text: (()=>{var t={729:t=>{"use strict";var e=Object.prototype.hasOwnProperty,n="~";function r(){}function o(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function s(t,e,r,s,i){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new o(r,s||t,i),h=n?n+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function i(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var t,r,o=[];if(0===this._eventsCount)return o;for(r in t=this._events)e.call(t,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(t)):o},a.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,s=r.length,i=new Array(s);o<s;o++)i[o]=r[o].fn;return i},a.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},a.prototype.emit=function(t,e,r,o,s,i){var a=n?n+t:t;if(!this._events[a])return!1;var h,c,u=this._events[a],f=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),f){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,r),!0;case 4:return u.fn.call(u.context,e,r,o),!0;case 5:return u.fn.call(u.context,e,r,o,s),!0;case 6:return u.fn.call(u.context,e,r,o,s,i),!0}for(c=1,h=new Array(f-1);c<f;c++)h[c-1]=arguments[c];u.fn.apply(u.context,h)}else{var l,p=u.length;for(c=0;c<p;c++)switch(u[c].once&&this.removeListener(t,u[c].fn,void 0,!0),f){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,e);break;case 3:u[c].fn.call(u[c].context,e,r);break;case 4:u[c].fn.call(u[c].context,e,r,o);break;default:if(!h)for(l=1,h=new Array(f-1);l<f;l++)h[l-1]=arguments[l];u[c].fn.apply(u[c].context,h)}}return!0},a.prototype.on=function(t,e,n){return s(this,t,e,n,!1)},a.prototype.once=function(t,e,n){return s(this,t,e,n,!0)},a.prototype.removeListener=function(t,e,r,o){var s=n?n+t:t;if(!this._events[s])return this;if(!e)return i(this,s),this;var a=this._events[s];if(a.fn)a.fn!==e||o&&!a.once||r&&a.context!==r||i(this,s);else{for(var h=0,c=[],u=a.length;h<u;h++)(a[h].fn!==e||o&&!a[h].once||r&&a[h].context!==r)&&c.push(a[h]);c.length?this._events[s]=1===c.length?c[0]:c:i(this,s)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&i(this,e)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a},298:t=>{const e=/\((-?[.\d]+), (-?[.\d]+), (-?[.\d]+)\)/;class n{constructor(t,e,n){this.x=t,this.y=e,this.z=n}set(t,e,n){return this.x=t,this.y=e,this.z=n,this}update(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}floored(){return new n(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}offset(t,e,r){return new n(this.x+t,this.y+e,this.z+r)}translate(t,e,n){return this.x+=t,this.y+=e,this.z+=n,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}subtract(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}plus(t){return this.offset(t.x,t.y,t.z)}minus(t){return this.offset(-t.x,-t.y,-t.z)}scaled(t){return new n(this.x*t,this.y*t,this.z*t)}abs(){return new n(Math.abs(this.x),Math.abs(this.y),Math.abs(this.z))}volume(){return this.x*this.y*this.z}modulus(t){return new n(o(this.x,t.x),o(this.y,t.y),o(this.z,t.z))}distanceTo(t){var e=t.x-this.x,n=t.y-this.y,r=t.z-this.z;return Math.sqrt(e*e+n*n+r*r)}distanceSquared(t){var e=t.x-this.x,n=t.y-this.y,r=t.z-this.z;return e*e+n*n+r*r}equals(t){return this.x===t.x&&this.y===t.y&&this.z===t.z}toString(){return"("+this.x+", "+this.y+", "+this.z+")"}clone(){return this.offset(0,0,0)}min(t){return new n(Math.min(this.x,t.x),Math.min(this.y,t.y),Math.min(this.z,t.z))}max(t){return new n(Math.max(this.x,t.x),Math.max(this.y,t.y),Math.max(this.z,t.z))}norm(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}cross(t){return new n(this.y*t.z-this.z*t.y,this.z*t.x-this.x*t.z,this.x*t.y-this.y*t.x)}unit(){const t=this.norm();return 0===t?this.clone():this.scaled(1/t)}normalize(){const t=this.norm();return 0!==t&&(this.x/=t,this.y/=t,this.z/=t),this}scale(t){return this.x*=t,this.y*=t,this.z*=t,this}xyDistanceTo(t){var e=t.x-this.x,n=t.y-this.y;return Math.sqrt(e*e+n*n)}xzDistanceTo(t){var e=t.x-this.x,n=t.z-this.z;return Math.sqrt(e*e+n*n)}yzDistanceTo(t){var e=t.y-this.y,n=t.z-this.z;return Math.sqrt(e*e+n*n)}innerProduct(t){return this.x*t.x+this.y*t.y+this.z*t.z}manhattanDistanceTo(t){return Math.abs(t.x-this.x)+Math.abs(t.y-this.y)+Math.abs(t.z-this.z)}toArray(){return[this.x,this.y,this.z]}}function r(t,r,o){if(null==t)return new n(0,0,0);if(Array.isArray(t))return new n(parseFloat(t[0],10),parseFloat(t[1],10),parseFloat(t[2],10));if("object"==typeof t)return new n(parseFloat(t.x,10),parseFloat(t.y,10),parseFloat(t.z,10));if("string"==typeof t&&null==r){var s=t.match(e);if(s)return new n(parseFloat(s[1],10),parseFloat(s[2],10),parseFloat(s[3],10));throw new Error("vec3: cannot parse: "+t)}return new n(parseFloat(t,10),parseFloat(r,10),parseFloat(o,10))}function o(t,e){var n=t%e;return n<0?n+e:n}t.exports=r,r.Vec3=n}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var s=e[r]={exports:{}};return t[r](s,s.exports,n),s.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";var t,e,r=n(729),o=n.n(r),s=(t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)},function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});!function(t){t.Left="left",t.Right="right",t.Top="top",t.Bottom="bottom",t.Back="back",t.Front="front"}(e||(e={}));var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e}(o()),a=n(298),h=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),c=function(){return(c=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};const u=function(t){function n(e){var n=t.call(this)||this;return n.config={lowestLimit:20,interval:300},n.prev_av=new a.Vec3(0,0,0),n.config=c(c({},n.config),e),n.available()&&window.addEventListener("devicemotion",n.onDeviceMotion.bind(n)),t.prototype.addListener.call(n,"shock",(function(t){console.log(t)})),n}return h(n,t),n.prototype.available=function(){return"DeviceMotionEvent"in window},n.prototype.emitShock=function(e){var n=this;this.timeout||t.prototype.emit.call(this,"shock",e),clearTimeout(this.timeout),this.timeout=setTimeout((function(){clearTimeout(n.timeout),n.timeout=0,console.log("cleared")}),this.config.interval)},n.prototype.onDeviceMotion=function(t){var n=new a.Vec3(t.acceleration.x,t.acceleration.y,t.acceleration.z),r=n.distanceTo(this.prev_av);if(r>this.config.lowestLimit){var o=Math.max(Math.abs(n.x),Math.abs(n.y),Math.abs(n.z)),s=e.Back;Math.abs(n.x)==o?s=n.x>0?e.Left:e.Right:Math.abs(n.y)==o?s=n.y>0?e.Bottom:e.Top:Math.abs(n.z)==o&&(s=n.z>0?e.Back:e.Front),this.emitShock({timeStamp:+new Date,force:r,side:s})}this.prev_av=n},n}(i);window&&(window.DevShock=u)})()})();