From fc6416bb5ae13f45a88b5e082579f434291ca433 Mon Sep 17 00:00:00 2001 From: Tentone Date: Fri, 26 Apr 2019 11:46:34 +0100 Subject: [PATCH] Clean up --- CHANGELOG.md | 12 +- build/nunu.editor.min.js | 13611 ++++++------ build/nunu.js | 18357 ++++++++-------- build/nunu.min.js | 3662 +-- docs/docs/classes/BloomPass.html | 92 + docs/docs/classes/EffectComposer.html | 28 + docs/docs/classes/SSAONOHPass.html | 30 + docs/docs/classes/SpriteSheetTexture.html | 27 + docs/docs/data.json | 140 +- docs/editor/nunu.editor.min.js | 13611 ++++++------ docs/editor/nunu.min.js | 3662 +-- docs/editor/package.json | 6 +- docs/editor/source/runtime/NunuApp.js | 3 +- npm-shrinkwrap.json | 7610 +++---- package.json | 4 +- source/editor/Editor.js | 2 +- source/editor/gui/tab/ConsoleTab.js | 14 +- .../editor/gui/tab/scene/sidebar/SideBar.js | 4 + 18 files changed, 29802 insertions(+), 31073 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c26887bad..7a6b4656f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,15 +7,17 @@ - CSS 3D renderer support. (IN PROGRESS) - Perspective transformed HTML containers. (IN PROGRESS) - Billboarded HTML containers. (IN PROGRESS) - - Support for extruded or planar Text Mesh. - - Fixed bug with tree overlaping other tabs. - Added bitmap text with support for SDF and MSDF text rendering. (IN PROGRESS) - Added canvas based text with support for CSS styling. (IN PROGRESS) + - Support for extruded or planar Text Mesh. + - Fixed bug with tree overlaping other tabs. - Select multiple tree objects using SHIFT. - Export draco compressed geometries. - - Scene editor toolbar is now attached to the scene editor tab. - - + - Scene editor toolbar is now attached to the scene editor tab. + - Fixed postprocessing pipeline bugs. + - Adaptive luminance pass. + + ## Published ### V0.9.5 Beta - Splitabble tabs in the UI diff --git a/build/nunu.editor.min.js b/build/nunu.editor.min.js index 746f80933..0db21bb97 100644 --- a/build/nunu.editor.min.js +++ b/build/nunu.editor.min.js @@ -1,459 +1,463 @@ -var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||'function'==typeof Object.defineProperties?Object.defineProperty:function(a,b,d){a!=Array.prototype&&a!=Object.prototype&&(a[b]=d.value)};$jscomp.getGlobal=function(a){return'undefined'!=typeof window&&window===a?a:'undefined'!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX='jscomp_symbol_'; +var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||'function'==typeof Object.defineProperties?Object.defineProperty:function(a,b,e){a!=Array.prototype&&a!=Object.prototype&&(a[b]=e.value)};$jscomp.getGlobal=function(a){return'undefined'!=typeof window&&window===a?a:'undefined'!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX='jscomp_symbol_'; $jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.Symbol=function(){var a=0;return function(b){return $jscomp.SYMBOL_PREFIX+(b||'')+a++}}(); $jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.iterator;a||(a=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol('iterator'));'function'!=typeof Array.prototype[a]&&$jscomp.defineProperty(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}}; $jscomp.initSymbolAsyncIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.asyncIterator;a||(a=$jscomp.global.Symbol.asyncIterator=$jscomp.global.Symbol('asyncIterator'));$jscomp.initSymbolAsyncIterator=function(){}};$jscomp.arrayIterator=function(a){var b=0;return $jscomp.iteratorPrototype(function(){return b=h}},'es6','es3');$jscomp.polyfill('Number.EPSILON',function(a){return Math.pow(2,-52)},'es6','es3');$jscomp.polyfill('Number.MAX_SAFE_INTEGER',function(){return 9007199254740991},'es6','es3'); -$jscomp.polyfill('Math.sign',function(a){return a?a:function(a){a=Number(a);return 0===a||isNaN(a)?a:0a||1342177279>>=1)b+=b;return c}},'es6','es3');$jscomp.polyfill('Number.isFinite',function(a){return a?a:function(a){return'number'!==typeof a?!1:!isNaN(a)&&Infinity!==a&&-Infinity!==a}},'es6','es3'); -$jscomp.polyfill('Number.isInteger',function(a){return a?a:function(a){return Number.isFinite(a)?a===Math.floor(a):!1}},'es6','es3');$jscomp.polyfill('Array.prototype.fill',function(a){return a?a:function(a,d,c){var b=this.length||0;0>d&&(d=Math.max(0,b+d));if(null==c||c>b)c=b;c=Number(c);0>c&&(c=Math.max(0,b+c));for(d=Number(d||0);d=g}},'es6','es3');$jscomp.FORCE_POLYFILL_PROMISE=!1; -$jscomp.polyfill('Promise',function(a){function b(){this.batch_=null}function d(a){return a instanceof g?a:new g(function(b,c){b(a)})}if(a&&!$jscomp.FORCE_POLYFILL_PROMISE)return a;b.prototype.asyncExecute=function(a){null==this.batch_&&(this.batch_=[],this.asyncExecuteBatch_());this.batch_.push(a);return this};b.prototype.asyncExecuteBatch_=function(){var a=this;this.asyncExecuteFunction(function(){a.executeBatch_()})};var c=$jscomp.global.setTimeout;b.prototype.asyncExecuteFunction=function(a){c(a, -0)};b.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=this.batch_;this.batch_=[];for(var b=0;bd&&(d=Math.max(d+g,0));d>>16&65535)*g+b*(d>>>16&65535)<<16>>>0)|0}},'es6','es3'); +$jscomp.iteratorPrototype=function(a){$jscomp.initSymbolIterator();a={next:a};a[$jscomp.global.Symbol.iterator]=function(){return this};return a};$jscomp.owns=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};$jscomp.assign='function'==typeof Object.assign?Object.assign:function(a,b){for(var e=1;ea||1342177279>>=1)b+=b;return d}},'es6','es3');$jscomp.checkEs6ConformanceViaProxy=function(){try{var a={},b=Object.create(new $jscomp.global.Proxy(a,{get:function(e,d,c){return e==a&&'q'==d&&c==b}}));return!0===b.q}catch(e){return!1}};$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS=!1; +$jscomp.ES6_CONFORMANCE=$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS&&$jscomp.checkEs6ConformanceViaProxy();$jscomp.makeIterator=function(a){$jscomp.initSymbolIterator();var b=a[Symbol.iterator];return b?b.call(a):$jscomp.arrayIterator(a)}; +$jscomp.polyfill('WeakMap',function(a){function b(){if(!a||!Object.seal)return!1;try{var b=Object.seal({}),c=Object.seal({}),d=new a([[b,2],[c,3]]);if(2!=d.get(b)||3!=d.get(c))return!1;d.delete(b);d.set(c,4);return!d.has(b)&&4==d.get(c)}catch(m){return!1}}function e(a){$jscomp.owns(a,c)||$jscomp.defineProperty(a,c,{value:{}})}function d(a){var b=Object[a];b&&(Object[a]=function(a){e(a);return b(a)})}if($jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS){if(a&&$jscomp.ES6_CONFORMANCE)return a}else if(b())return a; +var c='$jscomp_hidden_'+Math.random();d('freeze');d('preventExtensions');d('seal');var k=0,h=function(a){this.id_=(k+=Math.random()+1).toString();if(a){$jscomp.initSymbol();$jscomp.initSymbolIterator();a=$jscomp.makeIterator(a);for(var b;!(b=a.next()).done;)b=b.value,this.set(b[0],b[1])}};h.prototype.set=function(a,b){e(a);if(!$jscomp.owns(a,c))throw Error('WeakMap key fail: '+a);a[c][this.id_]=b;return this};h.prototype.get=function(a){return $jscomp.owns(a,c)?a[c][this.id_]:void 0};h.prototype.has= +function(a){return $jscomp.owns(a,c)&&$jscomp.owns(a[c],this.id_)};h.prototype.delete=function(a){return $jscomp.owns(a,c)&&$jscomp.owns(a[c],this.id_)?delete a[c][this.id_]:!1};return h},'es6','es3');$jscomp.iteratorFromArray=function(a,b){$jscomp.initSymbolIterator();a instanceof String&&(a+='');var e=0,d={next:function(){if(e=k}},'es6','es3'); +$jscomp.polyfill('Math.sign',function(a){return a?a:function(a){a=Number(a);return 0===a||isNaN(a)?a:0e&&(e=Math.max(0,b+e));if(null==d||d>b)d=b;d=Number(d);0>d&&(d=Math.max(0,b+d));for(e=Number(e||0);e=c}},'es6','es3');$jscomp.FORCE_POLYFILL_PROMISE=!1; +$jscomp.polyfill('Promise',function(a){function b(){this.batch_=null}function e(a){return a instanceof c?a:new c(function(b,c){b(a)})}if(a&&!$jscomp.FORCE_POLYFILL_PROMISE)return a;b.prototype.asyncExecute=function(a){null==this.batch_&&(this.batch_=[],this.asyncExecuteBatch_());this.batch_.push(a);return this};b.prototype.asyncExecuteBatch_=function(){var a=this;this.asyncExecuteFunction(function(){a.executeBatch_()})};var d=$jscomp.global.setTimeout;b.prototype.asyncExecuteFunction=function(a){d(a, +0)};b.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=this.batch_;this.batch_=[];for(var b=0;be&&(e=Math.max(e+c,0));e>>16&65535)*c+b*(e>>>16&65535)<<16>>>0)|0}},'es6','es3'); $jscomp.polyfill('Math.clz32',function(a){return a?a:function(a){a=Number(a)>>>0;if(0===a)return 32;var b=0;0===(a&4294901760)&&(a<<=16,b+=16);0===(a&4278190080)&&(a<<=8,b+=8);0===(a&4026531840)&&(a<<=4,b+=4);0===(a&3221225472)&&(a<<=2,b+=2);0===(a&2147483648)&&b++;return b}},'es6','es3');$jscomp.polyfill('Math.trunc',function(a){return a?a:function(a){a=Number(a);if(isNaN(a)||Infinity===a||-Infinity===a||0===a)return a;var b=Math.floor(Math.abs(a));return 0>a?-b:b}},'es6','es3'); $jscomp.polyfill('Number.parseFloat',function(a){return a||parseFloat},'es6','es3');function Editor(){} -(function(a,b){'object'===typeof exports&&'undefined'!==typeof module?b(exports):'function'===typeof define&&define.amd?define(['exports'],b):(a=a||self,b(a.THREE={}))})(this,function(a){function b(){}function d(a,b){this.x=a||0;this.y=b||0}function c(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];0b&&(b=a[B]);return b}function ea(){Object.defineProperty(this,'id',{value:Hd+=2});this.uuid=ac.generateUUID();this.name='';this.type='BufferGeometry';this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity};this.userData= -{}}function qa(a,b,e,c,d,g){Q.call(this);this.type='BoxGeometry';this.parameters={width:a,height:b,depth:e,widthSegments:c,heightSegments:d,depthSegments:g};this.fromBufferGeometry(new oa(a,b,e,c,d,g));this.mergeVertices()}function oa(a,b,e,c,d,g){function B(a,b,B,e,c,d,g,r,u,t,v){var Ta=d/u,w=g/t,D=d/2,H=g/2,z=r/2;g=u+1;var C=t+1,Xd=d=0,K,G,U=new h;for(G=0;Gn;n++){if(m=e[n])if(h=m[0],k=m[1]){l&&c.addAttribute('morphTarget'+ -n,l[h]);d&&c.addAttribute('morphNormal'+n,d[h]);B[n]=k;continue}B[n]=0}g.getUniforms().setValue(a,'morphTargetInfluences',B)}}}function Ub(a,b){var B={};return{update:function(e){var c=b.render.frame,d=e.geometry,g=a.get(e,d);B[g.id]!==c&&(d.isGeometry&&g.updateFromObject(e),a.update(g),B[g.id]=c);return g},dispose:function(){B={}}}}function Ya(a,b,e,c,d,g,h,k,n,m){a=void 0!==a?a:[];l.call(this,a,void 0!==b?b:301,e,c,d,g,void 0!==h?h:1022,k,n,m);this.flipY=!1}function qb(a,b,e,c){l.call(this,null); -this.image={data:a,width:b,height:e,depth:c};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1}function Gb(a,b,e,c){l.call(this,null);this.image={data:a,width:b,height:e,depth:c};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1}function Qb(a,b,e){var B=a[0];if(0>=B||0/gm,function(a,b){a=Hb[b];if(void 0===a)throw Error('Can not resolve #include <'+b+'>');return fe(a)})}function nf(a){return a.replace(/#pragma unroll_loop[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\S]+?)(?=\})\}/g, -function(a,b,e,B){a='';for(b=parseInt(b);bb&&(b=a[B]);return b}function fa(){Object.defineProperty(this,'id',{value:Zg+=2});this.uuid=cb.generateUUID();this.name='';this.type='BufferGeometry';this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity};this.userData= +{}}function oa(a,b,g,c,d,e){M.call(this);this.type='BoxGeometry';this.parameters={width:a,height:b,depth:g,widthSegments:c,heightSegments:d,depthSegments:e};this.fromBufferGeometry(new ma(a,b,g,c,d,e));this.mergeVertices()}function ma(a,b,g,d,e,h){function B(a,b,B,g,d,e,h,r,t,u,z){var fb=e/t,v=h/u,w=e/2,E=h/2,C=r/2;h=t+1;var Pa=u+1,ec=e=0,D,Hc,K=new c;for(Hc=0;Hcp;p++){if(m=g[p])if(h=m[0],k=m[1]){l&&c.addAttribute('morphTarget'+ +p,l[h]);d&&c.addAttribute('morphNormal'+p,d[h]);B[p]=k;continue}B[p]=0}e.getUniforms().setValue(a,'morphTargetInfluences',B)}}}function oc(a,b){var B={};return{update:function(g){var c=b.render.frame,d=g.geometry,e=a.get(g,d);B[e.id]!==c&&(d.isGeometry&&e.updateFromObject(g),a.update(e),B[e.id]=c);return e},dispose:function(){B={}}}}function Na(a,b,g,c,d,e,k,p,l,m){a=void 0!==a?a:[];h.call(this,a,void 0!==b?b:301,g,c,d,e,void 0!==k?k:1022,p,l,m);this.flipY=!1}function rb(a,b,g,c){h.call(this,null); +this.image={data:a,width:b,height:g,depth:c};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1}function lc(a,b,g,c){h.call(this,null);this.image={data:a,width:b,height:g,depth:c};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1}function vb(a,b,g){var B=a[0];if(0>=B||0/gm,function(a,b){a=Lb[b];if(void 0===a)throw Error('Can not resolve #include <'+b+'>');return we(a)})}function Xa(a){return a.replace(/#pragma unroll_loop[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\S]+?)(?=\})\}/g, +function(a,b,B,g){a='';for(b=parseInt(b);bc||a.height>c)d=c/Math.max(a.width,a.height);if(1>d||!0===b){if('undefined'!==typeof HTMLImageElement&&a instanceof HTMLImageElement||'undefined'!==typeof HTMLCanvasElement&&a instanceof HTMLCanvasElement||'undefined'!==typeof ImageBitmap&& -a instanceof ImageBitmap)return c=b?ac.floorPowerOfTwo:Math.floor,b=c(d*a.width),d=c(d*a.height),void 0===C&&(C=B(b,d)),e=e?B(b,d):C,e.width=b,e.height=d,e.getContext('2d').drawImage(a,0,0,b,d),console.warn('THREE.WebGLRenderer: Texture has been resized from ('+a.width+'x'+a.height+') to ('+b+'x'+d+').'),e;'data'in a&&console.warn('THREE.WebGLRenderer: Image in DataTexture is too big ('+a.width+'x'+a.height+').')}return a}function n(a){return ac.isPowerOfTwo(a.width)&&ac.isPowerOfTwo(a.height)}function l(a, -b){return a.generateMipmaps&&b&&1003!==a.minFilter&&1006!==a.minFilter}function m(b,e,B,d){a.generateMipmap(b);c.get(e).__maxMipLevel=Math.log(Math.max(B,d))*Math.LOG2E}function p(a,e){if(!d.isWebGL2)return a;var B=a;6403===a&&(5126===e&&(B=33326),5131===e&&(B=33325),5121===e&&(B=33321));6407===a&&(5126===e&&(B=34837),5131===e&&(B=34843),5121===e&&(B=32849));6408===a&&(5126===e&&(B=34836),5131===e&&(B=34842),5121===e&&(B=32856));33325===B||33326===B||34842===B||34836===B?b.get('EXT_color_buffer_float'): -(34843===B||34837===B)&&console.warn('THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead.');return B}function q(a){return 1003===a||1004===a||1005===a?9728:9729}function r(b){b=b.target;b.removeEventListener('dispose',r);var e=c.get(b);void 0!==e.__webglInit&&(a.deleteTexture(e.__webglTexture),c.remove(b));b.isVideoTexture&&delete H[b.id];h.memory.textures--}function u(b){b=b.target;b.removeEventListener('dispose',u);var e=c.get(b),B=c.get(b.texture); -if(b){void 0!==B.__webglTexture&&a.deleteTexture(B.__webglTexture);b.depthTexture&&b.depthTexture.dispose();if(b.isWebGLRenderTargetCube)for(B=0;6>B;B++)a.deleteFramebuffer(e.__webglFramebuffer[B]),e.__webglDepthbuffer&&a.deleteRenderbuffer(e.__webglDepthbuffer[B]);else a.deleteFramebuffer(e.__webglFramebuffer),e.__webglDepthbuffer&&a.deleteRenderbuffer(e.__webglDepthbuffer);c.remove(b.texture);c.remove(b)}h.memory.textures--}function Aa(a,b){var B=c.get(a);if(a.isVideoTexture){var d=a.id,g=h.render.frame; -H[d]!==g&&(H[d]=g,a.update())}if(0u;u++)r[u]=B||q?q?b.image[u].image:b.image[u]:k(b.image[u],!1,!0,d.maxCubemapSize);var Aa=r[0],w=n(Aa)||d.isWebGL2,Ta=g.convert(b.format),Na=g.convert(b.type),D=p(Ta,Na);t(34067,b,w);for(u=0;6>u;u++)if(B)for(var z,H=r[u].mipmaps,C=0,Xd=H.length;Cr;r++)B.__webglFramebuffer[r]=a.createFramebuffer();else if(B.__webglFramebuffer=a.createFramebuffer(), -r)if(d.isWebGL2){B.__webglMultisampledFramebuffer=a.createFramebuffer();B.__webglColorRenderbuffer=a.createRenderbuffer();a.bindRenderbuffer(36161,B.__webglColorRenderbuffer);r=g.convert(b.texture.format);var w=g.convert(b.texture.type);r=p(r,w);w=z(b);a.renderbufferStorageMultisample(36161,w,r,b.width,b.height);a.bindFramebuffer(36160,B.__webglMultisampledFramebuffer);a.framebufferRenderbuffer(36160,36064,36161,B.__webglColorRenderbuffer);a.bindRenderbuffer(36161,null);b.depthBuffer&&(B.__webglDepthRenderbuffer= -a.createRenderbuffer(),D(B.__webglDepthRenderbuffer,b,!0));a.bindFramebuffer(36160,null)}else console.warn('THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.');if(q){e.bindTexture(34067,k.__webglTexture);t(34067,b.texture,v);for(r=0;6>r;r++)Ta(B.__webglFramebuffer[r],b,36064,34069+r);l(b.texture,v)&&m(34067,b.texture,b.width,b.height);e.bindTexture(34067,null)}else e.bindTexture(3553,k.__webglTexture),t(3553,b.texture,v),Ta(B.__webglFramebuffer,b,36064,3553),l(b.texture, -v)&&m(3553,b.texture,b.width,b.height),e.bindTexture(3553,null);if(b.depthBuffer){B=c.get(b);k=!0===b.isWebGLRenderTargetCube;if(b.depthTexture){if(k)throw Error('target.depthTexture not supported in Cube render targets');if(b&&b.isWebGLRenderTargetCube)throw Error('Depth Texture with cube render targets is not supported');a.bindFramebuffer(36160,B.__webglFramebuffer);if(!b.depthTexture||!b.depthTexture.isDepthTexture)throw Error('renderTarget.depthTexture must be an instance of THREE.DepthTexture'); -c.get(b.depthTexture).__webglTexture&&b.depthTexture.image.width===b.width&&b.depthTexture.image.height===b.height||(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0);Aa(b.depthTexture,0);B=c.get(b.depthTexture).__webglTexture;if(1026===b.depthTexture.format)a.framebufferTexture2D(36160,36096,3553,B,0);else if(1027===b.depthTexture.format)a.framebufferTexture2D(36160,33306,3553,B,0);else throw Error('Unknown depthTexture format');}else if(k)for(B.__webglDepthbuffer= -[],k=0;6>k;k++)a.bindFramebuffer(36160,B.__webglFramebuffer[k]),B.__webglDepthbuffer[k]=a.createRenderbuffer(),D(B.__webglDepthbuffer[k],b);else a.bindFramebuffer(36160,B.__webglFramebuffer),B.__webglDepthbuffer=a.createRenderbuffer(),D(B.__webglDepthbuffer,b);a.bindFramebuffer(36160,null)}};this.updateRenderTargetMipmap=function(a){var b=a.texture,B=n(a)||d.isWebGL2;if(l(b,B)){B=a.isWebGLRenderTargetCube?34067:3553;var g=c.get(b).__webglTexture;e.bindTexture(B,g);m(B,b,a.width,a.height);e.bindTexture(B, -null)}};this.updateMultisampleRenderTarget=function(b){if(b.isWebGLMultisampleRenderTarget)if(d.isWebGL2){var e=c.get(b);a.bindFramebuffer(36008,e.__webglMultisampledFramebuffer);a.bindFramebuffer(36009,e.__webglFramebuffer);e=b.width;var B=b.height,g=16384;b.depthBuffer&&(g|=256);b.stencilBuffer&&(g|=1024);a.blitFramebuffer(0,0,e,B,0,0,e,B,g,9728)}else console.warn('THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.')}}function tg(a,b,e){return{convert:function(a){if(1E3=== -a)return 10497;if(1001===a)return 33071;if(1002===a)return 33648;if(1003===a)return 9728;if(1004===a)return 9984;if(1005===a)return 9986;if(1006===a)return 9729;if(1007===a)return 9985;if(1008===a)return 9987;if(1009===a)return 5121;if(1017===a)return 32819;if(1018===a)return 32820;if(1019===a)return 33635;if(1010===a)return 5120;if(1011===a)return 5122;if(1012===a)return 5123;if(1013===a)return 5124;if(1014===a)return 5125;if(1015===a)return 5126;if(1016===a){if(e.isWebGL2)return 5131;var B=b.get('OES_texture_half_float'); -if(null!==B)return B.HALF_FLOAT_OES}if(1021===a)return 6406;if(1022===a)return 6407;if(1023===a)return 6408;if(1024===a)return 6409;if(1025===a)return 6410;if(1026===a)return 6402;if(1027===a)return 34041;if(1028===a)return 6403;if(100===a)return 32774;if(101===a)return 32778;if(102===a)return 32779;if(200===a)return 0;if(201===a)return 1;if(202===a)return 768;if(203===a)return 769;if(204===a)return 770;if(205===a)return 771;if(206===a)return 772;if(207===a)return 773;if(208===a)return 774;if(209=== -a)return 775;if(210===a)return 776;if(33776===a||33777===a||33778===a||33779===a)if(B=b.get('WEBGL_compressed_texture_s3tc'),null!==B){if(33776===a)return B.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===a)return B.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===a)return B.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===a)return B.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===a||35841===a||35842===a||35843===a)if(B=b.get('WEBGL_compressed_texture_pvrtc'),null!==B){if(35840===a)return B.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841=== -a)return B.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===a)return B.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===a)return B.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===a&&(B=b.get('WEBGL_compressed_texture_etc1'),null!==B))return B.COMPRESSED_RGB_ETC1_WEBGL;if(37808===a||37809===a||37810===a||37811===a||37812===a||37813===a||37814===a||37815===a||37816===a||37817===a||37818===a||37819===a||37820===a||37821===a)if(B=b.get('WEBGL_compressed_texture_astc'),null!==B)return a;if(103===a||104===a){if(e.isWebGL2){if(103=== -a)return 32775;if(104===a)return 32776}B=b.get('EXT_blend_minmax');if(null!==B){if(103===a)return B.MIN_EXT;if(104===a)return B.MAX_EXT}}if(1020===a){if(e.isWebGL2)return 34042;B=b.get('WEBGL_depth_texture');if(null!==B)return B.UNSIGNED_INT_24_8_WEBGL}return 0}}}function uc(){P.call(this);this.type='Group'}function Rc(){P.call(this);this.type='Camera';this.matrixWorldInverse=new c;this.projectionMatrix=new c;this.projectionMatrixInverse=new c}function Zd(a,b,e,c){Rc.call(this);this.type='PerspectiveCamera'; -this.fov=void 0!==a?a:50;this.zoom=1;this.near=void 0!==e?e:.1;this.far=void 0!==c?c:2E3;this.focus=10;this.aspect=void 0!==b?b:1;this.view=null;this.filmGauge=35;this.filmOffset=0;this.updateProjectionMatrix()}function ef(a){Zd.call(this);this.cameras=a||[]}function Hg(a,b,e){sb.setFromMatrixPosition(b.matrixWorld);Wa.setFromMatrixPosition(e.matrixWorld);var B=sb.distanceTo(Wa),c=b.projectionMatrix.elements,d=e.projectionMatrix.elements,g=c[14]/(c[10]-1);e=c[14]/(c[10]+1);var h=(c[9]+1)/c[5],k=(c[9]- -1)/c[5],n=(c[8]-1)/c[0],l=(d[8]+1)/d[0];c=g*n;d=g*l;l=B/(-n+l);n=l*-n;b.matrixWorld.decompose(a.position,a.quaternion,a.scale);a.translateX(n);a.translateZ(l);a.matrixWorld.compose(a.position,a.quaternion,a.scale);a.matrixWorldInverse.getInverse(a.matrixWorld);b=g+l;g=e+l;a.projectionMatrix.makePerspective(c-n,d+(B-n),h*e/g*b,k*e/g*b,b,g)}function oe(a){function b(){return null!==k&&!0===k.isPresenting}function e(){if(b()){var e=k.getEyeParameters('left'),c=e.renderWidth*u;e=e.renderHeight*u;U=a.getPixelRatio(); -a.getSize(K);a.setDrawingBufferSize(2*c,e,1);P.start()}else B.enabled&&a.setDrawingBufferSize(K.width,K.height,U),P.stop()}var B=this,k=null,n=null,l=null,p=[],q=new c,r=new c,u=1,t='stage';'undefined'!==typeof window&&'VRFrameData'in window&&(n=new window.VRFrameData,window.addEventListener('vrdisplaypresentchange',e,!1));var v=new c,w=new g,D=new h,z=new Zd;z.bounds=new m(0,0,.5,1);z.layers.enable(1);var H=new Zd;H.bounds=new m(.5,0,.5,1);H.layers.enable(2);var C=new ef([z,H]);C.layers.enable(1); -C.layers.enable(2);var K=new d,U,I=[];this.enabled=!1;this.getController=function(a){var b=p[a];void 0===b&&(b=new uc,b.matrixAutoUpdate=!1,b.visible=!1,p[a]=b);return b};this.getDevice=function(){return k};this.setDevice=function(a){void 0!==a&&(k=a);P.setContext(a)};this.setFramebufferScaleFactor=function(a){u=a};this.setFrameOfReferenceType=function(a){t=a};this.setPoseTarget=function(a){void 0!==a&&(l=a)};this.getCamera=function(a){var e='stage'===t?1.6:0;if(!1===b())return a.position.set(0,e, -0),a.rotation.set(0,0,0),a;k.depthNear=a.near;k.depthFar=a.far;k.getFrameData(n);if('stage'===t){var B=k.stageParameters;B?q.fromArray(B.sittingToStandingTransform):q.makeTranslation(0,e,0)}e=n.pose;B=null!==l?l:a;B.matrix.copy(q);B.matrix.decompose(B.position,B.quaternion,B.scale);null!==e.orientation&&(w.fromArray(e.orientation),B.quaternion.multiply(w));null!==e.position&&(w.setFromRotationMatrix(q),D.fromArray(e.position),D.applyQuaternion(w),B.position.add(D));B.updateMatrixWorld();z.near=a.near; -H.near=a.near;z.far=a.far;H.far=a.far;z.matrixWorldInverse.fromArray(n.leftViewMatrix);H.matrixWorldInverse.fromArray(n.rightViewMatrix);r.getInverse(q);'stage'===t&&(z.matrixWorldInverse.multiply(r),H.matrixWorldInverse.multiply(r));a=B.parent;null!==a&&(v.getInverse(a.matrixWorld),z.matrixWorldInverse.multiply(v),H.matrixWorldInverse.multiply(v));z.matrixWorld.getInverse(z.matrixWorldInverse);H.matrixWorld.getInverse(H.matrixWorldInverse);z.projectionMatrix.fromArray(n.leftProjectionMatrix);H.projectionMatrix.fromArray(n.rightProjectionMatrix); -Hg(C,z,H);a=k.getLayers();a.length&&(a=a[0],null!==a.leftBounds&&4===a.leftBounds.length&&z.bounds.fromArray(a.leftBounds),null!==a.rightBounds&&4===a.rightBounds.length&&H.bounds.fromArray(a.rightBounds));a=0;a:for(;ac.matrixWorld.determinant();Db.setMaterial(B,g);var h=v(a,b,B,c),k=!1;if(C!==e.id||Rd!==h.id||ea!==(!0===B.wireframe))C=e.id,Rd=h.id,ea=!0===B.wireframe,k=!0;c.morphTargetInfluences&&(zd.update(c,e,B,h),k=!0);g=e.index;var n=e.attributes.position;b=1;!0===B.wireframe&&(g=ya.getWireframeAttribute(e),b=2);a=Ma;if(null!==g){var m=ra.get(g);a=db;a.setIndex(m)}if(k){if(e&&e.isInstancedBufferGeometry&&!va.isWebGL2&&null===Ba.get('ANGLE_instanced_arrays'))console.error('THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.'); -else{Db.initAttributes();k=e.attributes;h=h.getAttributes();var l=B.defaultAttributeValues;for(D in h){var p=h[D];if(0<=p){var q=k[D];if(void 0!==q){var r=q.normalized,u=q.itemSize,Aa=ra.get(q);if(void 0!==Aa){var t=Aa.buffer,Na=Aa.type;Aa=Aa.bytesPerElement;if(q.isInterleavedBufferAttribute){var w=q.data,z=w.stride;q=q.offset;w&&w.isInstancedInterleavedBuffer?(Db.enableAttributeAndDivisor(p,w.meshPerAttribute),void 0===e.maxInstancedCount&&(e.maxInstancedCount=w.meshPerAttribute*w.count)):Db.enableAttribute(p); -ka.bindBuffer(34962,t);ka.vertexAttribPointer(p,u,Na,r,z*Aa,q*Aa)}else q.isInstancedBufferAttribute?(Db.enableAttributeAndDivisor(p,q.meshPerAttribute),void 0===e.maxInstancedCount&&(e.maxInstancedCount=q.meshPerAttribute*q.count)):Db.enableAttribute(p),ka.bindBuffer(34962,t),ka.vertexAttribPointer(p,u,Na,r,0,0)}}else if(void 0!==l&&(r=l[D],void 0!==r))switch(r.length){case 2:ka.vertexAttrib2fv(p,r);break;case 3:ka.vertexAttrib3fv(p,r);break;case 4:ka.vertexAttrib4fv(p,r);break;default:ka.vertexAttrib1fv(p, -r)}}}Db.disableUnusedAttributes()}null!==g&&ka.bindBuffer(34963,m.buffer)}m=Infinity;null!==g?m=g.count:void 0!==n&&(m=n.count);g=e.drawRange.start*b;n=null!==d?d.start*b:0;var D=Math.max(g,n);d=Math.max(0,Math.min(m,g+e.drawRange.count*b,n+(null!==d?d.count*b:Infinity))-1-D+1);if(0!==d){if(c.isMesh)if(!0===B.wireframe)Db.setLineWidth(B.wireframeLinewidth*(null===ma?qa:1)),a.setMode(1);else switch(c.drawMode){case 0:a.setMode(4);break;case 1:a.setMode(5);break;case 2:a.setMode(6)}else c.isLine?(B= -B.linewidth,void 0===B&&(B=1),Db.setLineWidth(B*(null===ma?qa:1)),c.isLineSegments?a.setMode(1):c.isLineLoop?a.setMode(2):a.setMode(3)):c.isPoints?a.setMode(0):c.isSprite&&a.setMode(4);e&&e.isInstancedBufferGeometry?0=va.maxTextures&&console.warn('THREE.WebGLRenderer: Trying to use '+a+' texture units while this GPU supports only '+va.maxTextures);mc+=1;return a};this.setTexture2D=function(){var a=!1;return function(b,e){b&&b.isWebGLRenderTarget&&(a||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."), -a=!0),b=b.texture);sb.setTexture2D(b,e)}}();this.setTexture2DArray=function(a,b){sb.setTexture2DArray(a,b)};this.setTexture3D=function(a,b){sb.setTexture3D(a,b)};this.setTexture=function(){var a=!1;return function(b,e){a||(console.warn('THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead.'),a=!0);sb.setTexture2D(b,e)}}();this.setTextureCube=function(){var a=!1;return function(b,e){b&&b.isWebGLRenderTargetCube&&(a||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."), -a=!0),b=b.texture);b&&b.isCubeTexture||Array.isArray(b.image)&&6===b.image.length?sb.setTextureCube(b,e):sb.setTextureCubeDynamic(b,e)}}();this.setFramebuffer=function(a){ba=a};this.getRenderTarget=function(){return ma};this.setRenderTarget=function(a,b,e){(ma=a)&&void 0===gb.get(a).__webglFramebuffer&&sb.setupRenderTarget(a);var B=ba,c=!1;a?(B=gb.get(a).__webglFramebuffer,a.isWebGLRenderTargetCube?(B=B[b||0],c=!0):B=a.isWebGLMultisampleRenderTarget?gb.get(a).__webglMultisampledFramebuffer:B,bd.copy(a.viewport), -ud.copy(a.scissor),ik=a.scissorTest):(bd.copy(fe).multiplyScalar(qa),ud.copy(Z).multiplyScalar(qa),ik=W);O!==B&&(ka.bindFramebuffer(36160,B),O=B);Db.viewport(bd);Db.scissor(ud);Db.setScissorTest(ik);c&&(a=gb.get(a.texture),ka.framebufferTexture2D(36160,36064,34069+(b||0),a.__webglTexture,e||0))};this.readRenderTargetPixels=function(a,b,e,B,c,d){if(a&&a.isWebGLRenderTarget){var g=gb.get(a).__webglFramebuffer;if(g){var h=!1;g!==O&&(ka.bindFramebuffer(36160,g),h=!0);try{var k=a.texture,n=k.format,m= -k.type;1023!==n&&Oa.convert(n)!==ka.getParameter(35739)?console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.'):1009===m||Oa.convert(m)===ka.getParameter(35738)||1015===m&&(va.isWebGL2||Ba.get('OES_texture_float')||Ba.get('WEBGL_color_buffer_float'))||1016===m&&(va.isWebGL2?Ba.get('EXT_color_buffer_float'):Ba.get('EXT_color_buffer_half_float'))?36053===ka.checkFramebufferStatus(36160)?0<=b&&b<=a.width-B&&0<=e&&e<=a.height-c&&ka.readPixels(b, -e,B,c,Oa.convert(n),Oa.convert(m),d):console.error('THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.'):console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.')}finally{h&&ka.bindFramebuffer(36160,O)}}}else console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.')};this.copyFramebufferToTexture=function(a,b,e){var B=b.image.width, -c=b.image.height,d=Oa.convert(b.format);this.setTexture2D(b,0);ka.copyTexImage2D(3553,e||0,d,a.x,a.y,B,c,0)};this.copyTextureToTexture=function(a,b,e,B){var c=b.image.width,d=b.image.height,g=Oa.convert(e.format),h=Oa.convert(e.type);this.setTexture2D(e,0);b.isDataTexture?ka.texSubImage2D(3553,B||0,a.x,a.y,c,d,g,h,b.image.data):ka.texSubImage2D(3553,B||0,a.x,a.y,g,h,b.image)}}function bg(a,b){this.name='';this.color=new z(a);this.density=void 0!==b?b:2.5E-4}function Me(a,b,e){this.name='';this.color= -new z(a);this.near=void 0!==b?b:1;this.far=void 0!==e?e:1E3}function Ug(){P.call(this);this.type='Scene';this.overrideMaterial=this.fog=this.background=null;this.autoUpdate=!0}function $d(a,b){this.array=a;this.stride=b;this.count=void 0!==a?a.length/b:0;this.dynamic=!1;this.updateRange={offset:0,count:-1};this.version=0}function cg(a,b,e,c){this.data=a;this.itemSize=b;this.offset=e;this.normalized=!0===c}function ff(a){ha.call(this);this.type='SpriteMaterial';this.color=new z(16777215);this.map= -null;this.rotation=0;this.sizeAttenuation=!0;this.lights=!1;this.transparent=!0;this.setValues(a)}function Vg(a){P.call(this);this.type='Sprite';if(void 0===Ca){Ca=new ea;var b=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]);b=new $d(b,5);Ca.setIndex([0,1,2,0,2,3]);Ca.addAttribute('position',new cg(b,3,0,!1));Ca.addAttribute('uv',new cg(b,2,3,!1))}this.geometry=Ca;this.material=void 0!==a?a:new ff;this.center=new d(.5,.5)}function kg(){P.call(this);this.type='LOD';Object.defineProperties(this, -{levels:{enumerable:!0,value:[]}})}function Ee(a,b){a&&a.isGeometry&&console.error('THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.');U.call(this,a,b);this.type='SkinnedMesh';this.bindMode='attached';this.bindMatrix=new c;this.bindMatrixInverse=new c}function Re(a,b){a=a||[];this.bones=a.slice(0);this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===b)this.calculateInverses();else if(this.bones.length===b.length)this.boneInverses=b.slice(0);else for(console.warn('THREE.Skeleton boneInverses is the wrong length.'), -this.boneInverses=[],a=0,b=this.bones.length;ae;e++){var p=l[k[e]],q=l[k[(e+1)%3]];d[0]=Math.min(p,q);d[1]=Math.max(p,q);p=d[0]+','+d[1]; -void 0===g[p]&&(g[p]={index1:d[0],index2:d[1]})}}for(p in g)m=g[p],k=a.vertices[m.index1],b.push(k.x,k.y,k.z),k=a.vertices[m.index2],b.push(k.x,k.y,k.z)}else if(a&&a.isBufferGeometry)if(k=new h,null!==a.index){n=a.attributes.position;l=a.index;var r=a.groups;0===r.length&&(r=[{start:0,count:l.count,materialIndex:0}]);a=0;for(c=r.length;ae;e++)p=l.getX(m+e),q=l.getX(m+(e+1)%3),d[0]=Math.min(p,q),d[1]=Math.max(p,q),p=d[0]+','+d[1],void 0=== -g[p]&&(g[p]={index1:d[0],index2:d[1]});for(p in g)m=g[p],k.fromBufferAttribute(n,m.index1),b.push(k.x,k.y,k.z),k.fromBufferAttribute(n,m.index2),b.push(k.x,k.y,k.z)}else for(n=a.attributes.position,m=0,B=n.count/3;me;e++)g=3*m+e,k.fromBufferAttribute(n,g),b.push(k.x,k.y,k.z),g=3*m+(e+1)%3,k.fromBufferAttribute(n,g),b.push(k.x,k.y,k.z);this.addAttribute('position',new ba(b,3))}function Ng(a,b,e){Q.call(this);this.type='ParametricGeometry';this.parameters={func:a,slices:b,stacks:e}; -this.fromBufferGeometry(new vg(a,b,e));this.mergeVertices()}function vg(a,b,e){ea.call(this);this.type='ParametricBufferGeometry';this.parameters={func:a,slices:b,stacks:e};var B=[],c=[],d=[],g=[],k=new h,n=new h,m=new h,l=new h,p=new h,q,r;3>a.length&&console.error('THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.');var u=b+1;for(q=0;q<=e;q++){var Aa=q/e;for(r=0;r<=b;r++){var t=r/b;a(t,Aa,n);c.push(n.x,n.y,n.z);0<=t-1E-5?(a(t-1E-5,Aa,m),l.subVectors(n,m)):(a(t+1E-5, -Aa,m),l.subVectors(m,n));0<=Aa-1E-5?(a(t,Aa-1E-5,m),p.subVectors(n,m)):(a(t,Aa+1E-5,m),p.subVectors(m,n));k.crossVectors(l,p).normalize();d.push(k.x,k.y,k.z);g.push(t,Aa)}}for(q=0;qB&&1===a.x&&(m[b]=a.x-1);0===e.x&&0===e.z&&(m[b]=B/2/Math.PI+.5)}ea.call(this);this.type='PolyhedronBufferGeometry';this.parameters={vertices:a,indices:b,radius:e,detail:c};e=e||1;c=c||0;var n=[],m=[];(function(a){for(var e=new h,c=new h,d=new h,k=0;kc&&(.2>b&&(m[a+0]+=1),.2>e&&(m[a+2]+=1),.2>B&&(m[a+4]+=1))})();this.addAttribute('position',new ba(n,3));this.addAttribute('normal',new ba(n.slice(),3));this.addAttribute('uv',new ba(m,2));0===c?this.computeVertexNormals():this.normalizeNormals()}function Yf(a,b){Q.call(this);this.type='TetrahedronGeometry';this.parameters={radius:a,detail:b};this.fromBufferGeometry(new mg(a,b));this.mergeVertices()} -function mg(a,b){ob.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],a,b);this.type='TetrahedronBufferGeometry';this.parameters={radius:a,detail:b}}function fd(a,b){Q.call(this);this.type='OctahedronGeometry';this.parameters={radius:a,detail:b};this.fromBufferGeometry(new eg(a,b));this.mergeVertices()}function eg(a,b){ob.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],a,b);this.type='OctahedronBufferGeometry';this.parameters= -{radius:a,detail:b}}function wf(a,b){Q.call(this);this.type='IcosahedronGeometry';this.parameters={radius:a,detail:b};this.fromBufferGeometry(new wg(a,b));this.mergeVertices()}function wg(a,b){var e=(1+Math.sqrt(5))/2;ob.call(this,[-1,e,0,1,e,0,-1,-e,0,1,-e,0,0,-1,e,0,1,e,0,-1,-e,0,1,-e,e,0,-1,e,0,1,-e,0,-1,-e,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,b);this.type='IcosahedronBufferGeometry';this.parameters= -{radius:a,detail:b}}function Ag(a,b){Q.call(this);this.type='DodecahedronGeometry';this.parameters={radius:a,detail:b};this.fromBufferGeometry(new xf(a,b));this.mergeVertices()}function xf(a,b){var e=(1+Math.sqrt(5))/2,B=1/e;ob.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-B,-e,0,-B,e,0,B,-e,0,B,e,-B,-e,0,-B,e,0,B,-e,0,B,e,0,-e,0,-B,e,0,-B,-e,0,B,e,0,B],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2, -6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,b);this.type='DodecahedronBufferGeometry';this.parameters={radius:a,detail:b}}function ve(a,b,e,c,d,g){Q.call(this);this.type='TubeGeometry';this.parameters={path:a,tubularSegments:b,radius:e,radialSegments:c,closed:d};void 0!==g&&console.warn('THREE.TubeGeometry: taper has been removed.');a=new ge(a,b,e,c,d);this.tangents=a.tangents;this.normals= -a.normals;this.binormals=a.binormals;this.fromBufferGeometry(a);this.mergeVertices()}function ge(a,b,e,c,g){function B(B){p=a.getPointAt(B/b,p);var d=k.normals[B];B=k.binormals[B];for(r=0;r<=c;r++){var g=r/c*Math.PI*2,h=Math.sin(g);g=-Math.cos(g);m.x=g*d.x+h*B.x;m.y=g*d.y+h*B.y;m.z=g*d.z+h*B.z;m.normalize();Aa.push(m.x,m.y,m.z);n.x=p.x+e*m.x;n.y=p.y+e*m.y;n.z=p.z+e*m.z;u.push(n.x,n.y,n.z)}}ea.call(this);this.type='TubeBufferGeometry';this.parameters={path:a,tubularSegments:b,radius:e,radialSegments:c, -closed:g};b=b||64;e=e||1;c=c||8;g=g||!1;var k=a.computeFrenetFrames(b,g);this.tangents=k.tangents;this.normals=k.normals;this.binormals=k.binormals;var n=new h,m=new h,l=new d,p=new h,q,r,u=[],Aa=[],t=[],v=[];for(q=0;q=b;d-=c)B=bh(d,a[d],a[d+1],B);B&&xd(B,B.next)&&(gf(B),B=B.next);return B}function pf(a,b){if(!a)return a;b||(b=a);do{var e=!1;if(a.steiner||!xd(a,a.next)&&0!==Wc(a.prev,a,a.next))a=a.next;else{gf(a);a=b=a.prev;if(a===a.next)break;e=!0}}while(e||a!==b);return b}function Se(a,b,e,c,d,g,h){if(a){if(!h&&g){var B=a,k=B;do null===k.z&&(k.z=Sd(k.x,k.y,c,d,g)),k.prevZ= -k.prev,k=k.nextZ=k.next;while(k!==B);k.prevZ.nextZ=null;k.prevZ=null;B=k;var n,m,l,p,q=1;do{k=B;var r=B=null;for(m=0;k;){m++;var u=k;for(n=l=0;nl.x?m.x>q.x?m.x:q.x:l.x>q.x?l.x:q.x,w=m.y>l.y? -m.y>q.y?m.y:q.y:l.y>q.y?l.y:q.y;n=Sd(m.x=n;){if(Aa!==r.prev&&Aa!==r.next&&Od(m.x,m.y,l.x,l.y,q.x,q.y,Aa.x,Aa.y)&&0<=Wc(Aa.prev,Aa,Aa.next)){r=!1;break a}Aa=Aa.prevZ}r=!0}}else a:if(r=a,m=r.prev,l=r,q=r.next,0<=Wc(m,l,q))r=!1;else{for(n= -r.next.next;n!==r.prev;){if(Od(m.x,m.y,l.x,l.y,q.x,q.y,n.x,n.y)&&0<=Wc(n.prev,n,n.next)){r=!1;break a}n=n.next}r=!0}if(r)b.push(k.i/e),b.push(a.i/e),b.push(u.i/e),gf(a),B=a=u.next;else if(a=u,a===B){if(!h)Se(pf(a),b,e,c,d,g,1);else if(1===h){h=b;B=e;k=a;do u=k.prev,r=k.next.next,!xd(u,r)&&ae(u,k,k.next,r)&&he(u,r)&&he(r,u)&&(h.push(u.i/B),h.push(k.i/B),h.push(r.i/B),gf(k),gf(k.next),k=a=r),k=k.next;while(k!==a);a=k;Se(a,b,e,c,d,g,2)}else if(2===h)a:{h=a;do{for(B=h.next.next;B!==h.prev;){if(k=h.i!== -B.i){k=h;u=B;if(r=k.next.i!==u.i&&k.prev.i!==u.i){b:{r=k;do{if(r.i!==k.i&&r.next.i!==k.i&&r.i!==u.i&&r.next.i!==u.i&&ae(r,r.next,k,u)){r=!0;break b}r=r.next}while(r!==k);r=!1}r=!r}if(r=r&&he(k,u)&&he(u,k)){r=k;m=!1;l=(k.x+u.x)/2;u=(k.y+u.y)/2;do r.y>u!==r.next.y>u&&r.next.y!==r.y&&l<(r.next.x-r.x)*(u-r.y)/(r.next.y-r.y)+r.x&&(m=!m),r=r.next;while(r!==k);r=m}k=r}if(k){a=xe(h,B);h=pf(h,h.next);a=pf(a,a.next);Se(h,b,e,c,d,g);Se(a,b,e,c,d,g);break a}B=B.next}h=h.next}while(h!==a)}break}}}}function Wg(a, -b){return a.x-b.x}function qe(a,b){var e=b,B=a.x,c=a.y,d=-Infinity;do{if(c<=e.y&&c>=e.next.y&&e.next.y!==e.y){var g=e.x+(c-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(g<=B&&g>d){d=g;if(g===B){if(c===e.y)return e;if(c===e.next.y)return e.next}var h=e.x=e.x&&e.x>=g&&B!==e.x&&Od(ch.x)&&he(e, -a)&&(h=e,n=m)}e=e.next}return h}function Sd(a,b,e,c,d){a=32767*(a-e)*d;b=32767*(b-c)*d;a=(a|a<<8)&16711935;a=(a|a<<4)&252645135;a=(a|a<<2)&858993459;b=(b|b<<8)&16711935;b=(b|b<<4)&252645135;b=(b|b<<2)&858993459;return(a|a<<1)&1431655765|((b|b<<1)&1431655765)<<1}function yd(a){var b=a,e=a;do b.xWc(a.prev,a,a.next)?0<=Wc(a,b,a.next)&&0<=Wc(a,a.prev,b):0>Wc(a,b,a.prev)||0>Wc(a,a.next,b)}function xe(a,b){var e=new jh(a.i,a.x,a.y),c=new jh(b.i,b.x,b.y),B=a.next,d=b.prev;a.next=b;b.prev=a;e.next=B;B.prev=e;c.next=e;e.prev=c;d.next=c;c.prev=d;return c}function bh(a,b,e,c){a=new jh(a,b,e); -c?(a.next=c.next,a.prev=c,c.next.prev=a,c.next=a):(a.prev=a,a.next=a);return a}function gf(a){a.next.prev=a.prev;a.prev.next=a.next;a.prevZ&&(a.prevZ.nextZ=a.nextZ);a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function jh(a,b,e){this.i=a;this.x=b;this.y=e;this.nextZ=this.prevZ=this.z=this.next=this.prev=null;this.steiner=!1}function Og(a){var b=a.length;2Number.EPSILON){var n=Math.sqrt(k),m=Math.sqrt(g*g+h*h);k=b.x-B/n;b=b.y+c/n;h=((e.x-h/m-k)*h-(e.y+g/m-b)*g)/(c*h-B*g);g=k+c*h-a.x;c=b+B*h-a.y;B=g*g+c*c;if(2>=B)return new d(g, -c);B=Math.sqrt(B/2)}else a=!1,c>Number.EPSILON?g>Number.EPSILON&&(a=!0):c<-Number.EPSILON?g<-Number.EPSILON&&(a=!0):Math.sign(B)===Math.sign(h)&&(a=!0),a?(g=-B,B=Math.sqrt(k)):(g=c,c=B,B=Math.sqrt(k/2));return new d(g/B,c/B)}function n(a,b){for(L=a.length;0<=--L;){var e=L,d=L-1;0>d&&(d=a.length-1);var g,h=Aa+2*D;for(g=0;gm;m++){var l=n[d[m]],p=n[d[(m+1)%3]];c[0]=Math.min(l,p);c[1]=Math.max(l,p);l=c[0]+','+c[1];void 0===B[l]?B[l]={index1:c[0],index2:c[1],face1:h,face2:void 0}:B[l].face2=h}for(l in B)if(c=B[l],void 0===c.face2||g[c.face1].normal.dot(g[c.face2].normal)<=b)d=a[c.index1],e.push(d.x,d.y,d.z),d=a[c.index2], -e.push(d.x,d.y,d.z);this.addAttribute('position',new ba(e,3))}function xg(a,b,e,c,d,g,h,k){Q.call(this);this.type='CylinderGeometry';this.parameters={radiusTop:a,radiusBottom:b,height:e,radialSegments:c,heightSegments:d,openEnded:g,thetaStart:h,thetaLength:k};this.fromBufferGeometry(new Pf(a,b,e,c,d,g,h,k));this.mergeVertices()}function Pf(a,b,e,c,g,k,n,m){function B(e){var B,g=new d,k=new h,v=0,z=!0===e?a:b,D=!0===e?1:-1,H=t;for(B=1;B<=c;B++)q.push(0,Aa*D,0),r.push(0,D,0),u.push(.5,.5),t++;var C= -t;for(B=0;B<=c;B++){var Ta=B/c*m+n,K=Math.cos(Ta);Ta=Math.sin(Ta);k.x=z*Ta;k.y=Aa*D;k.z=z*K;q.push(k.x,k.y,k.z);r.push(0,D,0);g.x=.5*K+.5;g.y=.5*Ta*D+.5;u.push(g.x,g.y);t++}for(B=0;Bthis.duration&&this.resetDuration()}function Jd(a){switch(a.toLowerCase()){case 'scalar':case 'double':case 'float':case 'number':case 'integer':return Ad;case 'vector':case 'vector2':case 'vector3':case 'vector4':return ie; -case 'color':return di;case 'quaternion':return zh;case 'bool':case 'boolean':return re;case 'string':return Qi}throw Error('THREE.KeyframeTrack: Unsupported typeName: '+a);}function Kj(a){if(void 0===a.type)throw Error('THREE.KeyframeTrack: track type undefined, can not parse');var b=Jd(a.type);if(void 0===a.times){var e=[],c=[];Jb.flattenJSON(a.keys,e,c,'value');a.times=e;a.values=c}return void 0!==b.parse?b.parse(a):new b(a.name,a.times,a.values,a.interpolation)}function Zi(a,b,e){var c=this,B= -!1,d=0,g=0,h=void 0;this.onStart=void 0;this.onLoad=a;this.onProgress=b;this.onError=e;this.itemStart=function(a){g++;if(!1===B&&void 0!==c.onStart)c.onStart(a,d,g);B=!0};this.itemEnd=function(a){d++;if(void 0!==c.onProgress)c.onProgress(a,d,g);if(d===g&&(B=!1,void 0!==c.onLoad))c.onLoad()};this.itemError=function(a){if(void 0!==c.onError)c.onError(a)};this.resolveURL=function(a){return h?h(a):a};this.setURLModifier=function(a){h=a;return this}}function ze(a){this.manager=void 0!==a?a:$a}function Cg(a){this.manager= -void 0!==a?a:$a}function Ai(a){this.manager=void 0!==a?a:$a;this._parser=null}function Dg(a){this.manager=void 0!==a?a:$a;this._parser=null}function qg(a){this.manager=void 0!==a?a:$a}function kh(a){this.manager=void 0!==a?a:$a}function qh(a){this.manager=void 0!==a?a:$a}function Ab(){this.type='Curve';this.arcLengthDivisions=200}function zf(a,b,e,c,d,g,h,k){Ab.call(this);this.type='EllipseCurve';this.aX=a||0;this.aY=b||0;this.xRadius=e||1;this.yRadius=c||1;this.aStartAngle=d||0;this.aEndAngle=g|| -2*Math.PI;this.aClockwise=h||!1;this.aRotation=k||0}function fi(a,b,e,c,d,g){zf.call(this,a,b,e,e,c,d,g);this.type='ArcCurve'}function gi(){var a=0,b=0,e=0,c=0;return{initCatmullRom:function(B,d,g,h,k){B=k*(g-B);h=k*(h-d);a=d;b=B;e=-3*d+3*g-2*B-h;c=2*d-2*g+B+h},initNonuniformCatmullRom:function(B,d,g,h,k,n,m){B=((d-B)/k-(g-B)/(k+n)+(g-d)/n)*n;h=((g-d)/n-(h-d)/(n+m)+(h-g)/m)*n;a=d;b=B;e=-3*d+3*g-2*B-h;c=2*d-2*g+B+h},calc:function(B){var d=B*B;return a+b*B+e*d+c*d*B}}}function se(a,b,e,c){Ab.call(this); -this.type='CatmullRomCurve3';this.points=a||[];this.closed=b||!1;this.curveType=e||'centripetal';this.tension=c||.5}function hi(a,b,e,c,d){b=.5*(c-b);d=.5*(d-e);var B=a*a;return(2*e-2*c+b+d)*a*B+(-3*e+3*c-2*b-d)*B+b*a+e}function jf(a,b,e,c){var B=1-a;return B*B*b+2*(1-a)*a*e+a*a*c}function rh(a,b,e,c,d){var B=1-a,g=1-a;return B*B*B*b+3*g*g*a*e+3*(1-a)*a*a*c+a*a*a*d}function be(a,b,e,c){Ab.call(this);this.type='CubicBezierCurve';this.v0=a||new d;this.v1=b||new d;this.v2=e||new d;this.v3=c||new d}function Rf(a, -b,e,c){Ab.call(this);this.type='CubicBezierCurve3';this.v0=a||new h;this.v1=b||new h;this.v2=e||new h;this.v3=c||new h}function Td(a,b){Ab.call(this);this.type='LineCurve';this.v1=a||new d;this.v2=b||new d}function kf(a,b){Ab.call(this);this.type='LineCurve3';this.v1=a||new h;this.v2=b||new h}function Af(a,b,e){Ab.call(this);this.type='QuadraticBezierCurve';this.v0=a||new d;this.v1=b||new d;this.v2=e||new d}function gg(a,b,e){Ab.call(this);this.type='QuadraticBezierCurve3';this.v0=a||new h;this.v1= -b||new h;this.v2=e||new h}function Ld(a){Ab.call(this);this.type='SplineCurve';this.points=a||[]}function qf(){Ab.call(this);this.type='CurvePath';this.curves=[];this.autoClose=!1}function Sf(a){qf.call(this);this.type='Path';this.currentPoint=new d;a&&this.setFromPoints(a)}function rg(a){Sf.call(this,a);this.uuid=ac.generateUUID();this.type='Shape';this.holes=[]}function lf(a,b){P.call(this);this.type='Light';this.color=new z(a);this.intensity=void 0!==b?b:1;this.receiveShadow=void 0}function dh(a, -b,e){lf.call(this,a,e);this.type='HemisphereLight';this.castShadow=void 0;this.position.copy(P.DefaultUp);this.updateMatrix();this.groundColor=new z(b)}function Zf(a){this.camera=a;this.bias=0;this.radius=1;this.mapSize=new d(512,512);this.map=null;this.matrix=new c}function ii(){Zf.call(this,new Zd(50,1,.5,500))}function Ah(a,b,e,c,d,g){lf.call(this,a,b);this.type='SpotLight';this.position.copy(P.DefaultUp);this.updateMatrix();this.target=new P;Object.defineProperty(this,'power',{get:function(){return this.intensity* -Math.PI},set:function(a){this.intensity=a/Math.PI}});this.distance=void 0!==e?e:0;this.angle=void 0!==c?c:Math.PI/3;this.penumbra=void 0!==d?d:0;this.decay=void 0!==g?g:1;this.shadow=new ii}function ji(a,b,e,c){lf.call(this,a,b);this.type='PointLight';Object.defineProperty(this,'power',{get:function(){return 4*this.intensity*Math.PI},set:function(a){this.intensity=a/(4*Math.PI)}});this.distance=void 0!==e?e:0;this.decay=void 0!==c?c:1;this.shadow=new Zf(new Zd(90,1,.5,500))}function hg(a,b,e,c,d, -g){Rc.call(this);this.type='OrthographicCamera';this.zoom=1;this.view=null;this.left=void 0!==a?a:-1;this.right=void 0!==b?b:1;this.top=void 0!==e?e:1;this.bottom=void 0!==c?c:-1;this.near=void 0!==d?d:.1;this.far=void 0!==g?g:2E3;this.updateProjectionMatrix()}function ki(){Zf.call(this,new hg(-5,5,5,-5,.5,500))}function li(a,b){lf.call(this,a,b);this.type='DirectionalLight';this.position.copy(P.DefaultUp);this.updateMatrix();this.target=new P;this.shadow=new ki}function yg(a,b){lf.call(this,a,b); -this.type='AmbientLight';this.castShadow=void 0}function mi(a,b,e,c){lf.call(this,a,b);this.type='RectAreaLight';this.width=void 0!==e?e:10;this.height=void 0!==c?c:10}function Ie(a){this.manager=void 0!==a?a:$a;this.textures={}}function Nh(a){this.manager=void 0!==a?a:$a}function Zg(a){this.manager=void 0!==a?a:$a;this.resourcePath=''}function Ud(a){'undefined'===typeof createImageBitmap&&console.warn('THREE.ImageBitmapLoader: createImageBitmap() not supported.');'undefined'===typeof fetch&&console.warn('THREE.ImageBitmapLoader: fetch() not supported.'); -this.manager=void 0!==a?a:$a;this.options=void 0}function Bi(){this.type='ShapePath';this.color=new z;this.subPaths=[];this.currentPath=null}function Ci(a){this.type='Font';this.data=a}function pj(a){this.manager=void 0!==a?a:$a}function ni(){}function Ri(a){this.manager=void 0!==a?a:$a}function $i(){this.type='StereoCamera';this.aspect=1;this.eyeSep=.064;this.cameraL=new Zd;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate=!1;this.cameraR=new Zd;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate= -!1}function lh(a,b,c,d){P.call(this);this.type='CubeCamera';var B=new Zd(90,1,a,b);B.up.set(0,-1,0);B.lookAt(new h(1,0,0));this.add(B);var g=new Zd(90,1,a,b);g.up.set(0,-1,0);g.lookAt(new h(-1,0,0));this.add(g);var k=new Zd(90,1,a,b);k.up.set(0,0,1);k.lookAt(new h(0,1,0));this.add(k);var n=new Zd(90,1,a,b);n.up.set(0,0,-1);n.lookAt(new h(0,-1,0));this.add(n);var m=new Zd(90,1,a,b);m.up.set(0,-1,0);m.lookAt(new h(0,0,1));this.add(m);var l=new Zd(90,1,a,b);l.up.set(0,-1,0);l.lookAt(new h(0,0,-1));this.add(l); -d=d||{format:1022,magFilter:1006,minFilter:1006};this.renderTarget=new e(c,c,d);this.renderTarget.texture.name='CubeCamera';this.update=function(a,b){null===this.parent&&this.updateMatrixWorld();var e=a.getRenderTarget(),c=this.renderTarget,d=c.texture.generateMipmaps;c.texture.generateMipmaps=!1;a.setRenderTarget(c,0);a.render(b,B);a.setRenderTarget(c,1);a.render(b,g);a.setRenderTarget(c,2);a.render(b,k);a.setRenderTarget(c,3);a.render(b,n);a.setRenderTarget(c,4);a.render(b,m);c.texture.generateMipmaps= -d;a.setRenderTarget(c,5);a.render(b,l);a.setRenderTarget(e)};this.clear=function(a,b,e,c){for(var d=a.getRenderTarget(),B=this.renderTarget,g=0;6>g;g++)a.setRenderTarget(B,g),a.clear(b,e,c);a.setRenderTarget(d)}}function Eg(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1}function Di(){P.call(this);this.type='AudioListener';this.context=oi.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null;this.timeDelta= -0}function pi(a){P.call(this);this.type='Audio';this.listener=a;this.context=a.context;this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay=!1;this.buffer=null;this.detune=0;this.loop=!1;this.offset=this.startTime=0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType='empty';this.filters=[]}function qj(a){pi.call(this,a);this.panner=this.context.createPanner();this.panner.connect(this.gain)}function rj(a,b){this.analyser=a.context.createAnalyser(); -this.analyser.fftSize=void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)}function aj(a,b,e){this.binding=a;this.valueSize=e;a=Float64Array;switch(b){case 'quaternion':b=this._slerp;break;case 'string':case 'bool':a=Array;b=this._select;break;default:b=this._lerp}this.buffer=new a(4*e);this._mixBufferRegion=b;this.referenceCount=this.useCount=this.cumulativeWeight=0}function Lj(a,b,e){e=e||$f.parseTrackName(b);this._targetGroup=a;this._bindings= -a.subscribe_(b,e)}function $f(a,b,e){this.path=b;this.parsedPath=e||$f.parseTrackName(b);this.node=$f.findNode(a,this.parsedPath.nodeName)||a;this.rootNode=a}function Si(){this.uuid=ac.generateUUID();this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;var a={};this._indicesByUUID=a;for(var b=0,e=arguments.length;b!==e;++b)a[arguments[b].uuid]=b;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var c=this;this.stats={objects:{get total(){return c._objects.length}, -get inUse(){return this.total-c.nCachedObjects_}},get bindingsPerObject(){return c._bindings.length}}}function sj(a,b,e){this._mixer=a;this._clip=b;this._localRoot=e||null;a=b.tracks;b=a.length;e=Array(b);for(var c={endingStart:2400,endingEnd:2400},d=0;d!==b;++d){var B=a[d].createInterpolant(null);e[d]=B;B.settings=c}this._interpolantSettings=c;this._interpolants=e;this._propertyBindings=Array(b);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop= -2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function bj(a){this._root=a;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function Rg(a,b){'string'===typeof a&&(console.warn('THREE.Uniform: Type parameter is no longer needed.'),a=b);this.value=a}function tj(){ea.call(this); -this.type='InstancedBufferGeometry';this.maxInstancedCount=void 0}function uj(a,b,e){$d.call(this,a,b);this.meshPerAttribute=e||1}function ce(a,b,e,c){'number'===typeof e&&(c=e,e=!1,console.error('THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.'));T.call(this,a,b,e);this.meshPerAttribute=c||1}function Mj(a,b,e,c){this.ray=new va(a,b);this.near=e||0;this.far=c||Infinity;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params, -{PointCloud:{get:function(){console.warn('THREE.Raycaster: params.PointCloud has been renamed to params.Points.');return this.Points}}})}function qi(a,b){return a.distance-b.distance}function Ei(a,b,e,c){if(!1!==a.visible&&(a.raycast(b,e),!0===c)){a=a.children;c=0;for(var d=a.length;ce;e++,c++){var d=e/32*Math.PI*2,B=c/32*Math.PI*2;b.push(Math.cos(d),Math.sin(d),1,Math.cos(B),Math.sin(B),1)}a.addAttribute('position',new ba(b, -3));b=new Sc({fog:!1});this.cone=new Kb(a,b);this.add(this.cone);this.update()}function Vh(a){var b=[];a&&a.isBone&&b.push(a);for(var e=0;eg;g++)b.probe.push(new c);var e=new c,d=new v,h=new v;return{setup:function(B,g,c){for(var k=0,p=0,l=0,m=0;9>m;m++)b.probe[m].set(0,0,0);var n=0,q=0,sa=0,r=0,t=0;c=c.matrixWorldInverse;m=0;for(var u=B.length;mE;E++)b.probe[E].addScaledVector(z.sh.coefficients[E], +v);else if(z.isDirectionalLight){var C=a.get(z);C.color.copy(z.color).multiplyScalar(z.intensity);C.direction.setFromMatrixPosition(z.matrixWorld);e.setFromMatrixPosition(z.target.matrixWorld);C.direction.sub(e);C.direction.transformDirection(c);if(C.shadow=z.castShadow)v=z.shadow,C.shadowBias=v.bias,C.shadowRadius=v.radius,C.shadowMapSize=v.mapSize;b.directionalShadowMap[n]=E;b.directionalShadowMatrix[n]=z.shadow.matrix;b.directional[n]=C;n++}else if(z.isSpotLight){C=a.get(z);C.position.setFromMatrixPosition(z.matrixWorld); +C.position.applyMatrix4(c);C.color.copy(fb).multiplyScalar(v);C.distance=w;C.direction.setFromMatrixPosition(z.matrixWorld);e.setFromMatrixPosition(z.target.matrixWorld);C.direction.sub(e);C.direction.transformDirection(c);C.coneCos=Math.cos(z.angle);C.penumbraCos=Math.cos(z.angle*(1-z.penumbra));C.decay=z.decay;if(C.shadow=z.castShadow)v=z.shadow,C.shadowBias=v.bias,C.shadowRadius=v.radius,C.shadowMapSize=v.mapSize;b.spotShadowMap[sa]=E;b.spotShadowMatrix[sa]=z.shadow.matrix;b.spot[sa]=C;sa++}else if(z.isRectAreaLight)C= +a.get(z),C.color.copy(fb).multiplyScalar(v),C.position.setFromMatrixPosition(z.matrixWorld),C.position.applyMatrix4(c),h.identity(),d.copy(z.matrixWorld),d.premultiply(c),h.extractRotation(d),C.halfWidth.set(.5*z.width,0,0),C.halfHeight.set(0,.5*z.height,0),C.halfWidth.applyMatrix4(h),C.halfHeight.applyMatrix4(h),b.rectArea[r]=C,r++;else if(z.isPointLight){C=a.get(z);C.position.setFromMatrixPosition(z.matrixWorld);C.position.applyMatrix4(c);C.color.copy(z.color).multiplyScalar(z.intensity);C.distance= +z.distance;C.decay=z.decay;if(C.shadow=z.castShadow)v=z.shadow,C.shadowBias=v.bias,C.shadowRadius=v.radius,C.shadowMapSize=v.mapSize,C.shadowCameraNear=v.camera.near,C.shadowCameraFar=v.camera.far;b.pointShadowMap[q]=E;b.pointShadowMatrix[q]=z.shadow.matrix;b.point[q]=C;q++}else z.isHemisphereLight&&(C=a.get(z),C.direction.setFromMatrixPosition(z.matrixWorld),C.direction.transformDirection(c),C.direction.normalize(),C.skyColor.copy(z.color).multiplyScalar(v),C.groundColor.copy(z.groundColor).multiplyScalar(v), +b.hemi[t]=C,t++)}b.ambient[0]=k;b.ambient[1]=p;b.ambient[2]=l;b.directional.length=n;b.spot.length=sa;b.rectArea.length=r;b.point.length=q;b.hemi.length=t;b.hash.stateID=b.id;b.hash.directionalLength=n;b.hash.pointLength=q;b.hash.spotLength=sa;b.hash.rectAreaLength=r;b.hash.hemiLength=t;b.hash.shadowsLength=g.length},state:b}}function Ga(){var a=new Qb,b=[],g=[];return{init:function(){b.length=0;g.length=0},state:{lightsArray:b,shadowsArray:g,lights:a},setupLights:function(B){a.setup(b,g,B)},pushLight:function(a){b.push(a)}, +pushShadow:function(a){g.push(a)}}}function Pb(){function a(B){B=B.target;B.removeEventListener('dispose',a);delete b[B.id]}var b={};return{get:function(B,g){if(void 0===b[B.id]){var c=new Ga;b[B.id]={};b[B.id][g.id]=c;B.addEventListener('dispose',a)}else void 0===b[B.id][g.id]?(c=new Ga,b[B.id][g.id]=c):c=b[B.id][g.id];return c},dispose:function(){b={}}}}function vc(a){ea.call(this);this.type='MeshDepthMaterial';this.depthPacking=3200;this.morphTargets=this.skinning=!1;this.displacementMap=this.alphaMap= +this.map=null;this.displacementScale=1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.setValues(a)}function tb(a){ea.call(this);this.type='MeshDistanceMaterial';this.referencePosition=new c;this.nearDistance=1;this.farDistance=1E3;this.morphTargets=this.skinning=!1;this.displacementMap=this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.lights=this.fog=!1;this.setValues(a)}function qd(a,b,g){function B(b,B,g,c,e,d){var h= +b.geometry;var k=r;var p=b.customDepthMaterial;g&&(k=t,p=b.customDistanceMaterial);p?k=p:(p=!1,B.morphTargets&&(h&&h.isBufferGeometry?p=h.morphAttributes&&h.morphAttributes.position&&0c||a.height>c)e=c/Math.max(a.width,a.height);if(1>e||!0===b){if('undefined'!==typeof HTMLImageElement&&a instanceof HTMLImageElement|| +'undefined'!==typeof HTMLCanvasElement&&a instanceof HTMLCanvasElement||'undefined'!==typeof ImageBitmap&&a instanceof ImageBitmap)return c=b?cb.floorPowerOfTwo:Math.floor,b=c(e*a.width),e=c(e*a.height),void 0===K&&(K=B(b,e)),g=g?B(b,e):K,g.width=b,g.height=e,g.getContext('2d').drawImage(a,0,0,b,e),console.warn('THREE.WebGLRenderer: Texture has been resized from ('+a.width+'x'+a.height+') to ('+b+'x'+e+').'),g;'data'in a&&console.warn('THREE.WebGLRenderer: Image in DataTexture is too big ('+a.width+ +'x'+a.height+').')}return a}function p(a){return cb.isPowerOfTwo(a.width)&&cb.isPowerOfTwo(a.height)}function l(a,b){return a.generateMipmaps&&b&&1003!==a.minFilter&&1006!==a.minFilter}function m(b,g,B,e){a.generateMipmap(b);c.get(g).__maxMipLevel=Math.log(Math.max(B,e))*Math.LOG2E}function n(a,g){if(!e.isWebGL2)return a;var B=a;6403===a&&(5126===g&&(B=33326),5131===g&&(B=33325),5121===g&&(B=33321));6407===a&&(5126===g&&(B=34837),5131===g&&(B=34843),5121===g&&(B=32849));6408===a&&(5126===g&&(B=34836), +5131===g&&(B=34842),5121===g&&(B=32856));33325===B||33326===B||34842===B||34836===B?b.get('EXT_color_buffer_float'):(34843===B||34837===B)&&console.warn('THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead.');return B}function q(a){return 1003===a||1004===a||1005===a?9728:9729}function sa(b){b=b.target;b.removeEventListener('dispose',sa);var g=c.get(b);void 0!==g.__webglInit&&(a.deleteTexture(g.__webglTexture),c.remove(b));b.isVideoTexture&&delete Hc[b.id]; +h.memory.textures--}function r(b){b=b.target;b.removeEventListener('dispose',r);var g=c.get(b),B=c.get(b.texture);if(b){void 0!==B.__webglTexture&&a.deleteTexture(B.__webglTexture);b.depthTexture&&b.depthTexture.dispose();if(b.isWebGLRenderTargetCube)for(B=0;6>B;B++)a.deleteFramebuffer(g.__webglFramebuffer[B]),g.__webglDepthbuffer&&a.deleteRenderbuffer(g.__webglDepthbuffer[B]);else a.deleteFramebuffer(g.__webglFramebuffer),g.__webglDepthbuffer&&a.deleteRenderbuffer(g.__webglDepthbuffer);c.remove(b.texture); +c.remove(b)}h.memory.textures--}function t(a,b){var B=c.get(a);if(a.isVideoTexture){var e=a.id,d=h.render.frame;Hc[e]!==d&&(Hc[e]=d,a.update())}if(0r;r++)sa[r]=B||q?q?b.image[r].image:b.image[r]:k(b.image[r],!1,!0,e.maxCubemapSize);var t=sa[0],u=p(t)||e.isWebGL2,Pa=d.convert(b.format),z=d.convert(b.type),fb=n(Pa,z);v(34067,b,u);for(r=0;6>r;r++)if(B)for(var E,C=sa[r].mipmaps,ec=0,D= +C.length;ec=e.maxTextures&&console.warn('THREE.WebGLTextures: Trying to use '+a+' texture units while this GPU supports only '+e.maxTextures);S+=1;return a}; +this.resetTextureUnits=function(){S=0};this.setTexture2D=t;this.setTexture2DArray=function(a,b){var B=c.get(a);0sa;sa++)B.__webglFramebuffer[sa]=a.createFramebuffer();else if(B.__webglFramebuffer=a.createFramebuffer(),sa)if(e.isWebGL2){B.__webglMultisampledFramebuffer=a.createFramebuffer();B.__webglColorRenderbuffer=a.createRenderbuffer();a.bindRenderbuffer(36161,B.__webglColorRenderbuffer); +sa=d.convert(b.texture.format);var Pa=d.convert(b.texture.type);sa=n(sa,Pa);Pa=D(b);a.renderbufferStorageMultisample(36161,Pa,sa,b.width,b.height);a.bindFramebuffer(36160,B.__webglMultisampledFramebuffer);a.framebufferRenderbuffer(36160,36064,36161,B.__webglColorRenderbuffer);a.bindRenderbuffer(36161,null);b.depthBuffer&&(B.__webglDepthRenderbuffer=a.createRenderbuffer(),C(B.__webglDepthRenderbuffer,b,!0));a.bindFramebuffer(36160,null)}else console.warn('THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.'); +if(q){g.bindTexture(34067,k.__webglTexture);v(34067,b.texture,u);for(sa=0;6>sa;sa++)E(B.__webglFramebuffer[sa],b,36064,34069+sa);l(b.texture,u)&&m(34067,b.texture,b.width,b.height);g.bindTexture(34067,null)}else g.bindTexture(3553,k.__webglTexture),v(3553,b.texture,u),E(B.__webglFramebuffer,b,36064,3553),l(b.texture,u)&&m(3553,b.texture,b.width,b.height),g.bindTexture(3553,null);if(b.depthBuffer){B=c.get(b);k=!0===b.isWebGLRenderTargetCube;if(b.depthTexture){if(k)throw Error('target.depthTexture not supported in Cube render targets'); +if(b&&b.isWebGLRenderTargetCube)throw Error('Depth Texture with cube render targets is not supported');a.bindFramebuffer(36160,B.__webglFramebuffer);if(!b.depthTexture||!b.depthTexture.isDepthTexture)throw Error('renderTarget.depthTexture must be an instance of THREE.DepthTexture');c.get(b.depthTexture).__webglTexture&&b.depthTexture.image.width===b.width&&b.depthTexture.image.height===b.height||(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0); +t(b.depthTexture,0);B=c.get(b.depthTexture).__webglTexture;if(1026===b.depthTexture.format)a.framebufferTexture2D(36160,36096,3553,B,0);else if(1027===b.depthTexture.format)a.framebufferTexture2D(36160,33306,3553,B,0);else throw Error('Unknown depthTexture format');}else if(k)for(B.__webglDepthbuffer=[],k=0;6>k;k++)a.bindFramebuffer(36160,B.__webglFramebuffer[k]),B.__webglDepthbuffer[k]=a.createRenderbuffer(),C(B.__webglDepthbuffer[k],b);else a.bindFramebuffer(36160,B.__webglFramebuffer),B.__webglDepthbuffer= +a.createRenderbuffer(),C(B.__webglDepthbuffer,b);a.bindFramebuffer(36160,null)}};this.updateRenderTargetMipmap=function(a){var b=a.texture,B=p(a)||e.isWebGL2;if(l(b,B)){B=a.isWebGLRenderTargetCube?34067:3553;var d=c.get(b).__webglTexture;g.bindTexture(B,d);m(B,b,a.width,a.height);g.bindTexture(B,null)}};this.updateMultisampleRenderTarget=function(b){if(b.isWebGLMultisampleRenderTarget)if(e.isWebGL2){var g=c.get(b);a.bindFramebuffer(36008,g.__webglMultisampledFramebuffer);a.bindFramebuffer(36009,g.__webglFramebuffer); +g=b.width;var B=b.height,d=16384;b.depthBuffer&&(d|=256);b.stencilBuffer&&(d|=1024);a.blitFramebuffer(0,0,g,B,0,0,g,B,d,9728)}else console.warn('THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.')};this.safeSetTexture2D=function(a,b){a&&a.isWebGLRenderTarget&&(!1===H&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),H=!0),a=a.texture);t(a,b)};this.safeSetTextureCube=function(a,b){a&&a.isWebGLRenderTargetCube&& +(!1===Pa&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),Pa=!0),a=a.texture);a&&a.isCubeTexture||Array.isArray(a.image)&&6===a.image.length?u(a,b):z(a,b)}}function df(a,b,g){return{convert:function(a){if(1E3===a)return 10497;if(1001===a)return 33071;if(1002===a)return 33648;if(1003===a)return 9728;if(1004===a)return 9984;if(1005===a)return 9986;if(1006===a)return 9729;if(1007===a)return 9985;if(1008===a)return 9987; +if(1009===a)return 5121;if(1017===a)return 32819;if(1018===a)return 32820;if(1019===a)return 33635;if(1010===a)return 5120;if(1011===a)return 5122;if(1012===a)return 5123;if(1013===a)return 5124;if(1014===a)return 5125;if(1015===a)return 5126;if(1016===a){if(g.isWebGL2)return 5131;var B=b.get('OES_texture_half_float');if(null!==B)return B.HALF_FLOAT_OES}if(1021===a)return 6406;if(1022===a)return 6407;if(1023===a)return 6408;if(1024===a)return 6409;if(1025===a)return 6410;if(1026===a)return 6402;if(1027=== +a)return 34041;if(1028===a)return 6403;if(100===a)return 32774;if(101===a)return 32778;if(102===a)return 32779;if(200===a)return 0;if(201===a)return 1;if(202===a)return 768;if(203===a)return 769;if(204===a)return 770;if(205===a)return 771;if(206===a)return 772;if(207===a)return 773;if(208===a)return 774;if(209===a)return 775;if(210===a)return 776;if(33776===a||33777===a||33778===a||33779===a)if(B=b.get('WEBGL_compressed_texture_s3tc'),null!==B){if(33776===a)return B.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777=== +a)return B.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===a)return B.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===a)return B.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===a||35841===a||35842===a||35843===a)if(B=b.get('WEBGL_compressed_texture_pvrtc'),null!==B){if(35840===a)return B.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===a)return B.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===a)return B.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===a)return B.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===a&&(B=b.get('WEBGL_compressed_texture_etc1'), +null!==B))return B.COMPRESSED_RGB_ETC1_WEBGL;if(37808===a||37809===a||37810===a||37811===a||37812===a||37813===a||37814===a||37815===a||37816===a||37817===a||37818===a||37819===a||37820===a||37821===a)if(B=b.get('WEBGL_compressed_texture_astc'),null!==B)return a;if(103===a||104===a){if(g.isWebGL2){if(103===a)return 32775;if(104===a)return 32776}B=b.get('EXT_blend_minmax');if(null!==B){if(103===a)return B.MIN_EXT;if(104===a)return B.MAX_EXT}}if(1020===a){if(g.isWebGL2)return 34042;B=b.get('WEBGL_depth_texture'); +if(null!==B)return B.UNSIGNED_INT_24_8_WEBGL}return 0}}}function od(){Q.call(this);this.type='Group'}function kd(){Q.call(this);this.type='Camera';this.matrixWorldInverse=new v;this.projectionMatrix=new v;this.projectionMatrixInverse=new v}function fe(a,b,g,c){kd.call(this);this.type='PerspectiveCamera';this.fov=void 0!==a?a:50;this.zoom=1;this.near=void 0!==g?g:.1;this.far=void 0!==c?c:2E3;this.focus=10;this.aspect=void 0!==b?b:1;this.view=null;this.filmGauge=35;this.filmOffset=0;this.updateProjectionMatrix()} +function kf(a){fe.call(this);this.cameras=a||[]}function Tg(a,b,g){Ob.setFromMatrixPosition(b.matrixWorld);yb.setFromMatrixPosition(g.matrixWorld);var B=Ob.distanceTo(yb),c=b.projectionMatrix.elements,e=g.projectionMatrix.elements,d=c[14]/(c[10]-1);g=c[14]/(c[10]+1);var h=(c[9]+1)/c[5],k=(c[9]-1)/c[5],p=(c[8]-1)/c[0],l=(e[8]+1)/e[0];c=d*p;e=d*l;l=B/(-p+l);p=l*-p;b.matrixWorld.decompose(a.position,a.quaternion,a.scale);a.translateX(p);a.translateZ(l);a.matrixWorld.compose(a.position,a.quaternion,a.scale); +a.matrixWorldInverse.getInverse(a.matrixWorld);b=d+l;d=g+l;a.projectionMatrix.makePerspective(c-p,e+(B-p),h*g/d*b,k*g/d*b,b,d)}function Xe(a){function b(){return null!==h&&!0===h.isPresenting}function g(){if(b()){var g=h.getEyeParameters('left'),c=g.renderWidth*r;g=g.renderHeight*r;S=a.getPixelRatio();a.getSize(K);a.setDrawingBufferSize(2*c,g,1);Q.start()}else B.enabled&&a.setDrawingBufferSize(K.width,K.height,S),Q.stop()}var B=this,h=null,k=null,p=null,m=[],n=new v,q=new v,r=1,t='stage';'undefined'!== +typeof window&&'VRFrameData'in window&&(k=new window.VRFrameData,window.addEventListener('vrdisplaypresentchange',g,!1));var u=new v,z=new d,w=new c,E=new fe;E.bounds=new l(0,0,.5,1);E.layers.enable(1);var C=new fe;C.bounds=new l(.5,0,.5,1);C.layers.enable(2);var D=new kf([E,C]);D.layers.enable(1);D.layers.enable(2);var K=new e,S,H=[];this.enabled=!1;this.getController=function(a){var b=m[a];void 0===b&&(b=new od,b.matrixAutoUpdate=!1,b.visible=!1,m[a]=b);return b};this.getDevice=function(){return h}; +this.setDevice=function(a){void 0!==a&&(h=a);Q.setContext(a)};this.setFramebufferScaleFactor=function(a){r=a};this.setFrameOfReferenceType=function(a){t=a};this.setPoseTarget=function(a){void 0!==a&&(p=a)};this.getCamera=function(a){var g='stage'===t?1.6:0;if(!1===b())return a.position.set(0,g,0),a.rotation.set(0,0,0),a;h.depthNear=a.near;h.depthFar=a.far;h.getFrameData(k);if('stage'===t){var B=h.stageParameters;B?n.fromArray(B.sittingToStandingTransform):n.makeTranslation(0,g,0)}g=k.pose;B=null!== +p?p:a;B.matrix.copy(n);B.matrix.decompose(B.position,B.quaternion,B.scale);null!==g.orientation&&(z.fromArray(g.orientation),B.quaternion.multiply(z));null!==g.position&&(z.setFromRotationMatrix(n),w.fromArray(g.position),w.applyQuaternion(z),B.position.add(w));B.updateMatrixWorld();E.near=a.near;C.near=a.near;E.far=a.far;C.far=a.far;E.matrixWorldInverse.fromArray(k.leftViewMatrix);C.matrixWorldInverse.fromArray(k.rightViewMatrix);q.getInverse(n);'stage'===t&&(E.matrixWorldInverse.multiply(q),C.matrixWorldInverse.multiply(q)); +a=B.parent;null!==a&&(u.getInverse(a.matrixWorld),E.matrixWorldInverse.multiply(u),C.matrixWorldInverse.multiply(u));E.matrixWorld.getInverse(E.matrixWorldInverse);C.matrixWorld.getInverse(C.matrixWorldInverse);E.projectionMatrix.fromArray(k.leftProjectionMatrix);C.projectionMatrix.fromArray(k.rightProjectionMatrix);Tg(D,E,C);a=h.getLayers();a.length&&(a=a[0],null!==a.leftBounds&&4===a.leftBounds.length&&E.bounds.fromArray(a.leftBounds),null!==a.rightBounds&&4===a.rightBounds.length&&C.bounds.fromArray(a.rightBounds)); +a:for(a=0;ae.matrixWorld.determinant();wa.setMaterial(c,h);var k=z(a,B,c,e),p=!1;if(b!==g.id||Vi!==k.id||Wj!==(!0===c.wireframe))b=g.id,Vi=k.id,Wj=!0===c.wireframe,p=!0;e.morphTargetInfluences&&(Ra.update(e,g,c,k),p=!0);h=g.index;var m=g.attributes.position;B=1;!0===c.wireframe&&(h=Ya.getWireframeAttribute(g),B=2);a=Kd;if(null!==h){var l=ua.get(h);a=Ha;a.setIndex(l)}if(p){if(g&&g.isInstancedBufferGeometry&&!Da.isWebGL2&&null===qa.get('ANGLE_instanced_arrays'))console.error('THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.'); +else{wa.initAttributes();p=g.attributes;k=k.getAttributes();var n=c.defaultAttributeValues;for(fb in k){var q=k[fb];if(0<=q){var sa=p[fb];if(void 0!==sa){var r=sa.normalized,t=sa.itemSize,u=ua.get(sa);if(void 0!==u){var v=u.buffer,w=u.type;u=u.bytesPerElement;if(sa.isInterleavedBufferAttribute){var E=sa.data,C=E.stride;sa=sa.offset;E&&E.isInstancedInterleavedBuffer?(wa.enableAttributeAndDivisor(q,E.meshPerAttribute),void 0===g.maxInstancedCount&&(g.maxInstancedCount=E.meshPerAttribute*E.count)):wa.enableAttribute(q); +Xa.bindBuffer(34962,v);Xa.vertexAttribPointer(q,t,w,r,C*u,sa*u)}else sa.isInstancedBufferAttribute?(wa.enableAttributeAndDivisor(q,sa.meshPerAttribute),void 0===g.maxInstancedCount&&(g.maxInstancedCount=sa.meshPerAttribute*sa.count)):wa.enableAttribute(q),Xa.bindBuffer(34962,v),Xa.vertexAttribPointer(q,t,w,r,0,0)}}else if(void 0!==n&&(r=n[fb],void 0!==r))switch(r.length){case 2:Xa.vertexAttrib2fv(q,r);break;case 3:Xa.vertexAttrib3fv(q,r);break;case 4:Xa.vertexAttrib4fv(q,r);break;default:Xa.vertexAttrib1fv(q, +r)}}}wa.disableUnusedAttributes()}null!==h&&Xa.bindBuffer(34963,l.buffer)}l=Infinity;null!==h?l=h.count:void 0!==m&&(l=m.count);h=g.drawRange.start*B;m=null!==d?d.start*B:0;var fb=Math.max(h,m);d=Math.max(0,Math.min(l,h+g.drawRange.count*B,m+(null!==d?d.count*B:Infinity))-1-fb+1);if(0!==d){if(e.isMesh)if(!0===c.wireframe)wa.setLineWidth(c.wireframeLinewidth*(null===Pa?oa:1)),a.setMode(1);else switch(e.drawMode){case 0:a.setMode(4);break;case 1:a.setMode(5);break;case 2:a.setMode(6)}else e.isLine? +(c=c.linewidth,void 0===c&&(c=1),wa.setLineWidth(c*(null===Pa?oa:1)),e.isLineSegments?a.setMode(1):e.isLineLoop?a.setMode(2):a.setMode(3)):e.isPoints?a.setMode(0):e.isSprite&&a.setMode(4);g&&g.isInstancedBufferGeometry?0g;g++){var n=l[k[g]];var q=l[k[(g+1)%3]];d[0]=Math.min(n,q);d[1]=Math.max(n,q);n=d[0]+ +','+d[1];void 0===h[n]&&(h[n]={index1:d[0],index2:d[1]})}}for(n in h)m=h[n],k=a.vertices[m.index1],b.push(k.x,k.y,k.z),k=a.vertices[m.index2],b.push(k.x,k.y,k.z)}else if(a&&a.isBufferGeometry)if(k=new c,null!==a.index){p=a.attributes.position;l=a.index;var r=a.groups;0===r.length&&(r=[{start:0,count:l.count,materialIndex:0}]);a=0;for(e=r.length;ag;g++)n=l.getX(m+g),q=l.getX(m+(g+1)%3),d[0]=Math.min(n,q),d[1]=Math.max(n,q),n=d[0]+','+ +d[1],void 0===h[n]&&(h[n]={index1:d[0],index2:d[1]});for(n in h)m=h[n],k.fromBufferAttribute(p,m.index1),b.push(k.x,k.y,k.z),k.fromBufferAttribute(p,m.index2),b.push(k.x,k.y,k.z)}else for(p=a.attributes.position,m=0,B=p.count/3;mg;g++)h=3*m+g,k.fromBufferAttribute(p,h),b.push(k.x,k.y,k.z),h=3*m+(g+1)%3,k.fromBufferAttribute(p,h),b.push(k.x,k.y,k.z);this.addAttribute('position',new da(b,3))}function dg(a,b,g){M.call(this);this.type='ParametricGeometry';this.parameters={func:a,slices:b, +stacks:g};this.fromBufferGeometry(new ae(a,b,g));this.mergeVertices()}function ae(a,b,g){fa.call(this);this.type='ParametricBufferGeometry';this.parameters={func:a,slices:b,stacks:g};var B=[],e=[],d=[],h=[],k=new c,p=new c,m=new c,l=new c,n=new c,q,r;3>a.length&&console.error('THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.');var sa=b+1;for(q=0;q<=g;q++){var t=q/g;for(r=0;r<=b;r++){var u=r/b;a(u,t,p);e.push(p.x,p.y,p.z);0<=u-1E-5?(a(u-1E-5,t,m),l.subVectors(p,m)): +(a(u+1E-5,t,m),l.subVectors(m,p));0<=t-1E-5?(a(u,t-1E-5,m),n.subVectors(p,m)):(a(u,t+1E-5,m),n.subVectors(m,p));k.crossVectors(l,n).normalize();d.push(k.x,k.y,k.z);h.push(u,t)}}for(q=0;qB&&1===a.x&&(m[b]=a.x-1);0===g.x&&0===g.z&&(m[b]=B/2/Math.PI+.5)}fa.call(this);this.type='PolyhedronBufferGeometry';this.parameters={vertices:a,indices:b,radius:g,detail:d};g=g||1;d=d||0;var p=[],m=[];(function(a){for(var g=new c,e=new c,d=new c,k=0;kd&&(.2>b&&(m[a+0]+=1),.2>g&&(m[a+2]+=1),.2>B&&(m[a+4]+=1))})();this.addAttribute('position',new da(p,3));this.addAttribute('normal',new da(p.slice(),3));this.addAttribute('uv',new da(m,2));0===d?this.computeVertexNormals():this.normalizeNormals()}function qe(a,b){M.call(this);this.type='TetrahedronGeometry';this.parameters={radius:a,detail:b};this.fromBufferGeometry(new be(a, +b));this.mergeVertices()}function be(a,b){nb.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],a,b);this.type='TetrahedronBufferGeometry';this.parameters={radius:a,detail:b}}function ed(a,b){M.call(this);this.type='OctahedronGeometry';this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Gd(a,b));this.mergeVertices()}function Gd(a,b){nb.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],a,b);this.type='OctahedronBufferGeometry'; +this.parameters={radius:a,detail:b}}function mf(a,b){M.call(this);this.type='IcosahedronGeometry';this.parameters={radius:a,detail:b};this.fromBufferGeometry(new eg(a,b));this.mergeVertices()}function eg(a,b){var g=(1+Math.sqrt(5))/2;nb.call(this,[-1,g,0,1,g,0,-1,-g,0,1,-g,0,0,-1,g,0,1,g,0,-1,-g,0,1,-g,g,0,-1,g,0,1,-g,0,-1,-g,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,b);this.type='IcosahedronBufferGeometry'; +this.parameters={radius:a,detail:b}}function Uf(a,b){M.call(this);this.type='DodecahedronGeometry';this.parameters={radius:a,detail:b};this.fromBufferGeometry(new nf(a,b));this.mergeVertices()}function nf(a,b){var g=(1+Math.sqrt(5))/2,B=1/g;nb.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-B,-g,0,-B,g,0,B,-g,0,B,g,-B,-g,0,-B,g,0,B,-g,0,B,g,0,-g,0,-B,g,0,-B,-g,0,B,g,0,B],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18, +0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,b);this.type='DodecahedronBufferGeometry';this.parameters={radius:a,detail:b}}function Me(a,b,g,c,e,d){M.call(this);this.type='TubeGeometry';this.parameters={path:a,tubularSegments:b,radius:g,radialSegments:c,closed:e};void 0!==d&&console.warn('THREE.TubeGeometry: taper has been removed.');a=new Ee(a,b,g,c,e);this.tangents=a.tangents; +this.normals=a.normals;this.binormals=a.binormals;this.fromBufferGeometry(a);this.mergeVertices()}function Ee(a,b,g,d,h){function B(B){n=a.getPointAt(B/b,n);var c=k.normals[B];B=k.binormals[B];for(r=0;r<=d;r++){var e=r/d*Math.PI*2,h=Math.sin(e);e=-Math.cos(e);m.x=e*c.x+h*B.x;m.y=e*c.y+h*B.y;m.z=e*c.z+h*B.z;m.normalize();sa.push(m.x,m.y,m.z);p.x=n.x+g*m.x;p.y=n.y+g*m.y;p.z=n.z+g*m.z;t.push(p.x,p.y,p.z)}}fa.call(this);this.type='TubeBufferGeometry';this.parameters={path:a,tubularSegments:b,radius:g, +radialSegments:d,closed:h};b=b||64;g=g||1;d=d||8;h=h||!1;var k=a.computeFrenetFrames(b,h);this.tangents=k.tangents;this.normals=k.normals;this.binormals=k.binormals;var p=new c,m=new c,l=new e,n=new c,q,r,t=[],sa=[],u=[],z=[];for(q=0;q=b;e-=c)B=rg(e,a[e],a[e+1],B);B&&ud(B,B.next)&&(Fe(B),B=B.next);return B}function Oe(a,b){if(!a)return a;b||(b=a);do{var g=!1;if(a.steiner||!ud(a,a.next)&&0!==Pc(a.prev,a,a.next))a=a.next;else{Fe(a);a=b=a.prev;if(a===a.next)break;g=!0}}while(g||a!==b);return b}function Mf(a,b,g,c,e,d,h){if(a){if(!h&&d){var B=a,k=B;do null===k.z&&(k.z=Pd(k.x,k.y,c,e,d)),k.prevZ= +k.prev,k=k.nextZ=k.next;while(k!==B);k.prevZ.nextZ=null;k.prevZ=null;B=k;var p,m,l,n,q=1;do{k=B;var r=B=null;for(m=0;k;){m++;var t=k;for(p=l=0;pl.x?m.x>q.x?m.x:q.x:l.x>q.x?l.x:q.x,v=m.y>l.y? +m.y>q.y?m.y:q.y:l.y>q.y?l.y:q.y;p=Pd(m.x=p;){if(sa!==r.prev&&sa!==r.next&&vd(m.x,m.y,l.x,l.y,q.x,q.y,sa.x,sa.y)&&0<=Pc(sa.prev,sa,sa.next)){r=!1;break a}sa=sa.prevZ}r=!0}}else a:if(r=a,m=r.prev,l=r,q=r.next,0<=Pc(m,l,q))r=!1;else{for(p= +r.next.next;p!==r.prev;){if(vd(m.x,m.y,l.x,l.y,q.x,q.y,p.x,p.y)&&0<=Pc(p.prev,p,p.next)){r=!1;break a}p=p.next}r=!0}if(r)b.push(k.i/g),b.push(a.i/g),b.push(t.i/g),Fe(a),B=a=t.next;else if(a=t,a===B){if(!h)Mf(Oe(a),b,g,c,e,d,1);else if(1===h){h=b;B=g;k=a;do t=k.prev,r=k.next.next,!ud(t,r)&&lg(t,k,k.next,r)&&Nf(t,r)&&Nf(r,t)&&(h.push(t.i/B),h.push(k.i/B),h.push(r.i/B),Fe(k),Fe(k.next),k=a=r),k=k.next;while(k!==a);a=k;Mf(a,b,g,c,e,d,2)}else if(2===h)a:{h=a;do{for(B=h.next.next;B!==h.prev;){if(k=h.i!== +B.i){k=h;t=B;if(r=k.next.i!==t.i&&k.prev.i!==t.i){b:{r=k;do{if(r.i!==k.i&&r.next.i!==k.i&&r.i!==t.i&&r.next.i!==t.i&&lg(r,r.next,k,t)){r=!0;break b}r=r.next}while(r!==k);r=!1}r=!r}if(r=r&&Nf(k,t)&&Nf(t,k)){r=k;m=!1;l=(k.x+t.x)/2;t=(k.y+t.y)/2;do r.y>t!==r.next.y>t&&r.next.y!==r.y&&l<(r.next.x-r.x)*(t-r.y)/(r.next.y-r.y)+r.x&&(m=!m),r=r.next;while(r!==k);r=m}k=r}if(k){a=Pe(h,B);h=Oe(h,h.next);a=Oe(a,a.next);Mf(h,b,g,c,e,d);Mf(a,b,g,c,e,d);break a}B=B.next}h=h.next}while(h!==a)}break}}}}function uf(a, +b){return a.x-b.x}function re(a,b){var g=b,B=a.x,c=a.y,e=-Infinity;do{if(c<=g.y&&c>=g.next.y&&g.next.y!==g.y){var d=g.x+(c-g.y)*(g.next.x-g.x)/(g.next.y-g.y);if(d<=B&&d>e){e=d;if(d===B){if(c===g.y)return g;if(c===g.next.y)return g.next}var h=g.x=g.x&&g.x>=d&&B!==g.x&&vd(ch.x)&&Nf(g, +a)&&(h=g,p=m)}g=g.next}return h}function Pd(a,b,g,c,e){a=32767*(a-g)*e;b=32767*(b-c)*e;a=(a|a<<8)&16711935;a=(a|a<<4)&252645135;a=(a|a<<2)&858993459;b=(b|b<<8)&16711935;b=(b|b<<4)&252645135;b=(b|b<<2)&858993459;return(a|a<<1)&1431655765|((b|b<<1)&1431655765)<<1}function ie(a){var b=a,g=a;do b.xPc(a.prev,a,a.next)?0<=Pc(a,b,a.next)&&0<=Pc(a,a.prev,b):0>Pc(a,b,a.prev)||0>Pc(a,a.next,b)}function Pe(a,b){var g=new eh(a.i,a.x,a.y),B=new eh(b.i,b.x,b.y),c=a.next,e=b.prev;a.next=b;b.prev=a;g.next=c;c.prev=g;B.next=g;g.prev=B;e.next=B;B.prev=e;return B}function rg(a,b,g,c){a=new eh(a,b,g); +c?(a.next=c.next,a.prev=c,c.next.prev=a,c.next=a):(a.prev=a,a.next=a);return a}function Fe(a){a.next.prev=a.prev;a.prev.next=a.next;a.prevZ&&(a.prevZ.nextZ=a.nextZ);a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function eh(a,b,g){this.i=a;this.x=b;this.y=g;this.nextZ=this.prevZ=this.z=this.next=this.prev=null;this.steiner=!1}function zg(a){var b=a.length;2Number.EPSILON){var p=Math.sqrt(k),m=Math.sqrt(d*d+h*h);k=b.x-c/p;b=b.y+B/p;h=((g.x-h/m-k)*h-(g.y+d/m-b)*d)/(B*h-c*d);d=k+B*h-a.x;B=b+c*h-a.y;c=d*d+ +B*B;if(2>=c)return new e(d,B);c=Math.sqrt(c/2)}else a=!1,B>Number.EPSILON?d>Number.EPSILON&&(a=!0):B<-Number.EPSILON?d<-Number.EPSILON&&(a=!0):Math.sign(c)===Math.sign(h)&&(a=!0),a?(d=-c,c=Math.sqrt(k)):(d=B,B=c,c=Math.sqrt(k/2));return new e(d/c,B/c)}function p(a,b){for(lb=a.length;0<=--lb;){var g=lb;var c=lb-1;0>c&&(c=a.length-1);var e,h=sa+2*C;for(e=0;em;m++){var l=p[e[m]];var n=p[e[(m+1)%3]];B[0]=Math.min(l,n);B[1]=Math.max(l,n);l=B[0]+','+B[1];void 0===c[l]?c[l]={index1:B[0], +index2:B[1],face1:h,face2:void 0}:c[l].face2=h}for(l in c)if(B=c[l],void 0===B.face2||d[B.face1].normal.dot(d[B.face2].normal)<=b)e=a[B.index1],g.push(e.x,e.y,e.z),e=a[B.index2],g.push(e.x,e.y,e.z);this.addAttribute('position',new da(g,3))}function of(a,b,g,c,e,d,h,k){M.call(this);this.type='CylinderGeometry';this.parameters={radiusTop:a,radiusBottom:b,height:g,radialSegments:c,heightSegments:e,openEnded:d,thetaStart:h,thetaLength:k};this.fromBufferGeometry(new ye(a,b,g,c,e,d,h,k));this.mergeVertices()} +function ye(a,b,g,d,h,k,p,m){function B(g){var B,h=new e,k=new c,u=0,w=!0===g?a:b,E=!0===g?1:-1;var C=sa;for(B=1;B<=d;B++)q.push(0,z*E,0),r.push(0,E,0),t.push(.5,.5),sa++;var D=sa;for(B=0;B<=d;B++){var fb=B/d*m+p,K=Math.cos(fb);fb=Math.sin(fb);k.x=w*fb;k.y=z*E;k.z=w*K;q.push(k.x,k.y,k.z);r.push(0,E,0);h.x=.5*K+.5;h.y=.5*fb*E+.5;t.push(h.x,h.y);sa++}for(B=0;Bthis.duration&&this.resetDuration()}function pf(a){switch(a.toLowerCase()){case 'scalar':case 'double':case 'float':case 'number':case 'integer':return Ge;case 'vector':case 'vector2':case 'vector3':case 'vector4':return Xd;case 'color':return Yh;case 'quaternion':return Gg;case 'bool':case 'boolean':return je;case 'string':return Ji}throw Error('THREE.KeyframeTrack: Unsupported typeName: '+a);}function Jj(a){if(void 0===a.type)throw Error('THREE.KeyframeTrack: track type undefined, can not parse'); +var b=pf(a.type);if(void 0===a.times){var g=[],B=[];yc.flattenJSON(a.keys,g,B,'value');a.times=g;a.values=B}return void 0!==b.parse?b.parse(a):new b(a.name,a.times,a.values,a.interpolation)}function Zi(a,b,g){var B=this,c=!1,e=0,d=0,h=void 0;this.onStart=void 0;this.onLoad=a;this.onProgress=b;this.onError=g;this.itemStart=function(a){d++;if(!1===c&&void 0!==B.onStart)B.onStart(a,e,d);c=!0};this.itemEnd=function(a){e++;if(void 0!==B.onProgress)B.onProgress(a,e,d);if(e===d&&(c=!1,void 0!==B.onLoad))B.onLoad()}; +this.itemError=function(a){if(void 0!==B.onError)B.onError(a)};this.resolveURL=function(a){return h?h(a):a};this.setURLModifier=function(a){h=a;return this}}function ff(a){this.manager=void 0!==a?a:wd}function Hg(a){this.manager=void 0!==a?a:wd}function qi(a){this.manager=void 0!==a?a:wd;this._parser=null}function Yf(a){this.manager=void 0!==a?a:wd;this._parser=null}function Pg(a){this.manager=void 0!==a?a:wd}function bh(a){this.manager=void 0!==a?a:wd}function gh(a){this.manager=void 0!==a?a:wd} +function Mb(){this.type='Curve';this.arcLengthDivisions=200}function Ag(a,b,g,c,e,d,h,k){Mb.call(this);this.type='EllipseCurve';this.aX=a||0;this.aY=b||0;this.xRadius=g||1;this.yRadius=c||1;this.aStartAngle=e||0;this.aEndAngle=d||2*Math.PI;this.aClockwise=h||!1;this.aRotation=k||0}function $h(a,b,g,c,e,d){Ag.call(this,a,b,g,g,c,e,d);this.type='ArcCurve'}function ai(){var a=0,b=0,g=0,c=0;return{initCatmullRom:function(B,e,d,h,k){B=k*(d-B);h=k*(h-e);a=e;b=B;g=-3*e+3*d-2*B-h;c=2*e-2*d+B+h},initNonuniformCatmullRom:function(B, +e,d,h,k,p,m){B=((e-B)/k-(d-B)/(k+p)+(d-e)/p)*p;h=((d-e)/p-(h-e)/(p+m)+(h-d)/m)*p;a=e;b=B;g=-3*e+3*d-2*B-h;c=2*e-2*d+B+h},calc:function(B){var e=B*B;return a+b*B+g*e+c*e*B}}}function se(a,b,g,c){Mb.call(this);this.type='CatmullRomCurve3';this.points=a||[];this.closed=b||!1;this.curveType=g||'centripetal';this.tension=c||.5}function bi(a,b,g,c,e){b=.5*(c-b);e=.5*(e-g);var B=a*a;return(2*g-2*c+b+e)*a*B+(-3*g+3*c-2*b-e)*B+b*a+g}function Pf(a,b,g,c){var B=1-a;return B*B*b+2*(1-a)*a*g+a*a*c}function ng(a, +b,g,c,e){var B=1-a,d=1-a;return B*B*B*b+3*d*d*a*g+3*(1-a)*a*a*c+a*a*a*e}function ze(a,b,g,c){Mb.call(this);this.type='CubicBezierCurve';this.v0=a||new e;this.v1=b||new e;this.v2=g||new e;this.v3=c||new e}function hh(a,b,g,e){Mb.call(this);this.type='CubicBezierCurve3';this.v0=a||new c;this.v1=b||new c;this.v2=g||new c;this.v3=e||new c}function qf(a,b){Mb.call(this);this.type='LineCurve';this.v1=a||new e;this.v2=b||new e}function wg(a,b){Mb.call(this);this.type='LineCurve3';this.v1=a||new c;this.v2= +b||new c}function xf(a,b,g){Mb.call(this);this.type='QuadraticBezierCurve';this.v0=a||new e;this.v1=b||new e;this.v2=g||new e}function Qf(a,b,g){Mb.call(this);this.type='QuadraticBezierCurve3';this.v0=a||new c;this.v1=b||new c;this.v2=g||new c}function te(a){Mb.call(this);this.type='SplineCurve';this.points=a||[]}function Ie(){Mb.call(this);this.type='CurvePath';this.curves=[];this.autoClose=!1}function Rf(a){Ie.call(this);this.type='Path';this.currentPoint=new e;a&&this.setFromPoints(a)}function ch(a){Rf.call(this, +a);this.uuid=cb.generateUUID();this.type='Shape';this.holes=[]}function sd(a,b){Q.call(this);this.type='Light';this.color=new w(a);this.intensity=void 0!==b?b:1;this.receiveShadow=void 0}function ih(a,b,g){sd.call(this,a,g);this.type='HemisphereLight';this.castShadow=void 0;this.position.copy(Q.DefaultUp);this.updateMatrix();this.groundColor=new w(b)}function mh(a){this.camera=a;this.bias=0;this.radius=1;this.mapSize=new e(512,512);this.map=null;this.matrix=new v}function ci(){mh.call(this,new fe(50, +1,.5,500))}function Wg(a,b,g,c,e,d){sd.call(this,a,b);this.type='SpotLight';this.position.copy(Q.DefaultUp);this.updateMatrix();this.target=new Q;Object.defineProperty(this,'power',{get:function(){return this.intensity*Math.PI},set:function(a){this.intensity=a/Math.PI}});this.distance=void 0!==g?g:0;this.angle=void 0!==c?c:Math.PI/3;this.penumbra=void 0!==e?e:0;this.decay=void 0!==d?d:1;this.shadow=new ci}function di(a,b,g,c){sd.call(this,a,b);this.type='PointLight';Object.defineProperty(this,'power', +{get:function(){return 4*this.intensity*Math.PI},set:function(a){this.intensity=a/(4*Math.PI)}});this.distance=void 0!==g?g:0;this.decay=void 0!==c?c:1;this.shadow=new mh(new fe(90,1,.5,500))}function nh(a,b,g,c,e,d){kd.call(this);this.type='OrthographicCamera';this.zoom=1;this.view=null;this.left=void 0!==a?a:-1;this.right=void 0!==b?b:1;this.top=void 0!==g?g:1;this.bottom=void 0!==c?c:-1;this.near=void 0!==e?e:.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()}function ei(){mh.call(this, +new nh(-5,5,5,-5,.5,500))}function fi(a,b){sd.call(this,a,b);this.type='DirectionalLight';this.position.copy(Q.DefaultUp);this.updateMatrix();this.target=new Q;this.shadow=new ei}function xh(a,b){sd.call(this,a,b);this.type='AmbientLight';this.castShadow=void 0}function gi(a,b,g,c){sd.call(this,a,b);this.type='RectAreaLight';this.width=void 0!==g?g:10;this.height=void 0!==c?c:10}function Ae(a){this.manager=void 0!==a?a:wd;this.textures={}}function oh(a){this.manager=void 0!==a?a:wd}function Bg(a){this.manager= +void 0!==a?a:wd;this.resourcePath=''}function og(a){'undefined'===typeof createImageBitmap&&console.warn('THREE.ImageBitmapLoader: createImageBitmap() not supported.');'undefined'===typeof fetch&&console.warn('THREE.ImageBitmapLoader: fetch() not supported.');this.manager=void 0!==a?a:wd;this.options=void 0}function ri(){this.type='ShapePath';this.color=new w;this.subPaths=[];this.currentPath=null}function si(a){this.type='Font';this.data=a}function pj(a){this.manager=void 0!==a?a:wd}function hi(){} +function Ki(a){this.manager=void 0!==a?a:wd}function ti(){this.coefficients=[];for(var a=0;9>a;a++)this.coefficients.push(new c)}function Sf(a,b){sd.call(this,void 0,b);this.sh=void 0!==a?a:new ti}function Be(a,b,g){Sf.call(this,void 0,g);a=(new w).set(a);g=(new w).set(b);b=new c(a.r,a.g,a.b);a=new c(g.r,g.g,g.b);g=Math.sqrt(Math.PI);var B=g*Math.sqrt(.75);this.sh.coefficients[0].copy(b).add(a).multiplyScalar(g);this.sh.coefficients[1].copy(b).sub(a).multiplyScalar(B)}function ui(a,b){Sf.call(this, +void 0,b);a=(new w).set(a);this.sh.coefficients[0].set(a.r,a.g,a.b).multiplyScalar(2*Math.sqrt(Math.PI))}function qj(){this.type='StereoCamera';this.aspect=1;this.eyeSep=.064;this.cameraL=new fe;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate=!1;this.cameraR=new fe;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1}function Li(a,b,g,e){Q.call(this);this.type='CubeCamera';var B=new fe(90,1,a,b);B.up.set(0,-1,0);B.lookAt(new c(1,0,0));this.add(B);var d=new fe(90,1,a,b);d.up.set(0, +-1,0);d.lookAt(new c(-1,0,0));this.add(d);var h=new fe(90,1,a,b);h.up.set(0,0,1);h.lookAt(new c(0,1,0));this.add(h);var k=new fe(90,1,a,b);k.up.set(0,0,-1);k.lookAt(new c(0,-1,0));this.add(k);var p=new fe(90,1,a,b);p.up.set(0,-1,0);p.lookAt(new c(0,0,1));this.add(p);var l=new fe(90,1,a,b);l.up.set(0,-1,0);l.lookAt(new c(0,0,-1));this.add(l);e=e||{format:1022,magFilter:1006,minFilter:1006};this.renderTarget=new m(g,g,e);this.renderTarget.texture.name='CubeCamera';this.update=function(a,b){null===this.parent&& +this.updateMatrixWorld();var g=a.getRenderTarget(),c=this.renderTarget,e=c.texture.generateMipmaps;c.texture.generateMipmaps=!1;a.setRenderTarget(c,0);a.render(b,B);a.setRenderTarget(c,1);a.render(b,d);a.setRenderTarget(c,2);a.render(b,h);a.setRenderTarget(c,3);a.render(b,k);a.setRenderTarget(c,4);a.render(b,p);c.texture.generateMipmaps=e;a.setRenderTarget(c,5);a.render(b,l);a.setRenderTarget(g)};this.clear=function(a,b,g,B){for(var c=a.getRenderTarget(),e=this.renderTarget,d=0;6>d;d++)a.setRenderTarget(e, +d),a.clear(b,g,B);a.setRenderTarget(c)}}function rj(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1}function $i(){Q.call(this);this.type='AudioListener';this.context=aj.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null;this.timeDelta=0}function vi(a){Q.call(this);this.type='Audio';this.listener=a;this.context=a.context;this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay= +!1;this.buffer=null;this.detune=0;this.loop=!1;this.offset=this.startTime=0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType='empty';this.filters=[]}function sj(a){vi.call(this,a);this.panner=this.context.createPanner();this.panner.connect(this.gain)}function wi(a,b){this.analyser=a.context.createAnalyser();this.analyser.fftSize=void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)}function bj(a,b,g){this.binding= +a;this.valueSize=g;a=Float64Array;switch(b){case 'quaternion':b=this._slerp;break;case 'string':case 'bool':a=Array;b=this._select;break;default:b=this._lerp}this.buffer=new a(4*g);this._mixBufferRegion=b;this.referenceCount=this.useCount=this.cumulativeWeight=0}function tj(a,b,g){g=g||Qd.parseTrackName(b);this._targetGroup=a;this._bindings=a.subscribe_(b,g)}function Qd(a,b,g){this.path=b;this.parsedPath=g||Qd.parseTrackName(b);this.node=Qd.findNode(a,this.parsedPath.nodeName)||a;this.rootNode=a} +function Kj(){this.uuid=cb.generateUUID();this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;var a={};this._indicesByUUID=a;for(var b=0,g=arguments.length;b!==g;++b)a[arguments[b].uuid]=b;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var c=this;this.stats={objects:{get total(){return c._objects.length},get inUse(){return this.total-c.nCachedObjects_}},get bindingsPerObject(){return c._bindings.length}}}function Lj(a,b,g){this._mixer=a; +this._clip=b;this._localRoot=g||null;a=b.tracks;b=a.length;g=Array(b);for(var c={endingStart:2400,endingEnd:2400},B=0;B!==b;++B){var e=a[B].createInterpolant(null);g[B]=e;e.settings=c}this._interpolantSettings=c;this._interpolants=g;this._propertyBindings=Array(b);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale= +1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function Bd(a){this._root=a;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function cj(a,b){'string'===typeof a&&(console.warn('THREE.Uniform: Type parameter is no longer needed.'),a=b);this.value=a}function yh(){fa.call(this);this.type='InstancedBufferGeometry';this.maxInstancedCount=void 0}function xi(a,b,g){ge.call(this,a,b);this.meshPerAttribute= +g||1}function dj(a,b,g,c){'number'===typeof g&&(c=g,g=!1,console.error('THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.'));X.call(this,a,b,g);this.meshPerAttribute=c||1}function uj(a,b,g,c){this.ray=new wa(a,b);this.near=g||0;this.far=c||Infinity;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn('THREE.Raycaster: params.PointCloud has been renamed to params.Points.'); +return this.Points}}})}function vj(a,b){return a.distance-b.distance}function ej(a,b,g,c){if(!1!==a.visible&&(a.raycast(b,g),!0===c)){a=a.children;c=0;for(var B=a.length;cg;g++,c++){var B=g/32*Math.PI*2,e=c/32*Math.PI*2;b.push(Math.cos(B),Math.sin(B),1,Math.cos(e),Math.sin(e),1)}a.addAttribute('position',new da(b,3));b=new Cb({fog:!1});this.cone=new Db(a,b);this.add(this.cone);this.update()}function Ni(a){var b=[];a&&a.isBone&&b.push(a); +for(var g=0;ga?-1:0b;b++)a[b]=(16>b?'0':'')+b.toString(16); -return function(){var b=4294967295*Math.random()|0,e=4294967295*Math.random()|0,c=4294967295*Math.random()|0,d=4294967295*Math.random()|0;return(a[b&255]+a[b>>8&255]+a[b>>16&255]+a[b>>24&255]+'-'+a[e&255]+a[e>>8&255]+'-'+a[e>>16&15|64]+a[e>>24&255]+'-'+a[c&63|128]+a[c>>8&255]+'-'+a[c>>16&255]+a[c>>24&255]+a[d&255]+a[d>>8&255]+a[d>>16&255]+a[d>>24&255]).toUpperCase()}}(),clamp:function(a,b,e){return Math.max(b,Math.min(e,a))},euclideanModulo:function(a,b){return(a%b+b)%b},mapLinear:function(a,b,e, -c,d){return c+(a-b)*(d-c)/(e-b)},lerp:function(a,b,e){return(1-e)*a+e*b},smoothstep:function(a,b,e){if(a<=b)return 0;if(a>=e)return 1;a=(a-b)/(e-b);return a*a*(3-2*a)},smootherstep:function(a,b,e){if(a<=b)return 0;if(a>=e)return 1;a=(a-b)/(e-b);return a*a*a*(a*(6*a-15)+10)},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random())},degToRad:function(a){return a*ac.DEG2RAD},radToDeg:function(a){return a* -ac.RAD2DEG},isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},ceilPowerOfTwo:function(a){return Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))},floorPowerOfTwo:function(a){return Math.pow(2,Math.floor(Math.log(a)/Math.LN2))}};Object.defineProperties(d.prototype,{width:{get:function(){return this.x},set:function(a){this.x=a}},height:{get:function(){return this.y},set:function(a){this.y=a}}});Object.assign(d.prototype,{isVector2:!0,set:function(a,b){this.x=a;this.y=b;return this},setScalar:function(a){this.y= +a||null===a)throw new TypeError('Cannot convert undefined or null to object');for(var b=Object(a),g=1;gb;b++)a[b]=(16>b?'0':'')+b.toString(16); +return function(){var b=4294967295*Math.random()|0,g=4294967295*Math.random()|0,c=4294967295*Math.random()|0,e=4294967295*Math.random()|0;return(a[b&255]+a[b>>8&255]+a[b>>16&255]+a[b>>24&255]+'-'+a[g&255]+a[g>>8&255]+'-'+a[g>>16&15|64]+a[g>>24&255]+'-'+a[c&63|128]+a[c>>8&255]+'-'+a[c>>16&255]+a[c>>24&255]+a[e&255]+a[e>>8&255]+a[e>>16&255]+a[e>>24&255]).toUpperCase()}}(),clamp:function(a,b,g){return Math.max(b,Math.min(g,a))},euclideanModulo:function(a,b){return(a%b+b)%b},mapLinear:function(a,b,g, +c,e){return c+(a-b)*(e-c)/(g-b)},lerp:function(a,b,g){return(1-g)*a+g*b},smoothstep:function(a,b,g){if(a<=b)return 0;if(a>=g)return 1;a=(a-b)/(g-b);return a*a*(3-2*a)},smootherstep:function(a,b,g){if(a<=b)return 0;if(a>=g)return 1;a=(a-b)/(g-b);return a*a*a*(a*(6*a-15)+10)},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random())},degToRad:function(a){return a*cb.DEG2RAD},radToDeg:function(a){return a* +cb.RAD2DEG},isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},ceilPowerOfTwo:function(a){return Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))},floorPowerOfTwo:function(a){return Math.pow(2,Math.floor(Math.log(a)/Math.LN2))}};Object.defineProperties(e.prototype,{width:{get:function(){return this.x},set:function(a){this.x=a}},height:{get:function(){return this.y},set:function(a){this.y=a}}});Object.assign(e.prototype,{isVector2:!0,set:function(a,b){this.x=a;this.y=b;return this},setScalar:function(a){this.y= this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error('index is out of range: '+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error('index is out of range: '+a);}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a, b){if(void 0!==b)return console.warn('THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;return this},sub:function(a,b){if(void 0!==b)return console.warn('THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'), -this.subVectors(a,b);this.x-=a.x;this.y-=a.y;return this},subScalar:function(a){this.x-=a;this.y-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},applyMatrix3:function(a){var b=this.x,e=this.y;a=a.elements;this.x=a[0]*b+a[3]*e+a[6];this.y= -a[1]*b+a[4]*e+a[7];return this},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));return this},clampScalar:function(){var a=new d,b=new d;return function(e,c){a.set(e,e);b.set(c,c);return this.clamp(a,b)}}(),clampLength:function(a,b){var e=this.length();return this.divideScalar(e|| -1).multiplyScalar(Math.max(a,Math.min(b,e)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(a){return this.x* +this.subVectors(a,b);this.x-=a.x;this.y-=a.y;return this},subScalar:function(a){this.x-=a;this.y-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},applyMatrix3:function(a){var b=this.x,g=this.y;a=a.elements;this.x=a[0]*b+a[3]*g+a[6];this.y= +a[1]*b+a[4]*g+a[7];return this},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));return this},clampScalar:function(a,b){this.x=Math.max(a,Math.min(b,this.x));this.y=Math.max(a,Math.min(b,this.y));return this},clampLength:function(a,b){var g=this.length();return this.divideScalar(g|| +1).multiplyScalar(Math.max(a,Math.min(b,g)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(a){return this.x* a.x+this.y*a.y},cross:function(a){return this.x*a.y-this.y*a.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var a=Math.atan2(this.y,this.x);0>a&&(a+=2*Math.PI);return a},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b= -this.x-a.x;a=this.y-a.y;return b*b+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},lerpVectors:function(a,b,e){return this.subVectors(b,a).multiplyScalar(e).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toArray:function(a, -b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},fromBufferAttribute:function(a,b,e){void 0!==e&&console.warn('THREE.Vector2: offset has been removed from .fromBufferAttribute().');this.x=a.getX(b);this.y=a.getY(b);return this},rotateAround:function(a,b){var e=Math.cos(b);b=Math.sin(b);var c=this.x-a.x,d=this.y-a.y;this.x=c*e-d*b+a.x;this.y=c*b+d*e+a.y;return this}});Object.assign(c.prototype,{isMatrix4:!0,set:function(a,b,e,c,d,g,h,k,n,m,l,p,q,r,u,t){var B=this.elements; -B[0]=a;B[4]=b;B[8]=e;B[12]=c;B[1]=d;B[5]=g;B[9]=h;B[13]=k;B[2]=n;B[6]=m;B[10]=l;B[14]=p;B[3]=q;B[7]=r;B[11]=u;B[15]=t;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new c).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return this},copyPosition:function(a){var b= -this.elements;a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractBasis:function(a,b,e){a.setFromMatrixColumn(this,0);b.setFromMatrixColumn(this,1);e.setFromMatrixColumn(this,2);return this},makeBasis:function(a,b,e){this.set(a.x,b.x,e.x,0,a.y,b.y,e.y,0,a.z,b.z,e.z,0,0,0,0,1);return this},extractRotation:function(){var a=new h;return function(b){var e=this.elements,c=b.elements,d=1/a.setFromMatrixColumn(b,0).length(),g=1/a.setFromMatrixColumn(b,1).length();b=1/a.setFromMatrixColumn(b, -2).length();e[0]=c[0]*d;e[1]=c[1]*d;e[2]=c[2]*d;e[3]=0;e[4]=c[4]*g;e[5]=c[5]*g;e[6]=c[6]*g;e[7]=0;e[8]=c[8]*b;e[9]=c[9]*b;e[10]=c[10]*b;e[11]=0;e[12]=0;e[13]=0;e[14]=0;e[15]=1;return this}}(),makeRotationFromEuler:function(a){a&&a.isEuler||console.error('THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.');var b=this.elements,e=a.x,c=a.y,d=a.z,g=Math.cos(e);e=Math.sin(e);var B=Math.cos(c);c=Math.sin(c);var h=Math.cos(d);d=Math.sin(d);if('XYZ'===a.order){a= -g*h;var k=g*d,n=e*h,m=e*d;b[0]=B*h;b[4]=-B*d;b[8]=c;b[1]=k+n*c;b[5]=a-m*c;b[9]=-e*B;b[2]=m-a*c;b[6]=n+k*c;b[10]=g*B}else'YXZ'===a.order?(a=B*h,k=B*d,n=c*h,m=c*d,b[0]=a+m*e,b[4]=n*e-k,b[8]=g*c,b[1]=g*d,b[5]=g*h,b[9]=-e,b[2]=k*e-n,b[6]=m+a*e,b[10]=g*B):'ZXY'===a.order?(a=B*h,k=B*d,n=c*h,m=c*d,b[0]=a-m*e,b[4]=-g*d,b[8]=n+k*e,b[1]=k+n*e,b[5]=g*h,b[9]=m-a*e,b[2]=-g*c,b[6]=e,b[10]=g*B):'ZYX'===a.order?(a=g*h,k=g*d,n=e*h,m=e*d,b[0]=B*h,b[4]=n*c-k,b[8]=a*c+m,b[1]=B*d,b[5]=m*c+a,b[9]=k*c-n,b[2]=-c,b[6]=e* -B,b[10]=g*B):'YZX'===a.order?(a=g*B,k=g*c,n=e*B,m=e*c,b[0]=B*h,b[4]=m-a*d,b[8]=n*d+k,b[1]=d,b[5]=g*h,b[9]=-e*h,b[2]=-c*h,b[6]=k*d+n,b[10]=a-m*d):'XZY'===a.order&&(a=g*B,k=g*c,n=e*B,m=e*c,b[0]=B*h,b[4]=-d,b[8]=c*h,b[1]=a*d+m,b[5]=g*h,b[9]=k*d-n,b[2]=n*d-k,b[6]=e*h,b[10]=m*d+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},makeRotationFromQuaternion:function(){var a=new h(0,0,0),b=new h(1,1,1);return function(e){return this.compose(a,e,b)}}(),lookAt:function(){var a=new h,b=new h, -e=new h;return function(c,d,g){var B=this.elements;e.subVectors(c,d);0===e.lengthSq()&&(e.z=1);e.normalize();a.crossVectors(g,e);0===a.lengthSq()&&(1===Math.abs(g.z)?e.x+=1E-4:e.z+=1E-4,e.normalize(),a.crossVectors(g,e));a.normalize();b.crossVectors(e,a);B[0]=a.x;B[4]=b.x;B[8]=e.x;B[1]=a.y;B[5]=b.y;B[9]=e.y;B[2]=a.z;B[6]=b.z;B[10]=e.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn('THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.'), -this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},premultiply:function(a){return this.multiplyMatrices(a,this)},multiplyMatrices:function(a,b){var e=a.elements,c=b.elements;b=this.elements;a=e[0];var d=e[4],g=e[8],B=e[12],h=e[1],k=e[5],n=e[9],m=e[13],l=e[2],p=e[6],q=e[10],r=e[14],u=e[3],t=e[7],v=e[11];e=e[15];var Aa=c[0],w=c[4],z=c[8],D=c[12],H=c[1],C=c[5],K=c[9],G=c[13],U=c[2],I=c[6],P=c[10],xa=c[14],Q=c[3],fa=c[7],L=c[11];c=c[15];b[0]=a*Aa+d*H+g*U+B*Q;b[4]=a*w+d*C+g*I+B*fa;b[8]=a*z+d*K+ -g*P+B*L;b[12]=a*D+d*G+g*xa+B*c;b[1]=h*Aa+k*H+n*U+m*Q;b[5]=h*w+k*C+n*I+m*fa;b[9]=h*z+k*K+n*P+m*L;b[13]=h*D+k*G+n*xa+m*c;b[2]=l*Aa+p*H+q*U+r*Q;b[6]=l*w+p*C+q*I+r*fa;b[10]=l*z+p*K+q*P+r*L;b[14]=l*D+p*G+q*xa+r*c;b[3]=u*Aa+t*H+v*U+e*Q;b[7]=u*w+t*C+v*I+e*fa;b[11]=u*z+t*K+v*P+e*L;b[15]=u*D+t*G+v*xa+e*c;return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this}, -applyToBufferAttribute:function(){var a=new h;return function(b){for(var e=0,c=b.count;ethis.determinant()&&(B=-B);e.x=g[12];e.y=g[13];e.z=g[14];b.copy(this);e=1/B;g=1/h;var n=1/k;b.elements[0]*=e;b.elements[1]*=e;b.elements[2]*=e;b.elements[4]*=g;b.elements[5]*=g;b.elements[6]*=g;b.elements[8]*=n;b.elements[9]*=n;b.elements[10]*=n;c.setFromRotationMatrix(b);d.x=B;d.y=h;d.z=k;return this}}(),makePerspective:function(a,b,e,c,d,g){void 0===g&&console.warn('THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.'); -var B=this.elements;B[0]=2*d/(b-a);B[4]=0;B[8]=(b+a)/(b-a);B[12]=0;B[1]=0;B[5]=2*d/(e-c);B[9]=(e+c)/(e-c);B[13]=0;B[2]=0;B[6]=0;B[10]=-(g+d)/(g-d);B[14]=-2*g*d/(g-d);B[3]=0;B[7]=0;B[11]=-1;B[15]=0;return this},makeOrthographic:function(a,b,e,c,d,g){var B=this.elements,h=1/(b-a),k=1/(e-c),n=1/(g-d);B[0]=2*h;B[4]=0;B[8]=0;B[12]=-((b+a)*h);B[1]=0;B[5]=2*k;B[9]=0;B[13]=-((e+c)*k);B[2]=0;B[6]=0;B[10]=-2*n;B[14]=-((g+d)*n);B[3]=0;B[7]=0;B[11]=0;B[15]=1;return this},equals:function(a){var b=this.elements; -a=a.elements;for(var e=0;16>e;e++)if(b[e]!==a[e])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var e=0;16>e;e++)this.elements[e]=a[e+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var e=this.elements;a[b]=e[0];a[b+1]=e[1];a[b+2]=e[2];a[b+3]=e[3];a[b+4]=e[4];a[b+5]=e[5];a[b+6]=e[6];a[b+7]=e[7];a[b+8]=e[8];a[b+9]=e[9];a[b+10]=e[10];a[b+11]=e[11];a[b+12]=e[12];a[b+13]=e[13];a[b+14]=e[14];a[b+15]=e[15];return a}});Object.assign(g,{slerp:function(a,b,e,c){return e.copy(a).slerp(b, -c)},slerpFlat:function(a,b,e,c,d,g,h){var B=e[c+0],k=e[c+1],n=e[c+2];e=e[c+3];c=d[g+0];var m=d[g+1],l=d[g+2];d=d[g+3];if(e!==d||B!==c||k!==m||n!==l){g=1-h;var p=B*c+k*m+n*l+e*d,q=0<=p?1:-1,r=1-p*p;r>Number.EPSILON&&(r=Math.sqrt(r),p=Math.atan2(r,p*q),g=Math.sin(g*p)/r,h=Math.sin(h*p)/r);q*=h;B=B*g+c*q;k=k*g+m*q;n=n*g+l*q;e=e*g+d*q;g===1-h&&(h=1/Math.sqrt(B*B+k*k+n*n+e*e),B*=h,k*=h,n*=h,e*=h)}a[b]=B;a[b+1]=k;a[b+2]=n;a[b+3]=e}});Object.defineProperties(g.prototype,{x:{get:function(){return this._x}, -set:function(a){this._x=a;this.onChangeCallback()}},y:{get:function(){return this._y},set:function(a){this._y=a;this.onChangeCallback()}},z:{get:function(){return this._z},set:function(a){this._z=a;this.onChangeCallback()}},w:{get:function(){return this._w},set:function(a){this._w=a;this.onChangeCallback()}}});Object.assign(g.prototype,{isQuaternion:!0,set:function(a,b,e,c){this._x=a;this._y=b;this._z=e;this._w=c;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x, -this._y,this._z,this._w)},copy:function(a){this._x=a.x;this._y=a.y;this._z=a.z;this._w=a.w;this.onChangeCallback();return this},setFromEuler:function(a,b){if(!a||!a.isEuler)throw Error('THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.');var e=a._x,c=a._y,d=a._z;a=a.order;var g=Math.cos,B=Math.sin,h=g(e/2),k=g(c/2);g=g(d/2);e=B(e/2);c=B(c/2);d=B(d/2);'XYZ'===a?(this._x=e*k*g+h*c*d,this._y=h*c*g-e*k*d,this._z=h*k*d+e*c*g,this._w=h*k*g-e*c*d):'YXZ'===a? -(this._x=e*k*g+h*c*d,this._y=h*c*g-e*k*d,this._z=h*k*d-e*c*g,this._w=h*k*g+e*c*d):'ZXY'===a?(this._x=e*k*g-h*c*d,this._y=h*c*g+e*k*d,this._z=h*k*d+e*c*g,this._w=h*k*g-e*c*d):'ZYX'===a?(this._x=e*k*g-h*c*d,this._y=h*c*g+e*k*d,this._z=h*k*d-e*c*g,this._w=h*k*g+e*c*d):'YZX'===a?(this._x=e*k*g+h*c*d,this._y=h*c*g+e*k*d,this._z=h*k*d-e*c*g,this._w=h*k*g-e*c*d):'XZY'===a&&(this._x=e*k*g-h*c*d,this._y=h*c*g-e*k*d,this._z=h*k*d+e*c*g,this._w=h*k*g+e*c*d);if(!1!==b)this.onChangeCallback();return this},setFromAxisAngle:function(a, -b){b/=2;var e=Math.sin(b);this._x=a.x*e;this._y=a.y*e;this._z=a.z*e;this._w=Math.cos(b);this.onChangeCallback();return this},setFromRotationMatrix:function(a){var b=a.elements,e=b[0];a=b[4];var c=b[8],d=b[1],g=b[5],B=b[9],h=b[2],k=b[6];b=b[10];var n=e+g+b;0g&&e>b?(e=2*Math.sqrt(1+e-g-b),this._w=(k-B)/e,this._x=.25*e,this._y=(a+d)/e,this._z=(c+h)/e):g>b?(e=2*Math.sqrt(1+g-e-b),this._w=(c-h)/e,this._x=(a+d)/e,this._y= -.25*e,this._z=(B+k)/e):(e=2*Math.sqrt(1+b-e-g),this._w=(d-a)/e,this._x=(c+h)/e,this._y=(B+k)/e,this._z=.25*e);this.onChangeCallback();return this},setFromUnitVectors:function(){var a=new h,b;return function(e,c){void 0===a&&(a=new h);b=e.dot(c)+1;1E-6>b?(b=0,Math.abs(e.x)>Math.abs(e.z)?a.set(-e.y,e.x,0):a.set(0,-e.z,e.y)):a.crossVectors(e,c);this._x=a.x;this._y=a.y;this._z=a.z;this._w=b;return this.normalize()}}(),angleTo:function(a){return 2*Math.acos(Math.abs(ac.clamp(this.dot(a),-1,1)))},rotateTowards:function(a, -b){var e=this.angleTo(a);if(0===e)return this;this.slerp(a,Math.min(1,b/e));return this},inverse:function(){return this.conjugate()},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(a){return this._x*a._x+this._y*a._y+this._z*a._z+this._w*a._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var a= -this.length();0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);this.onChangeCallback();return this},multiply:function(a,b){return void 0!==b?(console.warn('THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.'),this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},premultiply:function(a){return this.multiplyQuaternions(a,this)},multiplyQuaternions:function(a,b){var e=a._x,c=a._y,d=a._z;a=a._w; -var g=b._x,B=b._y,h=b._z;b=b._w;this._x=e*b+a*g+c*h-d*B;this._y=c*b+a*B+d*g-e*h;this._z=d*b+a*h+e*B-c*g;this._w=a*b-e*g-c*B-d*h;this.onChangeCallback();return this},slerp:function(a,b){if(0===b)return this;if(1===b)return this.copy(a);var e=this._x,c=this._y,d=this._z,g=this._w,B=g*a._w+e*a._x+c*a._y+d*a._z;0>B?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,B=-B):this.copy(a);if(1<=B)return this._w=g,this._x=e,this._y=c,this._z=d,this;a=1-B*B;if(a<=Number.EPSILON)return B=1-b,this._w=B* -g+b*this._w,this._x=B*e+b*this._x,this._y=B*c+b*this._y,this._z=B*d+b*this._z,this.normalize();a=Math.sqrt(a);var h=Math.atan2(a,B);B=Math.sin((1-b)*h)/a;b=Math.sin(b*h)/a;this._w=g*B+this._w*b;this._x=e*B+this._x*b;this._y=c*B+this._y*b;this._z=d*B+this._z*b;this.onChangeCallback();return this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromArray:function(a,b){void 0===b&&(b=0);this._x=a[b];this._y=a[b+1];this._z=a[b+2];this._w=a[b+3];this.onChangeCallback(); -return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}});Object.assign(h.prototype,{isVector3:!0,set:function(a,b,e){this.x=a;this.y=b;this.z=e;return this},setScalar:function(a){this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this}, +this.x-a.x;a=this.y-a.y;return b*b+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},lerpVectors:function(a,b,g){return this.subVectors(b,a).multiplyScalar(g).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toArray:function(a, +b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},fromBufferAttribute:function(a,b,g){void 0!==g&&console.warn('THREE.Vector2: offset has been removed from .fromBufferAttribute().');this.x=a.getX(b);this.y=a.getY(b);return this},rotateAround:function(a,b){var g=Math.cos(b);b=Math.sin(b);var c=this.x-a.x,e=this.y-a.y;this.x=c*g-e*b+a.x;this.y=c*b+e*g+a.y;return this}});Object.assign(d,{slerp:function(a,b,g,c){return g.copy(a).slerp(b,c)},slerpFlat:function(a,b,g,c,e,d,h){var B= +g[c+0],k=g[c+1],p=g[c+2];g=g[c+3];c=e[d+0];var m=e[d+1],l=e[d+2];e=e[d+3];if(g!==e||B!==c||k!==m||p!==l){d=1-h;var n=B*c+k*m+p*l+g*e,q=0<=n?1:-1,r=1-n*n;r>Number.EPSILON&&(r=Math.sqrt(r),n=Math.atan2(r,n*q),d=Math.sin(d*n)/r,h=Math.sin(h*n)/r);q*=h;B=B*d+c*q;k=k*d+m*q;p=p*d+l*q;g=g*d+e*q;d===1-h&&(h=1/Math.sqrt(B*B+k*k+p*p+g*g),B*=h,k*=h,p*=h,g*=h)}a[b]=B;a[b+1]=k;a[b+2]=p;a[b+3]=g}});Object.defineProperties(d.prototype,{x:{get:function(){return this._x},set:function(a){this._x=a;this.onChangeCallback()}}, +y:{get:function(){return this._y},set:function(a){this._y=a;this.onChangeCallback()}},z:{get:function(){return this._z},set:function(a){this._z=a;this.onChangeCallback()}},w:{get:function(){return this._w},set:function(a){this._w=a;this.onChangeCallback()}}});Object.assign(d.prototype,{isQuaternion:!0,set:function(a,b,g,c){this._x=a;this._y=b;this._z=g;this._w=c;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(a){this._x= +a.x;this._y=a.y;this._z=a.z;this._w=a.w;this.onChangeCallback();return this},setFromEuler:function(a,b){if(!a||!a.isEuler)throw Error('THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.');var g=a._x,c=a._y,e=a._z;a=a.order;var d=Math.cos,B=Math.sin,h=d(g/2),k=d(c/2);d=d(e/2);g=B(g/2);c=B(c/2);e=B(e/2);'XYZ'===a?(this._x=g*k*d+h*c*e,this._y=h*c*d-g*k*e,this._z=h*k*e+g*c*d,this._w=h*k*d-g*c*e):'YXZ'===a?(this._x=g*k*d+h*c*e,this._y=h*c*d-g*k*e,this._z=h* +k*e-g*c*d,this._w=h*k*d+g*c*e):'ZXY'===a?(this._x=g*k*d-h*c*e,this._y=h*c*d+g*k*e,this._z=h*k*e+g*c*d,this._w=h*k*d-g*c*e):'ZYX'===a?(this._x=g*k*d-h*c*e,this._y=h*c*d+g*k*e,this._z=h*k*e-g*c*d,this._w=h*k*d+g*c*e):'YZX'===a?(this._x=g*k*d+h*c*e,this._y=h*c*d+g*k*e,this._z=h*k*e-g*c*d,this._w=h*k*d-g*c*e):'XZY'===a&&(this._x=g*k*d-h*c*e,this._y=h*c*d-g*k*e,this._z=h*k*e+g*c*d,this._w=h*k*d+g*c*e);if(!1!==b)this.onChangeCallback();return this},setFromAxisAngle:function(a,b){b/=2;var g=Math.sin(b); +this._x=a.x*g;this._y=a.y*g;this._z=a.z*g;this._w=Math.cos(b);this.onChangeCallback();return this},setFromRotationMatrix:function(a){var b=a.elements,g=b[0];a=b[4];var c=b[8],e=b[1],d=b[5],B=b[9],h=b[2],k=b[6];b=b[10];var p=g+d+b;0d&&g>b?(g=2*Math.sqrt(1+g-d-b),this._w=(k-B)/g,this._x=.25*g,this._y=(a+e)/g,this._z=(c+h)/g):d>b?(g=2*Math.sqrt(1+d-g-b),this._w=(c-h)/g,this._x=(a+e)/g,this._y=.25*g,this._z=(B+k)/ +g):(g=2*Math.sqrt(1+b-g-d),this._w=(e-a)/g,this._x=(c+h)/g,this._y=(B+k)/g,this._z=.25*g);this.onChangeCallback();return this},setFromUnitVectors:function(a,b){var g=a.dot(b)+1;1E-6>g?(g=0,Math.abs(a.x)>Math.abs(a.z)?(this._x=-a.y,this._y=a.x,this._z=0):(this._x=0,this._y=-a.z,this._z=a.y)):(this._x=a.y*b.z-a.z*b.y,this._y=a.z*b.x-a.x*b.z,this._z=a.x*b.y-a.y*b.x);this._w=g;return this.normalize()},angleTo:function(a){return 2*Math.acos(Math.abs(cb.clamp(this.dot(a),-1,1)))},rotateTowards:function(a, +b){var g=this.angleTo(a);if(0===g)return this;this.slerp(a,Math.min(1,b/g));return this},inverse:function(){return this.conjugate()},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(a){return this._x*a._x+this._y*a._y+this._z*a._z+this._w*a._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var a= +this.length();0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);this.onChangeCallback();return this},multiply:function(a,b){return void 0!==b?(console.warn('THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.'),this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},premultiply:function(a){return this.multiplyQuaternions(a,this)},multiplyQuaternions:function(a,b){var g=a._x,c=a._y,e=a._z;a=a._w; +var d=b._x,B=b._y,h=b._z;b=b._w;this._x=g*b+a*d+c*h-e*B;this._y=c*b+a*B+e*d-g*h;this._z=e*b+a*h+g*B-c*d;this._w=a*b-g*d-c*B-e*h;this.onChangeCallback();return this},slerp:function(a,b){if(0===b)return this;if(1===b)return this.copy(a);var g=this._x,c=this._y,e=this._z,d=this._w,B=d*a._w+g*a._x+c*a._y+e*a._z;0>B?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,B=-B):this.copy(a);if(1<=B)return this._w=d,this._x=g,this._y=c,this._z=e,this;a=1-B*B;if(a<=Number.EPSILON)return B=1-b,this._w=B* +d+b*this._w,this._x=B*g+b*this._x,this._y=B*c+b*this._y,this._z=B*e+b*this._z,this.normalize();a=Math.sqrt(a);var h=Math.atan2(a,B);B=Math.sin((1-b)*h)/a;b=Math.sin(b*h)/a;this._w=d*B+this._w*b;this._x=g*B+this._x*b;this._y=c*B+this._y*b;this._z=e*B+this._z*b;this.onChangeCallback();return this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromArray:function(a,b){void 0===b&&(b=0);this._x=a[b];this._y=a[b+1];this._z=a[b+2];this._w=a[b+3];this.onChangeCallback(); +return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}});Object.assign(c.prototype,{isVector3:!0,set:function(a,b,g){this.x=a;this.y=b;this.z=g;return this},setScalar:function(a){this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this}, setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error('index is out of range: '+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error('index is out of range: '+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){if(void 0!==b)return console.warn('THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'), this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;return this},sub:function(a,b){if(void 0!==b)return console.warn('THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z; return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn('THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.'),this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},multiplyVectors:function(a,b){this.x=a.x* -b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyEuler:function(){var a=new g;return function(b){b&&b.isEuler||console.error('THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.');return this.applyQuaternion(a.setFromEuler(b))}}(),applyAxisAngle:function(){var a=new g;return function(b,e){return this.applyQuaternion(a.setFromAxisAngle(b,e))}}(),applyMatrix3:function(a){var b=this.x,e=this.y,c=this.z;a=a.elements;this.x=a[0]*b+a[3]*e+a[6]*c;this.y=a[1]*b+ -a[4]*e+a[7]*c;this.z=a[2]*b+a[5]*e+a[8]*c;return this},applyMatrix4:function(a){var b=this.x,e=this.y,c=this.z;a=a.elements;var d=1/(a[3]*b+a[7]*e+a[11]*c+a[15]);this.x=(a[0]*b+a[4]*e+a[8]*c+a[12])*d;this.y=(a[1]*b+a[5]*e+a[9]*c+a[13])*d;this.z=(a[2]*b+a[6]*e+a[10]*c+a[14])*d;return this},applyQuaternion:function(a){var b=this.x,e=this.y,c=this.z,d=a.x,g=a.y,h=a.z;a=a.w;var B=a*b+g*c-h*e,k=a*e+h*b-d*c,n=a*c+d*e-g*b;b=-d*b-g*e-h*c;this.x=B*a+b*-d+k*-h-n*-g;this.y=k*a+b*-g+n*-d-B*-h;this.z=n*a+b*-h+ -B*-g-k*-d;return this},project:function(a){return this.applyMatrix4(a.matrixWorldInverse).applyMatrix4(a.projectionMatrix)},unproject:function(){var a=new c;return function(b){return this.applyMatrix4(a.getInverse(b.projectionMatrix)).applyMatrix4(b.matrixWorld)}}(),transformDirection:function(a){var b=this.x,e=this.y,c=this.z;a=a.elements;this.x=a[0]*b+a[4]*e+a[8]*c;this.y=a[1]*b+a[5]*e+a[9]*c;this.z=a[2]*b+a[6]*e+a[10]*c;return this.normalize()},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/= -a.z;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));return this},clampScalar:function(){var a=new h,b=new h; -return function(e,c){a.set(e,e,e);b.set(c,c,c);return this.clamp(a,b)}}(),clampLength:function(a,b){var e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(a,Math.min(b,e)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z); -return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+ -Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},lerpVectors:function(a,b,e){return this.subVectors(b,a).multiplyScalar(e).add(a)},cross:function(a,b){return void 0!==b?(console.warn('THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.'),this.crossVectors(a, -b)):this.crossVectors(this,a)},crossVectors:function(a,b){var e=a.x,c=a.y;a=a.z;var d=b.x,g=b.y;b=b.z;this.x=c*b-a*g;this.y=a*d-e*b;this.z=e*g-c*d;return this},projectOnVector:function(a){var b=a.dot(this)/a.lengthSq();return this.copy(a).multiplyScalar(b)},projectOnPlane:function(){var a=new h;return function(b){a.copy(this).projectOnVector(b);return this.sub(a)}}(),reflect:function(){var a=new h;return function(b){return this.sub(a.copy(b).multiplyScalar(2*this.dot(b)))}}(),angleTo:function(a){a= -this.dot(a)/Math.sqrt(this.lengthSq()*a.lengthSq());return Math.acos(ac.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return b*b+e*e+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)+Math.abs(this.z-a.z)},setFromSpherical:function(a){return this.setFromSphericalCoords(a.radius,a.phi,a.theta)},setFromSphericalCoords:function(a,b,e){var c=Math.sin(b)*a;this.x= -c*Math.sin(e);this.y=Math.cos(b)*a;this.z=c*Math.cos(e);return this},setFromCylindrical:function(a){return this.setFromCylindricalCoords(a.radius,a.theta,a.y)},setFromCylindricalCoords:function(a,b,e){this.x=a*Math.sin(b);this.y=e;this.z=a*Math.cos(b);return this},setFromMatrixPosition:function(a){a=a.elements;this.x=a[12];this.y=a[13];this.z=a[14];return this},setFromMatrixScale:function(a){var b=this.setFromMatrixColumn(a,0).length(),e=this.setFromMatrixColumn(a,1).length();a=this.setFromMatrixColumn(a, -2).length();this.x=b;this.y=e;this.z=a;return this},setFromMatrixColumn:function(a,b){return this.fromArray(a.elements,4*b)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},fromBufferAttribute:function(a,b,e){void 0!==e&&console.warn('THREE.Vector3: offset has been removed from .fromBufferAttribute().'); -this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);return this}});Object.assign(k.prototype,{isMatrix3:!0,set:function(a,b,e,c,d,g,h,k,n){var B=this.elements;B[0]=a;B[1]=c;B[2]=h;B[3]=b;B[4]=d;B[5]=k;B[6]=e;B[7]=g;B[8]=n;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]= -a[8];return this},setFromMatrix4:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[1],a[5],a[9],a[2],a[6],a[10]);return this},applyToBufferAttribute:function(){var a=new h;return function(b){for(var e=0,c=b.count;ee;e++)if(b[e]!==a[e])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var e=0;9>e;e++)this.elements[e]=a[e+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var e=this.elements;a[b]=e[0];a[b+1]=e[1];a[b+2]=e[2];a[b+3]=e[3];a[b+4]=e[4];a[b+5]=e[5];a[b+6]=e[6];a[b+7]=e[7];a[b+8]=e[8]; -return a}});var Gi,Xb={getDataURL:function(a){if('undefined'==typeof HTMLCanvasElement)return a.src;if(!(a instanceof HTMLCanvasElement)){void 0===Gi&&(Gi=document.createElementNS('http://www.w3.org/1999/xhtml','canvas'));Gi.width=a.width;Gi.height=a.height;var b=Gi.getContext('2d');a instanceof ImageData?b.putImageData(a,0,0):b.drawImage(a,0,0,a.width,a.height);a=Gi}return 2048this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+ +Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},lerpVectors:function(a,b,g){return this.subVectors(b,a).multiplyScalar(g).add(a)},cross:function(a,b){return void 0!==b?(console.warn('THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.'),this.crossVectors(a,b)):this.crossVectors(this, +a)},crossVectors:function(a,b){var g=a.x,c=a.y;a=a.z;var e=b.x,d=b.y;b=b.z;this.x=c*b-a*d;this.y=a*e-g*b;this.z=g*d-c*e;return this},projectOnVector:function(a){var b=a.dot(this)/a.lengthSq();return this.copy(a).multiplyScalar(b)},projectOnPlane:function(){var a=new c;return function(b){a.copy(this).projectOnVector(b);return this.sub(a)}}(),reflect:function(){var a=new c;return function(b){return this.sub(a.copy(b).multiplyScalar(2*this.dot(b)))}}(),angleTo:function(a){a=this.dot(a)/Math.sqrt(this.lengthSq()* +a.lengthSq());return Math.acos(cb.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,g=this.y-a.y;a=this.z-a.z;return b*b+g*g+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)+Math.abs(this.z-a.z)},setFromSpherical:function(a){return this.setFromSphericalCoords(a.radius,a.phi,a.theta)},setFromSphericalCoords:function(a,b,g){var c=Math.sin(b)*a;this.x=c*Math.sin(g);this.y=Math.cos(b)* +a;this.z=c*Math.cos(g);return this},setFromCylindrical:function(a){return this.setFromCylindricalCoords(a.radius,a.theta,a.y)},setFromCylindricalCoords:function(a,b,g){this.x=a*Math.sin(b);this.y=g;this.z=a*Math.cos(b);return this},setFromMatrixPosition:function(a){a=a.elements;this.x=a[12];this.y=a[13];this.z=a[14];return this},setFromMatrixScale:function(a){var b=this.setFromMatrixColumn(a,0).length(),g=this.setFromMatrixColumn(a,1).length();a=this.setFromMatrixColumn(a,2).length();this.x=b;this.y= +g;this.z=a;return this},setFromMatrixColumn:function(a,b){return this.fromArray(a.elements,4*b)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},fromBufferAttribute:function(a,b,g){void 0!==g&&console.warn('THREE.Vector3: offset has been removed from .fromBufferAttribute().'); +this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);return this}});Object.assign(k.prototype,{isMatrix3:!0,set:function(a,b,g,c,e,d,h,k,p){var B=this.elements;B[0]=a;B[1]=c;B[2]=h;B[3]=b;B[4]=e;B[5]=k;B[6]=g;B[7]=d;B[8]=p;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]= +a[8];return this},setFromMatrix4:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[1],a[5],a[9],a[2],a[6],a[10]);return this},applyToBufferAttribute:function(){var a=new c;return function(b){for(var g=0,c=b.count;gg;g++)if(b[g]!==a[g])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var g=0;9>g;g++)this.elements[g]=a[g+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var g=this.elements;a[b]=g[0];a[b+1]=g[1];a[b+2]=g[2];a[b+3]=g[3];a[b+4]=g[4];a[b+5]=g[5];a[b+6]=g[6];a[b+7]=g[7];a[b+8]=g[8]; +return a}});var xd,zh={getDataURL:function(a){if('undefined'==typeof HTMLCanvasElement)return a.src;if(!(a instanceof HTMLCanvasElement)){void 0===xd&&(xd=document.createElementNS('http://www.w3.org/1999/xhtml','canvas'));xd.width=a.width;xd.height=a.height;var b=xd.getContext('2d');a instanceof ImageData?b.putImageData(a,0,0):b.drawImage(a,0,0,a.width,a.height);a=xd}return 2048a.x||1a.x?0:1;break;case 1002:a.x=1===Math.abs(Math.floor(a.x)%2)?Math.ceil(a.x)-a.x:a.x-Math.floor(a.x)}if(0>a.y||1a.y?0:1;break;case 1002:a.y=1===Math.abs(Math.floor(a.y)%2)?Math.ceil(a.y)-a.y:a.y-Math.floor(a.y)}this.flipY&&(a.y=1-a.y);return a}});Object.defineProperty(l.prototype,'needsUpdate',{set:function(a){!0===a&&this.version++}});Object.assign(m.prototype,{isVector4:!0,set:function(a, -b,e,c){this.x=a;this.y=b;this.z=e;this.w=c;return this},setScalar:function(a){this.w=this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error('index is out of range: '+a);}return this},getComponent:function(a){switch(a){case 0:return this.x; +var g={metadata:{version:4.5,type:'Texture',generator:'Texture.toJSON'},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment}; +if(void 0!==this.image){var c=this.image;void 0===c.uuid&&(c.uuid=cb.generateUUID());if(!b&&void 0===a.images[c.uuid]){if(Array.isArray(c)){var e=[];for(var d=0,B=c.length;da.x||1a.x?0:1;break;case 1002:a.x=1===Math.abs(Math.floor(a.x)%2)?Math.ceil(a.x)-a.x:a.x-Math.floor(a.x)}if(0>a.y||1a.y?0:1;break;case 1002:a.y=1===Math.abs(Math.floor(a.y)%2)?Math.ceil(a.y)-a.y:a.y-Math.floor(a.y)}this.flipY&&(a.y=1-a.y);return a}});Object.defineProperty(h.prototype,'needsUpdate',{set:function(a){!0===a&&this.version++}});Object.assign(l.prototype,{isVector4:!0,set:function(a, +b,g,c){this.x=a;this.y=b;this.z=g;this.w=c;return this},setScalar:function(a){this.w=this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error('index is out of range: '+a);}return this},getComponent:function(a){switch(a){case 0:return this.x; case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error('index is out of range: '+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){if(void 0!==b)return console.warn('THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this}, addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;this.w+=a.w*b;return this},sub:function(a,b){if(void 0!==b)return console.warn('THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subScalar:function(a){this.x-= -a;this.y-=a;this.z-=a;this.w-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},applyMatrix4:function(a){var b=this.x,e=this.y,c=this.z,d=this.w;a=a.elements;this.x=a[0]*b+a[4]*e+a[8]*c+a[12]*d;this.y=a[1]*b+a[5]*e+a[9]*c+a[13]*d;this.z=a[2]*b+a[6]*e+a[10]*c+a[14]*d;this.w=a[3]*b+a[7]*e+a[11]*c+a[15]*d;return this},divideScalar:function(a){return this.multiplyScalar(1/ -a)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){a=a.elements;var b=a[0],e=a[4],c=a[8],d=a[1],g=a[5],h=a[9],k=a[2],B=a[6],n=a[10];if(.01>Math.abs(e-d)&&.01>Math.abs(c-k)&&.01>Math.abs(h-B)){if(.1>Math.abs(e+d)&&.1>Math.abs(c+k)&&.1>Math.abs(h+B)&&.1>Math.abs(b+g+n-3))return this.set(1,0,0,0),this;a=Math.PI;b=(b+1)/2;g=(g+1)/ -2;n=(n+1)/2;e=(e+d)/4;c=(c+k)/4;h=(h+B)/4;b>g&&b>n?.01>b?(B=0,e=k=.707106781):(B=Math.sqrt(b),k=e/B,e=c/B):g>n?.01>g?(B=.707106781,k=0,e=.707106781):(k=Math.sqrt(g),B=e/k,e=h/k):.01>n?(k=B=.707106781,e=0):(e=Math.sqrt(n),B=c/e,k=h/e);this.set(B,k,e,a);return this}a=Math.sqrt((B-h)*(B-h)+(c-k)*(c-k)+(d-e)*(d-e));.001>Math.abs(a)&&(a=1);this.x=(B-h)/a;this.y=(c-k)/a;this.z=(d-e)/a;this.w=Math.acos((b+g+n-1)/2);return this},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z= -Math.min(this.z,a.z);this.w=Math.min(this.w,a.w);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);this.w=Math.max(this.w,a.w);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));this.w=Math.max(a.w,Math.min(b.w,this.w));return this},clampScalar:function(){var a,b;return function(e,c){void 0===a&&(a=new m,b=new m);a.set(e,e,e,e); -b.set(c,c,c,c);return this.clamp(a,b)}}(),clampLength:function(a,b){var e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(a,Math.min(b,e)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z= -Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.x*this.x+ -this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},lerpVectors:function(a, -b,e){return this.subVectors(b,a).multiplyScalar(e).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;a[b+3]=this.w;return a},fromBufferAttribute:function(a,b,e){void 0!==e&&console.warn('THREE.Vector4: offset has been removed from .fromBufferAttribute().'); -this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);this.w=a.getW(b);return this}});q.prototype=Object.assign(Object.create(b.prototype),{constructor:q,isWebGLRenderTarget:!0,setSize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.dispose();this.viewport.set(0,0,a,b);this.scissor.set(0,0,a,b)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.viewport.copy(a.viewport);this.texture=a.texture.clone(); -this.depthBuffer=a.depthBuffer;this.stencilBuffer=a.stencilBuffer;this.depthTexture=a.depthTexture;return this},dispose:function(){this.dispatchEvent({type:'dispose'})}});p.prototype=Object.assign(Object.create(q.prototype),{constructor:p,isWebGLMultisampleRenderTarget:!0,copy:function(a){q.prototype.copy.call(this,a);this.samples=a.samples;return this}});e.prototype=Object.create(q.prototype);e.prototype.constructor=e;e.prototype.isWebGLRenderTargetCube=!0;n.prototype=Object.create(l.prototype); -n.prototype.constructor=n;n.prototype.isDataTexture=!0;Object.assign(r.prototype,{isBox3:!0,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromArray:function(a){for(var b=Infinity,e=Infinity,c=Infinity,d=-Infinity,g=-Infinity,h=-Infinity,k=0,B=a.length;kd&&(d=n);m>g&&(g=m);l>h&&(h=l)}this.min.set(b,e,c);this.max.set(d,g,h);return this},setFromBufferAttribute:function(a){for(var b=Infinity,e=Infinity,c=Infinity, -d=-Infinity,g=-Infinity,h=-Infinity,k=0,B=a.count;kd&&(d=n);m>g&&(g=m);l>h&&(h=l)}this.min.set(b,e,c);this.max.set(d,g,h);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,e=a.length;bthis.max.x||a.ythis.max.y|| -a.zthis.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z},getParameter:function(a,b){void 0===b&&(console.warn('THREE.Box3: .getParameter() target is now required'),b=new h);return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y||a.max.zthis.max.z?!1:!0},intersectsSphere:function(){var a=new h;return function(b){this.clampPoint(b.center,a);return a.distanceToSquared(b.center)<=b.radius*b.radius}}(),intersectsPlane:function(a){if(0=-a.constant},intersectsTriangle:function(){function a(a){var d,g=0;for(d=a.length-3;g<=d;g+=3){n.fromArray(a,g);var h=l.x*Math.abs(n.x)+l.y*Math.abs(n.y)+l.z*Math.abs(n.z),k=b.dot(n),B=e.dot(n),m=c.dot(n);if(Math.max(-Math.max(k,B,m),Math.min(k,B,m))>h)return!1}return!0}var b=new h,e=new h,c=new h,d=new h,g=new h,k=new h,n=new h,m=new h,l=new h, -p=new h;return function(h){if(this.isEmpty())return!1;this.getCenter(m);l.subVectors(this.max,m);b.subVectors(h.a,m);e.subVectors(h.b,m);c.subVectors(h.c,m);d.subVectors(e,b);g.subVectors(c,e);k.subVectors(b,c);h=[0,-d.z,d.y,0,-g.z,g.y,0,-k.z,k.y,d.z,0,-d.x,g.z,0,-g.x,k.z,0,-k.x,-d.y,d.x,0,-g.y,g.x,0,-k.y,k.x,0];if(!a(h))return!1;h=[1,0,0,0,1,0,0,0,1];if(!a(h))return!1;p.crossVectors(d,g);h=[p.x,p.y,p.z];return a(h)}}(),clampPoint:function(a,b){void 0===b&&(console.warn('THREE.Box3: .clampPoint() target is now required'), -b=new h);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new h;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=new h;return function(b){void 0===b&&(console.warn('THREE.Box3: .getBoundingSphere() target is now required'),b=new t);this.getCenter(b.center);b.radius=.5*this.getSize(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);this.isEmpty()&&this.makeEmpty();return this}, -union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(){var a=[new h,new h,new h,new h,new h,new h,new h,new h];return function(b){if(this.isEmpty())return this;a[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b);a[5].set(this.max.x, -this.min.y,this.max.z).applyMatrix4(b);a[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.setFromPoints(a);return this}}(),translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}});Object.assign(t.prototype,{set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(){var a=new r;return function(b,e){var c=this.center; -void 0!==e?c.copy(e):a.setFromPoints(b).getCenter(c);for(var d=e=0,g=b.length;d=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius}, -intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},intersectsBox:function(a){return a.intersectsSphere(this)},intersectsPlane:function(a){return Math.abs(a.distanceToPoint(this.center))<=this.radius},clampPoint:function(a,b){var e=this.center.distanceToSquared(a);void 0===b&&(console.warn('THREE.Sphere: .clampPoint() target is now required'),b=new h);b.copy(a);e>this.radius*this.radius&&(b.sub(this.center).normalize(),b.multiplyScalar(this.radius).add(this.center)); -return b},getBoundingBox:function(a){void 0===a&&(console.warn('THREE.Sphere: .getBoundingBox() target is now required'),a=new r);a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius}});Object.assign(D.prototype,{set:function(a,b){this.normal.copy(a); -this.constant=b;return this},setComponents:function(a,b,e,c){this.normal.set(a,b,e);this.constant=c;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new h,b=new h;return function(e,c,d){c=a.subVectors(d,c).cross(b.subVectors(e,c)).normalize();this.setFromNormalAndCoplanarPoint(c,e);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.normal.copy(a.normal); -this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){void 0===b&&(console.warn('THREE.Plane: .projectPoint() target is now required'),b=new h);return b.copy(this.normal).multiplyScalar(-this.distanceToPoint(a)).add(a)}, -intersectLine:function(){var a=new h;return function(b,e){void 0===e&&(console.warn('THREE.Plane: .intersectLine() target is now required'),e=new h);var c=b.delta(a),d=this.normal.dot(c);if(0===d){if(0===this.distanceToPoint(b.start))return e.copy(b.start)}else if(d=-(b.start.dot(this.normal)+this.constant)/d,!(0>d||1b&&0a&&0e;e++)b[e].copy(a.planes[e]);return this},setFromMatrix:function(a){var b=this.planes,e=a.elements;a=e[0];var c=e[1],d=e[2],g=e[3],h=e[4], -k=e[5],n=e[6],B=e[7],m=e[8],l=e[9],p=e[10],q=e[11],r=e[12],u=e[13],t=e[14];e=e[15];b[0].setComponents(g-a,B-h,q-m,e-r).normalize();b[1].setComponents(g+a,B+h,q+m,e+r).normalize();b[2].setComponents(g+c,B+k,q+l,e+u).normalize();b[3].setComponents(g-c,B-k,q-l,e-u).normalize();b[4].setComponents(g-d,B-n,q-p,e-t).normalize();b[5].setComponents(g+d,B+n,q+p,e+t).normalize();return this},intersectsObject:function(){var a=new t;return function(b){var e=b.geometry;null===e.boundingSphere&&e.computeBoundingSphere(); -a.copy(e.boundingSphere).applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSprite:function(){var a=new t;return function(b){a.center.set(0,0,0);a.radius=.7071067811865476;a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes,e=a.center;a=-a.radius;for(var c=0;6>c;c++)if(b[c].distanceToPoint(e)c;c++){var d=e[c]; -a.x=0d.distanceToPoint(a))return!1}return!0}}(),containsPoint:function(a){for(var b=this.planes,e=0;6>e;e++)if(0>b[e].distanceToPoint(a))return!1;return!0}});var Hb={alphamap_fragment:'#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif',alphamap_pars_fragment:'#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif',alphatest_fragment:'#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif', -aomap_fragment:'#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif',aomap_pars_fragment:'#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif', -begin_vertex:'vec3 transformed = vec3( position );',beginnormal_vertex:'vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif',bsdfs:'vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick( specularColor, dotNV );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}', +a;this.y-=a;this.z-=a;this.w-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},applyMatrix4:function(a){var b=this.x,g=this.y,c=this.z,e=this.w;a=a.elements;this.x=a[0]*b+a[4]*g+a[8]*c+a[12]*e;this.y=a[1]*b+a[5]*g+a[9]*c+a[13]*e;this.z=a[2]*b+a[6]*g+a[10]*c+a[14]*e;this.w=a[3]*b+a[7]*g+a[11]*c+a[15]*e;return this},divideScalar:function(a){return this.multiplyScalar(1/ +a)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){a=a.elements;var b=a[0];var g=a[4];var c=a[8],e=a[1],d=a[5],B=a[9];var h=a[2];var k=a[6];var p=a[10];if(.01>Math.abs(g-e)&&.01>Math.abs(c-h)&&.01>Math.abs(B-k)){if(.1>Math.abs(g+e)&&.1>Math.abs(c+h)&&.1>Math.abs(B+k)&&.1>Math.abs(b+d+p-3))return this.set(1,0,0,0),this;a=Math.PI; +b=(b+1)/2;d=(d+1)/2;p=(p+1)/2;g=(g+e)/4;c=(c+h)/4;B=(B+k)/4;b>d&&b>p?.01>b?(k=0,g=h=.707106781):(k=Math.sqrt(b),h=g/k,g=c/k):d>p?.01>d?(k=.707106781,h=0,g=.707106781):(h=Math.sqrt(d),k=g/h,g=B/h):.01>p?(h=k=.707106781,g=0):(g=Math.sqrt(p),k=c/g,h=B/g);this.set(k,h,g,a);return this}a=Math.sqrt((k-B)*(k-B)+(c-h)*(c-h)+(e-g)*(e-g));.001>Math.abs(a)&&(a=1);this.x=(k-B)/a;this.y=(c-h)/a;this.z=(e-g)/a;this.w=Math.acos((b+d+p-1)/2);return this},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y, +a.y);this.z=Math.min(this.z,a.z);this.w=Math.min(this.w,a.w);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);this.w=Math.max(this.w,a.w);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));this.w=Math.max(a.w,Math.min(b.w,this.w));return this},clampScalar:function(){var a,b;return function(g,c){void 0===a&&(a=new l,b=new l);a.set(g, +g,g,g);b.set(c,c,c,c);return this.clamp(a,b)}}(),clampLength:function(a,b){var g=this.length();return this.divideScalar(g||1).multiplyScalar(Math.max(a,Math.min(b,g)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y); +this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.x* +this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},lerpVectors:function(a, +b,g){return this.subVectors(b,a).multiplyScalar(g).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;a[b+3]=this.w;return a},fromBufferAttribute:function(a,b,g){void 0!==g&&console.warn('THREE.Vector4: offset has been removed from .fromBufferAttribute().'); +this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);this.w=a.getW(b);return this}});n.prototype=Object.assign(Object.create(b.prototype),{constructor:n,isWebGLRenderTarget:!0,setSize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.dispose();this.viewport.set(0,0,a,b);this.scissor.set(0,0,a,b)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.viewport.copy(a.viewport);this.texture=a.texture.clone(); +this.depthBuffer=a.depthBuffer;this.stencilBuffer=a.stencilBuffer;this.depthTexture=a.depthTexture;return this},dispose:function(){this.dispatchEvent({type:'dispose'})}});q.prototype=Object.assign(Object.create(n.prototype),{constructor:q,isWebGLMultisampleRenderTarget:!0,copy:function(a){n.prototype.copy.call(this,a);this.samples=a.samples;return this}});m.prototype=Object.create(n.prototype);m.prototype.constructor=m;m.prototype.isWebGLRenderTargetCube=!0;g.prototype=Object.create(h.prototype); +g.prototype.constructor=g;g.prototype.isDataTexture=!0;Object.assign(p.prototype,{isBox3:!0,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromArray:function(a){for(var b=Infinity,g=Infinity,c=Infinity,e=-Infinity,d=-Infinity,h=-Infinity,B=0,k=a.length;Be&&(e=p);m>d&&(d=m);l>h&&(h=l)}this.min.set(b,g,c);this.max.set(e,d,h);return this},setFromBufferAttribute:function(a){for(var b=Infinity,g=Infinity,c=Infinity, +e=-Infinity,d=-Infinity,h=-Infinity,B=0,k=a.count;Be&&(e=p);m>d&&(d=m);l>h&&(h=l)}this.min.set(b,g,c);this.max.set(e,d,h);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,g=a.length;bthis.max.x||a.ythis.max.y|| +a.zthis.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z},getParameter:function(a,b){void 0===b&&(console.warn('THREE.Box3: .getParameter() target is now required'),b=new c);return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y||a.max.zthis.max.z?!1:!0},intersectsSphere:function(){var a=new c;return function(b){this.clampPoint(b.center,a);return a.distanceToSquared(b.center)<=b.radius*b.radius}}(),intersectsPlane:function(a){if(0=-a.constant},intersectsTriangle:function(){function a(a){var c;var d=0;for(c=a.length-3;d<=c;d+=3){p.fromArray(a,d);var h=l.x*Math.abs(p.x)+l.y*Math.abs(p.y)+l.z*Math.abs(p.z),B=b.dot(p),k=g.dot(p),m=e.dot(p);if(Math.max(-Math.max(B,k,m),Math.min(B,k,m))>h)return!1}return!0}var b=new c,g=new c,e=new c,d=new c,h=new c,k=new c,p=new c, +m=new c,l=new c,n=new c;return function(c){if(this.isEmpty())return!1;this.getCenter(m);l.subVectors(this.max,m);b.subVectors(c.a,m);g.subVectors(c.b,m);e.subVectors(c.c,m);d.subVectors(g,b);h.subVectors(e,g);k.subVectors(b,e);c=[0,-d.z,d.y,0,-h.z,h.y,0,-k.z,k.y,d.z,0,-d.x,h.z,0,-h.x,k.z,0,-k.x,-d.y,d.x,0,-h.y,h.x,0,-k.y,k.x,0];if(!a(c))return!1;c=[1,0,0,0,1,0,0,0,1];if(!a(c))return!1;n.crossVectors(d,h);c=[n.x,n.y,n.z];return a(c)}}(),clampPoint:function(a,b){void 0===b&&(console.warn('THREE.Box3: .clampPoint() target is now required'), +b=new c);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new c;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=new c;return function(b){void 0===b&&console.error('THREE.Box3: .getBoundingSphere() target is now required');this.getCenter(b.center);b.radius=.5*this.getSize(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);this.isEmpty()&&this.makeEmpty();return this},union:function(a){this.min.min(a.min); +this.max.max(a.max);return this},applyMatrix4:function(){var a=[new c,new c,new c,new c,new c,new c,new c,new c];return function(b){if(this.isEmpty())return this;a[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b); +a[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.setFromPoints(a);return this}}(),translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}});Object.assign(r.prototype,{set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(){var a=new p;return function(b,g){var c=this.center;void 0!==g?c.copy(g):a.setFromPoints(b).getCenter(c); +for(var e=g=0,d=b.length;e=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+ +a.radius;return a.center.distanceToSquared(this.center)<=b*b},intersectsBox:function(a){return a.intersectsSphere(this)},intersectsPlane:function(a){return Math.abs(a.distanceToPoint(this.center))<=this.radius},clampPoint:function(a,b){var g=this.center.distanceToSquared(a);void 0===b&&(console.warn('THREE.Sphere: .clampPoint() target is now required'),b=new c);b.copy(a);g>this.radius*this.radius&&(b.sub(this.center).normalize(),b.multiplyScalar(this.radius).add(this.center));return b},getBoundingBox:function(a){void 0=== +a&&(console.warn('THREE.Sphere: .getBoundingBox() target is now required'),a=new p);a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius}});Object.assign(u.prototype,{set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a, +b,g,c){this.normal.set(a,b,g);this.constant=c;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new c,b=new c;return function(g,c,e){c=a.subVectors(e,c).cross(b.subVectors(g,c)).normalize();this.setFromNormalAndCoplanarPoint(c,g);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a= +1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){void 0===b&&(console.warn('THREE.Plane: .projectPoint() target is now required'),b=new c);return b.copy(this.normal).multiplyScalar(-this.distanceToPoint(a)).add(a)},intersectLine:function(){var a= +new c;return function(b,g){void 0===g&&(console.warn('THREE.Plane: .intersectLine() target is now required'),g=new c);var e=b.delta(a),d=this.normal.dot(e);if(0===d){if(0===this.distanceToPoint(b.start))return g.copy(b.start)}else if(d=-(b.start.dot(this.normal)+this.constant)/d,!(0>d||1b&&0a&&0g;g++)b[g].copy(a.planes[g]);return this},setFromMatrix:function(a){var b=this.planes,g=a.elements;a=g[0];var c=g[1],e=g[2],d=g[3],h=g[4], +k=g[5],B=g[6],p=g[7],m=g[8],l=g[9],n=g[10],q=g[11],r=g[12],t=g[13],u=g[14];g=g[15];b[0].setComponents(d-a,p-h,q-m,g-r).normalize();b[1].setComponents(d+a,p+h,q+m,g+r).normalize();b[2].setComponents(d+c,p+k,q+l,g+t).normalize();b[3].setComponents(d-c,p-k,q-l,g-t).normalize();b[4].setComponents(d-e,p-B,q-n,g-u).normalize();b[5].setComponents(d+e,p+B,q+n,g+u).normalize();return this},intersectsObject:function(){var a=new r;return function(b){var g=b.geometry;null===g.boundingSphere&&g.computeBoundingSphere(); +a.copy(g.boundingSphere).applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSprite:function(){var a=new r;return function(b){a.center.set(0,0,0);a.radius=.7071067811865476;a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes,g=a.center;a=-a.radius;for(var c=0;6>c;c++)if(b[c].distanceToPoint(g)c;c++){var e=g[c]; +a.x=0e.distanceToPoint(a))return!1}return!0}}(),containsPoint:function(a){for(var b=this.planes,g=0;6>g;g++)if(0>b[g].distanceToPoint(a))return!1;return!0}});Object.assign(v.prototype,{isMatrix4:!0,set:function(a,b,g,c,e,d,h,k,p,m,l,n,q,r,t,u){var B=this.elements;B[0]=a;B[4]=b;B[8]=g;B[12]=c;B[1]=e;B[5]=d;B[9]=h;B[13]=k;B[2]=p;B[6]=m;B[10]=l;B[14]=n;B[3]=q;B[7]=r;B[11]=t;B[15]=u;return this},identity:function(){this.set(1, +0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new v).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return this},copyPosition:function(a){var b=this.elements;a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractBasis:function(a,b,g){a.setFromMatrixColumn(this,0); +b.setFromMatrixColumn(this,1);g.setFromMatrixColumn(this,2);return this},makeBasis:function(a,b,g){this.set(a.x,b.x,g.x,0,a.y,b.y,g.y,0,a.z,b.z,g.z,0,0,0,0,1);return this},extractRotation:function(){var a=new c;return function(b){var g=this.elements,c=b.elements,e=1/a.setFromMatrixColumn(b,0).length(),d=1/a.setFromMatrixColumn(b,1).length();b=1/a.setFromMatrixColumn(b,2).length();g[0]=c[0]*e;g[1]=c[1]*e;g[2]=c[2]*e;g[3]=0;g[4]=c[4]*d;g[5]=c[5]*d;g[6]=c[6]*d;g[7]=0;g[8]=c[8]*b;g[9]=c[9]*b;g[10]=c[10]* +b;g[11]=0;g[12]=0;g[13]=0;g[14]=0;g[15]=1;return this}}(),makeRotationFromEuler:function(a){a&&a.isEuler||console.error('THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.');var b=this.elements,g=a.x,c=a.y,e=a.z,d=Math.cos(g);g=Math.sin(g);var h=Math.cos(c);c=Math.sin(c);var k=Math.cos(e);e=Math.sin(e);if('XYZ'===a.order){a=d*k;var B=d*e,p=g*k,m=g*e;b[0]=h*k;b[4]=-h*e;b[8]=c;b[1]=B+p*c;b[5]=a-m*c;b[9]=-g*h;b[2]=m-a*c;b[6]=p+B*c;b[10]=d*h}else'YXZ'=== +a.order?(a=h*k,B=h*e,p=c*k,m=c*e,b[0]=a+m*g,b[4]=p*g-B,b[8]=d*c,b[1]=d*e,b[5]=d*k,b[9]=-g,b[2]=B*g-p,b[6]=m+a*g,b[10]=d*h):'ZXY'===a.order?(a=h*k,B=h*e,p=c*k,m=c*e,b[0]=a-m*g,b[4]=-d*e,b[8]=p+B*g,b[1]=B+p*g,b[5]=d*k,b[9]=m-a*g,b[2]=-d*c,b[6]=g,b[10]=d*h):'ZYX'===a.order?(a=d*k,B=d*e,p=g*k,m=g*e,b[0]=h*k,b[4]=p*c-B,b[8]=a*c+m,b[1]=h*e,b[5]=m*c+a,b[9]=B*c-p,b[2]=-c,b[6]=g*h,b[10]=d*h):'YZX'===a.order?(a=d*h,B=d*c,p=g*h,m=g*c,b[0]=h*k,b[4]=m-a*e,b[8]=p*e+B,b[1]=e,b[5]=d*k,b[9]=-g*k,b[2]=-c*k,b[6]=B* +e+p,b[10]=a-m*e):'XZY'===a.order&&(a=d*h,B=d*c,p=g*h,m=g*c,b[0]=h*k,b[4]=-e,b[8]=c*k,b[1]=a*e+m,b[5]=d*k,b[9]=B*e-p,b[2]=p*e-B,b[6]=g*k,b[10]=m*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},makeRotationFromQuaternion:function(){var a=new c(0,0,0),b=new c(1,1,1);return function(g){return this.compose(a,g,b)}}(),lookAt:function(){var a=new c,b=new c,g=new c;return function(c,e,d){var h=this.elements;g.subVectors(c,e);0===g.lengthSq()&&(g.z=1);g.normalize();a.crossVectors(d, +g);0===a.lengthSq()&&(1===Math.abs(d.z)?g.x+=1E-4:g.z+=1E-4,g.normalize(),a.crossVectors(d,g));a.normalize();b.crossVectors(g,a);h[0]=a.x;h[4]=b.x;h[8]=g.x;h[1]=a.y;h[5]=b.y;h[9]=g.y;h[2]=a.z;h[6]=b.z;h[10]=g.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn('THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.'),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},premultiply:function(a){return this.multiplyMatrices(a,this)}, +multiplyMatrices:function(a,b){var g=a.elements,c=b.elements;b=this.elements;a=g[0];var e=g[4],d=g[8],h=g[12],k=g[1],B=g[5],p=g[9],m=g[13],l=g[2],n=g[6],q=g[10],r=g[14],t=g[3],u=g[7],z=g[11];g=g[15];var v=c[0],w=c[4],E=c[8],C=c[12],D=c[1],sa=c[5],K=c[9],I=c[13],S=c[2],H=c[6],Q=c[10],M=c[14],Pa=c[3],ec=c[7],Fa=c[11];c=c[15];b[0]=a*v+e*D+d*S+h*Pa;b[4]=a*w+e*sa+d*H+h*ec;b[8]=a*E+e*K+d*Q+h*Fa;b[12]=a*C+e*I+d*M+h*c;b[1]=k*v+B*D+p*S+m*Pa;b[5]=k*w+B*sa+p*H+m*ec;b[9]=k*E+B*K+p*Q+m*Fa;b[13]=k*C+B*I+p*M+m* +c;b[2]=l*v+n*D+q*S+r*Pa;b[6]=l*w+n*sa+q*H+r*ec;b[10]=l*E+n*K+q*Q+r*Fa;b[14]=l*C+n*I+q*M+r*c;b[3]=t*v+u*D+z*S+g*Pa;b[7]=t*w+u*sa+z*H+g*ec;b[11]=t*E+u*K+z*Q+g*Fa;b[15]=t*C+u*I+z*M+g*c;return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},applyToBufferAttribute:function(){var a=new c;return function(b){for(var g=0,c=b.count;gthis.determinant()&&(h=-h);g.x=d[12];g.y=d[13];g.z=d[14];b.copy(this);g=1/h;d=1/k;var p=1/B;b.elements[0]*=g;b.elements[1]*=g;b.elements[2]*=g;b.elements[4]*=d;b.elements[5]*=d;b.elements[6]*=d;b.elements[8]*=p;b.elements[9]*=p;b.elements[10]*=p;c.setFromRotationMatrix(b);e.x=h;e.y=k;e.z=B;return this}}(),makePerspective:function(a,b,g,c,e,d){void 0===d&&console.warn('THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.');var h=this.elements;h[0]= +2*e/(b-a);h[4]=0;h[8]=(b+a)/(b-a);h[12]=0;h[1]=0;h[5]=2*e/(g-c);h[9]=(g+c)/(g-c);h[13]=0;h[2]=0;h[6]=0;h[10]=-(d+e)/(d-e);h[14]=-2*d*e/(d-e);h[3]=0;h[7]=0;h[11]=-1;h[15]=0;return this},makeOrthographic:function(a,b,g,c,e,d){var h=this.elements,k=1/(b-a),B=1/(g-c),p=1/(d-e);h[0]=2*k;h[4]=0;h[8]=0;h[12]=-((b+a)*k);h[1]=0;h[5]=2*B;h[9]=0;h[13]=-((g+c)*B);h[2]=0;h[6]=0;h[10]=-2*p;h[14]=-((d+e)*p);h[3]=0;h[7]=0;h[11]=0;h[15]=1;return this},equals:function(a){var b=this.elements;a=a.elements;for(var g= +0;16>g;g++)if(b[g]!==a[g])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var g=0;16>g;g++)this.elements[g]=a[g+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var g=this.elements;a[b]=g[0];a[b+1]=g[1];a[b+2]=g[2];a[b+3]=g[3];a[b+4]=g[4];a[b+5]=g[5];a[b+6]=g[6];a[b+7]=g[7];a[b+8]=g[8];a[b+9]=g[9];a[b+10]=g[10];a[b+11]=g[11];a[b+12]=g[12];a[b+13]=g[13];a[b+14]=g[14];a[b+15]=g[15];return a}});var Lb={alphamap_fragment:'#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif', +alphamap_pars_fragment:'#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif',alphatest_fragment:'#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif',aomap_fragment:'#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif', +aomap_pars_fragment:'#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif',begin_vertex:'vec3 transformed = vec3( position );',beginnormal_vertex:'vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif',bsdfs:'vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick( specularColor, dotNV );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}', bumpmap_pars_fragment:'#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif', clipping_planes_fragment:'#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif', clipping_planes_pars_fragment:'#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif',clipping_planes_pars_vertex:'#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif',clipping_planes_vertex:'#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif', @@ -468,11 +472,11 @@ envmap_vertex:'#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_N fog_vertex:'#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif',fog_pars_vertex:'#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif',fog_fragment:'#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif',fog_pars_fragment:'#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif', gradientmap_pars_fragment:'#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif',lightmap_fragment:'#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif', lightmap_pars_fragment:'#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif',lights_lambert_vertex:'vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif', -lights_pars_begin:'uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif', +lights_pars_begin:'uniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif', lights_phong_fragment:'BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;',lights_phong_pars_fragment:'varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)', lights_physical_fragment:'PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif', lights_physical_pars_fragment:'struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#endif\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\tfloat clearCoatInv = 1.0 - clearCoatDHR;\n\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec3 singleScattering = vec3( 0.0 );\n\t\tvec3 multiScattering = vec3( 0.0 );\n\t\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\t\tvec3 diffuse = material.diffuseColor;\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * singleScattering;\n\t\treflectedLight.indirectDiffuse += multiScattering * cosineWeightedIrradiance;\n\t\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\t#else\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#endif\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}', -lights_fragment_begin:'\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 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#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? 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#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? 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 )\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#ifdef USE_SHADOWMAP\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 irradiance = getAmbientLightIrradiance( ambientLightColor );\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', +lights_fragment_begin:'\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 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#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? 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#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? 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 )\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#ifdef USE_SHADOWMAP\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 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', lights_fragment_maps:'#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), maxMipLevel );\n\t#ifndef STANDARD\n\t\tclearCoatRadiance += getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );\n\t#endif\n#endif', lights_fragment_end:'#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, irradiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif',logdepthbuf_fragment:'#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif',logdepthbuf_pars_fragment:'#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n#endif', logdepthbuf_pars_vertex:'#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif',logdepthbuf_vertex:'#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif',map_fragment:'#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif', @@ -519,530 +523,537 @@ points_vert:'uniform float size;\nuniform float scale;\n#include \n#incl shadow_frag:'uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n}',shadow_vert:'#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}', sprite_frag:'uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n}', sprite_vert:'uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}'}, -Lc={clone:u,merge:v},Ae={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643, +wj={clone:t,merge:z},yd={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643, darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055, grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184, lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130, palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780, -teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Object.assign(z.prototype,{isColor:!0,r:1,g:1,b:1,set:function(a){a&&a.isColor?this.copy(a):'number'===typeof a?this.setHex(a):'string'===typeof a&&this.setStyle(a);return this},setScalar:function(a){this.b=this.g=this.r=a;return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255; -return this},setRGB:function(a,b,e){this.r=a;this.g=b;this.b=e;return this},setHSL:function(){function a(a,b,e){0>e&&(e+=1);1e?b:e<2/3?a+6*(b-a)*(2/3-e):a}return function(b,e,c){b=ac.euclideanModulo(b,1);e=ac.clamp(e,0,1);c=ac.clamp(c,0,1);0===e?this.r=this.g=this.b=c:(e=.5>=c?c*(1+e):c+e-c*e,c=2*c-e,this.r=a(c,e,b+1/3),this.g=a(c,e,b),this.b=a(c,e,b-1/3));return this}}(),setStyle:function(a){function b(b){void 0!==b&&1>parseFloat(b)&&console.warn('THREE.Color: Alpha component of '+ -a+' will be ignored.')}var e;if(e=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var c=e[2];switch(e[1]){case 'rgb':case 'rgba':if(e=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(c))return this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,b(e[5]),this;if(e=/^(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(c))return this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2], -10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,b(e[5]),this;break;case 'hsl':case 'hsla':if(e=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(c)){c=parseFloat(e[1])/360;var d=parseInt(e[2],10)/100,g=parseInt(e[3],10)/100;b(e[5]);return this.setHSL(c,d,g)}}}else if(e=/^#([A-Fa-f0-9]+)$/.exec(a)){e=e[1];c=e.length;if(3===c)return this.r=parseInt(e.charAt(0)+e.charAt(0),16)/255,this.g=parseInt(e.charAt(1)+e.charAt(1),16)/255,this.b=parseInt(e.charAt(2)+e.charAt(2), -16)/255,this;if(6===c)return this.r=parseInt(e.charAt(0)+e.charAt(1),16)/255,this.g=parseInt(e.charAt(2)+e.charAt(3),16)/255,this.b=parseInt(e.charAt(4)+e.charAt(5),16)/255,this}a&&0>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255; +return this},setRGB:function(a,b,g){this.r=a;this.g=b;this.b=g;return this},setHSL:function(){function a(a,b,g){0>g&&(g+=1);1g?b:g<2/3?a+6*(b-a)*(2/3-g):a}return function(b,g,c){b=cb.euclideanModulo(b,1);g=cb.clamp(g,0,1);c=cb.clamp(c,0,1);0===g?this.r=this.g=this.b=c:(g=.5>=c?c*(1+g):c+g-c*g,c=2*c-g,this.r=a(c,g,b+1/3),this.g=a(c,g,b),this.b=a(c,g,b-1/3));return this}}(),setStyle:function(a){function b(b){void 0!==b&&1>parseFloat(b)&&console.warn('THREE.Color: Alpha component of '+ +a+' will be ignored.')}var g;if(g=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var c=g[2];switch(g[1]){case 'rgb':case 'rgba':if(g=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(c))return this.r=Math.min(255,parseInt(g[1],10))/255,this.g=Math.min(255,parseInt(g[2],10))/255,this.b=Math.min(255,parseInt(g[3],10))/255,b(g[5]),this;if(g=/^(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(c))return this.r=Math.min(100,parseInt(g[1],10))/100,this.g=Math.min(100,parseInt(g[2], +10))/100,this.b=Math.min(100,parseInt(g[3],10))/100,b(g[5]),this;break;case 'hsl':case 'hsla':if(g=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(c)){c=parseFloat(g[1])/360;var e=parseInt(g[2],10)/100,d=parseInt(g[3],10)/100;b(g[5]);return this.setHSL(c,e,d)}}}else if(g=/^#([A-Fa-f0-9]+)$/.exec(a)){g=g[1];c=g.length;if(3===c)return this.r=parseInt(g.charAt(0)+g.charAt(0),16)/255,this.g=parseInt(g.charAt(1)+g.charAt(1),16)/255,this.b=parseInt(g.charAt(2)+g.charAt(2), +16)/255,this;if(6===c)return this.r=parseInt(g.charAt(0)+g.charAt(1),16)/255,this.g=parseInt(g.charAt(2)+g.charAt(3),16)/255,this.b=parseInt(g.charAt(4)+g.charAt(5),16)/255,this}a&&0a?.0773993808*a:Math.pow(.9478672986*a+.0521327014,2.4)}return function(b){this.r=a(b.r);this.g=a(b.g);this.b= a(b.b);return this}}(),copyLinearToSRGB:function(){function a(a){return.0031308>a?12.92*a:1.055*Math.pow(a,.41666)-.055}return function(b){this.r=a(b.r);this.g=a(b.g);this.b=a(b.b);return this}}(),convertSRGBToLinear:function(){this.copySRGBToLinear(this);return this},convertLinearToSRGB:function(){this.copyLinearToSRGB(this);return this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return('000000'+this.getHex().toString(16)).slice(-6)},getHSL:function(a){void 0=== -a&&(console.warn('THREE.Color: .getHSL() target is now required'),a={h:0,s:0,l:0});var b=this.r,e=this.g,c=this.b,d=Math.max(b,e,c),g=Math.min(b,e,c),h,k=(g+d)/2;if(g===d)g=h=0;else{var n=d-g;g=.5>=k?n/(d+g):n/(2-d-g);switch(d){case b:h=(e-c)/n+(eMath.abs(h)?(this._x=Math.atan2(-m,d),this._z=Math.atan2(-g,a)):(this._x=Math.atan2(l,n),this._z=0)):'YXZ'===b?(this._x=Math.asin(-c(m,-1,1)),.99999>Math.abs(m)?(this._y=Math.atan2(h,d),this._z=Math.atan2(k,n)):(this._y=Math.atan2(-B,a),this._z=0)):'ZXY'===b?(this._x=Math.asin(c(l,-1,1)),.99999>Math.abs(l)?(this._y=Math.atan2(-B,d),this._z=Math.atan2(-g,n)):(this._y=0,this._z=Math.atan2(k,a))): -'ZYX'===b?(this._y=Math.asin(-c(B,-1,1)),.99999>Math.abs(B)?(this._x=Math.atan2(l,d),this._z=Math.atan2(k,a)):(this._x=0,this._z=Math.atan2(-g,n))):'YZX'===b?(this._z=Math.asin(c(k,-1,1)),.99999>Math.abs(k)?(this._x=Math.atan2(-m,n),this._y=Math.atan2(-B,a)):(this._x=0,this._y=Math.atan2(h,d))):'XZY'===b?(this._z=Math.asin(-c(g,-1,1)),.99999>Math.abs(g)?(this._x=Math.atan2(l,n),this._y=Math.atan2(h,a)):(this._x=Math.atan2(-m,d),this._y=0)):console.warn('THREE.Euler: .setFromRotationMatrix() given unsupported order: '+ -b);this._order=b;if(!1!==e)this.onChangeCallback();return this},setFromQuaternion:function(){var a=new c;return function(b,e,c){a.makeRotationFromQuaternion(b);return this.setFromRotationMatrix(a,e,c)}}(),setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(){var a=new g;return function(b){a.setFromEuler(this);return this.setFromQuaternion(a,b)}}(),equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){this._x= -a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._order;return a},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new h(this._x,this._y,this._z)},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}});Object.assign(C.prototype,{set:function(a){this.mask=1<h;h++)if(c[h]===c[(h+1)%3]){a.push(g);break}for(g=a.length-1;0<=g;g--)for(c=a[g],this.faces.splice(c,1),e=0,d=this.faceVertexUvs.length;e< -d;e++)this.faceVertexUvs[e].splice(c,1);g=this.vertices.length-b.length;this.vertices=b;return g},setFromPoints:function(a){this.vertices=[];for(var b=0,e=a.length;bthis.opacity&&(c.opacity=this.opacity);!0===this.transparent&&(c.transparent=this.transparent);c.depthFunc=this.depthFunc;c.depthTest=this.depthTest;c.depthWrite=this.depthWrite;0!==this.rotation&&(c.rotation=this.rotation);!0===this.polygonOffset&&(c.polygonOffset=!0);0!==this.polygonOffsetFactor&&(c.polygonOffsetFactor=this.polygonOffsetFactor);0!==this.polygonOffsetUnits&&(c.polygonOffsetUnits=this.polygonOffsetUnits); -1!==this.linewidth&&(c.linewidth=this.linewidth);void 0!==this.dashSize&&(c.dashSize=this.dashSize);void 0!==this.gapSize&&(c.gapSize=this.gapSize);void 0!==this.scale&&(c.scale=this.scale);!0===this.dithering&&(c.dithering=!0);0a?b.copy(this.origin):b.copy(this.direction).multiplyScalar(a).add(this.origin)},distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},distanceSqToPoint:function(){var a=new h;return function(b){var e=a.subVectors(b,this.origin).dot(this.direction);if(0>e)return this.origin.distanceToSquared(b);a.copy(this.direction).multiplyScalar(e).add(this.origin);return a.distanceToSquared(b)}}(),distanceSqToSegment:function(){var a= -new h,b=new h,e=new h;return function(c,d,g,h){a.copy(c).add(d).multiplyScalar(.5);b.copy(d).sub(c).normalize();e.copy(this.origin).sub(a);var k=.5*c.distanceTo(d),n=-this.direction.dot(b),m=e.dot(this.direction),l=-e.dot(b),p=e.lengthSq(),q=Math.abs(1-n*n);if(0=-r?d<=r?(k=1/q,c*=k,d*=k,n=c*(c+n*d+2*m)+d*(n*c+d+2*l)+p):(d=k,c=Math.max(0,-(n*d+m)),n=-c*c+d*(d+2*l)+p):(d=-k,c=Math.max(0,-(n*d+m)),n=-c*c+d*(d+2*l)+p):d<=-r?(c=Math.max(0,-(-n*k+m)),d=0b)return null; -b=Math.sqrt(b-d);d=c-b;c+=b;return 0>d&&0>c?null:0>d?this.at(c,e):this.at(d,e)}}(),intersectsSphere:function(a){return this.distanceSqToPoint(a.center)<=a.radius*a.radius},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){a=this.distanceToPlane(a);return null===a?null:this.at(a,b)},intersectsPlane:function(a){var b=a.distanceToPoint(this.origin); -return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},intersectBox:function(a,b){var e=1/this.direction.x,c=1/this.direction.y,d=1/this.direction.z,g=this.origin;if(0<=e){var h=(a.min.x-g.x)*e;e*=a.max.x-g.x}else h=(a.max.x-g.x)*e,e*=a.min.x-g.x;if(0<=c){var k=(a.min.y-g.y)*c;c*=a.max.y-g.y}else k=(a.max.y-g.y)*c,c*=a.min.y-g.y;if(h>c||k>e)return null;if(k>h||h!==h)h=k;if(ca||k>e)return null;if(k>h|| -h!==h)h=k;if(ae?null:this.at(0<=h?h:e,b)},intersectsBox:function(){var a=new h;return function(b){return null!==this.intersectBox(b,a)}}(),intersectTriangle:function(){var a=new h,b=new h,e=new h,c=new h;return function(d,g,h,k,n){b.subVectors(g,d);e.subVectors(h,d);c.crossVectors(b,e);g=this.direction.dot(c);if(0g)k=-1,g=-g;else return null;a.subVectors(this.origin,d);d=k*this.direction.dot(e.crossVectors(a,e));if(0>d)return null;h=k*this.direction.dot(b.cross(a)); -if(0>h||d+h>g)return null;d=-k*a.dot(c);return 0>d?null:this.at(d/g,n)}}(),applyMatrix4:function(a){this.origin.applyMatrix4(a);this.direction.transformDirection(a);return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}});Object.assign(ra,{getNormal:function(){var a=new h;return function(b,e,c,d){void 0===d&&(console.warn('THREE.Triangle: .getNormal() target is now required'),d=new h);d.subVectors(c,e);a.subVectors(b,e);d.cross(a);b=d.lengthSq();return 0< -b?d.multiplyScalar(1/Math.sqrt(b)):d.set(0,0,0)}}(),getBarycoord:function(){var a=new h,b=new h,e=new h;return function(c,d,g,k,n){a.subVectors(k,d);b.subVectors(g,d);e.subVectors(c,d);c=a.dot(a);d=a.dot(b);g=a.dot(e);var m=b.dot(b);k=b.dot(e);var l=c*m-d*d;void 0===n&&(console.warn('THREE.Triangle: .getBarycoord() target is now required'),n=new h);if(0===l)return n.set(-2,-1,-1);l=1/l;m=(m*g-d*k)*l;c=(c*k-d*g)*l;return n.set(1-m-c,c,m)}}(),containsPoint:function(){var a=new h;return function(b,e, -c,d){ra.getBarycoord(b,e,c,d,a);return 0<=a.x&&0<=a.y&&1>=a.x+a.y}}(),getUV:function(){var a=new h;return function(b,e,c,d,g,h,k,n){this.getBarycoord(b,e,c,d,a);n.set(0,0);n.addScaledVector(g,a.x);n.addScaledVector(h,a.y);n.addScaledVector(k,a.z);return n}}()});Object.assign(ra.prototype,{set:function(a,b,e){this.a.copy(a);this.b.copy(b);this.c.copy(e);return this},setFromPointsAndIndices:function(a,b,e,c){this.a.copy(a[b]);this.b.copy(a[e]);this.c.copy(a[c]);return this},clone:function(){return(new this.constructor).copy(this)}, -copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},getArea:function(){var a=new h,b=new h;return function(){a.subVectors(this.c,this.b);b.subVectors(this.a,this.b);return.5*a.cross(b).length()}}(),getMidpoint:function(a){void 0===a&&(console.warn('THREE.Triangle: .getMidpoint() target is now required'),a=new h);return a.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(a){return ra.getNormal(this.a,this.b,this.c,a)},getPlane:function(a){void 0=== -a&&(console.warn('THREE.Triangle: .getPlane() target is now required'),a=new h);return a.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(a,b){return ra.getBarycoord(a,this.a,this.b,this.c,b)},containsPoint:function(a){return ra.containsPoint(a,this.a,this.b,this.c)},getUV:function(a,b,e,c,d){return ra.getUV(a,this.a,this.b,this.c,b,e,c,d)},intersectsBox:function(a){return a.intersectsTriangle(this)},closestPointToPoint:function(){var a=new h,b=new h,e=new h,c=new h,d=new h,g=new h; -return function(k,n){void 0===n&&(console.warn('THREE.Triangle: .closestPointToPoint() target is now required'),n=new h);var m=this.a,l=this.b,p=this.c;a.subVectors(l,m);b.subVectors(p,m);c.subVectors(k,m);var q=a.dot(c),r=b.dot(c);if(0>=q&&0>=r)return n.copy(m);d.subVectors(k,l);var B=a.dot(d),u=b.dot(d);if(0<=B&&u<=B)return n.copy(l);var t=q*u-B*r;if(0>=t&&0<=q&&0>=B)return l=q/(q-B),n.copy(m).addScaledVector(a,l);g.subVectors(k,p);k=a.dot(g);var v=b.dot(g);if(0<=v&&k<=v)return n.copy(p);q=k*r- -q*v;if(0>=q&&0<=r&&0>=v)return t=r/(r-v),n.copy(m).addScaledVector(b,t);r=B*v-k*u;if(0>=r&&0<=u-B&&0<=k-v)return e.subVectors(p,l),t=(u-B)/(u-B+(k-v)),n.copy(l).addScaledVector(e,t);p=1/(r+q+t);l=q*p;t*=p;return n.copy(m).addScaledVector(a,l).addScaledVector(b,t)}}(),equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)}});ya.prototype=Object.create(ha.prototype);ya.prototype.constructor=ya;ya.prototype.isMeshBasicMaterial=!0;ya.prototype.copy=function(a){ha.prototype.copy.call(this, -a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning= -a.skinning;this.morphTargets=a.morphTargets;return this};U.prototype=Object.assign(Object.create(P.prototype),{constructor:U,isMesh:!0,setDrawMode:function(a){this.drawMode=a},copy:function(a){P.prototype.copy.call(this,a);this.drawMode=a.drawMode;void 0!==a.morphTargetInfluences&&(this.morphTargetInfluences=a.morphTargetInfluences.slice());void 0!==a.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},a.morphTargetDictionary));return this},updateMorphTargets:function(){var a=this.geometry; -if(a.isBufferGeometry){a=a.morphAttributes;var b=Object.keys(a);if(0e.far?null:{distance:b,point:D.clone(),object:a}}function b(b,e,c,g,h,k,p,q,r){n.fromBufferAttribute(h,p);m.fromBufferAttribute(h,q);l.fromBufferAttribute(h,r);if(b=a(b,e,c,g,n,m,l,z))k&&(u.fromBufferAttribute(k,p),v.fromBufferAttribute(k,q),w.fromBufferAttribute(k,r),b.uv=ra.getUV(z,n,m,l,u,v,w,new d)),k=new K(p,q, -r),ra.getNormal(n,m,l,k.normal),b.face=k;return b}var e=new c,g=new va,k=new t,n=new h,m=new h,l=new h,p=new h,q=new h,r=new h,u=new d,v=new d,w=new d,z=new h,D=new h;return function(c,h){var B=this.geometry,t=this.material,D=this.matrixWorld;if(void 0!==t&&(null===B.boundingSphere&&B.computeBoundingSphere(),k.copy(B.boundingSphere),k.applyMatrix4(D),!1!==c.ray.intersectsSphere(k)&&(e.getInverse(D),g.copy(c.ray).applyMatrix4(e),null===B.boundingBox||!1!==g.intersectsBox(B.boundingBox))))if(B.isBufferGeometry){var H= -B.index,C=B.attributes.position,K=B.attributes.uv,G=B.groups;B=B.drawRange;var U,I;if(null!==H)if(Array.isArray(t)){var P=0;for(U=G.length;Pc.far||h.push({distance:B,point:b.clone(),uv:ra.getUV(b,l,p,q,r,u,t,new d),face:null,object:this})}}(),clone:function(){return(new this.constructor(this.material)).copy(this)},copy:function(a){P.prototype.copy.call(this,a);void 0!==a.center&& -this.center.copy(a.center);return this}});kg.prototype=Object.assign(Object.create(P.prototype),{constructor:kg,copy:function(a){P.prototype.copy.call(this,a,!1);a=a.levels;for(var b=0,e=a.length;b=c[d].distance)c[d-1].object.visible= -!1,c[d].object.visible=!0;else break;for(;dg||(p.applyMatrix4(this.matrixWorld),t=c.ray.origin.distanceTo(p),tc.far||d.push({distance:t,point:n.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this}))}}else for(k= -0,B=u.length/3-1;kg||(p.applyMatrix4(this.matrixWorld),t=c.ray.origin.distanceTo(p),tc.far||d.push({distance:t,point:n.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this}))}else if(k.isGeometry)for(m=k.vertices,l=m.length,k=0;kg||(p.applyMatrix4(this.matrixWorld),t=c.ray.origin.distanceTo(p),tc.far||d.push({distance:t, -point:n.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});Kb.prototype=Object.assign(Object.create(fb.prototype),{constructor:Kb,isLineSegments:!0,computeLineDistances:function(){var a=new h,b=new h;return function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var c=e.attributes.position,d=[],g=0,h=c.count;gc.far||d.push({distance:a,distanceToRay:Math.sqrt(g),point:q.clone(),index:e,face:null,object:k}))}var k=this,n=this.geometry,m=this.matrixWorld,l=c.params.Points.threshold;null===n.boundingSphere&&n.computeBoundingSphere();e.copy(n.boundingSphere);e.applyMatrix4(m);e.radius+=l;if(!1!==c.ray.intersectsSphere(e)){a.getInverse(m);b.copy(c.ray).applyMatrix4(a);l/=(this.scale.x+this.scale.y+this.scale.z)/3;var p=l*l;l=new h;var q=new h;if(n.isBufferGeometry){var r= -n.index;n=n.attributes.position.array;if(null!==r){var u=r.array;r=0;for(var B=u.length;r=a.HAVE_CURRENT_DATA&& -(this.needsUpdate=!0)}});wc.prototype=Object.create(l.prototype);wc.prototype.constructor=wc;wc.prototype.isCompressedTexture=!0;lg.prototype=Object.create(l.prototype);lg.prototype.constructor=lg;lg.prototype.isCanvasTexture=!0;vf.prototype=Object.create(l.prototype);vf.prototype.constructor=vf;vf.prototype.isDepthTexture=!0;ug.prototype=Object.create(ea.prototype);ug.prototype.constructor=ug;Ng.prototype=Object.create(Q.prototype);Ng.prototype.constructor=Ng;vg.prototype=Object.create(ea.prototype); -vg.prototype.constructor=vg;Ne.prototype=Object.create(Q.prototype);Ne.prototype.constructor=Ne;ob.prototype=Object.create(ea.prototype);ob.prototype.constructor=ob;Yf.prototype=Object.create(Q.prototype);Yf.prototype.constructor=Yf;mg.prototype=Object.create(ob.prototype);mg.prototype.constructor=mg;fd.prototype=Object.create(Q.prototype);fd.prototype.constructor=fd;eg.prototype=Object.create(ob.prototype);eg.prototype.constructor=eg;wf.prototype=Object.create(Q.prototype);wf.prototype.constructor= -wf;wg.prototype=Object.create(ob.prototype);wg.prototype.constructor=wg;Ag.prototype=Object.create(Q.prototype);Ag.prototype.constructor=Ag;xf.prototype=Object.create(ob.prototype);xf.prototype.constructor=xf;ve.prototype=Object.create(Q.prototype);ve.prototype.constructor=ve;ge.prototype=Object.create(ea.prototype);ge.prototype.constructor=ge;ge.prototype.toJSON=function(){var a=ea.prototype.toJSON.call(this);a.path=this.parameters.path.toJSON();return a};cd.prototype=Object.create(Q.prototype); -cd.prototype.constructor=cd;pe.prototype=Object.create(ea.prototype);pe.prototype.constructor=pe;Oe.prototype=Object.create(Q.prototype);Oe.prototype.constructor=Oe;we.prototype=Object.create(ea.prototype);we.prototype.constructor=we;var ib={triangulate:function(a,b,e){e=e||2;var c=b&&b.length,d=c?b[0]*e:a.length,g=Bg(a,0,d,e,!0),h=[];if(!g)return h;var k;if(c){var n=e;c=[];var m,l=0;for(m=b.length;l80*e){var q=k=a[0],r=c=a[1];for(n=e;nk&&(k=l),b>c&&(c=b);k=Math.max(k-q,c-r);k=0!==k?1/k:0}Se(g,h,e,q,r,k);return h}},kc={area:function(a){for(var b=a.length,e=0,c=b-1,d=0;dkc.area(a)},triangulateShape:function(a,b){var e=[],c=[],d=[];Og(a);Pg(e,a);var g=a.length;b.forEach(Og); -for(a=0;aMath.abs(k-m)?[new d(a,1-e),new d(n,1-c),new d(l,1-g),new d(q,1-b)]:[new d(k,1-e),new d(m,1-c),new d(p,1-g),new d(r,1-b)]}};yf.prototype=Object.create(Q.prototype); -yf.prototype.constructor=yf;ng.prototype=Object.create(oc.prototype);ng.prototype.constructor=ng;Bc.prototype=Object.create(Q.prototype);Bc.prototype.constructor=Bc;jb.prototype=Object.create(ea.prototype);jb.prototype.constructor=jb;zd.prototype=Object.create(Q.prototype);zd.prototype.constructor=zd;gb.prototype=Object.create(ea.prototype);gb.prototype.constructor=gb;Ha.prototype=Object.create(Q.prototype);Ha.prototype.constructor=Ha;db.prototype=Object.create(ea.prototype);db.prototype.constructor= -db;Eb.prototype=Object.create(Q.prototype);Eb.prototype.constructor=Eb;Eb.prototype.toJSON=function(){var a=Q.prototype.toJSON.call(this);return gd(this.parameters.shapes,a)};tb.prototype=Object.create(ea.prototype);tb.prototype.constructor=tb;tb.prototype.toJSON=function(){var a=ea.prototype.toJSON.call(this);return gd(this.parameters.shapes,a)};Fe.prototype=Object.create(ea.prototype);Fe.prototype.constructor=Fe;xg.prototype=Object.create(Q.prototype);xg.prototype.constructor=xg;Pf.prototype=Object.create(ea.prototype); -Pf.prototype.constructor=Pf;ai.prototype=Object.create(xg.prototype);ai.prototype.constructor=ai;og.prototype=Object.create(Pf.prototype);og.prototype.constructor=og;Xg.prototype=Object.create(Q.prototype);Xg.prototype.constructor=Xg;Yg.prototype=Object.create(ea.prototype);Yg.prototype.constructor=Yg;var ec=Object.freeze({WireframeGeometry:ug,ParametricGeometry:Ng,ParametricBufferGeometry:vg,TetrahedronGeometry:Yf,TetrahedronBufferGeometry:mg,OctahedronGeometry:fd,OctahedronBufferGeometry:eg,IcosahedronGeometry:wf, -IcosahedronBufferGeometry:wg,DodecahedronGeometry:Ag,DodecahedronBufferGeometry:xf,PolyhedronGeometry:Ne,PolyhedronBufferGeometry:ob,TubeGeometry:ve,TubeBufferGeometry:ge,TorusKnotGeometry:cd,TorusKnotBufferGeometry:pe,TorusGeometry:Oe,TorusBufferGeometry:we,TextGeometry:yf,TextBufferGeometry:ng,SphereGeometry:Bc,SphereBufferGeometry:jb,RingGeometry:zd,RingBufferGeometry:gb,PlaneGeometry:O,PlaneBufferGeometry:ua,LatheGeometry:Ha,LatheBufferGeometry:db,ShapeGeometry:Eb,ShapeBufferGeometry:tb,ExtrudeGeometry:fg, -ExtrudeBufferGeometry:oc,EdgesGeometry:Fe,ConeGeometry:ai,ConeBufferGeometry:og,CylinderGeometry:xg,CylinderBufferGeometry:Pf,CircleGeometry:Xg,CircleBufferGeometry:Yg,BoxGeometry:qa,BoxBufferGeometry:oa});Qg.prototype=Object.create(ha.prototype);Qg.prototype.constructor=Qg;Qg.prototype.isShadowMaterial=!0;Qg.prototype.copy=function(a){ha.prototype.copy.call(this,a);this.color.copy(a.color);return this};ch.prototype=Object.create(ka.prototype);ch.prototype.constructor=ch;ch.prototype.isRawShaderMaterial= -!0;ye.prototype=Object.create(ha.prototype);ye.prototype.constructor=ye;ye.prototype.isMeshStandardMaterial=!0;ye.prototype.copy=function(a){ha.prototype.copy.call(this,a);this.defines={STANDARD:''};this.color.copy(a.color);this.roughness=a.roughness;this.metalness=a.metalness;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity= -a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.roughnessMap=a.roughnessMap;this.metalnessMap=a.metalnessMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.envMapIntensity=a.envMapIntensity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe; -this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};pg.prototype=Object.create(ye.prototype);pg.prototype.constructor=pg;pg.prototype.isMeshPhysicalMaterial=!0;pg.prototype.copy=function(a){ye.prototype.copy.call(this,a);this.defines={PHYSICAL:''};this.reflectivity=a.reflectivity;this.clearCoat=a.clearCoat;this.clearCoatRoughness= -a.clearCoatRoughness;return this};hf.prototype=Object.create(ha.prototype);hf.prototype.constructor=hf;hf.prototype.isMeshPhongMaterial=!0;hf.prototype.copy=function(a){ha.prototype.copy.call(this,a);this.color.copy(a.color);this.specular.copy(a.specular);this.shininess=a.shininess;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity= -a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth= -a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Qf.prototype=Object.create(hf.prototype);Qf.prototype.constructor=Qf;Qf.prototype.isMeshToonMaterial=!0;Qf.prototype.copy=function(a){hf.prototype.copy.call(this,a);this.gradientMap=a.gradientMap;return this};Cc.prototype=Object.create(ha.prototype);Cc.prototype.constructor=Cc;Cc.prototype.isMeshNormalMaterial= -!0;Cc.prototype.copy=function(a){ha.prototype.copy.call(this,a);this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this}; -Jg.prototype=Object.create(ha.prototype);Jg.prototype.constructor=Jg;Jg.prototype.isMeshLambertMaterial=!0;Jg.prototype.copy=function(a){ha.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap= -a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};bi.prototype=Object.create(ha.prototype);bi.prototype.constructor=bi;bi.prototype.isMeshMatcapMaterial=!0;bi.prototype.copy=function(a){ha.prototype.copy.call(this, -a);this.defines={MATCAP:''};this.color.copy(a.color);this.matcap=a.matcap;this.map=a.map;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.alphaMap=a.alphaMap;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};oh.prototype= -Object.create(Sc.prototype);oh.prototype.constructor=oh;oh.prototype.isLineDashedMaterial=!0;oh.prototype.copy=function(a){Sc.prototype.copy.call(this,a);this.scale=a.scale;this.dashSize=a.dashSize;this.gapSize=a.gapSize;return this};var ub=Object.freeze({ShadowMaterial:Qg,SpriteMaterial:ff,RawShaderMaterial:ch,ShaderMaterial:ka,PointsMaterial:of,MeshPhysicalMaterial:pg,MeshStandardMaterial:ye,MeshPhongMaterial:hf,MeshToonMaterial:Qf,MeshNormalMaterial:Cc,MeshLambertMaterial:Jg,MeshDepthMaterial:rc, -MeshDistanceMaterial:bc,MeshBasicMaterial:ya,MeshMatcapMaterial:bi,LineDashedMaterial:oh,LineBasicMaterial:Sc,Material:ha}),Jb={arraySlice:function(a,b,e){return Jb.isTypedArray(a)?new a.constructor(a.subarray(b,void 0!==e?e:a.length)):a.slice(b,e)},convertArray:function(a,b,e){return!a||!e&&a.constructor===b?a:'number'===typeof b.BYTES_PER_ELEMENT?new b(a):Array.prototype.slice.call(a)},isTypedArray:function(a){return ArrayBuffer.isView(a)&&!(a instanceof DataView)},getKeyframeOrder:function(a){for(var b= -a.length,e=Array(b),c=0;c!==b;++c)e[c]=c;e.sort(function(b,e){return a[b]-a[e]});return e},sortedArray:function(a,b,e){for(var c=a.length,d=new a.constructor(c),g=0,h=0;h!==c;++g)for(var k=e[g]*b,n=0;n!==b;++n)d[h++]=a[k+n];return d},flattenJSON:function(a,b,e,c){for(var d=1,g=a[0];void 0!==g&&void 0===g[c];)g=a[d++];if(void 0!==g){var h=g[c];if(void 0!==h)if(Array.isArray(h)){do h=g[c],void 0!==h&&(b.push(g.time),e.push.apply(e,h)),g=a[d++];while(void 0!==g)}else if(void 0!==h.toArray){do h=g[c], -void 0!==h&&(b.push(g.time),h.toArray(e,e.length)),g=a[d++];while(void 0!==g)}else{do h=g[c],void 0!==h&&(b.push(g.time),e.push(h)),g=a[d++];while(void 0!==g)}}}};Object.assign(Pe.prototype,{evaluate:function(a){var b=this.parameterPositions,e=this._cachedIndex,c=b[e],d=b[e-1];a:{b:{c:{d:if(!(a=d)break a;else{g=b[1];a=d)break b}c=e;e=0}}for(;e>>1,ab;)--g;++g;if(0!==d||g!==c)d>=g&&(g=Math.max(g, -1),d=g-1),a=this.getValueSize(),this.times=Jb.arraySlice(e,d,g),this.values=Jb.arraySlice(this.values,d*a,g*a);return this},validate:function(){var a=!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error('THREE.KeyframeTrack: Invalid value size in track.',this),a=!1);var e=this.times;b=this.values;var c=e.length;0===c&&(console.error('THREE.KeyframeTrack: Track is empty.',this),a=!1);for(var d=null,g=0;g!==c;g++){var h=e[g];if('number'===typeof h&&isNaN(h)){console.error('THREE.KeyframeTrack: Time is not a valid number.', -this,g,h);a=!1;break}if(null!==d&&d>h){console.error('THREE.KeyframeTrack: Out of order keys.',this,g,h,d);a=!1;break}d=h}if(void 0!==b&&Jb.isTypedArray(b))for(g=0,e=b.length;g!==e;++g)if(c=b[g],isNaN(c)){console.error('THREE.KeyframeTrack: Value is not a valid number.',this,g,c);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values,e=this.getValueSize(),c=2302===this.getInterpolation(),d=1,g=a.length-1,h=1;hh)d=a+1;else if(0b&&(b=0);1Number.EPSILON&&(n.normalize(),e=Math.acos(ac.clamp(d[l-1].dot(d[l]),-1,1)),g[l].applyMatrix4(m.makeRotationAxis(n,e))),k[l].crossVectors(d[l],g[l]);if(!0===b)for(e=Math.acos(ac.clamp(g[0].dot(g[a]),-1,1)),e/=a,0 -c;)c+=e;for(;c>e;)c-=e;cd&&(d=1);1E-4>c&&(c=d);1E-4> -m&&(m=d);dd.initNonuniformCatmullRom(g.x,k.x,n.x,e.x,c,d,m);Sg.initNonuniformCatmullRom(g.y,k.y,n.y,e.y,c,d,m);Xe.initNonuniformCatmullRom(g.z,k.z,n.z,e.z,c,d,m)}else'catmullrom'===this.curveType&&(dd.initCatmullRom(g.x,k.x,n.x,e.x,this.tension),Sg.initCatmullRom(g.y,k.y,n.y,e.y,this.tension),Xe.initCatmullRom(g.z,k.z,n.z,e.z,this.tension));b.set(dd.calc(a),Sg.calc(a),Xe.calc(a));return b};se.prototype.copy=function(a){Ab.prototype.copy.call(this,a);this.points=[];for(var b=0,e=a.points.length;b< -e;b++)this.points.push(a.points[b].clone());this.closed=a.closed;this.curveType=a.curveType;this.tension=a.tension;return this};se.prototype.toJSON=function(){var a=Ab.prototype.toJSON.call(this);a.points=[];for(var b=0,e=this.points.length;be.length-2?e.length-1:a+1];e=e[a>e.length-3?e.length-1:a+2];b.set(hi(c,g.x,h.x,k.x,e.x),hi(c,g.y,h.y,k.y,e.y));return b};Ld.prototype.copy=function(a){Ab.prototype.copy.call(this,a);this.points=[];for(var b=0,e=a.points.length;b=b)return b=e[a]-b,a=this.curves[a],e=a.getLength(),a.getPointAt(0===e?0:1-b/e);a++}return null},getLength:function(){var a=this.getCurveLengths();return a[a.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 a=[],b=0,e=0,c=this.curves.length;eNumber.EPSILON){if(0>m&&(h=b[g],n=-n,k=b[d],m=-m),!(a.yk.y))if(a.y===h.y){if(a.x===h.x)return!0}else{d= -m*(a.x-h.x)-n*(a.y-h.y);if(0===d)return!0;0>d||(c=!c)}}else if(a.y===h.y&&(k.x<=a.x&&a.x<=h.x||h.x<=a.x&&a.x<=k.x))return!0}return c}var d=kc.isClockWise,g=this.subPaths;if(0===g.length)return[];if(!0===b)return e(g);b=[];if(1===g.length){var h=g[0],k=new rg;k.curves=h.curves;b.push(k);return b}var n=!d(g[0].getPoints());n=a?!n:n;k=[];var m=[],l=[],p=0;m[p]=void 0;l[p]=[];for(var q=0,r=g.length;qm.opacity&&(m.transparent=!0);c.setTextures(n);return c.parse(m)}}()});var xj,oi={getContext:function(){void 0===xj&&(xj=new (window.AudioContext||window.webkitAudioContext));return xj},setContext:function(a){xj=a}};Object.assign(Ri.prototype, -{load:function(a,b,e,c){var d=new ze(this.manager);d.setResponseType('arraybuffer');d.setPath(this.path);d.load(a,function(a){a=a.slice(0);oi.getContext().decodeAudioData(a,function(a){b(a)})},e,c)},setPath:function(a){this.path=a;return this}});Object.assign($i.prototype,{update:function(){var a,b,e,d,g,h,k,n,m=new c,l=new c;return function(c){if(a!==this||b!==c.focus||e!==c.fov||d!==c.aspect*this.aspect||g!==c.near||h!==c.far||k!==c.zoom||n!==this.eyeSep){a=this;b=c.focus;e=c.fov;d=c.aspect*this.aspect; -g=c.near;h=c.far;k=c.zoom;var p=c.projectionMatrix.clone();n=this.eyeSep/2;var q=n*g/b,r=g*Math.tan(ac.DEG2RAD*e*.5)/k;l.elements[12]=-n;m.elements[12]=n;var u=-r*d+q,t=r*d+q;p.elements[0]=2*g/(t-u);p.elements[8]=(t+u)/(t-u);this.cameraL.projectionMatrix.copy(p);u=-r*d-q;t=r*d-q;p.elements[0]=2*g/(t-u);p.elements[8]=(t+u)/(t-u);this.cameraR.projectionMatrix.copy(p)}this.cameraL.matrixWorld.copy(c.matrixWorld).multiply(l);this.cameraR.matrixWorld.copy(c.matrixWorld).multiply(m)}}()});lh.prototype= -Object.create(P.prototype);lh.prototype.constructor=lh;Object.assign(Eg.prototype,{start:function(){this.oldTime=this.startTime=('undefined'===typeof performance?Date:performance).now();this.elapsedTime=0;this.running=!0},stop:function(){this.getElapsedTime();this.autoStart=this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var a=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var b=('undefined'===typeof performance?Date: -performance).now();a=(b-this.oldTime)/1E3;this.oldTime=b;this.elapsedTime+=a}return a}});Di.prototype=Object.assign(Object.create(P.prototype),{constructor:Di,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null);return this},getFilter:function(){return this.filter},setFilter:function(a){null!==this.filter?(this.gain.disconnect(this.filter), -this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination);this.filter=a;this.gain.connect(this.filter);this.filter.connect(this.context.destination);return this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(a){this.gain.gain.setTargetAtTime(a,this.context.currentTime,.01);return this},updateMatrixWorld:function(){var a=new h,b=new g,e=new h,c=new h,d=new Eg;return function(g){P.prototype.updateMatrixWorld.call(this,g);g=this.context.listener; -var h=this.up;this.timeDelta=d.getDelta();this.matrixWorld.decompose(a,b,e);c.set(0,0,-1).applyQuaternion(b);if(g.positionX){var k=this.context.currentTime+this.timeDelta;g.positionX.linearRampToValueAtTime(a.x,k);g.positionY.linearRampToValueAtTime(a.y,k);g.positionZ.linearRampToValueAtTime(a.z,k);g.forwardX.linearRampToValueAtTime(c.x,k);g.forwardY.linearRampToValueAtTime(c.y,k);g.forwardZ.linearRampToValueAtTime(c.z,k);g.upX.linearRampToValueAtTime(h.x,k);g.upY.linearRampToValueAtTime(h.y,k);g.upZ.linearRampToValueAtTime(h.z, -k)}else g.setPosition(a.x,a.y,a.z),g.setOrientation(c.x,c.y,c.z,h.x,h.y,h.z)}}()});pi.prototype=Object.assign(Object.create(P.prototype),{constructor:pi,getOutput:function(){return this.gain},setNodeSource:function(a){this.hasPlaybackControl=!1;this.sourceType='audioNode';this.source=a;this.connect();return this},setMediaElementSource:function(a){this.hasPlaybackControl=!1;this.sourceType='mediaNode';this.source=this.context.createMediaElementSource(a);this.connect();return this},setBuffer:function(a){this.buffer= -a;this.sourceType='buffer';this.autoplay&&this.play();return this},play:function(){if(!0===this.isPlaying)console.warn('THREE.Audio: Audio is already playing.');else if(!1===this.hasPlaybackControl)console.warn('THREE.Audio: this Audio has no playback control.');else{var a=this.context.createBufferSource();a.buffer=this.buffer;a.loop=this.loop;a.onended=this.onEnded.bind(this);this.startTime=this.context.currentTime;a.start(this.startTime,this.offset);this.isPlaying=!0;this.source=a;this.setDetune(this.detune); -this.setPlaybackRate(this.playbackRate);return this.connect()}},pause:function(){if(!1===this.hasPlaybackControl)console.warn('THREE.Audio: this Audio has no playback control.');else return!0===this.isPlaying&&(this.source.stop(),this.source.onended=null,this.offset+=(this.context.currentTime-this.startTime)*this.playbackRate,this.isPlaying=!1),this},stop:function(){if(!1===this.hasPlaybackControl)console.warn('THREE.Audio: this Audio has no playback control.');else return this.source.stop(),this.source.onended= -null,this.offset=0,this.isPlaying=!1,this},connect:function(){if(0c&&this._mixBufferRegion(e,a,3*b,1-c,b);c=b;for(var g=b+b;c!==g;++c)if(e[c]!==e[c+b]){d.setValue(e,a);break}}, -saveOriginalState:function(){var a=this.buffer,b=this.valueSize,e=3*b;this.binding.getValue(a,e);for(var c=b;c!==e;++c)a[c]=a[e+c%b];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a,b,e,c,d){if(.5<=c)for(c=0;c!==d;++c)a[b+c]=a[e+c]},_slerp:function(a,b,e,c){g.slerpFlat(a,b,a,b,a,e,c)},_lerp:function(a,b,e,c,d){for(var g=1-c,h=0;h!==d;++h){var k=b+h;a[k]=a[k]*g+a[e+h]*c}}});Object.assign(Lj.prototype,{getValue:function(a, -b){this.bind();var e=this._bindings[this._targetGroup.nCachedObjects_];void 0!==e&&e.getValue(a,b)},setValue:function(a,b){for(var e=this._bindings,c=this._targetGroup.nCachedObjects_,d=e.length;c!==d;++c)e[c].setValue(a,b)},bind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,e=a.length;b!==e;++b)a[b].bind()},unbind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,e=a.length;b!==e;++b)a[b].unbind()}});Object.assign($f,{Composite:Lj,create:function(a, -b,e){return a&&a.isAnimationObjectGroup?new $f.Composite(a,b,e):new $f(a,b,e)},sanitizeNodeName:function(){var a=/[\[\]\.:\/]/g;return function(b){return b.replace(/\s/g,'_').replace(a,'')}}(),parseTrackName:function(){var a='[^'+'\\[\\]\\.:\\/'.replace('\\.','')+']',b=/((?:WC+[\/:])*)/.source.replace('WC','[^\\[\\]\\.:\\/]');a=/(WCOD+)?/.source.replace('WCOD',a);var e=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace('WC','[^\\[\\]\\.:\\/]'),c=/\.(WC+)(?:\[(.+)\])?/.source.replace('WC','[^\\[\\]\\.:\\/]'), -d=new RegExp('^'+b+a+e+c+'$'),g=['material','materials','bones'];return function(a){var b=d.exec(a);if(!b)throw Error('PropertyBinding: Cannot parse trackName: '+a);b={nodeName:b[2],objectName:b[3],objectIndex:b[4],propertyName:b[5],propertyIndex:b[6]};var e=b.nodeName&&b.nodeName.lastIndexOf('.');if(void 0!==e&&-1!==e){var c=b.nodeName.substring(e+1);-1!==g.indexOf(c)&&(b.nodeName=b.nodeName.substring(0,e),b.objectName=c)}if(null===b.propertyName||0===b.propertyName.length)throw Error('PropertyBinding: can not parse propertyName from trackName: '+ -a);return b}}(),findNode:function(a,b){if(!b||''===b||'root'===b||'.'===b||-1===b||b===a.name||b===a.uuid)return a;if(a.skeleton){var e=a.skeleton.getBoneByName(b);if(void 0!==e)return e}if(a.children){var c=function(a){for(var e=0;e=b){var l=b++,p=a[l];e[p.uuid]=m;a[m]=p;e[n]=l;a[l]=k;k=0;for(n=d;k!==n;++k){p=c[k];var q=p[m];p[m]=p[l];p[l]=q}}}this.nCachedObjects_=b},uncache:function(){for(var a=this._objects,b=a.length,e=this.nCachedObjects_,c=this._indicesByUUID,d=this._bindings,g=d.length,h=0,k=arguments.length;h!==k;++h){var n= -arguments[h].uuid,m=c[n];if(void 0!==m)if(delete c[n],mb||0===e)return;this._startTime=null;b*=e}b*=this._updateTimeScale(a);e=this._updateTime(b);a=this._updateWeight(a);if(0e.parameterPositions[1]&&(this.stopFading(),0===c&&(this.enabled=!1))}}return this._effectiveWeight=b},_updateTimeScale:function(a){var b=0;if(!this.paused){b=this.timeScale;var e=this._timeScaleInterpolant;if(null!==e){var c=e.evaluate(a)[0];b*=c;a>e.parameterPositions[1]&&(this.stopWarping(),0===b?this.paused=!0:this.timeScale=b)}}return this._effectiveTimeScale=b},_updateTime:function(a){var b=this.time+a,e=this._clip.duration,c=this.loop,d=this._loopCount,g=2202===c;if(0===a)return-1=== -d?b:g&&1===(d&1)?e-b:b;if(2200===c)a:{if(-1===d&&(this._loopCount=0,this._setEndings(!0,!0,!1)),b>=e)b=e;else if(0>b)b=0;else break a;this.clampWhenFinished?this.paused=!0:this.enabled=!1;this._mixer.dispatchEvent({type:'finished',action:this,direction:0>a?-1:1})}else{-1===d&&(0<=a?(d=0,this._setEndings(!0,0===this.repetitions,g)):this._setEndings(0===this.repetitions,!0,g));if(b>=e||0>b){c=Math.floor(b/e);b-=e*c;d+=Math.abs(c);var h=this.repetitions-d;0>=h?(this.clampWhenFinished?this.paused=!0: -this.enabled=!1,b=0a,this._setEndings(a,!a,g)):this._setEndings(!1,!1,g),this._loopCount=d,this._mixer.dispatchEvent({type:'loop',action:this,loopDelta:c}))}if(g&&1===(d&1))return this.time=b,e-b}return this.time=b},_setEndings:function(a,b,e){var c=this._interpolantSettings;e?(c.endingStart=2401,c.endingEnd=2401):(c.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,c.endingEnd=b?this.zeroSlopeAtEnd?2401: -2400:2402)},_scheduleFading:function(a,b,e){var c=this._mixer,d=c.time,g=this._weightInterpolant;null===g&&(this._weightInterpolant=g=c._lendControlInterpolant());c=g.parameterPositions;g=g.sampleValues;c[0]=d;g[0]=b;c[1]=d+a;g[1]=e;return this}});bj.prototype=Object.assign(Object.create(b.prototype),{constructor:bj,_bindAction:function(a,b){var e=a._localRoot||this._root,c=a._clip.tracks,d=c.length,g=a._propertyBindings;a=a._interpolants;var h=e.uuid,k=this._bindingsByRootAndName,n=k[h];void 0=== -n&&(n={},k[h]=n);for(k=0;k!==d;++k){var m=c[k],l=m.name,p=n[l];if(void 0===p){p=g[k];if(void 0!==p){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,h,l));continue}p=new aj($f.create(e,l,b&&b._propertyBindings[k].binding.parsedPath),m.ValueTypeName,m.getValueSize());++p.referenceCount;this._addInactiveBinding(p,h,l)}g[k]=p;a[k].resultBuffer=p.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var b=(a._localRoot||this._root).uuid,e=a._clip.uuid, -c=this._actionsByClip[e];this._bindAction(a,c&&c.knownActions[0]);this._addInactiveAction(a,e,b)}b=a._propertyBindings;e=0;for(c=b.length;e!==c;++e){var d=b[e];0===d.useCount++&&(this._lendBinding(d),d.saveOriginalState())}this._lendAction(a)}},_deactivateAction:function(a){if(this._isActiveAction(a)){for(var b=a._propertyBindings,e=0,c=b.length;e!==c;++e){var d=b[e];0===--d.useCount&&(d.restoreOriginalState(),this._takeBackBinding(d))}this._takeBackAction(a)}},_initMemoryManager:function(){this._actions= -[];this._nActiveActions=0;this._actionsByClip={};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];this._nActiveControlInterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length},get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length},get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}}, -_isActiveAction:function(a){a=a._cacheIndex;return null!==a&&athis.max.x||a.ythis.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y},getParameter:function(a,b){void 0===b&&(console.warn('THREE.Box2: .getParameter() target is now required'),b=new d);return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y?!1:!0}, -clampPoint:function(a,b){void 0===b&&(console.warn('THREE.Box2: .clampPoint() target is now required'),b=new d);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new d;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&& -a.max.equals(this.max)}});Object.assign(dj.prototype,{set:function(a,b){this.start.copy(a);this.end.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},getCenter:function(a){void 0===a&&(console.warn('THREE.Line3: .getCenter() target is now required'),a=new h);return a.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(a){void 0===a&&(console.warn('THREE.Line3: .delta() target is now required'), -a=new h);return a.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a,b){void 0===b&&(console.warn('THREE.Line3: .at() target is now required'),b=new h);return this.delta(b).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(){var a=new h,b=new h;return function(e,c){a.subVectors(e,this.start);b.subVectors(this.end,this.start);e=b.dot(b);e=b.dot(a)/e;c&& -(e=ac.clamp(e,0,1));return e}}(),closestPointToPoint:function(a,b,e){a=this.closestPointToPointParameter(a,b);void 0===e&&(console.warn('THREE.Line3: .closestPointToPoint() target is now required'),e=new h);return this.delta(e).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a);this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)}});Uh.prototype=Object.create(P.prototype);Uh.prototype.constructor=Uh; -Uh.prototype.isImmediateRenderObject=!0;Tb.prototype=Object.create(Kb.prototype);Tb.prototype.constructor=Tb;Tb.prototype.update=function(){var a=new h,b=new h,e=new k;return function(){var c=['a','b','c'];this.object.updateMatrixWorld(!0);e.getNormalMatrix(this.object.matrixWorld);var d=this.object.matrixWorld,g=this.geometry.attributes.position,h=this.object.geometry;if(h&&h.isGeometry)for(var k=h.vertices,n=h.faces,m=h=0,l=n.length;mMath.abs(b)&&(b=1E-8);this.scale.set(.5*this.size,.5*this.size,b);this.children[0].material.side=0>b?1:0;this.lookAt(this.plane.normal);P.prototype.updateMatrixWorld.call(this,a)};var pd,Ve;Kc.prototype= -Object.create(P.prototype);Kc.prototype.constructor=Kc;Kc.prototype.setDirection=function(){var a=new h,b;return function(e){.99999e.y?this.quaternion.set(1,0,0,0):(a.set(e.z,0,-e.x).normalize(),b=Math.acos(e.y),this.quaternion.setFromAxisAngle(a,b))}}();Kc.prototype.setLength=function(a,b,e){void 0===b&&(b=.2*a);void 0===e&&(e=.2*b);this.line.scale.set(1,Math.max(0,a-b),1);this.line.updateMatrix();this.cone.scale.set(e,b,e);this.cone.position.y=a;this.cone.updateMatrix()}; -Kc.prototype.setColor=function(a){this.line.material.color.copy(a);this.cone.material.color.copy(a)};Kc.prototype.copy=function(a){P.prototype.copy.call(this,a,!1);this.line.copy(a.line);this.cone.copy(a.cone);return this};Kc.prototype.clone=function(){return(new this.constructor).copy(this)};zg.prototype=Object.create(Kb.prototype);zg.prototype.constructor=zg;Ab.create=function(a,b){console.log('THREE.Curve.create() has been deprecated');a.prototype=Object.create(Ab.prototype);a.prototype.constructor= -a;a.prototype.getPoint=b;return a};Object.assign(qf.prototype,{createPointsGeometry:function(a){console.warn('THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.');a=this.getPoints(a);return this.createGeometry(a)},createSpacedPointsGeometry:function(a){console.warn('THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.');a=this.getSpacedPoints(a);return this.createGeometry(a)}, -createGeometry:function(a){console.warn('THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.');for(var b=new Q,e=0,c=a.length;e=k?p/(e+d):p/(2-e-d);switch(e){case b:h=(g-c)/p+(gMath.abs(h)?(this._x=Math.atan2(-B,e),this._z=Math.atan2(-d,a)):(this._x=Math.atan2(l,p),this._z=0)):'YXZ'===b?(this._x=Math.asin(-c(B,-1,1)),.99999>Math.abs(B)?(this._y=Math.atan2(h,e),this._z=Math.atan2(k,p)):(this._y=Math.atan2(-m,a),this._z=0)):'ZXY'===b?(this._x=Math.asin(c(l,-1,1)),.99999>Math.abs(l)?(this._y=Math.atan2(-m,e),this._z=Math.atan2(-d,p)):(this._y=0,this._z=Math.atan2(k,a))): +'ZYX'===b?(this._y=Math.asin(-c(m,-1,1)),.99999>Math.abs(m)?(this._x=Math.atan2(l,e),this._z=Math.atan2(k,a)):(this._x=0,this._z=Math.atan2(-d,p))):'YZX'===b?(this._z=Math.asin(c(k,-1,1)),.99999>Math.abs(k)?(this._x=Math.atan2(-B,p),this._y=Math.atan2(-m,a)):(this._x=0,this._y=Math.atan2(h,e))):'XZY'===b?(this._z=Math.asin(-c(d,-1,1)),.99999>Math.abs(d)?(this._x=Math.atan2(l,p),this._y=Math.atan2(h,a)):(this._x=Math.atan2(-B,e),this._y=0)):console.warn('THREE.Euler: .setFromRotationMatrix() given unsupported order: '+ +b);this._order=b;if(!1!==g)this.onChangeCallback();return this},setFromQuaternion:function(){var a=new v;return function(b,g,c){a.makeRotationFromQuaternion(b);return this.setFromRotationMatrix(a,g,c)}}(),setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(){var a=new d;return function(b){a.setFromEuler(this);return this.setFromQuaternion(a,b)}}(),equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){this._x= +a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._order;return a},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new c(this._x,this._y,this._z)},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}});Object.assign(D.prototype,{set:function(a){this.mask=1<h;h++)if(c[h]===c[(h+1)%3]){a.push(d);break}for(d=a.length-1;0<=d;d--)for(c=a[d],this.faces.splice(c,1),g=0,e=this.faceVertexUvs.length;gthis.opacity&&(c.opacity=this.opacity);!0===this.transparent&&(c.transparent=this.transparent);c.depthFunc=this.depthFunc;c.depthTest=this.depthTest;c.depthWrite=this.depthWrite;0!==this.rotation&&(c.rotation=this.rotation);!0===this.polygonOffset&&(c.polygonOffset=!0);0!==this.polygonOffsetFactor&&(c.polygonOffsetFactor=this.polygonOffsetFactor);0!==this.polygonOffsetUnits&& +(c.polygonOffsetUnits=this.polygonOffsetUnits);1!==this.linewidth&&(c.linewidth=this.linewidth);void 0!==this.dashSize&&(c.dashSize=this.dashSize);void 0!==this.gapSize&&(c.gapSize=this.gapSize);void 0!==this.scale&&(c.scale=this.scale);!0===this.dithering&&(c.dithering=!0);0a?b.copy(this.origin):b.copy(this.direction).multiplyScalar(a).add(this.origin)},distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},distanceSqToPoint:function(){var a=new c;return function(b){var g=a.subVectors(b,this.origin).dot(this.direction);if(0>g)return this.origin.distanceToSquared(b);a.copy(this.direction).multiplyScalar(g).add(this.origin);return a.distanceToSquared(b)}}(),distanceSqToSegment:function(){var a= +new c,b=new c,g=new c;return function(c,d,e,h){a.copy(c).add(d).multiplyScalar(.5);b.copy(d).sub(c).normalize();g.copy(this.origin).sub(a);var k=.5*c.distanceTo(d),p=-this.direction.dot(b),m=g.dot(this.direction),l=-g.dot(b),n=g.lengthSq(),q=Math.abs(1-p*p);if(0=-B?d<=B?(k=1/q,c*=k,d*=k,p=c*(c+p*d+2*m)+d*(p*c+d+2*l)+n):(d=k,c=Math.max(0,-(p*d+m)),p=-c*c+d*(d+2*l)+n):(d=-k,c=Math.max(0,-(p*d+m)),p=-c*c+d*(d+2*l)+n):d<=-B?(c=Math.max(0,-(-p*k+m)),d=0b)return null; +b=Math.sqrt(b-d);d=c-b;c+=b;return 0>d&&0>c?null:0>d?this.at(c,g):this.at(d,g)}}(),intersectsSphere:function(a){return this.distanceSqToPoint(a.center)<=a.radius*a.radius},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){a=this.distanceToPlane(a);return null===a?null:this.at(a,b)},intersectsPlane:function(a){var b=a.distanceToPoint(this.origin); +return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},intersectBox:function(a,b){var g=1/this.direction.x;var c=1/this.direction.y;var d=1/this.direction.z,e=this.origin;if(0<=g){var h=(a.min.x-e.x)*g;g*=a.max.x-e.x}else h=(a.max.x-e.x)*g,g*=a.min.x-e.x;if(0<=c){var k=(a.min.y-e.y)*c;c*=a.max.y-e.y}else k=(a.max.y-e.y)*c,c*=a.min.y-e.y;if(h>c||k>g)return null;if(k>h||h!==h)h=k;if(ca||k>g)return null; +if(k>h||h!==h)h=k;if(ag?null:this.at(0<=h?h:g,b)},intersectsBox:function(){var a=new c;return function(b){return null!==this.intersectBox(b,a)}}(),intersectTriangle:function(){var a=new c,b=new c,g=new c,d=new c;return function(c,e,h,k,p){b.subVectors(e,c);g.subVectors(h,c);d.crossVectors(b,g);e=this.direction.dot(d);if(0e)k=-1,e=-e;else return null;a.subVectors(this.origin,c);c=k*this.direction.dot(g.crossVectors(a,g));if(0>c)return null; +h=k*this.direction.dot(b.cross(a));if(0>h||c+h>e)return null;c=-k*a.dot(d);return 0>c?null:this.at(c/e,p)}}(),applyMatrix4:function(a){this.origin.applyMatrix4(a);this.direction.transformDirection(a);return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}});Object.assign(ua,{getNormal:function(){var a=new c;return function(b,g,d,e){void 0===e&&(console.warn('THREE.Triangle: .getNormal() target is now required'),e=new c);e.subVectors(d,g);a.subVectors(b, +g);e.cross(a);b=e.lengthSq();return 0=a.x+a.y}}(),getUV:function(){var a=new c;return function(b,g,c,d,e,h,k,p){this.getBarycoord(b,g,c,d,a);p.set(0,0);p.addScaledVector(e,a.x);p.addScaledVector(h,a.y);p.addScaledVector(k,a.z);return p}}()});Object.assign(ua.prototype,{set:function(a,b,g){this.a.copy(a);this.b.copy(b);this.c.copy(g);return this},setFromPointsAndIndices:function(a,b,g,c){this.a.copy(a[b]);this.b.copy(a[g]);this.c.copy(a[c]);return this}, +clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},getArea:function(){var a=new c,b=new c;return function(){a.subVectors(this.c,this.b);b.subVectors(this.a,this.b);return.5*a.cross(b).length()}}(),getMidpoint:function(a){void 0===a&&(console.warn('THREE.Triangle: .getMidpoint() target is now required'),a=new c);return a.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(a){return ua.getNormal(this.a, +this.b,this.c,a)},getPlane:function(a){void 0===a&&(console.warn('THREE.Triangle: .getPlane() target is now required'),a=new c);return a.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(a,b){return ua.getBarycoord(a,this.a,this.b,this.c,b)},containsPoint:function(a){return ua.containsPoint(a,this.a,this.b,this.c)},getUV:function(a,b,g,c,d){return ua.getUV(a,this.a,this.b,this.c,b,g,c,d)},intersectsBox:function(a){return a.intersectsTriangle(this)},closestPointToPoint:function(){var a= +new c,b=new c,g=new c,d=new c,e=new c,h=new c;return function(k,p){void 0===p&&(console.warn('THREE.Triangle: .closestPointToPoint() target is now required'),p=new c);var m=this.a,l=this.b,n=this.c;a.subVectors(l,m);b.subVectors(n,m);d.subVectors(k,m);var q=a.dot(d),B=b.dot(d);if(0>=q&&0>=B)return p.copy(m);e.subVectors(k,l);var r=a.dot(e),t=b.dot(e);if(0<=r&&t<=r)return p.copy(l);var u=q*t-r*B;if(0>=u&&0<=q&&0>=r)return l=q/(q-r),p.copy(m).addScaledVector(a,l);h.subVectors(k,n);k=a.dot(h);var z= +b.dot(h);if(0<=z&&k<=z)return p.copy(n);q=k*B-q*z;if(0>=q&&0<=B&&0>=z)return u=B/(B-z),p.copy(m).addScaledVector(b,u);B=r*z-k*t;if(0>=B&&0<=t-r&&0<=k-z)return g.subVectors(n,l),u=(t-r)/(t-r+(k-z)),p.copy(l).addScaledVector(g,u);n=1/(B+q+u);l=q*n;u*=n;return p.copy(m).addScaledVector(a,l).addScaledVector(b,u)}}(),equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)}});ta.prototype=Object.create(ea.prototype);ta.prototype.constructor=ta;ta.prototype.isMeshBasicMaterial= +!0;ta.prototype.copy=function(a){ea.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap; +this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;return this};S.prototype=Object.assign(Object.create(Q.prototype),{constructor:S,isMesh:!0,setDrawMode:function(a){this.drawMode=a},copy:function(a){Q.prototype.copy.call(this,a);this.drawMode=a.drawMode;void 0!==a.morphTargetInfluences&&(this.morphTargetInfluences=a.morphTargetInfluences.slice());void 0!==a.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},a.morphTargetDictionary)); +return this},updateMorphTargets:function(){var a=this.geometry;if(a.isBufferGeometry){a=a.morphAttributes;var b=Object.keys(a);if(0g.far?null:{distance:b,point:I.clone(),object:a}}function b(b,g,c,d,h,B,r,v,I,S){k.fromBufferAttribute(h,v);p.fromBufferAttribute(h,I);m.fromBufferAttribute(h,S);h=b.morphTargetInfluences;if(g.morphTargets&&B&&h){t.set(0,0,0);u.set(0,0,0);z.set(0,0,0);for(var H= +0,Pa=B.length;Hc.far||h.push({distance:u,point:b.clone(),uv:ua.getUV(b,m,l,n,q,r,t,new e),face:null,object:this})}}(),clone:function(){return(new this.constructor(this.material)).copy(this)}, +copy:function(a){Q.prototype.copy.call(this,a);void 0!==a.center&&this.center.copy(a.center);return this}});oe.prototype=Object.assign(Object.create(Q.prototype),{constructor:oe,isLOD:!0,copy:function(a){Q.prototype.copy.call(this,a,!1);a=a.levels;for(var b=0,g=a.length;b=c[d].distance)c[d-1].object.visible=!1,c[d].object.visible=!0;else break;for(;dh||(n.applyMatrix4(this.matrixWorld),u=d.ray.origin.distanceTo(n), +ud.far||e.push({distance:u,point:p.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this}))}}else for(k=0,B=t.length/3-1;kh||(n.applyMatrix4(this.matrixWorld),u=d.ray.origin.distanceTo(n),ud.far||e.push({distance:u,point:p.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this}))}else if(k.isGeometry)for(m=k.vertices,l=m.length,k=0;kh||(n.applyMatrix4(this.matrixWorld),u=d.ray.origin.distanceTo(n),ud.far||e.push({distance:u,point:p.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});Db.prototype=Object.assign(Object.create($c.prototype),{constructor:Db,isLineSegments:!0,computeLineDistances:function(){var a=new c,b=new c;return function(){var g= +this.geometry;if(g.isBufferGeometry)if(null===g.index){for(var c=g.attributes.position,d=[],e=0,h=c.count;ed.far||e.push({distance:a,distanceToRay:Math.sqrt(c),point:q.clone(),index:g,face:null,object:k}))}var k=this,p=this.geometry,m=this.matrixWorld,l=d.params.Points.threshold;null===p.boundingSphere&&p.computeBoundingSphere();g.copy(p.boundingSphere);g.applyMatrix4(m); +g.radius+=l;if(!1!==d.ray.intersectsSphere(g)){a.getInverse(m);b.copy(d.ray).applyMatrix4(a);l/=(this.scale.x+this.scale.y+this.scale.z)/3;var n=l*l;l=new c;var q=new c;if(p.isBufferGeometry){var r=p.index;p=p.attributes.position.array;if(null!==r){var t=r.array;r=0;for(var B=t.length;r=a.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}});ad.prototype=Object.create(h.prototype);ad.prototype.constructor=ad;ad.prototype.isCompressedTexture=!0;Se.prototype=Object.create(h.prototype);Se.prototype.constructor=Se;Se.prototype.isCanvasTexture=!0;Ug.prototype=Object.create(h.prototype);Ug.prototype.constructor=Ug;Ug.prototype.isDepthTexture= +!0;cg.prototype=Object.create(fa.prototype);cg.prototype.constructor=cg;dg.prototype=Object.create(M.prototype);dg.prototype.constructor=dg;ae.prototype=Object.create(fa.prototype);ae.prototype.constructor=ae;pe.prototype=Object.create(M.prototype);pe.prototype.constructor=pe;nb.prototype=Object.create(fa.prototype);nb.prototype.constructor=nb;qe.prototype=Object.create(M.prototype);qe.prototype.constructor=qe;be.prototype=Object.create(nb.prototype);be.prototype.constructor=be;ed.prototype=Object.create(M.prototype); +ed.prototype.constructor=ed;Gd.prototype=Object.create(nb.prototype);Gd.prototype.constructor=Gd;mf.prototype=Object.create(M.prototype);mf.prototype.constructor=mf;eg.prototype=Object.create(nb.prototype);eg.prototype.constructor=eg;Uf.prototype=Object.create(M.prototype);Uf.prototype.constructor=Uf;nf.prototype=Object.create(nb.prototype);nf.prototype.constructor=nf;Me.prototype=Object.create(M.prototype);Me.prototype.constructor=Me;Ee.prototype=Object.create(fa.prototype);Ee.prototype.constructor= +Ee;Ee.prototype.toJSON=function(){var a=fa.prototype.toJSON.call(this);a.path=this.parameters.path.toJSON();return a};he.prototype=Object.create(M.prototype);he.prototype.constructor=he;Vf.prototype=Object.create(fa.prototype);Vf.prototype.constructor=Vf;Ne.prototype=Object.create(M.prototype);Ne.prototype.constructor=Ne;ce.prototype=Object.create(fa.prototype);ce.prototype.constructor=ce;var Vc={triangulate:function(a,b,g){g=g||2;var c=b&&b.length,d=c?b[0]*g:a.length,e=Fg(a,0,d,g,!0),h=[];if(!e)return h; +var k;if(c){var p=g;c=[];var m;var l=0;for(m=b.length;l80*g){var r=k=a[0];var t=c=a[1];for(p=g;pk&&(k=l),b>c&&(c=b);k=Math.max(k-r,c-t);k=0!==k?1/k:0}Mf(e,h,g,r,t,k);return h}},Ed={area:function(a){for(var b=a.length,g=0,c=b-1,d=0;dEd.area(a)},triangulateShape:function(a,b){var g=[],c=[],d=[];zg(a);Og(g,a);var e=a.length;b.forEach(zg);for(a=0;aMath.abs(k-m)?[new e(a,1-g),new e(p,1-c),new e(l,1-d),new e(q,1-b)]:[new e(k,1-g),new e(m,1-c),new e(n,1-d),new e(r,1-b)]}};mg.prototype=Object.create(M.prototype);mg.prototype.constructor=mg;tg.prototype=Object.create(Zb.prototype);tg.prototype.constructor=tg;md.prototype=Object.create(M.prototype);md.prototype.constructor=md;ob.prototype=Object.create(fa.prototype);ob.prototype.constructor=ob;Kd.prototype=Object.create(M.prototype);Kd.prototype.constructor=Kd;qb.prototype= +Object.create(fa.prototype);qb.prototype.constructor=qb;Za.prototype=Object.create(M.prototype);Za.prototype.constructor=Za;ab.prototype=Object.create(fa.prototype);ab.prototype.constructor=ab;ub.prototype=Object.create(M.prototype);ub.prototype.constructor=ub;ub.prototype.toJSON=function(){var a=M.prototype.toJSON.call(this);return Kb(this.parameters.shapes,a)};Ib.prototype=Object.create(fa.prototype);Ib.prototype.constructor=Ib;Ib.prototype.toJSON=function(){var a=fa.prototype.toJSON.call(this); +return Kb(this.parameters.shapes,a)};$e.prototype=Object.create(fa.prototype);$e.prototype.constructor=$e;of.prototype=Object.create(M.prototype);of.prototype.constructor=of;ye.prototype=Object.create(fa.prototype);ye.prototype.constructor=ye;Vh.prototype=Object.create(of.prototype);Vh.prototype.constructor=Vh;kh.prototype=Object.create(ye.prototype);kh.prototype.constructor=kh;vf.prototype=Object.create(M.prototype);vf.prototype.constructor=vf;ug.prototype=Object.create(fa.prototype);ug.prototype.constructor= +ug;var ke=Object.freeze({WireframeGeometry:cg,ParametricGeometry:dg,ParametricBufferGeometry:ae,TetrahedronGeometry:qe,TetrahedronBufferGeometry:be,OctahedronGeometry:ed,OctahedronBufferGeometry:Gd,IcosahedronGeometry:mf,IcosahedronBufferGeometry:eg,DodecahedronGeometry:Uf,DodecahedronBufferGeometry:nf,PolyhedronGeometry:pe,PolyhedronBufferGeometry:nb,TubeGeometry:Me,TubeBufferGeometry:Ee,TorusKnotGeometry:he,TorusKnotBufferGeometry:Vf,TorusGeometry:Ne,TorusBufferGeometry:ce,TextGeometry:mg,TextBufferGeometry:tg, +SphereGeometry:md,SphereBufferGeometry:ob,RingGeometry:Kd,RingBufferGeometry:qb,PlaneGeometry:O,PlaneBufferGeometry:ya,LatheGeometry:Za,LatheBufferGeometry:ab,ShapeGeometry:ub,ShapeBufferGeometry:Ib,ExtrudeGeometry:sg,ExtrudeBufferGeometry:Zb,EdgesGeometry:$e,ConeGeometry:Vh,ConeBufferGeometry:kh,CylinderGeometry:of,CylinderBufferGeometry:ye,CircleGeometry:vf,CircleBufferGeometry:ug,BoxGeometry:oa,BoxBufferGeometry:ma});wf.prototype=Object.create(ea.prototype);wf.prototype.constructor=wf;wf.prototype.isShadowMaterial= +!0;wf.prototype.copy=function(a){ea.prototype.copy.call(this,a);this.color.copy(a.color);return this};vg.prototype=Object.create(qa.prototype);vg.prototype.constructor=vg;vg.prototype.isRawShaderMaterial=!0;Wf.prototype=Object.create(ea.prototype);Wf.prototype.constructor=Wf;Wf.prototype.isMeshStandardMaterial=!0;Wf.prototype.copy=function(a){ea.prototype.copy.call(this,a);this.defines={STANDARD:''};this.color.copy(a.color);this.roughness=a.roughness;this.metalness=a.metalness;this.map=a.map;this.lightMap= +a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.roughnessMap= +a.roughnessMap;this.metalnessMap=a.metalnessMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.envMapIntensity=a.envMapIntensity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};fg.prototype=Object.create(Wf.prototype);fg.prototype.constructor=fg; +fg.prototype.isMeshPhysicalMaterial=!0;fg.prototype.copy=function(a){Wf.prototype.copy.call(this,a);this.defines={PHYSICAL:''};this.reflectivity=a.reflectivity;this.clearCoat=a.clearCoat;this.clearCoatRoughness=a.clearCoatRoughness;return this};ef.prototype=Object.create(ea.prototype);ef.prototype.constructor=ef;ef.prototype.isMeshPhongMaterial=!0;ef.prototype.copy=function(a){ea.prototype.copy.call(this,a);this.color.copy(a.color);this.specular.copy(a.specular);this.shininess=a.shininess;this.map= +a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias; +this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Vg.prototype=Object.create(ef.prototype);Vg.prototype.constructor=Vg; +Vg.prototype.isMeshToonMaterial=!0;Vg.prototype.copy=function(a){ef.prototype.copy.call(this,a);this.gradientMap=a.gradientMap;return this};zc.prototype=Object.create(ea.prototype);zc.prototype.constructor=zc;zc.prototype.isMeshNormalMaterial=!0;zc.prototype.copy=function(a){ea.prototype.copy.call(this,a);this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale= +a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};lh.prototype=Object.create(ea.prototype);lh.prototype.constructor=lh;lh.prototype.isMeshLambertMaterial=!0;lh.prototype.copy=function(a){ea.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity; +this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning= +a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Wh.prototype=Object.create(ea.prototype);Wh.prototype.constructor=Wh;Wh.prototype.isMeshMatcapMaterial=!0;Wh.prototype.copy=function(a){ea.prototype.copy.call(this,a);this.defines={MATCAP:''};this.color.copy(a.color);this.matcap=a.matcap;this.map=a.map;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap= +a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.alphaMap=a.alphaMap;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Xf.prototype=Object.create(Cb.prototype);Xf.prototype.constructor=Xf;Xf.prototype.isLineDashedMaterial=!0;Xf.prototype.copy=function(a){Cb.prototype.copy.call(this,a);this.scale=a.scale;this.dashSize=a.dashSize;this.gapSize=a.gapSize;return this};var Qg=Object.freeze({ShadowMaterial:wf, +SpriteMaterial:Lf,RawShaderMaterial:vg,ShaderMaterial:qa,PointsMaterial:xe,MeshPhysicalMaterial:fg,MeshStandardMaterial:Wf,MeshPhongMaterial:ef,MeshToonMaterial:Vg,MeshNormalMaterial:zc,MeshLambertMaterial:lh,MeshDepthMaterial:vc,MeshDistanceMaterial:tb,MeshBasicMaterial:ta,MeshMatcapMaterial:Wh,LineDashedMaterial:Xf,LineBasicMaterial:Cb,Material:ea}),yc={arraySlice:function(a,b,g){return yc.isTypedArray(a)?new a.constructor(a.subarray(b,void 0!==g?g:a.length)):a.slice(b,g)},convertArray:function(a, +b,g){return!a||!g&&a.constructor===b?a:'number'===typeof b.BYTES_PER_ELEMENT?new b(a):Array.prototype.slice.call(a)},isTypedArray:function(a){return ArrayBuffer.isView(a)&&!(a instanceof DataView)},getKeyframeOrder:function(a){for(var b=a.length,g=Array(b),c=0;c!==b;++c)g[c]=c;g.sort(function(b,g){return a[b]-a[g]});return g},sortedArray:function(a,b,g){for(var c=a.length,d=new a.constructor(c),e=0,h=0;h!==c;++e)for(var k=g[e]*b,p=0;p!==b;++p)d[h++]=a[k+p];return d},flattenJSON:function(a,b,g,c){for(var d= +1,e=a[0];void 0!==e&&void 0===e[c];)e=a[d++];if(void 0!==e){var h=e[c];if(void 0!==h)if(Array.isArray(h)){do h=e[c],void 0!==h&&(b.push(e.time),g.push.apply(g,h)),e=a[d++];while(void 0!==e)}else if(void 0!==h.toArray){do h=e[c],void 0!==h&&(b.push(e.time),h.toArray(g,g.length)),e=a[d++];while(void 0!==e)}else{do h=e[c],void 0!==h&&(b.push(e.time),g.push(h)),e=a[d++];while(void 0!==e)}}}};Object.assign(Te.prototype,{evaluate:function(a){var b=this.parameterPositions,g=this._cachedIndex,c=b[g],d=b[g- +1];a:{b:{c:{d:if(!(a=d)break a;else{e=b[1];a=d)break b}c=g;g=0}}for(;g>>1,ab;)--e;++e;if(0!==d||e!==c)d>=e&&(e=Math.max(e,1),d=e-1),a=this.getValueSize(),this.times=yc.arraySlice(g,d,e),this.values=yc.arraySlice(this.values,d*a,e*a);return this},validate:function(){var a=!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error('THREE.KeyframeTrack: Invalid value size in track.',this),a=!1);var g=this.times; +b=this.values;var c=g.length;0===c&&(console.error('THREE.KeyframeTrack: Track is empty.',this),a=!1);for(var d=null,e=0;e!==c;e++){var h=g[e];if('number'===typeof h&&isNaN(h)){console.error('THREE.KeyframeTrack: Time is not a valid number.',this,e,h);a=!1;break}if(null!==d&&d>h){console.error('THREE.KeyframeTrack: Out of order keys.',this,e,h,d);a=!1;break}d=h}if(void 0!==b&&yc.isTypedArray(b))for(e=0,g=b.length;e!==g;++e)if(c=b[e],isNaN(c)){console.error('THREE.KeyframeTrack: Value is not a valid number.', +this,e,c);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values,g=this.getValueSize(),c=2302===this.getInterpolation(),d=1,e=a.length-1,h=1;hh)d=a+1;else if(0b&&(b=0);1Number.EPSILON&&(k.normalize(),g=Math.acos(cb.clamp(d[m-1].dot(d[m]),-1,1)),e[m].applyMatrix4(p.makeRotationAxis(k,g))),h[m].crossVectors(d[m],e[m]);if(!0===b)for(g=Math.acos(cb.clamp(e[0].dot(e[a]),-1,1)),g/=a,0c;)c+=g;for(;c>g;)c-=g;ce&&(e=1);1E-4>d&&(d=e);1E-4>m&&(m=e);Ah.initNonuniformCatmullRom(h.x,k.x,p.x,g.x,d,e,m);Bi.initNonuniformCatmullRom(h.y,k.y,p.y,g.y,d,e,m);Ld.initNonuniformCatmullRom(h.z,k.z,p.z,g.z,d,e,m)}else'catmullrom'===this.curveType&&(Ah.initCatmullRom(h.x,k.x,p.x,g.x,this.tension),Bi.initCatmullRom(h.y,k.y,p.y,g.y,this.tension),Ld.initCatmullRom(h.z,k.z,p.z, +g.z,this.tension));b.set(Ah.calc(a),Bi.calc(a),Ld.calc(a));return b};se.prototype.copy=function(a){Mb.prototype.copy.call(this,a);this.points=[];for(var b=0,g=a.points.length;bg.length-2?g.length-1:a+1];g=g[a>g.length-3?g.length-1:a+2];b.set(bi(c,d.x,h.x,k.x,g.x),bi(c,d.y,h.y,k.y,g.y));return b};te.prototype.copy=function(a){Mb.prototype.copy.call(this,a);this.points=[];for(var b=0,g=a.points.length;b< +g;b++)this.points.push(a.points[b].clone());return this};te.prototype.toJSON=function(){var a=Mb.prototype.toJSON.call(this);a.points=[];for(var b=0,g=this.points.length;b=b)return b=g[a]-b,a=this.curves[a],g= +a.getLength(),a.getPointAt(0===g?0:1-b/g);a++}return null},getLength:function(){var a=this.getCurveLengths();return a[a.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 a=[],b=0,g=0,c=this.curves.length;gNumber.EPSILON){if(0>m&&(h=b[e],p=-p,k=b[d],m=-m),!(a.yk.y))if(a.y===h.y){if(a.x===h.x)return!0}else{d=m*(a.x-h.x)-p*(a.y-h.y);if(0===d)return!0;0>d||(c=!c)}}else if(a.y===h.y&&(k.x<= +a.x&&a.x<=h.x||h.x<=a.x&&a.x<=k.x))return!0}return c}var d=Ed.isClockWise,e=this.subPaths;if(0===e.length)return[];if(!0===b)return g(e);b=[];if(1===e.length){var h=e[0];var k=new ch;k.curves=h.curves;b.push(k);return b}var p=!d(e[0].getPoints());p=a?!p:p;k=[];var m=[],l=[],n=0;m[n]=void 0;l[n]=[];for(var q=0,r=e.length;qm.opacity&&(m.transparent=!0);c.setTextures(p);return c.parse(m)}}()});var Nj,aj={getContext:function(){void 0===Nj&&(Nj=new (window.AudioContext||window.webkitAudioContext));return Nj},setContext:function(a){Nj=a}};Object.assign(Ki.prototype,{load:function(a,b,g,c){var d=new ff(this.manager);d.setResponseType('arraybuffer');d.setPath(this.path);d.load(a,function(a){a=a.slice(0);aj.getContext().decodeAudioData(a,function(a){b(a)})}, +g,c)},setPath:function(a){this.path=a;return this}});Object.assign(ti.prototype,{isSphericalHarmonics3:!0,set:function(a){for(var b=0;9>b;b++)this.coefficients[b].copy(a[b]);return this},zero:function(){for(var a=0;9>a;a++)this.coefficients[a].set(0,0,0);return this},getAt:function(a,b){var g=a.x,c=a.y;a=a.z;var d=this.coefficients;b=.282095*d[0];b+=.488603*d[1]*c;b+=.488603*d[2]*a;b+=.488603*d[3]*g;b+=1.092548*d[4]*g*c;b+=1.092548*d[5]*c*a;b+=.315392*d[6]*(3*a*a-1);b+=1.092548*d[7]*g*a;return b+= +.546274*d[8]*(g*g-c*c)},getIrradianceAt:function(a,b){var g=a.x,c=a.y;a=a.z;var d=this.coefficients;b=.886227*d[0];b+=1.023328*d[1]*c;b+=1.023328*d[2]*a;b+=1.023328*d[3]*g;b+=.858086*d[4]*g*c;b+=.858086*d[5]*c*a;b+=d[6]*(.743125*a*a-.247708);b+=.858086*d[7]*g*a;return b+=.429043*d[8]*(g*g-c*c)},add:function(a){for(var b=0;9>b;b++)this.coefficients[b].add(a.coefficients[b]);return this},scale:function(a){for(var b=0;9>b;b++)this.coefficients[b].multiplyScalar(a);return this},lerp:function(a,b){for(var g= +0;9>g;g++)this.coefficients[g].lerp(a.coefficients[g],b);return this},equals:function(a){for(var b=0;9>b;b++)if(!this.coefficients[b].equals(a.coefficients[b]))return!1;return!0},copy:function(a){return this.set(a.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(a){for(var b=this.coefficients,g=0;9>g;g++)b[g].fromArray(a,3*g);return this},toArray:function(){for(var a=[],b=this.coefficients,g=0;9>g;g++)b[g].toArray(a,3*g);return a}});Object.assign(ti,{getBasisAt:function(a, +b){var g=a.x,c=a.y;a=a.z;b[0]=.282095;b[1]=.488603*c;b[2]=.488603*a;b[3]=.488603*g;b[4]=1.092548*g*c;b[5]=1.092548*c*a;b[6]=.315392*(3*a*a-1);b[7]=1.092548*g*a;b[8]=.546274*(g*g-c*c)}});Sf.prototype=Object.assign(Object.create(sd.prototype),{constructor:Sf,isLightProbe:!0,copy:function(a){sd.prototype.copy.call(this,a);this.sh.copy(a.sh);this.intensity=a.intensity;return this},toJSON:function(a){return sd.prototype.toJSON.call(this,a)}});Be.prototype=Object.assign(Object.create(Sf.prototype),{constructor:Be, +isHemisphereLightProbe:!0,copy:function(a){Sf.prototype.copy.call(this,a);return this},toJSON:function(a){return Sf.prototype.toJSON.call(this,a)}});ui.prototype=Object.assign(Object.create(Sf.prototype),{constructor:ui,isAmbientLightProbe:!0,copy:function(a){Sf.prototype.copy.call(this,a);return this},toJSON:function(a){return Sf.prototype.toJSON.call(this,a)}});Object.assign(qj.prototype,{update:function(){var a,b,g,c,d,e,h,k,p=new v,m=new v;return function(l){if(a!==this||b!==l.focus||g!==l.fov|| +c!==l.aspect*this.aspect||d!==l.near||e!==l.far||h!==l.zoom||k!==this.eyeSep){a=this;b=l.focus;g=l.fov;c=l.aspect*this.aspect;d=l.near;e=l.far;h=l.zoom;var n=l.projectionMatrix.clone();k=this.eyeSep/2;var q=k*d/b,r=d*Math.tan(cb.DEG2RAD*g*.5)/h;m.elements[12]=-k;p.elements[12]=k;var t=-r*c+q;var u=r*c+q;n.elements[0]=2*d/(u-t);n.elements[8]=(u+t)/(u-t);this.cameraL.projectionMatrix.copy(n);t=-r*c-q;u=r*c-q;n.elements[0]=2*d/(u-t);n.elements[8]=(u+t)/(u-t);this.cameraR.projectionMatrix.copy(n)}this.cameraL.matrixWorld.copy(l.matrixWorld).multiply(m); +this.cameraR.matrixWorld.copy(l.matrixWorld).multiply(p)}}()});Li.prototype=Object.create(Q.prototype);Li.prototype.constructor=Li;Object.assign(rj.prototype,{start:function(){this.oldTime=this.startTime=('undefined'===typeof performance?Date:performance).now();this.elapsedTime=0;this.running=!0},stop:function(){this.getElapsedTime();this.autoStart=this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var a=0;if(this.autoStart&&!this.running)return this.start(), +0;if(this.running){var b=('undefined'===typeof performance?Date:performance).now();a=(b-this.oldTime)/1E3;this.oldTime=b;this.elapsedTime+=a}return a}});$i.prototype=Object.assign(Object.create(Q.prototype),{constructor:$i,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null);return this},getFilter:function(){return this.filter}, +setFilter:function(a){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination);this.filter=a;this.gain.connect(this.filter);this.filter.connect(this.context.destination);return this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(a){this.gain.gain.setTargetAtTime(a,this.context.currentTime,.01);return this},updateMatrixWorld:function(){var a=new c,b=new d,g=new c,e=new c, +h=new rj;return function(c){Q.prototype.updateMatrixWorld.call(this,c);c=this.context.listener;var d=this.up;this.timeDelta=h.getDelta();this.matrixWorld.decompose(a,b,g);e.set(0,0,-1).applyQuaternion(b);if(c.positionX){var k=this.context.currentTime+this.timeDelta;c.positionX.linearRampToValueAtTime(a.x,k);c.positionY.linearRampToValueAtTime(a.y,k);c.positionZ.linearRampToValueAtTime(a.z,k);c.forwardX.linearRampToValueAtTime(e.x,k);c.forwardY.linearRampToValueAtTime(e.y,k);c.forwardZ.linearRampToValueAtTime(e.z, +k);c.upX.linearRampToValueAtTime(d.x,k);c.upY.linearRampToValueAtTime(d.y,k);c.upZ.linearRampToValueAtTime(d.z,k)}else c.setPosition(a.x,a.y,a.z),c.setOrientation(e.x,e.y,e.z,d.x,d.y,d.z)}}()});vi.prototype=Object.assign(Object.create(Q.prototype),{constructor:vi,getOutput:function(){return this.gain},setNodeSource:function(a){this.hasPlaybackControl=!1;this.sourceType='audioNode';this.source=a;this.connect();return this},setMediaElementSource:function(a){this.hasPlaybackControl=!1;this.sourceType= +'mediaNode';this.source=this.context.createMediaElementSource(a);this.connect();return this},setBuffer:function(a){this.buffer=a;this.sourceType='buffer';this.autoplay&&this.play();return this},play:function(){if(!0===this.isPlaying)console.warn('THREE.Audio: Audio is already playing.');else if(!1===this.hasPlaybackControl)console.warn('THREE.Audio: this Audio has no playback control.');else{var a=this.context.createBufferSource();a.buffer=this.buffer;a.loop=this.loop;a.onended=this.onEnded.bind(this); +this.startTime=this.context.currentTime;a.start(this.startTime,this.offset);this.isPlaying=!0;this.source=a;this.setDetune(this.detune);this.setPlaybackRate(this.playbackRate);return this.connect()}},pause:function(){if(!1===this.hasPlaybackControl)console.warn('THREE.Audio: this Audio has no playback control.');else return!0===this.isPlaying&&(this.source.stop(),this.source.onended=null,this.offset+=(this.context.currentTime-this.startTime)*this.playbackRate,this.isPlaying=!1),this},stop:function(){if(!1=== +this.hasPlaybackControl)console.warn('THREE.Audio: this Audio has no playback control.');else return this.source.stop(),this.source.onended=null,this.offset=0,this.isPlaying=!1,this},connect:function(){if(0c&&this._mixBufferRegion(g,a,3*b,1-c,b);c=b;for(var e=b+b;c!==e;++c)if(g[c]!==g[c+b]){d.setValue(g,a);break}},saveOriginalState:function(){var a=this.buffer,b=this.valueSize,g=3*b;this.binding.getValue(a,g);for(var c=b;c!==g;++c)a[c]=a[g+c%b];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a,b,g,c,d){if(.5<=c)for(c=0;c!==d;++c)a[b+c]=a[g+c]},_slerp:function(a,b,g,c){d.slerpFlat(a,b,a,b,a,g,c)},_lerp:function(a,b,g,c, +d){for(var e=1-c,h=0;h!==d;++h){var k=b+h;a[k]=a[k]*e+a[g+h]*c}}});Object.assign(tj.prototype,{getValue:function(a,b){this.bind();var g=this._bindings[this._targetGroup.nCachedObjects_];void 0!==g&&g.getValue(a,b)},setValue:function(a,b){for(var g=this._bindings,c=this._targetGroup.nCachedObjects_,d=g.length;c!==d;++c)g[c].setValue(a,b)},bind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,g=a.length;b!==g;++b)a[b].bind()},unbind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_, +g=a.length;b!==g;++b)a[b].unbind()}});Object.assign(Qd,{Composite:tj,create:function(a,b,g){return a&&a.isAnimationObjectGroup?new Qd.Composite(a,b,g):new Qd(a,b,g)},sanitizeNodeName:function(){var a=/[\[\]\.:\/]/g;return function(b){return b.replace(/\s/g,'_').replace(a,'')}}(),parseTrackName:function(){var a='[^'+'\\[\\]\\.:\\/'.replace('\\.','')+']',b=/((?:WC+[\/:])*)/.source.replace('WC','[^\\[\\]\\.:\\/]');a=/(WCOD+)?/.source.replace('WCOD',a);var g=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace('WC', +'[^\\[\\]\\.:\\/]'),c=/\.(WC+)(?:\[(.+)\])?/.source.replace('WC','[^\\[\\]\\.:\\/]'),d=new RegExp('^'+b+a+g+c+'$'),e=['material','materials','bones'];return function(a){var b=d.exec(a);if(!b)throw Error('PropertyBinding: Cannot parse trackName: '+a);b={nodeName:b[2],objectName:b[3],objectIndex:b[4],propertyName:b[5],propertyIndex:b[6]};var g=b.nodeName&&b.nodeName.lastIndexOf('.');if(void 0!==g&&-1!==g){var c=b.nodeName.substring(g+1);-1!==e.indexOf(c)&&(b.nodeName=b.nodeName.substring(0,g),b.objectName= +c)}if(null===b.propertyName||0===b.propertyName.length)throw Error('PropertyBinding: can not parse propertyName from trackName: '+a);return b}}(),findNode:function(a,b){if(!b||''===b||'root'===b||'.'===b||-1===b||b===a.name||b===a.uuid)return a;if(a.skeleton){var g=a.skeleton.getBoneByName(b);if(void 0!==g)return g}if(a.children){var c=function(a){for(var g=0;g=b){var l=b++,n=a[l];g[n.uuid]=m;a[m]=n;g[p]=l;a[l]=k;k=0;for(p=d;k!==p;++k){n= +c[k];var q=n[m];n[m]=n[l];n[l]=q}}}this.nCachedObjects_=b},uncache:function(){for(var a=this._objects,b=a.length,g=this.nCachedObjects_,c=this._indicesByUUID,d=this._bindings,e=d.length,h=0,k=arguments.length;h!==k;++h){var p=arguments[h].uuid,m=c[p];if(void 0!==m)if(delete c[p],mb||0===g)return;this._startTime=null;b*=g}b*=this._updateTimeScale(a);g=this._updateTime(b);a=this._updateWeight(a);if(0g.parameterPositions[1]&&(this.stopFading(),0===c&&(this.enabled=!1))}}return this._effectiveWeight=b},_updateTimeScale:function(a){var b=0;if(!this.paused){b=this.timeScale;var g=this._timeScaleInterpolant;if(null!==g){var c=g.evaluate(a)[0]; +b*=c;a>g.parameterPositions[1]&&(this.stopWarping(),0===b?this.paused=!0:this.timeScale=b)}}return this._effectiveTimeScale=b},_updateTime:function(a){var b=this.time+a,g=this._clip.duration,c=this.loop,d=this._loopCount,e=2202===c;if(0===a)return-1===d?b:e&&1===(d&1)?g-b:b;if(2200===c)a:{if(-1===d&&(this._loopCount=0,this._setEndings(!0,!0,!1)),b>=g)b=g;else if(0>b)b=0;else break a;this.clampWhenFinished?this.paused=!0:this.enabled=!1;this._mixer.dispatchEvent({type:'finished',action:this,direction:0> +a?-1:1})}else{-1===d&&(0<=a?(d=0,this._setEndings(!0,0===this.repetitions,e)):this._setEndings(0===this.repetitions,!0,e));if(b>=g||0>b){c=Math.floor(b/g);b-=g*c;d+=Math.abs(c);var h=this.repetitions-d;0>=h?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,b=0a,this._setEndings(a,!a,e)):this._setEndings(!1,!1,e),this._loopCount=d,this._mixer.dispatchEvent({type:'loop',action:this,loopDelta:c}))}if(e&& +1===(d&1))return this.time=b,g-b}return this.time=b},_setEndings:function(a,b,g){var c=this._interpolantSettings;g?(c.endingStart=2401,c.endingEnd=2401):(c.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,c.endingEnd=b?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(a,b,g){var c=this._mixer,d=c.time,e=this._weightInterpolant;null===e&&(this._weightInterpolant=e=c._lendControlInterpolant());c=e.parameterPositions;e=e.sampleValues;c[0]=d;e[0]=b;c[1]=d+a;e[1]=g;return this}});Bd.prototype= +Object.assign(Object.create(b.prototype),{constructor:Bd,_bindAction:function(a,b){var g=a._localRoot||this._root,c=a._clip.tracks,d=c.length,e=a._propertyBindings;a=a._interpolants;var h=g.uuid,k=this._bindingsByRootAndName,p=k[h];void 0===p&&(p={},k[h]=p);for(k=0;k!==d;++k){var m=c[k],l=m.name,n=p[l];if(void 0===n){n=e[k];if(void 0!==n){null===n._cacheIndex&&(++n.referenceCount,this._addInactiveBinding(n,h,l));continue}n=new bj(Qd.create(g,l,b&&b._propertyBindings[k].binding.parsedPath),m.ValueTypeName, +m.getValueSize());++n.referenceCount;this._addInactiveBinding(n,h,l)}e[k]=n;a[k].resultBuffer=n.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var b=(a._localRoot||this._root).uuid,g=a._clip.uuid,c=this._actionsByClip[g];this._bindAction(a,c&&c.knownActions[0]);this._addInactiveAction(a,g,b)}b=a._propertyBindings;g=0;for(c=b.length;g!==c;++g){var d=b[g];0===d.useCount++&&(this._lendBinding(d),d.saveOriginalState())}this._lendAction(a)}},_deactivateAction:function(a){if(this._isActiveAction(a)){for(var b= +a._propertyBindings,g=0,c=b.length;g!==c;++g){var d=b[g];0===--d.useCount&&(d.restoreOriginalState(),this._takeBackBinding(d))}this._takeBackAction(a)}},_initMemoryManager:function(){this._actions=[];this._nActiveActions=0;this._actionsByClip={};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];this._nActiveControlInterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length},get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length}, +get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}},_isActiveAction:function(a){a=a._cacheIndex;return null!==a&&athis.max.x||a.ythis.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y},getParameter:function(a,b){void 0===b&&(console.warn('THREE.Box2: .getParameter() target is now required'),b=new e); +return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y?!1:!0},clampPoint:function(a,b){void 0===b&&(console.warn('THREE.Box2: .clampPoint() target is now required'),b=new e);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new e;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){this.min.max(a.min); +this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}});Object.assign(Ig.prototype,{set:function(a,b){this.start.copy(a);this.end.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},getCenter:function(a){void 0=== +a&&(console.warn('THREE.Line3: .getCenter() target is now required'),a=new c);return a.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(a){void 0===a&&(console.warn('THREE.Line3: .delta() target is now required'),a=new c);return a.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a,b){void 0===b&&(console.warn('THREE.Line3: .at() target is now required'),b= +new c);return this.delta(b).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(){var a=new c,b=new c;return function(g,c){a.subVectors(g,this.start);b.subVectors(this.end,this.start);g=b.dot(b);g=b.dot(a)/g;c&&(g=cb.clamp(g,0,1));return g}}(),closestPointToPoint:function(a,b,g){a=this.closestPointToPointParameter(a,b);void 0===g&&(console.warn('THREE.Line3: .closestPointToPoint() target is now required'),g=new c);return this.delta(g).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a); +this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)}});yi.prototype=Object.create(Q.prototype);yi.prototype.constructor=yi;yi.prototype.isImmediateRenderObject=!0;jh.prototype=Object.create(Db.prototype);jh.prototype.constructor=jh;jh.prototype.update=function(){var a=new c,b=new c,g=new k;return function(){var c=['a','b','c'];this.object.updateMatrixWorld(!0);g.getNormalMatrix(this.object.matrixWorld);var d=this.object.matrixWorld,e= +this.geometry.attributes.position,h=this.object.geometry;if(h&&h.isGeometry)for(var k=h.vertices,p=h.faces,m=h=0,l=p.length;mMath.abs(b)&&(b=1E-8);this.scale.set(.5*this.size,.5*this.size,b);this.children[0].material.side=0>b?1:0;this.lookAt(this.plane.normal);Q.prototype.updateMatrixWorld.call(this,a)};var Pi,Ue;Zf.prototype=Object.create(Q.prototype);Zf.prototype.constructor=Zf;Zf.prototype.setDirection=function(){var a=new c,b;return function(g){.99999g.y?this.quaternion.set(1, +0,0,0):(a.set(g.z,0,-g.x).normalize(),b=Math.acos(g.y),this.quaternion.setFromAxisAngle(a,b))}}();Zf.prototype.setLength=function(a,b,g){void 0===b&&(b=.2*a);void 0===g&&(g=.2*b);this.line.scale.set(1,Math.max(0,a-b),1);this.line.updateMatrix();this.cone.scale.set(g,b,g);this.cone.position.y=a;this.cone.updateMatrix()};Zf.prototype.setColor=function(a){this.line.material.color.copy(a);this.cone.material.color.copy(a)};Zf.prototype.copy=function(a){Q.prototype.copy.call(this,a,!1);this.line.copy(a.line); +this.cone.copy(a.cone);return this};Zf.prototype.clone=function(){return(new this.constructor).copy(this)};Qi.prototype=Object.create(Db.prototype);Qi.prototype.constructor=Qi;Mb.create=function(a,b){console.log('THREE.Curve.create() has been deprecated');a.prototype=Object.create(Mb.prototype);a.prototype.constructor=a;a.prototype.getPoint=b;return a};Object.assign(Ie.prototype,{createPointsGeometry:function(a){console.warn('THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.'); +a=this.getPoints(a);return this.createGeometry(a)},createSpacedPointsGeometry:function(a){console.warn('THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.');a=this.getSpacedPoints(a);return this.createGeometry(a)},createGeometry:function(a){console.warn('THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.');for(var b=new M,g=0,d=a.length;ga.length&&console.error('THREE.QuickHull: The algorithm needs at least four points.');this.makeEmpty();for(var b=0,d=a.length;ba.length&&console.error('THREE.QuickHull: The algorithm needs at least four points.');this.makeEmpty();for(var b=0,c=a.length;bthis.tolerance?this.addVertexToFace(a,b):this.unassigned.append(a); -a=c}while(null!==a)}return this},resolveUnassignedPoints:function(a){if(!1===this.unassigned.isEmpty()){var b=this.unassigned.first();do{for(var c=b.next,d=this.tolerance,g=null,h=0;hd&&(d=n,g=e);if(d>1E3*this.tolerance)break}}null!==g&&this.addVertexToFace(b,g);b=c}while(null!==b)}return this},computeExtremes:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=[],d=[],g,p,e;for(g=0;3>g;g++)c[g]=d[g]=this.vertices[0]; -a.copy(this.vertices[0].point);b.copy(this.vertices[0].point);g=0;for(p=this.vertices.length;ge;e++)r.getComponent(e)e;e++)r.getComponent(e)>b.getComponent(e)&&(b.setComponent(e,r.getComponent(e)),d[e]=n)}this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(a.x),Math.abs(b.x))+Math.max(Math.abs(a.y),Math.abs(b.y))+Math.max(Math.abs(a.z),Math.abs(b.z)));return{min:c,max:d}},computeInitialHull:function(){var a, -c,d;return function(){void 0===a&&(a=new THREE.Line3,c=new THREE.Plane,d=new THREE.Vector3);var g=this.vertices,h=this.computeExtremes(),k=h.min,e=h.max,n,l,t=0;for(h=l=0;3>h;h++){var D=e[h].point.getComponent(h)-k[h].point.getComponent(h);D>t&&(t=D,l=h)}k=k[l];e=e[l];t=0;a.set(k.point,e.point);h=0;for(n=this.vertices.length;ht)){t=D;var u=w}}t=-1;c.setFromCoplanarPoints(k.point,e.point,u.point); -h=0;for(n=this.vertices.length;ht)){t=D;var v=w}D=[];if(0>c.distanceToPoint(v.point))for(D.push(b.create(k,e,u),b.create(v,e,k),b.create(v,u,e),b.create(v,k,u)),h=0;3>h;h++)l=(h+1)%3,D[h+1].getEdge(2).setTwin(D[0].getEdge(l)),D[h+1].getEdge(1).setTwin(D[l+1].getEdge(0));else for(D.push(b.create(k,u,e),b.create(v,k,e),b.create(v,e,u),b.create(v,u,k)),h=0;3>h;h++)l=(h+1)%3,D[h+1].getEdge(2).setTwin(D[0].getEdge((3-h)%3)), -D[h+1].getEdge(0).setTwin(D[l+1].getEdge(1));for(h=0;4>h;h++)this.faces.push(D[h]);h=0;for(n=g.length;hl;l++)D=this.faces[l].distanceToPoint(w.point),D>t&&(t=D,z=this.faces[l]);null!==z&&this.addVertexToFace(w,z)}return this}}(),reindexFaces:function(){for(var a=[],b=0;ba){a=d;var g=c}c=c.next}while(null!==c&&c.face===b);return g}},computeHorizon:function(a,b,c,d){this.deleteFaceVertices(c);c.mark=1;c=null===b?b=c.getEdge(0):b.next;do{var g=c.twin,h=g.face;0===h.mark&&(h.distanceToPoint(a)>this.tolerance?this.computeHorizon(a,g,h,d):d.push(c));c=c.next}while(c!==b);return this},addAdjoiningFace:function(a,c){a=b.create(a,c.tail(),c.head());this.faces.push(a);a.getEdge(-1).setTwin(c.twin); -return a.getEdge(0)},addNewFaces:function(a,b){this.newFaces=[];for(var c=null,d=null,g=0;ga;)b=b.prev,a++;return b},compute:function(){var a; -return function(){void 0===a&&(a=new THREE.Triangle);var b=this.edge.tail(),c=this.edge.head(),d=this.edge.next.head();a.set(b.point,c.point,d.point);a.getNormal(this.normal);a.getMidpoint(this.midpoint);this.area=a.getArea();this.constant=this.normal.dot(this.midpoint);return this}}(),distanceToPoint:function(a){return this.normal.dot(a)-this.constant}});Object.assign(d.prototype,{head:function(){return this.vertex},tail:function(){return this.prev?this.prev.vertex:null},length:function(){var a= -this.head(),b=this.tail();return null!==b?b.point.distanceTo(a.point):-1},lengthSquared:function(){var a=this.head(),b=this.tail();return null!==b?b.point.distanceToSquared(a.point):-1},setTwin:function(a){this.twin=a;a.twin=this;return this}});Object.assign(g.prototype,{first:function(){return this.head},last:function(){return this.tail},clear:function(){this.head=this.tail=null;return this},insertBefore:function(a,b){b.prev=a.prev;b.next=a;null===b.prev?this.head=b:b.prev.next=b;a.prev=b;return this}, +a=c}while(null!==a)}return this},resolveUnassignedPoints:function(a){if(!1===this.unassigned.isEmpty()){var b=this.unassigned.first();do{for(var c=b.next,d=this.tolerance,e=null,k=0;kd&&(d=p,e=g);if(d>1E3*this.tolerance)break}}null!==e&&this.addVertexToFace(b,e);b=c}while(null!==b)}return this},computeExtremes:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=[],d=[],e,m,g;for(e=0;3>e;e++)c[e]=d[e]=this.vertices[0]; +a.copy(this.vertices[0].point);b.copy(this.vertices[0].point);e=0;for(m=this.vertices.length;eg;g++)r.getComponent(g)g;g++)r.getComponent(g)>b.getComponent(g)&&(b.setComponent(g,r.getComponent(g)),d[g]=p)}this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(a.x),Math.abs(b.x))+Math.max(Math.abs(a.y),Math.abs(b.y))+Math.max(Math.abs(a.z),Math.abs(b.z)));return{min:c,max:d}},computeInitialHull:function(){var a, +c,d;return function(){void 0===a&&(a=new THREE.Line3,c=new THREE.Plane,d=new THREE.Vector3);var e=this.vertices,h=this.computeExtremes(),k=h.min,g=h.max,p,l,u=0;for(h=l=0;3>h;h++){var E=g[h].point.getComponent(h)-k[h].point.getComponent(h);E>u&&(u=E,l=h)}k=k[l];g=g[l];u=0;a.set(k.point,g.point);h=0;for(p=this.vertices.length;hu)){u=E;var t=v}}u=-1;c.setFromCoplanarPoints(k.point,g.point,t.point); +h=0;for(p=this.vertices.length;hu)){u=E;var z=v}E=[];if(0>c.distanceToPoint(z.point))for(E.push(b.create(k,g,t),b.create(z,g,k),b.create(z,t,g),b.create(z,k,t)),h=0;3>h;h++)l=(h+1)%3,E[h+1].getEdge(2).setTwin(E[0].getEdge(l)),E[h+1].getEdge(1).setTwin(E[l+1].getEdge(0));else for(E.push(b.create(k,t,g),b.create(z,k,g),b.create(z,g,t),b.create(z,t,k)),h=0;3>h;h++)l=(h+1)%3,E[h+1].getEdge(2).setTwin(E[0].getEdge((3-h)%3)), +E[h+1].getEdge(0).setTwin(E[l+1].getEdge(1));for(h=0;4>h;h++)this.faces.push(E[h]);h=0;for(p=e.length;hl;l++)E=this.faces[l].distanceToPoint(v.point),E>u&&(u=E,w=this.faces[l]);null!==w&&this.addVertexToFace(v,w)}return this}}(),reindexFaces:function(){for(var a=[],b=0;ba){a=d;var e=c}c=c.next}while(null!==c&&c.face===b);return e}},computeHorizon:function(a,b,c,d){this.deleteFaceVertices(c);c.mark=1;c=null===b?b=c.getEdge(0):b.next;do{var e=c.twin,h=e.face;0===h.mark&&(h.distanceToPoint(a)>this.tolerance?this.computeHorizon(a,e,h,d):d.push(c));c=c.next}while(c!==b);return this},addAdjoiningFace:function(a,c){a=b.create(a,c.tail(),c.head());this.faces.push(a);a.getEdge(-1).setTwin(c.twin); +return a.getEdge(0)},addNewFaces:function(a,b){this.newFaces=[];for(var c=null,d=null,e=0;ea;)b=b.prev,a++;return b},compute:function(){var a; +return function(){void 0===a&&(a=new THREE.Triangle);var b=this.edge.tail(),c=this.edge.head(),d=this.edge.next.head();a.set(b.point,c.point,d.point);a.getNormal(this.normal);a.getMidpoint(this.midpoint);this.area=a.getArea();this.constant=this.normal.dot(this.midpoint);return this}}(),distanceToPoint:function(a){return this.normal.dot(a)-this.constant}});Object.assign(e.prototype,{head:function(){return this.vertex},tail:function(){return this.prev?this.prev.vertex:null},length:function(){var a= +this.head(),b=this.tail();return null!==b?b.point.distanceTo(a.point):-1},lengthSquared:function(){var a=this.head(),b=this.tail();return null!==b?b.point.distanceToSquared(a.point):-1},setTwin:function(a){this.twin=a;a.twin=this;return this}});Object.assign(c.prototype,{first:function(){return this.head},last:function(){return this.tail},clear:function(){this.head=this.tail=null;return this},insertBefore:function(a,b){b.prev=a.prev;b.next=a;null===b.prev?this.head=b:b.prev.next=b;a.prev=b;return this}, insertAfter:function(a,b){b.prev=a;b.next=a.next;null===b.next?this.tail=b:b.next.prev=b;a.next=b;return this},append:function(a){null===this.head?this.head=a:this.tail.next=a;a.prev=this.tail;a.next=null;this.tail=a;return this},appendChain:function(a){null===this.head?this.head=a:this.tail.next=a;for(a.prev=this.tail;null!==a.next;)a=a.next;this.tail=a;return this},remove:function(a){null===a.prev?this.head=a.next:a.prev.next=a.next;null===a.next?this.tail=a.prev:a.next.prev=a.prev;return this}, removeSubList:function(a,b){null===a.prev?this.head=b.next:a.prev.next=b.next;null===b.next?this.tail=a.prev:b.next.prev=a.prev;return this},isEmpty:function(){return null===this.head}});THREE.QuickHull=a})(); var SimplexNoise=function(a){void 0==a&&(a=Math);this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]];this.grad4=[[0,1,1,1],[0,1,1,-1],[0,1,-1,1],[0,1,-1,-1],[0,-1,1,1],[0,-1,1,-1],[0,-1,-1,1],[0,-1,-1,-1],[1,0,1,1],[1,0,1,-1],[1,0,-1,1],[1,0,-1,-1],[-1,0,1,1],[-1,0,1,-1],[-1,0,-1,1],[-1,0,-1,-1],[1,1,0,1],[1,1,0,-1],[1,-1,0,1],[1,-1,0,-1],[-1,1,0,1],[-1,1,0,-1],[-1,-1,0,1],[-1,-1,0,-1],[1,1,1,0],[1,1,-1,0],[1,-1,1,0],[1,-1,-1,0], [-1,1,1,0],[-1,1,-1,0],[-1,-1,1,0],[-1,-1,-1,0]];this.p=[];for(var b=0;256>b;b++)this.p[b]=Math.floor(256*a.random());this.perm=[];for(b=0;512>b;b++)this.perm[b]=this.p[b&255];this.simplex=[[0,1,2,3],[0,1,3,2],[0,0,0,0],[0,2,3,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,3,0],[0,2,1,3],[0,0,0,0],[0,3,1,2],[0,3,2,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,3,2,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,0,3],[0,0,0,0],[1,3,0,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,3,0,1],[2, -3,1,0],[1,0,2,3],[1,0,3,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,3,1],[0,0,0,0],[2,1,3,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,1,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,0,1,2],[3,0,2,1],[0,0,0,0],[3,1,2,0],[2,1,0,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,1,0,2],[0,0,0,0],[3,2,0,1],[3,2,1,0]]};SimplexNoise.prototype.dot=function(a,b,d){return a[0]*b+a[1]*d};SimplexNoise.prototype.dot3=function(a,b,d,c){return a[0]*b+a[1]*d+a[2]*c}; -SimplexNoise.prototype.dot4=function(a,b,d,c,g){return a[0]*b+a[1]*d+a[2]*c+a[3]*g}; -SimplexNoise.prototype.noise=function(a,b){var d=.5*(a+b)*(Math.sqrt(3)-1),c=Math.floor(a+d),g=Math.floor(b+d);d=(3-Math.sqrt(3))/6;var h=(c+g)*d;a-=c-h;var k=b-(g-h);if(a>k){var l=1;var m=0}else l=0,m=1;h=a-l+d;var q=k-m+d;b=a-1+2*d;d=k-1+2*d;var p=c&255,e=g&255;c=this.perm[p+this.perm[e]]%12;g=this.perm[p+l+this.perm[e+m]]%12;l=this.perm[p+1+this.perm[e+1]]%12;m=.5-a*a-k*k;0>m?a=0:(m*=m,a=m*m*this.dot(this.grad3[c],a,k));k=.5-h*h-q*q;0>k?h=0:(k*=k,h=k*k*this.dot(this.grad3[g],h,q));q=.5-b*b-d*d; -0>q?b=0:(q*=q,b=q*q*this.dot(this.grad3[l],b,d));return 70*(a+h+b)}; -SimplexNoise.prototype.noise3d=function(a,b,d){var c=1/3*(a+b+d),g=Math.floor(a+c),h=Math.floor(b+c),k=Math.floor(d+c);c=1/6;var l=(g+h+k)*c;var m=a-(g-l);var q=b-(h-l);var p=d-(k-l),e,n;if(m>=q)if(q>=p){var r=1;var t=e=0;var D=n=1;var w=0}else m>=p?(r=1,t=e=0):(e=r=0,t=1),n=1,D=0,w=1;else qD?m=0:(D*=D,m=D*D*this.dot3(this.grad3[h],m,q,p));q=.6-u*u-v*v-z*z;0>q?q=0:(q*=q,q=q*q*this.dot3(this.grad3[k],u,v,z));u=.6-l*l-a*a-G*G;0>u?l=0:(u*=u,l=u*u*this.dot3(this.grad3[n],l,a,G));a=.6-d*d-b*b-c*c;0>a?d=0:(a*=a,d=a*a*this.dot3(this.grad3[g],d,b,c));return 32*(m+q+l+d)}; -SimplexNoise.prototype.noise4d=function(a,b,d,c){var g=this.grad4,h=this.simplex,k=this.perm,l=(5-Math.sqrt(5))/20;var m=(Math.sqrt(5)-1)/4*(a+b+d+c);var q=Math.floor(a+m),p=Math.floor(b+m),e=Math.floor(d+m),n=Math.floor(c+m);m=(q+p+e+n)*l;a-=q-m;var r=b-(p-m);var t=d-(e-m);var D=c-(n-m);c=(a>r?32:0)+(a>t?16:0)+(r>t?8:0)+(a>D?4:0)+(r>D?2:0)+(t>D?1:0);var w=3<=h[c][0]?1:0;var u=3<=h[c][1]?1:0;var v=3<=h[c][2]?1:0;var z=3<=h[c][3]?1:0;var G=2<=h[c][0]?1:0;var I=2<=h[c][1]?1:0;var K=2<=h[c][2]?1:0;var H= -2<=h[c][3]?1:0;var C=1<=h[c][0]?1:0;var P=1<=h[c][1]?1:0;var Q=1<=h[c][2]?1:0;var T=1<=h[c][3]?1:0;var fa=a-w+l,ja=r-u+l,ia=t-v+l,N=D-z+l,ma=a-G+2*l,V=r-I+2*l,ca=t-K+2*l,ba=D-H+2*l;m=a-C+3*l;b=r-P+3*l;var L=t-Q+3*l,na=D-T+3*l;h=a-1+4*l;c=r-1+4*l;d=t-1+4*l;l=D-1+4*l;q&=255;p&=255;var sa=e&255;n&=255;e=k[q+k[p+k[sa+k[n]]]]%32;w=k[q+w+k[p+u+k[sa+v+k[n+z]]]]%32;G=k[q+G+k[p+I+k[sa+K+k[n+H]]]]%32;C=k[q+C+k[p+P+k[sa+Q+k[n+T]]]]%32;k=k[q+1+k[p+1+k[sa+1+k[n+1]]]]%32;n=.6-a*a-r*r-t*t-D*D;0>n?a=0:(n*=n,a=n* -n*this.dot4(g[e],a,r,t,D));r=.6-fa*fa-ja*ja-ia*ia-N*N;0>r?r=0:(r*=r,r=r*r*this.dot4(g[w],fa,ja,ia,N));t=.6-ma*ma-V*V-ca*ca-ba*ba;0>t?t=0:(t*=t,t=t*t*this.dot4(g[G],ma,V,ca,ba));ma=.6-m*m-b*b-L*L-na*na;0>ma?m=0:(ma*=ma,m=ma*ma*this.dot4(g[C],m,b,L,na));b=.6-h*h-c*c-d*d-l*l;0>b?g=0:(b*=b,g=b*b*this.dot4(g[k],h,c,d,l));return 27*(a+r+t+m+g)}; +3,1,0],[1,0,2,3],[1,0,3,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,3,1],[0,0,0,0],[2,1,3,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,1,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,0,1,2],[3,0,2,1],[0,0,0,0],[3,1,2,0],[2,1,0,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,1,0,2],[0,0,0,0],[3,2,0,1],[3,2,1,0]]};SimplexNoise.prototype.dot=function(a,b,e){return a[0]*b+a[1]*e};SimplexNoise.prototype.dot3=function(a,b,e,d){return a[0]*b+a[1]*e+a[2]*d}; +SimplexNoise.prototype.dot4=function(a,b,e,d,c){return a[0]*b+a[1]*e+a[2]*d+a[3]*c}; +SimplexNoise.prototype.noise=function(a,b){var e=.5*(a+b)*(Math.sqrt(3)-1),d=Math.floor(a+e),c=Math.floor(b+e);e=(3-Math.sqrt(3))/6;var k=(d+c)*e;a-=d-k;var h=b-(c-k);if(a>h){var l=1;var n=0}else l=0,n=1;k=a-l+e;var q=h-n+e;b=a-1+2*e;e=h-1+2*e;var m=d&255,g=c&255;d=this.perm[m+this.perm[g]]%12;c=this.perm[m+l+this.perm[g+n]]%12;l=this.perm[m+1+this.perm[g+1]]%12;n=.5-a*a-h*h;0>n?a=0:(n*=n,a=n*n*this.dot(this.grad3[d],a,h));h=.5-k*k-q*q;0>h?k=0:(h*=h,k=h*h*this.dot(this.grad3[c],k,q));q=.5-b*b-e*e; +0>q?b=0:(q*=q,b=q*q*this.dot(this.grad3[l],b,e));return 70*(a+k+b)}; +SimplexNoise.prototype.noise3d=function(a,b,e){var d=1/3*(a+b+e),c=Math.floor(a+d),k=Math.floor(b+d),h=Math.floor(e+d);d=1/6;var l=(c+k+h)*d;var n=a-(c-l);var q=b-(k-l);var m=e-(h-l),g,p;if(n>=q)if(q>=m){var r=1;var u=g=0;var E=p=1;var v=0}else n>=m?(r=1,u=g=0):(g=r=0,u=1),p=1,E=0,v=1;else qE?n=0:(E*=E,n=E*E*this.dot3(this.grad3[k],n,q,m));q=.6-t*t-z*z-w*w;0>q?q=0:(q*=q,q=q*q*this.dot3(this.grad3[h],t,z,w));t=.6-l*l-a*a-I*I;0>t?l=0:(t*=t,l=t*t*this.dot3(this.grad3[p],l,a,I));a=.6-e*e-b*b-d*d;0>a?e=0:(a*=a,e=a*a*this.dot3(this.grad3[c],e,b,d));return 32*(n+q+l+e)}; +SimplexNoise.prototype.noise4d=function(a,b,e,d){var c=this.grad4,k=this.simplex,h=this.perm,l=(5-Math.sqrt(5))/20;var n=(Math.sqrt(5)-1)/4*(a+b+e+d);var q=Math.floor(a+n),m=Math.floor(b+n),g=Math.floor(e+n),p=Math.floor(d+n);n=(q+m+g+p)*l;a-=q-n;var r=b-(m-n);var u=e-(g-n);var E=d-(p-n);d=(a>r?32:0)+(a>u?16:0)+(r>u?8:0)+(a>E?4:0)+(r>E?2:0)+(u>E?1:0);var v=3<=k[d][0]?1:0;var t=3<=k[d][1]?1:0;var z=3<=k[d][2]?1:0;var w=3<=k[d][3]?1:0;var I=2<=k[d][0]?1:0;var H=2<=k[d][1]?1:0;var K=2<=k[d][2]?1:0;var C= +2<=k[d][3]?1:0;var D=1<=k[d][0]?1:0;var Q=1<=k[d][1]?1:0;var M=1<=k[d][2]?1:0;var X=1<=k[d][3]?1:0;var ka=a-v+l,ja=r-t+l,ba=u-z+l,N=E-w+l,la=a-I+2*l,T=r-H+2*l,aa=u-K+2*l,da=E-C+2*l;n=a-D+3*l;b=r-Q+3*l;var R=u-M+3*l,ra=E-X+3*l;k=a-1+4*l;d=r-1+4*l;e=u-1+4*l;l=E-1+4*l;q&=255;m&=255;var pa=g&255;p&=255;g=h[q+h[m+h[pa+h[p]]]]%32;v=h[q+v+h[m+t+h[pa+z+h[p+w]]]]%32;I=h[q+I+h[m+H+h[pa+K+h[p+C]]]]%32;D=h[q+D+h[m+Q+h[pa+M+h[p+X]]]]%32;h=h[q+1+h[m+1+h[pa+1+h[p+1]]]]%32;p=.6-a*a-r*r-u*u-E*E;0>p?a=0:(p*=p,a=p* +p*this.dot4(c[g],a,r,u,E));r=.6-ka*ka-ja*ja-ba*ba-N*N;0>r?r=0:(r*=r,r=r*r*this.dot4(c[v],ka,ja,ba,N));u=.6-la*la-T*T-aa*aa-da*da;0>u?u=0:(u*=u,u=u*u*this.dot4(c[I],la,T,aa,da));la=.6-n*n-b*b-R*R-ra*ra;0>la?n=0:(la*=la,n=la*la*this.dot4(c[D],n,b,R,ra));b=.6-k*k-d*d-e*e-l*l;0>b?c=0:(b*=b,c=b*b*this.dot4(c[h],k,d,e,l));return 27*(a+r+u+n+c)}; THREE.CopyShader={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:'varying vec2 vUv;\nvoid main() {\nvUv = uv;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}',fragmentShader:'uniform float opacity;\nuniform sampler2D tDiffuse;\nvarying vec2 vUv;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}'}; THREE.BokehShader={defines:{DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tColor:{value:null},tDepth:{value:null},focus:{value:1},aspect:{value:1},aperture:{value:.025},maxblur:{value:1},nearClip:{value:1},farClip:{value:1E3}},vertexShader:'varying vec2 vUv;\nvoid main() {\nvUv = uv;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}',fragmentShader:'#include \nvarying vec2 vUv;\nuniform sampler2D tColor;\nuniform sampler2D tDepth;\nuniform float maxblur;\nuniform float aperture;\nuniform float nearClip;\nuniform float farClip;\nuniform float focus;\nuniform float aspect;\n#include \nfloat getDepth( const in vec2 screenPosition ) {\n\t#if DEPTH_PACKING == 1\n\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );\n\t#else\n\treturn texture2D( tDepth, screenPosition ).x;\n\t#endif\n}\nfloat getViewZ( const in float depth ) {\n\t#if PERSPECTIVE_CAMERA == 1\n\treturn perspectiveDepthToViewZ( depth, nearClip, farClip );\n\t#else\n\treturn orthographicDepthToViewZ( depth, nearClip, farClip );\n\t#endif\n}\nvoid main() {\nvec2 aspectcorrect = vec2( 1.0, aspect );\nfloat viewZ = getViewZ( getDepth( vUv ) );\nfloat factor = ( focus + viewZ );\nvec2 dofblur = vec2 ( clamp( factor * aperture, -maxblur, maxblur ) );\nvec2 dofblur9 = dofblur * 0.9;\nvec2 dofblur7 = dofblur * 0.7;\nvec2 dofblur4 = dofblur * 0.4;\nvec4 col = vec4( 0.0 );\ncol += texture2D( tColor, vUv.xy );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur9 );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur9 );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur9 );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur9 );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur9 );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur9 );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur9 );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur9 );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur7 );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur7 );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur7 );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur7 );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur7 );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur7 );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur7 );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur7 );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur4 );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.4, 0.0 ) * aspectcorrect ) * dofblur4 );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur4 );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur4 );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur4 );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur4 );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur4 );\ncol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur4 );\ngl_FragColor = col / 41.0;\ngl_FragColor.a = 1.0;\n}'}; -THREE.SAOShader={defines:{NUM_SAMPLES:7,NUM_RINGS:4,NORMAL_TEXTURE:0,DIFFUSE_TEXTURE:0,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{type:'t',value:null},tDiffuse:{type:'t',value:null},tNormal:{type:'t',value:null},size:{type:'v2',value:new THREE.Vector2(512,512)},cameraNear:{type:'f',value:1},cameraFar:{type:'f',value:100},cameraProjectionMatrix:{type:'m4',value:new THREE.Matrix4},cameraInverseProjectionMatrix:{type:'m4',value:new THREE.Matrix4},scale:{type:'f',value:1},intensity:{type:'f', -value:.1},bias:{type:'f',value:.5},minResolution:{type:'f',value:0},kernelRadius:{type:'f',value:100},randomSeed:{type:'f',value:0}},vertexShader:'varying vec2 vUv;\nvoid main() {\n\tvUv = uv;\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}',fragmentShader:'#include \nvarying vec2 vUv;\n#if DIFFUSE_TEXTURE == 1\nuniform sampler2D tDiffuse;\n#endif\nuniform sampler2D tDepth;\n#if NORMAL_TEXTURE == 1\nuniform sampler2D tNormal;\n#endif\nuniform float cameraNear;\nuniform float cameraFar;\nuniform mat4 cameraProjectionMatrix;\nuniform mat4 cameraInverseProjectionMatrix;\nuniform float scale;\nuniform float intensity;\nuniform float bias;\nuniform float kernelRadius;\nuniform float minResolution;\nuniform vec2 size;\nuniform float randomSeed;\n// RGBA depth\n#include \nvec4 getDefaultColor( const in vec2 screenPosition ) {\n\t#if DIFFUSE_TEXTURE == 1\n\treturn texture2D( tDiffuse, vUv );\n\t#else\n\treturn vec4( 1.0 );\n\t#endif\n}\nfloat getDepth( const in vec2 screenPosition ) {\n\t#if DEPTH_PACKING == 1\n\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );\n\t#else\n\treturn texture2D( tDepth, screenPosition ).x;\n\t#endif\n}\nfloat getViewZ( const in float depth ) {\n\t#if PERSPECTIVE_CAMERA == 1\n\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );\n\t#else\n\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );\n\t#endif\n}\nvec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {\n\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];\n\tvec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );\n\tclipPosition *= clipW; // unprojection.\n\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;\n}\nvec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPosition ) {\n\t#if NORMAL_TEXTURE == 1\n\treturn unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );\n\t#else\n\treturn normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );\n\t#endif\n}\nfloat scaleDividedByCameraFar;\nfloat minResolutionMultipliedByCameraFar;\nfloat getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {\n\tvec3 viewDelta = sampleViewPosition - centerViewPosition;\n\tfloat viewDistance = length( viewDelta );\n\tfloat scaledScreenDistance = scaleDividedByCameraFar * viewDistance;\n\treturn max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - bias) / (1.0 + pow2( scaledScreenDistance ) );\n}\n// moving costly divides into consts\nconst float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES );\nconst float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );\nfloat getAmbientOcclusion( const in vec3 centerViewPosition ) {\n\t// precompute some variables require in getOcclusion.\n\tscaleDividedByCameraFar = scale / cameraFar;\n\tminResolutionMultipliedByCameraFar = minResolution * cameraFar;\n\tvec3 centerViewNormal = getViewNormal( centerViewPosition, vUv );\n\t// jsfiddle that shows sample pattern: https://jsfiddle.net/a16ff1p7/\n\tfloat angle = rand( vUv + randomSeed ) * PI2;\n\tvec2 radius = vec2( kernelRadius * INV_NUM_SAMPLES ) / size;\n\tvec2 radiusStep = radius;\n\tfloat occlusionSum = 0.0;\n\tfloat weightSum = 0.0;\n\tfor( int i = 0; i < NUM_SAMPLES; i ++ ) {\n\t\tvec2 sampleUv = vUv + vec2( cos( angle ), sin( angle ) ) * radius;\n\t\tradius += radiusStep;\n\t\tangle += ANGLE_STEP;\n\t\tfloat sampleDepth = getDepth( sampleUv );\n\t\tif( sampleDepth >= ( 1.0 - EPSILON ) ) {\n\t\t\tcontinue;\n\t\t}\n\t\tfloat sampleViewZ = getViewZ( sampleDepth );\n\t\tvec3 sampleViewPosition = getViewPosition( sampleUv, sampleDepth, sampleViewZ );\n\t\tocclusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );\n\t\tweightSum += 1.0;\n\t}\n\tif( weightSum == 0.0 ) discard;\n\treturn occlusionSum * ( intensity / weightSum );\n}\nvoid main() {\n\tfloat centerDepth = getDepth( vUv );\n\tif( centerDepth >= ( 1.0 - EPSILON ) ) {\n\t\tdiscard;\n\t}\n\tfloat centerViewZ = getViewZ( centerDepth );\n\tvec3 viewPosition = getViewPosition( vUv, centerDepth, centerViewZ );\n\tfloat ambientOcclusion = getAmbientOcclusion( viewPosition );\n\tgl_FragColor = getDefaultColor( vUv );\n\tgl_FragColor.xyz *= 1.0 - ambientOcclusion;\n}'}; -THREE.DepthLimitedBlurShader={defines:{KERNEL_RADIUS:4,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDiffuse:{type:'t',value:null},size:{type:'v2',value:new THREE.Vector2(512,512)},sampleUvOffsets:{type:'v2v',value:[new THREE.Vector2(0,0)]},sampleWeights:{type:'1fv',value:[1]},tDepth:{type:'t',value:null},cameraNear:{type:'f',value:10},cameraFar:{type:'f',value:1E3},depthCutoff:{type:'f',value:10}},vertexShader:'#include \nuniform vec2 size;\nvarying vec2 vUv;\nvarying vec2 vInvSize;\nvoid main() {\n\tvUv = uv;\n\tvInvSize = 1.0 / size;\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}', +THREE.SAOShader={defines:{NUM_SAMPLES:7,NUM_RINGS:4,NORMAL_TEXTURE:0,DIFFUSE_TEXTURE:0,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},tDiffuse:{value:null},tNormal:{value:null},size:{value:new THREE.Vector2(512,512)},cameraNear:{value:1},cameraFar:{value:100},cameraProjectionMatrix:{value:new THREE.Matrix4},cameraInverseProjectionMatrix:{value:new THREE.Matrix4},scale:{value:1},intensity:{value:.1},bias:{value:.5},minResolution:{value:0},kernelRadius:{value:100},randomSeed:{value:0}}, +vertexShader:'varying vec2 vUv;\nvoid main() {\n\tvUv = uv;\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}',fragmentShader:'#include \nvarying vec2 vUv;\n#if DIFFUSE_TEXTURE == 1\nuniform sampler2D tDiffuse;\n#endif\nuniform sampler2D tDepth;\n#if NORMAL_TEXTURE == 1\nuniform sampler2D tNormal;\n#endif\nuniform float cameraNear;\nuniform float cameraFar;\nuniform mat4 cameraProjectionMatrix;\nuniform mat4 cameraInverseProjectionMatrix;\nuniform float scale;\nuniform float intensity;\nuniform float bias;\nuniform float kernelRadius;\nuniform float minResolution;\nuniform vec2 size;\nuniform float randomSeed;\n// RGBA depth\n#include \nvec4 getDefaultColor( const in vec2 screenPosition ) {\n\t#if DIFFUSE_TEXTURE == 1\n\treturn texture2D( tDiffuse, vUv );\n\t#else\n\treturn vec4( 1.0 );\n\t#endif\n}\nfloat getDepth( const in vec2 screenPosition ) {\n\t#if DEPTH_PACKING == 1\n\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );\n\t#else\n\treturn texture2D( tDepth, screenPosition ).x;\n\t#endif\n}\nfloat getViewZ( const in float depth ) {\n\t#if PERSPECTIVE_CAMERA == 1\n\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );\n\t#else\n\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );\n\t#endif\n}\nvec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {\n\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];\n\tvec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );\n\tclipPosition *= clipW; // unprojection.\n\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;\n}\nvec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPosition ) {\n\t#if NORMAL_TEXTURE == 1\n\treturn unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );\n\t#else\n\treturn normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );\n\t#endif\n}\nfloat scaleDividedByCameraFar;\nfloat minResolutionMultipliedByCameraFar;\nfloat getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {\n\tvec3 viewDelta = sampleViewPosition - centerViewPosition;\n\tfloat viewDistance = length( viewDelta );\n\tfloat scaledScreenDistance = scaleDividedByCameraFar * viewDistance;\n\treturn max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - bias) / (1.0 + pow2( scaledScreenDistance ) );\n}\n// moving costly divides into consts\nconst float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES );\nconst float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );\nfloat getAmbientOcclusion( const in vec3 centerViewPosition ) {\n\t// precompute some variables require in getOcclusion.\n\tscaleDividedByCameraFar = scale / cameraFar;\n\tminResolutionMultipliedByCameraFar = minResolution * cameraFar;\n\tvec3 centerViewNormal = getViewNormal( centerViewPosition, vUv );\n\t// jsfiddle that shows sample pattern: https://jsfiddle.net/a16ff1p7/\n\tfloat angle = rand( vUv + randomSeed ) * PI2;\n\tvec2 radius = vec2( kernelRadius * INV_NUM_SAMPLES ) / size;\n\tvec2 radiusStep = radius;\n\tfloat occlusionSum = 0.0;\n\tfloat weightSum = 0.0;\n\tfor( int i = 0; i < NUM_SAMPLES; i ++ ) {\n\t\tvec2 sampleUv = vUv + vec2( cos( angle ), sin( angle ) ) * radius;\n\t\tradius += radiusStep;\n\t\tangle += ANGLE_STEP;\n\t\tfloat sampleDepth = getDepth( sampleUv );\n\t\tif( sampleDepth >= ( 1.0 - EPSILON ) ) {\n\t\t\tcontinue;\n\t\t}\n\t\tfloat sampleViewZ = getViewZ( sampleDepth );\n\t\tvec3 sampleViewPosition = getViewPosition( sampleUv, sampleDepth, sampleViewZ );\n\t\tocclusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );\n\t\tweightSum += 1.0;\n\t}\n\tif( weightSum == 0.0 ) discard;\n\treturn occlusionSum * ( intensity / weightSum );\n}\nvoid main() {\n\tfloat centerDepth = getDepth( vUv );\n\tif( centerDepth >= ( 1.0 - EPSILON ) ) {\n\t\tdiscard;\n\t}\n\tfloat centerViewZ = getViewZ( centerDepth );\n\tvec3 viewPosition = getViewPosition( vUv, centerDepth, centerViewZ );\n\tfloat ambientOcclusion = getAmbientOcclusion( viewPosition );\n\tgl_FragColor = getDefaultColor( vUv );\n\tgl_FragColor.xyz *= 1.0 - ambientOcclusion;\n}'}; +THREE.DepthLimitedBlurShader={defines:{KERNEL_RADIUS:4,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDiffuse:{value:null},size:{value:new THREE.Vector2(512,512)},sampleUvOffsets:{value:[new THREE.Vector2(0,0)]},sampleWeights:{value:[1]},tDepth:{value:null},cameraNear:{value:10},cameraFar:{value:1E3},depthCutoff:{value:10}},vertexShader:'#include \nuniform vec2 size;\nvarying vec2 vUv;\nvarying vec2 vInvSize;\nvoid main() {\n\tvUv = uv;\n\tvInvSize = 1.0 / size;\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}', fragmentShader:'#include \n#include \nuniform sampler2D tDiffuse;\nuniform sampler2D tDepth;\nuniform float cameraNear;\nuniform float cameraFar;\nuniform float depthCutoff;\nuniform vec2 sampleUvOffsets[ KERNEL_RADIUS + 1 ];\nuniform float sampleWeights[ KERNEL_RADIUS + 1 ];\nvarying vec2 vUv;\nvarying vec2 vInvSize;\nfloat getDepth( const in vec2 screenPosition ) {\n\t#if DEPTH_PACKING == 1\n\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );\n\t#else\n\treturn texture2D( tDepth, screenPosition ).x;\n\t#endif\n}\nfloat getViewZ( const in float depth ) {\n\t#if PERSPECTIVE_CAMERA == 1\n\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );\n\t#else\n\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );\n\t#endif\n}\nvoid main() {\n\tfloat depth = getDepth( vUv );\n\tif( depth >= ( 1.0 - EPSILON ) ) {\n\t\tdiscard;\n\t}\n\tfloat centerViewZ = -getViewZ( depth );\n\tbool rBreak = false, lBreak = false;\n\tfloat weightSum = sampleWeights[0];\n\tvec4 diffuseSum = texture2D( tDiffuse, vUv ) * weightSum;\n\tfor( int i = 1; i <= KERNEL_RADIUS; i ++ ) {\n\t\tfloat sampleWeight = sampleWeights[i];\n\t\tvec2 sampleUvOffset = sampleUvOffsets[i] * vInvSize;\n\t\tvec2 sampleUv = vUv + sampleUvOffset;\n\t\tfloat viewZ = -getViewZ( getDepth( sampleUv ) );\n\t\tif( abs( viewZ - centerViewZ ) > depthCutoff ) rBreak = true;\n\t\tif( ! rBreak ) {\n\t\t\tdiffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;\n\t\t\tweightSum += sampleWeight;\n\t\t}\n\t\tsampleUv = vUv - sampleUvOffset;\n\t\tviewZ = -getViewZ( getDepth( sampleUv ) );\n\t\tif( abs( viewZ - centerViewZ ) > depthCutoff ) lBreak = true;\n\t\tif( ! lBreak ) {\n\t\t\tdiffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;\n\t\t\tweightSum += sampleWeight;\n\t\t}\n\t}\n\tgl_FragColor = diffuseSum / weightSum;\n}'}; -THREE.BlurShaderUtils={createSampleWeights:function(a,b){for(var d=[],c=0;c<=a;c++)d.push(Math.exp(-(c*c)/(2*b*b))/(Math.sqrt(2*Math.PI)*b));return d},createSampleOffsets:function(a,b){for(var d=[],c=0;c<=a;c++)d.push(b.clone().multiplyScalar(c));return d},configure:function(a,b,d,c){a.defines.KERNEL_RADIUS=b;a.uniforms.sampleUvOffsets.value=THREE.BlurShaderUtils.createSampleOffsets(b,c);a.uniforms.sampleWeights.value=THREE.BlurShaderUtils.createSampleWeights(b,d);a.needsUpdate=!0}}; +THREE.BlurShaderUtils={createSampleWeights:function(a,b){for(var e=[],d=0;d<=a;d++)e.push(Math.exp(-(d*d)/(2*b*b))/(Math.sqrt(2*Math.PI)*b));return e},createSampleOffsets:function(a,b){for(var e=[],d=0;d<=a;d++)e.push(b.clone().multiplyScalar(d));return e},configure:function(a,b,e,d){a.defines.KERNEL_RADIUS=b;a.uniforms.sampleUvOffsets.value=THREE.BlurShaderUtils.createSampleOffsets(b,d);a.uniforms.sampleWeights.value=THREE.BlurShaderUtils.createSampleWeights(b,e);a.needsUpdate=!0}}; THREE.UnpackDepthRGBAShader={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:'varying vec2 vUv;\nvoid main() {\nvUv = uv;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}',fragmentShader:'uniform float opacity;\nuniform sampler2D tDiffuse;\nvarying vec2 vUv;\n#include \nvoid main() {\nfloat depth = 1.0 - unpackRGBAToDepth( texture2D( tDiffuse, vUv ) );\ngl_FragColor = vec4( vec3( depth ), opacity );\n}'}; THREE.ConvolutionShader={defines:{KERNEL_SIZE_FLOAT:'25.0',KERNEL_SIZE_INT:'25'},uniforms:{tDiffuse:{value:null},uImageIncrement:{value:new THREE.Vector2(.001953125,0)},cKernel:{value:[]}},vertexShader:'uniform vec2 uImageIncrement;\nvarying vec2 vUv;\nvoid main() {\nvUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}',fragmentShader:'uniform float cKernel[ KERNEL_SIZE_INT ];\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nvarying vec2 vUv;\nvoid main() {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}', -buildKernel:function(a){var b,d,c=2*Math.ceil(3*a)+1;25= edgeVert;\n FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\n/*--------------------------------------------------------------------------*/\n if(!horzSpan) lumaN = lumaW;\n if(!horzSpan) lumaS = lumaE;\n if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;\n FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;\n/*--------------------------------------------------------------------------*/\n FxaaFloat gradientN = lumaN - lumaM;\n FxaaFloat gradientS = lumaS - lumaM;\n FxaaFloat lumaNN = lumaN + lumaM;\n FxaaFloat lumaSS = lumaS + lumaM;\n FxaaBool pairN = abs(gradientN) >= abs(gradientS);\n FxaaFloat gradient = max(abs(gradientN), abs(gradientS));\n if(pairN) lengthSign = -lengthSign;\n FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posB;\n posB.x = posM.x;\n posB.y = posM.y;\n FxaaFloat2 offNP;\n offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n if(!horzSpan) posB.x += lengthSign * 0.5;\n if( horzSpan) posB.y += lengthSign * 0.5;\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posN;\n posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;\n posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;\n FxaaFloat2 posP;\n posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;\n posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;\n FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;\n FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));\n FxaaFloat subpixE = subpixC * subpixC;\n FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));\n/*--------------------------------------------------------------------------*/\n if(!pairN) lumaNN = lumaSS;\n FxaaFloat gradientScaled = gradient * 1.0/4.0;\n FxaaFloat lumaMM = lumaM - lumaNN * 0.5;\n FxaaFloat subpixF = subpixD * subpixE;\n FxaaBool lumaMLTZero = lumaMM < 0.0;\n/*--------------------------------------------------------------------------*/\n lumaEndN -= lumaNN * 0.5;\n lumaEndP -= lumaNN * 0.5;\n FxaaBool doneN = abs(lumaEndN) >= gradientScaled;\n FxaaBool doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;\n FxaaBool doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;\n/*--------------------------------------------------------------------------*/\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 3)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 4)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 5)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 6)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 7)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 8)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 9)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 10)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 11)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 12)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n/*--------------------------------------------------------------------------*/\n FxaaFloat dstN = posM.x - posN.x;\n FxaaFloat dstP = posP.x - posM.x;\n if(!horzSpan) dstN = posM.y - posN.y;\n if(!horzSpan) dstP = posP.y - posM.y;\n/*--------------------------------------------------------------------------*/\n FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\n FxaaFloat spanLength = (dstP + dstN);\n FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\n FxaaFloat spanLengthRcp = 1.0/spanLength;\n/*--------------------------------------------------------------------------*/\n FxaaBool directionN = dstN < dstP;\n FxaaFloat dst = min(dstN, dstP);\n FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;\n FxaaFloat subpixG = subpixF * subpixF;\n FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\n FxaaFloat subpixH = subpixG * fxaaQualitySubpix;\n/*--------------------------------------------------------------------------*/\n FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\n FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\n if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;\n if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;\n #if (FXAA_DISCARD == 1)\n return FxaaTexTop(tex, posM);\n #else\n return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);\n #endif\n}\n/*==========================================================================*/\n#endif\n\nvoid main() {\n gl_FragColor = FxaaPixelShader(\n vUv,\n vec4(0.0),\n tDiffuse,\n tDiffuse,\n tDiffuse,\n resolution,\n vec4(0.0),\n vec4(0.0),\n vec4(0.0),\n 0.75,\n 0.166,\n 0.0833,\n 0.0,\n 0.0,\n 0.0,\n vec4(0.0)\n );\n\n // TODO avoid querying texture twice for same texel\n gl_FragColor.a = texture2D(tDiffuse, vUv).a;\n}'}; THREE.SSAOShader={defines:{PERSPECTIVE_CAMERA:1,KERNEL_SIZE:32},uniforms:{tDiffuse:{value:null},tNormal:{value:null},tDepth:{value:null},tNoise:{value:null},kernel:{value:null},cameraNear:{value:null},cameraFar:{value:null},resolution:{value:new THREE.Vector2},cameraProjectionMatrix:{value:new THREE.Matrix4},cameraInverseProjectionMatrix:{value:new THREE.Matrix4},kernelRadius:{value:8},minDistance:{value:.005},maxDistance:{value:.05}},vertexShader:'varying vec2 vUv;\nvoid main() {\n\tvUv = uv;\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}', fragmentShader:'uniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tDepth;\nuniform sampler2D tNoise;\nuniform vec3 kernel[ KERNEL_SIZE ];\nuniform vec2 resolution;\nuniform float cameraNear;\nuniform float cameraFar;\nuniform mat4 cameraProjectionMatrix;\nuniform mat4 cameraInverseProjectionMatrix;\nuniform float kernelRadius;\nuniform float minDistance;\nuniform float maxDistance;\nvarying vec2 vUv;\n#include \nfloat getDepth( const in vec2 screenPosition ) {\n\treturn texture2D( tDepth, screenPosition ).x;\n}\nfloat getLinearDepth( const in vec2 screenPosition ) {\n\t#if PERSPECTIVE_CAMERA == 1\n\t\tfloat fragCoordZ = texture2D( tDepth, screenPosition ).x;\n\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );\n\t\treturn viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );\n\t#else\n\t\treturn texture2D( depthSampler, coord ).x;\n\t#endif\n}\nfloat getViewZ( const in float depth ) {\n\t#if PERSPECTIVE_CAMERA == 1\n\t\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );\n\t#else\n\t\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );\n\t#endif\n}\nvec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {\n\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];\n\tvec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );\n\tclipPosition *= clipW; // unprojection.\n\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;\n}\nvec3 getViewNormal( const in vec2 screenPosition ) {\n\treturn unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );\n}\nvoid main() {\n\tfloat depth = getDepth( vUv );\n\tfloat viewZ = getViewZ( depth );\n\tvec3 viewPosition = getViewPosition( vUv, depth, viewZ );\n\tvec3 viewNormal = getViewNormal( vUv );\n vec2 noiseScale = vec2( resolution.x / 4.0, resolution.y / 4.0 );\n\tvec3 random = texture2D( tNoise, vUv * noiseScale ).xyz;\n\tvec3 tangent = normalize( random - viewNormal * dot( random, viewNormal ) );\n\tvec3 bitangent = cross( viewNormal, tangent );\n\tmat3 kernelMatrix = mat3( tangent, bitangent, viewNormal );\n float occlusion = 0.0;\n for ( int i = 0; i < KERNEL_SIZE; i ++ ) {\n\t\tvec3 sampleVector = kernelMatrix * kernel[ i ];\n\t\tvec3 samplePoint = viewPosition + ( sampleVector * kernelRadius );\n\t\tvec4 samplePointNDC = cameraProjectionMatrix * vec4( samplePoint, 1.0 );\n\t\tsamplePointNDC /= samplePointNDC.w;\n\t\tvec2 samplePointUv = samplePointNDC.xy * 0.5 + 0.5;\n\t\tfloat realDepth = getLinearDepth( samplePointUv );\n\t\tfloat sampleDepth = viewZToOrthographicDepth( samplePoint.z, cameraNear, cameraFar );\n\t\tfloat delta = sampleDepth - realDepth;\n\t\tif ( delta > minDistance && delta < maxDistance ) {\n\t\t\tocclusion += 1.0;\n\t\t}\n\t}\n\tocclusion = clamp( occlusion / float( KERNEL_SIZE ), 0.0, 1.0 );\n\tgl_FragColor = vec4( vec3( 1.0 - occlusion ), 1.0 );\n}'}; @@ -1059,610 +1070,610 @@ THREE.HueSaturationShader={uniforms:{tDiffuse:{value:null},hue:{value:0},saturat THREE.EffectComposer=function(a,b){this.renderer=a;void 0===b&&(b={minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat,stencilBuffer:!1},a=a.getDrawingBufferSize(new THREE.Vector2),b=new THREE.WebGLRenderTarget(a.width,a.height,b),b.texture.name='EffectComposer.rt1');this.renderTarget1=b;this.renderTarget2=b.clone();this.renderTarget2.texture.name='EffectComposer.rt2';this.writeBuffer=this.renderTarget1;this.readBuffer=this.renderTarget2;this.renderToScreen=!0;this.passes= [];void 0===THREE.CopyShader&&console.error('THREE.EffectComposer relies on THREE.CopyShader');void 0===THREE.ShaderPass&&console.error('THREE.EffectComposer relies on THREE.ShaderPass');this.copyPass=new THREE.ShaderPass(THREE.CopyShader);this._previousFrameTime=Date.now()}; Object.assign(THREE.EffectComposer.prototype,{swapBuffers:function(){var a=this.readBuffer;this.readBuffer=this.writeBuffer;this.writeBuffer=a},addPass:function(a){this.passes.push(a);var b=this.renderer.getDrawingBufferSize(new THREE.Vector2);a.setSize(b.width,b.height)},insertPass:function(a,b){this.passes.splice(b,0,a)},isLastEnabledPass:function(a){for(a+=1;a=d[c])return c-1;if(b<=d[a])return a;for(var g=Math.floor((a+c)/2);b=d[g+1];)b=q&&(g[b][0]=g[a][0]/m[r+1][e],p=g[b][0]*m[e][r]);t=n-1<=r?q-1:d-n;for(k=-1<=e?1:-e;k<=t;++k)g[b][k]=(g[a][k]-g[a][k-1])/m[r+1][e+k],p+=g[b][k]*m[e+k][r];n<=r&&(g[b][q]=-g[a][q-1]/m[r+1][n],p+=g[b][q]*m[n][r]);l[q][n]=p;k=a;a=b;b=k}}n=d;for(q=1;q<=c;++q){for(k=0;k<=d;++k)l[q][k]*=n;n*=d-q}return l},calcBSplineDerivatives:function(a,b,d,c,g){var h=g=e[d])return d-1;if(b<=e[a])return a;for(var c=Math.floor((a+d)/2);b=e[c+1];)b=q&&(c[b][0]=c[a][0]/n[r+1][g],m=c[b][0]*n[g][r]);u=p-1<=r?q-1:e-p;for(h=-1<=g?1:-g;h<=u;++h)c[b][h]=(c[a][h]-c[a][h-1])/n[r+1][g+h],m+=c[b][h]*n[g+h][r];p<=r&&(c[b][q]=-c[a][q-1]/n[r+1][p],m+=c[b][q]*n[p][r]);l[q][p]=m;h=a;a=b;b=h}}p=e;for(q=1;q<=d;++q){for(h=0;h<=e;++h)l[q][h]*=p;p*=e-q}return l},calcBSplineDerivatives:function(a,b,e,d,c){var k=cc.dot(g)}}(),e=function(){var a=new THREE.Vector3,b=new THREE.Vector3,e=new THREE.Quaternion,c=new THREE.Vector3;return function(){d.matrixWorld.decompose(b,e,c);a.set(0,0,1).applyQuaternion(e).normalize();a.negate();l.setFromNormalAndCoplanarPoint(a,b)}}(),n=function(){var a=new THREE.Plane, -b=new THREE.Vector4,e=new THREE.Vector4;return function(c){k.matrixWorld.copy(c.matrixWorld);k.matrixWorldInverse.getInverse(k.matrixWorld);k.projectionMatrix.copy(c.projectionMatrix);k.far=c.far;a.copy(l);a.applyMatrix4(k.matrixWorldInverse);b.set(a.normal.x,a.normal.y,a.normal.z,a.constant);c=k.projectionMatrix;e.x=(Math.sign(b.x)+c.elements[8])/c.elements[0];e.y=(Math.sign(b.y)+c.elements[9])/c.elements[5];e.z=-1;e.w=(1+c.elements[10])/c.elements[14];b.multiplyScalar(2/b.dot(e));c.elements[2]= -b.x;c.elements[6]=b.y;c.elements[10]=b.z+1-h;c.elements[14]=b.w}}(),r=function(){var a=new THREE.Vector4,b=new THREE.Vector2;return function(e,c,g){d.visible=!1;var h=e.getRenderTarget(),n=e.vr.enabled,m=e.shadowMap.autoUpdate;e.vr.enabled=!1;e.shadowMap.autoUpdate=!1;e.setRenderTarget(q);e.clear();e.render(c,k);e.vr.enabled=n;e.shadowMap.autoUpdate=m;e.setRenderTarget(h);c=g.bounds;void 0!==c&&(e.getSize(b),g=e.getPixelRatio(),a.x=c.x*b.width*g,a.y=c.y*b.height*g,a.z=c.z*b.width*g,a.w=c.w*b.height* -g,e.state.viewport(a));d.visible=!0}}();this.onBeforeRender=function(a,b,c){!0!==c.userData.refractor&&!0!==!p(c)&&(e(),m.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),m.multiply(c.projectionMatrix),m.multiply(c.matrixWorldInverse),m.multiply(d.matrixWorld),n(c),r(a,b,c))};this.getRenderTarget=function(){return q}};THREE.Refractor.prototype=Object.create(THREE.Mesh.prototype);THREE.Refractor.prototype.constructor=THREE.Refractor; +THREE.Refractor=function(a,b){THREE.Mesh.call(this,a);this.type='Refractor';var e=this;b=b||{};a=void 0!==b.color?new THREE.Color(b.color):new THREE.Color(8355711);var d=b.textureWidth||512,c=b.textureHeight||512,k=b.clipBias||0;b=b.shader||THREE.Refractor.RefractorShader;var h=new THREE.PerspectiveCamera;h.matrixAutoUpdate=!1;h.userData.refractor=!0;var l=new THREE.Plane,n=new THREE.Matrix4,q=new THREE.WebGLRenderTarget(d,c,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBFormat, +stencilBuffer:!1});THREE.Math.isPowerOfTwo(d)&&THREE.Math.isPowerOfTwo(c)||(q.texture.generateMipmaps=!1);this.material=new THREE.ShaderMaterial({uniforms:THREE.UniformsUtils.clone(b.uniforms),vertexShader:b.vertexShader,fragmentShader:b.fragmentShader,transparent:!0});this.material.uniforms.color.value=a;this.material.uniforms.tDiffuse.value=q.texture;this.material.uniforms.textureMatrix.value=n;var m=function(){var a=new THREE.Vector3,b=new THREE.Vector3,g=new THREE.Matrix4,c=new THREE.Vector3, +d=new THREE.Vector3;return function(h){a.setFromMatrixPosition(e.matrixWorld);b.setFromMatrixPosition(h.matrixWorld);c.subVectors(a,b);g.extractRotation(e.matrixWorld);d.set(0,0,1);d.applyMatrix4(g);return 0>c.dot(d)}}(),g=function(){var a=new THREE.Vector3,b=new THREE.Vector3,g=new THREE.Quaternion,c=new THREE.Vector3;return function(){e.matrixWorld.decompose(b,g,c);a.set(0,0,1).applyQuaternion(g).normalize();a.negate();l.setFromNormalAndCoplanarPoint(a,b)}}(),p=function(){var a=new THREE.Plane, +b=new THREE.Vector4,g=new THREE.Vector4;return function(c){h.matrixWorld.copy(c.matrixWorld);h.matrixWorldInverse.getInverse(h.matrixWorld);h.projectionMatrix.copy(c.projectionMatrix);h.far=c.far;a.copy(l);a.applyMatrix4(h.matrixWorldInverse);b.set(a.normal.x,a.normal.y,a.normal.z,a.constant);c=h.projectionMatrix;g.x=(Math.sign(b.x)+c.elements[8])/c.elements[0];g.y=(Math.sign(b.y)+c.elements[9])/c.elements[5];g.z=-1;g.w=(1+c.elements[10])/c.elements[14];b.multiplyScalar(2/b.dot(g));c.elements[2]= +b.x;c.elements[6]=b.y;c.elements[10]=b.z+1-k;c.elements[14]=b.w}}(),r=function(){var a=new THREE.Vector4,b=new THREE.Vector2;return function(g,c,d){e.visible=!1;var k=g.getRenderTarget(),p=g.vr.enabled,m=g.shadowMap.autoUpdate;g.vr.enabled=!1;g.shadowMap.autoUpdate=!1;g.setRenderTarget(q);g.clear();g.render(c,h);g.vr.enabled=p;g.shadowMap.autoUpdate=m;g.setRenderTarget(k);c=d.bounds;void 0!==c&&(g.getSize(b),d=g.getPixelRatio(),a.x=c.x*b.width*d,a.y=c.y*b.height*d,a.z=c.z*b.width*d,a.w=c.w*b.height* +d,g.state.viewport(a));e.visible=!0}}();this.onBeforeRender=function(a,b,c){!0!==c.userData.refractor&&!0!==!m(c)&&(g(),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(c.projectionMatrix),n.multiply(c.matrixWorldInverse),n.multiply(e.matrixWorld),p(c),r(a,b,c))};this.getRenderTarget=function(){return q}};THREE.Refractor.prototype=Object.create(THREE.Mesh.prototype);THREE.Refractor.prototype.constructor=THREE.Refractor; THREE.Refractor.RefractorShader={uniforms:{color:{type:'c',value:null},tDiffuse:{type:'t',value:null},textureMatrix:{type:'m4',value:null}},vertexShader:'uniform mat4 textureMatrix;\nvarying vec4 vUv;\nvoid main() {\n\tvUv = textureMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}',fragmentShader:'uniform vec3 color;\nuniform sampler2D tDiffuse;\nvarying vec4 vUv;\nfloat blendOverlay( float base, float blend ) {\n\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );\n}\nvec3 blendOverlay( vec3 base, vec3 blend ) {\n\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );\n}\nvoid main() {\n\tvec4 base = texture2DProj( tDiffuse, vUv );\n\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );\n}'}; THREE.TTFLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager;this.reversed=!1}; -THREE.TTFLoader.prototype={constructor:THREE.TTFLoader,load:function(a,b,d,c){var g=this,h=new THREE.FileLoader(this.manager);h.setPath(this.path);h.setResponseType('arraybuffer');h.load(a,function(a){b(g.parse(a))},d,c)},setPath:function(a){this.path=a;return this},parse:function(a){function b(a){var b=[],d;a.forEach(function(a){'m'===a.type.toLowerCase()?(d=[a],b.push(d)):'z'!==a.type.toLowerCase()&&d.push(a)});var h=[];b.forEach(function(a){var b={type:'m',x:a[a.length-1].x,y:a[a.length-1].y}; -h.push(b);for(var c=a.length-1;0>1,n=-7;g=c?g-1:0;var m=c?-1:1,l=a[b+g];g+=m;c=l&(1<<-n)-1;l>>=-n;for(n+=e;0>=-n;for(n+=d;0>1,l=23===g?Math.pow(2, --24)-Math.pow(2,-77):0;h=d?0:h-1;var p=d?1:-1,q=0>b||0===b&&0>1/b?1:0;b=Math.abs(b);for(isNaN(b)||Infinity===b?(b=isNaN(b)?1:0,d=n):(d=Math.floor(Math.log(b)/Math.LN2),1>b*(e=Math.pow(2,-d))&&(d--,e*=2),b=1<=d+m?b+l/e:b+l*Math.pow(2,1-m),2<=b*e&&(d++,e/=2),d+m>=n?(b=0,d=n):1<=d+m?(b=(b*e-1)*Math.pow(2,g),d+=m):(b=b*Math.pow(2,m-1)*Math.pow(2,g),d=0));8<=g;a[c+h]=b&255,h+=p,b/=256,g-=8);d=d<a)throw RangeError('Illegal capacity');b=!!b;c=!!c}this.buffer=0===a?l:new ArrayBuffer(a);this.view=0===a?null:new Uint8Array(this.buffer);this.offset=0;this.markedOffset=-1;this.limit=a;this.littleEndian=b;this.noAssert=c};h.VERSION='5.0.1';h.LITTLE_ENDIAN=!0;h.BIG_ENDIAN=!1;h.DEFAULT_CAPACITY=16;h.DEFAULT_ENDIAN=h.BIG_ENDIAN;h.DEFAULT_NOASSERT=!1;h.Long=a||null;var k= -h.prototype;Object.defineProperty(k,'__isByteBuffer__',{value:!0,enumerable:!1,configurable:!1});var l=new ArrayBuffer(0),m=String.fromCharCode;h.accessor=function(){return Uint8Array};h.allocate=function(a,b,c){return new h(a,b,c)};h.concat=function(a,b,c,d){if('boolean'===typeof b||'string'!==typeof b)d=c,c=b,b=void 0;for(var e=0,g=0,k=a.length,n;g=n||(b.view.set(c.view.subarray(c.offset,c.limit),b.offset),b.offset+=n);b.limit=b.offset;b.offset=0;return b};h.isByteBuffer=function(a){return!0===(a&&a.__isByteBuffer__)};h.type=function(){return ArrayBuffer};h.wrap=function(a,b,c,d){'string'!==typeof b&&(d=c,c=b,b=void 0);if('string'===typeof a)switch('undefined'===typeof b&&(b='utf8'),b){case 'base64':return h.fromBase64(a,c);case 'hex':return h.fromHex(a,c);case 'binary':return h.fromBinary(a,c);case 'utf8':return h.fromUTF8(a, -c);case 'debug':return h.fromDebug(a,c);default:throw Error('Unsupported encoding: '+b);}if(null===a||'object'!==typeof a)throw TypeError('Illegal buffer');if(h.isByteBuffer(a))return b=k.clone.call(a),b.markedOffset=-1,b;if(a instanceof Uint8Array)b=new h(0,c,d),0>>=0;if(0>b||b+0> -this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var c=b,d=a.length,g=d>>3,h=0;for(b+=this.writeVarint32(d,b);g--;){var k=!!a[h++]&1|(!!a[h++]&1)<<1|(!!a[h++]&1)<<2|(!!a[h++]&1)<<3|(!!a[h++]&1)<<4|(!!a[h++]&1)<<5|(!!a[h++]&1)<<6|(!!a[h++]&1)<<7;this.writeByte(k,b++)}if(h>3,g=0,h=[];for(a+=e.length;d--;)e=this.readByte(a++),h[g++]=!!(e&1),h[g++]=!!(e&2),h[g++]=!!(e&4),h[g++]=!!(e&8),h[g++]=!!(e&16),h[g++]=!!(e&32),h[g++]=!!(e&64),h[g++]=!!(e&128);if(g>d++&1);b&&(this.offset=a);return h};k.readBytes=function(a,b){var e='undefined'===typeof b;e&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b|| -b+a>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+'+a+') <= '+this.buffer.byteLength);}b=this.slice(b,b+a);e&&(this.offset+=a);return b};k.writeBytes=k.append;k.writeInt8=function(a,b){var e='undefined'===typeof b;e&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a|=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ -b+' (+0) <= '+this.buffer.byteLength);}b+=1;var c=this.buffer.byteLength;b>c&&this.resize((c*=2)>b?c:b);this.view[b-1]=a;e&&(this.offset+=1);return this};k.writeByte=k.writeInt8;k.readInt8=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength);}a=this.view[a];128=== -(a&128)&&(a=-(255-a+1));b&&(this.offset+=1);return a};k.readByte=k.readInt8;k.writeUint8=function(a,b){var e='undefined'===typeof b;e&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}b+=1;var c=this.buffer.byteLength; -b>c&&this.resize((c*=2)>b?c:b);this.view[b-1]=a;e&&(this.offset+=1);return this};k.writeUInt8=k.writeUint8;k.readUint8=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength);}a=this.view[a];b&&(this.offset+=1);return a};k.readUInt8=k.readUint8;k.writeInt16=function(a, -b){var e='undefined'===typeof b;e&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a|=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}b+=2;var c=this.buffer.byteLength;b>c&&this.resize((c*=2)>b?c:b);b-=2;this.littleEndian?(this.view[b+1]=(a&65280)>>>8,this.view[b]= -a&255):(this.view[b]=(a&65280)>>>8,this.view[b+1]=a&255);e&&(this.offset+=2);return this};k.writeShort=k.writeInt16;k.readInt16=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+2>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+2) <= '+this.buffer.byteLength);}var e=0;this.littleEndian?(e=this.view[a],e|=this.view[a+1]<<8):(e=this.view[a]<<8, -e|=this.view[a+1]);32768===(e&32768)&&(e=-(65535-e+1));b&&(this.offset+=2);return e};k.readShort=k.readInt16;k.writeUint16=function(a,b){var e='undefined'===typeof b;e&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength); -}b+=2;var c=this.buffer.byteLength;b>c&&this.resize((c*=2)>b?c:b);b-=2;this.littleEndian?(this.view[b+1]=(a&65280)>>>8,this.view[b]=a&255):(this.view[b]=(a&65280)>>>8,this.view[b+1]=a&255);e&&(this.offset+=2);return this};k.writeUInt16=k.writeUint16;k.readUint16=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+2>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ -a+' (+2) <= '+this.buffer.byteLength);}var e=0;this.littleEndian?(e=this.view[a],e|=this.view[a+1]<<8):(e=this.view[a]<<8,e|=this.view[a+1]);b&&(this.offset+=2);return e};k.readUInt16=k.readUint16;k.writeInt32=function(a,b){var e='undefined'===typeof b;e&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a|=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ -b+' (+0) <= '+this.buffer.byteLength);}b+=4;var c=this.buffer.byteLength;b>c&&this.resize((c*=2)>b?c:b);b-=4;this.littleEndian?(this.view[b+3]=a>>>24&255,this.view[b+2]=a>>>16&255,this.view[b+1]=a>>>8&255,this.view[b]=a&255):(this.view[b]=a>>>24&255,this.view[b+1]=a>>>16&255,this.view[b+2]=a>>>8&255,this.view[b+3]=a&255);e&&(this.offset+=4);return this};k.writeInt=k.writeInt32;k.readInt32=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a% -1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+4) <= '+this.buffer.byteLength);}var e=0;this.littleEndian?(e=this.view[a+2]<<16,e|=this.view[a+1]<<8,e|=this.view[a],e+=this.view[a+3]<<24>>>0):(e=this.view[a+1]<<16,e|=this.view[a+2]<<8,e|=this.view[a+3],e+=this.view[a]<<24>>>0);b&&(this.offset+=4);return e|0};k.readInt=k.readInt32;k.writeUint32=function(a,b){var e='undefined'===typeof b;e&&(b=this.offset); +THREE.TTFLoader.prototype={constructor:THREE.TTFLoader,load:function(a,b,e,d){var c=this,k=new THREE.FileLoader(this.manager);k.setPath(this.path);k.setResponseType('arraybuffer');k.load(a,function(a){b(c.parse(a))},e,d)},setPath:function(a){this.path=a;return this},parse:function(a){function b(a){var b=[],c;a.forEach(function(a){'m'===a.type.toLowerCase()?(c=[a],b.push(c)):'z'!==a.type.toLowerCase()&&c.push(a)});var e=[];b.forEach(function(a){var b={type:'m',x:a[a.length-1].x,y:a[a.length-1].y}; +e.push(b);for(var c=a.length-1;0>1,p=-7;e=c?e-1:0;var m=c?-1:1,l=a[b+e];e+=m;c=l&(1<<-p)-1;l>>=-p;for(p+=g;0>=-p;for(p+=d;0>1,l=23===e?Math.pow(2, +-24)-Math.pow(2,-77):0;h=d?0:h-1;var n=d?1:-1,q=0>b||0===b&&0>1/b?1:0;b=Math.abs(b);for(isNaN(b)||Infinity===b?(b=isNaN(b)?1:0,d=p):(d=Math.floor(Math.log(b)/Math.LN2),1>b*(g=Math.pow(2,-d))&&(d--,g*=2),b=1<=d+m?b+l/g:b+l*Math.pow(2,1-m),2<=b*g&&(d++,g/=2),d+m>=p?(b=0,d=p):1<=d+m?(b=(b*g-1)*Math.pow(2,e),d+=m):(b=b*Math.pow(2,m-1)*Math.pow(2,e),d=0));8<=e;a[c+h]=b&255,h+=n,b/=256,e-=8);d=d<a)throw RangeError('Illegal capacity');b=!!b;c=!!c}this.buffer=0===a?l:new ArrayBuffer(a);this.view=0===a?null:new Uint8Array(this.buffer);this.offset=0;this.markedOffset=-1;this.limit=a;this.littleEndian=b;this.noAssert=c};k.VERSION='5.0.1';k.LITTLE_ENDIAN=!0;k.BIG_ENDIAN=!1;k.DEFAULT_CAPACITY=16;k.DEFAULT_ENDIAN=k.BIG_ENDIAN;k.DEFAULT_NOASSERT=!1;k.Long=a||null;var h= +k.prototype;Object.defineProperty(h,'__isByteBuffer__',{value:!0,enumerable:!1,configurable:!1});var l=new ArrayBuffer(0),n=String.fromCharCode;k.accessor=function(){return Uint8Array};k.allocate=function(a,b,c){return new k(a,b,c)};k.concat=function(a,b,c,d){if('boolean'===typeof b||'string'!==typeof b)d=c,c=b,b=void 0;for(var g=0,e=0,h=a.length,p;e=p||(b.view.set(c.view.subarray(c.offset,c.limit),b.offset),b.offset+=p);b.limit=b.offset;b.offset=0;return b};k.isByteBuffer=function(a){return!0===(a&&a.__isByteBuffer__)};k.type=function(){return ArrayBuffer};k.wrap=function(a,b,c,d){'string'!==typeof b&&(d=c,c=b,b=void 0);if('string'===typeof a)switch('undefined'===typeof b&&(b='utf8'),b){case 'base64':return k.fromBase64(a,c);case 'hex':return k.fromHex(a,c);case 'binary':return k.fromBinary(a,c);case 'utf8':return k.fromUTF8(a, +c);case 'debug':return k.fromDebug(a,c);default:throw Error('Unsupported encoding: '+b);}if(null===a||'object'!==typeof a)throw TypeError('Illegal buffer');if(k.isByteBuffer(a))return b=h.clone.call(a),b.markedOffset=-1,b;if(a instanceof Uint8Array)b=new k(0,c,d),0>>=0;if(0>b||b+0> +this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var c=b,d=a.length,e=d>>3,h=0;for(b+=this.writeVarint32(d,b);e--;){var k=!!a[h++]&1|(!!a[h++]&1)<<1|(!!a[h++]&1)<<2|(!!a[h++]&1)<<3|(!!a[h++]&1)<<4|(!!a[h++]&1)<<5|(!!a[h++]&1)<<6|(!!a[h++]&1)<<7;this.writeByte(k,b++)}if(h>3,e=0,h=[];for(a+=g.length;d--;)g=this.readByte(a++),h[e++]=!!(g&1),h[e++]=!!(g&2),h[e++]=!!(g&4),h[e++]=!!(g&8),h[e++]=!!(g&16),h[e++]=!!(g&32),h[e++]=!!(g&64),h[e++]=!!(g&128);if(e>d++&1);b&&(this.offset=a);return h};h.readBytes=function(a,b){var g='undefined'===typeof b;g&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b|| +b+a>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+'+a+') <= '+this.buffer.byteLength);}b=this.slice(b,b+a);g&&(this.offset+=a);return b};h.writeBytes=h.append;h.writeInt8=function(a,b){var g='undefined'===typeof b;g&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a|=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ +b+' (+0) <= '+this.buffer.byteLength);}b+=1;var c=this.buffer.byteLength;b>c&&this.resize((c*=2)>b?c:b);this.view[b-1]=a;g&&(this.offset+=1);return this};h.writeByte=h.writeInt8;h.readInt8=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength);}a=this.view[a];128=== +(a&128)&&(a=-(255-a+1));b&&(this.offset+=1);return a};h.readByte=h.readInt8;h.writeUint8=function(a,b){var g='undefined'===typeof b;g&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}b+=1;var c=this.buffer.byteLength; +b>c&&this.resize((c*=2)>b?c:b);this.view[b-1]=a;g&&(this.offset+=1);return this};h.writeUInt8=h.writeUint8;h.readUint8=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength);}a=this.view[a];b&&(this.offset+=1);return a};h.readUInt8=h.readUint8;h.writeInt16=function(a, +b){var g='undefined'===typeof b;g&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a|=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}b+=2;var c=this.buffer.byteLength;b>c&&this.resize((c*=2)>b?c:b);b-=2;this.littleEndian?(this.view[b+1]=(a&65280)>>>8,this.view[b]= +a&255):(this.view[b]=(a&65280)>>>8,this.view[b+1]=a&255);g&&(this.offset+=2);return this};h.writeShort=h.writeInt16;h.readInt16=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+2>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+2) <= '+this.buffer.byteLength);}var g=0;this.littleEndian?(g=this.view[a],g|=this.view[a+1]<<8):(g=this.view[a]<<8, +g|=this.view[a+1]);32768===(g&32768)&&(g=-(65535-g+1));b&&(this.offset+=2);return g};h.readShort=h.readInt16;h.writeUint16=function(a,b){var g='undefined'===typeof b;g&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength); +}b+=2;var c=this.buffer.byteLength;b>c&&this.resize((c*=2)>b?c:b);b-=2;this.littleEndian?(this.view[b+1]=(a&65280)>>>8,this.view[b]=a&255):(this.view[b]=(a&65280)>>>8,this.view[b+1]=a&255);g&&(this.offset+=2);return this};h.writeUInt16=h.writeUint16;h.readUint16=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+2>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ +a+' (+2) <= '+this.buffer.byteLength);}var g=0;this.littleEndian?(g=this.view[a],g|=this.view[a+1]<<8):(g=this.view[a]<<8,g|=this.view[a+1]);b&&(this.offset+=2);return g};h.readUInt16=h.readUint16;h.writeInt32=function(a,b){var g='undefined'===typeof b;g&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a|=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ +b+' (+0) <= '+this.buffer.byteLength);}b+=4;var c=this.buffer.byteLength;b>c&&this.resize((c*=2)>b?c:b);b-=4;this.littleEndian?(this.view[b+3]=a>>>24&255,this.view[b+2]=a>>>16&255,this.view[b+1]=a>>>8&255,this.view[b]=a&255):(this.view[b]=a>>>24&255,this.view[b+1]=a>>>16&255,this.view[b+2]=a>>>8&255,this.view[b+3]=a&255);g&&(this.offset+=4);return this};h.writeInt=h.writeInt32;h.readInt32=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a% +1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+4) <= '+this.buffer.byteLength);}var g=0;this.littleEndian?(g=this.view[a+2]<<16,g|=this.view[a+1]<<8,g|=this.view[a],g+=this.view[a+3]<<24>>>0):(g=this.view[a+1]<<16,g|=this.view[a+2]<<8,g|=this.view[a+3],g+=this.view[a]<<24>>>0);b&&(this.offset+=4);return g|0};h.readInt=h.readInt32;h.writeUint32=function(a,b){var g='undefined'===typeof b;g&&(b=this.offset); if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}b+=4;var c=this.buffer.byteLength;b>c&&this.resize((c*=2)>b?c:b);b-=4;this.littleEndian?(this.view[b+3]=a>>>24&255,this.view[b+2]=a>>>16&255,this.view[b+1]=a>>>8&255,this.view[b]= -a&255):(this.view[b]=a>>>24&255,this.view[b+1]=a>>>16&255,this.view[b+2]=a>>>8&255,this.view[b+3]=a&255);e&&(this.offset+=4);return this};k.writeUInt32=k.writeUint32;k.readUint32=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+4) <= '+this.buffer.byteLength);}var e=0;this.littleEndian?(e=this.view[a+ -2]<<16,e|=this.view[a+1]<<8,e|=this.view[a],e+=this.view[a+3]<<24>>>0):(e=this.view[a+1]<<16,e|=this.view[a+2]<<8,e|=this.view[a+3],e+=this.view[a]<<24>>>0);b&&(this.offset+=4);return e};k.readUInt32=k.readUint32;a&&(k.writeInt64=function(b,c){var e='undefined'===typeof c;e&&(c=this.offset);if(!this.noAssert){if('number'===typeof b)b=a.fromNumber(b);else if('string'===typeof b)b=a.fromString(b);else if(!(b&&b instanceof a))throw TypeError('Illegal value: '+b+' (not an integer or Long)');if('number'!== +a&255):(this.view[b]=a>>>24&255,this.view[b+1]=a>>>16&255,this.view[b+2]=a>>>8&255,this.view[b+3]=a&255);g&&(this.offset+=4);return this};h.writeUInt32=h.writeUint32;h.readUint32=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+4) <= '+this.buffer.byteLength);}var g=0;this.littleEndian?(g=this.view[a+ +2]<<16,g|=this.view[a+1]<<8,g|=this.view[a],g+=this.view[a+3]<<24>>>0):(g=this.view[a+1]<<16,g|=this.view[a+2]<<8,g|=this.view[a+3],g+=this.view[a]<<24>>>0);b&&(this.offset+=4);return g};h.readUInt32=h.readUint32;a&&(h.writeInt64=function(b,c){var g='undefined'===typeof c;g&&(c=this.offset);if(!this.noAssert){if('number'===typeof b)b=a.fromNumber(b);else if('string'===typeof b)b=a.fromString(b);else if(!(b&&b instanceof a))throw TypeError('Illegal value: '+b+' (not an integer or Long)');if('number'!== typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}'number'===typeof b?b=a.fromNumber(b):'string'===typeof b&&(b=a.fromString(b));c+=8;var d=this.buffer.byteLength;c>d&&this.resize((d*=2)>c?d:c);c-=8;d=b.low;b=b.high;this.littleEndian?(this.view[c+3]=d>>>24&255,this.view[c+2]=d>>>16&255,this.view[c+1]=d>>>8&255,this.view[c]=d&255,c+=4,this.view[c+3]=b>>> -24&255,this.view[c+2]=b>>>16&255,this.view[c+1]=b>>>8&255,this.view[c]=b&255):(this.view[c]=b>>>24&255,this.view[c+1]=b>>>16&255,this.view[c+2]=b>>>8&255,this.view[c+3]=b&255,c+=4,this.view[c]=d>>>24&255,this.view[c+1]=d>>>16&255,this.view[c+2]=d>>>8&255,this.view[c+3]=d&255);e&&(this.offset+=8);return this},k.writeLong=k.writeInt64,k.readInt64=function(b){var e='undefined'===typeof b;e&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)'); +24&255,this.view[c+2]=b>>>16&255,this.view[c+1]=b>>>8&255,this.view[c]=b&255):(this.view[c]=b>>>24&255,this.view[c+1]=b>>>16&255,this.view[c+2]=b>>>8&255,this.view[c+3]=b&255,c+=4,this.view[c]=d>>>24&255,this.view[c+1]=d>>>16&255,this.view[c+2]=d>>>8&255,this.view[c+3]=d&255);g&&(this.offset+=8);return this},h.writeLong=h.writeInt64,h.readInt64=function(b){var g='undefined'===typeof b;g&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)'); b>>>=0;if(0>b||b+8>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+8) <= '+this.buffer.byteLength);}var c=0,d=0;this.littleEndian?(c=this.view[b+2]<<16,c|=this.view[b+1]<<8,c|=this.view[b],c+=this.view[b+3]<<24>>>0,b+=4,d=this.view[b+2]<<16,d|=this.view[b+1]<<8,d|=this.view[b],d+=this.view[b+3]<<24>>>0):(d=this.view[b+1]<<16,d|=this.view[b+2]<<8,d|=this.view[b+3],d+=this.view[b]<<24>>>0,b+=4,c=this.view[b+1]<<16,c|=this.view[b+2]<<8,c|=this.view[b+3],c+=this.view[b]<<24>>>0); -b=new a(c,d,!1);e&&(this.offset+=8);return b},k.readLong=k.readInt64,k.writeUint64=function(b,c){var e='undefined'===typeof c;e&&(c=this.offset);if(!this.noAssert){if('number'===typeof b)b=a.fromNumber(b);else if('string'===typeof b)b=a.fromString(b);else if(!(b&&b instanceof a))throw TypeError('Illegal value: '+b+' (not an integer or Long)');if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ +b=new a(c,d,!1);g&&(this.offset+=8);return b},h.readLong=h.readInt64,h.writeUint64=function(b,c){var g='undefined'===typeof c;g&&(c=this.offset);if(!this.noAssert){if('number'===typeof b)b=a.fromNumber(b);else if('string'===typeof b)b=a.fromString(b);else if(!(b&&b instanceof a))throw TypeError('Illegal value: '+b+' (not an integer or Long)');if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ c+' (+0) <= '+this.buffer.byteLength);}'number'===typeof b?b=a.fromNumber(b):'string'===typeof b&&(b=a.fromString(b));c+=8;var d=this.buffer.byteLength;c>d&&this.resize((d*=2)>c?d:c);c-=8;d=b.low;b=b.high;this.littleEndian?(this.view[c+3]=d>>>24&255,this.view[c+2]=d>>>16&255,this.view[c+1]=d>>>8&255,this.view[c]=d&255,c+=4,this.view[c+3]=b>>>24&255,this.view[c+2]=b>>>16&255,this.view[c+1]=b>>>8&255,this.view[c]=b&255):(this.view[c]=b>>>24&255,this.view[c+1]=b>>>16&255,this.view[c+2]=b>>>8&255,this.view[c+ -3]=b&255,c+=4,this.view[c]=d>>>24&255,this.view[c+1]=d>>>16&255,this.view[c+2]=d>>>8&255,this.view[c+3]=d&255);e&&(this.offset+=8);return this},k.writeUInt64=k.writeUint64,k.readUint64=function(b){var e='undefined'===typeof b;e&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+8>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+8) <= '+this.buffer.byteLength);}var c=0,d=0;this.littleEndian? -(c=this.view[b+2]<<16,c|=this.view[b+1]<<8,c|=this.view[b],c+=this.view[b+3]<<24>>>0,b+=4,d=this.view[b+2]<<16,d|=this.view[b+1]<<8,d|=this.view[b],d+=this.view[b+3]<<24>>>0):(d=this.view[b+1]<<16,d|=this.view[b+2]<<8,d|=this.view[b+3],d+=this.view[b]<<24>>>0,b+=4,c=this.view[b+1]<<16,c|=this.view[b+2]<<8,c|=this.view[b+3],c+=this.view[b]<<24>>>0);b=new a(c,d,!0);e&&(this.offset+=8);return b},k.readUInt64=k.readUint64);k.writeFloat32=function(a,b){var e='undefined'===typeof b;e&&(b=this.offset);if(!this.noAssert){if('number'!== -typeof a)throw TypeError('Illegal value: '+a+' (not a number)');if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}b+=4;var c=this.buffer.byteLength;b>c&&this.resize((c*=2)>b?c:b);g(this.view,a,b-4,this.littleEndian,23,4);e&&(this.offset+=4);return this};k.writeFloat=k.writeFloat32;k.readFloat32=function(a){var b='undefined'===typeof a;b&& -(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+4) <= '+this.buffer.byteLength);}a=c(this.view,a,this.littleEndian,23,4);b&&(this.offset+=4);return a};k.readFloat=k.readFloat32;k.writeFloat64=function(a,b){var e='undefined'===typeof b;e&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a)throw TypeError('Illegal value: '+a+' (not a number)'); -if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}b+=8;var c=this.buffer.byteLength;b>c&&this.resize((c*=2)>b?c:b);g(this.view,a,b-8,this.littleEndian,52,8);e&&(this.offset+=8);return this};k.writeDouble=k.writeFloat64;k.readFloat64=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!== -a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+8>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+8) <= '+this.buffer.byteLength);}a=c(this.view,a,this.littleEndian,52,8);b&&(this.offset+=8);return a};k.readDouble=k.readFloat64;h.MAX_VARINT32_BYTES=5;h.calculateVarint32=function(a){a>>>=0;return 128>a?1:16384>a?2:2097152>a?3:268435456>a?4:5};h.zigZagEncode32=function(a){return((a|=0)<<1^a>>31)>>>0};h.zigZagDecode32=function(a){return a>>>1^-(a& -1)|0};k.writeVarint32=function(a,b){var e='undefined'===typeof b;e&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a|=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var c=h.calculateVarint32(a);b+=c;var d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b); -b-=c;for(a>>>=0;128<=a;)d=a&127|128,this.view[b++]=d,a>>>=7;this.view[b++]=a;return e?(this.offset=b,this):c};k.writeVarint32ZigZag=function(a,b){return this.writeVarint32(h.zigZagEncode32(a),b)};k.readVarint32=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength); -}var e=0,c=0;do{if(!this.noAssert&&a>this.limit)throw a=Error('Truncated'),a.truncated=!0,a;var d=this.view[a++];5>e&&(c|=(d&127)<<7*e);++e}while(0!==(d&128));c|=0;return b?(this.offset=a,c):{value:c,length:e}};k.readVarint32ZigZag=function(a){a=this.readVarint32(a);'object'===typeof a?a.value=h.zigZagDecode32(a.value):a=h.zigZagDecode32(a);return a};a&&(h.MAX_VARINT64_BYTES=10,h.calculateVarint64=function(b){'number'===typeof b?b=a.fromNumber(b):'string'===typeof b&&(b=a.fromString(b));var e=b.toInt()>>> -0,c=b.shiftRightUnsigned(28).toInt()>>>0;b=b.shiftRightUnsigned(56).toInt()>>>0;return 0==b?0==c?16384>e?128>e?1:2:2097152>e?3:4:16384>c?128>c?5:6:2097152>c?7:8:128>b?9:10},h.zigZagEncode64=function(b){'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&&(b=b.toSigned());return b.shiftLeft(1).xor(b.shiftRight(63)).toUnsigned()},h.zigZagDecode64=function(b){'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&& -(b=b.toSigned());return b.shiftRightUnsigned(1).xor(b.and(a.ONE).toSigned().negate()).toSigned()},k.writeVarint64=function(b,c){var e='undefined'===typeof c;e&&(c=this.offset);if(!this.noAssert){if('number'===typeof b)b=a.fromNumber(b);else if('string'===typeof b)b=a.fromString(b);else if(!(b&&b instanceof a))throw TypeError('Illegal value: '+b+' (not an integer or Long)');if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ -c+' (+0) <= '+this.buffer.byteLength);}'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&&(b=b.toSigned());var d=h.calculateVarint64(b),g=b.toInt()>>>0,k=b.shiftRightUnsigned(28).toInt()>>>0;b=b.shiftRightUnsigned(56).toInt()>>>0;c+=d;var m=this.buffer.byteLength;c>m&&this.resize((m*=2)>c?m:c);c-=d;switch(d){case 10:this.view[c+9]=b>>>7&1;case 9:this.view[c+8]=9!==d?b|128:b&127;case 8:this.view[c+7]=8!==d?k>>>21|128:k>>>21&127;case 7:this.view[c+6]= -7!==d?k>>>14|128:k>>>14&127;case 6:this.view[c+5]=6!==d?k>>>7|128:k>>>7&127;case 5:this.view[c+4]=5!==d?k|128:k&127;case 4:this.view[c+3]=4!==d?g>>>21|128:g>>>21&127;case 3:this.view[c+2]=3!==d?g>>>14|128:g>>>14&127;case 2:this.view[c+1]=2!==d?g>>>7|128:g>>>7&127;case 1:this.view[c]=1!==d?g|128:g&127}return e?(this.offset+=d,this):d},k.writeVarint64ZigZag=function(a,b){return this.writeVarint64(h.zigZagEncode64(a),b)},k.readVarint64=function(b){var e='undefined'===typeof b;e&&(b=this.offset);if(!this.noAssert){if('number'!== -typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+1) <= '+this.buffer.byteLength);}var c=b,d=0,g=0;var h=this.view[b++];var k=h&127;if(h&128&&(h=this.view[b++],k|=(h&127)<<7,h&128||this.noAssert&&'undefined'===typeof h)&&(h=this.view[b++],k|=(h&127)<<14,h&128||this.noAssert&&'undefined'===typeof h)&&(h=this.view[b++],k|=(h&127)<<21,h&128||this.noAssert&&'undefined'===typeof h)&&(h=this.view[b++], -d=h&127,h&128||this.noAssert&&'undefined'===typeof h)&&(h=this.view[b++],d|=(h&127)<<7,h&128||this.noAssert&&'undefined'===typeof h)&&(h=this.view[b++],d|=(h&127)<<14,h&128||this.noAssert&&'undefined'===typeof h)&&(h=this.view[b++],d|=(h&127)<<21,h&128||this.noAssert&&'undefined'===typeof h)&&(h=this.view[b++],g=h&127,h&128||this.noAssert&&'undefined'===typeof h)&&(h=this.view[b++],g|=(h&127)<<7,h&128||this.noAssert&&'undefined'===typeof h))throw Error('Buffer overrun');k=a.fromBits(k|d<<28,d>>>4| -g<<24,!1);return e?(this.offset=b,k):{value:k,length:b-c}},k.readVarint64ZigZag=function(b){(b=this.readVarint64(b))&&b.value instanceof a?b.value=h.zigZagDecode64(b.value):b=h.zigZagDecode64(b);return b});k.writeCString=function(a,c){var e='undefined'===typeof c;e&&(c=this.offset);var d,g=a.length;if(!this.noAssert){if('string'!==typeof a)throw TypeError('Illegal str: Not a string');for(d=0;d>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}g=p.calculateUTF16asUTF8(b(a))[1];c+=g+1;d=this.buffer.byteLength;c>d&&this.resize((d*=2)>c?d:c);c-=g+1;p.encodeUTF16toUTF8(b(a),function(a){this.view[c++]=a}.bind(this));this.view[c++]=0;return e?(this.offset=c,this):g};k.readCString=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!== -typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength);}var e=a,c,g=-1;p.decodeUTF8toUTF16(function(){if(0===g)return null;if(a>=this.limit)throw RangeError('Illegal range: Truncated data, '+a+' < '+this.limit);g=this.view[a++];return 0===g?null:g}.bind(this),c=d(),!0);return b?(this.offset=a,c()):{string:c(),length:a-e}};k.writeIString=function(a,c){var e= -'undefined'===typeof c;e&&(c=this.offset);if(!this.noAssert){if('string'!==typeof a)throw TypeError('Illegal str: Not a string');if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}var d=c;var g=p.calculateUTF16asUTF8(b(a),this.noAssert)[1];c+=4+g;var h=this.buffer.byteLength;c>h&&this.resize((h*=2)>c?h:c);c-=4+g;this.littleEndian?(this.view[c+ -3]=g>>>24&255,this.view[c+2]=g>>>16&255,this.view[c+1]=g>>>8&255,this.view[c]=g&255):(this.view[c]=g>>>24&255,this.view[c+1]=g>>>16&255,this.view[c+2]=g>>>8&255,this.view[c+3]=g&255);c+=4;p.encodeUTF16toUTF8(b(a),function(a){this.view[c++]=a}.bind(this));if(c!==d+4+g)throw RangeError('Illegal range: Truncated data, '+c+' == '+(c+4+g));return e?(this.offset=c,this):c-d};k.readIString=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+ -a+' (not an integer)');a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+4) <= '+this.buffer.byteLength);}var e=a,c=this.readUint32(a);c=this.readUTF8String(c,h.METRICS_BYTES,a+=4);a+=c.length;return b?(this.offset=a,c.string):{string:c.string,length:a-e}};h.METRICS_CHARS='c';h.METRICS_BYTES='b';k.writeUTF8String=function(a,c){var e='undefined'===typeof c;e&&(c=this.offset);if(!this.noAssert){if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+ -c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}var d=c;var g=p.calculateUTF16asUTF8(b(a))[1];c+=g;var h=this.buffer.byteLength;c>h&&this.resize((h*=2)>c?h:c);c-=g;p.encodeUTF16toUTF8(b(a),function(a){this.view[c++]=a}.bind(this));return e?(this.offset=c,this):c-d};k.writeString=k.writeUTF8String;h.calculateUTF8Chars=function(a){return p.calculateUTF16asUTF8(b(a))[0]};h.calculateUTF8Bytes=function(a){return p.calculateUTF16asUTF8(b(a))[1]}; -h.calculateString=h.calculateUTF8Bytes;k.readUTF8String=function(a,b,c){'number'===typeof b&&(c=b,b=void 0);var e='undefined'===typeof c;e&&(c=this.offset);'undefined'===typeof b&&(b=h.METRICS_CHARS);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal length: '+a+' (not an integer)');a|=0;if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+ -this.buffer.byteLength);}var g=0,k=c;if(b===h.METRICS_CHARS){var m=d();p.decodeUTF8(function(){return g>>=0;if(0>c||c+a>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ -c+' (+'+a+') <= '+this.buffer.byteLength);}var n=c+a;p.decodeUTF8toUTF16(function(){return c>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}var d=c;var g=p.calculateUTF16asUTF8(b(a),this.noAssert)[1];var k=h.calculateVarint32(g);c+=k+g;var m=this.buffer.byteLength;c>m&&this.resize((m*=2)>c?m:c);c-=k+g;c+=this.writeVarint32(g,c);p.encodeUTF16toUTF8(b(a),function(a){this.view[c++]=a}.bind(this));if(c!==d+g+k)throw RangeError('Illegal range: Truncated data, '+ -c+' == '+(c+g+k));return e?(this.offset=c,this):c-d};k.readVString=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength);}var e=a,c=this.readVarint32(a);c=this.readUTF8String(c.value,h.METRICS_BYTES,a+=c.length);a+=c.length;return b?(this.offset=a,c.string):{string:c.string, -length:a-e}};k.append=function(a,b,c){if('number'===typeof b||'string'!==typeof b)c=b,b=void 0;var e='undefined'===typeof c;e&&(c=this.offset);if(!this.noAssert){if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}a instanceof h||(a=h.wrap(a,b));b=a.limit-a.offset;if(0>=b)return this;c+=b;var d=this.buffer.byteLength;c>d&&this.resize((d*=2)> -c?d:c);c-=b;this.view.set(a.view.subarray(a.offset,a.limit),c);a.offset+=b;e&&(this.offset+=b);return this};k.appendTo=function(a,b){a.append(this,b);return this};k.assert=function(a){this.noAssert=!a;return this};k.capacity=function(){return this.buffer.byteLength};k.clear=function(){this.offset=0;this.limit=this.buffer.byteLength;this.markedOffset=-1;return this};k.clone=function(a){var b=new h(0,this.littleEndian,this.noAssert);a?(b.buffer=new ArrayBuffer(this.buffer.byteLength),b.view=new Uint8Array(b.buffer)): -(b.buffer=this.buffer,b.view=this.view);b.offset=this.offset;b.markedOffset=this.markedOffset;b.limit=this.limit;return b};k.compact=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal begin: Not an integer');a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+ -b+' <= '+this.buffer.byteLength);}if(0===a&&b===this.buffer.byteLength)return this;var e=b-a;if(0===e)return this.buffer=l,this.view=null,0<=this.markedOffset&&(this.markedOffset-=a),this.limit=this.offset=0,this;var c=new ArrayBuffer(e),d=new Uint8Array(c);d.set(this.view.subarray(a,b));this.buffer=c;this.view=d;0<=this.markedOffset&&(this.markedOffset-=a);this.offset=0;this.limit=e;return this};k.copy=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);if(!this.noAssert){if('number'!== -typeof a||0!==a%1)throw TypeError('Illegal begin: Not an integer');a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+b+' <= '+this.buffer.byteLength);}if(a===b)return new h(0,this.littleEndian,this.noAssert);var e=b-a,c=new h(e,this.littleEndian,this.noAssert);c.offset=0;c.limit=e;0<=c.markedOffset&&(c.markedOffset-=a);this.copyTo(c,0,a,b);return c};k.copyTo=function(a, -b,c,d){var e,g;if(!this.noAssert&&!h.isByteBuffer(a))throw TypeError('Illegal target: Not a ByteBuffer');b=(g='undefined'===typeof b)?a.offset:b|0;c=(e='undefined'===typeof c)?this.offset:c|0;d='undefined'===typeof d?this.limit:d|0;if(0>b||b>a.buffer.byteLength)throw RangeError('Illegal target range: 0 <= '+b+' <= '+a.buffer.byteLength);if(0>c||d>this.buffer.byteLength)throw RangeError('Illegal source range: 0 <= '+c+' <= '+this.buffer.byteLength);var k=d-c;if(0===k)return a;a.ensureCapacity(b+k); -a.view.set(this.view.subarray(c,d),b);e&&(this.offset+=k);g&&(a.offset+=k);return this};k.ensureCapacity=function(a){var b=this.buffer.byteLength;return ba?b:a):this};k.fill=function(a,b,c){var e='undefined'===typeof b;e&&(b=this.offset);'string'===typeof a&&0>>=0;if('number'!==typeof c||0!==c%1)throw TypeError('Illegal end: Not an integer');c>>>=0;if(0>b||b>c||c>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+b+' <= '+c+' <= '+this.buffer.byteLength);}if(b>=c)return this;for(;b>>=0;if(0>a||a+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+0) <= '+this.buffer.byteLength);}this.markedOffset=a;return this};k.order=function(a){if(!this.noAssert&&'boolean'!==typeof a)throw TypeError('Illegal littleEndian: Not a boolean');this.littleEndian=!!a;return this};k.LE=function(a){this.littleEndian='undefined'!==typeof a?!!a:!0;return this};k.BE=function(a){this.littleEndian= -'undefined'!==typeof a?!a:!1;return this};k.prepend=function(a,b,c){if('number'===typeof b||'string'!==typeof b)c=b,b=void 0;var e='undefined'===typeof c;e&&(c=this.offset);if(!this.noAssert){if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}a instanceof h||(a=h.wrap(a,b));b=a.limit-a.offset;if(0>=b)return this;var d=b-c;if(0a)throw RangeError('Illegal capacity: 0 <= '+a);}if(this.buffer.byteLength>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+b+' <= '+this.buffer.byteLength);}if(a===b)return this;Array.prototype.reverse.call(this.view.subarray(a,b));return this}; -k.skip=function(a){if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal length: '+a+' (not an integer)');a|=0}var b=this.offset+a;if(!this.noAssert&&(0>b||b>this.buffer.byteLength))throw RangeError('Illegal length: 0 <= '+this.offset+' + '+a+' <= '+this.buffer.byteLength);this.offset=b;return this};k.slice=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal begin: Not an integer'); -a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+b+' <= '+this.buffer.byteLength);}var e=this.clone();e.offset=a;e.limit=b;return e};k.toBuffer=function(a){var b=this.offset,e=this.limit;if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: Not an integer');b>>>=0;if('number'!==typeof e||0!==e%1)throw TypeError('Illegal limit: Not an integer'); -e>>>=0;if(0>b||b>e||e>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+b+' <= '+e+' <= '+this.buffer.byteLength);}if(!a&&0===b&&e===this.buffer.byteLength)return this.buffer;if(b===e)return l;a=new ArrayBuffer(e-b);(new Uint8Array(a)).set((new Uint8Array(this.buffer)).subarray(b,e),0);return a};k.toArrayBuffer=k.toBuffer;k.toString=function(a,b,c){if('undefined'===typeof a)return'ByteBufferAB(offset='+this.offset+',markedOffset='+this.markedOffset+',limit='+this.limit+',capacity='+this.capacity()+ +3]=b&255,c+=4,this.view[c]=d>>>24&255,this.view[c+1]=d>>>16&255,this.view[c+2]=d>>>8&255,this.view[c+3]=d&255);g&&(this.offset+=8);return this},h.writeUInt64=h.writeUint64,h.readUint64=function(b){var g='undefined'===typeof b;g&&(b=this.offset);if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+8>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+8) <= '+this.buffer.byteLength);}var c=0,d=0;this.littleEndian? +(c=this.view[b+2]<<16,c|=this.view[b+1]<<8,c|=this.view[b],c+=this.view[b+3]<<24>>>0,b+=4,d=this.view[b+2]<<16,d|=this.view[b+1]<<8,d|=this.view[b],d+=this.view[b+3]<<24>>>0):(d=this.view[b+1]<<16,d|=this.view[b+2]<<8,d|=this.view[b+3],d+=this.view[b]<<24>>>0,b+=4,c=this.view[b+1]<<16,c|=this.view[b+2]<<8,c|=this.view[b+3],c+=this.view[b]<<24>>>0);b=new a(c,d,!0);g&&(this.offset+=8);return b},h.readUInt64=h.readUint64);h.writeFloat32=function(a,b){var g='undefined'===typeof b;g&&(b=this.offset);if(!this.noAssert){if('number'!== +typeof a)throw TypeError('Illegal value: '+a+' (not a number)');if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}b+=4;var d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b);c(this.view,a,b-4,this.littleEndian,23,4);g&&(this.offset+=4);return this};h.writeFloat=h.writeFloat32;h.readFloat32=function(a){var b='undefined'===typeof a;b&& +(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+4) <= '+this.buffer.byteLength);}a=d(this.view,a,this.littleEndian,23,4);b&&(this.offset+=4);return a};h.readFloat=h.readFloat32;h.writeFloat64=function(a,b){var g='undefined'===typeof b;g&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a)throw TypeError('Illegal value: '+a+' (not a number)'); +if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}b+=8;var d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b);c(this.view,a,b-8,this.littleEndian,52,8);g&&(this.offset+=8);return this};h.writeDouble=h.writeFloat64;h.readFloat64=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!== +a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+8>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+8) <= '+this.buffer.byteLength);}a=d(this.view,a,this.littleEndian,52,8);b&&(this.offset+=8);return a};h.readDouble=h.readFloat64;k.MAX_VARINT32_BYTES=5;k.calculateVarint32=function(a){a>>>=0;return 128>a?1:16384>a?2:2097152>a?3:268435456>a?4:5};k.zigZagEncode32=function(a){return((a|=0)<<1^a>>31)>>>0};k.zigZagDecode32=function(a){return a>>>1^-(a& +1)|0};h.writeVarint32=function(a,b){var g='undefined'===typeof b;g&&(b=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal value: '+a+' (not an integer)');a|=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+0) <= '+this.buffer.byteLength);}var c=k.calculateVarint32(a);b+=c;var d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b); +b-=c;for(a>>>=0;128<=a;)d=a&127|128,this.view[b++]=d,a>>>=7;this.view[b++]=a;return g?(this.offset=b,this):c};h.writeVarint32ZigZag=function(a,b){return this.writeVarint32(k.zigZagEncode32(a),b)};h.readVarint32=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength); +}var g=0,c=0;do{if(!this.noAssert&&a>this.limit)throw a=Error('Truncated'),a.truncated=!0,a;var d=this.view[a++];5>g&&(c|=(d&127)<<7*g);++g}while(0!==(d&128));c|=0;return b?(this.offset=a,c):{value:c,length:g}};h.readVarint32ZigZag=function(a){a=this.readVarint32(a);'object'===typeof a?a.value=k.zigZagDecode32(a.value):a=k.zigZagDecode32(a);return a};a&&(k.MAX_VARINT64_BYTES=10,k.calculateVarint64=function(b){'number'===typeof b?b=a.fromNumber(b):'string'===typeof b&&(b=a.fromString(b));var g=b.toInt()>>> +0,c=b.shiftRightUnsigned(28).toInt()>>>0;b=b.shiftRightUnsigned(56).toInt()>>>0;return 0==b?0==c?16384>g?128>g?1:2:2097152>g?3:4:16384>c?128>c?5:6:2097152>c?7:8:128>b?9:10},k.zigZagEncode64=function(b){'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&&(b=b.toSigned());return b.shiftLeft(1).xor(b.shiftRight(63)).toUnsigned()},k.zigZagDecode64=function(b){'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&& +(b=b.toSigned());return b.shiftRightUnsigned(1).xor(b.and(a.ONE).toSigned().negate()).toSigned()},h.writeVarint64=function(b,c){var g='undefined'===typeof c;g&&(c=this.offset);if(!this.noAssert){if('number'===typeof b)b=a.fromNumber(b);else if('string'===typeof b)b=a.fromString(b);else if(!(b&&b instanceof a))throw TypeError('Illegal value: '+b+' (not an integer or Long)');if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ +c+' (+0) <= '+this.buffer.byteLength);}'number'===typeof b?b=a.fromNumber(b,!1):'string'===typeof b?b=a.fromString(b,!1):!1!==b.unsigned&&(b=b.toSigned());var d=k.calculateVarint64(b),e=b.toInt()>>>0,h=b.shiftRightUnsigned(28).toInt()>>>0;b=b.shiftRightUnsigned(56).toInt()>>>0;c+=d;var m=this.buffer.byteLength;c>m&&this.resize((m*=2)>c?m:c);c-=d;switch(d){case 10:this.view[c+9]=b>>>7&1;case 9:this.view[c+8]=9!==d?b|128:b&127;case 8:this.view[c+7]=8!==d?h>>>21|128:h>>>21&127;case 7:this.view[c+6]= +7!==d?h>>>14|128:h>>>14&127;case 6:this.view[c+5]=6!==d?h>>>7|128:h>>>7&127;case 5:this.view[c+4]=5!==d?h|128:h&127;case 4:this.view[c+3]=4!==d?e>>>21|128:e>>>21&127;case 3:this.view[c+2]=3!==d?e>>>14|128:e>>>14&127;case 2:this.view[c+1]=2!==d?e>>>7|128:e>>>7&127;case 1:this.view[c]=1!==d?e|128:e&127}return g?(this.offset+=d,this):d},h.writeVarint64ZigZag=function(a,b){return this.writeVarint64(k.zigZagEncode64(a),b)},h.readVarint64=function(b){var g='undefined'===typeof b;g&&(b=this.offset);if(!this.noAssert){if('number'!== +typeof b||0!==b%1)throw TypeError('Illegal offset: '+b+' (not an integer)');b>>>=0;if(0>b||b+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+b+' (+1) <= '+this.buffer.byteLength);}var c=b,d=0,e=0;var h=this.view[b++];var k=h&127;if(h&128&&(h=this.view[b++],k|=(h&127)<<7,h&128||this.noAssert&&'undefined'===typeof h)&&(h=this.view[b++],k|=(h&127)<<14,h&128||this.noAssert&&'undefined'===typeof h)&&(h=this.view[b++],k|=(h&127)<<21,h&128||this.noAssert&&'undefined'===typeof h)&&(h=this.view[b++], +d=h&127,h&128||this.noAssert&&'undefined'===typeof h)&&(h=this.view[b++],d|=(h&127)<<7,h&128||this.noAssert&&'undefined'===typeof h)&&(h=this.view[b++],d|=(h&127)<<14,h&128||this.noAssert&&'undefined'===typeof h)&&(h=this.view[b++],d|=(h&127)<<21,h&128||this.noAssert&&'undefined'===typeof h)&&(h=this.view[b++],e=h&127,h&128||this.noAssert&&'undefined'===typeof h)&&(h=this.view[b++],e|=(h&127)<<7,h&128||this.noAssert&&'undefined'===typeof h))throw Error('Buffer overrun');k=a.fromBits(k|d<<28,d>>>4| +e<<24,!1);return g?(this.offset=b,k):{value:k,length:b-c}},h.readVarint64ZigZag=function(b){(b=this.readVarint64(b))&&b.value instanceof a?b.value=k.zigZagDecode64(b.value):b=k.zigZagDecode64(b);return b});h.writeCString=function(a,c){var g='undefined'===typeof c;g&&(c=this.offset);var d,e=a.length;if(!this.noAssert){if('string'!==typeof a)throw TypeError('Illegal str: Not a string');for(d=0;d>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}e=m.calculateUTF16asUTF8(b(a))[1];c+=e+1;d=this.buffer.byteLength;c>d&&this.resize((d*=2)>c?d:c);c-=e+1;m.encodeUTF16toUTF8(b(a),function(a){this.view[c++]=a}.bind(this));this.view[c++]=0;return g?(this.offset=c,this):e};h.readCString=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!== +typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength);}var g=a,c,d=-1;m.decodeUTF8toUTF16(function(){if(0===d)return null;if(a>=this.limit)throw RangeError('Illegal range: Truncated data, '+a+' < '+this.limit);d=this.view[a++];return 0===d?null:d}.bind(this),c=e(),!0);return b?(this.offset=a,c()):{string:c(),length:a-g}};h.writeIString=function(a,c){var g= +'undefined'===typeof c;g&&(c=this.offset);if(!this.noAssert){if('string'!==typeof a)throw TypeError('Illegal str: Not a string');if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}var d=c;var e=m.calculateUTF16asUTF8(b(a),this.noAssert)[1];c+=4+e;var h=this.buffer.byteLength;c>h&&this.resize((h*=2)>c?h:c);c-=4+e;this.littleEndian?(this.view[c+ +3]=e>>>24&255,this.view[c+2]=e>>>16&255,this.view[c+1]=e>>>8&255,this.view[c]=e&255):(this.view[c]=e>>>24&255,this.view[c+1]=e>>>16&255,this.view[c+2]=e>>>8&255,this.view[c+3]=e&255);c+=4;m.encodeUTF16toUTF8(b(a),function(a){this.view[c++]=a}.bind(this));if(c!==d+4+e)throw RangeError('Illegal range: Truncated data, '+c+' == '+(c+4+e));return g?(this.offset=c,this):c-d};h.readIString=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+ +a+' (not an integer)');a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+4) <= '+this.buffer.byteLength);}var g=a,c=this.readUint32(a);c=this.readUTF8String(c,k.METRICS_BYTES,a+=4);a+=c.length;return b?(this.offset=a,c.string):{string:c.string,length:a-g}};k.METRICS_CHARS='c';k.METRICS_BYTES='b';h.writeUTF8String=function(a,c){var g='undefined'===typeof c;g&&(c=this.offset);if(!this.noAssert){if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+ +c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}var d=c;var e=m.calculateUTF16asUTF8(b(a))[1];c+=e;var h=this.buffer.byteLength;c>h&&this.resize((h*=2)>c?h:c);c-=e;m.encodeUTF16toUTF8(b(a),function(a){this.view[c++]=a}.bind(this));return g?(this.offset=c,this):c-d};h.writeString=h.writeUTF8String;k.calculateUTF8Chars=function(a){return m.calculateUTF16asUTF8(b(a))[0]};k.calculateUTF8Bytes=function(a){return m.calculateUTF16asUTF8(b(a))[1]}; +k.calculateString=k.calculateUTF8Bytes;h.readUTF8String=function(a,b,c){'number'===typeof b&&(c=b,b=void 0);var g='undefined'===typeof c;g&&(c=this.offset);'undefined'===typeof b&&(b=k.METRICS_CHARS);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal length: '+a+' (not an integer)');a|=0;if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+ +this.buffer.byteLength);}var d=0,h=c;if(b===k.METRICS_CHARS){var p=e();m.decodeUTF8(function(){return d>>=0;if(0>c||c+a>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+ +c+' (+'+a+') <= '+this.buffer.byteLength);}var l=c+a;m.decodeUTF8toUTF16(function(){return c>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}var d=c;var e=m.calculateUTF16asUTF8(b(a),this.noAssert)[1];var h=k.calculateVarint32(e);c+=h+e;var p=this.buffer.byteLength;c>p&&this.resize((p*=2)>c?p:c);c-=h+e;c+=this.writeVarint32(e,c);m.encodeUTF16toUTF8(b(a),function(a){this.view[c++]=a}.bind(this));if(c!==d+e+h)throw RangeError('Illegal range: Truncated data, '+ +c+' == '+(c+e+h));return g?(this.offset=c,this):c-d};h.readVString=function(a){var b='undefined'===typeof a;b&&(a=this.offset);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal offset: '+a+' (not an integer)');a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+1) <= '+this.buffer.byteLength);}var g=a,c=this.readVarint32(a);c=this.readUTF8String(c.value,k.METRICS_BYTES,a+=c.length);a+=c.length;return b?(this.offset=a,c.string):{string:c.string, +length:a-g}};h.append=function(a,b,c){if('number'===typeof b||'string'!==typeof b)c=b,b=void 0;var g='undefined'===typeof c;g&&(c=this.offset);if(!this.noAssert){if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}a instanceof k||(a=k.wrap(a,b));b=a.limit-a.offset;if(0>=b)return this;c+=b;var d=this.buffer.byteLength;c>d&&this.resize((d*=2)> +c?d:c);c-=b;this.view.set(a.view.subarray(a.offset,a.limit),c);a.offset+=b;g&&(this.offset+=b);return this};h.appendTo=function(a,b){a.append(this,b);return this};h.assert=function(a){this.noAssert=!a;return this};h.capacity=function(){return this.buffer.byteLength};h.clear=function(){this.offset=0;this.limit=this.buffer.byteLength;this.markedOffset=-1;return this};h.clone=function(a){var b=new k(0,this.littleEndian,this.noAssert);a?(b.buffer=new ArrayBuffer(this.buffer.byteLength),b.view=new Uint8Array(b.buffer)): +(b.buffer=this.buffer,b.view=this.view);b.offset=this.offset;b.markedOffset=this.markedOffset;b.limit=this.limit;return b};h.compact=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal begin: Not an integer');a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+ +b+' <= '+this.buffer.byteLength);}if(0===a&&b===this.buffer.byteLength)return this;var g=b-a;if(0===g)return this.buffer=l,this.view=null,0<=this.markedOffset&&(this.markedOffset-=a),this.limit=this.offset=0,this;var c=new ArrayBuffer(g),d=new Uint8Array(c);d.set(this.view.subarray(a,b));this.buffer=c;this.view=d;0<=this.markedOffset&&(this.markedOffset-=a);this.offset=0;this.limit=g;return this};h.copy=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);if(!this.noAssert){if('number'!== +typeof a||0!==a%1)throw TypeError('Illegal begin: Not an integer');a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+b+' <= '+this.buffer.byteLength);}if(a===b)return new k(0,this.littleEndian,this.noAssert);var g=b-a,c=new k(g,this.littleEndian,this.noAssert);c.offset=0;c.limit=g;0<=c.markedOffset&&(c.markedOffset-=a);this.copyTo(c,0,a,b);return c};h.copyTo=function(a, +b,c,d){var g,e;if(!this.noAssert&&!k.isByteBuffer(a))throw TypeError('Illegal target: Not a ByteBuffer');b=(e='undefined'===typeof b)?a.offset:b|0;c=(g='undefined'===typeof c)?this.offset:c|0;d='undefined'===typeof d?this.limit:d|0;if(0>b||b>a.buffer.byteLength)throw RangeError('Illegal target range: 0 <= '+b+' <= '+a.buffer.byteLength);if(0>c||d>this.buffer.byteLength)throw RangeError('Illegal source range: 0 <= '+c+' <= '+this.buffer.byteLength);var h=d-c;if(0===h)return a;a.ensureCapacity(b+h); +a.view.set(this.view.subarray(c,d),b);g&&(this.offset+=h);e&&(a.offset+=h);return this};h.ensureCapacity=function(a){var b=this.buffer.byteLength;return ba?b:a):this};h.fill=function(a,b,c){var g='undefined'===typeof b;g&&(b=this.offset);'string'===typeof a&&0>>=0;if('number'!==typeof c||0!==c%1)throw TypeError('Illegal end: Not an integer');c>>>=0;if(0>b||b>c||c>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+b+' <= '+c+' <= '+this.buffer.byteLength);}if(b>=c)return this;for(;b>>=0;if(0>a||a+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+a+' (+0) <= '+this.buffer.byteLength);}this.markedOffset=a;return this};h.order=function(a){if(!this.noAssert&&'boolean'!==typeof a)throw TypeError('Illegal littleEndian: Not a boolean');this.littleEndian=!!a;return this};h.LE=function(a){this.littleEndian='undefined'!==typeof a?!!a:!0;return this};h.BE=function(a){this.littleEndian= +'undefined'!==typeof a?!a:!1;return this};h.prepend=function(a,b,c){if('number'===typeof b||'string'!==typeof b)c=b,b=void 0;var g='undefined'===typeof c;g&&(c=this.offset);if(!this.noAssert){if('number'!==typeof c||0!==c%1)throw TypeError('Illegal offset: '+c+' (not an integer)');c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError('Illegal offset: 0 <= '+c+' (+0) <= '+this.buffer.byteLength);}a instanceof k||(a=k.wrap(a,b));b=a.limit-a.offset;if(0>=b)return this;var d=b-c;if(0a)throw RangeError('Illegal capacity: 0 <= '+a);}if(this.buffer.byteLength>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+b+' <= '+this.buffer.byteLength);}if(a===b)return this;Array.prototype.reverse.call(this.view.subarray(a,b));return this}; +h.skip=function(a){if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal length: '+a+' (not an integer)');a|=0}var b=this.offset+a;if(!this.noAssert&&(0>b||b>this.buffer.byteLength))throw RangeError('Illegal length: 0 <= '+this.offset+' + '+a+' <= '+this.buffer.byteLength);this.offset=b;return this};h.slice=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal begin: Not an integer'); +a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+b+' <= '+this.buffer.byteLength);}var g=this.clone();g.offset=a;g.limit=b;return g};h.toBuffer=function(a){var b=this.offset,g=this.limit;if(!this.noAssert){if('number'!==typeof b||0!==b%1)throw TypeError('Illegal offset: Not an integer');b>>>=0;if('number'!==typeof g||0!==g%1)throw TypeError('Illegal limit: Not an integer'); +g>>>=0;if(0>b||b>g||g>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+b+' <= '+g+' <= '+this.buffer.byteLength);}if(!a&&0===b&&g===this.buffer.byteLength)return this.buffer;if(b===g)return l;a=new ArrayBuffer(g-b);(new Uint8Array(a)).set((new Uint8Array(this.buffer)).subarray(b,g),0);return a};h.toArrayBuffer=h.toBuffer;h.toString=function(a,b,c){if('undefined'===typeof a)return'ByteBufferAB(offset='+this.offset+',markedOffset='+this.markedOffset+',limit='+this.limit+',capacity='+this.capacity()+ ')';'number'===typeof a&&(c=b=a='utf8');switch(a){case 'utf8':return this.toUTF8(b,c);case 'base64':return this.toBase64(b,c);case 'hex':return this.toHex(b,c);case 'binary':return this.toBinary(b,c);case 'debug':return this.toDebug();case 'columns':return this.toColumns();default:throw Error('Unsupported encoding: '+a);}};var q=function(){for(var a={},b=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113, -114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],c=[],d=0,g=b.length;d>2&63]),d=(c&3)<<4,null!==(c=a())?(d|=c>>4&15,e(b[(d|c>>4&15)&63]),d=(c&15)<<2,null!==(c=a())?(e(b[(d|c>>6&3)&63]),e(b[c&63])):(e(b[d&63]),e(61))):(e(b[d&63]),e(61),e(61))};a.decode=function(a,b){function e(a){throw Error('Illegal character code: '+a);}for(var d,g,h;null!==(d=a());)if(g=c[d],'undefined'===typeof g&&e(d),null!==(d=a())&& -(h=c[d],'undefined'===typeof h&&e(d),b(g<<2>>>0|(h&48)>>4),null!==(d=a()))){g=c[d];if('undefined'===typeof g)if(61===d)break;else e(d);b((h&15)<<4>>>0|(g&60)>>2);if(null!==(d=a())){h=c[d];if('undefined'===typeof h)if(61===d)break;else e(d);b((g&3)<<6>>>0|h)}}};a.test=function(a){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(a)};return a}();k.toBase64=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);a|=0;b|=0;if(0>a||b>this.capacity|| -a>b)throw RangeError('begin, end');var e;q.encode(function(){return aa||b>this.capacity()||a>b)throw RangeError('begin, end');if(a===b)return'';for(var e=[],c=[];ac?d+('0'+c.toString(16).toUpperCase()):d+c.toString(16).toUpperCase(),a&&(g+=32c?String.fromCharCode(c):'.'));++b;if(a&&0d.length;)d+=' ';h+=d+g+'\n';d=g=''}d=b===this.offset&&b===this.limit?d+(b===this.markedOffset?'!':'|'):b===this.offset?d+(b===this.markedOffset?'[':'<'):b===this.limit?d+(b===this.markedOffset?']':'>'):d+(b===this.markedOffset?"'":a||0!==b&&b!==e?' ':'')}if(a&&' '!== -d){for(;51>d.length;)d+=' ';h+=d+g+'\n'}return a?h:d};h.fromDebug=function(a,b,c){var e=a.length;b=new h((e+1)/3|0,b,c);for(var d=0,g=0,k,m=!1,l=!1,p=!1,n=!1,q=!1;d':if(!c){if(n){q=!0;break}n=!0}b.limit=g;m=!1;break;case "'":if(!c){if(p){q=!0;break}p=!0}b.markedOffset=g;m=!1;break;case ' ':m=!1;break;default:if(!c&&m)q=!0;else{k=parseInt(k+a.charAt(d++),16);if(!c&&(isNaN(k)||0>k||255>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+b+' <= '+ -this.buffer.byteLength);}for(var e=Array(b-a),c;ac?e.push('0',c.toString(16)):e.push(c.toString(16));return e.join('')};h.fromHex=function(a,b,c){if(!c){if('string'!==typeof a)throw TypeError('Illegal str: Not a string');if(0!==a.length%2)throw TypeError('Illegal str: Length not a multiple of 2');}var e=a.length;b=new h(e/2|0,b);for(var d,g=0,k=0;gd||255e?b(e&127):(2048>e?b(e>>6&31|192):(65536>e?b(e>>12&15|224):(b(e>>18&7|240),b(e>>12&63|128)),b(e>>6&63|128)),b(e&63|128)),e=null},decodeUTF8:function(a,b){for(var e,c,d,g,h=function(a){a=a.slice(0,a.indexOf(null));var b=Error(a.toString());b.name='TruncatedError';b.bytes=a;throw b;};null!==(e=a());)if(0=== -(e&128))b(e);else if(192===(e&224))null===(c=a())&&h([e,c]),b((e&31)<<6|c&63);else if(224===(e&240))null!==(c=a())&&null!==(d=a())||h([e,c,d]),b((e&15)<<12|(c&63)<<6|d&63);else if(240===(e&248))null!==(c=a())&&null!==(d=a())&&null!==(g=a())||h([e,c,d,g]),b((e&7)<<18|(c&63)<<12|(d&63)<<6|g&63);else throw RangeError('Illegal starting byte: '+e);},UTF16toUTF8:function(a,b){for(var e,c=null;null!==(e=null!==c?c:a());)55296<=e&&57343>=e&&null!==(c=a())&&56320<=c&&57343>=c?(b(1024*(e-55296)+c-56320+65536), -c=null):b(e);null!==c&&b(c)},UTF8toUTF16:function(a,b){var e=null;for('number'===typeof a&&(e=a,a=function(){return null});null!==e||null!==(e=a());)65535>=e?b(e):(e-=65536,b((e>>10)+55296),b(e%1024+56320)),e=null},encodeUTF16toUTF8:function(b,e){a.UTF16toUTF8(b,function(b){a.encodeUTF8(b,e)})},decodeUTF8toUTF16:function(b,e){a.decodeUTF8(b,function(b){a.UTF8toUTF16(b,e)})},calculateCodePoint:function(a){return 128>a?1:2048>a?2:65536>a?3:4},calculateUTF8:function(a){for(var b,e=0;null!==(b=a());)e+= -128>b?1:2048>b?2:65536>b?3:4;return e},calculateUTF16asUTF8:function(b){var e=0,c=0;a.UTF16toUTF8(b,function(a){++e;c+=128>a?1:2048>a?2:65536>a?3:4});return[e,c]}};return a}();k.toUTF8=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal begin: Not an integer');a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+ -a+' <= '+b+' <= '+this.buffer.byteLength);}var e;try{p.decodeUTF8toUTF16(function(){return a>>=0;if(e=0<=a&&256>a)if(b=m[a])return b;b=g(a,0>(a|0)?-1:0,!0);e&&(m[a]=b)}else{a|=0;if(e=-128<=a&&128>a)if(b=l[a])return b;b=g(a,0>a?-1:0,!1);e&&(l[a]= -b)}return b}function c(a,b){if(isNaN(a)||!isFinite(a))return b?t:r;if(b){if(0>a)return t;if(a>=p)return z}else{if(a<=-e)return G;if(a+1>=e)return v}return 0>a?c(-a,b).neg():g(a%4294967296|0,a/4294967296|0,b)}function g(b,e,c){return new a(b,e,c)}function h(a,b,e){if(0===a.length)throw Error('empty string');if('NaN'===a||'Infinity'===a||'+Infinity'===a||'-Infinity'===a)return r;'number'===typeof b?(e=b,b=!1):b=!!b;e=e||10;if(2>e||36m?(m=c(q(e,m)),g=g.mul(m).add(c(l))):(g=g.mul(d),g=g.add(c(l)))}g.unsigned=b;return g}function k(b){return b instanceof a?b:'number'===typeof b?c(b):'string'===typeof b?h(b):g(b.low,b.high,b.unsigned)}Object.defineProperty(a.prototype,'__isLong__',{value:!0,enumerable:!1,configurable:!1});a.isLong=b;var l={},m={};a.fromInt=d;a.fromNumber=c;a.fromBits= -g;var q=Math.pow;a.fromString=h;a.fromValue=k;var p=4294967296*4294967296,e=p/2,n=d(16777216),r=d(0);a.ZERO=r;var t=d(0,!0);a.UZERO=t;var D=d(1);a.ONE=D;var w=d(1,!0);a.UONE=w;var u=d(-1);a.NEG_ONE=u;var v=g(-1,2147483647,!1);a.MAX_VALUE=v;var z=g(-1,-1,!0);a.MAX_UNSIGNED_VALUE=z;var G=g(0,-2147483648,!1);a.MIN_VALUE=G;var I=a.prototype;I.toInt=function(){return this.unsigned?this.low>>>0:this.low};I.toNumber=function(){return this.unsigned?4294967296*(this.high>>>0)+(this.low>>>0):4294967296*this.high+ -(this.low>>>0)};I.toString=function(a){a=a||10;if(2>a||36>>0).toString(a);b=g;if(b.isZero())return h+d;for(;6>h.length;)h='0'+h;d=''+h+d}};I.getHighBits=function(){return this.high};I.getHighBitsUnsigned= -function(){return this.high>>>0};I.getLowBits=function(){return this.low};I.getLowBitsUnsigned=function(){return this.low>>>0};I.getNumBitsAbs=function(){if(this.isNegative())return this.eq(G)?64:this.neg().getNumBitsAbs();for(var a=0!=this.high?this.high:this.low,b=31;0this.high};I.isPositive=function(){return this.unsigned||0<=this.high};I.isOdd= -function(){return 1===(this.low&1)};I.isEven=function(){return 0===(this.low&1)};I.equals=function(a){b(a)||(a=k(a));return this.unsigned!==a.unsigned&&1===this.high>>>31&&1===a.high>>>31?!1:this.high===a.high&&this.low===a.low};I.eq=I.equals;I.notEquals=function(a){return!this.eq(a)};I.neq=I.notEquals;I.lessThan=function(a){return 0>this.comp(a)};I.lt=I.lessThan;I.lessThanOrEqual=function(a){return 0>=this.comp(a)};I.lte=I.lessThanOrEqual;I.greaterThan=function(a){return 0>>0>this.high>>>0||a.high===this.high&&a.low>>>0>this.low>>>0?-1:1:this.sub(a).isNegative()?-1:1};I.comp=I.compare;I.negate=function(){return!this.unsigned&&this.eq(G)?G:this.not().add(D)};I.neg=I.negate;I.add=function(a){b(a)||(a=k(a));var e=this.high>>>16,c=this.high&65535, -d=this.low>>>16,h=a.high>>>16,m=a.high&65535,l=a.low>>>16;var p=(this.low&65535)+(a.low&65535);a=(p>>>16)+(d+l);d=(a>>>16)+(c+m);c=(d>>>16)+(e+h)&65535;return g((a&65535)<<16|p&65535,c<<16|d&65535,this.unsigned)};I.subtract=function(a){b(a)||(a=k(a));return this.add(a.neg())};I.sub=I.subtract;I.multiply=function(a){if(this.isZero())return r;b(a)||(a=k(a));if(a.isZero())return r;if(this.eq(G))return a.isOdd()?G:r;if(a.eq(G))return this.isOdd()?G:r;if(this.isNegative())return a.isNegative()?this.neg().mul(a.neg()): -this.neg().mul(a).neg();if(a.isNegative())return this.mul(a.neg()).neg();if(this.lt(n)&&a.lt(n))return c(this.toNumber()*a.toNumber(),this.unsigned);var e=this.high>>>16,d=this.high&65535,h=this.low>>>16,m=this.low&65535,l=a.high>>>16,p=a.high&65535,q=a.low>>>16;a=a.low&65535;var u=m*a;var v=(u>>>16)+h*a;var t=v>>>16;v=(v&65535)+m*q;t+=v>>>16;t+=d*a;var z=t>>>16;t=(t&65535)+h*q;z+=t>>>16;t=(t&65535)+m*p;return g((v&65535)<<16|u&65535,(z+(t>>>16)+(e*a+d*q+h*p+m*l)&65535)<<16|t&65535,this.unsigned)}; -I.mul=I.multiply;I.divide=function(a){b(a)||(a=k(a));if(a.isZero())throw Error('division by zero');if(this.isZero())return this.unsigned?t:r;if(this.unsigned){a.unsigned||(a=a.toUnsigned());if(a.gt(this))return t;if(a.gt(this.shru(1)))return w;var e=t}else{if(this.eq(G)){if(a.eq(D)||a.eq(u))return G;if(a.eq(G))return D;var d=this.shr(1).div(a).shl(1);if(d.eq(r))return a.isNegative()?D:u;var g=this.sub(a.mul(d));return d.add(g.div(a))}if(a.eq(G))return this.unsigned?t:r;if(this.isNegative())return a.isNegative()? -this.neg().div(a.neg()):this.neg().div(a).neg();if(a.isNegative())return this.div(a.neg()).neg();e=r}for(g=this;g.gte(a);){d=Math.max(1,Math.floor(g.toNumber()/a.toNumber()));var h=Math.ceil(Math.log(d)/Math.LN2);h=48>=h?1:q(2,h-48);for(var m=c(d),l=m.mul(a);l.isNegative()||l.gt(g);)d-=h,m=c(d,this.unsigned),l=m.mul(a);m.isZero()&&(m=D);e=e.add(m);g=g.sub(l)}return e};I.div=I.divide;I.modulo=function(a){b(a)||(a=k(a));return this.sub(this.div(a).mul(a))};I.mod=I.modulo;I.not=function(){return g(~this.low, -~this.high,this.unsigned)};I.and=function(a){b(a)||(a=k(a));return g(this.low&a.low,this.high&a.high,this.unsigned)};I.or=function(a){b(a)||(a=k(a));return g(this.low|a.low,this.high|a.high,this.unsigned)};I.xor=function(a){b(a)||(a=k(a));return g(this.low^a.low,this.high^a.high,this.unsigned)};I.shiftLeft=function(a){b(a)&&(a=a.toInt());return 0===(a&=63)?this:32>a?g(this.low<>>32-a,this.unsigned):g(0,this.low<a?g(this.low>>>a|this.high<<32-a,this.high>>a,this.unsigned):g(this.high>>a-32,0<=this.high?0:-1,this.unsigned)};I.shr=I.shiftRight;I.shiftRightUnsigned=function(a){b(a)&&(a=a.toInt());a&=63;if(0===a)return this;var e=this.high;return 32>a?g(this.low>>>a|e<<32-a,e>>>a,this.unsigned):32===a?g(e,0,this.unsigned):g(e>>>a-32,0,this.unsigned)};I.shru=I.shiftRightUnsigned;I.toSigned=function(){return this.unsigned?g(this.low,this.high,!1):this};I.toUnsigned=function(){return this.unsigned? -this:g(this.low,this.high,!0)};I.toBytes=function(a){return a?this.toBytesLE():this.toBytesBE()};I.toBytesLE=function(){var a=this.high,b=this.low;return[b&255,b>>>8&255,b>>>16&255,b>>>24&255,a&255,a>>>8&255,a>>>16&255,a>>>24&255]};I.toBytesBE=function(){var a=this.high,b=this.low;return[a>>>24&255,a>>>16&255,a>>>8&255,a&255,b>>>24&255,b>>>16&255,b>>>8&255,b&255]};return a}); -(function(a){function b(a){if(!a)throw Error('PSON requires ByteBuffer.js: Get it at https://github.com/dcodeIO/ByteBuffer.js');var b={T:{ZERO:0,MAX:239,NULL:240,TRUE:241,FALSE:242,EOBJECT:243,EARRAY:244,ESTRING:245,OBJECT:246,ARRAY:247,INTEGER:248,LONG:249,FLOAT:250,DOUBLE:251,STRING:252,STRING_ADD:253,STRING_GET:254,BINARY:255}};b.Encoder=function(a,b){var c=new a(4);c.length=4;var d=a.Long,g=function(a,b,e){this.dict={};this.next=0;if(a&&Array.isArray(a))for(;this.next>2&63]),d=(c&3)<<4,null!==(c=a())?(d|=c>>4&15,g(b[(d|c>>4&15)&63]),d=(c&15)<<2,null!==(c=a())?(g(b[(d|c>>6&3)&63]),g(b[c&63])):(g(b[d&63]),g(61))):(g(b[d&63]),g(61),g(61))};a.decode=function(a,b){function g(a){throw Error('Illegal character code: '+a);}for(var d,e,h;null!==(d=a());)if(e=c[d],'undefined'===typeof e&&g(d),null!==(d=a())&& +(h=c[d],'undefined'===typeof h&&g(d),b(e<<2>>>0|(h&48)>>4),null!==(d=a()))){e=c[d];if('undefined'===typeof e)if(61===d)break;else g(d);b((h&15)<<4>>>0|(e&60)>>2);if(null!==(d=a())){h=c[d];if('undefined'===typeof h)if(61===d)break;else g(d);b((e&3)<<6>>>0|h)}}};a.test=function(a){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(a)};return a}();h.toBase64=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);a|=0;b|=0;if(0>a||b>this.capacity|| +a>b)throw RangeError('begin, end');var g;q.encode(function(){return aa||b>this.capacity()||a>b)throw RangeError('begin, end');if(a===b)return'';for(var g=[],c=[];ac?d+('0'+c.toString(16).toUpperCase()):d+c.toString(16).toUpperCase(),a&&(e+=32c?String.fromCharCode(c):'.'));++b;if(a&&0d.length;)d+=' ';h+=d+e+'\n';d=e=''}d=b===this.offset&&b===this.limit?d+(b===this.markedOffset?'!':'|'):b===this.offset?d+(b===this.markedOffset?'[':'<'):b===this.limit?d+(b===this.markedOffset?']':'>'):d+(b===this.markedOffset?"'":a||0!==b&&b!==g?' ':'')}if(a&&' '!== +d){for(;51>d.length;)d+=' ';h+=d+e+'\n'}return a?h:d};k.fromDebug=function(a,b,c){var g=a.length;b=new k((g+1)/3|0,b,c);for(var d=0,e=0,h,m=!1,l=!1,p=!1,n=!1,q=!1;d':if(!c){if(n){q=!0;break}n=!0}b.limit=e;m=!1;break;case "'":if(!c){if(p){q=!0;break}p=!0}b.markedOffset=e;m=!1;break;case ' ':m=!1;break;default:if(!c&&m)q=!0;else{h=parseInt(h+a.charAt(d++),16);if(!c&&(isNaN(h)||0>h||255>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+a+' <= '+b+' <= '+ +this.buffer.byteLength);}for(var g=Array(b-a),c;ac?g.push('0',c.toString(16)):g.push(c.toString(16));return g.join('')};k.fromHex=function(a,b,c){if(!c){if('string'!==typeof a)throw TypeError('Illegal str: Not a string');if(0!==a.length%2)throw TypeError('Illegal str: Length not a multiple of 2');}var g=a.length;b=new k(g/2|0,b);for(var d,e=0,h=0;ed||255g?b(g&127):(2048>g?b(g>>6&31|192):(65536>g?b(g>>12&15|224):(b(g>>18&7|240),b(g>>12&63|128)),b(g>>6&63|128)),b(g&63|128)),g=null},decodeUTF8:function(a,b){for(var g,c,d,e,h=function(a){a=a.slice(0,a.indexOf(null));var b=Error(a.toString());b.name='TruncatedError';b.bytes=a;throw b;};null!==(g=a());)if(0=== +(g&128))b(g);else if(192===(g&224))null===(c=a())&&h([g,c]),b((g&31)<<6|c&63);else if(224===(g&240))null!==(c=a())&&null!==(d=a())||h([g,c,d]),b((g&15)<<12|(c&63)<<6|d&63);else if(240===(g&248))null!==(c=a())&&null!==(d=a())&&null!==(e=a())||h([g,c,d,e]),b((g&7)<<18|(c&63)<<12|(d&63)<<6|e&63);else throw RangeError('Illegal starting byte: '+g);},UTF16toUTF8:function(a,b){for(var g,c=null;null!==(g=null!==c?c:a());)55296<=g&&57343>=g&&null!==(c=a())&&56320<=c&&57343>=c?(b(1024*(g-55296)+c-56320+65536), +c=null):b(g);null!==c&&b(c)},UTF8toUTF16:function(a,b){var g=null;for('number'===typeof a&&(g=a,a=function(){return null});null!==g||null!==(g=a());)65535>=g?b(g):(g-=65536,b((g>>10)+55296),b(g%1024+56320)),g=null},encodeUTF16toUTF8:function(b,g){a.UTF16toUTF8(b,function(b){a.encodeUTF8(b,g)})},decodeUTF8toUTF16:function(b,g){a.decodeUTF8(b,function(b){a.UTF8toUTF16(b,g)})},calculateCodePoint:function(a){return 128>a?1:2048>a?2:65536>a?3:4},calculateUTF8:function(a){for(var b,g=0;null!==(b=a());)g+= +128>b?1:2048>b?2:65536>b?3:4;return g},calculateUTF16asUTF8:function(b){var g=0,c=0;a.UTF16toUTF8(b,function(a){++g;c+=128>a?1:2048>a?2:65536>a?3:4});return[g,c]}};return a}();h.toUTF8=function(a,b){'undefined'===typeof a&&(a=this.offset);'undefined'===typeof b&&(b=this.limit);if(!this.noAssert){if('number'!==typeof a||0!==a%1)throw TypeError('Illegal begin: Not an integer');a>>>=0;if('number'!==typeof b||0!==b%1)throw TypeError('Illegal end: Not an integer');b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError('Illegal range: 0 <= '+ +a+' <= '+b+' <= '+this.buffer.byteLength);}var g;try{m.decodeUTF8toUTF16(function(){return a>>=0;if(g=0<=a&&256>a)if(b=n[a])return b;b=c(a,0>(a|0)?-1:0,!0);g&&(n[a]=b)}else{a|=0;if(g=-128<=a&&128>a)if(b=l[a])return b;b=c(a,0>a?-1:0,!1);g&&(l[a]= +b)}return b}function d(a,b){if(isNaN(a)||!isFinite(a))return b?u:r;if(b){if(0>a)return u;if(a>=m)return w}else{if(a<=-g)return I;if(a+1>=g)return z}return 0>a?d(-a,b).neg():c(a%4294967296|0,a/4294967296|0,b)}function c(b,g,c){return new a(b,g,c)}function k(a,b,g){if(0===a.length)throw Error('empty string');if('NaN'===a||'Infinity'===a||'+Infinity'===a||'-Infinity'===a)return r;'number'===typeof b?(g=b,b=!1):b=!!b;g=g||10;if(2>g||36m?(m=d(q(g,m)),e=e.mul(m).add(d(l))):(e=e.mul(c),e=e.add(d(l)))}e.unsigned=b;return e}function h(b){return b instanceof a?b:'number'===typeof b?d(b):'string'===typeof b?k(b):c(b.low,b.high,b.unsigned)}Object.defineProperty(a.prototype,'__isLong__',{value:!0,enumerable:!1,configurable:!1});a.isLong=b;var l={},n={};a.fromInt=e;a.fromNumber=d;a.fromBits= +c;var q=Math.pow;a.fromString=k;a.fromValue=h;var m=4294967296*4294967296,g=m/2,p=e(16777216),r=e(0);a.ZERO=r;var u=e(0,!0);a.UZERO=u;var E=e(1);a.ONE=E;var v=e(1,!0);a.UONE=v;var t=e(-1);a.NEG_ONE=t;var z=c(-1,2147483647,!1);a.MAX_VALUE=z;var w=c(-1,-1,!0);a.MAX_UNSIGNED_VALUE=w;var I=c(0,-2147483648,!1);a.MIN_VALUE=I;var H=a.prototype;H.toInt=function(){return this.unsigned?this.low>>>0:this.low};H.toNumber=function(){return this.unsigned?4294967296*(this.high>>>0)+(this.low>>>0):4294967296*this.high+ +(this.low>>>0)};H.toString=function(a){a=a||10;if(2>a||36>>0).toString(a);b=e;if(b.isZero())return h+c;for(;6>h.length;)h='0'+h;c=''+h+c}};H.getHighBits=function(){return this.high};H.getHighBitsUnsigned= +function(){return this.high>>>0};H.getLowBits=function(){return this.low};H.getLowBitsUnsigned=function(){return this.low>>>0};H.getNumBitsAbs=function(){if(this.isNegative())return this.eq(I)?64:this.neg().getNumBitsAbs();for(var a=0!=this.high?this.high:this.low,b=31;0this.high};H.isPositive=function(){return this.unsigned||0<=this.high};H.isOdd= +function(){return 1===(this.low&1)};H.isEven=function(){return 0===(this.low&1)};H.equals=function(a){b(a)||(a=h(a));return this.unsigned!==a.unsigned&&1===this.high>>>31&&1===a.high>>>31?!1:this.high===a.high&&this.low===a.low};H.eq=H.equals;H.notEquals=function(a){return!this.eq(a)};H.neq=H.notEquals;H.lessThan=function(a){return 0>this.comp(a)};H.lt=H.lessThan;H.lessThanOrEqual=function(a){return 0>=this.comp(a)};H.lte=H.lessThanOrEqual;H.greaterThan=function(a){return 0>>0>this.high>>>0||a.high===this.high&&a.low>>>0>this.low>>>0?-1:1:this.sub(a).isNegative()?-1:1};H.comp=H.compare;H.negate=function(){return!this.unsigned&&this.eq(I)?I:this.not().add(E)};H.neg=H.negate;H.add=function(a){b(a)||(a=h(a));var g=this.high>>>16,d=this.high&65535, +e=this.low>>>16,k=a.high>>>16,m=a.high&65535,l=a.low>>>16;var n=(this.low&65535)+(a.low&65535);a=(n>>>16)+(e+l);e=(a>>>16)+(d+m);d=(e>>>16)+(g+k)&65535;return c((a&65535)<<16|n&65535,d<<16|e&65535,this.unsigned)};H.subtract=function(a){b(a)||(a=h(a));return this.add(a.neg())};H.sub=H.subtract;H.multiply=function(a){if(this.isZero())return r;b(a)||(a=h(a));if(a.isZero())return r;if(this.eq(I))return a.isOdd()?I:r;if(a.eq(I))return this.isOdd()?I:r;if(this.isNegative())return a.isNegative()?this.neg().mul(a.neg()): +this.neg().mul(a).neg();if(a.isNegative())return this.mul(a.neg()).neg();if(this.lt(p)&&a.lt(p))return d(this.toNumber()*a.toNumber(),this.unsigned);var g=this.high>>>16,e=this.high&65535,k=this.low>>>16,m=this.low&65535,l=a.high>>>16,n=a.high&65535,q=a.low>>>16;a=a.low&65535;var t=m*a;var u=(t>>>16)+k*a;var z=u>>>16;u=(u&65535)+m*q;z+=u>>>16;z+=e*a;var w=z>>>16;z=(z&65535)+k*q;w+=z>>>16;z=(z&65535)+m*n;return c((u&65535)<<16|t&65535,(w+(z>>>16)+(g*a+e*q+k*n+m*l)&65535)<<16|z&65535,this.unsigned)}; +H.mul=H.multiply;H.divide=function(a){b(a)||(a=h(a));if(a.isZero())throw Error('division by zero');if(this.isZero())return this.unsigned?u:r;if(this.unsigned){a.unsigned||(a=a.toUnsigned());if(a.gt(this))return u;if(a.gt(this.shru(1)))return v;var g=u}else{if(this.eq(I)){if(a.eq(E)||a.eq(t))return I;if(a.eq(I))return E;var c=this.shr(1).div(a).shl(1);if(c.eq(r))return a.isNegative()?E:t;var e=this.sub(a.mul(c));return c.add(e.div(a))}if(a.eq(I))return this.unsigned?u:r;if(this.isNegative())return a.isNegative()? +this.neg().div(a.neg()):this.neg().div(a).neg();if(a.isNegative())return this.div(a.neg()).neg();g=r}for(e=this;e.gte(a);){c=Math.max(1,Math.floor(e.toNumber()/a.toNumber()));var k=Math.ceil(Math.log(c)/Math.LN2);k=48>=k?1:q(2,k-48);for(var m=d(c),l=m.mul(a);l.isNegative()||l.gt(e);)c-=k,m=d(c,this.unsigned),l=m.mul(a);m.isZero()&&(m=E);g=g.add(m);e=e.sub(l)}return g};H.div=H.divide;H.modulo=function(a){b(a)||(a=h(a));return this.sub(this.div(a).mul(a))};H.mod=H.modulo;H.not=function(){return c(~this.low, +~this.high,this.unsigned)};H.and=function(a){b(a)||(a=h(a));return c(this.low&a.low,this.high&a.high,this.unsigned)};H.or=function(a){b(a)||(a=h(a));return c(this.low|a.low,this.high|a.high,this.unsigned)};H.xor=function(a){b(a)||(a=h(a));return c(this.low^a.low,this.high^a.high,this.unsigned)};H.shiftLeft=function(a){b(a)&&(a=a.toInt());return 0===(a&=63)?this:32>a?c(this.low<>>32-a,this.unsigned):c(0,this.low<a?c(this.low>>>a|this.high<<32-a,this.high>>a,this.unsigned):c(this.high>>a-32,0<=this.high?0:-1,this.unsigned)};H.shr=H.shiftRight;H.shiftRightUnsigned=function(a){b(a)&&(a=a.toInt());a&=63;if(0===a)return this;var g=this.high;return 32>a?c(this.low>>>a|g<<32-a,g>>>a,this.unsigned):32===a?c(g,0,this.unsigned):c(g>>>a-32,0,this.unsigned)};H.shru=H.shiftRightUnsigned;H.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this};H.toUnsigned=function(){return this.unsigned? +this:c(this.low,this.high,!0)};H.toBytes=function(a){return a?this.toBytesLE():this.toBytesBE()};H.toBytesLE=function(){var a=this.high,b=this.low;return[b&255,b>>>8&255,b>>>16&255,b>>>24&255,a&255,a>>>8&255,a>>>16&255,a>>>24&255]};H.toBytesBE=function(){var a=this.high,b=this.low;return[a>>>24&255,a>>>16&255,a>>>8&255,a&255,b>>>24&255,b>>>16&255,b>>>8&255,b&255]};return a}); +(function(a){function b(a){if(!a)throw Error('PSON requires ByteBuffer.js: Get it at https://github.com/dcodeIO/ByteBuffer.js');var b={T:{ZERO:0,MAX:239,NULL:240,TRUE:241,FALSE:242,EOBJECT:243,EARRAY:244,ESTRING:245,OBJECT:246,ARRAY:247,INTEGER:248,LONG:249,FLOAT:250,DOUBLE:251,STRING:252,STRING_ADD:253,STRING_GET:254,BINARY:255}};b.Encoder=function(a,b){var c=new a(4);c.length=4;var d=a.Long,e=function(a,b,g){this.dict={};this.next=0;if(a&&Array.isArray(a))for(;this.next=c||q>=c)break;h=q;k=u;var r=n}m++}r&&(k+=r.xoffset);return{start:b,end:b+m,width:k}};'width height descender ascender xHeight baseline capHeight lineHeight'.split(' ').forEach(function(a){Object.defineProperty(c.prototype,a,{get:(new Function(['return function '+a+'() {',' return this._'+a,'}'].join('\n')))(),configurable:!0})})},{'as-number':2,'indexof-property':5,'word-wrapper':15,xtend:16}], -9:[function(a,b,d){var c=Object.prototype.hasOwnProperty,g=Object.prototype.propertyIsEnumerable;b.exports=function(){try{if(!Object.assign)return!1;var a=new String('abc');a[5]='de';if('5'===Object.getOwnPropertyNames(a)[0])return!1;var b={};for(a=0;10>a;a++)b['_'+String.fromCharCode(a)]=a;if('0123456789'!==Object.getOwnPropertyNames(b).map(function(a){return b[a]}).join(''))return!1;var c={};'abcdefghijklmnopqrst'.split('').forEach(function(a){c[a]=a});return'abcdefghijklmnopqrst'!==Object.keys(Object.assign({}, -c)).join('')?!1:!0}catch(m){return!1}}()?Object.assign:function(a,b){if(null===a||void 0===a)throw new TypeError('Object.assign cannot be called with null or undefined');var d=Object(a);for(var h,k=1;ka.length?(this.boundingSphere.radius=0,this.boundingSphere.center.set(0,0,0)):(q.computeSphere(a,this.boundingSphere),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.'))};c.prototype.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var a=this.boundingBox, -b=this.attributes.position.array,c=this.attributes.position.itemSize;!b||!c||2>b.length?a.makeEmpty():q.computeBox(b,a)}},{'./lib/utils':12,'./lib/vertices':13,inherits:6,'layout-bmfont-text':8,'object-assign':9,'quad-indices':10,'three-buffer-vertex-data':14}],12:[function(a,b,d){function c(a){var b=a.length/2;g.min[0]=a[0];g.min[1]=a[1];g.max[0]=a[0];g.max[1]=a[1];for(var c=0;ce?e:r;nn&&!h.test(a.charAt(t));)t--;if(t===n)r>n+1&&r--,t=r;else for(r=t;t>n&&h.test(a.charAt(t-1));)t--}t>=n&&(n=b(a,n,t,d),k.push(n));n=r}return k}},{}],16:[function(a,b,d){b.exports=function(){for(var a={},b=0;b (http://steffe.se)',keywords:['cannon.js','cannon','physics','engine','3d'],main:'./build/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:{jshint:'latest','uglify-js':'latest',nodeunit:'^0.9.0',grunt:'~0.4.0','grunt-contrib-jshint':'~0.1.1','grunt-contrib-nodeunit':'^0.4.1','grunt-contrib-concat':'~0.1.3','grunt-contrib-uglify':'^0.5.1','grunt-browserify':'^2.1.4','grunt-contrib-yuidoc':'^0.5.2',browserify:'*'},dependencies:{}}},{}],2:[function(b,d){d.exports={version:b('../package.json').version,AABB:b('./collision/AABB'),ArrayCollisionMatrix:b('./collision/ArrayCollisionMatrix'), +(function e$jscomp$0(a,b,e){function c(h,n){if(!b[h]){if(!a[h]){var l='function'==typeof require&&require;if(!n&&l)return l(h,!0);if(k)return k(h,!0);n=Error("Cannot find module '"+h+"'");throw n.code='MODULE_NOT_FOUND',n;}n=b[h]={exports:{}};a[h][0].call(n.exports,function(b){var g=a[h][1][b];return c(g?g:b)},n,n.exports,e$jscomp$0,a,b,e)}return b[h].exports}for(var k='function'==typeof require&&require,h=0;h=c||q>=c)break;h=q;k=t;var r=n}m++}r&&(k+=r.xoffset);return{start:b,end:b+m,width:k}};'width height descender ascender xHeight baseline capHeight lineHeight'.split(' ').forEach(function(a){Object.defineProperty(d.prototype,a,{get:(new Function(['return function '+a+'() {',' return this._'+a,'}'].join('\n')))(),configurable:!0})})},{'as-number':2,'indexof-property':5,'word-wrapper':15,xtend:16}], +9:[function(a,b,e){var d=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable;b.exports=function(){try{if(!Object.assign)return!1;var a=new String('abc');a[5]='de';if('5'===Object.getOwnPropertyNames(a)[0])return!1;var b={};for(a=0;10>a;a++)b['_'+String.fromCharCode(a)]=a;if('0123456789'!==Object.getOwnPropertyNames(b).map(function(a){return b[a]}).join(''))return!1;var c={};'abcdefghijklmnopqrst'.split('').forEach(function(a){c[a]=a});return'abcdefghijklmnopqrst'!==Object.keys(Object.assign({}, +c)).join('')?!1:!0}catch(n){return!1}}()?Object.assign:function(a,b){if(null===a||void 0===a)throw new TypeError('Object.assign cannot be called with null or undefined');var e=Object(a);for(var h,k=1;ka.length?(this.boundingSphere.radius=0,this.boundingSphere.center.set(0,0,0)):(q.computeSphere(a,this.boundingSphere),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.'))};d.prototype.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var a=this.boundingBox, +b=this.attributes.position.array,c=this.attributes.position.itemSize;!b||!c||2>b.length?a.makeEmpty():q.computeBox(b,a)}},{'./lib/utils':12,'./lib/vertices':13,inherits:6,'layout-bmfont-text':8,'object-assign':9,'quad-indices':10,'three-buffer-vertex-data':14}],12:[function(a,b,e){function d(a){var b=a.length/2;c.min[0]=a[0];c.min[1]=a[1];c.max[0]=a[0];c.max[1]=a[1];for(var d=0;dg?g:r;ll&&!k.test(a.charAt(u));)u--;if(u===l)r>l+1&&r--,u=r;else for(r=u;u>l&&k.test(a.charAt(u-1));)u--}u>=l&&(l=b(a,l,u,e),h.push(l));l=r}return h}},{}],16:[function(a,b,e){b.exports=function(){for(var a={},b=0;b (http://steffe.se)',keywords:['cannon.js','cannon','physics','engine','3d'],main:'./build/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:{jshint:'latest','uglify-js':'latest',nodeunit:'^0.9.0',grunt:'~0.4.0','grunt-contrib-jshint':'~0.1.1','grunt-contrib-nodeunit':'^0.4.1','grunt-contrib-concat':'~0.1.3','grunt-contrib-uglify':'^0.5.1','grunt-browserify':'^2.1.4','grunt-contrib-yuidoc':'^0.5.2',browserify:'*'},dependencies:{}}},{}],2:[function(b,e){e.exports={version:b('../package.json').version,AABB:b('./collision/AABB'),ArrayCollisionMatrix:b('./collision/ArrayCollisionMatrix'), Body:b('./objects/Body'),Box:b('./shapes/Box'),Broadphase:b('./collision/Broadphase'),Constraint:b('./constraints/Constraint'),ContactEquation:b('./equations/ContactEquation'),Narrowphase:b('./world/Narrowphase'),ConeTwistConstraint:b('./constraints/ConeTwistConstraint'),ContactMaterial:b('./material/ContactMaterial'),ConvexPolyhedron:b('./shapes/ConvexPolyhedron'),Cylinder:b('./shapes/Cylinder'),DistanceConstraint:b('./constraints/DistanceConstraint'),Equation:b('./equations/Equation'),EventTarget:b('./utils/EventTarget'), FrictionEquation:b('./equations/FrictionEquation'),GSSolver:b('./solver/GSSolver'),GridBroadphase:b('./collision/GridBroadphase'),Heightfield:b('./shapes/Heightfield'),HingeConstraint:b('./constraints/HingeConstraint'),LockConstraint:b('./constraints/LockConstraint'),Mat3:b('./math/Mat3'),Material:b('./material/Material'),NaiveBroadphase:b('./collision/NaiveBroadphase'),ObjectCollisionMatrix:b('./collision/ObjectCollisionMatrix'),Pool:b('./utils/Pool'),Particle:b('./shapes/Particle'),Plane:b('./shapes/Plane'), PointToPointConstraint:b('./constraints/PointToPointConstraint'),Quaternion:b('./math/Quaternion'),Ray:b('./collision/Ray'),RaycastVehicle:b('./objects/RaycastVehicle'),RaycastResult:b('./collision/RaycastResult'),RigidVehicle:b('./objects/RigidVehicle'),RotationalEquation:b('./equations/RotationalEquation'),RotationalMotorEquation:b('./equations/RotationalMotorEquation'),SAPBroadphase:b('./collision/SAPBroadphase'),SPHSystem:b('./objects/SPHSystem'),Shape:b('./shapes/Shape'),Solver:b('./solver/Solver'), Sphere:b('./shapes/Sphere'),SplitSolver:b('./solver/SplitSolver'),Spring:b('./objects/Spring'),Trimesh:b('./shapes/Trimesh'),Vec3:b('./math/Vec3'),Vec3Pool:b('./utils/Vec3Pool'),World:b('./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':9,'./collision/RaycastResult':10,'./collision/SAPBroadphase':11,'./constraints/ConeTwistConstraint':12, './constraints/Constraint':13,'./constraints/DistanceConstraint':14,'./constraints/HingeConstraint':15,'./constraints/LockConstraint':16,'./constraints/PointToPointConstraint':17,'./equations/ContactEquation':19,'./equations/Equation':20,'./equations/FrictionEquation':21,'./equations/RotationalEquation':22,'./equations/RotationalMotorEquation':23,'./material/ContactMaterial':24,'./material/Material':25,'./math/Mat3':27,'./math/Quaternion':28,'./math/Vec3':30,'./objects/Body':31,'./objects/RaycastVehicle':32, -'./objects/RigidVehicle':33,'./objects/SPHSystem':34,'./objects/Spring':35,'./shapes/Box':37,'./shapes/ConvexPolyhedron':38,'./shapes/Cylinder':39,'./shapes/Heightfield':40,'./shapes/Particle':41,'./shapes/Plane':42,'./shapes/Shape':43,'./shapes/Sphere':44,'./shapes/Trimesh':45,'./solver/GSSolver':46,'./solver/Solver':47,'./solver/SplitSolver':48,'./utils/EventTarget':49,'./utils/Pool':51,'./utils/Vec3Pool':54,'./world/Narrowphase':55,'./world/World':56}],3:[function(b,d){function c(b){b=b||{};this.lowerBound= -new g;b.lowerBound&&this.lowerBound.copy(b.lowerBound);this.upperBound=new g;b.upperBound&&this.upperBound.copy(b.upperBound)}var g=b('../math/Vec3');b('../utils/Utils');d.exports=c;var h=new g;c.prototype.setFromPoints=function(b,c,d,g){var e=this.lowerBound,k=this.upperBound;e.copy(b[0]);d&&d.vmult(e,e);k.copy(e);for(var m=1;mk.x&&(k.x=l.x);l.xk.y&&(k.y=l.y);l.yk.z&&(k.z=l.z);l.zc&&(this.lowerBound.x=c);c=b.upperBound.x;this.upperBound.xc&&(this.lowerBound.y=c);c=b.upperBound.y;this.upperBound.yc&&(this.lowerBound.z=c);c=b.upperBound.z;this.upperBound.z=b.x&&c.y<=g.y&&d.y>= -b.y&&c.z<=g.z&&d.z>=b.z};c.prototype.getCorners=function(b,c,d,g,e,h,k,t){var m=this.lowerBound,l=this.upperBound;b.copy(m);c.set(l.x,m.y,m.z);d.set(l.x,l.y,m.z);g.set(m.x,l.y,l.z);e.set(l.x,m.y,m.z);h.set(m.x,l.y,m.z);k.set(m.x,m.y,l.z);t.copy(l)};var k=[new g,new g,new g,new g,new g,new g,new g,new g];c.prototype.toLocalFrame=function(b,c){this.getCorners(k[0],k[1],k[2],k[3],k[4],k[5],k[6],k[7]);for(var d=0;8!==d;d++){var g=k[d];b.pointToLocal(g,g)}return c.setFromPoints(k)};c.prototype.toWorldFrame= -function(b,c){this.getCorners(k[0],k[1],k[2],k[3],k[4],k[5],k[6],k[7]);for(var d=0;8!==d;d++){var g=k[d];b.pointToWorld(g,g)}return c.setFromPoints(k)}},{'../math/Vec3':30,'../utils/Utils':53}],4:[function(b,d){function c(){this.matrix=[]}d.exports=c;c.prototype.get=function(b,c){if(b=b.index,c=c.index,c>b){var d=c;c=b;b=d}return this.matrix[(b*(b+1)>>1)+c-1]};c.prototype.set=function(b,c,d){if(b=b.index,c=c.index,c>b){var g=c;c=b;b=g}this.matrix[(b*(b+1)>>1)+c-1]=d?1:0};c.prototype.reset=function(){for(var b= -0,c=this.matrix.length;b!==c;b++)this.matrix[b]=0};c.prototype.setNumObjects=function(b){this.matrix.length=b*(b-1)>>1}},{}],5:[function(b,d){function c(){this.world=null;this.useBoundingBoxes=!1;this.dirty=!0}var g=b('../objects/Body'),h=b('../math/Vec3'),k=b('../math/Quaternion');b('../shapes/Shape');b('../shapes/Plane');d.exports=c;c.prototype.collisionPairs=function(){throw Error('collisionPairs not implemented for this BroadPhase class!');};var l=g.STATIC|g.KINEMATIC;c.prototype.needBroadphaseCollision= -function(b,e){return 0===(b.collisionFilterGroup&e.collisionFilterMask)||0===(e.collisionFilterGroup&b.collisionFilterMask)?!1:0===(b.type&l)&&b.sleepState!==g.SLEEPING||0===(e.type&l)&&e.sleepState!==g.SLEEPING?!0:!1};c.prototype.intersectionTest=function(b,e,c,d){this.useBoundingBoxes?this.doBoundingBoxBroadphase(b,e,c,d):this.doBoundingSphereBroadphase(b,e,c,d)};var m=new h;new h;new k;new h;c.prototype.doBoundingSphereBroadphase=function(b,e,c,d){e.position.vsub(b.position,m);var g=Math.pow(b.boundingRadius+ -e.boundingRadius,2),h=m.norm2();g>h&&(c.push(b),d.push(e))};c.prototype.doBoundingBoxBroadphase=function(b,e,c,d){b.aabbNeedsUpdate&&b.computeAABB();e.aabbNeedsUpdate&&e.computeAABB();b.aabb.overlaps(e.aabb)&&(c.push(b),d.push(e))};var q={keys:[]},p=[],e=[];c.prototype.makePairsUnique=function(b,c){for(var d=b.length,g=0;g!==d;g++)p[g]=b[g],e[g]=c[g];b.length=0;for(g=c.length=0;g!==d;g++){var h=p[g].id,k=e[g].id;h=k>h?h+','+k:k+','+h;q[h]=g;q.keys.push(h)}for(g=0;g!==q.keys.length;g++)h=q.keys.pop(), -d=q[h],b.push(p[d]),c.push(e[d]),delete q[h]};c.prototype.setWorld=function(){};var n=new h;c.boundingSphereCheck=function(b,e){return b.position.vsub(e.position,n),Math.pow(b.shape.boundingSphereRadius+e.shape.boundingSphereRadius,2)>n.norm2()};c.prototype.aabbQuery=function(){return console.warn('.aabbQuery is not implemented in this Broadphase subclass.'),[]}},{'../math/Quaternion':28,'../math/Vec3':30,'../objects/Body':31,'../shapes/Plane':42,'../shapes/Shape':43}],6:[function(b,d){function c(b, -c,d,e,k){g.apply(this);this.nx=d||10;this.ny=e||10;this.nz=k||10;this.aabbMin=b||new h(100,100,100);this.aabbMax=c||new h(-100,-100,-100);b=this.nx*this.ny*this.nz;if(0>=b)throw"GridBroadphase: Each dimension's n must be >0";this.bins=[];this.binLengths=[];this.bins.length=b;this.binLengths.length=b;for(c=0;b>c;c++)this.bins[c]=[],this.binLengths[c]=0}d.exports=c;var g=b('./Broadphase'),h=b('../math/Vec3'),k=b('../shapes/Shape');c.prototype=new g;c.prototype.constructor=c;var l=new h;new h;c.prototype.collisionPairs= -function(b,c,d){function e(b,e,c,d,g,h,k){b=(b-C)*T|0;e=(e-P)*fa|0;c=(c-Q)*ja|0;d=L((d-C)*T);g=L((g-P)*fa);h=L((h-Q)*ja);0>b?b=0:b>=p&&(b=p-1);0>e?e=0:e>=q&&(e=q-1);0>c?c=0:c>=u&&(c=u-1);0>d?d=0:d>=p&&(d=p-1);0>g?g=0:g>=q&&(g=q-1);0>h?h=0:h>=u&&(h=u-1);b*=v;e*=z;c*=G;d*=v;g*=z;for(h*=G;d>=b;b+=v)for(var m=e;g>=m;m+=z)for(var l=c;h>=l;l+=G){var n=b+m+l;ca[n][ba[n]++]=k}}var g=b.numObjects();b=b.bodies;var h=this.aabbMax,m=this.aabbMin,p=this.nx,q=this.ny,u=this.nz,v=q*u,z=u,G=1,I=h.x,K=h.y,H=h.z,C= -m.x,P=m.y,Q=m.z,T=p/(I-C),fa=q/(K-P),ja=u/(H-Q);I=(I-C)/p;var ia=(K-P)/q;H=(H-Q)/u;var N=.5*Math.sqrt(I*I+ia*ia+H*H);K=k.types;var ma=K.SPHERE,V=K.PLANE,ca=(K.BOX,K.COMPOUND,K.CONVEXPOLYHEDRON,this.bins),ba=this.binLengths;K=this.bins.length;for(m=0;m!==K;m++)ba[m]=0;var L=Math.ceil;m=Math.min;h=Math.max;for(m=0;m!==g;m++){h=b[m];var na=h.shape;switch(na.type){case ma:var sa=h.position.x,ea=h.position.y,qa=h.position.z;na=na.radius;e(sa-na,ea-na,qa-na,sa+na,ea+na,qa+na,h);break;case V:na.worldNormalNeedsUpdate&& -na.computeWorldNormal(h.quaternion);qa=na.worldNormal;na=P+.5*ia-h.position.y;var oa=Q+.5*H-h.position.z,O=l;O.set(C+.5*I-h.position.x,na,oa);for(var ua=sa=0;sa!==p;sa++,ua+=v,O.y=na,O.x+=I)for(var ha=ea=0;ea!==q;ea++,ha+=z,O.z=oa,O.y+=ia)for(var ka=0,va=0;ka!==u;ka++,va+=G,O.z+=H)if(O.dot(qa)b){var d=c;c=b;b=d}return b+'-'+c in this.matrix};c.prototype.set=function(b,c,d){if(b=b.id,c=c.id, -c>b){var g=c;c=b;b=g}d?this.matrix[b+'-'+c]=!0:delete this.matrix[b+'-'+c]};c.prototype.reset=function(){this.matrix={}};c.prototype.setNumObjects=function(){}},{}],9:[function(b,d){function c(b,e){this.from=b?b.clone():new h;this.to=e?e.clone():new h;this._direction=new h;this.precision=1E-4;this.checkCollisionResponse=!0;this.skipBackfaces=!1;this.collisionFilterGroup=this.collisionFilterMask=-1;this.mode=c.ANY;this.result=new l;this.hasHit=!1;this.callback=function(){}}function g(b,c,d,g){g.vsub(c, -ma);d.vsub(c,e);b.vsub(c,n);var h,k;b=ma.dot(ma);c=ma.dot(e);d=ma.dot(n);g=e.dot(e);var m=e.dot(n);return 0<=(h=g*d-c*m)&&0<=(k=b*m-c*d)&&b*g-c*c>h+k}d.exports=c;var h=b('../math/Vec3');d=b('../math/Quaternion');var k=b('../math/Transform'),l=(b('../shapes/ConvexPolyhedron'),b('../shapes/Box'),b('../collision/RaycastResult')),m=b('../shapes/Shape');b=b('../collision/AABB');c.prototype.constructor=c;c.CLOSEST=1;c.ANY=2;c.ALL=4;var q=new b,p=[];c.prototype.intersectWorld=function(b,e){return this.mode= -e.mode||c.ANY,this.result=e.result||new l,this.skipBackfaces=!!e.skipBackfaces,this.collisionFilterMask='undefined'!=typeof e.collisionFilterMask?e.collisionFilterMask:-1,this.collisionFilterGroup='undefined'!=typeof 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(q),p.length=0,b.broadphase.aabbQuery(b,q,p),this.intersectBodies(p), -this.hasHit};var e=new h,n=new h;c.pointInTriangle=g;var r=new h,t=new d;c.prototype.intersectBody=function(b,e){e&&(this.result=e,this._updateDirection());e=this.checkCollisionResponse;if((!e||b.collisionResponse)&&0!==(this.collisionFilterGroup&b.collisionFilterMask)&&0!==(b.collisionFilterGroup&this.collisionFilterMask))for(var c=0,d=b.shapes.length;d>c;c++){var g=b.shapes[c];if((!e||g.collisionResponse)&&(b.quaternion.mult(b.shapeOrientations[c],t),b.quaternion.vmult(b.shapeOffsets[c],r),r.vadd(b.position, -r),this.intersectShape(g,t,r,b),this.result._shouldStop))break}};c.prototype.intersectBodies=function(b,e){e&&(this.result=e,this._updateDirection());e=0;for(var c=b.length;!this.result._shouldStop&&c>e;e++)this.intersectBody(b[e])};c.prototype._updateDirection=function(){this.to.vsub(this.from,this._direction);this._direction.normalize()};c.prototype.intersectShape=function(b,e,c,d){var g=this.from,h=this._direction;c.vsub(g,ma);var k=ma.dot(h);h.mult(k,V);V.vadd(g,V);c.distanceTo(V)>b.boundingSphereRadius|| -(g=this[b.type])&&g.call(this,b,e,c,d)};var D=(new h,new h,new h),w=new h,u=new h,v=new h;new h;new l;c.prototype.intersectBox=function(b,e,c,d){return this.intersectConvex(b.convexPolyhedronRepresentation,e,c,d)};c.prototype[m.types.BOX]=c.prototype.intersectBox;c.prototype.intersectPlane=function(b,e,c,d){var g=this.from,k=this.to,m=this._direction,l=new h(0,0,1);e.vmult(l,l);var p=new h;g.vsub(c,p);e=p.dot(l);k.vsub(c,p);p=p.dot(l);if(!(0u)&&(u=p[0]),(null===q||p[1]r)&&(r=p[1])),null!==n)for(l=[],b.getRectMinMax(n,q,u,r,l),n=(l[0],l[1],n);u>=n;n++)for(l=q;r>=l;l++){if(this.result._shouldStop|| -(b.getConvexTrianglePillar(n,l,!1),k.pointToWorldFrame(d,e,b.pillarOffset,m),this.intersectConvex(b.pillarConvex,e,m,g,z),this.result._shouldStop))return;b.getConvexTrianglePillar(n,l,!0);k.pointToWorldFrame(d,e,b.pillarOffset,m);this.intersectConvex(b.pillarConvex,e,m,g,z)}};c.prototype[m.types.HEIGHTFIELD]=c.prototype.intersectHeightfield;var G=new h,I=new h;c.prototype.intersectSphere=function(b,e,c,d){e=this.from;var g=this.to,h=Math.pow(g.x-e.x,2)+Math.pow(g.y-e.y,2)+Math.pow(g.z-e.z,2),k=2* -((g.x-e.x)*(e.x-c.x)+(g.y-e.y)*(e.y-c.y)+(g.z-e.z)*(e.z-c.z)),m=Math.pow(k,2)-4*h*(Math.pow(e.x-c.x,2)+Math.pow(e.y-c.y,2)+Math.pow(e.z-c.z,2)-Math.pow(b.radius,2));if(!(0>m))if(0===m)e.lerp(g,m,G),G.vsub(c,I),I.normalize(),this.reportIntersection(I,G,b,d,-1);else{var l=(-k-Math.sqrt(m))/(2*h);h=(-k+Math.sqrt(m))/(2*h);(0<=l&&1>=l&&(e.lerp(g,l,G),G.vsub(c,I),I.normalize(),this.reportIntersection(I,G,b,d,-1)),this.result._shouldStop)||0<=h&&1>=h&&(e.lerp(g,h,G),G.vsub(c,I),I.normalize(),this.reportIntersection(I, -G,b,d,-1))}};c.prototype[m.types.SPHERE]=c.prototype.intersectSphere;var K=new h,H=(new h,new h,new h);c.prototype.intersectConvex=function(b,e,c,d,h){h=h&&h.faceList||null;for(var k=b.faces,m=b.vertices,l=b.faceNormals,p=this._direction,n=this.from,q=n.distanceTo(this.to),r=h?h.length:k.length,t=this.result,z=0;!t._shouldStop&&r>z;z++){var C=h?h[z]:z,U=k[C],G=l[C],I=e,P=c;H.copy(m[U[0]]);I.vmult(H,H);H.vadd(P,H);H.vsub(n,H);I.vmult(G,K);G=p.dot(K);if(!(Math.abs(G) -G)))for(p.mult(G,D),D.vadd(n,D),w.copy(m[U[0]]),I.vmult(w,w),P.vadd(w,w),G=1;!t._shouldStop&&Gq||this.reportIntersection(K,D,b,d,C)}}};c.prototype[m.types.CONVEXPOLYHEDRON]=c.prototype.intersectConvex;var C=new h,P=new h,Q=new h,T=new h,fa=new h,ja=new h,ia=(new b,[]),N=new k;c.prototype.intersectTrimesh=function(b,e,c,d,h){h=(h&&h.faceList||null,b.indices); -var m=(b.vertices,b.faceNormals,this.from),l=this.to,p=this._direction;N.position.copy(c);N.quaternion.copy(e);k.vectorToLocalFrame(c,e,p,P);k.pointToLocalFrame(c,e,m,Q);k.pointToLocalFrame(c,e,l,T);m=Q.distanceSquared(T);b.tree.rayQuery(this,N,ia);l=0;for(p=ia.length;!this.result._shouldStop&&l!==p;l++){var n=ia[l];b.getNormal(n,C);b.getVertex(h[3*n],w);w.vsub(Q,H);var q=P.dot(C);q=C.dot(H)/q;0>q||(P.scale(q,D),D.vadd(Q,D),b.getVertex(h[3*n+1],u),b.getVertex(h[3*n+2],v),q=D.distanceSquared(Q),!g(D, -u,w,v)&&!g(D,w,u,v)||q>m||(k.vectorToWorldFrame(e,C,fa),k.pointToWorldFrame(c,e,D,ja),this.reportIntersection(fa,ja,b,d,n)))}ia.length=0};c.prototype[m.types.TRIMESH]=c.prototype.intersectTrimesh;c.prototype.reportIntersection=function(b,e,d,g,h){var k=this.from,m=this.to,l=k.distanceTo(e),p=this.result;if(!(this.skipBackfaces&&0c;c++){for(var g=b[c],h=c-1;0<=h&&!(b[h].aabb.lowerBound.x<=g.aabb.lowerBound.x);h--)b[h+1]=b[h];b[h+1]=g}return b};c.insertionSortY= -function(b){for(var c=1,d=b.length;d>c;c++){for(var g=b[c],h=c-1;0<=h&&!(b[h].aabb.lowerBound.y<=g.aabb.lowerBound.y);h--)b[h+1]=b[h];b[h+1]=g}return b};c.insertionSortZ=function(b){for(var c=1,d=b.length;d>c;c++){for(var g=b[c],h=c-1;0<=h&&!(b[h].aabb.lowerBound.z<=g.aabb.lowerBound.z);h--)b[h+1]=b[h];b[h+1]=g}return b};c.prototype.collisionPairs=function(b,d,g){var h,k=this.axisList,l=k.length,e=this.axisIndex;this.dirty&&(this.sortList(),this.dirty=!1);for(b=0;b!==l;b++){var n=k[b];for(h=b+1;l> -h;h++){var r=k[h];if(this.needBroadphaseCollision(n,r)){if(!c.checkBounds(n,r,e))break;this.intersectionTest(n,r,d,g)}}}};c.prototype.sortList=function(){for(var b=this.axisList,d=this.axisIndex,g=b.length,m=0;m!==g;m++){var q=b[m];q.aabbNeedsUpdate&&q.computeAABB()}0===d?c.insertionSortX(b):1===d?c.insertionSortY(b):2===d&&c.insertionSortZ(b)};c.checkBounds=function(b,c,d){var g,h;0===d?(g=b.position.x,h=c.position.x):1===d?(g=b.position.y,h=c.position.y):2===d&&(g=b.position.z,h=c.position.z);return g+ -b.boundingRadius>h-c.boundingRadius};c.prototype.autoDetectAxis=function(){for(var b=0,c=0,d=0,g=0,q=0,p=0,e=this.axisList,n=e.length,r=1/n,t=0;t!==n;t++){var D=e[t],w=D.position.x;b+=w;c+=w*w;w=D.position.y;d+=w;g+=w*w;D=D.position.z;q+=D;p+=D*D}b=c-b*b*r;d=g-d*d*r;q=p-q*q*r;this.axisIndex=b>d?b>q?0:2:d>q?1:2};c.prototype.aabbQuery=function(b,c,d){d=d||[];this.dirty&&(this.sortList(),this.dirty=!1);b=this.axisIndex;var g='x';1===b&&(g='y');2===b&&(g='z');b=this.axisList;for(g=(c.lowerBound[g],c.upperBound[g], -0);gg;g++)for(var h=0;3>h;h++){for(var k=0,p=0;3>p;p++)k+=b.elements[g+3*p]*this.elements[p+3*h];d.elements[g+3*h]=k}return d};c.prototype.scale=function(b,d){d=d||new c;for(var g=this.elements,h=d.elements,k=0;3!==k;k++)h[3*k]=b.x*g[3*k],h[3*k+1]=b.y*g[3*k+1],h[3*k+2]=b.z*g[3*k+2];return d};c.prototype.solve=function(b,c){c=c||new g;for(var d=[],h=0;12>h;h++)d.push(0);var k;for(h=0;3>h;h++)for(k= -0;3>k;k++)d[h+4*k]=this.elements[h+3*k];d[3]=b.x;d[7]=b.y;d[11]=b.z;var p=3,e=p;do{if(h=e-p,0===d[h+4*h])for(k=h+1;e>k;k++)if(0!==d[h+4*k]){var n=4;do{var r=4-n;d[r+4*h]+=d[r+4*k]}while(--n);break}if(0!==d[h+4*h])for(k=h+1;e>k;k++){var t=d[h+4*k]/d[h+4*h];n=4;do r=4-n,d[r+4*k]=h>=r?0:d[r+4*k]-d[r+4*h]*t;while(--n)}}while(--p);if(c.z=d[11]/d[10],c.y=(d[7]-d[6]*c.z)/d[5],c.x=(d[3]-d[2]*c.z-d[1]*c.y)/d[0],isNaN(c.x)||isNaN(c.y)||isNaN(c.z)||1/0===c.x||1/0===c.y||1/0===c.z)throw'Could not solve equation! Got x=['+ -c.toString()+'], b=['+b.toString()+'], A=['+this.toString()+']';return c};c.prototype.e=function(b,c,d){return void 0===d?this.elements[c+3*b]:void(this.elements[c+3*b]=d)};c.prototype.copy=function(b){for(var c=0;cc;c++)b+=this.elements[c]+',';return b};c.prototype.reverse=function(b){b=b||new c;for(var d=[],g=0;18>g;g++)d.push(0);var h;for(g=0;3>g;g++)for(h=0;3>h;h++)d[g+6*h]=this.elements[g+ -3*h];d[3]=1;d[9]=0;d[15]=0;d[4]=0;d[10]=1;d[16]=0;d[5]=0;d[11]=0;d[17]=1;var q=3,p=q;do{if(g=p-q,0===d[g+6*g])for(h=g+1;p>h;h++)if(0!==d[g+6*h]){var e=6;do{var n=6-e;d[n+6*g]+=d[n+6*h]}while(--e);break}if(0!==d[g+6*g])for(h=g+1;p>h;h++){var r=d[g+6*h]/d[g+6*g];e=6;do n=6-e,d[n+6*h]=g>=n?0:d[n+6*h]-d[n+6*g]*r;while(--e)}}while(--q);g=2;do{h=g-1;do{r=d[g+6*h]/d[g+6*g];e=6;do n=6-e,d[n+6*h]-=d[n+6*g]*r;while(--e)}while(h--)}while(--g);g=2;do{r=1/d[g+6*g];e=6;do n=6-e,d[n+6*g]*=r;while(--e)}while(g--); -g=2;do{h=2;do{if(n=d[3+h+6*g],isNaN(n)||1/0===n)throw'Could not reverse! A=['+this.toString()+']';b.e(g,h,n)}while(h--)}while(g--);return b};c.prototype.setRotationFromQuaternion=function(b){var c=b.x,d=b.y,g=b.z,h=b.w,p=c+c,e=d+d,n=g+g;b=c*p;var r=c*e;c*=n;var t=d*e;d*=n;g*=n;p*=h;e*=h;h*=n;n=this.elements;return n[0]=1-(t+g),n[1]=r-h,n[2]=c+e,n[3]=r+h,n[4]=1-(b+g),n[5]=d-p,n[6]=c-e,n[7]=d+p,n[8]=1-(b+t),this};c.prototype.transpose=function(b){b=b||new c;for(var d=b.elements,g=this.elements,h=0;3!== -h;h++)for(var q=0;3!==q;q++)d[3*h+q]=g[3*q+h];return b}},{'./Vec3':30}],28:[function(b,d){function c(b,c,d,g){this.x=void 0!==b?b:0;this.y=void 0!==c?c:0;this.z=void 0!==d?d:0;this.w=void 0!==g?g:1}d.exports=c;var g=b('./Vec3');c.prototype.set=function(b,c,d,g){this.x=b;this.y=c;this.z=d;this.w=g};c.prototype.toString=function(){return this.x+','+this.y+','+this.z+','+this.w};c.prototype.toArray=function(){return[this.x,this.y,this.z,this.w]};c.prototype.setFromAxisAngle=function(b,c){var e=Math.sin(.5* -c);this.x=b.x*e;this.y=b.y*e;this.z=b.z*e;this.w=Math.cos(.5*c)};c.prototype.toAxisAngle=function(b){b=b||new g;this.normalize();var c=2*Math.acos(this.w),d=Math.sqrt(1-this.w*this.w);return.001>d?(b.x=this.x,b.y=this.y,b.z=this.z):(b.x=this.x/d,b.y=this.y/d,b.z=this.z/d),[b,c]};var h=new g,k=new g;c.prototype.setFromVectors=function(b,c){if(b.isAntiparallelTo(c))b.tangents(h,k),this.setFromAxisAngle(h,Math.PI);else{var e=b.cross(c);this.x=e.x;this.y=e.y;this.z=e.z;this.w=Math.sqrt(Math.pow(b.norm(), -2)*Math.pow(c.norm(),2))+b.dot(c);this.normalize()}};var l=new g,m=new g,q=new g;c.prototype.mult=function(b,e){e=e||new c;var d=this.w;return l.set(this.x,this.y,this.z),m.set(b.x,b.y,b.z),e.w=d*b.w-l.dot(m),l.cross(m,q),e.x=d*m.x+b.w*l.x+q.x,e.y=d*m.y+b.w*l.y+q.y,e.z=d*m.z+b.w*l.z+q.z,e};c.prototype.inverse=function(b){var e=this.x,d=this.y,g=this.z,h=this.w;b=b||new c;this.conjugate(b);e=1/(e*e+d*d+g*g+h*h);return b.x*=e,b.y*=e,b.z*=e,b.w*=e,b};c.prototype.conjugate=function(b){return b=b||new c, -b.x=-this.x,b.y=-this.y,b.z=-this.z,b.w=this.w,b};c.prototype.normalize=function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===b?(this.x=0,this.y=0,this.z=0,this.w=0):(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b)};c.prototype.normalizeFast=function(){var b=(3-(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w))/2;0===b?(this.x=0,this.y=0,this.z=0,this.w=0):(this.x*=b,this.y*=b,this.z*=b,this.w*=b)};c.prototype.vmult=function(b,c){c=c||new g;var e=b.x,d=b.y, -h=b.z;b=this.x;var k=this.y,m=this.z,l=this.w,p=l*e+k*h-m*d,q=l*d+m*e-b*h,G=l*h+b*d-k*e;e=-b*e-k*d-m*h;return c.x=p*l+e*-b+q*-m-G*-k,c.y=q*l+e*-k+G*-b-p*-m,c.z=G*l+e*-m+p*-k-q*-b,c};c.prototype.copy=function(b){return this.x=b.x,this.y=b.y,this.z=b.z,this.w=b.w,this};c.prototype.toEuler=function(b,c){c=c||'YZX';var e,d,g,h=this.x,k=this.y,m=this.z,l=this.w;switch(c){case 'YZX':c=h*k+m*l;if(.499c&&(e=-2*Math.atan2(h,l),d=-Math.PI/2,g=0),isNaN(e))g=m* -m,e=Math.atan2(2*k*l-2*h*m,1-2*k*k-2*g),d=Math.asin(2*c),g=Math.atan2(2*h*l-2*k*m,1-2*h*h-2*g);break;default:throw Error('Euler order '+c+' not supported yet.');}b.y=e;b.z=d;b.x=g};c.prototype.setFromEuler=function(b,c,d,g){g=g||'XYZ';var e=Math.cos(b/2),h=Math.cos(c/2),k=Math.cos(d/2);b=Math.sin(b/2);c=Math.sin(c/2);d=Math.sin(d/2);return'XYZ'===g?(this.x=b*h*k+e*c*d,this.y=e*c*k-b*h*d,this.z=e*h*d+b*c*k,this.w=e*h*k-b*c*d):'YXZ'===g?(this.x=b*h*k+e*c*d,this.y=e*c*k-b*h*d,this.z=e*h*d-b*c*k,this.w= -e*h*k+b*c*d):'ZXY'===g?(this.x=b*h*k-e*c*d,this.y=e*c*k+b*h*d,this.z=e*h*d+b*c*k,this.w=e*h*k-b*c*d):'ZYX'===g?(this.x=b*h*k-e*c*d,this.y=e*c*k+b*h*d,this.z=e*h*d-b*c*k,this.w=e*h*k+b*c*d):'YZX'===g?(this.x=b*h*k+e*c*d,this.y=e*c*k+b*h*d,this.z=e*h*d-b*c*k,this.w=e*h*k-b*c*d):'XZY'===g&&(this.x=b*h*k-e*c*d,this.y=e*c*k-b*h*d,this.z=e*h*d+b*c*k,this.w=e*h*k+b*c*d),this};c.prototype.clone=function(){return new c(this.x,this.y,this.z,this.w)}},{'./Vec3':30}],29:[function(b,d){function c(b){b=b||{};this.position= -new g;b.position&&this.position.copy(b.position);this.quaternion=new h;b.quaternion&&this.quaternion.copy(b.quaternion)}var g=b('./Vec3'),h=b('./Quaternion');d.exports=c;var k=new h;c.pointToLocalFrame=function(b,c,d,h){h=h||new g;return d.vsub(b,h),c.conjugate(k),k.vmult(h,h),h};c.prototype.pointToLocal=function(b,d){return c.pointToLocalFrame(this.position,this.quaternion,b,d)};c.pointToWorldFrame=function(b,c,d,h){h=h||new g;return c.vmult(d,h),h.vadd(b,h),h};c.prototype.pointToWorld=function(b, -d){return c.pointToWorldFrame(this.position,this.quaternion,b,d)};c.prototype.vectorToWorldFrame=function(b,c){c=c||new g;return this.quaternion.vmult(b,c),c};c.vectorToWorldFrame=function(b,c,d){return b.vmult(c,d),d};c.vectorToLocalFrame=function(b,c,d,h){h=h||new g;return c.w*=-1,c.vmult(d,h),c.w*=-1,h}},{'./Quaternion':28,'./Vec3':30}],30:[function(b,d){function c(b,c,d){this.x=b||0;this.y=c||0;this.z=d||0}d.exports=c;var g=b('./Mat3');c.ZERO=new c(0,0,0);c.UNIT_X=new c(1,0,0);c.UNIT_Y=new c(0, -1,0);c.UNIT_Z=new c(0,0,1);c.prototype.cross=function(b,d){var g=b.x,e=b.y;b=b.z;var h=this.x,k=this.y,m=this.z;return d=d||new c,d.x=k*b-m*e,d.y=m*g-h*b,d.z=h*e-k*g,d};c.prototype.set=function(b,c,d){return this.x=b,this.y=c,this.z=d,this};c.prototype.setZero=function(){this.x=this.y=this.z=0};c.prototype.vadd=function(b,d){return d?(d.x=b.x+this.x,d.y=b.y+this.y,d.z=b.z+this.z,void 0):new c(this.x+b.x,this.y+b.y,this.z+b.z)};c.prototype.vsub=function(b,d){return d?(d.x=this.x-b.x,d.y=this.y-b.y, -d.z=this.z-b.z,void 0):new c(this.x-b.x,this.y-b.y,this.z-b.z)};c.prototype.crossmat=function(){return new g([0,-this.z,this.y,this.z,0,-this.x,-this.y,this.x,0])};c.prototype.normalize=function(){var b=this.x,c=this.y,d=this.z;b=Math.sqrt(b*b+c*c+d*d);0Math.abs(h.x)?(k.set(1,0,0),h.cross(k,b)): -(k.set(0,1,0),h.cross(k,b)),h.cross(b,c)):(b.set(1,0,0),c.set(0,1,0))};c.prototype.toString=function(){return this.x+','+this.y+','+this.z};c.prototype.toArray=function(){return[this.x,this.y,this.z]};c.prototype.copy=function(b){return this.x=b.x,this.y=b.y,this.z=b.z,this};c.prototype.lerp=function(b,c,d){var e=this.x,g=this.y,h=this.z;d.x=e+(b.x-e)*c;d.y=g+(b.y-g)*c;d.z=h+(b.z-h)*c};c.prototype.almostEquals=function(b,c){return void 0===c&&(c=1E-6),Math.abs(this.x-b.x)>c||Math.abs(this.y-b.y)> -c||Math.abs(this.z-b.z)>c?!1:!0};c.prototype.almostZero=function(b){return void 0===b&&(b=1E-6),Math.abs(this.x)>b||Math.abs(this.y)>b||Math.abs(this.z)>b?!1:!0};var l=new c;c.prototype.isAntiparallelTo=function(b,c){return this.negate(l),l.almostEquals(b,c)};c.prototype.clone=function(){return new c(this.x,this.y,this.z)}},{'./Mat3':27}],31:[function(b,d){function c(b){b=b||{};g.apply(this);this.id=c.idCounter++;this.postStep=this.preStep=this.world=null;this.vlambda=new h;this.collisionFilterGroup= -'number'==typeof b.collisionFilterGroup?b.collisionFilterGroup:1;this.collisionFilterMask='number'==typeof b.collisionFilterMask?b.collisionFilterMask:1;this.collisionResponse=!0;this.position=new h;b.position&&this.position.copy(b.position);this.previousPosition=new h;this.initPosition=new h;this.velocity=new h;b.velocity&&this.velocity.copy(b.velocity);this.initVelocity=new h;this.force=new h;var e='number'==typeof b.mass?b.mass:0;this.mass=e;this.invMass=0=e?c.STATIC:c.DYNAMIC;typeof b.type==typeof c.STATIC&&(this.type=b.type);this.allowSleep='undefined'!=typeof b.allowSleep?b.allowSleep:!0;this.sleepState=0;this.sleepSpeedLimit='undefined'!=typeof b.sleepSpeedLimit?b.sleepSpeedLimit:.1;this.sleepTimeLimit='undefined'!=typeof b.sleepTimeLimit?b.sleepTimeLimit:1;this.timeLastSleepy=0;this._wakeUpAfterNarrowphase=!1;this.torque=new h;this.quaternion=new l;b.quaternion&& -this.quaternion.copy(b.quaternion);this.initQuaternion=new l;this.angularVelocity=new h;b.angularVelocity&&this.angularVelocity.copy(b.angularVelocity);this.initAngularVelocity=new h;this.interpolatedPosition=new h;this.interpolatedQuaternion=new l;this.shapes=[];this.shapeOffsets=[];this.shapeOrientations=[];this.inertia=new h;this.invInertia=new h;this.invInertiaWorld=new k;this.invMassSolve=0;this.invInertiaSolve=new h;this.invInertiaWorldSolve=new k;this.fixedRotation='undefined'!=typeof b.fixedRotation? -b.fixedRotation:!1;this.angularDamping='undefined'!=typeof b.angularDamping?b.angularDamping:.01;this.aabb=new m;this.aabbNeedsUpdate=!0;this.wlambda=new h;b.shape&&this.addShape(b.shape);this.updateMassProperties()}d.exports=c;var g=b('../utils/EventTarget'),h=(b('../shapes/Shape'),b('../math/Vec3')),k=b('../math/Mat3'),l=b('../math/Quaternion'),m=(b('../material/Material'),b('../collision/AABB')),q=b('../shapes/Box');c.prototype=new g;c.prototype.constructor=c;c.DYNAMIC=1;c.STATIC=2;c.KINEMATIC= -4;c.AWAKE=0;c.SLEEPY=1;c.SLEEPING=2;c.idCounter=0;c.prototype.wakeUp=function(){var b=this.sleepState;this.sleepState=0;b===c.SLEEPING&&this.dispatchEvent({type:'wakeup'})};c.prototype.sleep=function(){this.sleepState=c.SLEEPING;this.velocity.set(0,0,0);this.angularVelocity.set(0,0,0)};c.sleepyEvent={type:'sleepy'};c.sleepEvent={type:'sleep'};c.prototype.sleepTick=function(b){if(this.allowSleep){var e=this.sleepState,d=this.velocity.norm2()+this.angularVelocity.norm2(),g=Math.pow(this.sleepSpeedLimit, -2);e===c.AWAKE&&g>d?(this.sleepState=c.SLEEPY,this.timeLastSleepy=b,this.dispatchEvent(c.sleepyEvent)):e===c.SLEEPY&&d>g?this.wakeUp():e===c.SLEEPY&&b-this.timeLastSleepy>this.sleepTimeLimit&&(this.sleep(),this.dispatchEvent(c.sleepEvent))}};c.prototype.updateSolveMassProperties=function(){this.sleepState===c.SLEEPING||this.type===c.KINEMATIC?(this.invMassSolve=0,this.invInertiaSolve.setZero(),this.invInertiaWorldSolve.setZero()):(this.invMassSolve=this.invMass,this.invInertiaSolve.copy(this.invInertia), -this.invInertiaWorldSolve.copy(this.invInertiaWorld))};c.prototype.pointToLocalFrame=function(b,c){c=c||new h;return b.vsub(this.position,c),this.quaternion.conjugate().vmult(c,c),c};c.prototype.vectorToLocalFrame=function(b,c){c=c||new h;return this.quaternion.conjugate().vmult(b,c),c};c.prototype.pointToWorldFrame=function(b,c){c=c||new h;return this.quaternion.vmult(b,c),c.vadd(this.position,c),c};c.prototype.vectorToWorldFrame=function(b,c){c=c||new h;return this.quaternion.vmult(b,c),c};var p= -new h,e=new l;c.prototype.addShape=function(b,c,e){var d=new h,g=new l;return c&&d.copy(c),e&&g.copy(e),this.shapes.push(b),this.shapeOffsets.push(d),this.shapeOrientations.push(g),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0,this};c.prototype.updateBoundingRadius=function(){for(var b=this.shapes,c=this.shapeOffsets,e=b.length,d=0,g=0;g!==e;g++){var h=b[g];h.updateBoundingSphereRadius();var k=c[g].norm();h=h.boundingSphereRadius;k+h>d&&(d=k+h)}this.boundingRadius= -d};var n=new m;c.prototype.computeAABB=function(){for(var b=this.shapes,c=this.shapeOffsets,d=this.shapeOrientations,g=b.length,h=this.quaternion,k=this.aabb,m=0;m!==g;m++){var l=b[m];d[m].mult(h,e);e.vmult(c[m],p);p.vadd(this.position,p);l.calculateWorldAABB(p,e,n.lowerBound,n.upperBound);0===m?k.copy(n):k.extend(n)}this.aabbNeedsUpdate=!1};var r=new k,t=new k;new k;c.prototype.updateInertiaWorld=function(b){var c=this.invInertia;if(c.x!==c.y||c.y!==c.z||b)r.setRotationFromQuaternion(this.quaternion), -r.transpose(t),r.scale(c,r),r.mmult(t,this.invInertiaWorld)};var D=new h,w=new h;c.prototype.applyForce=function(b,e){this.type===c.DYNAMIC&&(e.vsub(this.position,D),D.cross(b,w),this.force.vadd(b,this.force),this.torque.vadd(w,this.torque))};var u=new h,v=new h;c.prototype.applyLocalForce=function(b,e){this.type===c.DYNAMIC&&(this.vectorToWorldFrame(b,u),this.pointToWorldFrame(e,v),this.applyForce(u,v))};var z=new h,G=new h,I=new h;c.prototype.applyImpulse=function(b,e){this.type===c.DYNAMIC&&(e.vsub(this.position, -z),G.copy(b),G.mult(this.invMass,G),this.velocity.vadd(G,this.velocity),z.cross(b,I),this.invInertiaWorld.vmult(I,I),this.angularVelocity.vadd(I,this.angularVelocity))};var K=new h,H=new h;c.prototype.applyLocalImpulse=function(b,e){this.type===c.DYNAMIC&&(this.vectorToWorldFrame(b,K),this.pointToWorldFrame(e,H),this.applyImpulse(K,H))};var C=new h;c.prototype.updateMassProperties=function(){this.invMass=0g;g++)this.updateWheelTransform(g);this.currentVehicleSpeedKmHour=3.6*d.velocity.norm();g=new h;this.getVehicleAxisWorld(this.indexForwardAxis,g);0>g.dot(d.velocity)&&(this.currentVehicleSpeedKmHour*=-1);for(g=0;e>g;g++)this.castRay(c[g]);this.updateSuspension(b);var k=new h,m=new h;for(g=0;e>g;g++){var l=c[g],n=l.suspensionForce;n>l.maxSuspensionForce&&(n=l.maxSuspensionForce);l.raycastResult.hitNormalWorld.scale(n*b,k);l.raycastResult.hitPointWorld.vsub(d.position, -m);d.applyImpulse(k,l.raycastResult.hitPointWorld)}this.updateFriction(b);k=new h;m=new h;n=new h;for(g=0;e>g;g++){l=c[g];d.getVelocityAtWorldPoint(l.chassisConnectionPointWorld,n);var p=1;switch(this.indexUpAxis){case 1:p=-1}if(l.isInContact){this.getVehicleAxisWorld(this.indexForwardAxis,m);var q=m.dot(l.raycastResult.hitNormalWorld);l.raycastResult.hitNormalWorld.scale(q,k);m.vsub(k,m);q=m.dot(n);l.deltaRotation=p*q*b/l.radius}!l.sliding&&l.isInContact||0===l.engineForce||!l.useCustomSlidingRotationalSpeed|| -(l.deltaRotation=(0Math.abs(l.engineForce)&&(l.deltaRotation=0);l.rotation+=l.deltaRotation;l.deltaRotation*=.99}};c.prototype.updateSuspension=function(){for(var b=this.chassisBody.mass,c=this.wheelInfos,e=c.length,d=0;e>d;d++){var g=c[d];if(g.isInContact){var h=g.suspensionStiffness*(g.suspensionRestLength-g.suspensionLength)*g.clippedInvContactDotSuspension;var k=g.suspensionRelativeVelocity;h-=(0>k?g.dampingCompression:g.dampingRelaxation)* -k;g.suspensionForce=h*b;0>g.suspensionForce&&(g.suspensionForce=0)}else g.suspensionForce=0}};c.prototype.removeFromWorld=function(b){this.constraints;b.remove(this.chassisBody);b.removeEventListener('preStep',this.preStepCallback);this.world=null};var n=new h,r=new h;c.prototype.castRay=function(b){this.updateWheelTransformWorld(b);var c=this.chassisBody,e=-1;b.directionWorld.scale(b.suspensionRestLength+b.radius,n);var d=b.chassisConnectionPointWorld;d.vadd(n,r);var g=b.raycastResult;g.reset(); -var k=c.collisionResponse;c.collisionResponse=!1;this.world.rayTest(d,r,g);c.collisionResponse=k;d=g.body;(b.raycastResult.groundObject=0,d)?(e=g.distance,b.raycastResult.hitNormalWorld=g.hitNormalWorld,b.isInContact=!0,b.suspensionLength=g.distance-b.radius,g=b.suspensionRestLength-b.maxSuspensionTravel,d=b.suspensionRestLength+b.maxSuspensionTravel,b.suspensionLengthd&&(b.suspensionLength=d,b.raycastResult.reset()),g=b.raycastResult.hitNormalWorld.dot(b.directionWorld), -d=new h,c.getVelocityAtWorldPoint(b.raycastResult.hitPointWorld,d),c=b.raycastResult.hitNormalWorld.dot(d),-.1<=g?(b.suspensionRelativeVelocity=0,b.clippedInvContactDotSuspension=10):(g=-1/g,b.suspensionRelativeVelocity=c*g,b.clippedInvContactDotSuspension=g)):(b.suspensionLength=b.suspensionRestLength+0*b.maxSuspensionTravel,b.suspensionRelativeVelocity=0,b.directionWorld.scale(-1,b.raycastResult.hitNormalWorld),b.clippedInvContactDotSuspension=1);return e};c.prototype.updateWheelTransformWorld= -function(b){b.isInContact=!1;var c=this.chassisBody;c.pointToWorldFrame(b.chassisConnectionPointLocal,b.chassisConnectionPointWorld);c.vectorToWorldFrame(b.directionLocal,b.directionWorld);c.vectorToWorldFrame(b.axleLocal,b.axleWorld)};c.prototype.updateWheelTransform=function(b){b=this.wheelInfos[b];this.updateWheelTransformWorld(b);b.directionLocal.scale(-1,q);p.copy(b.axleLocal);q.cross(p,e);e.normalize();p.normalize();var c=b.steering,d=new k;d.setFromAxisAngle(q,c);c=new k;c.setFromAxisAngle(p, -b.rotation);var g=b.worldTransform.quaternion;this.chassisBody.quaternion.mult(d,g);g.mult(c,g);g.normalize();d=b.worldTransform.position;d.copy(b.directionWorld);d.scale(b.suspensionLength,d);d.vadd(b.chassisConnectionPointWorld,d)};var t=[new h(1,0,0),new h(0,1,0),new h(0,0,1)];c.prototype.getWheelTransformWorld=function(b){return this.wheelInfos[b].worldTransform};var D=new h,w=[],u=[];c.prototype.updateFriction=function(b){for(var c=this.wheelInfos,e=c.length,d=this.chassisBody,k=0,m=0;e>m;m++){var l= -c[m],n=l.raycastResult.body;n&&k++;l.sideImpulse=0;l.forwardImpulse=0;u[m]||(u[m]=new h);w[m]||(w[m]=new h)}for(m=0;e>m;m++)if(l=c[m],n=l.raycastResult.body){var p=w[m];this.getWheelTransformWorld(m).vectorToWorldFrame(t[this.indexRightAxis],p);k=l.raycastResult.hitNormalWorld;var q=p.dot(k);k.scale(q,D);p.vsub(D,p);p.normalize();k.cross(p,u[m]);u[m].normalize();k=l;q=d;var r=l.raycastResult.hitPointWorld,H=l.raycastResult.hitPointWorld;if(1.1m;m++){l=c[m];n=l.raycastResult.body;r=0;if(l.slipInfo=1,n){k=l.brake?l.brake:0;K=d;H=n;p=l.raycastResult.hitPointWorld;C=u[m];r=k;q=0;I=p;var fa=v,ha=z,ka=G;K.getVelocityAtWorldPoint(I,fa);H.getVelocityAtWorldPoint(I,ha);fa.vsub(ha,ka);I=C.dot(ka);K=g(K,p,C);H=g(H,p,C);r=(q=1/(K+H)*-I,q>r&&(q=r),-r>q&&(q=-r),q);r+=l.engineForce*b;k/=r;l.slipInfo*=k}if(l.forwardImpulse= -0,l.skidInfo=1,n)if(l.skidInfo=1,n=l.suspensionForce*b*l.frictionSlip,k=n*n,l.forwardImpulse=r,q=.5*l.forwardImpulse,r=1*l.sideImpulse,q=q*q+r*r,l.sliding=!1,q>k)this.sliding=!0,l.sliding=!0,k=n/Math.sqrt(q),l.skidInfo*=k}if(this.sliding)for(m=0;e>m;m++)l=c[m],0!==l.sideImpulse&&1>l.skidInfo&&(l.forwardImpulse*=l.skidInfo,l.sideImpulse*=l.skidInfo);for(m=0;e>m;m++){l=c[m];b=new h;if(b.copy(l.raycastResult.hitPointWorld),0!==l.forwardImpulse)n=new h,u[m].scale(l.forwardImpulse,n),d.applyImpulse(n, -b);0!==l.sideImpulse&&(n=l.raycastResult.body,k=new h,k.copy(l.raycastResult.hitPointWorld),q=new h,w[m].scale(l.sideImpulse,q),d.pointToLocalFrame(b,b),b['xyz'[this.indexUpAxis]]*=l.rollInfluence,d.pointToWorldFrame(b,b),d.applyImpulse(q,b),q.scale(-1,q),n.applyImpulse(q,k))}};var v=new h,z=new h,G=new h,I=new h,K=new h,H=new h,C=new h,P=new h,Q=new h,T=new h},{'../collision/Ray':9,'../collision/RaycastResult':10,'../math/Quaternion':28,'../math/Vec3':30,'../objects/WheelInfo':36,'./Body':31}],33:[function(b, -d){function c(b){(this.wheelBodies=[],this.coordinateSystem='undefined'==typeof b.coordinateSystem?new l(1,2,3):b.coordinateSystem.clone(),this.chassisBody=b.chassisBody,this.chassisBody)||(b=new k(new l(5,2,.5)),this.chassisBody=new g(1,b));this.constraints=[];this.wheelAxes=[];this.wheelForces=[]}var g=b('./Body'),h=b('../shapes/Sphere'),k=b('../shapes/Box'),l=b('../math/Vec3'),m=b('../constraints/HingeConstraint');d.exports=c;c.prototype.addWheel=function(b){b=b||{};var c=b.body;c||(c=new g(1, -new h(1.2)));this.wheelBodies.push(c);this.wheelForces.push(0);var e=(new l,'undefined'!=typeof b.position?b.position.clone():new l),d=new l;this.chassisBody.pointToWorldFrame(e,d);c.position.set(d.x,d.y,d.z);b='undefined'!=typeof b.axis?b.axis.clone():new l(0,1,0);this.wheelAxes.push(b);c=new m(this.chassisBody,c,{pivotA:e,axisA:b,pivotB:l.ZERO,axisB:b,collideConnected:!1});return this.constraints.push(c),this.wheelBodies.length-1};c.prototype.setSteeringValue=function(b,c){var e=this.wheelAxes[c], -d=Math.cos(b);b=Math.sin(b);var g=e.x;e=e.y;this.constraints[c].axisA.set(d*g-b*e,b*g+d*e,0)};c.prototype.setMotorSpeed=function(b,c){c=this.constraints[c];c.enableMotor();c.motorTargetVelocity=b};c.prototype.disableMotor=function(b){this.constraints[b].disableMotor()};var q=new l;c.prototype.setWheelForce=function(b,c){this.wheelForces[c]=b};c.prototype.applyWheelForce=function(b,c){var e=this.wheelBodies[c],d=e.torque;this.wheelAxes[c].scale(b,q);e.vectorToWorldFrame(q,q);d.vadd(q,d)};c.prototype.addToWorld= -function(b){for(var c=this.constraints,e=this.wheelBodies.concat([this.chassisBody]),d=0;dthis.particles.length&&this.neighbors.pop())};var g=new d;c.prototype.getNeighbors=function(b,c){for(var e=this.particles.length,d=b.id,h=this.smoothingRadius* -this.smoothingRadius,k=0;k!==e;k++){var m=this.particles[k];m.position.vsub(b.position,g);d!==m.id&&g.norm2()h.x&&(h.x=l.x);l.xh.y&&(h.y=l.y);l.yh.z&&(h.z=l.z);l.zc&&(this.lowerBound.x=c);c=b.upperBound.x;this.upperBound.xc&&(this.lowerBound.y=c);c=b.upperBound.y;this.upperBound.yc&&(this.lowerBound.z=c);c=b.upperBound.z;this.upperBound.z=b.x&&c.y<=e.y&&d.y>= +b.y&&c.z<=e.z&&d.z>=b.z};d.prototype.getCorners=function(b,c,d,e,g,h,k,u){var m=this.lowerBound,l=this.upperBound;b.copy(m);c.set(l.x,m.y,m.z);d.set(l.x,l.y,m.z);e.set(m.x,l.y,l.z);g.set(l.x,m.y,m.z);h.set(m.x,l.y,m.z);k.set(m.x,m.y,l.z);u.copy(l)};var h=[new c,new c,new c,new c,new c,new c,new c,new c];d.prototype.toLocalFrame=function(b,c){this.getCorners(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7]);for(var d=0;8!==d;d++){var e=h[d];b.pointToLocal(e,e)}return c.setFromPoints(h)};d.prototype.toWorldFrame= +function(b,c){this.getCorners(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7]);for(var d=0;8!==d;d++){var e=h[d];b.pointToWorld(e,e)}return c.setFromPoints(h)}},{'../math/Vec3':30,'../utils/Utils':53}],4:[function(b,e){function d(){this.matrix=[]}e.exports=d;d.prototype.get=function(b,d){if(b=b.index,d=d.index,d>b){var c=d;d=b;b=c}return this.matrix[(b*(b+1)>>1)+d-1]};d.prototype.set=function(b,d,e){if(b=b.index,d=d.index,d>b){var c=d;d=b;b=c}this.matrix[(b*(b+1)>>1)+d-1]=e?1:0};d.prototype.reset=function(){for(var b= +0,d=this.matrix.length;b!==d;b++)this.matrix[b]=0};d.prototype.setNumObjects=function(b){this.matrix.length=b*(b-1)>>1}},{}],5:[function(b,e){function d(){this.world=null;this.useBoundingBoxes=!1;this.dirty=!0}var c=b('../objects/Body'),k=b('../math/Vec3'),h=b('../math/Quaternion');b('../shapes/Shape');b('../shapes/Plane');e.exports=d;d.prototype.collisionPairs=function(){throw Error('collisionPairs not implemented for this BroadPhase class!');};var l=c.STATIC|c.KINEMATIC;d.prototype.needBroadphaseCollision= +function(b,g){return 0===(b.collisionFilterGroup&g.collisionFilterMask)||0===(g.collisionFilterGroup&b.collisionFilterMask)?!1:0===(b.type&l)&&b.sleepState!==c.SLEEPING||0===(g.type&l)&&g.sleepState!==c.SLEEPING?!0:!1};d.prototype.intersectionTest=function(b,g,c,d){this.useBoundingBoxes?this.doBoundingBoxBroadphase(b,g,c,d):this.doBoundingSphereBroadphase(b,g,c,d)};var n=new k;new k;new h;new k;d.prototype.doBoundingSphereBroadphase=function(b,g,c,d){g.position.vsub(b.position,n);var e=Math.pow(b.boundingRadius+ +g.boundingRadius,2),h=n.norm2();e>h&&(c.push(b),d.push(g))};d.prototype.doBoundingBoxBroadphase=function(b,g,c,d){b.aabbNeedsUpdate&&b.computeAABB();g.aabbNeedsUpdate&&g.computeAABB();b.aabb.overlaps(g.aabb)&&(c.push(b),d.push(g))};var q={keys:[]},m=[],g=[];d.prototype.makePairsUnique=function(b,c){for(var d=b.length,e=0;e!==d;e++)m[e]=b[e],g[e]=c[e];b.length=0;for(e=c.length=0;e!==d;e++){var h=m[e].id,k=g[e].id;h=k>h?h+','+k:k+','+h;q[h]=e;q.keys.push(h)}for(e=0;e!==q.keys.length;e++)h=q.keys.pop(), +d=q[h],b.push(m[d]),c.push(g[d]),delete q[h]};d.prototype.setWorld=function(){};var p=new k;d.boundingSphereCheck=function(b,g){return b.position.vsub(g.position,p),Math.pow(b.shape.boundingSphereRadius+g.shape.boundingSphereRadius,2)>p.norm2()};d.prototype.aabbQuery=function(){return console.warn('.aabbQuery is not implemented in this Broadphase subclass.'),[]}},{'../math/Quaternion':28,'../math/Vec3':30,'../objects/Body':31,'../shapes/Plane':42,'../shapes/Shape':43}],6:[function(b,e){function d(b, +d,e,g,h){c.apply(this);this.nx=e||10;this.ny=g||10;this.nz=h||10;this.aabbMin=b||new k(100,100,100);this.aabbMax=d||new k(-100,-100,-100);b=this.nx*this.ny*this.nz;if(0>=b)throw"GridBroadphase: Each dimension's n must be >0";this.bins=[];this.binLengths=[];this.bins.length=b;this.binLengths.length=b;for(d=0;b>d;d++)this.bins[d]=[],this.binLengths[d]=0}e.exports=d;var c=b('./Broadphase'),k=b('../math/Vec3'),h=b('../shapes/Shape');d.prototype=new c;d.prototype.constructor=d;var l=new k;new k;d.prototype.collisionPairs= +function(b,c,d){function g(b,g,c,d,e,h,k){b=(b-D)*X|0;g=(g-Q)*ka|0;c=(c-M)*ja|0;d=R((d-D)*X);e=R((e-Q)*ka);h=R((h-M)*ja);0>b?b=0:b>=n&&(b=n-1);0>g?g=0:g>=q&&(g=q-1);0>c?c=0:c>=t&&(c=t-1);0>d?d=0:d>=n&&(d=n-1);0>e?e=0:e>=q&&(e=q-1);0>h?h=0:h>=t&&(h=t-1);b*=z;g*=w;c*=I;d*=z;e*=w;for(h*=I;d>=b;b+=z)for(var m=g;e>=m;m+=w)for(var l=c;h>=l;l+=I){var p=b+m+l;aa[p][da[p]++]=k}}var e=b.numObjects();b=b.bodies;var k=this.aabbMax,m=this.aabbMin,n=this.nx,q=this.ny,t=this.nz,z=q*t,w=t,I=1,H=k.x,K=k.y,C=k.z,D= +m.x,Q=m.y,M=m.z,X=n/(H-D),ka=q/(K-Q),ja=t/(C-M);H=(H-D)/n;var ba=(K-Q)/q;C=(C-M)/t;var N=.5*Math.sqrt(H*H+ba*ba+C*C);K=h.types;var la=K.SPHERE,T=K.PLANE,aa=(K.BOX,K.COMPOUND,K.CONVEXPOLYHEDRON,this.bins),da=this.binLengths;K=this.bins.length;for(m=0;m!==K;m++)da[m]=0;var R=Math.ceil;m=Math.min;k=Math.max;for(m=0;m!==e;m++){k=b[m];var ra=k.shape;switch(ra.type){case la:var pa=k.position.x,fa=k.position.y,oa=k.position.z;ra=ra.radius;g(pa-ra,fa-ra,oa-ra,pa+ra,fa+ra,oa+ra,k);break;case T:ra.worldNormalNeedsUpdate&& +ra.computeWorldNormal(k.quaternion);oa=ra.worldNormal;ra=Q+.5*ba-k.position.y;var ma=M+.5*C-k.position.z,O=l;O.set(D+.5*H-k.position.x,ra,ma);for(var ya=pa=0;pa!==n;pa++,ya+=z,O.y=ra,O.x+=H)for(var ea=fa=0;fa!==q;fa++,ea+=w,O.z=ma,O.y+=ba)for(var qa=0,wa=0;qa!==t;qa++,wa+=I,O.z+=C)if(O.dot(oa)b){var c=d;d=b;b=c}return b+'-'+d in this.matrix};d.prototype.set=function(b,d,e){if(b=b.id,d=d.id, +d>b){var c=d;d=b;b=c}e?this.matrix[b+'-'+d]=!0:delete this.matrix[b+'-'+d]};d.prototype.reset=function(){this.matrix={}};d.prototype.setNumObjects=function(){}},{}],9:[function(b,e){function d(b,g){this.from=b?b.clone():new k;this.to=g?g.clone():new k;this._direction=new k;this.precision=1E-4;this.checkCollisionResponse=!0;this.skipBackfaces=!1;this.collisionFilterGroup=this.collisionFilterMask=-1;this.mode=d.ANY;this.result=new l;this.hasHit=!1;this.callback=function(){}}function c(b,c,d,e){e.vsub(c, +la);d.vsub(c,g);b.vsub(c,p);var h,k;b=la.dot(la);c=la.dot(g);d=la.dot(p);e=g.dot(g);var m=g.dot(p);return 0<=(h=e*d-c*m)&&0<=(k=b*m-c*d)&&b*e-c*c>h+k}e.exports=d;var k=b('../math/Vec3');e=b('../math/Quaternion');var h=b('../math/Transform'),l=(b('../shapes/ConvexPolyhedron'),b('../shapes/Box'),b('../collision/RaycastResult')),n=b('../shapes/Shape');b=b('../collision/AABB');d.prototype.constructor=d;d.CLOSEST=1;d.ANY=2;d.ALL=4;var q=new b,m=[];d.prototype.intersectWorld=function(b,g){return this.mode= +g.mode||d.ANY,this.result=g.result||new l,this.skipBackfaces=!!g.skipBackfaces,this.collisionFilterMask='undefined'!=typeof g.collisionFilterMask?g.collisionFilterMask:-1,this.collisionFilterGroup='undefined'!=typeof g.collisionFilterGroup?g.collisionFilterGroup:-1,g.from&&this.from.copy(g.from),g.to&&this.to.copy(g.to),this.callback=g.callback||function(){},this.hasHit=!1,this.result.reset(),this._updateDirection(),this.getAABB(q),m.length=0,b.broadphase.aabbQuery(b,q,m),this.intersectBodies(m), +this.hasHit};var g=new k,p=new k;d.pointInTriangle=c;var r=new k,u=new e;d.prototype.intersectBody=function(b,g){g&&(this.result=g,this._updateDirection());g=this.checkCollisionResponse;if((!g||b.collisionResponse)&&0!==(this.collisionFilterGroup&b.collisionFilterMask)&&0!==(b.collisionFilterGroup&this.collisionFilterMask))for(var c=0,d=b.shapes.length;d>c;c++){var e=b.shapes[c];if((!g||e.collisionResponse)&&(b.quaternion.mult(b.shapeOrientations[c],u),b.quaternion.vmult(b.shapeOffsets[c],r),r.vadd(b.position, +r),this.intersectShape(e,u,r,b),this.result._shouldStop))break}};d.prototype.intersectBodies=function(b,g){g&&(this.result=g,this._updateDirection());g=0;for(var c=b.length;!this.result._shouldStop&&c>g;g++)this.intersectBody(b[g])};d.prototype._updateDirection=function(){this.to.vsub(this.from,this._direction);this._direction.normalize()};d.prototype.intersectShape=function(b,g,c,d){var e=this.from,h=this._direction;c.vsub(e,la);var k=la.dot(h);h.mult(k,T);T.vadd(e,T);c.distanceTo(T)>b.boundingSphereRadius|| +(e=this[b.type])&&e.call(this,b,g,c,d)};var E=(new k,new k,new k),v=new k,t=new k,z=new k;new k;new l;d.prototype.intersectBox=function(b,g,c,d){return this.intersectConvex(b.convexPolyhedronRepresentation,g,c,d)};d.prototype[n.types.BOX]=d.prototype.intersectBox;d.prototype.intersectPlane=function(b,g,c,d){var e=this.from,h=this.to,m=this._direction,l=new k(0,0,1);g.vmult(l,l);var p=new k;e.vsub(c,p);g=p.dot(l);h.vsub(c,p);p=p.dot(l);if(!(0t)&&(t=p[0]),(null===q||p[1]r)&&(r=p[1])),null!==n)for(l=[],b.getRectMinMax(n,q,t,r,l),n=(l[0],l[1],n);t>=n;n++)for(l=q;r>=l;l++){if(this.result._shouldStop|| +(b.getConvexTrianglePillar(n,l,!1),h.pointToWorldFrame(c,g,b.pillarOffset,m),this.intersectConvex(b.pillarConvex,g,m,e,w),this.result._shouldStop))return;b.getConvexTrianglePillar(n,l,!0);h.pointToWorldFrame(c,g,b.pillarOffset,m);this.intersectConvex(b.pillarConvex,g,m,e,w)}};d.prototype[n.types.HEIGHTFIELD]=d.prototype.intersectHeightfield;var I=new k,H=new k;d.prototype.intersectSphere=function(b,g,c,d){g=this.from;var e=this.to,h=Math.pow(e.x-g.x,2)+Math.pow(e.y-g.y,2)+Math.pow(e.z-g.z,2),k=2* +((e.x-g.x)*(g.x-c.x)+(e.y-g.y)*(g.y-c.y)+(e.z-g.z)*(g.z-c.z)),m=Math.pow(k,2)-4*h*(Math.pow(g.x-c.x,2)+Math.pow(g.y-c.y,2)+Math.pow(g.z-c.z,2)-Math.pow(b.radius,2));if(!(0>m))if(0===m)g.lerp(e,m,I),I.vsub(c,H),H.normalize(),this.reportIntersection(H,I,b,d,-1);else{var l=(-k-Math.sqrt(m))/(2*h);h=(-k+Math.sqrt(m))/(2*h);(0<=l&&1>=l&&(g.lerp(e,l,I),I.vsub(c,H),H.normalize(),this.reportIntersection(H,I,b,d,-1)),this.result._shouldStop)||0<=h&&1>=h&&(g.lerp(e,h,I),I.vsub(c,H),H.normalize(),this.reportIntersection(H, +I,b,d,-1))}};d.prototype[n.types.SPHERE]=d.prototype.intersectSphere;var K=new k,C=(new k,new k,new k);d.prototype.intersectConvex=function(b,g,d,e,h){h=h&&h.faceList||null;for(var k=b.faces,m=b.vertices,l=b.faceNormals,p=this._direction,n=this.from,q=n.distanceTo(this.to),r=h?h.length:k.length,u=this.result,w=0;!u._shouldStop&&r>w;w++){var D=h?h[w]:w,S=k[D],I=l[D],H=g,Q=d;C.copy(m[S[0]]);H.vmult(C,C);C.vadd(Q,C);C.vsub(n,C);H.vmult(I,K);I=p.dot(K);if(!(Math.abs(I) +I)))for(p.mult(I,E),E.vadd(n,E),v.copy(m[S[0]]),H.vmult(v,v),Q.vadd(v,v),I=1;!u._shouldStop&&Iq||this.reportIntersection(K,E,b,e,D)}}};d.prototype[n.types.CONVEXPOLYHEDRON]=d.prototype.intersectConvex;var D=new k,Q=new k,M=new k,X=new k,ka=new k,ja=new k,ba=(new b,[]),N=new h;d.prototype.intersectTrimesh=function(b,g,d,e,k){k=(k&&k.faceList||null,b.indices); +var m=(b.vertices,b.faceNormals,this.from),l=this.to,p=this._direction;N.position.copy(d);N.quaternion.copy(g);h.vectorToLocalFrame(d,g,p,Q);h.pointToLocalFrame(d,g,m,M);h.pointToLocalFrame(d,g,l,X);m=M.distanceSquared(X);b.tree.rayQuery(this,N,ba);l=0;for(p=ba.length;!this.result._shouldStop&&l!==p;l++){var n=ba[l];b.getNormal(n,D);b.getVertex(k[3*n],v);v.vsub(M,C);var q=Q.dot(D);q=D.dot(C)/q;0>q||(Q.scale(q,E),E.vadd(M,E),b.getVertex(k[3*n+1],t),b.getVertex(k[3*n+2],z),q=E.distanceSquared(M),!c(E, +t,v,z)&&!c(E,v,t,z)||q>m||(h.vectorToWorldFrame(g,D,ka),h.pointToWorldFrame(d,g,E,ja),this.reportIntersection(ka,ja,b,e,n)))}ba.length=0};d.prototype[n.types.TRIMESH]=d.prototype.intersectTrimesh;d.prototype.reportIntersection=function(b,g,c,e,h){var k=this.from,m=this.to,l=k.distanceTo(g),p=this.result;if(!(this.skipBackfaces&&0c;c++){for(var e=b[c],k=c-1;0<=k&&!(b[k].aabb.lowerBound.x<=e.aabb.lowerBound.x);k--)b[k+1]=b[k];b[k+1]=e}return b};d.insertionSortY= +function(b){for(var c=1,d=b.length;d>c;c++){for(var e=b[c],k=c-1;0<=k&&!(b[k].aabb.lowerBound.y<=e.aabb.lowerBound.y);k--)b[k+1]=b[k];b[k+1]=e}return b};d.insertionSortZ=function(b){for(var c=1,d=b.length;d>c;c++){for(var e=b[c],k=c-1;0<=k&&!(b[k].aabb.lowerBound.z<=e.aabb.lowerBound.z);k--)b[k+1]=b[k];b[k+1]=e}return b};d.prototype.collisionPairs=function(b,c,e){var h,k=this.axisList,m=k.length,g=this.axisIndex;this.dirty&&(this.sortList(),this.dirty=!1);for(b=0;b!==m;b++){var l=k[b];for(h=b+1;m> +h;h++){var r=k[h];if(this.needBroadphaseCollision(l,r)){if(!d.checkBounds(l,r,g))break;this.intersectionTest(l,r,c,e)}}}};d.prototype.sortList=function(){for(var b=this.axisList,c=this.axisIndex,e=b.length,n=0;n!==e;n++){var q=b[n];q.aabbNeedsUpdate&&q.computeAABB()}0===c?d.insertionSortX(b):1===c?d.insertionSortY(b):2===c&&d.insertionSortZ(b)};d.checkBounds=function(b,c,d){var e,h;0===d?(e=b.position.x,h=c.position.x):1===d?(e=b.position.y,h=c.position.y):2===d&&(e=b.position.z,h=c.position.z);return e+ +b.boundingRadius>h-c.boundingRadius};d.prototype.autoDetectAxis=function(){for(var b=0,c=0,d=0,e=0,q=0,m=0,g=this.axisList,p=g.length,r=1/p,u=0;u!==p;u++){var E=g[u],v=E.position.x;b+=v;c+=v*v;v=E.position.y;d+=v;e+=v*v;E=E.position.z;q+=E;m+=E*E}b=c-b*b*r;d=e-d*d*r;q=m-q*q*r;this.axisIndex=b>d?b>q?0:2:d>q?1:2};d.prototype.aabbQuery=function(b,c,d){d=d||[];this.dirty&&(this.sortList(),this.dirty=!1);b=this.axisIndex;var e='x';1===b&&(e='y');2===b&&(e='z');b=this.axisList;for(e=(c.lowerBound[e],c.upperBound[e], +0);ee;e++)for(var h=0;3>h;h++){for(var k=0,m=0;3>m;m++)k+=b.elements[e+3*m]*this.elements[m+3*h];c.elements[e+3*h]=k}return c};d.prototype.scale=function(b,c){c=c||new d;for(var e=this.elements,h=c.elements,k=0;3!==k;k++)h[3*k]=b.x*e[3*k],h[3*k+1]=b.y*e[3*k+1],h[3*k+2]=b.z*e[3*k+2];return c};d.prototype.solve=function(b,d){d=d||new c;for(var e=[],h=0;12>h;h++)e.push(0);var k;for(h=0;3>h;h++)for(k= +0;3>k;k++)e[h+4*k]=this.elements[h+3*k];e[3]=b.x;e[7]=b.y;e[11]=b.z;var m=3,g=m;do{if(h=g-m,0===e[h+4*h])for(k=h+1;g>k;k++)if(0!==e[h+4*k]){var p=4;do{var r=4-p;e[r+4*h]+=e[r+4*k]}while(--p);break}if(0!==e[h+4*h])for(k=h+1;g>k;k++){var u=e[h+4*k]/e[h+4*h];p=4;do r=4-p,e[r+4*k]=h>=r?0:e[r+4*k]-e[r+4*h]*u;while(--p)}}while(--m);if(d.z=e[11]/e[10],d.y=(e[7]-e[6]*d.z)/e[5],d.x=(e[3]-e[2]*d.z-e[1]*d.y)/e[0],isNaN(d.x)||isNaN(d.y)||isNaN(d.z)||1/0===d.x||1/0===d.y||1/0===d.z)throw'Could not solve equation! Got x=['+ +d.toString()+'], b=['+b.toString()+'], A=['+this.toString()+']';return d};d.prototype.e=function(b,c,d){return void 0===d?this.elements[c+3*b]:void(this.elements[c+3*b]=d)};d.prototype.copy=function(b){for(var c=0;cc;c++)b+=this.elements[c]+',';return b};d.prototype.reverse=function(b){b=b||new d;for(var c=[],e=0;18>e;e++)c.push(0);var k;for(e=0;3>e;e++)for(k=0;3>k;k++)c[e+6*k]=this.elements[e+ +3*k];c[3]=1;c[9]=0;c[15]=0;c[4]=0;c[10]=1;c[16]=0;c[5]=0;c[11]=0;c[17]=1;var q=3,m=q;do{if(e=m-q,0===c[e+6*e])for(k=e+1;m>k;k++)if(0!==c[e+6*k]){var g=6;do{var p=6-g;c[p+6*e]+=c[p+6*k]}while(--g);break}if(0!==c[e+6*e])for(k=e+1;m>k;k++){var r=c[e+6*k]/c[e+6*e];g=6;do p=6-g,c[p+6*k]=e>=p?0:c[p+6*k]-c[p+6*e]*r;while(--g)}}while(--q);e=2;do{k=e-1;do{r=c[e+6*k]/c[e+6*e];g=6;do p=6-g,c[p+6*k]-=c[p+6*e]*r;while(--g)}while(k--)}while(--e);e=2;do{r=1/c[e+6*e];g=6;do p=6-g,c[p+6*e]*=r;while(--g)}while(e--); +e=2;do{k=2;do{if(p=c[3+k+6*e],isNaN(p)||1/0===p)throw'Could not reverse! A=['+this.toString()+']';b.e(e,k,p)}while(k--)}while(e--);return b};d.prototype.setRotationFromQuaternion=function(b){var c=b.x,d=b.y,e=b.z,k=b.w,m=c+c,g=d+d,p=e+e;b=c*m;var r=c*g;c*=p;var u=d*g;d*=p;e*=p;m*=k;g*=k;k*=p;p=this.elements;return p[0]=1-(u+e),p[1]=r-k,p[2]=c+g,p[3]=r+k,p[4]=1-(b+e),p[5]=d-m,p[6]=c-g,p[7]=d+m,p[8]=1-(b+u),this};d.prototype.transpose=function(b){b=b||new d;for(var c=b.elements,e=this.elements,k=0;3!== +k;k++)for(var q=0;3!==q;q++)c[3*k+q]=e[3*q+k];return b}},{'./Vec3':30}],28:[function(b,e){function d(b,g,c,d){this.x=void 0!==b?b:0;this.y=void 0!==g?g:0;this.z=void 0!==c?c:0;this.w=void 0!==d?d:1}e.exports=d;var c=b('./Vec3');d.prototype.set=function(b,g,c,d){this.x=b;this.y=g;this.z=c;this.w=d};d.prototype.toString=function(){return this.x+','+this.y+','+this.z+','+this.w};d.prototype.toArray=function(){return[this.x,this.y,this.z,this.w]};d.prototype.setFromAxisAngle=function(b,g){var c=Math.sin(.5* +g);this.x=b.x*c;this.y=b.y*c;this.z=b.z*c;this.w=Math.cos(.5*g)};d.prototype.toAxisAngle=function(b){b=b||new c;this.normalize();var g=2*Math.acos(this.w),d=Math.sqrt(1-this.w*this.w);return.001>d?(b.x=this.x,b.y=this.y,b.z=this.z):(b.x=this.x/d,b.y=this.y/d,b.z=this.z/d),[b,g]};var k=new c,h=new c;d.prototype.setFromVectors=function(b,g){if(b.isAntiparallelTo(g))b.tangents(k,h),this.setFromAxisAngle(k,Math.PI);else{var c=b.cross(g);this.x=c.x;this.y=c.y;this.z=c.z;this.w=Math.sqrt(Math.pow(b.norm(), +2)*Math.pow(g.norm(),2))+b.dot(g);this.normalize()}};var l=new c,n=new c,q=new c;d.prototype.mult=function(b,g){g=g||new d;var c=this.w;return l.set(this.x,this.y,this.z),n.set(b.x,b.y,b.z),g.w=c*b.w-l.dot(n),l.cross(n,q),g.x=c*n.x+b.w*l.x+q.x,g.y=c*n.y+b.w*l.y+q.y,g.z=c*n.z+b.w*l.z+q.z,g};d.prototype.inverse=function(b){var g=this.x,c=this.y,e=this.z,h=this.w;b=b||new d;this.conjugate(b);g=1/(g*g+c*c+e*e+h*h);return b.x*=g,b.y*=g,b.z*=g,b.w*=g,b};d.prototype.conjugate=function(b){return b=b||new d, +b.x=-this.x,b.y=-this.y,b.z=-this.z,b.w=this.w,b};d.prototype.normalize=function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===b?(this.x=0,this.y=0,this.z=0,this.w=0):(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b)};d.prototype.normalizeFast=function(){var b=(3-(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w))/2;0===b?(this.x=0,this.y=0,this.z=0,this.w=0):(this.x*=b,this.y*=b,this.z*=b,this.w*=b)};d.prototype.vmult=function(b,g){g=g||new c;var d=b.x,e=b.y, +h=b.z;b=this.x;var k=this.y,m=this.z,l=this.w,n=l*d+k*h-m*e,q=l*e+m*d-b*h,I=l*h+b*e-k*d;d=-b*d-k*e-m*h;return g.x=n*l+d*-b+q*-m-I*-k,g.y=q*l+d*-k+I*-b-n*-m,g.z=I*l+d*-m+n*-k-q*-b,g};d.prototype.copy=function(b){return this.x=b.x,this.y=b.y,this.z=b.z,this.w=b.w,this};d.prototype.toEuler=function(b,g){g=g||'YZX';var c,d,e,h=this.x,k=this.y,m=this.z,l=this.w;switch(g){case 'YZX':g=h*k+m*l;if(.499g&&(c=-2*Math.atan2(h,l),d=-Math.PI/2,e=0),isNaN(c))e=m* +m,c=Math.atan2(2*k*l-2*h*m,1-2*k*k-2*e),d=Math.asin(2*g),e=Math.atan2(2*h*l-2*k*m,1-2*h*h-2*e);break;default:throw Error('Euler order '+g+' not supported yet.');}b.y=c;b.z=d;b.x=e};d.prototype.setFromEuler=function(b,g,c,d){d=d||'XYZ';var e=Math.cos(b/2),h=Math.cos(g/2),k=Math.cos(c/2);b=Math.sin(b/2);g=Math.sin(g/2);c=Math.sin(c/2);return'XYZ'===d?(this.x=b*h*k+e*g*c,this.y=e*g*k-b*h*c,this.z=e*h*c+b*g*k,this.w=e*h*k-b*g*c):'YXZ'===d?(this.x=b*h*k+e*g*c,this.y=e*g*k-b*h*c,this.z=e*h*c-b*g*k,this.w= +e*h*k+b*g*c):'ZXY'===d?(this.x=b*h*k-e*g*c,this.y=e*g*k+b*h*c,this.z=e*h*c+b*g*k,this.w=e*h*k-b*g*c):'ZYX'===d?(this.x=b*h*k-e*g*c,this.y=e*g*k+b*h*c,this.z=e*h*c-b*g*k,this.w=e*h*k+b*g*c):'YZX'===d?(this.x=b*h*k+e*g*c,this.y=e*g*k+b*h*c,this.z=e*h*c-b*g*k,this.w=e*h*k-b*g*c):'XZY'===d&&(this.x=b*h*k-e*g*c,this.y=e*g*k-b*h*c,this.z=e*h*c+b*g*k,this.w=e*h*k+b*g*c),this};d.prototype.clone=function(){return new d(this.x,this.y,this.z,this.w)}},{'./Vec3':30}],29:[function(b,e){function d(b){b=b||{};this.position= +new c;b.position&&this.position.copy(b.position);this.quaternion=new k;b.quaternion&&this.quaternion.copy(b.quaternion)}var c=b('./Vec3'),k=b('./Quaternion');e.exports=d;var h=new k;d.pointToLocalFrame=function(b,d,e,k){k=k||new c;return e.vsub(b,k),d.conjugate(h),h.vmult(k,k),k};d.prototype.pointToLocal=function(b,c){return d.pointToLocalFrame(this.position,this.quaternion,b,c)};d.pointToWorldFrame=function(b,d,e,h){h=h||new c;return d.vmult(e,h),h.vadd(b,h),h};d.prototype.pointToWorld=function(b, +c){return d.pointToWorldFrame(this.position,this.quaternion,b,c)};d.prototype.vectorToWorldFrame=function(b,d){d=d||new c;return this.quaternion.vmult(b,d),d};d.vectorToWorldFrame=function(b,c,d){return b.vmult(c,d),d};d.vectorToLocalFrame=function(b,d,e,h){h=h||new c;return d.w*=-1,d.vmult(e,h),d.w*=-1,h}},{'./Quaternion':28,'./Vec3':30}],30:[function(b,e){function d(b,c,d){this.x=b||0;this.y=c||0;this.z=d||0}e.exports=d;var c=b('./Mat3');d.ZERO=new d(0,0,0);d.UNIT_X=new d(1,0,0);d.UNIT_Y=new d(0, +1,0);d.UNIT_Z=new d(0,0,1);d.prototype.cross=function(b,c){var e=b.x,g=b.y;b=b.z;var h=this.x,k=this.y,l=this.z;return c=c||new d,c.x=k*b-l*g,c.y=l*e-h*b,c.z=h*g-k*e,c};d.prototype.set=function(b,c,d){return this.x=b,this.y=c,this.z=d,this};d.prototype.setZero=function(){this.x=this.y=this.z=0};d.prototype.vadd=function(b,c){return c?(c.x=b.x+this.x,c.y=b.y+this.y,c.z=b.z+this.z,void 0):new d(this.x+b.x,this.y+b.y,this.z+b.z)};d.prototype.vsub=function(b,c){return c?(c.x=this.x-b.x,c.y=this.y-b.y, +c.z=this.z-b.z,void 0):new d(this.x-b.x,this.y-b.y,this.z-b.z)};d.prototype.crossmat=function(){return new c([0,-this.z,this.y,this.z,0,-this.x,-this.y,this.x,0])};d.prototype.normalize=function(){var b=this.x,c=this.y,d=this.z;b=Math.sqrt(b*b+c*c+d*d);0Math.abs(k.x)?(h.set(1,0,0),k.cross(h,b)): +(h.set(0,1,0),k.cross(h,b)),k.cross(b,c)):(b.set(1,0,0),c.set(0,1,0))};d.prototype.toString=function(){return this.x+','+this.y+','+this.z};d.prototype.toArray=function(){return[this.x,this.y,this.z]};d.prototype.copy=function(b){return this.x=b.x,this.y=b.y,this.z=b.z,this};d.prototype.lerp=function(b,c,d){var g=this.x,e=this.y,h=this.z;d.x=g+(b.x-g)*c;d.y=e+(b.y-e)*c;d.z=h+(b.z-h)*c};d.prototype.almostEquals=function(b,c){return void 0===c&&(c=1E-6),Math.abs(this.x-b.x)>c||Math.abs(this.y-b.y)> +c||Math.abs(this.z-b.z)>c?!1:!0};d.prototype.almostZero=function(b){return void 0===b&&(b=1E-6),Math.abs(this.x)>b||Math.abs(this.y)>b||Math.abs(this.z)>b?!1:!0};var l=new d;d.prototype.isAntiparallelTo=function(b,c){return this.negate(l),l.almostEquals(b,c)};d.prototype.clone=function(){return new d(this.x,this.y,this.z)}},{'./Mat3':27}],31:[function(b,e){function d(b){b=b||{};c.apply(this);this.id=d.idCounter++;this.postStep=this.preStep=this.world=null;this.vlambda=new k;this.collisionFilterGroup= +'number'==typeof b.collisionFilterGroup?b.collisionFilterGroup:1;this.collisionFilterMask='number'==typeof b.collisionFilterMask?b.collisionFilterMask:1;this.collisionResponse=!0;this.position=new k;b.position&&this.position.copy(b.position);this.previousPosition=new k;this.initPosition=new k;this.velocity=new k;b.velocity&&this.velocity.copy(b.velocity);this.initVelocity=new k;this.force=new k;var g='number'==typeof b.mass?b.mass:0;this.mass=g;this.invMass=0=g?d.STATIC:d.DYNAMIC;typeof b.type==typeof d.STATIC&&(this.type=b.type);this.allowSleep='undefined'!=typeof b.allowSleep?b.allowSleep:!0;this.sleepState=0;this.sleepSpeedLimit='undefined'!=typeof b.sleepSpeedLimit?b.sleepSpeedLimit:.1;this.sleepTimeLimit='undefined'!=typeof b.sleepTimeLimit?b.sleepTimeLimit:1;this.timeLastSleepy=0;this._wakeUpAfterNarrowphase=!1;this.torque=new k;this.quaternion=new l;b.quaternion&& +this.quaternion.copy(b.quaternion);this.initQuaternion=new l;this.angularVelocity=new k;b.angularVelocity&&this.angularVelocity.copy(b.angularVelocity);this.initAngularVelocity=new k;this.interpolatedPosition=new k;this.interpolatedQuaternion=new l;this.shapes=[];this.shapeOffsets=[];this.shapeOrientations=[];this.inertia=new k;this.invInertia=new k;this.invInertiaWorld=new h;this.invMassSolve=0;this.invInertiaSolve=new k;this.invInertiaWorldSolve=new h;this.fixedRotation='undefined'!=typeof b.fixedRotation? +b.fixedRotation:!1;this.angularDamping='undefined'!=typeof b.angularDamping?b.angularDamping:.01;this.aabb=new n;this.aabbNeedsUpdate=!0;this.wlambda=new k;b.shape&&this.addShape(b.shape);this.updateMassProperties()}e.exports=d;var c=b('../utils/EventTarget'),k=(b('../shapes/Shape'),b('../math/Vec3')),h=b('../math/Mat3'),l=b('../math/Quaternion'),n=(b('../material/Material'),b('../collision/AABB')),q=b('../shapes/Box');d.prototype=new c;d.prototype.constructor=d;d.DYNAMIC=1;d.STATIC=2;d.KINEMATIC= +4;d.AWAKE=0;d.SLEEPY=1;d.SLEEPING=2;d.idCounter=0;d.prototype.wakeUp=function(){var b=this.sleepState;this.sleepState=0;b===d.SLEEPING&&this.dispatchEvent({type:'wakeup'})};d.prototype.sleep=function(){this.sleepState=d.SLEEPING;this.velocity.set(0,0,0);this.angularVelocity.set(0,0,0)};d.sleepyEvent={type:'sleepy'};d.sleepEvent={type:'sleep'};d.prototype.sleepTick=function(b){if(this.allowSleep){var g=this.sleepState,c=this.velocity.norm2()+this.angularVelocity.norm2(),e=Math.pow(this.sleepSpeedLimit, +2);g===d.AWAKE&&e>c?(this.sleepState=d.SLEEPY,this.timeLastSleepy=b,this.dispatchEvent(d.sleepyEvent)):g===d.SLEEPY&&c>e?this.wakeUp():g===d.SLEEPY&&b-this.timeLastSleepy>this.sleepTimeLimit&&(this.sleep(),this.dispatchEvent(d.sleepEvent))}};d.prototype.updateSolveMassProperties=function(){this.sleepState===d.SLEEPING||this.type===d.KINEMATIC?(this.invMassSolve=0,this.invInertiaSolve.setZero(),this.invInertiaWorldSolve.setZero()):(this.invMassSolve=this.invMass,this.invInertiaSolve.copy(this.invInertia), +this.invInertiaWorldSolve.copy(this.invInertiaWorld))};d.prototype.pointToLocalFrame=function(b,g){g=g||new k;return b.vsub(this.position,g),this.quaternion.conjugate().vmult(g,g),g};d.prototype.vectorToLocalFrame=function(b,g){g=g||new k;return this.quaternion.conjugate().vmult(b,g),g};d.prototype.pointToWorldFrame=function(b,g){g=g||new k;return this.quaternion.vmult(b,g),g.vadd(this.position,g),g};d.prototype.vectorToWorldFrame=function(b,g){g=g||new k;return this.quaternion.vmult(b,g),g};var m= +new k,g=new l;d.prototype.addShape=function(b,g,c){var d=new k,e=new l;return g&&d.copy(g),c&&e.copy(c),this.shapes.push(b),this.shapeOffsets.push(d),this.shapeOrientations.push(e),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0,this};d.prototype.updateBoundingRadius=function(){for(var b=this.shapes,g=this.shapeOffsets,c=b.length,d=0,e=0;e!==c;e++){var h=b[e];h.updateBoundingSphereRadius();var k=g[e].norm();h=h.boundingSphereRadius;k+h>d&&(d=k+h)}this.boundingRadius= +d};var p=new n;d.prototype.computeAABB=function(){for(var b=this.shapes,c=this.shapeOffsets,d=this.shapeOrientations,e=b.length,h=this.quaternion,k=this.aabb,l=0;l!==e;l++){var n=b[l];d[l].mult(h,g);g.vmult(c[l],m);m.vadd(this.position,m);n.calculateWorldAABB(m,g,p.lowerBound,p.upperBound);0===l?k.copy(p):k.extend(p)}this.aabbNeedsUpdate=!1};var r=new h,u=new h;new h;d.prototype.updateInertiaWorld=function(b){var g=this.invInertia;if(g.x!==g.y||g.y!==g.z||b)r.setRotationFromQuaternion(this.quaternion), +r.transpose(u),r.scale(g,r),r.mmult(u,this.invInertiaWorld)};var E=new k,v=new k;d.prototype.applyForce=function(b,g){this.type===d.DYNAMIC&&(g.vsub(this.position,E),E.cross(b,v),this.force.vadd(b,this.force),this.torque.vadd(v,this.torque))};var t=new k,z=new k;d.prototype.applyLocalForce=function(b,g){this.type===d.DYNAMIC&&(this.vectorToWorldFrame(b,t),this.pointToWorldFrame(g,z),this.applyForce(t,z))};var w=new k,I=new k,H=new k;d.prototype.applyImpulse=function(b,g){this.type===d.DYNAMIC&&(g.vsub(this.position, +w),I.copy(b),I.mult(this.invMass,I),this.velocity.vadd(I,this.velocity),w.cross(b,H),this.invInertiaWorld.vmult(H,H),this.angularVelocity.vadd(H,this.angularVelocity))};var K=new k,C=new k;d.prototype.applyLocalImpulse=function(b,g){this.type===d.DYNAMIC&&(this.vectorToWorldFrame(b,K),this.pointToWorldFrame(g,C),this.applyImpulse(K,C))};var D=new k;d.prototype.updateMassProperties=function(){this.invMass=0e;e++)this.updateWheelTransform(e);this.currentVehicleSpeedKmHour=3.6*d.velocity.norm();e=new k;this.getVehicleAxisWorld(this.indexForwardAxis,e);0>e.dot(d.velocity)&&(this.currentVehicleSpeedKmHour*=-1);for(e=0;c>e;e++)this.castRay(g[e]);this.updateSuspension(b);var h=new k,m=new k;for(e=0;c>e;e++){var l=g[e],p=l.suspensionForce;p>l.maxSuspensionForce&&(p=l.maxSuspensionForce);l.raycastResult.hitNormalWorld.scale(p*b,h);l.raycastResult.hitPointWorld.vsub(d.position, +m);d.applyImpulse(h,l.raycastResult.hitPointWorld)}this.updateFriction(b);h=new k;m=new k;p=new k;for(e=0;c>e;e++){l=g[e];d.getVelocityAtWorldPoint(l.chassisConnectionPointWorld,p);var n=1;switch(this.indexUpAxis){case 1:n=-1}if(l.isInContact){this.getVehicleAxisWorld(this.indexForwardAxis,m);var q=m.dot(l.raycastResult.hitNormalWorld);l.raycastResult.hitNormalWorld.scale(q,h);m.vsub(h,m);q=m.dot(p);l.deltaRotation=n*q*b/l.radius}!l.sliding&&l.isInContact||0===l.engineForce||!l.useCustomSlidingRotationalSpeed|| +(l.deltaRotation=(0Math.abs(l.engineForce)&&(l.deltaRotation=0);l.rotation+=l.deltaRotation;l.deltaRotation*=.99}};d.prototype.updateSuspension=function(){for(var b=this.chassisBody.mass,g=this.wheelInfos,c=g.length,d=0;c>d;d++){var e=g[d];if(e.isInContact){var h=e.suspensionStiffness*(e.suspensionRestLength-e.suspensionLength)*e.clippedInvContactDotSuspension;var k=e.suspensionRelativeVelocity;h-=(0>k?e.dampingCompression:e.dampingRelaxation)* +k;e.suspensionForce=h*b;0>e.suspensionForce&&(e.suspensionForce=0)}else e.suspensionForce=0}};d.prototype.removeFromWorld=function(b){this.constraints;b.remove(this.chassisBody);b.removeEventListener('preStep',this.preStepCallback);this.world=null};var p=new k,r=new k;d.prototype.castRay=function(b){this.updateWheelTransformWorld(b);var g=this.chassisBody,c=-1;b.directionWorld.scale(b.suspensionRestLength+b.radius,p);var d=b.chassisConnectionPointWorld;d.vadd(p,r);var e=b.raycastResult;e.reset(); +var h=g.collisionResponse;g.collisionResponse=!1;this.world.rayTest(d,r,e);g.collisionResponse=h;d=e.body;(b.raycastResult.groundObject=0,d)?(c=e.distance,b.raycastResult.hitNormalWorld=e.hitNormalWorld,b.isInContact=!0,b.suspensionLength=e.distance-b.radius,e=b.suspensionRestLength-b.maxSuspensionTravel,d=b.suspensionRestLength+b.maxSuspensionTravel,b.suspensionLengthd&&(b.suspensionLength=d,b.raycastResult.reset()),e=b.raycastResult.hitNormalWorld.dot(b.directionWorld), +d=new k,g.getVelocityAtWorldPoint(b.raycastResult.hitPointWorld,d),g=b.raycastResult.hitNormalWorld.dot(d),-.1<=e?(b.suspensionRelativeVelocity=0,b.clippedInvContactDotSuspension=10):(e=-1/e,b.suspensionRelativeVelocity=g*e,b.clippedInvContactDotSuspension=e)):(b.suspensionLength=b.suspensionRestLength+0*b.maxSuspensionTravel,b.suspensionRelativeVelocity=0,b.directionWorld.scale(-1,b.raycastResult.hitNormalWorld),b.clippedInvContactDotSuspension=1);return c};d.prototype.updateWheelTransformWorld= +function(b){b.isInContact=!1;var g=this.chassisBody;g.pointToWorldFrame(b.chassisConnectionPointLocal,b.chassisConnectionPointWorld);g.vectorToWorldFrame(b.directionLocal,b.directionWorld);g.vectorToWorldFrame(b.axleLocal,b.axleWorld)};d.prototype.updateWheelTransform=function(b){b=this.wheelInfos[b];this.updateWheelTransformWorld(b);b.directionLocal.scale(-1,q);m.copy(b.axleLocal);q.cross(m,g);g.normalize();m.normalize();var c=b.steering,d=new h;d.setFromAxisAngle(q,c);c=new h;c.setFromAxisAngle(m, +b.rotation);var e=b.worldTransform.quaternion;this.chassisBody.quaternion.mult(d,e);e.mult(c,e);e.normalize();d=b.worldTransform.position;d.copy(b.directionWorld);d.scale(b.suspensionLength,d);d.vadd(b.chassisConnectionPointWorld,d)};var u=[new k(1,0,0),new k(0,1,0),new k(0,0,1)];d.prototype.getWheelTransformWorld=function(b){return this.wheelInfos[b].worldTransform};var E=new k,v=[],t=[];d.prototype.updateFriction=function(b){for(var g=this.wheelInfos,d=g.length,e=this.chassisBody,h=0,m=0;d>m;m++){var l= +g[m],p=l.raycastResult.body;p&&h++;l.sideImpulse=0;l.forwardImpulse=0;t[m]||(t[m]=new k);v[m]||(v[m]=new k)}for(m=0;d>m;m++)if(l=g[m],p=l.raycastResult.body){var n=v[m];this.getWheelTransformWorld(m).vectorToWorldFrame(u[this.indexRightAxis],n);h=l.raycastResult.hitNormalWorld;var q=n.dot(h);h.scale(q,E);n.vsub(E,n);n.normalize();h.cross(n,t[m]);t[m].normalize();h=l;q=e;var r=l.raycastResult.hitPointWorld,C=l.raycastResult.hitPointWorld;if(1.1m;m++){l=g[m];p=l.raycastResult.body;r=0;if(l.slipInfo=1,p){h=l.brake?l.brake:0;H=e;C=p;n=l.raycastResult.hitPointWorld;D=t[m];r=h;q=0;K=n;var ka=z,ea=w,qa=I;H.getVelocityAtWorldPoint(K,ka);C.getVelocityAtWorldPoint(K,ea);ka.vsub(ea,qa);K=D.dot(qa);H=c(H,n,D);C=c(C,n,D);r=(q=1/(H+C)*-K,q>r&&(q=r),-r>q&&(q=-r),q);r+=l.engineForce*b;h/=r;l.slipInfo*=h}if(l.forwardImpulse= +0,l.skidInfo=1,p)if(l.skidInfo=1,p=l.suspensionForce*b*l.frictionSlip,h=p*p,l.forwardImpulse=r,q=.5*l.forwardImpulse,r=1*l.sideImpulse,q=q*q+r*r,l.sliding=!1,q>h)this.sliding=!0,l.sliding=!0,h=p/Math.sqrt(q),l.skidInfo*=h}if(this.sliding)for(m=0;d>m;m++)l=g[m],0!==l.sideImpulse&&1>l.skidInfo&&(l.forwardImpulse*=l.skidInfo,l.sideImpulse*=l.skidInfo);for(m=0;d>m;m++){l=g[m];b=new k;if(b.copy(l.raycastResult.hitPointWorld),0!==l.forwardImpulse)p=new k,t[m].scale(l.forwardImpulse,p),e.applyImpulse(p, +b);0!==l.sideImpulse&&(p=l.raycastResult.body,h=new k,h.copy(l.raycastResult.hitPointWorld),q=new k,v[m].scale(l.sideImpulse,q),e.pointToLocalFrame(b,b),b['xyz'[this.indexUpAxis]]*=l.rollInfluence,e.pointToWorldFrame(b,b),e.applyImpulse(q,b),q.scale(-1,q),p.applyImpulse(q,h))}};var z=new k,w=new k,I=new k,H=new k,K=new k,C=new k,D=new k,Q=new k,M=new k,X=new k},{'../collision/Ray':9,'../collision/RaycastResult':10,'../math/Quaternion':28,'../math/Vec3':30,'../objects/WheelInfo':36,'./Body':31}],33:[function(b, +e){function d(b){(this.wheelBodies=[],this.coordinateSystem='undefined'==typeof b.coordinateSystem?new l(1,2,3):b.coordinateSystem.clone(),this.chassisBody=b.chassisBody,this.chassisBody)||(b=new h(new l(5,2,.5)),this.chassisBody=new c(1,b));this.constraints=[];this.wheelAxes=[];this.wheelForces=[]}var c=b('./Body'),k=b('../shapes/Sphere'),h=b('../shapes/Box'),l=b('../math/Vec3'),n=b('../constraints/HingeConstraint');e.exports=d;d.prototype.addWheel=function(b){b=b||{};var g=b.body;g||(g=new c(1, +new k(1.2)));this.wheelBodies.push(g);this.wheelForces.push(0);var d=(new l,'undefined'!=typeof b.position?b.position.clone():new l),e=new l;this.chassisBody.pointToWorldFrame(d,e);g.position.set(e.x,e.y,e.z);b='undefined'!=typeof b.axis?b.axis.clone():new l(0,1,0);this.wheelAxes.push(b);g=new n(this.chassisBody,g,{pivotA:d,axisA:b,pivotB:l.ZERO,axisB:b,collideConnected:!1});return this.constraints.push(g),this.wheelBodies.length-1};d.prototype.setSteeringValue=function(b,c){var g=this.wheelAxes[c], +d=Math.cos(b);b=Math.sin(b);var e=g.x;g=g.y;this.constraints[c].axisA.set(d*e-b*g,b*e+d*g,0)};d.prototype.setMotorSpeed=function(b,c){c=this.constraints[c];c.enableMotor();c.motorTargetVelocity=b};d.prototype.disableMotor=function(b){this.constraints[b].disableMotor()};var q=new l;d.prototype.setWheelForce=function(b,c){this.wheelForces[c]=b};d.prototype.applyWheelForce=function(b,c){var g=this.wheelBodies[c],d=g.torque;this.wheelAxes[c].scale(b,q);g.vectorToWorldFrame(q,q);d.vadd(q,d)};d.prototype.addToWorld= +function(b){for(var g=this.constraints,c=this.wheelBodies.concat([this.chassisBody]),d=0;dthis.particles.length&&this.neighbors.pop())};var c=new e;d.prototype.getNeighbors=function(b,d){for(var g=this.particles.length,e=b.id,h=this.smoothingRadius* +this.smoothingRadius,k=0;k!==g;k++){var m=this.particles[k];m.position.vsub(b.position,c);e!==m.id&&c.norm2()g;g++){h=m[g];c.vmult(h,h);b.vadd(h,h);var k=h.x,l=h.y;h=h.z;k>d.x&&(d.x=k);l>d.y&&(d.y=l);h>d.z&&(d.z=h);kc.dot(this.vertices[this.faces[b][0]]))for(console.error('.faceNormals['+b+'] = Vec3('+c.toString()+') looks like it points into the shape? The vertices follow. Make sure they are ordered CCW around the normal, using the right hand rule.'),c=0;cu&&(u=v,q=r)}u=[];r=e.faces[q];v=r.length;for(var t=0;v>t;t++){var z= -e.vertices[r[t]],H=new h;H.copy(z);g.vmult(H,H);d.vadd(H,H);u.push(H)}0<=q&&this.clipFaceAgainstHull(k,b,c,u,m,l,n)};var e=new h,n=new h,r=new h,t=new h,D=new h,w=new h;c.prototype.findSeparatingAxis=function(b,c,d,g,h,k,m,l){var p=Number.MAX_VALUE,q=0;if(this.uniqueAxes)for(var u=0;u!==this.uniqueAxes.length;u++){d.vmult(this.uniqueAxes[u],e);var v=this.testSepAxis(e,b,c,d,g,h);if(!1===v)return!1;p>v&&(p=v,k.copy(e))}else{var z=m?m.length:this.faces.length;for(u=0;z>u;u++){v=m?m[u]:u;e.copy(this.faceNormals[v]); -d.vmult(e,e);v=this.testSepAxis(e,b,c,d,g,h);if(!1===v)return!1;p>v&&(p=v,k.copy(e))}}if(b.uniqueAxes)for(u=0;u!==b.uniqueAxes.length;u++){h.vmult(b.uniqueAxes[u],n);q++;v=this.testSepAxis(n,b,c,d,g,h);if(!1===v)return!1;p>v&&(p=v,k.copy(n))}else for(m=l?l.length:b.faces.length,u=0;m>u;u++){v=l?l[u]:u;n.copy(b.faceNormals[v]);h.vmult(n,n);q++;v=this.testSepAxis(n,b,c,d,g,h);if(!1===v)return!1;p>v&&(p=v,k.copy(n))}for(l=0;l!==this.uniqueEdges.length;l++)for(d.vmult(this.uniqueEdges[l],t),q=0;q!==b.uniqueEdges.length;q++)if(h.vmult(b.uniqueEdges[q], -D),t.cross(D,w),!w.almostZero()){w.normalize();u=this.testSepAxis(w,b,c,d,g,h);if(!1===u)return!1;p>u&&(p=u,k.copy(w))}return g.vsub(c,r),0d||b>e)return!1;d-=g;b=e-b;return b>d?d:b};var z=new h,G=new h;c.prototype.calculateLocalInertia=function(b,c){this.computeLocalAABB(z,G);var e=G.x-z.x,d=G.y-z.y,g=G.z-z.z;c.x=1/12*b*(4*d*d+4*g*g); -c.y=1/12*b*(4*e*e+4*g*g);c.z=1/12*b*(4*d*d+4*e*e)};c.prototype.getPlaneConstantOfFace=function(b){return-this.faceNormals[b].dot(this.vertices[this.faces[b][0]])};var I=new h,K=new h,H=new h,C=new h,P=new h,Q=new h,T=new h,fa=new h;c.prototype.clipFaceAgainstHull=function(b,c,e,d,g,h,k){for(var m=[],l=-1,p=Number.MAX_VALUE,n=0;nq&&(p=q,l=n)}if(!(0>l)){b=this.faces[l];b.connectedFaces=[];for(p=0;pn;n++){q=this.vertices[b[n]];q.vsub(this.vertices[b[(n+1)%p]],K);H.copy(K);e.vmult(H,H);c.vadd(H,H);C.copy(this.faceNormals[l]);e.vmult(C,C);c.vadd(C,C);H.cross(C,P);P.negate(P);Q.copy(q);e.vmult(Q,Q);c.vadd(Q,Q);q=(-Q.dot(P),b.connectedFaces[n]);T.copy(this.faceNormals[q]);q=this.getPlaneConstantOfFace(q);fa.copy(T);e.vmult(fa,fa);q-=fa.dot(c); -for(this.clipFaceAgainstPlane(d,m,fa,q);d.length;)d.shift();for(;m.length;)d.push(m.shift())}T.copy(this.faceNormals[l]);q=this.getPlaneConstantOfFace(l);fa.copy(T);e.vmult(fa,fa);q-=fa.dot(c);for(p=0;p=c&&(console.log('clamped: depth='+c+' to minDist='+(g+'')),c=g),h>=c)e=d[p],0>=c&&k.push({point:e,normal:fa,depth:c})}};c.prototype.clipFaceAgainstPlane=function(b,c,e,d){var g,k=b.length;if(2>k)return c;var m=b[b.length-1],l=b[0];var p=e.dot(m)+d;for(var n=0;k> -n;n++){if(l=b[n],g=e.dot(l)+d,0>p){if(0>g){var q=new h;q.copy(l)}else q=new h,m.lerp(l,p/(p-g),q);c.push(q)}else 0>g&&(q=new h,m.lerp(l,p/(p-g),q),c.push(q),c.push(l));m=l;p=g}return c};c.prototype.computeWorldVertices=function(b,c){for(var e=this.vertices.length;this.worldVertices.lengthg;g++){var h=d[g];h.xc.x&&(c.x=h.x);h.yc.y&&(c.y=h.y);h.zc.z&&(c.z=h.z)}};c.prototype.computeWorldFaceNormals=function(b){for(var c=this.faceNormals.length;this.worldFaceNormals.lengthb&&(b=g)}this.boundingSphereRadius=Math.sqrt(b)};var ja=new h;c.prototype.calculateWorldAABB=function(b,c,e,d){for(var g,h,k,m,l,p,n=this.vertices.length,q=this.vertices,u=0;n>u;u++){ja.copy(q[u]);c.vmult(ja,ja);b.vadd(ja,ja);var r=ja;r.xm||void 0===m)&&(m=r.x);r.y -l||void 0===l)&&(l=r.y);r.zp||void 0===p)&&(p=r.z)}e.set(g,h,k);d.set(m,l,p)};c.prototype.volume=function(){return 4*Math.PI*this.boundingSphereRadius/3};c.prototype.getAveragePointLocal=function(b){b=b||new h;for(var c=this.vertices.length,e=this.vertices,d=0;c>d;d++)b.vadd(e[d],b);return b.mult(1/c,b),b};c.prototype.transformAllPoints=function(b,c){var e=this.vertices.length,d=this.vertices;if(c){for(var g=0;e>g;g++){var h=d[g];c.vmult(h,h)}for(g=0;gg;g++)h=d[g],h.vadd(b,h)};var ia=new h,N=new h,ma=new h;c.prototype.pointIsInside=function(b){var c=this.vertices,e=this.faces,d=this.faceNormals,g=this.faces.length;this.getAveragePointLocal(ia);for(var h=0;g>h;h++){var k=(this.faces[h].length,d[h]);var m=c[e[h][0]],l=N;b.vsub(m,l);l=k.dot(l);var p=ma;ia.vsub(m,p);k=k.dot(p);if(0>l&&0k)return!1}return-1};var V=(new h,new h),ca=new h;c.project=function(b,c,e,d,g){var h=b.vertices.length;b= -b.vertices;ca.setZero();k.vectorToLocalFrame(e,d,c,V);k.pointToLocalFrame(e,d,ca,ca);d=ca.dot(V);e=c=b[0].dot(V);for(var m=1;h>m;m++){var l=b[m].dot(V);l>c&&(c=l);e>l&&(e=l)}if(e-=d,c-=d,e>c)h=e,e=c,c=h;g[0]=c;g[1]=e}},{'../math/Quaternion':28,'../math/Transform':29,'../math/Vec3':30,'./Shape':43}],39:[function(b,d){function c(b,c,d,p){var e=[],m=[],l=[],q=[],D=[],w=Math.cos,u=Math.sin;e.push(new h(c*w(0),c*u(0),.5*-d));q.push(0);e.push(new h(b*w(0),b*u(0),.5*d));D.push(1);for(var v=0;p>v;v++){var z= -2*Math.PI/p*(v+1),G=2*Math.PI/p*(v+.5);p-1>v?(e.push(new h(c*w(z),c*u(z),.5*-d)),q.push(2*v+2),e.push(new h(b*w(z),b*u(z),.5*d)),D.push(2*v+3),l.push([2*v+2,2*v+3,2*v+1,2*v])):l.push([0,1,2*v+1,2*v]);(1===p%2||p/2>v)&&m.push(new h(w(G),u(G),0))}l.push(D);m.push(new h(0,0,1));b=[];for(v=0;vg&&(c=g)}this.minValue=c};c.prototype.updateMaxValue=function(){for(var b=this.data,c=b[0][0],d=0;d!==b.length;d++)for(var e=0;e!==b[d].length;e++){var g=b[d][e];g>c&&(c= -g)}this.maxValue=c};c.prototype.setHeightValueAtIndex=function(b,c,d){this.data[b][c]=d;this.clearCachedConvexTrianglePillar(b,c,!1);0=b;b++)for(var m= -c;e>=m;m++){var l=h[b][m];l>k&&(k=l)}g[0]=this.minValue;g[1]=k};c.prototype.getIndexOfPosition=function(b,c,d,e){var g=this.elementSize,h=this.data;b=Math.floor(b/g);c=Math.floor(c/g);return d[0]=b,d[1]=c,e&&(0>b&&(b=0),0>c&&(c=0),b>=h.length-1&&(b=h.length-1),c>=h[0].length-1&&(c=h[0].length-1)),0>b||0>c||b>=h.length-1||c>=h[0].length-1?!1:!0};c.prototype.getHeightAt=function(b,c,d){var e=[];this.getIndexOfPosition(b,c,e,d);b=[];return this.getRectMinMax(e[0],e[1]+1,e[0],e[1]+1,b),(b[0]+b[1])/2}; -c.prototype.getCacheConvexTrianglePillarKey=function(b,c,d){return b+'_'+c+'_'+(d?1:0)};c.prototype.getCachedConvexTrianglePillar=function(b,c,d){return this._cachedPillars[this.getCacheConvexTrianglePillarKey(b,c,d)]};c.prototype.setCachedConvexTrianglePillar=function(b,c,d,e,g){this._cachedPillars[this.getCacheConvexTrianglePillarKey(b,c,d)]={convex:e,offset:g}};c.prototype.clearCachedConvexTrianglePillar=function(b,c,d){delete this._cachedPillars[this.getCacheConvexTrianglePillarKey(b,c,d)]};c.prototype.getConvexTrianglePillar= -function(b,c,d){var e=this.pillarConvex,g=this.pillarOffset;if(this.cacheEnabled){var l=this.getCachedConvexTrianglePillar(b,c,d);if(l)return this.pillarConvex=l.convex,void(this.pillarOffset=l.offset);e=new h;g=new k;this.pillarConvex=e;this.pillarOffset=g}l=this.data;var m=this.elementSize,p=e.faces;e.vertices.length=6;for(var q=0;6>q;q++)e.vertices[q]||(e.vertices[q]=new k);p.length=5;for(q=0;5>q;q++)p[q]||(p[q]=[]);q=e.vertices;var u=(Math.min(l[b][c],l[b+1][c],l[b][c+1],l[b+1][c+1])-this.minValue)/ -2+this.minValue;d?(g.set((b+.75)*m,(c+.75)*m,u),q[0].set(.25*m,.25*m,l[b+1][c+1]-u),q[1].set(-.75*m,.25*m,l[b][c+1]-u),q[2].set(.25*m,-.75*m,l[b+1][c]-u),q[3].set(.25*m,.25*m,-u-1),q[4].set(-.75*m,.25*m,-u-1),q[5].set(.25*m,-.75*m,-u-1),p[0][0]=0,p[0][1]=1,p[0][2]=2,p[1][0]=5,p[1][1]=4,p[1][2]=3,p[2][0]=2,p[2][1]=5,p[2][2]=3,p[2][3]=0,p[3][0]=3,p[3][1]=4,p[3][2]=1,p[3][3]=0,p[4][0]=1,p[4][1]=4,p[4][2]=5,p[4][3]=2):(g.set((b+.25)*m,(c+.25)*m,u),q[0].set(-.25*m,-.25*m,l[b][c]-u),q[1].set(.75*m,-.25* -m,l[b+1][c]-u),q[2].set(-.25*m,.75*m,l[b][c+1]-u),q[3].set(-.25*m,-.25*m,-u-1),q[4].set(.75*m,-.25*m,-u-1),q[5].set(-.25*m,.75*m,-u-1),p[0][0]=0,p[0][1]=1,p[0][2]=2,p[1][0]=5,p[1][1]=4,p[1][2]=3,p[2][0]=0,p[2][1]=2,p[2][2]=5,p[2][3]=3,p[3][0]=1,p[3][1]=0,p[3][2]=3,p[3][3]=4,p[4][0]=4,p[4][1]=5,p[4][2]=2,p[4][3]=1);e.computeNormals();e.computeEdges();e.updateBoundingSphereRadius();this.setCachedConvexTrianglePillar(b,c,d,e,g)};c.prototype.calculateLocalInertia=function(b,c){return c=c||new k,c.set(0, -0,0),c};c.prototype.volume=function(){return Number.MAX_VALUE};c.prototype.calculateWorldAABB=function(b,c,d,e){d.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);e.set(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE)};c.prototype.updateBoundingSphereRadius=function(){var b=this.data,c=this.elementSize;this.boundingSphereRadius=(new k(b.length*c,b[0].length*c,Math.max(Math.abs(this.maxValue),Math.abs(this.minValue)))).norm()}},{'../math/Vec3':30,'../utils/Utils':53,'./ConvexPolyhedron':38, -'./Shape':43}],41:[function(b,d){function c(){g.call(this);this.type=g.types.PARTICLE}d.exports=c;var g=b('./Shape'),h=b('../math/Vec3');c.prototype=new g;c.prototype.constructor=c;c.prototype.calculateLocalInertia=function(b,c){return c=c||new h,c.set(0,0,0),c};c.prototype.volume=function(){return 0};c.prototype.updateBoundingSphereRadius=function(){this.boundingSphereRadius=0};c.prototype.calculateWorldAABB=function(b,c,d,g){d.copy(b);g.copy(b)}},{'../math/Vec3':30,'./Shape':43}],42:[function(b, -d){function c(){g.call(this);this.type=g.types.PLANE;this.worldNormal=new h;this.worldNormalNeedsUpdate=!0;this.boundingSphereRadius=Number.MAX_VALUE}d.exports=c;var g=b('./Shape'),h=b('../math/Vec3');c.prototype=new g;c.prototype.constructor=c;c.prototype.computeWorldNormal=function(b){var c=this.worldNormal;c.set(0,0,1);b.vmult(c,c);this.worldNormalNeedsUpdate=!1};c.prototype.calculateLocalInertia=function(b,c){return c||new h};c.prototype.volume=function(){return Number.MAX_VALUE};var k=new h; -c.prototype.calculateWorldAABB=function(b,c,d,g){k.set(0,0,1);c.vmult(k,k);c=Number.MAX_VALUE;d.set(-c,-c,-c);g.set(c,c,c);1===k.x&&(g.x=b.x);1===k.y&&(g.y=b.y);1===k.z&&(g.z=b.z);-1===k.x&&(d.x=b.x);-1===k.y&&(d.y=b.y);-1===k.z&&(d.z=b.z)};c.prototype.updateBoundingSphereRadius=function(){this.boundingSphereRadius=Number.MAX_VALUE}},{'../math/Vec3':30,'./Shape':43}],43:[function(b,d){function c(){this.id=c.idCounter++;this.boundingSphereRadius=this.type=0;this.collisionResponse=!0;this.material= -null}d.exports=c;c=b('./Shape');b('../math/Vec3');b('../math/Quaternion');b('../material/Material');c.prototype.constructor=c;c.prototype.updateBoundingSphereRadius=function(){throw'computeBoundingSphereRadius() not implemented for shape type '+this.type;};c.prototype.volume=function(){throw'volume() not implemented for shape type '+this.type;};c.prototype.calculateLocalInertia=function(){throw'calculateLocalInertia() not implemented for shape type '+this.type;};c.idCounter=0;c.types={SPHERE:1,PLANE:2, -BOX:4,COMPOUND:8,CONVEXPOLYHEDRON:16,HEIGHTFIELD:32,PARTICLE:64,CYLINDER:128,TRIMESH:256}},{'../material/Material':25,'../math/Quaternion':28,'../math/Vec3':30,'./Shape':43}],44:[function(b,d){function c(b){if(g.call(this),this.radius=void 0!==b?Number(b):1,this.type=g.types.SPHERE,0>this.radius)throw Error('The sphere radius cannot be negative.');this.updateBoundingSphereRadius()}d.exports=c;var g=b('./Shape'),h=b('../math/Vec3');c.prototype=new g;c.prototype.constructor=c;c.prototype.calculateLocalInertia= -function(b,c){c=c||new h;b=2*b*this.radius*this.radius/5;return c.x=b,c.y=b,c.z=b,c};c.prototype.volume=function(){return 4*Math.PI*this.radius/3};c.prototype.updateBoundingSphereRadius=function(){this.boundingSphereRadius=this.radius};c.prototype.calculateWorldAABB=function(b,c,d,g){c=this.radius;for(var h=['x','y','z'],e=0;eg?g+'_'+h:h+'_'+g]=!0},e=0;eb.x&&(b.x=d.x), -d.yb.y&&(b.y=d.y),d.zb.z&&(b.z=d.z)};c.prototype.updateAABB=function(){this.computeLocalAABB(this.aabb)};c.prototype.updateBoundingSphereRadius=function(){var b=0,c=this.vertices,e=new h,d=0;for(c=c.length/3;d!==c;d++){this.getVertex(d,e);var g=e.norm2();g>b&&(b=g)}this.boundingSphereRadius=Math.sqrt(b)};var G=(new h,new k),I=new l;c.prototype.calculateWorldAABB=function(b,c,e,d){G.position=b;G.quaternion=c;this.aabb.toWorldFrame(G,I);e.copy(I.lowerBound);d.copy(I.upperBound)}; -c.prototype.volume=function(){return 4*Math.PI*this.boundingSphereRadius/3};c.createTorus=function(b,e,d,g,h){b=b||1;e=e||.5;d=d||8;g=g||6;h=h||2*Math.PI;for(var k=[],m=[],l=0;d>=l;l++)for(var p=0;g>=p;p++){var n=p/g*h,q=l/d*Math.PI*2;k.push((b+e*Math.cos(q))*Math.cos(n),(b+e*Math.cos(q))*Math.sin(n),e*Math.sin(q))}for(l=1;d>=l;l++)for(p=1;g>=p;p++)b=(g+1)*(l-1)+p-1,e=(g+1)*(l-1)+p,h=(g+1)*l+p,m.push((g+1)*l+p-1,b,h),m.push(b,e,h);return new c(k,m)}},{'../collision/AABB':3,'../math/Quaternion':28, -'../math/Transform':29,'../math/Vec3':30,'../utils/Octree':50,'./Shape':43}],46:[function(b,d){function c(){g.call(this);this.iterations=10;this.tolerance=1E-7}d.exports=c;var g=(b('../math/Vec3'),b('../math/Quaternion'),b('./Solver'));c.prototype=new g;var h=[],k=[],l=[];c.prototype.solve=function(b,c){var d,e=0,g=this.iterations,m=this.tolerance*this.tolerance,q=this.equations,D=q.length;c=c.bodies;var w=c.length;if(0!==D)for(d=0;d!==w;d++)c[d].updateSolveMassProperties();k.length=D;l.length=D; -h.length=D;for(d=0;d!==D;d++){var u=q[d];h[d]=0;l[d]=u.computeB(b);k[d]=1/u.computeC()}if(0!==D){for(d=0;d!==w;d++)u=c[d],e=u.wlambda,u.vlambda.set(0,0,0),e&&e.set(0,0,0);for(e=0;e!==g;e++){for(var v=d=0;v!==D;v++){u=q[v];var z=l[v];var G=k[v];b=h[v];var I=u.computeGWlambda();z=G*(z-I-u.eps*b);b+zu.maxForce&&(z=u.maxForce-b);h[v]+=z;d+=0d*d)break}for(d=0;d!==w;d++)u=c[d],g=u.velocity,m=u.angularVelocity,g.vadd(u.vlambda,g),m&&m.vadd(u.wlambda, -m)}return e}},{'../math/Quaternion':28,'../math/Vec3':30,'./Solver':47}],47:[function(b,d){function c(){this.equations=[]}d.exports=c;c.prototype.solve=function(){return 0};c.prototype.addEquation=function(b){b.enabled&&this.equations.push(b)};c.prototype.removeEquation=function(b){var c=this.equations;b=c.indexOf(b);-1!==b&&c.splice(b,1)};c.prototype.removeAllEquations=function(){this.equations.length=0}},{}],48:[function(b,d){function c(b){l.call(this);this.iterations=10;this.tolerance=1E-7;this.subsolver= -b;this.nodes=[];for(this.nodePool=[];128>this.nodePool.length;)this.nodePool.push(this.createNode())}function g(b){for(var c=b.length,d=0;d!==c;d++){var g=b[d];if(!(g.visited||g.body.type&e))return g}return!1}function h(b,c,e){c.push(b.body);c=b.eqs.length;for(var d=0;d!==c;d++){var g=b.eqs[d];-1===e.indexOf(g)&&e.push(g)}}function k(b,c){return c.id-b.id}d.exports=c;var l=(b('../math/Vec3'),b('../math/Quaternion'),b('./Solver'));b=b('../objects/Body');c.prototype=new l;var m=[],q=[],p={bodies:[]}, -e=b.STATIC,n=[];c.prototype.createNode=function(){return{body:null,children:[],eqs:[],visited:!1}};c.prototype.solve=function(b,c){var e=this.nodePool,d=c.bodies,l=this.equations,r=l.length,t=d.length;for(c=this.subsolver;e.lengthG;G++)m[G]=e[G];for(G=0;G!==t;G++)e=m[G],e.body=d[G],e.children.length=0,e.eqs.length=0,e.visited=!1;for(e=0;e!==r;e++){t=l[e];G=d.indexOf(t.bi);var I=d.indexOf(t.bj);G=m[G];I=m[I];G.children.push(I);G.eqs.push(t);I.children.push(G); -I.eqs.push(t)}d=0;l=q;c.tolerance=this.tolerance;for(c.iterations=this.iterations;G=g(m);){l.length=0;p.bodies.length=0;t=G;G=h;r=p.bodies;e=l;n.push(t);t.visited=!0;for(G(t,r,e);n.length;)for(I=n.pop();t=g(I.children);)t.visited=!0,G(t,r,e),n.push(t);r=l.length;l=l.sort(k);for(G=0;G!==r;G++)c.addEquation(l[G]);c.solve(b,p);c.removeAllEquations();d++}return d}},{'../math/Quaternion':28,'../math/Vec3':30,'../objects/Body':31,'./Solver':47}],49:[function(b,d){b=function(){};d.exports=b;b.prototype= -{constructor:b,addEventListener:function(b,d){void 0===this._listeners&&(this._listeners={});var c=this._listeners;return void 0===c[b]&&(c[b]=[]),-1===c[b].indexOf(d)&&c[b].push(d),this},hasEventListener:function(b,d){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[b]&&-1!==c[b].indexOf(d)?!0:!1},removeEventListener:function(b,d){if(void 0===this._listeners)return this;var c=this._listeners;if(void 0===c[b])return this;d=c[b].indexOf(d);return-1!==d&&c[b].splice(d,1), -this},dispatchEvent:function(b){if(void 0===this._listeners)return this;var c=this._listeners[b.type];if(void 0!==c){b.target=this;for(var d=0,k=c.length;k>d;d++)c[d].call(this,b)}return this}}},{}],50:[function(b,d){function c(b){b=b||{};this.root=b.root||null;this.aabb=b.aabb?b.aabb.clone():new h;this.data=[];this.children=[]}function g(b,d){d=d||{};d.root=null;d.aabb=b;c.call(this,d);this.maxDepth='undefined'!=typeof d.maxDepth?d.maxDepth:8}var h=b('../collision/AABB'),k=b('../math/Vec3');d.exports= -g;g.prototype=new c;c.prototype.reset=function(){this.children.length=this.data.length=0};c.prototype.insert=function(b,c,e){var d=this.data;if(e=e||0,!this.aabb.contains(b))return!1;var g=this.children;if(e<(this.maxDepth||this.root.maxDepth)){var h=!1;g.length||(this.subdivide(),h=!0);for(var k=0;8!==k;k++)if(g[k].insert(b,c,e+1))return!0;h&&(g.length=0)}return d.push(c),!0};var l=new k;c.prototype.subdivide=function(){var b=this.aabb,d=b.lowerBound,e=b.upperBound;b=this.children;b.push(new c({aabb:new h({lowerBound:new k(0, -0,0)})}),new c({aabb:new h({lowerBound:new k(1,0,0)})}),new c({aabb:new h({lowerBound:new k(1,1,0)})}),new c({aabb:new h({lowerBound:new k(1,1,1)})}),new c({aabb:new h({lowerBound:new k(0,1,1)})}),new c({aabb:new h({lowerBound:new k(0,0,1)})}),new c({aabb:new h({lowerBound:new k(1,0,1)})}),new c({aabb:new h({lowerBound:new k(0,1,0)})}));e.vsub(d,l);l.scale(.5,l);e=this.root||this;for(var g=0;8!==g;g++){var m=b[g];m.root=e;var t=m.aabb.lowerBound;t.x*=l.x;t.y*=l.y;t.z*=l.z;t.vadd(d,t);t.vadd(l,m.aabb.upperBound)}}; -c.prototype.aabbQuery=function(b,c){for(var e=(this.data,this.children,[this]);e.length;){var d=e.pop();d.aabb.overlaps(b)&&Array.prototype.push.apply(c,d.data);Array.prototype.push.apply(e,d.children)}return c};var m=new h;c.prototype.rayQuery=function(b,c,e){return b.getAABB(m),m.toLocalFrame(c,m),this.aabbQuery(m,e),e};c.prototype.removeEmptyNodes=function(){for(var b=[this];b.length;){for(var c=b.pop(),e=c.children.length-1;0<=e;e--)c.children[e].data.length||c.children.splice(e,1);Array.prototype.push.apply(b, -c.children)}}},{'../collision/AABB':3,'../math/Vec3':30}],51:[function(b,d){function c(){this.objects=[];this.type=Object}d.exports=c;c.prototype.release=function(){for(var b=arguments.length,c=0;c!==b;c++)this.objects.push(arguments[c])};c.prototype.get=function(){return 0===this.objects.length?this.constructObject():this.objects.pop()};c.prototype.constructObject=function(){throw Error('constructObject() not implemented in this Pool subclass yet!');}},{}],52:[function(b,d){function c(){this.data= -{keys:[]}}d.exports=c;c.prototype.get=function(b,c){if(b>c){var d=c;c=b;b=d}return this.data[b+'-'+c]};c.prototype.set=function(b,c,d){if(b>c){var g=c;c=b;b=g}g=b+'-'+c;this.get(b,c)||this.data.keys.push(g);this.data[g]=d};c.prototype.reset=function(){for(var b=this.data,c=b.keys;0p.boundingSphereRadius+q.boundingSphereRadius)){var r=null;p.material&&q.material&&(r=e.getContactMaterial(p.material,q.material)||null);this.currentContactMaterial=r||l||e.defaultContactMaterial;(r=this[p.type|q.type])&&(p.type=z.dot(q)){var u=this.createContactEquation(m,p,b,c);u.ni.copy(z);var r=I;z.scale(q.dot(z),r);n.vsub(r,r);u.ri.copy(r);u.ri.vsub(m.position,u.ri);u.rj.copy(n);u.rj.vsub(p.position,u.rj);this.result.push(u);this.createFrictionEquationsFromContact(u,this.frictionResult)}}};var K=new k,H=new k,C=(new k,new k),P=new k, -Q=new k,T=new k,fa=new k,ja=new k,ia=new k,N=new k,ma=new k,V=new k,ca=new k,ba=new d,L=[];c.prototype[g.types.SPHERE|g.types.TRIMESH]=c.prototype.sphereTrimesh=function(b,c,e,d,g,k,m,p){l.pointToLocalFrame(d,k,e,ia);g=b.radius;ba.lowerBound.set(ia.x-g,ia.y-g,ia.z-g);ba.upperBound.set(ia.x+g,ia.y+g,ia.z+g);c.getTrianglesInAABB(ba,L);var n=b.radius*b.radius;for(g=0;gq;q++)if(c.getVertex(c.indices[3*L[g]+q],C),C.vsub(ia,H),H.norm2()<=n){P.copy(C);l.pointToWorldFrame(d,k, -P,C);C.vsub(e,H);var u=this.createContactEquation(m,p,b,c);u.ni.copy(H);u.ni.normalize();u.ri.copy(u.ni);u.ri.scale(b.radius,u.ri);u.ri.vadd(e,u.ri);u.ri.vsub(m.position,u.ri);u.rj.copy(C);u.rj.vsub(p.position,u.rj);this.result.push(u);this.createFrictionEquationsFromContact(u,this.frictionResult)}for(g=0;gq;q++)c.getVertex(c.indices[3*L[g]+q],Q),c.getVertex(c.indices[3*L[g]+(q+1)%3],T),T.vsub(Q,fa),ia.vsub(T,N),e=N.dot(fa),ia.vsub(Q,N),u=N.dot(fa),0e&&(ia.vsub(Q,N), -ja.copy(fa),ja.normalize(),u=N.dot(ja),ja.scale(u,N),N.vadd(Q,N),e=N.distanceTo(ia),eC&&0K&&K>-G&&I>P&&P>-I&&(C=Math.abs(C- -H-h),(null===r||r>C)&&(r=C,q=K,u=P,p=H,ya.copy(z),U.copy(D),Ea.copy(w),n++))}}n&&(m=!0,n=this.createContactEquation(k,l,b,c),ya.mult(-h,n.ri),n.ni.copy(ya),n.ni.negate(n.ni),ya.mult(p,ya),U.mult(q,U),ya.vadd(U,ya),Ea.mult(u,Ea),ya.vadd(Ea,n.rj),n.ri.vadd(e,n.ri),n.ri.vsub(k.position,n.ri),n.rj.vadd(d,n.rj),n.rj.vsub(l.position,n.rj),this.result.push(n),this.createFrictionEquationsFromContact(n,this.frictionResult));C=g.get();for(p=0;2!==p&&!m;p++)for(q=0;2!==q&&!m;q++)for(u=0;2!==u&&!m;u++)if(C.set(0, -0,0),p?C.vadd(va[0],C):C.vsub(va[0],C),q?C.vadd(va[1],C):C.vsub(va[1],C),u?C.vadd(va[2],C):C.vsub(va[2],C),d.vadd(C,ra),ra.vsub(e,ra),ra.norm2()D&&(m=!0,u=this.createContactEquation(k,l,b,c),v.vadd(t,u.rj),u.rj.copy(u.rj),C.negate(u.ni),u.ni.normalize(),u.ri.copy(u.rj),u.ri.vadd(d,u.ri),u.ri.vsub(e,u.ri),u.ri.normalize(),u.ri.mult(h,u.ri),u.ri.vadd(e, -u.ri),u.ri.vsub(k.position,u.ri),u.rj.vadd(d,u.rj),u.rj.vsub(l.position,u.rj),this.result.push(u),this.createFrictionEquationsFromContact(u,this.frictionResult))}g.release(r,v,n,t,C)};var la=new k,xa=new k,Da=new k,Ka=new k,mb=new k,Sa=new k,hb=new k,nb=new k,Dc=new k,Ub=new k;c.prototype[g.types.SPHERE|g.types.CONVEXPOLYHEDRON]=c.prototype.sphereConvex=function(b,c,e,d,g,h,k,l){g=this.v3pool;e.vsub(d,la);for(var m=c.faceNormals,p=c.faces,n=c.vertices,q=b.radius,u=0;u!==n.length;u++){var r=mb;h.vmult(n[u], -r);d.vadd(r,r);var v=Ka;if(r.vsub(e,v),v.norm2()H&&0=K&&!1===G)){C=!1;break a}null===G&&(G=0=qb.dot(Gb)){var p=this.createContactEquation(k,l,b,c),n=Qb;qb.mult(qb.dot(Gb),n);Ya.vsub(n,n);n.vsub(e,p.ri);p.ni.copy(qb);Ya.vsub(d,p.rj);p.ri.vadd(e,p.ri);p.ri.vsub(k.position,p.ri);p.rj.vadd(d,p.rj);p.rj.vsub(l.position,p.rj);this.result.push(p);g++;this.enableFrictionReduction||this.createFrictionEquationsFromContact(p,this.frictionResult)}this.enableFrictionReduction&& -g&&this.createFrictionFromAverage(g)};var xb=new k,Qa=new k;c.prototype[g.types.CONVEXPOLYHEDRON]=c.prototype.convexConvex=function(b,c,e,d,g,h,k,l,m,p,n,q){if(!(e.distanceTo(d)>b.boundingSphereRadius+c.boundingSphereRadius)&&b.findSeparatingAxis(c,e,g,d,h,xb,n,q)){n=[];b.clipAgainstHull(e,g,c,d,h,xb,-100,100,n);for(h=g=0;h!==n.length;h++){q=this.createContactEquation(k,l,b,c,m,p);var u=q.ri,r=q.rj;xb.negate(q.ni);n[h].normal.negate(Qa);Qa.mult(n[h].depth,Qa);n[h].point.vadd(Qa,u);r.copy(n[h].point); -u.vsub(e,u);r.vsub(d,r);u.vadd(e,u);u.vsub(k.position,u);r.vadd(d,r);r.vsub(l.position,r);this.result.push(q);g++;this.enableFrictionReduction||this.createFrictionEquationsFromContact(q,this.frictionResult)}this.enableFrictionReduction&&g&&this.createFrictionFromAverage(g)}};var cc=new k,Fb=new k,ab=new k;c.prototype[g.types.PLANE|g.types.PARTICLE]=c.prototype.planeParticle=function(b,c,e,d,g,h,k,l){cc.set(0,0,1);k.quaternion.vmult(cc,cc);d.vsub(k.position,Fb);0>=cc.dot(Fb)&&(b=this.createContactEquation(l, -k,c,b),b.ni.copy(cc),b.ni.negate(b.ni),b.ri.set(0,0,0),cc.mult(cc.dot(d),ab),d.vsub(ab,ab),b.rj.copy(ab),this.result.push(b),this.createFrictionEquationsFromContact(b,this.frictionResult))};var yb=new k;c.prototype[g.types.PARTICLE|g.types.SPHERE]=c.prototype.sphereParticle=function(b,c,e,d,g,h,k,l){yb.set(0,0,1);d.vsub(e,yb);yb.norm2()<=b.radius*b.radius&&(c=this.createContactEquation(l,k,c,b),yb.normalize(),c.rj.copy(yb),c.rj.mult(b.radius,c.rj),c.ni.copy(yb),c.ni.negate(c.ni),c.ri.set(0,0,0),this.result.push(c), -this.createFrictionEquationsFromContact(c,this.frictionResult))};var Ga=new m,Vb=new k,Fd=(new k,new k),td=new k,Sb=new k;c.prototype[g.types.PARTICLE|g.types.CONVEXPOLYHEDRON]=c.prototype.convexParticle=function(b,c,e,d,g,h,k,l){var m=-1;h=null;var p=0;if(Vb.copy(d),Vb.vsub(e,Vb),g.conjugate(Ga),Ga.vmult(Vb,Vb),b.pointIsInside(Vb)){b.worldVerticesNeedsUpdate&&b.computeWorldVertices(e,g);b.worldFaceNormalsNeedsUpdate&&b.computeWorldFaceNormals(g);g=0;for(var n=b.faces.length;g!==n;g++){var q=b.worldFaceNormals[g]; -d.vsub(b.worldVertices[b.faces[g][0]],td);var u=-q.dot(td);(null===h||Math.abs(u)r||0>n||u>p.length||v>p[0].length)){0>u&&(u=0);0>r&&(r=0);0>v&&(v=0);0>n&&(n=0);u>=p.length&&(u=p.length-1);r>=p.length&&(r=p.length-1);n>=p[0].length&&(n=p[0].length-1);v>=p[0].length&&(v=p[0].length-1);p=[];c.getRectMinMax(u,v,r,n,p);var t=p[0];if(!(wb.z-q>p[1]||wb.z+qq;q++)for(u=v;n>u;u++)c.getConvexTrianglePillar(q,u,!1),l.pointToWorldFrame(d,h,c.pillarOffset,Ec),e.distanceTo(Ec)< -c.pillarConvex.boundingSphereRadius+b.boundingSphereRadius&&this.convexConvex(b,c.pillarConvex,e,Ec,g,h,k,m,null,null,Md,null),c.getConvexTrianglePillar(q,u,!0),l.pointToWorldFrame(d,h,c.pillarOffset,Ec),e.distanceTo(Ec)r||0>q||u>p.length||q>p[0].length)){0>u&&(u=0);0>r&&(r=0);0>v&&(v=0);0>q&&(q=0);u>=p.length&&(u=p.length-1);r>=p.length&&(r=p.length-1);q>=p[0].length&&(q=p[0].length-1);v>=p[0].length&&(v=p[0].length-1);p=[];c.getRectMinMax(u,v,r,q,p);var t=p[0];if(!(eb.z-n>p[1]||eb.z+nu;u++)for(p=v;q>p;p++)if(t=n.length,c.getConvexTrianglePillar(u, -p,!1),l.pointToWorldFrame(d,h,c.pillarOffset,zc),e.distanceTo(zc)1E3*b));g++);this.time+= -c;b=this.time%b/b;c=this.bodies;for(d=0;d!==c.length;d++)e=c[d],e.type!==n.STATIC&&e.sleepState!==n.SLEEPING?(e.position.vsub(e.previousPosition,G),G.scale(b,G),e.position.vadd(G,e.interpolatedPosition)):(e.interpolatedPosition.copy(e.position),e.interpolatedQuaternion.copy(e.quaternion))}};var I={type:'postStep'},K={type:'preStep'},H={type:'collide',body:null,contact:null},C=[],P=[],Q=[],T=[],fa=(new h,new h,new h,new h,new h,new h,new h,new h,new h,new d,new d),ja=new d,ia=new h;c.prototype.internalStep= -function(b){this.dt=b;var c,e=this.contacts,d=this.numObjects(),h=this.bodies,k=this.solver,l=this.gravity,m=this.doProfiling,p=this.profile,q=n.DYNAMIC,u=this.constraints,r=(l.norm(),l.x),v=l.y,t=l.z;m&&(c=performance.now());for(l=0;l!==d;l++){var z=h[l];if(z.type&q){var D=z.force;z=z.mass;D.x+=z*r;D.y+=z*v;D.z+=z*t}}l=0;for(z=this.subsystems.length;l!==z;l++)this.subsystems[l].update();m&&(c=performance.now());Q.length=0;T.length=0;this.broadphase.collisionPairs(this,Q,T);m&&(p.broadphase=performance.now()- -c);z=u.length;for(l=0;l!==z;l++)if(r=u[l],!r.collideConnected)for(v=Q.length-1;0<=v;--v)(r.bodyA===Q[v]&&r.bodyB===T[v]||r.bodyB===Q[v]&&r.bodyA===T[v])&&(Q.splice(v,1),T.splice(v,1));this.collisionMatrixTick();m&&(c=performance.now());z=e.length;for(l=0;l!==z;l++)C.push(e[l]);e.length=0;z=this.frictionEquations.length;for(l=0;l!==z;l++)P.push(this.frictionEquations[l]);this.frictionEquations.length=0;this.narrowphase.getContacts(Q,T,this,e,C,this.frictionEquations,P);m&&(p.narrowphase=performance.now()- -c);m&&(c=performance.now());for(l=0;l=2*Math.pow(t.sleepSpeedLimit,2)&&(z._wakeUpAfterNarrowphase=!0),t.allowSleep&&t.type===n.DYNAMIC&&t.sleepState===n.SLEEPING&&z.sleepState===n.AWAKE&&z.type!==n.STATIC&&z.velocity.norm2()+z.angularVelocity.norm2()>=2*Math.pow(z.sleepSpeedLimit,2)&&(t._wakeUpAfterNarrowphase=!0),this.collisionMatrix.set(z,t,!0),this.collisionMatrixPrevious.get(z,t)||(H.body=t,H.contact=r,z.dispatchEvent(H),H.body=z,t.dispatchEvent(H));m&&(p.makeContactConstraints=performance.now()- -c,c=performance.now());for(l=0;l!==d;l++)z=h[l],z._wakeUpAfterNarrowphase&&(z.wakeUp(),z._wakeUpAfterNarrowphase=!1);z=u.length;for(l=0;l!==z;l++)for(r=u[l],r.update(),v=0,e=r.equations.length;v!==e;v++)k.addEquation(r.equations[v]);k.solve(b,this);m&&(p.solve=performance.now()-c);k.removeAllEquations();k=Math.pow;for(l=0;l!==d;l++)if(z=h[l],z.type&q&&(u=k(1-z.linearDamping,b),e=z.velocity,e.mult(u,e),u=z.angularVelocity))e=k(1-z.angularDamping,b),u.mult(e,u);this.dispatchEvent(K);for(l=0;l!==d;l++)z= -h[l],z.preStep&&z.preStep.call(z);m&&(c=performance.now());q=n.DYNAMIC|n.KINEMATIC;k=0===this.stepnumber%(this.quatNormalizeSkip+1);u=this.quatNormalizeFast;e=.5*b;g.types.PLANE;g.types.CONVEXPOLYHEDRON;for(l=0;l!==d;l++)if(z=h[l],r=z.force,v=z.torque,z.type&q&&z.sleepState!==n.SLEEPING){t=z.velocity;D=z.angularVelocity;var w=z.position,G=z.quaternion,U=z.invMass,N=z.invInertiaWorld;t.x+=r.x*U*b;t.y+=r.y*U*b;t.z+=r.z*U*b;z.angularVelocity&&(N.vmult(v,ia),ia.mult(b,ia),ia.vadd(D,D));w.x+=t.x*b;w.y+= -t.y*b;w.z+=t.z*b;z.angularVelocity&&(fa.set(D.x,D.y,D.z,0),fa.mult(G,ja),G.x+=e*ja.x,G.y+=e*ja.y,G.z+=e*ja.z,G.w+=e*ja.w,k&&(u?G.normalizeFast():G.normalize()));z.aabb&&(z.aabbNeedsUpdate=!0);z.updateInertiaWorld&&z.updateInertiaWorld()}this.clearForces();this.broadphase.dirty=!0;m&&(p.integrate=performance.now()-c);this.time+=b;this.stepnumber+=1;this.dispatchEvent(I);for(l=0;l!==d;l++)z=h[l],(b=z.postStep)&&b.call(z);if(this.allowSleep)for(l=0;l!==d;l++)h[l].sleepTick(this.time)};c.prototype.clearForces= -function(){for(var b=this.bodies,c=b.length,e=0;e!==c;e++){var d=b[e];d.force;d.torque;d.force.set(0,0,0);d.torque.set(0,0,0)}}},{'../collision/AABB':3,'../collision/ArrayCollisionMatrix':4,'../collision/NaiveBroadphase':7,'../collision/Ray':9,'../collision/RaycastResult':10,'../equations/ContactEquation':19,'../equations/FrictionEquation':21,'../material/ContactMaterial':24,'../material/Material':25,'../math/Quaternion':28,'../math/Vec3':30,'../objects/Body':31,'../shapes/Shape':43,'../solver/GSSolver':46, +this.rotation=this.steering=0;this.rollInfluence=b.rollInfluence;this.maxSuspensionForce=b.maxSuspensionForce;this.brake=this.engineForce=0;this.isFrontWheel=b.isFrontWheel;this.clippedInvContactDotSuspension=1;this.forwardImpulse=this.sideImpulse=this.suspensionLength=this.skidInfo=this.suspensionForce=this.suspensionRelativeVelocity=0;this.raycastResult=new h;this.worldTransform=new k;this.isInContact=!1}var c=b('../math/Vec3'),k=b('../math/Transform'),h=b('../collision/RaycastResult'),l=b('../utils/Utils'); +e.exports=d;var n=new c,q=new c;n=new c;d.prototype.updateWheel=function(b){var g=this.raycastResult;if(this.isInContact){var c=g.hitNormalWorld.dot(g.directionWorld);g.hitPointWorld.vsub(b.position,q);b.getVelocityAtWorldPoint(q,n);b=g.hitNormalWorld.dot(n);-.1<=c?(this.suspensionRelativeVelocity=0,this.clippedInvContactDotSuspension=10):(c=-1/c,this.suspensionRelativeVelocity=b*c,this.clippedInvContactDotSuspension=c)}else g.suspensionLength=this.suspensionRestLength,this.suspensionRelativeVelocity= +0,g.directionWorld.scale(-1,g.hitNormalWorld),this.clippedInvContactDotSuspension=1}},{'../collision/RaycastResult':10,'../math/Transform':29,'../math/Vec3':30,'../utils/Utils':53}],37:[function(b,e){function d(b){c.call(this);this.type=c.types.BOX;this.halfExtents=b;this.convexPolyhedronRepresentation=null;this.updateConvexPolyhedronRepresentation();this.updateBoundingSphereRadius()}e.exports=d;var c=b('./Shape'),k=b('../math/Vec3'),h=b('./ConvexPolyhedron');d.prototype=new c;d.prototype.constructor= +d;d.prototype.updateConvexPolyhedronRepresentation=function(){var b=this.halfExtents.x,c=this.halfExtents.y,g=this.halfExtents.z;b=[new k(-b,-c,-g),new k(b,-c,-g),new k(b,c,-g),new k(-b,c,-g),new k(-b,-c,g),new k(b,-c,g),new k(b,c,g),new k(-b,c,g)];this.convexPolyhedronRepresentation=b=(new k(0,0,1),new k(0,1,0),new k(1,0,0),new h(b,[[3,2,1,0],[4,5,6,7],[5,4,0,1],[2,3,7,6],[0,4,7,3],[1,2,6,5]]));b.material=this.material};d.prototype.calculateLocalInertia=function(b,c){return c=c||new k,d.calculateInertia(this.halfExtents, +b,c),c};d.calculateInertia=function(b,c,g){g.x=1/12*c*(4*b.y*b.y+4*b.z*b.z);g.y=1/12*c*(4*b.x*b.x+4*b.z*b.z);g.z=1/12*c*(4*b.y*b.y+4*b.x*b.x)};d.prototype.getSideNormals=function(b,c){var g=this.halfExtents;if(b[0].set(g.x,0,0),b[1].set(0,g.y,0),b[2].set(0,0,g.z),b[3].set(-g.x,0,0),b[4].set(0,-g.y,0),b[5].set(0,0,-g.z),void 0!==c)for(g=0;g!==b.length;g++)c.vmult(b[g],b[g]);return b};d.prototype.volume=function(){return 8*this.halfExtents.x*this.halfExtents.y*this.halfExtents.z};d.prototype.updateBoundingSphereRadius= +function(){this.boundingSphereRadius=this.halfExtents.norm()};var l=new k;new k;d.prototype.forEachWorldCorner=function(b,c,g){var d=this.halfExtents;d=[[d.x,d.y,d.z],[-d.x,d.y,d.z],[-d.x,-d.y,d.z],[-d.x,-d.y,-d.z],[d.x,-d.y,-d.z],[d.x,d.y,-d.z],[-d.x,d.y,-d.z],[d.x,-d.y,d.z]];for(var e=0;ee;e++){h=n[e];c.vmult(h,h);b.vadd(h,h);var k=h.x,m=h.y;h=h.z;k>d.x&&(d.x=k);m>d.y&&(d.y=m);h>d.z&&(d.z=h);kg.dot(this.vertices[this.faces[b][0]]))for(console.error('.faceNormals['+b+'] = Vec3('+g.toString()+') looks like it points into the shape? The vertices follow. Make sure they are ordered CCW around the normal, using the right hand rule.'),g=0;gt&&(t=z,q=r)}t=[];r=c.faces[q];z=r.length;for(var u=0;z>u;u++){var w= +c.vertices[r[u]],C=new k;C.copy(w);e.vmult(C,C);d.vadd(C,C);t.push(C)}0<=q&&this.clipFaceAgainstHull(h,b,g,t,l,p,n)};var g=new k,p=new k,r=new k,u=new k,E=new k,v=new k;d.prototype.findSeparatingAxis=function(b,c,d,e,h,k,m,l){var n=Number.MAX_VALUE,q=0;if(this.uniqueAxes)for(var t=0;t!==this.uniqueAxes.length;t++){d.vmult(this.uniqueAxes[t],g);var z=this.testSepAxis(g,b,c,d,e,h);if(!1===z)return!1;n>z&&(n=z,k.copy(g))}else{var w=m?m.length:this.faces.length;for(t=0;w>t;t++){z=m?m[t]:t;g.copy(this.faceNormals[z]); +d.vmult(g,g);z=this.testSepAxis(g,b,c,d,e,h);if(!1===z)return!1;n>z&&(n=z,k.copy(g))}}if(b.uniqueAxes)for(t=0;t!==b.uniqueAxes.length;t++){h.vmult(b.uniqueAxes[t],p);q++;z=this.testSepAxis(p,b,c,d,e,h);if(!1===z)return!1;n>z&&(n=z,k.copy(p))}else for(m=l?l.length:b.faces.length,t=0;m>t;t++){z=l?l[t]:t;p.copy(b.faceNormals[z]);h.vmult(p,p);q++;z=this.testSepAxis(p,b,c,d,e,h);if(!1===z)return!1;n>z&&(n=z,k.copy(p))}for(l=0;l!==this.uniqueEdges.length;l++)for(d.vmult(this.uniqueEdges[l],u),q=0;q!==b.uniqueEdges.length;q++)if(h.vmult(b.uniqueEdges[q], +E),u.cross(E,v),!v.almostZero()){v.normalize();t=this.testSepAxis(v,b,c,d,e,h);if(!1===t)return!1;n>t&&(n=t,k.copy(v))}return e.vsub(c,r),0c||b>g)return!1;c-=e;b=g-b;return b>c?c:b};var w=new k,I=new k;d.prototype.calculateLocalInertia=function(b,g){this.computeLocalAABB(w,I);var c=I.x-w.x,d=I.y-w.y,e=I.z-w.z;g.x=1/12*b*(4*d*d+4*e*e); +g.y=1/12*b*(4*c*c+4*e*e);g.z=1/12*b*(4*d*d+4*c*c)};d.prototype.getPlaneConstantOfFace=function(b){return-this.faceNormals[b].dot(this.vertices[this.faces[b][0]])};var H=new k,K=new k,C=new k,D=new k,Q=new k,M=new k,X=new k,ka=new k;d.prototype.clipFaceAgainstHull=function(b,g,c,d,e,h,k){for(var m=[],l=-1,p=Number.MAX_VALUE,n=0;nq&&(p=q,l=n)}if(!(0>l)){b=this.faces[l];b.connectedFaces=[];for(p=0;pn;n++){q=this.vertices[b[n]];q.vsub(this.vertices[b[(n+1)%p]],K);C.copy(K);c.vmult(C,C);g.vadd(C,C);D.copy(this.faceNormals[l]);c.vmult(D,D);g.vadd(D,D);C.cross(D,Q);Q.negate(Q);M.copy(q);c.vmult(M,M);g.vadd(M,M);q=(-M.dot(Q),b.connectedFaces[n]);X.copy(this.faceNormals[q]);q=this.getPlaneConstantOfFace(q);ka.copy(X);c.vmult(ka,ka);q-=ka.dot(g); +for(this.clipFaceAgainstPlane(d,m,ka,q);d.length;)d.shift();for(;m.length;)d.push(m.shift())}X.copy(this.faceNormals[l]);q=this.getPlaneConstantOfFace(l);ka.copy(X);c.vmult(ka,ka);q-=ka.dot(g);for(p=0;p=g&&(console.log('clamped: depth='+g+' to minDist='+(e+'')),g=e),h>=g)c=d[p],0>=g&&k.push({point:c,normal:ka,depth:g})}};d.prototype.clipFaceAgainstPlane=function(b,g,c,d){var e,h=b.length;if(2>h)return g;var m=b[b.length-1],l=b[0];var p=c.dot(m)+d;for(var n=0;h> +n;n++){if(l=b[n],e=c.dot(l)+d,0>p){if(0>e){var q=new k;q.copy(l)}else q=new k,m.lerp(l,p/(p-e),q);g.push(q)}else 0>e&&(q=new k,m.lerp(l,p/(p-e),q),g.push(q),g.push(l));m=l;p=e}return g};d.prototype.computeWorldVertices=function(b,g){for(var c=this.vertices.length;this.worldVertices.lengthe;e++){var h=d[e];h.xg.x&&(g.x=h.x);h.yg.y&&(g.y=h.y);h.zg.z&&(g.z=h.z)}};d.prototype.computeWorldFaceNormals=function(b){for(var g=this.faceNormals.length;this.worldFaceNormals.lengthb&&(b=e)}this.boundingSphereRadius=Math.sqrt(b)};var ja=new k;d.prototype.calculateWorldAABB=function(b,g,c,d){for(var e,h,k,m,l,p,n=this.vertices.length,q=this.vertices,t=0;n>t;t++){ja.copy(q[t]);g.vmult(ja,ja);b.vadd(ja,ja);var r=ja;r.xm||void 0===m)&&(m=r.x);r.y +l||void 0===l)&&(l=r.y);r.zp||void 0===p)&&(p=r.z)}c.set(e,h,k);d.set(m,l,p)};d.prototype.volume=function(){return 4*Math.PI*this.boundingSphereRadius/3};d.prototype.getAveragePointLocal=function(b){b=b||new k;for(var g=this.vertices.length,c=this.vertices,d=0;g>d;d++)b.vadd(c[d],b);return b.mult(1/g,b),b};d.prototype.transformAllPoints=function(b,g){var c=this.vertices.length,d=this.vertices;if(g){for(var e=0;c>e;e++){var h=d[e];g.vmult(h,h)}for(e=0;ee;e++)h=d[e],h.vadd(b,h)};var ba=new k,N=new k,la=new k;d.prototype.pointIsInside=function(b){var g=this.vertices,c=this.faces,d=this.faceNormals,e=this.faces.length;this.getAveragePointLocal(ba);for(var h=0;e>h;h++){var k=(this.faces[h].length,d[h]);var m=g[c[h][0]],l=N;b.vsub(m,l);l=k.dot(l);var p=la;ba.vsub(m,p);k=k.dot(p);if(0>l&&0k)return!1}return-1};var T=(new k,new k),aa=new k;d.project=function(b,g,c,d,e){var k=b.vertices.length;b= +b.vertices;aa.setZero();h.vectorToLocalFrame(c,d,g,T);h.pointToLocalFrame(c,d,aa,aa);d=aa.dot(T);c=g=b[0].dot(T);for(var m=1;k>m;m++){var l=b[m].dot(T);l>g&&(g=l);c>l&&(c=l)}if(c-=d,g-=d,c>g)k=c,c=g,g=k;e[0]=g;e[1]=c}},{'../math/Quaternion':28,'../math/Transform':29,'../math/Vec3':30,'./Shape':43}],39:[function(b,e){function d(b,d,e,m){var g=[],l=[],n=[],q=[],E=[],v=Math.cos,t=Math.sin;g.push(new k(d*v(0),d*t(0),.5*-e));q.push(0);g.push(new k(b*v(0),b*t(0),.5*e));E.push(1);for(var z=0;m>z;z++){var w= +2*Math.PI/m*(z+1),I=2*Math.PI/m*(z+.5);m-1>z?(g.push(new k(d*v(w),d*t(w),.5*-e)),q.push(2*z+2),g.push(new k(b*v(w),b*t(w),.5*e)),E.push(2*z+3),n.push([2*z+2,2*z+3,2*z+1,2*z])):n.push([0,1,2*z+1,2*z]);(1===m%2||m/2>z)&&l.push(new k(v(I),t(I),0))}n.push(E);l.push(new k(0,0,1));b=[];for(z=0;ze&&(c=e)}this.minValue=c};d.prototype.updateMaxValue=function(){for(var b=this.data,c=b[0][0],d=0;d!==b.length;d++)for(var g=0;g!==b[d].length;g++){var e=b[d][g];e>c&&(c= +e)}this.maxValue=c};d.prototype.setHeightValueAtIndex=function(b,c,d){this.data[b][c]=d;this.clearCachedConvexTrianglePillar(b,c,!1);0=b;b++)for(var m= +c;g>=m;m++){var l=h[b][m];l>k&&(k=l)}e[0]=this.minValue;e[1]=k};d.prototype.getIndexOfPosition=function(b,c,d,g){var e=this.elementSize,h=this.data;b=Math.floor(b/e);c=Math.floor(c/e);return d[0]=b,d[1]=c,g&&(0>b&&(b=0),0>c&&(c=0),b>=h.length-1&&(b=h.length-1),c>=h[0].length-1&&(c=h[0].length-1)),0>b||0>c||b>=h.length-1||c>=h[0].length-1?!1:!0};d.prototype.getHeightAt=function(b,c,d){var g=[];this.getIndexOfPosition(b,c,g,d);b=[];return this.getRectMinMax(g[0],g[1]+1,g[0],g[1]+1,b),(b[0]+b[1])/2}; +d.prototype.getCacheConvexTrianglePillarKey=function(b,c,d){return b+'_'+c+'_'+(d?1:0)};d.prototype.getCachedConvexTrianglePillar=function(b,c,d){return this._cachedPillars[this.getCacheConvexTrianglePillarKey(b,c,d)]};d.prototype.setCachedConvexTrianglePillar=function(b,c,d,g,e){this._cachedPillars[this.getCacheConvexTrianglePillarKey(b,c,d)]={convex:g,offset:e}};d.prototype.clearCachedConvexTrianglePillar=function(b,c,d){delete this._cachedPillars[this.getCacheConvexTrianglePillarKey(b,c,d)]};d.prototype.getConvexTrianglePillar= +function(b,c,d){var g=this.pillarConvex,e=this.pillarOffset;if(this.cacheEnabled){var m=this.getCachedConvexTrianglePillar(b,c,d);if(m)return this.pillarConvex=m.convex,void(this.pillarOffset=m.offset);g=new k;e=new h;this.pillarConvex=g;this.pillarOffset=e}m=this.data;var l=this.elementSize,n=g.faces;g.vertices.length=6;for(var q=0;6>q;q++)g.vertices[q]||(g.vertices[q]=new h);n.length=5;for(q=0;5>q;q++)n[q]||(n[q]=[]);q=g.vertices;var t=(Math.min(m[b][c],m[b+1][c],m[b][c+1],m[b+1][c+1])-this.minValue)/ +2+this.minValue;d?(e.set((b+.75)*l,(c+.75)*l,t),q[0].set(.25*l,.25*l,m[b+1][c+1]-t),q[1].set(-.75*l,.25*l,m[b][c+1]-t),q[2].set(.25*l,-.75*l,m[b+1][c]-t),q[3].set(.25*l,.25*l,-t-1),q[4].set(-.75*l,.25*l,-t-1),q[5].set(.25*l,-.75*l,-t-1),n[0][0]=0,n[0][1]=1,n[0][2]=2,n[1][0]=5,n[1][1]=4,n[1][2]=3,n[2][0]=2,n[2][1]=5,n[2][2]=3,n[2][3]=0,n[3][0]=3,n[3][1]=4,n[3][2]=1,n[3][3]=0,n[4][0]=1,n[4][1]=4,n[4][2]=5,n[4][3]=2):(e.set((b+.25)*l,(c+.25)*l,t),q[0].set(-.25*l,-.25*l,m[b][c]-t),q[1].set(.75*l,-.25* +l,m[b+1][c]-t),q[2].set(-.25*l,.75*l,m[b][c+1]-t),q[3].set(-.25*l,-.25*l,-t-1),q[4].set(.75*l,-.25*l,-t-1),q[5].set(-.25*l,.75*l,-t-1),n[0][0]=0,n[0][1]=1,n[0][2]=2,n[1][0]=5,n[1][1]=4,n[1][2]=3,n[2][0]=0,n[2][1]=2,n[2][2]=5,n[2][3]=3,n[3][0]=1,n[3][1]=0,n[3][2]=3,n[3][3]=4,n[4][0]=4,n[4][1]=5,n[4][2]=2,n[4][3]=1);g.computeNormals();g.computeEdges();g.updateBoundingSphereRadius();this.setCachedConvexTrianglePillar(b,c,d,g,e)};d.prototype.calculateLocalInertia=function(b,c){return c=c||new h,c.set(0, +0,0),c};d.prototype.volume=function(){return Number.MAX_VALUE};d.prototype.calculateWorldAABB=function(b,c,d,g){d.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);g.set(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE)};d.prototype.updateBoundingSphereRadius=function(){var b=this.data,c=this.elementSize;this.boundingSphereRadius=(new h(b.length*c,b[0].length*c,Math.max(Math.abs(this.maxValue),Math.abs(this.minValue)))).norm()}},{'../math/Vec3':30,'../utils/Utils':53,'./ConvexPolyhedron':38, +'./Shape':43}],41:[function(b,e){function d(){c.call(this);this.type=c.types.PARTICLE}e.exports=d;var c=b('./Shape'),k=b('../math/Vec3');d.prototype=new c;d.prototype.constructor=d;d.prototype.calculateLocalInertia=function(b,c){return c=c||new k,c.set(0,0,0),c};d.prototype.volume=function(){return 0};d.prototype.updateBoundingSphereRadius=function(){this.boundingSphereRadius=0};d.prototype.calculateWorldAABB=function(b,c,d,e){d.copy(b);e.copy(b)}},{'../math/Vec3':30,'./Shape':43}],42:[function(b, +e){function d(){c.call(this);this.type=c.types.PLANE;this.worldNormal=new k;this.worldNormalNeedsUpdate=!0;this.boundingSphereRadius=Number.MAX_VALUE}e.exports=d;var c=b('./Shape'),k=b('../math/Vec3');d.prototype=new c;d.prototype.constructor=d;d.prototype.computeWorldNormal=function(b){var c=this.worldNormal;c.set(0,0,1);b.vmult(c,c);this.worldNormalNeedsUpdate=!1};d.prototype.calculateLocalInertia=function(b,c){return c||new k};d.prototype.volume=function(){return Number.MAX_VALUE};var h=new k; +d.prototype.calculateWorldAABB=function(b,c,d,e){h.set(0,0,1);c.vmult(h,h);c=Number.MAX_VALUE;d.set(-c,-c,-c);e.set(c,c,c);1===h.x&&(e.x=b.x);1===h.y&&(e.y=b.y);1===h.z&&(e.z=b.z);-1===h.x&&(d.x=b.x);-1===h.y&&(d.y=b.y);-1===h.z&&(d.z=b.z)};d.prototype.updateBoundingSphereRadius=function(){this.boundingSphereRadius=Number.MAX_VALUE}},{'../math/Vec3':30,'./Shape':43}],43:[function(b,e){function d(){this.id=d.idCounter++;this.boundingSphereRadius=this.type=0;this.collisionResponse=!0;this.material= +null}e.exports=d;d=b('./Shape');b('../math/Vec3');b('../math/Quaternion');b('../material/Material');d.prototype.constructor=d;d.prototype.updateBoundingSphereRadius=function(){throw'computeBoundingSphereRadius() not implemented for shape type '+this.type;};d.prototype.volume=function(){throw'volume() not implemented for shape type '+this.type;};d.prototype.calculateLocalInertia=function(){throw'calculateLocalInertia() not implemented for shape type '+this.type;};d.idCounter=0;d.types={SPHERE:1,PLANE:2, +BOX:4,COMPOUND:8,CONVEXPOLYHEDRON:16,HEIGHTFIELD:32,PARTICLE:64,CYLINDER:128,TRIMESH:256}},{'../material/Material':25,'../math/Quaternion':28,'../math/Vec3':30,'./Shape':43}],44:[function(b,e){function d(b){if(c.call(this),this.radius=void 0!==b?Number(b):1,this.type=c.types.SPHERE,0>this.radius)throw Error('The sphere radius cannot be negative.');this.updateBoundingSphereRadius()}e.exports=d;var c=b('./Shape'),k=b('../math/Vec3');d.prototype=new c;d.prototype.constructor=d;d.prototype.calculateLocalInertia= +function(b,c){c=c||new k;b=2*b*this.radius*this.radius/5;return c.x=b,c.y=b,c.z=b,c};d.prototype.volume=function(){return 4*Math.PI*this.radius/3};d.prototype.updateBoundingSphereRadius=function(){this.boundingSphereRadius=this.radius};d.prototype.calculateWorldAABB=function(b,c,d,e){c=this.radius;for(var h=['x','y','z'],g=0;ge?e+'_'+h:h+'_'+e]=!0},g=0;gb.x&&(b.x=d.x), +d.yb.y&&(b.y=d.y),d.zb.z&&(b.z=d.z)};d.prototype.updateAABB=function(){this.computeLocalAABB(this.aabb)};d.prototype.updateBoundingSphereRadius=function(){var b=0,c=this.vertices,g=new k,d=0;for(c=c.length/3;d!==c;d++){this.getVertex(d,g);var e=g.norm2();e>b&&(b=e)}this.boundingSphereRadius=Math.sqrt(b)};var I=(new k,new h),H=new l;d.prototype.calculateWorldAABB=function(b,c,g,d){I.position=b;I.quaternion=c;this.aabb.toWorldFrame(I,H);g.copy(H.lowerBound);d.copy(H.upperBound)}; +d.prototype.volume=function(){return 4*Math.PI*this.boundingSphereRadius/3};d.createTorus=function(b,c,g,e,h){b=b||1;c=c||.5;g=g||8;e=e||6;h=h||2*Math.PI;for(var k=[],m=[],l=0;g>=l;l++)for(var p=0;e>=p;p++){var n=p/e*h,q=l/g*Math.PI*2;k.push((b+c*Math.cos(q))*Math.cos(n),(b+c*Math.cos(q))*Math.sin(n),c*Math.sin(q))}for(l=1;g>=l;l++)for(p=1;e>=p;p++)b=(e+1)*(l-1)+p-1,c=(e+1)*(l-1)+p,h=(e+1)*l+p,m.push((e+1)*l+p-1,b,h),m.push(b,c,h);return new d(k,m)}},{'../collision/AABB':3,'../math/Quaternion':28, +'../math/Transform':29,'../math/Vec3':30,'../utils/Octree':50,'./Shape':43}],46:[function(b,e){function d(){c.call(this);this.iterations=10;this.tolerance=1E-7}e.exports=d;var c=(b('../math/Vec3'),b('../math/Quaternion'),b('./Solver'));d.prototype=new c;var k=[],h=[],l=[];d.prototype.solve=function(b,c){var d,g=0,e=this.iterations,n=this.tolerance*this.tolerance,q=this.equations,E=q.length;c=c.bodies;var v=c.length;if(0!==E)for(d=0;d!==v;d++)c[d].updateSolveMassProperties();h.length=E;l.length=E; +k.length=E;for(d=0;d!==E;d++){var t=q[d];k[d]=0;l[d]=t.computeB(b);h[d]=1/t.computeC()}if(0!==E){for(d=0;d!==v;d++)t=c[d],g=t.wlambda,t.vlambda.set(0,0,0),g&&g.set(0,0,0);for(g=0;g!==e;g++){for(var z=d=0;z!==E;z++){t=q[z];var w=l[z];var I=h[z];b=k[z];var H=t.computeGWlambda();w=I*(w-H-t.eps*b);b+wt.maxForce&&(w=t.maxForce-b);k[z]+=w;d+=0d*d)break}for(d=0;d!==v;d++)t=c[d],e=t.velocity,n=t.angularVelocity,e.vadd(t.vlambda,e),n&&n.vadd(t.wlambda, +n)}return g}},{'../math/Quaternion':28,'../math/Vec3':30,'./Solver':47}],47:[function(b,e){function d(){this.equations=[]}e.exports=d;d.prototype.solve=function(){return 0};d.prototype.addEquation=function(b){b.enabled&&this.equations.push(b)};d.prototype.removeEquation=function(b){var c=this.equations;b=c.indexOf(b);-1!==b&&c.splice(b,1)};d.prototype.removeAllEquations=function(){this.equations.length=0}},{}],48:[function(b,e){function d(b){l.call(this);this.iterations=10;this.tolerance=1E-7;this.subsolver= +b;this.nodes=[];for(this.nodePool=[];128>this.nodePool.length;)this.nodePool.push(this.createNode())}function c(b){for(var c=b.length,d=0;d!==c;d++){var e=b[d];if(!(e.visited||e.body.type&g))return e}return!1}function k(b,c,g){c.push(b.body);c=b.eqs.length;for(var d=0;d!==c;d++){var e=b.eqs[d];-1===g.indexOf(e)&&g.push(e)}}function h(b,c){return c.id-b.id}e.exports=d;var l=(b('../math/Vec3'),b('../math/Quaternion'),b('./Solver'));b=b('../objects/Body');d.prototype=new l;var n=[],q=[],m={bodies:[]}, +g=b.STATIC,p=[];d.prototype.createNode=function(){return{body:null,children:[],eqs:[],visited:!1}};d.prototype.solve=function(b,g){var d=this.nodePool,e=g.bodies,l=this.equations,r=l.length,u=e.length;for(g=this.subsolver;d.lengthI;I++)n[I]=d[I];for(I=0;I!==u;I++)d=n[I],d.body=e[I],d.children.length=0,d.eqs.length=0,d.visited=!1;for(d=0;d!==r;d++){u=l[d];I=e.indexOf(u.bi);var H=e.indexOf(u.bj);I=n[I];H=n[H];I.children.push(H);I.eqs.push(u);H.children.push(I); +H.eqs.push(u)}e=0;l=q;g.tolerance=this.tolerance;for(g.iterations=this.iterations;I=c(n);){l.length=0;m.bodies.length=0;u=I;I=k;r=m.bodies;d=l;p.push(u);u.visited=!0;for(I(u,r,d);p.length;)for(H=p.pop();u=c(H.children);)u.visited=!0,I(u,r,d),p.push(u);r=l.length;l=l.sort(h);for(I=0;I!==r;I++)g.addEquation(l[I]);g.solve(b,m);g.removeAllEquations();e++}return e}},{'../math/Quaternion':28,'../math/Vec3':30,'../objects/Body':31,'./Solver':47}],49:[function(b,e){b=function(){};e.exports=b;b.prototype= +{constructor:b,addEventListener:function(b,c){void 0===this._listeners&&(this._listeners={});var d=this._listeners;return void 0===d[b]&&(d[b]=[]),-1===d[b].indexOf(c)&&d[b].push(c),this},hasEventListener:function(b,c){if(void 0===this._listeners)return!1;var d=this._listeners;return void 0!==d[b]&&-1!==d[b].indexOf(c)?!0:!1},removeEventListener:function(b,c){if(void 0===this._listeners)return this;var d=this._listeners;if(void 0===d[b])return this;c=d[b].indexOf(c);return-1!==c&&d[b].splice(c,1), +this},dispatchEvent:function(b){if(void 0===this._listeners)return this;var c=this._listeners[b.type];if(void 0!==c){b.target=this;for(var d=0,e=c.length;e>d;d++)c[d].call(this,b)}return this}}},{}],50:[function(b,e){function d(b){b=b||{};this.root=b.root||null;this.aabb=b.aabb?b.aabb.clone():new k;this.data=[];this.children=[]}function c(b,c){c=c||{};c.root=null;c.aabb=b;d.call(this,c);this.maxDepth='undefined'!=typeof c.maxDepth?c.maxDepth:8}var k=b('../collision/AABB'),h=b('../math/Vec3');e.exports= +c;c.prototype=new d;d.prototype.reset=function(){this.children.length=this.data.length=0};d.prototype.insert=function(b,c,g){var d=this.data;if(g=g||0,!this.aabb.contains(b))return!1;var e=this.children;if(g<(this.maxDepth||this.root.maxDepth)){var h=!1;e.length||(this.subdivide(),h=!0);for(var k=0;8!==k;k++)if(e[k].insert(b,c,g+1))return!0;h&&(e.length=0)}return d.push(c),!0};var l=new h;d.prototype.subdivide=function(){var b=this.aabb,c=b.lowerBound,g=b.upperBound;b=this.children;b.push(new d({aabb:new k({lowerBound:new h(0, +0,0)})}),new d({aabb:new k({lowerBound:new h(1,0,0)})}),new d({aabb:new k({lowerBound:new h(1,1,0)})}),new d({aabb:new k({lowerBound:new h(1,1,1)})}),new d({aabb:new k({lowerBound:new h(0,1,1)})}),new d({aabb:new k({lowerBound:new h(0,0,1)})}),new d({aabb:new k({lowerBound:new h(1,0,1)})}),new d({aabb:new k({lowerBound:new h(0,1,0)})}));g.vsub(c,l);l.scale(.5,l);g=this.root||this;for(var e=0;8!==e;e++){var n=b[e];n.root=g;var u=n.aabb.lowerBound;u.x*=l.x;u.y*=l.y;u.z*=l.z;u.vadd(c,u);u.vadd(l,n.aabb.upperBound)}}; +d.prototype.aabbQuery=function(b,c){for(var g=(this.data,this.children,[this]);g.length;){var d=g.pop();d.aabb.overlaps(b)&&Array.prototype.push.apply(c,d.data);Array.prototype.push.apply(g,d.children)}return c};var n=new k;d.prototype.rayQuery=function(b,c,g){return b.getAABB(n),n.toLocalFrame(c,n),this.aabbQuery(n,g),g};d.prototype.removeEmptyNodes=function(){for(var b=[this];b.length;){for(var c=b.pop(),g=c.children.length-1;0<=g;g--)c.children[g].data.length||c.children.splice(g,1);Array.prototype.push.apply(b, +c.children)}}},{'../collision/AABB':3,'../math/Vec3':30}],51:[function(b,e){function d(){this.objects=[];this.type=Object}e.exports=d;d.prototype.release=function(){for(var b=arguments.length,d=0;d!==b;d++)this.objects.push(arguments[d])};d.prototype.get=function(){return 0===this.objects.length?this.constructObject():this.objects.pop()};d.prototype.constructObject=function(){throw Error('constructObject() not implemented in this Pool subclass yet!');}},{}],52:[function(b,e){function d(){this.data= +{keys:[]}}e.exports=d;d.prototype.get=function(b,d){if(b>d){var c=d;d=b;b=c}return this.data[b+'-'+d]};d.prototype.set=function(b,d,e){if(b>d){var c=d;d=b;b=c}c=b+'-'+d;this.get(b,d)||this.data.keys.push(c);this.data[c]=e};d.prototype.reset=function(){for(var b=this.data,d=b.keys;0p.boundingSphereRadius+q.boundingSphereRadius)){var r=null;p.material&&q.material&&(r=g.getContactMaterial(p.material,q.material)||null);this.currentContactMaterial=r||m||g.defaultContactMaterial;(r=this[p.type|q.type])&&(p.type=w.dot(q)){var t=this.createContactEquation(m,p,b,c);t.ni.copy(w);var r=H;w.scale(q.dot(w),r);n.vsub(r,r);t.ri.copy(r);t.ri.vsub(m.position,t.ri);t.rj.copy(n);t.rj.vsub(p.position,t.rj);this.result.push(t);this.createFrictionEquationsFromContact(t,this.frictionResult)}}};var K=new h,C=new h,D=(new h,new h),Q=new h, +M=new h,X=new h,ka=new h,ja=new h,ba=new h,N=new h,la=new h,T=new h,aa=new h,da=new e,R=[];d.prototype[c.types.SPHERE|c.types.TRIMESH]=d.prototype.sphereTrimesh=function(b,c,g,d,e,h,m,p){l.pointToLocalFrame(d,h,g,ba);e=b.radius;da.lowerBound.set(ba.x-e,ba.y-e,ba.z-e);da.upperBound.set(ba.x+e,ba.y+e,ba.z+e);c.getTrianglesInAABB(da,R);var n=b.radius*b.radius;for(e=0;eq;q++)if(c.getVertex(c.indices[3*R[e]+q],D),D.vsub(ba,C),C.norm2()<=n){Q.copy(D);l.pointToWorldFrame(d,h, +Q,D);D.vsub(g,C);var t=this.createContactEquation(m,p,b,c);t.ni.copy(C);t.ni.normalize();t.ri.copy(t.ni);t.ri.scale(b.radius,t.ri);t.ri.vadd(g,t.ri);t.ri.vsub(m.position,t.ri);t.rj.copy(D);t.rj.vsub(p.position,t.rj);this.result.push(t);this.createFrictionEquationsFromContact(t,this.frictionResult)}for(e=0;eq;q++)c.getVertex(c.indices[3*R[e]+q],M),c.getVertex(c.indices[3*R[e]+(q+1)%3],X),X.vsub(M,ka),ba.vsub(X,N),g=N.dot(ka),ba.vsub(M,N),t=N.dot(ka),0g&&(ba.vsub(M,N), +ja.copy(ka),ja.normalize(),t=N.dot(ja),ja.scale(t,N),N.vadd(M,N),g=N.distanceTo(ba),gD&&0K&&K>-I&&H>Q&&Q>-H&&(D=Math.abs(D- +C-h),(null===r||r>D)&&(r=D,q=K,t=Q,p=C,ta.copy(w),S.copy(v),Aa.copy(E),n++))}}n&&(l=!0,n=this.createContactEquation(k,m,b,c),ta.mult(-h,n.ri),n.ni.copy(ta),n.ni.negate(n.ni),ta.mult(p,ta),S.mult(q,S),ta.vadd(S,ta),Aa.mult(t,Aa),ta.vadd(Aa,n.rj),n.ri.vadd(g,n.ri),n.ri.vsub(k.position,n.ri),n.rj.vadd(d,n.rj),n.rj.vsub(m.position,n.rj),this.result.push(n),this.createFrictionEquationsFromContact(n,this.frictionResult));D=e.get();for(p=0;2!==p&&!l;p++)for(q=0;2!==q&&!l;q++)for(t=0;2!==t&&!l;t++)if(D.set(0, +0,0),p?D.vadd(wa[0],D):D.vsub(wa[0],D),q?D.vadd(wa[1],D):D.vsub(wa[1],D),t?D.vadd(wa[2],D):D.vsub(wa[2],D),d.vadd(D,ua),ua.vsub(g,ua),ua.norm2()v&&(l=!0,t=this.createContactEquation(k,m,b,c),z.vadd(u,t.rj),t.rj.copy(t.rj),D.negate(t.ni),t.ni.normalize(),t.ri.copy(t.rj),t.ri.vadd(d,t.ri),t.ri.vsub(g,t.ri),t.ri.normalize(),t.ri.mult(h,t.ri),t.ri.vadd(g, +t.ri),t.ri.vsub(k.position,t.ri),t.rj.vadd(d,t.rj),t.rj.vsub(m.position,t.rj),this.result.push(t),this.createFrictionEquationsFromContact(t,this.frictionResult))}e.release(r,z,n,u,D)};var ha=new h,Fa=new h,Wa=new h,Ia=new h,ib=new h,Ba=new h,wb=new h,Ta=new h,tc=new h,oc=new h;d.prototype[c.types.SPHERE|c.types.CONVEXPOLYHEDRON]=d.prototype.sphereConvex=function(b,c,g,d,e,h,k,m){e=this.v3pool;g.vsub(d,ha);for(var l=c.faceNormals,p=c.faces,n=c.vertices,q=b.radius,t=0;t!==n.length;t++){var r=ib;h.vmult(n[t], +r);d.vadd(r,r);var z=Ia;if(r.vsub(g,z),z.norm2()C&&0=K&&!1===I)){D=!1;break a}null===I&&(I=0=rb.dot(lc)){var p=this.createContactEquation(k,m,b,c),n=vb;rb.mult(rb.dot(lc),n);Na.vsub(n,n);n.vsub(g,p.ri);p.ni.copy(rb);Na.vsub(d,p.rj);p.ri.vadd(g,p.ri);p.ri.vsub(k.position,p.ri);p.rj.vadd(d,p.rj);p.rj.vsub(m.position,p.rj);this.result.push(p);e++;this.enableFrictionReduction||this.createFrictionEquationsFromContact(p,this.frictionResult)}this.enableFrictionReduction&& +e&&this.createFrictionFromAverage(e)};var La=new h,Ka=new h;d.prototype[c.types.CONVEXPOLYHEDRON]=d.prototype.convexConvex=function(b,c,g,d,e,h,k,m,l,p,n,q){if(!(g.distanceTo(d)>b.boundingSphereRadius+c.boundingSphereRadius)&&b.findSeparatingAxis(c,g,e,d,h,La,n,q)){n=[];b.clipAgainstHull(g,e,c,d,h,La,-100,100,n);for(h=e=0;h!==n.length;h++){q=this.createContactEquation(k,m,b,c,l,p);var t=q.ri,r=q.rj;La.negate(q.ni);n[h].normal.negate(Ka);Ka.mult(n[h].depth,Ka);n[h].point.vadd(Ka,t);r.copy(n[h].point); +t.vsub(g,t);r.vsub(d,r);t.vadd(g,t);t.vsub(k.position,t);r.vadd(d,r);r.vsub(m.position,r);this.result.push(q);e++;this.enableFrictionReduction||this.createFrictionEquationsFromContact(q,this.frictionResult)}this.enableFrictionReduction&&e&&this.createFrictionFromAverage(e)}};var Oc=new h,cc=new h,Ra=new h;d.prototype[c.types.PLANE|c.types.PARTICLE]=d.prototype.planeParticle=function(b,c,g,d,e,h,k,m){Oc.set(0,0,1);k.quaternion.vmult(Oc,Oc);d.vsub(k.position,cc);0>=Oc.dot(cc)&&(b=this.createContactEquation(m, +k,c,b),b.ni.copy(Oc),b.ni.negate(b.ni),b.ri.set(0,0,0),Oc.mult(Oc.dot(d),Ra),d.vsub(Ra,Ra),b.rj.copy(Ra),this.result.push(b),this.createFrictionEquationsFromContact(b,this.frictionResult))};var Ua=new h;d.prototype[c.types.PARTICLE|c.types.SPHERE]=d.prototype.sphereParticle=function(b,c,g,d,e,h,k,m){Ua.set(0,0,1);d.vsub(g,Ua);Ua.norm2()<=b.radius*b.radius&&(c=this.createContactEquation(m,k,c,b),Ua.normalize(),c.rj.copy(Ua),c.rj.mult(b.radius,c.rj),c.ni.copy(Ua),c.ni.negate(c.ni),c.ri.set(0,0,0),this.result.push(c), +this.createFrictionEquationsFromContact(c,this.frictionResult))};var va=new n,Yb=new h,Hd=(new h,new h),Bc=new h,gb=new h;d.prototype[c.types.PARTICLE|c.types.CONVEXPOLYHEDRON]=d.prototype.convexParticle=function(b,c,g,d,e,h,k,m){var l=-1;h=null;var p=0;if(Yb.copy(d),Yb.vsub(g,Yb),e.conjugate(va),va.vmult(Yb,Yb),b.pointIsInside(Yb)){b.worldVerticesNeedsUpdate&&b.computeWorldVertices(g,e);b.worldFaceNormalsNeedsUpdate&&b.computeWorldFaceNormals(e);e=0;for(var n=b.faces.length;e!==n;e++){var q=b.worldFaceNormals[e]; +d.vsub(b.worldVertices[b.faces[e][0]],Bc);var t=-q.dot(Bc);(null===h||Math.abs(t)r||0>n||t>p.length||z>p[0].length)){0>t&&(t=0);0>r&&(r=0);0>z&&(z=0);0>n&&(n=0);t>=p.length&&(t=p.length-1);r>=p.length&&(r=p.length-1);n>=p[0].length&&(n=p[0].length-1);z>=p[0].length&&(z=p[0].length-1);p=[];c.getRectMinMax(t,z,r,n,p);var u=p[0];if(!(uc.z-q>p[1]||uc.z+qq;q++)for(t=z;n>t;t++)c.getConvexTrianglePillar(q,t,!1),l.pointToWorldFrame(d,h,c.pillarOffset,Nb),g.distanceTo(Nb)< +c.pillarConvex.boundingSphereRadius+b.boundingSphereRadius&&this.convexConvex(b,c.pillarConvex,g,Nb,e,h,k,m,null,null,Le,null),c.getConvexTrianglePillar(q,t,!0),l.pointToWorldFrame(d,h,c.pillarOffset,Nb),g.distanceTo(Nb)r||0>q||t>p.length||q>p[0].length)){0>t&&(t=0);0>r&&(r=0);0>z&&(z=0);0>q&&(q=0);t>=p.length&&(t=p.length-1);r>=p.length&&(r=p.length-1);q>=p[0].length&&(q=p[0].length-1);z>=p[0].length&&(z=p[0].length-1);p=[];c.getRectMinMax(t,z,r,q,p);var u=p[0];if(!(Yc.z-n>p[1]||Yc.z+nt;t++)for(p=z;q>p;p++)if(u=n.length,c.getConvexTrianglePillar(t, +p,!1),l.pointToWorldFrame(d,h,c.pillarOffset,ld),g.distanceTo(ld)1E3*b));e++);this.time+= +c;b=this.time%b/b;c=this.bodies;for(d=0;d!==c.length;d++)g=c[d],g.type!==p.STATIC&&g.sleepState!==p.SLEEPING?(g.position.vsub(g.previousPosition,I),I.scale(b,I),g.position.vadd(I,g.interpolatedPosition)):(g.interpolatedPosition.copy(g.position),g.interpolatedQuaternion.copy(g.quaternion))}};var H={type:'postStep'},K={type:'preStep'},C={type:'collide',body:null,contact:null},D=[],Q=[],M=[],X=[],ka=(new k,new k,new k,new k,new k,new k,new k,new k,new k,new e,new e),ja=new e,ba=new k;d.prototype.internalStep= +function(b){this.dt=b;var g,d=this.contacts,e=this.numObjects(),h=this.bodies,k=this.solver,m=this.gravity,l=this.doProfiling,n=this.profile,q=p.DYNAMIC,t=this.constraints,r=(m.norm(),m.x),z=m.y,u=m.z;l&&(g=performance.now());for(m=0;m!==e;m++){var w=h[m];if(w.type&q){var v=w.force;w=w.mass;v.x+=w*r;v.y+=w*z;v.z+=w*u}}m=0;for(w=this.subsystems.length;m!==w;m++)this.subsystems[m].update();l&&(g=performance.now());M.length=0;X.length=0;this.broadphase.collisionPairs(this,M,X);l&&(n.broadphase=performance.now()- +g);w=t.length;for(m=0;m!==w;m++)if(r=t[m],!r.collideConnected)for(z=M.length-1;0<=z;--z)(r.bodyA===M[z]&&r.bodyB===X[z]||r.bodyB===M[z]&&r.bodyA===X[z])&&(M.splice(z,1),X.splice(z,1));this.collisionMatrixTick();l&&(g=performance.now());w=d.length;for(m=0;m!==w;m++)D.push(d[m]);d.length=0;w=this.frictionEquations.length;for(m=0;m!==w;m++)Q.push(this.frictionEquations[m]);this.frictionEquations.length=0;this.narrowphase.getContacts(M,X,this,d,D,this.frictionEquations,Q);l&&(n.narrowphase=performance.now()- +g);l&&(g=performance.now());for(m=0;m=2*Math.pow(u.sleepSpeedLimit,2)&&(w._wakeUpAfterNarrowphase=!0),u.allowSleep&&u.type===p.DYNAMIC&&u.sleepState===p.SLEEPING&&w.sleepState===p.AWAKE&&w.type!==p.STATIC&&w.velocity.norm2()+w.angularVelocity.norm2()>=2*Math.pow(w.sleepSpeedLimit,2)&&(u._wakeUpAfterNarrowphase=!0),this.collisionMatrix.set(w,u,!0),this.collisionMatrixPrevious.get(w,u)||(C.body=u,C.contact=r,w.dispatchEvent(C),C.body=w,u.dispatchEvent(C));l&&(n.makeContactConstraints=performance.now()- +g,g=performance.now());for(m=0;m!==e;m++)w=h[m],w._wakeUpAfterNarrowphase&&(w.wakeUp(),w._wakeUpAfterNarrowphase=!1);w=t.length;for(m=0;m!==w;m++)for(r=t[m],r.update(),z=0,d=r.equations.length;z!==d;z++)k.addEquation(r.equations[z]);k.solve(b,this);l&&(n.solve=performance.now()-g);k.removeAllEquations();k=Math.pow;for(m=0;m!==e;m++)if(w=h[m],w.type&q&&(t=k(1-w.linearDamping,b),d=w.velocity,d.mult(t,d),t=w.angularVelocity))d=k(1-w.angularDamping,b),t.mult(d,t);this.dispatchEvent(K);for(m=0;m!==e;m++)w= +h[m],w.preStep&&w.preStep.call(w);l&&(g=performance.now());q=p.DYNAMIC|p.KINEMATIC;k=0===this.stepnumber%(this.quatNormalizeSkip+1);t=this.quatNormalizeFast;d=.5*b;c.types.PLANE;c.types.CONVEXPOLYHEDRON;for(m=0;m!==e;m++)if(w=h[m],r=w.force,z=w.torque,w.type&q&&w.sleepState!==p.SLEEPING){u=w.velocity;v=w.angularVelocity;var E=w.position,I=w.quaternion,S=w.invMass,N=w.invInertiaWorld;u.x+=r.x*S*b;u.y+=r.y*S*b;u.z+=r.z*S*b;w.angularVelocity&&(N.vmult(z,ba),ba.mult(b,ba),ba.vadd(v,v));E.x+=u.x*b;E.y+= +u.y*b;E.z+=u.z*b;w.angularVelocity&&(ka.set(v.x,v.y,v.z,0),ka.mult(I,ja),I.x+=d*ja.x,I.y+=d*ja.y,I.z+=d*ja.z,I.w+=d*ja.w,k&&(t?I.normalizeFast():I.normalize()));w.aabb&&(w.aabbNeedsUpdate=!0);w.updateInertiaWorld&&w.updateInertiaWorld()}this.clearForces();this.broadphase.dirty=!0;l&&(n.integrate=performance.now()-g);this.time+=b;this.stepnumber+=1;this.dispatchEvent(H);for(m=0;m!==e;m++)w=h[m],(b=w.postStep)&&b.call(w);if(this.allowSleep)for(m=0;m!==e;m++)h[m].sleepTick(this.time)};d.prototype.clearForces= +function(){for(var b=this.bodies,c=b.length,g=0;g!==c;g++){var d=b[g];d.force;d.torque;d.force.set(0,0,0);d.torque.set(0,0,0)}}},{'../collision/AABB':3,'../collision/ArrayCollisionMatrix':4,'../collision/NaiveBroadphase':7,'../collision/Ray':9,'../collision/RaycastResult':10,'../equations/ContactEquation':19,'../equations/FrictionEquation':21,'../material/ContactMaterial':24,'../material/Material':25,'../math/Quaternion':28,'../math/Vec3':30,'../objects/Body':31,'../shapes/Shape':43,'../solver/GSSolver':46, '../utils/EventTarget':49,'../utils/TupleDictionary':52,'../utils/Vec3Pool':54,'./Narrowphase':55}]},{},[2])(2)}); -!function(a,b,d){function c(d,h){if(!b[d]){if(!a[d]){var k='function'==typeof require&&require;if(!h&&k)return k(d,!0);if(g)return g(d,!0);throw Error("Cannot find module '"+d+"'");}h=b[d]={exports:{}};a[d][0].call(h.exports,function(b){var g=a[d][1][b];return c(g?g:b)},h,h.exports)}return b[d].exports}for(var g='function'==typeof require&&require,h=0;hg.determinant(this.basis[0].concat(this.basis[1]).concat(this.basis[2])),this._left)};a.prototype.matrix=function(){if(this._matrix)return this._matrix;var a=this.basis,b=this._matrix=h.create(); -return b[0]=a[0][0],b[1]=a[0][1],b[2]=a[0][2],b[4]=a[1][0],b[5]=a[1][1],b[6]=a[1][2],b[8]=a[2][0],b[9]=a[2][1],b[10]=a[2][2],b[3]=this.center()[0],b[7]=this.center()[1],b[11]=this.center()[2],this.left()&&(b[0]*=-1,b[1]*=-1,b[2]*=-1),this._matrix};a.prototype.lerp=function(a,b){c.lerp(a,this.prevJoint,this.nextJoint,b)};a.prototype.center=function(){if(this._center)return this._center;var a=c.create();return this.lerp(a,.5),this._center=a,a};a.prototype.direction=function(){return[-1*this.basis[2][0], --1*this.basis[2][1],-1*this.basis[2][2]]}},{'./pointable':14,'gl-matrix':23,underscore:24}],2:[function(a,b){a=b.exports=function(a){this.pos=0;this._buf=[];this.size=a};a.prototype.get=function(a){return void 0==a&&(a=0),a>=this.size?void 0:a>=this._buf.length?void 0:this._buf[(this.pos-a-1)%this.size]};a.prototype.push=function(a){return this._buf[this.pos%this.size]=a,this.pos++}},{}],3:[function(a,b){var d=a('../protocol').chooseProtocol,c=a('events').EventEmitter,g=a('underscore'),h=b.exports= -function(a){this.opts=g.defaults(a||{},{host:'127.0.0.1',enableGestures:!1,scheme:this.getScheme(),port:this.getPort(),background:!1,optimizeHMD:!1,requestProtocolVersion:h.defaultProtocolVersion});this.host=this.opts.host;this.port=this.opts.port;this.scheme=this.opts.scheme;this.protocolVersionVerified=!1;this.optimizeHMD=this.background=null;this.on('ready',function(){this.enableGestures(this.opts.enableGestures);this.setBackground(this.opts.background);this.setOptimizeHMD(this.opts.optimizeHMD); -console.log(this.opts.optimizeHMD?'Optimized for head mounted display usage.':'Optimized for desktop usage.')})};h.defaultProtocolVersion=6;h.prototype.getUrl=function(){return this.scheme+'//'+this.host+':'+this.port+'/v'+this.opts.requestProtocolVersion+'.json'};h.prototype.getScheme=function(){return'ws:'};h.prototype.getPort=function(){return 6437};h.prototype.setBackground=function(a){this.opts.background=a;this.protocol&&this.protocol.sendBackground&&this.background!==this.opts.background&& -(this.background=this.opts.background,this.protocol.sendBackground(this,this.opts.background))};h.prototype.setOptimizeHMD=function(a){this.opts.optimizeHMD=a;this.protocol&&this.protocol.sendOptimizeHMD&&this.optimizeHMD!==this.opts.optimizeHMD&&(this.optimizeHMD=this.opts.optimizeHMD,this.protocol.sendOptimizeHMD(this,this.opts.optimizeHMD))};h.prototype.handleOpen=function(){this.connected||(this.connected=!0,this.emit('connect'))};h.prototype.enableGestures=function(a){this.gesturesEnabled=a? -!0:!1;this.send(this.protocol.encode({enableGestures:this.gesturesEnabled}))};h.prototype.handleClose=function(a){this.connected&&(this.disconnect(),1001===a&&1c.determinant(this.basis[0].concat(this.basis[1]).concat(this.basis[2])),this._left)};a.prototype.matrix=function(){if(this._matrix)return this._matrix;var a=this.basis,b=this._matrix=k.create(); +return b[0]=a[0][0],b[1]=a[0][1],b[2]=a[0][2],b[4]=a[1][0],b[5]=a[1][1],b[6]=a[1][2],b[8]=a[2][0],b[9]=a[2][1],b[10]=a[2][2],b[3]=this.center()[0],b[7]=this.center()[1],b[11]=this.center()[2],this.left()&&(b[0]*=-1,b[1]*=-1,b[2]*=-1),this._matrix};a.prototype.lerp=function(a,b){d.lerp(a,this.prevJoint,this.nextJoint,b)};a.prototype.center=function(){if(this._center)return this._center;var a=d.create();return this.lerp(a,.5),this._center=a,a};a.prototype.direction=function(){return[-1*this.basis[2][0], +-1*this.basis[2][1],-1*this.basis[2][2]]}},{'./pointable':14,'gl-matrix':23,underscore:24}],2:[function(a,b){a=b.exports=function(a){this.pos=0;this._buf=[];this.size=a};a.prototype.get=function(a){return void 0==a&&(a=0),a>=this.size?void 0:a>=this._buf.length?void 0:this._buf[(this.pos-a-1)%this.size]};a.prototype.push=function(a){return this._buf[this.pos%this.size]=a,this.pos++}},{}],3:[function(a,b){var e=a('../protocol').chooseProtocol,d=a('events').EventEmitter,c=a('underscore'),k=b.exports= +function(a){this.opts=c.defaults(a||{},{host:'127.0.0.1',enableGestures:!1,scheme:this.getScheme(),port:this.getPort(),background:!1,optimizeHMD:!1,requestProtocolVersion:k.defaultProtocolVersion});this.host=this.opts.host;this.port=this.opts.port;this.scheme=this.opts.scheme;this.protocolVersionVerified=!1;this.optimizeHMD=this.background=null;this.on('ready',function(){this.enableGestures(this.opts.enableGestures);this.setBackground(this.opts.background);this.setOptimizeHMD(this.opts.optimizeHMD); +console.log(this.opts.optimizeHMD?'Optimized for head mounted display usage.':'Optimized for desktop usage.')})};k.defaultProtocolVersion=6;k.prototype.getUrl=function(){return this.scheme+'//'+this.host+':'+this.port+'/v'+this.opts.requestProtocolVersion+'.json'};k.prototype.getScheme=function(){return'ws:'};k.prototype.getPort=function(){return 6437};k.prototype.setBackground=function(a){this.opts.background=a;this.protocol&&this.protocol.sendBackground&&this.background!==this.opts.background&& +(this.background=this.opts.background,this.protocol.sendBackground(this,this.opts.background))};k.prototype.setOptimizeHMD=function(a){this.opts.optimizeHMD=a;this.protocol&&this.protocol.sendOptimizeHMD&&this.optimizeHMD!==this.opts.optimizeHMD&&(this.optimizeHMD=this.opts.optimizeHMD,this.protocol.sendOptimizeHMD(this,this.opts.optimizeHMD))};k.prototype.handleOpen=function(){this.connected||(this.connected=!0,this.emit('connect'))};k.prototype.enableGestures=function(a){this.gesturesEnabled=a? +!0:!1;this.send(this.protocol.encode({enableGestures:this.gesturesEnabled}))};k.prototype.handleClose=function(a){this.connected&&(this.disconnect(),1001===a&&1a.connection.opts.requestProtocolVersion&&0==a.streamingCount){a.streamingCount=1;var c={attached:!0,streaming:!0,type:'unknown',id:'Lx00000000000'};a.devices[c.id]=c;a.emit('deviceAttached',c);a.emit('deviceStreaming',c);a.emit('streamingStarted',c);a.connection.removeListener('frame', b)}},c=function(){if(0b?(console.warn('Your Protocol Version is v'+b+', this app was designed for v'+c),e.warnOutOfDate({sV:a,pV:b}),!0):!1};r._pluginFactories={};r.plugin=function(a,b){return this._pluginFactories[a]&&console.warn('Plugin "'+a+'" already registered'),this._pluginFactories[a]=b};r.plugins=function(){return n.keys(this._pluginFactories)};r.prototype.use=function(a,b){var e,d;if(e='function'==typeof a?a:r._pluginFactories[a],!e)throw'Leap Plugin '+a+' not found.';if(b||(b={}),this.plugins[a])return n.extend(this.plugins[a], -b),this;this.plugins[a]=b;b=e.call(this,b);for(d in b)if(e=b[d],'function'==typeof e){var l=a,p=d;-1!=['beforeFrameCreated','afterFrameCreated'].indexOf(p)?this.on(p,e):(this.pipeline||(this.pipeline=new m(this)),this._pluginPipelineSteps[l]||(this._pluginPipelineSteps[l]=[]),this._pluginPipelineSteps[l].push(this.pipeline.addWrappedStep(p,e)))}else{l=a;p=d;switch(this._pluginExtendedMethods[l]||(this._pluginExtendedMethods[l]=[]),p){case 'frame':p=c;break;case 'hand':p=g;break;case 'pointable':p= -h;n.extend(k.prototype,e);n.extend(k.Invalid,e);break;case 'finger':p=k;break;default:throw l+' specifies invalid object type "'+p+'" for prototypical extension';}n.extend(p.prototype,e);n.extend(p.Invalid,e);this._pluginExtendedMethods[l].push([p,e])}return this};r.prototype.stopUsing=function(a){var b=this._pluginPipelineSteps[a];var c=this._pluginExtendedMethods[a],e;if(this.plugins[a]){if(b)for(e=0;eb?(console.warn('Your Protocol Version is v'+b+', this app was designed for v'+c),g.warnOutOfDate({sV:a,pV:b}),!0):!1};r._pluginFactories={};r.plugin=function(a,b){return this._pluginFactories[a]&&console.warn('Plugin "'+a+'" already registered'),this._pluginFactories[a]=b};r.plugins=function(){return p.keys(this._pluginFactories)};r.prototype.use=function(a,b){var g,e;if(g='function'==typeof a?a:r._pluginFactories[a],!g)throw'Leap Plugin '+a+' not found.';if(b||(b={}),this.plugins[a])return p.extend(this.plugins[a], +b),this;this.plugins[a]=b;b=g.call(this,b);for(e in b)if(g=b[e],'function'==typeof g){var m=a,l=e;-1!=['beforeFrameCreated','afterFrameCreated'].indexOf(l)?this.on(l,g):(this.pipeline||(this.pipeline=new n(this)),this._pluginPipelineSteps[m]||(this._pluginPipelineSteps[m]=[]),this._pluginPipelineSteps[m].push(this.pipeline.addWrappedStep(l,g)))}else{m=a;l=e;switch(this._pluginExtendedMethods[m]||(this._pluginExtendedMethods[m]=[]),l){case 'frame':l=d;break;case 'hand':l=c;break;case 'pointable':l= +k;p.extend(h.prototype,g);p.extend(h.Invalid,g);break;case 'finger':l=h;break;default:throw m+' specifies invalid object type "'+l+'" for prototypical extension';}p.extend(l.prototype,g);p.extend(l.Invalid,g);this._pluginExtendedMethods[m].push([l,g])}return this};r.prototype.stopUsing=function(a){var b=this._pluginPipelineSteps[a];var c=this._pluginExtendedMethods[a],g;if(this.plugins[a]){if(b)for(g=0;gUpgrade", -{onclick:function(a){'leapjs-decline-upgrade'!=a.target.id&&(a=window.open(b,'_blank','height=800,width=1000,location=1,menubar=1,resizable=1,status=1,toolbar=1,scrollbars=1'),window.focus&&a.focus());return g.hide(),!0},onmousemove:function(a){a.target==document.getElementById('leapjs-decline-upgrade')?(document.getElementById('leapjs-decline-upgrade').style.color='#000',document.getElementById('leapjs-decline-upgrade').style.boxShadow='0px 0px 2px #5daa00',document.getElementById('leapjs-accept-upgrade').style.color= +this.options.onmousemove&&a.addEventListener('mousemove',this.options.onmousemove)};d.prototype.show=function(){return document.body.appendChild(this.element),this};d.prototype.hide=function(){return document.body.removeChild(this.element),this};d.warnOutOfDate=function(a){a||(a={});var b='http://developer.leapmotion.com?';a.returnTo=window.location.href;for(var c in a)b+=c+'='+encodeURIComponent(a[c])+'&';var e;return e=new d("This site requires Leap Motion Tracking V2.", +{onclick:function(a){'leapjs-decline-upgrade'!=a.target.id&&(a=window.open(b,'_blank','height=800,width=1000,location=1,menubar=1,resizable=1,status=1,toolbar=1,scrollbars=1'),window.focus&&a.focus());return e.hide(),!0},onmousemove:function(a){a.target==document.getElementById('leapjs-decline-upgrade')?(document.getElementById('leapjs-decline-upgrade').style.color='#000',document.getElementById('leapjs-decline-upgrade').style.boxShadow='0px 0px 2px #5daa00',document.getElementById('leapjs-accept-upgrade').style.color= '#444',document.getElementById('leapjs-accept-upgrade').style.boxShadow='none'):(document.getElementById('leapjs-accept-upgrade').style.color='#000',document.getElementById('leapjs-accept-upgrade').style.boxShadow='0px 0px 2px #5daa00',document.getElementById('leapjs-decline-upgrade').style.color='#444',document.getElementById('leapjs-decline-upgrade').style.boxShadow='none')},onmouseout:function(){document.getElementById('leapjs-decline-upgrade').style.color='#444';document.getElementById('leapjs-decline-upgrade').style.boxShadow= -'none';document.getElementById('leapjs-accept-upgrade').style.color='#444';document.getElementById('leapjs-accept-upgrade').style.boxShadow='none'}}),g.show()};c.hasWarnedBones=!1;c.warnBones=function(){this.hasWarnedBones||(this.hasWarnedBones=!0,console.warn('Your Leap Service is out of date'),'undefined'!=typeof d&&d.versions&&d.versions.node||this.warnOutOfDate({reason:'bones'}))}},{__browserify_process:22}],7:[function(a,b){var d=a('./pointable'),c=a('./bone'),g=a('./dialog');a=a('underscore'); -b=b.exports=function(a){d.call(this,a);this.dipPosition=a.dipPosition;this.pipPosition=a.pipPosition;this.mcpPosition=a.mcpPosition;this.carpPosition=a.carpPosition;this.extended=a.extended;this.type=a.type;this.finger=!0;this.positions=[this.carpPosition,this.mcpPosition,this.pipPosition,this.dipPosition,this.tipPosition];a.bases?this.addBones(a):g.warnBones()};a.extend(b.prototype,d.prototype);b.prototype.addBones=function(a){this.metacarpal=new c(this,{type:0,width:this.width,prevJoint:this.carpPosition, -nextJoint:this.mcpPosition,basis:a.bases[0]});this.proximal=new c(this,{type:1,width:this.width,prevJoint:this.mcpPosition,nextJoint:this.pipPosition,basis:a.bases[1]});this.medial=new c(this,{type:2,width:this.width,prevJoint:this.pipPosition,nextJoint:this.dipPosition,basis:a.bases[2]});this.distal=new c(this,{type:3,width:this.width,prevJoint:this.dipPosition,nextJoint:a.btipPosition,basis:a.bases[3]});this.bones=[this.metacarpal,this.proximal,this.medial,this.distal]};b.prototype.toString=function(){return'Finger [ id:'+ -this.id+' '+this.length+'mmx | width:'+this.width+'mm | direction:'+this.direction+' ]'};b.Invalid={valid:!1}},{'./bone':1,'./dialog':6,'./pointable':14,underscore:24}],8:[function(a,b){var d=a('./hand'),c=a('./pointable'),g=a('./gesture').createGesture,h=a('gl-matrix'),k=h.mat3,l=h.vec3,m=a('./interaction_box'),q=a('./finger'),p=a('underscore');a=b.exports=function(a){if(this.valid=!0,this.id=a.id,this.timestamp=a.timestamp,this.hands=[],this.handsMap={},this.pointables=[],this.tools=[],this.fingers= -[],a.interactionBox&&(this.interactionBox=new m(a.interactionBox)),this.gestures=[],this.pointablesMap={},this._translation=a.t,this._rotation=p.flatten(a.r),this._scaleFactor=a.s,this.data=a,this.type='frame',this.currentFrameRate=a.currentFrameRate,a.gestures)for(var b=0,c=a.gestures.length;b!=c;b++)this.gestures.push(g(a.gestures[b]));this.postprocessData(a)};a.prototype.postprocessData=function(a){a||(a=this.data);for(var b=0,e=a.hands.length;b!=e;b++){var g=new d(a.hands[b]);g.frame=this;this.hands.push(g); -this.handsMap[g.id]=g}a.pointables=p.sortBy(a.pointables,function(a){return a.id});b=0;for(e=a.pointables.length;b!=e;b++)g=a.pointables[b],g=g.dipPosition?new q(g):new c(g),g.frame=this,this.addPointable(g)};a.prototype.addPointable=function(a){if(this.pointables.push(a),this.pointablesMap[a.id]=a,(a.tool?this.tools:this.fingers).push(a),void 0!==a.handId&&this.handsMap.hasOwnProperty(a.handId)){var b=this.handsMap[a.handId];switch(b.pointables.push(a),(a.tool?b.tools:b.fingers).push(a),a.type){case 0:b.thumb= -a;break;case 1:b.indexFinger=a;break;case 2:b.middleFinger=a;break;case 3:b.ringFinger=a;break;case 4:b.pinky=a}}};a.prototype.tool=function(a){a=this.pointable(a);return a.tool?a:c.Invalid};a.prototype.pointable=function(a){return this.pointablesMap[a]||c.Invalid};a.prototype.finger=function(a){a=this.pointable(a);return a.tool?c.Invalid:a};a.prototype.hand=function(a){return this.handsMap[a]||d.Invalid};a.prototype.rotationAngle=function(a,b){if(!this.valid||!a.valid)return 0;var c=this.rotationMatrix(a); -c=Math.acos(.5*(c[0]+c[4]+c[8]-1));if(c=isNaN(c)?0:c,void 0!==b)a=this.rotationAxis(a),c*=l.dot(a,l.normalize(l.create(),b));return c};a.prototype.rotationAxis=function(a){return this.valid&&a.valid?l.normalize(l.create(),[this._rotation[7]-a._rotation[5],this._rotation[2]-a._rotation[6],this._rotation[3]-a._rotation[1]]):l.create()};a.prototype.rotationMatrix=function(a){if(!this.valid||!a.valid)return k.create();var b=k.transpose(k.create(),this._rotation);return k.multiply(k.create(),a._rotation, +'none';document.getElementById('leapjs-accept-upgrade').style.color='#444';document.getElementById('leapjs-accept-upgrade').style.boxShadow='none'}}),e.show()};d.hasWarnedBones=!1;d.warnBones=function(){this.hasWarnedBones||(this.hasWarnedBones=!0,console.warn('Your Leap Service is out of date'),'undefined'!=typeof e&&e.versions&&e.versions.node||this.warnOutOfDate({reason:'bones'}))}},{__browserify_process:22}],7:[function(a,b){var e=a('./pointable'),d=a('./bone'),c=a('./dialog');a=a('underscore'); +b=b.exports=function(a){e.call(this,a);this.dipPosition=a.dipPosition;this.pipPosition=a.pipPosition;this.mcpPosition=a.mcpPosition;this.carpPosition=a.carpPosition;this.extended=a.extended;this.type=a.type;this.finger=!0;this.positions=[this.carpPosition,this.mcpPosition,this.pipPosition,this.dipPosition,this.tipPosition];a.bases?this.addBones(a):c.warnBones()};a.extend(b.prototype,e.prototype);b.prototype.addBones=function(a){this.metacarpal=new d(this,{type:0,width:this.width,prevJoint:this.carpPosition, +nextJoint:this.mcpPosition,basis:a.bases[0]});this.proximal=new d(this,{type:1,width:this.width,prevJoint:this.mcpPosition,nextJoint:this.pipPosition,basis:a.bases[1]});this.medial=new d(this,{type:2,width:this.width,prevJoint:this.pipPosition,nextJoint:this.dipPosition,basis:a.bases[2]});this.distal=new d(this,{type:3,width:this.width,prevJoint:this.dipPosition,nextJoint:a.btipPosition,basis:a.bases[3]});this.bones=[this.metacarpal,this.proximal,this.medial,this.distal]};b.prototype.toString=function(){return'Finger [ id:'+ +this.id+' '+this.length+'mmx | width:'+this.width+'mm | direction:'+this.direction+' ]'};b.Invalid={valid:!1}},{'./bone':1,'./dialog':6,'./pointable':14,underscore:24}],8:[function(a,b){var e=a('./hand'),d=a('./pointable'),c=a('./gesture').createGesture,k=a('gl-matrix'),h=k.mat3,l=k.vec3,n=a('./interaction_box'),q=a('./finger'),m=a('underscore');a=b.exports=function(a){if(this.valid=!0,this.id=a.id,this.timestamp=a.timestamp,this.hands=[],this.handsMap={},this.pointables=[],this.tools=[],this.fingers= +[],a.interactionBox&&(this.interactionBox=new n(a.interactionBox)),this.gestures=[],this.pointablesMap={},this._translation=a.t,this._rotation=m.flatten(a.r),this._scaleFactor=a.s,this.data=a,this.type='frame',this.currentFrameRate=a.currentFrameRate,a.gestures)for(var b=0,g=a.gestures.length;b!=g;b++)this.gestures.push(c(a.gestures[b]));this.postprocessData(a)};a.prototype.postprocessData=function(a){a||(a=this.data);for(var b=0,c=a.hands.length;b!=c;b++){var g=new e(a.hands[b]);g.frame=this;this.hands.push(g); +this.handsMap[g.id]=g}a.pointables=m.sortBy(a.pointables,function(a){return a.id});b=0;for(c=a.pointables.length;b!=c;b++)g=a.pointables[b],g=g.dipPosition?new q(g):new d(g),g.frame=this,this.addPointable(g)};a.prototype.addPointable=function(a){if(this.pointables.push(a),this.pointablesMap[a.id]=a,(a.tool?this.tools:this.fingers).push(a),void 0!==a.handId&&this.handsMap.hasOwnProperty(a.handId)){var b=this.handsMap[a.handId];switch(b.pointables.push(a),(a.tool?b.tools:b.fingers).push(a),a.type){case 0:b.thumb= +a;break;case 1:b.indexFinger=a;break;case 2:b.middleFinger=a;break;case 3:b.ringFinger=a;break;case 4:b.pinky=a}}};a.prototype.tool=function(a){a=this.pointable(a);return a.tool?a:d.Invalid};a.prototype.pointable=function(a){return this.pointablesMap[a]||d.Invalid};a.prototype.finger=function(a){a=this.pointable(a);return a.tool?d.Invalid:a};a.prototype.hand=function(a){return this.handsMap[a]||e.Invalid};a.prototype.rotationAngle=function(a,b){if(!this.valid||!a.valid)return 0;var c=this.rotationMatrix(a); +c=Math.acos(.5*(c[0]+c[4]+c[8]-1));if(c=isNaN(c)?0:c,void 0!==b)a=this.rotationAxis(a),c*=l.dot(a,l.normalize(l.create(),b));return c};a.prototype.rotationAxis=function(a){return this.valid&&a.valid?l.normalize(l.create(),[this._rotation[7]-a._rotation[5],this._rotation[2]-a._rotation[6],this._rotation[3]-a._rotation[1]]):l.create()};a.prototype.rotationMatrix=function(a){if(!this.valid||!a.valid)return h.create();var b=h.transpose(h.create(),this._rotation);return h.multiply(h.create(),a._rotation, b)};a.prototype.scaleFactor=function(a){return this.valid&&a.valid?Math.exp(this._scaleFactor-a._scaleFactor):1};a.prototype.translation=function(a){return this.valid&&a.valid?l.subtract(l.create(),this._translation,a._translation):l.create()};a.prototype.toString=function(){var a='Frame [ id:'+this.id+' | timestamp:'+this.timestamp+' | Hand count:('+this.hands.length+') | Pointable count:('+this.pointables.length+')';return this.gestures&&(a+=' | Gesture count:('+this.gestures.length+')'),a+' ]'}; a.prototype.dump=function(){var a='Frame Info:
'+this.toString();a+='

Hands:
';for(var b=0,c=this.hands.length;b!=c;b++)a+=' '+this.hands[b].toString()+'
';a+='

Pointables:
';b=0;for(c=this.pointables.length;b!=c;b++)a+=' '+this.pointables[b].toString()+'
';if(this.gestures)for(a+='

Gestures:
',b=0,c=this.gestures.length;b!=c;b++)a+=' '+this.gestures[b].toString()+'
';return a+='

Raw JSON:
',a+JSON.stringify(this.data)};a.Invalid= -{valid:!1,hands:[],fingers:[],tools:[],gestures:[],pointables:[],pointable:function(){return c.Invalid},finger:function(){return c.Invalid},hand:function(){return d.Invalid},toString:function(){return'invalid frame'},dump:function(){return this.toString()},rotationAngle:function(){return 0},rotationMatrix:function(){return k.create()},rotationAxis:function(){return l.create()},scaleFactor:function(){return 1},translation:function(){return l.create()}}},{'./finger':7,'./gesture':9,'./hand':10,'./interaction_box':12, -'./pointable':14,'gl-matrix':23,underscore:24}],9:[function(a,b,d){var c=a('gl-matrix').vec3;b=a('events').EventEmitter;var g=a('underscore'),h=(d.createGesture=function(a){switch(a.type){case 'circle':var b=new k(a);break;case 'swipe':b=new l(a);break;case 'screenTap':b=new m(a);break;case 'keyTap':b=new q(a);break;default:throw'unknown gesture type';}return b.id=a.id,b.handIds=a.handIds.slice(),b.pointableIds=a.pointableIds.slice(),b.duration=a.duration,b.state=a.state,b.type=a.type,b},d.gestureListener= -function(a,b){var c={},e={};a.on('gesture',function(a,d){if(a.type==b){if(('start'==a.state||'stop'==a.state)&&void 0===e[a.id]){var k=new h(a,d);e[a.id]=k;g.each(c,function(a,b){k.on(b,a)})}e[a.id].update(a,d);'stop'==a.state&&delete e[a.id]}});var d={start:function(a){return c.start=a,d},stop:function(a){return c.stop=a,d},complete:function(a){return c.stop=a,d},update:function(a){return c.update=a,d}};return d},d.Gesture=function(a,b){this.gestures=[a];this.frames=[b]});h.prototype.update=function(a, -b){this.lastGesture=a;this.lastFrame=b;this.gestures.push(a);this.frames.push(b);this.emit(a.state,this)};h.prototype.translation=function(){return c.subtract(c.create(),this.lastGesture.startPosition,this.lastGesture.position)};g.extend(h.prototype,b.prototype);var k=function(a){this.center=a.center;this.normal=a.normal;this.progress=a.progress;this.radius=a.radius};k.prototype.toString=function(){return'CircleGesture ['+JSON.stringify(this)+']'};var l=function(a){this.startPosition=a.startPosition; -this.position=a.position;this.direction=a.direction;this.speed=a.speed};l.prototype.toString=function(){return'SwipeGesture ['+JSON.stringify(this)+']'};var m=function(a){this.position=a.position;this.direction=a.direction;this.progress=a.progress};m.prototype.toString=function(){return'ScreenTapGesture ['+JSON.stringify(this)+']'};var q=function(a){this.position=a.position;this.direction=a.direction;this.progress=a.progress};q.prototype.toString=function(){return'KeyTapGesture ['+JSON.stringify(this)+ -']'}},{events:21,'gl-matrix':23,underscore:24}],10:[function(a,b){var d=a('./pointable'),c=a('./bone'),g=a('gl-matrix'),h=g.mat3,k=g.vec3,l=a('underscore');a=b.exports=function(a){this.id=a.id;this.palmPosition=a.palmPosition;this.direction=a.direction;this.palmVelocity=a.palmVelocity;this.palmNormal=a.palmNormal;this.sphereCenter=a.sphereCenter;this.sphereRadius=a.sphereRadius;this.valid=!0;this.pointables=[];this.fingers=[];this.arm=a.armBasis?new c(this,{type:4,width:a.armWidth,prevJoint:a.elbow, -nextJoint:a.wrist,basis:a.armBasis}):null;this.tools=[];this._translation=a.t;this._rotation=l.flatten(a.r);this._scaleFactor=a.s;this.timeVisible=a.timeVisible;this.stabilizedPalmPosition=a.stabilizedPalmPosition;this.type=a.type;this.grabStrength=a.grabStrength;this.pinchStrength=a.pinchStrength;this.confidence=a.confidence};a.prototype.finger=function(a){return(a=this.frame.finger(a))&&a.handId==this.id?a:d.Invalid};a.prototype.rotationAngle=function(a,b){if(!this.valid||!a.valid||!a.hand(this.id).valid)return 0; -var c=this.rotationMatrix(a);c=Math.acos(.5*(c[0]+c[4]+c[8]-1));if(c=isNaN(c)?0:c,void 0!==b)a=this.rotationAxis(a),c*=k.dot(a,k.normalize(k.create(),b));return c};a.prototype.rotationAxis=function(a){if(!this.valid||!a.valid)return k.create();a=a.hand(this.id);return a.valid?k.normalize(k.create(),[this._rotation[7]-a._rotation[5],this._rotation[2]-a._rotation[6],this._rotation[3]-a._rotation[1]]):k.create()};a.prototype.rotationMatrix=function(a){if(!this.valid||!a.valid)return h.create();a=a.hand(this.id); -if(!a.valid)return h.create();var b=h.transpose(h.create(),this._rotation);return h.multiply(h.create(),a._rotation,b)};a.prototype.scaleFactor=function(a){if(!this.valid||!a.valid)return 1;a=a.hand(this.id);return a.valid?Math.exp(this._scaleFactor-a._scaleFactor):1};a.prototype.translation=function(a){if(!this.valid||!a.valid)return k.create();a=a.hand(this.id);return a.valid?[this._translation[0]-a._translation[0],this._translation[1]-a._translation[1],this._translation[2]-a._translation[2]]:k.create()}; -a.prototype.toString=function(){return'Hand ('+this.type+') [ id: '+this.id+' | palm velocity:'+this.palmVelocity+' | sphere center:'+this.sphereCenter+' ] '};a.prototype.pitch=function(){return Math.atan2(this.direction[1],-this.direction[2])};a.prototype.yaw=function(){return Math.atan2(this.direction[0],-this.direction[2])};a.prototype.roll=function(){return Math.atan2(this.palmNormal[0],-this.palmNormal[1])};a.Invalid={valid:!1,fingers:[],tools:[],pointables:[],left:!1,pointable:function(){return d.Invalid}, -finger:function(){return d.Invalid},toString:function(){return'invalid frame'},dump:function(){return this.toString()},rotationAngle:function(){return 0},rotationMatrix:function(){return h.create()},rotationAxis:function(){return k.create()},scaleFactor:function(){return 1},translation:function(){return k.create()}}},{'./bone':1,'./pointable':14,'gl-matrix':23,underscore:24}],11:[function(a,b){b.exports={Controller:a('./controller'),Frame:a('./frame'),Gesture:a('./gesture'),Hand:a('./hand'),Pointable:a('./pointable'), +{valid:!1,hands:[],fingers:[],tools:[],gestures:[],pointables:[],pointable:function(){return d.Invalid},finger:function(){return d.Invalid},hand:function(){return e.Invalid},toString:function(){return'invalid frame'},dump:function(){return this.toString()},rotationAngle:function(){return 0},rotationMatrix:function(){return h.create()},rotationAxis:function(){return l.create()},scaleFactor:function(){return 1},translation:function(){return l.create()}}},{'./finger':7,'./gesture':9,'./hand':10,'./interaction_box':12, +'./pointable':14,'gl-matrix':23,underscore:24}],9:[function(a,b,e){var d=a('gl-matrix').vec3;b=a('events').EventEmitter;var c=a('underscore'),k=(e.createGesture=function(a){switch(a.type){case 'circle':var b=new h(a);break;case 'swipe':b=new l(a);break;case 'screenTap':b=new n(a);break;case 'keyTap':b=new q(a);break;default:throw'unknown gesture type';}return b.id=a.id,b.handIds=a.handIds.slice(),b.pointableIds=a.pointableIds.slice(),b.duration=a.duration,b.state=a.state,b.type=a.type,b},e.gestureListener= +function(a,b){var g={},d={};a.on('gesture',function(a,e){if(a.type==b){if(('start'==a.state||'stop'==a.state)&&void 0===d[a.id]){var h=new k(a,e);d[a.id]=h;c.each(g,function(a,b){h.on(b,a)})}d[a.id].update(a,e);'stop'==a.state&&delete d[a.id]}});var e={start:function(a){return g.start=a,e},stop:function(a){return g.stop=a,e},complete:function(a){return g.stop=a,e},update:function(a){return g.update=a,e}};return e},e.Gesture=function(a,b){this.gestures=[a];this.frames=[b]});k.prototype.update=function(a, +b){this.lastGesture=a;this.lastFrame=b;this.gestures.push(a);this.frames.push(b);this.emit(a.state,this)};k.prototype.translation=function(){return d.subtract(d.create(),this.lastGesture.startPosition,this.lastGesture.position)};c.extend(k.prototype,b.prototype);var h=function(a){this.center=a.center;this.normal=a.normal;this.progress=a.progress;this.radius=a.radius};h.prototype.toString=function(){return'CircleGesture ['+JSON.stringify(this)+']'};var l=function(a){this.startPosition=a.startPosition; +this.position=a.position;this.direction=a.direction;this.speed=a.speed};l.prototype.toString=function(){return'SwipeGesture ['+JSON.stringify(this)+']'};var n=function(a){this.position=a.position;this.direction=a.direction;this.progress=a.progress};n.prototype.toString=function(){return'ScreenTapGesture ['+JSON.stringify(this)+']'};var q=function(a){this.position=a.position;this.direction=a.direction;this.progress=a.progress};q.prototype.toString=function(){return'KeyTapGesture ['+JSON.stringify(this)+ +']'}},{events:21,'gl-matrix':23,underscore:24}],10:[function(a,b){var e=a('./pointable'),d=a('./bone'),c=a('gl-matrix'),k=c.mat3,h=c.vec3,l=a('underscore');a=b.exports=function(a){this.id=a.id;this.palmPosition=a.palmPosition;this.direction=a.direction;this.palmVelocity=a.palmVelocity;this.palmNormal=a.palmNormal;this.sphereCenter=a.sphereCenter;this.sphereRadius=a.sphereRadius;this.valid=!0;this.pointables=[];this.fingers=[];this.arm=a.armBasis?new d(this,{type:4,width:a.armWidth,prevJoint:a.elbow, +nextJoint:a.wrist,basis:a.armBasis}):null;this.tools=[];this._translation=a.t;this._rotation=l.flatten(a.r);this._scaleFactor=a.s;this.timeVisible=a.timeVisible;this.stabilizedPalmPosition=a.stabilizedPalmPosition;this.type=a.type;this.grabStrength=a.grabStrength;this.pinchStrength=a.pinchStrength;this.confidence=a.confidence};a.prototype.finger=function(a){return(a=this.frame.finger(a))&&a.handId==this.id?a:e.Invalid};a.prototype.rotationAngle=function(a,b){if(!this.valid||!a.valid||!a.hand(this.id).valid)return 0; +var c=this.rotationMatrix(a);c=Math.acos(.5*(c[0]+c[4]+c[8]-1));if(c=isNaN(c)?0:c,void 0!==b)a=this.rotationAxis(a),c*=h.dot(a,h.normalize(h.create(),b));return c};a.prototype.rotationAxis=function(a){if(!this.valid||!a.valid)return h.create();a=a.hand(this.id);return a.valid?h.normalize(h.create(),[this._rotation[7]-a._rotation[5],this._rotation[2]-a._rotation[6],this._rotation[3]-a._rotation[1]]):h.create()};a.prototype.rotationMatrix=function(a){if(!this.valid||!a.valid)return k.create();a=a.hand(this.id); +if(!a.valid)return k.create();var b=k.transpose(k.create(),this._rotation);return k.multiply(k.create(),a._rotation,b)};a.prototype.scaleFactor=function(a){if(!this.valid||!a.valid)return 1;a=a.hand(this.id);return a.valid?Math.exp(this._scaleFactor-a._scaleFactor):1};a.prototype.translation=function(a){if(!this.valid||!a.valid)return h.create();a=a.hand(this.id);return a.valid?[this._translation[0]-a._translation[0],this._translation[1]-a._translation[1],this._translation[2]-a._translation[2]]:h.create()}; +a.prototype.toString=function(){return'Hand ('+this.type+') [ id: '+this.id+' | palm velocity:'+this.palmVelocity+' | sphere center:'+this.sphereCenter+' ] '};a.prototype.pitch=function(){return Math.atan2(this.direction[1],-this.direction[2])};a.prototype.yaw=function(){return Math.atan2(this.direction[0],-this.direction[2])};a.prototype.roll=function(){return Math.atan2(this.palmNormal[0],-this.palmNormal[1])};a.Invalid={valid:!1,fingers:[],tools:[],pointables:[],left:!1,pointable:function(){return e.Invalid}, +finger:function(){return e.Invalid},toString:function(){return'invalid frame'},dump:function(){return this.toString()},rotationAngle:function(){return 0},rotationMatrix:function(){return k.create()},rotationAxis:function(){return h.create()},scaleFactor:function(){return 1},translation:function(){return h.create()}}},{'./bone':1,'./pointable':14,'gl-matrix':23,underscore:24}],11:[function(a,b){b.exports={Controller:a('./controller'),Frame:a('./frame'),Gesture:a('./gesture'),Hand:a('./hand'),Pointable:a('./pointable'), Finger:a('./finger'),InteractionBox:a('./interaction_box'),CircularBuffer:a('./circular_buffer'),UI:a('./ui'),JSONProtocol:a('./protocol').JSONProtocol,glMatrix:a('gl-matrix'),mat3:a('gl-matrix').mat3,vec3:a('gl-matrix').vec3,loopController:void 0,version:a('./version.js'),_:a('underscore'),EventEmitter:a('events').EventEmitter,loop:function(a,b){return a&&void 0===b&&'[object Function]'==={}.toString.call(a)&&(b=a,a={}),this.loopController?a&&this.loopController.setupFrameEvents(a):this.loopController= -new this.Controller(a),this.loopController.loop(b),this.loopController},plugin:function(a,b){this.Controller.plugin(a,b)}}},{'./circular_buffer':2,'./controller':5,'./finger':7,'./frame':8,'./gesture':9,'./hand':10,'./interaction_box':12,'./pointable':14,'./protocol':15,'./ui':16,'./version.js':19,events:21,'gl-matrix':23,underscore:24}],12:[function(a,b){var d=a('gl-matrix').vec3;a=b.exports=function(a){this.valid=!0;this.center=a.center;this.size=a.size;this.width=a.size[0];this.height=a.size[1]; -this.depth=a.size[2]};a.prototype.denormalizePoint=function(a){return d.fromValues((a[0]-.5)*this.size[0]+this.center[0],(a[1]-.5)*this.size[1]+this.center[1],(a[2]-.5)*this.size[2]+this.center[2])};a.prototype.normalizePoint=function(a,b){a=d.fromValues((a[0]-this.center[0])/this.size[0]+.5,(a[1]-this.center[1])/this.size[1]+.5,(a[2]-this.center[2])/this.size[2]+.5);return b&&(a[0]=Math.min(Math.max(a[0],0),1),a[1]=Math.min(Math.max(a[1],0),1),a[2]=Math.min(Math.max(a[2],0),1)),a};a.prototype.toString= -function(){return'InteractionBox [ width:'+this.width+' | height:'+this.height+' | depth:'+this.depth+' ]'};a.Invalid={valid:!1}},{'gl-matrix':23}],13:[function(a,b){a=b.exports=function(a){this.steps=[];this.controller=a};a.prototype.addStep=function(a){this.steps.push(a)};a.prototype.run=function(a){for(var b=this.steps.length,d=0;d!=b&&a;d++)a=this.steps[d](a);return a};a.prototype.removeStep=function(a){a=this.steps.indexOf(a);if(-1===a)throw'Step not found in pipeline';this.steps.splice(a,1)}; -a.prototype.addWrappedStep=function(a,b){var c=this.controller,d=function(d){var g;var h='frame'==a?[d]:d[a+'s']||[];var k=0;for(g=h.length;g>k;k++)b.call(c,h[k]);return d};return this.addStep(d),d}},{}],14:[function(a,b){a=a('gl-matrix');b=(a.vec3,b.exports=function(a){this.valid=!0;this.id=a.id;this.handId=a.handId;this.length=a.length;this.tool=a.tool;this.width=a.width;this.direction=a.direction;this.stabilizedTipPosition=a.stabilizedTipPosition;this.tipPosition=a.tipPosition;this.tipVelocity= -a.tipVelocity;this.touchZone=a.touchZone;this.touchDistance=a.touchDistance;this.timeVisible=a.timeVisible});b.prototype.toString=function(){return'Pointable [ id:'+this.id+' '+this.length+'mmx | width:'+this.width+'mm | direction:'+this.direction+' ]'};b.prototype.hand=function(){return this.frame.hand(this.handId)};b.Invalid={valid:!1}},{'gl-matrix':23}],15:[function(a,b,d){var c=a('./frame'),g=(a('./hand'),a('./pointable'),a('./finger'),a('underscore')),h=a('events').EventEmitter,k=function(a){this.type= -a.type;this.state=a.state};d.chooseProtocol=function(a){switch(a.version){case 1:case 2:case 3:case 4:case 5:case 6:var b=l(a);b.sendBackground=function(a,c){a.send(b.encode({background:c}))};b.sendFocused=function(a,c){a.send(b.encode({focused:c}))};b.sendOptimizeHMD=function(a,c){a.send(b.encode({optimizeHMD:c}))};break;default:throw'unrecognized version';}return b};var l=d.JSONProtocol=function(a){var b=function(a){if(a.event)return new k(a.event);b.emit('beforeFrameCreated',a);var e=new c(a); -return b.emit('afterFrameCreated',e,a),e};return b.encode=function(a){return JSON.stringify(a)},b.version=a.version,b.serviceVersion=a.serviceVersion,b.versionLong='Version '+a.version,b.type='protocol',g.extend(b,h.prototype),b}},{'./finger':7,'./frame':8,'./hand':10,'./pointable':14,events:21,underscore:24}],16:[function(a,b,d){d.UI={Region:a('./ui/region'),Cursor:a('./ui/cursor')}},{'./ui/cursor':17,'./ui/region':18}],17:[function(a,b){b.exports=function(){return function(a){var b=a.pointables.sort(function(a, -b){return a.z-b.z})[0];return b&&b.valid&&(a.cursorPosition=b.tipPosition),a}}},{}],18:[function(a,b){var d=a('events').EventEmitter;a=a('underscore');var c=b.exports=function(a,b){this.start=new Vector(a);this.end=new Vector(b);this.enteredFrame=null};c.prototype.hasPointables=function(a){for(var b=0;b!=a.pointables.length;b++){var c=a.pointables[b].tipPosition;if(c.x>=this.start.x&&c.x<=this.end.x&&c.y>=this.start.y&&c.y<=this.end.y&&c.z>=this.start.z&&c.z<=this.end.z)return!0}return!1};c.prototype.listener= -function(a){var b=this;return a&&a.nearThreshold&&this.setupNearRegion(a.nearThreshold),function(a){return b.updatePosition(a)}};c.prototype.clipper=function(){var a=this;return function(b){return a.updatePosition(b),a.enteredFrame?b:null}};c.prototype.setupNearRegion=function(a){a=this.nearRegion=new c([this.start.x-a,this.start.y-a,this.start.z-a],[this.end.x+a,this.end.y+a,this.end.z+a]);var b=this;a.on('enter',function(a){b.emit('near',a)});a.on('exit',function(a){b.emit('far',a)});b.on('exit', -function(a){b.emit('near',a)})};c.prototype.updatePosition=function(a){return this.nearRegion&&this.nearRegion.updatePosition(a),this.hasPointables(a)&&null==this.enteredFrame?(this.enteredFrame=a,this.emit('enter',this.enteredFrame)):this.hasPointables(a)||null==this.enteredFrame||(this.enteredFrame=null,this.emit('exit',this.enteredFrame)),a};c.prototype.normalize=function(a){return new Vector([(a.x-this.start.x)/(this.end.x-this.start.x),(a.y-this.start.y)/(this.end.y-this.start.y),(a.z-this.start.z)/ -(this.end.z-this.start.z)])};c.prototype.mapToXY=function(a,b,c){a=this.normalize(a);var d=a.x,g=a.y;return 1d&&(d=-1),1g&&(g=-1),[(d+1)/2*b,(1-g)/2*c,a.z]};a.extend(c.prototype,d.prototype)},{events:21,underscore:24}],19:[function(a,b){b.exports={full:'0.6.4',major:0,minor:6,dot:4}},{}],20:[function(){},{}],21:[function(a,b,d){a=a('__browserify_process');a.EventEmitter||(a.EventEmitter=function(){});d=d.EventEmitter=a.EventEmitter;var c='function'==typeof Array.isArray?Array.isArray: -function(a){return'[object Array]'===Object.prototype.toString.call(a)};d.prototype.setMaxListeners=function(a){this._events||(this._events={});this._events.maxListeners=a};d.prototype.emit=function(a){if('error'===a&&(!this._events||!this._events.error||c(this._events.error)&&!this._events.error.length))throw arguments[1]instanceof Error?arguments[1]:Error("Uncaught, unspecified 'error' event.");if(!this._events)return!1;var b=this._events[a];if(!b)return!1;if('function'==typeof b){switch(arguments.length){case 1:b.call(this); -break;case 2:b.call(this,arguments[1]);break;case 3:b.call(this,arguments[1],arguments[2]);break;default:var d=Array.prototype.slice.call(arguments,1);b.apply(this,d)}return!0}if(c(b)){d=Array.prototype.slice.call(arguments,1);b=b.slice();for(var g=0,m=b.length;m>g;g++)b[g].apply(this,d);return!0}return!1};d.prototype.addListener=function(a,b){if('function'!=typeof b)throw Error('addListener only takes instances of Function');if(this._events||(this._events={}),this.emit('newListener',a,b),this._events[a])if(c(this._events[a])){if(!this._events[a].warned){var d; -(d=void 0!==this._events.maxListeners?this._events.maxListeners:10)&&0d&&(this._events[a].warned=!0,console.error('(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.',this._events[a].length),console.trace())}this._events[a].push(b)}else this._events[a]=[this._events[a],b];else this._events[a]=b;return this};d.prototype.on=d.prototype.addListener;d.prototype.once=function(a,b){var c=this;return c.on(a, -function m(){c.removeListener(a,m);b.apply(this,arguments)}),this};d.prototype.removeListener=function(a,b){if('function'!=typeof b)throw Error('removeListener only takes instances of Function');if(!this._events||!this._events[a])return this;var d=this._events[a];if(c(d)){a:if(d.indexOf)b=d.indexOf(b);else{for(var g=0;gb)return this;d.splice(b,1);0==d.length&&delete this._events[a]}else this._events[a]===b&&delete this._events[a];return this};d.prototype.removeAllListeners= -function(a){return 0===arguments.length?(this._events={},this):(a&&this._events&&this._events[a]&&(this._events[a]=null),this)};d.prototype.listeners=function(a){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),c(this._events[a])||(this._events[a]=[this._events[a]]),this._events[a]};d.listenerCount=function(a,b){return a._events&&a._events[b]?'function'==typeof a._events[b]?1:a._events[b].length:0}},{__browserify_process:22}],22:[function(a,b){a=b.exports={};a.nextTick= +new this.Controller(a),this.loopController.loop(b),this.loopController},plugin:function(a,b){this.Controller.plugin(a,b)}}},{'./circular_buffer':2,'./controller':5,'./finger':7,'./frame':8,'./gesture':9,'./hand':10,'./interaction_box':12,'./pointable':14,'./protocol':15,'./ui':16,'./version.js':19,events:21,'gl-matrix':23,underscore:24}],12:[function(a,b){var e=a('gl-matrix').vec3;a=b.exports=function(a){this.valid=!0;this.center=a.center;this.size=a.size;this.width=a.size[0];this.height=a.size[1]; +this.depth=a.size[2]};a.prototype.denormalizePoint=function(a){return e.fromValues((a[0]-.5)*this.size[0]+this.center[0],(a[1]-.5)*this.size[1]+this.center[1],(a[2]-.5)*this.size[2]+this.center[2])};a.prototype.normalizePoint=function(a,b){a=e.fromValues((a[0]-this.center[0])/this.size[0]+.5,(a[1]-this.center[1])/this.size[1]+.5,(a[2]-this.center[2])/this.size[2]+.5);return b&&(a[0]=Math.min(Math.max(a[0],0),1),a[1]=Math.min(Math.max(a[1],0),1),a[2]=Math.min(Math.max(a[2],0),1)),a};a.prototype.toString= +function(){return'InteractionBox [ width:'+this.width+' | height:'+this.height+' | depth:'+this.depth+' ]'};a.Invalid={valid:!1}},{'gl-matrix':23}],13:[function(a,b){a=b.exports=function(a){this.steps=[];this.controller=a};a.prototype.addStep=function(a){this.steps.push(a)};a.prototype.run=function(a){for(var b=this.steps.length,c=0;c!=b&&a;c++)a=this.steps[c](a);return a};a.prototype.removeStep=function(a){a=this.steps.indexOf(a);if(-1===a)throw'Step not found in pipeline';this.steps.splice(a,1)}; +a.prototype.addWrappedStep=function(a,b){var c=this.controller,d=function(d){var e;var h='frame'==a?[d]:d[a+'s']||[];var k=0;for(e=h.length;e>k;k++)b.call(c,h[k]);return d};return this.addStep(d),d}},{}],14:[function(a,b){a=a('gl-matrix');b=(a.vec3,b.exports=function(a){this.valid=!0;this.id=a.id;this.handId=a.handId;this.length=a.length;this.tool=a.tool;this.width=a.width;this.direction=a.direction;this.stabilizedTipPosition=a.stabilizedTipPosition;this.tipPosition=a.tipPosition;this.tipVelocity= +a.tipVelocity;this.touchZone=a.touchZone;this.touchDistance=a.touchDistance;this.timeVisible=a.timeVisible});b.prototype.toString=function(){return'Pointable [ id:'+this.id+' '+this.length+'mmx | width:'+this.width+'mm | direction:'+this.direction+' ]'};b.prototype.hand=function(){return this.frame.hand(this.handId)};b.Invalid={valid:!1}},{'gl-matrix':23}],15:[function(a,b,e){var d=a('./frame'),c=(a('./hand'),a('./pointable'),a('./finger'),a('underscore')),k=a('events').EventEmitter,h=function(a){this.type= +a.type;this.state=a.state};e.chooseProtocol=function(a){switch(a.version){case 1:case 2:case 3:case 4:case 5:case 6:var b=l(a);b.sendBackground=function(a,c){a.send(b.encode({background:c}))};b.sendFocused=function(a,c){a.send(b.encode({focused:c}))};b.sendOptimizeHMD=function(a,c){a.send(b.encode({optimizeHMD:c}))};break;default:throw'unrecognized version';}return b};var l=e.JSONProtocol=function(a){var b=function(a){if(a.event)return new h(a.event);b.emit('beforeFrameCreated',a);var c=new d(a); +return b.emit('afterFrameCreated',c,a),c};return b.encode=function(a){return JSON.stringify(a)},b.version=a.version,b.serviceVersion=a.serviceVersion,b.versionLong='Version '+a.version,b.type='protocol',c.extend(b,k.prototype),b}},{'./finger':7,'./frame':8,'./hand':10,'./pointable':14,events:21,underscore:24}],16:[function(a,b,e){e.UI={Region:a('./ui/region'),Cursor:a('./ui/cursor')}},{'./ui/cursor':17,'./ui/region':18}],17:[function(a,b){b.exports=function(){return function(a){var b=a.pointables.sort(function(a, +b){return a.z-b.z})[0];return b&&b.valid&&(a.cursorPosition=b.tipPosition),a}}},{}],18:[function(a,b){var e=a('events').EventEmitter;a=a('underscore');var d=b.exports=function(a,b){this.start=new Vector(a);this.end=new Vector(b);this.enteredFrame=null};d.prototype.hasPointables=function(a){for(var b=0;b!=a.pointables.length;b++){var c=a.pointables[b].tipPosition;if(c.x>=this.start.x&&c.x<=this.end.x&&c.y>=this.start.y&&c.y<=this.end.y&&c.z>=this.start.z&&c.z<=this.end.z)return!0}return!1};d.prototype.listener= +function(a){var b=this;return a&&a.nearThreshold&&this.setupNearRegion(a.nearThreshold),function(a){return b.updatePosition(a)}};d.prototype.clipper=function(){var a=this;return function(b){return a.updatePosition(b),a.enteredFrame?b:null}};d.prototype.setupNearRegion=function(a){a=this.nearRegion=new d([this.start.x-a,this.start.y-a,this.start.z-a],[this.end.x+a,this.end.y+a,this.end.z+a]);var b=this;a.on('enter',function(a){b.emit('near',a)});a.on('exit',function(a){b.emit('far',a)});b.on('exit', +function(a){b.emit('near',a)})};d.prototype.updatePosition=function(a){return this.nearRegion&&this.nearRegion.updatePosition(a),this.hasPointables(a)&&null==this.enteredFrame?(this.enteredFrame=a,this.emit('enter',this.enteredFrame)):this.hasPointables(a)||null==this.enteredFrame||(this.enteredFrame=null,this.emit('exit',this.enteredFrame)),a};d.prototype.normalize=function(a){return new Vector([(a.x-this.start.x)/(this.end.x-this.start.x),(a.y-this.start.y)/(this.end.y-this.start.y),(a.z-this.start.z)/ +(this.end.z-this.start.z)])};d.prototype.mapToXY=function(a,b,d){a=this.normalize(a);var c=a.x,e=a.y;return 1c&&(c=-1),1e&&(e=-1),[(c+1)/2*b,(1-e)/2*d,a.z]};a.extend(d.prototype,e.prototype)},{events:21,underscore:24}],19:[function(a,b){b.exports={full:'0.6.4',major:0,minor:6,dot:4}},{}],20:[function(){},{}],21:[function(a,b,e){a=a('__browserify_process');a.EventEmitter||(a.EventEmitter=function(){});e=e.EventEmitter=a.EventEmitter;var d='function'==typeof Array.isArray?Array.isArray: +function(a){return'[object Array]'===Object.prototype.toString.call(a)};e.prototype.setMaxListeners=function(a){this._events||(this._events={});this._events.maxListeners=a};e.prototype.emit=function(a){if('error'===a&&(!this._events||!this._events.error||d(this._events.error)&&!this._events.error.length))throw arguments[1]instanceof Error?arguments[1]:Error("Uncaught, unspecified 'error' event.");if(!this._events)return!1;var b=this._events[a];if(!b)return!1;if('function'==typeof b){switch(arguments.length){case 1:b.call(this); +break;case 2:b.call(this,arguments[1]);break;case 3:b.call(this,arguments[1],arguments[2]);break;default:var c=Array.prototype.slice.call(arguments,1);b.apply(this,c)}return!0}if(d(b)){c=Array.prototype.slice.call(arguments,1);b=b.slice();for(var e=0,n=b.length;n>e;e++)b[e].apply(this,c);return!0}return!1};e.prototype.addListener=function(a,b){if('function'!=typeof b)throw Error('addListener only takes instances of Function');if(this._events||(this._events={}),this.emit('newListener',a,b),this._events[a])if(d(this._events[a])){if(!this._events[a].warned){var c; +(c=void 0!==this._events.maxListeners?this._events.maxListeners:10)&&0c&&(this._events[a].warned=!0,console.error('(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.',this._events[a].length),console.trace())}this._events[a].push(b)}else this._events[a]=[this._events[a],b];else this._events[a]=b;return this};e.prototype.on=e.prototype.addListener;e.prototype.once=function(a,b){var c=this;return c.on(a, +function n(){c.removeListener(a,n);b.apply(this,arguments)}),this};e.prototype.removeListener=function(a,b){if('function'!=typeof b)throw Error('removeListener only takes instances of Function');if(!this._events||!this._events[a])return this;var c=this._events[a];if(d(c)){a:if(c.indexOf)b=c.indexOf(b);else{for(var e=0;eb)return this;c.splice(b,1);0==c.length&&delete this._events[a]}else this._events[a]===b&&delete this._events[a];return this};e.prototype.removeAllListeners= +function(a){return 0===arguments.length?(this._events={},this):(a&&this._events&&this._events[a]&&(this._events[a]=null),this)};e.prototype.listeners=function(a){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),d(this._events[a])||(this._events[a]=[this._events[a]]),this._events[a]};e.listenerCount=function(a,b){return a._events&&a._events[b]?'function'==typeof a._events[b]?1:a._events[b].length:0}},{__browserify_process:22}],22:[function(a,b){a=b.exports={};a.nextTick= function(){if('undefined'!=typeof window&&window.setImmediate)return function(a){return window.setImmediate(a)};if('undefined'!=typeof window&&window.postMessage&&window.addEventListener){var a=[];return window.addEventListener('message',function(b){var c=b.source;(c===window||null===c)&&'process-tick'===b.data&&(b.stopPropagation(),0e;e+=c)a[0]=b[e],a[1]=b[e+1],g(a,a,h),b[e]=a[0],b[e+1]=a[1];return b}}();e.str=function(a){return'vec2('+ -a[0]+', '+a[1]+')'};'undefined'!=typeof a&&(a.vec2=e);var n={create:function(){var a=new c(3);return a[0]=0,a[1]=0,a[2]=0,a},clone:function(a){var b=new c(3);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b},fromValues:function(a,b,e){var d=new c(3);return d[0]=a,d[1]=b,d[2]=e,d},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a},set:function(a,b,c,e){return a[0]=b,a[1]=c,a[2]=e,a},add:function(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a[2]=b[2]+c[2],a},subtract:function(a,b,c){return a[0]=b[0]-c[0], -a[1]=b[1]-c[1],a[2]=b[2]-c[2],a}};n.sub=n.subtract;n.multiply=function(a,b,c){return a[0]=b[0]*c[0],a[1]=b[1]*c[1],a[2]=b[2]*c[2],a};n.mul=n.multiply;n.divide=function(a,b,c){return a[0]=b[0]/c[0],a[1]=b[1]/c[1],a[2]=b[2]/c[2],a};n.div=n.divide;n.min=function(a,b,c){return a[0]=Math.min(b[0],c[0]),a[1]=Math.min(b[1],c[1]),a[2]=Math.min(b[2],c[2]),a};n.max=function(a,b,c){return a[0]=Math.max(b[0],c[0]),a[1]=Math.max(b[1],c[1]),a[2]=Math.max(b[2],c[2]),a};n.scale=function(a,b,c){return a[0]=b[0]*c, -a[1]=b[1]*c,a[2]=b[2]*c,a};n.scaleAndAdd=function(a,b,c,e){return a[0]=b[0]+c[0]*e,a[1]=b[1]+c[1]*e,a[2]=b[2]+c[2]*e,a};n.distance=function(a,b){var c=b[0]-a[0],e=b[1]-a[1];a=b[2]-a[2];return Math.sqrt(c*c+e*e+a*a)};n.dist=n.distance;n.squaredDistance=function(a,b){var c=b[0]-a[0],e=b[1]-a[1];a=b[2]-a[2];return c*c+e*e+a*a};n.sqrDist=n.squaredDistance;n.length=function(a){var b=a[0],c=a[1];a=a[2];return Math.sqrt(b*b+c*c+a*a)};n.len=n.length;n.squaredLength=function(a){var b=a[0],c=a[1];a=a[2];return b* -b+c*c+a*a};n.sqrLen=n.squaredLength;n.negate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a};n.normalize=function(a,b){var c=b[0],e=b[1],d=b[2];c=c*c+e*e+d*d;return 0e;e+=c)a[0]=b[e],a[1]=b[e+1],a[2]=b[e+2],g(a,a,h),b[e]=a[0],b[e+1]=a[1],b[e+2]=a[2];return b}}();n.str=function(a){return'vec3('+a[0]+', '+a[1]+', '+a[2]+')'};'undefined'!=typeof a&&(a.vec3=n);var r={create:function(){var a=new c(4);return a[0]=0,a[1]=0,a[2]=0,a[3]=0,a},clone:function(a){var b=new c(4);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b},fromValues:function(a,b,e,d){var g=new c(4);return g[0]=a,g[1]=b,g[2]=e,g[3]=d,g},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2], -a[3]=b[3],a},set:function(a,b,c,e,d){return a[0]=b,a[1]=c,a[2]=e,a[3]=d,a},add:function(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a[2]=b[2]+c[2],a[3]=b[3]+c[3],a},subtract:function(a,b,c){return a[0]=b[0]-c[0],a[1]=b[1]-c[1],a[2]=b[2]-c[2],a[3]=b[3]-c[3],a}};r.sub=r.subtract;r.multiply=function(a,b,c){return a[0]=b[0]*c[0],a[1]=b[1]*c[1],a[2]=b[2]*c[2],a[3]=b[3]*c[3],a};r.mul=r.multiply;r.divide=function(a,b,c){return a[0]=b[0]/c[0],a[1]=b[1]/c[1],a[2]=b[2]/c[2],a[3]=b[3]/c[3],a};r.div=r.divide; -r.min=function(a,b,c){return a[0]=Math.min(b[0],c[0]),a[1]=Math.min(b[1],c[1]),a[2]=Math.min(b[2],c[2]),a[3]=Math.min(b[3],c[3]),a};r.max=function(a,b,c){return a[0]=Math.max(b[0],c[0]),a[1]=Math.max(b[1],c[1]),a[2]=Math.max(b[2],c[2]),a[3]=Math.max(b[3],c[3]),a};r.scale=function(a,b,c){return a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c,a[3]=b[3]*c,a};r.scaleAndAdd=function(a,b,c,e){return a[0]=b[0]+c[0]*e,a[1]=b[1]+c[1]*e,a[2]=b[2]+c[2]*e,a[3]=b[3]+c[3]*e,a};r.distance=function(a,b){var c=b[0]-a[0],e=b[1]- -a[1],d=b[2]-a[2];a=b[3]-a[3];return Math.sqrt(c*c+e*e+d*d+a*a)};r.dist=r.distance;r.squaredDistance=function(a,b){var c=b[0]-a[0],e=b[1]-a[1],d=b[2]-a[2];a=b[3]-a[3];return c*c+e*e+d*d+a*a};r.sqrDist=r.squaredDistance;r.length=function(a){var b=a[0],c=a[1],e=a[2];a=a[3];return Math.sqrt(b*b+c*c+e*e+a*a)};r.len=r.length;r.squaredLength=function(a){var b=a[0],c=a[1],e=a[2];a=a[3];return b*b+c*c+e*e+a*a};r.sqrLen=r.squaredLength;r.negate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a[3]=-b[3], -a};r.normalize=function(a,b){var c=b[0],e=b[1],d=b[2],g=b[3];c=c*c+e*e+d*d+g*g;return 0e;e+=c)a[0]=b[e],a[1]=b[e+1],a[2]=b[e+2],a[3]=b[e+3],g(a,a,h),b[e]=a[0],b[e+1]=a[1],b[e+2]=a[2],b[e+3]=a[3];return b}}();r.str=function(a){return'vec4('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+')'};'undefined'!=typeof a&&(a.vec4=r);g={create:function(){var a=new c(4);return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a},clone:function(a){var b=new c(4);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a},identity:function(a){return a[0]= -1,a[1]=0,a[2]=0,a[3]=1,a},transpose:function(a,b){if(a===b){var c=b[1];a[1]=b[2];a[2]=c}else a[0]=b[0],a[1]=b[2],a[2]=b[1],a[3]=b[3];return a},invert:function(a,b){var c=b[0],e=b[1],d=b[2];b=b[3];var g=c*b-d*e;return g?(g=1/g,a[0]=b*g,a[1]=-e*g,a[2]=-d*g,a[3]=c*g,a):null},adjoint:function(a,b){var c=b[0];return a[0]=b[3],a[1]=-b[1],a[2]=-b[2],a[3]=c,a},determinant:function(a){return a[0]*a[3]-a[2]*a[1]},multiply:function(a,b,c){var e=b[0],d=b[1],g=b[2];b=b[3];var h=c[0],k=c[1],l=c[2];c=c[3];return a[0]= -e*h+g*k,a[1]=d*h+b*k,a[2]=e*l+g*c,a[3]=d*l+b*c,a}};g.mul=g.multiply;g.rotate=function(a,b,c){var e=b[0],d=b[1],g=b[2];b=b[3];var h=Math.sin(c);c=Math.cos(c);return a[0]=e*c+g*h,a[1]=d*c+b*h,a[2]=e*-h+g*c,a[3]=d*-h+b*c,a};g.scale=function(a,b,c){var e=b[1],d=b[2],g=b[3],h=c[0];c=c[1];return a[0]=b[0]*h,a[1]=e*h,a[2]=d*c,a[3]=g*c,a};g.str=function(a){return'mat2('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+')'};g.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3], -2))};g.LDU=function(a,b,c,e){return a[2]=e[2]/e[0],c[0]=e[0],c[1]=e[1],c[3]=e[3]-a[2]*c[1],[a,b,c]};'undefined'!=typeof a&&(a.mat2=g);g={create:function(){var a=new c(6);return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a[4]=0,a[5]=0,a},clone:function(a){var b=new c(6);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]=a[4],b[5]=a[5],b},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4],a[5]=b[5],a},identity:function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a[4]=0,a[5]=0,a},invert:function(a, -b){var c=b[0],e=b[1],d=b[2],g=b[3],h=b[4];b=b[5];var k=c*g-e*d;return k?(k=1/k,a[0]=g*k,a[1]=-e*k,a[2]=-d*k,a[3]=c*k,a[4]=(d*b-g*h)*k,a[5]=(e*h-c*b)*k,a):null},determinant:function(a){return a[0]*a[3]-a[1]*a[2]},multiply:function(a,b,c){var e=b[0],d=b[1],g=b[2],h=b[3],k=b[4];b=b[5];var l=c[0],m=c[1],p=c[2],n=c[3],q=c[4];c=c[5];return a[0]=e*l+g*m,a[1]=d*l+h*m,a[2]=e*p+g*n,a[3]=d*p+h*n,a[4]=e*q+g*c+k,a[5]=d*q+h*c+b,a}};g.mul=g.multiply;g.rotate=function(a,b,c){var e=b[0],d=b[1],g=b[2],h=b[3],k=b[4]; -b=b[5];var l=Math.sin(c);c=Math.cos(c);return a[0]=e*c+g*l,a[1]=d*c+h*l,a[2]=e*-l+g*c,a[3]=d*-l+h*c,a[4]=k,a[5]=b,a};g.scale=function(a,b,c){var e=b[1],d=b[2],g=b[3],h=b[4],k=b[5],l=c[0];c=c[1];return a[0]=b[0]*l,a[1]=e*l,a[2]=d*c,a[3]=g*c,a[4]=h,a[5]=k,a};g.translate=function(a,b,c){var e=b[0],d=b[1],g=b[2],h=b[3],k=b[4];b=b[5];var l=c[0];c=c[1];return a[0]=e,a[1]=d,a[2]=g,a[3]=h,a[4]=e*l+g*c+k,a[5]=d*l+h*c+b,a};g.str=function(a){return'mat2d('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+', '+a[4]+', '+a[5]+ -')'};g.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+1)};'undefined'!=typeof a&&(a.mat2d=g);var t={create:function(){var a=new c(9);return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=1,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},fromMat4:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[4],a[4]=b[5],a[5]=b[6],a[6]=b[8],a[7]=b[9],a[8]=b[10],a},clone:function(a){var b=new c(9);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]= -a[4],b[5]=a[5],b[6]=a[6],b[7]=a[7],b[8]=a[8],b},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[8]=b[8],a},identity:function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=1,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},transpose:function(a,b){if(a===b){var c=b[1],e=b[2],d=b[5];a[1]=b[3];a[2]=b[6];a[3]=c;a[5]=b[7];a[6]=e;a[7]=d}else a[0]=b[0],a[1]=b[3],a[2]=b[6],a[3]=b[1],a[4]=b[4],a[5]=b[7],a[6]=b[2],a[7]=b[5],a[8]=b[8];return a},invert:function(a,b){var c= -b[0],e=b[1],d=b[2],g=b[3],h=b[4],k=b[5],l=b[6],m=b[7];b=b[8];var p=b*h-k*m,n=-b*g+k*l,q=m*g-h*l,r=c*p+e*n+d*q;return r?(r=1/r,a[0]=p*r,a[1]=(-b*e+d*m)*r,a[2]=(k*e-d*h)*r,a[3]=n*r,a[4]=(b*c-d*l)*r,a[5]=(-k*c+d*g)*r,a[6]=q*r,a[7]=(-m*c+e*l)*r,a[8]=(h*c-e*g)*r,a):null},adjoint:function(a,b){var c=b[0],e=b[1],d=b[2],g=b[3],h=b[4],k=b[5],l=b[6],m=b[7];b=b[8];return a[0]=h*b-k*m,a[1]=d*m-e*b,a[2]=e*k-d*h,a[3]=k*l-g*b,a[4]=c*b-d*l,a[5]=d*g-c*k,a[6]=g*m-h*l,a[7]=e*l-c*m,a[8]=c*h-e*g,a},determinant:function(a){var b= -a[3],c=a[4],e=a[5],d=a[6],g=a[7],h=a[8];return a[0]*(h*c-e*g)+a[1]*(-h*b+e*d)+a[2]*(g*b-c*d)},multiply:function(a,b,c){var e=b[0],d=b[1],g=b[2],h=b[3],k=b[4],l=b[5],m=b[6],p=b[7];b=b[8];var n=c[0],q=c[1],r=c[2],u=c[3],t=c[4],v=c[5],w=c[6],D=c[7];c=c[8];return a[0]=n*e+q*h+r*m,a[1]=n*d+q*k+r*p,a[2]=n*g+q*l+r*b,a[3]=u*e+t*h+v*m,a[4]=u*d+t*k+v*p,a[5]=u*g+t*l+v*b,a[6]=w*e+D*h+c*m,a[7]=w*d+D*k+c*p,a[8]=w*g+D*l+c*b,a}};t.mul=t.multiply;t.translate=function(a,b,c){var e=b[0],d=b[1],g=b[2],h=b[3],k=b[4], -l=b[5],m=b[6],p=b[7];b=b[8];var n=c[0];c=c[1];return a[0]=e,a[1]=d,a[2]=g,a[3]=h,a[4]=k,a[5]=l,a[6]=n*e+c*h+m,a[7]=n*d+c*k+p,a[8]=n*g+c*l+b,a};t.rotate=function(a,b,c){var e=b[0],d=b[1],g=b[2],h=b[3],k=b[4],l=b[5],m=b[6],p=b[7];b=b[8];var n=Math.sin(c);c=Math.cos(c);return a[0]=c*e+n*h,a[1]=c*d+n*k,a[2]=c*g+n*l,a[3]=c*h-n*e,a[4]=c*k-n*d,a[5]=c*l-n*g,a[6]=m,a[7]=p,a[8]=b,a};t.scale=function(a,b,c){var e=c[0];c=c[1];return a[0]=e*b[0],a[1]=e*b[1],a[2]=e*b[2],a[3]=c*b[3],a[4]=c*b[4],a[5]=c*b[5],a[6]= -b[6],a[7]=b[7],a[8]=b[8],a};t.fromMat2d=function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=0,a[3]=b[2],a[4]=b[3],a[5]=0,a[6]=b[4],a[7]=b[5],a[8]=1,a};t.fromQuat=function(a,b){var c=b[0],e=b[1],d=b[2];b=b[3];var g=c+c,h=e+e,k=d+d;c*=g;var l=e*g;e*=h;var m=d*g,p=d*h;d*=k;g*=b;h*=b;b*=k;return a[0]=1-e-d,a[3]=l-b,a[6]=m+h,a[1]=l+b,a[4]=1-c-d,a[7]=p-g,a[2]=m-h,a[5]=p+g,a[8]=1-c-e,a};t.normalFromMat4=function(a,b){var c=b[0],e=b[1],d=b[2],g=b[3],h=b[4],k=b[5],l=b[6],m=b[7],p=b[8],n=b[9],q=b[10],r=b[11],u=b[12], -t=b[13],v=b[14];b=b[15];var w=c*k-e*h,D=c*l-d*h,L=c*m-g*h,na=e*l-d*k,sa=e*m-g*k,ea=d*m-g*l,qa=p*t-n*u,oa=p*v-q*u;p=p*b-r*u;var O=n*v-q*t;n=n*b-r*t;q=q*b-r*v;return(r=w*q-D*n+L*O+na*p-sa*oa+ea*qa)?(r=1/r,a[0]=(k*q-l*n+m*O)*r,a[1]=(l*p-h*q-m*oa)*r,a[2]=(h*n-k*p+m*qa)*r,a[3]=(d*n-e*q-g*O)*r,a[4]=(c*q-d*p+g*oa)*r,a[5]=(e*p-c*n-g*qa)*r,a[6]=(t*ea-v*sa+b*na)*r,a[7]=(v*L-u*ea-b*D)*r,a[8]=(u*sa-t*L+b*w)*r,a):null};t.str=function(a){return'mat3('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+', '+a[4]+', '+a[5]+', '+ -a[6]+', '+a[7]+', '+a[8]+')'};t.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],2)+Math.pow(a[7],2)+Math.pow(a[8],2))};'undefined'!=typeof a&&(a.mat3=t);var D={create:function(){var a=new c(16);return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},clone:function(a){var b=new c(16);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3], +{};a.argv=[];a.binding=function(){throw Error('process.binding is not supported');};a.cwd=function(){return'/'};a.chdir=function(){throw Error('process.chdir is not supported');}},{}],23:[function(a,b,e){!function(a){var b;'undefined'==typeof e?'function'==typeof define&&'object'==typeof define.amd&&define.amd?(b={},define(function(){return b})):b='undefined'!=typeof window?window:a:b=e;(function(a){if(!b)var b=1E-6;if(!c)var c='undefined'!=typeof Float32Array?Float32Array:Array;if(!d)var d=Math.random; +var e={setMatrixArrayType:function(a){c=a}};'undefined'!=typeof a&&(a.glMatrix=e);var k=Math.PI/180;e.toRadian=function(a){return a*k};var g={create:function(){var a=new c(2);return a[0]=0,a[1]=0,a},clone:function(a){var b=new c(2);return b[0]=a[0],b[1]=a[1],b},fromValues:function(a,b){var g=new c(2);return g[0]=a,g[1]=b,g},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a},set:function(a,b,c){return a[0]=b,a[1]=c,a},add:function(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a},subtract:function(a,b, +c){return a[0]=b[0]-c[0],a[1]=b[1]-c[1],a}};g.sub=g.subtract;g.multiply=function(a,b,c){return a[0]=b[0]*c[0],a[1]=b[1]*c[1],a};g.mul=g.multiply;g.divide=function(a,b,c){return a[0]=b[0]/c[0],a[1]=b[1]/c[1],a};g.div=g.divide;g.min=function(a,b,c){return a[0]=Math.min(b[0],c[0]),a[1]=Math.min(b[1],c[1]),a};g.max=function(a,b,c){return a[0]=Math.max(b[0],c[0]),a[1]=Math.max(b[1],c[1]),a};g.scale=function(a,b,c){return a[0]=b[0]*c,a[1]=b[1]*c,a};g.scaleAndAdd=function(a,b,c,g){return a[0]=b[0]+c[0]* +g,a[1]=b[1]+c[1]*g,a};g.distance=function(a,b){var c=b[0]-a[0];a=b[1]-a[1];return Math.sqrt(c*c+a*a)};g.dist=g.distance;g.squaredDistance=function(a,b){var c=b[0]-a[0];a=b[1]-a[1];return c*c+a*a};g.sqrDist=g.squaredDistance;g.length=function(a){var b=a[0];a=a[1];return Math.sqrt(b*b+a*a)};g.len=g.length;g.squaredLength=function(a){var b=a[0];a=a[1];return b*b+a*a};g.sqrLen=g.squaredLength;g.negate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a};g.normalize=function(a,b){var c=b[0],g=b[1];c=c*c+g*g; +return 0g;g+=c)a[0]=b[g],a[1]=b[g+1],e(a,a,h),b[g]=a[0],b[g+1]=a[1];return b}}();g.str=function(a){return'vec2('+ +a[0]+', '+a[1]+')'};'undefined'!=typeof a&&(a.vec2=g);var p={create:function(){var a=new c(3);return a[0]=0,a[1]=0,a[2]=0,a},clone:function(a){var b=new c(3);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b},fromValues:function(a,b,g){var d=new c(3);return d[0]=a,d[1]=b,d[2]=g,d},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a},set:function(a,b,c,g){return a[0]=b,a[1]=c,a[2]=g,a},add:function(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a[2]=b[2]+c[2],a},subtract:function(a,b,c){return a[0]=b[0]-c[0], +a[1]=b[1]-c[1],a[2]=b[2]-c[2],a}};p.sub=p.subtract;p.multiply=function(a,b,c){return a[0]=b[0]*c[0],a[1]=b[1]*c[1],a[2]=b[2]*c[2],a};p.mul=p.multiply;p.divide=function(a,b,c){return a[0]=b[0]/c[0],a[1]=b[1]/c[1],a[2]=b[2]/c[2],a};p.div=p.divide;p.min=function(a,b,c){return a[0]=Math.min(b[0],c[0]),a[1]=Math.min(b[1],c[1]),a[2]=Math.min(b[2],c[2]),a};p.max=function(a,b,c){return a[0]=Math.max(b[0],c[0]),a[1]=Math.max(b[1],c[1]),a[2]=Math.max(b[2],c[2]),a};p.scale=function(a,b,c){return a[0]=b[0]*c, +a[1]=b[1]*c,a[2]=b[2]*c,a};p.scaleAndAdd=function(a,b,c,g){return a[0]=b[0]+c[0]*g,a[1]=b[1]+c[1]*g,a[2]=b[2]+c[2]*g,a};p.distance=function(a,b){var c=b[0]-a[0],g=b[1]-a[1];a=b[2]-a[2];return Math.sqrt(c*c+g*g+a*a)};p.dist=p.distance;p.squaredDistance=function(a,b){var c=b[0]-a[0],g=b[1]-a[1];a=b[2]-a[2];return c*c+g*g+a*a};p.sqrDist=p.squaredDistance;p.length=function(a){var b=a[0],c=a[1];a=a[2];return Math.sqrt(b*b+c*c+a*a)};p.len=p.length;p.squaredLength=function(a){var b=a[0],c=a[1];a=a[2];return b* +b+c*c+a*a};p.sqrLen=p.squaredLength;p.negate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a};p.normalize=function(a,b){var c=b[0],g=b[1],d=b[2];c=c*c+g*g+d*d;return 0g;g+=c)a[0]=b[g],a[1]=b[g+1],a[2]=b[g+2],e(a,a,h),b[g]=a[0],b[g+1]=a[1],b[g+2]=a[2];return b}}();p.str=function(a){return'vec3('+a[0]+', '+a[1]+', '+a[2]+')'};'undefined'!=typeof a&&(a.vec3=p);var r={create:function(){var a=new c(4);return a[0]=0,a[1]=0,a[2]=0,a[3]=0,a},clone:function(a){var b=new c(4);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b},fromValues:function(a,b,g,d){var e=new c(4);return e[0]=a,e[1]=b,e[2]=g,e[3]=d,e},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2], +a[3]=b[3],a},set:function(a,b,c,g,d){return a[0]=b,a[1]=c,a[2]=g,a[3]=d,a},add:function(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a[2]=b[2]+c[2],a[3]=b[3]+c[3],a},subtract:function(a,b,c){return a[0]=b[0]-c[0],a[1]=b[1]-c[1],a[2]=b[2]-c[2],a[3]=b[3]-c[3],a}};r.sub=r.subtract;r.multiply=function(a,b,c){return a[0]=b[0]*c[0],a[1]=b[1]*c[1],a[2]=b[2]*c[2],a[3]=b[3]*c[3],a};r.mul=r.multiply;r.divide=function(a,b,c){return a[0]=b[0]/c[0],a[1]=b[1]/c[1],a[2]=b[2]/c[2],a[3]=b[3]/c[3],a};r.div=r.divide; +r.min=function(a,b,c){return a[0]=Math.min(b[0],c[0]),a[1]=Math.min(b[1],c[1]),a[2]=Math.min(b[2],c[2]),a[3]=Math.min(b[3],c[3]),a};r.max=function(a,b,c){return a[0]=Math.max(b[0],c[0]),a[1]=Math.max(b[1],c[1]),a[2]=Math.max(b[2],c[2]),a[3]=Math.max(b[3],c[3]),a};r.scale=function(a,b,c){return a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c,a[3]=b[3]*c,a};r.scaleAndAdd=function(a,b,c,g){return a[0]=b[0]+c[0]*g,a[1]=b[1]+c[1]*g,a[2]=b[2]+c[2]*g,a[3]=b[3]+c[3]*g,a};r.distance=function(a,b){var c=b[0]-a[0],g=b[1]- +a[1],d=b[2]-a[2];a=b[3]-a[3];return Math.sqrt(c*c+g*g+d*d+a*a)};r.dist=r.distance;r.squaredDistance=function(a,b){var c=b[0]-a[0],g=b[1]-a[1],d=b[2]-a[2];a=b[3]-a[3];return c*c+g*g+d*d+a*a};r.sqrDist=r.squaredDistance;r.length=function(a){var b=a[0],c=a[1],g=a[2];a=a[3];return Math.sqrt(b*b+c*c+g*g+a*a)};r.len=r.length;r.squaredLength=function(a){var b=a[0],c=a[1],g=a[2];a=a[3];return b*b+c*c+g*g+a*a};r.sqrLen=r.squaredLength;r.negate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a[3]=-b[3], +a};r.normalize=function(a,b){var c=b[0],g=b[1],d=b[2],e=b[3];c=c*c+g*g+d*d+e*e;return 0g;g+=c)a[0]=b[g],a[1]=b[g+1],a[2]=b[g+2],a[3]=b[g+3],e(a,a,h),b[g]=a[0],b[g+1]=a[1],b[g+2]=a[2],b[g+3]=a[3];return b}}();r.str=function(a){return'vec4('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+')'};'undefined'!=typeof a&&(a.vec4=r);e={create:function(){var a=new c(4);return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a},clone:function(a){var b=new c(4);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a},identity:function(a){return a[0]= +1,a[1]=0,a[2]=0,a[3]=1,a},transpose:function(a,b){if(a===b){var c=b[1];a[1]=b[2];a[2]=c}else a[0]=b[0],a[1]=b[2],a[2]=b[1],a[3]=b[3];return a},invert:function(a,b){var c=b[0],g=b[1],d=b[2];b=b[3];var e=c*b-d*g;return e?(e=1/e,a[0]=b*e,a[1]=-g*e,a[2]=-d*e,a[3]=c*e,a):null},adjoint:function(a,b){var c=b[0];return a[0]=b[3],a[1]=-b[1],a[2]=-b[2],a[3]=c,a},determinant:function(a){return a[0]*a[3]-a[2]*a[1]},multiply:function(a,b,c){var g=b[0],d=b[1],e=b[2];b=b[3];var h=c[0],k=c[1],m=c[2];c=c[3];return a[0]= +g*h+e*k,a[1]=d*h+b*k,a[2]=g*m+e*c,a[3]=d*m+b*c,a}};e.mul=e.multiply;e.rotate=function(a,b,c){var g=b[0],d=b[1],e=b[2];b=b[3];var h=Math.sin(c);c=Math.cos(c);return a[0]=g*c+e*h,a[1]=d*c+b*h,a[2]=g*-h+e*c,a[3]=d*-h+b*c,a};e.scale=function(a,b,c){var g=b[1],d=b[2],e=b[3],h=c[0];c=c[1];return a[0]=b[0]*h,a[1]=g*h,a[2]=d*c,a[3]=e*c,a};e.str=function(a){return'mat2('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+')'};e.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3], +2))};e.LDU=function(a,b,c,g){return a[2]=g[2]/g[0],c[0]=g[0],c[1]=g[1],c[3]=g[3]-a[2]*c[1],[a,b,c]};'undefined'!=typeof a&&(a.mat2=e);e={create:function(){var a=new c(6);return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a[4]=0,a[5]=0,a},clone:function(a){var b=new c(6);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]=a[4],b[5]=a[5],b},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4],a[5]=b[5],a},identity:function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=1,a[4]=0,a[5]=0,a},invert:function(a, +b){var c=b[0],g=b[1],d=b[2],e=b[3],h=b[4];b=b[5];var k=c*e-g*d;return k?(k=1/k,a[0]=e*k,a[1]=-g*k,a[2]=-d*k,a[3]=c*k,a[4]=(d*b-e*h)*k,a[5]=(g*h-c*b)*k,a):null},determinant:function(a){return a[0]*a[3]-a[1]*a[2]},multiply:function(a,b,c){var g=b[0],d=b[1],e=b[2],h=b[3],k=b[4];b=b[5];var m=c[0],l=c[1],p=c[2],n=c[3],q=c[4];c=c[5];return a[0]=g*m+e*l,a[1]=d*m+h*l,a[2]=g*p+e*n,a[3]=d*p+h*n,a[4]=g*q+e*c+k,a[5]=d*q+h*c+b,a}};e.mul=e.multiply;e.rotate=function(a,b,c){var g=b[0],d=b[1],e=b[2],h=b[3],k=b[4]; +b=b[5];var m=Math.sin(c);c=Math.cos(c);return a[0]=g*c+e*m,a[1]=d*c+h*m,a[2]=g*-m+e*c,a[3]=d*-m+h*c,a[4]=k,a[5]=b,a};e.scale=function(a,b,c){var g=b[1],d=b[2],e=b[3],h=b[4],k=b[5],m=c[0];c=c[1];return a[0]=b[0]*m,a[1]=g*m,a[2]=d*c,a[3]=e*c,a[4]=h,a[5]=k,a};e.translate=function(a,b,c){var g=b[0],d=b[1],e=b[2],h=b[3],k=b[4];b=b[5];var m=c[0];c=c[1];return a[0]=g,a[1]=d,a[2]=e,a[3]=h,a[4]=g*m+e*c+k,a[5]=d*m+h*c+b,a};e.str=function(a){return'mat2d('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+', '+a[4]+', '+a[5]+ +')'};e.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+1)};'undefined'!=typeof a&&(a.mat2d=e);var u={create:function(){var a=new c(9);return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=1,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},fromMat4:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[4],a[4]=b[5],a[5]=b[6],a[6]=b[8],a[7]=b[9],a[8]=b[10],a},clone:function(a){var b=new c(9);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]= +a[4],b[5]=a[5],b[6]=a[6],b[7]=a[7],b[8]=a[8],b},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[8]=b[8],a},identity:function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=1,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},transpose:function(a,b){if(a===b){var c=b[1],g=b[2],d=b[5];a[1]=b[3];a[2]=b[6];a[3]=c;a[5]=b[7];a[6]=g;a[7]=d}else a[0]=b[0],a[1]=b[3],a[2]=b[6],a[3]=b[1],a[4]=b[4],a[5]=b[7],a[6]=b[2],a[7]=b[5],a[8]=b[8];return a},invert:function(a,b){var c= +b[0],g=b[1],d=b[2],e=b[3],h=b[4],k=b[5],m=b[6],l=b[7];b=b[8];var p=b*h-k*l,n=-b*e+k*m,q=l*e-h*m,r=c*p+g*n+d*q;return r?(r=1/r,a[0]=p*r,a[1]=(-b*g+d*l)*r,a[2]=(k*g-d*h)*r,a[3]=n*r,a[4]=(b*c-d*m)*r,a[5]=(-k*c+d*e)*r,a[6]=q*r,a[7]=(-l*c+g*m)*r,a[8]=(h*c-g*e)*r,a):null},adjoint:function(a,b){var c=b[0],g=b[1],d=b[2],e=b[3],h=b[4],k=b[5],m=b[6],l=b[7];b=b[8];return a[0]=h*b-k*l,a[1]=d*l-g*b,a[2]=g*k-d*h,a[3]=k*m-e*b,a[4]=c*b-d*m,a[5]=d*e-c*k,a[6]=e*l-h*m,a[7]=g*m-c*l,a[8]=c*h-g*e,a},determinant:function(a){var b= +a[3],c=a[4],g=a[5],d=a[6],e=a[7],h=a[8];return a[0]*(h*c-g*e)+a[1]*(-h*b+g*d)+a[2]*(e*b-c*d)},multiply:function(a,b,c){var g=b[0],d=b[1],e=b[2],h=b[3],k=b[4],m=b[5],l=b[6],p=b[7];b=b[8];var n=c[0],q=c[1],r=c[2],t=c[3],u=c[4],z=c[5],v=c[6],w=c[7];c=c[8];return a[0]=n*g+q*h+r*l,a[1]=n*d+q*k+r*p,a[2]=n*e+q*m+r*b,a[3]=t*g+u*h+z*l,a[4]=t*d+u*k+z*p,a[5]=t*e+u*m+z*b,a[6]=v*g+w*h+c*l,a[7]=v*d+w*k+c*p,a[8]=v*e+w*m+c*b,a}};u.mul=u.multiply;u.translate=function(a,b,c){var g=b[0],d=b[1],e=b[2],h=b[3],k=b[4], +m=b[5],l=b[6],p=b[7];b=b[8];var n=c[0];c=c[1];return a[0]=g,a[1]=d,a[2]=e,a[3]=h,a[4]=k,a[5]=m,a[6]=n*g+c*h+l,a[7]=n*d+c*k+p,a[8]=n*e+c*m+b,a};u.rotate=function(a,b,c){var g=b[0],d=b[1],e=b[2],h=b[3],k=b[4],m=b[5],l=b[6],p=b[7];b=b[8];var n=Math.sin(c);c=Math.cos(c);return a[0]=c*g+n*h,a[1]=c*d+n*k,a[2]=c*e+n*m,a[3]=c*h-n*g,a[4]=c*k-n*d,a[5]=c*m-n*e,a[6]=l,a[7]=p,a[8]=b,a};u.scale=function(a,b,c){var g=c[0];c=c[1];return a[0]=g*b[0],a[1]=g*b[1],a[2]=g*b[2],a[3]=c*b[3],a[4]=c*b[4],a[5]=c*b[5],a[6]= +b[6],a[7]=b[7],a[8]=b[8],a};u.fromMat2d=function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=0,a[3]=b[2],a[4]=b[3],a[5]=0,a[6]=b[4],a[7]=b[5],a[8]=1,a};u.fromQuat=function(a,b){var c=b[0],g=b[1],d=b[2];b=b[3];var e=c+c,h=g+g,k=d+d;c*=e;var m=g*e;g*=h;var l=d*e,p=d*h;d*=k;e*=b;h*=b;b*=k;return a[0]=1-g-d,a[3]=m-b,a[6]=l+h,a[1]=m+b,a[4]=1-c-d,a[7]=p-e,a[2]=l-h,a[5]=p+e,a[8]=1-c-g,a};u.normalFromMat4=function(a,b){var c=b[0],g=b[1],d=b[2],e=b[3],h=b[4],k=b[5],m=b[6],l=b[7],p=b[8],n=b[9],q=b[10],r=b[11],t=b[12], +u=b[13],z=b[14];b=b[15];var v=c*k-g*h,E=c*m-d*h,R=c*l-e*h,ra=g*m-d*k,pa=g*l-e*k,fa=d*l-e*m,oa=p*u-n*t,ma=p*z-q*t;p=p*b-r*t;var O=n*z-q*u;n=n*b-r*u;q=q*b-r*z;return(r=v*q-E*n+R*O+ra*p-pa*ma+fa*oa)?(r=1/r,a[0]=(k*q-m*n+l*O)*r,a[1]=(m*p-h*q-l*ma)*r,a[2]=(h*n-k*p+l*oa)*r,a[3]=(d*n-g*q-e*O)*r,a[4]=(c*q-d*p+e*ma)*r,a[5]=(g*p-c*n-e*oa)*r,a[6]=(u*fa-z*pa+b*ra)*r,a[7]=(z*R-t*fa-b*E)*r,a[8]=(t*pa-u*R+b*v)*r,a):null};u.str=function(a){return'mat3('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+', '+a[4]+', '+a[5]+', '+ +a[6]+', '+a[7]+', '+a[8]+')'};u.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],2)+Math.pow(a[7],2)+Math.pow(a[8],2))};'undefined'!=typeof a&&(a.mat3=u);var E={create:function(){var a=new c(16);return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},clone:function(a){var b=new c(16);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3], b[4]=a[4],b[5]=a[5],b[6]=a[6],b[7]=a[7],b[8]=a[8],b[9]=a[9],b[10]=a[10],b[11]=a[11],b[12]=a[12],b[13]=a[13],b[14]=a[14],b[15]=a[15],b},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[8]=b[8],a[9]=b[9],a[10]=b[10],a[11]=b[11],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15],a},identity:function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},transpose:function(a, -b){if(a===b){var c=b[1],e=b[2],d=b[3],g=b[6],h=b[7],k=b[11];a[1]=b[4];a[2]=b[8];a[3]=b[12];a[4]=c;a[6]=b[9];a[7]=b[13];a[8]=e;a[9]=g;a[11]=b[14];a[12]=d;a[13]=h;a[14]=k}else a[0]=b[0],a[1]=b[4],a[2]=b[8],a[3]=b[12],a[4]=b[1],a[5]=b[5],a[6]=b[9],a[7]=b[13],a[8]=b[2],a[9]=b[6],a[10]=b[10],a[11]=b[14],a[12]=b[3],a[13]=b[7],a[14]=b[11],a[15]=b[15];return a},invert:function(a,b){var c=b[0],e=b[1],d=b[2],g=b[3],h=b[4],k=b[5],l=b[6],m=b[7],p=b[8],n=b[9],q=b[10],r=b[11],u=b[12],t=b[13],v=b[14];b=b[15];var w= -c*k-e*h,D=c*l-d*h,L=c*m-g*h,na=e*l-d*k,sa=e*m-g*k,ea=d*m-g*l,qa=p*t-n*u,oa=p*v-q*u,O=p*b-r*u,ua=n*v-q*t,ha=n*b-r*t,ka=q*b-r*v,va=w*ka-D*ha+L*ua+na*O-sa*oa+ea*qa;return va?(va=1/va,a[0]=(k*ka-l*ha+m*ua)*va,a[1]=(d*ha-e*ka-g*ua)*va,a[2]=(t*ea-v*sa+b*na)*va,a[3]=(q*sa-n*ea-r*na)*va,a[4]=(l*O-h*ka-m*oa)*va,a[5]=(c*ka-d*O+g*oa)*va,a[6]=(v*L-u*ea-b*D)*va,a[7]=(p*ea-q*L+r*D)*va,a[8]=(h*ha-k*O+m*qa)*va,a[9]=(e*O-c*ha-g*qa)*va,a[10]=(u*sa-t*L+b*w)*va,a[11]=(n*L-p*sa-r*w)*va,a[12]=(k*oa-h*ua-l*qa)*va,a[13]= -(c*ua-e*oa+d*qa)*va,a[14]=(t*D-u*na-v*w)*va,a[15]=(p*na-n*D+q*w)*va,a):null},adjoint:function(a,b){var c=b[0],e=b[1],d=b[2],g=b[3],h=b[4],k=b[5],l=b[6],m=b[7],p=b[8],n=b[9],q=b[10],r=b[11],u=b[12],t=b[13],v=b[14];b=b[15];return a[0]=k*(q*b-r*v)-n*(l*b-m*v)+t*(l*r-m*q),a[1]=-(e*(q*b-r*v)-n*(d*b-g*v)+t*(d*r-g*q)),a[2]=e*(l*b-m*v)-k*(d*b-g*v)+t*(d*m-g*l),a[3]=-(e*(l*r-m*q)-k*(d*r-g*q)+n*(d*m-g*l)),a[4]=-(h*(q*b-r*v)-p*(l*b-m*v)+u*(l*r-m*q)),a[5]=c*(q*b-r*v)-p*(d*b-g*v)+u*(d*r-g*q),a[6]=-(c*(l*b-m*v)- -h*(d*b-g*v)+u*(d*m-g*l)),a[7]=c*(l*r-m*q)-h*(d*r-g*q)+p*(d*m-g*l),a[8]=h*(n*b-r*t)-p*(k*b-m*t)+u*(k*r-m*n),a[9]=-(c*(n*b-r*t)-p*(e*b-g*t)+u*(e*r-g*n)),a[10]=c*(k*b-m*t)-h*(e*b-g*t)+u*(e*m-g*k),a[11]=-(c*(k*r-m*n)-h*(e*r-g*n)+p*(e*m-g*k)),a[12]=-(h*(n*v-q*t)-p*(k*v-l*t)+u*(k*q-l*n)),a[13]=c*(n*v-q*t)-p*(e*v-d*t)+u*(e*q-d*n),a[14]=-(c*(k*v-l*t)-h*(e*v-d*t)+u*(e*l-d*k)),a[15]=c*(k*q-l*n)-h*(e*q-d*n)+p*(e*l-d*k),a},determinant:function(a){var b=a[0],c=a[1],e=a[2],d=a[3],g=a[4],h=a[5],k=a[6],l=a[7],m= -a[8],p=a[9],n=a[10],q=a[11],r=a[12],t=a[13],u=a[14];a=a[15];return(b*h-c*g)*(n*a-q*u)-(b*k-e*g)*(p*a-q*t)+(b*l-d*g)*(p*u-n*t)+(c*k-e*h)*(m*a-q*r)-(c*l-d*h)*(m*u-n*r)+(e*l-d*k)*(m*t-p*r)},multiply:function(a,b,c){var e=b[0],d=b[1],g=b[2],h=b[3],k=b[4],l=b[5],m=b[6],p=b[7],n=b[8],q=b[9],r=b[10],t=b[11],u=b[12],v=b[13],w=b[14];b=b[15];var D=c[0],z=c[1],na=c[2],sa=c[3];return a[0]=D*e+z*k+na*n+sa*u,a[1]=D*d+z*l+na*q+sa*v,a[2]=D*g+z*m+na*r+sa*w,a[3]=D*h+z*p+na*t+sa*b,D=c[4],z=c[5],na=c[6],sa=c[7],a[4]= -D*e+z*k+na*n+sa*u,a[5]=D*d+z*l+na*q+sa*v,a[6]=D*g+z*m+na*r+sa*w,a[7]=D*h+z*p+na*t+sa*b,D=c[8],z=c[9],na=c[10],sa=c[11],a[8]=D*e+z*k+na*n+sa*u,a[9]=D*d+z*l+na*q+sa*v,a[10]=D*g+z*m+na*r+sa*w,a[11]=D*h+z*p+na*t+sa*b,D=c[12],z=c[13],na=c[14],sa=c[15],a[12]=D*e+z*k+na*n+sa*u,a[13]=D*d+z*l+na*q+sa*v,a[14]=D*g+z*m+na*r+sa*w,a[15]=D*h+z*p+na*t+sa*b,a}};D.mul=D.multiply;D.translate=function(a,b,c){var e,d,g,h,k,l,m,p,n,q,r,t,u=c[0],v=c[1];c=c[2];return b===a?(a[12]=b[0]*u+b[4]*v+b[8]*c+b[12],a[13]=b[1]*u+ -b[5]*v+b[9]*c+b[13],a[14]=b[2]*u+b[6]*v+b[10]*c+b[14],a[15]=b[3]*u+b[7]*v+b[11]*c+b[15]):(e=b[0],d=b[1],g=b[2],h=b[3],k=b[4],l=b[5],m=b[6],p=b[7],n=b[8],q=b[9],r=b[10],t=b[11],a[0]=e,a[1]=d,a[2]=g,a[3]=h,a[4]=k,a[5]=l,a[6]=m,a[7]=p,a[8]=n,a[9]=q,a[10]=r,a[11]=t,a[12]=e*u+k*v+n*c+b[12],a[13]=d*u+l*v+q*c+b[13],a[14]=g*u+m*v+r*c+b[14],a[15]=h*u+p*v+t*c+b[15]),a};D.scale=function(a,b,c){var e=c[0],d=c[1];c=c[2];return a[0]=b[0]*e,a[1]=b[1]*e,a[2]=b[2]*e,a[3]=b[3]*e,a[4]=b[4]*d,a[5]=b[5]*d,a[6]=b[6]*d, -a[7]=b[7]*d,a[8]=b[8]*c,a[9]=b[9]*c,a[10]=b[10]*c,a[11]=b[11]*c,a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15],a};D.rotate=function(a,c,e,d){var g,h,k,l,m,p,n,q,r,t,u,v,w,D,z,G,na,sa,ea,qa,oa,O,ua,ha,ka=d[0],va=d[1];d=d[2];var ra=Math.sqrt(ka*ka+va*va+d*d);return Math.abs(ra)h?(n.cross(a,b,d),1E-6>n.length(a)&& -n.cross(a,c,d),n.normalize(a,a),w.setAxisAngle(e,a,Math.PI),e):.999999g&&(g=-g,q=-q,r=-r,t=-t,c=-c),1E-6<1-g?(d=Math.acos(g),h=Math.sin(d),k=Math.sin((1-e)*d)/h,l=Math.sin(e*d)/h):(k=1-e,l=e),a[0]=k*m+l*q,a[1]=k*p+l*r,a[2]=k*n+l*t,a[3]=k*b+l*c,a};w.invert=function(a,b){var c=b[0],e=b[1],d=b[2];b=b[3];var g=c*c+e*e+d*d+b*b;g=g?1/g:0;return a[0]=-c*g,a[1]=-e*g,a[2]=-d*g,a[3]=b*g,a};w.conjugate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a[3]=b[3],a};w.length=r.length; -w.len=w.length;w.squaredLength=r.squaredLength;w.sqrLen=w.squaredLength;w.normalize=r.normalize;w.fromMat3=function(a,b){var c=b[0]+b[4]+b[8];if(0b[0]&&(e=1);b[8]>b[3*e+e]&&(e=2);var d=(e+1)%3,g=(e+2)%3;c=Math.sqrt(b[3*e+e]-b[3*d+d]-b[3*g+g]+1);a[e]=.5*c;c=.5/c;a[3]=(b[3*g+d]-b[3*d+g])*c;a[d]=(b[3*d+e]+b[3*e+d])*c;a[g]=(b[3*g+e]+b[3*e+g])*c}return a};w.str=function(a){return'quat('+a[0]+ -', '+a[1]+', '+a[2]+', '+a[3]+')'};'undefined'!=typeof a&&(a.quat=w)})(b)}(this)},{}],24:[function(a,b,d){(function(){var a=this,g=a._,h={},k=Array.prototype,l=Object.prototype,m=k.push,q=k.slice,p=k.concat,e=l.toString,n=l.hasOwnProperty,r=k.forEach,t=k.map,D=k.reduce,w=k.reduceRight,u=k.filter,v=k.every,z=k.some,G=k.indexOf,I=k.lastIndexOf;l=Array.isArray;var K=Object.keys,H=Function.prototype.bind,C=function(a){return a instanceof C?a:this instanceof C?void(this._wrapped=a):new C(a)};'undefined'!= -typeof d?('undefined'!=typeof b&&b.exports&&(d=b.exports=C),d._=C):a._=C;C.VERSION='1.4.4';var P=C.each=C.forEach=function(a,b,c){if(null!=a)if(r&&a.forEach===r)a.forEach(b,c);else if(a.length===+a.length)for(var e=0,d=a.length;d>e&&b.call(c,a[e],e,a)!==h;e++);else for(e in a)if(C.has(a,e)&&b.call(c,a[e],e,a)===h)break};C.map=C.collect=function(a,b,c){var e=[];return null==a?e:t&&a.map===t?a.map(b,c):(P(a,function(a,d,g){e[e.length]=b.call(c,a,d,g)}),e)};C.reduce=C.foldl=C.inject=function(a,b,c,e){var d= -2a.length)return Math.max.apply(Math,a);if(!b&&C.isEmpty(a))return-1/0;var e={computed:-1/0,value:-1/0};return P(a,function(a,d,g){d=b?b.call(c, -a,d,g):a;d>=e.computed&&(e={value:a,computed:d})}),e.value};C.min=function(a,b,c){if(!b&&C.isArray(a)&&a[0]===+a[0]&&65535>a.length)return Math.min.apply(Math,a);if(!b&&C.isEmpty(a))return 1/0;var e={computed:1/0,value:1/0};return P(a,function(a,d,g){d=b?b.call(c,a,d,g):a;de||void 0===c)return 1;if(e>c||void 0===e)return-1}return a.indexd;){var h=d+g>>>1;c.call(e,a[h])e;e++)c[e]=C.pluck(a,''+e);return c};C.object=function(a,b){if(null==a)return{};for(var c={},e=0,d=a.length;d>e;e++)b?c[a[e]]=b[e]:c[a[e][0]]=a[e][1];return c};C.indexOf=function(a,b,c){if(null==a)return-1;var e=0,d=a.length;if(c){if('number'!=typeof c)return e=C.sortedIndex(a,b),a[e]===b?e:-1;e=0>c?Math.max(0,d+c):c}if(G&&a.indexOf===G)return a.indexOf(b,c);for(;d>e;e++)if(a[e]===b)return e;return-1};C.lastIndexOf= -function(a,b,c){if(null==a)return-1;var e=null!=c;if(I&&a.lastIndexOf===I)return e?a.lastIndexOf(b,c):a.lastIndexOf(b);for(c=e?c:a.length;c--;)if(a[c]===b)return c;return-1};C.range=function(a,b,c){1>=arguments.length&&(b=a||0,a=0);c=arguments[2]||1;for(var e=Math.max(Math.ceil((b-a)/c),0),d=0,g=Array(e);e>d;)g[d++]=a,a+=c;return g};C.bind=function(a,b){if(a.bind===H&&H)return H.apply(a,q.call(arguments,1));var c=q.call(arguments,2);return function(){return a.apply(b,c.concat(q.call(arguments)))}}; -C.partial=function(a){var b=q.call(arguments,1);return function(){return a.apply(this,b.concat(q.call(arguments)))}};C.bindAll=function(a){var b=q.call(arguments,1);return 0===b.length&&(b=C.functions(a)),P(b,function(b){a[b]=C.bind(a[b],a)}),a};C.memoize=function(a,b){var c={};return b||(b=C.identity),function(){var e=b.apply(this,arguments);return C.has(c,e)?c[e]:c[e]=a.apply(this,arguments)}};C.delay=function(a,b){var c=q.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)}; -C.defer=function(a){return C.delay.apply(C,[a,1].concat(q.call(arguments,1)))};C.throttle=function(a,b){var c,e,d,g,h=0,k=function(){h=new Date;d=null;g=a.apply(c,e)};return function(){var l=new Date,m=b-(l-h);return c=this,e=arguments,0>=m?(clearTimeout(d),d=null,h=l,g=a.apply(c,e)):d||(d=setTimeout(k,m)),g}};C.debounce=function(a,b,c){var e,d;return function(){var g=this,h=arguments,k=c&&!e;return clearTimeout(e),e=setTimeout(function(){e=null;c||(d=a.apply(g,h))},b),k&&(d=a.apply(g,h)),d}};C.once= -function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}};C.wrap=function(a,b){return function(){var c=[a];return m.apply(c,arguments),b.apply(this,c)}};C.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;0<=c;c--)b=[a[c].apply(this,b)];return b[0]}};C.after=function(a,b){return 0>=a?b():function(){return 1>--a?b.apply(this,arguments):void 0}};C.keys=K||function(a){if(a!==Object(a))throw new TypeError('Invalid object');var b= -[],c;for(c in a)C.has(a,c)&&(b[b.length]=c);return b};C.values=function(a){var b=[],c;for(c in a)C.has(a,c)&&b.push(a[c]);return b};C.pairs=function(a){var b=[],c;for(c in a)C.has(a,c)&&b.push([c,a[c]]);return b};C.invert=function(a){var b={},c;for(c in a)C.has(a,c)&&(b[a[c]]=c);return b};C.functions=C.methods=function(a){var b=[],c;for(c in a)C.isFunction(a[c])&&b.push(c);return b.sort()};C.extend=function(a){return P(q.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a};C.pick=function(a){var b= -{},c=p.apply(k,q.call(arguments,1));return P(c,function(c){c in a&&(b[c]=a[c])}),b};C.omit=function(a){var b={},c=p.apply(k,q.call(arguments,1)),e;for(e in a)C.contains(c,e)||(b[e]=a[e]);return b};C.defaults=function(a){return P(q.call(arguments,1),function(b){if(b)for(var c in b)null==a[c]&&(a[c]=b[c])}),a};C.clone=function(a){return C.isObject(a)?C.isArray(a)?a.slice():C.extend({},a):a};C.tap=function(a,b){return b(a),a};var ia=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null== -b)return a===b;a instanceof C&&(a=a._wrapped);b instanceof C&&(b=b._wrapped);var g=e.call(a);if(g!=e.call(b))return!1;switch(g){case '[object String]':return a==String(b);case '[object Number]':return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case '[object Date]':case '[object Boolean]':return+a==+b;case '[object RegExp]':return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if('object'!=typeof a||'object'!=typeof b)return!1;for(var h=c.length;h--;)if(c[h]==a)return d[h]== -b;c.push(a);d.push(b);h=0;var k=!0;if('[object Array]'==g){if(h=a.length,k=h==b.length)for(;h--&&(k=ia(a[h],b[h],c,d)););}else{g=a.constructor;var l=b.constructor;if(g!==l&&!(C.isFunction(g)&&g instanceof g&&C.isFunction(l)&&l instanceof l))return!1;for(var m in a)if(C.has(a,m)&&(h++,!(k=C.has(b,m)&&ia(a[m],b[m],c,d))))break;if(k){for(m in b)if(C.has(b,m)&&!h--)break;k=!h}}return c.pop(),d.pop(),k};C.isEqual=function(a,b){return ia(a,b,[],[])};C.isEmpty=function(a){if(null==a)return!0;if(C.isArray(a)|| -C.isString(a))return 0===a.length;for(var b in a)if(C.has(a,b))return!1;return!0};C.isElement=function(a){return!(!a||1!==a.nodeType)};C.isArray=l||function(a){return'[object Array]'==e.call(a)};C.isObject=function(a){return a===Object(a)};P('Arguments Function String Number Date RegExp'.split(' '),function(a){C['is'+a]=function(b){return e.call(b)=='[object '+a+']'}});C.isArguments(arguments)||(C.isArguments=function(a){return!(!a||!C.has(a,'callee'))});'function'!=typeof/./&&(C.isFunction=function(a){return'function'== -typeof a});C.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))};C.isNaN=function(a){return C.isNumber(a)&&a!=+a};C.isBoolean=function(a){return!0===a||!1===a||'[object Boolean]'==e.call(a)};C.isNull=function(a){return null===a};C.isUndefined=function(a){return void 0===a};C.has=function(a,b){return n.call(a,b)};C.noConflict=function(){return a._=g,this};C.identity=function(a){return a};C.times=function(a,b,c){for(var e=Array(a),d=0;a>d;d++)e[d]=b.call(c,d);return e};C.random=function(a, -b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))};var N={escape:{'&':'&','<':'<','>':'>','"':'"',"'":''','/':'/'}};N.unescape=C.invert(N.escape);var ma={escape:new RegExp('['+C.keys(N.escape).join('')+']','g'),unescape:new RegExp('('+C.keys(N.unescape).join('|')+')','g')};C.each(['escape','unescape'],function(a){C[a]=function(b){return null==b?'':(''+b).replace(ma[a],function(b){return N[a][b]})}});C.result=function(a,b){if(null==a)return null;b=a[b];return C.isFunction(b)? -b.call(a):b};C.mixin=function(a){P(C.functions(a),function(b){var c=C[b]=a[b];C.prototype[b]=function(){var a=[this._wrapped];return m.apply(a,arguments),na.call(this,c.apply(C,a))}})};var V=0;C.uniqueId=function(a){var b=++V+'';return a?a+b:b};C.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var ca=/(.)^/,ba={"'":"'",'\\':'\\','\r':'r','\n':'n','\t':'t','\u2028':'u2028','\u2029':'u2029'},L=/\\|'|\r|\n|\t|\u2028|\u2029/g;C.template=function(a, -b,c){c=C.defaults({},c,C.templateSettings);var e=new RegExp([(c.escape||ca).source,(c.interpolate||ca).source,(c.evaluate||ca).source].join('|')+'|$','g'),d=0,g="__p+='";a.replace(e,function(b,c,e,h,k){return g+=a.slice(d,k).replace(L,function(a){return'\\'+ba[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),e&&(g+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),h&&(g+="';\n"+h+"\n__p+='"),d=k+b.length,b});g+="';\n";c.variable||(g='with(obj||{}){\n'+g+'}\n');g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+ -g+'return __p;\n';try{var h=new Function(c.variable||'obj','_',g)}catch(ka){throw ka.source=g,ka;}if(b)return h(b,C);b=function(a){return h.call(this,a,C)};return b.source='function('+(c.variable||'obj')+'){\n'+g+'}',b};C.chain=function(a){return C(a).chain()};var na=function(a){return this._chain?C(a).chain():a};C.mixin(C);P('pop push reverse shift sort splice unshift'.split(' '),function(a){var b=k[a];C.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),'shift'!=a&&'splice'!= -a||0!==c.length||delete c[0],na.call(this,c)}});P(['concat','join','slice'],function(a){var b=k[a];C.prototype[a]=function(){return na.call(this,b.apply(this._wrapped,arguments))}});C.extend(C.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this)},{}],25:[function(a){'undefined'!=typeof window&&'function'!=typeof window.requestAnimationFrame&&(window.requestAnimationFrame=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame|| +b){if(a===b){var c=b[1],g=b[2],d=b[3],e=b[6],h=b[7],k=b[11];a[1]=b[4];a[2]=b[8];a[3]=b[12];a[4]=c;a[6]=b[9];a[7]=b[13];a[8]=g;a[9]=e;a[11]=b[14];a[12]=d;a[13]=h;a[14]=k}else a[0]=b[0],a[1]=b[4],a[2]=b[8],a[3]=b[12],a[4]=b[1],a[5]=b[5],a[6]=b[9],a[7]=b[13],a[8]=b[2],a[9]=b[6],a[10]=b[10],a[11]=b[14],a[12]=b[3],a[13]=b[7],a[14]=b[11],a[15]=b[15];return a},invert:function(a,b){var c=b[0],g=b[1],d=b[2],e=b[3],h=b[4],k=b[5],m=b[6],l=b[7],p=b[8],n=b[9],q=b[10],r=b[11],t=b[12],u=b[13],z=b[14];b=b[15];var v= +c*k-g*h,E=c*m-d*h,R=c*l-e*h,ra=g*m-d*k,pa=g*l-e*k,fa=d*l-e*m,oa=p*u-n*t,ma=p*z-q*t,O=p*b-r*t,ya=n*z-q*u,ea=n*b-r*u,qa=q*b-r*z,wa=v*qa-E*ea+R*ya+ra*O-pa*ma+fa*oa;return wa?(wa=1/wa,a[0]=(k*qa-m*ea+l*ya)*wa,a[1]=(d*ea-g*qa-e*ya)*wa,a[2]=(u*fa-z*pa+b*ra)*wa,a[3]=(q*pa-n*fa-r*ra)*wa,a[4]=(m*O-h*qa-l*ma)*wa,a[5]=(c*qa-d*O+e*ma)*wa,a[6]=(z*R-t*fa-b*E)*wa,a[7]=(p*fa-q*R+r*E)*wa,a[8]=(h*ea-k*O+l*oa)*wa,a[9]=(g*O-c*ea-e*oa)*wa,a[10]=(t*pa-u*R+b*v)*wa,a[11]=(n*R-p*pa-r*v)*wa,a[12]=(k*ma-h*ya-m*oa)*wa,a[13]= +(c*ya-g*ma+d*oa)*wa,a[14]=(u*E-t*ra-z*v)*wa,a[15]=(p*ra-n*E+q*v)*wa,a):null},adjoint:function(a,b){var c=b[0],g=b[1],d=b[2],e=b[3],h=b[4],k=b[5],m=b[6],l=b[7],p=b[8],n=b[9],q=b[10],r=b[11],t=b[12],u=b[13],v=b[14];b=b[15];return a[0]=k*(q*b-r*v)-n*(m*b-l*v)+u*(m*r-l*q),a[1]=-(g*(q*b-r*v)-n*(d*b-e*v)+u*(d*r-e*q)),a[2]=g*(m*b-l*v)-k*(d*b-e*v)+u*(d*l-e*m),a[3]=-(g*(m*r-l*q)-k*(d*r-e*q)+n*(d*l-e*m)),a[4]=-(h*(q*b-r*v)-p*(m*b-l*v)+t*(m*r-l*q)),a[5]=c*(q*b-r*v)-p*(d*b-e*v)+t*(d*r-e*q),a[6]=-(c*(m*b-l*v)- +h*(d*b-e*v)+t*(d*l-e*m)),a[7]=c*(m*r-l*q)-h*(d*r-e*q)+p*(d*l-e*m),a[8]=h*(n*b-r*u)-p*(k*b-l*u)+t*(k*r-l*n),a[9]=-(c*(n*b-r*u)-p*(g*b-e*u)+t*(g*r-e*n)),a[10]=c*(k*b-l*u)-h*(g*b-e*u)+t*(g*l-e*k),a[11]=-(c*(k*r-l*n)-h*(g*r-e*n)+p*(g*l-e*k)),a[12]=-(h*(n*v-q*u)-p*(k*v-m*u)+t*(k*q-m*n)),a[13]=c*(n*v-q*u)-p*(g*v-d*u)+t*(g*q-d*n),a[14]=-(c*(k*v-m*u)-h*(g*v-d*u)+t*(g*m-d*k)),a[15]=c*(k*q-m*n)-h*(g*q-d*n)+p*(g*m-d*k),a},determinant:function(a){var b=a[0],c=a[1],g=a[2],d=a[3],e=a[4],h=a[5],k=a[6],m=a[7],l= +a[8],p=a[9],n=a[10],q=a[11],r=a[12],t=a[13],u=a[14];a=a[15];return(b*h-c*e)*(n*a-q*u)-(b*k-g*e)*(p*a-q*t)+(b*m-d*e)*(p*u-n*t)+(c*k-g*h)*(l*a-q*r)-(c*m-d*h)*(l*u-n*r)+(g*m-d*k)*(l*t-p*r)},multiply:function(a,b,c){var g=b[0],d=b[1],e=b[2],h=b[3],k=b[4],m=b[5],l=b[6],p=b[7],n=b[8],q=b[9],r=b[10],t=b[11],u=b[12],v=b[13],z=b[14];b=b[15];var E=c[0],w=c[1],ra=c[2],pa=c[3];return a[0]=E*g+w*k+ra*n+pa*u,a[1]=E*d+w*m+ra*q+pa*v,a[2]=E*e+w*l+ra*r+pa*z,a[3]=E*h+w*p+ra*t+pa*b,E=c[4],w=c[5],ra=c[6],pa=c[7],a[4]= +E*g+w*k+ra*n+pa*u,a[5]=E*d+w*m+ra*q+pa*v,a[6]=E*e+w*l+ra*r+pa*z,a[7]=E*h+w*p+ra*t+pa*b,E=c[8],w=c[9],ra=c[10],pa=c[11],a[8]=E*g+w*k+ra*n+pa*u,a[9]=E*d+w*m+ra*q+pa*v,a[10]=E*e+w*l+ra*r+pa*z,a[11]=E*h+w*p+ra*t+pa*b,E=c[12],w=c[13],ra=c[14],pa=c[15],a[12]=E*g+w*k+ra*n+pa*u,a[13]=E*d+w*m+ra*q+pa*v,a[14]=E*e+w*l+ra*r+pa*z,a[15]=E*h+w*p+ra*t+pa*b,a}};E.mul=E.multiply;E.translate=function(a,b,c){var g,d,e,h,k,m,l,p,n,q,r,t,u=c[0],v=c[1];c=c[2];return b===a?(a[12]=b[0]*u+b[4]*v+b[8]*c+b[12],a[13]=b[1]*u+ +b[5]*v+b[9]*c+b[13],a[14]=b[2]*u+b[6]*v+b[10]*c+b[14],a[15]=b[3]*u+b[7]*v+b[11]*c+b[15]):(g=b[0],d=b[1],e=b[2],h=b[3],k=b[4],m=b[5],l=b[6],p=b[7],n=b[8],q=b[9],r=b[10],t=b[11],a[0]=g,a[1]=d,a[2]=e,a[3]=h,a[4]=k,a[5]=m,a[6]=l,a[7]=p,a[8]=n,a[9]=q,a[10]=r,a[11]=t,a[12]=g*u+k*v+n*c+b[12],a[13]=d*u+m*v+q*c+b[13],a[14]=e*u+l*v+r*c+b[14],a[15]=h*u+p*v+t*c+b[15]),a};E.scale=function(a,b,c){var g=c[0],d=c[1];c=c[2];return a[0]=b[0]*g,a[1]=b[1]*g,a[2]=b[2]*g,a[3]=b[3]*g,a[4]=b[4]*d,a[5]=b[5]*d,a[6]=b[6]*d, +a[7]=b[7]*d,a[8]=b[8]*c,a[9]=b[9]*c,a[10]=b[10]*c,a[11]=b[11]*c,a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15],a};E.rotate=function(a,c,g,d){var e,h,k,m,l,p,n,q,r,u,t,v,z,E,w,I,ra,pa,fa,oa,ma,O,ya,ea,qa=d[0],wa=d[1];d=d[2];var ua=Math.sqrt(qa*qa+wa*wa+d*d);return Math.abs(ua)h?(p.cross(a,b,d),1E-6>p.length(a)&& +p.cross(a,c,d),p.normalize(a,a),v.setAxisAngle(g,a,Math.PI),g):.999999e&&(e=-e,q=-q,r=-r,u=-u,c=-c),1E-6<1-e?(d=Math.acos(e),h=Math.sin(d),k=Math.sin((1-g)*d)/h,m=Math.sin(g*d)/h):(k=1-g,m=g),a[0]=k*l+m*q,a[1]=k*p+m*r,a[2]=k*n+m*u,a[3]=k*b+m*c,a};v.invert=function(a,b){var c=b[0],g=b[1],d=b[2];b=b[3];var e=c*c+g*g+d*d+b*b;e=e?1/e:0;return a[0]=-c*e,a[1]=-g*e,a[2]=-d*e,a[3]=b*e,a};v.conjugate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a[3]=b[3],a};v.length=r.length; +v.len=v.length;v.squaredLength=r.squaredLength;v.sqrLen=v.squaredLength;v.normalize=r.normalize;v.fromMat3=function(a,b){var c=b[0]+b[4]+b[8];if(0b[0]&&(g=1);b[8]>b[3*g+g]&&(g=2);var d=(g+1)%3,e=(g+2)%3;c=Math.sqrt(b[3*g+g]-b[3*d+d]-b[3*e+e]+1);a[g]=.5*c;c=.5/c;a[3]=(b[3*e+d]-b[3*d+e])*c;a[d]=(b[3*d+g]+b[3*g+d])*c;a[e]=(b[3*e+g]+b[3*g+e])*c}return a};v.str=function(a){return'quat('+a[0]+ +', '+a[1]+', '+a[2]+', '+a[3]+')'};'undefined'!=typeof a&&(a.quat=v)})(b)}(this)},{}],24:[function(a,b,e){(function(){var a=this,c=a._,k={},h=Array.prototype,l=Object.prototype,n=h.push,q=h.slice,m=h.concat,g=l.toString,p=l.hasOwnProperty,r=h.forEach,u=h.map,E=h.reduce,v=h.reduceRight,t=h.filter,z=h.every,w=h.some,I=h.indexOf,H=h.lastIndexOf;l=Array.isArray;var K=Object.keys,C=Function.prototype.bind,D=function(a){return a instanceof D?a:this instanceof D?void(this._wrapped=a):new D(a)};'undefined'!= +typeof e?('undefined'!=typeof b&&b.exports&&(e=b.exports=D),e._=D):a._=D;D.VERSION='1.4.4';var Q=D.each=D.forEach=function(a,b,c){if(null!=a)if(r&&a.forEach===r)a.forEach(b,c);else if(a.length===+a.length)for(var g=0,d=a.length;d>g&&b.call(c,a[g],g,a)!==k;g++);else for(g in a)if(D.has(a,g)&&b.call(c,a[g],g,a)===k)break};D.map=D.collect=function(a,b,c){var g=[];return null==a?g:u&&a.map===u?a.map(b,c):(Q(a,function(a,d,e){g[g.length]=b.call(c,a,d,e)}),g)};D.reduce=D.foldl=D.inject=function(a,b,c,g){var d= +2a.length)return Math.max.apply(Math,a);if(!b&&D.isEmpty(a))return-1/0;var g={computed:-1/0,value:-1/0};return Q(a,function(a,d,e){d=b?b.call(c, +a,d,e):a;d>=g.computed&&(g={value:a,computed:d})}),g.value};D.min=function(a,b,c){if(!b&&D.isArray(a)&&a[0]===+a[0]&&65535>a.length)return Math.min.apply(Math,a);if(!b&&D.isEmpty(a))return 1/0;var g={computed:1/0,value:1/0};return Q(a,function(a,d,e){d=b?b.call(c,a,d,e):a;dg||void 0===c)return 1;if(g>c||void 0===g)return-1}return a.indexd;){var h=d+e>>>1;c.call(g,a[h])g;g++)c[g]=D.pluck(a,''+g);return c};D.object=function(a,b){if(null==a)return{};for(var c={},g=0,d=a.length;d>g;g++)b?c[a[g]]=b[g]:c[a[g][0]]=a[g][1];return c};D.indexOf=function(a,b,c){if(null==a)return-1;var g=0,d=a.length;if(c){if('number'!=typeof c)return g=D.sortedIndex(a,b),a[g]===b?g:-1;g=0>c?Math.max(0,d+c):c}if(I&&a.indexOf===I)return a.indexOf(b,c);for(;d>g;g++)if(a[g]===b)return g;return-1};D.lastIndexOf= +function(a,b,c){if(null==a)return-1;var g=null!=c;if(H&&a.lastIndexOf===H)return g?a.lastIndexOf(b,c):a.lastIndexOf(b);for(c=g?c:a.length;c--;)if(a[c]===b)return c;return-1};D.range=function(a,b,c){1>=arguments.length&&(b=a||0,a=0);c=arguments[2]||1;for(var g=Math.max(Math.ceil((b-a)/c),0),d=0,e=Array(g);g>d;)e[d++]=a,a+=c;return e};D.bind=function(a,b){if(a.bind===C&&C)return C.apply(a,q.call(arguments,1));var c=q.call(arguments,2);return function(){return a.apply(b,c.concat(q.call(arguments)))}}; +D.partial=function(a){var b=q.call(arguments,1);return function(){return a.apply(this,b.concat(q.call(arguments)))}};D.bindAll=function(a){var b=q.call(arguments,1);return 0===b.length&&(b=D.functions(a)),Q(b,function(b){a[b]=D.bind(a[b],a)}),a};D.memoize=function(a,b){var c={};return b||(b=D.identity),function(){var g=b.apply(this,arguments);return D.has(c,g)?c[g]:c[g]=a.apply(this,arguments)}};D.delay=function(a,b){var c=q.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)}; +D.defer=function(a){return D.delay.apply(D,[a,1].concat(q.call(arguments,1)))};D.throttle=function(a,b){var c,g,d,e,h=0,k=function(){h=new Date;d=null;e=a.apply(c,g)};return function(){var m=new Date,l=b-(m-h);return c=this,g=arguments,0>=l?(clearTimeout(d),d=null,h=m,e=a.apply(c,g)):d||(d=setTimeout(k,l)),e}};D.debounce=function(a,b,c){var g,d;return function(){var e=this,h=arguments,k=c&&!g;return clearTimeout(g),g=setTimeout(function(){g=null;c||(d=a.apply(e,h))},b),k&&(d=a.apply(e,h)),d}};D.once= +function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}};D.wrap=function(a,b){return function(){var c=[a];return n.apply(c,arguments),b.apply(this,c)}};D.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;0<=c;c--)b=[a[c].apply(this,b)];return b[0]}};D.after=function(a,b){return 0>=a?b():function(){return 1>--a?b.apply(this,arguments):void 0}};D.keys=K||function(a){if(a!==Object(a))throw new TypeError('Invalid object');var b= +[],c;for(c in a)D.has(a,c)&&(b[b.length]=c);return b};D.values=function(a){var b=[],c;for(c in a)D.has(a,c)&&b.push(a[c]);return b};D.pairs=function(a){var b=[],c;for(c in a)D.has(a,c)&&b.push([c,a[c]]);return b};D.invert=function(a){var b={},c;for(c in a)D.has(a,c)&&(b[a[c]]=c);return b};D.functions=D.methods=function(a){var b=[],c;for(c in a)D.isFunction(a[c])&&b.push(c);return b.sort()};D.extend=function(a){return Q(q.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a};D.pick=function(a){var b= +{},c=m.apply(h,q.call(arguments,1));return Q(c,function(c){c in a&&(b[c]=a[c])}),b};D.omit=function(a){var b={},c=m.apply(h,q.call(arguments,1)),g;for(g in a)D.contains(c,g)||(b[g]=a[g]);return b};D.defaults=function(a){return Q(q.call(arguments,1),function(b){if(b)for(var c in b)null==a[c]&&(a[c]=b[c])}),a};D.clone=function(a){return D.isObject(a)?D.isArray(a)?a.slice():D.extend({},a):a};D.tap=function(a,b){return b(a),a};var ba=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null== +b)return a===b;a instanceof D&&(a=a._wrapped);b instanceof D&&(b=b._wrapped);var e=g.call(a);if(e!=g.call(b))return!1;switch(e){case '[object String]':return a==String(b);case '[object Number]':return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case '[object Date]':case '[object Boolean]':return+a==+b;case '[object RegExp]':return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if('object'!=typeof a||'object'!=typeof b)return!1;for(var h=c.length;h--;)if(c[h]==a)return d[h]== +b;c.push(a);d.push(b);h=0;var k=!0;if('[object Array]'==e){if(h=a.length,k=h==b.length)for(;h--&&(k=ba(a[h],b[h],c,d)););}else{e=a.constructor;var m=b.constructor;if(e!==m&&!(D.isFunction(e)&&e instanceof e&&D.isFunction(m)&&m instanceof m))return!1;for(var l in a)if(D.has(a,l)&&(h++,!(k=D.has(b,l)&&ba(a[l],b[l],c,d))))break;if(k){for(l in b)if(D.has(b,l)&&!h--)break;k=!h}}return c.pop(),d.pop(),k};D.isEqual=function(a,b){return ba(a,b,[],[])};D.isEmpty=function(a){if(null==a)return!0;if(D.isArray(a)|| +D.isString(a))return 0===a.length;for(var b in a)if(D.has(a,b))return!1;return!0};D.isElement=function(a){return!(!a||1!==a.nodeType)};D.isArray=l||function(a){return'[object Array]'==g.call(a)};D.isObject=function(a){return a===Object(a)};Q('Arguments Function String Number Date RegExp'.split(' '),function(a){D['is'+a]=function(b){return g.call(b)=='[object '+a+']'}});D.isArguments(arguments)||(D.isArguments=function(a){return!(!a||!D.has(a,'callee'))});'function'!=typeof/./&&(D.isFunction=function(a){return'function'== +typeof a});D.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))};D.isNaN=function(a){return D.isNumber(a)&&a!=+a};D.isBoolean=function(a){return!0===a||!1===a||'[object Boolean]'==g.call(a)};D.isNull=function(a){return null===a};D.isUndefined=function(a){return void 0===a};D.has=function(a,b){return p.call(a,b)};D.noConflict=function(){return a._=c,this};D.identity=function(a){return a};D.times=function(a,b,c){for(var g=Array(a),d=0;a>d;d++)g[d]=b.call(c,d);return g};D.random=function(a, +b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))};var N={escape:{'&':'&','<':'<','>':'>','"':'"',"'":''','/':'/'}};N.unescape=D.invert(N.escape);var la={escape:new RegExp('['+D.keys(N.escape).join('')+']','g'),unescape:new RegExp('('+D.keys(N.unescape).join('|')+')','g')};D.each(['escape','unescape'],function(a){D[a]=function(b){return null==b?'':(''+b).replace(la[a],function(b){return N[a][b]})}});D.result=function(a,b){if(null==a)return null;b=a[b];return D.isFunction(b)? +b.call(a):b};D.mixin=function(a){Q(D.functions(a),function(b){var c=D[b]=a[b];D.prototype[b]=function(){var a=[this._wrapped];return n.apply(a,arguments),ra.call(this,c.apply(D,a))}})};var T=0;D.uniqueId=function(a){var b=++T+'';return a?a+b:b};D.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var aa=/(.)^/,da={"'":"'",'\\':'\\','\r':'r','\n':'n','\t':'t','\u2028':'u2028','\u2029':'u2029'},R=/\\|'|\r|\n|\t|\u2028|\u2029/g;D.template=function(a, +b,c){c=D.defaults({},c,D.templateSettings);var g=new RegExp([(c.escape||aa).source,(c.interpolate||aa).source,(c.evaluate||aa).source].join('|')+'|$','g'),d=0,e="__p+='";a.replace(g,function(b,c,g,h,k){return e+=a.slice(d,k).replace(R,function(a){return'\\'+da[a]}),c&&(e+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),g&&(e+="'+\n((__t=("+g+"))==null?'':__t)+\n'"),h&&(e+="';\n"+h+"\n__p+='"),d=k+b.length,b});e+="';\n";c.variable||(e='with(obj||{}){\n'+e+'}\n');e="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+ +e+'return __p;\n';try{var h=new Function(c.variable||'obj','_',e)}catch(qa){throw qa.source=e,qa;}if(b)return h(b,D);b=function(a){return h.call(this,a,D)};return b.source='function('+(c.variable||'obj')+'){\n'+e+'}',b};D.chain=function(a){return D(a).chain()};var ra=function(a){return this._chain?D(a).chain():a};D.mixin(D);Q('pop push reverse shift sort splice unshift'.split(' '),function(a){var b=h[a];D.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),'shift'!=a&&'splice'!= +a||0!==c.length||delete c[0],ra.call(this,c)}});Q(['concat','join','slice'],function(a){var b=h[a];D.prototype[a]=function(){return ra.call(this,b.apply(this._wrapped,arguments))}});D.extend(D.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this)},{}],25:[function(a){'undefined'!=typeof window&&'function'!=typeof window.requestAnimationFrame&&(window.requestAnimationFrame=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame|| window.msRequestAnimationFrame||function(a){setTimeout(a,1E3/60)});Leap=a('../lib/index')},{'../lib/index':11}]},{},[25]);var SPE={distributions:{BOX:1,SPHERE:2,DISC:3},valueOverLifetimeLength:4};'function'==typeof define&&define.amd?define('spe',SPE):'undefined'!=typeof exports&&'undefined'!=typeof module&&(module.exports=SPE); -SPE.TypedArrayHelper=function(a,b,d,c){this.componentSize=d||1;this.size=b||1;this.TypedArrayConstructor=a||Float32Array;this.array=new a(b*this.componentSize);this.indexOffset=c||0};SPE.TypedArrayHelper.constructor=SPE.TypedArrayHelper;SPE.TypedArrayHelper.prototype.setSize=function(a,b){var d=this.array.length;return b||(a*=this.componentSize),d>a?this.shrink(a):a>d?this.grow(a):void console.info('TypedArray is already of size:',a+'.','Will not resize.')}; -SPE.TypedArrayHelper.prototype.shrink=function(a){return this.array=this.array.subarray(0,a),this.size=a,this};SPE.TypedArrayHelper.prototype.grow=function(a){var b=this.array,d=new this.TypedArrayConstructor(a);return d.set(b),this.array=d,this.size=a,this};SPE.TypedArrayHelper.prototype.splice=function(a,b){a*=this.componentSize;b*=this.componentSize;for(var d=[],c=this.array,g=c.length,h=0;g>h;++h)(a>h||h>=b)&&d.push(c[h]);return this.setFromArray(0,d),this}; -SPE.TypedArrayHelper.prototype.setFromArray=function(a,b){var d=a+b.length;return d>this.array.length?this.grow(d):da?this.shrink(a):a>e?this.grow(a):void console.info('TypedArray is already of size:',a+'.','Will not resize.')}; +SPE.TypedArrayHelper.prototype.shrink=function(a){return this.array=this.array.subarray(0,a),this.size=a,this};SPE.TypedArrayHelper.prototype.grow=function(a){var b=this.array,e=new this.TypedArrayConstructor(a);return e.set(b),this.array=e,this.size=a,this};SPE.TypedArrayHelper.prototype.splice=function(a,b){a*=this.componentSize;b*=this.componentSize;for(var e=[],d=this.array,c=d.length,k=0;c>k;++k)(a>k||k>=b)&&e.push(d[k]);return this.setFromArray(0,e),this}; +SPE.TypedArrayHelper.prototype.setFromArray=function(a,b){var e=a+b.length;return e>this.array.length?this.grow(e):eh;++h){var k=h*g,l=Math.floor(k);c[h]=this.lerpTypeAgnostic(a[l],a[Math.ceil(k)],k-l)}return c.push('function'==typeof a[d-1].clone?a[d-1].clone():a[d-1]),c},clamp:function(a,b,d){return Math.max(b,Math.min(a,d))},zeroToEpsilon:function(a,b){var d=a;return d=b?1E-4*Math.random():1E-5,0>a&&-1E-5a?-(Math.abs(a)-d):a+b-d)},arrayValuesAreEqual:function(a){for(var b=0;bl;++l){var m=g[l];a.copy(c[l]);a.r+=Math.random()*m.x-.5*m.x;a.g+=Math.random()*m.y-.5*m.y;a.b+=Math.random()*m.z-.5*m.z;a.r=this.clamp(a.r,0,1);a.g=this.clamp(a.g,0,1);a.b=this.clamp(a.b,0,1);k.push(a.getHex())}b.typedArray.setVec4Components(d,k[0],k[1],k[2],k[3])}}(),randomVector3OnSphere:function(a,b,d,c,g,h,k,l){l=2*Math.random()-1;var m=6.2832*Math.random(),q=Math.sqrt(1-l*l);c=this.randomFloat(c,g);k&&(c=Math.round(c/k)*k);k=q*Math.cos(m)* -c;m=q*Math.sin(m)*c;k*=h.x;m*=h.y;h=l*c*h.z;k+=d.x;m+=d.y;h+=d.z;a.typedArray.setVec3Components(b,k,m,h)},seededRandom:function(a){a=1E4*Math.sin(a);return a-(0|a)},randomVector3OnDisc:function(a,b,d,c,g,h,k){var l=6.2832*Math.random();c=Math.abs(this.randomFloat(c,g));k&&(c=Math.round(c/k)*k);k=Math.cos(l)*c;l=Math.sin(l)*c;k*=h.x;l*=h.y;k+=d.x;l+=d.y;d=0+d.z;a.typedArray.setVec3Components(b,k,l,d)},randomDirectionVector3OnSphere:function(){var a=new THREE.Vector3;return function(b,d,c,g,h,k,l,m){a.copy(k); -a.x-=c;a.y-=g;a.z-=h;a.normalize().multiplyScalar(-this.randomFloat(l,m));b.typedArray.setVec3Components(d,a.x,a.y,a.z)}}(),randomDirectionVector3OnDisc:function(){var a=new THREE.Vector3;return function(b,d,c,g,h,k,l,m){a.copy(k);a.x-=c;a.y-=g;a.z-=h;a.normalize().multiplyScalar(-this.randomFloat(l,m));b.typedArray.setVec3Components(d,a.x,a.y,0)}}(),getPackedRotationAxis:function(){var a=new THREE.Vector3,b=new THREE.Vector3,d=new THREE.Color,c=new THREE.Vector3(1,1,1);return function(g,h){return a.copy(g).normalize(), -b.copy(h).normalize(),a.x+=.5*-h.x+Math.random()*h.x,a.y+=.5*-h.y+Math.random()*h.y,a.z+=.5*-h.z+Math.random()*h.z,a.normalize().add(c).multiplyScalar(.5),d.setRGB(a.x,a.y,a.z),d.getHex()}}()}; -SPE.Group=function(a){var b=SPE.utils,d=b.types;a=b.ensureTypedArg(a,d.OBJECT,{});a.texture=b.ensureTypedArg(a.texture,d.OBJECT,{});this.uuid=THREE.Math.generateUUID();this.fixedTimeStep=b.ensureTypedArg(a.fixedTimeStep,d.NUMBER,.016);this.texture=b.ensureInstanceOf(a.texture.value,THREE.Texture,null);this.textureFrames=b.ensureInstanceOf(a.texture.frames,THREE.Vector2,new THREE.Vector2(1,1));this.textureFrameCount=b.ensureTypedArg(a.texture.frameCount,d.NUMBER,this.textureFrames.x*this.textureFrames.y); -this.textureLoop=b.ensureTypedArg(a.texture.loop,d.NUMBER,1);this.textureFrames.max(new THREE.Vector2(1,1));this.hasPerspective=b.ensureTypedArg(a.hasPerspective,d.BOOLEAN,!0);this.colorize=b.ensureTypedArg(a.colorize,d.BOOLEAN,!0);this.maxParticleCount=b.ensureTypedArg(a.maxParticleCount,d.NUMBER,null);this.blending=b.ensureTypedArg(a.blending,d.NUMBER,THREE.AdditiveBlending);this.transparent=b.ensureTypedArg(a.transparent,d.BOOLEAN,!0);this.alphaTest=parseFloat(b.ensureTypedArg(a.alphaTest,d.NUMBER, -0));this.depthWrite=b.ensureTypedArg(a.depthWrite,d.BOOLEAN,!1);this.depthTest=b.ensureTypedArg(a.depthTest,d.BOOLEAN,!0);this.fog=b.ensureTypedArg(a.fog,d.BOOLEAN,!0);this.scale=b.ensureTypedArg(a.scale,d.NUMBER,300);this.emitters=[];this.emitterIDs=[];this._pool=[];this._poolCreationSettings=null;this._createNewWhenPoolEmpty=0;this._attributesNeedDynamicReset=this._attributesNeedRefresh=!1;this.particleCount=0;this.uniforms={texture:{type:'t',value:this.texture},textureAnimation:{type:'v4',value:new THREE.Vector4(this.textureFrames.x, +SPE.utils={types:{BOOLEAN:'boolean',STRING:'string',NUMBER:'number',OBJECT:'object'},ensureTypedArg:function(a,b,e){return typeof a===b?a:e},ensureArrayTypedArg:function(a,b,e){if(Array.isArray(a)){for(var d=a.length-1;0<=d;--d)if(typeof a[d]!==b)return e;return a}return this.ensureTypedArg(a,b,e)},ensureInstanceOf:function(a,b,e){return void 0!==b&&a instanceof b?a:e},ensureArrayInstanceOf:function(a,b,e){if(Array.isArray(a)){for(var d=a.length-1;0<=d;--d)if(void 0!==b&&0==a[d]instanceof b)return e; +return a}return this.ensureInstanceOf(a,b,e)},ensureValueOverLifetimeCompliance:function(a,b,e){b=b||3;e=e||3;!1===Array.isArray(a._value)&&(a._value=[a._value]);!1===Array.isArray(a._spread)&&(a._spread=[a._spread]);var d=this.clamp(a._value.length,b,e);b=this.clamp(a._spread.length,b,e);d=Math.max(d,b);a._value.length!==d&&(a._value=this.interpolateArray(a._value,d));a._spread.length!==d&&(a._spread=this.interpolateArray(a._spread,d))},interpolateArray:function(a,b){for(var e=a.length,d=['function'== +typeof a[0].clone?a[0].clone():a[0]],c=(e-1)/(b-1),k=1;b-1>k;++k){var h=k*c,l=Math.floor(h);d[k]=this.lerpTypeAgnostic(a[l],a[Math.ceil(h)],h-l)}return d.push('function'==typeof a[e-1].clone?a[e-1].clone():a[e-1]),d},clamp:function(a,b,e){return Math.max(b,Math.min(a,e))},zeroToEpsilon:function(a,b){var e=a;return e=b?1E-4*Math.random():1E-5,0>a&&-1E-5a?-(Math.abs(a)-e):a+b-e)},arrayValuesAreEqual:function(a){for(var b=0;bl;++l){var n=c[l];a.copy(d[l]);a.r+=Math.random()*n.x-.5*n.x;a.g+=Math.random()*n.y-.5*n.y;a.b+=Math.random()*n.z-.5*n.z;a.r=this.clamp(a.r,0,1);a.g=this.clamp(a.g,0,1);a.b=this.clamp(a.b,0,1);h.push(a.getHex())}b.typedArray.setVec4Components(e,h[0],h[1],h[2],h[3])}}(),randomVector3OnSphere:function(a,b,e,d,c,k,h,l){l=2*Math.random()-1;var n=6.2832*Math.random(),q=Math.sqrt(1-l*l);d=this.randomFloat(d,c);h&&(d=Math.round(d/h)*h);h=q*Math.cos(n)* +d;n=q*Math.sin(n)*d;h*=k.x;n*=k.y;k=l*d*k.z;h+=e.x;n+=e.y;k+=e.z;a.typedArray.setVec3Components(b,h,n,k)},seededRandom:function(a){a=1E4*Math.sin(a);return a-(0|a)},randomVector3OnDisc:function(a,b,e,d,c,k,h){var l=6.2832*Math.random();d=Math.abs(this.randomFloat(d,c));h&&(d=Math.round(d/h)*h);h=Math.cos(l)*d;l=Math.sin(l)*d;h*=k.x;l*=k.y;h+=e.x;l+=e.y;e=0+e.z;a.typedArray.setVec3Components(b,h,l,e)},randomDirectionVector3OnSphere:function(){var a=new THREE.Vector3;return function(b,e,d,c,k,h,l,n){a.copy(h); +a.x-=d;a.y-=c;a.z-=k;a.normalize().multiplyScalar(-this.randomFloat(l,n));b.typedArray.setVec3Components(e,a.x,a.y,a.z)}}(),randomDirectionVector3OnDisc:function(){var a=new THREE.Vector3;return function(b,e,d,c,k,h,l,n){a.copy(h);a.x-=d;a.y-=c;a.z-=k;a.normalize().multiplyScalar(-this.randomFloat(l,n));b.typedArray.setVec3Components(e,a.x,a.y,0)}}(),getPackedRotationAxis:function(){var a=new THREE.Vector3,b=new THREE.Vector3,e=new THREE.Color,d=new THREE.Vector3(1,1,1);return function(c,k){return a.copy(c).normalize(), +b.copy(k).normalize(),a.x+=.5*-k.x+Math.random()*k.x,a.y+=.5*-k.y+Math.random()*k.y,a.z+=.5*-k.z+Math.random()*k.z,a.normalize().add(d).multiplyScalar(.5),e.setRGB(a.x,a.y,a.z),e.getHex()}}()}; +SPE.Group=function(a){var b=SPE.utils,e=b.types;a=b.ensureTypedArg(a,e.OBJECT,{});a.texture=b.ensureTypedArg(a.texture,e.OBJECT,{});this.uuid=THREE.Math.generateUUID();this.fixedTimeStep=b.ensureTypedArg(a.fixedTimeStep,e.NUMBER,.016);this.texture=b.ensureInstanceOf(a.texture.value,THREE.Texture,null);this.textureFrames=b.ensureInstanceOf(a.texture.frames,THREE.Vector2,new THREE.Vector2(1,1));this.textureFrameCount=b.ensureTypedArg(a.texture.frameCount,e.NUMBER,this.textureFrames.x*this.textureFrames.y); +this.textureLoop=b.ensureTypedArg(a.texture.loop,e.NUMBER,1);this.textureFrames.max(new THREE.Vector2(1,1));this.hasPerspective=b.ensureTypedArg(a.hasPerspective,e.BOOLEAN,!0);this.colorize=b.ensureTypedArg(a.colorize,e.BOOLEAN,!0);this.maxParticleCount=b.ensureTypedArg(a.maxParticleCount,e.NUMBER,null);this.blending=b.ensureTypedArg(a.blending,e.NUMBER,THREE.AdditiveBlending);this.transparent=b.ensureTypedArg(a.transparent,e.BOOLEAN,!0);this.alphaTest=parseFloat(b.ensureTypedArg(a.alphaTest,e.NUMBER, +0));this.depthWrite=b.ensureTypedArg(a.depthWrite,e.BOOLEAN,!1);this.depthTest=b.ensureTypedArg(a.depthTest,e.BOOLEAN,!0);this.fog=b.ensureTypedArg(a.fog,e.BOOLEAN,!0);this.scale=b.ensureTypedArg(a.scale,e.NUMBER,300);this.emitters=[];this.emitterIDs=[];this._pool=[];this._poolCreationSettings=null;this._createNewWhenPoolEmpty=0;this._attributesNeedDynamicReset=this._attributesNeedRefresh=!1;this.particleCount=0;this.uniforms={texture:{type:'t',value:this.texture},textureAnimation:{type:'v4',value:new THREE.Vector4(this.textureFrames.x, this.textureFrames.y,this.textureFrameCount,Math.max(Math.abs(this.textureLoop),1))},fogColor:{type:'c',value:null},fogNear:{type:'f',value:10},fogFar:{type:'f',value:200},fogDensity:{type:'f',value:.5},deltaTime:{type:'f',value:0},runTime:{type:'f',value:0},scale:{type:'f',value:this.scale}};this.defines={HAS_PERSPECTIVE:this.hasPerspective,COLORIZE:this.colorize,VALUE_OVER_LIFETIME_LENGTH:SPE.valueOverLifetimeLength,SHOULD_ROTATE_TEXTURE:!1,SHOULD_ROTATE_PARTICLES:!1,SHOULD_WIGGLE_PARTICLES:!1, SHOULD_CALCULATE_SPRITE:1this.maxParticleCount&&console.warn('SPE.Group: maxParticleCount exceeded. Requesting',this.particleCount,'particles, can support only',this.maxParticleCount);a._calculatePPSValue(a.maxAge._value+a.maxAge._spread);a._setBufferUpdateRanges(this.attributeKeys);a._setAttributeOffset(d);a.group=this;a.attributes=this.attributes;for(var g in b)b.hasOwnProperty(g)&&b[g]._createBufferAttribute(null!==this.maxParticleCount?this.maxParticleCount:this.particleCount); -for(b=d;c>b;++b)a._assignPositionValue(b),a._assignForceValue(b,'velocity'),a._assignForceValue(b,'acceleration'),a._assignAbsLifetimeValue(b,'opacity'),a._assignAbsLifetimeValue(b,'size'),a._assignAngleValue(b),a._assignRotationValue(b),a._assignParamsValue(b),a._assignColorValue(b);return this._applyAttributesToGeometry(),this.emitters.push(a),this.emitterIDs.push(a.uuid),this._updateDefines(a),this.material.needsUpdate=!0,this.geometry.needsUpdate=!0,this._attributesNeedRefresh=!0,this}; -SPE.Group.prototype.removeEmitter=function(a){var b=this.emitterIDs.indexOf(a.uuid);if(0==a instanceof SPE.Emitter)return void console.error('`emitter` argument must be instance of SPE.Emitter. Was provided with:',a);if(-1===b)return void console.error('Emitter does not exist in this group. Will not remove.');for(var d=a.attributeOffset,c=d+a.particleCount,g=this.attributes.params.typedArray,h=d;c>h;++h)g.array[4*h]=0,g.array[4*h+1]=0;this.emitters.splice(b,1);this.emitterIDs.splice(b,1);for(var k in this.attributes)this.attributes.hasOwnProperty(k)&& -this.attributes[k].splice(d,c);this.particleCount-=a.particleCount;a._onRemove();this._attributesNeedRefresh=!0};SPE.Group.prototype.getFromPool=function(){var a=this._pool,b=this._createNewWhenPoolEmpty;return a.length?a.pop():b?(a=new SPE.Emitter(this._poolCreationSettings),this.addEmitter(a),a):null};SPE.Group.prototype.releaseIntoPool=function(a){return 0==a instanceof SPE.Emitter?void console.error('Argument is not instanceof SPE.Emitter:',a):(a.reset(),this._pool.unshift(a),this)}; -SPE.Group.prototype.getPool=function(){return this._pool};SPE.Group.prototype.addPool=function(a,b,d){this._poolCreationSettings=b;this._createNewWhenPoolEmpty=!!d;for(var c=0;a>c;++c)d=Array.isArray(b)?new SPE.Emitter(b[c]):new SPE.Emitter(b),this.addEmitter(d),this.releaseIntoPool(d);return this}; -SPE.Group.prototype._triggerSingleEmitter=function(a){var b=this.getFromPool(),d=this;return null===b?void console.log('SPE.Group pool ran out.'):(a instanceof THREE.Vector3&&(b.position.value.copy(a),b.position.value=b.position.value),b.enable(),setTimeout(function(){b.disable();d.releaseIntoPool(b)},1E3*Math.max(b.duration,b.maxAge.value+b.maxAge.spread)),this)}; -SPE.Group.prototype.triggerPoolEmitter=function(a,b){if('number'==typeof a&&1d;++d)this._triggerSingleEmitter(b);else this._triggerSingleEmitter(b);return this};SPE.Group.prototype._updateUniforms=function(a){this.uniforms.runTime.value+=a;this.uniforms.deltaTime.value=a};SPE.Group.prototype._resetBufferRanges=function(){var a=this.attributeKeys,b=this.attributeCount-1,d=this.attributes;for(b;0<=b;--b)d[a[b]].resetUpdateRange()}; -SPE.Group.prototype._updateBuffers=function(a){var b=this.attributeKeys,d=this.attributeCount-1,c=this.attributes,g=a.bufferUpdateRanges;for(d;0<=d;--d){var h=b[d];a=g[h];h=c[h];h.setUpdateRange(a.min,a.max);h.flagUpdate()}}; -SPE.Group.prototype.tick=function(a){var b=this.emitters,d=b.length,c=a||this.fixedTimeStep,g=this.attributeKeys,h=this.attributes;if(this._updateUniforms(c),this._resetBufferRanges(),0!==d||!1!==this._attributesNeedRefresh||!1!==this._attributesNeedDynamicReset){for(a=0;d>a;++a){var k=b[a];k.tick(c);this._updateBuffers(k)}if(!0===this._attributesNeedDynamicReset){for(a=this.attributeCount-1;0<=a;--a)h[g[a]].resetDynamic();this._attributesNeedDynamicReset=!1}if(!0===this._attributesNeedRefresh){for(a= -this.attributeCount-1;0<=a;--a)h[g[a]].forceUpdateAll();this._attributesNeedRefresh=!1;this._attributesNeedDynamicReset=!0}}};SPE.Group.prototype.dispose=function(){return this.geometry.dispose(),this.material.dispose(),this}; -SPE.Emitter=function(a){var b=SPE.utils,d=b.types,c=SPE.valueOverLifetimeLength;a=b.ensureTypedArg(a,d.OBJECT,{});a.position=b.ensureTypedArg(a.position,d.OBJECT,{});a.velocity=b.ensureTypedArg(a.velocity,d.OBJECT,{});a.acceleration=b.ensureTypedArg(a.acceleration,d.OBJECT,{});a.radius=b.ensureTypedArg(a.radius,d.OBJECT,{});a.drag=b.ensureTypedArg(a.drag,d.OBJECT,{});a.rotation=b.ensureTypedArg(a.rotation,d.OBJECT,{});a.color=b.ensureTypedArg(a.color,d.OBJECT,{});a.opacity=b.ensureTypedArg(a.opacity, -d.OBJECT,{});a.size=b.ensureTypedArg(a.size,d.OBJECT,{});a.angle=b.ensureTypedArg(a.angle,d.OBJECT,{});a.wiggle=b.ensureTypedArg(a.wiggle,d.OBJECT,{});a.maxAge=b.ensureTypedArg(a.maxAge,d.OBJECT,{});a.onParticleSpawn&&console.warn('onParticleSpawn has been removed. Please set properties directly to alter values at runtime.');this.uuid=THREE.Math.generateUUID();this.type=b.ensureTypedArg(a.type,d.NUMBER,SPE.distributions.BOX);this.position={_value:b.ensureInstanceOf(a.position.value,THREE.Vector3, -new THREE.Vector3),_spread:b.ensureInstanceOf(a.position.spread,THREE.Vector3,new THREE.Vector3),_spreadClamp:b.ensureInstanceOf(a.position.spreadClamp,THREE.Vector3,new THREE.Vector3),_distribution:b.ensureTypedArg(a.position.distribution,d.NUMBER,this.type),_randomise:b.ensureTypedArg(a.position.randomise,d.BOOLEAN,!1),_radius:b.ensureTypedArg(a.position.radius,d.NUMBER,10),_radiusScale:b.ensureInstanceOf(a.position.radiusScale,THREE.Vector3,new THREE.Vector3(1,1,1)),_distributionClamp:b.ensureTypedArg(a.position.distributionClamp, -d.NUMBER,0)};this.velocity={_value:b.ensureInstanceOf(a.velocity.value,THREE.Vector3,new THREE.Vector3),_spread:b.ensureInstanceOf(a.velocity.spread,THREE.Vector3,new THREE.Vector3),_distribution:b.ensureTypedArg(a.velocity.distribution,d.NUMBER,this.type),_randomise:b.ensureTypedArg(a.position.randomise,d.BOOLEAN,!1)};this.acceleration={_value:b.ensureInstanceOf(a.acceleration.value,THREE.Vector3,new THREE.Vector3),_spread:b.ensureInstanceOf(a.acceleration.spread,THREE.Vector3,new THREE.Vector3), -_distribution:b.ensureTypedArg(a.acceleration.distribution,d.NUMBER,this.type),_randomise:b.ensureTypedArg(a.position.randomise,d.BOOLEAN,!1)};this.drag={_value:b.ensureTypedArg(a.drag.value,d.NUMBER,0),_spread:b.ensureTypedArg(a.drag.spread,d.NUMBER,0),_randomise:b.ensureTypedArg(a.position.randomise,d.BOOLEAN,!1)};this.wiggle={_value:b.ensureTypedArg(a.wiggle.value,d.NUMBER,0),_spread:b.ensureTypedArg(a.wiggle.spread,d.NUMBER,0)};this.rotation={_axis:b.ensureInstanceOf(a.rotation.axis,THREE.Vector3, -new THREE.Vector3(0,1,0)),_axisSpread:b.ensureInstanceOf(a.rotation.axisSpread,THREE.Vector3,new THREE.Vector3),_angle:b.ensureTypedArg(a.rotation.angle,d.NUMBER,0),_angleSpread:b.ensureTypedArg(a.rotation.angleSpread,d.NUMBER,0),_static:b.ensureTypedArg(a.rotation['static'],d.BOOLEAN,!1),_center:b.ensureInstanceOf(a.rotation.center,THREE.Vector3,this.position._value.clone()),_randomise:b.ensureTypedArg(a.position.randomise,d.BOOLEAN,!1)};this.maxAge={_value:b.ensureTypedArg(a.maxAge.value,d.NUMBER, -2),_spread:b.ensureTypedArg(a.maxAge.spread,d.NUMBER,0)};this.color={_value:b.ensureArrayInstanceOf(a.color.value,THREE.Color,new THREE.Color),_spread:b.ensureArrayInstanceOf(a.color.spread,THREE.Vector3,new THREE.Vector3),_randomise:b.ensureTypedArg(a.position.randomise,d.BOOLEAN,!1)};this.opacity={_value:b.ensureArrayTypedArg(a.opacity.value,d.NUMBER,1),_spread:b.ensureArrayTypedArg(a.opacity.spread,d.NUMBER,0),_randomise:b.ensureTypedArg(a.position.randomise,d.BOOLEAN,!1)};this.size={_value:b.ensureArrayTypedArg(a.size.value, -d.NUMBER,1),_spread:b.ensureArrayTypedArg(a.size.spread,d.NUMBER,0),_randomise:b.ensureTypedArg(a.position.randomise,d.BOOLEAN,!1)};this.angle={_value:b.ensureArrayTypedArg(a.angle.value,d.NUMBER,0),_spread:b.ensureArrayTypedArg(a.angle.spread,d.NUMBER,0),_randomise:b.ensureTypedArg(a.position.randomise,d.BOOLEAN,!1)};this.particleCount=b.ensureTypedArg(a.particleCount,d.NUMBER,100);this.duration=b.ensureTypedArg(a.duration,d.NUMBER,null);this.isStatic=b.ensureTypedArg(a.isStatic,d.BOOLEAN,!1);this.activeMultiplier= -b.ensureTypedArg(a.activeMultiplier,d.NUMBER,1);this.direction=b.ensureTypedArg(a.direction,d.NUMBER,1);this.alive=b.ensureTypedArg(a.alive,d.BOOLEAN,!0);this.activeParticleCount=this.age=this.attributeEnd=this.attributeOffset=this.activationIndex=this.particlesPerSecond=0;this.paramsArray=this.attributes=this.group=null;this.resetFlags={position:b.ensureTypedArg(a.position.randomise,d.BOOLEAN,!1)||b.ensureTypedArg(a.radius.randomise,d.BOOLEAN,!1),velocity:b.ensureTypedArg(a.velocity.randomise,d.BOOLEAN, -!1),acceleration:b.ensureTypedArg(a.acceleration.randomise,d.BOOLEAN,!1)||b.ensureTypedArg(a.drag.randomise,d.BOOLEAN,!1),rotation:b.ensureTypedArg(a.rotation.randomise,d.BOOLEAN,!1),rotationCenter:b.ensureTypedArg(a.rotation.randomise,d.BOOLEAN,!1),size:b.ensureTypedArg(a.size.randomise,d.BOOLEAN,!1),color:b.ensureTypedArg(a.color.randomise,d.BOOLEAN,!1),opacity:b.ensureTypedArg(a.opacity.randomise,d.BOOLEAN,!1),angle:b.ensureTypedArg(a.angle.randomise,d.BOOLEAN,!1)};this.updateFlags={};this.updateCounts= -{};this.updateMap={maxAge:'params',position:'position',velocity:'velocity',acceleration:'acceleration',drag:'acceleration',wiggle:'params',rotation:'rotation',size:'size',color:'color',opacity:'opacity',angle:'angle'};for(var g in this.updateMap)this.updateMap.hasOwnProperty(g)&&(this.updateCounts[this.updateMap[g]]=0,this.updateFlags[this.updateMap[g]]=!1,this._createGetterSetters(this[g],g));this.bufferUpdateRanges={};this.attributeKeys=null;this.attributeCount=0;b.ensureValueOverLifetimeCompliance(this.color, -c,c);b.ensureValueOverLifetimeCompliance(this.opacity,c,c);b.ensureValueOverLifetimeCompliance(this.size,c,c);b.ensureValueOverLifetimeCompliance(this.angle,c,c)};SPE.Emitter.constructor=SPE.Emitter; -SPE.Emitter.prototype._createGetterSetters=function(a,b){var d=this,c;for(c in a)if(a.hasOwnProperty(c)){var g=c.replace('_','');Object.defineProperty(a,g,{get:function(a){return function(){return this[a]}}(c),set:function(a){return function(c){var g=d.updateMap[b],h=this[a],k=SPE.valueOverLifetimeLength;'_rotationCenter'===a?(d.updateFlags.rotationCenter=!0,d.updateCounts.rotationCenter=0):'_randomise'===a?d.resetFlags[g]=c:(d.updateFlags[g]=!0,d.updateCounts[g]=0);d.group._updateDefines();this[a]= -c;Array.isArray(h)&&SPE.utils.ensureValueOverLifetimeCompliance(d[b],k,k)}}(c)})}};SPE.Emitter.prototype._setBufferUpdateRanges=function(a){this.attributeKeys=a;this.attributeCount=a.length;for(var b=this.attributeCount-1;0<=b;--b)this.bufferUpdateRanges[a[b]]={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY}};SPE.Emitter.prototype._calculatePPSValue=function(a){var b=this.particleCount;this.duration?this.particlesPerSecond=b/(athis.maxParticleCount&&console.warn('SPE.Group: maxParticleCount exceeded. Requesting',this.particleCount,'particles, can support only',this.maxParticleCount);a._calculatePPSValue(a.maxAge._value+a.maxAge._spread);a._setBufferUpdateRanges(this.attributeKeys);a._setAttributeOffset(e);a.group=this;a.attributes=this.attributes;for(var c in b)b.hasOwnProperty(c)&&b[c]._createBufferAttribute(null!==this.maxParticleCount?this.maxParticleCount:this.particleCount); +for(b=e;d>b;++b)a._assignPositionValue(b),a._assignForceValue(b,'velocity'),a._assignForceValue(b,'acceleration'),a._assignAbsLifetimeValue(b,'opacity'),a._assignAbsLifetimeValue(b,'size'),a._assignAngleValue(b),a._assignRotationValue(b),a._assignParamsValue(b),a._assignColorValue(b);return this._applyAttributesToGeometry(),this.emitters.push(a),this.emitterIDs.push(a.uuid),this._updateDefines(a),this.material.needsUpdate=!0,this.geometry.needsUpdate=!0,this._attributesNeedRefresh=!0,this}; +SPE.Group.prototype.removeEmitter=function(a){var b=this.emitterIDs.indexOf(a.uuid);if(0==a instanceof SPE.Emitter)return void console.error('`emitter` argument must be instance of SPE.Emitter. Was provided with:',a);if(-1===b)return void console.error('Emitter does not exist in this group. Will not remove.');for(var e=a.attributeOffset,d=e+a.particleCount,c=this.attributes.params.typedArray,k=e;d>k;++k)c.array[4*k]=0,c.array[4*k+1]=0;this.emitters.splice(b,1);this.emitterIDs.splice(b,1);for(var h in this.attributes)this.attributes.hasOwnProperty(h)&& +this.attributes[h].splice(e,d);this.particleCount-=a.particleCount;a._onRemove();this._attributesNeedRefresh=!0};SPE.Group.prototype.getFromPool=function(){var a=this._pool,b=this._createNewWhenPoolEmpty;return a.length?a.pop():b?(a=new SPE.Emitter(this._poolCreationSettings),this.addEmitter(a),a):null};SPE.Group.prototype.releaseIntoPool=function(a){return 0==a instanceof SPE.Emitter?void console.error('Argument is not instanceof SPE.Emitter:',a):(a.reset(),this._pool.unshift(a),this)}; +SPE.Group.prototype.getPool=function(){return this._pool};SPE.Group.prototype.addPool=function(a,b,e){this._poolCreationSettings=b;this._createNewWhenPoolEmpty=!!e;for(var d=0;a>d;++d)e=Array.isArray(b)?new SPE.Emitter(b[d]):new SPE.Emitter(b),this.addEmitter(e),this.releaseIntoPool(e);return this}; +SPE.Group.prototype._triggerSingleEmitter=function(a){var b=this.getFromPool(),e=this;return null===b?void console.log('SPE.Group pool ran out.'):(a instanceof THREE.Vector3&&(b.position.value.copy(a),b.position.value=b.position.value),b.enable(),setTimeout(function(){b.disable();e.releaseIntoPool(b)},1E3*Math.max(b.duration,b.maxAge.value+b.maxAge.spread)),this)}; +SPE.Group.prototype.triggerPoolEmitter=function(a,b){if('number'==typeof a&&1e;++e)this._triggerSingleEmitter(b);else this._triggerSingleEmitter(b);return this};SPE.Group.prototype._updateUniforms=function(a){this.uniforms.runTime.value+=a;this.uniforms.deltaTime.value=a};SPE.Group.prototype._resetBufferRanges=function(){var a=this.attributeKeys,b=this.attributeCount-1,e=this.attributes;for(b;0<=b;--b)e[a[b]].resetUpdateRange()}; +SPE.Group.prototype._updateBuffers=function(a){var b=this.attributeKeys,e=this.attributeCount-1,d=this.attributes,c=a.bufferUpdateRanges;for(e;0<=e;--e){var k=b[e];a=c[k];k=d[k];k.setUpdateRange(a.min,a.max);k.flagUpdate()}}; +SPE.Group.prototype.tick=function(a){var b=this.emitters,e=b.length,d=a||this.fixedTimeStep,c=this.attributeKeys,k=this.attributes;if(this._updateUniforms(d),this._resetBufferRanges(),0!==e||!1!==this._attributesNeedRefresh||!1!==this._attributesNeedDynamicReset){for(a=0;e>a;++a){var h=b[a];h.tick(d);this._updateBuffers(h)}if(!0===this._attributesNeedDynamicReset){for(a=this.attributeCount-1;0<=a;--a)k[c[a]].resetDynamic();this._attributesNeedDynamicReset=!1}if(!0===this._attributesNeedRefresh){for(a= +this.attributeCount-1;0<=a;--a)k[c[a]].forceUpdateAll();this._attributesNeedRefresh=!1;this._attributesNeedDynamicReset=!0}}};SPE.Group.prototype.dispose=function(){return this.geometry.dispose(),this.material.dispose(),this}; +SPE.Emitter=function(a){var b=SPE.utils,e=b.types,d=SPE.valueOverLifetimeLength;a=b.ensureTypedArg(a,e.OBJECT,{});a.position=b.ensureTypedArg(a.position,e.OBJECT,{});a.velocity=b.ensureTypedArg(a.velocity,e.OBJECT,{});a.acceleration=b.ensureTypedArg(a.acceleration,e.OBJECT,{});a.radius=b.ensureTypedArg(a.radius,e.OBJECT,{});a.drag=b.ensureTypedArg(a.drag,e.OBJECT,{});a.rotation=b.ensureTypedArg(a.rotation,e.OBJECT,{});a.color=b.ensureTypedArg(a.color,e.OBJECT,{});a.opacity=b.ensureTypedArg(a.opacity, +e.OBJECT,{});a.size=b.ensureTypedArg(a.size,e.OBJECT,{});a.angle=b.ensureTypedArg(a.angle,e.OBJECT,{});a.wiggle=b.ensureTypedArg(a.wiggle,e.OBJECT,{});a.maxAge=b.ensureTypedArg(a.maxAge,e.OBJECT,{});a.onParticleSpawn&&console.warn('onParticleSpawn has been removed. Please set properties directly to alter values at runtime.');this.uuid=THREE.Math.generateUUID();this.type=b.ensureTypedArg(a.type,e.NUMBER,SPE.distributions.BOX);this.position={_value:b.ensureInstanceOf(a.position.value,THREE.Vector3, +new THREE.Vector3),_spread:b.ensureInstanceOf(a.position.spread,THREE.Vector3,new THREE.Vector3),_spreadClamp:b.ensureInstanceOf(a.position.spreadClamp,THREE.Vector3,new THREE.Vector3),_distribution:b.ensureTypedArg(a.position.distribution,e.NUMBER,this.type),_randomise:b.ensureTypedArg(a.position.randomise,e.BOOLEAN,!1),_radius:b.ensureTypedArg(a.position.radius,e.NUMBER,10),_radiusScale:b.ensureInstanceOf(a.position.radiusScale,THREE.Vector3,new THREE.Vector3(1,1,1)),_distributionClamp:b.ensureTypedArg(a.position.distributionClamp, +e.NUMBER,0)};this.velocity={_value:b.ensureInstanceOf(a.velocity.value,THREE.Vector3,new THREE.Vector3),_spread:b.ensureInstanceOf(a.velocity.spread,THREE.Vector3,new THREE.Vector3),_distribution:b.ensureTypedArg(a.velocity.distribution,e.NUMBER,this.type),_randomise:b.ensureTypedArg(a.position.randomise,e.BOOLEAN,!1)};this.acceleration={_value:b.ensureInstanceOf(a.acceleration.value,THREE.Vector3,new THREE.Vector3),_spread:b.ensureInstanceOf(a.acceleration.spread,THREE.Vector3,new THREE.Vector3), +_distribution:b.ensureTypedArg(a.acceleration.distribution,e.NUMBER,this.type),_randomise:b.ensureTypedArg(a.position.randomise,e.BOOLEAN,!1)};this.drag={_value:b.ensureTypedArg(a.drag.value,e.NUMBER,0),_spread:b.ensureTypedArg(a.drag.spread,e.NUMBER,0),_randomise:b.ensureTypedArg(a.position.randomise,e.BOOLEAN,!1)};this.wiggle={_value:b.ensureTypedArg(a.wiggle.value,e.NUMBER,0),_spread:b.ensureTypedArg(a.wiggle.spread,e.NUMBER,0)};this.rotation={_axis:b.ensureInstanceOf(a.rotation.axis,THREE.Vector3, +new THREE.Vector3(0,1,0)),_axisSpread:b.ensureInstanceOf(a.rotation.axisSpread,THREE.Vector3,new THREE.Vector3),_angle:b.ensureTypedArg(a.rotation.angle,e.NUMBER,0),_angleSpread:b.ensureTypedArg(a.rotation.angleSpread,e.NUMBER,0),_static:b.ensureTypedArg(a.rotation['static'],e.BOOLEAN,!1),_center:b.ensureInstanceOf(a.rotation.center,THREE.Vector3,this.position._value.clone()),_randomise:b.ensureTypedArg(a.position.randomise,e.BOOLEAN,!1)};this.maxAge={_value:b.ensureTypedArg(a.maxAge.value,e.NUMBER, +2),_spread:b.ensureTypedArg(a.maxAge.spread,e.NUMBER,0)};this.color={_value:b.ensureArrayInstanceOf(a.color.value,THREE.Color,new THREE.Color),_spread:b.ensureArrayInstanceOf(a.color.spread,THREE.Vector3,new THREE.Vector3),_randomise:b.ensureTypedArg(a.position.randomise,e.BOOLEAN,!1)};this.opacity={_value:b.ensureArrayTypedArg(a.opacity.value,e.NUMBER,1),_spread:b.ensureArrayTypedArg(a.opacity.spread,e.NUMBER,0),_randomise:b.ensureTypedArg(a.position.randomise,e.BOOLEAN,!1)};this.size={_value:b.ensureArrayTypedArg(a.size.value, +e.NUMBER,1),_spread:b.ensureArrayTypedArg(a.size.spread,e.NUMBER,0),_randomise:b.ensureTypedArg(a.position.randomise,e.BOOLEAN,!1)};this.angle={_value:b.ensureArrayTypedArg(a.angle.value,e.NUMBER,0),_spread:b.ensureArrayTypedArg(a.angle.spread,e.NUMBER,0),_randomise:b.ensureTypedArg(a.position.randomise,e.BOOLEAN,!1)};this.particleCount=b.ensureTypedArg(a.particleCount,e.NUMBER,100);this.duration=b.ensureTypedArg(a.duration,e.NUMBER,null);this.isStatic=b.ensureTypedArg(a.isStatic,e.BOOLEAN,!1);this.activeMultiplier= +b.ensureTypedArg(a.activeMultiplier,e.NUMBER,1);this.direction=b.ensureTypedArg(a.direction,e.NUMBER,1);this.alive=b.ensureTypedArg(a.alive,e.BOOLEAN,!0);this.activeParticleCount=this.age=this.attributeEnd=this.attributeOffset=this.activationIndex=this.particlesPerSecond=0;this.paramsArray=this.attributes=this.group=null;this.resetFlags={position:b.ensureTypedArg(a.position.randomise,e.BOOLEAN,!1)||b.ensureTypedArg(a.radius.randomise,e.BOOLEAN,!1),velocity:b.ensureTypedArg(a.velocity.randomise,e.BOOLEAN, +!1),acceleration:b.ensureTypedArg(a.acceleration.randomise,e.BOOLEAN,!1)||b.ensureTypedArg(a.drag.randomise,e.BOOLEAN,!1),rotation:b.ensureTypedArg(a.rotation.randomise,e.BOOLEAN,!1),rotationCenter:b.ensureTypedArg(a.rotation.randomise,e.BOOLEAN,!1),size:b.ensureTypedArg(a.size.randomise,e.BOOLEAN,!1),color:b.ensureTypedArg(a.color.randomise,e.BOOLEAN,!1),opacity:b.ensureTypedArg(a.opacity.randomise,e.BOOLEAN,!1),angle:b.ensureTypedArg(a.angle.randomise,e.BOOLEAN,!1)};this.updateFlags={};this.updateCounts= +{};this.updateMap={maxAge:'params',position:'position',velocity:'velocity',acceleration:'acceleration',drag:'acceleration',wiggle:'params',rotation:'rotation',size:'size',color:'color',opacity:'opacity',angle:'angle'};for(var c in this.updateMap)this.updateMap.hasOwnProperty(c)&&(this.updateCounts[this.updateMap[c]]=0,this.updateFlags[this.updateMap[c]]=!1,this._createGetterSetters(this[c],c));this.bufferUpdateRanges={};this.attributeKeys=null;this.attributeCount=0;b.ensureValueOverLifetimeCompliance(this.color, +d,d);b.ensureValueOverLifetimeCompliance(this.opacity,d,d);b.ensureValueOverLifetimeCompliance(this.size,d,d);b.ensureValueOverLifetimeCompliance(this.angle,d,d)};SPE.Emitter.constructor=SPE.Emitter; +SPE.Emitter.prototype._createGetterSetters=function(a,b){var e=this,d;for(d in a)if(a.hasOwnProperty(d)){var c=d.replace('_','');Object.defineProperty(a,c,{get:function(a){return function(){return this[a]}}(d),set:function(a){return function(c){var d=e.updateMap[b],h=this[a],k=SPE.valueOverLifetimeLength;'_rotationCenter'===a?(e.updateFlags.rotationCenter=!0,e.updateCounts.rotationCenter=0):'_randomise'===a?e.resetFlags[d]=c:(e.updateFlags[d]=!0,e.updateCounts[d]=0);e.group._updateDefines();this[a]= +c;Array.isArray(h)&&SPE.utils.ensureValueOverLifetimeCompliance(e[b],k,k)}}(d)})}};SPE.Emitter.prototype._setBufferUpdateRanges=function(a){this.attributeKeys=a;this.attributeCount=a.length;for(var b=this.attributeCount-1;0<=b;--b)this.bufferUpdateRanges[a[b]]={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY}};SPE.Emitter.prototype._calculatePPSValue=function(a){var b=this.particleCount;this.duration?this.particlesPerSecond=b/(a=a;--l)b=4*l,k=d[b],0!==k&&(h=d[b+1],g=d[b+2],1===this.direction?(h+=c,h>=g&&(h=0,k=0,this._decrementParticleCount())):(h-=c,0>=h&&(h=g,k=0,this._decrementParticleCount())),d[b]=k,d[b+1]=h,this._updateAttributeUpdateRange('params',l))}; -SPE.Emitter.prototype._activateParticles=function(a,b,d,c){for(var g,h,k=this.direction,l=a;b>l;++l)g=4*l,0!=d[g]&&1!==this.particleCount||(this._incrementParticleCount(),d[g]=1,this._resetParticle(l),h=c*(l-a),d[g+1]=-1===k?d[g+2]-h:h,this._updateAttributeUpdateRange('params',l))}; -SPE.Emitter.prototype.tick=function(a){if(!this.isStatic){null===this.paramsArray&&(this.paramsArray=this.attributes.params.typedArray.array);var b=this.attributeOffset,d=b+this.particleCount,c=this.paramsArray,g=this.particlesPerSecond*this.activeMultiplier*a,h=this.activationIndex;if(this._resetBufferRanges(),this._checkParticleAges(b,d,c,a),!1===this.alive)return void(this.age=0);if(null!==this.duration&&this.age>this.duration)return this.alive=!1,void(this.age=0);h=1===this.particleCount?h:0| -h;var k=Math.min(h+g,this.activationEnd),l=k-this.activationIndex|0;this._activateParticles(h,k,c,0d&&(this.activationIndex=b);this.age+=a}};SPE.Emitter.prototype.reset=function(a){if(this.age=0,this.alive=!1,!0===a){for(var b=this.attributeOffset,d=this.paramsArray,c=this.attributes.params.bufferAttribute,g=b+this.particleCount-1;g>=b;--g)a=4*g,d[a]=0,d[a+1]=0;c.updateRange.offset=0;c.updateRange.count=-1;c.needsUpdate=!0}return this}; +SPE.Emitter.prototype._resetParticle=function(a){for(var b,e,d=this.resetFlags,c=this.updateFlags,k=this.updateCounts,h=this.attributeKeys,l=this.attributeCount-1;0<=l;--l)b=h[l],e=c[b],!0!==d[b]&&!0!==e||(this._assignValue(b,a),this._updateAttributeUpdateRange(b,a),!0===e&&k[b]===this.particleCount?(c[b]=!1,k[b]=0):1==e&&++k[b])};SPE.Emitter.prototype._updateAttributeUpdateRange=function(a,b){a=this.bufferUpdateRanges[a];a.min=Math.min(b,a.min);a.max=Math.max(b,a.max)}; +SPE.Emitter.prototype._resetBufferRanges=function(){var a=this.bufferUpdateRanges,b=this.bufferUpdateKeys,e=this.bufferUpdateCount-1;for(e;0<=e;--e){var d=b[e];a[d].min=Number.POSITIVE_INFINITY;a[d].max=Number.NEGATIVE_INFINITY}};SPE.Emitter.prototype._onRemove=function(){this.activeParticleCount=this.activationIndex=this.attributeOffset=this.particlesPerSecond=0;this.paramsArray=this.attributes=this.group=null;this.age=0};SPE.Emitter.prototype._decrementParticleCount=function(){--this.activeParticleCount}; +SPE.Emitter.prototype._incrementParticleCount=function(){++this.activeParticleCount};SPE.Emitter.prototype._checkParticleAges=function(a,b,e,d){for(var c,k,h,l=b-1;l>=a;--l)b=4*l,h=e[b],0!==h&&(k=e[b+1],c=e[b+2],1===this.direction?(k+=d,k>=c&&(k=0,h=0,this._decrementParticleCount())):(k-=d,0>=k&&(k=c,h=0,this._decrementParticleCount())),e[b]=h,e[b+1]=k,this._updateAttributeUpdateRange('params',l))}; +SPE.Emitter.prototype._activateParticles=function(a,b,e,d){for(var c,k,h=this.direction,l=a;b>l;++l)c=4*l,0!=e[c]&&1!==this.particleCount||(this._incrementParticleCount(),e[c]=1,this._resetParticle(l),k=d*(l-a),e[c+1]=-1===h?e[c+2]-k:k,this._updateAttributeUpdateRange('params',l))}; +SPE.Emitter.prototype.tick=function(a){if(!this.isStatic){null===this.paramsArray&&(this.paramsArray=this.attributes.params.typedArray.array);var b=this.attributeOffset,e=b+this.particleCount,d=this.paramsArray,c=this.particlesPerSecond*this.activeMultiplier*a,k=this.activationIndex;if(this._resetBufferRanges(),this._checkParticleAges(b,e,d,a),!1===this.alive)return void(this.age=0);if(null!==this.duration&&this.age>this.duration)return this.alive=!1,void(this.age=0);k=1===this.particleCount?k:0| +k;var h=Math.min(k+c,this.activationEnd),l=h-this.activationIndex|0;this._activateParticles(k,h,d,0e&&(this.activationIndex=b);this.age+=a}};SPE.Emitter.prototype.reset=function(a){if(this.age=0,this.alive=!1,!0===a){for(var b=this.attributeOffset,e=this.paramsArray,d=this.attributes.params.bufferAttribute,c=b+this.particleCount-1;c>=b;--c)a=4*c,e[a]=0,e[a+1]=0;d.updateRange.offset=0;d.updateRange.count=-1;d.needsUpdate=!0}return this}; SPE.Emitter.prototype.enable=function(){return this.alive=!0,this};SPE.Emitter.prototype.disable=function(){return this.alive=!1,this};SPE.Emitter.prototype.remove=function(){return null!==this.group?this.group.removeEmitter(this):console.error('Emitter does not belong to a group, cannot remove.'),this}; -var __extends=this&&this.__extends||function(a,b){function d(){this.constructor=a}for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);a.prototype=null===b?Object.create(b):(d.prototype=b.prototype,new d)},spine; -(function(a){var b=function(){function a(a,b,c){if(null==a)throw Error('name cannot be null.');if(null==b)throw Error('timelines cannot be null.');this.name=a;this.timelines=b;this.duration=c}a.prototype.apply=function(a,b,c,d,g,h,k,l){if(null==a)throw Error('skeleton cannot be null.');d&&0!=this.duration&&(c%=this.duration,0>>1;;){a[(g+1)*c]<=b?e=g+1:d=g;if(e==d)return(e+1)*c;g=e+d>>>1}};a.linearSearch=function(a,b,c){for(var e=0,d=a.length-c;e<=d;e+=c)if(a[e]>b)return e;return-1};return a}();a.Animation=b;(function(a){a[a.setup=0]='setup';a[a.current=1]='current';a[a.currentLayered=2]='currentLayered'})(a.MixPose||(a.MixPose={}));var d=a.MixPose;(function(a){a[a['in']=0]='in';a[a.out=1]='out'})(a.MixDirection||(a.MixDirection={}));var c=a.MixDirection;(function(a){a[a.rotate=0]='rotate';a[a.translate= -1]='translate';a[a.scale=2]='scale';a[a.shear=3]='shear';a[a.attachment=4]='attachment';a[a.color=5]='color';a[a.deform=6]='deform';a[a.event=7]='event';a[a.drawOrder=8]='drawOrder';a[a.ikConstraint=9]='ikConstraint';a[a.transformConstraint=10]='transformConstraint';a[a.pathConstraintPosition=11]='pathConstraintPosition';a[a.pathConstraintSpacing=12]='pathConstraintSpacing';a[a.pathConstraintMix=13]='pathConstraintMix';a[a.twoColor=14]='twoColor'})(a.TimelineType||(a.TimelineType={}));var g=a.TimelineType, -h=function(){function b(c){if(0>=c)throw Error('frameCount must be > 0: '+c);this.curves=a.Utils.newFloatArray((c-1)*b.BEZIER_SIZE)}b.prototype.getFrameCount=function(){return this.curves.length/b.BEZIER_SIZE+1};b.prototype.setLinear=function(a){this.curves[a*b.BEZIER_SIZE]=b.LINEAR};b.prototype.setStepped=function(a){this.curves[a*b.BEZIER_SIZE]=b.STEPPED};b.prototype.getCurveType=function(a){a*=b.BEZIER_SIZE;if(a==this.curves.length)return b.LINEAR;a=this.curves[a];return a==b.LINEAR?b.LINEAR:a== -b.STEPPED?b.STEPPED:b.BEZIER};b.prototype.setCurve=function(a,c,d,g,h){var e=.03*(2*-c+g),k=.03*(2*-d+h);g=.006*(3*(c-g)+1);h=.006*(3*(d-h)+1);var l=2*e+g,m=2*k+h;c=.3*c+e+.16666667*g;d=.3*d+k+.16666667*h;a*=b.BEZIER_SIZE;k=this.curves;k[a++]=b.BEZIER;e=c;for(var p=d,n=a+b.BEZIER_SIZE-1;a=e)return c==h?k=h=0:(h=d[c-2],k=d[c-1]),k+(d[c+1]-k)*(e-h)/(g-h);d=d[c-1];return d+(1-d)*(e-g)/(1-g)};b.LINEAR=0;b.STEPPED=1;b.BEZIER=2;b.BEZIER_SIZE=19;return b}();a.CurveTimeline=h;var k=function(c){function h(b){c.call(this,b);this.frames=a.Utils.newFloatArray(b<<1)}__extends(h,c);h.prototype.getPropertyId=function(){return(g.rotate<<24)+this.boneIndex};h.prototype.setFrame=function(a,b,c){a<<=1;this.frames[a]=b;this.frames[a+h.ROTATION]= -c};h.prototype.apply=function(a,c,g,k,l,m,p){c=this.frames;a=a.bones[this.boneIndex];if(g=c[c.length-h.ENTRIES])m==d.setup?a.rotation=a.data.rotation+c[c.length+h.PREV_ROTATION]*l:(m=a.data.rotation+c[c.length+h.PREV_ROTATION]-a.rotation,a.rotation+=(m-360*(16384-(16384.499999999996-m/360|0)))*l);else{p=b.binarySearch(c,g,h.ENTRIES); -k=c[p+h.PREV_ROTATION];var e=c[p];g=this.getCurvePercent((p>>1)-1,1-(g-e)/(c[p+h.PREV_TIME]-e));c=c[p+h.ROTATION]-k;c=k+(c-360*(16384-(16384.499999999996-c/360|0)))*g;m==d.setup?a.rotation=a.data.rotation+(c-360*(16384-(16384.499999999996-c/360|0)))*l:(c=a.data.rotation+c-a.rotation,a.rotation+=(c-360*(16384-(16384.499999999996-c/360|0)))*l)}};h.ENTRIES=2;h.PREV_TIME=-2;h.PREV_ROTATION=-1;h.ROTATION=1;return h}(h);a.RotateTimeline=k;k=function(c){function h(b){c.call(this,b);this.frames=a.Utils.newFloatArray(b* -h.ENTRIES)}__extends(h,c);h.prototype.getPropertyId=function(){return(g.translate<<24)+this.boneIndex};h.prototype.setFrame=function(a,b,c,d){a*=h.ENTRIES;this.frames[a]=b;this.frames[a+h.X]=c;this.frames[a+h.Y]=d};h.prototype.apply=function(a,c,g,k,l,m,p){c=this.frames;a=a.bones[this.boneIndex];if(g=c[c.length-h.ENTRIES])k=c[c.length+h.PREV_X],p=c[c.length+h.PREV_Y];else{var e= -b.binarySearch(c,g,h.ENTRIES);k=c[e+h.PREV_X];p=c[e+h.PREV_Y];var n=c[e];g=this.getCurvePercent(e/h.ENTRIES-1,1-(g-n)/(c[e+h.PREV_TIME]-n));k+=(c[e+h.X]-k)*g;p+=(c[e+h.Y]-p)*g}m==d.setup?(a.x=a.data.x+k*l,a.y=a.data.y+p*l):(a.x+=(a.data.x+k-a.x)*l,a.y+=(a.data.y+p-a.y)*l)}};h.ENTRIES=3;h.PREV_TIME=-3;h.PREV_X=-2;h.PREV_Y=-1;h.X=1;h.Y=2;return h}(h);a.TranslateTimeline=k;var l=function(h){function k(a){h.call(this,a)}__extends(k,h);k.prototype.getPropertyId=function(){return(g.scale<<24)+this.boneIndex}; -k.prototype.apply=function(e,g,h,l,m,p,q){var n=this.frames;e=e.bones[this.boneIndex];if(h=n[n.length-k.ENTRIES])g=n[n.length+k.PREV_X]*e.data.scaleX,l=n[n.length+k.PREV_Y]*e.data.scaleY;else{var r=b.binarySearch(n,h,k.ENTRIES);g=n[r+k.PREV_X];l=n[r+k.PREV_Y];var t=n[r];h=this.getCurvePercent(r/k.ENTRIES-1,1-(h-t)/(n[r+ -k.PREV_TIME]-t));g=(g+(n[r+k.X]-g)*h)*e.data.scaleX;l=(l+(n[r+k.Y]-l)*h)*e.data.scaleY}1==m?(e.scaleX=g,e.scaleY=l):(p==d.setup?(p=e.data.scaleX,h=e.data.scaleY):(p=e.scaleX,h=e.scaleY),q==c.out?(g=Math.abs(g)*a.MathUtils.signum(p),l=Math.abs(l)*a.MathUtils.signum(h)):(p=Math.abs(p)*a.MathUtils.signum(g),h=Math.abs(h)*a.MathUtils.signum(l)),e.scaleX=p+(g-p)*m,e.scaleY=h+(l-h)*m)}};return k}(k);a.ScaleTimeline=l;k=function(a){function c(b){a.call(this,b)}__extends(c,a);c.prototype.getPropertyId=function(){return(g.shear<< -24)+this.boneIndex};c.prototype.apply=function(a,g,h,k,l,m,p){g=this.frames;a=a.bones[this.boneIndex];if(h=g[g.length-c.ENTRIES])k=g[g.length+c.PREV_X],p=g[g.length+c.PREV_Y];else{var e=b.binarySearch(g,h,c.ENTRIES);k=g[e+c.PREV_X];p=g[e+c.PREV_Y];var n=g[e];h=this.getCurvePercent(e/c.ENTRIES-1,1-(h-n)/(g[e+c.PREV_TIME]- -n));k+=(g[e+c.X]-k)*h;p+=(g[e+c.Y]-p)*h}m==d.setup?(a.shearX=a.data.shearX+k*l,a.shearY=a.data.shearY+p*l):(a.shearX+=(a.data.shearX+k-a.shearX)*l,a.shearY+=(a.data.shearY+p-a.shearY)*l)}};return c}(k);a.ShearTimeline=k;k=function(c){function h(b){c.call(this,b);this.frames=a.Utils.newFloatArray(b*h.ENTRIES)}__extends(h,c);h.prototype.getPropertyId=function(){return(g.color<<24)+this.slotIndex};h.prototype.setFrame=function(a,b,c,d,g,k){a*=h.ENTRIES;this.frames[a]=b;this.frames[a+h.R]=c;this.frames[a+ -h.G]=d;this.frames[a+h.B]=g;this.frames[a+h.A]=k};h.prototype.apply=function(a,c,g,k,l,m,p){a=a.slots[this.slotIndex];var e=this.frames;if(g=e[e.length-h.ENTRIES]){g=e.length;c=e[g+h.PREV_R];k=e[g+h.PREV_G];p=e[g+h.PREV_B];var n=e[g+h.PREV_A]}else{var q=b.binarySearch(e,g,h.ENTRIES);c=e[q+h.PREV_R];k=e[q+h.PREV_G];p=e[q+h.PREV_B]; -n=e[q+h.PREV_A];var r=e[q];g=this.getCurvePercent(q/h.ENTRIES-1,1-(g-r)/(e[q+h.PREV_TIME]-r));c+=(e[q+h.R]-c)*g;k+=(e[q+h.G]-k)*g;p+=(e[q+h.B]-p)*g;n+=(e[q+h.A]-n)*g}1==l?a.color.set(c,k,p,n):(g=a.color,m==d.setup&&g.setFromColor(a.data.color),g.add((c-g.r)*l,(k-g.g)*l,(p-g.b)*l,(n-g.a)*l))}};h.ENTRIES=5;h.PREV_TIME=-5;h.PREV_R=-4;h.PREV_G=-3;h.PREV_B=-2;h.PREV_A=-1;h.R=1;h.G=2;h.B=3;h.A=4;return h}(h);a.ColorTimeline=k;k=function(c){function h(b){c.call(this,b);this.frames=a.Utils.newFloatArray(b* -h.ENTRIES)}__extends(h,c);h.prototype.getPropertyId=function(){return(g.twoColor<<24)+this.slotIndex};h.prototype.setFrame=function(a,b,c,d,g,k,l,m,p){a*=h.ENTRIES;this.frames[a]=b;this.frames[a+h.R]=c;this.frames[a+h.G]=d;this.frames[a+h.B]=g;this.frames[a+h.A]=k;this.frames[a+h.R2]=l;this.frames[a+h.G2]=m;this.frames[a+h.B2]=p};h.prototype.apply=function(a,c,g,k,l,m,p){a=a.slots[this.slotIndex];var e=this.frames;if(g=e[e.length-h.ENTRIES]){g=e.length;c=e[g+h.PREV_R];k=e[g+h.PREV_G];p=e[g+h.PREV_B];var n=e[g+h.PREV_A];var q=e[g+h.PREV_R2];var r=e[g+h.PREV_G2];var t=e[g+h.PREV_B2]}else{var u=b.binarySearch(e,g,h.ENTRIES);c=e[u+h.PREV_R];k=e[u+h.PREV_G];p=e[u+h.PREV_B];n=e[u+h.PREV_A];q=e[u+h.PREV_R2];r=e[u+h.PREV_G2];t=e[u+h.PREV_B2]; -var C=e[u];g=this.getCurvePercent(u/h.ENTRIES-1,1-(g-C)/(e[u+h.PREV_TIME]-C));c+=(e[u+h.R]-c)*g;k+=(e[u+h.G]-k)*g;p+=(e[u+h.B]-p)*g;n+=(e[u+h.A]-n)*g;q+=(e[u+h.R2]-q)*g;r+=(e[u+h.G2]-r)*g;t+=(e[u+h.B2]-t)*g}1==l?(a.color.set(c,k,p,n),a.darkColor.set(q,r,t,1)):(g=a.color,e=a.darkColor,m==d.setup&&(g.setFromColor(a.data.color),e.setFromColor(a.data.darkColor)),g.add((c-g.r)*l,(k-g.g)*l,(p-g.b)*l,(n-g.a)*l),e.add((q-e.r)*l,(r-e.g)*l,(t-e.b)*l,0))}};h.ENTRIES=8;h.PREV_TIME=-8;h.PREV_R=-7;h.PREV_G=-6; -h.PREV_B=-5;h.PREV_A=-4;h.PREV_R2=-3;h.PREV_G2=-2;h.PREV_B2=-1;h.R=1;h.G=2;h.B=3;h.A=4;h.R2=5;h.G2=6;h.B2=7;return h}(h);a.TwoColorTimeline=k;k=function(){function h(b){this.frames=a.Utils.newFloatArray(b);this.attachmentNames=Array(b)}h.prototype.getPropertyId=function(){return(g.attachment<<24)+this.slotIndex};h.prototype.getFrameCount=function(){return this.frames.length};h.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.attachmentNames[a]=c};h.prototype.apply=function(a,e,g,h,k,l,m){e= -a.slots[this.slotIndex];m==c.out&&l==d.setup?(g=e.data.attachmentName,e.setAttachment(null==g?null:a.getAttachment(this.slotIndex,g))):(m=this.frames,g=m[m.length-1]?m.length-1:b.binarySearch(m,g,1)-1,g=this.attachmentNames[g],a.slots[this.slotIndex].setAttachment(null==g?null:a.getAttachment(this.slotIndex,g))))};return h}();a.AttachmentTimeline=k;var m=null;k=function(c){function h(b){c.call(this, -b);this.frames=a.Utils.newFloatArray(b);this.frameVertices=Array(b);null==m&&(m=a.Utils.newFloatArray(64))}__extends(h,c);h.prototype.getPropertyId=function(){return(g.deform<<27)+ +this.attachment.id+this.slotIndex};h.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.frameVertices[a]=c};h.prototype.apply=function(c,g,h,k,l,m,p){c=c.slots[this.slotIndex];var e=c.getAttachment();if(e instanceof a.VertexAttachment&&e.applyDeform(this.attachment)){g=c.attachmentVertices;0==g.length&&(l=1);p=this.frameVertices; -c=p[0].length;var n=this.frames;if(h=n[n.length-1])if(k=p[n.length-1],1==l)a.Utils.arrayCopy(k,0,g,0,c);else if(m==d.setup)if(null==e.bones)for(p=e.vertices,h=0;hd)this.apply(a,c,Number.MAX_VALUE,g,h,k,l),c=-1;else if(c>=e[m-1])return;if(!(d=e[a];a++)g.push(this.events[a])}}};return c}();a.EventTimeline= -k;k=function(){function h(b){this.frames=a.Utils.newFloatArray(b);this.drawOrders=Array(b)}h.prototype.getPropertyId=function(){return g.drawOrder<<24};h.prototype.getFrameCount=function(){return this.frames.length};h.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.drawOrders[a]=c};h.prototype.apply=function(g,e,h,k,l,m,q){e=g.drawOrder;k=g.slots;if(q==c.out&&m==d.setup)a.Utils.arrayCopy(g.slots,0,g.drawOrder,0,g.slots.length);else if(q=this.frames,h=q[q.length-1]?q.length-1:b.binarySearch(q,h)-1,g=this.drawOrders[g],null==g)a.Utils.arrayCopy(k,0,e,0,k.length);else for(h=0,m=g.length;h=g[g.length-k.ENTRIES])p==d.setup?(a.mix=a.data.mix+(g[g.length+k.PREV_MIX]-a.data.mix)*m,a.bendDirection=q==c.out?a.data.bendDirection:g[g.length+k.PREV_BEND_DIRECTION]):(a.mix+= -(g[g.length+k.PREV_MIX]-a.mix)*m,q==c.in&&(a.bendDirection=g[g.length+k.PREV_BEND_DIRECTION]));else{l=b.binarySearch(g,h,k.ENTRIES);var e=g[l+k.PREV_MIX],n=g[l];h=this.getCurvePercent(l/k.ENTRIES-1,1-(h-n)/(g[l+k.PREV_TIME]-n));p==d.setup?(a.mix=a.data.mix+(e+(g[l+k.MIX]-e)*h-a.data.mix)*m,a.bendDirection=q==c.out?a.data.bendDirection:g[l+k.PREV_BEND_DIRECTION]):(a.mix+=(e+(g[l+k.MIX]-e)*h-a.mix)*m,q==c.in&&(a.bendDirection=g[l+k.PREV_BEND_DIRECTION]))}};k.ENTRIES=3;k.PREV_TIME=-3;k.PREV_MIX=-2;k.PREV_BEND_DIRECTION= --1;k.MIX=1;k.BEND_DIRECTION=2;return k}(h);a.IkConstraintTimeline=k;k=function(c){function h(b){c.call(this,b);this.frames=a.Utils.newFloatArray(b*h.ENTRIES)}__extends(h,c);h.prototype.getPropertyId=function(){return(g.transformConstraint<<24)+this.transformConstraintIndex};h.prototype.setFrame=function(a,b,c,d,g,k){a*=h.ENTRIES;this.frames[a]=b;this.frames[a+h.ROTATE]=c;this.frames[a+h.TRANSLATE]=d;this.frames[a+h.SCALE]=g;this.frames[a+h.SHEAR]=k};h.prototype.apply=function(a,c,g,k,l,m,p){c=this.frames; -a=a.transformConstraints[this.transformConstraintIndex];if(g=c[c.length-h.ENTRIES]){g=c.length;k=c[g+h.PREV_ROTATE];p=c[g+h.PREV_TRANSLATE];var e=c[g+h.PREV_SCALE];var n= -c[g+h.PREV_SHEAR]}else{var q=b.binarySearch(c,g,h.ENTRIES);k=c[q+h.PREV_ROTATE];p=c[q+h.PREV_TRANSLATE];e=c[q+h.PREV_SCALE];n=c[q+h.PREV_SHEAR];var r=c[q];g=this.getCurvePercent(q/h.ENTRIES-1,1-(g-r)/(c[q+h.PREV_TIME]-r));k+=(c[q+h.ROTATE]-k)*g;p+=(c[q+h.TRANSLATE]-p)*g;e+=(c[q+h.SCALE]-e)*g;n+=(c[q+h.SHEAR]-n)*g}m==d.setup?(g=a.data,a.rotateMix=g.rotateMix+(k-g.rotateMix)*l,a.translateMix=g.translateMix+(p-g.translateMix)*l,a.scaleMix=g.scaleMix+(e-g.scaleMix)*l,a.shearMix=g.shearMix+(n-g.shearMix)* -l):(a.rotateMix+=(k-a.rotateMix)*l,a.translateMix+=(p-a.translateMix)*l,a.scaleMix+=(e-a.scaleMix)*l,a.shearMix+=(n-a.shearMix)*l)}};h.ENTRIES=5;h.PREV_TIME=-5;h.PREV_ROTATE=-4;h.PREV_TRANSLATE=-3;h.PREV_SCALE=-2;h.PREV_SHEAR=-1;h.ROTATE=1;h.TRANSLATE=2;h.SCALE=3;h.SHEAR=4;return h}(h);a.TransformConstraintTimeline=k;k=function(c){function h(b){c.call(this,b);this.frames=a.Utils.newFloatArray(b*h.ENTRIES)}__extends(h,c);h.prototype.getPropertyId=function(){return(g.pathConstraintPosition<<24)+this.pathConstraintIndex}; -h.prototype.setFrame=function(a,b,c){a*=h.ENTRIES;this.frames[a]=b;this.frames[a+h.VALUE]=c};h.prototype.apply=function(a,c,g,k,l,m,p){c=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(g=c[c.length-h.ENTRIES])k=c[c.length+h.PREV_VALUE];else{p=b.binarySearch(c,g,h.ENTRIES);k=c[p+h.PREV_VALUE];var e=c[p];g=this.getCurvePercent(p/h.ENTRIES-1,1-(g-e)/(c[p+h.PREV_TIME]- -e));k+=(c[p+h.VALUE]-k)*g}a.position=m==d.setup?a.data.position+(k-a.data.position)*l:a.position+(k-a.position)*l}};h.ENTRIES=2;h.PREV_TIME=-2;h.PREV_VALUE=-1;h.VALUE=1;return h}(h);a.PathConstraintPositionTimeline=k;k=function(a){function c(b){a.call(this,b)}__extends(c,a);c.prototype.getPropertyId=function(){return(g.pathConstraintSpacing<<24)+this.pathConstraintIndex};c.prototype.apply=function(a,g,h,k,l,m,p){g=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(h=g[g.length-c.ENTRIES])k=g[g.length+c.PREV_VALUE];else{p=b.binarySearch(g,h,c.ENTRIES);k=g[p+c.PREV_VALUE];var e=g[p];h=this.getCurvePercent(p/c.ENTRIES-1,1-(h-e)/(g[p+c.PREV_TIME]-e));k+=(g[p+c.VALUE]-k)*h}a.spacing=m==d.setup?a.data.spacing+(k-a.data.spacing)*l:a.spacing+(k-a.spacing)*l}};return c}(k);a.PathConstraintSpacingTimeline=k;h=function(c){function h(b){c.call(this,b);this.frames=a.Utils.newFloatArray(b* -h.ENTRIES)}__extends(h,c);h.prototype.getPropertyId=function(){return(g.pathConstraintMix<<24)+this.pathConstraintIndex};h.prototype.setFrame=function(a,b,c,d){a*=h.ENTRIES;this.frames[a]=b;this.frames[a+h.ROTATE]=c;this.frames[a+h.TRANSLATE]=d};h.prototype.apply=function(a,c,g,k,l,m,p){c=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(g=c[c.length-h.ENTRIES])k=c[c.length+h.PREV_ROTATE],p=c[c.length+h.PREV_TRANSLATE];else{var e=b.binarySearch(c,g,h.ENTRIES);k=c[e+h.PREV_ROTATE];p=c[e+h.PREV_TRANSLATE];var n=c[e];g=this.getCurvePercent(e/h.ENTRIES-1,1-(g-n)/(c[e+h.PREV_TIME]-n));k+=(c[e+h.ROTATE]-k)*g;p+=(c[e+h.TRANSLATE]-p)*g}m==d.setup?(a.rotateMix=a.data.rotateMix+(k-a.data.rotateMix)*l,a.translateMix=a.data.translateMix+(p-a.data.translateMix)*l):(a.rotateMix+= -(k-a.rotateMix)*l,a.translateMix+=(p-a.translateMix)*l)}};h.ENTRIES=3;h.PREV_TIME=-3;h.PREV_ROTATE=-2;h.PREV_TRANSLATE=-1;h.ROTATE=1;h.TRANSLATE=2;return h}(h);a.PathConstraintMixTimeline=h})(spine||(spine={})); -(function(a){var b=function(){function b(b){this.tracks=[];this.events=[];this.listeners=[];this.queue=new c(this);this.propertyIDs=new a.IntSet;this.mixingTo=[];this.animationsChanged=!1;this.timeScale=1;this.trackEntryPool=new a.Pool(function(){return new d});this.data=b}b.prototype.update=function(a){a*=this.timeScale;for(var b=this.tracks,c=0,d=b.length;c=e.trackEnd&&null==e.mixingFrom){b[c]=null;this.queue.end(e);this.disposeNext(e);continue}if(null!=e.mixingFrom&&this.updateMixingFrom(e,a))for(h=e.mixingFrom,e.mixingFrom=null;null!=h;)this.queue.end(h),h=h.mixingFrom;e.trackTime+=g}}this.queue.drain()}; +var __extends=this&&this.__extends||function(a,b){function e(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(e.prototype=b.prototype,new e)},spine; +(function(a){var b=function(){function a(a,b,c){if(null==a)throw Error('name cannot be null.');if(null==b)throw Error('timelines cannot be null.');this.name=a;this.timelines=b;this.duration=c}a.prototype.apply=function(a,b,c,d,e,h,k,l){if(null==a)throw Error('skeleton cannot be null.');d&&0!=this.duration&&(c%=this.duration,0>>1;;){a[(e+1)*c]<=b?g=e+1:d=e;if(g==d)return(g+1)*c;e=g+d>>>1}};a.linearSearch=function(a,b,c){for(var g=0,d=a.length-c;g<=d;g+=c)if(a[g]>b)return g;return-1};return a}();a.Animation=b;(function(a){a[a.setup=0]='setup';a[a.current=1]='current';a[a.currentLayered=2]='currentLayered'})(a.MixPose||(a.MixPose={}));var e=a.MixPose;(function(a){a[a['in']=0]='in';a[a.out=1]='out'})(a.MixDirection||(a.MixDirection={}));var d=a.MixDirection;(function(a){a[a.rotate=0]='rotate';a[a.translate= +1]='translate';a[a.scale=2]='scale';a[a.shear=3]='shear';a[a.attachment=4]='attachment';a[a.color=5]='color';a[a.deform=6]='deform';a[a.event=7]='event';a[a.drawOrder=8]='drawOrder';a[a.ikConstraint=9]='ikConstraint';a[a.transformConstraint=10]='transformConstraint';a[a.pathConstraintPosition=11]='pathConstraintPosition';a[a.pathConstraintSpacing=12]='pathConstraintSpacing';a[a.pathConstraintMix=13]='pathConstraintMix';a[a.twoColor=14]='twoColor'})(a.TimelineType||(a.TimelineType={}));var c=a.TimelineType, +k=function(){function b(c){if(0>=c)throw Error('frameCount must be > 0: '+c);this.curves=a.Utils.newFloatArray((c-1)*b.BEZIER_SIZE)}b.prototype.getFrameCount=function(){return this.curves.length/b.BEZIER_SIZE+1};b.prototype.setLinear=function(a){this.curves[a*b.BEZIER_SIZE]=b.LINEAR};b.prototype.setStepped=function(a){this.curves[a*b.BEZIER_SIZE]=b.STEPPED};b.prototype.getCurveType=function(a){a*=b.BEZIER_SIZE;if(a==this.curves.length)return b.LINEAR;a=this.curves[a];return a==b.LINEAR?b.LINEAR:a== +b.STEPPED?b.STEPPED:b.BEZIER};b.prototype.setCurve=function(a,c,d,e,h){var g=.03*(2*-c+e),k=.03*(2*-d+h);e=.006*(3*(c-e)+1);h=.006*(3*(d-h)+1);var m=2*g+e,l=2*k+h;c=.3*c+g+.16666667*e;d=.3*d+k+.16666667*h;a*=b.BEZIER_SIZE;k=this.curves;k[a++]=b.BEZIER;g=c;for(var p=d,n=a+b.BEZIER_SIZE-1;a=g)return c==h?k=h=0:(h=d[c-2],k=d[c-1]),k+(d[c+1]-k)*(g-h)/(e-h);d=d[c-1];return d+(1-d)*(g-e)/(1-e)};b.LINEAR=0;b.STEPPED=1;b.BEZIER=2;b.BEZIER_SIZE=19;return b}();a.CurveTimeline=k;var h=function(d){function h(b){d.call(this,b);this.frames=a.Utils.newFloatArray(b<<1)}__extends(h,d);h.prototype.getPropertyId=function(){return(c.rotate<<24)+this.boneIndex};h.prototype.setFrame=function(a,b,c){a<<=1;this.frames[a]=b;this.frames[a+h.ROTATION]= +c};h.prototype.apply=function(a,c,d,k,m,l,n){c=this.frames;a=a.bones[this.boneIndex];if(d=c[c.length-h.ENTRIES])l==e.setup?a.rotation=a.data.rotation+c[c.length+h.PREV_ROTATION]*m:(l=a.data.rotation+c[c.length+h.PREV_ROTATION]-a.rotation,a.rotation+=(l-360*(16384-(16384.499999999996-l/360|0)))*m);else{n=b.binarySearch(c,d,h.ENTRIES); +k=c[n+h.PREV_ROTATION];var g=c[n];d=this.getCurvePercent((n>>1)-1,1-(d-g)/(c[n+h.PREV_TIME]-g));c=c[n+h.ROTATION]-k;c=k+(c-360*(16384-(16384.499999999996-c/360|0)))*d;l==e.setup?a.rotation=a.data.rotation+(c-360*(16384-(16384.499999999996-c/360|0)))*m:(c=a.data.rotation+c-a.rotation,a.rotation+=(c-360*(16384-(16384.499999999996-c/360|0)))*m)}};h.ENTRIES=2;h.PREV_TIME=-2;h.PREV_ROTATION=-1;h.ROTATION=1;return h}(k);a.RotateTimeline=h;h=function(d){function h(b){d.call(this,b);this.frames=a.Utils.newFloatArray(b* +h.ENTRIES)}__extends(h,d);h.prototype.getPropertyId=function(){return(c.translate<<24)+this.boneIndex};h.prototype.setFrame=function(a,b,c,d){a*=h.ENTRIES;this.frames[a]=b;this.frames[a+h.X]=c;this.frames[a+h.Y]=d};h.prototype.apply=function(a,c,d,k,m,l,n){c=this.frames;a=a.bones[this.boneIndex];if(d=c[c.length-h.ENTRIES])k=c[c.length+h.PREV_X],n=c[c.length+h.PREV_Y];else{var g= +b.binarySearch(c,d,h.ENTRIES);k=c[g+h.PREV_X];n=c[g+h.PREV_Y];var p=c[g];d=this.getCurvePercent(g/h.ENTRIES-1,1-(d-p)/(c[g+h.PREV_TIME]-p));k+=(c[g+h.X]-k)*d;n+=(c[g+h.Y]-n)*d}l==e.setup?(a.x=a.data.x+k*m,a.y=a.data.y+n*m):(a.x+=(a.data.x+k-a.x)*m,a.y+=(a.data.y+n-a.y)*m)}};h.ENTRIES=3;h.PREV_TIME=-3;h.PREV_X=-2;h.PREV_Y=-1;h.X=1;h.Y=2;return h}(k);a.TranslateTimeline=h;var l=function(h){function k(a){h.call(this,a)}__extends(k,h);k.prototype.getPropertyId=function(){return(c.scale<<24)+this.boneIndex}; +k.prototype.apply=function(c,h,m,l,n,q,t){var g=this.frames;c=c.bones[this.boneIndex];if(m=g[g.length-k.ENTRIES])h=g[g.length+k.PREV_X]*c.data.scaleX,l=g[g.length+k.PREV_Y]*c.data.scaleY;else{var p=b.binarySearch(g,m,k.ENTRIES);h=g[p+k.PREV_X];l=g[p+k.PREV_Y];var r=g[p];m=this.getCurvePercent(p/k.ENTRIES-1,1-(m-r)/(g[p+ +k.PREV_TIME]-r));h=(h+(g[p+k.X]-h)*m)*c.data.scaleX;l=(l+(g[p+k.Y]-l)*m)*c.data.scaleY}1==n?(c.scaleX=h,c.scaleY=l):(q==e.setup?(q=c.data.scaleX,m=c.data.scaleY):(q=c.scaleX,m=c.scaleY),t==d.out?(h=Math.abs(h)*a.MathUtils.signum(q),l=Math.abs(l)*a.MathUtils.signum(m)):(q=Math.abs(q)*a.MathUtils.signum(h),m=Math.abs(m)*a.MathUtils.signum(l)),c.scaleX=q+(h-q)*n,c.scaleY=m+(l-m)*n)}};return k}(h);a.ScaleTimeline=l;h=function(a){function d(b){a.call(this,b)}__extends(d,a);d.prototype.getPropertyId=function(){return(c.shear<< +24)+this.boneIndex};d.prototype.apply=function(a,c,h,k,m,l,n){c=this.frames;a=a.bones[this.boneIndex];if(h=c[c.length-d.ENTRIES])k=c[c.length+d.PREV_X],n=c[c.length+d.PREV_Y];else{var g=b.binarySearch(c,h,d.ENTRIES);k=c[g+d.PREV_X];n=c[g+d.PREV_Y];var p=c[g];h=this.getCurvePercent(g/d.ENTRIES-1,1-(h-p)/(c[g+d.PREV_TIME]- +p));k+=(c[g+d.X]-k)*h;n+=(c[g+d.Y]-n)*h}l==e.setup?(a.shearX=a.data.shearX+k*m,a.shearY=a.data.shearY+n*m):(a.shearX+=(a.data.shearX+k-a.shearX)*m,a.shearY+=(a.data.shearY+n-a.shearY)*m)}};return d}(h);a.ShearTimeline=h;h=function(d){function h(b){d.call(this,b);this.frames=a.Utils.newFloatArray(b*h.ENTRIES)}__extends(h,d);h.prototype.getPropertyId=function(){return(c.color<<24)+this.slotIndex};h.prototype.setFrame=function(a,b,c,d,e,k){a*=h.ENTRIES;this.frames[a]=b;this.frames[a+h.R]=c;this.frames[a+ +h.G]=d;this.frames[a+h.B]=e;this.frames[a+h.A]=k};h.prototype.apply=function(a,c,d,k,l,m,n){a=a.slots[this.slotIndex];var g=this.frames;if(d=g[g.length-h.ENTRIES]){d=g.length;c=g[d+h.PREV_R];k=g[d+h.PREV_G];n=g[d+h.PREV_B];var p=g[d+h.PREV_A]}else{var q=b.binarySearch(g,d,h.ENTRIES);c=g[q+h.PREV_R];k=g[q+h.PREV_G];n=g[q+h.PREV_B]; +p=g[q+h.PREV_A];var r=g[q];d=this.getCurvePercent(q/h.ENTRIES-1,1-(d-r)/(g[q+h.PREV_TIME]-r));c+=(g[q+h.R]-c)*d;k+=(g[q+h.G]-k)*d;n+=(g[q+h.B]-n)*d;p+=(g[q+h.A]-p)*d}1==l?a.color.set(c,k,n,p):(d=a.color,m==e.setup&&d.setFromColor(a.data.color),d.add((c-d.r)*l,(k-d.g)*l,(n-d.b)*l,(p-d.a)*l))}};h.ENTRIES=5;h.PREV_TIME=-5;h.PREV_R=-4;h.PREV_G=-3;h.PREV_B=-2;h.PREV_A=-1;h.R=1;h.G=2;h.B=3;h.A=4;return h}(k);a.ColorTimeline=h;h=function(d){function h(b){d.call(this,b);this.frames=a.Utils.newFloatArray(b* +h.ENTRIES)}__extends(h,d);h.prototype.getPropertyId=function(){return(c.twoColor<<24)+this.slotIndex};h.prototype.setFrame=function(a,b,c,d,e,k,l,m,n){a*=h.ENTRIES;this.frames[a]=b;this.frames[a+h.R]=c;this.frames[a+h.G]=d;this.frames[a+h.B]=e;this.frames[a+h.A]=k;this.frames[a+h.R2]=l;this.frames[a+h.G2]=m;this.frames[a+h.B2]=n};h.prototype.apply=function(a,c,d,k,l,m,n){a=a.slots[this.slotIndex];var g=this.frames;if(d=g[g.length-h.ENTRIES]){d=g.length;c=g[d+h.PREV_R];k=g[d+h.PREV_G];n=g[d+h.PREV_B];var p=g[d+h.PREV_A];var q=g[d+h.PREV_R2];var r=g[d+h.PREV_G2];var u=g[d+h.PREV_B2]}else{var t=b.binarySearch(g,d,h.ENTRIES);c=g[t+h.PREV_R];k=g[t+h.PREV_G];n=g[t+h.PREV_B];p=g[t+h.PREV_A];q=g[t+h.PREV_R2];r=g[t+h.PREV_G2];u=g[t+h.PREV_B2]; +var v=g[t];d=this.getCurvePercent(t/h.ENTRIES-1,1-(d-v)/(g[t+h.PREV_TIME]-v));c+=(g[t+h.R]-c)*d;k+=(g[t+h.G]-k)*d;n+=(g[t+h.B]-n)*d;p+=(g[t+h.A]-p)*d;q+=(g[t+h.R2]-q)*d;r+=(g[t+h.G2]-r)*d;u+=(g[t+h.B2]-u)*d}1==l?(a.color.set(c,k,n,p),a.darkColor.set(q,r,u,1)):(d=a.color,g=a.darkColor,m==e.setup&&(d.setFromColor(a.data.color),g.setFromColor(a.data.darkColor)),d.add((c-d.r)*l,(k-d.g)*l,(n-d.b)*l,(p-d.a)*l),g.add((q-g.r)*l,(r-g.g)*l,(u-g.b)*l,0))}};h.ENTRIES=8;h.PREV_TIME=-8;h.PREV_R=-7;h.PREV_G=-6; +h.PREV_B=-5;h.PREV_A=-4;h.PREV_R2=-3;h.PREV_G2=-2;h.PREV_B2=-1;h.R=1;h.G=2;h.B=3;h.A=4;h.R2=5;h.G2=6;h.B2=7;return h}(k);a.TwoColorTimeline=h;h=function(){function h(b){this.frames=a.Utils.newFloatArray(b);this.attachmentNames=Array(b)}h.prototype.getPropertyId=function(){return(c.attachment<<24)+this.slotIndex};h.prototype.getFrameCount=function(){return this.frames.length};h.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.attachmentNames[a]=c};h.prototype.apply=function(a,c,h,k,l,n,q){c= +a.slots[this.slotIndex];q==d.out&&n==e.setup?(h=c.data.attachmentName,c.setAttachment(null==h?null:a.getAttachment(this.slotIndex,h))):(q=this.frames,h=q[q.length-1]?q.length-1:b.binarySearch(q,h,1)-1,h=this.attachmentNames[h],a.slots[this.slotIndex].setAttachment(null==h?null:a.getAttachment(this.slotIndex,h))))};return h}();a.AttachmentTimeline=h;var n=null;h=function(d){function h(b){d.call(this, +b);this.frames=a.Utils.newFloatArray(b);this.frameVertices=Array(b);null==n&&(n=a.Utils.newFloatArray(64))}__extends(h,d);h.prototype.getPropertyId=function(){return(c.deform<<27)+ +this.attachment.id+this.slotIndex};h.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.frameVertices[a]=c};h.prototype.apply=function(c,d,h,k,l,m,n){c=c.slots[this.slotIndex];var g=c.getAttachment();if(g instanceof a.VertexAttachment&&g.applyDeform(this.attachment)){d=c.attachmentVertices;0==d.length&&(l=1);n=this.frameVertices; +c=n[0].length;var p=this.frames;if(h=p[p.length-1])if(k=n[p.length-1],1==l)a.Utils.arrayCopy(k,0,d,0,c);else if(m==e.setup)if(null==g.bones)for(n=g.vertices,h=0;hd)this.apply(a,c,Number.MAX_VALUE,e,h,k,l),c=-1;else if(c>=g[m-1])return;if(!(d=g[a];a++)e.push(this.events[a])}}};return d}();a.EventTimeline= +h;h=function(){function h(b){this.frames=a.Utils.newFloatArray(b);this.drawOrders=Array(b)}h.prototype.getPropertyId=function(){return c.drawOrder<<24};h.prototype.getFrameCount=function(){return this.frames.length};h.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.drawOrders[a]=c};h.prototype.apply=function(c,g,h,k,l,n,q){g=c.drawOrder;k=c.slots;if(q==d.out&&n==e.setup)a.Utils.arrayCopy(c.slots,0,c.drawOrder,0,c.slots.length);else if(q=this.frames,h=q[q.length-1]?q.length-1:b.binarySearch(q,h)-1,c=this.drawOrders[c],null==c)a.Utils.arrayCopy(k,0,g,0,k.length);else for(h=0,n=c.length;h=c[c.length-k.ENTRIES])n==e.setup?(a.mix=a.data.mix+(c[c.length+k.PREV_MIX]-a.data.mix)*m,a.bendDirection=q==d.out?a.data.bendDirection:c[c.length+k.PREV_BEND_DIRECTION]):(a.mix+= +(c[c.length+k.PREV_MIX]-a.mix)*m,q==d.in&&(a.bendDirection=c[c.length+k.PREV_BEND_DIRECTION]));else{l=b.binarySearch(c,h,k.ENTRIES);var g=c[l+k.PREV_MIX],p=c[l];h=this.getCurvePercent(l/k.ENTRIES-1,1-(h-p)/(c[l+k.PREV_TIME]-p));n==e.setup?(a.mix=a.data.mix+(g+(c[l+k.MIX]-g)*h-a.data.mix)*m,a.bendDirection=q==d.out?a.data.bendDirection:c[l+k.PREV_BEND_DIRECTION]):(a.mix+=(g+(c[l+k.MIX]-g)*h-a.mix)*m,q==d.in&&(a.bendDirection=c[l+k.PREV_BEND_DIRECTION]))}};k.ENTRIES=3;k.PREV_TIME=-3;k.PREV_MIX=-2;k.PREV_BEND_DIRECTION= +-1;k.MIX=1;k.BEND_DIRECTION=2;return k}(k);a.IkConstraintTimeline=h;h=function(d){function h(b){d.call(this,b);this.frames=a.Utils.newFloatArray(b*h.ENTRIES)}__extends(h,d);h.prototype.getPropertyId=function(){return(c.transformConstraint<<24)+this.transformConstraintIndex};h.prototype.setFrame=function(a,b,c,d,e,k){a*=h.ENTRIES;this.frames[a]=b;this.frames[a+h.ROTATE]=c;this.frames[a+h.TRANSLATE]=d;this.frames[a+h.SCALE]=e;this.frames[a+h.SHEAR]=k};h.prototype.apply=function(a,c,d,k,l,m,n){c=this.frames; +a=a.transformConstraints[this.transformConstraintIndex];if(d=c[c.length-h.ENTRIES]){d=c.length;k=c[d+h.PREV_ROTATE];n=c[d+h.PREV_TRANSLATE];var g=c[d+h.PREV_SCALE];var p= +c[d+h.PREV_SHEAR]}else{var q=b.binarySearch(c,d,h.ENTRIES);k=c[q+h.PREV_ROTATE];n=c[q+h.PREV_TRANSLATE];g=c[q+h.PREV_SCALE];p=c[q+h.PREV_SHEAR];var r=c[q];d=this.getCurvePercent(q/h.ENTRIES-1,1-(d-r)/(c[q+h.PREV_TIME]-r));k+=(c[q+h.ROTATE]-k)*d;n+=(c[q+h.TRANSLATE]-n)*d;g+=(c[q+h.SCALE]-g)*d;p+=(c[q+h.SHEAR]-p)*d}m==e.setup?(d=a.data,a.rotateMix=d.rotateMix+(k-d.rotateMix)*l,a.translateMix=d.translateMix+(n-d.translateMix)*l,a.scaleMix=d.scaleMix+(g-d.scaleMix)*l,a.shearMix=d.shearMix+(p-d.shearMix)* +l):(a.rotateMix+=(k-a.rotateMix)*l,a.translateMix+=(n-a.translateMix)*l,a.scaleMix+=(g-a.scaleMix)*l,a.shearMix+=(p-a.shearMix)*l)}};h.ENTRIES=5;h.PREV_TIME=-5;h.PREV_ROTATE=-4;h.PREV_TRANSLATE=-3;h.PREV_SCALE=-2;h.PREV_SHEAR=-1;h.ROTATE=1;h.TRANSLATE=2;h.SCALE=3;h.SHEAR=4;return h}(k);a.TransformConstraintTimeline=h;h=function(d){function h(b){d.call(this,b);this.frames=a.Utils.newFloatArray(b*h.ENTRIES)}__extends(h,d);h.prototype.getPropertyId=function(){return(c.pathConstraintPosition<<24)+this.pathConstraintIndex}; +h.prototype.setFrame=function(a,b,c){a*=h.ENTRIES;this.frames[a]=b;this.frames[a+h.VALUE]=c};h.prototype.apply=function(a,c,d,k,l,m,n){c=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(d=c[c.length-h.ENTRIES])k=c[c.length+h.PREV_VALUE];else{n=b.binarySearch(c,d,h.ENTRIES);k=c[n+h.PREV_VALUE];var g=c[n];d=this.getCurvePercent(n/h.ENTRIES-1,1-(d-g)/(c[n+h.PREV_TIME]- +g));k+=(c[n+h.VALUE]-k)*d}a.position=m==e.setup?a.data.position+(k-a.data.position)*l:a.position+(k-a.position)*l}};h.ENTRIES=2;h.PREV_TIME=-2;h.PREV_VALUE=-1;h.VALUE=1;return h}(k);a.PathConstraintPositionTimeline=h;h=function(a){function d(b){a.call(this,b)}__extends(d,a);d.prototype.getPropertyId=function(){return(c.pathConstraintSpacing<<24)+this.pathConstraintIndex};d.prototype.apply=function(a,c,h,k,l,m,n){c=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(h=c[c.length-d.ENTRIES])k=c[c.length+d.PREV_VALUE];else{n=b.binarySearch(c,h,d.ENTRIES);k=c[n+d.PREV_VALUE];var g=c[n];h=this.getCurvePercent(n/d.ENTRIES-1,1-(h-g)/(c[n+d.PREV_TIME]-g));k+=(c[n+d.VALUE]-k)*h}a.spacing=m==e.setup?a.data.spacing+(k-a.data.spacing)*l:a.spacing+(k-a.spacing)*l}};return d}(h);a.PathConstraintSpacingTimeline=h;k=function(d){function h(b){d.call(this,b);this.frames=a.Utils.newFloatArray(b* +h.ENTRIES)}__extends(h,d);h.prototype.getPropertyId=function(){return(c.pathConstraintMix<<24)+this.pathConstraintIndex};h.prototype.setFrame=function(a,b,c,d){a*=h.ENTRIES;this.frames[a]=b;this.frames[a+h.ROTATE]=c;this.frames[a+h.TRANSLATE]=d};h.prototype.apply=function(a,c,d,k,l,m,n){c=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(d=c[c.length-h.ENTRIES])k=c[c.length+h.PREV_ROTATE],n=c[c.length+h.PREV_TRANSLATE];else{var g=b.binarySearch(c,d,h.ENTRIES);k=c[g+h.PREV_ROTATE];n=c[g+h.PREV_TRANSLATE];var p=c[g];d=this.getCurvePercent(g/h.ENTRIES-1,1-(d-p)/(c[g+h.PREV_TIME]-p));k+=(c[g+h.ROTATE]-k)*d;n+=(c[g+h.TRANSLATE]-n)*d}m==e.setup?(a.rotateMix=a.data.rotateMix+(k-a.data.rotateMix)*l,a.translateMix=a.data.translateMix+(n-a.data.translateMix)*l):(a.rotateMix+= +(k-a.rotateMix)*l,a.translateMix+=(n-a.translateMix)*l)}};h.ENTRIES=3;h.PREV_TIME=-3;h.PREV_ROTATE=-2;h.PREV_TRANSLATE=-1;h.ROTATE=1;h.TRANSLATE=2;return h}(k);a.PathConstraintMixTimeline=k})(spine||(spine={})); +(function(a){var b=function(){function b(b){this.tracks=[];this.events=[];this.listeners=[];this.queue=new d(this);this.propertyIDs=new a.IntSet;this.mixingTo=[];this.animationsChanged=!1;this.timeScale=1;this.trackEntryPool=new a.Pool(function(){return new e});this.data=b}b.prototype.update=function(a){a*=this.timeScale;for(var b=this.tracks,c=0,d=b.length;c=g.trackEnd&&null==g.mixingFrom){b[c]=null;this.queue.end(g);this.disposeNext(g);continue}if(null!=g.mixingFrom&&this.updateMixingFrom(g,a))for(h=g.mixingFrom,g.mixingFrom=null;null!=h;)this.queue.end(h),h=h.mixingFrom;g.trackTime+=e}}this.queue.drain()}; b.prototype.updateMixingFrom=function(a,b){var c=a.mixingFrom;if(null==c)return!0;var d=this.updateMixingFrom(c,b);if(0=a.mixDuration||0==a.timeScale)){if(0==c.totalAlpha||0==a.mixDuration)a.mixingFrom=c.mixingFrom,a.interruptAlpha=c.interruptAlpha,this.queue.end(c);return d}c.animationLast=c.nextAnimationLast;c.trackLast=c.nextTrackLast;c.trackTime+=b*c.timeScale;a.mixTime+=b*a.timeScale;return!1};b.prototype.apply=function(c){if(null==c)throw Error('skeleton cannot be null.'); -this.animationsChanged&&this._animationsChanged();for(var d=this.events,g=this.tracks,h=!1,e=0,k=g.length;e=l.trackEnd&&null==l.next&&(D=0);var w=l.animationLast,u=l.getAnimationTime(),v=l.animation.timelines.length,z=l.animation.timelines;if(1==D)for(var G=0;G=b.FIRST?a.MixPose.setup:t;C instanceof a.RotateTimeline?this.applyRotateTimeline(C,c,u,D,P,H,G<<1,K):C.apply(c,w,u,d,D,P,a.MixDirection.in)}}this.queueEvents(l,u);d.length=0;l.nextAnimationLast=u;l.nextTrackLast=l.trackTime}}this.queue.drain();return h};b.prototype.applyMixingFrom=function(c,d,g){var h=c.mixingFrom;null!=h.mixingFrom&& -this.applyMixingFrom(h,d,g);if(0==c.mixDuration)var e=1;else e=c.mixTime/c.mixDuration,1=l[l.length-a.RotateTimeline.ENTRIES])l=c.data.rotation+l[l.length+a.RotateTimeline.PREV_ROTATION];else{var m=a.Animation.binarySearch(l,d,a.RotateTimeline.ENTRIES),n=l[m+a.RotateTimeline.PREV_ROTATION],p=l[m]; -b=b.getCurvePercent((m>>1)-1,1-(d-p)/(l[m+a.RotateTimeline.PREV_TIME]-p));l=l[m+a.RotateTimeline.ROTATION]-n;l=n+(l-360*(16384-(16384.499999999996-l/360|0)))*b+c.data.rotation;l-=360*(16384-(16384.499999999996-l/360|0))}e=e==a.MixPose.setup?c.data.rotation:c.rotation;l-=e;0==l?d=h[k]:(l-=360*(16384-(16384.499999999996-l/360|0)),t?(t=0,d=l):(t=h[k],d=h[k+1]),n=0=Math.abs(d)&&(180d||this.queue.event(a,m)}for((a.loop?g>a.trackTime%e:b>=d&&a.animationLast=l.trackEnd&&null==l.next&&(E=0);var v=l.animationLast,t=l.getAnimationTime(),z=l.animation.timelines.length,w=l.animation.timelines;if(1==E)for(var I=0;I=b.FIRST?a.MixPose.setup:u;D instanceof a.RotateTimeline?this.applyRotateTimeline(D,c,t,E,Q,C,I<<1,K):D.apply(c,v,t,d,E,Q,a.MixDirection.in)}}this.queueEvents(l,t);d.length=0;l.nextAnimationLast=t;l.nextTrackLast=l.trackTime}}this.queue.drain();return h};b.prototype.applyMixingFrom=function(c,d,e){var h=c.mixingFrom;null!=h.mixingFrom&& +this.applyMixingFrom(h,d,e);if(0==c.mixDuration)var g=1;else g=c.mixTime/c.mixDuration,1=l[l.length-a.RotateTimeline.ENTRIES])l=c.data.rotation+l[l.length+a.RotateTimeline.PREV_ROTATION];else{var m=a.Animation.binarySearch(l,d,a.RotateTimeline.ENTRIES),n=l[m+a.RotateTimeline.PREV_ROTATION],p=l[m]; +b=b.getCurvePercent((m>>1)-1,1-(d-p)/(l[m+a.RotateTimeline.PREV_TIME]-p));l=l[m+a.RotateTimeline.ROTATION]-n;l=n+(l-360*(16384-(16384.499999999996-l/360|0)))*b+c.data.rotation;l-=360*(16384-(16384.499999999996-l/360|0))}g=g==a.MixPose.setup?c.data.rotation:c.rotation;l-=g;0==l?d=h[k]:(l-=360*(16384-(16384.499999999996-l/360|0)),u?(u=0,d=l):(u=h[k],d=h[k+1]),n=0=Math.abs(d)&&(180d||this.queue.event(a,n)}for((a.loop?e>a.trackTime%g:b>=d&&a.animationLast=this.tracks.length)&&(a=this.tracks[a],null!=a)){this.queue.end(a);this.disposeNext(a);for(var b=a;;){var c=b.mixingFrom;if(null==c)break;this.queue.end(c);b.mixingFrom=null;b=c}this.tracks[a.trackIndex]=null;this.queue.drain()}};b.prototype.setCurrent=function(a,b,c){var d=this.expandToIndex(a);this.tracks[a]= -b;null!=d&&(c&&this.queue.interrupt(d),b.mixingFrom=d,b.mixTime=0,null!=d.mixingFrom&&0=d&&(a=e.animationEnd-e.animationStart,d=0!=a?d+(a*(1+(e.trackTime/a|0))-this.data.getMix(e.animation,b)):0));c.delay=d;return c};b.prototype.setEmptyAnimation=function(a,c){a=this.setAnimationWith(a,b.emptyAnimation,!1);a.mixDuration=c;a.trackEnd=c;return a};b.prototype.addEmptyAnimation=function(a,c,d){0>=d&&(d-=c);a=this.addAnimationWith(a, -b.emptyAnimation,!1,d);a.mixDuration=c;a.trackEnd=c;return a};b.prototype.setEmptyAnimations=function(a){var b=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var c=0,d=this.tracks.length;c=this.tracks.length?null:this.tracks[a]};b.prototype.addListener=function(a){if(null==a)throw Error('listener cannot be null.');this.listeners.push(a)};b.prototype.removeListener= -function(a){a=this.listeners.indexOf(a);0<=a&&this.listeners.splice(a,1)};b.prototype.clearListeners=function(){this.listeners.length=0};b.prototype.clearListenerNotifications=function(){this.queue.clear()};b.emptyAnimation=new a.Animation('',[],0);b.SUBSEQUENT=0;b.FIRST=1;b.DIP=2;b.DIP_MIX=3;return b}();a.AnimationState=b;var d=function(){function c(){this.timelineData=[];this.timelineDipMix=[];this.timelinesRotation=[]}c.prototype.reset=function(){this.listener=this.animation=this.mixingFrom= -this.next=null;this.timelineData.length=0;this.timelineDipMix.length=0;this.timelinesRotation.length=0};c.prototype.setTimelineData=function(c,d,g){null!=c&&d.push(c);var h=null!=this.mixingFrom?this.mixingFrom.setTimelineData(this,d,g):this;null!=c&&d.pop();var e=d.length-1,k=this.animation.timelines,l=this.animation.timelines.length,m=a.Utils.setArraySize(this.timelineData,l);this.timelineDipMix.length=0;var q=a.Utils.setArraySize(this.timelineDipMix,l),w=0;a:for(;w=this.animationEnd-this.animationStart};c.prototype.resetRotationDirections=function(){this.timelinesRotation.length=0};return c}();a.TrackEntry=d;var c=function(){function a(a){this.objects=[];this.drainDisabled=!1;this.animState=a}a.prototype.start=function(a){this.objects.push(g.start);this.objects.push(a);this.animState.animationsChanged= -!0};a.prototype.interrupt=function(a){this.objects.push(g.interrupt);this.objects.push(a)};a.prototype.end=function(a){this.objects.push(g.end);this.objects.push(a);this.animState.animationsChanged=!0};a.prototype.dispose=function(a){this.objects.push(g.dispose);this.objects.push(a)};a.prototype.complete=function(a){this.objects.push(g.complete);this.objects.push(a)};a.prototype.event=function(a,b){this.objects.push(g.event);this.objects.push(a);this.objects.push(b)};a.prototype.drain=function(){if(!this.drainDisabled){this.drainDisabled= -!0;for(var a=this.objects,b=this.animState.listeners,c=0;c=d&&(a=g.animationEnd-g.animationStart,d=0!=a?d+(a*(1+(g.trackTime/a|0))-this.data.getMix(g.animation,b)):0));c.delay=d;return c};b.prototype.setEmptyAnimation=function(a,c){a=this.setAnimationWith(a,b.emptyAnimation,!1);a.mixDuration=c;a.trackEnd=c;return a};b.prototype.addEmptyAnimation=function(a,c,d){0>=d&&(d-=c);a=this.addAnimationWith(a, +b.emptyAnimation,!1,d);a.mixDuration=c;a.trackEnd=c;return a};b.prototype.setEmptyAnimations=function(a){var b=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var c=0,d=this.tracks.length;c=this.tracks.length?null:this.tracks[a]};b.prototype.addListener=function(a){if(null==a)throw Error('listener cannot be null.');this.listeners.push(a)};b.prototype.removeListener= +function(a){a=this.listeners.indexOf(a);0<=a&&this.listeners.splice(a,1)};b.prototype.clearListeners=function(){this.listeners.length=0};b.prototype.clearListenerNotifications=function(){this.queue.clear()};b.emptyAnimation=new a.Animation('',[],0);b.SUBSEQUENT=0;b.FIRST=1;b.DIP=2;b.DIP_MIX=3;return b}();a.AnimationState=b;var e=function(){function c(){this.timelineData=[];this.timelineDipMix=[];this.timelinesRotation=[]}c.prototype.reset=function(){this.listener=this.animation=this.mixingFrom= +this.next=null;this.timelineData.length=0;this.timelineDipMix.length=0;this.timelinesRotation.length=0};c.prototype.setTimelineData=function(c,d,e){null!=c&&d.push(c);var h=null!=this.mixingFrom?this.mixingFrom.setTimelineData(this,d,e):this;null!=c&&d.pop();var g=d.length-1,k=this.animation.timelines,l=this.animation.timelines.length,n=a.Utils.setArraySize(this.timelineData,l);this.timelineDipMix.length=0;var q=a.Utils.setArraySize(this.timelineDipMix,l),v=0;a:for(;v=this.animationEnd-this.animationStart};c.prototype.resetRotationDirections=function(){this.timelinesRotation.length=0};return c}();a.TrackEntry=e;var d=function(){function a(a){this.objects=[];this.drainDisabled=!1;this.animState=a}a.prototype.start=function(a){this.objects.push(c.start);this.objects.push(a);this.animState.animationsChanged= +!0};a.prototype.interrupt=function(a){this.objects.push(c.interrupt);this.objects.push(a)};a.prototype.end=function(a){this.objects.push(c.end);this.objects.push(a);this.animState.animationsChanged=!0};a.prototype.dispose=function(a){this.objects.push(c.dispose);this.objects.push(a)};a.prototype.complete=function(a){this.objects.push(c.complete);this.objects.push(a)};a.prototype.event=function(a,b){this.objects.push(c.event);this.objects.push(a);this.objects.push(b)};a.prototype.drain=function(){if(!this.drainDisabled){this.drainDisabled= +!0;for(var a=this.objects,b=this.animState.listeners,d=0;dg.status?(c.assets[a]=g.responseText,b&&b(a,g.responseText)):(c.errors[a]="Couldn't load text "+a+': status '+ -g.status+', '+g.responseText,d&&d(a,"Couldn't load text "+a+': status '+g.status+', '+g.responseText)),c.toLoad--,c.loaded++)};g.open('GET',a,!0);g.send()};a.prototype.loadTexture=function(a,b,d){var c=this;void 0===b&&(b=null);void 0===d&&(d=null);a=this.pathPrefix+a;this.toLoad++;var g=new Image;g.crossOrigin='anonymous';g.onload=function(d){d=c.textureLoader(g);c.assets[a]=d;c.toLoad--;c.loaded++;b&&b(a,g)};g.onerror=function(b){c.errors[a]="Couldn't load image "+a;c.toLoad--;c.loaded++;d&&d(a, -"Couldn't load image "+a)};g.src=a};a.prototype.loadTextureData=function(a,b,d,k){var c=this;void 0===d&&(d=null);void 0===k&&(k=null);a=this.pathPrefix+a;this.toLoad++;var g=new Image;g.onload=function(b){b=c.textureLoader(g);c.assets[a]=b;c.toLoad--;c.loaded++;d&&d(a,g)};g.onerror=function(b){c.errors[a]="Couldn't load image "+a;c.toLoad--;c.loaded++;k&&k(a,"Couldn't load image "+a)};g.src=b};a.prototype.get=function(a){a=this.pathPrefix+a;return this.assets[a]};a.prototype.remove=function(a){a= +(function(a){var b=function(){function a(a){this.animationToMixTime={};this.defaultMix=0;if(null==a)throw Error('skeletonData cannot be null.');this.skeletonData=a}a.prototype.setMix=function(a,b,e){var c=this.skeletonData.findAnimation(a);if(null==c)throw Error('Animation not found: '+a);a=this.skeletonData.findAnimation(b);if(null==a)throw Error('Animation not found: '+b);this.setMixWith(c,a,e)};a.prototype.setMixWith=function(a,b,e){if(null==a)throw Error('from cannot be null.');if(null==b)throw Error('to cannot be null.'); +this.animationToMixTime[a.name+b.name]=e};a.prototype.getMix=function(a,b){a=this.animationToMixTime[a.name+b.name];return void 0===a?this.defaultMix:a};return a}();a.AnimationStateData=b})(spine||(spine={})); +(function(a){var b=function(){function a(a,b){void 0===b&&(b='');this.assets={};this.errors={};this.loaded=this.toLoad=0;this.textureLoader=a;this.pathPrefix=b}a.prototype.loadText=function(a,b,e){var c=this;void 0===b&&(b=null);void 0===e&&(e=null);a=this.pathPrefix+a;this.toLoad++;var d=new XMLHttpRequest;d.onreadystatechange=function(){d.readyState==XMLHttpRequest.DONE&&(200<=d.status&&300>d.status?(c.assets[a]=d.responseText,b&&b(a,d.responseText)):(c.errors[a]="Couldn't load text "+a+': status '+ +d.status+', '+d.responseText,e&&e(a,"Couldn't load text "+a+': status '+d.status+', '+d.responseText)),c.toLoad--,c.loaded++)};d.open('GET',a,!0);d.send()};a.prototype.loadTexture=function(a,b,e){var c=this;void 0===b&&(b=null);void 0===e&&(e=null);a=this.pathPrefix+a;this.toLoad++;var d=new Image;d.crossOrigin='anonymous';d.onload=function(e){e=c.textureLoader(d);c.assets[a]=e;c.toLoad--;c.loaded++;b&&b(a,d)};d.onerror=function(b){c.errors[a]="Couldn't load image "+a;c.toLoad--;c.loaded++;e&&e(a, +"Couldn't load image "+a)};d.src=a};a.prototype.loadTextureData=function(a,b,e,h){var c=this;void 0===e&&(e=null);void 0===h&&(h=null);a=this.pathPrefix+a;this.toLoad++;var d=new Image;d.onload=function(b){b=c.textureLoader(d);c.assets[a]=b;c.toLoad--;c.loaded++;e&&e(a,d)};d.onerror=function(b){c.errors[a]="Couldn't load image "+a;c.toLoad--;c.loaded++;h&&h(a,"Couldn't load image "+a)};d.src=b};a.prototype.get=function(a){a=this.pathPrefix+a;return this.assets[a]};a.prototype.remove=function(a){a= this.pathPrefix+a;var b=this.assets[a];b.dispose&&b.dispose();this.assets[a]=null};a.prototype.removeAll=function(){for(var a in this.assets){var b=this.assets[a];b.dispose&&b.dispose()}this.assets={}};a.prototype.isLoadingComplete=function(){return 0==this.toLoad};a.prototype.getToLoad=function(){return this.toLoad};a.prototype.getLoaded=function(){return this.loaded};a.prototype.dispose=function(){this.removeAll()};a.prototype.hasErrors=function(){return 0>1)*q;var g=a.bone.skeleton,e=a.attachmentVertices,h=this.vertices,k=this.bones;if(null==k){0>1)*q;var c=a.bone.skeleton,g=a.attachmentVertices,h=this.vertices,k=this.bones;if(null==k){0g*D-r*t:this.skeleton.flipX!=this.skeleton.flipY)d=-d,w=-w;this.a=h*c+d*k;this.b=h*e+d*l;this.c=b*c+w*k;this.d=b*e+w*l;return}this.skeleton.flipX&&(this.a=-this.a,this.b=-this.b);this.skeleton.flipY&&(this.c=-this.c,this.d=-this.d)}};b.prototype.setToSetupPose=function(){var a=this.data;this.x=a.x;this.y=a.y;this.rotation=a.rotation;this.scaleX=a.scaleX;this.scaleY=a.scaleY;this.shearX=a.shearX;this.shearY=a.shearY};b.prototype.getWorldRotationX=function(){return Math.atan2(this.c,this.a)*a.MathUtils.radDeg}; +(function(a){var b=function(b){function d(c){b.call(this,c);this.color=new a.Color(1,1,1,1)}__extends(d,b);return d}(a.VertexAttachment);a.BoundingBoxAttachment=b})(spine||(spine={}));(function(a){var b=function(b){function d(c){b.call(this,c);this.color=new a.Color(.2275,.2275,.8078,1)}__extends(d,b);return d}(a.VertexAttachment);a.ClippingAttachment=b})(spine||(spine={})); +(function(a){var b=function(b){function d(c){b.call(this,c);this.color=new a.Color(1,1,1,1);this.inheritDeform=!1;this.tempColor=new a.Color(0,0,0,0)}__extends(d,b);d.prototype.updateUVs=function(){var b,d;if(null==this.region){var e=b=0;var l=d=1}else e=this.region.u,b=this.region.v,l=this.region.u2-e,d=this.region.v2-b;var n=this.regionUVs;if(null==this.uvs||this.uvs.length!=n.length)this.uvs=a.Utils.newFloatArray(n.length);var q=this.uvs;if(this.region.rotate)for(var m=0,g=q.length;mk*E-r*u:this.skeleton.flipX!=this.skeleton.flipY)c=-c,v=-v;this.a=e*d+c*h;this.b=e*g+c*l;this.c=b*d+v*h;this.d=b*g+v*l;return}this.skeleton.flipX&&(this.a=-this.a,this.b=-this.b);this.skeleton.flipY&&(this.c=-this.c,this.d=-this.d)}};b.prototype.setToSetupPose=function(){var a=this.data;this.x=a.x;this.y=a.y;this.rotation=a.rotation;this.scaleX=a.scaleX;this.scaleY=a.scaleY;this.shearX=a.shearX;this.shearY=a.shearY};b.prototype.getWorldRotationX=function(){return Math.atan2(this.c,this.a)*a.MathUtils.radDeg}; b.prototype.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*a.MathUtils.radDeg};b.prototype.getWorldScaleX=function(){return Math.sqrt(this.a*this.a+this.c*this.c)};b.prototype.getWorldScaleY=function(){return Math.sqrt(this.b*this.b+this.d*this.d)};b.prototype.updateAppliedTransform=function(){this.appliedValid=!0;var b=this.parent;if(null==b)this.ax=this.worldX,this.ay=this.worldY,this.arotation=Math.atan2(this.c,this.a)*a.MathUtils.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c* -this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*a.MathUtils.radDeg;else{var d=b.a,h=b.b,k=b.c,l=b.d,m=1/(d*l-h*k),q=this.worldX-b.worldX;b=this.worldY-b.worldY;this.ax=q*l*m-b*h*m;this.ay=b*d*m-q*k*m;l*=m;d*=m;h*=m;m*=k;k=l*this.a-h*this.c;h=l*this.b-h*this.d;l=d*this.c-m*this.a;m=d*this.d-m*this.b;this.ashearX=0;this.ascaleX=Math.sqrt(k*k+l*l);1E-4a)throw Error('index must be >= 0.');if(null==b)throw Error('name cannot be null.');this.index=a;this.name=b;this.parent=h}}();a.BoneData=b;(function(a){a[a.Normal=0]='Normal';a[a.OnlyTranslation=1]='OnlyTranslation';a[a.NoRotationOrReflection=2]='NoRotationOrReflection';a[a.NoScale=3]='NoScale';a[a.NoScaleOrReflection=4]='NoScaleOrReflection'})(a.TransformMode|| -(a.TransformMode={}));var d=a.TransformMode})(spine||(spine={}));(function(a){var b=function(){return function(a,b){if(null==b)throw Error('data cannot be null.');this.time=a;this.data=b}}();a.Event=b})(spine||(spine={}));(function(a){var b=function(){return function(a){this.name=a}}();a.EventData=b})(spine||(spine={})); +this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*a.MathUtils.radDeg;else{var c=b.a,e=b.b,h=b.c,l=b.d,n=1/(c*l-e*h),q=this.worldX-b.worldX;b=this.worldY-b.worldY;this.ax=q*l*n-b*e*n;this.ay=b*c*n-q*h*n;l*=n;c*=n;e*=n;n*=h;h=l*this.a-e*this.c;e=l*this.b-e*this.d;l=c*this.c-n*this.a;n=c*this.d-n*this.b;this.ashearX=0;this.ascaleX=Math.sqrt(h*h+l*l);1E-4a)throw Error('index must be >= 0.');if(null==b)throw Error('name cannot be null.');this.index=a;this.name=b;this.parent=k}}();a.BoneData=b;(function(a){a[a.Normal=0]='Normal';a[a.OnlyTranslation=1]='OnlyTranslation';a[a.NoRotationOrReflection=2]='NoRotationOrReflection';a[a.NoScale=3]='NoScale';a[a.NoScaleOrReflection=4]='NoScaleOrReflection'})(a.TransformMode|| +(a.TransformMode={}));var e=a.TransformMode})(spine||(spine={}));(function(a){var b=function(){return function(a,b){if(null==b)throw Error('data cannot be null.');this.time=a;this.data=b}}();a.Event=b})(spine||(spine={}));(function(a){var b=function(){return function(a){this.name=a}}();a.EventData=b})(spine||(spine={})); (function(a){var b=function(){function b(a,b){this.mix=1;this.bendDirection=0;if(null==a)throw Error('data cannot be null.');if(null==b)throw Error('skeleton cannot be null.');this.data=a;this.mix=a.mix;this.bendDirection=a.bendDirection;this.bones=[];for(var c=0;cb.ascaleX&&(c+=180);180c&&(c+=360);b.updateWorldTransformWith(b.ax,b.ay, -b.arotation+c*k,b.ascaleX,b.ascaleY,b.ashearX,b.ashearY)};b.prototype.apply2=function(b,d,h,k,l,m){if(0==m)d.updateWorldTransform();else{b.appliedValid||b.updateAppliedTransform();d.appliedValid||d.updateAppliedTransform();var c=b.ax,g=b.ay,e=b.ascaleX,n=b.ascaleY,r=d.ascaleX;if(0>e){e=-e;var t=180;var D=-1}else t=0,D=1;0>n&&(n=-n,D=-D);if(0>r){r=-r;var w=180}else w=0;var u=d.ax,v=b.a,z=b.b,G=b.c,I=b.d,K=1E-4>=Math.abs(e-n);if(K){var H=d.ay;var C=v*u+z*H+b.worldX;var P=G*u+I*H+b.worldY}else H=0,C= -v*u+b.worldX,P=G*u+b.worldY;var Q=b.parent;v=Q.a;z=Q.b;G=Q.c;I=Q.d;var T=1/(v*I-z*G);h-=Q.worldX;k-=Q.worldY;var fa=(h*I-k*z)*T-c,ja=(k*v-h*G)*T-g;h=C-Q.worldX;k=P-Q.worldY;z=(h*I-k*z)*T-c;v=(k*v-h*G)*T-g;h=Math.sqrt(z*z+v*v);z=d.data.length*r;a:if(K)z*=e,v=(fa*fa+ja*ja-h*h-z*z)/(2*h*z),-1>v?v=-1:1ja&&(I=-I),I=-(ja+I)/2,ja=I/T,G/=I,G=Math.abs(ja)=G&&(G=Math.acos(G),h=v*Math.cos(G)+h,k=z*Math.sin(G),I=h*h+k*k,IQ&&(n=G,Q=I,P=h,ia=k));K<=(T+Q)/2?(v=fa-Math.atan2(C*l,ja),l*=e):(v=fa-Math.atan2(ia*l,P),l*=n)}z=Math.atan2(H,u)*D;G=b.arotation;v=(v-z)*a.MathUtils.radDeg+t-G;180< -v?v-=360:-180>v&&(v+=360);b.updateWorldTransformWith(c,g,G+v*m,b.ascaleX,b.ascaleY,0,0);G=d.arotation;l=((l+z)*a.MathUtils.radDeg-d.ashearX)*D+w-G;180l&&(l+=360);d.updateWorldTransformWith(u,H,G+l*m,d.ascaleX,d.ascaleY,d.ashearX,d.ashearY)}};return b}();a.IkConstraint=b})(spine||(spine={}));(function(a){var b=function(){return function(a){this.order=0;this.bones=[];this.mix=this.bendDirection=1;this.name=a}}();a.IkConstraintData=b})(spine||(spine={})); +this.target,b=this.bones;switch(b.length){case 1:this.apply1(b[0],a.worldX,a.worldY,this.mix);break;case 2:this.apply2(b[0],b[1],a.worldX,a.worldY,this.bendDirection,this.mix)}};b.prototype.apply1=function(b,c,e,h){b.appliedValid||b.updateAppliedTransform();var d=b.parent,k=1/(d.a*d.d-d.b*d.c);c-=d.worldX;e-=d.worldY;d=Math.atan2((e*d.a-c*d.c)*k-b.ay,(c*d.d-e*d.b)*k-b.ax)*a.MathUtils.radDeg-b.ashearX-b.arotation;0>b.ascaleX&&(d+=180);180d&&(d+=360);b.updateWorldTransformWith(b.ax,b.ay, +b.arotation+d*h,b.ascaleX,b.ascaleY,b.ashearX,b.ashearY)};b.prototype.apply2=function(b,c,e,h,l,n){if(0==n)c.updateWorldTransform();else{b.appliedValid||b.updateAppliedTransform();c.appliedValid||c.updateAppliedTransform();var d=b.ax,k=b.ay,g=b.ascaleX,p=b.ascaleY,r=c.ascaleX;if(0>g){g=-g;var u=180;var E=-1}else u=0,E=1;0>p&&(p=-p,E=-E);if(0>r){r=-r;var v=180}else v=0;var t=c.ax,z=b.a,w=b.b,I=b.c,H=b.d,K=1E-4>=Math.abs(g-p);if(K){var C=c.ay;var D=z*t+w*C+b.worldX;var Q=I*t+H*C+b.worldY}else C=0,D= +z*t+b.worldX,Q=I*t+b.worldY;var M=b.parent;z=M.a;w=M.b;I=M.c;H=M.d;var X=1/(z*H-w*I);e-=M.worldX;h-=M.worldY;var ka=(e*H-h*w)*X-d,ja=(h*z-e*I)*X-k;e=D-M.worldX;h=Q-M.worldY;w=(e*H-h*w)*X-d;z=(h*z-e*I)*X-k;e=Math.sqrt(w*w+z*z);w=c.data.length*r;a:if(K)w*=g,z=(ka*ka+ja*ja-e*e-w*w)/(2*e*w),-1>z?z=-1:1ja&&(H=-H),H=-(ja+H)/2,ja=H/X,I/=H,I=Math.abs(ja)=I&&(I=Math.acos(I),e=z*Math.cos(I)+e,h=w*Math.sin(I),H=e*e+h*h,HM&&(p=I,M=H,Q=e,ba=h));K<=(X+M)/2?(z=ka-Math.atan2(D*l,ja),l*=g):(z=ka-Math.atan2(ba*l,Q),l*=p)}w=Math.atan2(C,t)*E;I=b.arotation;z=(z-w)*a.MathUtils.radDeg+u-I;180< +z?z-=360:-180>z&&(z+=360);b.updateWorldTransformWith(d,k,I+z*n,b.ascaleX,b.ascaleY,0,0);I=c.arotation;l=((l+w)*a.MathUtils.radDeg-c.ashearX)*E+v-I;180l&&(l+=360);c.updateWorldTransformWith(t,C,I+l*n,c.ascaleX,c.ascaleY,c.ashearX,c.ashearY)}};return b}();a.IkConstraint=b})(spine||(spine={}));(function(a){var b=function(){return function(a){this.order=0;this.bones=[];this.mix=this.bendDirection=1;this.name=a}}();a.IkConstraintData=b})(spine||(spine={})); (function(a){var b=function(){function b(a,b){this.translateMix=this.rotateMix=this.spacing=this.position=0;this.spaces=[];this.positions=[];this.world=[];this.curves=[];this.lengths=[];this.segments=[];if(null==a)throw Error('data cannot be null.');if(null==b)throw Error('skeleton cannot be null.');this.data=a;this.bones=[];for(var c=0,d=a.bones.length;ca.MathUtils.PI?Q-=a.MathUtils.PI2:Q<-a.MathUtils.PI&&(Q+=a.MathUtils.PI2);Q*=d;T=Math.cos(Q);fa=Math.sin(Q);I.a=T*H-fa*K;I.b=T*C-fa*P;I.c=fa*H+T*K;I.d=fa*C+T*P}I.appliedValid= -!1}}}};b.prototype.computeWorldPositions=function(c,d,h,k,l){var g=this.target,q=this.position,p=this.spaces,e=a.Utils.setArraySize(this.positions,3*d+2),n=c.closed,r=c.worldVerticesLength,t=r/6,D=b.NONE;if(!c.constantSpeed){var w=c.lengths;t-=n?1:2;var u=w[t];k&&(q*=u);if(l)for(var v=0;vI&&(I+=u),l=0;else if(0>I){D!=b.BEFORE&&(D=b.BEFORE,c.computeWorldVertices(g,2,4,z,0,2));this.addBeforePosition(I, -z,0,e,k);continue}else if(I>u){D!=b.AFTER&&(D=b.AFTER,c.computeWorldVertices(g,r-6,4,z,0,2));this.addAfterPosition(I-u,z,0,e,k);continue}for(;;l++){var K=w[l];if(!(I>K)){if(0==l)I/=K;else{var H=w[l-1];I=(I-H)/(K-H)}break}}l!=D&&(D=l,n&&l==t?(c.computeWorldVertices(g,r-4,4,z,0,2),c.computeWorldVertices(g,0,4,z,4,2)):c.computeWorldVertices(g,6*l+2,8,z,0,2));this.addCurvePosition(I,z[0],z[1],z[2],z[3],z[4],z[5],z[6],z[7],e,k,h||0I&&(I+=g),l=0;else if(0>I){this.addBeforePosition(I,z,0,e,k);continue}else if(I>g){this.addAfterPosition(I-g,z,r-4,e,k);continue}for(;;l++)if(ma=c[l],!(I>ma)){0==l?I/=ma:(H=c[l-1],I=(I-H)/(ma-H));break}if(l!=D){D= -l;var ba=6*l;w=z[ba];u=z[ba+1];K=z[ba+2];C=z[ba+3];P=z[ba+4];Q=z[ba+5];T=z[ba+6];fa=z[ba+7];ja=.03*(w-2*K+P);ia=.03*(u-2*C+Q);H=.006*(3*(K-P)-w+T);N=.006*(3*(C-Q)-u+fa);ma=2*ja+H;V=2*ia+N;ja=.3*(K-w)+ja+.16666667*H;ia=.3*(C-u)+ia+.16666667*N;ca=Math.sqrt(ja*ja+ia*ia);t[0]=ca;for(ba=1;8>ba;ba++)ja+=ma,ia+=V,ma+=H,V+=N,ca+=Math.sqrt(ja*ja+ia*ia),t[ba]=ca;ja+=ma;ia+=V;ca+=Math.sqrt(ja*ja+ia*ia);t[8]=ca;ja+=ma+H;ia+=V+N;ca+=Math.sqrt(ja*ja+ia*ia);t[9]=ca;N=0}for(I*=ca;;N++)if(ma=t[N],!(I>ma)){0==N?I/= -ma:(H=t[N-1],I=N+(I-H)/(ma-H));break}this.addCurvePosition(.1*I,w,u,K,C,P,Q,T,fa,e,k,h||0a.MathUtils.PI?M-=a.MathUtils.PI2:M<-a.MathUtils.PI&&(M+=a.MathUtils.PI2);M*=c;X=Math.cos(M);ka=Math.sin(M);H.a=X*C-ka*K;H.b=X*D-ka*Q;H.c=ka*C+X*K;H.d=ka*D+X*Q}H.appliedValid= +!1}}}};b.prototype.computeWorldPositions=function(d,c,e,h,l){var k=this.target,q=this.position,m=this.spaces,g=a.Utils.setArraySize(this.positions,3*c+2),p=d.closed,r=d.worldVerticesLength,u=r/6,E=b.NONE;if(!d.constantSpeed){var v=d.lengths;u-=p?1:2;var t=v[u];h&&(q*=t);if(l)for(var z=0;zH&&(H+=t),l=0;else if(0>H){E!=b.BEFORE&&(E=b.BEFORE,d.computeWorldVertices(k,2,4,w,0,2));this.addBeforePosition(H, +w,0,g,h);continue}else if(H>t){E!=b.AFTER&&(E=b.AFTER,d.computeWorldVertices(k,r-6,4,w,0,2));this.addAfterPosition(H-t,w,0,g,h);continue}for(;;l++){var K=v[l];if(!(H>K)){if(0==l)H/=K;else{var C=v[l-1];H=(H-C)/(K-C)}break}}l!=E&&(E=l,p&&l==u?(d.computeWorldVertices(k,r-4,4,w,0,2),d.computeWorldVertices(k,0,4,w,4,2)):d.computeWorldVertices(k,6*l+2,8,w,0,2));this.addCurvePosition(H,w[0],w[1],w[2],w[3],w[4],w[5],w[6],w[7],g,h,e||0H&&(H+=k),l=0;else if(0>H){this.addBeforePosition(H,w,0,g,h);continue}else if(H>k){this.addAfterPosition(H-k,w,r-4,g,h);continue}for(;;l++)if(la=d[l],!(H>la)){0==l?H/=la:(C=d[l-1],H=(H-C)/(la-C));break}if(l!=E){E= +l;var da=6*l;v=w[da];t=w[da+1];K=w[da+2];D=w[da+3];Q=w[da+4];M=w[da+5];X=w[da+6];ka=w[da+7];ja=.03*(v-2*K+Q);ba=.03*(t-2*D+M);C=.006*(3*(K-Q)-v+X);N=.006*(3*(D-M)-t+ka);la=2*ja+C;T=2*ba+N;ja=.3*(K-v)+ja+.16666667*C;ba=.3*(D-t)+ba+.16666667*N;aa=Math.sqrt(ja*ja+ba*ba);u[0]=aa;for(da=1;8>da;da++)ja+=la,ba+=T,la+=C,T+=N,aa+=Math.sqrt(ja*ja+ba*ba),u[da]=aa;ja+=la;ba+=T;aa+=Math.sqrt(ja*ja+ba*ba);u[8]=aa;ja+=la+C;ba+=T+N;aa+=Math.sqrt(ja*ja+ba*ba);u[9]=aa;N=0}for(H*=aa;;N++)if(la=u[N],!(H>la)){0==N?H/= +la:(C=u[N-1],H=N+(H-C)/(la-C));break}this.addCurvePosition(.1*H,v,t,K,D,Q,M,X,ka,g,h,e||0d.status?c.rawAssets[b]=d.responseText:c.errors[b]="Couldn't load text "+b+': status '+d.status+', '+d.responseText)};d.open('GET',b,!0);d.send()}};a.prototype.loadJson=function(a,b){var c=this;b=this.pathPrefix+b;if(this.queueAsset(a,null,b)){var d= -new XMLHttpRequest;d.onreadystatechange=function(){d.readyState==XMLHttpRequest.DONE&&(200<=d.status&&300>d.status?c.rawAssets[b]=JSON.parse(d.responseText):c.errors[b]="Couldn't load text "+b+': status '+d.status+', '+d.responseText)};d.open('GET',b,!0);d.send()}};a.prototype.loadTexture=function(a,b,c){var d=this;c=this.pathPrefix+c;if(this.queueAsset(a,b,c)){var g=new Image;g.src=c;g.crossOrigin='anonymous';g.onload=function(a){d.rawAssets[c]=g};g.onerror=function(a){d.errors[c]="Couldn't load image "+ -c}}};a.prototype.get=function(a,b){b=this.pathPrefix+b;a=this.clientAssets[a];return null===a||void 0===a?!0:a.assets[b]};a.prototype.updateClientAssets=function(a){for(var b=0;b=this.minX&&a<=this.maxX&&b>=this.minY&&b<=this.maxY};b.prototype.aabbIntersectsSegment=function(a,b,d,k){var c=this.minX,g=this.minY,h=this.maxX,p=this.maxY;if(a<=c&&d<=c||b<=g&&k<=g||a>=h&&d>=h||b>=p&&k>=p)return!1;d=(k-b)/(d-a);k=d*(c-a)+b;if(k>g&&kg&&kc&&gc&&ga.minX&&this.minYa.minY};b.prototype.containsPoint=function(a,b){for(var c=this.polygons,d=0,g=c.length;d=d||e=d){var n=a[q]; -n+(d-p)/(e-p)*(a[g]-n)=n&&v<=D||v>=D&&v<=n)&&(v>=b&&v<=k||v>=k&&v<=b)&&(n=(e*z-h*u)/G,(n>= -r&&n<=w||n>=w&&n<=r)&&(n>=d&&n<=l||n>=l&&n<=d)))return!0;n=D;r=w}return!1};b.prototype.getPolygon=function(a){if(null==a)throw Error('boundingBox cannot be null.');a=this.boundingBoxes.indexOf(a);return-1==a?null:this.polygons[a]};b.prototype.getWidth=function(){return this.maxX-this.minX};b.prototype.getHeight=function(){return this.maxY-this.minY};return b}();a.SkeletonBounds=b})(spine||(spine={})); -(function(a){var b=function(){function b(){this.triangulator=new a.Triangulator;this.clippingPolygon=[];this.clipOutput=[];this.clippedVertices=[];this.clippedTriangles=[];this.scratch=[]}b.prototype.clipStart=function(c,d){if(null!=this.clipAttachment)return 0;this.clipAttachment=d;var g=d.worldVerticesLength,k=a.Utils.setArraySize(this.clippingPolygon,g);d.computeWorldVertices(c,0,g,k,0,2);c=this.clippingPolygon;b.makeClockwise(c);c=this.clippingPolygons=this.triangulator.decompose(c,this.triangulator.triangulate(c)); -d=0;for(g=c.length;d>1,ea=this.clipOutput,qa=a.Utils.setArraySize(c,N+sa*D),oa=0;oac))for(p=0,c=b-2,e=b>>1;pd.status?c.rawAssets[b]=d.responseText:c.errors[b]="Couldn't load text "+b+': status '+d.status+', '+d.responseText)};d.open('GET',b,!0);d.send()}};a.prototype.loadJson=function(a,b){var c=this;b=this.pathPrefix+b;if(this.queueAsset(a,null,b)){var d= +new XMLHttpRequest;d.onreadystatechange=function(){d.readyState==XMLHttpRequest.DONE&&(200<=d.status&&300>d.status?c.rawAssets[b]=JSON.parse(d.responseText):c.errors[b]="Couldn't load text "+b+': status '+d.status+', '+d.responseText)};d.open('GET',b,!0);d.send()}};a.prototype.loadTexture=function(a,b,d){var c=this;d=this.pathPrefix+d;if(this.queueAsset(a,b,d)){var e=new Image;e.src=d;e.crossOrigin='anonymous';e.onload=function(a){c.rawAssets[d]=e};e.onerror=function(a){c.errors[d]="Couldn't load image "+ +d}}};a.prototype.get=function(a,b){b=this.pathPrefix+b;a=this.clientAssets[a];return null===a||void 0===a?!0:a.assets[b]};a.prototype.updateClientAssets=function(a){for(var b=0;b=this.minX&&a<=this.maxX&&b>=this.minY&&b<=this.maxY};b.prototype.aabbIntersectsSegment=function(a,b,e,h){var c=this.minX,d=this.minY,k=this.maxX,m=this.maxY;if(a<=c&&e<=c||b<=d&&h<=d||a>=k&&e>=k||b>=m&&h>=m)return!1;e=(h-b)/(e-a);h=e*(c-a)+b;if(h>d&&hd&&hc&&dc&&da.minX&&this.minYa.minY};b.prototype.containsPoint=function(a,b){for(var c=this.polygons,d=0,e=c.length;d=e||g=e){var p=a[q]; +p+(e-m)/(g-m)*(a[d]-p)=p&&z<=E||z>=E&&z<=p)&&(z>=b&&z<=h||z>=h&&z<=b)&&(p=(g*w-k*t)/I,(p>= +r&&p<=v||p>=v&&p<=r)&&(p>=e&&p<=l||p>=l&&p<=e)))return!0;p=E;r=v}return!1};b.prototype.getPolygon=function(a){if(null==a)throw Error('boundingBox cannot be null.');a=this.boundingBoxes.indexOf(a);return-1==a?null:this.polygons[a]};b.prototype.getWidth=function(){return this.maxX-this.minX};b.prototype.getHeight=function(){return this.maxY-this.minY};return b}();a.SkeletonBounds=b})(spine||(spine={})); +(function(a){var b=function(){function b(){this.triangulator=new a.Triangulator;this.clippingPolygon=[];this.clipOutput=[];this.clippedVertices=[];this.clippedTriangles=[];this.scratch=[]}b.prototype.clipStart=function(d,c){if(null!=this.clipAttachment)return 0;this.clipAttachment=c;var e=c.worldVerticesLength,h=a.Utils.setArraySize(this.clippingPolygon,e);c.computeWorldVertices(d,0,e,h,0,2);d=this.clippingPolygon;b.makeClockwise(d);d=this.clippingPolygons=this.triangulator.decompose(d,this.triangulator.triangulate(d)); +c=0;for(e=d.length;c>1,fa=this.clipOutput,oa=a.Utils.setArraySize(g,N+pa*E),ma=0;mad))for(m=0,d=b-2,g=b>>1;m=c.length&&(c.length=a+1);c[a]||(c[a]={});c[a][b]=d};a.prototype.getAttachment=function(a,b){return(a=this.attachments[a])?a[b]:null};a.prototype.attachAll=function(a,b){for(var c=0,d=0;d=c.length&&(c.length=a+1);c[a]||(c[a]={});c[a][b]=e};a.prototype.getAttachment=function(a,b){return(a=this.attachments[a])?a[b]:null};a.prototype.attachAll=function(a,b){for(var c=0,d=0;db)throw Error('index must be >= 0.');if(null==c)throw Error('name cannot be null.');if(null==g)throw Error('boneData cannot be null.');this.index=b;this.name=c;this.boneData=g}}();a.SlotData=b})(spine||(spine={})); -(function(a){var b=function(){function a(a){this._image=a}a.prototype.getImage=function(){return this._image};a.filterFromString=function(a){switch(a.toLowerCase()){case 'nearest':return d.Nearest;case 'linear':return d.Linear;case 'mipmap':return d.MipMap;case 'mipmapnearestnearest':return d.MipMapNearestNearest;case 'mipmaplinearnearest':return d.MipMapLinearNearest;case 'mipmapnearestlinear':return d.MipMapNearestLinear;case 'mipmaplinearlinear':return d.MipMapLinearLinear;default:throw Error('Unknown texture filter '+ -a);}};a.wrapFromString=function(a){switch(a.toLowerCase()){case 'mirroredtepeat':return c.MirroredRepeat;case 'clamptoedge':return c.ClampToEdge;case 'repeat':return c.Repeat;default:throw Error('Unknown texture wrap '+a);}};return a}();a.Texture=b;(function(a){a[a.Nearest=9728]='Nearest';a[a.Linear=9729]='Linear';a[a.MipMap=9987]='MipMap';a[a.MipMapNearestNearest=9984]='MipMapNearestNearest';a[a.MipMapLinearNearest=9985]='MipMapLinearNearest';a[a.MipMapNearestLinear=9986]='MipMapNearestLinear';a[a.MipMapLinearLinear= -9987]='MipMapLinearLinear'})(a.TextureFilter||(a.TextureFilter={}));var d=a.TextureFilter;(function(a){a[a.MirroredRepeat=33648]='MirroredRepeat';a[a.ClampToEdge=33071]='ClampToEdge';a[a.Repeat=10497]='Repeat'})(a.TextureWrap||(a.TextureWrap={}));var c=a.TextureWrap;b=function(){return function(){this.height=this.width=this.v2=this.u2=this.v=this.u=0;this.rotate=!1;this.originalHeight=this.originalWidth=this.offsetY=this.offsetX=0}}();a.TextureRegion=b})(spine||(spine={})); -(function(a){var b=function(){function b(a,b){this.pages=[];this.regions=[];this.load(a,b)}b.prototype.load=function(b,h){if(null==h)throw Error('textureLoader cannot be null.');b=new d(b);for(var k=Array(4),l=null;;){var p=b.readLine();if(null==p)break;p=p.trim();if(0==p.length)l=null;else if(l){var e=new g;e.name=p;e.page=l;e.rotate='true'==b.readValue();b.readTuple(k);p=parseInt(k[0]);var n=parseInt(k[1]);b.readTuple(k);var r=parseInt(k[0]),t=parseInt(k[1]);e.u=p/l.width;e.v=n/l.height;e.rotate? -(e.u2=(p+t)/l.width,e.v2=(n+r)/l.height):(e.u2=(p+r)/l.width,e.v2=(n+t)/l.height);e.x=p;e.y=n;e.width=Math.abs(r);e.height=Math.abs(t);4==b.readTuple(k)&&4==b.readTuple(k)&&b.readTuple(k);e.originalWidth=parseInt(k[0]);e.originalHeight=parseInt(k[1]);b.readTuple(k);e.offsetX=parseInt(k[0]);e.offsetY=parseInt(k[1]);e.index=parseInt(b.readValue());e.texture=l.texture;this.regions.push(e)}else l=new c,l.name=p,2==b.readTuple(k)&&(l.width=parseInt(k[0]),l.height=parseInt(k[1]),b.readTuple(k)),b.readTuple(k), -l.minFilter=a.Texture.filterFromString(k[0]),l.magFilter=a.Texture.filterFromString(k[1]),e=b.readValue(),l.uWrap=a.TextureWrap.ClampToEdge,l.vWrap=a.TextureWrap.ClampToEdge,'x'==e?l.uWrap=a.TextureWrap.Repeat:'y'==e?l.vWrap=a.TextureWrap.Repeat:'xy'==e&&(l.uWrap=l.vWrap=a.TextureWrap.Repeat),l.texture=h(p),l.texture.setFilters(l.minFilter,l.magFilter),l.texture.setWraps(l.uWrap,l.vWrap),l.width=l.texture.getImage().width,l.height=l.texture.getImage().height,this.pages.push(l)}};b.prototype.findRegion= -function(a){for(var b=0;b=this.lines.length?null:this.lines[this.index++]};a.prototype.readValue=function(){var a=this.readLine(),b=a.indexOf(':');if(-1==b)throw Error('Invalid line: '+ -a);return a.substring(b+1).trim()};a.prototype.readTuple=function(a){var b=this.readLine(),c=b.indexOf(':');if(-1==c)throw Error('Invalid line: '+b);var d=0;for(c+=1;3>d;d++){var g=b.indexOf(',',c);if(-1==g)break;a[d]=b.substr(c,g-c).trim();c=g+1}a[d]=b.substring(c).trim();return d+1};return a}(),c=function(){return function(){}}();a.TextureAtlasPage=c;var g=function(a){function b(){a.apply(this,arguments)}__extends(b,a);return b}(a.TextureRegion);a.TextureAtlasRegion=g})(spine||(spine={})); -(function(a){var b=function(){function b(b,d){this.shearMix=this.scaleMix=this.translateMix=this.rotateMix=0;this.temp=new a.Vector2;if(null==b)throw Error('data cannot be null.');if(null==d)throw Error('skeleton cannot be null.');this.data=b;this.rotateMix=b.rotateMix;this.translateMix=b.translateMix;this.scaleMix=b.scaleMix;this.shearMix=b.shearMix;this.bones=[];for(var c=0;ca.MathUtils.PI?K-=a.MathUtils.PI2:K<-a.MathUtils.PI&&(K+=a.MathUtils.PI2);K*=b;var H=Math.cos(K);K=Math.sin(K);u.a=H*z-K*G;u.b=H*v-K*I;u.c=K*z+H*G;u.d=K*v+H*I;v=!0}0!=d&&(v=this.temp,l.localToWorld(v.set(this.data.offsetX,this.data.offsetY)),u.worldX+=(v.x-u.worldX)*d,u.worldY+=(v.y-u.worldY)*d,v=!0);0a.MathUtils.PI?K-=a.MathUtils.PI2:K<-a.MathUtils.PI&&(K+=a.MathUtils.PI2),K=z+(K+n)*k,v=Math.sqrt(v*v+I*I),u.b=Math.cos(K)*v,u.d=Math.sin(K)*v,v=!0);v&&(u.appliedValid=!1)}};b.prototype.applyRelativeWorld=function(){var b=this.rotateMix,d=this.translateMix,h=this.scaleMix, -k=this.shearMix,l=this.target,m=l.a,q=l.b,p=l.c,e=l.d,n=0a.MathUtils.PI?K-=a.MathUtils.PI2:K<-a.MathUtils.PI&&(K+=a.MathUtils.PI2);K*=b;var H=Math.cos(K);K=Math.sin(K);u.a=H*v-K*G;u.b=H*z-K*I;u.c=K*v+H*G;u.d=K*z+H*I;v=!0}0!=d&&(v=this.temp,l.localToWorld(v.set(this.data.offsetX, -this.data.offsetY)),u.worldX+=v.x*d,u.worldY+=v.y*d,v=!0);0a.MathUtils.PI?K-=a.MathUtils.PI2:K<-a.MathUtils.PI&&(K+=a.MathUtils.PI2),z=u.b,I=u.d,K=Math.atan2(I,z)+(K-a.MathUtils.PI/2+n)*k,v=Math.sqrt(z*z+I*I),u.b=Math.cos(K)*v,u.d=Math.sin(K)*v,v=!0);v&&(u.appliedValid=!1)}};b.prototype.applyAbsoluteLocal=function(){var a= -this.rotateMix,b=this.translateMix,d=this.scaleMix,k=this.shearMix,l=this.target;l.appliedValid||l.updateAppliedTransform();for(var m=this.bones,q=0,p=m.length;qb)throw Error('index must be >= 0.');if(null==d)throw Error('name cannot be null.');if(null==c)throw Error('boneData cannot be null.');this.index=b;this.name=d;this.boneData=c}}();a.SlotData=b})(spine||(spine={})); +(function(a){var b=function(){function a(a){this._image=a}a.prototype.getImage=function(){return this._image};a.filterFromString=function(a){switch(a.toLowerCase()){case 'nearest':return e.Nearest;case 'linear':return e.Linear;case 'mipmap':return e.MipMap;case 'mipmapnearestnearest':return e.MipMapNearestNearest;case 'mipmaplinearnearest':return e.MipMapLinearNearest;case 'mipmapnearestlinear':return e.MipMapNearestLinear;case 'mipmaplinearlinear':return e.MipMapLinearLinear;default:throw Error('Unknown texture filter '+ +a);}};a.wrapFromString=function(a){switch(a.toLowerCase()){case 'mirroredtepeat':return d.MirroredRepeat;case 'clamptoedge':return d.ClampToEdge;case 'repeat':return d.Repeat;default:throw Error('Unknown texture wrap '+a);}};return a}();a.Texture=b;(function(a){a[a.Nearest=9728]='Nearest';a[a.Linear=9729]='Linear';a[a.MipMap=9987]='MipMap';a[a.MipMapNearestNearest=9984]='MipMapNearestNearest';a[a.MipMapLinearNearest=9985]='MipMapLinearNearest';a[a.MipMapNearestLinear=9986]='MipMapNearestLinear';a[a.MipMapLinearLinear= +9987]='MipMapLinearLinear'})(a.TextureFilter||(a.TextureFilter={}));var e=a.TextureFilter;(function(a){a[a.MirroredRepeat=33648]='MirroredRepeat';a[a.ClampToEdge=33071]='ClampToEdge';a[a.Repeat=10497]='Repeat'})(a.TextureWrap||(a.TextureWrap={}));var d=a.TextureWrap;b=function(){return function(){this.height=this.width=this.v2=this.u2=this.v=this.u=0;this.rotate=!1;this.originalHeight=this.originalWidth=this.offsetY=this.offsetX=0}}();a.TextureRegion=b})(spine||(spine={})); +(function(a){var b=function(){function b(a,b){this.pages=[];this.regions=[];this.load(a,b)}b.prototype.load=function(b,k){if(null==k)throw Error('textureLoader cannot be null.');b=new e(b);for(var h=Array(4),l=null;;){var m=b.readLine();if(null==m)break;m=m.trim();if(0==m.length)l=null;else if(l){var g=new c;g.name=m;g.page=l;g.rotate='true'==b.readValue();b.readTuple(h);m=parseInt(h[0]);var p=parseInt(h[1]);b.readTuple(h);var r=parseInt(h[0]),u=parseInt(h[1]);g.u=m/l.width;g.v=p/l.height;g.rotate? +(g.u2=(m+u)/l.width,g.v2=(p+r)/l.height):(g.u2=(m+r)/l.width,g.v2=(p+u)/l.height);g.x=m;g.y=p;g.width=Math.abs(r);g.height=Math.abs(u);4==b.readTuple(h)&&4==b.readTuple(h)&&b.readTuple(h);g.originalWidth=parseInt(h[0]);g.originalHeight=parseInt(h[1]);b.readTuple(h);g.offsetX=parseInt(h[0]);g.offsetY=parseInt(h[1]);g.index=parseInt(b.readValue());g.texture=l.texture;this.regions.push(g)}else l=new d,l.name=m,2==b.readTuple(h)&&(l.width=parseInt(h[0]),l.height=parseInt(h[1]),b.readTuple(h)),b.readTuple(h), +l.minFilter=a.Texture.filterFromString(h[0]),l.magFilter=a.Texture.filterFromString(h[1]),g=b.readValue(),l.uWrap=a.TextureWrap.ClampToEdge,l.vWrap=a.TextureWrap.ClampToEdge,'x'==g?l.uWrap=a.TextureWrap.Repeat:'y'==g?l.vWrap=a.TextureWrap.Repeat:'xy'==g&&(l.uWrap=l.vWrap=a.TextureWrap.Repeat),l.texture=k(m),l.texture.setFilters(l.minFilter,l.magFilter),l.texture.setWraps(l.uWrap,l.vWrap),l.width=l.texture.getImage().width,l.height=l.texture.getImage().height,this.pages.push(l)}};b.prototype.findRegion= +function(a){for(var b=0;b=this.lines.length?null:this.lines[this.index++]};a.prototype.readValue=function(){var a=this.readLine(),b=a.indexOf(':');if(-1==b)throw Error('Invalid line: '+ +a);return a.substring(b+1).trim()};a.prototype.readTuple=function(a){var b=this.readLine(),c=b.indexOf(':');if(-1==c)throw Error('Invalid line: '+b);var d=0;for(c+=1;3>d;d++){var e=b.indexOf(',',c);if(-1==e)break;a[d]=b.substr(c,e-c).trim();c=e+1}a[d]=b.substring(c).trim();return d+1};return a}(),d=function(){return function(){}}();a.TextureAtlasPage=d;var c=function(a){function b(){a.apply(this,arguments)}__extends(b,a);return b}(a.TextureRegion);a.TextureAtlasRegion=c})(spine||(spine={})); +(function(a){var b=function(){function b(b,c){this.shearMix=this.scaleMix=this.translateMix=this.rotateMix=0;this.temp=new a.Vector2;if(null==b)throw Error('data cannot be null.');if(null==c)throw Error('skeleton cannot be null.');this.data=b;this.rotateMix=b.rotateMix;this.translateMix=b.translateMix;this.scaleMix=b.scaleMix;this.shearMix=b.shearMix;this.bones=[];for(var d=0;da.MathUtils.PI?K-=a.MathUtils.PI2:K<-a.MathUtils.PI&&(K+=a.MathUtils.PI2);K*=b;var C=Math.cos(K);K=Math.sin(K);t.a=C*w-K*I;t.b=C*z-K*H;t.c=K*w+C*I;t.d=K*z+C*H;z=!0}0!=c&&(z=this.temp,l.localToWorld(z.set(this.data.offsetX,this.data.offsetY)),t.worldX+=(z.x-t.worldX)*c,t.worldY+=(z.y-t.worldY)*c,z=!0);0a.MathUtils.PI?K-=a.MathUtils.PI2:K<-a.MathUtils.PI&&(K+=a.MathUtils.PI2),K=w+(K+p)*h,z=Math.sqrt(z*z+H*H),t.b=Math.cos(K)*z,t.d=Math.sin(K)*z,z=!0);z&&(t.appliedValid=!1)}};b.prototype.applyRelativeWorld=function(){var b=this.rotateMix,c=this.translateMix,e=this.scaleMix, +h=this.shearMix,l=this.target,n=l.a,q=l.b,m=l.c,g=l.d,p=0a.MathUtils.PI?K-=a.MathUtils.PI2:K<-a.MathUtils.PI&&(K+=a.MathUtils.PI2);K*=b;var C=Math.cos(K);K=Math.sin(K);t.a=C*z-K*I;t.b=C*w-K*H;t.c=K*z+C*I;t.d=K*w+C*H;z=!0}0!=c&&(z=this.temp,l.localToWorld(z.set(this.data.offsetX, +this.data.offsetY)),t.worldX+=z.x*c,t.worldY+=z.y*c,z=!0);0a.MathUtils.PI?K-=a.MathUtils.PI2:K<-a.MathUtils.PI&&(K+=a.MathUtils.PI2),w=t.b,H=t.d,K=Math.atan2(H,w)+(K-a.MathUtils.PI/2+p)*h,z=Math.sqrt(w*w+H*H),t.b=Math.cos(K)*z,t.d=Math.sin(K)*z,z=!0);z&&(t.appliedValid=!1)}};b.prototype.applyAbsoluteLocal=function(){var a= +this.rotateMix,b=this.translateMix,e=this.scaleMix,h=this.shearMix,l=this.target;l.appliedValid||l.updateAppliedTransform();for(var n=this.bones,q=0,m=n.length;q>1,d=this.indicesArray,k=d.length=0;kthis.r?this.r=0:1this.g?this.g=0:1this.b?this.b=0:1this.a?this.a=0:1d?d:a};a.cosDeg=function(b){return Math.cos(b*a.degRad)};a.sinDeg=function(b){return Math.sin(b* -a.degRad)};a.signum=function(a){return 0a?-1:0};a.toInt=function(a){return 0a?-b:b};a.randomTriangular=function(b,d){return a.randomTriangularWith(b,d,.5*(b+d))};a.randomTriangularWith=function(a,b,d){var c=Math.random(),g=b-a;return c<=(d-a)/g?a+Math.sqrt(c*g*(d-a)):b-Math.sqrt((1-c)*g*(b-d))};a.PI=3.1415927;a.PI2=2*a.PI;a.radiansToDegrees=180/a.PI;a.radDeg=a.radiansToDegrees;a.degreesToRadians=a.PI/ -180;a.degRad=a.degreesToRadians;return a}();a.MathUtils=b;b=function(){function a(){}a.prototype.apply=function(a,b,d){return a+(b-a)*this.applyInternal(d)};return a}();a.Interpolation=b;b=function(a){function b(b){a.call(this);this.power=2;this.power=b}__extends(b,a);b.prototype.applyInternal=function(a){return.5>=a?Math.pow(2*a,this.power)/2:Math.pow(2*(a-1),this.power)/(0==this.power%2?-2:2)+1};return b}(b);a.Pow=b;b=function(a){function b(b){a.call(this,b)}__extends(b,a);b.prototype.applyInternal= -function(a){return Math.pow(a-1,this.power)*(0==this.power%2?-1:1)+1};return b}(b);a.PowOut=b;b=function(){function a(){}a.arrayCopy=function(a,b,d,k,l){for(var c=b;c=d?b:a.setArraySize(b,d,h)};a.newArray=function(a,b){for(var c=Array(a),d=0;d>1,d=this.indicesArray,e=d.length=0;ethis.r?this.r=0:1this.g?this.g=0:1this.b?this.b=0:1this.a?this.a=0:1e?e:a};a.cosDeg=function(b){return Math.cos(b*a.degRad)};a.sinDeg=function(b){return Math.sin(b* +a.degRad)};a.signum=function(a){return 0a?-1:0};a.toInt=function(a){return 0a?-b:b};a.randomTriangular=function(b,c){return a.randomTriangularWith(b,c,.5*(b+c))};a.randomTriangularWith=function(a,b,e){var c=Math.random(),d=b-a;return c<=(e-a)/d?a+Math.sqrt(c*d*(e-a)):b-Math.sqrt((1-c)*d*(b-e))};a.PI=3.1415927;a.PI2=2*a.PI;a.radiansToDegrees=180/a.PI;a.radDeg=a.radiansToDegrees;a.degreesToRadians=a.PI/ +180;a.degRad=a.degreesToRadians;return a}();a.MathUtils=b;b=function(){function a(){}a.prototype.apply=function(a,b,e){return a+(b-a)*this.applyInternal(e)};return a}();a.Interpolation=b;b=function(a){function b(b){a.call(this);this.power=2;this.power=b}__extends(b,a);b.prototype.applyInternal=function(a){return.5>=a?Math.pow(2*a,this.power)/2:Math.pow(2*(a-1),this.power)/(0==this.power%2?-2:2)+1};return b}(b);a.Pow=b;b=function(a){function b(b){a.call(this,b)}__extends(b,a);b.prototype.applyInternal= +function(a){return Math.pow(a-1,this.power)*(0==this.power%2?-1:1)+1};return b}(b);a.PowOut=b;b=function(){function a(){}a.arrayCopy=function(a,b,e,h,l){for(var c=b;c=c?b:a.setArraySize(b,c,e)};a.newArray=function(a,b){for(var c=Array(a),d=0;dthis.maxDelta&&(this.delta=this.maxDelta);this.lastTime=a;this.frameCount++;1=this.values.length};a.prototype.addValue=function(a){this.addedValuesthis.values.length-1&&(this.lastValue=0);this.dirty=!0};a.prototype.getMean=function(){if(this.hasEnoughData()){if(this.dirty){for(var a=0,b=0;b>1)*w,I>v.length&&(v=this.vertices=a.Utils.newFloatArray(I)),z.computeWorldVertices(u,0,z.worldVerticesLength,v,0,w),K=z.triangles,H=z.uvs,z=z.region.renderObject.texture;else{v instanceof a.ClippingAttachment&&q.clipStart(u,v);continue}if(null!=z){if(!this.material.map){var C= -this.material;C.map=z.texture;C.needsUpdate=!0}z=u.bone.skeleton.color;C=u.color;u=this.tempColor;u.set(z.r*C.r*G.r,z.g*C.g*G.g,z.b*C.b*G.b,z.a*C.a*G.a);if(q.isClipping()){q.clipTriangles(v,I,K,K.length,H,u,null,!1);v=q.clippedVertices;K=q.clippedTriangles;if(null!=this.vertexEffect)for(C=this.vertexEffect,G=v,z=0,H=v.length;z>1)*v,H>z.length&&(z=this.vertices=a.Utils.newFloatArray(H)),w.computeWorldVertices(t,0,w.worldVerticesLength,z,0,v),K=w.triangles,C=w.uvs,w=w.region.renderObject.texture;else{z instanceof a.ClippingAttachment&&q.clipStart(t,z);continue}if(null!=w){if(!this.material.map){var D= +this.material;D.map=w.texture;D.needsUpdate=!0}w=t.bone.skeleton.color;D=t.color;t=this.tempColor;t.set(w.r*D.r*I.r,w.g*D.g*I.g,w.b*D.b*I.b,w.a*D.a*I.a);if(q.isClipping()){q.clipTriangles(z,H,K,K.length,C,t,null,!1);z=q.clippedVertices;K=q.clippedTriangles;if(null!=this.vertexEffect)for(D=this.vertexEffect,I=z,w=0,C=z.length;wg;++g)b[g]=0;for(g=0;30-e>g;++g)b[g+e]=g/e| -0;e=d;for(g=0;30>g;++g)c[g]=e,e+=1<g;++g)b.table[g]=0;for(g=0;d>g;++g)b.table[c[e+g]]++;for(g=h=b.table[0]=0;16>g;++g)I[g]=h,h+=b.table[g];for(g=0;d>g;++g)c[e+g]&&(b.trans[I[c[e+g]]++]=g)}function m(b,c,e){if(!c)return e;for(;24>b.bitcount;)b.tag|=b.source[b.sourceIndex++]<>>16-c;return b.tag>>>=c,b.bitcount-=c,d+e}function q(b,c){for(;24>b.bitcount;)b.tag|=b.source[b.sourceIndex++]<>>=1,++g,e+=c.table[g],d-=c.table[g];while(0<=d);return b.tag=h,b.bitcount-=g,c.trans[e+d]}function p(b,c,d){for(;;){var g=q(b,c);if(256===g)return e;if(256>g)b.dest[b.destLen++]=g;else{var h;g-=257;g=m(b,t[g],D[g]);var k=q(b,d);for(h=k=b.destLen-m(b,w[k],u[k]);k+g>h;++h)b.dest[b.destLen++]=b.dest[h]}}}var e=0,n=new g,r=new g,t=new Uint8Array(30),D=new Uint16Array(30),w=new Uint8Array(30),u=new Uint16Array(30),v=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4, -12,3,13,2,14,1,15]),z=new g,G=new Uint8Array(320),I=new Uint16Array(16);(function(b,c){var e;for(e=0;7>e;++e)b.table[e]=0;b.table[7]=24;b.table[8]=152;b.table[9]=112;for(e=0;24>e;++e)b.trans[e]=256+e;for(e=0;144>e;++e)b.trans[24+e]=e;for(e=0;8>e;++e)b.trans[168+e]=280+e;for(e=0;112>e;++e)b.trans[176+e]=144+e;for(e=0;5>e;++e)c.table[e]=0;c.table[5]=32;for(e=0;32>e;++e)c.trans[e]=e})(n,r);k(t,D,4,3);k(w,u,2,1);t[28]=0;D[28]=258;d.exports=function(b,c){b=new h(b,c);do{c=b;c.bitcount--||(c.tag=c.source[c.sourceIndex++], -c.bitcount=7);var d=1&c.tag;switch(c=(c.tag>>>=1,d),m(b,2,0)){case 0:var g,k=g=void 0;for(d=b;8 -t;++t)G[t]=0;for(t=0;w>t;++t){var D=m(k,3,0);G[v[t]]=D}l(z,G,0,19);for(t=0;g+d>t;)switch(w=q(k,z),w){case 16:D=G[t-1];for(w=m(k,2,3);w;--w)G[t++]=D;break;case 17:for(w=m(k,3,3);w;--w)G[t++]=0;break;case 18:for(w=m(k,7,11);w;--w)G[t++]=0;break;default:G[t++]=w}l(u,G,0,g);l(H,G,g,d);d=p(b,b.ltree,b.dtree);break;default:d=-3}if(d!==e)throw Error('Data error');}while(!c);return b.destLenb.descender,'Descender should be negative (e.g. -512).'),this.names={fontFamily:{en:b.familyName||' '},fontSubfamily:{en:b.styleName||' '}, +function(b){if(b===a.TextureWrap.ClampToEdge)return THREE.ClampToEdgeWrapping;if(b===a.TextureWrap.MirroredRepeat)return THREE.MirroredRepeatWrapping;if(b===a.TextureWrap.Repeat)return THREE.RepeatWrapping;throw Error('Unknown texture wrap: '+b);};return c}(a.Texture);b.ThreeJsTexture=e})(a.threejs||(a.threejs={}))})(spine||(spine={})); +(function(a){'object'===typeof exports&&'undefined'!==typeof module?module.exports=a():'function'===typeof define&&define.amd?define([],a):('undefined'!==typeof window?window:'undefined'!==typeof global?global:'undefined'!==typeof self?self:this).opentype=a()})(function(){return function c(b,e,d){function k(l,q){if(!e[l]){if(!b[l]){var m='function'==typeof require&&require;if(!q&&m)return m(l,!0);if(h)return h(l,!0);q=Error("Cannot find module '"+l+"'");throw q.code='MODULE_NOT_FOUND',q;}q=e[l]={exports:{}}; +b[l][0].call(q.exports,function(c){var g=b[l][1][c];return k(g?g:c)},q,q.exports,c,b,e,d)}return e[l].exports}for(var h='function'==typeof require&&require,l=0;le;++e)b[e]=0;for(e=0;30-g>e;++e)b[e+g]=e/g| +0;g=d;for(e=0;30>e;++e)c[e]=g,g+=1<e;++e)b.table[e]=0;for(e=0;d>e;++e)b.table[c[g+e]]++;for(e=h=b.table[0]=0;16>e;++e)H[e]=h,h+=b.table[e];for(e=0;d>e;++e)c[g+e]&&(b.trans[H[c[g+e]]++]=e)}function n(b,c,g){if(!c)return g;for(;24>b.bitcount;)b.tag|=b.source[b.sourceIndex++]<>>16-c;return b.tag>>>=c,b.bitcount-=c,d+g}function q(b,c){for(;24>b.bitcount;)b.tag|=b.source[b.sourceIndex++]<>>=1,++e,g+=c.table[e],d-=c.table[e];while(0<=d);return b.tag=h,b.bitcount-=e,c.trans[g+d]}function m(b,c,d){for(;;){var e=q(b,c);if(256===e)return g;if(256>e)b.dest[b.destLen++]=e;else{var h;e-=257;e=n(b,u[e],E[e]);var k=q(b,d);for(h=k=b.destLen-n(b,v[k],t[k]);k+e>h;++h)b.dest[b.destLen++]=b.dest[h]}}}var g=0,p=new c,r=new c,u=new Uint8Array(30),E=new Uint16Array(30),v=new Uint8Array(30),t=new Uint16Array(30),z=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4, +12,3,13,2,14,1,15]),w=new c,I=new Uint8Array(320),H=new Uint16Array(16);(function(b,c){var g;for(g=0;7>g;++g)b.table[g]=0;b.table[7]=24;b.table[8]=152;b.table[9]=112;for(g=0;24>g;++g)b.trans[g]=256+g;for(g=0;144>g;++g)b.trans[24+g]=g;for(g=0;8>g;++g)b.trans[168+g]=280+g;for(g=0;112>g;++g)b.trans[176+g]=144+g;for(g=0;5>g;++g)c.table[g]=0;c.table[5]=32;for(g=0;32>g;++g)c.trans[g]=g})(p,r);h(u,E,4,3);h(v,t,2,1);u[28]=0;E[28]=258;e.exports=function(b,c){b=new k(b,c);do{c=b;c.bitcount--||(c.tag=c.source[c.sourceIndex++], +c.bitcount=7);var d=1&c.tag;switch(c=(c.tag>>>=1,d),n(b,2,0)){case 0:var e,h=e=void 0;for(d=b;8 +u;++u)I[u]=0;for(u=0;C>u;++u){var E=n(h,3,0);I[z[u]]=E}l(w,I,0,19);for(u=0;e+d>u;)switch(C=q(h,w),C){case 16:E=I[u-1];for(C=n(h,2,3);C;--C)I[u++]=E;break;case 17:for(C=n(h,3,3);C;--C)I[u++]=0;break;case 18:for(C=n(h,7,11);C;--C)I[u++]=0;break;default:I[u++]=C}l(t,I,0,e);l(v,I,e,d);d=m(b,b.ltree,b.dtree);break;default:d=-3}if(d!==g)throw Error('Data error');}while(!c);return b.destLenb.descender,'Descender should be negative (e.g. -512).'),this.names={fontFamily:{en:b.familyName||' '},fontSubfamily:{en:b.styleName||' '}, fullName:{en:b.fullName||b.familyName+' '+b.styleName},postScriptName:{en:b.postScriptName||b.familyName+b.styleName},designer:{en:b.designer||' '},designerURL:{en:b.designerURL||' '},manufacturer:{en:b.manufacturer||' '},manufacturerURL:{en:b.manufacturerURL||' '},license:{en:b.license||' '},licenseURL:{en:b.licenseURL||' '},version:{en:b.version||'Version 0.1'},description:{en:b.description||' '},copyright:{en:b.copyright||' '},trademark:{en:b.trademark||' '}},this.unitsPerEm=b.unitsPerEm||1E3, -this.ascender=b.ascender,this.descender=b.descender,this.createdTimestamp=b.createdTimestamp,this.tables={os2:{usWeightClass:b.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:b.widthClass||this.usWidthClasses.MEDIUM,fsSelection:b.fsSelection||this.fsSelectionValues.REGULAR}});this.supported=!0;this.glyphs=new m.GlyphSet(this,b.glyphs||[]);this.encoding=new l.DefaultEncoding(this);this.substitution=new q(this);this.tables=this.tables||{}}var h=b('./path'),k=b('./tables/sfnt'),l=b('./encoding'), -m=b('./glyphset'),q=b('./substitution'),p=b('./util');g.prototype.hasChar=function(b){return null!==this.encoding.charToGlyphIndex(b)};g.prototype.charToGlyphIndex=function(b){return this.encoding.charToGlyphIndex(b)};g.prototype.charToGlyph=function(b){b=this.charToGlyphIndex(b);b=this.glyphs.get(b);return b||(b=this.glyphs.get(0)),b};g.prototype.stringToGlyphs=function(b){for(var c=[],e=0;e=d;){var h=d+g>>>1,e=b[h].tag;if(e===c)return h;c>e?d=h+1:g=h-1}return-d-1}var h=b('./check');d.exports={searchTag:g,binSearch:function(b,c){for(var d=0,g=b.length-1;g>=d;){var h=d+g>>>1,e=b[h];if(e===c)return h;c>e?d=h+1:g=h-1}return-d-1},getScriptNames:function(){var b=this.getGsubTable();return b?b.scripts.map(function(b){return b.tag}):[]},getScriptTable:function(b,c){var d=this.getGsubTable(c);if(d){c=d.scripts;d=g(d.scripts,b);if(0<=d)return c[d].script;b={tag:b,script:{defaultLangSys:{reserved:0, -reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return c.splice(-1-d,0,b.script),b}},getLangSysTable:function(b,c,d){if(b=this.getScriptTable(b,d)){if('DFLT'===c)return b.defaultLangSys;var h=g(b.langSysRecords,c);if(0<=h)return b.langSysRecords[h].langSys;if(d)return c={tag:c,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}},b.langSysRecords.splice(-1-h,0,c),c.langSys}},getFeatureTable:function(b,c,d,g){if(b=this.getLangSysTable(b,c,g)){var k;b=b.featureIndexes;c=this.font.tables.gsub.features; -for(var e=0;e=c[g-1].tag,'Features must be added in alphabetical order.'),k={tag:d,feature:{params:0,lookupListIndexes:[]}},c.push(k),b.push(g),k.feature}},getLookupTable:function(b,c,d,g,h){if(b=this.getFeatureTable(b,c,d,h)){var e;b=b.lookupListIndexes;c=this.font.tables.gsub.lookups;for(d=0;dd;d++){var g=b[d],h=g.end;for(g=g.start;h>=g;g++)c.push(g)}return c}}},{'./check':2}],9:[function(b,d,c){function g(c,d){b('fs').readFile(c,function(b,c){return b?d(b.message):void d(null,t.nodeBufferToArrayBuffer(c))})}function h(b,c){var d=new XMLHttpRequest;d.open('get',b,!0);d.responseType='arraybuffer';d.onload=function(){return 200!==d.status?c('Font could not be loaded: '+ -d.statusText):c(null,d.response)};d.send()}function k(b,c){for(var d=[],e=12,g=0;c>g;g+=1){var h=n.getTag(b,e),k=n.getULong(b,e+4),l=n.getULong(b,e+8),m=n.getULong(b,e+12);d.push({tag:h,checksum:k,offset:l,length:m,compression:!1});e+=16}return d}function l(b,c){if('WOFF'===c.compression){b=new Uint8Array(b.buffer,c.offset+2,c.compressedLength-2);var d=new Uint8Array(c.originalLength);if(q(b,d),d.byteLength!==c.originalLength)throw Error('Decompression error: '+c.tag+" decompressed length doesn't match recorded length"); -return{data:new DataView(d.buffer,0),offset:0}}return{data:b,offset:c.offset}}function m(b){var c=new e.Font({empty:!0});b=new DataView(b,0);var d=n.getTag(b,0);if(d===String.fromCharCode(0,1,0,0)){c.outlinesFormat='truetype';d=n.getUShort(b,4);var g=k(b,d)}else if('OTTO'===d)c.outlinesFormat='cff',d=n.getUShort(b,4),g=k(b,d);else{if('wOFF'!==d)throw Error('Unsupported OpenType signature '+d);g=n.getTag(b,4);if(g===String.fromCharCode(0,1,0,0))c.outlinesFormat='truetype';else{if('OTTO'!==g)throw Error('Unsupported OpenType flavor '+ -d);c.outlinesFormat='cff'}g=d=n.getUShort(b,12);for(var h=[],m=44,q=0;g>q;q+=1){var r=n.getTag(b,m),t=n.getULong(b,m+4),ma=n.getULong(b,m+8),O=n.getULong(b,m+12);h.push({tag:r,offset:t,compression:O>ma?'WOFF':!1,compressedLength:ma,originalLength:O});m+=20}g=h}for(h=0;d>h;h+=1)switch(m=g[h],m.tag){case 'cmap':m=l(b,m);c.tables.cmap=D.parse(m.data,m.offset);c.encoding=new p.CmapEncoding(c.tables.cmap);break;case 'fvar':var ua=m;break;case 'head':m=l(b,m);c.tables.head=I.parse(m.data,m.offset);c.unitsPerEm= -c.tables.head.unitsPerEm;var ha=c.tables.head.indexToLocFormat;break;case 'hhea':m=l(b,m);c.tables.hhea=K.parse(m.data,m.offset);c.ascender=c.tables.hhea.ascender;c.descender=c.tables.hhea.descender;c.numberOfHMetrics=c.tables.hhea.numberOfHMetrics;break;case 'hmtx':var ka=m;break;case 'ltag':m=l(b,m);var va=P.parse(m.data,m.offset);break;case 'maxp':m=l(b,m);c.tables.maxp=T.parse(m.data,m.offset);c.numGlyphs=c.tables.maxp.numGlyphs;break;case 'name':var ra=m;break;case 'OS/2':m=l(b,m);c.tables.os2= -ja.parse(m.data,m.offset);break;case 'post':m=l(b,m);c.tables.post=ia.parse(m.data,m.offset);c.glyphNames=new p.GlyphNames(c.tables.post);break;case 'glyf':var ya=m;break;case 'loca':var U=m;break;case 'CFF ':var Ea=m;break;case 'kern':var la=m;break;case 'GPOS':var xa=m;break;case 'GSUB':var Da=m;break;case 'meta':var Ka=m}ra=l(b,ra);if(c.tables.name=fa.parse(ra.data,ra.offset,va),c.names=c.tables.name,ya&&U)ha=0===ha,U=l(b,U),U=Q.parse(U.data,U.offset,c.numGlyphs,ha),ya=l(b,ya),c.glyphs=v.parse(ya.data, -ya.offset,U,c);else{if(!Ea)throw Error("Font doesn't contain TrueType or CFF outlines.");ya=l(b,Ea);w.parse(ya.data,ya.offset,c)}ka=l(b,ka);(H.parse(ka.data,ka.offset,c.numberOfHMetrics,c.numGlyphs,c.glyphs),p.addGlyphNames(c),la)?(la=l(b,la),c.kerningPairs=C.parse(la.data,la.offset)):c.kerningPairs={};xa&&(xa=l(b,xa),z.parse(xa.data,xa.offset,c));Da&&(Da=l(b,Da),c.tables.gsub=G.parse(Da.data,Da.offset));ua&&(ua=l(b,ua),c.tables.fvar=u.parse(ua.data,ua.offset,c.names));Ka&&(Ka=l(b,Ka),c.tables.meta= -N.parse(Ka.data,Ka.offset),c.metas=c.tables.meta);return c}var q=b('tiny-inflate'),p=b('./encoding'),e=b('./font');d=b('./glyph');var n=b('./parse'),r=b('./path'),t=b('./util'),D=b('./tables/cmap'),w=b('./tables/cff'),u=b('./tables/fvar'),v=b('./tables/glyf'),z=b('./tables/gpos'),G=b('./tables/gsub'),I=b('./tables/head'),K=b('./tables/hhea'),H=b('./tables/hmtx'),C=b('./tables/kern'),P=b('./tables/ltag'),Q=b('./tables/loca'),T=b('./tables/maxp'),fa=b('./tables/name'),ja=b('./tables/os2'),ia=b('./tables/post'), -N=b('./tables/meta');c._parse=n;c.Font=e.Font;c.Glyph=d.Glyph;c.Path=r.Path;c.parse=m;c.load=function(b,c){('undefined'==typeof window?g:h)(b,function(b,d){if(b)return c(b);try{var e=m(d)}catch(na){return c(na,null)}return c(null,e)})};c.loadSync=function(c){c=b('fs').readFileSync(c);return m(t.nodeBufferToArrayBuffer(c))}},{'./encoding':4,'./font':5,'./glyph':6,'./parse':10,'./path':11,'./tables/cff':14,'./tables/cmap':15,'./tables/fvar':16,'./tables/glyf':17,'./tables/gpos':18,'./tables/gsub':19, -'./tables/head':20,'./tables/hhea':21,'./tables/hmtx':22,'./tables/kern':23,'./tables/loca':24,'./tables/ltag':25,'./tables/maxp':26,'./tables/meta':27,'./tables/name':28,'./tables/os2':29,'./tables/post':30,'./util':33,fs:void 0,'tiny-inflate':1}],10:[function(b,d,c){function g(b,c){return b.getUint16(c,!1)}function h(b,c){this.data=b;this.offset=c;this.relativeOffset=0}var k=b('./check');c.getByte=function(b,c){return b.getUint8(c)};c.getCard8=c.getByte;c.getUShort=c.getCard16=g;c.getShort=function(b, -c){return b.getInt16(c,!1)};c.getULong=function(b,c){return b.getUint32(c,!1)};c.getFixed=function(b,c){var d=b.getInt16(c,!+1);b=b.getUint16(c+2,!1);return d+b/65535};c.getTag=function(b,c){for(var d='',g=c;c+4>g;g+=1)d+=String.fromCharCode(b.getInt8(g));return d};c.getOffset=function(b,c,d){for(var e=0,g=0;d>g;g+=1)e<<=8,e+=b.getUint8(c+g);return e};c.getBytes=function(b,c,d){for(var e=[];d>c;c+=1)e.push(b.getUint8(c));return e};c.bytesToString=function(b){for(var c='',d=0;dh;h++)g+=String.fromCharCode(c.getUint8(d+h));return g};h.prototype.parseTag=function(){return this.parseString(4)};h.prototype.parseLongDateTime=function(){var b=c.getULong(this.data,this.offset+this.relativeOffset+4);return b-=2082844800,this.relativeOffset+= -8,b};h.prototype.parseVersion=function(){var b=g(this.data,this.offset+this.relativeOffset),c=g(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,b+c/4096/10};h.prototype.skip=function(b,c){void 0===c&&(c=1);this.relativeOffset+=l[b]*c};h.prototype.parseOffset16List=h.prototype.parseUShortList=function(b){void 0===b&&(b=this.parseUShort());for(var c=Array(b),d=this.data,g=this.offset+this.relativeOffset,h=0;b>h;h++)c[h]=d.getUint16(g),g+=2;return this.relativeOffset+=2*b, -c};h.prototype.parseList=function(b,c){c||(c=b,b=this.parseUShort());for(var d=Array(b),g=0;b>g;g++)d[g]=c.call(this);return d};h.prototype.parseRecordList=function(b,c){c||(c=b,b=this.parseUShort());for(var d=Array(b),g=Object.keys(c),h=0;b>h;h++){for(var k={},l=0;lk;k++){var l=c[k];if(0!==l)if(this.relativeOffset=l,b){for(var m=this.parseOffset16List(),q=Array(m.length),v=0;vc;c++)b[c]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:b}}k.assert(!1,'0x'+b.toString(16)+': Coverage format must be 1 or 2.')};h.prototype.parseClassDef=function(){var b=this.offset+this.relativeOffset,c=this.parseUShort();return 1===c? -{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()}:2===c?{format:2,ranges:this.parseRecordList({start:h.uShort,end:h.uShort,classId:h.uShort})}:void k.assert(!1,'0x'+b.toString(16)+': ClassDef format must be 1 or 2.')};h.list=function(b,c){return function(){return this.parseList(b,c)}};h.recordList=function(b,c){return function(){return this.parseRecordList(b,c)}};h.pointer=function(b){return function(){return this.parsePointer(b)}};h.tag=h.prototype.parseTag;h.byte=h.prototype.parseByte; -h.uShort=h.offset16=h.prototype.parseUShort;h.uShortList=h.prototype.parseUShortList;h.struct=h.prototype.parseStruct;h.coverage=h.prototype.parseCoverage;h.classDef=h.prototype.parseClassDef;var m={reserved:h.uShort,reqFeatureIndex:h.uShort,featureIndexes:h.uShortList};h.prototype.parseScriptList=function(){return this.parsePointer(h.recordList({tag:h.tag,script:h.pointer({defaultLangSys:h.pointer(m),langSysRecords:h.recordList({tag:h.tag,langSys:h.pointer(m)})})}))};h.prototype.parseFeatureList= -function(){return this.parsePointer(h.recordList({tag:h.tag,feature:h.pointer({featureParams:h.offset16,lookupListIndexes:h.uShortList})}))};h.prototype.parseLookupList=function(b){return this.parsePointer(h.list(h.pointer(function(){var c=this.parseUShort();k.argument(1<=c&&8>=c,'GSUB lookup type '+c+' unknown.');var d=this.parseUShort(),g=16&d;return{lookupType:c,lookupFlag:d,subtables:this.parseList(h.pointer(b[c])),markFilteringSet:g?this.parseUShort():void 0}})))};c.Parser=h},{'./check':2}], -11:[function(b,d,c){function g(){this.commands=[];this.fill='black';this.stroke=null;this.strokeWidth=1}g.prototype.moveTo=function(b,c){this.commands.push({type:'M',x:b,y:c})};g.prototype.lineTo=function(b,c){this.commands.push({type:'L',x:b,y:c})};g.prototype.curveTo=g.prototype.bezierCurveTo=function(b,c,d,g,q,p){this.commands.push({type:'C',x1:b,y1:c,x2:d,y2:g,x:q,y:p})};g.prototype.quadTo=g.prototype.quadraticCurveTo=function(b,c,d,g){this.commands.push({type:'Q',x1:b,y1:c,x:d,y:g})};g.prototype.close= -g.prototype.closePath=function(){this.commands.push({type:'Z'})};g.prototype.extend=function(b){b.commands&&(b=b.commands);Array.prototype.push.apply(this.commands,b)};g.prototype.draw=function(b){b.beginPath();for(var c=0;c'};c.Path=g},{}],12:[function(b,d,c){function g(b,c,d){b=b.subtables;for(var g=0;gq&&(q=-1-q,b.coverage.glyphs.splice(q,0,d),b.substitute.splice(q,0,0));b.substitute[q]=c.by};c.prototype.addAlternate=function(b,c,d,q){b=this.getLookupTable(d,q,b,3,!0);b=g(b,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});h.assert(1===b.coverage.format,'Ligature: unable to modify coverage table format '+b.coverage.format);d=c.sub;q=this.binSearch(b.coverage.glyphs,d);0>q&&(q=-1-q,b.coverage.glyphs.splice(q,0,d),b.alternateSets.splice(q,0,0));b.alternateSets[q]=c.by};c.prototype.addLigature= -function(b,c,d,g){b=this.getLookupTable(d||'DFLT',g||'DFLT',b,4,!0);(d=b.subtables[0])||(d={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},b.subtables[0]=d);h.assert(1===d.coverage.format,'Ligature: unable to modify coverage table format '+d.coverage.format);g=c.sub[0];b=c.sub.slice(1);c={ligGlyph:c.by,components:b};var k=this.binSearch(d.coverage.glyphs,g);if(0<=k){d=d.ligatureSets[k];for(g=0;g -l;l++)if(k[l]!==b[l]){k=!1;break a}k=!0}}if(k)return}d.push(c)}else k=-1-k,d.coverage.glyphs.splice(k,0,g),d.ligatureSets.splice(k,0,[c])};c.prototype.getFeature=function(b,c,d){if(c=c||'DFLT',d=d||'DFLT',/ss\d\d/.test(b))return this.getSingle(b,c,d);switch(b){case 'aalt':case 'salt':return this.getSingle(b,c,d).concat(this.getAlternates(b,c,d));case 'dlig':case 'liga':case 'rlig':return this.getLigatures(b,c,d)}};c.prototype.add=function(b,c,d,g){if(d=d||'DFLT',g=g||'DFLT',/ss\d\d/.test(b))return this.addSingle(b, -c,d,g);switch(b){case 'aalt':case 'salt':return'number'==typeof c.by?this.addSingle(b,c,d,g):this.addAlternate(b,c,d,g);case 'dlig':case 'liga':case 'rlig':return this.addLigature(b,c,d,g)}};d.exports=c},{'./check':2,'./layout':8}],13:[function(b,d,c){function g(b,c,d){var e;for(e=0;eh;h++)g[h+1]={name:b+h,type:'TABLE',value:d(c[h],h)};return g}function l(b,c,d){var e=c.length,g=[];g[0]={name:b+'Count',type:'USHORT',value:e};for(b=0;e>b;b++)g=g.concat(d(c[b],b));return g}function m(b){1===b.format?g.call(this,'coverageTable',[{name:'coverageFormat', -type:'USHORT',value:1}].concat(h('glyph',b.glyphs))):n.assert(!1,"Can't create coverage table format 2 yet.")}function q(b){g.call(this,'scriptListTable',l('scriptRecord',b,function(b,c){var d=b.script,e=d.defaultLangSys;return n.assert(!!e,'Unable to write GSUB: script '+b.tag+' has no default language system.'),[{name:'scriptTag'+c,type:'TAG',value:b.tag},{name:'script'+c,type:'TABLE',value:new g('scriptTable',[{name:'defaultLangSys',type:'TABLE',value:new g('defaultLangSys',[{name:'lookupOrder', -type:'USHORT',value:0},{name:'reqFeatureIndex',type:'USHORT',value:e.reqFeatureIndex}].concat(h('featureIndex',e.featureIndexes)))}].concat(l('langSys',d.langSysRecords,function(b,c){var d=b.langSys;return[{name:'langSysTag'+c,type:'TAG',value:b.tag},{name:'langSys'+c,type:'TABLE',value:new g('langSys',[{name:'lookupOrder',type:'USHORT',value:0},{name:'reqFeatureIndex',type:'USHORT',value:d.reqFeatureIndex}].concat(h('featureIndex',d.featureIndexes)))}]})))}]}))}function p(b){g.call(this,'featureListTable', -l('featureRecord',b,function(b,c){var d=b.feature;return[{name:'featureTag'+c,type:'TAG',value:b.tag},{name:'feature'+c,type:'TABLE',value:new g('featureTable',[{name:'featureParams',type:'USHORT',value:d.featureParams}].concat(h('lookupListIndex',d.lookupListIndexes)))}]}))}function e(b,c){g.call(this,'lookupListTable',k('lookup',b,function(b){var d=c[b.lookupType];return n.assert(!!d,'Unable to write GSUB lookup type '+b.lookupType+' tables.'),new g('lookupTable',[{name:'lookupType',type:'USHORT', -value:b.lookupType},{name:'lookupFlag',type:'USHORT',value:b.lookupFlag}].concat(k('subtable',b.subtables,d)))}))}var n=b('./check'),r=b('./types').encode,t=b('./types').sizeOf;g.prototype.encode=function(){return r.TABLE(this)};g.prototype.sizeOf=function(){return t.TABLE(this)};m.prototype=Object.create(g.prototype);m.prototype.constructor=m;q.prototype=Object.create(g.prototype);q.prototype.constructor=q;p.prototype=Object.create(g.prototype);p.prototype.constructor=p;e.prototype=Object.create(g.prototype); -e.prototype.constructor=e;c.Record=c.Table=g;c.Coverage=m;c.ScriptList=q;c.FeatureList=p;c.LookupList=e;c.ushortList=h;c.tableList=k;c.recordList=l},{'./check':2,'./types':32}],14:[function(b,d,c){function g(b,c){if(b===c)return!0;if(Array.isArray(b)&&Array.isArray(c)){if(b.length!==c.length)return!1;for(var d=0;de;e+=1)g.push(v.getOffset(b,n,l)),n+=l;k=m+g[k]}else k=c+2;for(e=0;e>4;g&=15;if(15===e)break; -if(c+=d[e],15===g)break;c+=d[g]}return parseFloat(c)}if(32<=c&&246>=c)return c-139;if(247<=c&&250>=c)return d=b.parseByte(),256*(c-247)+d+108;if(251<=c&&254>=c)return d=b.parseByte(),256*-(c-251)-d-108;throw Error('Invalid b0 '+c);}function l(b,c,d){var e=new v.Parser(b,void 0!==c?c:0);c=[];var g=[];for(d=void 0!==d?d:b.length;e.relativeOffset=b?(12===b&&(b=1200+e.parseByte()),c.push([b,g]),g=[]):g.push(k(e,b));d={};for(b=0;b=c?w.cffStandardStrings[c]:b[c-391]}function q(b,c,d){for(var e={},g=0;g>1;q.length=0;t=!0}function h(d){for(var D, -v,z,I,G,P,K,U,L,la,xa=0;xaMath.abs(la-w)?C=L+q.shift():w=la+q.shift(); -p.curveTo(k,l,m,n,G,P);p.curveTo(K,U,L,la,C,w);break;default:console.log('Glyph '+c.index+': unknown operator 1200'+G),q.length=0}break;case 14:0>3;break;case 21:2>16);xa+=2;break;case 29:G=q.pop()+b.gsubrsBias;(G=b.gsubrs[G])&&h(G);break;case 30:for(;0G?console.log('Glyph '+c.index+': unknown operator '+G):247>G?q.push(G-139):251>G?(D=d[xa],xa+=1,q.push(256*(G-247)+D+108)):255>G?(D=d[xa],xa+=1,q.push(256*-(G-251)-D-108)):(D=d[xa],v=d[xa+1],z=d[xa+2], -I=d[xa+3],xa+=4,q.push((D<<24|v<<16|z<<8|I)/65536))}}var k,l,m,n,p=new z.Path,q=[],r=0,t=!1,u=b.defaultWidthX,H=!1,C=0,w=0;return h(d),c.advanceWidth=u,p}function e(b){return 1240>b.length?107:33900>b.length?1131:32768}function n(b,c){var d,e=w.cffStandardStrings.indexOf(b);return e=c.indexOf(b),0<=e?d=e+w.cffStandardStrings.length:(d=w.cffStandardStrings.length+c.length,c.push(b)),d}function r(b,c,d){for(var e={},h=0;h=d;){var h=d+e>>>1,g=b[h].tag;if(g===c)return h;c>g?d=h+1:e=h-1}return-d-1}var k=b('./check');e.exports={searchTag:c,binSearch:function(b,c){for(var d=0,e=b.length-1;e>=d;){var h=d+e>>>1,g=b[h];if(g===c)return h;c>g?d=h+1:e=h-1}return-d-1},getScriptNames:function(){var b=this.getGsubTable();return b?b.scripts.map(function(b){return b.tag}):[]},getScriptTable:function(b,d){var e=this.getGsubTable(d);if(e){d=e.scripts;e=c(e.scripts,b);if(0<=e)return d[e].script;b={tag:b,script:{defaultLangSys:{reserved:0, +reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return d.splice(-1-e,0,b.script),b}},getLangSysTable:function(b,d,e){if(b=this.getScriptTable(b,e)){if('DFLT'===d)return b.defaultLangSys;var h=c(b.langSysRecords,d);if(0<=h)return b.langSysRecords[h].langSys;if(e)return d={tag:d,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}},b.langSysRecords.splice(-1-h,0,d),d.langSys}},getFeatureTable:function(b,c,d,e){if(b=this.getLangSysTable(b,c,e)){var h;b=b.featureIndexes;c=this.font.tables.gsub.features; +for(var g=0;g=c[e-1].tag,'Features must be added in alphabetical order.'),h={tag:d,feature:{params:0,lookupListIndexes:[]}},c.push(h),b.push(e),h.feature}},getLookupTable:function(b,c,d,e,k){if(b=this.getFeatureTable(b,c,d,k)){var g;b=b.lookupListIndexes;c=this.font.tables.gsub.lookups;for(d=0;dd;d++){var e=b[d],h=e.end;for(e=e.start;h>=e;e++)c.push(e)}return c}}},{'./check':2}],9:[function(b,e,d){function c(c,g){b('fs').readFile(c,function(b,c){return b?g(b.message):void g(null,u.nodeBufferToArrayBuffer(c))})}function k(b,c){var g=new XMLHttpRequest;g.open('get',b,!0);g.responseType='arraybuffer';g.onload=function(){return 200!==g.status?c('Font could not be loaded: '+ +g.statusText):c(null,g.response)};g.send()}function h(b,c){for(var g=[],d=12,e=0;c>e;e+=1){var h=p.getTag(b,d),k=p.getULong(b,d+4),l=p.getULong(b,d+8),m=p.getULong(b,d+12);g.push({tag:h,checksum:k,offset:l,length:m,compression:!1});d+=16}return g}function l(b,c){if('WOFF'===c.compression){b=new Uint8Array(b.buffer,c.offset+2,c.compressedLength-2);var g=new Uint8Array(c.originalLength);if(q(b,g),g.byteLength!==c.originalLength)throw Error('Decompression error: '+c.tag+" decompressed length doesn't match recorded length"); +return{data:new DataView(g.buffer,0),offset:0}}return{data:b,offset:c.offset}}function n(b){var c=new g.Font({empty:!0});b=new DataView(b,0);var d=p.getTag(b,0);if(d===String.fromCharCode(0,1,0,0)){c.outlinesFormat='truetype';d=p.getUShort(b,4);var e=h(b,d)}else if('OTTO'===d)c.outlinesFormat='cff',d=p.getUShort(b,4),e=h(b,d);else{if('wOFF'!==d)throw Error('Unsupported OpenType signature '+d);e=p.getTag(b,4);if(e===String.fromCharCode(0,1,0,0))c.outlinesFormat='truetype';else{if('OTTO'!==e)throw Error('Unsupported OpenType flavor '+ +d);c.outlinesFormat='cff'}e=d=p.getUShort(b,12);for(var k=[],n=44,q=0;e>q;q+=1){var r=p.getTag(b,n),u=p.getULong(b,n+4),la=p.getULong(b,n+8),O=p.getULong(b,n+12);k.push({tag:r,offset:u,compression:O>la?'WOFF':!1,compressedLength:la,originalLength:O});n+=20}e=k}for(k=0;d>k;k+=1)switch(n=e[k],n.tag){case 'cmap':n=l(b,n);c.tables.cmap=E.parse(n.data,n.offset);c.encoding=new m.CmapEncoding(c.tables.cmap);break;case 'fvar':var ya=n;break;case 'head':n=l(b,n);c.tables.head=H.parse(n.data,n.offset);c.unitsPerEm= +c.tables.head.unitsPerEm;var ea=c.tables.head.indexToLocFormat;break;case 'hhea':n=l(b,n);c.tables.hhea=K.parse(n.data,n.offset);c.ascender=c.tables.hhea.ascender;c.descender=c.tables.hhea.descender;c.numberOfHMetrics=c.tables.hhea.numberOfHMetrics;break;case 'hmtx':var qa=n;break;case 'ltag':n=l(b,n);var wa=Q.parse(n.data,n.offset);break;case 'maxp':n=l(b,n);c.tables.maxp=X.parse(n.data,n.offset);c.numGlyphs=c.tables.maxp.numGlyphs;break;case 'name':var ua=n;break;case 'OS/2':n=l(b,n);c.tables.os2= +ja.parse(n.data,n.offset);break;case 'post':n=l(b,n);c.tables.post=ba.parse(n.data,n.offset);c.glyphNames=new m.GlyphNames(c.tables.post);break;case 'glyf':var ta=n;break;case 'loca':var S=n;break;case 'CFF ':var Aa=n;break;case 'kern':var ha=n;break;case 'GPOS':var Fa=n;break;case 'GSUB':var Wa=n;break;case 'meta':var Ia=n}ua=l(b,ua);if(c.tables.name=ka.parse(ua.data,ua.offset,wa),c.names=c.tables.name,ta&&S)ea=0===ea,S=l(b,S),S=M.parse(S.data,S.offset,c.numGlyphs,ea),ta=l(b,ta),c.glyphs=z.parse(ta.data, +ta.offset,S,c);else{if(!Aa)throw Error("Font doesn't contain TrueType or CFF outlines.");ta=l(b,Aa);v.parse(ta.data,ta.offset,c)}qa=l(b,qa);(C.parse(qa.data,qa.offset,c.numberOfHMetrics,c.numGlyphs,c.glyphs),m.addGlyphNames(c),ha)?(ha=l(b,ha),c.kerningPairs=D.parse(ha.data,ha.offset)):c.kerningPairs={};Fa&&(Fa=l(b,Fa),w.parse(Fa.data,Fa.offset,c));Wa&&(Wa=l(b,Wa),c.tables.gsub=I.parse(Wa.data,Wa.offset));ya&&(ya=l(b,ya),c.tables.fvar=t.parse(ya.data,ya.offset,c.names));Ia&&(Ia=l(b,Ia),c.tables.meta= +N.parse(Ia.data,Ia.offset),c.metas=c.tables.meta);return c}var q=b('tiny-inflate'),m=b('./encoding'),g=b('./font');e=b('./glyph');var p=b('./parse'),r=b('./path'),u=b('./util'),E=b('./tables/cmap'),v=b('./tables/cff'),t=b('./tables/fvar'),z=b('./tables/glyf'),w=b('./tables/gpos'),I=b('./tables/gsub'),H=b('./tables/head'),K=b('./tables/hhea'),C=b('./tables/hmtx'),D=b('./tables/kern'),Q=b('./tables/ltag'),M=b('./tables/loca'),X=b('./tables/maxp'),ka=b('./tables/name'),ja=b('./tables/os2'),ba=b('./tables/post'), +N=b('./tables/meta');d._parse=p;d.Font=g.Font;d.Glyph=e.Glyph;d.Path=r.Path;d.parse=n;d.load=function(b,g){('undefined'==typeof window?c:k)(b,function(b,c){if(b)return g(b);try{var d=n(c)}catch(ra){return g(ra,null)}return g(null,d)})};d.loadSync=function(c){c=b('fs').readFileSync(c);return n(u.nodeBufferToArrayBuffer(c))}},{'./encoding':4,'./font':5,'./glyph':6,'./parse':10,'./path':11,'./tables/cff':14,'./tables/cmap':15,'./tables/fvar':16,'./tables/glyf':17,'./tables/gpos':18,'./tables/gsub':19, +'./tables/head':20,'./tables/hhea':21,'./tables/hmtx':22,'./tables/kern':23,'./tables/loca':24,'./tables/ltag':25,'./tables/maxp':26,'./tables/meta':27,'./tables/name':28,'./tables/os2':29,'./tables/post':30,'./util':33,fs:void 0,'tiny-inflate':1}],10:[function(b,e,d){function c(b,c){return b.getUint16(c,!1)}function k(b,c){this.data=b;this.offset=c;this.relativeOffset=0}var h=b('./check');d.getByte=function(b,c){return b.getUint8(c)};d.getCard8=d.getByte;d.getUShort=d.getCard16=c;d.getShort=function(b, +c){return b.getInt16(c,!1)};d.getULong=function(b,c){return b.getUint32(c,!1)};d.getFixed=function(b,c){var g=b.getInt16(c,!1);b=b.getUint16(c+2,!1);return g+b/65535};d.getTag=function(b,c){for(var g='',d=c;c+4>d;d+=1)g+=String.fromCharCode(b.getInt8(d));return g};d.getOffset=function(b,c,g){for(var d=0,e=0;g>e;e+=1)d<<=8,d+=b.getUint8(c+e);return d};d.getBytes=function(b,c,g){for(var d=[];g>c;c+=1)d.push(b.getUint8(c));return d};d.bytesToString=function(b){for(var c='',g=0;ge;e++)d+=String.fromCharCode(c.getUint8(g+e));return d};k.prototype.parseTag=function(){return this.parseString(4)};k.prototype.parseLongDateTime=function(){var b=d.getULong(this.data,this.offset+this.relativeOffset+4);return b-=2082844800,this.relativeOffset+= +8,b};k.prototype.parseVersion=function(){var b=c(this.data,this.offset+this.relativeOffset),d=c(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,b+d/4096/10};k.prototype.skip=function(b,c){void 0===c&&(c=1);this.relativeOffset+=l[b]*c};k.prototype.parseOffset16List=k.prototype.parseUShortList=function(b){void 0===b&&(b=this.parseUShort());for(var c=Array(b),g=this.data,d=this.offset+this.relativeOffset,e=0;b>e;e++)c[e]=g.getUint16(d),d+=2;return this.relativeOffset+=2*b, +c};k.prototype.parseList=function(b,c){c||(c=b,b=this.parseUShort());for(var g=Array(b),d=0;b>d;d++)g[d]=c.call(this);return g};k.prototype.parseRecordList=function(b,c){c||(c=b,b=this.parseUShort());for(var g=Array(b),d=Object.keys(c),e=0;b>e;e++){for(var h={},k=0;kh;h++){var k=c[h];if(0!==k)if(this.relativeOffset=k,b){for(var l=this.parseOffset16List(),n=Array(l.length),q=0;qc;c++)b[c]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:b}}h.assert(!1,'0x'+b.toString(16)+': Coverage format must be 1 or 2.')};k.prototype.parseClassDef=function(){var b=this.offset+this.relativeOffset,c=this.parseUShort();return 1===c? +{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()}:2===c?{format:2,ranges:this.parseRecordList({start:k.uShort,end:k.uShort,classId:k.uShort})}:void h.assert(!1,'0x'+b.toString(16)+': ClassDef format must be 1 or 2.')};k.list=function(b,c){return function(){return this.parseList(b,c)}};k.recordList=function(b,c){return function(){return this.parseRecordList(b,c)}};k.pointer=function(b){return function(){return this.parsePointer(b)}};k.tag=k.prototype.parseTag;k.byte=k.prototype.parseByte; +k.uShort=k.offset16=k.prototype.parseUShort;k.uShortList=k.prototype.parseUShortList;k.struct=k.prototype.parseStruct;k.coverage=k.prototype.parseCoverage;k.classDef=k.prototype.parseClassDef;var n={reserved:k.uShort,reqFeatureIndex:k.uShort,featureIndexes:k.uShortList};k.prototype.parseScriptList=function(){return this.parsePointer(k.recordList({tag:k.tag,script:k.pointer({defaultLangSys:k.pointer(n),langSysRecords:k.recordList({tag:k.tag,langSys:k.pointer(n)})})}))};k.prototype.parseFeatureList= +function(){return this.parsePointer(k.recordList({tag:k.tag,feature:k.pointer({featureParams:k.offset16,lookupListIndexes:k.uShortList})}))};k.prototype.parseLookupList=function(b){return this.parsePointer(k.list(k.pointer(function(){var c=this.parseUShort();h.argument(1<=c&&8>=c,'GSUB lookup type '+c+' unknown.');var g=this.parseUShort(),d=16&g;return{lookupType:c,lookupFlag:g,subtables:this.parseList(k.pointer(b[c])),markFilteringSet:d?this.parseUShort():void 0}})))};d.Parser=k},{'./check':2}], +11:[function(b,e,d){function c(){this.commands=[];this.fill='black';this.stroke=null;this.strokeWidth=1}c.prototype.moveTo=function(b,c){this.commands.push({type:'M',x:b,y:c})};c.prototype.lineTo=function(b,c){this.commands.push({type:'L',x:b,y:c})};c.prototype.curveTo=c.prototype.bezierCurveTo=function(b,c,d,e,q,m){this.commands.push({type:'C',x1:b,y1:c,x2:d,y2:e,x:q,y:m})};c.prototype.quadTo=c.prototype.quadraticCurveTo=function(b,c,d,e){this.commands.push({type:'Q',x1:b,y1:c,x:d,y:e})};c.prototype.close= +c.prototype.closePath=function(){this.commands.push({type:'Z'})};c.prototype.extend=function(b){b.commands&&(b=b.commands);Array.prototype.push.apply(this.commands,b)};c.prototype.draw=function(b){b.beginPath();for(var c=0;c'};d.Path=c},{}],12:[function(b,e,d){function c(b,c,d){b=b.subtables;for(var e=0;eq&&(q=-1-q,b.coverage.glyphs.splice(q,0,e),b.substitute.splice(q,0,0));b.substitute[q]=d.by};d.prototype.addAlternate=function(b,d,e,q){b=this.getLookupTable(e,q,b,3,!0);b=c(b,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});k.assert(1===b.coverage.format,'Ligature: unable to modify coverage table format '+b.coverage.format);e=d.sub;q=this.binSearch(b.coverage.glyphs,e);0>q&&(q=-1-q,b.coverage.glyphs.splice(q,0,e),b.alternateSets.splice(q,0,0));b.alternateSets[q]=d.by};d.prototype.addLigature= +function(b,c,d,e){b=this.getLookupTable(d||'DFLT',e||'DFLT',b,4,!0);(d=b.subtables[0])||(d={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},b.subtables[0]=d);k.assert(1===d.coverage.format,'Ligature: unable to modify coverage table format '+d.coverage.format);e=c.sub[0];b=c.sub.slice(1);c={ligGlyph:c.by,components:b};var h=this.binSearch(d.coverage.glyphs,e);if(0<=h){d=d.ligatureSets[h];for(e=0;e +l;l++)if(h[l]!==b[l]){h=!1;break a}h=!0}}if(h)return}d.push(c)}else h=-1-h,d.coverage.glyphs.splice(h,0,e),d.ligatureSets.splice(h,0,[c])};d.prototype.getFeature=function(b,c,d){if(c=c||'DFLT',d=d||'DFLT',/ss\d\d/.test(b))return this.getSingle(b,c,d);switch(b){case 'aalt':case 'salt':return this.getSingle(b,c,d).concat(this.getAlternates(b,c,d));case 'dlig':case 'liga':case 'rlig':return this.getLigatures(b,c,d)}};d.prototype.add=function(b,c,d,e){if(d=d||'DFLT',e=e||'DFLT',/ss\d\d/.test(b))return this.addSingle(b, +c,d,e);switch(b){case 'aalt':case 'salt':return'number'==typeof c.by?this.addSingle(b,c,d,e):this.addAlternate(b,c,d,e);case 'dlig':case 'liga':case 'rlig':return this.addLigature(b,c,d,e)}};e.exports=d},{'./check':2,'./layout':8}],13:[function(b,e,d){function c(b,c,g){var d;for(d=0;dh;h++)e[h+1]={name:b+h,type:'TABLE',value:g(c[h],h)};return e}function l(b,c,g){var d=c.length,e=[];e[0]={name:b+'Count',type:'USHORT',value:d};for(b=0;d>b;b++)e=e.concat(g(c[b],b));return e}function n(b){1===b.format?c.call(this,'coverageTable',[{name:'coverageFormat', +type:'USHORT',value:1}].concat(k('glyph',b.glyphs))):p.assert(!1,"Can't create coverage table format 2 yet.")}function q(b){c.call(this,'scriptListTable',l('scriptRecord',b,function(b,g){var d=b.script,e=d.defaultLangSys;return p.assert(!!e,'Unable to write GSUB: script '+b.tag+' has no default language system.'),[{name:'scriptTag'+g,type:'TAG',value:b.tag},{name:'script'+g,type:'TABLE',value:new c('scriptTable',[{name:'defaultLangSys',type:'TABLE',value:new c('defaultLangSys',[{name:'lookupOrder', +type:'USHORT',value:0},{name:'reqFeatureIndex',type:'USHORT',value:e.reqFeatureIndex}].concat(k('featureIndex',e.featureIndexes)))}].concat(l('langSys',d.langSysRecords,function(b,g){var d=b.langSys;return[{name:'langSysTag'+g,type:'TAG',value:b.tag},{name:'langSys'+g,type:'TABLE',value:new c('langSys',[{name:'lookupOrder',type:'USHORT',value:0},{name:'reqFeatureIndex',type:'USHORT',value:d.reqFeatureIndex}].concat(k('featureIndex',d.featureIndexes)))}]})))}]}))}function m(b){c.call(this,'featureListTable', +l('featureRecord',b,function(b,g){var d=b.feature;return[{name:'featureTag'+g,type:'TAG',value:b.tag},{name:'feature'+g,type:'TABLE',value:new c('featureTable',[{name:'featureParams',type:'USHORT',value:d.featureParams}].concat(k('lookupListIndex',d.lookupListIndexes)))}]}))}function g(b,g){c.call(this,'lookupListTable',h('lookup',b,function(b){var d=g[b.lookupType];return p.assert(!!d,'Unable to write GSUB lookup type '+b.lookupType+' tables.'),new c('lookupTable',[{name:'lookupType',type:'USHORT', +value:b.lookupType},{name:'lookupFlag',type:'USHORT',value:b.lookupFlag}].concat(h('subtable',b.subtables,d)))}))}var p=b('./check'),r=b('./types').encode,u=b('./types').sizeOf;c.prototype.encode=function(){return r.TABLE(this)};c.prototype.sizeOf=function(){return u.TABLE(this)};n.prototype=Object.create(c.prototype);n.prototype.constructor=n;q.prototype=Object.create(c.prototype);q.prototype.constructor=q;m.prototype=Object.create(c.prototype);m.prototype.constructor=m;g.prototype=Object.create(c.prototype); +g.prototype.constructor=g;d.Record=d.Table=c;d.Coverage=n;d.ScriptList=q;d.FeatureList=m;d.LookupList=g;d.ushortList=k;d.tableList=h;d.recordList=l},{'./check':2,'./types':32}],14:[function(b,e,d){function c(b,g){if(b===g)return!0;if(Array.isArray(b)&&Array.isArray(g)){if(b.length!==g.length)return!1;for(var d=0;dd;d+=1)e.push(z.getOffset(b,n,l)),n+=l;k=m+e[k]}else k=c+2;for(d=0;d>4;e&=15;if(15===d)break; +if(c+=g[d],15===e)break;c+=g[e]}return parseFloat(c)}if(32<=c&&246>=c)return c-139;if(247<=c&&250>=c)return g=b.parseByte(),256*(c-247)+g+108;if(251<=c&&254>=c)return g=b.parseByte(),256*-(c-251)-g-108;throw Error('Invalid b0 '+c);}function l(b,c,g){var d=new z.Parser(b,void 0!==c?c:0);c=[];var e=[];for(g=void 0!==g?g:b.length;d.relativeOffset=b?(12===b&&(b=1200+d.parseByte()),c.push([b,e]),e=[]):e.push(h(d,b));g={};for(b=0;b=c?v.cffStandardStrings[c]:b[c-391]}function q(b,c,g){for(var d={},e=0;e>1;q.length=0;u=!0}function h(g){for(var E, +w,z,H,I,Q,K,S,N,ha,Fa=0;FaMath.abs(ha-D)?v=N+q.shift():D=ha+q.shift(); +p.curveTo(k,l,m,n,I,Q);p.curveTo(K,S,N,ha,v,D);break;default:console.log('Glyph '+c.index+': unknown operator 1200'+I),q.length=0}break;case 14:0>3;break;case 21:2>16);Fa+=2;break;case 29:I=q.pop()+b.gsubrsBias;(I=b.gsubrs[I])&&h(I);break;case 30:for(;0I?console.log('Glyph '+c.index+': unknown operator '+I):247>I?q.push(I-139):251>I?(E=g[Fa],Fa+=1,q.push(256*(I-247)+E+108)):255>I?(E=g[Fa],Fa+=1,q.push(256*-(I-251)-E-108)):(E=g[Fa],w=g[Fa+1],z=g[Fa+2], +H=g[Fa+3],Fa+=4,q.push((E<<24|w<<16|z<<8|H)/65536))}}var k,l,m,n,p=new w.Path,q=[],r=0,u=!1,t=b.defaultWidthX,C=!1,v=0,D=0;return h(g),c.advanceWidth=t,p}function g(b){return 1240>b.length?107:33900>b.length?1131:32768}function p(b,c){var g,d=v.cffStandardStrings.indexOf(b);return d=c.indexOf(b),0<=d?g=d+v.cffStandardStrings.length:(g=v.cffStandardStrings.length+c.length,c.push(b)),g}function r(b,g,d){for(var e={},h=0;hH;H+=1){var D=C.parseSID();k.push(m(t, -D))}else if(1===H)for(;k.length<=r;){D=C.parseSID();var z=C.parseCard8();for(H=0;z>=H;H+=1)k.push(m(t,D)),D+=1}else{if(2!==H)throw Error('Unknown charset format '+H);for(;k.length<=r;)for(D=C.parseSID(),z=C.parseCard16(),H=0;z>=H;H+=1)k.push(m(t,D)),D+=1}if(0===n.encoding)b=new w.CffEncoding(w.cffStandardEncoding,k);else if(1===n.encoding)b=new w.CffEncoding(w.cffExpertEncoding,k);else{r={};b=new v.Parser(b,c+n.encoding);c=b.parseCard8();if(0===c)for(t=b.parseCard8(),c=0;t>c;c+=1)n=b.parseCard8(), -r[n]=c;else{if(1!==c)throw Error('Unknown encoding format '+c);t=b.parseCard8();n=1;for(c=0;t>c;c+=1)for(C=b.parseCard8(),H=b.parseCard8(),D=C;C+H>=D;D+=1)r[D]=n,n+=1}b=new w.CffEncoding(r,k)}d.cffEncoding=b;d.encoding=d.encoding||d.cffEncoding;d.glyphs=new u.GlyphSet(d);for(b=0;bb;b+=1)for(m=d.parseULong(),g=d.parseULong(),l=d.parseULong();g>=m;m+=1)e.glyphIndexMap[m]=l,l++}else{if(4!==e.format)throw Error('Only format 4 and 12 cmap tables are supported.'); -var w=g;e.length=d.parseUShort();e.language=d.parseUShort();e.segCount=g=d.parseUShort()>>1;d.skip('uShort',3);e.glyphIndexMap={};d=new k.Parser(b,c+w+14);l=new k.Parser(b,c+w+16+2*g);m=new k.Parser(b,c+w+16+4*g);var u=new k.Parser(b,c+w+16+6*g);w=c+w+16+8*g;for(c=0;g-1>c;c+=1)for(var v=d.parseUShort(),z=l.parseUShort(),G=m.parseShort(),I=u.parseUShort(),K=z;v>=K;K+=1)0!==I?(w=u.offset+u.relativeOffset-2,w+=I,w+=2*(K-z),q=k.getUShort(b,w),0!==q&&(q=q+G&65535)):q=K+G&65535,e.glyphIndexMap[K]=q}return e}; -c.make=function(b){var c,d=new l.Table('cmap',[{name:'version',type:'USHORT',value:0},{name:'numTables',type:'USHORT',value:1},{name:'platformID',type:'USHORT',value:3},{name:'encodingID',type:'USHORT',value:1},{name:'offset',type:'ULONG',value:12},{name:'format',type:'USHORT',value:4},{name:'length',type:'USHORT',value:0},{name:'language',type:'USHORT',value:0},{name:'segCountX2',type:'USHORT',value:0},{name:'searchRange',type:'USHORT',value:0},{name:'entrySelector',type:'USHORT',value:0},{name:'rangeShift', -type:'USHORT',value:0}]);d.segments=[];for(c=0;cc;c+=1){var w= -d.segments[c];e=e.concat({name:'end_'+c,type:'USHORT',value:w.end});h=h.concat({name:'start_'+c,type:'USHORT',value:w.start});k=k.concat({name:'idDelta_'+c,type:'SHORT',value:w.delta});m=m.concat({name:'idRangeOffset_'+c,type:'USHORT',value:w.offset});void 0!==w.glyphId&&(D=D.concat({name:'glyph_'+c,type:'USHORT',value:w.glyphId}))}return d.fields=d.fields.concat(e),d.fields.push({name:'reservedPad',type:'USHORT',value:0}),d.fields=d.fields.concat(h),d.fields=d.fields.concat(k),d.fields=d.fields.concat(m), -d.fields=d.fields.concat(D),d.length=2*e.length+16+2*h.length+2*k.length+2*m.length+2*D.length,d}},{'../check':2,'../parse':10,'../table':13}],16:[function(b,d,c){function g(b,c){var d=JSON.stringify(b),e=256,g;for(g in c){var h=parseInt(g);if(h&&!(256>h)){if(JSON.stringify(c[g])===d)return h;h>=e&&(e=h+1)}}return c[e]=b,e}function h(b,c,d){d=g(c.name,d);return[{name:'tag_'+b,type:'TAG',value:c.tag},{name:'minValue_'+b,type:'FIXED',value:c.minValue<<16},{name:'defaultValue_'+b,type:'FIXED',value:c.defaultValue<< -16},{name:'maxValue_'+b,type:'FIXED',value:c.maxValue<<16},{name:'flags_'+b,type:'USHORT',value:0},{name:'nameID_'+b,type:'USHORT',value:d}]}function k(b,c,d){var e={};b=new p.Parser(b,c);return e.tag=b.parseTag(),e.minValue=b.parseFixed(),e.defaultValue=b.parseFixed(),e.maxValue=b.parseFixed(),b.skip('uShort',1),e.name=d[b.parseUShort()]||{},e}function l(b,c,d,e){e=g(c.name,e);e=[{name:'nameID_'+b,type:'USHORT',value:e},{name:'flags_'+b,type:'USHORT',value:0}];for(var h=0;ht;t++)r.push(k(b,c+h+t*n,d));t=[];c=c+h+l*n;for(h=0;g>h;h++)t.push(m(b,c+h*e,r,d));return{axes:r,instances:t}}},{'../check':2,'../parse':10,'../table':13}],17:[function(b,d,c){function g(b,c,d,e,g){var h;return 0<(c&e)?(h=b.parseByte(),0===(c&g)&&(h=-h),h=d+h):h=0<(c&g)?d:d+b.parseShort(),h}function h(b,c,d){c=new p.Parser(c,d);b.numberOfContours=c.parseShort(); -b._xMin=c.parseShort();b._yMin=c.parseShort();b._xMax=c.parseShort();b._yMax=c.parseShort();var e;if(0h;h+=1)if(e=c.parseByte(),d.push(e),0<(8&e))for(var n=c.parseByte(),q=0;n>q;q+=1)d.push(e),h+=1;if(m.argument(d.length===l,'Bad flags.'), -0h;h+=1)e=d[h],n={},n.onCurve=!!(1&e),n.lastPointOfContour=0<=k.indexOf(h),q.push(n);for(h=k=0;l>h;h+=1)e=d[h],n=q[h],n.x=g(c,e,k,2,16),k=n.x;for(h=k=0;l>h;h+=1)e=d[h],n=q[h],n.y=g(c,e,k,4,32),k=n.y}b.points=q}else b.points=[]}else if(0===b.numberOfContours)b.points=[];else for(b.isComposite=!0,b.points=[],b.components=[],e=!0;e;)d=c.parseUShort(),e={glyphIndex:c.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0},0<(1&d)?0<(2&d)?(e.dx=c.parseShort(),e.dy= -c.parseShort()):e.matchedPoints=[c.parseUShort(),c.parseUShort()]:0<(2&d)?(e.dx=c.parseChar(),e.dy=c.parseChar()):e.matchedPoints=[c.parseByte(),c.parseByte()],0<(8&d)?e.xScale=e.yScale=c.parseF2Dot14():0<(64&d)?(e.xScale=c.parseF2Dot14(),e.yScale=c.parseF2Dot14()):0<(128&d)&&(e.xScale=c.parseF2Dot14(),e.scale01=c.parseF2Dot14(),e.scale10=c.parseF2Dot14(),e.yScale=c.parseF2Dot14()),b.components.push(e),e=!!(32&d)}function k(b,c){for(var d=[],e=0;ec.points.length-1||g.matchedPoints[1]>h.points.length-1)throw Error('Matched points out of range in '+c.name);var l=c.points[g.matchedPoints[0]],n=h.points[g.matchedPoints[1]]; -g={xScale:g.xScale,scale01:g.scale01,scale10:g.scale10,yScale:g.yScale,dx:0,dy:0};n=k([n],g)[0];g.dx=l.x-n.x;g.dy=l.y-n.y;h=k(h.points,g)}c.points=c.points.concat(h)}}var p;c=c.points;b=new e.Path;if(c){d=[];h=[];for(l=0;le;e++)d[b.parseTag()]={offset:b.parseUShort()};return d}function h(b,c){b=new p.Parser(b,c);var d=b.parseUShort();c=b.parseUShort();if(1===d)return b.parseUShortList(c); -if(2===d){for(d=[];c--;)for(var e=b.parseUShort(),g=b.parseUShort(),h=b.parseUShort();g>=e;e++)d[h++]=e;return d}}function k(b,c){b=new p.Parser(b,c);c=b.parseUShort();if(1===c){var d=b.parseUShort();c=b.parseUShort();var e=b.parseUShortList(c);return function(b){return e[b-d]||0}}if(2===c){c=b.parseUShort();for(var g=[],h=[],k=[],l=0;c>l;l++)g[l]=b.parseUShort(),h[l]=b.parseUShort(),k[l]=b.parseUShort();return function(b){for(var c=0,d=g.length-1;d>c;){var e=c+d+1>>1;bg;g++){var I=c[g],K=q[I];if(!K)for(K={},e.relativeOffset=I,I=e.parseUShort();I--;){var H=e.parseUShort();m&&(d=e.parseShort());n&&e.parseShort();K[H]=d}G[l[g]]=K}return function(b,c){return(b=G[b])?b[c]:void 0}}if(2===g){K=e.parseUShort();I=e.parseUShort(); -q=e.parseUShort();g=e.parseUShort();var C=k(b,c+K),P=k(b,c+I),Q=[];for(b=0;q>b;b++)for(c=Q[b]=[],K=0;g>K;K++)m&&(d=e.parseShort()),n&&e.parseShort(),c[K]=d;var T={};for(b=0;be;e++)n.push(l(b, -c+m[e]));d.getKerningValue=function(b,c){for(var d=n.length;d--;){var e=n[d](b,c);if(void 0!==e)return e}return 0}}return d}var q=b('../check'),p=b('../parse');c.parse=function(b,c,d){var e=new p.Parser(b,c),h=e.parseFixed();q.argument(1===h,'Unsupported GPOS table version.');g(b,c+e.parseUShort());g(b,c+e.parseUShort());var k=e.parseUShort();e.relativeOffset=k;h=e.parseUShort();e=e.parseOffset16List(h);c+=k;for(k=0;h>k;k++){var l=m(b,c+e[k]);2!==l.lookupType||d.getGposKerningValue||(d.getGposKerningValue= -l.getKerningValue)}}},{'../check':2,'../parse':10}],19:[function(b,d,c){var g=b('../check'),h=b('../parse').Parser,k=Array(9),l=b('../table');k[1]=function(){var b=this.offset+this.relativeOffset,c=this.parseUShort();return 1===c?{substFormat:1,coverage:this.parsePointer(h.coverage),deltaGlyphId:this.parseUShort()}:2===c?{substFormat:2,coverage:this.parsePointer(h.coverage),substitute:this.parseOffset16List()}:void g.assert(!1,'0x'+b.toString(16)+': lookup type 1 format must be 1 or 2.')};k[2]=function(){var b= -this.parseUShort();return g.argument(1===b,'GSUB Multiple Substitution Subtable identifier-format must be 1'),{substFormat:b,coverage:this.parsePointer(h.coverage),sequences:this.parseListOfLists()}};k[3]=function(){var b=this.parseUShort();return g.argument(1===b,'GSUB Alternate Substitution Subtable identifier-format must be 1'),{substFormat:b,coverage:this.parsePointer(h.coverage),alternateSets:this.parseListOfLists()}};k[4]=function(){var b=this.parseUShort();return g.argument(1===b,'GSUB ligature table identifier-format must be 1'), -{substFormat:b,coverage:this.parsePointer(h.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var m={sequenceIndex:h.uShort,lookupListIndex:h.uShort};k[5]=function(){var b=this.offset+this.relativeOffset,c=this.parseUShort();if(1===c)return{substFormat:c,coverage:this.parsePointer(h.coverage),ruleSets:this.parseListOfLists(function(){var b=this.parseUShort(),c=this.parseUShort();return{input:this.parseUShortList(b- -1),lookupRecords:this.parseRecordList(c,m)}})};if(2===c)return{substFormat:c,coverage:this.parsePointer(h.coverage),classDef:this.parsePointer(h.classDef),classSets:this.parseListOfLists(function(){var b=this.parseUShort(),c=this.parseUShort();return{classes:this.parseUShortList(b-1),lookupRecords:this.parseRecordList(c,m)}})};if(3===c){b=this.parseUShort();var d=this.parseUShort();return{substFormat:c,coverages:this.parseList(b,h.pointer(h.coverage)),lookupRecords:this.parseRecordList(d,m)}}g.assert(!1, -'0x'+b.toString(16)+': lookup type 5 format must be 1, 2 or 3.')};k[6]=function(){var b=this.offset+this.relativeOffset,c=this.parseUShort();return 1===c?{substFormat:1,coverage:this.parsePointer(h.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(m)}})}:2===c?{substFormat:2,coverage:this.parsePointer(h.coverage),backtrackClassDef:this.parsePointer(h.classDef), -inputClassDef:this.parsePointer(h.classDef),lookaheadClassDef:this.parsePointer(h.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(m)}})}:3===c?{substFormat:3,backtrackCoverage:this.parseList(h.pointer(h.coverage)),inputCoverage:this.parseList(h.pointer(h.coverage)),lookaheadCoverage:this.parseList(h.pointer(h.coverage)),lookupRecords:this.parseRecordList(m)}: -void g.assert(!1,'0x'+b.toString(16)+': lookup type 6 format must be 1, 2 or 3.')};k[7]=function(){var b=this.parseUShort();g.argument(1===b,'GSUB Extension Substitution subtable identifier-format must be 1');b=this.parseUShort();var c=new h(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:b,extension:k[b].call(c)}};k[8]=function(){var b=this.parseUShort();return g.argument(1===b,'GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1'),{substFormat:b, -coverage:this.parsePointer(h.coverage),backtrackCoverage:this.parseList(h.pointer(h.coverage)),lookaheadCoverage:this.parseList(h.pointer(h.coverage)),substitutes:this.parseUShortList()}};var q=Array(9);q[1]=function(b){return 1===b.substFormat?new l.Table('substitutionTable',[{name:'substFormat',type:'USHORT',value:1},{name:'coverage',type:'TABLE',value:new l.Coverage(b.coverage)},{name:'deltaGlyphID',type:'USHORT',value:b.deltaGlyphId}]):new l.Table('substitutionTable',[{name:'substFormat',type:'USHORT', -value:2},{name:'coverage',type:'TABLE',value:new l.Coverage(b.coverage)}].concat(l.ushortList('substitute',b.substitute)))};q[3]=function(b){return g.assert(1===b.substFormat,'Lookup type 3 substFormat must be 1.'),new l.Table('substitutionTable',[{name:'substFormat',type:'USHORT',value:1},{name:'coverage',type:'TABLE',value:new l.Coverage(b.coverage)}].concat(l.tableList('altSet',b.alternateSets,function(b){return new l.Table('alternateSetTable',l.ushortList('alternate',b))})))};q[4]=function(b){return g.assert(1=== -b.substFormat,'Lookup type 4 substFormat must be 1.'),new l.Table('substitutionTable',[{name:'substFormat',type:'USHORT',value:1},{name:'coverage',type:'TABLE',value:new l.Coverage(b.coverage)}].concat(l.tableList('ligSet',b.ligatureSets,function(b){return new l.Table('ligatureSetTable',l.tableList('ligature',b,function(b){return new l.Table('ligatureTable',[{name:'ligGlyph',type:'USHORT',value:b.ligGlyph}].concat(l.ushortList('component',b.components,b.components.length+1)))}))})))};c.parse=function(b, -c){b=new h(b,c||0);c=b.parseVersion();return g.argument(1===c,'Unsupported GSUB table version.'),{version:c,scripts:b.parseScriptList(),features:b.parseFeatureList(),lookups:b.parseLookupList(k)}};c.make=function(b){return new l.Table('GSUB',[{name:'version',type:'ULONG',value:65536},{name:'scripts',type:'TABLE',value:new l.ScriptList(b.scripts)},{name:'features',type:'TABLE',value:new l.FeatureList(b.features)},{name:'lookups',type:'TABLE',value:new l.LookupList(b.lookups,q)}])}},{'../check':2,'../parse':10, -'../table':13}],20:[function(b,d,c){var g=b('../check'),h=b('../parse'),k=b('../table');c.parse=function(b,c){var d={};b=new h.Parser(b,c);return d.version=b.parseVersion(),d.fontRevision=Math.round(1E3*b.parseFixed())/1E3,d.checkSumAdjustment=b.parseULong(),d.magicNumber=b.parseULong(),g.argument(1594834165===d.magicNumber,'Font header has wrong magic number.'),d.flags=b.parseUShort(),d.unitsPerEm=b.parseUShort(),d.created=b.parseLongDateTime(),d.modified=b.parseLongDateTime(),d.xMin=b.parseShort(), -d.yMin=b.parseShort(),d.xMax=b.parseShort(),d.yMax=b.parseShort(),d.macStyle=b.parseUShort(),d.lowestRecPPEM=b.parseUShort(),d.fontDirectionHint=b.parseShort(),d.indexToLocFormat=b.parseShort(),d.glyphDataFormat=b.parseShort(),d};c.make=function(b){var c=Math.round((new Date).getTime()/1E3)+2082844800,d=c;return b.createdTimestamp&&(d=b.createdTimestamp+2082844800),new k.Table('head',[{name:'version',type:'FIXED',value:65536},{name:'fontRevision',type:'FIXED',value:65536},{name:'checkSumAdjustment', +op:20,type:'number',value:0},{name:'nominalWidthX',op:21,type:'number',value:0}];d.parse=function(b,c,d){d.tables.cff={};var e={};e=(e.formatMajor=z.getCard8(b,c),e.formatMinor=z.getCard8(b,c+1),e.size=z.getCard8(b,c+2),e.offsetSize=z.getCard8(b,c+3),e.startOffset=c,e.endOffset=c+4,e);e=k(b,e.endOffset,z.bytesToString);e=k(b,e.endOffset);var h=k(b,e.endOffset,z.bytesToString),p=k(b,h.endOffset);d.gsubrs=p.objects;d.gsubrsBias=g(d.gsubrs);p=new DataView((new Uint8Array(e.objects[0])).buffer);e=h.objects; +p=l(p,0,p.byteLength);p=q(p,H,e);d.tables.cff.topDict=p;e=c+p['private'][1];var r=h.objects;var u=l(b,e,p['private'][0]);r=q(u,K,r);(d.defaultWidthX=r.defaultWidthX,d.nominalWidthX=r.nominalWidthX,0!==r.subrs)?(e=k(b,e+r.subrs),d.subrs=e.objects,d.subrsBias=g(d.subrs)):(d.subrs=[],d.subrsBias=0);e=k(b,c+p.charStrings);d.nGlyphs=e.objects.length;r=d.nGlyphs;u=h.objects;var D=new z.Parser(b,c+p.charset);--r;h=['.notdef'];var C=D.parseCard8();if(0===C)for(C=0;r>C;C+=1){var E=D.parseSID();h.push(n(u, +E))}else if(1===C)for(;h.length<=r;){E=D.parseSID();var w=D.parseCard8();for(C=0;w>=C;C+=1)h.push(n(u,E)),E+=1}else{if(2!==C)throw Error('Unknown charset format '+C);for(;h.length<=r;)for(E=D.parseSID(),w=D.parseCard16(),C=0;w>=C;C+=1)h.push(n(u,E)),E+=1}if(0===p.encoding)b=new v.CffEncoding(v.cffStandardEncoding,h);else if(1===p.encoding)b=new v.CffEncoding(v.cffExpertEncoding,h);else{r={};b=new z.Parser(b,c+p.encoding);c=b.parseCard8();if(0===c)for(u=b.parseCard8(),c=0;u>c;c+=1)p=b.parseCard8(), +r[p]=c;else{if(1!==c)throw Error('Unknown encoding format '+c);u=b.parseCard8();p=1;for(c=0;u>c;c+=1)for(D=b.parseCard8(),C=b.parseCard8(),E=D;D+C>=E;E+=1)r[E]=p,p+=1}b=new v.CffEncoding(r,h)}d.cffEncoding=b;d.encoding=d.encoding||d.cffEncoding;d.glyphs=new t.GlyphSet(d);for(b=0;bb;b+=1)for(n=d.parseULong(),e=d.parseULong(),l=d.parseULong();e>=n;n+=1)g.glyphIndexMap[n]=l,l++}else{if(4!==g.format)throw Error('Only format 4 and 12 cmap tables are supported.'); +var v=e;g.length=d.parseUShort();g.language=d.parseUShort();g.segCount=e=d.parseUShort()>>1;d.skip('uShort',3);g.glyphIndexMap={};d=new h.Parser(b,c+v+14);l=new h.Parser(b,c+v+16+2*e);n=new h.Parser(b,c+v+16+4*e);var t=new h.Parser(b,c+v+16+6*e);v=c+v+16+8*e;for(c=0;e-1>c;c+=1)for(var z=d.parseUShort(),w=l.parseUShort(),I=n.parseShort(),H=t.parseUShort(),K=w;z>=K;K+=1)0!==H?(v=t.offset+t.relativeOffset-2,v+=H,v+=2*(K-w),q=h.getUShort(b,v),0!==q&&(q=q+I&65535)):q=K+I&65535,g.glyphIndexMap[K]=q}return g}; +d.make=function(b){var d,e=new l.Table('cmap',[{name:'version',type:'USHORT',value:0},{name:'numTables',type:'USHORT',value:1},{name:'platformID',type:'USHORT',value:3},{name:'encodingID',type:'USHORT',value:1},{name:'offset',type:'ULONG',value:12},{name:'format',type:'USHORT',value:4},{name:'length',type:'USHORT',value:0},{name:'language',type:'USHORT',value:0},{name:'segCountX2',type:'USHORT',value:0},{name:'searchRange',type:'USHORT',value:0},{name:'entrySelector',type:'USHORT',value:0},{name:'rangeShift', +type:'USHORT',value:0}]);e.segments=[];for(d=0;dd;d+=1){var v= +e.segments[d];g=g.concat({name:'end_'+d,type:'USHORT',value:v.end});h=h.concat({name:'start_'+d,type:'USHORT',value:v.start});k=k.concat({name:'idDelta_'+d,type:'SHORT',value:v.delta});n=n.concat({name:'idRangeOffset_'+d,type:'USHORT',value:v.offset});void 0!==v.glyphId&&(E=E.concat({name:'glyph_'+d,type:'USHORT',value:v.glyphId}))}return e.fields=e.fields.concat(g),e.fields.push({name:'reservedPad',type:'USHORT',value:0}),e.fields=e.fields.concat(h),e.fields=e.fields.concat(k),e.fields=e.fields.concat(n), +e.fields=e.fields.concat(E),e.length=2*g.length+16+2*h.length+2*k.length+2*n.length+2*E.length,e}},{'../check':2,'../parse':10,'../table':13}],16:[function(b,e,d){function c(b,c){var d=JSON.stringify(b),g=256,e;for(e in c){var h=parseInt(e);if(h&&!(256>h)){if(JSON.stringify(c[e])===d)return h;h>=g&&(g=h+1)}}return c[g]=b,g}function k(b,d,g){g=c(d.name,g);return[{name:'tag_'+b,type:'TAG',value:d.tag},{name:'minValue_'+b,type:'FIXED',value:d.minValue<<16},{name:'defaultValue_'+b,type:'FIXED',value:d.defaultValue<< +16},{name:'maxValue_'+b,type:'FIXED',value:d.maxValue<<16},{name:'flags_'+b,type:'USHORT',value:0},{name:'nameID_'+b,type:'USHORT',value:g}]}function h(b,c,d){var g={};b=new m.Parser(b,c);return g.tag=b.parseTag(),g.minValue=b.parseFixed(),g.defaultValue=b.parseFixed(),g.maxValue=b.parseFixed(),b.skip('uShort',1),g.name=d[b.parseUShort()]||{},g}function l(b,d,g,e){e=c(d.name,e);e=[{name:'nameID_'+b,type:'USHORT',value:e},{name:'flags_'+b,type:'USHORT',value:0}];for(var h=0;hu;u++)r.push(h(b,c+k+u*p,d));u=[];c=c+k+l*p;for(k=0;e>k;k++)u.push(n(b,c+k*g,r,d));return{axes:r,instances:u}}},{'../check':2,'../parse':10,'../table':13}],17:[function(b,e,d){function c(b,c,d,g,e){var h;return 0<(c&g)?(h=b.parseByte(),0===(c&e)&&(h=-h),h=d+h):h=0<(c&e)?d:d+b.parseShort(),h}function k(b,d,g){d=new m.Parser(d,g);b.numberOfContours=d.parseShort(); +b._xMin=d.parseShort();b._yMin=d.parseShort();b._xMax=d.parseShort();b._yMax=d.parseShort();var e;if(0h;h+=1)if(e=d.parseByte(),g.push(e),0<(8&e))for(var p=d.parseByte(),q=0;p>q;q+=1)g.push(e),h+=1;if(n.argument(g.length===l,'Bad flags.'), +0h;h+=1)e=g[h],p={},p.onCurve=!!(1&e),p.lastPointOfContour=0<=k.indexOf(h),q.push(p);for(h=k=0;l>h;h+=1)e=g[h],p=q[h],p.x=c(d,e,k,2,16),k=p.x;for(h=k=0;l>h;h+=1)e=g[h],p=q[h],p.y=c(d,e,k,4,32),k=p.y}b.points=q}else b.points=[]}else if(0===b.numberOfContours)b.points=[];else for(b.isComposite=!0,b.points=[],b.components=[],e=!0;e;)g=d.parseUShort(),e={glyphIndex:d.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0},0<(1&g)?0<(2&g)?(e.dx=d.parseShort(),e.dy= +d.parseShort()):e.matchedPoints=[d.parseUShort(),d.parseUShort()]:0<(2&g)?(e.dx=d.parseChar(),e.dy=d.parseChar()):e.matchedPoints=[d.parseByte(),d.parseByte()],0<(8&g)?e.xScale=e.yScale=d.parseF2Dot14():0<(64&g)?(e.xScale=d.parseF2Dot14(),e.yScale=d.parseF2Dot14()):0<(128&g)&&(e.xScale=d.parseF2Dot14(),e.scale01=d.parseF2Dot14(),e.scale10=d.parseF2Dot14(),e.yScale=d.parseF2Dot14()),b.components.push(e),e=!!(32&g)}function h(b,c){for(var d=[],g=0;gc.points.length-1||e.matchedPoints[1]>k.points.length-1)throw Error('Matched points out of range in '+c.name);var l=c.points[e.matchedPoints[0]],m=k.points[e.matchedPoints[1]]; +e={xScale:e.xScale,scale01:e.scale01,scale10:e.scale10,yScale:e.yScale,dx:0,dy:0};m=h([m],e)[0];e.dx=l.x-m.x;e.dy=l.y-m.y;k=h(k.points,e)}c.points=c.points.concat(k)}}var p;c=c.points;b=new g.Path;if(c){d=[];k=[];for(l=0;lg;g++)d[b.parseTag()]={offset:b.parseUShort()};return d}function k(b,c){b=new m.Parser(b,c);var d=b.parseUShort();c=b.parseUShort();if(1===d)return b.parseUShortList(c); +if(2===d){for(d=[];c--;)for(var g=b.parseUShort(),e=b.parseUShort(),h=b.parseUShort();e>=g;g++)d[h++]=g;return d}}function h(b,c){b=new m.Parser(b,c);c=b.parseUShort();if(1===c){var d=b.parseUShort();c=b.parseUShort();var g=b.parseUShortList(c);return function(b){return g[b-d]||0}}if(2===c){c=b.parseUShort();for(var e=[],h=[],k=[],l=0;c>l;l++)e[l]=b.parseUShort(),h[l]=b.parseUShort(),k[l]=b.parseUShort();return function(b){for(var c=0,d=e.length-1;d>c;){var g=c+d+1>>1;be;e++){var H=c[e],K=q[H];if(!K)for(K={},g.relativeOffset=H,H=g.parseUShort();H--;){var C=g.parseUShort();n&&(d=g.parseShort());p&&g.parseShort();K[C]=d}I[l[e]]=K}return function(b,c){return(b=I[b])?b[c]:void 0}}if(2===e){K=g.parseUShort();H=g.parseUShort(); +q=g.parseUShort();e=g.parseUShort();var D=h(b,c+K),Q=h(b,c+H),M=[];for(b=0;q>b;b++)for(c=M[b]=[],K=0;e>K;K++)n&&(d=g.parseShort()),p&&g.parseShort(),c[K]=d;var X={};for(b=0;bg;g++)p.push(l(b, +c+n[g]));d.getKerningValue=function(b,c){for(var d=p.length;d--;){var g=p[d](b,c);if(void 0!==g)return g}return 0}}return d}var q=b('../check'),m=b('../parse');d.parse=function(b,d,e){var g=new m.Parser(b,d),h=g.parseFixed();q.argument(1===h,'Unsupported GPOS table version.');c(b,d+g.parseUShort());c(b,d+g.parseUShort());var k=g.parseUShort();g.relativeOffset=k;h=g.parseUShort();g=g.parseOffset16List(h);d+=k;for(k=0;h>k;k++){var l=n(b,d+g[k]);2!==l.lookupType||e.getGposKerningValue||(e.getGposKerningValue= +l.getKerningValue)}}},{'../check':2,'../parse':10}],19:[function(b,e,d){var c=b('../check'),k=b('../parse').Parser,h=Array(9),l=b('../table');h[1]=function(){var b=this.offset+this.relativeOffset,d=this.parseUShort();return 1===d?{substFormat:1,coverage:this.parsePointer(k.coverage),deltaGlyphId:this.parseUShort()}:2===d?{substFormat:2,coverage:this.parsePointer(k.coverage),substitute:this.parseOffset16List()}:void c.assert(!1,'0x'+b.toString(16)+': lookup type 1 format must be 1 or 2.')};h[2]=function(){var b= +this.parseUShort();return c.argument(1===b,'GSUB Multiple Substitution Subtable identifier-format must be 1'),{substFormat:b,coverage:this.parsePointer(k.coverage),sequences:this.parseListOfLists()}};h[3]=function(){var b=this.parseUShort();return c.argument(1===b,'GSUB Alternate Substitution Subtable identifier-format must be 1'),{substFormat:b,coverage:this.parsePointer(k.coverage),alternateSets:this.parseListOfLists()}};h[4]=function(){var b=this.parseUShort();return c.argument(1===b,'GSUB ligature table identifier-format must be 1'), +{substFormat:b,coverage:this.parsePointer(k.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var n={sequenceIndex:k.uShort,lookupListIndex:k.uShort};h[5]=function(){var b=this.offset+this.relativeOffset,d=this.parseUShort();if(1===d)return{substFormat:d,coverage:this.parsePointer(k.coverage),ruleSets:this.parseListOfLists(function(){var b=this.parseUShort(),c=this.parseUShort();return{input:this.parseUShortList(b- +1),lookupRecords:this.parseRecordList(c,n)}})};if(2===d)return{substFormat:d,coverage:this.parsePointer(k.coverage),classDef:this.parsePointer(k.classDef),classSets:this.parseListOfLists(function(){var b=this.parseUShort(),c=this.parseUShort();return{classes:this.parseUShortList(b-1),lookupRecords:this.parseRecordList(c,n)}})};if(3===d){b=this.parseUShort();var e=this.parseUShort();return{substFormat:d,coverages:this.parseList(b,k.pointer(k.coverage)),lookupRecords:this.parseRecordList(e,n)}}c.assert(!1, +'0x'+b.toString(16)+': lookup type 5 format must be 1, 2 or 3.')};h[6]=function(){var b=this.offset+this.relativeOffset,d=this.parseUShort();return 1===d?{substFormat:1,coverage:this.parsePointer(k.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(n)}})}:2===d?{substFormat:2,coverage:this.parsePointer(k.coverage),backtrackClassDef:this.parsePointer(k.classDef), +inputClassDef:this.parsePointer(k.classDef),lookaheadClassDef:this.parsePointer(k.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(n)}})}:3===d?{substFormat:3,backtrackCoverage:this.parseList(k.pointer(k.coverage)),inputCoverage:this.parseList(k.pointer(k.coverage)),lookaheadCoverage:this.parseList(k.pointer(k.coverage)),lookupRecords:this.parseRecordList(n)}: +void c.assert(!1,'0x'+b.toString(16)+': lookup type 6 format must be 1, 2 or 3.')};h[7]=function(){var b=this.parseUShort();c.argument(1===b,'GSUB Extension Substitution subtable identifier-format must be 1');b=this.parseUShort();var d=new k(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:b,extension:h[b].call(d)}};h[8]=function(){var b=this.parseUShort();return c.argument(1===b,'GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1'),{substFormat:b, +coverage:this.parsePointer(k.coverage),backtrackCoverage:this.parseList(k.pointer(k.coverage)),lookaheadCoverage:this.parseList(k.pointer(k.coverage)),substitutes:this.parseUShortList()}};var q=Array(9);q[1]=function(b){return 1===b.substFormat?new l.Table('substitutionTable',[{name:'substFormat',type:'USHORT',value:1},{name:'coverage',type:'TABLE',value:new l.Coverage(b.coverage)},{name:'deltaGlyphID',type:'USHORT',value:b.deltaGlyphId}]):new l.Table('substitutionTable',[{name:'substFormat',type:'USHORT', +value:2},{name:'coverage',type:'TABLE',value:new l.Coverage(b.coverage)}].concat(l.ushortList('substitute',b.substitute)))};q[3]=function(b){return c.assert(1===b.substFormat,'Lookup type 3 substFormat must be 1.'),new l.Table('substitutionTable',[{name:'substFormat',type:'USHORT',value:1},{name:'coverage',type:'TABLE',value:new l.Coverage(b.coverage)}].concat(l.tableList('altSet',b.alternateSets,function(b){return new l.Table('alternateSetTable',l.ushortList('alternate',b))})))};q[4]=function(b){return c.assert(1=== +b.substFormat,'Lookup type 4 substFormat must be 1.'),new l.Table('substitutionTable',[{name:'substFormat',type:'USHORT',value:1},{name:'coverage',type:'TABLE',value:new l.Coverage(b.coverage)}].concat(l.tableList('ligSet',b.ligatureSets,function(b){return new l.Table('ligatureSetTable',l.tableList('ligature',b,function(b){return new l.Table('ligatureTable',[{name:'ligGlyph',type:'USHORT',value:b.ligGlyph}].concat(l.ushortList('component',b.components,b.components.length+1)))}))})))};d.parse=function(b, +d){b=new k(b,d||0);d=b.parseVersion();return c.argument(1===d,'Unsupported GSUB table version.'),{version:d,scripts:b.parseScriptList(),features:b.parseFeatureList(),lookups:b.parseLookupList(h)}};d.make=function(b){return new l.Table('GSUB',[{name:'version',type:'ULONG',value:65536},{name:'scripts',type:'TABLE',value:new l.ScriptList(b.scripts)},{name:'features',type:'TABLE',value:new l.FeatureList(b.features)},{name:'lookups',type:'TABLE',value:new l.LookupList(b.lookups,q)}])}},{'../check':2,'../parse':10, +'../table':13}],20:[function(b,e,d){var c=b('../check'),k=b('../parse'),h=b('../table');d.parse=function(b,d){var e={};b=new k.Parser(b,d);return e.version=b.parseVersion(),e.fontRevision=Math.round(1E3*b.parseFixed())/1E3,e.checkSumAdjustment=b.parseULong(),e.magicNumber=b.parseULong(),c.argument(1594834165===e.magicNumber,'Font header has wrong magic number.'),e.flags=b.parseUShort(),e.unitsPerEm=b.parseUShort(),e.created=b.parseLongDateTime(),e.modified=b.parseLongDateTime(),e.xMin=b.parseShort(), +e.yMin=b.parseShort(),e.xMax=b.parseShort(),e.yMax=b.parseShort(),e.macStyle=b.parseUShort(),e.lowestRecPPEM=b.parseUShort(),e.fontDirectionHint=b.parseShort(),e.indexToLocFormat=b.parseShort(),e.glyphDataFormat=b.parseShort(),e};d.make=function(b){var c=Math.round((new Date).getTime()/1E3)+2082844800,d=c;return b.createdTimestamp&&(d=b.createdTimestamp+2082844800),new h.Table('head',[{name:'version',type:'FIXED',value:65536},{name:'fontRevision',type:'FIXED',value:65536},{name:'checkSumAdjustment', type:'ULONG',value:0},{name:'magicNumber',type:'ULONG',value:1594834165},{name:'flags',type:'USHORT',value:0},{name:'unitsPerEm',type:'USHORT',value:1E3},{name:'created',type:'LONGDATETIME',value:d},{name:'modified',type:'LONGDATETIME',value:c},{name:'xMin',type:'SHORT',value:0},{name:'yMin',type:'SHORT',value:0},{name:'xMax',type:'SHORT',value:0},{name:'yMax',type:'SHORT',value:0},{name:'macStyle',type:'USHORT',value:0},{name:'lowestRecPPEM',type:'USHORT',value:0},{name:'fontDirectionHint',type:'SHORT', -value:2},{name:'indexToLocFormat',type:'SHORT',value:0},{name:'glyphDataFormat',type:'SHORT',value:0}],b)}},{'../check':2,'../parse':10,'../table':13}],21:[function(b,d,c){var g=b('../parse'),h=b('../table');c.parse=function(b,c){var d={};b=new g.Parser(b,c);return d.version=b.parseVersion(),d.ascender=b.parseShort(),d.descender=b.parseShort(),d.lineGap=b.parseShort(),d.advanceWidthMax=b.parseUShort(),d.minLeftSideBearing=b.parseShort(),d.minRightSideBearing=b.parseShort(),d.xMaxExtent=b.parseShort(), -d.caretSlopeRise=b.parseShort(),d.caretSlopeRun=b.parseShort(),d.caretOffset=b.parseShort(),b.relativeOffset+=8,d.metricDataFormat=b.parseShort(),d.numberOfHMetrics=b.parseUShort(),d};c.make=function(b){return new h.Table('hhea',[{name:'version',type:'FIXED',value:65536},{name:'ascender',type:'FWORD',value:0},{name:'descender',type:'FWORD',value:0},{name:'lineGap',type:'FWORD',value:0},{name:'advanceWidthMax',type:'UFWORD',value:0},{name:'minLeftSideBearing',type:'FWORD',value:0},{name:'minRightSideBearing', +value:2},{name:'indexToLocFormat',type:'SHORT',value:0},{name:'glyphDataFormat',type:'SHORT',value:0}],b)}},{'../check':2,'../parse':10,'../table':13}],21:[function(b,e,d){var c=b('../parse'),k=b('../table');d.parse=function(b,d){var e={};b=new c.Parser(b,d);return e.version=b.parseVersion(),e.ascender=b.parseShort(),e.descender=b.parseShort(),e.lineGap=b.parseShort(),e.advanceWidthMax=b.parseUShort(),e.minLeftSideBearing=b.parseShort(),e.minRightSideBearing=b.parseShort(),e.xMaxExtent=b.parseShort(), +e.caretSlopeRise=b.parseShort(),e.caretSlopeRun=b.parseShort(),e.caretOffset=b.parseShort(),b.relativeOffset+=8,e.metricDataFormat=b.parseShort(),e.numberOfHMetrics=b.parseUShort(),e};d.make=function(b){return new k.Table('hhea',[{name:'version',type:'FIXED',value:65536},{name:'ascender',type:'FWORD',value:0},{name:'descender',type:'FWORD',value:0},{name:'lineGap',type:'FWORD',value:0},{name:'advanceWidthMax',type:'UFWORD',value:0},{name:'minLeftSideBearing',type:'FWORD',value:0},{name:'minRightSideBearing', type:'FWORD',value:0},{name:'xMaxExtent',type:'FWORD',value:0},{name:'caretSlopeRise',type:'SHORT',value:1},{name:'caretSlopeRun',type:'SHORT',value:0},{name:'caretOffset',type:'SHORT',value:0},{name:'reserved1',type:'SHORT',value:0},{name:'reserved2',type:'SHORT',value:0},{name:'reserved3',type:'SHORT',value:0},{name:'reserved4',type:'SHORT',value:0},{name:'metricDataFormat',type:'SHORT',value:0},{name:'numberOfHMetrics',type:'USHORT',value:0}],b)}},{'../parse':10,'../table':13}],22:[function(b, -d,c){var g=b('../parse'),h=b('../table');c.parse=function(b,c,d,h,p){var e,k;b=new g.Parser(b,c);for(c=0;h>c;c+=1){d>c&&(e=b.parseUShort(),k=b.parseShort());var l=p.get(c);l.advanceWidth=e;l.leftSideBearing=k}};c.make=function(b){for(var c=new h.Table('hmtx',[]),d=0;dk;k+=1){var l=b.parseUShort(),e=b.parseUShort(),n=b.parseShort();d[l+','+e]=n}return d}},{'../check':2,'../parse':10}],24:[function(b,d,c){var g=b('../parse');c.parse= -function(b,c,d,m){b=new g.Parser(b,c);c=m?b.parseUShort:b.parseULong;for(var h=[],k=0;d+1>k;k+=1){var e=c.call(b);m&&(e*=2);h.push(e)}return h}},{'../parse':10}],25:[function(b,d,c){var g=b('../check'),h=b('../parse'),k=b('../table');c.make=function(b){for(var c=new k.Table('ltag',[{name:'version',type:'ULONG',value:1},{name:'flags',type:'ULONG',value:0},{name:'numTags',type:'ULONG',value:b.length}]),d='',g=12+4*b.length,e=0;eh&&(h=d.length,d+=b[e]);c.fields.push({name:'offset '+ -e,type:'USHORT',value:g+h});c.fields.push({name:'length '+e,type:'USHORT',value:b[e].length})}return c.fields.push({name:'stringPool',type:'CHARARRAY',value:d}),c};c.parse=function(b,c){var d=new h.Parser(b,c),k=d.parseULong();g.argument(1===k,'Unsupported ltag table version.');d.skip('uLong',1);k=d.parseULong();for(var e=[],l=0;k>l;l++){for(var m='',t=c+d.parseUShort(),D=d.parseUShort(),w=t;t+D>w;++w)m+=String.fromCharCode(b.getInt8(w));e.push(m)}return e}},{'../check':2,'../parse':10,'../table':13}], -26:[function(b,d,c){var g=b('../parse'),h=b('../table');c.parse=function(b,c){var d={};b=new g.Parser(b,c);return d.version=b.parseVersion(),d.numGlyphs=b.parseUShort(),1===d.version&&(d.maxPoints=b.parseUShort(),d.maxContours=b.parseUShort(),d.maxCompositePoints=b.parseUShort(),d.maxCompositeContours=b.parseUShort(),d.maxZones=b.parseUShort(),d.maxTwilightPoints=b.parseUShort(),d.maxStorage=b.parseUShort(),d.maxFunctionDefs=b.parseUShort(),d.maxInstructionDefs=b.parseUShort(),d.maxStackElements= -b.parseUShort(),d.maxSizeOfInstructions=b.parseUShort(),d.maxComponentElements=b.parseUShort(),d.maxComponentDepth=b.parseUShort()),d};c.make=function(b){return new h.Table('maxp',[{name:'version',type:'FIXED',value:20480},{name:'numGlyphs',type:'USHORT',value:b}])}},{'../parse':10,'../table':13}],27:[function(b,d,c){var g=b('../types').decode,h=b('../check'),k=b('../parse'),l=b('../table');c.parse=function(b,c){var d=new k.Parser(b,c),e=d.parseULong();h.argument(1===e,'Unsupported META table version.'); -d.parseULong();d.parseULong();e=d.parseULong();for(var l={},m=0;e>m;m++){var q=d.parseTag(),D=d.parseULong(),w=d.parseULong();D=g.UTF8(b,c+D,w);l[q]=D}return l};c.make=function(b){var c=Object.keys(b).length,d='',e=16+12*c;c=new l.Table('meta',[{name:'version',type:'ULONG',value:1},{name:'flags',type:'ULONG',value:0},{name:'offset',type:'ULONG',value:e},{name:'numTags',type:'ULONG',value:c}]);for(var g in b){var h=d.length;d+=b[g];c.fields.push({name:'tag '+g,type:'TAG',value:g});c.fields.push({name:'offset '+ -g,type:'ULONG',value:e+h});c.fields.push({name:'length '+g,type:'ULONG',value:b[g].length})}return c.fields.push({name:'stringPool',type:'CHARARRAY',value:d}),c}},{'../check':2,'../parse':10,'../table':13,'../types':32}],28:[function(b,d,c){function g(b,c,d){switch(b){case 0:return w;case 1:return v[d]||u[c];case 3:if(1===c||10===c)return w}}function h(b){var c={},d;for(d in b)c[b[d]]=parseInt(d);return c}function k(b,c,d,g,h,k){return new e.Record('NameRecord',[{name:'platformID',type:'USHORT',value:b}, -{name:'encodingID',type:'USHORT',value:c},{name:'languageID',type:'USHORT',value:d},{name:'nameID',type:'USHORT',value:g},{name:'length',type:'USHORT',value:h},{name:'offset',type:'USHORT',value:k}])}function l(b,c){a:{var d=b.length;var e=c.length-d+1,g=0;b:for(;e>g;g++)for(;e>g;){for(var h=0;d>h;h++)if(c[g+h]!==b[h])continue b;d=g;break a}d=-1}if(0>d)for(d=c.length,e=0,g=b.length;g>e;++e)c.push(b[e]);return d}d=b('../types');var m=d.decode,q=d.encode,p=b('../parse'),e=b('../table'),n='copyright fontFamily fontSubfamily uniqueID fullName version postScriptName trademark manufacturer designer description manufacturerURL designerURL license licenseURL reserved preferredFamily preferredSubfamily compatibleFullName sampleText postScriptFindFontName wwsFamily wwsSubfamily'.split(' '), +e,d){var c=b('../parse'),k=b('../table');d.parse=function(b,d,e,k,m){var g,h;b=new c.Parser(b,d);for(d=0;k>d;d+=1){e>d&&(g=b.parseUShort(),h=b.parseShort());var l=m.get(d);l.advanceWidth=g;l.leftSideBearing=h}};d.make=function(b){for(var c=new k.Table('hmtx',[]),d=0;dh;h+=1){var l=b.parseUShort(),g=b.parseUShort(),p=b.parseShort();e[l+','+g]=p}return e}},{'../check':2,'../parse':10}],24:[function(b,e,d){var c=b('../parse');d.parse= +function(b,d,e,n){b=new c.Parser(b,d);d=n?b.parseUShort:b.parseULong;for(var h=[],k=0;e+1>k;k+=1){var g=d.call(b);n&&(g*=2);h.push(g)}return h}},{'../parse':10}],25:[function(b,e,d){var c=b('../check'),k=b('../parse'),h=b('../table');d.make=function(b){for(var c=new h.Table('ltag',[{name:'version',type:'ULONG',value:1},{name:'flags',type:'ULONG',value:0},{name:'numTags',type:'ULONG',value:b.length}]),d='',e=12+4*b.length,g=0;gk&&(k=d.length,d+=b[g]);c.fields.push({name:'offset '+ +g,type:'USHORT',value:e+k});c.fields.push({name:'length '+g,type:'USHORT',value:b[g].length})}return c.fields.push({name:'stringPool',type:'CHARARRAY',value:d}),c};d.parse=function(b,d){var e=new k.Parser(b,d),h=e.parseULong();c.argument(1===h,'Unsupported ltag table version.');e.skip('uLong',1);h=e.parseULong();for(var g=[],l=0;h>l;l++){for(var n='',u=d+e.parseUShort(),E=e.parseUShort(),v=u;u+E>v;++v)n+=String.fromCharCode(b.getInt8(v));g.push(n)}return g}},{'../check':2,'../parse':10,'../table':13}], +26:[function(b,e,d){var c=b('../parse'),k=b('../table');d.parse=function(b,d){var e={};b=new c.Parser(b,d);return e.version=b.parseVersion(),e.numGlyphs=b.parseUShort(),1===e.version&&(e.maxPoints=b.parseUShort(),e.maxContours=b.parseUShort(),e.maxCompositePoints=b.parseUShort(),e.maxCompositeContours=b.parseUShort(),e.maxZones=b.parseUShort(),e.maxTwilightPoints=b.parseUShort(),e.maxStorage=b.parseUShort(),e.maxFunctionDefs=b.parseUShort(),e.maxInstructionDefs=b.parseUShort(),e.maxStackElements= +b.parseUShort(),e.maxSizeOfInstructions=b.parseUShort(),e.maxComponentElements=b.parseUShort(),e.maxComponentDepth=b.parseUShort()),e};d.make=function(b){return new k.Table('maxp',[{name:'version',type:'FIXED',value:20480},{name:'numGlyphs',type:'USHORT',value:b}])}},{'../parse':10,'../table':13}],27:[function(b,e,d){var c=b('../types').decode,k=b('../check'),h=b('../parse'),l=b('../table');d.parse=function(b,d){var e=new h.Parser(b,d),g=e.parseULong();k.argument(1===g,'Unsupported META table version.'); +e.parseULong();e.parseULong();g=e.parseULong();for(var l={},n=0;g>n;n++){var q=e.parseTag(),E=e.parseULong(),v=e.parseULong();E=c.UTF8(b,d+E,v);l[q]=E}return l};d.make=function(b){var c=Object.keys(b).length,d='',e=16+12*c;c=new l.Table('meta',[{name:'version',type:'ULONG',value:1},{name:'flags',type:'ULONG',value:0},{name:'offset',type:'ULONG',value:e},{name:'numTags',type:'ULONG',value:c}]);for(var h in b){var k=d.length;d+=b[h];c.fields.push({name:'tag '+h,type:'TAG',value:h});c.fields.push({name:'offset '+ +h,type:'ULONG',value:e+k});c.fields.push({name:'length '+h,type:'ULONG',value:b[h].length})}return c.fields.push({name:'stringPool',type:'CHARARRAY',value:d}),c}},{'../check':2,'../parse':10,'../table':13,'../types':32}],28:[function(b,e,d){function c(b,c,d){switch(b){case 0:return v;case 1:return z[d]||t[c];case 3:if(1===c||10===c)return v}}function k(b){var c={},d;for(d in b)c[b[d]]=parseInt(d);return c}function h(b,c,d,e,h,k){return new g.Record('NameRecord',[{name:'platformID',type:'USHORT',value:b}, +{name:'encodingID',type:'USHORT',value:c},{name:'languageID',type:'USHORT',value:d},{name:'nameID',type:'USHORT',value:e},{name:'length',type:'USHORT',value:h},{name:'offset',type:'USHORT',value:k}])}function l(b,c){a:{var d=b.length;var e=c.length-d+1,g=0;b:for(;e>g;g++)for(;e>g;){for(var h=0;d>h;h++)if(c[g+h]!==b[h])continue b;d=g;break a}d=-1}if(0>d)for(d=c.length,e=0,g=b.length;g>e;++e)c.push(b[e]);return d}e=b('../types');var n=e.decode,q=e.encode,m=b('../parse'),g=b('../table'),p='copyright fontFamily fontSubfamily uniqueID fullName version postScriptName trademark manufacturer designer description manufacturerURL designerURL license licenseURL reserved preferredFamily preferredSubfamily compatibleFullName sampleText postScriptFindFontName wwsFamily wwsSubfamily'.split(' '), r={0:'en',1:'fr',2:'de',3:'it',4:'nl',5:'sv',6:'es',7:'da',8:'pt',9:'no',10:'he',11:'ja',12:'ar',13:'fi',14:'el',15:'is',16:'mt',17:'tr',18:'hr',19:'zh-Hant',20:'ur',21:'hi',22:'th',23:'ko',24:'lt',25:'pl',26:'hu',27:'es',28:'lv',29:'se',30:'fo',31:'fa',32:'ru',33:'zh',34:'nl-BE',35:'ga',36:'sq',37:'ro',38:'cz',39:'sk',40:'si',41:'yi',42:'sr',43:'mk',44:'bg',45:'uk',46:'be',47:'uz',48:'kk',49:'az-Cyrl',50:'az-Arab',51:'hy',52:'ka',53:'mo',54:'ky',55:'tg',56:'tk',57:'mn-CN',58:'mn',59:'ps',60:'ks', 61:'ku',62:'sd',63:'bo',64:'ne',65:'sa',66:'mr',67:'bn',68:'as',69:'gu',70:'pa',71:'or',72:'ml',73:'kn',74:'ta',75:'te',76:'si',77:'my',78:'km',79:'lo',80:'vi',81:'id',82:'tl',83:'ms',84:'ms-Arab',85:'am',86:'ti',87:'om',88:'so',89:'sw',90:'rw',91:'rn',92:'ny',93:'mg',94:'eo',128:'cy',129:'eu',130:'ca',131:'la',132:'qu',133:'gn',134:'ay',135:'tt',136:'ug',137:'dz',138:'jv',139:'su',140:'gl',141:'af',142:'br',143:'iu',144:'gd',145:'gv',146:'ga',147:'to',148:'el-polyton',149:'kl',150:'az',151:'nn'}, -t={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0, -129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},D={1078:'af',1052:'sq',1156:'gsw',1118:'am',5121:'ar-DZ',15361:'ar-BH',3073:'ar',2049:'ar-IQ',11265:'ar-JO',13313:'ar-KW',12289:'ar-LB',4097:'ar-LY',6145:'ary',8193:'ar-OM',16385:'ar-QA',1025:'ar-SA',10241:'ar-SY',7169:'aeb',14337:'ar-AE',9217:'ar-YE',1067:'hy',1101:'as',2092:'az-Cyrl',1068:'az',1133:'ba',1069:'eu',1059:'be',2117:'bn',1093:'bn-IN',8218:'bs-Cyrl', +u={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0, +129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},E={1078:'af',1052:'sq',1156:'gsw',1118:'am',5121:'ar-DZ',15361:'ar-BH',3073:'ar',2049:'ar-IQ',11265:'ar-JO',13313:'ar-KW',12289:'ar-LB',4097:'ar-LY',6145:'ary',8193:'ar-OM',16385:'ar-QA',1025:'ar-SA',10241:'ar-SY',7169:'aeb',14337:'ar-AE',9217:'ar-YE',1067:'hy',1101:'as',2092:'az-Cyrl',1068:'az',1133:'ba',1069:'eu',1059:'be',2117:'bn',1093:'bn-IN',8218:'bs-Cyrl', 5146:'bs',1150:'br',1026:'bg',1027:'ca',3076:'zh-HK',5124:'zh-MO',2052:'zh',4100:'zh-SG',1028:'zh-TW',1155:'co',1050:'hr',4122:'hr-BA',1029:'cs',1030:'da',1164:'prs',1125:'dv',2067:'nl-BE',1043:'nl',3081:'en-AU',10249:'en-BZ',4105:'en-CA',9225:'en-029',16393:'en-IN',6153:'en-IE',8201:'en-JM',17417:'en-MY',5129:'en-NZ',13321:'en-PH',18441:'en-SG',7177:'en-ZA',11273:'en-TT',2057:'en-GB',1033:'en',12297:'en-ZW',1061:'et',1080:'fo',1124:'fil',1035:'fi',2060:'fr-BE',3084:'fr-CA',1036:'fr',5132:'fr-LU', 6156:'fr-MC',4108:'fr-CH',1122:'fy',1110:'gl',1079:'ka',3079:'de-AT',1031:'de',5127:'de-LI',4103:'de-LU',2055:'de-CH',1032:'el',1135:'kl',1095:'gu',1128:'ha',1037:'he',1081:'hi',1038:'hu',1039:'is',1136:'ig',1057:'id',1117:'iu',2141:'iu-Latn',2108:'ga',1076:'xh',1077:'zu',1040:'it',2064:'it-CH',1041:'ja',1099:'kn',1087:'kk',1107:'km',1158:'quc',1159:'rw',1089:'sw',1111:'kok',1042:'ko',1088:'ky',1108:'lo',1062:'lv',1063:'lt',2094:'dsb',1134:'lb',1071:'mk',2110:'ms-BN',1086:'ms',1100:'ml',1082:'mt', 1153:'mi',1146:'arn',1102:'mr',1148:'moh',1104:'mn',2128:'mn-CN',1121:'ne',1044:'nb',2068:'nn',1154:'oc',1096:'or',1123:'ps',1045:'pl',1046:'pt',2070:'pt-PT',1094:'pa',1131:'qu-BO',2155:'qu-EC',3179:'qu',1048:'ro',1047:'rm',1049:'ru',9275:'smn',4155:'smj-NO',5179:'smj',3131:'se-FI',1083:'se',2107:'se-SE',8251:'sms',6203:'sma-NO',7227:'sms',1103:'sa',7194:'sr-Cyrl-BA',3098:'sr',6170:'sr-Latn-BA',2074:'sr-Latn',1132:'nso',1074:'tn',1115:'si',1051:'sk',1060:'sl',11274:'es-AR',16394:'es-BO',13322:'es-CL', -9226:'es-CO',5130:'es-CR',7178:'es-DO',12298:'es-EC',17418:'es-SV',4106:'es-GT',18442:'es-HN',2058:'es-MX',19466:'es-NI',6154:'es-PA',15370:'es-PY',10250:'es-PE',20490:'es-PR',3082:'es',1034:'es',21514:'es-US',14346:'es-UY',8202:'es-VE',2077:'sv-FI',1053:'sv',1114:'syr',1064:'tg',2143:'tzm',1097:'ta',1092:'tt',1098:'te',1054:'th',1105:'bo',1055:'tr',1090:'tk',1152:'ug',1058:'uk',1070:'hsb',1056:'ur',2115:'uz-Cyrl',1091:'uz',1066:'vi',1106:'cy',1160:'wo',1157:'sah',1144:'ii',1130:'yo'},w='utf-16', -u={0:'macintosh',1:'x-mac-japanese',2:'x-mac-chinesetrad',3:'x-mac-korean',6:'x-mac-greek',7:'x-mac-cyrillic',9:'x-mac-devanagai',10:'x-mac-gurmukhi',11:'x-mac-gujarati',12:'x-mac-oriya',13:'x-mac-bengali',14:'x-mac-tamil',15:'x-mac-telugu',16:'x-mac-kannada',17:'x-mac-malayalam',18:'x-mac-sinhalese',19:'x-mac-burmese',20:'x-mac-khmer',21:'x-mac-thai',22:'x-mac-lao',23:'x-mac-georgian',24:'x-mac-armenian',25:'x-mac-chinesesimp',26:'x-mac-tibetan',27:'x-mac-mongolian',28:'x-mac-ethiopic',29:'x-mac-ce', -30:'x-mac-vietnamese',31:'x-mac-extarabic'},v={15:'x-mac-icelandic',17:'x-mac-turkish',18:'x-mac-croatian',24:'x-mac-ce',25:'x-mac-ce',26:'x-mac-ce',27:'x-mac-ce',28:'x-mac-ce',30:'x-mac-icelandic',37:'x-mac-romanian',38:'x-mac-ce',39:'x-mac-ce',40:'x-mac-ce',143:'x-mac-inuit',146:'x-mac-gaelic'};c.parse=function(b,c,d){var e={};c=new p.Parser(b,c);for(var h=c.parseUShort(),k=c.parseUShort(),l=c.offset+c.parseUShort(),q=0;k>q;q++){var t=c.parseUShort(),u=c.parseUShort(),v=c.parseUShort(),z=c.parseUShort(); -z=n[z]||z;var I=c.parseUShort(),G=c.parseUShort();a:{switch(t){case 0:if(65535===v){var V='und';break a}if(d){V=d[v];break a}break;case 1:V=r[v];break a;case 3:V=D[v];break a}V=void 0}t=g(t,u,v);void 0!==t&&void 0!==V&&(t=t===w?m.UTF16(b,l+G,I):m.MACSTRING(b,l+G,I,t))&&(u=e[z],void 0===u&&(u=e[z]={}),u[V]=t)}return 1===h&&c.parseUShort(),e};c.make=function(b,c){var d,m=[],p={},u=h(n);for(v in b){var w=u[v];if(void 0===w&&(w=v),d=parseInt(w),isNaN(d))throw Error('Name table entry "'+v+'" does not exist, see nameTableNames for complete list.'); -p[d]=b[v];m.push(d)}var v=h(r);w=h(D);b=[];u=[];for(var z=0;zma&&(ma=c.length,c.push(ja)),V=4,ca=q.UTF16(ia));var ba=l(ca,u);b.push(k(N,V,ma,d,ca.length,ba));N=w[ja];void 0!==N&&(ia=q.UTF16(ia),ma=l(ia,u),b.push(k(3,1,N,d,ia.length,ma)))}}b.sort(function(b,c){return b.platformID-c.platformID||b.encodingID-c.encodingID||b.languageID-c.languageID|| -b.nameID-c.nameID});c=new e.Table('name',[{name:'format',type:'USHORT',value:0},{name:'count',type:'USHORT',value:b.length},{name:'stringOffset',type:'USHORT',value:6+12*b.length}]);for(d=0;dq;q++){var u=d.parseUShort(),t=d.parseUShort(),w=d.parseUShort(),z=d.parseUShort(); +z=p[z]||z;var H=d.parseUShort(),I=d.parseUShort();a:{switch(u){case 0:if(65535===w){var T='und';break a}if(e){T=e[w];break a}break;case 1:T=r[w];break a;case 3:T=E[w];break a}T=void 0}u=c(u,t,w);void 0!==u&&void 0!==T&&(u=u===v?n.UTF16(b,l+I,H):n.MACSTRING(b,l+I,H,u))&&(t=g[z],void 0===t&&(t=g[z]={}),t[T]=u)}return 1===h&&d.parseUShort(),g};d.make=function(b,d){var e,m=[],n={},t=k(p);for(w in b){var v=t[w];if(void 0===v&&(v=w),e=parseInt(v),isNaN(e))throw Error('Name table entry "'+w+'" does not exist, see nameTableNames for complete list.'); +n[e]=b[w];m.push(e)}var w=k(r);v=k(E);b=[];t=[];for(var z=0;zla&&(la=d.length,d.push(ja)),T=4,aa=q.UTF16(ba));var da=l(aa,t);b.push(h(N,T,la,e,aa.length,da));N=v[ja];void 0!==N&&(ba=q.UTF16(ba),la=l(ba,t),b.push(h(3,1,N,e,ba.length,la)))}}b.sort(function(b,c){return b.platformID-c.platformID||b.encodingID-c.encodingID||b.languageID-c.languageID|| +b.nameID-c.nameID});d=new g.Table('name',[{name:'format',type:'USHORT',value:0},{name:'count',type:'USHORT',value:b.length},{name:'stringOffset',type:'USHORT',value:6+12*b.length}]);for(e=0;e=d.begin&&bc;c++)d.panose[c]=b.parseByte();return d.ulUnicodeRange1=b.parseULong(), -d.ulUnicodeRange2=b.parseULong(),d.ulUnicodeRange3=b.parseULong(),d.ulUnicodeRange4=b.parseULong(),d.achVendID=String.fromCharCode(b.parseByte(),b.parseByte(),b.parseByte(),b.parseByte()),d.fsSelection=b.parseUShort(),d.usFirstCharIndex=b.parseUShort(),d.usLastCharIndex=b.parseUShort(),d.sTypoAscender=b.parseShort(),d.sTypoDescender=b.parseShort(),d.sTypoLineGap=b.parseShort(),d.usWinAscent=b.parseUShort(),d.usWinDescent=b.parseUShort(),1<=d.version&&(d.ulCodePageRange1=b.parseULong(),d.ulCodePageRange2= -b.parseULong()),2<=d.version&&(d.sxHeight=b.parseShort(),d.sCapHeight=b.parseShort(),d.usDefaultChar=b.parseUShort(),d.usBreakChar=b.parseUShort(),d.usMaxContent=b.parseUShort()),d};c.make=function(b){return new h.Table('OS/2',[{name:'version',type:'USHORT',value:3},{name:'xAvgCharWidth',type:'SHORT',value:0},{name:'usWeightClass',type:'USHORT',value:0},{name:'usWidthClass',type:'USHORT',value:0},{name:'fsType',type:'USHORT',value:0},{name:'ySubscriptXSize',type:'SHORT',value:650},{name:'ySubscriptYSize', +{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66E3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];d.unicodeRanges=h;d.getUnicodeRange=function(b){for(var c=0;c=d.begin&&bd;d++)e.panose[d]=b.parseByte();return e.ulUnicodeRange1=b.parseULong(), +e.ulUnicodeRange2=b.parseULong(),e.ulUnicodeRange3=b.parseULong(),e.ulUnicodeRange4=b.parseULong(),e.achVendID=String.fromCharCode(b.parseByte(),b.parseByte(),b.parseByte(),b.parseByte()),e.fsSelection=b.parseUShort(),e.usFirstCharIndex=b.parseUShort(),e.usLastCharIndex=b.parseUShort(),e.sTypoAscender=b.parseShort(),e.sTypoDescender=b.parseShort(),e.sTypoLineGap=b.parseShort(),e.usWinAscent=b.parseUShort(),e.usWinDescent=b.parseUShort(),1<=e.version&&(e.ulCodePageRange1=b.parseULong(),e.ulCodePageRange2= +b.parseULong()),2<=e.version&&(e.sxHeight=b.parseShort(),e.sCapHeight=b.parseShort(),e.usDefaultChar=b.parseUShort(),e.usBreakChar=b.parseUShort(),e.usMaxContent=b.parseUShort()),e};d.make=function(b){return new k.Table('OS/2',[{name:'version',type:'USHORT',value:3},{name:'xAvgCharWidth',type:'SHORT',value:0},{name:'usWeightClass',type:'USHORT',value:0},{name:'usWidthClass',type:'USHORT',value:0},{name:'fsType',type:'USHORT',value:0},{name:'ySubscriptXSize',type:'SHORT',value:650},{name:'ySubscriptYSize', type:'SHORT',value:699},{name:'ySubscriptXOffset',type:'SHORT',value:0},{name:'ySubscriptYOffset',type:'SHORT',value:140},{name:'ySuperscriptXSize',type:'SHORT',value:650},{name:'ySuperscriptYSize',type:'SHORT',value:699},{name:'ySuperscriptXOffset',type:'SHORT',value:0},{name:'ySuperscriptYOffset',type:'SHORT',value:479},{name:'yStrikeoutSize',type:'SHORT',value:49},{name:'yStrikeoutPosition',type:'SHORT',value:258},{name:'sFamilyClass',type:'SHORT',value:0},{name:'bFamilyType',type:'BYTE',value:0}, {name:'bSerifStyle',type:'BYTE',value:0},{name:'bWeight',type:'BYTE',value:0},{name:'bProportion',type:'BYTE',value:0},{name:'bContrast',type:'BYTE',value:0},{name:'bStrokeVariation',type:'BYTE',value:0},{name:'bArmStyle',type:'BYTE',value:0},{name:'bLetterform',type:'BYTE',value:0},{name:'bMidline',type:'BYTE',value:0},{name:'bXHeight',type:'BYTE',value:0},{name:'ulUnicodeRange1',type:'ULONG',value:0},{name:'ulUnicodeRange2',type:'ULONG',value:0},{name:'ulUnicodeRange3',type:'ULONG',value:0},{name:'ulUnicodeRange4', type:'ULONG',value:0},{name:'achVendID',type:'CHARARRAY',value:'XXXX'},{name:'fsSelection',type:'USHORT',value:0},{name:'usFirstCharIndex',type:'USHORT',value:0},{name:'usLastCharIndex',type:'USHORT',value:0},{name:'sTypoAscender',type:'SHORT',value:0},{name:'sTypoDescender',type:'SHORT',value:0},{name:'sTypoLineGap',type:'SHORT',value:0},{name:'usWinAscent',type:'USHORT',value:0},{name:'usWinDescent',type:'USHORT',value:0},{name:'ulCodePageRange1',type:'ULONG',value:0},{name:'ulCodePageRange2',type:'ULONG', -value:0},{name:'sxHeight',type:'SHORT',value:0},{name:'sCapHeight',type:'SHORT',value:0},{name:'usDefaultChar',type:'USHORT',value:0},{name:'usBreakChar',type:'USHORT',value:0},{name:'usMaxContext',type:'USHORT',value:0}],b)}},{'../parse':10,'../table':13}],30:[function(b,d,c){var g=b('../encoding'),h=b('../parse'),k=b('../table');c.parse=function(b,c){var d={};c=new h.Parser(b,c);switch(d.version=c.parseVersion(),d.italicAngle=c.parseFixed(),d.underlinePosition=c.parseShort(),d.underlineThickness= -c.parseShort(),d.isFixedPitch=c.parseULong(),d.minMemType42=c.parseULong(),d.maxMemType42=c.parseULong(),d.minMemType1=c.parseULong(),d.maxMemType1=c.parseULong(),d.version){case 1:d.names=g.standardNames.slice();break;case 2:d.numberOfGlyphs=c.parseUShort();d.glyphNameIndex=Array(d.numberOfGlyphs);for(b=0;b=g.standardNames.length){var k=c.parseChar();d.names.push(c.parseString(k))}break; -case 2.5:for(d.numberOfGlyphs=c.parseUShort(),d.offset=Array(d.numberOfGlyphs),b=0;bc.value.tag?1:-1}),c.fields=c.fields.concat(d),c.fields=c.fields.concat(e),c}function l(b,c,d){for(var e=0;esa||void 0===c)&&0N&&(N=sa);sa=v.getUnicodeRange(sa);if(32>sa)ma|=1<sa)V|=1<sa)ca|=1<sa))throw Error('Unicode ranges bits > 123 are reserved for internal usage');ba|=1<=b,'Byte value should be between 0 and 255.'), -[b]};l.BYTE=g(1);k.CHAR=function(b){return[b.charCodeAt(0)]};l.CHAR=g(1);k.CHARARRAY=function(b){for(var c=[],d=0;d>8&255,255&b]};l.USHORT=g(2);k.SHORT=function(b){return 32768<=b&&(b=-(65536-b)),[b>>8&255,255&b]};l.SHORT=g(2);k.UINT24=function(b){return[b>>16&255,b>>8&255,255&b]};l.UINT24=g(3);k.ULONG=function(b){return[b>>24&255,b>>16&255,b>>8&255,255&b]};l.ULONG=g(4);k.LONG=function(b){return 2147483648<= -b&&(b=-(4294967296-b)),[b>>24&255,b>>16&255,b>>8&255,255&b]};l.LONG=g(4);k.FIXED=k.ULONG;l.FIXED=l.ULONG;k.FWORD=k.SHORT;l.FWORD=l.SHORT;k.UFWORD=k.USHORT;l.UFWORD=l.USHORT;k.LONGDATETIME=function(b){return[0,0,0,0,b>>24&255,b>>16&255,b>>8&255,255&b]};l.LONGDATETIME=g(8);k.TAG=function(b){return h.argument(4===b.length,'Tag should be exactly 4 ASCII characters.'),[b.charCodeAt(0),b.charCodeAt(1),b.charCodeAt(2),b.charCodeAt(3)]};l.TAG=g(4);k.Card8=k.BYTE;l.Card8=l.BYTE;k.Card16=k.USHORT;l.Card16= -l.USHORT;k.OffSize=k.BYTE;l.OffSize=l.BYTE;k.SID=k.USHORT;l.SID=l.USHORT;k.NUMBER=function(b){return-107<=b&&107>=b?[b+139]:108<=b&&1131>=b?(b-=108,[(b>>8)+247,255&b]):-1131<=b&&-108>=b?(b=-b-108,[(b>>8)+251,255&b]):-32768<=b&&32767>=b?k.NUMBER16(b):k.NUMBER32(b)};l.NUMBER=function(b){return k.NUMBER(b).length};k.NUMBER16=function(b){return[28,b>>8&255,255&b]};l.NUMBER16=g(3);k.NUMBER32=function(b){return[29,b>>24&255,b>>16&255,b>>8&255,255&b]};l.NUMBER32=g(5);k.REAL=function(b){var c=b.toString(), -d=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(c);d&&(c=parseFloat('1e'+((d[2]?+d[2]:0)+d[1].length)),c=(Math.round(b*c)/c).toString());var e='';b=0;for(d=c.length;d>b;b+=1){var g=c[b];e+='e'===g?'-'===c[++b]?'c':'b':'.'===g?'a':'-'===g?'e':g}e+=1&e.length?'f':'ff';c=[30];b=0;for(d=e.length;d>b;b+=2)c.push(parseInt(e.substr(b,2),16));return c};l.REAL=function(b){return k.REAL(b).length};k.NAME=k.CHARARRAY;l.NAME=l.CHARARRAY;k.STRING=k.CHARARRAY;l.STRING=l.CHARARRAY;b.UTF8=function(b,c,d){for(var e= -[],g=0;d>g;g++,c+=1)e[g]=b.getUint8(c);return String.fromCharCode.apply(null,e)};b.UTF16=function(b,c,d){var e=[];d/=2;for(var g=0;d>g;g++,c+=2)e[g]=b.getUint16(c);return String.fromCharCode.apply(null,e)};k.UTF16=function(b){for(var c=[],d=0;d>8&255;c[c.length]=255&e}return c};l.UTF16=function(b){return 2*b.length};var m={'x-mac-croatian':'\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u0160\u2122\u00b4\u00a8\u2260\u017d\u00d8\u221e\u00b1\u2264\u2265\u2206\u00b5\u2202\u2211\u220f\u0161\u222b\u00aa\u00ba\u03a9\u017e\u00f8\u00bf\u00a1\u00ac\u221a\u0192\u2248\u0106\u00ab\u010c\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u0110\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\uf8ff\u00a9\u2044\u20ac\u2039\u203a\u00c6\u00bb\u2013\u00b7\u201a\u201e\u2030\u00c2\u0107\u00c1\u010d\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\u0111\u00d2\u00da\u00db\u00d9\u0131\u02c6\u02dc\u00af\u03c0\u00cb\u02da\u00b8\u00ca\u00e6\u02c7', +value:0},{name:'sxHeight',type:'SHORT',value:0},{name:'sCapHeight',type:'SHORT',value:0},{name:'usDefaultChar',type:'USHORT',value:0},{name:'usBreakChar',type:'USHORT',value:0},{name:'usMaxContext',type:'USHORT',value:0}],b)}},{'../parse':10,'../table':13}],30:[function(b,e,d){var c=b('../encoding'),k=b('../parse'),h=b('../table');d.parse=function(b,d){var e={};d=new k.Parser(b,d);switch(e.version=d.parseVersion(),e.italicAngle=d.parseFixed(),e.underlinePosition=d.parseShort(),e.underlineThickness= +d.parseShort(),e.isFixedPitch=d.parseULong(),e.minMemType42=d.parseULong(),e.maxMemType42=d.parseULong(),e.minMemType1=d.parseULong(),e.maxMemType1=d.parseULong(),e.version){case 1:e.names=c.standardNames.slice();break;case 2:e.numberOfGlyphs=d.parseUShort();e.glyphNameIndex=Array(e.numberOfGlyphs);for(b=0;b=c.standardNames.length){var h=d.parseChar();e.names.push(d.parseString(h))}break; +case 2.5:for(e.numberOfGlyphs=d.parseUShort(),e.offset=Array(e.numberOfGlyphs),b=0;bc.value.tag?1:-1}),d.fields=d.fields.concat(e),d.fields=d.fields.concat(g),d}function l(b,c,d){for(var e=0;epa||void 0===d)&&0N&&(N=pa);pa=z.getUnicodeRange(pa);if(32>pa)la|=1<pa)T|=1<pa)aa|=1<pa))throw Error('Unicode ranges bits > 123 are reserved for internal usage');da|=1<=b,'Byte value should be between 0 and 255.'), +[b]};l.BYTE=c(1);h.CHAR=function(b){return[b.charCodeAt(0)]};l.CHAR=c(1);h.CHARARRAY=function(b){for(var c=[],d=0;d>8&255,255&b]};l.USHORT=c(2);h.SHORT=function(b){return 32768<=b&&(b=-(65536-b)),[b>>8&255,255&b]};l.SHORT=c(2);h.UINT24=function(b){return[b>>16&255,b>>8&255,255&b]};l.UINT24=c(3);h.ULONG=function(b){return[b>>24&255,b>>16&255,b>>8&255,255&b]};l.ULONG=c(4);h.LONG=function(b){return 2147483648<= +b&&(b=-(4294967296-b)),[b>>24&255,b>>16&255,b>>8&255,255&b]};l.LONG=c(4);h.FIXED=h.ULONG;l.FIXED=l.ULONG;h.FWORD=h.SHORT;l.FWORD=l.SHORT;h.UFWORD=h.USHORT;l.UFWORD=l.USHORT;h.LONGDATETIME=function(b){return[0,0,0,0,b>>24&255,b>>16&255,b>>8&255,255&b]};l.LONGDATETIME=c(8);h.TAG=function(b){return k.argument(4===b.length,'Tag should be exactly 4 ASCII characters.'),[b.charCodeAt(0),b.charCodeAt(1),b.charCodeAt(2),b.charCodeAt(3)]};l.TAG=c(4);h.Card8=h.BYTE;l.Card8=l.BYTE;h.Card16=h.USHORT;l.Card16= +l.USHORT;h.OffSize=h.BYTE;l.OffSize=l.BYTE;h.SID=h.USHORT;l.SID=l.USHORT;h.NUMBER=function(b){return-107<=b&&107>=b?[b+139]:108<=b&&1131>=b?(b-=108,[(b>>8)+247,255&b]):-1131<=b&&-108>=b?(b=-b-108,[(b>>8)+251,255&b]):-32768<=b&&32767>=b?h.NUMBER16(b):h.NUMBER32(b)};l.NUMBER=function(b){return h.NUMBER(b).length};h.NUMBER16=function(b){return[28,b>>8&255,255&b]};l.NUMBER16=c(3);h.NUMBER32=function(b){return[29,b>>24&255,b>>16&255,b>>8&255,255&b]};l.NUMBER32=c(5);h.REAL=function(b){var c=b.toString(), +d=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(c);d&&(c=parseFloat('1e'+((d[2]?+d[2]:0)+d[1].length)),c=(Math.round(b*c)/c).toString());var e='';b=0;for(d=c.length;d>b;b+=1){var g=c[b];e+='e'===g?'-'===c[++b]?'c':'b':'.'===g?'a':'-'===g?'e':g}e+=1&e.length?'f':'ff';c=[30];b=0;for(d=e.length;d>b;b+=2)c.push(parseInt(e.substr(b,2),16));return c};l.REAL=function(b){return h.REAL(b).length};h.NAME=h.CHARARRAY;l.NAME=l.CHARARRAY;h.STRING=h.CHARARRAY;l.STRING=l.CHARARRAY;b.UTF8=function(b,c,d){for(var e= +[],g=0;d>g;g++,c+=1)e[g]=b.getUint8(c);return String.fromCharCode.apply(null,e)};b.UTF16=function(b,c,d){var e=[];d/=2;for(var g=0;d>g;g++,c+=2)e[g]=b.getUint16(c);return String.fromCharCode.apply(null,e)};h.UTF16=function(b){for(var c=[],d=0;d>8&255;c[c.length]=255&e}return c};l.UTF16=function(b){return 2*b.length};var n={'x-mac-croatian':'\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u0160\u2122\u00b4\u00a8\u2260\u017d\u00d8\u221e\u00b1\u2264\u2265\u2206\u00b5\u2202\u2211\u220f\u0161\u222b\u00aa\u00ba\u03a9\u017e\u00f8\u00bf\u00a1\u00ac\u221a\u0192\u2248\u0106\u00ab\u010c\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u0110\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\uf8ff\u00a9\u2044\u20ac\u2039\u203a\u00c6\u00bb\u2013\u00b7\u201a\u201e\u2030\u00c2\u0107\u00c1\u010d\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\u0111\u00d2\u00da\u00db\u00d9\u0131\u02c6\u02dc\u00af\u03c0\u00cb\u02da\u00b8\u00ca\u00e6\u02c7', 'x-mac-cyrillic':'\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042a\u042b\u042c\u042d\u042e\u042f\u2020\u00b0\u0490\u00a3\u00a7\u2022\u00b6\u0406\u00ae\u00a9\u2122\u0402\u0452\u2260\u0403\u0453\u221e\u00b1\u2264\u2265\u0456\u00b5\u0491\u0408\u0404\u0454\u0407\u0457\u0409\u0459\u040a\u045a\u0458\u0405\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u040b\u045b\u040c\u045c\u0455\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u201e\u040e\u045e\u040f\u045f\u2116\u0401\u0451\u044f\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044a\u044b\u044c\u044d\u044e', 'x-mac-gaelic':'\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u00b4\u00a8\u2260\u00c6\u00d8\u1e02\u00b1\u2264\u2265\u1e03\u010a\u010b\u1e0a\u1e0b\u1e1e\u1e1f\u0120\u0121\u1e40\u00e6\u00f8\u1e41\u1e56\u1e57\u027c\u0192\u017f\u1e60\u00ab\u00bb\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u2013\u2014\u201c\u201d\u2018\u2019\u1e61\u1e9b\u00ff\u0178\u1e6a\u20ac\u2039\u203a\u0176\u0177\u1e6b\u00b7\u1ef2\u1ef3\u204a\u00c2\u00ca\u00c1\u00cb\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\u2663\u00d2\u00da\u00db\u00d9\u0131\u00dd\u00fd\u0174\u0175\u1e84\u1e85\u1e80\u1e81\u1e82\u1e83', 'x-mac-greek':'\u00c4\u00b9\u00b2\u00c9\u00b3\u00d6\u00dc\u0385\u00e0\u00e2\u00e4\u0384\u00a8\u00e7\u00e9\u00e8\u00ea\u00eb\u00a3\u2122\u00ee\u00ef\u2022\u00bd\u2030\u00f4\u00f6\u00a6\u20ac\u00f9\u00fb\u00fc\u2020\u0393\u0394\u0398\u039b\u039e\u03a0\u00df\u00ae\u00a9\u03a3\u03aa\u00a7\u2260\u00b0\u00b7\u0391\u00b1\u2264\u2265\u00a5\u0392\u0395\u0396\u0397\u0399\u039a\u039c\u03a6\u03ab\u03a8\u03a9\u03ac\u039d\u00ac\u039f\u03a1\u2248\u03a4\u00ab\u00bb\u2026\u00a0\u03a5\u03a7\u0386\u0388\u0153\u2013\u2015\u201c\u201d\u2018\u2019\u00f7\u0389\u038a\u038c\u038e\u03ad\u03ae\u03af\u03cc\u038f\u03cd\u03b1\u03b2\u03c8\u03b4\u03b5\u03c6\u03b3\u03b7\u03b9\u03be\u03ba\u03bb\u03bc\u03bd\u03bf\u03c0\u03ce\u03c1\u03c3\u03c4\u03b8\u03c9\u03c2\u03c7\u03c5\u03b6\u03ca\u03cb\u0390\u03b0\u00ad', @@ -2183,36 +2194,36 @@ d=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(c);d&&(c=parseFloat('1e'+ macintosh:'\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u00b4\u00a8\u2260\u00c6\u00d8\u221e\u00b1\u2264\u2265\u00a5\u00b5\u2202\u2211\u220f\u03c0\u222b\u00aa\u00ba\u03a9\u00e6\u00f8\u00bf\u00a1\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\u00ff\u0178\u2044\u20ac\u2039\u203a\ufb01\ufb02\u2021\u00b7\u201a\u201e\u2030\u00c2\u00ca\u00c1\u00cb\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\uf8ff\u00d2\u00da\u00db\u00d9\u0131\u02c6\u02dc\u00af\u02d8\u02d9\u02da\u00b8\u02dd\u02db\u02c7', 'x-mac-romanian':'\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u00b4\u00a8\u2260\u0102\u0218\u221e\u00b1\u2264\u2265\u00a5\u00b5\u2202\u2211\u220f\u03c0\u222b\u00aa\u00ba\u03a9\u0103\u0219\u00bf\u00a1\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\u00ff\u0178\u2044\u20ac\u2039\u203a\u021a\u021b\u2021\u00b7\u201a\u201e\u2030\u00c2\u00ca\u00c1\u00cb\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\uf8ff\u00d2\u00da\u00db\u00d9\u0131\u02c6\u02dc\u00af\u02d8\u02d9\u02da\u00b8\u02dd\u02db\u02c7', 'x-mac-turkish':'\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u00b4\u00a8\u2260\u00c6\u00d8\u221e\u00b1\u2264\u2265\u00a5\u00b5\u2202\u2211\u220f\u03c0\u222b\u00aa\u00ba\u03a9\u00e6\u00f8\u00bf\u00a1\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\u00ff\u0178\u011e\u011f\u0130\u0131\u015e\u015f\u2021\u00b7\u201a\u201e\u2030\u00c2\u00ca\u00c1\u00cb\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\uf8ff\u00d2\u00da\u00db\u00d9\uf8a0\u02c6\u02dc\u00af\u02d8\u02d9\u02da\u00b8\u02dd\u02db\u02c7'}; -b.MACSTRING=function(b,c,d,e){e=m[e];if(void 0!==e){for(var g='',h=0;d>h;h++){var k=b.getUint8(c+h);g+=127>=k?String.fromCharCode(k):e[127&k]}return g}};var q='function'==typeof WeakMap&&new WeakMap,p;k.MACSTRING=function(b,c){a:{if(!p)for(d in p={},m)p[d]=new String(d);var d=p[c];if(void 0!==d){if(q){var e=q.get(d);if(void 0!==e){d=e;break a}}c=m[c];if(void 0!==c){e={};for(var g=0;gg;g+=1){var h=parseInt(d[g],0),l=b[h];c=c.concat(k.OPERAND(l.value,l.type));c=c.concat(k.OPERATOR(h))}return c};l.DICT=function(b){return k.DICT(b).length};k.OPERATOR=function(b){return 1200>b?[b]:[12,b-1200]};k.OPERAND=function(b,c){var d=[];if(Array.isArray(c))for(var e=0;eg;g+=1){var h=b[g];c=c.concat(k[h.type](h.value))}return e&&e.set(b,c),c};l.CHARSTRING=function(b){return k.CHARSTRING(b).length}; -k.OBJECT=function(b){var c=k[b.type];return h.argument(void 0!==c,'No encoding function for type '+b.type),c(b.value)};l.OBJECT=function(b){var c=l[b.type];return h.argument(void 0!==c,'No sizeOf function for type '+b.type),c(b.value)};k.TABLE=function(b){var c,d=[],e=b.fields.length,g=[],l=[];for(c=0;e>c;c+=1){var m=b.fields[c],n=k[m.type];h.argument(void 0!==n,'No encoding function for field type '+m.type+' ('+m.name+')');var p=b[m.name];void 0===p&&(p=m.value);n=n(p);'TABLE'===m.type?(l.push(d.length), -d=d.concat([0,0]),g.push(n)):d=d.concat(n)}for(c=0;cm,'Table '+b.tableName+' too big.'),d[e]=m>>8,d[e+1]=255&m,d=d.concat(g[c]);return d};l.TABLE=function(b){for(var c=0,d=b.fields.length,e=0;d>e;e+=1){var g=b.fields[e],k=l[g.type];h.argument(void 0!==k,'No sizeOf function for field type '+g.type+' ('+g.name+')');var m=b[g.name];void 0===m&&(m=g.value);c+=k(m);'TABLE'===g.type&&(c+=2)}return c};k.RECORD=k.TABLE;l.RECORD=l.TABLE;k.LITERAL=function(b){return b}; -l.LITERAL=function(b){return b.length};c.decode=b;c.encode=k;c.sizeOf=l},{'./check':2}],33:[function(b,d,c){c.isBrowser=function(){return'undefined'!=typeof window};c.isNode=function(){return'undefined'==typeof window};c.nodeBufferToArrayBuffer=function(b){for(var c=new ArrayBuffer(b.length),d=new Uint8Array(c),g=0;g'===Nunu.TIMESTAMP};Nunu.webvrAvailable=function(){return void 0!==navigator.getVRDisplays}; -Nunu.getVRDisplays=function(a){void 0===navigator.getVRDisplays?console.warn('nunuStudio: WebVR is not supported.'):navigator.getVRDisplays().then(function(b){0h;h++){var k=b.getUint8(c+h);g+=127>=k?String.fromCharCode(k):e[127&k]}return g}};var q='function'==typeof WeakMap&&new WeakMap,m;h.MACSTRING=function(b,c){a:{if(!m)for(d in m={},n)m[d]=new String(d);var d=m[c];if(void 0!==d){if(q){var e=q.get(d);if(void 0!==e){d=e;break a}}c=n[c];if(void 0!==c){e={};for(var g=0;gg;g+=1){var k=parseInt(d[g],0),l=b[k];c=c.concat(h.OPERAND(l.value,l.type));c=c.concat(h.OPERATOR(k))}return c};l.DICT=function(b){return h.DICT(b).length};h.OPERATOR=function(b){return 1200>b?[b]:[12,b-1200]};h.OPERAND=function(b,c){var d=[];if(Array.isArray(c))for(var e=0;ee;e+=1){var k=b[e];c=c.concat(h[k.type](k.value))}return g&&g.set(b,c),c};l.CHARSTRING=function(b){return h.CHARSTRING(b).length}; +h.OBJECT=function(b){var c=h[b.type];return k.argument(void 0!==c,'No encoding function for type '+b.type),c(b.value)};l.OBJECT=function(b){var c=l[b.type];return k.argument(void 0!==c,'No sizeOf function for type '+b.type),c(b.value)};h.TABLE=function(b){var c,d=[],e=b.fields.length,g=[],l=[];for(c=0;e>c;c+=1){var m=b.fields[c],n=h[m.type];k.argument(void 0!==n,'No encoding function for field type '+m.type+' ('+m.name+')');var p=b[m.name];void 0===p&&(p=m.value);n=n(p);'TABLE'===m.type?(l.push(d.length), +d=d.concat([0,0]),g.push(n)):d=d.concat(n)}for(c=0;cm,'Table '+b.tableName+' too big.'),d[e]=m>>8,d[e+1]=255&m,d=d.concat(g[c]);return d};l.TABLE=function(b){for(var c=0,d=b.fields.length,e=0;d>e;e+=1){var g=b.fields[e],h=l[g.type];k.argument(void 0!==h,'No sizeOf function for field type '+g.type+' ('+g.name+')');var m=b[g.name];void 0===m&&(m=g.value);c+=h(m);'TABLE'===g.type&&(c+=2)}return c};h.RECORD=h.TABLE;l.RECORD=l.TABLE;h.LITERAL=function(b){return b}; +l.LITERAL=function(b){return b.length};d.decode=b;d.encode=h;d.sizeOf=l},{'./check':2}],33:[function(b,e,d){d.isBrowser=function(){return'undefined'!=typeof window};d.isNode=function(){return'undefined'==typeof window};d.nodeBufferToArrayBuffer=function(b){for(var c=new ArrayBuffer(b.length),d=new Uint8Array(c),e=0;e'===Nunu.TIMESTAMP};Nunu.webvrAvailable=function(){return void 0!==navigator.getVRDisplays}; +Nunu.getVRDisplays=function(a){void 0===navigator.getVRDisplays?console.warn('nunuStudio: WebVR is not supported.'):navigator.getVRDisplays().then(function(b){0d?b+1:d+1,a.lastIndexOf('.'))}return''};FileSystem.getFileNameWithExtension=function(a){if(void 0!==a){var b=a.lastIndexOf('\\'),d=a.lastIndexOf('/');return a.substring(b>d?b+1:d+1,a.length)}return''}; -FileSystem.getNameWithoutExtension=function(a){return void 0!==a?a.substring(0,a.lastIndexOf('.')):''};FileSystem.getFilePath=function(a){if(void 0!==a){var b=a.lastIndexOf('\\'),d=a.lastIndexOf('/');return a.substring(0,b>d?b+1:d+1)}return''};FileSystem.getFileExtension=function(a){return void 0!==a?a.substring(a.lastIndexOf('.')+1,a.length).toLowerCase():''};'use strict';THREE.KeyframeTrack.prototype.color='#FF0000';THREE.KeyframeTrack.prototype.setColor=function(a){this.color=a}; -THREE.KeyframeTrack.prototype.sort=function(){for(var a=0;athis.times[b]){var d=this.times[b];this.times[b]=this.times[a];this.times[a]=d;for(var c=this.getValueSize(),g=b*c,h=a*c,k=0;ke?b+1:e+1,a.lastIndexOf('.'))}return''};FileSystem.getFileNameWithExtension=function(a){if(void 0!==a){var b=a.lastIndexOf('\\'),e=a.lastIndexOf('/');return a.substring(b>e?b+1:e+1,a.length)}return''}; +FileSystem.getNameWithoutExtension=function(a){return void 0!==a?a.substring(0,a.lastIndexOf('.')):''};FileSystem.getFilePath=function(a){if(void 0!==a){var b=a.lastIndexOf('\\'),e=a.lastIndexOf('/');return a.substring(0,b>e?b+1:e+1)}return''};FileSystem.getFileExtension=function(a){return void 0!==a?a.substring(a.lastIndexOf('.')+1,a.length).toLowerCase():''};'use strict';THREE.KeyframeTrack.prototype.color='#FF0000';THREE.KeyframeTrack.prototype.setColor=function(a){this.color=a}; +THREE.KeyframeTrack.prototype.sort=function(){for(var a=0;athis.times[b]){var e=this.times[b];this.times[b]=this.times[a];this.times[a]=e;for(var d=this.getValueSize(),c=b*d,k=a*d,h=0;hg&&(g=l)}this.boundingSphere.radius=Math.sqrt(g)}}}(); -THREE.BufferGeometry.prototype.toJSON=function(){var a={metadata:{version:4.5,type:'BufferGeometry',generator:'BufferGeometry.toJSON'}};a.uuid=this.uuid;a.type=this.type;a.name=this.name;if(void 0!==this.parameters){var b=this.parameters;for(k in b)void 0!==b[k]&&(a[k]=b[k]);return a}a.data={attributes:{},morphAttributes:{}};var d=this.index;null!==d&&(b=Array.prototype.slice.call(d.array),a.data.index={type:d.array.constructor.name,array:b});var c=this.attributes;for(k in c)d=c[k],b=Array.prototype.slice.call(d.array), -a.data.attributes[k]={itemSize:d.itemSize,type:d.array.constructor.name,array:b,normalized:d.normalized};b=this.morphAttributes;for(k in b){c=this.morphAttributes[k];b=[];for(var g=0,h=c.length;gthis.opacity&&(d.opacity=this.opacity);!0===this.transparent&&(d.transparent=this.transparent);!0===this.dithering&&(d.dithering=!0);0c&&(c=l)}this.boundingSphere.radius=Math.sqrt(c)}}}(); +THREE.BufferGeometry.prototype.toJSON=function(){var a={metadata:{version:4.5,type:'BufferGeometry',generator:'BufferGeometry.toJSON'}};a.uuid=this.uuid;a.type=this.type;a.name=this.name;if(void 0!==this.parameters){var b=this.parameters;for(h in b)void 0!==b[h]&&(a[h]=b[h]);return a}a.data={attributes:{},morphAttributes:{}};var e=this.index;null!==e&&(b=Array.prototype.slice.call(e.array),a.data.index={type:e.array.constructor.name,array:b});var d=this.attributes;for(h in d)e=d[h],b=Array.prototype.slice.call(e.array), +a.data.attributes[h]={itemSize:e.itemSize,type:e.array.constructor.name,array:b,normalized:e.normalized};b=this.morphAttributes;for(h in b){d=this.morphAttributes[h];b=[];for(var c=0,k=d.length;cthis.opacity&&(e.opacity=this.opacity);!0===this.transparent&&(e.transparent=this.transparent);!0===this.dithering&&(e.dithering=!0);0a;){var b=this.actions.shift(),d=this.actions.shift();void 0===this.keys[b]&&(this.keys[b]=new Key);this.keys[b].update(d);if(this.keys[b].justReleased||this.keys[b].justPressed)this.actions.push(b),this.actions.push(Key.RESET),a+=2}};Keyboard.reset=function(){for(var a=0;aa;){var b=this.actions.shift(),e=this.actions.shift();void 0===this.keys[b]&&(this.keys[b]=new Key);this.keys[b].update(e);if(this.keys[b].justReleased||this.keys[b].justPressed)this.actions.push(b),this.actions.push(Key.RESET),a+=2}};Keyboard.reset=function(){for(var a=0;aa;a++)this._doubleClicked[a]=!1,this.doubleClicked[a]=!1,this._keys[a]=new Key, -this.keys[a]=new Key;var d=this;void 0!==window.onmousewheel?this.events.add(this.domElement,'mousewheel',function(a){d._wheel=a.deltaY;d._wheelUpdated=!0}):void 0!==window.addEventListener?this.events.add(this.domElement,'DOMMouseScroll',function(a){d._wheel=30*a.detail;d._wheelUpdated=!0}):this.events.add(this.domElement,'wheel',function(a){d._wheel=a.deltaY;d._wheelUpdated=!0});if(void 0!==window.ontouchstart||0a;a++)this._keys[a].justPressed&&this.keys[a].justPressed&&(this._keys[a].justPressed=!1),this._keys[a].justReleased&&this.keys[a].justReleased&&(this._keys[a].justReleased=!1),this.keys[a].set(this._keys[a].justPressed,this._keys[a].pressed,this._keys[a].justReleased),!0===this._doubleClicked[a]?(this.doubleClicked[a]=!0,this._doubleClicked[a]=!1):this.doubleClicked[a]=!1;this._wheelUpdated?(this.wheel=this._wheel,this._wheelUpdated=!1):this.wheel=0;this._positionUpdated? (this.delta.copy(this._delta),this.position.copy(this._position),this._delta.set(0,0),this._positionUpdated=!1):(this.delta.x=0,this.delta.y=0)};Mouse.create=function(){this.events.create()};Mouse.dispose=function(){this.events.destroy()};'use strict'; function Gamepad(){this.product=this.vendor=-1;this.connected=!1;this.gamepad=null;this.buttons=[];for(var a=navigator.getGamepads(),b=0;bthis.buttons.length||0>a?0:this.gamepad.buttons[a].value};Gamepad.prototype.getAxis=function(a){return a>this.gamepad.axes.length||0>a?0:this.gamepad.axes[a]};Gamepad.prototype.buttonExists=function(a){return 0<=a&&a\n\t\t\tvarying vec2 vUv;\n\t\t\tuniform sampler2D colorTexture;\n\t\t\tuniform vec2 texSize;\n\t\t\tuniform vec2 direction;\n\t\t\t\n\t\t\tfloat gaussianPdf(in float x, in float sigma)\n\t\t\t{\n\t\t\t\treturn 0.39894 * exp(-0.5 * x * x / (sigma * sigma)) / sigma;\n\t\t\t}\n\t\t\t\n\t\t\tvoid main()\n\t\t\t{\n\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\tfloat fSigma = float(SIGMA);\n\t\t\t\tfloat weightSum = gaussianPdf(0.0, fSigma);\n\t\t\t\tvec3 diffuseSum = texture2D(colorTexture, vUv).rgb * weightSum;\n\t\t\t\tfor(int i = 1; i < KERNEL_RADIUS; i++)\n\t\t\t\t{\n\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\tfloat w = gaussianPdf(x, fSigma);\n\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\tvec3 sample1 = texture2D(colorTexture, vUv + uvOffset).rgb;\n\t\t\t\t\tvec3 sample2 = texture2D(colorTexture, vUv - uvOffset).rgb;\n\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t}\n\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t}'})}; UnrealBloomPass.getCompositeMaterial=function(a){return new THREE.ShaderMaterial({defines:{NUM_MIPS:a},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},dirtTexture:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:'\n\t\t\tvarying vec2 vUv;\n\t\t\tvoid main()\n\t\t\t{\n\t\t\t\tvUv = uv;\n\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n\t\t\t}', fragmentShader:'\n\t\t\tvarying vec2 vUv;\n\t\t\tuniform sampler2D blurTexture1;\n\t\t\tuniform sampler2D blurTexture2;\n\t\t\tuniform sampler2D blurTexture3;\n\t\t\tuniform sampler2D blurTexture4;\n\t\t\tuniform sampler2D blurTexture5;\n\t\t\tuniform sampler2D dirtTexture;\n\t\t\tuniform float bloomStrength;\n\t\t\tuniform float bloomRadius;\n\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\t\t\t\n\t\t\tfloat lerpBloomFactor(const in float factor)\n\t\t\t{\n\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t}\n\t\t\t\n\t\t\tvoid main()\n\t\t\t{\n\t\t\t\tgl_FragColor = bloomStrength * (lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) + \n\t\t\t\t\t\t\t\t\t\t\t\t lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) + \n\t\t\t\t\t\t\t\t\t\t\t\t lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) + \n\t\t\t\t\t\t\t\t\t\t\t\t lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) + \n\t\t\t\t\t\t\t\t\t\t\t\t lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv));\n\t\t\t}'})}; 'use strict'; -function BloomPass(a,b,d,c){Pass.call(this);void 0===THREE.ConvolutionShader&&console.error('BloomPass relies on THREE.ConvolutionShader');void 0===THREE.CopyShader&&console.error('BloomPass relies on THREE.CopyShader');this.type='Bloom';this.copyToScreen=!0;this.createQuadScene();a=void 0!==a?a:1;b=void 0!==b?b:25;d=void 0!==d?d:4;c=void 0!==c?c:256;this.renderTargetX=new THREE.WebGLRenderTarget(c,c,Pass.RGBALinear);this.renderTargetY=new THREE.WebGLRenderTarget(c,c,Pass.RGBALinear);this.copyUniforms= -THREE.UniformsUtils.clone(THREE.CopyShader.uniforms);this.copyUniforms.opacity.value=a;this.materialCopy=new THREE.ShaderMaterial({uniforms:this.copyUniforms,vertexShader:THREE.CopyShader.vertexShader,fragmentShader:THREE.CopyShader.fragmentShader,blending:THREE.AdditiveBlending,transparent:!0});this.convolutionUniforms=THREE.UniformsUtils.clone(THREE.ConvolutionShader.uniforms);this.convolutionUniforms.uImageIncrement.value=BloomPass.blurX;this.convolutionUniforms.cKernel.value=THREE.ConvolutionShader.buildKernel(d); +function BloomPass(a,b,e,d){Pass.call(this);void 0===THREE.ConvolutionShader&&console.error('BloomPass relies on THREE.ConvolutionShader');void 0===THREE.CopyShader&&console.error('BloomPass relies on THREE.CopyShader');this.type='Bloom';this.copyToScreen=!0;this.createQuadScene();a=void 0!==a?a:1;b=void 0!==b?b:25;e=void 0!==e?e:4;d=void 0!==d?d:256;this.renderTargetX=new THREE.WebGLRenderTarget(d,d,Pass.RGBALinear);this.renderTargetY=new THREE.WebGLRenderTarget(d,d,Pass.RGBALinear);this.copyUniforms= +THREE.UniformsUtils.clone(THREE.CopyShader.uniforms);this.copyUniforms.opacity.value=a;this.materialCopy=new THREE.ShaderMaterial({uniforms:this.copyUniforms,vertexShader:THREE.CopyShader.vertexShader,fragmentShader:THREE.CopyShader.fragmentShader,blending:THREE.AdditiveBlending,transparent:!0});this.convolutionUniforms=THREE.UniformsUtils.clone(THREE.ConvolutionShader.uniforms);this.convolutionUniforms.uImageIncrement.value=BloomPass.blurX;this.convolutionUniforms.cKernel.value=THREE.ConvolutionShader.buildKernel(e); this.materialConvolution=new THREE.ShaderMaterial({uniforms:this.convolutionUniforms,vertexShader:THREE.ConvolutionShader.vertexShader,fragmentShader:THREE.ConvolutionShader.fragmentShader,defines:{KERNEL_SIZE_FLOAT:b.toFixed(1),KERNEL_SIZE_INT:b.toFixed(0)}})}BloomPass.blurX=new THREE.Vector2(.001953125,0);BloomPass.blurY=new THREE.Vector2(0,.001953125);BloomPass.prototype=Object.create(Pass.prototype); -BloomPass.prototype.render=function(a,b,d,c,g,h,k){g&&a.context.disable(a.context.STENCIL_TEST);this.quad.material=this.materialConvolution;this.convolutionUniforms.tDiffuse.value=d.texture;this.convolutionUniforms.uImageIncrement.value=BloomPass.blurX;a.render(this.scene,this.camera,this.renderTargetX,!0);this.convolutionUniforms.tDiffuse.value=this.renderTargetX.texture;this.convolutionUniforms.uImageIncrement.value=BloomPass.blurY;a.render(this.scene,this.camera,this.renderTargetY,!0);this.quad.material= -this.materialCopy;this.copyUniforms.tDiffuse.value=this.renderTargetY.texture;g&&a.context.enable(a.context.STENCIL_TEST);a.setRenderTarget(b);a.render(this.scene,this.camera)};BloomPass.prototype.toJSON=function(a){a=Pass.prototype.toJSON.call(this,a);a.strength=this.strength;a.kernelSize=this.kernelSize;a.sigma=this.sigma;a.resolution=this.resolution;return a};'use strict'; +BloomPass.prototype.render=function(a,b,e,d,c,k,h){c&&a.context.disable(a.context.STENCIL_TEST);this.quad.material=this.materialConvolution;this.convolutionUniforms.tDiffuse.value=e.texture;this.convolutionUniforms.uImageIncrement.value=BloomPass.blurX;a.render(this.scene,this.camera,this.renderTargetX,!0);this.convolutionUniforms.tDiffuse.value=this.renderTargetX.texture;this.convolutionUniforms.uImageIncrement.value=BloomPass.blurY;a.render(this.scene,this.camera,this.renderTargetY,!0);this.quad.material= +this.materialCopy;this.copyUniforms.tDiffuse.value=this.renderTargetY.texture;c&&a.context.enable(a.context.STENCIL_TEST);a.setRenderTarget(b);a.render(this.scene,this.camera)};BloomPass.prototype.toJSON=function(a){a=Pass.prototype.toJSON.call(this,a);a.strength=this.strength;a.kernelSize=this.kernelSize;a.sigma=this.sigma;a.resolution=this.resolution;return a};'use strict'; function SSAONOHPass(){void 0===THREE.SSAOShader&&console.warn('SSAONOHPass depends on THREE.SSAOShader');Pass.call(this);this.type='SSAONOH';this.kernel=[];this.noiseTexture=null;this.createQuadScene();this.depthTexture=new THREE.DepthTexture;this.depthTexture.type=THREE.UnsignedShortType;this.depthTexture.minFilter=THREE.NearestFilter;this.depthTexture.maxFilter=THREE.NearestFilter;this.normalMaterial=new THREE.MeshNormalMaterial;this.normalMaterial.blending=THREE.NoBlending;this.normalRenderTarget= new THREE.WebGLRenderTarget(1,1,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat,depthTexture:this.depthTexture,depthBuffer:!0});this.ssaoRenderTarget=new THREE.WebGLRenderTarget(1,1,Pass.RGBALinear);this.blurRenderTarget=new THREE.WebGLRenderTarget(1,1,Pass.RGBALinear);this.blurMaterial=new THREE.ShaderMaterial({defines:Object.assign({},THREE.SSAOBlurShader.defines),uniforms:THREE.UniformsUtils.clone(THREE.SSAOBlurShader.uniforms),vertexShader:THREE.SSAOBlurShader.vertexShader, fragmentShader:THREE.SSAOBlurShader.fragmentShader});this.blurMaterial.uniforms.tDiffuse.value=this.ssaoRenderTarget.texture;this.ssaoMaterial=new THREE.ShaderMaterial({defines:Object.assign({},THREE.SSAOShader.defines),uniforms:THREE.UniformsUtils.clone(THREE.SSAOShader.uniforms),vertexShader:THREE.SSAOShader.vertexShader,fragmentShader:THREE.SSAOShader.fragmentShader,blending:THREE.NoBlending});this.ssaoMaterial.uniforms.tNormal.value=this.normalRenderTarget.texture;this.copyMaterial=new THREE.ShaderMaterial({uniforms:THREE.UniformsUtils.clone(THREE.CopyShader.uniforms), -vertexShader:THREE.CopyShader.vertexShader,fragmentShader:THREE.CopyShader.fragmentShader,transparent:!0,depthTest:!1,depthWrite:!1,blendSrc:THREE.DstColorFactor,blendDst:THREE.ZeroFactor,blendEquation:THREE.AddEquation,blendSrcAlpha:THREE.DstAlphaFactor,blendDstAlpha:THREE.ZeroFactor,blendEquationAlpha:THREE.AddEquation});this.originalClearColor=new THREE.Color;this._kernelSize=0;var a=this;Object.defineProperties(this,{kernelRadius:{get:function(){return a.ssaoMaterial.uniforms.kernelRadius.value}, -set:function(b){a.ssaoMaterial.uniforms.kernelRadius.value=b}},minDistance:{get:function(){return a.ssaoMaterial.uniforms.minDistance.value},set:function(b){a.ssaoMaterial.uniforms.minDistance.value=b}},maxDistance:{get:function(){return a.ssaoMaterial.uniforms.maxDistance.value},set:function(b){a.ssaoMaterial.uniforms.maxDistance.value=b}},kernelSize:{get:function(){return a._kernelSize},set:function(b){a._kernelSize=b;a.generateSampleKernel();a.generateRandomKernelRotations();a.ssaoMaterial.uniforms.tNoise.value= -a.noiseTexture;a.ssaoMaterial.uniforms.kernel.value=a.kernel}}});this.kernelSize=64;this.kernelRadius=8;this.minDistance=.1;this.maxDistance=1E3}SSAONOHPass.prototype=Object.create(Pass.prototype);SSAONOHPass.prototype.generateSampleKernel=function(){for(var a=0;ad;d++)b[d]=a.noise3d(2*Math.random()-1,2*Math.random()-1,0);this.noiseTexture=new THREE.DataTexture(b,4,4,THREE.LuminanceFormat,THREE.FloatType);this.noiseTexture.wrapS=THREE.RepeatWrapping;this.noiseTexture.wrapT=THREE.RepeatWrapping;this.noiseTexture.needsUpdate=!0}; -SSAONOHPass.prototype.render=function(a,b,d,c,g,h,k){this.originalClearColor.copy(a.getClearColor());c=a.getClearAlpha();g=a.autoClear;h.overrideMaterial=this.normalMaterial;a.autoClear=!1;a.setClearColor(7829503);a.setClearAlpha(1);a.clear();a.setRenderTarget(this.normalRenderTarget);a.render(h,k);h.overrideMaterial=null;a.autoClear=g;a.setClearColor(this.originalClearColor);a.setClearAlpha(c);this.ssaoMaterial.uniforms.tDepth.value=this.depthTexture;this.ssaoMaterial.uniforms.tDiffuse.value=d.texture; -this.ssaoMaterial.uniforms.cameraNear.value=k.near;this.ssaoMaterial.uniforms.cameraFar.value=k.far;this.ssaoMaterial.uniforms.cameraProjectionMatrix.value.copy(k.projectionMatrix);this.ssaoMaterial.uniforms.cameraInverseProjectionMatrix.value.getInverse(k.projectionMatrix);this.renderPass(a,this.ssaoMaterial,this.ssaoRenderTarget);this.renderPass(a,this.blurMaterial,this.blurRenderTarget);this.renderToScreen?(this.copyMaterial.uniforms.tDiffuse.value=d.texture,this.copyMaterial.blending=THREE.NoBlending, -this.renderPass(a,this.copyMaterial,void 0,this.clear),this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.copyMaterial.blending=THREE.CustomBlending,this.renderPass(a,this.copyMaterial,void 0,!1)):(this.copyMaterial.uniforms.tDiffuse.value=d.texture,this.copyMaterial.blending=THREE.NoBlending,this.renderPass(a,this.copyMaterial,b,this.clear),this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.copyMaterial.blending=THREE.CustomBlending,this.renderPass(a, -this.copyMaterial,b,!1))};SSAONOHPass.prototype.renderPass=function(a,b,d,c){this.quad.material=b;!0===c&&a.clear();a.setRenderTarget(d);a.render(this.scene,this.camera)};SSAONOHPass.prototype.dispose=function(){this.normalRenderTarget.dispose();this.ssaoRenderTarget.dispose();this.blurRenderTarget.dispose();this.quad.geometry.dispose();this.normalMaterial.dispose();this.blurMaterial.dispose();this.copyMaterial.dispose()}; -SSAONOHPass.prototype.setSize=function(a,b){this.ssaoMaterial.uniforms.resolution.value.set(a,b);this.blurMaterial.uniforms.resolution.value.set(a,b);this.normalRenderTarget.setSize(a,b);this.ssaoRenderTarget.setSize(a,b);this.blurRenderTarget.setSize(a,b)};SSAONOHPass.prototype.toJSON=function(a){a=Pass.prototype.toJSON.call(this,a);a.kernelRadius=this.kernelRadius;a.minDistance=this.minDistance;a.maxDistance=this.maxDistance;return a};'use strict'; +vertexShader:THREE.CopyShader.vertexShader,fragmentShader:THREE.CopyShader.fragmentShader,transparent:!0,depthTest:!1,depthWrite:!1,blendSrc:THREE.DstColorFactor,blendDst:THREE.ZeroFactor,blendEquation:THREE.AddEquation,blendSrcAlpha:THREE.DstAlphaFactor,blendDstAlpha:THREE.ZeroFactor,blendEquationAlpha:THREE.AddEquation});this._kernelSize=0;var a=this;Object.defineProperties(this,{kernelRadius:{get:function(){return a.ssaoMaterial.uniforms.kernelRadius.value},set:function(b){a.ssaoMaterial.uniforms.kernelRadius.value= +b}},minDistance:{get:function(){return a.ssaoMaterial.uniforms.minDistance.value},set:function(b){a.ssaoMaterial.uniforms.minDistance.value=b}},maxDistance:{get:function(){return a.ssaoMaterial.uniforms.maxDistance.value},set:function(b){a.ssaoMaterial.uniforms.maxDistance.value=b}},kernelSize:{get:function(){return a._kernelSize},set:function(b){a._kernelSize=b;a.generateSampleKernel();a.generateRandomKernelRotations();a.ssaoMaterial.uniforms.tNoise.value=a.noiseTexture;a.ssaoMaterial.uniforms.kernel.value= +a.kernel}}});this.kernelSize=64;this.kernelRadius=8;this.minDistance=.1;this.maxDistance=1E3}SSAONOHPass.prototype=Object.create(Pass.prototype);SSAONOHPass.prototype.generateSampleKernel=function(){for(var a=0;ae;e++)b[e]=a.noise3d(2*Math.random()-1,2*Math.random()-1,0);this.noiseTexture=new THREE.DataTexture(b,4,4,THREE.LuminanceFormat,THREE.FloatType);this.noiseTexture.wrapS=THREE.RepeatWrapping;this.noiseTexture.wrapT=THREE.RepeatWrapping;this.noiseTexture.needsUpdate=!0}; +SSAONOHPass.prototype.render=function(a,b,e,d,c,k,h){a.autoClear=!1;a.setClearColor(7829503);a.setClearAlpha(1);k.overrideMaterial=this.normalMaterial;a.setRenderTarget(this.normalRenderTarget);a.clear(!0,!0,!0);a.render(k,h);k.overrideMaterial=null;this.ssaoMaterial.uniforms.tDepth.value=this.depthTexture;this.ssaoMaterial.uniforms.tDiffuse.value=e.texture;this.ssaoMaterial.uniforms.cameraNear.value=h.near;this.ssaoMaterial.uniforms.cameraFar.value=h.far;this.ssaoMaterial.uniforms.cameraProjectionMatrix.value.copy(h.projectionMatrix); +this.ssaoMaterial.uniforms.cameraInverseProjectionMatrix.value.getInverse(h.projectionMatrix);this.renderPass(a,this.ssaoMaterial,this.ssaoRenderTarget);this.renderPass(a,this.blurMaterial,this.blurRenderTarget);this.renderToScreen?(this.copyMaterial.uniforms.tDiffuse.value=e.texture,this.copyMaterial.blending=THREE.NoBlending,this.renderPass(a,this.copyMaterial,null,this.clear),this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.copyMaterial.blending=THREE.CustomBlending, +this.renderPass(a,this.copyMaterial,null,!1)):(this.copyMaterial.uniforms.tDiffuse.value=e.texture,this.copyMaterial.blending=THREE.NoBlending,this.renderPass(a,this.copyMaterial,b,this.clear),this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.copyMaterial.blending=THREE.CustomBlending,this.renderPass(a,this.copyMaterial,b,!1))}; +SSAONOHPass.prototype.renderPass=function(a,b,e,d){this.quad.material=b;a.autoClear=!1;a.setRenderTarget(e);d&&a.clear(!0,!0,!0);a.render(this.scene,this.camera)};SSAONOHPass.prototype.dispose=function(){this.normalRenderTarget.dispose();this.ssaoRenderTarget.dispose();this.blurRenderTarget.dispose();this.quad.geometry.dispose();this.normalMaterial.dispose();this.blurMaterial.dispose();this.copyMaterial.dispose()}; +SSAONOHPass.prototype.setSize=function(a,b){this.ssaoMaterial.uniforms.resolution.value.set(a,b);this.blurMaterial.uniforms.resolution.value.set(a,b);this.normalRenderTarget.setSize(a,b);this.ssaoRenderTarget.setSize(a,b);this.blurRenderTarget.setSize(a,b)};SSAONOHPass.prototype.toJSON=function(a){a=Pass.prototype.toJSON.call(this,a);a.kernelSize=this.kernelSize;a.kernelRadius=this.kernelRadius;a.minDistance=this.minDistance;a.maxDistance=this.maxDistance;return a};'use strict'; function SSAOPass(){ShaderPass.call(this,SSAOShader);this.type='SSAO';this.depthMaterial=new THREE.MeshDepthMaterial;this.depthMaterial.depthPacking=THREE.RGBADepthPacking;this.depthMaterial.blending=THREE.NoBlending;this.depthRenderTarget=new THREE.WebGLRenderTarget(2,2,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter});this.uniforms.tDepth.value=this.depthRenderTarget.texture;this.uniforms.size.value.set(2,2);Object.defineProperties(this,{radius:{get:function(){return this.uniforms.radius.value}, set:function(a){this.uniforms.radius.value=a}},onlyAO:{get:function(){return this.uniforms.onlyAO.value},set:function(a){this.uniforms.onlyAO.value=a}},aoClamp:{get:function(){return this.uniforms.aoClamp.value},set:function(a){this.uniforms.aoClamp.value=a}},lumInfluence:{get:function(){return this.uniforms.lumInfluence.value},set:function(a){this.uniforms.lumInfluence.value=a}}});this.radius=4;this.onlyAO=!1;this.aoClamp=.25;this.lumInfluence=.7}SSAOPass.prototype=Object.create(ShaderPass.prototype); -SSAOPass.prototype.render=function(a,b,d,c,g,h,k){this.uniforms.cameraNear.value=k.near;this.uniforms.cameraFar.value=k.far;h.overrideMaterial=this.depthMaterial;a.clear();a.setRenderTarget(this.depthRenderTarget);a.render(h,k);h.overrideMaterial=null;ShaderPass.prototype.render.call(this,a,b,d,c,g)};SSAOPass.prototype.setSize=function(a,b){this.uniforms.size.value.set(a,b);this.depthRenderTarget.setSize(a,b)}; +SSAOPass.prototype.render=function(a,b,e,d,c,k,h){this.uniforms.cameraNear.value=h.near;this.uniforms.cameraFar.value=h.far;k.overrideMaterial=this.depthMaterial;a.setRenderTarget(this.depthRenderTarget);a.clear(!0,!0,!0);a.render(k,h);k.overrideMaterial=null;ShaderPass.prototype.render.call(this,a,b,e,d,c)};SSAOPass.prototype.setSize=function(a,b){this.uniforms.size.value.set(a,b);this.depthRenderTarget.setSize(a,b)}; SSAOPass.prototype.toJSON=function(a){a=Pass.prototype.toJSON.call(this,a);a.onlyAO=this.onlyAO;a.radius=this.radius;a.aoClamp=this.aoClamp;a.lumInfluence=this.lumInfluence;return a};'use strict'; -function BokehPass(a,b,d){void 0===THREE.BokehShader&&console.error('BokehPass relies on THREE.BokehShader');Pass.call(this);this.type='Bokeh';this.renderTargetColor=new THREE.WebGLRenderTarget(0,0,Pass.RGBLinear);this.renderTargetDepth=this.renderTargetColor.clone();this.materialDepth=new THREE.MeshDepthMaterial;this.materialDepth.depthPacking=THREE.RGBADepthPacking;this.materialDepth.blending=THREE.NoBlending;this.uniforms=THREE.UniformsUtils.clone(THREE.BokehShader.uniforms);this.uniforms.tDepth.value= -this.renderTargetDepth.texture;this.materialBokeh=new THREE.ShaderMaterial({defines:THREE.BokehShader.defines,uniforms:this.uniforms,vertexShader:THREE.BokehShader.vertexShader,fragmentShader:THREE.BokehShader.fragmentShader});this.createQuadScene();this.quad.material=this.materialBokeh;this.oldClearColor=new THREE.Color;this.oldClearAlpha=1;this.oldAutoClear=!1;var c=this;Object.defineProperties(this,{aperture:{get:function(){return c.uniforms.aperture.value},set:function(a){c.uniforms.aperture.value= -a}},focus:{get:function(){return c.uniforms.focus.value},set:function(a){c.uniforms.focus.value=a}},maxblur:{get:function(){return c.uniforms.maxblur.value},set:function(a){c.uniforms.maxblur.value=a}}});this.focus=void 0!==a?a:1;this.aperture=void 0!==b?b:1;this.maxblur=void 0!==d?d:.2}BokehPass.prototype=Object.create(Pass.prototype); -BokehPass.prototype.render=function(a,b,d,c,g,h,k){this.oldClearColor.copy(a.getClearColor());this.oldClearAlpha=a.getClearAlpha();this.oldAutoClear=a.autoClear;h.overrideMaterial=this.materialDepth;a.autoClear=!1;a.setClearColor(16777215);a.setClearAlpha(1);a.render(h,k,this.renderTargetDepth,!0);this.uniforms.tColor.value=d.texture;this.uniforms.nearClip.value=k.near;this.uniforms.farClip.value=k.far;this.uniforms.aspect.value=k.aspect;!0===this.clear?(a.autoClear=!0,a.autoClearColor=!0,a.autoClearDepth= -!0,a.autoClearStencil=!0):a.autoClear=!1;a.setRenderTarget(this.renderToScreen?null:b);a.render(this.scene,this.camera);h.overrideMaterial=null;a.setClearColor(this.oldClearColor);a.setClearAlpha(this.oldClearAlpha);a.autoClear=this.oldAutoClear};BokehPass.prototype.setSize=function(a,b){this.renderTargetColor.setSize(a,b);this.renderTargetDepth.setSize(a,b)}; -BokehPass.prototype.toJSON=function(a){a=Pass.prototype.toJSON.call(this,a);a.aperture=this.aperture;a.focus=this.focus;a.maxblur=this.maxblur;return a};'use strict';function CopyPass(){ShaderPass.call(this,THREE.CopyShader);this.type='Copy'}CopyPass.prototype=Object.create(ShaderPass.prototype);'use strict'; -function FilmPass(a,b,d,c){void 0===THREE.FilmShader&&console.error('FilmPass relies on THREE.FilmShader');Pass.call(this);this.type='Film';this.createQuadScene();this.uniforms=THREE.UniformsUtils.clone(THREE.FilmShader.uniforms);this.material=new THREE.ShaderMaterial({uniforms:this.uniforms,vertexShader:THREE.FilmShader.vertexShader,fragmentShader:THREE.FilmShader.fragmentShader});var g=this;Object.defineProperties(this,{grayscale:{get:function(){return g.uniforms.grayscale.value},set:function(a){g.uniforms.grayscale.value= -a}},noiseIntensity:{get:function(){return g.uniforms.nIntensity.value},set:function(a){g.uniforms.nIntensity.value=a}},scanlinesIntensity:{get:function(){return g.uniforms.sIntensity.value},set:function(a){g.uniforms.sIntensity.value=a}},scanlinesCount:{get:function(){return g.uniforms.sCount.value},set:function(a){g.uniforms.sCount.value=a}}});this.grayscale=void 0!==c?c:!1;this.noiseIntensity=void 0!==a?a:.35;this.scanlinesIntensity=void 0!==b?b:.5;this.scanlinesCount=void 0!==d?d:512} -FilmPass.prototype=Object.create(Pass.prototype);FilmPass.prototype.render=function(a,b,d,c,g,h,k){this.uniforms.time.value+=c;this.uniforms.tDiffuse.value=d.texture;this.quad.material=this.material;!0===this.clear?(a.autoClear=!0,a.autoClearColor=!0,a.autoClearDepth=!0,a.autoClearStencil=!0):a.autoClear=!1;a.setRenderTarget(this.renderToScreen?null:b);a.render(this.scene,this.camera)}; +function BokehPass(a,b,e){void 0===THREE.BokehShader&&console.error('BokehPass relies on THREE.BokehShader');Pass.call(this);this.type='Bokeh';this.renderTargetColor=new THREE.WebGLRenderTarget(0,0,Pass.RGBLinear);this.renderTargetDepth=this.renderTargetColor.clone();this.materialDepth=new THREE.MeshDepthMaterial;this.materialDepth.depthPacking=THREE.RGBADepthPacking;this.materialDepth.blending=THREE.NoBlending;this.uniforms=THREE.UniformsUtils.clone(THREE.BokehShader.uniforms);this.uniforms.tDepth.value= +this.renderTargetDepth.texture;this.materialBokeh=new THREE.ShaderMaterial({defines:THREE.BokehShader.defines,uniforms:this.uniforms,vertexShader:THREE.BokehShader.vertexShader,fragmentShader:THREE.BokehShader.fragmentShader});this.createQuadScene();this.quad.material=this.materialBokeh;var d=this;Object.defineProperties(this,{aperture:{get:function(){return d.uniforms.aperture.value},set:function(a){d.uniforms.aperture.value=a}},focus:{get:function(){return d.uniforms.focus.value},set:function(a){d.uniforms.focus.value= +a}},maxblur:{get:function(){return d.uniforms.maxblur.value},set:function(a){d.uniforms.maxblur.value=a}}});this.focus=void 0!==a?a:1;this.aperture=void 0!==b?b:1;this.maxblur=void 0!==e?e:.2}BokehPass.prototype=Object.create(Pass.prototype); +BokehPass.prototype.render=function(a,b,e,d,c,k,h){k.overrideMaterial=this.materialDepth;a.autoClear=!1;a.setClearColor(16777215);a.setClearAlpha(1);a.render(k,h,this.renderTargetDepth,!0);this.uniforms.tColor.value=e.texture;this.uniforms.nearClip.value=h.near;this.uniforms.farClip.value=h.far;this.uniforms.aspect.value=h.aspect;this.clear?(a.autoClear=!0,a.autoClearColor=!0,a.autoClearDepth=!0,a.autoClearStencil=!0):a.autoClear=!1;a.setRenderTarget(this.renderToScreen?null:b);a.render(this.scene, +this.camera);k.overrideMaterial=null};BokehPass.prototype.setSize=function(a,b){this.renderTargetColor.setSize(a,b);this.renderTargetDepth.setSize(a,b)};BokehPass.prototype.toJSON=function(a){a=Pass.prototype.toJSON.call(this,a);a.aperture=this.aperture;a.focus=this.focus;a.maxblur=this.maxblur;return a};'use strict';function CopyPass(){ShaderPass.call(this,THREE.CopyShader);this.type='Copy'}CopyPass.prototype=Object.create(ShaderPass.prototype);'use strict'; +function FilmPass(a,b,e,d){void 0===THREE.FilmShader&&console.error('FilmPass relies on THREE.FilmShader');Pass.call(this);this.type='Film';this.createQuadScene();this.uniforms=THREE.UniformsUtils.clone(THREE.FilmShader.uniforms);this.material=new THREE.ShaderMaterial({uniforms:this.uniforms,vertexShader:THREE.FilmShader.vertexShader,fragmentShader:THREE.FilmShader.fragmentShader});var c=this;Object.defineProperties(this,{grayscale:{get:function(){return c.uniforms.grayscale.value},set:function(a){c.uniforms.grayscale.value= +a}},noiseIntensity:{get:function(){return c.uniforms.nIntensity.value},set:function(a){c.uniforms.nIntensity.value=a}},scanlinesIntensity:{get:function(){return c.uniforms.sIntensity.value},set:function(a){c.uniforms.sIntensity.value=a}},scanlinesCount:{get:function(){return c.uniforms.sCount.value},set:function(a){c.uniforms.sCount.value=a}}});this.grayscale=void 0!==d?d:!1;this.noiseIntensity=void 0!==a?a:.35;this.scanlinesIntensity=void 0!==b?b:.5;this.scanlinesCount=void 0!==e?e:512} +FilmPass.prototype=Object.create(Pass.prototype);FilmPass.prototype.render=function(a,b,e,d,c,k,h){this.uniforms.time.value+=d;this.uniforms.tDiffuse.value=e.texture;this.quad.material=this.material;this.clear?(a.autoClear=!0,a.autoClearColor=!0,a.autoClearDepth=!0,a.autoClearStencil=!0):a.autoClear=!1;a.setRenderTarget(this.renderToScreen?null:b);a.render(this.scene,this.camera)}; FilmPass.prototype.toJSON=function(a){a=Pass.prototype.toJSON.call(this,a);a.grayscale=this.grayscale;a.noiseIntensity=this.noiseIntensity;a.scanlinesIntensity=this.scanlinesIntensity;a.scanlinesCount=this.scanlinesCount;return a};'use strict'; -function DotScreenPass(a,b,d){void 0===THREE.DotScreenShader&&console.error('DotScreenPass relies on THREE.DotScreenShader');Pass.call(this);this.type='DotScreen';this.createQuadScene();this.uniforms=THREE.UniformsUtils.clone(THREE.DotScreenShader.uniforms);this.material=new THREE.ShaderMaterial({uniforms:this.uniforms,vertexShader:THREE.DotScreenShader.vertexShader,fragmentShader:THREE.DotScreenShader.fragmentShader});Object.defineProperties(this,{center:{get:function(){return this.uniforms.center.value}, -set:function(a){this.uniforms.center.value=a}},angle:{get:function(){return this.uniforms.angle.value},set:function(a){this.uniforms.angle.value=a}},scale:{get:function(){return this.uniforms.scale.value},set:function(a){this.uniforms.scale.value=a}}});void 0!==a&&this.center.copy(a);this.angle=void 0!==b?b:.5;this.scale=void 0!==d?d:.8}DotScreenPass.prototype=Object.create(Pass.prototype); -DotScreenPass.prototype.render=function(a,b,d,c,g,h,k){this.uniforms.tDiffuse.value=d.texture;this.uniforms.tSize.value.set(d.width,d.height);this.quad.material=this.material;!0===this.clear?(a.autoClear=!0,a.autoClearColor=!0,a.autoClearDepth=!0,a.autoClearStencil=!0):a.autoClear=!1;a.setRenderTarget(this.renderToScreen?null:b);a.render(this.scene,this.camera)}; -DotScreenPass.prototype.toJSON=function(a){a=Pass.prototype.toJSON.call(this,a);a.center=this.center.toArray();a.angle=this.angle;a.scale=this.scale;return a};'use strict';function SobelPass(a,b,d){void 0===THREE.SobelOperatorShader&&console.error('SobelPass relies on THREE.SobelOperatorShader');void 0===THREE.LuminosityShader&&console.error('SobelPass relies on THREE.LuminosityShader');ShaderPass.call(this,THREE.SobelOperatorShader);this.type='Sobel'}SobelPass.prototype=Object.create(ShaderPass.prototype); +function DotScreenPass(a,b,e){void 0===THREE.DotScreenShader&&console.error('DotScreenPass relies on THREE.DotScreenShader');Pass.call(this);this.type='DotScreen';this.createQuadScene();this.uniforms=THREE.UniformsUtils.clone(THREE.DotScreenShader.uniforms);this.material=new THREE.ShaderMaterial({uniforms:this.uniforms,vertexShader:THREE.DotScreenShader.vertexShader,fragmentShader:THREE.DotScreenShader.fragmentShader});Object.defineProperties(this,{center:{get:function(){return this.uniforms.center.value}, +set:function(a){this.uniforms.center.value=a}},angle:{get:function(){return this.uniforms.angle.value},set:function(a){this.uniforms.angle.value=a}},scale:{get:function(){return this.uniforms.scale.value},set:function(a){this.uniforms.scale.value=a}}});void 0!==a&&this.center.copy(a);this.angle=void 0!==b?b:.5;this.scale=void 0!==e?e:.8}DotScreenPass.prototype=Object.create(Pass.prototype); +DotScreenPass.prototype.render=function(a,b,e,d,c,k,h){this.uniforms.tDiffuse.value=e.texture;this.uniforms.tSize.value.set(e.width,e.height);this.quad.material=this.material;this.clear?(a.autoClear=!0,a.autoClearColor=!0,a.autoClearDepth=!0,a.autoClearStencil=!0):a.autoClear=!1;a.setRenderTarget(this.renderToScreen?null:b);a.render(this.scene,this.camera)}; +DotScreenPass.prototype.toJSON=function(a){a=Pass.prototype.toJSON.call(this,a);a.center=this.center.toArray();a.angle=this.angle;a.scale=this.scale;return a};'use strict';function SobelPass(a,b,e){void 0===THREE.SobelOperatorShader&&console.error('SobelPass relies on THREE.SobelOperatorShader');void 0===THREE.LuminosityShader&&console.error('SobelPass relies on THREE.LuminosityShader');ShaderPass.call(this,THREE.SobelOperatorShader);this.type='Sobel'}SobelPass.prototype=Object.create(ShaderPass.prototype); SobelPass.prototype.setSize=function(a,b){this.uniforms.resolution.value.set(a,b)};'use strict';function ColorifyPass(){ShaderPass.call(this,THREE.ColorifyShader);this.type='Colorify';Object.defineProperties(this,{color:{get:function(){return this.uniforms.color.value},set:function(a){this.uniforms.color.value=a}}})}ColorifyPass.prototype=Object.create(ShaderPass.prototype);ColorifyPass.prototype.toJSON=function(a){a=Pass.prototype.toJSON.call(this,a);a.color=this.color.getHex();return a};'use strict'; function TechnicolorPass(){ShaderPass.call(this,THREE.TechnicolorShader);this.type='Technicolor'}TechnicolorPass.prototype=Object.create(ShaderPass.prototype);'use strict'; function HueSaturationPass(a,b){ShaderPass.call(this,THREE.HueSaturationShader);this.type='HueSaturation';Object.defineProperties(this,{hue:{get:function(){return this.uniforms.hue.value},set:function(a){this.uniforms.hue.value=a}},saturation:{get:function(){return this.uniforms.saturation.value},set:function(a){this.uniforms.saturation.value=a}}});this.hue=void 0!==a?a:0;this.saturation=void 0!==b?b:0}HueSaturationPass.prototype=Object.create(ShaderPass.prototype); -HueSaturationPass.prototype.toJSON=function(a){a=Pass.prototype.toJSON.call(this,a);a.hue=this.hue;a.saturation=this.saturation;return a};'use strict'; +HueSaturationPass.prototype.toJSON=function(a){a=Pass.prototype.toJSON.call(this,a);a.hue=this.hue;a.saturation=this.saturation;return a}; +function AdaptiveToneMappingPass(a,b){Pass.call(this);var e=this;this.type='AdaptiveToneMapping';this.needsInit=!0;this.resolution=void 0!==b?b:256;this._adaptive=void 0!==a?a:!0;this.currentLuminanceRT=this.previousLuminanceRT=this.luminanceRT=null;this.copyUniforms=THREE.UniformsUtils.clone(THREE.CopyShader.uniforms);this.materialCopy=new THREE.ShaderMaterial({uniforms:this.copyUniforms,vertexShader:THREE.CopyShader.vertexShader,fragmentShader:THREE.CopyShader.fragmentShader,blending:THREE.NoBlending, +depthTest:!1});this.materialLuminance=new THREE.ShaderMaterial({uniforms:THREE.UniformsUtils.clone(THREE.LuminosityShader.uniforms),vertexShader:THREE.LuminosityShader.vertexShader,fragmentShader:THREE.LuminosityShader.fragmentShader,blending:THREE.NoBlending});this.createShader();void 0===THREE.ToneMapShader&&console.error('nunuStudio: AdaptiveToneMappingPass relies on THREE.ToneMapShader');this.materialToneMap=new THREE.ShaderMaterial({uniforms:THREE.UniformsUtils.clone(THREE.ToneMapShader.uniforms), +vertexShader:THREE.ToneMapShader.vertexShader,fragmentShader:THREE.ToneMapShader.fragmentShader,blending:THREE.NoBlending});this.createQuadScene();Object.defineProperties(this,{minLuminance:{get:function(){return e.adaptLuminanceShader.uniforms.minLuminance.value},set:function(a){e.adaptLuminanceShader.uniforms.minLuminance.value=a}},tau:{get:function(){return e.adaptLuminanceShader.uniforms.tau.value},set:function(a){e.adaptLuminanceShader.uniforms.tau.value=a}},adaptive:{get:function(){return e._adaptive}, +set:function(a){a?(this._adaptive=!0,this.materialToneMap.defines.ADAPTED_LUMINANCE='',this.materialToneMap.uniforms.luminanceMap.value=this.luminanceRT.texture):(this._adaptive=!1,delete this.materialToneMap.defines.ADAPTED_LUMINANCE,this.materialToneMap.uniforms.luminanceMap.value=null);this.materialToneMap.needsUpdate=!0}}})}AdaptiveToneMappingPass.prototype=Object.create(Pass.prototype);AdaptiveToneMappingPass.prototype.constructor=AdaptiveToneMappingPass; +AdaptiveToneMappingPass.prototype.render=function(a,b,e,d,c){this.needsInit&&(this.reset(),this.luminanceRT.texture.type=e.texture.type,this.previousLuminanceRT.texture.type=e.texture.type,this.currentLuminanceRT.texture.type=e.texture.type,this.needsInit=!1);this._adaptive&&(this.quad.material=this.materialLuminance,this.materialLuminance.uniforms.tDiffuse.value=e.texture,a.setRenderTarget(this.currentLuminanceRT),a.render(this.scene,this.camera),this.quad.material=this.materialAdaptiveLum,this.materialAdaptiveLum.uniforms.delta.value= +d,this.materialAdaptiveLum.uniforms.lastLum.value=this.previousLuminanceRT.texture,this.materialAdaptiveLum.uniforms.currentLum.value=this.currentLuminanceRT.texture,a.setRenderTarget(this.luminanceRT),a.render(this.scene,this.camera),this.quad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.luminanceRT.texture,a.setRenderTarget(this.previousLuminanceRT),a.render(this.scene,this.camera));this.quad.material=this.materialToneMap;this.materialToneMap.uniforms.tDiffuse.value=e.texture; +this.clear?(a.autoClear=!0,a.autoClearColor=!0,a.autoClearDepth=!0,a.autoClearStencil=!0):a.autoClear=!1;a.setRenderTarget(this.renderToScreen?null:b);a.render(this.scene,this.camera)}; +AdaptiveToneMappingPass.prototype.createShader=function(){this.adaptLuminanceShader={defines:{MIP_LEVEL_1X1:(Math.log(this.resolution)/Math.log(2)).toFixed(1)},uniforms:{lastLum:{value:null},currentLum:{value:null},minLuminance:{value:.01},delta:{value:.016},tau:{value:1}},vertexShader:'varying vec2 vUv;\n\t\tvoid main(){\n\t\t\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n\t\t\n\t\t}',fragmentShader:"varying vec2 vUv;\n\t\t\n\t\tuniform sampler2D lastLum;\n\t\tuniform sampler2D currentLum;\n\t\tuniform float minLuminance;\n\t\tuniform float delta;\n\t\tuniform float tau;\n\t\t\n\t\tvoid main()\n\t\t{\n\t\t\tvec4 lastLum = texture2D(lastLum, vUv, MIP_LEVEL_1X1);\n\t\t\tvec4 currentLum = texture2D(currentLum, vUv, MIP_LEVEL_1X1);\n\t\t\t\n\t\t\tfloat fLastLum = max(minLuminance, lastLum.r);\n\t\t\tfloat fCurrentLum = max(minLuminance, currentLum.r);\n\t\t\t\n\t\t\t// The adaption seems to work better in extreme lighting differences if the input luminance is squared.\t\t\tfCurrentLum *= fCurrentLum;\n\t\t\t\n\t\t\t// Adapt the luminance using Pattanaik's technique\t\t\tfloat fAdaptedLum = fLastLum + (fCurrentLum - fLastLum) * (1.0 - exp(-delta * tau));\n\t\t\tgl_FragColor.r = fAdaptedLum;\n\t\t}"}; +this.materialAdaptiveLum=new THREE.ShaderMaterial({uniforms:THREE.UniformsUtils.clone(this.adaptLuminanceShader.uniforms),vertexShader:this.adaptLuminanceShader.vertexShader,fragmentShader:this.adaptLuminanceShader.fragmentShader,defines:this.adaptLuminanceShader.defines,blending:THREE.NoBlending})}; +AdaptiveToneMappingPass.prototype.reset=function(){this.luminanceRT&&this.luminanceRT.dispose();this.currentLuminanceRT&&this.currentLuminanceRT.dispose();this.previousLuminanceRT&&this.previousLuminanceRT.dispose();this.luminanceRT=new THREE.WebGLRenderTarget(this.resolution,this.resolution,Pass.RGBALinear);this.luminanceRT.texture.generateMipmaps=!1;this.previousLuminanceRT=new THREE.WebGLRenderTarget(this.resolution,this.resolution,Pass.RGBALinear);this.previousLuminanceRT.texture.generateMipmaps= +!1;this.currentLuminanceRT=new THREE.WebGLRenderTarget(this.resolution,this.resolution,{minFilter:THREE.LinearMipMapLinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});this._adaptive&&(this.materialToneMap.defines.ADAPTED_LUMINANCE='',this.materialToneMap.uniforms.luminanceMap.value=this.luminanceRT.texture);this.quad.material=new THREE.MeshBasicMaterial({color:7829367});this.materialLuminance.needsUpdate=!0;this.materialAdaptiveLum.needsUpdate=!0;this.materialToneMap.needsUpdate= +!0};AdaptiveToneMappingPass.prototype.dispose=function(){this.luminanceRT&&this.luminanceRT.dispose();this.previousLuminanceRT&&this.previousLuminanceRT.dispose();this.currentLuminanceRT&&this.currentLuminanceRT.dispose();this.materialLuminance&&this.materialLuminance.dispose();this.materialAdaptiveLum&&this.materialAdaptiveLum.dispose();this.materialCopy&&this.materialCopy.dispose();this.materialToneMap&&this.materialToneMap.dispose()}; +AdaptiveToneMappingPass.prototype.toJSON=function(a){a=Pass.prototype.toJSON.call(this,a);a.minLuminance=this.minLuminance;a.tau=this.tau;a.adaptive=this._adaptive;return a};'use strict'; var SSAOShader={uniforms:{tDiffuse:{value:null},tDepth:{value:null},size:{value:new THREE.Vector2(512,512)},cameraNear:{value:1},cameraFar:{value:100},radius:{value:32},onlyAO:{value:0},aoClamp:{value:.25},lumInfluence:{value:.7}},vertexShader:'\n\tvarying vec2 vUv;\n\tvoid main()\n\t{\n\t\tvUv = uv;\n\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n\t}',fragmentShader:'\n\tuniform float cameraNear;\n\tuniform float cameraFar;\n\n\t#ifdef USE_LOGDEPTHBUF\n\t\tuniform float logDepthBufFC;\n\t#endif\n\n\tuniform float radius; //ao radius \n\tuniform bool onlyAO; //use only ambient occlusion pass?\n\n\tuniform vec2 size; //texture width, height\n\tuniform float aoClamp; //depth clamp - reduces haloing at screen edges\n\n\tuniform float lumInfluence; //how much luminance affects occlusion\n\n\tuniform sampler2D tDiffuse;\n\tuniform sampler2D tDepth;\n\n\tvarying vec2 vUv;\n\n\t#define DL 2.399963229728653 //PI *(3.0 - sqrt(5.0))\n\t#define EULER 2.718281828459045\n\n\t//user variables\n\tconst int samples = 64; //ao sample count\n\tconst bool useNoise = true; //use noise instead of pattern for sample dithering\n\tconst float noiseAmount = 0.0004; //dithering amount\n\tconst float diffArea = 0.4; //self-shadowing reduction\n\tconst float gDisplace = 0.4; //gauss bell center\n\n\t//RGBA depth\n\t#include \n\n\t//generating noise / pattern texture for dithering\n\tvec2 rand(const vec2 coord)\n\t{\n\t\tvec2 noise;\n\n\t\tif(useNoise)\n\t\t{\n\t\t\tfloat nx = dot(coord, vec2(12.9898, 78.233));\n\t\t\tfloat ny = dot(coord, vec2(12.9898, 78.233) * 2.0);\n\t\t\tnoise = clamp(fract(43758.5453 * sin(vec2(nx, ny))), 0.0, 1.0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfloat ff = fract(1.0 - coord.s *(size.x / 2.0));\n\t\t\tfloat gg = fract(coord.t *(size.y / 2.0));\n\t\t\tnoise = vec2(0.25, 0.75) * vec2(ff) + vec2(0.75, 0.25) * gg;\n\t\t}\n\n\t\treturn(noise * 2.0 - 1.0) * noiseAmount;\n\t}\n\n\tfloat readDepth(const in vec2 coord) {\n\n\t\tfloat cameraFarPlusNear = cameraFar + cameraNear;\n\t\tfloat cameraFarMinusNear = cameraFar - cameraNear;\n\t\tfloat cameraCoef = 2.0 * cameraNear;\n\n\t\t#ifdef USE_LOGDEPTHBUF\n\t\t\tfloat logz = unpackRGBAToDepth(texture2D(tDepth, coord));\n\t\t\tfloat w = pow(2.0, (logz / logDepthBufFC)) - 1.0;\n\t\t\tfloat z = (logz / w) + 1.0;\n\t\t#else\n\t\t\tfloat z = unpackRGBAToDepth(texture2D(tDepth, coord));\n\t\t#endif\n\n\t\treturn cameraCoef /(cameraFarPlusNear - z * cameraFarMinusNear);\n\t}\n\n\tfloat compareDepths(const in float depth1, const in float depth2, inout int far)\n\t{\n\t\tfloat garea = 8.0; //gauss bell width\n\t\tfloat diff =(depth1 - depth2) * 100.0; //depth difference (0-100)\n\n\t\t//reduce left bell width to avoid self-shadowing\n\t\tif(diff < gDisplace)\n\t\t{\n\t\t\tgarea = diffArea;\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfar = 1;\n\t\t}\n\n\t\tfloat dd = diff - gDisplace;\n\t\tfloat gauss = pow(EULER, -2.0 *(dd * dd) /(garea * garea));\n\t\treturn gauss;\n\t}\n\n\tfloat calcAO(float depth, float dw, float dh)\n\t{\n\t\tvec2 vv = vec2(dw, dh);\n\t\tvec2 coord1 = vUv + radius * vv;\n\t\tvec2 coord2 = vUv - radius * vv;\n\n\t\tfloat temp1 = 0.0;\n\t\tfloat temp2 = 0.0;\n\n\t\tint far = 0;\n\t\ttemp1 = compareDepths(depth, readDepth(coord1), far);\n\n\t\t//DEPTH EXTRAPOLATION\n\t\tif(far > 0)\n\t\t{\n\t\t\ttemp2 = compareDepths(readDepth(coord2), depth, far);\n\t\t\ttemp1 +=(1.0 - temp1) * temp2;\n\t\t}\n\n\t\treturn temp1;\n\t}\n\n\tvoid main()\n\t{\n\t\tvec2 noise = rand(vUv);\n\t\tfloat depth = readDepth(vUv);\n\n\t\tfloat tt = clamp(depth, aoClamp, 1.0);\n\n\t\tfloat w =(1.0 / size.x) / tt +(noise.x *(1.0 - noise.x));\n\t\tfloat h =(1.0 / size.y) / tt +(noise.y *(1.0 - noise.y));\n\n\t\tfloat ao = 0.0;\n\n\t\tfloat dz = 1.0 / float(samples);\n\t\tfloat l = 0.0;\n\t\tfloat z = 1.0 - dz / 2.0;\n\n\t\tfor(int i = 0; i <= samples; i ++)\n\t\t{\n\t\t\tfloat r = sqrt(1.0 - z);\n\n\t\t\tfloat pw = cos(l) * r;\n\t\t\tfloat ph = sin(l) * r;\n\t\t\tao += calcAO(depth, pw * w, ph * h);\n\t\t\tz = z - dz;\n\t\t\tl = l + DL;\n\t\t}\n\n\t\tao /= float(samples);\n\t\tao = 1.0 - ao;\n\n\t\tvec3 color = texture2D(tDiffuse, vUv).rgb;\n\n\t\tvec3 lumcoeff = vec3(0.299, 0.587, 0.114);\n\t\tfloat lum = dot(color.rgb, lumcoeff);\n\t\tvec3 luminance = vec3(lum);\n\n\t\tvec3 final = vec3(color * mix(vec3(ao), vec3(1.0), luminance * lumInfluence)); //mix(color * ao, white, luminance)\n\n\t\tif(onlyAO)\n\t\t{\n\t\t\tfinal = vec3(mix(vec3(ao), vec3(1.0), luminance * lumInfluence)); //ambient occlusion only\n\t\t}\n\n\t\tgl_FragColor = vec4(final, 1.0);\n\t}'}; 'use strict';function VRControls(){this.display=null;this.scale=1;this.standing=!1;this.userHeight=1.6;this.frameData=null;void 0!==VRFrameData&&(this.frameData=new VRFrameData);this.position=new THREE.Vector3;this.quaternion=new THREE.Quaternion;if(void 0!==navigator.getVRDisplays){var a=this;navigator.getVRDisplays().then(function(b){0=l.image.HAVE_CURRENT_DATA&&(l.needsUpdate=!0),requestAnimationFrame(k))}THREE.Texture.call(this,document.createElement('video'),b,d,c,THREE.LinearFilter,THREE.LinearFilter,THREE.RGBFormat,g,h);this.generateMipmaps=this.disposed=!1;this.name='video';this.category='Video';this.loop=this.autoplay=!0;this.volume=this.playbackRate=1;this.image.crossOrigin='anonymous';this.image.autoplay=this.autoplay;this.image.playbackRate= -this.playbackRate;this.image.loop=this.loop;this.image.volume=this.volume;this.video=null;this.setVideo(a);var l=this;k()}VideoTexture.prototype=Object.create(THREE.Texture.prototype);VideoTexture.prototype.setVideo=function(a){null===a||void 0===a?(this.video=null,this.image.src=null):('string'===typeof a?this.video=new Video(a):a instanceof Video&&(this.video=a),this.image.src=this.video.data)};VideoTexture.prototype.setTime=function(a){this.image.currentTime=a}; +function VideoTexture(a,b,e,d,c,k){function h(){l.disposed||(l.image.readyState>=l.image.HAVE_CURRENT_DATA&&(l.needsUpdate=!0),requestAnimationFrame(h))}THREE.Texture.call(this,document.createElement('video'),b,e,d,THREE.LinearFilter,THREE.LinearFilter,THREE.RGBFormat,c,k);this.generateMipmaps=this.disposed=!1;this.name='video';this.category='Video';this.loop=this.autoplay=!0;this.volume=this.playbackRate=1;this.image.crossOrigin='anonymous';this.image.autoplay=this.autoplay;this.image.playbackRate= +this.playbackRate;this.image.loop=this.loop;this.image.volume=this.volume;this.video=null;this.setVideo(a);var l=this;h()}VideoTexture.prototype=Object.create(THREE.Texture.prototype);VideoTexture.prototype.setVideo=function(a){null===a||void 0===a?(this.video=null,this.image.src=null):('string'===typeof a?this.video=new Video(a):a instanceof Video&&(this.video=a),this.image.src=this.video.data)};VideoTexture.prototype.setTime=function(a){this.image.currentTime=a}; VideoTexture.prototype.setLoop=function(a){this.loop=a;this.image.loop=a};VideoTexture.prototype.setVolume=function(a){this.volume=0<=a&&1>=a?a:0<=a?1:0;this.image.volume=this.volume};VideoTexture.prototype.setAutoPlay=function(a){this.autoplay=a;this.image.autoplay=this.autoplay};VideoTexture.prototype.setPlaybackRate=function(a){this.playbackRate=a;this.image.playbackRate=a};VideoTexture.prototype.pause=function(){this.image.paused||this.image.pause()}; VideoTexture.prototype.play=function(){this.image.paused&&this.image.play()};VideoTexture.prototype.dispose=function(){THREE.Texture.prototype.dispose.call(this);this.disposed=!0;this.image.pause();this.image.src='';this.image.load()};VideoTexture.prototype.toJSON=function(a){var b=THREE.Texture.prototype.toJSON.call(this,a);a=this.video.toJSON(a);b.video=a.uuid;b.loop=this.loop;b.autoplay=this.autoplay;b.playbackRate=this.playbackRate;b.volume=this.volume;return b};'use strict'; -function WebcamTexture(a,b,d,c,g){function h(){k.readyState>=k.HAVE_CURRENT_DATA&&(l.needsUpdate=!0);l.disposed||requestAnimationFrame(h)}var k=document.createElement('video');k.autoplay=!0;k.loop=!0;THREE.Texture.call(this,k,a,b,d,THREE.LinearFilter,THREE.LinearFilter,THREE.RGBFormat,c,g);var l=this;this.disposed=this.generateMipmaps=!1;this.name='webcam';this.category='Webcam';this.mode=WebcamTexture.USER;this.stream=null;this.connect();requestAnimationFrame(h)}WebcamTexture.USER=21; +function WebcamTexture(a,b,e,d,c){function k(){h.readyState>=h.HAVE_CURRENT_DATA&&(l.needsUpdate=!0);l.disposed||requestAnimationFrame(k)}var h=document.createElement('video');h.autoplay=!0;h.loop=!0;THREE.Texture.call(this,h,a,b,e,THREE.LinearFilter,THREE.LinearFilter,THREE.RGBFormat,d,c);var l=this;this.disposed=this.generateMipmaps=!1;this.name='webcam';this.category='Webcam';this.mode=WebcamTexture.USER;this.stream=null;this.connect();requestAnimationFrame(k)}WebcamTexture.USER=21; WebcamTexture.ENVIRONMENT=22;WebcamTexture.prototype=Object.create(THREE.Texture.prototype); WebcamTexture.prototype.connect=function(){var a=this.mode===WebcamTexture.USER?{facingMode:'user'}:{facingMode:{exact:'environment'}},b=this;void 0!==navigator.webkitGetUserMedia&&(navigator.getUserMedia=navigator.webkitGetUserMedia);navigator.getUserMedia?navigator.getUserMedia({video:!0},function(a){b.stream=a;b.image.src=URL.createObjectURL(a)},function(a){console.warn('nunuStudio: No webcam available')}):navigator.mediaDevices.getUserMedia&&navigator.mediaDevices.getUserMedia({video:a}).then(function(a){b.stream= a;b.image.src=URL.createObjectURL(a)}).catch(function(a){console.warn('nunuStudio: No webcam available')})};WebcamTexture.prototype.disconnect=function(){if(null!==this.stream)for(var a=this.stream.getTracks(),b=0;be;e++)p.push(document.createElement('canvas'));THREE.Texture.call(this,p,b,d,c,g,h,k,l,m,q);this.images=void 0!==a?a:[];this.size=512;this.flipY=!1;this.mode=6===this.images.length?CubeTexture.CUBE:CubeTexture.CROSS;0g;g++)m.push(document.createElement('canvas'));THREE.Texture.call(this,m,b,e,d,c,k,h,l,n,q);this.images=void 0!==a?a:[];this.size=512;this.flipY=!1;this.mode=6===this.images.length?CubeTexture.CUBE:CubeTexture.CROSS;0g;g++){var h=CubeTexture.renderEquirectFace(b,g,Math.PI,a.size);a.image[g].getContext('2d').putImageData(h,0,0)}a.needsUpdate=!0}}}; -CubeTexture.resampleBilinear=function(a,b,d,c,g){var h=a.width,k=a.height;a=a.data;var l=THREE.Math.clamp(Math.floor(d),0,h-1),m=THREE.Math.clamp(Math.ceil(d),0,h-1);d-=l;var q=THREE.Math.clamp(Math.floor(c),0,k-1),p=THREE.Math.clamp(Math.ceil(c),0,k-1);c-=q;k=4*(q*h+l);q=4*(q*h+m);l=4*(p*h+l);h=4*(p*h+m);for(m=0;3>m;m++)b.data[g+m]=Math.ceil((a[k+m]*(1-d)+a[q+m]*d)*(1-c)+(a[l+m]*(1-d)+a[h+m]*d)*c)}; -CubeTexture.renderEquirectFace=function(a,b,d,c){var g=new ImageData(c,c);b=CubeTexture.faces[b];for(var h=0;hc;c++){var k=CubeTexture.renderEquirectFace(b,c,Math.PI,a.size);a.image[c].getContext('2d').putImageData(k,0,0)}a.needsUpdate=!0}}}; +CubeTexture.resampleBilinear=function(a,b,e,d,c){var k=a.width,h=a.height;a=a.data;var l=THREE.Math.clamp(Math.floor(e),0,k-1),n=THREE.Math.clamp(Math.ceil(e),0,k-1);e-=l;var q=THREE.Math.clamp(Math.floor(d),0,h-1),m=THREE.Math.clamp(Math.ceil(d),0,h-1);d-=q;h=4*(q*k+l);q=4*(q*k+n);l=4*(m*k+l);k=4*(m*k+n);for(n=0;3>n;n++)b.data[c+n]=Math.ceil((a[h+n]*(1-e)+a[q+n]*e)*(1-d)+(a[l+n]*(1-e)+a[k+n]*e)*d)}; +CubeTexture.renderEquirectFace=function(a,b,e,d){var c=new ImageData(d,d);b=CubeTexture.faces[b];for(var k=0;k=m._endFrame&&(m.currentFrame=m._beginFrame);m.offset.x=m.currentFrame%m.framesHorizontal/m.framesHorizontal;m.offset.y=1-m.repeat.y-Math.floor(m.currentFrame/m.framesHorizontal)/m.framesVertical;m.disposed||setTimeout(l,1E3*m.animationSpeed)}'string'===typeof a?this.img=new Image(a):a instanceof Image&&(this.img=a);THREE.Texture.call(this,document.createElement('img'),g,THREE.RepeatWrapping,THREE.RepeatWrapping, -THREE.LinearFilter,THREE.LinearFilter,THREE.RGBFormat,h,k);this.name='animation';this.category='SpriteSheet';this.disposed=!1;this.format=this.img.hasTransparency()?THREE.RGBAFormat:THREE.RGBFormat;this.repeat.set(1/b,1/d);this.loop=!0;this.animationSpeed=.1;this._totalFrames=c;this._endFrame=this._beginFrame=0;this._framesHorizontal=b;this._framesVertical=d;var m=this;Object.defineProperties(this,{framesHorizontal:{get:function(){return m._framesHorizontal},set:function(a){m._framesHorizontal=a; -m.repeat.x=1/a;m.totalFrames=m._framesHorizontal*m._framesVertical}},framesVertical:{get:function(){return m._framesVertical},set:function(a){m._framesVertical=a;m.repeat.y=1/a;m.totalFrames=m._framesHorizontal*m._framesVertical}},endFrame:{get:function(){return m._endFrame},set:function(a){a>m._totalFrames&&(a=m._totalFrames);m._endFrame=a}},beginFrame:{get:function(){return m._beginFrame},set:function(a){0>a&&(a=0);m.currentFrame=a;m._beginFrame=a}},totalFrames:{get:function(){return m._totalFrames}, -set:function(a){m._beginFrame=0;m._endFrame=a;m._totalFrames=a}}});this.image.crossOrigin='anonymous';this.image.src=this.img.data;this.image.onload=function(){m.needsUpdate=!0};this.currentFrame=0;l()}SpriteSheetTexture.prototype=Object.create(THREE.Texture.prototype);SpriteSheetTexture.prototype.setAnimationSpeed=function(a){this.animationSpeed=a};SpriteSheetTexture.prototype.setFrameGrid=function(a,b){this._framesHorizontal=a;this._framesVertical=b;this._totalFrames=a*b;this.repeat.set(1/a,1/b)}; -SpriteSheetTexture.prototype.setAnimationFrames=function(a,b){this.beginFrame=a;this.endFrame=b};SpriteSheetTexture.prototype.dispose=function(){THREE.Texture.prototype.dispose.call(this);this.disposed=!0}; +CubeTexture.prototype.toJSON=function(a){var b=THREE.Texture.prototype.toJSON.call(this,a);b.size=this.size;b.mode=this.mode;b.images=[];if(this.mode===CubeTexture.EQUIRECTANGULAR||this.mode===CubeTexture.CROSS){var e=this.images[0].toJSON(a);b.images.push(e.uuid)}else for(var d=0;d=n._endFrame&&(n.currentFrame=n._beginFrame);n.offset.x=n.currentFrame%n.framesHorizontal/n.framesHorizontal;n.offset.y=1-n.repeat.y-Math.floor(n.currentFrame/n.framesHorizontal)/n.framesVertical;n.disposed||setTimeout(l,1E3*n.animationSpeed)}'string'===typeof a?this.img=new Image(a):a instanceof Image&&(this.img=a);THREE.Texture.call(this,document.createElement('img'),c,THREE.RepeatWrapping,THREE.RepeatWrapping, +THREE.LinearFilter,THREE.LinearFilter,THREE.RGBFormat,k,h);this.name='animation';this.category='SpriteSheet';this.disposed=!1;this.format=this.img.hasTransparency()?THREE.RGBAFormat:THREE.RGBFormat;this.repeat.set(1/b,1/e);this.loop=!0;this.animationSpeed=.1;this._totalFrames=d;this._endFrame=this._beginFrame=0;this._framesHorizontal=b;this._framesVertical=e;var n=this;Object.defineProperties(this,{framesHorizontal:{get:function(){return n._framesHorizontal},set:function(a){n._framesHorizontal=a; +n.repeat.x=1/a;n.totalFrames=n._framesHorizontal*n._framesVertical}},framesVertical:{get:function(){return n._framesVertical},set:function(a){n._framesVertical=a;n.repeat.y=1/a;n.totalFrames=n._framesHorizontal*n._framesVertical}},endFrame:{get:function(){return n._endFrame},set:function(a){a>n._totalFrames&&(a=n._totalFrames);n._endFrame=a}},beginFrame:{get:function(){return n._beginFrame},set:function(a){0>a&&(a=0);n.currentFrame=a;n._beginFrame=a}},totalFrames:{get:function(){return n._totalFrames}, +set:function(a){n._beginFrame=0;n._endFrame=a;n._totalFrames=a}}});this.image.crossOrigin='anonymous';this.image.src=this.img.data;this.image.onload=function(){n.needsUpdate=!0};this.currentFrame=0;l();console.log(this)}SpriteSheetTexture.prototype=Object.create(THREE.Texture.prototype);SpriteSheetTexture.prototype.setAnimationSpeed=function(a){this.animationSpeed=a}; +SpriteSheetTexture.prototype.setFrameGrid=function(a,b){this._framesHorizontal=a;this._framesVertical=b;this._totalFrames=a*b;this.repeat.set(1/a,1/b)};SpriteSheetTexture.prototype.setAnimationFrames=function(a,b){this.beginFrame=a;this.endFrame=b};SpriteSheetTexture.prototype.dispose=function(){THREE.Texture.prototype.dispose.call(this);this.disposed=!0}; SpriteSheetTexture.prototype.toJSON=function(a){var b=THREE.Texture.prototype.toJSON.call(this,a);a=this.img.toJSON(a);b.image=a.uuid;b.loop=this.loop;b.animationSpeed=this.animationSpeed;b.framesHorizontal=this._framesHorizontal;b.framesVertical=this._framesVertical;b.totalFrames=this._totalFrames;b.beginFrame=this._beginFrame;b.endFrame=this._endFrame;return b};'use strict';function FontLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager} -FontLoader.prototype.load=function(a,b,d,c){(new THREE.FileLoader(this.manager)).load(a,function(a){b(new Font(JSON.parse(a)))},d,c)}; +FontLoader.prototype.load=function(a,b,e,d){(new THREE.FileLoader(this.manager)).load(a,function(a){b(new Font(JSON.parse(a)))},e,d)}; FontLoader.prototype.parse=function(a){if(void 0!==a.data){var b=new Font;b.name=a.name;b.uuid=a.uuid;b.encoding=a.encoding;void 0!==a.reversed&&(b.reversed=a.reversed);'arraybuffer'===a.format?(b.format=a.format,b.data=void 0!==a.data.toArrayBuffer?a.data.toArrayBuffer():a.data,b.loadTTF()):'base64'===a.format?(b.format='arraybuffer',b.data=ArraybufferUtils.fromBase64(a.data),b.loadTTF()):(b.format=a.format,b.data=a.data,b.font=a.data);return b}return new Font(a)};'use strict'; -function ImageLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager;this.path='';this.crossOrigin='Anonymous'}ImageLoader.prototype.setCrossOrigin=function(a){this.crossOrigin=a;return this};ImageLoader.prototype.setPath=function(a){this.path=a;return this};ImageLoader.prototype.loadJSON=function(a,b,d,c){var g=this;(new THREE.FileLoader(this.manager)).load(a,function(a){b(g.parse(JSON.parse(a)))},d,c)}; -ImageLoader.prototype.parse=function(a){var b=new Image(void 0!==a.data.toArrayBuffer?a.data.toArrayBuffer():a.data,a.encoding);b.name=a.name;b.uuid=a.uuid;void 0!==a.width&&(b.width=a.width,b.height=a.height);return b};'use strict';function VideoLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager}VideoLoader.prototype.load=function(a,b,d,c){var g=this;(new THREE.FileLoader(this.manager)).load(a,function(a){b(g.parse(JSON.parse(a)))},d,c)}; -VideoLoader.prototype.parse=function(a){var b=new Video(void 0!==a.data.toArrayBuffer?a.data.toArrayBuffer():a.data,a.encoding);b.name=a.name;b.uuid=a.uuid;return b};'use strict';function AudioLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager}AudioLoader.prototype.load=function(a,b,d,c){(new THREE.FileLoader(this.manager)).load(a,function(a){b(self.parse(JSON.parse(a)))},d,c)}; +function ImageLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager;this.path='';this.crossOrigin='Anonymous'}ImageLoader.prototype.setCrossOrigin=function(a){this.crossOrigin=a;return this};ImageLoader.prototype.setPath=function(a){this.path=a;return this};ImageLoader.prototype.loadJSON=function(a,b,e,d){var c=this;(new THREE.FileLoader(this.manager)).load(a,function(a){b(c.parse(JSON.parse(a)))},e,d)}; +ImageLoader.prototype.parse=function(a){var b=new Image(void 0!==a.data.toArrayBuffer?a.data.toArrayBuffer():a.data,a.encoding);b.name=a.name;b.uuid=a.uuid;void 0!==a.width&&(b.width=a.width,b.height=a.height);return b};'use strict';function VideoLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager}VideoLoader.prototype.load=function(a,b,e,d){var c=this;(new THREE.FileLoader(this.manager)).load(a,function(a){b(c.parse(JSON.parse(a)))},e,d)}; +VideoLoader.prototype.parse=function(a){var b=new Video(void 0!==a.data.toArrayBuffer?a.data.toArrayBuffer():a.data,a.encoding);b.name=a.name;b.uuid=a.uuid;return b};'use strict';function AudioLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager}AudioLoader.prototype.load=function(a,b,e,d){(new THREE.FileLoader(this.manager)).load(a,function(a){b(self.parse(JSON.parse(a)))},e,d)}; AudioLoader.prototype.parse=function(a){var b=new Audio;b.name=a.name;b.uuid=a.uuid;b.encoding=a.encoding;'base64'===a.format?(b.format='arraybuffer',b.data=ArraybufferUtils.fromBase64(a.data)):'arraybuffer'===a.format?(b.format=a.format,b.data=void 0!==a.data.toArrayBuffer?a.data.toArrayBuffer():a.data):(b.format=a.format,b.data=a.data);return b};'use strict';function MaterialLoader(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager;this.textures={}} -MaterialLoader.prototype.load=function(a,b,d,c){var g=this;(new FileLoader(g.manager)).load(a,function(a){b(g.parse(JSON.parse(a)))},d,c)};MaterialLoader.prototype.setTextures=function(a){this.textures=a}; -MaterialLoader.prototype.parse=function(a){function b(a){void 0===d[a]&&console.warn('THREE.MaterialLoader: Undefined texture',a);return d[a]}var d=this.textures,c=new window[a.type];void 0!==a.uuid&&(c.uuid=a.uuid);void 0!==a.name&&(c.name=a.name);void 0!==a.color&&(void 0===c.color&&(c.color=new THREE.Color),c.color.setHex(a.color));void 0!==a.roughness&&(c.roughness=a.roughness);void 0!==a.metalness&&(c.metalness=a.metalness);void 0!==a.specular&&(void 0===c.specular&&(c.specular=new THREE.Color), -c.specular.setHex(a.specular));void 0!==a.shininess&&(c.shininess=a.shininess);void 0!==a.clearCoat&&(c.clearCoat=a.clearCoat);void 0!==a.clearCoatRoughness&&(c.clearCoatRoughness=a.clearCoatRoughness);void 0!==a.uniforms&&(c.uniforms=a.uniforms);void 0!==a.vertexShader&&(c.vertexShader=a.vertexShader);void 0!==a.fragmentShader&&(c.fragmentShader=a.fragmentShader);void 0!==a.vertexColors&&(c.vertexColors=a.vertexColors);void 0!==a.fog&&(c.fog=a.fog);void 0!==a.blending&&(c.blending=a.blending);void 0!== -a.side&&(c.side=a.side);void 0!==a.shading&&(c.flatShading=1===a.shading);void 0!==a.flatShading&&(c.flatShading=a.flatShading);void 0!==a.rotation&&(c.rotation=a.rotation);void 0!==a.linewidth&&(c.linewidth=a.linewidth);void 0!==a.dashSize&&(c.dashSize=a.dashSize);void 0!==a.gapSize&&(c.gapSize=a.gapSize);void 0!==a.scale&&(c.scale=a.scale);void 0!==a.opacity&&(c.opacity=a.opacity);void 0!==a.transparent&&(c.transparent=a.transparent);void 0!==a.alphaTest&&(c.alphaTest=a.alphaTest);void 0!==a.depthTest&& -(c.depthTest=a.depthTest);void 0!==a.depthWrite&&(c.depthWrite=a.depthWrite);void 0!==a.colorWrite&&(c.colorWrite=a.colorWrite);void 0!==a.wireframe&&(c.wireframe=a.wireframe);void 0!==a.wireframeLinewidth&&(c.wireframeLinewidth=a.wireframeLinewidth);void 0!==a.wireframeLinecap&&(c.wireframeLinecap=a.wireframeLinecap);void 0!==a.wireframeLinejoin&&(c.wireframeLinejoin=a.wireframeLinejoin);void 0!==a.morphTargets&&(c.morphTargets=a.morphTargets);void 0!==a.morphNormals&&(c.morphNormals=a.morphNormals); -void 0!==a.dithering&&(c.dithering=a.dithering);void 0!==a.visible&&(c.visible=a.visible);void 0!==a.userData&&(c.userData=a.userData);void 0!==a.skinning&&(c.skinning=a.skinning);void 0!==a.size&&(c.size=a.size);void 0!==a.sizeAttenuation&&(c.sizeAttenuation=a.sizeAttenuation);void 0!==a.map&&(c.map=b(a.map));void 0!==a.alphaMap&&(c.alphaMap=b(a.alphaMap),c.transparent=!0);void 0!==a.bumpMap&&(c.bumpMap=b(a.bumpMap));void 0!==a.bumpScale&&(c.bumpScale=a.bumpScale);void 0!==a.normalMap&&(c.normalMap= -b(a.normalMap));if(void 0!==a.normalScale){var g=a.normalScale;!1===Array.isArray(g)&&(g=[g,g]);c.normalScale=(new Vector2).fromArray(g)}void 0!==a.displacementMap&&(c.displacementMap=b(a.displacementMap));void 0!==a.displacementScale&&(c.displacementScale=a.displacementScale);void 0!==a.displacementBias&&(c.displacementBias=a.displacementBias);void 0!==a.roughnessMap&&(c.roughnessMap=b(a.roughnessMap));void 0!==a.metalnessMap&&(c.metalnessMap=b(a.metalnessMap));void 0!==a.emissiveMap&&(c.emissiveMap= -b(a.emissiveMap));void 0!==a.emissive&&(void 0===c.emissive&&(c.emissive=new THREE.Color),c.emissive.setHex(a.emissive));void 0!==a.emissiveIntensity&&(c.emissiveIntensity=a.emissiveIntensity);void 0!==a.matcap&&(c.matcap=b(a.matcap));void 0!==a.specularMap&&(c.specularMap=b(a.specularMap));void 0!==a.envMap&&(c.envMap=b(a.envMap));void 0!==a.reflectivity&&(c.reflectivity=a.reflectivity);void 0!==a.envMapIntensity&&(c.envMapIntensity=a.envMapIntensity);void 0!==a.combine&&(c.combine=a.combine);void 0!== -a.refractionRatio&&(c.refractionRatio=a.refractionRatio);void 0!==a.lightMap&&(c.lightMap=b(a.lightMap));void 0!==a.lightMapIntensity&&(c.lightMapIntensity=a.lightMapIntensity);void 0!==a.aoMap&&(c.aoMap=b(a.aoMap));void 0!==a.aoMapIntensity&&(c.aoMapIntensity=a.aoMapIntensity);void 0!==a.gradientMap&&(c.gradientMap=b(a.gradientMap));if(void 0!==a.materials){g=0;for(var h=a.materials.length;gh;h++){var G=l[r++];var I=z[2*G];G=z[2*G+1];I=new THREE.Vector2(I,G);2!==h&&d.faceVertexUvs[g][D].push(I);0!==h&&d.faceVertexUvs[g][D+1].push(I)}}w&&(w=3*l[r++],t.normal.set(q[w++], -q[w++],q[w]),v.normal.copy(t.normal));if(u)for(g=0;4>g;g++)w=3*l[r++],u=new THREE.Vector3(q[w++],q[w++],q[w]),2!==g&&t.vertexNormals.push(u),0!==g&&v.vertexNormals.push(u);e&&(e=l[r++],e=p[e],t.color.setHex(e),v.color.setHex(e));if(m)for(g=0;4>g;g++)e=l[r++],e=p[e],2!==g&&t.vertexColors.push(new Color(e)),0!==g&&v.vertexColors.push(new Color(e));d.faces.push(t);d.faces.push(v)}else{t=new THREE.Face3;t.a=l[r++];t.b=l[r++];t.c=l[r++];D&&(D=l[r++],t.materialIndex=D);D=d.faces.length;if(g)for(g=0;gh;h++)G=l[r++],I=z[2*G],G=z[2*G+1],I=new THREE.Vector2(I,G),d.faceVertexUvs[g][D].push(I);w&&(w=3*l[r++],t.normal.set(q[w++],q[w++],q[w]));if(u)for(g=0;3>g;g++)w=3*l[r++],u=new THREE.Vector3(q[w++],q[w++],q[w]),t.vertexNormals.push(u);e&&(e=l[r++],t.color.setHex(p[e]));if(m)for(g=0;3>g;g++)e=l[r++],t.vertexColors.push(new Color(p[e]));d.faces.push(t)}}c=a;r=void 0!==c.influencesPerVertex?c.influencesPerVertex:2;if(c.skinWeights)for(k=0,l=c.skinWeights.length;k< -l;k+=r)d.skinWeights.push(new Vector4(c.skinWeights[k],1k;k++){var I=l[r++];var H=w[2*I];I=w[2*I+1];H=new THREE.Vector2(H,I);2!==k&&e.faceVertexUvs[c][E].push(H);0!==k&&e.faceVertexUvs[c][E+1].push(H)}}v&&(v=3*l[r++],u.normal.set(q[v++], +q[v++],q[v]),z.normal.copy(u.normal));if(t)for(c=0;4>c;c++)v=3*l[r++],t=new THREE.Vector3(q[v++],q[v++],q[v]),2!==c&&u.vertexNormals.push(t),0!==c&&z.vertexNormals.push(t);g&&(g=l[r++],g=m[g],u.color.setHex(g),z.color.setHex(g));if(n)for(c=0;4>c;c++)g=l[r++],g=m[g],2!==c&&u.vertexColors.push(new Color(g)),0!==c&&z.vertexColors.push(new Color(g));e.faces.push(u);e.faces.push(z)}else{u=new THREE.Face3;u.a=l[r++];u.b=l[r++];u.c=l[r++];E&&(E=l[r++],u.materialIndex=E);E=e.faces.length;if(c)for(c=0;ck;k++)I=l[r++],H=w[2*I],I=w[2*I+1],H=new THREE.Vector2(H,I),e.faceVertexUvs[c][E].push(H);v&&(v=3*l[r++],u.normal.set(q[v++],q[v++],q[v]));if(t)for(c=0;3>c;c++)v=3*l[r++],t=new THREE.Vector3(q[v++],q[v++],q[v]),u.vertexNormals.push(t);g&&(g=l[r++],u.color.setHex(m[g]));if(n)for(c=0;3>c;c++)g=l[r++],u.vertexColors.push(new Color(m[g]));e.faces.push(u)}}d=a;r=void 0!==d.influencesPerVertex?d.influencesPerVertex:2;if(d.skinWeights)for(h=0,l=d.skinWeights.length;h< +l;h+=r)e.skinWeights.push(new Vector4(d.skinWeights[h],1a;a++)this.gesture[a]=!1;this.pose=[];for(a=0;3>a;a++)this.pose[a]=!1;this.data=null}LeapMotion.prototype=Object.create(THREE.Group.prototype); LeapMotion.DESK=0;LeapMotion.HDM=1;LeapMotion.SWIPE=0;LeapMotion.SWIPE_LEFT=1;LeapMotion.SWIPE_RIGHT=2;LeapMotion.SWIPE_FRONT=3;LeapMotion.SWIPE_BACK=4;LeapMotion.SWIPE_UP=5;LeapMotion.SWIPE_DOWN=6;LeapMotion.CIRCLE=7;LeapMotion.SCREEN_TAP=8;LeapMotion.KEY_TAP=9;LeapMotion.CLOSED=0;LeapMotion.OPEN=1;LeapMotion.POINTING=2;LeapMotion.prototype.initialize=function(){var a=this;Leap.loop({background:!0},function(b){a.data=b}).connect();THREE.Object3D.prototype.initialize.call(this)}; LeapMotion.prototype.update=function(a){null!==this.data&&(this.gesturesEnabled&&this.updateGestures(),this.posesEnabled&&this.updatePoses(),this.debugModel&&this.updateDebugModel());THREE.Object3D.prototype.update.call(this,a)};LeapMotion.prototype.checkGesture=function(a){return void 0!==this.gesture[a]?this.gesture[a]:!1};LeapMotion.prototype.checkPose=function(a){return void 0!==this.pose[a]?this.pose[a]:!1};LeapMotion.prototype.setMode=function(a){this.mode=a}; -LeapMotion.prototype.updatePoses=function(){for(var a=0;ak[a][2]&&(this.pose[LeapMotion.CLOSED]= -!1),-.5h[a][2]&&(this.pose[LeapMotion.CLOSED]= +!1),-.5this.viewport.x&&b.position.xthis.height-this.viewport.y-this.viewport.w}; -Viewport.prototype.getNormalized=function(){var a=new THREE.Vector2;return function(b,d){a.set((d.position.x-this.viewport.z-this.viewport.x)/this.viewport.z*2+1,-(d.position.y-(this.height-(this.viewport.y+this.viewport.w)))/this.viewport.w*2+1);return a}}();Viewport.prototype.enable=function(a){a.setViewport(this.viewport);a.setScissor(this.viewport)};Viewport.prototype.toJSON=function(){return{offset:this.offset.toArray(),size:this.size.toArray(),mode:this.mode,anchor:this.anchor}}; -Viewport.prototype.fromJSON=function(a){this.offset.fromArray(a.offset);this.size.fromArray(a.size);this.mode=a.mode;this.anchor=a.anchor};'use strict';function PerspectiveCamera(a,b,d,c){this.viewport=new Viewport;THREE.PerspectiveCamera.call(this,a,b,d,c);this.name='camera';this.clearStencil=this.clearDepth=this.clearColor=!0;this.order=0;this.composer=new EffectComposer;a=new RenderPass;a.renderToScreen=!0;this.composer.addPass(a)}PerspectiveCamera.prototype=Object.create(THREE.PerspectiveCamera.prototype); -PerspectiveCamera.prototype.resize=function(a,b,d){this.viewport.width=a;this.viewport.height=b;this.viewport.update(d);this.aspect=this.viewport.getAspectRatio();this.updateProjectionMatrix();this.composer.setSize(this.viewport.viewport.z,this.viewport.viewport.w)};PerspectiveCamera.prototype.setupRenderer=function(a){this.viewport.enable(a);a.clear(this.clearColor,this.clearDepth,this.clearStencil)};PerspectiveCamera.prototype.render=function(a,b){this.composer.render(a,b,this,.016)}; -PerspectiveCamera.prototype.destroy=function(){var a=this.getScene();null!==a&&a.removeCamera(this);THREE.Object3D.prototype.destroy.call(this)};PerspectiveCamera.prototype.updateProjectionMatrix=function(){var a=this.near*Math.tan(.5*THREE.Math.DEG2RAD*this.fov)/this.zoom,b=2*a,d=this.aspect*b,c=-.5*d;0!==this.filmOffset&&(c+=this.near*this.filmOffset/this.getFilmWidth());this.projectionMatrix.makePerspective(c,c+d,a,a-b,this.near,this.far)}; +Viewport.prototype.update=function(a){var b;if(void 0===a){var e=b=0;var d=this.width;a=this.height}else b=a.viewport.x,e=a.viewport.y,d=a.viewport.z,a=a.viewport.w;if(this.mode===Viewport.RELATIVE){var c=new THREE.Vector2(this.offset.x*d,this.offset.y*a);var k=new THREE.Vector2(this.size.x*d,this.size.y*a)}else this.mode===Viewport.ABSOLUTE&&(c=this.offset,k=this.size);this.anchor===Viewport.BOTTOM_LEFT?this.viewport.set(c.x+b,c.y+e,k.x,k.y):this.anchor===Viewport.BOTTOM_RIGHT?this.viewport.set(d- +k.x-c.x+b,c.y+e,k.x,k.y):this.anchor===Viewport.TOP_LEFT?this.viewport.set(c.x+b,a-k.y-c.y+e,k.x,k.y):this.anchor===Viewport.TOP_RIGHT&&this.viewport.set(d-k.x-c.x+b,a-k.y-c.y+e,k.x,k.y)};Viewport.prototype.getAspectRatio=function(){return this.viewport.z/this.viewport.w};Viewport.prototype.isInside=function(a,b){return b.position.x>this.viewport.x&&b.position.xthis.height-this.viewport.y-this.viewport.w}; +Viewport.prototype.getNormalized=function(){var a=new THREE.Vector2;return function(b,e){a.set((e.position.x-this.viewport.z-this.viewport.x)/this.viewport.z*2+1,-(e.position.y-(this.height-(this.viewport.y+this.viewport.w)))/this.viewport.w*2+1);return a}}();Viewport.prototype.enable=function(a){a.setViewport(this.viewport);a.setScissor(this.viewport)};Viewport.prototype.toJSON=function(){return{offset:this.offset.toArray(),size:this.size.toArray(),mode:this.mode,anchor:this.anchor}}; +Viewport.prototype.fromJSON=function(a){this.offset.fromArray(a.offset);this.size.fromArray(a.size);this.mode=a.mode;this.anchor=a.anchor};'use strict';function PerspectiveCamera(a,b,e,d){this.viewport=new Viewport;THREE.PerspectiveCamera.call(this,a,b,e,d);this.name='camera';this.clearStencil=this.clearDepth=this.clearColor=!0;this.order=0;this.composer=new EffectComposer;a=new RenderPass;a.renderToScreen=!0;this.composer.addPass(a)}PerspectiveCamera.prototype=Object.create(THREE.PerspectiveCamera.prototype); +PerspectiveCamera.prototype.resize=function(a,b,e){this.viewport.width=a;this.viewport.height=b;this.viewport.update(e);this.aspect=this.viewport.getAspectRatio();this.updateProjectionMatrix();this.composer.setSize(this.viewport.viewport.z,this.viewport.viewport.w)};PerspectiveCamera.prototype.setupRenderer=function(a){this.viewport.enable(a);a.clear(this.clearColor,this.clearDepth,this.clearStencil)};PerspectiveCamera.prototype.render=function(a,b){this.composer.render(a,b,this,.016)}; +PerspectiveCamera.prototype.destroy=function(){var a=this.getScene();null!==a&&a.removeCamera(this);THREE.Object3D.prototype.destroy.call(this)};PerspectiveCamera.prototype.updateProjectionMatrix=function(){var a=this.near*Math.tan(.5*THREE.Math.DEG2RAD*this.fov)/this.zoom,b=2*a,e=this.aspect*b,d=-.5*e;0!==this.filmOffset&&(d+=this.near*this.filmOffset/this.getFilmWidth());this.projectionMatrix.makePerspective(d,d+e,a,a-b,this.near,this.far);this.projectionMatrixInverse.getInverse(this.projectionMatrix)}; PerspectiveCamera.prototype.toJSON=function(a){a=THREE.PerspectiveCamera.prototype.toJSON.call(this,a);a.object.clearColor=this.clearColor;a.object.clearDepth=this.clearDepth;a.object.clearStencil=this.clearStencil;a.object.viewport=this.viewport.toJSON();a.object.order=this.order;a.object.composer=this.composer.toJSON();return a};'use strict'; -function OrthographicCamera(a,b,d,c,g){THREE.OrthographicCamera.call(this,-1,1,1,-1,c,g);this.name='camera';this.size=void 0!=a?a:10;this.aspect=void 0!=b?b:1;this.mode=void 0!==d?d:OrthographicCamera.RESIZE_HORIZONTAL;this.viewport=new Viewport;this.clearStencil=this.clearDepth=this.clearColor=!0;this.order=0;this.updateProjectionMatrix();this.composer=new EffectComposer;a=new RenderPass;a.renderToScreen=!0;this.composer.addPass(a)}OrthographicCamera.prototype=Object.create(THREE.OrthographicCamera.prototype); -OrthographicCamera.RESIZE_HORIZONTAL=0;OrthographicCamera.RESIZE_VERTICAL=1;OrthographicCamera.prototype.resize=function(a,b,d){this.viewport.width=a;this.viewport.height=b;this.viewport.update(d);this.aspect=this.viewport.getAspectRatio();this.updateProjectionMatrix();this.composer.setSize(this.viewport.viewport.z,this.viewport.viewport.w)};OrthographicCamera.prototype.setupRenderer=function(a){this.viewport.enable(a);a.clear(this.clearColor,this.clearDepth,this.clearStencil)}; +function OrthographicCamera(a,b,e,d,c){THREE.OrthographicCamera.call(this,-1,1,1,-1,d,c);this.name='camera';this.size=void 0!=a?a:10;this.aspect=void 0!=b?b:1;this.mode=void 0!==e?e:OrthographicCamera.RESIZE_HORIZONTAL;this.viewport=new Viewport;this.clearStencil=this.clearDepth=this.clearColor=!0;this.order=0;this.updateProjectionMatrix();this.composer=new EffectComposer;a=new RenderPass;a.renderToScreen=!0;this.composer.addPass(a)}OrthographicCamera.prototype=Object.create(THREE.OrthographicCamera.prototype); +OrthographicCamera.RESIZE_HORIZONTAL=0;OrthographicCamera.RESIZE_VERTICAL=1;OrthographicCamera.prototype.resize=function(a,b,e){this.viewport.width=a;this.viewport.height=b;this.viewport.update(e);this.aspect=this.viewport.getAspectRatio();this.updateProjectionMatrix();this.composer.setSize(this.viewport.viewport.z,this.viewport.viewport.w)};OrthographicCamera.prototype.setupRenderer=function(a){this.viewport.enable(a);a.clear(this.clearColor,this.clearDepth,this.clearStencil)}; OrthographicCamera.prototype.render=function(a,b){this.composer.render(a,b,this,.016)};OrthographicCamera.prototype.destroy=function(){var a=this.getScene();null!==a&&a.removeCamera(this);THREE.Object3D.prototype.destroy.call(this)}; OrthographicCamera.prototype.updateProjectionMatrix=function(){this.mode===OrthographicCamera.RESIZE_HORIZONTAL?(this.top=this.size/2,this.bottom=-this.top,this.right=this.top*this.aspect,this.left=-this.right):this.mode===OrthographicCamera.RESIZE_VERTICAL&&(this.right=this.size/2,this.left=-this.right,this.top=this.right/this.aspect,this.bottom=-this.top);THREE.OrthographicCamera.prototype.updateProjectionMatrix.call(this)}; OrthographicCamera.prototype.toJSON=function(a){a=THREE.OrthographicCamera.prototype.toJSON.call(this,a);a.object.size=this.size;a.object.aspect=this.aspect;a.object.mode=this.mode;a.object.clearColor=this.clearColor;a.object.clearDepth=this.clearDepth;a.object.clearStencil=this.clearStencil;a.object.viewport=this.viewport.toJSON();a.object.order=this.order;a.object.composer=this.composer.toJSON();return a};'use strict'; @@ -2556,83 +2578,83 @@ AudioEmitter.prototype.play=function(){if(null===this.buffer)console.warn('nunuS AudioEmitter.prototype.getVolume=function(){return this.gain.gain.value};AudioEmitter.prototype.setVolume=function(a){this.volume=a;this.gain.gain.value=a;return this};AudioEmitter.prototype.setLoop=function(a){this.loop=a;this.isPlaying&&(this.source.loop=this.loop);return this};AudioEmitter.prototype.setDetune=function(a){this.detune=a;!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01);return this};AudioEmitter.prototype.getLoop=function(){return this.loop}; AudioEmitter.prototype.setPlaybackRate=function(a){this.playbackRate=a;this.isPlaying&&this.source.playbackRate.setValueAtTime(this.playbackRate,this.context.currentTime);return this};AudioEmitter.prototype.getPlaybackRate=function(){return this.playbackRate};AudioEmitter.prototype.getFilters=function(){return this.filters};AudioEmitter.prototype.setFilters=function(a){a||(a=[]);this.isPlaying?(this.disconnect(),this.filters=a,this.connect()):this.filters=a;return this}; AudioEmitter.prototype.getFilter=function(a){return this.getFilters()[void 0!==a?a:0]};AudioEmitter.prototype.setFilter=function(a){return this.setFilters(a?[a]:[])};AudioEmitter.prototype.setNodeSource=function(a){this.hasPlaybackControl=!1;this.sourceType='audioNode';this.source=a;this.connect();return this};AudioEmitter.prototype.getOutput=function(){return this.gain};AudioEmitter.prototype.dispose=function(){this.isPlaying&&(this.stop(),this.disconnect());THREE.Object3D.prototype.dispose.call(this)}; -AudioEmitter.prototype.toJSON=function(a){var b=this.audio;a=THREE.Object3D.prototype.toJSON.call(this,a,function(a,c){b=b.toJSON(a)});a.object.audio=b.uuid;a.object.volume=this.volume;a.object.autoplay=this.autoplay;a.object.startTime=this.startTime;a.object.playbackRate=this.playbackRate;a.object.loop=this.loop;return a};'use strict'; +AudioEmitter.prototype.toJSON=function(a){var b=this.audio;a=THREE.Object3D.prototype.toJSON.call(this,a,function(a,d){b=b.toJSON(a)});a.object.audio=b.uuid;a.object.volume=this.volume;a.object.autoplay=this.autoplay;a.object.startTime=this.startTime;a.object.playbackRate=this.playbackRate;a.object.loop=this.loop;return a};'use strict'; function PositionalAudio(a){AudioEmitter.call(this,a);this.type='PositionalAudio';this.matrixAutoUpdate=!0;this.distanceModel='inverse';this.panningModel='HRTF';this.panner=this.context.createPanner();this.panner.connect(this.gain);this.panner.panningModel=this.panningModel;this.panner.distanceModel=this.distanceModel;this.panner.refDistance=1;this.panner.maxDistance=1E4;this.panner.rolloffFactor=1;this.panner.coneInnerAngle=360;this.panner.coneOuterAngle=0;this.panner.coneOuterGain=0;this.scene= null;this.tempPosition=new THREE.Vector3;this.tempPositionCamera=new THREE.Vector3;this.tempQuaternionCamera=new THREE.Quaternion}THREE._PositionalAudio=THREE.PositionalAudio;THREE.PositionalAudio=PositionalAudio;PositionalAudio.prototype=Object.create(AudioEmitter.prototype);PositionalAudio.prototype.initialize=function(){AudioEmitter.prototype.initialize.call(this);for(var a=this.parent;null!==a;){if(a instanceof Scene){this.scene=a;break}a=a.parent}}; PositionalAudio.prototype.update=function(a){if(0\n}\n\nfunction update(delta)\n{\n\t//TODO \n}\n';Script.METHODS='initialize update dispose onMouseOver onResize onAppData'.split(' ');Script.APPEND=100; -Script.EVALUATE=101;Script.INCLUDE=102;Script.getIncludes=function(a){var b=[],d=a.search(/include\(".+?"\);/gi);-1!==d&&(a=a.substring(d),d=a.indexOf('");'),a=a.substring(9,d),b.push(a));return b};Script.removeIncludes=function(a){return a.replace(/include\(".+?"\);/gi,'')}; +Script.EVALUATE=101;Script.INCLUDE=102;Script.getIncludes=function(a){var b=[],e=a.search(/include\(".+?"\);/gi);-1!==e&&(a=a.substring(e),e=a.indexOf('");'),a=a.substring(9,e),b.push(a));return b};Script.removeIncludes=function(a){return a.replace(/include\(".+?"\);/gi,'')}; Script.prototype.initialize=function(){for(var a=this;null!==a.parent;)a=a.parent,a instanceof Scene?this.scene=a:a instanceof Program&&(this.program=a);THREE.Object3D.prototype.initialize.call(this);var b=this;this.compileCode(this.code,function(){void 0!==b.script.initialize&&b.script.initialize.call(b)})}; Script.prototype.update=function(a){if(void 0!==this.script.onMouseOver){var b=this.scene.raycaster.intersectObjects(this.children,!0);0this.dayTime&&(this.time-=this.dayTime),this.updateSky());THREE.Object3D.prototype.update.call(this,a)}; -Sky.prototype.updateSky=function(){var a=this.time/this.dayTime;if(.25>a)this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[3].r,this.colorTop[3].g,this.colorTop[3].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[3].r,this.colorBottom[3].g,this.colorBottom[3].b);else if(.292>a){var b=23.81*(a-.25),d=1-b;this.sky.material.uniforms.topColor.value.setRGB(d*this.colorTop[3].r+b*this.colorTop[0].r,d*this.colorTop[3].g+b*this.colorTop[0].g,d*this.colorTop[3].b+b*this.colorTop[0].b); -this.sky.material.uniforms.bottomColor.value.setRGB(d*this.colorBottom[3].r+b*this.colorBottom[0].r,d*this.colorBottom[3].g+b*this.colorBottom[0].g,d*this.colorBottom[3].b+b*this.colorBottom[0].b)}else.4167>a?(this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[0].r,this.colorTop[0].g,this.colorTop[0].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[0].r,this.colorBottom[0].g,this.colorBottom[0].b)):.5>a?(b=12*(a-.4167),d=1-b,this.sky.material.uniforms.topColor.value.setRGB(d* -this.colorTop[0].r+b*this.colorTop[1].r,d*this.colorTop[0].g+b*this.colorTop[1].g,d*this.colorTop[0].b+b*this.colorTop[1].b),this.sky.material.uniforms.bottomColor.value.setRGB(d*this.colorBottom[0].r+b*this.colorBottom[1].r,d*this.colorBottom[0].g+b*this.colorBottom[1].g,d*this.colorBottom[0].b+b*this.colorBottom[1].b)):.708>a?(this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[1].r,this.colorTop[1].g,this.colorTop[1].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[1].r, -this.colorBottom[1].g,this.colorBottom[1].b)):.75>a?(b=23.81*(a-.708),d=1-b,this.sky.material.uniforms.topColor.value.setRGB(d*this.colorTop[1].r+b*this.colorTop[2].r,d*this.colorTop[1].g+b*this.colorTop[2].g,d*this.colorTop[1].b+b*this.colorTop[2].b),this.sky.material.uniforms.bottomColor.value.setRGB(d*this.colorBottom[1].r+b*this.colorBottom[2].r,d*this.colorBottom[1].g+b*this.colorBottom[2].g,d*this.colorBottom[1].b+b*this.colorBottom[2].b)):.8333>a?(b=12.048*(a-.75),d=1-b,this.sky.material.uniforms.topColor.value.setRGB(d* -this.colorTop[2].r+b*this.colorTop[3].r,d*this.colorTop[2].g+b*this.colorTop[3].g,d*this.colorTop[2].b+b*this.colorTop[3].b),this.sky.material.uniforms.bottomColor.value.setRGB(d*this.colorBottom[2].r+b*this.colorBottom[3].r,d*this.colorBottom[2].g+b*this.colorBottom[3].g,d*this.colorBottom[2].b+b*this.colorBottom[3].b)):(this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[3].r,this.colorTop[3].g,this.colorTop[3].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[3].r, +Sky.prototype.updateSky=function(){var a=this.time/this.dayTime;if(.25>a)this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[3].r,this.colorTop[3].g,this.colorTop[3].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[3].r,this.colorBottom[3].g,this.colorBottom[3].b);else if(.292>a){var b=23.81*(a-.25),e=1-b;this.sky.material.uniforms.topColor.value.setRGB(e*this.colorTop[3].r+b*this.colorTop[0].r,e*this.colorTop[3].g+b*this.colorTop[0].g,e*this.colorTop[3].b+b*this.colorTop[0].b); +this.sky.material.uniforms.bottomColor.value.setRGB(e*this.colorBottom[3].r+b*this.colorBottom[0].r,e*this.colorBottom[3].g+b*this.colorBottom[0].g,e*this.colorBottom[3].b+b*this.colorBottom[0].b)}else.4167>a?(this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[0].r,this.colorTop[0].g,this.colorTop[0].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[0].r,this.colorBottom[0].g,this.colorBottom[0].b)):.5>a?(b=12*(a-.4167),e=1-b,this.sky.material.uniforms.topColor.value.setRGB(e* +this.colorTop[0].r+b*this.colorTop[1].r,e*this.colorTop[0].g+b*this.colorTop[1].g,e*this.colorTop[0].b+b*this.colorTop[1].b),this.sky.material.uniforms.bottomColor.value.setRGB(e*this.colorBottom[0].r+b*this.colorBottom[1].r,e*this.colorBottom[0].g+b*this.colorBottom[1].g,e*this.colorBottom[0].b+b*this.colorBottom[1].b)):.708>a?(this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[1].r,this.colorTop[1].g,this.colorTop[1].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[1].r, +this.colorBottom[1].g,this.colorBottom[1].b)):.75>a?(b=23.81*(a-.708),e=1-b,this.sky.material.uniforms.topColor.value.setRGB(e*this.colorTop[1].r+b*this.colorTop[2].r,e*this.colorTop[1].g+b*this.colorTop[2].g,e*this.colorTop[1].b+b*this.colorTop[2].b),this.sky.material.uniforms.bottomColor.value.setRGB(e*this.colorBottom[1].r+b*this.colorBottom[2].r,e*this.colorBottom[1].g+b*this.colorBottom[2].g,e*this.colorBottom[1].b+b*this.colorBottom[2].b)):.8333>a?(b=12.048*(a-.75),e=1-b,this.sky.material.uniforms.topColor.value.setRGB(e* +this.colorTop[2].r+b*this.colorTop[3].r,e*this.colorTop[2].g+b*this.colorTop[3].g,e*this.colorTop[2].b+b*this.colorTop[3].b),this.sky.material.uniforms.bottomColor.value.setRGB(e*this.colorBottom[2].r+b*this.colorBottom[3].r,e*this.colorBottom[2].g+b*this.colorBottom[3].g,e*this.colorBottom[2].b+b*this.colorBottom[3].b)):(this.sky.material.uniforms.topColor.value.setRGB(this.colorTop[3].r,this.colorTop[3].g,this.colorTop[3].b),this.sky.material.uniforms.bottomColor.value.setRGB(this.colorBottom[3].r, this.colorBottom[3].g,this.colorBottom[3].b));.2>a?(this.sun.intensity=this.intensity,this.sun.color.setHex(this.moonColor)):.3>a?(b=10*(a-.2),.5>b?(this.sun.intensity=(2-2*b)*this.intensity,this.sun.color.setHex(this.moonColor)):(this.sun.intensity=2*b*this.intensity,this.sun.color.setHex(this.sunColor))):.7>a?(this.sun.intensity=this.intensity,this.sun.color.setHex(this.sunColor)):.8>a?(b=10*(a-.7),.5>b?(this.sun.intensity=(2-2*b)*this.intensity,this.sun.color.setHex(this.sunColor)):(this.sun.intensity= 2*b*this.intensity,this.sun.color.setHex(this.moonColor))):(this.sun.intensity=this.intensity,this.sun.color.setHex(this.moonColor));b=MathUtils.PI2*a-MathUtils.PID2;.25a?(this.sun.position.x=this.sunDistance*Math.cos(b),this.sun.position.y=this.sunDistance*Math.sin(b)):(this.sun.position.x=this.sunDistance*Math.cos(b+Math.PI),this.sun.position.y=this.sunDistance*Math.sin(b+Math.PI))}; Sky.prototype.toJSON=function(a){a=THREE.Object3D.prototype.toJSON.call(this,a);a.object.colorTop=[];for(var b=0;ba;a++)b=new THREE.PerspectiveCamera(90,1,this.near,this.far),b.parent=this,this.cameras.push(b);this.cameras[0].up.set(0,-1,0);this.cameras[0].lookAt(new THREE.Vector3(1,0,0));this.cameras[1].up.set(0,-1,0);this.cameras[1].lookAt(new THREE.Vector3(-1,0,0)); +function CubeCamera(a,b,e,d){THREE.Object3D.call(this);this.name='cubecamera';this.type='CubeCamera';this.near=void 0!==a?a:.01;this.far=void 0!==b?b:1E4;this.resolution=void 0!==e?e:256;this.autoUpdate=void 0!==d?d:!1;this.cameras=[];for(a=0;6>a;a++)b=new THREE.PerspectiveCamera(90,1,this.near,this.far),b.parent=this,this.cameras.push(b);this.cameras[0].up.set(0,-1,0);this.cameras[0].lookAt(new THREE.Vector3(1,0,0));this.cameras[1].up.set(0,-1,0);this.cameras[1].lookAt(new THREE.Vector3(-1,0,0)); this.cameras[2].up.set(0,0,1);this.cameras[2].lookAt(new THREE.Vector3(0,1,0));this.cameras[3].up.set(0,0,-1);this.cameras[3].lookAt(new THREE.Vector3(0,-1,0));this.cameras[4].up.set(0,-1,0);this.cameras[4].lookAt(new THREE.Vector3(0,0,1));this.cameras[5].up.set(0,-1,0);this.cameras[5].lookAt(new THREE.Vector3(0,0,-1));this.target=new THREE.WebGLRenderTargetCube(this.resolution,this.resolution,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.cube=this.target.texture; this.cube.generateMipmaps=!1;this.cube.name='cube';this.renderer=this.scene=null}THREE._CubeCamera=THREE.CubeCamera;THREE.CubeCamera=CubeCamera;CubeCamera.prototype=Object.create(THREE.Object3D.prototype);CubeCamera.prototype.initialize=function(){for(var a=this;null!==a.parent;)a=a.parent,a instanceof Scene?this.scene=a:a instanceof Program&&(this.renderer=a.renderer);THREE.Object3D.prototype.initialize.call(this)}; -CubeCamera.prototype.update=function(a){this.autoUpdate&&this.updateCubeMap(this.renderer,this.scene);THREE.Object3D.prototype.update.call(this,a)};CubeCamera.prototype.setResolution=function(a){this.resolution=a;this.target.setSize(a,a)};CubeCamera.prototype.updateCubeMap=function(a,b){var d=a.autoClear;a.autoClear=!0;for(var c=0;6>c;c++)this.cameras[c].updateMatrixWorld(),this.target.activeCubeFace=c,a.setRenderTarget(this.target),a.render(b,this.cameras[c]);a.autoClear=d}; +CubeCamera.prototype.update=function(a){this.autoUpdate&&this.updateCubeMap(this.renderer,this.scene);THREE.Object3D.prototype.update.call(this,a)};CubeCamera.prototype.setResolution=function(a){this.resolution=a;this.target.setSize(a,a)};CubeCamera.prototype.updateCubeMap=function(a,b){var e=a.autoClear;a.autoClear=!0;for(var d=0;6>d;d++)this.cameras[d].updateMatrixWorld(),this.target.activeCubeFace=d,a.setRenderTarget(this.target),a.render(b,this.cameras[d]);a.autoClear=e}; CubeCamera.prototype.toJSON=function(a){a=THREE.Object3D.prototype.toJSON.call(this,a);a.object.near=this.near;a.object.far=this.far;a.object.resolution=this.resolution;a.object.autoUpdate=this.autoUpdate;return a};'use strict'; function LensFlare(){THREE.Mesh.call(this,THREE.Lensflare.Geometry,new THREE.MeshBasicMaterial({opacity:0,transparent:!0}));this.name='lensflare';this.type='LensFlare';this.renderOrder=Infinity;this.castShadow=this.receiveShadow=this.frustumCulled=!1;this.elements=[];var a=new THREE.Vector3,b=new THREE.DataTexture(new Uint8Array(768),16,16,THREE.RGBFormat);b.minFilter=THREE.NearestFilter;b.magFilter=THREE.NearestFilter;b.wrapS=THREE.ClampToEdgeWrapping;b.wrapT=THREE.ClampToEdgeWrapping;b.needsUpdate= -!0;var d=new THREE.DataTexture(new Uint8Array(768),16,16,THREE.RGBFormat);d.minFilter=THREE.NearestFilter;d.magFilter=THREE.NearestFilter;d.wrapS=THREE.ClampToEdgeWrapping;d.wrapT=THREE.ClampToEdgeWrapping;d.needsUpdate=!0;var c=THREE.Lensflare.Geometry,g=THREE.Lensflare.Shader,h=new THREE.RawShaderMaterial({uniforms:{scale:{value:null},screenPosition:{value:null}},vertexShader:'precision highp float;\n\t\t\tuniform vec3 screenPosition;\n\t\t\tuniform vec2 scale;\n\t\t\tattribute vec3 position;\n\t\t\tvoid main()\n\t\t\t{\n\t\t\t\tgl_Position = vec4(position.xy * scale + screenPosition.xy, screenPosition.z, 1.0);\n\t\t\t}', -fragmentShader:'precision highp float;\n\t\t\tvoid main()\n\t\t\t{\n\t\t\t\tgl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);\n\t\t\t}',depthTest:!0,depthWrite:!1,transparent:!1}),k=new THREE.RawShaderMaterial({uniforms:{map:{value:b},scale:{value:null},screenPosition:{value:null}},vertexShader:'precision highp float;\n\t\t\tuniform vec3 screenPosition;\n\t\t\tuniform vec2 scale;\n\t\t\tattribute vec3 position;\n\t\t\tattribute vec2 uv;\n\t\t\tvarying vec2 vUV;\n\t\t\tvoid main()\n\t\t\t{\n\t\t\t\tvUV = uv;\n\t\t\t\tgl_Position = vec4(position.xy * scale + screenPosition.xy, screenPosition.z, 1.0);\n\t\t\t}', -fragmentShader:'precision highp float;\n\t\t\tuniform sampler2D map;\n\t\t\tvarying vec2 vUV;\n\t\t\tvoid main()\n\t\t\t{\n\t\t\t\tgl_FragColor = texture2D(map, vUV);\n\t\t\t}',depthTest:!1,depthWrite:!1,transparent:!1}),l=new THREE.Mesh(c,h);g=THREE.LensflareElement.Shader;var m=new THREE.RawShaderMaterial({uniforms:{map:{value:null},occlusionMap:{value:d},color:{value:new THREE.Color(16777215)},scale:{value:new THREE.Vector2},screenPosition:{value:new THREE.Vector3}},vertexShader:g.vertexShader, -fragmentShader:g.fragmentShader,blending:THREE.AdditiveBlending,transparent:!0,depthWrite:!1}),q=new THREE.Mesh(c,m),p=new THREE.Vector2,e=new THREE.Vector2,n=new THREE.Box2,r=new THREE.Vector4;this.onBeforeRender=function(g,D,w){g.getCurrentViewport(r);D=r.w/r.z;var t=r.z/2,v=r.w/2,z=16/r.w;p.set(z*D,z);n.min.set(r.x,r.y);n.max.set(r.x+(r.z-16),r.y+(r.w-16));a.setFromMatrixPosition(this.matrixWorld);a.applyMatrix4(w.matrixWorldInverse);a.applyMatrix4(w.projectionMatrix);e.x=r.x+a.x*t+t-8;e.y=r.y+ -a.y*v+v-8;if(n.containsPoint(e)){g.copyFramebufferToTexture(e,b);t=h.uniforms;t.scale.value=p;t.screenPosition.value=a;g.renderBufferDirect(w,null,c,h,l,null);g.copyFramebufferToTexture(e,d);t=k.uniforms;t.scale.value=p;t.screenPosition.value=a;g.renderBufferDirect(w,null,c,k,l,null);v=2*-a.x;for(var G=2*-a.y,I=0,K=this.elements.length;Ithis.limitUp&&(this.vector.y=this.limitUp);this.distancethis.maxDistance&&(this.distance=this.maxDistance);var a=this.distance*Math.cos(this.vector.y);this.position.set(Math.cos(this.vector.x)*a,this.distance*Math.sin(this.vector.y),Math.sin(this.vector.x)*a);this.position.add(this.center);a=new THREE.Matrix4;a.lookAt(this.position, this.center,OrbitControls.UP);this.quaternion.setFromRotationMatrix(a)}; OrbitControls.prototype.toJSON=function(a){a=THREE.Object3D.prototype.toJSON.call(this,a);a.object.distance=this.distance;a.object.maxDistance=this.maxDistance;a.object.minDistance=this.minDistance;a.object.sensitivity=this.sensitivity;a.object.limitUp=this.limitUp;a.object.limitDown=this.limitDown;a.object.needsButtonPressed=this.needsButtonPressed;a.object.zoomEnabled=this.zoomEnabled;a.object.movementEnabled=this.movementEnabled;a.object.smooth=this.smooth;a.object.friction=this.friction;a.object.speed= @@ -2645,7 +2667,7 @@ this.position.sub(b)}this.keyboard.keyPressed(this.moveKeys[1])&&(b=this.getWorl FirstPersonControls.prototype.getDirection=function(){var a=this.getWorldDirection(this.tempVector);a.normalize();return a};FirstPersonControls.prototype.toJSON=function(a){a=THREE.Object3D.prototype.toJSON.call(this,a);a.object.moveSpeed=this.moveSpeed;a.object.sensitivity=this.sensitivity;a.object.needsButtonPressed=this.needsButtonPressed;a.object.movementEnabled=this.movementEnabled;a.object.moveOnPlane=this.moveOnPlane;a.object.moveKeys=this.moveKeys;return a};'use strict'; function RendererConfiguration(){this.backend=RendererConfiguration.WEBGL;this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!1;this.stencil=this.shadows=this.antialiasing=!0;this.shadowsType=THREE.PCFSoftShadowMap;this.shadowsAutoUpdate=!0;this.toneMapping=THREE.NoToneMapping;this.toneMappingWhitePoint=this.toneMappingExposure=1;this.sortObjects=!0;this.gammaFactor=2;this.gammaOutput=this.gammaInput=!1;this.precision='highp';this.premultipliedAlpha=this.alpha=!0;this.preserveDrawingBuffer= !1;this.powerPreference='high-performance';this.physicallyCorrectLights=this.logarithmicDepthBuffer=!1}RendererConfiguration.WEBGL=1;RendererConfiguration.WEBGL2=2; -RendererConfiguration.prototype.createRenderer=function(a){var b=null;if(this.backend===RendererConfiguration.WEBGL2)try{b=a.getContext('webgl2')}catch(d){}a=new THREE.WebGLRenderer({canvas:a,context:b,precision:this.precision,alpha:this.alpha,premultipliedAlpha:this.premultipliedAlpha,antialias:this.antialiasing,stencil:this.stencil,preserveDrawingBuffer:this.preserveDrawingBuffer,powerPreference:this.powerPreference,logarithmicDepthBuffer:this.logarithmicDepthBuffer});a.autoClear=this.autoClear; +RendererConfiguration.prototype.createRenderer=function(a){var b=null;if(this.backend===RendererConfiguration.WEBGL2)try{b=a.getContext('webgl2')}catch(e){}a=new THREE.WebGLRenderer({canvas:a,context:b,precision:this.precision,alpha:this.alpha,premultipliedAlpha:this.premultipliedAlpha,antialias:this.antialiasing,stencil:this.stencil,preserveDrawingBuffer:this.preserveDrawingBuffer,powerPreference:this.powerPreference,logarithmicDepthBuffer:this.logarithmicDepthBuffer});a.autoClear=this.autoClear; a.autoClearColor=this.autoClearColor;a.autoClearDepth=this.autoClearDepth;a.autoClearStencil=this.autoClearStencil;a.shadowMap.enabled=this.shadows;a.shadowMap.type=this.shadowsType;a.shadowMap.autoUpdate=this.shadowsAutoUpdate;a.shadowMap.needsUpdate=!1;a.toneMapping=this.toneMapping;a.toneMappingExposure=this.toneMappingExposure;a.toneMappingWhitePoint=this.toneMappingWhitePoint;a.sortObjects=this.sortObjects;a.gammaFactor=this.gammaFactor;a.gammaInput=this.gammaInput;a.gammaOutput=this.gammaOutput; a.physicallyCorrectLights=this.physicallyCorrectLights;return a}; RendererConfiguration.prototype.toJSON=function(){return{backend:this.backend,autoClear:this.autoClear,autoClearColor:this.autoClearColor,autoClearDepth:this.autoClearDepth,autoClearStencil:this.autoClearStencil,antialiasing:this.antialiasing,shadows:this.shadows,stencil:this.stencil,shadowsType:this.shadowsType,shadowsAutoUpdate:this.shadowsAutoUpdate,toneMapping:this.toneMapping,toneMappingExposure:this.toneMappingExposure,toneMappingWhitePoint:this.toneMappingWhitePoint,sortObjects:this.sortObjects, @@ -2662,49 +2684,49 @@ Program.prototype.displayVR=function(){if(this.vr)try{this.vrDisplay.isPresentin Program.prototype.setScene=function(a){null!==this.scene&&this.scene.dispose();a instanceof Scene?this.scene=a:'string'===typeof a&&(this.scene=this.getObjectByName(a));null!==this.scene&&(null===this.scene.defaultCamera&&(this.scene.defaultCamera=this.defaultCamera),this.scene.initialize())}; Program.prototype.remove=function(a){if(a instanceof Scene){var b=this.children.indexOf(a);-1a?a:.05);for(var b=0;bb.order})};Scene.prototype.removeCamera=function(a){a=this.cameras.indexOf(a);-1>18,h=(l&258048)>>12,k=(l&4032)>>6,l&=63,b+=Base64Utils.encoding[g]+Base64Utils.encoding[h]+Base64Utils.encoding[k]+Base64Utils.encoding[l];1===d?(l=a[c],b+=Base64Utils.encoding[(l&252)>>2]+Base64Utils.encoding[(l&3)<<4]+'=='):2===d&&(l=a[c]<<8|a[c+1],b+=Base64Utils.encoding[(l&64512)>>10]+Base64Utils.encoding[(l&1008)>>4]+Base64Utils.encoding[(l& +Scene.prototype.toJSON=function(a){if(null==this.parent||'Program'!==this.parent.type)return console.warn('nunuStudio: Scene is not on top level serializing as Group.'),this.type='Group',THREE.Object3D.prototype.toJSON.call(this,a);var b=this.background,e=THREE.Object3D.prototype.toJSON.call(this,a,function(a,c){b instanceof THREE.Color?b=b.toJSON(a):b instanceof THREE.Texture&&(b=b.toJSON(a).uuid)});null!==b&&(e.object.background=b);if(null!==this.defaultCamera){var d=new THREE.Vector3,c=new THREE.Quaternion, +k=new THREE.Vector3;this.defaultCamera.matrixWorld.decompose(d,c,k);a=this.defaultCamera.toJSON(a);a.object.position=d.toArray();a.object.quaternion=c.toArray();a.object.scale=k.toArray();e.object.defaultCamera=a}null!==this.fog&&(e.object.fog=this.fog.toJSON());e.object.usePhysics=this.usePhysics;e.object.cameras=[];for(d=0;d>18,k=(l&258048)>>12,h=(l&4032)>>6,l&=63,b+=Base64Utils.encoding[c]+Base64Utils.encoding[k]+Base64Utils.encoding[h]+Base64Utils.encoding[l];1===e?(l=a[d],b+=Base64Utils.encoding[(l&252)>>2]+Base64Utils.encoding[(l&3)<<4]+'=='):2===e&&(l=a[d]<<8|a[d+1],b+=Base64Utils.encoding[(l&64512)>>10]+Base64Utils.encoding[(l&1008)>>4]+Base64Utils.encoding[(l& 15)<<2]+'=');return b}; -Base64Utils.fromBinaryString=function(a){for(var b='',d=a.length%3,c=a.length-d,g,h,k,l=0;l>2),b+=Base64Utils.encoding.charAt((g&3)<<4|(h&240)>>4),b+=Base64Utils.encoding.charAt((h&15)<<2|(k&192)>>6),b+=Base64Utils.encoding.charAt(k&63);1===d?(g=a.charCodeAt(l)&255,b+=Base64Utils.encoding.charAt(g>>2),b+=Base64Utils.encoding.charAt((g&3)<<4),b+='=='):2===d&&(g=a.charCodeAt(l)&255,h=a.charCodeAt(l+ -1),b+=Base64Utils.encoding.charAt(g>>2),b+=Base64Utils.encoding.charAt((g&3)<<4|(h&240)>>4),b+=Base64Utils.encoding.charAt((h&15)<<2),b+='=');return b};'use strict';function ArraybufferUtils(){}ArraybufferUtils.fromBinaryString=function(a){for(var b=a.length,d=new ArrayBuffer(b),c=new Uint8Array(d),g=0;g>4,64!==k&&(c[m+1]=(h&15)<<4|k>>2),64!==l&&(c[m+2]=(k&3)<<6|l);return d};ArraybufferUtils.fromBuffer=function(a){for(var b=new ArrayBuffer(a.length),d=new Uint8Array(b),c=0;c>2),b+=Base64Utils.encoding.charAt((c&3)<<4|(k&240)>>4),b+=Base64Utils.encoding.charAt((k&15)<<2|(h&192)>>6),b+=Base64Utils.encoding.charAt(h&63);1===e?(c=a.charCodeAt(l)&255,b+=Base64Utils.encoding.charAt(c>>2),b+=Base64Utils.encoding.charAt((c&3)<<4),b+='=='):2===e&&(c=a.charCodeAt(l)&255,k=a.charCodeAt(l+ +1),b+=Base64Utils.encoding.charAt(c>>2),b+=Base64Utils.encoding.charAt((c&3)<<4|(k&240)>>4),b+=Base64Utils.encoding.charAt((k&15)<<2),b+='=');return b};'use strict';function ArraybufferUtils(){}ArraybufferUtils.fromBinaryString=function(a){for(var b=a.length,e=new ArrayBuffer(b),d=new Uint8Array(e),c=0;c>4,64!==h&&(d[n+1]=(k&15)<<4|h>>2),64!==l&&(d[n+2]=(h&3)<<6|l);return e};ArraybufferUtils.fromBuffer=function(a){for(var b=new ArrayBuffer(a.length),e=new Uint8Array(b),d=0;db;b++)a+='0123456789ABCDEF'[Math.floor(16*Math.random())];return a};'use strict';function ObjectUtils(){} -ObjectUtils.getRoot=function(a){for(;null!==a.parent;)a=a.parent;return a};ObjectUtils.scaleAndCenterObject=function(a){var b=ObjectUtils.calculateBoundingBox(a);if(null!==b){var d=new THREE.Vector3;b.getSize(d);d=1/(d.x>d.y?d.x>d.z?d.x:d.z:d.y>d.z?d.y:d.z);var c=new THREE.Vector3;b.getCenter(c);c.multiplyScalar(d);a.scale.set(d,d,d);a.position.set(-c.x,-d*b.min.y,-c.z)}}; +ObjectUtils.getRoot=function(a){for(;null!==a.parent;)a=a.parent;return a};ObjectUtils.scaleAndCenterObject=function(a){var b=ObjectUtils.calculateBoundingBox(a);if(null!==b){var e=new THREE.Vector3;b.getSize(e);e=1/(e.x>e.y?e.x>e.z?e.x:e.z:e.y>e.z?e.y:e.z);var d=new THREE.Vector3;b.getCenter(d);d.multiplyScalar(e);a.scale.set(e,e,e);a.position.set(-d.x,-e*b.min.y,-d.z)}}; ObjectUtils.calculateBoundingBox=function(a){var b=null;a.traverse(function(a){void 0!==a.geometry&&(a.geometry.computeBoundingBox(),a=a.geometry.boundingBox,null===b?b=a.clone():(a.min.xb.max.x&&(b.max.x=a.max.x),a.min.yb.max.y&&(b.max.y=a.max.y),a.min.zb.max.z&&(b.max.z=a.max.z)))});return b}; -ObjectUtils.recalculateGeometryOrigin=function(a){a.traverse(function(a){if(void 0!==a.geometry){a.geometry.computeBoundingBox();var b=a.geometry.boundingBox.clone().getCenter(new THREE.Vector3);a.position.add(b);var c=new THREE.Matrix4;c.makeTranslation(-b.x,-b.y,-b.z);a.geometry.applyMatrix(c)}})};ObjectUtils.convertToBufferGeometry=function(a){a.traverse(function(a){void 0!==a.geometry&&!0===a.geometry.isGeometry&&(a.geometry=(new THREE.BufferGeometry).fromGeometry(a.geometry))})};'use strict'; +ObjectUtils.recalculateGeometryOrigin=function(a){a.traverse(function(a){if(void 0!==a.geometry){a.geometry.computeBoundingBox();var b=a.geometry.boundingBox.clone().getCenter(new THREE.Vector3);a.position.add(b);var d=new THREE.Matrix4;d.makeTranslation(-b.x,-b.y,-b.z);a.geometry.applyMatrix(d)}})};ObjectUtils.convertToBufferGeometry=function(a){a.traverse(function(a){void 0!==a.geometry&&!0===a.geometry.isGeometry&&(a.geometry=(new THREE.BufferGeometry).fromGeometry(a.geometry))})};'use strict'; function PhysicsGenerator(){}PhysicsGenerator.Type={BOX:'Box',CYLINDER:'Cylinder',SPHERE:'Sphere',HULL:'ConvexPolyhedron'}; PhysicsGenerator.createShape=function(a,b){if(void 0!==b)return b===PhysicsGenerator.Type.BOX?PhysicsGenerator.createBoundingBoxShape(a):b===PhysicsGenerator.Type.CYLINDER?PhysicsGenerator.createBoundingCylinderShape(a):b===PhysicsGenerator.Type.SPHERE?PhysicsGenerator.createBoundingSphereShape(a):b===PhysicsGenerator.Type.HULL?PhysicsGenerator.createConvexPolyhedron(a):null;b=PhysicsGenerator.getGeometry(a);if(!b)return null;switch(b.type){case 'BoxGeometry':case 'BoxBufferGeometry':return PhysicsGenerator.createBoxShape(b); case 'CylinderGeometry':case 'CylinderBufferGeometry':return PhysicsGenerator.createCylinderShape(b);case 'PlaneGeometry':case 'PlaneBufferGeometry':return PhysicsGenerator.createPlaneShape(b);case 'SphereGeometry':case 'SphereBufferGeometry':return PhysicsGenerator.createSphereShape(b);case 'TubeGeometry':return PhysicsGenerator.createTubeShape(b);case 'Geometry':case 'BufferGeometry':return PhysicsGenerator.createConvexPolyhedron(a);default:return PhysicsGenerator.createBoxShape(b)}}; PhysicsGenerator.createBoxShape=function(a){if(!PhysicsGenerator.getVertices(a).length)return null;a.computeBoundingBox();a=a.boundingBox;return new CANNON.Box(new CANNON.Vec3((a.max.x-a.min.x)/2,(a.max.y-a.min.y)/2,(a.max.z-a.min.z)/2))}; PhysicsGenerator.createBoundingBoxShape=function(a){var b=new Box3;b.setFromObject(a);if(!isFinite(b.min.lengthSq()))return null;b=new CANNON.Box(new CANNON.Vec3((b.max.x-b.min.x)/2,(b.max.y-b.min.y)/2,(b.max.z-b.min.z)/2));a.updateMatrixWorld();(new THREE.Vector3).setFromMatrixPosition(a.matrixWorld);return b}; -PhysicsGenerator.createConvexPolyhedron=function(a){var b=new THREE.QuickHull;b.setFromObject(a);a=[];for(var d=[],c=[],g=0;gKeyboard.F1&&a.keyCodeKeyboard.F1&&a.keyCodea;a++){var b=new Texture(new Image(Global.FILE_PATH+'lensflare/lensflare'+a+'.png'));b.name='lensflare'+a;Editor.defaultTextureLensFlare.push(b)}};Editor.updateSettings=function(){Editor.gui.tab.updateSettings()}; Editor.updateObjectsViewsGUI=function(){Editor.gui.tab.updateObjectsView();Editor.gui.tab.updateMetadata()};Editor.updateSelectionGUI=function(){Editor.gui.tab.updateMetadata();Editor.gui.tab.updateSelection()};Editor.resetEditor=function(){Editor.clearSelection();Editor.gui.tab.updateObjectsView();Editor.gui.tab.updateMetadata();Editor.gui.tab.updateSelection()}; Editor.createNewProgram=function(){var a=new Program;Editor.createDefaultResouces();Editor.setProgram(a);Editor.addDefaultScene(Editor.defaultMaterial);Editor.setOpenFile(null)}; -Editor.addDefaultScene=function(a){void 0===a&&(a=new THREE.MeshStandardMaterial({roughness:.6,metalness:.2}),a.name='default');var b=new Scene,d=new Sky;d.autoUpdate=!1;b.add(d);d=new Mesh(new THREE.BoxBufferGeometry(1,1,1),a);d.name='box';b.add(d);d=new Mesh(new THREE.BoxBufferGeometry(20,1,20),a);d.position.set(0,-1,0);d.name='ground';b.add(d);Editor.addObject(b,Editor.program);Editor.gui.tab.addTab(SceneEditor,!0).attach(b)}; -Editor.saveProgram=function(a,b,d,c){try{void 0===a&&null!==Editor.openFile&&(a=Editor.openFile);if(!0===b){a=a.replace('.isp','.nsp');var g=(new dcodeIO.PSON.StaticPair).toArrayBuffer(Editor.program.toJSON());FileSystem.writeFileArrayBuffer(a,g)}else{a=a.replace('.nsp','.isp');var h=JSON.stringify(Editor.program.toJSON(),null,'\t');FileSystem.writeFile(a,h)}!0!==d&&Editor.openFile!==a&&Editor.setOpenFile(a);!0!==c&&Editor.alert(Locale.projectSaved)}catch(k){Editor.alert(Locale.errorSavingFile+'\n('+ -k+')'),console.error('nunuStudio: Error saving file',k)}};Editor.setProgram=function(a){Editor.program!==a&&(null!==Editor.program&&Editor.program.dispose(),Editor.program=a,Editor.gui.tree.attach(Editor.program),Editor.gui.assetExplorer.attach(Editor.program),Editor.history=new History(Editor.settings.general.historySize),Editor.gui.tab.clear(),Editor.resetEditor(),0parseInt(Editor.TIMESTAMP)?(FileSystem.writeFile('nunu.min.js',b),Editor.alert(Locale.updatedRestart)):a||Editor.alert(Locale.alreadyUpdated)})}catch(b){a||Editor.alert(Locale.updateFailed)}}; +Editor.addDefaultScene=function(a){void 0===a&&(a=new THREE.MeshStandardMaterial({roughness:.6,metalness:.2}),a.name='default');var b=new Scene,e=new Sky;e.autoUpdate=!1;b.add(e);e=new Mesh(new THREE.BoxBufferGeometry(1,1,1),a);e.name='box';b.add(e);e=new Mesh(new THREE.BoxBufferGeometry(20,1,20),a);e.position.set(0,-1,0);e.name='ground';b.add(e);Editor.addObject(b,Editor.program);Editor.gui.tab.addTab(SceneEditor,!0).attach(b)}; +Editor.saveProgram=function(a,b,e,d){try{void 0===a&&null!==Editor.openFile&&(a=Editor.openFile);if(!0===b){a=a.replace('.isp','.nsp');var c=(new dcodeIO.PSON.StaticPair).toArrayBuffer(Editor.program.toJSON());FileSystem.writeFileArrayBuffer(a,c)}else{a=a.replace('.nsp','.isp');var k=JSON.stringify(Editor.program.toJSON(),null,'\t');FileSystem.writeFile(a,k)}!0!==e&&Editor.openFile!==a&&Editor.setOpenFile(a);!0!==d&&Editor.alert(Locale.projectSaved)}catch(h){Editor.alert(Locale.errorSavingFile+'\n('+ +h+')'),console.error('nunuStudio: Error saving file',h)}};Editor.setProgram=function(a){Editor.program!==a&&(null!==Editor.program&&Editor.program.dispose(),Editor.program=a,Editor.gui.tree.attach(Editor.program),Editor.gui.assetExplorer.attach(Editor.program),Editor.history=new History(Editor.settings.general.historySize),Editor.gui.tab.clear(),Editor.resetEditor(),0parseInt(Editor.TIMESTAMP)?(FileSystem.writeFile('nunu.min.js',b),Editor.alert(Locale.updatedRestart)):a||Editor.alert(Locale.alreadyUpdated)})}catch(b){a||Editor.alert(Locale.updateFailed)}}; Editor.exit=function(){if(Nunu.runningOnDesktop()){Editor.settings.store();var a=require('nw.gui'),b=a.Window.get();a.App.closeAllWindows();b.close(!0);a.App.quit()}};'use strict';var Global={NWJS_PATH:'../nwjs/',FILE_PATH:'./source/files/',RUNTIME_PATH:'./source/runtime/',BUILD_PATH:'./build/nunu.min.js'}; -(function(a,b){'object'===typeof exports&&'undefined'!==typeof module?module.exports=b():'function'===typeof define&&define.amd?define(b):a.CodeMirror=b()})(this,function(){function a(a){return new RegExp('(^|\\s)'+a+'(?:$|\\s)\\s*')}function b(a){for(var b=a.childNodes.length;0g||g>=b)return e+(b-d); -e+=g-d;e+=c-e%c;d=g+1}}function n(a,b){for(var c=0;c=b)return d+Math.min(h,b-e);e+=g-d;e+=c-e%c;d=g+1;if(e>=b)return d}}function t(a){for(;Oi.length<=a;)Oi.push(D(Oi)+' ');return Oi[a]}function D(a){return a[a.length-1]}function w(a,b){for(var c=[],d=0;dc?0c?-1:1;;){if(b==c)return b;var e=(b+c)/2;e=0>d?Math.ceil(e):Math.floor(e);if(e==b)return a(e)?b:c;a(e)?c=e:b=e+d}}function Q(a,b,d){this.input=d;this.scrollbarFiller=c('div',null,'CodeMirror-scrollbar-filler');this.scrollbarFiller.setAttribute('cm-not-content','true');this.gutterFiller=c('div',null,'CodeMirror-gutter-filler');this.gutterFiller.setAttribute('cm-not-content','true');this.lineDiv=g('div',null,'CodeMirror-code');this.selectionDiv=c('div',null,null,'position: relative; z-index: 1'); -this.cursorDiv=c('div',null,'CodeMirror-cursors');this.measure=c('div',null,'CodeMirror-measure');this.lineMeasure=c('div',null,'CodeMirror-measure');this.lineSpace=g('div',[this.measure,this.lineMeasure,this.selectionDiv,this.cursorDiv,this.lineDiv],null,'position: relative; outline: none');var e=g('div',[this.lineSpace],'CodeMirror-lines');this.mover=c('div',[e],null,'position: relative');this.sizer=c('div',[this.mover],'CodeMirror-sizer');this.sizerWidth=null;this.heightForcer=c('div',null,null, -'position: absolute; height: 30px; width: 1px;');this.gutters=c('div',null,'CodeMirror-gutters');this.lineGutter=null;this.scroller=c('div',[this.sizer,this.heightForcer,this.gutters],'CodeMirror-scroll');this.scroller.setAttribute('tabIndex','-1');this.wrapper=c('div',[this.scrollbarFiller,this.gutterFiller,this.scroller],'CodeMirror');od&&8>lb&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight=0);Kc||ah&&Hb||(this.scroller.draggable=!0);a&&(a.appendChild?a.appendChild(this.wrapper): +(function(a,b){'object'===typeof exports&&'undefined'!==typeof module?module.exports=b():'function'===typeof define&&define.amd?define(b):a.CodeMirror=b()})(this,function(){function a(a){return new RegExp('(^|\\s)'+a+'(?:$|\\s)\\s*')}function b(a){for(var b=a.childNodes.length;0g||g>=b)return e+(b-d); +e+=g-d;e+=c-e%c;d=g+1}}function p(a,b){for(var c=0;c=b)return d+Math.min(h,b-e);e+=g-d;e+=c-e%c;d=g+1;if(e>=b)return d}}function u(a){for(;Wi.length<=a;)Wi.push(E(Wi)+' ');return Wi[a]}function E(a){return a[a.length-1]}function v(a,b){for(var c=[],d=0;dc?0c?-1:1;;){if(b==c)return b;var e=(b+c)/2;e=0>d?Math.ceil(e):Math.floor(e);if(e==b)return a(e)?b:c;a(e)?c=e:b=e+d}}function M(a,b,e){this.input=e;this.scrollbarFiller=d('div',null,'CodeMirror-scrollbar-filler');this.scrollbarFiller.setAttribute('cm-not-content','true');this.gutterFiller=d('div',null,'CodeMirror-gutter-filler');this.gutterFiller.setAttribute('cm-not-content','true');this.lineDiv=c('div',null,'CodeMirror-code');this.selectionDiv=d('div',null,null,'position: relative; z-index: 1'); +this.cursorDiv=d('div',null,'CodeMirror-cursors');this.measure=d('div',null,'CodeMirror-measure');this.lineMeasure=d('div',null,'CodeMirror-measure');this.lineSpace=c('div',[this.measure,this.lineMeasure,this.selectionDiv,this.cursorDiv,this.lineDiv],null,'position: relative; outline: none');var g=c('div',[this.lineSpace],'CodeMirror-lines');this.mover=d('div',[g],null,'position: relative');this.sizer=d('div',[this.mover],'CodeMirror-sizer');this.sizerWidth=null;this.heightForcer=d('div',null,null, +'position: absolute; height: 30px; width: 1px;');this.gutters=d('div',null,'CodeMirror-gutters');this.lineGutter=null;this.scroller=d('div',[this.sizer,this.heightForcer,this.gutters],'CodeMirror-scroll');this.scroller.setAttribute('tabIndex','-1');this.wrapper=d('div',[this.scrollbarFiller,this.gutterFiller,this.scroller],'CodeMirror');gd&&8>Rb&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight=0);cd||Jg&&ki||(this.scroller.draggable=!0);a&&(a.appendChild?a.appendChild(this.wrapper): a(this.wrapper));this.reportedViewFrom=this.reportedViewTo=this.viewFrom=this.viewTo=b.first;this.view=[];this.externalMeasured=this.renderedView=null;this.lastWrapHeight=this.lastWrapWidth=this.viewOffset=0;this.updateLineNumbers=null;this.nativeBarWidth=this.barHeight=this.barWidth=0;this.scrollbarsClipped=!1;this.lineNumWidth=this.lineNumInnerWidth=this.lineNumChars=null;this.alignWidgets=!1;this.maxLine=this.cachedCharWidth=this.cachedTextHeight=this.cachedPaddingH=null;this.maxLineLength=0;this.maxLineChanged= -!1;this.wheelDX=this.wheelDY=this.wheelStartX=this.wheelStartY=null;this.shift=!1;this.activeTouch=this.selForContextMenu=null;d.init(this)}function T(a,b){b-=a.first;if(0>b||b>=a.size)throw Error('There is no line '+(b+a.first)+' in the document.');for(;!a.lines;)for(var c=0;;++c){var d=a.children[c],e=d.chunkSize();if(b=a.first&&bL(a,b)? -b:a}function qa(a,b){return 0>L(a,b)?a:b}function oa(a,b){if(b.linec)return ba(c,T(a,c).text.length);a=T(a,b.line).text.length;c=b.ch;b=null==c||c>a?ba(b.line,a):0>c?ba(b.line,0):b;return b}function O(a,b){for(var c=[],d=0;d=a:l.to>a);(h||(h=[])).push(new ua(m,l.from,n?null:l.to))}}c=h;var p;if(d)for(h=0;h=e:k.to>e)||k.from==e&&'bookmark'==l.type&&(!g||k.marker.insertLeft))m=null==k.from||(l.inclusiveLeft?k.from<=e:k.fromL(h.to,e.from)||0l||!c.inclusiveLeft&&!l)&&k.push({from:h.from,to:e.from});(0Ea(e,c.marker)))var e= -c.marker;return e}function xa(a,b,c,d,e){a=T(a,b);if(a=W&&a.markedSpans)for(b=0;b=l||0>=k&&0<=l)&&(0>=k&&(g.marker.inclusiveRight&&e.inclusiveLeft?0<=L(h.to,c):0=L(h.from,d):0>L(h.from,d))))return!0}}}function Da(a){for(var b;b= -la(a,!0);)a=b.find(-1,!0).line;return a}function Ka(a,b){a=T(a,b);var c=Da(a);return a==c?b:N(c)}function mb(a,b){if(b>a.lastLine())return b;var c=T(a,b);if(!Sa(a,c))return b;for(;a=la(c,!1);)c=a.find(1,!0).line;return N(c)+1}function Sa(a,b){var c=W&&b.markedSpans;if(c)for(var d,e=0;eb.maxLineLength&&(b.maxLineLength=c,b.maxLine=a)})}function Ya(a,b,c,d){if(!a)return d(b,c,'ltr',0);for(var e= -!1,g=0;gb||b==c&&h.to==b)d(Math.max(h.from,b),Math.min(h.to,c),1==h.level?'rtl':'ltr',g),e=!0}e||d(b,c,'ltr')}function qb(a,b,c){var d;Ba=null;for(var e=0;eb)return e;g.to==b&&(g.from!=g.to&&'before'==c?d=e:Ba=e);g.from==b&&(g.from!=g.to&&'before'!=c?d=e:Ba=e)}return null!=d?d:Ba}function Gb(a,b){var c=a.order;null==c&&(c=a.order=sb(a.text,b));return c}function Qb(a,b,c){if(a.removeEventListener)a.removeEventListener(b, -c,!1);else if(a.detachEvent)a.detachEvent('on'+b,c);else{var d=(a=a._handlers)&&a[b];d&&(c=n(d,c),-1=b.offsetWidth&&2lb))}a=kc?c('span','\u200b'):c('span','\u00a0',null,'display: inline-block; width: 1px; margin-right: -1px');a.setAttribute('cm-text','');return a}function wb(a, -b){2a&&e.splice(l,1,a,e[l+1],d);l+=2;m=Math.min(a,d)}if(b)if(k.opaque)e.splice(c,l-c,a,'overlay '+b),l=c+2;else for(;ca.options.maxHighlightLength&&zc(a.doc.mode,d.state),g=df(a,b,d);e&&(d.state=e);b.stateAfter= -d.save(!e);b.styles=g.styles;g.classes?b.styleClasses=g.classes:b.styleClasses&&(b.styleClasses=null);c===a.doc.highlightFrontier&&(a.doc.modeFrontier=Math.max(a.doc.modeFrontier,++a.doc.highlightFrontier))}return b.styles}function ne(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return new Xe(d,!0,b);var g=Db(a,b,c),h=g>d.first&&T(d,g-1).stateAfter,k=h?Xe.fromSaved(d,h,g):new Xe(d,Qe(d.mode),g);d.iter(g,b,function(c){Qd(a,c.text,k);var d=k.line;c.stateAfter=d==b-1||0==d%5||d>=e.viewFrom&& -de;e++){d&&(d[0]=me(a,c).mode);var g=a.token(b,c);if(b.pos>b.start)return g}throw Error('Mode '+a.name+' failed to advance stream.'); -}function gc(a,b,c,d){var e=a.doc,g=e.mode;b=oa(e,b);var h=T(e,b.line);c=ne(a,b.line,c);a=new dd(h.text,a.options.tabSize,c);var k;for(d&&(k=[]);(d||a.posa.options.maxHighlightLength){k=!1;h&&Qd(a,b,d,n.pos);n.pos=b.length;var q=null}else q=mc(Qc(c,n,d.state,p),g);if(p){var r=p[0].name;r&&(q='m-'+(q?r+' '+q:r))}if(!k||m!=q){for(;lk;--b){if(b<=h.first)return h.first;var l=T(h,b-1),m=l.stateAfter;if(m&&(!c||b+(m instanceof Sg?m.lookAhead:0)<=h.modeFrontier))return b;l=e(l.text,null,a.options.tabSize);if(null==g||d>l)g=b-1,d=l}return g}function Fc(a,b){a.modeFrontier=Math.min(a.modeFrontier,b);if(!(a.highlightFrontierc;d--){var e=T(a,d).stateAfter;if(e&&(!(e instanceof -Sg)||d+e.lookAheadp.right-q.right:!1}n&&(l=Gb(k,a.doc.direction))&&(e.addToken=Ac(e.addToken,l));e.map=[];var r=c!=a.display.externalMeasured&&N(k);a:{var Na=p=q=n=void 0,t=void 0,C=void 0,u=void 0;l=e;r=Uc(a,k,r);var H=k.markedSpans,w=k.text,U=0;if(H)for(var v=w.length,Vc=0,D=1,z='',xa=0;;){if(xa== -Vc){t=Na=p=q=C='';n=null;xa=Infinity;for(var la=[],I=void 0,G=0;GVc||K.collapsed&&P.to==Vc&&P.from==Vc)?(null!=P.to&&P.to!=Vc&&xa>P.to&&(xa=P.to,Na=''),K.className&&(t+=' '+K.className),K.css&&(C=(C?C+';':'')+K.css),K.startStyle&&P.from==Vc&&(p+=' '+K.startStyle),K.endStyle&&P.to==xa&&(I||(I=[])).push(K.endStyle,P.to),K.title&&!q&&(q=K.title),K.collapsed&&(!n||0>Ea(n.marker,K))&& -(n=P)):P.from>Vc&&xa>P.from&&(xa=P.from)}if(I)for(G=0;G=v)break;for(la=Math.min(v,xa);;){if(z){I=Vc+z.length;n||(G=I>la?z.slice(0,la-Vc):z,l.addToken(l,G,u?u+t:t,p,Vc+G.length==xa?Na:'',q,C));if(I>=la){z=z.slice(la-Vc);Vc=la;break}Vc=I;p=''}z=w.slice(U,U=r[D++]);u=Ma(r[D++],l.cm.options)}}else for(n= -1;nlb?l.appendChild(c('span',[C])):l.appendChild(C);a.map.push(a.pos,a.pos+Na,C);a.col+=Na;a.pos+=Na}if(!r)break;q+=Na+1;'\t'==r[0]?(r=a.cm.options.tabSize,r-=a.col% -r,Na=l.appendChild(c('span',t(r),'cm-tab')),Na.setAttribute('role','presentation'),Na.setAttribute('cm-text','\t'),a.col+=r):('\r'==r[0]||'\n'==r[0]?(Na=l.appendChild(c('span','\r'==r[0]?'\u240d':'\u2424','cm-invalidchar')),Na.setAttribute('cm-text',r[0])):(Na=a.cm.options.specialCharPlaceholder(r[0]),Na.setAttribute('cm-text',r[0]),od&&9>lb?l.appendChild(c('span',[Na])):l.appendChild(Na)),a.col+=1);a.map.push(a.pos,a.pos+1,Na);a.pos++}}else a.col+=b.length,l=document.createTextNode(m),a.map.push(a.pos, -a.pos+b.length,l),od&&9>lb&&(p=!0),a.pos+=b.length;a.trailingSpace=32==m.charCodeAt(b.length-1);if(d||e||g||p||k)return b=d||'',e&&(b+=e),g&&(b+=g),e=c('span',[l],b,k),h&&(e.title=h),a.content.appendChild(e);a.content.appendChild(l)}}function Ac(a,b){return function(c,d,e,g,h,k,l){e=e?e+' cm-force-border':'cm-force-border';for(var m=c.pos,n=m+d.length;;){for(var p=void 0,q=0;qm&&p.from<=m);q++);if(p.to>=n)return a(c,d,e,g,h,k,l);a(c,d.slice(0,p.to-m),e,g,null,k,l);g=null; -d=d.slice(p.to-m);m=p.to}}}function ta(a,b,c,d){var e=!d&&c.widgetNode;e&&a.map.push(a.pos,a.pos+b,e);!d&&a.cm.display.input.needsContentAttribute&&(e||(e=a.content.appendChild(document.createElement('span'))),e.setAttribute('cm-marker',c.id));e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e));a.pos+=b;a.trailingSpace=!1}function Pb(a,b,c){for(var d=this.line=b,e;d=la(d,!1);)d=d.find(1,!0).line,(e||(e=[])).push(d);this.size=(this.rest=e)?N(D(this.rest))-c+1:1;this.node=this.text=null; -this.hidden=Sa(a,b)}function La(a,b,c){var d=[],e;for(e=b;elb&&(a.node.style.zIndex=2));return a.node}function Kd(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=null,b.measure=c.measure,c.built):Ob(a,b)}function Nd(a,b){var d=b.bgClass?b.bgClass+' '+(b.line.bgClass||''):b.line.bgClass;d&&(d+=' CodeMirror-linebackground');if(b.background)d?b.background.className=d:(b.background.parentNode.removeChild(b.background),b.background=null);else if(d){var e= -Nf(b);b.background=e.insertBefore(c('div',null,d),e.firstChild);a.display.input.setUneditable(b.background)}b.line.wrapClass?Nf(b).className=b.line.wrapClass:b.node!=b.text&&(b.node.className='');b.text.className=(b.textClass?b.textClass+' '+(b.line.textClass||''):b.line.textClass)||''}function Rd(a,b,d,e){b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null);b.gutterBackground&&(b.node.removeChild(b.gutterBackground),b.gutterBackground=null);if(b.line.gutterClass){var g=Nf(b);b.gutterBackground= -c('div',null,'CodeMirror-gutter-background '+b.line.gutterClass,'left: '+(a.options.fixedGutter?e.fixedPos:-e.gutterTotalWidth)+'px; width: '+e.gutterTotalWidth+'px');a.display.input.setUneditable(b.gutterBackground);g.insertBefore(b.gutterBackground,b.text)}g=b.line.gutterMarkers;if(a.options.lineNumbers||g){var h=Nf(b),k=b.gutter=c('div',null,'CodeMirror-gutter-wrapper','left: '+(a.options.fixedGutter?e.fixedPos:-e.gutterTotalWidth)+'px');a.display.input.setUneditable(k);h.insertBefore(k,b.text); -b.line.gutterClass&&(k.className+=' '+b.line.gutterClass);!a.options.lineNumbers||g&&g['CodeMirror-linenumbers']||(b.lineNumber=k.appendChild(c('div',ca(a.options,d),'CodeMirror-linenumber CodeMirror-gutter-elt','left: '+e.gutterLeft['CodeMirror-linenumbers']+'px; width: '+a.display.lineNumInnerWidth+'px')));if(g)for(b=0;bc)return{map:a.measure.maps[b],cache:a.measure.caches[b],before:!0}}function Ja(a,b){if(b>=a.display.viewFrom&&b=a.lineN&&bt;t++){for(;m&&H(b.line.text.charAt(l.coverStart+m));)--m;for(;l.coverStart+nlb&&0==m&&n==l.coverEnd-l.coverStart)var Na=g.parentNode.getBoundingClientRect();else{Na=hc(g,m,n).getClientRects();n=xj;if('left'==q)for(p=0;plb&&((t=!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI)||(null!=Pd?t=Pd:(q=d(a.display.measure,c('span','x')),t= -q.getBoundingClientRect(),q=hc(q,0,1).getBoundingClientRect(),t=Pd=1lb)||m||Na&&(Na.left||Na.right)||(Na=(Na=g.parentNode.getClientRects()[0])?{left:Na.left,right:Na.left+Ee(a.display), -top:Na.top,bottom:Na.bottom}:xj);g=Na.top-b.rect.top;m=Na.bottom-b.rect.top;t=(g+m)/2;q=b.view.measure.heights;for(l=0;lb)g=l-k,e=g-1,b>=l&&(h='right');if(null!=e){d=a[m+2];k==l&&c==(d.insertLeft?'left':'right')&&(h=c);if('left'==c&&0==e)for(;m&&a[m-2]==a[m-3]&&a[m-1].insertLeft;)d=a[(m-=3)+2],h='left';if('right'==c&&e==l-k)for(;m=d.text.length?(m=d.text.length,b='before'):0>=m&&(m=0,b='after');if(!l)return h('before'==b?m-1:m,'before'==b);var n=qb(l,m,b),p=Ba;n=k(m,n,'before'==b);null!= -p&&(n.other=k(m,p,'before'!=b));return n}function Ig(a,b){var c=0;b=oa(a.doc,b);a.options.lineWrapping||(c=Ee(a.display)*b.ch);b=T(a.doc,b.line);a=nb(b)+a.display.lineSpace.offsetTop;return{left:c,right:c,top:a,bottom:a+b.height}}function uf(a,b,c,d,e){a=ba(a,b,c);a.xRel=e;d&&(a.outside=!0);return a}function bg(a,b,c){var d=a.doc;c+=a.display.viewOffset;if(0>c)return uf(d.first,0,null,!0,-1);var e=ma(d,c),g=d.first+d.size-1;if(e>g)return uf(d.first+d.size-1,T(d,g).text.length,null,!0,1);0>b&&(b=0); -for(var h=T(d,e);;){g=cg(a,h,e,b,c);var k=void 0;var l=g.ch+(0l)&&(!k||0>Ea(k,n.marker))&&(k=n.marker)}if(!k)return g;g=k.find(1);if(g.line==e)return g;h=T(d,e=g.line)}}function Me(a,b,c,d){d-=Rc(b);b=b.text.length;var e=P(function(b){return rc(a,c,b-1).bottom<=d},b,0);b=P(function(b){return rc(a,c,b).top>d},e,b);return{begin:e,end:b}}function Ug(a,b,c,d){c||(c= -rb(a,b));d=Zd(a,b,rc(a,c,d),'line').top;return Me(a,b,c,d)}function $d(a,b,c,d){return a.bottom<=c?!1:a.top>c?!0:(d?a.left:a.right)>b}function cg(a,b,c,d,e){e-=nb(b);var g=rb(a,b),h=Rc(b),k=0,l=b.text.length,m=!0,n=Gb(b,a.doc.direction);n&&(n=(a.options.lineWrapping?Vg:ff)(a,b,c,g,n,d,e),k=(m=1!=n.level)?n.from:n.to-1,l=m?n.to:n.from-1);var p=null,q=null;n=P(function(b){var c=rc(a,g,b);c.top+=h;c.bottom+=h;if(!$d(c,d,e,!1))return!1;c.top<=e&&c.left<=d&&(p=b,q=c);return!0},k,l);var r=!1;q?(k=d-q.left< -q.right-d,m=k==m,n=p+(m?0:1),m=m?'after':'before',k=k?q.left:q.right):(m||n!=l&&n!=k||n++,m=0==n?'after':n==b.text.length?'before':rc(a,g,n-(m?1:0)).bottom+h<=e==m?'after':'before',r=oe(a,ba(c,n,m),'line',b,g),k=r.left,r=e=r.bottom);n=C(b.text,n,1);return uf(c,n,m,r,d-k)}function ff(a,b,c,d,e,g,h){var k=P(function(k){k=e[k];var l=1!=k.level;return $d(oe(a,ba(c,l?k.to:k.from,l?'before':'after'),'line',b,d),g,h,!0)},0,e.length-1),l=e[k];if(0h&&(l=e[k-1])}return l}function Vg(a,b,c,d,e,g,h){h=Me(a,b,d,h);c=h.begin;h=h.end;/\s/.test(b.text.charAt(h-1))&&h--;for(var k=b=null,l=0;l=h||m.to<=c)){var n=rc(a,d,1!=m.level?Math.min(h,m.to)-1:Math.max(c,m.from)).right;n=nn)b=m,k=n}}b||(b=e[e.length-1]);b.fromh&&(b={from:b.from,to:h,level:b.level});return b}function kg(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight; -if(null==oi){oi=c('pre');for(var e=0;49>e;++e)oi.appendChild(document.createTextNode('x')),oi.appendChild(c('br'));oi.appendChild(document.createTextNode('x'))}d(a.measure,oi);e=oi.offsetHeight/50;3=a.display.viewTo)return null;b-=a.display.viewFrom;if(0>b)return null;a=a.display.view;for(var c=0;cb)return c}function of(a){a.display.input.showSelection(a.display.input.prepareSelection())}function dg(a,b){void 0=== -b&&(b=!0);for(var c=a.doc,d={},e=d.cursors=document.createDocumentFragment(),g=d.selection=document.createDocumentFragment(),h=0;h=a.display.viewTo||k.to().lineb&&(b=0);b=Math.round(b);e=Math.round(e);l.appendChild(c('div',null, -'CodeMirror-selected','position: absolute; left: '+a+'px;\n top: '+b+'px; width: '+(null==d?p-a:d)+'px;\n height: '+(e-b)+'px'))}function g(b,c,d){function g(c,d){return Hg(a,ba(b,c),'div',l,d)}function h(b,c,d){b=Ug(a,l,null,b);c='ltr'==c==('after'==d)?'left':'right';d='after'==d?b.begin:b.end-(/\s/.test(l.text.charAt(b.end-1))?2:1);return g(d,c)[c]}var l=T(k,b),m=l.text.length,r,t,Na=Gb(l,k.direction);Ya(Na,c||0,null==d?m:d,function(a,b,k, -l){var C='ltr'==k,u=g(a,C?'left':'right'),H=g(b-1,C?'right':'left'),w=null==c&&0==a,U=null==d&&b==m,v=0==l;l=!Na||l==Na.length-1;3>=H.top-u.top?(b=(q?w:U)&&v?n:(C?u:H).left,e(b,u.top,((q?U:w)&&l?p:(C?H:u).right)-b,u.bottom)):(C?(C=q&&w&&v?n:u.left,w=q?p:h(a,k,'before'),a=q?n:h(b,k,'after'),U=q&&U&&l?p:H.right):(C=q?h(a,k,'before'):n,w=!q&&w&&v?p:u.right,a=!q&&U&&l?n:H.left,U=q?h(b,k,'after'):p),e(C,u.top,w-C,u.bottom),u.bottomwc(u, -r))r=u;0>wc(H,r)&&(r=H);if(!t||0>wc(u,t))t=u;0>wc(H,t)&&(t=H)});return{start:r,end:t}}var h=a.display,k=a.doc,l=document.createDocumentFragment(),m=Z(a.display),n=m.left,p=Math.max(h.sizerWidth,Nb(a)-h.sizer.offsetLeft)-m.right,q='ltr'==k.direction;h=b.from();b=b.to();if(h.line==b.line)g(h.line,h.ch,b.ch);else{var r=T(k,h.line);m=T(k,b.line);m=Da(r)==Da(m);h=g(h.line,h.ch,m?r.text.length+1:null).end;b=g(b.line,m?0:null,b.ch).start;m&&(h.topa.options.cursorBlinkRate&&(b.cursorDiv.style.visibility='hidden')}}function ug(a){a.state.focused||(a.display.input.focus(),vg(a))} -function Ng(a){a.state.delayingBlurEvent=!0;setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,Ne(a))},100)}function vg(a,b){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1);'nocursor'!=a.options.readOnly&&(a.state.focused||(xb(a,'focus',a,b),a.state.focused=!0,l(a.display.wrapper,'CodeMirror-focused'),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),Kc&&setTimeout(function(){return a.display.input.reset(!0)},20)),a.display.input.receivedFocus()), -vf(a))}function Ne(a,b){a.state.delayingBlurEvent||(a.state.focused&&(xb(a,'blur',a,b),a.state.focused=!1,Hd(a.display.wrapper,'CodeMirror-focused')),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150))}function ob(a){a=a.display;for(var b=a.lineDiv.offsetTop,c=0;clb){var e=d.node.offsetTop+d.node.offsetHeight;var g=e-b;b=e}else g=d.node.getBoundingClientRect(),g=g.bottom-g.top;e=d.line.height- -g;2>g&&(g=kg(a));if(.005e)if(ia(d.line,g),Yf(d.line),d.rest)for(g=0;g=e&&(d=ma(b,nb(T(b,c))-a.wrapper.clientHeight),e=c)}return{from:d,to:Math.max(e,d+1)}}function fd(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=Xf(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,g=d+'px',h=0;hb.top&&(b.top=0);var e=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:c.scroller.scrollTop,g=cb(a),h={};b.bottom-b.top>g&&(b.bottom=b.top+g);var k=a.doc.height+Yd(c),l=b.topk-d;b.tope+g&&(g=Math.min(b.top,(d?k:b.bottom)-g),g!=e&&(h.scrollTop=g)); -e=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:c.scroller.scrollLeft;a=Nb(a)-(a.options.fixedGutter?c.gutters.offsetWidth:0);if(c=b.right-b.left>a)b.right=b.left+a;10>b.left?h.scrollLeft=0:b.lefta+e-3&&(h.scrollLeft=b.right+(c?0:10)-a);return h}function wg(a,b){null!=b&&(ve(a),a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+b)}function Ag(a){ve(a);var b=a.getCursor();a.curOp.scrollToPos={from:b,to:b,margin:a.options.cursorScrollMargin}} -function xf(a,b,c){null==b&&null==c||ve(a);null!=b&&(a.curOp.scrollLeft=b);null!=c&&(a.curOp.scrollTop=c)}function ve(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=Ig(a,b.from),d=Ig(a,b.to);ge(a,c,d,b.margin)}}function ge(a,b,c,d){b=wf(a,{left:Math.min(b.left,c.left),top:Math.min(b.top,c.top)-d,right:Math.max(b.right,c.right),bottom:Math.max(b.bottom,c.bottom)+d});xf(a,b.scrollLeft,b.scrollTop)}function cd(a,b){2>Math.abs(a.doc.scrollTop-b)||(ah||fg(a,{top:b}),pe(a,b,!0),ah&&fg(a), -gf(a,100))}function pe(a,b,c){b=Math.min(a.display.scroller.scrollHeight-a.display.scroller.clientHeight,b);if(a.display.scroller.scrollTop!=b||c)a.doc.scrollTop=b,a.display.scrollbars.setScrollTop(b),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b)}function Oe(a,b,c,d){b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth);(c?b==a.doc.scrollLeft:2>Math.abs(a.doc.scrollLeft-b))&&!d||(a.doc.scrollLeft=b,fd(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft= -b),a.display.scrollbars.setScrollLeft(b))}function we(a){var b=a.display,c=b.gutters.offsetWidth,d=Math.round(a.doc.height+Yd(a.display));return{clientHeight:b.scroller.clientHeight,viewHeight:b.wrapper.clientHeight,scrollWidth:b.scroller.scrollWidth,clientWidth:b.scroller.clientWidth,viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?c:0,docHeight:d,scrollHeight:d+Za(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:c}}function Bg(a,b){b||(b=we(a));var c=a.display.barWidth,d= -a.display.barHeight;pf(a,b);for(b=0;4>b&&c!=a.display.barWidth||d!=a.display.barHeight;b++)c!=a.display.barWidth&&a.options.lineWrapping&&ob(a),pf(a,we(a)),c=a.display.barWidth,d=a.display.barHeight}function pf(a,b){var c=a.display,d=c.scrollbars.update(b);c.sizer.style.paddingRight=(c.barWidth=d.right)+'px';c.sizer.style.paddingBottom=(c.barHeight=d.bottom)+'px';c.heightForcer.style.borderBottom=d.bottom+'px solid transparent';d.right&&d.bottom?(c.scrollbarFiller.style.display='block',c.scrollbarFiller.style.height= -d.bottom+'px',c.scrollbarFiller.style.width=d.right+'px'):c.scrollbarFiller.style.display='';d.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display='block',c.gutterFiller.style.height=d.bottom+'px',c.gutterFiller.style.width=b.gutterWidth+'px'):c.gutterFiller.style.display=''}function Se(a){a.display.scrollbars&&(a.display.scrollbars.clear(),a.display.scrollbars.addClass&&Hd(a.display.wrapper,a.display.scrollbars.addClass));a.display.scrollbars=new B[a.options.scrollbarStyle](function(b){a.display.wrapper.insertBefore(b, -a.display.scrollbarFiller);Ca(b,'mousedown',function(){a.state.focused&&setTimeout(function(){return a.display.input.focus()},0)});b.setAttribute('cm-not-content','true')},function(b,c){'horizontal'==c?Oe(a,b):cd(a,b)},a);a.display.scrollbars.addClass&&l(a.display.wrapper,a.display.scrollbars.addClass)}function Wg(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1, -updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Aa};a=a.curOp;nd?nd.ops.push(a):a.ownsGroup=nd={ops:[a],delayedCallbacks:[]}}function qe(a){Le(a.curOp,function(a){for(var b=0;b=g.viewTo)||g.maxLineChanged&&e.options.lineWrapping;d.update=d.mustUpdate&&new Ta(e,d.mustUpdate&&{top:d.scrollTop,ensure:d.scrollToPos},d.forceUpdate)}for(b=0;bq;q++){var r=!1;l=oe(e,m);var t=n&&n!=m?oe(e,n):l;l={left:Math.min(l.left,t.left),top:Math.min(l.top,t.top)-p,right:Math.max(l.left,t.left),bottom:Math.max(l.bottom,t.bottom)+p};t=wf(e,l);var C=e.doc.scrollTop,u=e.doc.scrollLeft;null!=t.scrollTop&&(cd(e,t.scrollTop),1n.top+q.top?m=!0:n.bottom+q.top>(window.innerHeight||document.documentElement.clientHeight)&&(m=!1),null==m||Gi||(n=c('div','\u200b',null,'position: absolute;\n top: '+(n.top-p.viewOffset-e.display.lineSpace.offsetTop)+'px;\n height: '+(n.bottom-n.top+Za(e)+p.barHeight)+'px;\n left: '+n.left+'px; width: '+Math.max(2,n.right-n.left)+'px;'),e.display.lineSpace.appendChild(n), -n.scrollIntoView(m),e.display.lineSpace.removeChild(n)))}n=d.maybeHiddenMarkers;m=d.maybeUnhiddenMarkers;if(n)for(p=0;pb)&&(e.updateLineNumbers=b);a.curOp.viewChanged=!0;if(b>=e.viewTo)W&&Ka(a.doc,b)e.viewFrom?he(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)he(a);else if(b<=e.viewFrom){var g=xe(a,c,c+d,1);g?(e.view=e.view.slice(g.index),e.viewFrom=g.lineN,e.viewTo+=d):he(a)}else if(c>=e.viewTo)(g=xe(a,b,b,-1))?(e.view=e.view.slice(0,g.index),e.viewTo=g.lineN):he(a);else{g=xe(a,b,b,-1);var h=xe(a,c,c+d,1);g&&h?(e.view= -e.view.slice(0,g.index).concat(La(a,g.lineN,h.lineN)).concat(e.view.slice(h.index)),e.viewTo+=d):he(a)}if(a=e.externalMeasured)c=e.lineN&&b=d.viewTo||(a=d.view[Of(a,b)],null!=a.node&&(a=a.changes||(a.changes=[]),-1==n(a,c)&&a.push(c)))}function he(a){a.display.viewFrom=a.display.viewTo= -a.doc.first;a.display.view=[];a.display.viewOffset=0}function xe(a,b,c,d){var e=Of(a,b),g=a.display.view;if(!W||c==a.doc.first+a.doc.size)return{index:e,lineN:c};for(var h=a.display.viewFrom,k=0;kd?0:g.length-1))return null;c+=d*g[e-(0>d?1:0)].size;e+=d}return{index:e,lineN:c}}function bh(a){a=a.display.view;for(var b=0,c=0;c=a.display.viewTo)){var c=+new Date+a.options.workTime,d=ne(a,b.highlightFrontier),e=[];b.iter(d.line,Math.min(b.first+b.size,a.display.viewTo+500),function(g){if(d.line>=a.display.viewFrom){var h=g.styles,k=g.text.length>a.options.maxHighlightLength?zc(b.mode,d.state):null,l=df(a,g,d,!0);k&&(d.state=k);g.styles=l.styles;k=g.styleClasses; -(l=l.classes)?g.styleClasses=l:k&&(g.styleClasses=null);l=!h||h.length!=g.styles.length||k!=l&&(!k||!l||k.bgClass!=l.bgClass||k.textClass!=l.textClass);for(k=0;!l&&kc)return gf(a,a.options.workDelay),!0});b.highlightFrontier=d.line;b.modeFrontier=Math.max(b.modeFrontier,d.line);e.length&&Sd(a,function(){for(var b= -0;b=d.viewFrom&&c.visible.to<=d.viewTo&&(null==d.updateLineNumbers||d.updateLineNumbers>=d.viewTo)&&d.renderedView==d.view&&0==bh(a))return!1;eg(a)&&(he(a),c.dims=Re(a));var g=e.first+e.size,l=Math.max(c.visible.from-a.options.viewportMargin,e.first),m=Math.min(g,c.visible.to+a.options.viewportMargin);d.viewFroml-d.viewFrom&&(l=Math.max(e.first,d.viewFrom)); -d.viewTo>m&&20>d.viewTo-m&&(m=Math.min(g,d.viewTo));W&&(l=Ka(a.doc,l),m=mb(a.doc,m));e=l!=d.viewFrom||m!=d.viewTo||d.lastWrapHeight!=c.wrapperHeight||d.lastWrapWidth!=c.wrapperWidth;g=a.display;0==g.view.length||l>=g.viewTo||m<=g.viewFrom?(g.view=La(a,l,m),g.viewFrom=l):(g.viewFrom>l?g.view=La(a,l,g.viewFrom).concat(g.view):g.viewFromm&&(g.view=g.view.slice(0,Of(a,m))));g.viewTo=m;d.viewOffset= -nb(T(a.doc,d.viewFrom));a.display.mover.style.top=d.viewOffset+'px';m=bh(a);if(!e&&0==m&&!c.force&&d.renderedView==d.view&&(null==d.updateLineNumbers||d.updateLineNumbers>=d.viewTo))return!1;a.hasFocus()?l=null:(l=k())&&h(a.display.lineDiv,l)?(l={activeElt:l},window.getSelection&&(g=window.getSelection(),g.anchorNode&&g.extend&&h(a.display.lineDiv,g.anchorNode)&&(l.anchorNode=g.anchorNode,l.anchorOffset=g.anchorOffset,l.focusNode=g.focusNode,l.focusOffset=g.focusOffset))):l=null;4=a.display.viewFrom&&b.visible.to<=a.display.viewTo)break;if(!Og(a,b))break;ob(a);d=we(a);of(a);Bg(a,d);yf(a,d);b.force=!1}b.signal(a,'update',a);if(a.display.viewFrom!=a.display.reportedViewFrom|| -a.display.viewTo!=a.display.reportedViewTo)b.signal(a,'viewportChange',a,a.display.viewFrom,a.display.viewTo),a.display.reportedViewFrom=a.display.viewFrom,a.display.reportedViewTo=a.display.viewTo}function fg(a,b){b=new Ta(a,b);if(Og(a,b)){ob(a);Pg(a,b);var c=we(a);of(a);Bg(a,c);yf(a,c);b.finish()}}function oc(a,c,d){function e(b){var c=b.nextSibling;Kc&&Lc&&a.display.currentWheelTarget==b?b.style.display='none':b.parentNode.removeChild(b);return c}var g=a.display,h=a.options.lineNumbers,k=g.lineDiv, -l=k.firstChild,m=g.view;g=g.viewFrom;for(var p=0;pg.clientWidth,k=g.scrollHeight>g.clientHeight;if(d&&h||c&&k){if(c&&Lc&&Kc){h=b.target;var l=e.view;a:for(;h!=g;h=h.parentNode)for(var m=0;mb?k=Math.max(0,k+b-50):h=Math.min(a.doc.height,h+b+50),fg(a,{top:k,bottom:h})),20>Xd&&(null==e.wheelStartX?(e.wheelStartX=g.scrollLeft,e.wheelStartY=g.scrollTop,e.wheelDX=d,e.wheelDY=c, -setTimeout(function(){if(null!=e.wheelStartX){var a=g.scrollLeft-e.wheelStartX,b=g.scrollTop-e.wheelStartY;a=b&&e.wheelDY&&b/e.wheelDY||a&&e.wheelDX&&a/e.wheelDX;e.wheelStartX=e.wheelStartY=null;a&&(le=(le*Xd+a)/(Xd+1),++Xd)}},200)):(e.wheelDX+=d,e.wheelDY+=c))):(c&&k&&cd(a,Math.max(0,g.scrollTop+c*le)),Oe(a,Math.max(0,g.scrollLeft+d*le)),(!c||c&&k)&&yb(b),e.wheelStartX=null)}}function Ha(a,b){b=a[b];a.sort(function(a,b){return L(a.from(),b.from())});b=n(a,b);for(var c=1;cL(a,b.from))return a;if(0>=L(a,b.to))return Eb(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;a.line==b.to.line&& -(d+=Eb(b).ch-b.to.ch);return ba(c,d)}function gd(a,b){for(var c=[],d=0;dg-(a.cm?a.cm.options.historyEventDelay:500)||'*'==b.origin.charAt(0))){if(e.lastOp==d){hf(e.done);var k=D(e.done)}else e.done.length&&!D(e.done).ranges?k=D(e.done):1e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift();e.done.push(c);e.generation=++e.maxGeneration;e.lastModTime=e.lastSelTime=g;e.lastOp=e.lastSelOp=d;e.lastOrigin=e.lastSelOrigin=b.origin;l||xb(a,'historyAdded')}function Cc(a,b){var c=D(b);c&&c.ranges&&c.equals(a)||b.push(a)}function Jg(a,b,c,d){var e=b['spans_'+a.id],g=0;a.iter(Math.max(a.first, -c),Math.min(a.first+a.size,d),function(c){c.markedSpans&&((e||(e=b['spans_'+a.id]={}))[g]=c.markedSpans);++g})}function bi(a){if(!a)return null;for(var b,c=0;cL(b,a),d!=0>L(c,a)?(a=b,b=c):d!=0>L(b,c)&&(b=c)),new Ia(a,b)):new Ia(c||b,b)}function Ue(a,b,c,d,e){null==e&&(e=a.cm&&(a.cm.display.shift||a.extend));Ad(a,new ih([ph(a.sel.primary(),b,c,e)],0),d)}function ci(a,b,c){for(var d=[],e=a.cm&&(a.cm.display.shift||a.extend),g=0;gL(b.primary().head, -a.sel.primary().head)?-1:1);zh(a,ie(a,b,d,!0));c&&!1===c.scroll||!a.cm||Ag(a.cm)}function zh(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,cc(a.cm)),Hc(a,'cursorActivity',a))}function Qi(a){zh(a,ie(a,a.sel,null,!1))}function ie(a,b,c,d){for(var e,g=0;g=b.ch:k.to>b.ch))){if(e&&(xb(l,'beforeCursorEnter'),l.explicitlyCleared))if(g.markedSpans){--h;continue}else break;if(l.atomic){if(c){h=l.find(0>d?1:-1);k=void 0;if(0>d?l.inclusiveRight:l.inclusiveLeft)h=Kj(a,h,-d,h&&h.line== -b.line?g:null);if(h&&h.line==b.line&&(k=L(h,c))&&(0>d?0>k:0d?-1:1);if(0>d?l.inclusiveLeft:l.inclusiveRight)c=Kj(a,c,d,c.line==b.line?g:null);return c?He(a,c,b,d,e):null}}}return b}function Jd(a,b,c,d,e){d=d||1;b=He(a,b,c,d,e)||!e&&He(a,b,c,d,!0)||He(a,b,c,-d,e)||!e&&He(a,b,c,-d,!0);return b?b:(a.cantEdit=!0,ba(a.first,0))}function Kj(a,b,c,d){return 0>c&&0==b.ch?b.line>a.first?oa(a,ba(b.line-1)):null:0a.lastLine())){if(b.from.linee&&(b={from:b.from,to:ba(e,T(a,e).text.length),text:[b.text[0]],origin:b.origin});b.removed=fa(a,b.from,b.to);c||(c=gd(a,b));a.cm?qh(a.cm,b,d):og(a,b,d);ei(a,c,Ke)}}function qh(a,b,c){var d=a.doc,e=a.display,g=b.from,h=b.to,k=!1,l=g.line;a.options.lineWrapping||(l=N(Da(T(d,g.line))),d.iter(l,h.line+1,function(a){if(a==e.maxLine)return k=!0}));-1e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,k=!1)}),k&&(a.curOp.updateMaxLine=!0));Fc(d,g.line);gf(a,400);c=b.text.length-(h.line-g.line)-1;b.full?xd(a):g.line!=h.line||1!=b.text.length||ai(a.doc,b)?xd(a,g.line,h.line+1,c):ae(a,g.line,'text');c=Fb(a,'changes');if((d=Fb(a,'change'))||c)b={from:g,to:h,text:b.text,removed:b.removed,origin:b.origin},d&&Hc(a,'change',a,b),c&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(b); -a.display.selForContextMenu=null}function Ab(a,b,c,d,e){d||(d=c);0>L(d,c)&&(d=[d,c],c=d[0],d=d[1]);'string'==typeof b&&(b=a.splitLines(b));Cg(a,{from:c,to:d,text:b,origin:e})}function zf(a,b,c,d){c=L(g.from,D(d).to);){var h=d.pop();if(0>L(h.from,g.from)){g.from=h.from;break}}d.push(g)}Sd(a,function(){for(var b=d.length- -1;0<=b;b--)Ab(a.doc,'',d[b].from,d[b].to,'+delete');Ag(a)})}function ki(a,b,c){b=C(a.text,b+c,c);return 0>b||b>a.text.length?null:b}function li(a,b,c){a=ki(a,b.ch,c);return null==a?null:new ba(b.line,a,0>c?'after':'before')}function yg(a,b,c,d,e){if(a&&(a=Gb(c,b.doc.direction))){a=0>e?D(a):a[0];var g=0>e==(1==a.level)?'after':'before';if(0e?c.text.length-1:0;var l=rc(b,h,k).top;k=P(function(a){return rc(b,h,a).top==l},0>e==(1==a.level)?a.from: -a.to-1,k);'before'==g&&(k=ki(c,k,1))}else k=0>e?a.to:a.from;return new ba(d,k,g)}return new ba(d,0>e?c.text.length:0,0>e?'before':'after')}function mi(a,b,c,d){var e=Gb(b,a.doc.direction);if(!e)return li(b,c,d);c.ch>=b.text.length?(c.ch=b.text.length,c.sticky='before'):0>=c.ch&&(c.ch=0,c.sticky='after');var g=qb(e,c.ch,c.sticky),h=e[g];if('ltr'==a.doc.direction&&0==h.level%2&&(0c.ch:h.fromd,q=k(c,p?1:-1);if(null!=q&&(p?q<=h.to&&q<=n.end:q>=h.from&&q>=n.begin))return new ba(c.line,q,p?'before':'after')}h=function(a,b,d){for(var g=function(a,b){return b?new ba(c.line,k(a,1),'before'):new ba(c.line,a,'after')};0<=a&&alb&&27==a.keyCode&&(a.returnValue=!1);var b=a.keyCode;this.display.shift=16==b||a.shiftKey;var c=Ci(this,a);Lg&&(Mk=c?b:null,!c&&88==b&&!Jb&&(Lc?a.metaKey:a.ctrlKey)&&this.replaceSelection('',null,'cut'));18!=b||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||Ri(this)}}function Ri(a){function b(a){18!=a.keyCode&&a.altKey||(Hd(c,'CodeMirror-crosshair'),Qb(document, -'keyup',b),Qb(document,'mouseover',b))}var c=a.display.lineDiv;l(c,'CodeMirror-crosshair');Ca(document,'keyup',b);Ca(document,'mouseover',b)}function $i(a){16==a.keyCode&&(this.doc.sel.shift=!1);Qa(this,a)}function lh(a){if(!(tf(this.display,a)||Qa(this,a)||a.ctrlKey&&!a.altKey||Lc&&a.metaKey)){var b=a.keyCode,c=a.charCode;if(Lg&&b==Mk)Mk=null,yb(a);else if(!Lg||a.which&&!(10>a.which)||!Ci(this,a))if(b=String.fromCharCode(null==c?b:c),'\b'!=b&&!pj(this,a,b))this.display.input.onKeyPress(a)}}function Eg(a, -b){var c=+new Date;if(Vj&&Vj.compare(c,a,b))return Xa=Vj=null,'triple';if(Xa&&Xa.compare(c,a,b))return Vj=new Nk(c,a,b),Xa=null,'double';Xa=new Nk(c,a,b);Vj=null;return'single'}function Di(a){var b=this.display;if(!(Qa(this,a)||b.activeTouch&&b.input.supportsTouch()))if(b.input.ensurePolled(),b.shift=a.shiftKey,tf(b,a))Kc||(b.scroller.draggable=!1,setTimeout(function(){return b.scroller.draggable=!0},100));else if(!Si(this,a,'gutterClick',!0)){var c=Kb(this,a),d=td(a),e=c?Eg(c,d):'single';window.focus(); -1==d&&this.state.selectingText&&this.state.selectingText(a);c&&pi(this,d,c,e,a)||(1==d?c?qj(this,c,e,a):(a.target||a.srcElement)==b.scroller&&yb(a):2==d?(c&&Ue(this.doc,c),setTimeout(function(){return b.input.focus()},20)):3==d&&(oj?sj(this,a):Ng(this)))}}function pi(a,b,c,d,e){var g='Click';'double'==d?g='Double'+g:'triple'==d&&(g='Triple'+g);return Ud(a,ii((1==b?'Left':2==b?'Middle':'Right')+g,e),e,function(b){'string'==typeof b&&(b=Uj[b]);if(!b)return!1;var d=!1;try{a.isReadOnly()&&(a.state.suppressEdits= -!0),d=b(a,c)!=Nc}finally{a.state.suppressEdits=!1}return d})}function qj(a,b,c,d){od?setTimeout(q(ug,a),0):a.curOp.focus=k();var e=a.getOption('configureMouse');e=e?e(a,c,d):{};null==e.unit&&(e.unit=(Ae?d.shiftKey&&d.metaKey:d.altKey)?'rectangle':'single'==c?'char':'double'==c?'word':'line');if(null==e.extend||a.doc.extend)e.extend=a.doc.extend||d.shiftKey;null==e.addNew&&(e.addNew=Lc?d.metaKey:d.ctrlKey);null==e.moveOnDrag&&(e.moveOnDrag=!(Lc?d.altKey:d.ctrlKey));var g=a.doc.sel,h;a.options.dragDrop&& -ib&&!a.isReadOnly()&&'single'==c&&-1<(h=g.contains(b))&&(0>L((h=g.ranges[h]).from(),b)||0b.xRel)?rj(a,d,b,e):Lj(a,d,b,e)}function rj(a,b,c,d){var e=a.display,g=!1,h=yd(a,function(b){Kc&&(e.scroller.draggable=!1);a.state.draggingText=!1;Qb(e.wrapper.ownerDocument,'mouseup',h);Qb(e.wrapper.ownerDocument,'mousemove',k);Qb(e.scroller,'dragstart',l);Qb(e.scroller,'drop',h);g||(yb(b),d.addNew||Ue(a.doc,c,null,null,d.extend),Kc||od&&9==lb?setTimeout(function(){e.wrapper.ownerDocument.body.focus(); -e.input.focus()},20):e.input.focus())}),k=function(a){g=g||10<=Math.abs(b.clientX-a.clientX)+Math.abs(b.clientY-a.clientY)},l=function(){return g=!0};Kc&&(e.scroller.draggable=!0);a.state.draggingText=h;h.copy=!d.moveOnDrag;e.scroller.dragDrop&&e.scroller.dragDrop();Ca(e.wrapper.ownerDocument,'mouseup',h);Ca(e.wrapper.ownerDocument,'mousemove',k);Ca(e.scroller,'dragstart',l);Ca(e.scroller,'drop',h);Ng(a);setTimeout(function(){return e.input.focus()},20)}function aj(a,b,c){if('char'==c)return new Ia(b, -b);if('word'==c)return a.findWordAt(b);if('line'==c)return new Ia(ba(b.line,0),oa(a.doc,ba(b.line+1,0)));a=c(a,b);return new Ia(a.from,a.to)}function Lj(a,b,c,d){function g(b){if(0!=L(u,b))if(u=b,'rectangle'==d.unit){var g=[],h=a.options.tabSize,k=e(T(n,c.line).text,c.ch,h),l=e(T(n,b.line).text,b.ch,h),m=Math.min(k,l);k=Math.max(k,l);l=Math.min(c.line,b.line);for(var q=Math.min(a.lastLine(),Math.max(c.line,b.line));l<=q;l++){var H=T(n,l).text,w=r(H,m,h);m==k?g.push(new Ia(ba(l,w),ba(l,w))):H.length> -w&&g.push(new Ia(ba(l,w),ba(l,r(H,k,h))))}g.length||g.push(new Ia(c,c));Ad(n,Ha(p.ranges.slice(0,t).concat(g),t),{origin:'*mouse',scroll:!1});a.scrollIntoView(b)}else g=C,m=aj(a,b,d.unit),b=g.anchor,0=l.to||e.lineH.bottom?20:0;p&&setTimeout(yd(a,function(){w==c&&(m.scroller.scrollTop+=p,h(b))}),50)}}function l(b){a.state.selectingText=!1;w=Infinity;yb(b);m.input.focus();Qb(m.wrapper.ownerDocument,'mousemove',U);Qb(m.wrapper.ownerDocument,'mouseup',v);n.history.lastSelOrigin=null}var m=a.display,n=a.doc;yb(b);var p=n.sel,q=p.ranges;if(d.addNew&&!d.extend){var t=n.sel.contains(c);var C=-1g:0=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&yb(b);d=a.display;var h=d.lineDiv.getBoundingClientRect();if(g>h.bottom||!Fb(a,c))return Vb(b);g-=h.top-d.viewOffset;for(h=0;h< -a.options.gutters.length;++h){var k=d.gutters.childNodes[h];if(k&&k.getBoundingClientRect().right>=e)return e=ma(a.doc,g),xb(a,c,a,e,a.options.gutters[h],b),Vb(b)}}function sj(a,b){var c;(c=tf(a.display,b))||(c=Fb(a,'gutterContextMenu')?Si(a,b,'gutterContextMenu',!1):!1);if(!c&&!Qa(a,b,'contextmenu'))a.display.input.onContextMenu(b)}function bj(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,'')+a.options.theme.replace(/(^|\s)\s*/g,' cm-s-');ue(a)}function Rg(a){ng(a); -xd(a);fd(a)}function tj(a,b,c){!b!=!(c&&c!=Fj)&&(c=a.display.dragFunctions,b=b?Ca:Qb,b(a.display.scroller,'dragstart',c.start),b(a.display.scroller,'dragenter',c.enter),b(a.display.scroller,'dragover',c.over),b(a.display.scroller,'dragleave',c.leave),b(a.display.scroller,'drop',c.drop))}function uj(a){a.options.lineWrapping?(l(a.display.wrapper,'CodeMirror-wrap'),a.display.sizer.style.minWidth='',a.display.sizerWidth=null):(Hd(a.display.wrapper,'CodeMirror-wrap'),Ub(a));fb(a);xd(a);ue(a);setTimeout(function(){return Bg(a)}, -100)}function ce(a,b){var c=this;if(!(this instanceof ce))return new ce(a,b);this.options=b=b?p(b):{};p(pl,b,!1);Bc(b);var d=b.value;'string'==typeof d?d=new Ce(d,b.mode,null,b.lineSeparator,b.direction):b.mode&&(d.modeOption=b.mode);this.doc=d;var e=new ce.inputStyles[b.inputStyle](this);a=this.display=new Q(a,d,e);a.wrapper.CodeMirror=this;ng(this);bj(this);b.lineWrapping&&(this.display.wrapper.className+=' CodeMirror-wrap');Se(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1, -focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Zh,keySeq:null,specialChars:null};b.autofocus&&!Hb&&a.input.focus();od&&11>lb&&setTimeout(function(){return c.display.input.reset(!0)},20);Mj(this);ol||(qf(),ol=!0);Wg(this);this.curOp.forceUpdate=!0;Yg(this,d);b.autofocus&&!Hb||this.hasFocus()?setTimeout(q(vg,this),20):Ne(this);for(var g in hk)if(hk.hasOwnProperty(g))hk[g](c,b[g],Fj);eg(this);b.finishInit&&b.finishInit(this);for(d=0;dlb?Ca(g.scroller,'dblclick',yd(a,function(b){if(!Qa(a,b)){var c=Kb(a,b);!c||Si(a,b, -'gutterClick',!0)||tf(a.display,b)||(yb(b),b=a.findWordAt(c),Ue(a.doc,b.anchor,b.head))}})):Ca(g.scroller,'dblclick',function(b){return Qa(a,b)||yb(b)});oj||Ca(g.scroller,'contextmenu',function(b){return sj(a,b)});var h,k={end:0};Ca(g.scroller,'touchstart',function(b){var c;if(c=!Qa(a,b))1!=b.touches.length?c=!1:(c=b.touches[0],c=1>=c.radiusX&&1>=c.radiusY),c=!c;c&&!Si(a,b,'gutterClick',!0)&&(g.input.ensurePolled(),clearTimeout(h),c=+new Date,g.activeTouch={start:c,moved:!1,prev:300>=c-k.end?k:null}, -1==b.touches.length&&(g.activeTouch.left=b.touches[0].pageX,g.activeTouch.top=b.touches[0].pageY))});Ca(g.scroller,'touchmove',function(){g.activeTouch&&(g.activeTouch.moved=!0)});Ca(g.scroller,'touchend',function(c){var d=g.activeTouch;if(d&&!tf(g,c)&&null!=d.left&&!d.moved&&300>new Date-d.start){var h=a.coordsChar(g.activeTouch,'page');d=!d.prev||e(d,d.prev)?new Ia(h,h):!d.prev.prev||e(d,d.prev.prev)?a.findWordAt(h):new Ia(ba(h.line,0),oa(a.doc,ba(h.line+1,0)));a.setSelection(d.anchor,d.head);a.focus(); -yb(c)}b()});Ca(g.scroller,'touchcancel',b);Ca(g.scroller,'scroll',function(){g.scroller.clientHeight&&(cd(a,g.scroller.scrollTop),Oe(a,g.scroller.scrollLeft,!0),xb(a,'scroll',a))});Ca(g.scroller,'mousewheel',function(b){return gb(a,b)});Ca(g.scroller,'DOMMouseScroll',function(b){return gb(a,b)});Ca(g.wrapper,'scroll',function(){return g.wrapper.scrollTop=g.wrapper.scrollLeft=0});g.dragFunctions={enter:function(b){Qa(a,b)||Fd(b)},over:function(b){if(!Qa(a,b)){var e=Kb(a,b);if(e){var g=document.createDocumentFragment(); -yh(a,e,g);a.display.dragCursor||(a.display.dragCursor=c('div',null,'CodeMirror-cursors CodeMirror-dragcursors'),a.display.lineSpace.insertBefore(a.display.dragCursor,a.display.cursorDiv));d(a.display.dragCursor,g)}Fd(b)}},start:function(b){if(od&&(!a.state.draggingText||100>+new Date-ql))Fd(b);else if(!Qa(a,b)&&!tf(a.display,b)&&(b.dataTransfer.setData('Text',a.getSelection()),b.dataTransfer.effectAllowed='copyMove',b.dataTransfer.setDragImage&&!ej)){var d=c('img',null,null,'position: fixed; left: 0; top: 0;'); -d.src='data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';Lg&&(d.width=d.height=1,a.display.wrapper.appendChild(d),d._top=d.offsetTop);b.dataTransfer.setDragImage(d,0,0);Lg&&d.parentNode.removeChild(d)}},drop:yd(a,Af),leave:function(b){Qa(a,b)||gg(a)}};var l=g.input.getField();Ca(l,'keyup',function(b){return $i.call(a,b)});Ca(l,'keydown',yd(a,ni));Ca(l,'keypress',yd(a,lh));Ca(l,'focus',function(b){return vg(a,b)});Ca(l,'blur',function(b){return Ne(a,b)})}function qi(a,b,c, -d){var g=a.doc,h;null==c&&(c='add');'smart'==c&&(g.mode.indent?h=ne(a,b).state:c='prev');var k=a.options.tabSize,l=T(g,b),m=e(l.text,null,k);l.stateAfter&&(l.stateAfter=null);var n=l.text.match(/^\s*/)[0];if(!d&&!/\S/.test(l.text)){var p=0;c='not'}else if('smart'==c&&(p=g.mode.indent(h,l.text.slice(n.length),l.text),p==Nc||150g.first?e(T(g,b-1).text,null,k):0:'add'==c?p=m+a.options.indentUnit:'subtract'==c?p=m-a.options.indentUnit:'number'==typeof c&&(p=m+ -c);p=Math.max(0,p);c='';d=0;if(a.options.indentWithTabs)for(a=Math.floor(p/k);a;--a)d+=k,c+='\t';d=a.first+a.size?d=!1:(b=new ba(d,b.ch,b.sticky),d=l=T(a,d));if(d)b=yg(e,a.cm,l,b.line,c);else return!1}else b=g;return!0}var h=b,k=c,l=T(a,b.line);if('char'==d)g();else if('column'==d)g(!0);else if('word'==d||'group'==d){var m=null;d='group'==d;for(var n=a.cm&&a.cm.getHelper(b,'wordChars'),p=!0;!(0>c)||g(!p);p=!1){var q=l.text.charAt(b.ch)|| -'\n';q=I(q,n)?'w':d&&'\n'==q?'n':!d||/\s/.test(q)?null:'p';!d||p||q||(q='s');if(m&&m!=q){0>c&&(c=1,g(),b.sticky='after');break}q&&(m=q);if(0c?0>=h:h>=e.height){b.hitSide=!0;break}h+=5*c}return b}function Vh(a,b){var c=Ja(a,b.line);if(!c||c.hidden)return null;var d=T(a.doc,b.line);c=Oa(c,d,b.line);a=Gb(d,a.doc.direction);d='left';a&&(d=qb(a,b.ch)%2?'right':'left');b=bc(c.map,b.ch,d);b.offset='right'==b.collapse?b.end:b.start;return b}function si(a){for(;a;a=a.parentNode)if(/CodeMirror-gutter-wrapper/.test(a.className))return!0;return!1}function $g(a,b){b&&(a.bad=!0);return a}function ti(a,b,c,d,e){function g(a){return function(b){return b.id== -a}}function h(){n&&(m+=p,q&&(m+=p),n=q=!1)}function k(a){a&&(h(),m+=a)}function l(b){if(1==b.nodeType){var c=b.getAttribute('cm-text');if(c)k(c);else{c=b.getAttribute('cm-marker');var m;if(c)b=a.findMarks(ba(d,0),ba(e+1,0),g(+c)),b.length&&(m=b[0].find(0))&&k(fa(a.doc,m.from,m.to).join(p));else if('false'!=b.getAttribute('contenteditable')&&(m=/^(pre|div|p|li|table|br)$/i.test(b.nodeName),/^br$/i.test(b.nodeName)||0!=b.textContent.length)){m&&h();for(c=0;ce?m.map:n[e],h=0;he?a.line:a.rest[e]);e=g[h]+d;if(0>d||k!=b)e=g[h+(d?1:0)];return ba(c,e)}}}var e=a.text.firstChild,g=!1;if(!b||!h(e,b))return $g(ba(N(a.line),0),!0);if(b==e&&(g=!0,b=e.childNodes[c],c=0,!b))return c=a.rest?D(a.rest):a.line,$g(ba(N(c),c.text.length),g);var k=3==b.nodeType? -b:null,l=b;k||1!=b.childNodes.length||3!=b.firstChild.nodeType||(k=b.firstChild,c&&(c=k.nodeValue.length));for(;l.parentNode!=e;)l=l.parentNode;var m=a.measure,n=m.maps;if(b=d(k,l,c))return $g(b,g);e=l.nextSibling;for(k=k?k.nodeValue.length-c:0;e;e=e.nextSibling){if(b=d(e,e.firstChild,0))return $g(ba(b.line,b.ch-k),g);k+=e.textContent.length}for(l=l.previousSibling;l;l=l.previousSibling){if(b=d(l,l.firstChild,-1))return $g(ba(b.line,b.ch+c),g);c+=l.textContent.length}}var Tf=navigator.userAgent,ui= -navigator.platform,ah=/gecko\/\d/i.test(Tf),eh=/MSIE \d/.test(Tf),Fi=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Tf),Kg=/Edge\/(\d+)/.exec(Tf),od=eh||Fi||Kg,lb=od&&(eh?document.documentMode||6:+(Kg||Fi)[1]),Kc=!Kg&&/WebKit\//.test(Tf),zg=Kc&&/Qt\/\d+\.\d+/.test(Tf),Wh=!Kg&&/Chrome\//.test(Tf),Lg=/Opera\//.test(Tf),ej=/Apple Computer/.test(navigator.vendor),ac=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(Tf),Gi=/PhantomJS/.test(Tf),Xb=!Kg&&/AppleWebKit/.test(Tf)&&/Mobile\/\w+/.test(Tf),Wi=/Android/.test(Tf), -Hb=Xb||Wi||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(Tf),Lc=Xb||/Mac/.test(ui),Ae=/\bCrOS\b/.test(Tf),dc=/win/i.test(ui),ag=Lg&&Tf.match(/Version\/(\d*\.\d*)/);ag&&(ag=Number(ag[1]));ag&&15<=ag&&(Lg=!1,Kc=!0);var Ej=Lc&&(zg||Lg&&(null==ag||12.11>ag)),oj=ah||od&&9<=lb,Hd=function(b,c){var d=b.className;if(c=a(c).exec(d)){var e=d.slice(c.index+c[0].length);b.className=d.slice(0,c.index)+(e?c[1]+e:'')}};var hc=document.createRange?function(a,b,c,d){var e=document.createRange();e.setEnd(d|| -a,c);e.setStart(a,b);return e}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(ik){return d}d.collapse(!0);d.moveEnd('character',c);d.moveStart('character',b);return d};var zi=function(a){a.select()};Xb?zi=function(a){a.selectionStart=0;a.selectionEnd=a.value.length}:od&&(zi=function(a){try{a.select()}catch(Vc){}});var Zh=function(){this.id=null};Zh.prototype.set=function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)};var Nc={toString:function(){return'CodeMirror.Pass'}}, -Ke={scroll:!1},Yi={origin:'*mouse'},yi={origin:'+move'},Oi=[''],De=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,R=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/, -aa=!1,W=!1,Ba=null,sb=function(){function a(a){return 247>=a?'bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN'.charAt(a):1424<=a&&1524>=a?'R':1536<=a&&1785>=a?'nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111'.charAt(a- -1536):1774<=a&&2220>=a?'r':8192<=a&&8203>=a?'w':8204==a?'b':'L'}function b(a,b,c){this.level=a;this.from=b;this.to=c}var c=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,d=/[stwN]/,e=/[LRr]/,g=/[Lb1n]/,h=/[1n]/;return function(k,l){var m='ltr'==l?'L':'R';if(0==k.length||'ltr'==l&&!c.test(k))return!1;for(var n=k.length,p=[],q=0;qlb)return!1;var a=c('div');return'draggable'in a||'dragDrop'in a}(),kc,nc,ec=3!='\n\nb'.split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf('\n',b);-1==e&&(e=a.length);var g=a.slice(b,'\r'==a.charAt(e-1)?e-1:e),h=g.indexOf('\r');-1!=h?(c.push(g.slice(0,h)),b+= -h+1):(c.push(g),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)},ub=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(Vc){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(bd){}return b&&b.parentElement()==a?0!=b.compareEndPoints('StartToEnd',b):!1},Jb=function(){var a=c('div');if('oncopy'in a)return!0;a.setAttribute('oncopy','return;');return'function'==typeof a.oncopy}(),Pd=null,$a={},bf={},fh={},dd=function(a,b,c){this.pos=this.start= -0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=0;this.lineOracle=c};dd.prototype.eol=function(){return this.pos>=this.string.length};dd.prototype.sol=function(){return this.pos==this.lineStart};dd.prototype.peek=function(){return this.string.charAt(this.pos)||void 0};dd.prototype.next=function(){if(this.posb};dd.prototype.eatSpace=function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a};dd.prototype.skipToEnd=function(){this.pos=this.string.length};dd.prototype.skipTo=function(a){a=this.string.indexOf(a,this.pos);if(-1this.maxLookAhead&&(this.maxLookAhead=a);return b};Xe.prototype.baseToken=function(a){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=a;)this.baseTokenPos+=2;var b=this.baseTokens[this.baseTokenPos+ -1];return{type:b&&b.replace(/( |^)overlay .*/,''),size:this.baseTokens[this.baseTokenPos]-a}};Xe.prototype.nextLine=function(){this.line++;0lb&&(this.horiz.style.minHeight=this.vert.style.minWidth='18px')};pd.prototype.update=function(a){var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+1,d=a.nativeBarWidth;c?(this.vert.style.display='block',this.vert.style.bottom=b?d+'px':'0',this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+(a.viewHeight-(b?d:0)))+'px'):(this.vert.style.display= -'',this.vert.firstChild.style.height='0');b?(this.horiz.style.display='block',this.horiz.style.right=c?d+'px':'0',this.horiz.style.left=a.barLeft+'px',this.horiz.firstChild.style.width=Math.max(0,a.scrollWidth-a.clientWidth+(a.viewWidth-a.barLeft-(c?d:0)))+'px'):(this.horiz.style.display='',this.horiz.firstChild.style.width='0');!this.checkedZeroWidth&&0=L(a,d.to()))return c}return-1};var Ia=function(a,b){this.anchor=a;this.head=b};Ia.prototype.from=function(){return qa(this.anchor, -this.head)};Ia.prototype.to=function(){return ea(this.anchor,this.head)};Ia.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};hi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=a,d=a+b;cthis.size- -b&&(1=this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5);b=new jf(b);if(a.parent){a.size-=b.size;a.height-=b.height;var c=n(a.parent.children,a);a.parent.children.splice(c+1,0,b)}else c=new jf(a.children),c.parent=a,a.children=[c,b],a=c;b.parent=a.parent}while(10a.display.maxLineLength&&(a.display.maxLine=g,a.display.maxLineLength=h,a.display.maxLineChanged=!0);null!=c&&a&&this.collapsed&&xd(a,c,d+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Qi(a.doc));a&&Hc(a,'markerCleared',a,this,c,d);b&&qe(a);this.parent&&this.parent.clear()}};Vi.prototype.find= -function(a,b){null==a&&'bookmark'==this.type&&(a=1);for(var c,d,e=0;eL(k.head,k.anchor),a[g]=new Ia(k?l:h,k?h:l)):a[g]=new Ia(h,h)}a=new ih(a,this.sel.primIndex)}b=a;for(a=d.length-1;0<=a;a--)Cg(this,d[a]);b?di(this,b):this.cm&&Ag(this.cm)}),undo:Wc(function(){Dg(this, -'undo')}),redo:Wc(function(){Dg(this,'redo')}),undoSelection:Wc(function(){Dg(this,'undo',!0)}),redoSelection:Wc(function(){Dg(this,'redo',!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){a=oa(this,a);b=oa(this,b);var d=[],e=a.line;this.iter(a.line,b.line+1,function(g){if(g=g.markedSpans)for(var h= -0;h=k.to||null==k.from&&e!=a.line||null!=k.from&&e==b.line&&k.from>=b.ch||c&&!c(k.marker)||d.push(k.marker.parent||k.marker)}++e});return d},getAllMarks:function(){var a=[];this.iter(function(b){if(b=b.markedSpans)for(var c=0;ca)return b=a,!0;a-=e;++c});return oa(this, -ba(c,b))},indexFromPos:function(a){a=oa(this,a);var b=a.ch;if(a.linea.ch)return 0;var c=this.lineSeparator().length;this.iter(this.first,a.line,function(a){b+=a.text.length+c});return b},copy:function(a){var b=new Ce(ja(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);b.scrollTop=this.scrollTop;b.scrollLeft=this.scrollLeft;b.sel=this.sel;b.extend=!1;a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory()));return b}, -linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from);null!=a.to&&a.tokd;kd++)Xi[kd+48]=Xi[kd+96]=String(kd); -for(var gk=65;90>=gk;gk++)Xi[gk]=String.fromCharCode(gk);for(var Sj=1;12>=Sj;Sj++)Xi[Sj+111]=Xi[Sj+63235]='F'+Sj;var Tj={basic:{Left:'goCharLeft',Right:'goCharRight',Up:'goLineUp',Down:'goLineDown',End:'goLineEnd',Home:'goLineStartSmart',PageUp:'goPageUp',PageDown:'goPageDown',Delete:'delCharAfter',Backspace:'delCharBefore','Shift-Backspace':'delCharBefore',Tab:'defaultTab','Shift-Tab':'indentAuto',Enter:'newlineAndIndent',Insert:'toggleOverwrite',Esc:'singleSelection'},pcDefault:{'Ctrl-A':'selectAll', +!1;this.wheelDX=this.wheelDY=this.wheelStartX=this.wheelStartY=null;this.shift=!1;this.activeTouch=this.selForContextMenu=null;e.init(this)}function X(a,b){b-=a.first;if(0>b||b>=a.size)throw Error('There is no line '+(b+a.first)+' in the document.');for(;!a.lines;)for(var c=0;;++c){var d=a.children[c],e=d.chunkSize();if(b=a.first&&bR(a,b)? +b:a}function oa(a,b){return 0>R(a,b)?a:b}function ma(a,b){if(b.linec)return da(c,X(a,c).text.length);a=X(a,b.line).text.length;c=b.ch;b=null==c||c>a?da(b.line,a):0>c?da(b.line,0):b;return b}function O(a,b){for(var c=[],d=0;d=a:l.to>a);(h||(h=[])).push(new ya(m,l.from,n?null:l.to))}}c=h;var p;if(d)for(h=0;h=e:k.to>e)||k.from==e&&'bookmark'==l.type&&(!g||k.marker.insertLeft))m=null==k.from||(l.inclusiveLeft?k.from<=e:k.fromR(h.to,e.from)||0l||!c.inclusiveLeft&&!l)&&k.push({from:h.from,to:e.from});(0Aa(e,c.marker)))var e= +c.marker;return e}function Fa(a,b,c,d,e){a=X(a,b);if(a=W&&a.markedSpans)for(b=0;b=l||0>=k&&0<=l)&&(0>=k&&(g.marker.inclusiveRight&&e.inclusiveLeft?0<=R(h.to,c):0=R(h.from,d):0>R(h.from,d))))return!0}}}function Wa(a){for(var b;b= +ha(a,!0);)a=b.find(-1,!0).line;return a}function Ia(a,b){a=X(a,b);var c=Wa(a);return a==c?b:N(c)}function ib(a,b){if(b>a.lastLine())return b;var c=X(a,b);if(!Ba(a,c))return b;for(;a=ha(c,!1);)c=a.find(1,!0).line;return N(c)+1}function Ba(a,b){var c=W&&b.markedSpans;if(c)for(var d,e=0;eb.maxLineLength&&(b.maxLineLength=c,b.maxLine=a)})}function Na(a,b,c,d){if(!a)return d(b,c,'ltr',0);for(var e= +!1,g=0;gb||b==c&&h.to==b)d(Math.max(h.from,b),Math.min(h.to,c),1==h.level?'rtl':'ltr',g),e=!0}e||d(b,c,'ltr')}function rb(a,b,c){var d;Da=null;for(var e=0;eb)return e;g.to==b&&(g.from!=g.to&&'before'==c?d=e:Da=e);g.from==b&&(g.from!=g.to&&'before'!=c?d=e:Da=e)}return null!=d?d:Da}function lc(a,b){var c=a.order;null==c&&(c=a.order=Ya(a.text,b));return c}function vb(a,b,c){if(a.removeEventListener)a.removeEventListener(b, +c,!1);else if(a.detachEvent)a.detachEvent('on'+b,c);else{var d=(a=a._handlers)&&a[b];d&&(c=p(d,c),-1=b.offsetWidth&&2Rb))}a=gc?d('span','\u200b'):d('span','\u00a0',null,'display: inline-block; width: 1px; margin-right: -1px');a.setAttribute('cm-text','');return a}function uc(a, +b){2a&&e.splice(l,1,a,e[l+1],d);l+=2;m=Math.min(a,d)}if(b)if(k.opaque)e.splice(c,l-c,a,'overlay '+b),l=c+2;else for(;ca.options.maxHighlightLength&&ld(a.doc.mode,d.state),g=ag(a,b,d);e&&(d.state=e);b.stateAfter= +d.save(!e);b.styles=g.styles;g.classes?b.styleClasses=g.classes:b.styleClasses&&(b.styleClasses=null);c===a.doc.highlightFrontier&&(a.doc.modeFrontier=Math.max(a.doc.modeFrontier,++a.doc.highlightFrontier))}return b.styles}function Td(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return new wd(d,!0,b);var g=Cc(a,b,c),h=g>d.first&&X(d,g-1).stateAfter,k=h?wd.fromSaved(d,h,g):new wd(d,ve(d.mode),g);d.iter(g,b,function(c){Nd(a,c.text,k);var d=k.line;c.stateAfter=d==b-1||0==d%5||d>=e.viewFrom&& +de;e++){d&&(d[0]=Dd(a,c).mode);var g=a.token(b,c);if(b.pos>b.start)return g}throw Error('Mode '+a.name+' failed to advance stream.'); +}function xc(a,b,c,d){var e=a.doc,g=e.mode;b=ma(e,b);var h=X(e,b.line);c=Td(a,b.line,c);a=new yc(h.text,a.options.tabSize,c);var k;for(d&&(k=[]);(d||a.posa.options.maxHighlightLength){k=!1;h&&Nd(a,b,d,n.pos);n.pos=b.length;var q=null}else q=Ab(Sc(c,n,d.state,p),g);if(p){var r=p[0].name;r&&(q='m-'+(q?r+' '+q:r))}if(!k||m!=q){for(;lk;--b){if(b<=h.first)return h.first;var l=X(h,b-1),m=l.stateAfter;if(m&&(!c||b+(m instanceof Xg?m.lookAhead:0)<=h.modeFrontier))return b;l=g(l.text,null,a.options.tabSize);if(null==e||d>l)e=b-1,d=l}return e}function Ub(a,b){a.modeFrontier=Math.min(a.modeFrontier,b);if(!(a.highlightFrontierc;d--){var e=X(a,d).stateAfter;if(e&&(!(e instanceof +Xg)||d+e.lookAheadp.right-q.right:!1}m&&(l=lc(k,a.doc.direction))&&(g.addToken=rd(g.addToken,l));g.map=[];var r=d!=a.display.externalMeasured&&N(k);a:{var Pa=p=q=m=void 0,u=void 0,t=void 0,C=void 0;l=g;r=Ce(a,k,r);var D=k.markedSpans,v=k.text,S=0;if(D)for(var w=v.length,ec=0,E=1,z='',Fa=0;;){if(Fa== +ec){u=Pa=p=q=t='';m=null;Fa=Infinity;for(var ha=[],H=void 0,I=0;Iec||Q.collapsed&&B.to==ec&&B.from==ec)?(null!=B.to&&B.to!=ec&&Fa>B.to&&(Fa=B.to,Pa=''),Q.className&&(u+=' '+Q.className),Q.css&&(t=(t?t+';':'')+Q.css),Q.startStyle&&B.from==ec&&(p+=' '+Q.startStyle),Q.endStyle&&B.to==Fa&&(H||(H=[])).push(Q.endStyle,B.to),Q.title&&!q&&(q=Q.title),Q.collapsed&&(!m||0>Aa(m.marker,Q))&& +(m=B)):B.from>ec&&Fa>B.from&&(Fa=B.from)}if(H)for(I=0;I=w)break;for(ha=Math.min(w,Fa);;){if(z){H=ec+z.length;m||(I=H>ha?z.slice(0,ha-ec):z,l.addToken(l,I,C?C+u:u,p,ec+I.length==Fa?Pa:'',q,t));if(H>=ha){z=z.slice(ha-ec);ec=ha;break}ec=H;p=''}z=v.slice(S,S=r[E++]);C=Ha(r[E++],l.cm.options)}}else for(m= +1;mRb?l.appendChild(d('span',[t])):l.appendChild(t);a.map.push(a.pos,a.pos+Pa,t);a.col+=Pa;a.pos+=Pa}if(!r)break;q+=Pa+1;'\t'==r[0]?(r=a.cm.options.tabSize,r-=a.col% +r,Pa=l.appendChild(d('span',u(r),'cm-tab')),Pa.setAttribute('role','presentation'),Pa.setAttribute('cm-text','\t'),a.col+=r):('\r'==r[0]||'\n'==r[0]?(Pa=l.appendChild(d('span','\r'==r[0]?'\u240d':'\u2424','cm-invalidchar')),Pa.setAttribute('cm-text',r[0])):(Pa=a.cm.options.specialCharPlaceholder(r[0]),Pa.setAttribute('cm-text',r[0]),gd&&9>Rb?l.appendChild(d('span',[Pa])):l.appendChild(Pa)),a.col+=1);a.map.push(a.pos,a.pos+1,Pa);a.pos++}}else a.col+=b.length,l=document.createTextNode(m),a.map.push(a.pos, +a.pos+b.length,l),gd&&9>Rb&&(p=!0),a.pos+=b.length;a.trailingSpace=32==m.charCodeAt(b.length-1);if(c||e||g||p||k)return b=c||'',e&&(b+=e),g&&(b+=g),e=d('span',[l],b,k),h&&(e.title=h),a.content.appendChild(e);a.content.appendChild(l)}}function rd(a,b){return function(c,d,e,g,h,k,l){e=e?e+' cm-force-border':'cm-force-border';for(var m=c.pos,n=m+d.length;;){for(var p=void 0,q=0;qm&&p.from<=m);q++);if(p.to>=n)return a(c,d,e,g,h,k,l);a(c,d.slice(0,p.to-m),e,g,null,k,l);g=null; +d=d.slice(p.to-m);m=p.to}}}function Ja(a,b,c,d){var e=!d&&c.widgetNode;e&&a.map.push(a.pos,a.pos+b,e);!d&&a.cm.display.input.needsContentAttribute&&(e||(e=a.content.appendChild(document.createElement('span'))),e.setAttribute('cm-marker',c.id));e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e));a.pos+=b;a.trailingSpace=!1}function fc(a,b,c){for(var d=this.line=b,e;d=ha(d,!1);)d=d.find(1,!0).line,(e||(e=[])).push(d);this.size=(this.rest=e)?N(E(this.rest))-c+1:1;this.node=this.text=null; +this.hidden=Ba(a,b)}function Qa(a,b,c){var d=[],e;for(e=b;eRb&&(a.node.style.zIndex=2));return a.node}function $d(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=null,b.measure=c.measure,c.built):kc(a,b)}function Uc(a,b){var c=b.bgClass?b.bgClass+' '+(b.line.bgClass||''):b.line.bgClass;c&&(c+=' CodeMirror-linebackground');if(b.background)c?b.background.className=c:(b.background.parentNode.removeChild(b.background),b.background=null);else if(c){var e= +We(b);b.background=e.insertBefore(d('div',null,c),e.firstChild);a.display.input.setUneditable(b.background)}b.line.wrapClass?We(b).className=b.line.wrapClass:b.node!=b.text&&(b.node.className='');b.text.className=(b.textClass?b.textClass+' '+(b.line.textClass||''):b.line.textClass)||''}function me(a,b,c,e){b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null);b.gutterBackground&&(b.node.removeChild(b.gutterBackground),b.gutterBackground=null);if(b.line.gutterClass){var g=We(b);b.gutterBackground= +d('div',null,'CodeMirror-gutter-background '+b.line.gutterClass,'left: '+(a.options.fixedGutter?e.fixedPos:-e.gutterTotalWidth)+'px; width: '+e.gutterTotalWidth+'px');a.display.input.setUneditable(b.gutterBackground);g.insertBefore(b.gutterBackground,b.text)}g=b.line.gutterMarkers;if(a.options.lineNumbers||g){var h=We(b),k=b.gutter=d('div',null,'CodeMirror-gutter-wrapper','left: '+(a.options.fixedGutter?e.fixedPos:-e.gutterTotalWidth)+'px');a.display.input.setUneditable(k);h.insertBefore(k,b.text); +b.line.gutterClass&&(k.className+=' '+b.line.gutterClass);!a.options.lineNumbers||g&&g['CodeMirror-linenumbers']||(b.lineNumber=k.appendChild(d('div',aa(a.options,c),'CodeMirror-linenumber CodeMirror-gutter-elt','left: '+e.gutterLeft['CodeMirror-linenumbers']+'px; width: '+a.display.lineNumInnerWidth+'px')));if(g)for(b=0;bc)return{map:a.measure.maps[b],cache:a.measure.caches[b],before:!0}}function Ga(a,b){if(b>=a.display.viewFrom&&b=a.lineN&&bu;u++){for(;m&&C(b.line.text.charAt(l.coverStart+m));)--m;for(;l.coverStart+nRb&&0==m&&n==l.coverEnd-l.coverStart)var Pa=g.parentNode.getBoundingClientRect();else{Pa=$a(g,m,n).getClientRects();n=Mj;if('left'==q)for(p=0;pRb&&((u=!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI)||(null!=Ed?u=Ed:(q=e(a.display.measure,d('span','x')),u= +q.getBoundingClientRect(),q=$a(q,0,1).getBoundingClientRect(),u=Ed=1Rb)||m||Pa&&(Pa.left||Pa.right)||(Pa=(Pa=g.parentNode.getClientRects()[0])?{left:Pa.left,right:Pa.left+kg(a.display), +top:Pa.top,bottom:Pa.bottom}:Mj);g=Pa.top-b.rect.top;m=Pa.bottom-b.rect.top;u=(g+m)/2;q=b.view.measure.heights;for(l=0;lb)g=l-k,e=g-1,b>=l&&(h='right');if(null!=e){d=a[m+2];k==l&&c==(d.insertLeft?'left':'right')&&(h=c);if('left'==c&&0==e)for(;m&&a[m-2]==a[m-3]&&a[m-1].insertLeft;)d=a[(m-=3)+2],h='left';if('right'==c&&e==l-k)for(;m=d.text.length?(m=d.text.length,b='before'):0>=m&&(m=0,b='after');if(!l)return h('before'==b?m-1:m,'before'==b);var n=rb(l,m,b),p=Da;n=k(m,n,'before'==b);null!= +p&&(n.other=k(m,p,'before'!=b));return n}function yg(a,b){var c=0;b=ma(a.doc,b);a.options.lineWrapping||(c=kg(a.display)*b.ch);b=X(a.doc,b.line);a=Ta(b)+a.display.lineSpace.offsetTop;return{left:c,right:c,top:a,bottom:a+b.height}}function $g(a,b,c,d,e){a=da(a,b,c);a.xRel=e;d&&(a.outside=!0);return a}function Dg(a,b,c){var d=a.doc;c+=a.display.viewOffset;if(0>c)return $g(d.first,0,null,!0,-1);var e=la(d,c),g=d.first+d.size-1;if(e>g)return $g(d.first+d.size-1,X(d,g).text.length,null,!0,1);0>b&&(b=0); +for(var h=X(d,e);;){g=pg(a,h,e,b,c);var k=void 0;var l=g.ch+(0l)&&(!k||0>Aa(k,n.marker))&&(k=n.marker)}if(!k)return g;g=k.find(1);if(g.line==e)return g;h=X(d,e=g.line)}}function dh(a,b,c,d){d-=kd(b);b=b.text.length;var e=Q(function(b){return vc(a,c,b-1).bottom<=d},b,0);b=Q(function(b){return vc(a,c,b).top>d},e,b);return{begin:e,end:b}}function Mg(a,b,c,d){c||(c= +Pb(a,b));d=fe(a,b,vc(a,c,d),'line').top;return dh(a,b,c,d)}function ge(a,b,c,d){return a.bottom<=c?!1:a.top>c?!0:(d?a.left:a.right)>b}function pg(a,b,c,d,e){e-=Ta(b);var g=Pb(a,b),h=kd(b),k=0,l=b.text.length,m=!0,n=lc(b,a.doc.direction);n&&(n=(a.options.lineWrapping?ah:Lf)(a,b,c,g,n,d,e),k=(m=1!=n.level)?n.from:n.to-1,l=m?n.to:n.from-1);var p=null,q=null;n=Q(function(b){var c=vc(a,g,b);c.top+=h;c.bottom+=h;if(!ge(c,d,e,!1))return!1;c.top<=e&&c.left<=d&&(p=b,q=c);return!0},k,l);var r=!1;q?(k=d-q.left< +q.right-d,m=k==m,n=p+(m?0:1),m=m?'after':'before',k=k?q.left:q.right):(m||n!=l&&n!=k||n++,m=0==n?'after':n==b.text.length?'before':vc(a,g,n-(m?1:0)).bottom+h<=e==m?'after':'before',r=Xe(a,da(c,n,m),'line',b,g),k=r.left,r=e=r.bottom);n=D(b.text,n,1);return $g(c,n,m,r,d-k)}function Lf(a,b,c,d,e,g,h){var k=Q(function(k){k=e[k];var l=1!=k.level;return ge(Xe(a,da(c,l?k.to:k.from,l?'before':'after'),'line',b,d),g,h,!0)},0,e.length-1),l=e[k];if(0h&&(l=e[k-1])}return l}function ah(a,b,c,d,e,g,h){h=dh(a,b,d,h);c=h.begin;h=h.end;/\s/.test(b.text.charAt(h-1))&&h--;for(var k=b=null,l=0;l=h||m.to<=c)){var n=vc(a,d,1!=m.level?Math.min(h,m.to)-1:Math.max(c,m.from)).right;n=nn)b=m,k=n}}b||(b=e[e.length-1]);b.fromh&&(b={from:b.from,to:h,level:b.level});return b}function oe(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight; +if(null==li){li=d('pre');for(var c=0;49>c;++c)li.appendChild(document.createTextNode('x')),li.appendChild(d('br'));li.appendChild(document.createTextNode('x'))}e(a.measure,li);c=li.offsetHeight/50;3=a.display.viewTo)return null;b-=a.display.viewFrom;if(0>b)return null;a=a.display.view;for(var c=0;cb)return c}function xe(a){a.display.input.showSelection(a.display.input.prepareSelection())}function Eg(a,b){void 0=== +b&&(b=!0);for(var c=a.doc,d={},e=d.cursors=document.createDocumentFragment(),g=d.selection=document.createDocumentFragment(),h=0;h=a.display.viewTo||k.to().lineb&&(b=0);b=Math.round(b);e=Math.round(e);l.appendChild(d('div',null, +'CodeMirror-selected','position: absolute; left: '+a+'px;\n top: '+b+'px; width: '+(null==c?p-a:c)+'px;\n height: '+(e-b)+'px'))}function g(b,c,d){function g(c,d){return Tg(a,da(b,c),'div',l,d)}function h(b,c,d){b=Mg(a,l,null,b);c='ltr'==c==('after'==d)?'left':'right';d='after'==d?b.begin:b.end-(/\s/.test(l.text.charAt(b.end-1))?2:1);return g(d,c)[c]}var l=X(k,b),m=l.text.length,r,u,Pa=lc(l,k.direction);Na(Pa,c||0,null==d?m:d,function(a,b,k, +l){var t='ltr'==k,C=g(a,t?'left':'right'),D=g(b-1,t?'right':'left'),v=null==c&&0==a,S=null==d&&b==m,w=0==l;l=!Pa||l==Pa.length-1;3>=D.top-C.top?(b=(q?v:S)&&w?n:(t?C:D).left,e(b,C.top,((q?S:v)&&l?p:(t?D:C).right)-b,C.bottom)):(t?(t=q&&v&&w?n:C.left,v=q?p:h(a,k,'before'),a=q?n:h(b,k,'after'),S=q&&S&&l?p:D.right):(t=q?h(a,k,'before'):n,v=!q&&v&&w?p:C.right,a=!q&&S&&l?n:D.left,S=q?h(b,k,'after'):p),e(t,C.top,v-t,C.bottom),C.bottomad(C, +r))r=C;0>ad(D,r)&&(r=D);if(!u||0>ad(C,u))u=C;0>ad(D,u)&&(u=D)});return{start:r,end:u}}var h=a.display,k=a.doc,l=document.createDocumentFragment(),m=ca(a.display),n=m.left,p=Math.max(h.sizerWidth,Hb(a)-h.sizer.offsetLeft)-m.right,q='ltr'==k.direction;h=b.from();b=b.to();if(h.line==b.line)g(h.line,h.ch,b.ch);else{var r=X(k,h.line);m=X(k,b.line);m=Wa(r)==Wa(m);h=g(h.line,h.ch,m?r.text.length+1:null).end;b=g(b.line,m?0:null,b.ch).start;m&&(h.topa.options.cursorBlinkRate&&(b.cursorDiv.style.visibility='hidden')}}function cg(a){a.state.focused||(a.display.input.focus(),ae(a))} +function dg(a){a.state.delayingBlurEvent=!0;setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,pe(a))},100)}function ae(a,b){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1);'nocursor'!=a.options.readOnly&&(a.state.focused||(La(a,'focus',a,b),a.state.focused=!0,l(a.display.wrapper,'CodeMirror-focused'),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),cd&&setTimeout(function(){return a.display.input.reset(!0)},20)),a.display.input.receivedFocus()), +Ug(a))}function pe(a,b){a.state.delayingBlurEvent||(a.state.focused&&(La(a,'blur',a,b),a.state.focused=!1,yd(a.display.wrapper,'CodeMirror-focused')),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150))}function nb(a){a=a.display;for(var b=a.lineDiv.offsetTop,c=0;cRb){var e=d.node.offsetTop+d.node.offsetHeight;var g=e-b;b=e}else g=d.node.getBoundingClientRect(),g=g.bottom-g.top;e=d.line.height- +g;2>g&&(g=oe(a));if(.005e)if(ba(d.line,g),qe(d.line),d.rest)for(g=0;g=e&&(d=la(b,Ta(X(b,c))-a.wrapper.clientHeight),e=c)}return{from:d,to:Math.max(e,d+1)}}function ed(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=De(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,g=d+'px',h=0;hb.top&&(b.top=0);var e=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:c.scroller.scrollTop,g=db(a),h={};b.bottom-b.top>g&&(b.bottom=b.top+g);var k=a.doc.height+ee(c),l=b.topk-d;b.tope+g&&(g=Math.min(b.top,(d?k:b.bottom)-g),g!=e&&(h.scrollTop=g)); +e=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:c.scroller.scrollLeft;a=Hb(a)-(a.options.fixedGutter?c.gutters.offsetWidth:0);if(c=b.right-b.left>a)b.right=b.left+a;10>b.left?h.scrollLeft=0:b.lefta+e-3&&(h.scrollLeft=b.right+(c?0:10)-a);return h}function eg(a,b){null!=b&&(Me(a),a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+b)}function Uf(a){Me(a);var b=a.getCursor();a.curOp.scrollToPos={from:b,to:b,margin:a.options.cursorScrollMargin}} +function nf(a,b,c){null==b&&null==c||Me(a);null!=b&&(a.curOp.scrollLeft=b);null!=c&&(a.curOp.scrollTop=c)}function Me(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=yg(a,b.from),d=yg(a,b.to);Ee(a,c,d,b.margin)}}function Ee(a,b,c,d){b=mf(a,{left:Math.min(b.left,c.left),top:Math.min(b.top,c.top)-d,right:Math.max(b.right,c.right),bottom:Math.max(b.bottom,c.bottom)+d});nf(a,b.scrollLeft,b.scrollTop)}function he(a,b){2>Math.abs(a.doc.scrollTop-b)||(Jg||sg(a,{top:b}),Vf(a,b,!0),Jg&&sg(a), +Fe(a,100))}function Vf(a,b,c){b=Math.min(a.display.scroller.scrollHeight-a.display.scroller.clientHeight,b);if(a.display.scroller.scrollTop!=b||c)a.doc.scrollTop=b,a.display.scrollbars.setScrollTop(b),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b)}function Ne(a,b,c,d){b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth);(c?b==a.doc.scrollLeft:2>Math.abs(a.doc.scrollLeft-b))&&!d||(a.doc.scrollLeft=b,ed(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft= +b),a.display.scrollbars.setScrollLeft(b))}function ce(a){var b=a.display,c=b.gutters.offsetWidth,d=Math.round(a.doc.height+ee(a.display));return{clientHeight:b.scroller.clientHeight,viewHeight:b.wrapper.clientHeight,scrollWidth:b.scroller.scrollWidth,clientWidth:b.scroller.clientWidth,viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?c:0,docHeight:d,scrollHeight:d+mb(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:c}}function Fg(a,b){b||(b=ce(a));var c=a.display.barWidth,d= +a.display.barHeight;Oe(a,b);for(b=0;4>b&&c!=a.display.barWidth||d!=a.display.barHeight;b++)c!=a.display.barWidth&&a.options.lineWrapping&&nb(a),Oe(a,ce(a)),c=a.display.barWidth,d=a.display.barHeight}function Oe(a,b){var c=a.display,d=c.scrollbars.update(b);c.sizer.style.paddingRight=(c.barWidth=d.right)+'px';c.sizer.style.paddingBottom=(c.barHeight=d.bottom)+'px';c.heightForcer.style.borderBottom=d.bottom+'px solid transparent';d.right&&d.bottom?(c.scrollbarFiller.style.display='block',c.scrollbarFiller.style.height= +d.bottom+'px',c.scrollbarFiller.style.width=d.right+'px'):c.scrollbarFiller.style.display='';d.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display='block',c.gutterFiller.style.height=d.bottom+'px',c.gutterFiller.style.width=b.gutterWidth+'px'):c.gutterFiller.style.display=''}function Mf(a){a.display.scrollbars&&(a.display.scrollbars.clear(),a.display.scrollbars.addClass&&yd(a.display.wrapper,a.display.scrollbars.addClass));a.display.scrollbars=new bk[a.options.scrollbarStyle](function(b){a.display.wrapper.insertBefore(b, +a.display.scrollbarFiller);Ea(b,'mousedown',function(){a.state.focused&&setTimeout(function(){return a.display.input.focus()},0)});b.setAttribute('cm-not-content','true')},function(b,c){'horizontal'==c?Ne(a,b):he(a,b)},a);a.display.scrollbars.addClass&&l(a.display.wrapper,a.display.scrollbars.addClass)}function uf(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1, +updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Nj};a=a.curOp;Ld?Ld.ops.push(a):a.ownsGroup=Ld={ops:[a],delayedCallbacks:[]}}function re(a){Tc(a.curOp,function(a){for(var b=0;b=g.viewTo)||g.maxLineChanged&&e.options.lineWrapping;c.update=c.mustUpdate&&new aj(e,c.mustUpdate&&{top:c.scrollTop,ensure:c.scrollToPos},c.forceUpdate)}for(b=0;bq;q++){var r=!1;l=Xe(e,m);var u=n&&n!=m?Xe(e,n):l;l={left:Math.min(l.left,u.left),top:Math.min(l.top,u.top)-p,right:Math.max(l.left,u.left),bottom:Math.max(l.bottom,u.bottom)+p};u=mf(e,l);var t=e.doc.scrollTop,C=e.doc.scrollLeft;null!=u.scrollTop&&(he(e,u.scrollTop),1n.top+q.top?m=!0:n.bottom+q.top>(window.innerHeight||document.documentElement.clientHeight)&&(m=!1),null==m||Qi||(n=d('div','\u200b',null,'position: absolute;\n top: '+(n.top-p.viewOffset-e.display.lineSpace.offsetTop)+'px;\n height: '+(n.bottom-n.top+mb(e)+p.barHeight)+'px;\n left: '+n.left+'px; width: '+Math.max(2,n.right-n.left)+'px;'),e.display.lineSpace.appendChild(n), +n.scrollIntoView(m),e.display.lineSpace.removeChild(n)))}n=c.maybeHiddenMarkers;m=c.maybeUnhiddenMarkers;if(n)for(p=0;pb)&&(e.updateLineNumbers=b);a.curOp.viewChanged=!0;if(b>=e.viewTo)W&&Ia(a.doc,b)e.viewFrom?Nf(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)Nf(a);else if(b<=e.viewFrom){var g=Pe(a,c,c+d,1);g?(e.view=e.view.slice(g.index),e.viewFrom=g.lineN,e.viewTo+=d):Nf(a)}else if(c>=e.viewTo)(g=Pe(a,b,b,-1))?(e.view=e.view.slice(0,g.index),e.viewTo=g.lineN):Nf(a);else{g=Pe(a,b,b,-1);var h=Pe(a,c,c+d,1);g&&h?(e.view= +e.view.slice(0,g.index).concat(Qa(a,g.lineN,h.lineN)).concat(e.view.slice(h.index)),e.viewTo+=d):Nf(a)}if(a=e.externalMeasured)c=e.lineN&&b=d.viewTo||(a=d.view[qg(a,b)],null!=a.node&&(a=a.changes||(a.changes=[]),-1==p(a,c)&&a.push(c)))}function Nf(a){a.display.viewFrom=a.display.viewTo= +a.doc.first;a.display.view=[];a.display.viewOffset=0}function Pe(a,b,c,d){var e=qg(a,b),g=a.display.view;if(!W||c==a.doc.first+a.doc.size)return{index:e,lineN:c};for(var h=a.display.viewFrom,k=0;kd?0:g.length-1))return null;c+=d*g[e-(0>d?1:0)].size;e+=d}return{index:e,lineN:c}}function rg(a){a=a.display.view;for(var b=0,c=0;c=a.display.viewTo)){var c=+new Date+a.options.workTime,d=Td(a,b.highlightFrontier),e=[];b.iter(d.line,Math.min(b.first+b.size,a.display.viewTo+500),function(g){if(d.line>=a.display.viewFrom){var h=g.styles,k=g.text.length>a.options.maxHighlightLength?ld(b.mode,d.state):null,l=ag(a,g,d,!0);k&&(d.state=k);g.styles=l.styles;k=g.styleClasses; +(l=l.classes)?g.styleClasses=l:k&&(g.styleClasses=null);l=!h||h.length!=g.styles.length||k!=l&&(!k||!l||k.bgClass!=l.bgClass||k.textClass!=l.textClass);for(k=0;!l&&kc)return Fe(a,a.options.workDelay),!0});b.highlightFrontier=d.line;b.modeFrontier=Math.max(b.modeFrontier,d.line);e.length&&Pd(a,function(){for(var b= +0;b=d.viewFrom&&c.visible.to<=d.viewTo&&(null==d.updateLineNumbers||d.updateLineNumbers>=d.viewTo)&&d.renderedView==d.view&&0==rg(a))return!1;Gd(a)&&(Nf(a),c.dims=lf(a));var g=e.first+e.size,l=Math.max(c.visible.from-a.options.viewportMargin,e.first),m=Math.min(g,c.visible.to+a.options.viewportMargin);d.viewFroml-d.viewFrom&&(l=Math.max(e.first,d.viewFrom)); +d.viewTo>m&&20>d.viewTo-m&&(m=Math.min(g,d.viewTo));W&&(l=Ia(a.doc,l),m=ib(a.doc,m));e=l!=d.viewFrom||m!=d.viewTo||d.lastWrapHeight!=c.wrapperHeight||d.lastWrapWidth!=c.wrapperWidth;g=a.display;0==g.view.length||l>=g.viewTo||m<=g.viewFrom?(g.view=Qa(a,l,m),g.viewFrom=l):(g.viewFrom>l?g.view=Qa(a,l,g.viewFrom).concat(g.view):g.viewFromm&&(g.view=g.view.slice(0,qg(a,m))));g.viewTo=m;d.viewOffset= +Ta(X(a.doc,d.viewFrom));a.display.mover.style.top=d.viewOffset+'px';m=rg(a);if(!e&&0==m&&!c.force&&d.renderedView==d.view&&(null==d.updateLineNumbers||d.updateLineNumbers>=d.viewTo))return!1;a.hasFocus()?l=null:(l=h())&&k(a.display.lineDiv,l)?(l={activeElt:l},window.getSelection&&(g=window.getSelection(),g.anchorNode&&g.extend&&k(a.display.lineDiv,g.anchorNode)&&(l.anchorNode=g.anchorNode,l.anchorOffset=g.anchorOffset,l.focusNode=g.focusNode,l.focusOffset=g.focusOffset))):l=null;4=a.display.viewFrom&&b.visible.to<=a.display.viewTo)break;if(!zg(a,b))break;nb(a);d=ce(a);xe(a);Fg(a,d);mg(a,d);b.force=!1}b.signal(a,'update',a);if(a.display.viewFrom!=a.display.reportedViewFrom|| +a.display.viewTo!=a.display.reportedViewTo)b.signal(a,'viewportChange',a,a.display.viewFrom,a.display.viewTo),a.display.reportedViewFrom=a.display.viewFrom,a.display.reportedViewTo=a.display.viewTo}function sg(a,b){b=new aj(a,b);if(zg(a,b)){nb(a);Og(a,b);var c=ce(a);xe(a);Fg(a,c);mg(a,c);b.finish()}}function Zb(a,c,d){function e(b){var c=b.nextSibling;cd&&cb&&a.display.currentWheelTarget==b?b.style.display='none':b.parentNode.removeChild(b);return c}var g=a.display,h=a.options.lineNumbers,k=g.lineDiv, +l=k.firstChild,m=g.view;g=g.viewFrom;for(var n=0;ng.clientWidth,k=g.scrollHeight>g.clientHeight;if(d&&h||c&&k){if(c&&cb&&cd){h=b.target;var l=e.view;a:for(;h!=g;h=h.parentNode)for(var m=0;mb?k=Math.max(0,k+b-50):h=Math.min(a.doc.height,h+b+50),sg(a,{top:k,bottom:h})),20>Pi&&(null==e.wheelStartX?(e.wheelStartX=g.scrollLeft,e.wheelStartY=g.scrollTop,e.wheelDX=d,e.wheelDY=c, +setTimeout(function(){if(null!=e.wheelStartX){var a=g.scrollLeft-e.wheelStartX,b=g.scrollTop-e.wheelStartY;a=b&&e.wheelDY&&b/e.wheelDY||a&&e.wheelDX&&a/e.wheelDX;e.wheelStartX=e.wheelStartY=null;a&&(Ue=(Ue*Pi+a)/(Pi+1),++Pi)}},200)):(e.wheelDX+=d,e.wheelDY+=c))):(c&&k&&he(a,Math.max(0,g.scrollTop+c*Ue)),Ne(a,Math.max(0,g.scrollLeft+d*Ue)),(!c||c&&k)&&Ua(b),e.wheelStartX=null)}}function Za(a,b){b=a[b];a.sort(function(a,b){return R(a.from(),b.from())});b=p(a,b);for(var c=1;cR(a,b.from))return a;if(0>=R(a,b.to))return ub(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;a.line==b.to.line&& +(d+=ub(b).ch-b.to.ch);return da(c,d)}function Kb(a,b){for(var c=[],d=0;dg-(a.cm?a.cm.options.historyEventDelay:500)||'*'==b.origin.charAt(0))){if(e.lastOp==d){ef(e.done);var k=E(e.done)}else e.done.length&&!E(e.done).ranges?k=E(e.done):1e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift();e.done.push(c);e.generation=++e.maxGeneration;e.lastModTime=e.lastSelTime=g;e.lastOp=e.lastSelOp=d;e.lastOrigin=e.lastSelOrigin=b.origin;l||La(a,'historyAdded')}function zc(a,b){var c=E(b);c&&c.ranges&&c.equals(a)||b.push(a)}function lh(a,b,c,d){var e=b['spans_'+a.id],g=0;a.iter(Math.max(a.first, +c),Math.min(a.first+a.size,d),function(c){c.markedSpans&&((e||(e=b['spans_'+a.id]={}))[g]=c.markedSpans);++g})}function Wh(a){if(!a)return null;for(var b,c=0;c +R(b,a),d!=0>R(c,a)?(a=b,b=c):d!=0>R(b,c)&&(b=c)),new sa(a,b)):new sa(c||b,b)}function Of(a,b,c,d,e){null==e&&(e=a.cm&&(a.cm.display.shift||a.extend));Ge(a,new B([fh(a.sel.primary(),b,c,e)],0),d)}function Xh(a,b,c){for(var d=[],e=a.cm&&(a.cm.display.shift||a.extend),g=0;gR(b.primary().head, +a.sel.primary().head)?-1:1);Gg(a,Xd(a,b,d,!0));c&&!1===c.scroll||!a.cm||Uf(a.cm)}function Gg(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,Oc(a.cm)),Bb(a,'cursorActivity',a))}function Ji(a){Gg(a,Xd(a,a.sel,null,!1))}function Xd(a,b,c,d){for(var e,g=0;g=b.ch:k.to>b.ch))){if(e&&(La(l,'beforeCursorEnter'),l.explicitlyCleared))if(g.markedSpans){--h;continue}else break;if(l.atomic){if(c){h=l.find(0>d?1:-1);k=void 0;if(0>d?l.inclusiveRight:l.inclusiveLeft)h=Jj(a,h,-d,h&&h.line== +b.line?g:null);if(h&&h.line==b.line&&(k=R(h,c))&&(0>d?0>k:0d?-1:1);if(0>d?l.inclusiveLeft:l.inclusiveRight)c=Jj(a,c,d,c.line==b.line?g:null);return c?He(a,c,b,d,e):null}}}return b}function pf(a,b,c,d,e){d=d||1;b=He(a,b,c,d,e)||!e&&He(a,b,c,d,!0)||He(a,b,c,-d,e)||!e&&He(a,b,c,-d,!0);return b?b:(a.cantEdit=!0,da(a.first,0))}function Jj(a,b,c,d){return 0>c&&0==b.ch?b.line>a.first?ma(a,da(b.line-1)):null:0a.lastLine())){if(b.from.linee&&(b={from:b.from,to:da(e,X(a,e).text.length),text:[b.text[0]],origin:b.origin});b.removed=ka(a,b.from,b.to);c||(c=Kb(a,b));a.cm?gh(a.cm,b,d):kh(a,b,d);Zh(a,c,Zg)}}function gh(a,b,c){var d=a.doc,e=a.display,g=b.from,h=b.to,k=!1,l=g.line;a.options.lineWrapping||(l=N(Wa(X(d,g.line))),d.iter(l,h.line+1,function(a){if(a==e.maxLine)return k=!0}));-1e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,k=!1)}),k&&(a.curOp.updateMaxLine=!0));Ub(d,g.line);Fe(a,400);c=b.text.length-(h.line-g.line)-1;b.full?ud(a):g.line!=h.line||1!=b.text.length||Vh(a.doc,b)?ud(a,g.line,h.line+1,c):lg(a,g.line,'text');c=cc(a,'changes');if((d=cc(a,'change'))||c)b={from:g,to:h,text:b.text,removed:b.removed,origin:b.origin},d&&Bb(a,'change',a,b),c&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(b); +a.display.selForContextMenu=null}function Mb(a,b,c,d,e){d||(d=c);0>R(d,c)&&(d=[d,c],c=d[0],d=d[1]);'string'==typeof b&&(b=a.splitLines(b));Hg(a,{from:c,to:d,text:b,origin:e})}function Ag(a,b,c,d){c=R(g.from,E(d).to);){var h=d.pop();if(0>R(h.from,g.from)){g.from=h.from;break}}d.push(g)}Pd(a,function(){for(var b=d.length- +1;0<=b;b--)Mb(a.doc,'',d[b].from,d[b].to,'+delete');Uf(a)})}function ei(a,b,c){b=D(a.text,b+c,c);return 0>b||b>a.text.length?null:b}function fi(a,b,c){a=ei(a,b.ch,c);return null==a?null:new da(b.line,a,0>c?'after':'before')}function xh(a,b,c,d,e){if(a&&(a=lc(c,b.doc.direction))){a=0>e?E(a):a[0];var g=0>e==(1==a.level)?'after':'before';if(0e?c.text.length-1:0;var l=vc(b,h,k).top;k=Q(function(a){return vc(b,h,a).top==l},0>e==(1==a.level)?a.from: +a.to-1,k);'before'==g&&(k=ei(c,k,1))}else k=0>e?a.to:a.from;return new da(d,k,g)}return new da(d,0>e?c.text.length:0,0>e?'before':'after')}function gi(a,b,c,d){var e=lc(b,a.doc.direction);if(!e)return fi(b,c,d);c.ch>=b.text.length?(c.ch=b.text.length,c.sticky='before'):0>=c.ch&&(c.ch=0,c.sticky='after');var g=rb(e,c.ch,c.sticky),h=e[g];if('ltr'==a.doc.direction&&0==h.level%2&&(0c.ch:h.fromd,q=k(c,p?1:-1);if(null!=q&&(p?q<=h.to&&q<=n.end:q>=h.from&&q>=n.begin))return new da(c.line,q,p?'before':'after')}h=function(a,b,d){for(var g=function(a,b){return b?new da(c.line,k(a,1),'before'):new da(c.line,a,'after')};0<=a&&aRb&&27==a.keyCode&&(a.returnValue=!1);var b=a.keyCode;this.display.shift=16==b||a.shiftKey;var c=si(this,a);ue&&(Nk=c?b:null,!c&&88==b&&!Vc&&(cb?a.metaKey:a.ctrlKey)&&this.replaceSelection('',null,'cut'));18!=b||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||Ki(this)}}function Ki(a){function b(a){18!=a.keyCode&&a.altKey||(yd(c,'CodeMirror-crosshair'),vb(document, +'keyup',b),vb(document,'mouseover',b))}var c=a.display.lineDiv;l(c,'CodeMirror-crosshair');Ea(document,'keyup',b);Ea(document,'mouseover',b)}function ti(a){16==a.keyCode&&(this.doc.sel.shift=!1);Ka(this,a)}function Sf(a){if(!(ne(this.display,a)||Ka(this,a)||a.ctrlKey&&!a.altKey||cb&&a.metaKey)){var b=a.keyCode,c=a.charCode;if(ue&&b==Nk)Nk=null,Ua(a);else if(!ue||a.which&&!(10>a.which)||!si(this,a))if(b=String.fromCharCode(null==c?b:c),'\b'!=b&&!pj(this,a,b))this.display.input.onKeyPress(a)}}function Be(a, +b){var c=+new Date;if(Uj&&Uj.compare(c,a,b))return bb=Uj=null,'triple';if(bb&&bb.compare(c,a,b))return Uj=new Ok(c,a,b),bb=null,'double';bb=new Ok(c,a,b);Uj=null;return'single'}function ui(a){var b=this.display;if(!(Ka(this,a)||b.activeTouch&&b.input.supportsTouch()))if(b.input.ensurePolled(),b.shift=a.shiftKey,ne(b,a))cd||(b.scroller.draggable=!1,setTimeout(function(){return b.scroller.draggable=!0},100));else if(!wi(this,a,'gutterClick',!0)){var c=Db(this,a),d=Bc(a),e=c?Be(c,d):'single';window.focus(); +1==d&&this.state.selectingText&&this.state.selectingText(a);c&&qj(this,d,c,e,a)||(1==d?c?Li(this,c,e,a):(a.target||a.srcElement)==b.scroller&&Ua(a):2==d?(c&&Of(this.doc,c),setTimeout(function(){return b.input.focus()},20)):3==d&&(wj?bj(this,a):dg(this)))}}function qj(a,b,c,d,e){var g='Click';'double'==d?g='Double'+g:'triple'==d&&(g='Triple'+g);return og(a,ci((1==b?'Left':2==b?'Middle':'Right')+g,e),e,function(b){'string'==typeof b&&(b=Tj[b]);if(!b)return!1;var d=!1;try{a.isReadOnly()&&(a.state.suppressEdits= +!0),d=b(a,c)!=fd}finally{a.state.suppressEdits=!1}return d})}function Li(a,b,c,d){gd?setTimeout(q(cg,a),0):a.curOp.focus=h();var e=a.getOption('configureMouse');e=e?e(a,c,d):{};null==e.unit&&(e.unit=(xd?d.shiftKey&&d.metaKey:d.altKey)?'rectangle':'single'==c?'char':'double'==c?'word':'line');if(null==e.extend||a.doc.extend)e.extend=a.doc.extend||d.shiftKey;null==e.addNew&&(e.addNew=cb?d.metaKey:d.ctrlKey);null==e.moveOnDrag&&(e.moveOnDrag=!(cb?d.altKey:d.ctrlKey));var g=a.doc.sel,k;a.options.dragDrop&& +zb&&!a.isReadOnly()&&'single'==c&&-1<(k=g.contains(b))&&(0>R((k=g.ranges[k]).from(),b)||0b.xRel)?rj(a,d,b,e):vi(a,d,b,e)}function rj(a,b,c,d){var e=a.display,g=!1,h=ie(a,function(b){cd&&(e.scroller.draggable=!1);a.state.draggingText=!1;vb(e.wrapper.ownerDocument,'mouseup',h);vb(e.wrapper.ownerDocument,'mousemove',k);vb(e.scroller,'dragstart',l);vb(e.scroller,'drop',h);g||(Ua(b),d.addNew||Of(a.doc,c,null,null,d.extend),cd||gd&&9==Rb?setTimeout(function(){e.wrapper.ownerDocument.body.focus(); +e.input.focus()},20):e.input.focus())}),k=function(a){g=g||10<=Math.abs(b.clientX-a.clientX)+Math.abs(b.clientY-a.clientY)},l=function(){return g=!0};cd&&(e.scroller.draggable=!0);a.state.draggingText=h;h.copy=!d.moveOnDrag;e.scroller.dragDrop&&e.scroller.dragDrop();Ea(e.wrapper.ownerDocument,'mouseup',h);Ea(e.wrapper.ownerDocument,'mousemove',k);Ea(e.scroller,'dragstart',l);Ea(e.scroller,'drop',h);dg(a);setTimeout(function(){return e.input.focus()},20)}function $i(a,b,c){if('char'==c)return new sa(b, +b);if('word'==c)return a.findWordAt(b);if('line'==c)return new sa(da(b.line,0),ma(a.doc,da(b.line+1,0)));a=c(a,b);return new sa(a.from,a.to)}function vi(a,b,c,d){function e(b){if(0!=R(C,b))if(C=b,'rectangle'==d.unit){var e=[],h=a.options.tabSize,k=g(X(n,c.line).text,c.ch,h),l=g(X(n,b.line).text,b.ch,h),m=Math.min(k,l);k=Math.max(k,l);l=Math.min(c.line,b.line);for(var q=Math.min(a.lastLine(),Math.max(c.line,b.line));l<=q;l++){var D=X(n,l).text,v=r(D,m,h);m==k?e.push(new sa(da(l,v),da(l,v))):D.length> +v&&e.push(new sa(da(l,v),da(l,r(D,k,h))))}e.length||e.push(new sa(c,c));Ge(n,Za(p.ranges.slice(0,u).concat(e),u),{origin:'*mouse',scroll:!1});a.scrollIntoView(b)}else e=t,m=$i(a,b,d.unit),b=e.anchor,0=l.to||g.lineD.bottom?20:0;p&&setTimeout(ie(a,function(){v==c&&(m.scroller.scrollTop+=p,k(b))}),50)}}function l(b){a.state.selectingText=!1;v=Infinity;Ua(b);m.input.focus();vb(m.wrapper.ownerDocument,'mousemove',S);vb(m.wrapper.ownerDocument,'mouseup',w);n.history.lastSelOrigin=null}var m=a.display,n=a.doc;Ua(b);var p=n.sel,q=p.ranges;if(d.addNew&&!d.extend){var u=n.sel.contains(c);var t=-1g:0=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&Ua(b);d=a.display;var h=d.lineDiv.getBoundingClientRect();if(g>h.bottom||!cc(a,c))return Yb(b);g-=h.top-d.viewOffset;for(h=0;h< +a.options.gutters.length;++h){var k=d.gutters.childNodes[h];if(k&&k.getBoundingClientRect().right>=e)return e=la(a.doc,g),La(a,c,a,e,a.options.gutters[h],b),Yb(b)}}function bj(a,b){var c;(c=ne(a.display,b))||(c=cc(a,'gutterContextMenu')?wi(a,b,'gutterContextMenu',!1):!1);if(!c&&!Ka(a,b,'contextmenu'))a.display.input.onContextMenu(b)}function tj(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,'')+a.options.theme.replace(/(^|\s)\s*/g,' cm-s-');tf(a)}function Qd(a){tg(a); +ud(a);ed(a)}function Kj(a,b,c){!b!=!(c&&c!=Dj)&&(c=a.display.dragFunctions,b=b?Ea:vb,b(a.display.scroller,'dragstart',c.start),b(a.display.scroller,'dragenter',c.enter),b(a.display.scroller,'dragover',c.over),b(a.display.scroller,'dragleave',c.leave),b(a.display.scroller,'drop',c.drop))}function Lj(a){a.options.lineWrapping?(l(a.display.wrapper,'CodeMirror-wrap'),a.display.sizer.style.minWidth='',a.display.sizerWidth=null):(yd(a.display.wrapper,'CodeMirror-wrap'),oc(a));$c(a);ud(a);tf(a);setTimeout(function(){return Fg(a)}, +100)}function Bd(a,b){var c=this;if(!(this instanceof Bd))return new Bd(a,b);this.options=b=b?m(b):{};m(ql,b,!1);md(b);var d=b.value;'string'==typeof d?d=new Re(d,b.mode,null,b.lineSeparator,b.direction):b.mode&&(d.modeOption=b.mode);this.doc=d;var e=new Bd.inputStyles[b.inputStyle](this);a=this.display=new M(a,d,e);a.wrapper.CodeMirror=this;tg(this);tj(this);b.lineWrapping&&(this.display.wrapper.className+=' CodeMirror-wrap');Mf(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1, +focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Th,keySeq:null,specialChars:null};b.autofocus&&!ki&&a.input.focus();gd&&11>Rb&&setTimeout(function(){return c.display.input.reset(!0)},20);cj(this);pl||(Ie(),pl=!0);uf(this);this.curOp.forceUpdate=!0;ug(this,d);b.autofocus&&!ki||this.hasFocus()?setTimeout(q(ae,this),20):pe(this);for(var g in ik)if(ik.hasOwnProperty(g))ik[g](c,b[g],Dj);Gd(this);b.finishInit&&b.finishInit(this);for(d=0;dRb?Ea(g.scroller,'dblclick',ie(a,function(b){if(!Ka(a,b)){var c=Db(a,b);!c||wi(a,b, +'gutterClick',!0)||ne(a.display,b)||(Ua(b),b=a.findWordAt(c),Of(a.doc,b.anchor,b.head))}})):Ea(g.scroller,'dblclick',function(b){return Ka(a,b)||Ua(b)});wj||Ea(g.scroller,'contextmenu',function(b){return bj(a,b)});var h,k={end:0};Ea(g.scroller,'touchstart',function(b){var c;if(c=!Ka(a,b))1!=b.touches.length?c=!1:(c=b.touches[0],c=1>=c.radiusX&&1>=c.radiusY),c=!c;c&&!wi(a,b,'gutterClick',!0)&&(g.input.ensurePolled(),clearTimeout(h),c=+new Date,g.activeTouch={start:c,moved:!1,prev:300>=c-k.end?k:null}, +1==b.touches.length&&(g.activeTouch.left=b.touches[0].pageX,g.activeTouch.top=b.touches[0].pageY))});Ea(g.scroller,'touchmove',function(){g.activeTouch&&(g.activeTouch.moved=!0)});Ea(g.scroller,'touchend',function(d){var e=g.activeTouch;if(e&&!ne(g,d)&&null!=e.left&&!e.moved&&300>new Date-e.start){var h=a.coordsChar(g.activeTouch,'page');e=!e.prev||c(e,e.prev)?new sa(h,h):!e.prev.prev||c(e,e.prev.prev)?a.findWordAt(h):new sa(da(h.line,0),ma(a.doc,da(h.line+1,0)));a.setSelection(e.anchor,e.head);a.focus(); +Ua(d)}b()});Ea(g.scroller,'touchcancel',b);Ea(g.scroller,'scroll',function(){g.scroller.clientHeight&&(he(a,g.scroller.scrollTop),Ne(a,g.scroller.scrollLeft,!0),La(a,'scroll',a))});Ea(g.scroller,'mousewheel',function(b){return qb(a,b)});Ea(g.scroller,'DOMMouseScroll',function(b){return qb(a,b)});Ea(g.wrapper,'scroll',function(){return g.wrapper.scrollTop=g.wrapper.scrollLeft=0});g.dragFunctions={enter:function(b){Ka(a,b)||Hd(b)},over:function(b){if(!Ka(a,b)){var c=Db(a,b);if(c){var g=document.createDocumentFragment(); +Ng(a,c,g);a.display.dragCursor||(a.display.dragCursor=d('div',null,'CodeMirror-cursors CodeMirror-dragcursors'),a.display.lineSpace.insertBefore(a.display.dragCursor,a.display.cursorDiv));e(a.display.dragCursor,g)}Hd(b)}},start:function(b){if(gd&&(!a.state.draggingText||100>+new Date-Cj))Hd(b);else if(!Ka(a,b)&&!ne(a.display,b)&&(b.dataTransfer.setData('Text',a.getSelection()),b.dataTransfer.effectAllowed='copyMove',b.dataTransfer.setDragImage&&!Ai)){var c=d('img',null,null,'position: fixed; left: 0; top: 0;'); +c.src='data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';ue&&(c.width=c.height=1,a.display.wrapper.appendChild(c),c._top=c.offsetTop);b.dataTransfer.setDragImage(c,0,0);ue&&c.parentNode.removeChild(c)}},drop:ie(a,xf),leave:function(b){Ka(a,b)||Qf(a)}};var l=g.input.getField();Ea(l,'keyup',function(b){return ti.call(a,b)});Ea(l,'keydown',ie(a,hi));Ea(l,'keypress',ie(a,Sf));Ea(l,'focus',function(b){return ae(a,b)});Ea(l,'blur',function(b){return pe(a,b)})}function yh(a,b,c, +d){var e=a.doc,h;null==c&&(c='add');'smart'==c&&(e.mode.indent?h=Td(a,b).state:c='prev');var k=a.options.tabSize,l=X(e,b),m=g(l.text,null,k);l.stateAfter&&(l.stateAfter=null);var n=l.text.match(/^\s*/)[0];if(!d&&!/\S/.test(l.text)){var p=0;c='not'}else if('smart'==c&&(p=e.mode.indent(h,l.text.slice(n.length),l.text),p==fd||150e.first?g(X(e,b-1).text,null,k):0:'add'==c?p=m+a.options.indentUnit:'subtract'==c?p=m-a.options.indentUnit:'number'==typeof c&&(p=m+ +c);p=Math.max(0,p);c='';d=0;if(a.options.indentWithTabs)for(a=Math.floor(p/k);a;--a)d+=k,c+='\t';d=a.first+a.size?d=!1:(b=new da(d,b.ch,b.sticky),d=l=X(a,d));if(d)b=xh(e,a.cm,l,b.line,c);else return!1}else b=g;return!0}var h=b,k=c,l=X(a,b.line);if('char'==d)g();else if('column'==d)g(!0);else if('word'==d||'group'==d){var m=null;d='group'==d;for(var n=a.cm&&a.cm.getHelper(b,'wordChars'),p=!0;!(0>c)||g(!p);p=!1){var q=l.text.charAt(b.ch)|| +'\n';q=H(q,n)?'w':d&&'\n'==q?'n':!d||/\s/.test(q)?null:'p';!d||p||q||(q='s');if(m&&m!=q){0>c&&(c=1,g(),b.sticky='after');break}q&&(m=q);if(0c?0>=h:h>=e.height){b.hitSide=!0;break}h+=5*c}return b}function Ig(a,b){var c=Ga(a,b.line);if(!c||c.hidden)return null;var d=X(a.doc,b.line);c=Qb(c,d,b.line);a=lc(d,a.doc.direction);d='left';a&&(d=rb(a,b.ch)%2?'right':'left');b=tb(c.map,b.ch,d);b.offset='right'==b.collapse?b.end:b.start;return b}function yi(a){for(;a;a=a.parentNode)if(/CodeMirror-gutter-wrapper/.test(a.className))return!0;return!1}function jh(a,b){b&&(a.bad=!0);return a}function ii(a,b,c,d,e){function g(a){return function(b){return b.id== +a}}function h(){n&&(m+=p,q&&(m+=p),n=q=!1)}function k(a){a&&(h(),m+=a)}function l(b){if(1==b.nodeType){var c=b.getAttribute('cm-text');if(c)k(c);else{c=b.getAttribute('cm-marker');var m;if(c)b=a.findMarks(da(d,0),da(e+1,0),g(+c)),b.length&&(m=b[0].find(0))&&k(ka(a.doc,m.from,m.to).join(p));else if('false'!=b.getAttribute('contenteditable')&&(m=/^(pre|div|p|li|table|br)$/i.test(b.nodeName),/^br$/i.test(b.nodeName)||0!=b.textContent.length)){m&&h();for(c=0;ce?m.map:n[e],h=0;he?a.line:a.rest[e]);e=g[h]+d;if(0>d||k!=b)e=g[h+(d?1:0)];return da(c,e)}}}var e=a.text.firstChild,g=!1;if(!b||!k(e,b))return jh(da(N(a.line),0),!0);if(b==e&&(g=!0,b=e.childNodes[c],c=0,!b))return c=a.rest?E(a.rest):a.line,jh(da(N(c),c.text.length),g);var h=3==b.nodeType? +b:null,l=b;h||1!=b.childNodes.length||3!=b.firstChild.nodeType||(h=b.firstChild,c&&(c=h.nodeValue.length));for(;l.parentNode!=e;)l=l.parentNode;var m=a.measure,n=m.maps;if(b=d(h,l,c))return jh(b,g);e=l.nextSibling;for(h=h?h.nodeValue.length-c:0;e;e=e.nextSibling){if(b=d(e,e.firstChild,0))return jh(da(b.line,b.ch-h),g);h+=e.textContent.length}for(l=l.previousSibling;l;l=l.previousSibling){if(b=d(l,l.firstChild,-1))return jh(da(b.line,b.ch+c),g);c+=l.textContent.length}}var yf=navigator.userAgent,ji= +navigator.platform,Jg=/gecko\/\d/i.test(yf),ph=/MSIE \d/.test(yf),Oi=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(yf),qh=/Edge\/(\d+)/.exec(yf),gd=ph||Oi||qh,Rb=gd&&(ph?document.documentMode||6:+(qh||Oi)[1]),cd=!qh&&/WebKit\//.test(yf),Tf=cd&&/Qt\/\d+\.\d+/.test(yf),gg=!qh&&/Chrome\//.test(yf),ue=/Opera\//.test(yf),Ai=/Apple Computer/.test(navigator.vendor),Zf=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(yf),Qi=/PhantomJS/.test(yf),wc=!qh&&/AppleWebKit/.test(yf)&&/Mobile\/\w+/.test(yf),Ri=/Android/.test(yf), +ki=wc||Ri||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(yf),cb=wc||/Mac/.test(ji),xd=/\bCrOS\b/.test(yf),zh=/win/i.test(ji),Sh=ue&&yf.match(/Version\/(\d*\.\d*)/);Sh&&(Sh=Number(Sh[1]));Sh&&15<=Sh&&(ue=!1,cd=!0);var Lb=cb&&(Tf||ue&&(null==Sh||12.11>Sh)),wj=Jg||gd&&9<=Rb,yd=function(b,c){var d=b.className;if(c=a(c).exec(d)){var e=d.slice(c.index+c[0].length);b.className=d.slice(0,c.index)+(e?c[1]+e:'')}};var $a=document.createRange?function(a,b,c,d){var e=document.createRange();e.setEnd(d|| +a,c);e.setStart(a,b);return e}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(Wj){return d}d.collapse(!0);d.moveEnd('character',c);d.moveStart('character',b);return d};var jf=function(a){a.select()};wc?jf=function(a){a.selectionStart=0;a.selectionEnd=a.value.length}:gd&&(jf=function(a){try{a.select()}catch(ec){}});var Th=function(){this.id=null};Th.prototype.set=function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)};var fd={toString:function(){return'CodeMirror.Pass'}}, +Zg={scroll:!1},oj={origin:'*mouse'},pi={origin:'+move'},Wi=[''],Id=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,V=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/, +Z=!1,W=!1,Da=null,Ya=function(){function a(a){return 247>=a?'bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN'.charAt(a):1424<=a&&1524>=a?'R':1536<=a&&1785>=a?'nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111'.charAt(a- +1536):1774<=a&&2220>=a?'r':8192<=a&&8203>=a?'w':8204==a?'b':'L'}function b(a,b,c){this.level=a;this.from=b;this.to=c}var c=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,d=/[stwN]/,e=/[LRr]/,g=/[Lb1n]/,h=/[1n]/;return function(k,l){var m='ltr'==l?'L':'R';if(0==k.length||'ltr'==l&&!c.test(k))return!1;for(var n=k.length,p=[],q=0;qRb)return!1;var a=d('div');return'draggable'in a||'dragDrop'in a}(),gc,Ob,yb=3!='\n\nb'.split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf('\n',b);-1==e&&(e=a.length);var g=a.slice(b,'\r'==a.charAt(e-1)?e-1:e),h=g.indexOf('\r');-1!=h?(c.push(g.slice(0,h)),b+= +h+1):(c.push(g),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)},bd=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(ec){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(jg){}return b&&b.parentElement()==a?0!=b.compareEndPoints('StartToEnd',b):!1},Vc=function(){var a=d('div');if('oncopy'in a)return!0;a.setAttribute('oncopy','return;');return'function'==typeof a.oncopy}(),Ed=null,rc={},ke={},Qg={},yc=function(a,b,c){this.pos=this.start= +0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=0;this.lineOracle=c};yc.prototype.eol=function(){return this.pos>=this.string.length};yc.prototype.sol=function(){return this.pos==this.lineStart};yc.prototype.peek=function(){return this.string.charAt(this.pos)||void 0};yc.prototype.next=function(){if(this.posb};yc.prototype.eatSpace=function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a};yc.prototype.skipToEnd=function(){this.pos=this.string.length};yc.prototype.skipTo=function(a){a=this.string.indexOf(a,this.pos);if(-1this.maxLookAhead&&(this.maxLookAhead=a);return b};wd.prototype.baseToken=function(a){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=a;)this.baseTokenPos+=2;var b=this.baseTokens[this.baseTokenPos+ +1];return{type:b&&b.replace(/( |^)overlay .*/,''),size:this.baseTokens[this.baseTokenPos]-a}};wd.prototype.nextLine=function(){this.line++;0Rb&&(this.horiz.style.minHeight=this.vert.style.minWidth='18px')};Wc.prototype.update=function(a){var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+1,d=a.nativeBarWidth;c?(this.vert.style.display='block',this.vert.style.bottom=b?d+'px':'0',this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+(a.viewHeight-(b?d:0)))+'px'):(this.vert.style.display= +'',this.vert.firstChild.style.height='0');b?(this.horiz.style.display='block',this.horiz.style.right=c?d+'px':'0',this.horiz.style.left=a.barLeft+'px',this.horiz.firstChild.style.width=Math.max(0,a.scrollWidth-a.clientWidth+(a.viewWidth-a.barLeft-(c?d:0)))+'px'):(this.horiz.style.display='',this.horiz.firstChild.style.width='0');!this.checkedZeroWidth&&0=R(a,d.to()))return c}return-1};var sa=function(a,b){this.anchor=a;this.head=b};sa.prototype.from=function(){return oa(this.anchor, +this.head)};sa.prototype.to=function(){return fa(this.anchor,this.head)};sa.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};bi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=a,d=a+b;cthis.size- +b&&(1=this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5);b=new Pf(b);if(a.parent){a.size-=b.size;a.height-=b.height;var c=p(a.parent.children,a);a.parent.children.splice(c+1,0,b)}else c=new Pf(a.children),c.parent=a,a.children=[c,b],a=c;b.parent=a.parent}while(10a.display.maxLineLength&&(a.display.maxLine=g,a.display.maxLineLength=h,a.display.maxLineChanged=!0);null!=c&&a&&this.collapsed&&ud(a,c,d+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Ji(a.doc));a&&Bb(a,'markerCleared',a,this,c,d);b&&re(a);this.parent&&this.parent.clear()}};lb.prototype.find= +function(a,b){null==a&&'bookmark'==this.type&&(a=1);for(var c,d,e=0;eR(k.head,k.anchor),a[g]=new sa(k?l:h,k?h:l)):a[g]=new sa(h,h)}a=new B(a,this.sel.primIndex)}b=a;for(a=d.length-1;0<=a;a--)Hg(this,d[a]);b?Yh(this,b):this.cm&&Uf(this.cm)}),undo:Pc(function(){Yf(this, +'undo')}),redo:Pc(function(){Yf(this,'redo')}),undoSelection:Pc(function(){Yf(this,'undo',!0)}),redoSelection:Pc(function(){Yf(this,'redo',!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){a=ma(this,a);b=ma(this,b);var d=[],e=a.line;this.iter(a.line,b.line+1,function(g){if(g=g.markedSpans)for(var h= +0;h=k.to||null==k.from&&e!=a.line||null!=k.from&&e==b.line&&k.from>=b.ch||c&&!c(k.marker)||d.push(k.marker.parent||k.marker)}++e});return d},getAllMarks:function(){var a=[];this.iter(function(b){if(b=b.markedSpans)for(var c=0;ca)return b=a,!0;a-=e;++c});return ma(this, +da(c,b))},indexFromPos:function(a){a=ma(this,a);var b=a.ch;if(a.linea.ch)return 0;var c=this.lineSeparator().length;this.iter(this.first,a.line,function(a){b+=a.text.length+c});return b},copy:function(a){var b=new Re(ja(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);b.scrollTop=this.scrollTop;b.scrollLeft=this.scrollLeft;b.sel=this.sel;b.extend=!1;a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory()));return b}, +linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from);null!=a.to&&a.toSb;Sb++)Ui[Sb+48]=Ui[Sb+96]=String(Sb); +for(var Ej=65;90>=Ej;Ej++)Ui[Ej]=String.fromCharCode(Ej);for(var Xj=1;12>=Xj;Xj++)Ui[Xj+111]=Ui[Xj+63235]='F'+Xj;var Sj={basic:{Left:'goCharLeft',Right:'goCharRight',Up:'goLineUp',Down:'goLineDown',End:'goLineEnd',Home:'goLineStartSmart',PageUp:'goPageUp',PageDown:'goPageDown',Delete:'delCharAfter',Backspace:'delCharBefore','Shift-Backspace':'delCharBefore',Tab:'defaultTab','Shift-Tab':'indentAuto',Enter:'newlineAndIndent',Insert:'toggleOverwrite',Esc:'singleSelection'},pcDefault:{'Ctrl-A':'selectAll', 'Ctrl-D':'deleteLine','Ctrl-Z':'undo','Shift-Ctrl-Z':'redo','Ctrl-Y':'redo','Ctrl-Home':'goDocStart','Ctrl-End':'goDocEnd','Ctrl-Up':'goLineUp','Ctrl-Down':'goLineDown','Ctrl-Left':'goGroupLeft','Ctrl-Right':'goGroupRight','Alt-Left':'goLineStart','Alt-Right':'goLineEnd','Ctrl-Backspace':'delGroupBefore','Ctrl-Delete':'delGroupAfter','Ctrl-S':'save','Ctrl-F':'find','Ctrl-G':'findNext','Shift-Ctrl-G':'findPrev','Shift-Ctrl-F':'replace','Shift-Ctrl-R':'replaceAll','Ctrl-[':'indentLess','Ctrl-]':'indentMore', 'Ctrl-U':'undoSelection','Shift-Ctrl-U':'redoSelection','Alt-U':'redoSelection',fallthrough:'basic'},emacsy:{'Ctrl-F':'goCharRight','Ctrl-B':'goCharLeft','Ctrl-P':'goLineUp','Ctrl-N':'goLineDown','Alt-F':'goWordRight','Alt-B':'goWordLeft','Ctrl-A':'goLineStart','Ctrl-E':'goLineEnd','Ctrl-V':'goPageDown','Shift-Ctrl-V':'goPageUp','Ctrl-D':'delCharAfter','Ctrl-H':'delCharBefore','Alt-D':'delWordAfter','Alt-Backspace':'delWordBefore','Ctrl-K':'killLine','Ctrl-T':'transposeChars','Ctrl-O':'openLine'}, macDefault:{'Cmd-A':'selectAll','Cmd-D':'deleteLine','Cmd-Z':'undo','Shift-Cmd-Z':'redo','Cmd-Y':'redo','Cmd-Home':'goDocStart','Cmd-Up':'goDocStart','Cmd-End':'goDocEnd','Cmd-Down':'goDocEnd','Alt-Left':'goGroupLeft','Alt-Right':'goGroupRight','Cmd-Left':'goLineLeft','Cmd-Right':'goLineRight','Alt-Backspace':'delGroupBefore','Ctrl-Alt-Backspace':'delGroupAfter','Alt-Delete':'delGroupAfter','Cmd-S':'save','Cmd-F':'find','Cmd-G':'findNext','Shift-Cmd-G':'findPrev','Cmd-Alt-F':'replace','Shift-Cmd-Alt-F':'replaceAll', -'Cmd-[':'indentLess','Cmd-]':'indentMore','Cmd-Backspace':'delWrappedLineLeft','Cmd-Delete':'delWrappedLineRight','Cmd-U':'undoSelection','Shift-Cmd-U':'redoSelection','Ctrl-Up':'goDocStart','Ctrl-Down':'goDocEnd',fallthrough:['basic','emacsy']}};Tj['default']=Lc?Tj.macDefault:Tj.pcDefault;var Uj={selectAll:Zi,singleSelection:function(a){return a.setSelection(a.getCursor('anchor'),a.getCursor('head'),Ke)},killLine:function(a){return hg(a,function(b){if(b.empty()){var c=T(a.doc,b.head.line).text.length; -return b.head.ch==c&&b.head.linea.doc.first){var h=T(a.doc,e.line-1).text;h&&(e=new ba(e.line,1),a.replaceRange(g.charAt(0)+a.doc.lineSeparator()+h.charAt(h.length-1),ba(e.line-1,h.length-1),e,'+transpose'))}c.push(new Ia(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){return Sd(a,function(){for(var b=a.listSelections(), -c=b.length-1;0<=c;c--)a.replaceRange(a.doc.lineSeparator(),b[c].anchor,b[c].head,'+input');b=a.listSelections();for(c=0;ca&&0==L(b,this.pos)&&c==this.button};var Xa,Vj,Fj={toString:function(){return'CodeMirror.Init'}}, -pl={},hk={};ce.defaults=pl;ce.optionHandlers=hk;var Ok=[];ce.defineInitHook=function(a){return Ok.push(a)};var ad=null,Cb=function(a){this.cm=a;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new Zh;this.composing=null;this.gracePeriod=!1;this.readDOMTimeout=null};Cb.prototype.init=function(a){function b(a){if(!Qa(e,a)){if(e.somethingSelected())ad={lineWise:!1,text:e.getSelections()},'cut'==a.type&&e.replaceSelection('',null,'cut');else if(e.options.lineWiseCopyCut){var b= -cj(e);ad={lineWise:!0,text:b.text};'cut'==a.type&&e.operation(function(){e.setSelections(b.ranges,0,Ke);e.replaceSelection('',null,'cut')})}else return;if(a.clipboardData){a.clipboardData.clearData();var c=ad.text.join('\n');a.clipboardData.setData('Text',c);if(a.clipboardData.getData('Text')==c){a.preventDefault();return}}var h=Uh();a=h.firstChild;e.display.lineSpace.insertBefore(h,e.display.lineSpace.firstChild);a.value=ad.text.join('\n');var k=document.activeElement;zi(a);setTimeout(function(){e.display.lineSpace.removeChild(h); -k.focus();k==g&&d.showPrimarySelection()},50)}}var c=this,d=this,e=d.cm,g=d.div=a.lineDiv;dj(g,e.options.spellcheck);Ca(g,'paste',function(a){Qa(e,a)||vj(a,e)||11>=lb&&setTimeout(yd(e,function(){return c.updateFromDOM()}),20)});Ca(g,'compositionstart',function(a){c.composing={data:a.data,done:!1}});Ca(g,'compositionupdate',function(a){c.composing||(c.composing={data:a.data,done:!1})});Ca(g,'compositionend',function(a){c.composing&&(a.data!=c.composing.data&&c.readFromDOMSoon(),c.composing.done=!0)}); -Ca(g,'touchstart',function(){return d.forceCompositionEnd()});Ca(g,'input',function(){c.composing||c.readFromDOMSoon()});Ca(g,'copy',b);Ca(g,'cut',b)};Cb.prototype.prepareSelection=function(){var a=dg(this.cm,!1);a.focus=this.cm.state.focused;return a};Cb.prototype.showSelection=function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))};Cb.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()};Cb.prototype.showPrimarySelection= -function(){var a=this.getSelection(),b=this.cm,c=b.doc.sel.primary(),d=c.from();c=c.to();if(b.display.viewTo==b.display.viewFrom||d.line>=b.display.viewTo||c.line=b.display.viewFrom&&Vh(b,d)||{node:e[0].measure.map[2],offset:0},c=c.linea.firstLine()&&(d=ba(d.line-1,T(a.doc,d.line-1).length));e.ch==T(a.doc,e.line).text.length&&e.lineb.viewTo-1)return!1;var g;d.line==b.viewFrom||0==(g=Of(a,d.line))?(c=N(b.view[0].line),g=b.view[0].node):(c=N(b.view[g].line),g=b.view[g-1].node.nextSibling);var h=Of(a,e.line);h==b.view.length-1? -(e=b.viewTo-1,b=b.lineDiv.lastChild):(e=N(b.view[h+1].line)-1,b=b.view[h+1].node.previousSibling);if(!g)return!1;b=a.doc.splitLines(ti(a,g,b,c,e));for(g=fa(a.doc,ba(c,0),ba(e,T(a.doc,e).text.length));1d.ch&&l.charCodeAt(l.length-h-1)==m.charCodeAt(m.length-h-1);)k--,h++;b[b.length-1]=l.slice(0,l.length-h).replace(/^\u200b+/,'');b[0]=b[0].slice(k).replace(/\u200b+$/,'');d=ba(c,k);c=ba(e,g.length?D(g).length-h:0);if(1lb&&g.scrollbars.setScrollTop(g.scroller.scrollTop=l);if(null!=h.selectionStart){(!od||od&&9>lb)&&b();var a=0,c=function(){g.selForContextMenu== -e.doc.sel&&0==h.selectionStart&&0a++?g.detectingSelectAll=setTimeout(c,500):(g.selForContextMenu=null,g.input.reset())};g.detectingSelectAll=setTimeout(c,200)}}var d=this,e=d.cm,g=e.display,h=d.textarea,k=Kb(e,a),l=g.scroller.scrollTop;if(k&&!Lg){e.options.resetSelectionOnContextMenu&&-1==e.doc.sel.contains(k)&&yd(e,Ad)(e.doc,db(k),Ke);var m=h.style.cssText,n=d.wrapper.style.cssText;d.wrapper.style.cssText='position: absolute';k=d.wrapper.getBoundingClientRect(); -h.style.cssText='position: absolute; width: 30px; height: 30px;\n top: '+(a.clientY-k.top-5)+'px; left: '+(a.clientX-k.left-5)+'px;\n z-index: 1000; background: '+(od?'rgba(255, 255, 255, .05)':'transparent')+';\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);';if(Kc)var p=window.scrollY;g.input.focus();Kc&&window.scrollTo(null,p);g.input.reset();e.somethingSelected()||(h.value=d.prevInput=' ');d.contextMenuPending=!0;g.selForContextMenu= -e.doc.sel;clearTimeout(g.detectingSelectAll);od&&9<=lb&&b();if(oj){Fd(a);var q=function(){Qb(window,'mouseup',q);setTimeout(c,20)};Ca(window,'mouseup',q)}else setTimeout(c,50)}};Id.prototype.readOnlyChanged=function(a){a||this.reset();this.textarea.disabled='nocursor'==a};Id.prototype.setUneditable=function(){};Id.prototype.needsContentAttribute=!1;(function(a){function b(b,d,e,g){a.defaults[b]=d;e&&(c[b]=g?function(a,b,c){c!=Fj&&e(a,b,c)}:e)}var c=a.optionHandlers;a.defineOption=b;a.Init=Fj;b('value', -'',function(a,b){return a.setValue(b)},!0);b('mode',null,function(a,b){a.doc.modeOption=b;xg(a)},!0);b('indentUnit',2,xg,!0);b('indentWithTabs',!1);b('smartIndent',!0);b('tabSize',4,function(a){Pf(a);ue(a);xd(a)},!0);b('lineSeparator',null,function(a,b){if(a.doc.lineSep=b){var c=[],d=a.doc.first;a.doc.iter(function(a){for(var e=0;;){var g=a.text.indexOf(b,e);if(-1==g)break;e=g+b.length;c.push(ba(d,g))}d++});for(var e=c.length-1;0<=e;e--)Ab(a.doc,b,c[e],ba(c[e].line,c[e].ch+b.length))}});b('specialChars', -/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(a,b,c){a.state.specialChars=new RegExp(b.source+(b.test('\t')?'':'|\t'),'g');c!=Fj&&a.refresh()});b('specialCharPlaceholder',Wf,function(a){return a.refresh()},!0);b('electricChars',!0);b('inputStyle',Hb?'contenteditable':'textarea',function(){throw Error('inputStyle can not (yet) be changed in a running editor');},!0);b('spellcheck',!1,function(a,b){return a.getInputField().spellcheck=b},!0);b('rtlMoveVisually',!dc); -b('wholeLineUpdateBefore',!0);b('theme','default',function(a){bj(a);Rg(a)},!0);b('keyMap','default',function(a,b,c){b=ji(b);(c=c!=Fj&&ji(c))&&c.detach&&c.detach(a,b);b.attach&&b.attach(a,c||null)});b('extraKeys',null);b('configureMouse',null);b('lineWrapping',!1,uj,!0);b('gutters',[],function(a){Bc(a.options);Rg(a)},!0);b('fixedGutter',!0,function(a,b){a.display.gutters.style.left=b?Xf(a.display)+'px':'0';a.refresh()},!0);b('coverGutterNextToScrollbar',!1,function(a){return Bg(a)},!0);b('scrollbarStyle', -'native',function(a){Se(a);Bg(a);a.display.scrollbars.setScrollTop(a.doc.scrollTop);a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},!0);b('lineNumbers',!1,function(a){Bc(a.options);Rg(a)},!0);b('firstLineNumber',1,Rg,!0);b('lineNumberFormatter',function(a){return a},Rg,!0);b('showCursorWhenSelecting',!1,of,!0);b('resetSelectionOnContextMenu',!0);b('lineWiseCopyCut',!0);b('pasteLinesPerSelection',!0);b('readOnly',!1,function(a,b){'nocursor'==b&&(Ne(a),a.display.input.blur());a.display.input.readOnlyChanged(b)}); -b('disableInput',!1,function(a,b){b||a.display.input.reset()},!0);b('dragDrop',!0,tj);b('allowDropFileTypes',null);b('cursorBlinkRate',530);b('cursorScrollMargin',0);b('cursorHeight',1,of,!0);b('singleCursorHeightPerLine',!0,of,!0);b('workTime',100);b('workDelay',100);b('flattenSpans',!0,Pf,!0);b('addModeClass',!1,Pf,!0);b('pollInterval',100);b('undoDepth',200,function(a,b){return a.doc.history.undoDepth=b});b('historyEventDelay',1250);b('viewportMargin',10,function(a){return a.refresh()},!0);b('maxHighlightLength', -1E4,Pf,!0);b('moveInputWithCursor',!0,function(a,b){b||a.display.input.resetPosition()});b('tabindex',null,function(a,b){return a.display.input.getField().tabIndex=b||''});b('autofocus',null);b('direction','ltr',function(a,b){return a.doc.setDirection(b)},!0);b('phrases',null)})(ce);(function(a){var b=a.optionHandlers,c=a.helpers={};a.prototype={constructor:a,focus:function(){window.focus();this.display.input.focus()},setOption:function(a,c){var d=this.options,e=d[a];if(d[a]!=c||'mode'==a)d[a]=c, -b.hasOwnProperty(a)&&yd(this,b[a])(this,c,e),xb(this,'optionChange',this,a)},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?'push':'unshift'](ji(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;cc&&(qi(this,e.head.line,a,!0),c=e.head.line,d==this.doc.sel.primIndex&&Ag(this));else{var g=e.from();e=e.to();var h=Math.max(c,g.line);c=Math.min(this.lastLine(),e.line-(e.ch?0:1))+1;for(e=h;e>1;if((e?b[2*e-1]:0)>=a)d=e;else if(b[2*e+1]c?b:0==c?null:b.slice(0,c-1)},getModeAt:function(b){var c=this.doc.mode;return c.innerMode?a.innerMode(c,this.getTokenAt(b).state).mode:c},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var d=[];if(!c.hasOwnProperty(b))return d; -var e=c[b];a=this.getModeAt(a);if('string'==typeof a[b])e[a[b]]&&d.push(e[a[b]]);else if(a[b])for(var g=0;ge&&(a=e,d=!0);a=T(this.doc,a)}return Zd(this,a,{top:0,left:0},b||'page',c||d).top+(d?this.doc.height-nb(a):0)},defaultTextHeight:function(){return kg(this.display)},defaultCharWidth:function(){return Ee(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var g=this.display;a=oe(this,oa(this.doc,a));var h=a.bottom,k=a.left;b.style.position='absolute';b.setAttribute('cm-ignore-events','true');this.display.input.setUneditable(b); +indentLess:function(a){return a.indentSelection('subtract')},insertTab:function(a){return a.replaceSelection('\t')},insertSoftTab:function(a){for(var b=[],c=a.listSelections(),d=a.options.tabSize,e=0;ea.doc.first){var h=X(a.doc,e.line-1).text;h&&(e=new da(e.line,1),a.replaceRange(g.charAt(0)+a.doc.lineSeparator()+h.charAt(h.length-1),da(e.line-1,h.length-1),e,'+transpose'))}c.push(new sa(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){return Pd(a,function(){for(var b=a.listSelections(), +c=b.length-1;0<=c;c--)a.replaceRange(a.doc.lineSeparator(),b[c].anchor,b[c].head,'+input');b=a.listSelections();for(c=0;ca&&0==R(b,this.pos)&&c==this.button};var bb,Uj,Dj={toString:function(){return'CodeMirror.Init'}}, +ql={},ik={};Bd.defaults=ql;Bd.optionHandlers=ik;var Pk=[];Bd.defineInitHook=function(a){return Pk.push(a)};var dd=null,pb=function(a){this.cm=a;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new Th;this.composing=null;this.gracePeriod=!1;this.readDOMTimeout=null};pb.prototype.init=function(a){function b(a){if(!Ka(e,a)){if(e.somethingSelected())dd={lineWise:!1,text:e.getSelections()},'cut'==a.type&&e.replaceSelection('',null,'cut');else if(e.options.lineWiseCopyCut){var b= +vj(e);dd={lineWise:!0,text:b.text};'cut'==a.type&&e.operation(function(){e.setSelections(b.ranges,0,Zg);e.replaceSelection('',null,'cut')})}else return;if(a.clipboardData){a.clipboardData.clearData();var c=dd.text.join('\n');a.clipboardData.setData('Text',c);if(a.clipboardData.getData('Text')==c){a.preventDefault();return}}var h=Mi();a=h.firstChild;e.display.lineSpace.insertBefore(h,e.display.lineSpace.firstChild);a.value=dd.text.join('\n');var k=document.activeElement;jf(a);setTimeout(function(){e.display.lineSpace.removeChild(h); +k.focus();k==g&&d.showPrimarySelection()},50)}}var c=this,d=this,e=d.cm,g=d.div=a.lineDiv;ej(g,e.options.spellcheck);Ea(g,'paste',function(a){Ka(e,a)||dj(a,e)||11>=Rb&&setTimeout(ie(e,function(){return c.updateFromDOM()}),20)});Ea(g,'compositionstart',function(a){c.composing={data:a.data,done:!1}});Ea(g,'compositionupdate',function(a){c.composing||(c.composing={data:a.data,done:!1})});Ea(g,'compositionend',function(a){c.composing&&(a.data!=c.composing.data&&c.readFromDOMSoon(),c.composing.done=!0)}); +Ea(g,'touchstart',function(){return d.forceCompositionEnd()});Ea(g,'input',function(){c.composing||c.readFromDOMSoon()});Ea(g,'copy',b);Ea(g,'cut',b)};pb.prototype.prepareSelection=function(){var a=Eg(this.cm,!1);a.focus=this.cm.state.focused;return a};pb.prototype.showSelection=function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))};pb.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()};pb.prototype.showPrimarySelection= +function(){var a=this.getSelection(),b=this.cm,c=b.doc.sel.primary(),d=c.from();c=c.to();if(b.display.viewTo==b.display.viewFrom||d.line>=b.display.viewTo||c.line=b.display.viewFrom&&Ig(b,d)||{node:e[0].measure.map[2],offset:0},c=c.linea.firstLine()&&(d=da(d.line-1,X(a.doc,d.line-1).length));e.ch==X(a.doc,e.line).text.length&&e.lineb.viewTo-1)return!1;var g;d.line==b.viewFrom||0==(g=qg(a,d.line))?(c=N(b.view[0].line),g=b.view[0].node):(c=N(b.view[g].line),g=b.view[g-1].node.nextSibling);var h=qg(a,e.line);h==b.view.length-1? +(e=b.viewTo-1,b=b.lineDiv.lastChild):(e=N(b.view[h+1].line)-1,b=b.view[h+1].node.previousSibling);if(!g)return!1;b=a.doc.splitLines(ii(a,g,b,c,e));for(g=ka(a.doc,da(c,0),da(e,X(a.doc,e).text.length));1d.ch&&l.charCodeAt(l.length-h-1)==m.charCodeAt(m.length-h-1);)k--,h++;b[b.length-1]=l.slice(0,l.length-h).replace(/^\u200b+/,'');b[0]=b[0].slice(k).replace(/\u200b+$/,'');d=da(c,k);c=da(e,g.length?E(g).length-h:0);if(1Rb&&g.scrollbars.setScrollTop(g.scroller.scrollTop=l);if(null!=h.selectionStart){(!gd||gd&&9>Rb)&&b();var a=0,c=function(){g.selForContextMenu== +e.doc.sel&&0==h.selectionStart&&0a++?g.detectingSelectAll=setTimeout(c,500):(g.selForContextMenu=null,g.input.reset())};g.detectingSelectAll=setTimeout(c,200)}}var d=this,e=d.cm,g=e.display,h=d.textarea,k=Db(e,a),l=g.scroller.scrollTop;if(k&&!ue){e.options.resetSelectionOnContextMenu&&-1==e.doc.sel.contains(k)&&ie(e,Ge)(e.doc,ab(k),Zg);var m=h.style.cssText,n=d.wrapper.style.cssText;d.wrapper.style.cssText='position: absolute';k=d.wrapper.getBoundingClientRect(); +h.style.cssText='position: absolute; width: 30px; height: 30px;\n top: '+(a.clientY-k.top-5)+'px; left: '+(a.clientX-k.left-5)+'px;\n z-index: 1000; background: '+(gd?'rgba(255, 255, 255, .05)':'transparent')+';\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);';if(cd)var p=window.scrollY;g.input.focus();cd&&window.scrollTo(null,p);g.input.reset();e.somethingSelected()||(h.value=d.prevInput=' ');d.contextMenuPending=!0;g.selForContextMenu= +e.doc.sel;clearTimeout(g.detectingSelectAll);gd&&9<=Rb&&b();if(wj){Hd(a);var q=function(){vb(window,'mouseup',q);setTimeout(c,20)};Ea(window,'mouseup',q)}else setTimeout(c,50)}};le.prototype.readOnlyChanged=function(a){a||this.reset();this.textarea.disabled='nocursor'==a};le.prototype.setUneditable=function(){};le.prototype.needsContentAttribute=!1;(function(a){function b(b,d,e,g){a.defaults[b]=d;e&&(c[b]=g?function(a,b,c){c!=Dj&&e(a,b,c)}:e)}var c=a.optionHandlers;a.defineOption=b;a.Init=Dj;b('value', +'',function(a,b){return a.setValue(b)},!0);b('mode',null,function(a,b){a.doc.modeOption=b;of(a)},!0);b('indentUnit',2,of,!0);b('indentWithTabs',!1);b('smartIndent',!0);b('tabSize',4,function(a){ye(a);tf(a);ud(a)},!0);b('lineSeparator',null,function(a,b){if(a.doc.lineSep=b){var c=[],d=a.doc.first;a.doc.iter(function(a){for(var e=0;;){var g=a.text.indexOf(b,e);if(-1==g)break;e=g+b.length;c.push(da(d,g))}d++});for(var e=c.length-1;0<=e;e--)Mb(a.doc,b,c[e],da(c[e].line,c[e].ch+b.length))}});b('specialChars', +/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(a,b,c){a.state.specialChars=new RegExp(b.source+(b.test('\t')?'':'|\t'),'g');c!=Dj&&a.refresh()});b('specialCharPlaceholder',de,function(a){return a.refresh()},!0);b('electricChars',!0);b('inputStyle',ki?'contenteditable':'textarea',function(){throw Error('inputStyle can not (yet) be changed in a running editor');},!0);b('spellcheck',!1,function(a,b){return a.getInputField().spellcheck=b},!0);b('rtlMoveVisually',!zh); +b('wholeLineUpdateBefore',!0);b('theme','default',function(a){tj(a);Qd(a)},!0);b('keyMap','default',function(a,b,c){b=di(b);(c=c!=Dj&&di(c))&&c.detach&&c.detach(a,b);b.attach&&b.attach(a,c||null)});b('extraKeys',null);b('configureMouse',null);b('lineWrapping',!1,Lj,!0);b('gutters',[],function(a){md(a.options);Qd(a)},!0);b('fixedGutter',!0,function(a,b){a.display.gutters.style.left=b?De(a.display)+'px':'0';a.refresh()},!0);b('coverGutterNextToScrollbar',!1,function(a){return Fg(a)},!0);b('scrollbarStyle', +'native',function(a){Mf(a);Fg(a);a.display.scrollbars.setScrollTop(a.doc.scrollTop);a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},!0);b('lineNumbers',!1,function(a){md(a.options);Qd(a)},!0);b('firstLineNumber',1,Qd,!0);b('lineNumberFormatter',function(a){return a},Qd,!0);b('showCursorWhenSelecting',!1,xe,!0);b('resetSelectionOnContextMenu',!0);b('lineWiseCopyCut',!0);b('pasteLinesPerSelection',!0);b('readOnly',!1,function(a,b){'nocursor'==b&&(pe(a),a.display.input.blur());a.display.input.readOnlyChanged(b)}); +b('disableInput',!1,function(a,b){b||a.display.input.reset()},!0);b('dragDrop',!0,Kj);b('allowDropFileTypes',null);b('cursorBlinkRate',530);b('cursorScrollMargin',0);b('cursorHeight',1,xe,!0);b('singleCursorHeightPerLine',!0,xe,!0);b('workTime',100);b('workDelay',100);b('flattenSpans',!0,ye,!0);b('addModeClass',!1,ye,!0);b('pollInterval',100);b('undoDepth',200,function(a,b){return a.doc.history.undoDepth=b});b('historyEventDelay',1250);b('viewportMargin',10,function(a){return a.refresh()},!0);b('maxHighlightLength', +1E4,ye,!0);b('moveInputWithCursor',!0,function(a,b){b||a.display.input.resetPosition()});b('tabindex',null,function(a,b){return a.display.input.getField().tabIndex=b||''});b('autofocus',null);b('direction','ltr',function(a,b){return a.doc.setDirection(b)},!0);b('phrases',null)})(Bd);(function(a){var b=a.optionHandlers,c=a.helpers={};a.prototype={constructor:a,focus:function(){window.focus();this.display.input.focus()},setOption:function(a,c){var d=this.options,e=d[a];if(d[a]!=c||'mode'==a)d[a]=c, +b.hasOwnProperty(a)&&ie(this,b[a])(this,c,e),La(this,'optionChange',this,a)},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?'push':'unshift'](di(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;cc&&(yh(this,e.head.line,a,!0),c=e.head.line,d==this.doc.sel.primIndex&&Uf(this));else{var g=e.from();e=e.to();var h=Math.max(c,g.line);c=Math.min(this.lastLine(),e.line-(e.ch?0:1))+1;for(e=h;e>1;if((e?b[2*e-1]:0)>=a)d=e;else if(b[2*e+1]c?b:0==c?null:b.slice(0,c-1)},getModeAt:function(b){var c=this.doc.mode;return c.innerMode?a.innerMode(c,this.getTokenAt(b).state).mode:c},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var d=[];if(!c.hasOwnProperty(b))return d; +var e=c[b];a=this.getModeAt(a);if('string'==typeof a[b])e[a[b]]&&d.push(e[a[b]]);else if(a[b])for(var g=0;ge&&(a=e,d=!0);a=X(this.doc,a)}return fe(this,a,{top:0,left:0},b||'page',c||d).top+(d?this.doc.height-Ta(a):0)},defaultTextHeight:function(){return oe(this.display)},defaultCharWidth:function(){return kg(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var g=this.display;a=Xe(this,ma(this.doc,a));var h=a.bottom,k=a.left;b.style.position='absolute';b.setAttribute('cm-ignore-events','true');this.display.input.setUneditable(b); g.sizer.appendChild(b);if('over'==d)h=a.top;else if('above'==d||'near'==d){var l=Math.max(g.wrapper.clientHeight,this.doc.height),m=Math.max(g.sizer.clientWidth,g.lineSpace.clientWidth);('above'==d||a.bottom+b.offsetHeight>l)&&a.top>b.offsetHeight?h=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=l&&(h=a.bottom);k+b.offsetWidth>m&&(k=m-b.offsetWidth)}b.style.top=h+'px';b.style.left=b.style.right='';'right'==e?(k=g.sizer.clientWidth-b.offsetWidth,b.style.right='0px'):('left'==e?k=0:'middle'==e&&(k=(g.sizer.clientWidth- -b.offsetWidth)/2),b.style.left=k+'px');c&&(a=wf(this,{left:k,top:h,right:k+b.offsetWidth,bottom:h+b.offsetHeight}),null!=a.scrollTop&&cd(this,a.scrollTop),null!=a.scrollLeft&&Oe(this,a.scrollLeft))},triggerOnKeyDown:Od(ni),triggerOnKeyPress:Od(lh),triggerOnKeyUp:$i,triggerOnMouseDown:Od(Di),execCommand:function(a){if(Uj.hasOwnProperty(a))return Uj[a].call(null,this)},triggerElectric:Od(function(a){wj(this,a)}),findPosH:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);a=oa(this.doc,a);for(var g=0;ga?d.from():d.to()},yi)}),deleteH:Od(function(a,b){var c=this.doc;this.doc.sel.somethingSelected()?c.replaceSelection('',null,'+delete'):hg(this,function(d){var e=Tb(c,d.head,a,b,!1);return 0>a?{from:e,to:d.head}:{from:d.head,to:e}})}),findPosV:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b); -var g=oa(this.doc,a);for(a=0;aa?h.from():h.to();var k=oe(c,h.head,'div');null!=h.goalColumn&&(k.left=h.goalColumn);e.push(k.left);var l=ri(c,k,a,b);'page'==b&&h==d.sel.primary()&&wg(c,Hg(c,l,'div').top-k.top);return l},yi);if(e.length)for(var h=0;hn(te,Wj)&&(ce.prototype[Wj]=function(a){return function(){return a.apply(this.doc,arguments)}}(Ce.prototype[Wj]));ab(Ce);ce.inputStyles={textarea:Id,contenteditable:Cb};ce.defineMode=function(a){ce.defaults.mode||'null'==a||(ce.defaults.mode=a);wb.apply(this,arguments)};ce.defineMIME=function(a,b){bf[a]=b};ce.defineMode('null',function(){return{token:function(a){return a.skipToEnd()}}});ce.defineMIME('text/plain','null');ce.defineExtension= -function(a,b){ce.prototype[a]=b};ce.defineDocExtension=function(a,b){Ce.prototype[a]=b};ce.fromTextArea=function(a,b){function c(){a.value=l.getValue()}b=b?p(b):{};b.value=a.value;!b.tabindex&&a.tabIndex&&(b.tabindex=a.tabIndex);!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder);if(null==b.autofocus){var d=k();b.autofocus=d==a||null!=a.getAttribute('autofocus')&&d==document.body}if(a.form&&(Ca(a.form,'submit',c),!b.leaveSubmitMethodAlone)){var e=a.form;var g=e.submit;try{var h=e.submit= -function(){c();e.submit=g;e.submit();e.submit=h}}catch(rl){}}b.finishInit=function(b){b.save=c;b.getTextArea=function(){return a};b.toTextArea=function(){b.toTextArea=isNaN;c();a.parentNode.removeChild(b.getWrapperElement());a.style.display='';a.form&&(Qb(a.form,'submit',c),'function'==typeof a.form.submit&&(a.form.submit=g))}};a.style.display='none';var l=ce(function(b){return a.parentNode.insertBefore(b,a.nextSibling)},b);return l};(function(a){a.off=Qb;a.on=Ca;a.wheelEventPixels=zd;a.Doc=Ce;a.splitLines= -ec;a.countColumn=e;a.findColumn=r;a.isWordChar=G;a.Pass=Nc;a.signal=xb;a.Line=rd;a.changeEnd=Eb;a.scrollbarModel=B;a.Pos=ba;a.cmpPos=L;a.modes=$a;a.mimeModes=bf;a.resolveMode=Ec;a.getMode=Md;a.modeExtensions=fh;a.extendMode=eb;a.copyState=zc;a.startState=Qe;a.innerMode=me;a.commands=Uj;a.keyMap=Tj;a.keyName=Ah;a.isModifierKey=Zf;a.lookupKey=dh;a.normalizeKeyMap=lf;a.StringStream=dd;a.SharedTextMarker=Rj;a.TextMarker=Vi;a.LineWidget=Dd;a.e_preventDefault=yb;a.e_stopPropagation=Ga;a.e_stop=Fd;a.addClass= -l;a.contains=h;a.rmClass=Hd;a.keyNames=Xi})(ce);ce.version='5.40.0';return ce}); -(function(a){'object'==typeof exports&&'object'==typeof module?a(require('../lib/codemirror'),require('../addon/search/searchcursor'),require('../addon/edit/matchbrackets')):'function'==typeof define&&define.amd?define(['../lib/codemirror','../addon/search/searchcursor','../addon/edit/matchbrackets'],a):a(CodeMirror)})(function(a){function b(b,c){b.extendSelectionsBy(function(d){if(b.display.shift||b.doc.extend||d.empty()){var g=b.doc;d=d.head;if(0>c&&0==d.ch)var h=g.clipPos(e(d.line-1));else{var k= -g.getLine(d.line);if(0=k.length)h=g.clipPos(e(d.line+1,0));else{g='start';for(var l=d.ch,m=0>c?0:k.length,n=0;l!=m;l+=c,n++){var p=k.charAt(0>c?l-1:l),q='_'!=p&&a.isWordChar(p)?'w':'o';'w'==q&&p.toUpperCase()==p&&(q='W');if('start'==g)'o'!=q&&(g='in',h=q);else if('in'==g&&h!=q)if('w'==h&&'W'==q&&0>c&&l--,'W'==h&&'w'==q&&0c?d.from():d.to()})}function d(b,c){if(b.isReadOnly())return a.Pass;b.operation(function(){for(var a=b.listSelections().length, -d=[],g=-1,h=0;h= -c&&a.execCommand('goLineUp')}a.scrollTo(null,b.top-a.defaultTextHeight())};p.scrollLineDown=function(a){var b=a.getScrollInfo();if(!a.somethingSelected()){var c=a.lineAtHeight(b.top,'local')+1;a.getCursor().line<=c&&a.execCommand('goLineDown')}a.scrollTo(null,b.top+a.defaultTextHeight())};p.splitSelectionByLine=function(a){for(var b=a.listSelections(),c=[],d=0;dg.line&&k==h.line&&0==h.ch||c.push({anchor:k==g.line?g:e(k, -0),head:k==h.line?h:e(k)});a.setSelections(c,0)};p.singleSelectionTop=function(a){var b=a.listSelections()[0];a.setSelection(b.anchor,b.head,{scroll:!1})};p.selectLine=function(a){for(var b=a.listSelections(),c=[],d=0;dg?d.push(m,n):d.length&&(d[d.length-1]=n);g=n}b.operation(function(){for(var a=0;ab.lastLine()?b.replaceRange('\n'+k,e(b.lastLine()),null,'+swapLine'):b.replaceRange(k+'\n',e(g,0),null,'+swapLine')}b.setSelections(h); -b.scrollIntoView()})};p.swapLineDown=function(b){if(b.isReadOnly())return a.Pass;for(var c=b.listSelections(),d=[],g=b.lastLine()+1,h=c.length-1;0<=h;h--){var k=c[h],l=k.to().line+1,m=k.from().line;0!=k.to().ch||k.empty()||l--;lb&&(e=-1,b=-b);a=ma(this.doc,a);for(var g=0;ga?d.from():d.to()},pi)}),deleteH:vd(function(a,b){var c=this.doc;this.doc.sel.somethingSelected()?c.replaceSelection('',null,'+delete'):nh(this,function(d){var e=kb(c,d.head,a,b,!1);return 0>a?{from:e,to:d.head}:{from:d.head,to:e}})}),findPosV:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b); +var g=ma(this.doc,a);for(a=0;aa?h.from():h.to();var k=Xe(c,h.head,'div');null!=h.goalColumn&&(k.left=h.goalColumn);e.push(k.left);var l=fj(c,k,a,b);'page'==b&&h==d.sel.primary()&&eg(c,Tg(c,l,'div').top-k.top);return l},pi);if(e.length)for(var h=0;hp(zd,Vj)&&(Bd.prototype[Vj]=function(a){return function(){return a.apply(this.doc,arguments)}}(Re.prototype[Vj]));Ra(Re);Bd.inputStyles={textarea:le,contenteditable:pb};Bd.defineMode=function(a){Bd.defaults.mode||'null'==a||(Bd.defaults.mode=a);uc.apply(this,arguments)};Bd.defineMIME=function(a,b){ke[a]=b};Bd.defineMode('null',function(){return{token:function(a){return a.skipToEnd()}}});Bd.defineMIME('text/plain','null');Bd.defineExtension= +function(a,b){Bd.prototype[a]=b};Bd.defineDocExtension=function(a,b){Re.prototype[a]=b};Bd.fromTextArea=function(a,b){function c(){a.value=l.getValue()}b=b?m(b):{};b.value=a.value;!b.tabindex&&a.tabIndex&&(b.tabindex=a.tabIndex);!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder);if(null==b.autofocus){var d=h();b.autofocus=d==a||null!=a.getAttribute('autofocus')&&d==document.body}if(a.form&&(Ea(a.form,'submit',c),!b.leaveSubmitMethodAlone)){var e=a.form;var g=e.submit;try{var k=e.submit= +function(){c();e.submit=g;e.submit();e.submit=k}}catch(rl){}}b.finishInit=function(b){b.save=c;b.getTextArea=function(){return a};b.toTextArea=function(){b.toTextArea=isNaN;c();a.parentNode.removeChild(b.getWrapperElement());a.style.display='';a.form&&(vb(a.form,'submit',c),'function'==typeof a.form.submit&&(a.form.submit=g))}};a.style.display='none';var l=Bd(function(b){return a.parentNode.insertBefore(b,a.nextSibling)},b);return l};(function(a){a.off=vb;a.on=Ea;a.wheelEventPixels=Kd;a.Doc=Re;a.splitLines= +yb;a.countColumn=g;a.findColumn=r;a.isWordChar=I;a.Pass=fd;a.signal=La;a.Line=Kg;a.changeEnd=ub;a.scrollbarModel=bk;a.Pos=da;a.cmpPos=R;a.modes=rc;a.mimeModes=ke;a.resolveMode=Nb;a.getMode=Le;a.modeExtensions=Qg;a.extendMode=Yc;a.copyState=ld;a.startState=ve;a.innerMode=Dd;a.commands=Tj;a.keyMap=Sj;a.keyName=Wg;a.isModifierKey=mh;a.lookupKey=ih;a.normalizeKeyMap=sd;a.StringStream=yc;a.SharedTextMarker=Rj;a.TextMarker=lb;a.LineWidget=fb;a.e_preventDefault=Ua;a.e_stopPropagation=va;a.e_stop=Hd;a.addClass= +l;a.contains=k;a.rmClass=yd;a.keyNames=Ui})(Bd);Bd.version='5.40.0';return Bd}); +(function(a){'object'==typeof exports&&'object'==typeof module?a(require('../lib/codemirror'),require('../addon/search/searchcursor'),require('../addon/edit/matchbrackets')):'function'==typeof define&&define.amd?define(['../lib/codemirror','../addon/search/searchcursor','../addon/edit/matchbrackets'],a):a(CodeMirror)})(function(a){function b(b,c){b.extendSelectionsBy(function(d){if(b.display.shift||b.doc.extend||d.empty()){var e=b.doc;d=d.head;if(0>c&&0==d.ch)var h=e.clipPos(g(d.line-1));else{var k= +e.getLine(d.line);if(0=k.length)h=e.clipPos(g(d.line+1,0));else{e='start';for(var l=d.ch,m=0>c?0:k.length,n=0;l!=m;l+=c,n++){var p=k.charAt(0>c?l-1:l),q='_'!=p&&a.isWordChar(p)?'w':'o';'w'==q&&p.toUpperCase()==p&&(q='W');if('start'==e)'o'!=q&&(e='in',h=q);else if('in'==e&&h!=q)if('w'==h&&'W'==q&&0>c&&l--,'W'==h&&'w'==q&&0c?d.from():d.to()})}function e(b,c){if(b.isReadOnly())return a.Pass;b.operation(function(){for(var a=b.listSelections().length, +d=[],e=-1,h=0;h= +c&&a.execCommand('goLineUp')}a.scrollTo(null,b.top-a.defaultTextHeight())};m.scrollLineDown=function(a){var b=a.getScrollInfo();if(!a.somethingSelected()){var c=a.lineAtHeight(b.top,'local')+1;a.getCursor().line<=c&&a.execCommand('goLineDown')}a.scrollTo(null,b.top+a.defaultTextHeight())};m.splitSelectionByLine=function(a){for(var b=a.listSelections(),c=[],d=0;de.line&&k==h.line&&0==h.ch||c.push({anchor:k==e.line?e:g(k, +0),head:k==h.line?h:g(k)});a.setSelections(c,0)};m.singleSelectionTop=function(a){var b=a.listSelections()[0];a.setSelection(b.anchor,b.head,{scroll:!1})};m.selectLine=function(a){for(var b=a.listSelections(),c=[],d=0;de?d.push(m,n):d.length&&(d[d.length-1]=n);e=n}b.operation(function(){for(var a=0;ab.lastLine()?b.replaceRange('\n'+k,g(b.lastLine()),null,'+swapLine'):b.replaceRange(k+'\n',g(e,0),null,'+swapLine')}b.setSelections(h); +b.scrollIntoView()})};m.swapLineDown=function(b){if(b.isReadOnly())return a.Pass;for(var c=b.listSelections(),d=[],e=b.lastLine()+1,h=c.length-1;0<=h;h--){var k=c[h],l=k.to().line+1,m=k.from().line;0!=k.to().ch||k.empty()||l--;lc?e.slice(0,b.ch):e.slice(b.ch));for(var g=a.firstLine(),h=a.lastLine();;){d+= -c;if(dh)return a.clipPos(fa(d-c,0>c?0:null));e=a.getLine(d);if(/\S/.test(e))b=!0;else if(b)return fa(d,0)}}function e(a,b,c){var d=b.line,e=b.ch;b=a.getLine(b.line);for(var g=!1;;){var h=b.charAt(e+(0>c?-1:0));if(h){if(g&&/[!?.]/.test(h))return fa(d,e+(0c?a.firstLine():a.lastLine()))return fa(d,e);b=a.getLine(d+c);if(!/\S/.test(b))return fa(d,e);d+=c;e=0>c?b.length:0}}}function n(a,c,d){var e;if(a.findMatchingBracket&&(e=a.findMatchingBracket(c, -{strict:!0}))&&e.match&&(e.forward?1:-1)==d)return 0d?h.start:h.end);if(g&&0g&&(e=-e,g=-g);for(var h=0;h',c,{bottom:!0}):c(prompt(b,''))}function Q(a,b){var c=a.getCursor(),d=a.findPosH(c,1,'word');a.replaceRange(b(a.getRange(c,d)),c,d);a.setCursor(d)}function T(a){V[a]=function(b){z(b,a)};ma['Ctrl-'+a]=function(b){z(b,a)};N['Ctrl-'+a]=!0}var fa=a.Pos,ja=[],ia=null,N={'Alt-G':!0,'Ctrl-X':!0,'Ctrl-Q':!0,'Ctrl-U':!0};a.emacs={kill:h,killRegion:v, -repeated:t};var ma=a.keyMap.emacs=a.normalizeKeyMap({'Ctrl-W':function(a){h(a,a.getCursor('start'),a.getCursor('end'),!0)},'Ctrl-K':t(function(a){var b=a.getCursor(),c=a.clipPos(fa(b.line)),d=a.getRange(b,c);/\S/.test(d)||(d+='\n',c=fa(b.line+1,0));h(a,b,c,'grow',d)}),'Alt-W':function(a){d(a.getSelection());a.setExtending(!1);a.setCursor(a.getCursor())},'Ctrl-Y':function(a){var b=a.getCursor();a.replaceRange(c(r(a)),b,b,'paste');a.setSelection(b,a.getCursor())},'Alt-Y':function(a){a.replaceSelection(g(), -'around','paste')},'Ctrl-Space':C,'Ctrl-Shift-2':C,'Ctrl-F':w(k,1),'Ctrl-B':w(k,-1),Right:w(k,1),Left:w(k,-1),'Ctrl-D':function(a){u(a,k,1,!1)},Delete:function(a){v(a,!1)||u(a,k,1,!1)},'Ctrl-H':function(a){u(a,k,-1,!1)},Backspace:function(a){v(a,!1)||u(a,k,-1,!1)},'Alt-F':w(l,1),'Alt-B':w(l,-1),'Alt-Right':w(l,1),'Alt-Left':w(l,-1),'Alt-D':function(a){u(a,l,1,'grow')},'Alt-Backspace':function(a){u(a,l,-1,'grow')},'Ctrl-N':w(m,1),'Ctrl-P':w(m,-1),Down:w(m,1),Up:w(m,-1),'Ctrl-A':'goLineStart','Ctrl-E':'goLineEnd', -End:'goLineEnd',Home:'goLineStart','Alt-V':w(q,-1),'Ctrl-V':w(q,1),PageUp:w(q,-1),PageDown:w(q,1),'Ctrl-Up':w(p,-1),'Ctrl-Down':w(p,1),'Alt-A':w(e,-1),'Alt-E':w(e,1),'Alt-K':function(a){u(a,e,1,'grow')},'Ctrl-Alt-K':function(a){u(a,n,1,'grow')},'Ctrl-Alt-Backspace':function(a){u(a,n,-1,'grow')},'Ctrl-Alt-F':w(n,1),'Ctrl-Alt-B':w(n,-1,'grow'),'Shift-Ctrl-Alt-2':function(a){var b=a.getCursor();a.setSelection(D(a,b,n,1),b)},'Ctrl-Alt-T':function(a){var b=n(a,a.getCursor(),-1),c=n(a,b,1),d=n(a,c,1),e= -n(a,d,-1);a.replaceRange(a.getRange(e,d)+a.getRange(c,e)+a.getRange(b,c),b,d)},'Ctrl-Alt-U':t(function(a){var b=a.getCursor(),c=b.line;b=b.ch;for(var d=[];c>=a.firstLine();){for(var e=a.getLine(c),g=null==b?e.length:b;0a;++a)T(String(a));T('-')}); +'Ctrl-H':'replace',F3:'findNext','Shift-F3':'findPrev',fallthrough:'pcDefault'};a.normalizeKeyMap(m.pcSublime);m.sublime=m.default==m.macDefault?m.macSublime:m.pcSublime}); +(function(a){'object'==typeof exports&&'object'==typeof module?a(require('../lib/codemirror')):'function'==typeof define&&define.amd?define(['../lib/codemirror'],a):a(CodeMirror)})(function(a){function b(a,b){return a.line==b.line&&a.ch==b.ch}function e(a){ja.push(a);50c?e.slice(0,b.ch):e.slice(b.ch));for(var g=a.firstLine(),h=a.lastLine();;){d+= +c;if(dh)return a.clipPos(ka(d-c,0>c?0:null));e=a.getLine(d);if(/\S/.test(e))b=!0;else if(b)return ka(d,0)}}function g(a,b,c){var d=b.line,e=b.ch;b=a.getLine(b.line);for(var g=!1;;){var h=b.charAt(e+(0>c?-1:0));if(h){if(g&&/[!?.]/.test(h))return ka(d,e+(0c?a.firstLine():a.lastLine()))return ka(d,e);b=a.getLine(d+c);if(!/\S/.test(b))return ka(d,e);d+=c;e=0>c?b.length:0}}}function p(a,c,d){var e;if(a.findMatchingBracket&&(e=a.findMatchingBracket(c, +{strict:!0}))&&e.match&&(e.forward?1:-1)==d)return 0d?h.start:h.end);if(g&&0g&&(e=-e,g=-g);for(var h=0;h',c,{bottom:!0}):c(prompt(b,''))}function M(a,b){var c=a.getCursor(),d=a.findPosH(c,1,'word');a.replaceRange(b(a.getRange(c,d)),c,d);a.setCursor(d)}function X(a){T[a]=function(b){w(b,a)};la['Ctrl-'+a]=function(b){w(b,a)};N['Ctrl-'+a]=!0}var ka=a.Pos,ja=[],ba=null,N={'Alt-G':!0,'Ctrl-X':!0,'Ctrl-Q':!0,'Ctrl-U':!0};a.emacs={kill:k,killRegion:z, +repeated:u};var la=a.keyMap.emacs=a.normalizeKeyMap({'Ctrl-W':function(a){k(a,a.getCursor('start'),a.getCursor('end'),!0)},'Ctrl-K':u(function(a){var b=a.getCursor(),c=a.clipPos(ka(b.line)),d=a.getRange(b,c);/\S/.test(d)||(d+='\n',c=ka(b.line+1,0));k(a,b,c,'grow',d)}),'Alt-W':function(a){e(a.getSelection());a.setExtending(!1);a.setCursor(a.getCursor())},'Ctrl-Y':function(a){var b=a.getCursor();a.replaceRange(d(r(a)),b,b,'paste');a.setSelection(b,a.getCursor())},'Alt-Y':function(a){a.replaceSelection(c(), +'around','paste')},'Ctrl-Space':D,'Ctrl-Shift-2':D,'Ctrl-F':v(h,1),'Ctrl-B':v(h,-1),Right:v(h,1),Left:v(h,-1),'Ctrl-D':function(a){t(a,h,1,!1)},Delete:function(a){z(a,!1)||t(a,h,1,!1)},'Ctrl-H':function(a){t(a,h,-1,!1)},Backspace:function(a){z(a,!1)||t(a,h,-1,!1)},'Alt-F':v(l,1),'Alt-B':v(l,-1),'Alt-Right':v(l,1),'Alt-Left':v(l,-1),'Alt-D':function(a){t(a,l,1,'grow')},'Alt-Backspace':function(a){t(a,l,-1,'grow')},'Ctrl-N':v(n,1),'Ctrl-P':v(n,-1),Down:v(n,1),Up:v(n,-1),'Ctrl-A':'goLineStart','Ctrl-E':'goLineEnd', +End:'goLineEnd',Home:'goLineStart','Alt-V':v(q,-1),'Ctrl-V':v(q,1),PageUp:v(q,-1),PageDown:v(q,1),'Ctrl-Up':v(m,-1),'Ctrl-Down':v(m,1),'Alt-A':v(g,-1),'Alt-E':v(g,1),'Alt-K':function(a){t(a,g,1,'grow')},'Ctrl-Alt-K':function(a){t(a,p,1,'grow')},'Ctrl-Alt-Backspace':function(a){t(a,p,-1,'grow')},'Ctrl-Alt-F':v(p,1),'Ctrl-Alt-B':v(p,-1,'grow'),'Shift-Ctrl-Alt-2':function(a){var b=a.getCursor();a.setSelection(E(a,b,p,1),b)},'Ctrl-Alt-T':function(a){var b=p(a,a.getCursor(),-1),c=p(a,b,1),d=p(a,c,1),e= +p(a,d,-1);a.replaceRange(a.getRange(e,d)+a.getRange(c,e)+a.getRange(b,c),b,d)},'Ctrl-Alt-U':u(function(a){var b=a.getCursor(),c=b.line;b=b.ch;for(var d=[];c>=a.firstLine();){for(var e=a.getLine(c),g=null==b?e.length:b;0a;++a)X(String(a));X('-')}); (function(a){'object'==typeof exports&&'object'==typeof module?a(require('../lib/codemirror'),require('../addon/search/searchcursor'),require('../addon/dialog/dialog'),require('../addon/edit/matchbrackets.js')):'function'==typeof define&&define.amd?define(['../lib/codemirror','../addon/search/searchcursor','../addon/dialog/dialog','../addon/edit/matchbrackets'],a):a(CodeMirror)})(function(a){var b=[{keys:'',type:'keyToKey',toKeys:'h'},{keys:'',type:'keyToKey',toKeys:'l'},{keys:'', type:'keyToKey',toKeys:'k'},{keys:'',type:'keyToKey',toKeys:'j'},{keys:'',type:'keyToKey',toKeys:'l'},{keys:'',type:'keyToKey',toKeys:'h',context:'normal'},{keys:'',type:'keyToKey',toKeys:'x',context:'normal'},{keys:'',type:'keyToKey',toKeys:'W'},{keys:'',type:'keyToKey',toKeys:'B',context:'normal'},{keys:'',type:'keyToKey',toKeys:'w'},{keys:'',type:'keyToKey',toKeys:'b',context:'normal'},{keys:'',type:'keyToKey',toKeys:'j'},{keys:'',type:'keyToKey', toKeys:'k'},{keys:'',type:'keyToKey',toKeys:''},{keys:'',type:'keyToKey',toKeys:''},{keys:'',type:'keyToKey',toKeys:'',context:'insert'},{keys:'',type:'keyToKey',toKeys:'',context:'insert'},{keys:'s',type:'keyToKey',toKeys:'cl',context:'normal'},{keys:'s',type:'keyToKey',toKeys:'c',context:'visual'},{keys:'S',type:'keyToKey',toKeys:'cc',context:'normal'},{keys:'S',type:'keyToKey',toKeys:'VdO',context:'visual'},{keys:'',type:'keyToKey',toKeys:'0'},{keys:'', @@ -3120,1018 +3142,1018 @@ isEdit:!0},{keys:'@',type:'action',action:'replayMacro'},{keys:'q',type:'action',action:'setMark'},{keys:'"',type:'action',action:'setRegister'},{keys:'zz',type:'action',action:'scrollToCursor',actionArgs:{position:'center'}},{keys:'z.',type:'action',action:'scrollToCursor',actionArgs:{position:'center'},motion:'moveToFirstNonWhiteSpaceCharacter'},{keys:'zt',type:'action',action:'scrollToCursor',actionArgs:{position:'top'}},{keys:'z',type:'action',action:'scrollToCursor',actionArgs:{position:'top'},motion:'moveToFirstNonWhiteSpaceCharacter'}, {keys:'z-',type:'action',action:'scrollToCursor',actionArgs:{position:'bottom'}},{keys:'zb',type:'action',action:'scrollToCursor',actionArgs:{position:'bottom'},motion:'moveToFirstNonWhiteSpaceCharacter'},{keys:'.',type:'action',action:'repeatLastEdit'},{keys:'',type:'action',action:'incrementNumberToken',isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:'',type:'action',action:'incrementNumberToken',isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:'',type:'action',action:'indent', actionArgs:{indentRight:!0},context:'insert'},{keys:'',type:'action',action:'indent',actionArgs:{indentRight:!1},context:'insert'},{keys:'a',type:'motion',motion:'textObjectManipulation'},{keys:'i',type:'motion',motion:'textObjectManipulation',motionArgs:{textObjectInner:!0}},{keys:'/',type:'search',searchArgs:{forward:!0,querySrc:'prompt',toJumplist:!0}},{keys:'?',type:'search',searchArgs:{forward:!1,querySrc:'prompt',toJumplist:!0}},{keys:'*',type:'search',searchArgs:{forward:!0, -querySrc:'wordUnderCursor',wholeWordOnly:!0,toJumplist:!0}},{keys:'#',type:'search',searchArgs:{forward:!1,querySrc:'wordUnderCursor',wholeWordOnly:!0,toJumplist:!0}},{keys:'g*',type:'search',searchArgs:{forward:!0,querySrc:'wordUnderCursor',toJumplist:!0}},{keys:'g#',type:'search',searchArgs:{forward:!1,querySrc:'wordUnderCursor',toJumplist:!0}},{keys:':',type:'ex'}],d=b.length,c=[{name:'colorscheme',shortName:'colo'},{name:'map'},{name:'imap',shortName:'im'},{name:'nmap',shortName:'nm'},{name:'vmap', +querySrc:'wordUnderCursor',wholeWordOnly:!0,toJumplist:!0}},{keys:'#',type:'search',searchArgs:{forward:!1,querySrc:'wordUnderCursor',wholeWordOnly:!0,toJumplist:!0}},{keys:'g*',type:'search',searchArgs:{forward:!0,querySrc:'wordUnderCursor',toJumplist:!0}},{keys:'g#',type:'search',searchArgs:{forward:!1,querySrc:'wordUnderCursor',toJumplist:!0}},{keys:':',type:'ex'}],e=b.length,d=[{name:'colorscheme',shortName:'colo'},{name:'map'},{name:'imap',shortName:'im'},{name:'nmap',shortName:'nm'},{name:'vmap', shortName:'vm'},{name:'unmap'},{name:'write',shortName:'w'},{name:'undo',shortName:'u'},{name:'redo',shortName:'red'},{name:'set',shortName:'se'},{name:'set',shortName:'se'},{name:'setlocal',shortName:'setl'},{name:'setglobal',shortName:'setg'},{name:'sort',shortName:'sor'},{name:'substitute',shortName:'s',possiblyAsync:!0},{name:'nohlsearch',shortName:'noh'},{name:'yank',shortName:'y'},{name:'delmarks',shortName:'delm'},{name:'registers',shortName:'reg',excludeFromCommandHistory:!0},{name:'global', -shortName:'g'}],g=a.Pos;a.Vim=function(){function h(b,c){if(this==a.keyMap.vim&&(a.rmClass(b.getWrapperElement(),'cm-fat-cursor'),'contenteditable'==b.getOption('inputStyle')&&null!=document.body.style.caretColor)){var d=b.state.fatCursorMarks;if(d)for(var g=0;g'}function e(a){var b=a.state.vim;b.onPasteFn||(b.onPasteFn= -function(){b.insertMode||(a.setCursor(N(a.getCursor(),0,1)),Pb.enterInsertMode(a,{},b))});return b.onPasteFn}function n(a,b){for(var c=[],d=a;d=a.firstLine()&&b<=a.lastLine()}function t(a){return/^[A-Z]$/.test(a)}function D(a){return/^\s*$/.test(a)}function w(a,b){for(var c=0;ck? -m:0;k=d[n].anchor;var q=Math.min(k.line,e.line);m=Math.max(k.line,e.line);p=k.ch;e=e.ch;d=d[n].head.ch-p;n=e-p;0=n?(p++,h||e--):0>d&&0<=n?(p--,l||e++):0>d&&-1==n&&(p--,e++);for(h=q;h<=m;h++)d={anchor:new g(h,p),head:new g(h,e)},c.push(d);a.setSelections(c);b.ch=e;k.ch=p;return k}function ha(a,b,c){for(var d=[],e=0;eb&&(e.line=b),e.ch=qa(a,e.line)),{ranges:[{anchor:h,head:e}],primary:0};if('block'==c){b=Math.min(h.line,e.line);a=Math.min(h.ch,e.ch);c=Math.max(h.ch,e.ch)+1;h=Math.max(h.line,e.line)-b+1;e=e.line==b?0:h-1;d=[];for(var k= -0;k=a.length)return null;d?e=ne[0]:(e=Uc[0],e(a.charAt(h))||(e=Uc[1]));for(d=h;e(a.charAt(d))&&dl&&!d?d=!0:e=!1;for(m=b;m>k&&(e&&!a.getLine(m)!=d&&m!=b||!h(m,-1,!0));m--);return{start:new g(m,0),end:c}}function Sa(a,b,c,d){function e(a,b){0>b.pos+b.dir||b.pos+b.dir>=b.line.length?(b.ln+=b.dir,r(a,b.ln)?(b.line=a.getLine(b.ln),b.pos=0d?k(a,b.ln,b.pos,d):h(a,b.ln,b.pos,d),c--;return g(b.ln,b.pos)}function hb(){}function nb(a){a= -a.state.vim;return a.searchState_||(a.searchState_=new hb)}function Dc(a,b){b=Ub(a,b)||[];if(!b.length)return[];var c=[];if(0===b[0]){for(var d=0;d'+b+'',{bottom:!0,duration:5E3}):alert(b)}function qb(a,b){var c= -(b.prefix||'')+' '+(b.desc||''),d=b.desc,e=''+(b.prefix||'')+'';d&&(e+=' '+d+'');d=b.onClose;a.openDialog?a.openDialog(e,d,{bottom:!0,value:b.value,onKeyDown:b.onKeyDown,onKeyUp:b.onKeyUp,selectValueOnOpen:!1}):d(prompt(c,''))}function Gb(a,b,c,d){if(b){var e=nb(a);c=!!c;d=!!d;Ma.registerController.getRegister('/').setText(b);if(b instanceof RegExp)var g=b;else{var h=Ub(b,'/');if(h.length){var k= -b.substring(0,h[0]);g=-1!=b.substring(h[0]).indexOf('i')}else k=b;if(k){if(!z('pcre')){b=k;h=!1;k=[];for(var l=-1;l=b&&a<=c:a==b}function ab(a){var b=a.getScrollInfo(),c=a.coordsChar({left:0,top:6+b.top},'local');a=a.coordsChar({left:0,top:b.clientHeight-10+b.top},'local');return{top:c.line,bottom:a.line}}function yb(a,b,c){if("'"==c)return a=a.doc.history.done, -(a=a[a.length-2])&&a.ranges&&a.ranges[0].head;if('.'==c){if(0==a.doc.history.lastModTime)return;a=a.doc.history.done.filter(function(a){if(void 0!==a.changes)return a});a.reverse();return a[0].changes[0].to}return(a=b.marks[c])&&a.find()}function Ga(b,c,d,e,g,h,k,l,m){function p(){b.operation(function(){for(;!t;)n(),q();r()})}function n(){var a=b.getRange(h.from(),h.to()).replace(k,l);h.replace(a)}function q(){for(;h.findNext()&&Fb(h.from(),e,g);)if(d||!C||h.from().line!=C.line){b.scrollIntoView(h.from(), -30);b.setSelection(h.from(),h.to());C=h.from();t=!1;return}t=!0}function r(a){a&&a();b.focus();C&&(b.setCursor(C),a=b.state.vim,a.exMode=!1,a.lastHPos=a.lastHSPos=C.ch);m&&m()}b.state.vim.exMode=!0;var t=!1,C=h.from();q();t?Ya(b,'No matches for '+k.source):c?qb(b,{prefix:'replace with '+l+' (y/n/a/q/l)',onKeyDown:function(c,d,e){a.e_stop(c);switch(a.keyName(c)){case 'Y':n();q();break;case 'N':q();break;case 'A':c=m;m=void 0;b.operation(p);m=c;break;case 'L':n();case 'Q':case 'Esc':case 'Ctrl-C':case 'Ctrl-[':r(e)}t&& -r(e);return!0}}):(p(),m&&m())}function Vb(b){var c=b.state.vim,d=Ma.macroModeState,e=Ma.registerController.getRegister('.'),g=d.isPlaying,h=d.lastInsertModeChanges;g||(b.off('change',td),a.off(b.getInputField(),'keydown',Md));!g&&1',sa(e,d))}else c.insertMode||(c.lastHPos=b.getCursor().ch)}c.visualMode&&wb(b)}function wb(a){var b=a.state.vim,c=ja(a,ca(b.sel.head)),d=N(c,0,1);b.fakeCursor&&b.fakeCursor.clear();b.fakeCursor=a.markText(c,d,{className:'cm-animate-fat-cursor'})}function Ec(a){this.keyName= -a}function Md(b){function c(){d.maybeReset&&(d.changes=[],d.maybeReset=!1);d.changes.push(new Ec(e));return!0}var d=Ma.macroModeState.lastInsertModeChanges,e=a.keyName(b);e&&(-1==e.indexOf('Delete')&&-1==e.indexOf('Backspace')||a.lookupKey(e,'vim-insert',c))}function eb(a,b,c,d){function e(){k?ld.processAction(a,b,b.lastEditActionCommand):ld.evalInput(a,b)}function g(c){0']),mc=[].concat(Qd,qd,Qc,['-','"','.',':','/']),md={};u('filetype',void 0,'string',['ft'],function(a,b){if(void 0!==b){if(void 0===a)return a=b.getOption('mode'),'null'==a?'':a;b.setOption('mode', -''==a?'null':a)}});var Db=function(){var a=-1,b=0,c=0,d=Array(100);return{cachedCursor:void 0,add:function(e,g,h){function k(b){var c=++a%100,g=d[c];g&&g.clear();d[c]=e.setBookmark(b)}var l=d[a%100];l?(l=l.find())&&!ba(l,g)&&k(g):k(g);k(h);b=a;c=a-100+1;0>c&&(c=0)},move:function(e,g){a+=g;a>b?a=b:ac)}return h}}},Fc=function(a){return a?{changes:a.changes, -expectCursorActivityForChange:a.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};G.prototype={exitMacroRecordMode:function(){var a=Ma.macroModeState;if(a.onRecordingDone)a.onRecordingDone();a.onRecordingDone=void 0;a.isRecording=!1},enterMacroRecordMode:function(a,b){var c=Ma.registerController.getRegister(b);c&&(c.clear(),this.latestRegister=b,a.openDialog&&(this.onRecordingDone=a.openDialog('(recording)['+b+']',null,{bottom:!0})),this.isRecording=!0)}};var Ma,Ob,Wf= -{buildKeyMap:function(){},getRegisterController:function(){return Ma.registerController},resetVimGlobalState_:K,getVimGlobalState_:function(){return Ma},maybeInitVimState_:I,suppressErrorLogging:!1,InsertModeKey:Ec,map:function(a,b,c){Nd.map(a,b,c)},unmap:function(a,b){Nd.unmap(a,b)},noremap:function(a,c,e){function g(a){return a?[a]:['normal','insert','visual']}for(var h=g(e),k=b.length,l=k-d;l'==d)return C(c),l.visualMode?U(c):l.insertMode&&Vb(c),!0}function h(){if(g())return!0;for(var a=l.inputState.keyBuffer+=d,e=1==d.length,h=ld.matchCommand(a, -b,l.inputState,'insert');1|<\w+>|./.exec(b),d=e[0],b=b.substring(e.index+d.length),a.Vim.handleKey(c,d,'mapping');else ld.processCommand(c,l,m)}catch(cb){throw c.state.vim= -void 0,I(c),a.Vim.suppressErrorLogging||console.log(cb),cb;}return!0})}},handleEx:function(a,b){Nd.processCommand(a,b)},defineMotion:function(a,b){Ac[a]=b},defineAction:function(a,b){Pb[a]=b},defineOperator:function(a,b){ta[a]=b},mapCommand:function(a,b,c,d,e){a={keys:a,type:b};a[b]=c;a[b+'Args']=d;for(var g in e)a[g]=e[g];Fd(a)},_mapCommand:Fd,defineRegister:function(a,b){var c=Ma.registerController.registers;if(!a||1!=a.length)throw Error('Register name must be 1 character');if(c[a])throw Error('Register already defined '+ -a);c[a]=b;mc.push(a)},exitVisualMode:U,exitInsertMode:Vb};H.prototype.pushRepeatDigit=function(a){this.operator?this.motionRepeat=this.motionRepeat.concat(a):this.prefixRepeat=this.prefixRepeat.concat(a)};H.prototype.getRepeat=function(){var a=0;if(0=c.length)return this.iterator= -c.length,this.initialPrefix;if(0>e)return a},pushInput:function(a){var b=this.historyBuffer.indexOf(a);-1'==p.slice(-11)){l= -p.length-11;var n=m.slice(0,l);p=p.slice(0,l);m=n==p&&m.length>l?'full':0==p.indexOf(n)?'partial':!1}else m=m==p?'full':0==p.indexOf(m)?'partial':!1;l=m}l&&('partial'==m&&e.push(k),'full'==m&&g.push(k))}b=e.length&&e;g=g.length&&g;if(!g&&!b)return{type:'none'};if(!g&&b)return{type:'partial'};var q;for(b=0;b'==q.keys.slice(-11)){a=(g=/^.*(<[^>]+>)$/.exec(a))?g[1]:a.slice(-1);if(1':a='\n';break;case '':a=' ';break;default:a= +shortName:'g'}],c=a.Pos;a.Vim=function(){function k(b,c){if(this==a.keyMap.vim&&(a.rmClass(b.getWrapperElement(),'cm-fat-cursor'),'contenteditable'==b.getOption('inputStyle')&&null!=document.body.style.caretColor)){var d=b.state.fatCursorMarks;if(d)for(var e=0;e'}function g(a){var b=a.state.vim;b.onPasteFn||(b.onPasteFn= +function(){b.insertMode||(a.setCursor(N(a.getCursor(),0,1)),fc.enterInsertMode(a,{},b))});return b.onPasteFn}function p(a,b){for(var c=[],d=a;d=a.firstLine()&&b<=a.lastLine()}function u(a){return/^[A-Z]$/.test(a)}function E(a){return/^\s*$/.test(a)}function v(a,b){for(var c=0;ck? +m:0;k=e[p].anchor;var q=Math.min(k.line,g.line);m=Math.max(k.line,g.line);n=k.ch;g=g.ch;e=e[p].head.ch-n;p=g-n;0=p?(n++,h||g--):0>e&&0<=p?(n--,l||g++):0>e&&-1==p&&(n--,g++);for(h=q;h<=m;h++)e={anchor:new c(h,n),head:new c(h,g)},d.push(e);a.setSelections(d);b.ch=g;k.ch=n;return k}function ea(a,b,c){for(var d=[],e=0;eb&&(g.line=b),g.ch=oa(a,g.line)),{ranges:[{anchor:h,head:g}],primary:0};if('block'==d){b=Math.min(h.line,g.line);a=Math.min(h.ch,g.ch);d=Math.max(h.ch,g.ch)+1;h=Math.max(h.line,g.line)-b+1;g=g.line==b?0:h-1;e=[];for(var k= +0;k=a.length)return null;e?g=Td[0]:(g=Ce[0],g(a.charAt(h))||(g=Ce[1]));for(e=h;g(a.charAt(e))&&el&&!e?e=!0:g=!1;for(m=b;m>k&&(g&&!a.getLine(m)!=e&&m!=b||!h(m,-1,!0));m--);return{start:new c(m,0),end:d}}function Ba(a,b,d,e){function g(a,b){0>b.pos+b.dir||b.pos+b.dir>=b.line.length?(b.ln+=b.dir,r(a,b.ln)?(b.line=a.getLine(b.ln),b.pos=0e?k(a,b.ln,b.pos,e):h(a,b.ln,b.pos,e),d--;return c(b.ln,b.pos)}function wb(){}function Ta(a){a= +a.state.vim;return a.searchState_||(a.searchState_=new wb)}function tc(a,b){b=oc(a,b)||[];if(!b.length)return[];var c=[];if(0===b[0]){for(var d=0;d'+b+'',{bottom:!0,duration:5E3}):alert(b)}function rb(a,b){var c= +(b.prefix||'')+' '+(b.desc||''),d=b.desc,e=''+(b.prefix||'')+'';d&&(e+=' '+d+'');d=b.onClose;a.openDialog?a.openDialog(e,d,{bottom:!0,value:b.value,onKeyDown:b.onKeyDown,onKeyUp:b.onKeyUp,selectValueOnOpen:!1}):d(prompt(c,''))}function lc(a,b,c,d){if(b){var e=Ta(a);c=!!c;d=!!d;Ha.registerController.getRegister('/').setText(b);if(b instanceof RegExp)var g=b;else{var h=oc(b,'/');if(h.length){var k= +b.substring(0,h[0]);g=-1!=b.substring(h[0]).indexOf('i')}else k=b;if(k){if(!w('pcre')){b=k;h=!1;k=[];for(var l=-1;l=b&&a<=c:a==b}function Ra(a){var b=a.getScrollInfo(),c=a.coordsChar({left:0,top:6+b.top},'local');a=a.coordsChar({left:0,top:b.clientHeight-10+b.top},'local');return{top:c.line,bottom:a.line}}function Ua(a,b,c){if("'"==c)return a=a.doc.history.done, +(a=a[a.length-2])&&a.ranges&&a.ranges[0].head;if('.'==c){if(0==a.doc.history.lastModTime)return;a=a.doc.history.done.filter(function(a){if(void 0!==a.changes)return a});a.reverse();return a[0].changes[0].to}return(a=b.marks[c])&&a.find()}function va(b,c,d,e,g,h,k,l,m){function n(){b.operation(function(){for(;!u;)p(),q();r()})}function p(){var a=b.getRange(h.from(),h.to()).replace(k,l);h.replace(a)}function q(){for(;h.findNext()&&cc(h.from(),e,g);)if(d||!t||h.from().line!=t.line){b.scrollIntoView(h.from(), +30);b.setSelection(h.from(),h.to());t=h.from();u=!1;return}u=!0}function r(a){a&&a();b.focus();t&&(b.setCursor(t),a=b.state.vim,a.exMode=!1,a.lastHPos=a.lastHSPos=t.ch);m&&m()}b.state.vim.exMode=!0;var u=!1,t=h.from();q();u?Na(b,'No matches for '+k.source):c?rb(b,{prefix:'replace with '+l+' (y/n/a/q/l)',onKeyDown:function(c,d,e){a.e_stop(c);switch(a.keyName(c)){case 'Y':p();q();break;case 'N':q();break;case 'A':c=m;m=void 0;b.operation(n);m=c;break;case 'L':p();case 'Q':case 'Esc':case 'Ctrl-C':case 'Ctrl-[':r(e)}u&& +r(e);return!0}}):(n(),m&&m())}function Yb(b){var c=b.state.vim,d=Ha.macroModeState,e=Ha.registerController.getRegister('.'),g=d.isPlaying,h=d.lastInsertModeChanges;g||(b.off('change',Bc),a.off(b.getInputField(),'keydown',Le));!g&&1',pa(e,d))}else c.insertMode||(c.lastHPos=b.getCursor().ch)}c.visualMode&&uc(b)}function uc(a){var b=a.state.vim,c=ja(a,aa(b.sel.head)),d=N(c,0,1);b.fakeCursor&&b.fakeCursor.clear();b.fakeCursor=a.markText(c,d,{className:'cm-animate-fat-cursor'})}function Nb(a){this.keyName= +a}function Le(b){function c(){d.maybeReset&&(d.changes=[],d.maybeReset=!1);d.changes.push(new Nb(e));return!0}var d=Ha.macroModeState.lastInsertModeChanges,e=a.keyName(b);e&&(-1==e.indexOf('Delete')&&-1==e.indexOf('Backspace')||a.lookupKey(e,'vim-insert',c))}function Yc(a,b,c,d){function e(){k?Jc.processAction(a,b,b.lastEditActionCommand):Jc.evalInput(a,b)}function g(c){0']),Ab=[].concat(Nd,jd,Sc,['-','"','.',':','/']),qc={};t('filetype',void 0,'string',['ft'],function(a,b){if(void 0!==b){if(void 0===a)return a=b.getOption('mode'),'null'==a?'':a;b.setOption('mode', +''==a?'null':a)}});var Cc=function(){var a=-1,b=0,c=0,d=Array(100);return{cachedCursor:void 0,add:function(e,g,h){function k(b){var c=++a%100,g=d[c];g&&g.clear();d[c]=e.setBookmark(b)}var l=d[a%100];l?(l=l.find())&&!da(l,g)&&k(g):k(g);k(h);b=a;c=a-100+1;0>c&&(c=0)},move:function(e,g){a+=g;a>b?a=b:ac)}return h}}},Ub=function(a){return a?{changes:a.changes, +expectCursorActivityForChange:a.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};I.prototype={exitMacroRecordMode:function(){var a=Ha.macroModeState;if(a.onRecordingDone)a.onRecordingDone();a.onRecordingDone=void 0;a.isRecording=!1},enterMacroRecordMode:function(a,b){var c=Ha.registerController.getRegister(b);c&&(c.clear(),this.latestRegister=b,a.openDialog&&(this.onRecordingDone=a.openDialog('(recording)['+b+']',null,{bottom:!0})),this.isRecording=!0)}};var Ha,kc,de= +{buildKeyMap:function(){},getRegisterController:function(){return Ha.registerController},resetVimGlobalState_:K,getVimGlobalState_:function(){return Ha},maybeInitVimState_:H,suppressErrorLogging:!1,InsertModeKey:Nb,map:function(a,b,c){Uc.map(a,b,c)},unmap:function(a,b){Uc.unmap(a,b)},noremap:function(a,c,d){function g(a){return a?[a]:['normal','insert','visual']}for(var h=g(d),k=b.length,l=k-e;l'==d)return D(c),l.visualMode?S(c):l.insertMode&&Yb(c),!0}function h(){if(g())return!0;for(var a=l.inputState.keyBuffer+=d,e=1==d.length,h=Jc.matchCommand(a, +b,l.inputState,'insert');1|<\w+>|./.exec(b),d=e[0],b=b.substring(e.index+d.length),a.Vim.handleKey(c,d,'mapping');else Jc.processCommand(c,l,m)}catch(db){throw c.state.vim= +void 0,H(c),a.Vim.suppressErrorLogging||console.log(db),db;}return!0})}},handleEx:function(a,b){Uc.processCommand(a,b)},defineMotion:function(a,b){rd[a]=b},defineAction:function(a,b){fc[a]=b},defineOperator:function(a,b){Ja[a]=b},mapCommand:function(a,b,c,d,e){a={keys:a,type:b};a[b]=c;a[b+'Args']=d;for(var g in e)a[g]=e[g];Hd(a)},_mapCommand:Hd,defineRegister:function(a,b){var c=Ha.registerController.registers;if(!a||1!=a.length)throw Error('Register name must be 1 character');if(c[a])throw Error('Register already defined '+ +a);c[a]=b;Ab.push(a)},exitVisualMode:S,exitInsertMode:Yb};C.prototype.pushRepeatDigit=function(a){this.operator?this.motionRepeat=this.motionRepeat.concat(a):this.prefixRepeat=this.prefixRepeat.concat(a)};C.prototype.getRepeat=function(){var a=0;if(0=c.length)return this.iterator= +c.length,this.initialPrefix;if(0>e)return a},pushInput:function(a){var b=this.historyBuffer.indexOf(a);-1'==n.slice(-11)){l= +n.length-11;var p=m.slice(0,l);n=n.slice(0,l);m=p==n&&m.length>l?'full':0==n.indexOf(p)?'partial':!1}else m=m==n?'full':0==n.indexOf(m)?'partial':!1;l=m}l&&('partial'==m&&e.push(k),'full'==m&&g.push(k))}b=e.length&&e;g=g.length&&g;if(!g&&!b)return{type:'none'};if(!g&&b)return{type:'partial'};var q;for(b=0;b'==q.keys.slice(-11)){a=(g=/^.*(<[^>]+>)$/.exec(a))?g[1]:a.slice(-1);if(1':a='\n';break;case '':a=' ';break;default:a= ''}if(!a)return{type:'none'};c.selectedCharacter=a}return{type:'full',command:q}},processCommand:function(a,b,c){b.inputState.repeatOverride=c.repeatOverride;switch(c.type){case 'motion':this.processMotion(a,b,c);break;case 'operator':this.processOperator(a,b,c);break;case 'operatorMotion':this.processOperatorMotion(a,b,c);break;case 'action':this.processAction(a,b,c);break;case 'search':this.processSearch(a,b,c);break;case 'ex':case 'keyToEx':this.processEx(a,b,c)}},processMotion:function(a,b,c){b.inputState.motion= -c.motion;b.inputState.motionArgs=ia(c.motionArgs);this.evalInput(a,b)},processOperator:function(a,b,c){var d=b.inputState;if(d.operator){if(d.operator==c.operator){d.motion='expandToLine';d.motionArgs={linewise:!0};this.evalInput(a,b);return}C(a)}d.operator=c.operator;d.operatorArgs=ia(c.operatorArgs);b.visualMode&&this.evalInput(a,b)},processOperatorMotion:function(a,b,c){var d=b.visualMode,e=ia(c.operatorMotionArgs);e&&d&&e.visualLine&&(b.visualLine=!0);this.processOperator(a,b,c);d||this.processMotion(a, -b,c)},processAction:function(a,b,c){var d=b.inputState,e=d.getRepeat(),g=!!e,h=ia(c.actionArgs)||{};d.selectedCharacter&&(h.selectedCharacter=d.selectedCharacter);c.operator&&this.processOperator(a,b,c);c.motion&&this.processMotion(a,b,c);(c.motion||c.operator)&&this.evalInput(a,b);h.repeat=e||1;h.repeatIsExplicit=g;h.registerName=d.registerName;C(a);b.lastMotion=null;c.isEdit&&this.recordLastEdit(b,d,c);Pb[c.action](a,h,b)},processSearch:function(b,c,d){function e(a,e,g){Ma.searchHistoryController.pushInput(a); -Ma.searchHistoryController.reset();try{Gb(b,a,e,g)}catch(Tg){Ya(b,'Invalid regex: '+a);C(b);return}ld.processMotion(b,c,{type:'motion',motion:'findNext',motionArgs:{forward:!0,toJumplist:d.searchArgs.toJumplist}})}function g(a){b.scrollTo(q.left,q.top);e(a,!0,!0);var c=Ma.macroModeState;c.isRecording&&(c.isPlaying||(c=Ma.registerController.getRegister(c.latestRegister))&&c.pushSearchQuery&&c.pushSearchQuery(a))}function h(c,d,e){var g=a.keyName(c);if('Up'==g||'Down'==g){var h=c.target?c.target.selectionEnd: -0;d=Ma.searchHistoryController.nextMatch(d,'Up'==g?!0:!1)||'';e(d);h&&c.target&&(c.target.selectionEnd=c.target.selectionStart=Math.min(h,c.target.value.length))}else'Left'!=g&&'Right'!=g&&'Ctrl'!=g&&'Alt'!=g&&'Shift'!=g&&Ma.searchHistoryController.reset();try{var k=Gb(b,d,!0,!0)}catch(uc){}k?b.scrollIntoView(Qa(b,!l,k),30):(cc(b),b.scrollTo(q.left,q.top))}function k(c,d,e){var g=a.keyName(c);'Esc'==g||'Ctrl-C'==g||'Ctrl-['==g||'Backspace'==g&&''==d?(Ma.searchHistoryController.pushInput(d),Ma.searchHistoryController.reset(), -Gb(b,n),cc(b),b.scrollTo(q.left,q.top),a.e_stop(c),C(b),e(),b.focus()):'Up'==g||'Down'==g?a.e_stop(c):'Ctrl-U'==g&&(a.e_stop(c),e(''))}if(b.getSearchCursor){var l=d.searchArgs.forward,m=d.searchArgs.wholeWordOnly;nb(b).setReversed(!l);var p=l?'/':'?',n=nb(b).getQuery(),q=b.getScrollInfo();switch(d.searchArgs.querySrc){case 'prompt':m=Ma.macroModeState;m.isPlaying?(p=m.replaySearchQueries.shift(),e(p,!0,!1)):qb(b,{onClose:g,prefix:p,desc:jc,onKeyUp:h,onKeyDown:k});break;case 'wordUnderCursor':var r= -la(b,!1,!0,!1,!0),t=!0;r||(r=la(b,!1,!0,!1,!1),t=!1);r&&(p=b.getLine(r.start.line).substring(r.start.ch,r.end.ch),p=t&&m?'\\b'+p+'\\b':p.replace(/([.?*+$\[\]\/\\(){}|\-])/g,'\\$1'),Ma.jumpList.cachedCursor=b.getCursor(),b.setCursor(r.start),e(p,!0,!1))}}},processEx:function(b,c,d){function e(a){Ma.exCommandHistoryController.pushInput(a);Ma.exCommandHistoryController.reset();Nd.processCommand(b,a)}function g(c,d,e){var g=a.keyName(c);if('Esc'==g||'Ctrl-C'==g||'Ctrl-['==g||'Backspace'==g&&''==d)Ma.exCommandHistoryController.pushInput(d), -Ma.exCommandHistoryController.reset(),a.e_stop(c),C(b),e(),b.focus();if('Up'==g||'Down'==g){a.e_stop(c);var h=c.target?c.target.selectionEnd:0;d=Ma.exCommandHistoryController.nextMatch(d,'Up'==g?!0:!1)||'';e(d);h&&c.target&&(c.target.selectionEnd=c.target.selectionStart=Math.min(h,c.target.value.length))}else'Ctrl-U'==g?(a.e_stop(c),e('')):'Left'!=g&&'Right'!=g&&'Ctrl'!=g&&'Alt'!=g&&'Shift'!=g&&Ma.exCommandHistoryController.reset()}'keyToEx'==d.type?Nd.processCommand(b,d.exArgs.input):c.visualMode? -qb(b,{onClose:e,prefix:':',value:"'<,'>",onKeyDown:g,selectValueOnOpen:!1}):qb(b,{onClose:e,prefix:':',onKeyDown:g})},evalInput:function(a,b){var c=b.inputState,d=c.motion,e=c.motionArgs||{},h=c.operator,k=c.operatorArgs||{},l=c.registerName,m=b.sel,p=ca(b.visualMode?ja(a,m.head):a.getCursor('head')),n=ca(b.visualMode?ja(a,m.anchor):a.getCursor('anchor')),q=ca(p);n=ca(n);h&&this.recordLastEdit(b,c);var r=void 0!==c.repeatOverride?c.repeatOverride:c.getRepeat();if(0',L(u,t)?t:u)):h||(t=ja(a,t),a.setCursor(t.line,t.ch))}if(h){k.lastSel?(u=n,m=k.lastSel,t=Math.abs(m.head.line-m.anchor.line),p=Math.abs(m.head.ch-m.anchor.ch),t=m.visualLine?g(n.line+t,n.ch):m.visualBlock?g(n.line+t,n.ch+p):m.head.line==m.anchor.line?g(n.line,n.ch+p):g(n.line+t,n.ch),b.visualMode=!0,b.visualLine=m.visualLine,b.visualBlock=m.visualBlock,m=b.sel={anchor:u,head:t},ra(a)):b.visualMode&&(k.lastSel={anchor:ca(m.anchor), -head:ca(m.head),visualBlock:b.visualBlock,visualLine:b.visualLine});if(b.visualMode){if(u=na(m.head,m.anchor),m=sa(m.head,m.anchor),q=b.visualLine||k.linewise,e=b.visualBlock?'block':q?'line':'char',u=ya(a,{anchor:u,head:m},e),q)if(m=u.ranges,'block'==e)for(e=0;el&&b.line==l)return this.moveToEol(a,b,c,d);c.toFirstChar&&(e=Ea(a.getLine(h)),d.lastHPos=e);d.lastHSPos=a.charCoords(g(h,e),'div').left;return g(h,e)},moveByDisplayLines:function(a,b,c,d){switch(d.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:d.lastHSPos=a.charCoords(b,'div').left}var e= -c.repeat;b=a.findPosV(b,c.forward?e:-e,'line',d.lastHSPos);b.hitSide&&(c.forward?(c={top:a.charCoords(b,'div').top+8,left:d.lastHSPos},b=a.coordsChar(c,'div')):(c=a.charCoords(g(a.firstLine(),0),'div'),c.left=d.lastHSPos,b=a.coordsChar(c,'div')));d.lastHPos=b.ch;return b},moveByPage:function(a,b,c){var d=c.repeat;return a.findPosV(b,c.forward?d:-d,'page')},moveByParagraph:function(a,b,c){return mb(a,b,c.repeat,c.forward?1:-1)},moveBySentence:function(a,b,c){return Sa(a,b,c.repeat,c.forward?1:-1)}, -moveByScroll:function(a,b,c,d){var e=a.getScrollInfo(),g=c.repeat;g||(g=e.clientHeight/(2*a.defaultTextHeight()));var h=a.charCoords(b,'local');c.repeat=g;b=Ac.moveByDisplayLines(a,b,c,d);if(!b)return null;c=a.charCoords(b,'local');a.scrollTo(null,e.top+c.top-h.top);return b},moveByWords:function(a,b,c){var d=b,e=c.repeat;b=!!c.forward;var h=!!c.wordEnd,k=!!c.bigWord;c=ca(d);var l=[];(b&&!h||!b&&h)&&e++;for(var m=!(b&&h),p=0;p'===d?/[(){}[\]<>]/:/[(){}[\]]/,a.findMatchingBracket(g(c,d),{bracketRegex:b}).to):b},moveToStartOfLine:function(a,b){return g(b.line,0)},moveToLineOrEdgeOfDocument:function(a,b,c){b=c.forward?a.lastLine():a.firstLine();c.repeatIsExplicit&& -(b=c.repeat-a.getOption('firstLineNumber'));return g(b,Ea(a.getLine(b)))},textObjectManipulation:function(a,b,c,d){var e={"'":!0,'"':!0},h=c.selectedCharacter;'b'==h?h='(':'B'==h&&(h='{');var k=!c.textObjectInner;if({'(':')',')':'(','{':'}','}':'{','[':']',']':'[','<':'>','>':'<'}[h]){var l={'(':/[()]/,')':/[()]/,'[':/[[\]]/,']':/[[\]]/,'{':/[{}]/,'}':/[{}]/,'<':/[<>]/,'>':/[<>]/}[h];var m={'(':'(',')':'(','[':'[',']':'[','{':'{','}':'{','<':'<','>':'<'}[h];c=a.getLine(b.line).charAt(b.ch)===m?1: -0;m=a.scanForBracket(g(b.line,b.ch+c),-1,void 0,{bracketRegex:l});l=a.scanForBracket(g(b.line,b.ch+c),1,void 0,{bracketRegex:l});if(m&&l){m=m.pos;l=l.pos;if(m.line==l.line&&m.ch>l.ch||m.line>l.line)b=m,m=l,l=b;k?l.ch+=1:m.ch+=1;b={start:m,end:l}}else b={start:b,end:b}}else if(e[h]){c=h;b=ca(b);d=a.getLine(b.line).split('');h=d.indexOf(c);b.chb.lastLine()&&c.linewise&&!m?b.replaceRange('',e,l):b.replaceRange('',k,l);c.linewise&&(m||(b.setCursor(e),a.commands.newlineAndIndent(b)), -k.ch=Number.MAX_VALUE)}Ma.registerController.pushText(c.registerName,'change',h,c.linewise,1g.top?(d.line+=(e-g.top)/c,d.line=Math.ceil(d.line),a.setCursor(d),g=a.charCoords(d,'local'),a.scrollTo(null,g.top)):a.scrollTo(null,e):(b=e+a.getScrollInfo().clientHeight,b|<\w+>|./.exec(r),C=t[0],r=r.substring(t.index+C.length),a.Vim.handleKey(h,C,'macro'),k.insertMode&&(t=p.insertModeChanges[n++].changes,Ma.macroModeState.lastInsertModeChanges.changes=t,zc(h,t,1),Vb(h))}l.isPlaying=!1}},enterMacroRecordMode:function(a,b){var c=Ma.macroModeState;b=b.selectedCharacter;Ma.registerController.isValidRegister(b)&&c.enterMacroRecordMode(a,b)},toggleOverwrite:function(b){b.state.overwrite?(b.toggleOverwrite(!1),b.setOption('keyMap', -'vim-insert'),a.signal(b,'vim-mode-change',{mode:'insert'})):(b.toggleOverwrite(!0),b.setOption('keyMap','vim-replace'),a.signal(b,'vim-mode-change',{mode:'replace'}))},enterInsertMode:function(b,c,d){if(!b.getOption('readOnly')){d.insertMode=!0;d.insertModeRepeat=c&&c.repeat||1;var e=c?c.insertAt:null,h=d.sel,k=c.head||b.getCursor('head'),l=b.listSelections().length;if('eol'==e)k=g(k.line,qa(b,k.line));else if('charAfter'==e)k=N(k,0,1);else if('firstNonBlank'==e)k=Ac.moveToFirstNonWhiteSpaceCharacter(b, -k);else if('startOfSelectedArea'==e)d.visualBlock?(k=g(Math.min(h.head.line,h.anchor.line),Math.min(h.head.ch,h.anchor.ch)),l=Math.abs(h.head.line-h.anchor.line)+1):k=h.head.line=h.anchor.line?N(h.head,0,1):g(h.anchor.line,0);else if('inplace'==e&&d.visualMode)return;b.setOption('disableInput', -!1);c&&c.replace?(b.toggleOverwrite(!0),b.setOption('keyMap','vim-replace'),a.signal(b,'vim-mode-change',{mode:'replace'})):(b.toggleOverwrite(!1),b.setOption('keyMap','vim-insert'),a.signal(b,'vim-mode-change',{mode:'insert'}));Ma.macroModeState.isPlaying||(b.on('change',td),a.on(b.getInputField(),'keydown',Md));d.visualMode&&U(b);ha(b,k,l)}},toggleVisualMode:function(b,c,d){var e=c.repeat,h=b.getCursor();d.visualMode?d.visualLine^c.linewise||d.visualBlock^c.blockwise?(d.visualLine=!!c.linewise, -d.visualBlock=!!c.blockwise,a.signal(b,'vim-mode-change',{mode:'visual',subMode:d.visualLine?'linewise':d.visualBlock?'blockwise':''}),ra(b)):U(b):(d.visualMode=!0,d.visualLine=!!c.linewise,d.visualBlock=!!c.blockwise,c=ja(b,g(h.line,h.ch+e-1),!0),d.sel={anchor:h,head:c},a.signal(b,'vim-mode-change',{mode:'visual',subMode:d.visualLine?'linewise':d.visualBlock?'blockwise':''}),ra(b),Ka(b,d,'<',na(h,c)),Ka(b,d,'>',sa(h,c)))},reselectLastSelection:function(b,c,d){c=d.lastSelection;d.visualMode&&va(b, -d);if(c){var e=c.anchorMark.find(),g=c.headMark.find();e&&g&&(d.sel={anchor:e,head:g},d.visualMode=!0,d.visualLine=c.visualLine,d.visualBlock=c.visualBlock,ra(b),Ka(b,d,'<',na(e,g)),Ka(b,d,'>',sa(e,g)),a.signal(b,'vim-mode-change',{mode:'visual',subMode:d.visualLine?'linewise':d.visualBlock?'blockwise':''}))}},joinLines:function(a,b,c){if(c.visualMode){b=a.getCursor('anchor');var d=a.getCursor('head');if(L(d,b)){var e=d;d=b;b=e}d.ch=qa(a,d.line)-1}else d=Math.max(b.repeat,2),b=a.getCursor(),d=ja(a, -g(b.line+d-1,Infinity));for(var h=0,k=b.line;kb?'':a.getOption('indentWithTabs')?Array(Math.floor(b/k)+1).join('\t'):Array(b+1).join(' ')});h+=n?'\n':''}1a.lastLine()&&a.replaceRange('\n',g(r,0)),qa(a,r)l.length&&(c=l.length),l=g(h.line,c);'\n'==e?(d.visualMode||b.replaceRange('', -h,l),(a.commands.newlineAndIndentContinueComment||a.commands.newlineAndIndent)(b)):(c=b.getRange(h,l),c=c.replace(/[^\n]/g,e),d.visualBlock?(h=Array(b.getOption('tabSize')+1).join(' '),c=b.getSelection(),c=c.replace(/\t/g,h).replace(/[^\n]/g,e).split('\n'),b.replaceSelections(c)):b.replaceRange(c,h,l),d.visualMode?(h=L(k[0].anchor,k[0].head)?k[0].anchor:k[0].head,b.setCursor(h),U(b,!1)):b.setCursor(N(l,0,-1)))},incrementNumberToken:function(a,b){for(var c=a.getCursor(),d=a.getLine(c.line),e=/(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi, -h,k,l;null!==(h=e.exec(d))&&!(k=h.index,l=k+h[0].length,c.ch",onKeyDown:g,selectValueOnOpen:!1}):rb(b,{onClose:e,prefix:':',onKeyDown:g})},evalInput:function(a,b){var d=b.inputState,e=d.motion,g=d.motionArgs||{},h=d.operator,k=d.operatorArgs||{},l=d.registerName,m=b.sel,n=aa(b.visualMode?ja(a,m.head):a.getCursor('head')),p=aa(b.visualMode?ja(a,m.anchor):a.getCursor('anchor')),q=aa(n);p=aa(p);h&&this.recordLastEdit(b,d);var r=void 0!==d.repeatOverride?d.repeatOverride:d.getRepeat();if(0',R(t,u)?u:t)):h||(u=ja(a,u),a.setCursor(u.line,u.ch))}if(h){k.lastSel?(t=p,m=k.lastSel,u=Math.abs(m.head.line-m.anchor.line),n=Math.abs(m.head.ch-m.anchor.ch),u=m.visualLine?c(p.line+u,p.ch):m.visualBlock?c(p.line+u,p.ch+n):m.head.line==m.anchor.line?c(p.line,p.ch+n):c(p.line+u,p.ch),b.visualMode=!0,b.visualLine=m.visualLine,b.visualBlock=m.visualBlock,m=b.sel={anchor:t,head:u},ua(a)):b.visualMode&&(k.lastSel={anchor:aa(m.anchor), +head:aa(m.head),visualBlock:b.visualBlock,visualLine:b.visualLine});if(b.visualMode){if(t=ra(m.head,m.anchor),m=pa(m.head,m.anchor),q=b.visualLine||k.linewise,g=b.visualBlock?'block':q?'line':'char',t=ta(a,{anchor:t,head:m},g),q)if(m=t.ranges,'block'==g)for(g=0;gl&&b.line==l)return this.moveToEol(a,b,d,e);d.toFirstChar&&(g=Aa(a.getLine(h)),e.lastHPos=g);e.lastHSPos=a.charCoords(c(h,g),'div').left;return c(h,g)},moveByDisplayLines:function(a,b,d,e){switch(e.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:e.lastHSPos=a.charCoords(b,'div').left}var g= +d.repeat;b=a.findPosV(b,d.forward?g:-g,'line',e.lastHSPos);b.hitSide&&(d.forward?(d={top:a.charCoords(b,'div').top+8,left:e.lastHSPos},b=a.coordsChar(d,'div')):(d=a.charCoords(c(a.firstLine(),0),'div'),d.left=e.lastHSPos,b=a.coordsChar(d,'div')));e.lastHPos=b.ch;return b},moveByPage:function(a,b,c){var d=c.repeat;return a.findPosV(b,c.forward?d:-d,'page')},moveByParagraph:function(a,b,c){return ib(a,b,c.repeat,c.forward?1:-1)},moveBySentence:function(a,b,c){return Ba(a,b,c.repeat,c.forward?1:-1)}, +moveByScroll:function(a,b,c,d){var e=a.getScrollInfo(),g=c.repeat;g||(g=e.clientHeight/(2*a.defaultTextHeight()));var h=a.charCoords(b,'local');c.repeat=g;b=rd.moveByDisplayLines(a,b,c,d);if(!b)return null;c=a.charCoords(b,'local');a.scrollTo(null,e.top+c.top-h.top);return b},moveByWords:function(a,b,d){var e=b,g=d.repeat;b=!!d.forward;var h=!!d.wordEnd,k=!!d.bigWord;d=aa(e);var l=[];(b&&!h||!b&&h)&&g++;for(var m=!(b&&h),n=0;n'===e?/[(){}[\]<>]/:/[(){}[\]]/,a.findMatchingBracket(c(d,e),{bracketRegex:b}).to):b},moveToStartOfLine:function(a,b){return c(b.line,0)},moveToLineOrEdgeOfDocument:function(a,b,d){b=d.forward?a.lastLine():a.firstLine();d.repeatIsExplicit&& +(b=d.repeat-a.getOption('firstLineNumber'));return c(b,Aa(a.getLine(b)))},textObjectManipulation:function(a,b,d,e){var g={"'":!0,'"':!0},h=d.selectedCharacter;'b'==h?h='(':'B'==h&&(h='{');var k=!d.textObjectInner;if({'(':')',')':'(','{':'}','}':'{','[':']',']':'[','<':'>','>':'<'}[h]){var l={'(':/[()]/,')':/[()]/,'[':/[[\]]/,']':/[[\]]/,'{':/[{}]/,'}':/[{}]/,'<':/[<>]/,'>':/[<>]/}[h];var m={'(':'(',')':'(','[':'[',']':'[','{':'{','}':'{','<':'<','>':'<'}[h];d=a.getLine(b.line).charAt(b.ch)===m?1: +0;m=a.scanForBracket(c(b.line,b.ch+d),-1,void 0,{bracketRegex:l});l=a.scanForBracket(c(b.line,b.ch+d),1,void 0,{bracketRegex:l});if(m&&l){m=m.pos;l=l.pos;if(m.line==l.line&&m.ch>l.ch||m.line>l.line)b=m,m=l,l=b;k?l.ch+=1:m.ch+=1;b={start:m,end:l}}else b={start:b,end:b}}else if(g[h]){d=h;b=aa(b);e=a.getLine(b.line).split('');h=e.indexOf(d);b.chb.lastLine()&&d.linewise&&!m?b.replaceRange('',g,l):b.replaceRange('',k,l);d.linewise&&(m||(b.setCursor(g),a.commands.newlineAndIndent(b)), +k.ch=Number.MAX_VALUE)}Ha.registerController.pushText(d.registerName,'change',h,d.linewise,1g.top?(d.line+=(e-g.top)/c,d.line=Math.ceil(d.line),a.setCursor(d),g=a.charCoords(d,'local'),a.scrollTo(null,g.top)):a.scrollTo(null,e):(b=e+a.getScrollInfo().clientHeight,b|<\w+>|./.exec(r),t=u[0],r=r.substring(u.index+t.length),a.Vim.handleKey(h,t,'macro'),k.insertMode&&(u=n.insertModeChanges[p++].changes,Ha.macroModeState.lastInsertModeChanges.changes=u,ld(h,u,1),Yb(h))}l.isPlaying=!1}},enterMacroRecordMode:function(a,b){var c=Ha.macroModeState;b=b.selectedCharacter;Ha.registerController.isValidRegister(b)&&c.enterMacroRecordMode(a,b)},toggleOverwrite:function(b){b.state.overwrite?(b.toggleOverwrite(!1),b.setOption('keyMap', +'vim-insert'),a.signal(b,'vim-mode-change',{mode:'insert'})):(b.toggleOverwrite(!0),b.setOption('keyMap','vim-replace'),a.signal(b,'vim-mode-change',{mode:'replace'}))},enterInsertMode:function(b,d,e){if(!b.getOption('readOnly')){e.insertMode=!0;e.insertModeRepeat=d&&d.repeat||1;var g=d?d.insertAt:null,h=e.sel,k=d.head||b.getCursor('head'),l=b.listSelections().length;if('eol'==g)k=c(k.line,oa(b,k.line));else if('charAfter'==g)k=N(k,0,1);else if('firstNonBlank'==g)k=rd.moveToFirstNonWhiteSpaceCharacter(b, +k);else if('startOfSelectedArea'==g)e.visualBlock?(k=c(Math.min(h.head.line,h.anchor.line),Math.min(h.head.ch,h.anchor.ch)),l=Math.abs(h.head.line-h.anchor.line)+1):k=h.head.line=h.anchor.line?N(h.head,0,1):c(h.anchor.line,0);else if('inplace'==g&&e.visualMode)return;b.setOption('disableInput', +!1);d&&d.replace?(b.toggleOverwrite(!0),b.setOption('keyMap','vim-replace'),a.signal(b,'vim-mode-change',{mode:'replace'})):(b.toggleOverwrite(!1),b.setOption('keyMap','vim-insert'),a.signal(b,'vim-mode-change',{mode:'insert'}));Ha.macroModeState.isPlaying||(b.on('change',Bc),a.on(b.getInputField(),'keydown',Le));e.visualMode&&S(b);ea(b,k,l)}},toggleVisualMode:function(b,d,e){var g=d.repeat,h=b.getCursor();e.visualMode?e.visualLine^d.linewise||e.visualBlock^d.blockwise?(e.visualLine=!!d.linewise, +e.visualBlock=!!d.blockwise,a.signal(b,'vim-mode-change',{mode:'visual',subMode:e.visualLine?'linewise':e.visualBlock?'blockwise':''}),ua(b)):S(b):(e.visualMode=!0,e.visualLine=!!d.linewise,e.visualBlock=!!d.blockwise,d=ja(b,c(h.line,h.ch+g-1),!0),e.sel={anchor:h,head:d},a.signal(b,'vim-mode-change',{mode:'visual',subMode:e.visualLine?'linewise':e.visualBlock?'blockwise':''}),ua(b),Ia(b,e,'<',ra(h,d)),Ia(b,e,'>',pa(h,d)))},reselectLastSelection:function(b,c,d){c=d.lastSelection;d.visualMode&&wa(b, +d);if(c){var e=c.anchorMark.find(),g=c.headMark.find();e&&g&&(d.sel={anchor:e,head:g},d.visualMode=!0,d.visualLine=c.visualLine,d.visualBlock=c.visualBlock,ua(b),Ia(b,d,'<',ra(e,g)),Ia(b,d,'>',pa(e,g)),a.signal(b,'vim-mode-change',{mode:'visual',subMode:d.visualLine?'linewise':d.visualBlock?'blockwise':''}))}},joinLines:function(a,b,d){if(d.visualMode){b=a.getCursor('anchor');var e=a.getCursor('head');if(R(e,b)){var g=e;e=b;b=g}e.ch=oa(a,e.line)-1}else e=Math.max(b.repeat,2),b=a.getCursor(),e=ja(a, +c(b.line+e-1,Infinity));for(var h=0,k=b.line;kb?'':a.getOption('indentWithTabs')?Array(Math.floor(b/k)+1).join('\t'):Array(b+1).join(' ')});h+=p?'\n':''}1a.lastLine()&&a.replaceRange('\n',c(r,0)),oa(a,r)l.length&&(d=l.length),l=c(h.line,d);'\n'==g?(e.visualMode||b.replaceRange('', +h,l),(a.commands.newlineAndIndentContinueComment||a.commands.newlineAndIndent)(b)):(d=b.getRange(h,l),d=d.replace(/[^\n]/g,g),e.visualBlock?(h=Array(b.getOption('tabSize')+1).join(' '),d=b.getSelection(),d=d.replace(/\t/g,h).replace(/[^\n]/g,g).split('\n'),b.replaceSelections(d)):b.replaceRange(d,h,l),e.visualMode?(h=R(k[0].anchor,k[0].head)?k[0].anchor:k[0].head,b.setCursor(h),S(b,!1)):b.setCursor(N(l,0,-1)))},incrementNumberToken:function(a,b){for(var d=a.getCursor(),e=a.getLine(d.line),g=/(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi, +h,k,l;null!==(h=g.exec(e))&&!(k=h.index,l=k+h[0].length,d.chb.args.length?Ya(a,a.getOption('theme')):a.setOption('theme',b.args[0])},map:function(a,b,c){var d=b.args;!d||2>d.length?a&&Ya(a,'Invalid mapping: '+b.input):Nd.map(d[0],d[1],c)},imap:function(a,b){this.map(a,b,'insert')},nmap:function(a,b){this.map(a,b,'normal')},vmap:function(a,b){this.map(a,b,'visual')},unmap:function(a,b,c){var d=b.args;!d||1>d.length?a&&Ya(a,'No such mapping: '+b.input):Nd.unmap(d[0],c)},move:function(a,b){ld.processCommand(a,a.state.vim, -{type:'motion',motion:'moveToLineOrEdgeOfDocument',motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:b.line+1})},set:function(a,b){var c=b.args,d=b.setCfg||{};if(!c||1>c.length)a&&Ya(a,'Invalid mapping: '+b.input);else{var e=c[0].split('=');c=e[0];e=e[1];var g=!1;if('?'==c.charAt(c.length-1)){if(e)throw Error('Trailing characters: '+b.argString);c=c.substring(0,c.length-1);g=!0}void 0===e&&'no'==c.substring(0,2)&&(c=c.substring(2),e=!1);(b=md[c]&&'boolean'==md[c].type)&&void 0== -e&&(e=!0);!b&&void 0===e||g?(d=z(c,a,d),d instanceof Error?Ya(a,d.message):!0===d||!1===d?Ya(a,' '+(d?'':'no')+c):Ya(a,' '+c+'='+d)):(d=v(c,e,a,d),d instanceof Error&&Ya(a,d.message))}},setlocal:function(a,b){b.setCfg={scope:'local'};this.set(a,b)},setglobal:function(a,b){b.setCfg={scope:'global'};this.set(a,b)},registers:function(a,b){var c=b.args;b=Ma.registerController.registers;var d='----------Registers----------

';if(c){c=c.join('');for(var e=0;e'}}else for(var h in b)c=b[h].toString(),c.length&&(d+='"'+h+' '+c+'
');Ya(a,d)},sort:function(b,c){function d(a,b){if(h){var c=a;a=b;b=c}k&&(a=a.toLowerCase(),b=b.toLowerCase());c=m&&t.exec(a);var d=m&&t.exec(b);if(!c)return a');if(g){var k=0,l=function(){k=k){Ya(b,'Invalid argument: '+c.argString.substring(g));break}for(g=0;g<=k-h;g++){var l=String.fromCharCode(h+g);delete d.marks[l]}}else{Ya(b,'Invalid argument: '+h+'-');break}}else delete d.marks[h]}else Ya(b, -'Argument required')}},Nd=new Nf;a.keyMap.vim={attach:k,detach:h,call:q};u('insertModeEscKeysTimeout',200,'number');a.keyMap['vim-insert']={fallthrough:['default'],attach:k,detach:h,call:q};a.keyMap['vim-replace']={Backspace:'goCharLeft',fallthrough:['vim-insert'],attach:k,detach:h,call:q};K();return Wf}()}); -(function(a){'object'==typeof exports&&'object'==typeof module?a(require('../../lib/codemirror')):'function'==typeof define&&define.amd?define(['../../lib/codemirror'],a):a(CodeMirror)})(function(a){a.defineMode('javascript',function(b,d){function c(a,b,c){Ac=a;ta=c;return b}function g(a,b){var d=a.next();if('"'==d||"'"==d)return b.tokenize=h(d),b.tokenize(a,b);if('.'==d&&a.match(/^\d+(?:[eE][+\-]?\d+)?/))return c('number','number');if('.'==d&&a.match('..'))return c('spread','meta');if(/[\[\]{}\(\),;:\.]/.test(d))return c(d); -if('='==d&&a.eat('>'))return c('=>','operator');if('0'==d&&a.match(/^(?:x[\da-f]+|o[0-7]+|b[01]+)n?/i))return c('number','number');if(/\d/.test(d))return a.match(/^\d*(?:n|(?:\.\d*)?(?:[eE][+\-]?\d+)?)?/),c('number','number');if('/'==d){if(a.eat('*'))return b.tokenize=k,k(a,b);if(a.eat('/'))return a.skipToEnd(),c('comment','comment');if(Qc(a,b,1)){a:for(var e=b=!1;null!=(d=a.next());){if(!b){if('/'==d&&!e)break a;'['==d?e=!0:e&&']'==d&&(e=!1)}b=!b&&'\\'==d}a.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/); -return c('regexp','string-2')}a.eat('=');return c('operator','operator',a.current())}if('`'==d)return b.tokenize=l,l(a,b);if('#'==d)return a.skipToEnd(),c('error','error');if(Wf.test(d))return'>'==d&&b.lexical&&'>'==b.lexical.type||(a.eat('=')?'!'!=d&&'='!=d||a.eat('='):/[<>*+\-]/.test(d)&&(a.eat(d),'>'==d&&a.eat(d))),c('operator','operator',a.current());if(Ma.test(d)){a.eatWhile(Ma);d=a.current();if('.'!=b.lastType){if(Ob.propertyIsEnumerable(d))return a=Ob[d],c(a.type,a.style,d);if('async'==d&& -a.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/,!1))return c('async','keyword',d)}return c('variable','variable',d)}}function h(a){return function(b,d){var e=!1,h;if(md&&'@'==b.peek()&&b.match(ld))return d.tokenize=g,c('jsonld-keyword','meta');for(;null!=(h=b.next())&&(h!=a||e);)e=!e&&'\\'==h;e||(d.tokenize=g);return c('string','string')}}function k(a,b){for(var d=!1,e;e=a.next();){if('/'==e&&d){b.tokenize=g;break}d='*'==e}return c('comment','comment')}function l(a,b){for(var d=!1,e;null!=(e=a.next());){if(!d&& -('`'==e||'$'==e&&a.eat('{'))){b.tokenize=g;break}d=!d&&'\\'==e}return c('quasi','string-2',a.current())}function m(a,b){b.fatArrowAt&&(b.fatArrowAt=null);var c=a.string.indexOf('=>',a.start);if(!(0>c)){if(Fc){var d=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(a.string.slice(a.start,c));d&&(c=d.index)}d=0;var e=!1;for(--c;0<=c;--c){var g=a.string.charAt(c),h='([{}])'.indexOf(g);if(0<=h&&3>h){if(!d){++c;break}if(0==--d){'('==g&&(e=!0);break}}else if(3<=h&&6>h)++d;else if(Ma.test(g))e=!0;else{if(/["'\/]/.test(g))return; -if(e&&!d){++c;break}}}e&&!d&&(b.fatArrowAt=c)}}function q(a,b,c,d,e,g){this.indented=a;this.column=b;this.type=c;this.prev=e;this.info=g;null!=d&&(this.align=d)}function p(){for(var a=arguments.length-1;0<=a;a--)La.cc.push(arguments[a])}function e(){p.apply(null,arguments);return!0}function n(a,b){for(;b;b=b.next)if(b.name==a)return!0;return!1}function r(a){var b=La.state;La.marked='def';if(b.context)if('var'==b.lexical.info&&b.context&&b.context.block){var c=t(a,b.context);if(null!=c){b.context= -c;return}}else if(!n(a,b.localVars)){b.localVars=new u(a,b.localVars);return}d.globalVars&&!n(a,b.globalVars)&&(b.globalVars=new u(a,b.globalVars))}function t(a,b){return b?b.block?(a=t(a,b.prev))?a==b.prev?b:new w(a,b.vars,!0):null:n(a,b.vars)?b:new w(b.prev,new u(a,b.vars),!1):null}function D(a){return'public'==a||'private'==a||'protected'==a||'abstract'==a||'readonly'==a}function w(a,b,c){this.prev=a;this.vars=b;this.block=c}function u(a,b){this.name=a;this.next=b}function v(){La.state.context= -new w(La.state.context,La.state.localVars,!1);La.state.localVars=Le}function z(){La.state.context=new w(La.state.context,La.state.localVars,!0);La.state.localVars=null}function G(){La.state.localVars=La.state.context.vars;La.state.context=La.state.context.prev}function I(a,b){var c=function(){var c=La.state,d=c.indented;if('stat'==c.lexical.type)d=c.lexical.indented;else for(var e=c.lexical;e&&')'==e.type&&e.align;e=e.prev)d=e.indented;c.lexical=new q(d,La.stream.column(),a,null,c.lexical,b)};c.lex= -!0;return c}function K(){var a=La.state;a.lexical.prev&&(')'==a.lexical.type&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function H(a){function b(c){return c==a?e():';'==a||'}'==c||')'==c||']'==c?p():e(b)}return b}function C(a,b){return'var'==a?e(I('vardef',b),Dc,H(';'),K):'keyword a'==a?e(I('form'),fa,C,K):'keyword b'==a?e(I('form'),C,K):'keyword d'==a?La.stream.match(/^\s*$/,!1)?e():e(I('stat'),ia,H(';'),K):'debugger'==a?e(H(';')):'{'==a?e(I('}'),z,ra,K,G):';'==a?e():'if'==a?('else'== -La.state.lexical.info&&La.state.cc[La.state.cc.length-1]==K&&La.state.cc.pop()(),e(I('form'),fa,C,K,xb)):'function'==a?e(Ga):'for'==a?e(I('form'),Qa,C,K):'class'==a||Fc&&'interface'==b?(La.marked='keyword',e(I('form'),td,K)):'variable'==a?Fc&&'declare'==b?(La.marked='keyword',e(C)):Fc&&('module'==b||'enum'==b||'type'==b)&&La.stream.match(/^\s*\w/,!1)?(La.marked='keyword','enum'==b?e(Qd):'type'==b?e(la,H('operator'),la,H(';')):e(I('form'),Ub,H('{'),I('}'),ra,K,K)):Fc&&'namespace'==b?(La.marked='keyword', -e(I('form'),Q,ra,K)):Fc&&'abstract'==b?(La.marked='keyword',e(C)):e(I('stat'),qa):'switch'==a?e(I('form'),fa,H('{'),I('}','switch'),z,ra,K,K,G):'case'==a?e(Q,H(':')):'default'==a?e(H(':')):'catch'==a?e(I('form'),v,P,C,K,G):'export'==a?e(I('stat'),Md,K):'import'==a?e(I('stat'),zc,K):'async'==a?e(C):'@'==b?e(Q,C):p(I('stat'),Q,H(';'),K)}function P(a){if('('==a)return e(Vb,H(')'))}function Q(a,b){return ja(a,b,!1)}function T(a,b){return ja(a,b,!0)}function fa(a){return'('!=a?p():e(I(')'),Q,H(')'),K)} -function ja(a,b,c){if(La.state.fatArrowAt==La.stream.start){var d=c?L:ba;if('('==a)return e(v,I(')'),ka(Vb,')'),K,H('=>'),d,G);if('variable'==a)return p(v,Ub,H('=>'),d,G)}d=c?ma:N;return Pb.hasOwnProperty(a)?e(d):'function'==a?e(Ga,d):'class'==a||Fc&&'interface'==b?(La.marked='keyword',e(I('form'),Fd,K)):'keyword c'==a||'async'==a?e(c?T:Q):'('==a?e(I(')'),ia,H(')'),K,d):'operator'==a||'spread'==a?e(c?T:Q):'['==a?e(I(']'),ne,K,d):'{'==a?va(O,'}',null,d):'quasi'==a?p(V,d):'new'==a?e(na(c)):'import'== -a?e(Q):e()}function ia(a){return a.match(/[;\}\)\],]/)?p():p(Q)}function N(a,b){return','==a?e(Q):ma(a,b,!1)}function ma(a,b,c){var d=0==c?N:ma,g=0==c?Q:T;if('=>'==a)return e(v,c?L:ba,G);if('operator'==a)return/\+\+|--/.test(b)||Fc&&'!'==b?e(d):Fc&&'<'==b&&La.stream.match(/^([^>]|<.*?>)*>\s*\(/,!1)?e(I('>'),ka(la,'>'),K,d):'?'==b?e(Q,H(':'),g):e(g);if('quasi'==a)return p(V,d);if(';'!=a){if('('==a)return va(T,')','call',d);if('.'==a)return e(oa,d);if('['==a)return e(I(']'),ia,H(']'),K,d);if(Fc&&'as'== -b)return La.marked='keyword',e(la,d);if('regexp'==a)return La.state.lastType=La.marked='operator',La.stream.backUp(La.stream.pos-La.stream.start-1),e(g)}}function V(a,b){return'quasi'!=a?p():'${'!=b.slice(b.length-2)?e(V):e(Q,ca)}function ca(a){if('}'==a)return La.marked='string-2',La.state.tokenize=l,e(V)}function ba(a){m(La.stream,La.state);return p('{'==a?C:Q)}function L(a){m(La.stream,La.state);return p('{'==a?C:T)}function na(a){return function(b){return'.'==b?e(a?ea:sa):'variable'==b&&Fc?e(Sa, -a?ma:N):p(a?T:Q)}}function sa(a,b){if('target'==b)return La.marked='keyword',e(N)}function ea(a,b){if('target'==b)return La.marked='keyword',e(ma)}function qa(a){return':'==a?e(K,C):p(N,H(';'),K)}function oa(a){if('variable'==a)return La.marked='property',e()}function O(a,b){if('async'==a)return La.marked='property',e(O);if('variable'==a||'keyword'==La.style){La.marked='property';if('get'==b||'set'==b)return e(ua);var c;Fc&&La.state.fatArrowAt==La.stream.start&&(c=La.stream.match(/^\s*:\s*/,!1))&& -(La.state.fatArrowAt=La.stream.pos+c[0].length);return e(ha)}if('number'==a||'string'==a)return La.marked=md?'property':La.style+' property',e(ha);if('jsonld-keyword'==a)return e(ha);if(Fc&&D(b))return La.marked='keyword',e(O);if('['==a)return e(Q,ya,H(']'),ha);if('spread'==a)return e(T,ha);if('*'==b)return La.marked='keyword',e(O);if(':'==a)return p(ha)}function ua(a){if('variable'!=a)return p(ha);La.marked='property';return e(Ga)}function ha(a){if(':'==a)return e(T);if('('==a)return p(Ga)}function ka(a, -b,c){function d(g,h){return(c?-1'),la)}function xa(a){if('=>'==a)return e(la)}function Da(a,b){if('variable'== -a||'keyword'==La.style)return La.marked='property',e(Da);if('?'==b)return e(Da);if(':'==a)return e(la);if('['==a)return e(Q,ya,H(']'),Da)}function Ka(a,b){return'variable'==a&&La.stream.match(/^\s*[?:]/,!1)||'?'==b?e(Ka):':'==a?e(la):p(la)}function mb(a,b){if('<'==b)return e(I('>'),ka(la,'>'),K,mb);if('|'==b||'.'==a||'&'==b)return e(la);if('['==a)return e(H(']'),mb);if('extends'==b||'implements'==b)return La.marked='keyword',e(la)}function Sa(a,b){if('<'==b)return e(I('>'),ka(la,'>'),K,mb)}function hb(){return p(la, -nb)}function nb(a,b){if('='==b)return e(la)}function Dc(a,b){return'enum'==b?(La.marked='keyword',e(Qd)):p(Ub,ya,Gb,Qb)}function Ub(a,b){if(Fc&&D(b))return La.marked='keyword',e(Ub);if('variable'==a)return r(b),e();if('spread'==a)return e(Ub);if('['==a)return va(qb,']');if('{'==a)return va(Ya,'}')}function Ya(a,b){if('variable'==a&&!La.stream.match(/^\s*:/,!1))return r(b),e(Gb);'variable'==a&&(La.marked='property');return'spread'==a?e(Ub):'}'==a?p():'['==a?e(Q,H(']'),H(':'),Ya):e(H(':'),Ub,Gb)}function qb(){return p(Ub, -Gb)}function Gb(a,b){if('='==b)return e(T)}function Qb(a){if(','==a)return e(Dc)}function xb(a,b){if('keyword b'==a&&'else'==b)return e(I('form','else'),C,K)}function Qa(a,b){if('await'==b)return e(Qa);if('('==a)return e(I(')'),cc,H(')'),K)}function cc(a){return'var'==a?e(Dc,H(';'),ab):';'==a?e(ab):'variable'==a?e(Fb):p(Q,H(';'),ab)}function Fb(a,b){return'in'==b||'of'==b?(La.marked='keyword',e(Q)):e(N,ab)}function ab(a,b){return';'==a?e(yb):'in'==b||'of'==b?(La.marked='keyword',e(Q)):p(Q,H(';'), -yb)}function yb(a){')'!=a&&e(Q)}function Ga(a,b){if('*'==b)return La.marked='keyword',e(Ga);if('variable'==a)return r(b),e(Ga);if('('==a)return e(v,I(')'),ka(Vb,')'),K,U,C,G);if(Fc&&'<'==b)return e(I('>'),ka(hb,'>'),K,Ga)}function Vb(a,b){'@'==b&&e(Q,Vb);return'spread'==a?e(Vb):Fc&&D(b)?(La.marked='keyword',e(Vb)):p(Ub,ya,Gb)}function Fd(a,b){return'variable'==a?td(a,b):Sb(a,b)}function td(a,b){if('variable'==a)return r(b),e(Sb)}function Sb(a,b){if('<'==b)return e(I('>'),ka(hb,'>'),K,Sb);if('extends'== -b||'implements'==b||Fc&&','==a)return'implements'==b&&(La.marked='keyword'),e(Fc?la:Q,Sb);if('{'==a)return e(I('}'),wb,K)}function wb(a,b){if('async'==a||'variable'==a&&('static'==b||'get'==b||'set'==b||Fc&&D(b))&&La.stream.match(/^\s+[\w$\xa1-\uffff]/,!1))return La.marked='keyword',e(wb);if('variable'==a||'keyword'==La.style)return La.marked='property',e(Fc?Ec:Ga,wb);if('['==a)return e(Q,ya,H(']'),Fc?Ec:Ga,wb);if('*'==b)return La.marked='keyword',e(wb);if(';'==a)return e(wb);if('}'==a)return e(); -if('@'==b)return e(Q,wb)}function Ec(a,b){return'?'==b?e(Ec):':'==a?e(la,Gb):'='==b?e(T):p(Ga)}function Md(a,b){return'*'==b?(La.marked='keyword',e(Uc,H(';'))):'default'==b?(La.marked='keyword',e(Q,H(';'))):'{'==a?e(ka(eb,'}'),Uc,H(';')):p(C)}function eb(a,b){if('as'==b)return La.marked='keyword',e(H('variable'));if('variable'==a)return p(T,eb)}function zc(a){return'string'==a?e():'('==a?p(Q):p(me,Qe,Uc)}function me(a,b){if('{'==a)return va(me,'}');'variable'==a&&r(b);'*'==b&&(La.marked='keyword'); -return e(df)}function Qe(a){if(','==a)return e(me,Qe)}function df(a,b){if('as'==b)return La.marked='keyword',e(me)}function Uc(a,b){if('from'==b)return La.marked='keyword',e(Q)}function ne(a){return']'==a?e():p(ka(T,']'))}function Qd(){return p(I('form'),Ub,H('{'),I('}'),ka(qd,'}'),K,K)}function qd(){return p(Ub,Gb)}function Qc(a,b,c){return b.tokenize==g&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(b.lastType)||'quasi'==b.lastType&&/\{\s*$/.test(a.string.slice(0, -a.pos-(c||0)))}var gc=b.indentUnit,mc=d.statementIndent,md=d.jsonld,Db=d.json||md,Fc=d.typescript,Ma=d.wordCharacters||/[\w$\xa1-\uffff]/,Ob=function(){function a(a){return{type:a,style:'keyword'}}var b=a('keyword a'),c=a('keyword b'),d=a('keyword c'),e=a('keyword d'),g=a('operator'),h={type:'atom',style:'atom'};return{'if':a('if'),'while':b,'with':b,'else':c,'do':c,'try':c,'finally':c,'return':e,'break':e,'continue':e,'new':a('new'),'delete':d,'void':d,'throw':d,'debugger':a('debugger'),'var':a('var'), -'const':a('var'),let:a('var'),'function':a('function'),'catch':a('catch'),'for':a('for'),'switch':a('switch'),'case':a('case'),'default':a('default'),'in':g,'typeof':g,'instanceof':g,'true':h,'false':h,'null':h,undefined:h,NaN:h,Infinity:h,'this':a('this'),'class':a('class'),'super':a('atom'),yield:d,'export':a('export'),'import':a('import'),'extends':d,await:d}}(),Wf=/[+\-*&%=<>!?|~^@]/,ld=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Ac,ta,Pb={atom:!0,number:!0, -variable:!0,string:!0,regexp:!0,'this':!0,'jsonld-keyword':!0},La={state:null,column:null,marked:null,cc:null},Le=new u('this',new u('arguments',null));G.lex=!0;K.lex=!0;return{startState:function(a){a={tokenize:g,lastType:'sof',cc:[],lexical:new q((a||0)-gc,0,'block',!1),localVars:d.localVars,context:d.localVars&&new w(null,null,!1),indented:a||0};d.globalVars&&'object'==typeof d.globalVars&&(a.globalVars=d.globalVars);return a},token:function(a,b){a.sol()&&(b.lexical.hasOwnProperty('align')||(b.lexical.align= -!1),b.indented=a.indentation(),m(a,b));if(b.tokenize!=k&&a.eatSpace())return null;var c=b.tokenize(a,b);if('comment'==Ac)return c;b.lastType='operator'!=Ac||'++'!=ta&&'--'!=ta?Ac:'incdec';a:{var d=Ac,e=ta,g=b.cc;La.state=b;La.stream=a;La.marked=null;La.cc=g;La.style=c;b.lexical.hasOwnProperty('align')||(b.lexical.align=!0);for(;;)if((g.length?g.pop():Db?Q:C)(d,e)){for(;g.length&&g[g.length-1].lex;)g.pop()();if(La.marked){c=La.marked;break a}if(a='variable'==d)b:{for(a=b.localVars;a;a=a.next)if(a.name== -e){a=!0;break b}for(b=b.context;b;b=b.prev)for(a=b.vars;a;a=a.next)if(a.name==e){a=!0;break b}a=void 0}if(a){c='variable-2';break a}break a}}return c},indent:function(b,c){if(b.tokenize==k)return a.Pass;if(b.tokenize!=g)return 0;var e=c&&c.charAt(0),h=b.lexical,l;if(!/^\s*else\b/.test(c))for(var m=b.cc.length-1;0<=m;--m){var p=b.cc[m];if(p==K)h=h.prev;else if(p!=xb)break}for(;!('stat'!=h.type&&'form'!=h.type||'}'!=e&&(!(l=b.cc[b.cc.length-1])||l!=N&&l!=ma||/^[,\.=+\-*:?[\(]/.test(c)));)h=h.prev;mc&& -')'==h.type&&'stat'==h.prev.type&&(h=h.prev);l=h.type;m=e==l;return'vardef'==l?h.indented+('operator'==b.lastType||','==b.lastType?h.info.length+1:0):'form'==l&&'{'==e?h.indented:'form'==l?h.indented+gc:'stat'==l?(e=h.indented,b='operator'==b.lastType||','==b.lastType||Wf.test(c.charAt(0))||/[,.]/.test(c.charAt(0)),e+(b?mc||gc:0)):'switch'!=h.info||m||0==d.doubleIndentSwitch?h.align?h.column+(m?0:1):h.indented+(m?0:gc):h.indented+(/^(?:case|default)\b/.test(c)?gc:2*gc)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/, -blockCommentStart:Db?null:'/*',blockCommentEnd:Db?null:'*/',blockCommentContinue:Db?null:' * ',lineComment:Db?null:'//',fold:'brace',closeBrackets:'()[]{}\'\'""``',helperType:Db?'json':'javascript',jsonldMode:md,jsonMode:Db,expressionAllowed:Qc,skipExpression:function(a){var b=a.cc[a.cc.length-1];b!=Q&&b!=T||a.cc.pop()}}});a.registerHelper('wordChars','javascript',/[\w$]/);a.defineMIME('text/javascript','javascript');a.defineMIME('text/ecmascript','javascript');a.defineMIME('application/javascript', +}};var $d={colorscheme:function(a,b){!b.args||1>b.args.length?Na(a,a.getOption('theme')):a.setOption('theme',b.args[0])},map:function(a,b,c){var d=b.args;!d||2>d.length?a&&Na(a,'Invalid mapping: '+b.input):Uc.map(d[0],d[1],c)},imap:function(a,b){this.map(a,b,'insert')},nmap:function(a,b){this.map(a,b,'normal')},vmap:function(a,b){this.map(a,b,'visual')},unmap:function(a,b,c){var d=b.args;!d||1>d.length?a&&Na(a,'No such mapping: '+b.input):Uc.unmap(d[0],c)},move:function(a,b){Jc.processCommand(a,a.state.vim, +{type:'motion',motion:'moveToLineOrEdgeOfDocument',motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:b.line+1})},set:function(a,b){var c=b.args,d=b.setCfg||{};if(!c||1>c.length)a&&Na(a,'Invalid mapping: '+b.input);else{var e=c[0].split('=');c=e[0];e=e[1];var g=!1;if('?'==c.charAt(c.length-1)){if(e)throw Error('Trailing characters: '+b.argString);c=c.substring(0,c.length-1);g=!0}void 0===e&&'no'==c.substring(0,2)&&(c=c.substring(2),e=!1);(b=qc[c]&&'boolean'==qc[c].type)&&void 0== +e&&(e=!0);!b&&void 0===e||g?(d=w(c,a,d),d instanceof Error?Na(a,d.message):!0===d||!1===d?Na(a,' '+(d?'':'no')+c):Na(a,' '+c+'='+d)):(d=z(c,e,a,d),d instanceof Error&&Na(a,d.message))}},setlocal:function(a,b){b.setCfg={scope:'local'};this.set(a,b)},setglobal:function(a,b){b.setCfg={scope:'global'};this.set(a,b)},registers:function(a,b){var c=b.args;b=Ha.registerController.registers;var d='----------Registers----------

';if(c){c=c.join('');for(var e=0;e'}}else for(var h in b)c=b[h].toString(),c.length&&(d+='"'+h+' '+c+'
');Na(a,d)},sort:function(b,d){function e(a,b){if(h){var c=a;a=b;b=c}k&&(a=a.toLowerCase(),b=b.toLowerCase());c=m&&u.exec(a);var d=m&&u.exec(b);if(!c)return a');if(g){var k=0,l=function(){k=k){Na(b,'Invalid argument: '+c.argString.substring(g));break}for(g=0;g<=k-h;g++){var l=String.fromCharCode(h+g);delete d.marks[l]}}else{Na(b,'Invalid argument: '+h+'-');break}}else delete d.marks[h]}else Na(b, +'Argument required')}},Uc=new We;a.keyMap.vim={attach:h,detach:k,call:q};t('insertModeEscKeysTimeout',200,'number');a.keyMap['vim-insert']={fallthrough:['default'],attach:h,detach:k,call:q};a.keyMap['vim-replace']={Backspace:'goCharLeft',fallthrough:['vim-insert'],attach:h,detach:k,call:q};K();return de}()}); +(function(a){'object'==typeof exports&&'object'==typeof module?a(require('../../lib/codemirror')):'function'==typeof define&&define.amd?define(['../../lib/codemirror'],a):a(CodeMirror)})(function(a){a.defineMode('javascript',function(b,e){function d(a,b,c){rd=a;Ja=c;return b}function c(a,b){var c=a.next();if('"'==c||"'"==c)return b.tokenize=k(c),b.tokenize(a,b);if('.'==c&&a.match(/^\d+(?:[eE][+\-]?\d+)?/))return d('number','number');if('.'==c&&a.match('..'))return d('spread','meta');if(/[\[\]{}\(\),;:\.]/.test(c))return d(c); +if('='==c&&a.eat('>'))return d('=>','operator');if('0'==c&&a.match(/^(?:x[\da-f]+|o[0-7]+|b[01]+)n?/i))return d('number','number');if(/\d/.test(c))return a.match(/^\d*(?:n|(?:\.\d*)?(?:[eE][+\-]?\d+)?)?/),d('number','number');if('/'==c){if(a.eat('*'))return b.tokenize=h,h(a,b);if(a.eat('/'))return a.skipToEnd(),d('comment','comment');if(Sc(a,b,1)){a:for(var e=b=!1;null!=(c=a.next());){if(!b){if('/'==c&&!e)break a;'['==c?e=!0:e&&']'==c&&(e=!1)}b=!b&&'\\'==c}a.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/); +return d('regexp','string-2')}a.eat('=');return d('operator','operator',a.current())}if('`'==c)return b.tokenize=l,l(a,b);if('#'==c)return a.skipToEnd(),d('error','error');if(de.test(c))return'>'==c&&b.lexical&&'>'==b.lexical.type||(a.eat('=')?'!'!=c&&'='!=c||a.eat('='):/[<>*+\-]/.test(c)&&(a.eat(c),'>'==c&&a.eat(c))),d('operator','operator',a.current());if(Ha.test(c)){a.eatWhile(Ha);c=a.current();if('.'!=b.lastType){if(kc.propertyIsEnumerable(c))return a=kc[c],d(a.type,a.style,c);if('async'==c&& +a.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/,!1))return d('async','keyword',c)}return d('variable','variable',c)}}function k(a){return function(b,e){var g=!1,h;if(qc&&'@'==b.peek()&&b.match(Jc))return e.tokenize=c,d('jsonld-keyword','meta');for(;null!=(h=b.next())&&(h!=a||g);)g=!g&&'\\'==h;g||(e.tokenize=c);return d('string','string')}}function h(a,b){for(var e=!1,g;g=a.next();){if('/'==g&&e){b.tokenize=c;break}e='*'==g}return d('comment','comment')}function l(a,b){for(var e=!1,g;null!=(g=a.next());){if(!e&& +('`'==g||'$'==g&&a.eat('{'))){b.tokenize=c;break}e=!e&&'\\'==g}return d('quasi','string-2',a.current())}function n(a,b){b.fatArrowAt&&(b.fatArrowAt=null);var c=a.string.indexOf('=>',a.start);if(!(0>c)){if(Ub){var d=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(a.string.slice(a.start,c));d&&(c=d.index)}d=0;var e=!1;for(--c;0<=c;--c){var g=a.string.charAt(c),h='([{}])'.indexOf(g);if(0<=h&&3>h){if(!d){++c;break}if(0==--d){'('==g&&(e=!0);break}}else if(3<=h&&6>h)++d;else if(Ha.test(g))e=!0;else{if(/["'\/]/.test(g))return; +if(e&&!d){++c;break}}}e&&!d&&(b.fatArrowAt=c)}}function q(a,b,c,d,e,g){this.indented=a;this.column=b;this.type=c;this.prev=e;this.info=g;null!=d&&(this.align=d)}function m(){for(var a=arguments.length-1;0<=a;a--)Qa.cc.push(arguments[a])}function g(){m.apply(null,arguments);return!0}function p(a,b){for(;b;b=b.next)if(b.name==a)return!0;return!1}function r(a){var b=Qa.state;Qa.marked='def';if(b.context)if('var'==b.lexical.info&&b.context&&b.context.block){var c=u(a,b.context);if(null!=c){b.context= +c;return}}else if(!p(a,b.localVars)){b.localVars=new t(a,b.localVars);return}e.globalVars&&!p(a,b.globalVars)&&(b.globalVars=new t(a,b.globalVars))}function u(a,b){return b?b.block?(a=u(a,b.prev))?a==b.prev?b:new v(a,b.vars,!0):null:p(a,b.vars)?b:new v(b.prev,new t(a,b.vars),!1):null}function E(a){return'public'==a||'private'==a||'protected'==a||'abstract'==a||'readonly'==a}function v(a,b,c){this.prev=a;this.vars=b;this.block=c}function t(a,b){this.name=a;this.next=b}function z(){Qa.state.context= +new v(Qa.state.context,Qa.state.localVars,!1);Qa.state.localVars=Tc}function w(){Qa.state.context=new v(Qa.state.context,Qa.state.localVars,!0);Qa.state.localVars=null}function I(){Qa.state.localVars=Qa.state.context.vars;Qa.state.context=Qa.state.context.prev}function H(a,b){var c=function(){var c=Qa.state,d=c.indented;if('stat'==c.lexical.type)d=c.lexical.indented;else for(var e=c.lexical;e&&')'==e.type&&e.align;e=e.prev)d=e.indented;c.lexical=new q(d,Qa.stream.column(),a,null,c.lexical,b)};c.lex= +!0;return c}function K(){var a=Qa.state;a.lexical.prev&&(')'==a.lexical.type&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function C(a){function b(c){return c==a?g():';'==a||'}'==c||')'==c||']'==c?m():g(b)}return b}function D(a,b){return'var'==a?g(H('vardef',b),tc,C(';'),K):'keyword a'==a?g(H('form'),ka,D,K):'keyword b'==a?g(H('form'),D,K):'keyword d'==a?Qa.stream.match(/^\s*$/,!1)?g():g(H('stat'),ba,C(';'),K):'debugger'==a?g(C(';')):'{'==a?g(H('}'),w,ua,K,I):';'==a?g():'if'==a?('else'== +Qa.state.lexical.info&&Qa.state.cc[Qa.state.cc.length-1]==K&&Qa.state.cc.pop()(),g(H('form'),ka,D,K,La)):'function'==a?g(va):'for'==a?g(H('form'),Ka,D,K):'class'==a||Ub&&'interface'==b?(Qa.marked='keyword',g(H('form'),Bc,K)):'variable'==a?Ub&&'declare'==b?(Qa.marked='keyword',g(D)):Ub&&('module'==b||'enum'==b||'type'==b)&&Qa.stream.match(/^\s*\w/,!1)?(Qa.marked='keyword','enum'==b?g(Nd):'type'==b?g(ha,C('operator'),ha,C(';')):g(H('form'),oc,C('{'),H('}'),ua,K,K)):Ub&&'namespace'==b?(Qa.marked='keyword', +g(H('form'),M,ua,K)):Ub&&'abstract'==b?(Qa.marked='keyword',g(D)):g(H('stat'),oa):'switch'==a?g(H('form'),ka,C('{'),H('}','switch'),w,ua,K,K,I):'case'==a?g(M,C(':')):'default'==a?g(C(':')):'catch'==a?g(H('form'),z,Q,D,K,I):'export'==a?g(H('stat'),Le,K):'import'==a?g(H('stat'),ld,K):'async'==a?g(D):'@'==b?g(M,D):m(H('stat'),M,C(';'),K)}function Q(a){if('('==a)return g(Yb,C(')'))}function M(a,b){return ja(a,b,!1)}function X(a,b){return ja(a,b,!0)}function ka(a){return'('!=a?m():g(H(')'),M,C(')'),K)} +function ja(a,b,c){if(Qa.state.fatArrowAt==Qa.stream.start){var d=c?R:da;if('('==a)return g(z,H(')'),qa(Yb,')'),K,C('=>'),d,I);if('variable'==a)return m(z,oc,C('=>'),d,I)}d=c?la:N;return fc.hasOwnProperty(a)?g(d):'function'==a?g(va,d):'class'==a||Ub&&'interface'==b?(Qa.marked='keyword',g(H('form'),Hd,K)):'keyword c'==a||'async'==a?g(c?X:M):'('==a?g(H(')'),ba,C(')'),K,d):'operator'==a||'spread'==a?g(c?X:M):'['==a?g(H(']'),Td,K,d):'{'==a?wa(O,'}',null,d):'quasi'==a?m(T,d):'new'==a?g(ra(c)):'import'== +a?g(M):g()}function ba(a){return a.match(/[;\}\)\],]/)?m():m(M)}function N(a,b){return','==a?g(M):la(a,b,!1)}function la(a,b,c){var d=0==c?N:la,e=0==c?M:X;if('=>'==a)return g(z,c?R:da,I);if('operator'==a)return/\+\+|--/.test(b)||Ub&&'!'==b?g(d):Ub&&'<'==b&&Qa.stream.match(/^([^>]|<.*?>)*>\s*\(/,!1)?g(H('>'),qa(ha,'>'),K,d):'?'==b?g(M,C(':'),e):g(e);if('quasi'==a)return m(T,d);if(';'!=a){if('('==a)return wa(X,')','call',d);if('.'==a)return g(ma,d);if('['==a)return g(H(']'),ba,C(']'),K,d);if(Ub&&'as'== +b)return Qa.marked='keyword',g(ha,d);if('regexp'==a)return Qa.state.lastType=Qa.marked='operator',Qa.stream.backUp(Qa.stream.pos-Qa.stream.start-1),g(e)}}function T(a,b){return'quasi'!=a?m():'${'!=b.slice(b.length-2)?g(T):g(M,aa)}function aa(a){if('}'==a)return Qa.marked='string-2',Qa.state.tokenize=l,g(T)}function da(a){n(Qa.stream,Qa.state);return m('{'==a?D:M)}function R(a){n(Qa.stream,Qa.state);return m('{'==a?D:X)}function ra(a){return function(b){return'.'==b?g(a?fa:pa):'variable'==b&&Ub?g(Ba, +a?la:N):m(a?X:M)}}function pa(a,b){if('target'==b)return Qa.marked='keyword',g(N)}function fa(a,b){if('target'==b)return Qa.marked='keyword',g(la)}function oa(a){return':'==a?g(K,D):m(N,C(';'),K)}function ma(a){if('variable'==a)return Qa.marked='property',g()}function O(a,b){if('async'==a)return Qa.marked='property',g(O);if('variable'==a||'keyword'==Qa.style){Qa.marked='property';if('get'==b||'set'==b)return g(ya);var c;Ub&&Qa.state.fatArrowAt==Qa.stream.start&&(c=Qa.stream.match(/^\s*:\s*/,!1))&& +(Qa.state.fatArrowAt=Qa.stream.pos+c[0].length);return g(ea)}if('number'==a||'string'==a)return Qa.marked=qc?'property':Qa.style+' property',g(ea);if('jsonld-keyword'==a)return g(ea);if(Ub&&E(b))return Qa.marked='keyword',g(O);if('['==a)return g(M,ta,C(']'),ea);if('spread'==a)return g(X,ea);if('*'==b)return Qa.marked='keyword',g(O);if(':'==a)return m(ea)}function ya(a){if('variable'!=a)return m(ea);Qa.marked='property';return g(va)}function ea(a){if(':'==a)return g(X);if('('==a)return m(va)}function qa(a, +b,c){function d(e,h){return(c?-1'),ha)}function Fa(a){if('=>'==a)return g(ha)}function Wa(a,b){if('variable'== +a||'keyword'==Qa.style)return Qa.marked='property',g(Wa);if('?'==b)return g(Wa);if(':'==a)return g(ha);if('['==a)return g(M,ta,C(']'),Wa)}function Ia(a,b){return'variable'==a&&Qa.stream.match(/^\s*[?:]/,!1)||'?'==b?g(Ia):':'==a?g(ha):m(ha)}function ib(a,b){if('<'==b)return g(H('>'),qa(ha,'>'),K,ib);if('|'==b||'.'==a||'&'==b)return g(ha);if('['==a)return g(C(']'),ib);if('extends'==b||'implements'==b)return Qa.marked='keyword',g(ha)}function Ba(a,b){if('<'==b)return g(H('>'),qa(ha,'>'),K,ib)}function wb(){return m(ha, +Ta)}function Ta(a,b){if('='==b)return g(ha)}function tc(a,b){return'enum'==b?(Qa.marked='keyword',g(Nd)):m(oc,ta,lc,vb)}function oc(a,b){if(Ub&&E(b))return Qa.marked='keyword',g(oc);if('variable'==a)return r(b),g();if('spread'==a)return g(oc);if('['==a)return wa(rb,']');if('{'==a)return wa(Na,'}')}function Na(a,b){if('variable'==a&&!Qa.stream.match(/^\s*:/,!1))return r(b),g(lc);'variable'==a&&(Qa.marked='property');return'spread'==a?g(oc):'}'==a?m():'['==a?g(M,C(']'),C(':'),Na):g(C(':'),oc,lc)}function rb(){return m(oc, +lc)}function lc(a,b){if('='==b)return g(X)}function vb(a){if(','==a)return g(tc)}function La(a,b){if('keyword b'==a&&'else'==b)return g(H('form','else'),D,K)}function Ka(a,b){if('await'==b)return g(Ka);if('('==a)return g(H(')'),Oc,C(')'),K)}function Oc(a){return'var'==a?g(tc,C(';'),Ra):';'==a?g(Ra):'variable'==a?g(cc):m(M,C(';'),Ra)}function cc(a,b){return'in'==b||'of'==b?(Qa.marked='keyword',g(M)):g(N,Ra)}function Ra(a,b){return';'==a?g(Ua):'in'==b||'of'==b?(Qa.marked='keyword',g(M)):m(M,C(';'), +Ua)}function Ua(a){')'!=a&&g(M)}function va(a,b){if('*'==b)return Qa.marked='keyword',g(va);if('variable'==a)return r(b),g(va);if('('==a)return g(z,H(')'),qa(Yb,')'),K,S,D,I);if(Ub&&'<'==b)return g(H('>'),qa(wb,'>'),K,va)}function Yb(a,b){'@'==b&&g(M,Yb);return'spread'==a?g(Yb):Ub&&E(b)?(Qa.marked='keyword',g(Yb)):m(oc,ta,lc)}function Hd(a,b){return'variable'==a?Bc(a,b):gb(a,b)}function Bc(a,b){if('variable'==a)return r(b),g(gb)}function gb(a,b){if('<'==b)return g(H('>'),qa(wb,'>'),K,gb);if('extends'== +b||'implements'==b||Ub&&','==a)return'implements'==b&&(Qa.marked='keyword'),g(Ub?ha:M,gb);if('{'==a)return g(H('}'),uc,K)}function uc(a,b){if('async'==a||'variable'==a&&('static'==b||'get'==b||'set'==b||Ub&&E(b))&&Qa.stream.match(/^\s+[\w$\xa1-\uffff]/,!1))return Qa.marked='keyword',g(uc);if('variable'==a||'keyword'==Qa.style)return Qa.marked='property',g(Ub?Nb:va,uc);if('['==a)return g(M,ta,C(']'),Ub?Nb:va,uc);if('*'==b)return Qa.marked='keyword',g(uc);if(';'==a)return g(uc);if('}'==a)return g(); +if('@'==b)return g(M,uc)}function Nb(a,b){return'?'==b?g(Nb):':'==a?g(ha,lc):'='==b?g(X):m(va)}function Le(a,b){return'*'==b?(Qa.marked='keyword',g(Ce,C(';'))):'default'==b?(Qa.marked='keyword',g(M,C(';'))):'{'==a?g(qa(Yc,'}'),Ce,C(';')):m(D)}function Yc(a,b){if('as'==b)return Qa.marked='keyword',g(C('variable'));if('variable'==a)return m(X,Yc)}function ld(a){return'string'==a?g():'('==a?m(M):m(Dd,ve,Ce)}function Dd(a,b){if('{'==a)return wa(Dd,'}');'variable'==a&&r(b);'*'==b&&(Qa.marked='keyword'); +return g(ag)}function ve(a){if(','==a)return g(Dd,ve)}function ag(a,b){if('as'==b)return Qa.marked='keyword',g(Dd)}function Ce(a,b){if('from'==b)return Qa.marked='keyword',g(M)}function Td(a){return']'==a?g():m(qa(X,']'))}function Nd(){return m(H('form'),oc,C('{'),H('}'),qa(jd,'}'),K,K)}function jd(){return m(oc,lc)}function Sc(a,b,d){return b.tokenize==c&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(b.lastType)||'quasi'==b.lastType&&/\{\s*$/.test(a.string.slice(0, +a.pos-(d||0)))}var xc=b.indentUnit,Ab=e.statementIndent,qc=e.jsonld,Cc=e.json||qc,Ub=e.typescript,Ha=e.wordCharacters||/[\w$\xa1-\uffff]/,kc=function(){function a(a){return{type:a,style:'keyword'}}var b=a('keyword a'),c=a('keyword b'),d=a('keyword c'),e=a('keyword d'),g=a('operator'),h={type:'atom',style:'atom'};return{'if':a('if'),'while':b,'with':b,'else':c,'do':c,'try':c,'finally':c,'return':e,'break':e,'continue':e,'new':a('new'),'delete':d,'void':d,'throw':d,'debugger':a('debugger'),'var':a('var'), +'const':a('var'),let:a('var'),'function':a('function'),'catch':a('catch'),'for':a('for'),'switch':a('switch'),'case':a('case'),'default':a('default'),'in':g,'typeof':g,'instanceof':g,'true':h,'false':h,'null':h,undefined:h,NaN:h,Infinity:h,'this':a('this'),'class':a('class'),'super':a('atom'),yield:d,'export':a('export'),'import':a('import'),'extends':d,await:d}}(),de=/[+\-*&%=<>!?|~^@]/,Jc=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,rd,Ja,fc={atom:!0,number:!0, +variable:!0,string:!0,regexp:!0,'this':!0,'jsonld-keyword':!0},Qa={state:null,column:null,marked:null,cc:null},Tc=new t('this',new t('arguments',null));I.lex=!0;K.lex=!0;return{startState:function(a){a={tokenize:c,lastType:'sof',cc:[],lexical:new q((a||0)-xc,0,'block',!1),localVars:e.localVars,context:e.localVars&&new v(null,null,!1),indented:a||0};e.globalVars&&'object'==typeof e.globalVars&&(a.globalVars=e.globalVars);return a},token:function(a,b){a.sol()&&(b.lexical.hasOwnProperty('align')||(b.lexical.align= +!1),b.indented=a.indentation(),n(a,b));if(b.tokenize!=h&&a.eatSpace())return null;var c=b.tokenize(a,b);if('comment'==rd)return c;b.lastType='operator'!=rd||'++'!=Ja&&'--'!=Ja?rd:'incdec';a:{var d=rd,e=Ja,g=b.cc;Qa.state=b;Qa.stream=a;Qa.marked=null;Qa.cc=g;Qa.style=c;b.lexical.hasOwnProperty('align')||(b.lexical.align=!0);for(;;)if((g.length?g.pop():Cc?M:D)(d,e)){for(;g.length&&g[g.length-1].lex;)g.pop()();if(Qa.marked){c=Qa.marked;break a}if(a='variable'==d)b:{for(a=b.localVars;a;a=a.next)if(a.name== +e){a=!0;break b}for(b=b.context;b;b=b.prev)for(a=b.vars;a;a=a.next)if(a.name==e){a=!0;break b}a=void 0}if(a){c='variable-2';break a}break a}}return c},indent:function(b,d){if(b.tokenize==h)return a.Pass;if(b.tokenize!=c)return 0;var g=d&&d.charAt(0),k=b.lexical,l;if(!/^\s*else\b/.test(d))for(var m=b.cc.length-1;0<=m;--m){var n=b.cc[m];if(n==K)k=k.prev;else if(n!=La)break}for(;!('stat'!=k.type&&'form'!=k.type||'}'!=g&&(!(l=b.cc[b.cc.length-1])||l!=N&&l!=la||/^[,\.=+\-*:?[\(]/.test(d)));)k=k.prev;Ab&& +')'==k.type&&'stat'==k.prev.type&&(k=k.prev);l=k.type;m=g==l;return'vardef'==l?k.indented+('operator'==b.lastType||','==b.lastType?k.info.length+1:0):'form'==l&&'{'==g?k.indented:'form'==l?k.indented+xc:'stat'==l?(g=k.indented,b='operator'==b.lastType||','==b.lastType||de.test(d.charAt(0))||/[,.]/.test(d.charAt(0)),g+(b?Ab||xc:0)):'switch'!=k.info||m||0==e.doubleIndentSwitch?k.align?k.column+(m?0:1):k.indented+(m?0:xc):k.indented+(/^(?:case|default)\b/.test(d)?xc:2*xc)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/, +blockCommentStart:Cc?null:'/*',blockCommentEnd:Cc?null:'*/',blockCommentContinue:Cc?null:' * ',lineComment:Cc?null:'//',fold:'brace',closeBrackets:'()[]{}\'\'""``',helperType:Cc?'json':'javascript',jsonldMode:qc,jsonMode:Cc,expressionAllowed:Sc,skipExpression:function(a){var b=a.cc[a.cc.length-1];b!=M&&b!=X||a.cc.pop()}}});a.registerHelper('wordChars','javascript',/[\w$]/);a.defineMIME('text/javascript','javascript');a.defineMIME('text/ecmascript','javascript');a.defineMIME('application/javascript', 'javascript');a.defineMIME('application/x-javascript','javascript');a.defineMIME('application/ecmascript','javascript');a.defineMIME('application/json',{name:'javascript',json:!0});a.defineMIME('application/x-json',{name:'javascript',json:!0});a.defineMIME('application/ld+json',{name:'javascript',jsonld:!0});a.defineMIME('text/typescript',{name:'javascript',typescript:!0});a.defineMIME('application/typescript',{name:'javascript',typescript:!0})}); -(function(a){'object'==typeof exports&&'object'==typeof module?a(require('../../lib/codemirror')):'function'==typeof define&&define.amd?define(['../../lib/codemirror'],a):a(CodeMirror)})(function(a){function b(a){for(var b={},c=0;c*\/]/.test(c)?d(null,'select-op'):'.'==c&&a.match(/^-?[_a-z][_a-z0-9-]*/i)?d('qualifier','qualifier'):/[:;{}\[\]\(\)]/.test(c)?d(null,c):('u'==c||'U'==c)&&a.match(/rl(-prefix)?\(/i)||('d'==c||'D'==c)&&a.match('omain(',!0,!0)||('r'==c||'R'==c)&&a.match('egexp(',!0,!0)?(a.backUp(1),b.tokenize=h,d('property','word')):/[\w\\\-]/.test(c)?(a.eatWhile(/[\w\\\-]/), d('property','word')):d(null,null)}function g(a){return function(b,c){for(var e=!1,g;null!=(g=b.next());){if(g==a&&!e){')'==a&&b.backUp(1);break}e=!e&&'\\'==g}if(g==a||!e&&')'!=a)c.tokenize=null;return d('string','string')}}function h(a,b){a.next();a.match(/\s*["')]/,!1)?b.tokenize=null:b.tokenize=g(')');return d(null,'(')}function k(a,b,c){this.type=a;this.indent=b;this.prev=c}function l(a,b,c,d){a.context=new k(c,b.indentation()+(!1===d?0:r),a.context);return c}function m(a){a.context.prev&&(a.context= -a.context.prev);return a.context.type}function p(a,b,c,d){for(d=d||1;0