diff --git a/README.md b/README.md index 9f96562a..db19e01a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

- +
- Play it here! + Launch in-browser demo

diff --git a/build/assets/blade_alpha.jpg b/build/assets/blade_alpha.jpg deleted file mode 100644 index b28c53de..00000000 Binary files a/build/assets/blade_alpha.jpg and /dev/null differ diff --git a/build/assets/blade_diffuse.jpg b/build/assets/blade_diffuse.jpg deleted file mode 100644 index 69090119..00000000 Binary files a/build/assets/blade_diffuse.jpg and /dev/null differ diff --git a/build/sketchbook.min.js b/build/sketchbook.min.js index 5a2e4e41..e97753a9 100644 --- a/build/sketchbook.min.js +++ b/build/sketchbook.min.js @@ -6,7 +6,7 @@ //!\ DECLARE ALIAS AFTER assign prototype ! Object.assign(Zl.prototype,{beforeStart_:Zl.prototype.copySampleValue_,afterEnd_:Zl.prototype.copySampleValue_}),Jl.prototype=Object.assign(Object.create(Zl.prototype),{constructor:Jl,DefaultSettings_:{endingStart:Re,endingEnd:Re},intervalChanged_:function(t,e,n){var i=this.parameterPositions,r=t-2,o=t+1,a=i[r],s=i[o];if(void 0===a)switch(this.getSettings_().endingStart){case Oe:r=t,a=2*e-n;break;case Fe:a=e+i[r=i.length-2]-i[r+1];break;default:r=t,a=n}if(void 0===s)switch(this.getSettings_().endingEnd){case Oe:o=t,s=2*n-e;break;case Fe:o=1,s=n+i[1]-i[0];break;default:o=t-1,s=e}var c=.5*(n-e),l=this.valueSize;this._weightPrev=c/(e-a),this._weightNext=c/(s-n),this._offsetPrev=r*l,this._offsetNext=o*l},interpolate_:function(t,e,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=s-a,l=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,p=this._weightNext,d=(n-e)/(i-e),f=d*d,m=f*d,v=-h*m+2*h*f-h*d,g=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*d+1,y=(-1-p)*m+(1.5+p)*f+.5*d,w=p*m-p*f,x=0;x!==a;++x)r[x]=v*o[l+x]+g*o[c+x]+y*o[s+x]+w*o[u+x];return r}}),$l.prototype=Object.assign(Object.create(Zl.prototype),{constructor:$l,interpolate_:function(t,e,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=s-a,l=(n-e)/(i-e),u=1-l,h=0;h!==a;++h)r[h]=o[c+h]*u+o[s+h]*l;return r}}),tu.prototype=Object.assign(Object.create(Zl.prototype),{constructor:tu,interpolate_:function(t){return this.copySampleValue_(t-1)}}),Object.assign(eu,{toJSON:function(t){var e,n=t.constructor;if(void 0!==n.toJSON)e=n.toJSON(t);else{e={name:t.name,times:Kl.convertArray(t.times,Array),values:Kl.convertArray(t.values,Array)};var i=t.getInterpolation();i!==t.DefaultInterpolation&&(e.interpolation=i)}return e.type=t.ValueTypeName,e}}),Object.assign(eu.prototype,{constructor:eu,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:Le,InterpolantFactoryMethodDiscrete:function(t){return new tu(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new $l(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new Jl(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e;switch(t){case Pe:e=this.InterpolantFactoryMethodDiscrete;break;case Le:e=this.InterpolantFactoryMethodLinear;break;case Ce:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=e,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Pe;case this.InterpolantFactoryMethodLinear:return Le;case this.InterpolantFactoryMethodSmooth:return Ce}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,n=0,i=e.length;n!==i;++n)e[n]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,n=0,i=e.length;n!==i;++n)e[n]*=t;return this},trim:function(t,e){for(var n=this.times,i=n.length,r=0,o=i-1;r!==i&&n[r]e;)--o;if(++o,0!==r||o!==i){r>=o&&(r=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=Kl.arraySlice(n,r,o),this.values=Kl.arraySlice(this.values,r*a,o*a)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);for(var o=null,a=0;a!==r;a++){var s=n[a];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,s),t=!1;break}if(null!==o&&o>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,s,o),t=!1;break}o=s}if(void 0!==i&&Kl.isTypedArray(i)){a=0;for(var c=i.length;a!==c;++a){var l=i[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),t=!1;break}}}return t},optimize:function(){for(var t=Kl.arraySlice(this.times),e=Kl.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===Ce,r=1,o=t.length-1,a=1;a0){t[r]=t[o];for(f=o*n,m=r*n,p=0;p!==n;++p)e[m+p]=e[f+p];++r}return r!==t.length?(this.times=Kl.arraySlice(t,0,r),this.values=Kl.arraySlice(e,0,r*n)):(this.times=t,this.values=e),this},clone:function(){var t=Kl.arraySlice(this.times,0),e=Kl.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}),nu.prototype=Object.assign(Object.create(eu.prototype),{constructor:nu,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:Pe,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),iu.prototype=Object.assign(Object.create(eu.prototype),{constructor:iu,ValueTypeName:"color"}),ru.prototype=Object.assign(Object.create(eu.prototype),{constructor:ru,ValueTypeName:"number"}),ou.prototype=Object.assign(Object.create(Zl.prototype),{constructor:ou,interpolate_:function(t,e,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=(n-e)/(i-e),l=s+a;s!==l;s+=4)In.slerpFlat(r,0,o,s-a,o,s,c);return r}}),au.prototype=Object.assign(Object.create(eu.prototype),{constructor:au,ValueTypeName:"quaternion",DefaultInterpolation:Le,InterpolantFactoryMethodLinear:function(t){return new ou(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),su.prototype=Object.assign(Object.create(eu.prototype),{constructor:su,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:Pe,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),cu.prototype=Object.assign(Object.create(eu.prototype),{constructor:cu,ValueTypeName:"vector"}),Object.assign(lu,{parse:function(t){for(var e=[],n=t.tracks,i=1/(t.fps||1),r=0,o=n.length;r!==o;++r)e.push(uu(n[r]).scale(i));return new lu(t.name,t.duration,e)},toJSON:function(t){for(var e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid},r=0,o=n.length;r!==o;++r)e.push(eu.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(t,e,n,i){for(var r=e.length,o=[],a=0;a1){var l=i[h=c[1]];l||(i[h]=l=[]),l.push(s)}}var u=[];for(var h in i)u.push(lu.CreateFromMorphTargetSequence(h,i[h],e,n));return u},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(t,e,n,i,r){if(0!==n.length){var o=[],a=[];Kl.flattenJSON(n,o,a,i),0!==o.length&&r.push(new t(e,o,a))}},i=[],r=t.name||"default",o=t.length||-1,a=t.fps||30,s=t.hierarchy||[],c=0;c0||0===t.search(/^data\:image\/jpeg/);r.format=i?Ht:Gt,r.needsUpdate=!0,void 0!==e&&e(r)}),n,i),r}}),Object.assign(Su.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){var n=this.getUtoTmapping(t);return this.getPoint(n,e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,n,i=[],r=this.getPoint(0),o=0;for(i.push(0),n=1;n<=t;n++)o+=(e=this.getPoint(n/t)).distanceTo(r),i.push(o),r=e;return this.cacheArcLengths=i,i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var n,i=this.getLengths(),r=0,o=i.length;n=e||t*i[o-1];for(var a,s=0,c=o-1;s<=c;)if((a=i[r=Math.floor(s+(c-s)/2)]-n)<0)s=r+1;else{if(!(a>0)){c=r;break}c=r-1}if(i[r=c]===n)return r/(o-1);var l=i[r];return(r+(n-l)/(i[r+1]-l))/(o-1)},getTangent:function(t){var e=t-1e-4,n=t+1e-4;e<0&&(e=0),n>1&&(n=1);var i=this.getPoint(e);return this.getPoint(n).clone().sub(i).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var n,i,r,o=new Dn,a=[],s=[],c=[],l=new Dn,u=new Wn;for(n=0;n<=t;n++)i=n/t,a[n]=this.getTangentAt(i),a[n].normalize();s[0]=new Dn,c[0]=new Dn;var h=Number.MAX_VALUE,p=Math.abs(a[0].x),d=Math.abs(a[0].y),f=Math.abs(a[0].z);for(p<=h&&(h=p,o.set(1,0,0)),d<=h&&(h=d,o.set(0,1,0)),f<=h&&o.set(0,0,1),l.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],l),c[0].crossVectors(a[0],s[0]),n=1;n<=t;n++)s[n]=s[n-1].clone(),c[n]=c[n-1].clone(),l.crossVectors(a[n-1],a[n]),l.length()>Number.EPSILON&&(l.normalize(),r=Math.acos(En.clamp(a[n-1].dot(a[n]),-1,1)),s[n].applyMatrix4(u.makeRotationAxis(l,r))),c[n].crossVectors(a[n],s[n]);if(!0===e)for(r=Math.acos(En.clamp(s[0].dot(s[t]),-1,1)),r/=t,a[0].dot(l.crossVectors(s[0],s[t]))>0&&(r=-r),n=1;n<=t;n++)s[n].applyMatrix4(u.makeRotationAxis(a[n],r*n)),c[n].crossVectors(a[n],s[n]);return{tangents:a,normals:s,binormals:c}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){var t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),Mu.prototype=Object.create(Su.prototype),Mu.prototype.constructor=Mu,Mu.prototype.isEllipseCurve=!0,Mu.prototype.getPoint=function(t,e){for(var n=e||new An,i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,o=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(u)/c)+1)*c:0===h&&u===c-1&&(u=c-2,h=1),this.closed||u>0?n=s[(u-1)%c]:(Tu.subVectors(s[0],s[1]).add(s[0]),n=Tu),i=s[u%c],r=s[(u+1)%c],this.closed||u+2i.length-2?i.length-1:o+1],u=i[o>i.length-3?i.length-1:o+2];return n.set(Ou(a,s.x,c.x,l.x,u.x),Ou(a,s.y,c.y,l.y,u.y)),n},ku.prototype.copy=function(t){Su.prototype.copy.call(this,t),this.points=[];for(var e=0,n=t.points.length;e=e){var r=n[i]-e,o=this.curves[i],a=o.getLength(),s=0===a?0:1-r/a;return o.getPointAt(s)}i++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,n=0,i=this.curves.length;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(t){Su.prototype.copy.call(this,t),this.curves=[];for(var e=0,n=t.curves.length;e0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var u=c.getPoint(1);return this.currentPoint.copy(u),this},copy:function(t){return Hu.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){var t=Hu.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return Hu.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}),Wu.prototype=Object.assign(Object.create(Gu.prototype),{constructor:Wu,getPointsHoles:function(t){for(var e=[],n=0,i=this.holes.length;n0){var o=new xu(new pu(e));o.setCrossOrigin(this.crossOrigin);for(var a=0,s=t.length;a0?new Ys(a,s):new qr(a,s);break;case"InstancedMesh":a=r(t.geometry),s=o(t.material);var c=t.count,l=t.instanceMatrix;(i=new ic(a,s,c)).instanceMatrix=new lr(new Float32Array(l.array),16);break;case"LOD":i=new Xs;break;case"Line":i=new uc(r(t.geometry),o(t.material),t.mode);break;case"LineLoop":i=new fc(r(t.geometry),o(t.material));break;case"LineSegments":i=new dc(r(t.geometry),o(t.material));break;case"PointCloud":case"Points":i=new xc(r(t.geometry),o(t.material));break;case"Sprite":i=new Hs(o(t.material));break;case"Group":i=new _s;break;default:i=new li}if(i.uuid=t.uuid,void 0!==t.name&&(i.name=t.name),void 0!==t.matrix?(i.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(i.matrixAutoUpdate=t.matrixAutoUpdate),i.matrixAutoUpdate&&i.matrix.decompose(i.position,i.quaternion,i.scale)):(void 0!==t.position&&i.position.fromArray(t.position),void 0!==t.rotation&&i.rotation.fromArray(t.rotation),void 0!==t.quaternion&&i.quaternion.fromArray(t.quaternion),void 0!==t.scale&&i.scale.fromArray(t.scale)),void 0!==t.castShadow&&(i.castShadow=t.castShadow),void 0!==t.receiveShadow&&(i.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(i.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(i.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&i.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(i.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(i.visible=t.visible),void 0!==t.frustumCulled&&(i.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(i.renderOrder=t.renderOrder),void 0!==t.userData&&(i.userData=t.userData),void 0!==t.layers&&(i.layers.mask=t.layers),void 0!==t.children)for(var u=t.children,h=0;hNumber.EPSILON){if(l<0&&(a=e[o],c=-c,s=e[r],l=-l),t.ys.y)continue;if(t.y===a.y){if(t.x===a.x)return!0}else{var u=l*(t.x-a.x)-c*(t.y-a.y);if(0===u)return!0;if(u<0)continue;i=!i}}else{if(t.y!==a.y)continue;if(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x)return!0}}return i}var r=dl.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return n(o);var a,s,c,l=[];if(1===o.length)return s=o[0],(c=new Wu).curves=s.curves,l.push(c),l;var u=!r(o[0].getPoints());u=t?!u:u;var h,p,d=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=o.length;g1){for(var w=!1,x=[],_=0,b=f.length;_0&&(w||(m=d))}g=0;for(var P=f.length;g0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t=.5)for(var o=0;o!==r;++o)t[e+o]=t[n+o]},_slerp:function(t,e,n,i){In.slerpFlat(t,e,t,e,t,n,i)},_lerp:function(t,e,n,i,r){for(var o=1-i,a=0;a!==r;++a){var s=e+a;t[s]=t[s]*o+t[n+a]*i}}});var Hh=new RegExp("[\\[\\]\\.:\\/]","g"),Gh="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Wh=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),qh=/(WCOD+)?/.source.replace("WCOD",Gh),Xh=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Yh=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Qh=new RegExp("^"+Wh+qh+Xh+Yh+"$"),Kh=["material","materials","bones"];function Zh(t,e,n){var i=n||Jh.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}function Jh(t,e,n){this.path=e,this.parsedPath=n||Jh.parseTrackName(e),this.node=Jh.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function $h(){this.uuid=En.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var e=0,n=arguments.length;e!==n;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}function tp(t,e,n){this._mixer=t,this._clip=e,this._localRoot=n||null;for(var i=e.tracks,r=i.length,o=new Array(r),a={endingStart:Re,endingEnd:Re},s=0;s!==r;++s){var c=i[s].createInterpolant(null);o[s]=c,c.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Ae,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function ep(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function np(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function ip(t,e,n){As.call(this,t,e),this.meshPerAttribute=n||1}function rp(t,e,n,i){this.ray=new Ni(t,e),this.near=n||0,this.far=i||1/0,this.camera=null,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function op(t,e){return t.distance-e.distance}function ap(t,e,n,i){if(!1!==t.visible&&(t.raycast(e,n),!0===i))for(var r=t.children,o=0,a=r.length;o=e){var u=e++,h=t[u];n[h.uuid]=l,t[l]=h,n[c]=u,t[u]=s;for(var p=0,d=r;p!==d;++p){var f=i[p],m=f[u],v=f[l];f[l]=m,f[u]=v}}}this.nCachedObjects_=e},uncache:function(){for(var t=this._objects,e=t.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,o=r.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a],l=c.uuid,u=i[l];if(void 0!==u)if(delete i[l],u0)for(var c=this._interpolants,l=this._propertyBindings,u=0,h=c.length;u!==h;++u)c[u].evaluate(a),l[u].accumulate(i,s)}else this._updateWeight(t)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t,n=this._clip.duration,i=this.loop,r=this._loopCount,o=i===Te;if(0===t)return-1===r?e:o&&1==(1&r)?n-e:e;if(i===Ee){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=n)e=n;else{if(!(e<0)){this.time=e;break t}e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=e,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),e>=n||e<0){var a=Math.floor(e/n);e-=n*a,r+=Math.abs(a);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?n:0,this.time=e,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){var c=t<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=e,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=e;if(o&&1==(1&r))return n-e}return e},_setEndings:function(t,e,n){var i=this._interpolantSettings;n?(i.endingStart=Oe,i.endingEnd=Oe):(i.endingStart=t?this.zeroSlopeAtStart?Oe:Re:Fe,i.endingEnd=e?this.zeroSlopeAtEnd?Oe:Re:Fe)},_scheduleFading:function(t,e,n){var i=this._mixer,r=i.time,o=this._weightInterpolant;null===o&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=r,s[0]=e,a[1]=r+t,s[1]=n,this}}),ep.prototype=Object.assign(Object.create(_n.prototype),{constructor:ep,_bindAction:function(t,e){var n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,o=t._propertyBindings,a=t._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];void 0===l&&(l={},c[s]=l);for(var u=0;u!==r;++u){var h=i[u],p=h.name,d=l[p];if(void 0!==d)o[u]=d;else{if(void 0!==(d=o[u])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=e&&e._propertyBindings[u].binding.parsedPath;++(d=new jh(Jh.create(n,p,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(d,s,p),o[u]=d}a[u].resultBuffer=d.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}for(var r=t._propertyBindings,o=0,a=r.length;o!==a;++o){var s=r[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,n=0,i=e.length;n!==i;++n){var r=e[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&ethis.max.x||t.ythis.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new An),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)},clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new An),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(t){return lp.copy(t).clamp(this.min,this.max).sub(t).length()},intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var hp=new Dn,pp=new Dn;function dp(t,e){this.start=void 0!==t?t:new Dn,this.end=void 0!==e?e:new Dn}function fp(t){li.call(this),this.material=t,this.render=function(){}}Object.assign(dp.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new Dn),t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new Dn),t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new Dn),this.delta(e).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(t,e){hp.subVectors(t,this.start),pp.subVectors(this.end,this.start);var n=pp.dot(pp),i=pp.dot(hp)/n;return e&&(i=En.clamp(i,0,1)),i},closestPointToPoint:function(t,e,n){var i=this.closestPointToPointParameter(t,e);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Dn),this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),fp.prototype=Object.create(li.prototype),fp.prototype.constructor=fp,fp.prototype.isImmediateRenderObject=!0;var mp=new Dn;function vp(t,e){li.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;for(var n=new Pr,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],r=0,o=1;r<32;r++,o++){var a=r/32*Math.PI*2,s=o/32*Math.PI*2;i.push(Math.cos(a),Math.sin(a),1,Math.cos(s),Math.sin(s),1)}n.setAttribute("position",new gr(i,3));var c=new rc({fog:!1});this.cone=new dc(n,c),this.add(this.cone),this.update()}vp.prototype=Object.create(li.prototype),vp.prototype.constructor=vp,vp.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},vp.prototype.update=function(){this.light.updateMatrixWorld();var t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),mp.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(mp),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var gp=new Dn,yp=new Wn,wp=new Wn;function xp(t){for(var e=function t(e){var n=[];e&&e.isBone&&n.push(e);for(var i=0;i.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{jp.set(t.z,0,-t.x).normalize();var e=Math.acos(t.y);this.quaternion.setFromAxisAngle(jp,e)}},Hp.prototype.setLength=function(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()},Hp.prototype.setColor=function(t){this.line.material.color.set(t),this.cone.material.color.set(t)},Hp.prototype.copy=function(t){return li.prototype.copy.call(this,t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this},Hp.prototype.clone=function(){return(new this.constructor).copy(this)},Gp.prototype=Object.create(dc.prototype),Gp.prototype.constructor=Gp;var Wp,qp,Xp,Yp,Qp=4,Kp=8,Zp=Math.pow(2,Kp),Jp=[.125,.215,.35,.446,.526,.582],$p=Kp-Qp+1+Jp.length,td=20,ed={[De]:0,[ze]:1,[Ue]:2,[je]:3,[He]:4,[Ge]:5,[Ve]:6},nd=new $u,id=(Wp=td,qp=new Float32Array(Wp),Xp=new Dn(0,1,0),(Yp=new Ul({defines:{n:Wp},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:qp},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:Xp},inputEncoding:{value:ed[De]},outputEncoding:{value:ed[De]}},vertexShader:Ad(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform int samples;\nuniform float weights[n];\nuniform bool latitudinal;\nuniform float dTheta;\nuniform float mipInt;\nuniform vec3 poleAxis;\n\n${Td()}\n\n#define ENVMAP_TYPE_CUBE_UV\n#include \n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tfor (int i = 0; i < n; i++) {\n\t\tif (i >= samples)\n\t\t\tbreak;\n\t\tfor (int dir = -1; dir < 2; dir += 2) {\n\t\t\tif (i == 0 && dir == 1)\n\t\t\t\tcontinue;\n\t\t\tvec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);\n\t\t\tif (all(equal(axis, vec3(0.0))))\n\t\t\t\taxis = cross(vec3(0.0, 1.0, 0.0), vOutputDirection);\n\t\t\taxis = normalize(axis);\n\t\t\tfloat theta = dTheta * float(dir * i);\n\t\t\tfloat cosTheta = cos(theta);\n\t\t\t// Rodrigues' axis-angle rotation\n\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross(axis, vOutputDirection) * sin(theta)\n\t\t\t\t\t+ axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);\n\t\t\tgl_FragColor.rgb +=\n\t\t\t\t\tweights[i] * bilinearCubeUV(envMap, sampleDirection, mipInt);\n\t\t}\n\t}\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,blending:M,depthTest:!1,depthWrite:!1})).type="SphericalGaussianBlur",Yp),rd=null,od=null,{_lodPlanes:ad,_sizeLods:sd,_sigmas:cd}=function(){for(var t=[],e=[],n=[],i=Kp,r=0;r<$p;r++){var o=Math.pow(2,i);e.push(o);var a=1/o;r>Kp-Qp?a=Jp[r-Kp+Qp-1]:0==r&&(a=0),n.push(a);for(var s=1/(o-1),c=-s/2,l=1+s/2,u=[c,c,l,c,l,l,c,c,l,l,c,l],h=new Float32Array(108),p=new Float32Array(72),d=new Float32Array(36),f=0;f<6;f++){var m=f%3*2/3-1,v=f>2?0:-1,g=[m,v,0,m+2/3,v,0,m+2/3,v+1,0,m,v,0,m+2/3,v+1,0,m,v+1,0];h.set(g,18*f),p.set(u,12*f);var y=[f,f,f,f,f,f];d.set(y,6*f)}var w=new Pr;w.setAttribute("position",new lr(h,3)),w.setAttribute("uv",new lr(p,2)),w.setAttribute("faceIndex",new lr(d,1)),t.push(w),i>Qp&&i--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}(),ld=null,ud=null,hd=null,pd=(1+Math.sqrt(5))/2,dd=1/pd,fd=[new Dn(1,1,1),new Dn(-1,1,1),new Dn(1,1,-1),new Dn(-1,1,-1),new Dn(0,pd,dd),new Dn(0,pd,-dd),new Dn(dd,0,pd),new Dn(-dd,0,pd),new Dn(pd,dd,0),new Dn(-pd,dd,0)];function md(t){ud=t,yd(id)}function vd(t){var e={magFilter:xt,minFilter:xt,generateMipmaps:!1,type:t?t.type:Ct,format:t?t.format:Xt,encoding:t?t.encoding:Ue,depthBuffer:!1,stencilBuffer:!1},n=wd(e);return n.depthBuffer=!t,ld=wd(e),n}function gd(t){ld.dispose(),ud.setRenderTarget(hd),t.scissorTest=!1,t.setSize(t.width,t.height)}function yd(t){var e=new ui;e.add(new qr(ad[0],t)),ud.compile(e,nd)}function wd(t){var e=new On(3*Zp,3*Zp,t);return e.texture.mapping=mt,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function xd(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function _d(t){var e=ud.autoClear;ud.autoClear=!1;for(var n=1;n<$p;n++){bd(t,n-1,n,Math.sqrt(cd[n]*cd[n]-cd[n-1]*cd[n-1]),fd[(n-1)%fd.length])}ud.autoClear=e}function bd(t,e,n,i,r){Sd(t,ld,e,n,i,"latitudinal",r),Sd(ld,t,n,n,i,"longitudinal",r)}function Sd(t,e,n,i,r,o,a){"latitudinal"!==o&&"longitudinal"!==o&&console.error("blur direction must be either latitudinal or longitudinal!");var s=new ui;s.add(new qr(ad[i],id));var c=id.uniforms,l=sd[n]-1,u=isFinite(r)?Math.PI/(2*l):2*Math.PI/(2*td-1),h=r/u,p=isFinite(r)?1+Math.floor(3*h):td;p>td&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${p} samples when the maximum is set to ${td}`);for(var d=[],f=0,m=0;mKp-Qp?i-Kp+Qp:0),3*y,2*y),ud.setRenderTarget(e),ud.render(s,nd)}function Md(){var t=new Ul({uniforms:{envMap:{value:null},texelSize:{value:new An(1,1)},inputEncoding:{value:ed[De]},outputEncoding:{value:ed[De]}},vertexShader:Ad(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform vec2 texelSize;\n\n${Td()}\n\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tvec3 outputDirection = normalize(vOutputDirection);\n\tvec2 uv;\n\tuv.y = asin(clamp(outputDirection.y, -1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n\tuv.x = atan(outputDirection.z, outputDirection.x) * RECIPROCAL_PI2 + 0.5;\n\tvec2 f = fract(uv / texelSize - 0.5);\n\tuv -= f * texelSize;\n\tvec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x += texelSize.x;\n\tvec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.y += texelSize.y;\n\tvec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x -= texelSize.x;\n\tvec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tvec3 tm = mix(tl, tr, f.x);\n\tvec3 bm = mix(bl, br, f.x);\n\tgl_FragColor.rgb = mix(tm, bm, f.y);\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,blending:M,depthTest:!1,depthWrite:!1});return t.type="EquirectangularToCubeUV",t}function Ed(){var t=new Ul({uniforms:{envMap:{value:null},inputEncoding:{value:ed[De]},outputEncoding:{value:ed[De]}},vertexShader:Ad(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform samplerCube envMap;\n\n${Td()}\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tgl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb;\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,blending:M,depthTest:!1,depthWrite:!1});return t.type="CubemapToCubeUV",t}function Ad(){return"\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nvec3 getDirection(vec2 uv, float face) {\n\tuv = 2.0 * uv - 1.0;\n\tvec3 direction = vec3(uv, 1.0);\n\tif (face == 0.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 1.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 3.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.x *= -1.0;\n\t} else if (face == 4.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.y *= -1.0;\n\t} else if (face == 5.0) {\n\t\tdirection.xz *= -1.0;\n\t}\n\treturn direction;\n}\nvoid main() {\n\tvOutputDirection = getDirection(uv, faceIndex);\n\tgl_Position = vec4( position, 1.0 );\n}\n\t"}function Td(){return"\nuniform int inputEncoding;\nuniform int outputEncoding;\n\n#include \n\nvec4 inputTexelToLinear(vec4 value){\n\tif(inputEncoding == 0){\n\t\treturn value;\n\t}else if(inputEncoding == 1){\n\t\treturn sRGBToLinear(value);\n\t}else if(inputEncoding == 2){\n\t\treturn RGBEToLinear(value);\n\t}else if(inputEncoding == 3){\n\t\treturn RGBMToLinear(value, 7.0);\n\t}else if(inputEncoding == 4){\n\t\treturn RGBMToLinear(value, 16.0);\n\t}else if(inputEncoding == 5){\n\t\treturn RGBDToLinear(value, 256.0);\n\t}else{\n\t\treturn GammaToLinear(value, 2.2);\n\t}\n}\n\nvec4 linearToOutputTexel(vec4 value){\n\tif(outputEncoding == 0){\n\t\treturn value;\n\t}else if(outputEncoding == 1){\n\t\treturn LinearTosRGB(value);\n\t}else if(outputEncoding == 2){\n\t\treturn LinearToRGBE(value);\n\t}else if(outputEncoding == 3){\n\t\treturn LinearToRGBM(value, 7.0);\n\t}else if(outputEncoding == 4){\n\t\treturn LinearToRGBM(value, 16.0);\n\t}else if(outputEncoding == 5){\n\t\treturn LinearToRGBD(value, 256.0);\n\t}else{\n\t\treturn LinearToGamma(value, 2.2);\n\t}\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n\treturn inputTexelToLinear(color);\n}\n\t"}function Pd(t,e,n,i,r,o,a){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new rr(t,e,n,r,o,a)}md.prototype={constructor:md,fromScene:function(t,e=0,n=.1,i=100){hd=ud.getRenderTarget();var r=vd();return function(t,e,n,i){var r=new lo(90,1,e,n),o=[1,1,1,1,-1,1],a=[1,1,-1,-1,-1,1],s=ud.outputEncoding,c=ud.toneMapping,l=ud.toneMappingExposure,u=ud.getClearColor(),h=ud.getClearAlpha();ud.toneMapping=rt,ud.toneMappingExposure=1,ud.outputEncoding=De,t.scale.z*=-1;var p=t.background;if(p&&p.isColor){p.convertSRGBToLinear();var d=Math.max(p.r,p.g,p.b),f=Math.min(Math.max(Math.ceil(Math.log2(d)),-128),127);p=p.multiplyScalar(Math.pow(2,-f));var m=(f+128)/255;ud.setClearColor(p,m),t.background=null}for(var v=0;v<6;v++){var g=v%3;0==g?(r.up.set(0,o[v],0),r.lookAt(a[v],0,0)):1==g?(r.up.set(0,0,o[v]),r.lookAt(0,a[v],0)):(r.up.set(0,o[v],0),r.lookAt(0,0,a[v])),xd(i,g*Zp,v>2?Zp:0,Zp,Zp),ud.setRenderTarget(i),ud.render(t,r)}ud.toneMapping=c,ud.toneMappingExposure=l,ud.outputEncoding=s,ud.setClearColor(u,h),t.scale.z*=-1}(t,n,i,r),e>0&&bd(r,0,0,e),_d(r),gd(r),r},fromEquirectangular:function(t){return t.magFilter=xt,t.minFilter=xt,t.generateMipmaps=!1,this.fromCubemap(t)},fromCubemap:function(t){hd=ud.getRenderTarget();var e=vd(t);return function(t,e){var n=new ui;t.isCubeTexture?null==od&&(od=Ed()):null==rd&&(rd=Md());var i=t.isCubeTexture?od:rd;n.add(new qr(ad[0],i));var r=i.uniforms;r.envMap.value=t,t.isCubeTexture||r.texelSize.value.set(1/t.image.width,1/t.image.height);r.inputEncoding.value=ed[t.encoding],r.outputEncoding.value=ed[t.encoding],xd(e,0,0,3*Zp,2*Zp),ud.setRenderTarget(e),ud.render(n,nd)}(t,e),_d(e),gd(e),e},compileCubemapShader:function(){null==od&&yd(od=Ed())},compileEquirectangularShader:function(){null==rd&&yd(rd=Md())},dispose:function(){id.dispose(),null!=od&&od.dispose(),null!=rd&&rd.dispose();for(var t=0;t (http://steffe.se)",keywords:["cannon.js","cannon","physics","engine","3d"],main:"./src/Cannon.js",engines:{node:"*"},repository:{type:"git",url:"https://github.com/schteppe/cannon.js.git"},bugs:{url:"https://github.com/schteppe/cannon.js/issues"},licenses:[{type:"MIT"}],devDependencies:{browserify:"*",grunt:"^0.4.5","grunt-browserify":"^2.1.4","grunt-contrib-concat":"~0.1.3","grunt-contrib-jshint":"~0.1.1","grunt-contrib-nodeunit":"^0.4.1","grunt-contrib-uglify":"^0.5.1","grunt-contrib-yuidoc":"^0.5.2",jshint:"latest",nodeunit:"^0.9.0","uglify-js":"latest"},dependencies:{typescript:"^3.7.4"}}},{}],2:[function(t,e,n){e.exports={version:t("../package.json").version,AABB:t("./collision/AABB"),ArrayCollisionMatrix:t("./collision/ArrayCollisionMatrix"),Body:t("./objects/Body"),Box:t("./shapes/Box"),Broadphase:t("./collision/Broadphase"),Constraint:t("./constraints/Constraint"),ContactEquation:t("./equations/ContactEquation"),Narrowphase:t("./world/Narrowphase"),ConeTwistConstraint:t("./constraints/ConeTwistConstraint"),ContactMaterial:t("./material/ContactMaterial"),ConvexPolyhedron:t("./shapes/ConvexPolyhedron"),Cylinder:t("./shapes/Cylinder"),DistanceConstraint:t("./constraints/DistanceConstraint"),Equation:t("./equations/Equation"),EventTarget:t("./utils/EventTarget"),FrictionEquation:t("./equations/FrictionEquation"),GSSolver:t("./solver/GSSolver"),GridBroadphase:t("./collision/GridBroadphase"),Heightfield:t("./shapes/Heightfield"),HingeConstraint:t("./constraints/HingeConstraint"),LockConstraint:t("./constraints/LockConstraint"),Mat3:t("./math/Mat3"),Material:t("./material/Material"),NaiveBroadphase:t("./collision/NaiveBroadphase"),ObjectCollisionMatrix:t("./collision/ObjectCollisionMatrix"),Pool:t("./utils/Pool"),Particle:t("./shapes/Particle"),Plane:t("./shapes/Plane"),PointToPointConstraint:t("./constraints/PointToPointConstraint"),Quaternion:t("./math/Quaternion"),Ray:t("./collision/Ray"),RaycastVehicle:t("./objects/RaycastVehicle"),RaycastResult:t("./collision/RaycastResult"),RigidVehicle:t("./objects/RigidVehicle"),RotationalEquation:t("./equations/RotationalEquation"),RotationalMotorEquation:t("./equations/RotationalMotorEquation"),SAPBroadphase:t("./collision/SAPBroadphase"),SPHSystem:t("./objects/SPHSystem"),Shape:t("./shapes/Shape"),Solver:t("./solver/Solver"),Sphere:t("./shapes/Sphere"),SplitSolver:t("./solver/SplitSolver"),Spring:t("./objects/Spring"),Transform:t("./math/Transform"),Trimesh:t("./shapes/Trimesh"),Vec3:t("./math/Vec3"),Vec3Pool:t("./utils/Vec3Pool"),World:t("./world/World")}},{"../package.json":1,"./collision/AABB":3,"./collision/ArrayCollisionMatrix":4,"./collision/Broadphase":5,"./collision/GridBroadphase":6,"./collision/NaiveBroadphase":7,"./collision/ObjectCollisionMatrix":8,"./collision/Ray":10,"./collision/RaycastResult":11,"./collision/SAPBroadphase":12,"./constraints/ConeTwistConstraint":13,"./constraints/Constraint":14,"./constraints/DistanceConstraint":15,"./constraints/HingeConstraint":16,"./constraints/LockConstraint":17,"./constraints/PointToPointConstraint":18,"./equations/ContactEquation":20,"./equations/Equation":21,"./equations/FrictionEquation":22,"./equations/RotationalEquation":23,"./equations/RotationalMotorEquation":24,"./material/ContactMaterial":25,"./material/Material":26,"./math/Mat3":28,"./math/Quaternion":29,"./math/Transform":30,"./math/Vec3":31,"./objects/Body":32,"./objects/RaycastVehicle":33,"./objects/RigidVehicle":34,"./objects/SPHSystem":35,"./objects/Spring":36,"./shapes/Box":38,"./shapes/ConvexPolyhedron":39,"./shapes/Cylinder":40,"./shapes/Heightfield":41,"./shapes/Particle":42,"./shapes/Plane":43,"./shapes/Shape":44,"./shapes/Sphere":45,"./shapes/Trimesh":46,"./solver/GSSolver":47,"./solver/Solver":48,"./solver/SplitSolver":49,"./utils/EventTarget":50,"./utils/Pool":52,"./utils/Vec3Pool":55,"./world/Narrowphase":56,"./world/World":57}],3:[function(t,e,n){var i=t("../math/Vec3");function r(t){t=t||{},this.lowerBound=new i,t.lowerBound&&this.lowerBound.copy(t.lowerBound),this.upperBound=new i,t.upperBound&&this.upperBound.copy(t.upperBound)}t("../utils/Utils"),e.exports=r;var o=new i;r.prototype.setFromPoints=function(t,e,n,i){var r=this.lowerBound,a=this.upperBound,s=n;r.copy(t[0]),s&&s.vmult(r,r),a.copy(r);for(var c=1;ca.x&&(a.x=l.x),l.xa.y&&(a.y=l.y),l.ya.z&&(a.z=l.z),l.z=r.x&&e.y<=i.y&&n.y>=r.y&&e.z<=i.z&&n.z>=r.z},r.prototype.getCorners=function(t,e,n,i,r,o,a,s){var c=this.lowerBound,l=this.upperBound;t.copy(c),e.set(l.x,c.y,c.z),n.set(l.x,l.y,c.z),i.set(c.x,l.y,l.z),r.set(l.x,c.y,l.z),o.set(c.x,l.y,c.z),a.set(c.x,c.y,l.z),s.copy(l)};var a=[new i,new i,new i,new i,new i,new i,new i,new i];r.prototype.toLocalFrame=function(t,e){var n=a,i=n[0],r=n[1],o=n[2],s=n[3],c=n[4],l=n[5],u=n[6],h=n[7];this.getCorners(i,r,o,s,c,l,u,h);for(var p=0;8!==p;p++){var d=n[p];t.pointToLocal(d,d)}return e.setFromPoints(n)},r.prototype.toWorldFrame=function(t,e){var n=a,i=n[0],r=n[1],o=n[2],s=n[3],c=n[4],l=n[5],u=n[6],h=n[7];this.getCorners(i,r,o,s,c,l,u,h);for(var p=0;8!==p;p++){var d=n[p];t.pointToWorld(d,d)}return e.setFromPoints(n)},r.prototype.overlapsRay=function(t){var e=1/t._direction.x,n=1/t._direction.y,i=1/t._direction.z,r=(this.lowerBound.x-t.from.x)*e,o=(this.upperBound.x-t.from.x)*e,a=(this.lowerBound.y-t.from.y)*n,s=(this.upperBound.y-t.from.y)*n,c=(this.lowerBound.z-t.from.z)*i,l=(this.upperBound.z-t.from.z)*i,u=Math.max(Math.max(Math.min(r,o),Math.min(a,s)),Math.min(c,l)),h=Math.min(Math.min(Math.max(r,o),Math.max(a,s)),Math.max(c,l));return!(h<0||u>h)}},{"../math/Vec3":31,"../utils/Utils":54}],4:[function(t,e,n){function i(){this.matrix=[]}e.exports=i,i.prototype.get=function(t,e){if(t=t.index,(e=e.index)>t){var n=e;e=t,t=n}return this.matrix[(t*(t+1)>>1)+e-1]},i.prototype.set=function(t,e,n){if(t=t.index,(e=e.index)>t){var i=e;e=t,t=i}this.matrix[(t*(t+1)>>1)+e-1]=n?1:0},i.prototype.reset=function(){for(var t=0,e=this.matrix.length;t!==e;t++)this.matrix[t]=0},i.prototype.setNumObjects=function(t){this.matrix.length=t*(t-1)>>1}},{}],5:[function(t,e,n){var i=t("../objects/Body"),r=t("../math/Vec3"),o=t("../math/Quaternion");function a(){this.world=null,this.useBoundingBoxes=!1,this.dirty=!0}t("../shapes/Shape"),t("../shapes/Plane"),e.exports=a,a.prototype.collisionPairs=function(t,e,n){throw new Error("collisionPairs not implemented for this BroadPhase class!")},a.prototype.needBroadphaseCollision=function(t,e){return 0!=(t.collisionFilterGroup&e.collisionFilterMask)&&0!=(e.collisionFilterGroup&t.collisionFilterMask)&&(0==(t.type&i.STATIC)&&t.sleepState!==i.SLEEPING||0==(e.type&i.STATIC)&&e.sleepState!==i.SLEEPING)},a.prototype.intersectionTest=function(t,e,n,i){this.useBoundingBoxes?this.doBoundingBoxBroadphase(t,e,n,i):this.doBoundingSphereBroadphase(t,e,n,i)};var s=new r;new r,new o,new r,a.prototype.doBoundingSphereBroadphase=function(t,e,n,i){var r=s;e.position.vsub(t.position,r);var o=Math.pow(t.boundingRadius+e.boundingRadius,2);r.norm2()n.norm2()},a.prototype.aabbQuery=function(t,e,n){return console.warn(".aabbQuery is not implemented in this Broadphase subclass."),[]}},{"../math/Quaternion":29,"../math/Vec3":31,"../objects/Body":32,"../shapes/Plane":43,"../shapes/Shape":44}],6:[function(t,e,n){e.exports=a;var i=t("./Broadphase"),r=t("../math/Vec3"),o=t("../shapes/Shape");function a(t,e,n,o,a){i.apply(this),this.nx=n||10,this.ny=o||10,this.nz=a||10,this.aabbMin=t||new r(100,100,100),this.aabbMax=e||new r(-100,-100,-100);var s=this.nx*this.ny*this.nz;if(s<=0)throw"GridBroadphase: Each dimension's n must be >0";this.bins=[],this.binLengths=[],this.bins.length=s,this.binLengths.length=s;for(var c=0;c=l&&(s=l-1),c<0?c=0:c>=u&&(c=u-1),m<0?m=0:m>=h&&(m=h-1),v<0?v=0:v>=l&&(v=l-1),g<0?g=0:g>=u&&(g=u-1),M<0?M=0:M>=h&&(M=h-1),c*=d,m*=f,v*=p,g*=d,M*=f;for(var E=s*=p;E<=v;E+=p)for(var A=c;A<=g;A+=d)for(var T=m;T<=M;T+=f){var P=E+A+T;R[P][O[P]++]=a}}for(c=Math.min,a=Math.max,I=0;I!==i;I++){var D=(nt=r[I]).shape;switch(D.type){case L:var z=nt.position.x,V=nt.position.y,U=nt.position.z,k=D.radius;B(z-k,V-k,U-k,z+k,V+k,U+k,nt);break;case C:D.worldNormalNeedsUpdate&&D.computeWorldNormal(nt.quaternion);var j=D.worldNormal,H=y+.5*M-nt.position.x,G=w+.5*E-nt.position.y,W=x+.5*A-nt.position.z,q=s;q.set(H,G,W);for(var X=0,Y=0;X!==l;X++,Y+=p,q.y=G,q.x+=M)for(var Q=0,K=0;Q!==u;Q++,K+=d,q.z=W,q.y+=E)for(var Z=0,J=0;Z!==h;Z++,J+=f,q.z+=A)if(q.dot(j)1){var et=R[I];for(X=0;X!==tt;X++){var nt=et[X];for(Q=0;Q!==X;Q++){var it=et[Q];this.needBroadphaseCollision(nt,it)&&this.intersectionTest(nt,it,e,n)}}}}this.makePairsUnique(e,n)}},{"../math/Vec3":31,"../shapes/Shape":44,"./Broadphase":5}],7:[function(t,e,n){e.exports=o;var i=t("./Broadphase"),r=t("./AABB");function o(){i.apply(this)}o.prototype=new i,o.prototype.constructor=o,o.prototype.collisionPairs=function(t,e,n){var i,r,o,a,s=t.bodies,c=s.length;for(i=0;i!==c;i++)for(r=0;r!==i;r++)o=s[i],a=s[r],this.needBroadphaseCollision(o,a)&&this.intersectionTest(o,a,e,n)},new r,o.prototype.aabbQuery=function(t,e,n){n=n||[];for(var i=0;it){var n=e;e=t,t=n}return t+"-"+e in this.matrix},i.prototype.set=function(t,e,n){if(t=t.id,(e=e.id)>t){var i=e;e=t,t=i}n?this.matrix[t+"-"+e]=!0:delete this.matrix[t+"-"+e]},i.prototype.reset=function(){this.matrix={}},i.prototype.setNumObjects=function(t){}},{}],9:[function(t,e,n){function i(){this.current=[],this.previous=[]}function r(t,e){t.push((4294901760&e)>>16,65535&e)}e.exports=i,i.prototype.getKey=function(t,e){if(ei[r];)r++;if(n!==i[r]){for(e=i.length-1;e>=r;e--)i[e+1]=i[e];i[r]=n}},i.prototype.tick=function(){var t=this.current;this.current=this.previous,this.previous=t,this.current.length=0},i.prototype.getDiff=function(t,e){for(var n=this.current,i=this.previous,o=n.length,a=i.length,s=0,c=0;ci[s];)s++;l===i[s]||r(t,l)}for(s=0,c=0;cn[s];)s++;n[s]===u||r(e,u)}}},{}],10:[function(t,e,n){e.exports=l;var i=t("../math/Vec3"),r=t("../math/Quaternion"),o=t("../math/Transform"),a=(t("../shapes/ConvexPolyhedron"),t("../shapes/Box"),t("../collision/RaycastResult")),s=t("../shapes/Shape"),c=t("../collision/AABB");function l(t,e){this.from=t?t.clone():new i,this.to=e?e.clone():new i,this._direction=new i,this.precision=1e-4,this.checkCollisionResponse=!0,this.skipBackfaces=!1,this.collisionFilterMask=-1,this.collisionFilterGroup=-1,this.mode=l.ANY,this.result=new a,this.hasHit=!1,this.callback=function(t){}}l.prototype.constructor=l,l.CLOSEST=1,l.ANY=2,l.ALL=4;var u=new c,h=[];l.prototype.intersectWorld=function(t,e){return this.mode=e.mode||l.ANY,this.result=e.result||new a,this.skipBackfaces=!!e.skipBackfaces,this.collisionFilterMask=void 0!==e.collisionFilterMask?e.collisionFilterMask:-1,this.collisionFilterGroup=void 0!==e.collisionFilterGroup?e.collisionFilterGroup:-1,e.from&&this.from.copy(e.from),e.to&&this.to.copy(e.to),this.callback=e.callback||function(){},this.hasHit=!1,this.result.reset(),this._updateDirection(),this.getAABB(u),h.length=0,t.broadphase.aabbQuery(t,u,h),this.intersectBodies(h),this.hasHit};var p=new i,d=new i;function f(t,e,n,i){i.vsub(e,D),n.vsub(e,p),t.vsub(e,d);var r,o,a=D.dot(D),s=D.dot(p),c=D.dot(d),l=p.dot(p),u=p.dot(d);return(r=l*c-s*u)>=0&&(o=a*u-s*c)>=0&&r+ot.boundingSphereRadius)){var r=this[t.type];r&&r.call(this,t,e,n,i,t)}},new i,new i;var g=new i,y=new i,w=new i,x=new i;new i,new a,l.prototype.intersectBox=function(t,e,n,i,r){return this.intersectConvex(t.convexPolyhedronRepresentation,e,n,i,r)},l.prototype[s.types.BOX]=l.prototype.intersectBox,l.prototype.intersectPlane=function(t,e,n,r,o){var a=this.from,s=this.to,c=this._direction,l=new i(0,0,1);e.vmult(l,l);var u=new i;a.vsub(n,u);var h=u.dot(l);if(s.vsub(n,u),!(h*u.dot(l)>0||a.distanceTo(s)=0&&f<=1&&(o.lerp(a,f,p),p.vsub(n,d),d.normalize(),this.reportIntersection(d,p,r,i,-1)),this.result._shouldStop)return;m>=0&&m<=1&&(o.lerp(a,m,p),p.vsub(n,d),d.normalize(),this.reportIntersection(d,p,r,i,-1))}},l.prototype[s.types.SPHERE]=l.prototype.intersectSphere;var T=new i,P=(new i,new i,new i);l.prototype.intersectConvex=function(t,e,n,i,r,o){for(var a=T,s=P,c=o&&o.faceList||null,l=t.faces,u=t.vertices,h=t.faceNormals,p=this._direction,d=this.from,m=this.to,v=d.distanceTo(m),_=c?c.length:l.length,b=this.result,S=0;!b._shouldStop&&S<_;S++){var M=c?c[S]:S,E=l[M],A=h[M],L=e,C=n;s.copy(u[E[0]]),L.vmult(s,s),s.vadd(C,s),s.vsub(d,s),L.vmult(A,a);var R=p.dot(a);if(!(Math.abs(R)v||this.reportIntersection(a,g,r,i,M)}}}}},l.prototype[s.types.CONVEXPOLYHEDRON]=l.prototype.intersectConvex;var L=new i,C=new i,R=new i,O=new i,F=new i,I=new i,N=(new c,[]),B=new o;l.prototype.intersectTrimesh=function(t,e,n,i,r,a){var s=L,c=N,l=B,u=P,h=C,p=R,d=O,m=I,v=F,_=(a&&a.faceList,t.indices),b=(t.vertices,t.faceNormals,this.from),S=this.to,M=this._direction;l.position.copy(n),l.quaternion.copy(e),o.vectorToLocalFrame(n,e,M,h),o.pointToLocalFrame(n,e,b,p),o.pointToLocalFrame(n,e,S,d),d.x*=t.scale.x,d.y*=t.scale.y,d.z*=t.scale.z,p.x*=t.scale.x,p.y*=t.scale.y,p.z*=t.scale.z,d.vsub(p,h),h.normalize();var E=p.distanceSquared(d);t.tree.rayQuery(this,l,c);for(var A=0,T=c.length;!this.result._shouldStop&&A!==T;A++){var D=c[A];t.getNormal(D,s),t.getVertex(_[3*D],y),y.vsub(p,u);var z=h.dot(s),V=s.dot(u)/z;if(!(V<0)){h.scale(V,g),g.vadd(p,g),t.getVertex(_[3*D+1],w),t.getVertex(_[3*D+2],x);var U=g.distanceSquared(p);!f(g,w,y,x)&&!f(g,y,w,x)||U>E||(o.vectorToWorldFrame(e,s,v),o.pointToWorldFrame(n,e,g,m),this.reportIntersection(v,m,r,i,D))}}c.length=0},l.prototype[s.types.TRIMESH]=l.prototype.intersectTrimesh,l.prototype.reportIntersection=function(t,e,n,i,r){var o=this.from,a=this.to,s=o.distanceTo(e),c=this.result;if(!(this.skipBackfaces&&t.dot(this._direction)>0))switch(c.hitFaceIndex=void 0!==r?r:-1,this.mode){case l.ALL:this.hasHit=!0,c.set(o,a,t,e,n,i,s),c.hasHit=!0,this.callback(c);break;case l.CLOSEST:(s=0&&!(t[r].aabb.lowerBound.x<=i.aabb.lowerBound.x);r--)t[r+1]=t[r];t[r+1]=i}return t},r.insertionSortY=function(t){for(var e=1,n=t.length;e=0&&!(t[r].aabb.lowerBound.y<=i.aabb.lowerBound.y);r--)t[r+1]=t[r];t[r+1]=i}return t},r.insertionSortZ=function(t){for(var e=1,n=t.length;e=0&&!(t[r].aabb.lowerBound.z<=i.aabb.lowerBound.z);r--)t[r+1]=t[r];t[r+1]=i}return t},r.prototype.collisionPairs=function(t,e,n){var i,o,a=this.axisList,s=a.length,c=this.axisIndex;for(this.dirty&&(this.sortList(),this.dirty=!1),i=0;i!==s;i++){var l=a[i];for(o=i+1;om?f>v?0:2:m>v?1:2},r.prototype.aabbQuery=function(t,e,n){n=n||[],this.dirty&&(this.sortList(),this.dirty=!1);var i=this.axisIndex,r="x";1===i&&(r="y"),2===i&&(r="z");for(var o=this.axisList,a=(e.lowerBound[r],e.upperBound[r],0);a.499&&(n=2*Math.atan2(o,c),i=Math.PI/2,r=0),l<-.499&&(n=-2*Math.atan2(o,c),i=-Math.PI/2,r=0),isNaN(n)){var u=o*o,h=a*a,p=s*s;n=Math.atan2(2*a*c-2*o*s,1-2*h-2*p),i=Math.asin(2*l),r=Math.atan2(2*o*c-2*a*s,1-2*u-2*p)}break;default:throw new Error("Euler order "+e+" not supported yet.")}t.y=n,t.z=i,t.x=r},r.prototype.setFromEuler=function(t,e,n,i){i=i||"XYZ";var r=Math.cos(t/2),o=Math.cos(e/2),a=Math.cos(n/2),s=Math.sin(t/2),c=Math.sin(e/2),l=Math.sin(n/2);return"XYZ"===i?(this.x=s*o*a+r*c*l,this.y=r*c*a-s*o*l,this.z=r*o*l+s*c*a,this.w=r*o*a-s*c*l):"YXZ"===i?(this.x=s*o*a+r*c*l,this.y=r*c*a-s*o*l,this.z=r*o*l-s*c*a,this.w=r*o*a+s*c*l):"ZXY"===i?(this.x=s*o*a-r*c*l,this.y=r*c*a+s*o*l,this.z=r*o*l+s*c*a,this.w=r*o*a-s*c*l):"ZYX"===i?(this.x=s*o*a-r*c*l,this.y=r*c*a+s*o*l,this.z=r*o*l-s*c*a,this.w=r*o*a+s*c*l):"YZX"===i?(this.x=s*o*a+r*c*l,this.y=r*c*a+s*o*l,this.z=r*o*l-s*c*a,this.w=r*o*a-s*c*l):"XZY"===i&&(this.x=s*o*a-r*c*l,this.y=r*c*a-s*o*l,this.z=r*o*l+s*c*a,this.w=r*o*a+s*c*l),this},r.prototype.clone=function(){return new r(this.x,this.y,this.z,this.w)},r.prototype.slerp=function(t,e,n){n=n||new r;var i,o,a,s,c,l=this.x,u=this.y,h=this.z,p=this.w,d=t.x,f=t.y,m=t.z,v=t.w;return(o=l*d+u*f+h*m+p*v)<0&&(o=-o,d=-d,f=-f,m=-m,v=-v),1-o>1e-6?(i=Math.acos(o),a=Math.sin(i),s=Math.sin((1-e)*i)/a,c=Math.sin(e*i)/a):(s=1-e,c=e),n.x=s*l+c*d,n.y=s*u+c*f,n.z=s*h+c*m,n.w=s*p+c*v,n},r.prototype.integrate=function(t,e,n,i){i=i||new r;var o=t.x*n.x,a=t.y*n.y,s=t.z*n.z,c=this.x,l=this.y,u=this.z,h=this.w,p=.5*e;return i.x+=p*(o*h+a*u-s*l),i.y+=p*(a*h+s*c-o*u),i.z+=p*(s*h+o*l-a*c),i.w+=p*(-o*c-a*l-s*u),i}},{"./Vec3":31}],30:[function(t,e,n){var i=t("./Vec3"),r=t("./Quaternion");function o(t){t=t||{},this.position=new i,t.position&&this.position.copy(t.position),this.quaternion=new r,t.quaternion&&this.quaternion.copy(t.quaternion)}e.exports=o;var a=new r;o.pointToLocalFrame=function(t,e,n,r){return r=r||new i,n.vsub(t,r),e.conjugate(a),a.vmult(r,r),r},o.prototype.pointToLocal=function(t,e){return o.pointToLocalFrame(this.position,this.quaternion,t,e)},o.pointToWorldFrame=function(t,e,n,r){return r=r||new i,e.vmult(n,r),r.vadd(t,r),r},o.prototype.pointToWorld=function(t,e){return o.pointToWorldFrame(this.position,this.quaternion,t,e)},o.prototype.vectorToWorldFrame=function(t,e){return e=e||new i,this.quaternion.vmult(t,e),e},o.vectorToWorldFrame=function(t,e,n){return t.vmult(e,n),n},o.vectorToLocalFrame=function(t,e,n,r){return r=r||new i,e.w*=-1,e.vmult(n,r),e.w*=-1,r}},{"./Quaternion":29,"./Vec3":31}],31:[function(t,e,n){e.exports=r;var i=t("./Mat3");function r(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}r.ZERO=new r(0,0,0),r.UNIT_X=new r(1,0,0),r.UNIT_Y=new r(0,1,0),r.UNIT_Z=new r(0,0,1),r.prototype.cross=function(t,e){var n=t.x,i=t.y,o=t.z,a=this.x,s=this.y,c=this.z;return(e=e||new r).x=s*o-c*i,e.y=c*n-a*o,e.z=a*i-s*n,e},r.prototype.set=function(t,e,n){return this.x=t,this.y=e,this.z=n,this},r.prototype.setZero=function(){this.x=this.y=this.z=0},r.prototype.vadd=function(t,e){if(!e)return new r(this.x+t.x,this.y+t.y,this.z+t.z);e.x=t.x+this.x,e.y=t.y+this.y,e.z=t.z+this.z},r.prototype.vsub=function(t,e){if(!e)return new r(this.x-t.x,this.y-t.y,this.z-t.z);e.x=this.x-t.x,e.y=this.y-t.y,e.z=this.z-t.z},r.prototype.crossmat=function(){return new i([0,-this.z,this.y,this.z,0,-this.x,-this.y,this.x,0])},r.prototype.normalize=function(){var t=this.x,e=this.y,n=this.z,i=Math.sqrt(t*t+e*e+n*n);if(i>0){var r=1/i;this.x*=r,this.y*=r,this.z*=r}else this.x=0,this.y=0,this.z=0;return i},r.prototype.unit=function(t){t=t||new r;var e=this.x,n=this.y,i=this.z,o=Math.sqrt(e*e+n*n+i*i);return o>0?(o=1/o,t.x=e*o,t.y=n*o,t.z=i*o):(t.x=1,t.y=0,t.z=0),t},r.prototype.norm=function(){var t=this.x,e=this.y,n=this.z;return Math.sqrt(t*t+e*e+n*n)},r.prototype.length=r.prototype.norm,r.prototype.norm2=function(){return this.dot(this)},r.prototype.lengthSquared=r.prototype.norm2,r.prototype.distanceTo=function(t){var e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,a=t.z;return Math.sqrt((r-e)*(r-e)+(o-n)*(o-n)+(a-i)*(a-i))},r.prototype.distanceSquared=function(t){var e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,a=t.z;return(r-e)*(r-e)+(o-n)*(o-n)+(a-i)*(a-i)},r.prototype.mult=function(t,e){e=e||new r;var n=this.x,i=this.y,o=this.z;return e.x=t*n,e.y=t*i,e.z=t*o,e},r.prototype.vmul=function(t,e){return(e=e||new r).x=t.x*this.x,e.y=t.y*this.y,e.z=t.z*this.z,e},r.prototype.scale=r.prototype.mult,r.prototype.addScaledVector=function(t,e,n){return(n=n||new r).x=this.x+t*e.x,n.y=this.y+t*e.y,n.z=this.z+t*e.z,n},r.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},r.prototype.isZero=function(){return 0===this.x&&0===this.y&&0===this.z},r.prototype.negate=function(t){return(t=t||new r).x=-this.x,t.y=-this.y,t.z=-this.z,t};var o=new r,a=new r;r.prototype.tangents=function(t,e){var n=this.norm();if(n>0){var i=o,r=1/n;i.set(this.x*r,this.y*r,this.z*r);var s=a;Math.abs(i.x)<.9?(s.set(1,0,0),i.cross(s,t)):(s.set(0,1,0),i.cross(s,t)),i.cross(t,e)}else t.set(1,0,0),e.set(0,1,0)},r.prototype.toString=function(){return this.x+","+this.y+","+this.z},r.prototype.toArray=function(){return[this.x,this.y,this.z]},r.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},r.prototype.lerp=function(t,e,n){var i=this.x,r=this.y,o=this.z;n.x=i+(t.x-i)*e,n.y=r+(t.y-r)*e,n.z=o+(t.z-o)*e},r.prototype.almostEquals=function(t,e){return void 0===e&&(e=1e-6),!(Math.abs(this.x-t.x)>e||Math.abs(this.y-t.y)>e||Math.abs(this.z-t.z)>e)},r.prototype.almostZero=function(t){return void 0===t&&(t=1e-6),!(Math.abs(this.x)>t||Math.abs(this.y)>t||Math.abs(this.z)>t)};var s=new r;r.prototype.isAntiparallelTo=function(t,e){return this.negate(s),s.almostEquals(t,e)},r.prototype.clone=function(){return new r(this.x,this.y,this.z)}},{"./Mat3":28}],32:[function(t,e,n){e.exports=l;var i=t("../utils/EventTarget"),r=(t("../shapes/Shape"),t("../math/Vec3")),o=t("../math/Mat3"),a=t("../math/Quaternion"),s=(t("../material/Material"),t("../collision/AABB")),c=t("../shapes/Box");function l(t){t=t||{},i.apply(this),this.id=l.idCounter++,this.world=null,this.preStep=null,this.postStep=null,this.vlambda=new r,this.collisionFilterGroup="number"==typeof t.collisionFilterGroup?t.collisionFilterGroup:1,this.collisionFilterMask="number"==typeof t.collisionFilterMask?t.collisionFilterMask:-1,this.collisionResponse=!0,this.position=new r,this.previousPosition=new r,this.interpolatedPosition=new r,this.initPosition=new r,t.position&&(this.position.copy(t.position),this.previousPosition.copy(t.position),this.interpolatedPosition.copy(t.position),this.initPosition.copy(t.position)),this.velocity=new r,t.velocity&&this.velocity.copy(t.velocity),this.initVelocity=new r,this.force=new r;var e="number"==typeof t.mass?t.mass:0;this.mass=e,this.invMass=e>0?1/e:0,this.material=t.material||null,this.linearDamping="number"==typeof t.linearDamping?t.linearDamping:.01,this.type=e<=0?l.STATIC:l.DYNAMIC,typeof t.type==typeof l.STATIC&&(this.type=t.type),this.allowSleep=void 0===t.allowSleep||t.allowSleep,this.sleepState=0,this.sleepSpeedLimit=void 0!==t.sleepSpeedLimit?t.sleepSpeedLimit:.03,this.sleepTimeLimit=void 0!==t.sleepTimeLimit?t.sleepTimeLimit:1,this.timeLastSleepy=0,this._wakeUpAfterNarrowphase=!1,this.torque=new r,this.quaternion=new a,this.initQuaternion=new a,this.previousQuaternion=new a,this.interpolatedQuaternion=new a,t.quaternion&&(this.quaternion.copy(t.quaternion),this.initQuaternion.copy(t.quaternion),this.previousQuaternion.copy(t.quaternion),this.interpolatedQuaternion.copy(t.quaternion)),this.angularVelocity=new r,t.angularVelocity&&this.angularVelocity.copy(t.angularVelocity),this.initAngularVelocity=new r,this.shapes=[],this.shapeOffsets=[],this.shapeOrientations=[],this.inertia=new r,this.invInertia=new r,this.invInertiaWorld=new o,this.invMassSolve=0,this.invInertiaSolve=new r,this.invInertiaWorldSolve=new o,this.fixedRotation=void 0!==t.fixedRotation&&t.fixedRotation,this.angularDamping=void 0!==t.angularDamping?t.angularDamping:.01,this.linearFactor=new r(1,1,1),t.linearFactor&&this.linearFactor.copy(t.linearFactor),this.angularFactor=new r(1,1,1),t.angularFactor&&this.angularFactor.copy(t.angularFactor),this.aabb=new s,this.aabbNeedsUpdate=!0,this.boundingRadius=0,this.wlambda=new r,t.shape&&this.addShape(t.shape),this.updateMassProperties()}l.prototype=new i,l.prototype.constructor=l,l.COLLIDE_EVENT_NAME="collide",l.DYNAMIC=1,l.STATIC=2,l.KINEMATIC=4,l.AWAKE=0,l.SLEEPY=1,l.SLEEPING=2,l.idCounter=0,l.wakeupEvent={type:"wakeup"},l.prototype.wakeUp=function(){var t=this.sleepState;this.sleepState=0,this._wakeUpAfterNarrowphase=!1,t===l.SLEEPING&&this.dispatchEvent(l.wakeupEvent)},l.prototype.sleep=function(){this.sleepState=l.SLEEPING,this.velocity.set(0,0,0),this.angularVelocity.set(0,0,0),this._wakeUpAfterNarrowphase=!1},l.sleepyEvent={type:"sleepy"},l.sleepEvent={type:"sleep"},l.prototype.sleepTick=function(t){if(this.allowSleep){var e=this.sleepState,n=this.velocity.norm2()+this.angularVelocity.norm2(),i=Math.pow(this.sleepSpeedLimit,2);e===l.AWAKE&&ni?this.wakeUp():e===l.SLEEPY&&t-this.timeLastSleepy>this.sleepTimeLimit&&(this.sleep(),this.dispatchEvent(l.sleepEvent))}},l.prototype.updateSolveMassProperties=function(){this.sleepState===l.SLEEPING||this.type===l.KINEMATIC?(this.invMassSolve=0,this.invInertiaSolve.setZero(),this.invInertiaWorldSolve.setZero()):(this.invMassSolve=this.invMass,this.invInertiaSolve.copy(this.invInertia),this.invInertiaWorldSolve.copy(this.invInertiaWorld))},l.prototype.pointToLocalFrame=function(t,e){return e=e||new r,t.vsub(this.position,e),this.quaternion.conjugate().vmult(e,e),e},l.prototype.vectorToLocalFrame=function(t,e){return e=e||new r,this.quaternion.conjugate().vmult(t,e),e},l.prototype.pointToWorldFrame=function(t,e){return e=e||new r,this.interpolatedQuaternion.vmult(t,e),e.vadd(this.interpolatedPosition,e),e},l.prototype.vectorToWorldFrame=function(t,e){return e=e||new r,this.interpolatedQuaternion.vmult(t,e),e};var u=new r,h=new a;l.prototype.addShape=function(t,e,n){var i=new r,o=new a;return e&&i.copy(e),n&&o.copy(n),this.shapes.push(t),this.shapeOffsets.push(i),this.shapeOrientations.push(o),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0,t.body=this,this},l.prototype.updateBoundingRadius=function(){for(var t=this.shapes,e=this.shapeOffsets,n=t.length,i=0,r=0;r!==n;r++){var o=t[r];o.updateBoundingSphereRadius();var a=e[r].norm(),s=o.boundingSphereRadius;a+s>i&&(i=a+s)}this.boundingRadius=i};var p=new s;l.prototype.computeAABB=function(){for(var t=this.shapes,e=this.shapeOffsets,n=this.shapeOrientations,i=t.length,r=u,o=h,a=this.quaternion,s=this.aabb,c=p,l=0;l!==i;l++){var d=t[l];a.vmult(e[l],r),r.vadd(this.position,r),n[l].mult(a,o),d.calculateWorldAABB(r,o,c.lowerBound,c.upperBound),0===l?s.copy(c):s.extend(c)}this.aabbNeedsUpdate=!1};var d=new o,f=new o;new o,l.prototype.updateInertiaWorld=function(t){var e=this.invInertia;if(e.x!==e.y||e.y!==e.z||t){var n=d,i=f;n.setRotationFromQuaternion(this.quaternion),n.transpose(i),n.scale(e,n),n.mmult(i,this.invInertiaWorld)}},new r;var m=new r;l.prototype.applyForce=function(t,e){if(this.type===l.DYNAMIC){var n=m;e.cross(t,n),this.force.vadd(t,this.force),this.torque.vadd(n,this.torque)}};var v=new r,g=new r;l.prototype.applyLocalForce=function(t,e){if(this.type===l.DYNAMIC){var n=v,i=g;this.vectorToWorldFrame(t,n),this.vectorToWorldFrame(e,i),this.applyForce(n,i)}},new r;var y=new r,w=new r;l.prototype.applyImpulse=function(t,e){if(this.type===l.DYNAMIC){var n=e,i=y;i.copy(t),i.mult(this.invMass,i),this.velocity.vadd(i,this.velocity);var r=w;n.cross(t,r),this.invInertiaWorld.vmult(r,r),this.angularVelocity.vadd(r,this.angularVelocity)}};var x=new r,_=new r;l.prototype.applyLocalImpulse=function(t,e){if(this.type===l.DYNAMIC){var n=x,i=_;this.vectorToWorldFrame(t,n),this.vectorToWorldFrame(e,i),this.applyImpulse(n,i)}};var b=new r;l.prototype.updateMassProperties=function(){var t=b;this.invMass=this.mass>0?1/this.mass:0;var e=this.inertia,n=this.fixedRotation;this.computeAABB(),t.set((this.aabb.upperBound.x-this.aabb.lowerBound.x)/2,(this.aabb.upperBound.y-this.aabb.lowerBound.y)/2,(this.aabb.upperBound.z-this.aabb.lowerBound.z)/2),c.calculateInertia(t,this.mass,e),this.invInertia.set(e.x>0&&!n?1/e.x:0,e.y>0&&!n?1/e.y:0,e.z>0&&!n?1/e.z:0),this.updateInertiaWorld(!0)},l.prototype.getVelocityAtWorldPoint=function(t,e){var n=new r;return t.vsub(this.position,n),this.angularVelocity.cross(n,e),this.velocity.vadd(e,e),e},new r,new r,new a,new a,l.prototype.integrate=function(t,e,n){if(this.previousPosition.copy(this.position),this.previousQuaternion.copy(this.quaternion),(this.type===l.DYNAMIC||this.type===l.KINEMATIC)&&this.sleepState!==l.SLEEPING){var i=this.velocity,r=this.angularVelocity,o=this.position,a=this.force,s=this.torque,c=this.quaternion,u=this.invMass,h=this.invInertiaWorld,p=this.linearFactor,d=u*t;i.x+=a.x*d*p.x,i.y+=a.y*d*p.y,i.z+=a.z*d*p.z;var f=h.elements,m=this.angularFactor,v=s.x*m.x,g=s.y*m.y,y=s.z*m.z;r.x+=t*(f[0]*v+f[1]*g+f[2]*y),r.y+=t*(f[3]*v+f[4]*g+f[5]*y),r.z+=t*(f[6]*v+f[7]*g+f[8]*y),o.x+=i.x*t,o.y+=i.y*t,o.z+=i.z*t,c.integrate(this.angularVelocity,t,this.angularFactor,c),e&&(n?c.normalizeFast():c.normalize()),this.aabbNeedsUpdate=!0,this.updateInertiaWorld()}}},{"../collision/AABB":3,"../material/Material":26,"../math/Mat3":28,"../math/Quaternion":29,"../math/Vec3":31,"../shapes/Box":38,"../shapes/Shape":44,"../utils/EventTarget":50}],33:[function(t,e,n){t("./Body");var i=t("../math/Vec3"),r=t("../math/Quaternion"),o=(t("../collision/RaycastResult"),t("../collision/Ray")),a=t("../objects/WheelInfo");function s(t){this.chassisBody=t.chassisBody,this.wheelInfos=[],this.sliding=!1,this.world=null,this.indexRightAxis=void 0!==t.indexRightAxis?t.indexRightAxis:1,this.indexForwardAxis=void 0!==t.indexForwardAxis?t.indexForwardAxis:0,this.indexUpAxis=void 0!==t.indexUpAxis?t.indexUpAxis:2,this.numWheelsOnGround=0}e.exports=s,new i,new i,new i;var c=new i,l=new i,u=new i;new o,s.prototype.addWheel=function(t){var e=new a(t=t||{}),n=this.wheelInfos.length;return this.wheelInfos.push(e),n},s.prototype.setSteeringValue=function(t,e){this.wheelInfos[e].steering=t},new i,s.prototype.applyEngineForce=function(t,e){this.wheelInfos[e].engineForce=t},s.prototype.setBrake=function(t,e){this.wheelInfos[e].brake=t},s.prototype.addToWorld=function(t){this.constraints,t.addBody(this.chassisBody);var e=this;this.preStepCallback=function(){e.updateVehicle(t.dt)},t.addEventListener("preStep",this.preStepCallback),this.world=t},s.prototype.getVehicleAxisWorld=function(t,e){e.set(0===t?1:0,1===t?1:0,2===t?1:0),this.chassisBody.vectorToWorldFrame(e,e)},s.prototype.updateVehicle=function(t){if(!(this.chassisBody.sleepState>1)){for(var e=this.wheelInfos,n=e.length,r=this.chassisBody,o=0;od.maxSuspensionForce&&(l=d.maxSuspensionForce),d.raycastResult.hitNormalWorld.scale(l*t,s),d.raycastResult.hitPointWorld.vsub(r.position,c),r.applyImpulse(s,c)}this.updateFriction(t);var u=new i,h=new i,p=new i;for(o=0;o0?1:-1)*d.customSlidingRotationalSpeed*t),Math.abs(d.brake)>Math.abs(d.engineForce)&&(d.deltaRotation=0),d.lastRotation=d.rotation,d.rotation+=d.deltaRotation,d.deltaRotation*=.99}}},s.prototype.updateSuspension=function(t){for(var e=this.chassisBody.mass,n=this.wheelInfos,i=n.length,r=0;rm&&(t.suspensionLength=m,t.raycastResult.reset());var v=t.raycastResult.hitNormalWorld.dot(t.directionWorld),g=new i;r.getVelocityAtWorldPoint(t.raycastResult.hitPointWorld,g);var y=t.raycastResult.hitNormalWorld.dot(g);if(v>=-.1)t.suspensionRelativeVelocity=0,t.clippedInvContactDotSuspension=10;else{var w=-1/v;t.suspensionRelativeVelocity=y*w,t.clippedInvContactDotSuspension=w}}else t.suspensionLength=t.suspensionRestLength+0*t.maxSuspensionTravel,t.suspensionRelativeVelocity=0,t.directionWorld.scale(-1,t.raycastResult.hitNormalWorld),t.clippedInvContactDotSuspension=1;return o},s.prototype.updateWheelTransformWorld=function(t){t.isInContact=!1;var e=this.chassisBody;e.pointToWorldFrame(t.chassisConnectionPointLocal,t.chassisConnectionPointWorld),e.vectorToWorldFrame(t.directionLocal,t.directionWorld),e.vectorToWorldFrame(t.axleLocal,t.axleWorld)},s.prototype.updateWheelTransform=function(t){var e=c,n=l,i=u,o=this.wheelInfos[t];this.updateWheelTransformWorld(o),o.directionLocal.scale(-1,e),n.copy(o.axleLocal),e.cross(n,i),i.normalize(),n.normalize();var a=o.steering,s=new r;s.setFromAxisAngle(e,a);var h=new r;h.setFromAxisAngle(n,this.lerp(o.lastRotation,o.rotation,this.world.interpolationFactor));var p=o.worldTransform.quaternion;this.chassisBody.quaternion.mult(s,p),p.mult(h,p),p.normalize();var d=o.worldTransform.position;d.copy(o.directionWorld),d.scale(this.lerp(o.lastSuspensionLength,o.suspensionLength,this.world.interpolationFactor),d),d.vadd(o.chassisConnectionPointWorld,d)},s.prototype.lerp=function(t,e,n){return t+(e-t)*(n=(n=n<0?0:n)>1?1:n)};var d=[new i(1,0,0),new i(0,1,0),new i(0,0,1)];s.prototype.getWheelTransformWorld=function(t){return this.wheelInfos[t].worldTransform};var f=new i,m=[],v=[];s.prototype.updateFriction=function(t){var e=f,n=this.wheelInfos,r=n.length,o=this.chassisBody,a=v,s=m;this.numWheelsOnGround=0;for(var c=0;cb&&(this.sliding=!0,A.sliding=!0,w=_/Math.sqrt(E),A.skidInfo*=w)}}if(this.sliding)for(c=0;c1.1)return 0;var a=A,s=T,c=P;return t.getVelocityAtWorldPoint(e,a),n.getVelocityAtWorldPoint(i,s),a.vsub(s,c),-.2*r.dot(c)*(1/(t.invMass+n.invMass))}},{"../collision/Ray":10,"../collision/RaycastResult":11,"../math/Quaternion":29,"../math/Vec3":31,"../objects/WheelInfo":37,"./Body":32}],34:[function(t,e,n){var i=t("./Body"),r=t("../shapes/Sphere"),o=t("../shapes/Box"),a=t("../math/Vec3"),s=t("../constraints/HingeConstraint");function c(t){if(this.wheelBodies=[],this.coordinateSystem=void 0===t.coordinateSystem?new a(1,2,3):t.coordinateSystem.clone(),this.chassisBody=t.chassisBody,!this.chassisBody){var e=new o(new a(5,2,.5));this.chassisBody=new i(1,e)}this.constraints=[],this.wheelAxes=[],this.wheelForces=[]}e.exports=c,c.prototype.addWheel=function(t){var e=(t=t||{}).body;e||(e=new i(1,new r(1.2))),this.wheelBodies.push(e),this.wheelForces.push(0),new a;var n=void 0!==t.position?t.position.clone():new a,o=new a;this.chassisBody.pointToWorldFrame(n,o),e.position.set(o.x,o.y,o.z);var c=void 0!==t.axis?t.axis.clone():new a(0,1,0);this.wheelAxes.push(c);var l=new s(this.chassisBody,e,{pivotA:n,axisA:c,pivotB:a.ZERO,axisB:c,collideConnected:!1});return this.constraints.push(l),this.wheelBodies.length-1},c.prototype.setSteeringValue=function(t,e){var n=this.wheelAxes[e],i=Math.cos(t),r=Math.sin(t),o=n.x,a=n.y;this.constraints[e].axisA.set(i*o-r*a,r*o+i*a,0)},c.prototype.setMotorSpeed=function(t,e){var n=this.constraints[e];n.enableMotor(),n.motorTargetVelocity=t},c.prototype.disableMotor=function(t){this.constraints[t].disableMotor()};var l=new a;c.prototype.setWheelForce=function(t,e){this.wheelForces[e]=t},c.prototype.applyWheelForce=function(t,e){var n=this.wheelAxes[e],i=this.wheelBodies[e],r=i.torque;n.scale(t,l),i.vectorToWorldFrame(l,l),r.vadd(l,r)},c.prototype.addToWorld=function(t){for(var e=this.constraints,n=this.wheelBodies.concat([this.chassisBody]),i=0;ithis.particles.length&&this.neighbors.pop())};var o=new i;r.prototype.getNeighbors=function(t,e){for(var n=this.particles.length,i=t.id,r=this.smoothingRadius*this.smoothingRadius,a=o,s=0;s!==n;s++){var c=this.particles[s];c.position.vsub(t.position,a),i!==c.id&&a.norm2()=-.1)this.suspensionRelativeVelocity=0,this.clippedInvContactDotSuspension=10;else{var r=-1/n;this.suspensionRelativeVelocity=i*r,this.clippedInvContactDotSuspension=r}}else e.suspensionLength=this.suspensionRestLength,this.suspensionRelativeVelocity=0,e.directionWorld.scale(-1,e.hitNormalWorld),this.clippedInvContactDotSuspension=1}},{"../collision/RaycastResult":11,"../math/Transform":30,"../math/Vec3":31,"../utils/Utils":54}],38:[function(t,e,n){e.exports=a;var i=t("./Shape"),r=t("../math/Vec3"),o=t("./ConvexPolyhedron");function a(t){i.call(this,{type:i.types.BOX}),this.halfExtents=t,this.convexPolyhedronRepresentation=null,this.updateConvexPolyhedronRepresentation(),this.updateBoundingSphereRadius()}a.prototype=new i,a.prototype.constructor=a,a.prototype.updateConvexPolyhedronRepresentation=function(){var t=this.halfExtents.x,e=this.halfExtents.y,n=this.halfExtents.z,i=r,a=[new i(-t,-e,-n),new i(t,-e,-n),new i(t,e,-n),new i(-t,e,-n),new i(-t,-e,n),new i(t,-e,n),new i(t,e,n),new i(-t,e,n)],s=(new i(0,0,1),new i(0,1,0),new i(1,0,0),new o(a,[[3,2,1,0],[4,5,6,7],[5,4,0,1],[2,3,7,6],[0,4,7,3],[1,2,6,5]]));this.convexPolyhedronRepresentation=s,s.material=this.material},a.prototype.calculateLocalInertia=function(t,e){return e=e||new r,a.calculateInertia(this.halfExtents,t,e),e},a.calculateInertia=function(t,e,n){var i=t;n.x=1/12*e*(2*i.y*2*i.y+2*i.z*2*i.z),n.y=1/12*e*(2*i.x*2*i.x+2*i.z*2*i.z),n.z=1/12*e*(2*i.y*2*i.y+2*i.x*2*i.x)},a.prototype.getSideNormals=function(t,e){var n=t,i=this.halfExtents;if(n[0].set(i.x,0,0),n[1].set(0,i.y,0),n[2].set(0,0,i.z),n[3].set(-i.x,0,0),n[4].set(0,-i.y,0),n[5].set(0,0,-i.z),void 0!==e)for(var r=0;r!==n.length;r++)e.vmult(n[r],n[r]);return n},a.prototype.volume=function(){return 8*this.halfExtents.x*this.halfExtents.y*this.halfExtents.z},a.prototype.updateBoundingSphereRadius=function(){this.boundingSphereRadius=this.halfExtents.norm()};var s=new r;new r,a.prototype.forEachWorldCorner=function(t,e,n){for(var i=this.halfExtents,r=[[i.x,i.y,i.z],[-i.x,i.y,i.z],[-i.x,-i.y,i.z],[-i.x,-i.y,-i.z],[i.x,-i.y,-i.z],[i.x,i.y,-i.z],[-i.x,i.y,-i.z],[i.x,-i.y,i.z]],o=0;oi.x&&(i.x=s),l>i.y&&(i.y=l),u>i.z&&(i.z=u),sd&&(d=m,p=f)}for(var v=[],g=n.faces[p],y=g.length,w=0;w=0&&this.clipFaceAgainstHull(a,t,e,v,s,c,l)};var h=new r,p=new r,d=new r,f=new r,m=new r,v=new r;a.prototype.findSeparatingAxis=function(t,e,n,i,r,o,a,s){var c=h,l=p,u=d,g=f,y=m,w=v,x=Number.MAX_VALUE;if(this.uniqueAxes)for(b=0;b!==this.uniqueAxes.length;b++){if(n.vmult(this.uniqueAxes[b],c),!1===(E=this.testSepAxis(c,t,e,n,i,r)))return!1;E0&&o.negate(o),!0};var g=[],y=[];a.prototype.testSepAxis=function(t,e,n,i,r,o){a.project(this,t,n,i,g),a.project(e,t,r,o,y);var s=g[0],c=g[1],l=y[0],u=y[1];if(se&&(e=r)}this.maxValue=e},s.prototype.setHeightValueAtIndex=function(t,e,n){this.data[t][e]=n,this.clearCachedConvexTrianglePillar(t,e,!1),t>0&&(this.clearCachedConvexTrianglePillar(t-1,e,!0),this.clearCachedConvexTrianglePillar(t-1,e,!1)),e>0&&(this.clearCachedConvexTrianglePillar(t,e-1,!0),this.clearCachedConvexTrianglePillar(t,e-1,!1)),e>0&&t>0&&this.clearCachedConvexTrianglePillar(t-1,e-1,!0)},s.prototype.getRectMinMax=function(t,e,n,i,r){r=r||[];for(var o=this.data,a=this.minValue,s=t;s<=n;s++)for(var c=e;c<=i;c++){var l=o[s][c];l>a&&(a=l)}r[0]=this.minValue,r[1]=a},s.prototype.getIndexOfPosition=function(t,e,n,i){var r=this.elementSize,o=this.data,a=Math.floor(t/r),s=Math.floor(e/r);return n[0]=a,n[1]=s,i&&(a<0&&(a=0),s<0&&(s=0),a>=o.length-1&&(a=o.length-1),s>=o[0].length-1&&(s=o[0].length-1)),!(a<0||s<0||a>=o.length-1||s>=o[0].length-1)};var c=[],l=new o,u=new o,h=new o,p=new o;s.prototype.getTriangleAt=function(t,e,n,i,r,o){var a=c;this.getIndexOfPosition(t,e,a,n);var s=a[0],l=a[1],u=this.data;n&&(s=Math.min(u.length-2,Math.max(0,s)),l=Math.min(u[0].length-2,Math.max(0,l)));var h=this.elementSize,p=Math.pow(t/h-s,2)+Math.pow(e/h-l,2)>Math.pow(t/h-(s+1),2)+Math.pow(e/h-(l+1),2);return this.getTriangle(s,l,p,i,r,o),p};var d=new o,f=new o,m=new o,v=new o,g=new o;s.prototype.getNormalAt=function(t,e,n,i){var r=d,o=f,a=m,s=v,c=g;this.getTriangleAt(t,e,n,r,o,a),o.vsub(r,s),a.vsub(r,c),s.cross(c,i),i.normalize()},s.prototype.getAabbAtIndex=function(t,e,n){var i=this.data,r=this.elementSize;n.lowerBound.set(t*r,e*r,i[t][e]),n.upperBound.set((t+1)*r,(e+1)*r,i[t+1][e+1])},s.prototype.getHeightAt=function(t,e,n){var i=this.data,r=u,o=h,a=p,s=c;this.getIndexOfPosition(t,e,s,n);var d=s[0],f=s[1];n&&(d=Math.min(i.length-2,Math.max(0,d)),f=Math.min(i[0].length-2,Math.max(0,f)));var m=this.getTriangleAt(t,e,n,r,o,a);!function(t,e,n,i,r,o,a,s,c){c.x=((o-s)*(t-a)+(a-r)*(e-s))/((o-s)*(n-a)+(a-r)*(i-s)),c.y=((s-i)*(t-a)+(n-a)*(e-s))/((o-s)*(n-a)+(a-r)*(i-s)),c.z=1-c.x-c.y}(t,e,r.x,r.y,o.x,o.y,a.x,a.y,l);var v=l;return m?i[d+1][f+1]*v.x+i[d][f+1]*v.y+i[d+1][f]*v.z:i[d][f]*v.x+i[d+1][f]*v.y+i[d][f+1]*v.z},s.prototype.getCacheConvexTrianglePillarKey=function(t,e,n){return t+"_"+e+"_"+(n?1:0)},s.prototype.getCachedConvexTrianglePillar=function(t,e,n){return this._cachedPillars[this.getCacheConvexTrianglePillarKey(t,e,n)]},s.prototype.setCachedConvexTrianglePillar=function(t,e,n,i,r){this._cachedPillars[this.getCacheConvexTrianglePillarKey(t,e,n)]={convex:i,offset:r}},s.prototype.clearCachedConvexTrianglePillar=function(t,e,n){delete this._cachedPillars[this.getCacheConvexTrianglePillarKey(t,e,n)]},s.prototype.getTriangle=function(t,e,n,i,r,o){var a=this.data,s=this.elementSize;n?(i.set((t+1)*s,(e+1)*s,a[t+1][e+1]),r.set(t*s,(e+1)*s,a[t][e+1]),o.set((t+1)*s,e*s,a[t+1][e])):(i.set(t*s,e*s,a[t][e]),r.set((t+1)*s,e*s,a[t+1][e]),o.set(t*s,(e+1)*s,a[t][e+1]))},s.prototype.getConvexTrianglePillar=function(t,e,n){var i=this.pillarConvex,a=this.pillarOffset;if(this.cacheEnabled){if(s=this.getCachedConvexTrianglePillar(t,e,n))return this.pillarConvex=s.convex,void(this.pillarOffset=s.offset);i=new r,a=new o,this.pillarConvex=i,this.pillarOffset=a}var s=this.data,c=this.elementSize,l=i.faces;i.vertices.length=6;for(var u=0;u<6;u++)i.vertices[u]||(i.vertices[u]=new o);for(l.length=5,u=0;u<5;u++)l[u]||(l[u]=[]);var h=i.vertices,p=(Math.min(s[t][e],s[t+1][e],s[t][e+1],s[t+1][e+1])-this.minValue)/2+this.minValue;n?(a.set((t+.75)*c,(e+.75)*c,p),h[0].set(.25*c,.25*c,s[t+1][e+1]-p),h[1].set(-.75*c,.25*c,s[t][e+1]-p),h[2].set(.25*c,-.75*c,s[t+1][e]-p),h[3].set(.25*c,.25*c,-p-1),h[4].set(-.75*c,.25*c,-p-1),h[5].set(.25*c,-.75*c,-p-1),l[0][0]=0,l[0][1]=1,l[0][2]=2,l[1][0]=5,l[1][1]=4,l[1][2]=3,l[2][0]=2,l[2][1]=5,l[2][2]=3,l[2][3]=0,l[3][0]=3,l[3][1]=4,l[3][2]=1,l[3][3]=0,l[4][0]=1,l[4][1]=4,l[4][2]=5,l[4][3]=2):(a.set((t+.25)*c,(e+.25)*c,p),h[0].set(-.25*c,-.25*c,s[t][e]-p),h[1].set(.75*c,-.25*c,s[t+1][e]-p),h[2].set(-.25*c,.75*c,s[t][e+1]-p),h[3].set(-.25*c,-.25*c,-p-1),h[4].set(.75*c,-.25*c,-p-1),h[5].set(-.25*c,.75*c,-p-1),l[0][0]=0,l[0][1]=1,l[0][2]=2,l[1][0]=5,l[1][1]=4,l[1][2]=3,l[2][0]=0,l[2][1]=2,l[2][2]=5,l[2][3]=3,l[3][0]=1,l[3][1]=0,l[3][2]=3,l[3][3]=4,l[4][0]=4,l[4][1]=5,l[4][2]=2,l[4][3]=1),i.computeNormals(),i.computeEdges(),i.updateBoundingSphereRadius(),this.setCachedConvexTrianglePillar(t,e,n,i,a)},s.prototype.calculateLocalInertia=function(t,e){return(e=e||new o).set(0,0,0),e},s.prototype.volume=function(){return Number.MAX_VALUE},s.prototype.calculateWorldAABB=function(t,e,n,i){n.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),i.set(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE)},s.prototype.updateBoundingSphereRadius=function(){var t=this.data,e=this.elementSize;this.boundingSphereRadius=new o(t.length*e,t[0].length*e,Math.max(Math.abs(this.maxValue),Math.abs(this.minValue))).norm()},s.prototype.setHeightsFromImage=function(t,e){var n=document.createElement("canvas");n.width=t.width,n.height=t.height;var i=n.getContext("2d");i.drawImage(t,0,0);var r=i.getImageData(0,0,t.width,t.height),o=this.data;o.length=0,this.elementSize=Math.abs(e.x)/r.width;for(var a=0;an.x&&(n.x=r.x),r.yn.y&&(n.y=r.y),r.zn.z&&(n.z=r.z)},c.prototype.updateAABB=function(){this.computeLocalAABB(this.aabb)},c.prototype.updateBoundingSphereRadius=function(){for(var t=0,e=this.vertices,n=new r,i=0,o=e.length/3;i!==o;i++){this.getVertex(i,n);var a=n.norm2();a>t&&(t=a)}this.boundingSphereRadius=Math.sqrt(t)},new r;var x=new o,_=new a;c.prototype.calculateWorldAABB=function(t,e,n,i){var r=x,o=_;r.position=t,r.quaternion=e,this.aabb.toWorldFrame(r,o),n.copy(o.lowerBound),i.copy(o.upperBound)},c.prototype.volume=function(){return 4*Math.PI*this.boundingSphereRadius/3},c.createTorus=function(t,e,n,i,r){t=t||1,e=e||.5,n=n||8,i=i||6,r=r||2*Math.PI;for(var o=[],a=[],s=0;s<=n;s++)for(var l=0;l<=i;l++){var u=l/i*r,h=s/n*Math.PI*2,p=(t+e*Math.cos(h))*Math.cos(u),d=(t+e*Math.cos(h))*Math.sin(u),f=e*Math.sin(h);o.push(p,d,f)}for(s=1;s<=n;s++)for(l=1;l<=i;l++){var m=(i+1)*s+l-1,v=(i+1)*(s-1)+l-1,g=(i+1)*(s-1)+l,y=(i+1)*s+l;a.push(m,v,y),a.push(v,g,y)}return new c(o,a)}},{"../collision/AABB":3,"../math/Quaternion":29,"../math/Transform":30,"../math/Vec3":31,"../utils/Octree":51,"./Shape":44}],47:[function(t,e,n){e.exports=r,t("../math/Vec3"),t("../math/Quaternion");var i=t("./Solver");function r(){i.call(this),this.iterations=10,this.tolerance=1e-7}r.prototype=new i;var o=[],a=[],s=[];r.prototype.solve=function(t,e){var n,i,r,c,l,u=0,h=this.iterations,p=this.tolerance*this.tolerance,d=this.equations,f=d.length,m=e.bodies,v=m.length,g=t;if(0!==f)for(var y=0;y!==v;y++)m[y].updateSolveMassProperties();var w=a,x=s,_=o;for(w.length=f,x.length=f,_.length=f,y=0;y!==f;y++){var b=d[y];_[y]=0,x[y]=b.computeB(g),w[y]=1/b.computeC()}if(0!==f){for(y=0;y!==v;y++){var S=(A=m[y]).vlambda,M=A.wlambda;S.set(0,0,0),M.set(0,0,0)}for(u=0;u!==h;u++){c=0;for(var E=0;E!==f;E++)b=d[E],n=x[E],i=w[E],(l=_[E])+(r=i*(n-b.computeGWlambda()-b.eps*l))b.maxForce&&(r=b.maxForce-l),_[E]+=r,c+=r>0?r:-r,b.addToWlambda(r);if(c*c=0;t--)this.children[t].removeEmptyNodes(),this.children[t].children.length||this.children[t].data.length||this.children.splice(t,1)}},{"../collision/AABB":3,"../math/Vec3":31}],52:[function(t,e,n){function i(){this.objects=[],this.type=Object}e.exports=i,i.prototype.release=function(){for(var t=arguments.length,e=0;e!==t;e++)this.objects.push(arguments[e]);return this},i.prototype.get=function(){return 0===this.objects.length?this.constructObject():this.objects.pop()},i.prototype.constructObject=function(){throw new Error("constructObject() not implemented in this Pool subclass yet!")},i.prototype.resize=function(t){for(var e=this.objects;e.length>t;)e.pop();for(;e.lengthe){var n=e;e=t,t=n}return this.data[t+"-"+e]},i.prototype.set=function(t,e,n){if(t>e){var i=e;e=t,t=i}var r=t+"-"+e;this.get(t,e)||this.data.keys.push(r),this.data[r]=n},i.prototype.reset=function(){for(var t=this.data,e=t.keys;e.length>0;)delete t[e.pop()]}},{}],54:[function(t,e,n){function i(){}e.exports=i,i.defaults=function(t,e){for(var n in t=t||{},e)n in t||(t[n]=e[n]);return t}},{}],55:[function(t,e,n){e.exports=o;var i=t("../math/Vec3"),r=t("./Pool");function o(){r.call(this),this.type=i}o.prototype=new r,o.prototype.constructObject=function(){return new i}},{"../math/Vec3":31,"./Pool":52}],56:[function(t,e,n){e.exports=d;var i=t("../collision/AABB"),r=t("../objects/Body"),o=t("../shapes/Shape"),a=t("../collision/Ray"),s=t("../math/Vec3"),c=t("../math/Transform"),l=(t("../shapes/ConvexPolyhedron"),t("../math/Quaternion")),u=(t("../solver/Solver"),t("../utils/Vec3Pool")),h=t("../equations/ContactEquation"),p=t("../equations/FrictionEquation");function d(t){this.contactPointPool=[],this.frictionEquationPool=[],this.result=[],this.frictionResult=[],this.v3pool=new u,this.world=t,this.currentContactMaterial=null,this.enableFrictionReduction=!1}d.prototype.createContactEquation=function(t,e,n,i,r,o){var a;this.contactPointPool.length?((a=this.contactPointPool.pop()).bi=t,a.bj=e):a=new h(t,e),a.enabled=t.collisionResponse&&e.collisionResponse&&n.collisionResponse&&i.collisionResponse;var s=this.currentContactMaterial;a.restitution=s.restitution,a.setSpookParams(s.contactEquationStiffness,s.contactEquationRelaxation,this.world.dt);var c=n.material||t.material,l=i.material||e.material;return c&&l&&c.restitution>=0&&l.restitution>=0&&(a.restitution=c.restitution*l.restitution),a.si=r||n,a.sj=o||i,a},d.prototype.createFrictionEquationsFromContact=function(t,e){var n=t.bi,i=t.bj,r=t.si,o=t.sj,a=this.world,s=this.currentContactMaterial,c=s.friction,l=r.material||n.material,u=o.material||i.material;if(l&&u&&l.friction>=0&&u.friction>=0&&(c=l.friction*u.friction),c>0){var h=c*a.gravity.length(),d=n.invMass+i.invMass;d>0&&(d=1/d);var f=this.frictionEquationPool,m=f.length?f.pop():new p(n,i,h*d),v=f.length?f.pop():new p(n,i,h*d);return m.bi=v.bi=n,m.bj=v.bj=i,m.minForce=v.minForce=-h*d,m.maxForce=v.maxForce=h*d,m.ri.copy(t.ri),m.rj.copy(t.rj),v.ri.copy(t.ri),v.rj.copy(t.rj),t.ni.tangents(m.t,v.t),m.setSpookParams(s.frictionEquationStiffness,s.frictionEquationRelaxation,a.dt),v.setSpookParams(s.frictionEquationStiffness,s.frictionEquationRelaxation,a.dt),m.enabled=v.enabled=t.enabled,e.push(m,v),!0}return!1};var f=new s,m=new s,v=new s;d.prototype.createFrictionFromAverage=function(t){var e=this.result[this.result.length-1];if(this.createFrictionEquationsFromContact(e,this.frictionResult)&&1!==t){var n=this.frictionResult[this.frictionResult.length-2],i=this.frictionResult[this.frictionResult.length-1];f.setZero(),m.setZero(),v.setZero();for(var r=e.bi,o=(e.bj,0);o!==t;o++)(e=this.result[this.result.length-1-o]).bodyA!==r?(f.vadd(e.ni,f),m.vadd(e.ri,m),v.vadd(e.rj,v)):(f.vsub(e.ni,f),m.vadd(e.rj,m),v.vadd(e.ri,v));var a=1/t;m.scale(a,n.ri),v.scale(a,n.rj),i.ri.copy(n.ri),i.rj.copy(n.rj),f.normalize(),f.tangents(n.t,i.t)}};var g=new s,y=new s,w=new l,x=new l;d.prototype.getContacts=function(t,e,n,i,o,a,s){this.contactPointPool=o,this.frictionEquationPool=s,this.result=i,this.frictionResult=a;for(var c=w,l=x,u=g,h=y,p=0,d=t.length;p!==d;p++){var f=t[p],m=e[p],v=null;f.material&&m.material&&(v=n.getContactMaterial(f.material,m.material)||null);for(var _=f.type&r.KINEMATIC&&m.type&r.STATIC||f.type&r.STATIC&&m.type&r.KINEMATIC||f.type&r.KINEMATIC&&m.type&r.KINEMATIC,b=0;bS.boundingSphereRadius+E.boundingSphereRadius)){var A=null;S.material&&E.material&&(A=n.getContactMaterial(S.material,E.material)||null),this.currentContactMaterial=A||v||n.defaultContactMaterial;var T=this[S.type|E.type];T&&(S.type0&&H<0&&(g.vsub(d,y),v.copy(m),v.normalize(),G=y.dot(v),v.scale(G,y),y.vadd(d,y),(Z=y.distanceTo(g))0&&!0===i||u<=0&&!1===i))return!1;null===i&&(i=u>0)}return!0}var W=new s,q=new s,X=new s,Y=new s,Q=[new s,new s,new s,new s,new s,new s],K=new s,Z=new s,J=new s,$=new s;d.prototype[o.types.SPHERE|o.types.BOX]=d.prototype.sphereBox=function(t,e,n,i,r,o,a,s,c,l,u){var h=this.v3pool,p=Q;n.vsub(i,W),e.getSideNormals(p,o);for(var d=t.radius,f=!1,m=Z,v=J,g=$,y=null,w=0,x=0,_=0,b=null,S=0,M=p.length;S!==M&&!1===f;S++){var E=q;E.copy(p[S]);var A=E.norm();E.normalize();var T=W.dot(E);if(T0){var P=X,L=Y;P.copy(p[(S+1)%3]),L.copy(p[(S+2)%3]);var C=P.norm(),R=L.norm();P.normalize(),L.normalize();var O=W.dot(P),F=W.dot(L);if(O-C&&F-R){var I=Math.abs(T-A-d);if((null===b||I0){for(var C=[],R=0,O=S.length;R!==O;R++){var F=h.get();o.vmult(f[S[R]],F),i.vadd(F,F),C.push(F)}if(G(C,M,n)){if(u)return!0;x=!0;var I=this.createContactEquation(a,s,t,e,c,l);M.mult(-m,I.ri),M.negate(I.ni);var N=h.get();M.mult(-P,N);var B=h.get();M.mult(-m,B),n.vsub(i,I.rj),I.rj.vadd(B,I.rj),I.rj.vadd(N,I.rj),I.rj.vadd(i,I.rj),I.rj.vsub(s.position,I.rj),I.ri.vadd(n,I.ri),I.ri.vsub(a.position,I.ri),h.release(N),h.release(B),this.result.push(I),this.createFrictionEquationsFromContact(I,this.frictionResult),R=0;for(var D=C.length;R!==D;R++)h.release(C[R]);return}for(R=0;R!==S.length;R++){var z=h.get(),V=h.get();o.vmult(f[S[(R+1)%S.length]],z),o.vmult(f[S[(R+2)%S.length]],V),i.vadd(z,z),i.vadd(V,V);var U=et;V.vsub(z,U);var k=nt;U.unit(k);var j=h.get(),H=h.get();n.vsub(z,H);var W=H.dot(k);k.mult(W,j),j.vadd(z,j);var q=h.get();if(j.vsub(n,q),W>0&&W*Wt.boundingSphereRadius+e.boundingSphereRadius)&&t.findSeparatingAxis(e,n,r,i,o,d,h,p)){var f=[],m=mt;t.clipAgainstHull(n,r,e,i,o,d,-100,100,f);for(var v=0,g=0;g!==f.length;g++){if(u)return!0;var y=this.createContactEquation(a,s,t,e,c,l),w=y.ri,x=y.rj;d.negate(y.ni),f[g].normal.negate(m),m.mult(f[g].depth,m),f[g].point.vadd(m,w),x.copy(f[g].point),w.vsub(n,w),x.vsub(i,x),w.vadd(n,w),w.vsub(a.position,w),x.vadd(i,x),x.vsub(s.position,x),this.result.push(y),v++,this.enableFrictionReduction||this.createFrictionEquationsFromContact(y,this.frictionResult)}this.enableFrictionReduction&&v&&this.createFrictionFromAverage(v)}};var vt=new s,gt=new s,yt=new s;d.prototype[o.types.PLANE|o.types.PARTICLE]=d.prototype.planeParticle=function(t,e,n,i,r,o,a,s,c,l,u){var h=vt;h.set(0,0,1),a.quaternion.vmult(h,h);var p=gt;if(i.vsub(a.position,p),h.dot(p)<=0){if(u)return!0;var d=this.createContactEquation(s,a,e,t,c,l);d.ni.copy(h),d.ni.negate(d.ni),d.ri.set(0,0,0);var f=yt;h.mult(h.dot(i),f),i.vsub(f,f),d.rj.copy(f),this.result.push(d),this.createFrictionEquationsFromContact(d,this.frictionResult)}};var wt=new s;d.prototype[o.types.PARTICLE|o.types.SPHERE]=d.prototype.sphereParticle=function(t,e,n,i,r,o,a,s,c,l,u){var h=wt;if(h.set(0,0,1),i.vsub(n,h),h.norm2()<=t.radius*t.radius){if(u)return!0;var p=this.createContactEquation(s,a,e,t,c,l);h.normalize(),p.rj.copy(h),p.rj.mult(t.radius,p.rj),p.ni.copy(h),p.ni.negate(p.ni),p.ri.set(0,0,0),this.result.push(p),this.createFrictionEquationsFromContact(p,this.frictionResult)}};var xt=new l,_t=new s,bt=(new s,new s),St=new s,Mt=new s;d.prototype[o.types.PARTICLE|o.types.CONVEXPOLYHEDRON]=d.prototype.convexParticle=function(t,e,n,i,r,o,a,s,c,l,u){var h=-1,p=bt,d=Mt,f=null,m=_t;if(m.copy(i),m.vsub(n,m),r.conjugate(xt),xt.vmult(m,m),t.pointIsInside(m)){t.worldVerticesNeedsUpdate&&t.computeWorldVertices(n,r),t.worldFaceNormalsNeedsUpdate&&t.computeWorldFaceNormals(r);for(var v=0,g=t.faces.length;v!==g;v++){var y=[t.worldVertices[t.faces[v][0]]],w=t.worldFaceNormals[v];i.vsub(y[0],St);var x=-w.dot(St);if(null===f||Math.abs(x)p.length||x>p[0].length)){y<0&&(y=0),w<0&&(w=0),x<0&&(x=0),_<0&&(_=0),y>=p.length&&(y=p.length-1),w>=p.length&&(w=p.length-1),_>=p[0].length&&(_=p[0].length-1),x>=p[0].length&&(x=p[0].length-1);var b=[];e.getRectMinMax(y,x,w,_,b);var S=b[0],M=b[1];if(!(g.z-f>M||g.z+fp.length||w>p[0].length)){g<0&&(g=0),y<0&&(y=0),w<0&&(w=0),x<0&&(x=0),g>=p.length&&(g=p.length-1),y>=p.length&&(y=p.length-1),x>=p[0].length&&(x=p[0].length-1),w>=p[0].length&&(w=p[0].length-1);var _=[];e.getRectMinMax(g,w,y,x,_);var b=_[0],S=_[1];if(!(v.z-d>S||v.z+d2)return}}}},{"../collision/AABB":3,"../collision/Ray":10,"../equations/ContactEquation":20,"../equations/FrictionEquation":22,"../math/Quaternion":29,"../math/Transform":30,"../math/Vec3":31,"../objects/Body":32,"../shapes/ConvexPolyhedron":39,"../shapes/Shape":44,"../solver/Solver":48,"../utils/Vec3Pool":55}],57:[function(t,e,n){e.exports=y,t("../shapes/Shape");var i=t("../math/Vec3"),r=t("../math/Quaternion"),o=t("../solver/GSSolver"),a=(t("../equations/ContactEquation"),t("../equations/FrictionEquation"),t("./Narrowphase")),s=t("../utils/EventTarget"),c=t("../collision/ArrayCollisionMatrix"),l=t("../collision/OverlapKeeper"),u=t("../material/Material"),h=t("../material/ContactMaterial"),p=t("../objects/Body"),d=t("../utils/TupleDictionary"),f=t("../collision/RaycastResult"),m=t("../collision/AABB"),v=t("../collision/Ray"),g=t("../collision/NaiveBroadphase");function y(t){t=t||{},s.apply(this),this.dt=-1,this.allowSleep=!!t.allowSleep,this.contacts=[],this.frictionEquations=[],this.quatNormalizeSkip=void 0!==t.quatNormalizeSkip?t.quatNormalizeSkip:0,this.quatNormalizeFast=void 0!==t.quatNormalizeFast&&t.quatNormalizeFast,this.time=0,this.interpolationFactor=0,this.stepnumber=0,this.default_dt=1/60,this.nextId=0,this.gravity=new i,t.gravity&&this.gravity.copy(t.gravity),this.broadphase=void 0!==t.broadphase?t.broadphase:new g,this.bodies=[],this.solver=void 0!==t.solver?t.solver:new o,this.constraints=[],this.narrowphase=new a(this),this.collisionMatrix=new c,this.collisionMatrixPrevious=new c,this.bodyOverlapKeeper=new l,this.shapeOverlapKeeper=new l,this.materials=[],this.contactmaterials=[],this.contactMaterialTable=new d,this.defaultMaterial=new u("default"),this.defaultContactMaterial=new h(this.defaultMaterial,this.defaultMaterial,{friction:.3,restitution:0}),this.doProfiling=!1,this.profile={solve:0,makeContactConstraints:0,broadphase:0,integrate:0,narrowphase:0},this.accumulator=0,this.subsystems=[],this.addBodyEvent={type:"addBody",body:null},this.removeBodyEvent={type:"removeBody",body:null},this.idToBodyMap={},this.broadphase.setWorld(this)}y.prototype=new s,new m;var w=new v;if(y.prototype.getContactMaterial=function(t,e){return this.contactMaterialTable.get(t.id,e.id)},y.prototype.numObjects=function(){return this.bodies.length},y.prototype.collisionMatrixTick=function(){var t=this.collisionMatrixPrevious;this.collisionMatrixPrevious=this.collisionMatrix,this.collisionMatrix=t,this.collisionMatrix.reset(),this.bodyOverlapKeeper.tick(),this.shapeOverlapKeeper.tick()},y.prototype.add=y.prototype.addBody=function(t){-1===this.bodies.indexOf(t)&&(t.index=this.bodies.length,this.bodies.push(t),t.world=this,t.initPosition.copy(t.position),t.initVelocity.copy(t.velocity),t.timeLastSleepy=this.time,t instanceof p&&(t.initAngularVelocity.copy(t.angularVelocity),t.initQuaternion.copy(t.quaternion)),this.collisionMatrix.setNumObjects(this.bodies.length),this.addBodyEvent.body=t,this.idToBodyMap[t.id]=t,this.dispatchEvent(this.addBodyEvent))},y.prototype.addConstraint=function(t){this.constraints.push(t)},y.prototype.removeConstraint=function(t){var e=this.constraints.indexOf(t);-1!==e&&this.constraints.splice(e,1)},y.prototype.rayTest=function(t,e,n){n instanceof f?this.raycastClosest(t,e,{skipBackfaces:!0},n):this.raycastAll(t,e,{skipBackfaces:!0},n)},y.prototype.raycastAll=function(t,e,n,i){return n.mode=v.ALL,n.from=t,n.to=e,n.callback=i,w.intersectWorld(this,n)},y.prototype.raycastAny=function(t,e,n,i){return n.mode=v.ANY,n.from=t,n.to=e,n.result=i,w.intersectWorld(this,n)},y.prototype.raycastClosest=function(t,e,n,i){return n.mode=v.CLOSEST,n.from=t,n.to=e,n.result=i,w.intersectWorld(this,n)},y.prototype.remove=function(t){t.world=null;var e=this.bodies.length-1,n=this.bodies,i=n.indexOf(t);if(-1!==i){n.splice(i,1);for(var r=0;r!==n.length;r++)n[r].index=r;this.collisionMatrix.setNumObjects(e),this.removeBodyEvent.body=t,delete this.idToBodyMap[t.id],this.dispatchEvent(this.removeBodyEvent)}},y.prototype.removeBody=y.prototype.remove,y.prototype.getBodyById=function(t){return this.idToBodyMap[t]},y.prototype.getShapeById=function(t){for(var e=this.bodies,n=0,i=e.length;n=t&&i=0;S-=1)(k.bodyA===i[S]&&k.bodyB===r[S]||k.bodyB===i[S]&&k.bodyA===r[S])&&(i.splice(S,1),r.splice(S,1));this.collisionMatrixTick(),l&&(e=performance.now());var M=C,E=n.length;for(y=0;y!==E;y++)M.push(n[y]);n.length=0;var A=this.frictionEquations.length;for(y=0;y!==A;y++)f.push(this.frictionEquations[y]);for(this.frictionEquations.length=0,this.narrowphase.getContacts(i,r,this,n,M,this.frictionEquations,f),l&&(u.narrowphase=performance.now()-e),l&&(e=performance.now()),y=0;y=0&&z.material.friction>=0&&(D.material.friction,z.material.friction),D.material.restitution>=0&&z.material.restitution>=0&&(k.restitution=D.material.restitution*z.material.restitution)),s.addEquation(k),D.allowSleep&&D.type===p.DYNAMIC&&D.sleepState===p.SLEEPING&&z.sleepState===p.AWAKE&&z.type!==p.STATIC&&z.velocity.norm2()+z.angularVelocity.norm2()>=2*Math.pow(z.sleepSpeedLimit,2)&&(D._wakeUpAfterNarrowphase=!0),z.allowSleep&&z.type===p.DYNAMIC&&z.sleepState===p.SLEEPING&&D.sleepState===p.AWAKE&&D.type!==p.STATIC&&D.velocity.norm2()+D.angularVelocity.norm2()>=2*Math.pow(D.sleepSpeedLimit,2)&&(z._wakeUpAfterNarrowphase=!0),this.collisionMatrix.set(D,z,!0),this.collisionMatrixPrevious.get(D,z)||(L.body=z,L.contact=k,D.dispatchEvent(L),L.body=D,z.dispatchEvent(L)),this.bodyOverlapKeeper.set(D.id,z.id),this.shapeOverlapKeeper.set(V.id,U.id)}for(this.emitContactEvents(),l&&(u.makeContactConstraints=performance.now()-e,e=performance.now()),y=0;y!==o;y++)(D=a[y])._wakeUpAfterNarrowphase&&(D.wakeUp(),D._wakeUpAfterNarrowphase=!1);for(b=d.length,y=0;y!==b;y++){var k;(k=d[y]).update(),S=0;for(var j=k.equations.length;S!==j;S++){var H=k.equations[S];s.addEquation(H)}}s.solve(t,this),l&&(u.solve=performance.now()-e),s.removeAllEquations();var G=Math.pow;for(y=0;y!==o;y++)if((D=a[y]).type&h){var W=G(I(1-D.linearDamping),t),q=D.velocity;q.mult(W,q);var X=D.angularVelocity;if(X){var Y=G(I(1-D.angularDamping),t);X.mult(Y,X)}}for(this.dispatchEvent(P),y=0;y!==o;y++)(D=a[y]).preStep&&D.preStep(D);l&&(e=performance.now());var Q=this.stepnumber%(this.quatNormalizeSkip+1)==0,K=this.quatNormalizeFast;for(y=0;y!==o;y++)a[y].integrate(t,Q,K);for(this.clearForces(),this.broadphase.dirty=!0,l&&(u.integrate=performance.now()-e),this.time+=t,this.stepnumber+=1,this.dispatchEvent(T),y=0;y!==o;y++){var Z=(D=a[y]).postStep;Z&&Z(D)}if(this.allowSleep)for(y=0;y!==o;y++)a[y].sleepTick(this.time)},y.prototype.emitContactEvents=(_=[],b=[],S={type:"beginContact",bodyA:null,bodyB:null},M={type:"endContact",bodyA:null,bodyB:null},E={type:"beginShapeContact",bodyA:null,bodyB:null,shapeA:null,shapeB:null},A={type:"endShapeContact",bodyA:null,bodyB:null,shapeA:null,shapeB:null},function(){var t=this.hasAnyEventListener("beginContact"),e=this.hasAnyEventListener("endContact");if((t||e)&&this.bodyOverlapKeeper.getDiff(_,b),t){for(var n=0,i=_.length;n1-n?0:i<-1+n?Math.PI:Math.acos(i)},e.getSignedAngleBetweenVectors=function(t,e,n,r){void 0===n&&(n=new i.Vector3(0,1,0)),void 0===r&&(r=5e-4);var o=this.getAngleBetweenVectors(t,e,r),a=(new i.Vector3).crossVectors(t,e);return n.dot(a)<0&&(o=-o),o},e.haveSameSigns=function(t,e){return t<0==e<0},e.haveDifferentSigns=function(t,e){return t<0!=e<0},e.setDefaults=function(t,e){return o.defaults({},o.clone(t),e)},e.getGlobalProperties=function(t){void 0===t&&(t="");var e=[],n=window;for(var i in n)0===i.indexOf(t)&&e.push(i);return e},e.spring=function(t,e,n,i,r){var o=e-t;n+=o/=i;var s=t+(n*=r);return new a.SimulationFrame(s,n)},e.springV=function(t,e,n,r,o){var a=(new i.Vector3).subVectors(e,t);a.divideScalar(r),n.add(a),n.multiplyScalar(o),t.add(n)},e.threeVector=function(t){return new i.Vector3(t.x,t.y,t.z)},e.cannonVector=function(t){return new r.Vec3(t.x,t.y,t.z)},e.threeQuat=function(t){return new i.Quaternion(t.x,t.y,t.z,t.w)},e.cannonQuat=function(t){return new r.Quaternion(t.x,t.y,t.z,t.w)},e.setupMeshProperties=function(t){if(t.castShadow=!0,t.receiveShadow=!0,null!==t.material.map){var e=new i.MeshPhongMaterial;e.shininess=0,e.name=t.material.name,e.map=t.material.map,e.map.anisotropy=4,e.aoMap=t.material.aoMap,e.transparent=t.material.transparent,e.skinning=t.material.skinning,t.material=e}},e.detectRelativeSide=function(t,e){var n=l(t,c.Space.Local),i=e.position.clone().sub(t.position).normalize();return n.dot(i)>0?s.Side.Left:s.Side.Right},e.easeInOutSine=function(t){return-(Math.cos(Math.PI*t)-1)/2},e.easeOutQuad=function(t){return 1-(1-t)*(1-t)},e.getRight=l,e.getUp=function(t,e){void 0===e&&(e=c.Space.Global);var n=u(t,e);return new i.Vector3(n.elements[4],n.elements[5],n.elements[6])},e.getForward=function(t,e){void 0===e&&(e=c.Space.Global);var n=u(t,e);return new i.Vector3(n.elements[8],n.elements[9],n.elements[10])},e.getBack=function(t,e){void 0===e&&(e=c.Space.Global);var n=u(t,e);return new i.Vector3(-n.elements[8],-n.elements[9],-n.elements[10])},e.getMatrix=u,e.countSleepyBodies=function(){}},function(t,e,n){"use strict";function i(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),i(n(61)),i(n(62)),i(n(25)),i(n(63)),i(n(64)),i(n(16)),i(n(8)),i(n(65)),i(n(66)),i(n(67)),i(n(68)),i(n(69)),i(n(70)),i(n(71)),i(n(72)),i(n(73)),i(n(74)),i(n(75)),i(n(76))},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var i,r,o,a=n(0);function s(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}Object.assign(s.prototype,{setSize:function(){},render:function(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}),s.FullScreenQuad=(i=new a.OrthographicCamera(-1,1,1,-1,0,1),r=new a.PlaneBufferGeometry(2,2),o=function(t){this._mesh=new a.Mesh(r,t)},Object.defineProperty(o.prototype,"material",{get:function(){return this._mesh.material},set:function(t){this._mesh.material=t}}),Object.assign(o.prototype,{dispose:function(){this._mesh.geometry.dispose()},render:function(t){t.render(this._mesh,i)}}),o)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.Left="left",t.Right="right"}(e.Side||(e.Side={}))},function(t,e,n){(function(t,i){var r; +Object.assign(Jh.prototype,{_getValue_unbound:Jh.prototype.getValue,_setValue_unbound:Jh.prototype.setValue}),Object.assign($h.prototype,{isAnimationObjectGroup:!0,add:function(){for(var t=this._objects,e=t.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._paths,o=this._parsedPaths,a=this._bindings,s=a.length,c=void 0,l=0,u=arguments.length;l!==u;++l){var h=arguments[l],p=h.uuid,d=i[p];if(void 0===d){d=e++,i[p]=d,t.push(h);for(var f=0,m=s;f!==m;++f)a[f].push(new Jh(h,r[f],o[f]))}else if(d=e){var u=e++,h=t[u];n[h.uuid]=l,t[l]=h,n[c]=u,t[u]=s;for(var p=0,d=r;p!==d;++p){var f=i[p],m=f[u],v=f[l];f[l]=m,f[u]=v}}}this.nCachedObjects_=e},uncache:function(){for(var t=this._objects,e=t.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,o=r.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a],l=c.uuid,u=i[l];if(void 0!==u)if(delete i[l],u0)for(var c=this._interpolants,l=this._propertyBindings,u=0,h=c.length;u!==h;++u)c[u].evaluate(a),l[u].accumulate(i,s)}else this._updateWeight(t)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t,n=this._clip.duration,i=this.loop,r=this._loopCount,o=i===Te;if(0===t)return-1===r?e:o&&1==(1&r)?n-e:e;if(i===Ee){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=n)e=n;else{if(!(e<0)){this.time=e;break t}e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=e,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),e>=n||e<0){var a=Math.floor(e/n);e-=n*a,r+=Math.abs(a);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?n:0,this.time=e,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){var c=t<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=e,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=e;if(o&&1==(1&r))return n-e}return e},_setEndings:function(t,e,n){var i=this._interpolantSettings;n?(i.endingStart=Oe,i.endingEnd=Oe):(i.endingStart=t?this.zeroSlopeAtStart?Oe:Re:Fe,i.endingEnd=e?this.zeroSlopeAtEnd?Oe:Re:Fe)},_scheduleFading:function(t,e,n){var i=this._mixer,r=i.time,o=this._weightInterpolant;null===o&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=r,s[0]=e,a[1]=r+t,s[1]=n,this}}),ep.prototype=Object.assign(Object.create(_n.prototype),{constructor:ep,_bindAction:function(t,e){var n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,o=t._propertyBindings,a=t._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];void 0===l&&(l={},c[s]=l);for(var u=0;u!==r;++u){var h=i[u],p=h.name,d=l[p];if(void 0!==d)o[u]=d;else{if(void 0!==(d=o[u])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=e&&e._propertyBindings[u].binding.parsedPath;++(d=new jh(Jh.create(n,p,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(d,s,p),o[u]=d}a[u].resultBuffer=d.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}for(var r=t._propertyBindings,o=0,a=r.length;o!==a;++o){var s=r[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,n=0,i=e.length;n!==i;++n){var r=e[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&ethis.max.x||t.ythis.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new An),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)},clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new An),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(t){return lp.copy(t).clamp(this.min,this.max).sub(t).length()},intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var hp=new Dn,pp=new Dn;function dp(t,e){this.start=void 0!==t?t:new Dn,this.end=void 0!==e?e:new Dn}function fp(t){li.call(this),this.material=t,this.render=function(){}}Object.assign(dp.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new Dn),t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new Dn),t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new Dn),this.delta(e).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(t,e){hp.subVectors(t,this.start),pp.subVectors(this.end,this.start);var n=pp.dot(pp),i=pp.dot(hp)/n;return e&&(i=En.clamp(i,0,1)),i},closestPointToPoint:function(t,e,n){var i=this.closestPointToPointParameter(t,e);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Dn),this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),fp.prototype=Object.create(li.prototype),fp.prototype.constructor=fp,fp.prototype.isImmediateRenderObject=!0;var mp=new Dn;function vp(t,e){li.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;for(var n=new Pr,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],r=0,o=1;r<32;r++,o++){var a=r/32*Math.PI*2,s=o/32*Math.PI*2;i.push(Math.cos(a),Math.sin(a),1,Math.cos(s),Math.sin(s),1)}n.setAttribute("position",new gr(i,3));var c=new rc({fog:!1});this.cone=new dc(n,c),this.add(this.cone),this.update()}vp.prototype=Object.create(li.prototype),vp.prototype.constructor=vp,vp.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},vp.prototype.update=function(){this.light.updateMatrixWorld();var t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),mp.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(mp),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var gp=new Dn,yp=new Wn,wp=new Wn;function xp(t){for(var e=function t(e){var n=[];e&&e.isBone&&n.push(e);for(var i=0;i.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{jp.set(t.z,0,-t.x).normalize();var e=Math.acos(t.y);this.quaternion.setFromAxisAngle(jp,e)}},Hp.prototype.setLength=function(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()},Hp.prototype.setColor=function(t){this.line.material.color.set(t),this.cone.material.color.set(t)},Hp.prototype.copy=function(t){return li.prototype.copy.call(this,t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this},Hp.prototype.clone=function(){return(new this.constructor).copy(this)},Gp.prototype=Object.create(dc.prototype),Gp.prototype.constructor=Gp;var Wp,qp,Xp,Yp,Qp=4,Kp=8,Zp=Math.pow(2,Kp),Jp=[.125,.215,.35,.446,.526,.582],$p=Kp-Qp+1+Jp.length,td=20,ed={[De]:0,[ze]:1,[Ue]:2,[je]:3,[He]:4,[Ge]:5,[Ve]:6},nd=new $u,id=(Wp=td,qp=new Float32Array(Wp),Xp=new Dn(0,1,0),(Yp=new Ul({defines:{n:Wp},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:qp},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:Xp},inputEncoding:{value:ed[De]},outputEncoding:{value:ed[De]}},vertexShader:Ad(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform int samples;\nuniform float weights[n];\nuniform bool latitudinal;\nuniform float dTheta;\nuniform float mipInt;\nuniform vec3 poleAxis;\n\n${Td()}\n\n#define ENVMAP_TYPE_CUBE_UV\n#include \n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tfor (int i = 0; i < n; i++) {\n\t\tif (i >= samples)\n\t\t\tbreak;\n\t\tfor (int dir = -1; dir < 2; dir += 2) {\n\t\t\tif (i == 0 && dir == 1)\n\t\t\t\tcontinue;\n\t\t\tvec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);\n\t\t\tif (all(equal(axis, vec3(0.0))))\n\t\t\t\taxis = cross(vec3(0.0, 1.0, 0.0), vOutputDirection);\n\t\t\taxis = normalize(axis);\n\t\t\tfloat theta = dTheta * float(dir * i);\n\t\t\tfloat cosTheta = cos(theta);\n\t\t\t// Rodrigues' axis-angle rotation\n\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross(axis, vOutputDirection) * sin(theta)\n\t\t\t\t\t+ axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);\n\t\t\tgl_FragColor.rgb +=\n\t\t\t\t\tweights[i] * bilinearCubeUV(envMap, sampleDirection, mipInt);\n\t\t}\n\t}\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,blending:M,depthTest:!1,depthWrite:!1})).type="SphericalGaussianBlur",Yp),rd=null,od=null,{_lodPlanes:ad,_sizeLods:sd,_sigmas:cd}=function(){for(var t=[],e=[],n=[],i=Kp,r=0;r<$p;r++){var o=Math.pow(2,i);e.push(o);var a=1/o;r>Kp-Qp?a=Jp[r-Kp+Qp-1]:0==r&&(a=0),n.push(a);for(var s=1/(o-1),c=-s/2,l=1+s/2,u=[c,c,l,c,l,l,c,c,l,l,c,l],h=new Float32Array(108),p=new Float32Array(72),d=new Float32Array(36),f=0;f<6;f++){var m=f%3*2/3-1,v=f>2?0:-1,g=[m,v,0,m+2/3,v,0,m+2/3,v+1,0,m,v,0,m+2/3,v+1,0,m,v+1,0];h.set(g,18*f),p.set(u,12*f);var y=[f,f,f,f,f,f];d.set(y,6*f)}var w=new Pr;w.setAttribute("position",new lr(h,3)),w.setAttribute("uv",new lr(p,2)),w.setAttribute("faceIndex",new lr(d,1)),t.push(w),i>Qp&&i--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}(),ld=null,ud=null,hd=null,pd=(1+Math.sqrt(5))/2,dd=1/pd,fd=[new Dn(1,1,1),new Dn(-1,1,1),new Dn(1,1,-1),new Dn(-1,1,-1),new Dn(0,pd,dd),new Dn(0,pd,-dd),new Dn(dd,0,pd),new Dn(-dd,0,pd),new Dn(pd,dd,0),new Dn(-pd,dd,0)];function md(t){ud=t,yd(id)}function vd(t){var e={magFilter:xt,minFilter:xt,generateMipmaps:!1,type:t?t.type:Ct,format:t?t.format:Xt,encoding:t?t.encoding:Ue,depthBuffer:!1,stencilBuffer:!1},n=wd(e);return n.depthBuffer=!t,ld=wd(e),n}function gd(t){ld.dispose(),ud.setRenderTarget(hd),t.scissorTest=!1,t.setSize(t.width,t.height)}function yd(t){var e=new ui;e.add(new qr(ad[0],t)),ud.compile(e,nd)}function wd(t){var e=new On(3*Zp,3*Zp,t);return e.texture.mapping=mt,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function xd(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function _d(t){var e=ud.autoClear;ud.autoClear=!1;for(var n=1;n<$p;n++){bd(t,n-1,n,Math.sqrt(cd[n]*cd[n]-cd[n-1]*cd[n-1]),fd[(n-1)%fd.length])}ud.autoClear=e}function bd(t,e,n,i,r){Sd(t,ld,e,n,i,"latitudinal",r),Sd(ld,t,n,n,i,"longitudinal",r)}function Sd(t,e,n,i,r,o,a){"latitudinal"!==o&&"longitudinal"!==o&&console.error("blur direction must be either latitudinal or longitudinal!");var s=new ui;s.add(new qr(ad[i],id));var c=id.uniforms,l=sd[n]-1,u=isFinite(r)?Math.PI/(2*l):2*Math.PI/(2*td-1),h=r/u,p=isFinite(r)?1+Math.floor(3*h):td;p>td&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${p} samples when the maximum is set to ${td}`);for(var d=[],f=0,m=0;mKp-Qp?i-Kp+Qp:0),3*y,2*y),ud.setRenderTarget(e),ud.render(s,nd)}function Md(){var t=new Ul({uniforms:{envMap:{value:null},texelSize:{value:new An(1,1)},inputEncoding:{value:ed[De]},outputEncoding:{value:ed[De]}},vertexShader:Ad(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform vec2 texelSize;\n\n${Td()}\n\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tvec3 outputDirection = normalize(vOutputDirection);\n\tvec2 uv;\n\tuv.y = asin(clamp(outputDirection.y, -1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n\tuv.x = atan(outputDirection.z, outputDirection.x) * RECIPROCAL_PI2 + 0.5;\n\tvec2 f = fract(uv / texelSize - 0.5);\n\tuv -= f * texelSize;\n\tvec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x += texelSize.x;\n\tvec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.y += texelSize.y;\n\tvec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x -= texelSize.x;\n\tvec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tvec3 tm = mix(tl, tr, f.x);\n\tvec3 bm = mix(bl, br, f.x);\n\tgl_FragColor.rgb = mix(tm, bm, f.y);\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,blending:M,depthTest:!1,depthWrite:!1});return t.type="EquirectangularToCubeUV",t}function Ed(){var t=new Ul({uniforms:{envMap:{value:null},inputEncoding:{value:ed[De]},outputEncoding:{value:ed[De]}},vertexShader:Ad(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform samplerCube envMap;\n\n${Td()}\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tgl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb;\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,blending:M,depthTest:!1,depthWrite:!1});return t.type="CubemapToCubeUV",t}function Ad(){return"\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nvec3 getDirection(vec2 uv, float face) {\n\tuv = 2.0 * uv - 1.0;\n\tvec3 direction = vec3(uv, 1.0);\n\tif (face == 0.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 1.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 3.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.x *= -1.0;\n\t} else if (face == 4.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.y *= -1.0;\n\t} else if (face == 5.0) {\n\t\tdirection.xz *= -1.0;\n\t}\n\treturn direction;\n}\nvoid main() {\n\tvOutputDirection = getDirection(uv, faceIndex);\n\tgl_Position = vec4( position, 1.0 );\n}\n\t"}function Td(){return"\nuniform int inputEncoding;\nuniform int outputEncoding;\n\n#include \n\nvec4 inputTexelToLinear(vec4 value){\n\tif(inputEncoding == 0){\n\t\treturn value;\n\t}else if(inputEncoding == 1){\n\t\treturn sRGBToLinear(value);\n\t}else if(inputEncoding == 2){\n\t\treturn RGBEToLinear(value);\n\t}else if(inputEncoding == 3){\n\t\treturn RGBMToLinear(value, 7.0);\n\t}else if(inputEncoding == 4){\n\t\treturn RGBMToLinear(value, 16.0);\n\t}else if(inputEncoding == 5){\n\t\treturn RGBDToLinear(value, 256.0);\n\t}else{\n\t\treturn GammaToLinear(value, 2.2);\n\t}\n}\n\nvec4 linearToOutputTexel(vec4 value){\n\tif(outputEncoding == 0){\n\t\treturn value;\n\t}else if(outputEncoding == 1){\n\t\treturn LinearTosRGB(value);\n\t}else if(outputEncoding == 2){\n\t\treturn LinearToRGBE(value);\n\t}else if(outputEncoding == 3){\n\t\treturn LinearToRGBM(value, 7.0);\n\t}else if(outputEncoding == 4){\n\t\treturn LinearToRGBM(value, 16.0);\n\t}else if(outputEncoding == 5){\n\t\treturn LinearToRGBD(value, 256.0);\n\t}else{\n\t\treturn LinearToGamma(value, 2.2);\n\t}\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n\treturn inputTexelToLinear(color);\n}\n\t"}function Pd(t,e,n,i,r,o,a){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new rr(t,e,n,r,o,a)}md.prototype={constructor:md,fromScene:function(t,e=0,n=.1,i=100){hd=ud.getRenderTarget();var r=vd();return function(t,e,n,i){var r=new lo(90,1,e,n),o=[1,1,1,1,-1,1],a=[1,1,-1,-1,-1,1],s=ud.outputEncoding,c=ud.toneMapping,l=ud.toneMappingExposure,u=ud.getClearColor(),h=ud.getClearAlpha();ud.toneMapping=rt,ud.toneMappingExposure=1,ud.outputEncoding=De,t.scale.z*=-1;var p=t.background;if(p&&p.isColor){p.convertSRGBToLinear();var d=Math.max(p.r,p.g,p.b),f=Math.min(Math.max(Math.ceil(Math.log2(d)),-128),127);p=p.multiplyScalar(Math.pow(2,-f));var m=(f+128)/255;ud.setClearColor(p,m),t.background=null}for(var v=0;v<6;v++){var g=v%3;0==g?(r.up.set(0,o[v],0),r.lookAt(a[v],0,0)):1==g?(r.up.set(0,0,o[v]),r.lookAt(0,a[v],0)):(r.up.set(0,o[v],0),r.lookAt(0,0,a[v])),xd(i,g*Zp,v>2?Zp:0,Zp,Zp),ud.setRenderTarget(i),ud.render(t,r)}ud.toneMapping=c,ud.toneMappingExposure=l,ud.outputEncoding=s,ud.setClearColor(u,h),t.scale.z*=-1}(t,n,i,r),e>0&&bd(r,0,0,e),_d(r),gd(r),r},fromEquirectangular:function(t){return t.magFilter=xt,t.minFilter=xt,t.generateMipmaps=!1,this.fromCubemap(t)},fromCubemap:function(t){hd=ud.getRenderTarget();var e=vd(t);return function(t,e){var n=new ui;t.isCubeTexture?null==od&&(od=Ed()):null==rd&&(rd=Md());var i=t.isCubeTexture?od:rd;n.add(new qr(ad[0],i));var r=i.uniforms;r.envMap.value=t,t.isCubeTexture||r.texelSize.value.set(1/t.image.width,1/t.image.height);r.inputEncoding.value=ed[t.encoding],r.outputEncoding.value=ed[t.encoding],xd(e,0,0,3*Zp,2*Zp),ud.setRenderTarget(e),ud.render(n,nd)}(t,e),_d(e),gd(e),e},compileCubemapShader:function(){null==od&&yd(od=Ed())},compileEquirectangularShader:function(){null==rd&&yd(rd=Md())},dispose:function(){id.dispose(),null!=od&&od.dispose(),null!=rd&&rd.dispose();for(var t=0;t (http://steffe.se)",keywords:["cannon.js","cannon","physics","engine","3d"],main:"./src/Cannon.js",engines:{node:"*"},repository:{type:"git",url:"https://github.com/schteppe/cannon.js.git"},bugs:{url:"https://github.com/schteppe/cannon.js/issues"},licenses:[{type:"MIT"}],devDependencies:{browserify:"*",grunt:"^0.4.5","grunt-browserify":"^2.1.4","grunt-contrib-concat":"~0.1.3","grunt-contrib-jshint":"~0.1.1","grunt-contrib-nodeunit":"^0.4.1","grunt-contrib-uglify":"^0.5.1","grunt-contrib-yuidoc":"^0.5.2",jshint:"latest",nodeunit:"^0.9.0","uglify-js":"latest"},dependencies:{typescript:"^3.7.4"}}},{}],2:[function(t,e,n){e.exports={version:t("../package.json").version,AABB:t("./collision/AABB"),ArrayCollisionMatrix:t("./collision/ArrayCollisionMatrix"),Body:t("./objects/Body"),Box:t("./shapes/Box"),Broadphase:t("./collision/Broadphase"),Constraint:t("./constraints/Constraint"),ContactEquation:t("./equations/ContactEquation"),Narrowphase:t("./world/Narrowphase"),ConeTwistConstraint:t("./constraints/ConeTwistConstraint"),ContactMaterial:t("./material/ContactMaterial"),ConvexPolyhedron:t("./shapes/ConvexPolyhedron"),Cylinder:t("./shapes/Cylinder"),DistanceConstraint:t("./constraints/DistanceConstraint"),Equation:t("./equations/Equation"),EventTarget:t("./utils/EventTarget"),FrictionEquation:t("./equations/FrictionEquation"),GSSolver:t("./solver/GSSolver"),GridBroadphase:t("./collision/GridBroadphase"),Heightfield:t("./shapes/Heightfield"),HingeConstraint:t("./constraints/HingeConstraint"),LockConstraint:t("./constraints/LockConstraint"),Mat3:t("./math/Mat3"),Material:t("./material/Material"),NaiveBroadphase:t("./collision/NaiveBroadphase"),ObjectCollisionMatrix:t("./collision/ObjectCollisionMatrix"),Pool:t("./utils/Pool"),Particle:t("./shapes/Particle"),Plane:t("./shapes/Plane"),PointToPointConstraint:t("./constraints/PointToPointConstraint"),Quaternion:t("./math/Quaternion"),Ray:t("./collision/Ray"),RaycastVehicle:t("./objects/RaycastVehicle"),RaycastResult:t("./collision/RaycastResult"),RigidVehicle:t("./objects/RigidVehicle"),RotationalEquation:t("./equations/RotationalEquation"),RotationalMotorEquation:t("./equations/RotationalMotorEquation"),SAPBroadphase:t("./collision/SAPBroadphase"),SPHSystem:t("./objects/SPHSystem"),Shape:t("./shapes/Shape"),Solver:t("./solver/Solver"),Sphere:t("./shapes/Sphere"),SplitSolver:t("./solver/SplitSolver"),Spring:t("./objects/Spring"),Transform:t("./math/Transform"),Trimesh:t("./shapes/Trimesh"),Vec3:t("./math/Vec3"),Vec3Pool:t("./utils/Vec3Pool"),World:t("./world/World")}},{"../package.json":1,"./collision/AABB":3,"./collision/ArrayCollisionMatrix":4,"./collision/Broadphase":5,"./collision/GridBroadphase":6,"./collision/NaiveBroadphase":7,"./collision/ObjectCollisionMatrix":8,"./collision/Ray":10,"./collision/RaycastResult":11,"./collision/SAPBroadphase":12,"./constraints/ConeTwistConstraint":13,"./constraints/Constraint":14,"./constraints/DistanceConstraint":15,"./constraints/HingeConstraint":16,"./constraints/LockConstraint":17,"./constraints/PointToPointConstraint":18,"./equations/ContactEquation":20,"./equations/Equation":21,"./equations/FrictionEquation":22,"./equations/RotationalEquation":23,"./equations/RotationalMotorEquation":24,"./material/ContactMaterial":25,"./material/Material":26,"./math/Mat3":28,"./math/Quaternion":29,"./math/Transform":30,"./math/Vec3":31,"./objects/Body":32,"./objects/RaycastVehicle":33,"./objects/RigidVehicle":34,"./objects/SPHSystem":35,"./objects/Spring":36,"./shapes/Box":38,"./shapes/ConvexPolyhedron":39,"./shapes/Cylinder":40,"./shapes/Heightfield":41,"./shapes/Particle":42,"./shapes/Plane":43,"./shapes/Shape":44,"./shapes/Sphere":45,"./shapes/Trimesh":46,"./solver/GSSolver":47,"./solver/Solver":48,"./solver/SplitSolver":49,"./utils/EventTarget":50,"./utils/Pool":52,"./utils/Vec3Pool":55,"./world/Narrowphase":56,"./world/World":57}],3:[function(t,e,n){var i=t("../math/Vec3");function r(t){t=t||{},this.lowerBound=new i,t.lowerBound&&this.lowerBound.copy(t.lowerBound),this.upperBound=new i,t.upperBound&&this.upperBound.copy(t.upperBound)}t("../utils/Utils"),e.exports=r;var o=new i;r.prototype.setFromPoints=function(t,e,n,i){var r=this.lowerBound,a=this.upperBound,s=n;r.copy(t[0]),s&&s.vmult(r,r),a.copy(r);for(var c=1;ca.x&&(a.x=l.x),l.xa.y&&(a.y=l.y),l.ya.z&&(a.z=l.z),l.z=r.x&&e.y<=i.y&&n.y>=r.y&&e.z<=i.z&&n.z>=r.z},r.prototype.getCorners=function(t,e,n,i,r,o,a,s){var c=this.lowerBound,l=this.upperBound;t.copy(c),e.set(l.x,c.y,c.z),n.set(l.x,l.y,c.z),i.set(c.x,l.y,l.z),r.set(l.x,c.y,l.z),o.set(c.x,l.y,c.z),a.set(c.x,c.y,l.z),s.copy(l)};var a=[new i,new i,new i,new i,new i,new i,new i,new i];r.prototype.toLocalFrame=function(t,e){var n=a,i=n[0],r=n[1],o=n[2],s=n[3],c=n[4],l=n[5],u=n[6],h=n[7];this.getCorners(i,r,o,s,c,l,u,h);for(var p=0;8!==p;p++){var d=n[p];t.pointToLocal(d,d)}return e.setFromPoints(n)},r.prototype.toWorldFrame=function(t,e){var n=a,i=n[0],r=n[1],o=n[2],s=n[3],c=n[4],l=n[5],u=n[6],h=n[7];this.getCorners(i,r,o,s,c,l,u,h);for(var p=0;8!==p;p++){var d=n[p];t.pointToWorld(d,d)}return e.setFromPoints(n)},r.prototype.overlapsRay=function(t){var e=1/t._direction.x,n=1/t._direction.y,i=1/t._direction.z,r=(this.lowerBound.x-t.from.x)*e,o=(this.upperBound.x-t.from.x)*e,a=(this.lowerBound.y-t.from.y)*n,s=(this.upperBound.y-t.from.y)*n,c=(this.lowerBound.z-t.from.z)*i,l=(this.upperBound.z-t.from.z)*i,u=Math.max(Math.max(Math.min(r,o),Math.min(a,s)),Math.min(c,l)),h=Math.min(Math.min(Math.max(r,o),Math.max(a,s)),Math.max(c,l));return!(h<0||u>h)}},{"../math/Vec3":31,"../utils/Utils":54}],4:[function(t,e,n){function i(){this.matrix=[]}e.exports=i,i.prototype.get=function(t,e){if(t=t.index,(e=e.index)>t){var n=e;e=t,t=n}return this.matrix[(t*(t+1)>>1)+e-1]},i.prototype.set=function(t,e,n){if(t=t.index,(e=e.index)>t){var i=e;e=t,t=i}this.matrix[(t*(t+1)>>1)+e-1]=n?1:0},i.prototype.reset=function(){for(var t=0,e=this.matrix.length;t!==e;t++)this.matrix[t]=0},i.prototype.setNumObjects=function(t){this.matrix.length=t*(t-1)>>1}},{}],5:[function(t,e,n){var i=t("../objects/Body"),r=t("../math/Vec3"),o=t("../math/Quaternion");function a(){this.world=null,this.useBoundingBoxes=!1,this.dirty=!0}t("../shapes/Shape"),t("../shapes/Plane"),e.exports=a,a.prototype.collisionPairs=function(t,e,n){throw new Error("collisionPairs not implemented for this BroadPhase class!")},a.prototype.needBroadphaseCollision=function(t,e){return 0!=(t.collisionFilterGroup&e.collisionFilterMask)&&0!=(e.collisionFilterGroup&t.collisionFilterMask)&&(0==(t.type&i.STATIC)&&t.sleepState!==i.SLEEPING||0==(e.type&i.STATIC)&&e.sleepState!==i.SLEEPING)},a.prototype.intersectionTest=function(t,e,n,i){this.useBoundingBoxes?this.doBoundingBoxBroadphase(t,e,n,i):this.doBoundingSphereBroadphase(t,e,n,i)};var s=new r;new r,new o,new r,a.prototype.doBoundingSphereBroadphase=function(t,e,n,i){var r=s;e.position.vsub(t.position,r);var o=Math.pow(t.boundingRadius+e.boundingRadius,2);r.norm2()n.norm2()},a.prototype.aabbQuery=function(t,e,n){return console.warn(".aabbQuery is not implemented in this Broadphase subclass."),[]}},{"../math/Quaternion":29,"../math/Vec3":31,"../objects/Body":32,"../shapes/Plane":43,"../shapes/Shape":44}],6:[function(t,e,n){e.exports=a;var i=t("./Broadphase"),r=t("../math/Vec3"),o=t("../shapes/Shape");function a(t,e,n,o,a){i.apply(this),this.nx=n||10,this.ny=o||10,this.nz=a||10,this.aabbMin=t||new r(100,100,100),this.aabbMax=e||new r(-100,-100,-100);var s=this.nx*this.ny*this.nz;if(s<=0)throw"GridBroadphase: Each dimension's n must be >0";this.bins=[],this.binLengths=[],this.bins.length=s,this.binLengths.length=s;for(var c=0;c=l&&(s=l-1),c<0?c=0:c>=u&&(c=u-1),m<0?m=0:m>=h&&(m=h-1),v<0?v=0:v>=l&&(v=l-1),g<0?g=0:g>=u&&(g=u-1),M<0?M=0:M>=h&&(M=h-1),c*=d,m*=f,v*=p,g*=d,M*=f;for(var E=s*=p;E<=v;E+=p)for(var A=c;A<=g;A+=d)for(var T=m;T<=M;T+=f){var P=E+A+T;R[P][O[P]++]=a}}for(c=Math.min,a=Math.max,I=0;I!==i;I++){var D=(nt=r[I]).shape;switch(D.type){case L:var z=nt.position.x,V=nt.position.y,U=nt.position.z,k=D.radius;B(z-k,V-k,U-k,z+k,V+k,U+k,nt);break;case C:D.worldNormalNeedsUpdate&&D.computeWorldNormal(nt.quaternion);var j=D.worldNormal,H=y+.5*M-nt.position.x,G=w+.5*E-nt.position.y,W=x+.5*A-nt.position.z,q=s;q.set(H,G,W);for(var X=0,Y=0;X!==l;X++,Y+=p,q.y=G,q.x+=M)for(var Q=0,K=0;Q!==u;Q++,K+=d,q.z=W,q.y+=E)for(var Z=0,J=0;Z!==h;Z++,J+=f,q.z+=A)if(q.dot(j)1){var et=R[I];for(X=0;X!==tt;X++){var nt=et[X];for(Q=0;Q!==X;Q++){var it=et[Q];this.needBroadphaseCollision(nt,it)&&this.intersectionTest(nt,it,e,n)}}}}this.makePairsUnique(e,n)}},{"../math/Vec3":31,"../shapes/Shape":44,"./Broadphase":5}],7:[function(t,e,n){e.exports=o;var i=t("./Broadphase"),r=t("./AABB");function o(){i.apply(this)}o.prototype=new i,o.prototype.constructor=o,o.prototype.collisionPairs=function(t,e,n){var i,r,o,a,s=t.bodies,c=s.length;for(i=0;i!==c;i++)for(r=0;r!==i;r++)o=s[i],a=s[r],this.needBroadphaseCollision(o,a)&&this.intersectionTest(o,a,e,n)},new r,o.prototype.aabbQuery=function(t,e,n){n=n||[];for(var i=0;it){var n=e;e=t,t=n}return t+"-"+e in this.matrix},i.prototype.set=function(t,e,n){if(t=t.id,(e=e.id)>t){var i=e;e=t,t=i}n?this.matrix[t+"-"+e]=!0:delete this.matrix[t+"-"+e]},i.prototype.reset=function(){this.matrix={}},i.prototype.setNumObjects=function(t){}},{}],9:[function(t,e,n){function i(){this.current=[],this.previous=[]}function r(t,e){t.push((4294901760&e)>>16,65535&e)}e.exports=i,i.prototype.getKey=function(t,e){if(ei[r];)r++;if(n!==i[r]){for(e=i.length-1;e>=r;e--)i[e+1]=i[e];i[r]=n}},i.prototype.tick=function(){var t=this.current;this.current=this.previous,this.previous=t,this.current.length=0},i.prototype.getDiff=function(t,e){for(var n=this.current,i=this.previous,o=n.length,a=i.length,s=0,c=0;ci[s];)s++;l===i[s]||r(t,l)}for(s=0,c=0;cn[s];)s++;n[s]===u||r(e,u)}}},{}],10:[function(t,e,n){e.exports=l;var i=t("../math/Vec3"),r=t("../math/Quaternion"),o=t("../math/Transform"),a=(t("../shapes/ConvexPolyhedron"),t("../shapes/Box"),t("../collision/RaycastResult")),s=t("../shapes/Shape"),c=t("../collision/AABB");function l(t,e){this.from=t?t.clone():new i,this.to=e?e.clone():new i,this._direction=new i,this.precision=1e-4,this.checkCollisionResponse=!0,this.skipBackfaces=!1,this.collisionFilterMask=-1,this.collisionFilterGroup=-1,this.mode=l.ANY,this.result=new a,this.hasHit=!1,this.callback=function(t){}}l.prototype.constructor=l,l.CLOSEST=1,l.ANY=2,l.ALL=4;var u=new c,h=[];l.prototype.intersectWorld=function(t,e){return this.mode=e.mode||l.ANY,this.result=e.result||new a,this.skipBackfaces=!!e.skipBackfaces,this.collisionFilterMask=void 0!==e.collisionFilterMask?e.collisionFilterMask:-1,this.collisionFilterGroup=void 0!==e.collisionFilterGroup?e.collisionFilterGroup:-1,e.from&&this.from.copy(e.from),e.to&&this.to.copy(e.to),this.callback=e.callback||function(){},this.hasHit=!1,this.result.reset(),this._updateDirection(),this.getAABB(u),h.length=0,t.broadphase.aabbQuery(t,u,h),this.intersectBodies(h),this.hasHit};var p=new i,d=new i;function f(t,e,n,i){i.vsub(e,D),n.vsub(e,p),t.vsub(e,d);var r,o,a=D.dot(D),s=D.dot(p),c=D.dot(d),l=p.dot(p),u=p.dot(d);return(r=l*c-s*u)>=0&&(o=a*u-s*c)>=0&&r+ot.boundingSphereRadius)){var r=this[t.type];r&&r.call(this,t,e,n,i,t)}},new i,new i;var g=new i,y=new i,w=new i,x=new i;new i,new a,l.prototype.intersectBox=function(t,e,n,i,r){return this.intersectConvex(t.convexPolyhedronRepresentation,e,n,i,r)},l.prototype[s.types.BOX]=l.prototype.intersectBox,l.prototype.intersectPlane=function(t,e,n,r,o){var a=this.from,s=this.to,c=this._direction,l=new i(0,0,1);e.vmult(l,l);var u=new i;a.vsub(n,u);var h=u.dot(l);if(s.vsub(n,u),!(h*u.dot(l)>0||a.distanceTo(s)=0&&f<=1&&(o.lerp(a,f,p),p.vsub(n,d),d.normalize(),this.reportIntersection(d,p,r,i,-1)),this.result._shouldStop)return;m>=0&&m<=1&&(o.lerp(a,m,p),p.vsub(n,d),d.normalize(),this.reportIntersection(d,p,r,i,-1))}},l.prototype[s.types.SPHERE]=l.prototype.intersectSphere;var T=new i,P=(new i,new i,new i);l.prototype.intersectConvex=function(t,e,n,i,r,o){for(var a=T,s=P,c=o&&o.faceList||null,l=t.faces,u=t.vertices,h=t.faceNormals,p=this._direction,d=this.from,m=this.to,v=d.distanceTo(m),_=c?c.length:l.length,b=this.result,S=0;!b._shouldStop&&S<_;S++){var M=c?c[S]:S,E=l[M],A=h[M],L=e,C=n;s.copy(u[E[0]]),L.vmult(s,s),s.vadd(C,s),s.vsub(d,s),L.vmult(A,a);var R=p.dot(a);if(!(Math.abs(R)v||this.reportIntersection(a,g,r,i,M)}}}}},l.prototype[s.types.CONVEXPOLYHEDRON]=l.prototype.intersectConvex;var L=new i,C=new i,R=new i,O=new i,F=new i,I=new i,N=(new c,[]),B=new o;l.prototype.intersectTrimesh=function(t,e,n,i,r,a){var s=L,c=N,l=B,u=P,h=C,p=R,d=O,m=I,v=F,_=(a&&a.faceList,t.indices),b=(t.vertices,t.faceNormals,this.from),S=this.to,M=this._direction;l.position.copy(n),l.quaternion.copy(e),o.vectorToLocalFrame(n,e,M,h),o.pointToLocalFrame(n,e,b,p),o.pointToLocalFrame(n,e,S,d),d.x*=t.scale.x,d.y*=t.scale.y,d.z*=t.scale.z,p.x*=t.scale.x,p.y*=t.scale.y,p.z*=t.scale.z,d.vsub(p,h),h.normalize();var E=p.distanceSquared(d);t.tree.rayQuery(this,l,c);for(var A=0,T=c.length;!this.result._shouldStop&&A!==T;A++){var D=c[A];t.getNormal(D,s),t.getVertex(_[3*D],y),y.vsub(p,u);var z=h.dot(s),V=s.dot(u)/z;if(!(V<0)){h.scale(V,g),g.vadd(p,g),t.getVertex(_[3*D+1],w),t.getVertex(_[3*D+2],x);var U=g.distanceSquared(p);!f(g,w,y,x)&&!f(g,y,w,x)||U>E||(o.vectorToWorldFrame(e,s,v),o.pointToWorldFrame(n,e,g,m),this.reportIntersection(v,m,r,i,D))}}c.length=0},l.prototype[s.types.TRIMESH]=l.prototype.intersectTrimesh,l.prototype.reportIntersection=function(t,e,n,i,r){var o=this.from,a=this.to,s=o.distanceTo(e),c=this.result;if(!(this.skipBackfaces&&t.dot(this._direction)>0))switch(c.hitFaceIndex=void 0!==r?r:-1,this.mode){case l.ALL:this.hasHit=!0,c.set(o,a,t,e,n,i,s),c.hasHit=!0,this.callback(c);break;case l.CLOSEST:(s=0&&!(t[r].aabb.lowerBound.x<=i.aabb.lowerBound.x);r--)t[r+1]=t[r];t[r+1]=i}return t},r.insertionSortY=function(t){for(var e=1,n=t.length;e=0&&!(t[r].aabb.lowerBound.y<=i.aabb.lowerBound.y);r--)t[r+1]=t[r];t[r+1]=i}return t},r.insertionSortZ=function(t){for(var e=1,n=t.length;e=0&&!(t[r].aabb.lowerBound.z<=i.aabb.lowerBound.z);r--)t[r+1]=t[r];t[r+1]=i}return t},r.prototype.collisionPairs=function(t,e,n){var i,o,a=this.axisList,s=a.length,c=this.axisIndex;for(this.dirty&&(this.sortList(),this.dirty=!1),i=0;i!==s;i++){var l=a[i];for(o=i+1;om?f>v?0:2:m>v?1:2},r.prototype.aabbQuery=function(t,e,n){n=n||[],this.dirty&&(this.sortList(),this.dirty=!1);var i=this.axisIndex,r="x";1===i&&(r="y"),2===i&&(r="z");for(var o=this.axisList,a=(e.lowerBound[r],e.upperBound[r],0);a.499&&(n=2*Math.atan2(o,c),i=Math.PI/2,r=0),l<-.499&&(n=-2*Math.atan2(o,c),i=-Math.PI/2,r=0),isNaN(n)){var u=o*o,h=a*a,p=s*s;n=Math.atan2(2*a*c-2*o*s,1-2*h-2*p),i=Math.asin(2*l),r=Math.atan2(2*o*c-2*a*s,1-2*u-2*p)}break;default:throw new Error("Euler order "+e+" not supported yet.")}t.y=n,t.z=i,t.x=r},r.prototype.setFromEuler=function(t,e,n,i){i=i||"XYZ";var r=Math.cos(t/2),o=Math.cos(e/2),a=Math.cos(n/2),s=Math.sin(t/2),c=Math.sin(e/2),l=Math.sin(n/2);return"XYZ"===i?(this.x=s*o*a+r*c*l,this.y=r*c*a-s*o*l,this.z=r*o*l+s*c*a,this.w=r*o*a-s*c*l):"YXZ"===i?(this.x=s*o*a+r*c*l,this.y=r*c*a-s*o*l,this.z=r*o*l-s*c*a,this.w=r*o*a+s*c*l):"ZXY"===i?(this.x=s*o*a-r*c*l,this.y=r*c*a+s*o*l,this.z=r*o*l+s*c*a,this.w=r*o*a-s*c*l):"ZYX"===i?(this.x=s*o*a-r*c*l,this.y=r*c*a+s*o*l,this.z=r*o*l-s*c*a,this.w=r*o*a+s*c*l):"YZX"===i?(this.x=s*o*a+r*c*l,this.y=r*c*a+s*o*l,this.z=r*o*l-s*c*a,this.w=r*o*a-s*c*l):"XZY"===i&&(this.x=s*o*a-r*c*l,this.y=r*c*a-s*o*l,this.z=r*o*l+s*c*a,this.w=r*o*a+s*c*l),this},r.prototype.clone=function(){return new r(this.x,this.y,this.z,this.w)},r.prototype.slerp=function(t,e,n){n=n||new r;var i,o,a,s,c,l=this.x,u=this.y,h=this.z,p=this.w,d=t.x,f=t.y,m=t.z,v=t.w;return(o=l*d+u*f+h*m+p*v)<0&&(o=-o,d=-d,f=-f,m=-m,v=-v),1-o>1e-6?(i=Math.acos(o),a=Math.sin(i),s=Math.sin((1-e)*i)/a,c=Math.sin(e*i)/a):(s=1-e,c=e),n.x=s*l+c*d,n.y=s*u+c*f,n.z=s*h+c*m,n.w=s*p+c*v,n},r.prototype.integrate=function(t,e,n,i){i=i||new r;var o=t.x*n.x,a=t.y*n.y,s=t.z*n.z,c=this.x,l=this.y,u=this.z,h=this.w,p=.5*e;return i.x+=p*(o*h+a*u-s*l),i.y+=p*(a*h+s*c-o*u),i.z+=p*(s*h+o*l-a*c),i.w+=p*(-o*c-a*l-s*u),i}},{"./Vec3":31}],30:[function(t,e,n){var i=t("./Vec3"),r=t("./Quaternion");function o(t){t=t||{},this.position=new i,t.position&&this.position.copy(t.position),this.quaternion=new r,t.quaternion&&this.quaternion.copy(t.quaternion)}e.exports=o;var a=new r;o.pointToLocalFrame=function(t,e,n,r){return r=r||new i,n.vsub(t,r),e.conjugate(a),a.vmult(r,r),r},o.prototype.pointToLocal=function(t,e){return o.pointToLocalFrame(this.position,this.quaternion,t,e)},o.pointToWorldFrame=function(t,e,n,r){return r=r||new i,e.vmult(n,r),r.vadd(t,r),r},o.prototype.pointToWorld=function(t,e){return o.pointToWorldFrame(this.position,this.quaternion,t,e)},o.prototype.vectorToWorldFrame=function(t,e){return e=e||new i,this.quaternion.vmult(t,e),e},o.vectorToWorldFrame=function(t,e,n){return t.vmult(e,n),n},o.vectorToLocalFrame=function(t,e,n,r){return r=r||new i,e.w*=-1,e.vmult(n,r),e.w*=-1,r}},{"./Quaternion":29,"./Vec3":31}],31:[function(t,e,n){e.exports=r;var i=t("./Mat3");function r(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}r.ZERO=new r(0,0,0),r.UNIT_X=new r(1,0,0),r.UNIT_Y=new r(0,1,0),r.UNIT_Z=new r(0,0,1),r.prototype.cross=function(t,e){var n=t.x,i=t.y,o=t.z,a=this.x,s=this.y,c=this.z;return(e=e||new r).x=s*o-c*i,e.y=c*n-a*o,e.z=a*i-s*n,e},r.prototype.set=function(t,e,n){return this.x=t,this.y=e,this.z=n,this},r.prototype.setZero=function(){this.x=this.y=this.z=0},r.prototype.vadd=function(t,e){if(!e)return new r(this.x+t.x,this.y+t.y,this.z+t.z);e.x=t.x+this.x,e.y=t.y+this.y,e.z=t.z+this.z},r.prototype.vsub=function(t,e){if(!e)return new r(this.x-t.x,this.y-t.y,this.z-t.z);e.x=this.x-t.x,e.y=this.y-t.y,e.z=this.z-t.z},r.prototype.crossmat=function(){return new i([0,-this.z,this.y,this.z,0,-this.x,-this.y,this.x,0])},r.prototype.normalize=function(){var t=this.x,e=this.y,n=this.z,i=Math.sqrt(t*t+e*e+n*n);if(i>0){var r=1/i;this.x*=r,this.y*=r,this.z*=r}else this.x=0,this.y=0,this.z=0;return i},r.prototype.unit=function(t){t=t||new r;var e=this.x,n=this.y,i=this.z,o=Math.sqrt(e*e+n*n+i*i);return o>0?(o=1/o,t.x=e*o,t.y=n*o,t.z=i*o):(t.x=1,t.y=0,t.z=0),t},r.prototype.norm=function(){var t=this.x,e=this.y,n=this.z;return Math.sqrt(t*t+e*e+n*n)},r.prototype.length=r.prototype.norm,r.prototype.norm2=function(){return this.dot(this)},r.prototype.lengthSquared=r.prototype.norm2,r.prototype.distanceTo=function(t){var e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,a=t.z;return Math.sqrt((r-e)*(r-e)+(o-n)*(o-n)+(a-i)*(a-i))},r.prototype.distanceSquared=function(t){var e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,a=t.z;return(r-e)*(r-e)+(o-n)*(o-n)+(a-i)*(a-i)},r.prototype.mult=function(t,e){e=e||new r;var n=this.x,i=this.y,o=this.z;return e.x=t*n,e.y=t*i,e.z=t*o,e},r.prototype.vmul=function(t,e){return(e=e||new r).x=t.x*this.x,e.y=t.y*this.y,e.z=t.z*this.z,e},r.prototype.scale=r.prototype.mult,r.prototype.addScaledVector=function(t,e,n){return(n=n||new r).x=this.x+t*e.x,n.y=this.y+t*e.y,n.z=this.z+t*e.z,n},r.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},r.prototype.isZero=function(){return 0===this.x&&0===this.y&&0===this.z},r.prototype.negate=function(t){return(t=t||new r).x=-this.x,t.y=-this.y,t.z=-this.z,t};var o=new r,a=new r;r.prototype.tangents=function(t,e){var n=this.norm();if(n>0){var i=o,r=1/n;i.set(this.x*r,this.y*r,this.z*r);var s=a;Math.abs(i.x)<.9?(s.set(1,0,0),i.cross(s,t)):(s.set(0,1,0),i.cross(s,t)),i.cross(t,e)}else t.set(1,0,0),e.set(0,1,0)},r.prototype.toString=function(){return this.x+","+this.y+","+this.z},r.prototype.toArray=function(){return[this.x,this.y,this.z]},r.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},r.prototype.lerp=function(t,e,n){var i=this.x,r=this.y,o=this.z;n.x=i+(t.x-i)*e,n.y=r+(t.y-r)*e,n.z=o+(t.z-o)*e},r.prototype.almostEquals=function(t,e){return void 0===e&&(e=1e-6),!(Math.abs(this.x-t.x)>e||Math.abs(this.y-t.y)>e||Math.abs(this.z-t.z)>e)},r.prototype.almostZero=function(t){return void 0===t&&(t=1e-6),!(Math.abs(this.x)>t||Math.abs(this.y)>t||Math.abs(this.z)>t)};var s=new r;r.prototype.isAntiparallelTo=function(t,e){return this.negate(s),s.almostEquals(t,e)},r.prototype.clone=function(){return new r(this.x,this.y,this.z)}},{"./Mat3":28}],32:[function(t,e,n){e.exports=l;var i=t("../utils/EventTarget"),r=(t("../shapes/Shape"),t("../math/Vec3")),o=t("../math/Mat3"),a=t("../math/Quaternion"),s=(t("../material/Material"),t("../collision/AABB")),c=t("../shapes/Box");function l(t){t=t||{},i.apply(this),this.id=l.idCounter++,this.world=null,this.preStep=null,this.postStep=null,this.vlambda=new r,this.collisionFilterGroup="number"==typeof t.collisionFilterGroup?t.collisionFilterGroup:1,this.collisionFilterMask="number"==typeof t.collisionFilterMask?t.collisionFilterMask:-1,this.collisionResponse=!0,this.position=new r,this.previousPosition=new r,this.interpolatedPosition=new r,this.initPosition=new r,t.position&&(this.position.copy(t.position),this.previousPosition.copy(t.position),this.interpolatedPosition.copy(t.position),this.initPosition.copy(t.position)),this.velocity=new r,t.velocity&&this.velocity.copy(t.velocity),this.initVelocity=new r,this.force=new r;var e="number"==typeof t.mass?t.mass:0;this.mass=e,this.invMass=e>0?1/e:0,this.material=t.material||null,this.linearDamping="number"==typeof t.linearDamping?t.linearDamping:.01,this.type=e<=0?l.STATIC:l.DYNAMIC,typeof t.type==typeof l.STATIC&&(this.type=t.type),this.allowSleep=void 0===t.allowSleep||t.allowSleep,this.sleepState=0,this.sleepSpeedLimit=void 0!==t.sleepSpeedLimit?t.sleepSpeedLimit:.03,this.sleepTimeLimit=void 0!==t.sleepTimeLimit?t.sleepTimeLimit:1,this.timeLastSleepy=0,this._wakeUpAfterNarrowphase=!1,this.torque=new r,this.quaternion=new a,this.initQuaternion=new a,this.previousQuaternion=new a,this.interpolatedQuaternion=new a,t.quaternion&&(this.quaternion.copy(t.quaternion),this.initQuaternion.copy(t.quaternion),this.previousQuaternion.copy(t.quaternion),this.interpolatedQuaternion.copy(t.quaternion)),this.angularVelocity=new r,t.angularVelocity&&this.angularVelocity.copy(t.angularVelocity),this.initAngularVelocity=new r,this.shapes=[],this.shapeOffsets=[],this.shapeOrientations=[],this.inertia=new r,this.invInertia=new r,this.invInertiaWorld=new o,this.invMassSolve=0,this.invInertiaSolve=new r,this.invInertiaWorldSolve=new o,this.fixedRotation=void 0!==t.fixedRotation&&t.fixedRotation,this.angularDamping=void 0!==t.angularDamping?t.angularDamping:.01,this.linearFactor=new r(1,1,1),t.linearFactor&&this.linearFactor.copy(t.linearFactor),this.angularFactor=new r(1,1,1),t.angularFactor&&this.angularFactor.copy(t.angularFactor),this.aabb=new s,this.aabbNeedsUpdate=!0,this.boundingRadius=0,this.wlambda=new r,t.shape&&this.addShape(t.shape),this.updateMassProperties()}l.prototype=new i,l.prototype.constructor=l,l.COLLIDE_EVENT_NAME="collide",l.DYNAMIC=1,l.STATIC=2,l.KINEMATIC=4,l.AWAKE=0,l.SLEEPY=1,l.SLEEPING=2,l.idCounter=0,l.wakeupEvent={type:"wakeup"},l.prototype.wakeUp=function(){var t=this.sleepState;this.sleepState=0,this._wakeUpAfterNarrowphase=!1,t===l.SLEEPING&&this.dispatchEvent(l.wakeupEvent)},l.prototype.sleep=function(){this.sleepState=l.SLEEPING,this.velocity.set(0,0,0),this.angularVelocity.set(0,0,0),this._wakeUpAfterNarrowphase=!1},l.sleepyEvent={type:"sleepy"},l.sleepEvent={type:"sleep"},l.prototype.sleepTick=function(t){if(this.allowSleep){var e=this.sleepState,n=this.velocity.norm2()+this.angularVelocity.norm2(),i=Math.pow(this.sleepSpeedLimit,2);e===l.AWAKE&&ni?this.wakeUp():e===l.SLEEPY&&t-this.timeLastSleepy>this.sleepTimeLimit&&(this.sleep(),this.dispatchEvent(l.sleepEvent))}},l.prototype.updateSolveMassProperties=function(){this.sleepState===l.SLEEPING||this.type===l.KINEMATIC?(this.invMassSolve=0,this.invInertiaSolve.setZero(),this.invInertiaWorldSolve.setZero()):(this.invMassSolve=this.invMass,this.invInertiaSolve.copy(this.invInertia),this.invInertiaWorldSolve.copy(this.invInertiaWorld))},l.prototype.pointToLocalFrame=function(t,e){return e=e||new r,t.vsub(this.position,e),this.quaternion.conjugate().vmult(e,e),e},l.prototype.vectorToLocalFrame=function(t,e){return e=e||new r,this.quaternion.conjugate().vmult(t,e),e},l.prototype.pointToWorldFrame=function(t,e){return e=e||new r,this.interpolatedQuaternion.vmult(t,e),e.vadd(this.interpolatedPosition,e),e},l.prototype.vectorToWorldFrame=function(t,e){return e=e||new r,this.interpolatedQuaternion.vmult(t,e),e};var u=new r,h=new a;l.prototype.addShape=function(t,e,n){var i=new r,o=new a;return e&&i.copy(e),n&&o.copy(n),this.shapes.push(t),this.shapeOffsets.push(i),this.shapeOrientations.push(o),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0,t.body=this,this},l.prototype.updateBoundingRadius=function(){for(var t=this.shapes,e=this.shapeOffsets,n=t.length,i=0,r=0;r!==n;r++){var o=t[r];o.updateBoundingSphereRadius();var a=e[r].norm(),s=o.boundingSphereRadius;a+s>i&&(i=a+s)}this.boundingRadius=i};var p=new s;l.prototype.computeAABB=function(){for(var t=this.shapes,e=this.shapeOffsets,n=this.shapeOrientations,i=t.length,r=u,o=h,a=this.quaternion,s=this.aabb,c=p,l=0;l!==i;l++){var d=t[l];a.vmult(e[l],r),r.vadd(this.position,r),n[l].mult(a,o),d.calculateWorldAABB(r,o,c.lowerBound,c.upperBound),0===l?s.copy(c):s.extend(c)}this.aabbNeedsUpdate=!1};var d=new o,f=new o;new o,l.prototype.updateInertiaWorld=function(t){var e=this.invInertia;if(e.x!==e.y||e.y!==e.z||t){var n=d,i=f;n.setRotationFromQuaternion(this.quaternion),n.transpose(i),n.scale(e,n),n.mmult(i,this.invInertiaWorld)}},new r;var m=new r;l.prototype.applyForce=function(t,e){if(this.type===l.DYNAMIC){var n=m;e.cross(t,n),this.force.vadd(t,this.force),this.torque.vadd(n,this.torque)}};var v=new r,g=new r;l.prototype.applyLocalForce=function(t,e){if(this.type===l.DYNAMIC){var n=v,i=g;this.vectorToWorldFrame(t,n),this.vectorToWorldFrame(e,i),this.applyForce(n,i)}},new r;var y=new r,w=new r;l.prototype.applyImpulse=function(t,e){if(this.type===l.DYNAMIC){var n=e,i=y;i.copy(t),i.mult(this.invMass,i),this.velocity.vadd(i,this.velocity);var r=w;n.cross(t,r),this.invInertiaWorld.vmult(r,r),this.angularVelocity.vadd(r,this.angularVelocity)}};var x=new r,_=new r;l.prototype.applyLocalImpulse=function(t,e){if(this.type===l.DYNAMIC){var n=x,i=_;this.vectorToWorldFrame(t,n),this.vectorToWorldFrame(e,i),this.applyImpulse(n,i)}};var b=new r;l.prototype.updateMassProperties=function(){var t=b;this.invMass=this.mass>0?1/this.mass:0;var e=this.inertia,n=this.fixedRotation;this.computeAABB(),t.set((this.aabb.upperBound.x-this.aabb.lowerBound.x)/2,(this.aabb.upperBound.y-this.aabb.lowerBound.y)/2,(this.aabb.upperBound.z-this.aabb.lowerBound.z)/2),c.calculateInertia(t,this.mass,e),this.invInertia.set(e.x>0&&!n?1/e.x:0,e.y>0&&!n?1/e.y:0,e.z>0&&!n?1/e.z:0),this.updateInertiaWorld(!0)},l.prototype.getVelocityAtWorldPoint=function(t,e){var n=new r;return t.vsub(this.position,n),this.angularVelocity.cross(n,e),this.velocity.vadd(e,e),e},new r,new r,new a,new a,l.prototype.integrate=function(t,e,n){if(this.previousPosition.copy(this.position),this.previousQuaternion.copy(this.quaternion),(this.type===l.DYNAMIC||this.type===l.KINEMATIC)&&this.sleepState!==l.SLEEPING){var i=this.velocity,r=this.angularVelocity,o=this.position,a=this.force,s=this.torque,c=this.quaternion,u=this.invMass,h=this.invInertiaWorld,p=this.linearFactor,d=u*t;i.x+=a.x*d*p.x,i.y+=a.y*d*p.y,i.z+=a.z*d*p.z;var f=h.elements,m=this.angularFactor,v=s.x*m.x,g=s.y*m.y,y=s.z*m.z;r.x+=t*(f[0]*v+f[1]*g+f[2]*y),r.y+=t*(f[3]*v+f[4]*g+f[5]*y),r.z+=t*(f[6]*v+f[7]*g+f[8]*y),o.x+=i.x*t,o.y+=i.y*t,o.z+=i.z*t,c.integrate(this.angularVelocity,t,this.angularFactor,c),e&&(n?c.normalizeFast():c.normalize()),this.aabbNeedsUpdate=!0,this.updateInertiaWorld()}}},{"../collision/AABB":3,"../material/Material":26,"../math/Mat3":28,"../math/Quaternion":29,"../math/Vec3":31,"../shapes/Box":38,"../shapes/Shape":44,"../utils/EventTarget":50}],33:[function(t,e,n){t("./Body");var i=t("../math/Vec3"),r=t("../math/Quaternion"),o=(t("../collision/RaycastResult"),t("../collision/Ray")),a=t("../objects/WheelInfo");function s(t){this.chassisBody=t.chassisBody,this.wheelInfos=[],this.sliding=!1,this.world=null,this.indexRightAxis=void 0!==t.indexRightAxis?t.indexRightAxis:1,this.indexForwardAxis=void 0!==t.indexForwardAxis?t.indexForwardAxis:0,this.indexUpAxis=void 0!==t.indexUpAxis?t.indexUpAxis:2,this.numWheelsOnGround=0}e.exports=s,new i,new i,new i;var c=new i,l=new i,u=new i;new o,s.prototype.addWheel=function(t){var e=new a(t=t||{}),n=this.wheelInfos.length;return this.wheelInfos.push(e),n},s.prototype.setSteeringValue=function(t,e){this.wheelInfos[e].steering=t},new i,s.prototype.applyEngineForce=function(t,e){this.wheelInfos[e].engineForce=t},s.prototype.setBrake=function(t,e){this.wheelInfos[e].brake=t},s.prototype.addToWorld=function(t){this.constraints,t.addBody(this.chassisBody);var e=this;this.preStepCallback=function(){e.updateVehicle(t.dt)},t.addEventListener("preStep",this.preStepCallback),this.world=t},s.prototype.getVehicleAxisWorld=function(t,e){e.set(0===t?1:0,1===t?1:0,2===t?1:0),this.chassisBody.vectorToWorldFrame(e,e)},s.prototype.updateVehicle=function(t){if(!(this.chassisBody.sleepState>1)){for(var e=this.wheelInfos,n=e.length,r=this.chassisBody,o=0;od.maxSuspensionForce&&(l=d.maxSuspensionForce),d.raycastResult.hitNormalWorld.scale(l*t,s),d.raycastResult.hitPointWorld.vsub(r.position,c),r.applyImpulse(s,c)}this.updateFriction(t);var u=new i,h=new i,p=new i;for(o=0;o0?1:-1)*d.customSlidingRotationalSpeed*t),Math.abs(d.brake)>Math.abs(d.engineForce)&&(d.deltaRotation=0),d.lastRotation=d.rotation,d.rotation+=d.deltaRotation,d.deltaRotation*=.99}}},s.prototype.updateSuspension=function(t){for(var e=this.chassisBody.mass,n=this.wheelInfos,i=n.length,r=0;rm&&(t.suspensionLength=m,t.raycastResult.reset());var v=t.raycastResult.hitNormalWorld.dot(t.directionWorld),g=new i;r.getVelocityAtWorldPoint(t.raycastResult.hitPointWorld,g);var y=t.raycastResult.hitNormalWorld.dot(g);if(v>=-.1)t.suspensionRelativeVelocity=0,t.clippedInvContactDotSuspension=10;else{var w=-1/v;t.suspensionRelativeVelocity=y*w,t.clippedInvContactDotSuspension=w}}else t.suspensionLength=t.suspensionRestLength+0*t.maxSuspensionTravel,t.suspensionRelativeVelocity=0,t.directionWorld.scale(-1,t.raycastResult.hitNormalWorld),t.clippedInvContactDotSuspension=1;return o},s.prototype.updateWheelTransformWorld=function(t){t.isInContact=!1;var e=this.chassisBody;e.pointToWorldFrame(t.chassisConnectionPointLocal,t.chassisConnectionPointWorld),e.vectorToWorldFrame(t.directionLocal,t.directionWorld),e.vectorToWorldFrame(t.axleLocal,t.axleWorld)},s.prototype.updateWheelTransform=function(t){var e=c,n=l,i=u,o=this.wheelInfos[t];this.updateWheelTransformWorld(o),o.directionLocal.scale(-1,e),n.copy(o.axleLocal),e.cross(n,i),i.normalize(),n.normalize();var a=o.steering,s=new r;s.setFromAxisAngle(e,a);var h=new r;h.setFromAxisAngle(n,this.lerp(o.lastRotation,o.rotation,this.world.interpolationFactor));var p=o.worldTransform.quaternion;this.chassisBody.quaternion.mult(s,p),p.mult(h,p),p.normalize();var d=o.worldTransform.position;d.copy(o.directionWorld),d.scale(this.lerp(o.lastSuspensionLength,o.suspensionLength,this.world.interpolationFactor),d),d.vadd(o.chassisConnectionPointWorld,d)},s.prototype.lerp=function(t,e,n){return t+(e-t)*(n=(n=n<0?0:n)>1?1:n)};var d=[new i(1,0,0),new i(0,1,0),new i(0,0,1)];s.prototype.getWheelTransformWorld=function(t){return this.wheelInfos[t].worldTransform};var f=new i,m=[],v=[];s.prototype.updateFriction=function(t){var e=f,n=this.wheelInfos,r=n.length,o=this.chassisBody,a=v,s=m;this.numWheelsOnGround=0;for(var c=0;cb&&(this.sliding=!0,A.sliding=!0,w=_/Math.sqrt(E),A.skidInfo*=w)}}if(this.sliding)for(c=0;c1.1)return 0;var a=A,s=T,c=P;return t.getVelocityAtWorldPoint(e,a),n.getVelocityAtWorldPoint(i,s),a.vsub(s,c),-.2*r.dot(c)*(1/(t.invMass+n.invMass))}},{"../collision/Ray":10,"../collision/RaycastResult":11,"../math/Quaternion":29,"../math/Vec3":31,"../objects/WheelInfo":37,"./Body":32}],34:[function(t,e,n){var i=t("./Body"),r=t("../shapes/Sphere"),o=t("../shapes/Box"),a=t("../math/Vec3"),s=t("../constraints/HingeConstraint");function c(t){if(this.wheelBodies=[],this.coordinateSystem=void 0===t.coordinateSystem?new a(1,2,3):t.coordinateSystem.clone(),this.chassisBody=t.chassisBody,!this.chassisBody){var e=new o(new a(5,2,.5));this.chassisBody=new i(1,e)}this.constraints=[],this.wheelAxes=[],this.wheelForces=[]}e.exports=c,c.prototype.addWheel=function(t){var e=(t=t||{}).body;e||(e=new i(1,new r(1.2))),this.wheelBodies.push(e),this.wheelForces.push(0),new a;var n=void 0!==t.position?t.position.clone():new a,o=new a;this.chassisBody.pointToWorldFrame(n,o),e.position.set(o.x,o.y,o.z);var c=void 0!==t.axis?t.axis.clone():new a(0,1,0);this.wheelAxes.push(c);var l=new s(this.chassisBody,e,{pivotA:n,axisA:c,pivotB:a.ZERO,axisB:c,collideConnected:!1});return this.constraints.push(l),this.wheelBodies.length-1},c.prototype.setSteeringValue=function(t,e){var n=this.wheelAxes[e],i=Math.cos(t),r=Math.sin(t),o=n.x,a=n.y;this.constraints[e].axisA.set(i*o-r*a,r*o+i*a,0)},c.prototype.setMotorSpeed=function(t,e){var n=this.constraints[e];n.enableMotor(),n.motorTargetVelocity=t},c.prototype.disableMotor=function(t){this.constraints[t].disableMotor()};var l=new a;c.prototype.setWheelForce=function(t,e){this.wheelForces[e]=t},c.prototype.applyWheelForce=function(t,e){var n=this.wheelAxes[e],i=this.wheelBodies[e],r=i.torque;n.scale(t,l),i.vectorToWorldFrame(l,l),r.vadd(l,r)},c.prototype.addToWorld=function(t){for(var e=this.constraints,n=this.wheelBodies.concat([this.chassisBody]),i=0;ithis.particles.length&&this.neighbors.pop())};var o=new i;r.prototype.getNeighbors=function(t,e){for(var n=this.particles.length,i=t.id,r=this.smoothingRadius*this.smoothingRadius,a=o,s=0;s!==n;s++){var c=this.particles[s];c.position.vsub(t.position,a),i!==c.id&&a.norm2()=-.1)this.suspensionRelativeVelocity=0,this.clippedInvContactDotSuspension=10;else{var r=-1/n;this.suspensionRelativeVelocity=i*r,this.clippedInvContactDotSuspension=r}}else e.suspensionLength=this.suspensionRestLength,this.suspensionRelativeVelocity=0,e.directionWorld.scale(-1,e.hitNormalWorld),this.clippedInvContactDotSuspension=1}},{"../collision/RaycastResult":11,"../math/Transform":30,"../math/Vec3":31,"../utils/Utils":54}],38:[function(t,e,n){e.exports=a;var i=t("./Shape"),r=t("../math/Vec3"),o=t("./ConvexPolyhedron");function a(t){i.call(this,{type:i.types.BOX}),this.halfExtents=t,this.convexPolyhedronRepresentation=null,this.updateConvexPolyhedronRepresentation(),this.updateBoundingSphereRadius()}a.prototype=new i,a.prototype.constructor=a,a.prototype.updateConvexPolyhedronRepresentation=function(){var t=this.halfExtents.x,e=this.halfExtents.y,n=this.halfExtents.z,i=r,a=[new i(-t,-e,-n),new i(t,-e,-n),new i(t,e,-n),new i(-t,e,-n),new i(-t,-e,n),new i(t,-e,n),new i(t,e,n),new i(-t,e,n)],s=(new i(0,0,1),new i(0,1,0),new i(1,0,0),new o(a,[[3,2,1,0],[4,5,6,7],[5,4,0,1],[2,3,7,6],[0,4,7,3],[1,2,6,5]]));this.convexPolyhedronRepresentation=s,s.material=this.material},a.prototype.calculateLocalInertia=function(t,e){return e=e||new r,a.calculateInertia(this.halfExtents,t,e),e},a.calculateInertia=function(t,e,n){var i=t;n.x=1/12*e*(2*i.y*2*i.y+2*i.z*2*i.z),n.y=1/12*e*(2*i.x*2*i.x+2*i.z*2*i.z),n.z=1/12*e*(2*i.y*2*i.y+2*i.x*2*i.x)},a.prototype.getSideNormals=function(t,e){var n=t,i=this.halfExtents;if(n[0].set(i.x,0,0),n[1].set(0,i.y,0),n[2].set(0,0,i.z),n[3].set(-i.x,0,0),n[4].set(0,-i.y,0),n[5].set(0,0,-i.z),void 0!==e)for(var r=0;r!==n.length;r++)e.vmult(n[r],n[r]);return n},a.prototype.volume=function(){return 8*this.halfExtents.x*this.halfExtents.y*this.halfExtents.z},a.prototype.updateBoundingSphereRadius=function(){this.boundingSphereRadius=this.halfExtents.norm()};var s=new r;new r,a.prototype.forEachWorldCorner=function(t,e,n){for(var i=this.halfExtents,r=[[i.x,i.y,i.z],[-i.x,i.y,i.z],[-i.x,-i.y,i.z],[-i.x,-i.y,-i.z],[i.x,-i.y,-i.z],[i.x,i.y,-i.z],[-i.x,i.y,-i.z],[i.x,-i.y,i.z]],o=0;oi.x&&(i.x=s),l>i.y&&(i.y=l),u>i.z&&(i.z=u),sd&&(d=m,p=f)}for(var v=[],g=n.faces[p],y=g.length,w=0;w=0&&this.clipFaceAgainstHull(a,t,e,v,s,c,l)};var h=new r,p=new r,d=new r,f=new r,m=new r,v=new r;a.prototype.findSeparatingAxis=function(t,e,n,i,r,o,a,s){var c=h,l=p,u=d,g=f,y=m,w=v,x=Number.MAX_VALUE;if(this.uniqueAxes)for(b=0;b!==this.uniqueAxes.length;b++){if(n.vmult(this.uniqueAxes[b],c),!1===(E=this.testSepAxis(c,t,e,n,i,r)))return!1;E0&&o.negate(o),!0};var g=[],y=[];a.prototype.testSepAxis=function(t,e,n,i,r,o){a.project(this,t,n,i,g),a.project(e,t,r,o,y);var s=g[0],c=g[1],l=y[0],u=y[1];if(se&&(e=r)}this.maxValue=e},s.prototype.setHeightValueAtIndex=function(t,e,n){this.data[t][e]=n,this.clearCachedConvexTrianglePillar(t,e,!1),t>0&&(this.clearCachedConvexTrianglePillar(t-1,e,!0),this.clearCachedConvexTrianglePillar(t-1,e,!1)),e>0&&(this.clearCachedConvexTrianglePillar(t,e-1,!0),this.clearCachedConvexTrianglePillar(t,e-1,!1)),e>0&&t>0&&this.clearCachedConvexTrianglePillar(t-1,e-1,!0)},s.prototype.getRectMinMax=function(t,e,n,i,r){r=r||[];for(var o=this.data,a=this.minValue,s=t;s<=n;s++)for(var c=e;c<=i;c++){var l=o[s][c];l>a&&(a=l)}r[0]=this.minValue,r[1]=a},s.prototype.getIndexOfPosition=function(t,e,n,i){var r=this.elementSize,o=this.data,a=Math.floor(t/r),s=Math.floor(e/r);return n[0]=a,n[1]=s,i&&(a<0&&(a=0),s<0&&(s=0),a>=o.length-1&&(a=o.length-1),s>=o[0].length-1&&(s=o[0].length-1)),!(a<0||s<0||a>=o.length-1||s>=o[0].length-1)};var c=[],l=new o,u=new o,h=new o,p=new o;s.prototype.getTriangleAt=function(t,e,n,i,r,o){var a=c;this.getIndexOfPosition(t,e,a,n);var s=a[0],l=a[1],u=this.data;n&&(s=Math.min(u.length-2,Math.max(0,s)),l=Math.min(u[0].length-2,Math.max(0,l)));var h=this.elementSize,p=Math.pow(t/h-s,2)+Math.pow(e/h-l,2)>Math.pow(t/h-(s+1),2)+Math.pow(e/h-(l+1),2);return this.getTriangle(s,l,p,i,r,o),p};var d=new o,f=new o,m=new o,v=new o,g=new o;s.prototype.getNormalAt=function(t,e,n,i){var r=d,o=f,a=m,s=v,c=g;this.getTriangleAt(t,e,n,r,o,a),o.vsub(r,s),a.vsub(r,c),s.cross(c,i),i.normalize()},s.prototype.getAabbAtIndex=function(t,e,n){var i=this.data,r=this.elementSize;n.lowerBound.set(t*r,e*r,i[t][e]),n.upperBound.set((t+1)*r,(e+1)*r,i[t+1][e+1])},s.prototype.getHeightAt=function(t,e,n){var i=this.data,r=u,o=h,a=p,s=c;this.getIndexOfPosition(t,e,s,n);var d=s[0],f=s[1];n&&(d=Math.min(i.length-2,Math.max(0,d)),f=Math.min(i[0].length-2,Math.max(0,f)));var m=this.getTriangleAt(t,e,n,r,o,a);!function(t,e,n,i,r,o,a,s,c){c.x=((o-s)*(t-a)+(a-r)*(e-s))/((o-s)*(n-a)+(a-r)*(i-s)),c.y=((s-i)*(t-a)+(n-a)*(e-s))/((o-s)*(n-a)+(a-r)*(i-s)),c.z=1-c.x-c.y}(t,e,r.x,r.y,o.x,o.y,a.x,a.y,l);var v=l;return m?i[d+1][f+1]*v.x+i[d][f+1]*v.y+i[d+1][f]*v.z:i[d][f]*v.x+i[d+1][f]*v.y+i[d][f+1]*v.z},s.prototype.getCacheConvexTrianglePillarKey=function(t,e,n){return t+"_"+e+"_"+(n?1:0)},s.prototype.getCachedConvexTrianglePillar=function(t,e,n){return this._cachedPillars[this.getCacheConvexTrianglePillarKey(t,e,n)]},s.prototype.setCachedConvexTrianglePillar=function(t,e,n,i,r){this._cachedPillars[this.getCacheConvexTrianglePillarKey(t,e,n)]={convex:i,offset:r}},s.prototype.clearCachedConvexTrianglePillar=function(t,e,n){delete this._cachedPillars[this.getCacheConvexTrianglePillarKey(t,e,n)]},s.prototype.getTriangle=function(t,e,n,i,r,o){var a=this.data,s=this.elementSize;n?(i.set((t+1)*s,(e+1)*s,a[t+1][e+1]),r.set(t*s,(e+1)*s,a[t][e+1]),o.set((t+1)*s,e*s,a[t+1][e])):(i.set(t*s,e*s,a[t][e]),r.set((t+1)*s,e*s,a[t+1][e]),o.set(t*s,(e+1)*s,a[t][e+1]))},s.prototype.getConvexTrianglePillar=function(t,e,n){var i=this.pillarConvex,a=this.pillarOffset;if(this.cacheEnabled){if(s=this.getCachedConvexTrianglePillar(t,e,n))return this.pillarConvex=s.convex,void(this.pillarOffset=s.offset);i=new r,a=new o,this.pillarConvex=i,this.pillarOffset=a}var s=this.data,c=this.elementSize,l=i.faces;i.vertices.length=6;for(var u=0;u<6;u++)i.vertices[u]||(i.vertices[u]=new o);for(l.length=5,u=0;u<5;u++)l[u]||(l[u]=[]);var h=i.vertices,p=(Math.min(s[t][e],s[t+1][e],s[t][e+1],s[t+1][e+1])-this.minValue)/2+this.minValue;n?(a.set((t+.75)*c,(e+.75)*c,p),h[0].set(.25*c,.25*c,s[t+1][e+1]-p),h[1].set(-.75*c,.25*c,s[t][e+1]-p),h[2].set(.25*c,-.75*c,s[t+1][e]-p),h[3].set(.25*c,.25*c,-p-1),h[4].set(-.75*c,.25*c,-p-1),h[5].set(.25*c,-.75*c,-p-1),l[0][0]=0,l[0][1]=1,l[0][2]=2,l[1][0]=5,l[1][1]=4,l[1][2]=3,l[2][0]=2,l[2][1]=5,l[2][2]=3,l[2][3]=0,l[3][0]=3,l[3][1]=4,l[3][2]=1,l[3][3]=0,l[4][0]=1,l[4][1]=4,l[4][2]=5,l[4][3]=2):(a.set((t+.25)*c,(e+.25)*c,p),h[0].set(-.25*c,-.25*c,s[t][e]-p),h[1].set(.75*c,-.25*c,s[t+1][e]-p),h[2].set(-.25*c,.75*c,s[t][e+1]-p),h[3].set(-.25*c,-.25*c,-p-1),h[4].set(.75*c,-.25*c,-p-1),h[5].set(-.25*c,.75*c,-p-1),l[0][0]=0,l[0][1]=1,l[0][2]=2,l[1][0]=5,l[1][1]=4,l[1][2]=3,l[2][0]=0,l[2][1]=2,l[2][2]=5,l[2][3]=3,l[3][0]=1,l[3][1]=0,l[3][2]=3,l[3][3]=4,l[4][0]=4,l[4][1]=5,l[4][2]=2,l[4][3]=1),i.computeNormals(),i.computeEdges(),i.updateBoundingSphereRadius(),this.setCachedConvexTrianglePillar(t,e,n,i,a)},s.prototype.calculateLocalInertia=function(t,e){return(e=e||new o).set(0,0,0),e},s.prototype.volume=function(){return Number.MAX_VALUE},s.prototype.calculateWorldAABB=function(t,e,n,i){n.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),i.set(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE)},s.prototype.updateBoundingSphereRadius=function(){var t=this.data,e=this.elementSize;this.boundingSphereRadius=new o(t.length*e,t[0].length*e,Math.max(Math.abs(this.maxValue),Math.abs(this.minValue))).norm()},s.prototype.setHeightsFromImage=function(t,e){var n=document.createElement("canvas");n.width=t.width,n.height=t.height;var i=n.getContext("2d");i.drawImage(t,0,0);var r=i.getImageData(0,0,t.width,t.height),o=this.data;o.length=0,this.elementSize=Math.abs(e.x)/r.width;for(var a=0;an.x&&(n.x=r.x),r.yn.y&&(n.y=r.y),r.zn.z&&(n.z=r.z)},c.prototype.updateAABB=function(){this.computeLocalAABB(this.aabb)},c.prototype.updateBoundingSphereRadius=function(){for(var t=0,e=this.vertices,n=new r,i=0,o=e.length/3;i!==o;i++){this.getVertex(i,n);var a=n.norm2();a>t&&(t=a)}this.boundingSphereRadius=Math.sqrt(t)},new r;var x=new o,_=new a;c.prototype.calculateWorldAABB=function(t,e,n,i){var r=x,o=_;r.position=t,r.quaternion=e,this.aabb.toWorldFrame(r,o),n.copy(o.lowerBound),i.copy(o.upperBound)},c.prototype.volume=function(){return 4*Math.PI*this.boundingSphereRadius/3},c.createTorus=function(t,e,n,i,r){t=t||1,e=e||.5,n=n||8,i=i||6,r=r||2*Math.PI;for(var o=[],a=[],s=0;s<=n;s++)for(var l=0;l<=i;l++){var u=l/i*r,h=s/n*Math.PI*2,p=(t+e*Math.cos(h))*Math.cos(u),d=(t+e*Math.cos(h))*Math.sin(u),f=e*Math.sin(h);o.push(p,d,f)}for(s=1;s<=n;s++)for(l=1;l<=i;l++){var m=(i+1)*s+l-1,v=(i+1)*(s-1)+l-1,g=(i+1)*(s-1)+l,y=(i+1)*s+l;a.push(m,v,y),a.push(v,g,y)}return new c(o,a)}},{"../collision/AABB":3,"../math/Quaternion":29,"../math/Transform":30,"../math/Vec3":31,"../utils/Octree":51,"./Shape":44}],47:[function(t,e,n){e.exports=r,t("../math/Vec3"),t("../math/Quaternion");var i=t("./Solver");function r(){i.call(this),this.iterations=10,this.tolerance=1e-7}r.prototype=new i;var o=[],a=[],s=[];r.prototype.solve=function(t,e){var n,i,r,c,l,u=0,h=this.iterations,p=this.tolerance*this.tolerance,d=this.equations,f=d.length,m=e.bodies,v=m.length,g=t;if(0!==f)for(var y=0;y!==v;y++)m[y].updateSolveMassProperties();var w=a,x=s,_=o;for(w.length=f,x.length=f,_.length=f,y=0;y!==f;y++){var b=d[y];_[y]=0,x[y]=b.computeB(g),w[y]=1/b.computeC()}if(0!==f){for(y=0;y!==v;y++){var S=(A=m[y]).vlambda,M=A.wlambda;S.set(0,0,0),M.set(0,0,0)}for(u=0;u!==h;u++){c=0;for(var E=0;E!==f;E++)b=d[E],n=x[E],i=w[E],(l=_[E])+(r=i*(n-b.computeGWlambda()-b.eps*l))b.maxForce&&(r=b.maxForce-l),_[E]+=r,c+=r>0?r:-r,b.addToWlambda(r);if(c*c=0;t--)this.children[t].removeEmptyNodes(),this.children[t].children.length||this.children[t].data.length||this.children.splice(t,1)}},{"../collision/AABB":3,"../math/Vec3":31}],52:[function(t,e,n){function i(){this.objects=[],this.type=Object}e.exports=i,i.prototype.release=function(){for(var t=arguments.length,e=0;e!==t;e++)this.objects.push(arguments[e]);return this},i.prototype.get=function(){return 0===this.objects.length?this.constructObject():this.objects.pop()},i.prototype.constructObject=function(){throw new Error("constructObject() not implemented in this Pool subclass yet!")},i.prototype.resize=function(t){for(var e=this.objects;e.length>t;)e.pop();for(;e.lengthe){var n=e;e=t,t=n}return this.data[t+"-"+e]},i.prototype.set=function(t,e,n){if(t>e){var i=e;e=t,t=i}var r=t+"-"+e;this.get(t,e)||this.data.keys.push(r),this.data[r]=n},i.prototype.reset=function(){for(var t=this.data,e=t.keys;e.length>0;)delete t[e.pop()]}},{}],54:[function(t,e,n){function i(){}e.exports=i,i.defaults=function(t,e){for(var n in t=t||{},e)n in t||(t[n]=e[n]);return t}},{}],55:[function(t,e,n){e.exports=o;var i=t("../math/Vec3"),r=t("./Pool");function o(){r.call(this),this.type=i}o.prototype=new r,o.prototype.constructObject=function(){return new i}},{"../math/Vec3":31,"./Pool":52}],56:[function(t,e,n){e.exports=d;var i=t("../collision/AABB"),r=t("../objects/Body"),o=t("../shapes/Shape"),a=t("../collision/Ray"),s=t("../math/Vec3"),c=t("../math/Transform"),l=(t("../shapes/ConvexPolyhedron"),t("../math/Quaternion")),u=(t("../solver/Solver"),t("../utils/Vec3Pool")),h=t("../equations/ContactEquation"),p=t("../equations/FrictionEquation");function d(t){this.contactPointPool=[],this.frictionEquationPool=[],this.result=[],this.frictionResult=[],this.v3pool=new u,this.world=t,this.currentContactMaterial=null,this.enableFrictionReduction=!1}d.prototype.createContactEquation=function(t,e,n,i,r,o){var a;this.contactPointPool.length?((a=this.contactPointPool.pop()).bi=t,a.bj=e):a=new h(t,e),a.enabled=t.collisionResponse&&e.collisionResponse&&n.collisionResponse&&i.collisionResponse;var s=this.currentContactMaterial;a.restitution=s.restitution,a.setSpookParams(s.contactEquationStiffness,s.contactEquationRelaxation,this.world.dt);var c=n.material||t.material,l=i.material||e.material;return c&&l&&c.restitution>=0&&l.restitution>=0&&(a.restitution=c.restitution*l.restitution),a.si=r||n,a.sj=o||i,a},d.prototype.createFrictionEquationsFromContact=function(t,e){var n=t.bi,i=t.bj,r=t.si,o=t.sj,a=this.world,s=this.currentContactMaterial,c=s.friction,l=r.material||n.material,u=o.material||i.material;if(l&&u&&l.friction>=0&&u.friction>=0&&(c=l.friction*u.friction),c>0){var h=c*a.gravity.length(),d=n.invMass+i.invMass;d>0&&(d=1/d);var f=this.frictionEquationPool,m=f.length?f.pop():new p(n,i,h*d),v=f.length?f.pop():new p(n,i,h*d);return m.bi=v.bi=n,m.bj=v.bj=i,m.minForce=v.minForce=-h*d,m.maxForce=v.maxForce=h*d,m.ri.copy(t.ri),m.rj.copy(t.rj),v.ri.copy(t.ri),v.rj.copy(t.rj),t.ni.tangents(m.t,v.t),m.setSpookParams(s.frictionEquationStiffness,s.frictionEquationRelaxation,a.dt),v.setSpookParams(s.frictionEquationStiffness,s.frictionEquationRelaxation,a.dt),m.enabled=v.enabled=t.enabled,e.push(m,v),!0}return!1};var f=new s,m=new s,v=new s;d.prototype.createFrictionFromAverage=function(t){var e=this.result[this.result.length-1];if(this.createFrictionEquationsFromContact(e,this.frictionResult)&&1!==t){var n=this.frictionResult[this.frictionResult.length-2],i=this.frictionResult[this.frictionResult.length-1];f.setZero(),m.setZero(),v.setZero();for(var r=e.bi,o=(e.bj,0);o!==t;o++)(e=this.result[this.result.length-1-o]).bodyA!==r?(f.vadd(e.ni,f),m.vadd(e.ri,m),v.vadd(e.rj,v)):(f.vsub(e.ni,f),m.vadd(e.rj,m),v.vadd(e.ri,v));var a=1/t;m.scale(a,n.ri),v.scale(a,n.rj),i.ri.copy(n.ri),i.rj.copy(n.rj),f.normalize(),f.tangents(n.t,i.t)}};var g=new s,y=new s,w=new l,x=new l;d.prototype.getContacts=function(t,e,n,i,o,a,s){this.contactPointPool=o,this.frictionEquationPool=s,this.result=i,this.frictionResult=a;for(var c=w,l=x,u=g,h=y,p=0,d=t.length;p!==d;p++){var f=t[p],m=e[p],v=null;f.material&&m.material&&(v=n.getContactMaterial(f.material,m.material)||null);for(var _=f.type&r.KINEMATIC&&m.type&r.STATIC||f.type&r.STATIC&&m.type&r.KINEMATIC||f.type&r.KINEMATIC&&m.type&r.KINEMATIC,b=0;bS.boundingSphereRadius+E.boundingSphereRadius)){var A=null;S.material&&E.material&&(A=n.getContactMaterial(S.material,E.material)||null),this.currentContactMaterial=A||v||n.defaultContactMaterial;var T=this[S.type|E.type];T&&(S.type0&&H<0&&(g.vsub(d,y),v.copy(m),v.normalize(),G=y.dot(v),v.scale(G,y),y.vadd(d,y),(Z=y.distanceTo(g))0&&!0===i||u<=0&&!1===i))return!1;null===i&&(i=u>0)}return!0}var W=new s,q=new s,X=new s,Y=new s,Q=[new s,new s,new s,new s,new s,new s],K=new s,Z=new s,J=new s,$=new s;d.prototype[o.types.SPHERE|o.types.BOX]=d.prototype.sphereBox=function(t,e,n,i,r,o,a,s,c,l,u){var h=this.v3pool,p=Q;n.vsub(i,W),e.getSideNormals(p,o);for(var d=t.radius,f=!1,m=Z,v=J,g=$,y=null,w=0,x=0,_=0,b=null,S=0,M=p.length;S!==M&&!1===f;S++){var E=q;E.copy(p[S]);var A=E.norm();E.normalize();var T=W.dot(E);if(T0){var P=X,L=Y;P.copy(p[(S+1)%3]),L.copy(p[(S+2)%3]);var C=P.norm(),R=L.norm();P.normalize(),L.normalize();var O=W.dot(P),F=W.dot(L);if(O-C&&F-R){var I=Math.abs(T-A-d);if((null===b||I0){for(var C=[],R=0,O=S.length;R!==O;R++){var F=h.get();o.vmult(f[S[R]],F),i.vadd(F,F),C.push(F)}if(G(C,M,n)){if(u)return!0;x=!0;var I=this.createContactEquation(a,s,t,e,c,l);M.mult(-m,I.ri),M.negate(I.ni);var N=h.get();M.mult(-P,N);var B=h.get();M.mult(-m,B),n.vsub(i,I.rj),I.rj.vadd(B,I.rj),I.rj.vadd(N,I.rj),I.rj.vadd(i,I.rj),I.rj.vsub(s.position,I.rj),I.ri.vadd(n,I.ri),I.ri.vsub(a.position,I.ri),h.release(N),h.release(B),this.result.push(I),this.createFrictionEquationsFromContact(I,this.frictionResult),R=0;for(var D=C.length;R!==D;R++)h.release(C[R]);return}for(R=0;R!==S.length;R++){var z=h.get(),V=h.get();o.vmult(f[S[(R+1)%S.length]],z),o.vmult(f[S[(R+2)%S.length]],V),i.vadd(z,z),i.vadd(V,V);var U=et;V.vsub(z,U);var k=nt;U.unit(k);var j=h.get(),H=h.get();n.vsub(z,H);var W=H.dot(k);k.mult(W,j),j.vadd(z,j);var q=h.get();if(j.vsub(n,q),W>0&&W*Wt.boundingSphereRadius+e.boundingSphereRadius)&&t.findSeparatingAxis(e,n,r,i,o,d,h,p)){var f=[],m=mt;t.clipAgainstHull(n,r,e,i,o,d,-100,100,f);for(var v=0,g=0;g!==f.length;g++){if(u)return!0;var y=this.createContactEquation(a,s,t,e,c,l),w=y.ri,x=y.rj;d.negate(y.ni),f[g].normal.negate(m),m.mult(f[g].depth,m),f[g].point.vadd(m,w),x.copy(f[g].point),w.vsub(n,w),x.vsub(i,x),w.vadd(n,w),w.vsub(a.position,w),x.vadd(i,x),x.vsub(s.position,x),this.result.push(y),v++,this.enableFrictionReduction||this.createFrictionEquationsFromContact(y,this.frictionResult)}this.enableFrictionReduction&&v&&this.createFrictionFromAverage(v)}};var vt=new s,gt=new s,yt=new s;d.prototype[o.types.PLANE|o.types.PARTICLE]=d.prototype.planeParticle=function(t,e,n,i,r,o,a,s,c,l,u){var h=vt;h.set(0,0,1),a.quaternion.vmult(h,h);var p=gt;if(i.vsub(a.position,p),h.dot(p)<=0){if(u)return!0;var d=this.createContactEquation(s,a,e,t,c,l);d.ni.copy(h),d.ni.negate(d.ni),d.ri.set(0,0,0);var f=yt;h.mult(h.dot(i),f),i.vsub(f,f),d.rj.copy(f),this.result.push(d),this.createFrictionEquationsFromContact(d,this.frictionResult)}};var wt=new s;d.prototype[o.types.PARTICLE|o.types.SPHERE]=d.prototype.sphereParticle=function(t,e,n,i,r,o,a,s,c,l,u){var h=wt;if(h.set(0,0,1),i.vsub(n,h),h.norm2()<=t.radius*t.radius){if(u)return!0;var p=this.createContactEquation(s,a,e,t,c,l);h.normalize(),p.rj.copy(h),p.rj.mult(t.radius,p.rj),p.ni.copy(h),p.ni.negate(p.ni),p.ri.set(0,0,0),this.result.push(p),this.createFrictionEquationsFromContact(p,this.frictionResult)}};var xt=new l,_t=new s,bt=(new s,new s),St=new s,Mt=new s;d.prototype[o.types.PARTICLE|o.types.CONVEXPOLYHEDRON]=d.prototype.convexParticle=function(t,e,n,i,r,o,a,s,c,l,u){var h=-1,p=bt,d=Mt,f=null,m=_t;if(m.copy(i),m.vsub(n,m),r.conjugate(xt),xt.vmult(m,m),t.pointIsInside(m)){t.worldVerticesNeedsUpdate&&t.computeWorldVertices(n,r),t.worldFaceNormalsNeedsUpdate&&t.computeWorldFaceNormals(r);for(var v=0,g=t.faces.length;v!==g;v++){var y=[t.worldVertices[t.faces[v][0]]],w=t.worldFaceNormals[v];i.vsub(y[0],St);var x=-w.dot(St);if(null===f||Math.abs(x)p.length||x>p[0].length)){y<0&&(y=0),w<0&&(w=0),x<0&&(x=0),_<0&&(_=0),y>=p.length&&(y=p.length-1),w>=p.length&&(w=p.length-1),_>=p[0].length&&(_=p[0].length-1),x>=p[0].length&&(x=p[0].length-1);var b=[];e.getRectMinMax(y,x,w,_,b);var S=b[0],M=b[1];if(!(g.z-f>M||g.z+fp.length||w>p[0].length)){g<0&&(g=0),y<0&&(y=0),w<0&&(w=0),x<0&&(x=0),g>=p.length&&(g=p.length-1),y>=p.length&&(y=p.length-1),x>=p[0].length&&(x=p[0].length-1),w>=p[0].length&&(w=p[0].length-1);var _=[];e.getRectMinMax(g,w,y,x,_);var b=_[0],S=_[1];if(!(v.z-d>S||v.z+d2)return}}}},{"../collision/AABB":3,"../collision/Ray":10,"../equations/ContactEquation":20,"../equations/FrictionEquation":22,"../math/Quaternion":29,"../math/Transform":30,"../math/Vec3":31,"../objects/Body":32,"../shapes/ConvexPolyhedron":39,"../shapes/Shape":44,"../solver/Solver":48,"../utils/Vec3Pool":55}],57:[function(t,e,n){e.exports=y,t("../shapes/Shape");var i=t("../math/Vec3"),r=t("../math/Quaternion"),o=t("../solver/GSSolver"),a=(t("../equations/ContactEquation"),t("../equations/FrictionEquation"),t("./Narrowphase")),s=t("../utils/EventTarget"),c=t("../collision/ArrayCollisionMatrix"),l=t("../collision/OverlapKeeper"),u=t("../material/Material"),h=t("../material/ContactMaterial"),p=t("../objects/Body"),d=t("../utils/TupleDictionary"),f=t("../collision/RaycastResult"),m=t("../collision/AABB"),v=t("../collision/Ray"),g=t("../collision/NaiveBroadphase");function y(t){t=t||{},s.apply(this),this.dt=-1,this.allowSleep=!!t.allowSleep,this.contacts=[],this.frictionEquations=[],this.quatNormalizeSkip=void 0!==t.quatNormalizeSkip?t.quatNormalizeSkip:0,this.quatNormalizeFast=void 0!==t.quatNormalizeFast&&t.quatNormalizeFast,this.time=0,this.interpolationFactor=0,this.stepnumber=0,this.default_dt=1/60,this.nextId=0,this.gravity=new i,t.gravity&&this.gravity.copy(t.gravity),this.broadphase=void 0!==t.broadphase?t.broadphase:new g,this.bodies=[],this.solver=void 0!==t.solver?t.solver:new o,this.constraints=[],this.narrowphase=new a(this),this.collisionMatrix=new c,this.collisionMatrixPrevious=new c,this.bodyOverlapKeeper=new l,this.shapeOverlapKeeper=new l,this.materials=[],this.contactmaterials=[],this.contactMaterialTable=new d,this.defaultMaterial=new u("default"),this.defaultContactMaterial=new h(this.defaultMaterial,this.defaultMaterial,{friction:.3,restitution:0}),this.doProfiling=!1,this.profile={solve:0,makeContactConstraints:0,broadphase:0,integrate:0,narrowphase:0},this.accumulator=0,this.subsystems=[],this.addBodyEvent={type:"addBody",body:null},this.removeBodyEvent={type:"removeBody",body:null},this.idToBodyMap={},this.broadphase.setWorld(this)}y.prototype=new s,new m;var w=new v;if(y.prototype.getContactMaterial=function(t,e){return this.contactMaterialTable.get(t.id,e.id)},y.prototype.numObjects=function(){return this.bodies.length},y.prototype.collisionMatrixTick=function(){var t=this.collisionMatrixPrevious;this.collisionMatrixPrevious=this.collisionMatrix,this.collisionMatrix=t,this.collisionMatrix.reset(),this.bodyOverlapKeeper.tick(),this.shapeOverlapKeeper.tick()},y.prototype.add=y.prototype.addBody=function(t){-1===this.bodies.indexOf(t)&&(t.index=this.bodies.length,this.bodies.push(t),t.world=this,t.initPosition.copy(t.position),t.initVelocity.copy(t.velocity),t.timeLastSleepy=this.time,t instanceof p&&(t.initAngularVelocity.copy(t.angularVelocity),t.initQuaternion.copy(t.quaternion)),this.collisionMatrix.setNumObjects(this.bodies.length),this.addBodyEvent.body=t,this.idToBodyMap[t.id]=t,this.dispatchEvent(this.addBodyEvent))},y.prototype.addConstraint=function(t){this.constraints.push(t)},y.prototype.removeConstraint=function(t){var e=this.constraints.indexOf(t);-1!==e&&this.constraints.splice(e,1)},y.prototype.rayTest=function(t,e,n){n instanceof f?this.raycastClosest(t,e,{skipBackfaces:!0},n):this.raycastAll(t,e,{skipBackfaces:!0},n)},y.prototype.raycastAll=function(t,e,n,i){return n.mode=v.ALL,n.from=t,n.to=e,n.callback=i,w.intersectWorld(this,n)},y.prototype.raycastAny=function(t,e,n,i){return n.mode=v.ANY,n.from=t,n.to=e,n.result=i,w.intersectWorld(this,n)},y.prototype.raycastClosest=function(t,e,n,i){return n.mode=v.CLOSEST,n.from=t,n.to=e,n.result=i,w.intersectWorld(this,n)},y.prototype.remove=function(t){t.world=null;var e=this.bodies.length-1,n=this.bodies,i=n.indexOf(t);if(-1!==i){n.splice(i,1);for(var r=0;r!==n.length;r++)n[r].index=r;this.collisionMatrix.setNumObjects(e),this.removeBodyEvent.body=t,delete this.idToBodyMap[t.id],this.dispatchEvent(this.removeBodyEvent)}},y.prototype.removeBody=y.prototype.remove,y.prototype.getBodyById=function(t){return this.idToBodyMap[t]},y.prototype.getShapeById=function(t){for(var e=this.bodies,n=0,i=e.length;n=t&&i=0;S-=1)(k.bodyA===i[S]&&k.bodyB===r[S]||k.bodyB===i[S]&&k.bodyA===r[S])&&(i.splice(S,1),r.splice(S,1));this.collisionMatrixTick(),l&&(e=performance.now());var M=C,E=n.length;for(y=0;y!==E;y++)M.push(n[y]);n.length=0;var A=this.frictionEquations.length;for(y=0;y!==A;y++)f.push(this.frictionEquations[y]);for(this.frictionEquations.length=0,this.narrowphase.getContacts(i,r,this,n,M,this.frictionEquations,f),l&&(u.narrowphase=performance.now()-e),l&&(e=performance.now()),y=0;y=0&&z.material.friction>=0&&(D.material.friction,z.material.friction),D.material.restitution>=0&&z.material.restitution>=0&&(k.restitution=D.material.restitution*z.material.restitution)),s.addEquation(k),D.allowSleep&&D.type===p.DYNAMIC&&D.sleepState===p.SLEEPING&&z.sleepState===p.AWAKE&&z.type!==p.STATIC&&z.velocity.norm2()+z.angularVelocity.norm2()>=2*Math.pow(z.sleepSpeedLimit,2)&&(D._wakeUpAfterNarrowphase=!0),z.allowSleep&&z.type===p.DYNAMIC&&z.sleepState===p.SLEEPING&&D.sleepState===p.AWAKE&&D.type!==p.STATIC&&D.velocity.norm2()+D.angularVelocity.norm2()>=2*Math.pow(D.sleepSpeedLimit,2)&&(z._wakeUpAfterNarrowphase=!0),this.collisionMatrix.set(D,z,!0),this.collisionMatrixPrevious.get(D,z)||(L.body=z,L.contact=k,D.dispatchEvent(L),L.body=D,z.dispatchEvent(L)),this.bodyOverlapKeeper.set(D.id,z.id),this.shapeOverlapKeeper.set(V.id,U.id)}for(this.emitContactEvents(),l&&(u.makeContactConstraints=performance.now()-e,e=performance.now()),y=0;y!==o;y++)(D=a[y])._wakeUpAfterNarrowphase&&(D.wakeUp(),D._wakeUpAfterNarrowphase=!1);for(b=d.length,y=0;y!==b;y++){var k;(k=d[y]).update(),S=0;for(var j=k.equations.length;S!==j;S++){var H=k.equations[S];s.addEquation(H)}}s.solve(t,this),l&&(u.solve=performance.now()-e),s.removeAllEquations();var G=Math.pow;for(y=0;y!==o;y++)if((D=a[y]).type&h){var W=G(I(1-D.linearDamping),t),q=D.velocity;q.mult(W,q);var X=D.angularVelocity;if(X){var Y=G(I(1-D.angularDamping),t);X.mult(Y,X)}}for(this.dispatchEvent(P),y=0;y!==o;y++)(D=a[y]).preStep&&D.preStep(D);l&&(e=performance.now());var Q=this.stepnumber%(this.quatNormalizeSkip+1)==0,K=this.quatNormalizeFast;for(y=0;y!==o;y++)a[y].integrate(t,Q,K);for(this.clearForces(),this.broadphase.dirty=!0,l&&(u.integrate=performance.now()-e),this.time+=t,this.stepnumber+=1,this.dispatchEvent(T),y=0;y!==o;y++){var Z=(D=a[y]).postStep;Z&&Z(D)}if(this.allowSleep)for(y=0;y!==o;y++)a[y].sleepTick(this.time)},y.prototype.emitContactEvents=(_=[],b=[],S={type:"beginContact",bodyA:null,bodyB:null},M={type:"endContact",bodyA:null,bodyB:null},E={type:"beginShapeContact",bodyA:null,bodyB:null,shapeA:null,shapeB:null},A={type:"endShapeContact",bodyA:null,bodyB:null,shapeA:null,shapeB:null},function(){var t=this.hasAnyEventListener("beginContact"),e=this.hasAnyEventListener("endContact");if((t||e)&&this.bodyOverlapKeeper.getDiff(_,b),t){for(var n=0,i=_.length;n1-n?0:i<-1+n?Math.PI:Math.acos(i)},e.getSignedAngleBetweenVectors=function(t,e,n,r){void 0===n&&(n=new i.Vector3(0,1,0)),void 0===r&&(r=5e-4);var o=this.getAngleBetweenVectors(t,e,r),a=(new i.Vector3).crossVectors(t,e);return n.dot(a)<0&&(o=-o),o},e.haveSameSigns=function(t,e){return t<0==e<0},e.haveDifferentSigns=function(t,e){return t<0!=e<0},e.setDefaults=function(t,e){return o.defaults({},o.clone(t),e)},e.getGlobalProperties=function(t){void 0===t&&(t="");var e=[],n=window;for(var i in n)0===i.indexOf(t)&&e.push(i);return e},e.spring=function(t,e,n,i,r){var o=e-t;n+=o/=i;var s=t+(n*=r);return new a.SimulationFrame(s,n)},e.springV=function(t,e,n,r,o){var a=(new i.Vector3).subVectors(e,t);a.divideScalar(r),n.add(a),n.multiplyScalar(o),t.add(n)},e.threeVector=function(t){return new i.Vector3(t.x,t.y,t.z)},e.cannonVector=function(t){return new r.Vec3(t.x,t.y,t.z)},e.threeQuat=function(t){return new i.Quaternion(t.x,t.y,t.z,t.w)},e.cannonQuat=function(t){return new r.Quaternion(t.x,t.y,t.z,t.w)},e.setupMeshProperties=function(t){if(t.castShadow=!0,t.receiveShadow=!0,null!==t.material.map){var e=new i.MeshPhongMaterial;e.shininess=0,e.name=t.material.name,e.map=t.material.map,e.map.anisotropy=4,e.aoMap=t.material.aoMap,e.transparent=t.material.transparent,e.skinning=t.material.skinning,t.material=e}},e.detectRelativeSide=function(t,e){var n=l(t,c.Space.Local),i=e.position.clone().sub(t.position).normalize();return n.dot(i)>0?s.Side.Left:s.Side.Right},e.easeInOutSine=function(t){return-(Math.cos(Math.PI*t)-1)/2},e.easeOutQuad=function(t){return 1-(1-t)*(1-t)},e.getRight=l,e.getUp=function(t,e){void 0===e&&(e=c.Space.Global);var n=u(t,e);return new i.Vector3(n.elements[4],n.elements[5],n.elements[6])},e.getForward=function(t,e){void 0===e&&(e=c.Space.Global);var n=u(t,e);return new i.Vector3(n.elements[8],n.elements[9],n.elements[10])},e.getBack=function(t,e){void 0===e&&(e=c.Space.Global);var n=u(t,e);return new i.Vector3(-n.elements[8],-n.elements[9],-n.elements[10])},e.getMatrix=u,e.countSleepyBodies=function(){}},function(t,e,n){"use strict";function i(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),i(n(55)),i(n(56)),i(n(25)),i(n(57)),i(n(58)),i(n(16)),i(n(8)),i(n(59)),i(n(60)),i(n(61)),i(n(62)),i(n(63)),i(n(64)),i(n(65)),i(n(66)),i(n(67)),i(n(68)),i(n(69)),i(n(70))},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var i,r,o,a=n(0);function s(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}Object.assign(s.prototype,{setSize:function(){},render:function(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}),s.FullScreenQuad=(i=new a.OrthographicCamera(-1,1,1,-1,0,1),r=new a.PlaneBufferGeometry(2,2),o=function(t){this._mesh=new a.Mesh(r,t)},Object.defineProperty(o.prototype,"material",{get:function(){return this._mesh.material},set:function(t){this._mesh.material=t}}),Object.assign(o.prototype,{dispose:function(){this._mesh.geometry.dispose()},render:function(t){t.render(this._mesh,i)}}),o)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.Left="left",t.Right="right"}(e.Side||(e.Side={}))},function(t,e,n){(function(t,i){var r; /** * @license * Lodash @@ -14,4 +14,4 @@ Object.assign(Jh.prototype,{_getValue_unbound:Jh.prototype.getValue,_setValue_un * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */(function(){var o,a=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",l="__lodash_hash_undefined__",u=500,h="__lodash_placeholder__",p=1,d=2,f=4,m=1,v=2,g=1,y=2,w=4,x=8,_=16,b=32,S=64,M=128,E=256,A=512,T=30,P="...",L=800,C=16,R=1,O=2,F=1/0,I=9007199254740991,N=17976931348623157e292,B=NaN,D=4294967295,z=D-1,V=D>>>1,U=[["ary",M],["bind",g],["bindKey",y],["curry",x],["curryRight",_],["flip",A],["partial",b],["partialRight",S],["rearg",E]],k="[object Arguments]",j="[object Array]",H="[object AsyncFunction]",G="[object Boolean]",W="[object Date]",q="[object DOMException]",X="[object Error]",Y="[object Function]",Q="[object GeneratorFunction]",K="[object Map]",Z="[object Number]",J="[object Null]",$="[object Object]",tt="[object Proxy]",et="[object RegExp]",nt="[object Set]",it="[object String]",rt="[object Symbol]",ot="[object Undefined]",at="[object WeakMap]",st="[object WeakSet]",ct="[object ArrayBuffer]",lt="[object DataView]",ut="[object Float32Array]",ht="[object Float64Array]",pt="[object Int8Array]",dt="[object Int16Array]",ft="[object Int32Array]",mt="[object Uint8Array]",vt="[object Uint8ClampedArray]",gt="[object Uint16Array]",yt="[object Uint32Array]",wt=/\b__p \+= '';/g,xt=/\b(__p \+=) '' \+/g,_t=/(__e\(.*?\)|\b__t\)) \+\n'';/g,bt=/&(?:amp|lt|gt|quot|#39);/g,St=/[&<>"']/g,Mt=RegExp(bt.source),Et=RegExp(St.source),At=/<%-([\s\S]+?)%>/g,Tt=/<%([\s\S]+?)%>/g,Pt=/<%=([\s\S]+?)%>/g,Lt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ct=/^\w*$/,Rt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ot=/[\\^$.*+?()[\]{}|]/g,Ft=RegExp(Ot.source),It=/^\s+|\s+$/g,Nt=/^\s+/,Bt=/\s+$/,Dt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,zt=/\{\n\/\* \[wrapped with (.+)\] \*/,Vt=/,? & /,Ut=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,kt=/\\(\\)?/g,jt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ht=/\w*$/,Gt=/^[-+]0x[0-9a-f]+$/i,Wt=/^0b[01]+$/i,qt=/^\[object .+?Constructor\]$/,Xt=/^0o[0-7]+$/i,Yt=/^(?:0|[1-9]\d*)$/,Qt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Kt=/($^)/,Zt=/['\n\r\u2028\u2029\\]/g,Jt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",$t="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",te="[\\ud800-\\udfff]",ee="["+$t+"]",ne="["+Jt+"]",ie="\\d+",re="[\\u2700-\\u27bf]",oe="[a-z\\xdf-\\xf6\\xf8-\\xff]",ae="[^\\ud800-\\udfff"+$t+ie+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",se="\\ud83c[\\udffb-\\udfff]",ce="[^\\ud800-\\udfff]",le="(?:\\ud83c[\\udde6-\\uddff]){2}",ue="[\\ud800-\\udbff][\\udc00-\\udfff]",he="[A-Z\\xc0-\\xd6\\xd8-\\xde]",pe="(?:"+oe+"|"+ae+")",de="(?:"+he+"|"+ae+")",fe="(?:"+ne+"|"+se+")"+"?",me="[\\ufe0e\\ufe0f]?"+fe+("(?:\\u200d(?:"+[ce,le,ue].join("|")+")[\\ufe0e\\ufe0f]?"+fe+")*"),ve="(?:"+[re,le,ue].join("|")+")"+me,ge="(?:"+[ce+ne+"?",ne,le,ue,te].join("|")+")",ye=RegExp("['’]","g"),we=RegExp(ne,"g"),xe=RegExp(se+"(?="+se+")|"+ge+me,"g"),_e=RegExp([he+"?"+oe+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[ee,he,"$"].join("|")+")",de+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[ee,he+pe,"$"].join("|")+")",he+"?"+pe+"+(?:['’](?:d|ll|m|re|s|t|ve))?",he+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ie,ve].join("|"),"g"),be=RegExp("[\\u200d\\ud800-\\udfff"+Jt+"\\ufe0e\\ufe0f]"),Se=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Me=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ee=-1,Ae={};Ae[ut]=Ae[ht]=Ae[pt]=Ae[dt]=Ae[ft]=Ae[mt]=Ae[vt]=Ae[gt]=Ae[yt]=!0,Ae[k]=Ae[j]=Ae[ct]=Ae[G]=Ae[lt]=Ae[W]=Ae[X]=Ae[Y]=Ae[K]=Ae[Z]=Ae[$]=Ae[et]=Ae[nt]=Ae[it]=Ae[at]=!1;var Te={};Te[k]=Te[j]=Te[ct]=Te[lt]=Te[G]=Te[W]=Te[ut]=Te[ht]=Te[pt]=Te[dt]=Te[ft]=Te[K]=Te[Z]=Te[$]=Te[et]=Te[nt]=Te[it]=Te[rt]=Te[mt]=Te[vt]=Te[gt]=Te[yt]=!0,Te[X]=Te[Y]=Te[at]=!1;var Pe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Le=parseFloat,Ce=parseInt,Re="object"==typeof t&&t&&t.Object===Object&&t,Oe="object"==typeof self&&self&&self.Object===Object&&self,Fe=Re||Oe||Function("return this")(),Ie=e&&!e.nodeType&&e,Ne=Ie&&"object"==typeof i&&i&&!i.nodeType&&i,Be=Ne&&Ne.exports===Ie,De=Be&&Re.process,ze=function(){try{var t=Ne&&Ne.require&&Ne.require("util").types;return t||De&&De.binding&&De.binding("util")}catch(t){}}(),Ve=ze&&ze.isArrayBuffer,Ue=ze&&ze.isDate,ke=ze&&ze.isMap,je=ze&&ze.isRegExp,He=ze&&ze.isSet,Ge=ze&&ze.isTypedArray;function We(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function qe(t,e,n,i){for(var r=-1,o=null==t?0:t.length;++r-1}function Je(t,e,n){for(var i=-1,r=null==t?0:t.length;++i-1;);return n}function _n(t,e){for(var n=t.length;n--&&cn(e,t[n],0)>-1;);return n}var bn=dn({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Sn=dn({"&":"&","<":"<",">":">",'"':""","'":"'"});function Mn(t){return"\\"+Pe[t]}function En(t){return be.test(t)}function An(t){var e=-1,n=Array(t.size);return t.forEach((function(t,i){n[++e]=[i,t]})),n}function Tn(t,e){return function(n){return t(e(n))}}function Pn(t,e){for(var n=-1,i=t.length,r=0,o=[];++n",""":'"',"'":"'"});var In=function t(e){var n,i=(e=null==e?Fe:In.defaults(Fe.Object(),e,In.pick(Fe,Me))).Array,r=e.Date,Jt=e.Error,$t=e.Function,te=e.Math,ee=e.Object,ne=e.RegExp,ie=e.String,re=e.TypeError,oe=i.prototype,ae=$t.prototype,se=ee.prototype,ce=e["__core-js_shared__"],le=ae.toString,ue=se.hasOwnProperty,he=0,pe=(n=/[^.]+$/.exec(ce&&ce.keys&&ce.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",de=se.toString,fe=le.call(ee),me=Fe._,ve=ne("^"+le.call(ue).replace(Ot,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ge=Be?e.Buffer:o,xe=e.Symbol,be=e.Uint8Array,Pe=ge?ge.allocUnsafe:o,Re=Tn(ee.getPrototypeOf,ee),Oe=ee.create,Ie=se.propertyIsEnumerable,Ne=oe.splice,De=xe?xe.isConcatSpreadable:o,ze=xe?xe.iterator:o,on=xe?xe.toStringTag:o,dn=function(){try{var t=Vo(ee,"defineProperty");return t({},"",{}),t}catch(t){}}(),Nn=e.clearTimeout!==Fe.clearTimeout&&e.clearTimeout,Bn=r&&r.now!==Fe.Date.now&&r.now,Dn=e.setTimeout!==Fe.setTimeout&&e.setTimeout,zn=te.ceil,Vn=te.floor,Un=ee.getOwnPropertySymbols,kn=ge?ge.isBuffer:o,jn=e.isFinite,Hn=oe.join,Gn=Tn(ee.keys,ee),Wn=te.max,qn=te.min,Xn=r.now,Yn=e.parseInt,Qn=te.random,Kn=oe.reverse,Zn=Vo(e,"DataView"),Jn=Vo(e,"Map"),$n=Vo(e,"Promise"),ti=Vo(e,"Set"),ei=Vo(e,"WeakMap"),ni=Vo(ee,"create"),ii=ei&&new ei,ri={},oi=ha(Zn),ai=ha(Jn),si=ha($n),ci=ha(ti),li=ha(ei),ui=xe?xe.prototype:o,hi=ui?ui.valueOf:o,pi=ui?ui.toString:o;function di(t){if(Ps(t)&&!gs(t)&&!(t instanceof gi)){if(t instanceof vi)return t;if(ue.call(t,"__wrapped__"))return pa(t)}return new vi(t)}var fi=function(){function t(){}return function(e){if(!Ts(e))return{};if(Oe)return Oe(e);t.prototype=e;var n=new t;return t.prototype=o,n}}();function mi(){}function vi(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=o}function gi(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=D,this.__views__=[]}function yi(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function Ni(t,e,n,i,r,a){var s,c=e&p,l=e&d,u=e&f;if(n&&(s=r?n(t,i,r,a):n(t)),s!==o)return s;if(!Ts(t))return t;var h=gs(t);if(h){if(s=function(t){var e=t.length,n=new t.constructor(e);e&&"string"==typeof t[0]&&ue.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!c)return no(t,s)}else{var m=jo(t),v=m==Y||m==Q;if(_s(t))return Kr(t,c);if(m==$||m==k||v&&!r){if(s=l||v?{}:Go(t),!c)return l?function(t,e){return io(t,ko(t),e)}(t,function(t,e){return t&&io(e,oc(e),t)}(s,t)):function(t,e){return io(t,Uo(t),e)}(t,Ri(s,t))}else{if(!Te[m])return r?t:{};s=function(t,e,n){var i=t.constructor;switch(e){case ct:return Zr(t);case G:case W:return new i(+t);case lt:return function(t,e){var n=e?Zr(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case ut:case ht:case pt:case dt:case ft:case mt:case vt:case gt:case yt:return Jr(t,n);case K:return new i;case Z:case it:return new i(t);case et:return function(t){var e=new t.constructor(t.source,Ht.exec(t));return e.lastIndex=t.lastIndex,e}(t);case nt:return new i;case rt:return r=t,hi?ee(hi.call(r)):{}}var r}(t,m,c)}}a||(a=new bi);var g=a.get(t);if(g)return g;a.set(t,s),Fs(t)?t.forEach((function(i){s.add(Ni(i,e,n,i,t,a))})):Ls(t)&&t.forEach((function(i,r){s.set(r,Ni(i,e,n,r,t,a))}));var y=h?o:(u?l?Oo:Ro:l?oc:rc)(t);return Xe(y||t,(function(i,r){y&&(i=t[r=i]),Pi(s,r,Ni(i,e,n,r,t,a))})),s}function Bi(t,e,n){var i=n.length;if(null==t)return!i;for(t=ee(t);i--;){var r=n[i],a=e[r],s=t[r];if(s===o&&!(r in t)||!a(s))return!1}return!0}function Di(t,e,n){if("function"!=typeof t)throw new re(c);return ra((function(){t.apply(o,n)}),e)}function zi(t,e,n,i){var r=-1,o=Ze,s=!0,c=t.length,l=[],u=e.length;if(!c)return l;n&&(e=$e(e,gn(n))),i?(o=Je,s=!1):e.length>=a&&(o=wn,s=!1,e=new _i(e));t:for(;++r-1},wi.prototype.set=function(t,e){var n=this.__data__,i=Li(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this},xi.prototype.clear=function(){this.size=0,this.__data__={hash:new yi,map:new(Jn||wi),string:new yi}},xi.prototype.delete=function(t){var e=Do(this,t).delete(t);return this.size-=e?1:0,e},xi.prototype.get=function(t){return Do(this,t).get(t)},xi.prototype.has=function(t){return Do(this,t).has(t)},xi.prototype.set=function(t,e){var n=Do(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this},_i.prototype.add=_i.prototype.push=function(t){return this.__data__.set(t,l),this},_i.prototype.has=function(t){return this.__data__.has(t)},bi.prototype.clear=function(){this.__data__=new wi,this.size=0},bi.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},bi.prototype.get=function(t){return this.__data__.get(t)},bi.prototype.has=function(t){return this.__data__.has(t)},bi.prototype.set=function(t,e){var n=this.__data__;if(n instanceof wi){var i=n.__data__;if(!Jn||i.length0&&n(s)?e>1?Gi(s,e-1,n,i,r):tn(r,s):i||(r[r.length]=s)}return r}var Wi=so(),qi=so(!0);function Xi(t,e){return t&&Wi(t,e,rc)}function Yi(t,e){return t&&qi(t,e,rc)}function Qi(t,e){return Ke(e,(function(e){return Ms(t[e])}))}function Ki(t,e){for(var n=0,i=(e=qr(e,t)).length;null!=t&&ne}function tr(t,e){return null!=t&&ue.call(t,e)}function er(t,e){return null!=t&&e in ee(t)}function nr(t,e,n){for(var r=n?Je:Ze,a=t[0].length,s=t.length,c=s,l=i(s),u=1/0,h=[];c--;){var p=t[c];c&&e&&(p=$e(p,gn(e))),u=qn(p.length,u),l[c]=!n&&(e||a>=120&&p.length>=120)?new _i(c&&p):o}p=t[0];var d=-1,f=l[0];t:for(;++d=s)return c;var l=n[i];return c*("desc"==l?-1:1)}}return t.index-e.index}(t,e,n)}))}function yr(t,e,n){for(var i=-1,r=e.length,o={};++i-1;)s!==t&&Ne.call(s,c,1),Ne.call(t,c,1);return t}function xr(t,e){for(var n=t?e.length:0,i=n-1;n--;){var r=e[n];if(n==i||r!==o){var o=r;qo(r)?Ne.call(t,r,1):zr(t,r)}}return t}function _r(t,e){return t+Vn(Qn()*(e-t+1))}function br(t,e){var n="";if(!t||e<1||e>I)return n;do{e%2&&(n+=t),(e=Vn(e/2))&&(t+=t)}while(e);return n}function Sr(t,e){return oa(ta(t,e,Cc),t+"")}function Mr(t){return Mi(dc(t))}function Er(t,e){var n=dc(t);return ca(n,Ii(e,0,n.length))}function Ar(t,e,n,i){if(!Ts(t))return t;for(var r=-1,a=(e=qr(e,t)).length,s=a-1,c=t;null!=c&&++ro?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var a=i(o);++r>>1,a=t[o];null!==a&&!Ns(a)&&(n?a<=e:a=a){var u=e?null:So(t);if(u)return Ln(u);s=!1,r=wn,l=new _i}else l=e?[]:c;t:for(;++i=i?t:Cr(t,e,n)}var Qr=Nn||function(t){return Fe.clearTimeout(t)};function Kr(t,e){if(e)return t.slice();var n=t.length,i=Pe?Pe(n):new t.constructor(n);return t.copy(i),i}function Zr(t){var e=new t.constructor(t.byteLength);return new be(e).set(new be(t)),e}function Jr(t,e){var n=e?Zr(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function $r(t,e){if(t!==e){var n=t!==o,i=null===t,r=t==t,a=Ns(t),s=e!==o,c=null===e,l=e==e,u=Ns(e);if(!c&&!u&&!a&&t>e||a&&s&&l&&!c&&!u||i&&s&&l||!n&&l||!r)return 1;if(!i&&!a&&!u&&t1?n[r-1]:o,s=r>2?n[2]:o;for(a=t.length>3&&"function"==typeof a?(r--,a):o,s&&Xo(n[0],n[1],s)&&(a=r<3?o:a,r=1),e=ee(e);++i-1?r[a?e[s]:s]:o}}function po(t){return Co((function(e){var n=e.length,i=n,r=vi.prototype.thru;for(t&&e.reverse();i--;){var a=e[i];if("function"!=typeof a)throw new re(c);if(r&&!s&&"wrapper"==Io(a))var s=new vi([],!0)}for(i=s?i:n;++i1&&x.reverse(),p&&uc))return!1;var u=a.get(t),h=a.get(e);if(u&&h)return u==e&&h==t;var p=-1,d=!0,f=n&v?new _i:o;for(a.set(t,e),a.set(e,t);++p-1&&t%1==0&&t1?"& ":"")+e[i],e=e.join(n>2?", ":" "),t.replace(Dt,"{\n/* [wrapped with "+e+"] */\n")}(i,function(t,e){return Xe(U,(function(n){var i="_."+n[0];e&n[1]&&!Ze(t,i)&&t.push(i)})),t.sort()}(function(t){var e=t.match(zt);return e?e[1].split(Vt):[]}(i),n)))}function sa(t){var e=0,n=0;return function(){var i=Xn(),r=C-(i-n);if(n=i,r>0){if(++e>=L)return arguments[0]}else e=0;return t.apply(o,arguments)}}function ca(t,e){var n=-1,i=t.length,r=i-1;for(e=e===o?i:e;++n1?t[e-1]:o;return n="function"==typeof n?(t.pop(),n):o,Oa(t,n)}));function Va(t){var e=di(t);return e.__chain__=!0,e}function Ua(t,e){return e(t)}var ka=Co((function(t){var e=t.length,n=e?t[0]:0,i=this.__wrapped__,r=function(e){return Fi(e,t)};return!(e>1||this.__actions__.length)&&i instanceof gi&&qo(n)?((i=i.slice(n,+n+(e?1:0))).__actions__.push({func:Ua,args:[r],thisArg:o}),new vi(i,this.__chain__).thru((function(t){return e&&!t.length&&t.push(o),t}))):this.thru(r)}));var ja=ro((function(t,e,n){ue.call(t,n)?++t[n]:Oi(t,n,1)}));var Ha=ho(va),Ga=ho(ga);function Wa(t,e){return(gs(t)?Xe:Vi)(t,Bo(e,3))}function qa(t,e){return(gs(t)?Ye:Ui)(t,Bo(e,3))}var Xa=ro((function(t,e,n){ue.call(t,n)?t[n].push(e):Oi(t,n,[e])}));var Ya=Sr((function(t,e,n){var r=-1,o="function"==typeof e,a=ws(t)?i(t.length):[];return Vi(t,(function(t){a[++r]=o?We(e,t,n):ir(t,e,n)})),a})),Qa=ro((function(t,e,n){Oi(t,n,e)}));function Ka(t,e){return(gs(t)?$e:pr)(t,Bo(e,3))}var Za=ro((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]}));var Ja=Sr((function(t,e){if(null==t)return[];var n=e.length;return n>1&&Xo(t,e[0],e[1])?e=[]:n>2&&Xo(e[0],e[1],e[2])&&(e=[e[0]]),gr(t,Gi(e,1),[])})),$a=Bn||function(){return Fe.Date.now()};function ts(t,e,n){return e=n?o:e,e=t&&null==e?t.length:e,Eo(t,M,o,o,o,o,e)}function es(t,e){var n;if("function"!=typeof e)throw new re(c);return t=ks(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=o),n}}var ns=Sr((function(t,e,n){var i=g;if(n.length){var r=Pn(n,No(ns));i|=b}return Eo(t,i,e,n,r)})),is=Sr((function(t,e,n){var i=g|y;if(n.length){var r=Pn(n,No(is));i|=b}return Eo(e,i,t,n,r)}));function rs(t,e,n){var i,r,a,s,l,u,h=0,p=!1,d=!1,f=!0;if("function"!=typeof t)throw new re(c);function m(e){var n=i,a=r;return i=r=o,h=e,s=t.apply(a,n)}function v(t){var n=t-u;return u===o||n>=e||n<0||d&&t-h>=a}function g(){var t=$a();if(v(t))return y(t);l=ra(g,function(t){var n=e-(t-u);return d?qn(n,a-(t-h)):n}(t))}function y(t){return l=o,f&&i?m(t):(i=r=o,s)}function w(){var t=$a(),n=v(t);if(i=arguments,r=this,u=t,n){if(l===o)return function(t){return h=t,l=ra(g,e),p?m(t):s}(u);if(d)return Qr(l),l=ra(g,e),m(u)}return l===o&&(l=ra(g,e)),s}return e=Hs(e)||0,Ts(n)&&(p=!!n.leading,a=(d="maxWait"in n)?Wn(Hs(n.maxWait)||0,e):a,f="trailing"in n?!!n.trailing:f),w.cancel=function(){l!==o&&Qr(l),h=0,i=u=r=l=o},w.flush=function(){return l===o?s:y($a())},w}var os=Sr((function(t,e){return Di(t,1,e)})),as=Sr((function(t,e,n){return Di(t,Hs(e)||0,n)}));function ss(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new re(c);var n=function(){var i=arguments,r=e?e.apply(this,i):i[0],o=n.cache;if(o.has(r))return o.get(r);var a=t.apply(this,i);return n.cache=o.set(r,a)||o,a};return n.cache=new(ss.Cache||xi),n}function cs(t){if("function"!=typeof t)throw new re(c);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}ss.Cache=xi;var ls=Xr((function(t,e){var n=(e=1==e.length&&gs(e[0])?$e(e[0],gn(Bo())):$e(Gi(e,1),gn(Bo()))).length;return Sr((function(i){for(var r=-1,o=qn(i.length,n);++r=e})),vs=rr(function(){return arguments}())?rr:function(t){return Ps(t)&&ue.call(t,"callee")&&!Ie.call(t,"callee")},gs=i.isArray,ys=Ve?gn(Ve):function(t){return Ps(t)&&Ji(t)==ct};function ws(t){return null!=t&&As(t.length)&&!Ms(t)}function xs(t){return Ps(t)&&ws(t)}var _s=kn||Hc,bs=Ue?gn(Ue):function(t){return Ps(t)&&Ji(t)==W};function Ss(t){if(!Ps(t))return!1;var e=Ji(t);return e==X||e==q||"string"==typeof t.message&&"string"==typeof t.name&&!Rs(t)}function Ms(t){if(!Ts(t))return!1;var e=Ji(t);return e==Y||e==Q||e==H||e==tt}function Es(t){return"number"==typeof t&&t==ks(t)}function As(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=I}function Ts(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Ps(t){return null!=t&&"object"==typeof t}var Ls=ke?gn(ke):function(t){return Ps(t)&&jo(t)==K};function Cs(t){return"number"==typeof t||Ps(t)&&Ji(t)==Z}function Rs(t){if(!Ps(t)||Ji(t)!=$)return!1;var e=Re(t);if(null===e)return!0;var n=ue.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&le.call(n)==fe}var Os=je?gn(je):function(t){return Ps(t)&&Ji(t)==et};var Fs=He?gn(He):function(t){return Ps(t)&&jo(t)==nt};function Is(t){return"string"==typeof t||!gs(t)&&Ps(t)&&Ji(t)==it}function Ns(t){return"symbol"==typeof t||Ps(t)&&Ji(t)==rt}var Bs=Ge?gn(Ge):function(t){return Ps(t)&&As(t.length)&&!!Ae[Ji(t)]};var Ds=xo(hr),zs=xo((function(t,e){return t<=e}));function Vs(t){if(!t)return[];if(ws(t))return Is(t)?On(t):no(t);if(ze&&t[ze])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[ze]());var e=jo(t);return(e==K?An:e==nt?Ln:dc)(t)}function Us(t){return t?(t=Hs(t))===F||t===-F?(t<0?-1:1)*N:t==t?t:0:0===t?t:0}function ks(t){var e=Us(t),n=e%1;return e==e?n?e-n:e:0}function js(t){return t?Ii(ks(t),0,D):0}function Hs(t){if("number"==typeof t)return t;if(Ns(t))return B;if(Ts(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Ts(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(It,"");var n=Wt.test(t);return n||Xt.test(t)?Ce(t.slice(2),n?2:8):Gt.test(t)?B:+t}function Gs(t){return io(t,oc(t))}function Ws(t){return null==t?"":Br(t)}var qs=oo((function(t,e){if(Zo(e)||ws(e))io(e,rc(e),t);else for(var n in e)ue.call(e,n)&&Pi(t,n,e[n])})),Xs=oo((function(t,e){io(e,oc(e),t)})),Ys=oo((function(t,e,n,i){io(e,oc(e),t,i)})),Qs=oo((function(t,e,n,i){io(e,rc(e),t,i)})),Ks=Co(Fi);var Zs=Sr((function(t,e){t=ee(t);var n=-1,i=e.length,r=i>2?e[2]:o;for(r&&Xo(e[0],e[1],r)&&(i=1);++n1),e})),io(t,Oo(t),n),i&&(n=Ni(n,p|d|f,Po));for(var r=e.length;r--;)zr(n,e[r]);return n}));var lc=Co((function(t,e){return null==t?{}:function(t,e){return yr(t,e,(function(e,n){return tc(t,n)}))}(t,e)}));function uc(t,e){if(null==t)return{};var n=$e(Oo(t),(function(t){return[t]}));return e=Bo(e),yr(t,n,(function(t,n){return e(t,n[0])}))}var hc=Mo(rc),pc=Mo(oc);function dc(t){return null==t?[]:yn(t,rc(t))}var fc=lo((function(t,e,n){return e=e.toLowerCase(),t+(n?mc(e):e)}));function mc(t){return Sc(Ws(t).toLowerCase())}function vc(t){return(t=Ws(t))&&t.replace(Qt,bn).replace(we,"")}var gc=lo((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),yc=lo((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),wc=co("toLowerCase");var xc=lo((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}));var _c=lo((function(t,e,n){return t+(n?" ":"")+Sc(e)}));var bc=lo((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Sc=co("toUpperCase");function Mc(t,e,n){return t=Ws(t),(e=n?o:e)===o?function(t){return Se.test(t)}(t)?function(t){return t.match(_e)||[]}(t):function(t){return t.match(Ut)||[]}(t):t.match(e)||[]}var Ec=Sr((function(t,e){try{return We(t,o,e)}catch(t){return Ss(t)?t:new Jt(t)}})),Ac=Co((function(t,e){return Xe(e,(function(e){e=ua(e),Oi(t,e,ns(t[e],t))})),t}));function Tc(t){return function(){return t}}var Pc=po(),Lc=po(!0);function Cc(t){return t}function Rc(t){return cr("function"==typeof t?t:Ni(t,p))}var Oc=Sr((function(t,e){return function(n){return ir(n,t,e)}})),Fc=Sr((function(t,e){return function(n){return ir(t,n,e)}}));function Ic(t,e,n){var i=rc(e),r=Qi(e,i);null!=n||Ts(e)&&(r.length||!i.length)||(n=e,e=t,t=this,r=Qi(e,rc(e)));var o=!(Ts(n)&&"chain"in n&&!n.chain),a=Ms(t);return Xe(r,(function(n){var i=e[n];t[n]=i,a&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__),r=n.__actions__=no(this.__actions__);return r.push({func:i,args:arguments,thisArg:t}),n.__chain__=e,n}return i.apply(t,tn([this.value()],arguments))})})),t}function Nc(){}var Bc=go($e),Dc=go(Qe),zc=go(rn);function Vc(t){return Yo(t)?pn(ua(t)):function(t){return function(e){return Ki(e,t)}}(t)}var Uc=wo(),kc=wo(!0);function jc(){return[]}function Hc(){return!1}var Gc=vo((function(t,e){return t+e}),0),Wc=bo("ceil"),qc=vo((function(t,e){return t/e}),1),Xc=bo("floor");var Yc,Qc=vo((function(t,e){return t*e}),1),Kc=bo("round"),Zc=vo((function(t,e){return t-e}),0);return di.after=function(t,e){if("function"!=typeof e)throw new re(c);return t=ks(t),function(){if(--t<1)return e.apply(this,arguments)}},di.ary=ts,di.assign=qs,di.assignIn=Xs,di.assignInWith=Ys,di.assignWith=Qs,di.at=Ks,di.before=es,di.bind=ns,di.bindAll=Ac,di.bindKey=is,di.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return gs(t)?t:[t]},di.chain=Va,di.chunk=function(t,e,n){e=(n?Xo(t,e,n):e===o)?1:Wn(ks(e),0);var r=null==t?0:t.length;if(!r||e<1)return[];for(var a=0,s=0,c=i(zn(r/e));ar?0:r+n),(i=i===o||i>r?r:ks(i))<0&&(i+=r),i=n>i?0:js(i);n>>0)?(t=Ws(t))&&("string"==typeof e||null!=e&&!Os(e))&&!(e=Br(e))&&En(t)?Yr(On(t),0,n):t.split(e,n):[]},di.spread=function(t,e){if("function"!=typeof t)throw new re(c);return e=null==e?0:Wn(ks(e),0),Sr((function(n){var i=n[e],r=Yr(n,0,e);return i&&tn(r,i),We(t,this,r)}))},di.tail=function(t){var e=null==t?0:t.length;return e?Cr(t,1,e):[]},di.take=function(t,e,n){return t&&t.length?Cr(t,0,(e=n||e===o?1:ks(e))<0?0:e):[]},di.takeRight=function(t,e,n){var i=null==t?0:t.length;return i?Cr(t,(e=i-(e=n||e===o?1:ks(e)))<0?0:e,i):[]},di.takeRightWhile=function(t,e){return t&&t.length?Ur(t,Bo(e,3),!1,!0):[]},di.takeWhile=function(t,e){return t&&t.length?Ur(t,Bo(e,3)):[]},di.tap=function(t,e){return e(t),t},di.throttle=function(t,e,n){var i=!0,r=!0;if("function"!=typeof t)throw new re(c);return Ts(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),rs(t,e,{leading:i,maxWait:e,trailing:r})},di.thru=Ua,di.toArray=Vs,di.toPairs=hc,di.toPairsIn=pc,di.toPath=function(t){return gs(t)?$e(t,ua):Ns(t)?[t]:no(la(Ws(t)))},di.toPlainObject=Gs,di.transform=function(t,e,n){var i=gs(t),r=i||_s(t)||Bs(t);if(e=Bo(e,4),null==n){var o=t&&t.constructor;n=r?i?new o:[]:Ts(t)&&Ms(o)?fi(Re(t)):{}}return(r?Xe:Xi)(t,(function(t,i,r){return e(n,t,i,r)})),n},di.unary=function(t){return ts(t,1)},di.union=Pa,di.unionBy=La,di.unionWith=Ca,di.uniq=function(t){return t&&t.length?Dr(t):[]},di.uniqBy=function(t,e){return t&&t.length?Dr(t,Bo(e,2)):[]},di.uniqWith=function(t,e){return e="function"==typeof e?e:o,t&&t.length?Dr(t,o,e):[]},di.unset=function(t,e){return null==t||zr(t,e)},di.unzip=Ra,di.unzipWith=Oa,di.update=function(t,e,n){return null==t?t:Vr(t,e,Wr(n))},di.updateWith=function(t,e,n,i){return i="function"==typeof i?i:o,null==t?t:Vr(t,e,Wr(n),i)},di.values=dc,di.valuesIn=function(t){return null==t?[]:yn(t,oc(t))},di.without=Fa,di.words=Mc,di.wrap=function(t,e){return us(Wr(e),t)},di.xor=Ia,di.xorBy=Na,di.xorWith=Ba,di.zip=Da,di.zipObject=function(t,e){return Hr(t||[],e||[],Pi)},di.zipObjectDeep=function(t,e){return Hr(t||[],e||[],Ar)},di.zipWith=za,di.entries=hc,di.entriesIn=pc,di.extend=Xs,di.extendWith=Ys,Ic(di,di),di.add=Gc,di.attempt=Ec,di.camelCase=fc,di.capitalize=mc,di.ceil=Wc,di.clamp=function(t,e,n){return n===o&&(n=e,e=o),n!==o&&(n=(n=Hs(n))==n?n:0),e!==o&&(e=(e=Hs(e))==e?e:0),Ii(Hs(t),e,n)},di.clone=function(t){return Ni(t,f)},di.cloneDeep=function(t){return Ni(t,p|f)},di.cloneDeepWith=function(t,e){return Ni(t,p|f,e="function"==typeof e?e:o)},di.cloneWith=function(t,e){return Ni(t,f,e="function"==typeof e?e:o)},di.conformsTo=function(t,e){return null==e||Bi(t,e,rc(e))},di.deburr=vc,di.defaultTo=function(t,e){return null==t||t!=t?e:t},di.divide=qc,di.endsWith=function(t,e,n){t=Ws(t),e=Br(e);var i=t.length,r=n=n===o?i:Ii(ks(n),0,i);return(n-=e.length)>=0&&t.slice(n,r)==e},di.eq=ds,di.escape=function(t){return(t=Ws(t))&&Et.test(t)?t.replace(St,Sn):t},di.escapeRegExp=function(t){return(t=Ws(t))&&Ft.test(t)?t.replace(Ot,"\\$&"):t},di.every=function(t,e,n){var i=gs(t)?Qe:ki;return n&&Xo(t,e,n)&&(e=o),i(t,Bo(e,3))},di.find=Ha,di.findIndex=va,di.findKey=function(t,e){return an(t,Bo(e,3),Xi)},di.findLast=Ga,di.findLastIndex=ga,di.findLastKey=function(t,e){return an(t,Bo(e,3),Yi)},di.floor=Xc,di.forEach=Wa,di.forEachRight=qa,di.forIn=function(t,e){return null==t?t:Wi(t,Bo(e,3),oc)},di.forInRight=function(t,e){return null==t?t:qi(t,Bo(e,3),oc)},di.forOwn=function(t,e){return t&&Xi(t,Bo(e,3))},di.forOwnRight=function(t,e){return t&&Yi(t,Bo(e,3))},di.get=$s,di.gt=fs,di.gte=ms,di.has=function(t,e){return null!=t&&Ho(t,e,tr)},di.hasIn=tc,di.head=wa,di.identity=Cc,di.includes=function(t,e,n,i){t=ws(t)?t:dc(t),n=n&&!i?ks(n):0;var r=t.length;return n<0&&(n=Wn(r+n,0)),Is(t)?n<=r&&t.indexOf(e,n)>-1:!!r&&cn(t,e,n)>-1},di.indexOf=function(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var r=null==n?0:ks(n);return r<0&&(r=Wn(i+r,0)),cn(t,e,r)},di.inRange=function(t,e,n){return e=Us(e),n===o?(n=e,e=0):n=Us(n),function(t,e,n){return t>=qn(e,n)&&t=-I&&t<=I},di.isSet=Fs,di.isString=Is,di.isSymbol=Ns,di.isTypedArray=Bs,di.isUndefined=function(t){return t===o},di.isWeakMap=function(t){return Ps(t)&&jo(t)==at},di.isWeakSet=function(t){return Ps(t)&&Ji(t)==st},di.join=function(t,e){return null==t?"":Hn.call(t,e)},di.kebabCase=gc,di.last=Sa,di.lastIndexOf=function(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var r=i;return n!==o&&(r=(r=ks(n))<0?Wn(i+r,0):qn(r,i-1)),e==e?function(t,e,n){for(var i=n+1;i--;)if(t[i]===e)return i;return i}(t,e,r):sn(t,un,r,!0)},di.lowerCase=yc,di.lowerFirst=wc,di.lt=Ds,di.lte=zs,di.max=function(t){return t&&t.length?ji(t,Cc,$i):o},di.maxBy=function(t,e){return t&&t.length?ji(t,Bo(e,2),$i):o},di.mean=function(t){return hn(t,Cc)},di.meanBy=function(t,e){return hn(t,Bo(e,2))},di.min=function(t){return t&&t.length?ji(t,Cc,hr):o},di.minBy=function(t,e){return t&&t.length?ji(t,Bo(e,2),hr):o},di.stubArray=jc,di.stubFalse=Hc,di.stubObject=function(){return{}},di.stubString=function(){return""},di.stubTrue=function(){return!0},di.multiply=Qc,di.nth=function(t,e){return t&&t.length?vr(t,ks(e)):o},di.noConflict=function(){return Fe._===this&&(Fe._=me),this},di.noop=Nc,di.now=$a,di.pad=function(t,e,n){t=Ws(t);var i=(e=ks(e))?Rn(t):0;if(!e||i>=e)return t;var r=(e-i)/2;return yo(Vn(r),n)+t+yo(zn(r),n)},di.padEnd=function(t,e,n){t=Ws(t);var i=(e=ks(e))?Rn(t):0;return e&&ie){var i=t;t=e,e=i}if(n||t%1||e%1){var r=Qn();return qn(t+r*(e-t+Le("1e-"+((r+"").length-1))),e)}return _r(t,e)},di.reduce=function(t,e,n){var i=gs(t)?en:fn,r=arguments.length<3;return i(t,Bo(e,4),n,r,Vi)},di.reduceRight=function(t,e,n){var i=gs(t)?nn:fn,r=arguments.length<3;return i(t,Bo(e,4),n,r,Ui)},di.repeat=function(t,e,n){return e=(n?Xo(t,e,n):e===o)?1:ks(e),br(Ws(t),e)},di.replace=function(){var t=arguments,e=Ws(t[0]);return t.length<3?e:e.replace(t[1],t[2])},di.result=function(t,e,n){var i=-1,r=(e=qr(e,t)).length;for(r||(r=1,t=o);++iI)return[];var n=D,i=qn(t,D);e=Bo(e),t-=D;for(var r=vn(i,e);++n=a)return t;var c=n-Rn(i);if(c<1)return i;var l=s?Yr(s,0,c).join(""):t.slice(0,c);if(r===o)return l+i;if(s&&(c+=l.length-c),Os(r)){if(t.slice(c).search(r)){var u,h=l;for(r.global||(r=ne(r.source,Ws(Ht.exec(r))+"g")),r.lastIndex=0;u=r.exec(h);)var p=u.index;l=l.slice(0,p===o?c:p)}}else if(t.indexOf(Br(r),c)!=c){var d=l.lastIndexOf(r);d>-1&&(l=l.slice(0,d))}return l+i},di.unescape=function(t){return(t=Ws(t))&&Mt.test(t)?t.replace(bt,Fn):t},di.uniqueId=function(t){var e=++he;return Ws(t)+e},di.upperCase=bc,di.upperFirst=Sc,di.each=Wa,di.eachRight=qa,di.first=wa,Ic(di,(Yc={},Xi(di,(function(t,e){ue.call(di.prototype,e)||(Yc[e]=t)})),Yc),{chain:!1}),di.VERSION="4.17.19",Xe(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){di[t].placeholder=di})),Xe(["drop","take"],(function(t,e){gi.prototype[t]=function(n){n=n===o?1:Wn(ks(n),0);var i=this.__filtered__&&!e?new gi(this):this.clone();return i.__filtered__?i.__takeCount__=qn(n,i.__takeCount__):i.__views__.push({size:qn(n,D),type:t+(i.__dir__<0?"Right":"")}),i},gi.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),Xe(["filter","map","takeWhile"],(function(t,e){var n=e+1,i=n==R||3==n;gi.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Bo(t,3),type:n}),e.__filtered__=e.__filtered__||i,e}})),Xe(["head","last"],(function(t,e){var n="take"+(e?"Right":"");gi.prototype[t]=function(){return this[n](1).value()[0]}})),Xe(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");gi.prototype[t]=function(){return this.__filtered__?new gi(this):this[n](1)}})),gi.prototype.compact=function(){return this.filter(Cc)},gi.prototype.find=function(t){return this.filter(t).head()},gi.prototype.findLast=function(t){return this.reverse().find(t)},gi.prototype.invokeMap=Sr((function(t,e){return"function"==typeof t?new gi(this):this.map((function(n){return ir(n,t,e)}))})),gi.prototype.reject=function(t){return this.filter(cs(Bo(t)))},gi.prototype.slice=function(t,e){t=ks(t);var n=this;return n.__filtered__&&(t>0||e<0)?new gi(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==o&&(n=(e=ks(e))<0?n.dropRight(-e):n.take(e-t)),n)},gi.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},gi.prototype.toArray=function(){return this.take(D)},Xi(gi.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),r=di[i?"take"+("last"==e?"Right":""):e],a=i||/^find/.test(e);r&&(di.prototype[e]=function(){var e=this.__wrapped__,s=i?[1]:arguments,c=e instanceof gi,l=s[0],u=c||gs(e),h=function(t){var e=r.apply(di,tn([t],s));return i&&p?e[0]:e};u&&n&&"function"==typeof l&&1!=l.length&&(c=u=!1);var p=this.__chain__,d=!!this.__actions__.length,f=a&&!p,m=c&&!d;if(!a&&u){e=m?e:new gi(this);var v=t.apply(e,s);return v.__actions__.push({func:Ua,args:[h],thisArg:o}),new vi(v,p)}return f&&m?t.apply(this,s):(v=this.thru(h),f?i?v.value()[0]:v.value():v)})})),Xe(["pop","push","shift","sort","splice","unshift"],(function(t){var e=oe[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:pop|shift)$/.test(t);di.prototype[t]=function(){var t=arguments;if(i&&!this.__chain__){var r=this.value();return e.apply(gs(r)?r:[],t)}return this[n]((function(n){return e.apply(gs(n)?n:[],t)}))}})),Xi(gi.prototype,(function(t,e){var n=di[e];if(n){var i=n.name+"";ue.call(ri,i)||(ri[i]=[]),ri[i].push({name:e,func:n})}})),ri[fo(o,y).name]=[{name:"wrapper",func:o}],gi.prototype.clone=function(){var t=new gi(this.__wrapped__);return t.__actions__=no(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=no(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=no(this.__views__),t},gi.prototype.reverse=function(){if(this.__filtered__){var t=new gi(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},gi.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=gs(t),i=e<0,r=n?t.length:0,o=function(t,e,n){var i=-1,r=n.length;for(;++i=this.__values__.length;return{done:t,value:t?o:this.__values__[this.__index__++]}},di.prototype.plant=function(t){for(var e,n=this;n instanceof mi;){var i=pa(n);i.__index__=0,i.__values__=o,e?r.__wrapped__=i:e=i;var r=i;n=n.__wrapped__}return r.__wrapped__=t,e},di.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof gi){var e=t;return this.__actions__.length&&(e=new gi(this)),(e=e.reverse()).__actions__.push({func:Ua,args:[Ta],thisArg:o}),new vi(e,this.__chain__)}return this.thru(Ta)},di.prototype.toJSON=di.prototype.valueOf=di.prototype.value=function(){return kr(this.__wrapped__,this.__actions__)},di.prototype.first=di.prototype.head,ze&&(di.prototype[ze]=function(){return this}),di}();Fe._=In,(r=function(){return In}.call(e,n,e,i))===o||(i.exports=r)}).call(this)}).call(this,n(34),n(35)(t))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){for(var t=[],e=0;e.5?this.character.setState(new o.Walk(this.character)):this.setAppropriateStartWalkState())},e}(o.CharacterStateBase);e.Idle=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.Driver="driver",t.Passenger="passenger"}(e.SeatType||(e.SeatType={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t[t.Character=0]="Character",t[t.Airplane=1]="Airplane",t[t.Car=2]="Car",t[t.Helicopter=3]="Helicopter",t[t.Decoration=4]="Decoration",t[t.System=5]="System"}(e.EntityType||(e.EntityType={}))},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=n(26),s=function(t){function e(e,n){var i=t.call(this,e)||this;return i.seat=n,i.canFindVehiclesToEnter=!1,i.playAnimation("driving",.1),i.character.startControllingVehicle(n.vehicle,i.seat),i.seat.vehicle.onInputChange(),i.character.vehicleEntryInstance=null,i}return r(e,t),e.prototype.update=function(e){var n,i;t.prototype.update.call(this,e),!(null===(n=this.seat.door)||void 0===n?void 0:n.achievingTargetRotation)&&(null===(i=this.seat.door)||void 0===i?void 0:i.rotation)>0&&this.seat.vehicle.noDirectionPressed()&&this.character.setState(new a.CloseVehicleDoorInside(this.character,this.seat))},e}(o.CharacterStateBase);e.Driving=s},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(18),s=n(20),c=n(2),l=function(t){function e(e,n,i,r,o){void 0===r&&(r=0),void 0===o&&(o=0);var a=t.call(this,e,n,i)||this;a.position=r,a.velocity=o,a.target=0,a.cache=[];for(var c=0;c<2;c++)a.cache.push(new s.SimulationFrame(r,o));return a}return r(e,t),e.prototype.simulate=function(t){this.generateFrames(t),this.position=o.MathUtils.lerp(this.cache[0].position,this.cache[1].position,this.offset/this.frameTime),this.velocity=o.MathUtils.lerp(this.cache[0].velocity,this.cache[1].velocity,this.offset/this.frameTime)},e.prototype.getFrame=function(t){return c.spring(this.lastFrame().position,this.target,this.lastFrame().velocity,this.mass,this.damping)},e}(a.SimulatorBase);e.SpringSimulator=l},function(t,e,n){"use strict";n.r(e),n.d(e,"ShaderPass",(function(){return o}));var i=n(0),r=n(4),o=function(t,e){r.a.call(this),this.textureID=void 0!==e?e:"tDiffuse",t instanceof i.ShaderMaterial?(this.uniforms=t.uniforms,this.material=t):t&&(this.uniforms=i.UniformsUtils.clone(t.uniforms),this.material=new i.ShaderMaterial({defines:Object.assign({},t.defines),uniforms:this.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader})),this.fsQuad=new r.a.FullScreenQuad(this.material)};o.prototype=Object.assign(Object.create(r.a.prototype),{constructor:o,render:function(t,e,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(t.setRenderTarget(null),this.fsQuad.render(t)):(t.setRenderTarget(e),this.clear&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),this.fsQuad.render(t))}})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t[t.Default=1]="Default",t[t.Characters=2]="Characters",t[t.TrimeshColliders=4]="TrimeshColliders"}(e.CollisionGroups||(e.CollisionGroups={}))},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(1),s=n(6),c=n(58),l=n(60),u=n(2),h=n(14),p=n(24),d=function(t){function e(e,n){var i=t.call(this)||this;i.updateOrder=2,i.actions={},i.seats=[],i.wheels=[],i.materials=[],i.firstPerson=!1,void 0===n&&(n={}),n.chassisConnectionPointLocal=new a.Vec3,n.axleLocal=new a.Vec3(-1,0,0),n.directionLocal=new a.Vec3(0,-1,0);var r=new a.Material("Mat");return r.friction=.01,i.collision=new a.Body({mass:50}),i.collision.material=r,i.readVehicleData(e),i.modelContainer=new o.Group,i.add(i.modelContainer),i.modelContainer.add(e.scene),i.rayCastVehicle=new a.RaycastVehicle({chassisBody:i.collision,indexUpAxis:1,indexRightAxis:0,indexForwardAxis:2}),i.wheels.forEach((function(t){n.chassisConnectionPointLocal.set(t.position.x,t.position.y+.2,t.position.z);var e=i.rayCastVehicle.addWheel(n);t.rayCastWheelInfoIndex=e})),i.help=new o.AxesHelper(2),i}return r(e,t),e.prototype.noDirectionPressed=function(){return!0},e.prototype.update=function(t){this.position.set(this.collision.interpolatedPosition.x,this.collision.interpolatedPosition.y,this.collision.interpolatedPosition.z),this.quaternion.set(this.collision.interpolatedQuaternion.x,this.collision.interpolatedQuaternion.y,this.collision.interpolatedQuaternion.z,this.collision.interpolatedQuaternion.w),this.seats.forEach((function(e){e.update(t)}));for(var e=0;e0&&(this.controllingCharacter.modelContainer.visible=!0,this.controllingCharacter.setState(new p.SwitchingSeats(this.controllingCharacter,this.controllingCharacter.occupyingSeat,this.controllingCharacter.occupyingSeat.connectedSeats[0])),this.controllingCharacter.stopControllingVehicle())},e.prototype.resetControls=function(){for(var t in this.actions)this.actions.hasOwnProperty(t)&&this.triggerAction(t,!1)},e.prototype.allowSleep=function(t){this.collision.allowSleep=t,!1===t&&this.collision.wakeUp()},e.prototype.handleKeyboardEvent=function(t,e,n){if("KeyC"===e&&!0===n&&!0===t.shiftKey)this.resetControls(),this.world.cameraOperator.characterCaller=this.controllingCharacter,this.world.inputManager.setInputReceiver(this.world.cameraOperator);else if("KeyR"===e&&!0===n&&!0===t.shiftKey)this.world.restartScenario();else for(var i in this.actions)if(this.actions.hasOwnProperty(i)){var r=this.actions[i];s.includes(r.eventCodes,e)&&this.triggerAction(i,n)}},e.prototype.setFirstPersonView=function(t){this.firstPerson=t,void 0!==this.controllingCharacter&&(this.controllingCharacter.modelContainer.visible=!t),t?this.world.cameraOperator.setRadius(0,!0):this.world.cameraOperator.setRadius(3,!0)},e.prototype.toggleFirstPersonView=function(){this.setFirstPersonView(!this.firstPerson)},e.prototype.triggerAction=function(t,e){var n=this.actions[t];n.isPressed!==e&&(n.isPressed=e,n.justPressed=!1,n.justReleased=!1,e?n.justPressed=!0:n.justReleased=!0,this.onInputChange(),n.justPressed=!1,n.justReleased=!1)},e.prototype.handleMouseButton=function(t,e,n){},e.prototype.handleMouseMove=function(t,e,n){this.world.cameraOperator.move(e,n)},e.prototype.handleMouseWheel=function(t,e){this.world.scrollTheTimeScale(e)},e.prototype.inputReceiverInit=function(){this.collision.allowSleep=!1,this.setFirstPersonView(!1)},e.prototype.inputReceiverUpdate=function(t){if(this.firstPerson){var e=(new o.Vector3).copy(this.camera.position);e.applyQuaternion(this.quaternion),this.world.cameraOperator.target.copy(e.add(this.position))}else this.world.cameraOperator.target.set(this.position.x,this.position.y+.5,this.position.z)},e.prototype.setPosition=function(t,e,n){this.collision.position.x=t,this.collision.position.y=e,this.collision.position.z=n},e.prototype.setSteeringValue=function(t){var e=this;this.wheels.forEach((function(n){n.steering&&e.rayCastVehicle.setSteeringValue(t,n.rayCastWheelInfoIndex)}))},e.prototype.applyEngineForce=function(t){var e=this;this.wheels.forEach((function(n){e.drive!==n.drive&&"awd"!==e.drive||e.rayCastVehicle.applyEngineForce(t,n.rayCastWheelInfoIndex)}))},e.prototype.setBrake=function(t,e){var n=this;this.wheels.forEach((function(i){void 0!==e&&e!==i.drive||n.rayCastVehicle.setBrake(t,i.rayCastWheelInfoIndex)}))},e.prototype.addToWorld=function(t){s.includes(t.vehicles,this)?console.warn("Adding character to a world in which it already exists."):void 0===this.rayCastVehicle?console.error("Trying to create vehicle without raycastVehicleComponent"):(this.world=t,t.vehicles.push(this),t.graphicsWorld.add(this),this.rayCastVehicle.addToWorld(t.physicsWorld),this.wheels.forEach((function(e){t.graphicsWorld.attach(e.wheelObject)})),this.materials.forEach((function(e){t.sky.csm.setupMaterial(e)})))},e.prototype.removeFromWorld=function(t){s.includes(t.vehicles,this)?(this.world=void 0,s.pull(t.vehicles,this),t.graphicsWorld.remove(this),this.rayCastVehicle.removeFromWorld(t.physicsWorld),this.wheels.forEach((function(e){t.graphicsWorld.remove(e.wheelObject)}))):console.warn("Removing character from a world in which it isn't present.")},e.prototype.readVehicleData=function(t){var e=this;t.scene.traverse((function(n){if(n.isMesh&&(u.setupMeshProperties(n),void 0!==n.material&&e.materials.push(n.material)),n.hasOwnProperty("userData")&&n.userData.hasOwnProperty("data")){if("seat"===n.userData.data&&e.seats.push(new c.VehicleSeat(e,n,t)),"camera"===n.userData.data&&(e.camera=n),"wheel"===n.userData.data&&e.wheels.push(new l.Wheel(n)),"collision"===n.userData.data)if("box"===n.userData.shape)n.visible=!1,(i=new a.Box(new a.Vec3(n.scale.x,n.scale.y,n.scale.z))).collisionFilterMask=~h.CollisionGroups.TrimeshColliders,e.collision.addShape(i,new a.Vec3(n.position.x,n.position.y,n.position.z));else if("sphere"===n.userData.shape){var i;n.visible=!1,(i=new a.Sphere(n.scale.x)).collisionFilterGroup=h.CollisionGroups.TrimeshColliders,e.collision.addShape(i,new a.Vec3(n.position.x,n.position.y,n.position.z))}"navmesh"===n.userData.data&&(n.visible=!1)}})),0===this.collision.shapes.length&&console.warn("Vehicle "+typeof this+" has no collision data."),0===this.seats.length?console.warn("Vehicle "+typeof this+" has no seats."):this.connectSeats()},e.prototype.connectSeats=function(){for(var t=0,e=this.seats;t0)for(var a=0,s=this.seats;a0&&this.noDirection())this.character.setState(new a.CloseVehicleDoorInside(this.character,this.seat));else if(null!==this.character.vehicleEntryInstance)if(this.character.vehicleEntryInstance.wantsToDrive)for(var o=0,l=this.seat.connectedSeats;o0&&(this.seat.door.physicsEnabled=!0),this.character.setState(new c.SwitchingSeats(this.character,this.seat,u));break}}else this.character.vehicleEntryInstance=null},e.prototype.onInputChange=function(){this.character.actions.seat_switch.justPressed&&this.seat.connectedSeats.length>0&&this.character.setState(new c.SwitchingSeats(this.character,this.seat,this.seat.connectedSeats[0])),this.character.actions.enter.justPressed&&(this.character.exitVehicle(),this.character.displayControls())},e}(o.CharacterStateBase);e.Sitting=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e,n){this.mass=e,this.damping=n,this.frameTime=1/t,this.offset=0}return t.prototype.setFPS=function(t){this.frameTime=1/t},t.prototype.lastFrame=function(){return this.cache[this.cache.length-1]},t.prototype.generateFrames=function(t){var e=this.offset+t,n=Math.floor(e/this.frameTime);if(this.offset=e%this.frameTime,n>0){for(var i=0;i(e=parseInt(e.getAttribute("tabindex")))?1:t1&&void 0!==arguments[1]?arguments[1]:"flex";t.style.opacity="",t.style.display=e},ct=function(t){t.style.opacity="",t.style.display="none"},lt=function(t,e,n){e?st(t,n):ct(t)},ut=function(t){return!(!t||!(t.offsetWidth||t.offsetHeight||t.getClientRects().length))},ht=function(t){return!!(t.scrollHeight>t.clientHeight)},pt=function(t){var e=window.getComputedStyle(t),n=parseFloat(e.getPropertyValue("animation-duration")||"0"),i=parseFloat(e.getPropertyValue("transition-duration")||"0");return n>0||i>0},dt=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=H();ut(n)&&(e&&(n.style.transition="none",n.style.width="100%"),setTimeout((function(){n.style.transition="width ".concat(t/1e3,"s linear"),n.style.width="0%"}),10))},ft=function(){return"undefined"==typeof window||"undefined"==typeof document},mt='\n
\n
\n
    \n
    \n
    \n
    \n
    \n
    \n \n

    \n \n
    \n
    \n
    \n \n \n
    \n \n \n
    \n \n
    \n \n \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n
    \n').replace(/(^|\n)\s*/g,""),vt=function(t){mn.isVisible()&&tt!==t.target.value&&mn.resetValidationMessage(),tt=t.target.value},gt=function(t){var e,n=!!(e=T())&&(e.parentNode.removeChild(e),rt([document.documentElement,document.body],[E["no-backdrop"],E["toast-shown"],E["has-column"]]),!0);if(ft())m("SweetAlert2 requires document to initialize");else{var i=document.createElement("div");i.className=E.container,n&&it(i,E["no-transition"]),K(i,mt);var r,o,a,s,c,l,u,h,p,d="string"==typeof(r=t.target)?document.querySelector(r):r;d.appendChild(i),function(t){var e=C();e.setAttribute("role",t.toast?"alert":"dialog"),e.setAttribute("aria-live",t.toast?"polite":"assertive"),t.toast||e.setAttribute("aria-modal","true")}(t),function(t){"rtl"===window.getComputedStyle(t).direction&&it(T(),E.rtl)}(d),o=I(),a=ot(o,E.input),s=ot(o,E.file),c=o.querySelector(".".concat(E.range," input")),l=o.querySelector(".".concat(E.range," output")),u=ot(o,E.select),h=o.querySelector(".".concat(E.checkbox," input")),p=ot(o,E.textarea),a.oninput=vt,s.onchange=vt,u.onchange=vt,h.onchange=vt,p.oninput=vt,c.oninput=function(t){vt(t),l.value=c.value},c.onchange=function(t){vt(t),c.nextSibling.value=c.value}}},yt=function(e,n){e instanceof HTMLElement?n.appendChild(e):"object"===t(e)?wt(e,n):e&&K(n,e)},wt=function(t,e){t.jquery?xt(e,t):K(e,t.toString())},xt=function(t,e){if(t.textContent="",0 in e)for(var n=0;n in e;n++)t.appendChild(e[n].cloneNode(!0));else t.appendChild(e.cloneNode(!0))},_t=function(){if(ft())return!1;var t=document.createElement("div"),e={WebkitAnimation:"webkitAnimationEnd",OAnimation:"oAnimationEnd oanimationend",animation:"animationend"};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&void 0!==t.style[n])return e[n];return!1}(),bt=function(t,e){var n=U(),i=z(),r=V();e.showConfirmButton||e.showCancelButton||ct(n),J(n,e,"actions"),St(i,"confirm",e),St(r,"cancel",e),e.buttonsStyling?function(t,e,n){if(it([t,e],E.styled),n.confirmButtonColor&&(t.style.backgroundColor=n.confirmButtonColor),n.cancelButtonColor&&(e.style.backgroundColor=n.cancelButtonColor),!Y()){var i=window.getComputedStyle(t).getPropertyValue("background-color");t.style.borderLeftColor=i,t.style.borderRightColor=i}}(i,r,e):(rt([i,r],E.styled),i.style.backgroundColor=i.style.borderLeftColor=i.style.borderRightColor="",r.style.backgroundColor=r.style.borderLeftColor=r.style.borderRightColor=""),e.reverseButtons&&i.parentNode.insertBefore(r,i)};function St(t,e,n){lt(t,n["show".concat(h(e),"Button")],"inline-block"),K(t,n["".concat(e,"ButtonText")]),t.setAttribute("aria-label",n["".concat(e,"ButtonAriaLabel")]),t.className=E[e],J(t,n,"".concat(e,"Button")),it(t,n["".concat(e,"ButtonClass")])}var Mt=function(t,e){var n=T();if(n){!function(t,e){"string"==typeof e?t.style.background=e:e||it([document.documentElement,document.body],E["no-backdrop"])}(n,e.backdrop),!e.backdrop&&e.allowOutsideClick&&f('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`'),function(t,e){e in E?it(t,E[e]):(f('The "position" parameter is not valid, defaulting to "center"'),it(t,E.center))}(n,e.position),function(t,e){if(e&&"string"==typeof e){var n="grow-".concat(e);n in E&&it(t,E[n])}}(n,e.grow),J(n,e,"container");var i=document.body.getAttribute("data-swal2-queue-step");i&&(n.setAttribute("data-queue-step",i),document.body.removeAttribute("data-swal2-queue-step"))}},Et={promise:new WeakMap,innerParams:new WeakMap,domCache:new WeakMap},At=["input","file","range","select","radio","checkbox","textarea"],Tt=function(t){if(!Ot[t.input])return m('Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "'.concat(t.input,'"'));var e=Rt(t.input),n=Ot[t.input](e,t);st(n),setTimeout((function(){et(n)}))},Pt=function(t,e){var n=$(I(),t);if(n)for(var i in function(t){for(var e=0;en?"".concat(e,"px"):null})).observe(t,{attributes:!0,attributeFilter:["style"]})}return t};var Ft=function(t,e){var n=I().querySelector("#".concat(E.content));e.html?(yt(e.html,n),st(n,"block")):e.text?(n.textContent=e.text,st(n,"block")):ct(n),function(t,e){var n=I(),i=Et.innerParams.get(t),r=!i||e.input!==i.input;At.forEach((function(t){var i=E[t],o=ot(n,i);Pt(t,e.inputAttributes),o.className=i,r&&ct(o)})),e.input&&(r&&Tt(e),Lt(e))}(t,e),J(I(),e,"content")},It=function(){for(var t=R(),e=0;e\n \n
    \n
    \n '):"error"===e.icon?K(t,'\n \n \n \n \n '):K(t,Dt({question:"?",warning:"!",info:"i"}[e.icon]))},Dt=function(t){return'
    ').concat(t,"
    ")},zt=[],Vt=function(){return T()&&T().getAttribute("data-queue-step")},Ut=function(t,e){var n=B();if(!e.progressSteps||0===e.progressSteps.length)return ct(n);st(n),n.textContent="";var i=parseInt(void 0===e.currentProgressStep?Vt():e.currentProgressStep);i>=e.progressSteps.length&&f("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),e.progressSteps.forEach((function(t,r){var o=function(t){var e=document.createElement("li");return it(e,E["progress-step"]),K(e,t),e}(t);if(n.appendChild(o),r===i&&it(o,E["active-progress-step"]),r!==e.progressSteps.length-1){var a=function(t){var e=document.createElement("li");return it(e,E["progress-step-line"]),t.progressStepsDistance&&(e.style.width=t.progressStepsDistance),e}(e);n.appendChild(a)}}))},kt=function(t,e){var n=k();J(n,e,"header"),Ut(0,e),function(t,e){var n=Et.innerParams.get(t);if(n&&e.icon===n.icon&&O())J(O(),e,"icon");else if(It(),e.icon)if(-1!==Object.keys(A).indexOf(e.icon)){var i=P(".".concat(E.icon,".").concat(A[e.icon]));st(i),Bt(i,e),Nt(),J(i,e,"icon"),it(i,e.showClass.icon)}else m('Unknown icon! Expected "success", "error", "warning", "info" or "question", got "'.concat(e.icon,'"'))}(t,e),function(t,e){var n=N();if(!e.imageUrl)return ct(n);st(n,""),n.setAttribute("src",e.imageUrl),n.setAttribute("alt",e.imageAlt),at(n,"width",e.imageWidth),at(n,"height",e.imageHeight),n.className=E.image,J(n,e,"image")}(0,e),function(t,e){var n=F();lt(n,e.title||e.titleText),e.title&&yt(e.title,n),e.titleText&&(n.innerText=e.titleText),J(n,e,"title")}(0,e),function(t,e){var n=G();K(n,e.closeButtonHtml),J(n,e,"closeButton"),lt(n,e.showCloseButton),n.setAttribute("aria-label",e.closeButtonAriaLabel)}(0,e)},jt=function(t,e){t.className="".concat(E.popup," ").concat(ut(t)?e.showClass.popup:""),e.toast?(it([document.documentElement,document.body],E["toast-shown"]),it(t,E.toast)):it(t,E.modal),J(t,e,"popup"),"string"==typeof e.customClass&&it(t,e.customClass),e.icon&&it(t,E["icon-".concat(e.icon)])},Ht=function(t,e){!function(t,e){var n=C();at(n,"width",e.width),at(n,"padding",e.padding),e.background&&(n.style.background=e.background),jt(n,e)}(0,e),Mt(0,e),kt(t,e),Ft(t,e),bt(0,e),function(t,e){var n=j();lt(n,e.footer),e.footer&&yt(e.footer,n),J(n,e,"footer")}(0,e),"function"==typeof e.onRender&&e.onRender(C())},Gt=function(){return z()&&z().click()},Wt=function(){var t=C();t||mn.fire(),t=C();var e=U(),n=z();st(e),st(n,"inline-block"),it([t,e],E.loading),n.disabled=!0,t.setAttribute("data-loading",!0),t.setAttribute("aria-busy",!0),t.focus()},qt={},Xt=function(){return new Promise((function(t){var e=window.scrollX,n=window.scrollY;qt.restoreFocusTimeout=setTimeout((function(){qt.previousActiveElement&&qt.previousActiveElement.focus?(qt.previousActiveElement.focus(),qt.previousActiveElement=null):document.body&&document.body.focus(),t()}),100),void 0!==e&&void 0!==n&&window.scrollTo(e,n)}))},Yt=function(){if(qt.timeout)return function(){var t=H(),e=parseInt(window.getComputedStyle(t).width);t.style.removeProperty("transition"),t.style.width="100%";var n=parseInt(window.getComputedStyle(t).width),i=parseInt(e/n*100);t.style.removeProperty("transition"),t.style.width="".concat(i,"%")}(),qt.timeout.stop()},Qt=function(){if(qt.timeout){var t=qt.timeout.start();return dt(t),t}},Kt={title:"",titleText:"",text:"",html:"",footer:"",icon:void 0,iconHtml:void 0,toast:!1,animation:!0,showClass:{popup:"swal2-show",backdrop:"swal2-backdrop-show",icon:"swal2-icon-show"},hideClass:{popup:"swal2-hide",backdrop:"swal2-backdrop-hide",icon:"swal2-icon-hide"},customClass:void 0,target:"body",backdrop:!0,heightAuto:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,stopKeydownPropagation:!0,keydownListenerCapture:!1,showConfirmButton:!0,showCancelButton:!1,preConfirm:void 0,confirmButtonText:"OK",confirmButtonAriaLabel:"",confirmButtonColor:void 0,cancelButtonText:"Cancel",cancelButtonAriaLabel:"",cancelButtonColor:void 0,buttonsStyling:!0,reverseButtons:!1,focusConfirm:!0,focusCancel:!1,showCloseButton:!1,closeButtonHtml:"×",closeButtonAriaLabel:"Close this dialog",showLoaderOnConfirm:!1,imageUrl:void 0,imageWidth:void 0,imageHeight:void 0,imageAlt:"",timer:void 0,timerProgressBar:!1,width:void 0,padding:void 0,background:void 0,input:void 0,inputPlaceholder:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputAttributes:{},inputValidator:void 0,validationMessage:void 0,grow:!1,position:"center",progressSteps:[],currentProgressStep:void 0,progressStepsDistance:void 0,onBeforeOpen:void 0,onOpen:void 0,onRender:void 0,onClose:void 0,onAfterClose:void 0,onDestroy:void 0,scrollbarPadding:!0},Zt=["title","titleText","text","html","footer","icon","hideClass","customClass","allowOutsideClick","allowEscapeKey","showConfirmButton","showCancelButton","confirmButtonText","confirmButtonAriaLabel","confirmButtonColor","cancelButtonText","cancelButtonAriaLabel","cancelButtonColor","buttonsStyling","reverseButtons","showCloseButton","closeButtonHtml","closeButtonAriaLabel","imageUrl","imageWidth","imageHeight","imageAlt","progressSteps","currentProgressStep","onClose","onAfterClose","onDestroy"],Jt={animation:'showClass" and "hideClass'},$t=["allowOutsideClick","allowEnterKey","backdrop","focusConfirm","focusCancel","heightAuto","keydownListenerCapture"],te=function(t){return Object.prototype.hasOwnProperty.call(Kt,t)},ee=function(t){return Jt[t]},ne=function(t){te(t)||f('Unknown parameter "'.concat(t,'"'))},ie=function(t){-1!==$t.indexOf(t)&&f('The parameter "'.concat(t,'" is incompatible with toasts'))},re=function(t){ee(t)&&g(t,ee(t))},oe=function(t){for(var e in t)ne(e),t.toast&&ie(e),re(e)},ae=Object.freeze({isValidParameter:te,isUpdatableParameter:function(t){return-1!==Zt.indexOf(t)},isDeprecatedParameter:ee,argsToParams:function(e){var n={};return"object"!==t(e[0])||S(e[0])?["title","html","icon"].forEach((function(i,r){var o=e[r];"string"==typeof o||S(o)?n[i]=o:void 0!==o&&m("Unexpected type of ".concat(i,'! Expected "string" or "Element", got ').concat(t(o)))})):r(n,e[0]),n},isVisible:function(){return ut(C())},clickConfirm:Gt,clickCancel:function(){return V()&&V().click()},getContainer:T,getPopup:C,getTitle:F,getContent:I,getHtmlContainer:function(){return L(E["html-container"])},getImage:N,getIcon:O,getIcons:R,getCloseButton:G,getActions:U,getConfirmButton:z,getCancelButton:V,getHeader:k,getFooter:j,getTimerProgressBar:H,getFocusableElements:W,getValidationMessage:D,isLoading:Y,fire:function(){for(var t=arguments.length,e=new Array(t),n=0;nwindow.innerHeight&&(Q.previousBodyPadding=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight="".concat(Q.previousBodyPadding+function(){var t=document.createElement("div");t.className=E["scrollbar-measure"],document.body.appendChild(t);var e=t.getBoundingClientRect().width-t.clientWidth;return document.body.removeChild(t),e}(),"px"))},le=function(){null!==Q.previousBodyPadding&&(document.body.style.paddingRight="".concat(Q.previousBodyPadding,"px"),Q.previousBodyPadding=null)},ue=function(){navigator.userAgent.match(/(CriOS|FxiOS|EdgiOS|YaBrowser|UCBrowser)/i)||C().scrollHeight>window.innerHeight-44&&(T().style.paddingBottom="".concat(44,"px"))},he=function(){var t,e=T();e.ontouchstart=function(e){t=pe(e.target)},e.ontouchmove=function(e){t&&(e.preventDefault(),e.stopPropagation())}},pe=function(t){var e=T();return t===e||!(ht(e)||"INPUT"===t.tagName||ht(I())&&I().contains(t))},de=function(){if(Z(document.body,E.iosfix)){var t=parseInt(document.body.style.top,10);rt(document.body,E.iosfix),document.body.style.top="",document.body.scrollTop=-1*t}},fe=function(){return!!window.MSInputMethodContext&&!!document.documentMode},me=function(){var t=T(),e=C();t.style.removeProperty("align-items"),e.offsetTop<0&&(t.style.alignItems="flex-start")},ve=function(){"undefined"!=typeof window&&fe()&&window.removeEventListener("resize",me)},ge=function(){d(document.body.children).forEach((function(t){t.hasAttribute("data-previous-aria-hidden")?(t.setAttribute("aria-hidden",t.getAttribute("data-previous-aria-hidden")),t.removeAttribute("data-previous-aria-hidden")):t.removeAttribute("aria-hidden")}))},ye={swalPromiseResolve:new WeakMap};function we(t,e,n,i){n?Se(t,i):(Xt().then((function(){return Se(t,i)})),qt.keydownTarget.removeEventListener("keydown",qt.keydownHandler,{capture:qt.keydownListenerCapture}),qt.keydownHandlerAdded=!1),e.parentNode&&!document.body.getAttribute("data-swal2-queue-step")&&e.parentNode.removeChild(e),q()&&(le(),de(),ve(),ge()),rt([document.documentElement,document.body],[E.shown,E["height-auto"],E["no-backdrop"],E["toast-shown"],E["toast-column"]])}function xe(t){var e=C();if(e){var n=Et.innerParams.get(this);if(n&&!Z(e,n.hideClass.popup)){var i=ye.swalPromiseResolve.get(this);rt(e,n.showClass.popup),it(e,n.hideClass.popup);var r=T();rt(r,n.showClass.backdrop),it(r,n.hideClass.backdrop),_e(this,e,n),void 0!==t?(t.isDismissed=void 0!==t.dismiss,t.isConfirmed=void 0===t.dismiss):t={isDismissed:!0,isConfirmed:!1},i(t||{})}}}var _e=function(t,e,n){var i=T(),r=_t&&pt(e),o=n.onClose,a=n.onAfterClose;null!==o&&"function"==typeof o&&o(e),r?be(t,e,i,a):we(t,i,X(),a)},be=function(t,e,n,i){qt.swalCloseEventFinishedCallback=we.bind(null,t,n,X(),i),e.addEventListener(_t,(function(t){t.target===e&&(qt.swalCloseEventFinishedCallback(),delete qt.swalCloseEventFinishedCallback)}))},Se=function(t,e){setTimeout((function(){"function"==typeof e&&e(),t._destroy()}))};function Me(t,e,n){var i=Et.domCache.get(t);e.forEach((function(t){i[t].disabled=n}))}function Ee(t,e){if(!t)return!1;if("radio"===t.type)for(var n=t.parentNode.parentNode.querySelectorAll("input"),i=0;i")),gt(t)}var Le=function(t){var e=T(),n=C();"function"==typeof t.onBeforeOpen&&t.onBeforeOpen(n);var i=window.getComputedStyle(document.body).overflowY;Ie(e,n,t),Oe(e,n),q()&&(Fe(e,t.scrollbarPadding,i),d(document.body.children).forEach((function(t){t===T()||function(t,e){if("function"==typeof t.contains)return t.contains(e)}(t,T())||(t.hasAttribute("aria-hidden")&&t.setAttribute("data-previous-aria-hidden",t.getAttribute("aria-hidden")),t.setAttribute("aria-hidden","true"))}))),X()||qt.previousActiveElement||(qt.previousActiveElement=document.activeElement),"function"==typeof t.onOpen&&setTimeout((function(){return t.onOpen(n)})),rt(e,E["no-transition"])};function Ce(t){var e=C();if(t.target===e){var n=T();e.removeEventListener(_t,Ce),n.style.overflowY="auto"}}var Re,Oe=function(t,e){_t&&pt(e)?(t.style.overflowY="hidden",e.addEventListener(_t,Ce)):t.style.overflowY="auto"},Fe=function(t,e,n){!function(){if((/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1)&&!Z(document.body,E.iosfix)){var t=document.body.scrollTop;document.body.style.top="".concat(-1*t,"px"),it(document.body,E.iosfix),he(),ue()}}(),"undefined"!=typeof window&&fe()&&(me(),window.addEventListener("resize",me)),e&&"hidden"!==n&&ce(),setTimeout((function(){t.scrollTop=0}))},Ie=function(t,e,n){it(t,n.showClass.backdrop),st(e),it(e,n.showClass.popup),it([document.documentElement,document.body],E.shown),n.heightAuto&&n.backdrop&&!n.toast&&it([document.documentElement,document.body],E["height-auto"])},Ne=function(t){return t.checked?1:0},Be=function(t){return t.checked?t.value:null},De=function(t){return t.files.length?null!==t.getAttribute("multiple")?t.files:t.files[0]:null},ze=function(e,n){var i=I(),r=function(t){return Ue[n.input](i,ke(t),n)};w(n.inputOptions)||_(n.inputOptions)?(Wt(),x(n.inputOptions).then((function(t){e.hideLoading(),r(t)}))):"object"===t(n.inputOptions)?r(n.inputOptions):m("Unexpected type of inputOptions! Expected object, Map or Promise, got ".concat(t(n.inputOptions)))},Ve=function(t,e){var n=t.getInput();ct(n),x(e.inputValue).then((function(i){n.value="number"===e.input?parseFloat(i)||0:"".concat(i),st(n),n.focus(),t.hideLoading()})).catch((function(e){m("Error in inputValue promise: ".concat(e)),n.value="",st(n),n.focus(),t.hideLoading()}))},Ue={select:function(t,e,n){var i=ot(t,E.select),r=function(t,e,i){var r=document.createElement("option");r.value=i,K(r,e),n.inputValue.toString()===i.toString()&&(r.selected=!0),t.appendChild(r)};e.forEach((function(t){var e=t[0],n=t[1];if(Array.isArray(n)){var o=document.createElement("optgroup");o.label=e,o.disabled=!1,i.appendChild(o),n.forEach((function(t){return r(o,t[1],t[0])}))}else r(i,n,e)})),i.focus()},radio:function(t,e,n){var i=ot(t,E.radio);e.forEach((function(t){var e=t[0],r=t[1],o=document.createElement("input"),a=document.createElement("label");o.type="radio",o.name=E.radio,o.value=e,n.inputValue.toString()===e.toString()&&(o.checked=!0);var s=document.createElement("span");K(s,r),s.className=E.label,a.appendChild(o),a.appendChild(s),i.appendChild(a)}));var r=i.querySelectorAll("input");r.length&&r[0].focus()}},ke=function e(n){var i=[];return"undefined"!=typeof Map&&n instanceof Map?n.forEach((function(n,r){var o=n;"object"===t(o)&&(o=e(o)),i.push([r,o])})):Object.keys(n).forEach((function(r){var o=n[r];"object"===t(o)&&(o=e(o)),i.push([r,o])})),i},je=function(t,e){var n=function(t,e){var n=t.getInput();if(!n)return null;switch(e.input){case"checkbox":return Ne(n);case"radio":return Be(n);case"file":return De(n);default:return e.inputAutoTrim?n.value.trim():n.value}}(t,e);e.inputValidator?(t.disableInput(),Promise.resolve().then((function(){return x(e.inputValidator(n,e.validationMessage))})).then((function(i){t.enableButtons(),t.enableInput(),i?t.showValidationMessage(i):Ge(t,e,n)}))):t.getInput().checkValidity()?Ge(t,e,n):(t.enableButtons(),t.showValidationMessage(e.validationMessage))},He=function(t,e){t.closePopup({value:e})},Ge=function(t,e,n){e.showLoaderOnConfirm&&Wt(),e.preConfirm?(t.resetValidationMessage(),Promise.resolve().then((function(){return x(e.preConfirm(n,e.validationMessage))})).then((function(e){ut(D())||!1===e?t.hideLoading():He(t,void 0===e?n:e)}))):He(t,n)},We=function(t,e,n){for(var i=W(),r=0;r:first-child,.swal2-container.swal2-bottom-left>:first-child,.swal2-container.swal2-bottom-right>:first-child,.swal2-container.swal2-bottom-start>:first-child,.swal2-container.swal2-bottom>:first-child{margin-top:auto}.swal2-container.swal2-grow-fullscreen>.swal2-modal{display:flex!important;flex:1;align-self:stretch;justify-content:center}.swal2-container.swal2-grow-row>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container.swal2-grow-column{flex:1;flex-direction:column}.swal2-container.swal2-grow-column.swal2-bottom,.swal2-container.swal2-grow-column.swal2-center,.swal2-container.swal2-grow-column.swal2-top{align-items:center}.swal2-container.swal2-grow-column.swal2-bottom-left,.swal2-container.swal2-grow-column.swal2-bottom-start,.swal2-container.swal2-grow-column.swal2-center-left,.swal2-container.swal2-grow-column.swal2-center-start,.swal2-container.swal2-grow-column.swal2-top-left,.swal2-container.swal2-grow-column.swal2-top-start{align-items:flex-start}.swal2-container.swal2-grow-column.swal2-bottom-end,.swal2-container.swal2-grow-column.swal2-bottom-right,.swal2-container.swal2-grow-column.swal2-center-end,.swal2-container.swal2-grow-column.swal2-center-right,.swal2-container.swal2-grow-column.swal2-top-end,.swal2-container.swal2-grow-column.swal2-top-right{align-items:flex-end}.swal2-container.swal2-grow-column>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container.swal2-no-transition{transition:none!important}.swal2-container:not(.swal2-top):not(.swal2-top-start):not(.swal2-top-end):not(.swal2-top-left):not(.swal2-top-right):not(.swal2-center-start):not(.swal2-center-end):not(.swal2-center-left):not(.swal2-center-right):not(.swal2-bottom):not(.swal2-bottom-start):not(.swal2-bottom-end):not(.swal2-bottom-left):not(.swal2-bottom-right):not(.swal2-grow-fullscreen)>.swal2-modal{margin:auto}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-container .swal2-modal{margin:0!important}}.swal2-popup{display:none;position:relative;box-sizing:border-box;flex-direction:column;justify-content:center;width:32em;max-width:100%;padding:1.25em;border:none;border-radius:.3125em;background:#fff;font-family:inherit;font-size:1rem}.swal2-popup:focus{outline:0}.swal2-popup.swal2-loading{overflow-y:hidden}.swal2-header{display:flex;flex-direction:column;align-items:center;padding:0 1.8em}.swal2-title{position:relative;max-width:100%;margin:0 0 .4em;padding:0;color:#595959;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}.swal2-actions{display:flex;z-index:1;flex-wrap:wrap;align-items:center;justify-content:center;width:100%;margin:1.25em auto 0}.swal2-actions:not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}.swal2-actions:not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,.1))}.swal2-actions:not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0,0,0,.2),rgba(0,0,0,.2))}.swal2-actions.swal2-loading .swal2-styled.swal2-confirm{box-sizing:border-box;width:2.5em;height:2.5em;margin:.46875em;padding:0;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border:.25em solid transparent;border-radius:100%;border-color:transparent;background-color:transparent!important;color:transparent!important;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-actions.swal2-loading .swal2-styled.swal2-cancel{margin-right:30px;margin-left:30px}.swal2-actions.swal2-loading :not(.swal2-styled).swal2-confirm::after{content:"";display:inline-block;width:15px;height:15px;margin-left:5px;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border:3px solid #999;border-radius:50%;border-right-color:transparent;box-shadow:1px 1px 1px #fff}.swal2-styled{margin:.3125em;padding:.625em 2em;box-shadow:none;font-weight:500}.swal2-styled:not([disabled]){cursor:pointer}.swal2-styled.swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#3085d6;color:#fff;font-size:1.0625em}.swal2-styled.swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#aaa;color:#fff;font-size:1.0625em}.swal2-styled:focus{outline:0;box-shadow:0 0 0 1px #fff,0 0 0 3px rgba(50,100,150,.4)}.swal2-styled::-moz-focus-inner{border:0}.swal2-footer{justify-content:center;margin:1.25em 0 0;padding:1em 0 0;border-top:1px solid #eee;color:#545454;font-size:1em}.swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;height:.25em;overflow:hidden;border-bottom-right-radius:.3125em;border-bottom-left-radius:.3125em}.swal2-timer-progress-bar{width:100%;height:.25em;background:rgba(0,0,0,.2)}.swal2-image{max-width:100%;margin:1.25em auto}.swal2-close{position:absolute;z-index:2;top:0;right:0;align-items:center;justify-content:center;width:1.2em;height:1.2em;padding:0;overflow:hidden;transition:color .1s ease-out;border:none;border-radius:0;background:0 0;color:#ccc;font-family:serif;font-size:2.5em;line-height:1.2;cursor:pointer}.swal2-close:hover{transform:none;background:0 0;color:#f27474}.swal2-close::-moz-focus-inner{border:0}.swal2-content{z-index:1;justify-content:center;margin:0;padding:0 1.6em;color:#545454;font-size:1.125em;font-weight:400;line-height:normal;text-align:center;word-wrap:break-word}.swal2-checkbox,.swal2-file,.swal2-input,.swal2-radio,.swal2-select,.swal2-textarea{margin:1em auto}.swal2-file,.swal2-input,.swal2-textarea{box-sizing:border-box;width:100%;transition:border-color .3s,box-shadow .3s;border:1px solid #d9d9d9;border-radius:.1875em;background:inherit;box-shadow:inset 0 1px 1px rgba(0,0,0,.06);color:inherit;font-size:1.125em}.swal2-file.swal2-inputerror,.swal2-input.swal2-inputerror,.swal2-textarea.swal2-inputerror{border-color:#f27474!important;box-shadow:0 0 2px #f27474!important}.swal2-file:focus,.swal2-input:focus,.swal2-textarea:focus{border:1px solid #b4dbed;outline:0;box-shadow:0 0 3px #c4e6f5}.swal2-file::-moz-placeholder,.swal2-input::-moz-placeholder,.swal2-textarea::-moz-placeholder{color:#ccc}.swal2-file:-ms-input-placeholder,.swal2-input:-ms-input-placeholder,.swal2-textarea:-ms-input-placeholder{color:#ccc}.swal2-file::-ms-input-placeholder,.swal2-input::-ms-input-placeholder,.swal2-textarea::-ms-input-placeholder{color:#ccc}.swal2-file::placeholder,.swal2-input::placeholder,.swal2-textarea::placeholder{color:#ccc}.swal2-range{margin:1em auto;background:#fff}.swal2-range input{width:80%}.swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}.swal2-range input,.swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}.swal2-input{height:2.625em;padding:0 .75em}.swal2-input[type=number]{max-width:10em}.swal2-file{background:inherit;font-size:1.125em}.swal2-textarea{height:6.75em;padding:.75em}.swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:inherit;color:inherit;font-size:1.125em}.swal2-checkbox,.swal2-radio{align-items:center;justify-content:center;background:#fff;color:inherit}.swal2-checkbox label,.swal2-radio label{margin:0 .6em;font-size:1.125em}.swal2-checkbox input,.swal2-radio input{margin:0 .4em}.swal2-validation-message{display:none;align-items:center;justify-content:center;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}.swal2-validation-message::before{content:"!";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}.swal2-icon{position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:1.25em auto 1.875em;border:.25em solid transparent;border-radius:50%;font-family:inherit;line-height:5em;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}.swal2-icon.swal2-error{border-color:#f27474;color:#f27474}.swal2-icon.swal2-error .swal2-x-mark{position:relative;flex-grow:1}.swal2-icon.swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}.swal2-icon.swal2-error.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-error.swal2-icon-show .swal2-x-mark{-webkit-animation:swal2-animate-error-x-mark .5s;animation:swal2-animate-error-x-mark .5s}.swal2-icon.swal2-warning{border-color:#facea8;color:#f8bb86}.swal2-icon.swal2-info{border-color:#9de0f6;color:#3fc3ee}.swal2-icon.swal2-question{border-color:#c9dae1;color:#87adbd}.swal2-icon.swal2-success{border-color:#a5dc86;color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;transform:rotate(45deg);border-radius:50%}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}.swal2-icon.swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-.25em;left:-.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}.swal2-icon.swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}.swal2-icon.swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-animate-success-line-tip .75s;animation:swal2-animate-success-line-tip .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-animate-success-line-long .75s;animation:swal2-animate-success-line-long .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-circular-line-right{-webkit-animation:swal2-rotate-success-circular-line 4.25s ease-in;animation:swal2-rotate-success-circular-line 4.25s ease-in}.swal2-progress-steps{align-items:center;margin:0 0 1.25em;padding:0;background:inherit;font-weight:600}.swal2-progress-steps li{display:inline-block;position:relative}.swal2-progress-steps .swal2-progress-step{z-index:20;width:2em;height:2em;border-radius:2em;background:#3085d6;color:#fff;line-height:2em;text-align:center}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#3085d6}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}.swal2-progress-steps .swal2-progress-step-line{z-index:10;width:2.5em;height:.4em;margin:0 -1px;background:#3085d6}[class^=swal2]{-webkit-tap-highlight-color:transparent}.swal2-show{-webkit-animation:swal2-show .3s;animation:swal2-show .3s}.swal2-hide{-webkit-animation:swal2-hide .15s forwards;animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{right:auto;left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@supports (-ms-accelerator:true){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@-moz-document url-prefix(){.swal2-close:focus{outline:2px solid rgba(50,100,150,.4)}}@-webkit-keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@-webkit-keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@-webkit-keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@-webkit-keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@-webkit-keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@-webkit-keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@-webkit-keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@-webkit-keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@-webkit-keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@-webkit-keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@-webkit-keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@-webkit-keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto!important}body.swal2-no-backdrop .swal2-container{top:auto;right:auto;bottom:auto;left:auto;max-width:calc(100% - .625em * 2);background-color:transparent!important}body.swal2-no-backdrop .swal2-container>.swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}body.swal2-no-backdrop .swal2-container.swal2-top{top:0;left:50%;transform:translateX(-50%)}body.swal2-no-backdrop .swal2-container.swal2-top-left,body.swal2-no-backdrop .swal2-container.swal2-top-start{top:0;left:0}body.swal2-no-backdrop .swal2-container.swal2-top-end,body.swal2-no-backdrop .swal2-container.swal2-top-right{top:0;right:0}body.swal2-no-backdrop .swal2-container.swal2-center{top:50%;left:50%;transform:translate(-50%,-50%)}body.swal2-no-backdrop .swal2-container.swal2-center-left,body.swal2-no-backdrop .swal2-container.swal2-center-start{top:50%;left:0;transform:translateY(-50%)}body.swal2-no-backdrop .swal2-container.swal2-center-end,body.swal2-no-backdrop .swal2-container.swal2-center-right{top:50%;right:0;transform:translateY(-50%)}body.swal2-no-backdrop .swal2-container.swal2-bottom{bottom:0;left:50%;transform:translateX(-50%)}body.swal2-no-backdrop .swal2-container.swal2-bottom-left,body.swal2-no-backdrop .swal2-container.swal2-bottom-start{bottom:0;left:0}body.swal2-no-backdrop .swal2-container.swal2-bottom-end,body.swal2-no-backdrop .swal2-container.swal2-bottom-right{right:0;bottom:0}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll!important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static!important}}body.swal2-toast-shown .swal2-container{background-color:transparent}body.swal2-toast-shown .swal2-container.swal2-top{top:0;right:auto;bottom:auto;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{top:0;right:0;bottom:auto;left:auto}body.swal2-toast-shown .swal2-container.swal2-top-left,body.swal2-toast-shown .swal2-container.swal2-top-start{top:0;right:auto;bottom:auto;left:0}body.swal2-toast-shown .swal2-container.swal2-center-left,body.swal2-toast-shown .swal2-container.swal2-center-start{top:50%;right:auto;bottom:auto;left:0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{top:50%;right:auto;bottom:auto;left:50%;transform:translate(-50%,-50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{top:50%;right:0;bottom:auto;left:auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-left,body.swal2-toast-shown .swal2-container.swal2-bottom-start{top:auto;right:auto;bottom:0;left:0}body.swal2-toast-shown .swal2-container.swal2-bottom{top:auto;right:auto;bottom:0;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{top:auto;right:0;bottom:0;left:auto}body.swal2-toast-column .swal2-toast{flex-direction:column;align-items:stretch}body.swal2-toast-column .swal2-toast .swal2-actions{flex:1;align-self:stretch;height:2.2em;margin-top:.3125em}body.swal2-toast-column .swal2-toast .swal2-loading{justify-content:center}body.swal2-toast-column .swal2-toast .swal2-input{height:2em;margin:.3125em auto;font-size:1em}body.swal2-toast-column .swal2-toast .swal2-validation-message{font-size:1em}')},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(t,e){this.position=t,this.velocity=e};e.SimulationFrame=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.Local="local",t.Global="global"}(e.Space||(e.Space={}))},function(t,e,n){"use strict";n.r(e),n.d(e,"Detector",(function(){return i}));var i={canvas:!!window.CanvasRenderingContext2D,webgl:function(){try{var t=document.createElement("canvas");return!(!window.WebGLRenderingContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}catch(t){return!1}}(),workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob,getWebGLErrorMessage:function(){var t=document.createElement("div");return t.id="webgl-error-message",t.style.fontFamily="monospace",t.style.fontSize="13px",t.style.fontWeight="normal",t.style.textAlign="center",t.style.background="#fff",t.style.color="#000",t.style.padding="1.5em",t.style.width="400px",t.style.margin="5em auto 0",this.webgl||(t.innerHTML=window.WebGLRenderingContext?['Your graphics card does not seem to support WebGL.
    ','Find out how to get it here.'].join("\n"):['Your browser does not seem to support WebGL.
    ','Find out how to get it here.'].join("\n")),t},addGetWebGLMessage:function(t){var e,n,r;e=void 0!==(t=t||{}).parent?t.parent:document.body,n=void 0!==t.id?t.id:"oldie",(r=i.getWebGLErrorMessage()).id=n,e.appendChild(r)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(){}return t.setUserInterfaceVisible=function(t){document.getElementById("ui-container").style.display=t?"block":"none"},t.setLoadingScreenVisible=function(t){document.getElementById("loading-screen").style.display=t?"flex":"none"},t.setFPSVisible=function(t){document.getElementById("statsBox").style.display=t?"block":"none",document.getElementById("dat-gui-container").style.top=t?"48px":"0px"},t}();e.UIManager=i},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(3),s=n(5),c=n(9),l=n(11),u=n(17),h=n(2),p=n(21),d=function(t){function e(e,n,i){var r=t.call(this,e)||this;r.startPosition=new o.Vector3,r.endPosition=new o.Vector3,r.startRotation=new o.Quaternion,r.endRotation=new o.Quaternion,r.toSeat=i,r.canFindVehiclesToEnter=!1,r.canLeaveVehicles=!1,e.leaveSeat(),r.character.occupySeat(i);var a=h.getRight(n.seatPointObject,p.Space.Local),c=i.seatPointObject.position.clone().sub(n.seatPointObject.position).normalize(),l=a.dot(c)>0?s.Side.Left:s.Side.Right;return l===s.Side.Left?r.playAnimation("sitting_shift_left",.1):l===s.Side.Right&&r.playAnimation("sitting_shift_right",.1),r.startPosition.copy(n.seatPointObject.position),r.startPosition.y+=.6,r.endPosition.copy(i.seatPointObject.position),r.endPosition.y+=.6,r.startRotation.copy(n.seatPointObject.quaternion),r.endRotation.copy(i.seatPointObject.quaternion),r}return r(e,t),e.prototype.update=function(e){if(t.prototype.update.call(this,e),this.animationEnded(e))this.toSeat.type===c.SeatType.Driver?this.character.setState(new l.Driving(this.character,this.toSeat)):this.toSeat.type===c.SeatType.Passenger&&this.character.setState(new u.Sitting(this.character,this.toSeat));else{var n=this.timer/this.animationLength,i=h.easeInOutSine(n),r=(new o.Vector3).lerpVectors(this.startPosition,this.endPosition,i);this.character.setPosition(r.x,r.y,r.z),o.Quaternion.slerp(this.startRotation,this.endRotation,this.character.quaternion,i)}},e}(a.CharacterStateBase);e.SwitchingSeats=d},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=function(t){function e(e){var n=t.call(this,e)||this;return n.character.velocitySimulator.mass=1,n.character.velocitySimulator.damping=.6,n.character.setArcadeVelocityTarget(.8),n.playAnimation("drop_running_roll",.03),n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.character.setCameraRelativeOrientationTarget(),this.animationEnded(e)&&(this.anyDirection()?this.character.setState(new o.Walk(this.character)):this.character.setState(new o.EndWalk(this.character)))},e}(o.CharacterStateBase);e.DropRolling=a},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=n(5),s=n(11),c=n(9),l=n(17),u=n(2),h=function(t){function e(e,n){var i,r=t.call(this,e)||this;r.hasClosedDoor=!1,r.seat=n,r.canFindVehiclesToEnter=!1,r.canLeaveVehicles=!1;var o=u.detectRelativeSide(n.seatPointObject,n.door.doorObject);return o===a.Side.Left?r.playAnimation("close_door_sitting_left",.1):o===a.Side.Right&&r.playAnimation("close_door_sitting_right",.1),null===(i=r.seat.door)||void 0===i||i.open(),r}return r(e,t),e.prototype.update=function(e){var n;t.prototype.update.call(this,e),this.timer>.4&&!this.hasClosedDoor&&(this.hasClosedDoor=!0,null===(n=this.seat.door)||void 0===n||n.close()),this.animationEnded(e)&&(this.seat.type===c.SeatType.Driver?this.character.setState(new s.Driving(this.character,this.seat)):this.seat.type===c.SeatType.Passenger&&this.character.setState(new l.Sitting(this.character,this.seat)))},e}(o.CharacterStateBase);e.CloseVehicleDoorInside=h},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(1),s=n(6),c=n(2),l=n(7),u=n(79),h=n(81),p=n(8),d=n(28),f=n(82),m=n(84),v=n(11),g=n(85),y=n(14),w=n(86),x=n(87),_=n(9),b=n(88),S=n(89),M=n(10),E=function(t){function e(e){var n=t.call(this)||this;n.updateOrder=1,n.entityType=M.EntityType.Character,n.height=0,n.materials=[],n.acceleration=new o.Vector3,n.velocity=new o.Vector3,n.arcadeVelocityInfluence=new o.Vector3,n.velocityTarget=new o.Vector3,n.arcadeVelocityIsAdditive=!1,n.defaultVelocitySimulatorDamping=.8,n.defaultVelocitySimulatorMass=50,n.moveSpeed=4,n.angularVelocity=0,n.orientation=new o.Vector3(0,0,1),n.orientationTarget=new o.Vector3(0,0,1),n.defaultRotationSimulatorDamping=.5,n.defaultRotationSimulatorMass=10,n.rayResult=new a.RaycastResult,n.rayHasHit=!1,n.rayCastLength=.57,n.raySafeOffset=.03,n.wantsToJump=!1,n.initJumpSpeed=-1,n.groundImpactData=new b.GroundImpactData,n.occupyingSeat=null,n.vehicleEntryInstance=null,n.physicsEnabled=!0,n.readCharacterData(e),n.setAnimations(e.animations),n.tiltContainer=new o.Group,n.add(n.tiltContainer),n.modelContainer=new o.Group,n.modelContainer.position.y=-.57,n.tiltContainer.add(n.modelContainer),n.modelContainer.add(e.scene),n.mixer=new o.AnimationMixer(e.scene),n.velocitySimulator=new u.VectorSpringSimulator(60,n.defaultVelocitySimulatorMass,n.defaultVelocitySimulatorDamping),n.rotationSimulator=new h.RelativeSpringSimulator(60,n.defaultRotationSimulatorMass,n.defaultRotationSimulatorDamping),n.viewVector=new o.Vector3,n.actions={up:new l.KeyBinding("KeyW"),down:new l.KeyBinding("KeyS"),left:new l.KeyBinding("KeyA"),right:new l.KeyBinding("KeyD"),run:new l.KeyBinding("ShiftLeft"),jump:new l.KeyBinding("Space"),use:new l.KeyBinding("KeyE"),enter:new l.KeyBinding("KeyF"),enter_passenger:new l.KeyBinding("KeyG"),seat_switch:new l.KeyBinding("KeyX"),primary:new l.KeyBinding("Mouse0"),secondary:new l.KeyBinding("Mouse1")},n.characterCapsule=new w.CapsuleCollider({mass:1,position:new a.Vec3,height:.5,radius:.25,segments:8,friction:0}),n.characterCapsule.body.shapes.forEach((function(t){t.collisionFilterMask=~y.CollisionGroups.TrimeshColliders})),n.characterCapsule.body.allowSleep=!1,n.characterCapsule.body.collisionFilterGroup=2,n.characterCapsule.body.fixedRotation=!0,n.characterCapsule.body.updateMassProperties();var i=new o.BoxGeometry(.1,.1,.1),r=new o.MeshLambertMaterial({color:16711680});return n.raycastBox=new o.Mesh(i,r),n.raycastBox.visible=!1,n.characterCapsule.body.preStep=function(t){n.physicsPreStep(t,n)},n.characterCapsule.body.postStep=function(t){n.physicsPostStep(t,n)},n.setState(new p.Idle(n)),n}return r(e,t),e.prototype.setAnimations=function(t){this.animations=t},e.prototype.setArcadeVelocityInfluence=function(t,e,n){void 0===e&&(e=t),void 0===n&&(n=t),this.arcadeVelocityInfluence.set(t,e,n)},e.prototype.setViewVector=function(t){this.viewVector.copy(t).normalize()},e.prototype.setState=function(t){this.charState=t,this.charState.onInputChange()},e.prototype.setPosition=function(t,e,n){this.physicsEnabled?(this.characterCapsule.body.previousPosition=new a.Vec3(t,e,n),this.characterCapsule.body.position=new a.Vec3(t,e,n),this.characterCapsule.body.interpolatedPosition=new a.Vec3(t,e,n)):(this.position.x=t,this.position.y=e,this.position.z=n)},e.prototype.resetVelocity=function(){this.velocity.x=0,this.velocity.y=0,this.velocity.z=0,this.characterCapsule.body.velocity.x=0,this.characterCapsule.body.velocity.y=0,this.characterCapsule.body.velocity.z=0,this.velocitySimulator.init()},e.prototype.setArcadeVelocityTarget=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=0),this.velocityTarget.z=t,this.velocityTarget.x=e,this.velocityTarget.y=n},e.prototype.setOrientation=function(t,e){void 0===e&&(e=!1);var n=(new o.Vector3).copy(t).setY(0).normalize();this.orientationTarget.copy(n),e&&this.orientation.copy(n)},e.prototype.resetOrientation=function(){var t=c.getForward(this);this.setOrientation(t,!0)},e.prototype.setBehaviour=function(t){t.character=this,this.behaviour=t},e.prototype.setPhysicsEnabled=function(t){this.physicsEnabled=t,!0===t?this.world.physicsWorld.addBody(this.characterCapsule.body):this.world.physicsWorld.remove(this.characterCapsule.body)},e.prototype.readCharacterData=function(t){var e=this;t.scene.traverse((function(t){t.isMesh&&(c.setupMeshProperties(t),void 0!==t.material&&e.materials.push(t.material))}))},e.prototype.handleKeyboardEvent=function(t,e,n){if(void 0!==this.controlledObject)this.controlledObject.handleKeyboardEvent(t,e,n);else if("KeyC"===e&&!0===n&&!0===t.shiftKey)this.resetControls(),this.world.cameraOperator.characterCaller=this,this.world.inputManager.setInputReceiver(this.world.cameraOperator);else if("KeyR"===e&&!0===n&&!0===t.shiftKey)this.world.restartScenario();else for(var i in this.actions)if(this.actions.hasOwnProperty(i)){var r=this.actions[i];s.includes(r.eventCodes,e)&&this.triggerAction(i,n)}},e.prototype.handleMouseButton=function(t,e,n){if(void 0!==this.controlledObject)this.controlledObject.handleMouseButton(t,e,n);else for(var i in this.actions)if(this.actions.hasOwnProperty(i)){var r=this.actions[i];s.includes(r.eventCodes,e)&&this.triggerAction(i,n)}},e.prototype.handleMouseMove=function(t,e,n){void 0!==this.controlledObject?this.controlledObject.handleMouseMove(t,e,n):this.world.cameraOperator.move(e,n)},e.prototype.handleMouseWheel=function(t,e){void 0!==this.controlledObject?this.controlledObject.handleMouseWheel(t,e):this.world.scrollTheTimeScale(e)},e.prototype.triggerAction=function(t,e){var n=this.actions[t];n.isPressed!==e&&(n.isPressed=e,n.justPressed=!1,n.justReleased=!1,e?n.justPressed=!0:n.justReleased=!0,this.charState.onInputChange(),n.justPressed=!1,n.justReleased=!1)},e.prototype.takeControl=function(){void 0!==this.world?this.world.inputManager.setInputReceiver(this):console.warn("Attempting to take control of a character that doesn't belong to a world.")},e.prototype.resetControls=function(){for(var t in this.actions)this.actions.hasOwnProperty(t)&&this.triggerAction(t,!1)},e.prototype.update=function(t){var e,n,i;if(null===(e=this.behaviour)||void 0===e||e.update(t),null===(n=this.vehicleEntryInstance)||void 0===n||n.update(t),null===(i=this.charState)||void 0===i||i.update(t),this.physicsEnabled&&this.springMovement(t),this.physicsEnabled&&this.springRotation(t),this.physicsEnabled&&this.rotateModel(),void 0!==this.mixer&&this.mixer.update(t),this.physicsEnabled)this.position.set(this.characterCapsule.body.interpolatedPosition.x,this.characterCapsule.body.interpolatedPosition.y,this.characterCapsule.body.interpolatedPosition.z);else{var r=new o.Vector3;this.getWorldPosition(r),this.characterCapsule.body.position.copy(c.cannonVector(r)),this.characterCapsule.body.interpolatedPosition.copy(c.cannonVector(r))}this.updateMatrixWorld()},e.prototype.inputReceiverInit=function(){void 0===this.controlledObject?(this.world.cameraOperator.setRadius(1.6,!0),this.world.cameraOperator.followMode=!1,this.displayControls()):this.controlledObject.inputReceiverInit()},e.prototype.displayControls=function(){this.world.updateControls([{keys:["W","A","S","D"],desc:"Movement"},{keys:["Shift"],desc:"Sprint"},{keys:["Space"],desc:"Jump"},{keys:["F","or","G"],desc:"Enter vehicle"},{keys:["Shift","+","R"],desc:"Respawn"},{keys:["Shift","+","C"],desc:"Free camera"}])},e.prototype.inputReceiverUpdate=function(t){void 0!==this.controlledObject?this.controlledObject.inputReceiverUpdate(t):(this.viewVector=(new o.Vector3).subVectors(this.position,this.world.camera.position),this.getWorldPosition(this.world.cameraOperator.target))},e.prototype.setAnimation=function(t,e){if(void 0!==this.mixer){var n=o.AnimationClip.findByName(this.animations,t),i=this.mixer.clipAction(n);return null===i?(console.error("Animation "+t+" not found!"),0):(this.mixer.stopAllAction(),i.fadeIn(e),i.play(),i.getClip().duration)}},e.prototype.springMovement=function(t){this.velocitySimulator.target.copy(this.velocityTarget),this.velocitySimulator.simulate(t),this.velocity.copy(this.velocitySimulator.position),this.acceleration.copy(this.velocitySimulator.velocity)},e.prototype.springRotation=function(t){var e=c.getSignedAngleBetweenVectors(this.orientation,this.orientationTarget);this.rotationSimulator.target=e,this.rotationSimulator.simulate(t);var n=this.rotationSimulator.position;this.orientation.applyAxisAngle(new o.Vector3(0,1,0),n),this.angularVelocity=this.rotationSimulator.velocity},e.prototype.getLocalMovementDirection=function(){var t=this.actions.right.isPressed?-1:0,e=this.actions.left.isPressed?1:0,n=this.actions.up.isPressed?1:0,i=this.actions.down.isPressed?-1:0;return new o.Vector3(t+e,0,n+i).normalize()},e.prototype.getCameraRelativeMovementVector=function(){var t=this.getLocalMovementDirection(),e=new o.Vector3(this.viewVector.x,0,this.viewVector.z).normalize();return c.appplyVectorMatrixXZ(e,t)},e.prototype.setCameraRelativeOrientationTarget=function(){if(null===this.vehicleEntryInstance){var t=this.getCameraRelativeMovementVector();0===t.x&&0===t.y&&0===t.z?this.setOrientation(this.orientation):this.setOrientation(t)}},e.prototype.rotateModel=function(){this.lookAt(this.position.x+this.orientation.x,this.position.y+this.orientation.y,this.position.z+this.orientation.z),this.tiltContainer.rotation.z=2.3*-this.angularVelocity*this.velocity.length(),this.tiltContainer.position.setY(Math.cos(Math.abs(2.3*this.angularVelocity*this.velocity.length()))/2-.5)},e.prototype.jump=function(t){void 0===t&&(t=-1),this.wantsToJump=!0,this.initJumpSpeed=t},e.prototype.findVehicleToEnter=function(t){var e=new o.Vector3,n=new S.ClosestObjectFinder(this.position,10);if(this.world.vehicles.forEach((function(t){n.consider(t,t.position)})),void 0!==n.closestObject){var i=n.closestObject,r=new x.VehicleEntryInstance(this);r.wantsToDrive=t;for(var a=new S.ClosestObjectFinder(this.position),s=0,c=i.seats;s0){var u=new a.Vec3;e.rayResult.body.getVelocityAtWorldPoint(e.rayResult.hitPointWorld,u),r.add(c.threeVector(u))}var h=new o.Vector3(0,1,0),p=new o.Vector3(e.rayResult.hitNormalWorld.x,e.rayResult.hitNormalWorld.y,e.rayResult.hitNormalWorld.z),d=(new o.Quaternion).setFromUnitVectors(h,p),f=(new o.Matrix4).makeRotationFromQuaternion(d);r.applyMatrix4(f),t.velocity.x=r.x,t.velocity.y=r.y,t.velocity.z=r.z,t.position.y=e.rayResult.hitPointWorld.y+e.rayCastLength+r.y/e.world.physicsFrameRate}else t.velocity.x=r.x,t.velocity.y=r.y,t.velocity.z=r.z,e.groundImpactData.velocity.x=t.velocity.x,e.groundImpactData.velocity.y=t.velocity.y,e.groundImpactData.velocity.z=t.velocity.z;if(e.wantsToJump){if(e.initJumpSpeed>-1){t.velocity.y=0;var m=Math.max(4*e.velocitySimulator.position.length(),e.initJumpSpeed);t.velocity=c.cannonVector(e.orientation.clone().multiplyScalar(m))}else{l=new a.Vec3;e.rayResult.body.getVelocityAtWorldPoint(e.rayResult.hitPointWorld,l),t.velocity.vsub(l,t.velocity)}t.velocity.y+=4,t.position.y+=2*e.raySafeOffset,e.wantsToJump=!1}},e.prototype.addToWorld=function(t){s.includes(t.characters,this)?console.warn("Adding character to a world in which it already exists."):(this.world=t,t.characters.push(this),t.physicsWorld.addBody(this.characterCapsule.body),t.graphicsWorld.add(this),t.graphicsWorld.add(this.raycastBox),this.materials.forEach((function(e){t.sky.csm.setupMaterial(e)})))},e.prototype.removeFromWorld=function(t){s.includes(t.characters,this)?(t.inputManager.inputReceiver===this&&(t.inputManager.inputReceiver=void 0),this.world=void 0,s.pull(t.characters,this),t.physicsWorld.remove(this.characterCapsule.body),t.graphicsWorld.remove(this),t.graphicsWorld.remove(this.raycastBox)):console.warn("Removing character from a world in which it isn't present.")},e}(o.Object3D);e.Character=E},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(3),s=n(11),c=n(5),l=n(17),u=n(9),h=n(10),p=n(2),d=n(12),f=function(t){function e(e,n,i){var r=t.call(this,e)||this;r.initialPositionOffset=new o.Vector3,r.startPosition=new o.Vector3,r.endPosition=new o.Vector3,r.startRotation=new o.Quaternion,r.endRotation=new o.Quaternion,r.canFindVehiclesToEnter=!1,r.vehicle=n.vehicle,r.seat=n;var a=p.detectRelativeSide(i,n.seatPointObject);return r.animData=r.getEntryAnimations(n.vehicle.entityType),r.playAnimation(r.animData[a],.1),r.character.resetVelocity(),r.character.tiltContainer.rotation.z=0,r.character.setPhysicsEnabled(!1),r.seat.vehicle.attach(r.character),r.startPosition.copy(i.position),r.startPosition.y+=.53,r.endPosition.copy(n.seatPointObject.position),r.endPosition.y+=.6,r.initialPositionOffset.copy(r.startPosition).sub(r.character.position),r.startRotation.copy(r.character.quaternion),r.endRotation.copy(r.seat.seatPointObject.quaternion),r.factorSimulator=new d.SpringSimulator(60,10,.5),r.factorSimulator.target=1,r}return r(e,t),e.prototype.update=function(e){if(t.prototype.update.call(this,e),this.animationEnded(e))this.character.occupySeat(this.seat),this.character.setPosition(this.endPosition.x,this.endPosition.y,this.endPosition.z),this.seat.type===u.SeatType.Driver?(this.seat.door&&(this.seat.door.physicsEnabled=!0),this.character.setState(new s.Driving(this.character,this.seat))):this.seat.type===u.SeatType.Passenger&&this.character.setState(new l.Sitting(this.character,this.seat));else{this.seat.door&&(this.seat.door.physicsEnabled=!1,this.seat.door.rotation=1);var n=o.MathUtils.clamp(this.timer/(this.animationLength-this.animData.end_early),0,1),i=p.easeInOutSine(n);this.factorSimulator.simulate(e);var r=(new o.Vector3).lerpVectors(this.initialPositionOffset,new o.Vector3,this.factorSimulator.position),a=(new o.Vector3).lerpVectors(this.startPosition.clone().sub(r),this.endPosition,i);this.character.setPosition(a.x,a.y,a.z),o.Quaternion.slerp(this.startRotation,this.endRotation,this.character.quaternion,this.factorSimulator.position)}},e.prototype.getEntryAnimations=function(t){var e,n;switch(t){case h.EntityType.Airplane:return(e={})[c.Side.Left]="enter_airplane_left",e[c.Side.Right]="enter_airplane_right",e.end_early=.3,e;default:return(n={})[c.Side.Left]="sit_down_left",n[c.Side.Right]="sit_down_right",n.end_early=0,n}},e}(a.CharacterStateBase);e.EnteringVehicle=f},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(2),s=function(t){function e(e,n){var i,r=t.call(this,e)||this;return r.startPosition=new o.Vector3,r.endPosition=new o.Vector3,r.startRotation=new o.Quaternion,r.endRotation=new o.Quaternion,r.canFindVehiclesToEnter=!1,r.seat=n,r.vehicle=n.vehicle,null===(i=r.seat.door)||void 0===i||i.open(),r.startPosition.copy(r.character.position),r.startRotation.copy(r.character.quaternion),r.dummyObj=new o.Object3D,r}return r(e,t),e.prototype.detachCharacterFromVehicle=function(){this.character.controlledObject=void 0,this.character.resetOrientation(),this.character.world.graphicsWorld.attach(this.character),this.character.resetVelocity(),this.character.setPhysicsEnabled(!0),this.character.setPosition(this.character.position.x,this.character.position.y,this.character.position.z),this.character.inputReceiverUpdate(0),this.character.characterCapsule.body.velocity.copy(this.vehicle.rayCastVehicle.chassisBody.velocity),this.character.feetRaycast()},e.prototype.updateEndRotation=function(){var t=a.getForward(this.exitPoint);t.y=0,t.normalize(),this.character.world.graphicsWorld.attach(this.dummyObj),this.exitPoint.getWorldPosition(this.dummyObj.position);var e=this.dummyObj.position.clone().add(t);this.dummyObj.lookAt(e),this.seat.seatPointObject.parent.attach(this.dummyObj),this.endRotation.copy(this.dummyObj.quaternion)},e}(n(3).CharacterStateBase);e.ExitingStateBase=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n(31);var i=n(32);e.World=i.World},function(t,e,n){},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=n(1),o=n(19),a=n(33),s=n(95),c=n(36),l=n(13),u=n(37),h=n(22),p=n(38),d=n(39),f=n(6),m=n(40),v=n(41),g=n(2),y=n(44),w=n(47),x=n(14),_=n(49),b=n(52),S=n(53),M=n(54),E=n(55),A=n(23),T=n(93),P=function(){function t(t){var e=this;this.timeScaleTarget=1,this.scenarios=[],this.characters=[],this.vehicles=[],this.paths=[],this.updatables=[];var n=this;h.Detector.webgl||o.default.fire({icon:"warning",title:"WebGL compatibility",text:"This browser doesn't seem to have the required WebGL capabilities. The application may not work correctly.",footer:'Click here for more information',showConfirmButton:!1,buttonsStyling:!1}),this.renderer=new i.WebGLRenderer,this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(window.innerWidth,window.innerHeight),this.renderer.toneMapping=i.ACESFilmicToneMapping,this.renderer.toneMappingExposure=1,this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=i.PCFSoftShadowMap,document.body.appendChild(this.renderer.domElement),this.renderer.domElement.id="canvas",window.addEventListener("resize",(function(){n.camera.aspect=window.innerWidth/window.innerHeight,n.camera.updateProjectionMatrix(),n.renderer.setSize(window.innerWidth,window.innerHeight),f.uniforms.resolution.value.set(1/(window.innerWidth*g),1/(window.innerHeight*g)),n.composer.setSize(window.innerWidth*g,window.innerHeight*g)}),!1),this.graphicsWorld=new i.Scene,this.camera=new i.PerspectiveCamera(80,window.innerWidth/window.innerHeight,.1,1010);var d=new c.RenderPass(this.graphicsWorld,this.camera),f=new l.ShaderPass(u.FXAAShader),g=this.renderer.getPixelRatio();if(f.material.uniforms.resolution.value.x=1/(window.innerWidth*g),f.material.uniforms.resolution.value.y=1/(window.innerHeight*g),this.composer=new s.EffectComposer(this.renderer),this.composer.addPass(d),this.composer.addPass(f),this.physicsWorld=new r.World,this.physicsWorld.gravity.set(0,-9.81,0),this.physicsWorld.broadphase=new r.SAPBroadphase(this.physicsWorld),this.physicsWorld.solver.iterations=10,this.physicsWorld.allowSleep=!0,this.parallelPairs=[],this.physicsFrameRate=60,this.physicsFrameTime=1/this.physicsFrameRate,this.physicsMaxPrediction=this.physicsFrameRate,this.clock=new i.Clock,this.renderDelta=0,this.logicDelta=0,this.sinceLastFrame=0,this.justRendered=!1,this.stats=p.Stats(),this.createParamsGUI(n),this.inputManager=new m.InputManager(this,this.renderer.domElement),this.cameraOperator=new a.CameraOperator(this,this.camera,this.params.Mouse_Sensitivity),this.sky=new v.Sky(this),void 0!==t){var y=new _.LoadingManager(this);y.onFinishedCallback=function(){e.update(1,1),e.setTimeScale(1),o.default.fire({title:"Welcome to Sketchbook!",text:"Feel free to explore the world and interact with available vehicles. There are also various scenarios ready to launch from the right panel.",footer:'GitHub pageDiscord server',confirmButtonText:"Okay",buttonsStyling:!1,onClose:function(){A.UIManager.setUserInterfaceVisible(!0)}})},y.loadGLTF(t,(function(t){e.loadScene(y,t)}))}else A.UIManager.setUserInterfaceVisible(!0),A.UIManager.setLoadingScreenVisible(!1),o.default.fire({icon:"success",title:"Hello world!",text:"Empty Sketchbook world was succesfully initialized. Enjoy the blueness of the sky.",buttonsStyling:!1});this.render(this)}return t.prototype.update=function(t,e){this.updatePhysics(t),this.updatables.forEach((function(n){n.update(t,e)})),this.params.Time_Scale=i.MathUtils.lerp(this.params.Time_Scale,this.timeScaleTarget,.2),this.params.Debug_Physics&&this.cannonDebugRenderer.update()},t.prototype.updatePhysics=function(t){var e=this;this.physicsWorld.step(this.physicsFrameTime,t),this.characters.forEach((function(t){e.isOutOfBounds(t.characterCapsule.body.position)&&e.outOfBoundsRespawn(t.characterCapsule.body)})),this.vehicles.forEach((function(t){if(e.isOutOfBounds(t.rayCastVehicle.chassisBody.position)){var n=new i.Vector3;t.spawnPoint.getWorldPosition(n),n.y+=1,e.outOfBoundsRespawn(t.rayCastVehicle.chassisBody,g.cannonVector(n))}}))},t.prototype.isOutOfBounds=function(t){var e=t.x>-211.882&&t.x<211.882&&t.z>-169.098&&t.z<153.232&&t.y>.107,n=t.y<14.989;return!e&&n},t.prototype.outOfBoundsRespawn=function(t,e){var n=e||new r.Vec3(0,16,0),i=new r.Quaternion(0,0,0,1);t.position.copy(n),t.interpolatedPosition.copy(n),t.quaternion.copy(i),t.interpolatedQuaternion.copy(i),t.velocity.setZero(),t.angularVelocity.setZero()},t.prototype.render=function(t){this.requestDelta=this.clock.getDelta(),requestAnimationFrame((function(){t.render(t)}));var e=this.requestDelta+this.renderDelta+this.logicDelta,n=e*this.params.Time_Scale;n=Math.min(n,1/30),t.update(n,e),this.logicDelta=this.clock.getDelta();this.sinceLastFrame+=this.requestDelta+this.renderDelta+this.logicDelta,this.sinceLastFrame%=1/60,this.stats.end(),this.stats.begin(),this.params.FXAA?this.composer.render():this.renderer.render(this.graphicsWorld,this.camera),this.renderDelta=this.clock.getDelta()},t.prototype.setTimeScale=function(t){this.params.Time_Scale=t,this.timeScaleTarget=t},t.prototype.add=function(t){t.addToWorld(this),this.registerUpdatable(t)},t.prototype.registerUpdatable=function(t){this.updatables.push(t),this.updatables.sort((function(t,e){return t.updateOrder>e.updateOrder?1:-1}))},t.prototype.remove=function(t){t.removeFromWorld(this),this.unregisterUpdatable(t)},t.prototype.unregisterUpdatable=function(t){f.pull(this.updatables,t)},t.prototype.loadScene=function(t,e){var n,r=this;e.scene.traverse((function(t){if(t.hasOwnProperty("userData")&&("Mesh"===t.type&&(g.setupMeshProperties(t),r.sky.csm.setupMaterial(t.material),"grass"===t.material.name&&r.registerUpdatable(new y.Grass(t,r)),"ocean"===t.material.name&&r.registerUpdatable(new T.Ocean(t,r))),t.userData.hasOwnProperty("data"))){if("physics"===t.userData.data&&t.userData.hasOwnProperty("type")){if("box"===t.userData.type)(e=new b.BoxCollider({size:new i.Vector3(t.scale.x,t.scale.y,t.scale.z)})).body.position.copy(g.cannonVector(t.position)),e.body.quaternion.copy(g.cannonQuat(t.quaternion)),e.body.computeAABB(),e.body.shapes.forEach((function(t){t.collisionFilterMask=~x.CollisionGroups.TrimeshColliders})),r.physicsWorld.addBody(e.body);else if("trimesh"===t.userData.type){var e=new S.TrimeshCollider(t,{});r.physicsWorld.addBody(e.body)}t.visible=!1}"path"===t.userData.data&&r.paths.push(new w.Path(t)),"scenario"===t.userData.data&&r.scenarios.push(new E.Scenario(t,r))}})),this.graphicsWorld.add(e.scene);for(var o=0,a=this.scenarios;o0?(this.timeScaleTarget/=1.3,this.timeScaleTarget<.003&&(this.timeScaleTarget=0)):(this.timeScaleTarget*=1.3,this.timeScaleTarget<.003&&(this.timeScaleTarget=.003),this.timeScaleTarget=Math.min(this.timeScaleTarget,1))},t.prototype.updateControls=function(t){var e="";e+='

    Controls:

    ',t.forEach((function(t){e+='
    ',t.keys.forEach((function(t){e+="+"===t||"and"===t||"or"===t||"&"===t?" "+t+" ":''+t+""})),e+=''+t.desc+"
    "})),document.getElementById("controls").innerHTML=e},t.prototype.createParamsGUI=function(t){var e=this;this.params={Pointer_Lock:!0,Mouse_Sensitivity:.3,Time_Scale:1,Shadows:!0,FXAA:!0,Debug_Physics:!1,Debug_FPS:!1,Sun_Elevation:60,Sun_Rotation:225};var n=new d.GUI;this.scenarioGUIFolder=n.addFolder("Scenarios"),this.scenarioGUIFolder.open();var i=n.addFolder("World");i.add(this.params,"Time_Scale",0,1).listen().onChange((function(e){t.timeScaleTarget=e})),i.add(this.params,"Sun_Elevation",0,180).listen().onChange((function(e){t.sky.phi=e})),i.add(this.params,"Sun_Rotation",0,360).listen().onChange((function(e){t.sky.theta=e}));var r=n.addFolder("Settings");r.add(this.params,"FXAA"),r.add(this.params,"Shadows").onChange((function(t){t?e.sky.csm.lights.forEach((function(t){t.castShadow=!0})):e.sky.csm.lights.forEach((function(t){t.castShadow=!1}))})),r.add(this.params,"Pointer_Lock").onChange((function(e){t.inputManager.setPointerLock(e)})),r.add(this.params,"Mouse_Sensitivity",0,1).onChange((function(e){t.cameraOperator.setSensitivity(e,.8*e)})),r.add(this.params,"Debug_Physics").onChange((function(n){n?e.cannonDebugRenderer=new M.CannonDebugRenderer(e.graphicsWorld,e.physicsWorld):(e.cannonDebugRenderer.clearMeshes(),e.cannonDebugRenderer=void 0),t.characters.forEach((function(t){t.raycastBox.visible=n}))})),r.add(this.params,"Debug_FPS").onChange((function(t){A.UIManager.setFPSVisible(t)})),n.open()},t}();e.World=P},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=n(2),o=n(7),a=n(6),s=function(){function t(t,e,n,r){void 0===n&&(n=1),void 0===r&&(r=.8*n),this.updateOrder=4,this.radius=1,this.targetRadius=1,this.upVelocity=0,this.forwardVelocity=0,this.rightVelocity=0,this.followMode=!1,this.world=t,this.camera=e,this.target=new i.Vector3,this.sensitivity=new i.Vector2(n,r),this.movementSpeed=.06,this.radius=3,this.theta=0,this.phi=0,this.onMouseDownPosition=new i.Vector2,this.onMouseDownTheta=this.theta,this.onMouseDownPhi=this.phi,this.actions={forward:new o.KeyBinding("KeyW"),back:new o.KeyBinding("KeyS"),left:new o.KeyBinding("KeyA"),right:new o.KeyBinding("KeyD"),up:new o.KeyBinding("KeyE"),down:new o.KeyBinding("KeyQ"),fast:new o.KeyBinding("ShiftLeft")},t.registerUpdatable(this)}return t.prototype.setSensitivity=function(t,e){void 0===e&&(e=t),this.sensitivity=new i.Vector2(t,e)},t.prototype.setRadius=function(t,e){void 0===e&&(e=!1),this.targetRadius=Math.max(.001,t),!0===e&&(this.radius=t)},t.prototype.move=function(t,e){this.theta-=t*(this.sensitivity.x/2),this.theta%=360,this.phi+=e*(this.sensitivity.y/2),this.phi=Math.min(85,Math.max(-85,this.phi))},t.prototype.update=function(t){if(!0===this.followMode){this.camera.position.y=i.MathUtils.clamp(this.camera.position.y,this.target.y,Number.POSITIVE_INFINITY),this.camera.lookAt(this.target);var e=this.target.clone().add((new i.Vector3).subVectors(this.camera.position,this.target).normalize().multiplyScalar(this.targetRadius));this.camera.position.x=e.x,this.camera.position.y=e.y,this.camera.position.z=e.z}else this.radius=i.MathUtils.lerp(this.radius,this.targetRadius,.1),this.camera.position.x=this.target.x+this.radius*Math.sin(this.theta*Math.PI/180)*Math.cos(this.phi*Math.PI/180),this.camera.position.y=this.target.y+this.radius*Math.sin(this.phi*Math.PI/180),this.camera.position.z=this.target.z+this.radius*Math.cos(this.theta*Math.PI/180)*Math.cos(this.phi*Math.PI/180),this.camera.updateMatrix(),this.camera.lookAt(this.target)},t.prototype.handleKeyboardEvent=function(t,e,n){if("KeyC"===e&&!0===n&&!0===t.shiftKey)void 0!==this.characterCaller&&(this.world.inputManager.setInputReceiver(this.characterCaller),this.characterCaller=void 0);else for(var i in this.actions)if(this.actions.hasOwnProperty(i)){var r=this.actions[i];a.includes(r.eventCodes,e)&&(r.isPressed=n)}},t.prototype.handleMouseWheel=function(t,e){this.world.scrollTheTimeScale(e)},t.prototype.handleMouseButton=function(t,e,n){for(var i in this.actions)if(this.actions.hasOwnProperty(i)){var r=this.actions[i];a.includes(r.eventCodes,e)&&(r.isPressed=n)}},t.prototype.handleMouseMove=function(t,e,n){this.move(e,n)},t.prototype.inputReceiverInit=function(){this.target.copy(this.camera.position),this.setRadius(0,!0),this.world.updateControls([{keys:["W","S","A","D"],desc:"Move around"},{keys:["E","Q"],desc:"Move up / down"},{keys:["Shift"],desc:"Speed up"},{keys:["Shift","+","C"],desc:"Exit free camera mode"}])},t.prototype.inputReceiverUpdate=function(t){var e=this.movementSpeed*(this.actions.fast.isPressed?600*t:60*t),n=r.getUp(this.camera),o=r.getRight(this.camera),a=r.getBack(this.camera);this.upVelocity=i.MathUtils.lerp(this.upVelocity,+this.actions.up.isPressed-+this.actions.down.isPressed,.3),this.forwardVelocity=i.MathUtils.lerp(this.forwardVelocity,+this.actions.forward.isPressed-+this.actions.back.isPressed,.3),this.rightVelocity=i.MathUtils.lerp(this.rightVelocity,+this.actions.right.isPressed-+this.actions.left.isPressed,.3),this.target.add(n.multiplyScalar(e*this.upVelocity)),this.target.add(a.multiplyScalar(e*this.forwardVelocity)),this.target.add(o.multiplyScalar(e*this.rightVelocity))},t}();e.CameraOperator=s},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){"use strict";n.r(e),n.d(e,"RenderPass",(function(){return r}));var i=n(4),r=function(t,e,n,r,o){i.a.call(this),this.scene=t,this.camera=e,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=void 0!==o?o:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1};r.prototype=Object.assign(Object.create(i.a.prototype),{constructor:r,render:function(t,e,n){var i,r,o=t.autoClear;t.autoClear=!1,this.scene.overrideMaterial=this.overrideMaterial,this.clearColor&&(i=t.getClearColor().getHex(),r=t.getClearAlpha(),t.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&t.clearDepth(),t.setRenderTarget(this.renderToScreen?null:n),this.clear&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),t.render(this.scene,this.camera),this.clearColor&&t.setClearColor(i,r),this.scene.overrideMaterial=null,t.autoClear=o}})},function(t,e,n){"use strict";n.r(e),n.d(e,"FXAAShader",(function(){return i}));var i={uniforms:{tDiffuse:{value:null},resolution:{value:new(n(0).Vector2)(1/1024,1/512)}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["precision highp float;","","uniform sampler2D tDiffuse;","","uniform vec2 resolution;","","varying vec2 vUv;","","// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)","","//----------------------------------------------------------------------------------","// File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag","// SDK Version: v3.00","// Email: gameworks@nvidia.com","// Site: http://developer.nvidia.com/","//","// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.","//","// Redistribution and use in source and binary forms, with or without","// modification, are permitted provided that the following conditions","// are met:","// * Redistributions of source code must retain the above copyright","// notice, this list of conditions and the following disclaimer.","// * Redistributions in binary form must reproduce the above copyright","// notice, this list of conditions and the following disclaimer in the","// documentation and/or other materials provided with the distribution.","// * Neither the name of NVIDIA CORPORATION nor the names of its","// contributors may be used to endorse or promote products derived","// from this software without specific prior written permission.","//","// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY","// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE","// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR","// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR","// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,","// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,","// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR","// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY","// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT","// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE","// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.","//","//----------------------------------------------------------------------------------","","#define FXAA_PC 1","#define FXAA_GLSL_100 1","#define FXAA_QUALITY_PRESET 12","","#define FXAA_GREEN_AS_LUMA 1","","/*--------------------------------------------------------------------------*/","#ifndef FXAA_PC_CONSOLE"," //"," // The console algorithm for PC is included"," // for developers targeting really low spec machines."," // Likely better to just run FXAA_PC, and use a really low preset."," //"," #define FXAA_PC_CONSOLE 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_GLSL_120"," #define FXAA_GLSL_120 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_GLSL_130"," #define FXAA_GLSL_130 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_HLSL_3"," #define FXAA_HLSL_3 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_HLSL_4"," #define FXAA_HLSL_4 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_HLSL_5"," #define FXAA_HLSL_5 0","#endif","/*==========================================================================*/","#ifndef FXAA_GREEN_AS_LUMA"," //"," // For those using non-linear color,"," // and either not able to get luma in alpha, or not wanting to,"," // this enables FXAA to run using green as a proxy for luma."," // So with this enabled, no need to pack luma in alpha."," //"," // This will turn off AA on anything which lacks some amount of green."," // Pure red and blue or combination of only R and B, will get no AA."," //"," // Might want to lower the settings for both,"," // fxaaConsoleEdgeThresholdMin"," // fxaaQualityEdgeThresholdMin"," // In order to insure AA does not get turned off on colors"," // which contain a minor amount of green."," //"," // 1 = On."," // 0 = Off."," //"," #define FXAA_GREEN_AS_LUMA 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_EARLY_EXIT"," //"," // Controls algorithm's early exit path."," // On PS3 turning this ON adds 2 cycles to the shader."," // On 360 turning this OFF adds 10ths of a millisecond to the shader."," // Turning this off on console will result in a more blurry image."," // So this defaults to on."," //"," // 1 = On."," // 0 = Off."," //"," #define FXAA_EARLY_EXIT 1","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_DISCARD"," //"," // Only valid for PC OpenGL currently."," // Probably will not work when FXAA_GREEN_AS_LUMA = 1."," //"," // 1 = Use discard on pixels which don't need AA."," // For APIs which enable concurrent TEX+ROP from same surface."," // 0 = Return unchanged color on pixels which don't need AA."," //"," #define FXAA_DISCARD 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_FAST_PIXEL_OFFSET"," //"," // Used for GLSL 120 only."," //"," // 1 = GL API supports fast pixel offsets"," // 0 = do not use fast pixel offsets"," //"," #ifdef GL_EXT_gpu_shader4"," #define FXAA_FAST_PIXEL_OFFSET 1"," #endif"," #ifdef GL_NV_gpu_shader5"," #define FXAA_FAST_PIXEL_OFFSET 1"," #endif"," #ifdef GL_ARB_gpu_shader5"," #define FXAA_FAST_PIXEL_OFFSET 1"," #endif"," #ifndef FXAA_FAST_PIXEL_OFFSET"," #define FXAA_FAST_PIXEL_OFFSET 0"," #endif","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_GATHER4_ALPHA"," //"," // 1 = API supports gather4 on alpha channel."," // 0 = API does not support gather4 on alpha channel."," //"," #if (FXAA_HLSL_5 == 1)"," #define FXAA_GATHER4_ALPHA 1"," #endif"," #ifdef GL_ARB_gpu_shader5"," #define FXAA_GATHER4_ALPHA 1"," #endif"," #ifdef GL_NV_gpu_shader5"," #define FXAA_GATHER4_ALPHA 1"," #endif"," #ifndef FXAA_GATHER4_ALPHA"," #define FXAA_GATHER4_ALPHA 0"," #endif","#endif","","","/*============================================================================"," FXAA QUALITY - TUNING KNOBS","------------------------------------------------------------------------------","NOTE the other tuning knobs are now in the shader function inputs!","============================================================================*/","#ifndef FXAA_QUALITY_PRESET"," //"," // Choose the quality preset."," // This needs to be compiled into the shader as it effects code."," // Best option to include multiple presets is to"," // in each shader define the preset, then include this file."," //"," // OPTIONS"," // -----------------------------------------------------------------------"," // 10 to 15 - default medium dither (10=fastest, 15=highest quality)"," // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)"," // 39 - no dither, very expensive"," //"," // NOTES"," // -----------------------------------------------------------------------"," // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)"," // 13 = about same speed as FXAA 3.9 and better than 12"," // 23 = closest to FXAA 3.9 visually and performance wise"," // _ = the lowest digit is directly related to performance"," // _ = the highest digit is directly related to style"," //"," #define FXAA_QUALITY_PRESET 12","#endif","","","/*============================================================================",""," FXAA QUALITY - PRESETS","","============================================================================*/","","/*============================================================================"," FXAA QUALITY - MEDIUM DITHER PRESETS","============================================================================*/","#if (FXAA_QUALITY_PRESET == 10)"," #define FXAA_QUALITY_PS 3"," #define FXAA_QUALITY_P0 1.5"," #define FXAA_QUALITY_P1 3.0"," #define FXAA_QUALITY_P2 12.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 11)"," #define FXAA_QUALITY_PS 4"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 3.0"," #define FXAA_QUALITY_P3 12.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 12)"," #define FXAA_QUALITY_PS 5"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 4.0"," #define FXAA_QUALITY_P4 12.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 13)"," #define FXAA_QUALITY_PS 6"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 4.0"," #define FXAA_QUALITY_P5 12.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 14)"," #define FXAA_QUALITY_PS 7"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 4.0"," #define FXAA_QUALITY_P6 12.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 15)"," #define FXAA_QUALITY_PS 8"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 4.0"," #define FXAA_QUALITY_P7 12.0","#endif","","/*============================================================================"," FXAA QUALITY - LOW DITHER PRESETS","============================================================================*/","#if (FXAA_QUALITY_PRESET == 20)"," #define FXAA_QUALITY_PS 3"," #define FXAA_QUALITY_P0 1.5"," #define FXAA_QUALITY_P1 2.0"," #define FXAA_QUALITY_P2 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 21)"," #define FXAA_QUALITY_PS 4"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 22)"," #define FXAA_QUALITY_PS 5"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 23)"," #define FXAA_QUALITY_PS 6"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 24)"," #define FXAA_QUALITY_PS 7"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 3.0"," #define FXAA_QUALITY_P6 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 25)"," #define FXAA_QUALITY_PS 8"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 4.0"," #define FXAA_QUALITY_P7 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 26)"," #define FXAA_QUALITY_PS 9"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 2.0"," #define FXAA_QUALITY_P7 4.0"," #define FXAA_QUALITY_P8 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 27)"," #define FXAA_QUALITY_PS 10"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 2.0"," #define FXAA_QUALITY_P7 2.0"," #define FXAA_QUALITY_P8 4.0"," #define FXAA_QUALITY_P9 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 28)"," #define FXAA_QUALITY_PS 11"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 2.0"," #define FXAA_QUALITY_P7 2.0"," #define FXAA_QUALITY_P8 2.0"," #define FXAA_QUALITY_P9 4.0"," #define FXAA_QUALITY_P10 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 29)"," #define FXAA_QUALITY_PS 12"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 2.0"," #define FXAA_QUALITY_P7 2.0"," #define FXAA_QUALITY_P8 2.0"," #define FXAA_QUALITY_P9 2.0"," #define FXAA_QUALITY_P10 4.0"," #define FXAA_QUALITY_P11 8.0","#endif","","/*============================================================================"," FXAA QUALITY - EXTREME QUALITY","============================================================================*/","#if (FXAA_QUALITY_PRESET == 39)"," #define FXAA_QUALITY_PS 12"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.0"," #define FXAA_QUALITY_P2 1.0"," #define FXAA_QUALITY_P3 1.0"," #define FXAA_QUALITY_P4 1.0"," #define FXAA_QUALITY_P5 1.5"," #define FXAA_QUALITY_P6 2.0"," #define FXAA_QUALITY_P7 2.0"," #define FXAA_QUALITY_P8 2.0"," #define FXAA_QUALITY_P9 2.0"," #define FXAA_QUALITY_P10 4.0"," #define FXAA_QUALITY_P11 8.0","#endif","","","","/*============================================================================",""," API PORTING","","============================================================================*/","#if (FXAA_GLSL_100 == 1) || (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)"," #define FxaaBool bool"," #define FxaaDiscard discard"," #define FxaaFloat float"," #define FxaaFloat2 vec2"," #define FxaaFloat3 vec3"," #define FxaaFloat4 vec4"," #define FxaaHalf float"," #define FxaaHalf2 vec2"," #define FxaaHalf3 vec3"," #define FxaaHalf4 vec4"," #define FxaaInt2 ivec2"," #define FxaaSat(x) clamp(x, 0.0, 1.0)"," #define FxaaTex sampler2D","#else"," #define FxaaBool bool"," #define FxaaDiscard clip(-1)"," #define FxaaFloat float"," #define FxaaFloat2 float2"," #define FxaaFloat3 float3"," #define FxaaFloat4 float4"," #define FxaaHalf half"," #define FxaaHalf2 half2"," #define FxaaHalf3 half3"," #define FxaaHalf4 half4"," #define FxaaSat(x) saturate(x)","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_GLSL_100 == 1)"," #define FxaaTexTop(t, p) texture2D(t, p, 0.0)"," #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_GLSL_120 == 1)"," // Requires,"," // #version 120"," // And at least,"," // #extension GL_EXT_gpu_shader4 : enable"," // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)"," #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)"," #if (FXAA_FAST_PIXEL_OFFSET == 1)"," #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)"," #else"," #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)"," #endif"," #if (FXAA_GATHER4_ALPHA == 1)"," // use #extension GL_ARB_gpu_shader5 : enable"," #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)"," #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)"," #define FxaaTexGreen4(t, p) textureGather(t, p, 1)"," #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)"," #endif","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_GLSL_130 == 1)",' // Requires "#version 130" or better'," #define FxaaTexTop(t, p) textureLod(t, p, 0.0)"," #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)"," #if (FXAA_GATHER4_ALPHA == 1)"," // use #extension GL_ARB_gpu_shader5 : enable"," #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)"," #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)"," #define FxaaTexGreen4(t, p) textureGather(t, p, 1)"," #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)"," #endif","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_HLSL_3 == 1)"," #define FxaaInt2 float2"," #define FxaaTex sampler2D"," #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))"," #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_HLSL_4 == 1)"," #define FxaaInt2 int2"," struct FxaaTex { SamplerState smpl; Texture2D tex; };"," #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)"," #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_HLSL_5 == 1)"," #define FxaaInt2 int2"," struct FxaaTex { SamplerState smpl; Texture2D tex; };"," #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)"," #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)"," #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)"," #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)"," #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)"," #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)","#endif","","","/*============================================================================"," GREEN AS LUMA OPTION SUPPORT FUNCTION","============================================================================*/","#if (FXAA_GREEN_AS_LUMA == 0)"," FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }","#else"," FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }","#endif","","","","","/*============================================================================",""," FXAA3 QUALITY - PC","","============================================================================*/","#if (FXAA_PC == 1)","/*--------------------------------------------------------------------------*/","FxaaFloat4 FxaaPixelShader("," //"," // Use noperspective interpolation here (turn off perspective interpolation)."," // {xy} = center of pixel"," FxaaFloat2 pos,"," //"," // Used only for FXAA Console, and not used on the 360 version."," // Use noperspective interpolation here (turn off perspective interpolation)."," // {xy_} = upper left of pixel"," // {_zw} = lower right of pixel"," FxaaFloat4 fxaaConsolePosPos,"," //"," // Input color texture."," // {rgb_} = color in linear or perceptual color space"," // if (FXAA_GREEN_AS_LUMA == 0)"," // {__a} = luma in perceptual color space (not linear)"," FxaaTex tex,"," //"," // Only used on the optimized 360 version of FXAA Console.",' // For everything but 360, just use the same input here as for "tex".'," // For 360, same texture, just alias with a 2nd sampler."," // This sampler needs to have an exponent bias of -1."," FxaaTex fxaaConsole360TexExpBiasNegOne,"," //"," // Only used on the optimized 360 version of FXAA Console.",' // For everything but 360, just use the same input here as for "tex".'," // For 360, same texture, just alias with a 3nd sampler."," // This sampler needs to have an exponent bias of -2."," FxaaTex fxaaConsole360TexExpBiasNegTwo,"," //"," // Only used on FXAA Quality."," // This must be from a constant/uniform."," // {x_} = 1.0/screenWidthInPixels"," // {_y} = 1.0/screenHeightInPixels"," FxaaFloat2 fxaaQualityRcpFrame,"," //"," // Only used on FXAA Console."," // This must be from a constant/uniform."," // This effects sub-pixel AA quality and inversely sharpness."," // Where N ranges between,"," // N = 0.50 (default)"," // N = 0.33 (sharper)"," // {x__} = -N/screenWidthInPixels"," // {_y_} = -N/screenHeightInPixels"," // {_z_} = N/screenWidthInPixels"," // {__w} = N/screenHeightInPixels"," FxaaFloat4 fxaaConsoleRcpFrameOpt,"," //"," // Only used on FXAA Console."," // Not used on 360, but used on PS3 and PC."," // This must be from a constant/uniform."," // {x__} = -2.0/screenWidthInPixels"," // {_y_} = -2.0/screenHeightInPixels"," // {_z_} = 2.0/screenWidthInPixels"," // {__w} = 2.0/screenHeightInPixels"," FxaaFloat4 fxaaConsoleRcpFrameOpt2,"," //"," // Only used on FXAA Console."," // Only used on 360 in place of fxaaConsoleRcpFrameOpt2."," // This must be from a constant/uniform."," // {x__} = 8.0/screenWidthInPixels"," // {_y_} = 8.0/screenHeightInPixels"," // {_z_} = -4.0/screenWidthInPixels"," // {__w} = -4.0/screenHeightInPixels"," FxaaFloat4 fxaaConsole360RcpFrameOpt2,"," //"," // Only used on FXAA Quality."," // This used to be the FXAA_QUALITY_SUBPIX define."," // It is here now to allow easier tuning."," // Choose the amount of sub-pixel aliasing removal."," // This can effect sharpness."," // 1.00 - upper limit (softer)"," // 0.75 - default amount of filtering"," // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)"," // 0.25 - almost off"," // 0.00 - completely off"," FxaaFloat fxaaQualitySubpix,"," //"," // Only used on FXAA Quality."," // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define."," // It is here now to allow easier tuning."," // The minimum amount of local contrast required to apply algorithm."," // 0.333 - too little (faster)"," // 0.250 - low quality"," // 0.166 - default"," // 0.125 - high quality"," // 0.063 - overkill (slower)"," FxaaFloat fxaaQualityEdgeThreshold,"," //"," // Only used on FXAA Quality."," // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define."," // It is here now to allow easier tuning."," // Trims the algorithm from processing darks."," // 0.0833 - upper limit (default, the start of visible unfiltered edges)"," // 0.0625 - high quality (faster)"," // 0.0312 - visible limit (slower)"," // Special notes when using FXAA_GREEN_AS_LUMA,"," // Likely want to set this to zero."," // As colors that are mostly not-green"," // will appear very dark in the green channel!"," // Tune by looking at mostly non-green content,"," // then start at zero and increase until aliasing is a problem."," FxaaFloat fxaaQualityEdgeThresholdMin,"," //"," // Only used on FXAA Console."," // This used to be the FXAA_CONSOLE_EDGE_SHARPNESS define."," // It is here now to allow easier tuning."," // This does not effect PS3, as this needs to be compiled in."," // Use FXAA_CONSOLE_PS3_EDGE_SHARPNESS for PS3."," // Due to the PS3 being ALU bound,"," // there are only three safe values here: 2 and 4 and 8."," // These options use the shaders ability to a free *|/ by 2|4|8."," // For all other platforms can be a non-power of two."," // 8.0 is sharper (default!!!)"," // 4.0 is softer"," // 2.0 is really soft (good only for vector graphics inputs)"," FxaaFloat fxaaConsoleEdgeSharpness,"," //"," // Only used on FXAA Console."," // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD define."," // It is here now to allow easier tuning."," // This does not effect PS3, as this needs to be compiled in."," // Use FXAA_CONSOLE_PS3_EDGE_THRESHOLD for PS3."," // Due to the PS3 being ALU bound,"," // there are only two safe values here: 1/4 and 1/8."," // These options use the shaders ability to a free *|/ by 2|4|8."," // The console setting has a different mapping than the quality setting."," // Other platforms can use other values."," // 0.125 leaves less aliasing, but is softer (default!!!)"," // 0.25 leaves more aliasing, and is sharper"," FxaaFloat fxaaConsoleEdgeThreshold,"," //"," // Only used on FXAA Console."," // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD_MIN define."," // It is here now to allow easier tuning."," // Trims the algorithm from processing darks."," // The console setting has a different mapping than the quality setting."," // This only applies when FXAA_EARLY_EXIT is 1."," // This does not apply to PS3,"," // PS3 was simplified to avoid more shader instructions."," // 0.06 - faster but more aliasing in darks"," // 0.05 - default"," // 0.04 - slower and less aliasing in darks"," // Special notes when using FXAA_GREEN_AS_LUMA,"," // Likely want to set this to zero."," // As colors that are mostly not-green"," // will appear very dark in the green channel!"," // Tune by looking at mostly non-green content,"," // then start at zero and increase until aliasing is a problem."," FxaaFloat fxaaConsoleEdgeThresholdMin,"," //"," // Extra constants for 360 FXAA Console only."," // Use zeros or anything else for other platforms."," // These must be in physical constant registers and NOT immediates."," // Immediates will result in compiler un-optimizing."," // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)"," FxaaFloat4 fxaaConsole360ConstDir",") {","/*--------------------------------------------------------------------------*/"," FxaaFloat2 posM;"," posM.x = pos.x;"," posM.y = pos.y;"," #if (FXAA_GATHER4_ALPHA == 1)"," #if (FXAA_DISCARD == 0)"," FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);"," #if (FXAA_GREEN_AS_LUMA == 0)"," #define lumaM rgbyM.w"," #else"," #define lumaM rgbyM.y"," #endif"," #endif"," #if (FXAA_GREEN_AS_LUMA == 0)"," FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);"," FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));"," #else"," FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);"," FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));"," #endif"," #if (FXAA_DISCARD == 1)"," #define lumaM luma4A.w"," #endif"," #define lumaE luma4A.z"," #define lumaS luma4A.x"," #define lumaSE luma4A.y"," #define lumaNW luma4B.w"," #define lumaN luma4B.z"," #define lumaW luma4B.x"," #else"," FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);"," #if (FXAA_GREEN_AS_LUMA == 0)"," #define lumaM rgbyM.w"," #else"," #define lumaM rgbyM.y"," #endif"," #if (FXAA_GLSL_100 == 1)"," FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0, 1.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 0.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0,-1.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));"," #else"," FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));"," #endif"," #endif","/*--------------------------------------------------------------------------*/"," FxaaFloat maxSM = max(lumaS, lumaM);"," FxaaFloat minSM = min(lumaS, lumaM);"," FxaaFloat maxESM = max(lumaE, maxSM);"," FxaaFloat minESM = min(lumaE, minSM);"," FxaaFloat maxWN = max(lumaN, lumaW);"," FxaaFloat minWN = min(lumaN, lumaW);"," FxaaFloat rangeMax = max(maxWN, maxESM);"," FxaaFloat rangeMin = min(minWN, minESM);"," FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;"," FxaaFloat range = rangeMax - rangeMin;"," FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);"," FxaaBool earlyExit = range < rangeMaxClamped;","/*--------------------------------------------------------------------------*/"," if(earlyExit)"," #if (FXAA_DISCARD == 1)"," FxaaDiscard;"," #else"," return rgbyM;"," #endif","/*--------------------------------------------------------------------------*/"," #if (FXAA_GATHER4_ALPHA == 0)"," #if (FXAA_GLSL_100 == 1)"," FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 1.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0,-1.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));"," #else"," FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));"," #endif"," #else"," FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));"," #endif","/*--------------------------------------------------------------------------*/"," FxaaFloat lumaNS = lumaN + lumaS;"," FxaaFloat lumaWE = lumaW + lumaE;"," FxaaFloat subpixRcpRange = 1.0/range;"," FxaaFloat subpixNSWE = lumaNS + lumaWE;"," FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;"," FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;","/*--------------------------------------------------------------------------*/"," FxaaFloat lumaNESE = lumaNE + lumaSE;"," FxaaFloat lumaNWNE = lumaNW + lumaNE;"," FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;"," FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;","/*--------------------------------------------------------------------------*/"," FxaaFloat lumaNWSW = lumaNW + lumaSW;"," FxaaFloat lumaSWSE = lumaSW + lumaSE;"," FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);"," FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);"," FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;"," FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;"," FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;"," FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;","/*--------------------------------------------------------------------------*/"," FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;"," FxaaFloat lengthSign = fxaaQualityRcpFrame.x;"," FxaaBool horzSpan = edgeHorz >= edgeVert;"," FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;","/*--------------------------------------------------------------------------*/"," if(!horzSpan) lumaN = lumaW;"," if(!horzSpan) lumaS = lumaE;"," if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;"," FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;","/*--------------------------------------------------------------------------*/"," FxaaFloat gradientN = lumaN - lumaM;"," FxaaFloat gradientS = lumaS - lumaM;"," FxaaFloat lumaNN = lumaN + lumaM;"," FxaaFloat lumaSS = lumaS + lumaM;"," FxaaBool pairN = abs(gradientN) >= abs(gradientS);"," FxaaFloat gradient = max(abs(gradientN), abs(gradientS));"," if(pairN) lengthSign = -lengthSign;"," FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);","/*--------------------------------------------------------------------------*/"," FxaaFloat2 posB;"," posB.x = posM.x;"," posB.y = posM.y;"," FxaaFloat2 offNP;"," offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;"," offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;"," if(!horzSpan) posB.x += lengthSign * 0.5;"," if( horzSpan) posB.y += lengthSign * 0.5;","/*--------------------------------------------------------------------------*/"," FxaaFloat2 posN;"," posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;"," posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;"," FxaaFloat2 posP;"," posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;"," posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;"," FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;"," FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));"," FxaaFloat subpixE = subpixC * subpixC;"," FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));","/*--------------------------------------------------------------------------*/"," if(!pairN) lumaNN = lumaSS;"," FxaaFloat gradientScaled = gradient * 1.0/4.0;"," FxaaFloat lumaMM = lumaM - lumaNN * 0.5;"," FxaaFloat subpixF = subpixD * subpixE;"," FxaaBool lumaMLTZero = lumaMM < 0.0;","/*--------------------------------------------------------------------------*/"," lumaEndN -= lumaNN * 0.5;"," lumaEndP -= lumaNN * 0.5;"," FxaaBool doneN = abs(lumaEndN) >= gradientScaled;"," FxaaBool doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;"," FxaaBool doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;","/*--------------------------------------------------------------------------*/"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 3)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 4)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 5)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 6)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 7)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 8)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 9)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 10)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 11)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 12)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }","/*--------------------------------------------------------------------------*/"," FxaaFloat dstN = posM.x - posN.x;"," FxaaFloat dstP = posP.x - posM.x;"," if(!horzSpan) dstN = posM.y - posN.y;"," if(!horzSpan) dstP = posP.y - posM.y;","/*--------------------------------------------------------------------------*/"," FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;"," FxaaFloat spanLength = (dstP + dstN);"," FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;"," FxaaFloat spanLengthRcp = 1.0/spanLength;","/*--------------------------------------------------------------------------*/"," FxaaBool directionN = dstN < dstP;"," FxaaFloat dst = min(dstN, dstP);"," FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;"," FxaaFloat subpixG = subpixF * subpixF;"," FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;"," FxaaFloat subpixH = subpixG * fxaaQualitySubpix;","/*--------------------------------------------------------------------------*/"," FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;"," FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);"," if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;"," if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;"," #if (FXAA_DISCARD == 1)"," return FxaaTexTop(tex, posM);"," #else"," return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);"," #endif","}","/*==========================================================================*/","#endif","","void main() {"," gl_FragColor = FxaaPixelShader("," vUv,"," vec4(0.0),"," tDiffuse,"," tDiffuse,"," tDiffuse,"," resolution,"," vec4(0.0),"," vec4(0.0),"," vec4(0.0),"," 0.75,"," 0.166,"," 0.0833,"," 0.0,"," 0.0,"," 0.0,"," vec4(0.0)"," );",""," // TODO avoid querying texture twice for same texel"," gl_FragColor.a = texture2D(tDiffuse, vUv).a;","}"].join("\n")}},function(t,e,n){"use strict";n.r(e),n.d(e,"Stats",(function(){return i}));var i=function(){var t=document.createElement("div");function e(e){return t.appendChild(e.dom),e}function n(e){for(var n=0;no+1e3&&(s.update(1e3*a/(t-o),100),o=t,a=0,l)){var e=performance.memory;l.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576)}return t},update:function(){r=this.end()},domElement:t,setMode:n}};i.Panel=function(t,e,n){var i=1/0,r=0,o=Math.round,a=o(window.devicePixelRatio||1),s=100*a,c=48*a,l=3*a,u=2*a,h=3*a,p=15*a,d=94*a,f=30*a,m=document.createElement("canvas");m.width=s,m.height=c,m.style.cssText="width:100px;height:48px";var v=m.getContext("2d");return v.font="bold "+9*a+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=n,v.fillRect(0,0,s,c),v.fillStyle=e,v.fillText(t,l,u),v.fillRect(h,p,d,f),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(h,p,d,f),{dom:m,update:function(c,g){i=Math.min(i,c),r=Math.max(r,c),v.fillStyle=n,v.globalAlpha=1,v.fillRect(0,0,s,p),v.fillStyle=e,v.fillText(o(c)+" "+t+" ("+o(i)+"-"+o(r)+")",l,u),v.drawImage(m,h+a,p,d-a,f,h,p,d-a,f),v.fillRect(h+d-a,p,a,f),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(h+d-a,p,a,o((1-c/g)*f))}}}},function(t,e,n){t.exports=function(){"use strict";function t(t,e){var n=t.__state.conversionName.toString(),i=Math.round(t.r),r=Math.round(t.g),o=Math.round(t.b),a=t.a,s=Math.round(t.h),c=t.s.toFixed(1),l=t.v.toFixed(1);if(e||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var u=t.hex.toString(16);u.length<6;)u="0"+u;return"#"+u}return"CSS_RGB"===n?"rgb("+i+","+r+","+o+")":"CSS_RGBA"===n?"rgba("+i+","+r+","+o+","+a+")":"HEX"===n?"0x"+t.hex.toString(16):"RGB_ARRAY"===n?"["+i+","+r+","+o+"]":"RGBA_ARRAY"===n?"["+i+","+r+","+o+","+a+"]":"RGB_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+"}":"RGBA_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+",a:"+a+"}":"HSV_OBJ"===n?"{h:"+s+",s:"+c+",v:"+l+"}":"HSVA_OBJ"===n?"{h:"+s+",s:"+c+",v:"+l+",a:"+a+"}":"unknown format"}var e=Array.prototype.forEach,n=Array.prototype.slice,i={BREAK:{},extend:function(t){return this.each(n.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(e[n])||(t[n]=e[n])}.bind(this))}),this),t},defaults:function(t){return this.each(n.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(t[n])&&(t[n]=e[n])}.bind(this))}),this),t},compose:function(){var t=n.call(arguments);return function(){for(var e=n.call(arguments),i=t.length-1;i>=0;i--)e=[t[i].apply(this,e)];return e[0]}},each:function(t,n,i){if(t)if(e&&t.forEach&&t.forEach===e)t.forEach(n,i);else if(t.length===t.length+0){var r,o=void 0;for(o=0,r=t.length;o1?i.toArray(arguments):arguments[0];return i.each(r,(function(e){if(e.litmus(t))return i.each(e.conversions,(function(e,n){if(o=e.read(t),!1===a&&!1!==o)return a=o,o.conversionName=n,o.conversion=e,i.BREAK})),i.BREAK})),a},c=void 0,l={hsv_to_rgb:function(t,e,n){var i=Math.floor(t/60)%6,r=t/60-Math.floor(t/60),o=n*(1-e),a=n*(1-r*e),s=n*(1-(1-r)*e),c=[[n,s,o],[a,n,o],[o,n,s],[o,a,n],[s,o,n],[n,o,a]][i];return{r:255*c[0],g:255*c[1],b:255*c[2]}},rgb_to_hsv:function(t,e,n){var i=Math.min(t,e,n),r=Math.max(t,e,n),o=r-i,a=void 0;return 0===r?{h:NaN,s:0,v:0}:(a=t===r?(e-n)/o:e===r?2+(n-t)/o:4+(t-e)/o,(a/=6)<0&&(a+=1),{h:360*a,s:o/r,v:r/255})},rgb_to_hex:function(t,e,n){var i=this.hex_with_component(0,2,t);return i=this.hex_with_component(i,1,e),i=this.hex_with_component(i,0,n)},component_from_hex:function(t,e){return t>>8*e&255},hex_with_component:function(t,e,n){return n<<(c=8*e)|t&~(255<-1?e.length-e.indexOf(".")-1:0}var P=function(t){function e(t,n,r){h(this,e);var o=m(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),a=r||{};return o.__min=a.min,o.__max=a.max,o.__step=a.step,i.isUndefined(o.__step)?0===o.initialValue?o.__impliedStep=1:o.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(o.initialValue))/Math.LN10))/10:o.__impliedStep=o.__step,o.__precision=T(o.__impliedStep),o}return f(e,t),p(e,[{key:"setValue",value:function(t){var n=t;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),d(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(t){return this.__min=t,this}},{key:"max",value:function(t){return this.__max=t,this}},{key:"step",value:function(t){return this.__step=t,this.__impliedStep=t,this.__precision=T(t),this}}]),e}(w),L=function(t){function e(t,n,r){h(this,e);var o=m(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,r));o.__truncationSuspended=!1;var a=o,s=void 0;function c(){a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function l(t){var e=s-t.clientY;a.setValue(a.getValue()+e*a.__impliedStep),s=t.clientY}function u(){S.unbind(window,"mousemove",l),S.unbind(window,"mouseup",u),c()}return o.__input=document.createElement("input"),o.__input.setAttribute("type","text"),S.bind(o.__input,"change",(function(){var t=parseFloat(a.__input.value);i.isNaN(t)||a.setValue(t)})),S.bind(o.__input,"blur",(function(){c()})),S.bind(o.__input,"mousedown",(function(t){S.bind(window,"mousemove",l),S.bind(window,"mouseup",u),s=t.clientY})),S.bind(o.__input,"keydown",(function(t){13===t.keyCode&&(a.__truncationSuspended=!0,this.blur(),a.__truncationSuspended=!1,c())})),o.updateDisplay(),o.domElement.appendChild(o.__input),o}return f(e,t),p(e,[{key:"updateDisplay",value:function(){var t,n,i;return this.__input.value=this.__truncationSuspended?this.getValue():(t=this.getValue(),n=this.__precision,i=Math.pow(10,n),Math.round(t*i)/i),d(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(P);function C(t,e,n,i,r){return i+(t-e)/(n-e)*(r-i)}var R=function(t){function e(t,n,i,r,o){h(this,e);var a=m(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,{min:i,max:r,step:o})),s=a;function c(t){t.preventDefault();var e=s.__background.getBoundingClientRect();return s.setValue(C(t.clientX,e.left,e.right,s.__min,s.__max)),!1}function l(){S.unbind(window,"mousemove",c),S.unbind(window,"mouseup",l),s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function u(t){var e=t.touches[0].clientX,n=s.__background.getBoundingClientRect();s.setValue(C(e,n.left,n.right,s.__min,s.__max))}function p(){S.unbind(window,"touchmove",u),S.unbind(window,"touchend",p),s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}return a.__background=document.createElement("div"),a.__foreground=document.createElement("div"),S.bind(a.__background,"mousedown",(function(t){document.activeElement.blur(),S.bind(window,"mousemove",c),S.bind(window,"mouseup",l),c(t)})),S.bind(a.__background,"touchstart",(function(t){1===t.touches.length&&(S.bind(window,"touchmove",u),S.bind(window,"touchend",p),u(t))})),S.addClass(a.__background,"slider"),S.addClass(a.__foreground,"slider-fg"),a.updateDisplay(),a.__background.appendChild(a.__foreground),a.domElement.appendChild(a.__background),a}return f(e,t),p(e,[{key:"updateDisplay",value:function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",d(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(P),O=function(t){function e(t,n,i){h(this,e);var r=m(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=r;return r.__button=document.createElement("div"),r.__button.innerHTML=void 0===i?"Fire":i,S.bind(r.__button,"click",(function(t){return t.preventDefault(),o.fire(),!1})),S.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return f(e,t),p(e,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),e}(w),F=function(t){function e(t,n){h(this,e);var r=m(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));r.__color=new v(r.getValue()),r.__temp=new v(0);var o=r;r.domElement=document.createElement("div"),S.makeSelectable(r.domElement,!1),r.__selector=document.createElement("div"),r.__selector.className="selector",r.__saturation_field=document.createElement("div"),r.__saturation_field.className="saturation-field",r.__field_knob=document.createElement("div"),r.__field_knob.className="field-knob",r.__field_knob_border="2px solid ",r.__hue_knob=document.createElement("div"),r.__hue_knob.className="hue-knob",r.__hue_field=document.createElement("div"),r.__hue_field.className="hue-field",r.__input=document.createElement("input"),r.__input.type="text",r.__input_textShadow="0 1px 1px ",S.bind(r.__input,"keydown",(function(t){13===t.keyCode&&f.call(this)})),S.bind(r.__input,"blur",f),S.bind(r.__selector,"mousedown",(function(){S.addClass(this,"drag").bind(window,"mouseup",(function(){S.removeClass(o.__selector,"drag")}))})),S.bind(r.__selector,"touchstart",(function(){S.addClass(this,"drag").bind(window,"touchend",(function(){S.removeClass(o.__selector,"drag")}))}));var a,c=document.createElement("div");function l(t){y(t),S.bind(window,"mousemove",y),S.bind(window,"touchmove",y),S.bind(window,"mouseup",p),S.bind(window,"touchend",p)}function u(t){w(t),S.bind(window,"mousemove",w),S.bind(window,"touchmove",w),S.bind(window,"mouseup",d),S.bind(window,"touchend",d)}function p(){S.unbind(window,"mousemove",y),S.unbind(window,"touchmove",y),S.unbind(window,"mouseup",p),S.unbind(window,"touchend",p),g()}function d(){S.unbind(window,"mousemove",w),S.unbind(window,"touchmove",w),S.unbind(window,"mouseup",d),S.unbind(window,"touchend",d),g()}function f(){var t=s(this.value);!1!==t?(o.__color.__state=t,o.setValue(o.__color.toOriginal())):this.value=o.__color.toString()}function g(){o.__onFinishChange&&o.__onFinishChange.call(o,o.__color.toOriginal())}function y(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=o.__saturation_field.getBoundingClientRect(),n=t.touches&&t.touches[0]||t,i=n.clientX,r=n.clientY,a=(i-e.left)/(e.right-e.left),s=1-(r-e.top)/(e.bottom-e.top);return s>1?s=1:s<0&&(s=0),a>1?a=1:a<0&&(a=0),o.__color.v=s,o.__color.s=a,o.setValue(o.__color.toOriginal()),!1}function w(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=o.__hue_field.getBoundingClientRect(),n=1-((t.touches&&t.touches[0]||t).clientY-e.top)/(e.bottom-e.top);return n>1?n=1:n<0&&(n=0),o.__color.h=360*n,o.setValue(o.__color.toOriginal()),!1}return i.extend(r.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(r.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:r.__field_knob_border+(r.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(r.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(r.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(c.style,{width:"100%",height:"100%",background:"none"}),N(c,"top","rgba(0,0,0,0)","#000"),i.extend(r.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(a=r.__hue_field).style.background="",a.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",a.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",a.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",a.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",a.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",i.extend(r.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,textShadow:r.__input_textShadow+"rgba(0,0,0,0.7)"}),S.bind(r.__saturation_field,"mousedown",l),S.bind(r.__saturation_field,"touchstart",l),S.bind(r.__field_knob,"mousedown",l),S.bind(r.__field_knob,"touchstart",l),S.bind(r.__hue_field,"mousedown",u),S.bind(r.__hue_field,"touchstart",u),r.__saturation_field.appendChild(c),r.__selector.appendChild(r.__field_knob),r.__selector.appendChild(r.__saturation_field),r.__selector.appendChild(r.__hue_field),r.__hue_field.appendChild(r.__hue_knob),r.domElement.appendChild(r.__input),r.domElement.appendChild(r.__selector),r.updateDisplay(),r}return f(e,t),p(e,[{key:"updateDisplay",value:function(){var t=s(this.getValue());if(!1!==t){var e=!1;i.each(v.COMPONENTS,(function(n){if(!i.isUndefined(t[n])&&!i.isUndefined(this.__color.__state[n])&&t[n]!==this.__color.__state[n])return e=!0,{}}),this),e&&i.extend(this.__color.__state,t)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,r=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,N(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+r+","+r+","+r+",.7)"})}}]),e}(w),I=["-moz-","-o-","-webkit-","-ms-",""];function N(t,e,n,r){t.style.background="",i.each(I,(function(i){t.style.cssText+="background: "+i+"linear-gradient("+e+", "+n+" 0%, "+r+" 100%); "}))}var B='
    \n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
    \n\n Automatically save\n values to localStorage on exit.\n\n
    The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
    \n\n
    \n\n
    ',D=function(t,e){var n=t[e];return i.isArray(arguments[2])||i.isObject(arguments[2])?new E(t,e,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new R(t,e,arguments[2],arguments[3],arguments[4]):new R(t,e,arguments[2],arguments[3]):i.isNumber(arguments[4])?new L(t,e,{min:arguments[2],max:arguments[3],step:arguments[4]}):new L(t,e,{min:arguments[2],max:arguments[3]}):i.isString(n)?new A(t,e):i.isFunction(n)?new O(t,e,""):i.isBoolean(n)?new M(t,e):null},z=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,1e3/60)},V=function(){function t(){h(this,t),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),S.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var e=this;S.bind(this.backgroundElement,"click",(function(){e.hide()}))}return p(t,[{key:"show",value:function(){var t=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer((function(){t.backgroundElement.style.opacity=1,t.domElement.style.opacity=1,t.domElement.style.webkitTransform="scale(1)"}))}},{key:"hide",value:function(){var t=this,e=function e(){t.domElement.style.display="none",t.backgroundElement.style.display="none",S.unbind(t.domElement,"webkitTransitionEnd",e),S.unbind(t.domElement,"transitionend",e),S.unbind(t.domElement,"oTransitionEnd",e)};S.bind(this.domElement,"webkitTransitionEnd",e),S.bind(this.domElement,"transitionend",e),S.bind(this.domElement,"oTransitionEnd",e),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-S.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-S.getHeight(this.domElement)/2+"px"}}]),t}(),U="Default",k=function(){try{return"localStorage"in window&&null!==window.localStorage}catch(t){return!1}}(),j=void 0,H=!0,G=void 0,W=!1,q=[],X=function t(e){var n=this,r=e||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),S.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],r=i.defaults(r,{closeOnTop:!1,autoPlace:!0,width:t.DEFAULT_WIDTH}),r=i.defaults(r,{resizable:r.autoPlace,hideable:r.autoPlace}),i.isUndefined(r.load)?r.load={preset:U}:r.preset&&(r.load.preset=r.preset),i.isUndefined(r.parent)&&r.hideable&&q.push(this),r.resizable=i.isUndefined(r.parent)&&r.resizable,r.autoPlace&&i.isUndefined(r.scrollable)&&(r.scrollable=!0);var o,a=k&&"true"===localStorage.getItem($(0,"isLocal")),s=void 0;if(Object.defineProperties(this,{parent:{get:function(){return r.parent}},scrollable:{get:function(){return r.scrollable}},autoPlace:{get:function(){return r.autoPlace}},closeOnTop:{get:function(){return r.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:r.load.preset},set:function(t){n.parent?n.getRoot().preset=t:r.load.preset=t,function(t){for(var e=0;e1){var r=n.__li.nextElementSibling;return n.remove(),J(t,n.object,n.property,{before:r,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(e)||i.isObject(e)){var o=n.__li.nextElementSibling;return n.remove(),J(t,n.object,n.property,{before:o,factoryArgs:[e]})}},name:function(t){return n.__li.firstElementChild.firstElementChild.innerHTML=t,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof R){var r=new L(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step"],(function(t){var e=n[t],i=r[t];n[t]=r[t]=function(){var t=Array.prototype.slice.call(arguments);return i.apply(r,t),e.apply(n,t)}})),S.addClass(e,"has-slider"),n.domElement.insertBefore(r.domElement,n.domElement.firstElementChild)}else if(n instanceof L){var o=function(e){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var r=n.__li.firstElementChild.firstElementChild.innerHTML,o=n.__gui.__listening.indexOf(n)>-1;n.remove();var a=J(t,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return a.name(r),o&&a.listen(),a}return e};n.min=i.compose(o,n.min),n.max=i.compose(o,n.max)}else n instanceof M?(S.bind(e,"click",(function(){S.fakeEvent(n.__checkbox,"click")})),S.bind(n.__checkbox,"click",(function(t){t.stopPropagation()}))):n instanceof O?(S.bind(e,"click",(function(){S.fakeEvent(n.__button,"click")})),S.bind(e,"mouseover",(function(){S.addClass(n.__button,"hover")})),S.bind(e,"mouseout",(function(){S.removeClass(n.__button,"hover")}))):n instanceof F&&(S.addClass(e,"color"),n.updateDisplay=i.compose((function(t){return e.style.borderLeftColor=n.__color.toString(),t}),n.updateDisplay),n.updateDisplay());n.setValue=i.compose((function(e){return t.getRoot().__preset_select&&n.isModified()&&K(t.getRoot(),!0),e}),n.setValue)}(t,l,o),t.__controllers.push(o),o}function $(t,e){return document.location.href+"."+e}function tt(t,e,n){var i=document.createElement("option");i.innerHTML=e,i.value=e,t.__preset_select.appendChild(i),n&&(t.__preset_select.selectedIndex=t.__preset_select.length-1)}function et(t,e){e.style.display=t.useLocalStorage?"block":"none"}function nt(t){var e=t.__save_row=document.createElement("li");S.addClass(t.domElement,"has-save"),t.__ul.insertBefore(e,t.__ul.firstChild),S.addClass(e,"save-row");var n=document.createElement("span");n.innerHTML=" ",S.addClass(n,"button gears");var r=document.createElement("span");r.innerHTML="Save",S.addClass(r,"button"),S.addClass(r,"save");var o=document.createElement("span");o.innerHTML="New",S.addClass(o,"button"),S.addClass(o,"save-as");var a=document.createElement("span");a.innerHTML="Revert",S.addClass(a,"button"),S.addClass(a,"revert");var s=t.__preset_select=document.createElement("select");if(t.load&&t.load.remembered?i.each(t.load.remembered,(function(e,n){tt(t,n,n===t.preset)})):tt(t,U,!1),S.bind(s,"change",(function(){for(var e=0;e0&&(t.preset=this.preset,t.remembered||(t.remembered={}),t.remembered[this.preset]=rt(this)),t.folders={},i.each(this.__folders,(function(e,n){t.folders[n]=e.getSaveObject()})),t},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=rt(this),K(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(t){this.load.remembered||(this.load.remembered={},this.load.remembered[U]=rt(this,!0)),this.load.remembered[t]=rt(this),this.preset=t,tt(this,t,!0),this.saveToLocalStorageIfPossible()},revert:function(t){i.each(this.__controllers,(function(e){this.getRoot().load.remembered?Z(t||this.getRoot(),e):e.setValue(e.initialValue),e.__onFinishChange&&e.__onFinishChange.call(e,e.getValue())}),this),i.each(this.__folders,(function(t){t.revert(t)})),t||K(this.getRoot(),!1)},listen:function(t){var e=0===this.__listening.length;this.__listening.push(t),e&&function t(e){0!==e.length&&z.call(window,(function(){t(e)})),i.each(e,(function(t){t.updateDisplay()}))}(this.__listening)},updateDisplay:function(){i.each(this.__controllers,(function(t){t.updateDisplay()})),i.each(this.__folders,(function(t){t.updateDisplay()}))}}),{color:{Color:v,math:l,interpret:s},controllers:{Controller:w,BooleanController:M,OptionController:E,StringController:A,NumberController:P,NumberControllerBox:L,NumberControllerSlider:R,FunctionController:O,ColorController:F},dom:{dom:S},gui:{GUI:X},GUI:X}}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){var n=this;this.updateOrder=3,this.world=t,this.pointerLock=t.params.Pointer_Lock,this.domElement=e||document.body,this.isLocked=!1,this.boundOnMouseDown=function(t){return n.onMouseDown(t)},this.boundOnMouseMove=function(t){return n.onMouseMove(t)},this.boundOnMouseUp=function(t){return n.onMouseUp(t)},this.boundOnMouseWheelMove=function(t){return n.onMouseWheelMove(t)},this.boundOnPointerlockChange=function(t){return n.onPointerlockChange(t)},this.boundOnPointerlockError=function(t){return n.onPointerlockError(t)},this.boundOnKeyDown=function(t){return n.onKeyDown(t)},this.boundOnKeyUp=function(t){return n.onKeyUp(t)},this.domElement.addEventListener("mousedown",this.boundOnMouseDown,!1),document.addEventListener("wheel",this.boundOnMouseWheelMove,!1),document.addEventListener("pointerlockchange",this.boundOnPointerlockChange,!1),document.addEventListener("pointerlockerror",this.boundOnPointerlockError,!1),document.addEventListener("keydown",this.boundOnKeyDown,!1),document.addEventListener("keyup",this.boundOnKeyUp,!1),t.registerUpdatable(this)}return t.prototype.update=function(t,e){var n;void 0===this.inputReceiver&&void 0!==this.world&&void 0!==this.world.cameraOperator&&this.setInputReceiver(this.world.cameraOperator),null===(n=this.inputReceiver)||void 0===n||n.inputReceiverUpdate(e)},t.prototype.setInputReceiver=function(t){this.inputReceiver=t,this.inputReceiver.inputReceiverInit()},t.prototype.setPointerLock=function(t){this.pointerLock=t},t.prototype.onPointerlockChange=function(t){document.pointerLockElement===this.domElement?(this.domElement.addEventListener("mousemove",this.boundOnMouseMove,!1),this.domElement.addEventListener("mouseup",this.boundOnMouseUp,!1),this.isLocked=!0):(this.domElement.removeEventListener("mousemove",this.boundOnMouseMove,!1),this.domElement.removeEventListener("mouseup",this.boundOnMouseUp,!1),this.isLocked=!1)},t.prototype.onPointerlockError=function(t){console.error("PointerLockControls: Unable to use Pointer Lock API")},t.prototype.onMouseDown=function(t){this.pointerLock?this.domElement.requestPointerLock():(this.domElement.addEventListener("mousemove",this.boundOnMouseMove,!1),this.domElement.addEventListener("mouseup",this.boundOnMouseUp,!1)),void 0!==this.inputReceiver&&this.inputReceiver.handleMouseButton(t,"mouse"+t.button,!0)},t.prototype.onMouseMove=function(t){void 0!==this.inputReceiver&&this.inputReceiver.handleMouseMove(t,t.movementX,t.movementY)},t.prototype.onMouseUp=function(t){this.pointerLock||(this.domElement.removeEventListener("mousemove",this.boundOnMouseMove,!1),this.domElement.removeEventListener("mouseup",this.boundOnMouseUp,!1)),void 0!==this.inputReceiver&&this.inputReceiver.handleMouseButton(t,"mouse"+t.button,!1)},t.prototype.onKeyDown=function(t){void 0!==this.inputReceiver&&this.inputReceiver.handleKeyboardEvent(t,t.code,!0)},t.prototype.onKeyUp=function(t){void 0!==this.inputReceiver&&this.inputReceiver.handleKeyboardEvent(t,t.code,!1)},t.prototype.onMouseWheelMove=function(t){void 0!==this.inputReceiver&&this.inputReceiver.handleMouseWheel(t,t.deltaY)},t}();e.InputManager=i},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(42),a=n(0),s=n(43),c=function(t){function e(e){var n=t.call(this)||this;n.updateOrder=5,n.sunPosition=new a.Vector3,n._phi=50,n._theta=215,n.maxHemiIntensity=.9,n.minHemiIntensity=.3,n.world=e,n.skyMaterial=new a.ShaderMaterial({uniforms:a.UniformsUtils.clone(o.SkyShader.uniforms),fragmentShader:o.SkyShader.fragmentShader,vertexShader:o.SkyShader.vertexShader,side:a.BackSide}),n.skyMesh=new a.Mesh(new a.SphereBufferGeometry(1e3,24,12),n.skyMaterial),n.attach(n.skyMesh),n.hemiLight=new a.HemisphereLight(16777215,16777215,1),n.refreshHemiIntensity(),n.hemiLight.color.setHSL(.59,.4,.6),n.hemiLight.groundColor.setHSL(.095,.2,.75),n.hemiLight.position.set(0,50,0),n.world.graphicsWorld.add(n.hemiLight);return n.csm=new s.default({fov:80,far:300,lightIntensity:2.5,cascades:4,shadowMapSize:2048,camera:e.camera,parent:e.graphicsWorld,mode:"custom",customSplitsCallback:function(t,e,n){for(var i=[],r=t-1;r>=0;r--)i.push(Math.pow(1/3,r));return i}}),n.csm.fade=!0,n.refreshSunPosition(),e.graphicsWorld.add(n),e.registerUpdatable(n),n}return r(e,t),Object.defineProperty(e.prototype,"theta",{set:function(t){this._theta=t,this.refreshSunPosition()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"phi",{set:function(t){this._phi=t,this.refreshSunPosition(),this.refreshHemiIntensity()},enumerable:!0,configurable:!0}),e.prototype.update=function(t){this.position.copy(this.world.camera.position),this.refreshSunPosition(),this.csm.update(this.world.camera.matrix),this.csm.lightDirection=new a.Vector3(-this.sunPosition.x,-this.sunPosition.y,-this.sunPosition.z).normalize()},e.prototype.refreshSunPosition=function(){this.sunPosition.x=10*Math.sin(this._theta*Math.PI/180)*Math.cos(this._phi*Math.PI/180),this.sunPosition.y=10*Math.sin(this._phi*Math.PI/180),this.sunPosition.z=10*Math.cos(this._theta*Math.PI/180)*Math.cos(this._phi*Math.PI/180),this.skyMaterial.uniforms.sunPosition.value.copy(this.sunPosition),this.skyMaterial.uniforms.cameraPos.value.copy(this.world.camera.position)},e.prototype.refreshHemiIntensity=function(){this.hemiLight.intensity=this.minHemiIntensity+Math.pow(1-Math.abs(this._phi-90)/90,.25)*(this.maxHemiIntensity-this.minHemiIntensity)},e}(a.Object3D);e.Sky=c},function(t,e,n){"use strict";n.r(e),n.d(e,"SkyShader",(function(){return r}));const i=n(0);let r={uniforms:{luminance:{value:1},turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new i.Vector3},cameraPos:{value:new i.Vector3}},vertexShader:"\n uniform vec3 sunPosition;\n uniform float rayleigh;\n uniform float turbidity;\n uniform float mieCoefficient;\n \n varying vec3 vWorldPosition;\n varying vec3 vSunDirection;\n varying float vSunfade;\n varying vec3 vBetaR;\n varying vec3 vBetaM;\n varying float vSunE;\n \n const vec3 up = vec3( 0.0, 1.0, 0.0 );\n \n // constants for atmospheric scattering\n const float e = 2.71828182845904523536028747135266249775724709369995957;\n const float pi = 3.141592653589793238462643383279502884197169;\n \n // wavelength of used primaries, according to preetham\n const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );\n // this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:\n // (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))\n const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );\n \n // mie stuff\n // K coefficient for the primaries\n const float v = 4.0;\n const vec3 K = vec3( 0.686, 0.678, 0.666 );\n // MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K\n const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );\n \n // earth shadow hack\n // cutoffAngle = pi / 1.95;\n const float cutoffAngle = 1.6110731556870734;\n const float steepness = 1.5;\n const float EE = 1000.0;\n \n float sunIntensity( float zenithAngleCos ) {\n \tzenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );\n \treturn EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );\n }\n \n vec3 totalMie( float T ) {\n \tfloat c = ( 0.2 * T ) * 10E-18;\n \treturn 0.434 * c * MieConst;\n }\n \n void main() {\n \n \tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n \tvWorldPosition = worldPosition.xyz;\n \n \tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n \n \tvSunDirection = normalize( sunPosition );\n \n \tvSunE = sunIntensity( dot( vSunDirection, up ) );\n \n \tvSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );\n \n \tfloat rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );\n \n // extinction (absorbtion + out scattering)\n // rayleigh coefficients\n \tvBetaR = totalRayleigh * rayleighCoefficient;\n \n // mie coefficients\n \tvBetaM = totalMie( turbidity ) * mieCoefficient;\n \n }\n ",fragmentShader:"\n varying vec3 vWorldPosition;\n varying vec3 vSunDirection;\n varying float vSunfade;\n varying vec3 vBetaR;\n varying vec3 vBetaM;\n varying float vSunE;\n \n uniform float luminance;\n uniform float mieDirectionalG;\n uniform vec3 cameraPos;\n \n // constants for atmospheric scattering\n const float pi = 3.141592653589793238462643383279502884197169;\n \n const float n = 1.0003; // refractive index of air\n const float N = 2.545E25; // number of molecules per unit volume for air at\n // 288.15K and 1013mb (sea level -45 celsius)\n \n // optical length at zenith for molecules\n const float rayleighZenithLength = 8.4E3;\n const float mieZenithLength = 1.25E3;\n const vec3 up = vec3( 0.0, 1.0, 0.0 );\n // 66 arc seconds -> degrees, and the cosine of that\n const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\n \n // 3.0 / ( 16.0 * pi )\n const float THREE_OVER_SIXTEENPI = 0.05968310365946075;\n // 1.0 / ( 4.0 * pi )\n const float ONE_OVER_FOURPI = 0.07957747154594767;\n \n float rayleighPhase( float cosTheta ) {\n \treturn THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );\n }\n \n float hgPhase( float cosTheta, float g ) {\n \tfloat g2 = pow( g, 2.0 );\n \tfloat inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );\n \treturn ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );\n }\n \n // Filmic ToneMapping http://filmicgames.com/archives/75\n const float A = 0.15;\n const float B = 0.50;\n const float C = 0.10;\n const float D = 0.20;\n const float E = 0.02;\n const float F = 0.30;\n \n const float whiteScale = 1.0748724675633854; // 1.0 / Uncharted2Tonemap(1000.0)\n \n vec3 Uncharted2Tonemap( vec3 x ) {\n \treturn ( ( x * ( A * x + C * B ) + D * E ) / ( x * ( A * x + B ) + D * F ) ) - E / F;\n }\n \n void main() {\n // optical length\n // cutoff angle at 90 to avoid singularity in next formula.\n \tfloat zenithAngle = acos( max( 0.0, dot( up, normalize( vWorldPosition - cameraPos ) ) ) );\n \tfloat inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );\n \tfloat sR = rayleighZenithLength * inverse;\n \tfloat sM = mieZenithLength * inverse;\n \n // combined extinction factor\n \tvec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );\n \n // in scattering\n \tfloat cosTheta = dot( normalize( vWorldPosition - cameraPos ), vSunDirection );\n \n \tfloat rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );\n \tvec3 betaRTheta = vBetaR * rPhase;\n \n \tfloat mPhase = hgPhase( cosTheta, mieDirectionalG );\n \tvec3 betaMTheta = vBetaM * mPhase;\n \n \tvec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );\n \tLin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );\n \n // nightsky\n \tvec3 direction = normalize( vWorldPosition - cameraPos );\n \tfloat theta = acos( direction.y ); // elevation --\x3e y-axis, [-pi/2, pi/2]\n \tfloat phi = atan( direction.z, direction.x ); // azimuth --\x3e x-axis [-pi/2, pi/2]\n \tvec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );\n \tvec3 L0 = vec3( 0.1 ) * Fex;\n \n // composition + solar disc\n \tfloat sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );\n \tL0 += ( vSunE * 19000.0 * Fex ) * sundisk;\n \n \tvec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );\n \n \t//vec3 curr = Uncharted2Tonemap( ( log2( 2.0 / pow( luminance, 4.0 ) ) ) * texColor );\n // vec3 color = texColor * whiteScale;\n vec3 color = texColor * 0.3;\n \n \tvec3 retColor = pow( color, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );\n \n \tgl_FragColor = vec4( retColor, 1.0 );\n \n #if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n #endif\n } "}},function(t,e,n){"use strict";n.r(e);var i=n(0);class r{constructor(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}fromLerp(t,e,n){return this.x=(1-n)*t.x+n*e.x,this.y=(1-n)*t.y+n*e.y,this.z=(1-n)*t.z+n*e.z,this}}function o(t){return t*Math.PI/180}class a{constructor(t){t=t||{},this.fov=t.fov||70,this.near=t.near||.1,this.far=t.far||1e3,this.aspect=t.aspect||1,this.vertices={near:[],far:[]}}getViewSpaceVertices(){return this.nearPlaneY=this.near*Math.tan(o(this.fov/2)),this.nearPlaneX=this.aspect*this.nearPlaneY,this.farPlaneY=this.far*Math.tan(o(this.fov/2)),this.farPlaneX=this.aspect*this.farPlaneY,this.vertices.near.push(new r(this.nearPlaneX,this.nearPlaneY,-this.near),new r(this.nearPlaneX,-this.nearPlaneY,-this.near),new r(-this.nearPlaneX,-this.nearPlaneY,-this.near),new r(-this.nearPlaneX,this.nearPlaneY,-this.near)),this.vertices.far.push(new r(this.farPlaneX,this.farPlaneY,-this.far),new r(this.farPlaneX,-this.farPlaneY,-this.far),new r(-this.farPlaneX,-this.farPlaneY,-this.far),new r(-this.farPlaneX,this.farPlaneY,-this.far)),this.vertices}split(t){const e=[];for(let n=0;n 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( pointLight.shadow, directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( spotLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0) && defined( RE_Direct ) && defined( USE_CSM ) && defined( CSM_CASCADES )\n\tDirectionalLight directionalLight;\n\tfloat linearDepth = (vViewPosition.z) / (shadowFar - cameraNear);\n\t\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tif(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y) directLight.color *= all( bvec3( directionalLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tif(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) RE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) && !defined( USE_CSM ) && !defined( CSM_CASCADES )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif\n",lights_pars_begin:"\n#if defined( USE_CSM ) && defined( CSM_CASCADES )\nuniform vec2 CSM_cascades[CSM_CASCADES];\nuniform float cameraNear;\nuniform float shadowFar;\n#endif\n\t"+i.ShaderChunk.lights_pars_begin};e.default=class{constructor(t){t=t||{},this.camera=t.camera,this.parent=t.parent,this.fov=t.fov||this.camera.fov,this.near=this.camera.near,this.far=t.far||this.camera.far,this.aspect=t.aspect||this.camera.aspect,this.cascades=t.cascades||3,this.mode=t.mode||"practical",this.shadowMapSize=t.shadowMapSize||2048,this.shadowBias=t.shadowBias||1e-6,this.lightDirection=t.lightDirection||new i.Vector3(1,-1,1).normalize(),this.lightIntensity=t.lightIntensity||1,this.lightNear=t.lightNear||1,this.lightFar=t.lightFar||2e3,this.lightMargin=t.lightMargin||200,this.customSplitsCallback=t.customSplitsCallback,this.lights=[],this.materials=[],this.createLights(),this.getBreaks(),this.initCascades(),this.injectInclude()}createLights(){for(let t=0;t0&&t<1&&(t*=65536),(t=Math.floor(t))<256&&(t|=t<<8);for(var e=0;e<256;e++){var a;a=1&e?i[e]^255&t:i[e]^t>>8&255,r[e]=r[e+256]=a,o[e]=o[e+256]=n[a%12]}},t.seed(0);var a=.5*(Math.sqrt(3)-1),s=(3-Math.sqrt(3))/6,c=1/6;function l(t){return t*t*t*(t*(6*t-15)+10)}function u(t,e,n){return(1-n)*t+n*e}return t.simplex2=function(t,e){var n,i,c=(t+e)*a,l=Math.floor(t+c),u=Math.floor(e+c),h=(l+u)*s,p=t-l+h,d=e-u+h;p>d?(n=1,i=0):(n=0,i=1);var f=p-n+s,m=d-i+s,v=p-1+2*s,g=d-1+2*s,y=o[(l&=255)+r[u&=255]],w=o[l+n+r[u+i]],x=o[l+1+r[u+1]],_=.5-p*p-d*d,b=.5-f*f-m*m,S=.5-v*v-g*g;return 70*((_<0?0:(_*=_)*_*y.dot2(p,d))+(b<0?0:(b*=b)*b*w.dot2(f,m))+(S<0?0:(S*=S)*S*x.dot2(v,g)))},t.simplex3=function(t,e,n){var i,a,s,l,u,h,p=(t+e+n)*(1/3),d=Math.floor(t+p),f=Math.floor(e+p),m=Math.floor(n+p),v=(d+f+m)*c,g=t-d+v,y=e-f+v,w=n-m+v;g>=y?y>=w?(i=1,a=0,s=0,l=1,u=1,h=0):g>=w?(i=1,a=0,s=0,l=1,u=0,h=1):(i=0,a=0,s=1,l=1,u=0,h=1):y x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0); vec4 x12 = x0.xyxy + C.xxzz; x12.xy -= i1; i = mod289(i); vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 )) + i.x + vec3(0.0, i1.x, 1.0 )); vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0); m = m*m ; m = m*m ; vec3 x = 2.0 * fract(p * C.www) - 1.0; vec3 h = abs(x) - 0.5; vec3 ox = floor(x + 0.5); vec3 a0 = x - ox; m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h ); vec3 g; g.x = a0.x * x0.x + h.x * x0.y; g.yz = a0.yz * x12.xz + h.yz * x12.yw; return 130.0 * dot(m, g);}\n //END NOISE\n \n //https://www.geeks3d.com/20141201/how-to-rotate-a-vertex-by-a-quaternion-in-glsl/\n vec3 rotateVectorByQuaternion( vec3 v, vec4 q){\n return 2.0 * cross(q.xyz, v * q.w + cross(q.xyz, v)) + v;\n }\n\n vec4 vectorToQuaternion(vec3 v){\n float c1 = cos(v.y / 2.0);\n float c2 = cos(v.x / 2.0);\n float c3 = cos(v.z / 2.0);\n float s1 = sin(v.y / 2.0);\n float s2 = sin(v.x / 2.0);\n float s3 = sin(v.z / 2.0);\n\n float c1c2 = c1 * c2;\n float s1s2 = s1 * s2;\n\n float w = c1c2 * c3 - s1s2 * s3;\n float x = c1c2 * s3 + s1s2 * c3;\n float y = s1 * c2 * c3 + c1 * s2 * s3;\n float z = c1 * s2 * c3 - s1 * c2 * s3;\n\n return vec4(-x, y, z, w);\n }\n \n //https://en.wikipedia.org/wiki/Slerp\n vec4 slerp(vec4 v0, vec4 v1, float t) {\n // Only unit quaternions are valid rotations.\n // Normalize to avoid undefined behavior.\n normalize(v0);\n normalize(v1);\n \n // Compute the cosine of the angle between the two vectors.\n float dot_ = dot(v0, v1);\n \n // If the dot product is negative, slerp won't take\n // the shorter path. Note that v1 and -v1 are equivalent when\n // the negation is applied to all four components. Fix by \n // reversing one quaternion.\n if (dot_ < 0.0) {\n v1 = -v1;\n dot_ = -dot_;\n } \n \n const float DOT_THRESHOLD = 0.9995;\n if (dot_ > DOT_THRESHOLD) {\n // If the inputs are too close for comfort, linearly interpolate\n // and normalize the result.\n \n vec4 result = t*(v1 - v0) + v0;\n normalize(result);\n return result;\n }\n \n // Since dot is in range [0, DOT_THRESHOLD], acos is safe\n float theta_0 = acos(dot_); // theta_0 = angle between input vectors\n float theta = theta_0*t; // theta = angle between v0 and result\n float sin_theta = sin(theta); // compute this value only once\n float sin_theta_0 = sin(theta_0); // compute this value only once\n \n float s0 = cos(theta) - dot_ * sin_theta / sin_theta_0; // == sin(theta_0 - theta) / sin(theta_0)\n float s1 = sin_theta / sin_theta_0;\n \n return (s0 * v0) + (s1 * v1);\n }\n \n void main() {\n \n //Relative position of vertex along the mesh Y direction\n\n frc = position.y/float(0.2);\n \n //Get wind data from simplex noise \n float noise = 1.0-(snoise(vec2(((time*0.35)-offset.x/10.0), ((time*0.35)-offset.z/10.0)))); \n \n //Define the direction of an unbent blade of grass rotated around the Y axis\n vec4 direction = vec4(0.0, halfRootAngleSin, 0.0, halfRootAngleCos);\n \n //Interpolate between the unbent direction and the direction of growth calculated on the CPU. \n //Using the relative location of the vertex along the Y axis as the weight, we get a smooth bend\n direction = slerp(direction, orientation, frc);\n vec3 vPosition = vec3(position.x, position.y + position.y * stretch, position.z);\n vPosition = rotateVectorByQuaternion(vPosition, direction);\n\n float halfAngle = noise * 0.15;\n vec4 windAngle = normalize(vec4(sin(halfAngle), 0.0, -sin(halfAngle), cos(halfAngle)));\n\n vec3 vObjectPosition = (modelMatrix * vec4( 0.0, 0.0, 0.0, 1.0 )).xyz;\n vec3 playerLookVector = playerPos - (vObjectPosition + offset);\n vec3 distortionAngle = normalize(vec3(playerLookVector.x, 0.0, playerLookVector.z));\n\n float distortionInfluence = clamp(1.0 - length(playerLookVector), 0.0, 1.0) * 2.3;\n\n vec4 angle = mix(windAngle, vectorToQuaternion(distortionAngle), pow(distortionInfluence, 2.0));\n vPosition = rotateVectorByQuaternion(vPosition, angle);\n\n //UV for texture\n vUv = uv;\n \n //Calculate final position of the vertex from the world offset and the above shenanigans \n gl_Position = projectionMatrix * modelViewMatrix * vec4(offset + vPosition, 1.0 );\n }",fragmentShader:"\n // precision mediump float;\n uniform sampler2D map;\n uniform sampler2D alphaMap;\n varying vec2 vUv;\n varying float frc;\n\n void main() {\n //Get transparency information from alpha map\n float alpha = texture2D(alphaMap, vUv).r;\n //If transparent, don't draw\n if(alpha < 0.15){\n discard;\n }\n //Get colour data from texture\n vec4 col = vec4(texture2D(map, vUv));\n //Add more green towards root\n col = mix(vec4(0.0, 0.6, 0.0, 1.0), col, frc);\n //Add a shadow towards root\n col = mix(vec4(0.0, 0.1, 0.0, 1.0), col, frc);\n gl_FragColor = col;\n\n #if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n #endif\n\n }"}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(48),r=function(){function t(t){var e=this;this.nodes={},this.rootNode=t,this.rootNode.traverse((function(t){e.addNode(t)})),this.connectNodes()}return t.prototype.addNode=function(t){if(t.hasOwnProperty("userData")&&t.userData.hasOwnProperty("data")&&"pathNode"===t.userData.data){var e=new i.PathNode(t,this);this.nodes[t.name]=e}},t.prototype.connectNodes=function(){for(var t in this.nodes)if(this.nodes.hasOwnProperty(t)){var e=this.nodes[t];e.nextNode=this.nodes[e.object.userData.nextNode],e.previousNode=this.nodes[e.object.userData.previousNode]}},t}();e.Path=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(t,e){this.object=t,this.path=e};e.PathNode=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(50),r=n(51),o=n(23),a=n(19),s=function(){function t(t){this.firstLoad=!0,this.loadingTracker=[],this.world=t,this.gltfLoader=new i.GLTFLoader,this.world.setTimeScale(0),o.UIManager.setUserInterfaceVisible(!1),o.UIManager.setLoadingScreenVisible(!0)}return t.prototype.loadGLTF=function(t,e){var n=this,i=this.addLoadingEntry(t);this.gltfLoader.load(t,(function(t){e(t),n.doneLoading(i)}),(function(t){t.lengthComputable&&(i.progress=t.loaded/t.total)}),(function(t){console.error(t)}))},t.prototype.addLoadingEntry=function(t){var e=new r.LoadingTrackerEntry(t);return this.loadingTracker.push(e),e},t.prototype.doneLoading=function(t){t.finished=!0,t.progress=1,this.isLoadingDone()&&(void 0!==this.onFinishedCallback?this.onFinishedCallback():o.UIManager.setUserInterfaceVisible(!0),o.UIManager.setLoadingScreenVisible(!1))},t.prototype.createWelcomeScreenCallback=function(t){var e=this;void 0===this.onFinishedCallback&&(this.onFinishedCallback=function(){e.world.update(1,1),a.default.fire({title:t.descriptionTitle,html:t.descriptionContent,confirmButtonText:"Play",buttonsStyling:!1,onClose:function(){e.world.setTimeScale(1),o.UIManager.setUserInterfaceVisible(!0)}})})},t.prototype.getLoadingPercentage=function(){for(var t=0,e=0,n=0,i=this.loadingTracker;n=2.0 are supported."));else{if(g.extensionsUsed)for(var y=0;y=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+w+'".')}}new U(g,v,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager}).parse(c,l)}}});var n={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function r(t){if(!t)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=n.MSFT_TEXTURE_DDS,this.ddsLoader=t}function o(t){this.name=n.KHR_LIGHTS_PUNCTUAL;var e=t.extensions&&t.extensions[n.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=e.lights||[]}function a(){this.name=n.KHR_MATERIALS_UNLIT}o.prototype.loadLight=function(t){var e,n=this.lightDefs[t],r=new i.Color(16777215);void 0!==n.color&&r.fromArray(n.color);var o=void 0!==n.range?n.range:0;switch(n.type){case"directional":(e=new i.DirectionalLight(r)).target.position.set(0,0,-1),e.add(e.target);break;case"point":(e=new i.PointLight(r)).distance=o;break;case"spot":(e=new i.SpotLight(r)).distance=o,n.spot=n.spot||{},n.spot.innerConeAngle=void 0!==n.spot.innerConeAngle?n.spot.innerConeAngle:0,n.spot.outerConeAngle=void 0!==n.spot.outerConeAngle?n.spot.outerConeAngle:Math.PI/4,e.angle=n.spot.outerConeAngle,e.penumbra=1-n.spot.innerConeAngle/n.spot.outerConeAngle,e.target.position.set(0,0,-1),e.add(e.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+n.type+'".')}return e.position.set(0,0,0),e.decay=2,void 0!==n.intensity&&(e.intensity=n.intensity),e.name=n.name||"light_"+t,Promise.resolve(e)},a.prototype.getMaterialType=function(){return i.MeshBasicMaterial},a.prototype.extendParams=function(t,e,n){var r=[];t.color=new i.Color(1,1,1),t.opacity=1;var o=e.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){var a=o.baseColorFactor;t.color.fromArray(a),t.opacity=a[3]}void 0!==o.baseColorTexture&&r.push(n.assignTexture(t,"map",o.baseColorTexture))}return Promise.all(r)};var s="glTF",c=12,l={JSON:1313821514,BIN:5130562};function u(t){this.name=n.KHR_BINARY_GLTF,this.content=null,this.body=null;var e=new DataView(t,0,c);if(this.header={magic:i.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==s)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var r=new DataView(t,c),o=0;o",e),t.fragmentShader=t.fragmentShader.replace("#include ",n),t.fragmentShader=t.fragmentShader.replace("#include ",r),t.fragmentShader=t.fragmentShader.replace("#include ",o),t.fragmentShader=t.fragmentShader.replace("#include ",a)},Object.defineProperties(this,{specular:{get:function(){return s.specular.value},set:function(t){s.specular.value=t}},specularMap:{get:function(){return s.specularMap.value},set:function(t){s.specularMap.value=t}},glossiness:{get:function(){return s.glossiness.value},set:function(t){s.glossiness.value=t}},glossinessMap:{get:function(){return s.glossinessMap.value},set:function(t){s.glossinessMap.value=t,t?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_ROUGHNESSMAP=""):(delete this.defines.USE_ROUGHNESSMAP,delete this.defines.USE_GLOSSINESSMAP)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(t)}function f(){return{name:n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return d},extendParams:function(t,e,n){var r=e.extensions[this.name];t.color=new i.Color(1,1,1),t.opacity=1;var o=[];if(Array.isArray(r.diffuseFactor)){var a=r.diffuseFactor;t.color.fromArray(a),t.opacity=a[3]}if(void 0!==r.diffuseTexture&&o.push(n.assignTexture(t,"map",r.diffuseTexture)),t.emissive=new i.Color(0,0,0),t.glossiness=void 0!==r.glossinessFactor?r.glossinessFactor:1,t.specular=new i.Color(1,1,1),Array.isArray(r.specularFactor)&&t.specular.fromArray(r.specularFactor),void 0!==r.specularGlossinessTexture){var s=r.specularGlossinessTexture;o.push(n.assignTexture(t,"glossinessMap",s)),o.push(n.assignTexture(t,"specularMap",s))}return Promise.all(o)},createMaterial:function(t){var e=new d(t);return e.fog=!0,e.color=t.color,e.map=void 0===t.map?null:t.map,e.lightMap=null,e.lightMapIntensity=1,e.aoMap=void 0===t.aoMap?null:t.aoMap,e.aoMapIntensity=1,e.emissive=t.emissive,e.emissiveIntensity=1,e.emissiveMap=void 0===t.emissiveMap?null:t.emissiveMap,e.bumpMap=void 0===t.bumpMap?null:t.bumpMap,e.bumpScale=1,e.normalMap=void 0===t.normalMap?null:t.normalMap,e.normalMapType=i.TangentSpaceNormalMap,t.normalScale&&(e.normalScale=t.normalScale),e.displacementMap=null,e.displacementScale=1,e.displacementBias=0,e.specularMap=void 0===t.specularMap?null:t.specularMap,e.specular=t.specular,e.glossinessMap=void 0===t.glossinessMap?null:t.glossinessMap,e.glossiness=t.glossiness,e.alphaMap=null,e.envMap=void 0===t.envMap?null:t.envMap,e.envMapIntensity=1,e.refractionRatio=.98,e}}}function m(){this.name=n.KHR_MESH_QUANTIZATION}function v(t,e,n,r){i.Interpolant.call(this,t,e,n,r)}h.prototype.decodePrimitive=function(t,e){var n=this.json,i=this.dracoLoader,r=t.extensions[this.name].bufferView,o=t.extensions[this.name].attributes,a={},s={},c={};for(var l in o){var u=P[l]||l.toLowerCase();a[u]=o[l]}for(l in t.attributes){u=P[l]||l.toLowerCase();if(void 0!==o[l]){var h=n.accessors[t.attributes[l]],p=M[h.componentType];c[u]=p,s[u]=!0===h.normalized}}return e.getDependency("bufferView",r).then((function(t){return new Promise((function(e){i.decodeDracoFile(t,(function(t){for(var n in t.attributes){var i=t.attributes[n],r=s[n];void 0!==r&&(i.normalized=r)}e(t)}),a,c)}))}))},p.prototype.extendTexture=function(t,e){return t=t.clone(),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),void 0!==e.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),t.needsUpdate=!0,t},d.prototype=Object.create(i.MeshStandardMaterial.prototype),d.prototype.constructor=d,d.prototype.copy=function(t){return i.MeshStandardMaterial.prototype.copy.call(this,t),this.specularMap=t.specularMap,this.specular.copy(t.specular),this.glossinessMap=t.glossinessMap,this.glossiness=t.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},v.prototype=Object.create(i.Interpolant.prototype),v.prototype.constructor=v,v.prototype.copySampleValue_=function(t){for(var e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i*3+i,o=0;o!==i;o++)e[o]=n[r+o];return e},v.prototype.beforeStart_=v.prototype.copySampleValue_,v.prototype.afterEnd_=v.prototype.copySampleValue_,v.prototype.interpolate_=function(t,e,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=2*a,c=3*a,l=i-e,u=(n-e)/l,h=u*u,p=h*u,d=t*c,f=d-c,m=-2*p+3*h,v=p-h,g=1-m,y=v-h+u,w=0;w!==a;w++){var x=o[f+w+a],_=o[f+w+s]*l,b=o[d+w+a],S=o[d+w]*l;r[w]=g*x+y*_+m*b+v*S}return r};var g=0,y=1,w=2,x=3,_=4,b=5,S=6,M={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},E={9728:i.NearestFilter,9729:i.LinearFilter,9984:i.NearestMipmapNearestFilter,9985:i.LinearMipmapNearestFilter,9986:i.NearestMipmapLinearFilter,9987:i.LinearMipmapLinearFilter},A={33071:i.ClampToEdgeWrapping,33648:i.MirroredRepeatWrapping,10497:i.RepeatWrapping},T={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},P={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},L={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},C={CUBICSPLINE:void 0,LINEAR:i.InterpolateLinear,STEP:i.InterpolateDiscrete},R="OPAQUE",O="MASK",F="BLEND",I={"image/png":i.RGBAFormat,"image/jpeg":i.RGBFormat};function N(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)?t:/^data:.*,.*$/i.test(t)?t:/^blob:.*$/i.test(t)?t:e+t)}function B(t,e,n){for(var i in n.extensions)void 0===t[i]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=n.extensions[i])}function D(t,e){void 0!==e.extras&&("object"==typeof e.extras?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function z(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(var n=0,i=e.weights.length;n=2&&a.setY(P,S[E*c+1]),c>=3&&a.setZ(P,S[E*c+2]),c>=4&&a.setW(P,S[E*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return a}))},U.prototype.loadTexture=function(t){var e,r=this,o=this.json,a=this.options,s=this.textureLoader,c=window.URL||window.webkitURL,l=o.textures[t],u=l.extensions||{},h=(e=u[n.MSFT_TEXTURE_DDS]?o.images[u[n.MSFT_TEXTURE_DDS].source]:o.images[l.source]).uri,p=!1;return void 0!==e.bufferView&&(h=r.getDependency("bufferView",e.bufferView).then((function(t){p=!0;var n=new Blob([t],{type:e.mimeType});return h=c.createObjectURL(n)}))),Promise.resolve(h).then((function(t){var e=a.manager.getHandler(t);return e||(e=u[n.MSFT_TEXTURE_DDS]?r.extensions[n.MSFT_TEXTURE_DDS].ddsLoader:s),new Promise((function(n,i){e.load(N(t,a.path),n,void 0,i)}))})).then((function(t){!0===p&&c.revokeObjectURL(h),t.flipY=!1,void 0!==l.name&&(t.name=l.name),e.mimeType in I&&(t.format=I[e.mimeType]);var n=(o.samplers||{})[l.sampler]||{};return t.magFilter=E[n.magFilter]||i.LinearFilter,t.minFilter=E[n.minFilter]||i.LinearMipmapLinearFilter,t.wrapS=A[n.wrapS]||i.RepeatWrapping,t.wrapT=A[n.wrapT]||i.RepeatWrapping,t}))},U.prototype.assignTexture=function(t,e,r){var o=this;return this.getDependency("texture",r.index).then((function(a){if(!a.isCompressedTexture)switch(e){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":a.format=i.RGBFormat}if(void 0===r.texCoord||0==r.texCoord||"aoMap"===e&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+e+" not yet supported."),o.extensions[n.KHR_TEXTURE_TRANSFORM]){var s=void 0!==r.extensions?r.extensions[n.KHR_TEXTURE_TRANSFORM]:void 0;s&&(a=o.extensions[n.KHR_TEXTURE_TRANSFORM].extendTexture(a,s))}t[e]=a}))},U.prototype.assignFinalMaterial=function(t){var e=t.geometry,n=t.material,r=(this.extensions,void 0!==e.attributes.tangent),o=void 0!==e.attributes.color,a=void 0===e.attributes.normal,s=!0===t.isSkinnedMesh,c=Object.keys(e.morphAttributes).length>0,l=c&&void 0!==e.morphAttributes.normal;if(t.isPoints){var u="PointsMaterial:"+n.uuid,h=this.cache.get(u);h||(h=new i.PointsMaterial,i.Material.prototype.copy.call(h,n),h.color.copy(n.color),h.map=n.map,h.sizeAttenuation=!1,this.cache.add(u,h)),n=h}else if(t.isLine){u="LineBasicMaterial:"+n.uuid;var p=this.cache.get(u);p||(p=new i.LineBasicMaterial,i.Material.prototype.copy.call(p,n),p.color.copy(n.color),this.cache.add(u,p)),n=p}if(r||o||a||s||c){u="ClonedMaterial:"+n.uuid+":";n.isGLTFSpecularGlossinessMaterial&&(u+="specular-glossiness:"),s&&(u+="skinning:"),r&&(u+="vertex-tangents:"),o&&(u+="vertex-colors:"),a&&(u+="flat-shading:"),c&&(u+="morph-targets:"),l&&(u+="morph-normals:");var d=this.cache.get(u);d||(d=n.clone(),s&&(d.skinning=!0),r&&(d.vertexTangents=!0),o&&(d.vertexColors=i.VertexColors),a&&(d.flatShading=!0),c&&(d.morphTargets=!0),l&&(d.morphNormals=!0),this.cache.add(u,d)),n=d}n.aoMap&&void 0===e.attributes.uv2&&void 0!==e.attributes.uv&&e.setAttribute("uv2",new i.BufferAttribute(e.attributes.uv.array,2)),n.normalScale&&!r&&(n.normalScale.y=-n.normalScale.y),t.material=n},U.prototype.loadMaterial=function(t){var e,r=this.json,o=this.extensions,a=r.materials[t],s={},c=a.extensions||{},l=[];if(c[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var u=o[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];e=u.getMaterialType(),l.push(u.extendParams(s,a,this))}else if(c[n.KHR_MATERIALS_UNLIT]){var h=o[n.KHR_MATERIALS_UNLIT];e=h.getMaterialType(),l.push(h.extendParams(s,a,this))}else{e=i.MeshStandardMaterial;var p=a.pbrMetallicRoughness||{};if(s.color=new i.Color(1,1,1),s.opacity=1,Array.isArray(p.baseColorFactor)){var f=p.baseColorFactor;s.color.fromArray(f),s.opacity=f[3]}void 0!==p.baseColorTexture&&l.push(this.assignTexture(s,"map",p.baseColorTexture)),s.metalness=void 0!==p.metallicFactor?p.metallicFactor:1,s.roughness=void 0!==p.roughnessFactor?p.roughnessFactor:1,void 0!==p.metallicRoughnessTexture&&(l.push(this.assignTexture(s,"metalnessMap",p.metallicRoughnessTexture)),l.push(this.assignTexture(s,"roughnessMap",p.metallicRoughnessTexture)))}!0===a.doubleSided&&(s.side=i.DoubleSide);var m=a.alphaMode||R;return m===F?s.transparent=!0:(s.transparent=!1,m===O&&(s.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&e!==i.MeshBasicMaterial&&(l.push(this.assignTexture(s,"normalMap",a.normalTexture)),s.normalScale=new i.Vector2(1,1),void 0!==a.normalTexture.scale&&s.normalScale.set(a.normalTexture.scale,a.normalTexture.scale)),void 0!==a.occlusionTexture&&e!==i.MeshBasicMaterial&&(l.push(this.assignTexture(s,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(s.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&e!==i.MeshBasicMaterial&&(s.emissive=(new i.Color).fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&e!==i.MeshBasicMaterial&&l.push(this.assignTexture(s,"emissiveMap",a.emissiveTexture)),Promise.all(l).then((function(){var t;return t=e===d?o[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s):new e(s),void 0!==a.name&&(t.name=a.name),t.map&&(t.map.encoding=i.sRGBEncoding),t.emissiveMap&&(t.emissiveMap.encoding=i.sRGBEncoding),D(t,a),a.extensions&&B(o,t,a),t}))},U.prototype.loadGeometries=function(t){var e=this,r=this.extensions,o=this.primitiveCache;function a(t){return r[n.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,e).then((function(n){return k(n,t,e)}))}for(var s,c,l=[],u=0,h=t.length;u0&&z(h,r),h.name=r.name||"mesh_"+t,s.length>1&&(h.name+="_"+l),D(h,r),n.assignFinalMaterial(h),c.push(h)}if(1===c.length)return c[0];var m=new i.Group;for(l=0,u=c.length;l1){var n=c[l.mesh]++;(e=t.clone()).name+="_instance_"+n}else e=t;return void 0!==l.weights&&e.traverse((function(t){if(t.isMesh)for(var e=0,n=l.weights.length;e1?new i.Group:1===t.length?t[0]:new i.Object3D)!==t[0])for(var n=0,r=t.length;n{this.scene.remove(t)})}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(56),r=n(92),o=function(){function t(t,e){var n=this;this.spawnAlways=!1,this.default=!1,this.spawnPoints=[],this.invisible=!1,this.rootNode=t,this.world=e,this.id=t.name,t.userData.hasOwnProperty("name")&&(this.name=t.userData.name),t.userData.hasOwnProperty("default")&&"true"===t.userData.default&&(this.default=!0),t.userData.hasOwnProperty("spawn_always")&&"true"===t.userData.spawn_always&&(this.spawnAlways=!0),t.userData.hasOwnProperty("invisible")&&"true"===t.userData.invisible&&(this.invisible=!0),t.userData.hasOwnProperty("desc_title")&&(this.descriptionTitle=t.userData.desc_title),t.userData.hasOwnProperty("desc_content")&&(this.descriptionContent=t.userData.desc_content),t.userData.hasOwnProperty("camera_angle")&&(this.initialCameraAngle=t.userData.camera_angle),this.invisible||this.createLaunchLink(),t.traverse((function(t){if(t.hasOwnProperty("userData")&&t.userData.hasOwnProperty("data")&&"spawn"===t.userData.data)if("car"===t.userData.type||"airplane"===t.userData.type||"heli"===t.userData.type){var e=new i.VehicleSpawnPoint(t);t.userData.hasOwnProperty("type")&&(e.type=t.userData.type),t.userData.hasOwnProperty("driver")&&(e.driver=t.userData.driver,"ai"===t.userData.driver&&t.userData.hasOwnProperty("first_node")&&(e.firstAINode=t.userData.first_node)),n.spawnPoints.push(e)}else if("player"===t.userData.type){e=new r.CharacterSpawnPoint(t);n.spawnPoints.push(e)}}))}return t.prototype.createLaunchLink=function(){var t=this;this.world.params[this.name]=function(){t.world.launchScenario(t.id)},this.world.scenarioGUIFolder.add(this.world.params,this.name)},t.prototype.launch=function(t,e){this.spawnPoints.forEach((function(n){n.spawn(t,e)})),this.spawnAlways||(t.createWelcomeScreenCallback(this),e.cameraOperator.theta=this.initialCameraAngle,e.cameraOperator.phi=15)},t}();e.Scenario=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=n(57),o=n(77),a=n(78),s=n(2),c=n(27),l=n(90),u=function(){function t(t){this.object=t}return t.prototype.spawn=function(t,e){var n=this;t.loadGLTF("build/assets/"+this.type+".glb",(function(r){var o=n.getNewVehicleByType(r,n.type);o.spawnPoint=n.object;var a=new i.Vector3,u=new i.Quaternion;n.object.getWorldPosition(a),n.object.getWorldQuaternion(u),o.setPosition(a.x,a.y+1,a.z),o.collision.quaternion.copy(s.cannonQuat(u)),e.add(o),void 0!==n.driver&&t.loadGLTF("build/assets/boxman.glb",(function(t){var i=new c.Character(t);if(e.add(i),i.teleportToVehicle(o,o.seats[0]),"player"===n.driver)i.takeControl();else if("ai"===n.driver&&void 0!==n.firstAINode){var r=!1;for(var a in e.paths)if(e.paths.hasOwnProperty(a)){var s=e.paths[a];for(var u in s.nodes)if(Object.prototype.hasOwnProperty.call(s.nodes,u)){var h=s.nodes[u];h.object.name===n.firstAINode&&(i.setBehaviour(new l.FollowPath(h,10)),r=!0)}}r||console.error("Path node "+n.firstAINode+"not found.")}}))}))},t.prototype.getNewVehicleByType=function(t,e){switch(e){case"car":return new a.Car(t);case"heli":return new r.Helicopter(t);case"airplane":return new o.Airplane(t)}},t}();e.VehicleSpawnPoint=u},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(1),s=n(2),c=n(15),l=n(7),u=n(10),h=function(t){function e(e){var n=t.call(this,e)||this;return n.entityType=u.EntityType.Helicopter,n.rotors=[],n.enginePower=0,n.readHelicopterData(e),n.collision.preStep=function(t){n.physicsPreStep(t,n)},n.actions={ascend:new l.KeyBinding("ShiftLeft"),descend:new l.KeyBinding("Space"),pitchUp:new l.KeyBinding("KeyS"),pitchDown:new l.KeyBinding("KeyW"),yawLeft:new l.KeyBinding("KeyQ"),yawRight:new l.KeyBinding("KeyE"),rollLeft:new l.KeyBinding("KeyA"),rollRight:new l.KeyBinding("KeyD"),exitVehicle:new l.KeyBinding("KeyF"),seat_switch:new l.KeyBinding("KeyX"),view:new l.KeyBinding("KeyV")},n}return r(e,t),e.prototype.noDirectionPressed=function(){return!this.actions.ascend.isPressed&&!this.actions.descend.isPressed},e.prototype.update=function(e){var n=this;t.prototype.update.call(this,e),void 0!==this.controllingCharacter?(this.enginePower<1&&(this.enginePower+=.2*e),this.enginePower>1&&(this.enginePower=1)):(this.enginePower>0&&(this.enginePower-=.06*e),this.enginePower<0&&(this.enginePower=0)),this.rotors.forEach((function(t){t.rotateX(n.enginePower*e*30)}))},e.prototype.onInputChange=function(){t.prototype.onInputChange.call(this),this.actions.exitVehicle.justPressed&&void 0!==this.controllingCharacter&&this.forceCharacterOut(),this.actions.view.justPressed&&this.toggleFirstPersonView()},e.prototype.physicsPreStep=function(t,e){var n=s.threeQuat(t.quaternion),i=new o.Vector3(1,0,0).applyQuaternion(n),r=new o.Vector3(0,1,0),c=new o.Vector3(0,1,0).applyQuaternion(n),l=new o.Vector3(0,0,1).applyQuaternion(n);e.actions.ascend.isPressed&&(t.velocity.x+=.15*c.x*this.enginePower,t.velocity.y+=.15*c.y*this.enginePower,t.velocity.z+=.15*c.z*this.enginePower),e.actions.descend.isPressed&&(t.velocity.x-=.15*c.x*this.enginePower,t.velocity.y-=.15*c.y*this.enginePower,t.velocity.z-=.15*c.z*this.enginePower);var u=e.world.physicsWorld.gravity,h=new a.Vec3(-u.x,-u.y,-u.z).length();h*=e.world.physicsFrameTime,h*=.98;var p=r.dot(c);h*=Math.sqrt(o.MathUtils.clamp(p,0,1));var d=new o.Vector3(0,t.velocity.y,0).multiplyScalar(-.01),f=c.clone();if(f.multiplyScalar(h),f.add(d),f.multiplyScalar(e.enginePower),t.velocity.x+=f.x,t.velocity.y+=f.y,t.velocity.z+=f.z,t.velocity.x*=o.MathUtils.lerp(1,.995,this.enginePower),t.velocity.z*=o.MathUtils.lerp(1,.995,this.enginePower),void 0!==this.controllingCharacter){var m=(new o.Quaternion).setFromUnitVectors(c,r);m.x*=.3,m.y*=.3,m.z*=.3,m.w*=.3;var v=(new o.Euler).setFromQuaternion(m);t.angularVelocity.x+=v.x*this.enginePower,t.angularVelocity.y+=v.y*this.enginePower,t.angularVelocity.z+=v.z*this.enginePower}e.actions.pitchUp.isPressed&&(t.angularVelocity.x-=.07*i.x*this.enginePower,t.angularVelocity.y-=.07*i.y*this.enginePower,t.angularVelocity.z-=.07*i.z*this.enginePower),e.actions.pitchDown.isPressed&&(t.angularVelocity.x+=.07*i.x*this.enginePower,t.angularVelocity.y+=.07*i.y*this.enginePower,t.angularVelocity.z+=.07*i.z*this.enginePower),e.actions.yawLeft.isPressed&&(t.angularVelocity.x+=.07*c.x*this.enginePower,t.angularVelocity.y+=.07*c.y*this.enginePower,t.angularVelocity.z+=.07*c.z*this.enginePower),e.actions.yawRight.isPressed&&(t.angularVelocity.x-=.07*c.x*this.enginePower,t.angularVelocity.y-=.07*c.y*this.enginePower,t.angularVelocity.z-=.07*c.z*this.enginePower),e.actions.rollLeft.isPressed&&(t.angularVelocity.x-=.07*l.x*this.enginePower,t.angularVelocity.y-=.07*l.y*this.enginePower,t.angularVelocity.z-=.07*l.z*this.enginePower),e.actions.rollRight.isPressed&&(t.angularVelocity.x+=.07*l.x*this.enginePower,t.angularVelocity.y+=.07*l.y*this.enginePower,t.angularVelocity.z+=.07*l.z*this.enginePower),t.angularVelocity.x*=.97,t.angularVelocity.y*=.97,t.angularVelocity.z*=.97},e.prototype.readHelicopterData=function(t){var e=this;t.scene.traverse((function(t){t.hasOwnProperty("userData")&&t.userData.hasOwnProperty("data")&&"rotor"===t.userData.data&&e.rotors.push(t)}))},e.prototype.inputReceiverInit=function(){t.prototype.inputReceiverInit.call(this),this.world.updateControls([{keys:["Shift"],desc:"Ascend"},{keys:["Space"],desc:"Descend"},{keys:["W","S"],desc:"Pitch"},{keys:["Q","E"],desc:"Yaw"},{keys:["A","D"],desc:"Roll"},{keys:["V"],desc:"View select"},{keys:["F"],desc:"Exit vehicle"},{keys:["Shift","+","R"],desc:"Respawn"},{keys:["Shift","+","C"],desc:"Free camera"}])},e}(c.Vehicle);e.Helicopter=h},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(59),r=function(){function t(t,e,n){if(this.connectedSeats=[],this.entryPoints=[],this.occupiedBy=null,this.vehicle=t,this.seatPointObject=e,e.hasOwnProperty("userData")&&e.userData.hasOwnProperty("data")){if(e.userData.hasOwnProperty("door_object")&&(this.door=new i.VehicleDoor(this,n.scene.getObjectByName(e.userData.door_object))),e.userData.hasOwnProperty("entry_points"))for(var r=0,o=e.userData.entry_points.split(";");r0&&this.entryPoints.push(n.scene.getObjectByName(a))}else console.error("Seat object "+e+" has no entry point reference property.");e.userData.hasOwnProperty("seat_type")?this.type=e.userData.seat_type:console.error("Seat object "+e+" has no seat type property."),e.userData.hasOwnProperty("connected_seats")&&(this.connectedSeatsString=e.userData.connected_seats)}}return t.prototype.update=function(t){void 0!==this.door&&this.door.update(t)},t}();e.VehicleSeat=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=n(2),o=n(5),a=function(){function t(t,e){this.doorVelocity=0,this.doorWorldPos=new i.Vector3,this.lastTrailerPos=new i.Vector3,this.lastTrailerVel=new i.Vector3,this.rotation=0,this.achievingTargetRotation=!1,this.physicsEnabled=!1,this.targetRotation=0,this.rotationSpeed=5,this.lastVehicleVel=new i.Vector3,this.lastVehiclePos=new i.Vector3,this.seat=t,this.vehicle=t.vehicle,this.doorObject=e;var n=r.detectRelativeSide(this.seat.seatPointObject,this.doorObject);n===o.Side.Left?this.sideMultiplier=-1:n===o.Side.Right?this.sideMultiplier=1:this.sideMultiplier=0}return t.prototype.update=function(t){this.achievingTargetRotation&&(this.rotationthis.targetRotation&&(this.rotation=this.targetRotation,this.achievingTargetRotation=!1,this.physicsEnabled=!0)):this.rotation>this.targetRotation&&(this.rotation-=t*this.rotationSpeed,this.rotation1&&(this.rotation=1,this.doorVelocity=-this.doorVelocity/2),this.doorVelocity=.98*this.doorVelocity}},t.prototype.open=function(){this.achievingTargetRotation=!0,this.targetRotation=1},t.prototype.close=function(){this.achievingTargetRotation=!0,this.targetRotation=0},t.prototype.resetPhysTrailer=function(){this.doorObject.getWorldPosition(this.doorWorldPos),this.lastVehicleVel=new i.Vector3;var t=r.threeQuat(this.vehicle.rayCastVehicle.chassisBody.quaternion),e=new i.Vector3(0,0,-1).applyQuaternion(t);this.lastTrailerPos.copy(e.add(this.doorWorldPos))},t}();e.VehicleDoor=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(t){this.steering=!1,this.wheelObject=t,this.position=t.position,t.hasOwnProperty("userData")&&t.userData.hasOwnProperty("data")&&(t.userData.hasOwnProperty("steering")&&(this.steering="true"===t.userData.steering),t.userData.hasOwnProperty("drive")&&(this.drive=t.userData.drive))};e.Wheel=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),r=n(3),o=function(){function t(t){this.character=t,this.character.velocitySimulator.damping=this.character.defaultVelocitySimulatorDamping,this.character.velocitySimulator.mass=this.character.defaultVelocitySimulatorMass,this.character.rotationSimulator.damping=this.character.defaultRotationSimulatorDamping,this.character.rotationSimulator.mass=this.character.defaultRotationSimulatorMass,this.character.arcadeVelocityIsAdditive=!1,this.character.setArcadeVelocityInfluence(1,0,1),this.canFindVehiclesToEnter=!0,this.canEnterVehicles=!1,this.canLeaveVehicles=!0,this.timer=0}return t.prototype.update=function(t){this.timer+=t},t.prototype.onInputChange=function(){this.canFindVehiclesToEnter&&this.character.actions.enter.justPressed?this.character.findVehicleToEnter(!0):this.canFindVehiclesToEnter&&this.character.actions.enter_passenger.justPressed?this.character.findVehicleToEnter(!1):this.canEnterVehicles&&null!==this.character.vehicleEntryInstance&&(this.character.actions.up.justPressed||this.character.actions.down.justPressed||this.character.actions.left.justPressed||this.character.actions.right.justPressed)&&(this.character.vehicleEntryInstance=null,this.character.actions.up.isPressed=!1)},t.prototype.noDirection=function(){return!(this.character.actions.up.isPressed||this.character.actions.down.isPressed||this.character.actions.left.isPressed||this.character.actions.right.isPressed)},t.prototype.anyDirection=function(){return this.character.actions.up.isPressed||this.character.actions.down.isPressed||this.character.actions.left.isPressed||this.character.actions.right.isPressed},t.prototype.fallInAir=function(){this.character.rayHasHit||this.character.setState(new r.Falling(this.character))},t.prototype.animationEnded=function(t){return void 0===this.character.mixer||(void 0===this.animationLength?(console.error(this.constructor.name+"Error: Set this.animationLength in state constructor!"),!1):this.timer>this.animationLength-t)},t.prototype.setAppropriateDropState=function(){this.character.groundImpactData.velocity.y<-6?this.character.setState(new r.DropRolling(this.character)):this.anyDirection()?this.character.groundImpactData.velocity.y<-2?this.character.setState(new r.DropRunning(this.character)):this.character.actions.run.isPressed?this.character.setState(new r.Sprint(this.character)):this.character.setState(new r.Walk(this.character)):this.character.setState(new r.DropIdle(this.character))},t.prototype.setAppropriateStartWalkState=function(){var t=Math.PI,e=i.getSignedAngleBetweenVectors(this.character.orientation,this.character.getCameraRelativeMovementVector());e>.8*t?this.character.setState(new r.StartWalkBackLeft(this.character)):e<.8*-t?this.character.setState(new r.StartWalkBackRight(this.character)):e>.3*t?this.character.setState(new r.StartWalkLeft(this.character)):e<.3*-t?this.character.setState(new r.StartWalkRight(this.character)):this.character.setState(new r.StartWalkForward(this.character))},t.prototype.playAnimation=function(t,e){this.animationLength=this.character.setAnimation(t,e)},t}();e.CharacterStateBase=o},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=function(t){function e(e){var n=t.call(this,e)||this;return n.character.velocitySimulator.damping=.5,n.character.velocitySimulator.mass=7,n.character.setArcadeVelocityTarget(0),n.playAnimation("drop_idle",.1),n.anyDirection()&&n.character.setState(new o.StartWalkForward(e)),n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.character.setCameraRelativeOrientationTarget(),this.animationEnded(e)&&this.character.setState(new o.Idle(this.character)),this.fallInAir()},e.prototype.onInputChange=function(){t.prototype.onInputChange.call(this),this.character.actions.jump.justPressed&&this.character.setState(new o.JumpIdle(this.character)),this.anyDirection()&&this.character.setState(new o.StartWalkForward(this.character))},e}(o.CharacterStateBase);e.DropIdle=a},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=function(t){function e(e){var n=t.call(this,e)||this;return n.character.setArcadeVelocityTarget(.8),n.playAnimation("drop_running",.1),n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.character.setCameraRelativeOrientationTarget(),this.animationEnded(e)&&this.character.setState(new o.Walk(this.character))},e.prototype.onInputChange=function(){t.prototype.onInputChange.call(this),this.noDirection()&&this.character.setState(new o.EndWalk(this.character)),this.anyDirection()&&this.character.actions.run.justPressed&&this.character.setState(new o.Sprint(this.character)),this.character.actions.jump.justPressed&&this.character.setState(new o.JumpRunning(this.character))},e}(o.CharacterStateBase);e.DropRunning=a},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=function(t){function e(e){var n=t.call(this,e)||this;return n.character.setArcadeVelocityTarget(0),n.animationLength=e.setAnimation("stop",.1),n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.animationEnded(e)&&this.character.setState(new o.Idle(this.character)),this.fallInAir()},e.prototype.onInputChange=function(){t.prototype.onInputChange.call(this),this.character.actions.jump.justPressed&&this.character.setState(new o.JumpIdle(this.character)),this.anyDirection()&&(this.character.actions.run.isPressed?this.character.setState(new o.Sprint(this.character)):this.character.velocity.length()>.5?this.character.setState(new o.Walk(this.character)):this.setAppropriateStartWalkState())},e}(o.CharacterStateBase);e.EndWalk=a},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=function(t){function e(e){var n=t.call(this,e)||this;return n.character.rotationSimulator.mass=30,n.character.rotationSimulator.damping=.6,n.character.velocitySimulator.damping=.6,n.character.velocitySimulator.mass=10,n.character.setArcadeVelocityTarget(0),n.playAnimation("rotate_left",.1),n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.animationEnded(e)&&this.character.setState(new o.Idle(this.character)),this.fallInAir()},e.prototype.onInputChange=function(){t.prototype.onInputChange.call(this),this.character.actions.jump.justPressed&&this.character.setState(new o.JumpIdle(this.character)),this.anyDirection()&&(this.character.velocity.length()>.5?this.character.setState(new o.Walk(this.character)):this.setAppropriateStartWalkState())},e}(o.CharacterStateBase);e.IdleRotateLeft=a},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=function(t){function e(e){var n=t.call(this,e)||this;return n.character.rotationSimulator.mass=30,n.character.rotationSimulator.damping=.6,n.character.velocitySimulator.damping=.6,n.character.velocitySimulator.mass=10,n.character.setArcadeVelocityTarget(0),n.playAnimation("rotate_right",.1),n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.animationEnded(e)&&this.character.setState(new o.Idle(this.character)),this.fallInAir()},e.prototype.onInputChange=function(){t.prototype.onInputChange.call(this),this.character.actions.jump.justPressed&&this.character.setState(new o.JumpIdle(this.character)),this.anyDirection()&&(this.character.velocity.length()>.5?this.character.setState(new o.Walk(this.character)):this.setAppropriateStartWalkState())},e}(o.CharacterStateBase);e.IdleRotateRight=a},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=function(t){function e(e){var n=t.call(this,e)||this;return n.character.velocitySimulator.mass=50,n.character.setArcadeVelocityTarget(0),n.playAnimation("jump_idle",.1),n.alreadyJumped=!1,n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.alreadyJumped&&(this.character.setCameraRelativeOrientationTarget(),this.character.setArcadeVelocityTarget(this.anyDirection()?.8:0)),this.timer>.2&&!this.alreadyJumped?(this.character.jump(),this.alreadyJumped=!0,this.character.velocitySimulator.mass=100,this.character.rotationSimulator.damping=.3,this.character.rayResult.body.velocity.length()>0?this.character.setArcadeVelocityInfluence(0,0,0):this.character.setArcadeVelocityInfluence(.3,0,.3)):this.timer>.3&&this.character.rayHasHit?this.setAppropriateDropState():this.animationEnded(e)&&this.character.setState(new o.Falling(this.character))},e}(o.CharacterStateBase);e.JumpIdle=a},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=function(t){function e(e){var n=t.call(this,e)||this;return n.character.velocitySimulator.mass=100,n.playAnimation("jump_running",.03),n.alreadyJumped=!1,n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.character.setCameraRelativeOrientationTarget(),this.alreadyJumped&&this.character.setArcadeVelocityTarget(this.anyDirection()?.8:0),this.timer>.13&&!this.alreadyJumped?(this.character.jump(4),this.alreadyJumped=!0,this.character.rotationSimulator.damping=.3,this.character.arcadeVelocityIsAdditive=!0,this.character.setArcadeVelocityInfluence(.05,0,.05)):this.timer>.24&&this.character.rayHasHit?this.setAppropriateDropState():this.animationEnded(e)&&this.character.setState(new o.Falling(this.character))},e}(o.CharacterStateBase);e.JumpRunning=a},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=function(t){function e(e){var n=t.call(this,e)||this;return n.canEnterVehicles=!0,n.character.velocitySimulator.mass=10,n.character.rotationSimulator.damping=.8,n.character.rotationSimulator.mass=50,n.character.setArcadeVelocityTarget(1.4),n.playAnimation("sprint",.1),n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.character.setCameraRelativeOrientationTarget(),this.fallInAir()},e.prototype.onInputChange=function(){t.prototype.onInputChange.call(this),this.character.actions.run.isPressed||this.character.setState(new o.Walk(this.character)),this.character.actions.jump.justPressed&&this.character.setState(new o.JumpRunning(this.character)),this.noDirection()&&this.character.setState(new o.EndWalk(this.character))},e}(o.CharacterStateBase);e.Sprint=a},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(2),a=n(3),s=function(t){function e(e){var n=t.call(this,e)||this;return n.canEnterVehicles=!0,n.character.rotationSimulator.mass=20,n.character.rotationSimulator.damping=.7,n.character.setArcadeVelocityTarget(.8),n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.animationEnded(e)&&this.character.setState(new a.Walk(this.character)),this.character.setCameraRelativeOrientationTarget(),this.fallInAir()},e.prototype.onInputChange=function(){if(t.prototype.onInputChange.call(this),this.character.actions.jump.justPressed&&this.character.setState(new a.JumpRunning(this.character)),this.noDirection())if(this.timer<.1){var e=o.getSignedAngleBetweenVectors(this.character.orientation,this.character.orientationTarget);e>.4*Math.PI?this.character.setState(new a.IdleRotateLeft(this.character)):e<.4*-Math.PI?this.character.setState(new a.IdleRotateRight(this.character)):this.character.setState(new a.Idle(this.character))}else this.character.setState(new a.Idle(this.character));this.character.actions.run.justPressed&&this.character.setState(new a.Sprint(this.character))},e}(a.CharacterStateBase);e.StartWalkBase=s},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e){var n=t.call(this,e)||this;return n.animationLength=e.setAnimation("start_back_left",.1),n}return r(e,t),e}(n(3).StartWalkBase);e.StartWalkBackLeft=o},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e){var n=t.call(this,e)||this;return n.animationLength=e.setAnimation("start_back_right",.1),n}return r(e,t),e}(n(3).StartWalkBase);e.StartWalkBackRight=o},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e){var n=t.call(this,e)||this;return n.animationLength=e.setAnimation("start_forward",.1),n}return r(e,t),e}(n(3).StartWalkBase);e.StartWalkForward=o},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e){var n=t.call(this,e)||this;return n.animationLength=e.setAnimation("start_left",.1),n}return r(e,t),e}(n(3).StartWalkBase);e.StartWalkLeft=o},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e){var n=t.call(this,e)||this;return n.animationLength=e.setAnimation("start_right",.1),n}return r(e,t),e}(n(3).StartWalkBase);e.StartWalkRight=o},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=function(t){function e(e){var n=t.call(this,e)||this;return n.canEnterVehicles=!0,n.character.setArcadeVelocityTarget(.8),n.playAnimation("run",.1),n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.character.setCameraRelativeOrientationTarget(),this.fallInAir()},e.prototype.onInputChange=function(){t.prototype.onInputChange.call(this),this.noDirection()&&this.character.setState(new o.EndWalk(this.character)),this.character.actions.run.isPressed&&this.character.setState(new o.Sprint(this.character)),this.character.actions.run.justPressed&&this.character.setState(new o.Sprint(this.character)),this.character.actions.jump.justPressed&&this.character.setState(new o.JumpRunning(this.character)),this.noDirection()&&(this.character.velocity.length()>1?this.character.setState(new o.EndWalk(this.character)):this.character.setState(new o.Idle(this.character)))},e}(o.CharacterStateBase);e.Walk=a},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(1),s=n(15),c=n(7),l=n(12),u=n(2),h=n(10),p=function(t){function e(e){var n=t.call(this,e,{radius:.12,suspensionStiffness:150,suspensionRestLength:.25,dampingRelaxation:5,dampingCompression:5,directionLocal:new a.Vec3(0,-1,0),axleLocal:new a.Vec3(-1,0,0),chassisConnectionPointLocal:new a.Vec3})||this;return n.entityType=h.EntityType.Airplane,n.elevators=[],n.enginePower=0,n.lastDrag=0,n.readAirplaneData(e),n.collision.preStep=function(t){n.physicsPreStep(t,n)},n.actions={throttle:new c.KeyBinding("ShiftLeft"),brake:new c.KeyBinding("Space"),wheelBrake:new c.KeyBinding("KeyB"),pitchUp:new c.KeyBinding("KeyS"),pitchDown:new c.KeyBinding("KeyW"),yawLeft:new c.KeyBinding("KeyQ"),yawRight:new c.KeyBinding("KeyE"),rollLeft:new c.KeyBinding("KeyA"),rollRight:new c.KeyBinding("KeyD"),exitVehicle:new c.KeyBinding("KeyF"),seat_switch:new c.KeyBinding("KeyX"),view:new c.KeyBinding("KeyV")},n.steeringSimulator=new l.SpringSimulator(60,10,.6),n.aileronSimulator=new l.SpringSimulator(60,5,.6),n.elevatorSimulator=new l.SpringSimulator(60,7,.6),n.rudderSimulator=new l.SpringSimulator(60,10,.6),n}return r(e,t),e.prototype.noDirectionPressed=function(){return!(this.actions.throttle.isPressed||this.actions.brake.isPressed||this.actions.yawLeft.isPressed||this.actions.yawRight.isPressed||this.actions.rollLeft.isPressed||this.actions.rollRight.isPressed)},e.prototype.update=function(e){var n=this;t.prototype.update.call(this,e),void 0!==this.controllingCharacter?(this.enginePower<1&&(this.enginePower+=.4*e),this.enginePower>1&&(this.enginePower=1)):(this.enginePower>0&&(this.enginePower-=.12*e),this.enginePower<0&&(this.enginePower=0)),this.rotor.rotateX(this.enginePower*e*60),this.rayCastVehicle.numWheelsOnGround>0?!this.actions.yawLeft.isPressed&&!this.actions.rollLeft.isPressed||this.actions.yawRight.isPressed||this.actions.rollRight.isPressed?!this.actions.yawRight.isPressed&&!this.actions.rollRight.isPressed||this.actions.yawLeft.isPressed||this.actions.rollLeft.isPressed?this.steeringSimulator.target=0:this.steeringSimulator.target=-.8:this.steeringSimulator.target=.8:this.steeringSimulator.target=0,this.steeringSimulator.simulate(e),this.setSteeringValue(this.steeringSimulator.position);this.actions.rollLeft.isPressed&&!this.actions.rollRight.isPressed?this.aileronSimulator.target=.7:!this.actions.rollLeft.isPressed&&this.actions.rollRight.isPressed?this.aileronSimulator.target=-.7:this.aileronSimulator.target=0,this.actions.pitchUp.isPressed&&!this.actions.pitchDown.isPressed?this.elevatorSimulator.target=.7:!this.actions.pitchUp.isPressed&&this.actions.pitchDown.isPressed?this.elevatorSimulator.target=-.7:this.elevatorSimulator.target=0,this.actions.yawLeft.isPressed&&!this.actions.yawRight.isPressed?this.rudderSimulator.target=.7:!this.actions.yawLeft.isPressed&&this.actions.yawRight.isPressed?this.rudderSimulator.target=-.7:this.rudderSimulator.target=0,this.aileronSimulator.simulate(e),this.elevatorSimulator.simulate(e),this.rudderSimulator.simulate(e),this.leftAileron.rotation.y=this.aileronSimulator.position,this.rightAileron.rotation.y=-this.aileronSimulator.position,this.elevators.forEach((function(t){t.rotation.y=n.elevatorSimulator.position})),this.rudder.rotation.y=this.rudderSimulator.position},e.prototype.physicsPreStep=function(t,e){var n=u.threeQuat(t.quaternion),i=new o.Vector3(1,0,0).applyQuaternion(n),r=new o.Vector3(0,1,0).applyQuaternion(n),s=new o.Vector3(0,0,1).applyQuaternion(n),c=(new a.Vec3).copy(this.collision.velocity),l=t.velocity.length(),h=c.dot(u.cannonVector(s)),p=h/10;p=o.MathUtils.clamp(p,0,1);var d=h/10;d=o.MathUtils.clamp(d,0,1),this.collision.mass=50*(1-.6*d);var f=t.velocity.clone();f.normalize();var m=(new o.Quaternion).setFromUnitVectors(s,u.threeVector(f));m.x*=.3,m.y*=.3,m.z*=.3,m.w*=.3;var v=(new o.Euler).setFromQuaternion(m),g=o.MathUtils.clamp(l-1,0,.1);g*=this.rayCastVehicle.numWheelsOnGround>0&&h<0?0:1;var y=this.actions.throttle.isPressed&&h>0?0:1;t.angularVelocity.x+=v.x*g*y,t.angularVelocity.y+=v.y*g,t.angularVelocity.z+=v.z*g*y,e.actions.pitchUp.isPressed&&(t.angularVelocity.x-=.04*i.x*p*this.enginePower,t.angularVelocity.y-=.04*i.y*p*this.enginePower,t.angularVelocity.z-=.04*i.z*p*this.enginePower),e.actions.pitchDown.isPressed&&(t.angularVelocity.x+=.04*i.x*p*this.enginePower,t.angularVelocity.y+=.04*i.y*p*this.enginePower,t.angularVelocity.z+=.04*i.z*p*this.enginePower),e.actions.yawLeft.isPressed&&(t.angularVelocity.x+=.02*r.x*p*this.enginePower,t.angularVelocity.y+=.02*r.y*p*this.enginePower,t.angularVelocity.z+=.02*r.z*p*this.enginePower),e.actions.yawRight.isPressed&&(t.angularVelocity.x-=.02*r.x*p*this.enginePower,t.angularVelocity.y-=.02*r.y*p*this.enginePower,t.angularVelocity.z-=.02*r.z*p*this.enginePower),e.actions.rollLeft.isPressed&&(t.angularVelocity.x-=.055*s.x*p*this.enginePower,t.angularVelocity.y-=.055*s.y*p*this.enginePower,t.angularVelocity.z-=.055*s.z*p*this.enginePower),e.actions.rollRight.isPressed&&(t.angularVelocity.x+=.055*s.x*p*this.enginePower,t.angularVelocity.y+=.055*s.y*p*this.enginePower,t.angularVelocity.z+=.055*s.z*p*this.enginePower);var w=.02;e.actions.throttle.isPressed&&!e.actions.brake.isPressed?w=.06:!e.actions.throttle.isPressed&&e.actions.brake.isPressed?w=-.05:this.rayCastVehicle.numWheelsOnGround>0&&(w=0),t.velocity.x+=(l*this.lastDrag+w)*s.x*this.enginePower,t.velocity.y+=(l*this.lastDrag+w)*s.y*this.enginePower,t.velocity.z+=(l*this.lastDrag+w)*s.z*this.enginePower;var x=t.velocity.length(),_=.003*Math.pow(x,1)*this.enginePower;t.velocity.x-=t.velocity.x*_,t.velocity.y-=t.velocity.y*_,t.velocity.z-=t.velocity.z*_,this.lastDrag=_;var b=.005*Math.pow(x,1)*this.enginePower;b=o.MathUtils.clamp(b,0,.05),t.velocity.x+=r.x*b,t.velocity.y+=r.y*b,t.velocity.z+=r.z*b,t.angularVelocity.x=o.MathUtils.lerp(t.angularVelocity.x,.98*t.angularVelocity.x,p),t.angularVelocity.y=o.MathUtils.lerp(t.angularVelocity.y,.98*t.angularVelocity.y,p),t.angularVelocity.z=o.MathUtils.lerp(t.angularVelocity.z,.98*t.angularVelocity.z,p)},e.prototype.onInputChange=function(){t.prototype.onInputChange.call(this);this.actions.exitVehicle.justPressed&&void 0!==this.controllingCharacter&&this.forceCharacterOut(),this.actions.wheelBrake.justPressed&&this.setBrake(100),this.actions.wheelBrake.justReleased&&this.setBrake(0),this.actions.view.justPressed&&this.toggleFirstPersonView()},e.prototype.readAirplaneData=function(t){var e=this;t.scene.traverse((function(t){t.hasOwnProperty("userData")&&t.userData.hasOwnProperty("data")&&("rotor"===t.userData.data&&(e.rotor=t),"rudder"===t.userData.data&&(e.rudder=t),"elevator"===t.userData.data&&e.elevators.push(t),"aileron"===t.userData.data&&t.userData.hasOwnProperty("side")&&("left"===t.userData.side?e.leftAileron=t:"right"===t.userData.side&&(e.rightAileron=t)))}))},e.prototype.inputReceiverInit=function(){t.prototype.inputReceiverInit.call(this),this.world.updateControls([{keys:["Shift"],desc:"Accelerate"},{keys:["Space"],desc:"Decelerate"},{keys:["W","S"],desc:"Elevators"},{keys:["A","D"],desc:"Ailerons"},{keys:["Q","E"],desc:"Rudder / Steering"},{keys:["B"],desc:"Brake"},{keys:["V"],desc:"View select"},{keys:["F"],desc:"Exit vehicle"},{keys:["Shift","+","R"],desc:"Respawn"},{keys:["Shift","+","C"],desc:"Free camera"}])},e}(s.Vehicle);e.Airplane=p},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),a=n(15),s=n(7),c=n(0),l=n(2),u=n(12),h=n(10),p=function(t){function e(e){var n=t.call(this,e,{radius:.25,suspensionStiffness:20,suspensionRestLength:.35,maxSuspensionTravel:1,frictionSlip:.8,dampingRelaxation:2,dampingCompression:2,rollInfluence:.8})||this;return n.entityType=h.EntityType.Car,n.drive="awd",n._speed=0,n.airSpinTimer=0,n.gear=1,n.timeToShift=.2,n.canTiltForwards=!1,n.characterWantsToExit=!1,n.readCarData(e),n.collision.preStep=function(t){n.physicsPreStep(t,n)},n.actions={throttle:new s.KeyBinding("KeyW"),reverse:new s.KeyBinding("KeyS"),brake:new s.KeyBinding("Space"),left:new s.KeyBinding("KeyA"),right:new s.KeyBinding("KeyD"),exitVehicle:new s.KeyBinding("KeyF"),seat_switch:new s.KeyBinding("KeyX"),view:new s.KeyBinding("KeyV")},n.steeringSimulator=new u.SpringSimulator(60,10,.6),n}return r(e,t),Object.defineProperty(e.prototype,"speed",{get:function(){return this._speed},enumerable:!0,configurable:!0}),e.prototype.noDirectionPressed=function(){return!(this.actions.throttle.isPressed||this.actions.reverse.isPressed||this.actions.left.isPressed||this.actions.right.isPressed)},e.prototype.update=function(e){t.prototype.update.call(this,e),this.rayCastVehicle.numWheelsOnGround>0?(this.canTiltForwards=!1,this.airSpinTimer=0):(this.airSpinTimer+=e,this.actions.throttle.isPressed||(this.canTiltForwards=!0));var n={R:-4,0:0,1:5,2:9,3:13,4:17,5:22};if(this.shiftTimer>0)this.shiftTimer-=e,this.shiftTimer<0&&(this.shiftTimer=0);else if(this.actions.reverse.isPressed){var i=(n.R-this.speed)/Math.abs(n.R),r=500/this.gear*Math.pow(Math.abs(i),1);this.applyEngineForce(r)}else{if((i=(n[this.gear]-this.speed)/(n[this.gear]-n[this.gear-1]))<.1&&this.gear<5)this.shiftUp();else if(this.gear>1&&i>1.2)this.shiftDown();else if(this.actions.throttle.isPressed){r=500/this.gear*Math.pow(i,1);this.applyEngineForce(-r)}}if(this.steeringSimulator.simulate(e),this.setSteeringValue(this.steeringSimulator.position),void 0!==this.steeringWheel&&(this.steeringWheel.rotation.z=2*-this.steeringSimulator.position),this.rayCastVehicle.numWheelsOnGround<3&&Math.abs(this.collision.velocity.length())<.5&&this.collision.quaternion.copy(this.collision.initQuaternion),this.characterWantsToExit&&void 0!==this.controllingCharacter&&this.controllingCharacter.charState.canLeaveVehicles){var o=this.collision.velocity.length();o>.1&&o<4?this.triggerAction("brake",!0):this.forceCharacterOut()}},e.prototype.shiftUp=function(){this.gear++,this.shiftTimer=this.timeToShift,this.applyEngineForce(0)},e.prototype.shiftDown=function(){this.gear--,this.shiftTimer=this.timeToShift,this.applyEngineForce(0)},e.prototype.physicsPreStep=function(t,e){var n=l.threeQuat(t.quaternion),i=new c.Vector3(0,0,1).applyQuaternion(n),r=new c.Vector3(1,0,0).applyQuaternion(n),a=new c.Vector3(0,1,0).applyQuaternion(n);this._speed=this.collision.velocity.dot(l.cannonVector(i));var s=c.MathUtils.clamp(this.airSpinTimer/2,0,1);s*=c.MathUtils.clamp(this.speed,0,1);var u=c.MathUtils.clamp(1-this.speed,0,1)*(a.dot(new c.Vector3(0,-1,0))/2+.5)*3,h=this.collision.angularVelocity,p=l.cannonVector(i.clone()),d=l.cannonVector(r.clone()),f=l.cannonVector(i.clone().multiplyScalar(.15*(s+u))),m=l.cannonVector(r.clone().multiplyScalar(.15*s));this.actions.right.isPressed&&!this.actions.left.isPressed?h.dot(p)<2&&h.vadd(f,h):this.actions.left.isPressed&&!this.actions.right.isPressed&&h.dot(p)>-2&&h.vsub(f,h),this.canTiltForwards&&this.actions.throttle.isPressed&&!this.actions.reverse.isPressed?h.dot(d)<2&&h.vadd(m,h):this.actions.reverse.isPressed&&!this.actions.throttle.isPressed&&h.dot(d)>-2&&h.vsub(m,h);var v=(new o.Vec3).copy(this.collision.velocity);v.normalize();var g=l.getSignedAngleBetweenVectors(l.threeVector(v),i),y=c.MathUtils.clamp(.3*this.speed,1,Number.MAX_VALUE);if(this.actions.right.isPressed){var w=Math.min(-.8/y,-g);this.steeringSimulator.target=c.MathUtils.clamp(w,-.8,.8)}else if(this.actions.left.isPressed){w=Math.max(.8/y,-g);this.steeringSimulator.target=c.MathUtils.clamp(w,-.8,.8)}else this.steeringSimulator.target=0;this.seats.forEach((function(t){var e;null===(e=t.door)||void 0===e||e.preStepCallback()}))},e.prototype.onInputChange=function(){t.prototype.onInputChange.call(this);this.actions.exitVehicle.justPressed&&(this.characterWantsToExit=!0),this.actions.exitVehicle.justReleased&&(this.characterWantsToExit=!1,this.triggerAction("brake",!1)),(this.actions.throttle.justReleased||this.actions.reverse.justReleased)&&this.applyEngineForce(0),this.actions.brake.justPressed&&this.setBrake(1e6,"rwd"),this.actions.brake.justReleased&&this.setBrake(0,"rwd"),this.actions.view.justPressed&&this.toggleFirstPersonView()},e.prototype.inputReceiverInit=function(){t.prototype.inputReceiverInit.call(this),this.world.updateControls([{keys:["W","S"],desc:"Accelerate, Brake / Reverse"},{keys:["A","D"],desc:"Steering"},{keys:["Space"],desc:"Handbrake"},{keys:["V"],desc:"View select"},{keys:["F"],desc:"Exit vehicle"},{keys:["Shift","+","R"],desc:"Respawn"},{keys:["Shift","+","C"],desc:"Free camera"}])},e.prototype.readCarData=function(t){var e=this;t.scene.traverse((function(t){t.hasOwnProperty("userData")&&t.userData.hasOwnProperty("data")&&"steering_wheel"===t.userData.data&&(e.steeringWheel=t)}))},e}(a.Vehicle);e.Car=p},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(18),s=n(80),c=n(2),l=function(t){function e(e,n,i){var r=t.call(this,e,n,i)||this;return r.init(),r}return r(e,t),e.prototype.init=function(){this.position=new o.Vector3,this.velocity=new o.Vector3,this.target=new o.Vector3,this.cache=[];for(var t=0;t<2;t++)this.cache.push(new s.SimulationFrameVector(new o.Vector3,new o.Vector3))},e.prototype.simulate=function(t){this.generateFrames(t),this.position.lerpVectors(this.cache[0].position,this.cache[1].position,this.offset/this.frameTime),this.velocity.lerpVectors(this.cache[0].velocity,this.cache[1].velocity,this.offset/this.frameTime)},e.prototype.getFrame=function(t){var e=new s.SimulationFrameVector(this.lastFrame().position.clone(),this.lastFrame().velocity.clone());return c.springV(e.position,this.target,e.velocity,this.mass,this.damping),e},e}(a.SimulatorBase);e.VectorSpringSimulator=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(t,e){this.position=t,this.velocity=e};e.SimulationFrameVector=i},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(18),s=n(2),c=function(t){function e(e,n,i,r,o){void 0===r&&(r=0),void 0===o&&(o=0);var a=t.call(this,e,n,i)||this;a.position=r,a.velocity=o,a.target=0,a.lastLerp=0,a.cache=[];for(var s=0;s<2;s++)a.cache.push({position:r,velocity:o});return a}return r(e,t),e.prototype.simulate=function(t){this.generateFrames(t);var e=o.MathUtils.lerp(0,this.cache[1].position,this.offset/this.frameTime);this.position=e-this.lastLerp,this.lastLerp=e,this.velocity=o.MathUtils.lerp(this.cache[0].velocity,this.cache[1].velocity,this.offset/this.frameTime)},e.prototype.getFrame=function(t){var e=Object.assign({},this.lastFrame());return t&&(e.position=0,this.lastLerp=this.lastLerp-this.lastFrame().position),s.spring(e.position,this.target,e.velocity,this.mass,this.damping)},e}(a.SimulatorBase);e.RelativeSpringSimulator=c},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(2),s=n(5),c=n(8),l=n(83),u=n(16),h=n(25),p=function(t){function e(e,n){var i=t.call(this,e,n)||this;i.exitPoint=n.entryPoints[0],i.endPosition.copy(i.exitPoint.position),i.endPosition.y+=.52;var r=a.detectRelativeSide(n.seatPointObject,i.exitPoint);return r===s.Side.Left?i.playAnimation("stand_up_left",.1):r===s.Side.Right&&i.playAnimation("stand_up_right",.1),i}return r(e,t),e.prototype.update=function(e){if(t.prototype.update.call(this,e),this.animationEnded(e))this.detachCharacterFromVehicle(),this.seat.door.physicsEnabled=!0,this.character.rayHasHit?this.vehicle.collision.velocity.length()>1?(this.character.setState(new h.DropRolling(this.character)),this.character.leaveSeat()):this.anyDirection()||void 0===this.seat.door?(this.character.setState(new c.Idle(this.character)),this.character.leaveSeat()):this.character.setState(new l.CloseVehicleDoorOutside(this.character,this.seat)):(this.character.setState(new u.Falling(this.character)),this.character.leaveSeat());else{this.seat.door&&(this.seat.door.physicsEnabled=!1);var n=this.timer/this.animationLength,i=a.easeInOutSine(n),r=(new o.Vector3).lerpVectors(this.startPosition,this.endPosition,i);this.character.setPosition(r.x,r.y,r.z),this.updateEndRotation(),o.Quaternion.slerp(this.startRotation,this.endRotation,this.character.quaternion,i)}},e}(n(29).ExitingStateBase);e.ExitingVehicle=p},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=n(5),s=n(8),c=n(2),l=function(t){function e(e,n){var i=t.call(this,e)||this;i.hasClosedDoor=!1,i.seat=n,i.canFindVehiclesToEnter=!1;var r=c.detectRelativeSide(n.seatPointObject,n.door.doorObject);return r===a.Side.Left?i.playAnimation("close_door_standing_right",.1):r===a.Side.Right&&i.playAnimation("close_door_standing_left",.1),i}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.timer>.3&&!this.hasClosedDoor&&(this.hasClosedDoor=!0,this.seat.door.close()),this.animationEnded(e)&&(this.character.setState(new s.Idle(this.character)),this.character.leaveSeat())},e}(o.CharacterStateBase);e.CloseVehicleDoorOutside=l},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(3),s=n(5),c=n(8),l=n(28),u=n(2),h=n(12),p=function(t){function e(e,n,i){var r=t.call(this,e)||this;r.hasOpenedDoor=!1,r.startPosition=new o.Vector3,r.endPosition=new o.Vector3,r.startRotation=new o.Quaternion,r.endRotation=new o.Quaternion,r.canFindVehiclesToEnter=!1,r.seat=n,r.entryPoint=i;var a=u.detectRelativeSide(i,n.seatPointObject);return a===s.Side.Left?r.playAnimation("open_door_standing_left",.1):a===s.Side.Right&&r.playAnimation("open_door_standing_right",.1),r.character.resetVelocity(),r.character.rotateModel(),r.character.setPhysicsEnabled(!1),r.character.setPhysicsEnabled(!1),r.seat.vehicle.attach(r.character),r.startPosition.copy(r.character.position),r.endPosition.copy(r.entryPoint.position),r.endPosition.y+=.53,r.startRotation.copy(r.character.quaternion),r.endRotation.copy(r.entryPoint.quaternion),r.factorSimluator=new h.SpringSimulator(60,10,.5),r.factorSimluator.target=1,r}return r(e,t),e.prototype.update=function(e){var n;if(t.prototype.update.call(this,e),this.timer>.3&&!this.hasOpenedDoor&&(this.hasOpenedDoor=!0,null===(n=this.seat.door)||void 0===n||n.open()),this.animationEnded(e))this.anyDirection()?(this.character.vehicleEntryInstance=null,this.character.world.graphicsWorld.attach(this.character),this.character.setPhysicsEnabled(!0),this.character.setState(new c.Idle(this.character))):this.character.setState(new l.EnteringVehicle(this.character,this.seat,this.entryPoint));else{this.factorSimluator.simulate(e);var i=(new o.Vector3).lerpVectors(this.startPosition,this.endPosition,this.factorSimluator.position);this.character.setPosition(i.x,i.y,i.z),o.Quaternion.slerp(this.startRotation,this.endRotation,this.character.quaternion,this.factorSimluator.position)}},e}(a.CharacterStateBase);e.OpenVehicleDoor=p},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(2),s=n(16),c=function(t){function e(e,n){var i=t.call(this,e,n)||this;i.endPosition.copy(i.startPosition),i.endPosition.y+=1;var r=a.threeQuat(n.vehicle.collision.quaternion),s=new o.Vector3(0,0,1).applyQuaternion(r);return i.exitPoint=new o.Object3D,i.exitPoint.lookAt(s),i.exitPoint.position.copy(i.endPosition),i.playAnimation("jump_idle",.1),i}return r(e,t),e.prototype.update=function(e){if(t.prototype.update.call(this,e),this.animationEnded(e))this.detachCharacterFromVehicle(),this.character.setState(new s.Falling(this.character)),this.character.leaveSeat();else{var n=o.MathUtils.clamp((this.timer/this.animationLength-.3)*(1/.7),0,1),i=a.easeOutQuad(n),r=(new o.Vector3).lerpVectors(this.startPosition,this.endPosition,i);this.character.setPosition(r.x,r.y,r.z),this.updateEndRotation(),o.Quaternion.slerp(this.startRotation,this.endRotation,this.character.quaternion,i)}},e}(n(29).ExitingStateBase);e.ExitingAirplane=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),r=n(2),o=function(t){var e={mass:0,position:new i.Vec3,height:.5,radius:.3,segments:8,friction:.3};t=r.setDefaults(t,e),this.options=t;var n=new i.Material("capsuleMat");n.friction=t.friction;var o=new i.Body({mass:t.mass,position:t.position}),a=new i.Sphere(t.radius);o.material=n,o.addShape(a,new i.Vec3(0,0,0)),o.addShape(a,new i.Vec3(0,t.height/2,0)),o.addShape(a,new i.Vec3(0,-t.height/2,0)),this.body=o};e.CapsuleCollider=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=function(){function t(t){this.wantsToDrive=!1,this.character=t}return t.prototype.update=function(t){var e=new i.Vector3;this.entryPoint.getWorldPosition(e);var n=(new i.Vector3).subVectors(e,this.character.position);this.character.setOrientation(n);var r=n.y;n.y=0,this.character.charState.canEnterVehicles&&n.length()<.2&&r<2&&this.character.enterVehicle(this.targetSeat,this.entryPoint)},t}();e.VehicleEntryInstance=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=function(){this.velocity=new i.Vector3};e.GroundImpactData=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){this.closestDistance=Number.POSITIVE_INFINITY,this.maxDistance=Number.POSITIVE_INFINITY,this.referencePosition=t,void 0!==e&&(this.maxDistance=e)}return t.prototype.consider=function(t,e){var n=this.referencePosition.distanceTo(e);nthis.stopDistance?this.isTargetReached=!1:this.isTargetReached=!0;var o=new i.Vector3(0,0,1).applyQuaternion(this.character.controlledObject.quaternion);c.normalize();var a=r.getSignedAngleBetweenVectors(o,c);if(o.dot(c)<0?(this.character.controlledObject.triggerAction("reverse",!0),this.character.controlledObject.triggerAction("throttle",!1)):(this.character.controlledObject.triggerAction("throttle",!0),this.character.controlledObject.triggerAction("reverse",!1)),Math.abs(a)>.3){var s=o.dot(r.threeVector(this.character.controlledObject.collision.velocity));o.dot(c)>0||s>0?a>0?(this.character.controlledObject.triggerAction("left",!0),this.character.controlledObject.triggerAction("right",!1)):(this.character.controlledObject.triggerAction("right",!0),this.character.controlledObject.triggerAction("left",!1)):a>0?(this.character.controlledObject.triggerAction("right",!0),this.character.controlledObject.triggerAction("left",!1)):(this.character.controlledObject.triggerAction("left",!0),this.character.controlledObject.triggerAction("right",!1))}else this.character.controlledObject.triggerAction("left",!1),this.character.controlledObject.triggerAction("right",!1)}else{var c=(new i.Vector3).subVectors(this.target.position,this.character.position);this.character.setViewVector(c),c.length()>this.stopDistance?(this.isTargetReached=!1,this.character.triggerAction("up",!0)):(this.isTargetReached=!0,this.character.triggerAction("up",!1),this.character.setOrientation(c))}},t}();e.FollowTarget=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=n(27),o=n(2),a=function(){function t(t){this.object=t}return t.prototype.spawn=function(t,e){var n=this;t.loadGLTF("build/assets/boxman.glb",(function(t){var a=new r.Character(t),s=new i.Vector3;n.object.getWorldPosition(s),a.setPosition(s.x,s.y,s.z);var c=o.getForward(n.object);a.setOrientation(c,!0),e.add(a),a.takeControl()}))},t}();e.CharacterSpawnPoint=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=n(94),o=function(){function t(t,e){this.updateOrder=10,this.world=e;var n=i.UniformsUtils.clone(r.WaterShader.uniforms);n.iResolution.value.x=window.innerWidth,n.iResolution.value.y=window.innerHeight,this.material=new i.ShaderMaterial({uniforms:n,fragmentShader:r.WaterShader.fragmentShader,vertexShader:r.WaterShader.vertexShader}),t.material=this.material,t.material.transparent=!0}return t.prototype.update=function(t){this.material.uniforms.cameraPos.value.copy(this.world.camera.position),this.material.uniforms.lightDir.value.copy((new i.Vector3).copy(this.world.sky.sunPosition).normalize()),this.material.uniforms.iGlobalTime.value+=t},t}();e.Ocean=o},function(t,e,n){"use strict";n.r(e),n.d(e,"WaterShader",(function(){return r}));const i=n(0);let r={uniforms:{iGlobalTime:{type:"f",value:.1},iResolution:{type:"v2",value:new i.Vector2},cameraPos:{value:new i.Vector3},lightDir:{value:new i.Vector3}},vertexShader:"\n\n varying vec3 vWorldPosition;\n varying vec2 vTexCoord;\n\n void main()\t{\n vec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n vWorldPosition = worldPosition.xyz;\n\n vTexCoord = uv;\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n ",fragmentShader:"\n uniform float iGlobalTime;\n uniform vec2 iResolution;\n uniform vec3 cameraPos;\n uniform vec3 lightDir;\n\n varying vec3 vWorldPosition;\n varying vec2 vTexCoord;\n \n const int NUM_STEPS = 8;\n const float PI\t \t= 3.1415;\n const float EPSILON\t= 1e-3;\n \n // sea variables\n const int ITER_GEOMETRY = 3;\n const int ITER_FRAGMENT = 5;\n const float SEA_HEIGHT = 0.6;\n const float SEA_CHOPPY = 1.0;\n const float SEA_SPEED = 1.0;\n const float SEA_FREQ = 0.16;\n const vec3 SEA_BASE = vec3(0.1,0.19,0.22);\n const vec3 SEA_WATER_COLOR = vec3(0.8,0.9,0.6);\n mat2 octave_m = mat2(1.6,1.2,-1.2,1.6);\n \n mat3 fromEuler(vec3 ang) {\n vec2 a1 = vec2(sin(ang.x),cos(ang.x));\n vec2 a2 = vec2(sin(ang.y),cos(ang.y));\n vec2 a3 = vec2(sin(ang.z),cos(ang.z));\n mat3 m;\n m[0] = vec3(\n a1.y*a3.y+a1.x*a2.x*a3.x,\n a1.y*a2.x*a3.x+a3.y*a1.x,\n -a2.y*a3.x\n );\n m[1] = vec3(-a2.y*a1.x,a1.y*a2.y,a2.x);\n m[2] = vec3(\n a3.y*a1.x*a2.x+a1.y*a3.x,\n a1.x*a3.x-a1.y*a3.y*a2.x,\n a2.y*a3.y\n );\n return m;\n }\n \n float hash( vec2 p ) {\n float h = dot(p,vec2(127.1,311.7));\t\n return fract(sin(h)*43758.5453123);\n }\n \n float noise( in vec2 p ) {\n vec2 i = floor(p);\n vec2 f = fract(p);\t\n vec2 u = f * f * (3.0 - 2.0 * f);\n return -1.0 + 2.0 * mix(\n mix(\n hash(i + vec2(0.0,0.0)\n ), \n hash(i + vec2(1.0,0.0)), u.x),\n mix(hash(i + vec2(0.0,1.0) ), \n hash(i + vec2(1.0,1.0) ), u.x), \n u.y\n );\n }\n \n float diffuse(vec3 n,vec3 l,float p) {\n return pow(dot(n,l) * 0.4 + 0.6,p);\n }\n \n float specular(vec3 n,vec3 l,vec3 e,float s) { \n float nrm = (s + 8.0) / (3.1415 * 8.0);\n return pow(max(dot(reflect(e,n),l),0.0),s) * nrm;\n }\n \n vec3 getSkyColor(vec3 e) {\n e.y = max(e.y, 0.0);\n vec3 ret;\n ret.x = pow(1.0 - e.y, 2.0);\n ret.y = 1.0 - e.y;\n ret.z = 0.6+(1.0 - e.y) * 0.4;\n return ret;\n }\n \n \n float sea_octave(vec2 uv, float choppy) {\n uv += noise(uv); \n vec2 wv = 1.0 - abs(sin(uv));\n vec2 swv = abs(cos(uv)); \n wv = mix(wv, swv, wv);\n return pow(1.0 - pow(wv.x * wv.y, 0.65), choppy);\n }\n \n float map(vec3 p) {\n float freq = SEA_FREQ;\n float amp = SEA_HEIGHT ;\n float choppy = SEA_CHOPPY;\n vec2 uv = p.xz; \n uv.x *= 0.75;\n \n\t float SEA_TIME = iGlobalTime * SEA_SPEED;\n float d, h = 0.0; \n for(int i = 0; i < ITER_GEOMETRY; i++) { \n d = sea_octave((uv + SEA_TIME) * freq, choppy);\n d += sea_octave((uv - SEA_TIME) * freq, choppy);\n h += d * amp; \n uv *= octave_m;\n freq *= 1.9; \n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n return p.y - h;\n }\n \n float map_detailed(vec3 p) {\n float freq = SEA_FREQ;\n float amp = SEA_HEIGHT;\n float choppy = SEA_CHOPPY;\n vec2 uv = p.xz;\n uv.x *= 0.75;\n \n\t\tfloat SEA_TIME = iGlobalTime * SEA_SPEED;\n float d, h = 0.0; \n for(int i = 0; i < ITER_FRAGMENT; i++) { \n d = sea_octave((uv+SEA_TIME) * freq, choppy);\n d += sea_octave((uv-SEA_TIME) * freq, choppy);\n h += d * amp; \n uv *= octave_m;\n freq *= 1.9; \n amp *= 0.22;\n choppy = mix(choppy,1.0,0.2);\n }\n return p.y - h;\n }\n \n vec3 getSeaColor(\n vec3 p,\n vec3 n, \n vec3 l, \n vec3 eye, \n vec3 dist\n ) { \n float fresnel = 1.0 - max(dot(n,-eye),0.0);\n fresnel = pow(fresnel,3.0) * 0.65;\n \n vec3 reflected = getSkyColor(reflect(eye,n)); \n vec3 refracted = SEA_BASE + diffuse(n,l,80.0) * SEA_WATER_COLOR * 0.12; \n \n vec3 color = mix(refracted,reflected,fresnel);\n \n float atten = max(1.0 - dot(dist,dist) * 0.001, 0.0);\n color += SEA_WATER_COLOR * (p.y - SEA_HEIGHT) * 0.18 * atten;\n \n float night = dot(l, vec3(0.0, 1.0, 0.0));\n night = clamp(night + 0.1, 0.0, 0.5) * 2.0;\n color *= vec3(night);\n\n color += vec3(specular(n,l,eye,60.0));\n \n return color;\n }\n \n // tracing\n vec3 getNormal(vec3 p, float eps) {\n vec3 n;\n n.y = map_detailed(p); \n n.x = map_detailed(vec3(p.x+eps,p.y,p.z)) - n.y;\n n.z = map_detailed(vec3(p.x,p.y,p.z+eps)) - n.y;\n n.y = eps;\n return normalize(n);\n }\n \n float heightMapTracing(vec3 ori, vec3 dir, out vec3 p) { \n\n vec3 oriComp = ori;\n oriComp.y -= vWorldPosition.y - SEA_HEIGHT;\n\n float tm = 0.0;\n float tx = 1000.0;\n float hx = map(oriComp + dir * tx);\n\n if(hx > 0.0) {\n return tx; \n }\n \n float hm = map(oriComp + dir * tm); \n float tmid = 0.0;\n for(int i = 0; i < NUM_STEPS; i++) {\n tmid = mix(tm,tx, hm/(hm-hx)); \n p = oriComp + dir * tmid; \n float hmid = map(p);\n if(hmid < 0.0) {\n tx = tmid;\n hx = hmid;\n } else {\n tm = tmid;\n hm = hmid;\n }\n }\n\n return tmid;\n }\n \n void main() {\n float time = iGlobalTime * 0.3;\n \n // ray\n vec3 ang = vec3(\n sin(time*3.0)*0.1,sin(time)*0.2+0.3,time\n ); \n\n vec3 dir = normalize( vWorldPosition - cameraPos );\n \n // tracing\n vec3 p;\n heightMapTracing(cameraPos,dir,p);\n\t vec3 dist = vWorldPosition - cameraPos;\n\t float EPSILON_NRM\t= 0.1 / iResolution.x;\n vec3 n = getNormal(\n p,\n dot(dist,dist) * EPSILON_NRM\n );\n \n // color\n vec3 color = mix(\n getSkyColor(dir),\n getSeaColor(p,n,lightDir,dir,dist),\n pow(smoothstep(0.0,-0.05,dir.y),0.3)\n );\n \n // post\n gl_FragColor = vec4(pow(color,vec3(0.8)), 1.0) * 1.2;\n\n float fogfac = clamp(length(dist), 300.0, 600.0);\n fogfac -= 300.0;\n fogfac /= 300.0;\n gl_FragColor.a = 1.0 - fogfac;\n\n #if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n #endif\n }\n "}},function(t,e,n){"use strict";n.r(e);var i=n(0),r={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 texel = texture2D( tDiffuse, vUv );","\tgl_FragColor = opacity * texel;","}"].join("\n")},o=n(13),a=n(4),s=function(t,e){a.a.call(this),this.scene=t,this.camera=e,this.clear=!0,this.needsSwap=!1,this.inverse=!1};s.prototype=Object.assign(Object.create(a.a.prototype),{constructor:s,render:function(t,e,n){var i,r,o=t.getContext(),a=t.state;a.buffers.color.setMask(!1),a.buffers.depth.setMask(!1),a.buffers.color.setLocked(!0),a.buffers.depth.setLocked(!0),this.inverse?(i=0,r=1):(i=1,r=0),a.buffers.stencil.setTest(!0),a.buffers.stencil.setOp(o.REPLACE,o.REPLACE,o.REPLACE),a.buffers.stencil.setFunc(o.ALWAYS,i,4294967295),a.buffers.stencil.setClear(r),a.buffers.stencil.setLocked(!0),t.setRenderTarget(n),this.clear&&t.clear(),t.render(this.scene,this.camera),t.setRenderTarget(e),this.clear&&t.clear(),t.render(this.scene,this.camera),a.buffers.color.setLocked(!1),a.buffers.depth.setLocked(!1),a.buffers.stencil.setLocked(!1),a.buffers.stencil.setFunc(o.EQUAL,1,4294967295),a.buffers.stencil.setOp(o.KEEP,o.KEEP,o.KEEP),a.buffers.stencil.setLocked(!0)}});var c=function(){a.a.call(this),this.needsSwap=!1};c.prototype=Object.create(a.a.prototype),Object.assign(c.prototype,{render:function(t){t.state.buffers.stencil.setLocked(!1),t.state.buffers.stencil.setTest(!1)}}),n.d(e,"EffectComposer",(function(){return l})),n.d(e,"Pass",(function(){return d}));var l=function(t,e){if(this.renderer=t,void 0===e){var n={minFilter:i.LinearFilter,magFilter:i.LinearFilter,format:i.RGBAFormat,stencilBuffer:!1},a=t.getSize(new i.Vector2);this._pixelRatio=t.getPixelRatio(),this._width=a.width,this._height=a.height,(e=new i.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio,n)).texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=e.width,this._height=e.height;this.renderTarget1=e,this.renderTarget2=e.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],void 0===r&&console.error("THREE.EffectComposer relies on CopyShader"),void 0===o.ShaderPass&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new o.ShaderPass(r),this.clock=new i.Clock};Object.assign(l.prototype,{swapBuffers:function(){var t=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=t},addPass:function(t){this.passes.push(t),t.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)},insertPass:function(t,e){this.passes.splice(e,0,t)},isLastEnabledPass:function(t){for(var e=t+1;e0&&r[e[a].x/3]>0;);a+10&&(t.visiblePoints=e.splice(a+1))}function A(t,e){for(var n,i=x.length,r=[t],o=e.indexOf(t.visiblePoints.pop());i-- >0;)(n=x[i])!==t&&M(n,e).dot(v.subVectors(e[o],e[n[0]]))>0&&r.push(n);var a,s,c,l,u=i=r.length,h=1===i,p=[],d=0,f=[];r[0][0],r[0][1],r[0][1],r[0][2],r[0][2],r[0][0];if(1===r.length)p=[(n=r[0])[0],n[1],n[1],n[2],n[2],n[0]],_.indexOf(n)>-1&&_.splice(_.indexOf(n),1),n.visiblePoints&&(f=f.concat(n.visiblePoints)),x.splice(x.indexOf(n),1);else for(;i-- >0;){var m;for(n=r[i],_.indexOf(n)>-1&&_.splice(_.indexOf(n),1),n.visiblePoints&&(f=f.concat(n.visiblePoints)),x.splice(x.indexOf(n),1),cEdgeIndex=0;cEdgeIndex<3;){for(m=!1,u=r.length,c=n[cEdgeIndex],l=n[(cEdgeIndex+1)%3];u-- >0&&!m;)if(d=0,(a=r[u])!==n)for(;d<3&&!m;)s=d+1,m=a[d]===c&&a[s%3]===l||a[d]===l&&a[s%3]===c,d++;m&&!h||(p.push(c),p.push(l)),cEdgeIndex++}}i=0;for(var g,y=p.length/2;i=s?n.dot(n):e.dot(e)-a*a/s}}();return function(M){for(h=new i.Vector3,p=new i.Vector3,new i.Vector3,d=new i.Vector3,f=new i.Vector3,m=new i.Vector3,v=new i.Vector3,g=new i.Vector3,y=new i.Vector3,w=new i.Vector3,points=M.vertices,x=[],_=[],I=t=points.length,e=points.slice(0,6),b=0;I-- >0;)points[I].xe[1].x&&(e[1]=points[I]),points[I].y0;)for(r=I-1;r-- >0;)b<(n=e[I].distanceToSquared(e[r]))&&(b=n,o=e[I],a=e[r]);for(I=6,b=0;I-- >0;)n=T(o,a,e[I]),b0;)n=Math.abs(points[I].dot(l)-u),b0;)E(O[I],F,points),void 0!==O[I].visiblePoints&&_.push(O[I]),x.push(O[I]);!function(t){for(;_.length>0;)A(_.shift(),t)}(points);for(var N=x.length;N-- >0;)M.faces[N]=new i.Face3(x[N][2],x[N][1],x[N][0],x[N].normal);return M.normalsNeedUpdate=!0,M}}();n.d(e,"threeToCannon",(function(){return c}));var a=Math.PI/2,s={BOX:"Box",CYLINDER:"Cylinder",SPHERE:"Sphere",HULL:"ConvexPolyhedron",MESH:"Trimesh"};const c=function(t,e){var n;if((e=e||{}).type===s.BOX)return u(t);if(e.type===s.CYLINDER)return function(t,e){var n,o,s,c=new i.Box3,l=["x","y","z"],u=e.cylinderAxis||"y",h=l.splice(l.indexOf(u),1)&&l;return c.setFromObject(t),isFinite(c.min.lengthSq())?(o=c.max[u]-c.min[u],s=.5*Math.max(c.max[h[0]]-c.min[h[0]],c.max[h[1]]-c.min[h[1]]),(n=new r.Cylinder(s,s,o,12))._type=r.Shape.types.CYLINDER,n.radiusTop=s,n.radiusBottom=s,n.height=o,n.numSegments=12,n.orientation=new r.Quaternion,n.orientation.setFromEuler("y"===u?a:0,"z"===u?a:0,0,"XYZ").normalize(),n):null}(t,e);if(e.type===s.SPHERE)return function(t,e){if(e.sphereRadius)return new r.Sphere(e.sphereRadius);var n=h(t);return n?(n.computeBoundingSphere(),new r.Sphere(n.boundingSphere.radius)):null}(t,e);if(e.type===s.HULL)return function(t){var e,n,i,a,s=h(t);if(!s||!s.vertices.length)return null;for(e=0;e2&&o.fromBufferGeometry(r[0].geometry):o=r[0].geometry.clone(),o.metadata=r[0].geometry.metadata,r[0].updateMatrixWorld(),r[0].matrixWorld.decompose(s,c,l),o.scale(l.x,l.y,l.z)}for(;n=r.pop();)if(n.updateMatrixWorld(),n.geometry.isBufferGeometry){if(n.geometry.attributes.position&&n.geometry.attributes.position.itemSize>2){var u=new i.Geometry;u.fromBufferGeometry(n.geometry),a.merge(u,n.matrixWorld),u.dispose()}}else a.merge(n.geometry,n.matrixWorld);return(e=new i.Matrix4).scale(t.scale),a.applyMatrix(e),a}function p(t){return t.attributes||(t=(new i.BufferGeometry).fromGeometry(t)),(t.attributes.position||{}).array||[]}c.Type=s}])})); \ No newline at end of file + */(function(){var o,a=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",l="__lodash_hash_undefined__",u=500,h="__lodash_placeholder__",p=1,d=2,f=4,m=1,v=2,g=1,y=2,w=4,x=8,_=16,b=32,S=64,M=128,E=256,A=512,T=30,P="...",L=800,C=16,R=1,O=2,F=1/0,I=9007199254740991,N=17976931348623157e292,B=NaN,D=4294967295,z=D-1,V=D>>>1,U=[["ary",M],["bind",g],["bindKey",y],["curry",x],["curryRight",_],["flip",A],["partial",b],["partialRight",S],["rearg",E]],k="[object Arguments]",j="[object Array]",H="[object AsyncFunction]",G="[object Boolean]",W="[object Date]",q="[object DOMException]",X="[object Error]",Y="[object Function]",Q="[object GeneratorFunction]",K="[object Map]",Z="[object Number]",J="[object Null]",$="[object Object]",tt="[object Proxy]",et="[object RegExp]",nt="[object Set]",it="[object String]",rt="[object Symbol]",ot="[object Undefined]",at="[object WeakMap]",st="[object WeakSet]",ct="[object ArrayBuffer]",lt="[object DataView]",ut="[object Float32Array]",ht="[object Float64Array]",pt="[object Int8Array]",dt="[object Int16Array]",ft="[object Int32Array]",mt="[object Uint8Array]",vt="[object Uint8ClampedArray]",gt="[object Uint16Array]",yt="[object Uint32Array]",wt=/\b__p \+= '';/g,xt=/\b(__p \+=) '' \+/g,_t=/(__e\(.*?\)|\b__t\)) \+\n'';/g,bt=/&(?:amp|lt|gt|quot|#39);/g,St=/[&<>"']/g,Mt=RegExp(bt.source),Et=RegExp(St.source),At=/<%-([\s\S]+?)%>/g,Tt=/<%([\s\S]+?)%>/g,Pt=/<%=([\s\S]+?)%>/g,Lt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ct=/^\w*$/,Rt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ot=/[\\^$.*+?()[\]{}|]/g,Ft=RegExp(Ot.source),It=/^\s+|\s+$/g,Nt=/^\s+/,Bt=/\s+$/,Dt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,zt=/\{\n\/\* \[wrapped with (.+)\] \*/,Vt=/,? & /,Ut=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,kt=/\\(\\)?/g,jt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ht=/\w*$/,Gt=/^[-+]0x[0-9a-f]+$/i,Wt=/^0b[01]+$/i,qt=/^\[object .+?Constructor\]$/,Xt=/^0o[0-7]+$/i,Yt=/^(?:0|[1-9]\d*)$/,Qt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Kt=/($^)/,Zt=/['\n\r\u2028\u2029\\]/g,Jt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",$t="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",te="[\\ud800-\\udfff]",ee="["+$t+"]",ne="["+Jt+"]",ie="\\d+",re="[\\u2700-\\u27bf]",oe="[a-z\\xdf-\\xf6\\xf8-\\xff]",ae="[^\\ud800-\\udfff"+$t+ie+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",se="\\ud83c[\\udffb-\\udfff]",ce="[^\\ud800-\\udfff]",le="(?:\\ud83c[\\udde6-\\uddff]){2}",ue="[\\ud800-\\udbff][\\udc00-\\udfff]",he="[A-Z\\xc0-\\xd6\\xd8-\\xde]",pe="(?:"+oe+"|"+ae+")",de="(?:"+he+"|"+ae+")",fe="(?:"+ne+"|"+se+")"+"?",me="[\\ufe0e\\ufe0f]?"+fe+("(?:\\u200d(?:"+[ce,le,ue].join("|")+")[\\ufe0e\\ufe0f]?"+fe+")*"),ve="(?:"+[re,le,ue].join("|")+")"+me,ge="(?:"+[ce+ne+"?",ne,le,ue,te].join("|")+")",ye=RegExp("['’]","g"),we=RegExp(ne,"g"),xe=RegExp(se+"(?="+se+")|"+ge+me,"g"),_e=RegExp([he+"?"+oe+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[ee,he,"$"].join("|")+")",de+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[ee,he+pe,"$"].join("|")+")",he+"?"+pe+"+(?:['’](?:d|ll|m|re|s|t|ve))?",he+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ie,ve].join("|"),"g"),be=RegExp("[\\u200d\\ud800-\\udfff"+Jt+"\\ufe0e\\ufe0f]"),Se=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Me=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ee=-1,Ae={};Ae[ut]=Ae[ht]=Ae[pt]=Ae[dt]=Ae[ft]=Ae[mt]=Ae[vt]=Ae[gt]=Ae[yt]=!0,Ae[k]=Ae[j]=Ae[ct]=Ae[G]=Ae[lt]=Ae[W]=Ae[X]=Ae[Y]=Ae[K]=Ae[Z]=Ae[$]=Ae[et]=Ae[nt]=Ae[it]=Ae[at]=!1;var Te={};Te[k]=Te[j]=Te[ct]=Te[lt]=Te[G]=Te[W]=Te[ut]=Te[ht]=Te[pt]=Te[dt]=Te[ft]=Te[K]=Te[Z]=Te[$]=Te[et]=Te[nt]=Te[it]=Te[rt]=Te[mt]=Te[vt]=Te[gt]=Te[yt]=!0,Te[X]=Te[Y]=Te[at]=!1;var Pe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Le=parseFloat,Ce=parseInt,Re="object"==typeof t&&t&&t.Object===Object&&t,Oe="object"==typeof self&&self&&self.Object===Object&&self,Fe=Re||Oe||Function("return this")(),Ie=e&&!e.nodeType&&e,Ne=Ie&&"object"==typeof i&&i&&!i.nodeType&&i,Be=Ne&&Ne.exports===Ie,De=Be&&Re.process,ze=function(){try{var t=Ne&&Ne.require&&Ne.require("util").types;return t||De&&De.binding&&De.binding("util")}catch(t){}}(),Ve=ze&&ze.isArrayBuffer,Ue=ze&&ze.isDate,ke=ze&&ze.isMap,je=ze&&ze.isRegExp,He=ze&&ze.isSet,Ge=ze&&ze.isTypedArray;function We(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function qe(t,e,n,i){for(var r=-1,o=null==t?0:t.length;++r-1}function Je(t,e,n){for(var i=-1,r=null==t?0:t.length;++i-1;);return n}function _n(t,e){for(var n=t.length;n--&&cn(e,t[n],0)>-1;);return n}var bn=dn({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Sn=dn({"&":"&","<":"<",">":">",'"':""","'":"'"});function Mn(t){return"\\"+Pe[t]}function En(t){return be.test(t)}function An(t){var e=-1,n=Array(t.size);return t.forEach((function(t,i){n[++e]=[i,t]})),n}function Tn(t,e){return function(n){return t(e(n))}}function Pn(t,e){for(var n=-1,i=t.length,r=0,o=[];++n",""":'"',"'":"'"});var In=function t(e){var n,i=(e=null==e?Fe:In.defaults(Fe.Object(),e,In.pick(Fe,Me))).Array,r=e.Date,Jt=e.Error,$t=e.Function,te=e.Math,ee=e.Object,ne=e.RegExp,ie=e.String,re=e.TypeError,oe=i.prototype,ae=$t.prototype,se=ee.prototype,ce=e["__core-js_shared__"],le=ae.toString,ue=se.hasOwnProperty,he=0,pe=(n=/[^.]+$/.exec(ce&&ce.keys&&ce.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",de=se.toString,fe=le.call(ee),me=Fe._,ve=ne("^"+le.call(ue).replace(Ot,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ge=Be?e.Buffer:o,xe=e.Symbol,be=e.Uint8Array,Pe=ge?ge.allocUnsafe:o,Re=Tn(ee.getPrototypeOf,ee),Oe=ee.create,Ie=se.propertyIsEnumerable,Ne=oe.splice,De=xe?xe.isConcatSpreadable:o,ze=xe?xe.iterator:o,on=xe?xe.toStringTag:o,dn=function(){try{var t=Vo(ee,"defineProperty");return t({},"",{}),t}catch(t){}}(),Nn=e.clearTimeout!==Fe.clearTimeout&&e.clearTimeout,Bn=r&&r.now!==Fe.Date.now&&r.now,Dn=e.setTimeout!==Fe.setTimeout&&e.setTimeout,zn=te.ceil,Vn=te.floor,Un=ee.getOwnPropertySymbols,kn=ge?ge.isBuffer:o,jn=e.isFinite,Hn=oe.join,Gn=Tn(ee.keys,ee),Wn=te.max,qn=te.min,Xn=r.now,Yn=e.parseInt,Qn=te.random,Kn=oe.reverse,Zn=Vo(e,"DataView"),Jn=Vo(e,"Map"),$n=Vo(e,"Promise"),ti=Vo(e,"Set"),ei=Vo(e,"WeakMap"),ni=Vo(ee,"create"),ii=ei&&new ei,ri={},oi=ha(Zn),ai=ha(Jn),si=ha($n),ci=ha(ti),li=ha(ei),ui=xe?xe.prototype:o,hi=ui?ui.valueOf:o,pi=ui?ui.toString:o;function di(t){if(Ps(t)&&!gs(t)&&!(t instanceof gi)){if(t instanceof vi)return t;if(ue.call(t,"__wrapped__"))return pa(t)}return new vi(t)}var fi=function(){function t(){}return function(e){if(!Ts(e))return{};if(Oe)return Oe(e);t.prototype=e;var n=new t;return t.prototype=o,n}}();function mi(){}function vi(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=o}function gi(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=D,this.__views__=[]}function yi(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function Ni(t,e,n,i,r,a){var s,c=e&p,l=e&d,u=e&f;if(n&&(s=r?n(t,i,r,a):n(t)),s!==o)return s;if(!Ts(t))return t;var h=gs(t);if(h){if(s=function(t){var e=t.length,n=new t.constructor(e);e&&"string"==typeof t[0]&&ue.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!c)return no(t,s)}else{var m=jo(t),v=m==Y||m==Q;if(_s(t))return Kr(t,c);if(m==$||m==k||v&&!r){if(s=l||v?{}:Go(t),!c)return l?function(t,e){return io(t,ko(t),e)}(t,function(t,e){return t&&io(e,oc(e),t)}(s,t)):function(t,e){return io(t,Uo(t),e)}(t,Ri(s,t))}else{if(!Te[m])return r?t:{};s=function(t,e,n){var i=t.constructor;switch(e){case ct:return Zr(t);case G:case W:return new i(+t);case lt:return function(t,e){var n=e?Zr(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case ut:case ht:case pt:case dt:case ft:case mt:case vt:case gt:case yt:return Jr(t,n);case K:return new i;case Z:case it:return new i(t);case et:return function(t){var e=new t.constructor(t.source,Ht.exec(t));return e.lastIndex=t.lastIndex,e}(t);case nt:return new i;case rt:return r=t,hi?ee(hi.call(r)):{}}var r}(t,m,c)}}a||(a=new bi);var g=a.get(t);if(g)return g;a.set(t,s),Fs(t)?t.forEach((function(i){s.add(Ni(i,e,n,i,t,a))})):Ls(t)&&t.forEach((function(i,r){s.set(r,Ni(i,e,n,r,t,a))}));var y=h?o:(u?l?Oo:Ro:l?oc:rc)(t);return Xe(y||t,(function(i,r){y&&(i=t[r=i]),Pi(s,r,Ni(i,e,n,r,t,a))})),s}function Bi(t,e,n){var i=n.length;if(null==t)return!i;for(t=ee(t);i--;){var r=n[i],a=e[r],s=t[r];if(s===o&&!(r in t)||!a(s))return!1}return!0}function Di(t,e,n){if("function"!=typeof t)throw new re(c);return ra((function(){t.apply(o,n)}),e)}function zi(t,e,n,i){var r=-1,o=Ze,s=!0,c=t.length,l=[],u=e.length;if(!c)return l;n&&(e=$e(e,gn(n))),i?(o=Je,s=!1):e.length>=a&&(o=wn,s=!1,e=new _i(e));t:for(;++r-1},wi.prototype.set=function(t,e){var n=this.__data__,i=Li(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this},xi.prototype.clear=function(){this.size=0,this.__data__={hash:new yi,map:new(Jn||wi),string:new yi}},xi.prototype.delete=function(t){var e=Do(this,t).delete(t);return this.size-=e?1:0,e},xi.prototype.get=function(t){return Do(this,t).get(t)},xi.prototype.has=function(t){return Do(this,t).has(t)},xi.prototype.set=function(t,e){var n=Do(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this},_i.prototype.add=_i.prototype.push=function(t){return this.__data__.set(t,l),this},_i.prototype.has=function(t){return this.__data__.has(t)},bi.prototype.clear=function(){this.__data__=new wi,this.size=0},bi.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},bi.prototype.get=function(t){return this.__data__.get(t)},bi.prototype.has=function(t){return this.__data__.has(t)},bi.prototype.set=function(t,e){var n=this.__data__;if(n instanceof wi){var i=n.__data__;if(!Jn||i.length0&&n(s)?e>1?Gi(s,e-1,n,i,r):tn(r,s):i||(r[r.length]=s)}return r}var Wi=so(),qi=so(!0);function Xi(t,e){return t&&Wi(t,e,rc)}function Yi(t,e){return t&&qi(t,e,rc)}function Qi(t,e){return Ke(e,(function(e){return Ms(t[e])}))}function Ki(t,e){for(var n=0,i=(e=qr(e,t)).length;null!=t&&ne}function tr(t,e){return null!=t&&ue.call(t,e)}function er(t,e){return null!=t&&e in ee(t)}function nr(t,e,n){for(var r=n?Je:Ze,a=t[0].length,s=t.length,c=s,l=i(s),u=1/0,h=[];c--;){var p=t[c];c&&e&&(p=$e(p,gn(e))),u=qn(p.length,u),l[c]=!n&&(e||a>=120&&p.length>=120)?new _i(c&&p):o}p=t[0];var d=-1,f=l[0];t:for(;++d=s)return c;var l=n[i];return c*("desc"==l?-1:1)}}return t.index-e.index}(t,e,n)}))}function yr(t,e,n){for(var i=-1,r=e.length,o={};++i-1;)s!==t&&Ne.call(s,c,1),Ne.call(t,c,1);return t}function xr(t,e){for(var n=t?e.length:0,i=n-1;n--;){var r=e[n];if(n==i||r!==o){var o=r;qo(r)?Ne.call(t,r,1):zr(t,r)}}return t}function _r(t,e){return t+Vn(Qn()*(e-t+1))}function br(t,e){var n="";if(!t||e<1||e>I)return n;do{e%2&&(n+=t),(e=Vn(e/2))&&(t+=t)}while(e);return n}function Sr(t,e){return oa(ta(t,e,Cc),t+"")}function Mr(t){return Mi(dc(t))}function Er(t,e){var n=dc(t);return ca(n,Ii(e,0,n.length))}function Ar(t,e,n,i){if(!Ts(t))return t;for(var r=-1,a=(e=qr(e,t)).length,s=a-1,c=t;null!=c&&++ro?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var a=i(o);++r>>1,a=t[o];null!==a&&!Ns(a)&&(n?a<=e:a=a){var u=e?null:So(t);if(u)return Ln(u);s=!1,r=wn,l=new _i}else l=e?[]:c;t:for(;++i=i?t:Cr(t,e,n)}var Qr=Nn||function(t){return Fe.clearTimeout(t)};function Kr(t,e){if(e)return t.slice();var n=t.length,i=Pe?Pe(n):new t.constructor(n);return t.copy(i),i}function Zr(t){var e=new t.constructor(t.byteLength);return new be(e).set(new be(t)),e}function Jr(t,e){var n=e?Zr(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function $r(t,e){if(t!==e){var n=t!==o,i=null===t,r=t==t,a=Ns(t),s=e!==o,c=null===e,l=e==e,u=Ns(e);if(!c&&!u&&!a&&t>e||a&&s&&l&&!c&&!u||i&&s&&l||!n&&l||!r)return 1;if(!i&&!a&&!u&&t1?n[r-1]:o,s=r>2?n[2]:o;for(a=t.length>3&&"function"==typeof a?(r--,a):o,s&&Xo(n[0],n[1],s)&&(a=r<3?o:a,r=1),e=ee(e);++i-1?r[a?e[s]:s]:o}}function po(t){return Co((function(e){var n=e.length,i=n,r=vi.prototype.thru;for(t&&e.reverse();i--;){var a=e[i];if("function"!=typeof a)throw new re(c);if(r&&!s&&"wrapper"==Io(a))var s=new vi([],!0)}for(i=s?i:n;++i1&&x.reverse(),p&&uc))return!1;var u=a.get(t),h=a.get(e);if(u&&h)return u==e&&h==t;var p=-1,d=!0,f=n&v?new _i:o;for(a.set(t,e),a.set(e,t);++p-1&&t%1==0&&t1?"& ":"")+e[i],e=e.join(n>2?", ":" "),t.replace(Dt,"{\n/* [wrapped with "+e+"] */\n")}(i,function(t,e){return Xe(U,(function(n){var i="_."+n[0];e&n[1]&&!Ze(t,i)&&t.push(i)})),t.sort()}(function(t){var e=t.match(zt);return e?e[1].split(Vt):[]}(i),n)))}function sa(t){var e=0,n=0;return function(){var i=Xn(),r=C-(i-n);if(n=i,r>0){if(++e>=L)return arguments[0]}else e=0;return t.apply(o,arguments)}}function ca(t,e){var n=-1,i=t.length,r=i-1;for(e=e===o?i:e;++n1?t[e-1]:o;return n="function"==typeof n?(t.pop(),n):o,Oa(t,n)}));function Va(t){var e=di(t);return e.__chain__=!0,e}function Ua(t,e){return e(t)}var ka=Co((function(t){var e=t.length,n=e?t[0]:0,i=this.__wrapped__,r=function(e){return Fi(e,t)};return!(e>1||this.__actions__.length)&&i instanceof gi&&qo(n)?((i=i.slice(n,+n+(e?1:0))).__actions__.push({func:Ua,args:[r],thisArg:o}),new vi(i,this.__chain__).thru((function(t){return e&&!t.length&&t.push(o),t}))):this.thru(r)}));var ja=ro((function(t,e,n){ue.call(t,n)?++t[n]:Oi(t,n,1)}));var Ha=ho(va),Ga=ho(ga);function Wa(t,e){return(gs(t)?Xe:Vi)(t,Bo(e,3))}function qa(t,e){return(gs(t)?Ye:Ui)(t,Bo(e,3))}var Xa=ro((function(t,e,n){ue.call(t,n)?t[n].push(e):Oi(t,n,[e])}));var Ya=Sr((function(t,e,n){var r=-1,o="function"==typeof e,a=ws(t)?i(t.length):[];return Vi(t,(function(t){a[++r]=o?We(e,t,n):ir(t,e,n)})),a})),Qa=ro((function(t,e,n){Oi(t,n,e)}));function Ka(t,e){return(gs(t)?$e:pr)(t,Bo(e,3))}var Za=ro((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]}));var Ja=Sr((function(t,e){if(null==t)return[];var n=e.length;return n>1&&Xo(t,e[0],e[1])?e=[]:n>2&&Xo(e[0],e[1],e[2])&&(e=[e[0]]),gr(t,Gi(e,1),[])})),$a=Bn||function(){return Fe.Date.now()};function ts(t,e,n){return e=n?o:e,e=t&&null==e?t.length:e,Eo(t,M,o,o,o,o,e)}function es(t,e){var n;if("function"!=typeof e)throw new re(c);return t=ks(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=o),n}}var ns=Sr((function(t,e,n){var i=g;if(n.length){var r=Pn(n,No(ns));i|=b}return Eo(t,i,e,n,r)})),is=Sr((function(t,e,n){var i=g|y;if(n.length){var r=Pn(n,No(is));i|=b}return Eo(e,i,t,n,r)}));function rs(t,e,n){var i,r,a,s,l,u,h=0,p=!1,d=!1,f=!0;if("function"!=typeof t)throw new re(c);function m(e){var n=i,a=r;return i=r=o,h=e,s=t.apply(a,n)}function v(t){var n=t-u;return u===o||n>=e||n<0||d&&t-h>=a}function g(){var t=$a();if(v(t))return y(t);l=ra(g,function(t){var n=e-(t-u);return d?qn(n,a-(t-h)):n}(t))}function y(t){return l=o,f&&i?m(t):(i=r=o,s)}function w(){var t=$a(),n=v(t);if(i=arguments,r=this,u=t,n){if(l===o)return function(t){return h=t,l=ra(g,e),p?m(t):s}(u);if(d)return Qr(l),l=ra(g,e),m(u)}return l===o&&(l=ra(g,e)),s}return e=Hs(e)||0,Ts(n)&&(p=!!n.leading,a=(d="maxWait"in n)?Wn(Hs(n.maxWait)||0,e):a,f="trailing"in n?!!n.trailing:f),w.cancel=function(){l!==o&&Qr(l),h=0,i=u=r=l=o},w.flush=function(){return l===o?s:y($a())},w}var os=Sr((function(t,e){return Di(t,1,e)})),as=Sr((function(t,e,n){return Di(t,Hs(e)||0,n)}));function ss(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new re(c);var n=function(){var i=arguments,r=e?e.apply(this,i):i[0],o=n.cache;if(o.has(r))return o.get(r);var a=t.apply(this,i);return n.cache=o.set(r,a)||o,a};return n.cache=new(ss.Cache||xi),n}function cs(t){if("function"!=typeof t)throw new re(c);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}ss.Cache=xi;var ls=Xr((function(t,e){var n=(e=1==e.length&&gs(e[0])?$e(e[0],gn(Bo())):$e(Gi(e,1),gn(Bo()))).length;return Sr((function(i){for(var r=-1,o=qn(i.length,n);++r=e})),vs=rr(function(){return arguments}())?rr:function(t){return Ps(t)&&ue.call(t,"callee")&&!Ie.call(t,"callee")},gs=i.isArray,ys=Ve?gn(Ve):function(t){return Ps(t)&&Ji(t)==ct};function ws(t){return null!=t&&As(t.length)&&!Ms(t)}function xs(t){return Ps(t)&&ws(t)}var _s=kn||Hc,bs=Ue?gn(Ue):function(t){return Ps(t)&&Ji(t)==W};function Ss(t){if(!Ps(t))return!1;var e=Ji(t);return e==X||e==q||"string"==typeof t.message&&"string"==typeof t.name&&!Rs(t)}function Ms(t){if(!Ts(t))return!1;var e=Ji(t);return e==Y||e==Q||e==H||e==tt}function Es(t){return"number"==typeof t&&t==ks(t)}function As(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=I}function Ts(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Ps(t){return null!=t&&"object"==typeof t}var Ls=ke?gn(ke):function(t){return Ps(t)&&jo(t)==K};function Cs(t){return"number"==typeof t||Ps(t)&&Ji(t)==Z}function Rs(t){if(!Ps(t)||Ji(t)!=$)return!1;var e=Re(t);if(null===e)return!0;var n=ue.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&le.call(n)==fe}var Os=je?gn(je):function(t){return Ps(t)&&Ji(t)==et};var Fs=He?gn(He):function(t){return Ps(t)&&jo(t)==nt};function Is(t){return"string"==typeof t||!gs(t)&&Ps(t)&&Ji(t)==it}function Ns(t){return"symbol"==typeof t||Ps(t)&&Ji(t)==rt}var Bs=Ge?gn(Ge):function(t){return Ps(t)&&As(t.length)&&!!Ae[Ji(t)]};var Ds=xo(hr),zs=xo((function(t,e){return t<=e}));function Vs(t){if(!t)return[];if(ws(t))return Is(t)?On(t):no(t);if(ze&&t[ze])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[ze]());var e=jo(t);return(e==K?An:e==nt?Ln:dc)(t)}function Us(t){return t?(t=Hs(t))===F||t===-F?(t<0?-1:1)*N:t==t?t:0:0===t?t:0}function ks(t){var e=Us(t),n=e%1;return e==e?n?e-n:e:0}function js(t){return t?Ii(ks(t),0,D):0}function Hs(t){if("number"==typeof t)return t;if(Ns(t))return B;if(Ts(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Ts(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(It,"");var n=Wt.test(t);return n||Xt.test(t)?Ce(t.slice(2),n?2:8):Gt.test(t)?B:+t}function Gs(t){return io(t,oc(t))}function Ws(t){return null==t?"":Br(t)}var qs=oo((function(t,e){if(Zo(e)||ws(e))io(e,rc(e),t);else for(var n in e)ue.call(e,n)&&Pi(t,n,e[n])})),Xs=oo((function(t,e){io(e,oc(e),t)})),Ys=oo((function(t,e,n,i){io(e,oc(e),t,i)})),Qs=oo((function(t,e,n,i){io(e,rc(e),t,i)})),Ks=Co(Fi);var Zs=Sr((function(t,e){t=ee(t);var n=-1,i=e.length,r=i>2?e[2]:o;for(r&&Xo(e[0],e[1],r)&&(i=1);++n1),e})),io(t,Oo(t),n),i&&(n=Ni(n,p|d|f,Po));for(var r=e.length;r--;)zr(n,e[r]);return n}));var lc=Co((function(t,e){return null==t?{}:function(t,e){return yr(t,e,(function(e,n){return tc(t,n)}))}(t,e)}));function uc(t,e){if(null==t)return{};var n=$e(Oo(t),(function(t){return[t]}));return e=Bo(e),yr(t,n,(function(t,n){return e(t,n[0])}))}var hc=Mo(rc),pc=Mo(oc);function dc(t){return null==t?[]:yn(t,rc(t))}var fc=lo((function(t,e,n){return e=e.toLowerCase(),t+(n?mc(e):e)}));function mc(t){return Sc(Ws(t).toLowerCase())}function vc(t){return(t=Ws(t))&&t.replace(Qt,bn).replace(we,"")}var gc=lo((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),yc=lo((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),wc=co("toLowerCase");var xc=lo((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}));var _c=lo((function(t,e,n){return t+(n?" ":"")+Sc(e)}));var bc=lo((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Sc=co("toUpperCase");function Mc(t,e,n){return t=Ws(t),(e=n?o:e)===o?function(t){return Se.test(t)}(t)?function(t){return t.match(_e)||[]}(t):function(t){return t.match(Ut)||[]}(t):t.match(e)||[]}var Ec=Sr((function(t,e){try{return We(t,o,e)}catch(t){return Ss(t)?t:new Jt(t)}})),Ac=Co((function(t,e){return Xe(e,(function(e){e=ua(e),Oi(t,e,ns(t[e],t))})),t}));function Tc(t){return function(){return t}}var Pc=po(),Lc=po(!0);function Cc(t){return t}function Rc(t){return cr("function"==typeof t?t:Ni(t,p))}var Oc=Sr((function(t,e){return function(n){return ir(n,t,e)}})),Fc=Sr((function(t,e){return function(n){return ir(t,n,e)}}));function Ic(t,e,n){var i=rc(e),r=Qi(e,i);null!=n||Ts(e)&&(r.length||!i.length)||(n=e,e=t,t=this,r=Qi(e,rc(e)));var o=!(Ts(n)&&"chain"in n&&!n.chain),a=Ms(t);return Xe(r,(function(n){var i=e[n];t[n]=i,a&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__),r=n.__actions__=no(this.__actions__);return r.push({func:i,args:arguments,thisArg:t}),n.__chain__=e,n}return i.apply(t,tn([this.value()],arguments))})})),t}function Nc(){}var Bc=go($e),Dc=go(Qe),zc=go(rn);function Vc(t){return Yo(t)?pn(ua(t)):function(t){return function(e){return Ki(e,t)}}(t)}var Uc=wo(),kc=wo(!0);function jc(){return[]}function Hc(){return!1}var Gc=vo((function(t,e){return t+e}),0),Wc=bo("ceil"),qc=vo((function(t,e){return t/e}),1),Xc=bo("floor");var Yc,Qc=vo((function(t,e){return t*e}),1),Kc=bo("round"),Zc=vo((function(t,e){return t-e}),0);return di.after=function(t,e){if("function"!=typeof e)throw new re(c);return t=ks(t),function(){if(--t<1)return e.apply(this,arguments)}},di.ary=ts,di.assign=qs,di.assignIn=Xs,di.assignInWith=Ys,di.assignWith=Qs,di.at=Ks,di.before=es,di.bind=ns,di.bindAll=Ac,di.bindKey=is,di.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return gs(t)?t:[t]},di.chain=Va,di.chunk=function(t,e,n){e=(n?Xo(t,e,n):e===o)?1:Wn(ks(e),0);var r=null==t?0:t.length;if(!r||e<1)return[];for(var a=0,s=0,c=i(zn(r/e));ar?0:r+n),(i=i===o||i>r?r:ks(i))<0&&(i+=r),i=n>i?0:js(i);n>>0)?(t=Ws(t))&&("string"==typeof e||null!=e&&!Os(e))&&!(e=Br(e))&&En(t)?Yr(On(t),0,n):t.split(e,n):[]},di.spread=function(t,e){if("function"!=typeof t)throw new re(c);return e=null==e?0:Wn(ks(e),0),Sr((function(n){var i=n[e],r=Yr(n,0,e);return i&&tn(r,i),We(t,this,r)}))},di.tail=function(t){var e=null==t?0:t.length;return e?Cr(t,1,e):[]},di.take=function(t,e,n){return t&&t.length?Cr(t,0,(e=n||e===o?1:ks(e))<0?0:e):[]},di.takeRight=function(t,e,n){var i=null==t?0:t.length;return i?Cr(t,(e=i-(e=n||e===o?1:ks(e)))<0?0:e,i):[]},di.takeRightWhile=function(t,e){return t&&t.length?Ur(t,Bo(e,3),!1,!0):[]},di.takeWhile=function(t,e){return t&&t.length?Ur(t,Bo(e,3)):[]},di.tap=function(t,e){return e(t),t},di.throttle=function(t,e,n){var i=!0,r=!0;if("function"!=typeof t)throw new re(c);return Ts(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),rs(t,e,{leading:i,maxWait:e,trailing:r})},di.thru=Ua,di.toArray=Vs,di.toPairs=hc,di.toPairsIn=pc,di.toPath=function(t){return gs(t)?$e(t,ua):Ns(t)?[t]:no(la(Ws(t)))},di.toPlainObject=Gs,di.transform=function(t,e,n){var i=gs(t),r=i||_s(t)||Bs(t);if(e=Bo(e,4),null==n){var o=t&&t.constructor;n=r?i?new o:[]:Ts(t)&&Ms(o)?fi(Re(t)):{}}return(r?Xe:Xi)(t,(function(t,i,r){return e(n,t,i,r)})),n},di.unary=function(t){return ts(t,1)},di.union=Pa,di.unionBy=La,di.unionWith=Ca,di.uniq=function(t){return t&&t.length?Dr(t):[]},di.uniqBy=function(t,e){return t&&t.length?Dr(t,Bo(e,2)):[]},di.uniqWith=function(t,e){return e="function"==typeof e?e:o,t&&t.length?Dr(t,o,e):[]},di.unset=function(t,e){return null==t||zr(t,e)},di.unzip=Ra,di.unzipWith=Oa,di.update=function(t,e,n){return null==t?t:Vr(t,e,Wr(n))},di.updateWith=function(t,e,n,i){return i="function"==typeof i?i:o,null==t?t:Vr(t,e,Wr(n),i)},di.values=dc,di.valuesIn=function(t){return null==t?[]:yn(t,oc(t))},di.without=Fa,di.words=Mc,di.wrap=function(t,e){return us(Wr(e),t)},di.xor=Ia,di.xorBy=Na,di.xorWith=Ba,di.zip=Da,di.zipObject=function(t,e){return Hr(t||[],e||[],Pi)},di.zipObjectDeep=function(t,e){return Hr(t||[],e||[],Ar)},di.zipWith=za,di.entries=hc,di.entriesIn=pc,di.extend=Xs,di.extendWith=Ys,Ic(di,di),di.add=Gc,di.attempt=Ec,di.camelCase=fc,di.capitalize=mc,di.ceil=Wc,di.clamp=function(t,e,n){return n===o&&(n=e,e=o),n!==o&&(n=(n=Hs(n))==n?n:0),e!==o&&(e=(e=Hs(e))==e?e:0),Ii(Hs(t),e,n)},di.clone=function(t){return Ni(t,f)},di.cloneDeep=function(t){return Ni(t,p|f)},di.cloneDeepWith=function(t,e){return Ni(t,p|f,e="function"==typeof e?e:o)},di.cloneWith=function(t,e){return Ni(t,f,e="function"==typeof e?e:o)},di.conformsTo=function(t,e){return null==e||Bi(t,e,rc(e))},di.deburr=vc,di.defaultTo=function(t,e){return null==t||t!=t?e:t},di.divide=qc,di.endsWith=function(t,e,n){t=Ws(t),e=Br(e);var i=t.length,r=n=n===o?i:Ii(ks(n),0,i);return(n-=e.length)>=0&&t.slice(n,r)==e},di.eq=ds,di.escape=function(t){return(t=Ws(t))&&Et.test(t)?t.replace(St,Sn):t},di.escapeRegExp=function(t){return(t=Ws(t))&&Ft.test(t)?t.replace(Ot,"\\$&"):t},di.every=function(t,e,n){var i=gs(t)?Qe:ki;return n&&Xo(t,e,n)&&(e=o),i(t,Bo(e,3))},di.find=Ha,di.findIndex=va,di.findKey=function(t,e){return an(t,Bo(e,3),Xi)},di.findLast=Ga,di.findLastIndex=ga,di.findLastKey=function(t,e){return an(t,Bo(e,3),Yi)},di.floor=Xc,di.forEach=Wa,di.forEachRight=qa,di.forIn=function(t,e){return null==t?t:Wi(t,Bo(e,3),oc)},di.forInRight=function(t,e){return null==t?t:qi(t,Bo(e,3),oc)},di.forOwn=function(t,e){return t&&Xi(t,Bo(e,3))},di.forOwnRight=function(t,e){return t&&Yi(t,Bo(e,3))},di.get=$s,di.gt=fs,di.gte=ms,di.has=function(t,e){return null!=t&&Ho(t,e,tr)},di.hasIn=tc,di.head=wa,di.identity=Cc,di.includes=function(t,e,n,i){t=ws(t)?t:dc(t),n=n&&!i?ks(n):0;var r=t.length;return n<0&&(n=Wn(r+n,0)),Is(t)?n<=r&&t.indexOf(e,n)>-1:!!r&&cn(t,e,n)>-1},di.indexOf=function(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var r=null==n?0:ks(n);return r<0&&(r=Wn(i+r,0)),cn(t,e,r)},di.inRange=function(t,e,n){return e=Us(e),n===o?(n=e,e=0):n=Us(n),function(t,e,n){return t>=qn(e,n)&&t=-I&&t<=I},di.isSet=Fs,di.isString=Is,di.isSymbol=Ns,di.isTypedArray=Bs,di.isUndefined=function(t){return t===o},di.isWeakMap=function(t){return Ps(t)&&jo(t)==at},di.isWeakSet=function(t){return Ps(t)&&Ji(t)==st},di.join=function(t,e){return null==t?"":Hn.call(t,e)},di.kebabCase=gc,di.last=Sa,di.lastIndexOf=function(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var r=i;return n!==o&&(r=(r=ks(n))<0?Wn(i+r,0):qn(r,i-1)),e==e?function(t,e,n){for(var i=n+1;i--;)if(t[i]===e)return i;return i}(t,e,r):sn(t,un,r,!0)},di.lowerCase=yc,di.lowerFirst=wc,di.lt=Ds,di.lte=zs,di.max=function(t){return t&&t.length?ji(t,Cc,$i):o},di.maxBy=function(t,e){return t&&t.length?ji(t,Bo(e,2),$i):o},di.mean=function(t){return hn(t,Cc)},di.meanBy=function(t,e){return hn(t,Bo(e,2))},di.min=function(t){return t&&t.length?ji(t,Cc,hr):o},di.minBy=function(t,e){return t&&t.length?ji(t,Bo(e,2),hr):o},di.stubArray=jc,di.stubFalse=Hc,di.stubObject=function(){return{}},di.stubString=function(){return""},di.stubTrue=function(){return!0},di.multiply=Qc,di.nth=function(t,e){return t&&t.length?vr(t,ks(e)):o},di.noConflict=function(){return Fe._===this&&(Fe._=me),this},di.noop=Nc,di.now=$a,di.pad=function(t,e,n){t=Ws(t);var i=(e=ks(e))?Rn(t):0;if(!e||i>=e)return t;var r=(e-i)/2;return yo(Vn(r),n)+t+yo(zn(r),n)},di.padEnd=function(t,e,n){t=Ws(t);var i=(e=ks(e))?Rn(t):0;return e&&ie){var i=t;t=e,e=i}if(n||t%1||e%1){var r=Qn();return qn(t+r*(e-t+Le("1e-"+((r+"").length-1))),e)}return _r(t,e)},di.reduce=function(t,e,n){var i=gs(t)?en:fn,r=arguments.length<3;return i(t,Bo(e,4),n,r,Vi)},di.reduceRight=function(t,e,n){var i=gs(t)?nn:fn,r=arguments.length<3;return i(t,Bo(e,4),n,r,Ui)},di.repeat=function(t,e,n){return e=(n?Xo(t,e,n):e===o)?1:ks(e),br(Ws(t),e)},di.replace=function(){var t=arguments,e=Ws(t[0]);return t.length<3?e:e.replace(t[1],t[2])},di.result=function(t,e,n){var i=-1,r=(e=qr(e,t)).length;for(r||(r=1,t=o);++iI)return[];var n=D,i=qn(t,D);e=Bo(e),t-=D;for(var r=vn(i,e);++n=a)return t;var c=n-Rn(i);if(c<1)return i;var l=s?Yr(s,0,c).join(""):t.slice(0,c);if(r===o)return l+i;if(s&&(c+=l.length-c),Os(r)){if(t.slice(c).search(r)){var u,h=l;for(r.global||(r=ne(r.source,Ws(Ht.exec(r))+"g")),r.lastIndex=0;u=r.exec(h);)var p=u.index;l=l.slice(0,p===o?c:p)}}else if(t.indexOf(Br(r),c)!=c){var d=l.lastIndexOf(r);d>-1&&(l=l.slice(0,d))}return l+i},di.unescape=function(t){return(t=Ws(t))&&Mt.test(t)?t.replace(bt,Fn):t},di.uniqueId=function(t){var e=++he;return Ws(t)+e},di.upperCase=bc,di.upperFirst=Sc,di.each=Wa,di.eachRight=qa,di.first=wa,Ic(di,(Yc={},Xi(di,(function(t,e){ue.call(di.prototype,e)||(Yc[e]=t)})),Yc),{chain:!1}),di.VERSION="4.17.19",Xe(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){di[t].placeholder=di})),Xe(["drop","take"],(function(t,e){gi.prototype[t]=function(n){n=n===o?1:Wn(ks(n),0);var i=this.__filtered__&&!e?new gi(this):this.clone();return i.__filtered__?i.__takeCount__=qn(n,i.__takeCount__):i.__views__.push({size:qn(n,D),type:t+(i.__dir__<0?"Right":"")}),i},gi.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),Xe(["filter","map","takeWhile"],(function(t,e){var n=e+1,i=n==R||3==n;gi.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Bo(t,3),type:n}),e.__filtered__=e.__filtered__||i,e}})),Xe(["head","last"],(function(t,e){var n="take"+(e?"Right":"");gi.prototype[t]=function(){return this[n](1).value()[0]}})),Xe(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");gi.prototype[t]=function(){return this.__filtered__?new gi(this):this[n](1)}})),gi.prototype.compact=function(){return this.filter(Cc)},gi.prototype.find=function(t){return this.filter(t).head()},gi.prototype.findLast=function(t){return this.reverse().find(t)},gi.prototype.invokeMap=Sr((function(t,e){return"function"==typeof t?new gi(this):this.map((function(n){return ir(n,t,e)}))})),gi.prototype.reject=function(t){return this.filter(cs(Bo(t)))},gi.prototype.slice=function(t,e){t=ks(t);var n=this;return n.__filtered__&&(t>0||e<0)?new gi(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==o&&(n=(e=ks(e))<0?n.dropRight(-e):n.take(e-t)),n)},gi.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},gi.prototype.toArray=function(){return this.take(D)},Xi(gi.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),r=di[i?"take"+("last"==e?"Right":""):e],a=i||/^find/.test(e);r&&(di.prototype[e]=function(){var e=this.__wrapped__,s=i?[1]:arguments,c=e instanceof gi,l=s[0],u=c||gs(e),h=function(t){var e=r.apply(di,tn([t],s));return i&&p?e[0]:e};u&&n&&"function"==typeof l&&1!=l.length&&(c=u=!1);var p=this.__chain__,d=!!this.__actions__.length,f=a&&!p,m=c&&!d;if(!a&&u){e=m?e:new gi(this);var v=t.apply(e,s);return v.__actions__.push({func:Ua,args:[h],thisArg:o}),new vi(v,p)}return f&&m?t.apply(this,s):(v=this.thru(h),f?i?v.value()[0]:v.value():v)})})),Xe(["pop","push","shift","sort","splice","unshift"],(function(t){var e=oe[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:pop|shift)$/.test(t);di.prototype[t]=function(){var t=arguments;if(i&&!this.__chain__){var r=this.value();return e.apply(gs(r)?r:[],t)}return this[n]((function(n){return e.apply(gs(n)?n:[],t)}))}})),Xi(gi.prototype,(function(t,e){var n=di[e];if(n){var i=n.name+"";ue.call(ri,i)||(ri[i]=[]),ri[i].push({name:e,func:n})}})),ri[fo(o,y).name]=[{name:"wrapper",func:o}],gi.prototype.clone=function(){var t=new gi(this.__wrapped__);return t.__actions__=no(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=no(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=no(this.__views__),t},gi.prototype.reverse=function(){if(this.__filtered__){var t=new gi(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},gi.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=gs(t),i=e<0,r=n?t.length:0,o=function(t,e,n){var i=-1,r=n.length;for(;++i=this.__values__.length;return{done:t,value:t?o:this.__values__[this.__index__++]}},di.prototype.plant=function(t){for(var e,n=this;n instanceof mi;){var i=pa(n);i.__index__=0,i.__values__=o,e?r.__wrapped__=i:e=i;var r=i;n=n.__wrapped__}return r.__wrapped__=t,e},di.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof gi){var e=t;return this.__actions__.length&&(e=new gi(this)),(e=e.reverse()).__actions__.push({func:Ua,args:[Ta],thisArg:o}),new vi(e,this.__chain__)}return this.thru(Ta)},di.prototype.toJSON=di.prototype.valueOf=di.prototype.value=function(){return kr(this.__wrapped__,this.__actions__)},di.prototype.first=di.prototype.head,ze&&(di.prototype[ze]=function(){return this}),di}();Fe._=In,(r=function(){return In}.call(e,n,e,i))===o||(i.exports=r)}).call(this)}).call(this,n(34),n(35)(t))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){for(var t=[],e=0;e.5?this.character.setState(new o.Walk(this.character)):this.setAppropriateStartWalkState())},e}(o.CharacterStateBase);e.Idle=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.Driver="driver",t.Passenger="passenger"}(e.SeatType||(e.SeatType={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t[t.Character=0]="Character",t[t.Airplane=1]="Airplane",t[t.Car=2]="Car",t[t.Helicopter=3]="Helicopter",t[t.Decoration=4]="Decoration",t[t.System=5]="System"}(e.EntityType||(e.EntityType={}))},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=n(26),s=function(t){function e(e,n){var i=t.call(this,e)||this;return i.seat=n,i.canFindVehiclesToEnter=!1,i.playAnimation("driving",.1),i.character.startControllingVehicle(n.vehicle,i.seat),i.seat.vehicle.onInputChange(),i.character.vehicleEntryInstance=null,i}return r(e,t),e.prototype.update=function(e){var n,i;t.prototype.update.call(this,e),!(null===(n=this.seat.door)||void 0===n?void 0:n.achievingTargetRotation)&&(null===(i=this.seat.door)||void 0===i?void 0:i.rotation)>0&&this.seat.vehicle.noDirectionPressed()&&this.character.setState(new a.CloseVehicleDoorInside(this.character,this.seat))},e}(o.CharacterStateBase);e.Driving=s},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(18),s=n(20),c=n(2),l=function(t){function e(e,n,i,r,o){void 0===r&&(r=0),void 0===o&&(o=0);var a=t.call(this,e,n,i)||this;a.position=r,a.velocity=o,a.target=0,a.cache=[];for(var c=0;c<2;c++)a.cache.push(new s.SimulationFrame(r,o));return a}return r(e,t),e.prototype.simulate=function(t){this.generateFrames(t),this.position=o.MathUtils.lerp(this.cache[0].position,this.cache[1].position,this.offset/this.frameTime),this.velocity=o.MathUtils.lerp(this.cache[0].velocity,this.cache[1].velocity,this.offset/this.frameTime)},e.prototype.getFrame=function(t){return c.spring(this.lastFrame().position,this.target,this.lastFrame().velocity,this.mass,this.damping)},e}(a.SimulatorBase);e.SpringSimulator=l},function(t,e,n){"use strict";n.r(e),n.d(e,"ShaderPass",(function(){return o}));var i=n(0),r=n(4),o=function(t,e){r.a.call(this),this.textureID=void 0!==e?e:"tDiffuse",t instanceof i.ShaderMaterial?(this.uniforms=t.uniforms,this.material=t):t&&(this.uniforms=i.UniformsUtils.clone(t.uniforms),this.material=new i.ShaderMaterial({defines:Object.assign({},t.defines),uniforms:this.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader})),this.fsQuad=new r.a.FullScreenQuad(this.material)};o.prototype=Object.assign(Object.create(r.a.prototype),{constructor:o,render:function(t,e,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(t.setRenderTarget(null),this.fsQuad.render(t)):(t.setRenderTarget(e),this.clear&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),this.fsQuad.render(t))}})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t[t.Default=1]="Default",t[t.Characters=2]="Characters",t[t.TrimeshColliders=4]="TrimeshColliders"}(e.CollisionGroups||(e.CollisionGroups={}))},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(1),s=n(6),c=n(52),l=n(54),u=n(2),h=n(14),p=n(24),d=function(t){function e(e,n){var i=t.call(this)||this;i.updateOrder=2,i.actions={},i.seats=[],i.wheels=[],i.materials=[],i.firstPerson=!1,void 0===n&&(n={}),n.chassisConnectionPointLocal=new a.Vec3,n.axleLocal=new a.Vec3(-1,0,0),n.directionLocal=new a.Vec3(0,-1,0);var r=new a.Material("Mat");return r.friction=.01,i.collision=new a.Body({mass:50}),i.collision.material=r,i.readVehicleData(e),i.modelContainer=new o.Group,i.add(i.modelContainer),i.modelContainer.add(e.scene),i.rayCastVehicle=new a.RaycastVehicle({chassisBody:i.collision,indexUpAxis:1,indexRightAxis:0,indexForwardAxis:2}),i.wheels.forEach((function(t){n.chassisConnectionPointLocal.set(t.position.x,t.position.y+.2,t.position.z);var e=i.rayCastVehicle.addWheel(n);t.rayCastWheelInfoIndex=e})),i.help=new o.AxesHelper(2),i}return r(e,t),e.prototype.noDirectionPressed=function(){return!0},e.prototype.update=function(t){this.position.set(this.collision.interpolatedPosition.x,this.collision.interpolatedPosition.y,this.collision.interpolatedPosition.z),this.quaternion.set(this.collision.interpolatedQuaternion.x,this.collision.interpolatedQuaternion.y,this.collision.interpolatedQuaternion.z,this.collision.interpolatedQuaternion.w),this.seats.forEach((function(e){e.update(t)}));for(var e=0;e0&&(this.controllingCharacter.modelContainer.visible=!0,this.controllingCharacter.setState(new p.SwitchingSeats(this.controllingCharacter,this.controllingCharacter.occupyingSeat,this.controllingCharacter.occupyingSeat.connectedSeats[0])),this.controllingCharacter.stopControllingVehicle())},e.prototype.resetControls=function(){for(var t in this.actions)this.actions.hasOwnProperty(t)&&this.triggerAction(t,!1)},e.prototype.allowSleep=function(t){this.collision.allowSleep=t,!1===t&&this.collision.wakeUp()},e.prototype.handleKeyboardEvent=function(t,e,n){if("KeyC"===e&&!0===n&&!0===t.shiftKey)this.resetControls(),this.world.cameraOperator.characterCaller=this.controllingCharacter,this.world.inputManager.setInputReceiver(this.world.cameraOperator);else if("KeyR"===e&&!0===n&&!0===t.shiftKey)this.world.restartScenario();else for(var i in this.actions)if(this.actions.hasOwnProperty(i)){var r=this.actions[i];s.includes(r.eventCodes,e)&&this.triggerAction(i,n)}},e.prototype.setFirstPersonView=function(t){this.firstPerson=t,void 0!==this.controllingCharacter&&(this.controllingCharacter.modelContainer.visible=!t),t?this.world.cameraOperator.setRadius(0,!0):this.world.cameraOperator.setRadius(3,!0)},e.prototype.toggleFirstPersonView=function(){this.setFirstPersonView(!this.firstPerson)},e.prototype.triggerAction=function(t,e){var n=this.actions[t];n.isPressed!==e&&(n.isPressed=e,n.justPressed=!1,n.justReleased=!1,e?n.justPressed=!0:n.justReleased=!0,this.onInputChange(),n.justPressed=!1,n.justReleased=!1)},e.prototype.handleMouseButton=function(t,e,n){},e.prototype.handleMouseMove=function(t,e,n){this.world.cameraOperator.move(e,n)},e.prototype.handleMouseWheel=function(t,e){this.world.scrollTheTimeScale(e)},e.prototype.inputReceiverInit=function(){this.collision.allowSleep=!1,this.setFirstPersonView(!1)},e.prototype.inputReceiverUpdate=function(t){if(this.firstPerson){var e=(new o.Vector3).copy(this.camera.position);e.applyQuaternion(this.quaternion),this.world.cameraOperator.target.copy(e.add(this.position))}else this.world.cameraOperator.target.set(this.position.x,this.position.y+.5,this.position.z)},e.prototype.setPosition=function(t,e,n){this.collision.position.x=t,this.collision.position.y=e,this.collision.position.z=n},e.prototype.setSteeringValue=function(t){var e=this;this.wheels.forEach((function(n){n.steering&&e.rayCastVehicle.setSteeringValue(t,n.rayCastWheelInfoIndex)}))},e.prototype.applyEngineForce=function(t){var e=this;this.wheels.forEach((function(n){e.drive!==n.drive&&"awd"!==e.drive||e.rayCastVehicle.applyEngineForce(t,n.rayCastWheelInfoIndex)}))},e.prototype.setBrake=function(t,e){var n=this;this.wheels.forEach((function(i){void 0!==e&&e!==i.drive||n.rayCastVehicle.setBrake(t,i.rayCastWheelInfoIndex)}))},e.prototype.addToWorld=function(t){s.includes(t.vehicles,this)?console.warn("Adding character to a world in which it already exists."):void 0===this.rayCastVehicle?console.error("Trying to create vehicle without raycastVehicleComponent"):(this.world=t,t.vehicles.push(this),t.graphicsWorld.add(this),this.rayCastVehicle.addToWorld(t.physicsWorld),this.wheels.forEach((function(e){t.graphicsWorld.attach(e.wheelObject)})),this.materials.forEach((function(e){t.sky.csm.setupMaterial(e)})))},e.prototype.removeFromWorld=function(t){s.includes(t.vehicles,this)?(this.world=void 0,s.pull(t.vehicles,this),t.graphicsWorld.remove(this),this.rayCastVehicle.removeFromWorld(t.physicsWorld),this.wheels.forEach((function(e){t.graphicsWorld.remove(e.wheelObject)}))):console.warn("Removing character from a world in which it isn't present.")},e.prototype.readVehicleData=function(t){var e=this;t.scene.traverse((function(n){if(n.isMesh&&(u.setupMeshProperties(n),void 0!==n.material&&e.materials.push(n.material)),n.hasOwnProperty("userData")&&n.userData.hasOwnProperty("data")){if("seat"===n.userData.data&&e.seats.push(new c.VehicleSeat(e,n,t)),"camera"===n.userData.data&&(e.camera=n),"wheel"===n.userData.data&&e.wheels.push(new l.Wheel(n)),"collision"===n.userData.data)if("box"===n.userData.shape)n.visible=!1,(i=new a.Box(new a.Vec3(n.scale.x,n.scale.y,n.scale.z))).collisionFilterMask=~h.CollisionGroups.TrimeshColliders,e.collision.addShape(i,new a.Vec3(n.position.x,n.position.y,n.position.z));else if("sphere"===n.userData.shape){var i;n.visible=!1,(i=new a.Sphere(n.scale.x)).collisionFilterGroup=h.CollisionGroups.TrimeshColliders,e.collision.addShape(i,new a.Vec3(n.position.x,n.position.y,n.position.z))}"navmesh"===n.userData.data&&(n.visible=!1)}})),0===this.collision.shapes.length&&console.warn("Vehicle "+typeof this+" has no collision data."),0===this.seats.length?console.warn("Vehicle "+typeof this+" has no seats."):this.connectSeats()},e.prototype.connectSeats=function(){for(var t=0,e=this.seats;t0)for(var a=0,s=this.seats;a0&&this.noDirection())this.character.setState(new a.CloseVehicleDoorInside(this.character,this.seat));else if(null!==this.character.vehicleEntryInstance)if(this.character.vehicleEntryInstance.wantsToDrive)for(var o=0,l=this.seat.connectedSeats;o0&&(this.seat.door.physicsEnabled=!0),this.character.setState(new c.SwitchingSeats(this.character,this.seat,u));break}}else this.character.vehicleEntryInstance=null},e.prototype.onInputChange=function(){this.character.actions.seat_switch.justPressed&&this.seat.connectedSeats.length>0&&this.character.setState(new c.SwitchingSeats(this.character,this.seat,this.seat.connectedSeats[0])),this.character.actions.enter.justPressed&&(this.character.exitVehicle(),this.character.displayControls())},e}(o.CharacterStateBase);e.Sitting=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e,n){this.mass=e,this.damping=n,this.frameTime=1/t,this.offset=0}return t.prototype.setFPS=function(t){this.frameTime=1/t},t.prototype.lastFrame=function(){return this.cache[this.cache.length-1]},t.prototype.generateFrames=function(t){var e=this.offset+t,n=Math.floor(e/this.frameTime);if(this.offset=e%this.frameTime,n>0){for(var i=0;i(e=parseInt(e.getAttribute("tabindex")))?1:t1&&void 0!==arguments[1]?arguments[1]:"flex";t.style.opacity="",t.style.display=e},ct=function(t){t.style.opacity="",t.style.display="none"},lt=function(t,e,n){e?st(t,n):ct(t)},ut=function(t){return!(!t||!(t.offsetWidth||t.offsetHeight||t.getClientRects().length))},ht=function(t){return!!(t.scrollHeight>t.clientHeight)},pt=function(t){var e=window.getComputedStyle(t),n=parseFloat(e.getPropertyValue("animation-duration")||"0"),i=parseFloat(e.getPropertyValue("transition-duration")||"0");return n>0||i>0},dt=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=H();ut(n)&&(e&&(n.style.transition="none",n.style.width="100%"),setTimeout((function(){n.style.transition="width ".concat(t/1e3,"s linear"),n.style.width="0%"}),10))},ft=function(){return"undefined"==typeof window||"undefined"==typeof document},mt='\n
    \n
    \n
      \n
      \n
      \n
      \n
      \n
      \n \n

      \n \n
      \n
      \n
      \n \n \n
      \n \n \n
      \n \n
      \n \n \n
      \n
      \n
      \n \n \n
      \n
      \n
      \n
      \n
      \n
      \n').replace(/(^|\n)\s*/g,""),vt=function(t){mn.isVisible()&&tt!==t.target.value&&mn.resetValidationMessage(),tt=t.target.value},gt=function(t){var e,n=!!(e=T())&&(e.parentNode.removeChild(e),rt([document.documentElement,document.body],[E["no-backdrop"],E["toast-shown"],E["has-column"]]),!0);if(ft())m("SweetAlert2 requires document to initialize");else{var i=document.createElement("div");i.className=E.container,n&&it(i,E["no-transition"]),K(i,mt);var r,o,a,s,c,l,u,h,p,d="string"==typeof(r=t.target)?document.querySelector(r):r;d.appendChild(i),function(t){var e=C();e.setAttribute("role",t.toast?"alert":"dialog"),e.setAttribute("aria-live",t.toast?"polite":"assertive"),t.toast||e.setAttribute("aria-modal","true")}(t),function(t){"rtl"===window.getComputedStyle(t).direction&&it(T(),E.rtl)}(d),o=I(),a=ot(o,E.input),s=ot(o,E.file),c=o.querySelector(".".concat(E.range," input")),l=o.querySelector(".".concat(E.range," output")),u=ot(o,E.select),h=o.querySelector(".".concat(E.checkbox," input")),p=ot(o,E.textarea),a.oninput=vt,s.onchange=vt,u.onchange=vt,h.onchange=vt,p.oninput=vt,c.oninput=function(t){vt(t),l.value=c.value},c.onchange=function(t){vt(t),c.nextSibling.value=c.value}}},yt=function(e,n){e instanceof HTMLElement?n.appendChild(e):"object"===t(e)?wt(e,n):e&&K(n,e)},wt=function(t,e){t.jquery?xt(e,t):K(e,t.toString())},xt=function(t,e){if(t.textContent="",0 in e)for(var n=0;n in e;n++)t.appendChild(e[n].cloneNode(!0));else t.appendChild(e.cloneNode(!0))},_t=function(){if(ft())return!1;var t=document.createElement("div"),e={WebkitAnimation:"webkitAnimationEnd",OAnimation:"oAnimationEnd oanimationend",animation:"animationend"};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&void 0!==t.style[n])return e[n];return!1}(),bt=function(t,e){var n=U(),i=z(),r=V();e.showConfirmButton||e.showCancelButton||ct(n),J(n,e,"actions"),St(i,"confirm",e),St(r,"cancel",e),e.buttonsStyling?function(t,e,n){if(it([t,e],E.styled),n.confirmButtonColor&&(t.style.backgroundColor=n.confirmButtonColor),n.cancelButtonColor&&(e.style.backgroundColor=n.cancelButtonColor),!Y()){var i=window.getComputedStyle(t).getPropertyValue("background-color");t.style.borderLeftColor=i,t.style.borderRightColor=i}}(i,r,e):(rt([i,r],E.styled),i.style.backgroundColor=i.style.borderLeftColor=i.style.borderRightColor="",r.style.backgroundColor=r.style.borderLeftColor=r.style.borderRightColor=""),e.reverseButtons&&i.parentNode.insertBefore(r,i)};function St(t,e,n){lt(t,n["show".concat(h(e),"Button")],"inline-block"),K(t,n["".concat(e,"ButtonText")]),t.setAttribute("aria-label",n["".concat(e,"ButtonAriaLabel")]),t.className=E[e],J(t,n,"".concat(e,"Button")),it(t,n["".concat(e,"ButtonClass")])}var Mt=function(t,e){var n=T();if(n){!function(t,e){"string"==typeof e?t.style.background=e:e||it([document.documentElement,document.body],E["no-backdrop"])}(n,e.backdrop),!e.backdrop&&e.allowOutsideClick&&f('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`'),function(t,e){e in E?it(t,E[e]):(f('The "position" parameter is not valid, defaulting to "center"'),it(t,E.center))}(n,e.position),function(t,e){if(e&&"string"==typeof e){var n="grow-".concat(e);n in E&&it(t,E[n])}}(n,e.grow),J(n,e,"container");var i=document.body.getAttribute("data-swal2-queue-step");i&&(n.setAttribute("data-queue-step",i),document.body.removeAttribute("data-swal2-queue-step"))}},Et={promise:new WeakMap,innerParams:new WeakMap,domCache:new WeakMap},At=["input","file","range","select","radio","checkbox","textarea"],Tt=function(t){if(!Ot[t.input])return m('Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "'.concat(t.input,'"'));var e=Rt(t.input),n=Ot[t.input](e,t);st(n),setTimeout((function(){et(n)}))},Pt=function(t,e){var n=$(I(),t);if(n)for(var i in function(t){for(var e=0;en?"".concat(e,"px"):null})).observe(t,{attributes:!0,attributeFilter:["style"]})}return t};var Ft=function(t,e){var n=I().querySelector("#".concat(E.content));e.html?(yt(e.html,n),st(n,"block")):e.text?(n.textContent=e.text,st(n,"block")):ct(n),function(t,e){var n=I(),i=Et.innerParams.get(t),r=!i||e.input!==i.input;At.forEach((function(t){var i=E[t],o=ot(n,i);Pt(t,e.inputAttributes),o.className=i,r&&ct(o)})),e.input&&(r&&Tt(e),Lt(e))}(t,e),J(I(),e,"content")},It=function(){for(var t=R(),e=0;e\n \n
      \n
      \n '):"error"===e.icon?K(t,'\n \n \n \n \n '):K(t,Dt({question:"?",warning:"!",info:"i"}[e.icon]))},Dt=function(t){return'
      ').concat(t,"
      ")},zt=[],Vt=function(){return T()&&T().getAttribute("data-queue-step")},Ut=function(t,e){var n=B();if(!e.progressSteps||0===e.progressSteps.length)return ct(n);st(n),n.textContent="";var i=parseInt(void 0===e.currentProgressStep?Vt():e.currentProgressStep);i>=e.progressSteps.length&&f("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),e.progressSteps.forEach((function(t,r){var o=function(t){var e=document.createElement("li");return it(e,E["progress-step"]),K(e,t),e}(t);if(n.appendChild(o),r===i&&it(o,E["active-progress-step"]),r!==e.progressSteps.length-1){var a=function(t){var e=document.createElement("li");return it(e,E["progress-step-line"]),t.progressStepsDistance&&(e.style.width=t.progressStepsDistance),e}(e);n.appendChild(a)}}))},kt=function(t,e){var n=k();J(n,e,"header"),Ut(0,e),function(t,e){var n=Et.innerParams.get(t);if(n&&e.icon===n.icon&&O())J(O(),e,"icon");else if(It(),e.icon)if(-1!==Object.keys(A).indexOf(e.icon)){var i=P(".".concat(E.icon,".").concat(A[e.icon]));st(i),Bt(i,e),Nt(),J(i,e,"icon"),it(i,e.showClass.icon)}else m('Unknown icon! Expected "success", "error", "warning", "info" or "question", got "'.concat(e.icon,'"'))}(t,e),function(t,e){var n=N();if(!e.imageUrl)return ct(n);st(n,""),n.setAttribute("src",e.imageUrl),n.setAttribute("alt",e.imageAlt),at(n,"width",e.imageWidth),at(n,"height",e.imageHeight),n.className=E.image,J(n,e,"image")}(0,e),function(t,e){var n=F();lt(n,e.title||e.titleText),e.title&&yt(e.title,n),e.titleText&&(n.innerText=e.titleText),J(n,e,"title")}(0,e),function(t,e){var n=G();K(n,e.closeButtonHtml),J(n,e,"closeButton"),lt(n,e.showCloseButton),n.setAttribute("aria-label",e.closeButtonAriaLabel)}(0,e)},jt=function(t,e){t.className="".concat(E.popup," ").concat(ut(t)?e.showClass.popup:""),e.toast?(it([document.documentElement,document.body],E["toast-shown"]),it(t,E.toast)):it(t,E.modal),J(t,e,"popup"),"string"==typeof e.customClass&&it(t,e.customClass),e.icon&&it(t,E["icon-".concat(e.icon)])},Ht=function(t,e){!function(t,e){var n=C();at(n,"width",e.width),at(n,"padding",e.padding),e.background&&(n.style.background=e.background),jt(n,e)}(0,e),Mt(0,e),kt(t,e),Ft(t,e),bt(0,e),function(t,e){var n=j();lt(n,e.footer),e.footer&&yt(e.footer,n),J(n,e,"footer")}(0,e),"function"==typeof e.onRender&&e.onRender(C())},Gt=function(){return z()&&z().click()},Wt=function(){var t=C();t||mn.fire(),t=C();var e=U(),n=z();st(e),st(n,"inline-block"),it([t,e],E.loading),n.disabled=!0,t.setAttribute("data-loading",!0),t.setAttribute("aria-busy",!0),t.focus()},qt={},Xt=function(){return new Promise((function(t){var e=window.scrollX,n=window.scrollY;qt.restoreFocusTimeout=setTimeout((function(){qt.previousActiveElement&&qt.previousActiveElement.focus?(qt.previousActiveElement.focus(),qt.previousActiveElement=null):document.body&&document.body.focus(),t()}),100),void 0!==e&&void 0!==n&&window.scrollTo(e,n)}))},Yt=function(){if(qt.timeout)return function(){var t=H(),e=parseInt(window.getComputedStyle(t).width);t.style.removeProperty("transition"),t.style.width="100%";var n=parseInt(window.getComputedStyle(t).width),i=parseInt(e/n*100);t.style.removeProperty("transition"),t.style.width="".concat(i,"%")}(),qt.timeout.stop()},Qt=function(){if(qt.timeout){var t=qt.timeout.start();return dt(t),t}},Kt={title:"",titleText:"",text:"",html:"",footer:"",icon:void 0,iconHtml:void 0,toast:!1,animation:!0,showClass:{popup:"swal2-show",backdrop:"swal2-backdrop-show",icon:"swal2-icon-show"},hideClass:{popup:"swal2-hide",backdrop:"swal2-backdrop-hide",icon:"swal2-icon-hide"},customClass:void 0,target:"body",backdrop:!0,heightAuto:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,stopKeydownPropagation:!0,keydownListenerCapture:!1,showConfirmButton:!0,showCancelButton:!1,preConfirm:void 0,confirmButtonText:"OK",confirmButtonAriaLabel:"",confirmButtonColor:void 0,cancelButtonText:"Cancel",cancelButtonAriaLabel:"",cancelButtonColor:void 0,buttonsStyling:!0,reverseButtons:!1,focusConfirm:!0,focusCancel:!1,showCloseButton:!1,closeButtonHtml:"×",closeButtonAriaLabel:"Close this dialog",showLoaderOnConfirm:!1,imageUrl:void 0,imageWidth:void 0,imageHeight:void 0,imageAlt:"",timer:void 0,timerProgressBar:!1,width:void 0,padding:void 0,background:void 0,input:void 0,inputPlaceholder:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputAttributes:{},inputValidator:void 0,validationMessage:void 0,grow:!1,position:"center",progressSteps:[],currentProgressStep:void 0,progressStepsDistance:void 0,onBeforeOpen:void 0,onOpen:void 0,onRender:void 0,onClose:void 0,onAfterClose:void 0,onDestroy:void 0,scrollbarPadding:!0},Zt=["title","titleText","text","html","footer","icon","hideClass","customClass","allowOutsideClick","allowEscapeKey","showConfirmButton","showCancelButton","confirmButtonText","confirmButtonAriaLabel","confirmButtonColor","cancelButtonText","cancelButtonAriaLabel","cancelButtonColor","buttonsStyling","reverseButtons","showCloseButton","closeButtonHtml","closeButtonAriaLabel","imageUrl","imageWidth","imageHeight","imageAlt","progressSteps","currentProgressStep","onClose","onAfterClose","onDestroy"],Jt={animation:'showClass" and "hideClass'},$t=["allowOutsideClick","allowEnterKey","backdrop","focusConfirm","focusCancel","heightAuto","keydownListenerCapture"],te=function(t){return Object.prototype.hasOwnProperty.call(Kt,t)},ee=function(t){return Jt[t]},ne=function(t){te(t)||f('Unknown parameter "'.concat(t,'"'))},ie=function(t){-1!==$t.indexOf(t)&&f('The parameter "'.concat(t,'" is incompatible with toasts'))},re=function(t){ee(t)&&g(t,ee(t))},oe=function(t){for(var e in t)ne(e),t.toast&&ie(e),re(e)},ae=Object.freeze({isValidParameter:te,isUpdatableParameter:function(t){return-1!==Zt.indexOf(t)},isDeprecatedParameter:ee,argsToParams:function(e){var n={};return"object"!==t(e[0])||S(e[0])?["title","html","icon"].forEach((function(i,r){var o=e[r];"string"==typeof o||S(o)?n[i]=o:void 0!==o&&m("Unexpected type of ".concat(i,'! Expected "string" or "Element", got ').concat(t(o)))})):r(n,e[0]),n},isVisible:function(){return ut(C())},clickConfirm:Gt,clickCancel:function(){return V()&&V().click()},getContainer:T,getPopup:C,getTitle:F,getContent:I,getHtmlContainer:function(){return L(E["html-container"])},getImage:N,getIcon:O,getIcons:R,getCloseButton:G,getActions:U,getConfirmButton:z,getCancelButton:V,getHeader:k,getFooter:j,getTimerProgressBar:H,getFocusableElements:W,getValidationMessage:D,isLoading:Y,fire:function(){for(var t=arguments.length,e=new Array(t),n=0;nwindow.innerHeight&&(Q.previousBodyPadding=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight="".concat(Q.previousBodyPadding+function(){var t=document.createElement("div");t.className=E["scrollbar-measure"],document.body.appendChild(t);var e=t.getBoundingClientRect().width-t.clientWidth;return document.body.removeChild(t),e}(),"px"))},le=function(){null!==Q.previousBodyPadding&&(document.body.style.paddingRight="".concat(Q.previousBodyPadding,"px"),Q.previousBodyPadding=null)},ue=function(){navigator.userAgent.match(/(CriOS|FxiOS|EdgiOS|YaBrowser|UCBrowser)/i)||C().scrollHeight>window.innerHeight-44&&(T().style.paddingBottom="".concat(44,"px"))},he=function(){var t,e=T();e.ontouchstart=function(e){t=pe(e.target)},e.ontouchmove=function(e){t&&(e.preventDefault(),e.stopPropagation())}},pe=function(t){var e=T();return t===e||!(ht(e)||"INPUT"===t.tagName||ht(I())&&I().contains(t))},de=function(){if(Z(document.body,E.iosfix)){var t=parseInt(document.body.style.top,10);rt(document.body,E.iosfix),document.body.style.top="",document.body.scrollTop=-1*t}},fe=function(){return!!window.MSInputMethodContext&&!!document.documentMode},me=function(){var t=T(),e=C();t.style.removeProperty("align-items"),e.offsetTop<0&&(t.style.alignItems="flex-start")},ve=function(){"undefined"!=typeof window&&fe()&&window.removeEventListener("resize",me)},ge=function(){d(document.body.children).forEach((function(t){t.hasAttribute("data-previous-aria-hidden")?(t.setAttribute("aria-hidden",t.getAttribute("data-previous-aria-hidden")),t.removeAttribute("data-previous-aria-hidden")):t.removeAttribute("aria-hidden")}))},ye={swalPromiseResolve:new WeakMap};function we(t,e,n,i){n?Se(t,i):(Xt().then((function(){return Se(t,i)})),qt.keydownTarget.removeEventListener("keydown",qt.keydownHandler,{capture:qt.keydownListenerCapture}),qt.keydownHandlerAdded=!1),e.parentNode&&!document.body.getAttribute("data-swal2-queue-step")&&e.parentNode.removeChild(e),q()&&(le(),de(),ve(),ge()),rt([document.documentElement,document.body],[E.shown,E["height-auto"],E["no-backdrop"],E["toast-shown"],E["toast-column"]])}function xe(t){var e=C();if(e){var n=Et.innerParams.get(this);if(n&&!Z(e,n.hideClass.popup)){var i=ye.swalPromiseResolve.get(this);rt(e,n.showClass.popup),it(e,n.hideClass.popup);var r=T();rt(r,n.showClass.backdrop),it(r,n.hideClass.backdrop),_e(this,e,n),void 0!==t?(t.isDismissed=void 0!==t.dismiss,t.isConfirmed=void 0===t.dismiss):t={isDismissed:!0,isConfirmed:!1},i(t||{})}}}var _e=function(t,e,n){var i=T(),r=_t&&pt(e),o=n.onClose,a=n.onAfterClose;null!==o&&"function"==typeof o&&o(e),r?be(t,e,i,a):we(t,i,X(),a)},be=function(t,e,n,i){qt.swalCloseEventFinishedCallback=we.bind(null,t,n,X(),i),e.addEventListener(_t,(function(t){t.target===e&&(qt.swalCloseEventFinishedCallback(),delete qt.swalCloseEventFinishedCallback)}))},Se=function(t,e){setTimeout((function(){"function"==typeof e&&e(),t._destroy()}))};function Me(t,e,n){var i=Et.domCache.get(t);e.forEach((function(t){i[t].disabled=n}))}function Ee(t,e){if(!t)return!1;if("radio"===t.type)for(var n=t.parentNode.parentNode.querySelectorAll("input"),i=0;i")),gt(t)}var Le=function(t){var e=T(),n=C();"function"==typeof t.onBeforeOpen&&t.onBeforeOpen(n);var i=window.getComputedStyle(document.body).overflowY;Ie(e,n,t),Oe(e,n),q()&&(Fe(e,t.scrollbarPadding,i),d(document.body.children).forEach((function(t){t===T()||function(t,e){if("function"==typeof t.contains)return t.contains(e)}(t,T())||(t.hasAttribute("aria-hidden")&&t.setAttribute("data-previous-aria-hidden",t.getAttribute("aria-hidden")),t.setAttribute("aria-hidden","true"))}))),X()||qt.previousActiveElement||(qt.previousActiveElement=document.activeElement),"function"==typeof t.onOpen&&setTimeout((function(){return t.onOpen(n)})),rt(e,E["no-transition"])};function Ce(t){var e=C();if(t.target===e){var n=T();e.removeEventListener(_t,Ce),n.style.overflowY="auto"}}var Re,Oe=function(t,e){_t&&pt(e)?(t.style.overflowY="hidden",e.addEventListener(_t,Ce)):t.style.overflowY="auto"},Fe=function(t,e,n){!function(){if((/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1)&&!Z(document.body,E.iosfix)){var t=document.body.scrollTop;document.body.style.top="".concat(-1*t,"px"),it(document.body,E.iosfix),he(),ue()}}(),"undefined"!=typeof window&&fe()&&(me(),window.addEventListener("resize",me)),e&&"hidden"!==n&&ce(),setTimeout((function(){t.scrollTop=0}))},Ie=function(t,e,n){it(t,n.showClass.backdrop),st(e),it(e,n.showClass.popup),it([document.documentElement,document.body],E.shown),n.heightAuto&&n.backdrop&&!n.toast&&it([document.documentElement,document.body],E["height-auto"])},Ne=function(t){return t.checked?1:0},Be=function(t){return t.checked?t.value:null},De=function(t){return t.files.length?null!==t.getAttribute("multiple")?t.files:t.files[0]:null},ze=function(e,n){var i=I(),r=function(t){return Ue[n.input](i,ke(t),n)};w(n.inputOptions)||_(n.inputOptions)?(Wt(),x(n.inputOptions).then((function(t){e.hideLoading(),r(t)}))):"object"===t(n.inputOptions)?r(n.inputOptions):m("Unexpected type of inputOptions! Expected object, Map or Promise, got ".concat(t(n.inputOptions)))},Ve=function(t,e){var n=t.getInput();ct(n),x(e.inputValue).then((function(i){n.value="number"===e.input?parseFloat(i)||0:"".concat(i),st(n),n.focus(),t.hideLoading()})).catch((function(e){m("Error in inputValue promise: ".concat(e)),n.value="",st(n),n.focus(),t.hideLoading()}))},Ue={select:function(t,e,n){var i=ot(t,E.select),r=function(t,e,i){var r=document.createElement("option");r.value=i,K(r,e),n.inputValue.toString()===i.toString()&&(r.selected=!0),t.appendChild(r)};e.forEach((function(t){var e=t[0],n=t[1];if(Array.isArray(n)){var o=document.createElement("optgroup");o.label=e,o.disabled=!1,i.appendChild(o),n.forEach((function(t){return r(o,t[1],t[0])}))}else r(i,n,e)})),i.focus()},radio:function(t,e,n){var i=ot(t,E.radio);e.forEach((function(t){var e=t[0],r=t[1],o=document.createElement("input"),a=document.createElement("label");o.type="radio",o.name=E.radio,o.value=e,n.inputValue.toString()===e.toString()&&(o.checked=!0);var s=document.createElement("span");K(s,r),s.className=E.label,a.appendChild(o),a.appendChild(s),i.appendChild(a)}));var r=i.querySelectorAll("input");r.length&&r[0].focus()}},ke=function e(n){var i=[];return"undefined"!=typeof Map&&n instanceof Map?n.forEach((function(n,r){var o=n;"object"===t(o)&&(o=e(o)),i.push([r,o])})):Object.keys(n).forEach((function(r){var o=n[r];"object"===t(o)&&(o=e(o)),i.push([r,o])})),i},je=function(t,e){var n=function(t,e){var n=t.getInput();if(!n)return null;switch(e.input){case"checkbox":return Ne(n);case"radio":return Be(n);case"file":return De(n);default:return e.inputAutoTrim?n.value.trim():n.value}}(t,e);e.inputValidator?(t.disableInput(),Promise.resolve().then((function(){return x(e.inputValidator(n,e.validationMessage))})).then((function(i){t.enableButtons(),t.enableInput(),i?t.showValidationMessage(i):Ge(t,e,n)}))):t.getInput().checkValidity()?Ge(t,e,n):(t.enableButtons(),t.showValidationMessage(e.validationMessage))},He=function(t,e){t.closePopup({value:e})},Ge=function(t,e,n){e.showLoaderOnConfirm&&Wt(),e.preConfirm?(t.resetValidationMessage(),Promise.resolve().then((function(){return x(e.preConfirm(n,e.validationMessage))})).then((function(e){ut(D())||!1===e?t.hideLoading():He(t,void 0===e?n:e)}))):He(t,n)},We=function(t,e,n){for(var i=W(),r=0;r:first-child,.swal2-container.swal2-bottom-left>:first-child,.swal2-container.swal2-bottom-right>:first-child,.swal2-container.swal2-bottom-start>:first-child,.swal2-container.swal2-bottom>:first-child{margin-top:auto}.swal2-container.swal2-grow-fullscreen>.swal2-modal{display:flex!important;flex:1;align-self:stretch;justify-content:center}.swal2-container.swal2-grow-row>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container.swal2-grow-column{flex:1;flex-direction:column}.swal2-container.swal2-grow-column.swal2-bottom,.swal2-container.swal2-grow-column.swal2-center,.swal2-container.swal2-grow-column.swal2-top{align-items:center}.swal2-container.swal2-grow-column.swal2-bottom-left,.swal2-container.swal2-grow-column.swal2-bottom-start,.swal2-container.swal2-grow-column.swal2-center-left,.swal2-container.swal2-grow-column.swal2-center-start,.swal2-container.swal2-grow-column.swal2-top-left,.swal2-container.swal2-grow-column.swal2-top-start{align-items:flex-start}.swal2-container.swal2-grow-column.swal2-bottom-end,.swal2-container.swal2-grow-column.swal2-bottom-right,.swal2-container.swal2-grow-column.swal2-center-end,.swal2-container.swal2-grow-column.swal2-center-right,.swal2-container.swal2-grow-column.swal2-top-end,.swal2-container.swal2-grow-column.swal2-top-right{align-items:flex-end}.swal2-container.swal2-grow-column>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container.swal2-no-transition{transition:none!important}.swal2-container:not(.swal2-top):not(.swal2-top-start):not(.swal2-top-end):not(.swal2-top-left):not(.swal2-top-right):not(.swal2-center-start):not(.swal2-center-end):not(.swal2-center-left):not(.swal2-center-right):not(.swal2-bottom):not(.swal2-bottom-start):not(.swal2-bottom-end):not(.swal2-bottom-left):not(.swal2-bottom-right):not(.swal2-grow-fullscreen)>.swal2-modal{margin:auto}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-container .swal2-modal{margin:0!important}}.swal2-popup{display:none;position:relative;box-sizing:border-box;flex-direction:column;justify-content:center;width:32em;max-width:100%;padding:1.25em;border:none;border-radius:.3125em;background:#fff;font-family:inherit;font-size:1rem}.swal2-popup:focus{outline:0}.swal2-popup.swal2-loading{overflow-y:hidden}.swal2-header{display:flex;flex-direction:column;align-items:center;padding:0 1.8em}.swal2-title{position:relative;max-width:100%;margin:0 0 .4em;padding:0;color:#595959;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}.swal2-actions{display:flex;z-index:1;flex-wrap:wrap;align-items:center;justify-content:center;width:100%;margin:1.25em auto 0}.swal2-actions:not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}.swal2-actions:not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,.1))}.swal2-actions:not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0,0,0,.2),rgba(0,0,0,.2))}.swal2-actions.swal2-loading .swal2-styled.swal2-confirm{box-sizing:border-box;width:2.5em;height:2.5em;margin:.46875em;padding:0;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border:.25em solid transparent;border-radius:100%;border-color:transparent;background-color:transparent!important;color:transparent!important;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-actions.swal2-loading .swal2-styled.swal2-cancel{margin-right:30px;margin-left:30px}.swal2-actions.swal2-loading :not(.swal2-styled).swal2-confirm::after{content:"";display:inline-block;width:15px;height:15px;margin-left:5px;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border:3px solid #999;border-radius:50%;border-right-color:transparent;box-shadow:1px 1px 1px #fff}.swal2-styled{margin:.3125em;padding:.625em 2em;box-shadow:none;font-weight:500}.swal2-styled:not([disabled]){cursor:pointer}.swal2-styled.swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#3085d6;color:#fff;font-size:1.0625em}.swal2-styled.swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#aaa;color:#fff;font-size:1.0625em}.swal2-styled:focus{outline:0;box-shadow:0 0 0 1px #fff,0 0 0 3px rgba(50,100,150,.4)}.swal2-styled::-moz-focus-inner{border:0}.swal2-footer{justify-content:center;margin:1.25em 0 0;padding:1em 0 0;border-top:1px solid #eee;color:#545454;font-size:1em}.swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;height:.25em;overflow:hidden;border-bottom-right-radius:.3125em;border-bottom-left-radius:.3125em}.swal2-timer-progress-bar{width:100%;height:.25em;background:rgba(0,0,0,.2)}.swal2-image{max-width:100%;margin:1.25em auto}.swal2-close{position:absolute;z-index:2;top:0;right:0;align-items:center;justify-content:center;width:1.2em;height:1.2em;padding:0;overflow:hidden;transition:color .1s ease-out;border:none;border-radius:0;background:0 0;color:#ccc;font-family:serif;font-size:2.5em;line-height:1.2;cursor:pointer}.swal2-close:hover{transform:none;background:0 0;color:#f27474}.swal2-close::-moz-focus-inner{border:0}.swal2-content{z-index:1;justify-content:center;margin:0;padding:0 1.6em;color:#545454;font-size:1.125em;font-weight:400;line-height:normal;text-align:center;word-wrap:break-word}.swal2-checkbox,.swal2-file,.swal2-input,.swal2-radio,.swal2-select,.swal2-textarea{margin:1em auto}.swal2-file,.swal2-input,.swal2-textarea{box-sizing:border-box;width:100%;transition:border-color .3s,box-shadow .3s;border:1px solid #d9d9d9;border-radius:.1875em;background:inherit;box-shadow:inset 0 1px 1px rgba(0,0,0,.06);color:inherit;font-size:1.125em}.swal2-file.swal2-inputerror,.swal2-input.swal2-inputerror,.swal2-textarea.swal2-inputerror{border-color:#f27474!important;box-shadow:0 0 2px #f27474!important}.swal2-file:focus,.swal2-input:focus,.swal2-textarea:focus{border:1px solid #b4dbed;outline:0;box-shadow:0 0 3px #c4e6f5}.swal2-file::-moz-placeholder,.swal2-input::-moz-placeholder,.swal2-textarea::-moz-placeholder{color:#ccc}.swal2-file:-ms-input-placeholder,.swal2-input:-ms-input-placeholder,.swal2-textarea:-ms-input-placeholder{color:#ccc}.swal2-file::-ms-input-placeholder,.swal2-input::-ms-input-placeholder,.swal2-textarea::-ms-input-placeholder{color:#ccc}.swal2-file::placeholder,.swal2-input::placeholder,.swal2-textarea::placeholder{color:#ccc}.swal2-range{margin:1em auto;background:#fff}.swal2-range input{width:80%}.swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}.swal2-range input,.swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}.swal2-input{height:2.625em;padding:0 .75em}.swal2-input[type=number]{max-width:10em}.swal2-file{background:inherit;font-size:1.125em}.swal2-textarea{height:6.75em;padding:.75em}.swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:inherit;color:inherit;font-size:1.125em}.swal2-checkbox,.swal2-radio{align-items:center;justify-content:center;background:#fff;color:inherit}.swal2-checkbox label,.swal2-radio label{margin:0 .6em;font-size:1.125em}.swal2-checkbox input,.swal2-radio input{margin:0 .4em}.swal2-validation-message{display:none;align-items:center;justify-content:center;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}.swal2-validation-message::before{content:"!";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}.swal2-icon{position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:1.25em auto 1.875em;border:.25em solid transparent;border-radius:50%;font-family:inherit;line-height:5em;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}.swal2-icon.swal2-error{border-color:#f27474;color:#f27474}.swal2-icon.swal2-error .swal2-x-mark{position:relative;flex-grow:1}.swal2-icon.swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}.swal2-icon.swal2-error.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-error.swal2-icon-show .swal2-x-mark{-webkit-animation:swal2-animate-error-x-mark .5s;animation:swal2-animate-error-x-mark .5s}.swal2-icon.swal2-warning{border-color:#facea8;color:#f8bb86}.swal2-icon.swal2-info{border-color:#9de0f6;color:#3fc3ee}.swal2-icon.swal2-question{border-color:#c9dae1;color:#87adbd}.swal2-icon.swal2-success{border-color:#a5dc86;color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;transform:rotate(45deg);border-radius:50%}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}.swal2-icon.swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-.25em;left:-.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}.swal2-icon.swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}.swal2-icon.swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-animate-success-line-tip .75s;animation:swal2-animate-success-line-tip .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-animate-success-line-long .75s;animation:swal2-animate-success-line-long .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-circular-line-right{-webkit-animation:swal2-rotate-success-circular-line 4.25s ease-in;animation:swal2-rotate-success-circular-line 4.25s ease-in}.swal2-progress-steps{align-items:center;margin:0 0 1.25em;padding:0;background:inherit;font-weight:600}.swal2-progress-steps li{display:inline-block;position:relative}.swal2-progress-steps .swal2-progress-step{z-index:20;width:2em;height:2em;border-radius:2em;background:#3085d6;color:#fff;line-height:2em;text-align:center}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#3085d6}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}.swal2-progress-steps .swal2-progress-step-line{z-index:10;width:2.5em;height:.4em;margin:0 -1px;background:#3085d6}[class^=swal2]{-webkit-tap-highlight-color:transparent}.swal2-show{-webkit-animation:swal2-show .3s;animation:swal2-show .3s}.swal2-hide{-webkit-animation:swal2-hide .15s forwards;animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{right:auto;left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@supports (-ms-accelerator:true){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@-moz-document url-prefix(){.swal2-close:focus{outline:2px solid rgba(50,100,150,.4)}}@-webkit-keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@-webkit-keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@-webkit-keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@-webkit-keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@-webkit-keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@-webkit-keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@-webkit-keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@-webkit-keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@-webkit-keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@-webkit-keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@-webkit-keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@-webkit-keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto!important}body.swal2-no-backdrop .swal2-container{top:auto;right:auto;bottom:auto;left:auto;max-width:calc(100% - .625em * 2);background-color:transparent!important}body.swal2-no-backdrop .swal2-container>.swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}body.swal2-no-backdrop .swal2-container.swal2-top{top:0;left:50%;transform:translateX(-50%)}body.swal2-no-backdrop .swal2-container.swal2-top-left,body.swal2-no-backdrop .swal2-container.swal2-top-start{top:0;left:0}body.swal2-no-backdrop .swal2-container.swal2-top-end,body.swal2-no-backdrop .swal2-container.swal2-top-right{top:0;right:0}body.swal2-no-backdrop .swal2-container.swal2-center{top:50%;left:50%;transform:translate(-50%,-50%)}body.swal2-no-backdrop .swal2-container.swal2-center-left,body.swal2-no-backdrop .swal2-container.swal2-center-start{top:50%;left:0;transform:translateY(-50%)}body.swal2-no-backdrop .swal2-container.swal2-center-end,body.swal2-no-backdrop .swal2-container.swal2-center-right{top:50%;right:0;transform:translateY(-50%)}body.swal2-no-backdrop .swal2-container.swal2-bottom{bottom:0;left:50%;transform:translateX(-50%)}body.swal2-no-backdrop .swal2-container.swal2-bottom-left,body.swal2-no-backdrop .swal2-container.swal2-bottom-start{bottom:0;left:0}body.swal2-no-backdrop .swal2-container.swal2-bottom-end,body.swal2-no-backdrop .swal2-container.swal2-bottom-right{right:0;bottom:0}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll!important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static!important}}body.swal2-toast-shown .swal2-container{background-color:transparent}body.swal2-toast-shown .swal2-container.swal2-top{top:0;right:auto;bottom:auto;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{top:0;right:0;bottom:auto;left:auto}body.swal2-toast-shown .swal2-container.swal2-top-left,body.swal2-toast-shown .swal2-container.swal2-top-start{top:0;right:auto;bottom:auto;left:0}body.swal2-toast-shown .swal2-container.swal2-center-left,body.swal2-toast-shown .swal2-container.swal2-center-start{top:50%;right:auto;bottom:auto;left:0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{top:50%;right:auto;bottom:auto;left:50%;transform:translate(-50%,-50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{top:50%;right:0;bottom:auto;left:auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-left,body.swal2-toast-shown .swal2-container.swal2-bottom-start{top:auto;right:auto;bottom:0;left:0}body.swal2-toast-shown .swal2-container.swal2-bottom{top:auto;right:auto;bottom:0;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{top:auto;right:0;bottom:0;left:auto}body.swal2-toast-column .swal2-toast{flex-direction:column;align-items:stretch}body.swal2-toast-column .swal2-toast .swal2-actions{flex:1;align-self:stretch;height:2.2em;margin-top:.3125em}body.swal2-toast-column .swal2-toast .swal2-loading{justify-content:center}body.swal2-toast-column .swal2-toast .swal2-input{height:2em;margin:.3125em auto;font-size:1em}body.swal2-toast-column .swal2-toast .swal2-validation-message{font-size:1em}')},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(t,e){this.position=t,this.velocity=e};e.SimulationFrame=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.Local="local",t.Global="global"}(e.Space||(e.Space={}))},function(t,e,n){"use strict";n.r(e),n.d(e,"Detector",(function(){return i}));var i={canvas:!!window.CanvasRenderingContext2D,webgl:function(){try{var t=document.createElement("canvas");return!(!window.WebGLRenderingContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}catch(t){return!1}}(),workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob,getWebGLErrorMessage:function(){var t=document.createElement("div");return t.id="webgl-error-message",t.style.fontFamily="monospace",t.style.fontSize="13px",t.style.fontWeight="normal",t.style.textAlign="center",t.style.background="#fff",t.style.color="#000",t.style.padding="1.5em",t.style.width="400px",t.style.margin="5em auto 0",this.webgl||(t.innerHTML=window.WebGLRenderingContext?['Your graphics card does not seem to support WebGL.
      ','Find out how to get it here.'].join("\n"):['Your browser does not seem to support WebGL.
      ','Find out how to get it here.'].join("\n")),t},addGetWebGLMessage:function(t){var e,n,r;e=void 0!==(t=t||{}).parent?t.parent:document.body,n=void 0!==t.id?t.id:"oldie",(r=i.getWebGLErrorMessage()).id=n,e.appendChild(r)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(){}return t.setUserInterfaceVisible=function(t){document.getElementById("ui-container").style.display=t?"block":"none"},t.setLoadingScreenVisible=function(t){document.getElementById("loading-screen").style.display=t?"flex":"none"},t.setFPSVisible=function(t){document.getElementById("statsBox").style.display=t?"block":"none",document.getElementById("dat-gui-container").style.top=t?"48px":"0px"},t}();e.UIManager=i},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(3),s=n(5),c=n(9),l=n(11),u=n(17),h=n(2),p=n(21),d=function(t){function e(e,n,i){var r=t.call(this,e)||this;r.startPosition=new o.Vector3,r.endPosition=new o.Vector3,r.startRotation=new o.Quaternion,r.endRotation=new o.Quaternion,r.toSeat=i,r.canFindVehiclesToEnter=!1,r.canLeaveVehicles=!1,e.leaveSeat(),r.character.occupySeat(i);var a=h.getRight(n.seatPointObject,p.Space.Local),c=i.seatPointObject.position.clone().sub(n.seatPointObject.position).normalize(),l=a.dot(c)>0?s.Side.Left:s.Side.Right;return l===s.Side.Left?r.playAnimation("sitting_shift_left",.1):l===s.Side.Right&&r.playAnimation("sitting_shift_right",.1),r.startPosition.copy(n.seatPointObject.position),r.startPosition.y+=.6,r.endPosition.copy(i.seatPointObject.position),r.endPosition.y+=.6,r.startRotation.copy(n.seatPointObject.quaternion),r.endRotation.copy(i.seatPointObject.quaternion),r}return r(e,t),e.prototype.update=function(e){if(t.prototype.update.call(this,e),this.animationEnded(e))this.toSeat.type===c.SeatType.Driver?this.character.setState(new l.Driving(this.character,this.toSeat)):this.toSeat.type===c.SeatType.Passenger&&this.character.setState(new u.Sitting(this.character,this.toSeat));else{var n=this.timer/this.animationLength,i=h.easeInOutSine(n),r=(new o.Vector3).lerpVectors(this.startPosition,this.endPosition,i);this.character.setPosition(r.x,r.y,r.z),o.Quaternion.slerp(this.startRotation,this.endRotation,this.character.quaternion,i)}},e}(a.CharacterStateBase);e.SwitchingSeats=d},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=function(t){function e(e){var n=t.call(this,e)||this;return n.character.velocitySimulator.mass=1,n.character.velocitySimulator.damping=.6,n.character.setArcadeVelocityTarget(.8),n.playAnimation("drop_running_roll",.03),n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.character.setCameraRelativeOrientationTarget(),this.animationEnded(e)&&(this.anyDirection()?this.character.setState(new o.Walk(this.character)):this.character.setState(new o.EndWalk(this.character)))},e}(o.CharacterStateBase);e.DropRolling=a},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=n(5),s=n(11),c=n(9),l=n(17),u=n(2),h=function(t){function e(e,n){var i,r=t.call(this,e)||this;r.hasClosedDoor=!1,r.seat=n,r.canFindVehiclesToEnter=!1,r.canLeaveVehicles=!1;var o=u.detectRelativeSide(n.seatPointObject,n.door.doorObject);return o===a.Side.Left?r.playAnimation("close_door_sitting_left",.1):o===a.Side.Right&&r.playAnimation("close_door_sitting_right",.1),null===(i=r.seat.door)||void 0===i||i.open(),r}return r(e,t),e.prototype.update=function(e){var n;t.prototype.update.call(this,e),this.timer>.4&&!this.hasClosedDoor&&(this.hasClosedDoor=!0,null===(n=this.seat.door)||void 0===n||n.close()),this.animationEnded(e)&&(this.seat.type===c.SeatType.Driver?this.character.setState(new s.Driving(this.character,this.seat)):this.seat.type===c.SeatType.Passenger&&this.character.setState(new l.Sitting(this.character,this.seat)))},e}(o.CharacterStateBase);e.CloseVehicleDoorInside=h},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(1),s=n(6),c=n(2),l=n(7),u=n(73),h=n(75),p=n(8),d=n(28),f=n(76),m=n(78),v=n(11),g=n(79),y=n(14),w=n(80),x=n(81),_=n(9),b=n(82),S=n(83),M=n(10),E=function(t){function e(e){var n=t.call(this)||this;n.updateOrder=1,n.entityType=M.EntityType.Character,n.height=0,n.materials=[],n.acceleration=new o.Vector3,n.velocity=new o.Vector3,n.arcadeVelocityInfluence=new o.Vector3,n.velocityTarget=new o.Vector3,n.arcadeVelocityIsAdditive=!1,n.defaultVelocitySimulatorDamping=.8,n.defaultVelocitySimulatorMass=50,n.moveSpeed=4,n.angularVelocity=0,n.orientation=new o.Vector3(0,0,1),n.orientationTarget=new o.Vector3(0,0,1),n.defaultRotationSimulatorDamping=.5,n.defaultRotationSimulatorMass=10,n.rayResult=new a.RaycastResult,n.rayHasHit=!1,n.rayCastLength=.57,n.raySafeOffset=.03,n.wantsToJump=!1,n.initJumpSpeed=-1,n.groundImpactData=new b.GroundImpactData,n.occupyingSeat=null,n.vehicleEntryInstance=null,n.physicsEnabled=!0,n.readCharacterData(e),n.setAnimations(e.animations),n.tiltContainer=new o.Group,n.add(n.tiltContainer),n.modelContainer=new o.Group,n.modelContainer.position.y=-.57,n.tiltContainer.add(n.modelContainer),n.modelContainer.add(e.scene),n.mixer=new o.AnimationMixer(e.scene),n.velocitySimulator=new u.VectorSpringSimulator(60,n.defaultVelocitySimulatorMass,n.defaultVelocitySimulatorDamping),n.rotationSimulator=new h.RelativeSpringSimulator(60,n.defaultRotationSimulatorMass,n.defaultRotationSimulatorDamping),n.viewVector=new o.Vector3,n.actions={up:new l.KeyBinding("KeyW"),down:new l.KeyBinding("KeyS"),left:new l.KeyBinding("KeyA"),right:new l.KeyBinding("KeyD"),run:new l.KeyBinding("ShiftLeft"),jump:new l.KeyBinding("Space"),use:new l.KeyBinding("KeyE"),enter:new l.KeyBinding("KeyF"),enter_passenger:new l.KeyBinding("KeyG"),seat_switch:new l.KeyBinding("KeyX"),primary:new l.KeyBinding("Mouse0"),secondary:new l.KeyBinding("Mouse1")},n.characterCapsule=new w.CapsuleCollider({mass:1,position:new a.Vec3,height:.5,radius:.25,segments:8,friction:0}),n.characterCapsule.body.shapes.forEach((function(t){t.collisionFilterMask=~y.CollisionGroups.TrimeshColliders})),n.characterCapsule.body.allowSleep=!1,n.characterCapsule.body.collisionFilterGroup=2,n.characterCapsule.body.fixedRotation=!0,n.characterCapsule.body.updateMassProperties();var i=new o.BoxGeometry(.1,.1,.1),r=new o.MeshLambertMaterial({color:16711680});return n.raycastBox=new o.Mesh(i,r),n.raycastBox.visible=!1,n.characterCapsule.body.preStep=function(t){n.physicsPreStep(t,n)},n.characterCapsule.body.postStep=function(t){n.physicsPostStep(t,n)},n.setState(new p.Idle(n)),n}return r(e,t),e.prototype.setAnimations=function(t){this.animations=t},e.prototype.setArcadeVelocityInfluence=function(t,e,n){void 0===e&&(e=t),void 0===n&&(n=t),this.arcadeVelocityInfluence.set(t,e,n)},e.prototype.setViewVector=function(t){this.viewVector.copy(t).normalize()},e.prototype.setState=function(t){this.charState=t,this.charState.onInputChange()},e.prototype.setPosition=function(t,e,n){this.physicsEnabled?(this.characterCapsule.body.previousPosition=new a.Vec3(t,e,n),this.characterCapsule.body.position=new a.Vec3(t,e,n),this.characterCapsule.body.interpolatedPosition=new a.Vec3(t,e,n)):(this.position.x=t,this.position.y=e,this.position.z=n)},e.prototype.resetVelocity=function(){this.velocity.x=0,this.velocity.y=0,this.velocity.z=0,this.characterCapsule.body.velocity.x=0,this.characterCapsule.body.velocity.y=0,this.characterCapsule.body.velocity.z=0,this.velocitySimulator.init()},e.prototype.setArcadeVelocityTarget=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=0),this.velocityTarget.z=t,this.velocityTarget.x=e,this.velocityTarget.y=n},e.prototype.setOrientation=function(t,e){void 0===e&&(e=!1);var n=(new o.Vector3).copy(t).setY(0).normalize();this.orientationTarget.copy(n),e&&this.orientation.copy(n)},e.prototype.resetOrientation=function(){var t=c.getForward(this);this.setOrientation(t,!0)},e.prototype.setBehaviour=function(t){t.character=this,this.behaviour=t},e.prototype.setPhysicsEnabled=function(t){this.physicsEnabled=t,!0===t?this.world.physicsWorld.addBody(this.characterCapsule.body):this.world.physicsWorld.remove(this.characterCapsule.body)},e.prototype.readCharacterData=function(t){var e=this;t.scene.traverse((function(t){t.isMesh&&(c.setupMeshProperties(t),void 0!==t.material&&e.materials.push(t.material))}))},e.prototype.handleKeyboardEvent=function(t,e,n){if(void 0!==this.controlledObject)this.controlledObject.handleKeyboardEvent(t,e,n);else if("KeyC"===e&&!0===n&&!0===t.shiftKey)this.resetControls(),this.world.cameraOperator.characterCaller=this,this.world.inputManager.setInputReceiver(this.world.cameraOperator);else if("KeyR"===e&&!0===n&&!0===t.shiftKey)this.world.restartScenario();else for(var i in this.actions)if(this.actions.hasOwnProperty(i)){var r=this.actions[i];s.includes(r.eventCodes,e)&&this.triggerAction(i,n)}},e.prototype.handleMouseButton=function(t,e,n){if(void 0!==this.controlledObject)this.controlledObject.handleMouseButton(t,e,n);else for(var i in this.actions)if(this.actions.hasOwnProperty(i)){var r=this.actions[i];s.includes(r.eventCodes,e)&&this.triggerAction(i,n)}},e.prototype.handleMouseMove=function(t,e,n){void 0!==this.controlledObject?this.controlledObject.handleMouseMove(t,e,n):this.world.cameraOperator.move(e,n)},e.prototype.handleMouseWheel=function(t,e){void 0!==this.controlledObject?this.controlledObject.handleMouseWheel(t,e):this.world.scrollTheTimeScale(e)},e.prototype.triggerAction=function(t,e){var n=this.actions[t];n.isPressed!==e&&(n.isPressed=e,n.justPressed=!1,n.justReleased=!1,e?n.justPressed=!0:n.justReleased=!0,this.charState.onInputChange(),n.justPressed=!1,n.justReleased=!1)},e.prototype.takeControl=function(){void 0!==this.world?this.world.inputManager.setInputReceiver(this):console.warn("Attempting to take control of a character that doesn't belong to a world.")},e.prototype.resetControls=function(){for(var t in this.actions)this.actions.hasOwnProperty(t)&&this.triggerAction(t,!1)},e.prototype.update=function(t){var e,n,i;if(null===(e=this.behaviour)||void 0===e||e.update(t),null===(n=this.vehicleEntryInstance)||void 0===n||n.update(t),null===(i=this.charState)||void 0===i||i.update(t),this.physicsEnabled&&this.springMovement(t),this.physicsEnabled&&this.springRotation(t),this.physicsEnabled&&this.rotateModel(),void 0!==this.mixer&&this.mixer.update(t),this.physicsEnabled)this.position.set(this.characterCapsule.body.interpolatedPosition.x,this.characterCapsule.body.interpolatedPosition.y,this.characterCapsule.body.interpolatedPosition.z);else{var r=new o.Vector3;this.getWorldPosition(r),this.characterCapsule.body.position.copy(c.cannonVector(r)),this.characterCapsule.body.interpolatedPosition.copy(c.cannonVector(r))}this.updateMatrixWorld()},e.prototype.inputReceiverInit=function(){void 0===this.controlledObject?(this.world.cameraOperator.setRadius(1.6,!0),this.world.cameraOperator.followMode=!1,this.displayControls()):this.controlledObject.inputReceiverInit()},e.prototype.displayControls=function(){this.world.updateControls([{keys:["W","A","S","D"],desc:"Movement"},{keys:["Shift"],desc:"Sprint"},{keys:["Space"],desc:"Jump"},{keys:["F","or","G"],desc:"Enter vehicle"},{keys:["Shift","+","R"],desc:"Respawn"},{keys:["Shift","+","C"],desc:"Free camera"}])},e.prototype.inputReceiverUpdate=function(t){void 0!==this.controlledObject?this.controlledObject.inputReceiverUpdate(t):(this.viewVector=(new o.Vector3).subVectors(this.position,this.world.camera.position),this.getWorldPosition(this.world.cameraOperator.target))},e.prototype.setAnimation=function(t,e){if(void 0!==this.mixer){var n=o.AnimationClip.findByName(this.animations,t),i=this.mixer.clipAction(n);return null===i?(console.error("Animation "+t+" not found!"),0):(this.mixer.stopAllAction(),i.fadeIn(e),i.play(),i.getClip().duration)}},e.prototype.springMovement=function(t){this.velocitySimulator.target.copy(this.velocityTarget),this.velocitySimulator.simulate(t),this.velocity.copy(this.velocitySimulator.position),this.acceleration.copy(this.velocitySimulator.velocity)},e.prototype.springRotation=function(t){var e=c.getSignedAngleBetweenVectors(this.orientation,this.orientationTarget);this.rotationSimulator.target=e,this.rotationSimulator.simulate(t);var n=this.rotationSimulator.position;this.orientation.applyAxisAngle(new o.Vector3(0,1,0),n),this.angularVelocity=this.rotationSimulator.velocity},e.prototype.getLocalMovementDirection=function(){var t=this.actions.right.isPressed?-1:0,e=this.actions.left.isPressed?1:0,n=this.actions.up.isPressed?1:0,i=this.actions.down.isPressed?-1:0;return new o.Vector3(t+e,0,n+i).normalize()},e.prototype.getCameraRelativeMovementVector=function(){var t=this.getLocalMovementDirection(),e=new o.Vector3(this.viewVector.x,0,this.viewVector.z).normalize();return c.appplyVectorMatrixXZ(e,t)},e.prototype.setCameraRelativeOrientationTarget=function(){if(null===this.vehicleEntryInstance){var t=this.getCameraRelativeMovementVector();0===t.x&&0===t.y&&0===t.z?this.setOrientation(this.orientation):this.setOrientation(t)}},e.prototype.rotateModel=function(){this.lookAt(this.position.x+this.orientation.x,this.position.y+this.orientation.y,this.position.z+this.orientation.z),this.tiltContainer.rotation.z=2.3*-this.angularVelocity*this.velocity.length(),this.tiltContainer.position.setY(Math.cos(Math.abs(2.3*this.angularVelocity*this.velocity.length()))/2-.5)},e.prototype.jump=function(t){void 0===t&&(t=-1),this.wantsToJump=!0,this.initJumpSpeed=t},e.prototype.findVehicleToEnter=function(t){var e=new o.Vector3,n=new S.ClosestObjectFinder(this.position,10);if(this.world.vehicles.forEach((function(t){n.consider(t,t.position)})),void 0!==n.closestObject){var i=n.closestObject,r=new x.VehicleEntryInstance(this);r.wantsToDrive=t;for(var a=new S.ClosestObjectFinder(this.position),s=0,c=i.seats;s0){var u=new a.Vec3;e.rayResult.body.getVelocityAtWorldPoint(e.rayResult.hitPointWorld,u),r.add(c.threeVector(u))}var h=new o.Vector3(0,1,0),p=new o.Vector3(e.rayResult.hitNormalWorld.x,e.rayResult.hitNormalWorld.y,e.rayResult.hitNormalWorld.z),d=(new o.Quaternion).setFromUnitVectors(h,p),f=(new o.Matrix4).makeRotationFromQuaternion(d);r.applyMatrix4(f),t.velocity.x=r.x,t.velocity.y=r.y,t.velocity.z=r.z,t.position.y=e.rayResult.hitPointWorld.y+e.rayCastLength+r.y/e.world.physicsFrameRate}else t.velocity.x=r.x,t.velocity.y=r.y,t.velocity.z=r.z,e.groundImpactData.velocity.x=t.velocity.x,e.groundImpactData.velocity.y=t.velocity.y,e.groundImpactData.velocity.z=t.velocity.z;if(e.wantsToJump){if(e.initJumpSpeed>-1){t.velocity.y=0;var m=Math.max(4*e.velocitySimulator.position.length(),e.initJumpSpeed);t.velocity=c.cannonVector(e.orientation.clone().multiplyScalar(m))}else{l=new a.Vec3;e.rayResult.body.getVelocityAtWorldPoint(e.rayResult.hitPointWorld,l),t.velocity.vsub(l,t.velocity)}t.velocity.y+=4,t.position.y+=2*e.raySafeOffset,e.wantsToJump=!1}},e.prototype.addToWorld=function(t){s.includes(t.characters,this)?console.warn("Adding character to a world in which it already exists."):(this.world=t,t.characters.push(this),t.physicsWorld.addBody(this.characterCapsule.body),t.graphicsWorld.add(this),t.graphicsWorld.add(this.raycastBox),this.materials.forEach((function(e){t.sky.csm.setupMaterial(e)})))},e.prototype.removeFromWorld=function(t){s.includes(t.characters,this)?(t.inputManager.inputReceiver===this&&(t.inputManager.inputReceiver=void 0),this.world=void 0,s.pull(t.characters,this),t.physicsWorld.remove(this.characterCapsule.body),t.graphicsWorld.remove(this),t.graphicsWorld.remove(this.raycastBox)):console.warn("Removing character from a world in which it isn't present.")},e}(o.Object3D);e.Character=E},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(3),s=n(11),c=n(5),l=n(17),u=n(9),h=n(10),p=n(2),d=n(12),f=function(t){function e(e,n,i){var r=t.call(this,e)||this;r.initialPositionOffset=new o.Vector3,r.startPosition=new o.Vector3,r.endPosition=new o.Vector3,r.startRotation=new o.Quaternion,r.endRotation=new o.Quaternion,r.canFindVehiclesToEnter=!1,r.vehicle=n.vehicle,r.seat=n;var a=p.detectRelativeSide(i,n.seatPointObject);return r.animData=r.getEntryAnimations(n.vehicle.entityType),r.playAnimation(r.animData[a],.1),r.character.resetVelocity(),r.character.tiltContainer.rotation.z=0,r.character.setPhysicsEnabled(!1),r.seat.vehicle.attach(r.character),r.startPosition.copy(i.position),r.startPosition.y+=.53,r.endPosition.copy(n.seatPointObject.position),r.endPosition.y+=.6,r.initialPositionOffset.copy(r.startPosition).sub(r.character.position),r.startRotation.copy(r.character.quaternion),r.endRotation.copy(r.seat.seatPointObject.quaternion),r.factorSimulator=new d.SpringSimulator(60,10,.5),r.factorSimulator.target=1,r}return r(e,t),e.prototype.update=function(e){if(t.prototype.update.call(this,e),this.animationEnded(e))this.character.occupySeat(this.seat),this.character.setPosition(this.endPosition.x,this.endPosition.y,this.endPosition.z),this.seat.type===u.SeatType.Driver?(this.seat.door&&(this.seat.door.physicsEnabled=!0),this.character.setState(new s.Driving(this.character,this.seat))):this.seat.type===u.SeatType.Passenger&&this.character.setState(new l.Sitting(this.character,this.seat));else{this.seat.door&&(this.seat.door.physicsEnabled=!1,this.seat.door.rotation=1);var n=o.MathUtils.clamp(this.timer/(this.animationLength-this.animData.end_early),0,1),i=p.easeInOutSine(n);this.factorSimulator.simulate(e);var r=(new o.Vector3).lerpVectors(this.initialPositionOffset,new o.Vector3,this.factorSimulator.position),a=(new o.Vector3).lerpVectors(this.startPosition.clone().sub(r),this.endPosition,i);this.character.setPosition(a.x,a.y,a.z),o.Quaternion.slerp(this.startRotation,this.endRotation,this.character.quaternion,this.factorSimulator.position)}},e.prototype.getEntryAnimations=function(t){var e,n;switch(t){case h.EntityType.Airplane:return(e={})[c.Side.Left]="enter_airplane_left",e[c.Side.Right]="enter_airplane_right",e.end_early=.3,e;default:return(n={})[c.Side.Left]="sit_down_left",n[c.Side.Right]="sit_down_right",n.end_early=0,n}},e}(a.CharacterStateBase);e.EnteringVehicle=f},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(2),s=function(t){function e(e,n){var i,r=t.call(this,e)||this;return r.startPosition=new o.Vector3,r.endPosition=new o.Vector3,r.startRotation=new o.Quaternion,r.endRotation=new o.Quaternion,r.canFindVehiclesToEnter=!1,r.seat=n,r.vehicle=n.vehicle,null===(i=r.seat.door)||void 0===i||i.open(),r.startPosition.copy(r.character.position),r.startRotation.copy(r.character.quaternion),r.dummyObj=new o.Object3D,r}return r(e,t),e.prototype.detachCharacterFromVehicle=function(){this.character.controlledObject=void 0,this.character.resetOrientation(),this.character.world.graphicsWorld.attach(this.character),this.character.resetVelocity(),this.character.setPhysicsEnabled(!0),this.character.setPosition(this.character.position.x,this.character.position.y,this.character.position.z),this.character.inputReceiverUpdate(0),this.character.characterCapsule.body.velocity.copy(this.vehicle.rayCastVehicle.chassisBody.velocity),this.character.feetRaycast()},e.prototype.updateEndRotation=function(){var t=a.getForward(this.exitPoint);t.y=0,t.normalize(),this.character.world.graphicsWorld.attach(this.dummyObj),this.exitPoint.getWorldPosition(this.dummyObj.position);var e=this.dummyObj.position.clone().add(t);this.dummyObj.lookAt(e),this.seat.seatPointObject.parent.attach(this.dummyObj),this.endRotation.copy(this.dummyObj.quaternion)},e}(n(3).CharacterStateBase);e.ExitingStateBase=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n(31);var i=n(32);e.World=i.World},function(t,e,n){},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=n(1),o=n(19),a=n(33),s=n(92),c=n(36),l=n(13),u=n(37),h=n(22),p=n(38),d=n(39),f=n(40),m=n(6),v=n(41),g=n(2),y=n(42),w=n(23),x=n(45),_=n(14),b=n(47),S=n(48),M=n(49),E=n(87),A=n(90),T=function(){function t(t){var e=this;this.timeScaleTarget=1,this.scenarios=[],this.characters=[],this.vehicles=[],this.paths=[],this.updatables=[];var n=this;h.Detector.webgl||o.default.fire({icon:"warning",title:"WebGL compatibility",text:"This browser doesn't seem to have the required WebGL capabilities. The application may not work correctly.",footer:'Click here for more information',showConfirmButton:!1,buttonsStyling:!1}),this.renderer=new i.WebGLRenderer,this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(window.innerWidth,window.innerHeight),this.renderer.toneMapping=i.ACESFilmicToneMapping,this.renderer.toneMappingExposure=1,this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=i.PCFSoftShadowMap,document.body.appendChild(this.renderer.domElement),this.renderer.domElement.id="canvas",window.addEventListener("resize",(function(){n.camera.aspect=window.innerWidth/window.innerHeight,n.camera.updateProjectionMatrix(),n.renderer.setSize(window.innerWidth,window.innerHeight),f.uniforms.resolution.value.set(1/(window.innerWidth*m),1/(window.innerHeight*m)),n.composer.setSize(window.innerWidth*m,window.innerHeight*m)}),!1),this.graphicsWorld=new i.Scene,this.camera=new i.PerspectiveCamera(80,window.innerWidth/window.innerHeight,.1,1010);var d=new c.RenderPass(this.graphicsWorld,this.camera),f=new l.ShaderPass(u.FXAAShader),m=this.renderer.getPixelRatio();if(f.material.uniforms.resolution.value.x=1/(window.innerWidth*m),f.material.uniforms.resolution.value.y=1/(window.innerHeight*m),this.composer=new s.EffectComposer(this.renderer),this.composer.addPass(d),this.composer.addPass(f),this.physicsWorld=new r.World,this.physicsWorld.gravity.set(0,-9.81,0),this.physicsWorld.broadphase=new r.SAPBroadphase(this.physicsWorld),this.physicsWorld.solver.iterations=10,this.physicsWorld.allowSleep=!0,this.parallelPairs=[],this.physicsFrameRate=60,this.physicsFrameTime=1/this.physicsFrameRate,this.physicsMaxPrediction=this.physicsFrameRate,this.clock=new i.Clock,this.renderDelta=0,this.logicDelta=0,this.sinceLastFrame=0,this.justRendered=!1,this.stats=p.Stats(),this.createParamsGUI(n),this.inputManager=new v.InputManager(this,this.renderer.domElement),this.cameraOperator=new a.CameraOperator(this,this.camera,this.params.Mouse_Sensitivity),this.sky=new E.Sky(this),void 0!==t){var g=new y.LoadingManager(this);g.onFinishedCallback=function(){e.update(1,1),e.setTimeScale(1),o.default.fire({title:"Welcome to Sketchbook!",text:"Feel free to explore the world and interact with available vehicles. There are also various scenarios ready to launch from the right panel.",footer:'GitHub pageDiscord server',confirmButtonText:"Okay",buttonsStyling:!1,onClose:function(){w.UIManager.setUserInterfaceVisible(!0)}})},g.loadGLTF(t,(function(t){e.loadScene(g,t)}))}else w.UIManager.setUserInterfaceVisible(!0),w.UIManager.setLoadingScreenVisible(!1),o.default.fire({icon:"success",title:"Hello world!",text:"Empty Sketchbook world was succesfully initialized. Enjoy the blueness of the sky.",buttonsStyling:!1});this.render(this)}return t.prototype.update=function(t,e){this.updatePhysics(t),this.updatables.forEach((function(n){n.update(t,e)})),this.params.Time_Scale=i.MathUtils.lerp(this.params.Time_Scale,this.timeScaleTarget,.2),this.params.Debug_Physics&&this.cannonDebugRenderer.update()},t.prototype.updatePhysics=function(t){var e=this;this.physicsWorld.step(this.physicsFrameTime,t),this.characters.forEach((function(t){e.isOutOfBounds(t.characterCapsule.body.position)&&e.outOfBoundsRespawn(t.characterCapsule.body)})),this.vehicles.forEach((function(t){if(e.isOutOfBounds(t.rayCastVehicle.chassisBody.position)){var n=new i.Vector3;t.spawnPoint.getWorldPosition(n),n.y+=1,e.outOfBoundsRespawn(t.rayCastVehicle.chassisBody,g.cannonVector(n))}}))},t.prototype.isOutOfBounds=function(t){var e=t.x>-211.882&&t.x<211.882&&t.z>-169.098&&t.z<153.232&&t.y>.107,n=t.y<14.989;return!e&&n},t.prototype.outOfBoundsRespawn=function(t,e){var n=e||new r.Vec3(0,16,0),i=new r.Quaternion(0,0,0,1);t.position.copy(n),t.interpolatedPosition.copy(n),t.quaternion.copy(i),t.interpolatedQuaternion.copy(i),t.velocity.setZero(),t.angularVelocity.setZero()},t.prototype.render=function(t){this.requestDelta=this.clock.getDelta(),requestAnimationFrame((function(){t.render(t)}));var e=this.requestDelta+this.renderDelta+this.logicDelta,n=e*this.params.Time_Scale;n=Math.min(n,1/30),t.update(n,e),this.logicDelta=this.clock.getDelta();this.sinceLastFrame+=this.requestDelta+this.renderDelta+this.logicDelta,this.sinceLastFrame%=1/60,this.stats.end(),this.stats.begin(),this.params.FXAA?this.composer.render():this.renderer.render(this.graphicsWorld,this.camera),this.renderDelta=this.clock.getDelta()},t.prototype.setTimeScale=function(t){this.params.Time_Scale=t,this.timeScaleTarget=t},t.prototype.add=function(t){t.addToWorld(this),this.registerUpdatable(t)},t.prototype.registerUpdatable=function(t){this.updatables.push(t),this.updatables.sort((function(t,e){return t.updateOrder>e.updateOrder?1:-1}))},t.prototype.remove=function(t){t.removeFromWorld(this),this.unregisterUpdatable(t)},t.prototype.unregisterUpdatable=function(t){m.pull(this.updatables,t)},t.prototype.loadScene=function(t,e){var n,r=this;e.scene.traverse((function(t){if(t.hasOwnProperty("userData")&&("Mesh"===t.type&&(g.setupMeshProperties(t),r.sky.csm.setupMaterial(t.material),"ocean"===t.material.name&&r.registerUpdatable(new A.Ocean(t,r))),t.userData.hasOwnProperty("data"))){if("physics"===t.userData.data&&t.userData.hasOwnProperty("type")){if("box"===t.userData.type)(e=new b.BoxCollider({size:new i.Vector3(t.scale.x,t.scale.y,t.scale.z)})).body.position.copy(g.cannonVector(t.position)),e.body.quaternion.copy(g.cannonQuat(t.quaternion)),e.body.computeAABB(),e.body.shapes.forEach((function(t){t.collisionFilterMask=~_.CollisionGroups.TrimeshColliders})),r.physicsWorld.addBody(e.body);else if("trimesh"===t.userData.type){var e=new S.TrimeshCollider(t,{});r.physicsWorld.addBody(e.body)}t.visible=!1}"path"===t.userData.data&&r.paths.push(new x.Path(t)),"scenario"===t.userData.data&&r.scenarios.push(new M.Scenario(t,r))}})),this.graphicsWorld.add(e.scene);for(var o=0,a=this.scenarios;o0?(this.timeScaleTarget/=1.3,this.timeScaleTarget<.003&&(this.timeScaleTarget=0)):(this.timeScaleTarget*=1.3,this.timeScaleTarget<.003&&(this.timeScaleTarget=.003),this.timeScaleTarget=Math.min(this.timeScaleTarget,1))},t.prototype.updateControls=function(t){var e="";e+='

      Controls:

      ',t.forEach((function(t){e+='
      ',t.keys.forEach((function(t){e+="+"===t||"and"===t||"or"===t||"&"===t?" "+t+" ":''+t+""})),e+=''+t.desc+"
      "})),document.getElementById("controls").innerHTML=e},t.prototype.createParamsGUI=function(t){var e=this;this.params={Pointer_Lock:!0,Mouse_Sensitivity:.3,Time_Scale:1,Shadows:!0,FXAA:!0,Debug_Physics:!1,Debug_FPS:!1,Sun_Elevation:50,Sun_Rotation:145};var n=new d.GUI;this.scenarioGUIFolder=n.addFolder("Scenarios"),this.scenarioGUIFolder.open();var i=n.addFolder("World");i.add(this.params,"Time_Scale",0,1).listen().onChange((function(e){t.timeScaleTarget=e})),i.add(this.params,"Sun_Elevation",0,180).listen().onChange((function(e){t.sky.phi=e})),i.add(this.params,"Sun_Rotation",0,360).listen().onChange((function(e){t.sky.theta=e}));var r=n.addFolder("Settings");r.add(this.params,"FXAA"),r.add(this.params,"Shadows").onChange((function(t){t?e.sky.csm.lights.forEach((function(t){t.castShadow=!0})):e.sky.csm.lights.forEach((function(t){t.castShadow=!1}))})),r.add(this.params,"Pointer_Lock").onChange((function(e){t.inputManager.setPointerLock(e)})),r.add(this.params,"Mouse_Sensitivity",0,1).onChange((function(e){t.cameraOperator.setSensitivity(e,.8*e)})),r.add(this.params,"Debug_Physics").onChange((function(n){n?e.cannonDebugRenderer=new f.CannonDebugRenderer(e.graphicsWorld,e.physicsWorld):(e.cannonDebugRenderer.clearMeshes(),e.cannonDebugRenderer=void 0),t.characters.forEach((function(t){t.raycastBox.visible=n}))})),r.add(this.params,"Debug_FPS").onChange((function(t){w.UIManager.setFPSVisible(t)})),n.open()},t}();e.World=T},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=n(2),o=n(7),a=n(6),s=function(){function t(t,e,n,r){void 0===n&&(n=1),void 0===r&&(r=.8*n),this.updateOrder=4,this.radius=1,this.targetRadius=1,this.upVelocity=0,this.forwardVelocity=0,this.rightVelocity=0,this.followMode=!1,this.world=t,this.camera=e,this.target=new i.Vector3,this.sensitivity=new i.Vector2(n,r),this.movementSpeed=.06,this.radius=3,this.theta=0,this.phi=0,this.onMouseDownPosition=new i.Vector2,this.onMouseDownTheta=this.theta,this.onMouseDownPhi=this.phi,this.actions={forward:new o.KeyBinding("KeyW"),back:new o.KeyBinding("KeyS"),left:new o.KeyBinding("KeyA"),right:new o.KeyBinding("KeyD"),up:new o.KeyBinding("KeyE"),down:new o.KeyBinding("KeyQ"),fast:new o.KeyBinding("ShiftLeft")},t.registerUpdatable(this)}return t.prototype.setSensitivity=function(t,e){void 0===e&&(e=t),this.sensitivity=new i.Vector2(t,e)},t.prototype.setRadius=function(t,e){void 0===e&&(e=!1),this.targetRadius=Math.max(.001,t),!0===e&&(this.radius=t)},t.prototype.move=function(t,e){this.theta-=t*(this.sensitivity.x/2),this.theta%=360,this.phi+=e*(this.sensitivity.y/2),this.phi=Math.min(85,Math.max(-85,this.phi))},t.prototype.update=function(t){if(!0===this.followMode){this.camera.position.y=i.MathUtils.clamp(this.camera.position.y,this.target.y,Number.POSITIVE_INFINITY),this.camera.lookAt(this.target);var e=this.target.clone().add((new i.Vector3).subVectors(this.camera.position,this.target).normalize().multiplyScalar(this.targetRadius));this.camera.position.x=e.x,this.camera.position.y=e.y,this.camera.position.z=e.z}else this.radius=i.MathUtils.lerp(this.radius,this.targetRadius,.1),this.camera.position.x=this.target.x+this.radius*Math.sin(this.theta*Math.PI/180)*Math.cos(this.phi*Math.PI/180),this.camera.position.y=this.target.y+this.radius*Math.sin(this.phi*Math.PI/180),this.camera.position.z=this.target.z+this.radius*Math.cos(this.theta*Math.PI/180)*Math.cos(this.phi*Math.PI/180),this.camera.updateMatrix(),this.camera.lookAt(this.target)},t.prototype.handleKeyboardEvent=function(t,e,n){if("KeyC"===e&&!0===n&&!0===t.shiftKey)void 0!==this.characterCaller&&(this.world.inputManager.setInputReceiver(this.characterCaller),this.characterCaller=void 0);else for(var i in this.actions)if(this.actions.hasOwnProperty(i)){var r=this.actions[i];a.includes(r.eventCodes,e)&&(r.isPressed=n)}},t.prototype.handleMouseWheel=function(t,e){this.world.scrollTheTimeScale(e)},t.prototype.handleMouseButton=function(t,e,n){for(var i in this.actions)if(this.actions.hasOwnProperty(i)){var r=this.actions[i];a.includes(r.eventCodes,e)&&(r.isPressed=n)}},t.prototype.handleMouseMove=function(t,e,n){this.move(e,n)},t.prototype.inputReceiverInit=function(){this.target.copy(this.camera.position),this.setRadius(0,!0),this.world.updateControls([{keys:["W","S","A","D"],desc:"Move around"},{keys:["E","Q"],desc:"Move up / down"},{keys:["Shift"],desc:"Speed up"},{keys:["Shift","+","C"],desc:"Exit free camera mode"}])},t.prototype.inputReceiverUpdate=function(t){var e=this.movementSpeed*(this.actions.fast.isPressed?600*t:60*t),n=r.getUp(this.camera),o=r.getRight(this.camera),a=r.getBack(this.camera);this.upVelocity=i.MathUtils.lerp(this.upVelocity,+this.actions.up.isPressed-+this.actions.down.isPressed,.3),this.forwardVelocity=i.MathUtils.lerp(this.forwardVelocity,+this.actions.forward.isPressed-+this.actions.back.isPressed,.3),this.rightVelocity=i.MathUtils.lerp(this.rightVelocity,+this.actions.right.isPressed-+this.actions.left.isPressed,.3),this.target.add(n.multiplyScalar(e*this.upVelocity)),this.target.add(a.multiplyScalar(e*this.forwardVelocity)),this.target.add(o.multiplyScalar(e*this.rightVelocity))},t}();e.CameraOperator=s},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){"use strict";n.r(e),n.d(e,"RenderPass",(function(){return r}));var i=n(4),r=function(t,e,n,r,o){i.a.call(this),this.scene=t,this.camera=e,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=void 0!==o?o:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1};r.prototype=Object.assign(Object.create(i.a.prototype),{constructor:r,render:function(t,e,n){var i,r,o=t.autoClear;t.autoClear=!1,this.scene.overrideMaterial=this.overrideMaterial,this.clearColor&&(i=t.getClearColor().getHex(),r=t.getClearAlpha(),t.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&t.clearDepth(),t.setRenderTarget(this.renderToScreen?null:n),this.clear&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),t.render(this.scene,this.camera),this.clearColor&&t.setClearColor(i,r),this.scene.overrideMaterial=null,t.autoClear=o}})},function(t,e,n){"use strict";n.r(e),n.d(e,"FXAAShader",(function(){return i}));var i={uniforms:{tDiffuse:{value:null},resolution:{value:new(n(0).Vector2)(1/1024,1/512)}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["precision highp float;","","uniform sampler2D tDiffuse;","","uniform vec2 resolution;","","varying vec2 vUv;","","// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)","","//----------------------------------------------------------------------------------","// File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag","// SDK Version: v3.00","// Email: gameworks@nvidia.com","// Site: http://developer.nvidia.com/","//","// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.","//","// Redistribution and use in source and binary forms, with or without","// modification, are permitted provided that the following conditions","// are met:","// * Redistributions of source code must retain the above copyright","// notice, this list of conditions and the following disclaimer.","// * Redistributions in binary form must reproduce the above copyright","// notice, this list of conditions and the following disclaimer in the","// documentation and/or other materials provided with the distribution.","// * Neither the name of NVIDIA CORPORATION nor the names of its","// contributors may be used to endorse or promote products derived","// from this software without specific prior written permission.","//","// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY","// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE","// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR","// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR","// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,","// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,","// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR","// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY","// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT","// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE","// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.","//","//----------------------------------------------------------------------------------","","#define FXAA_PC 1","#define FXAA_GLSL_100 1","#define FXAA_QUALITY_PRESET 12","","#define FXAA_GREEN_AS_LUMA 1","","/*--------------------------------------------------------------------------*/","#ifndef FXAA_PC_CONSOLE"," //"," // The console algorithm for PC is included"," // for developers targeting really low spec machines."," // Likely better to just run FXAA_PC, and use a really low preset."," //"," #define FXAA_PC_CONSOLE 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_GLSL_120"," #define FXAA_GLSL_120 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_GLSL_130"," #define FXAA_GLSL_130 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_HLSL_3"," #define FXAA_HLSL_3 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_HLSL_4"," #define FXAA_HLSL_4 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_HLSL_5"," #define FXAA_HLSL_5 0","#endif","/*==========================================================================*/","#ifndef FXAA_GREEN_AS_LUMA"," //"," // For those using non-linear color,"," // and either not able to get luma in alpha, or not wanting to,"," // this enables FXAA to run using green as a proxy for luma."," // So with this enabled, no need to pack luma in alpha."," //"," // This will turn off AA on anything which lacks some amount of green."," // Pure red and blue or combination of only R and B, will get no AA."," //"," // Might want to lower the settings for both,"," // fxaaConsoleEdgeThresholdMin"," // fxaaQualityEdgeThresholdMin"," // In order to insure AA does not get turned off on colors"," // which contain a minor amount of green."," //"," // 1 = On."," // 0 = Off."," //"," #define FXAA_GREEN_AS_LUMA 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_EARLY_EXIT"," //"," // Controls algorithm's early exit path."," // On PS3 turning this ON adds 2 cycles to the shader."," // On 360 turning this OFF adds 10ths of a millisecond to the shader."," // Turning this off on console will result in a more blurry image."," // So this defaults to on."," //"," // 1 = On."," // 0 = Off."," //"," #define FXAA_EARLY_EXIT 1","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_DISCARD"," //"," // Only valid for PC OpenGL currently."," // Probably will not work when FXAA_GREEN_AS_LUMA = 1."," //"," // 1 = Use discard on pixels which don't need AA."," // For APIs which enable concurrent TEX+ROP from same surface."," // 0 = Return unchanged color on pixels which don't need AA."," //"," #define FXAA_DISCARD 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_FAST_PIXEL_OFFSET"," //"," // Used for GLSL 120 only."," //"," // 1 = GL API supports fast pixel offsets"," // 0 = do not use fast pixel offsets"," //"," #ifdef GL_EXT_gpu_shader4"," #define FXAA_FAST_PIXEL_OFFSET 1"," #endif"," #ifdef GL_NV_gpu_shader5"," #define FXAA_FAST_PIXEL_OFFSET 1"," #endif"," #ifdef GL_ARB_gpu_shader5"," #define FXAA_FAST_PIXEL_OFFSET 1"," #endif"," #ifndef FXAA_FAST_PIXEL_OFFSET"," #define FXAA_FAST_PIXEL_OFFSET 0"," #endif","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_GATHER4_ALPHA"," //"," // 1 = API supports gather4 on alpha channel."," // 0 = API does not support gather4 on alpha channel."," //"," #if (FXAA_HLSL_5 == 1)"," #define FXAA_GATHER4_ALPHA 1"," #endif"," #ifdef GL_ARB_gpu_shader5"," #define FXAA_GATHER4_ALPHA 1"," #endif"," #ifdef GL_NV_gpu_shader5"," #define FXAA_GATHER4_ALPHA 1"," #endif"," #ifndef FXAA_GATHER4_ALPHA"," #define FXAA_GATHER4_ALPHA 0"," #endif","#endif","","","/*============================================================================"," FXAA QUALITY - TUNING KNOBS","------------------------------------------------------------------------------","NOTE the other tuning knobs are now in the shader function inputs!","============================================================================*/","#ifndef FXAA_QUALITY_PRESET"," //"," // Choose the quality preset."," // This needs to be compiled into the shader as it effects code."," // Best option to include multiple presets is to"," // in each shader define the preset, then include this file."," //"," // OPTIONS"," // -----------------------------------------------------------------------"," // 10 to 15 - default medium dither (10=fastest, 15=highest quality)"," // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)"," // 39 - no dither, very expensive"," //"," // NOTES"," // -----------------------------------------------------------------------"," // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)"," // 13 = about same speed as FXAA 3.9 and better than 12"," // 23 = closest to FXAA 3.9 visually and performance wise"," // _ = the lowest digit is directly related to performance"," // _ = the highest digit is directly related to style"," //"," #define FXAA_QUALITY_PRESET 12","#endif","","","/*============================================================================",""," FXAA QUALITY - PRESETS","","============================================================================*/","","/*============================================================================"," FXAA QUALITY - MEDIUM DITHER PRESETS","============================================================================*/","#if (FXAA_QUALITY_PRESET == 10)"," #define FXAA_QUALITY_PS 3"," #define FXAA_QUALITY_P0 1.5"," #define FXAA_QUALITY_P1 3.0"," #define FXAA_QUALITY_P2 12.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 11)"," #define FXAA_QUALITY_PS 4"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 3.0"," #define FXAA_QUALITY_P3 12.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 12)"," #define FXAA_QUALITY_PS 5"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 4.0"," #define FXAA_QUALITY_P4 12.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 13)"," #define FXAA_QUALITY_PS 6"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 4.0"," #define FXAA_QUALITY_P5 12.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 14)"," #define FXAA_QUALITY_PS 7"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 4.0"," #define FXAA_QUALITY_P6 12.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 15)"," #define FXAA_QUALITY_PS 8"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 4.0"," #define FXAA_QUALITY_P7 12.0","#endif","","/*============================================================================"," FXAA QUALITY - LOW DITHER PRESETS","============================================================================*/","#if (FXAA_QUALITY_PRESET == 20)"," #define FXAA_QUALITY_PS 3"," #define FXAA_QUALITY_P0 1.5"," #define FXAA_QUALITY_P1 2.0"," #define FXAA_QUALITY_P2 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 21)"," #define FXAA_QUALITY_PS 4"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 22)"," #define FXAA_QUALITY_PS 5"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 23)"," #define FXAA_QUALITY_PS 6"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 24)"," #define FXAA_QUALITY_PS 7"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 3.0"," #define FXAA_QUALITY_P6 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 25)"," #define FXAA_QUALITY_PS 8"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 4.0"," #define FXAA_QUALITY_P7 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 26)"," #define FXAA_QUALITY_PS 9"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 2.0"," #define FXAA_QUALITY_P7 4.0"," #define FXAA_QUALITY_P8 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 27)"," #define FXAA_QUALITY_PS 10"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 2.0"," #define FXAA_QUALITY_P7 2.0"," #define FXAA_QUALITY_P8 4.0"," #define FXAA_QUALITY_P9 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 28)"," #define FXAA_QUALITY_PS 11"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 2.0"," #define FXAA_QUALITY_P7 2.0"," #define FXAA_QUALITY_P8 2.0"," #define FXAA_QUALITY_P9 4.0"," #define FXAA_QUALITY_P10 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 29)"," #define FXAA_QUALITY_PS 12"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 2.0"," #define FXAA_QUALITY_P7 2.0"," #define FXAA_QUALITY_P8 2.0"," #define FXAA_QUALITY_P9 2.0"," #define FXAA_QUALITY_P10 4.0"," #define FXAA_QUALITY_P11 8.0","#endif","","/*============================================================================"," FXAA QUALITY - EXTREME QUALITY","============================================================================*/","#if (FXAA_QUALITY_PRESET == 39)"," #define FXAA_QUALITY_PS 12"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.0"," #define FXAA_QUALITY_P2 1.0"," #define FXAA_QUALITY_P3 1.0"," #define FXAA_QUALITY_P4 1.0"," #define FXAA_QUALITY_P5 1.5"," #define FXAA_QUALITY_P6 2.0"," #define FXAA_QUALITY_P7 2.0"," #define FXAA_QUALITY_P8 2.0"," #define FXAA_QUALITY_P9 2.0"," #define FXAA_QUALITY_P10 4.0"," #define FXAA_QUALITY_P11 8.0","#endif","","","","/*============================================================================",""," API PORTING","","============================================================================*/","#if (FXAA_GLSL_100 == 1) || (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)"," #define FxaaBool bool"," #define FxaaDiscard discard"," #define FxaaFloat float"," #define FxaaFloat2 vec2"," #define FxaaFloat3 vec3"," #define FxaaFloat4 vec4"," #define FxaaHalf float"," #define FxaaHalf2 vec2"," #define FxaaHalf3 vec3"," #define FxaaHalf4 vec4"," #define FxaaInt2 ivec2"," #define FxaaSat(x) clamp(x, 0.0, 1.0)"," #define FxaaTex sampler2D","#else"," #define FxaaBool bool"," #define FxaaDiscard clip(-1)"," #define FxaaFloat float"," #define FxaaFloat2 float2"," #define FxaaFloat3 float3"," #define FxaaFloat4 float4"," #define FxaaHalf half"," #define FxaaHalf2 half2"," #define FxaaHalf3 half3"," #define FxaaHalf4 half4"," #define FxaaSat(x) saturate(x)","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_GLSL_100 == 1)"," #define FxaaTexTop(t, p) texture2D(t, p, 0.0)"," #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_GLSL_120 == 1)"," // Requires,"," // #version 120"," // And at least,"," // #extension GL_EXT_gpu_shader4 : enable"," // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)"," #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)"," #if (FXAA_FAST_PIXEL_OFFSET == 1)"," #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)"," #else"," #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)"," #endif"," #if (FXAA_GATHER4_ALPHA == 1)"," // use #extension GL_ARB_gpu_shader5 : enable"," #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)"," #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)"," #define FxaaTexGreen4(t, p) textureGather(t, p, 1)"," #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)"," #endif","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_GLSL_130 == 1)",' // Requires "#version 130" or better'," #define FxaaTexTop(t, p) textureLod(t, p, 0.0)"," #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)"," #if (FXAA_GATHER4_ALPHA == 1)"," // use #extension GL_ARB_gpu_shader5 : enable"," #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)"," #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)"," #define FxaaTexGreen4(t, p) textureGather(t, p, 1)"," #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)"," #endif","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_HLSL_3 == 1)"," #define FxaaInt2 float2"," #define FxaaTex sampler2D"," #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))"," #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_HLSL_4 == 1)"," #define FxaaInt2 int2"," struct FxaaTex { SamplerState smpl; Texture2D tex; };"," #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)"," #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_HLSL_5 == 1)"," #define FxaaInt2 int2"," struct FxaaTex { SamplerState smpl; Texture2D tex; };"," #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)"," #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)"," #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)"," #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)"," #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)"," #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)","#endif","","","/*============================================================================"," GREEN AS LUMA OPTION SUPPORT FUNCTION","============================================================================*/","#if (FXAA_GREEN_AS_LUMA == 0)"," FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }","#else"," FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }","#endif","","","","","/*============================================================================",""," FXAA3 QUALITY - PC","","============================================================================*/","#if (FXAA_PC == 1)","/*--------------------------------------------------------------------------*/","FxaaFloat4 FxaaPixelShader("," //"," // Use noperspective interpolation here (turn off perspective interpolation)."," // {xy} = center of pixel"," FxaaFloat2 pos,"," //"," // Used only for FXAA Console, and not used on the 360 version."," // Use noperspective interpolation here (turn off perspective interpolation)."," // {xy_} = upper left of pixel"," // {_zw} = lower right of pixel"," FxaaFloat4 fxaaConsolePosPos,"," //"," // Input color texture."," // {rgb_} = color in linear or perceptual color space"," // if (FXAA_GREEN_AS_LUMA == 0)"," // {__a} = luma in perceptual color space (not linear)"," FxaaTex tex,"," //"," // Only used on the optimized 360 version of FXAA Console.",' // For everything but 360, just use the same input here as for "tex".'," // For 360, same texture, just alias with a 2nd sampler."," // This sampler needs to have an exponent bias of -1."," FxaaTex fxaaConsole360TexExpBiasNegOne,"," //"," // Only used on the optimized 360 version of FXAA Console.",' // For everything but 360, just use the same input here as for "tex".'," // For 360, same texture, just alias with a 3nd sampler."," // This sampler needs to have an exponent bias of -2."," FxaaTex fxaaConsole360TexExpBiasNegTwo,"," //"," // Only used on FXAA Quality."," // This must be from a constant/uniform."," // {x_} = 1.0/screenWidthInPixels"," // {_y} = 1.0/screenHeightInPixels"," FxaaFloat2 fxaaQualityRcpFrame,"," //"," // Only used on FXAA Console."," // This must be from a constant/uniform."," // This effects sub-pixel AA quality and inversely sharpness."," // Where N ranges between,"," // N = 0.50 (default)"," // N = 0.33 (sharper)"," // {x__} = -N/screenWidthInPixels"," // {_y_} = -N/screenHeightInPixels"," // {_z_} = N/screenWidthInPixels"," // {__w} = N/screenHeightInPixels"," FxaaFloat4 fxaaConsoleRcpFrameOpt,"," //"," // Only used on FXAA Console."," // Not used on 360, but used on PS3 and PC."," // This must be from a constant/uniform."," // {x__} = -2.0/screenWidthInPixels"," // {_y_} = -2.0/screenHeightInPixels"," // {_z_} = 2.0/screenWidthInPixels"," // {__w} = 2.0/screenHeightInPixels"," FxaaFloat4 fxaaConsoleRcpFrameOpt2,"," //"," // Only used on FXAA Console."," // Only used on 360 in place of fxaaConsoleRcpFrameOpt2."," // This must be from a constant/uniform."," // {x__} = 8.0/screenWidthInPixels"," // {_y_} = 8.0/screenHeightInPixels"," // {_z_} = -4.0/screenWidthInPixels"," // {__w} = -4.0/screenHeightInPixels"," FxaaFloat4 fxaaConsole360RcpFrameOpt2,"," //"," // Only used on FXAA Quality."," // This used to be the FXAA_QUALITY_SUBPIX define."," // It is here now to allow easier tuning."," // Choose the amount of sub-pixel aliasing removal."," // This can effect sharpness."," // 1.00 - upper limit (softer)"," // 0.75 - default amount of filtering"," // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)"," // 0.25 - almost off"," // 0.00 - completely off"," FxaaFloat fxaaQualitySubpix,"," //"," // Only used on FXAA Quality."," // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define."," // It is here now to allow easier tuning."," // The minimum amount of local contrast required to apply algorithm."," // 0.333 - too little (faster)"," // 0.250 - low quality"," // 0.166 - default"," // 0.125 - high quality"," // 0.063 - overkill (slower)"," FxaaFloat fxaaQualityEdgeThreshold,"," //"," // Only used on FXAA Quality."," // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define."," // It is here now to allow easier tuning."," // Trims the algorithm from processing darks."," // 0.0833 - upper limit (default, the start of visible unfiltered edges)"," // 0.0625 - high quality (faster)"," // 0.0312 - visible limit (slower)"," // Special notes when using FXAA_GREEN_AS_LUMA,"," // Likely want to set this to zero."," // As colors that are mostly not-green"," // will appear very dark in the green channel!"," // Tune by looking at mostly non-green content,"," // then start at zero and increase until aliasing is a problem."," FxaaFloat fxaaQualityEdgeThresholdMin,"," //"," // Only used on FXAA Console."," // This used to be the FXAA_CONSOLE_EDGE_SHARPNESS define."," // It is here now to allow easier tuning."," // This does not effect PS3, as this needs to be compiled in."," // Use FXAA_CONSOLE_PS3_EDGE_SHARPNESS for PS3."," // Due to the PS3 being ALU bound,"," // there are only three safe values here: 2 and 4 and 8."," // These options use the shaders ability to a free *|/ by 2|4|8."," // For all other platforms can be a non-power of two."," // 8.0 is sharper (default!!!)"," // 4.0 is softer"," // 2.0 is really soft (good only for vector graphics inputs)"," FxaaFloat fxaaConsoleEdgeSharpness,"," //"," // Only used on FXAA Console."," // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD define."," // It is here now to allow easier tuning."," // This does not effect PS3, as this needs to be compiled in."," // Use FXAA_CONSOLE_PS3_EDGE_THRESHOLD for PS3."," // Due to the PS3 being ALU bound,"," // there are only two safe values here: 1/4 and 1/8."," // These options use the shaders ability to a free *|/ by 2|4|8."," // The console setting has a different mapping than the quality setting."," // Other platforms can use other values."," // 0.125 leaves less aliasing, but is softer (default!!!)"," // 0.25 leaves more aliasing, and is sharper"," FxaaFloat fxaaConsoleEdgeThreshold,"," //"," // Only used on FXAA Console."," // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD_MIN define."," // It is here now to allow easier tuning."," // Trims the algorithm from processing darks."," // The console setting has a different mapping than the quality setting."," // This only applies when FXAA_EARLY_EXIT is 1."," // This does not apply to PS3,"," // PS3 was simplified to avoid more shader instructions."," // 0.06 - faster but more aliasing in darks"," // 0.05 - default"," // 0.04 - slower and less aliasing in darks"," // Special notes when using FXAA_GREEN_AS_LUMA,"," // Likely want to set this to zero."," // As colors that are mostly not-green"," // will appear very dark in the green channel!"," // Tune by looking at mostly non-green content,"," // then start at zero and increase until aliasing is a problem."," FxaaFloat fxaaConsoleEdgeThresholdMin,"," //"," // Extra constants for 360 FXAA Console only."," // Use zeros or anything else for other platforms."," // These must be in physical constant registers and NOT immediates."," // Immediates will result in compiler un-optimizing."," // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)"," FxaaFloat4 fxaaConsole360ConstDir",") {","/*--------------------------------------------------------------------------*/"," FxaaFloat2 posM;"," posM.x = pos.x;"," posM.y = pos.y;"," #if (FXAA_GATHER4_ALPHA == 1)"," #if (FXAA_DISCARD == 0)"," FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);"," #if (FXAA_GREEN_AS_LUMA == 0)"," #define lumaM rgbyM.w"," #else"," #define lumaM rgbyM.y"," #endif"," #endif"," #if (FXAA_GREEN_AS_LUMA == 0)"," FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);"," FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));"," #else"," FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);"," FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));"," #endif"," #if (FXAA_DISCARD == 1)"," #define lumaM luma4A.w"," #endif"," #define lumaE luma4A.z"," #define lumaS luma4A.x"," #define lumaSE luma4A.y"," #define lumaNW luma4B.w"," #define lumaN luma4B.z"," #define lumaW luma4B.x"," #else"," FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);"," #if (FXAA_GREEN_AS_LUMA == 0)"," #define lumaM rgbyM.w"," #else"," #define lumaM rgbyM.y"," #endif"," #if (FXAA_GLSL_100 == 1)"," FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0, 1.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 0.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0,-1.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));"," #else"," FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));"," #endif"," #endif","/*--------------------------------------------------------------------------*/"," FxaaFloat maxSM = max(lumaS, lumaM);"," FxaaFloat minSM = min(lumaS, lumaM);"," FxaaFloat maxESM = max(lumaE, maxSM);"," FxaaFloat minESM = min(lumaE, minSM);"," FxaaFloat maxWN = max(lumaN, lumaW);"," FxaaFloat minWN = min(lumaN, lumaW);"," FxaaFloat rangeMax = max(maxWN, maxESM);"," FxaaFloat rangeMin = min(minWN, minESM);"," FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;"," FxaaFloat range = rangeMax - rangeMin;"," FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);"," FxaaBool earlyExit = range < rangeMaxClamped;","/*--------------------------------------------------------------------------*/"," if(earlyExit)"," #if (FXAA_DISCARD == 1)"," FxaaDiscard;"," #else"," return rgbyM;"," #endif","/*--------------------------------------------------------------------------*/"," #if (FXAA_GATHER4_ALPHA == 0)"," #if (FXAA_GLSL_100 == 1)"," FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 1.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0,-1.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));"," #else"," FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));"," #endif"," #else"," FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));"," #endif","/*--------------------------------------------------------------------------*/"," FxaaFloat lumaNS = lumaN + lumaS;"," FxaaFloat lumaWE = lumaW + lumaE;"," FxaaFloat subpixRcpRange = 1.0/range;"," FxaaFloat subpixNSWE = lumaNS + lumaWE;"," FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;"," FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;","/*--------------------------------------------------------------------------*/"," FxaaFloat lumaNESE = lumaNE + lumaSE;"," FxaaFloat lumaNWNE = lumaNW + lumaNE;"," FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;"," FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;","/*--------------------------------------------------------------------------*/"," FxaaFloat lumaNWSW = lumaNW + lumaSW;"," FxaaFloat lumaSWSE = lumaSW + lumaSE;"," FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);"," FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);"," FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;"," FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;"," FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;"," FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;","/*--------------------------------------------------------------------------*/"," FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;"," FxaaFloat lengthSign = fxaaQualityRcpFrame.x;"," FxaaBool horzSpan = edgeHorz >= edgeVert;"," FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;","/*--------------------------------------------------------------------------*/"," if(!horzSpan) lumaN = lumaW;"," if(!horzSpan) lumaS = lumaE;"," if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;"," FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;","/*--------------------------------------------------------------------------*/"," FxaaFloat gradientN = lumaN - lumaM;"," FxaaFloat gradientS = lumaS - lumaM;"," FxaaFloat lumaNN = lumaN + lumaM;"," FxaaFloat lumaSS = lumaS + lumaM;"," FxaaBool pairN = abs(gradientN) >= abs(gradientS);"," FxaaFloat gradient = max(abs(gradientN), abs(gradientS));"," if(pairN) lengthSign = -lengthSign;"," FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);","/*--------------------------------------------------------------------------*/"," FxaaFloat2 posB;"," posB.x = posM.x;"," posB.y = posM.y;"," FxaaFloat2 offNP;"," offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;"," offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;"," if(!horzSpan) posB.x += lengthSign * 0.5;"," if( horzSpan) posB.y += lengthSign * 0.5;","/*--------------------------------------------------------------------------*/"," FxaaFloat2 posN;"," posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;"," posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;"," FxaaFloat2 posP;"," posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;"," posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;"," FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;"," FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));"," FxaaFloat subpixE = subpixC * subpixC;"," FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));","/*--------------------------------------------------------------------------*/"," if(!pairN) lumaNN = lumaSS;"," FxaaFloat gradientScaled = gradient * 1.0/4.0;"," FxaaFloat lumaMM = lumaM - lumaNN * 0.5;"," FxaaFloat subpixF = subpixD * subpixE;"," FxaaBool lumaMLTZero = lumaMM < 0.0;","/*--------------------------------------------------------------------------*/"," lumaEndN -= lumaNN * 0.5;"," lumaEndP -= lumaNN * 0.5;"," FxaaBool doneN = abs(lumaEndN) >= gradientScaled;"," FxaaBool doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;"," FxaaBool doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;","/*--------------------------------------------------------------------------*/"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 3)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 4)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 5)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 6)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 7)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 8)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 9)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 10)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 11)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 12)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }","/*--------------------------------------------------------------------------*/"," FxaaFloat dstN = posM.x - posN.x;"," FxaaFloat dstP = posP.x - posM.x;"," if(!horzSpan) dstN = posM.y - posN.y;"," if(!horzSpan) dstP = posP.y - posM.y;","/*--------------------------------------------------------------------------*/"," FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;"," FxaaFloat spanLength = (dstP + dstN);"," FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;"," FxaaFloat spanLengthRcp = 1.0/spanLength;","/*--------------------------------------------------------------------------*/"," FxaaBool directionN = dstN < dstP;"," FxaaFloat dst = min(dstN, dstP);"," FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;"," FxaaFloat subpixG = subpixF * subpixF;"," FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;"," FxaaFloat subpixH = subpixG * fxaaQualitySubpix;","/*--------------------------------------------------------------------------*/"," FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;"," FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);"," if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;"," if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;"," #if (FXAA_DISCARD == 1)"," return FxaaTexTop(tex, posM);"," #else"," return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);"," #endif","}","/*==========================================================================*/","#endif","","void main() {"," gl_FragColor = FxaaPixelShader("," vUv,"," vec4(0.0),"," tDiffuse,"," tDiffuse,"," tDiffuse,"," resolution,"," vec4(0.0),"," vec4(0.0),"," vec4(0.0),"," 0.75,"," 0.166,"," 0.0833,"," 0.0,"," 0.0,"," 0.0,"," vec4(0.0)"," );",""," // TODO avoid querying texture twice for same texel"," gl_FragColor.a = texture2D(tDiffuse, vUv).a;","}"].join("\n")}},function(t,e,n){"use strict";n.r(e),n.d(e,"Stats",(function(){return i}));var i=function(){var t=document.createElement("div");function e(e){return t.appendChild(e.dom),e}function n(e){for(var n=0;no+1e3&&(s.update(1e3*a/(t-o),100),o=t,a=0,l)){var e=performance.memory;l.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576)}return t},update:function(){r=this.end()},domElement:t,setMode:n}};i.Panel=function(t,e,n){var i=1/0,r=0,o=Math.round,a=o(window.devicePixelRatio||1),s=100*a,c=48*a,l=3*a,u=2*a,h=3*a,p=15*a,d=94*a,f=30*a,m=document.createElement("canvas");m.width=s,m.height=c,m.style.cssText="width:100px;height:48px";var v=m.getContext("2d");return v.font="bold "+9*a+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=n,v.fillRect(0,0,s,c),v.fillStyle=e,v.fillText(t,l,u),v.fillRect(h,p,d,f),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(h,p,d,f),{dom:m,update:function(c,g){i=Math.min(i,c),r=Math.max(r,c),v.fillStyle=n,v.globalAlpha=1,v.fillRect(0,0,s,p),v.fillStyle=e,v.fillText(o(c)+" "+t+" ("+o(i)+"-"+o(r)+")",l,u),v.drawImage(m,h+a,p,d-a,f,h,p,d-a,f),v.fillRect(h+d-a,p,a,f),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(h+d-a,p,a,o((1-c/g)*f))}}}},function(t,e,n){t.exports=function(){"use strict";function t(t,e){var n=t.__state.conversionName.toString(),i=Math.round(t.r),r=Math.round(t.g),o=Math.round(t.b),a=t.a,s=Math.round(t.h),c=t.s.toFixed(1),l=t.v.toFixed(1);if(e||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var u=t.hex.toString(16);u.length<6;)u="0"+u;return"#"+u}return"CSS_RGB"===n?"rgb("+i+","+r+","+o+")":"CSS_RGBA"===n?"rgba("+i+","+r+","+o+","+a+")":"HEX"===n?"0x"+t.hex.toString(16):"RGB_ARRAY"===n?"["+i+","+r+","+o+"]":"RGBA_ARRAY"===n?"["+i+","+r+","+o+","+a+"]":"RGB_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+"}":"RGBA_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+",a:"+a+"}":"HSV_OBJ"===n?"{h:"+s+",s:"+c+",v:"+l+"}":"HSVA_OBJ"===n?"{h:"+s+",s:"+c+",v:"+l+",a:"+a+"}":"unknown format"}var e=Array.prototype.forEach,n=Array.prototype.slice,i={BREAK:{},extend:function(t){return this.each(n.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(e[n])||(t[n]=e[n])}.bind(this))}),this),t},defaults:function(t){return this.each(n.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(t[n])&&(t[n]=e[n])}.bind(this))}),this),t},compose:function(){var t=n.call(arguments);return function(){for(var e=n.call(arguments),i=t.length-1;i>=0;i--)e=[t[i].apply(this,e)];return e[0]}},each:function(t,n,i){if(t)if(e&&t.forEach&&t.forEach===e)t.forEach(n,i);else if(t.length===t.length+0){var r,o=void 0;for(o=0,r=t.length;o1?i.toArray(arguments):arguments[0];return i.each(r,(function(e){if(e.litmus(t))return i.each(e.conversions,(function(e,n){if(o=e.read(t),!1===a&&!1!==o)return a=o,o.conversionName=n,o.conversion=e,i.BREAK})),i.BREAK})),a},c=void 0,l={hsv_to_rgb:function(t,e,n){var i=Math.floor(t/60)%6,r=t/60-Math.floor(t/60),o=n*(1-e),a=n*(1-r*e),s=n*(1-(1-r)*e),c=[[n,s,o],[a,n,o],[o,n,s],[o,a,n],[s,o,n],[n,o,a]][i];return{r:255*c[0],g:255*c[1],b:255*c[2]}},rgb_to_hsv:function(t,e,n){var i=Math.min(t,e,n),r=Math.max(t,e,n),o=r-i,a=void 0;return 0===r?{h:NaN,s:0,v:0}:(a=t===r?(e-n)/o:e===r?2+(n-t)/o:4+(t-e)/o,(a/=6)<0&&(a+=1),{h:360*a,s:o/r,v:r/255})},rgb_to_hex:function(t,e,n){var i=this.hex_with_component(0,2,t);return i=this.hex_with_component(i,1,e),i=this.hex_with_component(i,0,n)},component_from_hex:function(t,e){return t>>8*e&255},hex_with_component:function(t,e,n){return n<<(c=8*e)|t&~(255<-1?e.length-e.indexOf(".")-1:0}var P=function(t){function e(t,n,r){h(this,e);var o=m(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),a=r||{};return o.__min=a.min,o.__max=a.max,o.__step=a.step,i.isUndefined(o.__step)?0===o.initialValue?o.__impliedStep=1:o.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(o.initialValue))/Math.LN10))/10:o.__impliedStep=o.__step,o.__precision=T(o.__impliedStep),o}return f(e,t),p(e,[{key:"setValue",value:function(t){var n=t;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),d(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(t){return this.__min=t,this}},{key:"max",value:function(t){return this.__max=t,this}},{key:"step",value:function(t){return this.__step=t,this.__impliedStep=t,this.__precision=T(t),this}}]),e}(w),L=function(t){function e(t,n,r){h(this,e);var o=m(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,r));o.__truncationSuspended=!1;var a=o,s=void 0;function c(){a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function l(t){var e=s-t.clientY;a.setValue(a.getValue()+e*a.__impliedStep),s=t.clientY}function u(){S.unbind(window,"mousemove",l),S.unbind(window,"mouseup",u),c()}return o.__input=document.createElement("input"),o.__input.setAttribute("type","text"),S.bind(o.__input,"change",(function(){var t=parseFloat(a.__input.value);i.isNaN(t)||a.setValue(t)})),S.bind(o.__input,"blur",(function(){c()})),S.bind(o.__input,"mousedown",(function(t){S.bind(window,"mousemove",l),S.bind(window,"mouseup",u),s=t.clientY})),S.bind(o.__input,"keydown",(function(t){13===t.keyCode&&(a.__truncationSuspended=!0,this.blur(),a.__truncationSuspended=!1,c())})),o.updateDisplay(),o.domElement.appendChild(o.__input),o}return f(e,t),p(e,[{key:"updateDisplay",value:function(){var t,n,i;return this.__input.value=this.__truncationSuspended?this.getValue():(t=this.getValue(),n=this.__precision,i=Math.pow(10,n),Math.round(t*i)/i),d(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(P);function C(t,e,n,i,r){return i+(t-e)/(n-e)*(r-i)}var R=function(t){function e(t,n,i,r,o){h(this,e);var a=m(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,{min:i,max:r,step:o})),s=a;function c(t){t.preventDefault();var e=s.__background.getBoundingClientRect();return s.setValue(C(t.clientX,e.left,e.right,s.__min,s.__max)),!1}function l(){S.unbind(window,"mousemove",c),S.unbind(window,"mouseup",l),s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function u(t){var e=t.touches[0].clientX,n=s.__background.getBoundingClientRect();s.setValue(C(e,n.left,n.right,s.__min,s.__max))}function p(){S.unbind(window,"touchmove",u),S.unbind(window,"touchend",p),s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}return a.__background=document.createElement("div"),a.__foreground=document.createElement("div"),S.bind(a.__background,"mousedown",(function(t){document.activeElement.blur(),S.bind(window,"mousemove",c),S.bind(window,"mouseup",l),c(t)})),S.bind(a.__background,"touchstart",(function(t){1===t.touches.length&&(S.bind(window,"touchmove",u),S.bind(window,"touchend",p),u(t))})),S.addClass(a.__background,"slider"),S.addClass(a.__foreground,"slider-fg"),a.updateDisplay(),a.__background.appendChild(a.__foreground),a.domElement.appendChild(a.__background),a}return f(e,t),p(e,[{key:"updateDisplay",value:function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",d(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(P),O=function(t){function e(t,n,i){h(this,e);var r=m(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=r;return r.__button=document.createElement("div"),r.__button.innerHTML=void 0===i?"Fire":i,S.bind(r.__button,"click",(function(t){return t.preventDefault(),o.fire(),!1})),S.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return f(e,t),p(e,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),e}(w),F=function(t){function e(t,n){h(this,e);var r=m(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));r.__color=new v(r.getValue()),r.__temp=new v(0);var o=r;r.domElement=document.createElement("div"),S.makeSelectable(r.domElement,!1),r.__selector=document.createElement("div"),r.__selector.className="selector",r.__saturation_field=document.createElement("div"),r.__saturation_field.className="saturation-field",r.__field_knob=document.createElement("div"),r.__field_knob.className="field-knob",r.__field_knob_border="2px solid ",r.__hue_knob=document.createElement("div"),r.__hue_knob.className="hue-knob",r.__hue_field=document.createElement("div"),r.__hue_field.className="hue-field",r.__input=document.createElement("input"),r.__input.type="text",r.__input_textShadow="0 1px 1px ",S.bind(r.__input,"keydown",(function(t){13===t.keyCode&&f.call(this)})),S.bind(r.__input,"blur",f),S.bind(r.__selector,"mousedown",(function(){S.addClass(this,"drag").bind(window,"mouseup",(function(){S.removeClass(o.__selector,"drag")}))})),S.bind(r.__selector,"touchstart",(function(){S.addClass(this,"drag").bind(window,"touchend",(function(){S.removeClass(o.__selector,"drag")}))}));var a,c=document.createElement("div");function l(t){y(t),S.bind(window,"mousemove",y),S.bind(window,"touchmove",y),S.bind(window,"mouseup",p),S.bind(window,"touchend",p)}function u(t){w(t),S.bind(window,"mousemove",w),S.bind(window,"touchmove",w),S.bind(window,"mouseup",d),S.bind(window,"touchend",d)}function p(){S.unbind(window,"mousemove",y),S.unbind(window,"touchmove",y),S.unbind(window,"mouseup",p),S.unbind(window,"touchend",p),g()}function d(){S.unbind(window,"mousemove",w),S.unbind(window,"touchmove",w),S.unbind(window,"mouseup",d),S.unbind(window,"touchend",d),g()}function f(){var t=s(this.value);!1!==t?(o.__color.__state=t,o.setValue(o.__color.toOriginal())):this.value=o.__color.toString()}function g(){o.__onFinishChange&&o.__onFinishChange.call(o,o.__color.toOriginal())}function y(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=o.__saturation_field.getBoundingClientRect(),n=t.touches&&t.touches[0]||t,i=n.clientX,r=n.clientY,a=(i-e.left)/(e.right-e.left),s=1-(r-e.top)/(e.bottom-e.top);return s>1?s=1:s<0&&(s=0),a>1?a=1:a<0&&(a=0),o.__color.v=s,o.__color.s=a,o.setValue(o.__color.toOriginal()),!1}function w(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=o.__hue_field.getBoundingClientRect(),n=1-((t.touches&&t.touches[0]||t).clientY-e.top)/(e.bottom-e.top);return n>1?n=1:n<0&&(n=0),o.__color.h=360*n,o.setValue(o.__color.toOriginal()),!1}return i.extend(r.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(r.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:r.__field_knob_border+(r.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(r.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(r.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(c.style,{width:"100%",height:"100%",background:"none"}),N(c,"top","rgba(0,0,0,0)","#000"),i.extend(r.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(a=r.__hue_field).style.background="",a.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",a.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",a.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",a.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",a.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",i.extend(r.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,textShadow:r.__input_textShadow+"rgba(0,0,0,0.7)"}),S.bind(r.__saturation_field,"mousedown",l),S.bind(r.__saturation_field,"touchstart",l),S.bind(r.__field_knob,"mousedown",l),S.bind(r.__field_knob,"touchstart",l),S.bind(r.__hue_field,"mousedown",u),S.bind(r.__hue_field,"touchstart",u),r.__saturation_field.appendChild(c),r.__selector.appendChild(r.__field_knob),r.__selector.appendChild(r.__saturation_field),r.__selector.appendChild(r.__hue_field),r.__hue_field.appendChild(r.__hue_knob),r.domElement.appendChild(r.__input),r.domElement.appendChild(r.__selector),r.updateDisplay(),r}return f(e,t),p(e,[{key:"updateDisplay",value:function(){var t=s(this.getValue());if(!1!==t){var e=!1;i.each(v.COMPONENTS,(function(n){if(!i.isUndefined(t[n])&&!i.isUndefined(this.__color.__state[n])&&t[n]!==this.__color.__state[n])return e=!0,{}}),this),e&&i.extend(this.__color.__state,t)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,r=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,N(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+r+","+r+","+r+",.7)"})}}]),e}(w),I=["-moz-","-o-","-webkit-","-ms-",""];function N(t,e,n,r){t.style.background="",i.each(I,(function(i){t.style.cssText+="background: "+i+"linear-gradient("+e+", "+n+" 0%, "+r+" 100%); "}))}var B='
      \n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
      \n\n Automatically save\n values to localStorage on exit.\n\n
      The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
      \n\n
      \n\n
      ',D=function(t,e){var n=t[e];return i.isArray(arguments[2])||i.isObject(arguments[2])?new E(t,e,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new R(t,e,arguments[2],arguments[3],arguments[4]):new R(t,e,arguments[2],arguments[3]):i.isNumber(arguments[4])?new L(t,e,{min:arguments[2],max:arguments[3],step:arguments[4]}):new L(t,e,{min:arguments[2],max:arguments[3]}):i.isString(n)?new A(t,e):i.isFunction(n)?new O(t,e,""):i.isBoolean(n)?new M(t,e):null},z=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,1e3/60)},V=function(){function t(){h(this,t),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),S.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var e=this;S.bind(this.backgroundElement,"click",(function(){e.hide()}))}return p(t,[{key:"show",value:function(){var t=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer((function(){t.backgroundElement.style.opacity=1,t.domElement.style.opacity=1,t.domElement.style.webkitTransform="scale(1)"}))}},{key:"hide",value:function(){var t=this,e=function e(){t.domElement.style.display="none",t.backgroundElement.style.display="none",S.unbind(t.domElement,"webkitTransitionEnd",e),S.unbind(t.domElement,"transitionend",e),S.unbind(t.domElement,"oTransitionEnd",e)};S.bind(this.domElement,"webkitTransitionEnd",e),S.bind(this.domElement,"transitionend",e),S.bind(this.domElement,"oTransitionEnd",e),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-S.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-S.getHeight(this.domElement)/2+"px"}}]),t}(),U="Default",k=function(){try{return"localStorage"in window&&null!==window.localStorage}catch(t){return!1}}(),j=void 0,H=!0,G=void 0,W=!1,q=[],X=function t(e){var n=this,r=e||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),S.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],r=i.defaults(r,{closeOnTop:!1,autoPlace:!0,width:t.DEFAULT_WIDTH}),r=i.defaults(r,{resizable:r.autoPlace,hideable:r.autoPlace}),i.isUndefined(r.load)?r.load={preset:U}:r.preset&&(r.load.preset=r.preset),i.isUndefined(r.parent)&&r.hideable&&q.push(this),r.resizable=i.isUndefined(r.parent)&&r.resizable,r.autoPlace&&i.isUndefined(r.scrollable)&&(r.scrollable=!0);var o,a=k&&"true"===localStorage.getItem($(0,"isLocal")),s=void 0;if(Object.defineProperties(this,{parent:{get:function(){return r.parent}},scrollable:{get:function(){return r.scrollable}},autoPlace:{get:function(){return r.autoPlace}},closeOnTop:{get:function(){return r.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:r.load.preset},set:function(t){n.parent?n.getRoot().preset=t:r.load.preset=t,function(t){for(var e=0;e1){var r=n.__li.nextElementSibling;return n.remove(),J(t,n.object,n.property,{before:r,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(e)||i.isObject(e)){var o=n.__li.nextElementSibling;return n.remove(),J(t,n.object,n.property,{before:o,factoryArgs:[e]})}},name:function(t){return n.__li.firstElementChild.firstElementChild.innerHTML=t,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof R){var r=new L(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step"],(function(t){var e=n[t],i=r[t];n[t]=r[t]=function(){var t=Array.prototype.slice.call(arguments);return i.apply(r,t),e.apply(n,t)}})),S.addClass(e,"has-slider"),n.domElement.insertBefore(r.domElement,n.domElement.firstElementChild)}else if(n instanceof L){var o=function(e){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var r=n.__li.firstElementChild.firstElementChild.innerHTML,o=n.__gui.__listening.indexOf(n)>-1;n.remove();var a=J(t,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return a.name(r),o&&a.listen(),a}return e};n.min=i.compose(o,n.min),n.max=i.compose(o,n.max)}else n instanceof M?(S.bind(e,"click",(function(){S.fakeEvent(n.__checkbox,"click")})),S.bind(n.__checkbox,"click",(function(t){t.stopPropagation()}))):n instanceof O?(S.bind(e,"click",(function(){S.fakeEvent(n.__button,"click")})),S.bind(e,"mouseover",(function(){S.addClass(n.__button,"hover")})),S.bind(e,"mouseout",(function(){S.removeClass(n.__button,"hover")}))):n instanceof F&&(S.addClass(e,"color"),n.updateDisplay=i.compose((function(t){return e.style.borderLeftColor=n.__color.toString(),t}),n.updateDisplay),n.updateDisplay());n.setValue=i.compose((function(e){return t.getRoot().__preset_select&&n.isModified()&&K(t.getRoot(),!0),e}),n.setValue)}(t,l,o),t.__controllers.push(o),o}function $(t,e){return document.location.href+"."+e}function tt(t,e,n){var i=document.createElement("option");i.innerHTML=e,i.value=e,t.__preset_select.appendChild(i),n&&(t.__preset_select.selectedIndex=t.__preset_select.length-1)}function et(t,e){e.style.display=t.useLocalStorage?"block":"none"}function nt(t){var e=t.__save_row=document.createElement("li");S.addClass(t.domElement,"has-save"),t.__ul.insertBefore(e,t.__ul.firstChild),S.addClass(e,"save-row");var n=document.createElement("span");n.innerHTML=" ",S.addClass(n,"button gears");var r=document.createElement("span");r.innerHTML="Save",S.addClass(r,"button"),S.addClass(r,"save");var o=document.createElement("span");o.innerHTML="New",S.addClass(o,"button"),S.addClass(o,"save-as");var a=document.createElement("span");a.innerHTML="Revert",S.addClass(a,"button"),S.addClass(a,"revert");var s=t.__preset_select=document.createElement("select");if(t.load&&t.load.remembered?i.each(t.load.remembered,(function(e,n){tt(t,n,n===t.preset)})):tt(t,U,!1),S.bind(s,"change",(function(){for(var e=0;e0&&(t.preset=this.preset,t.remembered||(t.remembered={}),t.remembered[this.preset]=rt(this)),t.folders={},i.each(this.__folders,(function(e,n){t.folders[n]=e.getSaveObject()})),t},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=rt(this),K(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(t){this.load.remembered||(this.load.remembered={},this.load.remembered[U]=rt(this,!0)),this.load.remembered[t]=rt(this),this.preset=t,tt(this,t,!0),this.saveToLocalStorageIfPossible()},revert:function(t){i.each(this.__controllers,(function(e){this.getRoot().load.remembered?Z(t||this.getRoot(),e):e.setValue(e.initialValue),e.__onFinishChange&&e.__onFinishChange.call(e,e.getValue())}),this),i.each(this.__folders,(function(t){t.revert(t)})),t||K(this.getRoot(),!1)},listen:function(t){var e=0===this.__listening.length;this.__listening.push(t),e&&function t(e){0!==e.length&&z.call(window,(function(){t(e)})),i.each(e,(function(t){t.updateDisplay()}))}(this.__listening)},updateDisplay:function(){i.each(this.__controllers,(function(t){t.updateDisplay()})),i.each(this.__folders,(function(t){t.updateDisplay()}))}}),{color:{Color:v,math:l,interpret:s},controllers:{Controller:w,BooleanController:M,OptionController:E,StringController:A,NumberController:P,NumberControllerBox:L,NumberControllerSlider:R,FunctionController:O,ColorController:F},dom:{dom:S},gui:{GUI:X},GUI:X}}()},function(t,e,n){"use strict";n.r(e),n.d(e,"CannonDebugRenderer",(function(){return o}));var i=n(0),r=n(1),o=(n(22),function(t,e,n){n=n||{},this.scene=t,this.world=e,this._meshes=[],this._boxMaterial=new i.MeshBasicMaterial({color:255,wireframe:!0}),this._triMaterial=new i.MeshBasicMaterial({color:16711680,wireframe:!0}),this._sphereMaterial=new i.MeshBasicMaterial({color:65280,wireframe:!0}),this._sphereGeometry=new i.SphereGeometry(1),this._boxGeometry=new i.BoxGeometry(1,1,1),this._planeGeometry=new i.PlaneGeometry(10,10,10,10),this._cylinderGeometry=new i.CylinderGeometry(1,1,10,10)});o.prototype={tmpVec0:new r.Vec3,tmpVec1:new r.Vec3,tmpVec2:new r.Vec3,tmpQuat0:new r.Vec3,update:function(){for(var t=this.world.bodies,e=this._meshes,n=this.tmpVec0,i=this.tmpQuat0,r=0,o=0;o!==t.length;o++)for(var a=t[o],s=0;s!==a.shapes.length;s++){var c=a.shapes[s];this._updateMesh(r,a,c),(l=e[r])&&(a.interpolatedQuaternion.vmult(a.shapeOffsets[s],n),a.interpolatedPosition.vadd(n,n),a.quaternion.mult(a.shapeOrientations[s],i),l.position.copy(n),l.quaternion.copy(i)),r++}for(o=r;o{this.scene.remove(t)})}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){var n=this;this.updateOrder=3,this.world=t,this.pointerLock=t.params.Pointer_Lock,this.domElement=e||document.body,this.isLocked=!1,this.boundOnMouseDown=function(t){return n.onMouseDown(t)},this.boundOnMouseMove=function(t){return n.onMouseMove(t)},this.boundOnMouseUp=function(t){return n.onMouseUp(t)},this.boundOnMouseWheelMove=function(t){return n.onMouseWheelMove(t)},this.boundOnPointerlockChange=function(t){return n.onPointerlockChange(t)},this.boundOnPointerlockError=function(t){return n.onPointerlockError(t)},this.boundOnKeyDown=function(t){return n.onKeyDown(t)},this.boundOnKeyUp=function(t){return n.onKeyUp(t)},this.domElement.addEventListener("mousedown",this.boundOnMouseDown,!1),document.addEventListener("wheel",this.boundOnMouseWheelMove,!1),document.addEventListener("pointerlockchange",this.boundOnPointerlockChange,!1),document.addEventListener("pointerlockerror",this.boundOnPointerlockError,!1),document.addEventListener("keydown",this.boundOnKeyDown,!1),document.addEventListener("keyup",this.boundOnKeyUp,!1),t.registerUpdatable(this)}return t.prototype.update=function(t,e){var n;void 0===this.inputReceiver&&void 0!==this.world&&void 0!==this.world.cameraOperator&&this.setInputReceiver(this.world.cameraOperator),null===(n=this.inputReceiver)||void 0===n||n.inputReceiverUpdate(e)},t.prototype.setInputReceiver=function(t){this.inputReceiver=t,this.inputReceiver.inputReceiverInit()},t.prototype.setPointerLock=function(t){this.pointerLock=t},t.prototype.onPointerlockChange=function(t){document.pointerLockElement===this.domElement?(this.domElement.addEventListener("mousemove",this.boundOnMouseMove,!1),this.domElement.addEventListener("mouseup",this.boundOnMouseUp,!1),this.isLocked=!0):(this.domElement.removeEventListener("mousemove",this.boundOnMouseMove,!1),this.domElement.removeEventListener("mouseup",this.boundOnMouseUp,!1),this.isLocked=!1)},t.prototype.onPointerlockError=function(t){console.error("PointerLockControls: Unable to use Pointer Lock API")},t.prototype.onMouseDown=function(t){this.pointerLock?this.domElement.requestPointerLock():(this.domElement.addEventListener("mousemove",this.boundOnMouseMove,!1),this.domElement.addEventListener("mouseup",this.boundOnMouseUp,!1)),void 0!==this.inputReceiver&&this.inputReceiver.handleMouseButton(t,"mouse"+t.button,!0)},t.prototype.onMouseMove=function(t){void 0!==this.inputReceiver&&this.inputReceiver.handleMouseMove(t,t.movementX,t.movementY)},t.prototype.onMouseUp=function(t){this.pointerLock||(this.domElement.removeEventListener("mousemove",this.boundOnMouseMove,!1),this.domElement.removeEventListener("mouseup",this.boundOnMouseUp,!1)),void 0!==this.inputReceiver&&this.inputReceiver.handleMouseButton(t,"mouse"+t.button,!1)},t.prototype.onKeyDown=function(t){void 0!==this.inputReceiver&&this.inputReceiver.handleKeyboardEvent(t,t.code,!0)},t.prototype.onKeyUp=function(t){void 0!==this.inputReceiver&&this.inputReceiver.handleKeyboardEvent(t,t.code,!1)},t.prototype.onMouseWheelMove=function(t){void 0!==this.inputReceiver&&this.inputReceiver.handleMouseWheel(t,t.deltaY)},t}();e.InputManager=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(43),r=n(44),o=n(23),a=n(19),s=function(){function t(t){this.firstLoad=!0,this.loadingTracker=[],this.world=t,this.gltfLoader=new i.GLTFLoader,this.world.setTimeScale(0),o.UIManager.setUserInterfaceVisible(!1),o.UIManager.setLoadingScreenVisible(!0)}return t.prototype.loadGLTF=function(t,e){var n=this,i=this.addLoadingEntry(t);this.gltfLoader.load(t,(function(t){e(t),n.doneLoading(i)}),(function(t){t.lengthComputable&&(i.progress=t.loaded/t.total)}),(function(t){console.error(t)}))},t.prototype.addLoadingEntry=function(t){var e=new r.LoadingTrackerEntry(t);return this.loadingTracker.push(e),e},t.prototype.doneLoading=function(t){t.finished=!0,t.progress=1,this.isLoadingDone()&&(void 0!==this.onFinishedCallback?this.onFinishedCallback():o.UIManager.setUserInterfaceVisible(!0),o.UIManager.setLoadingScreenVisible(!1))},t.prototype.createWelcomeScreenCallback=function(t){var e=this;void 0===this.onFinishedCallback&&(this.onFinishedCallback=function(){e.world.update(1,1),a.default.fire({title:t.descriptionTitle,html:t.descriptionContent,confirmButtonText:"Play",buttonsStyling:!1,onClose:function(){e.world.setTimeScale(1),o.UIManager.setUserInterfaceVisible(!0)}})})},t.prototype.getLoadingPercentage=function(){for(var t=0,e=0,n=0,i=this.loadingTracker;n=2.0 are supported."));else{if(g.extensionsUsed)for(var y=0;y=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+w+'".')}}new U(g,v,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager}).parse(c,l)}}});var n={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function r(t){if(!t)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=n.MSFT_TEXTURE_DDS,this.ddsLoader=t}function o(t){this.name=n.KHR_LIGHTS_PUNCTUAL;var e=t.extensions&&t.extensions[n.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=e.lights||[]}function a(){this.name=n.KHR_MATERIALS_UNLIT}o.prototype.loadLight=function(t){var e,n=this.lightDefs[t],r=new i.Color(16777215);void 0!==n.color&&r.fromArray(n.color);var o=void 0!==n.range?n.range:0;switch(n.type){case"directional":(e=new i.DirectionalLight(r)).target.position.set(0,0,-1),e.add(e.target);break;case"point":(e=new i.PointLight(r)).distance=o;break;case"spot":(e=new i.SpotLight(r)).distance=o,n.spot=n.spot||{},n.spot.innerConeAngle=void 0!==n.spot.innerConeAngle?n.spot.innerConeAngle:0,n.spot.outerConeAngle=void 0!==n.spot.outerConeAngle?n.spot.outerConeAngle:Math.PI/4,e.angle=n.spot.outerConeAngle,e.penumbra=1-n.spot.innerConeAngle/n.spot.outerConeAngle,e.target.position.set(0,0,-1),e.add(e.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+n.type+'".')}return e.position.set(0,0,0),e.decay=2,void 0!==n.intensity&&(e.intensity=n.intensity),e.name=n.name||"light_"+t,Promise.resolve(e)},a.prototype.getMaterialType=function(){return i.MeshBasicMaterial},a.prototype.extendParams=function(t,e,n){var r=[];t.color=new i.Color(1,1,1),t.opacity=1;var o=e.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){var a=o.baseColorFactor;t.color.fromArray(a),t.opacity=a[3]}void 0!==o.baseColorTexture&&r.push(n.assignTexture(t,"map",o.baseColorTexture))}return Promise.all(r)};var s="glTF",c=12,l={JSON:1313821514,BIN:5130562};function u(t){this.name=n.KHR_BINARY_GLTF,this.content=null,this.body=null;var e=new DataView(t,0,c);if(this.header={magic:i.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==s)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var r=new DataView(t,c),o=0;o",e),t.fragmentShader=t.fragmentShader.replace("#include ",n),t.fragmentShader=t.fragmentShader.replace("#include ",r),t.fragmentShader=t.fragmentShader.replace("#include ",o),t.fragmentShader=t.fragmentShader.replace("#include ",a)},Object.defineProperties(this,{specular:{get:function(){return s.specular.value},set:function(t){s.specular.value=t}},specularMap:{get:function(){return s.specularMap.value},set:function(t){s.specularMap.value=t}},glossiness:{get:function(){return s.glossiness.value},set:function(t){s.glossiness.value=t}},glossinessMap:{get:function(){return s.glossinessMap.value},set:function(t){s.glossinessMap.value=t,t?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_ROUGHNESSMAP=""):(delete this.defines.USE_ROUGHNESSMAP,delete this.defines.USE_GLOSSINESSMAP)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(t)}function f(){return{name:n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return d},extendParams:function(t,e,n){var r=e.extensions[this.name];t.color=new i.Color(1,1,1),t.opacity=1;var o=[];if(Array.isArray(r.diffuseFactor)){var a=r.diffuseFactor;t.color.fromArray(a),t.opacity=a[3]}if(void 0!==r.diffuseTexture&&o.push(n.assignTexture(t,"map",r.diffuseTexture)),t.emissive=new i.Color(0,0,0),t.glossiness=void 0!==r.glossinessFactor?r.glossinessFactor:1,t.specular=new i.Color(1,1,1),Array.isArray(r.specularFactor)&&t.specular.fromArray(r.specularFactor),void 0!==r.specularGlossinessTexture){var s=r.specularGlossinessTexture;o.push(n.assignTexture(t,"glossinessMap",s)),o.push(n.assignTexture(t,"specularMap",s))}return Promise.all(o)},createMaterial:function(t){var e=new d(t);return e.fog=!0,e.color=t.color,e.map=void 0===t.map?null:t.map,e.lightMap=null,e.lightMapIntensity=1,e.aoMap=void 0===t.aoMap?null:t.aoMap,e.aoMapIntensity=1,e.emissive=t.emissive,e.emissiveIntensity=1,e.emissiveMap=void 0===t.emissiveMap?null:t.emissiveMap,e.bumpMap=void 0===t.bumpMap?null:t.bumpMap,e.bumpScale=1,e.normalMap=void 0===t.normalMap?null:t.normalMap,e.normalMapType=i.TangentSpaceNormalMap,t.normalScale&&(e.normalScale=t.normalScale),e.displacementMap=null,e.displacementScale=1,e.displacementBias=0,e.specularMap=void 0===t.specularMap?null:t.specularMap,e.specular=t.specular,e.glossinessMap=void 0===t.glossinessMap?null:t.glossinessMap,e.glossiness=t.glossiness,e.alphaMap=null,e.envMap=void 0===t.envMap?null:t.envMap,e.envMapIntensity=1,e.refractionRatio=.98,e}}}function m(){this.name=n.KHR_MESH_QUANTIZATION}function v(t,e,n,r){i.Interpolant.call(this,t,e,n,r)}h.prototype.decodePrimitive=function(t,e){var n=this.json,i=this.dracoLoader,r=t.extensions[this.name].bufferView,o=t.extensions[this.name].attributes,a={},s={},c={};for(var l in o){var u=P[l]||l.toLowerCase();a[u]=o[l]}for(l in t.attributes){u=P[l]||l.toLowerCase();if(void 0!==o[l]){var h=n.accessors[t.attributes[l]],p=M[h.componentType];c[u]=p,s[u]=!0===h.normalized}}return e.getDependency("bufferView",r).then((function(t){return new Promise((function(e){i.decodeDracoFile(t,(function(t){for(var n in t.attributes){var i=t.attributes[n],r=s[n];void 0!==r&&(i.normalized=r)}e(t)}),a,c)}))}))},p.prototype.extendTexture=function(t,e){return t=t.clone(),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),void 0!==e.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),t.needsUpdate=!0,t},d.prototype=Object.create(i.MeshStandardMaterial.prototype),d.prototype.constructor=d,d.prototype.copy=function(t){return i.MeshStandardMaterial.prototype.copy.call(this,t),this.specularMap=t.specularMap,this.specular.copy(t.specular),this.glossinessMap=t.glossinessMap,this.glossiness=t.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},v.prototype=Object.create(i.Interpolant.prototype),v.prototype.constructor=v,v.prototype.copySampleValue_=function(t){for(var e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i*3+i,o=0;o!==i;o++)e[o]=n[r+o];return e},v.prototype.beforeStart_=v.prototype.copySampleValue_,v.prototype.afterEnd_=v.prototype.copySampleValue_,v.prototype.interpolate_=function(t,e,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=2*a,c=3*a,l=i-e,u=(n-e)/l,h=u*u,p=h*u,d=t*c,f=d-c,m=-2*p+3*h,v=p-h,g=1-m,y=v-h+u,w=0;w!==a;w++){var x=o[f+w+a],_=o[f+w+s]*l,b=o[d+w+a],S=o[d+w]*l;r[w]=g*x+y*_+m*b+v*S}return r};var g=0,y=1,w=2,x=3,_=4,b=5,S=6,M={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},E={9728:i.NearestFilter,9729:i.LinearFilter,9984:i.NearestMipmapNearestFilter,9985:i.LinearMipmapNearestFilter,9986:i.NearestMipmapLinearFilter,9987:i.LinearMipmapLinearFilter},A={33071:i.ClampToEdgeWrapping,33648:i.MirroredRepeatWrapping,10497:i.RepeatWrapping},T={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},P={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},L={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},C={CUBICSPLINE:void 0,LINEAR:i.InterpolateLinear,STEP:i.InterpolateDiscrete},R="OPAQUE",O="MASK",F="BLEND",I={"image/png":i.RGBAFormat,"image/jpeg":i.RGBFormat};function N(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)?t:/^data:.*,.*$/i.test(t)?t:/^blob:.*$/i.test(t)?t:e+t)}function B(t,e,n){for(var i in n.extensions)void 0===t[i]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=n.extensions[i])}function D(t,e){void 0!==e.extras&&("object"==typeof e.extras?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function z(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(var n=0,i=e.weights.length;n=2&&a.setY(P,S[E*c+1]),c>=3&&a.setZ(P,S[E*c+2]),c>=4&&a.setW(P,S[E*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return a}))},U.prototype.loadTexture=function(t){var e,r=this,o=this.json,a=this.options,s=this.textureLoader,c=window.URL||window.webkitURL,l=o.textures[t],u=l.extensions||{},h=(e=u[n.MSFT_TEXTURE_DDS]?o.images[u[n.MSFT_TEXTURE_DDS].source]:o.images[l.source]).uri,p=!1;return void 0!==e.bufferView&&(h=r.getDependency("bufferView",e.bufferView).then((function(t){p=!0;var n=new Blob([t],{type:e.mimeType});return h=c.createObjectURL(n)}))),Promise.resolve(h).then((function(t){var e=a.manager.getHandler(t);return e||(e=u[n.MSFT_TEXTURE_DDS]?r.extensions[n.MSFT_TEXTURE_DDS].ddsLoader:s),new Promise((function(n,i){e.load(N(t,a.path),n,void 0,i)}))})).then((function(t){!0===p&&c.revokeObjectURL(h),t.flipY=!1,void 0!==l.name&&(t.name=l.name),e.mimeType in I&&(t.format=I[e.mimeType]);var n=(o.samplers||{})[l.sampler]||{};return t.magFilter=E[n.magFilter]||i.LinearFilter,t.minFilter=E[n.minFilter]||i.LinearMipmapLinearFilter,t.wrapS=A[n.wrapS]||i.RepeatWrapping,t.wrapT=A[n.wrapT]||i.RepeatWrapping,t}))},U.prototype.assignTexture=function(t,e,r){var o=this;return this.getDependency("texture",r.index).then((function(a){if(!a.isCompressedTexture)switch(e){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":a.format=i.RGBFormat}if(void 0===r.texCoord||0==r.texCoord||"aoMap"===e&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+e+" not yet supported."),o.extensions[n.KHR_TEXTURE_TRANSFORM]){var s=void 0!==r.extensions?r.extensions[n.KHR_TEXTURE_TRANSFORM]:void 0;s&&(a=o.extensions[n.KHR_TEXTURE_TRANSFORM].extendTexture(a,s))}t[e]=a}))},U.prototype.assignFinalMaterial=function(t){var e=t.geometry,n=t.material,r=(this.extensions,void 0!==e.attributes.tangent),o=void 0!==e.attributes.color,a=void 0===e.attributes.normal,s=!0===t.isSkinnedMesh,c=Object.keys(e.morphAttributes).length>0,l=c&&void 0!==e.morphAttributes.normal;if(t.isPoints){var u="PointsMaterial:"+n.uuid,h=this.cache.get(u);h||(h=new i.PointsMaterial,i.Material.prototype.copy.call(h,n),h.color.copy(n.color),h.map=n.map,h.sizeAttenuation=!1,this.cache.add(u,h)),n=h}else if(t.isLine){u="LineBasicMaterial:"+n.uuid;var p=this.cache.get(u);p||(p=new i.LineBasicMaterial,i.Material.prototype.copy.call(p,n),p.color.copy(n.color),this.cache.add(u,p)),n=p}if(r||o||a||s||c){u="ClonedMaterial:"+n.uuid+":";n.isGLTFSpecularGlossinessMaterial&&(u+="specular-glossiness:"),s&&(u+="skinning:"),r&&(u+="vertex-tangents:"),o&&(u+="vertex-colors:"),a&&(u+="flat-shading:"),c&&(u+="morph-targets:"),l&&(u+="morph-normals:");var d=this.cache.get(u);d||(d=n.clone(),s&&(d.skinning=!0),r&&(d.vertexTangents=!0),o&&(d.vertexColors=i.VertexColors),a&&(d.flatShading=!0),c&&(d.morphTargets=!0),l&&(d.morphNormals=!0),this.cache.add(u,d)),n=d}n.aoMap&&void 0===e.attributes.uv2&&void 0!==e.attributes.uv&&e.setAttribute("uv2",new i.BufferAttribute(e.attributes.uv.array,2)),n.normalScale&&!r&&(n.normalScale.y=-n.normalScale.y),t.material=n},U.prototype.loadMaterial=function(t){var e,r=this.json,o=this.extensions,a=r.materials[t],s={},c=a.extensions||{},l=[];if(c[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var u=o[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];e=u.getMaterialType(),l.push(u.extendParams(s,a,this))}else if(c[n.KHR_MATERIALS_UNLIT]){var h=o[n.KHR_MATERIALS_UNLIT];e=h.getMaterialType(),l.push(h.extendParams(s,a,this))}else{e=i.MeshStandardMaterial;var p=a.pbrMetallicRoughness||{};if(s.color=new i.Color(1,1,1),s.opacity=1,Array.isArray(p.baseColorFactor)){var f=p.baseColorFactor;s.color.fromArray(f),s.opacity=f[3]}void 0!==p.baseColorTexture&&l.push(this.assignTexture(s,"map",p.baseColorTexture)),s.metalness=void 0!==p.metallicFactor?p.metallicFactor:1,s.roughness=void 0!==p.roughnessFactor?p.roughnessFactor:1,void 0!==p.metallicRoughnessTexture&&(l.push(this.assignTexture(s,"metalnessMap",p.metallicRoughnessTexture)),l.push(this.assignTexture(s,"roughnessMap",p.metallicRoughnessTexture)))}!0===a.doubleSided&&(s.side=i.DoubleSide);var m=a.alphaMode||R;return m===F?s.transparent=!0:(s.transparent=!1,m===O&&(s.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&e!==i.MeshBasicMaterial&&(l.push(this.assignTexture(s,"normalMap",a.normalTexture)),s.normalScale=new i.Vector2(1,1),void 0!==a.normalTexture.scale&&s.normalScale.set(a.normalTexture.scale,a.normalTexture.scale)),void 0!==a.occlusionTexture&&e!==i.MeshBasicMaterial&&(l.push(this.assignTexture(s,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(s.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&e!==i.MeshBasicMaterial&&(s.emissive=(new i.Color).fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&e!==i.MeshBasicMaterial&&l.push(this.assignTexture(s,"emissiveMap",a.emissiveTexture)),Promise.all(l).then((function(){var t;return t=e===d?o[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s):new e(s),void 0!==a.name&&(t.name=a.name),t.map&&(t.map.encoding=i.sRGBEncoding),t.emissiveMap&&(t.emissiveMap.encoding=i.sRGBEncoding),D(t,a),a.extensions&&B(o,t,a),t}))},U.prototype.loadGeometries=function(t){var e=this,r=this.extensions,o=this.primitiveCache;function a(t){return r[n.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,e).then((function(n){return k(n,t,e)}))}for(var s,c,l=[],u=0,h=t.length;u0&&z(h,r),h.name=r.name||"mesh_"+t,s.length>1&&(h.name+="_"+l),D(h,r),n.assignFinalMaterial(h),c.push(h)}if(1===c.length)return c[0];var m=new i.Group;for(l=0,u=c.length;l1){var n=c[l.mesh]++;(e=t.clone()).name+="_instance_"+n}else e=t;return void 0!==l.weights&&e.traverse((function(t){if(t.isMesh)for(var e=0,n=l.weights.length;e1?new i.Group:1===t.length?t[0]:new i.Object3D)!==t[0])for(var n=0,r=t.length;n1&&(this.enginePower=1)):(this.enginePower>0&&(this.enginePower-=.06*e),this.enginePower<0&&(this.enginePower=0)),this.rotors.forEach((function(t){t.rotateX(n.enginePower*e*30)}))},e.prototype.onInputChange=function(){t.prototype.onInputChange.call(this),this.actions.exitVehicle.justPressed&&void 0!==this.controllingCharacter&&this.forceCharacterOut(),this.actions.view.justPressed&&this.toggleFirstPersonView()},e.prototype.physicsPreStep=function(t,e){var n=s.threeQuat(t.quaternion),i=new o.Vector3(1,0,0).applyQuaternion(n),r=new o.Vector3(0,1,0),c=new o.Vector3(0,1,0).applyQuaternion(n),l=new o.Vector3(0,0,1).applyQuaternion(n);e.actions.ascend.isPressed&&(t.velocity.x+=.15*c.x*this.enginePower,t.velocity.y+=.15*c.y*this.enginePower,t.velocity.z+=.15*c.z*this.enginePower),e.actions.descend.isPressed&&(t.velocity.x-=.15*c.x*this.enginePower,t.velocity.y-=.15*c.y*this.enginePower,t.velocity.z-=.15*c.z*this.enginePower);var u=e.world.physicsWorld.gravity,h=new a.Vec3(-u.x,-u.y,-u.z).length();h*=e.world.physicsFrameTime,h*=.98;var p=r.dot(c);h*=Math.sqrt(o.MathUtils.clamp(p,0,1));var d=new o.Vector3(0,t.velocity.y,0).multiplyScalar(-.01),f=c.clone();if(f.multiplyScalar(h),f.add(d),f.multiplyScalar(e.enginePower),t.velocity.x+=f.x,t.velocity.y+=f.y,t.velocity.z+=f.z,t.velocity.x*=o.MathUtils.lerp(1,.995,this.enginePower),t.velocity.z*=o.MathUtils.lerp(1,.995,this.enginePower),void 0!==this.controllingCharacter){var m=(new o.Quaternion).setFromUnitVectors(c,r);m.x*=.3,m.y*=.3,m.z*=.3,m.w*=.3;var v=(new o.Euler).setFromQuaternion(m);t.angularVelocity.x+=v.x*this.enginePower,t.angularVelocity.y+=v.y*this.enginePower,t.angularVelocity.z+=v.z*this.enginePower}e.actions.pitchUp.isPressed&&(t.angularVelocity.x-=.07*i.x*this.enginePower,t.angularVelocity.y-=.07*i.y*this.enginePower,t.angularVelocity.z-=.07*i.z*this.enginePower),e.actions.pitchDown.isPressed&&(t.angularVelocity.x+=.07*i.x*this.enginePower,t.angularVelocity.y+=.07*i.y*this.enginePower,t.angularVelocity.z+=.07*i.z*this.enginePower),e.actions.yawLeft.isPressed&&(t.angularVelocity.x+=.07*c.x*this.enginePower,t.angularVelocity.y+=.07*c.y*this.enginePower,t.angularVelocity.z+=.07*c.z*this.enginePower),e.actions.yawRight.isPressed&&(t.angularVelocity.x-=.07*c.x*this.enginePower,t.angularVelocity.y-=.07*c.y*this.enginePower,t.angularVelocity.z-=.07*c.z*this.enginePower),e.actions.rollLeft.isPressed&&(t.angularVelocity.x-=.07*l.x*this.enginePower,t.angularVelocity.y-=.07*l.y*this.enginePower,t.angularVelocity.z-=.07*l.z*this.enginePower),e.actions.rollRight.isPressed&&(t.angularVelocity.x+=.07*l.x*this.enginePower,t.angularVelocity.y+=.07*l.y*this.enginePower,t.angularVelocity.z+=.07*l.z*this.enginePower),t.angularVelocity.x*=.97,t.angularVelocity.y*=.97,t.angularVelocity.z*=.97},e.prototype.readHelicopterData=function(t){var e=this;t.scene.traverse((function(t){t.hasOwnProperty("userData")&&t.userData.hasOwnProperty("data")&&"rotor"===t.userData.data&&e.rotors.push(t)}))},e.prototype.inputReceiverInit=function(){t.prototype.inputReceiverInit.call(this),this.world.updateControls([{keys:["Shift"],desc:"Ascend"},{keys:["Space"],desc:"Descend"},{keys:["W","S"],desc:"Pitch"},{keys:["Q","E"],desc:"Yaw"},{keys:["A","D"],desc:"Roll"},{keys:["V"],desc:"View select"},{keys:["F"],desc:"Exit vehicle"},{keys:["Shift","+","R"],desc:"Respawn"},{keys:["Shift","+","C"],desc:"Free camera"}])},e}(c.Vehicle);e.Helicopter=h},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(53),r=function(){function t(t,e,n){if(this.connectedSeats=[],this.entryPoints=[],this.occupiedBy=null,this.vehicle=t,this.seatPointObject=e,e.hasOwnProperty("userData")&&e.userData.hasOwnProperty("data")){if(e.userData.hasOwnProperty("door_object")&&(this.door=new i.VehicleDoor(this,n.scene.getObjectByName(e.userData.door_object))),e.userData.hasOwnProperty("entry_points"))for(var r=0,o=e.userData.entry_points.split(";");r0&&this.entryPoints.push(n.scene.getObjectByName(a))}else console.error("Seat object "+e+" has no entry point reference property.");e.userData.hasOwnProperty("seat_type")?this.type=e.userData.seat_type:console.error("Seat object "+e+" has no seat type property."),e.userData.hasOwnProperty("connected_seats")&&(this.connectedSeatsString=e.userData.connected_seats)}}return t.prototype.update=function(t){void 0!==this.door&&this.door.update(t)},t}();e.VehicleSeat=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=n(2),o=n(5),a=function(){function t(t,e){this.doorVelocity=0,this.doorWorldPos=new i.Vector3,this.lastTrailerPos=new i.Vector3,this.lastTrailerVel=new i.Vector3,this.rotation=0,this.achievingTargetRotation=!1,this.physicsEnabled=!1,this.targetRotation=0,this.rotationSpeed=5,this.lastVehicleVel=new i.Vector3,this.lastVehiclePos=new i.Vector3,this.seat=t,this.vehicle=t.vehicle,this.doorObject=e;var n=r.detectRelativeSide(this.seat.seatPointObject,this.doorObject);n===o.Side.Left?this.sideMultiplier=-1:n===o.Side.Right?this.sideMultiplier=1:this.sideMultiplier=0}return t.prototype.update=function(t){this.achievingTargetRotation&&(this.rotationthis.targetRotation&&(this.rotation=this.targetRotation,this.achievingTargetRotation=!1,this.physicsEnabled=!0)):this.rotation>this.targetRotation&&(this.rotation-=t*this.rotationSpeed,this.rotation1&&(this.rotation=1,this.doorVelocity=-this.doorVelocity/2),this.doorVelocity=.98*this.doorVelocity}},t.prototype.open=function(){this.achievingTargetRotation=!0,this.targetRotation=1},t.prototype.close=function(){this.achievingTargetRotation=!0,this.targetRotation=0},t.prototype.resetPhysTrailer=function(){this.doorObject.getWorldPosition(this.doorWorldPos),this.lastVehicleVel=new i.Vector3;var t=r.threeQuat(this.vehicle.rayCastVehicle.chassisBody.quaternion),e=new i.Vector3(0,0,-1).applyQuaternion(t);this.lastTrailerPos.copy(e.add(this.doorWorldPos))},t}();e.VehicleDoor=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(t){this.steering=!1,this.wheelObject=t,this.position=t.position,t.hasOwnProperty("userData")&&t.userData.hasOwnProperty("data")&&(t.userData.hasOwnProperty("steering")&&(this.steering="true"===t.userData.steering),t.userData.hasOwnProperty("drive")&&(this.drive=t.userData.drive))};e.Wheel=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),r=n(3),o=function(){function t(t){this.character=t,this.character.velocitySimulator.damping=this.character.defaultVelocitySimulatorDamping,this.character.velocitySimulator.mass=this.character.defaultVelocitySimulatorMass,this.character.rotationSimulator.damping=this.character.defaultRotationSimulatorDamping,this.character.rotationSimulator.mass=this.character.defaultRotationSimulatorMass,this.character.arcadeVelocityIsAdditive=!1,this.character.setArcadeVelocityInfluence(1,0,1),this.canFindVehiclesToEnter=!0,this.canEnterVehicles=!1,this.canLeaveVehicles=!0,this.timer=0}return t.prototype.update=function(t){this.timer+=t},t.prototype.onInputChange=function(){this.canFindVehiclesToEnter&&this.character.actions.enter.justPressed?this.character.findVehicleToEnter(!0):this.canFindVehiclesToEnter&&this.character.actions.enter_passenger.justPressed?this.character.findVehicleToEnter(!1):this.canEnterVehicles&&null!==this.character.vehicleEntryInstance&&(this.character.actions.up.justPressed||this.character.actions.down.justPressed||this.character.actions.left.justPressed||this.character.actions.right.justPressed)&&(this.character.vehicleEntryInstance=null,this.character.actions.up.isPressed=!1)},t.prototype.noDirection=function(){return!(this.character.actions.up.isPressed||this.character.actions.down.isPressed||this.character.actions.left.isPressed||this.character.actions.right.isPressed)},t.prototype.anyDirection=function(){return this.character.actions.up.isPressed||this.character.actions.down.isPressed||this.character.actions.left.isPressed||this.character.actions.right.isPressed},t.prototype.fallInAir=function(){this.character.rayHasHit||this.character.setState(new r.Falling(this.character))},t.prototype.animationEnded=function(t){return void 0===this.character.mixer||(void 0===this.animationLength?(console.error(this.constructor.name+"Error: Set this.animationLength in state constructor!"),!1):this.timer>this.animationLength-t)},t.prototype.setAppropriateDropState=function(){this.character.groundImpactData.velocity.y<-6?this.character.setState(new r.DropRolling(this.character)):this.anyDirection()?this.character.groundImpactData.velocity.y<-2?this.character.setState(new r.DropRunning(this.character)):this.character.actions.run.isPressed?this.character.setState(new r.Sprint(this.character)):this.character.setState(new r.Walk(this.character)):this.character.setState(new r.DropIdle(this.character))},t.prototype.setAppropriateStartWalkState=function(){var t=Math.PI,e=i.getSignedAngleBetweenVectors(this.character.orientation,this.character.getCameraRelativeMovementVector());e>.8*t?this.character.setState(new r.StartWalkBackLeft(this.character)):e<.8*-t?this.character.setState(new r.StartWalkBackRight(this.character)):e>.3*t?this.character.setState(new r.StartWalkLeft(this.character)):e<.3*-t?this.character.setState(new r.StartWalkRight(this.character)):this.character.setState(new r.StartWalkForward(this.character))},t.prototype.playAnimation=function(t,e){this.animationLength=this.character.setAnimation(t,e)},t}();e.CharacterStateBase=o},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=function(t){function e(e){var n=t.call(this,e)||this;return n.character.velocitySimulator.damping=.5,n.character.velocitySimulator.mass=7,n.character.setArcadeVelocityTarget(0),n.playAnimation("drop_idle",.1),n.anyDirection()&&n.character.setState(new o.StartWalkForward(e)),n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.character.setCameraRelativeOrientationTarget(),this.animationEnded(e)&&this.character.setState(new o.Idle(this.character)),this.fallInAir()},e.prototype.onInputChange=function(){t.prototype.onInputChange.call(this),this.character.actions.jump.justPressed&&this.character.setState(new o.JumpIdle(this.character)),this.anyDirection()&&this.character.setState(new o.StartWalkForward(this.character))},e}(o.CharacterStateBase);e.DropIdle=a},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=function(t){function e(e){var n=t.call(this,e)||this;return n.character.setArcadeVelocityTarget(.8),n.playAnimation("drop_running",.1),n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.character.setCameraRelativeOrientationTarget(),this.animationEnded(e)&&this.character.setState(new o.Walk(this.character))},e.prototype.onInputChange=function(){t.prototype.onInputChange.call(this),this.noDirection()&&this.character.setState(new o.EndWalk(this.character)),this.anyDirection()&&this.character.actions.run.justPressed&&this.character.setState(new o.Sprint(this.character)),this.character.actions.jump.justPressed&&this.character.setState(new o.JumpRunning(this.character))},e}(o.CharacterStateBase);e.DropRunning=a},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=function(t){function e(e){var n=t.call(this,e)||this;return n.character.setArcadeVelocityTarget(0),n.animationLength=e.setAnimation("stop",.1),n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.animationEnded(e)&&this.character.setState(new o.Idle(this.character)),this.fallInAir()},e.prototype.onInputChange=function(){t.prototype.onInputChange.call(this),this.character.actions.jump.justPressed&&this.character.setState(new o.JumpIdle(this.character)),this.anyDirection()&&(this.character.actions.run.isPressed?this.character.setState(new o.Sprint(this.character)):this.character.velocity.length()>.5?this.character.setState(new o.Walk(this.character)):this.setAppropriateStartWalkState())},e}(o.CharacterStateBase);e.EndWalk=a},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=function(t){function e(e){var n=t.call(this,e)||this;return n.character.rotationSimulator.mass=30,n.character.rotationSimulator.damping=.6,n.character.velocitySimulator.damping=.6,n.character.velocitySimulator.mass=10,n.character.setArcadeVelocityTarget(0),n.playAnimation("rotate_left",.1),n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.animationEnded(e)&&this.character.setState(new o.Idle(this.character)),this.fallInAir()},e.prototype.onInputChange=function(){t.prototype.onInputChange.call(this),this.character.actions.jump.justPressed&&this.character.setState(new o.JumpIdle(this.character)),this.anyDirection()&&(this.character.velocity.length()>.5?this.character.setState(new o.Walk(this.character)):this.setAppropriateStartWalkState())},e}(o.CharacterStateBase);e.IdleRotateLeft=a},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=function(t){function e(e){var n=t.call(this,e)||this;return n.character.rotationSimulator.mass=30,n.character.rotationSimulator.damping=.6,n.character.velocitySimulator.damping=.6,n.character.velocitySimulator.mass=10,n.character.setArcadeVelocityTarget(0),n.playAnimation("rotate_right",.1),n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.animationEnded(e)&&this.character.setState(new o.Idle(this.character)),this.fallInAir()},e.prototype.onInputChange=function(){t.prototype.onInputChange.call(this),this.character.actions.jump.justPressed&&this.character.setState(new o.JumpIdle(this.character)),this.anyDirection()&&(this.character.velocity.length()>.5?this.character.setState(new o.Walk(this.character)):this.setAppropriateStartWalkState())},e}(o.CharacterStateBase);e.IdleRotateRight=a},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=function(t){function e(e){var n=t.call(this,e)||this;return n.character.velocitySimulator.mass=50,n.character.setArcadeVelocityTarget(0),n.playAnimation("jump_idle",.1),n.alreadyJumped=!1,n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.alreadyJumped&&(this.character.setCameraRelativeOrientationTarget(),this.character.setArcadeVelocityTarget(this.anyDirection()?.8:0)),this.timer>.2&&!this.alreadyJumped?(this.character.jump(),this.alreadyJumped=!0,this.character.velocitySimulator.mass=100,this.character.rotationSimulator.damping=.3,this.character.rayResult.body.velocity.length()>0?this.character.setArcadeVelocityInfluence(0,0,0):this.character.setArcadeVelocityInfluence(.3,0,.3)):this.timer>.3&&this.character.rayHasHit?this.setAppropriateDropState():this.animationEnded(e)&&this.character.setState(new o.Falling(this.character))},e}(o.CharacterStateBase);e.JumpIdle=a},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=function(t){function e(e){var n=t.call(this,e)||this;return n.character.velocitySimulator.mass=100,n.playAnimation("jump_running",.03),n.alreadyJumped=!1,n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.character.setCameraRelativeOrientationTarget(),this.alreadyJumped&&this.character.setArcadeVelocityTarget(this.anyDirection()?.8:0),this.timer>.13&&!this.alreadyJumped?(this.character.jump(4),this.alreadyJumped=!0,this.character.rotationSimulator.damping=.3,this.character.arcadeVelocityIsAdditive=!0,this.character.setArcadeVelocityInfluence(.05,0,.05)):this.timer>.24&&this.character.rayHasHit?this.setAppropriateDropState():this.animationEnded(e)&&this.character.setState(new o.Falling(this.character))},e}(o.CharacterStateBase);e.JumpRunning=a},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=function(t){function e(e){var n=t.call(this,e)||this;return n.canEnterVehicles=!0,n.character.velocitySimulator.mass=10,n.character.rotationSimulator.damping=.8,n.character.rotationSimulator.mass=50,n.character.setArcadeVelocityTarget(1.4),n.playAnimation("sprint",.1),n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.character.setCameraRelativeOrientationTarget(),this.fallInAir()},e.prototype.onInputChange=function(){t.prototype.onInputChange.call(this),this.character.actions.run.isPressed||this.character.setState(new o.Walk(this.character)),this.character.actions.jump.justPressed&&this.character.setState(new o.JumpRunning(this.character)),this.noDirection()&&this.character.setState(new o.EndWalk(this.character))},e}(o.CharacterStateBase);e.Sprint=a},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(2),a=n(3),s=function(t){function e(e){var n=t.call(this,e)||this;return n.canEnterVehicles=!0,n.character.rotationSimulator.mass=20,n.character.rotationSimulator.damping=.7,n.character.setArcadeVelocityTarget(.8),n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.animationEnded(e)&&this.character.setState(new a.Walk(this.character)),this.character.setCameraRelativeOrientationTarget(),this.fallInAir()},e.prototype.onInputChange=function(){if(t.prototype.onInputChange.call(this),this.character.actions.jump.justPressed&&this.character.setState(new a.JumpRunning(this.character)),this.noDirection())if(this.timer<.1){var e=o.getSignedAngleBetweenVectors(this.character.orientation,this.character.orientationTarget);e>.4*Math.PI?this.character.setState(new a.IdleRotateLeft(this.character)):e<.4*-Math.PI?this.character.setState(new a.IdleRotateRight(this.character)):this.character.setState(new a.Idle(this.character))}else this.character.setState(new a.Idle(this.character));this.character.actions.run.justPressed&&this.character.setState(new a.Sprint(this.character))},e}(a.CharacterStateBase);e.StartWalkBase=s},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e){var n=t.call(this,e)||this;return n.animationLength=e.setAnimation("start_back_left",.1),n}return r(e,t),e}(n(3).StartWalkBase);e.StartWalkBackLeft=o},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e){var n=t.call(this,e)||this;return n.animationLength=e.setAnimation("start_back_right",.1),n}return r(e,t),e}(n(3).StartWalkBase);e.StartWalkBackRight=o},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e){var n=t.call(this,e)||this;return n.animationLength=e.setAnimation("start_forward",.1),n}return r(e,t),e}(n(3).StartWalkBase);e.StartWalkForward=o},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e){var n=t.call(this,e)||this;return n.animationLength=e.setAnimation("start_left",.1),n}return r(e,t),e}(n(3).StartWalkBase);e.StartWalkLeft=o},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e){var n=t.call(this,e)||this;return n.animationLength=e.setAnimation("start_right",.1),n}return r(e,t),e}(n(3).StartWalkBase);e.StartWalkRight=o},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=function(t){function e(e){var n=t.call(this,e)||this;return n.canEnterVehicles=!0,n.character.setArcadeVelocityTarget(.8),n.playAnimation("run",.1),n}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.character.setCameraRelativeOrientationTarget(),this.fallInAir()},e.prototype.onInputChange=function(){t.prototype.onInputChange.call(this),this.noDirection()&&this.character.setState(new o.EndWalk(this.character)),this.character.actions.run.isPressed&&this.character.setState(new o.Sprint(this.character)),this.character.actions.run.justPressed&&this.character.setState(new o.Sprint(this.character)),this.character.actions.jump.justPressed&&this.character.setState(new o.JumpRunning(this.character)),this.noDirection()&&(this.character.velocity.length()>1?this.character.setState(new o.EndWalk(this.character)):this.character.setState(new o.Idle(this.character)))},e}(o.CharacterStateBase);e.Walk=a},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(1),s=n(15),c=n(7),l=n(12),u=n(2),h=n(10),p=function(t){function e(e){var n=t.call(this,e,{radius:.12,suspensionStiffness:150,suspensionRestLength:.25,dampingRelaxation:5,dampingCompression:5,directionLocal:new a.Vec3(0,-1,0),axleLocal:new a.Vec3(-1,0,0),chassisConnectionPointLocal:new a.Vec3})||this;return n.entityType=h.EntityType.Airplane,n.elevators=[],n.enginePower=0,n.lastDrag=0,n.readAirplaneData(e),n.collision.preStep=function(t){n.physicsPreStep(t,n)},n.actions={throttle:new c.KeyBinding("ShiftLeft"),brake:new c.KeyBinding("Space"),wheelBrake:new c.KeyBinding("KeyB"),pitchUp:new c.KeyBinding("KeyS"),pitchDown:new c.KeyBinding("KeyW"),yawLeft:new c.KeyBinding("KeyQ"),yawRight:new c.KeyBinding("KeyE"),rollLeft:new c.KeyBinding("KeyA"),rollRight:new c.KeyBinding("KeyD"),exitVehicle:new c.KeyBinding("KeyF"),seat_switch:new c.KeyBinding("KeyX"),view:new c.KeyBinding("KeyV")},n.steeringSimulator=new l.SpringSimulator(60,10,.6),n.aileronSimulator=new l.SpringSimulator(60,5,.6),n.elevatorSimulator=new l.SpringSimulator(60,7,.6),n.rudderSimulator=new l.SpringSimulator(60,10,.6),n}return r(e,t),e.prototype.noDirectionPressed=function(){return!(this.actions.throttle.isPressed||this.actions.brake.isPressed||this.actions.yawLeft.isPressed||this.actions.yawRight.isPressed||this.actions.rollLeft.isPressed||this.actions.rollRight.isPressed)},e.prototype.update=function(e){var n=this;t.prototype.update.call(this,e),void 0!==this.controllingCharacter?(this.enginePower<1&&(this.enginePower+=.4*e),this.enginePower>1&&(this.enginePower=1)):(this.enginePower>0&&(this.enginePower-=.12*e),this.enginePower<0&&(this.enginePower=0)),this.rotor.rotateX(this.enginePower*e*60),this.rayCastVehicle.numWheelsOnGround>0?!this.actions.yawLeft.isPressed&&!this.actions.rollLeft.isPressed||this.actions.yawRight.isPressed||this.actions.rollRight.isPressed?!this.actions.yawRight.isPressed&&!this.actions.rollRight.isPressed||this.actions.yawLeft.isPressed||this.actions.rollLeft.isPressed?this.steeringSimulator.target=0:this.steeringSimulator.target=-.8:this.steeringSimulator.target=.8:this.steeringSimulator.target=0,this.steeringSimulator.simulate(e),this.setSteeringValue(this.steeringSimulator.position);this.actions.rollLeft.isPressed&&!this.actions.rollRight.isPressed?this.aileronSimulator.target=.7:!this.actions.rollLeft.isPressed&&this.actions.rollRight.isPressed?this.aileronSimulator.target=-.7:this.aileronSimulator.target=0,this.actions.pitchUp.isPressed&&!this.actions.pitchDown.isPressed?this.elevatorSimulator.target=.7:!this.actions.pitchUp.isPressed&&this.actions.pitchDown.isPressed?this.elevatorSimulator.target=-.7:this.elevatorSimulator.target=0,this.actions.yawLeft.isPressed&&!this.actions.yawRight.isPressed?this.rudderSimulator.target=.7:!this.actions.yawLeft.isPressed&&this.actions.yawRight.isPressed?this.rudderSimulator.target=-.7:this.rudderSimulator.target=0,this.aileronSimulator.simulate(e),this.elevatorSimulator.simulate(e),this.rudderSimulator.simulate(e),this.leftAileron.rotation.y=this.aileronSimulator.position,this.rightAileron.rotation.y=-this.aileronSimulator.position,this.elevators.forEach((function(t){t.rotation.y=n.elevatorSimulator.position})),this.rudder.rotation.y=this.rudderSimulator.position},e.prototype.physicsPreStep=function(t,e){var n=u.threeQuat(t.quaternion),i=new o.Vector3(1,0,0).applyQuaternion(n),r=new o.Vector3(0,1,0).applyQuaternion(n),s=new o.Vector3(0,0,1).applyQuaternion(n),c=(new a.Vec3).copy(this.collision.velocity),l=t.velocity.length(),h=c.dot(u.cannonVector(s)),p=h/10;p=o.MathUtils.clamp(p,0,1);var d=h/10;d=o.MathUtils.clamp(d,0,1),this.collision.mass=50*(1-.6*d);var f=t.velocity.clone();f.normalize();var m=(new o.Quaternion).setFromUnitVectors(s,u.threeVector(f));m.x*=.3,m.y*=.3,m.z*=.3,m.w*=.3;var v=(new o.Euler).setFromQuaternion(m),g=o.MathUtils.clamp(l-1,0,.1);g*=this.rayCastVehicle.numWheelsOnGround>0&&h<0?0:1;var y=this.actions.throttle.isPressed&&h>0?0:1;t.angularVelocity.x+=v.x*g*y,t.angularVelocity.y+=v.y*g,t.angularVelocity.z+=v.z*g*y,e.actions.pitchUp.isPressed&&(t.angularVelocity.x-=.04*i.x*p*this.enginePower,t.angularVelocity.y-=.04*i.y*p*this.enginePower,t.angularVelocity.z-=.04*i.z*p*this.enginePower),e.actions.pitchDown.isPressed&&(t.angularVelocity.x+=.04*i.x*p*this.enginePower,t.angularVelocity.y+=.04*i.y*p*this.enginePower,t.angularVelocity.z+=.04*i.z*p*this.enginePower),e.actions.yawLeft.isPressed&&(t.angularVelocity.x+=.02*r.x*p*this.enginePower,t.angularVelocity.y+=.02*r.y*p*this.enginePower,t.angularVelocity.z+=.02*r.z*p*this.enginePower),e.actions.yawRight.isPressed&&(t.angularVelocity.x-=.02*r.x*p*this.enginePower,t.angularVelocity.y-=.02*r.y*p*this.enginePower,t.angularVelocity.z-=.02*r.z*p*this.enginePower),e.actions.rollLeft.isPressed&&(t.angularVelocity.x-=.055*s.x*p*this.enginePower,t.angularVelocity.y-=.055*s.y*p*this.enginePower,t.angularVelocity.z-=.055*s.z*p*this.enginePower),e.actions.rollRight.isPressed&&(t.angularVelocity.x+=.055*s.x*p*this.enginePower,t.angularVelocity.y+=.055*s.y*p*this.enginePower,t.angularVelocity.z+=.055*s.z*p*this.enginePower);var w=.02;e.actions.throttle.isPressed&&!e.actions.brake.isPressed?w=.06:!e.actions.throttle.isPressed&&e.actions.brake.isPressed?w=-.05:this.rayCastVehicle.numWheelsOnGround>0&&(w=0),t.velocity.x+=(l*this.lastDrag+w)*s.x*this.enginePower,t.velocity.y+=(l*this.lastDrag+w)*s.y*this.enginePower,t.velocity.z+=(l*this.lastDrag+w)*s.z*this.enginePower;var x=t.velocity.length(),_=.003*Math.pow(x,1)*this.enginePower;t.velocity.x-=t.velocity.x*_,t.velocity.y-=t.velocity.y*_,t.velocity.z-=t.velocity.z*_,this.lastDrag=_;var b=.005*Math.pow(x,1)*this.enginePower;b=o.MathUtils.clamp(b,0,.05),t.velocity.x+=r.x*b,t.velocity.y+=r.y*b,t.velocity.z+=r.z*b,t.angularVelocity.x=o.MathUtils.lerp(t.angularVelocity.x,.98*t.angularVelocity.x,p),t.angularVelocity.y=o.MathUtils.lerp(t.angularVelocity.y,.98*t.angularVelocity.y,p),t.angularVelocity.z=o.MathUtils.lerp(t.angularVelocity.z,.98*t.angularVelocity.z,p)},e.prototype.onInputChange=function(){t.prototype.onInputChange.call(this);this.actions.exitVehicle.justPressed&&void 0!==this.controllingCharacter&&this.forceCharacterOut(),this.actions.wheelBrake.justPressed&&this.setBrake(100),this.actions.wheelBrake.justReleased&&this.setBrake(0),this.actions.view.justPressed&&this.toggleFirstPersonView()},e.prototype.readAirplaneData=function(t){var e=this;t.scene.traverse((function(t){t.hasOwnProperty("userData")&&t.userData.hasOwnProperty("data")&&("rotor"===t.userData.data&&(e.rotor=t),"rudder"===t.userData.data&&(e.rudder=t),"elevator"===t.userData.data&&e.elevators.push(t),"aileron"===t.userData.data&&t.userData.hasOwnProperty("side")&&("left"===t.userData.side?e.leftAileron=t:"right"===t.userData.side&&(e.rightAileron=t)))}))},e.prototype.inputReceiverInit=function(){t.prototype.inputReceiverInit.call(this),this.world.updateControls([{keys:["Shift"],desc:"Accelerate"},{keys:["Space"],desc:"Decelerate"},{keys:["W","S"],desc:"Elevators"},{keys:["A","D"],desc:"Ailerons"},{keys:["Q","E"],desc:"Rudder / Steering"},{keys:["B"],desc:"Brake"},{keys:["V"],desc:"View select"},{keys:["F"],desc:"Exit vehicle"},{keys:["Shift","+","R"],desc:"Respawn"},{keys:["Shift","+","C"],desc:"Free camera"}])},e}(s.Vehicle);e.Airplane=p},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),a=n(15),s=n(7),c=n(0),l=n(2),u=n(12),h=n(10),p=function(t){function e(e){var n=t.call(this,e,{radius:.25,suspensionStiffness:20,suspensionRestLength:.35,maxSuspensionTravel:1,frictionSlip:.8,dampingRelaxation:2,dampingCompression:2,rollInfluence:.8})||this;return n.entityType=h.EntityType.Car,n.drive="awd",n._speed=0,n.airSpinTimer=0,n.gear=1,n.timeToShift=.2,n.canTiltForwards=!1,n.characterWantsToExit=!1,n.readCarData(e),n.collision.preStep=function(t){n.physicsPreStep(t,n)},n.actions={throttle:new s.KeyBinding("KeyW"),reverse:new s.KeyBinding("KeyS"),brake:new s.KeyBinding("Space"),left:new s.KeyBinding("KeyA"),right:new s.KeyBinding("KeyD"),exitVehicle:new s.KeyBinding("KeyF"),seat_switch:new s.KeyBinding("KeyX"),view:new s.KeyBinding("KeyV")},n.steeringSimulator=new u.SpringSimulator(60,10,.6),n}return r(e,t),Object.defineProperty(e.prototype,"speed",{get:function(){return this._speed},enumerable:!0,configurable:!0}),e.prototype.noDirectionPressed=function(){return!(this.actions.throttle.isPressed||this.actions.reverse.isPressed||this.actions.left.isPressed||this.actions.right.isPressed)},e.prototype.update=function(e){t.prototype.update.call(this,e),this.rayCastVehicle.numWheelsOnGround>0?(this.canTiltForwards=!1,this.airSpinTimer=0):(this.airSpinTimer+=e,this.actions.throttle.isPressed||(this.canTiltForwards=!0));var n={R:-4,0:0,1:5,2:9,3:13,4:17,5:22};if(this.shiftTimer>0)this.shiftTimer-=e,this.shiftTimer<0&&(this.shiftTimer=0);else if(this.actions.reverse.isPressed){var i=(n.R-this.speed)/Math.abs(n.R),r=500/this.gear*Math.pow(Math.abs(i),1);this.applyEngineForce(r)}else{if((i=(n[this.gear]-this.speed)/(n[this.gear]-n[this.gear-1]))<.1&&this.gear<5)this.shiftUp();else if(this.gear>1&&i>1.2)this.shiftDown();else if(this.actions.throttle.isPressed){r=500/this.gear*Math.pow(i,1);this.applyEngineForce(-r)}}if(this.steeringSimulator.simulate(e),this.setSteeringValue(this.steeringSimulator.position),void 0!==this.steeringWheel&&(this.steeringWheel.rotation.z=2*-this.steeringSimulator.position),this.rayCastVehicle.numWheelsOnGround<3&&Math.abs(this.collision.velocity.length())<.5&&this.collision.quaternion.copy(this.collision.initQuaternion),this.characterWantsToExit&&void 0!==this.controllingCharacter&&this.controllingCharacter.charState.canLeaveVehicles){var o=this.collision.velocity.length();o>.1&&o<4?this.triggerAction("brake",!0):this.forceCharacterOut()}},e.prototype.shiftUp=function(){this.gear++,this.shiftTimer=this.timeToShift,this.applyEngineForce(0)},e.prototype.shiftDown=function(){this.gear--,this.shiftTimer=this.timeToShift,this.applyEngineForce(0)},e.prototype.physicsPreStep=function(t,e){var n=l.threeQuat(t.quaternion),i=new c.Vector3(0,0,1).applyQuaternion(n),r=new c.Vector3(1,0,0).applyQuaternion(n),a=new c.Vector3(0,1,0).applyQuaternion(n);this._speed=this.collision.velocity.dot(l.cannonVector(i));var s=c.MathUtils.clamp(this.airSpinTimer/2,0,1);s*=c.MathUtils.clamp(this.speed,0,1);var u=c.MathUtils.clamp(1-this.speed,0,1)*(a.dot(new c.Vector3(0,-1,0))/2+.5)*3,h=this.collision.angularVelocity,p=l.cannonVector(i.clone()),d=l.cannonVector(r.clone()),f=l.cannonVector(i.clone().multiplyScalar(.15*(s+u))),m=l.cannonVector(r.clone().multiplyScalar(.15*s));this.actions.right.isPressed&&!this.actions.left.isPressed?h.dot(p)<2&&h.vadd(f,h):this.actions.left.isPressed&&!this.actions.right.isPressed&&h.dot(p)>-2&&h.vsub(f,h),this.canTiltForwards&&this.actions.throttle.isPressed&&!this.actions.reverse.isPressed?h.dot(d)<2&&h.vadd(m,h):this.actions.reverse.isPressed&&!this.actions.throttle.isPressed&&h.dot(d)>-2&&h.vsub(m,h);var v=(new o.Vec3).copy(this.collision.velocity);v.normalize();var g=l.getSignedAngleBetweenVectors(l.threeVector(v),i),y=c.MathUtils.clamp(.3*this.speed,1,Number.MAX_VALUE);if(this.actions.right.isPressed){var w=Math.min(-.8/y,-g);this.steeringSimulator.target=c.MathUtils.clamp(w,-.8,.8)}else if(this.actions.left.isPressed){w=Math.max(.8/y,-g);this.steeringSimulator.target=c.MathUtils.clamp(w,-.8,.8)}else this.steeringSimulator.target=0;this.seats.forEach((function(t){var e;null===(e=t.door)||void 0===e||e.preStepCallback()}))},e.prototype.onInputChange=function(){t.prototype.onInputChange.call(this);this.actions.exitVehicle.justPressed&&(this.characterWantsToExit=!0),this.actions.exitVehicle.justReleased&&(this.characterWantsToExit=!1,this.triggerAction("brake",!1)),(this.actions.throttle.justReleased||this.actions.reverse.justReleased)&&this.applyEngineForce(0),this.actions.brake.justPressed&&this.setBrake(1e6,"rwd"),this.actions.brake.justReleased&&this.setBrake(0,"rwd"),this.actions.view.justPressed&&this.toggleFirstPersonView()},e.prototype.inputReceiverInit=function(){t.prototype.inputReceiverInit.call(this),this.world.updateControls([{keys:["W","S"],desc:"Accelerate, Brake / Reverse"},{keys:["A","D"],desc:"Steering"},{keys:["Space"],desc:"Handbrake"},{keys:["V"],desc:"View select"},{keys:["F"],desc:"Exit vehicle"},{keys:["Shift","+","R"],desc:"Respawn"},{keys:["Shift","+","C"],desc:"Free camera"}])},e.prototype.readCarData=function(t){var e=this;t.scene.traverse((function(t){t.hasOwnProperty("userData")&&t.userData.hasOwnProperty("data")&&"steering_wheel"===t.userData.data&&(e.steeringWheel=t)}))},e}(a.Vehicle);e.Car=p},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(18),s=n(74),c=n(2),l=function(t){function e(e,n,i){var r=t.call(this,e,n,i)||this;return r.init(),r}return r(e,t),e.prototype.init=function(){this.position=new o.Vector3,this.velocity=new o.Vector3,this.target=new o.Vector3,this.cache=[];for(var t=0;t<2;t++)this.cache.push(new s.SimulationFrameVector(new o.Vector3,new o.Vector3))},e.prototype.simulate=function(t){this.generateFrames(t),this.position.lerpVectors(this.cache[0].position,this.cache[1].position,this.offset/this.frameTime),this.velocity.lerpVectors(this.cache[0].velocity,this.cache[1].velocity,this.offset/this.frameTime)},e.prototype.getFrame=function(t){var e=new s.SimulationFrameVector(this.lastFrame().position.clone(),this.lastFrame().velocity.clone());return c.springV(e.position,this.target,e.velocity,this.mass,this.damping),e},e}(a.SimulatorBase);e.VectorSpringSimulator=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(t,e){this.position=t,this.velocity=e};e.SimulationFrameVector=i},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(18),s=n(2),c=function(t){function e(e,n,i,r,o){void 0===r&&(r=0),void 0===o&&(o=0);var a=t.call(this,e,n,i)||this;a.position=r,a.velocity=o,a.target=0,a.lastLerp=0,a.cache=[];for(var s=0;s<2;s++)a.cache.push({position:r,velocity:o});return a}return r(e,t),e.prototype.simulate=function(t){this.generateFrames(t);var e=o.MathUtils.lerp(0,this.cache[1].position,this.offset/this.frameTime);this.position=e-this.lastLerp,this.lastLerp=e,this.velocity=o.MathUtils.lerp(this.cache[0].velocity,this.cache[1].velocity,this.offset/this.frameTime)},e.prototype.getFrame=function(t){var e=Object.assign({},this.lastFrame());return t&&(e.position=0,this.lastLerp=this.lastLerp-this.lastFrame().position),s.spring(e.position,this.target,e.velocity,this.mass,this.damping)},e}(a.SimulatorBase);e.RelativeSpringSimulator=c},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(2),s=n(5),c=n(8),l=n(77),u=n(16),h=n(25),p=function(t){function e(e,n){var i=t.call(this,e,n)||this;i.exitPoint=n.entryPoints[0],i.endPosition.copy(i.exitPoint.position),i.endPosition.y+=.52;var r=a.detectRelativeSide(n.seatPointObject,i.exitPoint);return r===s.Side.Left?i.playAnimation("stand_up_left",.1):r===s.Side.Right&&i.playAnimation("stand_up_right",.1),i}return r(e,t),e.prototype.update=function(e){if(t.prototype.update.call(this,e),this.animationEnded(e))this.detachCharacterFromVehicle(),this.seat.door.physicsEnabled=!0,this.character.rayHasHit?this.vehicle.collision.velocity.length()>1?(this.character.setState(new h.DropRolling(this.character)),this.character.leaveSeat()):this.anyDirection()||void 0===this.seat.door?(this.character.setState(new c.Idle(this.character)),this.character.leaveSeat()):this.character.setState(new l.CloseVehicleDoorOutside(this.character,this.seat)):(this.character.setState(new u.Falling(this.character)),this.character.leaveSeat());else{this.seat.door&&(this.seat.door.physicsEnabled=!1);var n=this.timer/this.animationLength,i=a.easeInOutSine(n),r=(new o.Vector3).lerpVectors(this.startPosition,this.endPosition,i);this.character.setPosition(r.x,r.y,r.z),this.updateEndRotation(),o.Quaternion.slerp(this.startRotation,this.endRotation,this.character.quaternion,i)}},e}(n(29).ExitingStateBase);e.ExitingVehicle=p},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=n(5),s=n(8),c=n(2),l=function(t){function e(e,n){var i=t.call(this,e)||this;i.hasClosedDoor=!1,i.seat=n,i.canFindVehiclesToEnter=!1;var r=c.detectRelativeSide(n.seatPointObject,n.door.doorObject);return r===a.Side.Left?i.playAnimation("close_door_standing_right",.1):r===a.Side.Right&&i.playAnimation("close_door_standing_left",.1),i}return r(e,t),e.prototype.update=function(e){t.prototype.update.call(this,e),this.timer>.3&&!this.hasClosedDoor&&(this.hasClosedDoor=!0,this.seat.door.close()),this.animationEnded(e)&&(this.character.setState(new s.Idle(this.character)),this.character.leaveSeat())},e}(o.CharacterStateBase);e.CloseVehicleDoorOutside=l},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(3),s=n(5),c=n(8),l=n(28),u=n(2),h=n(12),p=function(t){function e(e,n,i){var r=t.call(this,e)||this;r.hasOpenedDoor=!1,r.startPosition=new o.Vector3,r.endPosition=new o.Vector3,r.startRotation=new o.Quaternion,r.endRotation=new o.Quaternion,r.canFindVehiclesToEnter=!1,r.seat=n,r.entryPoint=i;var a=u.detectRelativeSide(i,n.seatPointObject);return a===s.Side.Left?r.playAnimation("open_door_standing_left",.1):a===s.Side.Right&&r.playAnimation("open_door_standing_right",.1),r.character.resetVelocity(),r.character.rotateModel(),r.character.setPhysicsEnabled(!1),r.character.setPhysicsEnabled(!1),r.seat.vehicle.attach(r.character),r.startPosition.copy(r.character.position),r.endPosition.copy(r.entryPoint.position),r.endPosition.y+=.53,r.startRotation.copy(r.character.quaternion),r.endRotation.copy(r.entryPoint.quaternion),r.factorSimluator=new h.SpringSimulator(60,10,.5),r.factorSimluator.target=1,r}return r(e,t),e.prototype.update=function(e){var n;if(t.prototype.update.call(this,e),this.timer>.3&&!this.hasOpenedDoor&&(this.hasOpenedDoor=!0,null===(n=this.seat.door)||void 0===n||n.open()),this.animationEnded(e))this.anyDirection()?(this.character.vehicleEntryInstance=null,this.character.world.graphicsWorld.attach(this.character),this.character.setPhysicsEnabled(!0),this.character.setState(new c.Idle(this.character))):this.character.setState(new l.EnteringVehicle(this.character,this.seat,this.entryPoint));else{this.factorSimluator.simulate(e);var i=(new o.Vector3).lerpVectors(this.startPosition,this.endPosition,this.factorSimluator.position);this.character.setPosition(i.x,i.y,i.z),o.Quaternion.slerp(this.startRotation,this.endRotation,this.character.quaternion,this.factorSimluator.position)}},e}(a.CharacterStateBase);e.OpenVehicleDoor=p},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(2),s=n(16),c=function(t){function e(e,n){var i=t.call(this,e,n)||this;i.endPosition.copy(i.startPosition),i.endPosition.y+=1;var r=a.threeQuat(n.vehicle.collision.quaternion),s=new o.Vector3(0,0,1).applyQuaternion(r);return i.exitPoint=new o.Object3D,i.exitPoint.lookAt(s),i.exitPoint.position.copy(i.endPosition),i.playAnimation("jump_idle",.1),i}return r(e,t),e.prototype.update=function(e){if(t.prototype.update.call(this,e),this.animationEnded(e))this.detachCharacterFromVehicle(),this.character.setState(new s.Falling(this.character)),this.character.leaveSeat();else{var n=o.MathUtils.clamp((this.timer/this.animationLength-.3)*(1/.7),0,1),i=a.easeOutQuad(n),r=(new o.Vector3).lerpVectors(this.startPosition,this.endPosition,i);this.character.setPosition(r.x,r.y,r.z),this.updateEndRotation(),o.Quaternion.slerp(this.startRotation,this.endRotation,this.character.quaternion,i)}},e}(n(29).ExitingStateBase);e.ExitingAirplane=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),r=n(2),o=function(t){var e={mass:0,position:new i.Vec3,height:.5,radius:.3,segments:8,friction:.3};t=r.setDefaults(t,e),this.options=t;var n=new i.Material("capsuleMat");n.friction=t.friction;var o=new i.Body({mass:t.mass,position:t.position}),a=new i.Sphere(t.radius);o.material=n,o.addShape(a,new i.Vec3(0,0,0)),o.addShape(a,new i.Vec3(0,t.height/2,0)),o.addShape(a,new i.Vec3(0,-t.height/2,0)),this.body=o};e.CapsuleCollider=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=function(){function t(t){this.wantsToDrive=!1,this.character=t}return t.prototype.update=function(t){var e=new i.Vector3;this.entryPoint.getWorldPosition(e);var n=(new i.Vector3).subVectors(e,this.character.position);this.character.setOrientation(n);var r=n.y;n.y=0,this.character.charState.canEnterVehicles&&n.length()<.2&&r<2&&this.character.enterVehicle(this.targetSeat,this.entryPoint)},t}();e.VehicleEntryInstance=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=function(){this.velocity=new i.Vector3};e.GroundImpactData=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){this.closestDistance=Number.POSITIVE_INFINITY,this.maxDistance=Number.POSITIVE_INFINITY,this.referencePosition=t,void 0!==e&&(this.maxDistance=e)}return t.prototype.consider=function(t,e){var n=this.referencePosition.distanceTo(e);n10&&(this.character.controlledObject.triggerAction("reverse",!0),this.character.controlledObject.triggerAction("throttle",!1)),u<1||0===this.character.controlledObject.rayCastVehicle.numWheelsOnGround?this.staleTimer+=e:this.staleTimer=0,this.staleTimer>5){var h=new o.Vector3;this.targetNode.object.getWorldPosition(h),h.y+=3,this.character.controlledObject.collision.position=s.cannonVector(h),this.character.controlledObject.collision.interpolatedPosition=s.cannonVector(h),this.character.controlledObject.collision.angularVelocity=new a.Vec3,this.character.controlledObject.collision.quaternion.copy(this.character.controlledObject.collision.initQuaternion),this.staleTimer=0}r.length()this.stopDistance?this.isTargetReached=!1:this.isTargetReached=!0;var o=new i.Vector3(0,0,1).applyQuaternion(this.character.controlledObject.quaternion);c.y=0,c.normalize();var a=r.getSignedAngleBetweenVectors(o,c),s=o.dot(r.threeVector(this.character.controlledObject.collision.velocity))>0;this.character.controlledObject.collision.velocity.length();o.dot(c)<0?(this.character.controlledObject.triggerAction("reverse",!0),this.character.controlledObject.triggerAction("throttle",!1)):(this.character.controlledObject.triggerAction("throttle",!0),this.character.controlledObject.triggerAction("reverse",!1)),Math.abs(a)>.15?o.dot(c)>0||s?a>0?(this.character.controlledObject.triggerAction("left",!0),this.character.controlledObject.triggerAction("right",!1)):(this.character.controlledObject.triggerAction("right",!0),this.character.controlledObject.triggerAction("left",!1)):a>0?(this.character.controlledObject.triggerAction("right",!0),this.character.controlledObject.triggerAction("left",!1)):(this.character.controlledObject.triggerAction("left",!0),this.character.controlledObject.triggerAction("right",!1)):(this.character.controlledObject.triggerAction("left",!1),this.character.controlledObject.triggerAction("right",!1))}else{var c=(new i.Vector3).subVectors(this.target.position,this.character.position);this.character.setViewVector(c),c.length()>this.stopDistance?(this.isTargetReached=!1,this.character.triggerAction("up",!0)):(this.isTargetReached=!0,this.character.triggerAction("up",!1),this.character.setOrientation(c))}},t}();e.FollowTarget=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=n(27),o=n(2),a=function(){function t(t){this.object=t}return t.prototype.spawn=function(t,e){var n=this;t.loadGLTF("build/assets/boxman.glb",(function(t){var a=new r.Character(t),s=new i.Vector3;n.object.getWorldPosition(s),a.setPosition(s.x,s.y,s.z);var c=o.getForward(n.object);a.setOrientation(c,!0),e.add(a),a.takeControl()}))},t}();e.CharacterSpawnPoint=a},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(88),a=n(0),s=n(89),c=function(t){function e(e){var n=t.call(this)||this;n.updateOrder=5,n.sunPosition=new a.Vector3,n._phi=50,n._theta=145,n.maxHemiIntensity=.9,n.minHemiIntensity=.3,n.world=e,n.skyMaterial=new a.ShaderMaterial({uniforms:a.UniformsUtils.clone(o.SkyShader.uniforms),fragmentShader:o.SkyShader.fragmentShader,vertexShader:o.SkyShader.vertexShader,side:a.BackSide}),n.skyMesh=new a.Mesh(new a.SphereBufferGeometry(1e3,24,12),n.skyMaterial),n.attach(n.skyMesh),n.hemiLight=new a.HemisphereLight(16777215,16777215,1),n.refreshHemiIntensity(),n.hemiLight.color.setHSL(.59,.4,.6),n.hemiLight.groundColor.setHSL(.095,.2,.75),n.hemiLight.position.set(0,50,0),n.world.graphicsWorld.add(n.hemiLight);return n.csm=new s.default({fov:80,far:250,lightIntensity:2.5,cascades:3,shadowMapSize:2048,camera:e.camera,parent:e.graphicsWorld,mode:"custom",customSplitsCallback:function(t,e,n){for(var i=[],r=t-1;r>=0;r--)i.push(Math.pow(.25,r));return i}}),n.csm.fade=!0,n.refreshSunPosition(),e.graphicsWorld.add(n),e.registerUpdatable(n),n}return r(e,t),Object.defineProperty(e.prototype,"theta",{set:function(t){this._theta=t,this.refreshSunPosition()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"phi",{set:function(t){this._phi=t,this.refreshSunPosition(),this.refreshHemiIntensity()},enumerable:!0,configurable:!0}),e.prototype.update=function(t){this.position.copy(this.world.camera.position),this.refreshSunPosition(),this.csm.update(this.world.camera.matrix),this.csm.lightDirection=new a.Vector3(-this.sunPosition.x,-this.sunPosition.y,-this.sunPosition.z).normalize()},e.prototype.refreshSunPosition=function(){this.sunPosition.x=10*Math.sin(this._theta*Math.PI/180)*Math.cos(this._phi*Math.PI/180),this.sunPosition.y=10*Math.sin(this._phi*Math.PI/180),this.sunPosition.z=10*Math.cos(this._theta*Math.PI/180)*Math.cos(this._phi*Math.PI/180),this.skyMaterial.uniforms.sunPosition.value.copy(this.sunPosition),this.skyMaterial.uniforms.cameraPos.value.copy(this.world.camera.position)},e.prototype.refreshHemiIntensity=function(){this.hemiLight.intensity=this.minHemiIntensity+Math.pow(1-Math.abs(this._phi-90)/90,.25)*(this.maxHemiIntensity-this.minHemiIntensity)},e}(a.Object3D);e.Sky=c},function(t,e,n){"use strict";n.r(e),n.d(e,"SkyShader",(function(){return r}));const i=n(0);let r={uniforms:{luminance:{value:1},turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new i.Vector3},cameraPos:{value:new i.Vector3}},vertexShader:"\n uniform vec3 sunPosition;\n uniform float rayleigh;\n uniform float turbidity;\n uniform float mieCoefficient;\n \n varying vec3 vWorldPosition;\n varying vec3 vSunDirection;\n varying float vSunfade;\n varying vec3 vBetaR;\n varying vec3 vBetaM;\n varying float vSunE;\n \n const vec3 up = vec3( 0.0, 1.0, 0.0 );\n \n // constants for atmospheric scattering\n const float e = 2.71828182845904523536028747135266249775724709369995957;\n const float pi = 3.141592653589793238462643383279502884197169;\n \n // wavelength of used primaries, according to preetham\n const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );\n // this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:\n // (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))\n const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );\n \n // mie stuff\n // K coefficient for the primaries\n const float v = 4.0;\n const vec3 K = vec3( 0.686, 0.678, 0.666 );\n // MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K\n const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );\n \n // earth shadow hack\n // cutoffAngle = pi / 1.95;\n const float cutoffAngle = 1.6110731556870734;\n const float steepness = 1.5;\n const float EE = 1000.0;\n \n float sunIntensity( float zenithAngleCos ) {\n \tzenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );\n \treturn EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );\n }\n \n vec3 totalMie( float T ) {\n \tfloat c = ( 0.2 * T ) * 10E-18;\n \treturn 0.434 * c * MieConst;\n }\n \n void main() {\n \n \tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n \tvWorldPosition = worldPosition.xyz;\n \n \tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n \n \tvSunDirection = normalize( sunPosition );\n \n \tvSunE = sunIntensity( dot( vSunDirection, up ) );\n \n \tvSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );\n \n \tfloat rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );\n \n // extinction (absorbtion + out scattering)\n // rayleigh coefficients\n \tvBetaR = totalRayleigh * rayleighCoefficient;\n \n // mie coefficients\n \tvBetaM = totalMie( turbidity ) * mieCoefficient;\n \n }\n ",fragmentShader:"\n varying vec3 vWorldPosition;\n varying vec3 vSunDirection;\n varying float vSunfade;\n varying vec3 vBetaR;\n varying vec3 vBetaM;\n varying float vSunE;\n \n uniform float luminance;\n uniform float mieDirectionalG;\n uniform vec3 cameraPos;\n \n // constants for atmospheric scattering\n const float pi = 3.141592653589793238462643383279502884197169;\n \n const float n = 1.0003; // refractive index of air\n const float N = 2.545E25; // number of molecules per unit volume for air at\n // 288.15K and 1013mb (sea level -45 celsius)\n \n // optical length at zenith for molecules\n const float rayleighZenithLength = 8.4E3;\n const float mieZenithLength = 1.25E3;\n const vec3 up = vec3( 0.0, 1.0, 0.0 );\n // 66 arc seconds -> degrees, and the cosine of that\n const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\n \n // 3.0 / ( 16.0 * pi )\n const float THREE_OVER_SIXTEENPI = 0.05968310365946075;\n // 1.0 / ( 4.0 * pi )\n const float ONE_OVER_FOURPI = 0.07957747154594767;\n \n float rayleighPhase( float cosTheta ) {\n \treturn THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );\n }\n \n float hgPhase( float cosTheta, float g ) {\n \tfloat g2 = pow( g, 2.0 );\n \tfloat inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );\n \treturn ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );\n }\n \n // Filmic ToneMapping http://filmicgames.com/archives/75\n const float A = 0.15;\n const float B = 0.50;\n const float C = 0.10;\n const float D = 0.20;\n const float E = 0.02;\n const float F = 0.30;\n \n const float whiteScale = 1.0748724675633854; // 1.0 / Uncharted2Tonemap(1000.0)\n \n vec3 Uncharted2Tonemap( vec3 x ) {\n \treturn ( ( x * ( A * x + C * B ) + D * E ) / ( x * ( A * x + B ) + D * F ) ) - E / F;\n }\n \n void main() {\n // optical length\n // cutoff angle at 90 to avoid singularity in next formula.\n \tfloat zenithAngle = acos( max( 0.0, dot( up, normalize( vWorldPosition - cameraPos ) ) ) );\n \tfloat inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );\n \tfloat sR = rayleighZenithLength * inverse;\n \tfloat sM = mieZenithLength * inverse;\n \n // combined extinction factor\n \tvec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );\n \n // in scattering\n \tfloat cosTheta = dot( normalize( vWorldPosition - cameraPos ), vSunDirection );\n \n \tfloat rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );\n \tvec3 betaRTheta = vBetaR * rPhase;\n \n \tfloat mPhase = hgPhase( cosTheta, mieDirectionalG );\n \tvec3 betaMTheta = vBetaM * mPhase;\n \n \tvec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );\n \tLin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );\n \n // nightsky\n \tvec3 direction = normalize( vWorldPosition - cameraPos );\n \tfloat theta = acos( direction.y ); // elevation --\x3e y-axis, [-pi/2, pi/2]\n \tfloat phi = atan( direction.z, direction.x ); // azimuth --\x3e x-axis [-pi/2, pi/2]\n \tvec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );\n \tvec3 L0 = vec3( 0.1 ) * Fex;\n \n // composition + solar disc\n \tfloat sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );\n \tL0 += ( vSunE * 19000.0 * Fex ) * sundisk;\n \n \tvec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );\n \n \t//vec3 curr = Uncharted2Tonemap( ( log2( 2.0 / pow( luminance, 4.0 ) ) ) * texColor );\n // vec3 color = texColor * whiteScale;\n vec3 color = texColor * 0.3;\n \n \tvec3 retColor = pow( color, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );\n \n \tgl_FragColor = vec4( retColor, 1.0 );\n \n #if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n #endif\n } "}},function(t,e,n){"use strict";n.r(e);var i=n(0);class r{constructor(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}fromLerp(t,e,n){return this.x=(1-n)*t.x+n*e.x,this.y=(1-n)*t.y+n*e.y,this.z=(1-n)*t.z+n*e.z,this}}function o(t){return t*Math.PI/180}class a{constructor(t){t=t||{},this.fov=t.fov||70,this.near=t.near||.1,this.far=t.far||1e3,this.aspect=t.aspect||1,this.vertices={near:[],far:[]}}getViewSpaceVertices(){return this.nearPlaneY=this.near*Math.tan(o(this.fov/2)),this.nearPlaneX=this.aspect*this.nearPlaneY,this.farPlaneY=this.far*Math.tan(o(this.fov/2)),this.farPlaneX=this.aspect*this.farPlaneY,this.vertices.near.push(new r(this.nearPlaneX,this.nearPlaneY,-this.near),new r(this.nearPlaneX,-this.nearPlaneY,-this.near),new r(-this.nearPlaneX,-this.nearPlaneY,-this.near),new r(-this.nearPlaneX,this.nearPlaneY,-this.near)),this.vertices.far.push(new r(this.farPlaneX,this.farPlaneY,-this.far),new r(this.farPlaneX,-this.farPlaneY,-this.far),new r(-this.farPlaneX,-this.farPlaneY,-this.far),new r(-this.farPlaneX,this.farPlaneY,-this.far)),this.vertices}split(t){const e=[];for(let n=0;n 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( pointLight.shadow, directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( spotLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0) && defined( RE_Direct ) && defined( USE_CSM ) && defined( CSM_CASCADES )\n\tDirectionalLight directionalLight;\n\tfloat linearDepth = (vViewPosition.z) / (shadowFar - cameraNear);\n\t\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tif(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y) directLight.color *= all( bvec3( directionalLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tif(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) RE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) && !defined( USE_CSM ) && !defined( CSM_CASCADES )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif\n",lights_pars_begin:"\n#if defined( USE_CSM ) && defined( CSM_CASCADES )\nuniform vec2 CSM_cascades[CSM_CASCADES];\nuniform float cameraNear;\nuniform float shadowFar;\n#endif\n\t"+i.ShaderChunk.lights_pars_begin};e.default=class{constructor(t){t=t||{},this.camera=t.camera,this.parent=t.parent,this.fov=t.fov||this.camera.fov,this.near=this.camera.near,this.far=t.far||this.camera.far,this.aspect=t.aspect||this.camera.aspect,this.cascades=t.cascades||3,this.mode=t.mode||"practical",this.shadowMapSize=t.shadowMapSize||2048,this.shadowBias=t.shadowBias||1e-6,this.lightDirection=t.lightDirection||new i.Vector3(1,-1,1).normalize(),this.lightIntensity=t.lightIntensity||1,this.lightNear=t.lightNear||1,this.lightFar=t.lightFar||2e3,this.lightMargin=t.lightMargin||200,this.customSplitsCallback=t.customSplitsCallback,this.lights=[],this.materials=[],this.createLights(),this.getBreaks(),this.initCascades(),this.injectInclude()}createLights(){for(let t=0;t 0.0) {\n return tx; \n }\n \n float hm = map(oriComp + dir * tm); \n float tmid = 0.0;\n for(int i = 0; i < NUM_STEPS; i++) {\n tmid = mix(tm,tx, hm/(hm-hx)); \n p = oriComp + dir * tmid; \n float hmid = map(p);\n if(hmid < 0.0) {\n tx = tmid;\n hx = hmid;\n } else {\n tm = tmid;\n hm = hmid;\n }\n }\n\n return tmid;\n }\n \n void main() {\n float time = iGlobalTime * 0.3;\n \n // ray\n vec3 ang = vec3(\n sin(time*3.0)*0.1,sin(time)*0.2+0.3,time\n ); \n\n vec3 dir = normalize( vWorldPosition - cameraPos );\n \n // tracing\n vec3 p;\n heightMapTracing(cameraPos,dir,p);\n\t vec3 dist = vWorldPosition - cameraPos;\n\t float EPSILON_NRM\t= 0.1 / iResolution.x;\n vec3 n = getNormal(\n p,\n dot(dist,dist) * EPSILON_NRM\n );\n \n // color\n vec3 color = mix(\n getSkyColor(dir),\n getSeaColor(p,n,lightDir,dir,dist),\n pow(smoothstep(0.0,-0.05,dir.y),0.3)\n );\n \n // post\n gl_FragColor = vec4(pow(color,vec3(0.8)), 1.0) * 1.2;\n\n float fogfac = clamp(length(dist), 300.0, 600.0);\n fogfac -= 300.0;\n fogfac /= 300.0;\n gl_FragColor.a = 1.0 - fogfac;\n\n #if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n #endif\n }\n "}},function(t,e,n){"use strict";n.r(e);var i=n(0),r={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 texel = texture2D( tDiffuse, vUv );","\tgl_FragColor = opacity * texel;","}"].join("\n")},o=n(13),a=n(4),s=function(t,e){a.a.call(this),this.scene=t,this.camera=e,this.clear=!0,this.needsSwap=!1,this.inverse=!1};s.prototype=Object.assign(Object.create(a.a.prototype),{constructor:s,render:function(t,e,n){var i,r,o=t.getContext(),a=t.state;a.buffers.color.setMask(!1),a.buffers.depth.setMask(!1),a.buffers.color.setLocked(!0),a.buffers.depth.setLocked(!0),this.inverse?(i=0,r=1):(i=1,r=0),a.buffers.stencil.setTest(!0),a.buffers.stencil.setOp(o.REPLACE,o.REPLACE,o.REPLACE),a.buffers.stencil.setFunc(o.ALWAYS,i,4294967295),a.buffers.stencil.setClear(r),a.buffers.stencil.setLocked(!0),t.setRenderTarget(n),this.clear&&t.clear(),t.render(this.scene,this.camera),t.setRenderTarget(e),this.clear&&t.clear(),t.render(this.scene,this.camera),a.buffers.color.setLocked(!1),a.buffers.depth.setLocked(!1),a.buffers.stencil.setLocked(!1),a.buffers.stencil.setFunc(o.EQUAL,1,4294967295),a.buffers.stencil.setOp(o.KEEP,o.KEEP,o.KEEP),a.buffers.stencil.setLocked(!0)}});var c=function(){a.a.call(this),this.needsSwap=!1};c.prototype=Object.create(a.a.prototype),Object.assign(c.prototype,{render:function(t){t.state.buffers.stencil.setLocked(!1),t.state.buffers.stencil.setTest(!1)}}),n.d(e,"EffectComposer",(function(){return l})),n.d(e,"Pass",(function(){return d}));var l=function(t,e){if(this.renderer=t,void 0===e){var n={minFilter:i.LinearFilter,magFilter:i.LinearFilter,format:i.RGBAFormat,stencilBuffer:!1},a=t.getSize(new i.Vector2);this._pixelRatio=t.getPixelRatio(),this._width=a.width,this._height=a.height,(e=new i.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio,n)).texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=e.width,this._height=e.height;this.renderTarget1=e,this.renderTarget2=e.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],void 0===r&&console.error("THREE.EffectComposer relies on CopyShader"),void 0===o.ShaderPass&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new o.ShaderPass(r),this.clock=new i.Clock};Object.assign(l.prototype,{swapBuffers:function(){var t=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=t},addPass:function(t){this.passes.push(t),t.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)},insertPass:function(t,e){this.passes.splice(e,0,t)},isLastEnabledPass:function(t){for(var e=t+1;e0&&r[e[a].x/3]>0;);a+10&&(t.visiblePoints=e.splice(a+1))}function A(t,e){for(var n,i=x.length,r=[t],o=e.indexOf(t.visiblePoints.pop());i-- >0;)(n=x[i])!==t&&M(n,e).dot(v.subVectors(e[o],e[n[0]]))>0&&r.push(n);var a,s,c,l,u=i=r.length,h=1===i,p=[],d=0,f=[];r[0][0],r[0][1],r[0][1],r[0][2],r[0][2],r[0][0];if(1===r.length)p=[(n=r[0])[0],n[1],n[1],n[2],n[2],n[0]],_.indexOf(n)>-1&&_.splice(_.indexOf(n),1),n.visiblePoints&&(f=f.concat(n.visiblePoints)),x.splice(x.indexOf(n),1);else for(;i-- >0;){var m;for(n=r[i],_.indexOf(n)>-1&&_.splice(_.indexOf(n),1),n.visiblePoints&&(f=f.concat(n.visiblePoints)),x.splice(x.indexOf(n),1),cEdgeIndex=0;cEdgeIndex<3;){for(m=!1,u=r.length,c=n[cEdgeIndex],l=n[(cEdgeIndex+1)%3];u-- >0&&!m;)if(d=0,(a=r[u])!==n)for(;d<3&&!m;)s=d+1,m=a[d]===c&&a[s%3]===l||a[d]===l&&a[s%3]===c,d++;m&&!h||(p.push(c),p.push(l)),cEdgeIndex++}}i=0;for(var g,y=p.length/2;i=s?n.dot(n):e.dot(e)-a*a/s}}();return function(M){for(h=new i.Vector3,p=new i.Vector3,new i.Vector3,d=new i.Vector3,f=new i.Vector3,m=new i.Vector3,v=new i.Vector3,g=new i.Vector3,y=new i.Vector3,w=new i.Vector3,points=M.vertices,x=[],_=[],I=t=points.length,e=points.slice(0,6),b=0;I-- >0;)points[I].xe[1].x&&(e[1]=points[I]),points[I].y0;)for(r=I-1;r-- >0;)b<(n=e[I].distanceToSquared(e[r]))&&(b=n,o=e[I],a=e[r]);for(I=6,b=0;I-- >0;)n=T(o,a,e[I]),b0;)n=Math.abs(points[I].dot(l)-u),b0;)E(O[I],F,points),void 0!==O[I].visiblePoints&&_.push(O[I]),x.push(O[I]);!function(t){for(;_.length>0;)A(_.shift(),t)}(points);for(var N=x.length;N-- >0;)M.faces[N]=new i.Face3(x[N][2],x[N][1],x[N][0],x[N].normal);return M.normalsNeedUpdate=!0,M}}();n.d(e,"threeToCannon",(function(){return c}));var a=Math.PI/2,s={BOX:"Box",CYLINDER:"Cylinder",SPHERE:"Sphere",HULL:"ConvexPolyhedron",MESH:"Trimesh"};const c=function(t,e){var n;if((e=e||{}).type===s.BOX)return u(t);if(e.type===s.CYLINDER)return function(t,e){var n,o,s,c=new i.Box3,l=["x","y","z"],u=e.cylinderAxis||"y",h=l.splice(l.indexOf(u),1)&&l;return c.setFromObject(t),isFinite(c.min.lengthSq())?(o=c.max[u]-c.min[u],s=.5*Math.max(c.max[h[0]]-c.min[h[0]],c.max[h[1]]-c.min[h[1]]),(n=new r.Cylinder(s,s,o,12))._type=r.Shape.types.CYLINDER,n.radiusTop=s,n.radiusBottom=s,n.height=o,n.numSegments=12,n.orientation=new r.Quaternion,n.orientation.setFromEuler("y"===u?a:0,"z"===u?a:0,0,"XYZ").normalize(),n):null}(t,e);if(e.type===s.SPHERE)return function(t,e){if(e.sphereRadius)return new r.Sphere(e.sphereRadius);var n=h(t);return n?(n.computeBoundingSphere(),new r.Sphere(n.boundingSphere.radius)):null}(t,e);if(e.type===s.HULL)return function(t){var e,n,i,a,s=h(t);if(!s||!s.vertices.length)return null;for(e=0;e2&&o.fromBufferGeometry(r[0].geometry):o=r[0].geometry.clone(),o.metadata=r[0].geometry.metadata,r[0].updateMatrixWorld(),r[0].matrixWorld.decompose(s,c,l),o.scale(l.x,l.y,l.z)}for(;n=r.pop();)if(n.updateMatrixWorld(),n.geometry.isBufferGeometry){if(n.geometry.attributes.position&&n.geometry.attributes.position.itemSize>2){var u=new i.Geometry;u.fromBufferGeometry(n.geometry),a.merge(u,n.matrixWorld),u.dispose()}}else a.merge(n.geometry,n.matrixWorld);return(e=new i.Matrix4).scale(t.scale),a.applyMatrix(e),a}function p(t){return t.attributes||(t=(new i.BufferGeometry).fromGeometry(t)),(t.attributes.position||{}).array||[]}c.Type=s}])})); \ No newline at end of file diff --git a/build/types/characters/character_ai/FollowPath.d.ts b/build/types/characters/character_ai/FollowPath.d.ts index 1ac4a032..18cd5502 100644 --- a/build/types/characters/character_ai/FollowPath.d.ts +++ b/build/types/characters/character_ai/FollowPath.d.ts @@ -4,6 +4,7 @@ import { PathNode } from '../../world/PathNode'; export declare class FollowPath extends FollowTarget implements ICharacterAI { nodeRadius: number; reverse: boolean; + private staleTimer; private targetNode; constructor(firstNode: PathNode, nodeRadius: number); update(timeStep: number): void; diff --git a/build/types/world/Grass.d.ts b/build/types/world/Grass.d.ts deleted file mode 100644 index 3093313f..00000000 --- a/build/types/world/Grass.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import * as THREE from 'three'; -import { World } from '../world/World'; -import { IUpdatable } from '../interfaces/IUpdatable.js'; -export declare class Grass implements IUpdatable { - updateOrder: number; - grassMaterial: THREE.ShaderMaterial; - playerPosition: THREE.Vector3; - private meshes; - private world; - constructor(object: any, world: World); - update(timeStep: number): void; -} diff --git a/build/types/world/World.d.ts b/build/types/world/World.d.ts index 873b4493..f9dd7025 100644 --- a/build/types/world/World.d.ts +++ b/build/types/world/World.d.ts @@ -2,17 +2,17 @@ import * as THREE from 'three'; import * as CANNON from 'cannon'; import { CameraOperator } from '../core/CameraOperator'; import { Stats } from '../../lib/utils/Stats'; +import { CannonDebugRenderer } from '../../lib/cannon/CannonDebugRenderer'; import { InputManager } from '../core/InputManager'; -import { Character } from '../characters/Character'; +import { LoadingManager } from '../core/LoadingManager'; +import { InfoStack } from '../core/InfoStack'; import { IWorldEntity } from '../interfaces/IWorldEntity'; -import { Sky } from './Sky'; +import { IUpdatable } from '../interfaces/IUpdatable'; +import { Character } from '../characters/Character'; import { Path } from './Path'; -import { LoadingManager } from '../core/LoadingManager'; -import { CannonDebugRenderer } from '../../lib/cannon/CannonDebugRenderer'; import { Vehicle } from '../vehicles/Vehicle'; import { Scenario } from './Scenario'; -import { InfoStack } from '../core/InfoStack'; -import { IUpdatable } from '../interfaces/IUpdatable'; +import { Sky } from './Sky'; export declare class World { renderer: THREE.WebGLRenderer; camera: THREE.PerspectiveCamera; diff --git a/src/img/thumbnail.png b/src/img/thumbnail.png new file mode 100644 index 00000000..74472cef Binary files /dev/null and b/src/img/thumbnail.png differ diff --git a/src/lib/utils/perlin.js b/src/lib/utils/perlin.js deleted file mode 100644 index 01465275..00000000 --- a/src/lib/utils/perlin.js +++ /dev/null @@ -1,311 +0,0 @@ -/* - * A speed-improved perlin and simplex noise algorithms for 2D. - * - * Based on example code by Stefan Gustavson (stegu@itn.liu.se). - * Optimisations by Peter Eastman (peastman@drizzle.stanford.edu). - * Better rank ordering method by Stefan Gustavson in 2012. - * Converted to Javascript by Joseph Gentle. - * - * Version 2012-03-09 - * - * This code was placed in the public domain by its original author, - * Stefan Gustavson. You may use it as you see fit, but - * attribution is appreciated. - * - */ - -export let Noise = function(){ - var module = {}; - - function Grad(x, y, z) { - this.x = x; this.y = y; this.z = z; - } - - Grad.prototype.dot2 = function(x, y) { - return this.x*x + this.y*y; - }; - - Grad.prototype.dot3 = function(x, y, z) { - return this.x*x + this.y*y + this.z*z; - }; - - var grad3 = [new Grad(1,1,0),new Grad(-1,1,0),new Grad(1,-1,0),new Grad(-1,-1,0), - new Grad(1,0,1),new Grad(-1,0,1),new Grad(1,0,-1),new Grad(-1,0,-1), - new Grad(0,1,1),new Grad(0,-1,1),new Grad(0,1,-1),new Grad(0,-1,-1)]; - - var p = [151,160,137,91,90,15, - 131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23, - 190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33, - 88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166, - 77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244, - 102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196, - 135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123, - 5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42, - 223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9, - 129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228, - 251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107, - 49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254, - 138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180]; - // To remove the need for index wrapping, double the permutation table length - var perm = new Array(512); - var gradP = new Array(512); - - // This isn't a very good seeding function, but it works ok. It supports 2^16 - // different seed values. Write something better if you need more seeds. - module.seed = function(seed) { - if(seed > 0 && seed < 1) { - // Scale the seed out - seed *= 65536; - } - - seed = Math.floor(seed); - if(seed < 256) { - seed |= seed << 8; - } - - for(var i = 0; i < 256; i++) { - var v; - if (i & 1) { - v = p[i] ^ (seed & 255); - } else { - v = p[i] ^ ((seed>>8) & 255); - } - - perm[i] = perm[i + 256] = v; - gradP[i] = gradP[i + 256] = grad3[v % 12]; - } - }; - - module.seed(0); - - /* - for(var i=0; i<256; i++) { - perm[i] = perm[i + 256] = p[i]; - gradP[i] = gradP[i + 256] = grad3[perm[i] % 12]; - }*/ - - // Skewing and unskewing factors for 2, 3, and 4 dimensions - var F2 = 0.5*(Math.sqrt(3)-1); - var G2 = (3-Math.sqrt(3))/6; - - var F3 = 1/3; - var G3 = 1/6; - - // 2D simplex noise - module.simplex2 = function(xin, yin) { - var n0, n1, n2; // Noise contributions from the three corners - // Skew the input space to determine which simplex cell we're in - var s = (xin+yin)*F2; // Hairy factor for 2D - var i = Math.floor(xin+s); - var j = Math.floor(yin+s); - var t = (i+j)*G2; - var x0 = xin-i+t; // The x,y distances from the cell origin, unskewed. - var y0 = yin-j+t; - // For the 2D case, the simplex shape is an equilateral triangle. - // Determine which simplex we are in. - var i1, j1; // Offsets for second (middle) corner of simplex in (i,j) coords - if(x0>y0) { // lower triangle, XY order: (0,0)->(1,0)->(1,1) - i1=1; j1=0; - } else { // upper triangle, YX order: (0,0)->(0,1)->(1,1) - i1=0; j1=1; - } - // A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and - // a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where - // c = (3-sqrt(3))/6 - var x1 = x0 - i1 + G2; // Offsets for middle corner in (x,y) unskewed coords - var y1 = y0 - j1 + G2; - var x2 = x0 - 1 + 2 * G2; // Offsets for last corner in (x,y) unskewed coords - var y2 = y0 - 1 + 2 * G2; - // Work out the hashed gradient indices of the three simplex corners - i &= 255; - j &= 255; - var gi0 = gradP[i+perm[j]]; - var gi1 = gradP[i+i1+perm[j+j1]]; - var gi2 = gradP[i+1+perm[j+1]]; - // Calculate the contribution from the three corners - var t0 = 0.5 - x0*x0-y0*y0; - if(t0<0) { - n0 = 0; - } else { - t0 *= t0; - n0 = t0 * t0 * gi0.dot2(x0, y0); // (x,y) of grad3 used for 2D gradient - } - var t1 = 0.5 - x1*x1-y1*y1; - if(t1<0) { - n1 = 0; - } else { - t1 *= t1; - n1 = t1 * t1 * gi1.dot2(x1, y1); - } - var t2 = 0.5 - x2*x2-y2*y2; - if(t2<0) { - n2 = 0; - } else { - t2 *= t2; - n2 = t2 * t2 * gi2.dot2(x2, y2); - } - // Add contributions from each corner to get the final noise value. - // The result is scaled to return values in the interval [-1,1]. - return 70 * (n0 + n1 + n2); - }; - - // 3D simplex noise - module.simplex3 = function(xin, yin, zin) { - var n0, n1, n2, n3; // Noise contributions from the four corners - - // Skew the input space to determine which simplex cell we're in - var s = (xin+yin+zin)*F3; // Hairy factor for 2D - var i = Math.floor(xin+s); - var j = Math.floor(yin+s); - var k = Math.floor(zin+s); - - var t = (i+j+k)*G3; - var x0 = xin-i+t; // The x,y distances from the cell origin, unskewed. - var y0 = yin-j+t; - var z0 = zin-k+t; - - // For the 3D case, the simplex shape is a slightly irregular tetrahedron. - // Determine which simplex we are in. - var i1, j1, k1; // Offsets for second corner of simplex in (i,j,k) coords - var i2, j2, k2; // Offsets for third corner of simplex in (i,j,k) coords - if(x0 >= y0) { - if(y0 >= z0) { i1=1; j1=0; k1=0; i2=1; j2=1; k2=0; } - else if(x0 >= z0) { i1=1; j1=0; k1=0; i2=1; j2=0; k2=1; } - else { i1=0; j1=0; k1=1; i2=1; j2=0; k2=1; } - } else { - if(y0 < z0) { i1=0; j1=0; k1=1; i2=0; j2=1; k2=1; } - else if(x0 < z0) { i1=0; j1=1; k1=0; i2=0; j2=1; k2=1; } - else { i1=0; j1=1; k1=0; i2=1; j2=1; k2=0; } - } - // A step of (1,0,0) in (i,j,k) means a step of (1-c,-c,-c) in (x,y,z), - // a step of (0,1,0) in (i,j,k) means a step of (-c,1-c,-c) in (x,y,z), and - // a step of (0,0,1) in (i,j,k) means a step of (-c,-c,1-c) in (x,y,z), where - // c = 1/6. - var x1 = x0 - i1 + G3; // Offsets for second corner - var y1 = y0 - j1 + G3; - var z1 = z0 - k1 + G3; - - var x2 = x0 - i2 + 2 * G3; // Offsets for third corner - var y2 = y0 - j2 + 2 * G3; - var z2 = z0 - k2 + 2 * G3; - - var x3 = x0 - 1 + 3 * G3; // Offsets for fourth corner - var y3 = y0 - 1 + 3 * G3; - var z3 = z0 - 1 + 3 * G3; - - // Work out the hashed gradient indices of the four simplex corners - i &= 255; - j &= 255; - k &= 255; - var gi0 = gradP[i+ perm[j+ perm[k ]]]; - var gi1 = gradP[i+i1+perm[j+j1+perm[k+k1]]]; - var gi2 = gradP[i+i2+perm[j+j2+perm[k+k2]]]; - var gi3 = gradP[i+ 1+perm[j+ 1+perm[k+ 1]]]; - - // Calculate the contribution from the four corners - var t0 = 0.6 - x0*x0 - y0*y0 - z0*z0; - if(t0<0) { - n0 = 0; - } else { - t0 *= t0; - n0 = t0 * t0 * gi0.dot3(x0, y0, z0); // (x,y) of grad3 used for 2D gradient - } - var t1 = 0.6 - x1*x1 - y1*y1 - z1*z1; - if(t1<0) { - n1 = 0; - } else { - t1 *= t1; - n1 = t1 * t1 * gi1.dot3(x1, y1, z1); - } - var t2 = 0.6 - x2*x2 - y2*y2 - z2*z2; - if(t2<0) { - n2 = 0; - } else { - t2 *= t2; - n2 = t2 * t2 * gi2.dot3(x2, y2, z2); - } - var t3 = 0.6 - x3*x3 - y3*y3 - z3*z3; - if(t3<0) { - n3 = 0; - } else { - t3 *= t3; - n3 = t3 * t3 * gi3.dot3(x3, y3, z3); - } - // Add contributions from each corner to get the final noise value. - // The result is scaled to return values in the interval [-1,1]. - return 32 * (n0 + n1 + n2 + n3); - - }; - - // ##### Perlin noise stuff - - function fade(t) { - return t*t*t*(t*(t*6-15)+10); - } - - function lerp(a, b, t) { - return (1-t)*a + t*b; - } - - // 2D Perlin Noise - module.perlin2 = function(x, y) { - // Find unit grid cell containing point - var X = Math.floor(x), Y = Math.floor(y); - // Get relative xy coordinates of point within that cell - x = x - X; y = y - Y; - // Wrap the integer cells at 255 (smaller integer period can be introduced here) - X = X & 255; Y = Y & 255; - - // Calculate noise contributions from each of the four corners - var n00 = gradP[X+perm[Y]].dot2(x, y); - var n01 = gradP[X+perm[Y+1]].dot2(x, y-1); - var n10 = gradP[X+1+perm[Y]].dot2(x-1, y); - var n11 = gradP[X+1+perm[Y+1]].dot2(x-1, y-1); - - // Compute the fade curve value for x - var u = fade(x); - - // Interpolate the four results - return lerp( - lerp(n00, n10, u), - lerp(n01, n11, u), - fade(y)); - }; - - // 3D Perlin Noise - module.perlin3 = function(x, y, z) { - // Find unit grid cell containing point - var X = Math.floor(x), Y = Math.floor(y), Z = Math.floor(z); - // Get relative xyz coordinates of point within that cell - x = x - X; y = y - Y; z = z - Z; - // Wrap the integer cells at 255 (smaller integer period can be introduced here) - X = X & 255; Y = Y & 255; Z = Z & 255; - - // Calculate noise contributions from each of the eight corners - var n000 = gradP[X+ perm[Y+ perm[Z ]]].dot3(x, y, z); - var n001 = gradP[X+ perm[Y+ perm[Z+1]]].dot3(x, y, z-1); - var n010 = gradP[X+ perm[Y+1+perm[Z ]]].dot3(x, y-1, z); - var n011 = gradP[X+ perm[Y+1+perm[Z+1]]].dot3(x, y-1, z-1); - var n100 = gradP[X+1+perm[Y+ perm[Z ]]].dot3(x-1, y, z); - var n101 = gradP[X+1+perm[Y+ perm[Z+1]]].dot3(x-1, y, z-1); - var n110 = gradP[X+1+perm[Y+1+perm[Z ]]].dot3(x-1, y-1, z); - var n111 = gradP[X+1+perm[Y+1+perm[Z+1]]].dot3(x-1, y-1, z-1); - - // Compute the fade curve value for x, y, z - var u = fade(x); - var v = fade(y); - var w = fade(z); - - // Interpolate - return lerp( - lerp( - lerp(n000, n100, u), - lerp(n001, n101, u), w), - lerp( - lerp(n010, n110, u), - lerp(n011, n111, u), w), - v); - }; - - return module; -}; diff --git a/src/ts/characters/character_ai/FollowPath.ts b/src/ts/characters/character_ai/FollowPath.ts index 1e4b8bc8..b53f534b 100644 --- a/src/ts/characters/character_ai/FollowPath.ts +++ b/src/ts/characters/character_ai/FollowPath.ts @@ -47,9 +47,9 @@ export class FollowPath extends FollowTarget implements ICharacterAI this.character.controlledObject.triggerAction('throttle', false); } - if (speed < 1) this.staleTimer += timeStep; + if (speed < 1 || (this.character.controlledObject as unknown as Vehicle).rayCastVehicle.numWheelsOnGround === 0) this.staleTimer += timeStep; else this.staleTimer = 0; - if (this.staleTimer > 3) + if (this.staleTimer > 5) { let worldPos = new THREE.Vector3(); this.targetNode.object.getWorldPosition(worldPos);