UNPKG

reveal-leap-motion

Version:

A plugin which allows you to use your Leap Motion device to control basic navigation of your Reveal.js presentation

18 lines 90.9 kB
/*! * reveal-leap-motion v1.1.0 * https://github.com/gneatgeek/reveal-leap-motion * * Copyright 2016 Rory Hardy, James Sun, and other contributors * Released under the Apache-2.0 license * https://github.com/gneatgeek/reveal-leap-motion/blob/master/LICENSE * * =================================================================== * * LeapJS v0.6.4 * http://github.com/leapmotion/leapjs/ * * Copyright 2013 LeapMotion, Inc. and other contributors * Released under the Apache-2.0 license * http://github.com/leapmotion/leapjs/blob/master/LICENSE.txt */ !function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=34)}([function(t,e,n){(function(){var n=this,r=n._,i={},o=Array.prototype,s=Object.prototype,a=Function.prototype,u=o.push,c=o.slice,l=o.concat,h=s.toString,p=s.hasOwnProperty,f=o.forEach,d=o.map,v=o.reduce,m=o.reduceRight,y=o.filter,g=o.every,b=o.some,w=o.indexOf,x=o.lastIndexOf,M=Array.isArray,_=Object.keys,j=a.bind,S=function(t){return t instanceof S?t:this instanceof S?void(this._wrapped=t):new S(t)};void 0!==t&&t.exports&&(e=t.exports=S),e._=S,S.VERSION="1.4.4";var P=S.each=S.forEach=function(t,e,n){if(null!=t)if(f&&t.forEach===f)t.forEach(e,n);else if(t.length===+t.length){for(var r=0,o=t.length;r<o;r++)if(e.call(n,t[r],r,t)===i)return}else for(var s in t)if(S.has(t,s)&&e.call(n,t[s],s,t)===i)return};S.map=S.collect=function(t,e,n){var r=[];return null==t?r:d&&t.map===d?t.map(e,n):(P(t,function(t,i,o){r[r.length]=e.call(n,t,i,o)}),r)};var F="Reduce of empty array with no initial value";S.reduce=S.foldl=S.inject=function(t,e,n,r){var i=arguments.length>2;if(null==t&&(t=[]),v&&t.reduce===v)return r&&(e=S.bind(e,r)),i?t.reduce(e,n):t.reduce(e);if(P(t,function(t,o,s){i?n=e.call(r,n,t,o,s):(n=t,i=!0)}),!i)throw new TypeError(F);return n},S.reduceRight=S.foldr=function(t,e,n,r){var i=arguments.length>2;if(null==t&&(t=[]),m&&t.reduceRight===m)return r&&(e=S.bind(e,r)),i?t.reduceRight(e,n):t.reduceRight(e);var o=t.length;if(o!==+o){var s=S.keys(t);o=s.length}if(P(t,function(a,u,c){u=s?s[--o]:--o,i?n=e.call(r,n,t[u],u,c):(n=t[u],i=!0)}),!i)throw new TypeError(F);return n},S.find=S.detect=function(t,e,n){var r;return O(t,function(t,i,o){if(e.call(n,t,i,o))return r=t,!0}),r},S.filter=S.select=function(t,e,n){var r=[];return null==t?r:y&&t.filter===y?t.filter(e,n):(P(t,function(t,i,o){e.call(n,t,i,o)&&(r[r.length]=t)}),r)},S.reject=function(t,e,n){return S.filter(t,function(t,r,i){return!e.call(n,t,r,i)},n)},S.every=S.all=function(t,e,n){e||(e=S.identity);var r=!0;return null==t?r:g&&t.every===g?t.every(e,n):(P(t,function(t,o,s){if(!(r=r&&e.call(n,t,o,s)))return i}),!!r)};var O=S.some=S.any=function(t,e,n){e||(e=S.identity);var r=!1;return null==t?r:b&&t.some===b?t.some(e,n):(P(t,function(t,o,s){if(r||(r=e.call(n,t,o,s)))return i}),!!r)};S.contains=S.include=function(t,e){return null!=t&&(w&&t.indexOf===w?-1!=t.indexOf(e):O(t,function(t){return t===e}))},S.invoke=function(t,e){var n=c.call(arguments,2),r=S.isFunction(e);return S.map(t,function(t){return(r?e:t[e]).apply(t,n)})},S.pluck=function(t,e){return S.map(t,function(t){return t[e]})},S.where=function(t,e,n){return S.isEmpty(e)?n?null:[]:S[n?"find":"filter"](t,function(t){for(var n in e)if(e[n]!==t[n])return!1;return!0})},S.findWhere=function(t,e){return S.where(t,e,!0)},S.max=function(t,e,n){if(!e&&S.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.max.apply(Math,t);if(!e&&S.isEmpty(t))return-1/0;var r={computed:-1/0,value:-1/0};return P(t,function(t,i,o){var s=e?e.call(n,t,i,o):t;s>=r.computed&&(r={value:t,computed:s})}),r.value},S.min=function(t,e,n){if(!e&&S.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.min.apply(Math,t);if(!e&&S.isEmpty(t))return 1/0;var r={computed:1/0,value:1/0};return P(t,function(t,i,o){var s=e?e.call(n,t,i,o):t;s<r.computed&&(r={value:t,computed:s})}),r.value},S.shuffle=function(t){var e,n=0,r=[];return P(t,function(t){e=S.random(n++),r[n-1]=r[e],r[e]=t}),r};var E=function(t){return S.isFunction(t)?t:function(e){return e[t]}};S.sortBy=function(t,e,n){var r=E(e);return S.pluck(S.map(t,function(t,e,i){return{value:t,index:e,criteria:r.call(n,t,e,i)}}).sort(function(t,e){var n=t.criteria,r=e.criteria;if(n!==r){if(n>r||void 0===n)return 1;if(n<r||void 0===r)return-1}return t.index<e.index?-1:1}),"value")};var k=function(t,e,n,r){var i={},o=E(e||S.identity);return P(t,function(e,s){var a=o.call(n,e,s,t);r(i,a,e)}),i};S.groupBy=function(t,e,n){return k(t,e,n,function(t,e,n){(S.has(t,e)?t[e]:t[e]=[]).push(n)})},S.countBy=function(t,e,n){return k(t,e,n,function(t,e){S.has(t,e)||(t[e]=0),t[e]++})},S.sortedIndex=function(t,e,n,r){n=null==n?S.identity:E(n);for(var i=n.call(r,e),o=0,s=t.length;o<s;){var a=o+s>>>1;n.call(r,t[a])<i?o=a+1:s=a}return o},S.toArray=function(t){return t?S.isArray(t)?c.call(t):t.length===+t.length?S.map(t,S.identity):S.values(t):[]},S.size=function(t){return null==t?0:t.length===+t.length?t.length:S.keys(t).length},S.first=S.head=S.take=function(t,e,n){if(null!=t)return null==e||n?t[0]:c.call(t,0,e)},S.initial=function(t,e,n){return c.call(t,0,t.length-(null==e||n?1:e))},S.last=function(t,e,n){if(null!=t)return null==e||n?t[t.length-1]:c.call(t,Math.max(t.length-e,0))},S.rest=S.tail=S.drop=function(t,e,n){return c.call(t,null==e||n?1:e)},S.compact=function(t){return S.filter(t,S.identity)};var A=function(t,e,n){return P(t,function(t){S.isArray(t)?e?u.apply(n,t):A(t,e,n):n.push(t)}),n};S.flatten=function(t,e){return A(t,e,[])},S.without=function(t){return S.difference(t,c.call(arguments,1))},S.uniq=S.unique=function(t,e,n,r){S.isFunction(e)&&(r=n,n=e,e=!1);var i=n?S.map(t,n,r):t,o=[],s=[];return P(i,function(n,r){(e?r&&s[s.length-1]===n:S.contains(s,n))||(s.push(n),o.push(t[r]))}),o},S.union=function(){return S.uniq(l.apply(o,arguments))},S.intersection=function(t){var e=c.call(arguments,1);return S.filter(S.uniq(t),function(t){return S.every(e,function(e){return S.indexOf(e,t)>=0})})},S.difference=function(t){var e=l.apply(o,c.call(arguments,1));return S.filter(t,function(t){return!S.contains(e,t)})},S.zip=function(){for(var t=c.call(arguments),e=S.max(S.pluck(t,"length")),n=new Array(e),r=0;r<e;r++)n[r]=S.pluck(t,""+r);return n},S.object=function(t,e){if(null==t)return{};for(var n={},r=0,i=t.length;r<i;r++)e?n[t[r]]=e[r]:n[t[r][0]]=t[r][1];return n},S.indexOf=function(t,e,n){if(null==t)return-1;var r=0,i=t.length;if(n){if("number"!=typeof n)return r=S.sortedIndex(t,e),t[r]===e?r:-1;r=n<0?Math.max(0,i+n):n}if(w&&t.indexOf===w)return t.indexOf(e,n);for(;r<i;r++)if(t[r]===e)return r;return-1},S.lastIndexOf=function(t,e,n){if(null==t)return-1;var r=null!=n;if(x&&t.lastIndexOf===x)return r?t.lastIndexOf(e,n):t.lastIndexOf(e);for(var i=r?n:t.length;i--;)if(t[i]===e)return i;return-1},S.range=function(t,e,n){arguments.length<=1&&(e=t||0,t=0),n=arguments[2]||1;for(var r=Math.max(Math.ceil((e-t)/n),0),i=0,o=new Array(r);i<r;)o[i++]=t,t+=n;return o},S.bind=function(t,e){if(t.bind===j&&j)return j.apply(t,c.call(arguments,1));var n=c.call(arguments,2);return function(){return t.apply(e,n.concat(c.call(arguments)))}},S.partial=function(t){var e=c.call(arguments,1);return function(){return t.apply(this,e.concat(c.call(arguments)))}},S.bindAll=function(t){var e=c.call(arguments,1);return 0===e.length&&(e=S.functions(t)),P(e,function(e){t[e]=S.bind(t[e],t)}),t},S.memoize=function(t,e){var n={};return e||(e=S.identity),function(){var r=e.apply(this,arguments);return S.has(n,r)?n[r]:n[r]=t.apply(this,arguments)}},S.delay=function(t,e){var n=c.call(arguments,2);return setTimeout(function(){return t.apply(null,n)},e)},S.defer=function(t){return S.delay.apply(S,[t,1].concat(c.call(arguments,1)))},S.throttle=function(t,e){var n,r,i,o,s=0,a=function(){s=new Date,i=null,o=t.apply(n,r)};return function(){var u=new Date,c=e-(u-s);return n=this,r=arguments,c<=0?(clearTimeout(i),i=null,s=u,o=t.apply(n,r)):i||(i=setTimeout(a,c)),o}},S.debounce=function(t,e,n){var r,i;return function(){var o=this,s=arguments,a=function(){r=null,n||(i=t.apply(o,s))},u=n&&!r;return clearTimeout(r),r=setTimeout(a,e),u&&(i=t.apply(o,s)),i}},S.once=function(t){var e,n=!1;return function(){return n?e:(n=!0,e=t.apply(this,arguments),t=null,e)}},S.wrap=function(t,e){return function(){var n=[t];return u.apply(n,arguments),e.apply(this,n)}},S.compose=function(){var t=arguments;return function(){for(var e=arguments,n=t.length-1;n>=0;n--)e=[t[n].apply(this,e)];return e[0]}},S.after=function(t,e){return t<=0?e():function(){if(--t<1)return e.apply(this,arguments)}},S.keys=_||function(t){if(t!==Object(t))throw new TypeError("Invalid object");var e=[];for(var n in t)S.has(t,n)&&(e[e.length]=n);return e},S.values=function(t){var e=[];for(var n in t)S.has(t,n)&&e.push(t[n]);return e},S.pairs=function(t){var e=[];for(var n in t)S.has(t,n)&&e.push([n,t[n]]);return e},S.invert=function(t){var e={};for(var n in t)S.has(t,n)&&(e[t[n]]=n);return e},S.functions=S.methods=function(t){var e=[];for(var n in t)S.isFunction(t[n])&&e.push(n);return e.sort()},S.extend=function(t){return P(c.call(arguments,1),function(e){if(e)for(var n in e)t[n]=e[n]}),t},S.pick=function(t){var e={},n=l.apply(o,c.call(arguments,1));return P(n,function(n){n in t&&(e[n]=t[n])}),e},S.omit=function(t){var e={},n=l.apply(o,c.call(arguments,1));for(var r in t)S.contains(n,r)||(e[r]=t[r]);return e},S.defaults=function(t){return P(c.call(arguments,1),function(e){if(e)for(var n in e)null==t[n]&&(t[n]=e[n])}),t},S.clone=function(t){return S.isObject(t)?S.isArray(t)?t.slice():S.extend({},t):t},S.tap=function(t,e){return e(t),t};var z=function(t,e,n,r){if(t===e)return 0!==t||1/t==1/e;if(null==t||null==e)return t===e;t instanceof S&&(t=t._wrapped),e instanceof S&&(e=e._wrapped);var i=h.call(t);if(i!=h.call(e))return!1;switch(i){case"[object String]":return t==String(e);case"[object Number]":return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case"[object Date]":case"[object Boolean]":return+t==+e;case"[object RegExp]":return t.source==e.source&&t.global==e.global&&t.multiline==e.multiline&&t.ignoreCase==e.ignoreCase}if("object"!=typeof t||"object"!=typeof e)return!1;for(var o=n.length;o--;)if(n[o]==t)return r[o]==e;n.push(t),r.push(e);var s=0,a=!0;if("[object Array]"==i){if(s=t.length,a=s==e.length)for(;s--&&(a=z(t[s],e[s],n,r)););}else{var u=t.constructor,c=e.constructor;if(u!==c&&!(S.isFunction(u)&&u instanceof u&&S.isFunction(c)&&c instanceof c))return!1;for(var l in t)if(S.has(t,l)&&(s++,!(a=S.has(e,l)&&z(t[l],e[l],n,r))))break;if(a){for(l in e)if(S.has(e,l)&&!s--)break;a=!s}}return n.pop(),r.pop(),a};S.isEqual=function(t,e){return z(t,e,[],[])},S.isEmpty=function(t){if(null==t)return!0;if(S.isArray(t)||S.isString(t))return 0===t.length;for(var e in t)if(S.has(t,e))return!1;return!0},S.isElement=function(t){return!(!t||1!==t.nodeType)},S.isArray=M||function(t){return"[object Array]"==h.call(t)},S.isObject=function(t){return t===Object(t)},P(["Arguments","Function","String","Number","Date","RegExp"],function(t){S["is"+t]=function(e){return h.call(e)=="[object "+t+"]"}}),S.isArguments(arguments)||(S.isArguments=function(t){return!(!t||!S.has(t,"callee"))}),S.isFunction=function(t){return"function"==typeof t},S.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t))},S.isNaN=function(t){return S.isNumber(t)&&t!=+t},S.isBoolean=function(t){return!0===t||!1===t||"[object Boolean]"==h.call(t)},S.isNull=function(t){return null===t},S.isUndefined=function(t){return void 0===t},S.has=function(t,e){return p.call(t,e)},S.noConflict=function(){return n._=r,this},S.identity=function(t){return t},S.times=function(t,e,n){for(var r=Array(t),i=0;i<t;i++)r[i]=e.call(n,i);return r},S.random=function(t,e){return null==e&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1))};var L={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"}};L.unescape=S.invert(L.escape);var I={escape:new RegExp("["+S.keys(L.escape).join("")+"]","g"),unescape:new RegExp("("+S.keys(L.unescape).join("|")+")","g")};S.each(["escape","unescape"],function(t){S[t]=function(e){return null==e?"":(""+e).replace(I[t],function(e){return L[t][e]})}}),S.result=function(t,e){if(null==t)return null;var n=t[e];return S.isFunction(n)?n.call(t):n},S.mixin=function(t){P(S.functions(t),function(e){var n=S[e]=t[e];S.prototype[e]=function(){var t=[this._wrapped];return u.apply(t,arguments),V.call(this,n.apply(S,t))}})};var T=0;S.uniqueId=function(t){var e=++T+"";return t?t+e:e},S.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var C=/(.)^/,q={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\t|\u2028|\u2029/g;S.template=function(t,e,n){var r;n=S.defaults({},n,S.templateSettings);var i=new RegExp([(n.escape||C).source,(n.interpolate||C).source,(n.evaluate||C).source].join("|")+"|$","g"),o=0,s="__p+='";t.replace(i,function(e,n,r,i,a){return s+=t.slice(o,a).replace(D,function(t){return"\\"+q[t]}),n&&(s+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),r&&(s+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(s+="';\n"+i+"\n__p+='"),o=a+e.length,e}),s+="';\n",n.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{r=new Function(n.variable||"obj","_",s)}catch(t){throw t.source=s,t}if(e)return r(e,S);var a=function(t){return r.call(this,t,S)};return a.source="function("+(n.variable||"obj")+"){\n"+s+"}",a},S.chain=function(t){return S(t).chain()};var V=function(t){return this._chain?S(t).chain():t};S.mixin(S),P(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=o[t];S.prototype[t]=function(){var n=this._wrapped;return e.apply(n,arguments),"shift"!=t&&"splice"!=t||0!==n.length||delete n[0],V.call(this,n)}}),P(["concat","join","slice"],function(t){var e=o[t];S.prototype[t]=function(){return V.call(this,e.apply(this._wrapped,arguments))}}),S.extend(S.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this)},function(t,e,n){!function(t){"use strict";var n={};n.exports=e,function(t){if(!e)var e=1e-6;if(!n)var n="undefined"!=typeof Float32Array?Float32Array:Array;if(!r)var r=Math.random;var i={};i.setMatrixArrayType=function(t){n=t},void 0!==t&&(t.glMatrix=i);var o=Math.PI/180;i.toRadian=function(t){return t*o};var s={};s.create=function(){var t=new n(2);return t[0]=0,t[1]=0,t},s.clone=function(t){var e=new n(2);return e[0]=t[0],e[1]=t[1],e},s.fromValues=function(t,e){var r=new n(2);return r[0]=t,r[1]=e,r},s.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},s.set=function(t,e,n){return t[0]=e,t[1]=n,t},s.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t},s.subtract=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t},s.sub=s.subtract,s.multiply=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t},s.mul=s.multiply,s.divide=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t},s.div=s.divide,s.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t},s.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t},s.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t},s.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t},s.distance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.sqrt(n*n+r*r)},s.dist=s.distance,s.squaredDistance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r},s.sqrDist=s.squaredDistance,s.length=function(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)},s.len=s.length,s.squaredLength=function(t){var e=t[0],n=t[1];return e*e+n*n},s.sqrLen=s.squaredLength,s.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},s.normalize=function(t,e){var n=e[0],r=e[1],i=n*n+r*r;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t},s.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},s.cross=function(t,e,n){var r=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=r,t},s.lerp=function(t,e,n,r){var i=e[0],o=e[1];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t},s.random=function(t,e){e=e||1;var n=2*r()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t},s.transformMat2=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i,t[1]=n[1]*r+n[3]*i,t},s.transformMat2d=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i+n[4],t[1]=n[1]*r+n[3]*i+n[5],t},s.transformMat3=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[3]*i+n[6],t[1]=n[1]*r+n[4]*i+n[7],t},s.transformMat4=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t},s.forEach=function(){var t=s.create();return function(e,n,r,i,o,s){var a,u;for(n||(n=2),r||(r=0),u=i?Math.min(i*n+r,e.length):e.length,a=r;a<u;a+=n)t[0]=e[a],t[1]=e[a+1],o(t,t,s),e[a]=t[0],e[a+1]=t[1];return e}}(),s.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},void 0!==t&&(t.vec2=s);var a={};a.create=function(){var t=new n(3);return t[0]=0,t[1]=0,t[2]=0,t},a.clone=function(t){var e=new n(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},a.fromValues=function(t,e,r){var i=new n(3);return i[0]=t,i[1]=e,i[2]=r,i},a.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},a.set=function(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t},a.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t},a.subtract=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t},a.sub=a.subtract,a.multiply=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t},a.mul=a.multiply,a.divide=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t},a.div=a.divide,a.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t},a.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t},a.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t},a.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t},a.distance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(n*n+r*r+i*i)},a.dist=a.distance,a.squaredDistance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return n*n+r*r+i*i},a.sqrDist=a.squaredDistance,a.length=function(t){var e=t[0],n=t[1],r=t[2];return Math.sqrt(e*e+n*n+r*r)},a.len=a.length,a.squaredLength=function(t){var e=t[0],n=t[1],r=t[2];return e*e+n*n+r*r},a.sqrLen=a.squaredLength,a.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},a.normalize=function(t,e){var n=e[0],r=e[1],i=e[2],o=n*n+r*r+i*i;return o>0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t},a.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},a.cross=function(t,e,n){var r=e[0],i=e[1],o=e[2],s=n[0],a=n[1],u=n[2];return t[0]=i*u-o*a,t[1]=o*s-r*u,t[2]=r*a-i*s,t},a.lerp=function(t,e,n,r){var i=e[0],o=e[1],s=e[2];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t[2]=s+r*(n[2]-s),t},a.random=function(t,e){e=e||1;var n=2*r()*Math.PI,i=2*r()-1,o=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(n)*o,t[1]=Math.sin(n)*o,t[2]=i*e,t},a.transformMat4=function(t,e,n){var r=e[0],i=e[1],o=e[2];return t[0]=n[0]*r+n[4]*i+n[8]*o+n[12],t[1]=n[1]*r+n[5]*i+n[9]*o+n[13],t[2]=n[2]*r+n[6]*i+n[10]*o+n[14],t},a.transformMat3=function(t,e,n){var r=e[0],i=e[1],o=e[2];return t[0]=r*n[0]+i*n[3]+o*n[6],t[1]=r*n[1]+i*n[4]+o*n[7],t[2]=r*n[2]+i*n[5]+o*n[8],t},a.transformQuat=function(t,e,n){var r=e[0],i=e[1],o=e[2],s=n[0],a=n[1],u=n[2],c=n[3],l=c*r+a*o-u*i,h=c*i+u*r-s*o,p=c*o+s*i-a*r,f=-s*r-a*i-u*o;return t[0]=l*c+f*-s+h*-u-p*-a,t[1]=h*c+f*-a+p*-s-l*-u,t[2]=p*c+f*-u+l*-a-h*-s,t},a.rotateX=function(t,e,n,r){var i=[],o=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],o[0]=i[0],o[1]=i[1]*Math.cos(r)-i[2]*Math.sin(r),o[2]=i[1]*Math.sin(r)+i[2]*Math.cos(r),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t},a.rotateY=function(t,e,n,r){var i=[],o=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],o[0]=i[2]*Math.sin(r)+i[0]*Math.cos(r),o[1]=i[1],o[2]=i[2]*Math.cos(r)-i[0]*Math.sin(r),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t},a.rotateZ=function(t,e,n,r){var i=[],o=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],o[0]=i[0]*Math.cos(r)-i[1]*Math.sin(r),o[1]=i[0]*Math.sin(r)+i[1]*Math.cos(r),o[2]=i[2],t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t},a.forEach=function(){var t=a.create();return function(e,n,r,i,o,s){var a,u;for(n||(n=3),r||(r=0),u=i?Math.min(i*n+r,e.length):e.length,a=r;a<u;a+=n)t[0]=e[a],t[1]=e[a+1],t[2]=e[a+2],o(t,t,s),e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2];return e}}(),a.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},void 0!==t&&(t.vec3=a);var u={};u.create=function(){var t=new n(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},u.clone=function(t){var e=new n(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},u.fromValues=function(t,e,r,i){var o=new n(4);return o[0]=t,o[1]=e,o[2]=r,o[3]=i,o},u.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},u.set=function(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t},u.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},u.subtract=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t},u.sub=u.subtract,u.multiply=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t},u.mul=u.multiply,u.divide=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t},u.div=u.divide,u.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t[3]=Math.min(e[3],n[3]),t},u.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t},u.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},u.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t},u.distance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return Math.sqrt(n*n+r*r+i*i+o*o)},u.dist=u.distance,u.squaredDistance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return n*n+r*r+i*i+o*o},u.sqrDist=u.squaredDistance,u.length=function(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Math.sqrt(e*e+n*n+r*r+i*i)},u.len=u.length,u.squaredLength=function(t){var e=t[0],n=t[1],r=t[2],i=t[3];return e*e+n*n+r*r+i*i},u.sqrLen=u.squaredLength,u.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},u.normalize=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=n*n+r*r+i*i+o*o;return s>0&&(s=1/Math.sqrt(s),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s),t},u.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},u.lerp=function(t,e,n,r){var i=e[0],o=e[1],s=e[2],a=e[3];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t[2]=s+r*(n[2]-s),t[3]=a+r*(n[3]-a),t},u.random=function(t,e){return e=e||1,t[0]=r(),t[1]=r(),t[2]=r(),t[3]=r(),u.normalize(t,t),u.scale(t,t,e),t},u.transformMat4=function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*o+n[12]*s,t[1]=n[1]*r+n[5]*i+n[9]*o+n[13]*s,t[2]=n[2]*r+n[6]*i+n[10]*o+n[14]*s,t[3]=n[3]*r+n[7]*i+n[11]*o+n[15]*s,t},u.transformQuat=function(t,e,n){var r=e[0],i=e[1],o=e[2],s=n[0],a=n[1],u=n[2],c=n[3],l=c*r+a*o-u*i,h=c*i+u*r-s*o,p=c*o+s*i-a*r,f=-s*r-a*i-u*o;return t[0]=l*c+f*-s+h*-u-p*-a,t[1]=h*c+f*-a+p*-s-l*-u,t[2]=p*c+f*-u+l*-a-h*-s,t},u.forEach=function(){var t=u.create();return function(e,n,r,i,o,s){var a,u;for(n||(n=4),r||(r=0),u=i?Math.min(i*n+r,e.length):e.length,a=r;a<u;a+=n)t[0]=e[a],t[1]=e[a+1],t[2]=e[a+2],t[3]=e[a+3],o(t,t,s),e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2],e[a+3]=t[3];return e}}(),u.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},void 0!==t&&(t.vec4=u);var c={};c.create=function(){var t=new n(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},c.clone=function(t){var e=new n(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},c.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},c.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},c.transpose=function(t,e){if(t===e){var n=e[1];t[1]=e[2],t[2]=n}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t},c.invert=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=n*o-i*r;return s?(s=1/s,t[0]=o*s,t[1]=-r*s,t[2]=-i*s,t[3]=n*s,t):null},c.adjoint=function(t,e){var n=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=n,t},c.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},c.multiply=function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=n[0],u=n[1],c=n[2],l=n[3];return t[0]=r*a+o*u,t[1]=i*a+s*u,t[2]=r*c+o*l,t[3]=i*c+s*l,t},c.mul=c.multiply,c.rotate=function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=Math.sin(n),u=Math.cos(n);return t[0]=r*u+o*a,t[1]=i*u+s*a,t[2]=r*-a+o*u,t[3]=i*-a+s*u,t},c.scale=function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=n[0],u=n[1];return t[0]=r*a,t[1]=i*a,t[2]=o*u,t[3]=s*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,e,n,r){return t[2]=r[2]/r[0],n[0]=r[0],n[1]=r[1],n[3]=r[3]-t[2]*n[1],[t,e,n]},void 0!==t&&(t.mat2=c);var l={};l.create=function(){var t=new n(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 e=new n(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},l.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[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,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=e[4],a=e[5],u=n*o-r*i;return u?(u=1/u,t[0]=o*u,t[1]=-r*u,t[2]=-i*u,t[3]=n*u,t[4]=(i*a-o*s)*u,t[5]=(r*s-n*a)*u,t):null},l.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},l.multiply=function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=e[4],u=e[5],c=n[0],l=n[1],h=n[2],p=n[3],f=n[4],d=n[5];return t[0]=r*c+o*l,t[1]=i*c+s*l,t[2]=r*h+o*p,t[3]=i*h+s*p,t[4]=r*f+o*d+a,t[5]=i*f+s*d+u,t},l.mul=l.multiply,l.rotate=function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=e[4],u=e[5],c=Math.sin(n),l=Math.cos(n);return t[0]=r*l+o*c,t[1]=i*l+s*c,t[2]=r*-c+o*l,t[3]=i*-c+s*l,t[4]=a,t[5]=u,t},l.scale=function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=e[4],u=e[5],c=n[0],l=n[1];return t[0]=r*c,t[1]=i*c,t[2]=o*l,t[3]=s*l,t[4]=a,t[5]=u,t},l.translate=function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=e[4],u=e[5],c=n[0],l=n[1];return t[0]=r,t[1]=i,t[2]=o,t[3]=s,t[4]=r*c+o*l+a,t[5]=i*c+s*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)},void 0!==t&&(t.mat2d=l);var h={};h.create=function(){var t=new n(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},h.fromMat4=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t},h.clone=function(t){var e=new n(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},h.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},h.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},h.transpose=function(t,e){if(t===e){var n=e[1],r=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=r,t[7]=i}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t},h.invert=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=e[4],a=e[5],u=e[6],c=e[7],l=e[8],h=l*s-a*c,p=-l*o+a*u,f=c*o-s*u,d=n*h+r*p+i*f;return d?(d=1/d,t[0]=h*d,t[1]=(-l*r+i*c)*d,t[2]=(a*r-i*s)*d,t[3]=p*d,t[4]=(l*n-i*u)*d,t[5]=(-a*n+i*o)*d,t[6]=f*d,t[7]=(-c*n+r*u)*d,t[8]=(s*n-r*o)*d,t):null},h.adjoint=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=e[4],a=e[5],u=e[6],c=e[7],l=e[8];return t[0]=s*l-a*c,t[1]=i*c-r*l,t[2]=r*a-i*s,t[3]=a*u-o*l,t[4]=n*l-i*u,t[5]=i*o-n*a,t[6]=o*c-s*u,t[7]=r*u-n*c,t[8]=n*s-r*o,t},h.determinant=function(t){var e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],s=t[5],a=t[6],u=t[7],c=t[8];return e*(c*o-s*u)+n*(-c*i+s*a)+r*(u*i-o*a)},h.multiply=function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=e[4],u=e[5],c=e[6],l=e[7],h=e[8],p=n[0],f=n[1],d=n[2],v=n[3],m=n[4],y=n[5],g=n[6],b=n[7],w=n[8];return t[0]=p*r+f*s+d*c,t[1]=p*i+f*a+d*l,t[2]=p*o+f*u+d*h,t[3]=v*r+m*s+y*c,t[4]=v*i+m*a+y*l,t[5]=v*o+m*u+y*h,t[6]=g*r+b*s+w*c,t[7]=g*i+b*a+w*l,t[8]=g*o+b*u+w*h,t},h.mul=h.multiply,h.translate=function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=e[4],u=e[5],c=e[6],l=e[7],h=e[8],p=n[0],f=n[1];return t[0]=r,t[1]=i,t[2]=o,t[3]=s,t[4]=a,t[5]=u,t[6]=p*r+f*s+c,t[7]=p*i+f*a+l,t[8]=p*o+f*u+h,t},h.rotate=function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=e[4],u=e[5],c=e[6],l=e[7],h=e[8],p=Math.sin(n),f=Math.cos(n);return t[0]=f*r+p*s,t[1]=f*i+p*a,t[2]=f*o+p*u,t[3]=f*s-p*r,t[4]=f*a-p*i,t[5]=f*u-p*o,t[6]=c,t[7]=l,t[8]=h,t},h.scale=function(t,e,n){var r=n[0],i=n[1];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},h.fromMat2d=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t},h.fromQuat=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=n+n,a=r+r,u=i+i,c=n*s,l=r*s,h=r*a,p=i*s,f=i*a,d=i*u,v=o*s,m=o*a,y=o*u;return t[0]=1-h-d,t[3]=l-y,t[6]=p+m,t[1]=l+y,t[4]=1-c-d,t[7]=f-v,t[2]=p-m,t[5]=f+v,t[8]=1-c-h,t},h.normalFromMat4=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=e[4],a=e[5],u=e[6],c=e[7],l=e[8],h=e[9],p=e[10],f=e[11],d=e[12],v=e[13],m=e[14],y=e[15],g=n*a-r*s,b=n*u-i*s,w=n*c-o*s,x=r*u-i*a,M=r*c-o*a,_=i*c-o*u,j=l*v-h*d,S=l*m-p*d,P=l*y-f*d,F=h*m-p*v,O=h*y-f*v,E=p*y-f*m,k=g*E-b*O+w*F+x*P-M*S+_*j;return k?(k=1/k,t[0]=(a*E-u*O+c*F)*k,t[1]=(u*P-s*E-c*S)*k,t[2]=(s*O-a*P+c*j)*k,t[3]=(i*O-r*E-o*F)*k,t[4]=(n*E-i*P+o*S)*k,t[5]=(r*P-n*O-o*j)*k,t[6]=(v*_-m*M+y*x)*k,t[7]=(m*w-d*_-y*b)*k,t[8]=(d*M-v*w+y*g)*k,t):null},h.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},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[7],2)+Math.pow(t[8],2))},void 0!==t&&(t.mat3=h);var p={};p.create=function(){var t=new n(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},p.clone=function(t){var e=new n(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},p.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},p.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},p.transpose=function(t,e){if(t===e){var n=e[1],r=e[2],i=e[3],o=e[6],s=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=o,t[11]=e[14],t[12]=i,t[13]=s,t[14]=a}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t},p.invert=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=e[4],a=e[5],u=e[6],c=e[7],l=e[8],h=e[9],p=e[10],f=e[11],d=e[12],v=e[13],m=e[14],y=e[15],g=n*a-r*s,b=n*u-i*s,w=n*c-o*s,x=r*u-i*a,M=r*c-o*a,_=i*c-o*u,j=l*v-h*d,S=l*m-p*d,P=l*y-f*d,F=h*m-p*v,O=h*y-f*v,E=p*y-f*m,k=g*E-b*O+w*F+x*P-M*S+_*j;return k?(k=1/k,t[0]=(a*E-u*O+c*F)*k,t[1]=(i*O-r*E-o*F)*k,t[2]=(v*_-m*M+y*x)*k,t[3]=(p*M-h*_-f*x)*k,t[4]=(u*P-s*E-c*S)*k,t[5]=(n*E-i*P+o*S)*k,t[6]=(m*w-d*_-y*b)*k,t[7]=(l*_-p*w+f*b)*k,t[8]=(s*O-a*P+c*j)*k,t[9]=(r*P-n*O-o*j)*k,t[10]=(d*M-v*w+y*g)*k,t[11]=(h*w-l*M-f*g)*k,t[12]=(a*S-s*F-u*j)*k,t[13]=(n*F-r*S+i*j)*k,t[14]=(v*b-d*x-m*g)*k,t[15]=(l*x-h*b+p*g)*k,t):null},p.adjoint=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=e[4],a=e[5],u=e[6],c=e[7],l=e[8],h=e[9],p=e[10],f=e[11],d=e[12],v=e[13],m=e[14],y=e[15];return t[0]=a*(p*y-f*m)-h*(u*y-c*m)+v*(u*f-c*p),t[1]=-(r*(p*y-f*m)-h*(i*y-o*m)+v*(i*f-o*p)),t[2]=r*(u*y-c*m)-a*(i*y-o*m)+v*(i*c-o*u),t[3]=-(r*(u*f-c*p)-a*(i*f-o*p)+h*(i*c-o*u)),t[4]=-(s*(p*y-f*m)-l*(u*y-c*m)+d*(u*f-c*p)),t[5]=n*(p*y-f*m)-l*(i*y-o*m)+d*(i*f-o*p),t[6]=-(n*(u*y-c*m)-s*(i*y-o*m)+d*(i*c-o*u)),t[7]=n*(u*f-c*p)-s*(i*f-o*p)+l*(i*c-o*u),t[8]=s*(h*y-f*v)-l*(a*y-c*v)+d*(a*f-c*h),t[9]=-(n*(h*y-f*v)-l*(r*y-o*v)+d*(r*f-o*h)),t[10]=n*(a*y-c*v)-s*(r*y-o*v)+d*(r*c-o*a),t[11]=-(n*(a*f-c*h)-s*(r*f-o*h)+l*(r*c-o*a)),t[12]=-(s*(h*m-p*v)-l*(a*m-u*v)+d*(a*p-u*h)),t[13]=n*(h*m-p*v)-l*(r*m-i*v)+d*(r*p-i*h),t[14]=-(n*(a*m-u*v)-s*(r*m-i*v)+d*(r*u-i*a)),t[15]=n*(a*p-u*h)-s*(r*p-i*h)+l*(r*u-i*a),t},p.determinant=function(t){var e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],s=t[5],a=t[6],u=t[7],c=t[8],l=t[9],h=t[10],p=t[11],f=t[12],d=t[13],v=t[14],m=t[15];return(e*s-n*o)*(h*m-p*v)-(e*a-r*o)*(l*m-p*d)+(e*u-i*o)*(l*v-h*d)+(n*a-r*s)*(c*m-p*f)-(n*u-i*s)*(c*v-h*f)+(r*u-i*a)*(c*d-l*f)},p.multiply=function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=e[4],u=e[5],c=e[6],l=e[7],h=e[8],p=e[9],f=e[10],d=e[11],v=e[12],m=e[13],y=e[14],g=e[15],b=n[0],w=n[1],x=n[2],M=n[3];return t[0]=b*r+w*a+x*h+M*v,t[1]=b*i+w*u+x*p+M*m,t[2]=b*o+w*c+x*f+M*y,t[3]=b*s+w*l+x*d+M*g,b=n[4],w=n[5],x=n[6],M=n[7],t[4]=b*r+w*a+x*h+M*v,t[5]=b*i+w*u+x*p+M*m,t[6]=b*o+w*c+x*f+M*y,t[7]=b*s+w*l+x*d+M*g,b=n[8],w=n[9],x=n[10],M=n[11],t[8]=b*r+w*a+x*h+M*v,t[9]=b*i+w*u+x*p+M*m,t[10]=b*o+w*c+x*f+M*y,t[11]=b*s+w*l+x*d+M*g,b=n[12],w=n[13],x=n[14],M=n[15],t[12]=b*r+w*a+x*h+M*v,t[13]=b*i+w*u+x*p+M*m,t[14]=b*o+w*c+x*f+M*y,t[15]=b*s+w*l+x*d+M*g,t},p.mul=p.multiply,p.translate=function(t,e,n){var r,i,o,s,a,u,c,l,h,p,f,d,v=n[0],m=n[1],y=n[2];return e===t?(t[12]=e[0]*v+e[4]*m+e[8]*y+e[12],t[13]=e[1]*v+e[5]*m+e[9]*y+e[13],t[14]=e[2]*v+e[6]*m+e[10]*y+e[14],t[15]=e[3]*v+e[7]*m+e[11]*y+e[15]):(r=e[0],i=e[1],o=e[2],s=e[3],a=e[4],u=e[5],c=e[6],l=e[7],h=e[8],p=e[9],f=e[10],d=e[11],t[0]=r,t[1]=i,t[2]=o,t[3]=s,t[4]=a,t[5]=u,t[6]=c,t[7]=l,t[8]=h,t[9]=p,t[10]=f,t[11]=d,t[12]=r*v+a*m+h*y+e[12],t[13]=i*v+u*m+p*y+e[13],t[14]=o*v+c*m+f*y+e[14],t[15]=s*v+l*m+d*y+e[15]),t},p.scale=function(t,e,n){var r=n[0],i=n[1],o=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},p.rotate=function(t,n,r,i){var o,s,a,u,c,l,h,p,f,d,v,m,y,g,b,w,x,M,_,j,S,P,F,O,E=i[0],k=i[1],A=i[2],z=Math.sqrt(E*E+k*k+A*A);return Math.abs(z)<e?null:(z=1/z,E*=z,k*=z,A*=z,o=Math.sin(r),s=Math.cos(r),a=1-s,u=n[0],c=n[1],l=n[2],h=n[3],p=n[4],f=n[5],d=n[6],v=n[7],m=n[8],y=n[9],g=n[10],b=n[11],w=E*E*a+s,x=k*E*a+A*o,M=A*E*a-k*o,_=E*k*a-A*o,j=k*k*a+s,S=A*k*a+E*o,P=E*A*a+k*o,F=k*A*a-E*o,O=A*A*a+s,t[0]=u*w+p*x+m*M,t[1]=c*w+f*x+y*M,t[2]=l*w+d*x+g*M,t[3]=h*w+v*x+b*M,t[4]=u*_+p*j+m*S,t[5]=c*_+f*j+y*S,t[6]=l*_+d*j+g*S,t[7]=h*_+v*j+b*S,t[8]=u*P+p*F+m*O,t[9]=c*P+f*F+y*O,t[10]=l*P+d*F+g*O,t[11]=h*P+v*F+b*O,n!==t&&(t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t)},p.rotateX=function(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[4],s=e[5],a=e[6],u=e[7],c=e[8],l=e[9],h=e[10],p=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+c*r,t[5]=s*i+l*r,t[6]=a*i+h*r,t[7]=u*i+p*r,t[8]=c*i-o*r,t[9]=l*i-s*r,t[10]=h*i-a*r,t[11]=p*i-u*r,t},p.rotateY=function(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[0],s=e[1],a=e[2],u=e[3],c=e[8],l=e[9],h=e[10],p=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-c*r,t[1]=s*i-l*r,t[2]=a*i-h*r,t[3]=u*i-p*r,t[8]=o*r+c*i,t[9]=s*r+l*i,t[10]=a*r+h*i,t[11]=u*r+p*i,t},p.rotateZ=function(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[0],s=e[1],a=e[2],u=e[3],c=e[4],l=e[5],h=e[6],p=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+c*r,t[1]=s*i+l*r,t[2]=a*i+h*r,t[3]=u*i+p*r,t[4]=c*i-o*r,t[5]=l*i-s*r,t[6]=h*i-a*r,t[7]=p*i-u*r,t},p.fromRotationTranslation=function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=r+r,u=i+i,c=o+o,l=r*a,h=r*u,p=r*c,f=i*u,d=i*c,v=o*c,m=s*a,y=s*u,g=s*c;return t[0]=1-(f+v),t[1]=h+g,t[2]=p-y,t[3]=0,t[4]=h-g,t[5]=1-(l+v),t[6]=d+m,t[7]=0,t[8]=p+y,t[9]=d-m,t[10]=1-(l+f),t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},p.fromQuat=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=n+n,a=r+r,u=i+i,c=n*s,l=r*s,h=r*a,p=i*s,f=i*a,d=i*u,v=o*s,m=o*a,y=o*u;return t[0]=1-h-d,t[1]=l+y,t[2]=p-m,t[3]=0,t[4]=l-y,t[5]=1-c-d,t[6]=f+v,t[7]=0,t[8]=p+m,t[9]=f-v,t[10]=1-c-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},p.frustum=function(t,e,n,r,i,o,s){var a=1/(n-e),u=1/(i-r),c=1/(o-s);return t[0]=2*o*a,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]=(n+e)*a,t[9]=(i+r)*u,t[10]=(s+o)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=s*o*2*c,t[15]=0,t},p.perspective=function(t,e,n,r,i){var o=1/Math.tan(e/2),s=1/(r-i);return t[0]=o/n,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+r)*s,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*r*s,t[15]=0,t},p.ortho=function(t,e,n,r,i,o,s){var a=1/(e-n),u=1/(r-i),c=1/(o-s);return t[0]=-2*a,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]=(e+n)*a,t[13]=(i+r)*u,t[14]=(s+o)*c,t[15]=1,t},p.lookAt=function(t,n,r,i){var o,s,a,u,c,l,h,f,d,v,m=n[0],y=n[1],g=n[2],b=i[0],w=i[1],x=i[2],M=r[0],_=r[1],j=r[2];return Math.abs(m-M)<e&&Math.abs(y-_)<e&&Math.abs(g-j)<e?p.identity(t):(h=m-M,f=y-_,d=g-j,v=1/Math.sqrt(h*h+f*f+d*d),h*=v,f*=v,d*=v,o=w*d-x*f,s=x*h-b*d,a=b*f-w*h,v=Math.sqrt(o*o+s*s+a*a),v?(v=1/v,o*=v,s*=v,a*=v):(o=0,s=0,a=0),u=f*a-d*s,c=d*o-h*a,l=h*s-f*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]=h,t[3]=0,t[4]=s,t[5]=c,t[6]=f,t[7]=0,t[8]=a,t[9]=l,t[10]=d,t[11]=0,t[12]=-(o*m+s*y+a*g),t[13]=-(u*m+c*y+l*g),t[14]=-(h*m+f*y+d*g),t[15]=1,t)},p.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]+")"},p.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))},void 0!==t&&(t.mat4=p);var f={};f.create=function(){var t=new n(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},f.rotationTo=function(){var t=a.create(),e=a.fromValues(1,0,0),n=a.fromValues(0,1,0);return function(r,i,o){var s=a.dot(i,o);return s<-.999999?(a.cross(t,e,i),a.length(t)<1e-6&&a.cross(t,n,i),a.normalize(t,t),f.setAxisAngle(r,t,Math.PI),r):s>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(a.cross(t,i,o),r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=1+s,f.normalize(r,r))}}(),f.setAxes=function(){var t=h.create();return function(e,n,r,i){return t[0]=r[0],t[3]=r[1],t[6]=r[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-n[0],t[5]=-n[1],t[8]=-n[2],f.normalize(e,f.fromMat3(e,t))}}(),f.clone=u.clone,f.fromValues=u.fromValues,f.copy=u.copy,f.set=u.set,f.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},f.setAxisAngle=function(t,e,n){n*=.5;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t},f.add=u.add,f.multiply=function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=n[0],u=n[1],c=n[2],l=n[3];return t[0]=r*l+s*a+i*c-o*u,t[1]=i*l+s*u+o*a-r*c,t[2]=o*l+s*c+r*u-i*a,t[3]=s*l-r*a-i*u-o*c,t},f.mul=f.multiply,f.scale=u.scale,f.rotateX=function(t,e,n){n*=.5;var r=e[0],i=e[1],o=e[2],s=e[3],a=Math.sin(n),u=Math.cos(n);return t[0]=r*u+s*a,t[1]=i*u+o*a,t[2]=o*u-i*a,t[3]=s*u-r*a,t},f.rotateY=function(t,e,n){n*=.5;var r=e[0],i=e[1],o=e[2],s=e[3],a=Math.sin(n),u=Math.cos(n);return t[0]=r*u-o*a,t[1]=i*u+s*a,t[2]=o*u+r*a,t[3]=s*u-i*a,t},f.rotateZ=function(t,e,n){n*=.5;var r=e[0],i=e[1],o=e[2],s=e[3],a=Math.sin(n),u=Math.cos(n);return t[0]=r*u+i*a,t[1]=i*u-r*a,t[2]=o*u+s*a,t[3]=s*u-o*a,t},f.calculateW=function(t,e){var n=e[0],r=e[1],i=e[2];return t[0]=n,t[1]=r,t[2]=i,t[3]=-Math.sqrt(Math.abs(1-n*n-r*r-i*i)),t},f.dot=u.dot,f.lerp=u.lerp,f.slerp=function(t,e,n,r){var i,o,s,a,u,c=e[0],l=e[1],h=e[2],p=e[3],f=n[0],d=n[1],v=n[2],m=n[3];return o=c*f+l*d+h*v+p*m,o<0&&(o=-o,f=-f,d=-d,v=-v,m=-m),1-o>1e-6?(i=Math.acos(o),s=Math.sin(i),a=Math.sin((1-r)*i)/s,u=Math.sin(r*i)/s):(a=1-r,u=r),t[0]=a*c+u*f,t[1]=a*l+u*d,t[2]=a*h+u*v,t[3]=a*p+u*m,t},f.invert=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=n*n+r*r+i*i+o*o,a=s?1/s:0;return t[0]=-n*a,t[1]=-r*a,t[2]=-i*a,t[3]=o*a,t},f.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},f.length=u.length,f.len=f.length,f.squaredLength=u.squaredLength,f.sqrLen=f.squaredLength,f.normalize=u.normalize,f.fromMat3=function(t,e){var n,r=e[0]+e[4]+e[8];if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[7]-e[5])*n,t[1]=(e[2]-e[6])*n,t[2]=(e[3]-e[1])*n;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var o=(i+1)%3,s=(i+2)%3;n=Math.sqrt(e[3*i+i]-e[3*o+o]-e[3*s+s]+1),t[i]=.5*n,n=.5/n,t[3]=(e[3*s+o]-e[3*o+s])*n,t[o]=(e[3*o+i]+e[3*i+o])*n,t[s]=(e[3*s+i]+e[3*i+s])*n}return t},f.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},void 0!==t&&(t.quat=f)}(n.exports)}()},function(t,e,n){var r=n(1),i=(r.vec3,t.exports=function(t){this.valid=!0,this.id=t.id,this.handId=t.handId,this.length=t.length,this.tool=t.tool,this.width=t.width,this.direction=t.direction,this.stabilizedTipPosition=t.stabilizedTipPosition,this.tipPosition=t.tipPosition,this.tipVelocity=t.tipVelocity,this.touchZone=t.touchZone,this.touchDistance=t.touchDistance,this.timeVisible=t.timeVisible});i.prototype.toString=function(){return"Pointable [ id:"+this.id+" "+this.length+"mmx | width:"+this.width+"mm | direction:"+this.direction+" ]"},i.prototype.hand=function(){return this.frame.hand(this.handId)},i.Invalid={valid:!1}},function(t,e){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(t){return"function"==typeof t}function i(t){return"number"==typeof t}function o(t){return"object"==typeof t&&null!==t}function s(t){return void 0===t}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!i(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,n,i,a,u,c;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var l=new Error('Uncaught, unspecified "error" event. ('+e+")");throw l.context=e,l}if(n=this._events[t],s(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),n.apply(this,a)}else if(o(n))for(a=Array.prototype.slice.call(arguments,1),c=n.slice(),i=c.length,u=0;u<i;u++)c[u].apply(this,a);return!0},n.prototype.addListener=function(t,e){var i;if(!r(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,r(e.listener)?e.listener:e),this._events[t]?o(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,o(this._events[t])&&!this._events[t].warned&&(i=s(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&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),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function n(){this.removeListener(t,n),i||(i=!0,e.apply(this,arguments))}if(!r(e))throw TypeError("listener must be a function");var i=!1;return n.listener=e,this.on(t,n),this},n.prototype.removeListener=function(t,e){var n,i,s,a;if(!r(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],s=n.length,i=-1,n===e||r(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(n)){for(a=s;a-- >0;)if(n[a]===e||n[a].listener&&n[a].listener===e){i=a;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,n;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(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],r(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){return this._events&&this._events[t]?r(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(r(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,n){var r=n(2),i=n(14),o=n(1),s=o.mat3,a=o.vec3,u=n(0),c=t.exports=function(t){this.id=t.id,this.palmPosition=t.palmPosition,this.direction=t.direction,this.palmVelocity=t.palmVelocity,this.palmNormal=t.palmNormal,this.sphereCenter=t.sphereCenter,this.sphereRadius=t.sphereRadius,this.valid=!0,this.pointables=[],this.fingers=[],t.armBasis?this.arm=new i(this,{type:4,width:t.armWidth,prevJoint:t.elbow,nextJoint:t.wrist,basis:t.armBasis}):this.arm=null,this.tools=[],this._translation=t.t,this._rotation=u.flatten(t.r),this._scaleFactor=t.s,this.timeVisible=t.timeVisible,this.stabilizedPalmPosition=t.stabilizedPalmPosition,this.type=t.type,this.grabStrength=t.grabStrength,this.pinchStrength=t.pinchStrength,this.confidence=t.confidence};c.prototype.finger=function(t){var e=this.frame.finger(t);return e&&e.handId==this.id?e:r.Invalid},c.prototype.rotationAngle=function(t,e){if(!this.valid||!t.valid)return 0;if(!t.hand(this.id).valid)return 0;var n=this.rotationMatrix(t),r=.5*(n[0]+n[4]+n[8]-1),i=Math.acos(r);if(i=isNaN(i)?0:i,void 0!==e){var o=this.rotationAxis(t);i*=a.dot(o,a.normalize(a.create(),e))}return i},c.prototype.rotationAxis=function(t){if(!this.valid||!t.valid)return a.create();var e=t.hand(this.id);return e.valid?a.normalize(a.create(),[this._rotation[7]-e._rotation[5],this._rotation[2]-e._rotation[6],this._rotation[3]-e._rotation[1]]):a.create()},c.prototype.rotationMatrix=function(t){if(!this.valid||!t.valid)return s.create();var e=t.hand(this.id);if(!e.valid)return s.create();var n=s.transpose(s.create(),this._rotation);return s.multiply(s.create(),e._rotation,n)},c.prototype.scaleFactor=function(t){if(!this.valid||!t.valid)return 1;var e=t.hand(this.id);return e.valid?Math.exp(this._scaleFactor-e._scaleFactor):1},c.prototype.translation=function(t){if(!this.valid||!t.valid)return a.create();var e=t.hand(this.id);return e.valid?[this._translation[0]-e._translation[0],this._translation[1]-e._translation[1],this._translation[2]-e._translation[2]]:a.create()},c.prototype.toString=function(){return"Hand ("+this.type+") [ id: "+this.id+" | palm velocity:"+this.palmVelocity+" | sphere center:"+this.sphereCenter+" ] "},c.prototype.pitch=function(){return Math.atan2(this.direction[1],-this.direction[2])},c.prototype.yaw=function(){return Math.atan2(this.direction[0],-this.direction[2])},c.prototype.roll=function(){return Math.atan2(this.palmNormal[0],-this.palmNormal[1])},c.Invalid={valid:!1,fingers:[],tools:[],pointables:[],left:!1,pointable:function(){return r.Invalid},finger:function(){return r.Invalid},toString:function(){return"invalid frame"},dump:function(){return this.toString()},rotationAngle:function(){return 0},rotationMatrix:function(){return s.create()},rotationAxis:function(){return a.create()},scaleFactor:function(){return 1},translation:function(){return a.create()}}},function(t,e,n){var r=n(2),i=n(14),o=n(16),s=n(0),a=t.exports=function(t){r.call(this,t),this.dipPosition=t.dipPosition,this.pipPosition=t.pipPosition,this.mcpPosition=t.mcpPosition,this.carpPosition=t.carpPosition,this.extended=t.extended,this.type=t.type,this.finger=!0,this.positions=[this.carpPosition,this.mcpPosition,this.pipPosition,this.dipPosition,this.tipPosition],t.bases?this.addBones(t):o.warnBones()};s.extend(a.prototype,r.prototype),a.prototype.addBones=function(t){this.metacarpal=new i(this,{type:0,width:this.width,prevJoint:this.carpPosition,nextJoint:this.mcpPosition,basis:t.bases[0]}),this.proximal=new i(this,{type:1,width:this.width,prevJoint:this.mcpPosition,nextJoint:this.pipPosition,basis:t.bases[1]}),this.medial=new i(this,{type:2,width:this.width,prevJoint:this.pipPosition,nextJoint:this.dipPosition,basis:t.bases[2]}),this.distal=new i(this,{type:3,width:this.width,prevJoint:this.dipPosition,nextJoint:t.btipPosition,basis:t.bases[3]}),this.bones=[this.metacarpal,this.proximal,this.medial,this.distal]},a.prototype.toString=function(){return"Finger [ id:"+this.id+" "+this.length+"mmx | width:"+this.width+"mm | direction:"+this.direction+" ]"},a.Invalid={valid:!1}},function(t,e,n){var r=n(4),i=n(2),o=n(7).createGesture,s=n(1),a=s.mat3,u=s.vec3,c=n(15)