MediaWiki:Wikia.js

!function(a){function b(a,b,e){return 4===arguments.length?c.apply(this,arguments):void d(a,{declarative:!0,deps:b,declare:e})}function c(a,b,c,e){d(a,{declarative:!1,deps:b,executingRequire:c,execute:e})}function d(a,b){b.name=a,a in n||(n[a]=b),b.normalizedDeps=b.deps}function e(a,b){if(b[a.groupIndex]=b[a.groupIndex]||[],-1==o.call(b[a.groupIndex],a)){b[a.groupIndex].push(a);for(var c=0,d=a.normalizedDeps.length;d>c;c++){var f=a.normalizedDeps[c],g=n[f];if(g&&!g.evaluated){var h=a.groupIndex+(g.declarative!=a.declarative);if(void 0===g.groupIndex||g.groupIndex=0;f--){for(var g=c[f],i=0;if;f++){var h=c.importers[f];if(!h.locked)for(var i=0;if;f++){var j,k=b.normalizedDeps[f],l=n[k],o=s[k];o?j=o.exports:l&&!l.declarative?j=l.esModule:l?(h(l),o=l.module,j=o.exports):j=m(k),o&&o.importers?(o.importers.push(c),c.dependencies.push(o)):c.dependencies.push(null),c.setters[f]&&c.setters[f](j)}}}function i(a){var b,c=n[a];if(c)c.declarative?l(a,[]):c.evaluated||j(c),b=c.module.exports;else if(b=m(a),!b)throw new Error("Unable to load dependency "+a+".");return(!c||c.declarative)&&b&&b.__useDefault?b["default"]:b}function j(b){if(!b.module){var c={},d=b.module={exports:c,id:b.name};if(!b.executingRequire)for(var e=0,f=b.normalizedDeps.length;f>e;e++){var g=b.normalizedDeps[e],h=n[g];h&&j(h)}b.evaluated=!0;var l=b.execute.call(a,function(a){for(var c=0,d=b.deps.length;d>c;c++)if(b.deps[c]==a)return i(b.normalizedDeps[c]);throw new TypeError("Module "+a+" not declared as a dependency.")},c,d);l&&(d.exports=l),c=d.exports,c&&c.__esModule?b.esModule=c:b.esModule=k(c)}}function k(b){if(b===a)return b;var c={};if("object"==typeof b||"function"==typeof b)if(p){var d;for(var e in b)(d=Object.getOwnPropertyDescriptor(b,e))&&r(c,e,d)}else{var f=b&&b.hasOwnProperty;for(var e in b)(!f||b.hasOwnProperty(e))&&(c[e]=b[e])}return c["default"]=b,r(c,"__useDefault",{value:!0}),c}function l(b,c){var d=n[b];if(d&&!d.evaluated&&d.declarative){c.push(b);for(var e=0,f=d.normalizedDeps.length;f>e;e++){var g=d.normalizedDeps[e];-1==o.call(c,g)&&(n[g]?l(g,c):m(g))}d.evaluated||(d.evaluated=!0,d.module.execute.call(a))}}function m(a){if(u[a])return u[a];if("@node/"==a.substr(0,6))return t(a.substr(6));var b=n[a];if(!b)throw"Module "+a+" not present.";return f(a),l(a,[]),n[a]=void 0,b.declarative&&r(b.module.exports,"__esModule",{value:!0}),u[a]=b.declarative?b.module.exports:b.esModule}var n={},o=Array.prototype.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},p=!0;try{Object.getOwnPropertyDescriptor({a:0},"a")}catch(q){p=!1}var r;!function{try{Object.defineProperty({},"a",{})&&(r=Object.defineProperty)}catch(a){r=function(a,b,c){try{a[b]=c.value||c.get.call(a)}catch(d){}}}};var s={},t="undefined"!=typeof System&&System._nodeRequire||"undefined"!=typeof require&&require.resolve&&"undefined"!=typeof process&&require,u={"@empty":{}};return function(a,d,e){return function(f){f(function(f){for(var g={_nodeRequire:t,register:b,registerDynamic:c,get:m,set:function(a,b){u[a]=b},newModule:function(a){return a}},h=0;h1)for(var h=1;hb;b++)if(this[b]===a)return b;return-1},h=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm,i="(?:^|[^$_a-zA-Z\\xA0-\\uFFFF.])",j="\\s*\\(\\s*(\"([^\"]+)\"|'([^']+)')\\s*\\)",k=/\(([^\)]*)\)/,l=/^\s+|\s+$/g,m={};e.amd={};var n={isBundle:!1,anonDefine:null};f.amdDefine=e,f.amdRequire=d}("undefined"!=typeof self?self:global),a.register("2",[],function{return{setters:[],execute:function{}}}),a.register("3",[],function{return{setters:[],execute:function{}}}),a.register("4",[],function{return{setters:[],execute:function{}}}),a.registerDynamic("5",["6"],!0,function(a,b,c){"use strict";var d,e=function(a,b){function c{this.constructor=a}for(var d in b)f.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},f={}.hasOwnProperty;return d=function(a){function b(a,c){var d;b.__super__.constructor.call(this,a)||(this.voxels=[],this.x=this.y=this.z=-1,this.warn=[],this.loadingState=0,d=new FileReader,d.onloadend=function(b){return function{var e,f,g,h;return e=b.readFile(d.result,0),null!=a.a?(f=new FileReader,f.onloadend=function{return b.readFile(f.result,1),2===b.loadingState++?(0===b.zOrientation&&b.mirrorZ,c(e)):void 0},console.log("reading alpha file with name: "+a.a.name),f.readAsArrayBuffer(a.a)):b.loadingState++,null!=a.t?(h=new FileReader,h.onloadend=function{return b.readFile(h.result,2),2===b.loadingState++?(0===b.zOrientation&&b.mirrorZ,c(e)):void 0},console.log("reading type file with name: "+a.t.name),h.readAsArrayBuffer(a.t)):b.loadingState++,null!=a.s?(g=new FileReader,g.onloadend=function{return b.readFile(g.result,3),2===b.loadingState++?(0===b.zOrientation&&b.mirrorZ,c(e)):void 0},console.log("reading specular file with name: "+a.s.name),g.readAsArrayBuffer(a.s)):b.loadingState++,3===b.loadingState?(0===b.zOrientation&&b.mirrorZ,c(e)):void 0}}(this),console.log("reading file with name: "+a.m.name),d.readAsArrayBuffer(a.m))}return e(b,a),b.prototype.readFile=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$;if(console.log("file.byteLength: "+a.byteLength),H=new Uint32Array(a.slice(0,24)),V=H[0],e=H[1],$=H[2],f=H[3],W=H[4],z=H[5],console.log("version: "+V+" (expected 257 = 1.1.0.0 = current version)"),257!==V&&console.warn("Expected version 257 but found version: "+V+" (May result in errors)"),console.log("color format: "+e+" (0 for RGBA (recommended) or 1 for BGRA)"),console.log("z-axis orientation: "+$+" (0 for left, 1 for right handed (recommended))"),0===b)this.zOrientation=$;else if(this.zOrientation!==$)throw alert("Error: mixing different z-axis orientations formats (left / right handed) is not supported"),new Error("mixing different z-axis orientations formats (left / right handed) is not supported");if(console.log("compression: "+f+" (0 for uncompressed, 1 for compressed with run length encoding (RLE))"),console.log("visability mask: "+W+" (should be 0 for encoded in A value, no partially visability)"),0!==W&&console.warn("partially visability not supported and will be ignored / handled as full visibility"),console.log("matrix count: "+z),z>1&&console.warn("matrices will be merged into one matrix with regard to their offsets"),j=l=n=0,z>1)for(A=24,o=v=1,I=z;I>=v;o=v+=1)if(D=new Uint8Array(a.slice(A,A+1))[0],M=new Uint32Array(a.slice(A+1+D,A+13+D)),X=M[0],Y=M[1],Z=M[2],N=new Int32Array(a.slice(A+13+D,A+25+D)),i=N[0],k=N[1],m=N[2],j=Math.min(j,i),l=Math.min(l,k),n=Math.min(n,m),0===f)A+=25+D+4*X*Y*Z;else{for(p=0,h=new Uint8Array(a.slice(A+25+D)),t=w=0,O=Z;O>w;t=w+=1)for{if(p+=4,6===h[p-4]&&0===h[p-3]&&0===h[p-2]&&0===h[p-1])break;2===h[p-4]&&0===h[p-3]&&0===h[p-2]&&0===h[p-1]&&(p+=8)}A+=25+D+p}for(y=24,o=x=1,P=z;P>=x;o=x+=1)if(console.log(" Matrix: "+o+" "),D=new Uint8Array(a.slice(y,y+1))[0],C=function{var b,c,e,f;for(e=new Uint8Array(a.slice(y+1,y+1+D)),f=[],c=0,b=e.length;b>c;c++)d=e[c],f.push(String.fromCharCode(d));return f}.join(""),console.log("reading "+o+". matrix with name: "+C),Q=new Uint32Array(a.slice(y+1+D,y+13+D)),X=Q[0],Y=Q[1],Z=Q[2],console.log("dimensions: width: "+X+" height: "+Y+" depth: "+Z),R=new Int32Array(a.slice(y+13+D,y+25+D)),i=R[0],k=R[1],m=R[2],console.log("position: dx : "+i+" dy: "+k+" dz: "+m+" (ignored if only 1 matrix)"),1===z&&(0===b&&0>=i&&0>=k&&0>=m&&(0>i||0>k||0>m)&&X>-i&&Y>-k&&Z>-m&&(c=[-i,-k,-m]),i=k=m=0),z>1&&(i-=j,k-=l,m-=n),console.log("position result: dx : "+i+" dy: "+k+" dz: "+m),0===b&&(this.x=Math.max(this.x,X+i),this.y=Math.max(this.y,Y+k),this.z=Math.max(this.z,Z+m)),0===f){for(h=new Uint8Array(a.slice(y+25+D,y+25+D+4*X*Y*Z)),t=B=0,S=Z;S>B;t=B+=1)for(s=E=0,T=Y;T>E;s=E+=1)for(r=F=0,J=X;J>F;r=F+=1)p=4*(t*Y*X+s*X+r),h[p+3]>0&&this.addValues(b,r+i,s+k,t+m,h[p],h[p+1],h[p+2],e);y+=25+D+4*X*Y*Z}else{for(h=new Uint8Array(a.slice(y+25+D)),p=0,t=G=0,K=Z;K>G;t=G+=1)for(q=0;;){if(p+=4,6===h[p-4]&&0===h[p-3]&&0===h[p-2]&&0===h[p-1])break;if(2===h[p-4]&&0===h[p-3]&&0===h[p-2]&&0===h[p-1]){if(g=h[p]+(h[p+1]<<8)+(h[p+2]<<16)+(h[p+3]<<24),h[p+7]>0)for(u=U=0,L=g;L>U;u=U+=1)r=q%X,s=Math.floor(q/X),q++,this.addValues(b,r+i,s+k,t+m,h[p+4],h[p+5],h[p+6],e);else q+=g;p+=8}else r=q%X,s=Math.floor(q/X),q++,h[p-1]>0&&this.addValues(b,r+i,s+k,t+m,h[p-4],h[p-3],h[p-2],e)}y+=25+D+p}return console.log("voxels:"),console.log(this.voxels),y!==a.byteLength&&console.warn("There shouldn't be any bytes left"),c},b.prototype.addValues=function(a,b,c,d,e,f,g,h){var i;switch(1===h&&(i=[g,e],e=i[0],g=i[1]),a){case 0:return this.addColorValues(b,c,d,e,f,g);case 1:return this.addAlphaValues(b,c,d,e,f,g);case 2:return this.addTypeValues(b,c,d,e,f,g);case 3:return this.addSpecularValues(b,c,d,e,f,g)}},b.prototype.addColorValues=function(a,b,c,d,e,f){return null==this.voxels[c]&&(this.voxels[c]=[]),null==this.voxels[c][b]&&(this.voxels[c][b]=[]),d===f&&255===f&&0===e?this.voxels[c][b][a]={r:255,g:0,b:255,a:250,t:7,s:7}:this.voxels[c][b][a]={r:d,g:e,b:f,a:255,t:0,s:0}},b.prototype.addAlphaValues=function(a,b,c,d,e,f){var g,h;return null==(null!=(g=this.voxels[c])&&null!=(h=g[b])?h[a]:void 0)?(this.warn.push("(x: "+a+", y: "+b+", z: "+c+"): Ignoring alpha voxel because of non existing color voxel at the same position"),console.warn("(x: "+a+", y: "+b+", z: "+c+"): Ignoring alpha voxel because of non existing color voxel at the same position")):d===e&&e===f?16===d||48===d||80===d||112===d||144===d||176===d||208===d||240===d||255===d?this.voxels[c][b][a].a=d:(console.warn("(x: "+a+", y: "+b+", z: "+c+"): Invalid alpha value "+d+": falling back to 122"),this.warn.push("(x: "+a+", y: "+b+", z: "+c+"): Invalid alpha value "+d+": falling back to 122"),this.voxels[c][b][a].a=112):d===f&&255===f&&0===e?this.voxels[c][b][a].a=250:(console.warn("(x: "+a+", y: "+b+", z: "+c+"): Invalid alpha value ("+d+", "+e+", "+f+"): r, g and b are not equal, falling back to 112"),this.warn.push("(x: "+a+", y: "+b+", z: "+c+"): Invalid alpha value ("+d+", "+e+", "+f+"): r, g and b are not equal, falling back to 112"),this.voxels[c][b][a].a=112)},b.prototype.addTypeValues=function(a,b,c,d,e,f){var g,h;return null==(null!=(g=this.voxels[c])&&null!=(h=g[b])?h[a]:void 0)?(this.warn.push("(x: "+a+", y: "+b+", z: "+c+"): Ignoring type voxel because of non existing color voxel at the same position"),console.warn("(x: "+a+", y: "+b+", z: "+c+"): Ignoring type voxel because of non existing color voxel at the same position")):255===d&&255===e&&255===f?this.voxels[c][b][a].t=0:128===d&&128===e&&128===f?this.voxels[c][b][a].t=1:64===d&&64===e&&64===f?this.voxels[c][b][a].t=2:255===d&&0===e&&0===f?this.voxels[c][b][a].t=3:255===d&&255===e&&0===f?this.voxels[c][b][a].t=4:255===d&&0===e&&255===f?this.voxels[c][b][a].t=7:(console.warn("(x: "+a+", y: "+b+", z: "+c+"): Invalid type value ("+d+", "+e+", "+f+"), falling back to solid"),this.warn.push("(x: "+a+", y: "+b+", z: "+c+"): Invalid type value ("+d+", "+e+", "+f+"), falling back to solid"),this.voxels[c][b][a].t=0)},b.prototype.addSpecularValues=function(a,b,c,d,e,f){var g,h;return null==(null!=(g=this.voxels[c])&&null!=(h=g[b])?h[a]:void 0)?(this.warn.push("(x: "+a+", y: "+b+", z: "+c+"): Ignoring specular voxel because of non existing color voxel at the same position"),console.warn("(x: "+a+", y: "+b+", z: "+c+"): Ignoring specular voxel because of non existing color voxel at the same position")):128===d&&0===e&&0===f?this.voxels[c][b][a].s=0:0===d&&128===e&&0===f?this.voxels[c][b][a].s=1:0===d&&0===e&&128===f?this.voxels[c][b][a].s=2:128===d&&128===e&&0===f?this.voxels[c][b][a].s=3:128===d&&0===e&&128===f?this.voxels[c][b][a].s=4:255===d&&0===e&&255===f?this.voxels[c][b][a].s=7:(d===e&&e===f&&255===f||(console.warn("(x: "+a+", y: "+b+", z: "+c+"): Invalid specular value ("+d+", "+e+", "+f+"), falling back to rough"),this.warn.push("(x: "+a+", y: "+b+", z: "+c+"): Invalid specular value ("+d+", "+e+", "+f+"), falling back to rough")),this.voxels[c][b][a].s=0)},b.prototype["export"]=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I;if(f=[1,1,0,0,0,0,0,0,1,0,0,0,+a,0,0,0,0,0,0,0,1,0,0,0,5,77,111,100,101,108],this.x<256?f.push(this.x,0,0,0):Array.prototype.push.apply(f,new Uint8Array(new Uint32Array([this.x]).buffer)),this.y<256?f.push(this.y,0,0,0):Array.prototype.push.apply(f,new Uint8Array(new Uint32Array([this.y]).buffer)),this.z<256?f.push(this.z,0,0,0):Array.prototype.push.apply(f,new Uint8Array(new Uint32Array([this.z]).buffer)),f.push(0,0,0,0,0,0,0,0,0,0,0,0),g=f.slice(0),i=f.slice(0),h=f.slice(0),k=function(a){if(null==a)return f.push(0,0,0,0),g.push(0,0,0,0),i.push(0,0,0,0),h.push(0,0,0,0);switch(f.push(a.r,a.g,a.b,255),a.a){case 250:g.push(255,0,255,255);break;case 255:g.push(255,255,255,255);break;case 240:g.push(240,240,240,255);break;case 208:g.push(208,208,208,255);break;case 176:g.push(176,176,176,255);break;case 144:g.push(144,144,144,255);break;case 112:g.push(112,112,112,255);break;case 80:g.push(80,80,80,255);break;case 48:g.push(48,48,48,255);break;case 16:g.push(16,16,16,255);break;default:g.push(112,112,112,255)}switch(a.t){case 0:i.push(255,255,255,255);break;case 1:i.push(128,128,128,255);break;case 2:i.push(64,64,64,255);break;case 3:i.push(255,0,0,255);break;case 4:i.push(255,255,0,255);break;case 7:i.push(255,0,255,255);break;default:i.push(255,255,255,255)}switch(a.s){case 0:return h.push(128,0,0,255);case 1:return h.push(0,128,0,255);case 2:return h.push(0,0,128,255);case 3:return h.push(128,128,0,255);case 4:return h.push(128,0,128,255);case 7:return h.push(255,0,255,255);default:return h.push(128,0,0,255)}},j=function(a,b){var c,d,e,f;if(null==a&&null==b)return!0;if(null==a||null==b)return!1;for(f=["r","g","b","a","t","s"],d=0,e=f.length;e>d;d++)if(c=f[d],a[c]!==b[c])return!1;return!0},a)for(I=m=0,u=this.z;u>m;I=m+=1){if(null!=this.voxels[I]){for(F=[],o=-1,H=n=0,v=this.y;v>n;H=n+=1)for(G=p=0,x=this.x;x>p;G=p+=1)F.push(null!=(y=this.voxels[I][H])?y[G]:void 0),null!=(null!=(z=this.voxels[I][H])?z[G]:void 0)&&(o=F.length-1);for(l=0;o>=l;){for(t=1;o>=l+t&&j(F[l+t-1],F[l+t]);)t++;t>1&&(A=new Uint8Array(new Uint32Array([t]).buffer),b=A[0],c=A[1],d=A[2],e=A[3],f.push(2,0,0,0,b,c,d,e),g.push(2,0,0,0,b,c,d,e),i.push(2,0,0,0,b,c,d,e),h.push(2,0,0,0,b,c,d,e)),k(F[l]),l+=t}}f.push(6,0,0,0),g.push(6,0,0,0),i.push(6,0,0,0),h.push(6,0,0,0)}else for(I=q=0,B=this.z;B>q;I=q+=1)for(H=r=0,C=this.y;C>r;H=r+=1)for(G=s=0,D=this.x;D>s;G=s+=1)k(null!=(E=this.voxels[I])&&null!=(w=E[H])?w[G]:void 0);return console.log("export Qubicle:"),console.log(f),[f,g,i,h].map(function(a){return new Uint8Array(a)})},b}(a("6")),c.exports=d,c.exports}),a.registerDynamic("7",["6"],!0,function(a,b,c){"use strict";var d,e=function(a,b){function c{this.constructor=a}for(var d in b)f.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},f={}.hasOwnProperty;return d=function(a){function b(a,c){var d;b.__super__.constructor.call(this,a)||(d=new FileReader,d.onloadend=function(a){return function{var b,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H;if(b=d.result,p=function{var a,c,d,f;for(d=new Uint8Array(b.slice(0,4)),f=[],a=0,c=d.length;c>a;a++)e=d[a],f.push(String.fromCharCode(e));return f}.join(""),console.log("meta: "+p+" (expected VOX )"),"VOX "!==p)throw new Error("Expected Magica Voxel header not found");if(C=new Uint32Array(b.slice(4,8))[0],console.log("version: "+C+" (expected 150)"),150!==C&&console.warn("Expected version 150 but found version: "+C+" (May result in errors)"),n=function{var a,c,d,f;for(d=new Uint8Array(b.slice(8,12)),f=[],a=0,c=d.length;c>a;a++)e=d[a],f.push(String.fromCharCode(e));return f}.join(""),console.log("mainChunkId: "+n+" (expected MAIN)"),"MAIN"!==n)throw new Error("Didn't found main Chunk as expected");for(v=new Uint32Array(b.slice(12,20)),o=v[0],m=v[1],console.log("mainChunkSize: "+o+" (expected 0)"),console.log("mainChunkChildSize: "+m),20+m!==b.byteLength&&console.warn(console.log("There shouldn't be any bytes left")),h=20+o,A=B=E=G=r=s=-1;20+o+m>h;){switch(g=function{var a,c,d,f;for(d=new Uint8Array(b.slice(h,h+4)),f=[],a=0,c=d.length;c>a;a++)e=d[a],f.push(String.fromCharCode(e));return f}.join(""),w=new Uint32Array(b.slice(h+4,h+12)),i=w[0],f=w[1],console.log("found child chunk: "+g+" with begin: "+(h+12)+", size: "+i+" and childSize: "+f+" (expected 0)"),g){case"SIZE":12!==i&&console.warn("invalid length of size chunk"),A=h+12,B=A+i;break;case"XYZI":E=h+12,G=E+i;break;case"RGBA":r=h+12,1024!==i&&console.warn("invalid length of palette chunk"),s=i}h+=12+i+f}if(-1===A||-1===B||-1===E||-1===G)throw new Error("missing chunks");if(x=new Uint32Array(b.slice(A,B)),a.x=x[0],a.z=x[1],a.y=x[2],console.log("dimensions: width: "+a.x+" height: "+a.y+" depth: "+a.z),q=[],-1===r||-1===s)q=[{r:255,g:255,b:255,a:255,t:0,s:0},{r:255,g:255,b:204,a:255,t:0,s:0},{r:255,g:255,b:153,a:255,t:0,s:0},{r:255,g:255,b:102,a:255,t:0,s:0},{r:255,g:255,b:51,a:255,t:0,s:0},{r:255,g:255,b:0,a:255,t:0,s:0},{r:255,g:204,b:255,a:255,t:0,s:0},{r:255,g:204,b:204,a:255,t:0,s:0},{r:255,g:204,b:153,a:255,t:0,s:0},{r:255,g:204,b:102,a:255,t:0,s:0},{r:255,g:204,b:51,a:255,t:0,s:0},{r:255,g:204,b:0,a:255,t:0,s:0},{r:255,g:153,b:255,a:255,t:0,s:0},{r:255,g:153,b:204,a:255,t:0,s:0},{r:255,g:153,b:153,a:255,t:0,s:0},{r:255,g:153,b:102,a:255,t:0,s:0},{r:255,g:153,b:51,a:255,t:0,s:0},{r:255,g:153,b:0,a:255,t:0,s:0},{r:255,g:102,b:255,a:255,t:0,s:0},{r:255,g:102,b:204,a:255,t:0,s:0},{r:255,g:102,b:153,a:255,t:0,s:0},{r:255,g:102,b:102,a:255,t:0,s:0},{r:255,g:102,b:51,a:255,t:0,s:0},{r:255,g:102,b:0,a:255,t:0,s:0},{r:255,g:51,b:255,a:255,t:0,s:0},{r:255,g:51,b:204,a:255,t:0,s:0},{r:255,g:51,b:153,a:255,t:0,s:0},{r:255,g:51,b:102,a:255,t:0,s:0},{r:255,g:51,b:51,a:255,t:0,s:0},{r:255,g:51,b:0,a:255,t:0,s:0},{r:255,g:0,b:255,a:250,t:7,s:7},{r:255,g:0,b:204,a:255,t:0,s:0},{r:255,g:0,b:153,a:255,t:0,s:0},{r:255,g:0,b:102,a:255,t:0,s:0},{r:255,g:0,b:51,a:255,t:0,s:0},{r:255,g:0,b:0,a:255,t:0,s:0},{r:204,g:255,b:255,a:255,t:0,s:0},{r:204,g:255,b:204,a:255,t:0,s:0},{r:204,g:255,b:153,a:255,t:0,s:0},{r:204,g:255,b:102,a:255,t:0,s:0},{r:204,g:255,b:51,a:255,t:0,s:0},{r:204,g:255,b:0,a:255,t:0,s:0},{r:204,g:204,b:255,a:255,t:0,s:0},{r:204,g:204,b:204,a:255,t:0,s:0},{r:204,g:204,b:153,a:255,t:0,s:0},{r:204,g:204,b:102,a:255,t:0,s:0},{r:204,g:204,b:51,a:255,t:0,s:0},{r:204,g:204,b:0,a:255,t:0,s:0},{r:204,g:153,b:255,a:255,t:0,s:0},{r:204,g:153,b:204,a:255,t:0,s:0},{r:204,g:153,b:153,a:255,t:0,s:0},{r:204,g:153,b:102,a:255,t:0,s:0},{r:204,g:153,b:51,a:255,t:0,s:0},{r:204,g:153,b:0,a:255,t:0,s:0},{r:204,g:102,b:255,a:255,t:0,s:0},{r:204,g:102,b:204,a:255,t:0,s:0},{r:204,g:102,b:153,a:255,t:0,s:0},{r:204,g:102,b:102,a:255,t:0,s:0},{r:204,g:102,b:51,a:255,t:0,s:0},{r:204,g:102,b:0,a:255,t:0,s:0},{r:204,g:51,b:255,a:255,t:0,s:0},{r:204,g:51,b:204,a:255,t:0,s:0},{r:204,g:51,b:153,a:255,t:0,s:0},{r:204,g:51,b:102,a:255,t:0,s:0},{r:204,g:51,b:51,a:255,t:0,s:0},{r:204,g:51,b:0,a:255,t:0,s:0},{r:204,g:0,b:255,a:255,t:0,s:0},{r:204,g:0,b:204,a:255,t:0,s:0},{r:204,g:0,b:153,a:255,t:0,s:0},{r:204,g:0,b:102,a:255,t:0,s:0},{r:204,g:0,b:51,a:255,t:0,s:0},{r:204,g:0,b:0,a:255,t:0,s:0},{r:153,g:255,b:255,a:255,t:0,s:0},{r:153,g:255,b:204,a:255,t:0,s:0},{r:153,g:255,b:153,a:255,t:0,s:0},{r:153,g:255,b:102,a:255,t:0,s:0},{r:153,g:255,b:51,a:255,t:0,s:0},{r:153,g:255,b:0,a:255,t:0,s:0},{r:153,g:204,b:255,a:255,t:0,s:0},{r:153,g:204,b:204,a:255,t:0,s:0},{r:153,g:204,b:153,a:255,t:0,s:0},{r:153,g:204,b:102,a:255,t:0,s:0},{r:153,g:204,b:51,a:255,t:0,s:0},{r:153,g:204,b:0,a:255,t:0,s:0},{r:153,g:153,b:255,a:255,t:0,s:0},{r:153,g:153,b:204,a:255,t:0,s:0},{r:153,g:153,b:153,a:255,t:0,s:0},{r:153,g:153,b:102,a:255,t:0,s:0},{r:153,g:153,b:51,a:255,t:0,s:0},{r:153,g:153,b:0,a:255,t:0,s:0},{r:153,g:102,b:255,a:255,t:0,s:0},{r:153,g:102,b:204,a:255,t:0,s:0},{r:153,g:102,b:153,a:255,t:0,s:0},{r:153,g:102,b:102,a:255,t:0,s:0},{r:153,g:102,b:51,a:255,t:0,s:0},{r:153,g:102,b:0,a:255,t:0,s:0},{r:153,g:51,b:255,a:255,t:0,s:0},{r:153,g:51,b:204,a:255,t:0,s:0},{r:153,g:51,b:153,a:255,t:0,s:0},{r:153,g:51,b:102,a:255,t:0,s:0},{r:153,g:51,b:51,a:255,t:0,s:0},{r:153,g:51,b:0,a:255,t:0,s:0},{r:153,g:0,b:255,a:255,t:0,s:0},{r:153,g:0,b:204,a:255,t:0,s:0},{r:153,g:0,b:153,a:255,t:0,s:0},{r:153,g:0,b:102,a:255,t:0,s:0},{r:153,g:0,b:51,a:255,t:0,s:0},{r:153,g:0,b:0,a:255,t:0,s:0},{r:102,g:255,b:255,a:255,t:0,s:0},{r:102,g:255,b:204,a:255,t:0,s:0},{r:102,g:255,b:153,a:255,t:0,s:0},{r:102,g:255,b:102,a:255,t:0,s:0},{r:102,g:255,b:51,a:255,t:0,s:0},{r:102,g:255,b:0,a:255,t:0,s:0},{r:102,g:204,b:255,a:255,t:0,s:0},{r:102,g:204,b:204,a:255,t:0,s:0},{r:102,g:204,b:153,a:255,t:0,s:0},{r:102,g:204,b:102,a:255,t:0,s:0},{r:102,g:204,b:51,a:255,t:0,s:0},{r:102,g:204,b:0,a:255,t:0,s:0},{r:102,g:153,b:255,a:255,t:0,s:0},{r:102,g:153,b:204,a:255,t:0,s:0},{r:102,g:153,b:153,a:255,t:0,s:0},{r:102,g:153,b:102,a:255,t:0,s:0},{r:102,g:153,b:51,a:255,t:0,s:0},{r:102,g:153,b:0,a:255,t:0,s:0},{r:102,g:102,b:255,a:255,t:0,s:0},{r:102,g:102,b:204,a:255,t:0,s:0},{r:102,g:102,b:153,a:255,t:0,s:0},{r:102,g:102,b:102,a:255,t:0,s:0},{r:102,g:102,b:51,a:255,t:0,s:0},{r:102,g:102,b:0,a:255,t:0,s:0},{r:102,g:51,b:255,a:255,t:0,s:0},{r:102,g:51,b:204,a:255,t:0,s:0},{r:102,g:51,b:153,a:255,t:0,s:0},{r:102,g:51,b:102,a:255,t:0,s:0},{r:102,g:51,b:51,a:255,t:0,s:0},{r:102,g:51,b:0,a:255,t:0,s:0},{r:102,g:0,b:255,a:255,t:0,s:0},{r:102,g:0,b:204,a:255,t:0,s:0},{r:102,g:0,b:153,a:255,t:0,s:0},{r:102,g:0,b:102,a:255,t:0,s:0},{r:102,g:0,b:51,a:255,t:0,s:0},{r:102,g:0,b:0,a:255,t:0,s:0},{r:51,g:255,b:255,a:255,t:0,s:0},{r:51,g:255,b:204,a:255,t:0,s:0},{r:51,g:255,b:153,a:255,t:0,s:0},{r:51,g:255,b:102,a:255,t:0,s:0},{r:51,g:255,b:51,a:255,t:0,s:0},{r:51,g:255,b:0,a:255,t:0,s:0},{r:51,g:204,b:255,a:255,t:0,s:0},{r:51,g:204,b:204,a:255,t:0,s:0},{r:51,g:204,b:153,a:255,t:0,s:0},{r:51,g:204,b:102,a:255,t:0,s:0},{r:51,g:204,b:51,a:255,t:0,s:0},{r:51,g:204,b:0,a:255,t:0,s:0},{r:51,g:153,b:255,a:255,t:0,s:0},{r:51,g:153,b:204,a:255,t:0,s:0},{r:51,g:153,b:153,a:255,t:0,s:0},{r:51,g:153,b:102,a:255,t:0,s:0},{r:51,g:153,b:51,a:255,t:0,s:0},{r:51,g:153,b:0,a:255,t:0,s:0},{r:51,g:102,b:255,a:255,t:0,s:0},{r:51,g:102,b:204,a:255,t:0,s:0},{r:51,g:102,b:153,a:255,t:0,s:0},{r:51,g:102,b:102,a:255,t:0,s:0},{r:51,g:102,b:51,a:255,t:0,s:0},{r:51,g:102,b:0,a:255,t:0,s:0},{r:51,g:51,b:255,a:255,t:0,s:0},{r:51,g:51,b:204,a:255,t:0,s:0},{r:51,g:51,b:153,a:255,t:0,s:0},{r:51,g:51,b:102,a:255,t:0,s:0},{r:51,g:51,b:51,a:255,t:0,s:0},{r:51,g:51,b:0,a:255,t:0,s:0},{r:51,g:0,b:255,a:255,t:0,s:0},{r:51,g:0,b:204,a:255,t:0,s:0},{r:51,g:0,b:153,a:255,t:0,s:0},{r:51,g:0,b:102,a:255,t:0,s:0},{r:51,g:0,b:51,a:255,t:0,s:0},{r:51,g:0,b:0,a:255,t:0,s:0},{r:0,g:255,b:255,a:255,t:0,s:0},{r:0,g:255,b:204,a:255,t:0,s:0},{r:0,g:255,b:153,a:255,t:0,s:0},{r:0,g:255,b:102,a:255,t:0,s:0},{r:0,g:255,b:51,a:255,t:0,s:0},{r:0,g:255,b:0,a:255,t:0,s:0},{r:0,g:204,b:255,a:255,t:0,s:0},{r:0,g:204,b:204,a:255,t:0,s:0},{r:0,g:204,b:153,a:255,t:0,s:0},{r:0,g:204,b:102,a:255,t:0,s:0},{r:0,g:204,b:51,a:255,t:0,s:0},{r:0,g:204,b:0,a:255,t:0,s:0},{r:0,g:153,b:255,a:255,t:0,s:0},{r:0,g:153,b:204,a:255,t:0,s:0},{r:0,g:153,b:153,a:255,t:0,s:0},{r:0,g:153,b:102,a:255,t:0,s:0},{r:0,g:153,b:51,a:255,t:0,s:0},{r:0,g:153,b:0,a:255,t:0,s:0},{r:0,g:102,b:255,a:255,t:0,s:0},{r:0,g:102,b:204,a:255,t:0,s:0},{r:0,g:102,b:153,a:255,t:0,s:0},{r:0,g:102,b:102,a:255,t:0,s:0},{r:0,g:102,b:51,a:255,t:0,s:0},{r:0,g:102,b:0,a:255,t:0,s:0},{r:0,g:51,b:255,a:255,t:0,s:0},{r:0,g:51,b:204,a:255,t:0,s:0},{r:0,g:51,b:153,a:255,t:0,s:0},{r:0,g:51,b:102,a:255,t:0,s:0},{r:0,g:51,b:51,a:255,t:0,s:0},{r:0,g:51,b:0,a:255,t:0,s:0},{r:0,g:0,b:255,a:255,t:0,s:0},{r:0,g:0,b:204,a:255,t:0,s:0},{r:0,g:0,b:153,a:255,t:0,s:0},{r:0,g:0,b:102,a:255,t:0,s:0},{r:0,g:0,b:51,a:255,t:0,s:0},{r:238,g:0,b:0,a:255,t:0,s:0},{r:221,g:0,b:0,a:255,t:0,s:0},{r:187,g:0,b:0,a:255,t:0,s:0},{r:170,g:0,b:0,a:255,t:0,s:0},{r:136,g:0,b:0,a:255,t:0,s:0},{r:119,g:0,b:0,a:255,t:0,s:0},{r:85,g:0,b:0,a:255,t:0,s:0},{r:68,g:0,b:0,a:255,t:0,s:0},{r:34,g:0,b:0,a:255,t:0,s:0},{r:17,g:0,b:0,a:255,t:0,s:0},{r:0,g:238,b:0,a:255,t:0,s:0},{r:0,g:221,b:0,a:255,t:0,s:0},{r:0,g:187,b:0,a:255,t:0,s:0},{r:0,g:170,b:0,a:255,t:0,s:0},{r:0,g:136,b:0,a:255,t:0,s:0},{r:0,g:119,b:0,a:255,t:0,s:0},{r:0,g:85,b:0,a:255,t:0,s:0},{r:0,g:68,b:0,a:255,t:0,s:0},{r:0,g:34,b:0,a:255,t:0,s:0},{r:0,g:17,b:0,a:255,t:0,s:0},{r:0,g:0,b:238,a:255,t:0,s:0},{r:0,g:0,b:221,a:255,t:0,s:0},{r:0,g:0,b:187,a:255,t:0,s:0},{r:0,g:0,b:170,a:255,t:0,s:0},{r:0,g:0,b:136,a:255,t:0,s:0},{r:0,g:0,b:119,a:255,t:0,s:0},{r:0,g:0,b:85,a:255,t:0,s:0},{r:0,g:0,b:68,a:255,t:0,s:0},{r:0,g:0,b:34,a:255,t:0,s:0},{r:0,g:0,b:17,a:255,t:0,s:0},{r:238,g:238,b:238,a:255,t:0,s:0},{r:221,g:221,b:221,a:255,t:0,s:0},{r:187,g:187,b:187,a:255,t:0,s:0},{r:170,g:170,b:170,a:255,t:0,s:0},{r:136,g:136,b:136,a:255,t:0,s:0},{r:119,g:119,b:119,a:255,t:0,s:0},{r:85,g:85,b:85,a:255,t:0,s:0},{r:68,g:68,b:68,a:255,t:0,s:0},{r:34,g:34,b:34,a:255,t:0,s:0},{r:17,g:17,b:17,a:255,t:0,s:0}],console.log("default palette");else{for(t=new Uint8Array(b.slice(r,r+s)),j=k=0,y=s;y>k;j=k+=4)255===t[j]&&0===t[j+1]&&255===t[j+2]?q.push({r:255,g:0,b:255,a:250,t:7,s:7}):q.push({r:t[j],g:t[j+1],b:t[j+2],a:255,t:0,s:0});console.log("palette:"),console.log(q)}for(a.voxels=[],F=new Uint32Array(b.slice(E,E+4))[0],console.log("voxel count: "+F),E+4+4*F!==G&&console.warn("invalid length of voxel chunk"),u=new Uint8Array(b.slice(E+4,E+4+4*F)),j=l=0,z=4*F;z>l;j=l+=4)H=a.z-u[j+1]-1,null==a.voxels[H]&&(a.voxels[H]=[]),null==a.voxels[H][u[j+2]]&&(a.voxels[H][u[j+2]]=[]),D=q[u[j+3]-1],a.voxels[H][u[j+2]][a.x-u[j]-1]={r:D.r,g:D.g,b:D.b,a:D.a,s:D.s,t:D.t};return console.log("voxels:"),console.log(a.voxels),c}}(this),console.log("reading file with name: "+a.name),d.readAsArrayBuffer(a))}return e(b,a),b.prototype["export"]=function{var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S;for(e=[86,79,88,32,150,0,0,0,77,65,73,78,0,0,0,0],m=new Uint8Array(new Uint32Array([this.x]).buffer),F=m[0],G=m[1],H=m[2],I=m[3],n=new Uint8Array(new Uint32Array([this.z]).buffer),K=n[0],L=n[1],M=n[2],N=n[3],p=new Uint8Array(new Uint32Array([this.y]).buffer),P=p[0],Q=p[1],R=p[2],S=p[3],C=[83,73,90,69,12,0,0,0,0,0,0,0,F,G,H,I,K,L,M,N,P,Q,R,S],D=[],l=[82,71,66,65,0,4,0,0,0,0,0,0],f={},O=i=0,q=this.z;q>i;O=i+=1)for(h=this.z-O-1,J=j=0,r=this.y;r>j;J=j+=1)for(E=k=0,s=this.x;s>k;E=k+=1)if(null!=(null!=(t=this.voxels[O])&&null!=(u=t[J])?u[E]:void 0)){if(x=(this.voxels[O][J][E].r<<24|this.voxels[O][J][E].g<<16|this.voxels[O][J][E].b<<8|255)>>>0,g=f[x],null==g){if(!(l.length<1036))throw new Error("To many colors for Magica Voxel palette");l.push(this.voxels[O][J][E].r,this.voxels[O][J][E].g,this.voxels[O][J][E].b,255),g=l.length/4-3,f[x]=g}D.push(this.x-E-1,h,J,g)}for(l.length<1036;)l.push(255,255,255,255);return v=new Uint8Array(new Uint32Array([1076+D.length]).buffer),y=v[0],z=v[1],A=v[2],B=v[3],e.push(y,z,A,B),e=e.concat(C),w=new Uint8Array(new Uint32Array([D.length+4]).buffer),y=w[0],z=w[1],A=w[2],B=w[3],o=new Uint8Array(new Uint32Array([D.length/4]).buffer),a=o[0],b=o[1],c=o[2],d=o[3],e.push(88,89,90,73,y,z,A,B,0,0,0,0,a,b,c,d),e=e.concat(D),e=e.concat(l),console.log("export Magica:"),console.log(e),new Uint8Array(e)},b}(a("6")),c.exports=d,c.exports}),a.registerDynamic("8",["6"],!0,function(a,b,c){"use strict";var d,e=function(a,b){function c{this.constructor=a}for(var d in b)f.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},f={}.hasOwnProperty;return d=function(a){function b(a,c){var d;b.__super__.constructor.call(this,a)||(this.voxels=[],d=new FileReader,d.onloadend=function(a){return function{var b,e,f,g,h,i,j,k,l,m,n,o,p,q; for(e=JSON.parse(d.result),b=e.creator,a.x=e.width,a.y=e.height,a.z=e.depth,n=e.version,g=e.frames,console.log("creator: "+o),console.log("version: "+n+" (expected 1)"),console.log("frames: "+g+" (expected 1)"),console.log("dimensions: width : "+a.x+" height: "+a.y+" depth: "+a.z),console.log("frame data:"),f=h=1,k=g;k>=h;f=h+=1)for(console.log(e["frame"+f]),l=e["frame"+f],i=0,j=l.length;j>i;i++)m=l[i],o=m[0],p=m[1],q=m[2],b=m[3],q=a.z-q-1,o=a.x-o-1,null==a.voxels[q]&&(a.voxels[q]=[]),null==a.voxels[q][p]&&(a.voxels[q][p]=[]),a.voxels[q][p][o]={r:(4278190080&b)>>>24,g:(16711680&b)>>>16,b:(65280&b)>>>8,a:255,t:0,s:0},255===a.voxels[q][p][o].r&&0===a.voxels[q][p][o].g&&255===a.voxels[q][p][o].b&&(a.voxels[q][p][o]={r:255,g:0,b:255,a:250,t:7,s:7});return console.log("voxels:"),console.log(a.voxels),c}}(this),console.log("reading file with name: "+a.name),d.readAsText(a))}return e(b,a),b.prototype["export"]=function{var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o;for(a=[],l=this.voxels,e=b=0,i=l.length;i>b;e=++b)if(o=l[e],null!=o)for(d=f=0,j=o.length;j>f;d=++f)if(n=o[d],null!=n)for(c=h=0,k=n.length;k>h;c=++h)m=n[c],null!=m&&a.push([this.x-c-1,d,this.z-e-1,(m.r<<24|m.g<<16|m.b<<8|255)>>>0]);return g={creator:"Troxel",width:this.x,height:this.y,depth:this.z,version:1,frames:1,frame1:a},console.log("Zoxel export:"),console.log(g),JSON.stringify(g)},b}(a("6")),c.exports=d,c.exports}),a.registerDynamic("9",[],!0,function(a,b,c){var d=function{function a(a,b,c){var d=document.createElement(a);return d.id=b,d.style.cssText=c,d}function b(b,c,d){var e=a("div",b,"padding:0 0 3px 3px;text-align:left;background:"+d),f=a("div",b+"Text","font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px;color:"+c);f.innerHTML=b.toUpperCase,e.appendChild(f);var g=a("div",b+"Graph","width:74px;height:30px;background:"+c);e.appendChild(g);for(var h=0;74>h;h++)g.appendChild(a("span","","width:1px;height:30px;float:left;opacity:0.9;background:"+d));return e}function c(a){for(var b=j.children,c=0;c<b.length;c++)b[c].style.display=c===a?"block":"none";i=a}function d(a,b){var c=a.appendChild(a.firstChild);c.style.height=Math.min(30,30-30*b)+"px"}var e=self.performance&&self.performance.now?self.performance.now.bind(performance):Date.now,f=e,g=f,h=0,i=0,j=a("div","stats","width:80px;opacity:0.9;cursor:pointer");j.addEventListener("mousedown",function(a){a.preventDefault,c(++i%j.children.length)},!1);var k=0,l=1/0,m=0,n=b("fps","#0ff","#002"),o=n.children[0],p=n.children[1];j.appendChild(n);var q=0,r=1/0,s=0,t=b("ms","#0f0","#020"),u=t.children[0],v=t.children[1];if(j.appendChild(t),self.performance&&self.performance.memory){var w=0,x=1/0,y=0,z=b("mb","#f08","#201"),A=z.children[0],B=z.children[1];j.appendChild(z)}return c(i),{REVISION:14,domElement:j,setMode:c,begin:function{f=e},end:function{var a=e;if(q=a-f,r=Math.min(r,q),s=Math.max(s,q),u.textContent=(0|q)+" MS ("+(0|r)+"-"+(0|s)+")",d(v,q/200),h++,a>g+1e3&&(k=Math.round(1e3*h/(a-g)),l=Math.min(l,k),m=Math.max(m,k),o.textContent=k+" FPS ("+l+"-"+m+")",d(p,k/100),g=a,h=0,void 0!==w)){var b=performance.memory.usedJSHeapSize,c=performance.memory.jsHeapSizeLimit;w=Math.round(9.54e-7*b),x=Math.min(x,w),y=Math.max(y,w),A.textContent=w+" MB ("+x+"-"+y+")",d(B,b/c)}return a},update:function{f=this.end}}};return"object"==typeof c&&(c.exports=d),c.exports}),a.registerDynamic("6",[],!0,function(a,b,c){"use strict";var d;return d=function{function a(b){return b instanceof a||"object"==typeof b&&null!=b.x&&null!=b.y&&null!=b.z&&null!=b.voxels?(this.voxels=b.voxels,this.x=b.x,this.y=b.y,this.z=b.z,b.readonly&&(this.readonly=!0),!0):void 0}return a.prototype.verify=function{var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;if(null==this.x||null==this.y||null==this.z||null==this.voxels)return!1;if(!(this.x>0&&this.y>0&&this.z>0&&Array.isArray(this.voxels)))return!1;if(this.voxels.length>this.z)return!1;for(g=this.voxels,a=0,d=g.length;d>a;a++){if(p=g[a],!Array.isArray(p)||p.length>this.y)return!1;for(b=0,e=p.length;e>b;b++){if(o=p[b],!Array.isArray(o)||o.length>this.x)return!1;for(c=0,f=o.length;f>c;c++){if(n=o[c],"object"!=typeof n)return!1;if(!("number"==typeof n.r&&0<=(h=n.r)&&255>=h))return!1;if(!("number"==typeof n.g&&0<=(i=n.g)&&255>=i))return!1;if(!("number"==typeof n.b&&0<=(j=n.b)&&255>=j))return!1;if(255===n.r&&0===n.g&&(n.b=255)){if("number"!=typeof n.a||250!==n.a)return!1;if("number"!=typeof n.t||7!==n.t)return!1;if("number"!=typeof n.s||7!==n.s)return!1}else{if("number"!=typeof n.a||16!==(k=n.a)&&48!==k&&80!==k&&112!==k&&144!==k&&176!==k&&208!==k&&240!==k&&255!==k)return!1;if(!("number"==typeof n.t&&0<=(l=n.t)&&4>=l))return!1;if(!("number"==typeof n.s&&0<=(m=n.s)&&4>=m))return!1}}}}return!0},a.prototype.rotateX=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n;for(k=this.voxels.slice(0),this.voxels=[],n=b=0,e=this.z;e>b;n=b+=1)for(m=c=0,f=this.y;f>c;m=c+=1)for(l=d=0,g=this.x;g>d;l=d+=1)null!=(null!=(h=k[a?this.z-n-1:n])&&null!=(i=h[a?m:this.y-m-1])?i[l]:void 0)&&(null==this.voxels[m]&&(this.voxels[m]=[]),null==this.voxels[m][n]&&(this.voxels[m][n]=[]),this.voxels[m][n][l]=k[a?this.z-n-1:n][a?m:this.y-m-1][l]);return j=[this.y,this.z],this.z=j[0],this.y=j[1],j},a.prototype.rotateY=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n;for(k=this.voxels.slice(0),this.voxels=[],n=b=0,e=this.z;e>b;n=b+=1)for(m=c=0,f=this.y;f>c;m=c+=1)for(l=d=0,g=this.x;g>d;l=d+=1)null!=(null!=(h=k[a?this.z-n-1:n])&&null!=(i=h[m])?i[a?l:this.x-l-1]:void 0)&&(null==this.voxels[l]&&(this.voxels[l]=[]),null==this.voxels[l][m]&&(this.voxels[l][m]=[]),this.voxels[l][m][n]=k[a?this.z-n-1:n][m][a?l:this.x-l-1]);return j=[this.x,this.z],this.z=j[0],this.x=j[1],j},a.prototype.rotateZ=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n;for(k=this.voxels.slice(0),this.voxels=[],n=b=0,e=this.z;e>b;n=b+=1)for(m=c=0,f=this.y;f>c;m=c+=1)for(l=d=0,g=this.x;g>d;l=d+=1)null!=(null!=(h=k[n])&&null!=(i=h[a?m:this.y-m-1])?i[a?this.x-l-1:l]:void 0)&&(null==this.voxels[n]&&(this.voxels[n]=[]),null==this.voxels[n][l]&&(this.voxels[n][l]=[]),this.voxels[n][l][m]=k[n][a?m:this.y-m-1][a?this.x-l-1:l]);return j=[this.x,this.y],this.y=j[0],this.x=j[1],j},a.prototype.mirrorX=function{var a,b,c,d,e,f,g;for(d=this.voxels.slice(0),this.voxels=[],c=[],g=a=0,b=this.z;b>a;g=a+=1)c.push(function{var a,b,c;for(c=[],f=a=0,b=this.y;b>a;f=a+=1)c.push(function{var a,b,c,h,i;for(i=[],e=a=0,b=this.x;b>a;e=a+=1)null!=(null!=(c=d[g])&&null!=(h=c[f])?h[this.x-e-1]:void 0)&&(null==this.voxels[g]&&(this.voxels[g]=[]),null==this.voxels[g][f]&&(this.voxels[g][f]=[]),i.push(this.voxels[g][f][e]=d[g][f][this.x-e-1]));return i}.call(this));return c}.call(this));return c},a.prototype.mirrorY=function{var a,b,c,d,e,f,g;for(d=this.voxels.slice(0),this.voxels=[],c=[],g=a=0,b=this.z;b>a;g=a+=1)c.push(function{var a,b,c;for(c=[],f=a=0,b=this.y;b>a;f=a+=1)c.push(function{var a,b,c,h,i;for(i=[],e=a=0,b=this.x;b>a;e=a+=1)null!=(null!=(c=d[g])&&null!=(h=c[this.y-f-1])?h[e]:void 0)&&(null==this.voxels[g]&&(this.voxels[g]=[]),null==this.voxels[g][f]&&(this.voxels[g][f]=[]),i.push(this.voxels[g][f][e]=d[g][this.y-f-1][e]));return i}.call(this));return c}.call(this));return c},a.prototype.mirrorZ=function{var a,b,c,d,e,f,g;for(d=this.voxels.slice(0),this.voxels=[],c=[],g=a=0,b=this.z;b>a;g=a+=1)c.push(function{var a,b,c;for(c=[],f=a=0,b=this.y;b>a;f=a+=1)c.push(function{var a,b,c,h,i;for(i=[],e=a=0,b=this.x;b>a;e=a+=1)null!=(null!=(c=d[this.z-g-1])&&null!=(h=c[f])?h[e]:void 0)&&(null==this.voxels[g]&&(this.voxels[g]=[]),null==this.voxels[g][f]&&(this.voxels[g][f]=[]),i.push(this.voxels[g][f][e]=d[this.z-g-1][f][e]));return i}.call(this));return c}.call(this));return c},a.prototype.moveX=function(a){var b,c,d,e,f,g,h;for(d=[],h=b=0,c=this.z;c>b;h=b+=1)null!=this.voxels[h]&&d.push(function{var b,c,d,i,j,k,l,m;for(m=[],g=b=0,d=this.y;d>b;g=b+=1)if(null!=(null!=(i=this.voxels[h])?i[g]:void 0)){for(f=this.voxels[h][g][a?0:this.x-1],e=c=0,j=this.x-1;j>c;e=c+=1)null!=(null!=(k=this.voxels[h])&&null!=(l=k[g])?l[a?e+1:this.x-2-e]:void 0)?this.voxels[h][g][a?e:this.x-1-e]=this.voxels[h][g][a?e+1:this.x-2-e]:delete this.voxels[h][g][a?e:this.x-1-e];null!=f?m.push(this.voxels[h][g][a?this.x-1:0]=f):m.push(delete this.voxels[h][g][a?this.x-1:0])}return m}.call(this));return d},a.prototype.moveY=function(a){var b,c,d,e,f,g,h,i,j;for(g=[],j=b=0,d=this.z;d>b;j=b+=1)if(null!=this.voxels[j]){for(i=this.voxels[j][a?0:this.y-1],h=c=0,e=this.y-1;e>c;h=c+=1)null!=(null!=(f=this.voxels[j])?f[a?h+1:this.y-2-h]:void 0)?this.voxels[j][a?h:this.y-1-h]=this.voxels[j][a?h+1:this.y-2-h]:delete this.voxels[j][a?h:this.y-1-h];null!=i?g.push(this.voxels[j][a?this.y-1:0]=i):g.push(delete this.voxels[j][a?this.y-1:0])}return g},a.prototype.moveZ=function(a){var b,c,d,e;for(e=this.voxels[a?0:this.z-1],d=b=0,c=this.z-1;c>b;d=b+=1)null!=this.voxels[a?d+1:this.z-2-d]?this.voxels[a?d:this.z-1-d]=this.voxels[a?d+1:this.z-2-d]:delete this.voxels[a?d:this.z-1-d];return null!=e?this.voxels[a?this.z-1:0]=e:delete this.voxels[a?this.z-1:0]},a.prototype.resize=function(a,b,c,d,e,f){var g,h,i,j,k;for(this.x=a,this.y=b,this.z=c,f>=0?this.voxels=this.voxels.slice(f,this.z+f):(this.voxels.unshift.apply(this.voxels,Array(-f)),this.voxels=this.voxels.slice(0,this.z)),i=[],k=g=0,h=this.z;h>g;k=g+=1)null!=this.voxels[k]&&(e>=0?this.voxels[k]=this.voxels[k].slice(e,this.y+e):(this.voxels[k].unshift.apply(this.voxels[k],Array(-e)),this.voxels[k]=this.voxels[k].slice(0,this.y)),i.push(function{var a,b,c;for(c=[],j=a=0,b=this.y;b>a;j=a+=1)null!=this.voxels[k][j]&&(d>=0?c.push(this.voxels[k][j]=this.voxels[k][j].slice(d,this.x+d)):(this.voxels[k][j].unshift.apply(this.voxels[k][j],Array(-d)),c.push(this.voxels[k][j]=this.voxels[k][j].slice(0,this.x))));return c}.call(this)));return i},a.prototype.computeBoundingBox=function{var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o;for(d=e=f=0,g=this.x-1,h=this.y-1,i=this.z-1,o=a=0,j=this.z;j>a;o=a+=1)if(null!=this.voxels[o])for(i=Math.min(i,o),f=Math.max(f,o),n=b=0,k=this.y;k>b;n=b+=1)if(null!=this.voxels[o][n])for(h=Math.min(h,n),e=Math.max(e,n),m=c=0,l=this.x;l>c;m=c+=1)null!=this.voxels[o][n][m]&&(g=Math.min(g,m),d=Math.max(d,m));return 0===d?[this.x,this.y,this.z,0,0,0]:[d-g+1,e-h+1,f-i+1,g,h,i]},a.prototype.getAttachmentPoint=function{var a,b,c,d,e,f,g,h,i;for(i=a=0,d=this.z;d>a;i=a+=1)if(null!=this.voxels[i])for(h=b=0,e=this.y;e>b;h=b+=1)if(null!=this.voxels[i][h])for(g=c=0,f=this.x;f>c;g=c+=1)if(null!=this.voxels[i][h][g]&&7===this.voxels[i][h][g].t)return[g,h,i];return[0,0,0]},a.prototype.merge=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;if(null==b&&(b={x:0,y:0,z:0}),null!=a.x&&null!=a.y&&null!=a.z&&null!=a.voxels)for(a.readonly&&(this.readonly=!0),c&&(j=a.getAttachmentPoint,d=j[0],e=j[1],f=j[2],b.x-=d,b.y-=e,b.z-=f),(b.x<0||b.y<0||b.z<0)&&(q=Math.min(0,b.x),r=Math.min(0,b.y),s=Math.min(0,b.z),this.resize(this.x-q,this.y-r,this.z-s,q,r,s),b.x=Math.max(0,b.x),b.y=Math.max(0,b.y),b.z=Math.max(0,b.z)),this.x=Math.max(this.x,a.x+b.x),this.y=Math.max(this.y,a.y+b.y),this.z=Math.max(this.z,a.z+b.z),v=g=k=b.z,l=this.z;l>g;v=g+=1)if(null!=a.voxels[v-b.z])for(null==this.voxels[v]&&(this.voxels[v]=[]),u=h=m=b.y,n=this.y;n>h;u=h+=1)if(null!=a.voxels[v-b.z][u-b.y])for(null==this.voxels[v][u]&&(this.voxels[v][u]=[]),t=i=o=b.x,p=this.x;p>i;t=i+=1)null!=a.voxels[v-b.z][u-b.y][t-b.x]&&(this.voxels[v][u][t]=a.voxels[v-b.z][u-b.y][t-b.x])},a},c.exports=d,c.exports}),a.registerDynamic("a",["6"],!0,function(a,b,c){"use strict";var d,e,f=function(a,b){function c{this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},g={}.hasOwnProperty,h=[].slice;return d=function(a){function b(a){var c,d,e,f,g,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q;if(!b.__super__.constructor.call(this,a)){if(this.voxels=[],d=atob(a).split("").map(function(a){return a.charCodeAt(0)}),0===d[0]?(c=d[0],D=d[1],E=d[2],F=d[3],G=d[4],I=d[5],J=d[6],K=d[7],L=d[8],N=d[9],O=d[10],P=d[11],Q=d[12],this.readonly=d[13],e=15<=d.length?h.call(d,14):[],this.x=new Uint32Array(new Uint8Array([D,E,F,G]).buffer)[0],this.y=new Uint32Array(new Uint8Array([I,J,K,L]).buffer)[0],this.z=new Uint32Array(new Uint8Array([N,O,P,Q]).buffer)[0]):(this.x=d[0],this.y=d[1],this.z=d[2],this.readonly=d[3],e=5<=d.length?h.call(d,4):[]),f=s=0,B={},85===e[0]){for(q=256*e[1]+e[2],A=0===e[1]&&e[2]<128?1:2,p=[null],i=j=3,t=5*q+3;t>j;i=j+=5)p.push({r:e[i+1],g:e[i+2],b:e[i+3],a:e[i+4],s:e[i]%16,t:e[i]>>4});for(f=5*q+3,M=k=0,u=this.z;u>k;M=k+=1)for(H=l=0,v=this.y;v>l;H=l+=1)for(C=m=0,w=this.x;w>m;C=m+=1)0===s&&(e[f]>127?(s=e[f]-126,f++):s=1,g=1===A?e[f]:256*e[f]+e[f+1],B=0!==g?p[g]:null,f+=A),null!=B&&(null==this.voxels[M]&&(this.voxels[M]=[]),null==this.voxels[M][H]&&(this.voxels[M][H]=[]),this.voxels[M][H][C]={r:B.r,g:B.g,b:B.b,a:B.a,s:B.s,t:B.t}),s--}else for(M=n=0,x=this.z;x>n;M=n+=1)for(H=o=0,y=this.y;y>o;H=o+=1)for(C=r=0,z=this.x;z>r;C=r+=1){if(0===s){if(e[f]>127?(s=e[f]-127,f++):s=1,e[f]>127)throw new Error("Base64 parsing error");e[f]<64?(B={r:e[f+1],g:e[f+2],b:e[f+3],a:e[f+4],s:e[f]%8,t:e[f]>>3},f+=5):(B=null,f++)}null!=B&&(null==this.voxels[M]&&(this.voxels[M]=[]),null==this.voxels[M][H]&&(this.voxels[M][H]=[]),this.voxels[M][H][C]={r:B.r,g:B.g,b:B.b,a:B.a,s:B.s,t:B.t}),s--}f!==e.length&&console.warn("There shouldn't be any bytes left"),this.readonly||console.log("voxels:"),this.readonly||console.log(this.voxels)}}return f(b,a),b.prototype["export"]=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P;for(null==b&&(b=1),this.readonly&&(a=!0),d=function(a,b,c){var d,e,f,g;if(!(ce;e++)if(d=g[e],a[d]!==b[d])return!1;return!0},this.x>255||this.y>255||this.z>255?(p=new Uint8Array(new Uint32Array([this.x]).buffer),C=p[0],D=p[1],E=p[2],F=p[3],q=new Uint8Array(new Uint32Array([this.y]).buffer),H=q[0],I=q[1],J=q[2],K=q[3],r=new Uint8Array(new Uint32Array([this.z]).buffer),M=r[0],N=r[1],O=r[2],P=r[3],c=[0,C,D,E,F,H,I,J,K,M,N,O,P,a?1:0]):c=[this.x,this.y,this.z,a?1:0],A=[],L=h=0,s=this.z;s>h;L=h+=1)for(G=i=0,t=this.y;t>i;G=i+=1)for(B=k=0,u=this.x;u>k;B=k+=1)A.push(null!=(v=this.voxels[L])&&null!=(w=v[G])?w[B]:void 0);if(f=0,1===b)for(fn&&d(A[f+n-1],A[f+n],f+n);)n++;n>1&&c.push(127+n),null!=A[f]?c.push(8*A[f].t+A[f].s,A[f].r,A[f].g,A[f].b,A[f].a):c.push(64),f+=n}if(2===b){for(c.push(85,0,0),o=[],m=0,j=A.length;j>m;m++)if(z=A[m],null!=z&&(e=z.b+256*z.g+65536*z.r,l=z.a+256*z.t+2048*z.s,null==o[e]&&(o[e]=[]),null==(null!=(x=o[e])?x[l]:void 0)&&(c.push(16*z.t+z.s,z.r,z.g,z.b,z.a),o[e][l]=(c.length-7)/5,!((c.length-7)/5<32768))))throw new Error("To many colors for Troxel2 palette");for(c[5]=Math.floor((c.length-7)/1280),c[6]=(c.length-7)/5%256,y=0===c[5]&&c[6]<128;fn&&d(A[f+n-1],A[f+n],f+n);)n++;n>1&&c.push(126+n),null!=A[f]?(g=o[A[f].b+256*A[f].g+65536*A[f].r][A[f].a+256*A[f].t+2048*A[f].s],y?c.push(g):c.push(Math.floor(g/256),g%256)):y?c.push(0):c.push(0,0),f+=n}}return console.log("export base64:"),console.log(c),btoa(String.fromCharCode.apply(null,c))},b}(a("6")),e=function(a){function b(a){var c;b.__super__.constructor.call(this,a)||(c=JSON.parse(a),this.x=c.x,this.y=c.y,this.z=c.z,this.voxels=c.voxels)}return f(b,a),b.prototype["export"]=function(a){return JSON.stringify({x:this.x,y:this.y,z:this.z,voxels:this.voxels},null,a?" ":"")},b}(a("6")),b.Base64IO=d,b.JsonIO=e,c.exports}),a.registerDynamic("b",["c"],!1,function(b,c,d){var e=a.get("@@global-helpers").prepareGlobal(d.id,"THREE",null);return function{THREE.SSAOShader={uniforms:{tDiffuse:{type:"t",value:null},tDepth:{type:"t",value:null},size:{type:"v2",value:new THREE.Vector2(512,512)},cameraNear:{type:"f",value:1},cameraFar:{type:"f",value:100},onlyAO:{type:"i",value:0},aoClamp:{type:"f",value:.5},lumInfluence:{type:"f",value:.5}},vertexShader:["varying vec2 vUv;","void main {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float cameraNear;","uniform float cameraFar;","uniform bool onlyAO;","uniform vec2 size;","uniform float aoClamp;","uniform float lumInfluence;","uniform sampler2D tDiffuse;","uniform sampler2D tDepth;","varying vec2 vUv;","#define DL 2.399963229728653","#define EULER 2.718281828459045","float width = size.x;","float height = size.y;","float cameraFarPlusNear = cameraFar + cameraNear;","float cameraFarMinusNear = cameraFar - cameraNear;","float cameraCoef = 2.0 * cameraNear;","const int samples = 8;","const float radius = 5.0;","const bool useNoise = false;","const float noiseAmount = 0.0003;","const float diffArea = 0.4;","const float gDisplace = 0.4;","float unpackDepth( const in vec4 rgba_depth ) {","const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );","float depth = dot( rgba_depth, bit_shift );","return depth;","}","vec2 rand( const vec2 coord ) {","vec2 noise;","if ( useNoise ) {","float nx = dot ( coord, vec2( 12.9898, 78.233 ) );","float ny = dot ( coord, vec2( 12.9898, 78.233 ) * 2.0 );","noise = clamp( fract ( 43758.5453 * sin( vec2( nx, ny ) ) ), 0.0, 1.0 );","} else {","float ff = fract( 1.0 - coord.s * ( width / 2.0 ) );","float gg = fract( coord.t * ( height / 2.0 ) );","noise = vec2( 0.25, 0.75 ) * vec2( ff ) + vec2( 0.75, 0.25 ) * gg;","}","return ( noise * 2.0 - 1.0 ) * noiseAmount;","}","float readDepth( const in vec2 coord ) {","return cameraCoef / ( cameraFarPlusNear - unpackDepth( texture2D( tDepth, coord ) ) * cameraFarMinusNear );","}","float compareDepths( const in float depth1, const in float depth2, inout int far ) {","float garea = 2.0;","float diff = ( depth1 - depth2 ) * 100.0;","if ( diff < gDisplace ) {","garea = diffArea;","} else {","far = 1;","}","float dd = diff - gDisplace;","float gauss = pow( EULER, -2.0 * dd * dd / ( garea * garea ) );","return gauss;","}","float calcAO( float depth, float dw, float dh ) {","float dd = radius - depth * radius;","vec2 vv = vec2( dw, dh );","vec2 coord1 = vUv + dd * vv;","vec2 coord2 = vUv - dd * vv;","float temp1 = 0.0;","float temp2 = 0.0;","int far = 0;","temp1 = compareDepths( depth, readDepth( coord1 ), far );","if ( far > 0 ) {","temp2 = compareDepths( readDepth( coord2 ), depth, far );","temp1 += ( 1.0 - temp1 ) * temp2;","}","return temp1;","}","void main {","vec2 noise = rand( vUv );","float depth = readDepth( vUv );","float tt = clamp( depth, aoClamp, 1.0 );","float w = ( 1.0 / width )  / tt + ( noise.x * ( 1.0 - noise.x ) );","float h = ( 1.0 / height ) / tt + ( noise.y * ( 1.0 - noise.y ) );","float ao = 0.0;","float dz = 1.0 / float( samples );","float z = 1.0 - dz / 2.0;","float l = 0.0;","for ( int i = 0; i <= samples; i ++ ) {","float r = sqrt( 1.0 - z );","float pw = cos( l ) * r;","float ph = sin( l ) * r;","ao += calcAO( depth, pw * w, ph * h );","z = z - dz;","l = l + DL;","}","ao /= float( samples );","ao = 1.0 - ao;","vec3 color = texture2D( tDiffuse, vUv ).rgb;","vec3 lumcoeff = vec3( 0.299, 0.587, 0.114 );","float lum = dot( color.rgb, lumcoeff );","vec3 luminance = vec3( lum );","vec3 final = vec3( color * mix( vec3( ao ), vec3( 1.0 ), luminance * lumInfluence ) );","if ( onlyAO ) {","final = vec3( mix( vec3( ao ), vec3( 1.0 ), luminance * lumInfluence ) );","}","gl_FragColor = vec4( final, 1.0 );","}"].join("\n")}},e}),a.registerDynamic("d",["c"],!1,function(b,c,d){var e=a.get("@@global-helpers").prepareGlobal(d.id,"THREE",null);return function{THREE.FXAAShader={uniforms:{tDiffuse:{type:"t",value:null},resolution:{type:"v2",value:new THREE.Vector2(1/1024,1/512)}},vertexShader:["void main {","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec2 resolution;","#define FXAA_REDUCE_MIN   (1.0/128.0)","#define FXAA_REDUCE_MUL   (1.0/8.0)","#define FXAA_SPAN_MAX     8.0","void main {","vec3 rgbNW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ).xyz;","vec3 rgbNE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ).xyz;","vec3 rgbSW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ).xyz;","vec3 rgbSE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ).xyz;","vec4 rgbaM  = texture2D( tDiffuse,  gl_FragCoord.xy  * resolution );","vec3 rgbM  = rgbaM.xyz;","vec3 luma = vec3( 0.299, 0.587, 0.114 );","float lumaNW = dot( rgbNW, luma );","float lumaNE = dot( rgbNE, luma );","float lumaSW = dot( rgbSW, luma );","float lumaSE = dot( rgbSE, luma );","float lumaM  = dot( rgbM,  luma );","float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );","float lumaMax = max( lumaM, max( max( lumaNW, lumaNE), max( lumaSW, lumaSE ) ) );","vec2 dir;","dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));","dir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));","float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );","float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );","dir = min( vec2( FXAA_SPAN_MAX,  FXAA_SPAN_MAX),","max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),","dir * rcpDirMin)) * resolution;","vec4 rgbA = (1.0/2.0) * (","texture2D(tDiffuse,  gl_FragCoord.xy  * resolution + dir * (1.0/3.0 - 0.5)) +","texture2D(tDiffuse,  gl_FragCoord.xy  * resolution + dir * (2.0/3.0 - 0.5)));","vec4 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (","texture2D(tDiffuse,  gl_FragCoord.xy  * resolution + dir * (0.0/3.0 - 0.5)) +","texture2D(tDiffuse,  gl_FragCoord.xy  * resolution + dir * (3.0/3.0 - 0.5)));","float lumaB = dot(rgbB, vec4(luma, 0.0));","if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) ) {","gl_FragColor = rgbA;","} else {","gl_FragColor = rgbB;","}","}"].join("\n")}},e}),a.registerDynamic("e",["c"],!1,function(b,c,d){var e=a.get("@@global-helpers").prepareGlobal(d.id,"THREE",null);return function{THREE.CopyShader={uniforms:{tDiffuse:{type:"t",value:null},opacity:{type:"f",value:1}},vertexShader:["varying vec2 vUv;","void main {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main {","vec4 texel = texture2D( tDiffuse, vUv );","gl_FragColor = opacity * texel;","}"].join("\n")}},e}),a.registerDynamic("f",["c"],!1,function(b,c,d){var e=a.get("@@global-helpers").prepareGlobal(d.id,"THREE",null);return function{THREE.ShaderPass=function(a,b){this.textureID=void 0!==b?b:"tDiffuse",this.uniforms=THREE.UniformsUtils.clone(a.uniforms),this.material=new THREE.ShaderMaterial({defines:a.defines||{},uniforms:this.uniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader}),this.renderToScreen=!1,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.camera=new THREE.OrthographicCamera(-1,1,1,-1,0,1),this.scene=new THREE.Scene,this.quad=new THREE.Mesh(new THREE.PlaneBufferGeometry(2,2),null),this.scene.add(this.quad)},THREE.ShaderPass.prototype={render:function(a,b,c,d){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=c),this.quad.material=this.material,this.renderToScreen?a.render(this.scene,this.camera):a.render(this.scene,this.camera,b,this.clear)}}},e}),a.registerDynamic("10",["c"],!1,function(b,c,d){var e=a.get("@@global-helpers").prepareGlobal(d.id,"THREE",null);return function{THREE.RenderPass=function(a,b,c,d,e){this.scene=a,this.camera=b,this.overrideMaterial=c,this.clearColor=d,this.clearAlpha=void 0!==e?e:1,this.oldClearColor=new THREE.Color,this.oldClearAlpha=1,this.enabled=!0,this.clear=!0,this.needsSwap=!1},THREE.RenderPass.prototype={render:function(a,b,c,d){this.scene.overrideMaterial=this.overrideMaterial,this.clearColor&&(this.oldClearColor.copy(a.getClearColor),this.oldClearAlpha=a.getClearAlpha,a.setClearColor(this.clearColor,this.clearAlpha)),a.render(this.scene,this.camera,c,this.clear),this.clearColor&&a.setClearColor(this.oldClearColor,this.oldClearAlpha),this.scene.overrideMaterial=null}}},e}),a.registerDynamic("11",["c"],!1,function(b,c,d){var e=a.get("@@global-helpers").prepareGlobal(d.id,"THREE",null);return function{THREE.MaskPass=function(a,b){this.scene=a,this.camera=b,this.enabled=!0,this.clear=!0,this.needsSwap=!1,this.inverse=!1},THREE.MaskPass.prototype={render:function(a,b,c,d){var e=a.context;e.colorMask(!1,!1,!1,!1),e.depthMask(!1);var f,g;this.inverse?(f=0,g=1):(f=1,g=0),e.enable(e.STENCIL_TEST),e.stencilOp(e.REPLACE,e.REPLACE,e.REPLACE),e.stencilFunc(e.ALWAYS,f,4294967295),e.clearStencil(g),a.render(this.scene,this.camera,c,this.clear),a.render(this.scene,this.camera,b,this.clear),e.colorMask(!0,!0,!0,!0),e.depthMask(!0),e.stencilFunc(e.EQUAL,1,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP)}},THREE.ClearMaskPass=function{this.enabled=!0},THREE.ClearMaskPass.prototype={render:function(a,b,c,d){var e=a.context;e.disable(e.STENCIL_TEST)}}},e}),a.registerDynamic("12",["c"],!1,function(b,c,d){var e=a.get("@@global-helpers").prepareGlobal(d.id,"THREE",null);return function{THREE.EffectComposer=function(a,b){if(this.renderer=a,void 0===b){var c=a.getPixelRatio,d=Math.floor(a.context.canvas.width/c)||1,e=Math.floor(a.context.canvas.height/c)||1,f={minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBFormat,stencilBuffer:!1};b=new THREE.WebGLRenderTarget(d,e,f)}this.renderTarget1=b,this.renderTarget2=b.clone,this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.passes=[],void 0===THREE.CopyShader&&console.error("THREE.EffectComposer relies on THREE.CopyShader"),this.copyPass=new THREE.ShaderPass(THREE.CopyShader)},THREE.EffectComposer.prototype={swapBuffers:function{var a=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=a},addPass:function(a){this.passes.push(a)},insertPass:function(a,b){this.passes.splice(b,0,a)},render:function(a){this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2;var b,c,d=!1,e=this.passes.length;for(c=0;e>c;c++)if(b=this.passes[c],b.enabled){if(b.render(this.renderer,this.writeBuffer,this.readBuffer,a,d),b.needsSwap){if(d){var f=this.renderer.context;f.stencilFunc(f.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,a),f.stencilFunc(f.EQUAL,1,4294967295)}this.swapBuffers}b instanceof THREE.MaskPass?d=!0:b instanceof THREE.ClearMaskPass&&(d=!1)}},reset:function(a){if(void 0===a){a=this.renderTarget1.clone;var b=this.renderer.getPixelRatio;a.width=Math.floor(this.renderer.context.canvas.width/b),a.height=Math.floor(this.renderer.context.canvas.height/b)}this.renderTarget1=a,this.renderTarget2=a.clone,this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2},setSize:function(a,b){var c=this.renderTarget1.clone;c.width=a,c.height=b,this.reset(c)}}},e}),a.registerDynamic("13",["c"],!0,function(a,b,c){"use strict";var d,e,f=function(a,b){function c{this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},g={}.hasOwnProperty;return d=a("c"),e=function(a){function b(a,b){this.object=a,this.domElement=b,this.enabled=!0,this.mode=!0,this.target=new d.Vector3,this.noZoom=!1,this.zoomSpeed=.95,this.minDistance=0,this.maxDistance=1/0,this.noRotate=!1,this.rotateSpeed=1,this.noPan=!1,this.autoRotate=!1,this.autoRotateSpeed=-4,this.noKeys=!1,this.needsRender=!1,this.EPS=1e-6,this.rotateStart=new d.Vector2,this.rotateEnd=new d.Vector2,this.rotateDelta=new d.Vector2,this.panStart=new d.Vector2,this.panEnd=new d.Vector2,this.panDelta=new d.Vector2,this.panOffset=new d.Vector3,this.offset=new d.Vector3,this.dollyStart=new d.Vector2,this.dollyEnd=new d.Vector2,this.dollyDelta=new d.Vector2,this.theta=0,this.phi=0,this.phiDelta=0,this.thetaDelta=0,this.scale=1,this.pan=new d.Vector3,this.lastPosition=new d.Vector3,this.lastQuaternion=new d.Quaternion,this.STATE={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5,FLY:6},this.state=this.STATE.NONE,this.target0=this.target.clone,this.position0=this.object.position.clone,this.quat=(new d.Quaternion).setFromUnitVectors(this.object.up,new d.Vector3(0,1,0)),this.quatInverse=this.quat.clone.inverse,this.moveVector=new d.Vector3,this.rotationVector=new d.Vector3,this.tmpQuaternion=new d.Quaternion,this.mousefly=!1,this.domElement.addEventListener("contextmenu",function(a){return a.preventDefault}),this.domElement.addEventListener("mousedown",function(a){return function(b){return a.onMouseDown(b)}}(this)),document.addEventListener("mouseup",function(a){return function(b){return a.onMouseUp(b)}}(this)),document.addEventListener("mousemove",function(a){return function(b){return a.onMouseMove(b)}}(this)),this.domElement.addEventListener("mousewheel",function(a){return function(b){return a.onMouseWheel(b)}}(this)),this.domElement.addEventListener("DOMMouseScroll",function(a){return function(b){return a.onMouseWheel(b)}}(this)),this.domElement.addEventListener("touchstart",function(a){return function(b){return a.touchstart(b)}}(this)),this.domElement.addEventListener("touchend",function(a){return function(b){return a.touchend(b)}}(this)),this.domElement.addEventListener("touchmove",function(a){return function(b){return a.touchmove(b)}}(this)),window.addEventListener("keydown",function(a){return function(b){return a.onKeyDown(b)}}(this)),window.addEventListener("keyup",function(a){return function(b){return a.onKeyUp(b)}}(this)),this.object.lookAt(this.target),this.update}var c;return f(b,a),b.prototype.rotateLeft=function(a){return null==a&&(a=2*Math.PI/60/60*this.autoRotateSpeed),this.thetaDelta-=a},b.prototype.rotateUp=function(a){return null==a&&(a=2*Math.PI/60/60*this.autoRotateSpeed),this.phiDelta-=a},b.prototype.panLeft=function(a){var b;return b=this.object.matrix.elements,this.panOffset.set(b[0],b[1],b[2]),this.panOffset.multiplyScalar(-a),this.pan.add(this.panOffset)},b.prototype.panUp=function(a){var b;return b=this.object.matrix.elements,this.panOffset.set(b[4],b[5],b[6]),this.panOffset.multiplyScalar(a),this.pan.add(this.panOffset)},b.prototype.panXY=function(a,b){var c,e;return this.object instanceof d.PerspectiveCamera?(c=this.object.position,e=c.clone.sub(this.target).length,e*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*a*e/this.domElement.clientHeight),this.panUp(2*b*e/this.domElement.clientHeight)):console.warn("WARNING: Controls.js only supports perspective camera type.")},b.prototype.dollyIn=function(a){return null==a&&(a=this.zoomSpeed),this.scale/=a},b.prototype.dollyOut=function(a){return null==a&&(a=this.zoomSpeed),this.scale*=a},b.prototype.update=function(a){var b,c;return this.mode?(b=this.object.position,this.offset.copy(b).sub(this.target),this.offset.applyQuaternion(this.quat),this.theta=Math.atan2(this.offset.x,this.offset.z),this.phi=Math.atan2(Math.sqrt(this.offset.x*this.offset.x+this.offset.z*this.offset.z),this.offset.y),this.autoRotate&&this.state===this.STATE.NONE&&this.rotateLeft(2*Math.PI/60/60*this.autoRotateSpeed),this.theta+=this.thetaDelta,this.phi+=this.phiDelta,this.phi=Math.max(this.EPS,Math.min(Math.PI-this.EPS,this.phi)),c=this.offset.length*this.scale,c=Math.max(this.minDistance,Math.min(this.maxDistance,c)),this.target.add(this.pan),this.offset.x=c*Math.sin(this.phi)*Math.sin(this.theta),this.offset.y=c*Math.cos(this.phi),this.offset.z=c*Math.sin(this.phi)*Math.cos(this.theta),this.offset.applyQuaternion(this.quatInverse),b.copy(this.target).add(this.offset),this.object.lookAt(this.target),this.thetaDelta=0,this.phiDelta=0,this.scale=1,this.pan.set(0,0,0)):(this.object.translateX(20*this.moveVector.x),this.object.translateY(20*this.moveVector.y),this.object.translateZ(20*this.moveVector.z),this.tmpQuaternion.set(.005*this.rotationVector.x,.005*this.rotationVector.y,.005*this.rotationVector.z,1).normalize, this.object.quaternion.multiply(this.tmpQuaternion),this.object.rotation.setFromQuaternion(this.object.quaternion,this.object.rotation.order)),this.lastPosition.distanceToSquared(this.object.position)>this.EPS||8*(1-this.lastQuaternion.dot(this.object.quaternion))>this.EPS?(this.dispatchEvent({type:"change"}),this.lastPosition.copy(this.object.position),this.lastQuaternion.copy(this.object.quaternion),this.needsRender=!1):this.needsRender?(this.dispatchEvent({type:"change"}),this.needsRender=!1):null!=a?a.end:void 0},c=function{return this.state=this.STATE.NONE,this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.updateProjectionMatrix,this.dispatchEvent({type:"change"}),this.update},b.prototype.onMouseDown=function(a){if(this.enabled){if(a.preventDefault,this.mode){if(0===a.button){if(this.noRotate)return;this.state=this.STATE.ROTATE,this.rotateStart.set(a.clientX,a.clientY)}else if(1===a.button){if(this.noZoom)return;this.state=this.STATE.DOLLY,this.dollyStart.set(a.clientX,a.clientY)}else if(2===a.button){if(this.noPan)return;this.state=this.STATE.PAN,this.panStart.set(a.clientX,a.clientY)}}else this.mousefly=!0,this.state=this.STATE.FLY,0===a.button?this.moveVector.z=-1:2===a.button&&(this.moveVector.z=1);return this.state!==this.STATE.NONE?this.dispatchEvent({type:"start"}):void 0}},b.prototype.onMouseMove=function(a){var b,c;if(this.enabled){if(a.preventDefault,this.state===this.STATE.ROTATE){if(this.noRotate)return;this.rotateEnd.set(a.clientX,a.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart),this.rotateLeft(2*Math.PI*this.rotateDelta.x/this.domElement.clientWidth*this.rotateSpeed),this.rotateUp(2*Math.PI*this.rotateDelta.y/this.domElement.clientHeight*this.rotateSpeed),this.rotateStart.copy(this.rotateEnd)}else if(this.state===this.STATE.DOLLY){if(this.noZoom)return;this.dollyEnd.set(a.clientX,a.clientY),this.dollyDelta.subVectors(this.dollyEnd,this.dollyStart),this.dollyDelta.y>0?this.dollyIn:this.dollyDelta.y<0&&this.dollyOut,this.dollyStart.copy(this.dollyEnd)}else if(this.state===this.STATE.PAN){if(this.noPan)return;this.panEnd.set(a.clientX,a.clientY),this.panDelta.subVectors(this.panEnd,this.panStart),this.panXY(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd)}else this.mousefly&&(c=this.domElement.clientWidth/2,b=this.domElement.clientHeight/2,this.rotationVector.y=-(a.clientX-c)/c,this.rotationVector.x=-(a.clientY-b)/b);return this.state!==this.STATE.NONE&&this.mode?this.update:void 0}},b.prototype.onMouseUp=function{return this.enabled?(this.moveVector.z=0,this.dispatchEvent({type:"end"}),this.state=this.STATE.NONE):void 0},b.prototype.onMouseWheel=function(a){var b;if(this.enabled&&!this.noZoom&&this.state===this.STATE.NONE&&this.mode)return a.preventDefault,a.stopPropagation,b=0,null!=a.wheelDelta?b=a.wheelDelta:null!=a.detail&&(b=-a.detail),b>0?this.dollyOut:0>b&&this.dollyIn,this.update,this.dispatchEvent({type:"start"}),this.dispatchEvent({type:"end"})},b.prototype.onKeyDown=function(a){if(this.enabled&&!this.noKeys)if(this.mode){if(!this.noRotate)switch(a.keyCode){case 87:this.rotateUp(-.05),this.update;break;case 65:this.rotateLeft(-.05),this.update;break;case 83:this.rotateUp(.05),this.update;break;case 68:this.rotateLeft(.05),this.update}if(!this.noZoom)switch(a.keyCode){case 81:this.dollyIn,this.update;break;case 69:this.dollyOut,this.update}if(!this.noPan)switch(a.keyCode){case 38:return this.panXY(0,7),this.update;case 40:return this.panXY(0,-7),this.update;case 37:return this.panXY(7,0),this.update;case 39:return this.panXY(-7,0),this.update}}else switch(this.mousefly&&(this.rotationVector.set(0,0,0),this.mousefly=!1),a.keyCode){case 87:return this.moveVector.z=-1;case 83:return this.moveVector.z=1;case 65:return this.moveVector.x=-1;case 68:return this.moveVector.x=1;case 82:return this.moveVector.y=1;case 70:return this.moveVector.y=-1;case 38:return this.rotationVector.x=-1;case 40:return this.rotationVector.x=1;case 37:return this.rotationVector.y=1;case 39:return this.rotationVector.y=-1;case 81:return this.rotationVector.z=1;case 69:return this.rotationVector.z=-1}},b.prototype.onKeyUp=function(a){if(this.enabled&&!this.noKeys&&!this.mode)switch(a.keyCode){case 87:return this.moveVector.z=0;case 83:return this.moveVector.z=0;case 65:return this.moveVector.x=0;case 68:return this.moveVector.x=0;case 82:return this.moveVector.y=0;case 70:return this.moveVector.y=0;case 38:return this.rotationVector.x=0;case 40:return this.rotationVector.x=0;case 37:return this.rotationVector.y=0;case 39:return this.rotationVector.y=0;case 81:return this.rotationVector.z=0;case 69:return this.rotationVector.z=0}},b.prototype.touchstart=function(a){var b,c;if(this.enabled&&this.mode){switch(a.touches.length){case 1:if(this.noRotate)return;this.state=this.STATE.TOUCH_ROTATE,this.rotateStart.set(a.touches[0].pageX,a.touches[0].pageY);break;case 2:if(this.noZoom)return;this.state=this.STATE.TOUCH_DOLLY,b=a.touches[0].pageX-a.touches[1].pageX,c=a.touches[0].pageY-a.touches[1].pageY,this.dollyStart.set(0,Math.sqrt(b*b+c*c));break;case 3:if(this.noPan)return;this.state=this.STATE.TOUCH_PAN,this.panStart.set(a.touches[0].pageX,a.touches[0].pageY);break;default:this.state=this.STATE.NONE}return this.state!==this.STATE.NONE?this.dispatchEvent({type:"start"}):void 0}},b.prototype.touchmove=function(a){var b,c;if(this.enabled&&this.mode)switch(a.preventDefault,a.stopPropagation,a.touches.length){case 1:if(this.noRotate||this.state!==this.STATE.TOUCH_ROTATE)return;return this.rotateEnd.set(a.touches[0].pageX,a.touches[0].pageY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart),this.rotateLeft(2*Math.PI*this.rotateDelta.x/this.domElement.clientWidth*this.rotateSpeed),this.rotateUp(2*Math.PI*this.rotateDelta.y/this.domElement.clientHeight*this.rotateSpeed),this.rotateStart.copy(this.rotateEnd),this.update;case 2:if(this.noZoom||this.state!==this.STATE.TOUCH_DOLLY)return;return b=a.touches[0].pageX-a.touches[1].pageX,c=a.touches[0].pageY-a.touches[1].pageY,this.dollyEnd.set(0,Math.sqrt(b*b+c*c)),this.dollyDelta.subVectors(this.dollyEnd,this.dollyStart),this.dollyDelta.y>0?this.dollyOut:this.dollyDelta.y<0&&this.dollyIn,this.dollyStart.copy(this.dollyEnd),this.update;case 3:if(this.noPan||this.state!==this.STATE.TOUCH_PAN)return;return this.panEnd.set(a.touches[0].pageX,a.touches[0].pageY),this.panDelta.subVectors(this.panEnd,this.panStart),this.panXY(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd),this.update;default:return this.state=this.STATE.NONE}},b.prototype.touchend=function{return this.enabled&&this.mode?(this.dispatchEvent({type:"end"}),this.state=this.STATE.NONE):void 0},b}(d.EventDispatcher),c.exports=e,c.exports}),a.registerDynamic("14",["c","b","d","e","f","10","11","12","13","15"],!0,function(a,b,c){"use strict";var d,e,f,g;return f=a("c"),a("b"),a("d"),a("e"),a("f"),a("10"),a("11"),a("12"),g=a("13"),d=a("15"),e=function{function a(a,b,c,e,h,i,j,k){var l,m;this.embedded=null!=b?b:!1,this.domContainer=null!=c?c:d("#WebGlContainer"),this.renderMode=null!=e?e:0,this.renderWireframes=null!=h?h:0,null==i&&(i=!0),this.ssao=null!=j?j:!1,null==k&&(k=!0),this.width=this.domContainer.width,this.height=this.domContainer.height,this.scene=new f.Scene,this.camera=new f.PerspectiveCamera(45,this.width/this.height,1,1e5),this.controls=new g(this.camera,this.domContainer[0]),this.controls.mode=k,this.controls.addEventListener("change",function(a){return function{return a.render}}(this)),this.reload(a.voxels,a.x,a.y,a.z,!1,!0),this.ambientLight=new f.AmbientLight(6316128),this.scene.add(this.ambientLight),this.directionalLight=new f.DirectionalLight(16777215,.3),this.directionalLight.position.set(-.5,-.5,1).normalize,this.scene.add(this.directionalLight),this.pointLight=new f.PointLight(16777215,.6,1e5),this.camera.add(this.pointLight),this.scene.add(this.camera),this.renderer=new f.WebGLRenderer({antialias:i}),this.renderer.setClearColor(8947848),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(this.width,this.height),this.domContainer.empty.append(this.renderer.domElement),window.test=this,this.ssao&&(this.composer=new f.EffectComposer(this.renderer),this.composer.addPass(new f.RenderPass(this.scene,this.camera)),this.ssaoPass=new f.ShaderPass(f.SSAOShader),this.depthRenderTarget=new f.WebGLRenderTarget(this.width,this.height,{minFilter:f.LinearFilter,magFilter:f.LinearFilter}),this.ssaoPass.uniforms.tDepth.value=this.depthRenderTarget,this.ssaoPass.uniforms.size.value.set(this.width,this.height),this.ssaoPass.uniforms.cameraNear.value=this.camera.near,this.ssaoPass.uniforms.cameraFar.value=this.camera.far,this.ssaoPass.uniforms.onlyAO.value=!1,this.ssaoPass.uniforms.aoClamp.value=.5,this.ssaoPass.uniforms.lumInfluence.value=.25,this.composer.addPass(this.ssaoPass),this.fxaaPass=new f.ShaderPass(f.FXAAShader),this.fxaaPass.uniforms.resolution.value.set(1/this.width,1/this.height),this.fxaaPass.renderToScreen=!0,this.composer.addPass(this.fxaaPass),l=f.ShaderLib.depthRGBA,m=f.UniformsUtils.clone(l.uniforms),this.depthMaterial=new f.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:m,blending:f.NoBlending})),window.addEventListener("resize",function(a){return function(b){return a.onWindowResize(b)}}(this)),this.embedded&&this.animate}return a.prototype.getMaterial=function(a,b,c,d){var e;switch(this.renderMode){case 0:case 1:break;case 2:a={250:16711935,16:1052688,48:3158064,80:5263440,12:7368816,144:9474192,176:11579568,208:13684944,240:15790320,255:16777215}[b];break;case 3:a=[16777215,8421504,4210752,16711680,16776960,null,null,16711935][c];break;case 4:a=[8388608,32768,128,8421376,8388736,null,null,16711935][d]}return e=new f.MeshPhongMaterial({color:a,ambient:a}),0===this.renderMode?(3!==c&&4!==c||(e.emissive=e.color.multiplyScalar(.5)),1===d&&(e.specular=e.color.multiplyScalar(.5)),1!==c&&2!==c&&4!==c||(e.transparent=!0,e.opacity=b/255)):e.shininess=.1,e},a.prototype.reload=function(a,b,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,aa,ba,ca,da,ea,fa,ga,ha,ia,ja,ka,la,ma,na,oa,pa,qa,ra,sa,ta,ua;for(this.voxels=a,this.x=b,this.y=c,this.z=d,null==e&&(e=!1),null==g&&(g=!1),(e||g)&&(this.embedded?(h=Math.max(this.x,this.z),this.camera.position.x=85*h+65*this.y,this.camera.position.y=50*this.y,this.camera.position.z=25*h):(this.camera.position.x=65*this.y+35*this.x+55*this.z,this.camera.position.y=50*this.y,this.camera.position.z=25*this.x),this.controls.target=new f.Vector3(25*this.z,25*this.y,25*this.x)),g||(this.scene.remove(this.mesh),this.mesh.geometry.dispose,null!=this.wireframe&&(this.scene.remove(this.wireframe),this.wireframe.geometry.dispose)),s=new f.Matrix4,i=new f.Color,w=new f.PlaneGeometry(50,50),w.applyMatrix(s.makeRotationY(Math.PI/2)),w.applyMatrix(s.makeTranslation(25,0,0)),t=new f.PlaneGeometry(50,50),t.applyMatrix(s.makeRotationY(-Math.PI/2)),t.applyMatrix(s.makeTranslation(-25,0,0)),x=new f.PlaneGeometry(50,50),x.applyMatrix(s.makeRotationX(-Math.PI/2)),x.applyMatrix(s.makeTranslation(0,25,0)),u=new f.PlaneGeometry(50,50),u.applyMatrix(s.makeRotationX(Math.PI/2)),u.applyMatrix(s.makeTranslation(0,-25,0)),y=new f.PlaneGeometry(50,50),y.applyMatrix(s.makeTranslation(0,0,25)),v=new f.PlaneGeometry(50,50),v.applyMatrix(s.makeRotationY(Math.PI)),v.applyMatrix(s.makeTranslation(0,0,-25)),j=new f.Geometry,r=[],oa=[],this.wireframe=null,this.renderWireframes>0&&(ra=new f.Geometry),ua=l=0,z=this.z;z>l;ua=l+=1)if(null!=this.voxels[ua])for(ta=m=0,A=this.y;A>m;ta=m+=1)if(null!=(null!=(L=this.voxels[ua])?L[ta]:void 0))for(sa=n=0,W=this.x;W>n;sa=n+=1)null!=(null!=(fa=this.voxels[ua])&&null!=(ja=fa[ta])?ja[sa]:void 0)&&(pa=this.voxels[ua][ta][sa],i.setRGB(pa.r/255,pa.g/255,pa.b/255),k=i.getHex,p=pa.a+256*pa.t+2048*pa.s,null!=(null!=(ka=oa[k])?ka[p]:void 0)?q=oa[k][p]:(q=r.length,null==oa[k]&&(oa[k]=[]),oa[k][p]=q,r.push(this.getMaterial(i,pa.a,pa.t,pa.s))),s.makeTranslation(50*ua+25,50*ta+25,50*sa+25),null!=(null!=(la=this.voxels[ua+1])&&null!=(ma=la[ta])?ma[sa]:void 0)&&(1!==(na=this.voxels[ua+1][ta][sa].t)&&2!==na&&4!==na||1===(B=pa.t)||2===B||4===B)||j.merge(w,s,q),null!=(null!=(C=this.voxels[ua-1])&&null!=(D=C[ta])?D[sa]:void 0)&&(1!==(E=this.voxels[ua-1][ta][sa].t)&&2!==E&&4!==E||1===(F=pa.t)||2===F||4===F)||j.merge(t,s,q),null!=(null!=(G=this.voxels[ua])&&null!=(H=G[ta+1])?H[sa]:void 0)&&(1!==(I=this.voxels[ua][ta+1][sa].t)&&2!==I&&4!==I||1===(J=pa.t)||2===J||4===J)||j.merge(x,s,q),null!=(null!=(K=this.voxels[ua])&&null!=(M=K[ta-1])?M[sa]:void 0)&&(1!==(N=this.voxels[ua][ta-1][sa].t)&&2!==N&&4!==N||1===(O=pa.t)||2===O||4===O)||j.merge(u,s,q),null!=(null!=(P=this.voxels[ua])&&null!=(Q=P[ta])?Q[sa+1]:void 0)&&(1!==(R=this.voxels[ua][ta][sa+1].t)&&2!==R&&4!==R||1===(S=pa.t)||2===S||4===S)||j.merge(y,s,q),null!=(null!=(T=this.voxels[ua])&&null!=(U=T[ta])?U[sa-1]:void 0)&&(1!==(V=this.voxels[ua][ta][sa-1].t)&&2!==V&&4!==V||1===(X=pa.t)||2===X||4===X)||j.merge(v,s,q),this.renderWireframes>0&&(qa=function{switch(this.renderWireframes){case 2:return new f.Color(pa.r/255,pa.g/255,pa.b/255);case 3:return new f.Color({250:16711935,16:1052688,48:3158064,80:5263440,12:7368816,144:9474192,176:11579568,208:13684944,240:15790320,255:16777215}[pa.a]);case 4:return new f.Color([16777215,8421504,4210752,16711680,16776960,null,null,16711935][pa.t]);case 5:return new f.Color([8388608,32768,128,8421376,8388736,null,null,16711935][pa.s]);case 6:return null!=pa.linter?new f.Color(pa.linter):!1;default:return new f.Color(3355443)}}.call(this),null==(null!=(Y=this.voxels[ua+1])&&null!=(Z=Y[ta])?Z[sa]:void 0)&&qa&&(ra.vertices.push(new f.Vector3(50*ua+50,50*ta,50*sa),new f.Vector3(50*ua+50,50*ta,50*sa+50),new f.Vector3(50*ua+50,50*ta,50*sa+50),new f.Vector3(50*ua+50,50*ta+50,50*sa+50),new f.Vector3(50*ua+50,50*ta+50,50*sa+50),new f.Vector3(50*ua+50,50*ta+50,50*sa),new f.Vector3(50*ua+50,50*ta+50,50*sa),new f.Vector3(50*ua+50,50*ta,50*sa)),ra.colors.push(qa,qa,qa,qa,qa,qa,qa,qa)),null==(null!=($=this.voxels[ua-1])&&null!=(_=$[ta])?_[sa]:void 0)&&qa&&(ra.vertices.push(new f.Vector3(50*ua,50*ta,50*sa),new f.Vector3(50*ua,50*ta,50*sa+50),new f.Vector3(50*ua,50*ta,50*sa+50),new f.Vector3(50*ua,50*ta+50,50*sa+50),new f.Vector3(50*ua,50*ta+50,50*sa+50),new f.Vector3(50*ua,50*ta+50,50*sa),new f.Vector3(50*ua,50*ta+50,50*sa),new f.Vector3(50*ua,50*ta,50*sa)),ra.colors.push(qa,qa,qa,qa,qa,qa,qa,qa)),null==(null!=(aa=this.voxels[ua])&&null!=(ba=aa[ta+1])?ba[sa]:void 0)&&qa&&(ra.vertices.push(new f.Vector3(50*ua,50*ta+50,50*sa),new f.Vector3(50*ua,50*ta+50,50*sa+50),new f.Vector3(50*ua,50*ta+50,50*sa+50),new f.Vector3(50*ua+50,50*ta+50,50*sa+50),new f.Vector3(50*ua+50,50*ta+50,50*sa+50),new f.Vector3(50*ua+50,50*ta+50,50*sa),new f.Vector3(50*ua+50,50*ta+50,50*sa),new f.Vector3(50*ua,50*ta+50,50*sa)),ra.colors.push(qa,qa,qa,qa,qa,qa,qa,qa)),null==(null!=(ca=this.voxels[ua])&&null!=(da=ca[ta-1])?da[sa]:void 0)&&qa&&(ra.vertices.push(new f.Vector3(50*ua,50*ta,50*sa),new f.Vector3(50*ua,50*ta,50*sa+50),new f.Vector3(50*ua,50*ta,50*sa+50),new f.Vector3(50*ua+50,50*ta,50*sa+50),new f.Vector3(50*ua+50,50*ta,50*sa+50),new f.Vector3(50*ua+50,50*ta,50*sa),new f.Vector3(50*ua+50,50*ta,50*sa),new f.Vector3(50*ua,50*ta,50*sa)),ra.colors.push(qa,qa,qa,qa,qa,qa,qa,qa)),null==(null!=(ea=this.voxels[ua])&&null!=(ga=ea[ta])?ga[sa+1]:void 0)&&qa&&(ra.vertices.push(new f.Vector3(50*ua,50*ta,50*sa+50),new f.Vector3(50*ua+50,50*ta,50*sa+50),new f.Vector3(50*ua+50,50*ta,50*sa+50),new f.Vector3(50*ua+50,50*ta+50,50*sa+50),new f.Vector3(50*ua+50,50*ta+50,50*sa+50),new f.Vector3(50*ua,50*ta+50,50*sa+50),new f.Vector3(50*ua,50*ta+50,50*sa+50),new f.Vector3(50*ua,50*ta,50*sa+50)),ra.colors.push(qa,qa,qa,qa,qa,qa,qa,qa)),null==(null!=(ha=this.voxels[ua])&&null!=(ia=ha[ta])?ia[sa-1]:void 0)&&qa&&(ra.vertices.push(new f.Vector3(50*ua,50*ta,50*sa),new f.Vector3(50*ua+50,50*ta,50*sa),new f.Vector3(50*ua+50,50*ta,50*sa),new f.Vector3(50*ua+50,50*ta+50,50*sa),new f.Vector3(50*ua+50,50*ta+50,50*sa),new f.Vector3(50*ua,50*ta+50,50*sa),new f.Vector3(50*ua,50*ta+50,50*sa),new f.Vector3(50*ua,50*ta,50*sa)),ra.colors.push(qa,qa,qa,qa,qa,qa,qa,qa))));return this.mesh=new f.Mesh(j,new f.MeshFaceMaterial(r)),this.renderWireframes>0&&(o=new f.LineBasicMaterial({vertexColors:f.VertexColors,linewidth:2}),this.wireframe=new f.Line(ra,o,f.LinePieces),this.scene.add(this.wireframe)),this.scene.add(this.mesh),g?void 0:this.controls.needsRender=!0},a.prototype.animate=function{return requestAnimationFrame(function(a){return function{return a.animate}}(this)),this.embedded||this.stats.begin,this.controls.update(this.stats)},a.prototype.render=function(a){return this.ssao?(this.scene.overrideMaterial=this.depthMaterial,this.renderer.render(this.scene,this.camera,this.depthRenderTarget,!0),this.scene.overrideMaterial=null,this.composer.render):this.renderer.render(this.scene,this.camera),this.embedded||this.stats.end,a?window.open(this.renderer.domElement.toDataURL,"Exported png"):void 0},a.prototype.onWindowResize=function{return this.width=this.domContainer.width,this.height=this.domContainer.height,this.camera.aspect=this.width/this.height,this.camera.updateProjectionMatrix,this.renderer.setSize(this.width,this.height),this.ssao&&(this.ssaoPass.uniforms.size.value.set(this.width,this.height),this.fxaaPass.uniforms.resolution.value.set(1/this.width,1/this.height),this.composer.setSize(this.width,this.height)),this.controls.needsRender=!0},a},c.exports=e,c.exports}),a.registerDynamic("16",["c","9","a","15","14"],!0,function(a,b,c){"use strict";var d,e,f,g,h,i=function(a,b){function c{this.constructor=a}for(var d in b)j.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},j={}.hasOwnProperty,k=function(a,b){return(+a%(b=+b)+b)%b},l=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};return h=a("c"),g=a("9"),e=a("a").Base64IO,d=a("15"),f=function(a){function b(a,c,e){this.embedded=null!=c?c:!1,this.domContainer=null!=e?e:d("#WebGlContainer"),this.objects=[],b.__super__.constructor.call(this,a,this.embedded,this.domContainer,parseInt(d("#renderMode").val),parseInt(d("#renderWireframes").val),"1"===d("#rendererPostEffect").val,"2"===d("#rendererPostEffect").val,"0"===d("#renderControls").val),this.rollOverMesh=new h.Mesh(new h.BoxGeometry(48,48,48),new h.MeshBasicMaterial({wireframe:!0,color:0})),this.scene.add(this.rollOverMesh),this.vector=new h.Vector3,this.raycaster=new h.Raycaster,this.setupGrid,this.stats=new g,this.stats.domElement.style.position="absolute",this.stats.domElement.style.top="0px",this.domContainer.append(this.stats.domElement),this.changeEditMode(d("#modeEdit").parent.hasClass("active")),this.domContainer.on("mousedown",function(a){return function(b){return a.onDocumentMouseDown(b)}}(this)),this.domContainer.on("mousemove",function(a){return function(b){return a.onDocumentMouseMove(b)}}(this)),document.addEventListener("keydown",function(a){return function(b){return a.onDocumentKeyDown(b)}}(this)),document.addEventListener("keyup",function(a){return function(b){return a.onDocumentKeyUp(b)}}(this)),this.animate}return i(b,a),b.prototype.setupGrid=function{var a,b,c,d,e,f,g,i,j,k,l,m;for(this.planes=[],a=new h.PlaneBufferGeometry(50*this.x,50*this.y),a.applyMatrix((new h.Matrix4).makeRotationY(Math.PI/2)),f=new h.Mesh(a),f.position.y=25*this.y,f.position.z=25*this.x,f.visible=!1,this.scene.add(f),this.objects.push(f),this.planes.push(f),a=new h.PlaneBufferGeometry(50*this.z,50*this.x),a.applyMatrix((new h.Matrix4).makeRotationX(-Math.PI/2)),f=new h.Mesh(a),f.position.x=25*this.z,f.position.z=25*this.x,f.visible=!1,this.scene.add(f),this.objects.push(f),this.planes.push(f),a=new h.PlaneBufferGeometry(50*this.y,50*this.z),a.applyMatrix((new h.Matrix4).makeRotationZ(-Math.PI/2)),a.applyMatrix((new h.Matrix4).makeRotationX(Math.PI)),f=new h.Mesh(a),f.position.x=25*this.z,f.position.y=25*this.y,f.position.z=50*this.x,f.visible=!1,this.scene.add(f),this.objects.push(f),this.planes.push(f),a=new h.Geometry,k=b=0,g=this.x;g>=b;k=b+=1)a.vertices.push(new h.Vector3(0,0,50*k)),a.vertices.push(new h.Vector3(50*this.z,0,50*k)),a.vertices.push(new h.Vector3(0,0,50*k)),a.vertices.push(new h.Vector3(0,50*this.y,50*k));for(l=c=0,i=this.y;i>=c;l=c+=1)a.vertices.push(new h.Vector3(0,50*l,50*this.x)),a.vertices.push(new h.Vector3(50*this.z,50*l,50*this.x)),a.vertices.push(new h.Vector3(0,50*l,0)),a.vertices.push(new h.Vector3(0,50*l,50*this.x));for(m=d=0,j=this.z;j>=d;m=d+=1)a.vertices.push(new h.Vector3(50*m,0,0)),a.vertices.push(new h.Vector3(50*m,0,50*this.x)),a.vertices.push(new h.Vector3(50*m,0,50*this.x)),a.vertices.push(new h.Vector3(50*m,50*this.y,50*this.x));return e=new h.LineBasicMaterial({color:0,opacity:.2,transparent:!0}),this.grid=new h.Line(a,e,h.LinePieces),this.scene.add(this.grid)},b.prototype.changeEditMode=function(a){return this.editMode=a,this.editMode?(this.grid.visible=!0,this.rollOverMesh.visible=!0,this.controls.enabled=!1):(this.grid.visible=!1,this.rollOverMesh.visible=!1,this.controls.enabled=!0),this.controls.needsRender=!0},b.prototype.reload=function(a,c,e,f,g,h){var i,j,k,l;if(this.voxels=a,this.x=c,this.y=e,this.z=f,null==g&&(g=!1),null==h&&(h=!1),g){for(l=this.planes,i=0,j=l.length;j>i;i++)k=l[i],this.scene.remove(k),k.geometry.dispose;this.scene.remove(this.grid),this.grid.geometry.dispose,this.setupGrid,this.changeEditMode(d("#modeEdit").parent.hasClass("active"))}return h||(this.objects=this.planes.slice(0)),b.__super__.reload.call(this,this.voxels,this.x,this.y,this.z,g,h),this.objects.push(this.mesh)},b.prototype.onDocumentMouseMove=function(a){var b,c;if(this.editMode&&"block"!==d("#openModal").css("display")&&"block"!==d("#exportModal").css("display")&&"block"!==d("#saveModal").css("display"))return a.preventDefault,this.vector.set(a.clientX/this.width*2-1,2*-((a.clientY-50)/this.height)+1,.5),this.vector.unproject(this.camera),this.raycaster.ray.set(this.camera.position,this.vector.sub(this.camera.position).normalize),c=this.raycaster.intersectObjects(this.objects),c.length>0&&(b=c[0],this.rollOverMesh.position.copy(b.point).add(b.face.normal),this.rollOverMesh.position.divideScalar(50).floor.multiplyScalar(50).addScalar(25)),this.controls.needsRender=!0},b.prototype.onDocumentMouseDown=function(a){var b,c,f,g,i,j,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N;if(this.editMode&&"block"!==d("#openModal").css("display")&&"block"!==d("#exportModal").css("display")&&"block"!==d("#saveModal").css("display")&&(m=function(a,b,c){var d;return b>0&&(a.multiplyScalar(2*Math.random*b+1-b),a.r>1&&(a.r=1),a.g>1&&(a.g=1),a.b>1&&(a.b=1)),c>0&&(d=a.getHSL,d.h=k(d.h+.1*(2*Math.random*c-c),1),d.s=Math.max(0,Math.min(1,d.s+2*Math.random*c-c)),d.l=Math.max(0,Math.min(1,d.l+2*Math.random*c-c)),a.setHSL(d.h,d.s,d.l)),a},this.vector.set(a.clientX/this.width*2-1,2*-((a.clientY-50)/this.height)+1,.5),this.vector.unproject(this.camera),this.raycaster.ray.set(this.camera.position,this.vector.sub(this.camera.position).normalize),p=this.raycaster.intersectObjects(this.objects),p.length>0)){switch(o=p[0],a.button){case 0:switch(d(".active .editTool").data("edittool")){case 0:if(g=m(new h.Color(d("#addVoxColor").val),parseFloat(d("#editVoxNoiseBright").val,parseFloat(d("#editVoxNoiseHSL").val))),b=parseInt(d("#addVoxAlpha").val),H=parseInt(d("#addVoxType").val),G=parseInt(d("#addVoxSpecular").val),0!==H&&3!==H||(b=255),0!==H&&3!==H&&(G=0),"#ff00ff"===d("#addVoxColor").val&&(b=250,H=G=7),o.point.add(o.face.normal).divideScalar(50).floor,L=o.point.z,M=o.point.y,N=o.point.x,!(L>=0&&L=0&&M=0&&N=0)return;o.point.add(o.face.normal).divideScalar(50).floor.sub(o.face.normal).round,L=o.point.z,M=o.point.y,N=o.point.x,g=m(new h.Color(d("#addVoxColor").val),parseFloat(d("#editVoxNoiseBright").val,parseFloat(d("#editVoxNoiseHSL").val))),b=parseInt(d("#addVoxAlpha").val),H=parseInt(d("#addVoxType").val),G=parseInt(d("#addVoxSpecular").val),0!==H&&3!==H||(b=255),0!==H&&3!==H&&(G=0),1===g.r&&0===g.g&&1===g.b&&(b=250,H=G=7),this.voxels[N][M][L].r=Math.floor(255*g.r),this.voxels[N][M][L].g=Math.floor(255*g.g),this.voxels[N][M][L].b=Math.floor(255*g.b),this.voxels[N][M][L].a=b,this.voxels[N][M][L].t=H,this.voxels[N][M][L].s=G}break;case 2:if(w=o.object,l.call(this.planes,w)>=0)return;switch(o.point.add(o.face.normal).divideScalar(50).floor.sub(o.face.normal).round,L=o.point.z,M=o.point.y,N=o.point.x,d(".active .editTool").data("edittool")){case 0:delete this.voxels[N][M][L],0===this.voxels[N][M].filter(function(a){return void 0!==a}).length&&delete this.voxels[N][M],0===this.voxels[N].filter(function(a){return void 0!==a}).length&&delete this.voxels[N];break;case 1:if(j=function(a,b,c){var d,e;return null!=(null!=(d=this.voxels[a])&&null!=(e=d[b])?e[c]:void 0)&&!this.voxels[a][b][c].filled&&(!i||J.r===this.voxels[a][b][c].r&&J.g===this.voxels[a][b][c].g&&J.b===this.voxels[a][b][c].b&&J.a===this.voxels[a][b][c].a&&J.t===this.voxels[a][b][c].t&&J.s===this.voxels[a][b][c].s)},f=new h.Color(d("#addVoxColor").val),t=parseFloat(d("#editVoxNoiseBright").val),u=parseFloat(d("#editVoxNoiseHSL").val),i=d("#fillSameColor").prop("checked"),b=parseInt(d("#addVoxAlpha").val),H=parseInt(d("#addVoxType").val),G=parseInt(d("#addVoxSpecular").val),0!==H&&3!==H||(b=255),0!==H&&3!==H&&(G=0),16711935===f.getHex)return;for(I=N,M,L,this.voxels[N][M][L].filled=!0,g=new h.Color;I.length>0;)y=I.pop,N=y[0],M=y[1],L=y[2],J={r:this.voxels[N][M][L].r,g:this.voxels[N][M][L].g,b:this.voxels[N][M][L].b,a:this.voxels[N][M][L].a,t:this.voxels[N][M][L].t,s:this.voxels[N][M][L].s},g=m(g.copy(f),t,u),this.voxels[N][M][L].r=Math.floor(255*g.r),this.voxels[N][M][L].g=Math.floor(255*g.g),this.voxels[N][M][L].b=Math.floor(255*g.b),1===g.r&&0===g.g&&1===g.b&&(this.voxels[N][M][L].g=1),this.voxels[N][M][L].a=b,this.voxels[N][M][L].t=H,this.voxels[N][M][L].s=G,j.call(this,N,M,L+1)&&(this.voxels[N][M][L+1].filled=!0,I.push([N,M,L+1])),j.call(this,N,M,L-1)&&(this.voxels[N][M][L-1].filled=!0,I.push([N,M,L-1])),j.call(this,N,M+1,L)&&(this.voxels[N][M+1][L].filled=!0,I.push([N,M+1,L])),j.call(this,N,M-1,L)&&(this.voxels[N][M-1][L].filled=!0,I.push([N,M-1,L])),j.call(this,N+1,M,L)&&(this.voxels[N+1][M][L].filled=!0,I.push([N+1,M,L])),j.call(this,N-1,M,L)&&(this.voxels[N-1][M][L].filled=!0,I.push([N-1,M,L]));for(N=n=0,z=this.z;z>n;N=n+=1)if(null!=this.voxels[N])for(M=r=0,A=this.y;A>r;M=r+=1)if(null!=(null!=(B=this.voxels[N])?B[M]:void 0))for(L=s=0,C=this.x;C>s;L=s+=1)null!=(null!=(D=this.voxels[N])&&null!=(E=D[M])?E[L]:void 0)&&this.voxels[N][M][L].filled&&delete this.voxels[N][M][L].filled}break;case 1:if(F=o.object,l.call(this.planes,F)>=0)return;return o.point.add(o.face.normal).divideScalar(50).floor.sub(o.face.normal).round,L=o.point.z,M=o.point.y,N=o.point.x,K=this.voxels[N][M][L],d("#addVoxColor").val("#"+new h.Color(K.r/255,K.g/255,K.b/255).getHexString),K.r===(x=K.b)&&255===x&&0===K.g?d("#addVoxColor").change:(d("#addVoxAlpha").val(K.a),d("#addVoxType").val(K.t),d("#addVoxSpecular").val(K.s),d("#addVoxColor").change)}this.reload(this.voxels,this.x,this.y,this.z,!1,!1),q={voxels:this.voxels,x:this.x,y:this.y,z:this.z},c=new e(q)["export"](!1);try{history.pushState(q,"Troxel","#m="+c)}catch(O){history.pushState(null,"Troxel","#m="+c)}return this.controls.needsRender=!0}},b.prototype.onDocumentKeyDown=function(a){if(1!==d(".active #modeView").length)switch(a.keyCode){case 18:return this.controls.enabled=!0,this.editMode=!1}},b.prototype.onDocumentKeyUp=function(a){if(1!==d(".active #modeView").length)switch(a.keyCode){case 18:return this.controls.enabled=!1,this.editMode=!0}},b}(a("14")),c.exports=f,c.exports}),a.registerDynamic("17",[],!0,function(a,b,c){"use strict";var d;return d=function{function a(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;for(this.io=a,this.type=b,this.errors=[],this.warnings=[],this.infos=[],i=this.io.computeBoundingBox,p=i[0],q=i[1],r=i[2],f=i[3],g=i[4],h=i[5],this.io.resize(p,q,r,f,g,h),r=c=0,j=this.io.z;j>c;r=c+=1)if(null!=this.io.voxels[r])for(q=d=0,k=this.io.y;k>d;q=d+=1)if(null!=this.io.voxels[r][q])for(p=e=0,l=this.io.x;l>e;p=e+=1)null!=this.io.voxels[r][q][p]&&null!=this.io.voxels[r][q][p].linter&&delete this.io.voxels[r][q][p].linter;switch(this.hasNoAlphaOnSolidVoxels,this.hasNoSpecularOnNonSolidVoxels,this.hasNoBlackVoxels,"lair"!==(m=this.type)&&"dungeon"!==m&&this.hasNoFloatingVoxels,"lair"!==(n=this.type)&&"dungeon"!==n&&"hair"!==n&&this.usesMaterialMaps,"deco"!==(o=this.type)&&"lair"!==o&&"dungeon"!==o&&this.hasExactlyOneAttachmentPoint,this.type){case"melee":this.validateMelee;break;case"gun":this.validateGun;break;case"staff":this.validateStaff;break;case"bow":this.validateBow;break;case"spear":this.validateSpear;break;case"mask":this.validateMask;break;case"hat":this.validateHat;break;case"hair":this.validateHair;break;case"deco":this.validateDeco;break;default:this.infos.push({title:"Linting lairs and dungeons not yet supported!",body:"Linting lairs and dungeons is not yet supported. Get feedback in the Trove Creations reddit!"})}}return a.prototype.hasExactlyOneAttachmentPoint=function{var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;for(a=0,l=!1,p=b=0,e=this.io.z;e>b;p=b+=1)if(null!=this.io.voxels[p])for(o=c=0,f=this.io.y;f>c;o=c+=1)if(null!=this.io.voxels[p][o])for(n=d=0,g=this.io.x;g>d;n=d+=1)null!=this.io.voxels[p][o][n]&&(m=this.io.voxels[p][o][n],(7===m.t||7===m.s||250===m.a||m.r===(h=m.b)&&255===h&&0===m.g)&&(a++,l=m.t===(i=m.s)&&7===i&&250===m.a&&m.r===(j=m.b)&&255===j&&0===m.g,this.io.voxels[p][o][n].linter=255));return 1===a?(l?(k=this.io.getAttachmentPoint,n=k[0],o=k[1],p=k[2],delete this.io.voxels[p][o][n].linter):this.errors.push({title:"Attachment point not in all material maps found!",body:"Your attachment point is only marked in some but not all material maps as a pink voxel. You need to change the voxel to a pink (255, 0, 255) voxel in all material maps!",footer:"You have to mark the attachment point with the blue wireframe in every material map as a a pink (255, 0, 255) voxel!"}),this.correctAttachmentPoint=!0):(this.correctAttachmentPoint=!1,0===a?this.errors.push({title:"No attachment point found!",body:"You need to specify an attachment point, a (255, 0, 255) = #FF00FF pink voxel, thereby your model will be aligned correctly ingame. Check out the guide for your specific creation type linked in the blue infobox below for more informations!"}):this.errors.push({title:"Multiple attachment points found!",body:"You have more the one attachment point in your model ("+a+" found). Avoid the usage of excatly pink (255, 0, 255) voxels in your model except for the attachment point in EVERY material map.",footer:"All voxels considers as an attachment point are now marked with a blue wireframe. Check all marked voxels you don't want as an attachment point for pink colors in any of the material map and recolor them accordingly!"}))},a.prototype.hasNoAlphaOnSolidVoxels=function{var a,b,c,d,e,f,g,h,i,j,k,l,m;for(i=!1,m=a=0,d=this.io.z;d>a;m=a+=1)if(null!=this.io.voxels[m])for(l=b=0,e=this.io.y;e>b;l=b+=1)if(null!=this.io.voxels[m][l])for(k=c=0,f=this.io.x;f>c;k=c+=1)null!=this.io.voxels[m][l][k]&&(j=this.io.voxels[m][l][k],0!==(g=j.t)&&3!==g||16===(h=j.a)||255===h||(i=!0,this.io.voxels[m][l][k].linter=16744192));return i?this.warnings.push({title:"Alpha material map used on a solid voxel!",body:'You have set a transparent alpha map value on a solid voxel, but transparency is only supported for all types of glass blocks. Consider checking your type map so that all voxel that should be transparent have a glass type set (or unset the alpha value from all solid voxels). Check out the Material Map Guide for more informations!', footer:"Recheck the material map of all voxels now marked with an orange wireframe!"}):void 0},a.prototype.hasNoSpecularOnNonSolidVoxels=function{var a,b,c,d,e,f,g,h,i,j,k,l,m;for(i=!1,a=!1,m=b=0,e=this.io.z;e>b;m=b+=1)if(null!=this.io.voxels[m])for(l=c=0,f=this.io.y;f>c;l=c+=1)if(null!=this.io.voxels[m][l])for(k=d=0,g=this.io.x;g>d;k=d+=1)null!=this.io.voxels[m][l][k]&&(j=this.io.voxels[m][l][k],1!==(h=j.t)&&2!==h&&4!==h||0===j.s?3===j.t&&0!==j.s&&(a=!0):(i=!0,this.io.voxels[m][l][k].linter=16776960));return i?this.warnings.push({title:"Specular material map used on non solid voxel!",body:'You have changed the specular map value on a non solid voxel, but specular values are only supported for solid voxels. Consider checking your type map so that all voxel that should have a specular value are set to solid OR change the specular map value of all non solid voxels to rough. Check out the Material Map Guide for more informations!',footer:"Recheck the material map of all voxels now marked with an yellow wireframe!"}):a?this.infos.push({title:"Specular material map usage is bugged on glowing solid voxel!",body:"Rendering specular map effects on glowing solid voxel is bugged in the current game engine. Don't rely on your specular map values other than rough having any visual effect ingame. For now using anything other than rought on glowing solid voxel is not recommended!"}):void 0},a.prototype.hasNoBlackVoxels=function{var a,b,c,d,e,f,g,h,i,j,k;for(g=null,k=a=0,d=this.io.z;d>a;k=a+=1)if(null!=this.io.voxels[k])for(j=b=0,e=this.io.y;e>b;j=b+=1)if(null!=this.io.voxels[k][j])for(i=c=0,f=this.io.x;f>c;i=c+=1)null!=this.io.voxels[k][j][i]&&(h=this.io.voxels[k][j][i],Math.min(h.r,h.g,h.b)+Math.max(h.r,h.g,h.b)<20&&(g=h,this.io.voxels[k][j][i].linter=16777215));return null!=g?this.errors.push({title:"Too dark voxel found!",body:"There shouldn't be voxels darker than (10, 10, 10) in your voxel model, but we found a voxel with ("+g.r+", "+g.g+", "+g.b+'). Try to use a (brighter) dark grey voxel instead. Check out the style guide</a> for more informations!',footer:"Increase the brightness of all voxels now marked with an white wireframe!"}):void 0},a.prototype.hasNoFloatingVoxels=function{var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;if(v=this.getStartingVoxel,null!=v){for(this.io.voxels[v[0][0]][v[0][1]][v[0][2]].checked=!0;v.length>0;)d=v.pop,y=d[0],x=d[1],w=d[2],null==(null!=(e=this.io.voxels[y])&&null!=(m=e[x])?m[w+1]:void 0)||this.io.voxels[y][x][w+1].checked||(this.io.voxels[y][x][w+1].checked=!0,v.push([y,x,w+1])),null==(null!=(n=this.io.voxels[y])&&null!=(o=n[x])?o[w-1]:void 0)||this.io.voxels[y][x][w-1].checked||(this.io.voxels[y][x][w-1].checked=!0,v.push([y,x,w-1])),null==(null!=(p=this.io.voxels[y])&&null!=(q=p[x+1])?q[w]:void 0)||this.io.voxels[y][x+1][w].checked||(this.io.voxels[y][x+1][w].checked=!0,v.push([y,x+1,w])),null==(null!=(r=this.io.voxels[y])&&null!=(s=r[x-1])?s[w]:void 0)||this.io.voxels[y][x-1][w].checked||(this.io.voxels[y][x-1][w].checked=!0,v.push([y,x-1,w])),null==(null!=(t=this.io.voxels[y+1])&&null!=(f=t[x])?f[w]:void 0)||this.io.voxels[y+1][x][w].checked||(this.io.voxels[y+1][x][w].checked=!0,v.push([y+1,x,w])),null==(null!=(g=this.io.voxels[y-1])&&null!=(h=g[x])?h[w]:void 0)||this.io.voxels[y-1][x][w].checked||(this.io.voxels[y-1][x][w].checked=!0,v.push([y-1,x,w]));for(u=!1,y=a=0,i=this.io.z;i>a;y=a+=1)if(null!=this.io.voxels[y])for(x=b=0,j=this.io.y;j>b;x=b+=1)if(null!=this.io.voxels[y][x])for(w=c=0,k=this.io.x;k>c;w=c+=1)null!=this.io.voxels[y][x][w]&&(this.io.voxels[y][x][w].checked?delete this.io.voxels[y][x][w].checked:(7!==this.io.voxels[y][x][w].t||"hair"!==(l=this.type)&&"hat"!==l&&"mask"!==l)&&(u=!0,this.io.voxels[y][x][w].linter=65535));return u?this.warnings.push({title:"Your model has floating/corner-connected voxels!",body:'There are voxels in your model, which are not directly connected to other voxels (in some cases caused by a unnecessary hole). Read more about voxel placements in the sytle guides</a>. There will be only a few exceptions where models with floating/corner-connected voxels will be accepted. Try to avoid them! You will get feedback if this is the case for you in the submission process on the Trove Creations subreddit.',footer:"All voxels marked with an cyan wireframe are not connected to the unmarked voxels. Try to connect them together (adding very transparent voxels doesn't count)!"}):void 0}},a.prototype.getStartingVoxel=function{var a,b,c,d,e,f,g,h,i,j;for(j=a=0,d=this.io.z;d>a;j=a+=1)if(null!=this.io.voxels[j])for(i=b=0,e=this.io.y;e>b;i=b+=1)if(null!=this.io.voxels[j][i])for(h=c=0,f=this.io.x;f>c;h=c+=1)if(null!=this.io.voxels[j][i][h]&&(7!==this.io.voxels[j][i][h].t||"hair"!==(g=this.type)&&"hat"!==g&&"mask"!==g))returnj,i,h},a.prototype.usesMaterialMaps=function{var a,b,c,d,e,f,g,h,i;for(i=a=0,d=this.io.z;d>a;i=a+=1)if(null!=this.io.voxels[i])for(h=b=0,e=this.io.y;e>b;h=b+=1)if(null!=this.io.voxels[i][h])for(g=c=0,f=this.io.x;f>c;g=c+=1)if(null!=this.io.voxels[i][h][g]&&(this.io.voxels[i][h][g].t>0||this.io.voxels[i][h][g].s>0)&&7!==this.io.voxels[i][h][g].t)return;return this.infos.push({title:"Material maps not used!",body:'It looks like you haven\'t used any material maps in your voxel model. If you arent yet familiar with them, check out the Material Map Guide</a> for more informations on how you could make voxel look more metallic or like transparent glass for example. You should use them where suitable in your model!'})},a.prototype.validateMelee=function{var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;if(this.io.x>10||this.io.y>10||this.io.z>35){if(this.io.z<=10&&(this.io.x<=35&&this.io.y<=10||this.io.x<=10&&this.io.y<=35))return this.errors.push({title:"Incorrect melee weapon model orientation!",body:"Your melee weapon model is incorrectly oriantated and will be thereby held in a wrong direction ingame. Rotate it so that the tip of your weapon is facing the front! Don't forget to fix this in your local files too before creating and submitting the .blueprint."});this.errors.push({title:"Incorrect melee weapon model dimensions!",body:"A melee weapon model should not exceed 10x10x35 voxels, but yours is "+this.io.x+"x"+this.io.y+"x"+this.io.z+'. Check out the melee weapon creation guide</a> for more informations!'})}if(this.correctAttachmentPoint){for(g=this.io.getAttachmentPoint,a=g[0],b=g[1],c=g[2],(b>4||this.io.y-b>6)&&this.warnings.push({title:"Incorrect attachment point height!",body:"There shouldn't be voxels higher than 5 voxel above or lower than 4 voxels below the attachment point! But in your melee weapon model there are up to "+(this.io.y-b-1)+" voxel above and "+b+' voxels below the attachment point. Check out the melee weapon creation guide</a> for more informations!'}),r=!1,u=d=h=c-1,j=c+1;j>=d;u=d+=1)for(t=e=k=b-1,l=b+1;l>=e;t=e+=1)for(s=f=m=a-1,n=a+1;n>=f;s=f+=1)s===a&&t===b?null==(null!=(o=this.io.voxels[u])&&null!=(p=o[t])?p[s]:void 0)&&(r=!0):null!=(null!=(q=this.io.voxels[u])&&null!=(i=q[t])?i[s]:void 0)&&(r=!0,this.io.voxels[u][t][s].linter=16711680);return r?this.warnings.push({title:"Incorrect attachment point surrounding / handle!",body:'Around the attachment point there should be only one voxel on either side lengthwise and nothing else in a 3x3x3 cube around the attachment point. Check out the melee weapon creation guide</a> for more informations!',footer:"You have to remove all overlaying voxels now marked with a red wireframe!"}):void 0}},a.prototype.validateGun=function{var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;if(this.io.x>5||this.io.y>12||this.io.z>5){if(this.io.y<=5&&(this.io.x<=12&&this.io.z<=5||this.io.x<=5&&this.io.z<=12))return this.errors.push({title:"Incorrect gun weapon model orientation!",body:'Your gun weapon model is incorrectly oriantated and will be thereby held in a wrong direction ingame. Rotate it so that the muzzle is facing down! Check out the gun weapon creation guide</a> for more informations! Don\'t forget to fix this in your local files too before creating and submitting the .blueprint.'});this.errors.push({title:"Incorrect gun weapon model dimensions!",body:"A gun weapon model should not exceed 5x12x5 voxels, but yours is "+this.io.x+"x"+this.io.y+"x"+this.io.z+'. Check out the gun weapon creation guide</a> for more informations!'})}if(this.correctAttachmentPoint){for(g=this.io.getAttachmentPoint,a=g[0],b=g[1],c=g[2],0!==c&&this.warnings.push({title:"Incorrect attachment point location!",body:'There shouldn\'t be voxels behind the attachment point. Check out the gun weapon creation guide</a> for more informations! Exceptions may be made for guns which are designed to be worn like a glove.'}),r=!1,u=d=h=c-1,j=c+1;j>=d;u=d+=1)for(t=e=k=b-1,l=b+1;l>=e;t=e+=1)for(s=f=m=a-1,n=a+1;n>=f;s=f+=1)s===a&&t===b&&u>=c?null==(null!=(o=this.io.voxels[u])&&null!=(p=o[t])?p[s]:void 0)&&(r=!0):null!=(null!=(q=this.io.voxels[u])&&null!=(i=q[t])?i[s]:void 0)&&(r=!0,this.io.voxels[u][t][s].linter=16711680);return r?this.warnings.push({title:"Incorrect attachment point surrounding / handle!",body:'Around the attachment point there should be only one voxel to the front and nothing else in a 3x3x3 cube around the attachment point. Check out the gun weapon creation guide</a> for more informations! Exceptions may be made for guns which are designed to be worn like a glove.',footer:"You have to remove all overlaying voxels now marked with a red wireframe!"}):void 0}},a.prototype.validateStaff=function{var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;if(this.io.x>12||this.io.y>12||this.io.z>35){if(this.io.z<=12&&(this.io.x<=35&&this.io.y<=12||this.io.x<=12&&this.io.y<=35))return this.errors.push({title:"Incorrect staff weapon model orientation!",body:"Your staff weapon model is incorrectly oriantated and will be thereby held in a wrong direction ingame. Rotate it so that the tip of your weapon is facing the front! Don't forget to fix this in your local files too before creating and submitting the .blueprint."});this.errors.push({title:"Incorrect staff weapon model dimensions!",body:"A staff weapon model should not exceed 12x12x35 voxels, but yours is "+this.io.x+"x"+this.io.y+"x"+this.io.z+'. Check out the staff weapon creation guide</a> for more informations!'})}if(this.correctAttachmentPoint){for(g=this.io.getAttachmentPoint,a=g[0],b=g[1],c=g[2],(8>c||c>14)&&this.warnings.push({title:"Incorrect attachment point location!",body:"The handle of the staff befind the attachment point must have a length between 8 and 14 voxels (your handle length: "+c+'). Check out the staff weapon creation guide</a> for more informations!'}),this.io.z-c<17&&this.warnings.push({title:"Incorrect attachment point location!",body:"There must be at least 16 voxels between attachment point and the tip of your staff (your distance: "+(this.io.z-c-1)+'). Check out the staff weapon creation guide</a> for more informations!'}),r=!1,u=d=h=c-1,j=c+1;j>=d;u=d+=1)for(t=e=k=b-1,l=b+1;l>=e;t=e+=1)for(s=f=m=a-1,n=a+1;n>=f;s=f+=1)s===a&&t===b?null==(null!=(o=this.io.voxels[u])&&null!=(p=o[t])?p[s]:void 0)&&(r=!0):null!=(null!=(q=this.io.voxels[u])&&null!=(i=q[t])?i[s]:void 0)&&(r=!0,this.io.voxels[u][t][s].linter=16711680);return r?this.warnings.push({title:"Incorrect attachment point surrounding / handle!",body:'Around the attachment point there should be only one voxel on either side lengthwise and nothing else in a 3x3x3 cube around the attachment point. Check out the staff weapon creation guide</a> for more informations!',footer:"You have to remove all overlaying voxels now marked with a red wireframe!"}):void 0}},a.prototype.validateBow=function{var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;if(this.io.x>3||this.io.y>9||this.io.z>21){if(this.io.z<=9&&(this.io.x<=21&&this.io.y<=9||this.io.x<=9&&this.io.y<=21))return this.errors.push({title:"Incorrect bow weapon model orientation!",body:"You bow weapon model is incorrectly oriantated and will be thereby held in a wrong direction ingame. Rotate it so that the bowstring goes from back to front! Don't forget to fix this in your local files too before creating and submitting the .blueprint."});this.io.x<=5&&this.io.y<=9&&this.io.z<=21?this.warnings.push({title:"Bow model dimensions does not follow guidelines!",body:'Your bow weapon model is more than the allowed 3 voxel thick. Try to reduce the thickness if you can, but if the 5 voxels tickness is really required for your bow and does make sense, go ahead add submit it to get feedback if it can stay this way. Check out the bow weapon creation guide</a> for more informations!'}):this.errors.push({title:"Incorrect bow model dimensions!",body:"A bow weapon model should not exceed 3x9x21 voxels, but yours is "+this.io.x+"x"+this.io.y+"x"+this.io.z+'. Check out the bow weapon creation guide</a> for more informations!'})}if(this.correctAttachmentPoint){for(g=this.io.getAttachmentPoint,a=g[0],b=g[1],c=g[2],(b>3||this.io.y-b>6)&&this.warnings.push({title:"Incorrect attachment point height!",body:"There shouldn't be voxels higher than 5 voxel above or lower than 3 voxels below the attachment point. But in your bow model there are up to "+(this.io.y-b-1)+" voxel above and "+b+' voxels below the attachment point. Check out the <a href="http://trove.wikia.com/wiki/Bow_Creation_Guide#Basic_Dimensions" class="alert-link" target="_blank">bow weapon creation guide</a> for more informations!'}),r=!1,u=d=h=c-1,j=c+1;j>=d;u=d+=1)for(t=e=k=b-1,l=b+1;l>=e;t=e+=1)for(s=f=m=a-1,n=a+1;n>=f;s=f+=1)s===a&&t===b?null==(null!=(o=this.io.voxels[u])&&null!=(p=o[t])?p[s]:void 0)&&(r=!0):null!=(null!=(q=this.io.voxels[u])&&null!=(i=q[t])?i[s]:void 0)&&(r=!0,this.io.voxels[u][t][s].linter=16711680);return r?this.warnings.push({title:"Incorrect attachment point surrounding / handle!",body:'Around the attachment point there should be only one voxel on either side lengthwise and nothing else in a 3x3x3 cube around the attachment point. Check out the <a href="http://trove.wikia.com/wiki/Bow_Creation_Guide#Other_details" class="alert-link" target="_blank">bow weapon creation guide</a> for more informations!',footer:"You have to remove all overlaying voxels now marked with a red wireframe!"}):void 0}},a.prototype.validateSpear=function{var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;if(this.io.x>11||this.io.y>11||this.io.z>45){if(this.io.z<=11&&(this.io.x<=45&&this.io.y<=11||this.io.x<=11&&this.io.y<=45))return this.errors.push({title:"Incorrect spear weapon model orientation!",body:"Your spear weapon model is incorrectly oriantated and will be thereby held in a wrong direction ingame. Rotate it so that the tip/head of your weapon is facing the front! Don't forget to fix this in your local files too before creating and submitting the .blueprint."});this.errors.push({title:"Incorrect spear weapon model dimensions!",body:"A spear weapon model should not exceed 11x11x45 voxels, but yours is "+this.io.x+"x"+this.io.y+"x"+this.io.z+'. Check out the <a href="http://trove.wikia.com/wiki/Spear_Creation_Guide#Weapon_Dimensions" class="alert-link" target="_blank">spear weapon creation guide</a> for more informations!'})}if(this.io.z<45&&this.errors.push({title:"Incorrect spear weapon model length!",body:"A spear weapon model should be exactly 45 voxels long, but yours is only "+this.io.z+' voxel long. Check out the <a href="http://trove.wikia.com/wiki/Spear_Creation_Guide#Weapon_Dimensions" class="alert-link" target="_blank">spear weapon creation guide</a> for more informations!'}),this.correctAttachmentPoint){for(j=this.io.getAttachmentPoint,a=j[0],b=j[1],c=j[2],(8>c||c>12)&&this.errors.push({title:"Incorrect attachment point position!",body:"The attachment point in the shaft of the spear should be between 9 and 13 voxel away (including the attachment point) from the bottom of the spear (or 6 to 10 from the 3x3 base), but yours is "+(c+1)+" (or "+(c-2)+') voxel away. Check out the <a href="http://trove.wikia.com/wiki/Spear_Creation_Guide#Weapon_Dimensions" class="alert-link" target="_blank">spear creation guide</a> for more informations!'}),o=!1,r=d=0;2>d;r=d+=1)if(null!=this.io.voxels[r])for(q=e=0,k=this.io.y;k>e;q=e+=1)if(null!=this.io.voxels[r][q])for(p=f=0,l=this.io.x;l>f;p=f+=1)null!=this.io.voxels[r][q][p]&&(p>a+1||a-1>p||q>b+1||b-1>q)&&(o=!0,this.io.voxels[r][q][p].linter=16711680);for(o&&this.errors.push({title:"Incorrect spear base!",body:'The spear base should fit in a 3x3x3 area with the shaft connected in the center of the base. Check out the <a href="http://trove.wikia.com/wiki/Spear_Creation_Guide#Weapon_Dimensions" class="alert-link" target="_blank">spear creation guide</a> for more informations!',footer:"You have to remove all overlaying voxels now marked with a red wireframe!"}),o=!1,s=31,r=g=3;30>g;r=g+=1)if(null!=this.io.voxels[r])for(q=h=0,m=this.io.y;m>h;q=h+=1)if(null!=this.io.voxels[r][q])for(p=i=0,n=this.io.x;n>i;p=i+=1)null==this.io.voxels[r][q][p]||p===a&&q===b||(o=!0,s=Math.min(s,r),this.io.voxels[r][q][p].linter=16711680);return o?this.errors.push({title:"Incorrect spear shaft or too long spear head/base!",body:"The spear shaft should only be 1 voxel thick and 27 voxels long and connect the (3 voxel long) spear base with the 15 voxel long spear head. But your spear head is either "+(this.io.z-s)+' voxel long or your spear shaft is too thick. Check out the <a href="http://trove.wikia.com/wiki/Spear_Creation_Guide#Weapon_Dimensions" class="alert-link" target="_blank">spear creation guide</a> for more informations!',footer:"You have to either fix your spear shaft/base length or remove all overlaying voxels now marked with a red wireframe!"}):void 0}},a.prototype.validateMask=function{var a,b,c,d,e,f,g,h,i,j,k,l,m;if((this.io.x>10||this.io.y>10)&&this.errors.push({title:"Incorrect mask model dimensions!",body:"A mask model should not exceed 10x10x5 voxels, but yours is "+this.io.x+"x"+this.io.y+"x"+(this.io.z-6)+'. Check out the <a href="http://trove.wikia.com/wiki/Mask_creation#Item_dimensions" class="alert-link" target="_blank">mask creation guide</a> for more informations!'}),this.io.z>11&&this.warnings.push({title:"Very special mask model depth!",body:"There will be only a few exceptions where mask with a depth greater than 5 will be accepted (your depth: "+(this.io.z-6)+'). You will get feedback if this is the case for you in the submission process and Trove Creations reddit. Check out the <a href="http://trove.wikia.com/wiki/Mask_creation#Item_dimensions" class="alert-link" target="_blank">mask creation guide</a> for more informations!'}),this.correctAttachmentPoint){if(g=this.io.getAttachmentPoint,a=g[0],b=g[1],c=g[2],0!==c)return this.errors.push({title:"Incorrect mask model orientation!",body:"You mask model is incorrectly oriantated and will be thereby not weared correctly ingame. Rotate it so that it is facing the front! Don't forget to fix this in your local files too before creating and submitting the .blueprint."});for((a>5||this.io.x-a>5||b>4||this.io.y-b>6)&&this.errors.push({title:"Incorrect attachment point position!",body:"There shouldn't be more than 5 voxels to the right ("+a+"), 4 to the left ("+(this.io.x-a-1)+"), 5 above ("+(this.io.y-b-1)+") and 4 below ("+b+') the attachment point (your models distances are in the brackest). Check out the <a href="http://trove.wikia.com/wiki/Mask_creation#Head_attachment" class="alert-link" target="_blank">mask creation guide</a> on the wiki for are more in depth attachment point position guide.'}),m=6,l=d=0;5>=d;l=d+=1)if(null!=this.io.voxels[l])for(k=e=0,h=this.io.y;h>e;k=e+=1)if(null!=this.io.voxels[l][k])for(j=f=0,i=this.io.x;i>f;j=f+=1)null!=this.io.voxels[l][k][j]&&7!==this.io.voxels[l][k][j].t&&(m=Math.min(m,l),this.io.voxels[l][k][j].linter=16711680);return 6>m?this.errors.push({title:"Incorrect attachment point position!",body:'The attachment point should be 6 voxels behind the mask and there shouldn\'t be any voxels behind this distance. Check out the <a href="http://trove.wikia.com/wiki/Mask_creation#Head_attachment" class="alert-link" target="_blank">mask creation guide</a> for more informations! (minimal distance to the mask was '+m+" instead of 6 voxels)",footer:"You have to either reposition your attachment point or remove all overlaying voxels now marked with a red wireframe!"}):void 0}},a.prototype.validateHat=function{var a,b,c,d,e,f,g,h,i,j,k,l,m;if((this.io.x>20||this.io.y>20||this.io.z>20)&&this.errors.push({title:"Incorrect hat model dimensions!",body:"A hat model should not exceed 20x14x20 voxels, but yours is "+this.io.x+"x"+(this.io.y-6)+"x"+this.io.z+'. Check out the <a href="http://trove.wikia.com/wiki/Hat_creation#Item_dimensions" class="alert-link" target="_blank">hat creation guide</a> for more informations!'}),this.correctAttachmentPoint){if(g=this.io.getAttachmentPoint,a=g[0],b=g[1],c=g[2],0!==b)return this.errors.push({title:"Incorrect hat model orientation!",body:"You hat model is incorrectly oriantated and will be thereby not weared correctly ingame. Rotate it so that top of the hat is facing up! Don't forget to fix this in your local files too before creating and submitting the .blueprint."});for((a>10||this.io.x-a>10||c>9||this.io.z-c>11)&&this.errors.push({title:"Incorrect attachment point position!",body:"There shouldn't be more than 10 voxels to the right ("+a+"), 9 to the left ("+(this.io.x-a-1)+"), 10 in front of ("+(this.io.z-c-1)+") and 9 behind ("+c+') the attachment point (your models distances are in the brackest). Check out the <a href="http://trove.wikia.com/wiki/Hat_creation#Head_attachment" class="alert-link" target="_blank">hat creation guide</a> on the wiki for are more in depth attachment point position guide.'}),l=6,m=d=0,h=this.io.z;h>d;m=d+=1)if(null!=this.io.voxels[m])for(k=e=0;5>=e;k=e+=1)if(null!=this.io.voxels[m][k])for(j=f=0,i=this.io.x;i>f;j=f+=1)null!=this.io.voxels[m][k][j]&&7!==this.io.voxels[m][k][j].t&&(l=Math.min(l,k),this.io.voxels[m][k][j].linter=16711680);return 6>l?this.errors.push({title:"Incorrect attachment point position!",body:'The attachment point should be 6 voxels below the hat and there shouldn\'t be any voxels below this distance. Check out the <a href="http://trove.wikia.com/wiki/Hat_creation#Head_attachment" class="alert-link" target="_blank">hat creation guide</a> for more informations! (minimal distance to the hat was '+l+" instead of 6 voxels)",footer:"You have to either reposition your attachment point or remove all overlaying voxels now marked with a red wireframe!"}):void 0}},a.prototype.validateHair=function{var a,b,c,d;return(this.io.x>20||this.io.y>20||this.io.z>20)&&this.errors.push({title:"Incorrect hat model dimensions!",body:"A hair model should not exceed 20x14x20 voxels, but yours is "+this.io.x+"x"+(this.io.y-6)+"x"+this.io.z+'. Check out the <a href="http://trove.wikia.com/wiki/Hair_creation#Item_dimensions" class="alert-link" target="_blank">hair creation guide</a> for more informations!'}),this.correctAttachmentPoint?(d=this.io.getAttachmentPoint,a=d[0],b=d[1],c=d[2],a>10||this.io.x-a>10||c>9||this.io.z-c>11||b>8||this.io.y-b>12?this.errors.push({title:"Incorrect attachment point position!",body:'Check the <a href="http://trove.wikia.com/wiki/Hair_creation#Head_attachment" class="alert-link" target="_blank">hair creation guide</a> on the wiki for it\'s correct position.'}):void 0):void 0},a.prototype.validateDeco=function{return this.io.x>12||this.io.y>12||this.io.z>12?this.errors.push({title:"Incorrect decoration model dimensions!",body:"A decorations model should not exceed 12x12x12 voxels, but yours is "+this.io.x+"x"+this.io.y+"x"+this.io.z+'. Check out the <a href="http://trove.wikia.com/wiki/Cornerstone_decoration_creation" class="alert-link" target="_blank">decoration creation guide</a> for more informations!'}):void 0},a},c.exports=d,c.exports}),a.registerDynamic("c",[],!1,function(b,c,d){var e=a.get("@@global-helpers").prepareGlobal(d.id,"THREE",null);return function{var a=this.THREE,a={REVISION:"71"};"object"==typeof module&&(module.exports=a),void 0===Math.sign&&(Math.sign=function(a){return 0>a?-1:a>0?1:+a}),a.log=function{console.log.apply(console,arguments)},a.warn=function{console.warn.apply(console,arguments)},a.error=function{console.error.apply(console,arguments)},a.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},a.CullFaceNone=0,a.CullFaceBack=1,a.CullFaceFront=2,a.CullFaceFrontBack=3,a.FrontFaceDirectionCW=0,a.FrontFaceDirectionCCW=1,a.BasicShadowMap=0,a.PCFShadowMap=1,a.PCFSoftShadowMap=2,a.FrontSide=0,a.BackSide=1,a.DoubleSide=2,a.NoShading=0,a.FlatShading=1,a.SmoothShading=2,a.NoColors=0,a.FaceColors=1,a.VertexColors=2,a.NoBlending=0,a.NormalBlending=1,a.AdditiveBlending=2,a.SubtractiveBlending=3,a.MultiplyBlending=4,a.CustomBlending=5,a.AddEquation=100,a.SubtractEquation=101,a.ReverseSubtractEquation=102,a.MinEquation=103,a.MaxEquation=104,a.ZeroFactor=200,a.OneFactor=201,a.SrcColorFactor=202,a.OneMinusSrcColorFactor=203,a.SrcAlphaFactor=204,a.OneMinusSrcAlphaFactor=205,a.DstAlphaFactor=206,a.OneMinusDstAlphaFactor=207,a.DstColorFactor=208,a.OneMinusDstColorFactor=209,a.SrcAlphaSaturateFactor=210,a.MultiplyOperation=0,a.MixOperation=1,a.AddOperation=2,a.UVMapping=300,a.CubeReflectionMapping=301,a.CubeRefractionMapping=302,a.EquirectangularReflectionMapping=303,a.EquirectangularRefractionMapping=304,a.SphericalReflectionMapping=305,a.RepeatWrapping=1e3,a.ClampToEdgeWrapping=1001,a.MirroredRepeatWrapping=1002,a.NearestFilter=1003,a.NearestMipMapNearestFilter=1004,a.NearestMipMapLinearFilter=1005,a.LinearFilter=1006,a.LinearMipMapNearestFilter=1007,a.LinearMipMapLinearFilter=1008,a.UnsignedByteType=1009,a.ByteType=1010,a.ShortType=1011,a.UnsignedShortType=1012,a.IntType=1013,a.UnsignedIntType=1014,a.FloatType=1015,a.HalfFloatType=1025,a.UnsignedShort4444Type=1016,a.UnsignedShort5551Type=1017,a.UnsignedShort565Type=1018,a.AlphaFormat=1019,a.RGBFormat=1020,a.RGBAFormat=1021,a.LuminanceFormat=1022,a.LuminanceAlphaFormat=1023,a.RGBEFormat=a.RGBAFormat,a.RGB_S3TC_DXT1_Format=2001,a.RGBA_S3TC_DXT1_Format=2002,a.RGBA_S3TC_DXT3_Format=2003,a.RGBA_S3TC_DXT5_Format=2004,a.RGB_PVRTC_4BPPV1_Format=2100,a.RGB_PVRTC_2BPPV1_Format=2101,a.RGBA_PVRTC_4BPPV1_Format=2102,a.RGBA_PVRTC_2BPPV1_Format=2103,a.Projector=function{a.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(b,c){a.warn("THREE.Projector: .projectVector is now vector.project."),b.project(c)},this.unprojectVector=function(b,c){a.warn("THREE.Projector: .unprojectVector is now vector.unproject."),b.unproject(c)},this.pickingRay=function(b,c){a.error("THREE.Projector: .pickingRay is now raycaster.setFromCamera.")}},a.CanvasRenderer=function{a.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElement("canvas"),this.clear=function{},this.render=function{},this.setClearColor=function{},this.setSize=function{}},a.Color=function(a){return 3===arguments.length?this.setRGB(arguments[0],arguments[1],arguments[2]):this.set(a)},a.Color.prototype={constructor:a.Color,r:1,g:1,b:1,set:function(b){return b instanceof a.Color?this.copy(b):"number"==typeof b?this.setHex(b):"string"==typeof b&&this.setStyle(b),this},setHex:function(a){return a=Math.floor(a),this.r=(a>>16&255)/255,this.g=(a>>8&255)/255,this.b=(255&a)/255,this},setRGB:function(a,b,c){return this.r=a,this.g=b,this.b=c,this},setHSL:function(a,b,c){if(0===b)this.r=this.g=this.b=c;else{var d=function(a,b,c){return 0>c&&(c+=1),c>1&&(c-=1),1/6>c?a+6*(b-a)*c:.5>c?b:2/3>c?a+6*(b-a)*(2/3-c):a},e=.5>=c?c*(1+b):c+b-c*b,f=2*c-e;this.r=d(f,e,a+1/3),this.g=d(f,e,a),this.b=d(f,e,a-1/3)}return this},setStyle:function(b){if(/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test(b)){var c=/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec(b);return this.r=Math.min(255,parseInt(c[1],10))/255,this.g=Math.min(255,parseInt(c[2],10))/255,this.b=Math.min(255,parseInt(c[3],10))/255,this}if(/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test(b)){var c=/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec(b);return this.r=Math.min(100,parseInt(c[1],10))/100,this.g=Math.min(100,parseInt(c[2],10))/100,this.b=Math.min(100,parseInt(c[3],10))/100,this}if(/^\#([0-9a-f]{6})$/i.test(b)){var c=/^\#([0-9a-f]{6})$/i.exec(b);return this.setHex(parseInt(c[1],16)),this}if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(b)){var c=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(b);return this.setHex(parseInt(c[1]+c[1]+c[2]+c[2]+c[3]+c[3],16)),this}return/^(\w+)$/i.test(b)?(this.setHex(a.ColorKeywords[b]),this):void 0},copy:function(a){return this.r=a.r,this.g=a.g,this.b=a.b,this},copyGammaToLinear:function(a,b){return void 0===b&&(b=2),this.r=Math.pow(a.r,b),this.g=Math.pow(a.g,b),this.b=Math.pow(a.b,b),this},copyLinearToGamma:function(a,b){void 0===b&&(b=2);var c=b>0?1/b:1;return this.r=Math.pow(a.r,c),this.g=Math.pow(a.g,c),this.b=Math.pow(a.b,c),this},convertGammaToLinear:function{var a=this.r,b=this.g,c=this.b;return this.r=a*a,this.g=b*b,this.b=c*c,this},convertLinearToGamma:function{return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),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){var b,c,d=a||{h:0,s:0,l:0},e=this.r,f=this.g,g=this.b,h=Math.max(e,f,g),i=Math.min(e,f,g),j=(i+h)/2;if(i===h)b=0,c=0;else{var k=h-i;switch(c=.5>=j?k/(h+i):k/(2-h-i),h){case e:b=(f-g)/k+(g>f?6:0);break;case f:b=(g-e)/k+2;break;case g:b=(e-f)/k+4}b/=6}return d.h=b,d.s=c,d.l=j,d},getStyle:function{return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(a,b,c){var d=this.getHSL;return d.h+=a,d.s+=b,d.l+=c,this.setHSL(d.h,d.s,d.l),this},add:function(a){return this.r+=a.r,this.g+=a.g,this.b+=a.b,this},addColors:function(a,b){return this.r=a.r+b.r,this.g=a.g+b.g,this.b=a.b+b.b,this},addScalar:function(a){return this.r+=a,this.g+=a,this.b+=a,this},multiply:function(a){return this.r*=a.r,this.g*=a.g,this.b*=a.b,this},multiplyScalar:function(a){return this.r*=a, this.g*=a,this.b*=a,this},lerp:function(a,b){return this.r+=(a.r-this.r)*b,this.g+=(a.g-this.g)*b,this.b+=(a.b-this.b)*b,this},equals:function(a){return a.r===this.r&&a.g===this.g&&a.b===this.b},fromArray:function(a){return this.r=a[0],this.g=a[1],this.b=a[2],this},toArray:function(a,b){return void 0===a&&(a=[]),void 0===b&&(b=0),a[b]=this.r,a[b+1]=this.g,a[b+2]=this.b,a},clone:function{return(new a.Color).setRGB(this.r,this.g,this.b)}},a.ColorKeywords={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,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},a.Quaternion=function(a,b,c,d){this._x=a||0,this._y=b||0,this._z=c||0,this._w=void 0!==d?d:1},a.Quaternion.prototype={constructor:a.Quaternion,_x:0,_y:0,_z:0,_w:0,get x{return this._x},set x(a){this._x=a,this.onChangeCallback},get y{return this._y},set y(a){this._y=a,this.onChangeCallback},get z{return this._z},set z(a){this._z=a,this.onChangeCallback},get w{return this._w},set w(a){this._w=a,this.onChangeCallback},set:function(a,b,c,d){return this._x=a,this._y=b,this._z=c,this._w=d,this.onChangeCallback,this},copy:function(a){return this._x=a.x,this._y=a.y,this._z=a.z,this._w=a.w,this.onChangeCallback,this},setFromEuler:function(b,c){if(b instanceof a.Euler==!1)throw new Error("THREE.Quaternion: .setFromEuler now expects a Euler rotation rather than a Vector3 and order.");var d=Math.cos(b._x/2),e=Math.cos(b._y/2),f=Math.cos(b._z/2),g=Math.sin(b._x/2),h=Math.sin(b._y/2),i=Math.sin(b._z/2);return"XYZ"===b.order?(this._x=g*e*f+d*h*i,this._y=d*h*f-g*e*i,this._z=d*e*i+g*h*f,this._w=d*e*f-g*h*i):"YXZ"===b.order?(this._x=g*e*f+d*h*i,this._y=d*h*f-g*e*i,this._z=d*e*i-g*h*f,this._w=d*e*f+g*h*i):"ZXY"===b.order?(this._x=g*e*f-d*h*i,this._y=d*h*f+g*e*i,this._z=d*e*i+g*h*f,this._w=d*e*f-g*h*i):"ZYX"===b.order?(this._x=g*e*f-d*h*i,this._y=d*h*f+g*e*i,this._z=d*e*i-g*h*f,this._w=d*e*f+g*h*i):"YZX"===b.order?(this._x=g*e*f+d*h*i,this._y=d*h*f+g*e*i,this._z=d*e*i-g*h*f,this._w=d*e*f-g*h*i):"XZY"===b.order&&(this._x=g*e*f-d*h*i,this._y=d*h*f-g*e*i,this._z=d*e*i+g*h*f,this._w=d*e*f+g*h*i),c!==!1&&this.onChangeCallback,this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);return this._x=a.x*d,this._y=a.y*d,this._z=a.z*d,this._w=Math.cos(c),this.onChangeCallback,this},setFromRotationMatrix:function(a){var b,c=a.elements,d=c[0],e=c[4],f=c[8],g=c[1],h=c[5],i=c[9],j=c[2],k=c[6],l=c[10],m=d+h+l;return m>0?(b=.5/Math.sqrt(m+1),this._w=.25/b,this._x=(k-i)*b,this._y=(f-j)*b,this._z=(g-e)*b):d>h&&d>l?(b=2*Math.sqrt(1+d-h-l),this._w=(k-i)/b,this._x=.25*b,this._y=(e+g)/b,this._z=(f+j)/b):h>l?(b=2*Math.sqrt(1+h-d-l),this._w=(f-j)/b,this._x=(e+g)/b,this._y=.25*b,this._z=(i+k)/b):(b=2*Math.sqrt(1+l-d-h),this._w=(g-e)/b,this._x=(f+j)/b,this._y=(i+k)/b,this._z=.25*b),this.onChangeCallback,this},setFromUnitVectors:function{var b,c,d=1e-6;return function(e,f){return void 0===b&&(b=new a.Vector3),c=e.dot(f)+1,d>c?(c=0,Math.abs(e.x)>Math.abs(e.z)?b.set(-e.y,e.x,0):b.set(0,-e.z,e.y)):b.crossVectors(e,f),this._x=b.x,this._y=b.y,this._z=b.z,this._w=c,this.normalize,this}},inverse:function{return this.conjugate.normalize,this},conjugate:function{return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback,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;return 0===a?(this._x=0,this._y=0,this._z=0,this._w=1):(a=1/a,this._x=this._x*a,this._y=this._y*a,this._z=this._z*a,this._w=this._w*a),this.onChangeCallback,this},multiply:function(b,c){return void 0!==c?(a.warn("THREE.Quaternion: .multiply now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(b,c)):this.multiplyQuaternions(this,b)},multiplyQuaternions:function(a,b){var c=a._x,d=a._y,e=a._z,f=a._w,g=b._x,h=b._y,i=b._z,j=b._w;return this._x=c*j+f*g+d*i-e*h,this._y=d*j+f*h+e*g-c*i,this._z=e*j+f*i+c*h-d*g,this._w=f*j-c*g-d*h-e*i,this.onChangeCallback,this},multiplyVector3:function(b){return a.warn("THREE.Quaternion: .multiplyVector3 has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),b.applyQuaternion(this)},slerp:function(a,b){if(0===b)return this;if(1===b)return this.copy(a);var c=this._x,d=this._y,e=this._z,f=this._w,g=f*a._w+c*a._x+d*a._y+e*a._z;if(0>g?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,g=-g):this.copy(a),g>=1)return this._w=f,this._x=c,this._y=d,this._z=e,this;var h=Math.acos(g),i=Math.sqrt(1-g*g);if(Math.abs(i)<.001)return this._w=.5*(f+this._w),this._x=.5*(c+this._x),this._y=.5*(d+this._y),this._z=.5*(e+this._z),this;var j=Math.sin((1-b)*h)/i,k=Math.sin(b*h)/i;return this._w=f*j+this._w*k,this._x=c*j+this._x*k,this._y=d*j+this._y*k,this._z=e*j+this._z*k,this.onChangeCallback,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){return 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,this},toArray:function(a,b){return 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,a},onChange:function(a){return this.onChangeCallback=a,this},onChangeCallback:function{},clone:function{return new a.Quaternion(this._x,this._y,this._z,this._w)}},a.Quaternion.slerp=function(a,b,c,d){return c.copy(a).slerp(b,d)},a.Vector2=function(a,b){this.x=a||0,this.y=b||0},a.Vector2.prototype={constructor:a.Vector2,set:function(a,b){return this.x=a,this.y=b,this},setX:function(a){return this.x=a,this},setY:function(a){return this.y=a,this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw new Error("index is out of range: "+a)}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+a)}},copy:function(a){return this.x=a.x,this.y=a.y,this},add:function(b,c){return void 0!==c?(a.warn("THREE.Vector2: .add now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(b,c)):(this.x+=b.x,this.y+=b.y,this)},addScalar:function(a){return this.x+=a,this.y+=a,this},addVectors:function(a,b){return this.x=a.x+b.x,this.y=a.y+b.y,this},sub:function(b,c){return void 0!==c?(a.warn("THREE.Vector2: .sub now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(b,c)):(this.x-=b.x,this.y-=b.y,this)},subScalar:function(a){return this.x-=a,this.y-=a,this},subVectors:function(a,b){return this.x=a.x-b.x,this.y=a.y-b.y,this},multiply:function(a){return this.x*=a.x,this.y*=a.y,this},multiplyScalar:function(a){return this.x*=a,this.y*=a,this},divide:function(a){return this.x/=a.x,this.y/=a.y,this},divideScalar:function(a){if(0!==a){var b=1/a;this.x*=b,this.y*=b}else this.x=0,this.y=0;return this},min:function(a){return this.x>a.x&&(this.x=a.x),this.y>a.y&&(this.y=a.y),this},max:function(a){return this.x<a.x&&(this.x=a.x),this.y<a.y&&(this.y=a.y),this},clamp:function(a,b){return this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x),this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y),this},clampScalar:function{var b,c;return function(d,e){return void 0===b&&(b=new a.Vector2,c=new a.Vector2),b.set(d,d),c.set(e,e),this.clamp(b,c)}},floor:function{return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function{return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function{return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function{return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function{return this.x=-this.x,this.y=-this.y,this},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function{return this.x*this.x+this.y*this.y},length:function{return Math.sqrt(this.x*this.x+this.y*this.y)},normalize:function{return this.divideScalar(this.length)},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;return b*b+c*c},setLength:function(a){var b=this.length;return 0!==b&&a!==b&&this.multiplyScalar(a/b),this},lerp:function(a,b){return this.x+=(a.x-this.x)*b,this.y+=(a.y-this.y)*b,this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a),this},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a,b){return void 0===b&&(b=0),this.x=a[b],this.y=a[b+1],this},toArray:function(a,b){return void 0===a&&(a=[]),void 0===b&&(b=0),a[b]=this.x,a[b+1]=this.y,a},fromAttribute:function(a,b,c){return void 0===c&&(c=0),b=b*a.itemSize+c,this.x=a.array[b],this.y=a.array[b+1],this},clone:function{return new a.Vector2(this.x,this.y)}},a.Vector3=function(a,b,c){this.x=a||0,this.y=b||0,this.z=c||0},a.Vector3.prototype={constructor:a.Vector3,set:function(a,b,c){return this.x=a,this.y=b,this.z=c,this},setX:function(a){return this.x=a,this},setY:function(a){return this.y=a,this},setZ:function(a){return this.z=a,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 new Error("index is out of range: "+a)}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+a)}},copy:function(a){return this.x=a.x,this.y=a.y,this.z=a.z,this},add:function(b,c){return void 0!==c?(a.warn("THREE.Vector3: .add now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(b,c)):(this.x+=b.x,this.y+=b.y,this.z+=b.z,this)},addScalar:function(a){return this.x+=a,this.y+=a,this.z+=a,this},addVectors:function(a,b){return this.x=a.x+b.x,this.y=a.y+b.y,this.z=a.z+b.z,this},sub:function(b,c){return void 0!==c?(a.warn("THREE.Vector3: .sub now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(b,c)):(this.x-=b.x,this.y-=b.y,this.z-=b.z,this)},subScalar:function(a){return this.x-=a,this.y-=a,this.z-=a,this},subVectors:function(a,b){return this.x=a.x-b.x,this.y=a.y-b.y,this.z=a.z-b.z,this},multiply:function(b,c){return void 0!==c?(a.warn("THREE.Vector3: .multiply now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(b,c)):(this.x*=b.x,this.y*=b.y,this.z*=b.z,this)},multiplyScalar:function(a){return this.x*=a,this.y*=a,this.z*=a,this},multiplyVectors:function(a,b){return this.x=a.x*b.x,this.y=a.y*b.y,this.z=a.z*b.z,this},applyEuler:function{var b;return function(c){return c instanceof a.Euler==!1&&a.error("THREE.Vector3: .applyEuler now expects a Euler rotation rather than a Vector3 and order."),void 0===b&&(b=new a.Quaternion),this.applyQuaternion(b.setFromEuler(c)),this}},applyAxisAngle:function{var b;return function(c,d){return void 0===b&&(b=new a.Quaternion),this.applyQuaternion(b.setFromAxisAngle(c,d)),this}},applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z,e=a.elements;return this.x=e[0]*b+e[3]*c+e[6]*d,this.y=e[1]*b+e[4]*c+e[7]*d,this.z=e[2]*b+e[5]*c+e[8]*d,this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,e=a.elements;return this.x=e[0]*b+e[4]*c+e[8]*d+e[12],this.y=e[1]*b+e[5]*c+e[9]*d+e[13],this.z=e[2]*b+e[6]*c+e[10]*d+e[14],this},applyProjection:function(a){var b=this.x,c=this.y,d=this.z,e=a.elements,f=1/(e[3]*b+e[7]*c+e[11]*d+e[15]);return this.x=(e[0]*b+e[4]*c+e[8]*d+e[12])*f,this.y=(e[1]*b+e[5]*c+e[9]*d+e[13])*f,this.z=(e[2]*b+e[6]*c+e[10]*d+e[14])*f,this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z,h=a.w,i=h*b+f*d-g*c,j=h*c+g*b-e*d,k=h*d+e*c-f*b,l=-e*b-f*c-g*d;return this.x=i*h+l*-e+j*-g-k*-f,this.y=j*h+l*-f+k*-e-i*-g,this.z=k*h+l*-g+i*-f-j*-e,this},project:function{var b;return function(c){return void 0===b&&(b=new a.Matrix4),b.multiplyMatrices(c.projectionMatrix,b.getInverse(c.matrixWorld)),this.applyProjection(b)}},unproject:function{var b;return function(c){return void 0===b&&(b=new a.Matrix4),b.multiplyMatrices(c.matrixWorld,b.getInverse(c.projectionMatrix)),this.applyProjection(b)}},transformDirection:function(a){var b=this.x,c=this.y,d=this.z,e=a.elements;return this.x=e[0]*b+e[4]*c+e[8]*d,this.y=e[1]*b+e[5]*c+e[9]*d,this.z=e[2]*b+e[6]*c+e[10]*d,this.normalize,this},divide:function(a){return this.x/=a.x,this.y/=a.y,this.z/=a.z,this},divideScalar:function(a){if(0!==a){var b=1/a;this.x*=b,this.y*=b,this.z*=b}else this.x=0,this.y=0,this.z=0;return this},min:function(a){return this.x>a.x&&(this.x=a.x),this.y>a.y&&(this.y=a.y),this.z>a.z&&(this.z=a.z),this},max:function(a){return this.x<a.x&&(this.x=a.x),this.y<a.y&&(this.y=a.y),this.z<a.z&&(this.z=a.z),this},clamp:function(a,b){return this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x),this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y),this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z),this},clampScalar:function{var b,c;return function(d,e){return void 0===b&&(b=new a.Vector3,c=new a.Vector3),b.set(d,d,d),c.set(e,e,e),this.clamp(b,c)}},floor:function{return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function{return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function{return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function{return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function{return this.x=-this.x,this.y=-this.y,this.z=-this.z,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)},lengthManhattan:function{return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function{return this.divideScalar(this.length)},setLength:function(a){var b=this.length;return 0!==b&&a!==b&&this.multiplyScalar(a/b),this},lerp:function(a,b){return this.x+=(a.x-this.x)*b,this.y+=(a.y-this.y)*b,this.z+=(a.z-this.z)*b,this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a),this},cross:function(b,c){if(void 0!==c)return a.warn("THREE.Vector3: .cross now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(b,c);var d=this.x,e=this.y,f=this.z;return this.x=e*b.z-f*b.y,this.y=f*b.x-d*b.z,this.z=d*b.y-e*b.x,this},crossVectors:function(a,b){var c=a.x,d=a.y,e=a.z,f=b.x,g=b.y,h=b.z;return this.x=d*h-e*g,this.y=e*f-c*h,this.z=c*g-d*f,this},projectOnVector:function{var b,c;return function(d){return void 0===b&&(b=new a.Vector3),b.copy(d).normalize,c=this.dot(b),this.copy(b).multiplyScalar(c)}},projectOnPlane:function{var b;return function(c){return void 0===b&&(b=new a.Vector3),b.copy(this).projectOnVector(c),this.sub(b)}},reflect:function{var b;return function(c){return void 0===b&&(b=new a.Vector3),this.sub(b.copy(c).multiplyScalar(2*this.dot(c)))}},angleTo:function(b){var c=this.dot(b)/(this.length*b.length);return Math.acos(a.Math.clamp(c,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y,d=this.z-a.z;return b*b+c*c+d*d},setEulerFromRotationMatrix:function(b,c){a.error("THREE.Vector3: .setEulerFromRotationMatrix has been removed. Use Euler.setFromRotationMatrix instead.")},setEulerFromQuaternion:function(b,c){a.error("THREE.Vector3: .setEulerFromQuaternion has been removed. Use Euler.setFromQuaternion instead.")},getPositionFromMatrix:function(b){return a.warn("THREE.Vector3: .getPositionFromMatrix has been renamed to .setFromMatrixPosition."),this.setFromMatrixPosition(b)},getScaleFromMatrix:function(b){return a.warn("THREE.Vector3: .getScaleFromMatrix has been renamed to .setFromMatrixScale."),this.setFromMatrixScale(b)},getColumnFromMatrix:function(b,c){return a.warn("THREE.Vector3: .getColumnFromMatrix has been renamed to .setFromMatrixColumn."),this.setFromMatrixColumn(b,c)},setFromMatrixPosition:function(a){return this.x=a.elements[12],this.y=a.elements[13],this.z=a.elements[14],this},setFromMatrixScale:function(a){var b=this.set(a.elements[0],a.elements[1],a.elements[2]).length,c=this.set(a.elements[4],a.elements[5],a.elements[6]).length,d=this.set(a.elements[8],a.elements[9],a.elements[10]).length;return this.x=b,this.y=c,this.z=d,this},setFromMatrixColumn:function(a,b){var c=4*a,d=b.elements;return this.x=d[c],this.y=d[c+1],this.z=d[c+2],this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){return void 0===b&&(b=0),this.x=a[b],this.y=a[b+1],this.z=a[b+2],this},toArray:function(a,b){return void 0===a&&(a=[]),void 0===b&&(b=0),a[b]=this.x,a[b+1]=this.y,a[b+2]=this.z,a},fromAttribute:function(a,b,c){return void 0===c&&(c=0),b=b*a.itemSize+c,this.x=a.array[b],this.y=a.array[b+1],this.z=a.array[b+2],this},clone:function{return new a.Vector3(this.x,this.y,this.z)}},a.Vector4=function(a,b,c,d){this.x=a||0,this.y=b||0,this.z=c||0,this.w=void 0!==d?d:1},a.Vector4.prototype={constructor:a.Vector4,set:function(a,b,c,d){return this.x=a,this.y=b,this.z=c,this.w=d,this},setX:function(a){return this.x=a,this},setY:function(a){return this.y=a,this},setZ:function(a){return this.z=a,this},setW:function(a){return this.w=a,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 new Error("index is out of range: "+a)}},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 new Error("index is out of range: "+a)}},copy:function(a){return this.x=a.x,this.y=a.y,this.z=a.z,this.w=void 0!==a.w?a.w:1,this},add:function(b,c){return void 0!==c?(a.warn("THREE.Vector4: .add now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(b,c)):(this.x+=b.x,this.y+=b.y,this.z+=b.z,this.w+=b.w,this)},addScalar:function(a){return this.x+=a,this.y+=a,this.z+=a,this.w+=a,this},addVectors:function(a,b){return this.x=a.x+b.x,this.y=a.y+b.y,this.z=a.z+b.z,this.w=a.w+b.w,this},sub:function(b,c){return void 0!==c?(a.warn("THREE.Vector4: .sub now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(b,c)):(this.x-=b.x,this.y-=b.y,this.z-=b.z,this.w-=b.w,this)},subScalar:function(a){return this.x-=a,this.y-=a,this.z-=a,this.w-=a,this},subVectors:function(a,b){return this.x=a.x-b.x,this.y=a.y-b.y,this.z=a.z-b.z,this.w=a.w-b.w,this},multiplyScalar:function(a){return this.x*=a,this.y*=a,this.z*=a,this.w*=a,this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.elements;return this.x=f[0]*b+f[4]*c+f[8]*d+f[12]*e,this.y=f[1]*b+f[5]*c+f[9]*d+f[13]*e,this.z=f[2]*b+f[6]*c+f[10]*d+f[14]*e,this.w=f[3]*b+f[7]*c+f[11]*d+f[15]*e,this},divideScalar:function(a){if(0!==a){var b=1/a;this.x*=b,this.y*=b,this.z*=b,this.w*=b}else this.x=0,this.y=0,this.z=0,this.w=1;return this},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);return 1e-4>b?(this.x=1,this.y=0,this.z=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b),this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,e,f=.01,g=.1,h=a.elements,i=h[0],j=h[4],k=h[8],l=h[1],m=h[5],n=h[9],o=h[2],p=h[6],q=h[10];if(Math.abs(j-l)<f&&Math.abs(k-o)<f&&Math.abs(n-p)<f){if(Math.abs(j+l)<g&&Math.abs(k+o)<g&&Math.abs(n+p)<g&&Math.abs(i+m+q-3)<g)return this.set(1,0,0,0),this;b=Math.PI;var r=(i+1)/2,s=(m+1)/2,t=(q+1)/2,u=(j+l)/4,v=(k+o)/4,w=(n+p)/4;return r>s&&r>t?f>r?(c=0,d=.707106781,e=.707106781):(c=Math.sqrt(r),d=u/c,e=v/c):s>t?f>s?(c=.707106781,d=0,e=.707106781):(d=Math.sqrt(s),c=u/d,e=w/d):f>t?(c=.707106781,d=.707106781,e=0):(e=Math.sqrt(t),c=v/e,d=w/e),this.set(c,d,e,b),this}var x=Math.sqrt((p-n)*(p-n)+(k-o)*(k-o)+(l-j)*(l-j));return Math.abs(x)<.001&&(x=1),this.x=(p-n)/x,this.y=(k-o)/x,this.z=(l-j)/x,this.w=Math.acos((i+m+q-1)/2),this},min:function(a){return this.x>a.x&&(this.x=a.x),this.y>a.y&&(this.y=a.y),this.z>a.z&&(this.z=a.z),this.w>a.w&&(this.w=a.w),this},max:function(a){return this.x<a.x&&(this.x=a.x),this.y<a.y&&(this.y=a.y),this.z<a.z&&(this.z=a.z),this.w<a.w&&(this.w=a.w),this},clamp:function(a,b){return this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x),this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y),this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z),this.w<a.w?this.w=a.w:this.w>b.w&&(this.w=b.w),this},clampScalar:function{var b,c;return function(d,e){return void 0===b&&(b=new a.Vector4,c=new a.Vector4),b.set(d,d,d,d),c.set(e,e,e,e),this.clamp(b,c)}},floor:function{return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function{return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function{return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function{return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function{return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,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)},lengthManhattan: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)},setLength:function(a){var b=this.length;return 0!==b&&a!==b&&this.multiplyScalar(a/b),this},lerp:function(a,b){return 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,this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a),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){return 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},toArray:function(a,b){return 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,a},fromAttribute:function(a,b,c){return void 0===c&&(c=0),b=b*a.itemSize+c,this.x=a.array[b],this.y=a.array[b+1],this.z=a.array[b+2],this.w=a.array[b+3],this},clone:function{return new a.Vector4(this.x,this.y,this.z,this.w)}},a.Euler=function(b,c,d,e){this._x=b||0,this._y=c||0,this._z=d||0,this._order=e||a.Euler.DefaultOrder},a.Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],a.Euler.DefaultOrder="XYZ",a.Euler.prototype={constructor:a.Euler,_x:0,_y:0,_z:0,_order:a.Euler.DefaultOrder,get x{return this._x},set x(a){this._x=a,this.onChangeCallback},get y{return this._y},set y(a){this._y=a,this.onChangeCallback},get z{return this._z},set z(a){this._z=a,this.onChangeCallback},get order{return this._order},set order(a){this._order=a,this.onChangeCallback},set:function(a,b,c,d){return this._x=a,this._y=b,this._z=c,this._order=d||this._order,this.onChangeCallback,this},copy:function(a){return this._x=a._x,this._y=a._y,this._z=a._z,this._order=a._order,this.onChangeCallback,this},setFromRotationMatrix:function(b,c,d){var e=a.Math.clamp,f=b.elements,g=f[0],h=f[4],i=f[8],j=f[1],k=f[5],l=f[9],m=f[2],n=f[6],o=f[10];return c=c||this._order,"XYZ"===c?(this._y=Math.asin(e(i,-1,1)),Math.abs(i)<.99999?(this._x=Math.atan2(-l,o),this._z=Math.atan2(-h,g)):(this._x=Math.atan2(n,k),this._z=0)):"YXZ"===c?(this._x=Math.asin(-e(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(i,o),this._z=Math.atan2(j,k)):(this._y=Math.atan2(-m,g),this._z=0)):"ZXY"===c?(this._x=Math.asin(e(n,-1,1)),Math.abs(n)<.99999?(this._y=Math.atan2(-m,o),this._z=Math.atan2(-h,k)):(this._y=0,this._z=Math.atan2(j,g))):"ZYX"===c?(this._y=Math.asin(-e(m,-1,1)),Math.abs(m)<.99999?(this._x=Math.atan2(n,o),this._z=Math.atan2(j,g)):(this._x=0,this._z=Math.atan2(-h,k))):"YZX"===c?(this._z=Math.asin(e(j,-1,1)),Math.abs(j)<.99999?(this._x=Math.atan2(-l,k),this._y=Math.atan2(-m,g)):(this._x=0,this._y=Math.atan2(i,o))):"XZY"===c?(this._z=Math.asin(-e(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(n,k),this._y=Math.atan2(i,g)):(this._x=Math.atan2(-l,o),this._y=0)):a.warn("THREE.Euler: .setFromRotationMatrix given unsupported order: "+c),this._order=c,d!==!1&&this.onChangeCallback,this},setFromQuaternion:function{var b;return function(c,d,e){return void 0===b&&(b=new a.Matrix4),b.makeRotationFromQuaternion(c),this.setFromRotationMatrix(b,d,e),this}},setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function{var b=new a.Quaternion;return function(a){b.setFromEuler(this),this.setFromQuaternion(b,a)}},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){return this._x=a[0],this._y=a[1],this._z=a[2],void 0!==a[3]&&(this._order=a[3]),this.onChangeCallback,this},toArray:function(a,b){return 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,a},toVector3:function(b){return b?b.set(this._x,this._y,this._z):new a.Vector3(this._x,this._y,this._z)},onChange:function(a){return this.onChangeCallback=a,this},onChangeCallback:function{},clone:function{return new a.Euler(this._x,this._y,this._z,this._order)}},a.Line3=function(b,c){this.start=void 0!==b?b:new a.Vector3,this.end=void 0!==c?c:new a.Vector3},a.Line3.prototype={constructor:a.Line3,set:function(a,b){return this.start.copy(a),this.end.copy(b),this},copy:function(a){return this.start.copy(a.start),this.end.copy(a.end),this},center:function(b){var c=b||new a.Vector3;return c.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(b){var c=b||new a.Vector3;return c.subVectors(this.end,this.start)},distanceSq:function{return this.start.distanceToSquared(this.end)},distance:function{return this.start.distanceTo(this.end)},at:function(b,c){var d=c||new a.Vector3;return this.delta(d).multiplyScalar(b).add(this.start)},closestPointToPointParameter:function{var b=new a.Vector3,c=new a.Vector3;return function(d,e){b.subVectors(d,this.start),c.subVectors(this.end,this.start);var f=c.dot(c),g=c.dot(b),h=g/f;return e&&(h=a.Math.clamp(h,0,1)),h}},closestPointToPoint:function(b,c,d){var e=this.closestPointToPointParameter(b,c),f=d||new a.Vector3;return this.delta(f).multiplyScalar(e).add(this.start)},applyMatrix4:function(a){return this.start.applyMatrix4(a),this.end.applyMatrix4(a),this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)},clone:function{return(new a.Line3).copy(this)}},a.Box2=function(b,c){this.min=void 0!==b?b:new a.Vector2(1/0,1/0),this.max=void 0!==c?c:new a.Vector2(-(1/0),-(1/0))},a.Box2.prototype={constructor:a.Box2,set:function(a,b){return this.min.copy(a),this.max.copy(b),this},setFromPoints:function(a){this.makeEmpty;for(var b=0,c=a.length;c>b;b++)this.expandByPoint(a[b]);return this},setFromCenterAndSize:function{var b=new a.Vector2;return function(a,c){var d=b.copy(c).multiplyScalar(.5);return this.min.copy(a).sub(d),this.max.copy(a).add(d),this}},copy:function(a){return this.min.copy(a.min),this.max.copy(a.max),this},makeEmpty:function{return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-(1/0),this},empty:function{return this.max.x<this.min.x||this.max.y<this.min.y},center:function(b){var c=b||new a.Vector2;return c.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(b){var c=b||new a.Vector2;return c.subVectors(this.max,this.min)},expandByPoint:function(a){return this.min.min(a),this.max.max(a),this},expandByVector:function(a){return this.min.sub(a),this.max.add(a),this},expandByScalar:function(a){return this.min.addScalar(-a),this.max.addScalar(a),this},containsPoint:function(a){return!(a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y)},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(b,c){var d=c||new a.Vector2;return d.set((b.x-this.min.x)/(this.max.x-this.min.x),(b.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(a){return!(a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y)},clampPoint:function(b,c){var d=c||new a.Vector2;return d.copy(b).clamp(this.min,this.max)},distanceToPoint:function{var b=new a.Vector2;return function(a){var c=b.copy(a).clamp(this.min,this.max);return c.sub(a).length}},intersect:function(a){return this.min.max(a.min),this.max.min(a.max),this},union:function(a){return this.min.min(a.min),this.max.max(a.max),this},translate:function(a){return this.min.add(a),this.max.add(a),this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function{return(new a.Box2).copy(this)}},a.Box3=function(b,c){this.min=void 0!==b?b:new a.Vector3(1/0,1/0,1/0),this.max=void 0!==c?c:new a.Vector3(-(1/0),-(1/0),-(1/0))},a.Box3.prototype={constructor:a.Box3,set:function(a,b){return this.min.copy(a),this.max.copy(b), this},setFromPoints:function(a){this.makeEmpty;for(var b=0,c=a.length;c>b;b++)this.expandByPoint(a[b]);return this},setFromCenterAndSize:function{var b=new a.Vector3;return function(a,c){var d=b.copy(c).multiplyScalar(.5);return this.min.copy(a).sub(d),this.max.copy(a).add(d),this}},setFromObject:function{var b=new a.Vector3;return function(c){var d=this;return c.updateMatrixWorld(!0),this.makeEmpty,c.traverse(function(c){var e=c.geometry;if(void 0!==e)if(e instanceof a.Geometry)for(var f=e.vertices,g=0,h=f.length;h>g;g++)b.copy(f[g]),b.applyMatrix4(c.matrixWorld),d.expandByPoint(b);else if(e instanceof a.BufferGeometry&&void 0!==e.attributes.position)for(var i=e.attributes.position.array,g=0,h=i.length;h>g;g+=3)b.set(i[g],i[g+1],i[g+2]),b.applyMatrix4(c.matrixWorld),d.expandByPoint(b)}),this}},copy:function(a){return this.min.copy(a.min),this.max.copy(a.max),this},makeEmpty:function{return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-(1/0),this},empty:function{return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(b){var c=b||new a.Vector3;return c.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(b){var c=b||new a.Vector3;return c.subVectors(this.max,this.min)},expandByPoint:function(a){return this.min.min(a),this.max.max(a),this},expandByVector:function(a){return this.min.sub(a),this.max.add(a),this},expandByScalar:function(a){return this.min.addScalar(-a),this.max.addScalar(a),this},containsPoint:function(a){return!(a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y||a.z<this.min.z||a.z>this.max.z)},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(b,c){var d=c||new a.Vector3;return d.set((b.x-this.min.x)/(this.max.x-this.min.x),(b.y-this.min.y)/(this.max.y-this.min.y),(b.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(a){return!(a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y||a.max.z<this.min.z||a.min.z>this.max.z)},clampPoint:function(b,c){var d=c||new a.Vector3;return d.copy(b).clamp(this.min,this.max)},distanceToPoint:function{var b=new a.Vector3;return function(a){var c=b.copy(a).clamp(this.min,this.max);return c.sub(a).length}},getBoundingSphere:function{var b=new a.Vector3;return function(c){var d=c||new a.Sphere;return d.center=this.center,d.radius=.5*this.size(b).length,d}},intersect:function(a){return this.min.max(a.min),this.max.min(a.max),this},union:function(a){return this.min.min(a.min),this.max.max(a.max),this},applyMatrix4:function{var b=[new a.Vector3,new a.Vector3,new a.Vector3,new a.Vector3,new a.Vector3,new a.Vector3,new a.Vector3,new a.Vector3];return function(a){return b[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(a),b[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(a),b[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(a),b[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(a),b[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(a),b[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(a),b[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(a),b[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(a),this.makeEmpty,this.setFromPoints(b),this}},translate:function(a){return this.min.add(a),this.max.add(a),this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function{return(new a.Box3).copy(this)}},a.Matrix3=function{this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),arguments.length>0&&a.error("THREE.Matrix3: the constructor no longer reads arguments. use .set instead.")},a.Matrix3.prototype={constructor:a.Matrix3,set:function(a,b,c,d,e,f,g,h,i){var j=this.elements;return j[0]=a,j[3]=b,j[6]=c,j[1]=d,j[4]=e,j[7]=f,j[2]=g,j[5]=h,j[8]=i,this},identity:function{return this.set(1,0,0,0,1,0,0,0,1),this},copy:function(a){var b=a.elements;return this.set(b[0],b[3],b[6],b[1],b[4],b[7],b[2],b[5],b[8]),this},multiplyVector3:function(b){return a.warn("THREE.Matrix3: .multiplyVector3 has been removed. Use vector.applyMatrix3( matrix ) instead."),b.applyMatrix3(this)},multiplyVector3Array:function(b){return a.warn("THREE.Matrix3: .multiplyVector3Array has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(b)},applyToVector3Array:function{var b=new a.Vector3;return function(a,c,d){void 0===c&&(c=0),void 0===d&&(d=a.length);for(var e=0,f=c;d>e;e+=3,f+=3)b.x=a[f],b.y=a[f+1],b.z=a[f+2],b.applyMatrix3(this),a[f]=b.x,a[f+1]=b.y,a[f+2]=b.z;return a}},multiplyScalar:function(a){var b=this.elements;return b[0]*=a,b[3]*=a,b[6]*=a,b[1]*=a,b[4]*=a,b[7]*=a,b[2]*=a,b[5]*=a,b[8]*=a,this},determinant:function{var a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],i=a[7],j=a[8];return b*f*j-b*g*i-c*e*j+c*g*h+d*e*i-d*f*h},getInverse:function(b,c){var d=b.elements,e=this.elements;e[0]=d[10]*d[5]-d[6]*d[9],e[1]=-d[10]*d[1]+d[2]*d[9],e[2]=d[6]*d[1]-d[2]*d[5],e[3]=-d[10]*d[4]+d[6]*d[8],e[4]=d[10]*d[0]-d[2]*d[8],e[5]=-d[6]*d[0]+d[2]*d[4],e[6]=d[9]*d[4]-d[5]*d[8],e[7]=-d[9]*d[0]+d[1]*d[8],e[8]=d[5]*d[0]-d[1]*d[4];var f=d[0]*e[0]+d[1]*e[3]+d[2]*e[6];if(0===f){var g="Matrix3.getInverse: can't invert matrix, determinant is 0";if(c)throw new Error(g);return a.warn(g),this.identity,this}return this.multiplyScalar(1/f),this},transpose:function{var a,b=this.elements;return a=b[1],b[1]=b[3],b[3]=a,a=b[2],b[2]=b[6],b[6]=a,a=b[5],b[5]=b[7],b[7]=a,this},flattenToArrayOffset:function(a,b){var c=this.elements;return a[b]=c[0],a[b+1]=c[1],a[b+2]=c[2],a[b+3]=c[3],a[b+4]=c[4],a[b+5]=c[5],a[b+6]=c[6],a[b+7]=c[7],a[b+8]=c[8],a},getNormalMatrix:function(a){return this.getInverse(a).transpose,this},transposeIntoArray:function(a){var b=this.elements;return 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],this},fromArray:function(a){return this.elements.set(a),this},toArray:function{var a=this.elements;return[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8]]},clone:function{return(new a.Matrix3).fromArray(this.elements)}},a.Matrix4=function{this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),arguments.length>0&&a.error("THREE.Matrix4: the constructor no longer reads arguments. use .set instead.")},a.Matrix4.prototype={constructor:a.Matrix4,set:function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){var q=this.elements;return q[0]=a,q[4]=b,q[8]=c,q[12]=d,q[1]=e,q[5]=f,q[9]=g,q[13]=h,q[2]=i,q[6]=j,q[10]=k,q[14]=l,q[3]=m,q[7]=n,q[11]=o,q[15]=p,this},identity:function{return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},copy:function(a){return this.elements.set(a.elements),this},extractPosition:function(b){return a.warn("THREE.Matrix4: .extractPosition has been renamed to .copyPosition."),this.copyPosition(b)},copyPosition:function(a){var b=this.elements,c=a.elements;return b[12]=c[12],b[13]=c[13],b[14]=c[14],this},extractBasis:function(a,b,c){var d=this.elements;return a.set(d[0],d[1],d[2]),b.set(d[4],d[5],d[6]),c.set(d[8],d[9],d[10]),this},makeBasis:function(a,b,c){return this.set(a.x,b.x,c.x,0,a.y,b.y,c.y,0,a.z,b.z,c.z,0,0,0,0,1),this},extractRotation:function{var b=new a.Vector3;return function(a){var c=this.elements,d=a.elements,e=1/b.set(d[0],d[1],d[2]).length,f=1/b.set(d[4],d[5],d[6]).length,g=1/b.set(d[8],d[9],d[10]).length;return c[0]=d[0]*e,c[1]=d[1]*e,c[2]=d[2]*e,c[4]=d[4]*f,c[5]=d[5]*f,c[6]=d[6]*f,c[8]=d[8]*g,c[9]=d[9]*g,c[10]=d[10]*g,this}},makeRotationFromEuler:function(b){b instanceof a.Euler==!1&&a.error("THREE.Matrix: .makeRotationFromEuler now expects a Euler rotation rather than a Vector3 and order.");var c=this.elements,d=b.x,e=b.y,f=b.z,g=Math.cos(d),h=Math.sin(d),i=Math.cos(e),j=Math.sin(e),k=Math.cos(f),l=Math.sin(f);if("XYZ"===b.order){var m=g*k,n=g*l,o=h*k,p=h*l;c[0]=i*k,c[4]=-i*l,c[8]=j,c[1]=n+o*j,c[5]=m-p*j,c[9]=-h*i,c[2]=p-m*j,c[6]=o+n*j,c[10]=g*i}else if("YXZ"===b.order){var q=i*k,r=i*l,s=j*k,t=j*l;c[0]=q+t*h,c[4]=s*h-r,c[8]=g*j,c[1]=g*l,c[5]=g*k,c[9]=-h,c[2]=r*h-s,c[6]=t+q*h,c[10]=g*i}else if("ZXY"===b.order){var q=i*k,r=i*l,s=j*k,t=j*l;c[0]=q-t*h,c[4]=-g*l,c[8]=s+r*h,c[1]=r+s*h,c[5]=g*k,c[9]=t-q*h,c[2]=-g*j,c[6]=h,c[10]=g*i}else if("ZYX"===b.order){var m=g*k,n=g*l,o=h*k,p=h*l;c[0]=i*k,c[4]=o*j-n,c[8]=m*j+p,c[1]=i*l,c[5]=p*j+m,c[9]=n*j-o,c[2]=-j,c[6]=h*i,c[10]=g*i}else if("YZX"===b.order){var u=g*i,v=g*j,w=h*i,x=h*j;c[0]=i*k,c[4]=x-u*l,c[8]=w*l+v,c[1]=l,c[5]=g*k,c[9]=-h*k,c[2]=-j*k,c[6]=v*l+w,c[10]=u-x*l}else if("XZY"===b.order){var u=g*i,v=g*j,w=h*i,x=h*j;c[0]=i*k,c[4]=-l,c[8]=j*k,c[1]=u*l+x,c[5]=g*k,c[9]=v*l-w,c[2]=w*l-v,c[6]=h*k,c[10]=x*l+u}return c[3]=0,c[7]=0,c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,this},setRotationFromQuaternion:function(b){return a.warn("THREE.Matrix4: .setRotationFromQuaternion has been renamed to .makeRotationFromQuaternion."),this.makeRotationFromQuaternion(b)},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,i=e+e,j=c*g,k=c*h,l=c*i,m=d*h,n=d*i,o=e*i,p=f*g,q=f*h,r=f*i;return b[0]=1-(m+o),b[4]=k-r,b[8]=l+q,b[1]=k+r,b[5]=1-(j+o),b[9]=n-p,b[2]=l-q,b[6]=n+p,b[10]=1-(j+m),b[3]=0,b[7]=0,b[11]=0,b[12]=0,b[13]=0,b[14]=0,b[15]=1,this},lookAt:function{var b=new a.Vector3,c=new a.Vector3,d=new a.Vector3;return function(a,e,f){var g=this.elements;return d.subVectors(a,e).normalize,0===d.length&&(d.z=1),b.crossVectors(f,d).normalize,0===b.length&&(d.x+=1e-4,b.crossVectors(f,d).normalize),c.crossVectors(d,b),g[0]=b.x,g[4]=c.x,g[8]=d.x,g[1]=b.y,g[5]=c.y,g[9]=d.y,g[2]=b.z,g[6]=c.z,g[10]=d.z,this}},multiply:function(b,c){return void 0!==c?(a.warn("THREE.Matrix4: .multiply now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(b,c)):this.multiplyMatrices(this,b)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],j=c[1],k=c[5],l=c[9],m=c[13],n=c[2],o=c[6],p=c[10],q=c[14],r=c[3],s=c[7],t=c[11],u=c[15],v=d[0],w=d[4],x=d[8],y=d[12],z=d[1],A=d[5],B=d[9],C=d[13],D=d[2],E=d[6],F=d[10],G=d[14],H=d[3],I=d[7],J=d[11],K=d[15];return e[0]=f*v+g*z+h*D+i*H,e[4]=f*w+g*A+h*E+i*I,e[8]=f*x+g*B+h*F+i*J,e[12]=f*y+g*C+h*G+i*K,e[1]=j*v+k*z+l*D+m*H,e[5]=j*w+k*A+l*E+m*I,e[9]=j*x+k*B+l*F+m*J,e[13]=j*y+k*C+l*G+m*K,e[2]=n*v+o*z+p*D+q*H,e[6]=n*w+o*A+p*E+q*I,e[10]=n*x+o*B+p*F+q*J,e[14]=n*y+o*C+p*G+q*K,e[3]=r*v+s*z+t*D+u*H,e[7]=r*w+s*A+t*E+u*I,e[11]=r*x+s*B+t*F+u*J,e[15]=r*y+s*C+t*G+u*K,this},multiplyToArray:function(a,b,c){var d=this.elements;return this.multiplyMatrices(a,b),c[0]=d[0],c[1]=d[1],c[2]=d[2],c[3]=d[3],c[4]=d[4],c[5]=d[5],c[6]=d[6],c[7]=d[7],c[8]=d[8],c[9]=d[9],c[10]=d[10],c[11]=d[11],c[12]=d[12],c[13]=d[13],c[14]=d[14],c[15]=d[15],this},multiplyScalar:function(a){var b=this.elements;return 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,this},multiplyVector3:function(b){return a.warn("THREE.Matrix4: .multiplyVector3 has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),b.applyProjection(this)},multiplyVector4:function(b){return a.warn("THREE.Matrix4: .multiplyVector4 has been removed. Use vector.applyMatrix4( matrix ) instead."),b.applyMatrix4(this)},multiplyVector3Array:function(b){return a.warn("THREE.Matrix4: .multiplyVector3Array has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(b)},applyToVector3Array:function{var b=new a.Vector3;return function(a,c,d){void 0===c&&(c=0),void 0===d&&(d=a.length);for(var e=0,f=c;d>e;e+=3,f+=3)b.x=a[f],b.y=a[f+1],b.z=a[f+2],b.applyMatrix4(this),a[f]=b.x,a[f+1]=b.y,a[f+2]=b.z;return a}},rotateAxis:function(b){a.warn("THREE.Matrix4: .rotateAxis has been removed. Use Vector3.transformDirection( matrix ) instead."),b.transformDirection(this)},crossVector:function(b){return a.warn("THREE.Matrix4: .crossVector has been removed. Use vector.applyMatrix4( matrix ) instead."),b.applyMatrix4(this)},determinant:function{var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],i=a[13],j=a[2],k=a[6],l=a[10],m=a[14],n=a[3],o=a[7],p=a[11],q=a[15];return n*(+e*h*k-d*i*k-e*g*l+c*i*l+d*g*m-c*h*m)+o*(+b*h*m-b*i*l+e*f*l-d*f*m+d*i*j-e*h*j)+p*(+b*i*k-b*g*m-e*f*k+c*f*m+e*g*j-c*i*j)+q*(-d*g*j-b*h*k+b*g*l+d*f*k-c*f*l+c*h*j)},transpose:function{var a,b=this.elements;return a=b[1],b[1]=b[4],b[4]=a,a=b[2],b[2]=b[8],b[8]=a,a=b[6],b[6]=b[9],b[9]=a,a=b[3],b[3]=b[12],b[12]=a,a=b[7],b[7]=b[13],b[13]=a,a=b[11],b[11]=b[14],b[14]=a,this},flattenToArrayOffset:function(a,b){var c=this.elements;return a[b]=c[0],a[b+1]=c[1],a[b+2]=c[2],a[b+3]=c[3],a[b+4]=c[4],a[b+5]=c[5],a[b+6]=c[6],a[b+7]=c[7],a[b+8]=c[8],a[b+9]=c[9],a[b+10]=c[10],a[b+11]=c[11],a[b+12]=c[12],a[b+13]=c[13],a[b+14]=c[14],a[b+15]=c[15],a},getPosition:function{var b=new a.Vector3;return function{a.warn("THREE.Matrix4: .getPosition has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var c=this.elements;return b.set(c[12],c[13],c[14])}},setPosition:function(a){var b=this.elements;return b[12]=a.x,b[13]=a.y,b[14]=a.z,this},getInverse:function(b,c){var d=this.elements,e=b.elements,f=e[0],g=e[4],h=e[8],i=e[12],j=e[1],k=e[5],l=e[9],m=e[13],n=e[2],o=e[6],p=e[10],q=e[14],r=e[3],s=e[7],t=e[11],u=e[15];d[0]=l*q*s-m*p*s+m*o*t-k*q*t-l*o*u+k*p*u,d[4]=i*p*s-h*q*s-i*o*t+g*q*t+h*o*u-g*p*u,d[8]=h*m*s-i*l*s+i*k*t-g*m*t-h*k*u+g*l*u,d[12]=i*l*o-h*m*o-i*k*p+g*m*p+h*k*q-g*l*q,d[1]=m*p*r-l*q*r-m*n*t+j*q*t+l*n*u-j*p*u,d[5]=h*q*r-i*p*r+i*n*t-f*q*t-h*n*u+f*p*u,d[9]=i*l*r-h*m*r-i*j*t+f*m*t+h*j*u-f*l*u,d[13]=h*m*n-i*l*n+i*j*p-f*m*p-h*j*q+f*l*q,d[2]=k*q*r-m*o*r+m*n*s-j*q*s-k*n*u+j*o*u,d[6]=i*o*r-g*q*r-i*n*s+f*q*s+g*n*u-f*o*u,d[10]=g*m*r-i*k*r+i*j*s-f*m*s-g*j*u+f*k*u,d[14]=i*k*n-g*m*n-i*j*o+f*m*o+g*j*q-f*k*q,d[3]=l*o*r-k*p*r-l*n*s+j*p*s+k*n*t-j*o*t,d[7]=g*p*r-h*o*r+h*n*s-f*p*s-g*n*t+f*o*t,d[11]=h*k*r-g*l*r-h*j*s+f*l*s+g*j*t-f*k*t,d[15]=g*l*n-h*k*n+h*j*o-f*l*o-g*j*p+f*k*p;var v=f*d[0]+j*d[4]+n*d[8]+r*d[12];if(0==v){var w="THREE.Matrix4.getInverse: can't invert matrix, determinant is 0";if(c)throw new Error(w);return a.warn(w),this.identity,this}return this.multiplyScalar(1/v),this},translate:function(b){a.error("THREE.Matrix4: .translate has been removed.")},rotateX:function(b){a.error("THREE.Matrix4: .rotateX has been removed.")},rotateY:function(b){a.error("THREE.Matrix4: .rotateY has been removed.")},rotateZ:function(b){a.error("THREE.Matrix4: .rotateZ has been removed.")},rotateByAxis:function(b,c){a.error("THREE.Matrix4: .rotateByAxis has been removed.")},scale:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z;return b[0]*=c,b[4]*=d,b[8]*=e,b[1]*=c,b[5]*=d,b[9]*=e,b[2]*=c,b[6]*=d,b[10]*=e,b[3]*=c,b[7]*=d,b[11]*=e,this},getMaxScaleOnAxis:function{var a=this.elements,b=a[0]*a[0]+a[1]*a[1]+a[2]*a[2],c=a[4]*a[4]+a[5]*a[5]+a[6]*a[6],d=a[8]*a[8]+a[9]*a[9]+a[10]*a[10];return Math.sqrt(Math.max(b,Math.max(c,d)))},makeTranslation:function(a,b,c){return this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1),this},makeRotationX:function(a){var b=Math.cos(a),c=Math.sin(a);return this.set(1,0,0,0,0,b,-c,0,0,c,b,0,0,0,0,1),this},makeRotationY:function(a){var b=Math.cos(a),c=Math.sin(a);return this.set(b,0,c,0,0,1,0,0,-c,0,b,0,0,0,0,1),this},makeRotationZ:function(a){var b=Math.cos(a),c=Math.sin(a);return this.set(b,-c,0,0,c,b,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,j=e*g;return this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,j*g+c,j*h-d*f,0,i*h-d*g,j*h+d*f,e*h*h+c,0,0,0,0,1),this},makeScale:function(a,b,c){return this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1),this},compose:function(a,b,c){return this.makeRotationFromQuaternion(b),this.scale(c),this.setPosition(a),this},decompose:function{var b=new a.Vector3,c=new a.Matrix4;return function(a,d,e){var f=this.elements,g=b.set(f[0],f[1],f[2]).length,h=b.set(f[4],f[5],f[6]).length,i=b.set(f[8],f[9],f[10]).length,j=this.determinant;0>j&&(g=-g),a.x=f[12],a.y=f[13],a.z=f[14],c.elements.set(this.elements);var k=1/g,l=1/h,m=1/i;return c.elements[0]*=k,c.elements[1]*=k,c.elements[2]*=k,c.elements[4]*=l,c.elements[5]*=l,c.elements[6]*=l,c.elements[8]*=m,c.elements[9]*=m,c.elements[10]*=m,d.setFromRotationMatrix(c),e.x=g,e.y=h,e.z=i,this}},makeFrustum:function(a,b,c,d,e,f){var g=this.elements,h=2*e/(b-a),i=2*e/(d-c),j=(b+a)/(b-a),k=(d+c)/(d-c),l=-(f+e)/(f-e),m=-2*f*e/(f-e);return g[0]=h,g[4]=0,g[8]=j,g[12]=0,g[1]=0,g[5]=i,g[9]=k,g[13]=0,g[2]=0,g[6]=0,g[10]=l,g[14]=m,g[3]=0,g[7]=0,g[11]=-1,g[15]=0,this},makePerspective:function(b,c,d,e){var f=d*Math.tan(a.Math.degToRad(.5*b)),g=-f,h=g*c,i=f*c;return this.makeFrustum(h,i,g,f,d,e)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=b-a,i=c-d,j=f-e,k=(b+a)/h,l=(c+d)/i,m=(f+e)/j;return g[0]=2/h,g[4]=0,g[8]=0,g[12]=-k,g[1]=0,g[5]=2/i,g[9]=0,g[13]=-l,g[2]=0,g[6]=0,g[10]=-2/j,g[14]=-m,g[3]=0,g[7]=0,g[11]=0,g[15]=1,this},fromArray:function(a){return this.elements.set(a),this},toArray:function{var a=this.elements;return[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15]]},clone:function{return(new a.Matrix4).fromArray(this.elements)}},a.Ray=function(b,c){this.origin=void 0!==b?b:new a.Vector3,this.direction=void 0!==c?c:new a.Vector3},a.Ray.prototype={constructor:a.Ray,set:function(a,b){return this.origin.copy(a),this.direction.copy(b),this},copy:function(a){return this.origin.copy(a.origin),this.direction.copy(a.direction),this},at:function(b,c){var d=c||new a.Vector3;return d.copy(this.direction).multiplyScalar(b).add(this.origin)},recast:function{var b=new a.Vector3;return function(a){return this.origin.copy(this.at(a,b)),this}},closestPointToPoint:function(b,c){var d=c||new a.Vector3;d.subVectors(b,this.origin);var e=d.dot(this.direction);return 0>e?d.copy(this.origin):d.copy(this.direction).multiplyScalar(e).add(this.origin)},distanceToPoint:function{var b=new a.Vector3;return function(a){var c=b.subVectors(a,this.origin).dot(this.direction);return 0>c?this.origin.distanceTo(a):(b.copy(this.direction).multiplyScalar(c).add(this.origin),b.distanceTo(a))}},distanceSqToSegment:function{var b=new a.Vector3,c=new a.Vector3,d=new a.Vector3;return function(a,e,f,g){b.copy(a).add(e).multiplyScalar(.5),c.copy(e).sub(a).normalize,d.copy(this.origin).sub(b);var h,i,j,k,l=.5*a.distanceTo(e),m=-this.direction.dot(c),n=d.dot(this.direction),o=-d.dot(c),p=d.lengthSq,q=Math.abs(1-m*m);if(q>0)if(h=m*o-n,i=m*n-o,k=l*q,h>=0)if(i>=-k)if(k>=i){var r=1/q;h*=r,i*=r,j=h*(h+m*i+2*n)+i*(m*h+i+2*o)+p}else i=l,h=Math.max(0,-(m*i+n)),j=-h*h+i*(i+2*o)+p;else i=-l,h=Math.max(0,-(m*i+n)),j=-h*h+i*(i+2*o)+p;else-k>=i?(h=Math.max(0,-(-m*l+n)),i=h>0?-l:Math.min(Math.max(-l,-o),l),j=-h*h+i*(i+2*o)+p):k>=i?(h=0,i=Math.min(Math.max(-l,-o),l),j=i*(i+2*o)+p):(h=Math.max(0,-(m*l+n)),i=h>0?l:Math.min(Math.max(-l,-o),l),j=-h*h+i*(i+2*o)+p);else i=m>0?-l:l,h=Math.max(0,-(m*i+n)),j=-h*h+i*(i+2*o)+p;return f&&f.copy(this.direction).multiplyScalar(h).add(this.origin),g&&g.copy(c).multiplyScalar(i).add(b),j}},isIntersectionSphere:function(a){return this.distanceToPoint(a.center)<=a.radius},intersectSphere:function{var b=new a.Vector3;return function(a,c){b.subVectors(a.center,this.origin);var d=b.dot(this.direction),e=b.dot(b)-d*d,f=a.radius*a.radius;if(e>f)return null;var g=Math.sqrt(f-e),h=d-g,i=d+g;return 0>h&&0>i?null:0>h?this.at(i,c):this.at(h,c)}},isIntersectionPlane:function(a){var b=a.distanceToPoint(this.origin);if(0===b)return!0;var c=a.normal.dot(this.direction);return 0>c*b},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0==b)return 0==a.distanceToPoint(this.origin)?0:null;var c=-(this.origin.dot(a.normal)+a.constant)/b;return c>=0?c:null},intersectPlane:function(a,b){var c=this.distanceToPlane(a);return null===c?null:this.at(c,b)},isIntersectionBox:function{var b=new a.Vector3;return function(a){return null!==this.intersectBox(a,b)}},intersectBox:function(a,b){var c,d,e,f,g,h,i=1/this.direction.x,j=1/this.direction.y,k=1/this.direction.z,l=this.origin;return i>=0?(c=(a.min.x-l.x)*i,d=(a.max.x-l.x)*i):(c=(a.max.x-l.x)*i,d=(a.min.x-l.x)*i),j>=0?(e=(a.min.y-l.y)*j,f=(a.max.y-l.y)*j):(e=(a.max.y-l.y)*j,f=(a.min.y-l.y)*j),c>f||e>d?null:((e>c||c!==c)&&(c=e),(d>f||d!==d)&&(d=f),k>=0?(g=(a.min.z-l.z)*k,h=(a.max.z-l.z)*k):(g=(a.max.z-l.z)*k,h=(a.min.z-l.z)*k),c>h||g>d?null:((g>c||c!==c)&&(c=g),(d>h||d!==d)&&(d=h),0>d?null:this.at(c>=0?c:d,b)))},intersectTriangle:function{var b=new a.Vector3,c=new a.Vector3,d=new a.Vector3,e=new a.Vector3;return function(a,f,g,h,i){c.subVectors(f,a),d.subVectors(g,a),e.crossVectors(c,d);var j,k=this.direction.dot(e);if(k>0){if(h)return null;j=1}else{if(!(0>k))return null;j=-1,k=-k}b.subVectors(this.origin,a);var l=j*this.direction.dot(d.crossVectors(b,d));if(0>l)return null;var m=j*this.direction.dot(c.cross(b));if(0>m)return null;if(l+m>k)return null;var n=-j*b.dot(e);return 0>n?null:this.at(n/k,i)}},applyMatrix4:function(a){return this.direction.add(this.origin).applyMatrix4(a),this.origin.applyMatrix4(a),this.direction.sub(this.origin),this.direction.normalize,this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)},clone:function{return(new a.Ray).copy(this)}},a.Sphere=function(b,c){this.center=void 0!==b?b:new a.Vector3,this.radius=void 0!==c?c:0},a.Sphere.prototype={constructor:a.Sphere,set:function(a,b){return this.center.copy(a),this.radius=b,this},setFromPoints:function{var b=new a.Box3;return function(a,c){var d=this.center;void 0!==c?d.copy(c):b.setFromPoints(a).center(d);for(var e=0,f=0,g=a.length;g>f;f++)e=Math.max(e,d.distanceToSquared(a[f]));return this.radius=Math.sqrt(e),this}},copy:function(a){return this.center.copy(a.center),this.radius=a.radius,this},empty:function{return this.radius<=0},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},clampPoint:function(b,c){var d=this.center.distanceToSquared(b),e=c||new a.Vector3;return e.copy(b),d>this.radius*this.radius&&(e.sub(this.center).normalize,e.multiplyScalar(this.radius).add(this.center)),e},getBoundingBox:function(b){var c=b||new a.Box3;return c.set(this.center,this.center),c.expandByScalar(this.radius),c},applyMatrix4:function(a){return this.center.applyMatrix4(a),this.radius=this.radius*a.getMaxScaleOnAxis,this},translate:function(a){return this.center.add(a),this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius},clone:function{return(new a.Sphere).copy(this)}},a.Frustum=function(b,c,d,e,f,g){this.planes=[void 0!==b?b:new a.Plane,void 0!==c?c:new a.Plane,void 0!==d?d:new a.Plane,void 0!==e?e:new a.Plane,void 0!==f?f:new a.Plane,void 0!==g?g:new a.Plane]},a.Frustum.prototype={constructor:a.Frustum,set:function(a,b,c,d,e,f){var g=this.planes;return g[0].copy(a),g[1].copy(b),g[2].copy(c),g[3].copy(d),g[4].copy(e),g[5].copy(f),this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements,d=c[0],e=c[1],f=c[2],g=c[3],h=c[4],i=c[5],j=c[6],k=c[7],l=c[8],m=c[9],n=c[10],o=c[11],p=c[12],q=c[13],r=c[14],s=c[15];return b[0].setComponents(g-d,k-h,o-l,s-p).normalize,b[1].setComponents(g+d,k+h,o+l,s+p).normalize,b[2].setComponents(g+e,k+i,o+m,s+q).normalize,b[3].setComponents(g-e,k-i,o-m,s-q).normalize,b[4].setComponents(g-f,k-j,o-n,s-r).normalize,b[5].setComponents(g+f,k+j,o+n,s+r).normalize,this},intersectsObject:function{var b=new a.Sphere;return function(a){var c=a.geometry;return null===c.boundingSphere&&c.computeBoundingSphere,b.copy(c.boundingSphere),b.applyMatrix4(a.matrixWorld),this.intersectsSphere(b)}},intersectsSphere:function(a){for(var b=this.planes,c=a.center,d=-a.radius,e=0;6>e;e++){var f=b[e].distanceToPoint(c);if(d>f)return!1}return!0},intersectsBox:function{var b=new a.Vector3,c=new a.Vector3;return function(a){for(var d=this.planes,e=0;6>e;e++){var f=d[e];b.x=f.normal.x>0?a.min.x:a.max.x,c.x=f.normal.x>0?a.max.x:a.min.x,b.y=f.normal.y>0?a.min.y:a.max.y,c.y=f.normal.y>0?a.max.y:a.min.y,b.z=f.normal.z>0?a.min.z:a.max.z,c.z=f.normal.z>0?a.max.z:a.min.z;var g=f.distanceToPoint(b),h=f.distanceToPoint(c);if(0>g&&0>h)return!1}return!0}},containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(b[c].distanceToPoint(a)<0)return!1;return!0},clone:function{return(new a.Frustum).copy(this)}},a.Plane=function(b,c){this.normal=void 0!==b?b:new a.Vector3(1,0,0),this.constant=void 0!==c?c:0},a.Plane.prototype={constructor:a.Plane,set:function(a,b){return this.normal.copy(a),this.constant=b,this},setComponents:function(a,b,c,d){return this.normal.set(a,b,c),this.constant=d,this},setFromNormalAndCoplanarPoint:function(a,b){return this.normal.copy(a),this.constant=-b.dot(this.normal),this},setFromCoplanarPoints:function{var b=new a.Vector3,c=new a.Vector3;return function(a,d,e){var f=b.subVectors(e,d).cross(c.subVectors(a,d)).normalize;return this.setFromNormalAndCoplanarPoint(f,a),this}},copy:function(a){return this.normal.copy(a.normal),this.constant=a.constant,this},normalize:function{var a=1/this.normal.length;return this.normal.multiplyScalar(a),this.constant*=a,this},negate:function{return this.constant*=-1,this.normal.negate,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){return this.orthoPoint(a,b).sub(a).negate},orthoPoint:function(b,c){var d=this.distanceToPoint(b),e=c||new a.Vector3;return e.copy(this.normal).multiplyScalar(d)},isIntersectionLine:function(a){var b=this.distanceToPoint(a.start),c=this.distanceToPoint(a.end);return 0>b&&c>0||0>c&&b>0},intersectLine:function{var b=new a.Vector3;return function(c,d){var e=d||new a.Vector3,f=c.delta(b),g=this.normal.dot(f);if(0!=g){var h=-(c.start.dot(this.normal)+this.constant)/g;if(!(0>h||h>1))return e.copy(f).multiplyScalar(h).add(c.start)}else if(0==this.distanceToPoint(c.start))return e.copy(c.start)}},coplanarPoint:function(b){var c=b||new a.Vector3;return c.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function{var b=new a.Vector3,c=new a.Vector3,d=new a.Matrix3;return function(a,e){var f=e||d.getNormalMatrix(a),g=b.copy(this.normal).applyMatrix3(f),h=this.coplanarPoint(c);return h.applyMatrix4(a),this.setFromNormalAndCoplanarPoint(g,h),this}},translate:function(a){return this.constant=this.constant-a.dot(this.normal),this},equals:function(a){return a.normal.equals(this.normal)&&a.constant==this.constant},clone:function{return(new a.Plane).copy(this)}},a.Math={generateUUID:function{var a,b="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),c=new Array(36),d=0;return function{for(var e=0;36>e;e++)8==e||13==e||18==e||23==e?c[e]="-":14==e?c[e]="4":(2>=d&&(d=33554432+16777216*Math.random|0),a=15&d,d>>=4,c[e]=b[19==e?3&a|8:a]);return c.join("")}},clamp:function(a,b,c){return b>a?b:a>c?c:a},clampBottom:function(a,b){return b>a?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},smoothstep:function(a,b,c){return b>=a?0:a>=c?1:(a=(a-b)/(c-b),a*a*(3-2*a))},smootherstep:function(a,b,c){return b>=a?0:a>=c?1:(a=(a-b)/(c-b),a*a*a*(a*(6*a-15)+10))},random16:function{return(65280*Math.random+255*Math.random)/65535},randInt:function(a,b){return Math.floor(this.randFloat(a,b))},randFloat:function(a,b){return a+Math.random*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random)},degToRad:function{var a=Math.PI/180;return function(b){return b*a}},radToDeg:function{var a=180/Math.PI;return function(b){return b*a}},isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},nextPowerOfTwo:function(a){return a--,a|=a>>1,a|=a>>2,a|=a>>4,a|=a>>8,a|=a>>16,a++,a}},a.Spline=function(b){function c(a,b,c,d,e,f,g){var h=.5*(c-a),i=.5*(d-b);return(2*(b-c)+h+i)*g+(-3*(b-c)-2*h-i)*f+h*e+b}this.points=b;var d,e,f,g,h,i,j,k,l,m=[],n={x:0,y:0,z:0};this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}},this.getPoint=function(a){return d=(this.points.length-1)*a,e=Math.floor(d),f=d-e,m[0]=0===e?e:e-1,m[1]=e,m[2]=e>this.points.length-2?this.points.length-1:e+1,m[3]=e>this.points.length-3?this.points.length-1:e+2,i=this.points[m[0]],j=this.points[m[1]],k=this.points[m[2]],l=this.points[m[3]],g=f*f,h=f*g,n.x=c(i.x,j.x,k.x,l.x,f,g,h),n.y=c(i.y,j.y,k.y,l.y,f,g,h),n.z=c(i.z,j.z,k.z,l.z,f,g,h),n},this.getControlPointsArray=function{var a,b,c=this.points.length,d=[];for(a=0;c>a;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d},this.getLength=function(b){var c,d,e,f,g=0,h=0,i=0,j=new a.Vector3,k=new a.Vector3,l=[],m=0;for(l[0]=0,b||(b=100),e=this.points.length*b,j.copy(this.points[0]),c=1;e>c;c++)d=c/e,f=this.getPoint(d),k.copy(f),m+=k.distanceTo(j),j.copy(f),g=(this.points.length-1)*d,h=Math.floor(g),h!=i&&(l[h]=m,i=h);return l[l.length]=m,{chunks:l,total:m}},this.reparametrizeByArcLength=function(b){var c,d,e,f,g,h,i,j,k=[],l=new a.Vector3,m=this.getLength;for(k.push(l.copy(this.points[0]).clone),c=1;c<this.points.length;c++){for(h=m.chunks[c]-m.chunks[c-1],i=Math.ceil(b*h/m.total),f=(c-1)/(this.points.length-1),g=c/(this.points.length-1),d=1;i-1>d;d++)e=f+d*(1/i)*(g-f),j=this.getPoint(e),k.push(l.copy(j).clone);k.push(l.copy(this.points[c]).clone)}this.points=k}},a.Triangle=function(b,c,d){this.a=void 0!==b?b:new a.Vector3,this.b=void 0!==c?c:new a.Vector3,this.c=void 0!==d?d:new a.Vector3},a.Triangle.normal=function{var b=new a.Vector3;return function(c,d,e,f){var g=f||new a.Vector3;g.subVectors(e,d),b.subVectors(c,d),g.cross(b);var h=g.lengthSq;return h>0?g.multiplyScalar(1/Math.sqrt(h)):g.set(0,0,0)}},a.Triangle.barycoordFromPoint=function{var b=new a.Vector3,c=new a.Vector3,d=new a.Vector3;return function(e,f,g,h,i){b.subVectors(h,f),c.subVectors(g,f),d.subVectors(e,f);var j=b.dot(b),k=b.dot(c),l=b.dot(d),m=c.dot(c),n=c.dot(d),o=j*m-k*k,p=i||new a.Vector3;if(0==o)return p.set(-2,-1,-1);var q=1/o,r=(m*l-k*n)*q,s=(j*n-k*l)*q;return p.set(1-r-s,s,r)}},a.Triangle.containsPoint=function{var b=new a.Vector3;return function(c,d,e,f){var g=a.Triangle.barycoordFromPoint(c,d,e,f,b);return g.x>=0&&g.y>=0&&g.x+g.y<=1}},a.Triangle.prototype={constructor:a.Triangle,set:function(a,b,c){return this.a.copy(a),this.b.copy(b),this.c.copy(c),this},setFromPointsAndIndices:function(a,b,c,d){return this.a.copy(a[b]),this.b.copy(a[c]),this.c.copy(a[d]),this},copy:function(a){return this.a.copy(a.a),this.b.copy(a.b),this.c.copy(a.c),this},area:function{var b=new a.Vector3,c=new a.Vector3;return function{return b.subVectors(this.c,this.b),c.subVectors(this.a,this.b),.5*b.cross(c).length}},midpoint:function(b){var c=b||new a.Vector3;return c.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(b){return a.Triangle.normal(this.a,this.b,this.c,b)},plane:function(b){var c=b||new a.Plane;return c.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(b,c){return a.Triangle.barycoordFromPoint(b,this.a,this.b,this.c,c)},containsPoint:function(b){return a.Triangle.containsPoint(b,this.a,this.b,this.c)},equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)},clone:function{return(new a.Triangle).copy(this)}},a.Clock=function(a){this.autoStart=void 0!==a?a:!0,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1},a.Clock.prototype={constructor:a.Clock,start:function{this.startTime=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now:Date.now,this.oldTime=this.startTime,this.running=!0},stop:function{this.getElapsedTime,this.running=!1; },getElapsedTime:function{return this.getDelta,this.elapsedTime},getDelta:function{var a=0;if(this.autoStart&&!this.running&&this.start,this.running){var b=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now:Date.now;a=.001*(b-this.oldTime),this.oldTime=b,this.elapsedTime+=a}return a}},a.EventDispatcher=function{},a.EventDispatcher.prototype={constructor:a.EventDispatcher,apply:function(b){b.addEventListener=a.EventDispatcher.prototype.addEventListener,b.hasEventListener=a.EventDispatcher.prototype.hasEventListener,b.removeEventListener=a.EventDispatcher.prototype.removeEventListener,b.dispatchEvent=a.EventDispatcher.prototype.dispatchEvent},addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]),-1===c[a].indexOf(b)&&c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners,d=c[a];if(void 0!==d){var e=d.indexOf(b);-1!==e&&d.splice(e,1)}}},dispatchEvent:function(a){if(void 0!==this._listeners){var b=this._listeners,c=b[a.type];if(void 0!==c){a.target=this;for(var d=[],e=c.length,f=0;e>f;f++)d[f]=c[f];for(var f=0;e>f;f++)d[f].call(this,a)}}}},function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c),this.near=d||0,this.far=e||1/0,this.params={Sprite:{},Mesh:{},PointCloud:{threshold:1},LOD:{},Line:{}}};var b=function(a,b){return a.distance-b.distance},c=function(a,b,d,e){if(a.raycast(b,d),e===!0)for(var f=a.children,g=0,h=f.length;h>g;g++)c(f[g],b,d,!0)};a.Raycaster.prototype={constructor:a.Raycaster,precision:1e-4,linePrecision:1,set:function(a,b){this.ray.set(a,b)},setFromCamera:function(b,c){c instanceof a.PerspectiveCamera?(this.ray.origin.copy(c.position),this.ray.direction.set(b.x,b.y,.5).unproject(c).sub(c.position).normalize):c instanceof a.OrthographicCamera?(this.ray.origin.set(b.x,b.y,-1).unproject(c),this.ray.direction.set(0,0,-1).transformDirection(c.matrixWorld)):a.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(a,d){var e=[];return c(a,this,e,d),e.sort(b),e},intersectObjects:function(d,e){var f=[];if(d instanceof Array==!1)return a.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),f;for(var g=0,h=d.length;h>g;g++)c(d[g],this,f,e);return f.sort(b),f}}}(a),a.Object3D=function{Object.defineProperty(this,"id",{value:a.Object3DIdCount++}),this.uuid=a.Math.generateUUID,this.name="",this.type="Object3D",this.parent=void 0,this.children=[],this.up=a.Object3D.DefaultUp.clone;var b=new a.Vector3,c=new a.Euler,d=new a.Quaternion,e=new a.Vector3(1,1,1),f=function{d.setFromEuler(c,!1)},g=function{c.setFromQuaternion(d,void 0,!1)};c.onChange(f),d.onChange(g),Object.defineProperties(this,{position:{enumerable:!0,value:b},rotation:{enumerable:!0,value:c},quaternion:{enumerable:!0,value:d},scale:{enumerable:!0,value:e}}),this.rotationAutoUpdate=!0,this.matrix=new a.Matrix4,this.matrixWorld=new a.Matrix4,this.matrixAutoUpdate=!0,this.matrixWorldNeedsUpdate=!1,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}},a.Object3D.DefaultUp=new a.Vector3(0,1,0),a.Object3D.prototype={constructor:a.Object3D,get eulerOrder{return a.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order."),this.rotation.order},set eulerOrder(b){a.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order."),this.rotation.order=b},get useQuaternion{a.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(b){a.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},applyMatrix:function(a){this.matrix.multiplyMatrices(a,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(a,b){this.quaternion.setFromAxisAngle(a,b)},setRotationFromEuler:function(a){this.quaternion.setFromEuler(a,!0)},setRotationFromMatrix:function(a){this.quaternion.setFromRotationMatrix(a)},setRotationFromQuaternion:function(a){this.quaternion.copy(a)},rotateOnAxis:function{var b=new a.Quaternion;return function(a,c){return b.setFromAxisAngle(a,c),this.quaternion.multiply(b),this}},rotateX:function{var b=new a.Vector3(1,0,0);return function(a){return this.rotateOnAxis(b,a)}},rotateY:function{var b=new a.Vector3(0,1,0);return function(a){return this.rotateOnAxis(b,a)}},rotateZ:function{var b=new a.Vector3(0,0,1);return function(a){return this.rotateOnAxis(b,a)}},translateOnAxis:function{var b=new a.Vector3;return function(a,c){return b.copy(a).applyQuaternion(this.quaternion),this.position.add(b.multiplyScalar(c)),this}},translate:function(b,c){return a.warn("THREE.Object3D: .translate has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(c,b)},translateX:function{var b=new a.Vector3(1,0,0);return function(a){return this.translateOnAxis(b,a)}},translateY:function{var b=new a.Vector3(0,1,0);return function(a){return this.translateOnAxis(b,a)}},translateZ:function{var b=new a.Vector3(0,0,1);return function(a){return this.translateOnAxis(b,a)}},localToWorld:function(a){return a.applyMatrix4(this.matrixWorld)},worldToLocal:function{var b=new a.Matrix4;return function(a){return a.applyMatrix4(b.getInverse(this.matrixWorld))}},lookAt:function{var b=new a.Matrix4;return function(a){b.lookAt(a,this.position,this.up),this.quaternion.setFromRotationMatrix(b)}},add:function(b){if(arguments.length>1){for(var c=0;c<arguments.length;c++)this.add(arguments[c]);return this}return b===this?(a.error("THREE.Object3D.add: object can't be added as a child of itself.",b),this):(b instanceof a.Object3D?(void 0!==b.parent&&b.parent.remove(b),b.parent=this,b.dispatchEvent({type:"added"}),this.children.push(b)):a.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",b),this)},remove:function(a){if(arguments.length>1)for(var b=0;b<arguments.length;b++)this.remove(arguments[b]);var c=this.children.indexOf(a);-1!==c&&(a.parent=void 0,a.dispatchEvent({type:"removed"}),this.children.splice(c,1))},getChildByName:function(b){return a.warn("THREE.Object3D: .getChildByName has been renamed to .getObjectByName."),this.getObjectByName(b)},getObjectById:function(a){return this.getObjectByProperty("id",a)},getObjectByName:function(a){return this.getObjectByProperty("name",a)},getObjectByProperty:function(a,b){if(this[a]===b)return this;for(var c=0,d=this.children.length;d>c;c++){var e=this.children[c],f=e.getObjectByProperty(a,b);if(void 0!==f)return f}},getWorldPosition:function(b){var c=b||new a.Vector3;return this.updateMatrixWorld(!0),c.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function{var b=new a.Vector3,c=new a.Vector3;return function(d){var e=d||new a.Quaternion;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(b,e,c),e}},getWorldRotation:function{var b=new a.Quaternion;return function(c){var d=c||new a.Euler;return this.getWorldQuaternion(b),d.setFromQuaternion(b,this.rotation.order,!1)}},getWorldScale:function{var b=new a.Vector3,c=new a.Quaternion;return function(d){var e=d||new a.Vector3;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(b,c,e),e}},getWorldDirection:function{var b=new a.Quaternion;return function(c){var d=c||new a.Vector3;return this.getWorldQuaternion(b),d.set(0,0,1).applyQuaternion(b)}},raycast:function{},traverse:function(a){a(this);for(var b=0,c=this.children.length;c>b;b++)this.children[b].traverse(a)},traverseVisible:function(a){if(this.visible!==!1){a(this);for(var b=0,c=this.children.length;c>b;b++)this.children[b].traverseVisible(a)}},traverseAncestors:function(a){this.parent&&(a(this.parent),this.parent.traverseAncestors(a))},updateMatrix:function{this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate===!0&&this.updateMatrix,this.matrixWorldNeedsUpdate!==!0&&a!==!0||(void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0);for(var b=0,c=this.children.length;c>b;b++)this.children[b].updateMatrixWorld(a)},toJSON:function{var b={metadata:{version:4.3,type:"Object",generator:"ObjectExporter"}},c={},d=function(a){if(void 0===b.geometries&&(b.geometries=[]),void 0===c[a.uuid]){var d=a.toJSON;delete d.metadata,c[a.uuid]=d,b.geometries.push(d)}return a.uuid},e={},f=function(a){if(void 0===b.materials&&(b.materials=[]),void 0===e[a.uuid]){var c=a.toJSON;delete c.metadata,e[a.uuid]=c,b.materials.push(c)}return a.uuid},g=function(b){var c={};if(c.uuid=b.uuid,c.type=b.type,""!==b.name&&(c.name=b.name),"{}"!==JSON.stringify(b.userData)&&(c.userData=b.userData),b.visible!==!0&&(c.visible=b.visible),b instanceof a.PerspectiveCamera?(c.fov=b.fov,c.aspect=b.aspect,c.near=b.near,c.far=b.far):b instanceof a.OrthographicCamera?(c.left=b.left,c.right=b.right,c.top=b.top,c.bottom=b.bottom,c.near=b.near,c.far=b.far):b instanceof a.AmbientLight?c.color=b.color.getHex:b instanceof a.DirectionalLight?(c.color=b.color.getHex,c.intensity=b.intensity):b instanceof a.PointLight?(c.color=b.color.getHex,c.intensity=b.intensity,c.distance=b.distance,c.decay=b.decay):b instanceof a.SpotLight?(c.color=b.color.getHex,c.intensity=b.intensity,c.distance=b.distance,c.angle=b.angle,c.exponent=b.exponent,c.decay=b.decay):b instanceof a.HemisphereLight?(c.color=b.color.getHex,c.groundColor=b.groundColor.getHex):b instanceof a.Mesh||b instanceof a.Line||b instanceof a.PointCloud?(c.geometry=d(b.geometry),c.material=f(b.material),b instanceof a.Line&&(c.mode=b.mode)):b instanceof a.Sprite&&(c.material=f(b.material)),c.matrix=b.matrix.toArray,b.children.length>0){c.children=[];for(var e=0;e<b.children.length;e++)c.children.push(g(b.children[e]))}return c};return b.object=g(this),b},clone:function(b,c){if(void 0===b&&(b=new a.Object3D),void 0===c&&(c=!0),b.name=this.name,b.up.copy(this.up),b.position.copy(this.position),b.quaternion.copy(this.quaternion),b.scale.copy(this.scale),b.rotationAutoUpdate=this.rotationAutoUpdate,b.matrix.copy(this.matrix),b.matrixWorld.copy(this.matrixWorld),b.matrixAutoUpdate=this.matrixAutoUpdate,b.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate,b.visible=this.visible,b.castShadow=this.castShadow,b.receiveShadow=this.receiveShadow,b.frustumCulled=this.frustumCulled,b.userData=JSON.parse(JSON.stringify(this.userData)),c===!0)for(var d=0;d<this.children.length;d++){var e=this.children[d];b.add(e.clone)}return b}},a.EventDispatcher.prototype.apply(a.Object3D.prototype),a.Object3DIdCount=0,a.Face3=function(b,c,d,e,f,g){this.a=b,this.b=c,this.c=d,this.normal=e instanceof a.Vector3?e:new a.Vector3,this.vertexNormals=e instanceof Array?e:[],this.color=f instanceof a.Color?f:new a.Color,this.vertexColors=f instanceof Array?f:[],this.vertexTangents=[],this.materialIndex=void 0!==g?g:0},a.Face3.prototype={constructor:a.Face3,clone:function{var b=new a.Face3(this.a,this.b,this.c);b.normal.copy(this.normal),b.color.copy(this.color),b.materialIndex=this.materialIndex;for(var c=0,d=this.vertexNormals.length;d>c;c++)b.vertexNormals[c]=this.vertexNormals[c].clone;for(var c=0,d=this.vertexColors.length;d>c;c++)b.vertexColors[c]=this.vertexColors[c].clone;for(var c=0,d=this.vertexTangents.length;d>c;c++)b.vertexTangents[c]=this.vertexTangents[c].clone;return b}},a.Face4=function(b,c,d,e,f,g,h){return a.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new a.Face3(b,c,d,f,g,h)},a.BufferAttribute=function(a,b){this.array=a,this.itemSize=b,this.needsUpdate=!1},a.BufferAttribute.prototype={constructor:a.BufferAttribute,get length{return this.array.length},copyAt:function(a,b,c){a*=this.itemSize,c*=b.itemSize;for(var d=0,e=this.itemSize;e>d;d++)this.array[a+d]=b.array[c+d];return this},set:function(a,b){return void 0===b&&(b=0),this.array.set(a,b),this},setX:function(a,b){return this.array[a*this.itemSize]=b,this},setY:function(a,b){return this.array[a*this.itemSize+1]=b,this},setZ:function(a,b){return this.array[a*this.itemSize+2]=b,this},setXY:function(a,b,c){return a*=this.itemSize,this.array[a]=b,this.array[a+1]=c,this},setXYZ:function(a,b,c,d){return a*=this.itemSize,this.array[a]=b,this.array[a+1]=c,this.array[a+2]=d,this},setXYZW:function(a,b,c,d,e){return a*=this.itemSize,this.array[a]=b,this.array[a+1]=c,this.array[a+2]=d,this.array[a+3]=e,this},clone:function{return new a.BufferAttribute(new this.array.constructor(this.array),this.itemSize)}},a.Int8Attribute=function(b,c){return a.warn("THREE.Int8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new a.BufferAttribute(b,c)},a.Uint8Attribute=function(b,c){return a.warn("THREE.Uint8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new a.BufferAttribute(b,c)},a.Uint8ClampedAttribute=function(b,c){return a.warn("THREE.Uint8ClampedAttribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new a.BufferAttribute(b,c)},a.Int16Attribute=function(b,c){return a.warn("THREE.Int16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new a.BufferAttribute(b,c)},a.Uint16Attribute=function(b,c){return a.warn("THREE.Uint16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new a.BufferAttribute(b,c)},a.Int32Attribute=function(b,c){return a.warn("THREE.Int32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new a.BufferAttribute(b,c)},a.Uint32Attribute=function(b,c){return a.warn("THREE.Uint32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new a.BufferAttribute(b,c)},a.Float32Attribute=function(b,c){return a.warn("THREE.Float32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new a.BufferAttribute(b,c)},a.Float64Attribute=function(b,c){return a.warn("THREE.Float64Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new a.BufferAttribute(b,c)},a.DynamicBufferAttribute=function(b,c){a.BufferAttribute.call(this,b,c),this.updateRange={offset:0,count:-1}},a.DynamicBufferAttribute.prototype=Object.create(a.BufferAttribute.prototype),a.DynamicBufferAttribute.prototype.constructor=a.DynamicBufferAttribute,a.DynamicBufferAttribute.prototype.clone=function{return new a.DynamicBufferAttribute(new this.array.constructor(this.array),this.itemSize)},a.BufferGeometry=function{Object.defineProperty(this,"id",{value:a.GeometryIdCount++}),this.uuid=a.Math.generateUUID,this.name="",this.type="BufferGeometry",this.attributes={},this.attributesKeys=[],this.drawcalls=[],this.offsets=this.drawcalls,this.boundingBox=null,this.boundingSphere=null},a.BufferGeometry.prototype={constructor:a.BufferGeometry,addAttribute:function(b,c){return c instanceof a.BufferAttribute==!1?(a.warn("THREE.BufferGeometry: .addAttribute now expects ( name, attribute )."),void(this.attributes[b]={array:arguments[1],itemSize:arguments[2]})):(this.attributes[b]=c,void(this.attributesKeys=Object.keys(this.attributes)))},getAttribute:function(a){return this.attributes[a]},addDrawCall:function(a,b,c){this.drawcalls.push({start:a,count:b,index:void 0!==c?c:0})},applyMatrix:function(b){var c=this.attributes.position;void 0!==c&&(b.applyToVector3Array(c.array),c.needsUpdate=!0);var d=this.attributes.normal;if(void 0!==d){var e=(new a.Matrix3).getNormalMatrix(b);e.applyToVector3Array(d.array),d.needsUpdate=!0}null!==this.boundingBox&&this.computeBoundingBox,null!==this.boundingSphere&&this.computeBoundingSphere},center:function{this.computeBoundingBox;var b=this.boundingBox.center.negate;return this.applyMatrix((new a.Matrix4).setPosition(b)),b},fromGeometry:function(b,c){c=c||{vertexColors:a.NoColors};var d=b.vertices,e=b.faces,f=b.faceVertexUvs,g=c.vertexColors,h=f[0].length>0,i=3==e[0].vertexNormals.length,j=new Float32Array(3*e.length*3);this.addAttribute("position",new a.BufferAttribute(j,3));var k=new Float32Array(3*e.length*3);if(this.addAttribute("normal",new a.BufferAttribute(k,3)),g!==a.NoColors){var l=new Float32Array(3*e.length*3);this.addAttribute("color",new a.BufferAttribute(l,3))}if(h===!0){var m=new Float32Array(3*e.length*2);this.addAttribute("uv",new a.BufferAttribute(m,2))}for(var n=0,o=0,p=0;n<e.length;n++,o+=6,p+=9){var q=e[n],r=d[q.a],s=d[q.b],t=d[q.c];if(j[p]=r.x,j[p+1]=r.y,j[p+2]=r.z,j[p+3]=s.x,j[p+4]=s.y,j[p+5]=s.z,j[p+6]=t.x,j[p+7]=t.y,j[p+8]=t.z,i===!0){var u=q.vertexNormals[0],v=q.vertexNormals[1],w=q.vertexNormals[2];k[p]=u.x,k[p+1]=u.y,k[p+2]=u.z,k[p+3]=v.x,k[p+4]=v.y,k[p+5]=v.z,k[p+6]=w.x,k[p+7]=w.y,k[p+8]=w.z}else{var x=q.normal;k[p]=x.x,k[p+1]=x.y,k[p+2]=x.z,k[p+3]=x.x,k[p+4]=x.y,k[p+5]=x.z,k[p+6]=x.x,k[p+7]=x.y,k[p+8]=x.z}if(g===a.FaceColors){var y=q.color;l[p]=y.r,l[p+1]=y.g,l[p+2]=y.b,l[p+3]=y.r,l[p+4]=y.g,l[p+5]=y.b,l[p+6]=y.r,l[p+7]=y.g,l[p+8]=y.b}else if(g===a.VertexColors){var z=q.vertexColors[0],A=q.vertexColors[1],B=q.vertexColors[2];l[p]=z.r,l[p+1]=z.g,l[p+2]=z.b,l[p+3]=A.r,l[p+4]=A.g,l[p+5]=A.b,l[p+6]=B.r,l[p+7]=B.g,l[p+8]=B.b}if(h===!0){var C=f[0][n][0],D=f[0][n][1],E=f[0][n][2];m[o]=C.x,m[o+1]=C.y,m[o+2]=D.x,m[o+3]=D.y,m[o+4]=E.x,m[o+5]=E.y}}return this.computeBoundingSphere,this},computeBoundingBox:function{var b=new a.Vector3;return function{null===this.boundingBox&&(this.boundingBox=new a.Box3);var c=this.attributes.position.array;if(c){var d=this.boundingBox;d.makeEmpty;for(var e=0,f=c.length;f>e;e+=3)b.set(c[e],c[e+1],c[e+2]),d.expandByPoint(b)}void 0!==c&&0!==c.length||(this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&a.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.')}},computeBoundingSphere:function{var b=new a.Box3,c=new a.Vector3;return function{null===this.boundingSphere&&(this.boundingSphere=new a.Sphere);var d=this.attributes.position.array;if(d){b.makeEmpty;for(var e=this.boundingSphere.center,f=0,g=d.length;g>f;f+=3)c.set(d[f],d[f+1],d[f+2]),b.expandByPoint(c);b.center(e);for(var h=0,f=0,g=d.length;g>f;f+=3)c.set(d[f],d[f+1],d[f+2]),h=Math.max(h,e.distanceToSquared(c));this.boundingSphere.radius=Math.sqrt(h),isNaN(this.boundingSphere.radius)&&a.error('THREE.BufferGeometry.computeBoundingSphere: Computed radius is NaN. The "position" attribute is likely to have NaN values.')}}},computeFaceNormals:function{},computeVertexNormals:function{var b=this.attributes;if(b.position){var c=b.position.array;if(void 0===b.normal)this.addAttribute("normal",new a.BufferAttribute(new Float32Array(c.length),3));else for(var d=b.normal.array,e=0,f=d.length;f>e;e++)d[e]=0;var g,h,i,d=b.normal.array,j=new a.Vector3,k=new a.Vector3,l=new a.Vector3,m=new a.Vector3,n=new a.Vector3;if(b.index)for(var o=b.index.array,p=this.offsets.length>0?this.offsets:[{start:0,count:o.length,index:0}],q=0,r=p.length;r>q;++q)for(var s=p[q].start,t=p[q].count,u=p[q].index,e=s,f=s+t;f>e;e+=3)g=3*(u+o[e]),h=3*(u+o[e+1]),i=3*(u+o[e+2]),j.fromArray(c,g),k.fromArray(c,h),l.fromArray(c,i),m.subVectors(l,k),n.subVectors(j,k),m.cross(n),d[g]+=m.x,d[g+1]+=m.y,d[g+2]+=m.z,d[h]+=m.x,d[h+1]+=m.y,d[h+2]+=m.z,d[i]+=m.x,d[i+1]+=m.y,d[i+2]+=m.z;else for(var e=0,f=c.length;f>e;e+=9)j.fromArray(c,e),k.fromArray(c,e+3),l.fromArray(c,e+6),m.subVectors(l,k),n.subVectors(j,k),m.cross(n),d[e]=m.x,d[e+1]=m.y,d[e+2]=m.z,d[e+3]=m.x,d[e+4]=m.y,d[e+5]=m.z,d[e+6]=m.x,d[e+7]=m.y,d[e+8]=m.z;this.normalizeNormals,b.normal.needsUpdate=!0}},computeTangents:function{function b(a,b,c){E.fromArray(e,3*a),F.fromArray(e,3*b),G.fromArray(e,3*c),H.fromArray(g,2*a),I.fromArray(g,2*b),J.fromArray(g,2*c),m=F.x-E.x,n=G.x-E.x,o=F.y-E.y,p=G.y-E.y,q=F.z-E.z,r=G.z-E.z,s=I.x-H.x,t=J.x-H.x,u=I.y-H.y,v=J.y-H.y,w=1/(s*v-t*u),K.set((v*m-u*n)*w,(v*o-u*p)*w,(v*q-u*r)*w),L.set((s*n-t*m)*w,(s*p-t*o)*w,(s*r-t*q)*w),j[a].add(K),j[b].add(K),j[c].add(K),k[a].add(L),k[b].add(L),k[c].add(L)}function c(a){V.fromArray(f,3*a),W.copy(V),R=j[a],T.copy(R),T.sub(V.multiplyScalar(V.dot(R))).normalize,U.crossVectors(W,R),S=U.dot(k[a]),Q=0>S?-1:1,i[4*a]=T.x,i[4*a+1]=T.y,i[4*a+2]=T.z,i[4*a+3]=Q}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)return void a.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents");var d=this.attributes.index.array,e=this.attributes.position.array,f=this.attributes.normal.array,g=this.attributes.uv.array,h=e.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new a.BufferAttribute(new Float32Array(4*h),4));for(var i=this.attributes.tangent.array,j=[],k=[],l=0;h>l;l++)j[l]=new a.Vector3,k[l]=new a.Vector3;var m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E=new a.Vector3,F=new a.Vector3,G=new a.Vector3,H=new a.Vector2,I=new a.Vector2,J=new a.Vector2,K=new a.Vector3,L=new a.Vector3;0===this.drawcalls.length&&this.addDrawCall(0,d.length,0);var M=this.drawcalls;for(z=0,A=M.length;A>z;++z){var N=M[z].start,O=M[z].count,P=M[z].index;for(x=N,y=N+O;y>x;x+=3)B=P+d[x],C=P+d[x+1],D=P+d[x+2],b(B,C,D)}var Q,R,S,T=new a.Vector3,U=new a.Vector3,V=new a.Vector3,W=new a.Vector3;for(z=0,A=M.length;A>z;++z){var N=M[z].start,O=M[z].count,P=M[z].index;for(x=N,y=N+O;y>x;x+=3)B=P+d[x],C=P+d[x+1],D=P+d[x+2],c(B),c(C),c(D)}},computeOffsets:function(a){void 0===a&&(a=65535);for(var b=this.attributes.index.array,c=this.attributes.position.array,d=b.length/3,e=new Uint16Array(b.length),f=0,g=0,h=[{start:0,count:0,index:0}],i=h[0],j=0,k=0,l=new Int32Array(6),m=new Int32Array(c.length),n=new Int32Array(c.length),o=0;o<c.length;o++)m[o]=-1,n[o]=-1;for(var p=0;d>p;p++){k=0;for(var q=0;3>q;q++){var r=b[3*p+q];-1==m[r]?(l[2*q]=r,l[2*q+1]=-1,k++):m[r]<i.index?(l[2*q]=r,l[2*q+1]=-1,j++):(l[2*q]=r,l[2*q+1]=m[r])}var s=g+k;if(s>i.index+a){var t={start:f,count:0,index:g};h.push(t),i=t;for(var u=0;6>u;u+=2){var v=l[u+1];v>-1&&v<i.index&&(l[u+1]=-1)}}for(var u=0;6>u;u+=2){var r=l[u],v=l[u+1];-1===v&&(v=g++),m[r]=v,n[v]=r,e[f++]=v-i.index,i.count++}}return this.reorderBuffers(e,n,g),this.offsets=h,this.drawcalls=h,h},merge:function(b,c){if(b instanceof a.BufferGeometry==!1)return void a.error("THREE.BufferGeometry.merge: geometry not an instance of THREE.BufferGeometry.",b);void 0===c&&(c=0);var d=this.attributes;for(var e in d)if(void 0!==b.attributes[e])for(var f=d[e],g=f.array,h=b.attributes[e],i=h.array,j=h.itemSize,k=0,l=j*c;k<i.length;k++,l++)g[l]=i[k];return this},normalizeNormals:function{for(var a,b,c,d,e=this.attributes.normal.array,f=0,g=e.length;g>f;f+=3)a=e[f],b=e[f+1],c=e[f+2],d=1/Math.sqrt(a*a+b*b+c*c),e[f]*=d,e[f+1]*=d,e[f+2]*=d},reorderBuffers:function(a,b,c){var d={};for(var e in this.attributes)if("index"!=e){var f=this.attributes[e].array;d[e]=new f.constructor(this.attributes[e].itemSize*c)}for(var g=0;c>g;g++){var h=b[g];for(var e in this.attributes)if("index"!=e)for(var i=this.attributes[e].array,j=this.attributes[e].itemSize,k=d[e],l=0;j>l;l++)k[g*j+l]=i[h*j+l]}this.attributes.index.array=a;for(var e in this.attributes)"index"!=e&&(this.attributes[e].array=d[e],this.attributes[e].numItems=this.attributes[e].itemSize*c)},toJSON:function{var a={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type,data:{attributes:{}}},b=this.attributes,c=this.offsets,d=this.boundingSphere;for(var e in b){var f=b[e],g=Array.prototype.slice.call(f.array);a.data.attributes[e]={itemSize:f.itemSize,type:f.array.constructor.name,array:g}}return c.length>0&&(a.data.offsets=JSON.parse(JSON.stringify(c))),null!==d&&(a.data.boundingSphere={center:d.center.toArray,radius:d.radius}),a},clone:function{var b=new a.BufferGeometry;for(var c in this.attributes){var d=this.attributes[c];b.addAttribute(c,d.clone)}for(var e=0,f=this.offsets.length;f>e;e++){var g=this.offsets[e];b.offsets.push({start:g.start,index:g.index,count:g.count})}return b},dispose:function{this.dispatchEvent({type:"dispose"})}},a.EventDispatcher.prototype.apply(a.BufferGeometry.prototype),a.Geometry=function{Object.defineProperty(this,"id",{value:a.GeometryIdCount++}),this.uuid=a.Math.generateUUID,this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=,this.morphTargets=[],this.morphColors=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.hasTangents=!1,this.dynamic=!0,this.verticesNeedUpdate=!1,this.elementsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.tangentsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1},a.Geometry.prototype={constructor:a.Geometry,applyMatrix:function(b){for(var c=(new a.Matrix3).getNormalMatrix(b),d=0,e=this.vertices.length;e>d;d++){var f=this.vertices[d];f.applyMatrix4(b)}for(var d=0,e=this.faces.length;e>d;d++){var g=this.faces[d];g.normal.applyMatrix3(c).normalize;for(var h=0,i=g.vertexNormals.length;i>h;h++)g.vertexNormals[h].applyMatrix3(c).normalize}null!==this.boundingBox&&this.computeBoundingBox,null!==this.boundingSphere&&this.computeBoundingSphere,this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0},fromBufferGeometry:function(b){for(var c=this,d=b.attributes,e=d.position.array,f=void 0!==d.index?d.index.array:void 0,g=void 0!==d.normal?d.normal.array:void 0,h=void 0!==d.color?d.color.array:void 0,i=void 0!==d.uv?d.uv.array:void 0,j=[],k=[],l=0,m=0;l<e.length;l+=3,m+=2)c.vertices.push(new a.Vector3(e[l],e[l+1],e[l+2])),void 0!==g&&j.push(new a.Vector3(g[l],g[l+1],g[l+2])),void 0!==h&&c.colors.push(new a.Color(h[l],h[l+1],h[l+2])),void 0!==i&&k.push(new a.Vector2(i[m],i[m+1]));var n=function(b,d,e){var f=void 0!==g?[j[b].clone,j[d].clone,j[e].clone]:[],l=void 0!==h?[c.colors[b].clone,c.colors[d].clone,c.colors[e].clone]:[];c.faces.push(new a.Face3(b,d,e,f,l)),void 0!==i&&c.faceVertexUvs[0].push([k[b].clone,k[d].clone,k[e].clone])};if(void 0!==f){var o=b.drawcalls;if(o.length>0)for(var l=0;l<o.length;l++)for(var p=o[l],q=p.start,r=p.count,s=p.index,m=q,t=q+r;t>m;m+=3)n(s+f[m],s+f[m+1],s+f[m+2]);else for(var l=0;l<f.length;l+=3)n(f[l],f[l+1],f[l+2])}else for(var l=0;l<e.length/3;l+=3)n(l,l+1,l+2);return this.computeFaceNormals,null!==b.boundingBox&&(this.boundingBox=b.boundingBox.clone),null!==b.boundingSphere&&(this.boundingSphere=b.boundingSphere.clone),this},center:function{this.computeBoundingBox;var b=this.boundingBox.center.negate;return this.applyMatrix((new a.Matrix4).setPosition(b)),b},computeFaceNormals:function{for(var b=new a.Vector3,c=new a.Vector3,d=0,e=this.faces.length;e>d;d++){var f=this.faces[d],g=this.vertices[f.a],h=this.vertices[f.b],i=this.vertices[f.c];b.subVectors(i,h),c.subVectors(g,h),b.cross(c),b.normalize,f.normal.copy(b)}},computeVertexNormals:function(b){var c,d,e,f,g,h;for(h=new Array(this.vertices.length),c=0,d=this.vertices.length;d>c;c++)h[c]=new a.Vector3;if(b){var i,j,k,l=new a.Vector3,m=new a.Vector3;for(e=0,f=this.faces.length;f>e;e++)g=this.faces[e],i=this.vertices[g.a],j=this.vertices[g.b],k=this.vertices[g.c],l.subVectors(k,j),m.subVectors(i,j),l.cross(m),h[g.a].add(l),h[g.b].add(l),h[g.c].add(l)}else for(e=0,f=this.faces.length;f>e;e++)g=this.faces[e],h[g.a].add(g.normal),h[g.b].add(g.normal),h[g.c].add(g.normal);for(c=0,d=this.vertices.length;d>c;c++)h[c].normalize;for(e=0,f=this.faces.length;f>e;e++)g=this.faces[e],g.vertexNormals[0]=h[g.a].clone,g.vertexNormals[1]=h[g.b].clone,g.vertexNormals[2]=h[g.c].clone},computeMorphNormals:function{var b,c,d,e,f;for(d=0,e=this.faces.length;e>d;d++)for(f=this.faces[d],f.__originalFaceNormal?f.__originalFaceNormal.copy(f.normal):f.__originalFaceNormal=f.normal.clone,f.__originalVertexNormals||(f.__originalVertexNormals=[]),b=0,c=f.vertexNormals.length;c>b;b++)f.__originalVertexNormals[b]?f.__originalVertexNormals[b].copy(f.vertexNormals[b]):f.__originalVertexNormals[b]=f.vertexNormals[b].clone;var g=new a.Geometry;for(g.faces=this.faces,b=0,c=this.morphTargets.length;c>b;b++){if(!this.morphNormals[b]){this.morphNormals[b]={},this.morphNormals[b].faceNormals=[],this.morphNormals[b].vertexNormals=[];var h,i,j=this.morphNormals[b].faceNormals,k=this.morphNormals[b].vertexNormals;for(d=0,e=this.faces.length;e>d;d++)h=new a.Vector3,i={a:new a.Vector3,b:new a.Vector3,c:new a.Vector3},j.push(h),k.push(i)}var l=this.morphNormals[b];g.vertices=this.morphTargets[b].vertices,g.computeFaceNormals,g.computeVertexNormals;var h,i;for(d=0,e=this.faces.length;e>d;d++)f=this.faces[d],h=l.faceNormals[d],i=l.vertexNormals[d],h.copy(f.normal),i.a.copy(f.vertexNormals[0]),i.b.copy(f.vertexNormals[1]),i.c.copy(f.vertexNormals[2])}for(d=0,e=this.faces.length;e>d;d++)f=this.faces[d],f.normal=f.__originalFaceNormal,f.vertexNormals=f.__originalVertexNormals},computeTangents:function{function b(a,b,c,d,e,f,g){k=a.vertices[b],l=a.vertices[c],m=a.vertices[d],n=j[e],o=j[f],p=j[g],q=l.x-k.x,r=m.x-k.x,s=l.y-k.y,t=m.y-k.y,u=l.z-k.z,v=m.z-k.z,w=o.x-n.x,x=p.x-n.x,y=o.y-n.y,z=p.y-n.y,A=1/(w*z-x*y),G.set((z*q-y*r)*A,(z*s-y*t)*A,(z*u-y*v)*A),H.set((w*r-x*q)*A,(w*t-x*s)*A,(w*v-x*u)*A),E[b].add(G),E[c].add(G),E[d].add(G),F[b].add(H),F[c].add(H),F[d].add(H)}var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E=[],F=[],G=new a.Vector3,H=new a.Vector3,I=new a.Vector3,J=new a.Vector3,K=new a.Vector3;for(e=0,f=this.vertices.length;f>e;e++)E[e]=new a.Vector3,F[e]=new a.Vector3;for(c=0,d=this.faces.length;d>c;c++)i=this.faces[c],j=this.faceVertexUvs[0][c],b(this,i.a,i.b,i.c,0,1,2);var L=["a","b","c","d"];for(c=0,d=this.faces.length;d>c;c++)for(i=this.faces[c],g=0;g<Math.min(i.vertexNormals.length,3);g++)K.copy(i.vertexNormals[g]),h=i[L[g]],B=E[h],I.copy(B),I.sub(K.multiplyScalar(K.dot(B))).normalize,J.crossVectors(i.vertexNormals[g],B),C=J.dot(F[h]),D=0>C?-1:1,i.vertexTangents[g]=new a.Vector4(I.x,I.y,I.z,D);this.hasTangents=!0},computeLineDistances:function{for(var a=0,b=this.vertices,c=0,d=b.length;d>c;c++)c>0&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function{null===this.boundingBox&&(this.boundingBox=new a.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function{null===this.boundingSphere&&(this.boundingSphere=new a.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(b,c,d){if(b instanceof a.Geometry==!1)return void a.error("THREE.Geometry.merge: geometry not an instance of THREE.Geometry.",b);var e,f=this.vertices.length,g=this.vertices,h=b.vertices,i=this.faces,j=b.faces,k=this.faceVertexUvs[0],l=b.faceVertexUvs[0];void 0===d&&(d=0),void 0!==c&&(e=(new a.Matrix3).getNormalMatrix(c));for(var m=0,n=h.length;n>m;m++){var o=h[m],p=o.clone;void 0!==c&&p.applyMatrix4(c),g.push(p)}for(m=0,n=j.length;n>m;m++){var q,r,s,t=j[m],u=t.vertexNormals,v=t.vertexColors;q=new a.Face3(t.a+f,t.b+f,t.c+f),q.normal.copy(t.normal),void 0!==e&&q.normal.applyMatrix3(e).normalize;for(var w=0,x=u.length;x>w;w++)r=u[w].clone,void 0!==e&&r.applyMatrix3(e).normalize,q.vertexNormals.push(r);q.color.copy(t.color);for(var w=0,x=v.length;x>w;w++)s=v[w],q.vertexColors.push(s.clone);q.materialIndex=t.materialIndex+d,i.push(q)}for(m=0,n=l.length;n>m;m++){var y=l[m],z=[];if(void 0!==y){for(var w=0,x=y.length;x>w;w++)z.push(y[w].clone);k.push(z)}}},mergeMesh:function(b){return b instanceof a.Mesh==!1?void a.error("THREE.Geometry.mergeMesh: mesh not an instance of THREE.Mesh.",b):(b.matrixAutoUpdate&&b.updateMatrix,void this.merge(b.geometry,b.matrix)); },mergeVertices:function{var a,b,c,d,e,f,g,h,i={},j=[],k=[],l=4,m=Math.pow(10,l);for(c=0,d=this.vertices.length;d>c;c++)a=this.vertices[c],b=Math.round(a.x*m)+"_"+Math.round(a.y*m)+"_"+Math.round(a.z*m),void 0===i[b]?(i[b]=c,j.push(this.vertices[c]),k[c]=j.length-1):k[c]=k[i[b]];var n=[];for(c=0,d=this.faces.length;d>c;c++){e=this.faces[c],e.a=k[e.a],e.b=k[e.b],e.c=k[e.c],f=[e.a,e.b,e.c];for(var o=-1,p=0;3>p;p++)if(f[p]==f[(p+1)%3]){o=p,n.push(c);break}}for(c=n.length-1;c>=0;c--){var q=n[c];for(this.faces.splice(q,1),g=0,h=this.faceVertexUvs.length;h>g;g++)this.faceVertexUvs[g].splice(q,1)}var r=this.vertices.length-j.length;return this.vertices=j,r},toJSON:function{function a(a,b,c){return c?a|1<<b:a&~(1<<b)}function b(a){var b=a.x.toString+a.y.toString+a.z.toString;return void 0!==m[b]?m[b]:(m[b]=l.length/3,l.push(a.x,a.y,a.z),m[b])}function c(a){var b=a.r.toString+a.g.toString+a.b.toString;return void 0!==o[b]?o[b]:(o[b]=n.length,n.push(a.getHex),o[b])}function d(a){var b=a.x.toString+a.y.toString;return void 0!==q[b]?q[b]:(q[b]=p.length/2,p.push(a.x,a.y),q[b])}var e={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type};if(""!==this.name&&(e.name=this.name),void 0!==this.parameters){var f=this.parameters;for(var g in f)void 0!==f[g]&&(e[g]=f[g]);return e}for(var h=[],i=0;i<this.vertices.length;i++){var j=this.vertices[i];h.push(j.x,j.y,j.z)}for(var k=[],l=[],m={},n=[],o={},p=[],q={},i=0;i<this.faces.length;i++){var r=this.faces[i],s=!1,t=!1,u=void 0!==this.faceVertexUvs[0][i],v=r.normal.length>0,w=r.vertexNormals.length>0,x=1!==r.color.r||1!==r.color.g||1!==r.color.b,y=r.vertexColors.length>0,z=0;if(z=a(z,0,0),z=a(z,1,s),z=a(z,2,t),z=a(z,3,u),z=a(z,4,v),z=a(z,5,w),z=a(z,6,x),z=a(z,7,y),k.push(z),k.push(r.a,r.b,r.c),u){var A=this.faceVertexUvs[0][i];k.push(d(A[0]),d(A[1]),d(A[2]))}if(v&&k.push(b(r.normal)),w){var B=r.vertexNormals;k.push(b(B[0]),b(B[1]),b(B[2]))}if(x&&k.push(c(r.color)),y){var C=r.vertexColors;k.push(c(C[0]),c(C[1]),c(C[2]))}}return e.data={},e.data.vertices=h,e.data.normals=l,n.length>0&&(e.data.colors=n),p.length>0&&(e.data.uvs=[p]),e.data.faces=k,e},clone:function{for(var b=new a.Geometry,c=this.vertices,d=0,e=c.length;e>d;d++)b.vertices.push(c[d].clone);for(var f=this.faces,d=0,e=f.length;e>d;d++)b.faces.push(f[d].clone);for(var d=0,e=this.faceVertexUvs.length;e>d;d++){var g=this.faceVertexUvs[d];void 0===b.faceVertexUvs[d]&&(b.faceVertexUvs[d]=[]);for(var h=0,i=g.length;i>h;h++){for(var j=g[h],k=[],l=0,m=j.length;m>l;l++){var n=j[l];k.push(n.clone)}b.faceVertexUvs[d].push(k)}}return b},dispose:function{this.dispatchEvent({type:"dispose"})}},a.EventDispatcher.prototype.apply(a.Geometry.prototype),a.GeometryIdCount=0,a.Camera=function{a.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new a.Matrix4,this.projectionMatrix=new a.Matrix4},a.Camera.prototype=Object.create(a.Object3D.prototype),a.Camera.prototype.constructor=a.Camera,a.Camera.prototype.getWorldDirection=function{var b=new a.Quaternion;return function(c){var d=c||new a.Vector3;return this.getWorldQuaternion(b),d.set(0,0,-1).applyQuaternion(b)}},a.Camera.prototype.lookAt=function{var b=new a.Matrix4;return function(a){b.lookAt(this.position,a,this.up),this.quaternion.setFromRotationMatrix(b)}},a.Camera.prototype.clone=function(b){return void 0===b&&(b=new a.Camera),a.Object3D.prototype.clone.call(this,b),b.matrixWorldInverse.copy(this.matrixWorldInverse),b.projectionMatrix.copy(this.projectionMatrix),b},a.CubeCamera=function(b,c,d){a.Object3D.call(this),this.type="CubeCamera";var e=90,f=1,g=new a.PerspectiveCamera(e,f,b,c);g.up.set(0,-1,0),g.lookAt(new a.Vector3(1,0,0)),this.add(g);var h=new a.PerspectiveCamera(e,f,b,c);h.up.set(0,-1,0),h.lookAt(new a.Vector3(-1,0,0)),this.add(h);var i=new a.PerspectiveCamera(e,f,b,c);i.up.set(0,0,1),i.lookAt(new a.Vector3(0,1,0)),this.add(i);var j=new a.PerspectiveCamera(e,f,b,c);j.up.set(0,0,-1),j.lookAt(new a.Vector3(0,-1,0)),this.add(j);var k=new a.PerspectiveCamera(e,f,b,c);k.up.set(0,-1,0),k.lookAt(new a.Vector3(0,0,1)),this.add(k);var l=new a.PerspectiveCamera(e,f,b,c);l.up.set(0,-1,0),l.lookAt(new a.Vector3(0,0,-1)),this.add(l),this.renderTarget=new a.WebGLRenderTargetCube(d,d,{format:a.RGBFormat,magFilter:a.LinearFilter,minFilter:a.LinearFilter}),this.updateCubeMap=function(a,b){var c=this.renderTarget,d=c.generateMipmaps;c.generateMipmaps=!1,c.activeCubeFace=0,a.render(b,g,c),c.activeCubeFace=1,a.render(b,h,c),c.activeCubeFace=2,a.render(b,i,c),c.activeCubeFace=3,a.render(b,j,c),c.activeCubeFace=4,a.render(b,k,c),c.generateMipmaps=d,c.activeCubeFace=5,a.render(b,l,c)}},a.CubeCamera.prototype=Object.create(a.Object3D.prototype),a.CubeCamera.prototype.constructor=a.CubeCamera,a.OrthographicCamera=function(b,c,d,e,f,g){a.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.left=b,this.right=c,this.top=d,this.bottom=e,this.near=void 0!==f?f:.1,this.far=void 0!==g?g:2e3,this.updateProjectionMatrix},a.OrthographicCamera.prototype=Object.create(a.Camera.prototype),a.OrthographicCamera.prototype.constructor=a.OrthographicCamera,a.OrthographicCamera.prototype.updateProjectionMatrix=function{var a=(this.right-this.left)/(2*this.zoom),b=(this.top-this.bottom)/(2*this.zoom),c=(this.right+this.left)/2,d=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(c-a,c+a,d+b,d-b,this.near,this.far)},a.OrthographicCamera.prototype.clone=function{var b=new a.OrthographicCamera;return a.Camera.prototype.clone.call(this,b),b.zoom=this.zoom,b.left=this.left,b.right=this.right,b.top=this.top,b.bottom=this.bottom,b.near=this.near,b.far=this.far,b.projectionMatrix.copy(this.projectionMatrix),b},a.PerspectiveCamera=function(b,c,d,e){a.Camera.call(this),this.type="PerspectiveCamera",this.zoom=1,this.fov=void 0!==b?b:50,this.aspect=void 0!==c?c:1,this.near=void 0!==d?d:.1,this.far=void 0!==e?e:2e3,this.updateProjectionMatrix},a.PerspectiveCamera.prototype=Object.create(a.Camera.prototype),a.PerspectiveCamera.prototype.constructor=a.PerspectiveCamera,a.PerspectiveCamera.prototype.setLens=function(b,c){void 0===c&&(c=24),this.fov=2*a.Math.radToDeg(Math.atan(c/(2*b))),this.updateProjectionMatrix},a.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a,this.fullHeight=b,this.x=c,this.y=d,this.width=e,this.height=f,this.updateProjectionMatrix},a.PerspectiveCamera.prototype.updateProjectionMatrix=function{var b=a.Math.radToDeg(2*Math.atan(Math.tan(.5*a.Math.degToRad(this.fov))/this.zoom));if(this.fullWidth){var c=this.fullWidth/this.fullHeight,d=Math.tan(a.Math.degToRad(.5*b))*this.near,e=-d,f=c*e,g=c*d,h=Math.abs(g-f),i=Math.abs(d-e);this.projectionMatrix.makeFrustum(f+this.x*h/this.fullWidth,f+(this.x+this.width)*h/this.fullWidth,d-(this.y+this.height)*i/this.fullHeight,d-this.y*i/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(b,this.aspect,this.near,this.far)},a.PerspectiveCamera.prototype.clone=function{var b=new a.PerspectiveCamera;return a.Camera.prototype.clone.call(this,b),b.zoom=this.zoom,b.fov=this.fov,b.aspect=this.aspect,b.near=this.near,b.far=this.far,b.projectionMatrix.copy(this.projectionMatrix),b},a.Light=function(b){a.Object3D.call(this),this.type="Light",this.color=new a.Color(b)},a.Light.prototype=Object.create(a.Object3D.prototype),a.Light.prototype.constructor=a.Light,a.Light.prototype.clone=function(b){return void 0===b&&(b=new a.Light),a.Object3D.prototype.clone.call(this,b),b.color.copy(this.color),b},a.AmbientLight=function(b){a.Light.call(this,b),this.type="AmbientLight"},a.AmbientLight.prototype=Object.create(a.Light.prototype),a.AmbientLight.prototype.constructor=a.AmbientLight,a.AmbientLight.prototype.clone=function{var b=new a.AmbientLight;return a.Light.prototype.clone.call(this,b),b},a.AreaLight=function(b,c){a.Light.call(this,b),this.type="AreaLight",this.normal=new a.Vector3(0,-1,0),this.right=new a.Vector3(1,0,0),this.intensity=void 0!==c?c:1,this.width=1,this.height=1,this.constantAttenuation=1.5,this.linearAttenuation=.5,this.quadraticAttenuation=.1},a.AreaLight.prototype=Object.create(a.Light.prototype),a.AreaLight.prototype.constructor=a.AreaLight,a.DirectionalLight=function(b,c){a.Light.call(this,b),this.type="DirectionalLight",this.position.set(0,1,0),this.target=new a.Object3D,this.intensity=void 0!==c?c:1,this.castShadow=!1,this.onlyShadow=!1,this.shadowCameraNear=50,this.shadowCameraFar=5e3,this.shadowCameraLeft=-500,this.shadowCameraRight=500,this.shadowCameraTop=500,this.shadowCameraBottom=-500,this.shadowCameraVisible=!1,this.shadowBias=0,this.shadowDarkness=.5,this.shadowMapWidth=512,this.shadowMapHeight=512,this.shadowCascade=!1,this.shadowCascadeOffset=new a.Vector3(0,0,-1e3),this.shadowCascadeCount=2,this.shadowCascadeBias=[0,0,0],this.shadowCascadeWidth=[512,512,512],this.shadowCascadeHeight=[512,512,512],this.shadowCascadeNearZ=[-1,.99,.998],this.shadowCascadeFarZ=[.99,.998,1],this.shadowCascadeArray=[],this.shadowMap=null,this.shadowMapSize=null,this.shadowCamera=null,this.shadowMatrix=null},a.DirectionalLight.prototype=Object.create(a.Light.prototype),a.DirectionalLight.prototype.constructor=a.DirectionalLight,a.DirectionalLight.prototype.clone=function{var b=new a.DirectionalLight;return a.Light.prototype.clone.call(this,b),b.target=this.target.clone,b.intensity=this.intensity,b.castShadow=this.castShadow,b.onlyShadow=this.onlyShadow,b.shadowCameraNear=this.shadowCameraNear,b.shadowCameraFar=this.shadowCameraFar,b.shadowCameraLeft=this.shadowCameraLeft,b.shadowCameraRight=this.shadowCameraRight,b.shadowCameraTop=this.shadowCameraTop,b.shadowCameraBottom=this.shadowCameraBottom,b.shadowCameraVisible=this.shadowCameraVisible,b.shadowBias=this.shadowBias,b.shadowDarkness=this.shadowDarkness,b.shadowMapWidth=this.shadowMapWidth,b.shadowMapHeight=this.shadowMapHeight,b.shadowCascade=this.shadowCascade,b.shadowCascadeOffset.copy(this.shadowCascadeOffset),b.shadowCascadeCount=this.shadowCascadeCount,b.shadowCascadeBias=this.shadowCascadeBias.slice(0),b.shadowCascadeWidth=this.shadowCascadeWidth.slice(0),b.shadowCascadeHeight=this.shadowCascadeHeight.slice(0),b.shadowCascadeNearZ=this.shadowCascadeNearZ.slice(0),b.shadowCascadeFarZ=this.shadowCascadeFarZ.slice(0),b},a.HemisphereLight=function(b,c,d){a.Light.call(this,b),this.type="HemisphereLight",this.position.set(0,100,0),this.groundColor=new a.Color(c),this.intensity=void 0!==d?d:1},a.HemisphereLight.prototype=Object.create(a.Light.prototype),a.HemisphereLight.prototype.constructor=a.HemisphereLight,a.HemisphereLight.prototype.clone=function{var b=new a.HemisphereLight;return a.Light.prototype.clone.call(this,b),b.groundColor.copy(this.groundColor),b.intensity=this.intensity,b},a.PointLight=function(b,c,d,e){a.Light.call(this,b),this.type="PointLight",this.intensity=void 0!==c?c:1,this.distance=void 0!==d?d:0,this.decay=void 0!==e?e:1},a.PointLight.prototype=Object.create(a.Light.prototype),a.PointLight.prototype.constructor=a.PointLight,a.PointLight.prototype.clone=function{var b=new a.PointLight;return a.Light.prototype.clone.call(this,b),b.intensity=this.intensity,b.distance=this.distance,b.decay=this.decay,b},a.SpotLight=function(b,c,d,e,f,g){a.Light.call(this,b),this.type="SpotLight",this.position.set(0,1,0),this.target=new a.Object3D,this.intensity=void 0!==c?c:1,this.distance=void 0!==d?d:0,this.angle=void 0!==e?e:Math.PI/3,this.exponent=void 0!==f?f:10,this.decay=void 0!==g?g:1,this.castShadow=!1,this.onlyShadow=!1,this.shadowCameraNear=50,this.shadowCameraFar=5e3,this.shadowCameraFov=50,this.shadowCameraVisible=!1,this.shadowBias=0,this.shadowDarkness=.5,this.shadowMapWidth=512,this.shadowMapHeight=512,this.shadowMap=null,this.shadowMapSize=null,this.shadowCamera=null,this.shadowMatrix=null},a.SpotLight.prototype=Object.create(a.Light.prototype),a.SpotLight.prototype.constructor=a.SpotLight,a.SpotLight.prototype.clone=function{var b=new a.SpotLight;return a.Light.prototype.clone.call(this,b),b.target=this.target.clone,b.intensity=this.intensity,b.distance=this.distance,b.angle=this.angle,b.exponent=this.exponent,b.decay=this.decay,b.castShadow=this.castShadow,b.onlyShadow=this.onlyShadow,b.shadowCameraNear=this.shadowCameraNear,b.shadowCameraFar=this.shadowCameraFar,b.shadowCameraFov=this.shadowCameraFov,b.shadowCameraVisible=this.shadowCameraVisible,b.shadowBias=this.shadowBias,b.shadowDarkness=this.shadowDarkness,b.shadowMapWidth=this.shadowMapWidth,b.shadowMapHeight=this.shadowMapHeight,b},a.Cache={files:{},add:function(a,b){this.files[a]=b},get:function(a){return this.files[a]},remove:function(a){delete this.files[a]},clear:function{this.files={}}},a.Loader=function(b){this.showStatus=b,this.statusDomElement=b?a.Loader.prototype.addStatusElement:null,this.imageLoader=new a.ImageLoader,this.onLoadStart=function{},this.onLoadProgress=function{},this.onLoadComplete=function{}},a.Loader.prototype={constructor:a.Loader,crossOrigin:void 0,addStatusElement:function{var a=document.createElement("div");return a.style.position="absolute",a.style.right="0px",a.style.top="0px",a.style.fontSize="0.8em",a.style.textAlign="left",a.style.background="rgba(0,0,0,0.25)",a.style.color="#fff",a.style.width="120px",a.style.padding="0.5em 0.5em 0.5em 0.5em",a.style.zIndex=1e3,a.innerHTML="Loading ...",a},updateProgress:function(a){var b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1024).toFixed(2)+" KB",this.statusDomElement.innerHTML=b},extractUrlBase:function(a){var b=a.split("/");return 1===b.length?"./":(b.pop,b.join("/")+"/")},initMaterials:function(a,b){for(var c=[],d=0;d<a.length;++d)c[d]=this.createMaterial(a[d],b);return c},needsTangents:function(b){for(var c=0,d=b.length;d>c;c++){var e=b[c];if(e instanceof a.ShaderMaterial)return!0}return!1},createMaterial:function(b,c){function d(a){var b=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(b))}function e(b,e,f,h,i,j,k){var l,m=c+f,n=a.Loader.Handlers.get(m);if(null!==n?l=n.load(m):(l=new a.Texture,n=g.imageLoader,n.crossOrigin=g.crossOrigin,n.load(m,function(b){if(a.Math.isPowerOfTwo(b.width)===!1||a.Math.isPowerOfTwo(b.height)===!1){var c=d(b.width),e=d(b.height),f=document.createElement("canvas");f.width=c,f.height=e;var g=f.getContext("2d");g.drawImage(b,0,0,c,e),l.image=f}else l.image=b;l.needsUpdate=!0})),l.sourceFile=f,h&&(l.repeat.set(h[0],h[1]),1!==h[0]&&(l.wrapS=a.RepeatWrapping),1!==h[1]&&(l.wrapT=a.RepeatWrapping)),i&&l.offset.set(i[0],i[1]),j){var o={repeat:a.RepeatWrapping,mirror:a.MirroredRepeatWrapping};void 0!==o[j[0]]&&(l.wrapS=o[j[0]]),void 0!==o[j[1]]&&(l.wrapT=o[j[1]])}k&&(l.anisotropy=k),b[e]=l}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var g=this,h="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(b.shading){var j=b.shading.toLowerCase;"phong"===j?h="MeshPhongMaterial":"basic"===j&&(h="MeshBasicMaterial")}void 0!==b.blending&&void 0!==a[b.blending]&&(i.blending=a[b.blending]),void 0!==b.transparent&&(i.transparent=b.transparent),void 0!==b.opacity&&b.opacity<1&&(i.transparent=!0),void 0!==b.depthTest&&(i.depthTest=b.depthTest),void 0!==b.depthWrite&&(i.depthWrite=b.depthWrite),void 0!==b.visible&&(i.visible=b.visible),void 0!==b.flipSided&&(i.side=a.BackSide),void 0!==b.doubleSided&&(i.side=a.DoubleSide),void 0!==b.wireframe&&(i.wireframe=b.wireframe),void 0!==b.vertexColors&&("face"===b.vertexColors?i.vertexColors=a.FaceColors:b.vertexColors&&(i.vertexColors=a.VertexColors)),b.colorDiffuse?i.color=f(b.colorDiffuse):b.DbgColor&&(i.color=b.DbgColor),b.colorSpecular&&(i.specular=f(b.colorSpecular)),b.colorEmissive&&(i.emissive=f(b.colorEmissive)),void 0!==b.transparency&&(console.warn("THREE.Loader: transparency has been renamed to opacity"),b.opacity=b.transparency),void 0!==b.opacity&&(i.opacity=b.opacity),b.specularCoef&&(i.shininess=b.specularCoef),b.mapDiffuse&&c&&e(i,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap,b.mapDiffuseAnisotropy),b.mapLight&&c&&e(i,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap,b.mapLightAnisotropy),b.mapBump&&c&&e(i,"bumpMap",b.mapBump,b.mapBumpRepeat,b.mapBumpOffset,b.mapBumpWrap,b.mapBumpAnisotropy),b.mapNormal&&c&&e(i,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap,b.mapNormalAnisotropy),b.mapSpecular&&c&&e(i,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap,b.mapSpecularAnisotropy),b.mapAlpha&&c&&e(i,"alphaMap",b.mapAlpha,b.mapAlphaRepeat,b.mapAlphaOffset,b.mapAlphaWrap,b.mapAlphaAnisotropy),b.mapBumpScale&&(i.bumpScale=b.mapBumpScale),b.mapNormalFactor&&(i.normalScale=new a.Vector2(b.mapNormalFactor,b.mapNormalFactor));var k=new a[h](i);return void 0!==b.DbgName&&(k.name=b.DbgName),k}},a.Loader.Handlers={handlers:[],add:function(a,b){this.handlers.push(a,b)},get:function(a){for(var b=0,c=this.handlers.length;c>b;b+=2){var d=this.handlers[b],e=this.handlers[b+1];if(d.test(a))return e}return null}},a.XHRLoader=function(b){this.manager=void 0!==b?b:a.DefaultLoadingManager},a.XHRLoader.prototype={constructor:a.XHRLoader,load:function(b,c,d,e){var f=this,g=a.Cache.get(b);if(void 0!==g)return void(c&&c(g));var h=new XMLHttpRequest;h.open("GET",b,!0),h.addEventListener("load",function(d){a.Cache.add(b,this.response),c&&c(this.response),f.manager.itemEnd(b)},!1),void 0!==d&&h.addEventListener("progress",function(a){d(a)},!1),void 0!==e&&h.addEventListener("error",function(a){e(a)},!1),void 0!==this.crossOrigin&&(h.crossOrigin=this.crossOrigin),void 0!==this.responseType&&(h.responseType=this.responseType),h.send(null),f.manager.itemStart(b)},setResponseType:function(a){this.responseType=a},setCrossOrigin:function(a){this.crossOrigin=a}},a.ImageLoader=function(b){this.manager=void 0!==b?b:a.DefaultLoadingManager},a.ImageLoader.prototype={constructor:a.ImageLoader,load:function(b,c,d,e){var f=this,g=a.Cache.get(b);if(void 0!==g)return void c(g);var h=document.createElement("img");return h.addEventListener("load",function(d){a.Cache.add(b,this),c&&c(this),f.manager.itemEnd(b)},!1),void 0!==d&&h.addEventListener("progress",function(a){d(a)},!1),void 0!==e&&h.addEventListener("error",function(a){e(a)},!1),void 0!==this.crossOrigin&&(h.crossOrigin=this.crossOrigin),h.src=b,f.manager.itemStart(b),h},setCrossOrigin:function(a){this.crossOrigin=a}},a.JSONLoader=function(b){a.Loader.call(this,b),this.withCredentials=!1},a.JSONLoader.prototype=Object.create(a.Loader.prototype),a.JSONLoader.prototype.constructor=a.JSONLoader,a.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"==typeof c?c:this.extractUrlBase(a),this.onLoadStart,this.loadAjaxJSON(this,a,b,c)},a.JSONLoader.prototype.loadAjaxJSON=function(b,c,d,e,f){var g=new XMLHttpRequest,h=0;g.onreadystatechange=function{if(g.readyState===g.DONE)if(200===g.status||0===g.status){if(g.responseText){var i=JSON.parse(g.responseText),j=i.metadata;if(void 0!==j){if("object"===j.type)return void a.error("THREE.JSONLoader: "+c+" should be loaded with THREE.ObjectLoader instead.");if("scene"===j.type)return void a.error("THREE.JSONLoader: "+c+" seems to be a Scene. Use THREE.SceneLoader instead.")}var k=b.parse(i,e);d(k.geometry,k.materials)}else a.error("THREE.JSONLoader: "+c+" seems to be unreachable or the file is empty.");b.onLoadComplete}else a.error("THREE.JSONLoader: Couldn't load "+c+" ("+g.status+")");else g.readyState===g.LOADING?f&&(0===h&&(h=g.getResponseHeader("Content-Length")),f({total:h,loaded:g.responseText.length})):g.readyState===g.HEADERS_RECEIVED&&void 0!==f&&(h=g.getResponseHeader("Content-Length"))},g.open("GET",c,!0),g.withCredentials=this.withCredentials,g.send(null)},a.JSONLoader.prototype.parse=function(b,c){function d(c){function d(a,b){return a&1<<b}var e,f,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G=b.faces,H=b.vertices,I=b.normals,J=b.colors,K=0;if(void 0!==b.uvs){for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&K++;for(e=0;K>e;e++)g.faceVertexUvs[e]=[]}for(i=0,j=H.length;j>i;)w=new a.Vector3,w.x=H[i++]*c,w.y=H[i++]*c,w.z=H[i++]*c,g.vertices.push(w);for(i=0,j=G.length;j>i;)if(o=G[i++],p=d(o,0),q=d(o,1),r=d(o,3),s=d(o,4),t=d(o,5),u=d(o,6),v=d(o,7),p){if(y=new a.Face3,y.a=G[i],y.b=G[i+1],y.c=G[i+3],z=new a.Face3,z.a=G[i+1],z.b=G[i+2],z.c=G[i+3],i+=4,q&&(n=G[i++],y.materialIndex=n,z.materialIndex=n),h=g.faces.length,r)for(e=0;K>e;e++)for(C=b.uvs[e],g.faceVertexUvs[e][h]=[],g.faceVertexUvs[e][h+1]=[],f=0;4>f;f++)m=G[i++],E=C[2*m],F=C[2*m+1],D=new a.Vector2(E,F),2!==f&&g.faceVertexUvs[e][h].push(D),0!==f&&g.faceVertexUvs[e][h+1].push(D);if(s&&(l=3*G[i++],y.normal.set(I[l++],I[l++],I[l]),z.normal.copy(y.normal)),t)for(e=0;4>e;e++)l=3*G[i++],B=new a.Vector3(I[l++],I[l++],I[l]),2!==e&&y.vertexNormals.push(B),0!==e&&z.vertexNormals.push(B);if(u&&(k=G[i++],A=J[k],y.color.setHex(A),z.color.setHex(A)),v)for(e=0;4>e;e++)k=G[i++],A=J[k],2!==e&&y.vertexColors.push(new a.Color(A)),0!==e&&z.vertexColors.push(new a.Color(A));g.faces.push(y),g.faces.push(z)}else{if(x=new a.Face3,x.a=G[i++],x.b=G[i++],x.c=G[i++],q&&(n=G[i++],x.materialIndex=n),h=g.faces.length,r)for(e=0;K>e;e++)for(C=b.uvs[e],g.faceVertexUvs[e][h]=[],f=0;3>f;f++)m=G[i++],E=C[2*m],F=C[2*m+1],D=new a.Vector2(E,F),g.faceVertexUvs[e][h].push(D);if(s&&(l=3*G[i++],x.normal.set(I[l++],I[l++],I[l])),t)for(e=0;3>e;e++)l=3*G[i++],B=new a.Vector3(I[l++],I[l++],I[l]),x.vertexNormals.push(B);if(u&&(k=G[i++],x.color.setHex(J[k])),v)for(e=0;3>e;e++)k=G[i++],x.vertexColors.push(new a.Color(J[k]));g.faces.push(x)}}function e{var c=void 0!==b.influencesPerVertex?b.influencesPerVertex:2;if(b.skinWeights)for(var d=0,e=b.skinWeights.length;e>d;d+=c){var f=b.skinWeights[d],h=c>1?b.skinWeights[d+1]:0,i=c>2?b.skinWeights[d+2]:0,j=c>3?b.skinWeights[d+3]:0;g.skinWeights.push(new a.Vector4(f,h,i,j))}if(b.skinIndices)for(var d=0,e=b.skinIndices.length;e>d;d+=c){var k=b.skinIndices[d],l=c>1?b.skinIndices[d+1]:0,m=c>2?b.skinIndices[d+2]:0,n=c>3?b.skinIndices[d+3]:0;g.skinIndices.push(new a.Vector4(k,l,m,n))}g.bones=b.bones,g.bones&&g.bones.length>0&&(g.skinWeights.length!==g.skinIndices.length||g.skinIndices.length!==g.vertices.length)&&a.warn("THREE.JSONLoader: When skinning, number of vertices ("+g.vertices.length+"), skinIndices ("+g.skinIndices.length+"), and skinWeights ("+g.skinWeights.length+") should match."),g.animation=b.animation,g.animations=b.animations}function f(c){if(void 0!==b.morphTargets){var d,e,f,h,i,j;for(d=0,e=b.morphTargets.length;e>d;d++)for(g.morphTargets[d]={},g.morphTargets[d].name=b.morphTargets[d].name,g.morphTargets[d].vertices=[],i=g.morphTargets[d].vertices,j=b.morphTargets[d].vertices,f=0,h=j.length;h>f;f+=3){var k=new a.Vector3;k.x=j[f]*c,k.y=j[f+1]*c,k.z=j[f+2]*c,i.push(k)}}if(void 0!==b.morphColors){var d,e,l,m,n,o,p;for(d=0,e=b.morphColors.length;e>d;d++)for(g.morphColors[d]={},g.morphColors[d].name=b.morphColors[d].name,g.morphColors[d].colors=[],n=g.morphColors[d].colors,o=b.morphColors[d].colors,l=0,m=o.length;m>l;l+=3)p=new a.Color(16755200),p.setRGB(o[l],o[l+1],o[l+2]),n.push(p)}}var g=new a.Geometry,h=void 0!==b.scale?1/b.scale:1;if(d(h),e,f(h),g.computeFaceNormals,g.computeBoundingSphere,void 0===b.materials||0===b.materials.length)return{geometry:g};var i=this.initMaterials(b.materials,c);return this.needsTangents(i)&&g.computeTangents,{geometry:g,materials:i}},a.LoadingManager=function(a,b,c){var d=this,e=0,f=0;this.onLoad=a,this.onProgress=b,this.onError=c,this.itemStart=function(a){f++},this.itemEnd=function(a){e++,void 0!==d.onProgress&&d.onProgress(a,e,f),e===f&&void 0!==d.onLoad&&d.onLoad}},a.DefaultLoadingManager=new a.LoadingManager,a.BufferGeometryLoader=function(b){this.manager=void 0!==b?b:a.DefaultLoadingManager},a.BufferGeometryLoader.prototype={constructor:a.BufferGeometryLoader,load:function(b,c,d,e){var f=this,g=new a.XHRLoader(f.manager);g.setCrossOrigin(this.crossOrigin),g.load(b,function(a){c(f.parse(JSON.parse(a)))},d,e)},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(b){var c=new a.BufferGeometry,d=b.data.attributes;for(var e in d){var f=d[e],g=new self[f.type](f.array);c.addAttribute(e,new a.BufferAttribute(g,f.itemSize))}var h=b.data.offsets;void 0!==h&&(c.offsets=JSON.parse(JSON.stringify(h)));var i=b.data.boundingSphere;if(void 0!==i){var j=new a.Vector3;void 0!==i.center&&j.fromArray(i.center),c.boundingSphere=new a.Sphere(j,i.radius)}return c}},a.MaterialLoader=function(b){this.manager=void 0!==b?b:a.DefaultLoadingManager},a.MaterialLoader.prototype={constructor:a.MaterialLoader,load:function(b,c,d,e){var f=this,g=new a.XHRLoader(f.manager);g.setCrossOrigin(this.crossOrigin),g.load(b,function(a){c(f.parse(JSON.parse(a)))},d,e)},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(b){var c=new a[b.type];if(void 0!==b.color&&c.color.setHex(b.color),void 0!==b.emissive&&c.emissive.setHex(b.emissive),void 0!==b.specular&&c.specular.setHex(b.specular),void 0!==b.shininess&&(c.shininess=b.shininess),void 0!==b.uniforms&&(c.uniforms=b.uniforms),void 0!==b.vertexShader&&(c.vertexShader=b.vertexShader),void 0!==b.fragmentShader&&(c.fragmentShader=b.fragmentShader),void 0!==b.vertexColors&&(c.vertexColors=b.vertexColors),void 0!==b.shading&&(c.shading=b.shading),void 0!==b.blending&&(c.blending=b.blending),void 0!==b.side&&(c.side=b.side),void 0!==b.opacity&&(c.opacity=b.opacity),void 0!==b.transparent&&(c.transparent=b.transparent),void 0!==b.wireframe&&(c.wireframe=b.wireframe),void 0!==b.size&&(c.size=b.size),void 0!==b.sizeAttenuation&&(c.sizeAttenuation=b.sizeAttenuation),void 0!==b.materials)for(var d=0,e=b.materials.length;e>d;d++)c.materials.push(this.parse(b.materials[d]));return c}},a.ObjectLoader=function(b){this.manager=void 0!==b?b:a.DefaultLoadingManager,this.texturePath=""},a.ObjectLoader.prototype={constructor:a.ObjectLoader,load:function(b,c,d,e){""===this.texturePath&&(this.texturePath=b.substring(0,b.lastIndexOf("/")+1));var f=this,g=new a.XHRLoader(f.manager);g.setCrossOrigin(this.crossOrigin),g.load(b,function(a){f.parse(JSON.parse(a),c)},d,e)},setTexturePath:function(a){this.texturePath=a},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a,b){var c=this.parseGeometries(a.geometries),d=this.parseImages(a.images,function{void 0!==b&&b(g)}),e=this.parseTextures(a.textures,d),f=this.parseMaterials(a.materials,e),g=this.parseObject(a.object,c,f);return void 0!==a.images&&0!==a.images.length||void 0!==b&&b(g),g},parseGeometries:function(b){var c={};if(void 0!==b)for(var d=new a.JSONLoader,e=new a.BufferGeometryLoader,f=0,g=b.length;g>f;f++){var h,i=b[f];switch(i.type){case"PlaneGeometry":case"PlaneBufferGeometry":h=new a[i.type](i.width,i.height,i.widthSegments,i.heightSegments);break;case"BoxGeometry":case"CubeGeometry":h=new a.BoxGeometry(i.width,i.height,i.depth,i.widthSegments,i.heightSegments,i.depthSegments);break;case"CircleGeometry":h=new a.CircleGeometry(i.radius,i.segments);break;case"CylinderGeometry":h=new a.CylinderGeometry(i.radiusTop,i.radiusBottom,i.height,i.radialSegments,i.heightSegments,i.openEnded);break;case"SphereGeometry":h=new a.SphereGeometry(i.radius,i.widthSegments,i.heightSegments,i.phiStart,i.phiLength,i.thetaStart,i.thetaLength);break;case"IcosahedronGeometry":h=new a.IcosahedronGeometry(i.radius,i.detail);break;case"TorusGeometry":h=new a.TorusGeometry(i.radius,i.tube,i.radialSegments,i.tubularSegments,i.arc);break;case"TorusKnotGeometry":h=new a.TorusKnotGeometry(i.radius,i.tube,i.radialSegments,i.tubularSegments,i.p,i.q,i.heightScale);break;case"BufferGeometry":h=e.parse(i);break;case"Geometry":h=d.parse(i.data).geometry}h.uuid=i.uuid,void 0!==i.name&&(h.name=i.name),c[i.uuid]=h}return c},parseMaterials:function(b,c){var d={};if(void 0!==b)for(var e=function(b){return void 0===c[b]&&a.warn("THREE.ObjectLoader: Undefined texture",b),c[b]},f=new a.MaterialLoader,g=0,h=b.length;h>g;g++){var i=b[g],j=f.parse(i);j.uuid=i.uuid,void 0!==i.name&&(j.name=i.name),void 0!==i.map&&(j.map=e(i.map)),void 0!==i.bumpMap&&(j.bumpMap=e(i.bumpMap),i.bumpScale&&(j.bumpScale=new a.Vector2(i.bumpScale,i.bumpScale))),void 0!==i.alphaMap&&(j.alphaMap=e(i.alphaMap)),void 0!==i.envMap&&(j.envMap=e(i.envMap)),void 0!==i.normalMap&&(j.normalMap=e(i.normalMap),i.normalScale&&(j.normalScale=new a.Vector2(i.normalScale,i.normalScale))),void 0!==i.lightMap&&(j.lightMap=e(i.lightMap)),void 0!==i.specularMap&&(j.specularMap=e(i.specularMap)),d[i.uuid]=j}return d},parseImages:function(b,c){var d=this,e={};if(void 0!==b&&b.length>0){var f=new a.LoadingManager(c),g=new a.ImageLoader(f);g.setCrossOrigin(this.crossOrigin);for(var h=function(a){return d.manager.itemStart(a),g.load(a,function{d.manager.itemEnd(a)})},i=0,j=b.length;j>i;i++){var k=b[i],l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(k.url)?k.url:d.texturePath+k.url;e[k.uuid]=h(l)}}return e},parseTextures:function(b,c){var d={};if(void 0!==b)for(var e=0,f=b.length;f>e;e++){var g=b[e];void 0===g.image&&a.warn('THREE.ObjectLoader: No "image" speficied for',g.uuid),void 0===c[g.image]&&a.warn("THREE.ObjectLoader: Undefined image",g.image);var h=new a.Texture(c[g.image]);h.needsUpdate=!0,h.uuid=g.uuid,void 0!==g.name&&(h.name=g.name),void 0!==g.repeat&&(h.repeat=new a.Vector2(g.repeat[0],g.repeat[1])),void 0!==g.minFilter&&(h.minFilter=a[g.minFilter]),void 0!==g.magFilter&&(h.magFilter=a[g.magFilter]),void 0!==g.anisotropy&&(h.anisotropy=g.anisotropy),g.wrap instanceof Array&&(h.wrapS=a[g.wrap[0]],h.wrapT=a[g.wrap[1]]),d[g.uuid]=h}return d},parseObject:function{var b=new a.Matrix4;return function(c,d,e){var f,g=function(b){return void 0===d[b]&&a.warn("THREE.ObjectLoader: Undefined geometry",b),d[b]},h=function(b){return void 0===e[b]&&a.warn("THREE.ObjectLoader: Undefined material",b),e[b]};switch(c.type){case"Scene":f=new a.Scene;break;case"PerspectiveCamera":f=new a.PerspectiveCamera(c.fov,c.aspect,c.near,c.far);break;case"OrthographicCamera":f=new a.OrthographicCamera(c.left,c.right,c.top,c.bottom,c.near,c.far);break;case"AmbientLight":f=new a.AmbientLight(c.color);break;case"DirectionalLight":f=new a.DirectionalLight(c.color,c.intensity);break;case"PointLight":f=new a.PointLight(c.color,c.intensity,c.distance,c.decay);break;case"SpotLight":f=new a.SpotLight(c.color,c.intensity,c.distance,c.angle,c.exponent,c.decay);break;case"HemisphereLight":f=new a.HemisphereLight(c.color,c.groundColor,c.intensity);break;case"Mesh":f=new a.Mesh(g(c.geometry),h(c.material));break;case"Line":f=new a.Line(g(c.geometry),h(c.material),c.mode);break;case"PointCloud":f=new a.PointCloud(g(c.geometry),h(c.material));break;case"Sprite":f=new a.Sprite(h(c.material));break;case"Group":f=new a.Group;break;default:f=new a.Object3D}if(f.uuid=c.uuid,void 0!==c.name&&(f.name=c.name),void 0!==c.matrix?(b.fromArray(c.matrix),b.decompose(f.position,f.quaternion,f.scale)):(void 0!==c.position&&f.position.fromArray(c.position),void 0!==c.rotation&&f.rotation.fromArray(c.rotation),void 0!==c.scale&&f.scale.fromArray(c.scale)),void 0!==c.visible&&(f.visible=c.visible),void 0!==c.userData&&(f.userData=c.userData),void 0!==c.children)for(var i in c.children)f.add(this.parseObject(c.children[i],d,e));return f}}},a.TextureLoader=function(b){this.manager=void 0!==b?b:a.DefaultLoadingManager},a.TextureLoader.prototype={constructor:a.TextureLoader,load:function(b,c,d,e){var f=this,g=new a.ImageLoader(f.manager);g.setCrossOrigin(this.crossOrigin),g.load(b,function(b){var d=new a.Texture(b);d.needsUpdate=!0,void 0!==c&&c(d)},d,e)},setCrossOrigin:function(a){this.crossOrigin=a}},a.DataTextureLoader=a.BinaryTextureLoader=function{this._parser=null},a.BinaryTextureLoader.prototype={constructor:a.BinaryTextureLoader,load:function(b,c,d,e){var f=this,g=new a.DataTexture,h=new a.XHRLoader;return h.setResponseType("arraybuffer"),h.load(b,function(b){var d=f._parser(b);d&&(void 0!==d.image?g.image=d.image:void 0!==d.data&&(g.image.width=d.width,g.image.height=d.height,g.image.data=d.data),g.wrapS=void 0!==d.wrapS?d.wrapS:a.ClampToEdgeWrapping, g.wrapT=void 0!==d.wrapT?d.wrapT:a.ClampToEdgeWrapping,g.magFilter=void 0!==d.magFilter?d.magFilter:a.LinearFilter,g.minFilter=void 0!==d.minFilter?d.minFilter:a.LinearMipMapLinearFilter,g.anisotropy=void 0!==d.anisotropy?d.anisotropy:1,void 0!==d.format&&(g.format=d.format),void 0!==d.type&&(g.type=d.type),void 0!==d.mipmaps&&(g.mipmaps=d.mipmaps),1===d.mipmapCount&&(g.minFilter=a.LinearFilter),g.needsUpdate=!0,c&&c(g,d))},d,e),g}},a.CompressedTextureLoader=function{this._parser=null},a.CompressedTextureLoader.prototype={constructor:a.CompressedTextureLoader,load:function(b,c,d){var e=this,f=[],g=new a.CompressedTexture;g.image=f;var h=new a.XHRLoader;if(h.setResponseType("arraybuffer"),b instanceof Array)for(var i=0,j=function(d){h.load(b[d],function(b){var h=e._parser(b,!0);f[d]={width:h.width,height:h.height,format:h.format,mipmaps:h.mipmaps},i+=1,6===i&&(1==h.mipmapCount&&(g.minFilter=a.LinearFilter),g.format=h.format,g.needsUpdate=!0,c&&c(g))})},k=0,l=b.length;l>k;++k)j(k);else h.load(b,function(b){var d=e._parser(b,!0);if(d.isCubemap)for(var h=d.mipmaps.length/d.mipmapCount,i=0;h>i;i++){f[i]={mipmaps:[]};for(var j=0;j<d.mipmapCount;j++)f[i].mipmaps.push(d.mipmaps[i*d.mipmapCount+j]),f[i].format=d.format,f[i].width=d.width,f[i].height=d.height}else g.image.width=d.width,g.image.height=d.height,g.mipmaps=d.mipmaps;1===d.mipmapCount&&(g.minFilter=a.LinearFilter),g.format=d.format,g.needsUpdate=!0,c&&c(g)});return g}},a.Material=function{Object.defineProperty(this,"id",{value:a.MaterialIdCount++}),this.uuid=a.Math.generateUUID,this.name="",this.type="Material",this.side=a.FrontSide,this.opacity=1,this.transparent=!1,this.blending=a.NormalBlending,this.blendSrc=a.SrcAlphaFactor,this.blendDst=a.OneMinusSrcAlphaFactor,this.blendEquation=a.AddEquation,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthTest=!0,this.depthWrite=!0,this.colorWrite=!0,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.overdraw=0,this.visible=!0,this._needsUpdate=!0},a.Material.prototype={constructor:a.Material,get needsUpdate{return this._needsUpdate},set needsUpdate(a){a===!0&&this.update,this._needsUpdate=a},setValues:function(b){if(void 0!==b)for(var c in b){var d=b[c];if(void 0!==d){if(c in this){var e=this[c];e instanceof a.Color?e.set(d):e instanceof a.Vector3&&d instanceof a.Vector3?e.copy(d):"overdraw"==c?this[c]=Number(d):this[c]=d}}else a.warn("THREE.Material: '"+c+"' parameter is undefined.")}},toJSON:function{var b={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type};return""!==this.name&&(b.name=this.name),this instanceof a.MeshBasicMaterial?(b.color=this.color.getHex,this.vertexColors!==a.NoColors&&(b.vertexColors=this.vertexColors),this.blending!==a.NormalBlending&&(b.blending=this.blending),this.side!==a.FrontSide&&(b.side=this.side)):this instanceof a.MeshLambertMaterial?(b.color=this.color.getHex,b.emissive=this.emissive.getHex,this.vertexColors!==a.NoColors&&(b.vertexColors=this.vertexColors),this.shading!==a.SmoothShading&&(b.shading=this.shading),this.blending!==a.NormalBlending&&(b.blending=this.blending),this.side!==a.FrontSide&&(b.side=this.side)):this instanceof a.MeshPhongMaterial?(b.color=this.color.getHex,b.emissive=this.emissive.getHex,b.specular=this.specular.getHex,b.shininess=this.shininess,this.vertexColors!==a.NoColors&&(b.vertexColors=this.vertexColors),this.shading!==a.SmoothShading&&(b.shading=this.shading),this.blending!==a.NormalBlending&&(b.blending=this.blending),this.side!==a.FrontSide&&(b.side=this.side)):this instanceof a.MeshNormalMaterial?(this.blending!==a.NormalBlending&&(b.blending=this.blending),this.side!==a.FrontSide&&(b.side=this.side)):this instanceof a.MeshDepthMaterial?(this.blending!==a.NormalBlending&&(b.blending=this.blending),this.side!==a.FrontSide&&(b.side=this.side)):this instanceof a.PointCloudMaterial?(b.size=this.size,b.sizeAttenuation=this.sizeAttenuation,b.color=this.color.getHex,this.vertexColors!==a.NoColors&&(b.vertexColors=this.vertexColors),this.blending!==a.NormalBlending&&(b.blending=this.blending)):this instanceof a.ShaderMaterial?(b.uniforms=this.uniforms,b.vertexShader=this.vertexShader,b.fragmentShader=this.fragmentShader):this instanceof a.SpriteMaterial&&(b.color=this.color.getHex),this.opacity<1&&(b.opacity=this.opacity),this.transparent!==!1&&(b.transparent=this.transparent),this.wireframe!==!1&&(b.wireframe=this.wireframe),b},clone:function(b){return void 0===b&&(b=new a.Material),b.name=this.name,b.side=this.side,b.opacity=this.opacity,b.transparent=this.transparent,b.blending=this.blending,b.blendSrc=this.blendSrc,b.blendDst=this.blendDst,b.blendEquation=this.blendEquation,b.blendSrcAlpha=this.blendSrcAlpha,b.blendDstAlpha=this.blendDstAlpha,b.blendEquationAlpha=this.blendEquationAlpha,b.depthTest=this.depthTest,b.depthWrite=this.depthWrite,b.polygonOffset=this.polygonOffset,b.polygonOffsetFactor=this.polygonOffsetFactor,b.polygonOffsetUnits=this.polygonOffsetUnits,b.alphaTest=this.alphaTest,b.overdraw=this.overdraw,b.visible=this.visible,b},update:function{this.dispatchEvent({type:"update"})},dispose:function{this.dispatchEvent({type:"dispose"})}},a.EventDispatcher.prototype.apply(a.Material.prototype),a.MaterialIdCount=0,a.LineBasicMaterial=function(b){a.Material.call(this),this.type="LineBasicMaterial",this.color=new a.Color(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.vertexColors=a.NoColors,this.fog=!0,this.setValues(b)},a.LineBasicMaterial.prototype=Object.create(a.Material.prototype),a.LineBasicMaterial.prototype.constructor=a.LineBasicMaterial,a.LineBasicMaterial.prototype.clone=function{var b=new a.LineBasicMaterial;return a.Material.prototype.clone.call(this,b),b.color.copy(this.color),b.linewidth=this.linewidth,b.linecap=this.linecap,b.linejoin=this.linejoin,b.vertexColors=this.vertexColors,b.fog=this.fog,b},a.LineDashedMaterial=function(b){a.Material.call(this),this.type="LineDashedMaterial",this.color=new a.Color(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.vertexColors=!1,this.fog=!0,this.setValues(b)},a.LineDashedMaterial.prototype=Object.create(a.Material.prototype),a.LineDashedMaterial.prototype.constructor=a.LineDashedMaterial,a.LineDashedMaterial.prototype.clone=function{var b=new a.LineDashedMaterial;return a.Material.prototype.clone.call(this,b),b.color.copy(this.color),b.linewidth=this.linewidth,b.scale=this.scale,b.dashSize=this.dashSize,b.gapSize=this.gapSize,b.vertexColors=this.vertexColors,b.fog=this.fog,b},a.MeshBasicMaterial=function(b){a.Material.call(this),this.type="MeshBasicMaterial",this.color=new a.Color(16777215),this.map=null,this.lightMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=a.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=a.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=a.NoColors,this.skinning=!1,this.morphTargets=!1,this.setValues(b)},a.MeshBasicMaterial.prototype=Object.create(a.Material.prototype),a.MeshBasicMaterial.prototype.constructor=a.MeshBasicMaterial,a.MeshBasicMaterial.prototype.clone=function{var b=new a.MeshBasicMaterial;return a.Material.prototype.clone.call(this,b),b.color.copy(this.color),b.map=this.map,b.lightMap=this.lightMap,b.specularMap=this.specularMap,b.alphaMap=this.alphaMap,b.envMap=this.envMap,b.combine=this.combine,b.reflectivity=this.reflectivity,b.refractionRatio=this.refractionRatio,b.fog=this.fog,b.shading=this.shading,b.wireframe=this.wireframe,b.wireframeLinewidth=this.wireframeLinewidth,b.wireframeLinecap=this.wireframeLinecap,b.wireframeLinejoin=this.wireframeLinejoin,b.vertexColors=this.vertexColors,b.skinning=this.skinning,b.morphTargets=this.morphTargets,b},a.MeshLambertMaterial=function(b){a.Material.call(this),this.type="MeshLambertMaterial",this.color=new a.Color(16777215),this.emissive=new a.Color(0),this.wrapAround=!1,this.wrapRGB=new a.Vector3(1,1,1),this.map=null,this.lightMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=a.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=a.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=a.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(b)},a.MeshLambertMaterial.prototype=Object.create(a.Material.prototype),a.MeshLambertMaterial.prototype.constructor=a.MeshLambertMaterial,a.MeshLambertMaterial.prototype.clone=function{var b=new a.MeshLambertMaterial;return a.Material.prototype.clone.call(this,b),b.color.copy(this.color),b.emissive.copy(this.emissive),b.wrapAround=this.wrapAround,b.wrapRGB.copy(this.wrapRGB),b.map=this.map,b.lightMap=this.lightMap,b.specularMap=this.specularMap,b.alphaMap=this.alphaMap,b.envMap=this.envMap,b.combine=this.combine,b.reflectivity=this.reflectivity,b.refractionRatio=this.refractionRatio,b.fog=this.fog,b.shading=this.shading,b.wireframe=this.wireframe,b.wireframeLinewidth=this.wireframeLinewidth,b.wireframeLinecap=this.wireframeLinecap,b.wireframeLinejoin=this.wireframeLinejoin,b.vertexColors=this.vertexColors,b.skinning=this.skinning,b.morphTargets=this.morphTargets,b.morphNormals=this.morphNormals,b},a.MeshPhongMaterial=function(b){a.Material.call(this),this.type="MeshPhongMaterial",this.color=new a.Color(16777215),this.emissive=new a.Color(0),this.specular=new a.Color(1118481),this.shininess=30,this.metal=!1,this.wrapAround=!1,this.wrapRGB=new a.Vector3(1,1,1),this.map=null,this.lightMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new a.Vector2(1,1),this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=a.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=a.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=a.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(b)},a.MeshPhongMaterial.prototype=Object.create(a.Material.prototype),a.MeshPhongMaterial.prototype.constructor=a.MeshPhongMaterial,a.MeshPhongMaterial.prototype.clone=function{var b=new a.MeshPhongMaterial;return a.Material.prototype.clone.call(this,b),b.color.copy(this.color),b.emissive.copy(this.emissive),b.specular.copy(this.specular),b.shininess=this.shininess,b.metal=this.metal,b.wrapAround=this.wrapAround,b.wrapRGB.copy(this.wrapRGB),b.map=this.map,b.lightMap=this.lightMap,b.bumpMap=this.bumpMap,b.bumpScale=this.bumpScale,b.normalMap=this.normalMap,b.normalScale.copy(this.normalScale),b.specularMap=this.specularMap,b.alphaMap=this.alphaMap,b.envMap=this.envMap,b.combine=this.combine,b.reflectivity=this.reflectivity,b.refractionRatio=this.refractionRatio,b.fog=this.fog,b.shading=this.shading,b.wireframe=this.wireframe,b.wireframeLinewidth=this.wireframeLinewidth,b.wireframeLinecap=this.wireframeLinecap,b.wireframeLinejoin=this.wireframeLinejoin,b.vertexColors=this.vertexColors,b.skinning=this.skinning,b.morphTargets=this.morphTargets,b.morphNormals=this.morphNormals,b},a.MeshDepthMaterial=function(b){a.Material.call(this),this.type="MeshDepthMaterial",this.morphTargets=!1,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(b)},a.MeshDepthMaterial.prototype=Object.create(a.Material.prototype),a.MeshDepthMaterial.prototype.constructor=a.MeshDepthMaterial,a.MeshDepthMaterial.prototype.clone=function{var b=new a.MeshDepthMaterial;return a.Material.prototype.clone.call(this,b),b.wireframe=this.wireframe,b.wireframeLinewidth=this.wireframeLinewidth,b},a.MeshNormalMaterial=function(b){a.Material.call(this,b),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=!1,this.setValues(b)},a.MeshNormalMaterial.prototype=Object.create(a.Material.prototype),a.MeshNormalMaterial.prototype.constructor=a.MeshNormalMaterial,a.MeshNormalMaterial.prototype.clone=function{var b=new a.MeshNormalMaterial;return a.Material.prototype.clone.call(this,b),b.wireframe=this.wireframe,b.wireframeLinewidth=this.wireframeLinewidth,b},a.MeshFaceMaterial=function(b){this.uuid=a.Math.generateUUID,this.type="MeshFaceMaterial",this.materials=b instanceof Array?b:[]},a.MeshFaceMaterial.prototype={constructor:a.MeshFaceMaterial,toJSON:function{for(var a={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},b=0,c=this.materials.length;c>b;b++)a.materials.push(this.materials[b].toJSON);return a},clone:function{for(var b=new a.MeshFaceMaterial,c=0;c<this.materials.length;c++)b.materials.push(this.materials[c].clone);return b}},a.PointCloudMaterial=function(b){a.Material.call(this),this.type="PointCloudMaterial",this.color=new a.Color(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.vertexColors=a.NoColors,this.fog=!0,this.setValues(b)},a.PointCloudMaterial.prototype=Object.create(a.Material.prototype),a.PointCloudMaterial.prototype.constructor=a.PointCloudMaterial,a.PointCloudMaterial.prototype.clone=function{var b=new a.PointCloudMaterial;return a.Material.prototype.clone.call(this,b),b.color.copy(this.color),b.map=this.map,b.size=this.size,b.sizeAttenuation=this.sizeAttenuation,b.vertexColors=this.vertexColors,b.fog=this.fog,b},a.ParticleBasicMaterial=function(b){return a.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointCloudMaterial."),new a.PointCloudMaterial(b)},a.ParticleSystemMaterial=function(b){return a.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointCloudMaterial."),new a.PointCloudMaterial(b)},a.ShaderMaterial=function(b){a.Material.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.attributes=null,this.vertexShader="void main {\n	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main {\n	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.shading=a.SmoothShading,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.vertexColors=a.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.setValues(b)},a.ShaderMaterial.prototype=Object.create(a.Material.prototype),a.ShaderMaterial.prototype.constructor=a.ShaderMaterial,a.ShaderMaterial.prototype.clone=function{var b=new a.ShaderMaterial;return a.Material.prototype.clone.call(this,b),b.fragmentShader=this.fragmentShader,b.vertexShader=this.vertexShader,b.uniforms=a.UniformsUtils.clone(this.uniforms),b.attributes=this.attributes,b.defines=this.defines,b.shading=this.shading,b.wireframe=this.wireframe,b.wireframeLinewidth=this.wireframeLinewidth,b.fog=this.fog,b.lights=this.lights,b.vertexColors=this.vertexColors,b.skinning=this.skinning,b.morphTargets=this.morphTargets,b.morphNormals=this.morphNormals,b},a.RawShaderMaterial=function(b){a.ShaderMaterial.call(this,b),this.type="RawShaderMaterial"},a.RawShaderMaterial.prototype=Object.create(a.ShaderMaterial.prototype),a.RawShaderMaterial.prototype.constructor=a.RawShaderMaterial,a.RawShaderMaterial.prototype.clone=function{var b=new a.RawShaderMaterial;return a.ShaderMaterial.prototype.clone.call(this,b),b},a.SpriteMaterial=function(b){a.Material.call(this),this.type="SpriteMaterial",this.color=new a.Color(16777215),this.map=null,this.rotation=0,this.fog=!1,this.setValues(b)},a.SpriteMaterial.prototype=Object.create(a.Material.prototype),a.SpriteMaterial.prototype.constructor=a.SpriteMaterial,a.SpriteMaterial.prototype.clone=function{var b=new a.SpriteMaterial;return a.Material.prototype.clone.call(this,b),b.color.copy(this.color),b.map=this.map,b.rotation=this.rotation,b.fog=this.fog,b},a.Texture=function(b,c,d,e,f,g,h,i,j){Object.defineProperty(this,"id",{value:a.TextureIdCount++}),this.uuid=a.Math.generateUUID,this.name="",this.sourceFile="",this.image=void 0!==b?b:a.Texture.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==c?c:a.Texture.DEFAULT_MAPPING,this.wrapS=void 0!==d?d:a.ClampToEdgeWrapping,this.wrapT=void 0!==e?e:a.ClampToEdgeWrapping,this.magFilter=void 0!==f?f:a.LinearFilter,this.minFilter=void 0!==g?g:a.LinearMipMapLinearFilter,this.anisotropy=void 0!==j?j:1,this.format=void 0!==h?h:a.RGBAFormat,this.type=void 0!==i?i:a.UnsignedByteType,this.offset=new a.Vector2(0,0),this.repeat=new a.Vector2(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this._needsUpdate=!1,this.onUpdate=null},a.Texture.DEFAULT_IMAGE=void 0,a.Texture.DEFAULT_MAPPING=a.UVMapping,a.Texture.prototype={constructor:a.Texture,get needsUpdate{return this._needsUpdate},set needsUpdate(a){a===!0&&this.update,this._needsUpdate=a},clone:function(b){return void 0===b&&(b=new a.Texture),b.image=this.image,b.mipmaps=this.mipmaps.slice(0),b.mapping=this.mapping,b.wrapS=this.wrapS,b.wrapT=this.wrapT,b.magFilter=this.magFilter,b.minFilter=this.minFilter,b.anisotropy=this.anisotropy,b.format=this.format,b.type=this.type,b.offset.copy(this.offset),b.repeat.copy(this.repeat),b.generateMipmaps=this.generateMipmaps,b.premultiplyAlpha=this.premultiplyAlpha,b.flipY=this.flipY,b.unpackAlignment=this.unpackAlignment,b},update:function{this.dispatchEvent({type:"update"})},dispose:function{this.dispatchEvent({type:"dispose"})}},a.EventDispatcher.prototype.apply(a.Texture.prototype),a.TextureIdCount=0,a.CubeTexture=function(b,c,d,e,f,g,h,i,j){c=void 0!==c?c:a.CubeReflectionMapping,a.Texture.call(this,b,c,d,e,f,g,h,i,j),this.images=b},a.CubeTexture.prototype=Object.create(a.Texture.prototype),a.CubeTexture.prototype.constructor=a.CubeTexture,a.CubeTexture.clone=function(b){return void 0===b&&(b=new a.CubeTexture),a.Texture.prototype.clone.call(this,b),b.images=this.images,b},a.CompressedTexture=function(b,c,d,e,f,g,h,i,j,k,l){a.Texture.call(this,null,g,h,i,j,k,e,f,l),this.image={width:c,height:d},this.mipmaps=b,this.flipY=!1,this.generateMipmaps=!1},a.CompressedTexture.prototype=Object.create(a.Texture.prototype),a.CompressedTexture.prototype.constructor=a.CompressedTexture,a.CompressedTexture.prototype.clone=function{var b=new a.CompressedTexture;return a.Texture.prototype.clone.call(this,b),b},a.DataTexture=function(b,c,d,e,f,g,h,i,j,k,l){a.Texture.call(this,null,g,h,i,j,k,e,f,l),this.image={data:b,width:c,height:d}},a.DataTexture.prototype=Object.create(a.Texture.prototype),a.DataTexture.prototype.constructor=a.DataTexture,a.DataTexture.prototype.clone=function{var b=new a.DataTexture;return a.Texture.prototype.clone.call(this,b),b},a.VideoTexture=function(b,c,d,e,f,g,h,i,j){a.Texture.call(this,b,c,d,e,f,g,h,i,j),this.generateMipmaps=!1;var k=this,l=function{requestAnimationFrame(l),b.readyState===b.HAVE_ENOUGH_DATA&&(k.needsUpdate=!0)};l},a.VideoTexture.prototype=Object.create(a.Texture.prototype),a.VideoTexture.prototype.constructor=a.VideoTexture,a.Group=function{a.Object3D.call(this),this.type="Group"},a.Group.prototype=Object.create(a.Object3D.prototype),a.Group.prototype.constructor=a.Group,a.PointCloud=function(b,c){a.Object3D.call(this),this.type="PointCloud",this.geometry=void 0!==b?b:new a.Geometry,this.material=void 0!==c?c:new a.PointCloudMaterial({color:16777215*Math.random})},a.PointCloud.prototype=Object.create(a.Object3D.prototype),a.PointCloud.prototype.constructor=a.PointCloud,a.PointCloud.prototype.raycast=function{var b=new a.Matrix4,c=new a.Ray;return function(d,e){var f=this,g=f.geometry,h=d.params.PointCloud.threshold;if(b.getInverse(this.matrixWorld),c.copy(d.ray).applyMatrix4(b),null===g.boundingBox||c.isIntersectionBox(g.boundingBox)!==!1){var i=h/((this.scale.x+this.scale.y+this.scale.z)/3),j=new a.Vector3,k=function(a,b){var g=c.distanceToPoint(a);if(i>g){var h=c.closestPointToPoint(a);h.applyMatrix4(f.matrixWorld);var j=d.ray.origin.distanceTo(h);e.push({distance:j,distanceToRay:g,point:h.clone,index:b,face:null,object:f})}};if(g instanceof a.BufferGeometry){var l=g.attributes,m=l.position.array;if(void 0!==l.index){var n=l.index.array,o=g.offsets;if(0===o.length){var p={start:0,count:n.length,index:0};o=[p]}for(var q=0,r=o.length;r>q;++q)for(var s=o[q].start,t=o[q].count,u=o[q].index,v=s,w=s+t;w>v;v++){var x=u+n[v];j.fromArray(m,3*x),k(j,x)}}else for(var y=m.length/3,v=0;y>v;v++)j.set(m[3*v],m[3*v+1],m[3*v+2]),k(j,v)}else for(var z=this.geometry.vertices,v=0;v<z.length;v++)k(z[v],v)}}},a.PointCloud.prototype.clone=function(b){return void 0===b&&(b=new a.PointCloud(this.geometry,this.material)),a.Object3D.prototype.clone.call(this,b),b},a.ParticleSystem=function(b,c){return a.warn("THREE.ParticleSystem has been renamed to THREE.PointCloud."),new a.PointCloud(b,c)},a.Line=function(b,c,d){a.Object3D.call(this),this.type="Line",this.geometry=void 0!==b?b:new a.Geometry,this.material=void 0!==c?c:new a.LineBasicMaterial({color:16777215*Math.random}),this.mode=void 0!==d?d:a.LineStrip},a.LineStrip=0,a.LinePieces=1,a.Line.prototype=Object.create(a.Object3D.prototype),a.Line.prototype.constructor=a.Line,a.Line.prototype.raycast=function{var b=new a.Matrix4,c=new a.Ray,d=new a.Sphere;return function(e,f){var g=e.linePrecision,h=g*g,i=this.geometry;if(null===i.boundingSphere&&i.computeBoundingSphere,d.copy(i.boundingSphere),d.applyMatrix4(this.matrixWorld),e.ray.isIntersectionSphere(d)!==!1){b.getInverse(this.matrixWorld),c.copy(e.ray).applyMatrix4(b);var j=new a.Vector3,k=new a.Vector3,l=new a.Vector3,m=new a.Vector3,n=this.mode===a.LineStrip?1:2;if(i instanceof a.BufferGeometry){var o=i.attributes;if(void 0!==o.index){var p=o.index.array,q=o.position.array,r=i.offsets;0===r.length&&(r=[{start:0,count:p.length,index:0}]);for(var s=0;s<r.length;s++)for(var t=r[s].start,u=r[s].count,v=r[s].index,w=t;t+u-1>w;w+=n){var x=v+p[w],y=v+p[w+1];j.fromArray(q,3*x),k.fromArray(q,3*y);var z=c.distanceSqToSegment(j,k,m,l);if(!(z>h)){var A=c.origin.distanceTo(m);A<e.near||A>e.far||f.push({distance:A,point:l.clone.applyMatrix4(this.matrixWorld),index:w,offsetIndex:s,face:null,faceIndex:null,object:this})}}}else for(var q=o.position.array,w=0;w<q.length/3-1;w+=n){j.fromArray(q,3*w),k.fromArray(q,3*w+3);var z=c.distanceSqToSegment(j,k,m,l);if(!(z>h)){var A=c.origin.distanceTo(m);A<e.near||A>e.far||f.push({distance:A,point:l.clone.applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}}else if(i instanceof a.Geometry)for(var B=i.vertices,C=B.length,w=0;C-1>w;w+=n){var z=c.distanceSqToSegment(B[w],B[w+1],m,l);if(!(z>h)){var A=c.origin.distanceTo(m);A<e.near||A>e.far||f.push({distance:A,point:l.clone.applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}}}},a.Line.prototype.clone=function(b){return void 0===b&&(b=new a.Line(this.geometry,this.material,this.mode)),a.Object3D.prototype.clone.call(this,b),b},a.Mesh=function(b,c){a.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==b?b:new a.Geometry,this.material=void 0!==c?c:new a.MeshBasicMaterial({color:16777215*Math.random}),this.updateMorphTargets},a.Mesh.prototype=Object.create(a.Object3D.prototype),a.Mesh.prototype.constructor=a.Mesh,a.Mesh.prototype.updateMorphTargets=function{if(void 0!==this.geometry.morphTargets&&this.geometry.morphTargets.length>0){this.morphTargetBase=-1,this.morphTargetForcedOrder=[],this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var a=0,b=this.geometry.morphTargets.length;b>a;a++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[a].name]=a}},a.Mesh.prototype.getMorphTargetIndexByName=function(b){return void 0!==this.morphTargetDictionary[b]?this.morphTargetDictionary[b]:(a.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0."),0)},a.Mesh.prototype.raycast=function{var b=new a.Matrix4,c=new a.Ray,d=new a.Sphere,e=new a.Vector3,f=new a.Vector3,g=new a.Vector3;return function(h,i){var j=this.geometry;if(null===j.boundingSphere&&j.computeBoundingSphere,d.copy(j.boundingSphere),d.applyMatrix4(this.matrixWorld),h.ray.isIntersectionSphere(d)!==!1&&(b.getInverse(this.matrixWorld),c.copy(h.ray).applyMatrix4(b),null===j.boundingBox||c.isIntersectionBox(j.boundingBox)!==!1))if(j instanceof a.BufferGeometry){var k=this.material;if(void 0===k)return;var l,m,n,o=j.attributes,p=h.precision;if(void 0!==o.index){var q=o.index.array,r=o.position.array,s=j.offsets;0===s.length&&(s=[{start:0,count:q.length,index:0}]);for(var t=0,u=s.length;u>t;++t)for(var v=s[t].start,w=s[t].count,x=s[t].index,y=v,z=v+w;z>y;y+=3){if(l=x+q[y],m=x+q[y+1],n=x+q[y+2],e.fromArray(r,3*l),f.fromArray(r,3*m),g.fromArray(r,3*n),k.side===a.BackSide)var A=c.intersectTriangle(g,f,e,!0);else var A=c.intersectTriangle(e,f,g,k.side!==a.DoubleSide);if(null!==A){A.applyMatrix4(this.matrixWorld);var B=h.ray.origin.distanceTo(A);p>B||B<h.near||B>h.far||i.push({distance:B,point:A,face:new a.Face3(l,m,n,a.Triangle.normal(e,f,g)),faceIndex:null,object:this})}}}else for(var r=o.position.array,y=0,C=0,z=r.length;z>y;y+=3,C+=9){if(l=y,m=y+1,n=y+2,e.fromArray(r,C),f.fromArray(r,C+3),g.fromArray(r,C+6),k.side===a.BackSide)var A=c.intersectTriangle(g,f,e,!0);else var A=c.intersectTriangle(e,f,g,k.side!==a.DoubleSide);if(null!==A){A.applyMatrix4(this.matrixWorld);var B=h.ray.origin.distanceTo(A);p>B||B<h.near||B>h.far||i.push({distance:B,point:A,face:new a.Face3(l,m,n,a.Triangle.normal(e,f,g)),faceIndex:null,object:this})}}}else if(j instanceof a.Geometry)for(var l,m,n,D=this.material instanceof a.MeshFaceMaterial,E=D===!0?this.material.materials:null,p=h.precision,F=j.vertices,G=0,H=j.faces.length;H>G;G++){var I=j.faces[G],k=D===!0?E[I.materialIndex]:this.material;if(void 0!==k){if(l=F[I.a],m=F[I.b],n=F[I.c],k.morphTargets===!0){var J=j.morphTargets,K=this.morphTargetInfluences;e.set(0,0,0),f.set(0,0,0),g.set(0,0,0);for(var L=0,M=J.length;M>L;L++){var N=K[L];if(0!==N){var O=J[L].vertices;e.x+=(O[I.a].x-l.x)*N,e.y+=(O[I.a].y-l.y)*N,e.z+=(O[I.a].z-l.z)*N,f.x+=(O[I.b].x-m.x)*N,f.y+=(O[I.b].y-m.y)*N,f.z+=(O[I.b].z-m.z)*N,g.x+=(O[I.c].x-n.x)*N,g.y+=(O[I.c].y-n.y)*N,g.z+=(O[I.c].z-n.z)*N}}e.add(l),f.add(m),g.add(n),l=e,m=f,n=g}if(k.side===a.BackSide)var A=c.intersectTriangle(n,m,l,!0);else var A=c.intersectTriangle(l,m,n,k.side!==a.DoubleSide);if(null!==A){A.applyMatrix4(this.matrixWorld);var B=h.ray.origin.distanceTo(A);p>B||B<h.near||B>h.far||i.push({distance:B,point:A,face:I,faceIndex:G,object:this})}}}}},a.Mesh.prototype.clone=function(b,c){return void 0===b&&(b=new a.Mesh(this.geometry,this.material)),a.Object3D.prototype.clone.call(this,b,c),b},a.Bone=function(b){a.Object3D.call(this),this.type="Bone",this.skin=b},a.Bone.prototype=Object.create(a.Object3D.prototype),a.Bone.prototype.constructor=a.Bone,a.Skeleton=function(b,c,d){if(this.useVertexTexture=void 0!==d?d:!0,this.identityMatrix=new a.Matrix4,b=b||[],this.bones=b.slice(0),this.useVertexTexture){var e;e=this.bones.length>256?64:this.bones.length>64?32:this.bones.length>16?16:8,this.boneTextureWidth=e,this.boneTextureHeight=e,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new a.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,a.RGBAFormat,a.FloatType),this.boneTexture.minFilter=a.NearestFilter,this.boneTexture.magFilter=a.NearestFilter,this.boneTexture.generateMipmaps=!1,this.boneTexture.flipY=!1}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===c)this.calculateInverses;else if(this.bones.length===c.length)this.boneInverses=c.slice(0);else{a.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var f=0,g=this.bones.length;g>f;f++)this.boneInverses.push(new a.Matrix4)}},a.Skeleton.prototype.calculateInverses=function{this.boneInverses=[];for(var b=0,c=this.bones.length;c>b;b++){var d=new a.Matrix4;this.bones[b]&&d.getInverse(this.bones[b].matrixWorld),this.boneInverses.push(d)}},a.Skeleton.prototype.pose=function{for(var a,b=0,c=this.bones.length;c>b;b++)a=this.bones[b],a&&a.matrixWorld.getInverse(this.boneInverses[b]);for(var b=0,c=this.bones.length;c>b;b++)a=this.bones[b],a&&(a.parent?(a.matrix.getInverse(a.parent.matrixWorld),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale))},a.Skeleton.prototype.update=function{var b=new a.Matrix4;return function{for(var a=0,c=this.bones.length;c>a;a++){var d=this.bones[a]?this.bones[a].matrixWorld:this.identityMatrix;b.multiplyMatrices(d,this.boneInverses[a]),b.flattenToArrayOffset(this.boneMatrices,16*a)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}},a.SkinnedMesh=function(b,c,d){a.Mesh.call(this,b,c),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new a.Matrix4,this.bindMatrixInverse=new a.Matrix4;var e=[];if(this.geometry&&void 0!==this.geometry.bones){for(var f,g,h,i,j,k=0,l=this.geometry.bones.length;l>k;++k)g=this.geometry.bones[k],h=g.pos,i=g.rotq,j=g.scl,f=new a.Bone(this),e.push(f),f.name=g.name,f.position.set(h[0],h[1],h[2]),f.quaternion.set(i[0],i[1],i[2],i[3]),void 0!==j?f.scale.set(j[0],j[1],j[2]):f.scale.set(1,1,1);for(var k=0,l=this.geometry.bones.length;l>k;++k)g=this.geometry.bones[k],-1!==g.parent?e[g.parent].add(e[k]):this.add(e[k])}this.normalizeSkinWeights,this.updateMatrixWorld(!0),this.bind(new a.Skeleton(e,void 0,d))},a.SkinnedMesh.prototype=Object.create(a.Mesh.prototype),a.SkinnedMesh.prototype.constructor=a.SkinnedMesh,a.SkinnedMesh.prototype.bind=function(a,b){this.skeleton=a,void 0===b&&(this.updateMatrixWorld(!0),b=this.matrixWorld),this.bindMatrix.copy(b),this.bindMatrixInverse.getInverse(b)},a.SkinnedMesh.prototype.pose=function{this.skeleton.pose},a.SkinnedMesh.prototype.normalizeSkinWeights=function{if(this.geometry instanceof a.Geometry)for(var b=0;b<this.geometry.skinIndices.length;b++){var c=this.geometry.skinWeights[b],d=1/c.lengthManhattan;d!==1/0?c.multiplyScalar(d):c.set(1)}},a.SkinnedMesh.prototype.updateMatrixWorld=function(b){a.Mesh.prototype.updateMatrixWorld.call(this,!0),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):a.warn("THREE.SkinnedMesh unreckognized bindMode: "+this.bindMode)},a.SkinnedMesh.prototype.clone=function(b){return void 0===b&&(b=new a.SkinnedMesh(this.geometry,this.material,this.useVertexTexture)),a.Mesh.prototype.clone.call(this,b),b},a.MorphAnimMesh=function(b,c){a.Mesh.call(this,b,c),this.type="MorphAnimMesh",this.duration=1e3,this.mirroredLoop=!1,this.time=0,this.lastKeyframe=0,this.currentKeyframe=0,this.direction=1,this.directionBackwards=!1,this.setFrameRange(0,this.geometry.morphTargets.length-1)},a.MorphAnimMesh.prototype=Object.create(a.Mesh.prototype),a.MorphAnimMesh.prototype.constructor=a.MorphAnimMesh,a.MorphAnimMesh.prototype.setFrameRange=function(a,b){this.startKeyframe=a,this.endKeyframe=b,this.length=this.endKeyframe-this.startKeyframe+1},a.MorphAnimMesh.prototype.setDirectionForward=function{this.direction=1,this.directionBackwards=!1},a.MorphAnimMesh.prototype.setDirectionBackward=function{this.direction=-1,this.directionBackwards=!0},a.MorphAnimMesh.prototype.parseAnimations=function{var a=this.geometry;a.animations||(a.animations={});for(var b,c=a.animations,d=/([a-z]+)_?(\d+)/,e=0,f=a.morphTargets.length;f>e;e++){var g=a.morphTargets[e],h=g.name.match(d);if(h&&h.length>1){var i=h[1];c[i]||(c[i]={start:1/0,end:-(1/0)});var j=c[i];e<j.start&&(j.start=e),e>j.end&&(j.end=e),b||(b=i)}}a.firstAnimation=b},a.MorphAnimMesh.prototype.setAnimationLabel=function(a,b,c){this.geometry.animations||(this.geometry.animations={}),this.geometry.animations[a]={start:b,end:c}},a.MorphAnimMesh.prototype.playAnimation=function(b,c){ var d=this.geometry.animations[b];d?(this.setFrameRange(d.start,d.end),this.duration=1e3*((d.end-d.start)/c),this.time=0):a.warn("THREE.MorphAnimMesh: animation["+b+"] undefined in .playAnimation")},a.MorphAnimMesh.prototype.updateAnimation=function(b){var c=this.duration/this.length;this.time+=this.direction*b,this.mirroredLoop?(this.time>this.duration||this.time<0)&&(this.direction*=-1,this.time>this.duration&&(this.time=this.duration,this.directionBackwards=!0),this.time<0&&(this.time=0,this.directionBackwards=!1)):(this.time=this.time%this.duration,this.time<0&&(this.time+=this.duration));var d=this.startKeyframe+a.Math.clamp(Math.floor(this.time/c),0,this.length-1);d!==this.currentKeyframe&&(this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[d]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=d);var e=this.time%c/c;this.directionBackwards&&(e=1-e),this.morphTargetInfluences[this.currentKeyframe]=e,this.morphTargetInfluences[this.lastKeyframe]=1-e},a.MorphAnimMesh.prototype.interpolateTargets=function(a,b,c){for(var d=this.morphTargetInfluences,e=0,f=d.length;f>e;e++)d[e]=0;a>-1&&(d[a]=1-c),b>-1&&(d[b]=c)},a.MorphAnimMesh.prototype.clone=function(b){return void 0===b&&(b=new a.MorphAnimMesh(this.geometry,this.material)),b.duration=this.duration,b.mirroredLoop=this.mirroredLoop,b.time=this.time,b.lastKeyframe=this.lastKeyframe,b.currentKeyframe=this.currentKeyframe,b.direction=this.direction,b.directionBackwards=this.directionBackwards,a.Mesh.prototype.clone.call(this,b),b},a.LOD=function{a.Object3D.call(this),this.objects=[]},a.LOD.prototype=Object.create(a.Object3D.prototype),a.LOD.prototype.constructor=a.LOD,a.LOD.prototype.addLevel=function(a,b){void 0===b&&(b=0),b=Math.abs(b);for(var c=0;c<this.objects.length&&!(b<this.objects[c].distance);c++);this.objects.splice(c,0,{distance:b,object:a}),this.add(a)},a.LOD.prototype.getObjectForDistance=function(a){for(var b=1,c=this.objects.length;c>b&&!(a<this.objects[b].distance);b++);return this.objects[b-1].object},a.LOD.prototype.raycast=function{var b=new a.Vector3;return function(a,c){b.setFromMatrixPosition(this.matrixWorld);var d=a.ray.origin.distanceTo(b);this.getObjectForDistance(d).raycast(a,c)}},a.LOD.prototype.update=function{var b=new a.Vector3,c=new a.Vector3;return function(a){if(this.objects.length>1){b.setFromMatrixPosition(a.matrixWorld),c.setFromMatrixPosition(this.matrixWorld);var d=b.distanceTo(c);this.objects[0].object.visible=!0;for(var e=1,f=this.objects.length;f>e&&d>=this.objects[e].distance;e++)this.objects[e-1].object.visible=!1,this.objects[e].object.visible=!0;for(f>e;e++)this.objects[e].object.visible=!1}}},a.LOD.prototype.clone=function(b){void 0===b&&(b=new a.LOD),a.Object3D.prototype.clone.call(this,b);for(var c=0,d=this.objects.length;d>c;c++){var e=this.objects[c].object.clone;e.visible=0===c,b.addLevel(e,this.objects[c].distance)}return b},a.Sprite=function{var b=new Uint16Array([0,1,2,0,2,3]),c=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),d=new Float32Array([0,0,1,0,1,1,0,1]),e=new a.BufferGeometry;return e.addAttribute("index",new a.BufferAttribute(b,1)),e.addAttribute("position",new a.BufferAttribute(c,3)),e.addAttribute("uv",new a.BufferAttribute(d,2)),function(b){a.Object3D.call(this),this.type="Sprite",this.geometry=e,this.material=void 0!==b?b:new a.SpriteMaterial}},a.Sprite.prototype=Object.create(a.Object3D.prototype),a.Sprite.prototype.constructor=a.Sprite,a.Sprite.prototype.raycast=function{var b=new a.Vector3;return function(a,c){b.setFromMatrixPosition(this.matrixWorld);var d=a.ray.distanceToPoint(b);d>this.scale.x||c.push({distance:d,point:this.position,face:null,object:this})}},a.Sprite.prototype.clone=function(b){return void 0===b&&(b=new a.Sprite(this.material)),a.Object3D.prototype.clone.call(this,b),b},a.Particle=a.Sprite,a.LensFlare=function(b,c,d,e,f){a.Object3D.call(this),this.lensFlares=[],this.positionScreen=new a.Vector3,this.customUpdateCallback=void 0,void 0!==b&&this.add(b,c,d,e,f)},a.LensFlare.prototype=Object.create(a.Object3D.prototype),a.LensFlare.prototype.constructor=a.LensFlare,a.LensFlare.prototype.add=function(b,c,d,e,f,g){void 0===c&&(c=-1),void 0===d&&(d=0),void 0===g&&(g=1),void 0===f&&(f=new a.Color(16777215)),void 0===e&&(e=a.NormalBlending),d=Math.min(d,Math.max(0,d)),this.lensFlares.push({texture:b,size:c,distance:d,x:0,y:0,z:0,scale:1,rotation:1,opacity:g,color:f,blending:e})},a.LensFlare.prototype.updateLensFlares=function{var a,b,c=this.lensFlares.length,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;c>a;a++)b=this.lensFlares[a],b.x=this.positionScreen.x+d*b.distance,b.y=this.positionScreen.y+e*b.distance,b.wantedRotation=b.x*Math.PI*.25,b.rotation+=.25*(b.wantedRotation-b.rotation)},a.Scene=function{a.Object3D.call(this),this.type="Scene",this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0},a.Scene.prototype=Object.create(a.Object3D.prototype),a.Scene.prototype.constructor=a.Scene,a.Scene.prototype.clone=function(b){return void 0===b&&(b=new a.Scene),a.Object3D.prototype.clone.call(this,b),null!==this.fog&&(b.fog=this.fog.clone),null!==this.overrideMaterial&&(b.overrideMaterial=this.overrideMaterial.clone),b.autoUpdate=this.autoUpdate,b.matrixAutoUpdate=this.matrixAutoUpdate,b},a.Fog=function(b,c,d){this.name="",this.color=new a.Color(b),this.near=void 0!==c?c:1,this.far=void 0!==d?d:1e3},a.Fog.prototype.clone=function{return new a.Fog(this.color.getHex,this.near,this.far)},a.FogExp2=function(b,c){this.name="",this.color=new a.Color(b),this.density=void 0!==c?c:25e-5},a.FogExp2.prototype.clone=function{return new a.FogExp2(this.color.getHex,this.density)},a.ShaderChunk={},a.ShaderChunk.common="#define PI 3.14159\n#define PI2 6.28318\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n\nfloat square( in float a ) { return a*a; }\nvec2 square( in vec2 a )  { return vec2( a.x*a.x, a.y*a.y ); }\nvec3  square( in vec3 a )  { return vec3( a.x*a.x, a.y*a.y, a.z*a.z ); }\nvec4  square( in vec4 a )  { return vec4( a.x*a.x, a.y*a.y, a.z*a.z, a.w*a.w ); }\nfloat saturate( in float a ) { return clamp( a, 0.0, 1.0 ); }\nvec2  saturate( in vec2 a )  { return clamp( a, 0.0, 1.0 ); }\nvec3  saturate( in vec3 a )  { return clamp( a, 0.0, 1.0 ); }\nvec4  saturate( in vec4 a )  { return clamp( a, 0.0, 1.0 ); }\nfloat average( in float a ) { return a; }\nfloat average( in vec2 a )  { return ( a.x + a.y) * 0.5; }\nfloat average( in vec3 a )  { return ( a.x + a.y + a.z) / 3.0; }\nfloat average( in vec4 a )  { return ( a.x + a.y + a.z + a.w) * 0.25; }\nfloat whiteCompliment( in float a ) { return saturate( 1.0 - a ); }\nvec2  whiteCompliment( in vec2 a )  { return saturate( vec2(1.0) - a ); }\nvec3  whiteCompliment( in vec3 a )  { return saturate( vec3(1.0) - a ); }\nvec4  whiteCompliment( in vec4 a )  { return saturate( vec4(1.0) - a ); }\nvec3 transformDirection( in vec3 normal, in mat4 matrix ) {\n	return normalize( ( matrix * vec4( normal, 0.0 ) ).xyz );\n}\n// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\nvec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {\n	return normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal) {\n	float distance = dot( planeNormal, point-pointOnPlane );\n	return point - distance * planeNormal;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n	return sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n	return pointOnLine + lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) );\n}\nfloat calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {\n	if ( decayExponent > 0.0 ) {\n	  return pow( saturate( 1.0 - lightDistance / cutoffDistance ), decayExponent );\n	}\n	return 1.0;\n}\n\nvec3 inputToLinear( in vec3 a ) {\n#ifdef GAMMA_INPUT\n	return pow( a, vec3( float( GAMMA_FACTOR ) ) );\n#else\n	return a;\n#endif\n}\nvec3 linearToOutput( in vec3 a ) {\n#ifdef GAMMA_OUTPUT\n	return pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n#else\n	return a;\n#endif\n}\n",a.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\n	if ( diffuseColor.a < ALPHATEST ) discard;\n\n#endif\n",a.ShaderChunk.lights_lambert_vertex="vLightFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n\n	vLightBack = vec3( 0.0 );\n\n#endif\n\ntransformedNormal = normalize( transformedNormal );\n\n#if MAX_DIR_LIGHTS > 0\n\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n	vec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n	float dotProduct = dot( transformedNormal, dirVector );\n	vec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n	#ifdef DOUBLE_SIDED\n\n		vec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n		#ifdef WRAP_AROUND\n\n			vec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n		#endif\n\n	#endif\n\n	#ifdef WRAP_AROUND\n\n		vec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n		directionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n\n		#ifdef DOUBLE_SIDED\n\n			directionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n\n		#endif\n\n	#endif\n\n	vLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n\n	#ifdef DOUBLE_SIDED\n\n		vLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n\n	#endif\n\n}\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n	for( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n		vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n		vec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n		float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n		lVector = normalize( lVector );\n		float dotProduct = dot( transformedNormal, lVector );\n\n		vec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n		#ifdef DOUBLE_SIDED\n\n			vec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n			#ifdef WRAP_AROUND\n\n				vec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n			#endif\n\n		#endif\n\n		#ifdef WRAP_AROUND\n\n			vec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n			pointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n\n			#ifdef DOUBLE_SIDED\n\n				pointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n\n			#endif\n\n		#endif\n\n		vLightFront += pointLightColor[ i ] * pointLightWeighting * attenuation;\n\n		#ifdef DOUBLE_SIDED\n\n			vLightBack += pointLightColor[ i ] * pointLightWeightingBack * attenuation;\n\n		#endif\n\n	}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n	for( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n		vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n		vec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n		float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\n\n		if ( spotEffect > spotLightAngleCos[ i ] ) {\n\n			spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n			float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n			lVector = normalize( lVector );\n\n			float dotProduct = dot( transformedNormal, lVector );\n			vec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n			#ifdef DOUBLE_SIDED\n\n				vec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n				#ifdef WRAP_AROUND\n\n					vec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n				#endif\n\n			#endif\n\n			#ifdef WRAP_AROUND\n\n				vec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n				spotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\n\n				#ifdef DOUBLE_SIDED\n\n					spotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\n\n				#endif\n\n			#endif\n\n			vLightFront += spotLightColor[ i ] * spotLightWeighting * attenuation * spotEffect;\n\n			#ifdef DOUBLE_SIDED\n\n				vLightBack += spotLightColor[ i ] * spotLightWeightingBack * attenuation * spotEffect;\n\n			#endif\n\n		}\n\n	}\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n	for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n		vec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n		float dotProduct = dot( transformedNormal, lVector );\n\n		float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n		float hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;\n\n		vLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n		#ifdef DOUBLE_SIDED\n\n			vLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n\n		#endif\n\n	}\n\n#endif\n\nvLightFront += ambientLightColor;\n\n#ifdef DOUBLE_SIDED\n\n	vLightBack += ambientLightColor;\n\n#endif\n",a.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\n	uniform vec4 offsetRepeat;\n	uniform sampler2D map;\n\n#endif\n",a.ShaderChunk.default_vertex="#ifdef USE_SKINNING\n\n	vec4 mvPosition = modelViewMatrix * skinned;\n\n#elif defined( USE_MORPHTARGETS )\n\n	vec4 mvPosition = modelViewMatrix * vec4( morphed, 1.0 );\n\n#else\n\n	vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;\n",a.ShaderChunk.map_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n	varying vec2 vUv;\n\n#endif\n\n#ifdef USE_MAP\n\n	uniform sampler2D map;\n\n#endif",a.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\n	mat4 skinMatrix = mat4( 0.0 );\n	skinMatrix += skinWeight.x * boneMatX;\n	skinMatrix += skinWeight.y * boneMatY;\n	skinMatrix += skinWeight.z * boneMatZ;\n	skinMatrix += skinWeight.w * boneMatW;\n	skinMatrix  = bindMatrixInverse * skinMatrix * bindMatrix;\n\n	#ifdef USE_MORPHNORMALS\n\n	vec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\n\n	#else\n\n	vec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\n\n	#endif\n\n#endif\n",a.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\n	#ifdef USE_LOGDEPTHBUF_EXT\n\n		varying float vFragDepth;\n\n	#endif\n\n	uniform float logDepthBufFC;\n\n#endif",a.ShaderChunk.lightmap_pars_vertex="#ifdef USE_LIGHTMAP\n\n	varying vec2 vUv2;\n\n#endif",a.ShaderChunk.lights_phong_fragment="#ifndef FLAT_SHADED\n\n	vec3 normal = normalize( vNormal );\n\n	#ifdef DOUBLE_SIDED\n\n		normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\n	#endif\n\n#else\n\n	vec3 fdx = dFdx( vViewPosition );\n	vec3 fdy = dFdy( vViewPosition );\n	vec3 normal = normalize( cross( fdx, fdy ) );\n\n#endif\n\nvec3 viewPosition = normalize( vViewPosition );\n\n#ifdef USE_NORMALMAP\n\n	normal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n	normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd );\n\n#endif\n\nvec3 totalDiffuseLight = vec3( 0.0 );\nvec3 totalSpecularLight = vec3( 0.0 );\n\n#if MAX_POINT_LIGHTS > 0\n\n	for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n		vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n		vec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n		float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n		lVector = normalize( lVector );\n\n		// diffuse\n\n		float dotProduct = dot( normal, lVector );\n\n		#ifdef WRAP_AROUND\n\n			float pointDiffuseWeightFull = max( dotProduct, 0.0 );\n			float pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n			vec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n\n		#else\n\n			float pointDiffuseWeight = max( dotProduct, 0.0 );\n\n		#endif\n\n		totalDiffuseLight += pointLightColor[ i ] * pointDiffuseWeight * attenuation;\n\n				// specular\n\n		vec3 pointHalfVector = normalize( lVector + viewPosition );\n		float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\n		float pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n\n		float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n		vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );\n		totalSpecularLight += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * attenuation * specularNormalization;\n\n	}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n	for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n		vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n		vec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n		float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n		lVector = normalize( lVector );\n\n		float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\n\n		if ( spotEffect > spotLightAngleCos[ i ] ) {\n\n			spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n			// diffuse\n\n			float dotProduct = dot( normal, lVector );\n\n			#ifdef WRAP_AROUND\n\n				float spotDiffuseWeightFull = max( dotProduct, 0.0 );\n				float spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n				vec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n\n			#else\n\n				float spotDiffuseWeight = max( dotProduct, 0.0 );\n\n			#endif\n\n			totalDiffuseLight += spotLightColor[ i ] * spotDiffuseWeight * attenuation * spotEffect;\n\n			// specular\n\n			vec3 spotHalfVector = normalize( lVector + viewPosition );\n			float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\n			float spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n\n			float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n			vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );\n			totalSpecularLight += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * attenuation * specularNormalization * spotEffect;\n\n		}\n\n	}\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n	for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n		vec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n		// diffuse\n\n		float dotProduct = dot( normal, dirVector );\n\n		#ifdef WRAP_AROUND\n\n			float dirDiffuseWeightFull = max( dotProduct, 0.0 );\n			float dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n			vec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n\n		#else\n\n			float dirDiffuseWeight = max( dotProduct, 0.0 );\n\n		#endif\n\n		totalDiffuseLight += directionalLightColor[ i ] * dirDiffuseWeight;\n\n		// specular\n\n		vec3 dirHalfVector = normalize( dirVector + viewPosition );\n		float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\n		float dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n\n		/*\n		// fresnel term from skin shader\n		const float F0 = 0.128;\n\n		float base = 1.0 - dot( viewPosition, dirHalfVector );\n		float exponential = pow( base, 5.0 );\n\n		float fresnel = exponential + F0 * ( 1.0 - exponential );\n		*/\n\n		/*\n		// fresnel term from fresnel shader\n		const float mFresnelBias = 0.08;\n		const float mFresnelScale = 0.3;\n		const float mFresnelPower = 5.0;\n\n		float fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );\n		*/\n\n		float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n		// 		dirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;\n\n		vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\n		totalSpecularLight += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n\n\n	}\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n	for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n		vec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n		// diffuse\n\n		float dotProduct = dot( normal, lVector );\n		float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n		vec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n		totalDiffuseLight += hemiColor;\n\n		// specular (sky light)\n\n		vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\n		float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\n		float hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );\n\n		// specular (ground light)\n\n		vec3 lVectorGround = -lVector;\n\n		vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\n		float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\n		float hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );\n\n		float dotProductGround = dot( normal, lVectorGround );\n\n		float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n		vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );\n		vec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );\n		totalSpecularLight += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n\n	}\n\n#endif\n\n#ifdef METAL\n\n	outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) * specular + totalSpecularLight + emissive;\n\n#else\n\n	outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) + totalSpecularLight + emissive;\n\n#endif\n",a.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\n	uniform vec3 fogColor;\n\n	#ifdef FOG_EXP2\n\n		uniform float fogDensity;\n\n	#else\n\n		uniform float fogNear;\n		uniform float fogFar;\n	#endif\n\n#endif",a.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\n	vec3 morphedNormal = vec3( 0.0 );\n\n	morphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n	morphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n	morphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n	morphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n	morphedNormal += normal;\n\n#endif",a.ShaderChunk.envmap_pars_fragment="#ifdef USE_ENVMAP\n\n	uniform float reflectivity;\n	#ifdef ENVMAP_TYPE_CUBE\n		uniform samplerCube envMap;\n	#else\n		uniform sampler2D envMap;\n	#endif\n	uniform float flipEnvMap;\n\n	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n		uniform float refractionRatio;\n\n	#else\n\n		varying vec3 vReflect;\n\n	#endif\n\n#endif\n",a.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n	gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif",a.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\n	uniform sampler2D normalMap;\n	uniform vec2 normalScale;\n\n	// Per-Pixel Tangent Space Normal Mapping\n	// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n	vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\n		vec3 q0 = dFdx( eye_pos.xyz );\n		vec3 q1 = dFdy( eye_pos.xyz );\n		vec2 st0 = dFdx( vUv.st );\n		vec2 st1 = dFdy( vUv.st );\n\n		vec3 S = normalize( q0 * st1.t - q1 * st0.t );\n		vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n		vec3 N = normalize( surf_norm );\n\n		vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n		mapN.xy = normalScale * mapN.xy;\n		mat3 tsn = mat3( S, T, N );\n		return normalize( tsn * mapN );\n\n	}\n\n#endif\n",a.ShaderChunk.lights_phong_pars_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n	varying vec3 vWorldPosition;\n\n#endif\n",a.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\n	varying vec2 vUv2;\n	uniform sampler2D lightMap;\n\n#endif",a.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\n	for( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n		vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\n	}\n\n#endif",a.ShaderChunk.lights_phong_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n	vWorldPosition = worldPosition.xyz;\n\n#endif",a.ShaderChunk.map_fragment="#ifdef USE_MAP\n\n	vec4 texelColor = texture2D( map, vUv );\n\n	texelColor.xyz = inputToLinear( texelColor.xyz );\n\n	diffuseColor *= texelColor;\n\n#endif",a.ShaderChunk.lightmap_vertex="#ifdef USE_LIGHTMAP\n\n	vUv2 = uv2;\n\n#endif",a.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\n	diffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\n#endif\n",a.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\n	varying vec3 vColor;\n\n#endif\n",a.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\n	vColor.xyz = inputToLinear( color.xyz );\n\n#endif",a.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\n	#ifdef USE_MORPHTARGETS\n\n	vec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );\n\n	#else\n\n	vec4 skinVertex = bindMatrix * vec4( position, 1.0 );\n\n	#endif\n\n	vec4 skinned = vec4( 0.0 );\n	skinned += boneMatX * skinVertex * skinWeight.x;\n	skinned += boneMatY * skinVertex * skinWeight.y;\n	skinned += boneMatZ * skinVertex * skinWeight.z;\n	skinned += boneMatW * skinVertex * skinWeight.w;\n	skinned  = bindMatrixInverse * skinned;\n\n#endif\n",a.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n	varying vec3 vReflect;\n\n	uniform float refractionRatio;\n\n#endif\n",a.ShaderChunk.linear_to_gamma_fragment="\n	outgoingLight = linearToOutput( outgoingLight );\n",a.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\n	varying vec3 vColor;\n\n#endif",a.ShaderChunk.lights_lambert_pars_vertex="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n	uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n	uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n	uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n	uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n	uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n	uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n	uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n	uniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n	uniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n	uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n	uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n	uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n	uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n	uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n	uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n	uniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#ifdef WRAP_AROUND\n\n	uniform vec3 wrapRGB;\n\n#endif\n",a.ShaderChunk.map_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n	varying vec2 vUv;\n	uniform vec4 offsetRepeat;\n\n#endif\n",a.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n\n	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n		vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n		// Transforming Normal Vectors with the Inverse Transformation\n		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n		#ifdef ENVMAP_MODE_REFLECTION\n\n			vec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\n		#else\n\n			vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n		#endif\n\n	#else\n\n		vec3 reflectVec = vReflect;\n\n	#endif\n\n	#ifdef DOUBLE_SIDED\n		float flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n	#else\n		float flipNormal = 1.0;\n	#endif\n\n	#ifdef ENVMAP_TYPE_CUBE\n		vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n	#elif defined( ENVMAP_TYPE_EQUIREC )\n		vec2 sampleUV;\n		sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n		sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n		vec4 envColor = texture2D( envMap, sampleUV );\n\n	#elif defined( ENVMAP_TYPE_SPHERE )\n		vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n		vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n	#endif\n\n	envColor.xyz = inputToLinear( envColor.xyz );\n\n	#ifdef ENVMAP_BLENDING_MULTIPLY\n\n		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n	#elif defined( ENVMAP_BLENDING_MIX )\n\n		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n	#elif defined( ENVMAP_BLENDING_ADD )\n\n		outgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n	#endif\n\n#endif\n",a.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\n	uniform sampler2D specularMap;\n\n#endif",a.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\n	gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\n	#ifdef USE_LOGDEPTHBUF_EXT\n\n		vFragDepth = 1.0 + gl_Position.w;\n\n#else\n\n		gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n	#endif\n\n#endif",a.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n\n	#ifndef USE_MORPHNORMALS\n\n	uniform float morphTargetInfluences[ 8 ];\n\n	#else\n\n	uniform float morphTargetInfluences[ 4 ];\n\n	#endif\n\n#endif",a.ShaderChunk.specularmap_fragment="float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n	vec4 texelSpecular = texture2D( specularMap, vUv );\n	specularStrength = texelSpecular.r;\n\n#else\n\n	specularStrength = 1.0;\n\n#endif",a.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\n	#ifdef USE_LOGDEPTHBUF_EXT\n\n		float depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n	#else\n\n		float depth = gl_FragCoord.z / gl_FragCoord.w;\n\n	#endif\n\n	#ifdef FOG_EXP2\n\n		float fogFactor = exp2( - square( fogDensity ) * square( depth ) * LOG2 );\n		fogFactor = whiteCompliment( fogFactor );\n\n	#else\n\n		float fogFactor = smoothstep( fogNear, fogFar, depth );\n\n	#endif\n	\n	outgoingLight = mix( outgoingLight, fogColor, fogFactor );\n\n#endif",a.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\n	uniform sampler2D bumpMap;\n	uniform float bumpScale;\n\n	// Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\n	// http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\n\n	// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n	vec2 dHdxy_fwd {\n\n		vec2 dSTdx = dFdx( vUv );\n		vec2 dSTdy = dFdy( vUv );\n\n		float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n		float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n		float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\n		return vec2( dBx, dBy );\n\n	}\n\n	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n		vec3 vSigmaX = dFdx( surf_pos );\n		vec3 vSigmaY = dFdy( surf_pos );\n		vec3 vN = surf_norm;		// normalized\n\n		vec3 R1 = cross( vSigmaY, vN );\n		vec3 R2 = cross( vN, vSigmaX );\n\n		float fDet = dot( vSigmaX, R1 );\n\n		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n		return normalize( abs( fDet ) * surf_norm - vGrad );\n\n	}\n\n#endif\n", a.ShaderChunk.defaultnormal_vertex="#ifdef USE_SKINNING\n\n	vec3 objectNormal = skinnedNormal.xyz;\n\n#elif defined( USE_MORPHNORMALS )\n\n	vec3 objectNormal = morphedNormal;\n\n#else\n\n	vec3 objectNormal = normal;\n\n#endif\n\n#ifdef FLIP_SIDED\n\n	objectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;\n",a.ShaderChunk.lights_phong_pars_fragment="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n	uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n	uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n	uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n	uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n	uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n	uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\n	uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n	uniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n	uniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n	uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n	uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n	uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n	uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n	uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n	uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n	uniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n	varying vec3 vWorldPosition;\n\n#endif\n\n#ifdef WRAP_AROUND\n\n	uniform vec3 wrapRGB;\n\n#endif\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n	varying vec3 vNormal;\n\n#endif\n",a.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n\n	mat4 boneMatX = getBoneMatrix( skinIndex.x );\n	mat4 boneMatY = getBoneMatrix( skinIndex.y );\n	mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n	mat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif",a.ShaderChunk.map_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n	vUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif",a.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\n	outgoingLight *= diffuseColor.xyz * texture2D( lightMap, vUv2 ).xyz;\n\n#endif",a.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\n	varying vec4 vShadowCoord[ MAX_SHADOWS ];\n	uniform mat4 shadowMatrix[ MAX_SHADOWS ];\n\n#endif",a.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\n	diffuseColor.rgb *= vColor;\n\n#endif",a.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\n	vec3 morphed = vec3( 0.0 );\n	morphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n	morphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n	morphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n	morphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n	#ifndef USE_MORPHNORMALS\n\n	morphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n	morphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n	morphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n	morphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n	#endif\n\n	morphed += position;\n\n#endif",a.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n	vec3 worldNormal = transformDirection( objectNormal, modelMatrix );\n\n	vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n	#ifdef ENVMAP_MODE_REFLECTION\n\n		vReflect = reflect( cameraToVertex, worldNormal );\n\n	#else\n\n		vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n	#endif\n\n#endif\n",a.ShaderChunk.shadowmap_fragment="#ifdef USE_SHADOWMAP\n\n	#ifdef SHADOWMAP_DEBUG\n\n		vec3 frustumColors[3];\n		frustumColors[0] = vec3( 1.0, 0.5, 0.0 );\n		frustumColors[1] = vec3( 0.0, 1.0, 0.8 );\n		frustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n\n	#endif\n\n	#ifdef SHADOWMAP_CASCADE\n\n		int inFrustumCount = 0;\n\n	#endif\n\n	float fDepth;\n	vec3 shadowColor = vec3( 1.0 );\n\n	for( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n		vec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\n\n				// if ( something && something ) breaks ATI OpenGL shader compiler\n				// if ( all( something, something ) ) using this instead\n\n		bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n		bool inFrustum = all( inFrustumVec );\n\n				// don't shadow pixels outside of light frustum\n				// use just first frustum (for cascades)\n				// don't shadow pixels behind far plane of light frustum\n\n		#ifdef SHADOWMAP_CASCADE\n\n			inFrustumCount += int( inFrustum );\n			bvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n\n		#else\n\n			bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n		#endif\n\n		bool frustumTest = all( frustumTestVec );\n\n		if ( frustumTest ) {\n\n			shadowCoord.z += shadowBias[ i ];\n\n			#if defined( SHADOWMAP_TYPE_PCF )\n\n						// Percentage-close filtering\n						// (9 pixel kernel)\n						// http://fabiensanglard.net/shadowmappingPCF/\n\n				float shadow = 0.0;\n\n		/*\n						// nested loops breaks shader compiler / validator on some ATI cards when using OpenGL\n						// must enroll loop manually\n\n				for ( float y = -1.25; y <= 1.25; y += 1.25 )\n					for ( float x = -1.25; x <= 1.25; x += 1.25 ) {\n\n						vec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\n\n								// doesn't seem to produce any noticeable visual difference compared to simple texture2D lookup\n								//vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );\n\n						float fDepth = unpackDepth( rgbaDepth );\n\n						if ( fDepth < shadowCoord.z )\n							shadow += 1.0;\n\n				}\n\n				shadow /= 9.0;\n\n		*/\n\n				const float shadowDelta = 1.0 / 9.0;\n\n				float xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n				float yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n				float dx0 = -1.25 * xPixelOffset;\n				float dy0 = -1.25 * yPixelOffset;\n				float dx1 = 1.25 * xPixelOffset;\n				float dy1 = 1.25 * yPixelOffset;\n\n				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n				if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n				if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n				if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n				if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n				if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n				if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n				if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n				if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n				if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n				shadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n			#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n						// Percentage-close filtering\n						// (9 pixel kernel)\n						// http://fabiensanglard.net/shadowmappingPCF/\n\n				float shadow = 0.0;\n\n				float xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n				float yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n				float dx0 = -1.0 * xPixelOffset;\n				float dy0 = -1.0 * yPixelOffset;\n				float dx1 = 1.0 * xPixelOffset;\n				float dy1 = 1.0 * yPixelOffset;\n\n				mat3 shadowKernel;\n				mat3 depthKernel;\n\n				depthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n				depthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n				depthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n				depthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n				depthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n				depthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n				depthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n				depthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n				depthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\n				vec3 shadowZ = vec3( shadowCoord.z );\n				shadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\n				shadowKernel[0] *= vec3(0.25);\n\n				shadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\n				shadowKernel[1] *= vec3(0.25);\n\n				shadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\n				shadowKernel[2] *= vec3(0.25);\n\n				vec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\n\n				shadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\n				shadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\n\n				vec4 shadowValues;\n				shadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\n				shadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\n				shadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\n				shadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\n\n				shadow = dot( shadowValues, vec4( 1.0 ) );\n\n				shadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n			#else\n\n				vec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\n				float fDepth = unpackDepth( rgbaDepth );\n\n				if ( fDepth < shadowCoord.z )\n\n		// spot with multiple shadows is darker\n\n					shadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n\n		// spot with multiple shadows has the same color as single shadow spot\n\n		// 					shadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );\n\n			#endif\n\n		}\n\n\n		#ifdef SHADOWMAP_DEBUG\n\n			#ifdef SHADOWMAP_CASCADE\n\n				if ( inFrustum && inFrustumCount == 1 ) outgoingLight *= frustumColors[ i ];\n\n			#else\n\n				if ( inFrustum ) outgoingLight *= frustumColors[ i ];\n\n			#endif\n\n		#endif\n\n	}\n\n	// NOTE: I am unsure if this is correct in linear space. -bhouston, Dec 29, 2014\n	shadowColor = inputToLinear( shadowColor );\n\n	outgoingLight = outgoingLight * shadowColor;\n\n#endif\n",a.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n	#ifdef USE_SKINNING\n\n		vec4 worldPosition = modelMatrix * skinned;\n\n	#elif defined( USE_MORPHTARGETS )\n\n		vec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n\n	#else\n\n		vec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\n	#endif\n\n#endif\n",a.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n\n	uniform sampler2D shadowMap[ MAX_SHADOWS ];\n	uniform vec2 shadowMapSize[ MAX_SHADOWS ];\n\n	uniform float shadowDarkness[ MAX_SHADOWS ];\n	uniform float shadowBias[ MAX_SHADOWS ];\n\n	varying vec4 vShadowCoord[ MAX_SHADOWS ];\n\n	float unpackDepth( const in vec4 rgba_depth ) {\n\n		const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n		float depth = dot( rgba_depth, bit_shift );\n		return depth;\n\n	}\n\n#endif",a.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\n	uniform mat4 bindMatrix;\n	uniform mat4 bindMatrixInverse;\n\n	#ifdef BONE_TEXTURE\n\n		uniform sampler2D boneTexture;\n		uniform int boneTextureWidth;\n		uniform int boneTextureHeight;\n\n		mat4 getBoneMatrix( const in float i ) {\n\n			float j = i * 4.0;\n			float x = mod( j, float( boneTextureWidth ) );\n			float y = floor( j / float( boneTextureWidth ) );\n\n			float dx = 1.0 / float( boneTextureWidth );\n			float dy = 1.0 / float( boneTextureHeight );\n\n			y = dy * ( y + 0.5 );\n\n			vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n			vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n			vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n			vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\n			mat4 bone = mat4( v1, v2, v3, v4 );\n\n			return bone;\n\n		}\n\n	#else\n\n		uniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\n		mat4 getBoneMatrix( const in float i ) {\n\n			mat4 bone = boneGlobalMatrices[ int(i) ];\n			return bone;\n\n		}\n\n	#endif\n\n#endif\n",a.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\n	uniform float logDepthBufFC;\n\n	#ifdef USE_LOGDEPTHBUF_EXT\n\n		#extension GL_EXT_frag_depth : enable\n		varying float vFragDepth;\n\n	#endif\n\n#endif",a.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\n	diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n",a.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\n	uniform sampler2D alphaMap;\n\n#endif\n",a.UniformsUtils={merge:function(a){for(var b={},c=0;c<a.length;c++){var d=this.clone(a[c]);for(var e in d)b[e]=d[e]}return b},clone:function(b){var c={};for(var d in b){c[d]={};for(var e in b[d]){var f=b[d][e];f instanceof a.Color||f instanceof a.Vector2||f instanceof a.Vector3||f instanceof a.Vector4||f instanceof a.Matrix4||f instanceof a.Texture?c[d][e]=f.clone:f instanceof Array?c[d][e]=f.slice:c[d][e]=f}}return c}},a.UniformsLib={common:{diffuse:{type:"c",value:new a.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new a.Vector4(0,0,1,1)},lightMap:{type:"t",value:null},specularMap:{type:"t",value:null},alphaMap:{type:"t",value:null},envMap:{type:"t",value:null},flipEnvMap:{type:"f",value:-1},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:.98},morphTargetInfluences:{type:"f",value:0}},bump:{bumpMap:{type:"t",value:null},bumpScale:{type:"f",value:1}},normalmap:{normalMap:{type:"t",value:null},normalScale:{type:"v2",value:new a.Vector2(1,1)}},fog:{fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new a.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},hemisphereLightDirection:{type:"fv",value:[]},hemisphereLightSkyColor:{type:"fv",value:[]},hemisphereLightGroundColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]},pointLightDecay:{type:"fv1",value:[]},spotLightColor:{type:"fv",value:[]},spotLightPosition:{type:"fv",value:[]},spotLightDirection:{type:"fv",value:[]},spotLightDistance:{type:"fv1",value:[]},spotLightAngleCos:{type:"fv1",value:[]},spotLightExponent:{type:"fv1",value:[]},spotLightDecay:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new a.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new a.Vector4(0,0,1,1)},fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new a.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:[]},shadowMapSize:{type:"v2v",value:[]},shadowBias:{type:"fv1",value:[]},shadowDarkness:{type:"fv1",value:[]},shadowMatrix:{type:"m4v",value:[]}}},a.ShaderLib={basic:{uniforms:a.UniformsUtils.merge([a.UniformsLib.common,a.UniformsLib.fog,a.UniformsLib.shadowmap]),vertexShader:[a.ShaderChunk.common,a.ShaderChunk.map_pars_vertex,a.ShaderChunk.lightmap_pars_vertex,a.ShaderChunk.envmap_pars_vertex,a.ShaderChunk.color_pars_vertex,a.ShaderChunk.morphtarget_pars_vertex,a.ShaderChunk.skinning_pars_vertex,a.ShaderChunk.shadowmap_pars_vertex,a.ShaderChunk.logdepthbuf_pars_vertex,"void main {",a.ShaderChunk.map_vertex,a.ShaderChunk.lightmap_vertex,a.ShaderChunk.color_vertex,a.ShaderChunk.skinbase_vertex,"	#ifdef USE_ENVMAP",a.ShaderChunk.morphnormal_vertex,a.ShaderChunk.skinnormal_vertex,a.ShaderChunk.defaultnormal_vertex,"	#endif",a.ShaderChunk.morphtarget_vertex,a.ShaderChunk.skinning_vertex,a.ShaderChunk.default_vertex,a.ShaderChunk.logdepthbuf_vertex,a.ShaderChunk.worldpos_vertex,a.ShaderChunk.envmap_vertex,a.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform float opacity;",a.ShaderChunk.common,a.ShaderChunk.color_pars_fragment,a.ShaderChunk.map_pars_fragment,a.ShaderChunk.alphamap_pars_fragment,a.ShaderChunk.lightmap_pars_fragment,a.ShaderChunk.envmap_pars_fragment,a.ShaderChunk.fog_pars_fragment,a.ShaderChunk.shadowmap_pars_fragment,a.ShaderChunk.specularmap_pars_fragment,a.ShaderChunk.logdepthbuf_pars_fragment,"void main {","	vec3 outgoingLight = vec3( 0.0 );","	vec4 diffuseColor = vec4( diffuse, opacity );",a.ShaderChunk.logdepthbuf_fragment,a.ShaderChunk.map_fragment,a.ShaderChunk.color_fragment,a.ShaderChunk.alphamap_fragment,a.ShaderChunk.alphatest_fragment,a.ShaderChunk.specularmap_fragment,"	outgoingLight = diffuseColor.rgb;",a.ShaderChunk.lightmap_fragment,a.ShaderChunk.envmap_fragment,a.ShaderChunk.shadowmap_fragment,a.ShaderChunk.linear_to_gamma_fragment,a.ShaderChunk.fog_fragment,"	gl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},lambert:{uniforms:a.UniformsUtils.merge([a.UniformsLib.common,a.UniformsLib.fog,a.UniformsLib.lights,a.UniformsLib.shadowmap,{emissive:{type:"c",value:new a.Color(0)},wrapRGB:{type:"v3",value:new a.Vector3(1,1,1)}}]),vertexShader:["#define LAMBERT","varying vec3 vLightFront;","#ifdef DOUBLE_SIDED","	varying vec3 vLightBack;","#endif",a.ShaderChunk.common,a.ShaderChunk.map_pars_vertex,a.ShaderChunk.lightmap_pars_vertex,a.ShaderChunk.envmap_pars_vertex,a.ShaderChunk.lights_lambert_pars_vertex,a.ShaderChunk.color_pars_vertex,a.ShaderChunk.morphtarget_pars_vertex,a.ShaderChunk.skinning_pars_vertex,a.ShaderChunk.shadowmap_pars_vertex,a.ShaderChunk.logdepthbuf_pars_vertex,"void main {",a.ShaderChunk.map_vertex,a.ShaderChunk.lightmap_vertex,a.ShaderChunk.color_vertex,a.ShaderChunk.morphnormal_vertex,a.ShaderChunk.skinbase_vertex,a.ShaderChunk.skinnormal_vertex,a.ShaderChunk.defaultnormal_vertex,a.ShaderChunk.morphtarget_vertex,a.ShaderChunk.skinning_vertex,a.ShaderChunk.default_vertex,a.ShaderChunk.logdepthbuf_vertex,a.ShaderChunk.worldpos_vertex,a.ShaderChunk.envmap_vertex,a.ShaderChunk.lights_lambert_vertex,a.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform vec3 emissive;","uniform float opacity;","varying vec3 vLightFront;","#ifdef DOUBLE_SIDED","	varying vec3 vLightBack;","#endif",a.ShaderChunk.common,a.ShaderChunk.color_pars_fragment,a.ShaderChunk.map_pars_fragment,a.ShaderChunk.alphamap_pars_fragment,a.ShaderChunk.lightmap_pars_fragment,a.ShaderChunk.envmap_pars_fragment,a.ShaderChunk.fog_pars_fragment,a.ShaderChunk.shadowmap_pars_fragment,a.ShaderChunk.specularmap_pars_fragment,a.ShaderChunk.logdepthbuf_pars_fragment,"void main {","	vec3 outgoingLight = vec3( 0.0 );","	vec4 diffuseColor = vec4( diffuse, opacity );",a.ShaderChunk.logdepthbuf_fragment,a.ShaderChunk.map_fragment,a.ShaderChunk.color_fragment,a.ShaderChunk.alphamap_fragment,a.ShaderChunk.alphatest_fragment,a.ShaderChunk.specularmap_fragment,"	#ifdef DOUBLE_SIDED","		if ( gl_FrontFacing )","			outgoingLight += diffuseColor.rgb * vLightFront + emissive;","		else","			outgoingLight += diffuseColor.rgb * vLightBack + emissive;","	#else","		outgoingLight += diffuseColor.rgb * vLightFront + emissive;","	#endif",a.ShaderChunk.lightmap_fragment,a.ShaderChunk.envmap_fragment,a.ShaderChunk.shadowmap_fragment,a.ShaderChunk.linear_to_gamma_fragment,a.ShaderChunk.fog_fragment,"	gl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},phong:{uniforms:a.UniformsUtils.merge([a.UniformsLib.common,a.UniformsLib.bump,a.UniformsLib.normalmap,a.UniformsLib.fog,a.UniformsLib.lights,a.UniformsLib.shadowmap,{emissive:{type:"c",value:new a.Color(0)},specular:{type:"c",value:new a.Color(1118481)},shininess:{type:"f",value:30},wrapRGB:{type:"v3",value:new a.Vector3(1,1,1)}}]),vertexShader:["#define PHONG","varying vec3 vViewPosition;","#ifndef FLAT_SHADED","	varying vec3 vNormal;","#endif",a.ShaderChunk.common,a.ShaderChunk.map_pars_vertex,a.ShaderChunk.lightmap_pars_vertex,a.ShaderChunk.envmap_pars_vertex,a.ShaderChunk.lights_phong_pars_vertex,a.ShaderChunk.color_pars_vertex,a.ShaderChunk.morphtarget_pars_vertex,a.ShaderChunk.skinning_pars_vertex,a.ShaderChunk.shadowmap_pars_vertex,a.ShaderChunk.logdepthbuf_pars_vertex,"void main {",a.ShaderChunk.map_vertex,a.ShaderChunk.lightmap_vertex,a.ShaderChunk.color_vertex,a.ShaderChunk.morphnormal_vertex,a.ShaderChunk.skinbase_vertex,a.ShaderChunk.skinnormal_vertex,a.ShaderChunk.defaultnormal_vertex,"#ifndef FLAT_SHADED","	vNormal = normalize( transformedNormal );","#endif",a.ShaderChunk.morphtarget_vertex,a.ShaderChunk.skinning_vertex,a.ShaderChunk.default_vertex,a.ShaderChunk.logdepthbuf_vertex,"	vViewPosition = -mvPosition.xyz;",a.ShaderChunk.worldpos_vertex,a.ShaderChunk.envmap_vertex,a.ShaderChunk.lights_phong_vertex,a.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["#define PHONG","uniform vec3 diffuse;","uniform vec3 emissive;","uniform vec3 specular;","uniform float shininess;","uniform float opacity;",a.ShaderChunk.common,a.ShaderChunk.color_pars_fragment,a.ShaderChunk.map_pars_fragment,a.ShaderChunk.alphamap_pars_fragment,a.ShaderChunk.lightmap_pars_fragment,a.ShaderChunk.envmap_pars_fragment,a.ShaderChunk.fog_pars_fragment,a.ShaderChunk.lights_phong_pars_fragment,a.ShaderChunk.shadowmap_pars_fragment,a.ShaderChunk.bumpmap_pars_fragment,a.ShaderChunk.normalmap_pars_fragment,a.ShaderChunk.specularmap_pars_fragment,a.ShaderChunk.logdepthbuf_pars_fragment,"void main {","	vec3 outgoingLight = vec3( 0.0 );","	vec4 diffuseColor = vec4( diffuse, opacity );",a.ShaderChunk.logdepthbuf_fragment,a.ShaderChunk.map_fragment,a.ShaderChunk.color_fragment,a.ShaderChunk.alphamap_fragment,a.ShaderChunk.alphatest_fragment,a.ShaderChunk.specularmap_fragment,a.ShaderChunk.lights_phong_fragment,a.ShaderChunk.lightmap_fragment,a.ShaderChunk.envmap_fragment,a.ShaderChunk.shadowmap_fragment,a.ShaderChunk.linear_to_gamma_fragment,a.ShaderChunk.fog_fragment,"	gl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},particle_basic:{uniforms:a.UniformsUtils.merge([a.UniformsLib.particle,a.UniformsLib.shadowmap]),vertexShader:["uniform float size;","uniform float scale;",a.ShaderChunk.common,a.ShaderChunk.color_pars_vertex,a.ShaderChunk.shadowmap_pars_vertex,a.ShaderChunk.logdepthbuf_pars_vertex,"void main {",a.ShaderChunk.color_vertex,"	vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","	#ifdef USE_SIZEATTENUATION","		gl_PointSize = size * ( scale / length( mvPosition.xyz ) );","	#else","		gl_PointSize = size;","	#endif","	gl_Position = projectionMatrix * mvPosition;",a.ShaderChunk.logdepthbuf_vertex,a.ShaderChunk.worldpos_vertex,a.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;","uniform float opacity;",a.ShaderChunk.common,a.ShaderChunk.color_pars_fragment,a.ShaderChunk.map_particle_pars_fragment,a.ShaderChunk.fog_pars_fragment,a.ShaderChunk.shadowmap_pars_fragment,a.ShaderChunk.logdepthbuf_pars_fragment,"void main {","	vec3 outgoingLight = vec3( 0.0 );","	vec4 diffuseColor = vec4( psColor, opacity );",a.ShaderChunk.logdepthbuf_fragment,a.ShaderChunk.map_particle_fragment,a.ShaderChunk.color_fragment,a.ShaderChunk.alphatest_fragment,"	outgoingLight = diffuseColor.rgb;",a.ShaderChunk.shadowmap_fragment,a.ShaderChunk.fog_fragment,"	gl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},dashed:{uniforms:a.UniformsUtils.merge([a.UniformsLib.common,a.UniformsLib.fog,{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]),vertexShader:["uniform float scale;","attribute float lineDistance;","varying float vLineDistance;",a.ShaderChunk.common,a.ShaderChunk.color_pars_vertex,a.ShaderChunk.logdepthbuf_pars_vertex,"void main {",a.ShaderChunk.color_vertex,"	vLineDistance = scale * lineDistance;","	vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","	gl_Position = projectionMatrix * mvPosition;",a.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform float opacity;","uniform float dashSize;","uniform float totalSize;","varying float vLineDistance;",a.ShaderChunk.common,a.ShaderChunk.color_pars_fragment,a.ShaderChunk.fog_pars_fragment,a.ShaderChunk.logdepthbuf_pars_fragment,"void main {","	if ( mod( vLineDistance, totalSize ) > dashSize ) {","		discard;","	}","	vec3 outgoingLight = vec3( 0.0 );","	vec4 diffuseColor = vec4( diffuse, opacity );",a.ShaderChunk.logdepthbuf_fragment,a.ShaderChunk.color_fragment,"	outgoingLight = diffuseColor.rgb;",a.ShaderChunk.fog_fragment,"	gl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexShader:[a.ShaderChunk.common,a.ShaderChunk.morphtarget_pars_vertex,a.ShaderChunk.logdepthbuf_pars_vertex,"void main {",a.ShaderChunk.morphtarget_vertex,a.ShaderChunk.default_vertex,a.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float mNear;","uniform float mFar;","uniform float opacity;",a.ShaderChunk.common,a.ShaderChunk.logdepthbuf_pars_fragment,"void main {",a.ShaderChunk.logdepthbuf_fragment,"	#ifdef USE_LOGDEPTHBUF_EXT","		float depth = gl_FragDepthEXT / gl_FragCoord.w;","	#else","		float depth = gl_FragCoord.z / gl_FragCoord.w;","	#endif","	float color = 1.0 - smoothstep( mNear, mFar, depth );","	gl_FragColor = vec4( vec3( color ), opacity );","}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",a.ShaderChunk.common,a.ShaderChunk.morphtarget_pars_vertex,a.ShaderChunk.logdepthbuf_pars_vertex,"void main {","	vNormal = normalize( normalMatrix * normal );",a.ShaderChunk.morphtarget_vertex,a.ShaderChunk.default_vertex,a.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;","varying vec3 vNormal;",a.ShaderChunk.common,a.ShaderChunk.logdepthbuf_pars_fragment,"void main {","	gl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",a.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",a.ShaderChunk.common,a.ShaderChunk.logdepthbuf_pars_vertex,"void main {","	vWorldPosition = transformDirection( position, modelMatrix );","	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",a.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;","uniform float tFlip;","varying vec3 vWorldPosition;",a.ShaderChunk.common,a.ShaderChunk.logdepthbuf_pars_fragment,"void main {","	gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",a.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",a.ShaderChunk.common,a.ShaderChunk.logdepthbuf_pars_vertex,"void main {","	vWorldPosition = transformDirection( position, modelMatrix );","	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",a.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","uniform float tFlip;","varying vec3 vWorldPosition;",a.ShaderChunk.common,a.ShaderChunk.logdepthbuf_pars_fragment,"void main {","vec3 direction = normalize( vWorldPosition );","vec2 sampleUV;","sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );","sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;","gl_FragColor = texture2D( tEquirect, sampleUV );",a.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[a.ShaderChunk.common,a.ShaderChunk.morphtarget_pars_vertex,a.ShaderChunk.skinning_pars_vertex,a.ShaderChunk.logdepthbuf_pars_vertex,"void main {",a.ShaderChunk.skinbase_vertex,a.ShaderChunk.morphtarget_vertex,a.ShaderChunk.skinning_vertex,a.ShaderChunk.default_vertex,a.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:[a.ShaderChunk.common,a.ShaderChunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {","	const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );","	const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );","	vec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );","	res -= res.xxyz * bit_mask;","	return res;","}","void main {",a.ShaderChunk.logdepthbuf_fragment,"	#ifdef USE_LOGDEPTHBUF_EXT","		gl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );","	#else","		gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );","	#endif","}"].join("\n")}},a.WebGLRenderer=function(b){function c(a){a.__webglVertexBuffer=Fa.createBuffer,a.__webglColorBuffer=Fa.createBuffer,Ga.info.memory.geometries++}function d(a){a.__webglVertexBuffer=Fa.createBuffer,a.__webglColorBuffer=Fa.createBuffer,a.__webglLineDistanceBuffer=Fa.createBuffer,Ga.info.memory.geometries++}function e(a){a.__webglVertexBuffer=Fa.createBuffer,a.__webglNormalBuffer=Fa.createBuffer,a.__webglTangentBuffer=Fa.createBuffer,a.__webglColorBuffer=Fa.createBuffer,a.__webglUVBuffer=Fa.createBuffer,a.__webglUV2Buffer=Fa.createBuffer,a.__webglSkinIndicesBuffer=Fa.createBuffer,a.__webglSkinWeightsBuffer=Fa.createBuffer,a.__webglFaceBuffer=Fa.createBuffer,a.__webglLineBuffer=Fa.createBuffer;var b=a.numMorphTargets;if(b){a.__webglMorphTargetsBuffers=[];for(var c=0,d=b;d>c;c++)a.__webglMorphTargetsBuffers.push(Fa.createBuffer)}var e=a.numMorphNormals;if(e){a.__webglMorphNormalsBuffers=[];for(var c=0,d=e;d>c;c++)a.__webglMorphNormalsBuffers.push(Fa.createBuffer)}Ga.info.memory.geometries++}function f(a){var b=a.geometry,c=a.material,d=b.vertices.length;if(c.attributes){void 0===b.__webglCustomAttributesList&&(b.__webglCustomAttributesList=[]);for(var e in c.attributes){var f=c.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;"v2"===f.type?g=2:"v3"===f.type?g=3:"v4"===f.type?g=4:"c"===f.type&&(g=3),f.size=g,f.array=new Float32Array(d*g),f.buffer=Fa.createBuffer,f.buffer.belongsToAttribute=e,f.needsUpdate=!0}b.__webglCustomAttributesList.push(f)}}}function g(a,b){var c=a.vertices.length;a.__vertexArray=new Float32Array(3*c),a.__colorArray=new Float32Array(3*c),a.__webglParticleCount=c,f(b)}function h(a,b){var c=a.vertices.length;a.__vertexArray=new Float32Array(3*c),a.__colorArray=new Float32Array(3*c),a.__lineDistanceArray=new Float32Array(1*c),a.__webglLineCount=c,f(b)}function i(a,b){var c=b.geometry,d=a.faces3,e=3*d.length,f=1*d.length,g=3*d.length,h=j(b,a);a.__vertexArray=new Float32Array(3*e),a.__normalArray=new Float32Array(3*e),a.__colorArray=new Float32Array(3*e),a.__uvArray=new Float32Array(2*e),c.faceVertexUvs.length>1&&(a.__uv2Array=new Float32Array(2*e)),c.hasTangents&&(a.__tangentArray=new Float32Array(4*e)), b.geometry.skinWeights.length&&b.geometry.skinIndices.length&&(a.__skinIndexArray=new Float32Array(4*e),a.__skinWeightArray=new Float32Array(4*e));var i=null!==bb.get("OES_element_index_uint")&&f>21845?Uint32Array:Uint16Array;a.__typeArray=i,a.__faceArray=new i(3*f),a.__lineArray=new i(2*g);var k=a.numMorphTargets;if(k){a.__morphTargetsArrays=[];for(var l=0,m=k;m>l;l++)a.__morphTargetsArrays.push(new Float32Array(3*e))}var n=a.numMorphNormals;if(n){a.__morphNormalsArrays=[];for(var l=0,m=n;m>l;l++)a.__morphNormalsArrays.push(new Float32Array(3*e))}if(a.__webglFaceCount=3*f,a.__webglLineCount=2*g,h.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var o in h.attributes){var p=h.attributes[o],q={};for(var r in p)q[r]=p[r];if(!q.__webglInitialized||q.createUniqueBuffers){q.__webglInitialized=!0;var s=1;"v2"===q.type?s=2:"v3"===q.type?s=3:"v4"===q.type?s=4:"c"===q.type&&(s=3),q.size=s,q.array=new Float32Array(e*s),q.buffer=Fa.createBuffer,q.buffer.belongsToAttribute=o,p.needsUpdate=!0,q.__original=p}a.__webglCustomAttributesList.push(q)}}a.__inittedArrays=!0}function j(b,c){return b.material instanceof a.MeshFaceMaterial?b.material.materials[c.materialIndex]:b.material}function k(b){return b instanceof a.MeshPhongMaterial==!1&&b.shading===a.FlatShading}function l(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o=a.vertices,p=o.length,q=a.colors,r=q.length,s=a.__vertexArray,t=a.__colorArray,u=a.verticesNeedUpdate,v=a.colorsNeedUpdate,w=a.__webglCustomAttributesList;if(u){for(d=0;p>d;d++)f=o[d],g=3*d,s[g]=f.x,s[g+1]=f.y,s[g+2]=f.z;Fa.bindBuffer(Fa.ARRAY_BUFFER,a.__webglVertexBuffer),Fa.bufferData(Fa.ARRAY_BUFFER,s,b)}if(v){for(e=0;r>e;e++)h=q[e],g=3*e,t[g]=h.r,t[g+1]=h.g,t[g+2]=h.b;Fa.bindBuffer(Fa.ARRAY_BUFFER,a.__webglColorBuffer),Fa.bufferData(Fa.ARRAY_BUFFER,t,b)}if(w)for(i=0,j=w.length;j>i;i++){if(n=w[i],n.needsUpdate&&(void 0===n.boundTo||"vertices"===n.boundTo))if(l=n.value.length,g=0,1===n.size)for(k=0;l>k;k++)n.array[k]=n.value[k];else if(2===n.size)for(k=0;l>k;k++)m=n.value[k],n.array[g]=m.x,n.array[g+1]=m.y,g+=2;else if(3===n.size)if("c"===n.type)for(k=0;l>k;k++)m=n.value[k],n.array[g]=m.r,n.array[g+1]=m.g,n.array[g+2]=m.b,g+=3;else for(k=0;l>k;k++)m=n.value[k],n.array[g]=m.x,n.array[g+1]=m.y,n.array[g+2]=m.z,g+=3;else if(4===n.size)for(k=0;l>k;k++)m=n.value[k],n.array[g]=m.x,n.array[g+1]=m.y,n.array[g+2]=m.z,n.array[g+3]=m.w,g+=4;Fa.bindBuffer(Fa.ARRAY_BUFFER,n.buffer),Fa.bufferData(Fa.ARRAY_BUFFER,n.array,b),n.needsUpdate=!1}}function m(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o=a.vertices,p=a.colors,q=a.lineDistances,r=o.length,s=p.length,t=q.length,u=a.__vertexArray,v=a.__colorArray,w=a.__lineDistanceArray,x=a.verticesNeedUpdate,y=a.colorsNeedUpdate,z=a.lineDistancesNeedUpdate,A=a.__webglCustomAttributesList;if(x){for(c=0;r>c;c++)f=o[c],g=3*c,u[g]=f.x,u[g+1]=f.y,u[g+2]=f.z;Fa.bindBuffer(Fa.ARRAY_BUFFER,a.__webglVertexBuffer),Fa.bufferData(Fa.ARRAY_BUFFER,u,b)}if(y){for(d=0;s>d;d++)h=p[d],g=3*d,v[g]=h.r,v[g+1]=h.g,v[g+2]=h.b;Fa.bindBuffer(Fa.ARRAY_BUFFER,a.__webglColorBuffer),Fa.bufferData(Fa.ARRAY_BUFFER,v,b)}if(z){for(e=0;t>e;e++)w[e]=q[e];Fa.bindBuffer(Fa.ARRAY_BUFFER,a.__webglLineDistanceBuffer),Fa.bufferData(Fa.ARRAY_BUFFER,w,b)}if(A)for(i=0,j=A.length;j>i;i++)if(n=A[i],n.needsUpdate&&(void 0===n.boundTo||"vertices"===n.boundTo)){if(g=0,l=n.value.length,1===n.size)for(k=0;l>k;k++)n.array[k]=n.value[k];else if(2===n.size)for(k=0;l>k;k++)m=n.value[k],n.array[g]=m.x,n.array[g+1]=m.y,g+=2;else if(3===n.size)if("c"===n.type)for(k=0;l>k;k++)m=n.value[k],n.array[g]=m.r,n.array[g+1]=m.g,n.array[g+2]=m.b,g+=3;else for(k=0;l>k;k++)m=n.value[k],n.array[g]=m.x,n.array[g+1]=m.y,n.array[g+2]=m.z,g+=3;else if(4===n.size)for(k=0;l>k;k++)m=n.value[k],n.array[g]=m.x,n.array[g+1]=m.y,n.array[g+2]=m.z,n.array[g+3]=m.w,g+=4;Fa.bindBuffer(Fa.ARRAY_BUFFER,n.buffer),Fa.bufferData(Fa.ARRAY_BUFFER,n.array,b),n.needsUpdate=!1}}function n(b,c,d,e,f){if(b.__inittedArrays){var g,h,i,j,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X=k(f),Y=0,Z=0,$=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=b.__vertexArray,ja=b.__uvArray,ka=b.__uv2Array,la=b.__normalArray,ma=b.__tangentArray,na=b.__colorArray,oa=b.__skinIndexArray,pa=b.__skinWeightArray,qa=b.__morphTargetsArrays,ra=b.__morphNormalsArrays,sa=b.__webglCustomAttributesList,ta=b.__faceArray,ua=b.__lineArray,va=c.geometry,wa=va.verticesNeedUpdate,xa=va.elementsNeedUpdate,ya=va.uvsNeedUpdate,za=va.normalsNeedUpdate,Aa=va.tangentsNeedUpdate,Ba=va.colorsNeedUpdate,Ca=va.morphTargetsNeedUpdate,Da=va.vertices,Ea=b.faces3,Ga=va.faces,Ha=va.faceVertexUvs[0],Ia=va.faceVertexUvs[1],Ja=va.skinIndices,Ka=va.skinWeights,La=va.morphTargets,Ma=va.morphNormals;if(wa){for(g=0,h=Ea.length;h>g;g++)j=Ga[Ea[g]],s=Da[j.a],t=Da[j.b],u=Da[j.c],ia[Z]=s.x,ia[Z+1]=s.y,ia[Z+2]=s.z,ia[Z+3]=t.x,ia[Z+4]=t.y,ia[Z+5]=t.z,ia[Z+6]=u.x,ia[Z+7]=u.y,ia[Z+8]=u.z,Z+=9;Fa.bindBuffer(Fa.ARRAY_BUFFER,b.__webglVertexBuffer),Fa.bufferData(Fa.ARRAY_BUFFER,ia,d)}if(Ca)for(P=0,Q=La.length;Q>P;P++){for(ga=0,g=0,h=Ea.length;h>g;g++)T=Ea[g],j=Ga[T],s=La[P].vertices[j.a],t=La[P].vertices[j.b],u=La[P].vertices[j.c],R=qa[P],R[ga]=s.x,R[ga+1]=s.y,R[ga+2]=s.z,R[ga+3]=t.x,R[ga+4]=t.y,R[ga+5]=t.z,R[ga+6]=u.x,R[ga+7]=u.y,R[ga+8]=u.z,f.morphNormals&&(X?(y=Ma[P].faceNormals[T],z=y,A=y):(U=Ma[P].vertexNormals[T],y=U.a,z=U.b,A=U.c),S=ra[P],S[ga]=y.x,S[ga+1]=y.y,S[ga+2]=y.z,S[ga+3]=z.x,S[ga+4]=z.y,S[ga+5]=z.z,S[ga+6]=A.x,S[ga+7]=A.y,S[ga+8]=A.z),ga+=9;Fa.bindBuffer(Fa.ARRAY_BUFFER,b.__webglMorphTargetsBuffers[P]),Fa.bufferData(Fa.ARRAY_BUFFER,qa[P],d),f.morphNormals&&(Fa.bindBuffer(Fa.ARRAY_BUFFER,b.__webglMorphNormalsBuffers[P]),Fa.bufferData(Fa.ARRAY_BUFFER,ra[P],d))}if(Ka.length){for(g=0,h=Ea.length;h>g;g++)j=Ga[Ea[g]],E=Ka[j.a],F=Ka[j.b],G=Ka[j.c],pa[fa]=E.x,pa[fa+1]=E.y,pa[fa+2]=E.z,pa[fa+3]=E.w,pa[fa+4]=F.x,pa[fa+5]=F.y,pa[fa+6]=F.z,pa[fa+7]=F.w,pa[fa+8]=G.x,pa[fa+9]=G.y,pa[fa+10]=G.z,pa[fa+11]=G.w,H=Ja[j.a],I=Ja[j.b],J=Ja[j.c],oa[fa]=H.x,oa[fa+1]=H.y,oa[fa+2]=H.z,oa[fa+3]=H.w,oa[fa+4]=I.x,oa[fa+5]=I.y,oa[fa+6]=I.z,oa[fa+7]=I.w,oa[fa+8]=J.x,oa[fa+9]=J.y,oa[fa+10]=J.z,oa[fa+11]=J.w,fa+=12;fa>0&&(Fa.bindBuffer(Fa.ARRAY_BUFFER,b.__webglSkinIndicesBuffer),Fa.bufferData(Fa.ARRAY_BUFFER,oa,d),Fa.bindBuffer(Fa.ARRAY_BUFFER,b.__webglSkinWeightsBuffer),Fa.bufferData(Fa.ARRAY_BUFFER,pa,d))}if(Ba){for(g=0,h=Ea.length;h>g;g++)j=Ga[Ea[g]],n=j.vertexColors,o=j.color,3===n.length&&f.vertexColors===a.VertexColors?(B=n[0],C=n[1],D=n[2]):(B=o,C=o,D=o),na[ea]=B.r,na[ea+1]=B.g,na[ea+2]=B.b,na[ea+3]=C.r,na[ea+4]=C.g,na[ea+5]=C.b,na[ea+6]=D.r,na[ea+7]=D.g,na[ea+8]=D.b,ea+=9;ea>0&&(Fa.bindBuffer(Fa.ARRAY_BUFFER,b.__webglColorBuffer),Fa.bufferData(Fa.ARRAY_BUFFER,na,d))}if(Aa&&va.hasTangents){for(g=0,h=Ea.length;h>g;g++)j=Ga[Ea[g]],p=j.vertexTangents,v=p[0],w=p[1],x=p[2],ma[ca]=v.x,ma[ca+1]=v.y,ma[ca+2]=v.z,ma[ca+3]=v.w,ma[ca+4]=w.x,ma[ca+5]=w.y,ma[ca+6]=w.z,ma[ca+7]=w.w,ma[ca+8]=x.x,ma[ca+9]=x.y,ma[ca+10]=x.z,ma[ca+11]=x.w,ca+=12;Fa.bindBuffer(Fa.ARRAY_BUFFER,b.__webglTangentBuffer),Fa.bufferData(Fa.ARRAY_BUFFER,ma,d)}if(za){for(g=0,h=Ea.length;h>g;g++)if(j=Ga[Ea[g]],l=j.vertexNormals,m=j.normal,3===l.length&&X===!1)for(K=0;3>K;K++)M=l[K],la[ba]=M.x,la[ba+1]=M.y,la[ba+2]=M.z,ba+=3;else for(K=0;3>K;K++)la[ba]=m.x,la[ba+1]=m.y,la[ba+2]=m.z,ba+=3;Fa.bindBuffer(Fa.ARRAY_BUFFER,b.__webglNormalBuffer),Fa.bufferData(Fa.ARRAY_BUFFER,la,d)}if(ya&&Ha){for(g=0,h=Ea.length;h>g;g++)if(i=Ea[g],q=Ha[i],void 0!==q)for(K=0;3>K;K++)N=q[K],ja[$]=N.x,ja[$+1]=N.y,$+=2;$>0&&(Fa.bindBuffer(Fa.ARRAY_BUFFER,b.__webglUVBuffer),Fa.bufferData(Fa.ARRAY_BUFFER,ja,d))}if(ya&&Ia){for(g=0,h=Ea.length;h>g;g++)if(i=Ea[g],r=Ia[i],void 0!==r)for(K=0;3>K;K++)O=r[K],ka[_]=O.x,ka[_+1]=O.y,_+=2;_>0&&(Fa.bindBuffer(Fa.ARRAY_BUFFER,b.__webglUV2Buffer),Fa.bufferData(Fa.ARRAY_BUFFER,ka,d))}if(xa){for(g=0,h=Ea.length;h>g;g++)ta[aa]=Y,ta[aa+1]=Y+1,ta[aa+2]=Y+2,aa+=3,ua[da]=Y,ua[da+1]=Y+1,ua[da+2]=Y,ua[da+3]=Y+2,ua[da+4]=Y+1,ua[da+5]=Y+2,da+=6,Y+=3;Fa.bindBuffer(Fa.ELEMENT_ARRAY_BUFFER,b.__webglFaceBuffer),Fa.bufferData(Fa.ELEMENT_ARRAY_BUFFER,ta,d),Fa.bindBuffer(Fa.ELEMENT_ARRAY_BUFFER,b.__webglLineBuffer),Fa.bufferData(Fa.ELEMENT_ARRAY_BUFFER,ua,d)}if(sa)for(K=0,L=sa.length;L>K;K++)if(W=sa[K],W.__original.needsUpdate){if(ha=0,1===W.size){if(void 0===W.boundTo||"vertices"===W.boundTo)for(g=0,h=Ea.length;h>g;g++)j=Ga[Ea[g]],W.array[ha]=W.value[j.a],W.array[ha+1]=W.value[j.b],W.array[ha+2]=W.value[j.c],ha+=3;else if("faces"===W.boundTo)for(g=0,h=Ea.length;h>g;g++)V=W.value[Ea[g]],W.array[ha]=V,W.array[ha+1]=V,W.array[ha+2]=V,ha+=3}else if(2===W.size){if(void 0===W.boundTo||"vertices"===W.boundTo)for(g=0,h=Ea.length;h>g;g++)j=Ga[Ea[g]],s=W.value[j.a],t=W.value[j.b],u=W.value[j.c],W.array[ha]=s.x,W.array[ha+1]=s.y,W.array[ha+2]=t.x,W.array[ha+3]=t.y,W.array[ha+4]=u.x,W.array[ha+5]=u.y,ha+=6;else if("faces"===W.boundTo)for(g=0,h=Ea.length;h>g;g++)V=W.value[Ea[g]],s=V,t=V,u=V,W.array[ha]=s.x,W.array[ha+1]=s.y,W.array[ha+2]=t.x,W.array[ha+3]=t.y,W.array[ha+4]=u.x,W.array[ha+5]=u.y,ha+=6}else if(3===W.size){var Na;if(Na="c"===W.type?["r","g","b"]:["x","y","z"],void 0===W.boundTo||"vertices"===W.boundTo)for(g=0,h=Ea.length;h>g;g++)j=Ga[Ea[g]],s=W.value[j.a],t=W.value[j.b],u=W.value[j.c],W.array[ha]=s[Na[0]],W.array[ha+1]=s[Na[1]],W.array[ha+2]=s[Na[2]],W.array[ha+3]=t[Na[0]],W.array[ha+4]=t[Na[1]],W.array[ha+5]=t[Na[2]],W.array[ha+6]=u[Na[0]],W.array[ha+7]=u[Na[1]],W.array[ha+8]=u[Na[2]],ha+=9;else if("faces"===W.boundTo)for(g=0,h=Ea.length;h>g;g++)V=W.value[Ea[g]],s=V,t=V,u=V,W.array[ha]=s[Na[0]],W.array[ha+1]=s[Na[1]],W.array[ha+2]=s[Na[2]],W.array[ha+3]=t[Na[0]],W.array[ha+4]=t[Na[1]],W.array[ha+5]=t[Na[2]],W.array[ha+6]=u[Na[0]],W.array[ha+7]=u[Na[1]],W.array[ha+8]=u[Na[2]],ha+=9;else if("faceVertices"===W.boundTo)for(g=0,h=Ea.length;h>g;g++)V=W.value[Ea[g]],s=V[0],t=V[1],u=V[2],W.array[ha]=s[Na[0]],W.array[ha+1]=s[Na[1]],W.array[ha+2]=s[Na[2]],W.array[ha+3]=t[Na[0]],W.array[ha+4]=t[Na[1]],W.array[ha+5]=t[Na[2]],W.array[ha+6]=u[Na[0]],W.array[ha+7]=u[Na[1]],W.array[ha+8]=u[Na[2]],ha+=9}else if(4===W.size)if(void 0===W.boundTo||"vertices"===W.boundTo)for(g=0,h=Ea.length;h>g;g++)j=Ga[Ea[g]],s=W.value[j.a],t=W.value[j.b],u=W.value[j.c],W.array[ha]=s.x,W.array[ha+1]=s.y,W.array[ha+2]=s.z,W.array[ha+3]=s.w,W.array[ha+4]=t.x,W.array[ha+5]=t.y,W.array[ha+6]=t.z,W.array[ha+7]=t.w,W.array[ha+8]=u.x,W.array[ha+9]=u.y,W.array[ha+10]=u.z,W.array[ha+11]=u.w,ha+=12;else if("faces"===W.boundTo)for(g=0,h=Ea.length;h>g;g++)V=W.value[Ea[g]],s=V,t=V,u=V,W.array[ha]=s.x,W.array[ha+1]=s.y,W.array[ha+2]=s.z,W.array[ha+3]=s.w,W.array[ha+4]=t.x,W.array[ha+5]=t.y,W.array[ha+6]=t.z,W.array[ha+7]=t.w,W.array[ha+8]=u.x,W.array[ha+9]=u.y,W.array[ha+10]=u.z,W.array[ha+11]=u.w,ha+=12;else if("faceVertices"===W.boundTo)for(g=0,h=Ea.length;h>g;g++)V=W.value[Ea[g]],s=V[0],t=V[1],u=V[2],W.array[ha]=s.x,W.array[ha+1]=s.y,W.array[ha+2]=s.z,W.array[ha+3]=s.w,W.array[ha+4]=t.x,W.array[ha+5]=t.y,W.array[ha+6]=t.z,W.array[ha+7]=t.w,W.array[ha+8]=u.x,W.array[ha+9]=u.y,W.array[ha+10]=u.z,W.array[ha+11]=u.w,ha+=12;Fa.bindBuffer(Fa.ARRAY_BUFFER,W.buffer),Fa.bufferData(Fa.ARRAY_BUFFER,W.array,d)}e&&(delete b.__inittedArrays,delete b.__colorArray,delete b.__normalArray,delete b.__tangentArray,delete b.__uvArray,delete b.__uv2Array,delete b.__faceArray,delete b.__vertexArray,delete b.__lineArray,delete b.__skinIndexArray,delete b.__skinWeightArray)}}function o(a,b,c,d){for(var e=c.attributes,f=b.attributes,g=b.attributesKeys,h=0,i=g.length;i>h;h++){var j=g[h],k=f[j];if(k>=0){var l=e[j];if(void 0!==l){var m=l.itemSize;Fa.bindBuffer(Fa.ARRAY_BUFFER,l.buffer),ab.enableAttribute(k),Fa.vertexAttribPointer(k,m,Fa.FLOAT,!1,0,d*m*4)}else void 0!==a.defaultAttributeValues&&(2===a.defaultAttributeValues[j].length?Fa.vertexAttrib2fv(k,a.defaultAttributeValues[j]):3===a.defaultAttributeValues[j].length&&Fa.vertexAttrib3fv(k,a.defaultAttributeValues[j]))}}ab.disableUnusedAttributes}function p(a,b,c){var d=a.program.attributes;if(-1!==c.morphTargetBase&&d.position>=0?(Fa.bindBuffer(Fa.ARRAY_BUFFER,b.__webglMorphTargetsBuffers[c.morphTargetBase]),ab.enableAttribute(d.position),Fa.vertexAttribPointer(d.position,3,Fa.FLOAT,!1,0,0)):d.position>=0&&(Fa.bindBuffer(Fa.ARRAY_BUFFER,b.__webglVertexBuffer),ab.enableAttribute(d.position),Fa.vertexAttribPointer(d.position,3,Fa.FLOAT,!1,0,0)),c.morphTargetForcedOrder.length)for(var e,f=0,g=c.morphTargetForcedOrder,h=c.morphTargetInfluences;f<a.numSupportedMorphTargets&&f<g.length;)e=d["morphTarget"+f],e>=0&&(Fa.bindBuffer(Fa.ARRAY_BUFFER,b.__webglMorphTargetsBuffers[g[f]]),ab.enableAttribute(e),Fa.vertexAttribPointer(e,3,Fa.FLOAT,!1,0,0)),e=d["morphNormal"+f],e>=0&&a.morphNormals&&(Fa.bindBuffer(Fa.ARRAY_BUFFER,b.__webglMorphNormalsBuffers[g[f]]),ab.enableAttribute(e),Fa.vertexAttribPointer(e,3,Fa.FLOAT,!1,0,0)),c.__webglMorphTargetInfluences[f]=h[g[f]],f++;else{var i=[],h=c.morphTargetInfluences,j=c.geometry.morphTargets;h.length>j.length&&(console.warn("THREE.WebGLRenderer: Influences array is bigger than morphTargets array."),h.length=j.length);for(var k=0,l=h.length;l>k;k++){var m=h[k];i.push([m,k])}i.length>a.numSupportedMorphTargets?(i.sort(s),i.length=a.numSupportedMorphTargets):i.length>a.numSupportedMorphNormals?i.sort(s):0===i.length&&i.push([0,0]);for(var e,f=0,n=a.numSupportedMorphTargets;n>f;f++)if(i[f]){var o=i[f][1];e=d["morphTarget"+f],e>=0&&(Fa.bindBuffer(Fa.ARRAY_BUFFER,b.__webglMorphTargetsBuffers[o]),ab.enableAttribute(e),Fa.vertexAttribPointer(e,3,Fa.FLOAT,!1,0,0)),e=d["morphNormal"+f],e>=0&&a.morphNormals&&(Fa.bindBuffer(Fa.ARRAY_BUFFER,b.__webglMorphNormalsBuffers[o]),ab.enableAttribute(e),Fa.vertexAttribPointer(e,3,Fa.FLOAT,!1,0,0)),c.__webglMorphTargetInfluences[f]=h[o]}else c.__webglMorphTargetInfluences[f]=0}null!==a.program.uniforms.morphTargetInfluences&&Fa.uniform1fv(a.program.uniforms.morphTargetInfluences,c.__webglMorphTargetInfluences)}function q(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.material.id!==b.material.id?a.material.id-b.material.id:a.z!==b.z?a.z-b.z:a.id-b.id}function r(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function s(a,b){return b[0]-a[0]}function t(b){if(b.visible!==!1){if(b instanceof a.Scene||b instanceof a.Group);else if(y(b),b instanceof a.Light)ya.push(b);else if(b instanceof a.Sprite)Da.push(b);else if(b instanceof a.LensFlare)Ea.push(b);else{var c=za[b.id];if(c&&(b.frustumCulled===!1||Ua.intersectsObject(b)===!0))for(var d=0,e=c.length;e>d;d++){var f=c[d];x(f),f.render=!0,Ga.sortObjects===!0&&(Wa.setFromMatrixPosition(b.matrixWorld),Wa.applyProjection(Va),f.z=Wa.z)}}for(var d=0,e=b.children.length;e>d;d++)t(b.children[d])}}function u(b,c,d,e,f){for(var g,h=0,i=b.length;i>h;h++){var j=b[h],k=j.object,l=j.buffer;if(Y(k,c),f)g=f;else{if(g=j.material,!g)continue;J(g)}Ga.setMaterialFaces(g),l instanceof a.BufferGeometry?Ga.renderBufferDirect(c,d,e,g,l,k):Ga.renderBuffer(c,d,e,g,l,k)}}function v(a,b,c,d,e,f){for(var g,h=0,i=a.length;i>h;h++){var j=a[h],k=j.object;if(k.visible){if(f)g=f;else{if(g=j[b],!g)continue;J(g)}Ga.renderImmediateObject(c,d,e,g,k)}}}function w(a){var b=a.object,c=b.material;c.transparent?(a.transparent=c,a.opaque=null):(a.opaque=c,a.transparent=null)}function x(b){var c=b.object,d=b.buffer,e=c.geometry,f=c.material;if(f instanceof a.MeshFaceMaterial){var g=e instanceof a.BufferGeometry?0:d.materialIndex;f=f.materials[g],b.material=f,f.transparent?Ca.push(b):Ba.push(b)}else f&&(b.material=f,f.transparent?Ca.push(b):Ba.push(b))}function y(b){void 0===b.__webglInit&&(b.__webglInit=!0,b._modelViewMatrix=new a.Matrix4,b._normalMatrix=new a.Matrix3,b.addEventListener("removed",vb));var e=b.geometry;if(void 0===e||void 0===e.__webglInit&&(e.__webglInit=!0,e.addEventListener("dispose",wb),e instanceof a.BufferGeometry?Ga.info.memory.geometries++:b instanceof a.Mesh?A(b,e):b instanceof a.Line?void 0===e.__webglVertexBuffer&&(d(e),h(e,b),e.verticesNeedUpdate=!0,e.colorsNeedUpdate=!0,e.lineDistancesNeedUpdate=!0):b instanceof a.PointCloud&&void 0===e.__webglVertexBuffer&&(c(e),g(e,b),e.verticesNeedUpdate=!0,e.colorsNeedUpdate=!0)),void 0===b.__webglActive)if(b.__webglActive=!0,b instanceof a.Mesh){if(e instanceof a.BufferGeometry)B(za,e,b);else if(e instanceof a.Geometry)for(var f=Fb[e.id],i=0,j=f.length;j>i;i++)B(za,f[i],b)}else b instanceof a.Line||b instanceof a.PointCloud?B(za,e,b):(b instanceof a.ImmediateRenderObject||b.immediateRenderCallback)&&C(Aa,b)}function z(a,b){for(var c,d,e=bb.get("OES_element_index_uint")?4294967296:65535,f={},g=a.morphTargets.length,h=a.morphNormals.length,i={},j=[],k=0,l=a.faces.length;l>k;k++){var m=a.faces[k],n=b?m.materialIndex:0;n in f||(f[n]={hash:n,counter:0}),c=f[n].hash+"_"+f[n].counter,c in i||(d={id:Gb++,faces3:[],materialIndex:n,vertices:0,numMorphTargets:g,numMorphNormals:h},i[c]=d,j.push(d)),i[c].vertices+3>e&&(f[n].counter+=1,c=f[n].hash+"_"+f[n].counter,c in i||(d={id:Gb++,faces3:[],materialIndex:n,vertices:0,numMorphTargets:g,numMorphNormals:h},i[c]=d,j.push(d))),i[c].faces3.push(k),i[c].vertices+=3}return j}function A(b,c){var d=b.material,f=!1;void 0!==Fb[c.id]&&c.groupsNeedUpdate!==!0||(delete za[b.id],Fb[c.id]=z(c,d instanceof a.MeshFaceMaterial),c.groupsNeedUpdate=!1);for(var g=Fb[c.id],h=0,j=g.length;j>h;h++){var k=g[h];void 0===k.__webglVertexBuffer?(e(k),i(k,b),c.verticesNeedUpdate=!0,c.morphTargetsNeedUpdate=!0,c.elementsNeedUpdate=!0,c.uvsNeedUpdate=!0,c.normalsNeedUpdate=!0,c.tangentsNeedUpdate=!0,c.colorsNeedUpdate=!0,f=!0):f=!1,(f||void 0===b.__webglActive)&&B(za,k,b)}b.__webglActive=!0}function B(a,b,c){var d=c.id;a[d]=a[d]||[],a[d].push({id:d,buffer:b,object:c,material:null,z:0})}function C(a,b){a.push({id:null,object:b,opaque:null,transparent:null,z:0})}function D(b){var c=b.geometry;if(c instanceof a.BufferGeometry)for(var d=c.attributes,e=c.attributesKeys,f=0,g=e.length;g>f;f++){var h=e[f],i=d[h],k="index"===h?Fa.ELEMENT_ARRAY_BUFFER:Fa.ARRAY_BUFFER;void 0===i.buffer?(i.buffer=Fa.createBuffer,Fa.bindBuffer(k,i.buffer),Fa.bufferData(k,i.array,i instanceof a.DynamicBufferAttribute?Fa.DYNAMIC_DRAW:Fa.STATIC_DRAW),i.needsUpdate=!1):i.needsUpdate===!0&&(Fa.bindBuffer(k,i.buffer),void 0===i.updateRange||-1===i.updateRange.count?Fa.bufferSubData(k,0,i.array):0===i.updateRange.count?console.error("THREE.WebGLRenderer.updateObject: using updateRange for THREE.DynamicBufferAttribute and marked as needsUpdate but count is 0, ensure you are using set methods or updating manually."):(Fa.bufferSubData(k,i.updateRange.offset*i.array.BYTES_PER_ELEMENT,i.array.subarray(i.updateRange.offset,i.updateRange.offset+i.updateRange.count)),i.updateRange.count=0),i.needsUpdate=!1)}else if(b instanceof a.Mesh){c.groupsNeedUpdate===!0&&A(b,c);for(var o=Fb[c.id],f=0,p=o.length;p>f;f++){var q=o[f],r=j(b,q),s=r.attributes&&E(r);(c.verticesNeedUpdate||c.morphTargetsNeedUpdate||c.elementsNeedUpdate||c.uvsNeedUpdate||c.normalsNeedUpdate||c.colorsNeedUpdate||c.tangentsNeedUpdate||s)&&n(q,b,Fa.DYNAMIC_DRAW,!c.dynamic,r)}c.verticesNeedUpdate=!1,c.morphTargetsNeedUpdate=!1,c.elementsNeedUpdate=!1,c.uvsNeedUpdate=!1,c.normalsNeedUpdate=!1,c.colorsNeedUpdate=!1,c.tangentsNeedUpdate=!1,r.attributes&&F(r)}else if(b instanceof a.Line){var r=j(b,c),s=r.attributes&&E(r);(c.verticesNeedUpdate||c.colorsNeedUpdate||c.lineDistancesNeedUpdate||s)&&m(c,Fa.DYNAMIC_DRAW),c.verticesNeedUpdate=!1,c.colorsNeedUpdate=!1,c.lineDistancesNeedUpdate=!1,r.attributes&&F(r)}else if(b instanceof a.PointCloud){var r=j(b,c),s=r.attributes&&E(r);(c.verticesNeedUpdate||c.colorsNeedUpdate||s)&&l(c,Fa.DYNAMIC_DRAW,b),c.verticesNeedUpdate=!1,c.colorsNeedUpdate=!1,r.attributes&&F(r)}}function E(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function F(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function G(b){b instanceof a.Mesh||b instanceof a.PointCloud||b instanceof a.Line?delete za[b.id]:(b instanceof a.ImmediateRenderObject||b.immediateRenderCallback)&&H(Aa,b),delete b.__webglInit,delete b._modelViewMatrix,delete b._normalMatrix,delete b.__webglActive}function H(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function I(b,c,d,e){b.addEventListener("dispose",zb);var f=Hb[b.type];if(f){var g=a.ShaderLib[f];b.__webglShader={uniforms:a.UniformsUtils.clone(g.uniforms),vertexShader:g.vertexShader,fragmentShader:g.fragmentShader}}else b.__webglShader={uniforms:b.uniforms,vertexShader:b.vertexShader,fragmentShader:b.fragmentShader};var h=ja(c),i=ka(c),j=ia(e),k={precision:oa,supportsVertexTextures:jb,map:!!b.map,envMap:!!b.envMap,envMapMode:b.envMap&&b.envMap.mapping,lightMap:!!b.lightMap,bumpMap:!!b.bumpMap,normalMap:!!b.normalMap,specularMap:!!b.specularMap,alphaMap:!!b.alphaMap,combine:b.combine,vertexColors:b.vertexColors,fog:d,useFog:b.fog,fogExp:d instanceof a.FogExp2,flatShading:b.shading===a.FlatShading,sizeAttenuation:b.sizeAttenuation,logarithmicDepthBuffer:va,skinning:b.skinning,maxBones:j,useVertexTexture:kb&&e&&e.skeleton&&e.skeleton.useVertexTexture,morphTargets:b.morphTargets,morphNormals:b.morphNormals,maxMorphTargets:Ga.maxMorphTargets,maxMorphNormals:Ga.maxMorphNormals,maxDirLights:h.directional,maxPointLights:h.point,maxSpotLights:h.spot,maxHemiLights:h.hemi,maxShadows:i,shadowMapEnabled:Ga.shadowMapEnabled&&e.receiveShadow&&i>0,shadowMapType:Ga.shadowMapType,shadowMapDebug:Ga.shadowMapDebug,shadowMapCascade:Ga.shadowMapCascade,alphaTest:b.alphaTest,metal:b.metal,wrapAround:b.wrapAround,doubleSided:b.side===a.DoubleSide,flipSided:b.side===a.BackSide},l=[];if(f?l.push(f):(l.push(b.fragmentShader),l.push(b.vertexShader)),void 0!==b.defines)for(var m in b.defines)l.push(m),l.push(b.defines[m]);for(var m in k)l.push(m),l.push(k[m]);for(var n,o=l.join,p=0,q=Ha.length;q>p;p++){var r=Ha[p];if(r.code===o){n=r,n.usedTimes++;break}}void 0===n&&(n=new a.WebGLProgram(Ga,o,b,k),Ha.push(n),Ga.info.memory.programs=Ha.length),b.program=n;var s=n.attributes;if(b.morphTargets){b.numSupportedMorphTargets=0;for(var t,u="morphTarget",v=0;v<Ga.maxMorphTargets;v++)t=u+v,s[t]>=0&&b.numSupportedMorphTargets++}if(b.morphNormals){b.numSupportedMorphNormals=0;var t,u="morphNormal";for(v=0;v<Ga.maxMorphNormals;v++)t=u+v,s[t]>=0&&b.numSupportedMorphNormals++}b.uniformsList=[];for(var w in b.__webglShader.uniforms){var x=b.program.uniforms[w];x&&b.uniformsList.push([b.__webglShader.uniforms[w],x])}}function J(b){b.transparent===!0?ab.setBlending(b.blending,b.blendEquation,b.blendSrc,b.blendDst,b.blendEquationAlpha,b.blendSrcAlpha,b.blendDstAlpha):ab.setBlending(a.NoBlending),ab.setDepthTest(b.depthTest),ab.setDepthWrite(b.depthWrite),ab.setColorWrite(b.colorWrite),ab.setPolygonOffset(b.polygonOffset,b.polygonOffsetFactor,b.polygonOffsetUnits)}function K(b,c,d,e,f){Na=0,e.needsUpdate&&(e.program&&Eb(e),I(e,c,d,f),e.needsUpdate=!1),e.morphTargets&&(f.__webglMorphTargetInfluences||(f.__webglMorphTargetInfluences=new Float32Array(Ga.maxMorphTargets)));var g=!1,h=!1,i=!1,j=e.program,k=j.uniforms,l=e.__webglShader.uniforms;if(j.id!==Ia&&(Fa.useProgram(j.program),Ia=j.id,g=!0,h=!0,i=!0),e.id!==Ka&&(-1===Ka&&(i=!0),Ka=e.id,h=!0),(g||b!==Ma)&&(Fa.uniformMatrix4fv(k.projectionMatrix,!1,b.projectionMatrix.elements),va&&Fa.uniform1f(k.logDepthBufFC,2/(Math.log(b.far+1)/Math.LN2)),b!==Ma&&(Ma=b),(e instanceof a.ShaderMaterial||e instanceof a.MeshPhongMaterial||e.envMap)&&null!==k.cameraPosition&&(Wa.setFromMatrixPosition(b.matrixWorld),Fa.uniform3f(k.cameraPosition,Wa.x,Wa.y,Wa.z)),(e instanceof a.MeshPhongMaterial||e instanceof a.MeshLambertMaterial||e instanceof a.MeshBasicMaterial||e instanceof a.ShaderMaterial||e.skinning)&&null!==k.viewMatrix&&Fa.uniformMatrix4fv(k.viewMatrix,!1,b.matrixWorldInverse.elements)),e.skinning)if(f.bindMatrix&&null!==k.bindMatrix&&Fa.uniformMatrix4fv(k.bindMatrix,!1,f.bindMatrix.elements),f.bindMatrixInverse&&null!==k.bindMatrixInverse&&Fa.uniformMatrix4fv(k.bindMatrixInverse,!1,f.bindMatrixInverse.elements),kb&&f.skeleton&&f.skeleton.useVertexTexture){if(null!==k.boneTexture){var m=W;Fa.uniform1i(k.boneTexture,m),Ga.setTexture(f.skeleton.boneTexture,m)}null!==k.boneTextureWidth&&Fa.uniform1i(k.boneTextureWidth,f.skeleton.boneTextureWidth),null!==k.boneTextureHeight&&Fa.uniform1i(k.boneTextureHeight,f.skeleton.boneTextureHeight)}else f.skeleton&&f.skeleton.boneMatrices&&null!==k.boneGlobalMatrices&&Fa.uniformMatrix4fv(k.boneGlobalMatrices,!1,f.skeleton.boneMatrices);return h&&(d&&e.fog&&P(l,d),(e instanceof a.MeshPhongMaterial||e instanceof a.MeshLambertMaterial||e.lights)&&(Ya&&(i=!0,$(c),Ya=!1),i?(S(l,Za),T(l,!0)):T(l,!1)),(e instanceof a.MeshBasicMaterial||e instanceof a.MeshLambertMaterial||e instanceof a.MeshPhongMaterial)&&L(l,e),e instanceof a.LineBasicMaterial?M(l,e):e instanceof a.LineDashedMaterial?(M(l,e),N(l,e)):e instanceof a.PointCloudMaterial?O(l,e):e instanceof a.MeshPhongMaterial?Q(l,e):e instanceof a.MeshLambertMaterial?R(l,e):e instanceof a.MeshDepthMaterial?(l.mNear.value=b.near,l.mFar.value=b.far,l.opacity.value=e.opacity):e instanceof a.MeshNormalMaterial&&(l.opacity.value=e.opacity),f.receiveShadow&&!e._shadowPass&&U(l,c),X(e.uniformsList)),V(k,f),null!==k.modelMatrix&&Fa.uniformMatrix4fv(k.modelMatrix,!1,f.matrixWorld.elements),j}function L(b,c){b.opacity.value=c.opacity,b.diffuse.value=c.color,b.map.value=c.map,b.lightMap.value=c.lightMap,b.specularMap.value=c.specularMap,b.alphaMap.value=c.alphaMap,c.bumpMap&&(b.bumpMap.value=c.bumpMap,b.bumpScale.value=c.bumpScale),c.normalMap&&(b.normalMap.value=c.normalMap,b.normalScale.value.copy(c.normalScale));var d;if(c.map?d=c.map:c.specularMap?d=c.specularMap:c.normalMap?d=c.normalMap:c.bumpMap?d=c.bumpMap:c.alphaMap&&(d=c.alphaMap),void 0!==d){var e=d.offset,f=d.repeat;b.offsetRepeat.value.set(e.x,e.y,f.x,f.y)}b.envMap.value=c.envMap,b.flipEnvMap.value=c.envMap instanceof a.WebGLRenderTargetCube?1:-1,b.reflectivity.value=c.reflectivity,b.refractionRatio.value=c.refractionRatio}function M(a,b){a.diffuse.value=b.color,a.opacity.value=b.opacity}function N(a,b){a.dashSize.value=b.dashSize,a.totalSize.value=b.dashSize+b.gapSize,a.scale.value=b.scale}function O(a,b){if(a.psColor.value=b.color,a.opacity.value=b.opacity,a.size.value=b.size,a.scale.value=la.height/2,a.map.value=b.map,null!==b.map){var c=b.map.offset,d=b.map.repeat;a.offsetRepeat.value.set(c.x,c.y,d.x,d.y)}}function P(b,c){b.fogColor.value=c.color,c instanceof a.Fog?(b.fogNear.value=c.near,b.fogFar.value=c.far):c instanceof a.FogExp2&&(b.fogDensity.value=c.density)}function Q(a,b){a.shininess.value=b.shininess,a.emissive.value=b.emissive,a.specular.value=b.specular,b.wrapAround&&a.wrapRGB.value.copy(b.wrapRGB)}function R(a,b){a.emissive.value=b.emissive,b.wrapAround&&a.wrapRGB.value.copy(b.wrapRGB)}function S(a,b){a.ambientLightColor.value=b.ambient,a.directionalLightColor.value=b.directional.colors,a.directionalLightDirection.value=b.directional.positions,a.pointLightColor.value=b.point.colors,a.pointLightPosition.value=b.point.positions,a.pointLightDistance.value=b.point.distances,a.pointLightDecay.value=b.point.decays,a.spotLightColor.value=b.spot.colors,a.spotLightPosition.value=b.spot.positions,a.spotLightDistance.value=b.spot.distances,a.spotLightDirection.value=b.spot.directions,a.spotLightAngleCos.value=b.spot.anglesCos,a.spotLightExponent.value=b.spot.exponents,a.spotLightDecay.value=b.spot.decays,a.hemisphereLightSkyColor.value=b.hemi.skyColors,a.hemisphereLightGroundColor.value=b.hemi.groundColors,a.hemisphereLightDirection.value=b.hemi.positions}function T(a,b){a.ambientLightColor.needsUpdate=b,a.directionalLightColor.needsUpdate=b,a.directionalLightDirection.needsUpdate=b,a.pointLightColor.needsUpdate=b,a.pointLightPosition.needsUpdate=b,a.pointLightDistance.needsUpdate=b,a.pointLightDecay.needsUpdate=b,a.spotLightColor.needsUpdate=b,a.spotLightPosition.needsUpdate=b,a.spotLightDistance.needsUpdate=b,a.spotLightDirection.needsUpdate=b,a.spotLightAngleCos.needsUpdate=b,a.spotLightExponent.needsUpdate=b,a.spotLightDecay.needsUpdate=b,a.hemisphereLightSkyColor.needsUpdate=b,a.hemisphereLightGroundColor.needsUpdate=b,a.hemisphereLightDirection.needsUpdate=b}function U(b,c){if(b.shadowMatrix)for(var d=0,e=0,f=c.length;f>e;e++){var g=c[e];g.castShadow&&(g instanceof a.SpotLight||g instanceof a.DirectionalLight&&!g.shadowCascade)&&(b.shadowMap.value[d]=g.shadowMap,b.shadowMapSize.value[d]=g.shadowMapSize,b.shadowMatrix.value[d]=g.shadowMatrix,b.shadowDarkness.value[d]=g.shadowDarkness,b.shadowBias.value[d]=g.shadowBias,d++)}}function V(a,b){Fa.uniformMatrix4fv(a.modelViewMatrix,!1,b._modelViewMatrix.elements),a.normalMatrix&&Fa.uniformMatrix3fv(a.normalMatrix,!1,b._normalMatrix.elements)}function W{var b=Na;return b>=fb&&a.warn("WebGLRenderer: trying to use "+b+" texture units while this GPU supports only "+fb),Na+=1,b}function X(b){for(var c,d,e,f=0,g=b.length;g>f;f++){var h=b[f][0];if(h.needsUpdate!==!1){var i=h.type,j=h.value,k=b[f][1];switch(i){case"1i":Fa.uniform1i(k,j);break;case"1f":Fa.uniform1f(k,j);break;case"2f":Fa.uniform2f(k,j[0],j[1]);break;case"3f":Fa.uniform3f(k,j[0],j[1],j[2]);break;case"4f":Fa.uniform4f(k,j[0],j[1],j[2],j[3]);break;case"1iv":Fa.uniform1iv(k,j);break;case"3iv":Fa.uniform3iv(k,j);break;case"1fv":Fa.uniform1fv(k,j);break;case"2fv":Fa.uniform2fv(k,j);break;case"3fv":Fa.uniform3fv(k,j);break;case"4fv":Fa.uniform4fv(k,j);break;case"Matrix3fv":Fa.uniformMatrix3fv(k,!1,j);break;case"Matrix4fv":Fa.uniformMatrix4fv(k,!1,j);break;case"i":Fa.uniform1i(k,j);break;case"f":Fa.uniform1f(k,j);break;case"v2":Fa.uniform2f(k,j.x,j.y);break;case"v3":Fa.uniform3f(k,j.x,j.y,j.z);break;case"v4":Fa.uniform4f(k,j.x,j.y,j.z,j.w);break;case"c":Fa.uniform3f(k,j.r,j.g,j.b);break;case"iv1":Fa.uniform1iv(k,j);break;case"iv":Fa.uniform3iv(k,j);break;case"fv1":Fa.uniform1fv(k,j);break;case"fv":Fa.uniform3fv(k,j);break;case"v2v":void 0===h._array&&(h._array=new Float32Array(2*j.length));for(var l=0,m=j.length;m>l;l++)e=2*l,h._array[e]=j[l].x,h._array[e+1]=j[l].y;Fa.uniform2fv(k,h._array);break;case"v3v":void 0===h._array&&(h._array=new Float32Array(3*j.length));for(var l=0,m=j.length;m>l;l++)e=3*l,h._array[e]=j[l].x,h._array[e+1]=j[l].y,h._array[e+2]=j[l].z;Fa.uniform3fv(k,h._array);break;case"v4v":void 0===h._array&&(h._array=new Float32Array(4*j.length));for(var l=0,m=j.length;m>l;l++)e=4*l,h._array[e]=j[l].x,h._array[e+1]=j[l].y,h._array[e+2]=j[l].z,h._array[e+3]=j[l].w;Fa.uniform4fv(k,h._array);break;case"m3":Fa.uniformMatrix3fv(k,!1,j.elements);break;case"m3v":void 0===h._array&&(h._array=new Float32Array(9*j.length));for(var l=0,m=j.length;m>l;l++)j[l].flattenToArrayOffset(h._array,9*l);Fa.uniformMatrix3fv(k,!1,h._array);break;case"m4":Fa.uniformMatrix4fv(k,!1,j.elements);break;case"m4v":void 0===h._array&&(h._array=new Float32Array(16*j.length));for(var l=0,m=j.length;m>l;l++)j[l].flattenToArrayOffset(h._array,16*l);Fa.uniformMatrix4fv(k,!1,h._array);break;case"t":if(c=j,d=W,Fa.uniform1i(k,d),!c)continue;c instanceof a.CubeTexture||c.image instanceof Array&&6===c.image.length?ba(c,d):c instanceof a.WebGLRenderTargetCube?ca(c,d):Ga.setTexture(c,d);break;case"tv":void 0===h._array&&(h._array=[]);for(var l=0,m=h.value.length;m>l;l++)h._array[l]=W;Fa.uniform1iv(k,h._array);for(var l=0,m=h.value.length;m>l;l++)c=h.value[l],d=h._array[l],c&&Ga.setTexture(c,d);break;default:a.warn("THREE.WebGLRenderer: Unknown uniform type: "+i)}}}}function Y(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld),a._normalMatrix.getNormalMatrix(a._modelViewMatrix)}function Z(a,b,c,d){a[b]=c.r*d,a[b+1]=c.g*d,a[b+2]=c.b*d}function $(b){var c,d,e,f,g,h,i,j,k=0,l=0,m=0,n=Za,o=n.directional.colors,p=n.directional.positions,q=n.point.colors,r=n.point.positions,s=n.point.distances,t=n.point.decays,u=n.spot.colors,v=n.spot.positions,w=n.spot.distances,x=n.spot.directions,y=n.spot.anglesCos,z=n.spot.exponents,A=n.spot.decays,B=n.hemi.skyColors,C=n.hemi.groundColors,D=n.hemi.positions,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0;for(c=0,d=b.length;d>c;c++)if(e=b[c], !e.onlyShadow)if(f=e.color,i=e.intensity,j=e.distance,e instanceof a.AmbientLight){if(!e.visible)continue;k+=f.r,l+=f.g,m+=f.b}else if(e instanceof a.DirectionalLight){if(I+=1,!e.visible)continue;Xa.setFromMatrixPosition(e.matrixWorld),Wa.setFromMatrixPosition(e.target.matrixWorld),Xa.sub(Wa),Xa.normalize,M=3*E,p[M]=Xa.x,p[M+1]=Xa.y,p[M+2]=Xa.z,Z(o,M,f,i),E+=1}else if(e instanceof a.PointLight){if(J+=1,!e.visible)continue;N=3*F,Z(q,N,f,i),Wa.setFromMatrixPosition(e.matrixWorld),r[N]=Wa.x,r[N+1]=Wa.y,r[N+2]=Wa.z,s[F]=j,t[F]=0===e.distance?0:e.decay,F+=1}else if(e instanceof a.SpotLight){if(K+=1,!e.visible)continue;O=3*G,Z(u,O,f,i),Xa.setFromMatrixPosition(e.matrixWorld),v[O]=Xa.x,v[O+1]=Xa.y,v[O+2]=Xa.z,w[G]=j,Wa.setFromMatrixPosition(e.target.matrixWorld),Xa.sub(Wa),Xa.normalize,x[O]=Xa.x,x[O+1]=Xa.y,x[O+2]=Xa.z,y[G]=Math.cos(e.angle),z[G]=e.exponent,A[G]=0===e.distance?0:e.decay,G+=1}else if(e instanceof a.HemisphereLight){if(L+=1,!e.visible)continue;Xa.setFromMatrixPosition(e.matrixWorld),Xa.normalize,P=3*H,D[P]=Xa.x,D[P+1]=Xa.y,D[P+2]=Xa.z,g=e.color,h=e.groundColor,Z(B,P,g,i),Z(C,P,h,i),H+=1}for(c=3*E,d=Math.max(o.length,3*I);d>c;c++)o[c]=0;for(c=3*F,d=Math.max(q.length,3*J);d>c;c++)q[c]=0;for(c=3*G,d=Math.max(u.length,3*K);d>c;c++)u[c]=0;for(c=3*H,d=Math.max(B.length,3*L);d>c;c++)B[c]=0;for(c=3*H,d=Math.max(C.length,3*L);d>c;c++)C[c]=0;n.directional.length=E,n.point.length=F,n.spot.length=G,n.hemi.length=H,n.ambient[0]=k,n.ambient[1]=l,n.ambient[2]=m}function _(b,c,d){var e;d?(Fa.texParameteri(b,Fa.TEXTURE_WRAP_S,ha(c.wrapS)),Fa.texParameteri(b,Fa.TEXTURE_WRAP_T,ha(c.wrapT)),Fa.texParameteri(b,Fa.TEXTURE_MAG_FILTER,ha(c.magFilter)),Fa.texParameteri(b,Fa.TEXTURE_MIN_FILTER,ha(c.minFilter))):(Fa.texParameteri(b,Fa.TEXTURE_WRAP_S,Fa.CLAMP_TO_EDGE),Fa.texParameteri(b,Fa.TEXTURE_WRAP_T,Fa.CLAMP_TO_EDGE),c.wrapS===a.ClampToEdgeWrapping&&c.wrapT===a.ClampToEdgeWrapping||a.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping. ( "+c.sourceFile+" )"),Fa.texParameteri(b,Fa.TEXTURE_MAG_FILTER,ga(c.magFilter)),Fa.texParameteri(b,Fa.TEXTURE_MIN_FILTER,ga(c.minFilter)),c.minFilter!==a.NearestFilter&&c.minFilter!==a.LinearFilter&&a.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter. ( "+c.sourceFile+" )")),e=bb.get("EXT_texture_filter_anisotropic"),e&&c.type!==a.FloatType&&c.type!==a.HalfFloatType&&(c.anisotropy>1||c.__currentAnisotropy)&&(Fa.texParameterf(b,e.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(c.anisotropy,Ga.getMaxAnisotropy)),c.__currentAnisotropy=c.anisotropy)}function aa(b,c){if(b.width>c||b.height>c){var d=c/Math.max(b.width,b.height),e=document.createElement("canvas");e.width=Math.floor(b.width*d),e.height=Math.floor(b.height*d);var f=e.getContext("2d");return f.drawImage(b,0,0,b.width,b.height,0,0,e.width,e.height),a.warn("THREE.WebGLRenderer: image is too big ("+b.width+"x"+b.height+"). Resized to "+e.width+"x"+e.height,b),e}return b}function ba(b,c){if(6===b.image.length)if(b.needsUpdate){b.image.__webglTextureCube||(b.addEventListener("dispose",xb),b.image.__webglTextureCube=Fa.createTexture,Ga.info.memory.textures++),Fa.activeTexture(Fa.TEXTURE0+c),Fa.bindTexture(Fa.TEXTURE_CUBE_MAP,b.image.__webglTextureCube),Fa.pixelStorei(Fa.UNPACK_FLIP_Y_WEBGL,b.flipY);for(var d=b instanceof a.CompressedTexture,e=b.image[0]instanceof a.DataTexture,f=[],g=0;6>g;g++)!Ga.autoScaleCubemaps||d||e?f[g]=e?b.image[g].image:b.image[g]:f[g]=aa(b.image[g],ib);var h=f[0],i=a.Math.isPowerOfTwo(h.width)&&a.Math.isPowerOfTwo(h.height),j=ha(b.format),k=ha(b.type);_(Fa.TEXTURE_CUBE_MAP,b,i);for(var g=0;6>g;g++)if(d)for(var l,m=f[g].mipmaps,n=0,o=m.length;o>n;n++)l=m[n],b.format!==a.RGBAFormat&&b.format!==a.RGBFormat?pb.indexOf(j)>-1?Fa.compressedTexImage2D(Fa.TEXTURE_CUBE_MAP_POSITIVE_X+g,n,j,l.width,l.height,0,l.data):a.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture"):Fa.texImage2D(Fa.TEXTURE_CUBE_MAP_POSITIVE_X+g,n,j,l.width,l.height,0,j,k,l.data);else e?Fa.texImage2D(Fa.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,j,f[g].width,f[g].height,0,j,k,f[g].data):Fa.texImage2D(Fa.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,j,j,k,f[g]);b.generateMipmaps&&i&&Fa.generateMipmap(Fa.TEXTURE_CUBE_MAP),b.needsUpdate=!1,b.onUpdate&&b.onUpdate}else Fa.activeTexture(Fa.TEXTURE0+c),Fa.bindTexture(Fa.TEXTURE_CUBE_MAP,b.image.__webglTextureCube)}function ca(a,b){Fa.activeTexture(Fa.TEXTURE0+b),Fa.bindTexture(Fa.TEXTURE_CUBE_MAP,a.__webglTexture)}function da(a,b,c){Fa.bindFramebuffer(Fa.FRAMEBUFFER,a),Fa.framebufferTexture2D(Fa.FRAMEBUFFER,Fa.COLOR_ATTACHMENT0,c,b.__webglTexture,0)}function ea(a,b){Fa.bindRenderbuffer(Fa.RENDERBUFFER,a),b.depthBuffer&&!b.stencilBuffer?(Fa.renderbufferStorage(Fa.RENDERBUFFER,Fa.DEPTH_COMPONENT16,b.width,b.height),Fa.framebufferRenderbuffer(Fa.FRAMEBUFFER,Fa.DEPTH_ATTACHMENT,Fa.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(Fa.renderbufferStorage(Fa.RENDERBUFFER,Fa.DEPTH_STENCIL,b.width,b.height),Fa.framebufferRenderbuffer(Fa.FRAMEBUFFER,Fa.DEPTH_STENCIL_ATTACHMENT,Fa.RENDERBUFFER,a)):Fa.renderbufferStorage(Fa.RENDERBUFFER,Fa.RGBA4,b.width,b.height)}function fa(b){b instanceof a.WebGLRenderTargetCube?(Fa.bindTexture(Fa.TEXTURE_CUBE_MAP,b.__webglTexture),Fa.generateMipmap(Fa.TEXTURE_CUBE_MAP),Fa.bindTexture(Fa.TEXTURE_CUBE_MAP,null)):(Fa.bindTexture(Fa.TEXTURE_2D,b.__webglTexture),Fa.generateMipmap(Fa.TEXTURE_2D),Fa.bindTexture(Fa.TEXTURE_2D,null))}function ga(b){return b===a.NearestFilter||b===a.NearestMipMapNearestFilter||b===a.NearestMipMapLinearFilter?Fa.NEAREST:Fa.LINEAR}function ha(b){var c;if(b===a.RepeatWrapping)return Fa.REPEAT;if(b===a.ClampToEdgeWrapping)return Fa.CLAMP_TO_EDGE;if(b===a.MirroredRepeatWrapping)return Fa.MIRRORED_REPEAT;if(b===a.NearestFilter)return Fa.NEAREST;if(b===a.NearestMipMapNearestFilter)return Fa.NEAREST_MIPMAP_NEAREST;if(b===a.NearestMipMapLinearFilter)return Fa.NEAREST_MIPMAP_LINEAR;if(b===a.LinearFilter)return Fa.LINEAR;if(b===a.LinearMipMapNearestFilter)return Fa.LINEAR_MIPMAP_NEAREST;if(b===a.LinearMipMapLinearFilter)return Fa.LINEAR_MIPMAP_LINEAR;if(b===a.UnsignedByteType)return Fa.UNSIGNED_BYTE;if(b===a.UnsignedShort4444Type)return Fa.UNSIGNED_SHORT_4_4_4_4;if(b===a.UnsignedShort5551Type)return Fa.UNSIGNED_SHORT_5_5_5_1;if(b===a.UnsignedShort565Type)return Fa.UNSIGNED_SHORT_5_6_5;if(b===a.ByteType)return Fa.BYTE;if(b===a.ShortType)return Fa.SHORT;if(b===a.UnsignedShortType)return Fa.UNSIGNED_SHORT;if(b===a.IntType)return Fa.INT;if(b===a.UnsignedIntType)return Fa.UNSIGNED_INT;if(b===a.FloatType)return Fa.FLOAT;if(c=bb.get("OES_texture_half_float"),null!==c&&b===a.HalfFloatType)return c.HALF_FLOAT_OES;if(b===a.AlphaFormat)return Fa.ALPHA;if(b===a.RGBFormat)return Fa.RGB;if(b===a.RGBAFormat)return Fa.RGBA;if(b===a.LuminanceFormat)return Fa.LUMINANCE;if(b===a.LuminanceAlphaFormat)return Fa.LUMINANCE_ALPHA;if(b===a.AddEquation)return Fa.FUNC_ADD;if(b===a.SubtractEquation)return Fa.FUNC_SUBTRACT;if(b===a.ReverseSubtractEquation)return Fa.FUNC_REVERSE_SUBTRACT;if(b===a.ZeroFactor)return Fa.ZERO;if(b===a.OneFactor)return Fa.ONE;if(b===a.SrcColorFactor)return Fa.SRC_COLOR;if(b===a.OneMinusSrcColorFactor)return Fa.ONE_MINUS_SRC_COLOR;if(b===a.SrcAlphaFactor)return Fa.SRC_ALPHA;if(b===a.OneMinusSrcAlphaFactor)return Fa.ONE_MINUS_SRC_ALPHA;if(b===a.DstAlphaFactor)return Fa.DST_ALPHA;if(b===a.OneMinusDstAlphaFactor)return Fa.ONE_MINUS_DST_ALPHA;if(b===a.DstColorFactor)return Fa.DST_COLOR;if(b===a.OneMinusDstColorFactor)return Fa.ONE_MINUS_DST_COLOR;if(b===a.SrcAlphaSaturateFactor)return Fa.SRC_ALPHA_SATURATE;if(c=bb.get("WEBGL_compressed_texture_s3tc"),null!==c){if(b===a.RGB_S3TC_DXT1_Format)return c.COMPRESSED_RGB_S3TC_DXT1_EXT;if(b===a.RGBA_S3TC_DXT1_Format)return c.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(b===a.RGBA_S3TC_DXT3_Format)return c.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(b===a.RGBA_S3TC_DXT5_Format)return c.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(c=bb.get("WEBGL_compressed_texture_pvrtc"),null!==c){if(b===a.RGB_PVRTC_4BPPV1_Format)return c.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(b===a.RGB_PVRTC_2BPPV1_Format)return c.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(b===a.RGBA_PVRTC_4BPPV1_Format)return c.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(b===a.RGBA_PVRTC_2BPPV1_Format)return c.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(c=bb.get("EXT_blend_minmax"),null!==c){if(b===a.MinEquation)return c.MIN_EXT;if(b===a.MaxEquation)return c.MAX_EXT}return 0}function ia(b){if(kb&&b&&b.skeleton&&b.skeleton.useVertexTexture)return 1024;var c=Fa.getParameter(Fa.MAX_VERTEX_UNIFORM_VECTORS),d=Math.floor((c-20)/4),e=d;return void 0!==b&&b instanceof a.SkinnedMesh&&(e=Math.min(b.skeleton.bones.length,e),e<b.skeleton.bones.length&&a.warn("WebGLRenderer: too many bones - "+b.skeleton.bones.length+", this GPU supports just "+e+" (try OpenGL instead of ANGLE)")),e}function ja(b){for(var c=0,d=0,e=0,f=0,g=0,h=b.length;h>g;g++){var i=b[g];i.onlyShadow||i.visible===!1||(i instanceof a.DirectionalLight&&c++,i instanceof a.PointLight&&d++,i instanceof a.SpotLight&&e++,i instanceof a.HemisphereLight&&f++)}return{directional:c,point:d,spot:e,hemi:f}}function ka(b){for(var c=0,d=0,e=b.length;e>d;d++){var f=b[d];f.castShadow&&(f instanceof a.SpotLight&&c++,f instanceof a.DirectionalLight&&!f.shadowCascade&&c++)}return c}console.log("THREE.WebGLRenderer",a.REVISION),b=b||{};var la=void 0!==b.canvas?b.canvas:document.createElement("canvas"),ma=void 0!==b.context?b.context:null,na=1,oa=void 0!==b.precision?b.precision:"highp",pa=void 0!==b.alpha?b.alpha:!1,qa=void 0!==b.depth?b.depth:!0,ra=void 0!==b.stencil?b.stencil:!0,sa=void 0!==b.antialias?b.antialias:!1,ta=void 0!==b.premultipliedAlpha?b.premultipliedAlpha:!0,ua=void 0!==b.preserveDrawingBuffer?b.preserveDrawingBuffer:!1,va=void 0!==b.logarithmicDepthBuffer?b.logarithmicDepthBuffer:!1,wa=new a.Color(0),xa=0,ya=[],za={},Aa=[],Ba=[],Ca=[],Da=[],Ea=[];this.domElement=la,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.shadowMapEnabled=!1,this.shadowMapType=a.PCFShadowMap,this.shadowMapCullFace=a.CullFaceFront,this.shadowMapDebug=!1,this.shadowMapCascade=!1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0,this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var Fa,Ga=this,Ha=[],Ia=null,Ja=null,Ka=-1,La="",Ma=null,Na=0,Oa=0,Pa=0,Qa=la.width,Ra=la.height,Sa=0,Ta=0,Ua=new a.Frustum,Va=new a.Matrix4,Wa=new a.Vector3,Xa=new a.Vector3,Ya=!0,Za={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[],decays:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[],decays:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}};try{var $a={alpha:pa,depth:qa,stencil:ra,antialias:sa,premultipliedAlpha:ta,preserveDrawingBuffer:ua};if(Fa=ma||la.getContext("webgl",$a)||la.getContext("experimental-webgl",$a),null===Fa)throw null!==la.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";la.addEventListener("webglcontextlost",function(a){a.preventDefault,eb,db,za={}},!1)}catch(_a){a.error("THREE.WebGLRenderer: "+_a)}var ab=new a.WebGLState(Fa,ha);void 0===Fa.getShaderPrecisionFormat&&(Fa.getShaderPrecisionFormat=function{return{rangeMin:1,rangeMax:1,precision:1}});var bb=new a.WebGLExtensions(Fa);bb.get("OES_texture_float"),bb.get("OES_texture_float_linear"),bb.get("OES_texture_half_float"),bb.get("OES_texture_half_float_linear"),bb.get("OES_standard_derivatives"),va&&bb.get("EXT_frag_depth");var cb=function(a,b,c,d){ta===!0&&(a*=d,b*=d,c*=d),Fa.clearColor(a,b,c,d)},db=function{Fa.clearColor(0,0,0,1),Fa.clearDepth(1),Fa.clearStencil(0),Fa.enable(Fa.DEPTH_TEST),Fa.depthFunc(Fa.LEQUAL),Fa.frontFace(Fa.CCW),Fa.cullFace(Fa.BACK),Fa.enable(Fa.CULL_FACE),Fa.enable(Fa.BLEND),Fa.blendEquation(Fa.FUNC_ADD),Fa.blendFunc(Fa.SRC_ALPHA,Fa.ONE_MINUS_SRC_ALPHA),Fa.viewport(Oa,Pa,Qa,Ra),cb(wa.r,wa.g,wa.b,xa)},eb=function{Ia=null,Ma=null,La="",Ka=-1,Ya=!0,ab.reset};db,this.context=Fa,this.state=ab;var fb=Fa.getParameter(Fa.MAX_TEXTURE_IMAGE_UNITS),gb=Fa.getParameter(Fa.MAX_VERTEX_TEXTURE_IMAGE_UNITS),hb=Fa.getParameter(Fa.MAX_TEXTURE_SIZE),ib=Fa.getParameter(Fa.MAX_CUBE_MAP_TEXTURE_SIZE),jb=gb>0,kb=jb&&bb.get("OES_texture_float"),lb=Fa.getShaderPrecisionFormat(Fa.VERTEX_SHADER,Fa.HIGH_FLOAT),mb=Fa.getShaderPrecisionFormat(Fa.VERTEX_SHADER,Fa.MEDIUM_FLOAT),nb=Fa.getShaderPrecisionFormat(Fa.FRAGMENT_SHADER,Fa.HIGH_FLOAT),ob=Fa.getShaderPrecisionFormat(Fa.FRAGMENT_SHADER,Fa.MEDIUM_FLOAT),pb=function{var a;return function{if(void 0!==a)return a;if(a=[],bb.get("WEBGL_compressed_texture_pvrtc")||bb.get("WEBGL_compressed_texture_s3tc"))for(var b=Fa.getParameter(Fa.COMPRESSED_TEXTURE_FORMATS),c=0;c<b.length;c++)a.push(b[c]);return a}},qb=lb.precision>0&&nb.precision>0,rb=mb.precision>0&&ob.precision>0;"highp"!==oa||qb||(rb?(oa="mediump",a.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(oa="lowp",a.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp."))),"mediump"!==oa||rb||(oa="lowp",a.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));var sb=new a.ShadowMapPlugin(this,ya,za,Aa),tb=new a.SpritePlugin(this,Da),ub=new a.LensFlarePlugin(this,Ea);this.getContext=function{return Fa},this.forceContextLoss=function{bb.get("WEBGL_lose_context").loseContext},this.supportsVertexTextures=function{return jb},this.supportsFloatTextures=function{return bb.get("OES_texture_float")},this.supportsHalfFloatTextures=function{return bb.get("OES_texture_half_float")},this.supportsStandardDerivatives=function{return bb.get("OES_standard_derivatives")},this.supportsCompressedTextureS3TC=function{return bb.get("WEBGL_compressed_texture_s3tc")},this.supportsCompressedTexturePVRTC=function{return bb.get("WEBGL_compressed_texture_pvrtc")},this.supportsBlendMinMax=function{return bb.get("EXT_blend_minmax")},this.getMaxAnisotropy=function{var a;return function{if(void 0!==a)return a;var b=bb.get("EXT_texture_filter_anisotropic");return a=null!==b?Fa.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}},this.getPrecision=function{return oa},this.getPixelRatio=function{return na},this.setPixelRatio=function(a){na=a},this.setSize=function(a,b,c){la.width=a*na,la.height=b*na,c!==!1&&(la.style.width=a+"px",la.style.height=b+"px"),this.setViewport(0,0,a,b)},this.setViewport=function(a,b,c,d){Oa=a*na,Pa=b*na,Qa=c*na,Ra=d*na,Fa.viewport(Oa,Pa,Qa,Ra)},this.setScissor=function(a,b,c,d){Fa.scissor(a*na,b*na,c*na,d*na)},this.enableScissorTest=function(a){a?Fa.enable(Fa.SCISSOR_TEST):Fa.disable(Fa.SCISSOR_TEST)},this.getClearColor=function{return wa},this.setClearColor=function(a,b){wa.set(a),xa=void 0!==b?b:1,cb(wa.r,wa.g,wa.b,xa)},this.getClearAlpha=function{return xa},this.setClearAlpha=function(a){xa=a,cb(wa.r,wa.g,wa.b,xa)},this.clear=function(a,b,c){var d=0;(void 0===a||a)&&(d|=Fa.COLOR_BUFFER_BIT),(void 0===b||b)&&(d|=Fa.DEPTH_BUFFER_BIT),(void 0===c||c)&&(d|=Fa.STENCIL_BUFFER_BIT),Fa.clear(d)},this.clearColor=function{Fa.clear(Fa.COLOR_BUFFER_BIT)},this.clearDepth=function{Fa.clear(Fa.DEPTH_BUFFER_BIT)},this.clearStencil=function{Fa.clear(Fa.STENCIL_BUFFER_BIT)},this.clearTarget=function(a,b,c,d){this.setRenderTarget(a),this.clear(b,c,d)},this.resetGLState=eb;var vb=function(a){var b=a.target;b.traverse(function(a){a.removeEventListener("remove",vb),G(a)})},wb=function(a){var b=a.target;b.removeEventListener("dispose",wb),Bb(b)},xb=function(a){var b=a.target;b.removeEventListener("dispose",xb),Cb(b),Ga.info.memory.textures--},yb=function(a){var b=a.target;b.removeEventListener("dispose",yb),Db(b),Ga.info.memory.textures--},zb=function(a){var b=a.target;b.removeEventListener("dispose",zb),Eb(b)},Ab=function(a){for(var b=["__webglVertexBuffer","__webglNormalBuffer","__webglTangentBuffer","__webglColorBuffer","__webglUVBuffer","__webglUV2Buffer","__webglSkinIndicesBuffer","__webglSkinWeightsBuffer","__webglFaceBuffer","__webglLineBuffer","__webglLineDistanceBuffer"],c=0,d=b.length;d>c;c++){var e=b[c];void 0!==a[e]&&(Fa.deleteBuffer(a[e]),delete a[e])}if(void 0!==a.__webglCustomAttributesList){for(var e in a.__webglCustomAttributesList)Fa.deleteBuffer(a.__webglCustomAttributesList[e].buffer);delete a.__webglCustomAttributesList}Ga.info.memory.geometries--},Bb=function(b){if(delete b.__webglInit,b instanceof a.BufferGeometry){for(var c in b.attributes){var d=b.attributes[c];void 0!==d.buffer&&(Fa.deleteBuffer(d.buffer),delete d.buffer)}Ga.info.memory.geometries--}else{var e=Fb[b.id];if(void 0!==e){for(var f=0,g=e.length;g>f;f++){var h=e[f];if(void 0!==h.numMorphTargets){for(var i=0,j=h.numMorphTargets;j>i;i++)Fa.deleteBuffer(h.__webglMorphTargetsBuffers[i]);delete h.__webglMorphTargetsBuffers}if(void 0!==h.numMorphNormals){for(var i=0,j=h.numMorphNormals;j>i;i++)Fa.deleteBuffer(h.__webglMorphNormalsBuffers[i]);delete h.__webglMorphNormalsBuffers}Ab(h)}delete Fb[b.id]}else Ab(b)}La=""},Cb=function(a){if(a.image&&a.image.__webglTextureCube)Fa.deleteTexture(a.image.__webglTextureCube),delete a.image.__webglTextureCube;else{if(void 0===a.__webglInit)return;Fa.deleteTexture(a.__webglTexture),delete a.__webglTexture,delete a.__webglInit}},Db=function(b){if(b&&void 0!==b.__webglTexture){if(Fa.deleteTexture(b.__webglTexture),delete b.__webglTexture,b instanceof a.WebGLRenderTargetCube)for(var c=0;6>c;c++)Fa.deleteFramebuffer(b.__webglFramebuffer[c]),Fa.deleteRenderbuffer(b.__webglRenderbuffer[c]);else Fa.deleteFramebuffer(b.__webglFramebuffer),Fa.deleteRenderbuffer(b.__webglRenderbuffer);delete b.__webglFramebuffer,delete b.__webglRenderbuffer}},Eb=function(a){var b=a.program.program;if(void 0!==b){a.program=void 0;var c,d,e,f=!1;for(c=0,d=Ha.length;d>c;c++)if(e=Ha[c],e.program===b){e.usedTimes--,0===e.usedTimes&&(f=!0);break}if(f===!0){var g=[];for(c=0,d=Ha.length;d>c;c++)e=Ha[c],e.program!==b&&g.push(e);Ha=g,Fa.deleteProgram(b),Ga.info.memory.programs--}}};this.renderBufferImmediate=function(b,c,d){if(ab.initAttributes,b.hasPositions&&!b.__webglVertexBuffer&&(b.__webglVertexBuffer=Fa.createBuffer),b.hasNormals&&!b.__webglNormalBuffer&&(b.__webglNormalBuffer=Fa.createBuffer),b.hasUvs&&!b.__webglUvBuffer&&(b.__webglUvBuffer=Fa.createBuffer),b.hasColors&&!b.__webglColorBuffer&&(b.__webglColorBuffer=Fa.createBuffer),b.hasPositions&&(Fa.bindBuffer(Fa.ARRAY_BUFFER,b.__webglVertexBuffer),Fa.bufferData(Fa.ARRAY_BUFFER,b.positionArray,Fa.DYNAMIC_DRAW),ab.enableAttribute(c.attributes.position),Fa.vertexAttribPointer(c.attributes.position,3,Fa.FLOAT,!1,0,0)),b.hasNormals){if(Fa.bindBuffer(Fa.ARRAY_BUFFER,b.__webglNormalBuffer),d instanceof a.MeshPhongMaterial==!1&&d.shading===a.FlatShading){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s=3*b.count;for(r=0;s>r;r+=9)q=b.normalArray,h=q[r],k=q[r+1],n=q[r+2],i=q[r+3],l=q[r+4],o=q[r+5],j=q[r+6],m=q[r+7],p=q[r+8],e=(h+i+j)/3,f=(k+l+m)/3,g=(n+o+p)/3,q[r]=e,q[r+1]=f,q[r+2]=g,q[r+3]=e,q[r+4]=f,q[r+5]=g,q[r+6]=e,q[r+7]=f,q[r+8]=g}Fa.bufferData(Fa.ARRAY_BUFFER,b.normalArray,Fa.DYNAMIC_DRAW),ab.enableAttribute(c.attributes.normal),Fa.vertexAttribPointer(c.attributes.normal,3,Fa.FLOAT,!1,0,0)}b.hasUvs&&d.map&&(Fa.bindBuffer(Fa.ARRAY_BUFFER,b.__webglUvBuffer),Fa.bufferData(Fa.ARRAY_BUFFER,b.uvArray,Fa.DYNAMIC_DRAW),ab.enableAttribute(c.attributes.uv),Fa.vertexAttribPointer(c.attributes.uv,2,Fa.FLOAT,!1,0,0)),b.hasColors&&d.vertexColors!==a.NoColors&&(Fa.bindBuffer(Fa.ARRAY_BUFFER,b.__webglColorBuffer),Fa.bufferData(Fa.ARRAY_BUFFER,b.colorArray,Fa.DYNAMIC_DRAW),ab.enableAttribute(c.attributes.color),Fa.vertexAttribPointer(c.attributes.color,3,Fa.FLOAT,!1,0,0)),ab.disableUnusedAttributes,Fa.drawArrays(Fa.TRIANGLES,0,b.count),b.count=0},this.renderBufferDirect=function(b,c,d,e,f,g){if(e.visible!==!1){D(g);var h=K(b,c,d,e,g),i=!1,j=e.wireframe?1:0,k="direct_"+f.id+"_"+h.id+"_"+j;if(k!==La&&(La=k,i=!0),i&&ab.initAttributes,g instanceof a.Mesh){var l=e.wireframe===!0?Fa.LINES:Fa.TRIANGLES,m=f.attributes.index;if(m){var n,p;m.array instanceof Uint32Array&&bb.get("OES_element_index_uint")?(n=Fa.UNSIGNED_INT,p=4):(n=Fa.UNSIGNED_SHORT,p=2);var q=f.offsets;if(0===q.length)i&&(o(e,h,f,0),Fa.bindBuffer(Fa.ELEMENT_ARRAY_BUFFER,m.buffer)),Fa.drawElements(l,m.array.length,n,0),Ga.info.render.calls++,Ga.info.render.vertices+=m.array.length,Ga.info.render.faces+=m.array.length/3;else{i=!0;for(var r=0,s=q.length;s>r;r++){var t=q[r].index;i&&(o(e,h,f,t),Fa.bindBuffer(Fa.ELEMENT_ARRAY_BUFFER,m.buffer)),Fa.drawElements(l,q[r].count,n,q[r].start*p),Ga.info.render.calls++,Ga.info.render.vertices+=q[r].count,Ga.info.render.faces+=q[r].count/3}}}else{i&&o(e,h,f,0);var u=f.attributes.position;Fa.drawArrays(l,0,u.array.length/u.itemSize),Ga.info.render.calls++,Ga.info.render.vertices+=u.array.length/u.itemSize,Ga.info.render.faces+=u.array.length/(3*u.itemSize)}}else if(g instanceof a.PointCloud){var l=Fa.POINTS,m=f.attributes.index;if(m){var n,p;m.array instanceof Uint32Array&&bb.get("OES_element_index_uint")?(n=Fa.UNSIGNED_INT,p=4):(n=Fa.UNSIGNED_SHORT,p=2);var q=f.offsets;if(0===q.length)i&&(o(e,h,f,0),Fa.bindBuffer(Fa.ELEMENT_ARRAY_BUFFER,m.buffer)),Fa.drawElements(l,m.array.length,n,0),Ga.info.render.calls++,Ga.info.render.points+=m.array.length;else{q.length>1&&(i=!0);for(var r=0,s=q.length;s>r;r++){var t=q[r].index;i&&(o(e,h,f,t),Fa.bindBuffer(Fa.ELEMENT_ARRAY_BUFFER,m.buffer)),Fa.drawElements(l,q[r].count,n,q[r].start*p),Ga.info.render.calls++,Ga.info.render.points+=q[r].count}}}else{i&&o(e,h,f,0);var u=f.attributes.position,q=f.offsets;if(0===q.length)Fa.drawArrays(l,0,u.array.length/3),Ga.info.render.calls++,Ga.info.render.points+=u.array.length/3;else for(var r=0,s=q.length;s>r;r++)Fa.drawArrays(l,q[r].index,q[r].count),Ga.info.render.calls++,Ga.info.render.points+=q[r].count}}else if(g instanceof a.Line){var l=g.mode===a.LineStrip?Fa.LINE_STRIP:Fa.LINES;ab.setLineWidth(e.linewidth*na);var m=f.attributes.index;if(m){var n,p;m.array instanceof Uint32Array?(n=Fa.UNSIGNED_INT,p=4):(n=Fa.UNSIGNED_SHORT,p=2);var q=f.offsets;if(0===q.length)i&&(o(e,h,f,0),Fa.bindBuffer(Fa.ELEMENT_ARRAY_BUFFER,m.buffer)),Fa.drawElements(l,m.array.length,n,0),Ga.info.render.calls++,Ga.info.render.vertices+=m.array.length;else{q.length>1&&(i=!0);for(var r=0,s=q.length;s>r;r++){var t=q[r].index;i&&(o(e,h,f,t),Fa.bindBuffer(Fa.ELEMENT_ARRAY_BUFFER,m.buffer)),Fa.drawElements(l,q[r].count,n,q[r].start*p),Ga.info.render.calls++,Ga.info.render.vertices+=q[r].count}}}else{i&&o(e,h,f,0);var u=f.attributes.position,q=f.offsets;if(0===q.length)Fa.drawArrays(l,0,u.array.length/3),Ga.info.render.calls++,Ga.info.render.vertices+=u.array.length/3;else for(var r=0,s=q.length;s>r;r++)Fa.drawArrays(l,q[r].index,q[r].count),Ga.info.render.calls++,Ga.info.render.vertices+=q[r].count}}}},this.renderBuffer=function(b,c,d,e,f,g){if(e.visible!==!1){D(g);var h=K(b,c,d,e,g),i=h.attributes,j=!1,k=e.wireframe?1:0,l=f.id+"_"+h.id+"_"+k;if(l!==La&&(La=l,j=!0),j&&ab.initAttributes,!e.morphTargets&&i.position>=0?j&&(Fa.bindBuffer(Fa.ARRAY_BUFFER,f.__webglVertexBuffer),ab.enableAttribute(i.position),Fa.vertexAttribPointer(i.position,3,Fa.FLOAT,!1,0,0)):g.morphTargetBase&&p(e,f,g),j){if(f.__webglCustomAttributesList)for(var m=0,n=f.__webglCustomAttributesList.length;n>m;m++){var o=f.__webglCustomAttributesList[m];i[o.buffer.belongsToAttribute]>=0&&(Fa.bindBuffer(Fa.ARRAY_BUFFER,o.buffer),ab.enableAttribute(i[o.buffer.belongsToAttribute]),Fa.vertexAttribPointer(i[o.buffer.belongsToAttribute],o.size,Fa.FLOAT,!1,0,0))}i.color>=0&&(g.geometry.colors.length>0||g.geometry.faces.length>0?(Fa.bindBuffer(Fa.ARRAY_BUFFER,f.__webglColorBuffer),ab.enableAttribute(i.color),Fa.vertexAttribPointer(i.color,3,Fa.FLOAT,!1,0,0)):void 0!==e.defaultAttributeValues&&Fa.vertexAttrib3fv(i.color,e.defaultAttributeValues.color)),i.normal>=0&&(Fa.bindBuffer(Fa.ARRAY_BUFFER,f.__webglNormalBuffer),ab.enableAttribute(i.normal),Fa.vertexAttribPointer(i.normal,3,Fa.FLOAT,!1,0,0)),i.tangent>=0&&(Fa.bindBuffer(Fa.ARRAY_BUFFER,f.__webglTangentBuffer),ab.enableAttribute(i.tangent),Fa.vertexAttribPointer(i.tangent,4,Fa.FLOAT,!1,0,0)),i.uv>=0&&(g.geometry.faceVertexUvs[0]?(Fa.bindBuffer(Fa.ARRAY_BUFFER,f.__webglUVBuffer),ab.enableAttribute(i.uv),Fa.vertexAttribPointer(i.uv,2,Fa.FLOAT,!1,0,0)):void 0!==e.defaultAttributeValues&&Fa.vertexAttrib2fv(i.uv,e.defaultAttributeValues.uv)),i.uv2>=0&&(g.geometry.faceVertexUvs[1]?(Fa.bindBuffer(Fa.ARRAY_BUFFER,f.__webglUV2Buffer),ab.enableAttribute(i.uv2),Fa.vertexAttribPointer(i.uv2,2,Fa.FLOAT,!1,0,0)):void 0!==e.defaultAttributeValues&&Fa.vertexAttrib2fv(i.uv2,e.defaultAttributeValues.uv2)),e.skinning&&i.skinIndex>=0&&i.skinWeight>=0&&(Fa.bindBuffer(Fa.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),ab.enableAttribute(i.skinIndex),Fa.vertexAttribPointer(i.skinIndex,4,Fa.FLOAT,!1,0,0),Fa.bindBuffer(Fa.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),ab.enableAttribute(i.skinWeight),Fa.vertexAttribPointer(i.skinWeight,4,Fa.FLOAT,!1,0,0)),i.lineDistance>=0&&(Fa.bindBuffer(Fa.ARRAY_BUFFER,f.__webglLineDistanceBuffer),ab.enableAttribute(i.lineDistance),Fa.vertexAttribPointer(i.lineDistance,1,Fa.FLOAT,!1,0,0))}if(ab.disableUnusedAttributes,g instanceof a.Mesh){var q=f.__typeArray===Uint32Array?Fa.UNSIGNED_INT:Fa.UNSIGNED_SHORT;e.wireframe?(ab.setLineWidth(e.wireframeLinewidth*na),j&&Fa.bindBuffer(Fa.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),Fa.drawElements(Fa.LINES,f.__webglLineCount,q,0)):(j&&Fa.bindBuffer(Fa.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),Fa.drawElements(Fa.TRIANGLES,f.__webglFaceCount,q,0)),Ga.info.render.calls++,Ga.info.render.vertices+=f.__webglFaceCount,Ga.info.render.faces+=f.__webglFaceCount/3}else if(g instanceof a.Line){var r=g.mode===a.LineStrip?Fa.LINE_STRIP:Fa.LINES;ab.setLineWidth(e.linewidth*na),Fa.drawArrays(r,0,f.__webglLineCount),Ga.info.render.calls++}else g instanceof a.PointCloud&&(Fa.drawArrays(Fa.POINTS,0,f.__webglParticleCount),Ga.info.render.calls++,Ga.info.render.points+=f.__webglParticleCount)}},this.render=function(b,c,d,e){if(c instanceof a.Camera==!1)return void a.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");var f=b.fog;La="",Ka=-1,Ma=null,Ya=!0,b.autoUpdate===!0&&b.updateMatrixWorld,void 0===c.parent&&c.updateMatrixWorld,b.traverse(function(b){b instanceof a.SkinnedMesh&&b.skeleton.update}),c.matrixWorldInverse.getInverse(c.matrixWorld),Va.multiplyMatrices(c.projectionMatrix,c.matrixWorldInverse),Ua.setFromMatrix(Va),ya.length=0,Ba.length=0,Ca.length=0,Da.length=0,Ea.length=0,t(b),Ga.sortObjects===!0&&(Ba.sort(q),Ca.sort(r)),sb.render(b,c),Ga.info.render.calls=0,Ga.info.render.vertices=0,Ga.info.render.faces=0,Ga.info.render.points=0,this.setRenderTarget(d),(this.autoClear||e)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);for(var g=0,h=Aa.length;h>g;g++){var i=Aa[g],j=i.object;j.visible&&(Y(j,c),w(i))}if(b.overrideMaterial){var k=b.overrideMaterial;J(k),u(Ba,c,ya,f,k),u(Ca,c,ya,f,k),v(Aa,"",c,ya,f,k)}else ab.setBlending(a.NoBlending),u(Ba,c,ya,f,null),v(Aa,"opaque",c,ya,f,null),u(Ca,c,ya,f,null),v(Aa,"transparent",c,ya,f,null);tb.render(b,c),ub.render(b,c,Sa,Ta),d&&d.generateMipmaps&&d.minFilter!==a.NearestFilter&&d.minFilter!==a.LinearFilter&&fa(d),ab.setDepthTest(!0),ab.setDepthWrite(!0),ab.setColorWrite(!0)},this.renderImmediateObject=function(a,b,c,d,e){var f=K(a,b,c,d,e);La="",Ga.setMaterialFaces(d),e.immediateRenderCallback?e.immediateRenderCallback(f,Fa,Ua):e.render(function(a){Ga.renderBufferImmediate(a,f,d)})};var Fb={},Gb=0,Hb={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointCloudMaterial:"particle_basic"};this.setFaceCulling=function(b,c){b===a.CullFaceNone?Fa.disable(Fa.CULL_FACE):(c===a.FrontFaceDirectionCW?Fa.frontFace(Fa.CW):Fa.frontFace(Fa.CCW),b===a.CullFaceBack?Fa.cullFace(Fa.BACK):b===a.CullFaceFront?Fa.cullFace(Fa.FRONT):Fa.cullFace(Fa.FRONT_AND_BACK),Fa.enable(Fa.CULL_FACE))},this.setMaterialFaces=function(b){ab.setDoubleSided(b.side===a.DoubleSide),ab.setFlipSided(b.side===a.BackSide)},this.uploadTexture=function(b){void 0===b.__webglInit&&(b.__webglInit=!0,b.addEventListener("dispose",xb),b.__webglTexture=Fa.createTexture,Ga.info.memory.textures++),Fa.bindTexture(Fa.TEXTURE_2D,b.__webglTexture),Fa.pixelStorei(Fa.UNPACK_FLIP_Y_WEBGL,b.flipY),Fa.pixelStorei(Fa.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha),Fa.pixelStorei(Fa.UNPACK_ALIGNMENT,b.unpackAlignment),b.image=aa(b.image,hb);var c=b.image,d=a.Math.isPowerOfTwo(c.width)&&a.Math.isPowerOfTwo(c.height),e=ha(b.format),f=ha(b.type);_(Fa.TEXTURE_2D,b,d);var g,h=b.mipmaps;if(b instanceof a.DataTexture)if(h.length>0&&d){for(var i=0,j=h.length;j>i;i++)g=h[i],Fa.texImage2D(Fa.TEXTURE_2D,i,e,g.width,g.height,0,e,f,g.data);b.generateMipmaps=!1}else Fa.texImage2D(Fa.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(b instanceof a.CompressedTexture)for(var i=0,j=h.length;j>i;i++)g=h[i],b.format!==a.RGBAFormat&&b.format!==a.RGBFormat?pb.indexOf(e)>-1?Fa.compressedTexImage2D(Fa.TEXTURE_2D,i,e,g.width,g.height,0,g.data):a.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture"):Fa.texImage2D(Fa.TEXTURE_2D,i,e,g.width,g.height,0,e,f,g.data);else if(h.length>0&&d){for(var i=0,j=h.length;j>i;i++)g=h[i],Fa.texImage2D(Fa.TEXTURE_2D,i,e,e,f,g);b.generateMipmaps=!1}else Fa.texImage2D(Fa.TEXTURE_2D,0,e,e,f,b.image);b.generateMipmaps&&d&&Fa.generateMipmap(Fa.TEXTURE_2D),b.needsUpdate=!1,b.onUpdate&&b.onUpdate},this.setTexture=function(a,b){Fa.activeTexture(Fa.TEXTURE0+b),a.needsUpdate?Ga.uploadTexture(a):Fa.bindTexture(Fa.TEXTURE_2D,a.__webglTexture)},this.setRenderTarget=function(b){var c=b instanceof a.WebGLRenderTargetCube;if(b&&void 0===b.__webglFramebuffer){void 0===b.depthBuffer&&(b.depthBuffer=!0),void 0===b.stencilBuffer&&(b.stencilBuffer=!0),b.addEventListener("dispose",yb),b.__webglTexture=Fa.createTexture,Ga.info.memory.textures++;var d=a.Math.isPowerOfTwo(b.width)&&a.Math.isPowerOfTwo(b.height),e=ha(b.format),f=ha(b.type);if(c){b.__webglFramebuffer=[],b.__webglRenderbuffer=[],Fa.bindTexture(Fa.TEXTURE_CUBE_MAP,b.__webglTexture),_(Fa.TEXTURE_CUBE_MAP,b,d);for(var g=0;6>g;g++)b.__webglFramebuffer[g]=Fa.createFramebuffer,b.__webglRenderbuffer[g]=Fa.createRenderbuffer,Fa.texImage2D(Fa.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,e,b.width,b.height,0,e,f,null),da(b.__webglFramebuffer[g],b,Fa.TEXTURE_CUBE_MAP_POSITIVE_X+g),ea(b.__webglRenderbuffer[g],b);d&&Fa.generateMipmap(Fa.TEXTURE_CUBE_MAP)}else b.__webglFramebuffer=Fa.createFramebuffer,b.shareDepthFrom?b.__webglRenderbuffer=b.shareDepthFrom.__webglRenderbuffer:b.__webglRenderbuffer=Fa.createRenderbuffer,Fa.bindTexture(Fa.TEXTURE_2D,b.__webglTexture),_(Fa.TEXTURE_2D,b,d),Fa.texImage2D(Fa.TEXTURE_2D,0,e,b.width,b.height,0,e,f,null),da(b.__webglFramebuffer,b,Fa.TEXTURE_2D),b.shareDepthFrom?b.depthBuffer&&!b.stencilBuffer?Fa.framebufferRenderbuffer(Fa.FRAMEBUFFER,Fa.DEPTH_ATTACHMENT,Fa.RENDERBUFFER,b.__webglRenderbuffer):b.depthBuffer&&b.stencilBuffer&&Fa.framebufferRenderbuffer(Fa.FRAMEBUFFER,Fa.DEPTH_STENCIL_ATTACHMENT,Fa.RENDERBUFFER,b.__webglRenderbuffer):ea(b.__webglRenderbuffer,b),d&&Fa.generateMipmap(Fa.TEXTURE_2D);c?Fa.bindTexture(Fa.TEXTURE_CUBE_MAP,null):Fa.bindTexture(Fa.TEXTURE_2D,null),Fa.bindRenderbuffer(Fa.RENDERBUFFER,null),Fa.bindFramebuffer(Fa.FRAMEBUFFER,null)}var h,i,j,k,l;b?(h=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,i=b.width,j=b.height,k=0,l=0):(h=null,i=Qa,j=Ra,k=Oa,l=Pa),h!==Ja&&(Fa.bindFramebuffer(Fa.FRAMEBUFFER,h),Fa.viewport(k,l,i,j),Ja=h),Sa=i,Ta=j},this.readRenderTargetPixels=function(b,c,d,e,f,g){if(!(b instanceof a.WebGLRenderTarget))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget."); if(b.__webglFramebuffer){if(b.format!==a.RGBAFormat)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA format. readPixels can read only RGBA format.");var h=!1;b.__webglFramebuffer!==Ja&&(Fa.bindFramebuffer(Fa.FRAMEBUFFER,b.__webglFramebuffer),h=!0),Fa.checkFramebufferStatus(Fa.FRAMEBUFFER)===Fa.FRAMEBUFFER_COMPLETE?Fa.readPixels(c,d,e,f,Fa.RGBA,Fa.UNSIGNED_BYTE,g):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."),h&&Fa.bindFramebuffer(Fa.FRAMEBUFFER,Ja)}},this.initMaterial=function{a.warn("THREE.WebGLRenderer: .initMaterial has been removed.")},this.addPrePlugin=function{a.warn("THREE.WebGLRenderer: .addPrePlugin has been removed.")},this.addPostPlugin=function{a.warn("THREE.WebGLRenderer: .addPostPlugin has been removed.")},this.updateShadowMap=function{a.warn("THREE.WebGLRenderer: .updateShadowMap has been removed.")}},a.WebGLRenderTarget=function(b,c,d){this.width=b,this.height=c,d=d||{},this.wrapS=void 0!==d.wrapS?d.wrapS:a.ClampToEdgeWrapping,this.wrapT=void 0!==d.wrapT?d.wrapT:a.ClampToEdgeWrapping,this.magFilter=void 0!==d.magFilter?d.magFilter:a.LinearFilter,this.minFilter=void 0!==d.minFilter?d.minFilter:a.LinearMipMapLinearFilter,this.anisotropy=void 0!==d.anisotropy?d.anisotropy:1,this.offset=new a.Vector2(0,0),this.repeat=new a.Vector2(1,1),this.format=void 0!==d.format?d.format:a.RGBAFormat,this.type=void 0!==d.type?d.type:a.UnsignedByteType,this.depthBuffer=void 0!==d.depthBuffer?d.depthBuffer:!0,this.stencilBuffer=void 0!==d.stencilBuffer?d.stencilBuffer:!0,this.generateMipmaps=!0,this.shareDepthFrom=void 0!==d.shareDepthFrom?d.shareDepthFrom:null},a.WebGLRenderTarget.prototype={constructor:a.WebGLRenderTarget,setSize:function(a,b){this.width=a,this.height=b},clone:function{var b=new a.WebGLRenderTarget(this.width,this.height);return b.wrapS=this.wrapS,b.wrapT=this.wrapT,b.magFilter=this.magFilter,b.minFilter=this.minFilter,b.anisotropy=this.anisotropy,b.offset.copy(this.offset),b.repeat.copy(this.repeat),b.format=this.format,b.type=this.type,b.depthBuffer=this.depthBuffer,b.stencilBuffer=this.stencilBuffer,b.generateMipmaps=this.generateMipmaps,b.shareDepthFrom=this.shareDepthFrom,b},dispose:function{this.dispatchEvent({type:"dispose"})}},a.EventDispatcher.prototype.apply(a.WebGLRenderTarget.prototype),a.WebGLRenderTargetCube=function(b,c,d){a.WebGLRenderTarget.call(this,b,c,d),this.activeCubeFace=0},a.WebGLRenderTargetCube.prototype=Object.create(a.WebGLRenderTarget.prototype),a.WebGLRenderTargetCube.prototype.constructor=a.WebGLRenderTargetCube,a.WebGLExtensions=function(b){var c={};this.get=function(d){if(void 0!==c[d])return c[d];var e;switch(d){case"EXT_texture_filter_anisotropic":e=b.getExtension("EXT_texture_filter_anisotropic")||b.getExtension("MOZ_EXT_texture_filter_anisotropic")||b.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":e=b.getExtension("WEBGL_compressed_texture_s3tc")||b.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||b.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":e=b.getExtension("WEBGL_compressed_texture_pvrtc")||b.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:e=b.getExtension(d)}return null===e&&a.warn("THREE.WebGLRenderer: "+d+" extension not supported."),c[d]=e,e}},a.WebGLProgram=function{var b=0,c=function(a){var b,c,d=[];for(var e in a)b=a[e],b!==!1&&(c="#define "+e+" "+b,d.push(c));return d.join("\n")},d=function(a,b,c){for(var d={},e=0,f=c.length;f>e;e++){var g=c[e];d[g]=a.getUniformLocation(b,g)}return d},e=function(a,b,c){for(var d={},e=0,f=c.length;f>e;e++){var g=c[e];d[g]=a.getAttribLocation(b,g)}return d};return function(f,g,h,i){var j=f,k=j.context,l=h.defines,m=h.__webglShader.uniforms,n=h.attributes,o=h.__webglShader.vertexShader,p=h.__webglShader.fragmentShader,q=h.index0AttributeName;void 0===q&&i.morphTargets===!0&&(q="position");var r="SHADOWMAP_TYPE_BASIC";i.shadowMapType===a.PCFShadowMap?r="SHADOWMAP_TYPE_PCF":i.shadowMapType===a.PCFSoftShadowMap&&(r="SHADOWMAP_TYPE_PCF_SOFT");var s="ENVMAP_TYPE_CUBE",t="ENVMAP_MODE_REFLECTION",u="ENVMAP_BLENDING_MULTIPLY";if(i.envMap){switch(h.envMap.mapping){case a.CubeReflectionMapping:case a.CubeRefractionMapping:s="ENVMAP_TYPE_CUBE";break;case a.EquirectangularReflectionMapping:case a.EquirectangularRefractionMapping:s="ENVMAP_TYPE_EQUIREC";break;case a.SphericalReflectionMapping:s="ENVMAP_TYPE_SPHERE"}switch(h.envMap.mapping){case a.CubeRefractionMapping:case a.EquirectangularRefractionMapping:t="ENVMAP_MODE_REFRACTION"}switch(h.combine){case a.MultiplyOperation:u="ENVMAP_BLENDING_MULTIPLY";break;case a.MixOperation:u="ENVMAP_BLENDING_MIX";break;case a.AddOperation:u="ENVMAP_BLENDING_ADD"}}var v,w,x=f.gammaFactor>0?f.gammaFactor:1,y=c(l),z=k.createProgram;h instanceof a.RawShaderMaterial?(v="",w=""):(v=["precision "+i.precision+" float;","precision "+i.precision+" int;",y,i.supportsVertexTextures?"#define VERTEX_TEXTURES":"",j.gammaInput?"#define GAMMA_INPUT":"",j.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+x,"#define MAX_DIR_LIGHTS "+i.maxDirLights,"#define MAX_POINT_LIGHTS "+i.maxPointLights,"#define MAX_SPOT_LIGHTS "+i.maxSpotLights,"#define MAX_HEMI_LIGHTS "+i.maxHemiLights,"#define MAX_SHADOWS "+i.maxShadows,"#define MAX_BONES "+i.maxBones,i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+t:"",i.lightMap?"#define USE_LIGHTMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals?"#define USE_MORPHNORMALS":"",i.wrapAround?"#define WRAP_AROUND":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+r:"",i.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",i.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","attribute vec2 uv2;","#ifdef USE_COLOR","	attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","	attribute vec3 morphTarget0;","	attribute vec3 morphTarget1;","	attribute vec3 morphTarget2;","	attribute vec3 morphTarget3;","	#ifdef USE_MORPHNORMALS","		attribute vec3 morphNormal0;","		attribute vec3 morphNormal1;","		attribute vec3 morphNormal2;","		attribute vec3 morphNormal3;","	#else","		attribute vec3 morphTarget4;","		attribute vec3 morphTarget5;","		attribute vec3 morphTarget6;","		attribute vec3 morphTarget7;","	#endif","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",""].join("\n"),w=["precision "+i.precision+" float;","precision "+i.precision+" int;",i.bumpMap||i.normalMap||i.flatShading?"#extension GL_OES_standard_derivatives : enable":"",y,"#define MAX_DIR_LIGHTS "+i.maxDirLights,"#define MAX_POINT_LIGHTS "+i.maxPointLights,"#define MAX_SPOT_LIGHTS "+i.maxSpotLights,"#define MAX_HEMI_LIGHTS "+i.maxHemiLights,"#define MAX_SHADOWS "+i.maxShadows,i.alphaTest?"#define ALPHATEST "+i.alphaTest:"",j.gammaInput?"#define GAMMA_INPUT":"",j.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+x,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+s:"",i.envMap?"#define "+t:"",i.envMap?"#define "+u:"",i.lightMap?"#define USE_LIGHTMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.flatShading?"#define FLAT_SHADED":"",i.metal?"#define METAL":"",i.wrapAround?"#define WRAP_AROUND":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+r:"",i.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",i.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",""].join("\n"));var A=new a.WebGLShader(k,k.VERTEX_SHADER,v+o),B=new a.WebGLShader(k,k.FRAGMENT_SHADER,w+p);k.attachShader(z,A),k.attachShader(z,B),void 0!==q&&k.bindAttribLocation(z,0,q),k.linkProgram(z);var C=k.getProgramInfoLog(z);k.getProgramParameter(z,k.LINK_STATUS)===!1&&a.error("THREE.WebGLProgram: shader error: "+k.getError,"gl.VALIDATE_STATUS",k.getProgramParameter(z,k.VALIDATE_STATUS),"gl.getPRogramInfoLog",C),""!==C&&a.warn("THREE.WebGLProgram: gl.getProgramInfoLog"+C),k.deleteShader(A),k.deleteShader(B);var D=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","morphTargetInfluences","bindMatrix","bindMatrixInverse"];i.useVertexTexture?(D.push("boneTexture"),D.push("boneTextureWidth"),D.push("boneTextureHeight")):D.push("boneGlobalMatrices"),i.logarithmicDepthBuffer&&D.push("logDepthBufFC");for(var E in m)D.push(E);this.uniforms=d(k,z,D),D=["position","normal","uv","uv2","tangent","color","skinIndex","skinWeight","lineDistance"];for(var F=0;F<i.maxMorphTargets;F++)D.push("morphTarget"+F);for(var F=0;F<i.maxMorphNormals;F++)D.push("morphNormal"+F);for(var G in n)D.push(G);return this.attributes=e(k,z,D),this.attributesKeys=Object.keys(this.attributes),this.id=b++,this.code=g,this.usedTimes=1,this.program=z,this.vertexShader=A,this.fragmentShader=B,this}},a.WebGLShader=function{var b=function(a){for(var b=a.split("\n"),c=0;c<b.length;c++)b[c]=c+1+": "+b[c];return b.join("\n")};return function(c,d,e){var f=c.createShader(d);return c.shaderSource(f,e),c.compileShader(f),c.getShaderParameter(f,c.COMPILE_STATUS)===!1&&a.error("THREE.WebGLShader: Shader couldn't compile."),""!==c.getShaderInfoLog(f)&&a.warn("THREE.WebGLShader: gl.getShaderInfoLog",c.getShaderInfoLog(f),b(e)),f}},a.WebGLState=function(b,c){var d=new Uint8Array(16),e=new Uint8Array(16),f=null,g=null,h=null,i=null,j=null,k=null,l=null,m=null,n=null,o=null,p=null,q=null,r=null,s=null,t=null,u=null;this.initAttributes=function{for(var a=0,b=d.length;b>a;a++)d[a]=0},this.enableAttribute=function(a){d[a]=1,0===e[a]&&(b.enableVertexAttribArray(a),e[a]=1)},this.disableUnusedAttributes=function{for(var a=0,c=e.length;c>a;a++)e[a]!==d[a]&&(b.disableVertexAttribArray(a),e[a]=0)},this.setBlending=function(d,e,m,n,o,p,q){d!==f&&(d===a.NoBlending?b.disable(b.BLEND):d===a.AdditiveBlending?(b.enable(b.BLEND),b.blendEquation(b.FUNC_ADD),b.blendFunc(b.SRC_ALPHA,b.ONE)):d===a.SubtractiveBlending?(b.enable(b.BLEND),b.blendEquation(b.FUNC_ADD),b.blendFunc(b.ZERO,b.ONE_MINUS_SRC_COLOR)):d===a.MultiplyBlending?(b.enable(b.BLEND),b.blendEquation(b.FUNC_ADD),b.blendFunc(b.ZERO,b.SRC_COLOR)):d===a.CustomBlending?b.enable(b.BLEND):(b.enable(b.BLEND),b.blendEquationSeparate(b.FUNC_ADD,b.FUNC_ADD),b.blendFuncSeparate(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA,b.ONE,b.ONE_MINUS_SRC_ALPHA)),f=d),d===a.CustomBlending?(o=o||e,p=p||m,q=q||n,e===g&&o===j||(b.blendEquationSeparate(c(e),c(o)),g=e,j=o),m===h&&n===i&&p===k&&q===l||(b.blendFuncSeparate(c(m),c(n),c(p),c(q)),h=m,i=n,k=p,l=q)):(g=null,h=null,i=null,j=null,k=null,l=null)},this.setDepthTest=function(a){m!==a&&(a?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST),m=a)},this.setDepthWrite=function(a){n!==a&&(b.depthMask(a),n=a)},this.setColorWrite=function(a){o!==a&&(b.colorMask(a,a,a,a),o=a)},this.setDoubleSided=function(a){p!==a&&(a?b.disable(b.CULL_FACE):b.enable(b.CULL_FACE),p=a)},this.setFlipSided=function(a){q!==a&&(a?b.frontFace(b.CW):b.frontFace(b.CCW),q=a)},this.setLineWidth=function(a){a!==r&&(b.lineWidth(a),r=a)},this.setPolygonOffset=function(a,c,d){s!==a&&(a?b.enable(b.POLYGON_OFFSET_FILL):b.disable(b.POLYGON_OFFSET_FILL),s=a),!a||t===c&&u===d||(b.polygonOffset(c,d),t=c,u=d)},this.reset=function{for(var a=0;a<e.length;a++)e[a]=0;f=null,m=null,n=null,o=null,p=null,q=null}},a.LensFlarePlugin=function(b,c){function d(a){var c=m.createProgram,d=m.createShader(m.FRAGMENT_SHADER),e=m.createShader(m.VERTEX_SHADER),f="precision "+b.getPrecision+" float;\n";return m.shaderSource(d,f+a.fragmentShader),m.shaderSource(e,f+a.vertexShader),m.compileShader(d),m.compileShader(e),m.attachShader(c,d),m.attachShader(c,e),m.linkProgram(c),c}var e,f,g,h,i,j,k,l,m=b.context,n=function{var a=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),b=new Uint16Array([0,1,2,0,2,3]);e=m.createBuffer,f=m.createBuffer,m.bindBuffer(m.ARRAY_BUFFER,e),m.bufferData(m.ARRAY_BUFFER,a,m.STATIC_DRAW),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f),m.bufferData(m.ELEMENT_ARRAY_BUFFER,b,m.STATIC_DRAW),k=m.createTexture,l=m.createTexture,m.bindTexture(m.TEXTURE_2D,k),m.texImage2D(m.TEXTURE_2D,0,m.RGB,16,16,0,m.RGB,m.UNSIGNED_BYTE,null),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST),m.bindTexture(m.TEXTURE_2D,l),m.texImage2D(m.TEXTURE_2D,0,m.RGBA,16,16,0,m.RGBA,m.UNSIGNED_BYTE,null),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST),j=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;var c;c=j?{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility =       visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *=       visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main {","if( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")}:{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["precision mediump float;","uniform lowp int renderType;","uniform sampler2D map;","uniform sampler2D occlusionMap;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","void main {","if( renderType == 0 ) {","gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;","visibility = ( 1.0 - visibility / 4.0 );","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * visibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},g=d(c),h={vertex:m.getAttribLocation(g,"position"),uv:m.getAttribLocation(g,"uv")},i={renderType:m.getUniformLocation(g,"renderType"),map:m.getUniformLocation(g,"map"),occlusionMap:m.getUniformLocation(g,"occlusionMap"),opacity:m.getUniformLocation(g,"opacity"),color:m.getUniformLocation(g,"color"),scale:m.getUniformLocation(g,"scale"),rotation:m.getUniformLocation(g,"rotation"),screenPosition:m.getUniformLocation(g,"screenPosition")}};this.render=function(d,o,p,q){if(0!==c.length){var r=new a.Vector3,s=q/p,t=.5*p,u=.5*q,v=16/q,w=new a.Vector2(v*s,v),x=new a.Vector3(1,1,0),y=new a.Vector2(1,1);void 0===g&&n,m.useProgram(g),m.enableVertexAttribArray(h.vertex),m.enableVertexAttribArray(h.uv),m.uniform1i(i.occlusionMap,0),m.uniform1i(i.map,1),m.bindBuffer(m.ARRAY_BUFFER,e),m.vertexAttribPointer(h.vertex,2,m.FLOAT,!1,16,0),m.vertexAttribPointer(h.uv,2,m.FLOAT,!1,16,8),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f),m.disable(m.CULL_FACE),m.depthMask(!1);for(var z=0,A=c.length;A>z;z++){v=16/q,w.set(v*s,v);var B=c[z];if(r.set(B.matrixWorld.elements[12],B.matrixWorld.elements[13],B.matrixWorld.elements[14]),r.applyMatrix4(o.matrixWorldInverse),r.applyProjection(o.projectionMatrix),x.copy(r),y.x=x.x*t+t,y.y=x.y*u+u,j||y.x>0&&y.x<p&&y.y>0&&y.y<q){m.activeTexture(m.TEXTURE1),m.bindTexture(m.TEXTURE_2D,k),m.copyTexImage2D(m.TEXTURE_2D,0,m.RGB,y.x-8,y.y-8,16,16,0),m.uniform1i(i.renderType,0),m.uniform2f(i.scale,w.x,w.y),m.uniform3f(i.screenPosition,x.x,x.y,x.z),m.disable(m.BLEND),m.enable(m.DEPTH_TEST),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0),m.activeTexture(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,l),m.copyTexImage2D(m.TEXTURE_2D,0,m.RGBA,y.x-8,y.y-8,16,16,0),m.uniform1i(i.renderType,1),m.disable(m.DEPTH_TEST),m.activeTexture(m.TEXTURE1),m.bindTexture(m.TEXTURE_2D,k),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0),B.positionScreen.copy(x),B.customUpdateCallback?B.customUpdateCallback(B):B.updateLensFlares,m.uniform1i(i.renderType,2),m.enable(m.BLEND);for(var C=0,D=B.lensFlares.length;D>C;C++){var E=B.lensFlares[C];E.opacity>.001&&E.scale>.001&&(x.x=E.x,x.y=E.y,x.z=E.z,v=E.size*E.scale/q,w.x=v*s,w.y=v,m.uniform3f(i.screenPosition,x.x,x.y,x.z),m.uniform2f(i.scale,w.x,w.y),m.uniform1f(i.rotation,E.rotation),m.uniform1f(i.opacity,E.opacity),m.uniform3f(i.color,E.color.r,E.color.g,E.color.b),b.state.setBlending(E.blending,E.blendEquation,E.blendSrc,E.blendDst),b.setTexture(E.texture,1),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0))}}}m.enable(m.CULL_FACE),m.enable(m.DEPTH_TEST),m.depthMask(!0),b.resetGLState}}},a.ShadowMapPlugin=function(b,c,d,e){function f(a,b,c){if(b.visible){var e=d[b.id];if(e&&b.castShadow&&(b.frustumCulled===!1||p.intersectsObject(b)===!0))for(var g=0,h=e.length;h>g;g++){var i=e[g];b._modelViewMatrix.multiplyMatrices(c.matrixWorldInverse,b.matrixWorld),u.push(i)}for(var g=0,h=b.children.length;h>g;g++)f(a,b.children[g],c)}}function g(b,c){var d=new a.DirectionalLight;d.isVirtual=!0,d.onlyShadow=!0,d.castShadow=!0,d.shadowCameraNear=b.shadowCameraNear,d.shadowCameraFar=b.shadowCameraFar,d.shadowCameraLeft=b.shadowCameraLeft,d.shadowCameraRight=b.shadowCameraRight,d.shadowCameraBottom=b.shadowCameraBottom,d.shadowCameraTop=b.shadowCameraTop,d.shadowCameraVisible=b.shadowCameraVisible,d.shadowDarkness=b.shadowDarkness,d.shadowBias=b.shadowCascadeBias[c],d.shadowMapWidth=b.shadowCascadeWidth[c],d.shadowMapHeight=b.shadowCascadeHeight[c],d.pointsWorld=[],d.pointsFrustum=[];for(var e=d.pointsWorld,f=d.pointsFrustum,g=0;8>g;g++)e[g]=new a.Vector3,f[g]=new a.Vector3;var h=b.shadowCascadeNearZ[c],i=b.shadowCascadeFarZ[c];return f[0].set(-1,-1,h),f[1].set(1,-1,h),f[2].set(-1,1,h),f[3].set(1,1,h),f[4].set(-1,-1,i),f[5].set(1,-1,i),f[6].set(-1,1,i),f[7].set(1,1,i),d}function h(a,b){var c=a.shadowCascadeArray[b];c.position.copy(a.position),c.target.position.copy(a.target.position),c.lookAt(c.target),c.shadowCameraVisible=a.shadowCameraVisible,c.shadowDarkness=a.shadowDarkness,c.shadowBias=a.shadowCascadeBias[b];var d=a.shadowCascadeNearZ[b],e=a.shadowCascadeFarZ[b],f=c.pointsFrustum;f[0].z=d,f[1].z=d,f[2].z=d,f[3].z=d,f[4].z=e,f[5].z=e,f[6].z=e,f[7].z=e}function i(a,b){var c=b.shadowCamera,d=b.pointsFrustum,e=b.pointsWorld;r.set(1/0,1/0,1/0),s.set(-(1/0),-(1/0),-(1/0));for(var f=0;8>f;f++){var g=e[f];g.copy(d[f]),g.unproject(a),g.applyMatrix4(c.matrixWorldInverse),g.x<r.x&&(r.x=g.x),g.x>s.x&&(s.x=g.x),g.y<r.y&&(r.y=g.y),g.y>s.y&&(s.y=g.y),g.z<r.z&&(r.z=g.z),g.z>s.z&&(s.z=g.z)}c.left=r.x,c.right=s.x,c.top=s.y,c.bottom=r.y,c.updateProjectionMatrix}function j(b){return b.material instanceof a.MeshFaceMaterial?b.material.materials[0]:b.material}var k,l,m,n,o=b.context,p=new a.Frustum,q=new a.Matrix4,r=new a.Vector3,s=new a.Vector3,t=new a.Vector3,u=[],v=a.ShaderLib.depthRGBA,w=a.UniformsUtils.clone(v.uniforms);k=new a.ShaderMaterial({uniforms:w,vertexShader:v.vertexShader,fragmentShader:v.fragmentShader}),l=new a.ShaderMaterial({uniforms:w,vertexShader:v.vertexShader,fragmentShader:v.fragmentShader,morphTargets:!0}),m=new a.ShaderMaterial({uniforms:w,vertexShader:v.vertexShader,fragmentShader:v.fragmentShader,skinning:!0}),n=new a.ShaderMaterial({uniforms:w,vertexShader:v.vertexShader,fragmentShader:v.fragmentShader,morphTargets:!0,skinning:!0}),k._shadowPass=!0,l._shadowPass=!0,m._shadowPass=!0,n._shadowPass=!0,this.render=function(d,r){if(b.shadowMapEnabled!==!1){var s,v,w,x,y,z,A,B,C,D,E,F,G,H=[],I=0,J=null;for(o.clearColor(1,1,1,1),o.disable(o.BLEND),o.enable(o.CULL_FACE),o.frontFace(o.CCW),b.shadowMapCullFace===a.CullFaceFront?o.cullFace(o.FRONT):o.cullFace(o.BACK),b.state.setDepthTest(!0),s=0,v=c.length;v>s;s++)if(G=c[s],G.castShadow)if(G instanceof a.DirectionalLight&&G.shadowCascade)for(y=0;y<G.shadowCascadeCount;y++){var K;if(G.shadowCascadeArray[y])K=G.shadowCascadeArray[y];else{K=g(G,y),K.originalCamera=r;var L=new a.Gyroscope;L.position.copy(G.shadowCascadeOffset),L.add(K),L.add(K.target),r.add(L),G.shadowCascadeArray[y]=K}h(G,y),H[I]=K,I++}else H[I]=G,I++;for(s=0,v=H.length;v>s;s++){if(G=H[s],!G.shadowMap){var M=a.LinearFilter;b.shadowMapType===a.PCFSoftShadowMap&&(M=a.NearestFilter);var N={minFilter:M,magFilter:M,format:a.RGBAFormat};G.shadowMap=new a.WebGLRenderTarget(G.shadowMapWidth,G.shadowMapHeight,N),G.shadowMapSize=new a.Vector2(G.shadowMapWidth,G.shadowMapHeight),G.shadowMatrix=new a.Matrix4}if(!G.shadowCamera){if(G instanceof a.SpotLight)G.shadowCamera=new a.PerspectiveCamera(G.shadowCameraFov,G.shadowMapWidth/G.shadowMapHeight,G.shadowCameraNear,G.shadowCameraFar);else{if(!(G instanceof a.DirectionalLight)){a.error("THREE.ShadowMapPlugin: Unsupported light type for shadow",G);continue}G.shadowCamera=new a.OrthographicCamera(G.shadowCameraLeft,G.shadowCameraRight,G.shadowCameraTop,G.shadowCameraBottom,G.shadowCameraNear,G.shadowCameraFar)}d.add(G.shadowCamera),d.autoUpdate===!0&&d.updateMatrixWorld}G.shadowCameraVisible&&!G.cameraHelper&&(G.cameraHelper=new a.CameraHelper(G.shadowCamera),d.add(G.cameraHelper)),G.isVirtual&&K.originalCamera==r&&i(r,G),z=G.shadowMap,A=G.shadowMatrix,B=G.shadowCamera,B.position.setFromMatrixPosition(G.matrixWorld),t.setFromMatrixPosition(G.target.matrixWorld),B.lookAt(t),B.updateMatrixWorld,B.matrixWorldInverse.getInverse(B.matrixWorld),G.cameraHelper&&(G.cameraHelper.visible=G.shadowCameraVisible),G.shadowCameraVisible&&G.cameraHelper.update,A.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),A.multiply(B.projectionMatrix),A.multiply(B.matrixWorldInverse),q.multiplyMatrices(B.projectionMatrix,B.matrixWorldInverse),p.setFromMatrix(q),b.setRenderTarget(z),b.clear,u.length=0,f(d,d,B);var O,P,Q;for(w=0,x=u.length;x>w;w++)E=u[w],F=E.object,C=E.buffer,O=j(F),P=void 0!==F.geometry.morphTargets&&F.geometry.morphTargets.length>0&&O.morphTargets,Q=F instanceof a.SkinnedMesh&&O.skinning,D=F.customDepthMaterial?F.customDepthMaterial:Q?P?n:m:P?l:k,b.setMaterialFaces(O),C instanceof a.BufferGeometry?b.renderBufferDirect(B,c,J,D,C,F):b.renderBuffer(B,c,J,D,C,F);for(w=0,x=e.length;x>w;w++)E=e[w],F=E.object,F.visible&&F.castShadow&&(F._modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,F.matrixWorld),b.renderImmediateObject(B,c,J,k,F))}var R=b.getClearColor,S=b.getClearAlpha;o.clearColor(R.r,R.g,R.b,S),o.enable(o.BLEND),b.shadowMapCullFace===a.CullFaceFront&&o.cullFace(o.BACK),b.resetGLState}}},a.SpritePlugin=function(b,c){function d{var a=l.createProgram,c=l.createShader(l.VERTEX_SHADER),d=l.createShader(l.FRAGMENT_SHADER);return l.shaderSource(c,["precision "+b.getPrecision+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),l.shaderSource(d,["precision "+b.getPrecision+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","float fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),l.compileShader(c),l.compileShader(d),l.attachShader(a,c),l.attachShader(a,d),l.linkProgram(a),a}function e(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var f,g,h,i,j,k,l=b.context,m=new a.Vector3,n=new a.Quaternion,o=new a.Vector3,p=function{var b=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),c=new Uint16Array([0,1,2,0,2,3]);f=l.createBuffer,g=l.createBuffer,l.bindBuffer(l.ARRAY_BUFFER,f),l.bufferData(l.ARRAY_BUFFER,b,l.STATIC_DRAW),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,g),l.bufferData(l.ELEMENT_ARRAY_BUFFER,c,l.STATIC_DRAW),h=d,i={position:l.getAttribLocation(h,"position"),uv:l.getAttribLocation(h,"uv")},j={uvOffset:l.getUniformLocation(h,"uvOffset"),uvScale:l.getUniformLocation(h,"uvScale"),rotation:l.getUniformLocation(h,"rotation"),scale:l.getUniformLocation(h,"scale"),color:l.getUniformLocation(h,"color"),map:l.getUniformLocation(h,"map"),opacity:l.getUniformLocation(h,"opacity"),modelViewMatrix:l.getUniformLocation(h,"modelViewMatrix"),projectionMatrix:l.getUniformLocation(h,"projectionMatrix"),fogType:l.getUniformLocation(h,"fogType"),fogDensity:l.getUniformLocation(h,"fogDensity"),fogNear:l.getUniformLocation(h,"fogNear"),fogFar:l.getUniformLocation(h,"fogFar"),fogColor:l.getUniformLocation(h,"fogColor"),alphaTest:l.getUniformLocation(h,"alphaTest")};var e=document.createElement("canvas");e.width=8,e.height=8;var m=e.getContext("2d");m.fillStyle="white",m.fillRect(0,0,8,8),k=new a.Texture(e),k.needsUpdate=!0};this.render=function(d,q){if(0!==c.length){void 0===h&&p,l.useProgram(h),l.enableVertexAttribArray(i.position),l.enableVertexAttribArray(i.uv),l.disable(l.CULL_FACE),l.enable(l.BLEND),l.bindBuffer(l.ARRAY_BUFFER,f),l.vertexAttribPointer(i.position,2,l.FLOAT,!1,16,0),l.vertexAttribPointer(i.uv,2,l.FLOAT,!1,16,8),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,g),l.uniformMatrix4fv(j.projectionMatrix,!1,q.projectionMatrix.elements),l.activeTexture(l.TEXTURE0),l.uniform1i(j.map,0);var r=0,s=0,t=d.fog;t?(l.uniform3f(j.fogColor,t.color.r,t.color.g,t.color.b),t instanceof a.Fog?(l.uniform1f(j.fogNear,t.near),l.uniform1f(j.fogFar,t.far),l.uniform1i(j.fogType,1),r=1,s=1):t instanceof a.FogExp2&&(l.uniform1f(j.fogDensity,t.density),l.uniform1i(j.fogType,2),r=2,s=2)):(l.uniform1i(j.fogType,0),r=0,s=0);for(var u=0,v=c.length;v>u;u++){var w=c[u];w._modelViewMatrix.multiplyMatrices(q.matrixWorldInverse,w.matrixWorld),w.z=-w._modelViewMatrix.elements[14]}c.sort(e);for(var x=[],u=0,v=c.length;v>u;u++){var w=c[u],y=w.material;l.uniform1f(j.alphaTest,y.alphaTest),l.uniformMatrix4fv(j.modelViewMatrix,!1,w._modelViewMatrix.elements),w.matrixWorld.decompose(m,n,o),x[0]=o.x,x[1]=o.y;var z=0;d.fog&&y.fog&&(z=s),r!==z&&(l.uniform1i(j.fogType,z),r=z),null!==y.map?(l.uniform2f(j.uvOffset,y.map.offset.x,y.map.offset.y),l.uniform2f(j.uvScale,y.map.repeat.x,y.map.repeat.y)):(l.uniform2f(j.uvOffset,0,0),l.uniform2f(j.uvScale,1,1)),l.uniform1f(j.opacity,y.opacity),l.uniform3f(j.color,y.color.r,y.color.g,y.color.b),l.uniform1f(j.rotation,y.rotation),l.uniform2fv(j.scale,x),b.state.setBlending(y.blending,y.blendEquation,y.blendSrc,y.blendDst),b.state.setDepthTest(y.depthTest),b.state.setDepthWrite(y.depthWrite),y.map&&y.map.image&&y.map.image.width?b.setTexture(y.map,0):b.setTexture(k,0),l.drawElements(l.TRIANGLES,6,l.UNSIGNED_SHORT,0)}l.enable(l.CULL_FACE),b.resetGLState}}},a.GeometryUtils={merge:function(b,c,d){a.warn("THREE.GeometryUtils: .merge has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var e;c instanceof a.Mesh&&(c.matrixAutoUpdate&&c.updateMatrix,e=c.matrix,c=c.geometry),b.merge(c,e,d)},center:function(b){return a.warn("THREE.GeometryUtils: .center has been moved to Geometry. Use geometry.center instead."),b.center}},a.ImageUtils={crossOrigin:void 0,loadTexture:function(b,c,d,e){var f=new a.ImageLoader;f.crossOrigin=this.crossOrigin;var g=new a.Texture(void 0,c);return f.load(b,function(a){g.image=a,g.needsUpdate=!0,d&&d(g)},void 0,function(a){e&&e(a)}),g.sourceFile=b,g},loadTextureCube:function(b,c,d,e){var f=[],g=new a.ImageLoader;g.crossOrigin=this.crossOrigin;var h=new a.CubeTexture(f,c);h.flipY=!1;for(var i=0,j=function(a){g.load(b[a],function(b){h.images[a]=b,i+=1,6===i&&(h.needsUpdate=!0,d&&d(h))},void 0,e)},k=0,l=b.length;l>k;++k)j(k);return h},loadCompressedTexture:function{a.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function{a.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},getNormalMap:function(a,b){var c=function(a,b){return[a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1]-a[1]*b[0]]; },d=function(a,b){return[a[0]-b[0],a[1]-b[1],a[2]-b[2]]},e=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};b=1|b;var f=a.width,g=a.height,h=document.createElement("canvas");h.width=f,h.height=g;var i=h.getContext("2d");i.drawImage(a,0,0);for(var j=i.getImageData(0,0,f,g).data,k=i.createImageData(f,g),l=k.data,m=0;f>m;m++)for(var n=0;g>n;n++){var o=0>n-1?0:n-1,p=n+1>g-1?g-1:n+1,q=0>m-1?0:m-1,r=m+1>f-1?f-1:m+1,s=[],t=[0,0,j[4*(n*f+m)]/255*b];s.push([-1,0,j[4*(n*f+q)]/255*b]),s.push([-1,-1,j[4*(o*f+q)]/255*b]),s.push([0,-1,j[4*(o*f+m)]/255*b]),s.push([1,-1,j[4*(o*f+r)]/255*b]),s.push([1,0,j[4*(n*f+r)]/255*b]),s.push([1,1,j[4*(p*f+r)]/255*b]),s.push([0,1,j[4*(p*f+m)]/255*b]),s.push([-1,1,j[4*(p*f+q)]/255*b]);for(var u=[],v=s.length,w=0;v>w;w++){var x=s[w],y=s[(w+1)%v];x=d(x,t),y=d(y,t),u.push(e(c(x,y)))}for(var z=[0,0,0],w=0;w<u.length;w++)z[0]+=u[w][0],z[1]+=u[w][1],z[2]+=u[w][2];z[0]/=u.length,z[1]/=u.length,z[2]/=u.length;var A=4*(n*f+m);l[A]=(z[0]+1)/2*255|0,l[A+1]=(z[1]+1)/2*255|0,l[A+2]=255*z[2]|0,l[A+3]=255}return i.putImageData(k,0,0),h},generateDataTexture:function(b,c,d){for(var e=b*c,f=new Uint8Array(3*e),g=Math.floor(255*d.r),h=Math.floor(255*d.g),i=Math.floor(255*d.b),j=0;e>j;j++)f[3*j]=g,f[3*j+1]=h,f[3*j+2]=i;var k=new a.DataTexture(f,b,c,a.RGBFormat);return k.needsUpdate=!0,k}},a.SceneUtils={createMultiMaterialObject:function(b,c){for(var d=new a.Object3D,e=0,f=c.length;f>e;e++)d.add(new a.Mesh(b,c[e]));return d},detach:function(a,b,c){a.applyMatrix(b.matrixWorld),b.remove(a),c.add(a)},attach:function(b,c,d){var e=new a.Matrix4;e.getInverse(d.matrixWorld),b.applyMatrix(e),c.remove(b),d.add(b)}},a.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function{try{return this.faces[this.face][this.weight][this.style]}catch(a){throw"The font "+this.face+" with "+this.weight+" weight and "+this.style+" style is missing."}},loadFace:function(a){var b=a.familyName.toLowerCase,c=this;return c.faces[b]=c.faces[b]||{},c.faces[b][a.cssFontWeight]=c.faces[b][a.cssFontWeight]||{},c.faces[b][a.cssFontWeight][a.cssFontStyle]=a,c.faces[b][a.cssFontWeight][a.cssFontStyle]=a,a},drawText:function(b){var c,d=this.getFace,e=this.size/d.resolution,f=0,g=String(b).split(""),h=g.length,i=[];for(c=0;h>c;c++){var j=new a.Path,k=this.extractGlyphPoints(g[c],d,e,f,j);f+=k.offset,i.push(k.path)}var l=f/2;return{paths:i,offset:l}},extractGlyphPoints:function(b,c,d,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z=[],A=c.glyphs[b]||c.glyphs["?"];if(A){if(A.o)for(j=A._cachedOutline||(A._cachedOutline=A.o.split(" ")),l=j.length,m=d,n=d,g=0;l>g;)switch(k=j[g++]){case"m":o=j[g++]*m+e,p=j[g++]*n,f.moveTo(o,p);break;case"l":o=j[g++]*m+e,p=j[g++]*n,f.lineTo(o,p);break;case"q":if(q=j[g++]*m+e,r=j[g++]*n,u=j[g++]*m+e,v=j[g++]*n,f.quadraticCurveTo(u,v,q,r),y=z[z.length-1])for(s=y.x,t=y.y,h=1,i=this.divisions;i>=h;h++){var B=h/i;a.Shape.Utils.b2(B,s,u,q),a.Shape.Utils.b2(B,t,v,r)}break;case"b":if(q=j[g++]*m+e,r=j[g++]*n,u=j[g++]*m+e,v=j[g++]*n,w=j[g++]*m+e,x=j[g++]*n,f.bezierCurveTo(u,v,w,x,q,r),y=z[z.length-1])for(s=y.x,t=y.y,h=1,i=this.divisions;i>=h;h++){var B=h/i;a.Shape.Utils.b3(B,s,u,w,q),a.Shape.Utils.b3(B,t,v,x,r)}}return{offset:A.ha*d,path:f}}}},a.FontUtils.generateShapes=function(b,c){c=c||{};var d=void 0!==c.size?c.size:100,e=void 0!==c.curveSegments?c.curveSegments:4,f=void 0!==c.font?c.font:"helvetiker",g=void 0!==c.weight?c.weight:"normal",h=void 0!==c.style?c.style:"normal";a.FontUtils.size=d,a.FontUtils.divisions=e,a.FontUtils.face=f,a.FontUtils.weight=g,a.FontUtils.style=h;for(var i=a.FontUtils.drawText(b),j=i.paths,k=[],l=0,m=j.length;m>l;l++)Array.prototype.push.apply(k,j[l].toShapes);return k},function(b){var c=1e-10,d=function(b,c){var d=b.length;if(3>d)return null;var g,h,i,j=[],k=[],l=[];if(e(b)>0)for(h=0;d>h;h++)k[h]=h;else for(h=0;d>h;h++)k[h]=d-1-h;var m=d,n=2*m;for(h=m-1;m>2;){if(n--<=0)return a.warn("THREE.FontUtils: Warning, unable to triangulate polygon! in Triangulate.process"),c?l:j;if(g=h,g>=m&&(g=0),h=g+1,h>=m&&(h=0),i=h+1,i>=m&&(i=0),f(b,g,h,i,m,k)){var o,p,q,r,s;for(o=k[g],p=k[h],q=k[i],j.push([b[o],b[p],b[q]]),l.push([k[g],k[h],k[i]]),r=h,s=h+1;m>s;r++,s++)k[r]=k[s];m--,n=2*m}}return c?l:j},e=function(a){for(var b=a.length,c=0,d=b-1,e=0;b>e;d=e++)c+=a[d].x*a[e].y-a[e].x*a[d].y;return.5*c},f=function(a,b,d,e,f,g){var h,i,j,k,l,m,n,o,p;if(i=a[g[b]].x,j=a[g[b]].y,k=a[g[d]].x,l=a[g[d]].y,m=a[g[e]].x,n=a[g[e]].y,c>(k-i)*(n-j)-(l-j)*(m-i))return!1;var q,r,s,t,u,v,w,x,y,z,A,B,C,D,E;for(q=m-k,r=n-l,s=i-m,t=j-n,u=k-i,v=l-j,h=0;f>h;h++)if(o=a[g[h]].x,p=a[g[h]].y,!(o===i&&p===j||o===k&&p===l||o===m&&p===n)&&(w=o-i,x=p-j,y=o-k,z=p-l,A=o-m,B=p-n,E=q*z-r*y,C=u*x-v*w,D=s*B-t*A,E>=-c&&D>=-c&&C>=-c))return!1;return!0};return b.Triangulate=d,b.Triangulate.area=e,b}(a.FontUtils),self._typeface_js={faces:a.FontUtils.faces,loadFace:a.FontUtils.loadFace},a.typeface_js=self._typeface_js,a.Audio=function(b){a.Object3D.call(this),this.type="Audio",this.context=b.context,this.source=this.context.createBufferSource,this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain,this.gain.connect(this.context.destination),this.panner=this.context.createPanner,this.panner.connect(this.gain),this.autoplay=!1,this.startTime=0,this.isPlaying=!1},a.Audio.prototype=Object.create(a.Object3D.prototype),a.Audio.prototype.constructor=a.Audio,a.Audio.prototype.load=function(a){var b=this,c=new XMLHttpRequest;return c.open("GET",a,!0),c.responseType="arraybuffer",c.onload=function(a){b.context.decodeAudioData(this.response,function(a){b.source.buffer=a,b.autoplay&&b.play})},c.send,this},a.Audio.prototype.play=function{if(this.isPlaying===!0)return void a.warn("THREE.Audio: Audio is already playing.");var b=this.context.createBufferSource;b.buffer=this.source.buffer,b.loop=this.source.loop,b.onended=this.source.onended,b.connect(this.panner),b.start(0,this.startTime),this.isPlaying=!0,this.source=b},a.Audio.prototype.pause=function{this.source.stop,this.startTime=this.context.currentTime},a.Audio.prototype.stop=function{this.source.stop,this.startTime=0},a.Audio.prototype.onEnded=function{this.isPlaying=!1},a.Audio.prototype.setLoop=function(a){this.source.loop=a},a.Audio.prototype.setRefDistance=function(a){this.panner.refDistance=a},a.Audio.prototype.setRolloffFactor=function(a){this.panner.rolloffFactor=a},a.Audio.prototype.setVolume=function(a){this.gain.gain.value=a},a.Audio.prototype.updateMatrixWorld=function{var b=new a.Vector3;return function(c){a.Object3D.prototype.updateMatrixWorld.call(this,c),b.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(b.x,b.y,b.z)}},a.AudioListener=function{a.Object3D.call(this),this.type="AudioListener",this.context=new(window.AudioContext||window.webkitAudioContext)},a.AudioListener.prototype=Object.create(a.Object3D.prototype),a.AudioListener.prototype.constructor=a.AudioListener,a.AudioListener.prototype.updateMatrixWorld=function{var b=new a.Vector3,c=new a.Quaternion,d=new a.Vector3,e=new a.Vector3,f=new a.Vector3,g=new a.Vector3;return function(h){a.Object3D.prototype.updateMatrixWorld.call(this,h);var i=this.context.listener,j=this.up;this.matrixWorld.decompose(b,c,d),e.set(0,0,-1).applyQuaternion(c),f.subVectors(b,g),i.setPosition(b.x,b.y,b.z),i.setOrientation(e.x,e.y,e.z,j.x,j.y,j.z),i.setVelocity(f.x,f.y,f.z),g.copy(b)}},a.Curve=function{},a.Curve.prototype.getPoint=function(b){return a.warn("THREE.Curve: Warning, getPoint not implemented!"),null},a.Curve.prototype.getPointAt=function(a){var b=this.getUtoTmapping(a);return this.getPoint(b)},a.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;a>=b;b++)c.push(this.getPoint(b/a));return c},a.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;a>=b;b++)c.push(this.getPointAt(b/a));return c},a.Curve.prototype.getLength=function{var a=this.getLengths;return a[a.length-1]},a.Curve.prototype.getLengths=function(a){if(a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b,c,d=[],e=this.getPoint(0),f=0;for(d.push(0),c=1;a>=c;c++)b=this.getPoint(c/a),f+=b.distanceTo(e),d.push(f),e=b;return this.cacheArcLengths=d,d},a.Curve.prototype.updateArcLengths=function{this.needsUpdate=!0,this.getLengths},a.Curve.prototype.getUtoTmapping=function(a,b){var c,d=this.getLengths,e=0,f=d.length;c=b?b:a*d[f-1];for(var g,h=0,i=f-1;i>=h;)if(e=Math.floor(h+(i-h)/2),g=d[e]-c,0>g)h=e+1;else{if(!(g>0)){i=e;break}i=e-1}if(e=i,d[e]==c){var j=e/(f-1);return j}var k=d[e],l=d[e+1],m=l-k,n=(c-k)/m,j=(e+n)/(f-1);return j},a.Curve.prototype.getTangent=function(a){var b=1e-4,c=a-b,d=a+b;0>c&&(c=0),d>1&&(d=1);var e=this.getPoint(c),f=this.getPoint(d),g=f.clone.sub(e);return g.normalize},a.Curve.prototype.getTangentAt=function(a){var b=this.getUtoTmapping(a);return this.getTangent(b)},a.Curve.Utils={tangentQuadraticBezier:function(a,b,c,d){return 2*(1-a)*(c-b)+2*a*(d-c)},tangentCubicBezier:function(a,b,c,d,e){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*e},tangentSpline:function(a,b,c,d,e){var f=6*a*a-6*a,g=3*a*a-4*a+1,h=-6*a*a+6*a,i=3*a*a-2*a;return f+g+h+i},interpolate:function(a,b,c,d,e){var f=.5*(c-a),g=.5*(d-b),h=e*e,i=e*h;return(2*b-2*c+f+g)*i+(-3*b+3*c-2*f-g)*h+f*e+b}},a.Curve.create=function(b,c){return b.prototype=Object.create(a.Curve.prototype),b.prototype.constructor=b,b.prototype.getPoint=c,b},a.CurvePath=function{this.curves=[],this.bends=[],this.autoClose=!1},a.CurvePath.prototype=Object.create(a.Curve.prototype),a.CurvePath.prototype.constructor=a.CurvePath,a.CurvePath.prototype.add=function(a){this.curves.push(a)},a.CurvePath.prototype.checkConnection=function{},a.CurvePath.prototype.closePath=function{var b=this.curves[0].getPoint(0),c=this.curves[this.curves.length-1].getPoint(1);b.equals(c)||this.curves.push(new a.LineCurve(c,b))},a.CurvePath.prototype.getPoint=function(a){for(var b,c,d=a*this.getLength,e=this.getCurveLengths,f=0;f<e.length;){if(e[f]>=d){b=e[f]-d,c=this.curves[f];var g=1-b/c.getLength;return c.getPointAt(g)}f++}return null},a.CurvePath.prototype.getLength=function{var a=this.getCurveLengths;return a[a.length-1]},a.CurvePath.prototype.getCurveLengths=function{if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a,b=[],c=0,d=this.curves.length;for(a=0;d>a;a++)c+=this.curves[a].getLength,b.push(c);return this.cacheLengths=b,b},a.CurvePath.prototype.getBoundingBox=function{var b,c,d,e,f,g,h=this.getPoints;b=c=Number.NEGATIVE_INFINITY,e=f=Number.POSITIVE_INFINITY;var i,j,k,l,m=h[0]instanceof a.Vector3;for(l=m?new a.Vector3:new a.Vector2,j=0,k=h.length;k>j;j++)i=h[j],i.x>b?b=i.x:i.x<e&&(e=i.x),i.y>c?c=i.y:i.y<f&&(f=i.y),m&&(i.z>d?d=i.z:i.z<g&&(g=i.z)),l.add(i);var n={minX:e,minY:f,maxX:b,maxY:c};return m&&(n.maxZ=d,n.minZ=g),n},a.CurvePath.prototype.createPointsGeometry=function(a){var b=this.getPoints(a,!0);return this.createGeometry(b)},a.CurvePath.prototype.createSpacedPointsGeometry=function(a){var b=this.getSpacedPoints(a,!0);return this.createGeometry(b)},a.CurvePath.prototype.createGeometry=function(b){for(var c=new a.Geometry,d=0;d<b.length;d++)c.vertices.push(new a.Vector3(b[d].x,b[d].y,b[d].z||0));return c},a.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)},a.CurvePath.prototype.getTransformedPoints=function(a,b){var c,d,e=this.getPoints(a);for(b||(b=this.bends),c=0,d=b.length;d>c;c++)e=this.getWrapPoints(e,b[c]);return e},a.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c,d,e=this.getSpacedPoints(a);for(b||(b=this.bends),c=0,d=b.length;d>c;c++)e=this.getWrapPoints(e,b[c]);return e},a.CurvePath.prototype.getWrapPoints=function(a,b){var c,d,e,f,g,h,i=this.getBoundingBox;for(c=0,d=a.length;d>c;c++){e=a[c],f=e.x,g=e.y,h=f/i.maxX,h=b.getUtoTmapping(h,f);var j=b.getPoint(h),k=b.getTangent(h);k.set(-k.y,k.x).multiplyScalar(g),e.x=j.x+k.x,e.y=j.y+k.y}return a},a.Gyroscope=function{a.Object3D.call(this)},a.Gyroscope.prototype=Object.create(a.Object3D.prototype),a.Gyroscope.prototype.constructor=a.Gyroscope,a.Gyroscope.prototype.updateMatrixWorld=function{var b=new a.Vector3,c=new a.Quaternion,d=new a.Vector3,e=new a.Vector3,f=new a.Quaternion,g=new a.Vector3;return function(a){this.matrixAutoUpdate&&this.updateMatrix,(this.matrixWorldNeedsUpdate||a)&&(this.parent?(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(e,f,g),this.matrix.decompose(b,c,d),this.matrixWorld.compose(e,c,g)):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0);for(var h=0,i=this.children.length;i>h;h++)this.children[h].updateMatrixWorld(a)}},a.Path=function(b){a.CurvePath.call(this),this.actions=[],b&&this.fromPoints(b)},a.Path.prototype=Object.create(a.CurvePath.prototype),a.Path.prototype.constructor=a.Path,a.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc",ELLIPSE:"ellipse"},a.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);for(var b=1,c=a.length;c>b;b++)this.lineTo(a[b].x,a[b].y)},a.Path.prototype.moveTo=function(b,c){var d=Array.prototype.slice.call(arguments);this.actions.push({action:a.PathActions.MOVE_TO,args:d})},a.Path.prototype.lineTo=function(b,c){var d=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args,f=e[e.length-2],g=e[e.length-1],h=new a.LineCurve(new a.Vector2(f,g),new a.Vector2(b,c));this.curves.push(h),this.actions.push({action:a.PathActions.LINE_TO,args:d})},a.Path.prototype.quadraticCurveTo=function(b,c,d,e){var f=Array.prototype.slice.call(arguments),g=this.actions[this.actions.length-1].args,h=g[g.length-2],i=g[g.length-1],j=new a.QuadraticBezierCurve(new a.Vector2(h,i),new a.Vector2(b,c),new a.Vector2(d,e));this.curves.push(j),this.actions.push({action:a.PathActions.QUADRATIC_CURVE_TO,args:f})},a.Path.prototype.bezierCurveTo=function(b,c,d,e,f,g){var h=Array.prototype.slice.call(arguments),i=this.actions[this.actions.length-1].args,j=i[i.length-2],k=i[i.length-1],l=new a.CubicBezierCurve(new a.Vector2(j,k),new a.Vector2(b,c),new a.Vector2(d,e),new a.Vector2(f,g));this.curves.push(l),this.actions.push({action:a.PathActions.BEZIER_CURVE_TO,args:h})},a.Path.prototype.splineThru=function(b){var c=Array.prototype.slice.call(arguments),d=this.actions[this.actions.length-1].args,e=d[d.length-2],f=d[d.length-1],g=[new a.Vector2(e,f)];Array.prototype.push.apply(g,b);var h=new a.SplineCurve(g);this.curves.push(h),this.actions.push({action:a.PathActions.CSPLINE_THRU,args:c})},a.Path.prototype.arc=function(a,b,c,d,e,f){var g=this.actions[this.actions.length-1].args,h=g[g.length-2],i=g[g.length-1];this.absarc(a+h,b+i,c,d,e,f)},a.Path.prototype.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)},a.Path.prototype.ellipse=function(a,b,c,d,e,f,g){var h=this.actions[this.actions.length-1].args,i=h[h.length-2],j=h[h.length-1];this.absellipse(a+i,b+j,c,d,e,f,g)},a.Path.prototype.absellipse=function(b,c,d,e,f,g,h){var i=Array.prototype.slice.call(arguments),j=new a.EllipseCurve(b,c,d,e,f,g,h);this.curves.push(j);var k=j.getPoint(1);i.push(k.x),i.push(k.y),this.actions.push({action:a.PathActions.ELLIPSE,args:i})},a.Path.prototype.getSpacedPoints=function(a,b){a||(a=40);for(var c=[],d=0;a>d;d++)c.push(this.getPoint(d/a));return c},a.Path.prototype.getPoints=function(b,c){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(b,c);b=b||12;var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v=[];for(d=0,e=this.actions.length;e>d;d++)switch(f=this.actions[d],g=f.action,h=f.args,g){case a.PathActions.MOVE_TO:v.push(new a.Vector2(h[0],h[1]));break;case a.PathActions.LINE_TO:v.push(new a.Vector2(h[0],h[1]));break;case a.PathActions.QUADRATIC_CURVE_TO:for(i=h[2],j=h[3],m=h[0],n=h[1],v.length>0?(q=v[v.length-1],o=q.x,p=q.y):(q=this.actions[d-1].args,o=q[q.length-2],p=q[q.length-1]),r=1;b>=r;r++)s=r/b,t=a.Shape.Utils.b2(s,o,m,i),u=a.Shape.Utils.b2(s,p,n,j),v.push(new a.Vector2(t,u));break;case a.PathActions.BEZIER_CURVE_TO:for(i=h[4],j=h[5],m=h[0],n=h[1],k=h[2],l=h[3],v.length>0?(q=v[v.length-1],o=q.x,p=q.y):(q=this.actions[d-1].args,o=q[q.length-2],p=q[q.length-1]),r=1;b>=r;r++)s=r/b,t=a.Shape.Utils.b3(s,o,m,k,i),u=a.Shape.Utils.b3(s,p,n,l,j),v.push(new a.Vector2(t,u));break;case a.PathActions.CSPLINE_THRU:q=this.actions[d-1].args;var w=new a.Vector2(q[q.length-2],q[q.length-1]),x=[w],y=b*h[0].length;x=x.concat(h[0]);var z=new a.SplineCurve(x);for(r=1;y>=r;r++)v.push(z.getPointAt(r/y));break;case a.PathActions.ARC:var A,B=h[0],C=h[1],D=h[2],E=h[3],F=h[4],G=!!h[5],H=F-E,I=2*b;for(r=1;I>=r;r++)s=r/I,G||(s=1-s),A=E+s*H,t=B+D*Math.cos(A),u=C+D*Math.sin(A),v.push(new a.Vector2(t,u));break;case a.PathActions.ELLIPSE:var A,B=h[0],C=h[1],J=h[2],K=h[3],E=h[4],F=h[5],G=!!h[6],H=F-E,I=2*b;for(r=1;I>=r;r++)s=r/I,G||(s=1-s),A=E+s*H,t=B+J*Math.cos(A),u=C+K*Math.sin(A),v.push(new a.Vector2(t,u))}var L=v[v.length-1],M=1e-10;return Math.abs(L.x-v[0].x)<M&&Math.abs(L.y-v[0].y)<M&&v.splice(v.length-1,1),c&&v.push(v[0]),v},a.Path.prototype.toShapes=function(b,c){function d(b){var c,d,e,f,g,h=[],i=new a.Path;for(c=0,d=b.length;d>c;c++)e=b[c],g=e.args,f=e.action,f==a.PathActions.MOVE_TO&&0!=i.actions.length&&(h.push(i),i=new a.Path),i[f].apply(i,g);return 0!=i.actions.length&&h.push(i),h}function e(b){for(var c=[],d=0,e=b.length;e>d;d++){var f=b[d],g=new a.Shape;g.actions=f.actions,g.curves=f.curves,c.push(g)}return c}function f(a,b){for(var c=1e-10,d=b.length,e=!1,f=d-1,g=0;d>g;f=g++){var h=b[f],i=b[g],j=i.x-h.x,k=i.y-h.y;if(Math.abs(k)>c){if(0>k&&(h=b[g],j=-j,i=b[f],k=-k),a.y<h.y||a.y>i.y)continue;if(a.y==h.y){if(a.x==h.x)return!0}else{var l=k*(a.x-h.x)-j*(a.y-h.y);if(0==l)return!0;if(0>l)continue;e=!e}}else{if(a.y!=h.y)continue;if(i.x<=a.x&&a.x<=h.x||h.x<=a.x&&a.x<=i.x)return!0}}return e}var g=d(this.actions);if(0==g.length)return[];if(c===!0)return e(g);var h,i,j,k=[];if(1==g.length)return i=g[0],j=new a.Shape,j.actions=i.actions,j.curves=i.curves,k.push(j),k;var l=!a.Shape.Utils.isClockWise(g[0].getPoints);l=b?!l:l;var m,n=[],o=[],p=[],q=0;o[q]=void 0,p[q]=[];var r,s;for(r=0,s=g.length;s>r;r++)i=g[r],m=i.getPoints,h=a.Shape.Utils.isClockWise(m),h=b?!h:h,h?(!l&&o[q]&&q++,o[q]={s:new a.Shape,p:m},o[q].s.actions=i.actions,o[q].s.curves=i.curves,l&&q++,p[q]=[]):p[q].push({h:i,p:m[0]});if(!o[0])return e(g);if(o.length>1){for(var t=!1,u=[],v=0,w=o.length;w>v;v++)n[v]=[];for(var v=0,w=o.length;w>v;v++)for(var x=p[v],y=0;y<x.length;y++){for(var z=x[y],A=!0,B=0;B<o.length;B++)f(z.p,o[B].p)&&(v!=B&&u.push({froms:v,tos:B,hole:y}),A?(A=!1,n[B].push(z)):t=!0);A&&n[v].push(z)}u.length>0&&(t||(p=n))}var C,D,E;for(r=0,s=o.length;s>r;r++)for(j=o[r].s,k.push(j),C=p[r],D=0,E=C.length;E>D;D++)j.holes.push(C[D].h);return k},a.Shape=function{a.Path.apply(this,arguments),this.holes=[]},a.Shape.prototype=Object.create(a.Path.prototype),a.Shape.prototype.constructor=a.Shape,a.Shape.prototype.extrude=function(b){var c=new a.ExtrudeGeometry(this,b);return c},a.Shape.prototype.makeGeometry=function(b){var c=new a.ShapeGeometry(this,b);return c},a.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;c>b;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d},a.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;c>b;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d},a.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}},a.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)},a.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}},a.Shape.Utils={triangulateShape:function(b,c){function d(a,b,c){return a.x!=b.x?a.x<b.x?a.x<=c.x&&c.x<=b.x:b.x<=c.x&&c.x<=a.x:a.y<b.y?a.y<=c.y&&c.y<=b.y:b.y<=c.y&&c.y<=a.y}function e(a,b,c,e,f){var g=1e-10,h=b.x-a.x,i=b.y-a.y,j=e.x-c.x,k=e.y-c.y,l=a.x-c.x,m=a.y-c.y,n=i*j-h*k,o=i*l-h*m;if(Math.abs(n)>g){var p;if(n>0){if(0>o||o>n)return[];if(p=k*l-j*m,0>p||p>n)return[]}else{if(o>0||n>o)return[];if(p=k*l-j*m,p>0||n>p)return[]}if(0==p)return!f||0!=o&&o!=n?[a]:[];if(p==n)return!f||0!=o&&o!=n?[b]:[];if(0==o)return[c];if(o==n)return[e];var q=p/n;return[{x:a.x+q*h,y:a.y+q*i}]}if(0!=o||k*l!=j*m)return[];var r=0==h&&0==i,s=0==j&&0==k;if(r&&s)return a.x!=c.x||a.y!=c.y?[]:[a];if(r)return d(c,e,a)?[a]:[];if(s)return d(a,b,c)?[c]:[];var t,u,v,w,x,y,z,A;return 0!=h?(a.x<b.x?(t=a,v=a.x,u=b,w=b.x):(t=b,v=b.x,u=a,w=a.x),c.x<e.x?(x=c,z=c.x,y=e,A=e.x):(x=e,z=e.x,y=c,A=c.x)):(a.y<b.y?(t=a,v=a.y,u=b,w=b.y):(t=b,v=b.y,u=a,w=a.y),c.y<e.y?(x=c,z=c.y,y=e,A=e.y):(x=e,z=e.y,y=c,A=c.y)),z>=v?z>w?[]:w==z?f?[]:[x]:A>=w?[x,u]:[x,y]:v>A?[]:v==A?f?[]:[t]:A>=w?[t,u]:[t,y]}function f(a,b,c,d){var e=1e-10,f=b.x-a.x,g=b.y-a.y,h=c.x-a.x,i=c.y-a.y,j=d.x-a.x,k=d.y-a.y,l=f*i-g*h,m=f*k-g*j;if(Math.abs(l)>e){var n=j*i-k*h;return l>0?m>=0&&n>=0:m>=0||n>=0}return m>0}function g(a,b){function c(a,b){var c=s.length-1,d=a-1;0>d&&(d=c);var e=a+1;e>c&&(e=0);var g=f(s[a],s[d],s[e],h[b]);if(!g)return!1;var i=h.length-1,j=b-1;0>j&&(j=i);var k=b+1;return k>i&&(k=0),g=f(h[b],h[j],h[k],s[a]),!!g}function d(a,b){var c,d,f;for(c=0;c<s.length;c++)if(d=c+1,d%=s.length,f=e(a,b,s[c],s[d],!0),f.length>0)return!0;return!1}function g(a,c){var d,f,g,h,i;for(d=0;d<t.length;d++)for(f=b[t[d]],g=0;g<f.length;g++)if(h=g+1,h%=f.length,i=e(a,c,f[g],f[h],!0),i.length>0)return!0;return!1}for(var h,i,j,k,l,m,n,o,p,q,r,s=a.concat,t=[],u=[],v=0,w=b.length;w>v;v++)t.push(v);for(var x=0,y=2*t.length;t.length>0;){if(y--,0>y){console.log("Infinite Loop! Holes left:"+t.length+", Probably Hole outside Shape!");break}for(j=x;j<s.length;j++){k=s[j],i=-1;for(var v=0;v<t.length;v++)if(m=t[v],n=k.x+":"+k.y+":"+m,void 0===u[n]){h=b[m];for(var z=0;z<h.length;z++)if(l=h[z],c(j,z)&&!d(k,l)&&!g(k,l)){i=z,t.splice(v,1),o=s.slice(0,j+1),p=s.slice(j),q=h.slice(i),r=h.slice(0,i+1),s=o.concat(q).concat(r).concat(p),x=j;break}if(i>=0)break;u[n]=!0}if(i>=0)break}}return s}for(var h,i,j,k,l,m,n={},o=b.concat,p=0,q=c.length;q>p;p++)Array.prototype.push.apply(o,c[p]);for(h=0,i=o.length;i>h;h++)l=o[h].x+":"+o[h].y,void 0!==n[l]&&a.warn("THREE.Shape: Duplicate point",l),n[l]=h;var r=g(b,c),s=a.FontUtils.Triangulate(r,!1);for(h=0,i=s.length;i>h;h++)for(k=s[h],j=0;3>j;j++)l=k[j].x+":"+k[j].y,m=n[l],void 0!==m&&(k[j]=m);return s.concat},isClockWise:function(b){return a.FontUtils.Triangulate.area(b)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){var c=1-a;return 3*c*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+this.b3p3(a,e)}},a.LineCurve=function(a,b){this.v1=a,this.v2=b},a.LineCurve.prototype=Object.create(a.Curve.prototype),a.LineCurve.prototype.constructor=a.LineCurve,a.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone.sub(this.v1);return b.multiplyScalar(a).add(this.v1),b},a.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)},a.LineCurve.prototype.getTangent=function(a){var b=this.v2.clone.sub(this.v1);return b.normalize},a.QuadraticBezierCurve=function(a,b,c){this.v0=a,this.v1=b,this.v2=c},a.QuadraticBezierCurve.prototype=Object.create(a.Curve.prototype),a.QuadraticBezierCurve.prototype.constructor=a.QuadraticBezierCurve,a.QuadraticBezierCurve.prototype.getPoint=function(b){var c=new a.Vector2;return c.x=a.Shape.Utils.b2(b,this.v0.x,this.v1.x,this.v2.x),c.y=a.Shape.Utils.b2(b,this.v0.y,this.v1.y,this.v2.y),c},a.QuadraticBezierCurve.prototype.getTangent=function(b){var c=new a.Vector2;return c.x=a.Curve.Utils.tangentQuadraticBezier(b,this.v0.x,this.v1.x,this.v2.x),c.y=a.Curve.Utils.tangentQuadraticBezier(b,this.v0.y,this.v1.y,this.v2.y),c.normalize},a.CubicBezierCurve=function(a,b,c,d){this.v0=a,this.v1=b,this.v2=c,this.v3=d},a.CubicBezierCurve.prototype=Object.create(a.Curve.prototype),a.CubicBezierCurve.prototype.constructor=a.CubicBezierCurve,a.CubicBezierCurve.prototype.getPoint=function(b){var c,d;return c=a.Shape.Utils.b3(b,this.v0.x,this.v1.x,this.v2.x,this.v3.x),d=a.Shape.Utils.b3(b,this.v0.y,this.v1.y,this.v2.y,this.v3.y),new a.Vector2(c,d)},a.CubicBezierCurve.prototype.getTangent=function(b){var c,d;c=a.Curve.Utils.tangentCubicBezier(b,this.v0.x,this.v1.x,this.v2.x,this.v3.x),d=a.Curve.Utils.tangentCubicBezier(b,this.v0.y,this.v1.y,this.v2.y,this.v3.y);var e=new a.Vector2(c,d);return e.normalize,e},a.SplineCurve=function(a){this.points=void 0==a?[]:a},a.SplineCurve.prototype=Object.create(a.Curve.prototype),a.SplineCurve.prototype.constructor=a.SplineCurve,a.SplineCurve.prototype.getPoint=function(b){var c=this.points,d=(c.length-1)*b,e=Math.floor(d),f=d-e,g=c[0==e?e:e-1],h=c[e],i=c[e>c.length-2?c.length-1:e+1],j=c[e>c.length-3?c.length-1:e+2],k=new a.Vector2;return k.x=a.Curve.Utils.interpolate(g.x,h.x,i.x,j.x,f),k.y=a.Curve.Utils.interpolate(g.y,h.y,i.y,j.y,f),k},a.EllipseCurve=function(a,b,c,d,e,f,g){this.aX=a,this.aY=b,this.xRadius=c,this.yRadius=d,this.aStartAngle=e,this.aEndAngle=f,this.aClockwise=g},a.EllipseCurve.prototype=Object.create(a.Curve.prototype),a.EllipseCurve.prototype.constructor=a.EllipseCurve,a.EllipseCurve.prototype.getPoint=function(b){var c=this.aEndAngle-this.aStartAngle;0>c&&(c+=2*Math.PI),c>2*Math.PI&&(c-=2*Math.PI);var d;d=this.aClockwise===!0?this.aEndAngle+(1-b)*(2*Math.PI-c):this.aStartAngle+b*c;var e=new a.Vector2;return e.x=this.aX+this.xRadius*Math.cos(d),e.y=this.aY+this.yRadius*Math.sin(d),e},a.ArcCurve=function(b,c,d,e,f,g){a.EllipseCurve.call(this,b,c,d,d,e,f,g)},a.ArcCurve.prototype=Object.create(a.EllipseCurve.prototype),a.ArcCurve.prototype.constructor=a.ArcCurve,a.LineCurve3=a.Curve.create(function(a,b){this.v1=a,this.v2=b},function(b){var c=new a.Vector3;return c.subVectors(this.v2,this.v1),c.multiplyScalar(b),c.add(this.v1),c}),a.QuadraticBezierCurve3=a.Curve.create(function(a,b,c){this.v0=a,this.v1=b,this.v2=c},function(b){var c=new a.Vector3;return c.x=a.Shape.Utils.b2(b,this.v0.x,this.v1.x,this.v2.x),c.y=a.Shape.Utils.b2(b,this.v0.y,this.v1.y,this.v2.y),c.z=a.Shape.Utils.b2(b,this.v0.z,this.v1.z,this.v2.z),c}),a.CubicBezierCurve3=a.Curve.create(function(a,b,c,d){this.v0=a,this.v1=b,this.v2=c,this.v3=d},function(b){var c=new a.Vector3;return c.x=a.Shape.Utils.b3(b,this.v0.x,this.v1.x,this.v2.x,this.v3.x),c.y=a.Shape.Utils.b3(b,this.v0.y,this.v1.y,this.v2.y,this.v3.y),c.z=a.Shape.Utils.b3(b,this.v0.z,this.v1.z,this.v2.z,this.v3.z),c}),a.SplineCurve3=a.Curve.create(function(a){this.points=void 0==a?[]:a},function(b){var c=this.points,d=(c.length-1)*b,e=Math.floor(d),f=d-e,g=c[0==e?e:e-1],h=c[e],i=c[e>c.length-2?c.length-1:e+1],j=c[e>c.length-3?c.length-1:e+2],k=new a.Vector3;return k.x=a.Curve.Utils.interpolate(g.x,h.x,i.x,j.x,f),k.y=a.Curve.Utils.interpolate(g.y,h.y,i.y,j.y,f),k.z=a.Curve.Utils.interpolate(g.z,h.z,i.z,j.z,f),k}),a.ClosedSplineCurve3=a.Curve.create(function(a){this.points=void 0==a?[]:a},function(b){var c=this.points,d=(c.length-0)*b,e=Math.floor(d),f=d-e;e+=e>0?0:(Math.floor(Math.abs(e)/c.length)+1)*c.length;var g=c[(e-1)%c.length],h=c[e%c.length],i=c[(e+1)%c.length],j=c[(e+2)%c.length],k=new a.Vector3;return k.x=a.Curve.Utils.interpolate(g.x,h.x,i.x,j.x,f),k.y=a.Curve.Utils.interpolate(g.y,h.y,i.y,j.y,f),k.z=a.Curve.Utils.interpolate(g.z,h.z,i.z,j.z,f),k}),a.AnimationHandler={LINEAR:0,CATMULLROM:1,CATMULLROM_FORWARD:2,add:function{a.warn("THREE.AnimationHandler.add has been deprecated.")},get:function{a.warn("THREE.AnimationHandler.get has been deprecated.")},remove:function{a.warn("THREE.AnimationHandler.remove has been deprecated.")},animations:[],init:function(b){if(b.initialized===!0)return b;for(var c=0;c<b.hierarchy.length;c++){for(var d=0;d<b.hierarchy[c].keys.length;d++)if(b.hierarchy[c].keys[d].time<0&&(b.hierarchy[c].keys[d].time=0),void 0!==b.hierarchy[c].keys[d].rot&&!(b.hierarchy[c].keys[d].rot instanceof a.Quaternion)){var e=b.hierarchy[c].keys[d].rot;b.hierarchy[c].keys[d].rot=(new a.Quaternion).fromArray(e)}if(b.hierarchy[c].keys.length&&void 0!==b.hierarchy[c].keys[0].morphTargets){for(var f={},d=0;d<b.hierarchy[c].keys.length;d++)for(var g=0;g<b.hierarchy[c].keys[d].morphTargets.length;g++){var h=b.hierarchy[c].keys[d].morphTargets[g];f[h]=-1}b.hierarchy[c].usedMorphTargets=f;for(var d=0;d<b.hierarchy[c].keys.length;d++){var i={};for(var h in f){for(var g=0;g<b.hierarchy[c].keys[d].morphTargets.length;g++)if(b.hierarchy[c].keys[d].morphTargets[g]===h){i[h]=b.hierarchy[c].keys[d].morphTargetsInfluences[g];break}g===b.hierarchy[c].keys[d].morphTargets.length&&(i[h]=0)}b.hierarchy[c].keys[d].morphTargetsInfluences=i}}for(var d=1;d<b.hierarchy[c].keys.length;d++)b.hierarchy[c].keys[d].time===b.hierarchy[c].keys[d-1].time&&(b.hierarchy[c].keys.splice(d,1),d--);for(var d=0;d<b.hierarchy[c].keys.length;d++)b.hierarchy[c].keys[d].index=d}return b.initialized=!0,b},parse:function(b){var c=function(a,b){b.push(a);for(var d=0;d<a.children.length;d++)c(a.children[d],b)},d=[];if(b instanceof a.SkinnedMesh)for(var e=0;e<b.skeleton.bones.length;e++)d.push(b.skeleton.bones[e]);else c(b,d);return d},play:function(a){-1===this.animations.indexOf(a)&&this.animations.push(a)},stop:function(a){var b=this.animations.indexOf(a);-1!==b&&this.animations.splice(b,1)},update:function(a){for(var b=0;b<this.animations.length;b++)this.animations[b].resetBlendWeights;for(var b=0;b<this.animations.length;b++)this.animations[b].update(a)}},a.Animation=function(b,c){this.root=b,this.data=a.AnimationHandler.init(c),this.hierarchy=a.AnimationHandler.parse(b),this.currentTime=0,this.timeScale=1,this.isPlaying=!1,this.loop=!0,this.weight=0,this.interpolationType=a.AnimationHandler.LINEAR},a.Animation.prototype={constructor:a.Animation,keyTypes:["pos","rot","scl"],play:function(b,c){this.currentTime=void 0!==b?b:0,this.weight=void 0!==c?c:1,this.isPlaying=!0,this.reset,a.AnimationHandler.play(this)},stop:function{this.isPlaying=!1,a.AnimationHandler.stop(this)},reset:function{for(var a=0,b=this.hierarchy.length;b>a;a++){var c=this.hierarchy[a];void 0===c.animationCache&&(c.animationCache={animations:{},blending:{positionWeight:0,quaternionWeight:0,scaleWeight:0}});var d=this.data.name,e=c.animationCache.animations,f=e[d];void 0===f&&(f={prevKey:{pos:0,rot:0,scl:0},nextKey:{pos:0,rot:0,scl:0},originalMatrix:c.matrix},e[d]=f);for(var g=0;3>g;g++){for(var h=this.keyTypes[g],i=this.data.hierarchy[a].keys[0],j=this.getNextKeyWith(h,a,1);j.time<this.currentTime&&j.index>i.index;)i=j,j=this.getNextKeyWith(h,a,j.index+1);f.prevKey[h]=i,f.nextKey[h]=j}}},resetBlendWeights:function{for(var a=0,b=this.hierarchy.length;b>a;a++){var c=this.hierarchy[a],d=c.animationCache;if(void 0!==d){var e=d.blending;e.positionWeight=0,e.quaternionWeight=0,e.scaleWeight=0}}},update:function{var b=[],c=new a.Vector3,d=new a.Vector3,e=new a.Quaternion,f=function(a,b){var c,d,e,f,h,i,j,k,l,m=[],n=[];return c=(a.length-1)*b,d=Math.floor(c),e=c-d,m[0]=0===d?d:d-1,m[1]=d,m[2]=d>a.length-2?d:d+1,m[3]=d>a.length-3?d:d+2,i=a[m[0]],j=a[m[1]],k=a[m[2]],l=a[m[3]],f=e*e,h=e*f,n[0]=g(i[0],j[0],k[0],l[0],e,f,h),n[1]=g(i[1],j[1],k[1],l[1],e,f,h),n[2]=g(i[2],j[2],k[2],l[2],e,f,h),n},g=function(a,b,c,d,e,f,g){var h=.5*(c-a),i=.5*(d-b);return(2*(b-c)+h+i)*g+(-3*(b-c)-2*h-i)*f+h*e+b};return function(g){if(this.isPlaying!==!1&&(this.currentTime+=g*this.timeScale,0!==this.weight)){var h=this.data.length;(this.currentTime>h||this.currentTime<0)&&(this.loop?(this.currentTime%=h, this.currentTime<0&&(this.currentTime+=h),this.reset):this.stop);for(var i=0,j=this.hierarchy.length;j>i;i++)for(var k=this.hierarchy[i],l=k.animationCache.animations[this.data.name],m=k.animationCache.blending,n=0;3>n;n++){var o=this.keyTypes[n],p=l.prevKey[o],q=l.nextKey[o];if(this.timeScale>0&&q.time<=this.currentTime||this.timeScale<0&&p.time>=this.currentTime){for(p=this.data.hierarchy[i].keys[0],q=this.getNextKeyWith(o,i,1);q.time<this.currentTime&&q.index>p.index;)p=q,q=this.getNextKeyWith(o,i,q.index+1);l.prevKey[o]=p,l.nextKey[o]=q}var r=(this.currentTime-p.time)/(q.time-p.time),s=p[o],t=q[o];if(0>r&&(r=0),r>1&&(r=1),"pos"===o){if(this.interpolationType===a.AnimationHandler.LINEAR){d.x=s[0]+(t[0]-s[0])*r,d.y=s[1]+(t[1]-s[1])*r,d.z=s[2]+(t[2]-s[2])*r;var u=this.weight/(this.weight+m.positionWeight);k.position.lerp(d,u),m.positionWeight+=this.weight}else if(this.interpolationType===a.AnimationHandler.CATMULLROM||this.interpolationType===a.AnimationHandler.CATMULLROM_FORWARD){b[0]=this.getPrevKeyWith("pos",i,p.index-1).pos,b[1]=s,b[2]=t,b[3]=this.getNextKeyWith("pos",i,q.index+1).pos,r=.33*r+.33;var v=f(b,r),u=this.weight/(this.weight+m.positionWeight);m.positionWeight+=this.weight;var w=k.position;if(w.x=w.x+(v[0]-w.x)*u,w.y=w.y+(v[1]-w.y)*u,w.z=w.z+(v[2]-w.z)*u,this.interpolationType===a.AnimationHandler.CATMULLROM_FORWARD){var x=f(b,1.01*r);c.set(x[0],x[1],x[2]),c.sub(w),c.y=0,c.normalize;var y=Math.atan2(c.x,c.z);k.rotation.set(0,y,0)}}}else if("rot"===o)if(a.Quaternion.slerp(s,t,e,r),0===m.quaternionWeight)k.quaternion.copy(e),m.quaternionWeight=this.weight;else{var u=this.weight/(this.weight+m.quaternionWeight);a.Quaternion.slerp(k.quaternion,e,k.quaternion,u),m.quaternionWeight+=this.weight}else if("scl"===o){d.x=s[0]+(t[0]-s[0])*r,d.y=s[1]+(t[1]-s[1])*r,d.z=s[2]+(t[2]-s[2])*r;var u=this.weight/(this.weight+m.scaleWeight);k.scale.lerp(d,u),m.scaleWeight+=this.weight}}return!0}}},getNextKeyWith:function(b,c,d){var e=this.data.hierarchy[c].keys;for(this.interpolationType===a.AnimationHandler.CATMULLROM||this.interpolationType===a.AnimationHandler.CATMULLROM_FORWARD?d=d<e.length-1?d:e.length-1:d%=e.length;d<e.length;d++)if(void 0!==e[d][b])return e[d];return this.data.hierarchy[c].keys[0]},getPrevKeyWith:function(b,c,d){var e=this.data.hierarchy[c].keys;for(d=this.interpolationType===a.AnimationHandler.CATMULLROM||this.interpolationType===a.AnimationHandler.CATMULLROM_FORWARD?d>0?d:0:d>=0?d:d+e.length;d>=0;d--)if(void 0!==e[d][b])return e[d];return this.data.hierarchy[c].keys[e.length-1]}},a.KeyFrameAnimation=function(b){this.root=b.node,this.data=a.AnimationHandler.init(b),this.hierarchy=a.AnimationHandler.parse(this.root),this.currentTime=0,this.timeScale=.001,this.isPlaying=!1,this.isPaused=!0,this.loop=!0;for(var c=0,d=this.hierarchy.length;d>c;c++){var e=this.data.hierarchy[c].keys,f=this.data.hierarchy[c].sids,g=this.hierarchy[c];if(e.length&&f){for(var h=0;h<f.length;h++){var i=f[h],j=this.getNextKeyWith(i,c,0);j&&j.apply(i)}g.matrixAutoUpdate=!1,this.data.hierarchy[c].node.updateMatrix,g.matrixWorldNeedsUpdate=!0}}},a.KeyFrameAnimation.prototype={constructor:a.KeyFrameAnimation,play:function(b){if(this.currentTime=void 0!==b?b:0,this.isPlaying===!1){this.isPlaying=!0;var c,d,e,f=this.hierarchy.length;for(c=0;f>c;c++){d=this.hierarchy[c],e=this.data.hierarchy[c],void 0===e.animationCache&&(e.animationCache={},e.animationCache.prevKey=null,e.animationCache.nextKey=null,e.animationCache.originalMatrix=d.matrix);var g=this.data.hierarchy[c].keys;g.length&&(e.animationCache.prevKey=g[0],e.animationCache.nextKey=g[1],this.startTime=Math.min(g[0].time,this.startTime),this.endTime=Math.max(g[g.length-1].time,this.endTime))}this.update(0)}this.isPaused=!1,a.AnimationHandler.play(this)},stop:function{this.isPlaying=!1,this.isPaused=!1,a.AnimationHandler.stop(this);for(var b=0;b<this.data.hierarchy.length;b++){var c=this.hierarchy[b],d=this.data.hierarchy[b];if(void 0!==d.animationCache){var e=d.animationCache.originalMatrix;e.copy(c.matrix),c.matrix=e,delete d.animationCache}}},update:function(a){if(this.isPlaying!==!1){this.currentTime+=a*this.timeScale;var b=this.data.length;this.loop===!0&&this.currentTime>b&&(this.currentTime%=b),this.currentTime=Math.min(this.currentTime,b);for(var c=0,d=this.hierarchy.length;d>c;c++){var e=this.hierarchy[c],f=this.data.hierarchy[c],g=f.keys,h=f.animationCache;if(g.length){var i=h.prevKey,j=h.nextKey;if(j.time<=this.currentTime){for(j.time<this.currentTime&&j.index>i.index;)i=j,j=g[i.index+1];h.prevKey=i,h.nextKey=j}j.time>=this.currentTime?i.interpolate(j,this.currentTime):i.interpolate(j,j.time),this.data.hierarchy[c].node.updateMatrix,e.matrixWorldNeedsUpdate=!0}}}},getNextKeyWith:function(a,b,c){var d=this.data.hierarchy[b].keys;for(c%=d.length;c<d.length;c++)if(d[c].hasTarget(a))return d[c];return d[0]},getPrevKeyWith:function(a,b,c){var d=this.data.hierarchy[b].keys;for(c=c>=0?c:c+d.length;c>=0;c--)if(d[c].hasTarget(a))return d[c];return d[d.length-1]}},a.MorphAnimation=function(a){this.mesh=a,this.frames=a.morphTargetInfluences.length,this.currentTime=0,this.duration=1e3,this.loop=!0,this.lastFrame=0,this.currentFrame=0,this.isPlaying=!1},a.MorphAnimation.prototype={constructor:a.MorphAnimation,play:function{this.isPlaying=!0},pause:function{this.isPlaying=!1},update:function(a){if(this.isPlaying!==!1){this.currentTime+=a,this.loop===!0&&this.currentTime>this.duration&&(this.currentTime%=this.duration),this.currentTime=Math.min(this.currentTime,this.duration);var b=this.duration/this.frames,c=Math.floor(this.currentTime/b),d=this.mesh.morphTargetInfluences;c!=this.currentFrame&&(d[this.lastFrame]=0,d[this.currentFrame]=1,d[c]=0,this.lastFrame=this.currentFrame,this.currentFrame=c),d[c]=this.currentTime%b/b,d[this.lastFrame]=1-d[c]}}},a.BoxGeometry=function(b,c,d,e,f,g){function h(b,c,d,e,f,g,h,j){var k,l,m,n=i.widthSegments,o=i.heightSegments,p=f/2,q=g/2,r=i.vertices.length;"x"===b&&"y"===c||"y"===b&&"x"===c?k="z":"x"===b&&"z"===c||"z"===b&&"x"===c?(k="y",o=i.depthSegments):("z"===b&&"y"===c||"y"===b&&"z"===c)&&(k="x",n=i.depthSegments);var s=n+1,t=o+1,u=f/n,v=g/o,w=new a.Vector3;for(w[k]=h>0?1:-1,m=0;t>m;m++)for(l=0;s>l;l++){var x=new a.Vector3;x[b]=(l*u-p)*d,x[c]=(m*v-q)*e,x[k]=h,i.vertices.push(x)}for(m=0;o>m;m++)for(l=0;n>l;l++){var y=l+s*m,z=l+s*(m+1),A=l+1+s*(m+1),B=l+1+s*m,C=new a.Vector2(l/n,1-m/o),D=new a.Vector2(l/n,1-(m+1)/o),E=new a.Vector2((l+1)/n,1-(m+1)/o),F=new a.Vector2((l+1)/n,1-m/o),G=new a.Face3(y+r,z+r,B+r);G.normal.copy(w),G.vertexNormals.push(w.clone,w.clone,w.clone),G.materialIndex=j,i.faces.push(G),i.faceVertexUvs[0].push([C,D,F]),G=new a.Face3(z+r,A+r,B+r),G.normal.copy(w),G.vertexNormals.push(w.clone,w.clone,w.clone),G.materialIndex=j,i.faces.push(G),i.faceVertexUvs[0].push([D.clone,E,F.clone])}}a.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:b,height:c,depth:d,widthSegments:e,heightSegments:f,depthSegments:g},this.widthSegments=e||1,this.heightSegments=f||1,this.depthSegments=g||1;var i=this,j=b/2,k=c/2,l=d/2;h("z","y",-1,-1,d,c,j,0),h("z","y",1,-1,d,c,-j,1),h("x","z",1,1,b,d,k,2),h("x","z",1,-1,b,d,-k,3),h("x","y",1,-1,b,c,l,4),h("x","y",-1,-1,b,c,-l,5),this.mergeVertices},a.BoxGeometry.prototype=Object.create(a.Geometry.prototype),a.BoxGeometry.prototype.constructor=a.BoxGeometry,a.CircleGeometry=function(b,c,d,e){a.Geometry.call(this),this.type="CircleGeometry",this.parameters={radius:b,segments:c,thetaStart:d,thetaLength:e},b=b||50,c=void 0!==c?Math.max(3,c):8,d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI;var f,g=[],h=new a.Vector3,i=new a.Vector2(.5,.5);for(this.vertices.push(h),g.push(i),f=0;c>=f;f++){var j=new a.Vector3,k=d+f/c*e;j.x=b*Math.cos(k),j.y=b*Math.sin(k),this.vertices.push(j),g.push(new a.Vector2((j.x/b+1)/2,(j.y/b+1)/2))}var l=new a.Vector3(0,0,1);for(f=1;c>=f;f++)this.faces.push(new a.Face3(f,f+1,0,[l.clone,l.clone,l.clone])),this.faceVertexUvs[0].push([g[f].clone,g[f+1].clone,i.clone]);this.computeFaceNormals,this.boundingSphere=new a.Sphere(new a.Vector3,b)},a.CircleGeometry.prototype=Object.create(a.Geometry.prototype),a.CircleGeometry.prototype.constructor=a.CircleGeometry,a.CubeGeometry=function(b,c,d,e,f,g){return a.warn("THREE.CubeGeometry has been renamed to THREE.BoxGeometry."),new a.BoxGeometry(b,c,d,e,f,g)},a.CylinderGeometry=function(b,c,d,e,f,g,h,i){a.Geometry.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:b,radiusBottom:c,height:d,radialSegments:e,heightSegments:f,openEnded:g,thetaStart:h,thetaLength:i},b=void 0!==b?b:20,c=void 0!==c?c:20,d=void 0!==d?d:100,e=e||8,f=f||1,g=void 0!==g?g:!1,h=void 0!==h?h:0,i=void 0!==i?i:2*Math.PI;var j,k,l=d/2,m=[],n=[];for(k=0;f>=k;k++){var o=[],p=[],q=k/f,r=q*(c-b)+b;for(j=0;e>=j;j++){var s=j/e,t=new a.Vector3;t.x=r*Math.sin(s*i+h),t.y=-q*d+l,t.z=r*Math.cos(s*i+h),this.vertices.push(t),o.push(this.vertices.length-1),p.push(new a.Vector2(s,1-q))}m.push(o),n.push(p)}var u,v,w=(c-b)/d;for(j=0;e>j;j++)for(0!==b?(u=this.vertices[m[0][j]].clone,v=this.vertices[m[0][j+1]].clone):(u=this.vertices[m[1][j]].clone,v=this.vertices[m[1][j+1]].clone),u.setY(Math.sqrt(u.x*u.x+u.z*u.z)*w).normalize,v.setY(Math.sqrt(v.x*v.x+v.z*v.z)*w).normalize,k=0;f>k;k++){var x=m[k][j],y=m[k+1][j],z=m[k+1][j+1],A=m[k][j+1],B=u.clone,C=u.clone,D=v.clone,E=v.clone,F=n[k][j].clone,G=n[k+1][j].clone,H=n[k+1][j+1].clone,I=n[k][j+1].clone;this.faces.push(new a.Face3(x,y,A,[B,C,E])),this.faceVertexUvs[0].push([F,G,I]),this.faces.push(new a.Face3(y,z,A,[C.clone,D,E.clone])),this.faceVertexUvs[0].push([G.clone,H,I.clone])}if(g===!1&&b>0)for(this.vertices.push(new a.Vector3(0,l,0)),j=0;e>j;j++){var x=m[0][j],y=m[0][j+1],z=this.vertices.length-1,B=new a.Vector3(0,1,0),C=new a.Vector3(0,1,0),D=new a.Vector3(0,1,0),F=n[0][j].clone,G=n[0][j+1].clone,H=new a.Vector2(G.x,0);this.faces.push(new a.Face3(x,y,z,[B,C,D])),this.faceVertexUvs[0].push([F,G,H])}if(g===!1&&c>0)for(this.vertices.push(new a.Vector3(0,-l,0)),j=0;e>j;j++){var x=m[f][j+1],y=m[f][j],z=this.vertices.length-1,B=new a.Vector3(0,-1,0),C=new a.Vector3(0,-1,0),D=new a.Vector3(0,-1,0),F=n[f][j+1].clone,G=n[f][j].clone,H=new a.Vector2(G.x,1);this.faces.push(new a.Face3(x,y,z,[B,C,D])),this.faceVertexUvs[0].push([F,G,H])}this.computeFaceNormals},a.CylinderGeometry.prototype=Object.create(a.Geometry.prototype),a.CylinderGeometry.prototype.constructor=a.CylinderGeometry,a.ExtrudeGeometry=function(b,c){return"undefined"==typeof b?void(b=[]):(a.Geometry.call(this),this.type="ExtrudeGeometry",b=b instanceof Array?b:[b],this.addShapeList(b,c),void this.computeFaceNormals)},a.ExtrudeGeometry.prototype=Object.create(a.Geometry.prototype),a.ExtrudeGeometry.prototype.constructor=a.ExtrudeGeometry,a.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;c>d;d++){var e=a[d];this.addShape(e,b)}},a.ExtrudeGeometry.prototype.addShape=function(b,c){function d(b,c,d){return c||a.error("THREE.ExtrudeGeometry: vec does not exist"),c.clone.multiplyScalar(d).add(b)}function e(b,c,d){var e,f,g=1e-10,h=1,i=b.x-c.x,j=b.y-c.y,k=d.x-b.x,l=d.y-b.y,m=i*i+j*j,n=i*l-j*k;if(Math.abs(n)>g){var o=Math.sqrt(m),p=Math.sqrt(k*k+l*l),q=c.x-j/o,r=c.y+i/o,s=d.x-l/p,t=d.y+k/p,u=((s-q)*l-(t-r)*k)/(i*l-j*k);e=q+i*u-b.x,f=r+j*u-b.y;var v=e*e+f*f;if(2>=v)return new a.Vector2(e,f);h=Math.sqrt(v/2)}else{var w=!1;i>g?k>g&&(w=!0):-g>i?-g>k&&(w=!0):Math.sign(j)==Math.sign(l)&&(w=!0),w?(e=-j,f=i,h=Math.sqrt(m)):(e=i,f=j,h=Math.sqrt(m/2))}return new a.Vector2(e/h,f/h)}function f{if(u){var a=0,b=T*a;for(W=0;U>W;W++)S=L[W],j(S[2]+b,S[1]+b,S[0]+b);for(a=w+2*t,b=T*a,W=0;U>W;W++)S=L[W],j(S[0]+b,S[1]+b,S[2]+b)}else{for(W=0;U>W;W++)S=L[W],j(S[2],S[1],S[0]);for(W=0;U>W;W++)S=L[W],j(S[0]+T*w,S[1]+T*w,S[2]+T*w)}}function g{var a=0;for(h(M,a),a+=M.length,D=0,E=J.length;E>D;D++)C=J[D],h(C,a),a+=C.length}function h(a,b){var c,d;for(W=a.length;--W>=0;){c=W,d=W-1,0>d&&(d=a.length-1);var e=0,f=w+2*t;for(e=0;f>e;e++){var g=T*e,h=T*(e+1),i=b+c+g,j=b+d+g,l=b+d+h,m=b+c+h;k(i,j,l,m,a,e,f,c,d)}}}function i(b,c,d){F.vertices.push(new a.Vector3(b,c,d))}function j(b,c,d){b+=G,c+=G,d+=G,F.faces.push(new a.Face3(b,c,d,null,null,z));var e=B.generateTopUV(F,b,c,d);F.faceVertexUvs[0].push(e)}function k(b,c,d,e,f,g,h,i,j){b+=G,c+=G,d+=G,e+=G,F.faces.push(new a.Face3(b,c,e,null,null,A)),F.faces.push(new a.Face3(c,d,e,null,null,A));var k=B.generateSideWallUV(F,b,c,d,e);F.faceVertexUvs[0].push([k[0],k[1],k[3]]),F.faceVertexUvs[0].push([k[1],k[2],k[3]])}var l,m,n,o,p,q=void 0!==c.amount?c.amount:100,r=void 0!==c.bevelThickness?c.bevelThickness:6,s=void 0!==c.bevelSize?c.bevelSize:r-2,t=void 0!==c.bevelSegments?c.bevelSegments:3,u=void 0!==c.bevelEnabled?c.bevelEnabled:!0,v=void 0!==c.curveSegments?c.curveSegments:12,w=void 0!==c.steps?c.steps:1,x=c.extrudePath,y=!1,z=c.material,A=c.extrudeMaterial,B=void 0!==c.UVGenerator?c.UVGenerator:a.ExtrudeGeometry.WorldUVGenerator;x&&(l=x.getSpacedPoints(w),y=!0,u=!1,m=void 0!==c.frames?c.frames:new a.TubeGeometry.FrenetFrames(x,w,!1),n=new a.Vector3,o=new a.Vector3,p=new a.Vector3),u||(t=0,r=0,s=0);var C,D,E,F=this,G=this.vertices.length,H=b.extractPoints(v),I=H.shape,J=H.holes,K=!a.Shape.Utils.isClockWise(I);if(K){for(I=I.reverse,D=0,E=J.length;E>D;D++)C=J[D],a.Shape.Utils.isClockWise(C)&&(J[D]=C.reverse);K=!1}var L=a.Shape.Utils.triangulateShape(I,J),M=I;for(D=0,E=J.length;E>D;D++)C=J[D],I=I.concat(C);for(var N,O,P,Q,R,S,T=I.length,U=L.length,V=[],W=0,X=M.length,Y=X-1,Z=W+1;X>W;W++,Y++,Z++)Y===X&&(Y=0),Z===X&&(Z=0),V[W]=e(M[W],M[Y],M[Z]);var $,_=[],aa=V.concat;for(D=0,E=J.length;E>D;D++){for(C=J[D],$=[],W=0,X=C.length,Y=X-1,Z=W+1;X>W;W++,Y++,Z++)Y===X&&(Y=0),Z===X&&(Z=0),$[W]=e(C[W],C[Y],C[Z]);_.push($),aa=aa.concat($)}for(N=0;t>N;N++){for(P=N/t,Q=r*(1-P),O=s*Math.sin(P*Math.PI/2),W=0,X=M.length;X>W;W++)R=d(M[W],V[W],O),i(R.x,R.y,-Q);for(D=0,E=J.length;E>D;D++)for(C=J[D],$=_[D],W=0,X=C.length;X>W;W++)R=d(C[W],$[W],O),i(R.x,R.y,-Q)}for(O=s,W=0;T>W;W++)R=u?d(I[W],aa[W],O):I[W],y?(o.copy(m.normals[0]).multiplyScalar(R.x),n.copy(m.binormals[0]).multiplyScalar(R.y),p.copy(l[0]).add(o).add(n),i(p.x,p.y,p.z)):i(R.x,R.y,0);var ba;for(ba=1;w>=ba;ba++)for(W=0;T>W;W++)R=u?d(I[W],aa[W],O):I[W],y?(o.copy(m.normals[ba]).multiplyScalar(R.x),n.copy(m.binormals[ba]).multiplyScalar(R.y),p.copy(l[ba]).add(o).add(n),i(p.x,p.y,p.z)):i(R.x,R.y,q/w*ba);for(N=t-1;N>=0;N--){for(P=N/t,Q=r*(1-P),O=s*Math.sin(P*Math.PI/2),W=0,X=M.length;X>W;W++)R=d(M[W],V[W],O),i(R.x,R.y,q+Q);for(D=0,E=J.length;E>D;D++)for(C=J[D],$=_[D],W=0,X=C.length;X>W;W++)R=d(C[W],$[W],O),y?i(R.x,R.y+l[w-1].y,l[w-1].x+Q):i(R.x,R.y,q+Q)}f,g},a.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(b,c,d,e){var f=b.vertices,g=f[c],h=f[d],i=f[e];return[new a.Vector2(g.x,g.y),new a.Vector2(h.x,h.y),new a.Vector2(i.x,i.y)]},generateSideWallUV:function(b,c,d,e,f){var g=b.vertices,h=g[c],i=g[d],j=g[e],k=g[f];return Math.abs(h.y-i.y)<.01?[new a.Vector2(h.x,1-h.z),new a.Vector2(i.x,1-i.z),new a.Vector2(j.x,1-j.z),new a.Vector2(k.x,1-k.z)]:[new a.Vector2(h.y,1-h.z),new a.Vector2(i.y,1-i.z),new a.Vector2(j.y,1-j.z),new a.Vector2(k.y,1-k.z)]}},a.ShapeGeometry=function(b,c){a.Geometry.call(this),this.type="ShapeGeometry",b instanceof Array==!1&&(b=[b]),this.addShapeList(b,c),this.computeFaceNormals},a.ShapeGeometry.prototype=Object.create(a.Geometry.prototype),a.ShapeGeometry.prototype.constructor=a.ShapeGeometry,a.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;d>c;c++)this.addShape(a[c],b);return this},a.ShapeGeometry.prototype.addShape=function(b,c){void 0===c&&(c={});var d,e,f,g=void 0!==c.curveSegments?c.curveSegments:12,h=c.material,i=void 0===c.UVGenerator?a.ExtrudeGeometry.WorldUVGenerator:c.UVGenerator,j=this.vertices.length,k=b.extractPoints(g),l=k.shape,m=k.holes,n=!a.Shape.Utils.isClockWise(l);if(n){for(l=l.reverse,d=0,e=m.length;e>d;d++)f=m[d],a.Shape.Utils.isClockWise(f)&&(m[d]=f.reverse);n=!1}var o=a.Shape.Utils.triangulateShape(l,m);for(d=0,e=m.length;e>d;d++)f=m[d],l=l.concat(f);var p,q,r=l.length,s=o.length;for(d=0;r>d;d++)p=l[d],this.vertices.push(new a.Vector3(p.x,p.y,0));for(d=0;s>d;d++){q=o[d];var t=q[0]+j,u=q[1]+j,v=q[2]+j;this.faces.push(new a.Face3(t,u,v,null,null,h)),this.faceVertexUvs[0].push(i.generateTopUV(this,t,u,v))}},a.LatheGeometry=function(b,c,d,e){a.Geometry.call(this),this.type="LatheGeometry",this.parameters={points:b,segments:c,phiStart:d,phiLength:e},c=c||12,d=d||0,e=e||2*Math.PI;for(var f=1/(b.length-1),g=1/c,h=0,i=c;i>=h;h++)for(var j=d+h*g*e,k=Math.cos(j),l=Math.sin(j),m=0,n=b.length;n>m;m++){var o=b[m],p=new a.Vector3;p.x=k*o.x-l*o.y,p.y=l*o.x+k*o.y,p.z=o.z,this.vertices.push(p)}for(var q=b.length,h=0,i=c;i>h;h++)for(var m=0,n=b.length-1;n>m;m++){var r=m+q*h,s=r,t=r+q,k=r+1+q,u=r+1,v=h*g,w=m*f,x=v+g,y=w+f;this.faces.push(new a.Face3(s,t,u)),this.faceVertexUvs[0].push([new a.Vector2(v,w),new a.Vector2(x,w),new a.Vector2(v,y)]),this.faces.push(new a.Face3(t,k,u)),this.faceVertexUvs[0].push([new a.Vector2(x,w),new a.Vector2(x,y),new a.Vector2(v,y)])}this.mergeVertices,this.computeFaceNormals,this.computeVertexNormals},a.LatheGeometry.prototype=Object.create(a.Geometry.prototype),a.LatheGeometry.prototype.constructor=a.LatheGeometry,a.PlaneGeometry=function(b,c,d,e){console.info("THREE.PlaneGeometry: Consider using THREE.PlaneBufferGeometry for lower memory footprint."),a.Geometry.call(this),this.type="PlaneGeometry",this.parameters={width:b,height:c,widthSegments:d,heightSegments:e},this.fromBufferGeometry(new a.PlaneBufferGeometry(b,c,d,e))},a.PlaneGeometry.prototype=Object.create(a.Geometry.prototype),a.PlaneGeometry.prototype.constructor=a.PlaneGeometry,a.PlaneBufferGeometry=function(b,c,d,e){a.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:b,height:c,widthSegments:d,heightSegments:e};for(var f=b/2,g=c/2,h=d||1,i=e||1,j=h+1,k=i+1,l=b/h,m=c/i,n=new Float32Array(j*k*3),o=new Float32Array(j*k*3),p=new Float32Array(j*k*2),q=0,r=0,s=0;k>s;s++)for(var t=s*m-g,u=0;j>u;u++){var v=u*l-f;n[q]=v,n[q+1]=-t,o[q+2]=1,p[r]=u/h,p[r+1]=1-s/i,q+=3,r+=2}q=0;for(var w=new(n.length/3>65535?Uint32Array:Uint16Array)(h*i*6),s=0;i>s;s++)for(var u=0;h>u;u++){var x=u+j*s,y=u+j*(s+1),z=u+1+j*(s+1),A=u+1+j*s;w[q]=x,w[q+1]=y,w[q+2]=A,w[q+3]=y,w[q+4]=z,w[q+5]=A,q+=6}this.addAttribute("index",new a.BufferAttribute(w,1)),this.addAttribute("position",new a.BufferAttribute(n,3)),this.addAttribute("normal",new a.BufferAttribute(o,3)),this.addAttribute("uv",new a.BufferAttribute(p,2))},a.PlaneBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.PlaneBufferGeometry.prototype.constructor=a.PlaneBufferGeometry,a.RingGeometry=function(b,c,d,e,f,g){a.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:b,outerRadius:c,thetaSegments:d,phiSegments:e,thetaStart:f,thetaLength:g},b=b||0,c=c||50,f=void 0!==f?f:0,g=void 0!==g?g:2*Math.PI,d=void 0!==d?Math.max(3,d):8,e=void 0!==e?Math.max(1,e):8;var h,i,j=[],k=b,l=(c-b)/e;for(h=0;e+1>h;h++){for(i=0;d+1>i;i++){var m=new a.Vector3,n=f+i/d*g;m.x=k*Math.cos(n),m.y=k*Math.sin(n),this.vertices.push(m),j.push(new a.Vector2((m.x/c+1)/2,(m.y/c+1)/2))}k+=l}var o=new a.Vector3(0,0,1);for(h=0;e>h;h++){var p=h*(d+1);for(i=0;d>i;i++){var n=i+p,q=n,r=n+d+1,s=n+d+2;this.faces.push(new a.Face3(q,r,s,[o.clone,o.clone,o.clone])),this.faceVertexUvs[0].push([j[q].clone,j[r].clone,j[s].clone]),q=n,r=n+d+2,s=n+1,this.faces.push(new a.Face3(q,r,s,[o.clone,o.clone,o.clone])),this.faceVertexUvs[0].push([j[q].clone,j[r].clone,j[s].clone])}}this.computeFaceNormals,this.boundingSphere=new a.Sphere(new a.Vector3,k)},a.RingGeometry.prototype=Object.create(a.Geometry.prototype),a.RingGeometry.prototype.constructor=a.RingGeometry,a.SphereGeometry=function(b,c,d,e,f,g,h){a.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:b,widthSegments:c,heightSegments:d,phiStart:e,phiLength:f,thetaStart:g,thetaLength:h},b=b||50,c=Math.max(3,Math.floor(c)||8),d=Math.max(2,Math.floor(d)||6),e=void 0!==e?e:0,f=void 0!==f?f:2*Math.PI,g=void 0!==g?g:0,h=void 0!==h?h:Math.PI;var i,j,k=[],l=[];for(j=0;d>=j;j++){var m=[],n=[];for(i=0;c>=i;i++){var o=i/c,p=j/d,q=new a.Vector3;q.x=-b*Math.cos(e+o*f)*Math.sin(g+p*h),q.y=b*Math.cos(g+p*h),q.z=b*Math.sin(e+o*f)*Math.sin(g+p*h),this.vertices.push(q),m.push(this.vertices.length-1),n.push(new a.Vector2(o,1-p))}k.push(m),l.push(n)}for(j=0;d>j;j++)for(i=0;c>i;i++){var r=k[j][i+1],s=k[j][i],t=k[j+1][i],u=k[j+1][i+1],v=this.vertices[r].clone.normalize,w=this.vertices[s].clone.normalize,x=this.vertices[t].clone.normalize,y=this.vertices[u].clone.normalize,z=l[j][i+1].clone,A=l[j][i].clone,B=l[j+1][i].clone,C=l[j+1][i+1].clone;Math.abs(this.vertices[r].y)===b?(z.x=(z.x+A.x)/2,this.faces.push(new a.Face3(r,t,u,[v,x,y])),this.faceVertexUvs[0].push([z,B,C])):Math.abs(this.vertices[t].y)===b?(B.x=(B.x+C.x)/2,this.faces.push(new a.Face3(r,s,t,[v,w,x])),this.faceVertexUvs[0].push([z,A,B])):(this.faces.push(new a.Face3(r,s,u,[v,w,y])),this.faceVertexUvs[0].push([z,A,C]),this.faces.push(new a.Face3(s,t,u,[w.clone,x,y.clone])),this.faceVertexUvs[0].push([A.clone,B,C.clone]))}this.computeFaceNormals,this.boundingSphere=new a.Sphere(new a.Vector3,b)},a.SphereGeometry.prototype=Object.create(a.Geometry.prototype),a.SphereGeometry.prototype.constructor=a.SphereGeometry,a.TextGeometry=function(b,c){c=c||{};var d=a.FontUtils.generateShapes(b,c);c.amount=void 0!==c.height?c.height:50,void 0===c.bevelThickness&&(c.bevelThickness=10),void 0===c.bevelSize&&(c.bevelSize=8),void 0===c.bevelEnabled&&(c.bevelEnabled=!1),a.ExtrudeGeometry.call(this,d,c),this.type="TextGeometry"},a.TextGeometry.prototype=Object.create(a.ExtrudeGeometry.prototype),a.TextGeometry.prototype.constructor=a.TextGeometry,a.TorusGeometry=function(b,c,d,e,f){a.Geometry.call(this),this.type="TorusGeometry",this.parameters={radius:b,tube:c,radialSegments:d,tubularSegments:e,arc:f},b=b||100,c=c||40,d=d||8,e=e||6,f=f||2*Math.PI;for(var g=new a.Vector3,h=[],i=[],j=0;d>=j;j++)for(var k=0;e>=k;k++){var l=k/e*f,m=j/d*Math.PI*2;g.x=b*Math.cos(l),g.y=b*Math.sin(l);var n=new a.Vector3;n.x=(b+c*Math.cos(m))*Math.cos(l),n.y=(b+c*Math.cos(m))*Math.sin(l),n.z=c*Math.sin(m),this.vertices.push(n),h.push(new a.Vector2(k/e,j/d)),i.push(n.clone.sub(g).normalize)}for(var j=1;d>=j;j++)for(var k=1;e>=k;k++){var o=(e+1)*j+k-1,p=(e+1)*(j-1)+k-1,q=(e+1)*(j-1)+k,r=(e+1)*j+k,s=new a.Face3(o,p,r,[i[o].clone,i[p].clone,i[r].clone]);this.faces.push(s),this.faceVertexUvs[0].push([h[o].clone,h[p].clone,h[r].clone]),s=new a.Face3(p,q,r,[i[p].clone,i[q].clone,i[r].clone]),this.faces.push(s),this.faceVertexUvs[0].push([h[p].clone,h[q].clone,h[r].clone])}this.computeFaceNormals},a.TorusGeometry.prototype=Object.create(a.Geometry.prototype),a.TorusGeometry.prototype.constructor=a.TorusGeometry,a.TorusKnotGeometry=function(b,c,d,e,f,g,h){function i(b,c,d,e,f){var g=Math.cos(b),h=Math.sin(b),i=c/d*b,j=Math.cos(i),k=e*(2+j)*.5*g,l=e*(2+j)*h*.5,m=f*e*Math.sin(i)*.5;return new a.Vector3(k,l,m)}a.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:b,tube:c,radialSegments:d,tubularSegments:e,p:f,q:g,heightScale:h},b=b||100,c=c||40,d=d||64,e=e||8,f=f||2,g=g||3,h=h||1;for(var j=new Array(d),k=new a.Vector3,l=new a.Vector3,m=new a.Vector3,n=0;d>n;++n){j[n]=new Array(e);var o=n/d*2*f*Math.PI,p=i(o,g,f,b,h),q=i(o+.01,g,f,b,h);k.subVectors(q,p),l.addVectors(q,p),m.crossVectors(k,l),l.crossVectors(m,k),m.normalize,l.normalize;for(var r=0;e>r;++r){var s=r/e*2*Math.PI,t=-c*Math.cos(s),u=c*Math.sin(s),v=new a.Vector3;v.x=p.x+t*l.x+u*m.x,v.y=p.y+t*l.y+u*m.y,v.z=p.z+t*l.z+u*m.z,j[n][r]=this.vertices.push(v)-1}}for(var n=0;d>n;++n)for(var r=0;e>r;++r){var w=(n+1)%d,x=(r+1)%e,y=j[n][r],z=j[w][r],A=j[w][x],B=j[n][x],C=new a.Vector2(n/d,r/e),D=new a.Vector2((n+1)/d,r/e),E=new a.Vector2((n+1)/d,(r+1)/e),F=new a.Vector2(n/d,(r+1)/e);this.faces.push(new a.Face3(y,z,B)),this.faceVertexUvs[0].push([C,D,F]),this.faces.push(new a.Face3(z,A,B)),this.faceVertexUvs[0].push([D.clone,E,F.clone])}this.computeFaceNormals,this.computeVertexNormals},a.TorusKnotGeometry.prototype=Object.create(a.Geometry.prototype),a.TorusKnotGeometry.prototype.constructor=a.TorusKnotGeometry,a.TubeGeometry=function(b,c,d,e,f,g){function h(b,c,d){return E.vertices.push(new a.Vector3(b,c,d))-1}a.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:b,segments:c,radius:d,radialSegments:e,closed:f},c=c||64,d=d||1,e=e||8,f=f||!1,g=g||a.TubeGeometry.NoTaper;var i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D=[],E=this,F=c+1,G=new a.Vector3,H=new a.TubeGeometry.FrenetFrames(b,c,f),I=H.tangents,J=H.normals,K=H.binormals;for(this.tangents=I,this.normals=J,this.binormals=K,r=0;F>r;r++)for(D[r]=[],l=r/(F-1),q=b.getPointAt(l),i=I[r],j=J[r],k=K[r],n=d*g(l),s=0;e>s;s++)m=s/e*2*Math.PI,o=-n*Math.cos(m),p=n*Math.sin(m),G.copy(q),G.x+=o*j.x+p*k.x,G.y+=o*j.y+p*k.y,G.z+=o*j.z+p*k.z,D[r][s]=h(G.x,G.y,G.z);for(r=0;c>r;r++)for(s=0;e>s;s++)t=f?(r+1)%c:r+1,u=(s+1)%e,v=D[r][s],w=D[t][s],x=D[t][u],y=D[r][u],z=new a.Vector2(r/c,s/e),A=new a.Vector2((r+1)/c,s/e),B=new a.Vector2((r+1)/c,(s+1)/e),C=new a.Vector2(r/c,(s+1)/e),this.faces.push(new a.Face3(v,w,y)),this.faceVertexUvs[0].push([z,A,C]),this.faces.push(new a.Face3(w,x,y)),this.faceVertexUvs[0].push([A.clone,B,C.clone]);this.computeFaceNormals,this.computeVertexNormals},a.TubeGeometry.prototype=Object.create(a.Geometry.prototype),a.TubeGeometry.prototype.constructor=a.TubeGeometry,a.TubeGeometry.NoTaper=function(a){return 1},a.TubeGeometry.SinusoidalTaper=function(a){return Math.sin(Math.PI*a)},a.TubeGeometry.FrenetFrames=function(b,c,d){function e{o[0]=new a.Vector3,p[0]=new a.Vector3,g=Number.MAX_VALUE,h=Math.abs(n[0].x),i=Math.abs(n[0].y),j=Math.abs(n[0].z),g>=h&&(g=h,m.set(1,0,0)),g>=i&&(g=i,m.set(0,1,0)),g>=j&&m.set(0,0,1),q.crossVectors(n[0],m).normalize,o[0].crossVectors(n[0],q),p[0].crossVectors(n[0],o[0])}var f,g,h,i,j,k,l,m=new a.Vector3,n=[],o=[],p=[],q=new a.Vector3,r=new a.Matrix4,s=c+1,t=1e-4;for(this.tangents=n,this.normals=o,this.binormals=p,k=0;s>k;k++)l=k/(s-1),n[k]=b.getTangentAt(l),n[k].normalize;for(e,k=1;s>k;k++)o[k]=o[k-1].clone,p[k]=p[k-1].clone,q.crossVectors(n[k-1],n[k]),q.length>t&&(q.normalize,f=Math.acos(a.Math.clamp(n[k-1].dot(n[k]),-1,1)),o[k].applyMatrix4(r.makeRotationAxis(q,f))),p[k].crossVectors(n[k],o[k]);if(d)for(f=Math.acos(a.Math.clamp(o[0].dot(o[s-1]),-1,1)),f/=s-1,n[0].dot(q.crossVectors(o[0],o[s-1]))>0&&(f=-f),k=1;s>k;k++)o[k].applyMatrix4(r.makeRotationAxis(n[k],f*k)),p[k].crossVectors(n[k],o[k])},a.PolyhedronGeometry=function(b,c,d,e){function f(b){var c=b.normalize.clone;c.index=l.vertices.push(c)-1;var d=i(b)/2/Math.PI+.5,e=j(b)/Math.PI+.5;return c.uv=new a.Vector2(d,1-e),c}function g(b,c,d){var e=new a.Face3(b.index,c.index,d.index,[b.clone,c.clone,d.clone]);l.faces.push(e),u.copy(b).add(c).add(d).divideScalar(3);var f=i(u);l.faceVertexUvs[0].push([k(b.uv,b,f),k(c.uv,c,f),k(d.uv,d,f)])}function h(a,b){for(var c=Math.pow(2,b),d=f(l.vertices[a.a]),e=f(l.vertices[a.b]),h=f(l.vertices[a.c]),i=[],j=0;c>=j;j++){i[j]=[];for(var k=f(d.clone.lerp(h,j/c)),m=f(e.clone.lerp(h,j/c)),n=c-j,o=0;n>=o;o++)0==o&&j==c?i[j][o]=k:i[j][o]=f(k.clone.lerp(m,o/n))}for(var j=0;c>j;j++)for(var o=0;2*(c-j)-1>o;o++){var p=Math.floor(o/2);o%2==0?g(i[j][p+1],i[j+1][p],i[j][p]):g(i[j][p+1],i[j+1][p+1],i[j+1][p])}}function i(a){return Math.atan2(a.z,-a.x)}function j(a){return Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))}function k(b,c,d){return 0>d&&1===b.x&&(b=new a.Vector2(b.x-1,b.y)),0===c.x&&0===c.z&&(b=new a.Vector2(d/2/Math.PI+.5,b.y)),b.clone}a.Geometry.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:b,indices:c,radius:d,detail:e},d=d||1,e=e||0;for(var l=this,m=0,n=b.length;n>m;m+=3)f(new a.Vector3(b[m],b[m+1],b[m+2]));for(var o=this.vertices,p=[],m=0,q=0,n=c.length;n>m;m+=3,q++){var r=o[c[m]],s=o[c[m+1]],t=o[c[m+2]];p[q]=new a.Face3(r.index,s.index,t.index,[r.clone,s.clone,t.clone])}for(var u=new a.Vector3,m=0,n=p.length;n>m;m++)h(p[m],e);for(var m=0,n=this.faceVertexUvs[0].length;n>m;m++){var v=this.faceVertexUvs[0][m],w=v[0].x,x=v[1].x,y=v[2].x,z=Math.max(w,Math.max(x,y)),A=Math.min(w,Math.min(x,y));z>.9&&.1>A&&(.2>w&&(v[0].x+=1),.2>x&&(v[1].x+=1),.2>y&&(v[2].x+=1))}for(var m=0,n=this.vertices.length;n>m;m++)this.vertices[m].multiplyScalar(d);this.mergeVertices,this.computeFaceNormals,this.boundingSphere=new a.Sphere(new a.Vector3,d)},a.PolyhedronGeometry.prototype=Object.create(a.Geometry.prototype),a.PolyhedronGeometry.prototype.constructor=a.PolyhedronGeometry,a.DodecahedronGeometry=function(b,c){this.parameters={radius:b,detail:c};var d=(1+Math.sqrt(5))/2,e=1/d,f=[-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,-e,-d,0,-e,d,0,e,-d,0,e,d,-e,-d,0,-e,d,0,e,-d,0,e,d,0,-d,0,-e,d,0,-e,-d,0,e,d,0,e],g=[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.PolyhedronGeometry.call(this,f,g,b,c)},a.DodecahedronGeometry.prototype=Object.create(a.Geometry.prototype),a.DodecahedronGeometry.prototype.constructor=a.DodecahedronGeometry,a.IcosahedronGeometry=function(b,c){var d=(1+Math.sqrt(5))/2,e=[-1,d,0,1,d,0,-1,-d,0,1,-d,0,0,-1,d,0,1,d,0,-1,-d,0,1,-d,d,0,-1,d,0,1,-d,0,-1,-d,0,1],f=[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.PolyhedronGeometry.call(this,e,f,b,c),this.type="IcosahedronGeometry",this.parameters={radius:b,detail:c}},a.IcosahedronGeometry.prototype=Object.create(a.Geometry.prototype),a.IcosahedronGeometry.prototype.constructor=a.IcosahedronGeometry,a.OctahedronGeometry=function(b,c){this.parameters={radius:b,detail:c};var d=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],e=[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.PolyhedronGeometry.call(this,d,e,b,c),this.type="OctahedronGeometry",this.parameters={radius:b,detail:c}},a.OctahedronGeometry.prototype=Object.create(a.Geometry.prototype),a.OctahedronGeometry.prototype.constructor=a.OctahedronGeometry,a.TetrahedronGeometry=function(b,c){var d=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],e=[2,1,0,0,3,2,1,3,0,2,3,1];a.PolyhedronGeometry.call(this,d,e,b,c),this.type="TetrahedronGeometry",this.parameters={radius:b,detail:c}},a.TetrahedronGeometry.prototype=Object.create(a.Geometry.prototype),a.TetrahedronGeometry.prototype.constructor=a.TetrahedronGeometry,a.ParametricGeometry=function(b,c,d){a.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:b,slices:c,stacks:d};var e,f,g,h,i,j=this.vertices,k=this.faces,l=this.faceVertexUvs[0],m=c+1;for(e=0;d>=e;e++)for(i=e/d,f=0;c>=f;f++)h=f/c,g=b(h,i),j.push(g);var n,o,p,q,r,s,t,u;for(e=0;d>e;e++)for(f=0;c>f;f++)n=e*m+f,o=e*m+f+1,p=(e+1)*m+f+1,q=(e+1)*m+f,r=new a.Vector2(f/c,e/d),s=new a.Vector2((f+1)/c,e/d),t=new a.Vector2((f+1)/c,(e+1)/d),u=new a.Vector2(f/c,(e+1)/d),k.push(new a.Face3(n,o,q)),l.push([r,s,u]),k.push(new a.Face3(o,p,q)),l.push([s.clone,t,u.clone]);this.computeFaceNormals,this.computeVertexNormals},a.ParametricGeometry.prototype=Object.create(a.Geometry.prototype),a.ParametricGeometry.prototype.constructor=a.ParametricGeometry,a.AxisHelper=function(b){b=b||1;var c=new Float32Array([0,0,0,b,0,0,0,0,0,0,b,0,0,0,0,0,0,b]),d=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]),e=new a.BufferGeometry;e.addAttribute("position",new a.BufferAttribute(c,3)),e.addAttribute("color",new a.BufferAttribute(d,3));var f=new a.LineBasicMaterial({vertexColors:a.VertexColors});a.Line.call(this,e,f,a.LinePieces)},a.AxisHelper.prototype=Object.create(a.Line.prototype),a.AxisHelper.prototype.constructor=a.AxisHelper,a.ArrowHelper=function{var b=new a.Geometry;b.vertices.push(new a.Vector3(0,0,0),new a.Vector3(0,1,0)); var c=new a.CylinderGeometry(0,.5,1,5,1);return c.applyMatrix((new a.Matrix4).makeTranslation(0,-.5,0)),function(d,e,f,g,h,i){a.Object3D.call(this),void 0===g&&(g=16776960),void 0===f&&(f=1),void 0===h&&(h=.2*f),void 0===i&&(i=.2*h),this.position.copy(e),this.line=new a.Line(b,new a.LineBasicMaterial({color:g})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new a.Mesh(c,new a.MeshBasicMaterial({color:g})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(d),this.setLength(f,h,i)}},a.ArrowHelper.prototype=Object.create(a.Object3D.prototype),a.ArrowHelper.prototype.constructor=a.ArrowHelper,a.ArrowHelper.prototype.setDirection=function{var b,c=new a.Vector3;return function(a){a.y>.99999?this.quaternion.set(0,0,0,1):a.y<-.99999?this.quaternion.set(1,0,0,0):(c.set(a.z,0,-a.x).normalize,b=Math.acos(a.y),this.quaternion.setFromAxisAngle(c,b))}},a.ArrowHelper.prototype.setLength=function(a,b,c){void 0===b&&(b=.2*a),void 0===c&&(c=.2*b),this.line.scale.set(1,a-b,1),this.line.updateMatrix,this.cone.scale.set(c,b,c),this.cone.position.y=a,this.cone.updateMatrix},a.ArrowHelper.prototype.setColor=function(a){this.line.material.color.set(a),this.cone.material.color.set(a)},a.BoxHelper=function(b){var c=new a.BufferGeometry;c.addAttribute("position",new a.BufferAttribute(new Float32Array(72),3)),a.Line.call(this,c,new a.LineBasicMaterial({color:16776960}),a.LinePieces),void 0!==b&&this.update(b)},a.BoxHelper.prototype=Object.create(a.Line.prototype),a.BoxHelper.prototype.constructor=a.BoxHelper,a.BoxHelper.prototype.update=function(a){var b=a.geometry;null===b.boundingBox&&b.computeBoundingBox;var c=b.boundingBox.min,d=b.boundingBox.max,e=this.geometry.attributes.position.array;e[0]=d.x,e[1]=d.y,e[2]=d.z,e[3]=c.x,e[4]=d.y,e[5]=d.z,e[6]=c.x,e[7]=d.y,e[8]=d.z,e[9]=c.x,e[10]=c.y,e[11]=d.z,e[12]=c.x,e[13]=c.y,e[14]=d.z,e[15]=d.x,e[16]=c.y,e[17]=d.z,e[18]=d.x,e[19]=c.y,e[20]=d.z,e[21]=d.x,e[22]=d.y,e[23]=d.z,e[24]=d.x,e[25]=d.y,e[26]=c.z,e[27]=c.x,e[28]=d.y,e[29]=c.z,e[30]=c.x,e[31]=d.y,e[32]=c.z,e[33]=c.x,e[34]=c.y,e[35]=c.z,e[36]=c.x,e[37]=c.y,e[38]=c.z,e[39]=d.x,e[40]=c.y,e[41]=c.z,e[42]=d.x,e[43]=c.y,e[44]=c.z,e[45]=d.x,e[46]=d.y,e[47]=c.z,e[48]=d.x,e[49]=d.y,e[50]=d.z,e[51]=d.x,e[52]=d.y,e[53]=c.z,e[54]=c.x,e[55]=d.y,e[56]=d.z,e[57]=c.x,e[58]=d.y,e[59]=c.z,e[60]=c.x,e[61]=c.y,e[62]=d.z,e[63]=c.x,e[64]=c.y,e[65]=c.z,e[66]=d.x,e[67]=c.y,e[68]=d.z,e[69]=d.x,e[70]=c.y,e[71]=c.z,this.geometry.attributes.position.needsUpdate=!0,this.geometry.computeBoundingSphere,this.matrix=a.matrixWorld,this.matrixAutoUpdate=!1},a.BoundingBoxHelper=function(b,c){var d=void 0!==c?c:8947848;this.object=b,this.box=new a.Box3,a.Mesh.call(this,new a.BoxGeometry(1,1,1),new a.MeshBasicMaterial({color:d,wireframe:!0}))},a.BoundingBoxHelper.prototype=Object.create(a.Mesh.prototype),a.BoundingBoxHelper.prototype.constructor=a.BoundingBoxHelper,a.BoundingBoxHelper.prototype.update=function{this.box.setFromObject(this.object),this.box.size(this.scale),this.box.center(this.position)},a.CameraHelper=function(b){function c(a,b,c){d(a,c),d(b,c)}function d(b,c){e.vertices.push(new a.Vector3),e.colors.push(new a.Color(c)),void 0===g[b]&&(g[b]=[]),g[b].push(e.vertices.length-1)}var e=new a.Geometry,f=new a.LineBasicMaterial({color:16777215,vertexColors:a.FaceColors}),g={},h=16755200,i=16711680,j=43775,k=16777215,l=3355443;c("n1","n2",h),c("n2","n4",h),c("n4","n3",h),c("n3","n1",h),c("f1","f2",h),c("f2","f4",h),c("f4","f3",h),c("f3","f1",h),c("n1","f1",h),c("n2","f2",h),c("n3","f3",h),c("n4","f4",h),c("p","n1",i),c("p","n2",i),c("p","n3",i),c("p","n4",i),c("u1","u2",j),c("u2","u3",j),c("u3","u1",j),c("c","t",k),c("p","c",l),c("cn1","cn2",l),c("cn3","cn4",l),c("cf1","cf2",l),c("cf3","cf4",l),a.Line.call(this,e,f,a.LinePieces),this.camera=b,this.matrix=b.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=g,this.update},a.CameraHelper.prototype=Object.create(a.Line.prototype),a.CameraHelper.prototype.constructor=a.CameraHelper,a.CameraHelper.prototype.update=function{var b,c,d=new a.Vector3,e=new a.Camera,f=function(a,f,g,h){d.set(f,g,h).unproject(e);var i=c[a];if(void 0!==i)for(var j=0,k=i.length;k>j;j++)b.vertices[i[j]].copy(d)};return function{b=this.geometry,c=this.pointMap;var a=1,d=1;e.projectionMatrix.copy(this.camera.projectionMatrix),f("c",0,0,-1),f("t",0,0,1),f("n1",-a,-d,-1),f("n2",a,-d,-1),f("n3",-a,d,-1),f("n4",a,d,-1),f("f1",-a,-d,1),f("f2",a,-d,1),f("f3",-a,d,1),f("f4",a,d,1),f("u1",.7*a,1.1*d,-1),f("u2",.7*-a,1.1*d,-1),f("u3",0,2*d,-1),f("cf1",-a,0,1),f("cf2",a,0,1),f("cf3",0,-d,1),f("cf4",0,d,1),f("cn1",-a,0,-1),f("cn2",a,0,-1),f("cn3",0,-d,-1),f("cn4",0,d,-1),b.verticesNeedUpdate=!0}},a.DirectionalLightHelper=function(b,c){a.Object3D.call(this),this.light=b,this.light.updateMatrixWorld,this.matrix=b.matrixWorld,this.matrixAutoUpdate=!1,c=c||1;var d=new a.Geometry;d.vertices.push(new a.Vector3(-c,c,0),new a.Vector3(c,c,0),new a.Vector3(c,-c,0),new a.Vector3(-c,-c,0),new a.Vector3(-c,c,0));var e=new a.LineBasicMaterial({fog:!1});e.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.lightPlane=new a.Line(d,e),this.add(this.lightPlane),d=new a.Geometry,d.vertices.push(new a.Vector3,new a.Vector3),e=new a.LineBasicMaterial({fog:!1}),e.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine=new a.Line(d,e),this.add(this.targetLine),this.update},a.DirectionalLightHelper.prototype=Object.create(a.Object3D.prototype),a.DirectionalLightHelper.prototype.constructor=a.DirectionalLightHelper,a.DirectionalLightHelper.prototype.dispose=function{this.lightPlane.geometry.dispose,this.lightPlane.material.dispose,this.targetLine.geometry.dispose,this.targetLine.material.dispose},a.DirectionalLightHelper.prototype.update=function{var b=new a.Vector3,c=new a.Vector3,d=new a.Vector3;return function{b.setFromMatrixPosition(this.light.matrixWorld),c.setFromMatrixPosition(this.light.target.matrixWorld),d.subVectors(c,b),this.lightPlane.lookAt(d),this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine.geometry.vertices[1].copy(d),this.targetLine.geometry.verticesNeedUpdate=!0,this.targetLine.material.color.copy(this.lightPlane.material.color)}},a.EdgesHelper=function(b,c,d){var e=void 0!==c?c:16777215;d=void 0!==d?d:1;var f,g=Math.cos(a.Math.degToRad(d)),h=[0,0],i={},j=function(a,b){return a-b},k=["a","b","c"],l=new a.BufferGeometry;b.geometry instanceof a.BufferGeometry?(f=new a.Geometry,f.fromBufferGeometry(b.geometry)):f=b.geometry.clone,f.mergeVertices,f.computeFaceNormals;for(var m=f.vertices,n=f.faces,o=0,p=0,q=n.length;q>p;p++)for(var r=n[p],s=0;3>s;s++){h[0]=r[k[s]],h[1]=r[k[(s+1)%3]],h.sort(j);var t=h.toString;void 0===i[t]?(i[t]={vert1:h[0],vert2:h[1],face1:p,face2:void 0},o++):i[t].face2=p}var u=new Float32Array(2*o*3),v=0;for(var t in i){var w=i[t];if(void 0===w.face2||n[w.face1].normal.dot(n[w.face2].normal)<=g){var x=m[w.vert1];u[v++]=x.x,u[v++]=x.y,u[v++]=x.z,x=m[w.vert2],u[v++]=x.x,u[v++]=x.y,u[v++]=x.z}}l.addAttribute("position",new a.BufferAttribute(u,3)),a.Line.call(this,l,new a.LineBasicMaterial({color:e}),a.LinePieces),this.matrix=b.matrixWorld,this.matrixAutoUpdate=!1},a.EdgesHelper.prototype=Object.create(a.Line.prototype),a.EdgesHelper.prototype.constructor=a.EdgesHelper,a.FaceNormalsHelper=function(b,c,d,e){this.object=b,this.size=void 0!==c?c:1;for(var f=void 0!==d?d:16776960,g=void 0!==e?e:1,h=new a.Geometry,i=this.object.geometry.faces,j=0,k=i.length;k>j;j++)h.vertices.push(new a.Vector3,new a.Vector3);a.Line.call(this,h,new a.LineBasicMaterial({color:f,linewidth:g}),a.LinePieces),this.matrixAutoUpdate=!1,this.normalMatrix=new a.Matrix3,this.update},a.FaceNormalsHelper.prototype=Object.create(a.Line.prototype),a.FaceNormalsHelper.prototype.constructor=a.FaceNormalsHelper,a.FaceNormalsHelper.prototype.update=function{var a=this.geometry.vertices,b=this.object,c=b.geometry.vertices,d=b.geometry.faces,e=b.matrixWorld;b.updateMatrixWorld(!0),this.normalMatrix.getNormalMatrix(e);for(var f=0,g=0,h=d.length;h>f;f++,g+=2){var i=d[f];a[g].copy(c[i.a]).add(c[i.b]).add(c[i.c]).divideScalar(3).applyMatrix4(e),a[g+1].copy(i.normal).applyMatrix3(this.normalMatrix).normalize.multiplyScalar(this.size).add(a[g])}return this.geometry.verticesNeedUpdate=!0,this},a.GridHelper=function(b,c){var d=new a.Geometry,e=new a.LineBasicMaterial({vertexColors:a.VertexColors});this.color1=new a.Color(4473924),this.color2=new a.Color(8947848);for(var f=-b;b>=f;f+=c){d.vertices.push(new a.Vector3(-b,0,f),new a.Vector3(b,0,f),new a.Vector3(f,0,-b),new a.Vector3(f,0,b));var g=0===f?this.color1:this.color2;d.colors.push(g,g,g,g)}a.Line.call(this,d,e,a.LinePieces)},a.GridHelper.prototype=Object.create(a.Line.prototype),a.GridHelper.prototype.constructor=a.GridHelper,a.GridHelper.prototype.setColors=function(a,b){this.color1.set(a),this.color2.set(b),this.geometry.colorsNeedUpdate=!0},a.HemisphereLightHelper=function(b,c){a.Object3D.call(this),this.light=b,this.light.updateMatrixWorld,this.matrix=b.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new a.Color,new a.Color];var d=new a.SphereGeometry(c,4,2);d.applyMatrix((new a.Matrix4).makeRotationX(-Math.PI/2));for(var e=0,f=8;f>e;e++)d.faces[e].color=this.colors[4>e?0:1];var g=new a.MeshBasicMaterial({vertexColors:a.FaceColors,wireframe:!0});this.lightSphere=new a.Mesh(d,g),this.add(this.lightSphere),this.update},a.HemisphereLightHelper.prototype=Object.create(a.Object3D.prototype),a.HemisphereLightHelper.prototype.constructor=a.HemisphereLightHelper,a.HemisphereLightHelper.prototype.dispose=function{this.lightSphere.geometry.dispose,this.lightSphere.material.dispose},a.HemisphereLightHelper.prototype.update=function{var b=new a.Vector3;return function{this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity),this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity),this.lightSphere.lookAt(b.setFromMatrixPosition(this.light.matrixWorld).negate),this.lightSphere.geometry.colorsNeedUpdate=!0}},a.PointLightHelper=function(b,c){this.light=b,this.light.updateMatrixWorld;var d=new a.SphereGeometry(c,4,2),e=new a.MeshBasicMaterial({wireframe:!0,fog:!1});e.color.copy(this.light.color).multiplyScalar(this.light.intensity),a.Mesh.call(this,d,e),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1},a.PointLightHelper.prototype=Object.create(a.Mesh.prototype),a.PointLightHelper.prototype.constructor=a.PointLightHelper,a.PointLightHelper.prototype.dispose=function{this.geometry.dispose,this.material.dispose},a.PointLightHelper.prototype.update=function{this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},a.SkeletonHelper=function(b){this.bones=this.getBoneList(b);for(var c=new a.Geometry,d=0;d<this.bones.length;d++){var e=this.bones[d];e.parent instanceof a.Bone&&(c.vertices.push(new a.Vector3),c.vertices.push(new a.Vector3),c.colors.push(new a.Color(0,0,1)),c.colors.push(new a.Color(0,1,0)))}var f=new a.LineBasicMaterial({vertexColors:a.VertexColors,depthTest:!1,depthWrite:!1,transparent:!0});a.Line.call(this,c,f,a.LinePieces),this.root=b,this.matrix=b.matrixWorld,this.matrixAutoUpdate=!1,this.update},a.SkeletonHelper.prototype=Object.create(a.Line.prototype),a.SkeletonHelper.prototype.constructor=a.SkeletonHelper,a.SkeletonHelper.prototype.getBoneList=function(b){var c=[];b instanceof a.Bone&&c.push(b);for(var d=0;d<b.children.length;d++)c.push.apply(c,this.getBoneList(b.children[d]));return c},a.SkeletonHelper.prototype.update=function{for(var b=this.geometry,c=(new a.Matrix4).getInverse(this.root.matrixWorld),d=new a.Matrix4,e=0,f=0;f<this.bones.length;f++){var g=this.bones[f];g.parent instanceof a.Bone&&(d.multiplyMatrices(c,g.matrixWorld),b.vertices[e].setFromMatrixPosition(d),d.multiplyMatrices(c,g.parent.matrixWorld),b.vertices[e+1].setFromMatrixPosition(d),e+=2)}b.verticesNeedUpdate=!0,b.computeBoundingSphere},a.SpotLightHelper=function(b){a.Object3D.call(this),this.light=b,this.light.updateMatrixWorld,this.matrix=b.matrixWorld,this.matrixAutoUpdate=!1;var c=new a.CylinderGeometry(0,1,1,8,1,!0);c.applyMatrix((new a.Matrix4).makeTranslation(0,-.5,0)),c.applyMatrix((new a.Matrix4).makeRotationX(-Math.PI/2));var d=new a.MeshBasicMaterial({wireframe:!0,fog:!1});this.cone=new a.Mesh(c,d),this.add(this.cone),this.update},a.SpotLightHelper.prototype=Object.create(a.Object3D.prototype),a.SpotLightHelper.prototype.constructor=a.SpotLightHelper,a.SpotLightHelper.prototype.dispose=function{this.cone.geometry.dispose,this.cone.material.dispose},a.SpotLightHelper.prototype.update=function{var b=new a.Vector3,c=new a.Vector3;return function{var a=this.light.distance?this.light.distance:1e4,d=a*Math.tan(this.light.angle);this.cone.scale.set(d,d,a),b.setFromMatrixPosition(this.light.matrixWorld),c.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(c.sub(b)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}},a.VertexNormalsHelper=function(b,c,d,e){this.object=b,this.size=void 0!==c?c:1;for(var f=void 0!==d?d:16711680,g=void 0!==e?e:1,h=new a.Geometry,i=b.geometry.faces,j=0,k=i.length;k>j;j++)for(var l=i[j],m=0,n=l.vertexNormals.length;n>m;m++)h.vertices.push(new a.Vector3,new a.Vector3);a.Line.call(this,h,new a.LineBasicMaterial({color:f,linewidth:g}),a.LinePieces),this.matrixAutoUpdate=!1,this.normalMatrix=new a.Matrix3,this.update},a.VertexNormalsHelper.prototype=Object.create(a.Line.prototype),a.VertexNormalsHelper.prototype.constructor=a.VertexNormalsHelper,a.VertexNormalsHelper.prototype.update=function(b){var c=new a.Vector3;return function(a){var b=["a","b","c","d"];this.object.updateMatrixWorld(!0),this.normalMatrix.getNormalMatrix(this.object.matrixWorld);for(var d=this.geometry.vertices,e=this.object.geometry.vertices,f=this.object.geometry.faces,g=this.object.matrixWorld,h=0,i=0,j=f.length;j>i;i++)for(var k=f[i],l=0,m=k.vertexNormals.length;m>l;l++){var n=k[b[l]],o=e[n],p=k.vertexNormals[l];d[h].copy(o).applyMatrix4(g),c.copy(p).applyMatrix3(this.normalMatrix).normalize.multiplyScalar(this.size),c.add(d[h]),h+=1,d[h].copy(c),h+=1}return this.geometry.verticesNeedUpdate=!0,this}},a.VertexTangentsHelper=function(b,c,d,e){this.object=b,this.size=void 0!==c?c:1;for(var f=void 0!==d?d:255,g=void 0!==e?e:1,h=new a.Geometry,i=b.geometry.faces,j=0,k=i.length;k>j;j++)for(var l=i[j],m=0,n=l.vertexTangents.length;n>m;m++)h.vertices.push(new a.Vector3),h.vertices.push(new a.Vector3);a.Line.call(this,h,new a.LineBasicMaterial({color:f,linewidth:g}),a.LinePieces),this.matrixAutoUpdate=!1,this.update},a.VertexTangentsHelper.prototype=Object.create(a.Line.prototype),a.VertexTangentsHelper.prototype.constructor=a.VertexTangentsHelper,a.VertexTangentsHelper.prototype.update=function(b){var c=new a.Vector3;return function(a){var b=["a","b","c","d"];this.object.updateMatrixWorld(!0);for(var d=this.geometry.vertices,e=this.object.geometry.vertices,f=this.object.geometry.faces,g=this.object.matrixWorld,h=0,i=0,j=f.length;j>i;i++)for(var k=f[i],l=0,m=k.vertexTangents.length;m>l;l++){var n=k[b[l]],o=e[n],p=k.vertexTangents[l];d[h].copy(o).applyMatrix4(g),c.copy(p).transformDirection(g).multiplyScalar(this.size),c.add(d[h]),h+=1,d[h].copy(c),h+=1}return this.geometry.verticesNeedUpdate=!0,this}},a.WireframeHelper=function(b,c){var d=void 0!==c?c:16777215,e=[0,0],f={},g=function(a,b){return a-b},h=["a","b","c"],i=new a.BufferGeometry;if(b.geometry instanceof a.Geometry){for(var j=b.geometry.vertices,k=b.geometry.faces,l=0,m=new Uint32Array(6*k.length),n=0,o=k.length;o>n;n++)for(var p=k[n],q=0;3>q;q++){e[0]=p[h[q]],e[1]=p[h[(q+1)%3]],e.sort(g);var r=e.toString;void 0===f[r]&&(m[2*l]=e[0],m[2*l+1]=e[1],f[r]=!0,l++)}for(var s=new Float32Array(2*l*3),n=0,o=l;o>n;n++)for(var q=0;2>q;q++){var t=j[m[2*n+q]],u=6*n+3*q;s[u+0]=t.x,s[u+1]=t.y,s[u+2]=t.z}i.addAttribute("position",new a.BufferAttribute(s,3))}else if(b.geometry instanceof a.BufferGeometry)if(void 0!==b.geometry.attributes.index){var j=b.geometry.attributes.position.array,v=b.geometry.attributes.index.array,w=b.geometry.drawcalls,l=0;0===w.length&&(w=[{count:v.length,index:0,start:0}]);for(var m=new Uint32Array(2*v.length),x=0,y=w.length;y>x;++x)for(var z=w[x].start,A=w[x].count,u=w[x].index,n=z,B=z+A;B>n;n+=3)for(var q=0;3>q;q++){e[0]=u+v[n+q],e[1]=u+v[n+(q+1)%3],e.sort(g);var r=e.toString;void 0===f[r]&&(m[2*l]=e[0],m[2*l+1]=e[1],f[r]=!0,l++)}for(var s=new Float32Array(2*l*3),n=0,o=l;o>n;n++)for(var q=0;2>q;q++){var u=6*n+3*q,C=3*m[2*n+q];s[u+0]=j[C],s[u+1]=j[C+1],s[u+2]=j[C+2]}i.addAttribute("position",new a.BufferAttribute(s,3))}else{for(var j=b.geometry.attributes.position.array,l=j.length/3,D=l/3,s=new Float32Array(2*l*3),n=0,o=D;o>n;n++)for(var q=0;3>q;q++){var u=18*n+6*q,E=9*n+3*q;s[u+0]=j[E],s[u+1]=j[E+1],s[u+2]=j[E+2];var C=9*n+3*((q+1)%3);s[u+3]=j[C],s[u+4]=j[C+1],s[u+5]=j[C+2]}i.addAttribute("position",new a.BufferAttribute(s,3))}a.Line.call(this,i,new a.LineBasicMaterial({color:d}),a.LinePieces),this.matrix=b.matrixWorld,this.matrixAutoUpdate=!1},a.WireframeHelper.prototype=Object.create(a.Line.prototype),a.WireframeHelper.prototype.constructor=a.WireframeHelper,a.ImmediateRenderObject=function{a.Object3D.call(this),this.render=function(a){}},a.ImmediateRenderObject.prototype=Object.create(a.Object3D.prototype),a.ImmediateRenderObject.prototype.constructor=a.ImmediateRenderObject,a.MorphBlendMesh=function(b,c){a.Mesh.call(this,b,c),this.animationsMap={},this.animationsList=[];var d=this.geometry.morphTargets.length,e="__default",f=0,g=d-1,h=d/1;this.createAnimation(e,f,g,h),this.setAnimationWeight(e,1)},a.MorphBlendMesh.prototype=Object.create(a.Mesh.prototype),a.MorphBlendMesh.prototype.constructor=a.MorphBlendMesh,a.MorphBlendMesh.prototype.createAnimation=function(a,b,c,d){var e={startFrame:b,endFrame:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[a]=e,this.animationsList.push(e)},a.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b,c=/([a-z]+)_?(\d+)/,d={},e=this.geometry,f=0,g=e.morphTargets.length;g>f;f++){var h=e.morphTargets[f],i=h.name.match(c);if(i&&i.length>1){var j=i[1];d[j]||(d[j]={start:1/0,end:-(1/0)});var k=d[j];f<k.start&&(k.start=f),f>k.end&&(k.end=f),b||(b=j)}}for(var j in d){var k=d[j];this.createAnimation(j,k.start,k.end,a)}this.firstAnimation=b},a.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){var b=this.animationsMap[a];b&&(b.direction=1,b.directionBackwards=!1)},a.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(a){var b=this.animationsMap[a];b&&(b.direction=-1,b.directionBackwards=!0)},a.MorphBlendMesh.prototype.setAnimationFPS=function(a,b){var c=this.animationsMap[a];c&&(c.fps=b,c.duration=(c.end-c.start)/c.fps)},a.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];c&&(c.duration=b,c.fps=(c.end-c.start)/c.duration)},a.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];c&&(c.weight=b)},a.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];c&&(c.time=b)},a.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0,c=this.animationsMap[a];return c&&(b=c.time),b},a.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1,c=this.animationsMap[a];return c&&(b=c.duration),b},a.MorphBlendMesh.prototype.playAnimation=function(b){var c=this.animationsMap[b];c?(c.time=0,c.active=!0):a.warn("THREE.MorphBlendMesh: animation["+b+"] undefined in .playAnimation")},a.MorphBlendMesh.prototype.stopAnimation=function(a){var b=this.animationsMap[a];b&&(b.active=!1)},a.MorphBlendMesh.prototype.update=function(b){for(var c=0,d=this.animationsList.length;d>c;c++){var e=this.animationsList[c];if(e.active){var f=e.duration/e.length;e.time+=e.direction*b,e.mirroredLoop?(e.time>e.duration||e.time<0)&&(e.direction*=-1,e.time>e.duration&&(e.time=e.duration,e.directionBackwards=!0),e.time<0&&(e.time=0,e.directionBackwards=!1)):(e.time=e.time%e.duration,e.time<0&&(e.time+=e.duration));var g=e.startFrame+a.Math.clamp(Math.floor(e.time/f),0,e.length-1),h=e.weight;g!==e.currentFrame&&(this.morphTargetInfluences[e.lastFrame]=0,this.morphTargetInfluences[e.currentFrame]=1*h,this.morphTargetInfluences[g]=0,e.lastFrame=e.currentFrame,e.currentFrame=g);var i=e.time%f/f;e.directionBackwards&&(i=1-i),this.morphTargetInfluences[e.currentFrame]=i*h,this.morphTargetInfluences[e.lastFrame]=(1-i)*h}}},this.THREE=a},e}),function{var b=a.amdDefine;!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a;else if("function"==typeof b&&b.amd)b("18",[],a);else{var c;"undefined"!=typeof window?c=window:"undefined"!=typeof global?c=global:"undefined"!=typeof self&&(c=self),c.JSZip=a}}(function{return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";c.encode=function(a,b){for(var c,e,f,g,h,i,j,k="",l=0;l<a.length;)c=a.charCodeAt(l++),e=a.charCodeAt(l++),f=a.charCodeAt(l++),g=c>>2,h=(3&c)<<4|e>>4,i=(15&e)<<2|f>>6,j=63&f,isNaN(e)?i=j=64:isNaN(f)&&(j=64),k=k+d.charAt(g)+d.charAt(h)+d.charAt(i)+d.charAt(j);return k},c.decode=function(a,b){var c,e,f,g,h,i,j,k="",l=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<a.length;)g=d.indexOf(a.charAt(l++)),h=d.indexOf(a.charAt(l++)),i=d.indexOf(a.charAt(l++)),j=d.indexOf(a.charAt(l++)),c=g<<2|h>>4,e=(15&h)<<4|i>>2,f=(3&i)<<6|j,k+=String.fromCharCode(c),64!=i&&(k+=String.fromCharCode(e)),64!=j&&(k+=String.fromCharCode(f));return k}},{}],2:[function(a,b,c){"use strict";function d{this.compressedSize=0,this.uncompressedSize=0,this.crc32=0,this.compressionMethod=null,this.compressedContent=null}d.prototype={getContent:function{return null},getCompressedContent:function{return null}},b.exports=d},{}],3:[function(a,b,c){"use strict";c.STORE={magic:"\x00\x00",compress:function(a,b){return a},uncompress:function(a){return a},compressInputType:null,uncompressInputType:null},c.DEFLATE=a("./flate")},{"./flate":8}],4:[function(a,b,c){"use strict";var d=a("./utils"),e=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];b.exports=function(a,b){if("undefined"==typeof a||!a.length)return 0;var c="string"!==d.getTypeOf(a);"undefined"==typeof b&&(b=0);var f=0,g=0,h=0;b=-1^b;for(var i=0,j=a.length;j>i;i++)h=c?a[i]:a.charCodeAt(i),g=255&(b^h),f=e[g],b=b>>>8^f;return-1^b}},{"./utils":21}],5:[function(a,b,c){"use strict";function d(a){this.data=null,this.length=0,this.index=0}var e=a("./utils");d.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<a||0>a)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(a){},readInt:function(a){var b,c=0;for(this.checkOffset(a),b=this.index+a-1;b>=this.index;b--)c=(c<<8)+this.byteAt(b);return this.index+=a,c},readString:function(a){return e.transformTo("string",this.readData(a))},readData:function(a){},lastIndexOfSignature:function(a){},readDate:function{var a=this.readInt(4);return new Date((a>>25&127)+1980,(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1)}},b.exports=d},{"./utils":21}],6:[function(a,b,c){"use strict";c.base64=!1,c.binary=!1,c.dir=!1,c.createFolders=!1,c.date=null,c.compression=null,c.compressionOptions=null,c.comment=null,c.unixPermissions=null,c.dosPermissions=null},{}],7:[function(a,b,c){"use strict";var d=a("./utils");c.string2binary=function(a){return d.string2binary(a)},c.string2Uint8Array=function(a){return d.transformTo("uint8array",a)},c.uint8Array2String=function(a){return d.transformTo("string",a)},c.string2Blob=function(a){var b=d.transformTo("arraybuffer",a);return d.arrayBuffer2Blob(b)},c.arrayBuffer2Blob=function(a){return d.arrayBuffer2Blob(a)},c.transformTo=function(a,b){return d.transformTo(a,b)},c.getTypeOf=function(a){return d.getTypeOf(a)},c.checkSupport=function(a){return d.checkSupport(a)},c.MAX_VALUE_16BITS=d.MAX_VALUE_16BITS,c.MAX_VALUE_32BITS=d.MAX_VALUE_32BITS,c.pretty=function(a){return d.pretty(a)},c.findCompression=function(a){return d.findCompression(a)},c.isRegExp=function(a){return d.isRegExp(a)}},{"./utils":21}],8:[function(a,b,c){"use strict";var d="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,e=a("pako");c.uncompressInputType=d?"uint8array":"array",c.compressInputType=d?"uint8array":"array",c.magic="\b\x00",c.compress=function(a,b){return e.deflateRaw(a,{level:b.level||-1})},c.uncompress=function(a){return e.inflateRaw(a)}},{pako:24}],9:[function(a,b,c){"use strict";function d(a,b){return this instanceof d?(this.files={},this.comment=null,this.root="",a&&this.load(a,b),void(this.clone=function{var a=new d;for(var b in this)"function"!=typeof this[b]&&(a[b]=this[b]);return a})):new d(a,b)}var e=a("./base64");d.prototype=a("./object"),d.prototype.load=a("./load"),d.support=a("./support"),d.defaults=a("./defaults"),d.utils=a("./deprecatedPublicUtils"),d.base64={encode:function(a){return e.encode(a)},decode:function(a){return e.decode(a)}},d.compressions=a("./compressions"),b.exports=d},{"./base64":1,"./compressions":3,"./defaults":6,"./deprecatedPublicUtils":7,"./load":10,"./object":13,"./support":17}],10:[function(a,b,c){"use strict";var d=a("./base64"),e=a("./zipEntries");b.exports=function(a,b){var c,f,g,h;for(b=b||{},b.base64&&(a=d.decode(a)),f=new e(a,b),c=f.files,g=0;g<c.length;g++)h=c[g],this.file(h.fileName,h.decompressed,{binary:!0,optimizedBinaryString:!0,date:h.date,dir:h.dir,comment:h.fileComment.length?h.fileComment:null,unixPermissions:h.unixPermissions,dosPermissions:h.dosPermissions,createFolders:b.createFolders});return f.zipComment.length&&(this.comment=f.zipComment),this}},{"./base64":1,"./zipEntries":22}],11:[function(a,b,c){(function(a){"use strict";b.exports=function(b,c){return new a(b,c)},b.exports.test=function(b){return a.isBuffer(b)}}).call(this,"undefined"!=typeof Buffer?Buffer:void 0)},{}],12:[function(a,b,c){"use strict";function d(a){this.data=a,this.length=this.data.length,this.index=0}var e=a("./uint8ArrayReader");d.prototype=new e,d.prototype.readData=function(a){this.checkOffset(a);var b=this.data.slice(this.index,this.index+a);return this.index+=a,b},b.exports=d},{"./uint8ArrayReader":18}],13:,14:[function(a,b,c){"use strict";c.LOCAL_FILE_HEADER="PK��",c.CENTRAL_FILE_HEADER="PK��",c.CENTRAL_DIRECTORY_END="PK��",c.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK��",c.ZIP64_CENTRAL_DIRECTORY_END="PK��",c.DATA_DESCRIPTOR="PK�\b"},{}],15:[function(a,b,c){"use strict";function d(a,b){this.data=a,b||(this.data=f.string2binary(this.data)),this.length=this.data.length,this.index=0}var e=a("./dataReader"),f=a("./utils");d.prototype=new e,d.prototype.byteAt=function(a){return this.data.charCodeAt(a)},d.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)},d.prototype.readData=function(a){this.checkOffset(a);var b=this.data.slice(this.index,this.index+a);return this.index+=a,b},b.exports=d},{"./dataReader":5,"./utils":21}],16:[function(a,b,c){"use strict";var d=a("./utils"),e=function{this.data=[]};e.prototype={append:function(a){a=d.transformTo("string",a),this.data.push(a)},finalize:function{return this.data.join("")}},b.exports=e},{"./utils":21}],17:[function(a,b,c){(function(a){"use strict";if(c.base64=!0,c.array=!0,c.string=!0,c.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,c.nodebuffer="undefined"!=typeof a,c.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)c.blob=!1;else{var b=new ArrayBuffer(0);try{c.blob=0===new Blob([b],{type:"application/zip"}).size}catch(d){try{var e=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,f=new e;f.append(b),c.blob=0===f.getBlob("application/zip").size}catch(d){c.blob=!1}}}}).call(this,"undefined"!=typeof Buffer?Buffer:void 0)},{}],18:[function(a,b,c){"use strict";function d(a){a&&(this.data=a,this.length=this.data.length,this.index=0)}var e=a("./dataReader");d.prototype=new e,d.prototype.byteAt=function(a){return this.data[a]},d.prototype.lastIndexOfSignature=function(a){for(var b=a.charCodeAt(0),c=a.charCodeAt(1),d=a.charCodeAt(2),e=a.charCodeAt(3),f=this.length-4;f>=0;--f)if(this.data[f]===b&&this.data[f+1]===c&&this.data[f+2]===d&&this.data[f+3]===e)return f;return-1},d.prototype.readData=function(a){if(this.checkOffset(a),0===a)return new Uint8Array(0);var b=this.data.subarray(this.index,this.index+a);return this.index+=a,b},b.exports=d},{"./dataReader":5}],19:[function(a,b,c){"use strict";var d=a("./utils"),e=function(a){this.data=new Uint8Array(a),this.index=0};e.prototype={append:function(a){0!==a.length&&(a=d.transformTo("uint8array",a),this.data.set(a,this.index),this.index+=a.length)},finalize:function{return this.data}},b.exports=e},{"./utils":21}],20:[function(a,b,c){"use strict";for(var d=a("./utils"),e=a("./support"),f=a("./nodeBuffer"),g=new Array(256),h=0;256>h;h++)g[h]=h>=252?6:h>=248?5:h>=240?4:h>=224?3:h>=192?2:1;g[254]=g[254]=1;var i=function(a){var b,c,d,f,g,h=a.length,i=0;for(f=0;h>f;f++)c=a.charCodeAt(f),55296===(64512&c)&&h>f+1&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),i+=128>c?1:2048>c?2:65536>c?3:4;for(b=e.uint8array?new Uint8Array(i):new Array(i),g=0,f=0;i>g;f++)c=a.charCodeAt(f),55296===(64512&c)&&h>f+1&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),128>c?b[g++]=c:2048>c?(b[g++]=192|c>>>6,b[g++]=128|63&c):65536>c?(b[g++]=224|c>>>12,b[g++]=128|c>>>6&63,b[g++]=128|63&c):(b[g++]=240|c>>>18,b[g++]=128|c>>>12&63,b[g++]=128|c>>>6&63,b[g++]=128|63&c);return b},j=function(a,b){var c;for(b=b||a.length,b>a.length&&(b=a.length),c=b-1;c>=0&&128===(192&a[c]);)c--;return 0>c?b:0===c?b:c+g[a[c]]>b?c:b},k=function(a){var b,c,e,f,h=a.length,i=new Array(2*h);for(c=0,b=0;h>b;)if(e=a[b++],128>e)i[c++]=e;else if(f=g[e],f>4)i[c++]=65533,b+=f-1;else{for(e&=2===f?31:3===f?15:7;f>1&&h>b;)e=e<<6|63&a[b++],f--;f>1?i[c++]=65533:65536>e?i[c++]=e:(e-=65536,i[c++]=55296|e>>10&1023,i[c++]=56320|1023&e)}return i.length!==c&&(i.subarray?i=i.subarray(0,c):i.length=c),d.applyFromCharCode(i)};c.utf8encode=function(a){return e.nodebuffer?f(a,"utf-8"):i(a)},c.utf8decode=function(a){if(e.nodebuffer)return d.transformTo("nodebuffer",a).toString("utf-8");a=d.transformTo(e.uint8array?"uint8array":"array",a);for(var b=[],c=0,f=a.length,g=65536;f>c;){var h=j(a,Math.min(c+g,f));e.uint8array?b.push(k(a.subarray(c,h))):b.push(k(a.slice(c,h))),c=h}return b.join("")}},{"./nodeBuffer":11,"./support":17,"./utils":21}],21:[function(a,b,c){"use strict";function d(a){return a}function e(a,b){for(var c=0;c<a.length;++c)b[c]=255&a.charCodeAt(c);return b}function f(a){var b=65536,d=[],e=a.length,f=c.getTypeOf(a),g=0,h=!0;try{switch(f){case"uint8array":String.fromCharCode.apply(null,new Uint8Array(0));break;case"nodebuffer":String.fromCharCode.apply(null,j(0))}}catch(i){h=!1}if(!h){for(var k="",l=0;l<a.length;l++)k+=String.fromCharCode(a[l]);return k}for(e>g&&b>1;)try{"array"===f||"nodebuffer"===f?d.push(String.fromCharCode.apply(null,a.slice(g,Math.min(g+b,e)))):d.push(String.fromCharCode.apply(null,a.subarray(g,Math.min(g+b,e)))),g+=b}catch(i){b=Math.floor(b/2)}return d.join("")}function g(a,b){for(var c=0;c<a.length;c++)b[c]=a[c];return b}var h=a("./support"),i=a("./compressions"),j=a("./nodeBuffer");c.string2binary=function(a){for(var b="",c=0;c<a.length;c++)b+=String.fromCharCode(255&a.charCodeAt(c));return b},c.arrayBuffer2Blob=function(a,b){c.checkSupport("blob"),b=b||"application/zip";try{return new Blob([a],{type:b})}catch(d){try{var e=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,f=new e;return f.append(a),f.getBlob(b)}catch(d){throw new Error("Bug : can't construct the Blob.")}}},c.applyFromCharCode=f;var k={};k.string={string:d,array:function(a){return e(a,new Array(a.length))},arraybuffer:function(a){return k.string.uint8array(a).buffer},uint8array:function(a){return e(a,new Uint8Array(a.length))},nodebuffer:function(a){return e(a,j(a.length))}},k.array={string:f,array:d,arraybuffer:function(a){return new Uint8Array(a).buffer},uint8array:function(a){return new Uint8Array(a)},nodebuffer:function(a){return j(a)}},k.arraybuffer={string:function(a){return f(new Uint8Array(a))},array:function(a){return g(new Uint8Array(a),new Array(a.byteLength))},arraybuffer:d,uint8array:function(a){return new Uint8Array(a)},nodebuffer:function(a){return j(new Uint8Array(a))}},k.uint8array={string:f,array:function(a){return g(a,new Array(a.length))},arraybuffer:function(a){return a.buffer},uint8array:d,nodebuffer:function(a){return j(a)}},k.nodebuffer={string:f,array:function(a){return g(a,new Array(a.length))},arraybuffer:function(a){return k.nodebuffer.uint8array(a).buffer},uint8array:function(a){return g(a,new Uint8Array(a.length))},nodebuffer:d},c.transformTo=function(a,b){if(b||(b=""),!a)return b;c.checkSupport(a);var d=c.getTypeOf(b),e=k[d][a](b);return e},c.getTypeOf=function(a){return"string"==typeof a?"string":"[object Array]"===Object.prototype.toString.call(a)?"array":h.nodebuffer&&j.test(a)?"nodebuffer":h.uint8array&&a instanceof Uint8Array?"uint8array":h.arraybuffer&&a instanceof ArrayBuffer?"arraybuffer":void 0},c.checkSupport=function(a){var b=h[a.toLowerCase];if(!b)throw new Error(a+" is not supported by this browser")},c.MAX_VALUE_16BITS=65535,c.MAX_VALUE_32BITS=-1,c.pretty=function(a){var b,c,d="";for(c=0;c<(a||"").length;c++)b=a.charCodeAt(c),d+="\\x"+(16>b?"0":"")+b.toString(16).toUpperCase;return d},c.findCompression=function(a){for(var b in i)if(i.hasOwnProperty(b)&&i[b].magic===a)return i[b];return null},c.isRegExp=function(a){return"[object RegExp]"===Object.prototype.toString.call(a)}},{"./compressions":3,"./nodeBuffer":11,"./support":17}],22:[function(a,b,c){"use strict";function d(a,b){this.files=[],this.loadOptions=b,a&&this.load(a)}var e=a("./stringReader"),f=a("./nodeBufferReader"),g=a("./uint8ArrayReader"),h=a("./utils"),i=a("./signature"),j=a("./zipEntry"),k=a("./support"),l=a("./object");d.prototype={checkSignature:function(a){var b=this.reader.readString(4);if(b!==a)throw new Error("Corrupted zip or bug : unexpected signature ("+h.pretty(b)+", expected "+h.pretty(a)+")")},readBlockEndOfCentral:function{this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2),this.zipComment=this.reader.readString(this.zipCommentLength),this.zipComment=l.utf8decode(this.zipComment)},readBlockZip64EndOfCentral:function{this.zip64EndOfCentralSize=this.reader.readInt(8),this.versionMadeBy=this.reader.readString(2),this.versionNeeded=this.reader.readInt(2),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var a,b,c,d=this.zip64EndOfCentralSize-44,e=0;d>e;)a=this.reader.readInt(2),b=this.reader.readInt(4),c=this.reader.readString(b),this.zip64ExtensibleData[a]={id:a,length:b,value:c}},readBlockZip64EndOfCentralLocator:function{if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function{var a,b;for(a=0;a<this.files.length;a++)b=this.files[a],this.reader.setIndex(b.localHeaderOffset),this.checkSignature(i.LOCAL_FILE_HEADER),b.readLocalPart(this.reader),b.handleUTF8,b.processAttributes},readCentralDir:function{var a;for(this.reader.setIndex(this.centralDirOffset);this.reader.readString(4)===i.CENTRAL_FILE_HEADER;)a=new j({zip64:this.zip64},this.loadOptions),a.readCentralPart(this.reader),this.files.push(a)},readEndOfCentral:function{var a=this.reader.lastIndexOfSignature(i.CENTRAL_DIRECTORY_END);if(-1===a){var b=!0;try{this.reader.setIndex(0),this.checkSignature(i.LOCAL_FILE_HEADER),b=!1}catch(c){}throw b?new Error("Can't find end of central directory : is this a zip file ? If it is, see http://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip : can't find end of central directory")}if(this.reader.setIndex(a),this.checkSignature(i.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral,this.diskNumber===h.MAX_VALUE_16BITS||this.diskWithCentralDirStart===h.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===h.MAX_VALUE_16BITS||this.centralDirRecords===h.MAX_VALUE_16BITS||this.centralDirSize===h.MAX_VALUE_32BITS||this.centralDirOffset===h.MAX_VALUE_32BITS){if(this.zip64=!0,a=this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR),-1===a)throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator");this.reader.setIndex(a),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator,this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral}},prepareReader:function(a){var b=h.getTypeOf(a);"string"!==b||k.uint8array?"nodebuffer"===b?this.reader=new f(a):this.reader=new g(h.transformTo("uint8array",a)):this.reader=new e(a,this.loadOptions.optimizedBinaryString)},load:function(a){this.prepareReader(a),this.readEndOfCentral,this.readCentralDir,this.readLocalFiles}},b.exports=d},{"./nodeBufferReader":12,"./object":13,"./signature":14,"./stringReader":15,"./support":17,"./uint8ArrayReader":18,"./utils":21,"./zipEntry":23}],23:[function(a,b,c){"use strict";function d(a,b){this.options=a,this.loadOptions=b}var e=a("./stringReader"),f=a("./utils"),g=a("./compressedObject"),h=a("./object"),i=0,j=3;d.prototype={isEncrypted:function{return 1===(1&this.bitFlag)},useUTF8:function{return 2048===(2048&this.bitFlag)},prepareCompressedContent:function(a,b,c){return function{var d=a.index;a.setIndex(b);var e=a.readData(c);return a.setIndex(d),e}},prepareContent:function(a,b,c,d,e){return function{var a=f.transformTo(d.uncompressInputType,this.getCompressedContent),b=d.uncompress(a);if(b.length!==e)throw new Error("Bug : uncompressed data size mismatch");return b}},readLocalPart:function(a){var b,c;if(a.skip(22),this.fileNameLength=a.readInt(2),c=a.readInt(2),this.fileName=a.readString(this.fileNameLength),a.skip(c),-1==this.compressedSize||-1==this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory (compressedSize == -1 || uncompressedSize == -1)");if(b=f.findCompression(this.compressionMethod),null===b)throw new Error("Corrupted zip : compression "+f.pretty(this.compressionMethod)+" unknown (inner file : "+this.fileName+")");if(this.decompressed=new g,this.decompressed.compressedSize=this.compressedSize,this.decompressed.uncompressedSize=this.uncompressedSize,this.decompressed.crc32=this.crc32,this.decompressed.compressionMethod=this.compressionMethod,this.decompressed.getCompressedContent=this.prepareCompressedContent(a,a.index,this.compressedSize,b),this.decompressed.getContent=this.prepareContent(a,a.index,this.compressedSize,b,this.uncompressedSize),this.loadOptions.checkCRC32&&(this.decompressed=f.transformTo("string",this.decompressed.getContent),h.crc32(this.decompressed)!==this.crc32))throw new Error("Corrupted zip : CRC32 mismatch")},readCentralPart:function(a){if(this.versionMadeBy=a.readInt(2),this.versionNeeded=a.readInt(2),this.bitFlag=a.readInt(2),this.compressionMethod=a.readString(2),this.date=a.readDate,this.crc32=a.readInt(4),this.compressedSize=a.readInt(4),this.uncompressedSize=a.readInt(4),this.fileNameLength=a.readInt(2),this.extraFieldsLength=a.readInt(2),this.fileCommentLength=a.readInt(2),this.diskNumberStart=a.readInt(2),this.internalFileAttributes=a.readInt(2),this.externalFileAttributes=a.readInt(4),this.localHeaderOffset=a.readInt(4),this.isEncrypted)throw new Error("Encrypted zip are not supported");this.fileName=a.readString(this.fileNameLength),this.readExtraFields(a),this.parseZIP64ExtraField(a),this.fileComment=a.readString(this.fileCommentLength)},processAttributes:function{this.unixPermissions=null,this.dosPermissions=null;var a=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),a===i&&(this.dosPermissions=63&this.externalFileAttributes),a===j&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileName.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(a){if(this.extraFields[1]){var b=new e(this.extraFields[1].value);this.uncompressedSize===f.MAX_VALUE_32BITS&&(this.uncompressedSize=b.readInt(8)),this.compressedSize===f.MAX_VALUE_32BITS&&(this.compressedSize=b.readInt(8)),this.localHeaderOffset===f.MAX_VALUE_32BITS&&(this.localHeaderOffset=b.readInt(8)),this.diskNumberStart===f.MAX_VALUE_32BITS&&(this.diskNumberStart=b.readInt(4))}},readExtraFields:function(a){var b,c,d,e=a.index;for(this.extraFields=this.extraFields||{};a.index<e+this.extraFieldsLength;)b=a.readInt(2),c=a.readInt(2),d=a.readString(c),this.extraFields[b]={id:b,length:c,value:d}},handleUTF8:function{if(this.useUTF8)this.fileName=h.utf8decode(this.fileName),this.fileComment=h.utf8decode(this.fileComment);else{var a=this.findExtraFieldUnicodePath;null!==a&&(this.fileName=a);var b=this.findExtraFieldUnicodeComment;null!==b&&(this.fileComment=b)}},findExtraFieldUnicodePath:function{var a=this.extraFields[28789];if(a){var b=new e(a.value);return 1!==b.readInt(1)?null:h.crc32(this.fileName)!==b.readInt(4)?null:h.utf8decode(b.readString(a.length-5))}return null},findExtraFieldUnicodeComment:function{var a=this.extraFields[25461];if(a){var b=new e(a.value);return 1!==b.readInt(1)?null:h.crc32(this.fileComment)!==b.readInt(4)?null:h.utf8decode(b.readString(a.length-5))}return null}},b.exports=d},{"./compressedObject":2,"./object":13,"./stringReader":15,"./utils":21}],24:[function(a,b,c){"use strict";var d=a("./lib/utils/common").assign,e=a("./lib/deflate"),f=a("./lib/inflate"),g=a("./lib/zlib/constants"),h={};d(h,e,f,g),b.exports=h},{"./lib/deflate":25,"./lib/inflate":26,"./lib/utils/common":27,"./lib/zlib/constants":30}],25:[function(a,b,c){"use strict";function d(a,b){var c=new s(b);if(c.push(a,!0),c.err)throw c.msg;return c.result}function e(a,b){return b=b||{},b.raw=!0,d(a,b)}function f(a,b){return b=b||{},b.gzip=!0,d(a,b)}var g=a("./zlib/deflate.js"),h=a("./utils/common"),i=a("./utils/strings"),j=a("./zlib/messages"),k=a("./zlib/zstream"),l=0,m=4,n=0,o=1,p=-1,q=0,r=8,s=function(a){this.options=h.assign({level:p,method:r,chunkSize:16384,windowBits:15,memLevel:8,strategy:q,to:""},a||{});var b=this.options;b.raw&&b.windowBits>0?b.windowBits=-b.windowBits:b.gzip&&b.windowBits>0&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new k,this.strm.avail_out=0;var c=g.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(c!==n)throw new Error(j[c]);b.header&&g.deflateSetHeader(this.strm,b.header)};s.prototype.push=function(a,b){var c,d,e=this.strm,f=this.options.chunkSize;if(this.ended)return!1;d=b===b?b:b===!0?m:l,"string"==typeof a?e.input=i.string2buf(a):e.input=a,e.next_in=0,e.avail_in=e.input.length;do{if(0===e.avail_out&&(e.output=new h.Buf8(f),e.next_out=0,e.avail_out=f),c=g.deflate(e,d),c!==o&&c!==n)return this.onEnd(c),this.ended=!0,!1;(0===e.avail_out||0===e.avail_in&&d===m)&&("string"===this.options.to?this.onData(i.buf2binstring(h.shrinkBuf(e.output,e.next_out))):this.onData(h.shrinkBuf(e.output,e.next_out)))}while((e.avail_in>0||0===e.avail_out)&&c!==o);return d===m?(c=g.deflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===n):!0},s.prototype.onData=function(a){this.chunks.push(a)},s.prototype.onEnd=function(a){a===n&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=h.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},c.Deflate=s,c.deflate=d,c.deflateRaw=e,c.gzip=f},{"./utils/common":27,"./utils/strings":28,"./zlib/deflate.js":32,"./zlib/messages":37,"./zlib/zstream":39}],26:[function(a,b,c){"use strict";function d(a,b){var c=new m(b);if(c.push(a,!0),c.err)throw c.msg;return c.result}function e(a,b){return b=b||{},b.raw=!0,d(a,b)}var f=a("./zlib/inflate.js"),g=a("./utils/common"),h=a("./utils/strings"),i=a("./zlib/constants"),j=a("./zlib/messages"),k=a("./zlib/zstream"),l=a("./zlib/gzheader"),m=function(a){this.options=g.assign({chunkSize:16384,windowBits:0,to:""},a||{});var b=this.options;b.raw&&b.windowBits>=0&&b.windowBits<16&&(b.windowBits=-b.windowBits,0===b.windowBits&&(b.windowBits=-15)),!(b.windowBits>=0&&b.windowBits<16)||a&&a.windowBits||(b.windowBits+=32),b.windowBits>15&&b.windowBits<48&&0===(15&b.windowBits)&&(b.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new k,this.strm.avail_out=0;var c=f.inflateInit2(this.strm,b.windowBits);if(c!==i.Z_OK)throw new Error(j[c]);this.header=new l,f.inflateGetHeader(this.strm,this.header)};m.prototype.push=function(a,b){var c,d,e,j,k,l=this.strm,m=this.options.chunkSize;if(this.ended)return!1;d=b===b?b:b===!0?i.Z_FINISH:i.Z_NO_FLUSH,"string"==typeof a?l.input=h.binstring2buf(a):l.input=a,l.next_in=0,l.avail_in=l.input.length;do{if(0===l.avail_out&&(l.output=new g.Buf8(m),l.next_out=0,l.avail_out=m),c=f.inflate(l,i.Z_NO_FLUSH),c!==i.Z_STREAM_END&&c!==i.Z_OK)return this.onEnd(c),this.ended=!0,!1;l.next_out&&(0===l.avail_out||c===i.Z_STREAM_END||0===l.avail_in&&d===i.Z_FINISH)&&("string"===this.options.to?(e=h.utf8border(l.output,l.next_out),j=l.next_out-e,k=h.buf2string(l.output,e),l.next_out=j,l.avail_out=m-j,j&&g.arraySet(l.output,l.output,e,j,0),this.onData(k)):this.onData(g.shrinkBuf(l.output,l.next_out)))}while(l.avail_in>0&&c!==i.Z_STREAM_END);return c===i.Z_STREAM_END&&(d=i.Z_FINISH),d===i.Z_FINISH?(c=f.inflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===i.Z_OK):!0},m.prototype.onData=function(a){this.chunks.push(a)},m.prototype.onEnd=function(a){a===i.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=g.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},c.Inflate=m,c.inflate=d,c.inflateRaw=e,c.ungzip=d},{"./utils/common":27,"./utils/strings":28,"./zlib/constants":30,"./zlib/gzheader":33,"./zlib/inflate.js":35,"./zlib/messages":37,"./zlib/zstream":39}],27:[function(a,b,c){"use strict";var d="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;c.assign=function(a){for(var b=Array.prototype.slice.call(arguments,1);b.length;){var c=b.shift;if(c){if("object"!=typeof c)throw new TypeError(c+"must be non-object");for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])}}return a},c.shrinkBuf=function(a,b){return a.length===b?a:a.subarray?a.subarray(0,b):(a.length=b,a)};var e={arraySet:function(a,b,c,d,e){if(b.subarray&&a.subarray)return void a.set(b.subarray(c,c+d),e);for(var f=0;d>f;f++)a[e+f]=b[c+f]},flattenChunks:function(a){var b,c,d,e,f,g;for(d=0,b=0,c=a.length;c>b;b++)d+=a[b].length;for(g=new Uint8Array(d),e=0,b=0,c=a.length;c>b;b++)f=a[b],g.set(f,e),e+=f.length;return g}},f={arraySet:function(a,b,c,d,e){for(var f=0;d>f;f++)a[e+f]=b[c+f]},flattenChunks:function(a){return[].concat.apply([],a)}};c.setTyped=function(a){a?(c.Buf8=Uint8Array,c.Buf16=Uint16Array,c.Buf32=Int32Array,c.assign(c,e)):(c.Buf8=Array,c.Buf16=Array,c.Buf32=Array,c.assign(c,f))},c.setTyped(d)},{}],28:[function(a,b,c){"use strict";function d(a,b){if(65537>b&&(a.subarray&&g||!a.subarray&&f))return String.fromCharCode.apply(null,e.shrinkBuf(a,b));for(var c="",d=0;b>d;d++)c+=String.fromCharCode(a[d]);return c}var e=a("./common"),f=!0,g=!0;try{String.fromCharCode.apply(null,[0])}catch(h){f=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(h){g=!1}for(var i=new e.Buf8(256),j=0;256>j;j++)i[j]=j>=252?6:j>=248?5:j>=240?4:j>=224?3:j>=192?2:1;i[254]=i[254]=1,c.string2buf=function(a){var b,c,d,f,g,h=a.length,i=0;for(f=0;h>f;f++)c=a.charCodeAt(f),55296===(64512&c)&&h>f+1&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),i+=128>c?1:2048>c?2:65536>c?3:4;for(b=new e.Buf8(i),g=0,f=0;i>g;f++)c=a.charCodeAt(f),55296===(64512&c)&&h>f+1&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),128>c?b[g++]=c:2048>c?(b[g++]=192|c>>>6,b[g++]=128|63&c):65536>c?(b[g++]=224|c>>>12,b[g++]=128|c>>>6&63,b[g++]=128|63&c):(b[g++]=240|c>>>18,b[g++]=128|c>>>12&63,b[g++]=128|c>>>6&63,b[g++]=128|63&c);return b},c.buf2binstring=function(a){return d(a,a.length)},c.binstring2buf=function(a){for(var b=new e.Buf8(a.length),c=0,d=b.length;d>c;c++)b[c]=a.charCodeAt(c);return b},c.buf2string=function(a,b){var c,e,f,g,h=b||a.length,j=new Array(2*h);for(e=0,c=0;h>c;)if(f=a[c++],128>f)j[e++]=f;else if(g=i[f],g>4)j[e++]=65533,c+=g-1;else{for(f&=2===g?31:3===g?15:7;g>1&&h>c;)f=f<<6|63&a[c++],g--;g>1?j[e++]=65533:65536>f?j[e++]=f:(f-=65536,j[e++]=55296|f>>10&1023,j[e++]=56320|1023&f)}return d(j,e)},c.utf8border=function(a,b){var c;for(b=b||a.length,b>a.length&&(b=a.length),c=b-1;c>=0&&128===(192&a[c]);)c--;return 0>c?b:0===c?b:c+i[a[c]]>b?c:b}},{"./common":27}],29:[function(a,b,c){"use strict";function d(a,b,c,d){for(var e=65535&a|0,f=a>>>16&65535|0,g=0;0!==c;){g=c>2e3?2e3:c,c-=g;do e=e+b[d++]|0,f=f+e|0;while(--g);e%=65521,f%=65521}return e|f<<16|0}b.exports=d},{}],30:[function(a,b,c){b.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],31:[function(a,b,c){"use strict";function d{for(var a,b=[],c=0;256>c;c++){a=c;for(var d=0;8>d;d++)a=1&a?3988292384^a>>>1:a>>>1;b[c]=a}return b}function e(a,b,c,d){var e=f,g=d+c;a=-1^a;for(var h=d;g>h;h++)a=a>>>8^e[255&(a^b[h])];return-1^a}var f=d;b.exports=e},{}],32:[function(a,b,c){"use strict";function d(a,b){return a.msg=G[b],b}function e(a){return(a<<1)-(a>4?9:0)}function f(a){for(var b=a.length;--b>=0;)a[b]=0}function g(a){var b=a.state,c=b.pending;c>a.avail_out&&(c=a.avail_out),0!==c&&(C.arraySet(a.output,b.pending_buf,b.pending_out,c,a.next_out),a.next_out+=c,b.pending_out+=c,a.total_out+=c,a.avail_out-=c,b.pending-=c,0===b.pending&&(b.pending_out=0))}function h(a,b){D._tr_flush_block(a,a.block_start>=0?a.block_start:-1,a.strstart-a.block_start,b),a.block_start=a.strstart,g(a.strm)}function i(a,b){a.pending_buf[a.pending++]=b}function j(a,b){a.pending_buf[a.pending++]=b>>>8&255,a.pending_buf[a.pending++]=255&b}function k(a,b,c,d){var e=a.avail_in;return e>d&&(e=d),0===e?0:(a.avail_in-=e,C.arraySet(b,a.input,a.next_in,e,c),1===a.state.wrap?a.adler=E(a.adler,b,e,c):2===a.state.wrap&&(a.adler=F(a.adler,b,e,c)),a.next_in+=e,a.total_in+=e,e)}function l(a,b){var c,d,e=a.max_chain_length,f=a.strstart,g=a.prev_length,h=a.nice_match,i=a.strstart>a.w_size-ja?a.strstart-(a.w_size-ja):0,j=a.window,k=a.w_mask,l=a.prev,m=a.strstart+ia,n=j[f+g-1],o=j[f+g];a.prev_length>=a.good_match&&(e>>=2),h>a.lookahead&&(h=a.lookahead);do if(c=b,j[c+g]===o&&j[c+g-1]===n&&j[c]===j[f]&&j[++c]===j[f+1]){f+=2,c++;do;while(j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&m>f);if(d=ia-(m-f),f=m-ia,d>g){if(a.match_start=b,g=d,d>=h)break;n=j[f+g-1],o=j[f+g]}}while((b=l[b&k])>i&&0!==--e);return g<=a.lookahead?g:a.lookahead}function m(a){var b,c,d,e,f,g=a.w_size;do{if(e=a.window_size-a.lookahead-a.strstart,a.strstart>=g+(g-ja)){C.arraySet(a.window,a.window,g,g,0),a.match_start-=g,a.strstart-=g,a.block_start-=g,c=a.hash_size,b=c;do d=a.head[--b],a.head[b]=d>=g?d-g:0;while(--c);c=g,b=c;do d=a.prev[--b],a.prev[b]=d>=g?d-g:0;while(--c);e+=g}if(0===a.strm.avail_in)break;if(c=k(a.strm,a.window,a.strstart+a.lookahead,e),a.lookahead+=c,a.lookahead+a.insert>=ha)for(f=a.strstart-a.insert,a.ins_h=a.window[f],a.ins_h=(a.ins_h<<a.hash_shift^a.window[f+1])&a.hash_mask;a.insert&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[f+ha-1])&a.hash_mask,a.prev[f&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=f,f++,a.insert--,!(a.lookahead+a.insert<ha)););}while(a.lookahead<ja&&0!==a.strm.avail_in)}function n(a,b){var c=65535;for(c>a.pending_buf_size-5&&(c=a.pending_buf_size-5);;){if(a.lookahead<=1){if(m(a),0===a.lookahead&&b===H)return sa;if(0===a.lookahead)break}a.strstart+=a.lookahead,a.lookahead=0;var d=a.block_start+c;if((0===a.strstart||a.strstart>=d)&&(a.lookahead=a.strstart-d,a.strstart=d,h(a,!1),0===a.strm.avail_out))return sa;if(a.strstart-a.block_start>=a.w_size-ja&&(h(a,!1),0===a.strm.avail_out))return sa; }return a.insert=0,b===K?(h(a,!0),0===a.strm.avail_out?ua:va):a.strstart>a.block_start&&(h(a,!1),0===a.strm.avail_out)?sa:sa}function o(a,b){for(var c,d;;){if(a.lookahead<ja){if(m(a),a.lookahead<ja&&b===H)return sa;if(0===a.lookahead)break}if(c=0,a.lookahead>=ha&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ha-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),0!==c&&a.strstart-c<=a.w_size-ja&&(a.match_length=l(a,c)),a.match_length>=ha)if(d=D._tr_tally(a,a.strstart-a.match_start,a.match_length-ha),a.lookahead-=a.match_length,a.match_length<=a.max_lazy_match&&a.lookahead>=ha){a.match_length--;do a.strstart++,a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ha-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart;while(0!==--a.match_length);a.strstart++}else a.strstart+=a.match_length,a.match_length=0,a.ins_h=a.window[a.strstart],a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+1])&a.hash_mask;else d=D._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++;if(d&&(h(a,!1),0===a.strm.avail_out))return sa}return a.insert=a.strstart<ha-1?a.strstart:ha-1,b===K?(h(a,!0),0===a.strm.avail_out?ua:va):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?sa:ta}function p(a,b){for(var c,d,e;;){if(a.lookahead<ja){if(m(a),a.lookahead<ja&&b===H)return sa;if(0===a.lookahead)break}if(c=0,a.lookahead>=ha&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ha-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),a.prev_length=a.match_length,a.prev_match=a.match_start,a.match_length=ha-1,0!==c&&a.prev_length<a.max_lazy_match&&a.strstart-c<=a.w_size-ja&&(a.match_length=l(a,c),a.match_length<=5&&(a.strategy===S||a.match_length===ha&&a.strstart-a.match_start>4096)&&(a.match_length=ha-1)),a.prev_length>=ha&&a.match_length<=a.prev_length){e=a.strstart+a.lookahead-ha,d=D._tr_tally(a,a.strstart-1-a.prev_match,a.prev_length-ha),a.lookahead-=a.prev_length-1,a.prev_length-=2;do++a.strstart<=e&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ha-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart);while(0!==--a.prev_length);if(a.match_available=0,a.match_length=ha-1,a.strstart++,d&&(h(a,!1),0===a.strm.avail_out))return sa}else if(a.match_available){if(d=D._tr_tally(a,0,a.window[a.strstart-1]),d&&h(a,!1),a.strstart++,a.lookahead--,0===a.strm.avail_out)return sa}else a.match_available=1,a.strstart++,a.lookahead--}return a.match_available&&(d=D._tr_tally(a,0,a.window[a.strstart-1]),a.match_available=0),a.insert=a.strstart<ha-1?a.strstart:ha-1,b===K?(h(a,!0),0===a.strm.avail_out?ua:va):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?sa:ta}function q(a,b){for(var c,d,e,f,g=a.window;;){if(a.lookahead<=ia){if(m(a),a.lookahead<=ia&&b===H)return sa;if(0===a.lookahead)break}if(a.match_length=0,a.lookahead>=ha&&a.strstart>0&&(e=a.strstart-1,d=g[e],d===g[++e]&&d===g[++e]&&d===g[++e])){f=a.strstart+ia;do;while(d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&f>e);a.match_length=ia-(f-e),a.match_length>a.lookahead&&(a.match_length=a.lookahead)}if(a.match_length>=ha?(c=D._tr_tally(a,1,a.match_length-ha),a.lookahead-=a.match_length,a.strstart+=a.match_length,a.match_length=0):(c=D._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++),c&&(h(a,!1),0===a.strm.avail_out))return sa}return a.insert=0,b===K?(h(a,!0),0===a.strm.avail_out?ua:va):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?sa:ta}function r(a,b){for(var c;;){if(0===a.lookahead&&(m(a),0===a.lookahead)){if(b===H)return sa;break}if(a.match_length=0,c=D._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++,c&&(h(a,!1),0===a.strm.avail_out))return sa}return a.insert=0,b===K?(h(a,!0),0===a.strm.avail_out?ua:va):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?sa:ta}function s(a){a.window_size=2*a.w_size,f(a.head),a.max_lazy_match=B[a.level].max_lazy,a.good_match=B[a.level].good_length,a.nice_match=B[a.level].nice_length,a.max_chain_length=B[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=ha-1,a.match_available=0,a.ins_h=0}function t{this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Y,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new C.Buf16(2*fa),this.dyn_dtree=new C.Buf16(2*(2*da+1)),this.bl_tree=new C.Buf16(2*(2*ea+1)),f(this.dyn_ltree),f(this.dyn_dtree),f(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new C.Buf16(ga+1),this.heap=new C.Buf16(2*ca+1),f(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new C.Buf16(2*ca+1),f(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function u(a){var b;return a&&a.state?(a.total_in=a.total_out=0,a.data_type=X,b=a.state,b.pending=0,b.pending_out=0,b.wrap<0&&(b.wrap=-b.wrap),b.status=b.wrap?la:qa,a.adler=2===b.wrap?0:1,b.last_flush=H,D._tr_init(b),M):d(a,O)}function v(a){var b=u(a);return b===M&&s(a.state),b}function w(a,b){return a&&a.state?2!==a.state.wrap?O:(a.state.gzhead=b,M):O}function x(a,b,c,e,f,g){if(!a)return O;var h=1;if(b===R&&(b=6),0>e?(h=0,e=-e):e>15&&(h=2,e-=16),1>f||f>Z||c!==Y||8>e||e>15||0>b||b>9||0>g||g>V)return d(a,O);8===e&&(e=9);var i=new t;return a.state=i,i.strm=a,i.wrap=h,i.gzhead=null,i.w_bits=e,i.w_size=1<<i.w_bits,i.w_mask=i.w_size-1,i.hash_bits=f+7,i.hash_size=1<<i.hash_bits,i.hash_mask=i.hash_size-1,i.hash_shift=((i.hash_bits+ha-1)/ha),i.window=new C.Buf8(2*i.w_size),i.head=new C.Buf16(i.hash_size),i.prev=new C.Buf16(i.w_size),i.lit_bufsize=1<<f+6,i.pending_buf_size=4*i.lit_bufsize,i.pending_buf=new C.Buf8(i.pending_buf_size),i.d_buf=i.lit_bufsize>>1,i.l_buf=3*i.lit_bufsize,i.level=b,i.strategy=g,i.method=c,v(a)}function y(a,b){return x(a,b,Y,$,_,W)}function z(a,b){var c,h,k,l;if(!a||!a.state||b>L||0>b)return a?d(a,O):O;if(h=a.state,!a.output||!a.input&&0!==a.avail_in||h.status===ra&&b!==K)return d(a,0===a.avail_out?Q:O);if(h.strm=a,c=h.last_flush,h.last_flush=b,h.status===la)if(2===h.wrap)a.adler=0,i(h,31),i(h,139),i(h,8),h.gzhead?(i(h,(h.gzhead.text?1:0)+(h.gzhead.hcrc?2:0)+(h.gzhead.extra?4:0)+(h.gzhead.name?8:0)+(h.gzhead.comment?16:0)),i(h,255&h.gzhead.time),i(h,h.gzhead.time>>8&255),i(h,h.gzhead.time>>16&255),i(h,h.gzhead.time>>24&255),i(h,9===h.level?2:h.strategy>=T||h.level<2?4:0),i(h,255&h.gzhead.os),h.gzhead.extra&&h.gzhead.extra.length&&(i(h,255&h.gzhead.extra.length),i(h,h.gzhead.extra.length>>8&255)),h.gzhead.hcrc&&(a.adler=F(a.adler,h.pending_buf,h.pending,0)),h.gzindex=0,h.status=ma):(i(h,0),i(h,0),i(h,0),i(h,0),i(h,0),i(h,9===h.level?2:h.strategy>=T||h.level<2?4:0),i(h,wa),h.status=qa);else{var m=Y+(h.w_bits-8<<4)<<8,n=-1;n=h.strategy>=T||h.level<2?0:h.level<6?1:6===h.level?2:3,m|=n<<6,0!==h.strstart&&(m|=ka),m+=31-m%31,h.status=qa,j(h,m),0!==h.strstart&&(j(h,a.adler>>>16),j(h,65535&a.adler)),a.adler=1}if(h.status===ma)if(h.gzhead.extra){for(k=h.pending;h.gzindex<(65535&h.gzhead.extra.length)&&(h.pending!==h.pending_buf_size||(h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending!==h.pending_buf_size));)i(h,255&h.gzhead.extra[h.gzindex]),h.gzindex++;h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),h.gzindex===h.gzhead.extra.length&&(h.gzindex=0,h.status=na)}else h.status=na;if(h.status===na)if(h.gzhead.name){k=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending===h.pending_buf_size)){l=1;break}l=h.gzindex<h.gzhead.name.length?255&h.gzhead.name.charCodeAt(h.gzindex++):0,i(h,l)}while(0!==l);h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),0===l&&(h.gzindex=0,h.status=oa)}else h.status=oa;if(h.status===oa)if(h.gzhead.comment){k=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending===h.pending_buf_size)){l=1;break}l=h.gzindex<h.gzhead.comment.length?255&h.gzhead.comment.charCodeAt(h.gzindex++):0,i(h,l)}while(0!==l);h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),0===l&&(h.status=pa)}else h.status=pa;if(h.status===pa&&(h.gzhead.hcrc?(h.pending+2>h.pending_buf_size&&g(a),h.pending+2<=h.pending_buf_size&&(i(h,255&a.adler),i(h,a.adler>>8&255),a.adler=0,h.status=qa)):h.status=qa),0!==h.pending){if(g(a),0===a.avail_out)return h.last_flush=-1,M}else if(0===a.avail_in&&e(b)<=e(c)&&b!==K)return d(a,Q);if(h.status===ra&&0!==a.avail_in)return d(a,Q);if(0!==a.avail_in||0!==h.lookahead||b!==H&&h.status!==ra){var o=h.strategy===T?r(h,b):h.strategy===U?q(h,b):B[h.level].func(h,b);if(o!==ua&&o!==va||(h.status=ra),o===sa||o===ua)return 0===a.avail_out&&(h.last_flush=-1),M;if(o===ta&&(b===I?D._tr_align(h):b!==L&&(D._tr_stored_block(h,0,0,!1),b===J&&(f(h.head),0===h.lookahead&&(h.strstart=0,h.block_start=0,h.insert=0))),g(a),0===a.avail_out))return h.last_flush=-1,M}return b!==K?M:h.wrap<=0?N:(2===h.wrap?(i(h,255&a.adler),i(h,a.adler>>8&255),i(h,a.adler>>16&255),i(h,a.adler>>24&255),i(h,255&a.total_in),i(h,a.total_in>>8&255),i(h,a.total_in>>16&255),i(h,a.total_in>>24&255)):(j(h,a.adler>>>16),j(h,65535&a.adler)),g(a),h.wrap>0&&(h.wrap=-h.wrap),0!==h.pending?M:N)}function A(a){var b;return a&&a.state?(b=a.state.status,b!==la&&b!==ma&&b!==na&&b!==oa&&b!==pa&&b!==qa&&b!==ra?d(a,O):(a.state=null,b===qa?d(a,P):M)):O}var B,C=a("../utils/common"),D=a("./trees"),E=a("./adler32"),F=a("./crc32"),G=a("./messages"),H=0,I=1,J=3,K=4,L=5,M=0,N=1,O=-2,P=-3,Q=-5,R=-1,S=1,T=2,U=3,V=4,W=0,X=2,Y=8,Z=9,$=15,_=8,aa=29,ba=256,ca=ba+1+aa,da=30,ea=19,fa=2*ca+1,ga=15,ha=3,ia=258,ja=ia+ha+1,ka=32,la=42,ma=69,na=73,oa=91,pa=103,qa=113,ra=666,sa=1,ta=2,ua=3,va=4,wa=3,xa=function(a,b,c,d,e){this.good_length=a,this.max_lazy=b,this.nice_length=c,this.max_chain=d,this.func=e};B=[new xa(0,0,0,0,n),new xa(4,4,8,4,o),new xa(4,5,16,8,o),new xa(4,6,32,32,o),new xa(4,4,16,16,p),new xa(8,16,32,32,p),new xa(8,16,128,128,p),new xa(8,32,128,256,p),new xa(32,128,258,1024,p),new xa(32,258,258,4096,p)],c.deflateInit=y,c.deflateInit2=x,c.deflateReset=v,c.deflateResetKeep=u,c.deflateSetHeader=w,c.deflate=z,c.deflateEnd=A,c.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":27,"./adler32":29,"./crc32":31,"./messages":37,"./trees":38}],33:[function(a,b,c){"use strict";function d{this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}b.exports=d},{}],34:[function(a,b,c){"use strict";var d=30,e=12;b.exports=function(a,b){var c,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C;c=a.state,f=a.next_in,B=a.input,g=f+(a.avail_in-5),h=a.next_out,C=a.output,i=h-(b-a.avail_out),j=h+(a.avail_out-257),k=c.dmax,l=c.wsize,m=c.whave,n=c.wnext,o=c.window,p=c.hold,q=c.bits,r=c.lencode,s=c.distcode,t=(1<<c.lenbits)-1,u=(1<<c.distbits)-1;a:do{15>q&&(p+=B[f++]<<q,q+=8,p+=B[f++]<<q,q+=8),v=r[p&t];b:for{if(w=v>>>24,p>>>=w,q-=w,w=v>>>16&255,0===w)C[h++]=65535&v;else{if(!(16&w)){if(0===(64&w)){v=r[(65535&v)+(p&(1<<w)-1)];continue b}if(32&w){c.mode=e;break a}a.msg="invalid literal/length code",c.mode=d;break a}x=65535&v,w&=15,w&&(w>q&&(p+=B[f++]<<q,q+=8),x+=p&(1<<w)-1,p>>>=w,q-=w),15>q&&(p+=B[f++]<<q,q+=8,p+=B[f++]<<q,q+=8),v=s[p&u];c:for{if(w=v>>>24,p>>>=w,q-=w,w=v>>>16&255,!(16&w)){if(0===(64&w)){v=s[(65535&v)+(p&(1<<w)-1)];continue c}a.msg="invalid distance code",c.mode=d;break a}if(y=65535&v,w&=15,w>q&&(p+=B[f++]<<q,q+=8,w>q&&(p+=B[f++]<<q,q+=8)),y+=p&(1<<w)-1,y>k){a.msg="invalid distance too far back",c.mode=d;break a}if(p>>>=w,q-=w,w=h-i,y>w){if(w=y-w,w>m&&c.sane){a.msg="invalid distance too far back",c.mode=d;break a}if(z=0,A=o,0===n){if(z+=l-w,x>w){x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}}else if(w>n){if(z+=l+n-w,w-=n,x>w){x-=w;do C[h++]=o[z++];while(--w);if(z=0,x>n){w=n,x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}}}else if(z+=n-w,x>w){x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}for(x>2;)C[h++]=A[z++],C[h++]=A[z++],C[h++]=A[z++],x-=3;x&&(C[h++]=A[z++],x>1&&(C[h++]=A[z++]))}else{z=h-y;do C[h++]=C[z++],C[h++]=C[z++],C[h++]=C[z++],x-=3;while(x>2);x&&(C[h++]=C[z++],x>1&&(C[h++]=C[z++]))}break}}break}}while(g>f&&j>h);x=q>>3,f-=x,q-=x<<3,p&=(1<<q)-1,a.next_in=f,a.next_out=h,a.avail_in=g>f?5+(g-f):5-(f-g),a.avail_out=j>h?257+(j-h):257-(h-j),c.hold=p,c.bits=q}},{}],35:[function(a,b,c){"use strict";function d(a){return(a>>>24&255)+(a>>>8&65280)+((65280&a)<<8)+((255&a)<<24)}function e{this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function f(a){var b;return a&&a.state?(b=a.state,a.total_in=a.total_out=b.total=0,a.msg="",b.wrap&&(a.adler=1&b.wrap),b.mode=K,b.last=0,b.havedict=0,b.dmax=32768,b.head=null,b.hold=0,b.bits=0,b.lencode=b.lendyn=new r.Buf32(oa),b.distcode=b.distdyn=new r.Buf32(pa),b.sane=1,b.back=-1,C):F}function g(a){var b;return a&&a.state?(b=a.state,b.wsize=0,b.whave=0,b.wnext=0,f(a)):F}function h(a,b){var c,d;return a&&a.state?(d=a.state,0>b?(c=0,b=-b):(c=(b>>4)+1,48>b&&(b&=15)),b&&(8>b||b>15)?F:(null!==d.window&&d.wbits!==b&&(d.window=null),d.wrap=c,d.wbits=b,g(a))):F}function i(a,b){var c,d;return a?(d=new e,a.state=d,d.window=null,c=h(a,b),c!==C&&(a.state=null),c):F}function j(a){return i(a,ra)}function k(a){if(sa){var b;for(p=new r.Buf32(512),q=new r.Buf32(32),b=0;144>b;)a.lens[b++]=8;for(256>b;)a.lens[b++]=9;for(280>b;)a.lens[b++]=7;for(288>b;)a.lens[b++]=8;for(v(x,a.lens,0,288,p,0,a.work,{bits:9}),b=0;32>b;)a.lens[b++]=5;v(y,a.lens,0,32,q,0,a.work,{bits:5}),sa=!1}a.lencode=p,a.lenbits=9,a.distcode=q,a.distbits=5}function l(a,b,c,d){var e,f=a.state;return null===f.window&&(f.wsize=1<<f.wbits,f.wnext=0,f.whave=0,f.window=new r.Buf8(f.wsize)),d>=f.wsize?(r.arraySet(f.window,b,c-f.wsize,f.wsize,0),f.wnext=0,f.whave=f.wsize):(e=f.wsize-f.wnext,e>d&&(e=d),r.arraySet(f.window,b,c-d,e,f.wnext),d-=e,d?(r.arraySet(f.window,b,c-d,d,0),f.wnext=d,f.whave=f.wsize):(f.wnext+=e,f.wnext===f.wsize&&(f.wnext=0),f.whave<f.wsize&&(f.whave+=e))),0}function m(a,b){var c,e,f,g,h,i,j,m,n,o,p,q,oa,pa,qa,ra,sa,ta,ua,va,wa,xa,ya,za,Aa=0,Ba=new r.Buf8(4),Ca=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!a||!a.state||!a.output||!a.input&&0!==a.avail_in)return F;c=a.state,c.mode===V&&(c.mode=W),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,o=i,p=j,xa=C;a:forswitch(c.mode){case K:if(0===c.wrap){c.mode=W;break}for(16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(2&c.wrap&&35615===m){c.check=0,Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=t(c.check,Ba,2,0),m=0,n=0,c.mode=L;break}if(c.flags=0,c.head&&(c.head.done=!1),!(1&c.wrap)||(((255&m)<<8)+(m>>8))%31){a.msg="incorrect header check",c.mode=la;break}if((15&m)!==J){a.msg="unknown compression method",c.mode=la;break}if(m>>>=4,n-=4,wa=(15&m)+8,0===c.wbits)c.wbits=wa;else if(wa>c.wbits){a.msg="invalid window size",c.mode=la;break}c.dmax=1<<wa,a.adler=c.check=1,c.mode=512&m?T:V,m=0,n=0;break;case L:for(16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(c.flags=m,(255&c.flags)!==J){a.msg="unknown compression method",c.mode=la;break}if(57344&c.flags){a.msg="unknown header flags set",c.mode=la;break}c.head&&(c.head.text=m>>8&1),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=t(c.check,Ba,2,0)),m=0,n=0,c.mode=M;case M:for(32>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.head&&(c.head.time=m),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,Ba[2]=m>>>16&255,Ba[3]=m>>>24&255,c.check=t(c.check,Ba,4,0)),m=0,n=0,c.mode=N;case N:for(16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.head&&(c.head.xflags=255&m,c.head.os=m>>8),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=t(c.check,Ba,2,0)),m=0,n=0,c.mode=O;case O:if(1024&c.flags){for(16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.length=m,c.head&&(c.head.extra_len=m),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=t(c.check,Ba,2,0)),m=0,n=0}else c.head&&(c.head.extra=null);c.mode=P;case P:if(1024&c.flags&&(q=c.length,q>i&&(q=i),q&&(c.head&&(wa=c.head.extra_len-c.length,c.head.extra||(c.head.extra=new Array(c.head.extra_len)),r.arraySet(c.head.extra,e,g,q,wa)),512&c.flags&&(c.check=t(c.check,e,q,g)),i-=q,g+=q,c.length-=q),c.length))break a;c.length=0,c.mode=Q;case Q:if(2048&c.flags){if(0===i)break a;q=0;do wa=e[g+q++],c.head&&wa&&c.length<65536&&(c.head.name+=String.fromCharCode(wa));while(wa&&i>q);if(512&c.flags&&(c.check=t(c.check,e,q,g)),i-=q,g+=q,wa)break a}else c.head&&(c.head.name=null);c.length=0,c.mode=R;case R:if(4096&c.flags){if(0===i)break a;q=0;do wa=e[g+q++],c.head&&wa&&c.length<65536&&(c.head.comment+=String.fromCharCode(wa));while(wa&&i>q);if(512&c.flags&&(c.check=t(c.check,e,q,g)),i-=q,g+=q,wa)break a}else c.head&&(c.head.comment=null);c.mode=S;case S:if(512&c.flags){for(16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m!==(65535&c.check)){a.msg="header crc mismatch",c.mode=la;break}m=0,n=0}c.head&&(c.head.hcrc=c.flags>>9&1,c.head.done=!0),a.adler=c.check=0,c.mode=V;break;case T:for(32>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}a.adler=c.check=d(m),m=0,n=0,c.mode=U;case U:if(0===c.havedict)return a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,E;a.adler=c.check=1,c.mode=V;case V:if(b===A||b===B)break a;case W:if(c.last){m>>>=7&n,n-=7&n,c.mode=ia;break}for(3>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}switch(c.last=1&m,m>>>=1,n-=1,3&m){case 0:c.mode=X;break;case 1:if(k(c),c.mode=ba,b===B){m>>>=2,n-=2;break a}break;case 2:c.mode=$;break;case 3:a.msg="invalid block type",c.mode=la}m>>>=2,n-=2;break;case X:for(m>>>=7&n,n-=7&n;32>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if((65535&m)!==(m>>>16^65535)){a.msg="invalid stored block lengths",c.mode=la;break}if(c.length=65535&m,m=0,n=0,c.mode=Y,b===B)break a;case Y:c.mode=Z;case Z:if(q=c.length){if(q>i&&(q=i),q>j&&(q=j),0===q)break a;r.arraySet(f,e,g,q,h),i-=q,g+=q,j-=q,h+=q,c.length-=q;break}c.mode=V;break;case $:for(14>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(c.nlen=(31&m)+257,m>>>=5,n-=5,c.ndist=(31&m)+1,m>>>=5,n-=5,c.ncode=(15&m)+4,m>>>=4,n-=4,c.nlen>286||c.ndist>30){a.msg="too many length or distance symbols",c.mode=la;break}c.have=0,c.mode=_;case _:for(c.have<c.ncode;){for(3>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.lens[Ca[c.have++]]=7&m,m>>>=3,n-=3}for(c.have<19;)c.lens[Ca[c.have++]]=0;if(c.lencode=c.lendyn,c.lenbits=7,ya={bits:c.lenbits},xa=v(w,c.lens,0,19,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid code lengths set",c.mode=la;break}c.have=0,c.mode=aa;case aa:for(c.have<c.nlen+c.ndist;){for(Aa=c.lencode[m&(1<<c.lenbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(n>=qa);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(16>sa)m>>>=qa,n-=qa,c.lens[c.have++]=sa;else{if(16===sa){for(za=qa+2;za>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m>>>=qa,n-=qa,0===c.have){a.msg="invalid bit length repeat",c.mode=la;break}wa=c.lens[c.have-1],q=3+(3&m),m>>>=2,n-=2}else if(17===sa){for(za=qa+3;za>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=qa,n-=qa,wa=0,q=3+(7&m),m>>>=3,n-=3}else{for(za=qa+7;za>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=qa,n-=qa,wa=0,q=11+(127&m),m>>>=7,n-=7}if(c.have+q>c.nlen+c.ndist){a.msg="invalid bit length repeat",c.mode=la;break}for(q--;)c.lens[c.have++]=wa}}if(c.mode===la)break;if(0===c.lens[256]){a.msg="invalid code -- missing end-of-block",c.mode=la;break}if(c.lenbits=9,ya={bits:c.lenbits},xa=v(x,c.lens,0,c.nlen,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid literal/lengths set",c.mode=la;break}if(c.distbits=6,c.distcode=c.distdyn,ya={bits:c.distbits},xa=v(y,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,ya),c.distbits=ya.bits,xa){a.msg="invalid distances set",c.mode=la;break}if(c.mode=ba,b===B)break a;case ba:c.mode=ca;case ca:if(i>=6&&j>=258){a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,u(a,p),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,c.mode===V&&(c.back=-1);break}for(c.back=0;Aa=c.lencode[m&(1<<c.lenbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(n>=qa);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(ra&&0===(240&ra)){for(ta=qa,ua=ra,va=sa;Aa=c.lencode[va+((m&(1<<ta+ua)-1)>>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(n>=ta+qa);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,c.length=sa,0===ra){c.mode=ha;break}if(32&ra){c.back=-1,c.mode=V;break}if(64&ra){a.msg="invalid literal/length code",c.mode=la;break}c.extra=15&ra,c.mode=da;case da:if(c.extra){for(za=c.extra;za>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.length+=m&(1<<c.extra)-1,m>>>=c.extra,n-=c.extra,c.back+=c.extra}c.was=c.length,c.mode=ea;case ea:for(Aa=c.distcode[m&(1<<c.distbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(n>=qa);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(0===(240&ra)){for(ta=qa,ua=ra,va=sa;Aa=c.distcode[va+((m&(1<<ta+ua)-1)>>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(n>=ta+qa);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,64&ra){a.msg="invalid distance code",c.mode=la;break}c.offset=sa,c.extra=15&ra,c.mode=fa;case fa:if(c.extra){for(za=c.extra;za>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.offset+=m&(1<<c.extra)-1,m>>>=c.extra,n-=c.extra,c.back+=c.extra}if(c.offset>c.dmax){a.msg="invalid distance too far back",c.mode=la;break}c.mode=ga;case ga:if(0===j)break a;if(q=p-j,c.offset>q){if(q=c.offset-q,q>c.whave&&c.sane){a.msg="invalid distance too far back",c.mode=la;break}q>c.wnext?(q-=c.wnext,oa=c.wsize-q):oa=c.wnext-q,q>c.length&&(q=c.length),pa=c.window}else pa=f,oa=h-c.offset,q=c.length;q>j&&(q=j),j-=q,c.length-=q;do f[h++]=pa[oa++];while(--q);0===c.length&&(c.mode=ca);break;case ha:if(0===j)break a;f[h++]=c.length,j--,c.mode=ca;break;case ia:if(c.wrap){for(32>n;){if(0===i)break a;i--,m|=e[g++]<<n,n+=8}if(p-=j,a.total_out+=p,c.total+=p,p&&(a.adler=c.check=c.flags?t(c.check,f,p,h-p):s(c.check,f,p,h-p)),p=j,(c.flags?m:d(m))!==c.check){a.msg="incorrect data check",c.mode=la;break}m=0,n=0}c.mode=ja;case ja:if(c.wrap&&c.flags){for(32>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m!==(4294967295&c.total)){a.msg="incorrect length check",c.mode=la;break}m=0,n=0}c.mode=ka;case ka:xa=D;break a;case la:xa=G;break a;case ma:return H;case na:default:return F}return a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,(c.wsize||p!==a.avail_out&&c.mode<la&&(c.mode<ia||b!==z))&&l(a,a.output,a.next_out,p-a.avail_out)?(c.mode=ma,H):(o-=a.avail_in,p-=a.avail_out,a.total_in+=o,a.total_out+=p,c.total+=p,c.wrap&&p&&(a.adler=c.check=c.flags?t(c.check,f,p,a.next_out-p):s(c.check,f,p,a.next_out-p)),a.data_type=c.bits+(c.last?64:0)+(c.mode===V?128:0)+(c.mode===ba||c.mode===Y?256:0),(0===o&&0===p||b===z)&&xa===C&&(xa=I),xa)}function n(a){if(!a||!a.state)return F;var b=a.state;return b.window&&(b.window=null),a.state=null,C}function o(a,b){var c;return a&&a.state?(c=a.state,0===(2&c.wrap)?F:(c.head=b,b.done=!1,C)):F}var p,q,r=a("../utils/common"),s=a("./adler32"),t=a("./crc32"),u=a("./inffast"),v=a("./inftrees"),w=0,x=1,y=2,z=4,A=5,B=6,C=0,D=1,E=2,F=-2,G=-3,H=-4,I=-5,J=8,K=1,L=2,M=3,N=4,O=5,P=6,Q=7,R=8,S=9,T=10,U=11,V=12,W=13,X=14,Y=15,Z=16,$=17,_=18,aa=19,ba=20,ca=21,da=22,ea=23,fa=24,ga=25,ha=26,ia=27,ja=28,ka=29,la=30,ma=31,na=32,oa=852,pa=592,qa=15,ra=qa,sa=!0;c.inflateReset=g,c.inflateReset2=h,c.inflateResetKeep=f,c.inflateInit=j,c.inflateInit2=i,c.inflate=m,c.inflateEnd=n,c.inflateGetHeader=o,c.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":27,"./adler32":29,"./crc32":31,"./inffast":34,"./inftrees":36}],36:[function(a,b,c){"use strict";var d=a("../utils/common"),e=15,f=852,g=592,h=0,i=1,j=2,k=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],m=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],n=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];b.exports=function(a,b,c,o,p,q,r,s){var t,u,v,w,x,y,z,A,B,C=s.bits,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=null,O=0,P=new d.Buf16(e+1),Q=new d.Buf16(e+1),R=null,S=0;for(D=0;e>=D;D++)P[D]=0;for(E=0;o>E;E++)P[b[c+E]]++;for(H=C,G=e;G>=1&&0===P[G];G--);if(H>G&&(H=G),0===G)return p[q++]=20971520,p[q++]=20971520,s.bits=1,0;for(F=1;G>F&&0===P[F];F++);for(F>H&&(H=F),K=1,D=1;e>=D;D++)if(K<<=1,K-=P[D],0>K)return-1;if(K>0&&(a===h||1!==G))return-1;for(Q[1]=0,D=1;e>D;D++)Q[D+1]=Q[D]+P[D];for(E=0;o>E;E++)0!==b[c+E]&&(r[Q[b[c+E]]++]=E);if(a===h?(N=R=r,y=19):a===i?(N=k,O-=257,R=l,S-=257,y=256):(N=m,R=n,y=-1),M=0,E=0,D=F,x=q,I=H,J=0,v=-1,L=1<<H,w=L-1,a===i&&L>f||a===j&&L>g)return 1;for(var T=0;;){T++,z=D-J,r[E]<y?(A=0,B=r[E]):r[E]>y?(A=R[S+r[E]],B=N[O+r[E]]):(A=96,B=0),t=1<<D-J,u=1<<I,F=u;do u-=t,p[x+(M>>J)+u]=z<<24|A<<16|B|0;while(0!==u);for(t=1<<D-1;M&t;)t>>=1;if(0!==t?(M&=t-1,M+=t):M=0,E++,0===--P[D]){if(D===G)break;D=b[c+r[E]]}if(D>H&&(M&w)!==v){for(0===J&&(J=H),x+=F,I=D-J,K=1<<I;G>I+J&&(K-=P[I+J],!(0>=K));)I++,K<<=1;if(L+=1<<I,a===i&&L>f||a===j&&L>g)return 1;v=M&w,p[v]=H<<24|I<<16|x-q|0}}return 0!==M&&(p[x+M]=D-J<<24|64<<16|0),s.bits=H,0}},{"../utils/common":27}],37:[function(a,b,c){"use strict";b.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],38:[function(a,b,c){"use strict";function d(a){for(var b=a.length;--b>=0;)a[b]=0}function e(a){return 256>a?ga[a]:ga[256+(a>>>7)]}function f(a,b){a.pending_buf[a.pending++]=255&b,a.pending_buf[a.pending++]=b>>>8&255}function g(a,b,c){a.bi_valid>V-c?(a.bi_buf|=b<<a.bi_valid&65535,f(a,a.bi_buf),a.bi_buf=b>>V-a.bi_valid,a.bi_valid+=c-V):(a.bi_buf|=b<<a.bi_valid&65535,a.bi_valid+=c)}function h(a,b,c){g(a,c[2*b],c[2*b+1])}function i(a,b){var c=0;do c|=1&a,a>>>=1,c<<=1;while(--b>0);return c>>>1}function j(a){16===a.bi_valid?(f(a,a.bi_buf),a.bi_buf=0,a.bi_valid=0):a.bi_valid>=8&&(a.pending_buf[a.pending++]=255&a.bi_buf,a.bi_buf>>=8,a.bi_valid-=8)}function k(a,b){var c,d,e,f,g,h,i=b.dyn_tree,j=b.max_code,k=b.stat_desc.static_tree,l=b.stat_desc.has_stree,m=b.stat_desc.extra_bits,n=b.stat_desc.extra_base,o=b.stat_desc.max_length,p=0;for(f=0;U>=f;f++)a.bl_count[f]=0;for(i[2*a.heap[a.heap_max]+1]=0,c=a.heap_max+1;T>c;c++)d=a.heap[c],f=i[2*i[2*d+1]+1]+1,f>o&&(f=o,p++),i[2*d+1]=f,d>j||(a.bl_count[f]++,g=0,d>=n&&(g=m[d-n]),h=i[2*d],a.opt_len+=h*(f+g),l&&(a.static_len+=h*(k[2*d+1]+g)));if(0!==p){do{for(f=o-1;0===a.bl_count[f];)f--;a.bl_count[f]--,a.bl_count[f+1]+=2,a.bl_count[o]--,p-=2}while(p>0);for(f=o;0!==f;f--)for(d=a.bl_count[f];0!==d;)e=a.heap[--c],e>j||(i[2*e+1]!==f&&(a.opt_len+=(f-i[2*e+1])*i[2*e],i[2*e+1]=f),d--)}}function l(a,b,c){var d,e,f=new Array(U+1),g=0;for(d=1;U>=d;d++)f[d]=g=g+c[d-1]<<1;for(e=0;b>=e;e++){var h=a[2*e+1];0!==h&&(a[2*e]=i(f[h]++,h))}}function m{var a,b,c,d,e,f=new Array(U+1);for(c=0,d=0;O-1>d;d++)for(ia[d]=c,a=0;a<1<<_[d];a++)ha[c++]=d;for(ha[c-1]=d,e=0,d=0;16>d;d++)for(ja[d]=e,a=0;a<1<<aa[d];a++)ga[e++]=d;for(e>>=7;R>d;d++)for(ja[d]=e<<7,a=0;a<1<<aa[d]-7;a++)ga[256+e++]=d;for(b=0;U>=b;b++)f[b]=0;for(a=0;143>=a;)ea[2*a+1]=8,a++,f[8]++;for(255>=a;)ea[2*a+1]=9,a++,f[9]++;for(279>=a;)ea[2*a+1]=7,a++,f[7]++;for(287>=a;)ea[2*a+1]=8,a++,f[8]++;for(l(ea,Q+1,f),a=0;R>a;a++)fa[2*a+1]=5,fa[2*a]=i(a,5);ka=new na(ea,_,P+1,Q,U),la=new na(fa,aa,0,R,U),ma=new na(new Array(0),ba,0,S,W)}function n(a){var b;for(b=0;Q>b;b++)a.dyn_ltree[2*b]=0;for(b=0;R>b;b++)a.dyn_dtree[2*b]=0;for(b=0;S>b;b++)a.bl_tree[2*b]=0;a.dyn_ltree[2*X]=1,a.opt_len=a.static_len=0,a.last_lit=a.matches=0}function o(a){a.bi_valid>8?f(a,a.bi_buf):a.bi_valid>0&&(a.pending_buf[a.pending++]=a.bi_buf),a.bi_buf=0,a.bi_valid=0}function p(a,b,c,d){o(a),d&&(f(a,c),f(a,~c)),E.arraySet(a.pending_buf,a.window,b,c,a.pending),a.pending+=c}function q(a,b,c,d){var e=2*b,f=2*c;return a[e]<a[f]||a[e]===a[f]&&d[b]<=d[c]}function r(a,b,c){for(var d=a.heap[c],e=c<<1;e<=a.heap_len&&(e<a.heap_len&&q(b,a.heap[e+1],a.heap[e],a.depth)&&e++,!q(b,d,a.heap[e],a.depth));)a.heap[c]=a.heap[e],c=e,e<<=1;a.heap[c]=d}function s(a,b,c){var d,f,i,j,k=0;if(0!==a.last_lit)do d=a.pending_buf[a.d_buf+2*k]<<8|a.pending_buf[a.d_buf+2*k+1],f=a.pending_buf[a.l_buf+k],k++,0===d?h(a,f,b):(i=ha[f],h(a,i+P+1,b),j=_[i],0!==j&&(f-=ia[i],g(a,f,j)),d--,i=e(d),h(a,i,c),j=aa[i],0!==j&&(d-=ja[i],g(a,d,j)));while(k<a.last_lit);h(a,X,b)}function t(a,b){var c,d,e,f=b.dyn_tree,g=b.stat_desc.static_tree,h=b.stat_desc.has_stree,i=b.stat_desc.elems,j=-1;for(a.heap_len=0,a.heap_max=T,c=0;i>c;c++)0!==f[2*c]?(a.heap[++a.heap_len]=j=c,a.depth[c]=0):f[2*c+1]=0;for(a.heap_len<2;)e=a.heap[++a.heap_len]=2>j?++j:0,f[2*e]=1,a.depth[e]=0,a.opt_len--,h&&(a.static_len-=g[2*e+1]);for(b.max_code=j,c=a.heap_len>>1;c>=1;c--)r(a,f,c);e=i;do c=a.heap[1],a.heap[1]=a.heap[a.heap_len--],r(a,f,1),d=a.heap[1],a.heap[--a.heap_max]=c,a.heap[--a.heap_max]=d,f[2*e]=f[2*c]+f[2*d],a.depth[e]=(a.depth[c]>=a.depth[d]?a.depth[c]:a.depth[d])+1,f[2*c+1]=f[2*d+1]=e,a.heap[1]=e++,r(a,f,1);while(a.heap_len>=2);a.heap[--a.heap_max]=a.heap[1],k(a,b),l(f,j,a.bl_count)}function u(a,b,c){var d,e,f=-1,g=b[1],h=0,i=7,j=4;for(0===g&&(i=138,j=3),b[2*(c+1)+1]=65535,d=0;c>=d;d++)e=g,g=b[2*(d+1)+1],++h<i&&e===g||(j>h?a.bl_tree[2*e]+=h:0!==e?(e!==f&&a.bl_tree[2*e]++,a.bl_tree[2*Y]++):10>=h?a.bl_tree[2*Z]++:a.bl_tree[2*$]++,h=0,f=e,0===g?(i=138,j=3):e===g?(i=6,j=3):(i=7,j=4))}function v(a,b,c){var d,e,f=-1,i=b[1],j=0,k=7,l=4;for(0===i&&(k=138,l=3),d=0;c>=d;d++)if(e=i,i=b[2*(d+1)+1],!(++j<k&&e===i)){if(l>j){do h(a,e,a.bl_tree);while(0!==--j)}else 0!==e?(e!==f&&(h(a,e,a.bl_tree),j--),h(a,Y,a.bl_tree),g(a,j-3,2)):10>=j?(h(a,Z,a.bl_tree),g(a,j-3,3)):(h(a,$,a.bl_tree),g(a,j-11,7));j=0,f=e,0===i?(k=138,l=3):e===i?(k=6,l=3):(k=7,l=4)}}function w(a){var b;for(u(a,a.dyn_ltree,a.l_desc.max_code),u(a,a.dyn_dtree,a.d_desc.max_code),t(a,a.bl_desc),b=S-1;b>=3&&0===a.bl_tree[2*ca[b]+1];b--);return a.opt_len+=3*(b+1)+5+5+4,b}function x(a,b,c,d){var e;for(g(a,b-257,5),g(a,c-1,5),g(a,d-4,4),e=0;d>e;e++)g(a,a.bl_tree[2*ca[e]+1],3);v(a,a.dyn_ltree,b-1),v(a,a.dyn_dtree,c-1)}function y(a){var b,c=4093624447;for(b=0;31>=b;b++,c>>>=1)if(1&c&&0!==a.dyn_ltree[2*b])return G;if(0!==a.dyn_ltree[18]||0!==a.dyn_ltree[20]||0!==a.dyn_ltree[26])return H;for(b=32;P>b;b++)if(0!==a.dyn_ltree[2*b])return H;return G}function z(a){pa||(m,pa=!0),a.l_desc=new oa(a.dyn_ltree,ka),a.d_desc=new oa(a.dyn_dtree,la),a.bl_desc=new oa(a.bl_tree,ma),a.bi_buf=0,a.bi_valid=0,n(a)}function A(a,b,c,d){g(a,(J<<1)+(d?1:0),3),p(a,b,c,!0)}function B(a){g(a,K<<1,3),h(a,X,ea),j(a)}function C(a,b,c,d){var e,f,h=0;a.level>0?(a.strm.data_type===I&&(a.strm.data_type=y(a)),t(a,a.l_desc),t(a,a.d_desc),h=w(a),e=a.opt_len+3+7>>>3,f=a.static_len+3+7>>>3,e>=f&&(e=f)):e=f=c+5,e>=c+4&&-1!==b?A(a,b,c,d):a.strategy===F||f===e?(g(a,(K<<1)+(d?1:0),3),s(a,ea,fa)):(g(a,(L<<1)+(d?1:0),3),x(a,a.l_desc.max_code+1,a.d_desc.max_code+1,h+1),s(a,a.dyn_ltree,a.dyn_dtree)),n(a),d&&o(a)}function D(a,b,c){ return a.pending_buf[a.d_buf+2*a.last_lit]=b>>>8&255,a.pending_buf[a.d_buf+2*a.last_lit+1]=255&b,a.pending_buf[a.l_buf+a.last_lit]=255&c,a.last_lit++,0===b?a.dyn_ltree[2*c]++:(a.matches++,b--,a.dyn_ltree[2*(ha[c]+P+1)]++,a.dyn_dtree[2*e(b)]++),a.last_lit===a.lit_bufsize-1}var E=a("../utils/common"),F=4,G=0,H=1,I=2,J=0,K=1,L=2,M=3,N=258,O=29,P=256,Q=P+1+O,R=30,S=19,T=2*Q+1,U=15,V=16,W=7,X=256,Y=16,Z=17,$=18,_=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],aa=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],ba=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],ca=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],da=512,ea=new Array(2*(Q+2));d(ea);var fa=new Array(2*R);d(fa);var ga=new Array(da);d(ga);var ha=new Array(N-M+1);d(ha);var ia=new Array(O);d(ia);var ja=new Array(R);d(ja);var ka,la,ma,na=function(a,b,c,d,e){this.static_tree=a,this.extra_bits=b,this.extra_base=c,this.elems=d,this.max_length=e,this.has_stree=a&&a.length},oa=function(a,b){this.dyn_tree=a,this.max_code=0,this.stat_desc=b},pa=!1;c._tr_init=z,c._tr_stored_block=A,c._tr_flush_block=C,c._tr_tally=D,c._tr_align=B},{"../utils/common":27}],39:[function(a,b,c){"use strict";function d{this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}b.exports=d},{}]},{},[9])(9)})},function{var b=a.amdDefine;!function(a,c){"function"==typeof b&&b.amd?(b("19",["15"],function(a){return c(a)}),b("typeahead.js",["19"],function(a){return a})):"object"==typeof exports?module.exports=c(require("jquery")):c(jQuery)}(this,function(a){var b=function{"use strict";return{isMsie:function{return/(msie|trident)/i.test(navigator.userAgent)?navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]:!1},isBlankString:function(a){return!a||/^\s*$/.test(a)},escapeRegExChars:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(a){return"string"==typeof a},isNumber:function(a){return"number"==typeof a},isArray:a.isArray,isFunction:a.isFunction,isObject:a.isPlainObject,isUndefined:function(a){return"undefined"==typeof a},isElement:function(a){return!(!a||1!==a.nodeType)},isJQuery:function(b){return b instanceof a},toStr:function(a){return b.isUndefined(a)||null===a?"":a+""},bind:a.proxy,each:function(b,c){function d(a,b){return c(b,a)}a.each(b,d)},map:a.map,filter:a.grep,every:function(b,c){var d=!0;return b?(a.each(b,function(a,e){return(d=c.call(null,e,a,b))?void 0:!1}),!!d):d},some:function(b,c){var d=!1;return b?(a.each(b,function(a,e){return(d=c.call(null,e,a,b))?!1:void 0}),!!d):d},mixin:a.extend,identity:function(a){return a},clone:function(b){return a.extend(!0,{},b)},getIdGenerator:function{var a=0;return function{return a++}},templatify:function(b){function c{return String(b)}return a.isFunction(b)?b:c},defer:function(a){setTimeout(a,0)},debounce:function(a,b,c){var d,e;return function{var f,g,h=this,i=arguments;return f=function{d=null,c||(e=a.apply(h,i))},g=c&&!d,clearTimeout(d),d=setTimeout(f,b),g&&(e=a.apply(h,i)),e}},throttle:function(a,b){var c,d,e,f,g,h;return g=0,h=function{g=new Date,e=null,f=a.apply(c,d)},function{var i=new Date,j=b-(i-g);return c=this,d=arguments,0>=j?(clearTimeout(e),e=null,g=i,f=a.apply(c,d)):e||(e=setTimeout(h,j)),f}},stringify:function(a){return b.isString(a)?a:JSON.stringify(a)},noop:function{}}},c=function{"use strict";function a(a){var g,h;return h=b.mixin({},f,a),g={css:e,classes:h,html:c(h),selectors:d(h)},{css:g.css,html:g.html,classes:g.classes,selectors:g.selectors,mixin:function(a){b.mixin(a,g)}}}function c(a){return{wrapper:'<span class="'+a.wrapper+'"> ',menu:'<div class="'+a.menu+'"> '}}function d(a){var c={};return b.each(a,function(a,b){c[b]="."+a}),c}function e{var a={wrapper:{position:"relative",display:"inline-block"},hint:{position:"absolute",top:"0",left:"0",borderColor:"transparent",boxShadow:"none",opacity:"1"},input:{position:"relative",verticalAlign:"top",backgroundColor:"transparent"},inputWithNoHint:{position:"relative",verticalAlign:"top"},menu:{position:"absolute",top:"100%",left:"0",zIndex:"100",display:"none"},ltr:{left:"0",right:"auto"},rtl:{left:"auto",right:" 0"}};return b.isMsie&&b.mixin(a.input,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"}),a}var f={wrapper:"twitter-typeahead",input:"tt-input",hint:"tt-hint",menu:"tt-menu",dataset:"tt-dataset",suggestion:"tt-suggestion",selectable:"tt-selectable",empty:"tt-empty",open:"tt-open",cursor:"tt-cursor",highlight:"tt-highlight"};return a},d=function{"use strict";function c(b){b&&b.el||a.error("EventBus initialized without el"),this.$el=a(b.el)}var d,e;return d="typeahead:",e={render:"rendered",cursorchange:"cursorchanged",select:"selected",autocomplete:"autocompleted"},b.mixin(c.prototype,{_trigger:function(b,c){var e;return e=a.Event(d+b),(c=c||[]).unshift(e),this.$el.trigger.apply(this.$el,c),e},before:function(a){var b,c;return b=[].slice.call(arguments,1),c=this._trigger("before"+a,b),c.isDefaultPrevented},trigger:function(a){var b;this._trigger(a,[].slice.call(arguments,1)),(b=e[a])&&this._trigger(b,[].slice.call(arguments,1))}}),c},e=function{"use strict";function a(a,b,c,d){var e;if(!c)return this;for(b=b.split(i),c=d?h(c,d):c,this._callbacks=this._callbacks||{};e=b.shift;)this._callbacks[e]=this._callbacks[e]||{sync:[],async:[]},this._callbacks[e][a].push(c);return this}function b(b,c,d){return a.call(this,"async",b,c,d)}function c(b,c,d){return a.call(this,"sync",b,c,d)}function d(a){var b;if(!this._callbacks)return this;for(a=a.split(i);b=a.shift;)delete this._callbacks[b];return this}function e(a){var b,c,d,e,g;if(!this._callbacks)return this;for(a=a.split(i),d=[].slice.call(arguments,1);(b=a.shift)&&(c=this._callbacks[b]);)e=f(c.sync,this,[b].concat(d)),g=f(c.async,this,[b].concat(d)),e&&j(g);return this}function f(a,b,c){function d{for(var d,e=0,f=a.length;!d&&f>e;e+=1)d=a[e].apply(b,c)===!1;return!d}return d}function g{var a;return a=window.setImmediate?function(a){setImmediate(function{a})}:function(a){setTimeout(function{a},0)}}function h(a,b){return a.bind?a.bind(b):function{a.apply(b,[].slice.call(arguments,0))}}var i=/\s+/,j=g;return{onSync:c,onAsync:b,off:d,trigger:e}},f=function(a){"use strict";function c(a,c,d){for(var e,f=[],g=0,h=a.length;h>g;g++)f.push(b.escapeRegExChars(a[g]));return e=d?"\\b("+f.join("|")+")\\b":"("+f.join("|")+")",c?new RegExp(e):new RegExp(e,"i")}var d={node:null,pattern:null,tagName:"strong",className:null,wordsOnly:!1,caseSensitive:!1};return function(e){function f(b){var c,d,f;return(c=h.exec(b.data))&&(f=a.createElement(e.tagName),e.className&&(f.className=e.className),d=b.splitText(c.index),d.splitText(c[0].length),f.appendChild(d.cloneNode(!0)),b.parentNode.replaceChild(f,d)),!!c}function g(a,b){for(var c,d=3,e=0;e<a.childNodes.length;e++)c=a.childNodes[e],c.nodeType===d?e+=b(c)?1:0:g(c,b)}var h;e=b.mixin({},d,e),e.node&&e.pattern&&(e.pattern=b.isArray(e.pattern)?e.pattern:[e.pattern],h=c(e.pattern,e.caseSensitive,e.wordsOnly),g(e.node,f))}}(window.document),g=function{"use strict";function c(c,e){c=c||{},c.input||a.error("input is missing"),e.mixin(this),this.$hint=a(c.hint),this.$input=a(c.input),this.query=this.$input.val,this.queryWhenFocused=this.hasFocus?this.query:null,this.$overflowHelper=d(this.$input),this._checkLanguageDirection,0===this.$hint.length&&(this.setHint=this.getHint=this.clearHint=this.clearHintIfInvalid=b.noop)}function d(b){return a('<pre aria-hidden="true"> ').css({position:"absolute",visibility:"hidden",whiteSpace:"pre",fontFamily:b.css("font-family"),fontSize:b.css("font-size"),fontStyle:b.css("font-style"),fontVariant:b.css("font-variant"),fontWeight:b.css("font-weight"),wordSpacing:b.css("word-spacing"),letterSpacing:b.css("letter-spacing"),textIndent:b.css("text-indent"),textRendering:b.css("text-rendering"),textTransform:b.css("text-transform")}).insertAfter(b)}function f(a,b){return c.normalizeQuery(a)===c.normalizeQuery(b)}function g(a){return a.altKey||a.ctrlKey||a.metaKey||a.shiftKey}var h;return h={9:"tab",27:"esc",37:"left",39:"right",13:"enter",38:"up",40:"down"},c.normalizeQuery=function(a){return b.toStr(a).replace(/^\s*/g,"").replace(/\s{2,}/g," ")},b.mixin(c.prototype,e,{_onBlur:function{this.resetInputValue,this.trigger("blurred")},_onFocus:function{this.queryWhenFocused=this.query,this.trigger("focused")},_onKeydown:function(a){var b=h[a.which||a.keyCode];this._managePreventDefault(b,a),b&&this._shouldTrigger(b,a)&&this.trigger(b+"Keyed",a)},_onInput:function{this._setQuery(this.getInputValue),this.clearHintIfInvalid,this._checkLanguageDirection},_managePreventDefault:function(a,b){var c;switch(a){case"up":case"down":c=!g(b);break;default:c=!1}c&&b.preventDefault},_shouldTrigger:function(a,b){var c;switch(a){case"tab":c=!g(b);break;default:c=!0}return c},_checkLanguageDirection:function{var a=(this.$input.css("direction")||"ltr").toLowerCase;this.dir!==a&&(this.dir=a,this.$hint.attr("dir",a),this.trigger("langDirChanged",a))},_setQuery:function(a,b){var c,d;c=f(a,this.query),d=c?this.query.length!==a.length:!1,this.query=a,b||c?!b&&d&&this.trigger("whitespaceChanged",this.query):this.trigger("queryChanged",this.query)},bind:function{var a,c,d,e,f=this;return a=b.bind(this._onBlur,this),c=b.bind(this._onFocus,this),d=b.bind(this._onKeydown,this),e=b.bind(this._onInput,this),this.$input.on("blur.tt",a).on("focus.tt",c).on("keydown.tt",d),!b.isMsie||b.isMsie>9?this.$input.on("input.tt",e):this.$input.on("keydown.tt keypress.tt cut.tt paste.tt",function(a){h[a.which||a.keyCode]||b.defer(b.bind(f._onInput,f,a))}),this},focus:function{this.$input.focus},blur:function{this.$input.blur},getLangDir:function{return this.dir},getQuery:function{return this.query||""},setQuery:function(a,b){this.setInputValue(a),this._setQuery(a,b)},hasQueryChangedSinceLastFocus:function{return this.query!==this.queryWhenFocused},getInputValue:function{return this.$input.val},setInputValue:function(a){this.$input.val(a),this.clearHintIfInvalid,this._checkLanguageDirection},resetInputValue:function{this.setInputValue(this.query)},getHint:function{return this.$hint.val},setHint:function(a){this.$hint.val(a)},clearHint:function{this.setHint("")},clearHintIfInvalid:function{var a,b,c,d;a=this.getInputValue,b=this.getHint,c=a!==b&&0===b.indexOf(a),d=""!==a&&c&&!this.hasOverflow,!d&&this.clearHint},hasFocus:function{return this.$input.is(":focus")},hasOverflow:function{var a=this.$input.width-2;return this.$overflowHelper.text(this.getInputValue),this.$overflowHelper.width>=a},isCursorAtEnd:function{var a,c,d;return a=this.$input.val.length,c=this.$input[0].selectionStart,b.isNumber(c)?c===a:document.selection?(d=document.selection.createRange,d.moveStart("character",-a),a===d.text.length):!0},destroy:function{this.$hint.off(".tt"),this.$input.off(".tt"),this.$overflowHelper.remove,this.$hint=this.$input=this.$overflowHelper=a(" ")}}),c},h=function{"use strict";function c(c,e){c=c||{},c.templates=c.templates||{},c.templates.notFound=c.templates.notFound||c.templates.empty,c.source||a.error("missing source"),c.node||a.error("missing node"),c.name&&!h(c.name)&&a.error("invalid dataset name: "+c.name),e.mixin(this),this.highlight=!!c.highlight,this.name=c.name||j,this.limit=c.limit||5,this.displayFn=d(c.display||c.displayKey),this.templates=g(c.templates,this.displayFn),this.source=c.source.__ttAdapter?c.source.__ttAdapter:c.source,this.async=b.isUndefined(c.async)?this.source.length>2:!!c.async,this._resetLastSuggestion,this.$el=a(c.node).addClass(this.classes.dataset).addClass(this.classes.dataset+"-"+this.name)}function d(a){function c(b){return b[a]}return a=a||b.stringify,b.isFunction(a)?a:c}function g(c,d){function e(b){return a(" ").text(d(b))}return{notFound:c.notFound&&b.templatify(c.notFound),pending:c.pending&&b.templatify(c.pending),header:c.header&&b.templatify(c.header),footer:c.footer&&b.templatify(c.footer),suggestion:c.suggestion||e}}function h(a){return/^[_a-zA-Z0-9-]+$/.test(a)}var i,j;return i={val:"tt-selectable-display",obj:"tt-selectable-object"},j=b.getIdGenerator,c.extractData=function(b){var c=a(b);return c.data(i.obj)?{val:c.data(i.val)||"",obj:c.data(i.obj)||null}:null},b.mixin(c.prototype,e,{_overwrite:function(a,b){b=b||[],b.length?this._renderSuggestions(a,b):this.async&&this.templates.pending?this._renderPending(a):!this.async&&this.templates.notFound?this._renderNotFound(a):this._empty,this.trigger("rendered",this.name,b,!1)},_append:function(a,b){b=b||[],b.length&&this.$lastSuggestion.length?this._appendSuggestions(a,b):b.length?this._renderSuggestions(a,b):!this.$lastSuggestion.length&&this.templates.notFound&&this._renderNotFound(a),this.trigger("rendered",this.name,b,!0)},_renderSuggestions:function(a,b){var c;c=this._getSuggestionsFragment(a,b),this.$lastSuggestion=c.children.last,this.$el.html(c).prepend(this._getHeader(a,b)).append(this._getFooter(a,b))},_appendSuggestions:function(a,b){var c,d;c=this._getSuggestionsFragment(a,b),d=c.children.last,this.$lastSuggestion.after(c),this.$lastSuggestion=d},_renderPending:function(a){var b=this.templates.pending;this._resetLastSuggestion,b&&this.$el.html(b({query:a,dataset:this.name}))},_renderNotFound:function(a){var b=this.templates.notFound;this._resetLastSuggestion,b&&this.$el.html(b({query:a,dataset:this.name}))},_empty:function{this.$el.empty,this._resetLastSuggestion},_getSuggestionsFragment:function(c,d){var e,g=this;return e=document.createDocumentFragment,b.each(d,function(b){var d,f;f=g._injectQuery(c,b),d=a(g.templates.suggestion(f)).data(i.obj,b).data(i.val,g.displayFn(b)).addClass(g.classes.suggestion+" "+g.classes.selectable),e.appendChild(d[0])}),this.highlight&&f({className:this.classes.highlight,node:e,pattern:c}),a(e)},_getFooter:function(a,b){return this.templates.footer?this.templates.footer({query:a,suggestions:b,dataset:this.name}):null},_getHeader:function(a,b){return this.templates.header?this.templates.header({query:a,suggestions:b,dataset:this.name}):null},_resetLastSuggestion:function{this.$lastSuggestion=a},_injectQuery:function(a,c){return b.isObject(c)?b.mixin({_query:a},c):c},update:function(b){function c(a){g||(g=!0,a=(a||[]).slice(0,e.limit),h=a.length,e._overwrite(b,a),h<e.limit&&e.async&&e.trigger("asyncRequested",b))}function d(c){c=c||[],!f&&h<e.limit&&(e.cancel=a.noop,h+=c.length,e._append(b,c.slice(0,e.limit-h)),e.async&&e.trigger("asyncReceived",b))}var e=this,f=!1,g=!1,h=0;this.cancel,this.cancel=function{f=!0,e.cancel=a.noop,e.async&&e.trigger("asyncCanceled",b)},this.source(b,c,d),!g&&c([])},cancel:a.noop,clear:function{this._empty,this.cancel,this.trigger("cleared")},isEmpty:function{return this.$el.is(":empty")},destroy:function{this.$el=a(" ")}}),c},i=function{"use strict";function c(c,d){function e(b){var c=f.$node.find(b.node).first;return b.node=c.length?c:a(" ").appendTo(f.$node),new h(b,d)}var f=this;c=c||{},c.node||a.error("node is required"),d.mixin(this),this.$node=a(c.node),this.query=null,this.datasets=b.map(c.datasets,e)}return b.mixin(c.prototype,e,{_onSelectableClick:function(b){this.trigger("selectableClicked",a(b.currentTarget))},_onRendered:function(a,b,c,d){this.$node.toggleClass(this.classes.empty,this._allDatasetsEmpty),this.trigger("datasetRendered",b,c,d)},_onCleared:function{this.$node.toggleClass(this.classes.empty,this._allDatasetsEmpty),this.trigger("datasetCleared")},_propagate:function{this.trigger.apply(this,arguments)},_allDatasetsEmpty:function{function a(a){return a.isEmpty}return b.every(this.datasets,a)},_getSelectables:function{return this.$node.find(this.selectors.selectable)},_removeCursor:function{var a=this.getActiveSelectable;a&&a.removeClass(this.classes.cursor)},_ensureVisible:function(a){var b,c,d,e;b=a.position.top,c=b+a.outerHeight(!0),d=this.$node.scrollTop,e=this.$node.height+parseInt(this.$node.css("paddingTop"),10)+parseInt(this.$node.css("paddingBottom"),10),0>b?this.$node.scrollTop(d+b):c>e&&this.$node.scrollTop(d+(c-e))},bind:function{var a,c=this;return a=b.bind(this._onSelectableClick,this),this.$node.on("click.tt",this.selectors.selectable,a),b.each(this.datasets,function(a){a.onSync("asyncRequested",c._propagate,c).onSync("asyncCanceled",c._propagate,c).onSync("asyncReceived",c._propagate,c).onSync("rendered",c._onRendered,c).onSync("cleared",c._onCleared,c)}),this},isOpen:function{return this.$node.hasClass(this.classes.open)},open:function{this.$node.addClass(this.classes.open)},close:function{this.$node.removeClass(this.classes.open),this._removeCursor},setLanguageDirection:function(a){this.$node.attr("dir",a)},selectableRelativeToCursor:function(a){var b,c,d,e;return c=this.getActiveSelectable,b=this._getSelectables,d=c?b.index(c):-1,e=d+a,e=(e+1)%(b.length+1)-1,e=-1>e?b.length-1:e,-1===e?null:b.eq(e)},setCursor:function(a){this._removeCursor,(a=a&&a.first)&&(a.addClass(this.classes.cursor),this._ensureVisible(a))},getSelectableData:function(a){return a&&a.length?h.extractData(a):null},getActiveSelectable:function{var a=this._getSelectables.filter(this.selectors.cursor).first;return a.length?a:null},getTopSelectable:function{var a=this._getSelectables.first;return a.length?a:null},update:function(a){function c(b){b.update(a)}var d=a!==this.query;return d&&(this.query=a,b.each(this.datasets,c)),d},empty:function{function a(a){a.clear}b.each(this.datasets,a),this.query=null,this.$node.addClass(this.classes.empty)},destroy:function{function c(a){a.destroy}this.$node.off(".tt"),this.$node=a(" "),b.each(this.datasets,c)}}),c},j=function{"use strict";function a{i.apply(this,[].slice.call(arguments,0))}var c=i.prototype;return b.mixin(a.prototype,i.prototype,{open:function{return!this._allDatasetsEmpty&&this._show,c.open.apply(this,[].slice.call(arguments,0))},close:function{return this._hide,c.close.apply(this,[].slice.call(arguments,0))},_onRendered:function{return this._allDatasetsEmpty?this._hide:this.isOpen&&this._show,c._onRendered.apply(this,[].slice.call(arguments,0))},_onCleared:function{return this._allDatasetsEmpty?this._hide:this.isOpen&&this._show,c._onCleared.apply(this,[].slice.call(arguments,0))},setLanguageDirection:function(a){return this.$node.css("ltr"===a?this.css.ltr:this.css.rtl),c.setLanguageDirection.apply(this,[].slice.call(arguments,0))},_hide:function{this.$node.hide},_show:function{this.$node.css("display","block")}}),a},k=function{"use strict";function c(c,e){var f,g,h,i,j,k,l,m,n,o,p;c=c||{},c.input||a.error("missing input"),c.menu||a.error("missing menu"),c.eventBus||a.error("missing event bus"),e.mixin(this),this.eventBus=c.eventBus,this.minLength=b.isNumber(c.minLength)?c.minLength:1,this.input=c.input,this.menu=c.menu,this.enabled=!0,this.active=!1,this.input.hasFocus&&this.activate,this.dir=this.input.getLangDir,this._hacks,this.menu.bind.onSync("selectableClicked",this._onSelectableClicked,this).onSync("asyncRequested",this._onAsyncRequested,this).onSync("asyncCanceled",this._onAsyncCanceled,this).onSync("asyncReceived",this._onAsyncReceived,this).onSync("datasetRendered",this._onDatasetRendered,this).onSync("datasetCleared",this._onDatasetCleared,this),f=d(this,"activate","open","_onFocused"),g=d(this,"deactivate","_onBlurred"),h=d(this,"isActive","isOpen","_onEnterKeyed"),i=d(this,"isActive","isOpen","_onTabKeyed"),j=d(this,"isActive","_onEscKeyed"),k=d(this,"isActive","open","_onUpKeyed"),l=d(this,"isActive","open","_onDownKeyed"),m=d(this,"isActive","isOpen","_onLeftKeyed"),n=d(this,"isActive","isOpen","_onRightKeyed"),o=d(this,"_openIfActive","_onQueryChanged"),p=d(this,"_openIfActive","_onWhitespaceChanged"),this.input.bind.onSync("focused",f,this).onSync("blurred",g,this).onSync("enterKeyed",h,this).onSync("tabKeyed",i,this).onSync("escKeyed",j,this).onSync("upKeyed",k,this).onSync("downKeyed",l,this).onSync("leftKeyed",m,this).onSync("rightKeyed",n,this).onSync("queryChanged",o,this).onSync("whitespaceChanged",p,this).onSync("langDirChanged",this._onLangDirChanged,this)}function d(a){var c=[].slice.call(arguments,1);return function{var d=[].slice.call(arguments);b.each(c,function(b){return a[b].apply(a,d)})}}return b.mixin(c.prototype,{_hacks:function{var c,d;c=this.input.$input||a(" "),d=this.menu.$node||a(" "),c.on("blur.tt",function(a){var e,f,g;e=document.activeElement,f=d.is(e),g=d.has(e).length>0,b.isMsie&&(f||g)&&(a.preventDefault,a.stopImmediatePropagation,b.defer(function{c.focus}))}),d.on("mousedown.tt",function(a){a.preventDefault})},_onSelectableClicked:function(a,b){this.select(b)},_onDatasetCleared:function{this._updateHint},_onDatasetRendered:function(a,b,c,d){this._updateHint,this.eventBus.trigger("render",c,d,b)},_onAsyncRequested:function(a,b,c){this.eventBus.trigger("asyncrequest",c,b)},_onAsyncCanceled:function(a,b,c){this.eventBus.trigger("asynccancel",c,b)},_onAsyncReceived:function(a,b,c){this.eventBus.trigger("asyncreceive",c,b)},_onFocused:function{this._minLengthMet&&this.menu.update(this.input.getQuery)},_onBlurred:function{this.input.hasQueryChangedSinceLastFocus&&this.eventBus.trigger("change",this.input.getQuery)},_onEnterKeyed:function(a,b){var c;(c=this.menu.getActiveSelectable)&&this.select(c)&&b.preventDefault},_onTabKeyed:function(a,b){var c;(c=this.menu.getActiveSelectable)?this.select(c)&&b.preventDefault:(c=this.menu.getTopSelectable)&&this.autocomplete(c)&&b.preventDefault},_onEscKeyed:function{this.close},_onUpKeyed:function{this.moveCursor(-1)},_onDownKeyed:function{this.moveCursor(1)},_onLeftKeyed:function{"rtl"===this.dir&&this.input.isCursorAtEnd&&this.autocomplete(this.menu.getTopSelectable)},_onRightKeyed:function{"ltr"===this.dir&&this.input.isCursorAtEnd&&this.autocomplete(this.menu.getTopSelectable)},_onQueryChanged:function(a,b){this._minLengthMet(b)?this.menu.update(b):this.menu.empty},_onWhitespaceChanged:function{this._updateHint},_onLangDirChanged:function(a,b){this.dir!==b&&(this.dir=b,this.menu.setLanguageDirection(b))},_openIfActive:function{this.isActive&&this.open},_minLengthMet:function(a){return a=b.isString(a)?a:this.input.getQuery||"",a.length>=this.minLength},_updateHint:function{var a,c,d,e,f,h,i;a=this.menu.getTopSelectable,c=this.menu.getSelectableData(a),d=this.input.getInputValue,!c||b.isBlankString(d)||this.input.hasOverflow?this.input.clearHint:(e=g.normalizeQuery(d),f=b.escapeRegExChars(e),h=new RegExp("^(?:"+f+")(.+$)","i"),i=h.exec(c.val),i&&this.input.setHint(d+i[1]))},isEnabled:function{return this.enabled},enable:function{this.enabled=!0},disable:function{this.enabled=!1},isActive:function{return this.active},activate:function{return this.isActive?!0:!this.isEnabled||this.eventBus.before("active")?!1:(this.active=!0,this.eventBus.trigger("active"),!0)},deactivate:function{return this.isActive?this.eventBus.before("idle")?!1:(this.active=!1,this.close,this.eventBus.trigger("idle"),!0):!0},isOpen:function{return this.menu.isOpen},open:function{return this.isOpen||this.eventBus.before("open")||(this.menu.open,this._updateHint,this.eventBus.trigger("open")),this.isOpen},close:function{return this.isOpen&&!this.eventBus.before("close")&&(this.menu.close,this.input.clearHint,this.input.resetInputValue,this.eventBus.trigger("close")),!this.isOpen},setVal:function(a){this.input.setQuery(b.toStr(a))},getVal:function{return this.input.getQuery},select:function(a){var b=this.menu.getSelectableData(a);return b&&!this.eventBus.before("select",b.obj)?(this.input.setQuery(b.val,!0),this.eventBus.trigger("select",b.obj),this.close,!0):!1},autocomplete:function(a){var b,c,d;return b=this.input.getQuery,c=this.menu.getSelectableData(a),d=c&&b!==c.val,d&&!this.eventBus.before("autocomplete",c.obj)?(this.input.setQuery(c.val),this.eventBus.trigger("autocomplete",c.obj),!0):!1},moveCursor:function(a){var b,c,d,e,f;return b=this.input.getQuery,c=this.menu.selectableRelativeToCursor(a),d=this.menu.getSelectableData(c),e=d?d.obj:null,f=this._minLengthMet&&this.menu.update(b),f||this.eventBus.before("cursorchange",e)?!1:(this.menu.setCursor(c),d?this.input.setInputValue(d.val):(this.input.resetInputValue,this._updateHint),this.eventBus.trigger("cursorchange",e),!0)},destroy:function{this.input.destroy,this.menu.destroy}}),c};!function{"use strict";function e(b,c){b.each(function{var b,d=a(this);(b=d.data(p.typeahead))&&c(b,d)})}function f(a,b){return a.clone.addClass(b.classes.hint).removeData.css(b.css.hint).css(l(a)).prop("readonly",!0).removeAttr("id name placeholder required").attr({autocomplete:"off",spellcheck:"false",tabindex:-1})}function h(a,b){a.data(p.attrs,{dir:a.attr("dir"),autocomplete:a.attr("autocomplete"),spellcheck:a.attr("spellcheck"),style:a.attr("style")}),a.addClass(b.classes.input).attr({autocomplete:"off",spellcheck:!1});try{!a.attr("dir")&&a.attr("dir","auto")}catch(c){}return a}function l(a){return{backgroundAttachment:a.css("background-attachment"),backgroundClip:a.css("background-clip"),backgroundColor:a.css("background-color"),backgroundImage:a.css("background-image"),backgroundOrigin:a.css("background-origin"),backgroundPosition:a.css("background-position"),backgroundRepeat:a.css("background-repeat"),backgroundSize:a.css("background-size")}}function m(a){var c,d;c=a.data(p.www),d=a.parent.filter(c.selectors.wrapper),b.each(a.data(p.attrs),function(c,d){b.isUndefined(c)?a.removeAttr(d):a.attr(d,c)}),a.removeData(p.typeahead).removeData(p.www).removeData(p.attr).removeClass(c.classes.input),d.length&&(a.detach.insertAfter(d),d.remove)}function n(c){var d,e;return d=b.isJQuery(c)||b.isElement(c),e=d?a(c).first:[],e.length?e:null}var o,p,q;o=a.fn.typeahead,p={www:"tt-www",attrs:"tt-attrs",typeahead:"tt-typeahead"},q={initialize:function(e,l){function m{var c,m,q,r,s,t,u,v,w,x,y;b.each(l,function(a){a.highlight=!!e.highlight}),c=a(this),m=a(o.html.wrapper),q=n(e.hint),r=n(e.menu),s=e.hint!==!1&&!q,t=e.menu!==!1&&!r,s&&(q=f(c,o)),t&&(r=a(o.html.menu).css(o.css.menu)),q&&q.val(""),c=h(c,o),(s||t)&&(m.css(o.css.wrapper),c.css(s?o.css.input:o.css.inputWithNoHint),c.wrap(m).parent.prepend(s?q:null).append(t?r:null)),y=t?j:i,u=new d({el:c}),v=new g({hint:q,input:c},o),w=new y({node:r,datasets:l},o),x=new k({input:v,menu:w,eventBus:u,minLength:e.minLength},o),c.data(p.www,o),c.data(p.typeahead,x)}var o;return l=b.isArray(l)?l:[].slice.call(arguments,1),e=e||{},o=c(e.classNames),this.each(m)},isEnabled:function{var a;return e(this.first,function(b){a=b.isEnabled}),a},enable:function{return e(this,function(a){a.enable}),this},disable:function{return e(this,function(a){a.disable}),this},isActive:function{var a;return e(this.first,function(b){a=b.isActive}),a},activate:function{return e(this,function(a){a.activate}),this},deactivate:function{return e(this,function(a){a.deactivate}),this},isOpen:function{var a;return e(this.first,function(b){a=b.isOpen}),a},open:function{return e(this,function(a){a.open}),this},close:function{return e(this,function(a){a.close}),this},select:function(b){var c=!1,d=a(b);return e(this.first,function(a){c=a.select(d)}),c},autocomplete:function(b){var c=!1,d=a(b);return e(this.first,function(a){c=a.autocomplete(d)}),c},moveCursor:function(a){var b=!1;return e(this.first,function(c){b=c.moveCursor(a)}),b},val:function(a){var b;return arguments.length?(e(this,function(b){b.setVal(a)}),this):(e(this.first,function(a){b=a.getVal}),b)},destroy:function{return e(this,function(a,b){m(b),a.destroy}),this}},a.fn.typeahead=function(a){return q[a]?q[a].apply(this,[].slice.call(arguments,1)):q.initialize.apply(this,arguments)},a.fn.typeahead.noConflict=function{return a.fn.typeahead=o,this}}})},function{var b=a.amdDefine;!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,c){function d(a){var b=!!a&&"length"in a&&a.length,c=ga.type(a);return"function"===c||ga.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}function e(a,b,c){if(ga.isFunction(b))return ga.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return ga.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(qa.test(b))return ga.filter(b,a,c);b=ga.filter(b,a)}return ga.grep(a,function(a){return aa.call(b,a)>-1!==c})}function f(a,b){for((a=a[b])&&1!==a.nodeType;);return a}function g(a){var b={};return ga.each(a.match(wa)||[],function(a,c){b[c]=!0}),b}function h{Y.removeEventListener("DOMContentLoaded",h),a.removeEventListener("load",h),ga.ready}function i{this.expando=ga.expando+i.uid++}function j(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Da,"-$&").toLowerCase,c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:Ca.test(c)?ga.parseJSON(c):c}catch(e){}Ba.set(a,b,c)}else c=void 0;return c}function k(a,b,c,d){var e,f=1,g=20,h=d?function{return d.cur}:function{return ga.css(a,b,"")},i=h,j=c&&c[3]||(ga.cssNumber[b]?"":"px"),k=(ga.cssNumber[b]||"px"!==j&&+i)&&Fa.exec(ga.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,ga.style(a,b,k+j);while(f!==(f=h/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}function l(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&ga.nodeName(a,b)?ga.merge([a],c):c}function m(a,b){for(var c=0,d=a.length;d>c;c++)Aa.set(a[c],"globalEval",!b||Aa.get(b[c],"globalEval"))}function n(a,b,c,d,e){for(var f,g,h,i,j,k,n=b.createDocumentFragment,o=[],p=0,q=a.length;q>p;p++)if(f=a[p],f||0===f)if("object"===ga.type(f))ga.merge(o,f.nodeType?[f]:f);else if(Ma.test(f)){for(g=g||n.appendChild(b.createElement("div")),h=(Ja.exec(f)||["",""])[1].toLowerCase,i=La[h]||La._default,g.innerHTML=i[1]+ga.htmlPrefilter(f)+i[2],k=i[0];k--;)g=g.lastChild;ga.merge(o,g.childNodes),g=n.firstChild,g.textContent=""}else o.push(b.createTextNode(f));for(n.textContent="",p=0;f=o[p++];)if(d&&ga.inArray(f,d)>-1)e&&e.push(f);else if(j=ga.contains(f.ownerDocument,f),g=l(n.appendChild(f),"script"),j&&m(g),c)for(k=0;f=g[k++];)Ka.test(f.type||"")&&c.push(f);return n}function o{return!0}function p{return!1}function q{try{return Y.activeElement}catch(a){}}function r(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)r(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=p;else if(!e)return a;return 1===f&&(g=e,e=function(a){return ga.off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=ga.guid++)),a.each(function{ga.event.add(this,b,e,d,c)})}function s(a,b){return ga.nodeName(a,"table")&&ga.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function t(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function u(a){var b=Ta.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function v(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(Aa.hasData(a)&&(f=Aa.access(a),g=Aa.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)ga.event.add(b,e,j[e][c])}Ba.hasData(a)&&(h=Ba.access(a), i=ga.extend({},h),Ba.set(b,i))}}function w(a,b){var c=b.nodeName.toLowerCase;"input"===c&&Ia.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function x(a,b,c,d){b=$.apply([],b);var e,f,g,h,i,j,k=0,m=a.length,o=m-1,p=b[0],q=ga.isFunction(p);if(q||m>1&&"string"==typeof p&&!ea.checkClone&&Sa.test(p))return a.each(function(e){var f=a.eq(e);q&&(b[0]=p.call(this,e,f.html)),x(f,b,c,d)});if(m&&(e=n(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(g=ga.map(l(e,"script"),t),h=g.length;m>k;k++)i=e,k!==o&&(i=ga.clone(i,!0,!0),h&&ga.merge(g,l(i,"script"))),c.call(a[k],i,k);if(h)for(j=g[g.length-1].ownerDocument,ga.map(g,u),k=0;h>k;k++)i=g[k],Ka.test(i.type||"")&&!Aa.access(i,"globalEval")&&ga.contains(j,i)&&(i.src?ga._evalUrl&&ga._evalUrl(i.src):ga.globalEval(i.textContent.replace(Ua,"")))}return a}function y(a,b,c){for(var d,e=b?ga.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||ga.cleanData(l(d)),d.parentNode&&(c&&ga.contains(d.ownerDocument,d)&&m(l(d,"script")),d.parentNode.removeChild(d));return a}function z(a,b){var c=ga(b.createElement(a)).appendTo(b.body),d=ga.css(c[0],"display");return c.detach,d}function A(a){var b=Y,c=Wa[a];return c||(c=z(a,b),"none"!==c&&c||(Va=(Va||ga("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=Va[0].contentDocument,b.write,b.close,c=z(a,b),Va.detach),Wa[a]=c),c}function B(a,b,c){var d,e,f,g,h=a.style;return c=c||Za(a),g=c?c.getPropertyValue(b)||c[b]:void 0,""!==g&&void 0!==g||ga.contains(a.ownerDocument,a)||(g=ga.style(a,b)),c&&!ea.pixelMarginRight&&Ya.test(g)&&Xa.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f),void 0!==g?g+"":g}function C(a,b){return{get:function{return a?void delete this.get:(this.get=b).apply(this,arguments)}}}function D(a){if(a in eb)return a;for(var b=a[0].toUpperCase+a.slice(1),c=db.length;c--;)if(a=db[c]+b,a in eb)return a}function E(a,b,c){var d=Fa.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function F(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=ga.css(a,c+Ga[f],!0,e)),d?("content"===c&&(g-=ga.css(a,"padding"+Ga[f],!0,e)),"margin"!==c&&(g-=ga.css(a,"border"+Ga[f]+"Width",!0,e))):(g+=ga.css(a,"padding"+Ga[f],!0,e),"padding"!==c&&(g+=ga.css(a,"border"+Ga[f]+"Width",!0,e)));return g}function G(b,c,d){var e=!0,f="width"===c?b.offsetWidth:b.offsetHeight,g=Za(b),h="border-box"===ga.css(b,"boxSizing",!1,g);if(Y.msFullscreenElement&&a.top!==a&&b.getClientRects.length&&(f=Math.round(100*b.getBoundingClientRect[c])),0>=f||null==f){if(f=B(b,c,g),(0>f||null==f)&&(f=b.style[c]),Ya.test(f))return f;e=h&&(ea.boxSizingReliable||f===b.style[c]),f=parseFloat(f)||0}return f+F(b,c,d||(h?"border":"content"),e,g)+"px"}function H(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=Aa.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&Ha(d)&&(f[g]=Aa.access(d,"olddisplay",A(d.nodeName)))):(e=Ha(d),"none"===c&&e||Aa.set(d,"olddisplay",e?c:ga.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function I(a,b,c,d,e){return new I.prototype.init(a,b,c,d,e)}function J{return a.setTimeout(function{fb=void 0}),fb=ga.now}function K(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=Ga[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function L(a,b,c){for(var d,e=(O.tweeners[b]||[]).concat(O.tweeners["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function M(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},n=a.style,o=a.nodeType&&Ha(a),p=Aa.get(a,"fxshow");c.queue||(h=ga._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function{h.unqueued||i}),h.unqueued++,l.always(function{l.always(function{h.unqueued--,ga.queue(a,"fx").length||h.empty.fire})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[n.overflow,n.overflowX,n.overflowY],j=ga.css(a,"display"),k="none"===j?Aa.get(a,"olddisplay")||A(a.nodeName):j,"inline"===k&&"none"===ga.css(a,"float")&&(n.display="inline-block")),c.overflow&&(n.overflow="hidden",l.always(function{n.overflow=c.overflow[0],n.overflowX=c.overflow[1],n.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],hb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(o?"hide":"show")){if("show"!==e||!p||void 0===p[d])continue;o=!0}m[d]=p&&p[d]||ga.style(a,d)}else j=void 0;if(ga.isEmptyObject(m))"inline"===("none"===j?A(a.nodeName):j)&&(n.display=j);else{p?"hidden"in p&&(o=p.hidden):p=Aa.access(a,"fxshow",{}),f&&(p.hidden=!o),o?ga(a).show:l.done(function{ga(a).hide}),l.done(function{var b;Aa.remove(a,"fxshow");for(b in m)ga.style(a,b,m[b])});for(d in m)g=L(o?p[d]:0,d,l),d in p||(p[d]=g.start,o&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function N(a,b){var c,d,e,f,g;for(c in a)if(d=ga.camelCase(c),e=b[d],f=a[c],ga.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=ga.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function O(a,b,c){var d,e,f=0,g=O.prefilters.length,h=ga.Deferred.always(function{delete i.elem}),i=function{if(e)return!1;for(var b=fb||J,c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:ga.extend({},b),opts:ga.extend(!0,{specialEasing:{},easing:ga.easing._default},c),originalProperties:b,originalOptions:c,startTime:fb||J,duration:c.duration,tweens:[],createTween:function(b,c){var d=ga.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(N(k,j.opts.specialEasing);g>f;f++)if(d=O.prefilters[f].call(j,a,k,j.opts))return ga.isFunction(d.stop)&&(ga._queueHooks(j.elem,j.opts.queue).stop=ga.proxy(d.stop,d)),d;return ga.map(k,L,j),ga.isFunction(j.opts.start)&&j.opts.start.call(a,j),ga.fx.timer(ga.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}function P(a){return a.getAttribute&&a.getAttribute("class")||""}function Q(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase.match(wa)||[];if(ga.isFunction(c))for(d=f[e++];)"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function R(a,b,c,d){function e(h){var i;return f[h]=!0,ga.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||g||f[j]?g?!(i=j):void 0:(b.dataTypes.unshift(j),e(j),!1)}),i}var f={},g=a===Ab;return e(b.dataTypes[0])||!f["*"]&&e("*")}function S(a,b){var c,d,e=ga.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&ga.extend(!0,a,d),a}function T(a,b,c){for(var d,e,f,g,h=a.contents,i=a.dataTypes;"*"===i[0];)i.shift,void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function U(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice;if(k[1])for(g in a.converters)j[g.toLowerCase]=a.converters[g];for(f=k.shift;f;)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift)if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}function V(a,b,c,d){var e;if(ga.isArray(b))ga.each(b,function(b,e){c||Eb.test(a)?d(a,e):V(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==ga.type(b))d(a,b);else for(e in b)V(a+"["+e+"]",b[e],c,d)}function W(a){return ga.isWindow(a)?a:9===a.nodeType&&a.defaultView}var X=[],Y=a.document,Z=X.slice,$=X.concat,_=X.push,aa=X.indexOf,ba={},ca=ba.toString,da=ba.hasOwnProperty,ea={},fa="2.2.1",ga=function(a,b){return new ga.fn.init(a,b)},ha=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,ia=/^-ms-/,ja=/-([\da-z])/gi,ka=function(a,b){return b.toUpperCase};ga.fn=ga.prototype={jquery:fa,constructor:ga,selector:"",length:0,toArray:function{return Z.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:Z.call(this)},pushStack:function(a){var b=ga.merge(this.constructor,a);return b.prevObject=this,b.context=this.context,b},each:function(a){return ga.each(this,a)},map:function(a){return this.pushStack(ga.map(this,function(b,c){return a.call(b,c,b)}))},slice:function{return this.pushStack(Z.apply(this,arguments))},first:function{return this.eq(0)},last:function{return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function{return this.prevObject||this.constructor},push:_,sort:X.sort,splice:X.splice},ga.extend=ga.fn.extend=function{var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||ga.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(ga.isPlainObject(d)||(e=ga.isArray(d)))?(e?(e=!1,f=c&&ga.isArray(c)?c:[]):f=c&&ga.isPlainObject(c)?c:{},g[b]=ga.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},ga.extend({expando:"jQuery"+(fa+Math.random).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function{},isFunction:function(a){return"function"===ga.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=a&&a.toString;return!ga.isArray(a)&&b-parseFloat(b)+1>=0},isPlainObject:function(a){return"object"!==ga.type(a)||a.nodeType||ga.isWindow(a)?!1:!a.constructor||da.call(a.constructor.prototype,"isPrototypeOf")},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?ba[ca.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=ga.trim(a),a&&(1===a.indexOf("use strict")?(b=Y.createElement("script"),b.text=a,Y.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(ia,"ms-").replace(ja,ka)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase===b.toLowerCase},each:function(a,b){var c,e=0;if(d(a))for(c=a.length;c>e&&b.call(a[e],e,a[e])!==!1;e++);else for(e in a)if(b.call(a[e],e,a[e])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(ha,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(d(Object(a))?ga.merge(c,"string"==typeof a?[a]:a):_.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:aa.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var e,f,g=0,h=[];if(d(a))for(e=a.length;e>g;g++)f=b(a[g],g,c),null!=f&&h.push(f);else for(g in a)f=b(a[g],g,c),null!=f&&h.push(f);return $.apply([],h)},guid:1,proxy:function(a,b){var c,d,e;return"string"==typeof b&&(c=a[b],b=a,a=c),ga.isFunction(a)?(d=Z.call(arguments,2),e=function{return a.apply(b||this,d.concat(Z.call(arguments)))},e.guid=a.guid=a.guid||ga.guid++,e):void 0},now:Date.now,support:ea}),"function"==typeof Symbol&&(ga.fn[Symbol.iterator]=X[Symbol.iterator]),ga.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){ba["[object "+b+"]"]=b.toLowerCase});var la=function(a){function b(a,b,c,d){var e,f,g,h,i,j,l,n,o=b&&b.ownerDocument,p=b?b.nodeType:9;if(c=c||[],"string"!=typeof a||!a||1!==p&&9!==p&&11!==p)return c;if(!d&&((b?b.ownerDocument||b:O)!==G&&F(b),b=b||G,I)){if(11!==p&&(j=ra.exec(a)))if(e=j[1]){if(9===p){if(!(g=b.getElementById(e)))return c;if(g.id===e)return c.push(g),c}else if(o&&(g=o.getElementById(e))&&M(b,g)&&g.id===e)return c.push(g),c}else{if(j[2])return $.apply(c,b.getElementsByTagName(a)),c;if((e=j[3])&&v.getElementsByClassName&&b.getElementsByClassName)return $.apply(c,b.getElementsByClassName(e)),c}if(v.qsa&&!T[a+" "]&&(!J||!J.test(a))){if(1!==p)o=b,n=a;else if("object"!==b.nodeName.toLowerCase){for((h=b.getAttribute("id"))?h=h.replace(ta,"\\$&"):b.setAttribute("id",h=N),l=z(a),f=l.length,i=ma.test(h)?"#"+h:"[id='"+h+"']";f--;)l[f]=i+" "+m(l[f]);n=l.join(","),o=sa.test(a)&&k(b.parentNode)||b}if(n)try{return $.apply(c,o.querySelectorAll(n)),c}catch(q){}finally{h===N&&b.removeAttribute("id")}}}return B(a.replace(ha,"$1"),b,c,d)}function c{function a(c,d){return b.push(c+" ")>w.cacheLength&&delete a[b.shift],a[c+" "]=d}var b=[];return a}function d(a){return a[N]=!0,a}function e(a){var b=G.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function f(a,b){for(var c=a.split("|"),d=c.length;d--;)w.attrHandle[c[d]]=b}function g(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||V)-(~a.sourceIndex||V);if(d)return d;if(c)for(c=c.nextSibling;)if(c===b)return-1;return a?1:-1}function h(a){return function(b){var c=b.nodeName.toLowerCase;return"input"===c&&b.type===a}}function i(a){return function(b){var c=b.nodeName.toLowerCase;return("input"===c||"button"===c)&&b.type===a}}function j(a){return d(function(b){return b=+b,d(function(c,d){for(var e,f=a([],c.length,b),g=f.length;g--;)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function k(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}function l{}function m(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function n(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=Q++;return b.first?function(b,c,f){for(b=b[d];)if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=[P,f];if(g){for(b=b[d];)if((1===b.nodeType||e)&&a(b,c,g))return!0}else for(b=b[d];)if(1===b.nodeType||e){if(j=b[N]||(b[N]={}),i=j[b.uniqueID]||(j[b.uniqueID]={}),(h=i[d])&&h[0]===P&&h[1]===f)return k[2]=h[2];if(i[d]=k,k[2]=a(b,c,g))return!0}}}function o(a){return a.length>1?function(b,c,d){for(var e=a.length;e--;)if(!a[e](b,c,d))return!1;return!0}:a[0]}function p(a,c,d){for(var e=0,f=c.length;f>e;e++)b(a,c[e],d);return d}function q(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function r(a,b,c,e,f,g){return e&&!e[N]&&(e=r(e)),f&&!f[N]&&(f=r(f,g)),d(function(d,g,h,i){var j,k,l,m=[],n=[],o=g.length,r=d||p(b||"*",h.nodeType?[h]:h,[]),s=!a||!d&&b?r:q(r,m,a,h,i),t=c?f||(d?a:o||e)?[]:g:s;if(c&&c(s,t,h,i),e)for(j=q(t,n),e(j,[],h,i),k=j.length;k--;)(l=j[k])&&(t[n[k]]=!(s[n[k]]=l));if(d){if(f||a){if(f){for(j=[],k=t.length;k--;)(l=t[k])&&j.push(s[k]=l);f(null,t=[],j,i)}for(k=t.length;k--;)(l=t[k])&&(j=f?aa(d,l):m[k])>-1&&(d[j]=!(g[j]=l))}}else t=q(t===g?t.splice(o,t.length):t),f?f(null,g,t,i):$.apply(g,t)})}function s(a){for(var b,c,d,e=a.length,f=w.relative[a[0].type],g=f||w.relative[" "],h=f?1:0,i=n(function(a){return a===b},g,!0),j=n(function(a){return aa(b,a)>-1},g,!0),k=[function(a,c,d){var e=!f&&(d||c!==C)||((b=c).nodeType?i(a,c,d):j(a,c,d));return b=null,e}];e>h;h++)if(c=w.relative[a[h].type])k=[n(o(k),c)];else{if(c=w.filter[a[h].type].apply(null,a[h].matches),c[N]){for(d=++h;e>d&&!w.relative[a[d].type];d++);return r(h>1&&o(k),h>1&&m(a.slice(0,h-1).concat({value:" "===a[h-2].type?"*":""})).replace(ha,"$1"),c,d>h&&s(a.slice(h,d)),e>d&&s(a=a.slice(d)),e>d&&m(a))}k.push(c)}return o(k)}function t(a,c){var e=c.length>0,f=a.length>0,g=function(d,g,h,i,j){var k,l,m,n=0,o="0",p=d&&[],r=[],s=C,t=d||f&&w.find.TAG("*",j),u=P+=null==s?1:Math.random||.1,v=t.length;for(j&&(C=g===G||g||j);o!==v&&null!=(k=t[o]);o++){if(f&&k){for(l=0,g||k.ownerDocument===G||(F(k),h=!I);m=a[l++];)if(m(k,g||G,h)){i.push(k);break}j&&(P=u)}e&&((k=!m&&k)&&n--,d&&p.push(k))}if(n+=o,e&&o!==n){for(l=0;m=c[l++];)m(p,r,g,h);if(d){if(n>0)for(o--;)p[o]||r[o]||(r[o]=Y.call(i));r=q(r)}$.apply(i,r),j&&!d&&r.length>0&&n+c.length>1&&b.uniqueSort(i)}return j&&(P=u,C=s),p};return e?d(g):g}var u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N="sizzle"+1*new Date,O=a.document,P=0,Q=0,R=c,S=c,T=c,U=function(a,b){return a===b&&(E=!0),0},V=1<<31,W={}.hasOwnProperty,X=[],Y=X.pop,Z=X.push,$=X.push,_=X.slice,aa=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},ba="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",ca="[\\x20\\t\\r\\n\\f]",da="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",ea="\\["+ca+"*("+da+")(?:"+ca+"*([*^$|!~]?=)"+ca+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+da+"))|)"+ca+"*\\]",fa=":("+da+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\[\\]]|"+ea+")*)|.*)\\)|)",ga=new RegExp(ca+"+","g"),ha=new RegExp("^"+ca+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ca+"+$","g"),ia=new RegExp("^"+ca+"*,"+ca+"*"),ja=new RegExp("^"+ca+"*([>+~]|"+ca+")"+ca+"*"),ka=new RegExp("="+ca+"*([^\\]'\"]*?)"+ca+"*\\]","g"),la=new RegExp(fa),ma=new RegExp("^"+da+"$"),na={ID:new RegExp("^#("+da+")"),CLASS:new RegExp("^\\.("+da+")"),TAG:new RegExp("^("+da+"|[*])"),ATTR:new RegExp("^"+ea),PSEUDO:new RegExp("^"+fa),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ca+"*(even|odd|(([+-]|)(\\d*)n|)"+ca+"*(?:([+-]|)"+ca+"*(\\d+)|))"+ca+"*\\)|)","i"),bool:new RegExp("^(?:"+ba+")$","i"),needsContext:new RegExp("^"+ca+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ca+"*((?:-\\d)?\\d*)"+ca+"*\\)|)(?=[^-]|$)","i")},oa=/^(?:input|select|textarea|button)$/i,pa=/^h\d$/i,qa=/^[^{]+\{\s*\[native \w/,ra=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,sa=/[+~]/,ta=/'|\\/g,ua=new RegExp("\\\\([\\da-f]{1,6}"+ca+"?|("+ca+")|.)","ig"),va=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},wa=function{F};try{$.apply(X=_.call(O.childNodes),O.childNodes),X[O.childNodes.length].nodeType}catch(xa){$={apply:X.length?function(a,b){Z.apply(a,_.call(b))}:function(a,b){for(var c=a.length,d=0;a[c++]=b[d++];);a.length=c-1}}}v=b.support={},y=b.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},F=b.setDocument=function(a){var b,c,d=a?a.ownerDocument||a:O;return d!==G&&9===d.nodeType&&d.documentElement?(G=d,H=G.documentElement,I=!y(G),(c=G.defaultView)&&c.top!==c&&(c.addEventListener?c.addEventListener("unload",wa,!1):c.attachEvent&&c.attachEvent("onunload",wa)),v.attributes=e(function(a){return a.className="i",!a.getAttribute("className")}),v.getElementsByTagName=e(function(a){return a.appendChild(G.createComment("")),!a.getElementsByTagName("*").length}),v.getElementsByClassName=qa.test(G.getElementsByClassName),v.getById=e(function(a){return H.appendChild(a).id=N,!G.getElementsByName||!G.getElementsByName(N).length}),v.getById?(w.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&I){var c=b.getElementById(a);return c?[c]:[]}},w.filter.ID=function(a){var b=a.replace(ua,va);return function(a){return a.getAttribute("id")===b}}):(delete w.find.ID,w.filter.ID=function(a){var b=a.replace(ua,va);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),w.find.TAG=v.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):v.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){for(c=f[e++];)1===c.nodeType&&d.push(c);return d}return f},w.find.CLASS=v.getElementsByClassName&&function(a,b){return"undefined"!=typeof b.getElementsByClassName&&I?b.getElementsByClassName(a):void 0},K=[],J=[],(v.qsa=qa.test(G.querySelectorAll))&&(e(function(a){H.appendChild(a).innerHTML="<a id='"+N+"'></a><select id='"+N+"-\r\\' msallowcapture=><option selected=> ",a.querySelectorAll("[msallowcapture^=]").length&&J.push("[*^$]="+ca+"*(?:|\"\")"),a.querySelectorAll("[selected]").length||J.push("\\["+ca+"*(?:value|"+ba+")"),a.querySelectorAll("[id~="+N+"-]").length||J.push("~="),a.querySelectorAll(":checked").length||J.push(":checked"),a.querySelectorAll("a#"+N+"+*").length||J.push(".#.+[+~]")}),e(function(a){var b=G.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&J.push("name"+ca+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||J.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),J.push(",.*:")})),(v.matchesSelector=qa.test(L=H.matches||H.webkitMatchesSelector||H.mozMatchesSelector||H.oMatchesSelector||H.msMatchesSelector))&&e(function(a){v.disconnectedMatch=L.call(a,"div"),L.call(a,"[s!='']:x"),K.push("!=",fa)}),J=J.length&&new RegExp(J.join("|")),K=K.length&&new RegExp(K.join("|")),b=qa.test(H.compareDocumentPosition),M=b||qa.test(H.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)for(b=b.parentNode;)if(b===a)return!0;return!1},U=b?function(a,b){if(a===b)return E=!0,0;var c=!a.compareDocumentPosition-!b.compareDocumentPosition;return c?c:(c=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&c||!v.sortDetached&&b.compareDocumentPosition(a)===c?a===G||a.ownerDocument===O&&M(O,a)?-1:b===G||b.ownerDocument===O&&M(O,b)?1:D?aa(D,a)-aa(D,b):0:4&c?-1:1)}:function(a,b){if(a===b)return E=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===G?-1:b===G?1:e?-1:f?1:D?aa(D,a)-aa(D,b):0;if(e===f)return g(a,b);for(c=a;c=c.parentNode;)h.unshift(c);for(c=b;c=c.parentNode;)i.unshift(c);for(h[d]===i[d];)d++;return d?g(h[d],i[d]):h[d]===O?-1:i[d]===O?1:0},G):G},b.matches=function(a,c){return b(a,null,null,c)},b.matchesSelector=function(a,c){if((a.ownerDocument||a)!==G&&F(a),c=c.replace(ka,"='$1']"),v.matchesSelector&&I&&!T[c+" "]&&(!K||!K.test(c))&&(!J||!J.test(c)))try{var d=L.call(a,c);if(d||v.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return b(c,G,null,[a]).length>0},b.contains=function(a,b){return(a.ownerDocument||a)!==G&&F(a),M(a,b)},b.attr=function(a,b){(a.ownerDocument||a)!==G&&F(a);var c=w.attrHandle[b.toLowerCase],d=c&&W.call(w.attrHandle,b.toLowerCase)?c(a,b,!I):void 0;return void 0!==d?d:v.attributes||!I?a.getAttribute(b):(d=a.getAttributeNode(b))&&d.specified?d.value:null},b.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},b.uniqueSort=function(a){var b,c=[],d=0,e=0;if(E=!v.detectDuplicates,D=!v.sortStable&&a.slice(0),a.sort(U),E){for(b=a[e++];)b===a[e]&&(d=c.push(e));for(d--;)a.splice(c[d],1)}return D=null,a},x=b.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(1===e||9===e||11===e){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=x(a)}else if(3===e||4===e)return a.nodeValue}else for(b=a[d++];)c+=x(b);return c},w=b.selectors={cacheLength:50,createPseudo:d,match:na,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ua,va),a[3]=(a[3]||a[4]||a[5]||"").replace(ua,va),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase,"nth"===a[1].slice(0,3)?(a[3]||b.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&b.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return na.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&la.test(c)&&(b=z(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ua,va).toLowerCase;return"*"===a?function{return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase===b}},CLASS:function(a){var b=R[a+" "];return b||(b=new RegExp("(^|"+ca+")"+a+"("+ca+"|$)"))&&R(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,c,d){return function(e){var f=b.attr(e,a);return null==f?"!="===c:c?(f+="","="===c?f===d:"!="===c?f!==d:"^="===c?d&&0===f.indexOf(d):"*="===c?d&&f.indexOf(d)>-1:"$="===c?d&&f.slice(-d.length)===d:"~="===c?(" "+f.replace(ga," ")+" ").indexOf(d)>-1:"|="===c?f===d||f.slice(0,d.length+1)===d+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase,s=!i&&!h,t=!1;if(q){if(f){for(p;){for(m=b;m=m[p];)if(h?m.nodeName.toLowerCase===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){for(m=q,l=m[N]||(m[N]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===P&&j[1],t=n&&j[2],m=n&&q.childNodes[n];m=++n&&m&&m[p]||(t=n=0)||o.pop;)if(1===m.nodeType&&++t&&m===b){k[a]=[P,n,t];break}}else if(s&&(m=b,l=m[N]||(m[N]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===P&&j[1],t=n),t===!1)for((m=++n&&m&&m[p]||(t=n=0)||o.pop)&&((h?m.nodeName.toLowerCase!==r:1!==m.nodeType)||!++t||(s&&(l=m[N]||(m[N]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[P,t]),m!==b)););return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,c){var e,f=w.pseudos[a]||w.setFilters[a.toLowerCase]||b.error("unsupported pseudo: "+a);return f[N]?f(c):f.length>1?(e=[a,a,"",c],w.setFilters.hasOwnProperty(a.toLowerCase)?d(function(a,b){for(var d,e=f(a,c),g=e.length;g--;)d=aa(a,e[g]),a[d]=!(b[d]=e[g])}):function(a){return f(a,0,e)}):f}},pseudos:{not:d(function(a){var b=[],c=[],e=A(a.replace(ha,"$1"));return e[N]?d(function(a,b,c,d){for(var f,g=e(a,null,d,[]),h=a.length;h--;)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,d,f){return b[0]=a,e(b,null,f,c),b[0]=null,!c.pop}}),has:d(function(a){return function(c){return b(a,c).length>0}}),contains:d(function(a){return a=a.replace(ua,va),function(b){return(b.textContent||b.innerText||x(b)).indexOf(a)>-1}}),lang:d(function(a){return ma.test(a||"")||b.error("unsupported lang: "+a),a=a.replace(ua,va).toLowerCase,function(b){var c;do if(c=I?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase,c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===H},focus:function(a){return a===G.activeElement&&(!G.hasFocus||G.hasFocus)&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase;return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!w.pseudos.empty(a)},header:function(a){return pa.test(a.nodeName)},input:function(a){return oa.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase;return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase)},first:j(function{return[0]}),last:j(function(a,b){return[b-1]}),eq:j(function(a,b,c){return[0>c?c+b:c]}),even:j(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:j(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:j(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:j(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},w.pseudos.nth=w.pseudos.eq;for(u in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})w.pseudos[u]=h(u);for(u in{submit:!0,reset:!0})w.pseudos[u]=i(u);return l.prototype=w.filters=w.pseudos,w.setFilters=new l,z=b.tokenize=function(a,c){var d,e,f,g,h,i,j,k=S[a+" "];if(k)return c?0:k.slice(0);for(h=a,i=[],j=w.preFilter;h;){d&&!(e=ia.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),d=!1,(e=ja.exec(h))&&(d=e.shift,f.push({value:d,type:e[0].replace(ha," ")}),h=h.slice(d.length));for(g in w.filter)!(e=na[g].exec(h))||j[g]&&!(e=j[g](e))||(d=e.shift,f.push({value:d,type:g,matches:e}),h=h.slice(d.length));if(!d)break}return c?h.length:h?b.error(a):S(a,i).slice(0)},A=b.compile=function(a,b){var c,d=[],e=[],f=T[a+" "];if(!f){for(b||(b=z(a)),c=b.length;c--;)f=s(b[c]),f[N]?d.push(f):e.push(f);f=T(a,t(e,d)),f.selector=a}return f},B=b.select=function(a,b,c,d){var e,f,g,h,i,j="function"==typeof a&&a,l=!d&&z(a=j.selector||a);if(c=c||[],1===l.length){if(f=l[0]=l[0].slice(0),f.length>2&&"ID"===(g=f[0]).type&&v.getById&&9===b.nodeType&&I&&w.relative[f[1].type]){if(b=(w.find.ID(g.matches[0].replace(ua,va),b)||[])[0],!b)return c;j&&(b=b.parentNode),a=a.slice(f.shift.value.length)}for(e=na.needsContext.test(a)?0:f.length;e--&&(g=f[e],!w.relative[h=g.type]);)if((i=w.find[h])&&(d=i(g.matches[0].replace(ua,va),sa.test(f[0].type)&&k(b.parentNode)||b))){if(f.splice(e,1),a=d.length&&m(f),!a)return $.apply(c,d),c;break}}return(j||A(a,l))(d,b,!I,c,!b||sa.test(a)&&k(b.parentNode)||b),c},v.sortStable=N.split("").sort(U).join("")===N,v.detectDuplicates=!!E,F,v.sortDetached=e(function(a){return 1&a.compareDocumentPosition(G.createElement("div"))}),e(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||f("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase?1:2)}),v.attributes&&e(function(a){return a.innerHTML=" ",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||f("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase?void 0:a.defaultValue}),e(function(a){return null==a.getAttribute("disabled")})||f(ba,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase:(d=a.getAttributeNode(b))&&d.specified?d.value:null}),b}(a);ga.find=la,ga.expr=la.selectors,ga.expr[":"]=ga.expr.pseudos,ga.uniqueSort=ga.unique=la.uniqueSort,ga.text=la.getText,ga.isXMLDoc=la.isXML,ga.contains=la.contains;var ma=function(a,b,c){for(var d=[],e=void 0!==c;(a=a[b])&&9!==a.nodeType;)if(1===a.nodeType){if(e&&ga(a).is(c))break;d.push(a)}return d},na=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},oa=ga.expr.match.needsContext,pa=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,qa=/^.[^:#\[\.,]*$/;ga.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?ga.find.matchesSelector(d,a)?[d]:[]:ga.find.matches(a,ga.grep(b,function(a){return 1===a.nodeType}))},ga.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(ga(a).filter(function{for(b=0;c>b;b++)if(ga.contains(e[b],this))return!0}));for(b=0;c>b;b++)ga.find(a,e[b],d);return d=this.pushStack(c>1?ga.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(e(this,a||[],!1))},not:function(a){return this.pushStack(e(this,a||[],!0))},is:function(a){return!!e(this,"string"==typeof a&&oa.test(a)?ga(a):a||[],!1).length}});var ra,sa=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ta=ga.fn.init=function(a,b,c){var d,e;if(!a)return this; if(c=c||ra,"string"==typeof a){if(d="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:sa.exec(a),!d||!d[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(d[1]){if(b=b instanceof ga?b[0]:b,ga.merge(this,ga.parseHTML(d[1],b&&b.nodeType?b.ownerDocument||b:Y,!0)),pa.test(d[1])&&ga.isPlainObject(b))for(d in b)ga.isFunction(this[d])?this[d](b[d]):this.attr(d,b[d]);return this}return e=Y.getElementById(d[2]),e&&e.parentNode&&(this.length=1,this[0]=e),this.context=Y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):ga.isFunction(a)?void 0!==c.ready?c.ready(a):a(ga):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),ga.makeArray(a,this))};ta.prototype=ga.fn,ra=ga(Y);var ua=/^(?:parents|prev(?:Until|All))/,va={children:!0,contents:!0,next:!0,prev:!0};ga.fn.extend({has:function(a){var b=ga(a,this),c=b.length;return this.filter(function{for(var a=0;c>a;a++)if(ga.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=oa.test(a)||"string"!=typeof a?ga(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&ga.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?ga.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?aa.call(ga(a),this[0]):aa.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first.prevAll.length:-1},add:function(a,b){return this.pushStack(ga.uniqueSort(ga.merge(this.get,ga(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}}),ga.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return ma(a,"parentNode")},parentsUntil:function(a,b,c){return ma(a,"parentNode",c)},next:function(a){return f(a,"nextSibling")},prev:function(a){return f(a,"previousSibling")},nextAll:function(a){return ma(a,"nextSibling")},prevAll:function(a){return ma(a,"previousSibling")},nextUntil:function(a,b,c){return ma(a,"nextSibling",c)},prevUntil:function(a,b,c){return ma(a,"previousSibling",c)},siblings:function(a){return na((a.parentNode||{}).firstChild,a)},children:function(a){return na(a.firstChild)},contents:function(a){return a.contentDocument||ga.merge([],a.childNodes)}},function(a,b){ga.fn[a]=function(c,d){var e=ga.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=ga.filter(d,e)),this.length>1&&(va[a]||ga.uniqueSort(e),ua.test(a)&&e.reverse),this.pushStack(e)}});var wa=/\S+/g;ga.Callbacks=function(a){a="string"==typeof a?g(a):ga.extend({},a);var b,c,d,e,f=[],h=[],i=-1,j=function{for(e=a.once,d=b=!0;h.length;i=-1)for(c=h.shift;++i<f.length;)f[i].apply(c[0],c[1])===!1&&a.stopOnFalse&&(i=f.length,c=!1);a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},k={add:function{return f&&(c&&!b&&(i=f.length-1,h.push(c)),function d(b){ga.each(b,function(b,c){ga.isFunction(c)?a.unique&&k.has(c)||f.push(c):c&&c.length&&"string"!==ga.type(c)&&d(c)})}(arguments),c&&!b&&j),this},remove:function{return ga.each(arguments,function(a,b){for(var c;(c=ga.inArray(b,f,c))>-1;)f.splice(c,1),i>=c&&i--}),this},has:function(a){return a?ga.inArray(a,f)>-1:f.length>0},empty:function{return f&&(f=[]),this},disable:function{return e=h=[],f=c="",this},disabled:function{return!f},lock:function{return e=h=[],c||(f=c=""),this},locked:function{return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice:c],h.push(c),b||j),this},fire:function{return k.fireWith(this,arguments),this},fired:function{return!!d}};return k},ga.extend({Deferred:function(a){var b="resolve","done",ga.Callbacks("once memory"),"resolved"],["reject","fail",ga.Callbacks("once memory"),"rejected"],["notify","progress",ga.Callbacks("memory"),c="pending",d={state:function{return c},always:function{return e.done(arguments).fail(arguments),this},then:function{var a=arguments;return ga.Deferred(function(c){ga.each(b,function(b,f){var g=ga.isFunction(a[b])&&a[b];e[f[1]](function{var a=g&&g.apply(this,arguments);a&&ga.isFunction(a.promise)?a.promise.progress(c.notify).done(c.resolve).fail(c.reject):c[f[0]+"With"](this===d?c.promise:this,g?[a]:arguments)})}),a=null}).promise},promise:function(a){return null!=a?ga.extend(a,d):d}},e={};return d.pipe=d.then,ga.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function{c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function{return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b,c,d,e=0,f=Z.call(arguments),g=f.length,h=1!==g||a&&ga.isFunction(a.promise)?g:0,i=1===h?a:ga.Deferred,j=function(a,c,d){return function(e){c[a]=this,d[a]=arguments.length>1?Z.call(arguments):e,d===b?i.notifyWith(c,d):--h||i.resolveWith(c,d)}};if(g>1)for(b=new Array(g),c=new Array(g),d=new Array(g);g>e;e++)f[e]&&ga.isFunction(f[e].promise)?f[e].promise.progress(j(e,c,b)).done(j(e,d,f)).fail(i.reject):--h;return h||i.resolveWith(d,f),i.promise}});var xa;ga.fn.ready=function(a){return ga.ready.promise.done(a),this},ga.extend({isReady:!1,readyWait:1,holdReady:function(a){a?ga.readyWait++:ga.ready(!0)},ready:function(a){(a===!0?--ga.readyWait:ga.isReady)||(ga.isReady=!0,a!==!0&&--ga.readyWait>0||(xa.resolveWith(Y,[ga]),ga.fn.triggerHandler&&(ga(Y).triggerHandler("ready"),ga(Y).off("ready"))))}}),ga.ready.promise=function(b){return xa||(xa=ga.Deferred,"complete"===Y.readyState||"loading"!==Y.readyState&&!Y.documentElement.doScroll?a.setTimeout(ga.ready):(Y.addEventListener("DOMContentLoaded",h),a.addEventListener("load",h))),xa.promise(b)},ga.ready.promise;var ya=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===ga.type(c)){e=!0;for(h in c)ya(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,ga.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(ga(a),c)})),b))for(i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},za=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};i.uid=1,i.prototype={register:function(a,b){var c=b||{};return a.nodeType?a[this.expando]=c:Object.defineProperty(a,this.expando,{value:c,writable:!0,configurable:!0}),a[this.expando]},cache:function(a){if(!za(a))return{};var b=a[this.expando];return b||(b={},za(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[b]=c;else for(d in b)e[d]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,ga.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=a[this.expando];if(void 0!==f){if(void 0===b)this.register(a);else{ga.isArray(b)?d=b.concat(b.map(ga.camelCase)):(e=ga.camelCase(b),b in f?d=[b,e]:(d=e,d=d in f?[d]:d.match(wa)||[])),c=d.length;for(c--;)delete f[d[c]]}(void 0===b||ga.isEmptyObject(f))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!ga.isEmptyObject(b)}};var Aa=new i,Ba=new i,Ca=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Da=/[A-Z]/g;ga.extend({hasData:function(a){return Ba.hasData(a)||Aa.hasData(a)},data:function(a,b,c){return Ba.access(a,b,c)},removeData:function(a,b){Ba.remove(a,b)},_data:function(a,b,c){return Aa.access(a,b,c)},_removeData:function(a,b){Aa.remove(a,b)}}),ga.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=Ba.get(f),1===f.nodeType&&!Aa.get(f,"hasDataAttrs"))){for(c=g.length;c--;)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=ga.camelCase(d.slice(5)),j(f,d,e[d])));Aa.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function{Ba.set(this,a)}):ya(this,function(b){var c,d;if(f&&void 0===b){if(c=Ba.get(f,a)||Ba.get(f,a.replace(Da,"-$&").toLowerCase),void 0!==c)return c;if(d=ga.camelCase(a),c=Ba.get(f,d),void 0!==c)return c;if(c=j(f,d,void 0),void 0!==c)return c}else d=ga.camelCase(a),this.each(function{var c=Ba.get(this,d);Ba.set(this,d,b),a.indexOf("-")>-1&&void 0!==c&&Ba.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function{Ba.remove(this,a)})}}),ga.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=Aa.get(a,b),c&&(!d||ga.isArray(c)?d=Aa.access(a,b,ga.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=ga.queue(a,b),d=c.length,e=c.shift,f=ga._queueHooks(a,b),g=function{ga.dequeue(a,b)};"inprogress"===e&&(e=c.shift,d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire},_queueHooks:function(a,b){var c=b+"queueHooks";return Aa.get(a,c)||Aa.access(a,c,{empty:ga.Callbacks("once memory").add(function{Aa.remove(a,[b+"queue",c])})})}}),ga.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?ga.queue(this[0],a):void 0===b?this:this.each(function{var c=ga.queue(this,a,b);ga._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&ga.dequeue(this,a)})},dequeue:function(a){return this.each(function{ga.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=ga.Deferred,f=this,g=this.length,h=function{--d||e.resolveWith(f,[f])};for("string"!=typeof a&&(b=a,a=void 0),a=a||"fx";g--;)c=Aa.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h,e.promise(b)}});var Ea=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Fa=new RegExp("^(?:([+-])=|)("+Ea+")([a-z%]*)$","i"),Ga=["Top","Right","Bottom","Left"],Ha=function(a,b){return a=b||a,"none"===ga.css(a,"display")||!ga.contains(a.ownerDocument,a)},Ia=/^(?:checkbox|radio)$/i,Ja=/<([\w:-]+)/,Ka=/^$|\/(?:java|ecma)script/i,La={option:[1,"<select multiple='multiple'>"," "],thead:[1," "],col:[2," "],tr:[2," "],td:[3," "],_default:[0,"",""]};La.optgroup=La.option,La.tbody=La.tfoot=La.colgroup=La.caption=La.thead,La.th=La.td;var Ma=/<|&#?\w+;/;!function{var a=Y.createDocumentFragment,b=a.appendChild(Y.createElement("div")),c=Y.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),ea.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML=" x ",ea.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue};var Na=/^key/,Oa=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Pa=/^([^.]*)(?:\.(.+)|)/;ga.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=Aa.get(a);if(q)for(c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=ga.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof ga&&ga.event.triggered!==b.type?ga.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(wa)||[""],j=b.length;j--;)h=Pa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort,n&&(l=ga.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=ga.event.special[n]||{},k=ga.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&ga.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),ga.event.global[n]=!0)},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=Aa.hasData(a)&&Aa.get(a);if(q&&(i=q.events)){for(b=(b||"").match(wa)||[""],j=b.length;j--;)if(h=Pa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort,n){for(l=ga.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;f--;)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||ga.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)ga.event.remove(a,n+b[j],c,d,!0);ga.isEmptyObject(i)&&Aa.remove(a,"handle events")}},dispatch:function(a){a=ga.event.fix(a);var b,c,d,e,f,g=[],h=Z.call(arguments),i=(Aa.get(this,"events")||{})[a.type]||[],j=ga.event.special[a.type]||{};if(h[0]=a,a.delegateTarget=this,!j.preDispatch||j.preDispatch.call(this,a)!==!1){for(g=ga.event.handlers.call(this,a,i),b=0;(e=g[b++])&&!a.isPropagationStopped;)for(a.currentTarget=e.elem,c=0;(f=e.handlers[c++])&&!a.isImmediatePropagationStopped;)a.rnamespace&&!a.rnamespace.test(f.namespace)||(a.handleObj=f,a.data=f.data,d=((ga.event.special[f.origType]||{}).handle||f.handler).apply(e.elem,h),void 0!==d&&(a.result=d)===!1&&(a.preventDefault,a.stopPropagation));return j.postDispatch&&j.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&("click"!==a.type||isNaN(a.button)||a.button<1))for(i!==this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?ga(e,this).index(i)>-1:ga.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||Y,d=c.documentElement,e=c.body,a.pageX=b.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0),a.pageY=b.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},fix:function(a){if(a[ga.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];for(g||(this.fixHooks[e]=g=Oa.test(e)?this.mouseHooks:Na.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new ga.Event(f),b=d.length;b--;)c=d[b],a[c]=f[c];return a.target||(a.target=Y),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function{return this!==q&&this.focus?(this.focus,!1):void 0},delegateType:"focusin"},blur:{trigger:function{return this===q&&this.blur?(this.blur,!1):void 0},delegateType:"focusout"},click:{trigger:function{return"checkbox"===this.type&&this.click&&ga.nodeName(this,"input")?(this.click,!1):void 0},_default:function(a){return ga.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}}},ga.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)},ga.Event=function(a,b){return this instanceof ga.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?o:p):this.type=a,b&&ga.extend(this,b),this.timeStamp=a&&a.timeStamp||ga.now,void(this[ga.expando]=!0)):new ga.Event(a,b)},ga.Event.prototype={constructor:ga.Event,isDefaultPrevented:p,isPropagationStopped:p,isImmediatePropagationStopped:p,preventDefault:function{var a=this.originalEvent;this.isDefaultPrevented=o,a&&a.preventDefault},stopPropagation:function{var a=this.originalEvent;this.isPropagationStopped=o,a&&a.stopPropagation},stopImmediatePropagation:function{var a=this.originalEvent;this.isImmediatePropagationStopped=o,a&&a.stopImmediatePropagation,this.stopPropagation}},ga.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){ga.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||ga.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),ga.fn.extend({on:function(a,b,c,d){return r(this,a,b,c,d)},one:function(a,b,c,d){return r(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,ga(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&"function"!=typeof b||(c=b,b=void 0),c===!1&&(c=p),this.each(function{ga.event.remove(this,a,c,b)})}});var Qa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,Ra=/<script|<style|<link/i,Sa=/checked\s*(?:[^=]|=\s*.checked.)/i,Ta=/^true\/(.*)/,Ua=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;ga.extend({htmlPrefilter:function(a){return a.replace(Qa,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=ga.contains(a.ownerDocument,a);if(!(ea.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||ga.isXMLDoc(a)))for(g=l(h),f=l(a),d=0,e=f.length;e>d;d++)w(f[d],g[d]);if(b)if(c)for(f=f||l(a),g=g||l(h),d=0,e=f.length;e>d;d++)v(f[d],g[d]);else v(a,h);return g=l(h,"script"),g.length>0&&m(g,!i&&l(a,"script")),h},cleanData:function(a){for(var b,c,d,e=ga.event.special,f=0;void 0!==(c=a[f]);f++)if(za(c)){if(b=c[Aa.expando]){if(b.events)for(d in b.events)e[d]?ga.event.remove(c,d):ga.removeEvent(c,d,b.handle);c[Aa.expando]=void 0}c[Ba.expando]&&(c[Ba.expando]=void 0)}}}),ga.fn.extend({domManip:x,detach:function(a){return y(this,a,!0)},remove:function(a){return y(this,a)},text:function(a){return ya(this,function(a){return void 0===a?ga.text(this):this.empty.each(function{1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function{return x(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=s(this,a);b.appendChild(a)}})},prepend:function{return x(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=s(this,a);b.insertBefore(a,b.firstChild)}})},before:function{return x(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function{return x(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function{for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(ga.cleanData(l(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function{return ga.clone(this,a,b)})},html:function(a){return ya(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!Ra.test(a)&&!La[(Ja.exec(a)||["",""])[1].toLowerCase]){a=ga.htmlPrefilter(a);try{for(d>c;c++)b=this[c]||{},1===b.nodeType&&(ga.cleanData(l(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty.append(a)},null,a,arguments.length)},replaceWith:function{var a=[];return x(this,arguments,function(b){var c=this.parentNode;ga.inArray(this,a)<0&&(ga.cleanData(l(this)),c&&c.replaceChild(b,this))},a)}}),ga.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){ga.fn[a]=function(a){for(var c,d=[],e=ga(a),f=e.length-1,g=0;f>=g;g++)c=g===f?this:this.clone(!0),ga(e[g])[b](c),_.apply(d,c.get);return this.pushStack(d)}});var Va,Wa={HTML:"block",BODY:"block"},Xa=/^margin/,Ya=new RegExp("^("+Ea+")(?!px)[a-z%]+$","i"),Za=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)},$a=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e},_a=Y.documentElement;!function{function b{h.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",h.innerHTML="",_a.appendChild(g);var b=a.getComputedStyle(h);c="1%"!==b.top,f="2px"===b.marginLeft,d="4px"===b.width,h.style.marginRight="50%",e="4px"===b.marginRight,_a.removeChild(g)}var c,d,e,f,g=Y.createElement("div"),h=Y.createElement("div");h.style&&(h.style.backgroundClip="content-box",h.cloneNode(!0).style.backgroundClip="",ea.clearCloneStyle="content-box"===h.style.backgroundClip,g.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",g.appendChild(h),ga.extend(ea,{pixelPosition:function{return b,c},boxSizingReliable:function{return null==d&&b,d},pixelMarginRight:function{return null==d&&b,e},reliableMarginLeft:function{return null==d&&b,f},reliableMarginRight:function{var b,c=h.appendChild(Y.createElement("div"));return c.style.cssText=h.style.cssText="-webkit-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",h.style.width="1px",_a.appendChild(g),b=!parseFloat(a.getComputedStyle(c).marginRight),_a.removeChild(g),h.removeChild(c),b}}))};var ab=/^(none|table(?!-c[ea]).+)/,bb={position:"absolute",visibility:"hidden",display:"block"},cb={letterSpacing:"0",fontWeight:"400"},db=["Webkit","O","Moz","ms"],eb=Y.createElement("div").style;ga.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=B(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=ga.camelCase(b),i=a.style;return b=ga.cssProps[h]||(ga.cssProps[h]=D(h)||h),g=ga.cssHooks[b]||ga.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=Fa.exec(c))&&e[1]&&(c=k(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(ga.cssNumber[h]?"":"px")),ea.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=ga.camelCase(b);return b=ga.cssProps[h]||(ga.cssProps[h]=D(h)||h),g=ga.cssHooks[b]||ga.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=B(a,b,d)),"normal"===e&&b in cb&&(e=cb[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),ga.each(["height","width"],function(a,b){ga.cssHooks[b]={get:function(a,c,d){return c?ab.test(ga.css(a,"display"))&&0===a.offsetWidth?$a(a,bb,function{return G(a,b,d)}):G(a,b,d):void 0},set:function(a,c,d){var e,f=d&&Za(a),g=d&&F(a,b,d,"border-box"===ga.css(a,"boxSizing",!1,f),f);return g&&(e=Fa.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=ga.css(a,b)),E(a,c,g)}}}),ga.cssHooks.marginLeft=C(ea.reliableMarginLeft,function(a,b){return b?(parseFloat(B(a,"marginLeft"))||a.getBoundingClientRect.left-$a(a,{marginLeft:0},function{return a.getBoundingClientRect.left}))+"px":void 0}),ga.cssHooks.marginRight=C(ea.reliableMarginRight,function(a,b){return b?$a(a,{display:"inline-block"},B,[a,"marginRight"]):void 0}),ga.each({margin:"",padding:"",border:"Width"},function(a,b){ga.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+Ga[d]+b]=f[d]||f[d-2]||f[0];return e}},Xa.test(a)||(ga.cssHooks[a+b].set=E)}),ga.fn.extend({css:function(a,b){return ya(this,function(a,b,c){var d,e,f={},g=0;if(ga.isArray(b)){for(d=Za(a),e=b.length;e>g;g++)f[b[g]]=ga.css(a,b[g],!1,d);return f}return void 0!==c?ga.style(a,b,c):ga.css(a,b)},a,b,arguments.length>1)},show:function{return H(this,!0)},hide:function{return H(this)},toggle:function(a){return"boolean"==typeof a?a?this.show:this.hide:this.each(function{Ha(this)?ga(this).show:ga(this).hide})}}),ga.Tween=I,I.prototype={constructor:I,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||ga.easing._default,this.options=b,this.start=this.now=this.cur,this.end=d,this.unit=f||(ga.cssNumber[c]?"":"px")},cur:function{var a=I.propHooks[this.prop];return a&&a.get?a.get(this):I.propHooks._default.get(this)},run:function(a){var b,c=I.propHooks[this.prop];return this.options.duration?this.pos=b=ga.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):I.propHooks._default.set(this),this}},I.prototype.init.prototype=I.prototype,I.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=ga.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){ga.fx.step[a.prop]?ga.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[ga.cssProps[a.prop]]&&!ga.cssHooks[a.prop]?a.elem[a.prop]=a.now:ga.style(a.elem,a.prop,a.now+a.unit)}}},I.propHooks.scrollTop=I.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},ga.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},ga.fx=I.prototype.init,ga.fx.step={};var fb,gb,hb=/^(?:toggle|show|hide)$/,ib=/queueHooks$/;ga.Animation=ga.extend(O,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return k(c.elem,a,Fa.exec(b),c),c}]},tweener:function(a,b){ga.isFunction(a)?(b=a,a=["*"]):a=a.match(wa);for(var c,d=0,e=a.length;e>d;d++)c=a[d],O.tweeners[c]=O.tweeners[c]||[],O.tweeners[c].unshift(b)},prefilters:[M],prefilter:function(a,b){b?O.prefilters.unshift(a):O.prefilters.push(a)}}),ga.speed=function(a,b,c){var d=a&&"object"==typeof a?ga.extend({},a):{complete:c||!c&&b||ga.isFunction(a)&&a,duration:a,easing:c&&b||b&&!ga.isFunction(b)&&b};return d.duration=ga.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in ga.fx.speeds?ga.fx.speeds[d.duration]:ga.fx.speeds._default,null!=d.queue&&d.queue!==!0||(d.queue="fx"),d.old=d.complete,d.complete=function{ga.isFunction(d.old)&&d.old.call(this),d.queue&&ga.dequeue(this,d.queue)},d},ga.fn.extend({fadeTo:function(a,b,c,d){return this.filter(Ha).css("opacity",0).show.end.animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=ga.isEmptyObject(a),f=ga.speed(b,c,d),g=function{var b=O(this,ga.extend({},a),f);(e||Aa.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function{var b=!0,e=null!=a&&a+"queueHooks",f=ga.timers,g=Aa.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&ib.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||ga.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function{var b,c=Aa.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=ga.timers,g=d?d.length:0;for(c.finish=!0,ga.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),ga.each(["toggle","show","hide"],function(a,b){var c=ga.fn[b];ga.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(K(b,!0),a,d,e)}}),ga.each({slideDown:K("show"),slideUp:K("hide"),slideToggle:K("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){ga.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),ga.timers=[],ga.fx.tick=function{var a,b=0,c=ga.timers;for(fb=ga.now;b<c.length;b++)a=c[b],a||c[b]!==a||c.splice(b--,1);c.length||ga.fx.stop,fb=void 0},ga.fx.timer=function(a){ga.timers.push(a),a?ga.fx.start:ga.timers.pop},ga.fx.interval=13,ga.fx.start=function{gb||(gb=a.setInterval(ga.fx.tick,ga.fx.interval))},ga.fx.stop=function{a.clearInterval(gb),gb=null},ga.fx.speeds={slow:600,fast:200,_default:400},ga.fn.delay=function(b,c){return b=ga.fx?ga.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function{a.clearTimeout(e)}})},function{var a=Y.createElement("input"),b=Y.createElement("select"),c=b.appendChild(Y.createElement("option"));a.type="checkbox",ea.checkOn=""!==a.value,ea.optSelected=c.selected,b.disabled=!0,ea.optDisabled=!c.disabled,a=Y.createElement("input"),a.value="t",a.type="radio",ea.radioValue="t"===a.value};var jb,kb=ga.expr.attrHandle;ga.fn.extend({attr:function(a,b){return ya(this,ga.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function{ga.removeAttr(this,a)})}}),ga.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?ga.prop(a,b,c):(1===f&&ga.isXMLDoc(a)||(b=b.toLowerCase,e=ga.attrHooks[b]||(ga.expr.match.bool.test(b)?jb:void 0)),void 0!==c?null===c?void ga.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=ga.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!ea.radioValue&&"radio"===b&&ga.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(wa);if(f&&1===a.nodeType)for(c=f[e++];)d=ga.propFix[c]||c,ga.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)}}),jb={set:function(a,b,c){return b===!1?ga.removeAttr(a,c):a.setAttribute(c,c),c}},ga.each(ga.expr.match.bool.source.match(/\w+/g),function(a,b){var c=kb[b]||ga.find.attr;kb[b]=function(a,b,d){var e,f;return d||(f=kb[b],kb[b]=e,e=null!=c(a,b,d)?b.toLowerCase:null,kb[b]=f),e}});var lb=/^(?:input|select|textarea|button)$/i,mb=/^(?:a|area)$/i;ga.fn.extend({prop:function(a,b){return ya(this,ga.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function{delete this[ga.propFix[a]||a]})}}),ga.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&ga.isXMLDoc(a)||(b=ga.propFix[b]||b,e=ga.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=ga.find.attr(a,"tabindex");return b?parseInt(b,10):lb.test(a.nodeName)||mb.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),ea.optSelected||(ga.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),ga.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function{ga.propFix[this.toLowerCase]=this});var nb=/[\t\r\n\f]/g;ga.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(ga.isFunction(a))return this.each(function(b){ga(this).addClass(a.call(this,b,P(this)))});if("string"==typeof a&&a)for(b=a.match(wa)||[];c=this[i++];)if(e=P(c),d=1===c.nodeType&&(" "+e+" ").replace(nb," ")){for(g=0;f=b[g++];)d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=ga.trim(d),e!==h&&c.setAttribute("class",h)}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(ga.isFunction(a))return this.each(function(b){ga(this).removeClass(a.call(this,b,P(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a)for(b=a.match(wa)||[];c=this[i++];)if(e=P(c),d=1===c.nodeType&&(" "+e+" ").replace(nb," ")){for(g=0;f=b[g++];)for(d.indexOf(" "+f+" ")>-1;)d=d.replace(" "+f+" "," ");h=ga.trim(d),e!==h&&c.setAttribute("class",h); }return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):ga.isFunction(a)?this.each(function(c){ga(this).toggleClass(a.call(this,c,P(this),b),b)}):this.each(function{var b,d,e,f;if("string"===c)for(d=0,e=ga(this),f=a.match(wa)||[];b=f[d++];)e.hasClass(b)?e.removeClass(b):e.addClass(b);else void 0!==a&&"boolean"!==c||(b=P(this),b&&Aa.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":Aa.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;for(b=" "+a+" ";c=this[d++];)if(1===c.nodeType&&(" "+P(c)+" ").replace(nb," ").indexOf(b)>-1)return!0;return!1}});var ob=/\r/g;ga.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=ga.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,ga(this).val):a,null==e?e="":"number"==typeof e?e+="":ga.isArray(e)&&(e=ga.map(e,function(a){return null==a?"":a+""})),b=ga.valHooks[this.type]||ga.valHooks[this.nodeName.toLowerCase],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=ga.valHooks[e.type]||ga.valHooks[e.nodeName.toLowerCase],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(ob,""):null==c?"":c)}}}),ga.extend({valHooks:{option:{get:function(a){return ga.trim(a.value)}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],(c.selected||i===e)&&(ea.optDisabled?!c.disabled:null===c.getAttribute("disabled"))&&(!c.parentNode.disabled||!ga.nodeName(c.parentNode,"optgroup"))){if(b=ga(c).val,f)return b;g.push(b)}return g},set:function(a,b){for(var c,d,e=a.options,f=ga.makeArray(b),g=e.length;g--;)d=e[g],(d.selected=ga.inArray(ga.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),ga.each(["radio","checkbox"],function{ga.valHooks[this]={set:function(a,b){return ga.isArray(b)?a.checked=ga.inArray(ga(a).val,b)>-1:void 0}},ea.checkOn||(ga.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var pb=/^(?:focusinfocus|focusoutblur)$/;ga.extend(ga.event,{trigger:function(b,c,d,e){var f,g,h,i,j,k,l,m=[d||Y],n=da.call(b,"type")?b.type:b,o=da.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||Y,3!==d.nodeType&&8!==d.nodeType&&!pb.test(n+ga.event.triggered)&&(n.indexOf(".")>-1&&(o=n.split("."),n=o.shift,o.sort),j=n.indexOf(":")<0&&"on"+n,b=b[ga.expando]?b:new ga.Event(n,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=o.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:ga.makeArray(c,[b]),l=ga.event.special[n]||{},e||!l.trigger||l.trigger.apply(d,c)!==!1)){if(!e&&!l.noBubble&&!ga.isWindow(d)){for(i=l.delegateType||n,pb.test(i+n)||(g=g.parentNode);g;g=g.parentNode)m.push(g),h=g;h===(d.ownerDocument||Y)&&m.push(h.defaultView||h.parentWindow||a)}for(f=0;(g=m[f++])&&!b.isPropagationStopped;)b.type=f>1?i:l.bindType||n,k=(Aa.get(g,"events")||{})[b.type]&&Aa.get(g,"handle"),k&&k.apply(g,c),k=j&&g[j],k&&k.apply&&za(g)&&(b.result=k.apply(g,c),b.result===!1&&b.preventDefault);return b.type=n,e||b.isDefaultPrevented||l._default&&l._default.apply(m.pop,c)!==!1||!za(d)||j&&ga.isFunction(d[n])&&!ga.isWindow(d)&&(h=d[j],h&&(d[j]=null),ga.event.triggered=n,d[n],ga.event.triggered=void 0,h&&(d[j]=h)),b.result}},simulate:function(a,b,c){var d=ga.extend(new ga.Event,c,{type:a,isSimulated:!0});ga.event.trigger(d,null,b),d.isDefaultPrevented&&c.preventDefault}}),ga.fn.extend({trigger:function(a,b){return this.each(function{ga.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?ga.event.trigger(a,b,c,!0):void 0}}),ga.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){ga.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),ga.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),ea.focusin="onfocusin"in a,ea.focusin||ga.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){ga.event.simulate(b,a.target,ga.event.fix(a))};ga.event.special[b]={setup:function{var d=this.ownerDocument||this,e=Aa.access(d,b);e||d.addEventListener(a,c,!0),Aa.access(d,b,(e||0)+1)},teardown:function{var d=this.ownerDocument||this,e=Aa.access(d,b)-1;e?Aa.access(d,b,e):(d.removeEventListener(a,c,!0),Aa.remove(d,b))}}});var qb=a.location,rb=ga.now,sb=/\?/;ga.parseJSON=function(a){return JSON.parse(a+"")},ga.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||ga.error("Invalid XML: "+b),c};var tb=/#.*$/,ub=/([?&])_=[^&]*/,vb=/^(.*?):[ \t]*([^\r\n]*)$/gm,wb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,xb=/^(?:GET|HEAD)$/,yb=/^\/\//,zb={},Ab={},Bb="*/".concat("*"),Cb=Y.createElement("a");Cb.href=qb.href,ga.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:qb.href,type:"GET",isLocal:wb.test(qb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Bb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":ga.parseJSON,"text xml":ga.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?S(S(a,ga.ajaxSettings),b):S(ga.ajaxSettings,a)},ajaxPrefilter:Q(zb),ajaxTransport:Q(Ab),ajax:function(b,c){function d(b,c,d,h){var j,l,s,t,v,x=c;2!==u&&(u=2,i&&a.clearTimeout(i),e=void 0,g=h||"",w.readyState=b>0?4:0,j=b>=200&&300>b||304===b,d&&(t=T(m,w,d)),t=U(m,t,w,j),j?(m.ifModified&&(v=w.getResponseHeader("Last-Modified"),v&&(ga.lastModified[f]=v),v=w.getResponseHeader("etag"),v&&(ga.etag[f]=v)),204===b||"HEAD"===m.type?x="nocontent":304===b?x="notmodified":(x=t.state,l=t.data,s=t.error,j=!s)):(s=x,!b&&x||(x="error",0>b&&(b=0))),w.status=b,w.statusText=(c||x)+"",j?p.resolveWith(n,[l,x,w]):p.rejectWith(n,[w,x,s]),w.statusCode(r),r=void 0,k&&o.trigger(j?"ajaxSuccess":"ajaxError",[w,m,j?l:s]),q.fireWith(n,[w,x]),k&&(o.trigger("ajaxComplete",[w,m]),--ga.active||ga.event.trigger("ajaxStop")))}"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m=ga.ajaxSetup({},c),n=m.context||m,o=m.context&&(n.nodeType||n.jquery)?ga(n):ga.event,p=ga.Deferred,q=ga.Callbacks("once memory"),r=m.statusCode||{},s={},t={},u=0,v="canceled",w={readyState:0,getResponseHeader:function(a){var b;if(2===u){if(!h)for(h={};b=vb.exec(g);)h[b[1].toLowerCase]=b[2];b=h[a.toLowerCase]}return null==b?null:b},getAllResponseHeaders:function{return 2===u?g:null},setRequestHeader:function(a,b){var c=a.toLowerCase;return u||(a=t[c]=t[c]||a,s[a]=b),this},overrideMimeType:function(a){return u||(m.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>u)for(b in a)r[b]=[r[b],a[b]];else w.always(a[w.status]);return this},abort:function(a){var b=a||v;return e&&e.abort(b),d(0,b),this}};if(p.promise(w).complete=q.add,w.success=w.done,w.error=w.fail,m.url=((b||m.url||qb.href)+"").replace(tb,"").replace(yb,qb.protocol+"//"),m.type=c.method||c.type||m.method||m.type,m.dataTypes=ga.trim(m.dataType||"*").toLowerCase.match(wa)||[""],null==m.crossDomain){j=Y.createElement("a");try{j.href=m.url,j.href=j.href,m.crossDomain=Cb.protocol+"//"+Cb.host!=j.protocol+"//"+j.host}catch(x){m.crossDomain=!0}}if(m.data&&m.processData&&"string"!=typeof m.data&&(m.data=ga.param(m.data,m.traditional)),R(zb,m,c,w),2===u)return w;k=ga.event&&m.global,k&&0===ga.active++&&ga.event.trigger("ajaxStart"),m.type=m.type.toUpperCase,m.hasContent=!xb.test(m.type),f=m.url,m.hasContent||(m.data&&(f=m.url+=(sb.test(f)?"&":"?")+m.data,delete m.data),m.cache===!1&&(m.url=ub.test(f)?f.replace(ub,"$1_="+rb++):f+(sb.test(f)?"&":"?")+"_="+rb++)),m.ifModified&&(ga.lastModified[f]&&w.setRequestHeader("If-Modified-Since",ga.lastModified[f]),ga.etag[f]&&w.setRequestHeader("If-None-Match",ga.etag[f])),(m.data&&m.hasContent&&m.contentType!==!1||c.contentType)&&w.setRequestHeader("Content-Type",m.contentType),w.setRequestHeader("Accept",m.dataTypes[0]&&m.accepts[m.dataTypes[0]]?m.accepts[m.dataTypes[0]]+("*"!==m.dataTypes[0]?", "+Bb+"; q=0.01":""):m.accepts["*"]);for(l in m.headers)w.setRequestHeader(l,m.headers[l]);if(m.beforeSend&&(m.beforeSend.call(n,w,m)===!1||2===u))return w.abort;v="abort";for(l in{success:1,error:1,complete:1})w[l](m[l]);if(e=R(Ab,m,c,w)){if(w.readyState=1,k&&o.trigger("ajaxSend",[w,m]),2===u)return w;m.async&&m.timeout>0&&(i=a.setTimeout(function{w.abort("timeout")},m.timeout));try{u=1,e.send(s,d)}catch(x){if(!(2>u))throw x;d(-1,x)}}else d(-1,"No Transport");return w},getJSON:function(a,b,c){return ga.get(a,b,c,"json")},getScript:function(a,b){return ga.get(a,void 0,b,"script")}}),ga.each(["get","post"],function(a,b){ga[b]=function(a,c,d,e){return ga.isFunction(c)&&(e=e||d,d=c,c=void 0),ga.ajax(ga.extend({url:a,type:b,dataType:e,data:c,success:d},ga.isPlainObject(a)&&a))}}),ga._evalUrl=function(a){return ga.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},ga.fn.extend({wrapAll:function(a){var b;return ga.isFunction(a)?this.each(function(b){ga(this).wrapAll(a.call(this,b))}):(this[0]&&(b=ga(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function{for(var a=this;a.firstElementChild;)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return ga.isFunction(a)?this.each(function(b){ga(this).wrapInner(a.call(this,b))}):this.each(function{var b=ga(this),c=b.contents;c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=ga.isFunction(a);return this.each(function(c){ga(this).wrapAll(b?a.call(this,c):a)})},unwrap:function{return this.parent.each(function{ga.nodeName(this,"body")||ga(this).replaceWith(this.childNodes)}).end}}),ga.expr.filters.hidden=function(a){return!ga.expr.filters.visible(a)},ga.expr.filters.visible=function(a){return a.offsetWidth>0||a.offsetHeight>0||a.getClientRects.length>0};var Db=/%20/g,Eb=/\[\]$/,Fb=/\r?\n/g,Gb=/^(?:submit|button|image|reset|file)$/i,Hb=/^(?:input|select|textarea|keygen)/i;ga.param=function(a,b){var c,d=[],e=function(a,b){b=ga.isFunction(b)?b:null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=ga.ajaxSettings&&ga.ajaxSettings.traditional),ga.isArray(a)||a.jquery&&!ga.isPlainObject(a))ga.each(a,function{e(this.name,this.value)});else for(c in a)V(c,a[c],b,e);return d.join("&").replace(Db,"+")},ga.fn.extend({serialize:function{return ga.param(this.serializeArray)},serializeArray:function{return this.map(function{var a=ga.prop(this,"elements");return a?ga.makeArray(a):this}).filter(function{var a=this.type;return this.name&&!ga(this).is(":disabled")&&Hb.test(this.nodeName)&&!Gb.test(a)&&(this.checked||!Ia.test(a))}).map(function(a,b){var c=ga(this).val;return null==c?null:ga.isArray(c)?ga.map(c,function(a){return{name:b.name,value:a.replace(Fb,"\r\n")}}):{name:b.name,value:c.replace(Fb,"\r\n")}}).get}}),ga.ajaxSettings.xhr=function{try{return new a.XMLHttpRequest}catch(b){}};var Ib={0:200,1223:204},Jb=ga.ajaxSettings.xhr;ea.cors=!!Jb&&"withCredentials"in Jb,ea.ajax=Jb=!!Jb,ga.ajaxTransport(function(b){var c,d;return ea.cors||Jb&&!b.crossDomain?{send:function(e,f){var g,h=b.xhr;if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function{c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort:"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Ib[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders))}},h.onload=c,d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function{4===h.readyState&&a.setTimeout(function{c&&d})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function{c&&c}}:void 0}),ga.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return ga.globalEval(a),a}}}),ga.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),ga.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=ga(" ").prop({charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove,c=null,a&&e("error"===a.type?404:200,a.type)}),Y.head.appendChild(b[0])},abort:function{c&&c}}}});var Kb=[],Lb=/(=)\?(?=&|$)|\?\?/;ga.ajaxSetup({jsonp:"callback",jsonpCallback:function{var a=Kb.pop||ga.expando+"_"+rb++;return this[a]=!0,a}}),ga.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Lb.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Lb.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=ga.isFunction(b.jsonpCallback)?b.jsonpCallback:b.jsonpCallback,h?b[h]=b[h].replace(Lb,"$1"+e):b.jsonp!==!1&&(b.url+=(sb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function{return g||ga.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function{g=arguments},d.always(function{void 0===f?ga(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Kb.push(e)),g&&ga.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),ea.createHTMLDocument=function{var a=Y.implementation.createHTMLDocument("").body;return a.innerHTML="   ",2===a.childNodes.length},ga.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||(ea.createHTMLDocument?Y.implementation.createHTMLDocument(""):Y);var d=pa.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n([a],b,e),e&&e.length&&ga(e).remove,ga.merge([],d.childNodes))};var Mb=ga.fn.load;ga.fn.load=function(a,b,c){if("string"!=typeof a&&Mb)return Mb.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=ga.trim(a.slice(h)),a=a.slice(0,h)),ga.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&ga.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?ga(" ").append(ga.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function{c.apply(g,f||[a.responseText,b,a])})}),this},ga.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){ga.fn[b]=function(a){return this.on(b,a)}}),ga.expr.filters.animated=function(a){return ga.grep(ga.timers,function(b){return a===b.elem}).length},ga.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=ga.css(a,"position"),l=ga(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset,f=ga.css(a,"top"),i=ga.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position,g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),ga.isFunction(b)&&(b=b.call(a,c,ga.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},ga.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){ga.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,ga.contains(b,d)?(e=d.getBoundingClientRect,c=W(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function{if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===ga.css(c,"position")?b=c.getBoundingClientRect:(a=this.offsetParent,b=this.offset,ga.nodeName(a[0],"html")||(d=a.offset),d.top+=ga.css(a[0],"borderTopWidth",!0),d.left+=ga.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-ga.css(c,"marginTop",!0),left:b.left-d.left-ga.css(c,"marginLeft",!0)}}},offsetParent:function{return this.map(function{for(var a=this.offsetParent;a&&"static"===ga.css(a,"position");)a=a.offsetParent;return a||_a})}}),ga.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;ga.fn[a]=function(d){return ya(this,function(a,d,e){var f=W(a);return void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),ga.each(["top","left"],function(a,b){ga.cssHooks[b]=C(ea.pixelPosition,function(a,c){return c?(c=B(a,b),Ya.test(c)?ga(a).position[b]+"px":c):void 0})}),ga.each({Height:"height",Width:"width"},function(a,b){ga.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){ga.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return ya(this,function(b,c,d){var e;return ga.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?ga.css(b,c,g):ga.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),ga.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)},size:function{return this.length}}),ga.fn.andSelf=ga.fn.addBack,"function"==typeof b&&b.amd&&(b("15",[],function{return ga}),b("jquery",["15"],function(a){return a}));var Nb=a.jQuery,Ob=a.$;return ga.noConflict=function(b){return a.$===ga&&(a.$=Ob),b&&a.jQuery===ga&&(a.jQuery=Nb),ga},c||(a.jQuery=a.$=ga),ga})},a.registerDynamic("1a",["15"],!1,function(b,c,d){var e=a.get("@@global-helpers").prepareGlobal(d.id,"$",null);return function{if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>2)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3")}(jQuery),+function(a){"use strict";function b{var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function{c=!0});var e=function{c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function{a.support.transition=b,a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function{var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.6",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c{g.detach.trigger("closed.bs.alert").remove}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a(f);b&&b.preventDefault,g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c)};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function{return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function{var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle:b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.6",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data;b+="Text",null==f.resetText&&d.data("resetText",d[e]),setTimeout(a.proxy(function{d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function{var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function{return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),a(c.target).is('input[type="radio"]')||a(c.target).is('input[type="checkbox"]')||c.preventDefault}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function{var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data,"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]:f.interval&&e.pause.cycle})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.6",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev;break;case 39:this.next;break;default:return}a.preventDefault}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent.children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));return a>this.$items.length-1||0>a?void 0:this.sliding?this.$element.one("slid.bs.carousel",function{b.to(a)}):c==a?this.pause.cycle:this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function{return this.sliding?void 0:this.slide("next")},c.prototype.prev=function{return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented){if(this.sliding=!0,g&&this.pause,this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function{f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function{i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle,this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function{return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data,e.data),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function{a('[data-ride="carousel"]').each(function{var c=a(this);b.call(c,c.data)})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function{var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data,"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent:this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle};d.VERSION="3.3.6",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function{var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function{if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension;this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function{this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function{if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented){var c=this.dimension;this.$element[c](this.$element[c])[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function{this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function{this[this.$element.hasClass("in")?"hide":"show"]},d.prototype.getParent=function{return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function{return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault;var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data;c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent}function c(c){c&&3===c.which||(a(e).remove,a(f).each(function{var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function{var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.6",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c,!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented)return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault,c.stopPropagation,!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function{return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",c).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f,g.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",g.prototype.keydown); }(jQuery),+function(a){"use strict";function b(b,d){return this.each(function{var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data,"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function{this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.3.6",c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide:this.show(a)},c.prototype.show=function(b){var d=this,e=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(e),this.isShown||e.isDefaultPrevented||(this.isShown=!0,this.checkScrollbar,this.setScrollbar,this.$body.addClass("modal-open"),this.escape,this.resize,this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function{d.$element.one("mouseup.dismiss.bs.modal",function(b){a(b.target).is(d.$element)&&(d.ignoreBackdropClick=!0)})}),this.backdrop(function{var e=a.support.transition&&d.$element.hasClass("fade");d.$element.parent.length||d.$element.appendTo(d.$body),d.$element.show.scrollTop(0),d.adjustDialog,e&&d.$element[0].offsetWidth,d.$element.addClass("in"),d.enforceFocus;var f=a.Event("shown.bs.modal",{relatedTarget:b});e?d.$dialog.one("bsTransitionEnd",function{d.$element.trigger("focus").trigger(f)}).emulateTransitionEnd(c.TRANSITION_DURATION):d.$element.trigger("focus").trigger(f)}))},c.prototype.hide=function(b){b&&b.preventDefault,b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented&&(this.isShown=!1,this.escape,this.resize,a(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(c.TRANSITION_DURATION):this.hideModal)},c.prototype.enforceFocus=function{a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function{this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},c.prototype.resize=function{this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},c.prototype.hideModal=function{var a=this;this.$element.hide,this.backdrop(function{a.$body.removeClass("modal-open"),a.resetAdjustments,a.resetScrollbar,a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function{this.$backdrop&&this.$backdrop.remove,this.$backdrop=null},c.prototype.backdrop=function(b){var d=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&e;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+e).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus:this.hide))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;f?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var g=function{d.removeBackdrop,b&&b};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g}else b&&b},c.prototype.handleUpdate=function{this.adjustDialog},c.prototype.adjustDialog=function{var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function{this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function{var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect;a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth<a,this.scrollbarWidth=this.measureScrollbar},c.prototype.setScrollbar=function{var a=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function{this.$body.css("padding-right",this.originalBodyPad)},c.prototype.measureScrollbar=function{var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function{return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data,d.data);d.is("a")&&c.preventDefault,f.one("show.bs.modal",function(a){a.isDefaultPrevented||f.one("hidden.bs.modal",function{d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function{var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b])})}var c=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",a,b)};c.VERSION="3.3.6",c.TRANSITION_DURATION=150,c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'   ',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle},c.prototype.getDefaults=function{return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults,this.$element.data,b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function{var b={},c=this.getDefaults;return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip.hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function{"in"==c.hoverState&&c.show},c.options.delay.show)):c.show)},c.prototype.isInStateTrue=function{for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),c.isInStateTrue?void 0:(clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function{"out"==c.hoverState&&c.hide},c.options.delay.hide)):c.hide)},c.prototype.show=function{var b=a.Event("show.bs."+this.type);if(this.hasContent&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented||!d)return;var e=this,f=this.tip,g=this.getUID(this.type);this.setContent,f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach.css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition,l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-m<o.top?"bottom":"right"==h&&k.right+l>o.width?"left":"left"==h&&k.left-l<o.left?"right":h,f.removeClass(n).addClass(h)}var p=this.getCalculatedOffset(h,k,l,m);this.applyPlacement(p,h);var q=function{var a=e.hoverState;e.$element.trigger("shown.bs."+e.type),e.hoverState=null,"out"==a&&e.leave(e)};a.support.transition&&this.$tip.hasClass("fade")?f.one("bsTransitionEnd",q).emulateTransitionEnd(c.TRANSITION_DURATION):q}},c.prototype.applyPlacement=function(b,c){var d=this.tip,e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top+=g,b.left+=h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=/top|bottom/.test(c),m=l?2*k.left-e+i:2*k.top-f+j,n=l?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(m,d[0][n],l)},c.prototype.replaceArrow=function(a,b,c){this.arrow.css(c?"left":"top",50*(1-a/b)+"%").css(c?"top":"left","")},c.prototype.setContent=function{var a=this.tip,b=this.getTitle;a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(b){function d{"in"!=e.hoverState&&f.detach,e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),b&&b}var e=this,f=a(this.$tip),g=a.Event("hide.bs."+this.type);return this.$element.trigger(g),g.isDefaultPrevented?void 0:(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",d).emulateTransitionEnd(c.TRANSITION_DURATION):d,this.hoverState=null,this)},c.prototype.fixTitle=function{var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function{return this.getTitle},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName,e=c.getBoundingClientRect;null==e.width&&(e=a.extend({},e,{width:e.right-e.left,height:e.bottom-e.top}));var f=d?{top:0,left:0}:b.offset,g={scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop},h=d?{width:a(window).width,height:a(window).height}:null;return a.extend({},e,g,h,f)},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function{var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=(1e6*Math.random);while(document.getElementById(a));return a},c.prototype.tip=function{if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function{return this.$arrow=this.$arrow||this.tip.find(".tooltip-arrow")},c.prototype.enable=function{this.enabled=!0},c.prototype.disable=function{this.enabled=!1},c.prototype.toggleEnabled=function{this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue?c.enter(c):c.leave(c)):c.tip.hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function{var a=this;clearTimeout(this.timeout),this.hide(function{a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach,a.$tip=null,a.$arrow=null,a.$viewport=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function{return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function{var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b])})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.6",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'  <h3 class="popover-title">  '}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function{return c.DEFAULTS},c.prototype.setContent=function{var a=this.tip,b=this.getTitle,c=this.getContent;a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children.detach.end[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html||a.find(".popover-title").hide},c.prototype.hasContent=function{return this.getTitle||this.getContent},c.prototype.getContent=function{var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function{return this.$arrow=this.$arrow||this.tip.find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function{return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh,this.process}function c(c){return this.each(function{var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]})}b.VERSION="3.3.6",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function{return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function{var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight,a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop),this.$body.find(this.selector).map(function{var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&f[c].top+d,e||null}).sort(function(a,b){return a[0]-b[0]}).each(function{b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function{var a,b=this.$scrollElement.scrollTop+this.options.offset,c=this.getScrollHeight,d=this.options.offset+c-this.$scrollElement.height,e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh,b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear;for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(void 0===e[a+1]||b<e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,this.clear;var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")},b.prototype.clear=function{a(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function{return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function{a('[data-spy="scroll"]').each(function{var b=a(this);c.call(b,b.data)})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function{var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]})}var c=function(b){this.element=a(b)};c.VERSION="3.3.6",c.TRANSITION_DURATION=150,c.prototype.show=function{var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a"),f=a.Event("hide.bs.tab",{relatedTarget:b[0]}),g=a.Event("show.bs.tab",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented&&!f.isDefaultPrevented){var h=a(d);this.activate(b.closest("li"),c),this.activate(h,h.parent,function{e.trigger({type:"hidden.bs.tab",relatedTarget:b[0]}),b.trigger({type:"shown.bs.tab",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f{g.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end.find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end.find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f,g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function{return a.fn.tab=d,this};var e=function(c){c.preventDefault,b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function{var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition};c.VERSION="3.3.6",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop,f=this.$element.offset,g=this.$target.height;if(null!=c&&"top"==this.affixed)return c>e?"top":!1;if("bottom"==this.affixed)return null!=c?e+this.unpin<=f.top?!1:"bottom":a-d>=e+g?!1:"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&c>=e?"top":null!=d&&i+j>=a-d?"bottom":!1},c.prototype.getPinnedOffset=function{if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop,b=this.$element.offset;return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function{setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function{if(this.$element.is(":visible")){var b=this.$element.height,d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height,a(document.body).height);"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented)return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset:null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function{return a.fn.affix=d,this},a(window).on("load",function{a('[data-spy="affix"]').each(function{var c=a(this),d=c.data;d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery)},e}),a.registerDynamic("1",["2","3","4","6","a","5","7","8","16","17","c","18","19","1a"],!0,function(a,b,c){"use strict";var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B;return a("2"),a("3"),a("4"),h=a("6"),z=a("a"),e=z.Base64IO,j=z.JsonIO,l=a("5"),k=a("7"),o=a("8"),g=a("16"),n=a("17"),m=a("c"),i=a("18"),f=a("19"),d=a("1a"),v=null,t=null,u=null,r={version:[1,0]},p=null,d.getJSON("https://troxel.js.org/trove-blueprints/index.json").done(function(a){var b,c,d;return a.version[0]===r.version[0]&&a.version[1]===r.version[1]?(d=parseInt(window.localStorage.getItem("_BpDB_latestVersion")||0),b=parseInt(window.localStorage.getItem("_BpDB_formatMajor")||r.version[0]),c=window.localStorage.getItem("_BpDB_latestTag"),b!==r.version[0]&&(alert("The Trove Blueprints Datebase is outdated and must be recreated using and updated format.). Troxel will now clean all remaining artifacts up, reload the page and recreate a basic Trove Blueprints Datebase (only latest tag)!"),s),r.installRequest=JSON.parse(window.localStorage.getItem("_BpDB_installRequest")||"[]"),r.removeRequest=JSON.parse(window.localStorage.getItem("_BpDB_removeRequest")||"[]"),d>0&&null!=c&&c===a.latest||(r.installLatestTag=a.latest),(0===d||null==c||c!==a.latest||r.installRequest.length>0||r.removeRequest.length>0)&&d++):(alert("Warning: You are using an outdated version of Troxel which is no longer compatible with the newest Trove Blueprints Datebase format. You have to update Troxel to the latest version to continue getting updates for the Trove Blueprints Datebase!"),d=parseInt(window.localStorage.getItem("_BpDB_latestVersion")||1)),x(window.indexedDB.open("Trove-Blueprints",parseInt(d)),d)}).fail(function{var a;return a=parseInt(window.localStorage.getItem("_BpDB_latestVersion")||1),x(window.indexedDB.open("Trove-Blueprints",parseInt(a)),a)}),x=function(a,b){return a.onerror=function(a){switch(console.warn(a.target.error),a.target.error.name){case"VersionError":return alert("The Trove Blueprints Datebase is corrupted (maybe your browser has run out of profile disk space or you deleted part of it manually). Troxel will now clean all remaining artifacts up, reload the page and recreate a basic Trove Blueprints Datebase (only latest tag)!"),s;case"QuotaExceededError":return alert("The Trove Blueprints Datebase run out of disk space. Try to allow Troxel to use more disk space or remove older Blueprint Databases and reload the page to use it again!");case"UnknownError":return alert("The Trove Blueprints Datebase couldn't be loaded because of an error with your Browser or hard disk. Try to fix all issues with your Browser profile to use it again!")}},a.onblocked=function(a){return alert("The Trove Blueprints Datebase needs to be updated. Please close (or reload) all other opened tabs with Troxel or any other subproject hostet on troxel.js.org!")},a.onupgradeneeded=function(a){var c;return r.doingUpgrade=!0,window.localStorage.setItem("_BpDB_latestVersion",b),c=a.target.result,c.createObjectStore(r.installLatestTag,{autoIncrement:!1}),d.getJSON("https://troxel.js.org/trove-blueprints/"+r.installLatestTag+".json").done(function(a){var b,e,f,g,h,i,j;return j=c.transaction(r.installLatestTag,"readwrite"),i=j.objectStore(r.installLatestTag),e=d("#UpdateProgress").show.children.width("0%"),g=Object.keys(a),h=g.length,f=0,b=function{var c,d,j;for(c=d=0,j=Math.min(98,h-f-2);j>=d;c=d+=1)i.add(a[g[f+c]],g[f+c]);return f+c>=h?e.width("100%"):(i.add(a[g[f+c]],g[f+c]).onsuccess=b,f+=100,e.width(100*f/h+"%"))},b,j.oncomplete=function(a){return d("#UpdateProgress").fadeOut,r.latestTag=r.installLatestTag,window.localStorage.setItem("_BpDB_formatMajor",r.version[0]),window.localStorage.setItem("_BpDB_latestTag",r.latestTag),null!=r.installRequest&&delete r.installRequest,delete r.installRequest,delete r.removeRequest,B(c)},j.onerror=function(a){switch(console.warn(a.target.error),a.target.error.name){case"QuotaExceededError":return alert("The Trove Blueprints Datebase run out of disk space. Try to allow Troxel to use more disk space or remove older Blueprint Databases and reload the page to use it again!");case"UnknownError":return alert("The Trove Blueprints Datebase couldn't be loaded because of an error with your Browser or hard disk. Try to fix all issues with your Browser profile to use it again!")}}})},a.onsuccess=function(a){var c,d,e,f,g;if(null==r.doingUpgrade){if(window.localStorage.setItem("_BpDB_latestVersion",b),c=a.target.result,r.latestTag=window.localStorage.getItem("_BpDB_latestTag"),null==r.latestTag){for(g=c.objectStoreNames,d=0,e=g.length;e>d;d++)f=g[d],(null==r.latestTag||f>r.latestTag)&&(r.latestTag=f);null!=r.latestTag&&window.localStorage.setItem("_BpDB_latestTag",r.latestTag)}return null!=r.latestTag?B(c):alert("The local Trove Blueprints Datebase does not exist and all Trove Blueprint related features won't be available. Try going online and or updating Troxel to fix this and be able use all Trove Blueprint related features again!")}}},s=function{var a;return a=window.indexedDB.deleteDatabase("Trove-Blueprints"),a.onerror=function{return alert("Error: An error occurred while cleaning up all remaining artifacts of the Trove Blueprints Datebase. Please try to delete all offline data used by troxel.js.org in your brower settings manually and reload the page!")},a.onsuccess=function{return window.localStorage.removeItem("_BpDB_latestVersion"),window.localStorage.removeItem("_BpDB_formatMajor"),window.localStorage.removeItem("_BpDB_latestTag"),window.localStorage.removeItem("_BpDB_installRequest"),window.localStorage.removeItem("_BpDB_removeRequest"),location.reload}},B=function(a){return a.onversionchange=function(b){return a.close,alert("The Trove Blueprints Datebase was updated in another browser tab. This page will be reloaded now!"),location.reload},a.onerror=function(a){return console.warn(a.target.error)},r.db=a,null!=p?w(p):void 0},w=function(a){var b,c,f;if(null!=r.db)return f=r.db.transaction(r.latestTag,"readonly"),b=f.objectStore(r.latestTag),c=b.get(a.toLowerCase),c.onerror=function(a){return console.warn(a.target.error),d("#WebGlContainer").empty,u=null},c.onsuccess=function(a){return null!=a.target.result?(v=new e(a.target.result),d("#btnExport").hide,d("#btnExportPng").show,null!=u?u.reload(v.voxels,v.x,v.y,v.z,!0,!1):u=new g(v),A({voxels:v.voxels,x:v.x,y:v.y,z:v.z,readonly:!0},"#b="+value.toLowerCase)):(d("#WebGlContainer").empty,u=null)}},window.onpopstate=function(a){var b,c,f,i,j,k,l,m,n;if(null!=(null!=a?a.state:void 0))return l=null!=v,m=v.x!==a.state.x||v.y!==a.state.y||v.z!==a.state.z,v=new h(a.state),null==v.readonly||0===v.readonly?d("#btnExport").show:d("#btnExport").hide,d("#btnExportPng").show,l?u.reload(v.voxels,v.x,v.y,v.z,m,!1):u=new g(v);for(v=null,j=decodeURI(window.location.hash).replace("#","").split("&"),c=0,f=j.length;f>c;c++){if(b=j[c],k=b.split("="),i=k[0],n=k[1],"m"===i){v=new e(n),1===v.readonly&&d("#btnExport").hide,0===v.readonly&&d("#btnExport").show,d("#btnExportPng").show,null!=u?u.reload(v.voxels,v.x,v.y,v.z,!0,!1):u=new g(v);break}if("b"===i)return null!=r.db?w(n):p=n}return null==v?(d("#WebGlContainer").empty,u=null):void 0},window.onpopstate,d('input[type="file"]').change(function{var a,b,c,e;if(d(this).prop("files").length>1){for(t=d(this).prop("files"),d("#filetabs li:last a").tab("show"),d("#tabdrag ul").empty,e=[],b=0,c=t.length;c>b;b++)a=t[b],e.push(d("#tabdrag ul").append(d("<li>"+a.name+"</li>")));return e}}),document.addEventListener("dragover",function(a){return a.stopPropagation,a.preventDefault,a.dataTransfer.dropEffect="copy"}),document.addEventListener("drop",function(a){var b,c,e,f;if(a.stopPropagation,a.preventDefault,t=a.dataTransfer.files,t.length>0){for(d("#openModal").modal("show"),d("#dragTab").click,d("#tabdrag ul").empty,f=[],c=0,e=t.length;e>c;c++)b=t[c],f.push(d("#tabdrag ul").append(d("<li>"+b.name+"</li>")));return f}}),y=function(a,b){try{return history.pushState(a,"Troxel",b)}catch(c){return history.pushState(null,"Troxel",b)}},A=function(a,b){try{return history.replaceState(a,"Troxel",b)}catch(c){}},d("#open").click(function{var a,b,c,f,i,m,n,p,q,s,w,x,z,A,B,C,D,E;switch(f=function(a){var b,c,f;return null!=a&&d("#ImportRestorAP").prop("checked")&&(null==s.voxels[a[2]]&&(s.voxels[a[2]]=[]),null==s.voxels[a[2]][a[1]]&&(s.voxels[a[2]][a[1]]=[]),null!=s.voxels[a[2]][a[1]][a[0]]?7!==s.voxels[a[2]][a[1]][a[0]].t&&console.warn("Skip importing AP because already existing voxel at some postion. Model most likely not exported from Trove."):s.voxels[a[2]][a[1]][a[0]]={r:255,g:0,b:255,a:250,t:7,s:7}),null!=v&&d("#ImportMerge").prop("checked")?(f={x:parseInt(d("#QbMergeOffX").val),y:parseInt(d("#QbMergeOffY").val),z:parseInt(d("#QbMergeOffZ").val)},v.merge(s,f,d("#ImportAPrelativeOffsets").prop("checked"))):v=s,d("#openModal").modal("hide"), d("#modeEdit").parent.hasClass("active")&&d("#modeView").click,null==v.readonly||0===v.readonly?d("#btnExport").show:d("#btnExport").hide,d("#btnExportPng").show,null!=u?u.reload(v.voxels,v.x,v.y,v.z,!0,!1):u=new g(v),c={voxels:v.voxels,x:v.x,y:v.y,z:v.z},b=new e(c)["export"](!1),y(c,"#m="+b)},console.log("##################################################"),d("#filetabs li.active a").attr("href")){case"#tabdrag":if("zox"===t[0].name.split(".").pop)s=new o(t[0],f);else if("vox"===t[0].name.split(".").pop)s=new k(t[0],f);else if("qb"===t[0].name.split(".").pop){for(m={},n=p=0,q=t.length;q>p;n=++p)switch(i=t[n],i.name.substr(-5)){case"_a.qb":null==m.a&&(m.a=i);break;case"_t.qb":null==m.t&&(m.t=i);break;case"_s.qb":null==m.s&&(m.s=i);break;default:".qb"===i.name.substr(-3)&&(m.m=i)}null!=m.m?s=new l(m,f):alert("Can't find Qubicle main mesh file!")}else alert("Can't import selected file format.");break;case"#tabqb":i=d("#fqb").prop("files")[0],i&&"qb"===i.name.split(".").pop?s=new l({m:i,a:i=d("#fqba").prop("files")[0],t:i=d("#fqbt").prop("files")[0],s:i=d("#fqbs").prop("files")[0]},f):alert("Please choose at least a valid main mesh Qubicle (.qb) file above!");break;case"#tabvox":i=d("#fvox").prop("files")[0],i&&"vox"===i.name.split(".").pop?s=new k(i,f):alert("Please choose a valid Magica Voxel (.vox) file above!");break;case"#tabzox":i=d("#fzox").prop("files")[0],i&&"zox"===i.name.split(".").pop?s=new o(i,f):alert("Please choose a valid Zoxel (.zox) file above!");break;case"#tabjson":s=new j(d("#sjson").val),f;break;case"#tabtrove":if(null==r.db)return;z=d("#cbbtag").val,"latest"===z&&(z=r.latestTag),A=r.db.transaction(z,"readonly"),w=A.objectStore(z),x=w.get(d("#sbtrove").val.toLowerCase),x.onerror=function(a){return console.warn(a.target.error)},x.onsuccess=function(a){var b,c,f;return c=a.target.result,null!=c?(null!=v&&d("#ImportMerge").prop("checked")?(f={x:parseInt(d("#QbMergeOffX").val),y:parseInt(d("#QbMergeOffY").val),z:parseInt(d("#QbMergeOffZ").val)},v.merge(new e(c),f,d("#ImportAPrelativeOffsets").prop("checked")),b="#m="+new e(v)["export"](!0,2)):(v=new e(c),b="#b="+d("#sbtrove").val.toLowerCase),d("#openModal").modal("hide"),d("#modeEdit").parent.hasClass("active")&&d("#modeView").click,d("#btnExport").hide,d("#btnExportPng").show,null!=u?u.reload(v.voxels,v.x,v.y,v.z,!0,!1):u=new g(v),y({voxels:v.voxels,x:v.x,y:v.y,z:v.z,readonly:!0},b)):void 0};break;case"#tabnew":C=parseInt(d("#snewX").val),D=parseInt(d("#snewY").val),E=parseInt(d("#snewZ").val),B=[],d("#cbnewAp").prop("checked")&&(a=parseInt(d("#snewApX").val),b=parseInt(d("#snewApY").val),c=parseInt(d("#snewApZ").val),C>a&&D>b&&E>c&&(B[c]=[],B[c][b]=[],B[c][b][a]={r:255,g:0,b:255,a:250,t:7,s:7})),s=new h({x:C,y:D,z:E,voxels:B}),f,d("#modeEdit").click}}),d("#openTroveTab").click(function{var a,b,c,e;if(null!=r.db&&!d("#cbbtag").data("troxel-filled")){for(d("#cbbtag").children("option").text("latest (default: "+new Date(r.latestTag).toLocaleDateString+")"),e=r.db.objectStoreNames,a=0,b=e.length;b>a;a++)c=e[a],d("#cbbtag").append('<option value="'+c+'">'+c+" ("+new Date(c).toLocaleDateString+") ");return d("#cbbtag").data("troxel-filled",!0),d("#cbbtag").change}}),d("#cbbtag").change(function{var a;return a=d("#cbbtag").val,"latest"===a&&(a=r.latestTag),d("#sbtrove").typeahead("destroy"),d("#sbtrove").typeahead({highlight:!1,minLength:2,hint:!0},{name:"troveBlueprints",async:!0,limit:1e3,source:function(b,c,d){var e,f,g,h;return h=r.db.transaction(a,"readonly"),e=h.objectStore(a),b=b.toLowerCase,f=null!=e.openKeyCursor?e.openKeyCursor(window.IDBKeyRange.bound(b,b+"�")):e.openCursor(window.IDBKeyRange.bound(b,b+"�")),g=[],f.onerror=function(a){return console.warn(a.target.error),d(g)},f.onsuccess=function(a){var b;return b=a.target.result,null!=b?(g.push(b.key),b["continue"]):d(g)}},displayKey:function(a){return a}})}),d("#bbmanageTags").click(function{return d.getJSON("https://troxel.js.org/trove-blueprints/index.json").done(function(a){var b,c,e,f,g,h;for(e=r.db.objectStoreNames,d("#manageBpDBinstalledTags").empty,d("#manageBpDBnotInstalledTags").empty,f=a.tags,b=0,c=f.length;c>b;b++)g=f[b],h=new Date(g).toLocaleDateString,e.contains(g)?g===a.latest?d("#manageBpDBinstalledTags").append(' '+g+" "+h+'  <input type="checkbox" class="manageBpDBremoveTag" data-troxel-tag="'+g+"\" disabled>latest tag (can't remove)   "):d("#manageBpDBinstalledTags").append("  "+g+"  "+h+'  <input type="checkbox" class="manageBpDBremoveTag" data-troxel-tag="'+g+'">remove tag   '):g===a.latest?d("#manageBpDBnotInstalledTags").append(' '+g+"  "+h+'  <input type="checkbox" class="manageBpDBinstallTag" data-troxel-tag="'+g+'" disabled checked>latest tag (required update)   '):d("#manageBpDBnotInstalledTags").append("  "+g+"  "+h+'  <input type="checkbox" class="manageBpDBinstallTag" data-troxel-tag="'+g+'">install tag   ');return d("#manageBpDBmodal").modal("show")}).fail(function{return alert("You need to be online to manage installed Trove Blueprint Database tags!")})}),d("#manageBpDBapply").click(function{var a,b;return a=[],d(".manageBpDBinstallTag:checked").each(function{return a.push(d(this).data("troxel-tag"))}),b=[],d(".manageBpDBremoveTag:checked").each(function{return b.push(d(this).data("troxel-tag"))}),window.localStorage.setItem("_BpDB_installRequest",JSON.stringify(a)),window.localStorage.setItem("_BpDB_removeRequest",JSON.stringify(b)),location.reload}),d("#manageBpDBremoveDB").click(function{return window.confirm("Are you really sure you want to delete all installed Trove Blueprint Database tags and reload the page? The latest tag will be redownloaded after the page reload and all other installed tags will be gone!")?s:void 0}),d(".snewApPos").prop("disabled",!0),d("#cbnewAp").prop("checked",!1).change(function{return d(".snewApPos").prop("disabled",!d(this).prop("checked"))}),q=[],d("#exportModal").on("hide.bs.modal",function{var a,b,c;for(d("#exportQb").text("Export as Qubicle (*.qb, main map) ...").removeAttr("href"),d("#exportQba").text("Export as alpha material map (*_a.qb) ...").removeAttr("href"),d("#exportQbt").text("Export as type material map (*_t.qb) ...").removeAttr("href"),d("#exportQbs").text("Export as specular material map (*_s.qb) ...").removeAttr("href"),d("#exportQbzip").text("Export as material map archive (.zip: 4x .qb) ...").removeAttr("href"),d("#exportZox").text("Export as Zoxel (.zox) ...").removeAttr("href"),d("#exportVox").text("Export as Magica Voxel (.vox) ...").removeAttr("href"),d("#exportBase64Ta").hide,d("#exportJsonTa").hide,b=0,c=q.length;c>b;b++)a=q[b],URL.revokeObjectURL(a);return q=[]}),d("#exportQbzip").click(function{var a,b,c,e,f,g,h,j;if(!v.readonly)return null==d(this).attr("href")?(h=new l(v)["export"](d("#exportQbComp").prop("checked")),c=h[0],e=h[1],g=h[2],f=h[3],a=d("#exportFilenameQb").val||"Model",j=new i,j.file(a+".qb",c),j.file(a+"_a.qb",e),j.file(a+"_t.qb",g),j.file(a+"_s.qb",f),b=URL.createObjectURL(j.generate({type:"blob"}),{type:"application/zip"}),q.push(b),d("#exportQbzip").text("Download material map archive (.zip: 4x .qb)").attr("download",a+".zip").attr("href",b)):void 0}),d(".exportQb").click(function{var a,b,c,e,f,g,h;if(!v.readonly)return null==d(this).attr("href")?(g=new l(v)["export"](d("#exportQbComp").prop("checked")),h=g.map(function(a){return URL.createObjectURL(new Blob([a],{type:"application/octet-binary"}))}),b=h[0],c=h[1],f=h[2],e=h[3],q.push(b,c,f,e),a=d("#exportFilenameQb").val||"Model",d("#exportQb").text("Download main map (.qb)").attr("download",a+".qb").attr("href",b),d("#exportQba").text("Download alpha material map (*_a.qb)").attr("download",a+"_a.qb").attr("href",c),d("#exportQbt").text("Download type material map (*_t.qb)").attr("download",a+"_t.qb").attr("href",f),d("#exportQbs").text("Download specular material map (*_s.qb)").attr("download",a+"_s.qb").attr("href",e)):void 0}),d("#exportZox").click(function{var a,b;if(!v.readonly)return a=d("#exportFilenameZox").val||"Model",b="data:application/octet-binary;base64,"+btoa(new o(v)["export"]),null==d(this).attr("href")?d(this).text("Download as Zoxel (.zox)").attr("download",a+".zox").attr("href",b):void 0}),d("#exportVox").click(function{var a,b;if(!v.readonly)return a=d("#exportFilenameVox").val||"Model",b=URL.createObjectURL(new Blob([new k(v)["export"]],{type:"application/octet-binary"})),q.push(b),null==d(this).attr("href")?d(this).text("Download as Magica Voxel (.vox)").attr("download",a+".vox").attr("href",b):void 0}),d("#exportBase64").click(function{var a,b,c,f,g,h,i,j;if(!v.readonly)return d("#exportBase64Rbb").prop("checked")&&(g=v.computeBoundingBox,h=g[0],i=g[1],j=g[2],b=g[3],c=g[4],f=g[5],v.resize(h,i,j,b,c,f)),a=window.location.toString.split("#")[0]+"#m="+new e(v)["export"](d("#exportBase64Ro").prop("checked"),d("#exportBase64V2").prop("checked")?2:1),d("#exportBase64Ta").val(a).fadeIn,d("#exportBase64Tsl").prop("checked")?d.post("http://www.trovesaurus.com/shorturl.php",{TroxelData:a}).done(function(a){return d("#exportBase64Ta").val(a)}):void 0}),d("#exportJson").click(function{return v.readonly?void 0:d("#exportJsonTa").val(new j(v)["export"](d("#exportJsonPret").prop("checked"))).fadeIn}),d("#btnExportPng").click(function{return u.render(!0)}),d("#ulSavedModels").parent.on("show.bs.dropdown",function(a){var b,c,f,h;if("#ulSavedModels"===d(a.relatedTarget).data("tag")){for(null==v||1===v.readonly?d(this).find("#SavedModelsAdd").prop("disabled",!0).parent.addClass("disabled"):d(this).find("#SavedModelsAdd").prop("disabled",!1).parent.removeClass("disabled"),d("#ulSavedModels li:gt(6)").remove,b=c=0,h=window.localStorage.length;h>c;b=c+=1)f=window.localStorage.key(b),0===f.indexOf("saved_models_")&&d("#ulSavedModels").append("<li><a class='openSavedModel' data-model='"+window.localStorage.getItem(f)+"'>"+f.substring(13)+"</a></li>");0===d(".openSavedModel").length&&d("#ulSavedModels").append(' <a>No saved models</a></li>')}return d(".openSavedModel").click(function{return v=new e(d(this).data("model")),null!=v.readonly&&0!==v.readonly||d("#btnExport").show,d("#btnExportPng").show,y({voxels:this.voxels,x:this.x,y:this.y,z:this.z},"#m="+d(this).data("model")),null!=u?u.reload(v.voxels,v.x,v.y,v.z,!0,!1):u=new g(v),d("#ulSavedModels li:eq(1) a").text(d(this).text)})}),d("#saveModelAs").click(function{return 0===d("#saveModelName").val.length||null==v||v.readonly?void 0:(window.localStorage.setItem("saved_models_"+d("#saveModelName").val,new e(v)["export"](v.readonly)),d("#saveModal").modal("hide"))}),d("#modeView").click(function{return null==v||d(this).parent.hasClass("active")?void 0:(d(this).parent.addClass("active"),d("#modeEdit").parent.removeClass("active"),u.changeEditMode(!1),d("#addPanel").fadeOut,"undefined"!=typeof ga&&null!==ga?ga("send","pageview","/"):void 0)}),d("#modeEdit").click(function{return null==v||v.readonly||d(this).parent.hasClass("active")?void 0:(d(this).parent.addClass("active"),d("#modeView").parent.removeClass("active"),u.changeEditMode(!0),d("#addPanel").fadeIn,"undefined"!=typeof ga&&null!==ga?ga("send","pageview","/edit"):void 0)}),d(".rotateBtn").click(function{var a,b;if(null!=v){switch(d(this).data("rotate")){case"x":v.rotateX(!0);break;case"-x":v.rotateX(!1);break;case"y":v.rotateY(!0);break;case"-y":v.rotateY(!1);break;case"z":v.rotateZ(!0);break;case"-z":v.rotateZ(!1)}return u.reload(v.voxels,v.x,v.y,v.z,!0,!1),b={voxels:v.voxels,x:v.x,y:v.y,z:v.z,readonly:v.readonly},a=new e(b)["export"](!1),y(b,"#m="+a)}}),d(".moveBtn").click(function{var a,b;if(null!=v){switch(d(this).data("move")){case"x":v.moveX(!0,!0);break;case"-x":v.moveX(!1,!0);break;case"y":v.moveY(!0,!0);break;case"-y":v.moveY(!1,!0);break;case"z":v.moveZ(!0,!0);break;case"-z":v.moveZ(!1,!0)}return u.reload(v.voxels,v.x,v.y,v.z,!1,!1),b={voxels:v.voxels,x:v.x,y:v.y,z:v.z,readonly:v.readonly},a=new e(b)["export"](!1),y(b,"#m="+a)}}),d(".mirrorBtn").click(function{var a,b;if(null!=v){switch(d(this).data("mirror")){case"x":v.mirrorX(!0);break;case"y":v.mirrorY(!0);break;case"z":v.mirrorZ(!0)}return u.reload(v.voxels,v.x,v.y,v.z,!1,!1),b={voxels:v.voxels,x:v.x,y:v.y,z:v.z,readonly:v.readonly},a=new e(b)["export"](!1),y(b,"#m="+a)}}),d(".panel-heading").click(function{var a;return a=d(this).find("button span"),a.hasClass("glyphicon-minus")?a.removeClass("glyphicon-minus").addClass("glyphicon-plus"):a.removeClass("glyphicon-plus").addClass("glyphicon-minus"),d(this).next.toggle}),d("#backgroundColor").val("#888888").change(function{return null!=u?(u.renderer.setClearColor(new m.Color(d(this).val).getHex),u.controls.needsRender=!0,d("body").css("background-color",d(this).val)):void 0}),d("#ambLightColor").val("#606060").change(function{return null!=u?(u.ambientLight.color=new m.Color(d(this).val),u.controls.needsRender=!0):void 0}),d("#dirLightColor").val("#ffffff").change(function{return null!=u?(u.directionalLight.color=new m.Color(d(this).val),u.controls.needsRender=!0):void 0}),d("#dirLightIntensity").val(.3).change(function{return null!=u?(u.directionalLight.intensity=parseFloat(d(this).val),u.controls.needsRender=!0):void 0}),d("#pointLightColor").val("#ffffff").change(function{return null!=u?(u.pointLight.color=new m.Color(d(this).val),u.controls.needsRender=!0):void 0}),d("#pointLightIntensity").val(.7).change(function{return null!=u?(u.pointLight.intensity=parseFloat(d(this).val),u.controls.needsRender=!0):void 0}),d("#dirLightX").val("-0.5"),d("#dirLightY").val("-0.5"),d("#dirLightZ").val("1"),d("#dirLightVector").click(function{return null!=u?(u.directionalLight.position.set(parseFloat(d("#dirLightX").val),parseFloat(d("#dirLightY").val),parseFloat(d("#dirLightZ").val)).normalize,u.controls.needsRender=!0):void 0}),d("#addVoxAP").click(function{return d("#addVoxColor").val("#ff00ff"),d("#addVoxAlpha, #addVoxType, #addVoxSpecular").prop("disabled",!0)}),d("#addVoxColor").change(function{switch(d(this).val){case"#ff00ff":return d("#addVoxAlpha, #addVoxType, #addVoxSpecular").prop("disabled",!0);default:return d("#addVoxAlpha, #addVoxType, #addVoxSpecular").prop("disabled",!1),d("#addVoxType").change}}),d("#addVoxType").change(function{switch(parseInt(d(this).val)){case 1:case 2:case 4:return d("#addVoxAlpha").prop("disabled",!1),d("#addVoxSpecular").prop("disabled",!0);case 0:case 3:return d("#addVoxAlpha").prop("disabled",!0),d("#addVoxSpecular").prop("disabled",!1)}}),d("#addVoxAlpha").val(112),d("#editVoxNoiseBright").val(0),d("#editVoxNoiseHSL").val(0),d("#resizeModal").on("show.bs.modal",function(a){return null==u?a.relatedTarget.preventDefault:void 0}),d("#openResizeModal").click(function{return null!=u?(d("#resizeX").val(v.x),d("#resizeY").val(v.y),d("#resizeZ").val(v.z),d("#resizeOffX").val(0),d("#resizeOffY").val(0),d("#resizeOffZ").val(0)):void 0}),d("#resizeBtn").click(function{var a,b;if(null!=u)return d("#resizeModal").modal("hide"),v.resize(parseInt(d("#resizeX").val),parseInt(d("#resizeY").val),parseInt(d("#resizeZ").val),parseInt(d("#resizeOffX").val),parseInt(d("#resizeOffY").val),parseInt(d("#resizeOffZ").val)),u.reload(v.voxels,v.x,v.y,v.z,!0,!1),b={voxels:v.voxels,x:v.x,y:v.y,z:v.z,readonly:v.readonly},a=new e(b)["export"](!1),y(b,"#m="+a)}),d("#resizeCalcBBb").click(function{var a,b,c,e,f,g,h;if(null!=u)return e=v.computeBoundingBox,f=e[0],g=e[1],h=e[2],a=e[3],b=e[4],c=e[5],d("#resizeX").val(f),d("#resizeY").val(g),d("#resizeZ").val(h),d("#resizeOffX").val(a),d("#resizeOffY").val(b),d("#resizeOffZ").val(c)}),d(d(".editTool")[0]).parent.button("toggle"),d("#fillSameColor").prop("checked",!0),d(".editTool").change(function{switch(d(this).data("edittool")){case 1:return d("#fillSameColorDiv").show;default:return d("#fillSameColorDiv").hide}}),d('[data-toggle="tooltip"]').tooltip,d("#rendererPostEffect").val(1).change(function{return null!=u?u=new g(v):void 0}),d("#renderMode").change(function{return null!=u?(u.renderMode=parseInt(d(this).val),u.reload(v.voxels,v.x,v.y,v.z,!1,!1)):void 0}),d("#renderWireframes").change(function{return null!=u?(u.renderWireframes=parseInt(d(this).val),u.reload(v.voxels,v.x,v.y,v.z,!1,!1)):void 0}),d("#renderControls").change(function{return null!=u?u.controls.mode="0"===d(this).val:void 0}),d("#ImportMerge").prop("checked",!1).change(function{return d(".QbMergeOff").prop("disabled",!d(this).prop("checked"))}),d("#renderAutoRotateSpeed").val(0).change(function{var a;if(null!=u)return a=parseInt(d(this).val),0===a?u.controls.autoRotate=!1:(u.controls.autoRotate=!0,u.controls.autoRotateSpeed=a)}),d("#TroveCreationsLint").click(function{var a,b,c,f,g,h,i,j,k,l,m,o,p,q,r,s,t,w,x,z,A,B;if(null!=u){for(d("#TroveCreationsExportLink").hide,v.readonly?d("#TroveCreationsExportDiv").hide:d("#TroveCreationsExportDiv").show,z=d("#TroveCreationsType").val,w=new n(v,z),u.renderWireframes=6,d("#renderWireframes").val("6"),u.reload(v.voxels,v.x,v.y,v.z,!0,!1),g={voxels:v.voxels,x:v.x,y:v.y,z:v.z,readonly:v.readonly},a=new e(g)["export"](!1),y(g,"#m="+a),d("#TroveCreationsLintingResults").empty,o=w.errors,h=0,i=o.length;i>h;h++)b=o[h],c=null!=b.footer?'<hr style="margin-top: 5px; margin-bottom: 5px;"> Hot to fix it?: '+b.footer+" ":"",d("#TroveCreationsLintingResults").append(' '+b.title+" "+b.body+c+" ");for((null!=(p=v.warn)?p.length:void 0)>0&&d("#TroveCreationsLintingResults").append(' Troxel had to fix issues in your material maps for you! There were issues in your material maps like invalid color values in the type / alpha / specular map or having a voxel in one map but not in another. These were fixed automatically on import by Troxel for you. It\'s recommended that you either fix these isues by yourself in your source .qb files or use the .qb files exported by Troxel for creating your .blueprint for submission. <textarea class="form-control" style="resize: none">'+v.warn.join("\n")+" "),q=w.warnings,l=0,j=q.length;j>l;l++)A=q[l],c=null!=A.footer?'<hr style="margin-top: 5px; margin-bottom: 5px;"> Hot to fix it?: '+A.footer+" ":"",d("#TroveCreationsLintingResults").append(' '+A.title+" "+A.body+c+" ");for(r=w.infos,m=0,k=r.length;k>m;m++)f=r[m],d("#TroveCreationsLintingResults").append(' '+f.title+" "+f.body+" ");return w.warnings.length===(s=w.errors.length)&&0===s?d("#TroveCreationsLintingResults").append(' All test passed! There is nothing to complain about your model. Thats great, go submitting it! '):(B=w.warnings.length+((null!=(t=v.warn)?t.length:void 0)>0?1:0),d("#TroveCreationsLintingCount").text("Warning: You have "+w.errors.length+" errors and "+B+" warnings for your voxel model. Please try to fix them for submitting it to the Trove Creation Reddit!")),x=function{switch(z){case"melee":return'melee weapon creation check out the <a href="http://trove.wikia.com/wiki/Melee_weapon_creation" class="alert-link" target="_blank">melee weapon creation guide</a>';case"gun":return'gun creation check out the <a href="http://trove.wikia.com/wiki/Gun_Weapon_Creation" class="alert-link" target="_blank">gun creation guide</a>';case"staff":return'staff creation check out the <a href="http://trove.wikia.com/wiki/Staff_Creation_Guide" class="alert-link" target="_blank">staff creation guide</a>';case"bow":return'bow creation check out the <a href="http://trove.wikia.com/wiki/Bow_Creation_Guide" class="alert-link" target="_blank">bow creation guide</a>';case"spear":return'spear creation check out the <a href="http://trove.wikia.com/wiki/Spear_Creation_Guide" class="alert-link" target="_blank">spear creation guide</a>';case"mask":return'mask creation check out the <a href="http://trove.wikia.com/wiki/Mask_creation" class="alert-link" target="_blank">mask creation guide</a>';case"hat":return'hat creation check out the <a href="http://trove.wikia.com/wiki/Hat_creation" class="alert-link" target="_blank">hat creation guide</a>';case"hair":return'hair creation check out the <a href="http://trove.wikia.com/wiki/Hair_creation" class="alert-link" target="_blank">hair creation guide</a>';case"deco":return'decoration creation check out the <a href="http://trove.wikia.com/wiki/Cornerstone_decoration_creation" class="alert-link" target="_blank">decoration creation guide</a>';case"lair":case"dungeon":return'lair and dungeon creation check out the <a href="http://trove.wikia.com/wiki/Lair_and_Dungeon_creation" class="alert-link" target="_blank">lair and dungeon creation guide</a>';default:return'Trove creations check out the <a href="http://trove.wikia.com/wiki/Guides" class="alert-link" target="_blank">trove creations guides</a>'}},d("#TroveCreationsLintingResults").prepend(' For more information about '+x+'. Also check out the <a href="http://trove.wikia.com/wiki/Material_Map_Guide" class="alert-link" target="_blank">Material Maps Guide</a>, the <a href="http://trove.wikia.com/wiki/Style_guidelines" class="alert-link" target="_blank">offical Style Guidelines</a> and the <a href="http://trove.wikia.com/wiki/Mods\'_Style_Guidelines" class="alert-link" target="_blank"> Mods\' Style Guidelines</a>! Note: You will also need some ingame screenshots for your item submission. ')}}),d("#TroveCreationsExport").click(function{var a;if(!v.readonly)return a=window.location.toString.split("#")[0]+"#m="+new e(v)["export"](d("#TroveCreationsReadonly").prop("checked"),2),d("#TroveCreationsExportLink").val("[Troxel Link]("+a+")").fadeIn,d("#TroveCreationsTsl").prop("checked")?d.post("http://www.trovesaurus.com/shorturl.php",{TroxelData:a}).done(function(a){return d("#TroveCreationsExportLink").val(a)}):void 0}),d("#TroveCreationLinterModal").on("show.bs.modal",function(a){return null==u?a.relatedTarget.preventDefault:void 0}),c.exports}),a.register("github:twbs/bootstrap@3.3.6/dist/css/bootstrap.css!github:systemjs/plugin-css@0.1.20/css.js",[],!1,function{}),a.register("github:twbs/bootstrap@3.3.6/dist/css/bootstrap-theme.css!github:systemjs/plugin-css@0.1.20/css.js",[],!1,function{}),a.register("troxel/Main.css!github:systemjs/plugin-css@0.1.20/css.js",[],!1,function{})})(function(a){"function"==typeof define&&define.amd?define([],a):"object"==typeof module&&module.exports&&"function"==typeof require?module.exports=a:a});