Skip to content

Instantly share code, notes, and snippets.

@mikolalysenko
Created April 25, 2014 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikolalysenko/11296778 to your computer and use it in GitHub Desktop.
Save mikolalysenko/11296778 to your computer and use it in GitHub Desktop.
requirebin sketch
var shell = require("gl-now")({clearColor: [0,0,0,0]})
var camera = require("game-shell-orbit-camera")(shell)
var glm = require("gl-matrix")
var createMesh = require("gl-simplicial-complex")
var dup = require("dup")
var mat4 = glm.mat4
var NUM_POINTS = 1e6
var gl, mesh
//Set camera positions
camera.lookAt(
[0.5, 0.5, -3], //Camera position
[0.5, 0.5, 0.5], //Camera target
[0, 1, 0]) //Up vector
//Create an array of points
var positions = dup(NUM_POINTS).map(function() {
return [Math.random(), Math.random(), Math.random()]
})
//Point colors
var colors = dup(NUM_POINTS).map(function() {
return [Math.random(), Math.random(), Math.random()]
})
//Point sizes
var sizes = dup(NUM_POINTS).map(function() {
return Math.random() * 3 + 1
})
//Initialize mesh
shell.on("gl-init", function() {
gl = shell.gl
mesh = createMesh(gl, {
cells: dup(NUM_POINTS).map(function(v,i) { return [i] }), //Points are rendered as length 1 cells
positions: positions, //Position of points in the scene
vertexColors: colors, //Point colors
pointSizes: sizes //Point size can be changed too
})
})
shell.on("gl-render", function() {
//Create projection matrix
var projection = mat4.perspective(
mat4.create(),
Math.PI/4.0, //FOV
shell.width/shell.height, //Aspect ratio
0.1, //Near clip plane distance
1000.0) //Far clip plane distance
//Create view matrix
var view = camera.view()
//Create camera parameter object
var cameraParameters = {
projection: projection,
view: view
}
mesh.draw(cameraParameters)
})
require=function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);throw Error("Cannot find module '"+a+"'")}var c=r[a]={exports:{}};t[a][0].call(c.exports,function(r){var e=t[a][1][r];return i(e?e:r)},c,c.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;n.length>a;a++)i(n[a]);return i}({"0Wjxbg":[function(t,r){"use strict";function e(t,r,n){var i=0|t[n];if(0>=i)return[];var o,a=Array(i);if(n===t.length-1)for(o=0;i>o;++o)a[o]=r;else for(o=0;i>o;++o)a[o]=e(t,r,n+1);return a}function n(t,r){var e,n;for(e=Array(t),n=0;t>n;++n)e[n]=r;return e}function i(t,r){switch(r===void 0&&(r=0),typeof t){case"number":if(t>0)return n(0|t,r);break;case"object":if("number"==typeof t.length)return e(t,r,0)}return[]}r.exports=i},{}],dup:[function(t,r){r.exports=t("0Wjxbg")},{}]},{},[]),require=function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);throw Error("Cannot find module '"+a+"'")}var c=r[a]={exports:{}};t[a][0].call(c.exports,function(r){var e=t[a][1][r];return i(e?e:r)},c,c.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;n.length>a;a++)i(n[a]);return i}({JSCNs5:[function(t,r,e){(function(){"use strict";var t={};e===void 0?"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.exports={},define(function(){return t.exports})):t.exports=window:t.exports=e,function(t){if(!r)var r=1e-6;if(!e)var e="undefined"!=typeof Float32Array?Float32Array:Array;var n={};n.setMatrixArrayType=function(t){e=t},t!==void 0&&(t.glMatrix=n);var i={};i.create=function(){var t=new e(2);return t[0]=0,t[1]=0,t},i.clone=function(t){var r=new e(2);return r[0]=t[0],r[1]=t[1],r},i.fromValues=function(t,r){var n=new e(2);return n[0]=t,n[1]=r,n},i.copy=function(t,r){return t[0]=r[0],t[1]=r[1],t},i.set=function(t,r,e){return t[0]=r,t[1]=e,t},i.add=function(t,r,e){return t[0]=r[0]+e[0],t[1]=r[1]+e[1],t},i.subtract=function(t,r,e){return t[0]=r[0]-e[0],t[1]=r[1]-e[1],t},i.sub=i.subtract,i.multiply=function(t,r,e){return t[0]=r[0]*e[0],t[1]=r[1]*e[1],t},i.mul=i.multiply,i.divide=function(t,r,e){return t[0]=r[0]/e[0],t[1]=r[1]/e[1],t},i.div=i.divide,i.min=function(t,r,e){return t[0]=Math.min(r[0],e[0]),t[1]=Math.min(r[1],e[1]),t},i.max=function(t,r,e){return t[0]=Math.max(r[0],e[0]),t[1]=Math.max(r[1],e[1]),t},i.scale=function(t,r,e){return t[0]=r[0]*e,t[1]=r[1]*e,t},i.distance=function(t,r){var e=r[0]-t[0],n=r[1]-t[1];return Math.sqrt(e*e+n*n)},i.dist=i.distance,i.squaredDistance=function(t,r){var e=r[0]-t[0],n=r[1]-t[1];return e*e+n*n},i.sqrDist=i.squaredDistance,i.length=function(t){var r=t[0],e=t[1];return Math.sqrt(r*r+e*e)},i.len=i.length,i.squaredLength=function(t){var r=t[0],e=t[1];return r*r+e*e},i.sqrLen=i.squaredLength,i.negate=function(t,r){return t[0]=-r[0],t[1]=-r[1],t},i.normalize=function(t,r){var e=r[0],n=r[1],i=e*e+n*n;return i>0&&(i=1/Math.sqrt(i),t[0]=r[0]*i,t[1]=r[1]*i),t},i.dot=function(t,r){return t[0]*r[0]+t[1]*r[1]},i.cross=function(t,r,e){var n=r[0]*e[1]-r[1]*e[0];return t[0]=t[1]=0,t[2]=n,t},i.lerp=function(t,r,e,n){var i=r[0],o=r[1];return t[0]=i+n*(e[0]-i),t[1]=o+n*(e[1]-o),t},i.transformMat2=function(t,r,e){var n=r[0],i=r[1];return t[0]=e[0]*n+e[2]*i,t[1]=e[1]*n+e[3]*i,t},i.transformMat2d=function(t,r,e){var n=r[0],i=r[1];return t[0]=e[0]*n+e[2]*i+e[4],t[1]=e[1]*n+e[3]*i+e[5],t},i.transformMat3=function(t,r,e){var n=r[0],i=r[1];return t[0]=e[0]*n+e[3]*i+e[6],t[1]=e[1]*n+e[4]*i+e[7],t},i.transformMat4=function(t,r,e){var n=r[0],i=r[1];return t[0]=e[0]*n+e[4]*i+e[12],t[1]=e[1]*n+e[5]*i+e[13],t},i.forEach=function(){var t=i.create();return function(r,e,n,i,o,a){var s,u;for(e||(e=2),n||(n=0),u=i?Math.min(i*e+n,r.length):r.length,s=n;u>s;s+=e)t[0]=r[s],t[1]=r[s+1],o(t,t,a),r[s]=t[0],r[s+1]=t[1];return r}}(),i.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},t!==void 0&&(t.vec2=i);var o={};o.create=function(){var t=new e(3);return t[0]=0,t[1]=0,t[2]=0,t},o.clone=function(t){var r=new e(3);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r},o.fromValues=function(t,r,n){var i=new e(3);return i[0]=t,i[1]=r,i[2]=n,i},o.copy=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t},o.set=function(t,r,e,n){return t[0]=r,t[1]=e,t[2]=n,t},o.add=function(t,r,e){return t[0]=r[0]+e[0],t[1]=r[1]+e[1],t[2]=r[2]+e[2],t},o.subtract=function(t,r,e){return t[0]=r[0]-e[0],t[1]=r[1]-e[1],t[2]=r[2]-e[2],t},o.sub=o.subtract,o.multiply=function(t,r,e){return t[0]=r[0]*e[0],t[1]=r[1]*e[1],t[2]=r[2]*e[2],t},o.mul=o.multiply,o.divide=function(t,r,e){return t[0]=r[0]/e[0],t[1]=r[1]/e[1],t[2]=r[2]/e[2],t},o.div=o.divide,o.min=function(t,r,e){return t[0]=Math.min(r[0],e[0]),t[1]=Math.min(r[1],e[1]),t[2]=Math.min(r[2],e[2]),t},o.max=function(t,r,e){return t[0]=Math.max(r[0],e[0]),t[1]=Math.max(r[1],e[1]),t[2]=Math.max(r[2],e[2]),t},o.scale=function(t,r,e){return t[0]=r[0]*e,t[1]=r[1]*e,t[2]=r[2]*e,t},o.distance=function(t,r){var e=r[0]-t[0],n=r[1]-t[1],i=r[2]-t[2];return Math.sqrt(e*e+n*n+i*i)},o.dist=o.distance,o.squaredDistance=function(t,r){var e=r[0]-t[0],n=r[1]-t[1],i=r[2]-t[2];return e*e+n*n+i*i},o.sqrDist=o.squaredDistance,o.length=function(t){var r=t[0],e=t[1],n=t[2];return Math.sqrt(r*r+e*e+n*n)},o.len=o.length,o.squaredLength=function(t){var r=t[0],e=t[1],n=t[2];return r*r+e*e+n*n},o.sqrLen=o.squaredLength,o.negate=function(t,r){return t[0]=-r[0],t[1]=-r[1],t[2]=-r[2],t},o.normalize=function(t,r){var e=r[0],n=r[1],i=r[2],o=e*e+n*n+i*i;return o>0&&(o=1/Math.sqrt(o),t[0]=r[0]*o,t[1]=r[1]*o,t[2]=r[2]*o),t},o.dot=function(t,r){return t[0]*r[0]+t[1]*r[1]+t[2]*r[2]},o.cross=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=e[0],s=e[1],u=e[2];return t[0]=i*u-o*s,t[1]=o*a-n*u,t[2]=n*s-i*a,t},o.lerp=function(t,r,e,n){var i=r[0],o=r[1],a=r[2];return t[0]=i+n*(e[0]-i),t[1]=o+n*(e[1]-o),t[2]=a+n*(e[2]-a),t},o.transformMat4=function(t,r,e){var n=r[0],i=r[1],o=r[2];return t[0]=e[0]*n+e[4]*i+e[8]*o+e[12],t[1]=e[1]*n+e[5]*i+e[9]*o+e[13],t[2]=e[2]*n+e[6]*i+e[10]*o+e[14],t},o.transformQuat=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=e[0],s=e[1],u=e[2],c=e[3],l=c*n+s*o-u*i,f=c*i+u*n-a*o,h=c*o+a*i-s*n,p=-a*n-s*i-u*o;return t[0]=l*c+p*-a+f*-u-h*-s,t[1]=f*c+p*-s+h*-a-l*-u,t[2]=h*c+p*-u+l*-s-f*-a,t},o.forEach=function(){var t=o.create();return function(r,e,n,i,o,a){var s,u;for(e||(e=3),n||(n=0),u=i?Math.min(i*e+n,r.length):r.length,s=n;u>s;s+=e)t[0]=r[s],t[1]=r[s+1],t[2]=r[s+2],o(t,t,a),r[s]=t[0],r[s+1]=t[1],r[s+2]=t[2];return r}}(),o.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},t!==void 0&&(t.vec3=o);var a={};a.create=function(){var t=new e(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},a.clone=function(t){var r=new e(4);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r},a.fromValues=function(t,r,n,i){var o=new e(4);return o[0]=t,o[1]=r,o[2]=n,o[3]=i,o},a.copy=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t},a.set=function(t,r,e,n,i){return t[0]=r,t[1]=e,t[2]=n,t[3]=i,t},a.add=function(t,r,e){return t[0]=r[0]+e[0],t[1]=r[1]+e[1],t[2]=r[2]+e[2],t[3]=r[3]+e[3],t},a.subtract=function(t,r,e){return t[0]=r[0]-e[0],t[1]=r[1]-e[1],t[2]=r[2]-e[2],t[3]=r[3]-e[3],t},a.sub=a.subtract,a.multiply=function(t,r,e){return t[0]=r[0]*e[0],t[1]=r[1]*e[1],t[2]=r[2]*e[2],t[3]=r[3]*e[3],t},a.mul=a.multiply,a.divide=function(t,r,e){return t[0]=r[0]/e[0],t[1]=r[1]/e[1],t[2]=r[2]/e[2],t[3]=r[3]/e[3],t},a.div=a.divide,a.min=function(t,r,e){return t[0]=Math.min(r[0],e[0]),t[1]=Math.min(r[1],e[1]),t[2]=Math.min(r[2],e[2]),t[3]=Math.min(r[3],e[3]),t},a.max=function(t,r,e){return t[0]=Math.max(r[0],e[0]),t[1]=Math.max(r[1],e[1]),t[2]=Math.max(r[2],e[2]),t[3]=Math.max(r[3],e[3]),t},a.scale=function(t,r,e){return t[0]=r[0]*e,t[1]=r[1]*e,t[2]=r[2]*e,t[3]=r[3]*e,t},a.distance=function(t,r){var e=r[0]-t[0],n=r[1]-t[1],i=r[2]-t[2],o=r[3]-t[3];return Math.sqrt(e*e+n*n+i*i+o*o)},a.dist=a.distance,a.squaredDistance=function(t,r){var e=r[0]-t[0],n=r[1]-t[1],i=r[2]-t[2],o=r[3]-t[3];return e*e+n*n+i*i+o*o},a.sqrDist=a.squaredDistance,a.length=function(t){var r=t[0],e=t[1],n=t[2],i=t[3];return Math.sqrt(r*r+e*e+n*n+i*i)},a.len=a.length,a.squaredLength=function(t){var r=t[0],e=t[1],n=t[2],i=t[3];return r*r+e*e+n*n+i*i},a.sqrLen=a.squaredLength,a.negate=function(t,r){return t[0]=-r[0],t[1]=-r[1],t[2]=-r[2],t[3]=-r[3],t},a.normalize=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=e*e+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a),t[0]=r[0]*a,t[1]=r[1]*a,t[2]=r[2]*a,t[3]=r[3]*a),t},a.dot=function(t,r){return t[0]*r[0]+t[1]*r[1]+t[2]*r[2]+t[3]*r[3]},a.lerp=function(t,r,e,n){var i=r[0],o=r[1],a=r[2],s=r[3];return t[0]=i+n*(e[0]-i),t[1]=o+n*(e[1]-o),t[2]=a+n*(e[2]-a),t[3]=s+n*(e[3]-s),t},a.transformMat4=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3];return t[0]=e[0]*n+e[4]*i+e[8]*o+e[12]*a,t[1]=e[1]*n+e[5]*i+e[9]*o+e[13]*a,t[2]=e[2]*n+e[6]*i+e[10]*o+e[14]*a,t[3]=e[3]*n+e[7]*i+e[11]*o+e[15]*a,t},a.transformQuat=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=e[0],s=e[1],u=e[2],c=e[3],l=c*n+s*o-u*i,f=c*i+u*n-a*o,h=c*o+a*i-s*n,p=-a*n-s*i-u*o;return t[0]=l*c+p*-a+f*-u-h*-s,t[1]=f*c+p*-s+h*-a-l*-u,t[2]=h*c+p*-u+l*-s-f*-a,t},a.forEach=function(){var t=a.create();return function(r,e,n,i,o,a){var s,u;for(e||(e=4),n||(n=0),u=i?Math.min(i*e+n,r.length):r.length,s=n;u>s;s+=e)t[0]=r[s],t[1]=r[s+1],t[2]=r[s+2],t[3]=r[s+3],o(t,t,a),r[s]=t[0],r[s+1]=t[1],r[s+2]=t[2],r[s+3]=t[3];return r}}(),a.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},t!==void 0&&(t.vec4=a);var s={};new Float32Array([1,0,0,1]),s.create=function(){var t=new e(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},s.clone=function(t){var r=new e(4);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r},s.copy=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t},s.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},s.transpose=function(t,r){if(t===r){var e=r[1];t[1]=r[2],t[2]=e}else t[0]=r[0],t[1]=r[2],t[2]=r[1],t[3]=r[3];return t},s.invert=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=e*o-i*n;return a?(a=1/a,t[0]=o*a,t[1]=-n*a,t[2]=-i*a,t[3]=e*a,t):null},s.adjoint=function(t,r){var e=r[0];return t[0]=r[3],t[1]=-r[1],t[2]=-r[2],t[3]=e,t},s.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},s.multiply=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=e[0],u=e[1],c=e[2],l=e[3];return t[0]=n*s+i*c,t[1]=n*u+i*l,t[2]=o*s+a*c,t[3]=o*u+a*l,t},s.mul=s.multiply,s.rotate=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=Math.sin(e),u=Math.cos(e);return t[0]=n*u+i*s,t[1]=n*-s+i*u,t[2]=o*u+a*s,t[3]=o*-s+a*u,t},s.scale=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=e[0],u=e[1];return t[0]=n*s,t[1]=i*u,t[2]=o*s,t[3]=a*u,t},s.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},t!==void 0&&(t.mat2=s);var u={};new Float32Array([1,0,0,1,0,0]),u.create=function(){var t=new e(6);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},u.clone=function(t){var r=new e(6);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r},u.copy=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t},u.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},u.invert=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],u=e*o-n*i;return u?(u=1/u,t[0]=o*u,t[1]=-n*u,t[2]=-i*u,t[3]=e*u,t[4]=(i*s-o*a)*u,t[5]=(n*a-e*s)*u,t):null},u.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},u.multiply=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=e[0],l=e[1],f=e[2],h=e[3],p=e[4],d=e[5];return t[0]=n*c+i*f,t[1]=n*l+i*h,t[2]=o*c+a*f,t[3]=o*l+a*h,t[4]=c*s+f*u+p,t[5]=l*s+h*u+d,t},u.mul=u.multiply,u.rotate=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=Math.sin(e),l=Math.cos(e);return t[0]=n*l+i*c,t[1]=-n*c+i*l,t[2]=o*l+a*c,t[3]=-o*c+l*a,t[4]=l*s+c*u,t[5]=l*u-c*s,t},u.scale=function(t,r,e){var n=e[0],i=e[1];return t[0]=r[0]*n,t[1]=r[1]*i,t[2]=r[2]*n,t[3]=r[3]*i,t[4]=r[4]*n,t[5]=r[5]*i,t},u.translate=function(t,r,e){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4]+e[0],t[5]=r[5]+e[1],t},u.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},t!==void 0&&(t.mat2d=u);var c={};new Float32Array([1,0,0,0,1,0,0,0,1]),c.create=function(){var t=new e(9);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},c.clone=function(t){var r=new e(9);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r},c.copy=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t},c.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},c.transpose=function(t,r){if(t===r){var e=r[1],n=r[2],i=r[5];t[1]=r[3],t[2]=r[6],t[3]=e,t[5]=r[7],t[6]=n,t[7]=i}else t[0]=r[0],t[1]=r[3],t[2]=r[6],t[3]=r[1],t[4]=r[4],t[5]=r[7],t[6]=r[2],t[7]=r[5],t[8]=r[8];return t},c.invert=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],u=r[6],c=r[7],l=r[8],f=l*a-s*c,h=-l*o+s*u,p=c*o-a*u,d=e*f+n*h+i*p;return d?(d=1/d,t[0]=f*d,t[1]=(-l*n+i*c)*d,t[2]=(s*n-i*a)*d,t[3]=h*d,t[4]=(l*e-i*u)*d,t[5]=(-s*e+i*o)*d,t[6]=p*d,t[7]=(-c*e+n*u)*d,t[8]=(a*e-n*o)*d,t):null},c.adjoint=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],u=r[6],c=r[7],l=r[8];return t[0]=a*l-s*c,t[1]=i*c-n*l,t[2]=n*s-i*a,t[3]=s*u-o*l,t[4]=e*l-i*u,t[5]=i*o-e*s,t[6]=o*c-a*u,t[7]=n*u-e*c,t[8]=e*a-n*o,t},c.determinant=function(t){var r=t[0],e=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],u=t[7],c=t[8];return r*(c*o-a*u)+e*(-c*i+a*s)+n*(u*i-o*s)},c.multiply=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=r[6],l=r[7],f=r[8],h=e[0],p=e[1],d=e[2],v=e[3],m=e[4],g=e[5],y=e[6],b=e[7],_=e[8];return t[0]=h*n+p*a+d*c,t[1]=h*i+p*s+d*l,t[2]=h*o+p*u+d*f,t[3]=v*n+m*a+g*c,t[4]=v*i+m*s+g*l,t[5]=v*o+m*u+g*f,t[6]=y*n+b*a+_*c,t[7]=y*i+b*s+_*l,t[8]=y*o+b*u+_*f,t},c.mul=c.multiply,c.translate=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=r[6],l=r[7],f=r[8],h=e[0],p=e[1];return t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=u,t[6]=h*n+p*a+c,t[7]=h*i+p*s+l,t[8]=h*o+p*u+f,t},c.rotate=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=r[6],l=r[7],f=r[8],h=Math.sin(e),p=Math.cos(e);return t[0]=p*n+h*a,t[1]=p*i+h*s,t[2]=p*o+h*u,t[3]=p*a-h*n,t[4]=p*s-h*i,t[5]=p*u-h*o,t[6]=c,t[7]=l,t[8]=f,t},c.scale=function(t,r,e){var n=e[0],i=e[2];return t[0]=n*r[0],t[1]=n*r[1],t[2]=n*r[2],t[3]=i*r[3],t[4]=i*r[4],t[5]=i*r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t},c.fromMat2d=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=0,t[3]=r[2],t[4]=r[3],t[5]=0,t[6]=r[4],t[7]=r[5],t[8]=1,t},c.fromQuat=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=e+e,s=n+n,u=i+i,c=e*a,l=e*s,f=e*u,h=n*s,p=n*u,d=i*u,v=o*a,m=o*s,g=o*u;return t[0]=1-(h+d),t[1]=l+g,t[2]=f-m,t[3]=l-g,t[4]=1-(c+d),t[5]=p+v,t[6]=f+m,t[7]=p-v,t[8]=1-(c+h),t},c.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},t!==void 0&&(t.mat3=c);var l={};new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),l.create=function(){var t=new e(16);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},l.clone=function(t){var r=new e(16);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},l.copy=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t},l.identity=function(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},l.transpose=function(t,r){if(t===r){var e=r[1],n=r[2],i=r[3],o=r[6],a=r[7],s=r[11];t[1]=r[4],t[2]=r[8],t[3]=r[12],t[4]=e,t[6]=r[9],t[7]=r[13],t[8]=n,t[9]=o,t[11]=r[14],t[12]=i,t[13]=a,t[14]=s}else t[0]=r[0],t[1]=r[4],t[2]=r[8],t[3]=r[12],t[4]=r[1],t[5]=r[5],t[6]=r[9],t[7]=r[13],t[8]=r[2],t[9]=r[6],t[10]=r[10],t[11]=r[14],t[12]=r[3],t[13]=r[7],t[14]=r[11],t[15]=r[15];return t},l.invert=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],u=r[6],c=r[7],l=r[8],f=r[9],h=r[10],p=r[11],d=r[12],v=r[13],m=r[14],g=r[15],y=e*s-n*a,b=e*u-i*a,_=e*c-o*a,w=n*u-i*s,M=n*c-o*s,A=i*c-o*u,E=l*v-f*d,x=l*m-h*d,j=l*g-p*d,k=f*m-h*v,L=f*g-p*v,I=h*g-p*m,q=y*I-b*L+_*k+w*j-M*x+A*E;return q?(q=1/q,t[0]=(s*I-u*L+c*k)*q,t[1]=(i*L-n*I-o*k)*q,t[2]=(v*A-m*M+g*w)*q,t[3]=(h*M-f*A-p*w)*q,t[4]=(u*j-a*I-c*x)*q,t[5]=(e*I-i*j+o*x)*q,t[6]=(m*_-d*A-g*b)*q,t[7]=(l*A-h*_+p*b)*q,t[8]=(a*L-s*j+c*E)*q,t[9]=(n*j-e*L-o*E)*q,t[10]=(d*M-v*_+g*y)*q,t[11]=(f*_-l*M-p*y)*q,t[12]=(s*x-a*k-u*E)*q,t[13]=(e*k-n*x+i*E)*q,t[14]=(v*b-d*w-m*y)*q,t[15]=(l*w-f*b+h*y)*q,t):null},l.adjoint=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],u=r[6],c=r[7],l=r[8],f=r[9],h=r[10],p=r[11],d=r[12],v=r[13],m=r[14],g=r[15];return t[0]=s*(h*g-p*m)-f*(u*g-c*m)+v*(u*p-c*h),t[1]=-(n*(h*g-p*m)-f*(i*g-o*m)+v*(i*p-o*h)),t[2]=n*(u*g-c*m)-s*(i*g-o*m)+v*(i*c-o*u),t[3]=-(n*(u*p-c*h)-s*(i*p-o*h)+f*(i*c-o*u)),t[4]=-(a*(h*g-p*m)-l*(u*g-c*m)+d*(u*p-c*h)),t[5]=e*(h*g-p*m)-l*(i*g-o*m)+d*(i*p-o*h),t[6]=-(e*(u*g-c*m)-a*(i*g-o*m)+d*(i*c-o*u)),t[7]=e*(u*p-c*h)-a*(i*p-o*h)+l*(i*c-o*u),t[8]=a*(f*g-p*v)-l*(s*g-c*v)+d*(s*p-c*f),t[9]=-(e*(f*g-p*v)-l*(n*g-o*v)+d*(n*p-o*f)),t[10]=e*(s*g-c*v)-a*(n*g-o*v)+d*(n*c-o*s),t[11]=-(e*(s*p-c*f)-a*(n*p-o*f)+l*(n*c-o*s)),t[12]=-(a*(f*m-h*v)-l*(s*m-u*v)+d*(s*h-u*f)),t[13]=e*(f*m-h*v)-l*(n*m-i*v)+d*(n*h-i*f),t[14]=-(e*(s*m-u*v)-a*(n*m-i*v)+d*(n*u-i*s)),t[15]=e*(s*h-u*f)-a*(n*h-i*f)+l*(n*u-i*s),t},l.determinant=function(t){var r=t[0],e=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],u=t[7],c=t[8],l=t[9],f=t[10],h=t[11],p=t[12],d=t[13],v=t[14],m=t[15],g=r*a-e*o,y=r*s-n*o,b=r*u-i*o,_=e*s-n*a,w=e*u-i*a,M=n*u-i*s,A=c*d-l*p,E=c*v-f*p,x=c*m-h*p,j=l*v-f*d,k=l*m-h*d,L=f*m-h*v;return g*L-y*k+b*j+_*x-w*E+M*A},l.multiply=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=r[6],l=r[7],f=r[8],h=r[9],p=r[10],d=r[11],v=r[12],m=r[13],g=r[14],y=r[15],b=e[0],_=e[1],w=e[2],M=e[3];return t[0]=b*n+_*s+w*f+M*v,t[1]=b*i+_*u+w*h+M*m,t[2]=b*o+_*c+w*p+M*g,t[3]=b*a+_*l+w*d+M*y,b=e[4],_=e[5],w=e[6],M=e[7],t[4]=b*n+_*s+w*f+M*v,t[5]=b*i+_*u+w*h+M*m,t[6]=b*o+_*c+w*p+M*g,t[7]=b*a+_*l+w*d+M*y,b=e[8],_=e[9],w=e[10],M=e[11],t[8]=b*n+_*s+w*f+M*v,t[9]=b*i+_*u+w*h+M*m,t[10]=b*o+_*c+w*p+M*g,t[11]=b*a+_*l+w*d+M*y,b=e[12],_=e[13],w=e[14],M=e[15],t[12]=b*n+_*s+w*f+M*v,t[13]=b*i+_*u+w*h+M*m,t[14]=b*o+_*c+w*p+M*g,t[15]=b*a+_*l+w*d+M*y,t},l.mul=l.multiply,l.translate=function(t,r,e){var n,i,o,a,s,u,c,l,f,h,p,d,v=e[0],m=e[1],g=e[2];return r===t?(t[12]=r[0]*v+r[4]*m+r[8]*g+r[12],t[13]=r[1]*v+r[5]*m+r[9]*g+r[13],t[14]=r[2]*v+r[6]*m+r[10]*g+r[14],t[15]=r[3]*v+r[7]*m+r[11]*g+r[15]):(n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=r[6],l=r[7],f=r[8],h=r[9],p=r[10],d=r[11],t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=u,t[6]=c,t[7]=l,t[8]=f,t[9]=h,t[10]=p,t[11]=d,t[12]=n*v+s*m+f*g+r[12],t[13]=i*v+u*m+h*g+r[13],t[14]=o*v+c*m+p*g+r[14],t[15]=a*v+l*m+d*g+r[15]),t},l.scale=function(t,r,e){var n=e[0],i=e[1],o=e[2];return t[0]=r[0]*n,t[1]=r[1]*n,t[2]=r[2]*n,t[3]=r[3]*n,t[4]=r[4]*i,t[5]=r[5]*i,t[6]=r[6]*i,t[7]=r[7]*i,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[10]*o,t[11]=r[11]*o,t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t},l.rotate=function(t,e,n,i){var o,a,s,u,c,l,f,h,p,d,v,m,g,y,b,_,w,M,A,E,x,j,k,L,I=i[0],q=i[1],S=i[2],F=Math.sqrt(I*I+q*q+S*S);return r>Math.abs(F)?null:(F=1/F,I*=F,q*=F,S*=F,o=Math.sin(n),a=Math.cos(n),s=1-a,u=e[0],c=e[1],l=e[2],f=e[3],h=e[4],p=e[5],d=e[6],v=e[7],m=e[8],g=e[9],y=e[10],b=e[11],_=I*I*s+a,w=q*I*s+S*o,M=S*I*s-q*o,A=I*q*s-S*o,E=q*q*s+a,x=S*q*s+I*o,j=I*S*s+q*o,k=q*S*s-I*o,L=S*S*s+a,t[0]=u*_+h*w+m*M,t[1]=c*_+p*w+g*M,t[2]=l*_+d*w+y*M,t[3]=f*_+v*w+b*M,t[4]=u*A+h*E+m*x,t[5]=c*A+p*E+g*x,t[6]=l*A+d*E+y*x,t[7]=f*A+v*E+b*x,t[8]=u*j+h*k+m*L,t[9]=c*j+p*k+g*L,t[10]=l*j+d*k+y*L,t[11]=f*j+v*k+b*L,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)},l.rotateX=function(t,r,e){var n=Math.sin(e),i=Math.cos(e),o=r[4],a=r[5],s=r[6],u=r[7],c=r[8],l=r[9],f=r[10],h=r[11];return r!==t&&(t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[4]=o*i+c*n,t[5]=a*i+l*n,t[6]=s*i+f*n,t[7]=u*i+h*n,t[8]=c*i-o*n,t[9]=l*i-a*n,t[10]=f*i-s*n,t[11]=h*i-u*n,t},l.rotateY=function(t,r,e){var n=Math.sin(e),i=Math.cos(e),o=r[0],a=r[1],s=r[2],u=r[3],c=r[8],l=r[9],f=r[10],h=r[11];return r!==t&&(t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[0]=o*i-c*n,t[1]=a*i-l*n,t[2]=s*i-f*n,t[3]=u*i-h*n,t[8]=o*n+c*i,t[9]=a*n+l*i,t[10]=s*n+f*i,t[11]=u*n+h*i,t},l.rotateZ=function(t,r,e){var n=Math.sin(e),i=Math.cos(e),o=r[0],a=r[1],s=r[2],u=r[3],c=r[4],l=r[5],f=r[6],h=r[7];return r!==t&&(t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[0]=o*i+c*n,t[1]=a*i+l*n,t[2]=s*i+f*n,t[3]=u*i+h*n,t[4]=c*i-o*n,t[5]=l*i-a*n,t[6]=f*i-s*n,t[7]=h*i-u*n,t},l.fromRotationTranslation=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=n+n,u=i+i,c=o+o,l=n*s,f=n*u,h=n*c,p=i*u,d=i*c,v=o*c,m=a*s,g=a*u,y=a*c;return t[0]=1-(p+v),t[1]=f+y,t[2]=h-g,t[3]=0,t[4]=f-y,t[5]=1-(l+v),t[6]=d+m,t[7]=0,t[8]=h+g,t[9]=d-m,t[10]=1-(l+p),t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t},l.fromQuat=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=e+e,s=n+n,u=i+i,c=e*a,l=e*s,f=e*u,h=n*s,p=n*u,d=i*u,v=o*a,m=o*s,g=o*u;return t[0]=1-(h+d),t[1]=l+g,t[2]=f-m,t[3]=0,t[4]=l-g,t[5]=1-(c+d),t[6]=p+v,t[7]=0,t[8]=f+m,t[9]=p-v,t[10]=1-(c+h),t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},l.frustum=function(t,r,e,n,i,o,a){var s=1/(e-r),u=1/(i-n),c=1/(o-a);return t[0]=2*o*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*u,t[6]=0,t[7]=0,t[8]=(e+r)*s,t[9]=(i+n)*u,t[10]=(a+o)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*a*o*c,t[15]=0,t},l.perspective=function(t,r,e,n,i){var o=1/Math.tan(r/2),a=1/(n-i);return t[0]=o/e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*a,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*a,t[15]=0,t},l.ortho=function(t,r,e,n,i,o,a){var s=1/(r-e),u=1/(n-i),c=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(r+e)*s,t[13]=(i+n)*u,t[14]=(a+o)*c,t[15]=1,t},l.lookAt=function(t,e,n,i){var o,a,s,u,c,f,h,p,d,v,m=e[0],g=e[1],y=e[2],b=i[0],_=i[1],w=i[2],M=n[0],A=n[1],E=n[2];return r>Math.abs(m-M)&&r>Math.abs(g-A)&&r>Math.abs(y-E)?l.identity(t):(h=m-M,p=g-A,d=y-E,v=1/Math.sqrt(h*h+p*p+d*d),h*=v,p*=v,d*=v,o=_*d-w*p,a=w*h-b*d,s=b*p-_*h,v=Math.sqrt(o*o+a*a+s*s),v?(v=1/v,o*=v,a*=v,s*=v):(o=0,a=0,s=0),u=p*s-d*a,c=d*o-h*s,f=h*a-p*o,v=Math.sqrt(u*u+c*c+f*f),v?(v=1/v,u*=v,c*=v,f*=v):(u=0,c=0,f=0),t[0]=o,t[1]=u,t[2]=h,t[3]=0,t[4]=a,t[5]=c,t[6]=p,t[7]=0,t[8]=s,t[9]=f,t[10]=d,t[11]=0,t[12]=-(o*m+a*g+s*y),t[13]=-(u*m+c*g+f*y),t[14]=-(h*m+p*g+d*y),t[15]=1,t)},l.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]+")"},t!==void 0&&(t.mat4=l);var f={};new Float32Array([0,0,0,1]),f.create=function(){var t=new e(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},f.clone=a.clone,f.fromValues=a.fromValues,f.copy=a.copy,f.set=a.set,f.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},f.setAxisAngle=function(t,r,e){e=.5*e;var n=Math.sin(e);return t[0]=n*r[0],t[1]=n*r[1],t[2]=n*r[2],t[3]=Math.cos(e),t},f.add=a.add,f.multiply=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=e[0],u=e[1],c=e[2],l=e[3];return t[0]=n*l+a*s+i*c-o*u,t[1]=i*l+a*u+o*s-n*c,t[2]=o*l+a*c+n*u-i*s,t[3]=a*l-n*s-i*u-o*c,t},f.mul=f.multiply,f.scale=a.scale,f.rotateX=function(t,r,e){e*=.5;var n=r[0],i=r[1],o=r[2],a=r[3],s=Math.sin(e),u=Math.cos(e);return t[0]=n*u+a*s,t[1]=i*u+o*s,t[2]=o*u-i*s,t[3]=a*u-n*s,t},f.rotateY=function(t,r,e){e*=.5;var n=r[0],i=r[1],o=r[2],a=r[3],s=Math.sin(e),u=Math.cos(e);return t[0]=n*u-o*s,t[1]=i*u+a*s,t[2]=o*u+n*s,t[3]=a*u-i*s,t},f.rotateZ=function(t,r,e){e*=.5;var n=r[0],i=r[1],o=r[2],a=r[3],s=Math.sin(e),u=Math.cos(e);return t[0]=n*u+i*s,t[1]=i*u-n*s,t[2]=o*u+a*s,t[3]=a*u-o*s,t},f.calculateW=function(t,r){var e=r[0],n=r[1],i=r[2];return t[0]=e,t[1]=n,t[2]=i,t[3]=-Math.sqrt(Math.abs(1-e*e-n*n-i*i)),t},f.dot=a.dot,f.lerp=a.lerp,f.slerp=function(t,r,e,n){var i,o,a,s,u=r[0],c=r[1],l=r[2],f=r[3],h=e[0],p=e[1],d=e[2],v=e[3],m=u*h+c*p+l*d+f*v;return Math.abs(m)>=1?(t!==r&&(t[0]=u,t[1]=c,t[2]=l,t[3]=f),t):(i=Math.acos(m),o=Math.sqrt(1-m*m),.001>Math.abs(o)?(t[0]=.5*u+.5*h,t[1]=.5*c+.5*p,t[2]=.5*l+.5*d,t[3]=.5*f+.5*v,t):(a=Math.sin((1-n)*i)/o,s=Math.sin(n*i)/o,t[0]=u*a+h*s,t[1]=c*a+p*s,t[2]=l*a+d*s,t[3]=f*a+v*s,t))},f.invert=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=e*e+n*n+i*i+o*o,s=a?1/a:0;return t[0]=-e*s,t[1]=-n*s,t[2]=-i*s,t[3]=o*s,t},f.conjugate=function(t,r){return t[0]=-r[0],t[1]=-r[1],t[2]=-r[2],t[3]=r[3],t},f.length=a.length,f.len=f.length,f.squaredLength=a.squaredLength,f.sqrLen=f.squaredLength,f.normalize=a.normalize,f.fromMat3=function(){var t=[1,2,0];return function(r,e){var n,i=e[0]+e[4]+e[8];if(i>0)n=Math.sqrt(i+1),r[3]=.5*n,n=.5/n,r[0]=(e[7]-e[5])*n,r[1]=(e[2]-e[6])*n,r[2]=(e[3]-e[1])*n;else{var o=0;e[4]>e[0]&&(o=1),e[8]>e[3*o+o]&&(o=2);var a=t[o],s=t[a];n=Math.sqrt(e[3*o+o]-e[3*a+a]-e[3*s+s]+1),r[o]=.5*n,n=.5/n,r[3]=(e[3*s+a]-e[3*a+s])*n,r[a]=(e[3*a+o]+e[3*o+a])*n,r[s]=(e[3*s+o]+e[3*o+s])*n}return r}}(),f.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},t!==void 0&&(t.quat=f)}(t.exports)})()},{}],"gl-matrix":[function(t,r){r.exports=t("JSCNs5")},{}]},{},[]),require=function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);throw Error("Cannot find module '"+a+"'")}var c=r[a]={exports:{}};t[a][0].call(c.exports,function(r){var e=t[a][1][r];return i(e?e:r)},c,c.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;n.length>a;a++)i(n[a]);return i}({1:[function(t,r){function e(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(t){return"function"==typeof t}function i(t){return"number"==typeof t}function o(t){return"object"==typeof t&&null!==t}function a(t){return void 0===t}r.exports=e,e.EventEmitter=e,e.prototype._events=void 0,e.prototype._maxListeners=void 0,e.defaultMaxListeners=10,e.prototype.setMaxListeners=function(t){if(!i(t)||0>t||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},e.prototype.emit=function(t){var r,e,i,s,u,c;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length))throw r=arguments[1],r instanceof Error?r:TypeError('Uncaught, unspecified "error" event.');if(e=this._events[t],a(e))return!1;if(n(e))switch(arguments.length){case 1:e.call(this);break;case 2:e.call(this,arguments[1]);break;case 3:e.call(this,arguments[1],arguments[2]);break;default:for(i=arguments.length,s=Array(i-1),u=1;i>u;u++)s[u-1]=arguments[u];e.apply(this,s)}else if(o(e)){for(i=arguments.length,s=Array(i-1),u=1;i>u;u++)s[u-1]=arguments[u];for(c=e.slice(),i=c.length,u=0;i>u;u++)c[u].apply(this,s)}return!0},e.prototype.addListener=function(t,r){var i;if(!n(r))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,n(r.listener)?r.listener:r),this._events[t]?o(this._events[t])?this._events[t].push(r):this._events[t]=[this._events[t],r]:this._events[t]=r,o(this._events[t])&&!this._events[t].warned){var i;i=a(this._maxListeners)?e.defaultMaxListeners:this._maxListeners,i&&i>0&&this._events[t].length>i&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),console.trace())}return this},e.prototype.on=e.prototype.addListener,e.prototype.once=function(t,r){function e(){this.removeListener(t,e),i||(i=!0,r.apply(this,arguments))}if(!n(r))throw TypeError("listener must be a function");var i=!1;return e.listener=r,this.on(t,e),this},e.prototype.removeListener=function(t,r){var e,i,a,s;if(!n(r))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(e=this._events[t],a=e.length,i=-1,e===r||n(e.listener)&&e.listener===r)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,r);else if(o(e)){for(s=a;s-->0;)if(e[s]===r||e[s].listener&&e[s].listener===r){i=s;break}if(0>i)return this;1===e.length?(e.length=0,delete this._events[t]):e.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,r)}return this},e.prototype.removeAllListeners=function(t){var r,e;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(r in this._events)"removeListener"!==r&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events={},this}if(e=this._events[t],n(e))this.removeListener(t,e);else for(;e.length;)this.removeListener(t,e[e.length-1]);return delete this._events[t],this},e.prototype.listeners=function(t){var r;return r=this._events&&this._events[t]?n(this._events[t])?[this._events[t]]:this._events[t].slice():[]},e.listenerCount=function(t,r){var e;return e=t._events&&t._events[r]?n(t._events[r])?1:t._events[r].length:0}},{}],2:[function(t,r){r.exports="function"==typeof Object.create?function(t,r){t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,r){t.super_=r;var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t}},{}],3:[function(t,r){var e=r.exports={};e.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,r="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(r){var e=[];return window.addEventListener("message",function(t){var r=t.source;if((r===window||null===r)&&"process-tick"===t.data&&(t.stopPropagation(),e.length>0)){var n=e.shift();n()}},!0),function(t){e.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),e.title="browser",e.browser=!0,e.env={},e.argv=[],e.binding=function(){throw Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(){throw Error("process.chdir is not supported")}},{}],4:[function(t,r){r.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],5:[function(t,r,e){(function(r,n){function i(t,r){var n={seen:[],stylize:a};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),v(r)?n.showHidden=r:r&&e._extend(n,r),w(n.showHidden)&&(n.showHidden=!1),w(n.depth)&&(n.depth=2),w(n.colors)&&(n.colors=!1),w(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=o),u(n,t,n.depth)}function o(t,r){var e=i.styles[r];return e?"["+i.colors[e][0]+"m"+t+"["+i.colors[e][1]+"m":t}function a(t){return t}function s(t){var r={};return t.forEach(function(t){r[t]=!0}),r}function u(t,r,n){if(t.customInspect&&r&&j(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,t);return b(i)||(i=u(t,i,n)),i}var o=c(t,r);if(o)return o;var a=Object.keys(r),v=s(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(r)),x(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return l(r);if(0===a.length){if(j(r)){var m=r.name?": "+r.name:"";return t.stylize("[Function"+m+"]","special")}if(M(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(E(r))return t.stylize(Date.prototype.toString.call(r),"date");if(x(r))return l(r)}var g="",y=!1,_=["{","}"];if(d(r)&&(y=!0,_=["[","]"]),j(r)){var w=r.name?": "+r.name:"";g=" [Function"+w+"]"}if(M(r)&&(g=" "+RegExp.prototype.toString.call(r)),E(r)&&(g=" "+Date.prototype.toUTCString.call(r)),x(r)&&(g=" "+l(r)),0===a.length&&(!y||0==r.length))return _[0]+g+_[1];
if(0>n)return M(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special");t.seen.push(r);var A;return A=y?f(t,r,n,v,a):a.map(function(e){return h(t,r,n,v,e,y)}),t.seen.pop(),p(A,g,_)}function c(t,r){if(w(r))return t.stylize("undefined","undefined");if(b(r)){var e="'"+JSON.stringify(r).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(e,"string")}return y(r)?t.stylize(""+r,"number"):v(r)?t.stylize(""+r,"boolean"):m(r)?t.stylize("null","null"):void 0}function l(t){return"["+Error.prototype.toString.call(t)+"]"}function f(t,r,e,n,i){for(var o=[],a=0,s=r.length;s>a;++a)S(r,a+"")?o.push(h(t,r,e,n,a+"",!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(h(t,r,e,n,i,!0))}),o}function h(t,r,e,n,i,o){var a,s,c;if(c=Object.getOwnPropertyDescriptor(r,i)||{value:r[i]},c.get?s=c.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):c.set&&(s=t.stylize("[Setter]","special")),S(n,i)||(a="["+i+"]"),s||(0>t.seen.indexOf(c.value)?(s=m(e)?u(t,c.value,null):u(t,c.value,e-1),s.indexOf("\n")>-1&&(s=o?s.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+s.split("\n").map(function(t){return" "+t}).join("\n"))):s=t.stylize("[Circular]","special")),w(a)){if(o&&i.match(/^\d+$/))return s;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function p(t,r,e){var n=0,i=t.reduce(function(t,r){return n++,r.indexOf("\n")>=0&&n++,t+r.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?e[0]+(""===r?"":r+"\n ")+" "+t.join(",\n ")+" "+e[1]:e[0]+r+" "+t.join(", ")+" "+e[1]}function d(t){return Array.isArray(t)}function v(t){return"boolean"==typeof t}function m(t){return null===t}function g(t){return null==t}function y(t){return"number"==typeof t}function b(t){return"string"==typeof t}function _(t){return"symbol"==typeof t}function w(t){return void 0===t}function M(t){return A(t)&&"[object RegExp]"===L(t)}function A(t){return"object"==typeof t&&null!==t}function E(t){return A(t)&&"[object Date]"===L(t)}function x(t){return A(t)&&("[object Error]"===L(t)||t instanceof Error)}function j(t){return"function"==typeof t}function k(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||t===void 0}function L(t){return Object.prototype.toString.call(t)}function I(t){return 10>t?"0"+t.toString(10):t.toString(10)}function q(){var t=new Date,r=[I(t.getHours()),I(t.getMinutes()),I(t.getSeconds())].join(":");return[t.getDate(),V[t.getMonth()],r].join(" ")}function S(t,r){return Object.prototype.hasOwnProperty.call(t,r)}var F=/%[sdj%]/g;e.format=function(t){if(!b(t)){for(var r=[],e=0;arguments.length>e;e++)r.push(i(arguments[e]));return r.join(" ")}for(var e=1,n=arguments,o=n.length,a=(t+"").replace(F,function(t){if("%%"===t)return"%";if(e>=o)return t;switch(t){case"%s":return n[e++]+"";case"%d":return Number(n[e++]);case"%j":try{return JSON.stringify(n[e++])}catch(r){return"[Circular]"}default:return t}}),s=n[e];o>e;s=n[++e])a+=m(s)||!A(s)?" "+s:" "+i(s);return a},e.deprecate=function(t,i){function o(){if(!a){if(r.throwDeprecation)throw Error(i);r.traceDeprecation?console.trace(i):console.error(i),a=!0}return t.apply(this,arguments)}if(w(n.process))return function(){return e.deprecate(t,i).apply(this,arguments)};if(r.noDeprecation===!0)return t;var a=!1;return o};var T,O={};e.debuglog=function(t){if(w(T)&&(T=r.env.NODE_DEBUG||""),t=t.toUpperCase(),!O[t])if(RegExp("\\b"+t+"\\b","i").test(T)){var n=r.pid;O[t]=function(){var r=e.format.apply(e,arguments);console.error("%s %d: %s",t,n,r)}}else O[t]=function(){};return O[t]},e.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=d,e.isBoolean=v,e.isNull=m,e.isNullOrUndefined=g,e.isNumber=y,e.isString=b,e.isSymbol=_,e.isUndefined=w,e.isRegExp=M,e.isObject=A,e.isDate=E,e.isError=x,e.isFunction=j,e.isPrimitive=k,e.isBuffer=t("./support/isBuffer");var V=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];e.log=function(){console.log("%s - %s",q(),e.format.apply(e,arguments))},e.inherits=t("inherits"),e._extend=function(t,r){if(!r||!A(r))return t;for(var e=Object.keys(r),n=e.length;n--;)t[e[n]]=r[e[n]];return t}}).call(this,t("/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":4,"/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":3,inherits:2}],"gl-now":[function(t,r){r.exports=t("4Rg4Ae")},{}],"4Rg4Ae":[function(t,r){"use strict";function e(t){function r(){var t=0|o._width/a,r=0|o._height/a;o.canvas.width=t,o.canvas.height=r,o.canvas.style.width=o._width+"px",o.canvas.style.height=o._height+"px",o.emit("gl-resize",t,r)}t=t||{};var e=t.extensions||[],o=n(t),a=o.scale||1;return o.on("init",function(){var n=document.createElement("canvas"),s=n.getContext("webgl")||n.getContext("experimental-webgl");if(!s)return o.emit("gl-error",Error("Unable to initialize WebGL")),void 0;for(var u=i(s),c=0;e.length>c;++c)if(!(e[c]in u))return o.emit("gl-error",Error("Missing extension: "+e[c])),void 0;n.style.position="absolute",n.style.left="0px",n.style.top="0px",o.element.appendChild(n),o.canvas=n,o.gl=s,r(),o.clearFlags=void 0===t.clearFlags?s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT:t.clearFlags,o.clearColor=t.clearColor||[0,0,0,0],o.clearDepth=t.clearDepth||1,o.clearStencil=t.clearStencil||0,o.on("resize",r),o.on("render",function(t){s.bindFramebuffer(s.FRAMEBUFFER,null),s.viewport(0,0,0|o._width/a,0|o._height/a),o.clearFlags&s.STENCIL_BUFFER_BIT&&s.clearStencil(o.clearStencil),o.clearFlags&s.COLOR_BUFFER_BIT&&s.clearColor(o.clearColor[0],o.clearColor[1],o.clearColor[2],o.clearColor[3]),o.clearFlags&s.DEPTH_BUFFER_BIT&&s.clearDepth(o.clearDepth),o.clearFlags&&s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT|s.STENCIL_BUFFER_BIT),o.emit("gl-render",t)}),o.emit("gl-init")}),Object.defineProperty(o,"scale",{get:function(){return a},set:function(t){return t=+t,0>=t||isNaN(t)||a===t?a:(a=t,r(),a)}}),Object.defineProperty(o,"width",{get:function(){return 0|o._width/a}}),Object.defineProperty(o,"height",{get:function(){return 0|o._height/a}}),Object.defineProperty(o,"mouse",{get:function(){return[o.mouseX/a,o.mouseY/a]}}),Object.defineProperty(o,"prevMouse",{get:function(){return[o.prevMouseX/a,o.prevMouseY/a]}}),o}var n=t("game-shell"),i=t("webglew");r.exports=e},{"game-shell":17,webglew:19}],8:[function(t,r){"object"==typeof window.performance?window.performance.now?r.exports=function(){return window.performance.now()}:window.performance.webktiNow&&(r.exports=function(){return window.performance.webkitNow()}):r.exports=Date.now?Date.now:function(){return(new Date).getTime()}},{}],9:[function(t,r){function e(t,r,e,a){t[n](o+r,"wheel"==i?e:function(t){!t&&(t=window.event);var r={originalEvent:t,target:t.target||t.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==t.type?0:1,deltaX:0,delatZ:0,preventDefault:function(){t.preventDefault?t.preventDefault():t.returnValue=!1}};return"mousewheel"==i?(r.deltaY=-1/40*t.wheelDelta,t.wheelDeltaX&&(r.deltaX=-1/40*t.wheelDeltaX)):r.deltaY=t.detail,e(r)},a||!1)}var n,i,o="";window.addEventListener?n="addEventListener":(n="attachEvent",o="on"),i="onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll",r.exports=function(t,r,n){e(t,i,r,n),"DOMMouseScroll"==i&&e(t,"MozMousePixelScroll",r,n)}},{}],10:[function(){for(var t=0,r=["ms","moz","webkit","o"],e=0;r.length>e&&!window.requestAnimationFrame;++e)window.requestAnimationFrame=window[r[e]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[r[e]+"CancelAnimationFrame"]||window[r[e]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(r){var e=(new Date).getTime(),n=Math.max(0,16-(e-t)),i=window.setTimeout(function(){r(e+n)},n);return t=e+n,i}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)})},{}],11:[function(t,r){"use strict";function e(t,r,e,n,i,o){var a=["function ",t,"(a,l,h,",n.join(","),"){",o?"":"var i=",e?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",i?".get(m)":"[m]"];return o?0>r.indexOf("c")?a.push(";if(x===y){return m}else if(x<=y){"):a.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):a.push(";if(",r,"){i=m;"),e?a.push("l=m+1}else{h=m-1}"):a.push("h=m-1}else{l=m+1}"),a.push("}"),o?a.push("return -1};"):a.push("return i};"),a.join("")}function n(t,r,n,i){var o=Function([e("A","x"+t+"y",r,["y"],!1,i),e("B","x"+t+"y",r,["y"],!0,i),e("P","c(x,y)"+t+"0",r,["y","c"],!1,i),e("Q","c(x,y)"+t+"0",r,["y","c"],!0,i),"function dispatchBsearch",n,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",n].join(""));return o()}r.exports={ge:n(">=",!1,"GE"),gt:n(">",!1,"GT"),lt:n("<",!0,"LT"),le:n("<=",!0,"LE"),eq:n("-",!0,"EQ",!0)}},{}],12:[function(t,r){!function(t,e){r!==void 0?r.exports=e():"function"==typeof define&&"object"==typeof define.amd?define(e):this[t]=e()}("domready",function(t){function r(t){for(p=1;t=n.shift();)t()}var e,n=[],i=!1,o=document,a=o.documentElement,s=a.doScroll,u="DOMContentLoaded",c="addEventListener",l="onreadystatechange",f="readyState",h=s?/^loaded|^c/:/^loaded|c/,p=h.test(o[f]);return o[c]&&o[c](u,e=function(){o.removeEventListener(u,e,i),r()},i),s&&o.attachEvent(l,e=function(){/^c/.test(o[f])&&(o.detachEvent(l,e),r())}),t=s?function(r){self!=top?p?r():n.push(r):function(){try{a.doScroll("left")}catch(e){return setTimeout(function(){t(r)},50)}r()}()}:function(t){p?t():n.push(t)}})},{}],13:[function(t,r){"use strict";function e(t){var r={};for(var e in t)t.hasOwnProperty(e)&&(r[t[e]]=e);return r}r.exports=e},{}],14:[function(t,r){"use strict";function e(t){for(var r=Array(t),e=0;t>e;++e)r[e]=e;return r}r.exports=e},{}],15:[function(t,r){"use strict";function e(t,r){for(var e=1,n=t.length,i=t[0],o=t[0],a=1;n>a;++a)if(o=i,i=t[a],r(i,o)){if(a===e){e++;continue}t[e++]=i}return t.length=e,t}function n(t){for(var r=1,e=t.length,n=t[0],i=t[0],o=1;e>o;++o,i=n)if(i=n,n=t[o],n!==i){if(o===r){r++;continue}t[r++]=n}return t.length=r,t}function i(t,r,i){return 0===t.length?[]:r?(i||t.sort(r),e(t,r)):(i||t.sort(),n(t))}r.exports=i},{}],16:[function(t,r){var e,n="undefined"!=typeof window?window.navigator.userAgent:"",i=/OS X/.test(n),o=/Opera/.test(n),a=!/like Gecko/.test(n)&&!o,s=r.exports={0:i?"<menu>":"<UNK>",1:"<mouse 1>",2:"<mouse 2>",3:"<break>",4:"<mouse 3>",5:"<mouse 4>",6:"<mouse 5>",8:"<backspace>",9:"<tab>",12:"<clear>",13:"<enter>",16:"<shift>",17:"<control>",18:"<alt>",19:"<pause>",20:"<caps-lock>",21:"<ime-hangul>",23:"<ime-junja>",24:"<ime-final>",25:"<ime-kanji>",27:"<escape>",28:"<ime-convert>",29:"<ime-nonconvert>",30:"<ime-accept>",31:"<ime-mode-change>",27:"<escape>",32:"<space>",33:"<page-up>",34:"<page-down>",35:"<end>",36:"<home>",37:"<left>",38:"<up>",39:"<right>",40:"<down>",41:"<select>",42:"<print>",43:"<execute>",44:"<snapshot>",45:"<insert>",46:"<delete>",47:"<help>",91:"<meta>",92:"<meta>",93:i?"<meta>":"<menu>",95:"<sleep>",106:"<num-*>",107:"<num-+>",108:"<num-enter>",109:"<num-->",110:"<num-.>",111:"<num-/>",144:"<num-lock>",145:"<scroll-lock>",160:"<shift-left>",161:"<shift-right>",162:"<control-left>",163:"<control-right>",164:"<alt-left>",165:"<alt-right>",166:"<browser-back>",167:"<browser-forward>",168:"<browser-refresh>",169:"<browser-stop>",170:"<browser-search>",171:"<browser-favorites>",172:"<browser-home>",173:i&&a?"-":"<volume-mute>",174:"<volume-down>",175:"<volume-up>",176:"<next-track>",177:"<prev-track>",178:"<stop>",179:"<play-pause>",180:"<launch-mail>",181:"<launch-media-select>",182:"<launch-app 1>",183:"<launch-app 2>",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",223:"<meta>",224:"<meta>",226:"<alt-gr>",229:"<ime-process>",231:o?"`":"<unicode>",246:"<attention>",247:"<crsel>",248:"<exsel>",249:"<erase-eof>",250:"<play>",251:"<zoom>",252:"<no-name>",253:"<pa-1>",254:"<clear>"};for(e=58;65>e;++e)s[e]=String.fromCharCode(e);for(e=48;58>e;++e)s[e]=e-48+"";for(e=65;91>e;++e)s[e]=String.fromCharCode(e);for(e=96;106>e;++e)s[e]="<num-"+(e-96)+">";for(e=112;136>e;++e)s[e]="F"+(e-111)},{}],17:[function(t,r){"use strict";function e(t){return O.eq(D,t)}function n(t){return e(U[t])}function i(){L.call(this),this._curKeyState=Array(D.length),this._pressCount=Array(D.length),this._releaseCount=Array(D.length),this._tickInterval=null,this._rafHandle=null,this._tickRate=0,this._lastTick=P(),this._frameTime=0,this._paused=!0,this._width=0,this._height=0,this._wantFullscreen=!1,this._wantPointerLock=!1,this._fullscreenActive=!1,this._pointerLockActive=!1,this._render=h.bind(void 0,this);for(var t=0;D.length>t;++t)this._curKeyState[t]=!1,this._pressCount[t]=this._releaseCount[t]=0;this.element=null,this.bindings={},this.frameSkip=100,this.tickCount=0,this.frameCount=0,this.startTime=P(),this.tickTime=this._tickRate,this.frameTime=10,this.stickyFullscreen=!1,this.stickyPointLock=!1,this.scroll=[0,0,0],this.mouseX=0,this.mouseY=0,this.prevMouseX=0,this.prevMouseY=0}function o(t,r,n){if(n in r){for(var i=r[n],o=0,a=i.length;a>o;++o)if(t[e(i[o])])return!0;return!1}var s=e(n);return s>=0?t[s]:!1}function a(t,r,n){if(n in r){for(var i=r[n],o=0,a=0,s=i.length;s>a;++a)o+=t[e(i[a])];return o}var u=e(n);return u>=0?t[u]:0}function s(t){var r=t.element;if(t._wantFullscreen&&!t._fullscreenActive){var e=r.requestFullscreen||r.requestFullScreen||r.webkitRequestFullscreen||r.webkitRequestFullScreen||r.mozRequestFullscreen||r.mozRequestFullScreen||function(){};e.call(r)}if(t._wantPointerLock&&!t._pointerLockActive){var n=r.requestPointerLock||r.webkitRequestPointerLock||r.mozRequestPointerLock||r.msRequestPointerLock||r.oRequestPointerLock||function(){};n.call(r)}}function u(t){t._fullscreenActive=document.fullscreen||document.mozFullScreen||document.webkitIsFullScreen||!1,!t.stickyFullscreen&&t._fullscreenActive&&(t._wantFullscreen=!1)}function c(t){t._pointerLockActive=t.element===(document.pointerLockElement||document.mozPointerLockElement||document.webkitPointerLockElement||null),!t.stickyPointerLock&&t._pointerLockActive&&(t._wantPointerLock=!1)}function l(t,r,e){var n=t._curKeyState[r];n!==e&&(e?t._pressCount[r]++:t._releaseCount[r]++,t._curKeyState[r]=e)}function f(t){for(var r,e,n,i=P()+t.frameSkip,o=t._pressCount,a=t._releaseCount,s=t._tickRate,u=D.length;!t._paused&&P()>=t._lastTick+s;){if(P()>i)return t._lastTick=P()+s,void 0;for(e=P(),t.emit("tick"),n=P(),t.tickTime=n-e,++t.tickCount,t._lastTick+=s,r=0;u>r;++r)o[r]=a[r]=0;t._pointerLockActive?(t.prevMouseX=t.mouseX=t.width>>1,t.prevMouseY=t.mouseY=t.height>>1):(t.prevMouseX=t.mouseX,t.prevMouseY=t.mouseY),t.scroll[0]=t.scroll[1]=t.scroll[2]=0}}function h(t){t._rafHandle=requestAnimationFrame(t._render),f(t);var r;r=t._paused?t._frameTime:C(1,(P()-t._lastTick)/t._tickRate),++t.frameCount;var e=P();t.emit("render",r);var n=P();t.frameTime=n-e}function p(t){return document.activeElement===document.body||document.activeElement===t.element}function d(t,r){r.preventDefault();var e=n(r.keyCode||r.char||r.which||r.charCode);e>=0&&l(t,e,!1)}function v(t,r){if(p(t))if(r.metaKey)E(t,r);else{r.preventDefault();var e=n(r.keyCode||r.char||r.which||r.charCode);e>=0&&l(t,e,!0)}}function m(t,r){for(var e=0;32>e;++e)l(t,Y[e],!!(r&1<<e))}function g(t,r){if(t._pointerLockActive){var e=r.movementX||r.mozMovementX||r.webkitMovementX||0,n=r.movementY||r.mozMovementY||r.webkitMovementY||0;t.mouseX+=e,t.mouseY+=n}else t.mouseX=r.clientX-t.element.offsetLeft,t.mouseY=r.clientY-t.element.offsetTop;return!1}function y(t,r){return l(t,Y[r.button],!0),!1}function b(t,r){return l(t,Y[r.button],!1),!1}function _(t,r){return t._pointerLockActive?(t.prevMouseX=t.mouseX=t.width>>1,t.prevMouseY=t.mouseY=t.height>>1):(t.prevMouseX=t.mouseX=r.clientX-t.element.offsetLeft,t.prevMouseY=t.mouseY=r.clientY-t.element.offsetTop),!1}function w(t){return m(t,0),!1}function M(t,r){var e=1;switch(r.deltaMode){case 0:e=1;break;case 1:e=12;break;case 2:e=t.height}return t.scroll[0]+=r.deltaX*e,t.scroll[1]+=r.deltaY*e,t.scroll[2]+=r.deltaZ*e||0,!1}function A(){return!1}function E(t){var r,e=D.length,n=t._curKeyState,i=t._releaseCount;for(r=0;e>r;++r)n[r]&&++i[r],n[r]=!1;return!1}function x(t){var r=0|t.element.clientWidth,e=0|t.element.clientHeight;(r!==t._width||e!==t._height)&&(t._width=r,t._height=e,t.emit("resize",r,e))}function j(){var t=document.createElement("div");return t.tabindex=1,t.style.position="absolute",t.style.left="0px",t.style.right="0px",t.style.top="0px",t.style.bottom="0px",t.style.height="100%",t.style.overflow="hidden",document.body.appendChild(t),document.body.style.overflow="hidden",document.body.style.height="100%",t}function k(t){t=t||{};var r=!!t.fullscreen,e=r;void 0!==typeof t.pointerLock&&(e=!!t.pointerLock);var n=new i;return n._tickRate=t.tickRate||30,n.frameSkip=t.frameSkip||5*(n._tickRate+5),n.stickyFullscreen=!!t.stickyFullscreen||!!t.sticky,n.stickyPointerLock=!!t.stickPointerLock||!t.sticky,t.bindings&&(n.bindings=bindings),setTimeout(function(){q(function(){var i=t.element;if("string"==typeof i){var o=document.querySelector(i);o||(o=document.getElementById(i)),o||(o=document.getElementByClass(i)[0]),o||(o=j()),n.element=o}else n.element="object"==typeof i&&i?i:"function"==typeof i?i():j();n.element.style&&(n.element.style["-webkit-touch-callout"]="none",n.element.style["-webkit-user-select"]="none",n.element.style["-khtml-user-select"]="none",n.element.style["-moz-user-select"]="none",n.element.style["-ms-user-select"]="none",n.element.style["user-select"]="none"),n._width=n.element.clientWidth,n._height=n.element.clientHeight;var a=x.bind(void 0,n);if("undefined"!=typeof MutationObserver){var l=new MutationObserver(a);l.observe(n.element,{attributes:!0,subtree:!0})}else n.element.addEventListener("DOMSubtreeModified",a,!1);window.addEventListener("resize",a,!1),window.addEventListener("keydown",v.bind(void 0,n),!1),window.addEventListener("keyup",d.bind(void 0,n),!1),n.element.oncontextmenu=A.bind(void 0,n),n.element.addEventListener("mousedown",y.bind(void 0,n),!1),n.element.addEventListener("mouseup",b.bind(void 0,n),!1),n.element.addEventListener("mousemove",g.bind(void 0,n),!1),n.element.addEventListener("mouseenter",_.bind(void 0,n),!1);var f=w.bind(void 0,n);n.element.addEventListener("mouseleave",f,!1),n.element.addEventListener("mouseout",f,!1),window.addEventListener("mouseleave",f,!1),window.addEventListener("mouseout",f,!1);var h=E.bind(void 0,n);n.element.addEventListener("blur",h,!1),n.element.addEventListener("focusout",h,!1),n.element.addEventListener("focus",h,!1),window.addEventListener("blur",h,!1),window.addEventListener("focusout",h,!1),window.addEventListener("focus",h,!1),N(n.element,M.bind(void 0,n),!1);var p=u.bind(void 0,n);document.addEventListener("fullscreenchange",p,!1),document.addEventListener("mozfullscreenchange",p,!1),document.addEventListener("webkitfullscreenchange",p,!1),n.element.addEventListener("click",s.bind(void 0,n),!1);var m=c.bind(void 0,n);document.addEventListener("pointerlockchange",m,!1),document.addEventListener("mozpointerlockchange",m,!1),document.addEventListener("webkitpointerlockchange",m,!1),document.addEventListener("pointerlocklost",m,!1),document.addEventListener("webkitpointerlocklost",m,!1),document.addEventListener("mozpointerlocklost",m,!1),n.fullscreen=r,n.pointerLock=e,n.bind("mouse-left","mouse-1"),n.bind("mouse-right","mouse-3"),n.bind("mouse-middle","mouse-2"),n._lastTick=P(),n.startTime=P(),n.paused=!1,n.emit("init")})},0),n}var L=t("events").EventEmitter,I=t("util"),q=t("domready"),S=t("vkey"),F=t("invert-hash"),T=t("uniq"),O=t("binary-search-bounds"),V=t("iota-array"),C=Math.min;t("./lib/raf-polyfill.js");var N=t("./lib/mousewheel-polyfill.js"),P=t("./lib/hrtime-polyfill.js"),U=function(){var t,r,e=Array(256);for(t=0;256>t;++t)e[t]="UNK";for(t in S)r=S[t],"<"===r.charAt(0)&&">"===r.charAt(r.length-1)&&(r=r.substring(1,r.length-1)),r=r.replace(/\s/g,"-"),e[parseInt(t)]=r;return e}(),D=T(Object.keys(F(U)));I.inherits(i,L);var R=i.prototype;R.keyNames=D,R.bind=function(t){var r;r=t in this.bindings?this.bindings[t]:[];for(var n,i=1,o=arguments.length;o>i;++i)if(n=arguments[i],e(n)>=0)r.push(n);else if(n in this.bindings)for(var a=this.bindings[n],s=0;a.length>s;++s)r.push(a[s]);r=T(r),r.length>0&&(this.bindings[t]=r)},R.unbind=function(t){t in this.bindings&&delete this.bindings[t]},R.down=function(t){return o(this._curKeyState,this.bindings,t)},R.wasDown=function(t){return this.down(t)||!!this.press(t)},R.up=function(t){return!this.down(t)},R.wasUp=function(t){return this.up(t)||!!this.release(t)},R.press=function(t){return a(this._pressCount,this.bindings,t)},R.release=function(t){return a(this._releaseCount,this.bindings,t)},Object.defineProperty(R,"paused",{get:function(){return this._paused},set:function(t){var r=!!t;r!==this._paused&&(this._paused?(this._paused=!1,this._lastTick=P()-Math.floor(this._frameTime*this._tickRate),this._tickInterval=setInterval(f,this._tickRate,this),this._rafHandle=requestAnimationFrame(this._render)):(this._paused=!0,this._frameTime=C(1,(P()-this._lastTick)/this._tickRate),clearInterval(this._tickInterval)))}});var B=document.exitFullscreen||document.cancelFullscreen||document.cancelFullScreen||document.webkitCancelFullscreen||document.webkitCancelFullScreen||document.mozCancelFullscreen||document.mozCancelFullScreen||function(){};Object.defineProperty(R,"fullscreen",{get:function(){return this._fullscreenActive},set:function(t){var r=!!t;return r?(this._wantFullscreen=!0,s(this)):(this._wantFullscreen=!1,B.call(document)),this._fullscreenActive}});var z=document.exitPointerLock||document.webkitExitPointerLock||document.mozExitPointerLock||function(){};Object.defineProperty(R,"pointerLock",{get:function(){return this._pointerLockActive},set:function(t){var r=!!t;return r?(this._wantPointerLock=!0,s(this)):(this._wantPointerLock=!1,z.call(document)),this._pointerLockActive}}),Object.defineProperty(R,"width",{get:function(){return this.element.clientWidth}}),Object.defineProperty(R,"height",{get:function(){return this.element.clientHeight}});var Y=V(32).map(function(t){return e("mouse-"+(t+1))});r.exports=k},{"./lib/hrtime-polyfill.js":8,"./lib/mousewheel-polyfill.js":9,"./lib/raf-polyfill.js":10,"binary-search-bounds":11,domready:12,events:1,"invert-hash":13,"iota-array":14,uniq:15,util:5,vkey:16}],18:[function(t,r,e){void function(t,n,i){function o(t,r,e){return"function"==typeof r&&(e=r,r=a(e).replace(/_$/,"")),c(t,r,{configurable:!0,writable:!0,value:e})}function a(t){return"function"!=typeof t?"":"name"in t?t.name:l.call(t).match(p)[1]}function s(t){function r(r,n){return n||2===arguments.length?e.set(r,n):(n=e.get(r),n===i&&(n=t(r),e.set(r,n))),n}var e=new v;return t||(t=m),r}var u=Object.getOwnPropertyNames,c=Object.defineProperty,l=Function.prototype.toString,f=Object.create,h=Object.prototype.hasOwnProperty,p=/^\n?function\s?(\w*)?_?\(/,d=function(){function t(){var t=a(),n={};this.unlock=function(i){var o=l(i);if(h.call(o,t))return o[t](n);var a=f(null,r);return c(o,t,{value:Function("s","l",e)(n,a)}),a}}var r={value:{writable:!0,value:i}},e="return function(k){if(k===s)return l}",n=f(null),a=function(){var t=Math.random().toString(36).slice(2);return t in n?a():n[t]=t},s=a(),l=function(t){if(h.call(t,s))return t[s];if(!Object.isExtensible(t))throw new TypeError("Object must be extensible");var r=f(null);return c(t,s,{value:r}),r};return o(Object,function(t){var r=u(t);return h.call(t,s)&&r.splice(r.indexOf(s),1),r}),o(t.prototype,function(t){return this.unlock(t).value}),o(t.prototype,function(t,r){this.unlock(t).value=r}),t}(),v=function(r){function e(r){return this===t||null==this||this===e.prototype?new e(r):(p(this,new d),m(this,r),i)}function s(t){h(t);var r=v(this).get(t);return r===n?i:r}function u(t,r){h(t),v(this).set(t,r===i?n:r)}function c(t){return h(t),v(this).get(t)!==i}function l(t){h(t);var r=v(this),e=r.get(t)!==i;return r.set(t,i),e}function f(){return v(this),"[object WeakMap]"}var h=function(t){if(null==t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Invalid WeakMap key")},p=function(t,e){var n=r.unlock(t);if(n.value)throw new TypeError("Object is already a WeakMap");n.value=e},v=function(t){var e=r.unlock(t).value;if(!e)throw new TypeError("WeakMap is not generic");return e},m=function(t,r){null!==r&&"object"==typeof r&&"function"==typeof r.forEach&&r.forEach(function(e,n){e instanceof Array&&2===e.length&&u.call(t,r[n][0],r[n][1])})};try{var g=("return "+l).replace("e_","\\u0065"),y=Function("unwrap","validate",g)(v,h)}catch(b){var y=l}var g=(""+Object).split("Object"),_=function f(){return g[0]+a(this)+g[1]};o(_,_);var w={__proto__:[]}instanceof Array?function(t){t.__proto__=_}:function(t){o(t,_)};return w(e),[f,s,u,c,y].forEach(function(t){o(e.prototype,t),w(t)}),e}(new d),m=Object.create?function(){return Object.create(null)}:function(){return{}};r!==i?r.exports=v:e!==i?e.WeakMap=v:"WeakMap"in t||(t.WeakMap=v),v.createStorage=s,t.WeakMap&&(t.WeakMap.createStorage=s)}((0,eval)("this"))},{}],19:[function(t,r){"use strict";function e(t){return t.replace(/^[A-Z]+_/,"")}function n(t){var r=o.get(t);if(r)return r;for(var n={},i=t.getSupportedExtensions(),a=0;i.length>a;++a){var s=i[a],u=t.getExtension(i[a]);if(u)for(;;){n[s]=u;var c=e(s);if(c===s)break;s=c}}return o.set(t,n),n}var i="undefined"==typeof WeakMap?t("weakmap"):WeakMap,o=new i;r.exports=n},{weakmap:18}]},{},[]),require=function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);throw Error("Cannot find module '"+a+"'")}var c=r[a]={exports:{}};t[a][0].call(c.exports,function(r){var e=t[a][1][r];return i(e?e:r)},c,c.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;n.length>a;a++)i(n[a]);return i}({c1bonG:[function(t,r){"use strict";function e(t){var r=n();return t.on("tick",function(){var e=t.down("control"),n=t.down("shift"),i=t.down("mouse-left"),o=t.down("mouse-right"),a=t.down("mouse-middle");if(!i||e||n||r.rotate([t.mouseX/t.width-.5,t.mouseY/t.height-.5],[t.prevMouseX/t.width-.5,t.prevMouseY/t.height-.5]),(o||i&&e&&!n)&&r.pan([(t.mouseX-t.prevMouseX)/t.width,(t.mouseY-t.prevMouseY)/t.height]),t.scroll[1]&&(r.distance*=Math.exp(t.scroll[1]/t.height)),a||i&&!e&&n){var s=t.mouseY-t.prevMouseY;s&&(r.distance*=Math.exp(s/t.height))}}),r}var n=t("orbit-camera");r.exports=e},{"orbit-camera":4}],"game-shell-orbit-camera":[function(t,r){r.exports=t("c1bonG")},{}],3:[function(t,r,e){(function(t){"use strict";var r={};e===void 0?"function"==typeof define&&"object"==typeof define.amd&&define.amd?(r.exports={},define(function(){return r.exports})):r.exports="undefined"!=typeof window?window:t:r.exports=e,function(t){if(!r)var r=1e-6;if(!e)var e="undefined"!=typeof Float32Array?Float32Array:Array;if(!n)var n=Math.random;var i={};i.setMatrixArrayType=function(t){e=t},t!==void 0&&(t.glMatrix=i);var o=Math.PI/180;i.toRadian=function(t){return t*o};var a={};a.create=function(){var t=new e(2);return t[0]=0,t[1]=0,t},a.clone=function(t){var r=new e(2);return r[0]=t[0],r[1]=t[1],r},a.fromValues=function(t,r){var n=new e(2);return n[0]=t,n[1]=r,n},a.copy=function(t,r){return t[0]=r[0],t[1]=r[1],t},a.set=function(t,r,e){return t[0]=r,t[1]=e,t},a.add=function(t,r,e){return t[0]=r[0]+e[0],t[1]=r[1]+e[1],t},a.subtract=function(t,r,e){return t[0]=r[0]-e[0],t[1]=r[1]-e[1],t},a.sub=a.subtract,a.multiply=function(t,r,e){return t[0]=r[0]*e[0],t[1]=r[1]*e[1],t},a.mul=a.multiply,a.divide=function(t,r,e){return t[0]=r[0]/e[0],t[1]=r[1]/e[1],t},a.div=a.divide,a.min=function(t,r,e){return t[0]=Math.min(r[0],e[0]),t[1]=Math.min(r[1],e[1]),t},a.max=function(t,r,e){return t[0]=Math.max(r[0],e[0]),t[1]=Math.max(r[1],e[1]),t},a.scale=function(t,r,e){return t[0]=r[0]*e,t[1]=r[1]*e,t},a.scaleAndAdd=function(t,r,e,n){return t[0]=r[0]+e[0]*n,t[1]=r[1]+e[1]*n,t},a.distance=function(t,r){var e=r[0]-t[0],n=r[1]-t[1];return Math.sqrt(e*e+n*n)},a.dist=a.distance,a.squaredDistance=function(t,r){var e=r[0]-t[0],n=r[1]-t[1];return e*e+n*n},a.sqrDist=a.squaredDistance,a.length=function(t){var r=t[0],e=t[1];return Math.sqrt(r*r+e*e)},a.len=a.length,a.squaredLength=function(t){var r=t[0],e=t[1];return r*r+e*e},a.sqrLen=a.squaredLength,a.negate=function(t,r){return t[0]=-r[0],t[1]=-r[1],t},a.normalize=function(t,r){var e=r[0],n=r[1],i=e*e+n*n;return i>0&&(i=1/Math.sqrt(i),t[0]=r[0]*i,t[1]=r[1]*i),t},a.dot=function(t,r){return t[0]*r[0]+t[1]*r[1]},a.cross=function(t,r,e){var n=r[0]*e[1]-r[1]*e[0];return t[0]=t[1]=0,t[2]=n,t},a.lerp=function(t,r,e,n){var i=r[0],o=r[1];return t[0]=i+n*(e[0]-i),t[1]=o+n*(e[1]-o),t},a.random=function(t,r){r=r||1;var e=2*n()*Math.PI;return t[0]=Math.cos(e)*r,t[1]=Math.sin(e)*r,t},a.transformMat2=function(t,r,e){var n=r[0],i=r[1];return t[0]=e[0]*n+e[2]*i,t[1]=e[1]*n+e[3]*i,t},a.transformMat2d=function(t,r,e){var n=r[0],i=r[1];return t[0]=e[0]*n+e[2]*i+e[4],t[1]=e[1]*n+e[3]*i+e[5],t},a.transformMat3=function(t,r,e){var n=r[0],i=r[1];return t[0]=e[0]*n+e[3]*i+e[6],t[1]=e[1]*n+e[4]*i+e[7],t},a.transformMat4=function(t,r,e){var n=r[0],i=r[1];return t[0]=e[0]*n+e[4]*i+e[12],t[1]=e[1]*n+e[5]*i+e[13],t},a.forEach=function(){var t=a.create();return function(r,e,n,i,o,a){var s,u;for(e||(e=2),n||(n=0),u=i?Math.min(i*e+n,r.length):r.length,s=n;u>s;s+=e)t[0]=r[s],t[1]=r[s+1],o(t,t,a),r[s]=t[0],r[s+1]=t[1];return r}}(),a.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},t!==void 0&&(t.vec2=a);var s={};s.create=function(){var t=new e(3);return t[0]=0,t[1]=0,t[2]=0,t},s.clone=function(t){var r=new e(3);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r},s.fromValues=function(t,r,n){var i=new e(3);return i[0]=t,i[1]=r,i[2]=n,i},s.copy=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t},s.set=function(t,r,e,n){return t[0]=r,t[1]=e,t[2]=n,t},s.add=function(t,r,e){return t[0]=r[0]+e[0],t[1]=r[1]+e[1],t[2]=r[2]+e[2],t},s.subtract=function(t,r,e){return t[0]=r[0]-e[0],t[1]=r[1]-e[1],t[2]=r[2]-e[2],t},s.sub=s.subtract,s.multiply=function(t,r,e){return t[0]=r[0]*e[0],t[1]=r[1]*e[1],t[2]=r[2]*e[2],t},s.mul=s.multiply,s.divide=function(t,r,e){return t[0]=r[0]/e[0],t[1]=r[1]/e[1],t[2]=r[2]/e[2],t},s.div=s.divide,s.min=function(t,r,e){return t[0]=Math.min(r[0],e[0]),t[1]=Math.min(r[1],e[1]),t[2]=Math.min(r[2],e[2]),t},s.max=function(t,r,e){return t[0]=Math.max(r[0],e[0]),t[1]=Math.max(r[1],e[1]),t[2]=Math.max(r[2],e[2]),t},s.scale=function(t,r,e){return t[0]=r[0]*e,t[1]=r[1]*e,t[2]=r[2]*e,t},s.scaleAndAdd=function(t,r,e,n){return t[0]=r[0]+e[0]*n,t[1]=r[1]+e[1]*n,t[2]=r[2]+e[2]*n,t},s.distance=function(t,r){var e=r[0]-t[0],n=r[1]-t[1],i=r[2]-t[2];return Math.sqrt(e*e+n*n+i*i)},s.dist=s.distance,s.squaredDistance=function(t,r){var e=r[0]-t[0],n=r[1]-t[1],i=r[2]-t[2];return e*e+n*n+i*i},s.sqrDist=s.squaredDistance,s.length=function(t){var r=t[0],e=t[1],n=t[2];return Math.sqrt(r*r+e*e+n*n)},s.len=s.length,s.squaredLength=function(t){var r=t[0],e=t[1],n=t[2];return r*r+e*e+n*n},s.sqrLen=s.squaredLength,s.negate=function(t,r){return t[0]=-r[0],t[1]=-r[1],t[2]=-r[2],t},s.normalize=function(t,r){var e=r[0],n=r[1],i=r[2],o=e*e+n*n+i*i;
return o>0&&(o=1/Math.sqrt(o),t[0]=r[0]*o,t[1]=r[1]*o,t[2]=r[2]*o),t},s.dot=function(t,r){return t[0]*r[0]+t[1]*r[1]+t[2]*r[2]},s.cross=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=e[0],s=e[1],u=e[2];return t[0]=i*u-o*s,t[1]=o*a-n*u,t[2]=n*s-i*a,t},s.lerp=function(t,r,e,n){var i=r[0],o=r[1],a=r[2];return t[0]=i+n*(e[0]-i),t[1]=o+n*(e[1]-o),t[2]=a+n*(e[2]-a),t},s.random=function(t,r){r=r||1;var e=2*n()*Math.PI,i=2*n()-1,o=Math.sqrt(1-i*i)*r;return t[0]=Math.cos(e)*o,t[1]=Math.sin(e)*o,t[2]=i*r,t},s.transformMat4=function(t,r,e){var n=r[0],i=r[1],o=r[2];return t[0]=e[0]*n+e[4]*i+e[8]*o+e[12],t[1]=e[1]*n+e[5]*i+e[9]*o+e[13],t[2]=e[2]*n+e[6]*i+e[10]*o+e[14],t},s.transformMat3=function(t,r,e){var n=r[0],i=r[1],o=r[2];return t[0]=n*e[0]+i*e[3]+o*e[6],t[1]=n*e[1]+i*e[4]+o*e[7],t[2]=n*e[2]+i*e[5]+o*e[8],t},s.transformQuat=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=e[0],s=e[1],u=e[2],c=e[3],l=c*n+s*o-u*i,f=c*i+u*n-a*o,h=c*o+a*i-s*n,p=-a*n-s*i-u*o;return t[0]=l*c+p*-a+f*-u-h*-s,t[1]=f*c+p*-s+h*-a-l*-u,t[2]=h*c+p*-u+l*-s-f*-a,t},s.rotateX=function(t,r,e,n){var i=[],o=[];return i[0]=r[0]-e[0],i[1]=r[1]-e[1],i[2]=r[2]-e[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),t[0]=o[0]+e[0],t[1]=o[1]+e[1],t[2]=o[2]+e[2],t},s.rotateY=function(t,r,e,n){var i=[],o=[];return i[0]=r[0]-e[0],i[1]=r[1]-e[1],i[2]=r[2]-e[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),t[0]=o[0]+e[0],t[1]=o[1]+e[1],t[2]=o[2]+e[2],t},s.rotateZ=function(t,r,e,n){var i=[],o=[];return i[0]=r[0]-e[0],i[1]=r[1]-e[1],i[2]=r[2]-e[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],t[0]=o[0]+e[0],t[1]=o[1]+e[1],t[2]=o[2]+e[2],t},s.forEach=function(){var t=s.create();return function(r,e,n,i,o,a){var s,u;for(e||(e=3),n||(n=0),u=i?Math.min(i*e+n,r.length):r.length,s=n;u>s;s+=e)t[0]=r[s],t[1]=r[s+1],t[2]=r[s+2],o(t,t,a),r[s]=t[0],r[s+1]=t[1],r[s+2]=t[2];return r}}(),s.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},t!==void 0&&(t.vec3=s);var u={};u.create=function(){var t=new e(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},u.clone=function(t){var r=new e(4);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r},u.fromValues=function(t,r,n,i){var o=new e(4);return o[0]=t,o[1]=r,o[2]=n,o[3]=i,o},u.copy=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t},u.set=function(t,r,e,n,i){return t[0]=r,t[1]=e,t[2]=n,t[3]=i,t},u.add=function(t,r,e){return t[0]=r[0]+e[0],t[1]=r[1]+e[1],t[2]=r[2]+e[2],t[3]=r[3]+e[3],t},u.subtract=function(t,r,e){return t[0]=r[0]-e[0],t[1]=r[1]-e[1],t[2]=r[2]-e[2],t[3]=r[3]-e[3],t},u.sub=u.subtract,u.multiply=function(t,r,e){return t[0]=r[0]*e[0],t[1]=r[1]*e[1],t[2]=r[2]*e[2],t[3]=r[3]*e[3],t},u.mul=u.multiply,u.divide=function(t,r,e){return t[0]=r[0]/e[0],t[1]=r[1]/e[1],t[2]=r[2]/e[2],t[3]=r[3]/e[3],t},u.div=u.divide,u.min=function(t,r,e){return t[0]=Math.min(r[0],e[0]),t[1]=Math.min(r[1],e[1]),t[2]=Math.min(r[2],e[2]),t[3]=Math.min(r[3],e[3]),t},u.max=function(t,r,e){return t[0]=Math.max(r[0],e[0]),t[1]=Math.max(r[1],e[1]),t[2]=Math.max(r[2],e[2]),t[3]=Math.max(r[3],e[3]),t},u.scale=function(t,r,e){return t[0]=r[0]*e,t[1]=r[1]*e,t[2]=r[2]*e,t[3]=r[3]*e,t},u.scaleAndAdd=function(t,r,e,n){return t[0]=r[0]+e[0]*n,t[1]=r[1]+e[1]*n,t[2]=r[2]+e[2]*n,t[3]=r[3]+e[3]*n,t},u.distance=function(t,r){var e=r[0]-t[0],n=r[1]-t[1],i=r[2]-t[2],o=r[3]-t[3];return Math.sqrt(e*e+n*n+i*i+o*o)},u.dist=u.distance,u.squaredDistance=function(t,r){var e=r[0]-t[0],n=r[1]-t[1],i=r[2]-t[2],o=r[3]-t[3];return e*e+n*n+i*i+o*o},u.sqrDist=u.squaredDistance,u.length=function(t){var r=t[0],e=t[1],n=t[2],i=t[3];return Math.sqrt(r*r+e*e+n*n+i*i)},u.len=u.length,u.squaredLength=function(t){var r=t[0],e=t[1],n=t[2],i=t[3];return r*r+e*e+n*n+i*i},u.sqrLen=u.squaredLength,u.negate=function(t,r){return t[0]=-r[0],t[1]=-r[1],t[2]=-r[2],t[3]=-r[3],t},u.normalize=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=e*e+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a),t[0]=r[0]*a,t[1]=r[1]*a,t[2]=r[2]*a,t[3]=r[3]*a),t},u.dot=function(t,r){return t[0]*r[0]+t[1]*r[1]+t[2]*r[2]+t[3]*r[3]},u.lerp=function(t,r,e,n){var i=r[0],o=r[1],a=r[2],s=r[3];return t[0]=i+n*(e[0]-i),t[1]=o+n*(e[1]-o),t[2]=a+n*(e[2]-a),t[3]=s+n*(e[3]-s),t},u.random=function(t,r){return r=r||1,t[0]=n(),t[1]=n(),t[2]=n(),t[3]=n(),u.normalize(t,t),u.scale(t,t,r),t},u.transformMat4=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3];return t[0]=e[0]*n+e[4]*i+e[8]*o+e[12]*a,t[1]=e[1]*n+e[5]*i+e[9]*o+e[13]*a,t[2]=e[2]*n+e[6]*i+e[10]*o+e[14]*a,t[3]=e[3]*n+e[7]*i+e[11]*o+e[15]*a,t},u.transformQuat=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=e[0],s=e[1],u=e[2],c=e[3],l=c*n+s*o-u*i,f=c*i+u*n-a*o,h=c*o+a*i-s*n,p=-a*n-s*i-u*o;return t[0]=l*c+p*-a+f*-u-h*-s,t[1]=f*c+p*-s+h*-a-l*-u,t[2]=h*c+p*-u+l*-s-f*-a,t},u.forEach=function(){var t=u.create();return function(r,e,n,i,o,a){var s,u;for(e||(e=4),n||(n=0),u=i?Math.min(i*e+n,r.length):r.length,s=n;u>s;s+=e)t[0]=r[s],t[1]=r[s+1],t[2]=r[s+2],t[3]=r[s+3],o(t,t,a),r[s]=t[0],r[s+1]=t[1],r[s+2]=t[2],r[s+3]=t[3];return r}}(),u.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},t!==void 0&&(t.vec4=u);var c={};c.create=function(){var t=new e(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},c.clone=function(t){var r=new e(4);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r},c.copy=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t},c.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},c.transpose=function(t,r){if(t===r){var e=r[1];t[1]=r[2],t[2]=e}else t[0]=r[0],t[1]=r[2],t[2]=r[1],t[3]=r[3];return t},c.invert=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=e*o-i*n;return a?(a=1/a,t[0]=o*a,t[1]=-n*a,t[2]=-i*a,t[3]=e*a,t):null},c.adjoint=function(t,r){var e=r[0];return t[0]=r[3],t[1]=-r[1],t[2]=-r[2],t[3]=e,t},c.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},c.multiply=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=e[0],u=e[1],c=e[2],l=e[3];return t[0]=n*s+o*u,t[1]=i*s+a*u,t[2]=n*c+o*l,t[3]=i*c+a*l,t},c.mul=c.multiply,c.rotate=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=Math.sin(e),u=Math.cos(e);return t[0]=n*u+o*s,t[1]=i*u+a*s,t[2]=n*-s+o*u,t[3]=i*-s+a*u,t},c.scale=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=e[0],u=e[1];return t[0]=n*s,t[1]=i*s,t[2]=o*u,t[3]=a*u,t},c.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},c.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))},c.LDU=function(t,r,e,n){return t[2]=n[2]/n[0],e[0]=n[0],e[1]=n[1],e[3]=n[3]-t[2]*e[1],[t,r,e]},t!==void 0&&(t.mat2=c);var l={};l.create=function(){var t=new e(6);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},l.clone=function(t){var r=new e(6);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r},l.copy=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t},l.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},l.invert=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],u=e*o-n*i;return u?(u=1/u,t[0]=o*u,t[1]=-n*u,t[2]=-i*u,t[3]=e*u,t[4]=(i*s-o*a)*u,t[5]=(n*a-e*s)*u,t):null},l.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},l.multiply=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=e[0],l=e[1],f=e[2],h=e[3],p=e[4],d=e[5];return t[0]=n*c+o*l,t[1]=i*c+a*l,t[2]=n*f+o*h,t[3]=i*f+a*h,t[4]=n*p+o*d+s,t[5]=i*p+a*d+u,t},l.mul=l.multiply,l.rotate=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=Math.sin(e),l=Math.cos(e);return t[0]=n*l+o*c,t[1]=i*l+a*c,t[2]=n*-c+o*l,t[3]=i*-c+a*l,t[4]=s,t[5]=u,t},l.scale=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=e[0],l=e[1];return t[0]=n*c,t[1]=i*c,t[2]=o*l,t[3]=a*l,t[4]=s,t[5]=u,t},l.translate=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=e[0],l=e[1];return t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=n*c+o*l+s,t[5]=i*c+a*l+u,t},l.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},l.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)},t!==void 0&&(t.mat2d=l);var f={};f.create=function(){var t=new e(9);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},f.fromMat4=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[4],t[4]=r[5],t[5]=r[6],t[6]=r[8],t[7]=r[9],t[8]=r[10],t},f.clone=function(t){var r=new e(9);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r},f.copy=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t},f.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},f.transpose=function(t,r){if(t===r){var e=r[1],n=r[2],i=r[5];t[1]=r[3],t[2]=r[6],t[3]=e,t[5]=r[7],t[6]=n,t[7]=i}else t[0]=r[0],t[1]=r[3],t[2]=r[6],t[3]=r[1],t[4]=r[4],t[5]=r[7],t[6]=r[2],t[7]=r[5],t[8]=r[8];return t},f.invert=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],u=r[6],c=r[7],l=r[8],f=l*a-s*c,h=-l*o+s*u,p=c*o-a*u,d=e*f+n*h+i*p;return d?(d=1/d,t[0]=f*d,t[1]=(-l*n+i*c)*d,t[2]=(s*n-i*a)*d,t[3]=h*d,t[4]=(l*e-i*u)*d,t[5]=(-s*e+i*o)*d,t[6]=p*d,t[7]=(-c*e+n*u)*d,t[8]=(a*e-n*o)*d,t):null},f.adjoint=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],u=r[6],c=r[7],l=r[8];return t[0]=a*l-s*c,t[1]=i*c-n*l,t[2]=n*s-i*a,t[3]=s*u-o*l,t[4]=e*l-i*u,t[5]=i*o-e*s,t[6]=o*c-a*u,t[7]=n*u-e*c,t[8]=e*a-n*o,t},f.determinant=function(t){var r=t[0],e=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],u=t[7],c=t[8];return r*(c*o-a*u)+e*(-c*i+a*s)+n*(u*i-o*s)},f.multiply=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=r[6],l=r[7],f=r[8],h=e[0],p=e[1],d=e[2],v=e[3],m=e[4],g=e[5],y=e[6],b=e[7],_=e[8];return t[0]=h*n+p*a+d*c,t[1]=h*i+p*s+d*l,t[2]=h*o+p*u+d*f,t[3]=v*n+m*a+g*c,t[4]=v*i+m*s+g*l,t[5]=v*o+m*u+g*f,t[6]=y*n+b*a+_*c,t[7]=y*i+b*s+_*l,t[8]=y*o+b*u+_*f,t},f.mul=f.multiply,f.translate=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=r[6],l=r[7],f=r[8],h=e[0],p=e[1];return t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=u,t[6]=h*n+p*a+c,t[7]=h*i+p*s+l,t[8]=h*o+p*u+f,t},f.rotate=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=r[6],l=r[7],f=r[8],h=Math.sin(e),p=Math.cos(e);return t[0]=p*n+h*a,t[1]=p*i+h*s,t[2]=p*o+h*u,t[3]=p*a-h*n,t[4]=p*s-h*i,t[5]=p*u-h*o,t[6]=c,t[7]=l,t[8]=f,t},f.scale=function(t,r,e){var n=e[0],i=e[1];return t[0]=n*r[0],t[1]=n*r[1],t[2]=n*r[2],t[3]=i*r[3],t[4]=i*r[4],t[5]=i*r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t},f.fromMat2d=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=0,t[3]=r[2],t[4]=r[3],t[5]=0,t[6]=r[4],t[7]=r[5],t[8]=1,t},f.fromQuat=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=e+e,s=n+n,u=i+i,c=e*a,l=n*a,f=n*s,h=i*a,p=i*s,d=i*u,v=o*a,m=o*s,g=o*u;return t[0]=1-f-d,t[3]=l-g,t[6]=h+m,t[1]=l+g,t[4]=1-c-d,t[7]=p-v,t[2]=h-m,t[5]=p+v,t[8]=1-c-f,t},f.normalFromMat4=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],u=r[6],c=r[7],l=r[8],f=r[9],h=r[10],p=r[11],d=r[12],v=r[13],m=r[14],g=r[15],y=e*s-n*a,b=e*u-i*a,_=e*c-o*a,w=n*u-i*s,M=n*c-o*s,A=i*c-o*u,E=l*v-f*d,x=l*m-h*d,j=l*g-p*d,k=f*m-h*v,L=f*g-p*v,I=h*g-p*m,q=y*I-b*L+_*k+w*j-M*x+A*E;return q?(q=1/q,t[0]=(s*I-u*L+c*k)*q,t[1]=(u*j-a*I-c*x)*q,t[2]=(a*L-s*j+c*E)*q,t[3]=(i*L-n*I-o*k)*q,t[4]=(e*I-i*j+o*x)*q,t[5]=(n*j-e*L-o*E)*q,t[6]=(v*A-m*M+g*w)*q,t[7]=(m*_-d*A-g*b)*q,t[8]=(d*M-v*_+g*y)*q,t):null},f.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},f.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))},t!==void 0&&(t.mat3=f);var h={};h.create=function(){var t=new e(16);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},h.clone=function(t){var r=new e(16);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},h.copy=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t},h.identity=function(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},h.transpose=function(t,r){if(t===r){var e=r[1],n=r[2],i=r[3],o=r[6],a=r[7],s=r[11];t[1]=r[4],t[2]=r[8],t[3]=r[12],t[4]=e,t[6]=r[9],t[7]=r[13],t[8]=n,t[9]=o,t[11]=r[14],t[12]=i,t[13]=a,t[14]=s}else t[0]=r[0],t[1]=r[4],t[2]=r[8],t[3]=r[12],t[4]=r[1],t[5]=r[5],t[6]=r[9],t[7]=r[13],t[8]=r[2],t[9]=r[6],t[10]=r[10],t[11]=r[14],t[12]=r[3],t[13]=r[7],t[14]=r[11],t[15]=r[15];return t},h.invert=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],u=r[6],c=r[7],l=r[8],f=r[9],h=r[10],p=r[11],d=r[12],v=r[13],m=r[14],g=r[15],y=e*s-n*a,b=e*u-i*a,_=e*c-o*a,w=n*u-i*s,M=n*c-o*s,A=i*c-o*u,E=l*v-f*d,x=l*m-h*d,j=l*g-p*d,k=f*m-h*v,L=f*g-p*v,I=h*g-p*m,q=y*I-b*L+_*k+w*j-M*x+A*E;return q?(q=1/q,t[0]=(s*I-u*L+c*k)*q,t[1]=(i*L-n*I-o*k)*q,t[2]=(v*A-m*M+g*w)*q,t[3]=(h*M-f*A-p*w)*q,t[4]=(u*j-a*I-c*x)*q,t[5]=(e*I-i*j+o*x)*q,t[6]=(m*_-d*A-g*b)*q,t[7]=(l*A-h*_+p*b)*q,t[8]=(a*L-s*j+c*E)*q,t[9]=(n*j-e*L-o*E)*q,t[10]=(d*M-v*_+g*y)*q,t[11]=(f*_-l*M-p*y)*q,t[12]=(s*x-a*k-u*E)*q,t[13]=(e*k-n*x+i*E)*q,t[14]=(v*b-d*w-m*y)*q,t[15]=(l*w-f*b+h*y)*q,t):null},h.adjoint=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],u=r[6],c=r[7],l=r[8],f=r[9],h=r[10],p=r[11],d=r[12],v=r[13],m=r[14],g=r[15];return t[0]=s*(h*g-p*m)-f*(u*g-c*m)+v*(u*p-c*h),t[1]=-(n*(h*g-p*m)-f*(i*g-o*m)+v*(i*p-o*h)),t[2]=n*(u*g-c*m)-s*(i*g-o*m)+v*(i*c-o*u),t[3]=-(n*(u*p-c*h)-s*(i*p-o*h)+f*(i*c-o*u)),t[4]=-(a*(h*g-p*m)-l*(u*g-c*m)+d*(u*p-c*h)),t[5]=e*(h*g-p*m)-l*(i*g-o*m)+d*(i*p-o*h),t[6]=-(e*(u*g-c*m)-a*(i*g-o*m)+d*(i*c-o*u)),t[7]=e*(u*p-c*h)-a*(i*p-o*h)+l*(i*c-o*u),t[8]=a*(f*g-p*v)-l*(s*g-c*v)+d*(s*p-c*f),t[9]=-(e*(f*g-p*v)-l*(n*g-o*v)+d*(n*p-o*f)),t[10]=e*(s*g-c*v)-a*(n*g-o*v)+d*(n*c-o*s),t[11]=-(e*(s*p-c*f)-a*(n*p-o*f)+l*(n*c-o*s)),t[12]=-(a*(f*m-h*v)-l*(s*m-u*v)+d*(s*h-u*f)),t[13]=e*(f*m-h*v)-l*(n*m-i*v)+d*(n*h-i*f),t[14]=-(e*(s*m-u*v)-a*(n*m-i*v)+d*(n*u-i*s)),t[15]=e*(s*h-u*f)-a*(n*h-i*f)+l*(n*u-i*s),t},h.determinant=function(t){var r=t[0],e=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],u=t[7],c=t[8],l=t[9],f=t[10],h=t[11],p=t[12],d=t[13],v=t[14],m=t[15],g=r*a-e*o,y=r*s-n*o,b=r*u-i*o,_=e*s-n*a,w=e*u-i*a,M=n*u-i*s,A=c*d-l*p,E=c*v-f*p,x=c*m-h*p,j=l*v-f*d,k=l*m-h*d,L=f*m-h*v;return g*L-y*k+b*j+_*x-w*E+M*A},h.multiply=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=r[6],l=r[7],f=r[8],h=r[9],p=r[10],d=r[11],v=r[12],m=r[13],g=r[14],y=r[15],b=e[0],_=e[1],w=e[2],M=e[3];return t[0]=b*n+_*s+w*f+M*v,t[1]=b*i+_*u+w*h+M*m,t[2]=b*o+_*c+w*p+M*g,t[3]=b*a+_*l+w*d+M*y,b=e[4],_=e[5],w=e[6],M=e[7],t[4]=b*n+_*s+w*f+M*v,t[5]=b*i+_*u+w*h+M*m,t[6]=b*o+_*c+w*p+M*g,t[7]=b*a+_*l+w*d+M*y,b=e[8],_=e[9],w=e[10],M=e[11],t[8]=b*n+_*s+w*f+M*v,t[9]=b*i+_*u+w*h+M*m,t[10]=b*o+_*c+w*p+M*g,t[11]=b*a+_*l+w*d+M*y,b=e[12],_=e[13],w=e[14],M=e[15],t[12]=b*n+_*s+w*f+M*v,t[13]=b*i+_*u+w*h+M*m,t[14]=b*o+_*c+w*p+M*g,t[15]=b*a+_*l+w*d+M*y,t},h.mul=h.multiply,h.translate=function(t,r,e){var n,i,o,a,s,u,c,l,f,h,p,d,v=e[0],m=e[1],g=e[2];return r===t?(t[12]=r[0]*v+r[4]*m+r[8]*g+r[12],t[13]=r[1]*v+r[5]*m+r[9]*g+r[13],t[14]=r[2]*v+r[6]*m+r[10]*g+r[14],t[15]=r[3]*v+r[7]*m+r[11]*g+r[15]):(n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=r[6],l=r[7],f=r[8],h=r[9],p=r[10],d=r[11],t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=u,t[6]=c,t[7]=l,t[8]=f,t[9]=h,t[10]=p,t[11]=d,t[12]=n*v+s*m+f*g+r[12],t[13]=i*v+u*m+h*g+r[13],t[14]=o*v+c*m+p*g+r[14],t[15]=a*v+l*m+d*g+r[15]),t},h.scale=function(t,r,e){var n=e[0],i=e[1],o=e[2];return t[0]=r[0]*n,t[1]=r[1]*n,t[2]=r[2]*n,t[3]=r[3]*n,t[4]=r[4]*i,t[5]=r[5]*i,t[6]=r[6]*i,t[7]=r[7]*i,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[10]*o,t[11]=r[11]*o,t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t},h.rotate=function(t,e,n,i){var o,a,s,u,c,l,f,h,p,d,v,m,g,y,b,_,w,M,A,E,x,j,k,L,I=i[0],q=i[1],S=i[2],F=Math.sqrt(I*I+q*q+S*S);return r>Math.abs(F)?null:(F=1/F,I*=F,q*=F,S*=F,o=Math.sin(n),a=Math.cos(n),s=1-a,u=e[0],c=e[1],l=e[2],f=e[3],h=e[4],p=e[5],d=e[6],v=e[7],m=e[8],g=e[9],y=e[10],b=e[11],_=I*I*s+a,w=q*I*s+S*o,M=S*I*s-q*o,A=I*q*s-S*o,E=q*q*s+a,x=S*q*s+I*o,j=I*S*s+q*o,k=q*S*s-I*o,L=S*S*s+a,t[0]=u*_+h*w+m*M,t[1]=c*_+p*w+g*M,t[2]=l*_+d*w+y*M,t[3]=f*_+v*w+b*M,t[4]=u*A+h*E+m*x,t[5]=c*A+p*E+g*x,t[6]=l*A+d*E+y*x,t[7]=f*A+v*E+b*x,t[8]=u*j+h*k+m*L,t[9]=c*j+p*k+g*L,t[10]=l*j+d*k+y*L,t[11]=f*j+v*k+b*L,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)},h.rotateX=function(t,r,e){var n=Math.sin(e),i=Math.cos(e),o=r[4],a=r[5],s=r[6],u=r[7],c=r[8],l=r[9],f=r[10],h=r[11];return r!==t&&(t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[4]=o*i+c*n,t[5]=a*i+l*n,t[6]=s*i+f*n,t[7]=u*i+h*n,t[8]=c*i-o*n,t[9]=l*i-a*n,t[10]=f*i-s*n,t[11]=h*i-u*n,t},h.rotateY=function(t,r,e){var n=Math.sin(e),i=Math.cos(e),o=r[0],a=r[1],s=r[2],u=r[3],c=r[8],l=r[9],f=r[10],h=r[11];return r!==t&&(t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[0]=o*i-c*n,t[1]=a*i-l*n,t[2]=s*i-f*n,t[3]=u*i-h*n,t[8]=o*n+c*i,t[9]=a*n+l*i,t[10]=s*n+f*i,t[11]=u*n+h*i,t},h.rotateZ=function(t,r,e){var n=Math.sin(e),i=Math.cos(e),o=r[0],a=r[1],s=r[2],u=r[3],c=r[4],l=r[5],f=r[6],h=r[7];return r!==t&&(t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[0]=o*i+c*n,t[1]=a*i+l*n,t[2]=s*i+f*n,t[3]=u*i+h*n,t[4]=c*i-o*n,t[5]=l*i-a*n,t[6]=f*i-s*n,t[7]=h*i-u*n,t},h.fromRotationTranslation=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=n+n,u=i+i,c=o+o,l=n*s,f=n*u,h=n*c,p=i*u,d=i*c,v=o*c,m=a*s,g=a*u,y=a*c;return t[0]=1-(p+v),t[1]=f+y,t[2]=h-g,t[3]=0,t[4]=f-y,t[5]=1-(l+v),t[6]=d+m,t[7]=0,t[8]=h+g,t[9]=d-m,t[10]=1-(l+p),t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t},h.fromQuat=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=e+e,s=n+n,u=i+i,c=e*a,l=n*a,f=n*s,h=i*a,p=i*s,d=i*u,v=o*a,m=o*s,g=o*u;return t[0]=1-f-d,t[1]=l+g,t[2]=h-m,t[3]=0,t[4]=l-g,t[5]=1-c-d,t[6]=p+v,t[7]=0,t[8]=h+m,t[9]=p-v,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},h.frustum=function(t,r,e,n,i,o,a){var s=1/(e-r),u=1/(i-n),c=1/(o-a);return t[0]=2*o*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*u,t[6]=0,t[7]=0,t[8]=(e+r)*s,t[9]=(i+n)*u,t[10]=(a+o)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*a*o*c,t[15]=0,t},h.perspective=function(t,r,e,n,i){var o=1/Math.tan(r/2),a=1/(n-i);return t[0]=o/e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*a,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*a,t[15]=0,t},h.ortho=function(t,r,e,n,i,o,a){var s=1/(r-e),u=1/(n-i),c=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(r+e)*s,t[13]=(i+n)*u,t[14]=(a+o)*c,t[15]=1,t},h.lookAt=function(t,e,n,i){var o,a,s,u,c,l,f,p,d,v,m=e[0],g=e[1],y=e[2],b=i[0],_=i[1],w=i[2],M=n[0],A=n[1],E=n[2];return r>Math.abs(m-M)&&r>Math.abs(g-A)&&r>Math.abs(y-E)?h.identity(t):(f=m-M,p=g-A,d=y-E,v=1/Math.sqrt(f*f+p*p+d*d),f*=v,p*=v,d*=v,o=_*d-w*p,a=w*f-b*d,s=b*p-_*f,v=Math.sqrt(o*o+a*a+s*s),v?(v=1/v,o*=v,a*=v,s*=v):(o=0,a=0,s=0),u=p*s-d*a,c=d*o-f*s,l=f*a-p*o,v=Math.sqrt(u*u+c*c+l*l),v?(v=1/v,u*=v,c*=v,l*=v):(u=0,c=0,l=0),t[0]=o,t[1]=u,t[2]=f,t[3]=0,t[4]=a,t[5]=c,t[6]=p,t[7]=0,t[8]=s,t[9]=l,t[10]=d,t[11]=0,t[12]=-(o*m+a*g+s*y),t[13]=-(u*m+c*g+l*y),t[14]=-(f*m+p*g+d*y),t[15]=1,t)},h.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]+")"},h.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[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))},t!==void 0&&(t.mat4=h);var p={};p.create=function(){var t=new e(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},p.rotationTo=function(){var t=s.create(),r=s.fromValues(1,0,0),e=s.fromValues(0,1,0);return function(n,i,o){var a=s.dot(i,o);return-.999999>a?(s.cross(t,r,i),1e-6>s.length(t)&&s.cross(t,e,i),s.normalize(t,t),p.setAxisAngle(n,t,Math.PI),n):a>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(s.cross(t,i,o),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+a,p.normalize(n,n))}}(),p.setAxes=function(){var t=f.create();return function(r,e,n,i){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-e[0],t[5]=-e[1],t[8]=-e[2],p.normalize(r,p.fromMat3(r,t))}}(),p.clone=u.clone,p.fromValues=u.fromValues,p.copy=u.copy,p.set=u.set,p.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},p.setAxisAngle=function(t,r,e){e=.5*e;var n=Math.sin(e);return t[0]=n*r[0],t[1]=n*r[1],t[2]=n*r[2],t[3]=Math.cos(e),t},p.add=u.add,p.multiply=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=e[0],u=e[1],c=e[2],l=e[3];return t[0]=n*l+a*s+i*c-o*u,t[1]=i*l+a*u+o*s-n*c,t[2]=o*l+a*c+n*u-i*s,t[3]=a*l-n*s-i*u-o*c,t},p.mul=p.multiply,p.scale=u.scale,p.rotateX=function(t,r,e){e*=.5;var n=r[0],i=r[1],o=r[2],a=r[3],s=Math.sin(e),u=Math.cos(e);return t[0]=n*u+a*s,t[1]=i*u+o*s,t[2]=o*u-i*s,t[3]=a*u-n*s,t},p.rotateY=function(t,r,e){e*=.5;var n=r[0],i=r[1],o=r[2],a=r[3],s=Math.sin(e),u=Math.cos(e);return t[0]=n*u-o*s,t[1]=i*u+a*s,t[2]=o*u+n*s,t[3]=a*u-i*s,t},p.rotateZ=function(t,r,e){e*=.5;var n=r[0],i=r[1],o=r[2],a=r[3],s=Math.sin(e),u=Math.cos(e);return t[0]=n*u+i*s,t[1]=i*u-n*s,t[2]=o*u+a*s,t[3]=a*u-o*s,t},p.calculateW=function(t,r){var e=r[0],n=r[1],i=r[2];return t[0]=e,t[1]=n,t[2]=i,t[3]=-Math.sqrt(Math.abs(1-e*e-n*n-i*i)),t},p.dot=u.dot,p.lerp=u.lerp,p.slerp=function(t,r,e,n){var i,o,a,s,u,c=r[0],l=r[1],f=r[2],h=r[3],p=e[0],d=e[1],v=e[2],m=e[3];return o=c*p+l*d+f*v+h*m,0>o&&(o=-o,p=-p,d=-d,v=-v,m=-m),1-o>1e-6?(i=Math.acos(o),a=Math.sin(i),s=Math.sin((1-n)*i)/a,u=Math.sin(n*i)/a):(s=1-n,u=n),t[0]=s*c+u*p,t[1]=s*l+u*d,t[2]=s*f+u*v,t[3]=s*h+u*m,t},p.invert=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=e*e+n*n+i*i+o*o,s=a?1/a:0;return t[0]=-e*s,t[1]=-n*s,t[2]=-i*s,t[3]=o*s,t},p.conjugate=function(t,r){return t[0]=-r[0],t[1]=-r[1],t[2]=-r[2],t[3]=r[3],t},p.length=u.length,p.len=p.length,p.squaredLength=u.squaredLength,p.sqrLen=p.squaredLength,p.normalize=u.normalize,p.fromMat3=function(t,r){var e,n=r[0]+r[4]+r[8];if(n>0)e=Math.sqrt(n+1),t[3]=.5*e,e=.5/e,t[0]=(r[7]-r[5])*e,t[1]=(r[2]-r[6])*e,t[2]=(r[3]-r[1])*e;else{var i=0;r[4]>r[0]&&(i=1),r[8]>r[3*i+i]&&(i=2);var o=(i+1)%3,a=(i+2)%3;e=Math.sqrt(r[3*i+i]-r[3*o+o]-r[3*a+a]+1),t[i]=.5*e,e=.5/e,t[3]=(r[3*a+o]-r[3*o+a])*e,t[o]=(r[3*o+i]+r[3*i+o])*e,t[a]=(r[3*a+i]+r[3*i+a])*e}return t},p.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},t!==void 0&&(t.quat=p)}(r.exports)})(this)},{}],4:[function(t,r){"use strict";function e(t,r,e){this.rotation=t,this.center=r,this.distance=e}function n(t,r){var e=r[0],n=r[1];r[2];var i=e*e+n*n;i>1&&(i=1),t[0]=-r[0],t[1]=r[1],t[2]=r[2]||Math.sqrt(1-i),t[3]=0}function i(t,r,n){t=t||[0,0,-1],r=r||[0,0,0],n=n||[0,1,0];var i=new e(c.create(),a.create(),1);return i.lookAt(t,r,n),i}var o=t("gl-matrix"),a=o.vec3,s=o.mat3,u=o.mat4,c=o.quat,l=new Float32Array(16),f=new Float32Array(16),h=e.prototype;h.view=function(t){return t||(t=u.create()),f[0]=f[1]=0,f[2]=-this.distance,u.fromRotationTranslation(t,c.conjugate(l,this.rotation),f),u.translate(t,t,a.negate(l,this.center)),t},h.lookAt=function(t,r,e){u.lookAt(l,t,r,e),s.fromMat4(l,l),c.fromMat3(this.rotation,l),a.copy(this.center,r),this.distance=a.distance(t,r)},h.pan=function(t){var r=this.distance;l[0]=-r*(t[0]||0),l[1]=r*(t[1]||0),l[2]=r*(t[2]||0),a.transformQuat(l,l,this.rotation),a.add(this.center,this.center,l)},h.zoom=function(t){this.distance+=t,0>this.distance&&(this.distance=0)},h.rotate=function(t,r){n(l,t),n(f,r),c.invert(f,f),c.multiply(l,l,f),1e-6>c.length(l)||(c.multiply(this.rotation,this.rotation,l),c.normalize(this.rotation,this.rotation))},r.exports=i},{"gl-matrix":3}]},{},[]),require=function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);throw Error("Cannot find module '"+a+"'")}var c=r[a]={exports:{}};t[a][0].call(c.exports,function(r){var e=t[a][1][r];return i(e?e:r)},c,c.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;n.length>a;a++)i(n[a]);return i}({1:[function(t,r,e){function n(t,r,e){if(!(this instanceof n))return new n(t,r,e);var i=typeof t;if("base64"===r&&"string"===i)for(t=j(t);0!==t.length%4;)t+="=";var o;if("number"===i)o=I(t);else if("string"===i)o=n.byteLength(t,r);else{if("object"!==i)throw Error("First argument needs to be a number, array or string.");o=I(t.length)}var a;n._useTypedArrays?a=k(new Uint8Array(o)):(a=this,a.length=o,a._isBuffer=!0);var s;if(n._useTypedArrays&&"function"==typeof Uint8Array&&t instanceof Uint8Array)a._set(t);else if(S(t))for(s=0;o>s;s++)a[s]=n.isBuffer(t)?t.readUInt8(s):t[s];else if("string"===i)a.write(t,0,r);else if("number"===i&&!n._useTypedArrays&&!e)for(s=0;o>s;s++)a[s]=0;return a}function i(t,r,e,i){e=Number(e)||0;var o=t.length-e;i?(i=Number(i),i>o&&(i=o)):i=o;var a=r.length;R(0===a%2,"Invalid hex string"),i>a/2&&(i=a/2);for(var s=0;i>s;s++){var u=parseInt(r.substr(2*s,2),16);R(!isNaN(u),"Invalid hex string"),t[e+s]=u}return n._charsWritten=2*s,s}function o(t,r,e,i){var o=n._charsWritten=C(T(r),t,e,i);return o}function a(t,r,e,i){var o=n._charsWritten=C(O(r),t,e,i);return o}function s(t,r,e,n){return a(t,r,e,n)}function u(t,r,e,i){var o=n._charsWritten=C(V(r),t,e,i);return o}function c(t,r,e){return 0===r&&e===t.length?B.fromByteArray(t):B.fromByteArray(t.slice(r,e))}function l(t,r,e){var n="",i="";e=Math.min(t.length,e);for(var o=r;e>o;o++)127>=t[o]?(n+=N(i)+String.fromCharCode(t[o]),i=""):i+="%"+t[o].toString(16);return n+N(i)}function f(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;e>i;i++)n+=String.fromCharCode(t[i]);return n}function h(t,r,e){return f(t,r,e)}function p(t,r,e){var n=t.length;(!r||0>r)&&(r=0),(!e||0>e||e>n)&&(e=n);for(var i="",o=r;e>o;o++)i+=F(t[o]);return i}function d(t,r,e,n){n||(R("boolean"==typeof e,"missing or invalid endian"),R(void 0!==r&&null!==r,"missing offset"),R(t.length>r+1,"Trying to read beyond buffer length"));var i=t.length;if(!(r>=i)){var o;return e?(o=t[r],i>r+1&&(o|=t[r+1]<<8)):(o=t[r]<<8,i>r+1&&(o|=t[r+1])),o}}function v(t,r,e,n){n||(R("boolean"==typeof e,"missing or invalid endian"),R(void 0!==r&&null!==r,"missing offset"),R(t.length>r+3,"Trying to read beyond buffer length"));var i=t.length;if(!(r>=i)){var o;return e?(i>r+2&&(o=t[r+2]<<16),i>r+1&&(o|=t[r+1]<<8),o|=t[r],i>r+3&&(o+=t[r+3]<<24>>>0)):(i>r+1&&(o=t[r+1]<<16),i>r+2&&(o|=t[r+2]<<8),i>r+3&&(o|=t[r+3]),o+=t[r]<<24>>>0),o}}function m(t,r,e,n){n||(R("boolean"==typeof e,"missing or invalid endian"),R(void 0!==r&&null!==r,"missing offset"),R(t.length>r+1,"Trying to read beyond buffer length"));var i=t.length;if(!(r>=i)){var o=d(t,r,e,!0),a=32768&o;return a?-1*(65535-o+1):o}}function g(t,r,e,n){n||(R("boolean"==typeof e,"missing or invalid endian"),R(void 0!==r&&null!==r,"missing offset"),R(t.length>r+3,"Trying to read beyond buffer length"));var i=t.length;if(!(r>=i)){var o=v(t,r,e,!0),a=2147483648&o;return a?-1*(4294967295-o+1):o}}function y(t,r,e,n){return n||(R("boolean"==typeof e,"missing or invalid endian"),R(t.length>r+3,"Trying to read beyond buffer length")),z.read(t,r,e,23,4)}function b(t,r,e,n){return n||(R("boolean"==typeof e,"missing or invalid endian"),R(t.length>r+7,"Trying to read beyond buffer length")),z.read(t,r,e,52,8)}function _(t,r,e,n,i){i||(R(void 0!==r&&null!==r,"missing value"),R("boolean"==typeof n,"missing or invalid endian"),R(void 0!==e&&null!==e,"missing offset"),R(t.length>e+1,"trying to write beyond buffer length"),P(r,65535));var o=t.length;if(!(e>=o))for(var a=0,s=Math.min(o-e,2);s>a;a++)t[e+a]=(r&255<<8*(n?a:1-a))>>>8*(n?a:1-a)}function w(t,r,e,n,i){i||(R(void 0!==r&&null!==r,"missing value"),R("boolean"==typeof n,"missing or invalid endian"),R(void 0!==e&&null!==e,"missing offset"),R(t.length>e+3,"trying to write beyond buffer length"),P(r,4294967295));var o=t.length;if(!(e>=o))for(var a=0,s=Math.min(o-e,4);s>a;a++)t[e+a]=255&r>>>8*(n?a:3-a)}function M(t,r,e,n,i){i||(R(void 0!==r&&null!==r,"missing value"),R("boolean"==typeof n,"missing or invalid endian"),R(void 0!==e&&null!==e,"missing offset"),R(t.length>e+1,"Trying to write beyond buffer length"),U(r,32767,-32768));var o=t.length;e>=o||(r>=0?_(t,r,e,n,i):_(t,65535+r+1,e,n,i))}function A(t,r,e,n,i){i||(R(void 0!==r&&null!==r,"missing value"),R("boolean"==typeof n,"missing or invalid endian"),R(void 0!==e&&null!==e,"missing offset"),R(t.length>e+3,"Trying to write beyond buffer length"),U(r,2147483647,-2147483648));var o=t.length;e>=o||(r>=0?w(t,r,e,n,i):w(t,4294967295+r+1,e,n,i))}function E(t,r,e,n,i){i||(R(void 0!==r&&null!==r,"missing value"),R("boolean"==typeof n,"missing or invalid endian"),R(void 0!==e&&null!==e,"missing offset"),R(t.length>e+3,"Trying to write beyond buffer length"),D(r,3.4028234663852886e38,-3.4028234663852886e38));var o=t.length;e>=o||z.write(t,r,e,n,23,4)}function x(t,r,e,n,i){i||(R(void 0!==r&&null!==r,"missing value"),R("boolean"==typeof n,"missing or invalid endian"),R(void 0!==e&&null!==e,"missing offset"),R(t.length>e+7,"Trying to write beyond buffer length"),D(r,1.7976931348623157e308,-1.7976931348623157e308));var o=t.length;e>=o||z.write(t,r,e,n,52,8)}function j(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function k(t){return t._isBuffer=!0,t._get=t.get,t._set=t.set,t.get=Y.get,t.set=Y.set,t.write=Y.write,t.toString=Y.toString,t.toLocaleString=Y.toString,t.toJSON=Y.toJSON,t.copy=Y.copy,t.slice=Y.slice,t.readUInt8=Y.readUInt8,t.readUInt16LE=Y.readUInt16LE,t.readUInt16BE=Y.readUInt16BE,t.readUInt32LE=Y.readUInt32LE,t.readUInt32BE=Y.readUInt32BE,t.readInt8=Y.readInt8,t.readInt16LE=Y.readInt16LE,t.readInt16BE=Y.readInt16BE,t.readInt32LE=Y.readInt32LE,t.readInt32BE=Y.readInt32BE,t.readFloatLE=Y.readFloatLE,t.readFloatBE=Y.readFloatBE,t.readDoubleLE=Y.readDoubleLE,t.readDoubleBE=Y.readDoubleBE,t.writeUInt8=Y.writeUInt8,t.writeUInt16LE=Y.writeUInt16LE,t.writeUInt16BE=Y.writeUInt16BE,t.writeUInt32LE=Y.writeUInt32LE,t.writeUInt32BE=Y.writeUInt32BE,t.writeInt8=Y.writeInt8,t.writeInt16LE=Y.writeInt16LE,t.writeInt16BE=Y.writeInt16BE,t.writeInt32LE=Y.writeInt32LE,t.writeInt32BE=Y.writeInt32BE,t.writeFloatLE=Y.writeFloatLE,t.writeFloatBE=Y.writeFloatBE,t.writeDoubleLE=Y.writeDoubleLE,t.writeDoubleBE=Y.writeDoubleBE,t.fill=Y.fill,t.inspect=Y.inspect,t.toArrayBuffer=Y.toArrayBuffer,t}function L(t,r,e){return"number"!=typeof t?e:(t=~~t,t>=r?r:t>=0?t:(t+=r,t>=0?t:0))}function I(t){return t=~~Math.ceil(+t),0>t?0:t}function q(t){return(Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)})(t)}function S(t){return q(t)||n.isBuffer(t)||t&&"object"==typeof t&&"number"==typeof t.length}function F(t){return 16>t?"0"+t.toString(16):t.toString(16)}function T(t){for(var r=[],e=0;t.length>e;e++){var n=t.charCodeAt(e);if(127>=n)r.push(t.charCodeAt(e));else{var i=e;n>=55296&&57343>=n&&e++;for(var o=encodeURIComponent(t.slice(i,e+1)).substr(1).split("%"),a=0;o.length>a;a++)r.push(parseInt(o[a],16))}}return r}function O(t){for(var r=[],e=0;t.length>e;e++)r.push(255&t.charCodeAt(e));return r}function V(t){return B.toByteArray(t)}function C(t,r,e,n){for(var i=0;n>i&&!(i+e>=r.length||i>=t.length);i++)r[i+e]=t[i];return i}function N(t){try{return decodeURIComponent(t)}catch(r){return String.fromCharCode(65533)}}function P(t,r){R("number"==typeof t,"cannot write a non-number as a number"),R(t>=0,"specified a negative value for writing an unsigned value"),R(r>=t,"value is larger than maximum value for type"),R(Math.floor(t)===t,"value has a fractional component")}function U(t,r,e){R("number"==typeof t,"cannot write a non-number as a number"),R(r>=t,"value larger than maximum allowed value"),R(t>=e,"value smaller than minimum allowed value"),R(Math.floor(t)===t,"value has a fractional component")
}function D(t,r,e){R("number"==typeof t,"cannot write a non-number as a number"),R(r>=t,"value larger than maximum allowed value"),R(t>=e,"value smaller than minimum allowed value")}function R(t,r){if(!t)throw Error(r||"Failed assertion")}var B=t("base64-js"),z=t("ieee754");e.Buffer=n,e.SlowBuffer=n,e.INSPECT_MAX_BYTES=50,n.poolSize=8192,n._useTypedArrays=function(){if("undefined"==typeof Uint8Array||"undefined"==typeof ArrayBuffer)return!1;try{var t=new Uint8Array(0);return t.foo=function(){return 42},42===t.foo()&&"function"==typeof t.subarray}catch(r){return!1}}(),n.isEncoding=function(t){switch((t+"").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}},n.isBuffer=function(t){return!(null===t||void 0===t||!t._isBuffer)},n.byteLength=function(t,r){var e;switch(t+="",r||"utf8"){case"hex":e=t.length/2;break;case"utf8":case"utf-8":e=T(t).length;break;case"ascii":case"binary":case"raw":e=t.length;break;case"base64":e=V(t).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":e=2*t.length;break;default:throw Error("Unknown encoding")}return e},n.concat=function(t,r){if(R(q(t),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."),0===t.length)return new n(0);if(1===t.length)return t[0];var e;if("number"!=typeof r)for(r=0,e=0;t.length>e;e++)r+=t[e].length;var i=new n(r),o=0;for(e=0;t.length>e;e++){var a=t[e];a.copy(i,o),o+=a.length}return i},n.prototype.write=function(t,r,e,n){if(isFinite(r))isFinite(e)||(n=e,e=void 0);else{var c=n;n=r,r=e,e=c}r=Number(r)||0;var l=this.length-r;switch(e?(e=Number(e),e>l&&(e=l)):e=l,n=((n||"utf8")+"").toLowerCase()){case"hex":return i(this,t,r,e);case"utf8":case"utf-8":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o(this,t,r,e);case"ascii":return a(this,t,r,e);case"binary":return s(this,t,r,e);case"base64":return u(this,t,r,e);default:throw Error("Unknown encoding")}},n.prototype.toString=function(t,r,e){var n=this;if(t=((t||"utf8")+"").toLowerCase(),r=Number(r)||0,e=void 0!==e?Number(e):e=n.length,e===r)return"";switch(t){case"hex":return p(n,r,e);case"utf8":case"utf-8":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return l(n,r,e);case"ascii":return f(n,r,e);case"binary":return h(n,r,e);case"base64":return c(n,r,e);default:throw Error("Unknown encoding")}},n.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},n.prototype.copy=function(t,r,e,n){var i=this;if(e||(e=0),n||0===n||(n=this.length),r||(r=0),n!==e&&0!==t.length&&0!==i.length){R(n>=e,"sourceEnd < sourceStart"),R(r>=0&&t.length>r,"targetStart out of bounds"),R(e>=0&&i.length>e,"sourceStart out of bounds"),R(n>=0&&i.length>=n,"sourceEnd out of bounds"),n>this.length&&(n=this.length),n-e>t.length-r&&(n=t.length-r+e);for(var o=0;n-e>o;o++)t[o+r]=this[o+e]}},n.prototype.slice=function(t,r){var e=this.length;if(t=L(t,e,0),r=L(r,e,e),n._useTypedArrays)return k(this.subarray(t,r));for(var i=r-t,o=new n(i,void 0,!0),a=0;i>a;a++)o[a]=this[a+t];return o},n.prototype.get=function(t){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(t)},n.prototype.set=function(t,r){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(t,r)},n.prototype.readUInt8=function(t,r){return r||(R(void 0!==t&&null!==t,"missing offset"),R(this.length>t,"Trying to read beyond buffer length")),t>=this.length?void 0:this[t]},n.prototype.readUInt16LE=function(t,r){return d(this,t,!0,r)},n.prototype.readUInt16BE=function(t,r){return d(this,t,!1,r)},n.prototype.readUInt32LE=function(t,r){return v(this,t,!0,r)},n.prototype.readUInt32BE=function(t,r){return v(this,t,!1,r)},n.prototype.readInt8=function(t,r){if(r||(R(void 0!==t&&null!==t,"missing offset"),R(this.length>t,"Trying to read beyond buffer length")),!(t>=this.length)){var e=128&this[t];return e?-1*(255-this[t]+1):this[t]}},n.prototype.readInt16LE=function(t,r){return m(this,t,!0,r)},n.prototype.readInt16BE=function(t,r){return m(this,t,!1,r)},n.prototype.readInt32LE=function(t,r){return g(this,t,!0,r)},n.prototype.readInt32BE=function(t,r){return g(this,t,!1,r)},n.prototype.readFloatLE=function(t,r){return y(this,t,!0,r)},n.prototype.readFloatBE=function(t,r){return y(this,t,!1,r)},n.prototype.readDoubleLE=function(t,r){return b(this,t,!0,r)},n.prototype.readDoubleBE=function(t,r){return b(this,t,!1,r)},n.prototype.writeUInt8=function(t,r,e){e||(R(void 0!==t&&null!==t,"missing value"),R(void 0!==r&&null!==r,"missing offset"),R(this.length>r,"trying to write beyond buffer length"),P(t,255)),r>=this.length||(this[r]=t)},n.prototype.writeUInt16LE=function(t,r,e){_(this,t,r,!0,e)},n.prototype.writeUInt16BE=function(t,r,e){_(this,t,r,!1,e)},n.prototype.writeUInt32LE=function(t,r,e){w(this,t,r,!0,e)},n.prototype.writeUInt32BE=function(t,r,e){w(this,t,r,!1,e)},n.prototype.writeInt8=function(t,r,e){e||(R(void 0!==t&&null!==t,"missing value"),R(void 0!==r&&null!==r,"missing offset"),R(this.length>r,"Trying to write beyond buffer length"),U(t,127,-128)),r>=this.length||(t>=0?this.writeUInt8(t,r,e):this.writeUInt8(255+t+1,r,e))},n.prototype.writeInt16LE=function(t,r,e){M(this,t,r,!0,e)},n.prototype.writeInt16BE=function(t,r,e){M(this,t,r,!1,e)},n.prototype.writeInt32LE=function(t,r,e){A(this,t,r,!0,e)},n.prototype.writeInt32BE=function(t,r,e){A(this,t,r,!1,e)},n.prototype.writeFloatLE=function(t,r,e){E(this,t,r,!0,e)},n.prototype.writeFloatBE=function(t,r,e){E(this,t,r,!1,e)},n.prototype.writeDoubleLE=function(t,r,e){x(this,t,r,!0,e)},n.prototype.writeDoubleBE=function(t,r,e){x(this,t,r,!1,e)},n.prototype.fill=function(t,r,e){if(t||(t=0),r||(r=0),e||(e=this.length),"string"==typeof t&&(t=t.charCodeAt(0)),R("number"==typeof t&&!isNaN(t),"value is not a number"),R(e>=r,"end < start"),e!==r&&0!==this.length){R(r>=0&&this.length>r,"start out of bounds"),R(e>=0&&this.length>=e,"end out of bounds");for(var n=r;e>n;n++)this[n]=t}},n.prototype.inspect=function(){for(var t=[],r=this.length,n=0;r>n;n++)if(t[n]=F(this[n]),n===e.INSPECT_MAX_BYTES){t[n+1]="...";break}return"<Buffer "+t.join(" ")+">"},n.prototype.toArrayBuffer=function(){if("function"==typeof Uint8Array){if(n._useTypedArrays)return new n(this).buffer;for(var t=new Uint8Array(this.length),r=0,e=t.length;e>r;r+=1)t[r]=this[r];return t.buffer}throw Error("Buffer.toArrayBuffer not supported in this browser")};var Y=n.prototype},{"base64-js":2,ieee754:3}],2:[function(t,r){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(){"use strict";function t(t){var r=t.charCodeAt(0);return r===a?62:r===s?63:u>r?-1:u+10>r?r-u+26+26:l+26>r?r-l:c+26>r?r-c+26:void 0}function n(r){function e(t){c[f++]=t}var n,i,a,s,u,c;if(r.length%4>0)throw Error("Invalid string. Length must be a multiple of 4");var l=r.length;u="="===r.charAt(l-2)?2:"="===r.charAt(l-1)?1:0,c=new o(3*r.length/4-u),a=u>0?r.length-4:r.length;var f=0;for(n=0,i=0;a>n;n+=4,i+=3)s=t(r.charAt(n))<<18|t(r.charAt(n+1))<<12|t(r.charAt(n+2))<<6|t(r.charAt(n+3)),e((16711680&s)>>16),e((65280&s)>>8),e(255&s);return 2===u?(s=t(r.charAt(n))<<2|t(r.charAt(n+1))>>4,e(255&s)):1===u&&(s=t(r.charAt(n))<<10|t(r.charAt(n+1))<<4|t(r.charAt(n+2))>>2,e(255&s>>8),e(255&s)),c}function i(t){function r(t){return e.charAt(t)}function n(t){return r(63&t>>18)+r(63&t>>12)+r(63&t>>6)+r(63&t)}var i,o,a,s=t.length%3,u="";for(i=0,a=t.length-s;a>i;i+=3)o=(t[i]<<16)+(t[i+1]<<8)+t[i+2],u+=n(o);switch(s){case 1:o=t[t.length-1],u+=r(o>>2),u+=r(63&o<<4),u+="==";break;case 2:o=(t[t.length-2]<<8)+t[t.length-1],u+=r(o>>10),u+=r(63&o>>4),u+=r(63&o<<2),u+="="}return u}var o="undefined"!=typeof Uint8Array?Uint8Array:Array;"0".charCodeAt(0);var a="+".charCodeAt(0),s="/".charCodeAt(0),u="0".charCodeAt(0),c="a".charCodeAt(0),l="A".charCodeAt(0);r.exports.toByteArray=n,r.exports.fromByteArray=i})()},{}],3:[function(t,r,e){e.read=function(t,r,e,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,c=u>>1,l=-7,f=e?i-1:0,h=e?-1:1,p=t[r+f];for(f+=h,o=p&(1<<-l)-1,p>>=-l,l+=s;l>0;o=256*o+t[r+f],f+=h,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+t[r+f],f+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return a?0/0:1/0*(p?-1:1);a+=Math.pow(2,n),o-=c}return(p?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,r,e,n,i,o){var a,s,u,c=8*o-i-1,l=(1<<c)-1,f=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,v=0>r||0===r&&0>1/r?1:0;for(r=Math.abs(r),isNaN(r)||1/0===r?(s=isNaN(r)?1:0,a=l):(a=Math.floor(Math.log(r)/Math.LN2),1>r*(u=Math.pow(2,-a))&&(a--,u*=2),r+=a+f>=1?h/u:h*Math.pow(2,1-f),r*u>=2&&(a++,u/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(r*u-1)*Math.pow(2,i),a+=f):(s=r*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;t[e+p]=255&s,p+=d,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;t[e+p]=255&a,p+=d,a/=256,c-=8);t[e+p-d]|=128*v}},{}],pSwivp:[function(t,r){"use strict";function e(t,r,e,n,i,o,a,s,u,c,l,f){this.gl=t,this.trianglePositions=r,this.triangleColors=e,this.triangleNormals=n,this.triangleVAO=i,this.triangleCount=0,this.edgePositions=o,this.edgeColors=a,this.edgeVAO=s,this.edgeCount=0,this.pointPositions=u,this.pointColors=c,this.pointSizes=l,this.pointVAO=f,this.pointCount=0}function n(t){var r=h(t);return r.attributes.position.location=0,r.attributes.color.location=1,r.attributes.normal.location=2,r}function i(t){var r=p(t);return r.attributes.position.location=0,r.attributes.color.location=1,r}function o(t){var r=d(t);return r.attributes.position.location=0,r.attributes.color.location=1,r.attributes.pointSize.location=2,r}function a(t,r){t.__SIMPLICIAL_MESH_SHADER||(t.__SIMPLICIAL_MESH_SHADER=n(t)),t.__SIMPLICIAL_WIRE_SHADER||(t.__SIMPLICIAL_WIRE_SHADER=i(t)),t.__SIMPLICIAL_POINT_SHADER||(t.__SIMPLICIAL_POINT_SHADER=o(t));var a=s(t,[]),c=s(t,[]),l=s(t,[]),f=u(t,[{buffer:a,type:t.FLOAT,size:3},{buffer:c,type:t.FLOAT,size:3},{buffer:l,type:t.FLOAT,size:3}]),h=s(t,[]),p=s(t,[]),d=u(t,[{buffer:h,type:t.FLOAT,size:3},{buffer:p,type:t.FLOAT,size:3}]),v=s(t,[]),m=s(t,[]),g=s(t,[]),y=u(t,[{buffer:v,type:t.FLOAT,size:3},{buffer:m,type:t.FLOAT,size:3},{buffer:g,type:t.FLOAT,size:1}]),b=new e(t,a,c,l,f,h,p,d,v,m,g,y);return b.update(r),b}var s=t("gl-buffer"),u=t("gl-vao");t("glslify");var c=t("gl-matrix"),l=t("normals"),f=c.mat4,h=t("glslify/adapter.js")("\nattribute vec3 position;\nattribute vec3 color;\nattribute vec3 normal;\nuniform mat4 model;\nuniform mat4 modelInverseTranspose;\nuniform mat4 view;\nuniform vec3 eyePosition;\nuniform mat4 projection;\nvarying vec3 f_position;\nvarying vec3 f_color;\nvarying vec3 f_normal;\nvarying vec3 viewDirection;\nvoid main() {\n vec4 m_position = model * vec4(position, 1.0);\n vec4 t_position = view * m_position;\n gl_Position = projection * t_position;\n f_color = color;\n f_normal = normalize((modelInverseTranspose * vec4(normal, 0.0)).xyz);\n f_position = m_position.xyz / m_position.w;\n viewDirection = eyePosition - f_position;\n}","\nprecision highp float;\nuniform vec3 lightPosition;\nuniform vec3 ambient;\nuniform vec3 diffuse;\nuniform vec3 specular;\nuniform float specularExponent;\nvarying vec3 f_position;\nvarying vec3 f_color;\nvarying vec3 f_normal;\nvarying vec3 viewDirection;\nvoid main() {\n vec3 lightDirection = normalize(lightPosition - f_position);\n vec3 normal = normalize(f_normal);\n float diffuseIntensity = clamp(dot(normal, lightDirection), 0.0, 1.0);\n vec3 halfView = normalize(lightDirection + normalize(viewDirection));\n float specularIntensity = pow(clamp(dot(normal, halfView), 0.0, 1.0), specularExponent);\n gl_FragColor = vec4(f_color * (ambient + diffuse * diffuseIntensity) + specular * specularIntensity, 1.0);\n}",[{name:"model",type:"mat4"},{name:"modelInverseTranspose",type:"mat4"},{name:"view",type:"mat4"},{name:"eyePosition",type:"vec3"},{name:"projection",type:"mat4"},{name:"lightPosition",type:"vec3"},{name:"ambient",type:"vec3"},{name:"diffuse",type:"vec3"},{name:"specular",type:"vec3"},{name:"specularExponent",type:"float"}],[{name:"position",type:"vec3"},{name:"color",type:"vec3"},{name:"normal",type:"vec3"}]),p=t("glslify/adapter.js")("\nattribute vec3 position;\nattribute vec3 color;\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\nvarying vec3 f_color;\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_color = color;\n}","\nprecision highp float;\nvarying vec3 f_color;\nvoid main() {\n gl_FragColor = vec4(f_color, 1.0);\n}",[{name:"model",type:"mat4"},{name:"view",type:"mat4"},{name:"projection",type:"mat4"}],[{name:"position",type:"vec3"},{name:"color",type:"vec3"}]),d=t("glslify/adapter.js")("\nattribute vec3 position;\nattribute vec3 color;\nattribute float pointSize;\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\nvarying vec3 f_color;\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_color = color;\n gl_PointSize = pointSize;\n}","\nprecision highp float;\nvarying vec3 f_color;\nvoid main() {\n gl_FragColor = vec4(f_color, 1.0);\n}",[{name:"model",type:"mat4"},{name:"view",type:"mat4"},{name:"projection",type:"mat4"}],[{name:"position",type:"vec3"},{name:"color",type:"vec3"},{name:"pointSize",type:"float"}]),v=f.identity(f.create());e.prototype.update=function(t){t=t||{},this.gl;var r=t.cells,e=t.positions,n=[],i=[],o=[],a=[],s=[],u=[],c=[],f=[],h=t.vertexNormals,p=t.cellNormals;t.useCellNormals&&!p&&(p=l.facetNormals(r,e)),p||h||(h=l.vertexNormals(r,e));var d=t.vertexColors,v=t.cellColors,m=t.meshColor||[.7,.5,.2];if(3!==m.length)throw Error("bad mesh color");for(var g=t.pointSizes,y=t.pointSize||1,b=0,_=0,w=0,M=0;r.length>M;++M){var A=r[M],E=r[M].length;switch(E){case 1:++w,u.push.apply(u,e[A[0]]),d?c.push.apply(c,d[A[0]]):v?c.push.apply(c,v[M]):c.push.apply(c,m),g?f.push(g[A[0]]):f.push(y);break;case 2:++_;for(var x=0;2>x;++x){var j=A[x];a.push.apply(a,e[j]),d?s.push.apply(s,d[j]):v?s.push.apply(s,v[M]):s.push.apply(s,m)}break;case 3:++b;for(var x=0;3>x;++x){var j=A[x];n.push.apply(n,e[j]),d?i.push.apply(i,d[j]):v?i.push.apply(i,v[M]):i.push.apply(i,m),h?o.push.apply(o,h[j]):o.push.apply(o,p[M])}break;default:}}this.pointCount=w,this.edgeCount=_,this.triangleCount=b,this.pointPositions.update(u),this.pointColors.update(c),this.pointSizes.update(f),this.edgePositions.update(a),this.edgeColors.update(s),this.trianglePositions.update(n),this.triangleColors.update(i),this.triangleNormals.update(o)},e.prototype.draw=function(t){t=t||{};var r=this.gl,e=t.model||v,n=t.view||v,i=t.projection||v;if(this.triangleCount>0){var o=r.__SIMPLICIAL_MESH_SHADER;o.bind(),o.uniforms.model=e,o.uniforms.view=n,o.uniforms.projection=i;var a=f.invert(f.create(),n);o.uniforms.lightPosition=t.lightPosition||[0,100,0],o.uniforms.ambient=t.ambient||[.3,.3,.3],o.uniforms.diffuse=t.diffuse||[.5,.5,.5],o.uniforms.specular=t.specular||[1,1,1],o.uniforms.specularExponent=t.specularExponent||10,o.uniforms.eyePosition=[a[12],a[13],a[14]];var s=f.create();o.uniforms.modelInverseTranspose=f.transpose(s,f.invert(s,e)),this.triangleVAO.bind(),r.drawArrays(r.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}if(this.edgeCount>0){var o=r.__SIMPLICIAL_WIRE_SHADER;o.bind(),o.uniforms.model=e,o.uniforms.view=n,o.uniforms.projection=i,this.edgeVAO.bind(),r.drawArrays(r.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()}if(this.pointCount>0){var o=r.__SIMPLICIAL_POINT_SHADER;o.bind(),o.uniforms.model=e,o.uniforms.view=n,o.uniforms.projection=i,this.pointVAO.bind(),r.drawArrays(r.POINTS,0,this.pointCount),this.pointVAO.unbind()}},e.prototype.dispose=function(){this.triangleVAO.dispose(),this.edgeVAO.dispose(),this.pointVAO.dispose(),this.trianglePositions.dispose(),this.triangleColors.dispose(),this.triangleNormals.dispose(),this.edgePositions.dispose(),this.edgeColors.dispose(),this.pointPositions.dispose(),this.pointColors.dispose(),this.pointSizes.dispose()},r.exports=a},{"gl-buffer":6,"gl-matrix":17,"gl-vao":23,glslify:25,"glslify/adapter.js":24,normals:32}],"gl-simplicial-complex":[function(t,r){r.exports=t("pSwivp")},{}],6:[function(t,r){"use strict";function e(t,r,e,n,i){this.gl=t,this.type=r,this.handle=e,this.length=n,this.usage=i}function n(t,r,e,n,i,o){if(0>=o&&i.length>e)return t.bufferData(r,i,n),i.length;if(i.length+o>e)throw Error("gl-buffer: If resizing buffer, offset must be 0");return t.bufferSubData(r,o,i),e}function i(t,r){for(var e=a.malloc(t.length,r),n=t.length,i=0;n>i;++i)e[i]=t[i];return e}function o(t,r,n,i){void 0===n&&(n=r,r=t.ARRAY_BUFFER),i||(i=t.DYNAMIC_DRAW);var o=0,c=t.createBuffer();if(t.bindBuffer(r,c),"number"==typeof n)t.bufferData(r,n,i),o=n;else if(n instanceof Array)r===t.ELEMENT_ARRAY_BUFFER?t.bufferData(r,new Uint16Array(n),i):t.bufferData(r,new Float32Array(n),i),o=n.length;else if(n.length)t.bufferData(r,n,i),o=n.length;else{if(!n.shape)throw Error("gl-buffer: Invalid format for buffer data");var l=n.dtype;if(("float64"===l||"array"===l||"generic"===l)&&(l="float32"),r===t.ELEMENT_ARRAY_BUFFER&&(l="uint16"),1!==n.shape.length)throw Error("gl-buffer: Array shape must be 1D");var o=n.shape[0];if(l===n.type&&1===n.stride[0])t.bufferData(r,n.data.subarray(n.offset,n.offset+o),i);else{var f=a.malloc(n.shape[0],l),h=u(f);s.assign(h,n),t.bufferData(r,f,i),a.free(f)}}if(r!==t.ARRAY_BUFFER&&r!==t.ELEMENT_ARRAY_BUFFER)throw Error("gl-buffer: Invalid type for webgl buffer");if(i!==t.DYNAMIC_DRAW&&i!==t.STATIC_DRAW&&i!==t.STREAM_DRAW)throw Error("gl-buffer: Invalid usage for buffer");return new e(t,r,c,o,i)}var a=t("typedarray-pool"),s=t("ndarray-ops"),u=t("ndarray");e.prototype.bind=function(){this.gl.bindBuffer(this.type,this.handle)},e.prototype.dispose=function(){this.gl.deleteBuffer(this.handle)},e.prototype.update=function(t,r){if(r||(r=0),this.bind(),"number"==typeof t){if(r>0)throw Error("gl-buffer: Cannot specify offset when resizing buffer");this.gl.bufferData(this.type,t,this.usage),this.length=t}else if(t.shape){var e=t.dtype;if(("float64"===e||"array"===e||"generic"===e)&&(e="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER&&(e="uint16"),1!==t.shape.length)throw Error("gl-buffer: Array length must be 1");if(e===t.dtype&&1===t.stride[0])this.length=0===t.offset&&t.data.length===t.shape[0]?n(this.gl,this.type,this.length,this.usage,t.data,r):n(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),r);else{var o=a.malloc(t.shape[0],e),c=u(o);s.assign(c,t),this.length=n(this.gl,this.type,this.length,this.usage,o,r),a.free(o)}}else if(Array.isArray(t))if(this.type===this.gl.ELEMENT_ARRAY_BUFFER){var l=i(t,"uint16");this.length=n(this.gl,this.type,this.length,this.usage,l.subarray(0,t.length),r),a.freeUint16(l)}else{var l=i(t,"float32");this.length=n(this.gl,this.type,this.length,this.usage,l.subarray(0,t.length),r),a.freeFloat32(l)}else this.length=n(this.gl,this.type,this.length,this.usage,t,r)},e.prototype.draw=function(t,r,e){e=e||0;var n=this.gl;if(this.type===n.ARRAY_BUFFER)n.drawArrays(t,e,r);else{if(this.type!==n.ELEMENT_ARRAY_BUFFER)throw Error("Invalid type for WebGL buffer");this.bind(),n.drawElements(t,r,n.UNSIGNED_SHORT,e)}},r.exports=o},{ndarray:12,"ndarray-ops":7,"typedarray-pool":16}],7:[function(t,r,e){"use strict";function n(t){if(!t)return s;for(var r=0;t.args.length>r;++r){var e=t.args[r];t.args[r]=0===r?{name:e,lvalue:!0,rvalue:!!t.rvalue,count:t.count||1}:{name:e,lvalue:!1,rvalue:!0,count:1}}return t.thisVars||(t.thisVars=[]),t.localVars||(t.localVars=[]),t}function i(t){return a({args:t.args,pre:n(t.pre),body:n(t.body),post:n(t.proc),funcName:t.funcName})}function o(t){for(var r=[],e=0;t.args.length>e;++e)r.push("a"+e);var n=Function("P",["return function ",t.funcName,"_ndarrayops(",r.join(","),") {P(",r.join(","),");return a0}"].join(""));return n(i(t))}var a=t("cwise-compiler"),s={body:"",args:[],thisVars:[],localVars:[]},u={add:"+",sub:"-",mul:"*",div:"/",mod:"%",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"};(function(){for(var t in u){var r=u[t];e[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+r+"c"},funcName:t}),e[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a"+r+"=b"},rvalue:!0,funcName:t+"eq"}),e[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+r+"s"},funcName:t+"s"}),e[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a"+r+"=s"},rvalue:!0,funcName:t+"seq"})}})();var c={not:"!",bnot:"~",neg:"-",recip:"1.0/"};(function(){for(var t in c){var r=c[t];e[t]=o({args:["array","array"],body:{args:["a","b"],body:"a="+r+"b"},funcName:t}),e[t+"eq"]=o({args:["array"],body:{args:["a"],body:"a="+r+"a"},rvalue:!0,count:2,funcName:t+"eq"})}})();var l={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};(function(){for(var t in l){var r=l[t];e[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+r+"c"},funcName:t}),e[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+r+"s"},funcName:t+"s"}),e[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a=a"+r+"b"},rvalue:!0,count:2,funcName:t+"eq"}),e[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+r+"s"},rvalue:!0,count:2,funcName:t+"seq"})}})();var f=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];(function(){for(var t=0;f.length>t;++t){var r=f[t];e[r]=o({args:["array","array"],pre:{args:[],body:"this_f=Math."+r,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b)",thisVars:["this_f"]},funcName:r}),e[r+"eq"]=o({args:["array"],pre:{args:[],body:"this_f=Math."+r,thisVars:["this_f"]},body:{args:["a"],body:"a=this_f(a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:r+"eq"})}})();var h=["max","min","atan2","pow"];(function(){for(var t=0;h.length>t;++t){var r=h[t];e[r]=o({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+r,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:r}),e[r+"s"]=o({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+r,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:r+"s"}),e[r+"eq"]=o({args:["array","array"],pre:{args:[],body:"this_f=Math."+r,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:r+"eq"}),e[r+"seq"]=o({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+r,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:r+"seq"})}})();var p=["atan2","pow"];(function(){for(var t=0;p.length>t;++t){var r=p[t];e[r+"op"]=o({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+r,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:r+"op"}),e[r+"ops"]=o({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+r,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:r+"ops"}),e[r+"opeq"]=o({args:["array","array"],pre:{args:[],body:"this_f=Math."+r,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:r+"opeq"}),e[r+"opseq"]=o({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+r,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:r+"opseq"})}})(),e.any=a({args:["array"],pre:s,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"}),e.all=a({args:["array"],pre:s,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"}),e.sum=a({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"}),e.prod=a({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"}),e.norm2squared=a({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"}),e.norm2=a({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"}),e.norminf=a({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"}),e.norm1=a({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"}),e.sup=a({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:[]}}),e.inf=a({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:[]}}),e.argmin=a({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:[]}}),e.argmax=a({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:[]}}),e.random=o({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),e.assign=o({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),e.assigns=o({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),e.equals=a({args:["array","array"],pre:s,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":8}],8:[function(t,r){"use strict";function e(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.scalarArgs=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}function n(t){var r=new e;r.pre=t.pre,r.body=t.body,r.post=t.post;var n=t.args.slice(0);r.argTypes=n;for(var o=0;n.length>o;++o)switch(n[o]){case"array":if(r.arrayArgs.push(o),r.shimArgs.push("array"+o),r.pre.args.length>o&&r.pre.args[o].count>0)throw Error("cwise: pre() block may not reference array args");if(r.post.args.length>o&&r.post.args[o].count>0)throw Error("cwise: post() block may not reference array args");break;case"scalar":r.scalarArgs.push(o),r.shimArgs.push("scalar"+o);break;case"index":if(r.indexArgs.push(o),r.pre.args.length>o&&r.pre.args[o].count>0)throw Error("cwise: pre() block may not reference array index");if(r.body.args.length>o&&r.body.args[o].lvalue)throw Error("cwise: body() block may not write to array index");if(r.post.args.length>o&&r.post.args[o].count>0)throw Error("cwise: post() block may not reference array index");break;case"shape":if(r.shapeArgs.push(o),r.pre.args.length>o&&r.pre.args[o].lvalue)throw Error("cwise: pre() block may not write to array shape");if(r.body.args.length>o&&r.body.args[o].lvalue)throw Error("cwise: body() block may not write to array shape");if(r.post.args.length>o&&r.post.args[o].lvalue)throw Error("cwise: post() block may not write to array shape");break;default:throw Error("cwise: Unknown argument type "+n[o])}if(0>=r.arrayArgs.length)throw Error("cwise: No array arguments specified");if(r.pre.args.length>n.length)throw Error("cwise: Too many arguments in pre() block");if(r.body.args.length>n.length)throw Error("cwise: Too many arguments in body() block");if(r.post.args.length>n.length)throw Error("cwise: Too many arguments in post() block");return r.debug=!!t.printCode||!!t.debug,r.funcName=t.funcName||"cwise",r.blockSize=t.blockSize||64,i(r)}var i=t("./lib/thunk.js");r.exports=n},{"./lib/thunk.js":10}],9:[function(t,r){"use strict";function e(t,r,e){var n,i,o=t.length,a=r.arrayArgs.length,s=r.indexArgs.length>0,u=[],c=[],l=0,f=0;for(n=0;o>n;++n)c.push(["i",n,"=0"].join(""));for(i=0;a>i;++i)for(n=0;o>n;++n)f=l,l=t[n],0===n?c.push(["d",i,"s",n,"=t",i,"[",l,"]"].join("")):c.push(["d",i,"s",n,"=(t",i,"[",l,"]-s",f,"*t",i,"[",f,"])"].join(""));for(u.push("var "+c.join(",")),n=o-1;n>=0;--n)l=t[n],u.push(["for(i",n,"=0;i",n,"<s",l,";++i",n,"){"].join(""));for(u.push(e),n=0;o>n;++n){for(f=l,l=t[n],i=0;a>i;++i)u.push(["p",i,"+=d",i,"s",n].join(""));s&&(n>0&&u.push(["index[",f,"]-=s",f].join("")),u.push(["++index[",l,"]"].join(""))),u.push("}")}return u.join("\n")}function n(t,r,n,i){for(var o=r.length,a=n.arrayArgs.length,s=n.blockSize,u=n.indexArgs.length>0,c=[],l=0;a>l;++l)c.push(["var offset",l,"=p",l].join(""));for(var l=t;o>l;++l)c.push(["for(var j"+l+"=SS[",r[l],"]|0;j",l,">0;){"].join("")),c.push(["if(j",l,"<",s,"){"].join("")),c.push(["s",r[l],"=j",l].join("")),c.push(["j",l,"=0"].join("")),c.push(["}else{s",r[l],"=",s].join("")),c.push(["j",l,"-=",s,"}"].join("")),u&&c.push(["index[",r[l],"]=j",l].join(""));for(var l=0;a>l;++l){for(var f=["offset"+l],h=t;o>h;++h)f.push(["j",h,"*t",l,"[",r[h],"]"].join(""));c.push(["p",l,"=(",f.join("+"),")"].join(""))}c.push(e(r,n,i));for(var l=t;o>l;++l)c.push("}");return c.join("\n")}function i(t){for(var r=0,e=t[0].length;e>r;){for(var n=1;t.length>n;++n)if(t[n][r]!==t[0][r])return r;++r}return r}function o(t,r,e){for(var n=t.body,i=[],o=[],a=0;t.args.length>a;++a){var s=t.args[a];if(!(0>=s.count)){var u=RegExp(s.name,"g");switch(r.argTypes[a]){case"array":var c=r.arrayArgs.indexOf(a);1===s.count?"generic"===e[c]?s.lvalue?(i.push(["var l",c,"=a",c,".get(p",c,")"].join("")),n=n.replace(u,"l"+c),o.push(["a",c,".set(p",c,",l",c,")"].join(""))):n=n.replace(u,["a",c,".get(p",c,")"].join("")):n=n.replace(u,["a",c,"[p",c,"]"].join("")):"generic"===e[c]?(i.push(["var l",c,"=a",c,".get(p",c,")"].join("")),n=n.replace(u,"l"+c),s.lvalue&&o.push(["a",c,".set(p",c,",l",c,")"].join(""))):(i.push(["var l",c,"=a",c,"[p",c,"]"].join("")),n=n.replace(u,"l"+c),s.lvalue&&o.push(["a",c,"[p",c,"]=l",c].join("")));
break;case"scalar":n=n.replace(u,"Y"+r.scalarArgs.indexOf(a));break;case"index":n=n.replace(u,"index");break;case"shape":n=n.replace(u,"shape")}}}return[i.join("\n"),n,o.join("\n")].join("\n").trim()}function a(t){for(var r=Array(t.length),e=!0,n=0;t.length>n;++n){var i=t[n],o=i.match(/\d+/);o=o?o[0]:"",r[n]=0===i.charAt(0)?"u"+i.charAt(1)+o:i.charAt(0)+o,n>0&&(e=e&&r[n]===r[n-1])}return e?r[0]:r.join("")}function s(t,r){for(var s=0|r[1].length,c=Array(t.arrayArgs.length),l=Array(t.arrayArgs.length),f=["SS"],h=["'use strict'"],p=[],d=0;s>d;++d)p.push(["s",d,"=SS[",d,"]"].join(""));for(var v=0;t.arrayArgs.length>v;++v)f.push("a"+v),f.push("t"+v),f.push("p"+v),l[v]=r[2*v],c[v]=r[2*v+1];for(var v=0;t.scalarArgs.length>v;++v)f.push("Y"+v);if(t.shapeArgs.length>0&&p.push("shape=SS.slice(0)"),t.indexArgs.length>0){for(var m=Array(s),v=0;s>v;++v)m[v]="0";p.push(["index=[",m.join(","),"]"].join(""))}var g=u([].concat(t.pre.thisVars).concat(t.body.thisVars).concat(t.post.thisVars));p=p.concat(g),h.push("var "+p.join(","));for(var v=0;t.arrayArgs.length>v;++v)h.push("p"+v+"|=0");t.pre.body.length>3&&h.push(o(t.pre,t,l));var y=o(t.body,t,l),b=i(c);s>b?h.push(n(b,c[0],t,y)):h.push(e(c[0],t,y)),t.post.body.length>3&&h.push(o(t.post,t,l)),t.debug&&console.log("Generated cwise routine for ",r,":\n\n",h.join("\n"));var _=[t.funcName||"unnamed","_cwise_loop_",c[0].join("s"),"m",b,a(l)].join(""),w=Function(["function ",_,"(",f.join(","),"){",h.join("\n"),"} return ",_].join(""));return w()}var u=t("uniq");r.exports=s},{uniq:11}],10:[function(t,r){"use strict";function e(t){var r=["'use strict'","var CACHED={}"],e=[],i=t.funcName+"_cwise_thunk";r.push(["return function ",i,"(",t.shimArgs.join(","),"){"].join(""));for(var o=[],a=[],s=[["array",t.arrayArgs[0],".shape"].join("")],u=0;t.arrayArgs.length>u;++u){var c=t.arrayArgs[u];e.push(["t",c,"=array",c,".dtype,","r",c,"=array",c,".order"].join("")),o.push("t"+c),o.push("r"+c),a.push("t"+c),a.push("r"+c+".join()"),s.push("array"+c+".data"),s.push("array"+c+".stride"),s.push("array"+c+".offset|0")}for(var u=0;t.scalarArgs.length>u;++u)s.push("scalar"+t.scalarArgs[u]);e.push(["type=[",a.join(","),"].join()"].join("")),e.push("proc=CACHED[type]"),r.push("var "+e.join(",")),r.push(["if(!proc){","CACHED[type]=proc=compile([",o.join(","),"])}","return proc(",s.join(","),")}"].join("")),t.debug&&console.log("Generated thunk:",r.join("\n"));var l=Function("compile",r.join("\n"));return l(n.bind(void 0,t))}var n=t("./compile.js");r.exports=e},{"./compile.js":9}],11:[function(t,r){"use strict";function e(t,r){for(var e=1,n=t.length,i=t[0],o=t[0],a=1;n>a;++a)if(o=i,i=t[a],r(i,o)){if(a===e){e++;continue}t[e++]=i}return t.length=e,t}function n(t){for(var r=1,e=t.length,n=t[0],i=t[0],o=1;e>o;++o,i=n)if(i=n,n=t[o],n!==i){if(o===r){r++;continue}t[r++]=n}return t.length=r,t}function i(t,r,i){return 0===t.length?[]:r?(i||t.sort(r),e(t,r)):(i||t.sort(),n(t))}r.exports=i},{}],12:[function(t,r){(function(e){"use strict";function n(t,r){return t[0]-r[0]}function i(){var t,r=this.stride,e=Array(r.length);for(t=0;e.length>t;++t)e[t]=[Math.abs(r[t]),t];e.sort(n);var i=Array(e.length);for(t=0;i.length>t;++t)i[t]=e[t][1];return i}function o(t,r){var e=["View",r,"d",t].join("");0>r&&(e="View_Nil"+t);var n="generic"===t;if(-1===r){var o="function "+e+"(a){this.data=a;};var proto="+e+".prototype;proto.dtype='"+t+"';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 "+e+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+e+"(a){return new "+e+"(a);}",a=Function(o);return a()}if(0===r){var o="function "+e+"(a,d) {this.data = a;this.offset = d};var proto="+e+".prototype;proto.dtype='"+t+"';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 "+e+"_copy() {return new "+e+"(this.data,this.offset)};proto.pick=function "+e+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+e+"_get(){return "+(n?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+e+"_set(v){return "+(n?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+e+"(a,b,c,d){return new "+e+"(a,d)}",a=Function("TrivialArray",o);return a(l[t][0])}var o=["'use strict'"],s=u(r),f=s.map(function(t){return"i"+t}),h="this.offset+"+s.map(function(t){return["this._stride",t,"*i",t].join("")}).join("+");o.push("function "+e+"(a,"+s.map(function(t){return"b"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",d){this.data=a");for(var p=0;r>p;++p)o.push("this._shape"+p+"=b"+p+"|0");for(var p=0;r>p;++p)o.push("this._stride"+p+"=c"+p+"|0");o.push("this.offset=d|0}","var proto="+e+".prototype","proto.dtype='"+t+"'","proto.dimension="+r);var d="VStride"+r+"d"+t,v="VShape"+r+"d"+t,m={stride:d,shape:v};for(var g in m){var y=m[g];o.push("function "+y+"(v) {this._v=v} var aproto="+y+".prototype","aproto.length="+r);for(var b=[],p=0;r>p;++p)b.push(["this._v._",g,p].join(""));o.push("aproto.toJSON=function "+y+"_toJSON(){return ["+b.join(",")+"]}","aproto.valueOf=aproto.toString=function "+y+"_toString(){return ["+b.join(",")+"].join()}");for(var p=0;r>p;++p)o.push(["Object.defineProperty(aproto,",p,",{get:function(){return this._v._",g,p,"},set:function(v){return this._v._",g,p,"=v|0},enumerable:true})"].join(""));for(var p=0;c.length>p;++p)c[p]in Array.prototype&&o.push(["aproto.",c[p],"=Array.prototype.",c[p]].join(""));o.push(["Object.defineProperty(proto,'",g,"',{get:function ",y,"_get(){return new ",y,"(this)},set: function ",y,"_set(v){"].join(""));for(var p=0;r>p;++p)o.push(["this._",g,p,"=v[",p,"]|0"].join(""));o.push("return v}})")}o.push(["Object.defineProperty(proto,'size',{get:function ",e,"_size(){return ",s.map(function(t){return["this._shape",t].join("")}).join("*"),"}})"].join("")),1===r?o.push("proto.order=[0]"):(o.push("Object.defineProperty(proto,'order',{get:"),4>r?(o.push(["function ",e,"_order(){"].join("")),2===r?o.push("return (Math.abs(this._stride0)>Math.abs(this._stride1))?[1,0]:[0,1]}})"):3===r&&o.push("var s0=Math.abs(this._stride0),s1=Math.abs(this._stride1),s2=Math.abs(this._stride2);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];}}})")):o.push("ORDER})")),o.push(["proto.set=function ",e,"_set(",f.join(","),",v){"].join("")),n?o.push(["return this.data.set(",h,",v)}"].join("")):o.push(["return this.data[",h,"]=v}"].join("")),o.push(["proto.get=function ",e,"_get(",f.join(","),"){"].join("")),n?o.push(["return this.data.get(",h,")}"].join("")):o.push(["return this.data[",h,"]}"].join("")),o.push(["proto.index=function ",e,"_index(",f.join(),"){return ",h,"}"].join("")),o.push(["proto.hi=function ",e,"_hi(",f.join(","),"){return new ",e,"(this.data,",s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this._shape",t,":i",t,"|0"].join("")}).join(","),",",s.map(function(t){return"this._stride"+t}).join(","),",this.offset)}"].join(""));var _=s.map(function(t){return"a"+t+"=this._shape"+t}),w=s.map(function(t){return"c"+t+"=this._stride"+t});o.push(["proto.lo=function ",e,"_lo(",f.join(","),"){var b=this.offset,d=0,",_.join(","),",",w.join(",")].join(""));for(var p=0;r>p;++p)o.push(["if(typeof i",p,"==='number'&&i",p,">=0){d=i",p,"|0;b+=c",p,"*d;a",p,"-=d}"].join(""));o.push(["return new ",e,"(this.data,",s.map(function(t){return"a"+t}).join(","),",",s.map(function(t){return"c"+t}).join(","),",b)}"].join("")),o.push(["proto.step=function ",e,"_step(",f.join(","),"){var ",s.map(function(t){return"a"+t+"=this._shape"+t}).join(","),",",s.map(function(t){return"b"+t+"=this._stride"+t}).join(","),",c=this.offset,d=0,ceil=Math.ceil"].join(""));for(var p=0;r>p;++p)o.push(["if(typeof i",p,"==='number'){d=i",p,"|0;if(d<0){c+=b",p,"*(a",p,"-1);a",p,"=ceil(-a",p,"/d)}else{a",p,"=ceil(a",p,"/d)}b",p,"*=d}"].join(""));o.push(["return new ",e,"(this.data,",s.map(function(t){return"a"+t}).join(","),",",s.map(function(t){return"b"+t}).join(","),",c)}"].join(""));for(var M=Array(r),A=Array(r),p=0;r>p;++p)M[p]=["a[i",p,"]"].join(""),A[p]=["b[i",p,"]"].join("");o.push(["proto.transpose=function ",e,"_transpose(",f,"){",f.map(function(t,r){return t+"=("+t+"===undefined?"+r+":"+t+"|0)"}).join(";"),";var a=this.shape,b=this.stride;return new ",e,"(this.data,",M.join(","),",",A.join(","),",this.offset)}"].join("")),o.push(["proto.pick=function ",e,"_pick(",f,"){var a=[],b=[],c=this.offset"].join(""));for(var p=0;r>p;++p)o.push(["if(typeof i",p,"==='number'&&i",p,">=0){c=(c+this._stride",p,"*i",p,")|0}else{a.push(this._shape",p,");b.push(this._stride",p,")}"].join(""));o.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),o.push(["return function construct_",e,"(data,shape,stride,offset){return new ",e,"(data,",s.map(function(t){return"shape["+t+"]"}).join(","),",",s.map(function(t){return"stride["+t+"]"}).join(","),",offset)}"].join(""));var a=Function("CTOR_LIST","ORDER",o.join("\n"));return a(l[t],i)}function a(t){return t instanceof Float64Array?"float64":t instanceof Float32Array?"float32":t instanceof Int32Array?"int32":t instanceof Uint32Array?"uint32":t instanceof Uint8Array?"uint8":t instanceof Uint16Array?"uint16":t instanceof Int16Array?"int16":t instanceof Int8Array?"int8":t instanceof Uint8ClampedArray?"uint8_clamped":e!==void 0&&t instanceof e?"buffer":t instanceof Array?"array":"generic"}function s(t,r,e,n){if(void 0===t){var i=l.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===r&&(r=[t.length]);var s=r.length;if(void 0===e){e=Array(s);for(var u=s-1,c=1;u>=0;--u)e[u]=c,c*=r[u]}if(void 0===n){n=0;for(var u=0;s>u;++u)0>e[u]&&(n-=(r[u]-1)*e[u])}for(var f=a(t),h=l[f];s+1>=h.length;)h.push(o(f,h.length-1));var i=h[s+1];return i(t,r,e,n)}var u=t("iota-array"),c=["concat","join","slice","toString","indexOf","lastIndexOf","forEach","every","some","filter","map","reduce","reduceRight"],l={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};r.exports=s}).call(this,t("buffer").Buffer)},{buffer:1,"iota-array":13}],13:[function(t,r){"use strict";function e(t){for(var r=Array(t),e=0;t>e;++e)r[e]=e;return r}r.exports=e},{}],14:[function(t,r,e){"use strict";"use restrict";function n(t){var r=32;return t&=-t,t&&r--,65535&t&&(r-=16),16711935&t&&(r-=8),252645135&t&&(r-=4),858993459&t&&(r-=2),1431655765&t&&(r-=1),r}var i=32;e.INT_BITS=i,e.INT_MAX=2147483647,e.INT_MIN=-1<<i-1,e.sign=function(t){return(t>0)-(0>t)},e.abs=function(t){var r=t>>i-1;return(t^r)-r},e.min=function(t,r){return r^(t^r)&-(r>t)},e.max=function(t,r){return t^(t^r)&-(r>t)},e.isPow2=function(t){return!(t&t-1||!t)},e.log2=function(t){var r,e;return r=(t>65535)<<4,t>>>=r,e=(t>255)<<3,t>>>=e,r|=e,e=(t>15)<<2,t>>>=e,r|=e,e=(t>3)<<1,t>>>=e,r|=e,r|t>>1},e.log10=function(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},e.popCount=function(t){return t-=1431655765&t>>>1,t=(858993459&t)+(858993459&t>>>2),16843009*(252645135&t+(t>>>4))>>>24},e.countTrailingZeros=n,e.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1},e.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t-(t>>>1)},e.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,t&=15,1&27030>>>t};var o=Array(256);(function(t){for(var r=0;256>r;++r){var e=r,n=r,i=7;for(e>>>=1;e;e>>>=1)n<<=1,n|=1&e,--i;t[r]=255&n<<i}})(o),e.reverse=function(t){return o[255&t]<<24|o[255&t>>>8]<<16|o[255&t>>>16]<<8|o[255&t>>>24]},e.interleave2=function(t,r){return t&=65535,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),r&=65535,r=16711935&(r|r<<8),r=252645135&(r|r<<4),r=858993459&(r|r<<2),r=1431655765&(r|r<<1),t|r<<1},e.deinterleave2=function(t,r){return t=1431655765&t>>>r,t=858993459&(t|t>>>1),t=252645135&(t|t>>>2),t=16711935&(t|t>>>4),t=65535&(t|t>>>16),t<<16>>16},e.interleave3=function(t,r,e){return t&=1023,t=4278190335&(t|t<<16),t=251719695&(t|t<<8),t=3272356035&(t|t<<4),t=1227133513&(t|t<<2),r&=1023,r=4278190335&(r|r<<16),r=251719695&(r|r<<8),r=3272356035&(r|r<<4),r=1227133513&(r|r<<2),t|=r<<1,e&=1023,e=4278190335&(e|e<<16),e=251719695&(e|e<<8),e=3272356035&(e|e<<4),e=1227133513&(e|e<<2),t|e<<2},e.deinterleave3=function(t,r){return t=1227133513&t>>>r,t=3272356035&(t|t>>>2),t=251719695&(t|t>>>4),t=4278190335&(t|t>>>8),t=1023&(t|t>>>16),t<<22>>22},e.nextCombination=function(t){var r=t|t-1;return r+1|(~r&-~r)-1>>>n(t)+1}},{}],15:[function(t,r){"use strict";function e(t,r,n){var i=0|t[n];if(0>=i)return[];var o,a=Array(i);if(n===t.length-1)for(o=0;i>o;++o)a[o]=r;else for(o=0;i>o;++o)a[o]=e(t,r,n+1);return a}function n(t,r){var e,n;for(e=Array(t),n=0;t>n;++n)e[n]=r;return e}function i(t,r){switch(r===void 0&&(r=0),typeof t){case"number":if(t>0)return n(0|t,r);break;case"object":if("number"==typeof t.length)return e(t,r,0)}return[]}r.exports=i},{}],16:[function(t,r,e){(function(r){"use strict";var n=t("bit-twiddle"),i=t("dup");r.__TYPEDARRAY_POOL||(r.__TYPEDARRAY_POOL={UINT8:i([32,0]),UINT16:i([32,0]),UINT32:i([32,0]),INT8:i([32,0]),INT16:i([32,0]),INT32:i([32,0]),FLOAT:i([32,0]),DOUBLE:i([32,0]),DATA:i([32,0])});var o=r.__TYPEDARRAY_POOL,a=o.UINT8,s=o.UINT16,u=o.UINT32,c=o.INT8,l=o.INT16,f=o.INT32,h=o.FLOAT,p=o.DOUBLE,d=o.DATA;e.free=function(t){if(t instanceof ArrayBuffer){var r=0|t.byteLength,e=n.log2(r);d[e].push(t)}else{var r=0|t.length,e=n.log2(r);t instanceof Uint8Array?a[e].push(t):t instanceof Uint16Array?s[e].push(t):t instanceof Uint32Array?u[e].push(t):t instanceof Int8Array?c[e].push(t):t instanceof Int16Array?l[e].push(t):t instanceof Int32Array?f[e].push(t):t instanceof Float32Array?h[e].push(t):t instanceof Float64Array&&p[e].push(t)}},e.freeUint8=function(t){a[n.log2(t.length)].push(t)},e.freeUint16=function(t){s[n.log2(t.length)].push(t)},e.freeUint32=function(t){u[n.log2(t.length)].push(t)},e.freeInt8=function(t){c[n.log2(t.length)].push(t)},e.freeInt16=function(t){l[n.log2(t.length)].push(t)},e.freeInt32=function(t){f[n.log2(t.length)].push(t)},e.freeFloat32=e.freeFloat=function(t){h[n.log2(t.length)].push(t)},e.freeFloat64=e.freeDouble=function(t){p[n.log2(t.length)].push(t)},e.freeArrayBuffer=function(t){d[n.log2(t.length)].push(t)},e.malloc=function(t,r){t=n.nextPow2(t);var e=n.log2(t);if(void 0===r){var i=d[e];if(i.length>0){var o=i[i.length-1];return i.pop(),o}return new ArrayBuffer(t)}switch(r){case"uint8":var v=a[e];return v.length>0?v.pop():new Uint8Array(t);case"uint16":var m=s[e];return m.length>0?m.pop():new Uint16Array(t);case"uint32":var g=u[e];return g.length>0?g.pop():new Uint32Array(t);case"int8":var y=c[e];return y.length>0?y.pop():new Int8Array(t);case"int16":var b=l[e];return b.length>0?b.pop():new Int16Array(t);case"int32":var _=f[e];return _.length>0?_.pop():new Int32Array(t);case"float":case"float32":var w=h[e];return w.length>0?w.pop():new Float32Array(t);case"double":case"float64":var M=p[e];return M.length>0?M.pop():new Float64Array(t);default:return null}return null},e.mallocUint8=function(t){t=n.nextPow2(t);var r=n.log2(t),e=a[r];return e.length>0?e.pop():new Uint8Array(t)},e.mallocUint16=function(t){t=n.nextPow2(t);var r=n.log2(t),e=s[r];return e.length>0?e.pop():new Uint16Array(t)},e.mallocUint32=function(t){t=n.nextPow2(t);var r=n.log2(t),e=u[r];return e.length>0?e.pop():new Uint32Array(t)},e.mallocInt8=function(t){t=n.nextPow2(t);var r=n.log2(t),e=c[r];return e.length>0?e.pop():new Int8Array(t)},e.mallocInt16=function(t){t=n.nextPow2(t);var r=n.log2(t),e=l[r];return e.length>0?e.pop():new Int16Array(t)},e.mallocInt32=function(t){t=n.nextPow2(t);var r=n.log2(t),e=f[r];return e.length>0?e.pop():new Int32Array(t)},e.mallocFloat32=e.mallocFloat=function(t){t=n.nextPow2(t);var r=n.log2(t),e=h[r];return e.length>0?e.pop():new Float32Array(t)},e.mallocFloat64=e.mallocDouble=function(t){t=n.nextPow2(t);var r=n.log2(t),e=p[r];return e.length>0?e.pop():new Float64Array(t)},e.mallocArrayBuffer=function(t){t=n.nextPow2(t);var r=n.log2(t),e=d[r];return e.length>0?e.pop():new ArrayBuffer(t)},e.clearCache=function(){for(var t=0;32>t;++t)a[t].length=0,s[t].length=0,u[t].length=0,c[t].length=0,l[t].length=0,f[t].length=0,h[t].length=0,p[t].length=0,d[t].length=0}}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"bit-twiddle":14,dup:15}],17:[function(t,r,e){(function(){"use strict";var t={};e===void 0?"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.exports={},define(function(){return t.exports})):t.exports=window:t.exports=e,function(t){if(!r)var r=1e-6;if(!e)var e="undefined"!=typeof Float32Array?Float32Array:Array;var n={};n.setMatrixArrayType=function(t){e=t},t!==void 0&&(t.glMatrix=n);var i={};i.create=function(){var t=new e(2);return t[0]=0,t[1]=0,t},i.clone=function(t){var r=new e(2);return r[0]=t[0],r[1]=t[1],r},i.fromValues=function(t,r){var n=new e(2);return n[0]=t,n[1]=r,n},i.copy=function(t,r){return t[0]=r[0],t[1]=r[1],t},i.set=function(t,r,e){return t[0]=r,t[1]=e,t},i.add=function(t,r,e){return t[0]=r[0]+e[0],t[1]=r[1]+e[1],t},i.subtract=function(t,r,e){return t[0]=r[0]-e[0],t[1]=r[1]-e[1],t},i.sub=i.subtract,i.multiply=function(t,r,e){return t[0]=r[0]*e[0],t[1]=r[1]*e[1],t},i.mul=i.multiply,i.divide=function(t,r,e){return t[0]=r[0]/e[0],t[1]=r[1]/e[1],t},i.div=i.divide,i.min=function(t,r,e){return t[0]=Math.min(r[0],e[0]),t[1]=Math.min(r[1],e[1]),t},i.max=function(t,r,e){return t[0]=Math.max(r[0],e[0]),t[1]=Math.max(r[1],e[1]),t},i.scale=function(t,r,e){return t[0]=r[0]*e,t[1]=r[1]*e,t},i.distance=function(t,r){var e=r[0]-t[0],n=r[1]-t[1];return Math.sqrt(e*e+n*n)},i.dist=i.distance,i.squaredDistance=function(t,r){var e=r[0]-t[0],n=r[1]-t[1];return e*e+n*n},i.sqrDist=i.squaredDistance,i.length=function(t){var r=t[0],e=t[1];return Math.sqrt(r*r+e*e)},i.len=i.length,i.squaredLength=function(t){var r=t[0],e=t[1];return r*r+e*e},i.sqrLen=i.squaredLength,i.negate=function(t,r){return t[0]=-r[0],t[1]=-r[1],t},i.normalize=function(t,r){var e=r[0],n=r[1],i=e*e+n*n;return i>0&&(i=1/Math.sqrt(i),t[0]=r[0]*i,t[1]=r[1]*i),t},i.dot=function(t,r){return t[0]*r[0]+t[1]*r[1]},i.cross=function(t,r,e){var n=r[0]*e[1]-r[1]*e[0];return t[0]=t[1]=0,t[2]=n,t},i.lerp=function(t,r,e,n){var i=r[0],o=r[1];return t[0]=i+n*(e[0]-i),t[1]=o+n*(e[1]-o),t},i.transformMat2=function(t,r,e){var n=r[0],i=r[1];return t[0]=e[0]*n+e[2]*i,t[1]=e[1]*n+e[3]*i,t},i.transformMat2d=function(t,r,e){var n=r[0],i=r[1];return t[0]=e[0]*n+e[2]*i+e[4],t[1]=e[1]*n+e[3]*i+e[5],t},i.transformMat3=function(t,r,e){var n=r[0],i=r[1];return t[0]=e[0]*n+e[3]*i+e[6],t[1]=e[1]*n+e[4]*i+e[7],t},i.transformMat4=function(t,r,e){var n=r[0],i=r[1];return t[0]=e[0]*n+e[4]*i+e[12],t[1]=e[1]*n+e[5]*i+e[13],t},i.forEach=function(){var t=i.create();return function(r,e,n,i,o,a){var s,u;for(e||(e=2),n||(n=0),u=i?Math.min(i*e+n,r.length):r.length,s=n;u>s;s+=e)t[0]=r[s],t[1]=r[s+1],o(t,t,a),r[s]=t[0],r[s+1]=t[1];return r}}(),i.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},t!==void 0&&(t.vec2=i);var o={};o.create=function(){var t=new e(3);return t[0]=0,t[1]=0,t[2]=0,t},o.clone=function(t){var r=new e(3);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r},o.fromValues=function(t,r,n){var i=new e(3);return i[0]=t,i[1]=r,i[2]=n,i},o.copy=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t},o.set=function(t,r,e,n){return t[0]=r,t[1]=e,t[2]=n,t},o.add=function(t,r,e){return t[0]=r[0]+e[0],t[1]=r[1]+e[1],t[2]=r[2]+e[2],t},o.subtract=function(t,r,e){return t[0]=r[0]-e[0],t[1]=r[1]-e[1],t[2]=r[2]-e[2],t},o.sub=o.subtract,o.multiply=function(t,r,e){return t[0]=r[0]*e[0],t[1]=r[1]*e[1],t[2]=r[2]*e[2],t},o.mul=o.multiply,o.divide=function(t,r,e){return t[0]=r[0]/e[0],t[1]=r[1]/e[1],t[2]=r[2]/e[2],t},o.div=o.divide,o.min=function(t,r,e){return t[0]=Math.min(r[0],e[0]),t[1]=Math.min(r[1],e[1]),t[2]=Math.min(r[2],e[2]),t},o.max=function(t,r,e){return t[0]=Math.max(r[0],e[0]),t[1]=Math.max(r[1],e[1]),t[2]=Math.max(r[2],e[2]),t},o.scale=function(t,r,e){return t[0]=r[0]*e,t[1]=r[1]*e,t[2]=r[2]*e,t},o.distance=function(t,r){var e=r[0]-t[0],n=r[1]-t[1],i=r[2]-t[2];return Math.sqrt(e*e+n*n+i*i)},o.dist=o.distance,o.squaredDistance=function(t,r){var e=r[0]-t[0],n=r[1]-t[1],i=r[2]-t[2];return e*e+n*n+i*i},o.sqrDist=o.squaredDistance,o.length=function(t){var r=t[0],e=t[1],n=t[2];return Math.sqrt(r*r+e*e+n*n)},o.len=o.length,o.squaredLength=function(t){var r=t[0],e=t[1],n=t[2];return r*r+e*e+n*n},o.sqrLen=o.squaredLength,o.negate=function(t,r){return t[0]=-r[0],t[1]=-r[1],t[2]=-r[2],t},o.normalize=function(t,r){var e=r[0],n=r[1],i=r[2],o=e*e+n*n+i*i;return o>0&&(o=1/Math.sqrt(o),t[0]=r[0]*o,t[1]=r[1]*o,t[2]=r[2]*o),t},o.dot=function(t,r){return t[0]*r[0]+t[1]*r[1]+t[2]*r[2]},o.cross=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=e[0],s=e[1],u=e[2];return t[0]=i*u-o*s,t[1]=o*a-n*u,t[2]=n*s-i*a,t},o.lerp=function(t,r,e,n){var i=r[0],o=r[1],a=r[2];return t[0]=i+n*(e[0]-i),t[1]=o+n*(e[1]-o),t[2]=a+n*(e[2]-a),t},o.transformMat4=function(t,r,e){var n=r[0],i=r[1],o=r[2];return t[0]=e[0]*n+e[4]*i+e[8]*o+e[12],t[1]=e[1]*n+e[5]*i+e[9]*o+e[13],t[2]=e[2]*n+e[6]*i+e[10]*o+e[14],t},o.transformQuat=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=e[0],s=e[1],u=e[2],c=e[3],l=c*n+s*o-u*i,f=c*i+u*n-a*o,h=c*o+a*i-s*n,p=-a*n-s*i-u*o;return t[0]=l*c+p*-a+f*-u-h*-s,t[1]=f*c+p*-s+h*-a-l*-u,t[2]=h*c+p*-u+l*-s-f*-a,t},o.forEach=function(){var t=o.create();return function(r,e,n,i,o,a){var s,u;for(e||(e=3),n||(n=0),u=i?Math.min(i*e+n,r.length):r.length,s=n;u>s;s+=e)t[0]=r[s],t[1]=r[s+1],t[2]=r[s+2],o(t,t,a),r[s]=t[0],r[s+1]=t[1],r[s+2]=t[2];return r}}(),o.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},t!==void 0&&(t.vec3=o);var a={};a.create=function(){var t=new e(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},a.clone=function(t){var r=new e(4);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r},a.fromValues=function(t,r,n,i){var o=new e(4);return o[0]=t,o[1]=r,o[2]=n,o[3]=i,o},a.copy=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t},a.set=function(t,r,e,n,i){return t[0]=r,t[1]=e,t[2]=n,t[3]=i,t},a.add=function(t,r,e){return t[0]=r[0]+e[0],t[1]=r[1]+e[1],t[2]=r[2]+e[2],t[3]=r[3]+e[3],t},a.subtract=function(t,r,e){return t[0]=r[0]-e[0],t[1]=r[1]-e[1],t[2]=r[2]-e[2],t[3]=r[3]-e[3],t},a.sub=a.subtract,a.multiply=function(t,r,e){return t[0]=r[0]*e[0],t[1]=r[1]*e[1],t[2]=r[2]*e[2],t[3]=r[3]*e[3],t},a.mul=a.multiply,a.divide=function(t,r,e){return t[0]=r[0]/e[0],t[1]=r[1]/e[1],t[2]=r[2]/e[2],t[3]=r[3]/e[3],t},a.div=a.divide,a.min=function(t,r,e){return t[0]=Math.min(r[0],e[0]),t[1]=Math.min(r[1],e[1]),t[2]=Math.min(r[2],e[2]),t[3]=Math.min(r[3],e[3]),t},a.max=function(t,r,e){return t[0]=Math.max(r[0],e[0]),t[1]=Math.max(r[1],e[1]),t[2]=Math.max(r[2],e[2]),t[3]=Math.max(r[3],e[3]),t},a.scale=function(t,r,e){return t[0]=r[0]*e,t[1]=r[1]*e,t[2]=r[2]*e,t[3]=r[3]*e,t},a.distance=function(t,r){var e=r[0]-t[0],n=r[1]-t[1],i=r[2]-t[2],o=r[3]-t[3];return Math.sqrt(e*e+n*n+i*i+o*o)},a.dist=a.distance,a.squaredDistance=function(t,r){var e=r[0]-t[0],n=r[1]-t[1],i=r[2]-t[2],o=r[3]-t[3];return e*e+n*n+i*i+o*o},a.sqrDist=a.squaredDistance,a.length=function(t){var r=t[0],e=t[1],n=t[2],i=t[3];return Math.sqrt(r*r+e*e+n*n+i*i)},a.len=a.length,a.squaredLength=function(t){var r=t[0],e=t[1],n=t[2],i=t[3];return r*r+e*e+n*n+i*i},a.sqrLen=a.squaredLength,a.negate=function(t,r){return t[0]=-r[0],t[1]=-r[1],t[2]=-r[2],t[3]=-r[3],t},a.normalize=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=e*e+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a),t[0]=r[0]*a,t[1]=r[1]*a,t[2]=r[2]*a,t[3]=r[3]*a),t},a.dot=function(t,r){return t[0]*r[0]+t[1]*r[1]+t[2]*r[2]+t[3]*r[3]},a.lerp=function(t,r,e,n){var i=r[0],o=r[1],a=r[2],s=r[3];return t[0]=i+n*(e[0]-i),t[1]=o+n*(e[1]-o),t[2]=a+n*(e[2]-a),t[3]=s+n*(e[3]-s),t},a.transformMat4=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3];return t[0]=e[0]*n+e[4]*i+e[8]*o+e[12]*a,t[1]=e[1]*n+e[5]*i+e[9]*o+e[13]*a,t[2]=e[2]*n+e[6]*i+e[10]*o+e[14]*a,t[3]=e[3]*n+e[7]*i+e[11]*o+e[15]*a,t},a.transformQuat=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=e[0],s=e[1],u=e[2],c=e[3],l=c*n+s*o-u*i,f=c*i+u*n-a*o,h=c*o+a*i-s*n,p=-a*n-s*i-u*o;return t[0]=l*c+p*-a+f*-u-h*-s,t[1]=f*c+p*-s+h*-a-l*-u,t[2]=h*c+p*-u+l*-s-f*-a,t},a.forEach=function(){var t=a.create();return function(r,e,n,i,o,a){var s,u;for(e||(e=4),n||(n=0),u=i?Math.min(i*e+n,r.length):r.length,s=n;u>s;s+=e)t[0]=r[s],t[1]=r[s+1],t[2]=r[s+2],t[3]=r[s+3],o(t,t,a),r[s]=t[0],r[s+1]=t[1],r[s+2]=t[2],r[s+3]=t[3];return r}}(),a.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},t!==void 0&&(t.vec4=a);var s={};new Float32Array([1,0,0,1]),s.create=function(){var t=new e(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},s.clone=function(t){var r=new e(4);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r},s.copy=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t},s.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},s.transpose=function(t,r){if(t===r){var e=r[1];t[1]=r[2],t[2]=e}else t[0]=r[0],t[1]=r[2],t[2]=r[1],t[3]=r[3];return t},s.invert=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=e*o-i*n;return a?(a=1/a,t[0]=o*a,t[1]=-n*a,t[2]=-i*a,t[3]=e*a,t):null},s.adjoint=function(t,r){var e=r[0];return t[0]=r[3],t[1]=-r[1],t[2]=-r[2],t[3]=e,t},s.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},s.multiply=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=e[0],u=e[1],c=e[2],l=e[3];return t[0]=n*s+i*c,t[1]=n*u+i*l,t[2]=o*s+a*c,t[3]=o*u+a*l,t},s.mul=s.multiply,s.rotate=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=Math.sin(e),u=Math.cos(e);return t[0]=n*u+i*s,t[1]=n*-s+i*u,t[2]=o*u+a*s,t[3]=o*-s+a*u,t},s.scale=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=e[0],u=e[1];return t[0]=n*s,t[1]=i*u,t[2]=o*s,t[3]=a*u,t},s.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},t!==void 0&&(t.mat2=s);var u={};new Float32Array([1,0,0,1,0,0]),u.create=function(){var t=new e(6);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},u.clone=function(t){var r=new e(6);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r},u.copy=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t},u.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},u.invert=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],u=e*o-n*i;return u?(u=1/u,t[0]=o*u,t[1]=-n*u,t[2]=-i*u,t[3]=e*u,t[4]=(i*s-o*a)*u,t[5]=(n*a-e*s)*u,t):null},u.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},u.multiply=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=e[0],l=e[1],f=e[2],h=e[3],p=e[4],d=e[5];return t[0]=n*c+i*f,t[1]=n*l+i*h,t[2]=o*c+a*f,t[3]=o*l+a*h,t[4]=c*s+f*u+p,t[5]=l*s+h*u+d,t},u.mul=u.multiply,u.rotate=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=Math.sin(e),l=Math.cos(e);return t[0]=n*l+i*c,t[1]=-n*c+i*l,t[2]=o*l+a*c,t[3]=-o*c+l*a,t[4]=l*s+c*u,t[5]=l*u-c*s,t},u.scale=function(t,r,e){var n=e[0],i=e[1];return t[0]=r[0]*n,t[1]=r[1]*i,t[2]=r[2]*n,t[3]=r[3]*i,t[4]=r[4]*n,t[5]=r[5]*i,t},u.translate=function(t,r,e){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4]+e[0],t[5]=r[5]+e[1],t},u.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},t!==void 0&&(t.mat2d=u);var c={};new Float32Array([1,0,0,0,1,0,0,0,1]),c.create=function(){var t=new e(9);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},c.clone=function(t){var r=new e(9);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r},c.copy=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t},c.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},c.transpose=function(t,r){if(t===r){var e=r[1],n=r[2],i=r[5];t[1]=r[3],t[2]=r[6],t[3]=e,t[5]=r[7],t[6]=n,t[7]=i}else t[0]=r[0],t[1]=r[3],t[2]=r[6],t[3]=r[1],t[4]=r[4],t[5]=r[7],t[6]=r[2],t[7]=r[5],t[8]=r[8];return t},c.invert=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],u=r[6],c=r[7],l=r[8],f=l*a-s*c,h=-l*o+s*u,p=c*o-a*u,d=e*f+n*h+i*p;return d?(d=1/d,t[0]=f*d,t[1]=(-l*n+i*c)*d,t[2]=(s*n-i*a)*d,t[3]=h*d,t[4]=(l*e-i*u)*d,t[5]=(-s*e+i*o)*d,t[6]=p*d,t[7]=(-c*e+n*u)*d,t[8]=(a*e-n*o)*d,t):null},c.adjoint=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],u=r[6],c=r[7],l=r[8];return t[0]=a*l-s*c,t[1]=i*c-n*l,t[2]=n*s-i*a,t[3]=s*u-o*l,t[4]=e*l-i*u,t[5]=i*o-e*s,t[6]=o*c-a*u,t[7]=n*u-e*c,t[8]=e*a-n*o,t},c.determinant=function(t){var r=t[0],e=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],u=t[7],c=t[8];return r*(c*o-a*u)+e*(-c*i+a*s)+n*(u*i-o*s)},c.multiply=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=r[6],l=r[7],f=r[8],h=e[0],p=e[1],d=e[2],v=e[3],m=e[4],g=e[5],y=e[6],b=e[7],_=e[8];return t[0]=h*n+p*a+d*c,t[1]=h*i+p*s+d*l,t[2]=h*o+p*u+d*f,t[3]=v*n+m*a+g*c,t[4]=v*i+m*s+g*l,t[5]=v*o+m*u+g*f,t[6]=y*n+b*a+_*c,t[7]=y*i+b*s+_*l,t[8]=y*o+b*u+_*f,t},c.mul=c.multiply,c.translate=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=r[6],l=r[7],f=r[8],h=e[0],p=e[1];return t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=u,t[6]=h*n+p*a+c,t[7]=h*i+p*s+l,t[8]=h*o+p*u+f,t},c.rotate=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=r[6],l=r[7],f=r[8],h=Math.sin(e),p=Math.cos(e);return t[0]=p*n+h*a,t[1]=p*i+h*s,t[2]=p*o+h*u,t[3]=p*a-h*n,t[4]=p*s-h*i,t[5]=p*u-h*o,t[6]=c,t[7]=l,t[8]=f,t},c.scale=function(t,r,e){var n=e[0],i=e[2];return t[0]=n*r[0],t[1]=n*r[1],t[2]=n*r[2],t[3]=i*r[3],t[4]=i*r[4],t[5]=i*r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t},c.fromMat2d=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=0,t[3]=r[2],t[4]=r[3],t[5]=0,t[6]=r[4],t[7]=r[5],t[8]=1,t},c.fromQuat=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=e+e,s=n+n,u=i+i,c=e*a,l=e*s,f=e*u,h=n*s,p=n*u,d=i*u,v=o*a,m=o*s,g=o*u;return t[0]=1-(h+d),t[1]=l+g,t[2]=f-m,t[3]=l-g,t[4]=1-(c+d),t[5]=p+v,t[6]=f+m,t[7]=p-v,t[8]=1-(c+h),t},c.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},t!==void 0&&(t.mat3=c);var l={};new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),l.create=function(){var t=new e(16);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},l.clone=function(t){var r=new e(16);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},l.copy=function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t},l.identity=function(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},l.transpose=function(t,r){if(t===r){var e=r[1],n=r[2],i=r[3],o=r[6],a=r[7],s=r[11];t[1]=r[4],t[2]=r[8],t[3]=r[12],t[4]=e,t[6]=r[9],t[7]=r[13],t[8]=n,t[9]=o,t[11]=r[14],t[12]=i,t[13]=a,t[14]=s}else t[0]=r[0],t[1]=r[4],t[2]=r[8],t[3]=r[12],t[4]=r[1],t[5]=r[5],t[6]=r[9],t[7]=r[13],t[8]=r[2],t[9]=r[6],t[10]=r[10],t[11]=r[14],t[12]=r[3],t[13]=r[7],t[14]=r[11],t[15]=r[15];return t},l.invert=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],u=r[6],c=r[7],l=r[8],f=r[9],h=r[10],p=r[11],d=r[12],v=r[13],m=r[14],g=r[15],y=e*s-n*a,b=e*u-i*a,_=e*c-o*a,w=n*u-i*s,M=n*c-o*s,A=i*c-o*u,E=l*v-f*d,x=l*m-h*d,j=l*g-p*d,k=f*m-h*v,L=f*g-p*v,I=h*g-p*m,q=y*I-b*L+_*k+w*j-M*x+A*E;return q?(q=1/q,t[0]=(s*I-u*L+c*k)*q,t[1]=(i*L-n*I-o*k)*q,t[2]=(v*A-m*M+g*w)*q,t[3]=(h*M-f*A-p*w)*q,t[4]=(u*j-a*I-c*x)*q,t[5]=(e*I-i*j+o*x)*q,t[6]=(m*_-d*A-g*b)*q,t[7]=(l*A-h*_+p*b)*q,t[8]=(a*L-s*j+c*E)*q,t[9]=(n*j-e*L-o*E)*q,t[10]=(d*M-v*_+g*y)*q,t[11]=(f*_-l*M-p*y)*q,t[12]=(s*x-a*k-u*E)*q,t[13]=(e*k-n*x+i*E)*q,t[14]=(v*b-d*w-m*y)*q,t[15]=(l*w-f*b+h*y)*q,t):null
},l.adjoint=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],u=r[6],c=r[7],l=r[8],f=r[9],h=r[10],p=r[11],d=r[12],v=r[13],m=r[14],g=r[15];return t[0]=s*(h*g-p*m)-f*(u*g-c*m)+v*(u*p-c*h),t[1]=-(n*(h*g-p*m)-f*(i*g-o*m)+v*(i*p-o*h)),t[2]=n*(u*g-c*m)-s*(i*g-o*m)+v*(i*c-o*u),t[3]=-(n*(u*p-c*h)-s*(i*p-o*h)+f*(i*c-o*u)),t[4]=-(a*(h*g-p*m)-l*(u*g-c*m)+d*(u*p-c*h)),t[5]=e*(h*g-p*m)-l*(i*g-o*m)+d*(i*p-o*h),t[6]=-(e*(u*g-c*m)-a*(i*g-o*m)+d*(i*c-o*u)),t[7]=e*(u*p-c*h)-a*(i*p-o*h)+l*(i*c-o*u),t[8]=a*(f*g-p*v)-l*(s*g-c*v)+d*(s*p-c*f),t[9]=-(e*(f*g-p*v)-l*(n*g-o*v)+d*(n*p-o*f)),t[10]=e*(s*g-c*v)-a*(n*g-o*v)+d*(n*c-o*s),t[11]=-(e*(s*p-c*f)-a*(n*p-o*f)+l*(n*c-o*s)),t[12]=-(a*(f*m-h*v)-l*(s*m-u*v)+d*(s*h-u*f)),t[13]=e*(f*m-h*v)-l*(n*m-i*v)+d*(n*h-i*f),t[14]=-(e*(s*m-u*v)-a*(n*m-i*v)+d*(n*u-i*s)),t[15]=e*(s*h-u*f)-a*(n*h-i*f)+l*(n*u-i*s),t},l.determinant=function(t){var r=t[0],e=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],u=t[7],c=t[8],l=t[9],f=t[10],h=t[11],p=t[12],d=t[13],v=t[14],m=t[15],g=r*a-e*o,y=r*s-n*o,b=r*u-i*o,_=e*s-n*a,w=e*u-i*a,M=n*u-i*s,A=c*d-l*p,E=c*v-f*p,x=c*m-h*p,j=l*v-f*d,k=l*m-h*d,L=f*m-h*v;return g*L-y*k+b*j+_*x-w*E+M*A},l.multiply=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=r[6],l=r[7],f=r[8],h=r[9],p=r[10],d=r[11],v=r[12],m=r[13],g=r[14],y=r[15],b=e[0],_=e[1],w=e[2],M=e[3];return t[0]=b*n+_*s+w*f+M*v,t[1]=b*i+_*u+w*h+M*m,t[2]=b*o+_*c+w*p+M*g,t[3]=b*a+_*l+w*d+M*y,b=e[4],_=e[5],w=e[6],M=e[7],t[4]=b*n+_*s+w*f+M*v,t[5]=b*i+_*u+w*h+M*m,t[6]=b*o+_*c+w*p+M*g,t[7]=b*a+_*l+w*d+M*y,b=e[8],_=e[9],w=e[10],M=e[11],t[8]=b*n+_*s+w*f+M*v,t[9]=b*i+_*u+w*h+M*m,t[10]=b*o+_*c+w*p+M*g,t[11]=b*a+_*l+w*d+M*y,b=e[12],_=e[13],w=e[14],M=e[15],t[12]=b*n+_*s+w*f+M*v,t[13]=b*i+_*u+w*h+M*m,t[14]=b*o+_*c+w*p+M*g,t[15]=b*a+_*l+w*d+M*y,t},l.mul=l.multiply,l.translate=function(t,r,e){var n,i,o,a,s,u,c,l,f,h,p,d,v=e[0],m=e[1],g=e[2];return r===t?(t[12]=r[0]*v+r[4]*m+r[8]*g+r[12],t[13]=r[1]*v+r[5]*m+r[9]*g+r[13],t[14]=r[2]*v+r[6]*m+r[10]*g+r[14],t[15]=r[3]*v+r[7]*m+r[11]*g+r[15]):(n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=r[5],c=r[6],l=r[7],f=r[8],h=r[9],p=r[10],d=r[11],t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=u,t[6]=c,t[7]=l,t[8]=f,t[9]=h,t[10]=p,t[11]=d,t[12]=n*v+s*m+f*g+r[12],t[13]=i*v+u*m+h*g+r[13],t[14]=o*v+c*m+p*g+r[14],t[15]=a*v+l*m+d*g+r[15]),t},l.scale=function(t,r,e){var n=e[0],i=e[1],o=e[2];return t[0]=r[0]*n,t[1]=r[1]*n,t[2]=r[2]*n,t[3]=r[3]*n,t[4]=r[4]*i,t[5]=r[5]*i,t[6]=r[6]*i,t[7]=r[7]*i,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[10]*o,t[11]=r[11]*o,t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t},l.rotate=function(t,e,n,i){var o,a,s,u,c,l,f,h,p,d,v,m,g,y,b,_,w,M,A,E,x,j,k,L,I=i[0],q=i[1],S=i[2],F=Math.sqrt(I*I+q*q+S*S);return r>Math.abs(F)?null:(F=1/F,I*=F,q*=F,S*=F,o=Math.sin(n),a=Math.cos(n),s=1-a,u=e[0],c=e[1],l=e[2],f=e[3],h=e[4],p=e[5],d=e[6],v=e[7],m=e[8],g=e[9],y=e[10],b=e[11],_=I*I*s+a,w=q*I*s+S*o,M=S*I*s-q*o,A=I*q*s-S*o,E=q*q*s+a,x=S*q*s+I*o,j=I*S*s+q*o,k=q*S*s-I*o,L=S*S*s+a,t[0]=u*_+h*w+m*M,t[1]=c*_+p*w+g*M,t[2]=l*_+d*w+y*M,t[3]=f*_+v*w+b*M,t[4]=u*A+h*E+m*x,t[5]=c*A+p*E+g*x,t[6]=l*A+d*E+y*x,t[7]=f*A+v*E+b*x,t[8]=u*j+h*k+m*L,t[9]=c*j+p*k+g*L,t[10]=l*j+d*k+y*L,t[11]=f*j+v*k+b*L,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)},l.rotateX=function(t,r,e){var n=Math.sin(e),i=Math.cos(e),o=r[4],a=r[5],s=r[6],u=r[7],c=r[8],l=r[9],f=r[10],h=r[11];return r!==t&&(t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[4]=o*i+c*n,t[5]=a*i+l*n,t[6]=s*i+f*n,t[7]=u*i+h*n,t[8]=c*i-o*n,t[9]=l*i-a*n,t[10]=f*i-s*n,t[11]=h*i-u*n,t},l.rotateY=function(t,r,e){var n=Math.sin(e),i=Math.cos(e),o=r[0],a=r[1],s=r[2],u=r[3],c=r[8],l=r[9],f=r[10],h=r[11];return r!==t&&(t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[0]=o*i-c*n,t[1]=a*i-l*n,t[2]=s*i-f*n,t[3]=u*i-h*n,t[8]=o*n+c*i,t[9]=a*n+l*i,t[10]=s*n+f*i,t[11]=u*n+h*i,t},l.rotateZ=function(t,r,e){var n=Math.sin(e),i=Math.cos(e),o=r[0],a=r[1],s=r[2],u=r[3],c=r[4],l=r[5],f=r[6],h=r[7];return r!==t&&(t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[0]=o*i+c*n,t[1]=a*i+l*n,t[2]=s*i+f*n,t[3]=u*i+h*n,t[4]=c*i-o*n,t[5]=l*i-a*n,t[6]=f*i-s*n,t[7]=h*i-u*n,t},l.fromRotationTranslation=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=n+n,u=i+i,c=o+o,l=n*s,f=n*u,h=n*c,p=i*u,d=i*c,v=o*c,m=a*s,g=a*u,y=a*c;return t[0]=1-(p+v),t[1]=f+y,t[2]=h-g,t[3]=0,t[4]=f-y,t[5]=1-(l+v),t[6]=d+m,t[7]=0,t[8]=h+g,t[9]=d-m,t[10]=1-(l+p),t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t},l.fromQuat=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=e+e,s=n+n,u=i+i,c=e*a,l=e*s,f=e*u,h=n*s,p=n*u,d=i*u,v=o*a,m=o*s,g=o*u;return t[0]=1-(h+d),t[1]=l+g,t[2]=f-m,t[3]=0,t[4]=l-g,t[5]=1-(c+d),t[6]=p+v,t[7]=0,t[8]=f+m,t[9]=p-v,t[10]=1-(c+h),t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},l.frustum=function(t,r,e,n,i,o,a){var s=1/(e-r),u=1/(i-n),c=1/(o-a);return t[0]=2*o*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*u,t[6]=0,t[7]=0,t[8]=(e+r)*s,t[9]=(i+n)*u,t[10]=(a+o)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*a*o*c,t[15]=0,t},l.perspective=function(t,r,e,n,i){var o=1/Math.tan(r/2),a=1/(n-i);return t[0]=o/e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*a,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*a,t[15]=0,t},l.ortho=function(t,r,e,n,i,o,a){var s=1/(r-e),u=1/(n-i),c=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(r+e)*s,t[13]=(i+n)*u,t[14]=(a+o)*c,t[15]=1,t},l.lookAt=function(t,e,n,i){var o,a,s,u,c,f,h,p,d,v,m=e[0],g=e[1],y=e[2],b=i[0],_=i[1],w=i[2],M=n[0],A=n[1],E=n[2];return r>Math.abs(m-M)&&r>Math.abs(g-A)&&r>Math.abs(y-E)?l.identity(t):(h=m-M,p=g-A,d=y-E,v=1/Math.sqrt(h*h+p*p+d*d),h*=v,p*=v,d*=v,o=_*d-w*p,a=w*h-b*d,s=b*p-_*h,v=Math.sqrt(o*o+a*a+s*s),v?(v=1/v,o*=v,a*=v,s*=v):(o=0,a=0,s=0),u=p*s-d*a,c=d*o-h*s,f=h*a-p*o,v=Math.sqrt(u*u+c*c+f*f),v?(v=1/v,u*=v,c*=v,f*=v):(u=0,c=0,f=0),t[0]=o,t[1]=u,t[2]=h,t[3]=0,t[4]=a,t[5]=c,t[6]=p,t[7]=0,t[8]=s,t[9]=f,t[10]=d,t[11]=0,t[12]=-(o*m+a*g+s*y),t[13]=-(u*m+c*g+f*y),t[14]=-(h*m+p*g+d*y),t[15]=1,t)},l.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]+")"},t!==void 0&&(t.mat4=l);var f={};new Float32Array([0,0,0,1]),f.create=function(){var t=new e(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},f.clone=a.clone,f.fromValues=a.fromValues,f.copy=a.copy,f.set=a.set,f.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},f.setAxisAngle=function(t,r,e){e=.5*e;var n=Math.sin(e);return t[0]=n*r[0],t[1]=n*r[1],t[2]=n*r[2],t[3]=Math.cos(e),t},f.add=a.add,f.multiply=function(t,r,e){var n=r[0],i=r[1],o=r[2],a=r[3],s=e[0],u=e[1],c=e[2],l=e[3];return t[0]=n*l+a*s+i*c-o*u,t[1]=i*l+a*u+o*s-n*c,t[2]=o*l+a*c+n*u-i*s,t[3]=a*l-n*s-i*u-o*c,t},f.mul=f.multiply,f.scale=a.scale,f.rotateX=function(t,r,e){e*=.5;var n=r[0],i=r[1],o=r[2],a=r[3],s=Math.sin(e),u=Math.cos(e);return t[0]=n*u+a*s,t[1]=i*u+o*s,t[2]=o*u-i*s,t[3]=a*u-n*s,t},f.rotateY=function(t,r,e){e*=.5;var n=r[0],i=r[1],o=r[2],a=r[3],s=Math.sin(e),u=Math.cos(e);return t[0]=n*u-o*s,t[1]=i*u+a*s,t[2]=o*u+n*s,t[3]=a*u-i*s,t},f.rotateZ=function(t,r,e){e*=.5;var n=r[0],i=r[1],o=r[2],a=r[3],s=Math.sin(e),u=Math.cos(e);return t[0]=n*u+i*s,t[1]=i*u-n*s,t[2]=o*u+a*s,t[3]=a*u-o*s,t},f.calculateW=function(t,r){var e=r[0],n=r[1],i=r[2];return t[0]=e,t[1]=n,t[2]=i,t[3]=-Math.sqrt(Math.abs(1-e*e-n*n-i*i)),t},f.dot=a.dot,f.lerp=a.lerp,f.slerp=function(t,r,e,n){var i,o,a,s,u=r[0],c=r[1],l=r[2],f=r[3],h=e[0],p=e[1],d=e[2],v=e[3],m=u*h+c*p+l*d+f*v;return Math.abs(m)>=1?(t!==r&&(t[0]=u,t[1]=c,t[2]=l,t[3]=f),t):(i=Math.acos(m),o=Math.sqrt(1-m*m),.001>Math.abs(o)?(t[0]=.5*u+.5*h,t[1]=.5*c+.5*p,t[2]=.5*l+.5*d,t[3]=.5*f+.5*v,t):(a=Math.sin((1-n)*i)/o,s=Math.sin(n*i)/o,t[0]=u*a+h*s,t[1]=c*a+p*s,t[2]=l*a+d*s,t[3]=f*a+v*s,t))},f.invert=function(t,r){var e=r[0],n=r[1],i=r[2],o=r[3],a=e*e+n*n+i*i+o*o,s=a?1/a:0;return t[0]=-e*s,t[1]=-n*s,t[2]=-i*s,t[3]=o*s,t},f.conjugate=function(t,r){return t[0]=-r[0],t[1]=-r[1],t[2]=-r[2],t[3]=r[3],t},f.length=a.length,f.len=f.length,f.squaredLength=a.squaredLength,f.sqrLen=f.squaredLength,f.normalize=a.normalize,f.fromMat3=function(){var t=[1,2,0];return function(r,e){var n,i=e[0]+e[4]+e[8];if(i>0)n=Math.sqrt(i+1),r[3]=.5*n,n=.5/n,r[0]=(e[7]-e[5])*n,r[1]=(e[2]-e[6])*n,r[2]=(e[3]-e[1])*n;else{var o=0;e[4]>e[0]&&(o=1),e[8]>e[3*o+o]&&(o=2);var a=t[o],s=t[a];n=Math.sqrt(e[3*o+o]-e[3*a+a]-e[3*s+s]+1),r[o]=.5*n,n=.5/n,r[3]=(e[3*s+a]-e[3*a+s])*n,r[a]=(e[3*a+o]+e[3*o+a])*n,r[s]=(e[3*s+o]+e[3*o+s])*n}return r}}(),f.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},t!==void 0&&(t.quat=f)}(t.exports)})()},{}],18:[function(t,r){"use strict";function e(t,r,e){r?r.bind():t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null);var n=0|t.getParameter(t.MAX_VERTEX_ATTRIBS);if(e){if(e.length>n)throw Error("gl-vao: Too many vertex attributes");for(var i=0;e.length>i;++i){var o=e[i];if(o.buffer){var a=o.buffer,s=o.size||4,u=o.type||t.FLOAT,c=!!o.normalized,l=o.stride||0,f=o.offset||0;a.bind(),t.enableVertexAttribArray(i),t.vertexAttribPointer(i,s,u,c,l,f)}else{if("number"==typeof o)t.vertexAttrib1f(i,o);else if(1===o.length)t.vertexAttrib1f(i,o[0]);else if(2===o.length)t.vertexAttrib2f(i,o[0],o[1]);else if(3===o.length)t.vertexAttrib3f(i,o[0],o[1],o[2]);else{if(4!==o.length)throw Error("gl-vao: Invalid vertex attribute");t.vertexAttrib4f(i,o[0],o[1],o[2],o[3])}t.disableVertexAttribArray(i)}}for(;n>i;++i)t.disableVertexAttribArray(i)}else{t.bindBuffer(t.ARRAY_BUFFER,null);for(var i=0;n>i;++i)t.disableVertexAttribArray(i)}}r.exports=e},{}],19:[function(t,r){"use strict";function e(t){this.gl=t,this._elements=null,this._attributes=null}function n(t){return new e(t)}var i=t("./do-bind.js");e.prototype.bind=function(){i(this.gl,this._elements,this._attributes)},e.prototype.update=function(t,r){this._elements=r,this._attributes=t},e.prototype.dispose=function(){},e.prototype.unbind=function(){},e.prototype.draw=function(t,r,e){e=e||0;var n=this.gl;this._elements?n.drawElements(t,r,n.UNSIGNED_SHORT,e):n.drawArrays(t,e,r)},r.exports=n},{"./do-bind.js":18}],20:[function(t,r){"use strict";function e(t,r,e,n,i,o){this.location=t,this.dimension=r,this.a=e,this.b=n,this.c=i,this.d=o}function n(t,r,e){this.gl=t,this._ext=r,this.handle=e,this._attribs=[],this._useElements=!1}function i(t,r){return new n(t,r,r.createVertexArrayOES())}var o=t("./do-bind.js");e.prototype.bind=function(t){switch(this.dimension){case 1:t.vertexAttrib1f(this.location,this.a);break;case 2:t.vertexAttrib2f(this.location,this.a,this.b);break;case 3:t.vertexAttrib3f(this.location,this.a,this.b,this.c);break;case 4:t.vertexAttrib4f(this.location,this.a,this.b,this.c,this.d)}},n.prototype.bind=function(){this._ext.bindVertexArrayOES(this.handle);for(var t=0;this._attribs.length>t;++t)this._attribs[t].bind(this.gl)},n.prototype.unbind=function(){this._ext.bindVertexArrayOES(null)},n.prototype.dispose=function(){this._ext.deleteVertexArrayOES(this.handle)},n.prototype.update=function(t,r){if(this.bind(),o(this.gl,r,t),this.unbind(),this._attribs.length=0,t)for(var n=0;t.length>n;++n){var i=t[n];"number"==typeof i?this._attribs.push(new e(n,1,i)):Array.isArray(i)&&this._attribs.push(new e(n,i.length,i[0],i[1],i[2],i[3]))}this._useElements=!!r},n.prototype.draw=function(t,r,e){e=e||0;var n=this.gl;this._useElements?n.drawElements(t,r,n.UNSIGNED_SHORT,e):n.drawArrays(t,e,r)},r.exports=i},{"./do-bind.js":18}],21:[function(t,r,e){void function(t,n,i){function o(t,r,e){return"function"==typeof r&&(e=r,r=a(e).replace(/_$/,"")),c(t,r,{configurable:!0,writable:!0,value:e})}function a(t){return"function"!=typeof t?"":"name"in t?t.name:l.call(t).match(p)[1]}function s(t){function r(r,n){return n||2===arguments.length?e.set(r,n):(n=e.get(r),n===i&&(n=t(r),e.set(r,n))),n}var e=new v;return t||(t=m),r}var u=Object.getOwnPropertyNames,c=Object.defineProperty,l=Function.prototype.toString,f=Object.create,h=Object.prototype.hasOwnProperty,p=/^\n?function\s?(\w*)?_?\(/,d=function(){function t(){var t=a(),n={};this.unlock=function(i){var o=l(i);if(h.call(o,t))return o[t](n);var a=f(null,r);return c(o,t,{value:Function("s","l",e)(n,a)}),a}}var r={value:{writable:!0,value:i}},e="return function(k){if(k===s)return l}",n=f(null),a=function(){var t=Math.random().toString(36).slice(2);return t in n?a():n[t]=t},s=a(),l=function(t){if(h.call(t,s))return t[s];if(!Object.isExtensible(t))throw new TypeError("Object must be extensible");var r=f(null);return c(t,s,{value:r}),r};return o(Object,function(t){var r=u(t);return h.call(t,s)&&r.splice(r.indexOf(s),1),r}),o(t.prototype,function(t){return this.unlock(t).value}),o(t.prototype,function(t,r){this.unlock(t).value=r}),t}(),v=function(r){function e(r){return this===t||null==this||this===e.prototype?new e(r):(p(this,new d),m(this,r),i)}function s(t){h(t);var r=v(this).get(t);return r===n?i:r}function u(t,r){h(t),v(this).set(t,r===i?n:r)}function c(t){return h(t),v(this).get(t)!==i}function l(t){h(t);var r=v(this),e=r.get(t)!==i;return r.set(t,i),e}function f(){return v(this),"[object WeakMap]"}var h=function(t){if(null==t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Invalid WeakMap key")},p=function(t,e){var n=r.unlock(t);if(n.value)throw new TypeError("Object is already a WeakMap");n.value=e},v=function(t){var e=r.unlock(t).value;if(!e)throw new TypeError("WeakMap is not generic");return e},m=function(t,r){null!==r&&"object"==typeof r&&"function"==typeof r.forEach&&r.forEach(function(e,n){e instanceof Array&&2===e.length&&u.call(t,r[n][0],r[n][1])})};try{var g=("return "+l).replace("e_","\\u0065"),y=Function("unwrap","validate",g)(v,h)}catch(b){var y=l}var g=(""+Object).split("Object"),_=function f(){return g[0]+a(this)+g[1]};o(_,_);var w={__proto__:[]}instanceof Array?function(t){t.__proto__=_}:function(t){o(t,_)};return w(e),[f,s,u,c,y].forEach(function(t){o(e.prototype,t),w(t)}),e}(new d),m=Object.create?function(){return Object.create(null)}:function(){return{}};r!==i?r.exports=v:e!==i?e.WeakMap=v:"WeakMap"in t||(t.WeakMap=v),v.createStorage=s,t.WeakMap&&(t.WeakMap.createStorage=s)}((0,eval)("this"))},{}],22:[function(t,r){"use strict";function e(t){return t.replace(/^[A-Z]+_/,"")}function n(t){var r=o.get(t);if(r)return r;for(var n={},i=t.getSupportedExtensions(),a=0;i.length>a;++a){var s=i[a],u=t.getExtension(i[a]);if(u)for(;;){n[s]=u;var c=e(s);if(c===s)break;s=c}}return o.set(t,n),n}var i="undefined"==typeof WeakMap?t("weakmap"):WeakMap,o=new i;r.exports=n},{weakmap:21}],23:[function(t,r){"use strict";function e(t,r,e){var a,s=n(t).OES_vertex_array_object;return a=s?i(t,s):o(t),a.update(r,e),a}var n=t("webglew"),i=t("./lib/vao-native.js"),o=t("./lib/vao-emulated.js");r.exports=e},{"./lib/vao-emulated.js":19,"./lib/vao-native.js":20,webglew:22}],24:[function(t,r){function e(t,r,e,i){return function(o){return n(o,t,r,e,i)}}r.exports=e;var n=t("gl-shader-core")},{"gl-shader-core":31}],25:[function(t,r){function e(){throw Error("You should bundle your code using `glslify` as a transform.")}r.exports=e},{}],26:[function(t,r){"use strict";function e(t){for(var r={},e=0;t.length>e;++e)for(var n=t[e].name,i=n.split("."),o=r,a=0;i.length>a;++a){var s=i[a].split("[");if(s.length>1){s[0]in o||(o[s[0]]=[]),o=o[s[0]];for(var u=1;s.length>u;++u){var c=parseInt(s[u]);s.length-1>u||i.length-1>a?(c in o||(o[c]=s.length-1>u?[]:{}),o=o[c]):o[c]=e}}else i.length-1>a?(s[0]in o||(o[s[0]]={}),o=o[s[0]]):o[s[0]]=e}return r}r.exports=e},{}],27:[function(t,r){"use strict";function e(t,r,e,n,i,o,a){this._gl=t,this._program=r,this._location=e,this._dimension=n,this._name=i,this._constFunc=o,this._relink=a}function n(t,r,n,i,o,a,s){for(var u=["gl","v"],c=[],l=0;i>l;++l)u.push("x"+l),c.push("x"+l);u.push(["if(x0.length===undefined){return gl.vertexAttrib",i,"f(v,",c.join(","),")}else{return gl.vertexAttrib",i,"fv(v,x0)}"].join(""));var f=Function.apply(void 0,u),h=new e(t,r,n,i,a,f,s);Object.defineProperty(o,a,{set:function(r){return t.disableVertexAttribArray(h._location),f(t,h._location,r),r},get:function(){return h},enumerable:!0})}function i(t,r,e,i){for(var o={},a=0,s=e.length;s>a;++a){var u=e[a],c=u.name,l=u.type,f=t.getAttribLocation(r,c);switch(l){case"bool":case"int":case"float":n(t,r,f,1,o,c,i);break;default:if(!(l.indexOf("vec")>=0))throw Error("Unknown data type for attribute "+c+": "+l);var h=l.charCodeAt(l.length-1)-48;if(2>h||h>4)throw Error("Invalid data type for attribute "+c+": "+l);n(t,r,f,h,o,c,i)}}return o}r.exports=i;var o=e.prototype;o.pointer=function(t,r,e,n){var i=this._gl;i.vertexAttribPointer(this._location,this._dimension,t||i.FLOAT,r?i.TRUE:i.FALSE,e||0,n||0),this._gl.enableVertexAttribArray(this._location)},Object.defineProperty(o,"location",{get:function(){return this._location},set:function(t){t!==this._location&&(this._location=t,this._gl.bindAttribLocation(this._program,t,this._name),this._gl.linkProgram(this._program),this._relink())}})},{}],28:[function(t,r){"use strict";function e(t){var r=Function("y","return function(){return y}");return r(t)}function n(t,r,n,a){function s(e){var n=Function("gl","prog","locations","return function(){return gl.getUniform(prog,locations["+e+"])}");return n(t,r,a)}function u(t,r,e){switch(e){case"bool":case"int":case"sampler2D":case"samplerCube":return"gl.uniform1i(locations["+r+"],obj"+t+")";case"float":return"gl.uniform1f(locations["+r+"],obj"+t+")";default:var n=e.indexOf("vec");if(!(n>=0&&1>=n&&e.length===4+n)){if(0===e.indexOf("mat")&&4===e.length){var i=e.charCodeAt(e.length-1)-48;if(2>i||i>4)throw Error("Invalid uniform dimension type for matrix "+name+": "+e);return"gl.uniformMatrix"+i+"fv(locations["+r+"],false,obj"+t+")"}throw Error("Unknown uniform data type for "+name+": "+e)}var i=e.charCodeAt(e.length-1)-48;if(2>i||i>4)throw Error("Invalid data type");switch(e.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+r+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+r+"],obj"+t+")";default:throw Error("Unrecognized data type for vector "+name+": "+e)}}}function c(t,r){if("object"!=typeof r)return[[t,r]];var e=[];for(var n in r){var i=r[n],o=t;o+=parseInt(n)+""===n?"["+n+"]":"."+n,"object"==typeof i?e.push.apply(e,c(o,i)):e.push([o,i])}return e}function l(e){for(var i=["return function updateProperty(obj){"],o=c("",e),s=0;o.length>s;++s){var l=o[s],f=l[0],h=l[1];a[h]&&i.push(u(f,h,n[h].type))}i.push("return obj}");var p=Function("gl","prog","locations",i.join("\n"));return p(t,r,a)}function f(t){switch(t){case"bool":return!1;case"int":case"sampler2D":case"samplerCube":return 0;case"float":return 0;default:var r=t.indexOf("vec");if(r>=0&&1>=r&&t.length===4+r){var e=t.charCodeAt(t.length-1)-48;if(2>e||e>4)throw Error("Invalid data type");return"b"===t.charAt(0)?i(e,!1):i(e)}if(0===t.indexOf("mat")&&4===t.length){var e=t.charCodeAt(t.length-1)-48;if(2>e||e>4)throw Error("Invalid uniform dimension type for matrix "+name+": "+t);return i([e,e])}throw Error("Unknown uniform data type for "+name+": "+t)}}function h(t,r,i){if("object"==typeof i){var o=p(i);Object.defineProperty(t,r,{get:e(o),set:l(i),enumerable:!0,configurable:!1})}else a[i]?Object.defineProperty(t,r,{get:s(i),set:l(i),enumerable:!0,configurable:!1}):t[r]=f(n[i].type)}function p(t){var r;if(Array.isArray(t)){r=Array(t.length);for(var e=0;t.length>e;++e)h(r,e,t[e])}else{r={};for(var n in t)h(r,n,t[n])}return r}var d=o(n);return{get:e(p(d)),set:l(d),enumerable:!0,configurable:!1}}var i=t("dup"),o=t("./coallesce-uniforms.js");r.exports=n},{"./coallesce-uniforms.js":26,dup:30}],29:[function(t,r){"use strict";function e(t){for(var r={},e=0;t.length>e;++e)for(var n=t[e].name,i=n.split("."),o=r,a=0;i.length>a;++a){var s=i[a].split("[");if(s.length>1){s[0]in o||(o[s[0]]=[]),o=o[s[0]];for(var u=1;s.length>u;++u){var c=parseInt(s[u]);s.length-1>u||i.length-1>a?(c in o||(o[c]=s.length-1>u?[]:{}),o=o[c]):o[c]=t[e].type}}else i.length-1>a?(s[0]in o||(o[s[0]]={}),o=o[s[0]]):o[s[0]]=t[e].type}return r}r.exports=e},{}],30:[function(t,r){r.exports=t(15)},{}],31:[function(t,r){"use strict";function e(t,r,e,n,i,o){this.gl=t,this.handle=r,this.attributes=e,this.types=n,this.vertexShader=i,this.fragmentShader=o}function n(t,r,e,n){for(var i=0;n.length>i;++i)e[i]=t.getUniformLocation(r,n[i].name)}function i(t,r,i,u,c){var l=t.createShader(t.VERTEX_SHADER);if(t.shaderSource(l,r),t.compileShader(l),!t.getShaderParameter(l,t.COMPILE_STATUS))throw Error("Error compiling vertex shader: "+t.getShaderInfoLog(l));var f=t.createShader(t.FRAGMENT_SHADER);if(t.shaderSource(f,i),t.compileShader(f),!t.getShaderParameter(f,t.COMPILE_STATUS))throw Error("Error compiling fragment shader: "+t.getShaderInfoLog(f));var h=t.createProgram();if(t.attachShader(h,f),t.attachShader(h,l),t.linkProgram(h),!t.getProgramParameter(h,t.LINK_STATUS))throw Error("Error linking shader program: "+t.getProgramInfoLog(h));var p=Array(u.length),d=n.bind(void 0,t,h,p,u);d();var v=new e(t,h,a(t,h,c,d),{uniforms:s(u),attributes:s(c)},l,f);return Object.defineProperty(v,"uniforms",o(t,h,u,p)),v}var o=t("./lib/create-uniforms.js"),a=t("./lib/create-attributes.js"),s=t("./lib/reflect.js");e.prototype.bind=function(){this.gl.useProgram(this.handle)},e.prototype.dispose=function(){var t=this.gl;t.deleteShader(this.vertexShader),t.deleteShader(this.fragmentShader),t.deleteProgram(this.handle)},r.exports=i},{"./lib/create-attributes.js":27,"./lib/create-uniforms.js":28,"./lib/reflect.js":29}],32:[function(t,r,e){var n=1e-6;e.vertexNormals=function(t,r){for(var e=r.length,i=Array(e),o=0;e>o;++o)i[o]=[0,0,0];for(var o=0;t.length>o;++o)for(var a=t[o],s=0,u=a[a.length-1],c=a[0],l=0;a.length>l;++l){s=u,u=c,c=a[(l+1)%a.length];for(var f=r[s],h=r[u],p=r[c],d=Array(3),v=0,m=Array(3),g=0,y=0;3>y;++y)d[y]=f[y]-h[y],v+=d[y]*d[y],m[y]=p[y]-h[y],g+=m[y]*m[y];if(v*g>n)for(var b=i[u],_=1/Math.sqrt(v*g),y=0;3>y;++y){var w=(y+1)%3,M=(y+2)%3;b[y]+=_*(m[w]*d[M]-m[M]*d[w])}}for(var o=0;e>o;++o){for(var b=i[o],A=0,y=0;3>y;++y)A+=b[y]*b[y];if(A>n)for(var _=1/Math.sqrt(A),y=0;3>y;++y)b[y]*=_;else for(var y=0;3>y;++y)b[y]=0}return i},e.faceNormals=function(t,r){for(var e=t.length,i=Array(e),o=0;e>o;++o){for(var a=t[o],s=Array(3),u=0;3>u;++u)s[u]=r[a[u]];for(var c=Array(3),l=Array(3),u=0;3>u;++u)c[u]=s[1][u]-s[0][u],l[u]=s[2][u]-s[0][u];for(var f=Array(3),h=0,u=0;3>u;++u){var p=(u+1)%3,d=(u+2)%3;f[u]=c[p]*l[d]-c[d]*l[p],h+=f[u]*f[u]}h=h>n?1/Math.sqrt(h):0;for(var u=0;3>u;++u)f[u]*=h;i[o]=f}return i}},{}]},{},[]);var shell=require("gl-now")({clearColor:[0,0,0,0]}),camera=require("game-shell-orbit-camera")(shell),glm=require("gl-matrix"),createMesh=require("gl-simplicial-complex"),dup=require("dup"),mat4=glm.mat4,NUM_POINTS=1e6,gl,mesh;camera.lookAt([.5,.5,-3],[.5,.5,.5],[0,1,0]);var positions=dup(NUM_POINTS).map(function(){return[Math.random(),Math.random(),Math.random()]}),colors=dup(NUM_POINTS).map(function(){return[Math.random(),Math.random(),Math.random()]}),sizes=dup(NUM_POINTS).map(function(){return 3*Math.random()+1});shell.on("gl-init",function(){gl=shell.gl,mesh=createMesh(gl,{cells:dup(NUM_POINTS).map(function(t,r){return[r]}),positions:positions,vertexColors:colors,pointSizes:sizes})}),shell.on("gl-render",function(){var t=mat4.perspective(mat4.create(),Math.PI/4,shell.width/shell.height,.1,1e3),r=camera.view(),e={projection:t,view:r};mesh.draw(e)});
{
"name": "requirebin-sketch",
"version": "1.0.0",
"dependencies": {
"dup": "0.0.0",
"gl-matrix": "2.1.0",
"gl-now": "1.3.1",
"game-shell-orbit-camera": "0.0.2",
"gl-simplicial-complex": "1.0.0"
}
}
<style type='text/css'>html, body { margin: 0; padding: 0; border: 0; }
body, html { height: 100%; width: 100%; }</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment