-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsplash.min.js
More file actions
10 lines (10 loc) · 311 KB
/
splash.min.js
File metadata and controls
10 lines (10 loc) · 311 KB
1
2
3
4
5
6
7
8
9
10
!function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){module.exports=require("ndpack-image")(1,256,4,"iVBORw0KGgoAAAANSUhEUgAAAQAAAAABCAYAAAAxWXB3AAAAAklEQVR4AewaftIAAADsSURBVCXBgXEEIQADsZW5/lv+DERS/dBDF3roQlkXeoj1EOshVnSxItZjoSzWQyzWb2JFF6e2WBGrLVbEaosV2YpYka0sZCti/SZWZMpClIQQ2oROQhRC6BBCUwiNRmhEobM1oqTRmdCIGp1JGlGzvokaoW9Cq9C3Yk1R3xY1QseaQqMzjajR6BCaGp0JjaizRY3QmUaq0ZnQCI02nUSh0aYRoqSzRSGEDiGKYlGsqU0IoRHLtC2EkImFItTEykIRshWhiPUjFKEs1ISyUIQi1kMoMqHoQhGKLlYkPYSiC0UXii70KPRPF3ro+gNf1gb72t6EvgAAAABJRU5ErkJggg==")},{"ndpack-image":71}],2:[function(require,module,exports){function createMesh(){var voxels=qbqb(SIZE,1,SIZE),positions=unindex(combine(voxels)),edges=unindex(combine(getEdges(voxels)));return{positions:positions,centroids:unindex(combine(getCentroids(voxels))),normals:normals(positions),edges:edges}}function getCentroids(meshes){return meshes.map(function(mesh){mesh=clone(mesh);for(var i=0;i<mesh.positions.length;i++)mesh.positions[i]=mesh.centroid;return mesh})}function getEdges(meshes){return meshes.map(function(mesh){mesh=clone(mesh);for(var idx=mesh.index,i=0;i<mesh.positions.length;i++){var pos=mesh.positions[i];mesh.positions[i]=mesh.positions[i].slice(),mesh.positions[i][0]=2*(pos[0]*SIZE-idx[0]-.5),mesh.positions[i][2]=2*(pos[2]*SIZE-idx[2]-.5),mesh.positions[i][1]=2*(pos[1]-idx[1]-.5)}return mesh})}var createCamera=require("orbit-camera"),createTex2d=require("gl-texture2d"),createGeom=require("gl-geometry"),createShader=require("gl-shader"),createFBO=require("gl-fbo"),clear=require("gl-clear")({color:[1,1,1,1]}),mat4=require("gl-matrix").mat4,quat=require("gl-matrix").quat,triangle=require("a-big-triangle"),debounce=require("frame-debounce"),unindex=require("unindex-mesh"),normals=require("face-normals"),combine=require("mesh-combine"),fit=require("canvas-fit"),qbqb=require("cube-cube"),getTime=require("right-now"),clone=require("clone"),SIZE=16,RES=[1/SIZE,1/SIZE];module.exports=function(canvas){function render(){var width=canvas.width,height=canvas.height,now=.5*getTime();heightmap.bind(),gl.viewport(0,0,SIZE,SIZE),gl.disable(gl.DEPTH_TEST),gl.disable(gl.CULL_FACE),heightShader.bind(),heightShader.uniforms.uTime=now,heightShader.uniforms.uResolution=RES,triangle(gl),gl.bindFramebuffer(gl.FRAMEBUFFER,null),gl.viewport(0,0,width,height),gl.enable(gl.DEPTH_TEST),gl.enable(gl.CULL_FACE),clear(gl),mat4.perspective(projection,Math.PI/4,width/height,.001,100),quat.identity(camera.rotation),quat.rotateY(camera.rotation,camera.rotation,2e-4*now),quat.rotateX(camera.rotation,camera.rotation,-.5),camera.view(view),quat.identity(camera.rotation),quat.rotateY(camera.rotation,camera.rotation,2e-4*now),geom.bind(shader),shader.uniforms.uResolution=RES,shader.uniforms.uViewRotation=mat4.fromQuat(viewrot,camera.rotation),shader.uniforms.uProjection=projection,shader.uniforms.uModel=model,shader.uniforms.uView=view,shader.uniforms.tHeightmap=heightmap.color[0].bind(0),shader.uniforms.tGradient=gradient.bind(1),geom.draw(),geom.unbind()}canvas.style.position="fixed";var gl=require("gl-context")(canvas,render),heightmap=createFBO(gl,[SIZE,SIZE],{float:!0}),gradient=createTex2d(gl,require("./gradient-map")),voxels=createMesh(),projection=mat4.create(),viewrot=mat4.create(),view=mat4.create(),model=mat4.create(),camera=createCamera([0,10,30],[0,0,0],[0,1,0]),shader=createShader(gl,"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 aPosition;\nattribute vec3 aCentroid;\nattribute vec3 aNormal;\nattribute vec3 aEdge;\n\nvarying vec4 vNeighbours;\nvarying vec3 vNormal;\nvarying vec2 vEdge;\n\nuniform sampler2D tHeightmap;\n\nuniform vec2 uResolution;\nuniform mat4 uProjection;\nuniform mat4 uModel;\nuniform mat4 uView;\n\nconst float threshold = 1.0 / 0.01;\n\nvoid main() {\n vec3 position = aPosition;\n vec2 coord = aCentroid.xz;\n\n float height = texture2D(tHeightmap, aCentroid.xz).r;\n float nht = texture2D(tHeightmap, coord + uResolution * vec2(+0.0, -1.0)).r;\n float nhb = texture2D(tHeightmap, coord + uResolution * vec2(+0.0, +1.0)).r;\n float nhl = texture2D(tHeightmap, coord + uResolution * vec2(-1.0, +0.0)).r;\n float nhr = texture2D(tHeightmap, coord + uResolution * vec2(+1.0, +0.0)).r;\n\n position.y = mix(position.y, height, position.y);\n\n gl_Position = (\n uProjection\n * uView\n * uModel\n * vec4(position, 1.0)\n ) + vec4(0.35, -0.2, 0.0, 0.0);\n\n vNormal = aNormal;\n vEdge = aEdge.xz;\n vNeighbours = vec4(\n clamp((nht - height) * threshold, -1.0, 1.0)\n , clamp((nhb - height) * threshold, -1.0, 1.0)\n , clamp((nhl - height) * threshold, -1.0, 1.0)\n , clamp((nhr - height) * threshold, -1.0, 1.0)\n );\n}\n","precision mediump float;\n#define GLSLIFY 1\n\nuniform sampler2D tGradient;\nuniform mat4 uViewRotation;\n\nvarying vec4 vNeighbours;\nvarying vec3 vNormal;\nvarying vec2 vEdge;\n\n#define EDGE_SHARPNESS 1.8\n#define EDGE_SHADOW 0.2\n#define BLOCK_COLOR 1.1\n\nvoid main() {\n vec4 lightDirection = vec4(normalize(vec3(-0.2, 1.2, 0.8)), 1.0);\n\n lightDirection = uViewRotation * lightDirection;\n\n float nhr = max(0.0, vNeighbours.x);\n float nhl = max(0.0, vNeighbours.y);\n float nhb = max(0.0, vNeighbours.z);\n float nht = max(0.0, vNeighbours.w);\n float top = abs(vNormal.y);\n\n vec2 de = vec2(\n max(0.0, nht * vEdge.x) - min(0.0, nhb * vEdge.x)\n , max(0.0, nhl * vEdge.y) - min(0.0, nhr * vEdge.y)\n );\n\n float d1 = smoothstep(0.0, 1.0, abs(de.x));\n float d2 = smoothstep(0.0, 1.0, abs(de.y));\n float d = (pow(d1, EDGE_SHARPNESS) + pow(d2, EDGE_SHARPNESS));\n\n vec3 diffuse = vec3(1.0 - min(d, 1.0) * top * EDGE_SHADOW) * BLOCK_COLOR;\n vec3 ambient = vec3(0.1);\n float lambert = max(0.0, dot(vNormal, normalize(lightDirection.xyz)));\n\n vec3 color = diffuse * lambert + ambient;\n\n gl_FragColor.rgb = texture2D(tGradient, vec2(0.0, color.r)).rgb;\n gl_FragColor.a = 1.0;\n}\n"),heightShader=createShader(gl,"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\n\nvoid main() {\n gl_Position = vec4(position.xy, 1.0, 1.0);\n}\n","precision mediump float;\n#define GLSLIFY 1\n\nuniform vec2 uResolution;\nuniform float uTime;\n\nvoid main() {\n vec2 coord = (gl_FragCoord.xy * uResolution - 0.5) * 2.0;\n float height = 0.0;\n\n height += sin(uTime * 0.00062 + coord.y * 2.5) * 0.4;\n height += cos(uTime * 0.00048 + coord.x * 1.8) * 0.6;\n height += sin(uTime * 0.0048 + coord.x * 7.9) * 0.2;\n height += cos(uTime * 0.0038 + coord.y * 6.8) * 0.1;\n height += sin(uTime * 0.0028 + coord.y * 2.8 + 0.5) * 0.3;\n\n // scale up from 0 during the first few moments.\n height -= clamp(1.0 - uTime * 0.0005, 0.0, 1.0) * 2.0;\n\n // scale by 0.2, prevent going below 0.\n height = max(0.0, height * 0.2);\n\n // scale to fill a hemisphere(ish): avoid it looking like\n // a clear grid of raised columns.\n height *= max(0.0, 0.85 - max(0.0, coord.x * coord.x + coord.y * coord.y));\n\n gl_FragColor.r = height;\n gl_FragColor.gba = vec3(1.0);\n}\n"),geom=createGeom(gl).attr("aPosition",voxels.positions).attr("aCentroid",voxels.centroids).attr("aNormal",voxels.normals).attr("aEdge",voxels.edges);camera.distance=1.5,heightmap.color[0].wrap=gl.CLAMP_TO_EDGE,heightmap.color[0].minFilter=gl.NEAREST,heightmap.color[0].maxFilter=gl.NEAREST,mat4.translate(model,model,[-.5,0,-.5]),window.addEventListener("resize",debounce(fit(canvas,window)),!1)}},{"./gradient-map":1,"a-big-triangle":3,"canvas-fit":9,clone:10,"cube-cube":11,"face-normals":18,"frame-debounce":19,"gl-clear":22,"gl-context":25,"gl-fbo":26,"gl-geometry":29,"gl-matrix":39,"gl-shader":40,"gl-texture2d":51,"mesh-combine":68,"orbit-camera":72,"right-now":95,"unindex-mesh":100}],3:[function(require,module,exports){"use strict";function createABigTriangle(gl){if(gl.__BIG_TRIANGLE)return gl.__BIG_TRIANGLE.bind(),gl.drawArrays(gl.TRIANGLES,0,3),void gl.__BIG_TRIANGLE.unbind();var buf=createBuffer(gl,new Float32Array([-1,-1,-1,4,4,-1])),vao=createVAO(gl,null,[{buffer:buf,type:gl.FLOAT,size:2,offset:0,stride:0,normalized:!1}]);gl.__BIG_TRIANGLE=vao,vao.bind(),gl.drawArrays(gl.TRIANGLES,0,3),vao.unbind()}var createBuffer=require("gl-buffer"),createVAO=require("gl-vao");module.exports=createABigTriangle},{"gl-buffer":20,"gl-vao":55}],4:[function(require,module,exports){function addLineNumbers(string,start,delim){start="number"==typeof start?start:1,delim=delim||": ";var lines=string.split(/\r?\n/),totalDigits=String(lines.length+start-1).length;return lines.map(function(line,i){var c=i+start,digits=String(c).length;return padLeft(c,totalDigits-digits)+delim+line}).join("\n")}var padLeft=require("pad-left");module.exports=addLineNumbers},{"pad-left":73}],5:[function(require,module,exports){function pack(arr,type){if(type=type||"float32",!arr[0]||!arr[0].length)return arr;for(var Arr="string"==typeof type?dtype(type):type,dim=arr[0].length,out=new Arr(arr.length*dim),k=0,i=0;i<arr.length;i++)for(var j=0;j<dim;j++)out[k++]=arr[i][j];return out}var dtype=require("dtype");module.exports=pack},{dtype:6}],6:[function(require,module,exports){(function(Buffer){module.exports=function(dtype){switch(dtype){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray;case"generic":case"data":case"dataview":return ArrayBuffer;case"buffer":return void 0===Buffer?ArrayBuffer:Buffer}}}).call(this,require("buffer").Buffer)},{buffer:108}],7:[function(require,module,exports){module.exports=function(str){return atob(str)}},{}],8:[function(require,module,exports){"use strict";"use restrict";function countTrailingZeros(v){var c=32;return v&=-v,v&&c--,65535&v&&(c-=16),16711935&v&&(c-=8),252645135&v&&(c-=4),858993459&v&&(c-=2),1431655765&v&&(c-=1),c}exports.INT_BITS=32,exports.INT_MAX=2147483647,exports.INT_MIN=-1<<31,exports.sign=function(v){return(v>0)-(v<0)},exports.abs=function(v){var mask=v>>31;return(v^mask)-mask},exports.min=function(x,y){return y^(x^y)&-(x<y)},exports.max=function(x,y){return x^(x^y)&-(x<y)},exports.isPow2=function(v){return!(v&v-1||!v)},exports.log2=function(v){var r,shift;return r=(v>65535)<<4,v>>>=r,shift=(v>255)<<3,v>>>=shift,r|=shift,shift=(v>15)<<2,v>>>=shift,r|=shift,shift=(v>3)<<1,v>>>=shift,(r|=shift)|v>>1},exports.log10=function(v){return v>=1e9?9:v>=1e8?8:v>=1e7?7:v>=1e6?6:v>=1e5?5:v>=1e4?4:v>=1e3?3:v>=100?2:v>=10?1:0},exports.popCount=function(v){return v-=v>>>1&1431655765,16843009*((v=(858993459&v)+(v>>>2&858993459))+(v>>>4)&252645135)>>>24},exports.countTrailingZeros=countTrailingZeros,exports.nextPow2=function(v){return v+=0===v,--v,v|=v>>>1,v|=v>>>2,v|=v>>>4,v|=v>>>8,(v|=v>>>16)+1},exports.prevPow2=function(v){return v|=v>>>1,v|=v>>>2,v|=v>>>4,v|=v>>>8,(v|=v>>>16)-(v>>>1)},exports.parity=function(v){return v^=v>>>16,v^=v>>>8,v^=v>>>4,27030>>>(v&=15)&1};var REVERSE_TABLE=new Array(256);!function(tab){for(var i=0;i<256;++i){var v=i,r=i,s=7;for(v>>>=1;v;v>>>=1)r<<=1,r|=1&v,--s;tab[i]=r<<s&255}}(REVERSE_TABLE),exports.reverse=function(v){return REVERSE_TABLE[255&v]<<24|REVERSE_TABLE[v>>>8&255]<<16|REVERSE_TABLE[v>>>16&255]<<8|REVERSE_TABLE[v>>>24&255]},exports.interleave2=function(x,y){return x&=65535,x=16711935&(x|x<<8),x=252645135&(x|x<<4),x=858993459&(x|x<<2),x=1431655765&(x|x<<1),y&=65535,y=16711935&(y|y<<8),y=252645135&(y|y<<4),y=858993459&(y|y<<2),y=1431655765&(y|y<<1),x|y<<1},exports.deinterleave2=function(v,n){return v=v>>>n&1431655765,v=858993459&(v|v>>>1),v=252645135&(v|v>>>2),v=16711935&(v|v>>>4),(v=65535&(v|v>>>16))<<16>>16},exports.interleave3=function(x,y,z){return x&=1023,x=4278190335&(x|x<<16),x=251719695&(x|x<<8),x=3272356035&(x|x<<4),x=1227133513&(x|x<<2),y&=1023,y=4278190335&(y|y<<16),y=251719695&(y|y<<8),y=3272356035&(y|y<<4),y=1227133513&(y|y<<2),x|=y<<1,z&=1023,z=4278190335&(z|z<<16),z=251719695&(z|z<<8),z=3272356035&(z|z<<4),z=1227133513&(z|z<<2),x|z<<2},exports.deinterleave3=function(v,n){return v=v>>>n&1227133513,v=3272356035&(v|v>>>2),v=251719695&(v|v>>>4),v=4278190335&(v|v>>>8),(v=1023&(v|v>>>16))<<22>>22},exports.nextCombination=function(v){var t=v|v-1;return t+1|(~t&-~t)-1>>>countTrailingZeros(v)+1}},{}],9:[function(require,module,exports){function fit(canvas,parent,scale){function resize(){var p=resize.parent||canvas.parentNode;if("function"==typeof p)var dims=p(scratch)||scratch,width=dims[0],height=dims[1];else if(p&&p!==document.body)var psize=size(p),width=0|psize[0],height=0|psize[1];else var width=window.innerWidth,height=window.innerHeight;return isSVG?(canvas.setAttribute("width",width*resize.scale+"px"),canvas.setAttribute("height",height*resize.scale+"px")):(canvas.width=width*resize.scale,canvas.height=height*resize.scale),canvas.style.width=width+"px",canvas.style.height=height+"px",resize}var isSVG="SVG"===canvas.nodeName.toUpperCase();return canvas.style.position=canvas.style.position||"absolute",canvas.style.top=0,canvas.style.left=0,resize.scale=parseFloat(scale||1),resize.parent=parent,resize()}var size=require("element-size");module.exports=fit;var scratch=new Float32Array(2)},{"element-size":17}],10:[function(require,module,exports){(function(Buffer){"use strict";function objectToString(o){return Object.prototype.toString.call(o)}function clone(parent,circular,depth,prototype){function _clone(parent,depth){if(null===parent)return null;if(0==depth)return parent;var child,proto;if("object"!=typeof parent)return parent;if(util.isArray(parent))child=[];else if(util.isRegExp(parent))child=new RegExp(parent.source,util.getRegExpFlags(parent)),parent.lastIndex&&(child.lastIndex=parent.lastIndex);else if(util.isDate(parent))child=new Date(parent.getTime());else{if(useBuffer&&Buffer.isBuffer(parent))return child=new Buffer(parent.length),parent.copy(child),child;void 0===prototype?(proto=Object.getPrototypeOf(parent),child=Object.create(proto)):(child=Object.create(prototype),proto=prototype)}if(circular){var index=allParents.indexOf(parent);if(-1!=index)return allChildren[index];allParents.push(parent),allChildren.push(child)}for(var i in parent){var attrs;proto&&(attrs=Object.getOwnPropertyDescriptor(proto,i)),attrs&&null==attrs.set||(child[i]=_clone(parent[i],depth-1))}return child}var allParents=[],allChildren=[],useBuffer=void 0!==Buffer;return void 0===circular&&(circular=!0),void 0===depth&&(depth=1/0),_clone(parent,depth)}var util={isArray:function(ar){return Array.isArray(ar)||"object"==typeof ar&&"[object Array]"===objectToString(ar)},isDate:function(d){return"object"==typeof d&&"[object Date]"===objectToString(d)},isRegExp:function(re){return"object"==typeof re&&"[object RegExp]"===objectToString(re)},getRegExpFlags:function(re){var flags="";return re.global&&(flags+="g"),re.ignoreCase&&(flags+="i"),re.multiline&&(flags+="m"),flags}};"object"==typeof module&&(module.exports=clone),clone.clonePrototype=function(parent){if(null===parent)return null;var c=function(){};return c.prototype=parent,new c}}).call(this,require("buffer").Buffer)},{buffer:108}],11:[function(require,module,exports){function cubecube(w,h,d,filter){filter=filter||truthy;for(var size=[1/w,1/h,1/d],cubes=[],x=0;x<w;x++)for(var y=0;y<h;y++)for(var z=0;z<d;z++)if(filter(x,y,z)){var cube=prism(size,[x/w,y/h,z/d]);cubes.push(cube),cube.centroid=[(x+.5)/w,(y+.5)/h,(z+.5)/d],cube.index=[x,y,z]}return cubes}var prism=require("rectangular-prism"),truthy=function(){return!0};module.exports=cubecube},{"rectangular-prism":93}],12:[function(require,module,exports){"use strict";function Procedure(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}function compileCwise(user_args){var proc=new Procedure;proc.pre=user_args.pre,proc.body=user_args.body,proc.post=user_args.post;var proc_args=user_args.args.slice(0);proc.argTypes=proc_args;for(var i=0;i<proc_args.length;++i){var arg_type=proc_args[i];if("array"===arg_type||"object"==typeof arg_type&&arg_type.blockIndices){if(proc.argTypes[i]="array",proc.arrayArgs.push(i),proc.arrayBlockIndices.push(arg_type.blockIndices?arg_type.blockIndices:0),proc.shimArgs.push("array"+i),i<proc.pre.args.length&&proc.pre.args[i].count>0)throw new Error("cwise: pre() block may not reference array args");if(i<proc.post.args.length&&proc.post.args[i].count>0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===arg_type)proc.scalarArgs.push(i),proc.shimArgs.push("scalar"+i);else if("index"===arg_type){if(proc.indexArgs.push(i),i<proc.pre.args.length&&proc.pre.args[i].count>0)throw new Error("cwise: pre() block may not reference array index");if(i<proc.body.args.length&&proc.body.args[i].lvalue)throw new Error("cwise: body() block may not write to array index");if(i<proc.post.args.length&&proc.post.args[i].count>0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===arg_type){if(proc.shapeArgs.push(i),i<proc.pre.args.length&&proc.pre.args[i].lvalue)throw new Error("cwise: pre() block may not write to array shape");if(i<proc.body.args.length&&proc.body.args[i].lvalue)throw new Error("cwise: body() block may not write to array shape");if(i<proc.post.args.length&&proc.post.args[i].lvalue)throw new Error("cwise: post() block may not write to array shape")}else{if("object"!=typeof arg_type||!arg_type.offset)throw new Error("cwise: Unknown argument type "+proc_args[i]);proc.argTypes[i]="offset",proc.offsetArgs.push({array:arg_type.array,offset:arg_type.offset}),proc.offsetArgIndex.push(i)}}if(proc.arrayArgs.length<=0)throw new Error("cwise: No array arguments specified");if(proc.pre.args.length>proc_args.length)throw new Error("cwise: Too many arguments in pre() block");if(proc.body.args.length>proc_args.length)throw new Error("cwise: Too many arguments in body() block");if(proc.post.args.length>proc_args.length)throw new Error("cwise: Too many arguments in post() block");return proc.debug=!!user_args.printCode||!!user_args.debug,proc.funcName=user_args.funcName||"cwise",proc.blockSize=user_args.blockSize||64,createThunk(proc)}var createThunk=require("./lib/thunk.js");module.exports=compileCwise},{"./lib/thunk.js":14}],13:[function(require,module,exports){"use strict";function innerFill(order,proc,body){var i,j,dimension=order.length,nargs=proc.arrayArgs.length,has_index=proc.indexArgs.length>0,code=[],vars=[],idx=0,pidx=0;for(i=0;i<dimension;++i)vars.push(["i",i,"=0"].join(""));for(j=0;j<nargs;++j)for(i=0;i<dimension;++i)pidx=idx,idx=order[i],0===i?vars.push(["d",j,"s",i,"=t",j,"p",idx].join("")):vars.push(["d",j,"s",i,"=(t",j,"p",idx,"-s",pidx,"*t",j,"p",pidx,")"].join(""));for(vars.length>0&&code.push("var "+vars.join(",")),i=dimension-1;i>=0;--i)idx=order[i],code.push(["for(i",i,"=0;i",i,"<s",idx,";++i",i,"){"].join(""));for(code.push(body),i=0;i<dimension;++i){for(pidx=idx,idx=order[i],j=0;j<nargs;++j)code.push(["p",j,"+=d",j,"s",i].join(""));has_index&&(i>0&&code.push(["index[",pidx,"]-=s",pidx].join("")),code.push(["++index[",idx,"]"].join(""))),code.push("}")}return code.join("\n")}function outerFill(matched,order,proc,body){for(var dimension=order.length,nargs=proc.arrayArgs.length,blockSize=proc.blockSize,has_index=proc.indexArgs.length>0,code=[],i=0;i<nargs;++i)code.push(["var offset",i,"=p",i].join(""));for(var i=matched;i<dimension;++i)code.push(["for(var j"+i+"=SS[",order[i],"]|0;j",i,">0;){"].join("")),code.push(["if(j",i,"<",blockSize,"){"].join("")),code.push(["s",order[i],"=j",i].join("")),code.push(["j",i,"=0"].join("")),code.push(["}else{s",order[i],"=",blockSize].join("")),code.push(["j",i,"-=",blockSize,"}"].join("")),has_index&&code.push(["index[",order[i],"]=j",i].join(""));for(var i=0;i<nargs;++i){for(var indexStr=["offset"+i],j=matched;j<dimension;++j)indexStr.push(["j",j,"*t",i,"p",order[j]].join(""));code.push(["p",i,"=(",indexStr.join("+"),")"].join(""))}code.push(innerFill(order,proc,body));for(var i=matched;i<dimension;++i)code.push("}");return code.join("\n")}function countMatches(orders){for(var matched=0,dimension=orders[0].length;matched<dimension;){for(var j=1;j<orders.length;++j)if(orders[j][matched]!==orders[0][matched])return matched;++matched}return matched}function processBlock(block,proc,dtypes){for(var code=block.body,pre=[],post=[],i=0;i<block.args.length;++i){var carg=block.args[i];if(!(carg.count<=0)){var re=new RegExp(carg.name,"g"),ptrStr="",arrNum=proc.arrayArgs.indexOf(i);switch(proc.argTypes[i]){case"offset":var offArgIndex=proc.offsetArgIndex.indexOf(i);arrNum=proc.offsetArgs[offArgIndex].array,ptrStr="+q"+offArgIndex;case"array":ptrStr="p"+arrNum+ptrStr;var localStr="l"+i,arrStr="a"+arrNum;if(0===proc.arrayBlockIndices[arrNum])1===carg.count?"generic"===dtypes[arrNum]?carg.lvalue?(pre.push(["var ",localStr,"=",arrStr,".get(",ptrStr,")"].join("")),code=code.replace(re,localStr),post.push([arrStr,".set(",ptrStr,",",localStr,")"].join(""))):code=code.replace(re,[arrStr,".get(",ptrStr,")"].join("")):code=code.replace(re,[arrStr,"[",ptrStr,"]"].join("")):"generic"===dtypes[arrNum]?(pre.push(["var ",localStr,"=",arrStr,".get(",ptrStr,")"].join("")),code=code.replace(re,localStr),carg.lvalue&&post.push([arrStr,".set(",ptrStr,",",localStr,")"].join(""))):(pre.push(["var ",localStr,"=",arrStr,"[",ptrStr,"]"].join("")),code=code.replace(re,localStr),carg.lvalue&&post.push([arrStr,"[",ptrStr,"]=",localStr].join("")));else{for(var reStrArr=[carg.name],ptrStrArr=[ptrStr],j=0;j<Math.abs(proc.arrayBlockIndices[arrNum]);j++)reStrArr.push("\\s*\\[([^\\]]+)\\]"),ptrStrArr.push("$"+(j+1)+"*t"+arrNum+"b"+j);if(re=new RegExp(reStrArr.join(""),"g"),ptrStr=ptrStrArr.join("+"),"generic"===dtypes[arrNum])throw new Error("cwise: Generic arrays not supported in combination with blocks!");code=code.replace(re,[arrStr,"[",ptrStr,"]"].join(""))}break;case"scalar":code=code.replace(re,"Y"+proc.scalarArgs.indexOf(i));break;case"index":code=code.replace(re,"index");break;case"shape":code=code.replace(re,"shape")}}}return[pre.join("\n"),code,post.join("\n")].join("\n").trim()}function typeSummary(dtypes){for(var summary=new Array(dtypes.length),allEqual=!0,i=0;i<dtypes.length;++i){var t=dtypes[i],digits=t.match(/\d+/);digits=digits?digits[0]:"",0===t.charAt(0)?summary[i]="u"+t.charAt(1)+digits:summary[i]=t.charAt(0)+digits,i>0&&(allEqual=allEqual&&summary[i]===summary[i-1])}return allEqual?summary[0]:summary.join("")}function generateCWiseOp(proc,typesig){for(var dimension=typesig[1].length-Math.abs(proc.arrayBlockIndices[0])|0,orders=new Array(proc.arrayArgs.length),dtypes=new Array(proc.arrayArgs.length),i=0;i<proc.arrayArgs.length;++i)dtypes[i]=typesig[2*i],orders[i]=typesig[2*i+1];for(var blockBegin=[],blockEnd=[],loopBegin=[],loopEnd=[],loopOrders=[],i=0;i<proc.arrayArgs.length;++i){proc.arrayBlockIndices[i]<0?(loopBegin.push(0),loopEnd.push(dimension),blockBegin.push(dimension),blockEnd.push(dimension+proc.arrayBlockIndices[i])):(loopBegin.push(proc.arrayBlockIndices[i]),loopEnd.push(proc.arrayBlockIndices[i]+dimension),blockBegin.push(0),blockEnd.push(proc.arrayBlockIndices[i]));for(var newOrder=[],j=0;j<orders[i].length;j++)loopBegin[i]<=orders[i][j]&&orders[i][j]<loopEnd[i]&&newOrder.push(orders[i][j]-loopBegin[i]);loopOrders.push(newOrder)}for(var arglist=["SS"],code=["'use strict'"],vars=[],j=0;j<dimension;++j)vars.push(["s",j,"=SS[",j,"]"].join(""));for(var i=0;i<proc.arrayArgs.length;++i){arglist.push("a"+i),arglist.push("t"+i),arglist.push("p"+i);for(var j=0;j<dimension;++j)vars.push(["t",i,"p",j,"=t",i,"[",loopBegin[i]+j,"]"].join(""));for(var j=0;j<Math.abs(proc.arrayBlockIndices[i]);++j)vars.push(["t",i,"b",j,"=t",i,"[",blockBegin[i]+j,"]"].join(""))}for(var i=0;i<proc.scalarArgs.length;++i)arglist.push("Y"+i);if(proc.shapeArgs.length>0&&vars.push("shape=SS.slice(0)"),proc.indexArgs.length>0){for(var zeros=new Array(dimension),i=0;i<dimension;++i)zeros[i]="0";vars.push(["index=[",zeros.join(","),"]"].join(""))}for(var i=0;i<proc.offsetArgs.length;++i){for(var off_arg=proc.offsetArgs[i],init_string=[],j=0;j<off_arg.offset.length;++j)0!==off_arg.offset[j]&&(1===off_arg.offset[j]?init_string.push(["t",off_arg.array,"p",j].join("")):init_string.push([off_arg.offset[j],"*t",off_arg.array,"p",j].join("")));0===init_string.length?vars.push("q"+i+"=0"):vars.push(["q",i,"=",init_string.join("+")].join(""))}var thisVars=uniq([].concat(proc.pre.thisVars).concat(proc.body.thisVars).concat(proc.post.thisVars));vars=vars.concat(thisVars),vars.length>0&&code.push("var "+vars.join(","));for(var i=0;i<proc.arrayArgs.length;++i)code.push("p"+i+"|=0");proc.pre.body.length>3&&code.push(processBlock(proc.pre,proc,dtypes));var body=processBlock(proc.body,proc,dtypes),matched=countMatches(loopOrders);matched<dimension?code.push(outerFill(matched,loopOrders[0],proc,body)):code.push(innerFill(loopOrders[0],proc,body)),proc.post.body.length>3&&code.push(processBlock(proc.post,proc,dtypes)),proc.debug&&console.log("-----Generated cwise routine for ",typesig,":\n"+code.join("\n")+"\n----------");var loopName=[proc.funcName||"unnamed","_cwise_loop_",orders[0].join("s"),"m",matched,typeSummary(dtypes)].join("");return new Function(["function ",loopName,"(",arglist.join(","),"){",code.join("\n"),"} return ",loopName].join(""))()}var uniq=require("uniq");module.exports=generateCWiseOp},{uniq:101}],14:[function(require,module,exports){"use strict";function createThunk(proc){var code=["'use strict'","var CACHED={}"],vars=[],thunkName=proc.funcName+"_cwise_thunk";code.push(["return function ",thunkName,"(",proc.shimArgs.join(","),"){"].join(""));for(var typesig=[],string_typesig=[],proc_args=[["array",proc.arrayArgs[0],".shape.slice(",Math.max(0,proc.arrayBlockIndices[0]),proc.arrayBlockIndices[0]<0?","+proc.arrayBlockIndices[0]+")":")"].join("")],shapeLengthConditions=[],shapeConditions=[],i=0;i<proc.arrayArgs.length;++i){var j=proc.arrayArgs[i];vars.push(["t",j,"=array",j,".dtype,","r",j,"=array",j,".order"].join("")),typesig.push("t"+j),typesig.push("r"+j),string_typesig.push("t"+j),string_typesig.push("r"+j+".join()"),proc_args.push("array"+j+".data"),proc_args.push("array"+j+".stride"),proc_args.push("array"+j+".offset|0"),i>0&&(shapeLengthConditions.push("array"+proc.arrayArgs[0]+".shape.length===array"+j+".shape.length+"+(Math.abs(proc.arrayBlockIndices[0])-Math.abs(proc.arrayBlockIndices[i]))),shapeConditions.push("array"+proc.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,proc.arrayBlockIndices[0])+"]===array"+j+".shape[shapeIndex+"+Math.max(0,proc.arrayBlockIndices[i])+"]"))}proc.arrayArgs.length>1&&(code.push("if (!("+shapeLengthConditions.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),code.push("for(var shapeIndex=array"+proc.arrayArgs[0]+".shape.length-"+Math.abs(proc.arrayBlockIndices[0])+"; shapeIndex--\x3e0;) {"),code.push("if (!("+shapeConditions.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),code.push("}"));for(var i=0;i<proc.scalarArgs.length;++i)proc_args.push("scalar"+proc.scalarArgs[i]);return vars.push(["type=[",string_typesig.join(","),"].join()"].join("")),vars.push("proc=CACHED[type]"),code.push("var "+vars.join(",")),code.push(["if(!proc){","CACHED[type]=proc=compile([",typesig.join(","),"])}","return proc(",proc_args.join(","),")}"].join("")),proc.debug&&console.log("-----Generated thunk:\n"+code.join("\n")+"\n----------"),new Function("compile",code.join("\n"))(compile.bind(void 0,proc))}var compile=require("./compile.js");module.exports=createThunk},{"./compile.js":13}],15:[function(require,module,exports){module.exports=function(dtype){switch(dtype){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array}}},{}],16:[function(require,module,exports){"use strict";function dupe_array(count,value,i){var c=0|count[i];if(c<=0)return[];var j,result=new Array(c);if(i===count.length-1)for(j=0;j<c;++j)result[j]=value;else for(j=0;j<c;++j)result[j]=dupe_array(count,value,i+1);return result}function dupe_number(count,value){var result,i;for(result=new Array(count),i=0;i<count;++i)result[i]=value;return result}function dupe(count,value){switch(void 0===value&&(value=0),typeof count){case"number":if(count>0)return dupe_number(0|count,value);break;case"object":if("number"==typeof count.length)return dupe_array(count,value,0)}return[]}module.exports=dupe},{}],17:[function(require,module,exports){function getSize(element){if(element===window||element===document.body)return[window.innerWidth,window.innerHeight];if(!element.parentNode){var temporary=!0;document.body.appendChild(element)}var bounds=element.getBoundingClientRect(),styles=getComputedStyle(element),height=(0|bounds.height)+parse(styles.getPropertyValue("margin-top"))+parse(styles.getPropertyValue("margin-bottom")),width=(0|bounds.width)+parse(styles.getPropertyValue("margin-left"))+parse(styles.getPropertyValue("margin-right"));return temporary&&document.body.removeChild(element),[width,height]}function parse(prop){return parseFloat(prop)||0}module.exports=getSize},{}],18:[function(require,module,exports){function faceNormals(verts,output){var l=verts.length;output||(output=new Float32Array(l));for(var i=0;i<l;i+=9){var p1x=verts[i+3]-verts[i],p1y=verts[i+4]-verts[i+1],p1z=verts[i+5]-verts[i+2],p2x=verts[i+6]-verts[i],p2y=verts[i+7]-verts[i+1],p2z=verts[i+8]-verts[i+2],p3x=p1y*p2z-p1z*p2y,p3y=p1z*p2x-p1x*p2z,p3z=p1x*p2y-p1y*p2x,mag=Math.sqrt(p3x*p3x+p3y*p3y+p3z*p3z);0===mag?(output[i]=0,output[i+1]=0,output[i+2]=0,output[i+3]=0,output[i+4]=0,output[i+5]=0,output[i+6]=0,output[i+7]=0,output[i+8]=0):(p3x/=mag,p3y/=mag,p3z/=mag,output[i]=p3x,output[i+1]=p3y,output[i+2]=p3z,output[i+3]=p3x,output[i+4]=p3y,output[i+5]=p3z,output[i+6]=p3x,output[i+7]=p3y,output[i+8]=p3z)}return output}module.exports=faceNormals},{}],19:[function(require,module,exports){(function(process){function debounce(fn,now){function debounced(){null===args&&(args=slice(arguments),ctx=this,now&&fn.apply(ctx,args),raf(next))}function next(){now||fn.apply(ctx,args),args=null,ctx=null}var args=null,ctx=null;return debounced}var slice=require("sliced");if(process.browser)var raf=require("raf-component");else var raf="undefined"!=typeof setImmediate?setImmediate:process.nextTick;module.exports=debounce}).call(this,require("_process"))},{_process:113,"raf-component":91,sliced:96}],20:[function(require,module,exports){"use strict";function GLBuffer(gl,type,handle,length,usage){this.gl=gl,this.type=type,this.handle=handle,this.length=length,this.usage=usage}function updateTypeArray(gl,type,len,usage,data,offset){if(offset<=0&&data.length>len)return gl.bufferData(type,data,usage),data.length;if(data.length+offset>len)throw new Error("gl-buffer: If resizing buffer, offset must be 0");return gl.bufferSubData(type,offset,data),len}function makeScratchTypeArray(array,dtype){for(var res=pool.malloc(array.length,dtype),n=array.length,i=0;i<n;++i)res[i]=array[i];return res}function createBuffer(gl,type,data,usage){void 0===data&&(data=type,type=gl.ARRAY_BUFFER),usage||(usage=gl.DYNAMIC_DRAW);var len=0,handle=gl.createBuffer();if(gl.bindBuffer(type,handle),"number"==typeof data)gl.bufferData(type,data,usage),
len=data;else if(data instanceof Array)type===gl.ELEMENT_ARRAY_BUFFER?gl.bufferData(type,new Uint16Array(data),usage):gl.bufferData(type,new Float32Array(data),usage),len=data.length;else if(data.length)gl.bufferData(type,data,usage),len=data.length;else{if(!data.shape)throw new Error("gl-buffer: Invalid format for buffer data");var dtype=data.dtype;if("float64"!==dtype&&"array"!==dtype&&"generic"!==dtype||(dtype="float32"),type===gl.ELEMENT_ARRAY_BUFFER&&(dtype="uint16"),1!==data.shape.length)throw new Error("gl-buffer: Array shape must be 1D");var len=data.shape[0];if(dtype===data.type&&1===data.stride[0])gl.bufferData(type,data.data.subarray(data.offset,data.offset+len),usage);else{var tmp=pool.malloc(data.shape[0],dtype),ndt=ndarray(tmp);ops.assign(ndt,data),gl.bufferData(type,tmp,usage),pool.free(tmp)}}if(type!==gl.ARRAY_BUFFER&&type!==gl.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer");if(usage!==gl.DYNAMIC_DRAW&&usage!==gl.STATIC_DRAW&&usage!==gl.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer");return new GLBuffer(gl,type,handle,len,usage)}var pool=require("typedarray-pool"),ops=require("ndarray-ops"),ndarray=require("ndarray");GLBuffer.prototype.bind=function(){this.gl.bindBuffer(this.type,this.handle)},GLBuffer.prototype.dispose=function(){this.gl.deleteBuffer(this.handle)},GLBuffer.prototype.update=function(array,offset){if(offset||(offset=0),this.bind(),"number"==typeof array){if(offset>0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");this.gl.bufferData(this.type,array,this.usage),this.length=array}else if(array.shape){var dtype=array.dtype;if("float64"!==dtype&&"array"!==dtype&&"generic"!==dtype||(dtype="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER&&(dtype="uint16"),1!==array.shape.length)throw new Error("gl-buffer: Array length must be 1");if(dtype===array.dtype&&1===array.stride[0])0===array.offset&&array.data.length===array.shape[0]?this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,array.data,offset):this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,array.data.subarray(array.offset,array.shape[0]),offset);else{var tmp=pool.malloc(array.shape[0],dtype),ndt=ndarray(tmp);ops.assign(ndt,array),this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,tmp,offset),pool.free(tmp)}}else if(Array.isArray(array))if(this.type===this.gl.ELEMENT_ARRAY_BUFFER){var t=makeScratchTypeArray(array,"uint16");this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,t.subarray(0,array.length),offset),pool.freeUint16(t)}else{var t=makeScratchTypeArray(array,"float32");this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,t.subarray(0,array.length),offset),pool.freeFloat32(t)}else this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,array,offset)},GLBuffer.prototype.draw=function(mode,count,offset){offset=offset||0;var gl=this.gl;if(this.type===gl.ARRAY_BUFFER)gl.drawArrays(mode,offset,count);else{if(this.type!==gl.ELEMENT_ARRAY_BUFFER)throw new Error("Invalid type for WebGL buffer");this.bind(),gl.drawElements(mode,count,gl.UNSIGNED_SHORT,offset)}},module.exports=createBuffer},{ndarray:70,"ndarray-ops":69,"typedarray-pool":99}],21:[function(require,module,exports){function defaults(opts){return{color:array(opts.color,[0,0,0,1]),depth:number(opts.depth,1),stencil:number(opts.stencil,!1)}}function number(n,def){return!1!==n&&(void 0===n?def:n+0)}function array(a,def){return!1!==a&&(Array.isArray(a)?a||def:def)}module.exports=defaults},{}],22:[function(require,module,exports){function clear(opts){opts=defaults(opts||{});var stencil=opts.stencil,color=opts.color,depth=opts.depth;return function(gl){var flags=0;return!1!==color&&(gl.clearColor(color[0],color[1],color[2],color[3]),flags|=gl.COLOR_BUFFER_BIT),!1!==depth&&(gl.clearDepth(depth),flags|=gl.DEPTH_BUFFER_BIT),!1!==stencil&&(gl.clearStencil(stencil),flags|=gl.STENCIL_BUFFER_BIT),gl.clear(flags),gl}}var defaults=require("./defaults");module.exports=clear},{"./defaults":21}],23:[function(require,module,exports){module.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"}},{}],24:[function(require,module,exports){var gl10=require("./1.0/numbers");module.exports=function(number){return gl10[number]}},{"./1.0/numbers":23}],25:[function(require,module,exports){function createContext(canvas,opts,render){function tick(){render(gl),raf(tick)}"function"==typeof opts?(render=opts,opts={}):opts=opts||{};var gl=canvas.getContext("webgl",opts)||canvas.getContext("webgl-experimental",opts)||canvas.getContext("experimental-webgl",opts);if(!gl)throw new Error("Unable to initialize WebGL");return render&&raf(tick),gl}var raf=require("raf-component");module.exports=createContext},{"raf-component":91}],26:[function(require,module,exports){"use strict";function lazyInitColorAttachments(gl,ext){var maxColorAttachments=gl.getParameter(ext.MAX_COLOR_ATTACHMENTS_WEBGL);colorAttachmentArrays=new Array(maxColorAttachments+1);for(var i=0;i<=maxColorAttachments;++i){for(var x=new Array(maxColorAttachments),j=0;j<i;++j)x[j]=gl.COLOR_ATTACHMENT0+j;for(var j=i;j<maxColorAttachments;++j)x[j]=gl.NONE;colorAttachmentArrays[i]=x}}function throwFBOError(status){switch(status){case FRAMEBUFFER_UNSUPPORTED:throw new Error("gl-fbo: Framebuffer unsupported");case FRAMEBUFFER_INCOMPLETE_ATTACHMENT:throw new Error("gl-fbo: Framebuffer incomplete attachment");case FRAMEBUFFER_INCOMPLETE_DIMENSIONS:throw new Error("gl-fbo: Framebuffer incomplete dimensions");case FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:throw new Error("gl-fbo: Framebuffer incomplete missing attachment");default:throw new Error("gl-fbo: Framebuffer failed for unspecified reason")}}function initTexture(gl,width,height,type,format,attachment){if(!type)return null;var result=createTexture(gl,width,height,format,type);return result.magFilter=gl.NEAREST,result.minFilter=gl.NEAREST,result.mipSamples=1,gl.framebufferTexture2D(gl.FRAMEBUFFER,attachment,gl.TEXTURE_2D,result.handle,0),gl.bindTexture(gl.TEXTURE_2D,null),result}function initRenderBuffer(gl,width,height,component,attachment){var result=gl.createRenderbuffer();return gl.bindRenderbuffer(gl.RENDERBUFFER,result),gl.renderbufferStorage(gl.RENDERBUFFER,component,width,height),gl.framebufferRenderbuffer(gl.FRAMEBUFFER,attachment,gl.RENDERBUFFER,result),result}function rebuildFBO(fbo){var gl=fbo.gl,handle=fbo.handle=gl.createFramebuffer(),height=fbo._shape[0],width=fbo._shape[1],numColors=fbo.color.length,ext=fbo._ext,useStencil=fbo._useStencil,useDepth=fbo._useDepth,colorType=fbo._colorType,extensions=webglew(gl);gl.bindFramebuffer(gl.FRAMEBUFFER,handle);for(var i=0;i<numColors;++i)fbo.color[i]=initTexture(gl,width,height,colorType,gl.RGBA,gl.COLOR_ATTACHMENT0+i);0===numColors?(fbo._color_rb=initRenderBuffer(gl,width,height,gl.RGBA4,gl.COLOR_ATTACHMENT0),ext&&ext.drawBuffersWEBGL(colorAttachmentArrays[0])):numColors>1&&ext.drawBuffersWEBGL(colorAttachmentArrays[numColor]),extensions.WEBGL_depth_texture?useStencil?fbo.depth=initTexture(gl,width,height,extensions.WEBGL_depth_texture.UNSIGNED_INT_24_8_WEBGL,gl.DEPTH_STENCIL,gl.DEPTH_STENCIL_ATTACHMENT):useDepth&&(fbo.depth=initTexture(gl,width,height,gl.UNSIGNED_SHORT,gl.DEPTH_COMPONENT,gl.DEPTH_ATTACHMENT)):useDepth&&useStencil?fbo._depth_rb=initRenderBuffer(gl,width,height,gl.DEPTH_STENCIL,gl.DEPTH_STENCIL_ATTACHMENT):useDepth?fbo._depth_rb=initRenderBuffer(gl,width,height,gl.DEPTH_COMPONENT16,gl.DEPTH_ATTACHMENT):useStencil&&(fbo._depth_rb=initRenderBuffer(gl,width,height,gl.STENCIL_INDEX,gl.STENCIL_ATTACHMENT));var status=gl.checkFramebufferStatus(gl.FRAMEBUFFER);if(status!==gl.FRAMEBUFFER_COMPLETE){fbo._destroyed=!0,gl.bindFramebuffer(gl.FRAMEBUFFER,null),gl.deleteFramebuffer(fbo.handle),fbo.handle=null,fbo.depth&&(fbo.depth.dispose(),fbo.depth=null),fbo._depth_rb&&(gl.deleteRenderbuffer(fbo._depth_rb),fbo._depth_rb=null);for(var i=0;i<fbo.color.length;++i)fbo.color[i].dispose(),fbo.color[i]=null;fbo._color_rb&&(gl.deleteRenderbuffer(fbo._color_rb),fbo._color_rb=null),throwFBOError(status)}gl.bindFramebuffer(gl.FRAMEBUFFER,null)}function Framebuffer(gl,width,height,colorType,numColors,useDepth,useStencil,ext){webglew(gl);this.gl=gl,this._shape=[0|height,0|width],this._destroyed=!1,this._ext=ext,this.color=new Array(numColors),this._color_rb=null,this.depth=null,this._depth_rb=null,this._colorType=colorType,this._useDepth=useDepth,this._useStencil=useStencil,rebuildFBO(this)}function createFBO(gl,width,height,options){FRAMEBUFFER_UNSUPPORTED||(FRAMEBUFFER_UNSUPPORTED=gl.FRAMEBUFFER_UNSUPPORTED,FRAMEBUFFER_INCOMPLETE_ATTACHMENT=gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT,FRAMEBUFFER_INCOMPLETE_DIMENSIONS=gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);var extensions=webglew(gl);if(!colorAttachmentArrays&&extensions.WEBGL_draw_buffers&&lazyInitColorAttachments(gl,extensions.WEBGL_draw_buffers),Array.isArray(width)&&(options=height,height=0|width[0],width=0|width[1]),"number"!=typeof width)throw new Error("gl-fbo: Missing shape parameter");var maxFBOSize=gl.getParameter(gl.MAX_RENDERBUFFER_SIZE);if(width<0||width>maxFBOSize||height<0||height>maxFBOSize)throw new Error("gl-fbo: Parameters are too large for FBO");options=options||{};var numColors=1;if("color"in options){if((numColors=Math.max(0|options.color,0))<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(numColors>1){var mrtext=extensions.WEBGL_draw_buffers;if(!mrtext)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(numColors>gl.getParameter(mrtext.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+numColors+" draw buffers")}}var colorType=gl.UNSIGNED_BYTE;if(options.float&&numColors>0){if(!extensions.OES_texture_float)throw new Error("gl-fbo: Context does not support floating point textures");colorType=gl.FLOAT}else options.preferFloat&&numColors>0&&extensions.OES_texture_float&&(colorType=gl.FLOAT);var useDepth=!0;"depth"in options&&(useDepth=!!options.depth);var useStencil=!1;return"stencil"in options&&(useStencil=!!options.stencil),new Framebuffer(gl,width,height,colorType,numColors,useDepth,useStencil,extensions.WEBGL_draw_buffers)}var webglew=require("webglew"),createTexture=require("gl-texture2d");module.exports=createFBO;var FRAMEBUFFER_UNSUPPORTED,FRAMEBUFFER_INCOMPLETE_ATTACHMENT,FRAMEBUFFER_INCOMPLETE_DIMENSIONS,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT,colorAttachmentArrays=null,proto=Framebuffer.prototype;Object.defineProperty(proto,"valid",{get:function(){return!this._destroyed}}),Object.defineProperty(proto,"shape",{get:function(){return this._destroyed?[0,0]:this._shape},set:function(x){if(this._destroyed)throw new Error("gl-fbo: Can't resize destroyed FBO");if(!(this._shape[0]===x[0]|0&&this._shape[1]===x[1]|0)){var gl=this.gl,maxFBOSize=gl.getParameter(gl.MAX_RENDERBUFFER_SIZE);if(!Array.isArray(x)||2!==x.length||x[0]<0||x[0]>maxFBOSize||x[1]<0||x[1]>maxFBOSize)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");this._shape[0]=0|x[0],this._shape[1]=0|x[1];for(var i=0;i<this.color.length;++i)this.color[i].shape=this._shape;this._color_rb&&(gl.bindRenderbuffer(gl.RENDERBUFFER,this._color_rb),gl.renderbufferStorage(gl.RENDERBUFFER,gl.RGBA4,this._shape[1],this._shape[0])),this.depth&&(this.depth.shape=this._shape),this._depth_rb&&(gl.bindRenderbuffer(gl.RENDERBUFFER,this._depth_rb),this._useDepth&&this._useStencil?gl.renderbufferStorage(gl.RENDERBUFFER,gl.DEPTH_STENCIL,this._shape[1],this._shape[0]):this._useDepth?gl.renderbufferStorage(gl.RENDERBUFFER,gl.DEPTH_COMPONENT16,this._shape[1],this._shape[0]):this._useStencil&&gl.renderbufferStorage(gl.RENDERBUFFER,gl.STENCIL_INDEX,this._shape[1],this._shape[0])),gl.bindFramebuffer(gl.FRAMEBUFFER,this.handle);var status=gl.checkFramebufferStatus(gl.FRAMEBUFFER);return status!==gl.FRAMEBUFFER_COMPLETE&&(this.dispose(),throwFBOError(status)),gl.bindFramebuffer(gl.FRAMEBUFFER,null),x}}}),proto.bind=function(){if(!this._destroyed){var gl=this.gl;gl.bindFramebuffer(gl.FRAMEBUFFER,this.handle),gl.viewport(0,0,this._shape[1],this._shape[0])}},proto.dispose=function(){if(!this._destroyed){this._destroyed=!0;var gl=this.gl;gl.deleteFramebuffer(this.handle),this.handle=null,this.depth&&(this.depth.dispose(),this.depth=null),this._depth_rb&&(gl.deleteRenderbuffer(this._depth_rb),this._depth_rb=null);for(var i=0;i<this.color.length;++i)this.color[i].dispose(),this.color[i]=null;this._color_rb&&(gl.deleteRenderbuffer(this._color_rb),this._color_rb=null)}}},{"gl-texture2d":51,webglew:27}],27:[function(require,module,exports){"use strict";function baseName(ext_name){return ext_name.replace(/^[A-Z]+_/,"")}function initWebGLEW(gl){var struct=WebGLEWStruct.get(gl);if(struct)return struct;for(var extensions={},supported=gl.getSupportedExtensions(),i=0;i<supported.length;++i){var extName=supported[i];if(0!==extName.indexOf("MOZ_")){var ext=gl.getExtension(supported[i]);if(ext)for(;;){extensions[extName]=ext;var base=baseName(extName);if(base===extName)break;extName=base}}}return WebGLEWStruct.set(gl,extensions),extensions}var weakMap="undefined"==typeof WeakMap?require("weak-map"):WeakMap,WebGLEWStruct=new weakMap;module.exports=initWebGLEW},{"weak-map":102}],28:[function(require,module,exports){function formatCompilerError(errLog,src,type){"use strict";var name=shaderName(src)||"of unknown name (see npm glsl-shader-name)",typeName="unknown type";void 0!==type&&(typeName=type===glConstants.FRAGMENT_SHADER?"fragment":"vertex");for(var longForm=sprintf("Error compiling %s shader %s:\n",typeName,name),shortForm=sprintf("%s%s",longForm,errLog),errorStrings=errLog.split("\n"),errors={},i=0;i<errorStrings.length;i++){var errorString=errorStrings[i];if(""!==errorString&&"\0"!==errorString){var lineNo=parseInt(errorString.split(":")[2]);if(isNaN(lineNo))throw new Error(sprintf("Could not parse error: %s",errorString));errors[lineNo]=errorString}}for(var lines=addLineNumbers(src).split("\n"),i=0;i<lines.length;i++)if(errors[i+3]||errors[i+2]||errors[i+1]){var line=lines[i];if(longForm+=line+"\n",errors[i+1]){var e=errors[i+1];e=e.substr(e.split(":",3).join(":").length+1).trim(),longForm+=sprintf("^^^ %s\n\n",e)}}return{long:longForm.trim(),short:shortForm.trim()}}var sprintf=require("sprintf-js").sprintf,glConstants=require("gl-constants/lookup"),shaderName=require("glsl-shader-name"),addLineNumbers=require("add-line-numbers");module.exports=formatCompilerError},{"add-line-numbers":4,"gl-constants/lookup":24,"glsl-shader-name":56,"sprintf-js":98}],29:[function(require,module,exports){function GLGeometry(gl){if(!(this instanceof GLGeometry))return new GLGeometry(gl);this._attributes=[],this._dirty=!0,this._length=0,this._index=null,this._vao=null,this._keys=[],this.gl=gl}var normalize=require("./normalize"),createVAO=require("gl-vao");module.exports=GLGeometry,GLGeometry.prototype.faces=function(attr,opts){var size=opts&&opts.size||3;return attr=attr.cells?attr.cells:attr,this._dirty=!0,this._index=normalize(this.gl,attr,size,this.gl.ELEMENT_ARRAY_BUFFER,"uint16"),this._length=this._index.length*size,this._index=this._index.buffer,this},GLGeometry.prototype.attr=function(name,attr,opts){opts=opts||{},this._dirty=!0;var gl=this.gl,first=!this._attributes.length,size=opts.size||3,attribute=normalize(gl,attr,size);if(!attribute)throw new Error("Unexpected attribute format: needs an ndarray, array, typed array, gl-buffer or simplicial complex");var buffer=attribute.buffer,length=attribute.length,index=attribute.index;return this._keys.push(name),this._attributes.push({size:size,buffer:buffer}),first&&(this._length=length),first&&index&&(this._index=index),this},GLGeometry.prototype.bind=function(shader){if(this.update(),this._vao.bind(),shader&&(shader.bind(),this._keys))for(var i=0;i<this._keys.length;i++){var attr=shader.attributes[this._keys[i]];attr&&(attr.location=i)}},GLGeometry.prototype.draw=function(mode){this.update(),this._vao.draw(mode||this.gl.TRIANGLES,this._length)},GLGeometry.prototype.unbind=function(){this.update(),this._vao.unbind()},GLGeometry.prototype.update=function(){this._dirty&&(this._dirty=!1,this._vao&&this._vao.dispose(),this._vao=createVAO(this.gl,this._attributes,this._index))}},{"./normalize":38,"gl-vao":36}],30:[function(require,module,exports){arguments[4][8][0].apply(exports,arguments)},{dup:8}],31:[function(require,module,exports){arguments[4][16][0].apply(exports,arguments)},{dup:16}],32:[function(require,module,exports){"use strict";function GLBuffer(gl,type,handle,length,usage){this.gl=gl,this.type=type,this.handle=handle,this.length=length,this.usage=usage}function updateTypeArray(gl,type,len,usage,data,offset){var dataLen=data.length*data.BYTES_PER_ELEMENT;if(offset<0)return gl.bufferData(type,data,usage),dataLen;if(dataLen+offset>len)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return gl.bufferSubData(type,offset,data),len}function makeScratchTypeArray(array,dtype){for(var res=pool.malloc(array.length,dtype),n=array.length,i=0;i<n;++i)res[i]=array[i];return res}function isPacked(shape,stride){for(var n=1,i=stride.length-1;i>=0;--i){if(stride[i]!==n)return!1;n*=shape[i]}return!0}function createBuffer(gl,data,type,usage){if(type=type||gl.ARRAY_BUFFER,usage=usage||gl.DYNAMIC_DRAW,type!==gl.ARRAY_BUFFER&&type!==gl.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(usage!==gl.DYNAMIC_DRAW&&usage!==gl.STATIC_DRAW&&usage!==gl.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var handle=gl.createBuffer(),result=new GLBuffer(gl,type,handle,0,usage);return result.update(data),result}var pool=require("typedarray-pool"),ops=require("ndarray-ops"),ndarray=require("ndarray"),SUPPORTED_TYPES=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"],proto=GLBuffer.prototype;proto.bind=function(){this.gl.bindBuffer(this.type,this.handle)},proto.unbind=function(){this.gl.bindBuffer(this.type,null)},proto.dispose=function(){this.gl.deleteBuffer(this.handle)},proto.update=function(array,offset){if("number"!=typeof offset&&(offset=-1),this.bind(),"object"==typeof array&&void 0!==array.shape){var dtype=array.dtype;if(SUPPORTED_TYPES.indexOf(dtype)<0&&(dtype="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){dtype=gl.getExtension("OES_element_index_uint")&&"uint16"!==dtype?"uint32":"uint16"}if(dtype===array.dtype&&isPacked(array.shape,array.stride))0===array.offset&&array.data.length===array.shape[0]?this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,array.data,offset):this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,array.data.subarray(array.offset,array.shape[0]),offset);else{var tmp=pool.malloc(array.size,dtype),ndt=ndarray(tmp,array.shape);ops.assign(ndt,array),this.length=offset<0?updateTypeArray(this.gl,this.type,this.length,this.usage,tmp,offset):updateTypeArray(this.gl,this.type,this.length,this.usage,tmp.subarray(0,array.size),offset),pool.free(tmp)}}else if(Array.isArray(array)){var t;t=this.type===this.gl.ELEMENT_ARRAY_BUFFER?makeScratchTypeArray(array,"uint16"):makeScratchTypeArray(array,"float32"),this.length=offset<0?updateTypeArray(this.gl,this.type,this.length,this.usage,t,offset):updateTypeArray(this.gl,this.type,this.length,this.usage,t.subarray(0,array.length),offset),pool.free(t)}else if("object"==typeof array&&"number"==typeof array.length)this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,array,offset);else{if("number"!=typeof array&&void 0!==array)throw new Error("gl-buffer: Invalid data type");if(offset>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");array|=0,array<=0&&(array=1),this.gl.bufferData(this.type,0|array,this.usage),this.length=array}},module.exports=createBuffer},{ndarray:70,"ndarray-ops":69,"typedarray-pool":37}],33:[function(require,module,exports){"use strict";function doBind(gl,elements,attributes){elements?elements.bind():gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,null);var nattribs=0|gl.getParameter(gl.MAX_VERTEX_ATTRIBS);if(attributes){if(attributes.length>nattribs)throw new Error("gl-vao: Too many vertex attributes");for(var i=0;i<attributes.length;++i){var attrib=attributes[i];if(attrib.buffer){var buffer=attrib.buffer,size=attrib.size||4,type=attrib.type||gl.FLOAT,normalized=!!attrib.normalized,stride=attrib.stride||0,offset=attrib.offset||0;buffer.bind(),gl.enableVertexAttribArray(i),gl.vertexAttribPointer(i,size,type,normalized,stride,offset)}else{if("number"==typeof attrib)gl.vertexAttrib1f(i,attrib);else if(1===attrib.length)gl.vertexAttrib1f(i,attrib[0]);else if(2===attrib.length)gl.vertexAttrib2f(i,attrib[0],attrib[1]);else if(3===attrib.length)gl.vertexAttrib3f(i,attrib[0],attrib[1],attrib[2]);else{if(4!==attrib.length)throw new Error("gl-vao: Invalid vertex attribute");gl.vertexAttrib4f(i,attrib[0],attrib[1],attrib[2],attrib[3])}gl.disableVertexAttribArray(i)}}for(;i<nattribs;++i)gl.disableVertexAttribArray(i)}else{gl.bindBuffer(gl.ARRAY_BUFFER,null);for(var i=0;i<nattribs;++i)gl.disableVertexAttribArray(i)}}module.exports=doBind},{}],34:[function(require,module,exports){"use strict";function VAOEmulated(gl){this.gl=gl,this._elements=null,this._attributes=null,this._elementsType=gl.UNSIGNED_SHORT}function createVAOEmulated(gl){return new VAOEmulated(gl)}var bindAttribs=require("./do-bind.js");VAOEmulated.prototype.bind=function(){bindAttribs(this.gl,this._elements,this._attributes)},VAOEmulated.prototype.update=function(attributes,elements,elementsType){this._elements=elements,this._attributes=attributes,this._elementsType=elementsType||this.gl.UNSIGNED_SHORT},VAOEmulated.prototype.dispose=function(){},VAOEmulated.prototype.unbind=function(){},VAOEmulated.prototype.draw=function(mode,count,offset){offset=offset||0;var gl=this.gl;this._elements?gl.drawElements(mode,count,this._elementsType,offset):gl.drawArrays(mode,offset,count)},module.exports=createVAOEmulated},{"./do-bind.js":33}],35:[function(require,module,exports){"use strict";function VertexAttribute(location,dimension,a,b,c,d){this.location=location,this.dimension=dimension,this.a=a,this.b=b,this.c=c,this.d=d}function VAONative(gl,ext,handle){this.gl=gl,this._ext=ext,this.handle=handle,this._attribs=[],this._useElements=!1,this._elementsType=gl.UNSIGNED_SHORT}function createVAONative(gl,ext){return new VAONative(gl,ext,ext.createVertexArrayOES())}var bindAttribs=require("./do-bind.js");VertexAttribute.prototype.bind=function(gl){switch(this.dimension){case 1:gl.vertexAttrib1f(this.location,this.a);break;case 2:gl.vertexAttrib2f(this.location,this.a,this.b);break;case 3:gl.vertexAttrib3f(this.location,this.a,this.b,this.c);break;case 4:gl.vertexAttrib4f(this.location,this.a,this.b,this.c,this.d)}},VAONative.prototype.bind=function(){this._ext.bindVertexArrayOES(this.handle);for(var i=0;i<this._attribs.length;++i)this._attribs[i].bind(this.gl)},VAONative.prototype.unbind=function(){this._ext.bindVertexArrayOES(null)},VAONative.prototype.dispose=function(){this._ext.deleteVertexArrayOES(this.handle)},VAONative.prototype.update=function(attributes,elements,elementsType){if(this.bind(),bindAttribs(this.gl,elements,attributes),this.unbind(),this._attribs.length=0,attributes)for(var i=0;i<attributes.length;++i){var a=attributes[i];"number"==typeof a?this._attribs.push(new VertexAttribute(i,1,a)):Array.isArray(a)&&this._attribs.push(new VertexAttribute(i,a.length,a[0],a[1],a[2],a[3]))}this._useElements=!!elements,this._elementsType=elementsType||this.gl.UNSIGNED_SHORT},VAONative.prototype.draw=function(mode,count,offset){offset=offset||0;var gl=this.gl;this._useElements?gl.drawElements(mode,count,this._elementsType,offset):gl.drawArrays(mode,offset,count)},module.exports=createVAONative},{"./do-bind.js":33}],36:[function(require,module,exports){"use strict";function ExtensionShim(gl){this.bindVertexArrayOES=gl.bindVertexArray.bind(gl),this.createVertexArrayOES=gl.createVertexArray.bind(gl),this.deleteVertexArrayOES=gl.deleteVertexArray.bind(gl)}function createVAO(gl,attributes,elements,elementsType){var vao,ext=gl.createVertexArray?new ExtensionShim(gl):gl.getExtension("OES_vertex_array_object");return vao=ext?createVAONative(gl,ext):createVAOEmulated(gl),vao.update(attributes,elements,elementsType),vao}var createVAONative=require("./lib/vao-native.js"),createVAOEmulated=require("./lib/vao-emulated.js");module.exports=createVAO},{"./lib/vao-emulated.js":34,"./lib/vao-native.js":35}],37:[function(require,module,exports){(function(global){"use strict";function freeArrayBuffer(buffer){if(buffer){var n=buffer.length||buffer.byteLength,log_n=bits.log2(n);DATA[log_n].push(buffer)}}function freeTypedArray(array){freeArrayBuffer(array.buffer)}function mallocArrayBuffer(n){var n=bits.nextPow2(n),log_n=bits.log2(n),d=DATA[log_n];return d.length>0?d.pop():new ArrayBuffer(n)}function mallocUint8(n){return new Uint8Array(mallocArrayBuffer(n),0,n)}
function mallocUint16(n){return new Uint16Array(mallocArrayBuffer(2*n),0,n)}function mallocUint32(n){return new Uint32Array(mallocArrayBuffer(4*n),0,n)}function mallocInt8(n){return new Int8Array(mallocArrayBuffer(n),0,n)}function mallocInt16(n){return new Int16Array(mallocArrayBuffer(2*n),0,n)}function mallocInt32(n){return new Int32Array(mallocArrayBuffer(4*n),0,n)}function mallocFloat(n){return new Float32Array(mallocArrayBuffer(4*n),0,n)}function mallocDouble(n){return new Float64Array(mallocArrayBuffer(8*n),0,n)}function mallocUint8Clamped(n){return hasUint8C?new Uint8ClampedArray(mallocArrayBuffer(n),0,n):mallocUint8(n)}function mallocBigUint64(n){return hasBigUint64?new BigUint64Array(mallocArrayBuffer(8*n),0,n):null}function mallocBigInt64(n){return hasBigInt64?new BigInt64Array(mallocArrayBuffer(8*n),0,n):null}function mallocDataView(n){return new DataView(mallocArrayBuffer(n),0,n)}function mallocBuffer(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=BUFFER[log_n];return cache.length>0?cache.pop():new Buffer(n)}var bits=require("bit-twiddle"),dup=require("dup"),Buffer=require("buffer").Buffer;global.__TYPEDARRAY_POOL||(global.__TYPEDARRAY_POOL={UINT8:dup([32,0]),UINT16:dup([32,0]),UINT32:dup([32,0]),BIGUINT64:dup([32,0]),INT8:dup([32,0]),INT16:dup([32,0]),INT32:dup([32,0]),BIGINT64:dup([32,0]),FLOAT:dup([32,0]),DOUBLE:dup([32,0]),DATA:dup([32,0]),UINT8C:dup([32,0]),BUFFER:dup([32,0])});var hasUint8C="undefined"!=typeof Uint8ClampedArray,hasBigUint64="undefined"!=typeof BigUint64Array,hasBigInt64="undefined"!=typeof BigInt64Array,POOL=global.__TYPEDARRAY_POOL;POOL.UINT8C||(POOL.UINT8C=dup([32,0])),POOL.BIGUINT64||(POOL.BIGUINT64=dup([32,0])),POOL.BIGINT64||(POOL.BIGINT64=dup([32,0])),POOL.BUFFER||(POOL.BUFFER=dup([32,0]));var DATA=POOL.DATA,BUFFER=POOL.BUFFER;exports.free=function(array){if(Buffer.isBuffer(array))BUFFER[bits.log2(array.length)].push(array);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(array)&&(array=array.buffer),!array)return;var n=array.length||array.byteLength,log_n=0|bits.log2(n);DATA[log_n].push(array)}},exports.freeUint8=exports.freeUint16=exports.freeUint32=exports.freeBigUint64=exports.freeInt8=exports.freeInt16=exports.freeInt32=exports.freeBigInt64=exports.freeFloat32=exports.freeFloat=exports.freeFloat64=exports.freeDouble=exports.freeUint8Clamped=exports.freeDataView=freeTypedArray,exports.freeArrayBuffer=freeArrayBuffer,exports.freeBuffer=function(array){BUFFER[bits.log2(array.length)].push(array)},exports.malloc=function(n,dtype){if(void 0===dtype||"arraybuffer"===dtype)return mallocArrayBuffer(n);switch(dtype){case"uint8":return mallocUint8(n);case"uint16":return mallocUint16(n);case"uint32":return mallocUint32(n);case"int8":return mallocInt8(n);case"int16":return mallocInt16(n);case"int32":return mallocInt32(n);case"float":case"float32":return mallocFloat(n);case"double":case"float64":return mallocDouble(n);case"uint8_clamped":return mallocUint8Clamped(n);case"bigint64":return mallocBigInt64(n);case"biguint64":return mallocBigUint64(n);case"buffer":return mallocBuffer(n);case"data":case"dataview":return mallocDataView(n);default:return null}return null},exports.mallocArrayBuffer=mallocArrayBuffer,exports.mallocUint8=mallocUint8,exports.mallocUint16=mallocUint16,exports.mallocUint32=mallocUint32,exports.mallocInt8=mallocInt8,exports.mallocInt16=mallocInt16,exports.mallocInt32=mallocInt32,exports.mallocFloat32=exports.mallocFloat=mallocFloat,exports.mallocFloat64=exports.mallocDouble=mallocDouble,exports.mallocUint8Clamped=mallocUint8Clamped,exports.mallocBigUint64=mallocBigUint64,exports.mallocBigInt64=mallocBigInt64,exports.mallocDataView=mallocDataView,exports.mallocBuffer=mallocBuffer,exports.clearCache=function(){for(var i=0;i<32;++i)POOL.UINT8[i].length=0,POOL.UINT16[i].length=0,POOL.UINT32[i].length=0,POOL.INT8[i].length=0,POOL.INT16[i].length=0,POOL.INT32[i].length=0,POOL.FLOAT[i].length=0,POOL.DOUBLE[i].length=0,POOL.BIGUINT64[i].length=0,POOL.BIGINT64[i].length=0,POOL.UINT8C[i].length=0,DATA[i].length=0,BUFFER[i].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"bit-twiddle":30,buffer:108,dup:31}],38:[function(require,module,exports){function normalize(gl,attr,size,mode,type){return Array.isArray(attr)&&Array.isArray(attr[0])?{buffer:createBuffer(gl,pack(attr,type),mode),length:attr.length}:Array.isArray(attr)?{buffer:createBuffer(gl,new(dtype(type))(attr),mode),length:attr.length/size}:attr.handle instanceof WebGLBuffer?{buffer:attr,length:attr.length/size/4}:attr.cells&&attr.positions?{length:attr.cells.length*size,buffer:createBuffer(gl,pack(attr.positions,type),mode),index:createBuffer(gl,pack(attr.cells,"uint16"),gl.ELEMENT_ARRAY_BUFFER)}:isnd(attr)?{buffer:createBuffer(gl,attr,mode),length:ndlength(attr.shape)/size}:ista(attr)?(!type||attr instanceof dtype(type)||(attr=convert(attr,dtype(type))),{buffer:createBuffer(gl,attr,mode),length:attr.length/size}):void 0}function ndlength(shape){for(var length=1,i=0;i<shape.length;i++)length*=shape[i];return length}function convert(a,b){b=new b(a.length);for(var i=0;i<a.length;i++)b[i]=a[i];return b}var pack=require("array-pack-2d"),ista=require("is-typedarray"),createBuffer=require("gl-buffer"),isnd=require("isndarray"),dtype=require("dtype");module.exports=normalize},{"array-pack-2d":5,dtype:15,"gl-buffer":32,"is-typedarray":66,isndarray:67}],39:[function(require,module,exports){!function(t,n){if("object"==typeof exports&&"object"==typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var r=n();for(var a in r)("object"==typeof exports?exports:t)[a]=r[a]}}("undefined"!=typeof self?self:this,function(){return function(t){function r(a){if(n[a])return n[a].exports;var e=n[a]={i:a,l:!1,exports:{}};return t[a].call(e.exports,e,e.exports,r),e.l=!0,e.exports}var n={};return r.m=t,r.c=n,r.d=function(t,n,a){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:a})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var e in t)r.d(a,e,function(n){return t[n]}.bind(null,e));return a},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=10)}([function(t,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.setMatrixArrayType=function(t){n.ARRAY_TYPE=t},n.toRadian=function(t){return t*e},n.equals=function(t,n){return Math.abs(t-n)<=a*Math.max(1,Math.abs(t),Math.abs(n))};var a=n.EPSILON=1e-6;n.ARRAY_TYPE="undefined"!=typeof Float32Array?Float32Array:Array,n.RANDOM=Math.random;var e=Math.PI/180},function(t,n,r){"use strict";function e(){var t=new a.ARRAY_TYPE(4);return a.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function u(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t[3]=n[3]-r[3],t}function o(t,n,r){return t[0]=n[0]*r[0],t[1]=n[1]*r[1],t[2]=n[2]*r[2],t[3]=n[3]*r[3],t}function i(t,n,r){return t[0]=n[0]/r[0],t[1]=n[1]/r[1],t[2]=n[2]/r[2],t[3]=n[3]/r[3],t}function s(t,n){var r=n[0]-t[0],a=n[1]-t[1],e=n[2]-t[2],u=n[3]-t[3];return Math.sqrt(r*r+a*a+e*e+u*u)}function c(t,n){var r=n[0]-t[0],a=n[1]-t[1],e=n[2]-t[2],u=n[3]-t[3];return r*r+a*a+e*e+u*u}function f(t){var n=t[0],r=t[1],a=t[2],e=t[3];return Math.sqrt(n*n+r*r+a*a+e*e)}function M(t){var n=t[0],r=t[1],a=t[2],e=t[3];return n*n+r*r+a*a+e*e}Object.defineProperty(n,"__esModule",{value:!0}),n.forEach=n.sqrLen=n.len=n.sqrDist=n.dist=n.div=n.mul=n.sub=void 0,n.create=e,n.clone=function(t){var n=new a.ARRAY_TYPE(4);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n},n.fromValues=function(t,n,r,e){var u=new a.ARRAY_TYPE(4);return u[0]=t,u[1]=n,u[2]=r,u[3]=e,u},n.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t},n.set=function(t,n,r,a,e){return t[0]=n,t[1]=r,t[2]=a,t[3]=e,t},n.add=function(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2],t[3]=n[3]+r[3],t},n.subtract=u,n.multiply=o,n.divide=i,n.ceil=function(t,n){return t[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t[2]=Math.ceil(n[2]),t[3]=Math.ceil(n[3]),t},n.floor=function(t,n){return t[0]=Math.floor(n[0]),t[1]=Math.floor(n[1]),t[2]=Math.floor(n[2]),t[3]=Math.floor(n[3]),t},n.min=function(t,n,r){return t[0]=Math.min(n[0],r[0]),t[1]=Math.min(n[1],r[1]),t[2]=Math.min(n[2],r[2]),t[3]=Math.min(n[3],r[3]),t},n.max=function(t,n,r){return t[0]=Math.max(n[0],r[0]),t[1]=Math.max(n[1],r[1]),t[2]=Math.max(n[2],r[2]),t[3]=Math.max(n[3],r[3]),t},n.round=function(t,n){return t[0]=Math.round(n[0]),t[1]=Math.round(n[1]),t[2]=Math.round(n[2]),t[3]=Math.round(n[3]),t},n.scale=function(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=n[3]*r,t},n.scaleAndAdd=function(t,n,r,a){return t[0]=n[0]+r[0]*a,t[1]=n[1]+r[1]*a,t[2]=n[2]+r[2]*a,t[3]=n[3]+r[3]*a,t},n.distance=s,n.squaredDistance=c,n.length=f,n.squaredLength=M,n.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=-n[3],t},n.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t[3]=1/n[3],t},n.normalize=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=r*r+a*a+e*e+u*u;return o>0&&(o=1/Math.sqrt(o),t[0]=r*o,t[1]=a*o,t[2]=e*o,t[3]=u*o),t},n.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]*n[3]},n.lerp=function(t,n,r,a){var e=n[0],u=n[1],o=n[2],i=n[3];return t[0]=e+a*(r[0]-e),t[1]=u+a*(r[1]-u),t[2]=o+a*(r[2]-o),t[3]=i+a*(r[3]-i),t},n.random=function(t,n){var r,e,u,o,i,s;n=n||1;do{r=2*a.RANDOM()-1,e=2*a.RANDOM()-1,i=r*r+e*e}while(i>=1);do{u=2*a.RANDOM()-1,o=2*a.RANDOM()-1,s=u*u+o*o}while(s>=1);var c=Math.sqrt((1-i)/s);return t[0]=n*r,t[1]=n*e,t[2]=n*u*c,t[3]=n*o*c,t},n.transformMat4=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3];return t[0]=r[0]*a+r[4]*e+r[8]*u+r[12]*o,t[1]=r[1]*a+r[5]*e+r[9]*u+r[13]*o,t[2]=r[2]*a+r[6]*e+r[10]*u+r[14]*o,t[3]=r[3]*a+r[7]*e+r[11]*u+r[15]*o,t},n.transformQuat=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=r[0],i=r[1],s=r[2],c=r[3],f=c*a+i*u-s*e,M=c*e+s*a-o*u,h=c*u+o*e-i*a,l=-o*a-i*e-s*u;return t[0]=f*c+l*-o+M*-s-h*-i,t[1]=M*c+l*-i+h*-o-f*-s,t[2]=h*c+l*-s+f*-i-M*-o,t[3]=n[3],t},n.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},n.exactEquals=function(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]},n.equals=function(t,n){var r=t[0],e=t[1],u=t[2],o=t[3],i=n[0],s=n[1],c=n[2],f=n[3];return Math.abs(r-i)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(e-s)<=a.EPSILON*Math.max(1,Math.abs(e),Math.abs(s))&&Math.abs(u-c)<=a.EPSILON*Math.max(1,Math.abs(u),Math.abs(c))&&Math.abs(o-f)<=a.EPSILON*Math.max(1,Math.abs(o),Math.abs(f))};var a=function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}(r(0));n.sub=u,n.mul=o,n.div=i,n.dist=s,n.sqrDist=c,n.len=f,n.sqrLen=M,n.forEach=function(){var t=e();return function(n,r,a,e,u,o){var i=void 0,s=void 0;for(r||(r=4),a||(a=0),s=e?Math.min(e*r+a,n.length):n.length,i=a;i<s;i+=r)t[0]=n[i],t[1]=n[i+1],t[2]=n[i+2],t[3]=n[i+3],u(t,t,o),n[i]=t[0],n[i+1]=t[1],n[i+2]=t[2],n[i+3]=t[3];return n}}()},function(t,n,r){"use strict";function e(){var t=new a.ARRAY_TYPE(3);return a.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function u(t){var n=t[0],r=t[1],a=t[2];return Math.sqrt(n*n+r*r+a*a)}function o(t,n,r){var e=new a.ARRAY_TYPE(3);return e[0]=t,e[1]=n,e[2]=r,e}function i(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t}function s(t,n,r){return t[0]=n[0]*r[0],t[1]=n[1]*r[1],t[2]=n[2]*r[2],t}function c(t,n,r){return t[0]=n[0]/r[0],t[1]=n[1]/r[1],t[2]=n[2]/r[2],t}function f(t,n){var r=n[0]-t[0],a=n[1]-t[1],e=n[2]-t[2];return Math.sqrt(r*r+a*a+e*e)}function M(t,n){var r=n[0]-t[0],a=n[1]-t[1],e=n[2]-t[2];return r*r+a*a+e*e}function h(t){var n=t[0],r=t[1],a=t[2];return n*n+r*r+a*a}function l(t,n){var r=n[0],a=n[1],e=n[2],u=r*r+a*a+e*e;return u>0&&(u=1/Math.sqrt(u),t[0]=n[0]*u,t[1]=n[1]*u,t[2]=n[2]*u),t}function v(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}Object.defineProperty(n,"__esModule",{value:!0}),n.forEach=n.sqrLen=n.len=n.sqrDist=n.dist=n.div=n.mul=n.sub=void 0,n.create=e,n.clone=function(t){var n=new a.ARRAY_TYPE(3);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n},n.length=u,n.fromValues=o,n.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t},n.set=function(t,n,r,a){return t[0]=n,t[1]=r,t[2]=a,t},n.add=function(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2],t},n.subtract=i,n.multiply=s,n.divide=c,n.ceil=function(t,n){return t[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t[2]=Math.ceil(n[2]),t},n.floor=function(t,n){return t[0]=Math.floor(n[0]),t[1]=Math.floor(n[1]),t[2]=Math.floor(n[2]),t},n.min=function(t,n,r){return t[0]=Math.min(n[0],r[0]),t[1]=Math.min(n[1],r[1]),t[2]=Math.min(n[2],r[2]),t},n.max=function(t,n,r){return t[0]=Math.max(n[0],r[0]),t[1]=Math.max(n[1],r[1]),t[2]=Math.max(n[2],r[2]),t},n.round=function(t,n){return t[0]=Math.round(n[0]),t[1]=Math.round(n[1]),t[2]=Math.round(n[2]),t},n.scale=function(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t},n.scaleAndAdd=function(t,n,r,a){return t[0]=n[0]+r[0]*a,t[1]=n[1]+r[1]*a,t[2]=n[2]+r[2]*a,t},n.distance=f,n.squaredDistance=M,n.squaredLength=h,n.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t},n.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t},n.normalize=l,n.dot=v,n.cross=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=r[0],i=r[1],s=r[2];return t[0]=e*s-u*i,t[1]=u*o-a*s,t[2]=a*i-e*o,t},n.lerp=function(t,n,r,a){var e=n[0],u=n[1],o=n[2];return t[0]=e+a*(r[0]-e),t[1]=u+a*(r[1]-u),t[2]=o+a*(r[2]-o),t},n.hermite=function(t,n,r,a,e,u){var o=u*u,i=o*(2*u-3)+1,s=o*(u-2)+u,c=o*(u-1),f=o*(3-2*u);return t[0]=n[0]*i+r[0]*s+a[0]*c+e[0]*f,t[1]=n[1]*i+r[1]*s+a[1]*c+e[1]*f,t[2]=n[2]*i+r[2]*s+a[2]*c+e[2]*f,t},n.bezier=function(t,n,r,a,e,u){var o=1-u,i=o*o,s=u*u,c=i*o,f=3*u*i,M=3*s*o,h=s*u;return t[0]=n[0]*c+r[0]*f+a[0]*M+e[0]*h,t[1]=n[1]*c+r[1]*f+a[1]*M+e[1]*h,t[2]=n[2]*c+r[2]*f+a[2]*M+e[2]*h,t},n.random=function(t,n){n=n||1;var r=2*a.RANDOM()*Math.PI,e=2*a.RANDOM()-1,u=Math.sqrt(1-e*e)*n;return t[0]=Math.cos(r)*u,t[1]=Math.sin(r)*u,t[2]=e*n,t},n.transformMat4=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=r[3]*a+r[7]*e+r[11]*u+r[15];return o=o||1,t[0]=(r[0]*a+r[4]*e+r[8]*u+r[12])/o,t[1]=(r[1]*a+r[5]*e+r[9]*u+r[13])/o,t[2]=(r[2]*a+r[6]*e+r[10]*u+r[14])/o,t},n.transformMat3=function(t,n,r){var a=n[0],e=n[1],u=n[2];return t[0]=a*r[0]+e*r[3]+u*r[6],t[1]=a*r[1]+e*r[4]+u*r[7],t[2]=a*r[2]+e*r[5]+u*r[8],t},n.transformQuat=function(t,n,r){var a=r[0],e=r[1],u=r[2],o=r[3],i=n[0],s=n[1],c=n[2],f=e*c-u*s,M=u*i-a*c,h=a*s-e*i,l=e*h-u*M,v=u*f-a*h,d=a*M-e*f,b=2*o;return f*=b,M*=b,h*=b,l*=2,v*=2,d*=2,t[0]=i+f+l,t[1]=s+M+v,t[2]=c+h+d,t},n.rotateX=function(t,n,r,a){var e=[],u=[];return e[0]=n[0]-r[0],e[1]=n[1]-r[1],e[2]=n[2]-r[2],u[0]=e[0],u[1]=e[1]*Math.cos(a)-e[2]*Math.sin(a),u[2]=e[1]*Math.sin(a)+e[2]*Math.cos(a),t[0]=u[0]+r[0],t[1]=u[1]+r[1],t[2]=u[2]+r[2],t},n.rotateY=function(t,n,r,a){var e=[],u=[];return e[0]=n[0]-r[0],e[1]=n[1]-r[1],e[2]=n[2]-r[2],u[0]=e[2]*Math.sin(a)+e[0]*Math.cos(a),u[1]=e[1],u[2]=e[2]*Math.cos(a)-e[0]*Math.sin(a),t[0]=u[0]+r[0],t[1]=u[1]+r[1],t[2]=u[2]+r[2],t},n.rotateZ=function(t,n,r,a){var e=[],u=[];return e[0]=n[0]-r[0],e[1]=n[1]-r[1],e[2]=n[2]-r[2],u[0]=e[0]*Math.cos(a)-e[1]*Math.sin(a),u[1]=e[0]*Math.sin(a)+e[1]*Math.cos(a),u[2]=e[2],t[0]=u[0]+r[0],t[1]=u[1]+r[1],t[2]=u[2]+r[2],t},n.angle=function(t,n){var r=o(t[0],t[1],t[2]),a=o(n[0],n[1],n[2]);l(r,r),l(a,a);var e=v(r,a);return e>1?0:e<-1?Math.PI:Math.acos(e)},n.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},n.exactEquals=function(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]},n.equals=function(t,n){var r=t[0],e=t[1],u=t[2],o=n[0],i=n[1],s=n[2];return Math.abs(r-o)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(e-i)<=a.EPSILON*Math.max(1,Math.abs(e),Math.abs(i))&&Math.abs(u-s)<=a.EPSILON*Math.max(1,Math.abs(u),Math.abs(s))};var a=function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}(r(0));n.sub=i,n.mul=s,n.div=c,n.dist=f,n.sqrDist=M,n.len=u,n.sqrLen=h,n.forEach=function(){var t=e();return function(n,r,a,e,u,o){var i=void 0,s=void 0;for(r||(r=3),a||(a=0),s=e?Math.min(e*r+a,n.length):n.length,i=a;i<s;i+=r)t[0]=n[i],t[1]=n[i+1],t[2]=n[i+2],u(t,t,o),n[i]=t[0],n[i+1]=t[1],n[i+2]=t[2];return n}}()},function(t,n,r){"use strict";function i(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}function s(){var t=new a.ARRAY_TYPE(4);return a.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function c(t,n,r){r*=.5;var a=Math.sin(r);return t[0]=a*n[0],t[1]=a*n[1],t[2]=a*n[2],t[3]=Math.cos(r),t}function f(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=r[0],s=r[1],c=r[2],f=r[3];return t[0]=a*f+o*i+e*c-u*s,t[1]=e*f+o*s+u*i-a*c,t[2]=u*f+o*c+a*s-e*i,t[3]=o*f-a*i-e*s-u*c,t}function M(t,n,r,e){var u=n[0],o=n[1],i=n[2],s=n[3],c=r[0],f=r[1],M=r[2],h=r[3],l=void 0,v=void 0,d=void 0,b=void 0,m=void 0;return(v=u*c+o*f+i*M+s*h)<0&&(v=-v,c=-c,f=-f,M=-M,h=-h),1-v>a.EPSILON?(l=Math.acos(v),d=Math.sin(l),b=Math.sin((1-e)*l)/d,m=Math.sin(e*l)/d):(b=1-e,m=e),t[0]=b*u+m*c,t[1]=b*o+m*f,t[2]=b*i+m*M,t[3]=b*s+m*h,t}function h(t,n){var r=n[0]+n[4]+n[8],a=void 0;if(r>0)a=Math.sqrt(r+1),t[3]=.5*a,a=.5/a,t[0]=(n[5]-n[7])*a,t[1]=(n[6]-n[2])*a,t[2]=(n[1]-n[3])*a;else{var e=0;n[4]>n[0]&&(e=1),n[8]>n[3*e+e]&&(e=2);var u=(e+1)%3,o=(e+2)%3;a=Math.sqrt(n[3*e+e]-n[3*u+u]-n[3*o+o]+1),t[e]=.5*a,a=.5/a,t[3]=(n[3*u+o]-n[3*o+u])*a,t[u]=(n[3*u+e]+n[3*e+u])*a,t[o]=(n[3*o+e]+n[3*e+o])*a}return t}Object.defineProperty(n,"__esModule",{value:!0}),n.setAxes=n.sqlerp=n.rotationTo=n.equals=n.exactEquals=n.normalize=n.sqrLen=n.squaredLength=n.len=n.length=n.lerp=n.dot=n.scale=n.mul=n.add=n.set=n.copy=n.fromValues=n.clone=void 0,n.create=s,n.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},n.setAxisAngle=c,n.getAxisAngle=function(t,n){var r=2*Math.acos(n[3]),e=Math.sin(r/2);return e>a.EPSILON?(t[0]=n[0]/e,t[1]=n[1]/e,t[2]=n[2]/e):(t[0]=1,t[1]=0,t[2]=0),r},n.multiply=f,n.rotateX=function(t,n,r){r*=.5;var a=n[0],e=n[1],u=n[2],o=n[3],i=Math.sin(r),s=Math.cos(r);return t[0]=a*s+o*i,t[1]=e*s+u*i,t[2]=u*s-e*i,t[3]=o*s-a*i,t},n.rotateY=function(t,n,r){r*=.5;var a=n[0],e=n[1],u=n[2],o=n[3],i=Math.sin(r),s=Math.cos(r);return t[0]=a*s-u*i,t[1]=e*s+o*i,t[2]=u*s+a*i,t[3]=o*s-e*i,t},n.rotateZ=function(t,n,r){r*=.5;var a=n[0],e=n[1],u=n[2],o=n[3],i=Math.sin(r),s=Math.cos(r);return t[0]=a*s+e*i,t[1]=e*s-a*i,t[2]=u*s+o*i,t[3]=o*s-u*i,t},n.calculateW=function(t,n){var r=n[0],a=n[1],e=n[2];return t[0]=r,t[1]=a,t[2]=e,t[3]=Math.sqrt(Math.abs(1-r*r-a*a-e*e)),t},n.slerp=M,n.random=function(t){var n=a.RANDOM(),r=a.RANDOM(),e=a.RANDOM(),u=Math.sqrt(1-n),o=Math.sqrt(n);return t[0]=u*Math.sin(2*Math.PI*r),t[1]=u*Math.cos(2*Math.PI*r),t[2]=o*Math.sin(2*Math.PI*e),t[3]=o*Math.cos(2*Math.PI*e),t},n.invert=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=r*r+a*a+e*e+u*u,i=o?1/o:0;return t[0]=-r*i,t[1]=-a*i,t[2]=-e*i,t[3]=u*i,t},n.conjugate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=n[3],t},n.fromMat3=h,n.fromEuler=function(t,n,r,a){var e=.5*Math.PI/180;n*=e,r*=e,a*=e;var u=Math.sin(n),o=Math.cos(n),i=Math.sin(r),s=Math.cos(r),c=Math.sin(a),f=Math.cos(a);return t[0]=u*s*f-o*i*c,t[1]=o*i*f+u*s*c,t[2]=o*s*c-u*i*f,t[3]=o*s*f+u*i*c,t},n.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"};var a=i(r(0)),e=i(r(5)),u=i(r(2)),o=i(r(1));n.clone=o.clone,n.fromValues=o.fromValues,n.copy=o.copy,n.set=o.set,n.add=o.add,n.mul=f,n.scale=o.scale,n.dot=o.dot,n.lerp=o.lerp;var l=n.length=o.length,v=(n.len=l,n.squaredLength=o.squaredLength),d=(n.sqrLen=v,n.normalize=o.normalize);n.exactEquals=o.exactEquals,n.equals=o.equals,n.rotationTo=function(){var t=u.create(),n=u.fromValues(1,0,0),r=u.fromValues(0,1,0);return function(a,e,o){var i=u.dot(e,o);return i<-.999999?(u.cross(t,n,e),u.len(t)<1e-6&&u.cross(t,r,e),u.normalize(t,t),c(a,t,Math.PI),a):i>.999999?(a[0]=0,a[1]=0,a[2]=0,a[3]=1,a):(u.cross(t,e,o),a[0]=t[0],a[1]=t[1],a[2]=t[2],a[3]=1+i,d(a,a))}}(),n.sqlerp=function(){var t=s(),n=s();return function(r,a,e,u,o,i){return M(t,a,o,i),M(n,e,u,i),M(r,t,n,2*i*(1-i)),r}}(),n.setAxes=function(){var t=e.create();return function(n,r,a,e){return t[0]=a[0],t[3]=a[1],t[6]=a[2],t[1]=e[0],t[4]=e[1],t[7]=e[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],d(n,h(n,t))}}()},function(t,n,r){"use strict";function e(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function u(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],s=n[5],c=n[6],f=n[7],M=n[8],h=n[9],l=n[10],v=n[11],d=n[12],b=n[13],m=n[14],p=n[15],P=r[0],A=r[1],E=r[2],O=r[3];return t[0]=P*a+A*i+E*M+O*d,t[1]=P*e+A*s+E*h+O*b,t[2]=P*u+A*c+E*l+O*m,t[3]=P*o+A*f+E*v+O*p,P=r[4],A=r[5],E=r[6],O=r[7],t[4]=P*a+A*i+E*M+O*d,t[5]=P*e+A*s+E*h+O*b,t[6]=P*u+A*c+E*l+O*m,t[7]=P*o+A*f+E*v+O*p,P=r[8],A=r[9],E=r[10],O=r[11],t[8]=P*a+A*i+E*M+O*d,t[9]=P*e+A*s+E*h+O*b,t[10]=P*u+A*c+E*l+O*m,t[11]=P*o+A*f+E*v+O*p,P=r[12],A=r[13],E=r[14],O=r[15],t[12]=P*a+A*i+E*M+O*d,t[13]=P*e+A*s+E*h+O*b,t[14]=P*u+A*c+E*l+O*m,t[15]=P*o+A*f+E*v+O*p,t}function o(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=a+a,s=e+e,c=u+u,f=a*i,M=a*s,h=a*c,l=e*s,v=e*c,d=u*c,b=o*i,m=o*s,p=o*c;return t[0]=1-(l+d),t[1]=M+p,t[2]=h-m,t[3]=0,t[4]=M-p,t[5]=1-(f+d),t[6]=v+b,t[7]=0,t[8]=h+m,t[9]=v-b,t[10]=1-(f+l),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function i(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t[3]=n[3]-r[3],t[4]=n[4]-r[4],t[5]=n[5]-r[5],t[6]=n[6]-r[6],t[7]=n[7]-r[7],t[8]=n[8]-r[8],t[9]=n[9]-r[9],t[10]=n[10]-r[10],t[11]=n[11]-r[11],t[12]=n[12]-r[12],t[13]=n[13]-r[13],t[14]=n[14]-r[14],t[15]=n[15]-r[15],t}Object.defineProperty(n,"__esModule",{value:!0}),n.sub=n.mul=void 0,n.create=function(){var t=new a.ARRAY_TYPE(16);return a.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},n.clone=function(t){var n=new a.ARRAY_TYPE(16);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},n.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},n.fromValues=function(t,n,r,e,u,o,i,s,c,f,M,h,l,v,d,b){var m=new a.ARRAY_TYPE(16);return m[0]=t,m[1]=n,m[2]=r,m[3]=e,m[4]=u,m[5]=o,m[6]=i,m[7]=s,m[8]=c,m[9]=f,m[10]=M,m[11]=h,m[12]=l,m[13]=v,m[14]=d,m[15]=b,m},n.set=function(t,n,r,a,e,u,o,i,s,c,f,M,h,l,v,d,b){return t[0]=n,t[1]=r,t[2]=a,t[3]=e,t[4]=u,t[5]=o,t[6]=i,t[7]=s,t[8]=c,t[9]=f,t[10]=M,t[11]=h,t[12]=l,t[13]=v,t[14]=d,t[15]=b,t},n.identity=e,n.transpose=function(t,n){if(t===n){var r=n[1],a=n[2],e=n[3],u=n[6],o=n[7],i=n[11];t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=r,t[6]=n[9],t[7]=n[13],t[8]=a,t[9]=u,t[11]=n[14],t[12]=e,t[13]=o,t[14]=i}else t[0]=n[0],t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=n[1],t[5]=n[5],t[6]=n[9],t[7]=n[13],t[8]=n[2],t[9]=n[6],t[10]=n[10],t[11]=n[14],t[12]=n[3],t[13]=n[7],t[14]=n[11],t[15]=n[15];return t},n.invert=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],s=n[6],c=n[7],f=n[8],M=n[9],h=n[10],l=n[11],v=n[12],d=n[13],b=n[14],m=n[15],p=r*i-a*o,P=r*s-e*o,A=r*c-u*o,E=a*s-e*i,O=a*c-u*i,R=e*c-u*s,y=f*d-M*v,q=f*b-h*v,x=f*m-l*v,_=M*b-h*d,Y=M*m-l*d,L=h*m-l*b,S=p*L-P*Y+A*_+E*x-O*q+R*y;return S?(S=1/S,t[0]=(i*L-s*Y+c*_)*S,t[1]=(e*Y-a*L-u*_)*S,t[2]=(d*R-b*O+m*E)*S,t[3]=(h*O-M*R-l*E)*S,t[4]=(s*x-o*L-c*q)*S,t[5]=(r*L-e*x+u*q)*S,t[6]=(b*A-v*R-m*P)*S,t[7]=(f*R-h*A+l*P)*S,t[8]=(o*Y-i*x+c*y)*S,t[9]=(a*x-r*Y-u*y)*S,t[10]=(v*O-d*A+m*p)*S,t[11]=(M*A-f*O-l*p)*S,t[12]=(i*q-o*_-s*y)*S,t[13]=(r*_-a*q+e*y)*S,t[14]=(d*P-v*E-b*p)*S,t[15]=(f*E-M*P+h*p)*S,t):null},n.adjoint=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],s=n[6],c=n[7],f=n[8],M=n[9],h=n[10],l=n[11],v=n[12],d=n[13],b=n[14],m=n[15];return t[0]=i*(h*m-l*b)-M*(s*m-c*b)+d*(s*l-c*h),t[1]=-(a*(h*m-l*b)-M*(e*m-u*b)+d*(e*l-u*h)),t[2]=a*(s*m-c*b)-i*(e*m-u*b)+d*(e*c-u*s),t[3]=-(a*(s*l-c*h)-i*(e*l-u*h)+M*(e*c-u*s)),t[4]=-(o*(h*m-l*b)-f*(s*m-c*b)+v*(s*l-c*h)),t[5]=r*(h*m-l*b)-f*(e*m-u*b)+v*(e*l-u*h),t[6]=-(r*(s*m-c*b)-o*(e*m-u*b)+v*(e*c-u*s)),t[7]=r*(s*l-c*h)-o*(e*l-u*h)+f*(e*c-u*s),t[8]=o*(M*m-l*d)-f*(i*m-c*d)+v*(i*l-c*M),t[9]=-(r*(M*m-l*d)-f*(a*m-u*d)+v*(a*l-u*M)),t[10]=r*(i*m-c*d)-o*(a*m-u*d)+v*(a*c-u*i),t[11]=-(r*(i*l-c*M)-o*(a*l-u*M)+f*(a*c-u*i)),t[12]=-(o*(M*b-h*d)-f*(i*b-s*d)+v*(i*h-s*M)),t[13]=r*(M*b-h*d)-f*(a*b-e*d)+v*(a*h-e*M),t[14]=-(r*(i*b-s*d)-o*(a*b-e*d)+v*(a*s-e*i)),t[15]=r*(i*h-s*M)-o*(a*h-e*M)+f*(a*s-e*i),t},n.determinant=function(t){var n=t[0],r=t[1],a=t[2],e=t[3],u=t[4],o=t[5],i=t[6],s=t[7],c=t[8],f=t[9],M=t[10],h=t[11],l=t[12],v=t[13],d=t[14],b=t[15];return(n*o-r*u)*(M*b-h*d)-(n*i-a*u)*(f*b-h*v)+(n*s-e*u)*(f*d-M*v)+(r*i-a*o)*(c*b-h*l)-(r*s-e*o)*(c*d-M*l)+(a*s-e*i)*(c*v-f*l)},n.multiply=u,n.translate=function(t,n,r){var a=r[0],e=r[1],u=r[2],o=void 0,i=void 0,s=void 0,c=void 0,f=void 0,M=void 0,h=void 0,l=void 0,v=void 0,d=void 0,b=void 0,m=void 0;return n===t?(t[12]=n[0]*a+n[4]*e+n[8]*u+n[12],t[13]=n[1]*a+n[5]*e+n[9]*u+n[13],t[14]=n[2]*a+n[6]*e+n[10]*u+n[14],t[15]=n[3]*a+n[7]*e+n[11]*u+n[15]):(o=n[0],i=n[1],s=n[2],c=n[3],f=n[4],M=n[5],h=n[6],l=n[7],v=n[8],d=n[9],b=n[10],m=n[11],t[0]=o,t[1]=i,t[2]=s,t[3]=c,t[4]=f,t[5]=M,t[6]=h,t[7]=l,t[8]=v,t[9]=d,t[10]=b,t[11]=m,t[12]=o*a+f*e+v*u+n[12],t[13]=i*a+M*e+d*u+n[13],t[14]=s*a+h*e+b*u+n[14],t[15]=c*a+l*e+m*u+n[15]),t},n.scale=function(t,n,r){var a=r[0],e=r[1],u=r[2];return t[0]=n[0]*a,t[1]=n[1]*a,t[2]=n[2]*a,t[3]=n[3]*a,t[4]=n[4]*e,t[5]=n[5]*e,t[6]=n[6]*e,t[7]=n[7]*e,t[8]=n[8]*u,t[9]=n[9]*u,t[10]=n[10]*u,t[11]=n[11]*u,t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},n.rotate=function(t,n,r,e){var u=e[0],o=e[1],i=e[2],s=Math.sqrt(u*u+o*o+i*i),c=void 0,f=void 0,M=void 0,h=void 0,l=void 0,v=void 0,d=void 0,b=void 0,m=void 0,p=void 0,P=void 0,A=void 0,E=void 0,O=void 0,R=void 0,y=void 0,q=void 0,x=void 0,_=void 0,Y=void 0,L=void 0,S=void 0,w=void 0,I=void 0;return s<a.EPSILON?null:(u*=s=1/s,o*=s,i*=s,c=Math.sin(r),f=Math.cos(r),M=1-f,h=n[0],l=n[1],v=n[2],d=n[3],b=n[4],m=n[5],p=n[6],P=n[7],A=n[8],E=n[9],O=n[10],R=n[11],y=u*u*M+f,q=o*u*M+i*c,x=i*u*M-o*c,_=u*o*M-i*c,Y=o*o*M+f,L=i*o*M+u*c,S=u*i*M+o*c,w=o*i*M-u*c,I=i*i*M+f,t[0]=h*y+b*q+A*x,t[1]=l*y+m*q+E*x,t[2]=v*y+p*q+O*x,t[3]=d*y+P*q+R*x,t[4]=h*_+b*Y+A*L,t[5]=l*_+m*Y+E*L,t[6]=v*_+p*Y+O*L,t[7]=d*_+P*Y+R*L,t[8]=h*S+b*w+A*I,t[9]=l*S+m*w+E*I,t[10]=v*S+p*w+O*I,t[11]=d*S+P*w+R*I,n!==t&&(t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t)},n.rotateX=function(t,n,r){var a=Math.sin(r),e=Math.cos(r),u=n[4],o=n[5],i=n[6],s=n[7],c=n[8],f=n[9],M=n[10],h=n[11];return n!==t&&(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[4]=u*e+c*a,t[5]=o*e+f*a,t[6]=i*e+M*a,t[7]=s*e+h*a,t[8]=c*e-u*a,t[9]=f*e-o*a,t[10]=M*e-i*a,t[11]=h*e-s*a,t},n.rotateY=function(t,n,r){var a=Math.sin(r),e=Math.cos(r),u=n[0],o=n[1],i=n[2],s=n[3],c=n[8],f=n[9],M=n[10],h=n[11];return n!==t&&(t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[0]=u*e-c*a,t[1]=o*e-f*a,t[2]=i*e-M*a,t[3]=s*e-h*a,t[8]=u*a+c*e,t[9]=o*a+f*e,t[10]=i*a+M*e,t[11]=s*a+h*e,t},n.rotateZ=function(t,n,r){var a=Math.sin(r),e=Math.cos(r),u=n[0],o=n[1],i=n[2],s=n[3],c=n[4],f=n[5],M=n[6],h=n[7];return n!==t&&(t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[0]=u*e+c*a,t[1]=o*e+f*a,t[2]=i*e+M*a,t[3]=s*e+h*a,t[4]=c*e-u*a,t[5]=f*e-o*a,t[6]=M*e-i*a,t[7]=h*e-s*a,t},n.fromTranslation=function(t,n){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},n.fromScaling=function(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=n[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},n.fromRotation=function(t,n,r){var e=r[0],u=r[1],o=r[2],i=Math.sqrt(e*e+u*u+o*o),s=void 0,c=void 0,f=void 0;return i<a.EPSILON?null:(e*=i=1/i,u*=i,o*=i,s=Math.sin(n),c=Math.cos(n),f=1-c,t[0]=e*e*f+c,t[1]=u*e*f+o*s,t[2]=o*e*f-u*s,t[3]=0,t[4]=e*u*f-o*s,t[5]=u*u*f+c,t[6]=o*u*f+e*s,t[7]=0,t[8]=e*o*f+u*s,t[9]=u*o*f-e*s,t[10]=o*o*f+c,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)},n.fromXRotation=function(t,n){var r=Math.sin(n),a=Math.cos(n);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=r,t[7]=0,t[8]=0,t[9]=-r,t[10]=a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},n.fromYRotation=function(t,n){var r=Math.sin(n),a=Math.cos(n);return t[0]=a,t[1]=0,t[2]=-r,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=r,t[9]=0,t[10]=a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},n.fromZRotation=function(t,n){var r=Math.sin(n),a=Math.cos(n);return t[0]=a,t[1]=r,t[2]=0,t[3]=0,t[4]=-r,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},n.fromRotationTranslation=o,n.fromQuat2=function(t,n){var r=new a.ARRAY_TYPE(3),e=-n[0],u=-n[1],i=-n[2],s=n[3],c=n[4],f=n[5],M=n[6],h=n[7],l=e*e+u*u+i*i+s*s;return l>0?(r[0]=2*(c*s+h*e+f*i-M*u)/l,r[1]=2*(f*s+h*u+M*e-c*i)/l,r[2]=2*(M*s+h*i+c*u-f*e)/l):(r[0]=2*(c*s+h*e+f*i-M*u),r[1]=2*(f*s+h*u+M*e-c*i),r[2]=2*(M*s+h*i+c*u-f*e)),o(t,n,r),t},n.getTranslation=function(t,n){return t[0]=n[12],t[1]=n[13],t[2]=n[14],t},n.getScaling=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[4],o=n[5],i=n[6],s=n[8],c=n[9],f=n[10];return t[0]=Math.sqrt(r*r+a*a+e*e),t[1]=Math.sqrt(u*u+o*o+i*i),t[2]=Math.sqrt(s*s+c*c+f*f),t},n.getRotation=function(t,n){var r=n[0]+n[5]+n[10],a=0;return r>0?(a=2*Math.sqrt(r+1),t[3]=.25*a,t[0]=(n[6]-n[9])/a,t[1]=(n[8]-n[2])/a,t[2]=(n[1]-n[4])/a):n[0]>n[5]&&n[0]>n[10]?(a=2*Math.sqrt(1+n[0]-n[5]-n[10]),t[3]=(n[6]-n[9])/a,t[0]=.25*a,t[1]=(n[1]+n[4])/a,t[2]=(n[8]+n[2])/a):n[5]>n[10]?(a=2*Math.sqrt(1+n[5]-n[0]-n[10]),t[3]=(n[8]-n[2])/a,t[0]=(n[1]+n[4])/a,t[1]=.25*a,t[2]=(n[6]+n[9])/a):(a=2*Math.sqrt(1+n[10]-n[0]-n[5]),t[3]=(n[1]-n[4])/a,t[0]=(n[8]+n[2])/a,t[1]=(n[6]+n[9])/a,t[2]=.25*a),t},n.fromRotationTranslationScale=function(t,n,r,a){var e=n[0],u=n[1],o=n[2],i=n[3],s=e+e,c=u+u,f=o+o,M=e*s,h=e*c,l=e*f,v=u*c,d=u*f,b=o*f,m=i*s,p=i*c,P=i*f,A=a[0],E=a[1],O=a[2];return t[0]=(1-(v+b))*A,t[1]=(h+P)*A,t[2]=(l-p)*A,t[3]=0,t[4]=(h-P)*E,t[5]=(1-(M+b))*E,t[6]=(d+m)*E,t[7]=0,t[8]=(l+p)*O,t[9]=(d-m)*O,t[10]=(1-(M+v))*O,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t},n.fromRotationTranslationScaleOrigin=function(t,n,r,a,e){var u=n[0],o=n[1],i=n[2],s=n[3],c=u+u,f=o+o,M=i+i,h=u*c,l=u*f,v=u*M,d=o*f,b=o*M,m=i*M,p=s*c,P=s*f,A=s*M,E=a[0],O=a[1],R=a[2],y=e[0],q=e[1],x=e[2],_=(1-(d+m))*E,Y=(l+A)*E,L=(v-P)*E,S=(l-A)*O,w=(1-(h+m))*O,I=(b+p)*O,N=(v+P)*R,g=(b-p)*R,T=(1-(h+d))*R;return t[0]=_,t[1]=Y,t[2]=L,t[3]=0,t[4]=S,t[5]=w,t[6]=I,t[7]=0,t[8]=N,t[9]=g,t[10]=T,t[11]=0,t[12]=r[0]+y-(_*y+S*q+N*x),t[13]=r[1]+q-(Y*y+w*q+g*x),t[14]=r[2]+x-(L*y+I*q+T*x),t[15]=1,t},n.fromQuat=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=r+r,i=a+a,s=e+e,c=r*o,f=a*o,M=a*i,h=e*o,l=e*i,v=e*s,d=u*o,b=u*i,m=u*s;return t[0]=1-M-v,t[1]=f+m,t[2]=h-b,t[3]=0,t[4]=f-m,t[5]=1-c-v,t[6]=l+d,t[7]=0,t[8]=h+b,t[9]=l-d,t[10]=1-c-M,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},n.frustum=function(t,n,r,a,e,u,o){var i=1/(r-n),s=1/(e-a),c=1/(u-o);return t[0]=2*u*i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*u*s,t[6]=0,t[7]=0,t[8]=(r+n)*i,t[9]=(e+a)*s,t[10]=(o+u)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*u*2*c,t[15]=0,t},n.perspective=function(t,n,r,a,e){var u=1/Math.tan(n/2),o=void 0;return t[0]=u/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=e&&e!==1/0?(o=1/(a-e),
t[10]=(e+a)*o,t[14]=2*e*a*o):(t[10]=-1,t[14]=-2*a),t},n.perspectiveFromFieldOfView=function(t,n,r,a){var e=Math.tan(n.upDegrees*Math.PI/180),u=Math.tan(n.downDegrees*Math.PI/180),o=Math.tan(n.leftDegrees*Math.PI/180),i=Math.tan(n.rightDegrees*Math.PI/180),s=2/(o+i),c=2/(e+u);return t[0]=s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-(o-i)*s*.5,t[9]=(e-u)*c*.5,t[10]=a/(r-a),t[11]=-1,t[12]=0,t[13]=0,t[14]=a*r/(r-a),t[15]=0,t},n.ortho=function(t,n,r,a,e,u,o){var i=1/(n-r),s=1/(a-e),c=1/(u-o);return t[0]=-2*i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(n+r)*i,t[13]=(e+a)*s,t[14]=(o+u)*c,t[15]=1,t},n.lookAt=function(t,n,r,u){var o=void 0,i=void 0,s=void 0,c=void 0,f=void 0,M=void 0,h=void 0,l=void 0,v=void 0,d=void 0,b=n[0],m=n[1],p=n[2],P=u[0],A=u[1],E=u[2],O=r[0],R=r[1],y=r[2];return Math.abs(b-O)<a.EPSILON&&Math.abs(m-R)<a.EPSILON&&Math.abs(p-y)<a.EPSILON?e(t):(h=b-O,l=m-R,v=p-y,d=1/Math.sqrt(h*h+l*l+v*v),o=A*(v*=d)-E*(l*=d),i=E*(h*=d)-P*v,s=P*l-A*h,(d=Math.sqrt(o*o+i*i+s*s))?(o*=d=1/d,i*=d,s*=d):(o=0,i=0,s=0),c=l*s-v*i,f=v*o-h*s,M=h*i-l*o,(d=Math.sqrt(c*c+f*f+M*M))?(c*=d=1/d,f*=d,M*=d):(c=0,f=0,M=0),t[0]=o,t[1]=c,t[2]=h,t[3]=0,t[4]=i,t[5]=f,t[6]=l,t[7]=0,t[8]=s,t[9]=M,t[10]=v,t[11]=0,t[12]=-(o*b+i*m+s*p),t[13]=-(c*b+f*m+M*p),t[14]=-(h*b+l*m+v*p),t[15]=1,t)},n.targetTo=function(t,n,r,a){var e=n[0],u=n[1],o=n[2],i=a[0],s=a[1],c=a[2],f=e-r[0],M=u-r[1],h=o-r[2],l=f*f+M*M+h*h;l>0&&(l=1/Math.sqrt(l),f*=l,M*=l,h*=l);var v=s*h-c*M,d=c*f-i*h,b=i*M-s*f;return(l=v*v+d*d+b*b)>0&&(l=1/Math.sqrt(l),v*=l,d*=l,b*=l),t[0]=v,t[1]=d,t[2]=b,t[3]=0,t[4]=M*b-h*d,t[5]=h*v-f*b,t[6]=f*d-M*v,t[7]=0,t[8]=f,t[9]=M,t[10]=h,t[11]=0,t[12]=e,t[13]=u,t[14]=o,t[15]=1,t},n.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},n.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2)+Math.pow(t[9],2)+Math.pow(t[10],2)+Math.pow(t[11],2)+Math.pow(t[12],2)+Math.pow(t[13],2)+Math.pow(t[14],2)+Math.pow(t[15],2))},n.add=function(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2],t[3]=n[3]+r[3],t[4]=n[4]+r[4],t[5]=n[5]+r[5],t[6]=n[6]+r[6],t[7]=n[7]+r[7],t[8]=n[8]+r[8],t[9]=n[9]+r[9],t[10]=n[10]+r[10],t[11]=n[11]+r[11],t[12]=n[12]+r[12],t[13]=n[13]+r[13],t[14]=n[14]+r[14],t[15]=n[15]+r[15],t},n.subtract=i,n.multiplyScalar=function(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=n[3]*r,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=n[7]*r,t[8]=n[8]*r,t[9]=n[9]*r,t[10]=n[10]*r,t[11]=n[11]*r,t[12]=n[12]*r,t[13]=n[13]*r,t[14]=n[14]*r,t[15]=n[15]*r,t},n.multiplyScalarAndAdd=function(t,n,r,a){return t[0]=n[0]+r[0]*a,t[1]=n[1]+r[1]*a,t[2]=n[2]+r[2]*a,t[3]=n[3]+r[3]*a,t[4]=n[4]+r[4]*a,t[5]=n[5]+r[5]*a,t[6]=n[6]+r[6]*a,t[7]=n[7]+r[7]*a,t[8]=n[8]+r[8]*a,t[9]=n[9]+r[9]*a,t[10]=n[10]+r[10]*a,t[11]=n[11]+r[11]*a,t[12]=n[12]+r[12]*a,t[13]=n[13]+r[13]*a,t[14]=n[14]+r[14]*a,t[15]=n[15]+r[15]*a,t},n.exactEquals=function(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]&&t[4]===n[4]&&t[5]===n[5]&&t[6]===n[6]&&t[7]===n[7]&&t[8]===n[8]&&t[9]===n[9]&&t[10]===n[10]&&t[11]===n[11]&&t[12]===n[12]&&t[13]===n[13]&&t[14]===n[14]&&t[15]===n[15]},n.equals=function(t,n){var r=t[0],e=t[1],u=t[2],o=t[3],i=t[4],s=t[5],c=t[6],f=t[7],M=t[8],h=t[9],l=t[10],v=t[11],d=t[12],b=t[13],m=t[14],p=t[15],P=n[0],A=n[1],E=n[2],O=n[3],R=n[4],y=n[5],q=n[6],x=n[7],_=n[8],Y=n[9],L=n[10],S=n[11],w=n[12],I=n[13],N=n[14],g=n[15];return Math.abs(r-P)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(P))&&Math.abs(e-A)<=a.EPSILON*Math.max(1,Math.abs(e),Math.abs(A))&&Math.abs(u-E)<=a.EPSILON*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(o-O)<=a.EPSILON*Math.max(1,Math.abs(o),Math.abs(O))&&Math.abs(i-R)<=a.EPSILON*Math.max(1,Math.abs(i),Math.abs(R))&&Math.abs(s-y)<=a.EPSILON*Math.max(1,Math.abs(s),Math.abs(y))&&Math.abs(c-q)<=a.EPSILON*Math.max(1,Math.abs(c),Math.abs(q))&&Math.abs(f-x)<=a.EPSILON*Math.max(1,Math.abs(f),Math.abs(x))&&Math.abs(M-_)<=a.EPSILON*Math.max(1,Math.abs(M),Math.abs(_))&&Math.abs(h-Y)<=a.EPSILON*Math.max(1,Math.abs(h),Math.abs(Y))&&Math.abs(l-L)<=a.EPSILON*Math.max(1,Math.abs(l),Math.abs(L))&&Math.abs(v-S)<=a.EPSILON*Math.max(1,Math.abs(v),Math.abs(S))&&Math.abs(d-w)<=a.EPSILON*Math.max(1,Math.abs(d),Math.abs(w))&&Math.abs(b-I)<=a.EPSILON*Math.max(1,Math.abs(b),Math.abs(I))&&Math.abs(m-N)<=a.EPSILON*Math.max(1,Math.abs(m),Math.abs(N))&&Math.abs(p-g)<=a.EPSILON*Math.max(1,Math.abs(p),Math.abs(g))};var a=function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}(r(0));n.mul=u,n.sub=i},function(t,n,r){"use strict";function e(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],s=n[5],c=n[6],f=n[7],M=n[8],h=r[0],l=r[1],v=r[2],d=r[3],b=r[4],m=r[5],p=r[6],P=r[7],A=r[8];return t[0]=h*a+l*o+v*c,t[1]=h*e+l*i+v*f,t[2]=h*u+l*s+v*M,t[3]=d*a+b*o+m*c,t[4]=d*e+b*i+m*f,t[5]=d*u+b*s+m*M,t[6]=p*a+P*o+A*c,t[7]=p*e+P*i+A*f,t[8]=p*u+P*s+A*M,t}function u(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t[3]=n[3]-r[3],t[4]=n[4]-r[4],t[5]=n[5]-r[5],t[6]=n[6]-r[6],t[7]=n[7]-r[7],t[8]=n[8]-r[8],t}Object.defineProperty(n,"__esModule",{value:!0}),n.sub=n.mul=void 0,n.create=function(){var t=new a.ARRAY_TYPE(9);return a.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},n.fromMat4=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[4],t[4]=n[5],t[5]=n[6],t[6]=n[8],t[7]=n[9],t[8]=n[10],t},n.clone=function(t){var n=new a.ARRAY_TYPE(9);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n},n.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t},n.fromValues=function(t,n,r,e,u,o,i,s,c){var f=new a.ARRAY_TYPE(9);return f[0]=t,f[1]=n,f[2]=r,f[3]=e,f[4]=u,f[5]=o,f[6]=i,f[7]=s,f[8]=c,f},n.set=function(t,n,r,a,e,u,o,i,s,c){return t[0]=n,t[1]=r,t[2]=a,t[3]=e,t[4]=u,t[5]=o,t[6]=i,t[7]=s,t[8]=c,t},n.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},n.transpose=function(t,n){if(t===n){var r=n[1],a=n[2],e=n[5];t[1]=n[3],t[2]=n[6],t[3]=r,t[5]=n[7],t[6]=a,t[7]=e}else t[0]=n[0],t[1]=n[3],t[2]=n[6],t[3]=n[1],t[4]=n[4],t[5]=n[7],t[6]=n[2],t[7]=n[5],t[8]=n[8];return t},n.invert=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],s=n[6],c=n[7],f=n[8],M=f*o-i*c,h=-f*u+i*s,l=c*u-o*s,v=r*M+a*h+e*l;return v?(v=1/v,t[0]=M*v,t[1]=(-f*a+e*c)*v,t[2]=(i*a-e*o)*v,t[3]=h*v,t[4]=(f*r-e*s)*v,t[5]=(-i*r+e*u)*v,t[6]=l*v,t[7]=(-c*r+a*s)*v,t[8]=(o*r-a*u)*v,t):null},n.adjoint=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],s=n[6],c=n[7],f=n[8];return t[0]=o*f-i*c,t[1]=e*c-a*f,t[2]=a*i-e*o,t[3]=i*s-u*f,t[4]=r*f-e*s,t[5]=e*u-r*i,t[6]=u*c-o*s,t[7]=a*s-r*c,t[8]=r*o-a*u,t},n.determinant=function(t){var n=t[0],r=t[1],a=t[2],e=t[3],u=t[4],o=t[5],i=t[6],s=t[7],c=t[8];return n*(c*u-o*s)+r*(-c*e+o*i)+a*(s*e-u*i)},n.multiply=e,n.translate=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],s=n[5],c=n[6],f=n[7],M=n[8],h=r[0],l=r[1];return t[0]=a,t[1]=e,t[2]=u,t[3]=o,t[4]=i,t[5]=s,t[6]=h*a+l*o+c,t[7]=h*e+l*i+f,t[8]=h*u+l*s+M,t},n.rotate=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],s=n[5],c=n[6],f=n[7],M=n[8],h=Math.sin(r),l=Math.cos(r);return t[0]=l*a+h*o,t[1]=l*e+h*i,t[2]=l*u+h*s,t[3]=l*o-h*a,t[4]=l*i-h*e,t[5]=l*s-h*u,t[6]=c,t[7]=f,t[8]=M,t},n.scale=function(t,n,r){var a=r[0],e=r[1];return t[0]=a*n[0],t[1]=a*n[1],t[2]=a*n[2],t[3]=e*n[3],t[4]=e*n[4],t[5]=e*n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t},n.fromTranslation=function(t,n){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=n[0],t[7]=n[1],t[8]=1,t},n.fromRotation=function(t,n){var r=Math.sin(n),a=Math.cos(n);return t[0]=a,t[1]=r,t[2]=0,t[3]=-r,t[4]=a,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},n.fromScaling=function(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=0,t[4]=n[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},n.fromMat2d=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=0,t[3]=n[2],t[4]=n[3],t[5]=0,t[6]=n[4],t[7]=n[5],t[8]=1,t},n.fromQuat=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=r+r,i=a+a,s=e+e,c=r*o,f=a*o,M=a*i,h=e*o,l=e*i,v=e*s,d=u*o,b=u*i,m=u*s;return t[0]=1-M-v,t[3]=f-m,t[6]=h+b,t[1]=f+m,t[4]=1-c-v,t[7]=l-d,t[2]=h-b,t[5]=l+d,t[8]=1-c-M,t},n.normalFromMat4=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],s=n[6],c=n[7],f=n[8],M=n[9],h=n[10],l=n[11],v=n[12],d=n[13],b=n[14],m=n[15],p=r*i-a*o,P=r*s-e*o,A=r*c-u*o,E=a*s-e*i,O=a*c-u*i,R=e*c-u*s,y=f*d-M*v,q=f*b-h*v,x=f*m-l*v,_=M*b-h*d,Y=M*m-l*d,L=h*m-l*b,S=p*L-P*Y+A*_+E*x-O*q+R*y;return S?(S=1/S,t[0]=(i*L-s*Y+c*_)*S,t[1]=(s*x-o*L-c*q)*S,t[2]=(o*Y-i*x+c*y)*S,t[3]=(e*Y-a*L-u*_)*S,t[4]=(r*L-e*x+u*q)*S,t[5]=(a*x-r*Y-u*y)*S,t[6]=(d*R-b*O+m*E)*S,t[7]=(b*A-v*R-m*P)*S,t[8]=(v*O-d*A+m*p)*S,t):null},n.projection=function(t,n,r){return t[0]=2/n,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/r,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t},n.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},n.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2))},n.add=function(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2],t[3]=n[3]+r[3],t[4]=n[4]+r[4],t[5]=n[5]+r[5],t[6]=n[6]+r[6],t[7]=n[7]+r[7],t[8]=n[8]+r[8],t},n.subtract=u,n.multiplyScalar=function(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=n[3]*r,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=n[7]*r,t[8]=n[8]*r,t},n.multiplyScalarAndAdd=function(t,n,r,a){return t[0]=n[0]+r[0]*a,t[1]=n[1]+r[1]*a,t[2]=n[2]+r[2]*a,t[3]=n[3]+r[3]*a,t[4]=n[4]+r[4]*a,t[5]=n[5]+r[5]*a,t[6]=n[6]+r[6]*a,t[7]=n[7]+r[7]*a,t[8]=n[8]+r[8]*a,t},n.exactEquals=function(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]&&t[4]===n[4]&&t[5]===n[5]&&t[6]===n[6]&&t[7]===n[7]&&t[8]===n[8]},n.equals=function(t,n){var r=t[0],e=t[1],u=t[2],o=t[3],i=t[4],s=t[5],c=t[6],f=t[7],M=t[8],h=n[0],l=n[1],v=n[2],d=n[3],b=n[4],m=n[5],p=n[6],P=n[7],A=n[8];return Math.abs(r-h)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(e-l)<=a.EPSILON*Math.max(1,Math.abs(e),Math.abs(l))&&Math.abs(u-v)<=a.EPSILON*Math.max(1,Math.abs(u),Math.abs(v))&&Math.abs(o-d)<=a.EPSILON*Math.max(1,Math.abs(o),Math.abs(d))&&Math.abs(i-b)<=a.EPSILON*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(s-m)<=a.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(c-p)<=a.EPSILON*Math.max(1,Math.abs(c),Math.abs(p))&&Math.abs(f-P)<=a.EPSILON*Math.max(1,Math.abs(f),Math.abs(P))&&Math.abs(M-A)<=a.EPSILON*Math.max(1,Math.abs(M),Math.abs(A))};var a=function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}(r(0));n.mul=e,n.sub=u},function(t,n,r){"use strict";function e(){var t=new a.ARRAY_TYPE(2);return a.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function u(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t}function o(t,n,r){return t[0]=n[0]*r[0],t[1]=n[1]*r[1],t}function i(t,n,r){return t[0]=n[0]/r[0],t[1]=n[1]/r[1],t}function s(t,n){var r=n[0]-t[0],a=n[1]-t[1];return Math.sqrt(r*r+a*a)}function c(t,n){var r=n[0]-t[0],a=n[1]-t[1];return r*r+a*a}function f(t){var n=t[0],r=t[1];return Math.sqrt(n*n+r*r)}function M(t){var n=t[0],r=t[1];return n*n+r*r}Object.defineProperty(n,"__esModule",{value:!0}),n.forEach=n.sqrLen=n.sqrDist=n.dist=n.div=n.mul=n.sub=n.len=void 0,n.create=e,n.clone=function(t){var n=new a.ARRAY_TYPE(2);return n[0]=t[0],n[1]=t[1],n},n.fromValues=function(t,n){var r=new a.ARRAY_TYPE(2);return r[0]=t,r[1]=n,r},n.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t},n.set=function(t,n,r){return t[0]=n,t[1]=r,t},n.add=function(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t},n.subtract=u,n.multiply=o,n.divide=i,n.ceil=function(t,n){return t[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t},n.floor=function(t,n){return t[0]=Math.floor(n[0]),t[1]=Math.floor(n[1]),t},n.min=function(t,n,r){return t[0]=Math.min(n[0],r[0]),t[1]=Math.min(n[1],r[1]),t},n.max=function(t,n,r){return t[0]=Math.max(n[0],r[0]),t[1]=Math.max(n[1],r[1]),t},n.round=function(t,n){return t[0]=Math.round(n[0]),t[1]=Math.round(n[1]),t},n.scale=function(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t},n.scaleAndAdd=function(t,n,r,a){return t[0]=n[0]+r[0]*a,t[1]=n[1]+r[1]*a,t},n.distance=s,n.squaredDistance=c,n.length=f,n.squaredLength=M,n.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t},n.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t},n.normalize=function(t,n){var r=n[0],a=n[1],e=r*r+a*a;return e>0&&(e=1/Math.sqrt(e),t[0]=n[0]*e,t[1]=n[1]*e),t},n.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]},n.cross=function(t,n,r){var a=n[0]*r[1]-n[1]*r[0];return t[0]=t[1]=0,t[2]=a,t},n.lerp=function(t,n,r,a){var e=n[0],u=n[1];return t[0]=e+a*(r[0]-e),t[1]=u+a*(r[1]-u),t},n.random=function(t,n){n=n||1;var r=2*a.RANDOM()*Math.PI;return t[0]=Math.cos(r)*n,t[1]=Math.sin(r)*n,t},n.transformMat2=function(t,n,r){var a=n[0],e=n[1];return t[0]=r[0]*a+r[2]*e,t[1]=r[1]*a+r[3]*e,t},n.transformMat2d=function(t,n,r){var a=n[0],e=n[1];return t[0]=r[0]*a+r[2]*e+r[4],t[1]=r[1]*a+r[3]*e+r[5],t},n.transformMat3=function(t,n,r){var a=n[0],e=n[1];return t[0]=r[0]*a+r[3]*e+r[6],t[1]=r[1]*a+r[4]*e+r[7],t},n.transformMat4=function(t,n,r){var a=n[0],e=n[1];return t[0]=r[0]*a+r[4]*e+r[12],t[1]=r[1]*a+r[5]*e+r[13],t},n.rotate=function(t,n,r,a){var e=n[0]-r[0],u=n[1]-r[1],o=Math.sin(a),i=Math.cos(a);return t[0]=e*i-u*o+r[0],t[1]=e*o+u*i+r[1],t},n.angle=function(t,n){var r=t[0],a=t[1],e=n[0],u=n[1],o=r*r+a*a;o>0&&(o=1/Math.sqrt(o));var i=e*e+u*u;i>0&&(i=1/Math.sqrt(i));var s=(r*e+a*u)*o*i;return s>1?0:s<-1?Math.PI:Math.acos(s)},n.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},n.exactEquals=function(t,n){return t[0]===n[0]&&t[1]===n[1]},n.equals=function(t,n){var r=t[0],e=t[1],u=n[0],o=n[1];return Math.abs(r-u)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(u))&&Math.abs(e-o)<=a.EPSILON*Math.max(1,Math.abs(e),Math.abs(o))};var a=function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}(r(0));n.len=f,n.sub=u,n.mul=o,n.div=i,n.dist=s,n.sqrDist=c,n.sqrLen=M,n.forEach=function(){var t=e();return function(n,r,a,e,u,o){var i=void 0,s=void 0;for(r||(r=2),a||(a=0),s=e?Math.min(e*r+a,n.length):n.length,i=a;i<s;i+=r)t[0]=n[i],t[1]=n[i+1],u(t,t,o),n[i]=t[0],n[i+1]=t[1];return n}}()},function(t,n,r){"use strict";function o(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}function i(t,n,r){var a=.5*r[0],e=.5*r[1],u=.5*r[2],o=n[0],i=n[1],s=n[2],c=n[3];return t[0]=o,t[1]=i,t[2]=s,t[3]=c,t[4]=a*c+e*s-u*i,t[5]=e*c+u*o-a*s,t[6]=u*c+a*i-e*o,t[7]=-a*o-e*i-u*s,t}function s(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t}function c(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=r[4],s=r[5],c=r[6],f=r[7],M=n[4],h=n[5],l=n[6],v=n[7],d=r[0],b=r[1],m=r[2],p=r[3];return t[0]=a*p+o*d+e*m-u*b,t[1]=e*p+o*b+u*d-a*m,t[2]=u*p+o*m+a*b-e*d,t[3]=o*p-a*d-e*b-u*m,t[4]=a*f+o*i+e*c-u*s+M*p+v*d+h*m-l*b,t[5]=e*f+o*s+u*i-a*c+h*p+v*b+l*d-M*m,t[6]=u*f+o*c+a*s-e*i+l*p+v*m+M*b-h*d,t[7]=o*f-a*i-e*s-u*c+v*p-M*d-h*b-l*m,t}Object.defineProperty(n,"__esModule",{value:!0}),n.sqrLen=n.squaredLength=n.len=n.length=n.dot=n.mul=n.setReal=n.getReal=void 0,n.create=function(){var t=new a.ARRAY_TYPE(8);return a.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0),t[3]=1,t},n.clone=function(t){var n=new a.ARRAY_TYPE(8);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n},n.fromValues=function(t,n,r,e,u,o,i,s){var c=new a.ARRAY_TYPE(8);return c[0]=t,c[1]=n,c[2]=r,c[3]=e,c[4]=u,c[5]=o,c[6]=i,c[7]=s,c},n.fromRotationTranslationValues=function(t,n,r,e,u,o,i){var s=new a.ARRAY_TYPE(8);s[0]=t,s[1]=n,s[2]=r,s[3]=e;var c=.5*u,f=.5*o,M=.5*i;return s[4]=c*e+f*r-M*n,s[5]=f*e+M*t-c*r,s[6]=M*e+c*n-f*t,s[7]=-c*t-f*n-M*r,s},n.fromRotationTranslation=i,n.fromTranslation=function(t,n){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=.5*n[0],t[5]=.5*n[1],t[6]=.5*n[2],t[7]=0,t},n.fromRotation=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=0,t[5]=0,t[6]=0,t[7]=0,t},n.fromMat4=function(t,n){var r=e.create();u.getRotation(r,n);var o=new a.ARRAY_TYPE(3);return u.getTranslation(o,n),i(t,r,o),t},n.copy=s,n.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t},n.set=function(t,n,r,a,e,u,o,i,s){return t[0]=n,t[1]=r,t[2]=a,t[3]=e,t[4]=u,t[5]=o,t[6]=i,t[7]=s,t},n.getDual=function(t,n){return t[0]=n[4],t[1]=n[5],t[2]=n[6],t[3]=n[7],t},n.setDual=function(t,n){return t[4]=n[0],t[5]=n[1],t[6]=n[2],t[7]=n[3],t},n.getTranslation=function(t,n){var r=n[4],a=n[5],e=n[6],u=n[7],o=-n[0],i=-n[1],s=-n[2],c=n[3];return t[0]=2*(r*c+u*o+a*s-e*i),t[1]=2*(a*c+u*i+e*o-r*s),t[2]=2*(e*c+u*s+r*i-a*o),t},n.translate=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=.5*r[0],s=.5*r[1],c=.5*r[2],f=n[4],M=n[5],h=n[6],l=n[7];return t[0]=a,t[1]=e,t[2]=u,t[3]=o,t[4]=o*i+e*c-u*s+f,t[5]=o*s+u*i-a*c+M,t[6]=o*c+a*s-e*i+h,t[7]=-a*i-e*s-u*c+l,t},n.rotateX=function(t,n,r){var a=-n[0],u=-n[1],o=-n[2],i=n[3],s=n[4],c=n[5],f=n[6],M=n[7],h=s*i+M*a+c*o-f*u,l=c*i+M*u+f*a-s*o,v=f*i+M*o+s*u-c*a,d=M*i-s*a-c*u-f*o;return e.rotateX(t,n,r),a=t[0],u=t[1],o=t[2],i=t[3],t[4]=h*i+d*a+l*o-v*u,t[5]=l*i+d*u+v*a-h*o,t[6]=v*i+d*o+h*u-l*a,t[7]=d*i-h*a-l*u-v*o,t},n.rotateY=function(t,n,r){var a=-n[0],u=-n[1],o=-n[2],i=n[3],s=n[4],c=n[5],f=n[6],M=n[7],h=s*i+M*a+c*o-f*u,l=c*i+M*u+f*a-s*o,v=f*i+M*o+s*u-c*a,d=M*i-s*a-c*u-f*o;return e.rotateY(t,n,r),a=t[0],u=t[1],o=t[2],i=t[3],t[4]=h*i+d*a+l*o-v*u,t[5]=l*i+d*u+v*a-h*o,t[6]=v*i+d*o+h*u-l*a,t[7]=d*i-h*a-l*u-v*o,t},n.rotateZ=function(t,n,r){var a=-n[0],u=-n[1],o=-n[2],i=n[3],s=n[4],c=n[5],f=n[6],M=n[7],h=s*i+M*a+c*o-f*u,l=c*i+M*u+f*a-s*o,v=f*i+M*o+s*u-c*a,d=M*i-s*a-c*u-f*o;return e.rotateZ(t,n,r),a=t[0],u=t[1],o=t[2],i=t[3],t[4]=h*i+d*a+l*o-v*u,t[5]=l*i+d*u+v*a-h*o,t[6]=v*i+d*o+h*u-l*a,t[7]=d*i-h*a-l*u-v*o,t},n.rotateByQuatAppend=function(t,n,r){var a=r[0],e=r[1],u=r[2],o=r[3],i=n[0],s=n[1],c=n[2],f=n[3];return t[0]=i*o+f*a+s*u-c*e,t[1]=s*o+f*e+c*a-i*u,t[2]=c*o+f*u+i*e-s*a,t[3]=f*o-i*a-s*e-c*u,i=n[4],s=n[5],c=n[6],f=n[7],t[4]=i*o+f*a+s*u-c*e,t[5]=s*o+f*e+c*a-i*u,t[6]=c*o+f*u+i*e-s*a,t[7]=f*o-i*a-s*e-c*u,t},n.rotateByQuatPrepend=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=r[0],s=r[1],c=r[2],f=r[3];return t[0]=a*f+o*i+e*c-u*s,t[1]=e*f+o*s+u*i-a*c,t[2]=u*f+o*c+a*s-e*i,t[3]=o*f-a*i-e*s-u*c,i=r[4],s=r[5],c=r[6],f=r[7],t[4]=a*f+o*i+e*c-u*s,t[5]=e*f+o*s+u*i-a*c,t[6]=u*f+o*c+a*s-e*i,t[7]=o*f-a*i-e*s-u*c,t},n.rotateAroundAxis=function(t,n,r,e){if(Math.abs(e)<a.EPSILON)return s(t,n);var u=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);e*=.5;var o=Math.sin(e),i=o*r[0]/u,c=o*r[1]/u,f=o*r[2]/u,M=Math.cos(e),h=n[0],l=n[1],v=n[2],d=n[3];t[0]=h*M+d*i+l*f-v*c,t[1]=l*M+d*c+v*i-h*f,t[2]=v*M+d*f+h*c-l*i,t[3]=d*M-h*i-l*c-v*f;var b=n[4],m=n[5],p=n[6],P=n[7];return t[4]=b*M+P*i+m*f-p*c,t[5]=m*M+P*c+p*i-b*f,t[6]=p*M+P*f+b*c-m*i,t[7]=P*M-b*i-m*c-p*f,t},n.add=function(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2],t[3]=n[3]+r[3],t[4]=n[4]+r[4],t[5]=n[5]+r[5],t[6]=n[6]+r[6],t[7]=n[7]+r[7],t},n.multiply=c,n.scale=function(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=n[3]*r,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=n[7]*r,t},n.lerp=function(t,n,r,a){var e=1-a;return f(n,r)<0&&(a=-a),t[0]=n[0]*e+r[0]*a,t[1]=n[1]*e+r[1]*a,t[2]=n[2]*e+r[2]*a,t[3]=n[3]*e+r[3]*a,t[4]=n[4]*e+r[4]*a,t[5]=n[5]*e+r[5]*a,t[6]=n[6]*e+r[6]*a,t[7]=n[7]*e+r[7]*a,t},n.invert=function(t,n){var r=h(n);return t[0]=-n[0]/r,t[1]=-n[1]/r,t[2]=-n[2]/r,t[3]=n[3]/r,t[4]=-n[4]/r,t[5]=-n[5]/r,t[6]=-n[6]/r,t[7]=n[7]/r,t},n.conjugate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=n[3],t[4]=-n[4],t[5]=-n[5],t[6]=-n[6],t[7]=n[7],t},n.normalize=function(t,n){var r=h(n);if(r>0){r=Math.sqrt(r);var a=n[0]/r,e=n[1]/r,u=n[2]/r,o=n[3]/r,i=n[4],s=n[5],c=n[6],f=n[7],M=a*i+e*s+u*c+o*f;t[0]=a,t[1]=e,t[2]=u,t[3]=o,t[4]=(i-a*M)/r,t[5]=(s-e*M)/r,t[6]=(c-u*M)/r,t[7]=(f-o*M)/r}return t},n.str=function(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"},n.exactEquals=function(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]&&t[4]===n[4]&&t[5]===n[5]&&t[6]===n[6]&&t[7]===n[7]},n.equals=function(t,n){var r=t[0],e=t[1],u=t[2],o=t[3],i=t[4],s=t[5],c=t[6],f=t[7],M=n[0],h=n[1],l=n[2],v=n[3],d=n[4],b=n[5],m=n[6],p=n[7];return Math.abs(r-M)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(M))&&Math.abs(e-h)<=a.EPSILON*Math.max(1,Math.abs(e),Math.abs(h))&&Math.abs(u-l)<=a.EPSILON*Math.max(1,Math.abs(u),Math.abs(l))&&Math.abs(o-v)<=a.EPSILON*Math.max(1,Math.abs(o),Math.abs(v))&&Math.abs(i-d)<=a.EPSILON*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(s-b)<=a.EPSILON*Math.max(1,Math.abs(s),Math.abs(b))&&Math.abs(c-m)<=a.EPSILON*Math.max(1,Math.abs(c),Math.abs(m))&&Math.abs(f-p)<=a.EPSILON*Math.max(1,Math.abs(f),Math.abs(p))};var a=o(r(0)),e=o(r(3)),u=o(r(4));n.getReal=e.copy,n.setReal=e.copy,n.mul=c;var f=n.dot=e.dot,M=n.length=e.length,h=(n.len=M,n.squaredLength=e.squaredLength);n.sqrLen=h},function(t,n,r){"use strict";function e(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],s=n[5],c=r[0],f=r[1],M=r[2],h=r[3],l=r[4],v=r[5];return t[0]=a*c+u*f,t[1]=e*c+o*f,t[2]=a*M+u*h,t[3]=e*M+o*h,t[4]=a*l+u*v+i,t[5]=e*l+o*v+s,t}function u(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t[3]=n[3]-r[3],t[4]=n[4]-r[4],t[5]=n[5]-r[5],t}Object.defineProperty(n,"__esModule",{value:!0}),n.sub=n.mul=void 0,n.create=function(){var t=new a.ARRAY_TYPE(6);return a.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t},n.clone=function(t){var n=new a.ARRAY_TYPE(6);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n},n.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t},n.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},n.fromValues=function(t,n,r,e,u,o){var i=new a.ARRAY_TYPE(6);return i[0]=t,i[1]=n,i[2]=r,i[3]=e,i[4]=u,i[5]=o,i},n.set=function(t,n,r,a,e,u,o){return t[0]=n,t[1]=r,t[2]=a,t[3]=e,t[4]=u,t[5]=o,t},n.invert=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],s=r*u-a*e;return s?(s=1/s,t[0]=u*s,t[1]=-a*s,t[2]=-e*s,t[3]=r*s,t[4]=(e*i-u*o)*s,t[5]=(a*o-r*i)*s,t):null},n.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},n.multiply=e,n.rotate=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],s=n[5],c=Math.sin(r),f=Math.cos(r);return t[0]=a*f+u*c,t[1]=e*f+o*c,t[2]=a*-c+u*f,t[3]=e*-c+o*f,t[4]=i,t[5]=s,t},n.scale=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],s=n[5],c=r[0],f=r[1];return t[0]=a*c,t[1]=e*c,t[2]=u*f,t[3]=o*f,t[4]=i,t[5]=s,t},n.translate=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],s=n[5],c=r[0],f=r[1];return t[0]=a,t[1]=e,t[2]=u,t[3]=o,t[4]=a*c+u*f+i,t[5]=e*c+o*f+s,t},n.fromRotation=function(t,n){var r=Math.sin(n),a=Math.cos(n);return t[0]=a,t[1]=r,t[2]=-r,t[3]=a,t[4]=0,t[5]=0,t},n.fromScaling=function(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=n[1],t[4]=0,t[5]=0,t},n.fromTranslation=function(t,n){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=n[0],t[5]=n[1],t},n.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},n.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+1)},n.add=function(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2],t[3]=n[3]+r[3],t[4]=n[4]+r[4],t[5]=n[5]+r[5],t},n.subtract=u,n.multiplyScalar=function(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=n[3]*r,t[4]=n[4]*r,t[5]=n[5]*r,t},n.multiplyScalarAndAdd=function(t,n,r,a){return t[0]=n[0]+r[0]*a,t[1]=n[1]+r[1]*a,t[2]=n[2]+r[2]*a,t[3]=n[3]+r[3]*a,t[4]=n[4]+r[4]*a,t[5]=n[5]+r[5]*a,t},n.exactEquals=function(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]&&t[4]===n[4]&&t[5]===n[5]},n.equals=function(t,n){var r=t[0],e=t[1],u=t[2],o=t[3],i=t[4],s=t[5],c=n[0],f=n[1],M=n[2],h=n[3],l=n[4],v=n[5];return Math.abs(r-c)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(e-f)<=a.EPSILON*Math.max(1,Math.abs(e),Math.abs(f))&&Math.abs(u-M)<=a.EPSILON*Math.max(1,Math.abs(u),Math.abs(M))&&Math.abs(o-h)<=a.EPSILON*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(i-l)<=a.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(s-v)<=a.EPSILON*Math.max(1,Math.abs(s),Math.abs(v))};var a=function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}(r(0));n.mul=e,n.sub=u},function(t,n,r){"use strict";function e(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=r[0],s=r[1],c=r[2],f=r[3];return t[0]=a*i+u*s,t[1]=e*i+o*s,t[2]=a*c+u*f,t[3]=e*c+o*f,t}function u(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t[3]=n[3]-r[3],t}Object.defineProperty(n,"__esModule",{value:!0}),n.sub=n.mul=void 0,n.create=function(){var t=new a.ARRAY_TYPE(4);return a.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},n.clone=function(t){var n=new a.ARRAY_TYPE(4);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n},n.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t},n.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},n.fromValues=function(t,n,r,e){var u=new a.ARRAY_TYPE(4);return u[0]=t,u[1]=n,u[2]=r,u[3]=e,u},n.set=function(t,n,r,a,e){return t[0]=n,t[1]=r,t[2]=a,t[3]=e,t},n.transpose=function(t,n){if(t===n){var r=n[1];t[1]=n[2],t[2]=r}else t[0]=n[0],t[1]=n[2],t[2]=n[1],t[3]=n[3];return t},n.invert=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=r*u-e*a;return o?(o=1/o,t[0]=u*o,t[1]=-a*o,t[2]=-e*o,t[3]=r*o,t):null},n.adjoint=function(t,n){var r=n[0];return t[0]=n[3],t[1]=-n[1],t[2]=-n[2],t[3]=r,t},n.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},n.multiply=e,n.rotate=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=Math.sin(r),s=Math.cos(r);return t[0]=a*s+u*i,t[1]=e*s+o*i,t[2]=a*-i+u*s,t[3]=e*-i+o*s,t},n.scale=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=r[0],s=r[1];return t[0]=a*i,t[1]=e*i,t[2]=u*s,t[3]=o*s,t},n.fromRotation=function(t,n){var r=Math.sin(n),a=Math.cos(n);return t[0]=a,t[1]=r,t[2]=-r,t[3]=a,t},n.fromScaling=function(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=n[1],t},n.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},n.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2))},n.LDU=function(t,n,r,a){return t[2]=a[2]/a[0],r[0]=a[0],r[1]=a[1],r[3]=a[3]-t[2]*r[1],[t,n,r]},n.add=function(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2],t[3]=n[3]+r[3],t},n.subtract=u,n.exactEquals=function(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]},n.equals=function(t,n){var r=t[0],e=t[1],u=t[2],o=t[3],i=n[0],s=n[1],c=n[2],f=n[3];return Math.abs(r-i)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(e-s)<=a.EPSILON*Math.max(1,Math.abs(e),Math.abs(s))&&Math.abs(u-c)<=a.EPSILON*Math.max(1,Math.abs(u),Math.abs(c))&&Math.abs(o-f)<=a.EPSILON*Math.max(1,Math.abs(o),Math.abs(f))},n.multiplyScalar=function(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=n[3]*r,t},n.multiplyScalarAndAdd=function(t,n,r,a){return t[0]=n[0]+r[0]*a,t[1]=n[1]+r[1]*a,t[2]=n[2]+r[2]*a,t[3]=n[3]+r[3]*a,t};var a=function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}(r(0));n.mul=e,n.sub=u},function(t,n,r){"use strict";function l(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}Object.defineProperty(n,"__esModule",{value:!0}),n.vec4=n.vec3=n.vec2=n.quat2=n.quat=n.mat4=n.mat3=n.mat2d=n.mat2=n.glMatrix=void 0;var a=l(r(0)),e=l(r(9)),u=l(r(8)),o=l(r(5)),i=l(r(4)),s=l(r(3)),c=l(r(7)),f=l(r(6)),M=l(r(2)),h=l(r(1));n.glMatrix=a,n.mat2=e,n.mat2d=u,n.mat3=o,n.mat4=i,n.quat=s,n.quat2=c,n.vec2=f,n.vec3=M,n.vec4=h}])})},{}],40:[function(require,module,exports){"use strict";function Shader(gl){this.gl=gl,this.gl.lastAttribCount=0,this._vref=this._fref=this._relink=this.vertShader=this.fragShader=this.program=this.attributes=this.uniforms=this.types=null}function compareAttributes(a,b){return a.name<b.name?-1:1}function createShader(gl,vertSource,fragSource,uniforms,attributes){var shader=new Shader(gl);return shader.update(vertSource,fragSource,uniforms,attributes),shader}var createUniformWrapper=require("./lib/create-uniforms"),createAttributeWrapper=require("./lib/create-attributes"),makeReflect=require("./lib/reflect"),shaderCache=require("./lib/shader-cache"),runtime=require("./lib/runtime-reflect"),GLError=require("./lib/GLError"),proto=Shader.prototype;proto.bind=function(){this.program||this._relink();var i,newAttribCount=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_ATTRIBUTES),oldAttribCount=this.gl.lastAttribCount;if(newAttribCount>oldAttribCount)for(i=oldAttribCount;i<newAttribCount;i++)this.gl.enableVertexAttribArray(i);else if(oldAttribCount>newAttribCount)for(i=newAttribCount;i<oldAttribCount;i++)this.gl.disableVertexAttribArray(i);this.gl.lastAttribCount=newAttribCount,this.gl.useProgram(this.program)},proto.dispose=function(){for(var oldAttribCount=this.gl.lastAttribCount,i=0;i<oldAttribCount;i++)this.gl.disableVertexAttribArray(i);this.gl.lastAttribCount=0,this._fref&&this._fref.dispose(),this._vref&&this._vref.dispose(),this.attributes=this.types=this.vertShader=this.fragShader=this.program=this._relink=this._fref=this._vref=null},proto.update=function(vertSource,fragSource,uniforms,attributes){function relink(){wrapper.program=shaderCache.program(gl,wrapper._vref,wrapper._fref,attributeNames,attributeLocations);for(var i=0;i<uniforms.length;++i)uniformLocations[i]=gl.getUniformLocation(wrapper.program,uniforms[i].name)}if(!fragSource||1===arguments.length){var obj=vertSource;vertSource=obj.vertex,fragSource=obj.fragment,uniforms=obj.uniforms,attributes=obj.attributes}var wrapper=this,gl=wrapper.gl,pvref=wrapper._vref;wrapper._vref=shaderCache.shader(gl,gl.VERTEX_SHADER,vertSource),pvref&&pvref.dispose(),wrapper.vertShader=wrapper._vref.shader;var pfref=this._fref;if(wrapper._fref=shaderCache.shader(gl,gl.FRAGMENT_SHADER,fragSource),pfref&&pfref.dispose(),wrapper.fragShader=wrapper._fref.shader,!uniforms||!attributes){var testProgram=gl.createProgram();if(gl.attachShader(testProgram,wrapper.fragShader),gl.attachShader(testProgram,wrapper.vertShader),gl.linkProgram(testProgram),!gl.getProgramParameter(testProgram,gl.LINK_STATUS)){var errLog=gl.getProgramInfoLog(testProgram);throw new GLError(errLog,"Error linking program:"+errLog)}uniforms=uniforms||runtime.uniforms(gl,testProgram),attributes=attributes||runtime.attributes(gl,testProgram),gl.deleteProgram(testProgram)}attributes=attributes.slice(),attributes.sort(compareAttributes);var i,attributeUnpacked=[],attributeNames=[],attributeLocations=[];for(i=0;i<attributes.length;++i){var attr=attributes[i];if(attr.type.indexOf("mat")>=0){for(var size=0|attr.type.charAt(attr.type.length-1),locVector=new Array(size),j=0;j<size;++j)locVector[j]=attributeLocations.length,attributeNames.push(attr.name+"["+j+"]"),"number"==typeof attr.location?attributeLocations.push(attr.location+j):Array.isArray(attr.location)&&attr.location.length===size&&"number"==typeof attr.location[j]?attributeLocations.push(0|attr.location[j]):attributeLocations.push(-1);attributeUnpacked.push({name:attr.name,type:attr.type,locations:locVector})}else attributeUnpacked.push({name:attr.name,type:attr.type,locations:[attributeLocations.length]}),attributeNames.push(attr.name),"number"==typeof attr.location?attributeLocations.push(0|attr.location):attributeLocations.push(-1)}var curLocation=0
;for(i=0;i<attributeLocations.length;++i)if(attributeLocations[i]<0){for(;attributeLocations.indexOf(curLocation)>=0;)curLocation+=1;attributeLocations[i]=curLocation}var uniformLocations=new Array(uniforms.length);relink(),wrapper._relink=relink,wrapper.types={uniforms:makeReflect(uniforms),attributes:makeReflect(attributes)},wrapper.attributes=createAttributeWrapper(gl,wrapper,attributeUnpacked,attributeLocations),Object.defineProperty(wrapper,"uniforms",createUniformWrapper(gl,wrapper,uniforms,uniformLocations))},module.exports=createShader},{"./lib/GLError":41,"./lib/create-attributes":42,"./lib/create-uniforms":43,"./lib/reflect":44,"./lib/runtime-reflect":45,"./lib/shader-cache":46}],41:[function(require,module,exports){function GLError(rawError,shortMessage,longMessage){this.shortMessage=shortMessage||"",this.longMessage=longMessage||"",this.rawError=rawError||"",this.message="gl-shader: "+(shortMessage||rawError||"")+(longMessage?"\n"+longMessage:""),this.stack=(new Error).stack}GLError.prototype=new Error,GLError.prototype.name="GLError",GLError.prototype.constructor=GLError,module.exports=GLError},{}],42:[function(require,module,exports){"use strict";function ShaderAttribute(gl,wrapper,index,locations,dimension,constFunc){this._gl=gl,this._wrapper=wrapper,this._index=index,this._locations=locations,this._dimension=dimension,this._constFunc=constFunc}function addVectorAttribute(gl,wrapper,index,locations,dimension,obj,name){for(var constFuncArgs=["gl","v"],varNames=[],i=0;i<dimension;++i)constFuncArgs.push("x"+i),varNames.push("x"+i);constFuncArgs.push("if(x0.length===void 0){return gl.vertexAttrib"+dimension+"f(v,"+varNames.join()+")}else{return gl.vertexAttrib"+dimension+"fv(v,x0)}");var constFunc=Function.apply(null,constFuncArgs),attr=new ShaderAttribute(gl,wrapper,index,locations,dimension,constFunc);Object.defineProperty(obj,name,{set:function(x){return gl.disableVertexAttribArray(locations[index]),constFunc(gl,locations[index],x),x},get:function(){return attr},enumerable:!0})}function addMatrixAttribute(gl,wrapper,index,locations,dimension,obj,name){for(var parts=new Array(dimension),attrs=new Array(dimension),i=0;i<dimension;++i)addVectorAttribute(gl,wrapper,index[i],locations,dimension,parts,i),attrs[i]=parts[i];Object.defineProperty(parts,"location",{set:function(v){if(Array.isArray(v))for(var i=0;i<dimension;++i)attrs[i].location=v[i];else for(var i=0;i<dimension;++i)attrs[i].location=v+i;return v},get:function(){for(var result=new Array(dimension),i=0;i<dimension;++i)result[i]=locations[index[i]];return result},enumerable:!0}),parts.pointer=function(type,normalized,stride,offset){type=type||gl.FLOAT,normalized=!!normalized,stride=stride||dimension*dimension,offset=offset||0;for(var i=0;i<dimension;++i){var location=locations[index[i]];gl.vertexAttribPointer(location,dimension,type,normalized,stride,offset+i*dimension),gl.enableVertexAttribArray(location)}};var scratch=new Array(dimension),vertexAttrib=gl["vertexAttrib"+dimension+"fv"];Object.defineProperty(obj,name,{set:function(x){for(var i=0;i<dimension;++i){var loc=locations[index[i]];if(gl.disableVertexAttribArray(loc),Array.isArray(x[0]))vertexAttrib.call(gl,loc,x[i]);else{for(var j=0;j<dimension;++j)scratch[j]=x[dimension*i+j];vertexAttrib.call(gl,loc,scratch)}}return x},get:function(){return parts},enumerable:!0})}function createAttributeWrapper(gl,wrapper,attributes,locations){for(var obj={},i=0,n=attributes.length;i<n;++i){var a=attributes[i],name=a.name,type=a.type,locs=a.locations;switch(type){case"bool":case"int":case"float":addVectorAttribute(gl,wrapper,locs[0],locations,1,obj,name);break;default:if(type.indexOf("vec")>=0){var d=type.charCodeAt(type.length-1)-48;if(d<2||d>4)throw new GLError("","Invalid data type for attribute "+name+": "+type);addVectorAttribute(gl,wrapper,locs[0],locations,d,obj,name)}else{if(!(type.indexOf("mat")>=0))throw new GLError("","Unknown data type for attribute "+name+": "+type);var d=type.charCodeAt(type.length-1)-48;if(d<2||d>4)throw new GLError("","Invalid data type for attribute "+name+": "+type);addMatrixAttribute(gl,wrapper,locs,locations,d,obj,name)}}}return obj}module.exports=createAttributeWrapper;var GLError=require("./GLError"),proto=ShaderAttribute.prototype;proto.pointer=function(type,normalized,stride,offset){var self=this,gl=self._gl,location=self._locations[self._index];gl.vertexAttribPointer(location,self._dimension,type||gl.FLOAT,!!normalized,stride||0,offset||0),gl.enableVertexAttribArray(location)},proto.set=function(x0,x1,x2,x3){return this._constFunc(this._locations[this._index],x0,x1,x2,x3)},Object.defineProperty(proto,"location",{get:function(){return this._locations[this._index]},set:function(v){return v!==this._locations[this._index]&&(this._locations[this._index]=0|v,this._wrapper.program=null),0|v}})},{"./GLError":41}],43:[function(require,module,exports){"use strict";function identity(x){return new Function("y","return function(){return y}")(x)}function makeVector(length,fill){for(var result=new Array(length),i=0;i<length;++i)result[i]=fill;return result}function createUniformWrapper(gl,wrapper,uniforms,locations){function makeGetter(index){return new Function("gl","wrapper","locations","return function(){return gl.getUniform(wrapper.program,locations["+index+"])}")(gl,wrapper,locations)}function makePropSetter(path,index,type){switch(type){case"bool":case"int":case"sampler2D":case"samplerCube":return"gl.uniform1i(locations["+index+"],obj"+path+")";case"float":return"gl.uniform1f(locations["+index+"],obj"+path+")";default:var vidx=type.indexOf("vec");if(!(0<=vidx&&vidx<=1&&type.length===4+vidx)){if(0===type.indexOf("mat")&&4===type.length){var d=type.charCodeAt(type.length-1)-48;if(d<2||d>4)throw new GLError("","Invalid uniform dimension type for matrix "+name+": "+type);return"gl.uniformMatrix"+d+"fv(locations["+index+"],false,obj"+path+")"}throw new GLError("","Unknown uniform data type for "+name+": "+type)}var d=type.charCodeAt(type.length-1)-48;if(d<2||d>4)throw new GLError("","Invalid data type");switch(type.charAt(0)){case"b":case"i":return"gl.uniform"+d+"iv(locations["+index+"],obj"+path+")";case"v":return"gl.uniform"+d+"fv(locations["+index+"],obj"+path+")";default:throw new GLError("","Unrecognized data type for vector "+name+": "+type)}}}function enumerateIndices(prefix,type){if("object"!=typeof type)return[[prefix,type]];var indices=[];for(var id in type){var prop=type[id],tprefix=prefix;parseInt(id)+""===id?tprefix+="["+id+"]":tprefix+="."+id,"object"==typeof prop?indices.push.apply(indices,enumerateIndices(tprefix,prop)):indices.push([tprefix,prop])}return indices}function makeSetter(type){for(var code=["return function updateProperty(obj){"],indices=enumerateIndices("",type),i=0;i<indices.length;++i){var item=indices[i],path=item[0],idx=item[1];locations[idx]&&code.push(makePropSetter(path,idx,uniforms[idx].type))}return code.push("return obj}"),new Function("gl","locations",code.join("\n"))(gl,locations)}function defaultValue(type){switch(type){case"bool":return!1;case"int":case"sampler2D":case"samplerCube":case"float":return 0;default:var vidx=type.indexOf("vec");if(0<=vidx&&vidx<=1&&type.length===4+vidx){var d=type.charCodeAt(type.length-1)-48;if(d<2||d>4)throw new GLError("","Invalid data type");return"b"===type.charAt(0)?makeVector(d,!1):makeVector(d,0)}if(0===type.indexOf("mat")&&4===type.length){var d=type.charCodeAt(type.length-1)-48;if(d<2||d>4)throw new GLError("","Invalid uniform dimension type for matrix "+name+": "+type);return makeVector(d*d,0)}throw new GLError("","Unknown uniform data type for "+name+": "+type)}}function storeProperty(obj,prop,type){if("object"==typeof type){var child=processObject(type);Object.defineProperty(obj,prop,{get:identity(child),set:makeSetter(type),enumerable:!0,configurable:!1})}else locations[type]?Object.defineProperty(obj,prop,{get:makeGetter(type),set:makeSetter(type),enumerable:!0,configurable:!1}):obj[prop]=defaultValue(uniforms[type].type)}function processObject(obj){var result;if(Array.isArray(obj)){result=new Array(obj.length);for(var i=0;i<obj.length;++i)storeProperty(result,i,obj[i])}else{result={};for(var id in obj)storeProperty(result,id,obj[id])}return result}var coallesced=coallesceUniforms(uniforms,!0);return{get:identity(processObject(coallesced)),set:makeSetter(coallesced),enumerable:!0,configurable:!0}}var coallesceUniforms=require("./reflect"),GLError=require("./GLError");module.exports=createUniformWrapper},{"./GLError":41,"./reflect":44}],44:[function(require,module,exports){"use strict";function makeReflectTypes(uniforms,useIndex){for(var obj={},i=0;i<uniforms.length;++i)for(var n=uniforms[i].name,parts=n.split("."),o=obj,j=0;j<parts.length;++j){var x=parts[j].split("[");if(x.length>1){x[0]in o||(o[x[0]]=[]),o=o[x[0]];for(var k=1;k<x.length;++k){var y=parseInt(x[k]);k<x.length-1||j<parts.length-1?(y in o||(k<x.length-1?o[y]=[]:o[y]={}),o=o[y]):o[y]=useIndex?i:uniforms[i].type}}else j<parts.length-1?(x[0]in o||(o[x[0]]={}),o=o[x[0]]):o[x[0]]=useIndex?i:uniforms[i].type}return obj}module.exports=makeReflectTypes},{}],45:[function(require,module,exports){"use strict";function getType(gl,type){if(!GL_TABLE){var typeNames=Object.keys(GL_TO_GLSL_TYPES);GL_TABLE={};for(var i=0;i<typeNames.length;++i){var tn=typeNames[i];GL_TABLE[gl[tn]]=GL_TO_GLSL_TYPES[tn]}}return GL_TABLE[type]}function runtimeUniforms(gl,program){for(var numUniforms=gl.getProgramParameter(program,gl.ACTIVE_UNIFORMS),result=[],i=0;i<numUniforms;++i){var info=gl.getActiveUniform(program,i);if(info){var type=getType(gl,info.type);if(info.size>1)for(var j=0;j<info.size;++j)result.push({name:info.name.replace("[0]","["+j+"]"),type:type});else result.push({name:info.name,type:type})}}return result}function runtimeAttributes(gl,program){for(var numAttributes=gl.getProgramParameter(program,gl.ACTIVE_ATTRIBUTES),result=[],i=0;i<numAttributes;++i){var info=gl.getActiveAttrib(program,i);info&&result.push({name:info.name,type:getType(gl,info.type)})}return result}exports.uniforms=runtimeUniforms,exports.attributes=runtimeAttributes;var GL_TO_GLSL_TYPES={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},GL_TABLE=null},{}],46:[function(require,module,exports){"use strict";function ShaderReference(id,src,type,shader,programs,count,cache){this.id=id,this.src=src,this.type=type,this.shader=shader,this.count=count,this.programs=[],this.cache=cache}function ContextCache(gl){this.gl=gl,this.shaders=[{},{}],this.programs={}}function compileShader(gl,type,src){var shader=gl.createShader(type);if(gl.shaderSource(shader,src),gl.compileShader(shader),!gl.getShaderParameter(shader,gl.COMPILE_STATUS)){var errLog=gl.getShaderInfoLog(shader);try{var fmt=formatCompilerError(errLog,src,type)}catch(e){throw console.warn("Failed to format compiler error: "+e),new GLError(errLog,"Error compiling shader:\n"+errLog)}throw new GLError(errLog,fmt.short,fmt.long)}return shader}function linkProgram(gl,vshader,fshader,attribs,locations){var program=gl.createProgram();gl.attachShader(program,vshader),gl.attachShader(program,fshader);for(var i=0;i<attribs.length;++i)gl.bindAttribLocation(program,locations[i],attribs[i]);if(gl.linkProgram(program),!gl.getProgramParameter(program,gl.LINK_STATUS)){var errLog=gl.getProgramInfoLog(program);throw new GLError(errLog,"Error linking program: "+errLog)}return program}function getCache(gl){var ctxCache=CACHE.get(gl);return ctxCache||(ctxCache=new ContextCache(gl),CACHE.set(gl,ctxCache)),ctxCache}function getShaderReference(gl,type,src){return getCache(gl).getShaderReference(type,src)}function createProgram(gl,vref,fref,attribs,locations){return getCache(gl).getProgram(vref,fref,attribs,locations)}exports.shader=getShaderReference,exports.program=createProgram;var GLError=require("./GLError"),formatCompilerError=require("gl-format-compiler-error"),weakMap="undefined"==typeof WeakMap?require("weakmap-shim"):WeakMap,CACHE=new weakMap,SHADER_COUNTER=0;ShaderReference.prototype.dispose=function(){if(0==--this.count){for(var cache=this.cache,gl=cache.gl,programs=this.programs,i=0,n=programs.length;i<n;++i){var p=cache.programs[programs[i]];p&&(delete cache.programs[i],gl.deleteProgram(p))}gl.deleteShader(this.shader),delete cache.shaders[this.type===gl.FRAGMENT_SHADER|0][this.src]}};var proto=ContextCache.prototype;proto.getShaderReference=function(type,src){var gl=this.gl,shaders=this.shaders[type===gl.FRAGMENT_SHADER|0],shader=shaders[src];if(shader&&gl.isShader(shader.shader))shader.count+=1;else{var shaderObj=compileShader(gl,type,src);shader=shaders[src]=new ShaderReference(SHADER_COUNTER++,src,type,shaderObj,[],1,this)}return shader},proto.getProgram=function(vref,fref,attribs,locations){var token=[vref.id,fref.id,attribs.join(":"),locations.join(":")].join("@"),prog=this.programs[token];return prog&&this.gl.isProgram(prog)||(this.programs[token]=prog=linkProgram(this.gl,vref.shader,fref.shader,attribs,locations),vref.programs.push(token),fref.programs.push(token)),prog}},{"./GLError":41,"gl-format-compiler-error":28,"weakmap-shim":105}],47:[function(require,module,exports){arguments[4][8][0].apply(exports,arguments)},{dup:8}],48:[function(require,module,exports){arguments[4][16][0].apply(exports,arguments)},{dup:16}],49:[function(require,module,exports){arguments[4][37][0].apply(exports,arguments)},{"bit-twiddle":47,buffer:108,dup:37}],50:[function(require,module,exports){arguments[4][27][0].apply(exports,arguments)},{dup:27,"weak-map":102}],51:[function(require,module,exports){"use strict";function lazyInitLinearTypes(gl){linearTypes=[gl.LINEAR,gl.NEAREST_MIPMAP_LINEAR,gl.LINEAR_MIPMAP_NEAREST,gl.LINEAR_MIPMAP_NEAREST],filterTypes=[gl.NEAREST,gl.LINEAR,gl.NEAREST_MIPMAP_NEAREST,gl.NEAREST_MIPMAP_LINEAR,gl.LINEAR_MIPMAP_NEAREST,gl.LINEAR_MIPMAP_LINEAR],wrapTypes=[gl.REPEAT,gl.CLAMP_TO_EDGE,gl.MIRRORED_REPEAT]}function Texture2D(gl,handle,width,height,format,type){this.gl=gl,this.handle=handle,this.format=format,this.type=type,this._shape=[height,width],this._mipLevels=[0],this._magFilter=gl.NEAREST,this._minFilter=gl.NEAREST,this._wrapS=gl.CLAMP_TO_EDGE,this._wrapT=gl.CLAMP_TO_EDGE,this._anisoSamples=1}function texSubImageArray(gl,x_off,y_off,mip_level,cformat,ctype,mipLevels,array){var dtype=array.dtype,shape=array.shape,packed=isPacked(array),type=0,format=0;if("float32"===dtype?type=gl.FLOAT:"float64"===dtype?(type=gl.FLOAT,packed=!1,dtype="float32"):"uint8"===dtype?type=gl.UNSIGNED_BYTE:(type=gl.UNSIGNED_BYTE,packed=!1,dtype="uint8"),2===shape.length)format=gl.LUMINANCE;else{if(3!==shape.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===shape[2])format=gl.ALPHA;else if(2===shape[2])format=gl.LUMINANCE_ALPHA;else if(3===shape[2])format=gl.RGB;else{if(4!==shape[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");format=gl.RGBA}}if(format!==gl.LUMINANCE&&format!==gl.ALPHA||cformat!==gl.LUMINANCE&&cformat!==gl.ALPHA||(format=cformat),format!==cformat)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var size=array.size,needsMip=mipLevels.indexOf(mip_level)<0;if(needsMip&&mipLevels.push(mip_level),type===ctype&&packed)0===array.offset&&array.data.length===size?needsMip?gl.texImage2D(gl.TEXTURE_2D,mip_level,cformat,shape[1],shape[0],0,cformat,ctype,array.data):gl.texSubImage2D(gl.TEXTURE_2D,mip_level,x_off,y_off,shape[1],shape[0],cformat,ctype,array.data):needsMip?gl.texImage2D(gl.TEXTURE_2D,mip_level,cformat,shape[1],shape[0],0,cformat,ctype,array.data.subarray(array.offset,array.offset+size)):gl.texSubImage2D(gl.TEXTURE_2D,mip_level,x_off,y_off,shape[1],shape[0],cformat,ctype,array.data.subarray(array.offset,array.offset+size));else{var pack_buffer;pack_buffer=ctype===gl.FLOAT?pool.mallocFloat32(size):pool.mallocUint8(size);var pack_view=ndarray(pack_buffer,shape);type===gl.FLOAT&&ctype===gl.UNSIGNED_BYTE?convertFloatToUint8(pack_view,array):ops.assign(pack_view,array),needsMip?gl.texImage2D(gl.TEXTURE_2D,mip_level,cformat,shape[1],shape[0],0,cformat,ctype,pack_buffer.subarray(0,size)):gl.texSubImage2D(gl.TEXTURE_2D,mip_level,x_off,y_off,shape[1],shape[0],cformat,ctype,pack_buffer.subarray(0,size)),ctype===gl.FLOAT?pool.freeFloat32(pack_buffer):pool.freeUint8(pack_buffer)}}function initTexture(gl){var tex=gl.createTexture();return gl.bindTexture(gl.TEXTURE_2D,tex),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.NEAREST),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.NEAREST),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE),tex}function createTextureShape(gl,width,height,format,type){var maxTextureSize=gl.getParameter(gl.MAX_TEXTURE_SIZE);if(width<0||width>maxTextureSize||height<0||height>maxTextureSize)throw new Error("gl-texture2d: Invalid texture shape");var tex=initTexture(gl);return gl.texImage2D(gl.TEXTURE_2D,0,format,width,height,0,format,type,null),new Texture2D(gl,tex,width,height,format,type)}function createTextureDOM(gl,element,format,type){var tex=initTexture(gl);return gl.texImage2D(gl.TEXTURE_2D,0,format,format,type,element),new Texture2D(gl,tex,0|element.width,0|element.height,format,type)}function isPacked(array){for(var shape=array.shape,stride=array.stride,s=1,i=shape.length-1;i>=0;--i){if(stride[i]!==s)return!1;s*=shape[i]}return!0}function createTextureArray(gl,array){var dtype=array.dtype,shape=array.shape.slice(),maxSize=gl.getParameter(gl.MAX_TEXTURE_SIZE);if(shape[0]<0||shape[0]>maxSize||shape[1]<0||shape[1]>maxSize)throw new Error("gl-texture2d: Invalid texture size");var packed=isPacked(array),type=0;"float32"===dtype?type=gl.FLOAT:"float64"===dtype?(type=gl.FLOAT,packed=!1,dtype="float32"):"uint8"===dtype?type=gl.UNSIGNED_BYTE:(type=gl.UNSIGNED_BYTE,packed=!1,dtype="uint8");var format=0;if(2===shape.length)format=gl.LUMINANCE;else{if(3!==shape.length)throw new Error("Invalid shape for texture");if(1===shape[2])format=gl.ALPHA;else if(2===shape[2])format=gl.LUMINANCE_ALPHA;else if(3===shape[2])format=gl.RGB;else{if(4!==shape[2])throw new Error("Invalid shape for pixel coords");format=gl.RGBA}}type===gl.FLOAT&&webglew(gl).texture_float&&(type=gl.UNSIGNED_BYTE,packed=!1);var buffer,buf_store;if(packed){var array_size=array.size;buffer=array.data.subarray(array.offset,array.offset+array_size)}else{for(var sz=1,stride=new Array(shape.length),i=shape.length-1;i>=0;--i)stride[i]=sz,sz*=shape[i];buf_store=pool.malloc(sz,dtype);var buf_array=ndarray(buf_store,array.shape,stride,0);"float32"!==dtype&&"float64"!==dtype||type!==gl.UNSIGNED_BYTE?ops.assign(buf_array,array):convertFloatToUint8(buf_array,array),buffer=buf_store.subarray(0,sz)}var tex=initTexture(gl);return gl.texImage2D(gl.TEXTURE_2D,0,format,shape[1],shape[0],0,format,type,buffer),packed||pool.free(buf_store),new Texture2D(gl,tex,shape[1],shape[0],format,type)}function createTexture2D(gl){if(arguments.length<=1)throw new Error("Missing arguments for texture2d constructor");if(linearTypes||lazyInitLinearTypes(gl),"number"==typeof arguments[1])return createTextureShape(gl,arguments[1],arguments[2],arguments[3]||gl.RGBA,arguments[4]||gl.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return createTextureShape(gl,0|arguments[1][1],0|arguments[1][0],arguments[2]||gl.RGBA,arguments[4]||gl.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var obj=arguments[1];if(obj instanceof HTMLCanvasElement||obj instanceof HTMLImageElement||obj instanceof HTMLVideoElement||obj instanceof ImageData)return createTextureDOM(gl,obj,arguments[2]||gl.RGBA,arguments[3]||gl.UNSIGNED_BYTE);if(obj.shape&&obj.data&&obj.stride)return createTextureArray(gl,obj)}throw new Error("Invalid arguments for texture2d constructor")}var ndarray=require("ndarray"),ops=require("ndarray-ops"),pool=require("typedarray-pool"),webglew=require("webglew"),linearTypes=null,filterTypes=null,wrapTypes=null,convertFloatToUint8=function(out,inp){ops.muls(out,inp,255)};Object.defineProperty(Texture2D.prototype,"minFilter",{get:function(){return this._minFilter},set:function(v){this.bind();var gl=this.gl;if(this.type===gl.FLOAT&&linearTypes.indexOf(v)>=0&&(webglew(gl).OES_texture_float_linear||(v=gl.NEAREST)),filterTypes.indexOf(v)<0)throw new Error("gl-texture2d: Unknown filter mode "+v);return gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,v),this._minFilter=v}});var proto=Texture2D.prototype;Object.defineProperty(proto,"magFilter",{get:function(){return this._magFilter},set:function(v){this.bind();var gl=this.gl;if(this.type===gl.FLOAT&&linearTypes.indexOf(v)>=0&&(webglew(gl).OES_texture_float_linear||(v=gl.NEAREST)),filterTypes.indexOf(v)<0)throw new Error("gl-texture2d: Unknown filter mode "+v);return gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,v),this._magFilter=v}}),Object.defineProperty(proto,"wrapS",{get:function(){return this._wrapS},set:function(v){if(this.bind(),wrapTypes.indexOf(v)<0)throw new Error("gl-texture2d: Unknown wrap mode "+v);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,v),this._wrapS=v}}),Object.defineProperty(proto,"wrapT",{get:function(){return this._wrapT},set:function(v){if(this.bind(),wrapTypes.indexOf(v)<0)throw new Error("gl-texture2d: Unknown wrap mode "+v);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,v),this._wrapT=v}}),Object.defineProperty(proto,"wrap",{get:function(){return[this._wrapT,this._wrapS]},set:function(v){if(Array.isArray(v)||(v=[v,v]),2!==v.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var i=0;i<2;++i)if(wrapTypes.indexOf(v[i])<0)throw new Error("gl-texture2d: Unknown wrap mode "+v);this._wrapT=v[0],this._wrapS=v[1];var gl=this.gl;return this.bind(),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,this._wrapT),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,this._wrapS),v}}),Object.defineProperty(proto,"mipSamples",{get:function(){return this._anisoSamples},set:function(i){var psamples=this._anisoSamples;if(this._anisoSamples=0|Math.max(i,1),psamples!==this._anisoSamples){var ext=webglew(this.gl).EXT_texture_filter_anisotropic;ext&&this.gl.texParameterf(this.gl.TEXTURE_2D,ext.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}}),Object.defineProperty(proto,"shape",{get:function(){return this._shape},set:function(x){if(Array.isArray(x)){if(2!==x.length)throw new Error("gl-texture2d: Invalid texture shape")}else x=[0|x,0|x];var r=0|x[0],c=0|x[1];if(this.height===r&&this.width===c)return x;var gl=this.gl,maxSize=gl.getParameter(gl.MAX_TEXTURE_SIZE);if(c<0||c>maxSize||r<0||r>maxSize)throw new Error("gl-texture2d: Invalid texture size");return this._shape=[r,c],this.bind(),gl.texImage2D(gl.TEXTURE_2D,0,this.format,c,r,0,this.format,this.type,null),this._mipLevels=[0],x}}),proto.bind=function(unit){var gl=this.gl;return void 0!==unit&&gl.activeTexture(gl.TEXTURE0+(0|unit)),gl.bindTexture(gl.TEXTURE_2D,this.handle),void 0!==unit?unit:gl.getParameter(gl.ACTIVE_TEXTURE)-gl.TEXTURE0},proto.dispose=function(){this.gl.deleteTexture(this.handle)},proto.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var l=Math.min(this._shape[0],this._shape[1]),i=0;l>0;++i,l>>>=1)this._mipLevels.indexOf(i)<0&&this._mipLevels.push(i)},proto.setPixels=function(data,x_off,y_off,mip_level){var gl=this.gl;if(this.bind(),Array.isArray(x_off)?(mip_level=y_off,y_off=0|x_off[0],x_off=0|x_off[1]):(x_off=x_off||0,y_off=y_off||0),mip_level=mip_level||0,data instanceof HTMLCanvasElement||data instanceof ImageData||data instanceof HTMLImageElement||data instanceof HTMLVideoElement){this._mipLevels.indexOf(mip_level)<0?(gl.texImage2D(gl.TEXTURE_2D,0,this.format,this.format,this.type,data),this._mipLevels.push(mip_level)):gl.texSubImage2D(gl.TEXTURE_2D,mip_level,x_off,y_off,this.format,this.type,data)}else{if(!(data.shape&&data.stride&&data.data))throw new Error("gl-texture2d: Unsupported data type");if(data.shape.length<2||x_off+data.shape[1]>this._shape[1]>>>mip_level||y_off+data.shape[0]>this._shape[0]>>>mip_level||x_off<0||y_off<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");texSubImageArray(gl,x_off,y_off,mip_level,this.format,this.type,this._mipLevels,data)}},module.exports=createTexture2D},{ndarray:70,"ndarray-ops":69,"typedarray-pool":49,webglew:50}],52:[function(require,module,exports){"use strict";function doBind(gl,elements,attributes){elements?elements.bind():gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,null);var nattribs=0|gl.getParameter(gl.MAX_VERTEX_ATTRIBS);if(attributes){if(attributes.length>nattribs)throw new Error("Too many vertex attributes");for(var i=0;i<attributes.length;++i){var attrib=attributes[i];if(attrib.buffer){var buffer=attrib.buffer,size=attrib.size||4,type=attrib.type||gl.FLOAT,normalized=!!attrib.normalized,stride=attrib.stride||0,offset=attrib.offset||0;buffer.bind(),gl.vertexAttribPointer(i,size,type,normalized,stride,offset),gl.enableVertexAttribArray(i)}else{if("number"==typeof attrib)gl.vertexAttrib1f(i,attrib);else if(1===attrib.length)gl.vertexAttrib1f(i,attrib[0]);else if(2===attrib.length)gl.vertexAttrib2f(i,attrib[0],attrib[1]);else if(3===attrib.length)gl.vertexAttrib3f(i,attrib[0],attrib[1],attrib[2]);else{if(4!==attrib.length)throw new Error("Invalid vertex attribute");gl.vertexAttrib4f(i,attrib[0],attrib[1],attrib[2],attrib[3])}gl.disableVertexAttribArray(i)}}for(;i<nattribs;++i)gl.disableVertexAttribArray(i)}else{gl.bindBuffer(gl.ARRAY_BUFFER,null);for(var i=0;i<nattribs;++i)gl.disableVertexAttribArray(i)}}module.exports=doBind},{}],53:[function(require,module,exports){"use strict";function VAOEmulated(gl){this.gl=gl,this.elements=null,this.attributes=null}function createVAOEmulated(gl){return new VAOEmulated(gl)}var bindAttribs=require("./do-bind.js");VAOEmulated.prototype.bind=function(){bindAttribs(this.gl,this.elements,this.attributes)},VAOEmulated.prototype.update=function(elements,attributes){this.elements=elements,this.attributes=attributes},VAOEmulated.prototype.dispose=function(){},VAOEmulated.prototype.unbind=function(){},module.exports=createVAOEmulated},{"./do-bind.js":52}],54:[function(require,module,exports){"use strict";function VAONative(gl,ext,handle){this.gl=gl,this.ext=ext,this.handle=handle}function createVAONative(gl,ext){return new VAONative(gl,ext,ext.createVertexArrayOES())}var bindAttribs=require("./do-bind.js");VAONative.prototype.bind=function(){this.ext.bindVertexArrayOES(this.handle)},VAONative.prototype.unbind=function(){this.ext.bindVertexArrayOES(null)},VAONative.prototype.dispose=function(){this.ext.deleteVertexArrayOES(this.handle)},VAONative.prototype.update=function(elements,attributes){this.bind(),bindAttribs(this.gl,elements,attributes),this.unbind()},module.exports=createVAONative},{"./do-bind.js":52}],55:[function(require,module,exports){"use strict";function createVAO(gl,elements,attributes){var vao,ext=webglew(gl).OES_vertex_array_object;return vao=ext?createVAONative(gl,ext):createVAOEmulated(gl),vao.update(elements,attributes),vao}var webglew=require("webglew"),createVAONative=require("./lib/vao-native.js"),createVAOEmulated=require("./lib/vao-emulated.js");module.exports=createVAO},{"./lib/vao-emulated.js":53,"./lib/vao-native.js":54,webglew:106}],56:[function(require,module,exports){function getName(src){for(var tokens=Array.isArray(src)?src:tokenize(src),i=0;i<tokens.length;i++){var token=tokens[i];if("preprocessor"===token.type){var match=token.data.match(/\#define\s+SHADER_NAME(_B64)?\s+(.+)$/);if(match&&match[2]){var b64=match[1],name=match[2];return(b64?atob(name):name).trim()}}}}var tokenize=require("glsl-tokenizer"),atob=require("atob-lite");module.exports=getName},{"atob-lite":7,"glsl-tokenizer":63}],57:[function(require,module,exports){function tokenize(opt){function token(data){data.length&&tokens.push({type:map[mode],data:data,position:start,line:line,column:col})}function write(chunk){i=0,chunk.toString&&(chunk=chunk.toString()),input+=chunk.replace(/\r\n/g,"\n"),len=input.length;for(var last;c=input[i],i<len;){switch(last=i,mode){case BLOCK_COMMENT:i=block_comment();break;case LINE_COMMENT:i=line_comment();break;case PREPROCESSOR:i=preprocessor();break;case OPERATOR:i=operator();break;case INTEGER:i=integer();break;case HEX:i=hex();break;case FLOAT:i=decimal();break;case TOKEN:i=readtoken();break;case WHITESPACE:i=whitespace();break;case NORMAL:i=normal()}if(last!==i)switch(input[last]){case"\n":col=0,++line;break;default:++col}}return total+=i,input=input.slice(i),tokens}function end(chunk){return content.length&&token(content.join("")),mode=EOF,token("(eof)"),tokens}function normal(){return content=content.length?[]:content,"/"===last&&"*"===c?(start=total+i-1,mode=BLOCK_COMMENT,last=c,i+1):"/"===last&&"/"===c?(start=total+i-1,mode=LINE_COMMENT,last=c,i+1):"#"===c?(mode=PREPROCESSOR,start=total+i,i):/\s/.test(c)?(mode=WHITESPACE,start=total+i,i):(isnum=/\d/.test(c),isoperator=/[^\w_]/.test(c),start=total+i,mode=isnum?INTEGER:isoperator?OPERATOR:TOKEN,i)}function whitespace(){return/[^\s]/g.test(c)?(token(content.join("")),mode=NORMAL,i):(content.push(c),last=c,i+1)}function preprocessor(){return"\r"!==c&&"\n"!==c||"\\"===last?(content.push(c),last=c,i+1):(token(content.join("")),mode=NORMAL,i)}function line_comment(){return preprocessor()}function block_comment(){return"/"===c&&"*"===last?(content.push(c),token(content.join("")),mode=NORMAL,i+1):(content.push(c),last=c,i+1)}function operator(){if("."===last&&/\d/.test(c))return mode=FLOAT,i;if("/"===last&&"*"===c)return mode=BLOCK_COMMENT,i;if("/"===last&&"/"===c)return mode=LINE_COMMENT,i;if("."===c&&content.length){for(;determine_operator(content););return mode=FLOAT,i}if(";"===c||")"===c||"("===c){if(content.length)for(;determine_operator(content););return token(c),mode=NORMAL,i+1}var is_composite_operator=2===content.length&&"="!==c;if(/[\w_\d\s]/.test(c)||is_composite_operator){for(;determine_operator(content););return mode=NORMAL,i}return content.push(c),last=c,i+1}function determine_operator(buf){for(var idx,res,j=0;;){if(idx=operators.indexOf(buf.slice(0,buf.length+j).join("")),res=operators[idx],-1===idx){if(j--+buf.length>0)continue;res=buf.slice(0,1).join("")}return token(res),start+=res.length,content=content.slice(res.length),content.length}}function hex(){return/[^a-fA-F0-9]/.test(c)?(token(content.join("")),mode=NORMAL,i):(content.push(c),last=c,i+1)}function integer(){return"."===c?(content.push(c),mode=FLOAT,last=c,i+1):/[eE]/.test(c)?(content.push(c),mode=FLOAT,last=c,i+1):"x"===c&&1===content.length&&"0"===content[0]?(mode=HEX,content.push(c),last=c,i+1):/[^\d]/.test(c)?(token(content.join("")),mode=NORMAL,i):(content.push(c),last=c,i+1)}function decimal(){return"f"===c&&(content.push(c),last=c,i+=1),/[eE]/.test(c)?(content.push(c),last=c,i+1):("-"!==c&&"+"!==c||!/[eE]/.test(last))&&/[^\d]/.test(c)?(token(content.join("")),mode=NORMAL,i):(content.push(c),last=c,i+1)}function readtoken(){if(/[^\d\w_]/.test(c)){var contentstr=content.join("");return mode=literalsDict[contentstr]?KEYWORD:builtinsDict[contentstr]?BUILTIN:IDENT,token(content.join("")),mode=NORMAL,i}return content.push(c),last=c,i+1}var c,last,len,i=0,total=0,mode=NORMAL,content=[],tokens=[],line=1,col=0,start=0,isnum=!1,isoperator=!1,input="";opt=opt||{};var allBuiltins=builtins100,allLiterals=literals100;"300 es"===opt.version&&(allBuiltins=builtins300es,allLiterals=literals300es);for(var builtinsDict={},literalsDict={},i=0;i<allBuiltins.length;i++)builtinsDict[allBuiltins[i]]=!0;for(var i=0;i<allLiterals.length;i++)literalsDict[allLiterals[i]]=!0;return function(data){return tokens=[],null!==data?write(data):end()}}module.exports=tokenize
;var literals100=require("./lib/literals"),operators=require("./lib/operators"),builtins100=require("./lib/builtins"),literals300es=require("./lib/literals-300es"),builtins300es=require("./lib/builtins-300es"),NORMAL=999,TOKEN=9999,BLOCK_COMMENT=0,LINE_COMMENT=1,PREPROCESSOR=2,OPERATOR=3,INTEGER=4,FLOAT=5,IDENT=6,BUILTIN=7,KEYWORD=8,WHITESPACE=9,EOF=10,HEX=11,map=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":59,"./lib/builtins-300es":58,"./lib/literals":61,"./lib/literals-300es":60,"./lib/operators":62}],58:[function(require,module,exports){var v100=require("./builtins");v100=v100.slice().filter(function(b){return!/^(gl\_|texture)/.test(b)}),module.exports=v100.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"])},{"./builtins":59}],59:[function(require,module,exports){module.exports=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"]},{}],60:[function(require,module,exports){var v100=require("./literals");module.exports=v100.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"])},{"./literals":61}],61:[function(require,module,exports){module.exports=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","uint","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"]},{}],62:[function(require,module,exports){module.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],63:[function(require,module,exports){function tokenizeString(str,opt){var generator=tokenize(opt),tokens=[];return tokens=tokens.concat(generator(str)),tokens=tokens.concat(generator(null))}var tokenize=require("./index");module.exports=tokenizeString},{"./index":57}],64:[function(require,module,exports){"use strict";function iota(n){for(var result=new Array(n),i=0;i<n;++i)result[i]=i;return result}module.exports=iota},{}],65:[function(require,module,exports){function isBuffer(obj){return!!obj.constructor&&"function"==typeof obj.constructor.isBuffer&&obj.constructor.isBuffer(obj)}function isSlowBuffer(obj){return"function"==typeof obj.readFloatLE&&"function"==typeof obj.slice&&isBuffer(obj.slice(0,0))}module.exports=function(obj){return null!=obj&&(isBuffer(obj)||isSlowBuffer(obj)||!!obj._isBuffer)}},{}],66:[function(require,module,exports){function isTypedArray(arr){return isStrictTypedArray(arr)||isLooseTypedArray(arr)}function isStrictTypedArray(arr){return arr instanceof Int8Array||arr instanceof Int16Array||arr instanceof Int32Array||arr instanceof Uint8Array||arr instanceof Uint16Array||arr instanceof Uint32Array||arr instanceof Float32Array||arr instanceof Float64Array}function isLooseTypedArray(arr){return names[toString.call(arr)]}module.exports=isTypedArray,isTypedArray.strict=isStrictTypedArray,isTypedArray.loose=isLooseTypedArray;var toString=Object.prototype.toString,names={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0}},{}],67:[function(require,module,exports){module.exports=function(arr){return!!arr&&(!!arr.dtype&&new RegExp("function View[0-9]+d(:?"+arr.dtype+")+").test(String(arr.constructor)))}},{}],68:[function(require,module,exports){function combine(meshes){for(var pos=[],cel=[],p=0,c=0,k=0,i=0;i<meshes.length;i++){for(var mpos=meshes[i].positions,mcel=meshes[i].cells,j=0;j<mpos.length;j++)pos[j+p]=slice(mpos[j]);for(var j=0;j<mcel.length;j++){cel[k=j+c]=slice(mcel[j]);for(var l=0;l<cel[k].length;l++)cel[k][l]+=p}p+=mpos.length,c+=mcel.length}return{cells:cel,positions:pos}}var slice=require("sliced");module.exports=combine},{sliced:96}],69:[function(require,module,exports){"use strict";function fixup(x){if(!x)return EmptyProc;for(var i=0;i<x.args.length;++i){var a=x.args[i];x.args[i]=0===i?{name:a,lvalue:!0,rvalue:!!x.rvalue,count:x.count||1}:{name:a,lvalue:!1,rvalue:!0,count:1}}return x.thisVars||(x.thisVars=[]),x.localVars||(x.localVars=[]),x}function pcompile(user_args){return compile({args:user_args.args,pre:fixup(user_args.pre),body:fixup(user_args.body),post:fixup(user_args.proc),funcName:user_args.funcName})}function makeOp(user_args){for(var args=[],i=0;i<user_args.args.length;++i)args.push("a"+i);return new Function("P",["return function ",user_args.funcName,"_ndarrayops(",args.join(","),") {P(",args.join(","),");return a0}"].join(""))(pcompile(user_args))}var compile=require("cwise-compiler"),EmptyProc={body:"",args:[],thisVars:[],localVars:[]},assign_ops={add:"+",sub:"-",mul:"*",div:"/",mod:"%",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"};!function(){for(var id in assign_ops){var op=assign_ops[id];exports[id]=makeOp({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+op+"c"},funcName:id}),exports[id+"eq"]=makeOp({args:["array","array"],body:{args:["a","b"],body:"a"+op+"=b"},rvalue:!0,funcName:id+"eq"}),exports[id+"s"]=makeOp({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+op+"s"},funcName:id+"s"}),exports[id+"seq"]=makeOp({args:["array","scalar"],body:{args:["a","s"],body:"a"+op+"=s"},rvalue:!0,funcName:id+"seq"})}}();var unary_ops={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var id in unary_ops){var op=unary_ops[id];exports[id]=makeOp({args:["array","array"],body:{args:["a","b"],body:"a="+op+"b"},funcName:id}),exports[id+"eq"]=makeOp({args:["array"],body:{args:["a"],body:"a="+op+"a"},rvalue:!0,count:2,funcName:id+"eq"})}}();var binary_ops={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var id in binary_ops){var op=binary_ops[id];exports[id]=makeOp({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+op+"c"},funcName:id}),exports[id+"s"]=makeOp({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+op+"s"},funcName:id+"s"}),exports[id+"eq"]=makeOp({args:["array","array"],body:{args:["a","b"],body:"a=a"+op+"b"},rvalue:!0,count:2,funcName:id+"eq"}),exports[id+"seq"]=makeOp({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+op+"s"},rvalue:!0,count:2,funcName:id+"seq"})}}();var math_unary=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var i=0;i<math_unary.length;++i){var f=math_unary[i];exports[f]=makeOp({args:["array","array"],pre:{args:[],body:"this_f=Math."+f,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b)",thisVars:["this_f"]},funcName:f}),exports[f+"eq"]=makeOp({args:["array"],pre:{args:[],body:"this_f=Math."+f,thisVars:["this_f"]},body:{args:["a"],body:"a=this_f(a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:f+"eq"})}}();var math_comm=["max","min","atan2","pow"];!function(){for(var i=0;i<math_comm.length;++i){var f=math_comm[i];exports[f]=makeOp({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+f,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:f}),exports[f+"s"]=makeOp({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+f,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:f+"s"}),exports[f+"eq"]=makeOp({args:["array","array"],pre:{args:[],body:"this_f=Math."+f,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:f+"eq"}),exports[f+"seq"]=makeOp({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+f,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:f+"seq"})}}();var math_noncomm=["atan2","pow"];!function(){for(var i=0;i<math_noncomm.length;++i){var f=math_noncomm[i];exports[f+"op"]=makeOp({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+f,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:f+"op"}),exports[f+"ops"]=makeOp({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+f,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:f+"ops"}),exports[f+"opeq"]=makeOp({args:["array","array"],pre:{args:[],body:"this_f=Math."+f,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:f+"opeq"}),exports[f+"opseq"]=makeOp({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+f,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:f+"opseq"})}}(),exports.any=compile({args:["array"],pre:EmptyProc,body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"if(a){return true}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return false"},funcName:"any"}),exports.all=compile({args:["array"],pre:EmptyProc,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1}],body:"if(!x){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"all"}),exports.sum=compile({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s+=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"sum"}),exports.prod=compile({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=1"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s*=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"prod"}),exports.norm2squared=compile({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm2squared"}),exports.norm2=compile({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return Math.sqrt(this_s)"},funcName:"norm2"}),exports.norminf=compile({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:4}],body:"if(-a>this_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),exports.norm1=compile({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),exports.sup=compile({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),exports.inf=compile({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_<this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),exports.argmin=compile({args:["index","array","shape"],pre:{body:"{this_v=Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_<this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),exports.argmax=compile({args:["index","array","shape"],pre:{body:"{this_v=-Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_>this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),exports.random=makeOp({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),exports.assign=makeOp({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),exports.assigns=makeOp({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),exports.equals=compile({args:["array","array"],pre:EmptyProc,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":12}],70:[function(require,module,exports){function compare1st(a,b){return a[0]-b[0]}function order(){var i,stride=this.stride,terms=new Array(stride.length);for(i=0;i<terms.length;++i)terms[i]=[Math.abs(stride[i]),i];terms.sort(compare1st);var result=new Array(terms.length);for(i=0;i<result.length;++i)result[i]=terms[i][1];return result}function compileConstructor(dtype,dimension){var className=["View",dimension,"d",dtype].join("");dimension<0&&(className="View_Nil"+dtype);var useGetters="generic"===dtype;if(-1===dimension){var code="function "+className+"(a){this.data=a;};var proto="+className+".prototype;proto.dtype='"+dtype+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+className+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+className+"(a){return new "+className+"(a);}",procedure=new Function(code);return procedure()}if(0===dimension){var code="function "+className+"(a,d) {this.data = a;this.offset = d};var proto="+className+".prototype;proto.dtype='"+dtype+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+className+"_copy() {return new "+className+"(this.data,this.offset)};proto.pick=function "+className+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+className+"_get(){return "+(useGetters?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+className+"_set(v){return "+(useGetters?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+className+"(a,b,c,d){return new "+className+"(a,d)}",procedure=new Function("TrivialArray",code);return procedure(CACHED_CONSTRUCTORS[dtype][0])}var code=["'use strict'"],indices=iota(dimension),args=indices.map(function(i){return"i"+i}),index_str="this.offset+"+indices.map(function(i){return"this.stride["+i+"]*i"+i}).join("+"),shapeArg=indices.map(function(i){return"b"+i}).join(","),strideArg=indices.map(function(i){return"c"+i}).join(",");code.push("function "+className+"(a,"+shapeArg+","+strideArg+",d){this.data=a","this.shape=["+shapeArg+"]","this.stride=["+strideArg+"]","this.offset=d|0}","var proto="+className+".prototype","proto.dtype='"+dtype+"'","proto.dimension="+dimension),code.push("Object.defineProperty(proto,'size',{get:function "+className+"_size(){return "+indices.map(function(i){return"this.shape["+i+"]"}).join("*"),"}})"),1===dimension?code.push("proto.order=[0]"):(code.push("Object.defineProperty(proto,'order',{get:"),dimension<4?(code.push("function "+className+"_order(){"),2===dimension?code.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===dimension&&code.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):code.push("ORDER})")),code.push("proto.set=function "+className+"_set("+args.join(",")+",v){"),useGetters?code.push("return this.data.set("+index_str+",v)}"):code.push("return this.data["+index_str+"]=v}"),code.push("proto.get=function "+className+"_get("+args.join(",")+"){"),useGetters?code.push("return this.data.get("+index_str+")}"):code.push("return this.data["+index_str+"]}"),code.push("proto.index=function "+className+"_index(",args.join(),"){return "+index_str+"}"),code.push("proto.hi=function "+className+"_hi("+args.join(",")+"){return new "+className+"(this.data,"+indices.map(function(i){return["(typeof i",i,"!=='number'||i",i,"<0)?this.shape[",i,"]:i",i,"|0"].join("")}).join(",")+","+indices.map(function(i){return"this.stride["+i+"]"}).join(",")+",this.offset)}");var a_vars=indices.map(function(i){return"a"+i+"=this.shape["+i+"]"}),c_vars=indices.map(function(i){return"c"+i+"=this.stride["+i+"]"});code.push("proto.lo=function "+className+"_lo("+args.join(",")+"){var b=this.offset,d=0,"+a_vars.join(",")+","+c_vars.join(","));for(var i=0;i<dimension;++i)code.push("if(typeof i"+i+"==='number'&&i"+i+">=0){d=i"+i+"|0;b+=c"+i+"*d;a"+i+"-=d}");code.push("return new "+className+"(this.data,"+indices.map(function(i){return"a"+i}).join(",")+","+indices.map(function(i){return"c"+i}).join(",")+",b)}"),code.push("proto.step=function "+className+"_step("+args.join(",")+"){var "+indices.map(function(i){return"a"+i+"=this.shape["+i+"]"}).join(",")+","+indices.map(function(i){return"b"+i+"=this.stride["+i+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var i=0;i<dimension;++i)code.push("if(typeof i"+i+"==='number'){d=i"+i+"|0;if(d<0){c+=b"+i+"*(a"+i+"-1);a"+i+"=ceil(-a"+i+"/d)}else{a"+i+"=ceil(a"+i+"/d)}b"+i+"*=d}");code.push("return new "+className+"(this.data,"+indices.map(function(i){return"a"+i}).join(",")+","+indices.map(function(i){return"b"+i}).join(",")+",c)}");for(var tShape=new Array(dimension),tStride=new Array(dimension),i=0;i<dimension;++i)tShape[i]="a[i"+i+"]",tStride[i]="b[i"+i+"]";code.push("proto.transpose=function "+className+"_transpose("+args+"){"+args.map(function(n,idx){return n+"=("+n+"===undefined?"+idx+":"+n+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+className+"(this.data,"+tShape.join(",")+","+tStride.join(",")+",this.offset)}"),code.push("proto.pick=function "+className+"_pick("+args+"){var a=[],b=[],c=this.offset");for(var i=0;i<dimension;++i)code.push("if(typeof i"+i+"==='number'&&i"+i+">=0){c=(c+this.stride["+i+"]*i"+i+")|0}else{a.push(this.shape["+i+"]);b.push(this.stride["+i+"])}");code.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),code.push("return function construct_"+className+"(data,shape,stride,offset){return new "+className+"(data,"+indices.map(function(i){return"shape["+i+"]"}).join(",")+","+indices.map(function(i){return"stride["+i+"]"}).join(",")+",offset)}");var procedure=new Function("CTOR_LIST","ORDER",code.join("\n"));return procedure(CACHED_CONSTRUCTORS[dtype],order)}function arrayDType(data){if(isBuffer(data))return"buffer";if(hasTypedArrays)switch(Object.prototype.toString.call(data)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped";case"[object BigInt64Array]":return"bigint64";case"[object BigUint64Array]":return"biguint64"}return Array.isArray(data)?"array":"generic"}function wrappedNDArrayCtor(data,shape,stride,offset){if(void 0===data){var ctor=CACHED_CONSTRUCTORS.array[0];return ctor([])}"number"==typeof data&&(data=[data]),void 0===shape&&(shape=[data.length]);var d=shape.length;if(void 0===stride){stride=new Array(d);for(var i=d-1,sz=1;i>=0;--i)stride[i]=sz,sz*=shape[i]}if(void 0===offset){offset=0;for(var i=0;i<d;++i)stride[i]<0&&(offset-=(shape[i]-1)*stride[i])}for(var dtype=arrayDType(data),ctor_list=CACHED_CONSTRUCTORS[dtype];ctor_list.length<=d+1;)ctor_list.push(compileConstructor(dtype,ctor_list.length-1));var ctor=ctor_list[d+1];return ctor(data,shape,stride,offset)}var iota=require("iota-array"),isBuffer=require("is-buffer"),hasTypedArrays="undefined"!=typeof Float64Array,CACHED_CONSTRUCTORS={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],bigint64:[],biguint64:[],buffer:[],generic:[]};module.exports=wrappedNDArrayCtor},{"iota-array":64,"is-buffer":65}],71:[function(require,module,exports){(function(Buffer){"use strict";function decodeB64(str){return new Buffer(str,"base64")}function unpackPNG(w,h,c,str){var pixels=parse(decodeB64(str));return ndarray(pixels.data,[h,w,pixels.channels],[pixels.channels*w,pixels.channels,1],0)}module.exports=unpackPNG;var ndarray=require("ndarray"),parse=require("pngparse-sync")}).call(this,require("buffer").Buffer)},{buffer:108,ndarray:70,"pngparse-sync":90}],72:[function(require,module,exports){"use strict";function OrbitCamera(rotation,center,distance){this.rotation=rotation,this.center=center,this.distance=distance}function quatFromVec(out,da){var x=da[0],y=da[1],s=(da[2],x*x+y*y);s>1&&(s=1),out[0]=-da[0],out[1]=da[1],out[2]=da[2]||Math.sqrt(1-s),out[3]=0}function createOrbitCamera(eye,target,up){eye=eye||[0,0,-1],target=target||[0,0,0],up=up||[0,1,0];var camera=new OrbitCamera(quat.create(),vec3.create(),1);return camera.lookAt(eye,target,up),camera}var glm=require("gl-matrix"),vec3=glm.vec3,mat3=glm.mat3,mat4=glm.mat4,quat=glm.quat,scratch0=new Float32Array(16),scratch1=new Float32Array(16),proto=OrbitCamera.prototype;proto.view=function(out){return out||(out=mat4.create()),scratch1[0]=scratch1[1]=0,scratch1[2]=-this.distance,mat4.fromRotationTranslation(out,quat.conjugate(scratch0,this.rotation),scratch1),mat4.translate(out,out,vec3.negate(scratch0,this.center)),out},proto.lookAt=function(eye,center,up){mat4.lookAt(scratch0,eye,center,up),mat3.fromMat4(scratch0,scratch0),quat.fromMat3(this.rotation,scratch0),vec3.copy(this.center,center),this.distance=vec3.distance(eye,center)},proto.pan=function(dpan){var d=this.distance;scratch0[0]=-d*(dpan[0]||0),scratch0[1]=d*(dpan[1]||0),scratch0[2]=d*(dpan[2]||0),vec3.transformQuat(scratch0,scratch0,this.rotation),vec3.add(this.center,this.center,scratch0)},proto.zoom=function(d){this.distance+=d,this.distance<0&&(this.distance=0)},proto.rotate=function(da,db){quatFromVec(scratch0,da),quatFromVec(scratch1,db),quat.invert(scratch1,scratch1),quat.multiply(scratch0,scratch0,scratch1),quat.length(scratch0)<1e-6||(quat.multiply(this.rotation,this.rotation,scratch0),quat.normalize(this.rotation,this.rotation))},module.exports=createOrbitCamera},{"gl-matrix":39}],73:[function(require,module,exports){"use strict";var repeat=require("repeat-string");module.exports=function(str,num,ch){return ch=void 0!==ch?ch+"":" ",repeat(ch,num)+str}},{"repeat-string":94}],74:[function(require,module,exports){"use strict";var assign=require("./lib/utils/common").assign,deflate=require("./lib/deflate"),inflate=require("./lib/inflate"),constants=require("./lib/zlib/constants"),pako={};assign(pako,deflate,inflate,constants),module.exports=pako},{"./lib/deflate":75,"./lib/inflate":76,"./lib/utils/common":77,"./lib/zlib/constants":80}],75:[function(require,module,exports){"use strict";function Deflate(options){if(!(this instanceof Deflate))return new Deflate(options);this.options=utils.assign({level:Z_DEFAULT_COMPRESSION,method:Z_DEFLATED,chunkSize:16384,windowBits:15,memLevel:8,strategy:Z_DEFAULT_STRATEGY,to:""},options||{});var opt=this.options;opt.raw&&opt.windowBits>0?opt.windowBits=-opt.windowBits:opt.gzip&&opt.windowBits>0&&opt.windowBits<16&&(opt.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ZStream,this.strm.avail_out=0;var status=zlib_deflate.deflateInit2(this.strm,opt.level,opt.method,opt.windowBits,opt.memLevel,opt.strategy);if(status!==Z_OK)throw new Error(msg[status]);if(opt.header&&zlib_deflate.deflateSetHeader(this.strm,opt.header),opt.dictionary){var dict;if(dict="string"==typeof opt.dictionary?strings.string2buf(opt.dictionary):"[object ArrayBuffer]"===toString.call(opt.dictionary)?new Uint8Array(opt.dictionary):opt.dictionary,(status=zlib_deflate.deflateSetDictionary(this.strm,dict))!==Z_OK)throw new Error(msg[status]);this._dict_set=!0}}function deflate(input,options){var deflator=new Deflate(options);if(deflator.push(input,!0),deflator.err)throw deflator.msg;return deflator.result}function deflateRaw(input,options){return options=options||{},options.raw=!0,deflate(input,options)}function gzip(input,options){return options=options||{},options.gzip=!0,deflate(input,options)}var zlib_deflate=require("./zlib/deflate"),utils=require("./utils/common"),strings=require("./utils/strings"),msg=require("./zlib/messages"),ZStream=require("./zlib/zstream"),toString=Object.prototype.toString,Z_OK=0,Z_DEFAULT_COMPRESSION=-1,Z_DEFAULT_STRATEGY=0,Z_DEFLATED=8;Deflate.prototype.push=function(data,mode){var status,_mode,strm=this.strm,chunkSize=this.options.chunkSize;if(this.ended)return!1;_mode=mode===~~mode?mode:!0===mode?4:0,"string"==typeof data?strm.input=strings.string2buf(data):"[object ArrayBuffer]"===toString.call(data)?strm.input=new Uint8Array(data):strm.input=data,strm.next_in=0,strm.avail_in=strm.input.length;do{if(0===strm.avail_out&&(strm.output=new utils.Buf8(chunkSize),strm.next_out=0,strm.avail_out=chunkSize),1!==(status=zlib_deflate.deflate(strm,_mode))&&status!==Z_OK)return this.onEnd(status),this.ended=!0,!1
;0!==strm.avail_out&&(0!==strm.avail_in||4!==_mode&&2!==_mode)||("string"===this.options.to?this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output,strm.next_out))):this.onData(utils.shrinkBuf(strm.output,strm.next_out)))}while((strm.avail_in>0||0===strm.avail_out)&&1!==status);return 4===_mode?(status=zlib_deflate.deflateEnd(this.strm),this.onEnd(status),this.ended=!0,status===Z_OK):2!==_mode||(this.onEnd(Z_OK),strm.avail_out=0,!0)},Deflate.prototype.onData=function(chunk){this.chunks.push(chunk)},Deflate.prototype.onEnd=function(status){status===Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=utils.flattenChunks(this.chunks)),this.chunks=[],this.err=status,this.msg=this.strm.msg},exports.Deflate=Deflate,exports.deflate=deflate,exports.deflateRaw=deflateRaw,exports.gzip=gzip},{"./utils/common":77,"./utils/strings":78,"./zlib/deflate":82,"./zlib/messages":87,"./zlib/zstream":89}],76:[function(require,module,exports){"use strict";function Inflate(options){if(!(this instanceof Inflate))return new Inflate(options);this.options=utils.assign({chunkSize:16384,windowBits:0,to:""},options||{});var opt=this.options;opt.raw&&opt.windowBits>=0&&opt.windowBits<16&&(opt.windowBits=-opt.windowBits,0===opt.windowBits&&(opt.windowBits=-15)),!(opt.windowBits>=0&&opt.windowBits<16)||options&&options.windowBits||(opt.windowBits+=32),opt.windowBits>15&&opt.windowBits<48&&0==(15&opt.windowBits)&&(opt.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ZStream,this.strm.avail_out=0;var status=zlib_inflate.inflateInit2(this.strm,opt.windowBits);if(status!==c.Z_OK)throw new Error(msg[status]);this.header=new GZheader,zlib_inflate.inflateGetHeader(this.strm,this.header)}function inflate(input,options){var inflator=new Inflate(options);if(inflator.push(input,!0),inflator.err)throw inflator.msg;return inflator.result}function inflateRaw(input,options){return options=options||{},options.raw=!0,inflate(input,options)}var zlib_inflate=require("./zlib/inflate"),utils=require("./utils/common"),strings=require("./utils/strings"),c=require("./zlib/constants"),msg=require("./zlib/messages"),ZStream=require("./zlib/zstream"),GZheader=require("./zlib/gzheader"),toString=Object.prototype.toString;Inflate.prototype.push=function(data,mode){var status,_mode,next_out_utf8,tail,utf8str,dict,strm=this.strm,chunkSize=this.options.chunkSize,dictionary=this.options.dictionary,allowBufError=!1;if(this.ended)return!1;_mode=mode===~~mode?mode:!0===mode?c.Z_FINISH:c.Z_NO_FLUSH,"string"==typeof data?strm.input=strings.binstring2buf(data):"[object ArrayBuffer]"===toString.call(data)?strm.input=new Uint8Array(data):strm.input=data,strm.next_in=0,strm.avail_in=strm.input.length;do{if(0===strm.avail_out&&(strm.output=new utils.Buf8(chunkSize),strm.next_out=0,strm.avail_out=chunkSize),status=zlib_inflate.inflate(strm,c.Z_NO_FLUSH),status===c.Z_NEED_DICT&&dictionary&&(dict="string"==typeof dictionary?strings.string2buf(dictionary):"[object ArrayBuffer]"===toString.call(dictionary)?new Uint8Array(dictionary):dictionary,status=zlib_inflate.inflateSetDictionary(this.strm,dict)),status===c.Z_BUF_ERROR&&!0===allowBufError&&(status=c.Z_OK,allowBufError=!1),status!==c.Z_STREAM_END&&status!==c.Z_OK)return this.onEnd(status),this.ended=!0,!1;strm.next_out&&(0!==strm.avail_out&&status!==c.Z_STREAM_END&&(0!==strm.avail_in||_mode!==c.Z_FINISH&&_mode!==c.Z_SYNC_FLUSH)||("string"===this.options.to?(next_out_utf8=strings.utf8border(strm.output,strm.next_out),tail=strm.next_out-next_out_utf8,utf8str=strings.buf2string(strm.output,next_out_utf8),strm.next_out=tail,strm.avail_out=chunkSize-tail,tail&&utils.arraySet(strm.output,strm.output,next_out_utf8,tail,0),this.onData(utf8str)):this.onData(utils.shrinkBuf(strm.output,strm.next_out)))),0===strm.avail_in&&0===strm.avail_out&&(allowBufError=!0)}while((strm.avail_in>0||0===strm.avail_out)&&status!==c.Z_STREAM_END);return status===c.Z_STREAM_END&&(_mode=c.Z_FINISH),_mode===c.Z_FINISH?(status=zlib_inflate.inflateEnd(this.strm),this.onEnd(status),this.ended=!0,status===c.Z_OK):_mode!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),strm.avail_out=0,!0)},Inflate.prototype.onData=function(chunk){this.chunks.push(chunk)},Inflate.prototype.onEnd=function(status){status===c.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=utils.flattenChunks(this.chunks)),this.chunks=[],this.err=status,this.msg=this.strm.msg},exports.Inflate=Inflate,exports.inflate=inflate,exports.inflateRaw=inflateRaw,exports.ungzip=inflate},{"./utils/common":77,"./utils/strings":78,"./zlib/constants":80,"./zlib/gzheader":83,"./zlib/inflate":85,"./zlib/messages":87,"./zlib/zstream":89}],77:[function(require,module,exports){"use strict";var TYPED_OK="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;exports.assign=function(obj){for(var sources=Array.prototype.slice.call(arguments,1);sources.length;){var source=sources.shift();if(source){if("object"!=typeof source)throw new TypeError(source+"must be non-object");for(var p in source)source.hasOwnProperty(p)&&(obj[p]=source[p])}}return obj},exports.shrinkBuf=function(buf,size){return buf.length===size?buf:buf.subarray?buf.subarray(0,size):(buf.length=size,buf)};var fnTyped={arraySet:function(dest,src,src_offs,len,dest_offs){if(src.subarray&&dest.subarray)return void dest.set(src.subarray(src_offs,src_offs+len),dest_offs);for(var i=0;i<len;i++)dest[dest_offs+i]=src[src_offs+i]},flattenChunks:function(chunks){var i,l,len,pos,chunk,result;for(len=0,i=0,l=chunks.length;i<l;i++)len+=chunks[i].length;for(result=new Uint8Array(len),pos=0,i=0,l=chunks.length;i<l;i++)chunk=chunks[i],result.set(chunk,pos),pos+=chunk.length;return result}},fnUntyped={arraySet:function(dest,src,src_offs,len,dest_offs){for(var i=0;i<len;i++)dest[dest_offs+i]=src[src_offs+i]},flattenChunks:function(chunks){return[].concat.apply([],chunks)}};exports.setTyped=function(on){on?(exports.Buf8=Uint8Array,exports.Buf16=Uint16Array,exports.Buf32=Int32Array,exports.assign(exports,fnTyped)):(exports.Buf8=Array,exports.Buf16=Array,exports.Buf32=Array,exports.assign(exports,fnUntyped))},exports.setTyped(TYPED_OK)},{}],78:[function(require,module,exports){"use strict";function buf2binstring(buf,len){if(len<65537&&(buf.subarray&&STR_APPLY_UIA_OK||!buf.subarray&&STR_APPLY_OK))return String.fromCharCode.apply(null,utils.shrinkBuf(buf,len));for(var result="",i=0;i<len;i++)result+=String.fromCharCode(buf[i]);return result}var utils=require("./common"),STR_APPLY_OK=!0,STR_APPLY_UIA_OK=!0;try{String.fromCharCode.apply(null,[0])}catch(__){STR_APPLY_OK=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(__){STR_APPLY_UIA_OK=!1}for(var _utf8len=new utils.Buf8(256),q=0;q<256;q++)_utf8len[q]=q>=252?6:q>=248?5:q>=240?4:q>=224?3:q>=192?2:1;_utf8len[254]=_utf8len[254]=1,exports.string2buf=function(str){var buf,c,c2,m_pos,i,str_len=str.length,buf_len=0;for(m_pos=0;m_pos<str_len;m_pos++)c=str.charCodeAt(m_pos),55296==(64512&c)&&m_pos+1<str_len&&56320==(64512&(c2=str.charCodeAt(m_pos+1)))&&(c=65536+(c-55296<<10)+(c2-56320),m_pos++),buf_len+=c<128?1:c<2048?2:c<65536?3:4;for(buf=new utils.Buf8(buf_len),i=0,m_pos=0;i<buf_len;m_pos++)c=str.charCodeAt(m_pos),55296==(64512&c)&&m_pos+1<str_len&&56320==(64512&(c2=str.charCodeAt(m_pos+1)))&&(c=65536+(c-55296<<10)+(c2-56320),m_pos++),c<128?buf[i++]=c:c<2048?(buf[i++]=192|c>>>6,buf[i++]=128|63&c):c<65536?(buf[i++]=224|c>>>12,buf[i++]=128|c>>>6&63,buf[i++]=128|63&c):(buf[i++]=240|c>>>18,buf[i++]=128|c>>>12&63,buf[i++]=128|c>>>6&63,buf[i++]=128|63&c);return buf},exports.buf2binstring=function(buf){return buf2binstring(buf,buf.length)},exports.binstring2buf=function(str){for(var buf=new utils.Buf8(str.length),i=0,len=buf.length;i<len;i++)buf[i]=str.charCodeAt(i);return buf},exports.buf2string=function(buf,max){var i,out,c,c_len,len=max||buf.length,utf16buf=new Array(2*len);for(out=0,i=0;i<len;)if((c=buf[i++])<128)utf16buf[out++]=c;else if((c_len=_utf8len[c])>4)utf16buf[out++]=65533,i+=c_len-1;else{for(c&=2===c_len?31:3===c_len?15:7;c_len>1&&i<len;)c=c<<6|63&buf[i++],c_len--;c_len>1?utf16buf[out++]=65533:c<65536?utf16buf[out++]=c:(c-=65536,utf16buf[out++]=55296|c>>10&1023,utf16buf[out++]=56320|1023&c)}return buf2binstring(utf16buf,out)},exports.utf8border=function(buf,max){var pos;for(max=max||buf.length,max>buf.length&&(max=buf.length),pos=max-1;pos>=0&&128==(192&buf[pos]);)pos--;return pos<0?max:0===pos?max:pos+_utf8len[buf[pos]]>max?pos:max}},{"./common":77}],79:[function(require,module,exports){"use strict";function adler32(adler,buf,len,pos){for(var s1=65535&adler|0,s2=adler>>>16&65535|0,n=0;0!==len;){n=len>2e3?2e3:len,len-=n;do{s1=s1+buf[pos++]|0,s2=s2+s1|0}while(--n);s1%=65521,s2%=65521}return s1|s2<<16|0}module.exports=adler32},{}],80:[function(require,module,exports){"use strict";module.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}},{}],81:[function(require,module,exports){"use strict";function crc32(crc,buf,len,pos){var t=crcTable,end=pos+len;crc^=-1;for(var i=pos;i<end;i++)crc=crc>>>8^t[255&(crc^buf[i])];return-1^crc}var crcTable=function(){for(var c,table=[],n=0;n<256;n++){c=n;for(var k=0;k<8;k++)c=1&c?3988292384^c>>>1:c>>>1;table[n]=c}return table}();module.exports=crc32},{}],82:[function(require,module,exports){"use strict";function err(strm,errorCode){return strm.msg=msg[errorCode],errorCode}function rank(f){return(f<<1)-(f>4?9:0)}function zero(buf){for(var len=buf.length;--len>=0;)buf[len]=0}function flush_pending(strm){var s=strm.state,len=s.pending;len>strm.avail_out&&(len=strm.avail_out),0!==len&&(utils.arraySet(strm.output,s.pending_buf,s.pending_out,len,strm.next_out),strm.next_out+=len,s.pending_out+=len,strm.total_out+=len,strm.avail_out-=len,s.pending-=len,0===s.pending&&(s.pending_out=0))}function flush_block_only(s,last){trees._tr_flush_block(s,s.block_start>=0?s.block_start:-1,s.strstart-s.block_start,last),s.block_start=s.strstart,flush_pending(s.strm)}function put_byte(s,b){s.pending_buf[s.pending++]=b}function putShortMSB(s,b){s.pending_buf[s.pending++]=b>>>8&255,s.pending_buf[s.pending++]=255&b}function read_buf(strm,buf,start,size){var len=strm.avail_in;return len>size&&(len=size),0===len?0:(strm.avail_in-=len,utils.arraySet(buf,strm.input,strm.next_in,len,start),1===strm.state.wrap?strm.adler=adler32(strm.adler,buf,len,start):2===strm.state.wrap&&(strm.adler=crc32(strm.adler,buf,len,start)),strm.next_in+=len,strm.total_in+=len,len)}function longest_match(s,cur_match){var match,len,chain_length=s.max_chain_length,scan=s.strstart,best_len=s.prev_length,nice_match=s.nice_match,limit=s.strstart>s.w_size-MIN_LOOKAHEAD?s.strstart-(s.w_size-MIN_LOOKAHEAD):0,_win=s.window,wmask=s.w_mask,prev=s.prev,strend=s.strstart+MAX_MATCH,scan_end1=_win[scan+best_len-1],scan_end=_win[scan+best_len];s.prev_length>=s.good_match&&(chain_length>>=2),nice_match>s.lookahead&&(nice_match=s.lookahead);do{if(match=cur_match,_win[match+best_len]===scan_end&&_win[match+best_len-1]===scan_end1&&_win[match]===_win[scan]&&_win[++match]===_win[scan+1]){scan+=2,match++;do{}while(_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&scan<strend);if(len=MAX_MATCH-(strend-scan),scan=strend-MAX_MATCH,len>best_len){if(s.match_start=cur_match,best_len=len,len>=nice_match)break;scan_end1=_win[scan+best_len-1],scan_end=_win[scan+best_len]}}}while((cur_match=prev[cur_match&wmask])>limit&&0!=--chain_length);return best_len<=s.lookahead?best_len:s.lookahead}function fill_window(s){var p,n,m,more,str,_w_size=s.w_size;do{if(more=s.window_size-s.lookahead-s.strstart,s.strstart>=_w_size+(_w_size-MIN_LOOKAHEAD)){utils.arraySet(s.window,s.window,_w_size,_w_size,0),s.match_start-=_w_size,s.strstart-=_w_size,s.block_start-=_w_size,n=s.hash_size,p=n;do{m=s.head[--p],s.head[p]=m>=_w_size?m-_w_size:0}while(--n);n=_w_size,p=n;do{m=s.prev[--p],s.prev[p]=m>=_w_size?m-_w_size:0}while(--n);more+=_w_size}if(0===s.strm.avail_in)break;if(n=read_buf(s.strm,s.window,s.strstart+s.lookahead,more),s.lookahead+=n,s.lookahead+s.insert>=MIN_MATCH)for(str=s.strstart-s.insert,s.ins_h=s.window[str],s.ins_h=(s.ins_h<<s.hash_shift^s.window[str+1])&s.hash_mask;s.insert&&(s.ins_h=(s.ins_h<<s.hash_shift^s.window[str+MIN_MATCH-1])&s.hash_mask,s.prev[str&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=str,str++,s.insert--,!(s.lookahead+s.insert<MIN_MATCH)););}while(s.lookahead<MIN_LOOKAHEAD&&0!==s.strm.avail_in)}function deflate_stored(s,flush){var max_block_size=65535;for(max_block_size>s.pending_buf_size-5&&(max_block_size=s.pending_buf_size-5);;){if(s.lookahead<=1){if(fill_window(s),0===s.lookahead&&flush===Z_NO_FLUSH)return BS_NEED_MORE;if(0===s.lookahead)break}s.strstart+=s.lookahead,s.lookahead=0;var max_start=s.block_start+max_block_size;if((0===s.strstart||s.strstart>=max_start)&&(s.lookahead=s.strstart-max_start,s.strstart=max_start,flush_block_only(s,!1),0===s.strm.avail_out))return BS_NEED_MORE;if(s.strstart-s.block_start>=s.w_size-MIN_LOOKAHEAD&&(flush_block_only(s,!1),0===s.strm.avail_out))return BS_NEED_MORE}return s.insert=0,flush===Z_FINISH?(flush_block_only(s,!0),0===s.strm.avail_out?BS_FINISH_STARTED:BS_FINISH_DONE):(s.strstart>s.block_start&&(flush_block_only(s,!1),s.strm.avail_out),BS_NEED_MORE)}function deflate_fast(s,flush){for(var hash_head,bflush;;){if(s.lookahead<MIN_LOOKAHEAD){if(fill_window(s),s.lookahead<MIN_LOOKAHEAD&&flush===Z_NO_FLUSH)return BS_NEED_MORE;if(0===s.lookahead)break}if(hash_head=0,s.lookahead>=MIN_MATCH&&(s.ins_h=(s.ins_h<<s.hash_shift^s.window[s.strstart+MIN_MATCH-1])&s.hash_mask,hash_head=s.prev[s.strstart&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=s.strstart),0!==hash_head&&s.strstart-hash_head<=s.w_size-MIN_LOOKAHEAD&&(s.match_length=longest_match(s,hash_head)),s.match_length>=MIN_MATCH)if(bflush=trees._tr_tally(s,s.strstart-s.match_start,s.match_length-MIN_MATCH),s.lookahead-=s.match_length,s.match_length<=s.max_lazy_match&&s.lookahead>=MIN_MATCH){s.match_length--;do{s.strstart++,s.ins_h=(s.ins_h<<s.hash_shift^s.window[s.strstart+MIN_MATCH-1])&s.hash_mask,hash_head=s.prev[s.strstart&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=s.strstart}while(0!=--s.match_length);s.strstart++}else s.strstart+=s.match_length,s.match_length=0,s.ins_h=s.window[s.strstart],s.ins_h=(s.ins_h<<s.hash_shift^s.window[s.strstart+1])&s.hash_mask;else bflush=trees._tr_tally(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++;if(bflush&&(flush_block_only(s,!1),0===s.strm.avail_out))return BS_NEED_MORE}return s.insert=s.strstart<MIN_MATCH-1?s.strstart:MIN_MATCH-1,flush===Z_FINISH?(flush_block_only(s,!0),0===s.strm.avail_out?BS_FINISH_STARTED:BS_FINISH_DONE):s.last_lit&&(flush_block_only(s,!1),0===s.strm.avail_out)?BS_NEED_MORE:BS_BLOCK_DONE}function deflate_slow(s,flush){for(var hash_head,bflush,max_insert;;){if(s.lookahead<MIN_LOOKAHEAD){if(fill_window(s),s.lookahead<MIN_LOOKAHEAD&&flush===Z_NO_FLUSH)return BS_NEED_MORE;if(0===s.lookahead)break}if(hash_head=0,s.lookahead>=MIN_MATCH&&(s.ins_h=(s.ins_h<<s.hash_shift^s.window[s.strstart+MIN_MATCH-1])&s.hash_mask,hash_head=s.prev[s.strstart&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=s.strstart),s.prev_length=s.match_length,s.prev_match=s.match_start,s.match_length=MIN_MATCH-1,0!==hash_head&&s.prev_length<s.max_lazy_match&&s.strstart-hash_head<=s.w_size-MIN_LOOKAHEAD&&(s.match_length=longest_match(s,hash_head),s.match_length<=5&&(s.strategy===Z_FILTERED||s.match_length===MIN_MATCH&&s.strstart-s.match_start>4096)&&(s.match_length=MIN_MATCH-1)),s.prev_length>=MIN_MATCH&&s.match_length<=s.prev_length){max_insert=s.strstart+s.lookahead-MIN_MATCH,bflush=trees._tr_tally(s,s.strstart-1-s.prev_match,s.prev_length-MIN_MATCH),s.lookahead-=s.prev_length-1,s.prev_length-=2;do{++s.strstart<=max_insert&&(s.ins_h=(s.ins_h<<s.hash_shift^s.window[s.strstart+MIN_MATCH-1])&s.hash_mask,hash_head=s.prev[s.strstart&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=s.strstart)}while(0!=--s.prev_length);if(s.match_available=0,s.match_length=MIN_MATCH-1,s.strstart++,bflush&&(flush_block_only(s,!1),0===s.strm.avail_out))return BS_NEED_MORE}else if(s.match_available){if(bflush=trees._tr_tally(s,0,s.window[s.strstart-1]),bflush&&flush_block_only(s,!1),s.strstart++,s.lookahead--,0===s.strm.avail_out)return BS_NEED_MORE}else s.match_available=1,s.strstart++,s.lookahead--}return s.match_available&&(bflush=trees._tr_tally(s,0,s.window[s.strstart-1]),s.match_available=0),s.insert=s.strstart<MIN_MATCH-1?s.strstart:MIN_MATCH-1,flush===Z_FINISH?(flush_block_only(s,!0),0===s.strm.avail_out?BS_FINISH_STARTED:BS_FINISH_DONE):s.last_lit&&(flush_block_only(s,!1),0===s.strm.avail_out)?BS_NEED_MORE:BS_BLOCK_DONE}function deflate_rle(s,flush){for(var bflush,prev,scan,strend,_win=s.window;;){if(s.lookahead<=MAX_MATCH){if(fill_window(s),s.lookahead<=MAX_MATCH&&flush===Z_NO_FLUSH)return BS_NEED_MORE;if(0===s.lookahead)break}if(s.match_length=0,s.lookahead>=MIN_MATCH&&s.strstart>0&&(scan=s.strstart-1,(prev=_win[scan])===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan])){strend=s.strstart+MAX_MATCH;do{}while(prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&scan<strend);s.match_length=MAX_MATCH-(strend-scan),s.match_length>s.lookahead&&(s.match_length=s.lookahead)}if(s.match_length>=MIN_MATCH?(bflush=trees._tr_tally(s,1,s.match_length-MIN_MATCH),s.lookahead-=s.match_length,s.strstart+=s.match_length,s.match_length=0):(bflush=trees._tr_tally(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++),bflush&&(flush_block_only(s,!1),0===s.strm.avail_out))return BS_NEED_MORE}return s.insert=0,flush===Z_FINISH?(flush_block_only(s,!0),0===s.strm.avail_out?BS_FINISH_STARTED:BS_FINISH_DONE):s.last_lit&&(flush_block_only(s,!1),0===s.strm.avail_out)?BS_NEED_MORE:BS_BLOCK_DONE}function deflate_huff(s,flush){for(var bflush;;){if(0===s.lookahead&&(fill_window(s),0===s.lookahead)){if(flush===Z_NO_FLUSH)return BS_NEED_MORE;break}if(s.match_length=0,bflush=trees._tr_tally(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++,bflush&&(flush_block_only(s,!1),0===s.strm.avail_out))return BS_NEED_MORE}return s.insert=0,flush===Z_FINISH?(flush_block_only(s,!0),0===s.strm.avail_out?BS_FINISH_STARTED:BS_FINISH_DONE):s.last_lit&&(flush_block_only(s,!1),0===s.strm.avail_out)?BS_NEED_MORE:BS_BLOCK_DONE}function Config(good_length,max_lazy,nice_length,max_chain,func){this.good_length=good_length,this.max_lazy=max_lazy,this.nice_length=nice_length,this.max_chain=max_chain,this.func=func}function lm_init(s){s.window_size=2*s.w_size,zero(s.head),s.max_lazy_match=configuration_table[s.level].max_lazy,s.good_match=configuration_table[s.level].good_length,s.nice_match=configuration_table[s.level].nice_length,s.max_chain_length=configuration_table[s.level].max_chain,s.strstart=0,s.block_start=0,s.lookahead=0,s.insert=0,s.match_length=s.prev_length=MIN_MATCH-1,s.match_available=0,s.ins_h=0}function DeflateState(){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=Z_DEFLATED,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 utils.Buf16(2*HEAP_SIZE),this.dyn_dtree=new utils.Buf16(2*(2*D_CODES+1)),this.bl_tree=new utils.Buf16(2*(2*BL_CODES+1)),zero(this.dyn_ltree),zero(this.dyn_dtree),zero(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new utils.Buf16(MAX_BITS+1),this.heap=new utils.Buf16(2*L_CODES+1),zero(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new utils.Buf16(2*L_CODES+1),zero(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 deflateResetKeep(strm){var s;return strm&&strm.state?(strm.total_in=strm.total_out=0,strm.data_type=Z_UNKNOWN,s=strm.state,s.pending=0,s.pending_out=0,s.wrap<0&&(s.wrap=-s.wrap),s.status=s.wrap?INIT_STATE:BUSY_STATE,strm.adler=2===s.wrap?0:1,s.last_flush=Z_NO_FLUSH,trees._tr_init(s),Z_OK):err(strm,Z_STREAM_ERROR)}function deflateReset(strm){var ret=deflateResetKeep(strm);return ret===Z_OK&&lm_init(strm.state),ret}function deflateSetHeader(strm,head){return strm&&strm.state?2!==strm.state.wrap?Z_STREAM_ERROR:(strm.state.gzhead=head,Z_OK):Z_STREAM_ERROR}function deflateInit2(strm,level,method,windowBits,memLevel,strategy){if(!strm)return Z_STREAM_ERROR;var wrap=1;if(level===Z_DEFAULT_COMPRESSION&&(level=6),windowBits<0?(wrap=0,windowBits=-windowBits):windowBits>15&&(wrap=2,windowBits-=16),memLevel<1||memLevel>MAX_MEM_LEVEL||method!==Z_DEFLATED||windowBits<8||windowBits>15||level<0||level>9||strategy<0||strategy>Z_FIXED)return err(strm,Z_STREAM_ERROR);8===windowBits&&(windowBits=9);var s=new DeflateState;return strm.state=s,s.strm=strm,s.wrap=wrap,s.gzhead=null,s.w_bits=windowBits,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=memLevel+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+MIN_MATCH-1)/MIN_MATCH),s.window=new utils.Buf8(2*s.w_size),s.head=new utils.Buf16(s.hash_size),s.prev=new utils.Buf16(s.w_size),s.lit_bufsize=1<<memLevel+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new utils.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=level,s.strategy=strategy,s.method=method,deflateReset(strm)}function deflateInit(strm,level){return deflateInit2(strm,level,Z_DEFLATED,MAX_WBITS,DEF_MEM_LEVEL,Z_DEFAULT_STRATEGY)}function deflate(strm,flush){var old_flush,s,beg,val;if(!strm||!strm.state||flush>Z_BLOCK||flush<0)return strm?err(strm,Z_STREAM_ERROR):Z_STREAM_ERROR;if(s=strm.state,!strm.output||!strm.input&&0!==strm.avail_in||s.status===FINISH_STATE&&flush!==Z_FINISH)return err(strm,0===strm.avail_out?Z_BUF_ERROR:Z_STREAM_ERROR);if(s.strm=strm,old_flush=s.last_flush,s.last_flush=flush,s.status===INIT_STATE)if(2===s.wrap)strm.adler=0,put_byte(s,31),put_byte(s,139),put_byte(s,8),s.gzhead?(put_byte(s,(s.gzhead.text?1:0)+(s.gzhead.hcrc?2:0)+(s.gzhead.extra?4:0)+(s.gzhead.name?8:0)+(s.gzhead.comment?16:0)),put_byte(s,255&s.gzhead.time),put_byte(s,s.gzhead.time>>8&255),put_byte(s,s.gzhead.time>>16&255),put_byte(s,s.gzhead.time>>24&255),put_byte(s,9===s.level?2:s.strategy>=Z_HUFFMAN_ONLY||s.level<2?4:0),put_byte(s,255&s.gzhead.os),s.gzhead.extra&&s.gzhead.extra.length&&(put_byte(s,255&s.gzhead.extra.length),put_byte(s,s.gzhead.extra.length>>8&255)),s.gzhead.hcrc&&(strm.adler=crc32(strm.adler,s.pending_buf,s.pending,0)),s.gzindex=0,s.status=EXTRA_STATE):(put_byte(s,0),put_byte(s,0),put_byte(s,0),put_byte(s,0),put_byte(s,0),put_byte(s,9===s.level?2:s.strategy>=Z_HUFFMAN_ONLY||s.level<2?4:0),put_byte(s,OS_CODE),s.status=BUSY_STATE);else{var header=Z_DEFLATED+(s.w_bits-8<<4)<<8,level_flags=-1;level_flags=s.strategy>=Z_HUFFMAN_ONLY||s.level<2?0:s.level<6?1:6===s.level?2:3,header|=level_flags<<6,0!==s.strstart&&(header|=PRESET_DICT),header+=31-header%31,s.status=BUSY_STATE,putShortMSB(s,header),0!==s.strstart&&(putShortMSB(s,strm.adler>>>16),putShortMSB(s,65535&strm.adler)),strm.adler=1}if(s.status===EXTRA_STATE)if(s.gzhead.extra){for(beg=s.pending;s.gzindex<(65535&s.gzhead.extra.length)&&(s.pending!==s.pending_buf_size||(s.gzhead.hcrc&&s.pending>beg&&(strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)),flush_pending(strm),beg=s.pending,s.pending!==s.pending_buf_size));)put_byte(s,255&s.gzhead.extra[s.gzindex]),s.gzindex++;s.gzhead.hcrc&&s.pending>beg&&(strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)),s.gzindex===s.gzhead.extra.length&&(s.gzindex=0,s.status=NAME_STATE)}else s.status=NAME_STATE;if(s.status===NAME_STATE)if(s.gzhead.name){beg=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>beg&&(strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)),flush_pending(strm),beg=s.pending,s.pending===s.pending_buf_size)){val=1;break}val=s.gzindex<s.gzhead.name.length?255&s.gzhead.name.charCodeAt(s.gzindex++):0,put_byte(s,val)}while(0!==val);s.gzhead.hcrc&&s.pending>beg&&(strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)),0===val&&(s.gzindex=0,s.status=COMMENT_STATE)}else s.status=COMMENT_STATE;if(s.status===COMMENT_STATE)if(s.gzhead.comment){beg=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>beg&&(strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)),flush_pending(strm),beg=s.pending,s.pending===s.pending_buf_size)){val=1;break}val=s.gzindex<s.gzhead.comment.length?255&s.gzhead.comment.charCodeAt(s.gzindex++):0,put_byte(s,val)}while(0!==val);s.gzhead.hcrc&&s.pending>beg&&(strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)),0===val&&(s.status=HCRC_STATE)}else s.status=HCRC_STATE;if(s.status===HCRC_STATE&&(s.gzhead.hcrc?(s.pending+2>s.pending_buf_size&&flush_pending(strm),s.pending+2<=s.pending_buf_size&&(put_byte(s,255&strm.adler),put_byte(s,strm.adler>>8&255),strm.adler=0,s.status=BUSY_STATE)):s.status=BUSY_STATE),0!==s.pending){if(flush_pending(strm),0===strm.avail_out)return s.last_flush=-1,Z_OK}else if(0===strm.avail_in&&rank(flush)<=rank(old_flush)&&flush!==Z_FINISH)return err(strm,Z_BUF_ERROR);if(s.status===FINISH_STATE&&0!==strm.avail_in)return err(strm,Z_BUF_ERROR);if(0!==strm.avail_in||0!==s.lookahead||flush!==Z_NO_FLUSH&&s.status!==FINISH_STATE){var bstate=s.strategy===Z_HUFFMAN_ONLY?deflate_huff(s,flush):s.strategy===Z_RLE?deflate_rle(s,flush):configuration_table[s.level].func(s,flush);if(bstate!==BS_FINISH_STARTED&&bstate!==BS_FINISH_DONE||(s.status=FINISH_STATE),bstate===BS_NEED_MORE||bstate===BS_FINISH_STARTED)return 0===strm.avail_out&&(s.last_flush=-1),Z_OK;if(bstate===BS_BLOCK_DONE&&(flush===Z_PARTIAL_FLUSH?trees._tr_align(s):flush!==Z_BLOCK&&(trees._tr_stored_block(s,0,0,!1),flush===Z_FULL_FLUSH&&(zero(s.head),0===s.lookahead&&(s.strstart=0,s.block_start=0,s.insert=0))),flush_pending(strm),0===strm.avail_out))return s.last_flush=-1,Z_OK}return flush!==Z_FINISH?Z_OK:s.wrap<=0?Z_STREAM_END:(2===s.wrap?(put_byte(s,255&strm.adler),put_byte(s,strm.adler>>8&255),put_byte(s,strm.adler>>16&255),put_byte(s,strm.adler>>24&255),put_byte(s,255&strm.total_in),put_byte(s,strm.total_in>>8&255),put_byte(s,strm.total_in>>16&255),put_byte(s,strm.total_in>>24&255)):(putShortMSB(s,strm.adler>>>16),putShortMSB(s,65535&strm.adler)),flush_pending(strm),s.wrap>0&&(s.wrap=-s.wrap),0!==s.pending?Z_OK:Z_STREAM_END)}function deflateEnd(strm){var status;return strm&&strm.state?(status=strm.state.status)!==INIT_STATE&&status!==EXTRA_STATE&&status!==NAME_STATE&&status!==COMMENT_STATE&&status!==HCRC_STATE&&status!==BUSY_STATE&&status!==FINISH_STATE?err(strm,Z_STREAM_ERROR):(strm.state=null,status===BUSY_STATE?err(strm,Z_DATA_ERROR):Z_OK):Z_STREAM_ERROR}function deflateSetDictionary(strm,dictionary){var s,str,n,wrap,avail,next,input,tmpDict,dictLength=dictionary.length;if(!strm||!strm.state)return Z_STREAM_ERROR;if(s=strm.state,2===(wrap=s.wrap)||1===wrap&&s.status!==INIT_STATE||s.lookahead)return Z_STREAM_ERROR;for(1===wrap&&(strm.adler=adler32(strm.adler,dictionary,dictLength,0)),s.wrap=0,dictLength>=s.w_size&&(0===wrap&&(zero(s.head),s.strstart=0,s.block_start=0,s.insert=0),tmpDict=new utils.Buf8(s.w_size),utils.arraySet(tmpDict,dictionary,dictLength-s.w_size,s.w_size,0),dictionary=tmpDict,dictLength=s.w_size),avail=strm.avail_in,next=strm.next_in,input=strm.input,strm.avail_in=dictLength,strm.next_in=0,strm.input=dictionary,fill_window(s);s.lookahead>=MIN_MATCH;){str=s.strstart,n=s.lookahead-(MIN_MATCH-1);do{s.ins_h=(s.ins_h<<s.hash_shift^s.window[str+MIN_MATCH-1])&s.hash_mask,s.prev[str&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=str,str++}while(--n);s.strstart=str,s.lookahead=MIN_MATCH-1,fill_window(s)}return s.strstart+=s.lookahead,s.block_start=s.strstart,s.insert=s.lookahead,s.lookahead=0,s.match_length=s.prev_length=MIN_MATCH-1,s.match_available=0,strm.next_in=next,strm.input=input,strm.avail_in=avail,s.wrap=wrap,Z_OK}var configuration_table,utils=require("../utils/common"),trees=require("./trees"),adler32=require("./adler32"),crc32=require("./crc32"),msg=require("./messages"),Z_NO_FLUSH=0,Z_PARTIAL_FLUSH=1,Z_FULL_FLUSH=3,Z_FINISH=4,Z_BLOCK=5,Z_OK=0,Z_STREAM_END=1,Z_STREAM_ERROR=-2,Z_DATA_ERROR=-3,Z_BUF_ERROR=-5,Z_DEFAULT_COMPRESSION=-1,Z_FILTERED=1,Z_HUFFMAN_ONLY=2,Z_RLE=3,Z_FIXED=4,Z_DEFAULT_STRATEGY=0,Z_UNKNOWN=2,Z_DEFLATED=8,MAX_MEM_LEVEL=9,MAX_WBITS=15,DEF_MEM_LEVEL=8,L_CODES=286,D_CODES=30,BL_CODES=19,HEAP_SIZE=2*L_CODES+1,MAX_BITS=15,MIN_MATCH=3,MAX_MATCH=258,MIN_LOOKAHEAD=MAX_MATCH+MIN_MATCH+1,PRESET_DICT=32,INIT_STATE=42,EXTRA_STATE=69,NAME_STATE=73,COMMENT_STATE=91,HCRC_STATE=103,BUSY_STATE=113,FINISH_STATE=666,BS_NEED_MORE=1,BS_BLOCK_DONE=2,BS_FINISH_STARTED=3,BS_FINISH_DONE=4,OS_CODE=3;configuration_table=[new Config(0,0,0,0,deflate_stored),new Config(4,4,8,4,deflate_fast),new Config(4,5,16,8,deflate_fast),new Config(4,6,32,32,deflate_fast),new Config(4,4,16,16,deflate_slow),new Config(8,16,32,32,deflate_slow),new Config(8,16,128,128,deflate_slow),new Config(8,32,128,256,deflate_slow),new Config(32,128,258,1024,deflate_slow),new Config(32,258,258,4096,deflate_slow)],exports.deflateInit=deflateInit,exports.deflateInit2=deflateInit2,exports.deflateReset=deflateReset,exports.deflateResetKeep=deflateResetKeep,exports.deflateSetHeader=deflateSetHeader,exports.deflate=deflate,exports.deflateEnd=deflateEnd,exports.deflateSetDictionary=deflateSetDictionary,exports.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":77,"./adler32":79,"./crc32":81,"./messages":87,"./trees":88}],83:[function(require,module,exports){"use strict";function GZheader(){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}module.exports=GZheader},{}],84:[function(require,module,exports){"use strict";module.exports=function(strm,start){var state,_in,last,_out,beg,end,dmax,wsize,whave,wnext,s_window,hold,bits,lcode,dcode,lmask,dmask,here,op,len,dist,from,from_source,input,output;state=strm.state,_in=strm.next_in,input=strm.input,last=_in+(strm.avail_in-5),_out=strm.next_out,output=strm.output,beg=_out-(start-strm.avail_out),end=_out+(strm.avail_out-257),dmax=state.dmax,wsize=state.wsize,whave=state.whave,wnext=state.wnext,s_window=state.window,hold=state.hold,bits=state.bits,lcode=state.lencode,dcode=state.distcode,lmask=(1<<state.lenbits)-1,dmask=(1<<state.distbits)-1;top:do{bits<15&&(hold+=input[_in++]<<bits,bits+=8,hold+=input[_in++]<<bits,bits+=8),here=lcode[hold&lmask];dolen:for(;;){if(op=here>>>24,hold>>>=op,bits-=op,0===(op=here>>>16&255))output[_out++]=65535&here;else{if(!(16&op)){if(0==(64&op)){here=lcode[(65535&here)+(hold&(1<<op)-1)];continue dolen}if(32&op){state.mode=12;break top}strm.msg="invalid literal/length code",state.mode=30;break top}len=65535&here,op&=15,op&&(bits<op&&(hold+=input[_in++]<<bits,bits+=8),len+=hold&(1<<op)-1,hold>>>=op,bits-=op),bits<15&&(hold+=input[_in++]<<bits,bits+=8,hold+=input[_in++]<<bits,bits+=8),here=dcode[hold&dmask];dodist:for(;;){if(op=here>>>24,hold>>>=op,bits-=op,!(16&(op=here>>>16&255))){if(0==(64&op)){
here=dcode[(65535&here)+(hold&(1<<op)-1)];continue dodist}strm.msg="invalid distance code",state.mode=30;break top}if(dist=65535&here,op&=15,bits<op&&(hold+=input[_in++]<<bits,(bits+=8)<op&&(hold+=input[_in++]<<bits,bits+=8)),(dist+=hold&(1<<op)-1)>dmax){strm.msg="invalid distance too far back",state.mode=30;break top}if(hold>>>=op,bits-=op,op=_out-beg,dist>op){if((op=dist-op)>whave&&state.sane){strm.msg="invalid distance too far back",state.mode=30;break top}if(from=0,from_source=s_window,0===wnext){if(from+=wsize-op,op<len){len-=op;do{output[_out++]=s_window[from++]}while(--op);from=_out-dist,from_source=output}}else if(wnext<op){if(from+=wsize+wnext-op,(op-=wnext)<len){len-=op;do{output[_out++]=s_window[from++]}while(--op);if(from=0,wnext<len){op=wnext,len-=op;do{output[_out++]=s_window[from++]}while(--op);from=_out-dist,from_source=output}}}else if(from+=wnext-op,op<len){len-=op;do{output[_out++]=s_window[from++]}while(--op);from=_out-dist,from_source=output}for(;len>2;)output[_out++]=from_source[from++],output[_out++]=from_source[from++],output[_out++]=from_source[from++],len-=3;len&&(output[_out++]=from_source[from++],len>1&&(output[_out++]=from_source[from++]))}else{from=_out-dist;do{output[_out++]=output[from++],output[_out++]=output[from++],output[_out++]=output[from++],len-=3}while(len>2);len&&(output[_out++]=output[from++],len>1&&(output[_out++]=output[from++]))}break}}break}}while(_in<last&&_out<end);len=bits>>3,_in-=len,bits-=len<<3,hold&=(1<<bits)-1,strm.next_in=_in,strm.next_out=_out,strm.avail_in=_in<last?last-_in+5:5-(_in-last),strm.avail_out=_out<end?end-_out+257:257-(_out-end),state.hold=hold,state.bits=bits}},{}],85:[function(require,module,exports){"use strict";function zswap32(q){return(q>>>24&255)+(q>>>8&65280)+((65280&q)<<8)+((255&q)<<24)}function InflateState(){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 utils.Buf16(320),this.work=new utils.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function inflateResetKeep(strm){var state;return strm&&strm.state?(state=strm.state,strm.total_in=strm.total_out=state.total=0,strm.msg="",state.wrap&&(strm.adler=1&state.wrap),state.mode=HEAD,state.last=0,state.havedict=0,state.dmax=32768,state.head=null,state.hold=0,state.bits=0,state.lencode=state.lendyn=new utils.Buf32(ENOUGH_LENS),state.distcode=state.distdyn=new utils.Buf32(ENOUGH_DISTS),state.sane=1,state.back=-1,Z_OK):Z_STREAM_ERROR}function inflateReset(strm){var state;return strm&&strm.state?(state=strm.state,state.wsize=0,state.whave=0,state.wnext=0,inflateResetKeep(strm)):Z_STREAM_ERROR}function inflateReset2(strm,windowBits){var wrap,state;return strm&&strm.state?(state=strm.state,windowBits<0?(wrap=0,windowBits=-windowBits):(wrap=1+(windowBits>>4),windowBits<48&&(windowBits&=15)),windowBits&&(windowBits<8||windowBits>15)?Z_STREAM_ERROR:(null!==state.window&&state.wbits!==windowBits&&(state.window=null),state.wrap=wrap,state.wbits=windowBits,inflateReset(strm))):Z_STREAM_ERROR}function inflateInit2(strm,windowBits){var ret,state;return strm?(state=new InflateState,strm.state=state,state.window=null,ret=inflateReset2(strm,windowBits),ret!==Z_OK&&(strm.state=null),ret):Z_STREAM_ERROR}function inflateInit(strm){return inflateInit2(strm,DEF_WBITS)}function fixedtables(state){if(virgin){var sym;for(lenfix=new utils.Buf32(512),distfix=new utils.Buf32(32),sym=0;sym<144;)state.lens[sym++]=8;for(;sym<256;)state.lens[sym++]=9;for(;sym<280;)state.lens[sym++]=7;for(;sym<288;)state.lens[sym++]=8;for(inflate_table(LENS,state.lens,0,288,lenfix,0,state.work,{bits:9}),sym=0;sym<32;)state.lens[sym++]=5;inflate_table(DISTS,state.lens,0,32,distfix,0,state.work,{bits:5}),virgin=!1}state.lencode=lenfix,state.lenbits=9,state.distcode=distfix,state.distbits=5}function updatewindow(strm,src,end,copy){var dist,state=strm.state;return null===state.window&&(state.wsize=1<<state.wbits,state.wnext=0,state.whave=0,state.window=new utils.Buf8(state.wsize)),copy>=state.wsize?(utils.arraySet(state.window,src,end-state.wsize,state.wsize,0),state.wnext=0,state.whave=state.wsize):(dist=state.wsize-state.wnext,dist>copy&&(dist=copy),utils.arraySet(state.window,src,end-copy,dist,state.wnext),copy-=dist,copy?(utils.arraySet(state.window,src,end-copy,copy,0),state.wnext=copy,state.whave=state.wsize):(state.wnext+=dist,state.wnext===state.wsize&&(state.wnext=0),state.whave<state.wsize&&(state.whave+=dist))),0}function inflate(strm,flush){var state,input,output,next,put,have,left,hold,bits,_in,_out,copy,from,from_source,here_bits,here_op,here_val,last_bits,last_op,last_val,len,ret,opts,n,here=0,hbuf=new utils.Buf8(4),order=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!strm||!strm.state||!strm.output||!strm.input&&0!==strm.avail_in)return Z_STREAM_ERROR;state=strm.state,state.mode===TYPE&&(state.mode=TYPEDO),put=strm.next_out,output=strm.output,left=strm.avail_out,next=strm.next_in,input=strm.input,have=strm.avail_in,hold=state.hold,bits=state.bits,_in=have,_out=left,ret=Z_OK;inf_leave:for(;;)switch(state.mode){case HEAD:if(0===state.wrap){state.mode=TYPEDO;break}for(;bits<16;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(2&state.wrap&&35615===hold){state.check=0,hbuf[0]=255&hold,hbuf[1]=hold>>>8&255,state.check=crc32(state.check,hbuf,2,0),hold=0,bits=0,state.mode=FLAGS;break}if(state.flags=0,state.head&&(state.head.done=!1),!(1&state.wrap)||(((255&hold)<<8)+(hold>>8))%31){strm.msg="incorrect header check",state.mode=BAD;break}if((15&hold)!==Z_DEFLATED){strm.msg="unknown compression method",state.mode=BAD;break}if(hold>>>=4,bits-=4,len=8+(15&hold),0===state.wbits)state.wbits=len;else if(len>state.wbits){strm.msg="invalid window size",state.mode=BAD;break}state.dmax=1<<len,strm.adler=state.check=1,state.mode=512&hold?DICTID:TYPE,hold=0,bits=0;break;case FLAGS:for(;bits<16;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(state.flags=hold,(255&state.flags)!==Z_DEFLATED){strm.msg="unknown compression method",state.mode=BAD;break}if(57344&state.flags){strm.msg="unknown header flags set",state.mode=BAD;break}state.head&&(state.head.text=hold>>8&1),512&state.flags&&(hbuf[0]=255&hold,hbuf[1]=hold>>>8&255,state.check=crc32(state.check,hbuf,2,0)),hold=0,bits=0,state.mode=TIME;case TIME:for(;bits<32;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}state.head&&(state.head.time=hold),512&state.flags&&(hbuf[0]=255&hold,hbuf[1]=hold>>>8&255,hbuf[2]=hold>>>16&255,hbuf[3]=hold>>>24&255,state.check=crc32(state.check,hbuf,4,0)),hold=0,bits=0,state.mode=OS;case OS:for(;bits<16;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}state.head&&(state.head.xflags=255&hold,state.head.os=hold>>8),512&state.flags&&(hbuf[0]=255&hold,hbuf[1]=hold>>>8&255,state.check=crc32(state.check,hbuf,2,0)),hold=0,bits=0,state.mode=EXLEN;case EXLEN:if(1024&state.flags){for(;bits<16;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}state.length=hold,state.head&&(state.head.extra_len=hold),512&state.flags&&(hbuf[0]=255&hold,hbuf[1]=hold>>>8&255,state.check=crc32(state.check,hbuf,2,0)),hold=0,bits=0}else state.head&&(state.head.extra=null);state.mode=EXTRA;case EXTRA:if(1024&state.flags&&(copy=state.length,copy>have&&(copy=have),copy&&(state.head&&(len=state.head.extra_len-state.length,state.head.extra||(state.head.extra=new Array(state.head.extra_len)),utils.arraySet(state.head.extra,input,next,copy,len)),512&state.flags&&(state.check=crc32(state.check,input,copy,next)),have-=copy,next+=copy,state.length-=copy),state.length))break inf_leave;state.length=0,state.mode=NAME;case NAME:if(2048&state.flags){if(0===have)break inf_leave;copy=0;do{len=input[next+copy++],state.head&&len&&state.length<65536&&(state.head.name+=String.fromCharCode(len))}while(len&©<have);if(512&state.flags&&(state.check=crc32(state.check,input,copy,next)),have-=copy,next+=copy,len)break inf_leave}else state.head&&(state.head.name=null);state.length=0,state.mode=COMMENT;case COMMENT:if(4096&state.flags){if(0===have)break inf_leave;copy=0;do{len=input[next+copy++],state.head&&len&&state.length<65536&&(state.head.comment+=String.fromCharCode(len))}while(len&©<have);if(512&state.flags&&(state.check=crc32(state.check,input,copy,next)),have-=copy,next+=copy,len)break inf_leave}else state.head&&(state.head.comment=null);state.mode=HCRC;case HCRC:if(512&state.flags){for(;bits<16;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(hold!==(65535&state.check)){strm.msg="header crc mismatch",state.mode=BAD;break}hold=0,bits=0}state.head&&(state.head.hcrc=state.flags>>9&1,state.head.done=!0),strm.adler=state.check=0,state.mode=TYPE;break;case DICTID:for(;bits<32;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}strm.adler=state.check=zswap32(hold),hold=0,bits=0,state.mode=DICT;case DICT:if(0===state.havedict)return strm.next_out=put,strm.avail_out=left,strm.next_in=next,strm.avail_in=have,state.hold=hold,state.bits=bits,Z_NEED_DICT;strm.adler=state.check=1,state.mode=TYPE;case TYPE:if(flush===Z_BLOCK||flush===Z_TREES)break inf_leave;case TYPEDO:if(state.last){hold>>>=7&bits,bits-=7&bits,state.mode=CHECK;break}for(;bits<3;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}switch(state.last=1&hold,hold>>>=1,bits-=1,3&hold){case 0:state.mode=STORED;break;case 1:if(fixedtables(state),state.mode=LEN_,flush===Z_TREES){hold>>>=2,bits-=2;break inf_leave}break;case 2:state.mode=TABLE;break;case 3:strm.msg="invalid block type",state.mode=BAD}hold>>>=2,bits-=2;break;case STORED:for(hold>>>=7&bits,bits-=7&bits;bits<32;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if((65535&hold)!=(hold>>>16^65535)){strm.msg="invalid stored block lengths",state.mode=BAD;break}if(state.length=65535&hold,hold=0,bits=0,state.mode=COPY_,flush===Z_TREES)break inf_leave;case COPY_:state.mode=COPY;case COPY:if(copy=state.length){if(copy>have&&(copy=have),copy>left&&(copy=left),0===copy)break inf_leave;utils.arraySet(output,input,next,copy,put),have-=copy,next+=copy,left-=copy,put+=copy,state.length-=copy;break}state.mode=TYPE;break;case TABLE:for(;bits<14;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(state.nlen=257+(31&hold),hold>>>=5,bits-=5,state.ndist=1+(31&hold),hold>>>=5,bits-=5,state.ncode=4+(15&hold),hold>>>=4,bits-=4,state.nlen>286||state.ndist>30){strm.msg="too many length or distance symbols",state.mode=BAD;break}state.have=0,state.mode=LENLENS;case LENLENS:for(;state.have<state.ncode;){for(;bits<3;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}state.lens[order[state.have++]]=7&hold,hold>>>=3,bits-=3}for(;state.have<19;)state.lens[order[state.have++]]=0;if(state.lencode=state.lendyn,state.lenbits=7,opts={bits:state.lenbits},ret=inflate_table(CODES,state.lens,0,19,state.lencode,0,state.work,opts),state.lenbits=opts.bits,ret){strm.msg="invalid code lengths set",state.mode=BAD;break}state.have=0,state.mode=CODELENS;case CODELENS:for(;state.have<state.nlen+state.ndist;){for(;here=state.lencode[hold&(1<<state.lenbits)-1],here_bits=here>>>24,here_op=here>>>16&255,here_val=65535&here,!(here_bits<=bits);){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(here_val<16)hold>>>=here_bits,bits-=here_bits,state.lens[state.have++]=here_val;else{if(16===here_val){for(n=here_bits+2;bits<n;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(hold>>>=here_bits,bits-=here_bits,0===state.have){strm.msg="invalid bit length repeat",state.mode=BAD;break}len=state.lens[state.have-1],copy=3+(3&hold),hold>>>=2,bits-=2}else if(17===here_val){for(n=here_bits+3;bits<n;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}hold>>>=here_bits,bits-=here_bits,len=0,copy=3+(7&hold),hold>>>=3,bits-=3}else{for(n=here_bits+7;bits<n;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}hold>>>=here_bits,bits-=here_bits,len=0,copy=11+(127&hold),hold>>>=7,bits-=7}if(state.have+copy>state.nlen+state.ndist){strm.msg="invalid bit length repeat",state.mode=BAD;break}for(;copy--;)state.lens[state.have++]=len}}if(state.mode===BAD)break;if(0===state.lens[256]){strm.msg="invalid code -- missing end-of-block",state.mode=BAD;break}if(state.lenbits=9,opts={bits:state.lenbits},ret=inflate_table(LENS,state.lens,0,state.nlen,state.lencode,0,state.work,opts),state.lenbits=opts.bits,ret){strm.msg="invalid literal/lengths set",state.mode=BAD;break}if(state.distbits=6,state.distcode=state.distdyn,opts={bits:state.distbits},ret=inflate_table(DISTS,state.lens,state.nlen,state.ndist,state.distcode,0,state.work,opts),state.distbits=opts.bits,ret){strm.msg="invalid distances set",state.mode=BAD;break}if(state.mode=LEN_,flush===Z_TREES)break inf_leave;case LEN_:state.mode=LEN;case LEN:if(have>=6&&left>=258){strm.next_out=put,strm.avail_out=left,strm.next_in=next,strm.avail_in=have,state.hold=hold,state.bits=bits,inflate_fast(strm,_out),put=strm.next_out,output=strm.output,left=strm.avail_out,next=strm.next_in,input=strm.input,have=strm.avail_in,hold=state.hold,bits=state.bits,state.mode===TYPE&&(state.back=-1);break}for(state.back=0;here=state.lencode[hold&(1<<state.lenbits)-1],here_bits=here>>>24,here_op=here>>>16&255,here_val=65535&here,!(here_bits<=bits);){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(here_op&&0==(240&here_op)){for(last_bits=here_bits,last_op=here_op,last_val=here_val;here=state.lencode[last_val+((hold&(1<<last_bits+last_op)-1)>>last_bits)],here_bits=here>>>24,here_op=here>>>16&255,here_val=65535&here,!(last_bits+here_bits<=bits);){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}hold>>>=last_bits,bits-=last_bits,state.back+=last_bits}if(hold>>>=here_bits,bits-=here_bits,state.back+=here_bits,state.length=here_val,0===here_op){state.mode=LIT;break}if(32&here_op){state.back=-1,state.mode=TYPE;break}if(64&here_op){strm.msg="invalid literal/length code",state.mode=BAD;break}state.extra=15&here_op,state.mode=LENEXT;case LENEXT:if(state.extra){for(n=state.extra;bits<n;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}state.length+=hold&(1<<state.extra)-1,hold>>>=state.extra,bits-=state.extra,state.back+=state.extra}state.was=state.length,state.mode=DIST;case DIST:for(;here=state.distcode[hold&(1<<state.distbits)-1],here_bits=here>>>24,here_op=here>>>16&255,here_val=65535&here,!(here_bits<=bits);){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(0==(240&here_op)){for(last_bits=here_bits,last_op=here_op,last_val=here_val;here=state.distcode[last_val+((hold&(1<<last_bits+last_op)-1)>>last_bits)],here_bits=here>>>24,here_op=here>>>16&255,here_val=65535&here,!(last_bits+here_bits<=bits);){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}hold>>>=last_bits,bits-=last_bits,state.back+=last_bits}if(hold>>>=here_bits,bits-=here_bits,state.back+=here_bits,64&here_op){strm.msg="invalid distance code",state.mode=BAD;break}state.offset=here_val,state.extra=15&here_op,state.mode=DISTEXT;case DISTEXT:if(state.extra){for(n=state.extra;bits<n;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}state.offset+=hold&(1<<state.extra)-1,hold>>>=state.extra,bits-=state.extra,state.back+=state.extra}if(state.offset>state.dmax){strm.msg="invalid distance too far back",state.mode=BAD;break}state.mode=MATCH;case MATCH:if(0===left)break inf_leave;if(copy=_out-left,state.offset>copy){if((copy=state.offset-copy)>state.whave&&state.sane){strm.msg="invalid distance too far back",state.mode=BAD;break}copy>state.wnext?(copy-=state.wnext,from=state.wsize-copy):from=state.wnext-copy,copy>state.length&&(copy=state.length),from_source=state.window}else from_source=output,from=put-state.offset,copy=state.length;copy>left&&(copy=left),left-=copy,state.length-=copy;do{output[put++]=from_source[from++]}while(--copy);0===state.length&&(state.mode=LEN);break;case LIT:if(0===left)break inf_leave;output[put++]=state.length,left--,state.mode=LEN;break;case CHECK:if(state.wrap){for(;bits<32;){if(0===have)break inf_leave;have--,hold|=input[next++]<<bits,bits+=8}if(_out-=left,strm.total_out+=_out,state.total+=_out,_out&&(strm.adler=state.check=state.flags?crc32(state.check,output,_out,put-_out):adler32(state.check,output,_out,put-_out)),_out=left,(state.flags?hold:zswap32(hold))!==state.check){strm.msg="incorrect data check",state.mode=BAD;break}hold=0,bits=0}state.mode=LENGTH;case LENGTH:if(state.wrap&&state.flags){for(;bits<32;){if(0===have)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(hold!==(4294967295&state.total)){strm.msg="incorrect length check",state.mode=BAD;break}hold=0,bits=0}state.mode=DONE;case DONE:ret=Z_STREAM_END;break inf_leave;case BAD:ret=Z_DATA_ERROR;break inf_leave;case MEM:return Z_MEM_ERROR;case SYNC:default:return Z_STREAM_ERROR}return strm.next_out=put,strm.avail_out=left,strm.next_in=next,strm.avail_in=have,state.hold=hold,state.bits=bits,(state.wsize||_out!==strm.avail_out&&state.mode<BAD&&(state.mode<CHECK||flush!==Z_FINISH))&&updatewindow(strm,strm.output,strm.next_out,_out-strm.avail_out)?(state.mode=MEM,Z_MEM_ERROR):(_in-=strm.avail_in,_out-=strm.avail_out,strm.total_in+=_in,strm.total_out+=_out,state.total+=_out,state.wrap&&_out&&(strm.adler=state.check=state.flags?crc32(state.check,output,_out,strm.next_out-_out):adler32(state.check,output,_out,strm.next_out-_out)),strm.data_type=state.bits+(state.last?64:0)+(state.mode===TYPE?128:0)+(state.mode===LEN_||state.mode===COPY_?256:0),(0===_in&&0===_out||flush===Z_FINISH)&&ret===Z_OK&&(ret=Z_BUF_ERROR),ret)}function inflateEnd(strm){if(!strm||!strm.state)return Z_STREAM_ERROR;var state=strm.state;return state.window&&(state.window=null),strm.state=null,Z_OK}function inflateGetHeader(strm,head){var state;return strm&&strm.state?(state=strm.state,0==(2&state.wrap)?Z_STREAM_ERROR:(state.head=head,head.done=!1,Z_OK)):Z_STREAM_ERROR}function inflateSetDictionary(strm,dictionary){var state,dictid,dictLength=dictionary.length;return strm&&strm.state?(state=strm.state,0!==state.wrap&&state.mode!==DICT?Z_STREAM_ERROR:state.mode===DICT&&(dictid=1,(dictid=adler32(dictid,dictionary,dictLength,0))!==state.check)?Z_DATA_ERROR:updatewindow(strm,dictionary,dictLength,dictLength)?(state.mode=MEM,Z_MEM_ERROR):(state.havedict=1,Z_OK)):Z_STREAM_ERROR}var lenfix,distfix,utils=require("../utils/common"),adler32=require("./adler32"),crc32=require("./crc32"),inflate_fast=require("./inffast"),inflate_table=require("./inftrees"),CODES=0,LENS=1,DISTS=2,Z_FINISH=4,Z_BLOCK=5,Z_TREES=6,Z_OK=0,Z_STREAM_END=1,Z_NEED_DICT=2,Z_STREAM_ERROR=-2,Z_DATA_ERROR=-3,Z_MEM_ERROR=-4,Z_BUF_ERROR=-5,Z_DEFLATED=8,HEAD=1,FLAGS=2,TIME=3,OS=4,EXLEN=5,EXTRA=6,NAME=7,COMMENT=8,HCRC=9,DICTID=10,DICT=11,TYPE=12,TYPEDO=13,STORED=14,COPY_=15,COPY=16,TABLE=17,LENLENS=18,CODELENS=19,LEN_=20,LEN=21,LENEXT=22,DIST=23,DISTEXT=24,MATCH=25,LIT=26,CHECK=27,LENGTH=28,DONE=29,BAD=30,MEM=31,SYNC=32,ENOUGH_LENS=852,ENOUGH_DISTS=592,DEF_WBITS=15,virgin=!0;exports.inflateReset=inflateReset,exports.inflateReset2=inflateReset2,exports.inflateResetKeep=inflateResetKeep,exports.inflateInit=inflateInit,exports.inflateInit2=inflateInit2,exports.inflate=inflate,exports.inflateEnd=inflateEnd,exports.inflateGetHeader=inflateGetHeader,exports.inflateSetDictionary=inflateSetDictionary,exports.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":77,"./adler32":79,"./crc32":81,"./inffast":84,"./inftrees":86}],86:[function(require,module,exports){"use strict";var utils=require("../utils/common"),lbase=[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],lext=[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],dbase=[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],dext=[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];module.exports=function(type,lens,lens_index,codes,table,table_index,work,opts){var incr,fill,low,mask,next,end,here_bits,here_op,here_val,bits=opts.bits,len=0,sym=0,min=0,max=0,root=0,curr=0,drop=0,left=0,used=0,huff=0,base=null,base_index=0,count=new utils.Buf16(16),offs=new utils.Buf16(16),extra=null,extra_index=0;for(len=0;len<=15;len++)count[len]=0;for(sym=0;sym<codes;sym++)count[lens[lens_index+sym]]++;for(root=bits,max=15;max>=1&&0===count[max];max--);if(root>max&&(root=max),0===max)return table[table_index++]=20971520,table[table_index++]=20971520,opts.bits=1,0;for(min=1;min<max&&0===count[min];min++);for(root<min&&(root=min),left=1,len=1;len<=15;len++)if(left<<=1,(left-=count[len])<0)return-1;if(left>0&&(0===type||1!==max))return-1;for(offs[1]=0,len=1;len<15;len++)offs[len+1]=offs[len]+count[len];for(sym=0;sym<codes;sym++)0!==lens[lens_index+sym]&&(work[offs[lens[lens_index+sym]]++]=sym);if(0===type?(base=extra=work,end=19):1===type?(base=lbase,base_index-=257,extra=lext,extra_index-=257,end=256):(base=dbase,extra=dext,end=-1),huff=0,sym=0,len=min,next=table_index,curr=root,drop=0,low=-1,used=1<<root,mask=used-1,1===type&&used>852||2===type&&used>592)return 1;for(var i=0;;){i++,here_bits=len-drop,work[sym]<end?(here_op=0,here_val=work[sym]):work[sym]>end?(here_op=extra[extra_index+work[sym]],here_val=base[base_index+work[sym]]):(here_op=96,here_val=0),incr=1<<len-drop,fill=1<<curr,min=fill;do{fill-=incr,table[next+(huff>>drop)+fill]=here_bits<<24|here_op<<16|here_val|0}while(0!==fill);for(incr=1<<len-1;huff&incr;)incr>>=1;if(0!==incr?(huff&=incr-1,huff+=incr):huff=0,sym++,0==--count[len]){if(len===max)break;len=lens[lens_index+work[sym]]}if(len>root&&(huff&mask)!==low){for(0===drop&&(drop=root),next+=min,curr=len-drop,left=1<<curr;curr+drop<max&&!((left-=count[curr+drop])<=0);)curr++,left<<=1;if(used+=1<<curr,1===type&&used>852||2===type&&used>592)return 1;low=huff&mask,table[low]=root<<24|curr<<16|next-table_index|0}}return 0!==huff&&(table[next+huff]=len-drop<<24|64<<16|0),opts.bits=root,0}},{"../utils/common":77}],87:[function(require,module,exports){"use strict";module.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"}},{}],88:[function(require,module,exports){"use strict";function zero(buf){for(var len=buf.length;--len>=0;)buf[len]=0}function StaticTreeDesc(static_tree,extra_bits,extra_base,elems,max_length){this.static_tree=static_tree,this.extra_bits=extra_bits,this.extra_base=extra_base,this.elems=elems,this.max_length=max_length,this.has_stree=static_tree&&static_tree.length}function TreeDesc(dyn_tree,stat_desc){this.dyn_tree=dyn_tree,this.max_code=0,this.stat_desc=stat_desc}function d_code(dist){return dist<256?_dist_code[dist]:_dist_code[256+(dist>>>7)]}function put_short(s,w){s.pending_buf[s.pending++]=255&w,s.pending_buf[s.pending++]=w>>>8&255}function send_bits(s,value,length){s.bi_valid>Buf_size-length?(s.bi_buf|=value<<s.bi_valid&65535,put_short(s,s.bi_buf),s.bi_buf=value>>Buf_size-s.bi_valid,s.bi_valid+=length-Buf_size):(s.bi_buf|=value<<s.bi_valid&65535,s.bi_valid+=length)}function send_code(s,c,tree){send_bits(s,tree[2*c],tree[2*c+1])}function bi_reverse(code,len){var res=0;do{res|=1&code,code>>>=1,res<<=1}while(--len>0);return res>>>1}function bi_flush(s){16===s.bi_valid?(put_short(s,s.bi_buf),s.bi_buf=0,s.bi_valid=0):s.bi_valid>=8&&(s.pending_buf[s.pending++]=255&s.bi_buf,s.bi_buf>>=8,s.bi_valid-=8)}function gen_bitlen(s,desc){var h,n,m,bits,xbits,f,tree=desc.dyn_tree,max_code=desc.max_code,stree=desc.stat_desc.static_tree,has_stree=desc.stat_desc.has_stree,extra=desc.stat_desc.extra_bits,base=desc.stat_desc.extra_base,max_length=desc.stat_desc.max_length,overflow=0;for(bits=0;bits<=MAX_BITS;bits++)s.bl_count[bits]=0;for(tree[2*s.heap[s.heap_max]+1]=0,h=s.heap_max+1;h<HEAP_SIZE;h++)n=s.heap[h],bits=tree[2*tree[2*n+1]+1]+1,bits>max_length&&(bits=max_length,overflow++),tree[2*n+1]=bits,n>max_code||(s.bl_count[bits]++,xbits=0,n>=base&&(xbits=extra[n-base]),f=tree[2*n],s.opt_len+=f*(bits+xbits),has_stree&&(s.static_len+=f*(stree[2*n+1]+xbits)));if(0!==overflow){do{for(bits=max_length-1;0===s.bl_count[bits];)bits--;s.bl_count[bits]--,s.bl_count[bits+1]+=2,s.bl_count[max_length]--,overflow-=2}while(overflow>0);for(bits=max_length;0!==bits;bits--)for(n=s.bl_count[bits];0!==n;)(m=s.heap[--h])>max_code||(tree[2*m+1]!==bits&&(s.opt_len+=(bits-tree[2*m+1])*tree[2*m],tree[2*m+1]=bits),n--)}}function gen_codes(tree,max_code,bl_count){var bits,n,next_code=new Array(MAX_BITS+1),code=0;for(bits=1;bits<=MAX_BITS;bits++)next_code[bits]=code=code+bl_count[bits-1]<<1;for(n=0;n<=max_code;n++){var len=tree[2*n+1];0!==len&&(tree[2*n]=bi_reverse(next_code[len]++,len))}}function tr_static_init(){var n,bits,length,code,dist,bl_count=new Array(MAX_BITS+1);for(length=0,code=0;code<LENGTH_CODES-1;code++)for(base_length[code]=length,n=0;n<1<<extra_lbits[code];n++)_length_code[length++]=code;for(_length_code[length-1]=code,dist=0,code=0;code<16;code++)for(base_dist[code]=dist,n=0;n<1<<extra_dbits[code];n++)_dist_code[dist++]=code;for(dist>>=7;code<D_CODES;code++)for(base_dist[code]=dist<<7,n=0;n<1<<extra_dbits[code]-7;n++)_dist_code[256+dist++]=code;for(bits=0;bits<=MAX_BITS;bits++)bl_count[bits]=0;for(n=0;n<=143;)static_ltree[2*n+1]=8,n++,bl_count[8]++;for(;n<=255;)static_ltree[2*n+1]=9,n++,bl_count[9]++;for(;n<=279;)static_ltree[2*n+1]=7,n++,bl_count[7]++;for(;n<=287;)static_ltree[2*n+1]=8,n++,bl_count[8]++;for(gen_codes(static_ltree,L_CODES+1,bl_count),n=0;n<D_CODES;n++)static_dtree[2*n+1]=5,static_dtree[2*n]=bi_reverse(n,5);static_l_desc=new StaticTreeDesc(static_ltree,extra_lbits,LITERALS+1,L_CODES,MAX_BITS),static_d_desc=new StaticTreeDesc(static_dtree,extra_dbits,0,D_CODES,MAX_BITS),static_bl_desc=new StaticTreeDesc(new Array(0),extra_blbits,0,BL_CODES,MAX_BL_BITS)}function init_block(s){var n;for(n=0;n<L_CODES;n++)s.dyn_ltree[2*n]=0;for(n=0;n<D_CODES;n++)s.dyn_dtree[2*n]=0;for(n=0;n<BL_CODES;n++)s.bl_tree[2*n]=0;s.dyn_ltree[2*END_BLOCK]=1,s.opt_len=s.static_len=0,s.last_lit=s.matches=0}function bi_windup(s){s.bi_valid>8?put_short(s,s.bi_buf):s.bi_valid>0&&(s.pending_buf[s.pending++]=s.bi_buf),s.bi_buf=0,s.bi_valid=0}function copy_block(s,buf,len,header){bi_windup(s),header&&(put_short(s,len),put_short(s,~len)),utils.arraySet(s.pending_buf,s.window,buf,len,s.pending),s.pending+=len}function smaller(tree,n,m,depth){var _n2=2*n,_m2=2*m;return tree[_n2]<tree[_m2]||tree[_n2]===tree[_m2]&&depth[n]<=depth[m]}function pqdownheap(s,tree,k){for(var v=s.heap[k],j=k<<1;j<=s.heap_len&&(j<s.heap_len&&smaller(tree,s.heap[j+1],s.heap[j],s.depth)&&j++,!smaller(tree,v,s.heap[j],s.depth));)s.heap[k]=s.heap[j],k=j,j<<=1;s.heap[k]=v}function compress_block(s,ltree,dtree){var dist,lc,code,extra,lx=0;if(0!==s.last_lit)do{dist=s.pending_buf[s.d_buf+2*lx]<<8|s.pending_buf[s.d_buf+2*lx+1],lc=s.pending_buf[s.l_buf+lx],lx++,0===dist?send_code(s,lc,ltree):(code=_length_code[lc],send_code(s,code+LITERALS+1,ltree),extra=extra_lbits[code],0!==extra&&(lc-=base_length[code],send_bits(s,lc,extra)),dist--,code=d_code(dist),send_code(s,code,dtree),0!==(extra=extra_dbits[code])&&(dist-=base_dist[code],send_bits(s,dist,extra)))}while(lx<s.last_lit);send_code(s,END_BLOCK,ltree)}function build_tree(s,desc){var n,m,node,tree=desc.dyn_tree,stree=desc.stat_desc.static_tree,has_stree=desc.stat_desc.has_stree,elems=desc.stat_desc.elems,max_code=-1;for(s.heap_len=0,s.heap_max=HEAP_SIZE,n=0;n<elems;n++)0!==tree[2*n]?(s.heap[++s.heap_len]=max_code=n,s.depth[n]=0):tree[2*n+1]=0;for(;s.heap_len<2;)node=s.heap[++s.heap_len]=max_code<2?++max_code:0,tree[2*node]=1,s.depth[node]=0,s.opt_len--,has_stree&&(s.static_len-=stree[2*node+1]);for(desc.max_code=max_code,n=s.heap_len>>1;n>=1;n--)pqdownheap(s,tree,n);node=elems;do{n=s.heap[1],s.heap[1]=s.heap[s.heap_len--],pqdownheap(s,tree,1),m=s.heap[1],s.heap[--s.heap_max]=n,s.heap[--s.heap_max]=m,tree[2*node]=tree[2*n]+tree[2*m],s.depth[node]=(s.depth[n]>=s.depth[m]?s.depth[n]:s.depth[m])+1,tree[2*n+1]=tree[2*m+1]=node,s.heap[1]=node++,pqdownheap(s,tree,1)}while(s.heap_len>=2);s.heap[--s.heap_max]=s.heap[1],gen_bitlen(s,desc),gen_codes(tree,max_code,s.bl_count)}function scan_tree(s,tree,max_code){var n,curlen,prevlen=-1,nextlen=tree[1],count=0,max_count=7,min_count=4;for(0===nextlen&&(max_count=138,min_count=3),tree[2*(max_code+1)+1]=65535,n=0;n<=max_code;n++)curlen=nextlen,nextlen=tree[2*(n+1)+1],++count<max_count&&curlen===nextlen||(count<min_count?s.bl_tree[2*curlen]+=count:0!==curlen?(curlen!==prevlen&&s.bl_tree[2*curlen]++,s.bl_tree[2*REP_3_6]++):count<=10?s.bl_tree[2*REPZ_3_10]++:s.bl_tree[2*REPZ_11_138]++,count=0,prevlen=curlen,0===nextlen?(max_count=138,min_count=3):curlen===nextlen?(max_count=6,min_count=3):(max_count=7,min_count=4))}function send_tree(s,tree,max_code){var n,curlen,prevlen=-1,nextlen=tree[1],count=0,max_count=7,min_count=4;for(0===nextlen&&(max_count=138,min_count=3),n=0;n<=max_code;n++)if(curlen=nextlen,nextlen=tree[2*(n+1)+1],!(++count<max_count&&curlen===nextlen)){if(count<min_count)do{send_code(s,curlen,s.bl_tree)}while(0!=--count);else 0!==curlen?(curlen!==prevlen&&(send_code(s,curlen,s.bl_tree),count--),send_code(s,REP_3_6,s.bl_tree),send_bits(s,count-3,2)):count<=10?(send_code(s,REPZ_3_10,s.bl_tree),send_bits(s,count-3,3)):(send_code(s,REPZ_11_138,s.bl_tree),send_bits(s,count-11,7));count=0,prevlen=curlen,0===nextlen?(max_count=138,min_count=3):curlen===nextlen?(max_count=6,min_count=3):(max_count=7,min_count=4)}}function build_bl_tree(s){var max_blindex;for(scan_tree(s,s.dyn_ltree,s.l_desc.max_code),scan_tree(s,s.dyn_dtree,s.d_desc.max_code),build_tree(s,s.bl_desc),max_blindex=BL_CODES-1;max_blindex>=3&&0===s.bl_tree[2*bl_order[max_blindex]+1];max_blindex--);return s.opt_len+=3*(max_blindex+1)+5+5+4,max_blindex}function send_all_trees(s,lcodes,dcodes,blcodes){var rank;for(send_bits(s,lcodes-257,5),send_bits(s,dcodes-1,5),send_bits(s,blcodes-4,4),rank=0;rank<blcodes;rank++)send_bits(s,s.bl_tree[2*bl_order[rank]+1],3);send_tree(s,s.dyn_ltree,lcodes-1),send_tree(s,s.dyn_dtree,dcodes-1)}function detect_data_type(s){var n,black_mask=4093624447;for(n=0;n<=31;n++,black_mask>>>=1)if(1&black_mask&&0!==s.dyn_ltree[2*n])return Z_BINARY;if(0!==s.dyn_ltree[18]||0!==s.dyn_ltree[20]||0!==s.dyn_ltree[26])return Z_TEXT;for(n=32;n<LITERALS;n++)if(0!==s.dyn_ltree[2*n])return Z_TEXT;return Z_BINARY}function _tr_init(s){static_init_done||(tr_static_init(),static_init_done=!0),s.l_desc=new TreeDesc(s.dyn_ltree,static_l_desc),s.d_desc=new TreeDesc(s.dyn_dtree,static_d_desc),s.bl_desc=new TreeDesc(s.bl_tree,static_bl_desc),s.bi_buf=0,s.bi_valid=0,init_block(s)}function _tr_stored_block(s,buf,stored_len,last){send_bits(s,(STORED_BLOCK<<1)+(last?1:0),3),copy_block(s,buf,stored_len,!0)}function _tr_align(s){send_bits(s,STATIC_TREES<<1,3),send_code(s,END_BLOCK,static_ltree),bi_flush(s)}function _tr_flush_block(s,buf,stored_len,last){var opt_lenb,static_lenb,max_blindex=0;s.level>0?(s.strm.data_type===Z_UNKNOWN&&(s.strm.data_type=detect_data_type(s)),build_tree(s,s.l_desc),build_tree(s,s.d_desc),max_blindex=build_bl_tree(s),opt_lenb=s.opt_len+3+7>>>3,(static_lenb=s.static_len+3+7>>>3)<=opt_lenb&&(opt_lenb=static_lenb)):opt_lenb=static_lenb=stored_len+5,stored_len+4<=opt_lenb&&-1!==buf?_tr_stored_block(s,buf,stored_len,last):s.strategy===Z_FIXED||static_lenb===opt_lenb?(send_bits(s,(STATIC_TREES<<1)+(last?1:0),3),compress_block(s,static_ltree,static_dtree)):(send_bits(s,(DYN_TREES<<1)+(last?1:0),3),send_all_trees(s,s.l_desc.max_code+1,s.d_desc.max_code+1,max_blindex+1),
compress_block(s,s.dyn_ltree,s.dyn_dtree)),init_block(s),last&&bi_windup(s)}function _tr_tally(s,dist,lc){return s.pending_buf[s.d_buf+2*s.last_lit]=dist>>>8&255,s.pending_buf[s.d_buf+2*s.last_lit+1]=255&dist,s.pending_buf[s.l_buf+s.last_lit]=255&lc,s.last_lit++,0===dist?s.dyn_ltree[2*lc]++:(s.matches++,dist--,s.dyn_ltree[2*(_length_code[lc]+LITERALS+1)]++,s.dyn_dtree[2*d_code(dist)]++),s.last_lit===s.lit_bufsize-1}var utils=require("../utils/common"),Z_FIXED=4,Z_BINARY=0,Z_TEXT=1,Z_UNKNOWN=2,STORED_BLOCK=0,STATIC_TREES=1,DYN_TREES=2,LENGTH_CODES=29,LITERALS=256,L_CODES=LITERALS+1+LENGTH_CODES,D_CODES=30,BL_CODES=19,HEAP_SIZE=2*L_CODES+1,MAX_BITS=15,Buf_size=16,MAX_BL_BITS=7,END_BLOCK=256,REP_3_6=16,REPZ_3_10=17,REPZ_11_138=18,extra_lbits=[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],extra_dbits=[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],extra_blbits=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],bl_order=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],static_ltree=new Array(2*(L_CODES+2));zero(static_ltree);var static_dtree=new Array(2*D_CODES);zero(static_dtree);var _dist_code=new Array(512);zero(_dist_code);var _length_code=new Array(256);zero(_length_code);var base_length=new Array(LENGTH_CODES);zero(base_length);var base_dist=new Array(D_CODES);zero(base_dist);var static_l_desc,static_d_desc,static_bl_desc,static_init_done=!1;exports._tr_init=_tr_init,exports._tr_stored_block=_tr_stored_block,exports._tr_flush_block=_tr_flush_block,exports._tr_tally=_tr_tally,exports._tr_align=_tr_align},{"../utils/common":77}],89:[function(require,module,exports){"use strict";function ZStream(){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}module.exports=ZStream},{}],90:[function(require,module,exports){(function(Buffer){"use strict";function ImageData(width,height,channels,data,trailer){this.width=width,this.height=height,this.channels=channels,this.data=data,this.trailer=trailer}function paeth(a,b,c){var p=a+b-c,pa=Math.abs(p-a),pb=Math.abs(p-b),pc=Math.abs(p-c);return pa<=pb&&pa<=pc?a:pb<=pc?b:c}function parseData(dataBuffer){var chunkLength,pngWidth,pngHeight,pngBitDepth,pngDepthMult,pngColorType,pngPixels,pngSamplesPerPixel,pngBytesPerPixel,pngBytesPerScanline,pngSamples,currentScanline,priorScanline,scanlineFilter,pngTrailer,pngPalette,pngAlpha,idChannels,state=0,off=0,buf=new Buffer(13),b=-1,p=0,pngPaletteEntries=0,pngAlphaEntries=0,inflateQueue=[];if(!function(data){for(var tmp,j,len=data.length,i=0;i!==len;)switch(state){case 0:if(data.readUInt8(i++)!==HEADER[off++])return!1;off===HEADER.length&&(state=1,off=0);break;case 1:if(len-i<8-off)data.copy(buf,off,i),off+=len-i,i=len;else switch(data.copy(buf,off,i,i+8-off),i+=8-off,off=0,chunkLength=buf.readUInt32BE(0),buf.toString("ascii",4,8)){case"IHDR":state=2;break;case"PLTE":if(3!==pngColorType)state=7;else{if(chunkLength%3!=0)return!1;pngPaletteEntries=chunkLength/3,pngPalette=new Buffer(chunkLength),state=3}break;case"tRNS":if(3!==pngColorType)return!1;idChannels++,pngAlphaEntries=chunkLength,pngAlpha=new Buffer(chunkLength),state=4;break;case"IDAT":pngPixels||(pngPixels=new Uint8Array(pngWidth*pngHeight*idChannels)),state=5;break;case"IEND":state=6;break;default:state=7}break;case 2:if(13!==chunkLength)return!1;if(len-i<chunkLength-off)data.copy(buf,off,i),off+=len-i,i=len;else{if(data.copy(buf,off,i,i+chunkLength-off),0!==buf.readUInt8(10))return!1;if(0!==buf.readUInt8(11))return!1;if(0!==buf.readUInt8(12))return!1;switch(i+=chunkLength-off,state=8,off=0,pngWidth=buf.readUInt32BE(0),pngHeight=buf.readUInt32BE(4),pngBitDepth=buf.readUInt8(8),pngDepthMult=255/((1<<pngBitDepth)-1),pngColorType=buf.readUInt8(9)){case 0:pngSamplesPerPixel=1,pngBytesPerPixel=Math.ceil(.125*pngBitDepth),idChannels=1;break;case 2:pngSamplesPerPixel=3,pngBytesPerPixel=Math.ceil(.375*pngBitDepth),idChannels=3;break;case 3:pngSamplesPerPixel=1,pngBytesPerPixel=1,idChannels=3;break;case 4:pngSamplesPerPixel=2,pngBytesPerPixel=Math.ceil(.25*pngBitDepth),idChannels=2;break;case 6:pngSamplesPerPixel=4,pngBytesPerPixel=Math.ceil(.5*pngBitDepth),idChannels=4;break;default:return!1}pngBytesPerScanline=Math.ceil(pngWidth*pngBitDepth*pngSamplesPerPixel/8),pngSamples=new Buffer(pngSamplesPerPixel),currentScanline=new Buffer(pngBytesPerScanline),priorScanline=new Buffer(pngBytesPerScanline),currentScanline.fill(0)}break;case 3:if(len-i<chunkLength-off)data.copy(pngPalette,off,i),off+=len-i,i=len;else for(data.copy(pngPalette,off,i,i+chunkLength-off),i+=chunkLength-off,state=8,off=0,idChannels=1,j=pngPaletteEntries;j--;)if(pngPalette[3*j+0]!==pngPalette[3*j+1]||pngPalette[3*j+0]!==pngPalette[3*j+2]){idChannels=3;break}break;case 4:len-i<chunkLength-off?(data.copy(pngAlpha,off,i),off+=len-i,i=len):(data.copy(pngAlpha,off,i,i+chunkLength-off),i+=chunkLength-off,state=8,off=0);break;case 5:len-i<chunkLength-off?(inflateQueue.push(data.slice(i)),off+=len-i,i=len):(inflateQueue.push(data.slice(i,i+chunkLength-off)),i+=chunkLength-off,state=8,off=0);break;case 6:if(0!==chunkLength)return!1;len-i<4-off?(off+=len-i,i=len):(pngTrailer=new Buffer(0),i+=4-off,state=9,off=0);break;case 7:len-i<chunkLength-off?(off+=len-i,i=len):(i+=chunkLength-off,state=8,off=0);break;case 8:len-i<4-off?(off+=len-i,i=len):(i+=4-off,state=1,off=0);break;case 9:tmp=new Buffer(off+len-i),pngTrailer.copy(tmp),data.copy(tmp,off,i,len),pngTrailer=tmp,off+=len-i,i=len}return!0}(dataBuffer))return null;if(9!==state)return null;var inflateBuffer=Buffer.concat(inflateQueue),inflateData=pako.inflate(new Uint8Array(inflateBuffer));return function(data){var i,tmp,x,j,k,len=data.length;for(i=0;i!==len;++i){if(-1===b)scanlineFilter=data[i],tmp=currentScanline,currentScanline=priorScanline,priorScanline=tmp;else switch(scanlineFilter){case 0:currentScanline[b]=data[i];break;case 1:currentScanline[b]=b<pngBytesPerPixel?data[i]:data[i]+currentScanline[b-pngBytesPerPixel]&255;break;case 2:currentScanline[b]=data[i]+priorScanline[b]&255;break;case 3:currentScanline[b]=data[i]+((b<pngBytesPerPixel?priorScanline[b]:currentScanline[b-pngBytesPerPixel]+priorScanline[b])>>>1)&255;break;case 4:currentScanline[b]=data[i]+(b<pngBytesPerPixel?priorScanline[b]:paeth(currentScanline[b-pngBytesPerPixel],priorScanline[b],priorScanline[b-pngBytesPerPixel]))&255;break;default:return null}if(++b===pngBytesPerScanline){if(p===pngPixels.length)return null;for(j=0,x=0;x!==pngWidth;++x){for(k=0;k!==pngSamplesPerPixel;++j,++k)switch(pngBitDepth){case 1:pngSamples[k]=currentScanline[j>>>3]>>7-(7&j)&1;break;case 2:pngSamples[k]=currentScanline[j>>>2]>>(3-(3&j)<<1)&3;break;case 4:pngSamples[k]=currentScanline[j>>>1]>>(1-(1&j)<<2)&15;break;case 8:pngSamples[k]=currentScanline[j];break;default:return null}switch(pngColorType){case 0:pngPixels[p++]=pngSamples[0]*pngDepthMult;break;case 2:pngPixels[p++]=pngSamples[0]*pngDepthMult,pngPixels[p++]=pngSamples[1]*pngDepthMult,pngPixels[p++]=pngSamples[2]*pngDepthMult;break;case 3:if(pngSamples[0]>=pngPaletteEntries)return null;switch(idChannels){case 1:pngPixels[p++]=pngPalette[3*pngSamples[0]];break;case 2:pngPixels[p++]=pngPalette[3*pngSamples[0]],pngPixels[p++]=pngSamples[0]<pngAlphaEntries?pngAlpha[pngSamples[0]]:255;break;case 3:pngPixels[p++]=pngPalette[3*pngSamples[0]+0],pngPixels[p++]=pngPalette[3*pngSamples[0]+1],pngPixels[p++]=pngPalette[3*pngSamples[0]+2];break;case 4:pngPixels[p++]=pngPalette[3*pngSamples[0]+0],pngPixels[p++]=pngPalette[3*pngSamples[0]+1],pngPixels[p++]=pngPalette[3*pngSamples[0]+2],pngPixels[p++]=pngSamples[0]<pngAlphaEntries?pngAlpha[pngSamples[0]]:255}break;case 4:pngPixels[p++]=pngSamples[0]*pngDepthMult,pngPixels[p++]=pngSamples[1]*pngDepthMult;break;case 6:pngPixels[p++]=pngSamples[0]*pngDepthMult,pngPixels[p++]=pngSamples[1]*pngDepthMult,pngPixels[p++]=pngSamples[2]*pngDepthMult,pngPixels[p++]=pngSamples[3]*pngDepthMult}}b=-1}}return!0}(inflateData)?p!==pngPixels.length?null:new ImageData(pngWidth,pngHeight,idChannels,pngPixels,pngTrailer):null}module.exports=parseData;var pako=require("pako"),HEADER=new Buffer("89504e470d0a1a0a","hex")}).call(this,require("buffer").Buffer)},{buffer:108,pako:74}],91:[function(require,module,exports){function fallback(fn){var curr=(new Date).getTime(),ms=Math.max(0,16-(curr-prev)),req=setTimeout(fn,ms);return prev=curr,req}exports=module.exports=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||fallback;var prev=(new Date).getTime(),cancel=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||window.clearTimeout;exports.cancel=function(id){cancel.call(window,id)}},{}],92:[function(require,module,exports){module.exports={cells:[[1,0,2],[3,1,2],[4,5,6],[5,7,6],[0,1,5],[4,0,5],[1,3,5],[3,7,5],[2,0,4],[2,4,6],[2,6,3],[6,7,3]],positions:[[0,0,0],[0,0,1],[1,0,0],[1,0,1],[0,1,0],[0,1,1],[1,1,0],[1,1,1]]}},{}],93:[function(require,module,exports){function createPrism(size,pos){pos=pos||[0,0,0],size=size||[1,1,1],Array.isArray(size)||(size=[size,size,size]);for(var prism=clonePrism(),i=0;i<prism.positions.length;i++)prism.positions[i][0]*=size[0],prism.positions[i][1]*=size[1],prism.positions[i][2]*=size[2],prism.positions[i][0]+=pos[0],prism.positions[i][1]+=pos[1],prism.positions[i][2]+=pos[2];return prism}function clonePrism(){return{cells:prism.cells.map(function(d){return d.slice()}),positions:prism.positions.map(function(d){return d.slice()})}}var prism=require("./cube");module.exports=createPrism},{"./cube":92}],94:[function(require,module,exports){"use strict";function repeat(str,num){if("string"!=typeof str)throw new TypeError("expected a string");if(1===num)return str;if(2===num)return str+str;var max=str.length*num;if(cache!==str||void 0===cache)cache=str,res="";else if(res.length>=max)return res.substr(0,max);for(;max>res.length&&num>1;)1&num&&(res+=str),num>>=1,str+=str;return res+=str,res=res.substr(0,max)}var cache,res="";module.exports=repeat},{}],95:[function(require,module,exports){(function(global){module.exports=global.performance&&global.performance.now?function(){return performance.now()}:Date.now||function(){return+new Date}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],96:[function(require,module,exports){module.exports=require("./lib/sliced")},{"./lib/sliced":97}],97:[function(require,module,exports){module.exports=function(args,slice,sliceEnd){var ret=[],len=args.length;if(0===len)return ret;var start=slice<0?Math.max(0,slice+len):slice||0;for(void 0!==sliceEnd&&(len=sliceEnd<0?sliceEnd+len:sliceEnd);len-- >start;)ret[len-start]=args[len];return ret}},{}],98:[function(require,module,exports){!function(){"use strict";function sprintf(key){return sprintf_format(sprintf_parse(key),arguments)}function vsprintf(fmt,argv){return sprintf.apply(null,[fmt].concat(argv||[]))}function sprintf_format(parse_tree,argv){var arg,i,k,ph,pad,pad_character,pad_length,is_positive,sign,cursor=1,tree_length=parse_tree.length,output="";for(i=0;i<tree_length;i++)if("string"==typeof parse_tree[i])output+=parse_tree[i];else if("object"==typeof parse_tree[i]){if(ph=parse_tree[i],ph.keys)for(arg=argv[cursor],k=0;k<ph.keys.length;k++){if(void 0==arg)throw new Error(sprintf('[sprintf] Cannot access property "%s" of undefined value "%s"',ph.keys[k],ph.keys[k-1]));arg=arg[ph.keys[k]]}else arg=ph.param_no?argv[ph.param_no]:argv[cursor++];if(re.not_type.test(ph.type)&&re.not_primitive.test(ph.type)&&arg instanceof Function&&(arg=arg()),re.numeric_arg.test(ph.type)&&"number"!=typeof arg&&isNaN(arg))throw new TypeError(sprintf("[sprintf] expecting number but found %T",arg));switch(re.number.test(ph.type)&&(is_positive=arg>=0),ph.type){case"b":arg=parseInt(arg,10).toString(2);break;case"c":arg=String.fromCharCode(parseInt(arg,10));break;case"d":case"i":arg=parseInt(arg,10);break;case"j":arg=JSON.stringify(arg,null,ph.width?parseInt(ph.width):0);break;case"e":arg=ph.precision?parseFloat(arg).toExponential(ph.precision):parseFloat(arg).toExponential();break;case"f":arg=ph.precision?parseFloat(arg).toFixed(ph.precision):parseFloat(arg);break;case"g":arg=ph.precision?String(Number(arg.toPrecision(ph.precision))):parseFloat(arg);break;case"o":arg=(parseInt(arg,10)>>>0).toString(8);break;case"s":arg=String(arg),arg=ph.precision?arg.substring(0,ph.precision):arg;break;case"t":arg=String(!!arg),arg=ph.precision?arg.substring(0,ph.precision):arg;break;case"T":arg=Object.prototype.toString.call(arg).slice(8,-1).toLowerCase(),arg=ph.precision?arg.substring(0,ph.precision):arg;break;case"u":arg=parseInt(arg,10)>>>0;break;case"v":arg=arg.valueOf(),arg=ph.precision?arg.substring(0,ph.precision):arg;break;case"x":arg=(parseInt(arg,10)>>>0).toString(16);break;case"X":arg=(parseInt(arg,10)>>>0).toString(16).toUpperCase()}re.json.test(ph.type)?output+=arg:(!re.number.test(ph.type)||is_positive&&!ph.sign?sign="":(sign=is_positive?"+":"-",arg=arg.toString().replace(re.sign,"")),pad_character=ph.pad_char?"0"===ph.pad_char?"0":ph.pad_char.charAt(1):" ",pad_length=ph.width-(sign+arg).length,pad=ph.width&&pad_length>0?pad_character.repeat(pad_length):"",output+=ph.align?sign+arg+pad:"0"===pad_character?sign+pad+arg:pad+sign+arg)}return output}function sprintf_parse(fmt){if(sprintf_cache[fmt])return sprintf_cache[fmt];for(var match,_fmt=fmt,parse_tree=[],arg_names=0;_fmt;){if(null!==(match=re.text.exec(_fmt)))parse_tree.push(match[0]);else if(null!==(match=re.modulo.exec(_fmt)))parse_tree.push("%");else{if(null===(match=re.placeholder.exec(_fmt)))throw new SyntaxError("[sprintf] unexpected placeholder");if(match[2]){arg_names|=1;var field_list=[],replacement_field=match[2],field_match=[];if(null===(field_match=re.key.exec(replacement_field)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(field_list.push(field_match[1]);""!==(replacement_field=replacement_field.substring(field_match[0].length));)if(null!==(field_match=re.key_access.exec(replacement_field)))field_list.push(field_match[1]);else{if(null===(field_match=re.index_access.exec(replacement_field)))throw new SyntaxError("[sprintf] failed to parse named argument key");field_list.push(field_match[1])}match[2]=field_list}else arg_names|=2;if(3===arg_names)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");parse_tree.push({placeholder:match[0],param_no:match[1],keys:match[2],sign:match[3],pad_char:match[4],align:match[5],width:match[6],precision:match[7],type:match[8]})}_fmt=_fmt.substring(match[0].length)}return sprintf_cache[fmt]=parse_tree}var re={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/},sprintf_cache=Object.create(null);void 0!==exports&&(exports.sprintf=sprintf,exports.vsprintf=vsprintf),"undefined"!=typeof window&&(window.sprintf=sprintf,window.vsprintf=vsprintf,"function"==typeof define&&define.amd&&define(function(){return{sprintf:sprintf,vsprintf:vsprintf}}))}()},{}],99:[function(require,module,exports){(function(global){"use strict";var bits=require("bit-twiddle"),dup=require("dup");global.__TYPEDARRAY_POOL||(global.__TYPEDARRAY_POOL={UINT8:dup([32,0]),UINT16:dup([32,0]),UINT32:dup([32,0]),INT8:dup([32,0]),INT16:dup([32,0]),INT32:dup([32,0]),FLOAT:dup([32,0]),DOUBLE:dup([32,0]),DATA:dup([32,0])});var POOL=global.__TYPEDARRAY_POOL,UINT8=POOL.UINT8,UINT16=POOL.UINT16,UINT32=POOL.UINT32,INT8=POOL.INT8,INT16=POOL.INT16,INT32=POOL.INT32,FLOAT=POOL.FLOAT,DOUBLE=POOL.DOUBLE,DATA=POOL.DATA;exports.free=function(array){if(array instanceof ArrayBuffer){var n=0|array.byteLength,log_n=bits.log2(n);DATA[log_n].push(array)}else{var n=0|array.length,log_n=bits.log2(n);array instanceof Uint8Array?UINT8[log_n].push(array):array instanceof Uint16Array?UINT16[log_n].push(array):array instanceof Uint32Array?UINT32[log_n].push(array):array instanceof Int8Array?INT8[log_n].push(array):array instanceof Int16Array?INT16[log_n].push(array):array instanceof Int32Array?INT32[log_n].push(array):array instanceof Float32Array?FLOAT[log_n].push(array):array instanceof Float64Array&&DOUBLE[log_n].push(array)}},exports.freeUint8=function(array){UINT8[bits.log2(array.length)].push(array)},exports.freeUint16=function(array){UINT16[bits.log2(array.length)].push(array)},exports.freeUint32=function(array){UINT32[bits.log2(array.length)].push(array)},exports.freeInt8=function(array){INT8[bits.log2(array.length)].push(array)},exports.freeInt16=function(array){INT16[bits.log2(array.length)].push(array)},exports.freeInt32=function(array){INT32[bits.log2(array.length)].push(array)},exports.freeFloat32=exports.freeFloat=function(array){FLOAT[bits.log2(array.length)].push(array)},exports.freeFloat64=exports.freeDouble=function(array){DOUBLE[bits.log2(array.length)].push(array)},exports.freeArrayBuffer=function(array){DATA[bits.log2(array.length)].push(array)},exports.malloc=function(n,dtype){n=bits.nextPow2(n);var log_n=bits.log2(n);if(void 0===dtype){var d=DATA[log_n];if(d.length>0){var r=d[d.length-1];return d.pop(),r}return new ArrayBuffer(n)}switch(dtype){case"uint8":var u8=UINT8[log_n];return u8.length>0?u8.pop():new Uint8Array(n);case"uint16":var u16=UINT16[log_n];return u16.length>0?u16.pop():new Uint16Array(n);case"uint32":var u32=UINT32[log_n];return u32.length>0?u32.pop():new Uint32Array(n);case"int8":var i8=INT8[log_n];return i8.length>0?i8.pop():new Int8Array(n);case"int16":var i16=INT16[log_n];return i16.length>0?i16.pop():new Int16Array(n);case"int32":var i32=INT32[log_n];return i32.length>0?i32.pop():new Int32Array(n);case"float":case"float32":var f=FLOAT[log_n];return f.length>0?f.pop():new Float32Array(n);case"double":case"float64":var dd=DOUBLE[log_n];return dd.length>0?dd.pop():new Float64Array(n);default:return null}return null},exports.mallocUint8=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=UINT8[log_n];return cache.length>0?cache.pop():new Uint8Array(n)},exports.mallocUint16=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=UINT16[log_n];return cache.length>0?cache.pop():new Uint16Array(n)},exports.mallocUint32=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=UINT32[log_n];return cache.length>0?cache.pop():new Uint32Array(n)},exports.mallocInt8=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=INT8[log_n];return cache.length>0?cache.pop():new Int8Array(n)},exports.mallocInt16=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=INT16[log_n];return cache.length>0?cache.pop():new Int16Array(n)},exports.mallocInt32=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=INT32[log_n];return cache.length>0?cache.pop():new Int32Array(n)},exports.mallocFloat32=exports.mallocFloat=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=FLOAT[log_n];return cache.length>0?cache.pop():new Float32Array(n)},exports.mallocFloat64=exports.mallocDouble=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=DOUBLE[log_n];return cache.length>0?cache.pop():new Float64Array(n)},exports.mallocArrayBuffer=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=DATA[log_n];return cache.length>0?cache.pop():new ArrayBuffer(n)},exports.clearCache=function(){for(var i=0;i<32;++i)UINT8[i].length=0,UINT16[i].length=0,UINT32[i].length=0,INT8[i].length=0,INT16[i].length=0,INT32[i].length=0,FLOAT[i].length=0,DOUBLE[i].length=0,DATA[i].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"bit-twiddle":8,dup:16}],100:[function(require,module,exports){function unindex(positions,cells,out){positions.positions&&positions.cells&&(out=cells,cells=positions.cells,positions=positions.positions),out=out||new Float32Array(9*cells.length);for(var i=0,n=0,l=cells.length;i<l;i+=1)out[n++]=positions[cells[i][0]][0],out[n++]=positions[cells[i][0]][1],out[n++]=positions[cells[i][0]][2],out[n++]=positions[cells[i][1]][0],out[n++]=positions[cells[i][1]][1],out[n++]=positions[cells[i][1]][2],out[n++]=positions[cells[i][2]][0],out[n++]=positions[cells[i][2]][1],out[n++]=positions[cells[i][2]][2];return out}module.exports=unindex},{}],101:[function(require,module,exports){"use strict";function unique_pred(list,compare){for(var ptr=1,len=list.length,a=list[0],b=list[0],i=1;i<len;++i)if(b=a,a=list[i],compare(a,b)){if(i===ptr){ptr++;continue}list[ptr++]=a}return list.length=ptr,list}function unique_eq(list){for(var ptr=1,len=list.length,a=list[0],b=list[0],i=1;i<len;++i,b=a)if(b=a,(a=list[i])!==b){if(i===ptr){ptr++;continue}list[ptr++]=a}return list.length=ptr,list}function unique(list,compare,sorted){return 0===list.length?list:compare?(sorted||list.sort(compare),unique_pred(list,compare)):(sorted||list.sort(),unique_eq(list))}module.exports=unique},{}],102:[function(require,module,exports){!function(){"use strict";function weakMapPermitHostObjects(map){map.permitHostObjects___&&map.permitHostObjects___(weakMapPermitHostObjects)}function isNotHiddenName(name){return!(name.substr(0,HIDDEN_NAME_PREFIX.length)==HIDDEN_NAME_PREFIX&&"___"===name.substr(name.length-3))}function getHiddenRecord(key){if(key!==Object(key))throw new TypeError("Not an object: "+key);var hiddenRecord=key[HIDDEN_NAME];if(hiddenRecord&&hiddenRecord.key===key)return hiddenRecord;if(isExtensible(key)){hiddenRecord={key:key};try{return defProp(key,HIDDEN_NAME,{value:hiddenRecord,writable:!1,enumerable:!1,configurable:!1}),hiddenRecord}catch(error){return}}}function constFunc(func){return func.prototype=null,Object.freeze(func)}function calledAsFunctionWarning(){calledAsFunctionWarningDone||"undefined"==typeof console||(calledAsFunctionWarningDone=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}if("undefined"==typeof ses||!ses.ok||ses.ok()){"undefined"!=typeof ses&&(ses.weakMapPermitHostObjects=weakMapPermitHostObjects);var doubleWeakMapCheckSilentFailure=!1;if("function"==typeof WeakMap){var HostWeakMap=WeakMap;if("undefined"!=typeof navigator&&/Firefox/.test(navigator.userAgent));else{var testMap=new HostWeakMap,testObject=Object.freeze({});if(testMap.set(testObject,1),1===testMap.get(testObject))return void(module.exports=WeakMap);doubleWeakMapCheckSilentFailure=!0}}var gopn=(Object.prototype.hasOwnProperty,Object.getOwnPropertyNames),defProp=Object.defineProperty,isExtensible=Object.isExtensible,HIDDEN_NAME_PREFIX="weakmap:",HIDDEN_NAME=HIDDEN_NAME_PREFIX+"ident:"+Math.random()+"___";if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues&&"function"==typeof ArrayBuffer&&"function"==typeof Uint8Array){var ab=new ArrayBuffer(25),u8s=new Uint8Array(ab);crypto.getRandomValues(u8s),HIDDEN_NAME=HIDDEN_NAME_PREFIX+"rand:"+Array.prototype.map.call(u8s,function(u8){return(u8%36).toString(36)}).join("")+"___"}if(defProp(Object,"getOwnPropertyNames",{value:function(obj){return gopn(obj).filter(isNotHiddenName)}}),"getPropertyNames"in Object){var originalGetPropertyNames=Object.getPropertyNames;defProp(Object,"getPropertyNames",{value:function(obj){return originalGetPropertyNames(obj).filter(isNotHiddenName)}})}!function(){var oldFreeze=Object.freeze;defProp(Object,"freeze",{value:function(obj){return getHiddenRecord(obj),oldFreeze(obj)}});var oldSeal=Object.seal;defProp(Object,"seal",{value:function(obj){return getHiddenRecord(obj),oldSeal(obj)}});var oldPreventExtensions=Object.preventExtensions;defProp(Object,"preventExtensions",{value:function(obj){return getHiddenRecord(obj),oldPreventExtensions(obj)}})}();var calledAsFunctionWarningDone=!1,nextId=0,OurWeakMap=function(){function get___(key,opt_default){var index,hiddenRecord=getHiddenRecord(key);return hiddenRecord?id in hiddenRecord?hiddenRecord[id]:opt_default:(index=keys.indexOf(key),index>=0?values[index]:opt_default)}function has___(key){var hiddenRecord=getHiddenRecord(key);return hiddenRecord?id in hiddenRecord:keys.indexOf(key)>=0}function set___(key,value){var index,hiddenRecord=getHiddenRecord(key);return hiddenRecord?hiddenRecord[id]=value:(index=keys.indexOf(key),index>=0?values[index]=value:(index=keys.length,values[index]=value,keys[index]=key)),this}function delete___(key){var index,lastIndex,hiddenRecord=getHiddenRecord(key);return hiddenRecord?id in hiddenRecord&&delete hiddenRecord[id]:!((index=keys.indexOf(key))<0)&&(lastIndex=keys.length-1,keys[index]=void 0,values[index]=values[lastIndex],keys[index]=keys[lastIndex],keys.length=lastIndex,values.length=lastIndex,!0)}this instanceof OurWeakMap||calledAsFunctionWarning();var keys=[],values=[],id=nextId++;return Object.create(OurWeakMap.prototype,{get___:{value:constFunc(get___)},has___:{value:constFunc(has___)},set___:{value:constFunc(set___)},delete___:{value:constFunc(delete___)}})};OurWeakMap.prototype=Object.create(Object.prototype,{get:{value:function(key,opt_default){return this.get___(key,opt_default)},writable:!0,configurable:!0},has:{value:function(key){return this.has___(key)},writable:!0,configurable:!0},set:{value:function(key,value){return this.set___(key,value)},writable:!0,configurable:!0},delete:{value:function(key){return this.delete___(key)},writable:!0,configurable:!0}}),"function"==typeof HostWeakMap?function(){function DoubleWeakMap(){function dget(key,opt_default){return omap?hmap.has(key)?hmap.get(key):omap.get___(key,opt_default):hmap.get(key,opt_default)}function dhas(key){return hmap.has(key)||!!omap&&omap.has___(key)}function ddelete(key){var result=!!hmap.delete(key);return omap?omap.delete___(key)||result:result}this instanceof OurWeakMap||calledAsFunctionWarning();var dset,hmap=new HostWeakMap,omap=void 0,enableSwitching=!1;return dset=doubleWeakMapCheckSilentFailure?function(key,value){return hmap.set(key,value),hmap.has(key)||(omap||(omap=new OurWeakMap),omap.set(key,value)),this}:function(key,value){if(enableSwitching)try{hmap.set(key,value)}catch(e){omap||(omap=new OurWeakMap),omap.set___(key,value)}else hmap.set(key,value);return this},Object.create(OurWeakMap.prototype,{get___:{value:constFunc(dget)},has___:{value:constFunc(dhas)},set___:{value:constFunc(dset)},delete___:{value:constFunc(ddelete)},permitHostObjects___:{value:constFunc(function(token){if(token!==weakMapPermitHostObjects)throw new Error("bogus call to permitHostObjects___");enableSwitching=!0})}})}doubleWeakMapCheckSilentFailure&&"undefined"!=typeof Proxy&&(Proxy=void 0),DoubleWeakMap.prototype=OurWeakMap.prototype,module.exports=DoubleWeakMap,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),module.exports=OurWeakMap)}}()},{}],103:[function(require,module,exports){function createStore(){var key={};return function(obj){if(("object"!=typeof obj||null===obj)&&"function"!=typeof obj)throw new Error("Weakmap-shim: Key must be object");var store=obj.valueOf(key);return store&&store.identity===key?store:hiddenStore(obj,key)}}var hiddenStore=require("./hidden-store.js");module.exports=createStore},{"./hidden-store.js":104}],104:[function(require,module,exports){function hiddenStore(obj,key){var store={identity:key},valueOf=obj.valueOf;return Object.defineProperty(obj,"valueOf",{value:function(value){return value!==key?valueOf.apply(this,arguments):store},writable:!0}),store}module.exports=hiddenStore},{}],105:[function(require,module,exports){function weakMap(){var privates=createStore();return{get:function(key,fallback){var store=privates(key);return store.hasOwnProperty("value")?store.value:fallback},set:function(key,value){return privates(key).value=value,this},has:function(key){return"value"in privates(key)},delete:function(key){return delete privates(key).value}}}var createStore=require("./create-store.js");module.exports=weakMap},{"./create-store.js":103}],106:[function(require,module,exports){"use strict";function baseName(ext_name){for(var i=0;i<VENDOR_PREFIX.length;++i){var prefix=VENDOR_PREFIX[i];if(0===ext_name.indexOf(prefix))return ext_name.slice(prefix.length)}return ext_name}function initWebGLEW(gl){if(gl._webglew_struct)return gl._webglew_struct;for(var extensions={},supported=gl.getSupportedExtensions(),i=0;i<supported.length;++i){var ext=gl.getExtension(supported[i]);ext&&(extensions[supported[i]]=ext,extensions[baseName(supported[i])]=ext)}return gl._webglew_struct=extensions,extensions}var VENDOR_PREFIX=["WEBKIT_","MOZ_"];module.exports=initWebGLEW},{}],107:[function(require,module,exports){!function(exports){"use strict";function decode(elt){var code=elt.charCodeAt(0);return code===PLUS||code===PLUS_URL_SAFE?62:code===SLASH||code===SLASH_URL_SAFE?63:code<NUMBER?-1:code<NUMBER+10?code-NUMBER+26+26:code<UPPER+26?code-UPPER:code<LOWER+26?code-LOWER+26:void 0}function b64ToByteArray(b64){function push(v){arr[L++]=v}var i,j,l,tmp,placeHolders,arr;if(b64.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var len=b64.length;placeHolders="="===b64.charAt(len-2)?2:"="===b64.charAt(len-1)?1:0,arr=new Arr(3*b64.length/4-placeHolders),l=placeHolders>0?b64.length-4:b64.length;var L=0;for(i=0,j=0;i<l;i+=4,j+=3)tmp=decode(b64.charAt(i))<<18|decode(b64.charAt(i+1))<<12|decode(b64.charAt(i+2))<<6|decode(b64.charAt(i+3)),push((16711680&tmp)>>16),push((65280&tmp)>>8),push(255&tmp);return 2===placeHolders?(tmp=decode(b64.charAt(i))<<2|decode(b64.charAt(i+1))>>4,push(255&tmp)):1===placeHolders&&(tmp=decode(b64.charAt(i))<<10|decode(b64.charAt(i+1))<<4|decode(b64.charAt(i+2))>>2,push(tmp>>8&255),push(255&tmp)),arr}function uint8ToBase64(uint8){function encode(num){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(num)}var i,temp,length,extraBytes=uint8.length%3,output="";for(i=0,length=uint8.length-extraBytes;i<length;i+=3)temp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2],output+=function(num){return encode(num>>18&63)+encode(num>>12&63)+encode(num>>6&63)+encode(63&num)}(temp);switch(extraBytes){case 1:temp=uint8[uint8.length-1],output+=encode(temp>>2),output+=encode(temp<<4&63),output+="==";break;case 2:temp=(uint8[uint8.length-2]<<8)+uint8[uint8.length-1],output+=encode(temp>>10),output+=encode(temp>>4&63),output+=encode(temp<<2&63),output+="="}return output}var Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,PLUS="+".charCodeAt(0),SLASH="/".charCodeAt(0),NUMBER="0".charCodeAt(0),LOWER="a".charCodeAt(0),UPPER="A".charCodeAt(0),PLUS_URL_SAFE="-".charCodeAt(0),SLASH_URL_SAFE="_".charCodeAt(0);exports.toByteArray=b64ToByteArray,exports.fromByteArray=uint8ToBase64}(void 0===exports?this.base64js={}:exports)},{}],108:[function(require,module,exports){(function(global){"use strict";function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Buffer(arg){return this instanceof Buffer?(Buffer.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof arg?fromNumber(this,arg):"string"==typeof arg?fromString(this,arg,arguments.length>1?arguments[1]:"utf8"):fromObject(this,arg)):arguments.length>1?new Buffer(arg,arguments[1]):new Buffer(arg)}function fromNumber(that,length){if(that=allocate(that,length<0?0:0|checked(length)),!Buffer.TYPED_ARRAY_SUPPORT)for(var i=0;i<length;i++)that[i]=0;return that}function fromString(that,string,encoding){return"string"==typeof encoding&&""!==encoding||(encoding="utf8"),that=allocate(that,0|byteLength(string,encoding)),that.write(string,encoding),that}function fromObject(that,object){if(Buffer.isBuffer(object))return fromBuffer(that,object);if(isArray(object))return fromArray(that,object)
;if(null==object)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(object.buffer instanceof ArrayBuffer)return fromTypedArray(that,object);if(object instanceof ArrayBuffer)return fromArrayBuffer(that,object)}return object.length?fromArrayLike(that,object):fromJsonObject(that,object)}function fromBuffer(that,buffer){var length=0|checked(buffer.length);return that=allocate(that,length),buffer.copy(that,0,0,length),that}function fromArray(that,array){var length=0|checked(array.length);that=allocate(that,length);for(var i=0;i<length;i+=1)that[i]=255&array[i];return that}function fromTypedArray(that,array){var length=0|checked(array.length);that=allocate(that,length);for(var i=0;i<length;i+=1)that[i]=255&array[i];return that}function fromArrayBuffer(that,array){return Buffer.TYPED_ARRAY_SUPPORT?(array.byteLength,that=Buffer._augment(new Uint8Array(array))):that=fromTypedArray(that,new Uint8Array(array)),that}function fromArrayLike(that,array){var length=0|checked(array.length);that=allocate(that,length);for(var i=0;i<length;i+=1)that[i]=255&array[i];return that}function fromJsonObject(that,object){var array,length=0;"Buffer"===object.type&&isArray(object.data)&&(array=object.data,length=0|checked(array.length)),that=allocate(that,length);for(var i=0;i<length;i+=1)that[i]=255&array[i];return that}function allocate(that,length){return Buffer.TYPED_ARRAY_SUPPORT?(that=Buffer._augment(new Uint8Array(length)),that.__proto__=Buffer.prototype):(that.length=length,that._isBuffer=!0),0!==length&&length<=Buffer.poolSize>>>1&&(that.parent=rootParent),that}function checked(length){if(length>=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|length}function SlowBuffer(subject,encoding){if(!(this instanceof SlowBuffer))return new SlowBuffer(subject,encoding);var buf=new Buffer(subject,encoding);return delete buf.parent,buf}function byteLength(string,encoding){"string"!=typeof string&&(string=""+string);var len=string.length;if(0===len)return 0;for(var loweredCase=!1;;)switch(encoding){case"ascii":case"binary":case"raw":case"raws":return len;case"utf8":case"utf-8":return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*len;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase(),loweredCase=!0}}function slowToString(encoding,start,end){var loweredCase=!1;if(start|=0,end=void 0===end||end===1/0?this.length:0|end,encoding||(encoding="utf8"),start<0&&(start=0),end>this.length&&(end=this.length),end<=start)return"";for(;;)switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"binary":return binarySlice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase(),loweredCase=!0}}function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;length?(length=Number(length))>remaining&&(length=remaining):length=remaining;var strLen=string.length;if(strLen%2!=0)throw new Error("Invalid hex string");length>strLen/2&&(length=strLen/2);for(var i=0;i<length;i++){var parsed=parseInt(string.substr(2*i,2),16);if(isNaN(parsed))throw new Error("Invalid hex string");buf[offset+i]=parsed}return i}function utf8Write(buf,string,offset,length){return blitBuffer(utf8ToBytes(string,buf.length-offset),buf,offset,length)}function asciiWrite(buf,string,offset,length){return blitBuffer(asciiToBytes(string),buf,offset,length)}function binaryWrite(buf,string,offset,length){return asciiWrite(buf,string,offset,length)}function base64Write(buf,string,offset,length){return blitBuffer(base64ToBytes(string),buf,offset,length)}function ucs2Write(buf,string,offset,length){return blitBuffer(utf16leToBytes(string,buf.length-offset),buf,offset,length)}function base64Slice(buf,start,end){return 0===start&&end===buf.length?base64.fromByteArray(buf):base64.fromByteArray(buf.slice(start,end))}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);for(var res=[],i=start;i<end;){var firstByte=buf[i],codePoint=null,bytesPerSequence=firstByte>239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:firstByte<128&&(codePoint=firstByte);break;case 2:secondByte=buf[i+1],128==(192&secondByte)&&(tempCodePoint=(31&firstByte)<<6|63&secondByte)>127&&(codePoint=tempCodePoint);break;case 3:secondByte=buf[i+1],thirdByte=buf[i+2],128==(192&secondByte)&&128==(192&thirdByte)&&(tempCodePoint=(15&firstByte)<<12|(63&secondByte)<<6|63&thirdByte)>2047&&(tempCodePoint<55296||tempCodePoint>57343)&&(codePoint=tempCodePoint);break;case 4:secondByte=buf[i+1],thirdByte=buf[i+2],fourthByte=buf[i+3],128==(192&secondByte)&&128==(192&thirdByte)&&128==(192&fourthByte)&&(tempCodePoint=(15&firstByte)<<18|(63&secondByte)<<12|(63&thirdByte)<<6|63&fourthByte)>65535&&tempCodePoint<1114112&&(codePoint=tempCodePoint)}}null===codePoint?(codePoint=65533,bytesPerSequence=1):codePoint>65535&&(codePoint-=65536,res.push(codePoint>>>10&1023|55296),codePoint=56320|1023&codePoint),res.push(codePoint),i+=bytesPerSequence}return decodeCodePointsArray(res)}function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,codePoints);for(var res="",i=0;i<len;)res+=String.fromCharCode.apply(String,codePoints.slice(i,i+=MAX_ARGUMENTS_LENGTH));return res}function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;i++)ret+=String.fromCharCode(127&buf[i]);return ret}function binarySlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;i++)ret+=String.fromCharCode(buf[i]);return ret}function hexSlice(buf,start,end){var len=buf.length;(!start||start<0)&&(start=0),(!end||end<0||end>len)&&(end=len);for(var out="",i=start;i<end;i++)out+=toHex(buf[i]);return out}function utf16leSlice(buf,start,end){for(var bytes=buf.slice(start,end),res="",i=0;i<bytes.length;i+=2)res+=String.fromCharCode(bytes[i]+256*bytes[i+1]);return res}function checkOffset(offset,ext,length){if(offset%1!=0||offset<0)throw new RangeError("offset is not uint");if(offset+ext>length)throw new RangeError("Trying to access beyond buffer length")}function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError("buffer must be a Buffer instance");if(value>max||value<min)throw new RangeError("value is out of bounds");if(offset+ext>buf.length)throw new RangeError("index out of range")}function objectWriteUInt16(buf,value,offset,littleEndian){value<0&&(value=65535+value+1);for(var i=0,j=Math.min(buf.length-offset,2);i<j;i++)buf[offset+i]=(value&255<<8*(littleEndian?i:1-i))>>>8*(littleEndian?i:1-i)}function objectWriteUInt32(buf,value,offset,littleEndian){value<0&&(value=4294967295+value+1);for(var i=0,j=Math.min(buf.length-offset,4);i<j;i++)buf[offset+i]=value>>>8*(littleEndian?i:3-i)&255}function checkIEEE754(buf,value,offset,ext,max,min){if(value>max||value<min)throw new RangeError("value is out of bounds");if(offset+ext>buf.length)throw new RangeError("index out of range");if(offset<0)throw new RangeError("index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38),ieee754.write(buf,value,offset,littleEndian,23,4),offset+4}function writeDouble(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308),ieee754.write(buf,value,offset,littleEndian,52,8),offset+8}function base64clean(str){if(str=stringtrim(str).replace(INVALID_BASE64_RE,""),str.length<2)return"";for(;str.length%4!=0;)str+="=";return str}function stringtrim(str){return str.trim?str.trim():str.replace(/^\s+|\s+$/g,"")}function toHex(n){return n<16?"0"+n.toString(16):n.toString(16)}function utf8ToBytes(string,units){units=units||1/0;for(var codePoint,length=string.length,leadSurrogate=null,bytes=[],i=0;i<length;i++){if((codePoint=string.charCodeAt(i))>55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){(units-=3)>-1&&bytes.push(239,191,189);continue}if(i+1===length){(units-=3)>-1&&bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){(units-=3)>-1&&bytes.push(239,191,189),leadSurrogate=codePoint;continue}codePoint=65536+(leadSurrogate-55296<<10|codePoint-56320)}else leadSurrogate&&(units-=3)>-1&&bytes.push(239,191,189);if(leadSurrogate=null,codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,63&codePoint|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,63&codePoint|128)}else{if(!(codePoint<1114112))throw new Error("Invalid code point");if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,63&codePoint|128)}}return bytes}function asciiToBytes(str){for(var byteArray=[],i=0;i<str.length;i++)byteArray.push(255&str.charCodeAt(i));return byteArray}function utf16leToBytes(str,units){for(var c,hi,lo,byteArray=[],i=0;i<str.length&&!((units-=2)<0);i++)c=str.charCodeAt(i),hi=c>>8,lo=c%256,byteArray.push(lo),byteArray.push(hi);return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i<length&&!(i+offset>=dst.length||i>=src.length);i++)dst[i+offset]=src[i];return i}var base64=require("base64-js"),ieee754=require("ieee754"),isArray=require("isarray");exports.Buffer=Buffer,exports.SlowBuffer=SlowBuffer,exports.INSPECT_MAX_BYTES=50,Buffer.poolSize=8192;var rootParent={};Buffer.TYPED_ARRAY_SUPPORT=void 0!==global.TYPED_ARRAY_SUPPORT?global.TYPED_ARRAY_SUPPORT:function(){function Bar(){}try{var arr=new Uint8Array(1);return arr.foo=function(){return 42},arr.constructor=Bar,42===arr.foo()&&arr.constructor===Bar&&"function"==typeof arr.subarray&&0===arr.subarray(1,1).byteLength}catch(e){return!1}}(),Buffer.TYPED_ARRAY_SUPPORT?(Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array):(Buffer.prototype.length=void 0,Buffer.prototype.parent=void 0),Buffer.isBuffer=function(b){return!(null==b||!b._isBuffer)},Buffer.compare=function(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var x=a.length,y=b.length,i=0,len=Math.min(x,y);i<len&&a[i]===b[i];)++i;return i!==len&&(x=a[i],y=b[i]),x<y?-1:y<x?1:0},Buffer.isEncoding=function(encoding){switch(String(encoding).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer.concat=function(list,length){if(!isArray(list))throw new TypeError("list argument must be an Array of Buffers.");if(0===list.length)return new Buffer(0);var i;if(void 0===length)for(length=0,i=0;i<list.length;i++)length+=list[i].length;var buf=new Buffer(length),pos=0;for(i=0;i<list.length;i++){var item=list[i];item.copy(buf,pos),pos+=item.length}return buf},Buffer.byteLength=byteLength,Buffer.prototype.toString=function(){var length=0|this.length;return 0===length?"":0===arguments.length?utf8Slice(this,0,length):slowToString.apply(this,arguments)},Buffer.prototype.equals=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return this===b||0===Buffer.compare(this,b)},Buffer.prototype.inspect=function(){var str="",max=exports.INSPECT_MAX_BYTES;return this.length>0&&(str=this.toString("hex",0,max).match(/.{2}/g).join(" "),this.length>max&&(str+=" ... ")),"<Buffer "+str+">"},Buffer.prototype.compare=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return this===b?0:Buffer.compare(this,b)},Buffer.prototype.indexOf=function(val,byteOffset){function arrayIndexOf(arr,val,byteOffset){for(var foundIndex=-1,i=0;byteOffset+i<arr.length;i++)if(arr[byteOffset+i]===val[-1===foundIndex?0:i-foundIndex]){if(-1===foundIndex&&(foundIndex=i),i-foundIndex+1===val.length)return byteOffset+foundIndex}else foundIndex=-1;return-1}if(byteOffset>2147483647?byteOffset=2147483647:byteOffset<-2147483648&&(byteOffset=-2147483648),byteOffset>>=0,0===this.length)return-1;if(byteOffset>=this.length)return-1;if(byteOffset<0&&(byteOffset=Math.max(this.length+byteOffset,0)),"string"==typeof val)return 0===val.length?-1:String.prototype.indexOf.call(this,val,byteOffset);if(Buffer.isBuffer(val))return arrayIndexOf(this,val,byteOffset);if("number"==typeof val)return Buffer.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,val,byteOffset):arrayIndexOf(this,[val],byteOffset);throw new TypeError("val must be string, number or Buffer")},Buffer.prototype.get=function(offset){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(offset)},Buffer.prototype.set=function(v,offset){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(v,offset)},Buffer.prototype.write=function(string,offset,length,encoding){if(void 0===offset)encoding="utf8",length=this.length,offset=0;else if(void 0===length&&"string"==typeof offset)encoding=offset,length=this.length,offset=0;else if(isFinite(offset))offset|=0,isFinite(length)?(length|=0,void 0===encoding&&(encoding="utf8")):(encoding=length,length=void 0);else{var swap=encoding;encoding=offset,offset=0|length,length=swap}var remaining=this.length-offset;if((void 0===length||length>remaining)&&(length=remaining),string.length>0&&(length<0||offset<0)||offset>this.length)throw new RangeError("attempt to write outside buffer bounds");encoding||(encoding="utf8");for(var loweredCase=!1;;)switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"binary":return binaryWrite(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase(),loweredCase=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;Buffer.prototype.slice=function(start,end){var len=this.length;start=~~start,end=void 0===end?len:~~end,start<0?(start+=len)<0&&(start=0):start>len&&(start=len),end<0?(end+=len)<0&&(end=0):end>len&&(end=len),end<start&&(end=start);var newBuf;if(Buffer.TYPED_ARRAY_SUPPORT)newBuf=Buffer._augment(this.subarray(start,end));else{var sliceLen=end-start;newBuf=new Buffer(sliceLen,void 0);for(var i=0;i<sliceLen;i++)newBuf[i]=this[i+start]}return newBuf.length&&(newBuf.parent=this.parent||this),newBuf},Buffer.prototype.readUIntLE=function(offset,byteLength,noAssert){offset|=0,byteLength|=0,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset],mul=1,i=0;++i<byteLength&&(mul*=256);)val+=this[offset+i]*mul;return val},Buffer.prototype.readUIntBE=function(offset,byteLength,noAssert){offset|=0,byteLength|=0,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset+--byteLength],mul=1;byteLength>0&&(mul*=256);)val+=this[offset+--byteLength]*mul;return val},Buffer.prototype.readUInt8=function(offset,noAssert){return noAssert||checkOffset(offset,1,this.length),this[offset]},Buffer.prototype.readUInt16LE=function(offset,noAssert){return noAssert||checkOffset(offset,2,this.length),this[offset]|this[offset+1]<<8},Buffer.prototype.readUInt16BE=function(offset,noAssert){return noAssert||checkOffset(offset,2,this.length),this[offset]<<8|this[offset+1]},Buffer.prototype.readUInt32LE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+16777216*this[offset+3]},Buffer.prototype.readUInt32BE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),16777216*this[offset]+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])},Buffer.prototype.readIntLE=function(offset,byteLength,noAssert){offset|=0,byteLength|=0,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset],mul=1,i=0;++i<byteLength&&(mul*=256);)val+=this[offset+i]*mul;return mul*=128,val>=mul&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readIntBE=function(offset,byteLength,noAssert){offset|=0,byteLength|=0,noAssert||checkOffset(offset,byteLength,this.length);for(var i=byteLength,mul=1,val=this[offset+--i];i>0&&(mul*=256);)val+=this[offset+--i]*mul;return mul*=128,val>=mul&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readInt8=function(offset,noAssert){return noAssert||checkOffset(offset,1,this.length),128&this[offset]?-1*(255-this[offset]+1):this[offset]},Buffer.prototype.readInt16LE=function(offset,noAssert){noAssert||checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt16BE=function(offset,noAssert){noAssert||checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt32LE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24},Buffer.prototype.readInt32BE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]},Buffer.prototype.readFloatLE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!0,23,4)},Buffer.prototype.readFloatBE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!1,23,4)},Buffer.prototype.readDoubleLE=function(offset,noAssert){return noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!0,52,8)},Buffer.prototype.readDoubleBE=function(offset,noAssert){return noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!1,52,8)},Buffer.prototype.writeUIntLE=function(value,offset,byteLength,noAssert){value=+value,offset|=0,byteLength|=0,noAssert||checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength),0);var mul=1,i=0;for(this[offset]=255&value;++i<byteLength&&(mul*=256);)this[offset+i]=value/mul&255;return offset+byteLength},Buffer.prototype.writeUIntBE=function(value,offset,byteLength,noAssert){value=+value,offset|=0,byteLength|=0,noAssert||checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength),0);var i=byteLength-1,mul=1;for(this[offset+i]=255&value;--i>=0&&(mul*=256);)this[offset+i]=value/mul&255;return offset+byteLength},Buffer.prototype.writeUInt8=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(value=Math.floor(value)),this[offset]=255&value,offset+1},Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8):objectWriteUInt16(this,value,offset,!0),offset+2},Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>8,this[offset+1]=255&value):objectWriteUInt16(this,value,offset,!1),offset+2},Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset+3]=value>>>24,this[offset+2]=value>>>16,this[offset+1]=value>>>8,this[offset]=255&value):objectWriteUInt32(this,value,offset,!0),offset+4},Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeIntLE=function(value,offset,byteLength,noAssert){if(value=+value,offset|=0,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0,mul=1,sub=value<0?1:0;for(this[offset]=255&value;++i<byteLength&&(mul*=256);)this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength},Buffer.prototype.writeIntBE=function(value,offset,byteLength,noAssert){if(value=+value,offset|=0,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1,mul=1,sub=value<0?1:0;for(this[offset+i]=255&value;--i>=0&&(mul*=256);)this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength},Buffer.prototype.writeInt8=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(value=Math.floor(value)),value<0&&(value=255+value+1),this[offset]=255&value,offset+1},Buffer.prototype.writeInt16LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8):objectWriteUInt16(this,value,offset,!0),offset+2},Buffer.prototype.writeInt16BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>8,this[offset+1]=255&value):objectWriteUInt16(this,value,offset,!1),offset+2},Buffer.prototype.writeInt32LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8,this[offset+2]=value>>>16,this[offset+3]=value>>>24):objectWriteUInt32(this,value,offset,!0),offset+4},Buffer.prototype.writeInt32BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),value<0&&(value=4294967295+value+1),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,!0,noAssert)},Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,!1,noAssert)},Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,!0,noAssert)},Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,!1,noAssert)},Buffer.prototype.copy=function(target,targetStart,start,end){if(start||(start=0),end||0===end||(end=this.length),targetStart>=target.length&&(targetStart=target.length),targetStart||(targetStart=0),end>0&&end<start&&(end=start),end===start)return 0;if(0===target.length||0===this.length)return 0;if(targetStart<0)throw new RangeError("targetStart out of bounds");if(start<0||start>=this.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");end>this.length&&(end=this.length),target.length-targetStart<end-start&&(end=target.length-targetStart+start);var i,len=end-start;if(this===target&&start<targetStart&&targetStart<end)for(i=len-1;i>=0;i--)target[i+targetStart]=this[i+start];else if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(i=0;i<len;i++)target[i+targetStart]=this[i+start];else target._set(this.subarray(start,start+len),targetStart);return len},Buffer.prototype.fill=function(value,start,end){if(value||(value=0),start||(start=0),end||(end=this.length),end<start)throw new RangeError("end < start");if(end!==start&&0!==this.length){if(start<0||start>=this.length)throw new RangeError("start out of bounds");if(end<0||end>this.length)throw new RangeError("end out of bounds");var i;if("number"==typeof value)for(i=start;i<end;i++)this[i]=value;else{var bytes=utf8ToBytes(value.toString()),len=bytes.length;for(i=start;i<end;i++)this[i]=bytes[i%len]}return this}},Buffer.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(Buffer.TYPED_ARRAY_SUPPORT)return new Buffer(this).buffer;for(var buf=new Uint8Array(this.length),i=0,len=buf.length;i<len;i+=1)buf[i]=this[i];return buf.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var BP=Buffer.prototype;Buffer._augment=function(arr){return arr.constructor=Buffer,arr._isBuffer=!0,arr._set=arr.set,arr.get=BP.get,arr.set=BP.set,arr.write=BP.write,arr.toString=BP.toString,arr.toLocaleString=BP.toString,arr.toJSON=BP.toJSON,arr.equals=BP.equals,arr.compare=BP.compare,arr.indexOf=BP.indexOf,arr.copy=BP.copy,arr.slice=BP.slice,arr.readUIntLE=BP.readUIntLE,arr.readUIntBE=BP.readUIntBE,arr.readUInt8=BP.readUInt8,arr.readUInt16LE=BP.readUInt16LE,arr.readUInt16BE=BP.readUInt16BE,arr.readUInt32LE=BP.readUInt32LE,arr.readUInt32BE=BP.readUInt32BE,arr.readIntLE=BP.readIntLE,arr.readIntBE=BP.readIntBE,arr.readInt8=BP.readInt8,arr.readInt16LE=BP.readInt16LE,arr.readInt16BE=BP.readInt16BE,arr.readInt32LE=BP.readInt32LE,arr.readInt32BE=BP.readInt32BE,arr.readFloatLE=BP.readFloatLE,arr.readFloatBE=BP.readFloatBE,arr.readDoubleLE=BP.readDoubleLE,arr.readDoubleBE=BP.readDoubleBE,arr.writeUInt8=BP.writeUInt8,arr.writeUIntLE=BP.writeUIntLE,arr.writeUIntBE=BP.writeUIntBE,arr.writeUInt16LE=BP.writeUInt16LE,arr.writeUInt16BE=BP.writeUInt16BE,arr.writeUInt32LE=BP.writeUInt32LE,arr.writeUInt32BE=BP.writeUInt32BE,arr.writeIntLE=BP.writeIntLE,arr.writeIntBE=BP.writeIntBE,arr.writeInt8=BP.writeInt8,arr.writeInt16LE=BP.writeInt16LE,arr.writeInt16BE=BP.writeInt16BE,arr.writeInt32LE=BP.writeInt32LE,arr.writeInt32BE=BP.writeInt32BE,arr.writeFloatLE=BP.writeFloatLE,arr.writeFloatBE=BP.writeFloatBE,arr.writeDoubleLE=BP.writeDoubleLE,arr.writeDoubleBE=BP.writeDoubleBE,arr.fill=BP.fill,arr.inspect=BP.inspect,arr.toArrayBuffer=BP.toArrayBuffer,arr};var INVALID_BASE64_RE=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":107,ieee754:110,isarray:112}],109:[function(require,module,exports){function ClassList(elem){function add(token){var list=getTokens();indexof(list,token)>-1||(list.push(token),setTokens(list))}function remove(token){var list=getTokens(),index=indexof(list,token);-1!==index&&(list.splice(index,1),setTokens(list))}function contains(token){return indexof(getTokens(),token)>-1}function toggle(token){return contains(token)?(remove(token),!1):(add(token),!0)}function $toString(){return elem.className}function item(index){return getTokens()[index]||null}function getTokens(){return filter(elem.className.split(" "),isTruthy)}function setTokens(list){var length=list.length;elem.className=list.join(" "),classList.length=length;for(var i=0;i<list.length;i++)classList[i]=list[i];delete list[length]}var cl=elem.classList;if(cl)return cl;var classList={add:add,remove:remove,contains:contains,toggle:toggle,toString:$toString,length:0,item:item};return classList}function filter(arr,fn){for(var ret=[],i=0;i<arr.length;i++)fn(arr[i])&&ret.push(arr[i]);return ret}function isTruthy(value){return!!value}var indexof=require("indexof");module.exports=ClassList},{indexof:111}],110:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=8*nBytes-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];for(i+=d,e=s&(1<<-nBits)-1,s>>=-nBits,nBits+=eLen;nBits>0;e=256*e+buffer[offset+i],i+=d,nBits-=8);for(m=e&(1<<-nBits)-1,e>>=-nBits,nBits+=mLen;nBits>0;m=256*m+buffer[offset+i],i+=d,nBits-=8);if(0===e)e=1-eBias;else{if(e===eMax)return m?NaN:1/0*(s?-1:1);m+=Math.pow(2,mLen),e-=eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)},exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=8*nBytes-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,rt=23===mLen?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||0===value&&1/value<0?1:0;for(value=Math.abs(value),isNaN(value)||value===1/0?(m=isNaN(value)?1:0,e=eMax):(e=Math.floor(Math.log(value)/Math.LN2),value*(c=Math.pow(2,-e))<1&&(e--,c*=2),value+=e+eBias>=1?rt/c:rt*Math.pow(2,1-eBias),value*c>=2&&(e++,c/=2),e+eBias>=eMax?(m=0,e=eMax):e+eBias>=1?(m=(value*c-1)*Math.pow(2,mLen),e+=eBias):(m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen),e=0));mLen>=8;buffer[offset+i]=255&m,i+=d,m/=256,mLen-=8);for(e=e<<mLen|m,eLen+=mLen;eLen>0;buffer[offset+i]=255&e,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=128*s}},{}],111:[function(require,module,exports){var indexOf=[].indexOf;module.exports=function(arr,obj){if(indexOf)return arr.indexOf(obj);for(var i=0;i<arr.length;++i)if(arr[i]===obj)return i;return-1}},{}],112:[function(require,module,exports){var toString={}.toString;module.exports=Array.isArray||function(arr){return"[object Array]"==toString.call(arr)}},{}],113:[function(require,module,exports){function drainQueue(){if(!draining){draining=!0;for(var currentQueue,len=queue.length;len;){currentQueue=queue,queue=[];for(var i=-1;++i<len;)currentQueue[i]();len=queue.length}draining=!1}}function noop(){}var process=module.exports={},queue=[],draining=!1;process.nextTick=function(fun){queue.push(fun),draining||setTimeout(drainQueue,0)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.binding=function(name){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(dir){throw new Error("process.chdir is not supported")},process.umask=function(){return 0}},{}],114:[function(require,module,exports){var cl=require("class-list");try{require("@stackgl/splash-grid")(document.getElementById("grid"))}catch(e){cl(document.body).add("no-webgl")}},{"@stackgl/splash-grid":2,"class-list":109}]},{},[114]);