New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

elmajs

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elmajs - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

7

CHANGELOG.md

@@ -6,2 +6,9 @@ # Changelog

## [1.1.1](https://github.com/elmadev/elmajs/compare/v1.1.0...v1.1.1) (2020-06-23)
### Bug Fixes
* **Replay:** .getTime() precision ([#187](https://github.com/elmadev/elmajs/issues/187)) ([22847c3](https://github.com/elmadev/elmajs/commit/22847c31894782127e1d12adb99d6a8c475a1a8a))
# [1.1.0](https://github.com/elmadev/elmajs/compare/v1.0.2...v1.1.0) (2020-06-21)

@@ -8,0 +15,0 @@

6

lib-esm/rec/Replay.js

@@ -207,5 +207,5 @@ import { Position } from '../shared';

// Set to highest event time.
const maxEventTime = lastEvent.time * 2289.37728938;
const maxEventTime = lastEvent.time * (0.001 / (0.182 * 0.0024)) * 1000;
// If event difference to frame time is >1 frames of time, probably not finished?
if (maxFrameTime > maxEventTime + 34.333) {
if (maxFrameTime > maxEventTime + 33.333) {
return {

@@ -221,3 +221,3 @@ finished: false,

reason: ReplayFinishStateReason.Touch,
time: Math.round(maxEventTime),
time: Math.floor(maxEventTime),
};

@@ -224,0 +224,0 @@ }

@@ -227,5 +227,5 @@ "use strict";

// Set to highest event time.
var maxEventTime = lastEvent.time * 2289.37728938;
var maxEventTime = lastEvent.time * (0.001 / (0.182 * 0.0024)) * 1000;
// If event difference to frame time is >1 frames of time, probably not finished?
if (maxFrameTime > maxEventTime + 34.333) {
if (maxFrameTime > maxEventTime + 33.333) {
return {

@@ -241,3 +241,3 @@ finished: false,

reason: ReplayFinishStateReason.Touch,
time: Math.round(maxEventTime),
time: Math.floor(maxEventTime),
};

@@ -244,0 +244,0 @@ };

{
"name": "elmajs",
"version": "1.1.0",
"version": "1.1.1",
"description": "Elasto Mania NPM package to read, modify and write Elma files",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -8,3 +8,3 @@ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("ElmaJS",[],e):"object"==typeof exports?exports.ElmaJS=e():t.ElmaJS=e()}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=3)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.OBJECT_RADIUS=e.OBJECT_DIAMETER=e.HEAD_RADIUS=e.HEAD_DIAMETER=e.Clip=e.Position=void 0;var n=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e};e.Position=n,function(t){t[t.Unclipped=0]="Unclipped",t[t.Ground=1]="Ground",t[t.Sky=2]="Sky"}(e.Clip||(e.Clip={})),e.HEAD_DIAMETER=.476,e.HEAD_RADIUS=.238,e.OBJECT_DIAMETER=.8,e.OBJECT_RADIUS=.4},function(t,e,r){"use strict";(function(t){

*/
var n=r(12),i=r(13),o=r(14);function a(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=s.prototype:(null===t&&(t=new s(e)),t.length=e),t}function s(t,e,r){if(!(s.TYPED_ARRAY_SUPPORT||this instanceof s))return new s(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(this,t)}return f(this,t,e,r)}function f(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);s.TYPED_ARRAY_SUPPORT?(t=e).__proto__=s.prototype:t=h(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!s.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(e,r),i=(t=u(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(s.isBuffer(e)){var r=0|p(e.length);return 0===(t=u(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?u(t,0):h(t,e);if("Buffer"===e.type&&o(e.data))return h(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function c(t,e){if(l(e),t=u(t,e<0?0:0|p(e)),!s.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function h(t,e){var r=e.length<0?0:0|p(e.length);t=u(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function p(t){if(t>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return N(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(n)return N(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,r);case"utf8":case"utf-8":return T(this,e,r);case"ascii":return _(this,e,r);case"latin1":case"binary":return A(this,e,r);case"base64":return S(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:w(t,e,r,n,i);if("number"==typeof e)return e&=255,s.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):w(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function w(t,e,r,n,i){var o,a=1,u=t.length,s=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,u/=2,s/=2,r/=2}function f(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var l=-1;for(o=r;o<u;o++)if(f(t,o)===f(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===s)return l*a}else-1!==l&&(o-=o-l),l=-1}else for(r+s>u&&(r=u-s),o=r;o>=0;o--){for(var c=!0,h=0;h<s;h++)if(f(t,o+h)!==f(e,h)){c=!1;break}if(c)return o}return-1}function E(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var u=parseInt(e.substr(2*a,2),16);if(isNaN(u))return a;t[r+a]=u}return a}function m(t,e,r,n){return z(N(e,t.length-r),t,r,n)}function b(t,e,r,n){return z(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function I(t,e,r,n){return b(t,e,r,n)}function L(t,e,r,n){return z(F(e),t,r,n)}function P(t,e,r,n){return z(function(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function S(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function T(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,a,u,s,f=t[i],l=null,c=f>239?4:f>223?3:f>191?2:1;if(i+c<=r)switch(c){case 1:f<128&&(l=f);break;case 2:128==(192&(o=t[i+1]))&&(s=(31&f)<<6|63&o)>127&&(l=s);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(s=(15&f)<<12|(63&o)<<6|63&a)>2047&&(s<55296||s>57343)&&(l=s);break;case 4:o=t[i+1],a=t[i+2],u=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&u)&&(s=(15&f)<<18|(63&o)<<12|(63&a)<<6|63&u)>65535&&s<1114112&&(l=s)}null===l?(l=65533,c=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=c}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}e.Buffer=s,e.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},e.INSPECT_MAX_BYTES=50,s.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=a(),s.poolSize=8192,s._augment=function(t){return t.__proto__=s.prototype,t},s.from=function(t,e,r){return f(null,t,e,r)},s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0})),s.alloc=function(t,e,r){return function(t,e,r,n){return l(e),e<=0?u(t,e):void 0!==r?"string"==typeof n?u(t,e).fill(r,n):u(t,e).fill(r):u(t,e)}(null,t,e,r)},s.allocUnsafe=function(t){return c(null,t)},s.allocUnsafeSlow=function(t){return c(null,t)},s.isBuffer=function(t){return!(null==t||!t._isBuffer)},s.compare=function(t,e){if(!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=s.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var a=t[r];if(!s.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},s.byteLength=d,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},s.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},s.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},s.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?T(this,0,t):y.apply(this,arguments)},s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},s.prototype.compare=function(t,e,r,n,i){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),u=Math.min(o,a),f=this.slice(n,i),l=t.slice(e,r),c=0;c<u;++c)if(f[c]!==l[c]){o=f[c],a=l[c];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},s.prototype.indexOf=function(t,e,r){return v(this,t,e,r,!0)},s.prototype.lastIndexOf=function(t,e,r){return v(this,t,e,r,!1)},s.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return E(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":return b(this,t,e,r);case"latin1":case"binary":return I(this,t,e,r);case"base64":return L(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function _(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function A(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function R(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=Y(t[o]);return i}function U(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function O(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function B(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function D(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function j(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function x(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(t,e,r,n,o){return o||x(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function k(t,e,r,n,o){return o||x(t,0,r,8),i.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),s.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=s.prototype;else{var i=e-t;r=new s(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},s.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},s.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUInt8=function(t,e){return e||O(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return e||O(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return e||O(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){e||O(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){e||O(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return e||O(t,4,this.length),i.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return e||O(t,4,this.length),i.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return e||O(t,8,this.length),i.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return e||O(t,8,this.length),i.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||B(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||B(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):D(this,t,e,!0),e+2},s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):D(this,t,e,!1),e+2},s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):j(this,t,e,!0),e+4},s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);B(this,t,e,r,i-1,-i)}var o=0,a=1,u=0;for(this[e]=255&t;++o<r&&(a*=256);)t<0&&0===u&&0!==this[e+o-1]&&(u=1),this[e+o]=(t/a>>0)-u&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);B(this,t,e,r,i-1,-i)}var o=r-1,a=1,u=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===u&&0!==this[e+o+1]&&(u=1),this[e+o]=(t/a>>0)-u&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):D(this,t,e,!0),e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):D(this,t,e,!1),e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):j(this,t,e,!0),e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},s.prototype.writeFloatLE=function(t,e,r){return M(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return M(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return k(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return k(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!s.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var a=s.isBuffer(t)?t:N(new s(t,n).toString()),u=a.length;for(o=0;o<r-e;++o)this[o+e]=a[o%u]}return this};var C=/[^+\/0-9A-Za-z-_]/g;function Y(t){return t<16?"0"+t.toString(16):t.toString(16)}function N(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function F(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(C,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(11))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.bufferToTop10=e.bufferToTop10Part=e.top10ToBuffer=e.trimString=e.nullpadString=e.formatTime=void 0;var n=r(1);function i(t,e){if(!/^[\x00-\x7F]*$/.test(t))throw new Error("String contains non-ASCII values");return t.length>e?t.slice(0,e):t.padEnd(e,"\0")}function o(t){var e=n.Buffer.from(t),r=e.indexOf("\0");return e.toString("ascii",0,-1!==r?r:void 0)}function a(t){var e=n.Buffer.from(t);if(344!==e.length)throw Error("Top10 buffer length expected to be 344, got "+e.length);for(var r=e.readInt32LE(0),i=[],a=0;a<r;a++){var u=4+4*a,s=44+15*a,f=s+15,l=194+15*a,c=l+15,h=e.readInt32LE(u),p=o(e.slice(s,f)),d=o(e.slice(l,c));i.push({time:h,name1:p,name2:d})}return i}e.formatTime=function(t){var e=Math.trunc(t%100),r=Math.trunc(t/100%60),n=Math.trunc(t/6e3%60),i=Math.trunc(t/36e4);return(i?i+":":"")+n.toString().padStart(2,"0")+":"+r.toString().padStart(2,"0")+","+e.toString().padStart(2,"0")},e.nullpadString=i,e.trimString=o,e.top10ToBuffer=function(t){var e=Object.values(t).map((function(t){t.sort((function(t,e){return t.time>e.time?1:t.time<e.time?-1:0}));var e=n.Buffer.alloc(344);e.writeUInt32LE(t.length>=10?10:t.length,0);for(var r=0;r<t.length;r++)r<10&&(e.writeUInt32LE(t[r].time,4+4*r),e.write(i(t[r].name1,15),44+15*r),e.write(i(t[r].name2,15),194+15*r));return e}));return n.Buffer.concat(e,688)},e.bufferToTop10Part=a,e.bufferToTop10=function(t){var e=n.Buffer.from(t);if(688!==e.length)throw Error("Top10 buffer length expected to be 688, got "+e.length);return{single:a(e.slice(0,344)),multi:a(e.slice(344))}}},function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||e.hasOwnProperty(r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(6),e),i(r(4),e),i(r(0),e),i(r(2),e),i(r(18),e),i(r(22),e)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(5);Object.defineProperty(e,"Event",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(e,"EventType",{enumerable:!0,get:function(){return n.EventType}});var i=r(15);Object.defineProperty(e,"Frame",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(e,"Direction",{enumerable:!0,get:function(){return i.Direction}});var o=r(16);Object.defineProperty(e,"Ride",{enumerable:!0,get:function(){return o.default}});var a=r(17);Object.defineProperty(e,"Replay",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(e,"ReplayFinishStateReason",{enumerable:!0,get:function(){return a.ReplayFinishStateReason}})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EventType=void 0;var n=function(){this.type=0,this.time=0,this.touchInfo=0,this.groundInfo=0};e.default=n,function(t){t[t.Touch=0]="Touch",t[t.Ground=1]="Ground",t[t.Apple=4]="Apple",t[t.Turn=5]="Turn",t[t.VoltRight=6]="VoltRight",t[t.VoltLeft=7]="VoltLeft"}(e.EventType||(e.EventType={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(7);Object.defineProperty(e,"ElmaObject",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(e,"Gravity",{enumerable:!0,get:function(){return n.Gravity}}),Object.defineProperty(e,"ObjectType",{enumerable:!0,get:function(){return n.ObjectType}});var i=r(8);Object.defineProperty(e,"Picture",{enumerable:!0,get:function(){return i.default}});var o=r(9);Object.defineProperty(e,"Polygon",{enumerable:!0,get:function(){return o.default}});var a=r(10);Object.defineProperty(e,"Level",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(e,"Version",{enumerable:!0,get:function(){return a.Version}})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Gravity=e.ObjectType=void 0;var n,i,o=r(0);!function(t){t[t.Exit=1]="Exit",t[t.Apple=2]="Apple",t[t.Killer=3]="Killer",t[t.Start=4]="Start"}(n=e.ObjectType||(e.ObjectType={})),function(t){t[t.None=0]="None",t[t.Up=1]="Up",t[t.Down=2]="Down",t[t.Left=3]="Left",t[t.Right=4]="Right"}(i=e.Gravity||(e.Gravity={}));var a=function(){this.position=new o.Position,this.type=n.Apple,this.gravity=i.None,this.animation=1};e.default=a},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),i=function(){this.name="barrel",this.texture="",this.mask="",this.position=new n.Position(0,0),this.distance=600,this.clip=n.Clip.Sky,this.grass=!1,this.vertices=[]};e.default=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){this.grass=!1,this.vertices=[]};e.default=n},function(t,e,r){"use strict";var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.Version=void 0;var o,a=r(1),u=r(3);!function(t){t[t.Across=0]="Across",t[t.Elma=1]="Elma"}(o=e.Version||(e.Version={}));var s=function(){function t(){this.version=o.Elma,this.link=0,this.integrity=[0,0,0,0],this.lgr="default",this.name="Unnamed level",this.ground="ground",this.sky="sky",this.polygons=[{grass:!1,vertices:[new u.Position(10,0),new u.Position(10,7),new u.Position(0,7),new u.Position(0,0)]}],this.objects=[{animation:1,gravity:u.Gravity.None,position:new u.Position(2,0+u.OBJECT_RADIUS),type:u.ObjectType.Start},{animation:1,gravity:u.Gravity.None,position:new u.Position(8,0+u.OBJECT_RADIUS),type:u.ObjectType.Exit}],this.pictures=[],this.top10={multi:[],single:[]}}return t.from=function(t){return this.parseBuffer(a.Buffer.from(t))},t.cryptTop10=function(t){for(var e=a.Buffer.from(t),r=21,n=9783,i=0;i<688;i++)e[i]^=255&r,r=(65535&(r=31*(n+=r%3389*3389)+3389))-2*(32768&r);return e},t.parseBuffer=function(e){var r=new t;r.polygons=[],r.objects=[];var i=0;switch(e.toString("ascii",0,5)){case"POT06":throw r.version=o.Across,new Error("Across levels are not supported");case"POT14":r.version=o.Elma;break;default:throw new Error("Not valid Elma level")}i+=7,r.link=e.readUInt32LE(i),i+=4;for(var a=0;a<4;a++)r.integrity[a]=e.readDoubleLE(i),i+=8;r.name=u.trimString(e.slice(i,i+51)),i+=51,r.lgr=u.trimString(e.slice(i,i+16)),i+=16,r.ground=u.trimString(e.slice(i,i+10)),i+=10,r.sky=u.trimString(e.slice(i,i+10)),i+=10;var s=e.readDoubleLE(i)-.4643643;i+=8;var f=n(this.parsePolygons(e,i,s),2),l=f[0],c=f[1];r.polygons=l,i=c;var h=e.readDoubleLE(i)-.4643643;i+=8,r.objects=this.parseObjects(e,i,h),i+=28*h;var p=e.readDoubleLE(i)-.2345672;if(i+=8,r.pictures=this.parsePictures(e,i,p),i+=54*p,6754362!==e.readInt32LE(i))throw new Error("End of data marker mismatch");i+=4;var d=t.cryptTop10(e.slice(i,i+688));if(r.top10=u.bufferToTop10(d),i+=688,8674642!==e.readInt32LE(i))throw new Error("End of file marker mismatch");return r},t.parsePolygons=function(t,e,r){for(var n=[],i=0;i<r;i++){var o=new u.Polygon;o.grass=Boolean(t.readInt32LE(e)),e+=4;var a=t.readInt32LE(e);e+=4;for(var s=0;s<a;s++){var f=t.readDoubleLE(e);e+=8;var l=t.readDoubleLE(e);e+=8,o.vertices.push(new u.Position(f,-l))}n.push(o)}return[n,e]},t.parseObjects=function(t,e,r){for(var n=[],i=0;i<r;i++){var o=new u.ElmaObject;if(o.position.x=t.readDoubleLE(e),e+=8,o.position.y=-t.readDoubleLE(e),e+=8,o.type=t.readInt32LE(e),o.type<1||o.type>4)throw new Error("Invalid object type value="+o.type+" at offset="+e);if(e+=4,o.gravity=t.readInt32LE(e),o.gravity<0||o.gravity>4)throw new Error("Invalid gravity value="+o.gravity+" at offset="+e);e+=4,o.animation=t.readInt32LE(e)+1,e+=4,n.push(o)}return n},t.parsePictures=function(t,e,r){for(var n=[],i=0;i<r;i++){var o=new u.Picture;if(o.name=u.trimString(t.slice(e,e+10)),e+=10,o.texture=u.trimString(t.slice(e,e+10)),e+=10,o.mask=u.trimString(t.slice(e,e+10)),e+=10,o.position.x=t.readDoubleLE(e),e+=8,o.position.y=-t.readDoubleLE(e),e+=8,o.distance=t.readInt32LE(e),e+=4,o.clip=t.readInt32LE(e),o.clip<0||o.clip>2)throw new Error("Invalid clip value="+o.clip+" at offset="+e);e+=4,n.push(o)}return n},t.prototype.toBuffer=function(){var e,r,n,s,f,l,c,h,p,d;this.integrity=this.calculateIntegrity();var y=850;try{for(var g=i(this.polygons),v=g.next();!v.done;v=g.next()){y+=8+16*(_=v.value).vertices.length}}catch(t){e={error:t}}finally{try{v&&!v.done&&(r=g.return)&&r.call(g)}finally{if(e)throw e.error}}y+=28*this.objects.length+54*this.pictures.length;var w=a.Buffer.alloc(y);if(this.version!==o.Elma)throw new Error("Only Elma levels are supported");w.write("POT14",0,5,"ascii"),w.writeUInt16LE(65535&this.link,5),w.writeUInt32LE(this.link,7);for(var E=0;E<this.integrity.length;E++)w.writeDoubleLE(this.integrity[E],11+8*E);var m=u.nullpadString(this.name,51);w.write(m,43,51,"ascii");var b=u.nullpadString(this.lgr,16);w.write(b,94,16,"ascii");var I=u.nullpadString(this.ground,10);w.write(I,110,10,"ascii");var L=u.nullpadString(this.sky,10);w.write(L,120,10,"ascii"),w.writeDoubleLE(this.polygons.length+.4643643,130);var P=138;try{for(var S=i(this.polygons),T=S.next();!T.done;T=S.next()){var _=T.value;w.writeInt32LE(_.grass?1:0,P),P+=4,w.writeInt32LE(_.vertices.length,P),P+=4;try{for(var A=(f=void 0,i(_.vertices)),R=A.next();!R.done;R=A.next()){var U=R.value;w.writeDoubleLE(U.x,P),P+=8,w.writeDoubleLE(-U.y,P),P+=8}}catch(t){f={error:t}}finally{try{R&&!R.done&&(l=A.return)&&l.call(A)}finally{if(f)throw f.error}}}}catch(t){n={error:t}}finally{try{T&&!T.done&&(s=S.return)&&s.call(S)}finally{if(n)throw n.error}}w.writeDoubleLE(this.objects.length+.4643643,P),P+=8;try{for(var O=i(this.objects),B=O.next();!B.done;B=O.next()){var D=B.value;w.writeDoubleLE(D.position.x,P),P+=8,w.writeDoubleLE(-D.position.y,P),P+=8,w.writeInt32LE(D.type,P),P+=4,w.writeInt32LE(D.gravity,P),P+=4,w.writeInt32LE(D.animation-1,P),P+=4}}catch(t){c={error:t}}finally{try{B&&!B.done&&(h=O.return)&&h.call(O)}finally{if(c)throw c.error}}w.writeDoubleLE(this.pictures.length+.2345672,P),P+=8;try{for(var j=i(this.pictures),x=j.next();!x.done;x=j.next()){var M=x.value,k=u.nullpadString(M.name,10);w.write(k,P,10,"ascii"),P+=10;var C=u.nullpadString(M.texture,10);w.write(C,P,10,"ascii"),P+=10;var Y=u.nullpadString(M.mask,10);w.write(Y,P,10,"ascii"),P+=10,w.writeDoubleLE(M.position.x,P),P+=8,w.writeDoubleLE(-M.position.y,P),P+=8,w.writeInt32LE(M.distance,P),P+=4,w.writeInt32LE(M.clip,P),P+=4}}catch(t){p={error:t}}finally{try{x&&!x.done&&(d=j.return)&&d.call(j)}finally{if(p)throw p.error}}w.writeInt32LE(6754362,P),P+=4;var N=u.top10ToBuffer(this.top10);return t.cryptTop10(N).copy(w,P),P+=688,w.writeInt32LE(8674642,P),w},t.prototype.calculateIntegrity=function(){var t=3247.764325643*(this.polygons.reduce((function(t,e){return t+e.vertices.reduce((function(t,e){return t+e.x+e.y}),0)}),0)+this.objects.reduce((function(t,e){var r=0;return e.type===u.ObjectType.Exit?r=1:e.type===u.ObjectType.Apple?r=2:e.type===u.ObjectType.Killer?r=3:e.type===u.ObjectType.Start&&(r=4),t+e.position.x+e.position.y+r}),0)+this.pictures.reduce((function(t,e){return t+e.position.x+e.position.y}),0));return[t,this.getRandomInt(0,5871)+11877-t,this.getRandomInt(0,5871)+11877-t,this.getRandomInt(0,6102)+12112-t]},t.prototype.getRandomInt=function(t,e){return t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t))+t},t}();e.default=s},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";e.byteLength=function(t){var e=f(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=f(t),a=n[0],u=n[1],s=new o(function(t,e,r){return 3*(e+r)/4-r}(0,a,u)),l=0,c=u>0?a-4:a;for(r=0;r<c;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],s[l++]=e>>16&255,s[l++]=e>>8&255,s[l++]=255&e;2===u&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,s[l++]=255&e);1===u&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,s[l++]=e>>8&255,s[l++]=255&e);return s},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=0,u=r-i;a<u;a+=16383)o.push(l(t,a,a+16383>u?u:a+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,s=a.length;u<s;++u)n[u]=a[u],i[a.charCodeAt(u)]=u;function f(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,r){for(var i,o,a=[],u=e;u<r;u+=3)i=(t[u]<<16&16711680)+(t[u+1]<<8&65280)+(255&t[u+2]),a.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,n,i){var o,a,u=8*i-n-1,s=(1<<u)-1,f=s>>1,l=-7,c=r?i-1:0,h=r?-1:1,p=t[e+c];for(c+=h,o=p&(1<<-l)-1,p>>=-l,l+=u;l>0;o=256*o+t[e+c],c+=h,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+t[e+c],c+=h,l-=8);if(0===o)o=1-f;else{if(o===s)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),o-=f}return(p?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,u,s,f=8*o-i-1,l=(1<<f)-1,c=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(s=Math.pow(2,-a))<1&&(a--,s*=2),(e+=a+c>=1?h/s:h*Math.pow(2,1-c))*s>=2&&(a++,s/=2),a+c>=l?(u=0,a=l):a+c>=1?(u=(e*s-1)*Math.pow(2,i),a+=c):(u=e*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;t[r+p]=255&u,p+=d,u/=256,i-=8);for(a=a<<i|u,f+=i;f>0;t[r+p]=255&a,p+=d,a/=256,f-=8);t[r+p-d]|=128*y}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Direction=void 0;var n=r(0);!function(t){t[t.Left=0]="Left",t[t.Right=1]="Right"}(e.Direction||(e.Direction={}));var i=function(){function t(){this.bike=new n.Position(0,0),this.leftWheel=new n.Position(0,0),this.rightWheel=new n.Position(0,0),this.head=new n.Position(0,0),this.bikeRotation=0,this.leftWheelRotation=0,this.rightWheelRotation=0,this.backWheelSpeed=0,this.collisionStrength=0,this.throttleAndDirection=0}return Object.defineProperty(t.prototype,"throttle",{get:function(){return 0!=(1&this.throttleAndDirection)},set:function(t){this.throttleAndDirection=-2&this.throttleAndDirection|(t?1:0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"direction",{get:function(){return 2&this.throttleAndDirection},set:function(t){this.throttleAndDirection=-5&this.throttleAndDirection|t<<2},enumerable:!1,configurable:!0}),t}();e.default=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){this.frames=[],this.events=[]};e.default=n},function(t,e,r){"use strict";(function(t){var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.ReplayFinishStateReason=void 0;var i,o=r(0),a=r(2),u=r(4),s=r(5);!function(t){t.Touch="Touch",t.NoTouch="NoTouch",t.FrameDifference="FrameDifference"}(i=e.ReplayFinishStateReason||(e.ReplayFinishStateReason={}));var f=function(){function e(){this.link=0,this.level="",this.isMulti=!1,this.isFlagTag=!1,this.rides=[],this.path=""}return e.from=function(e){return this.parseBuffer(t.from(e))},e.parseBuffer=function(t){for(var r=new e,i=0;i<t.length;){var o=n(this.parseRide(t.slice(i)),2),a=o[0],u=o[1];Object.assign(r,a),r.rides.push(u),i+=44+27*u.frames.length+16*u.events.length}return r},e.parseRide=function(t){var r=new u.Ride,n=0,i=t.readUInt32LE(n);n+=8;var o=Boolean(t.readInt32LE(n));n+=4;var s=Boolean(t.readInt32LE(n));n+=4;var f=t.readUInt32LE(n);n+=4;var l=a.trimString(t.slice(n,n+12));n+=16;var c={isMulti:o,isFlagTag:s,link:f,level:l};r.frames=e.parseFrames(t.slice(n,n+27*i),i),n+=27*i;var h=t.readUInt32LE(n);if(n+=4,r.events=e.parseEvents(t.slice(n,n+16*h),h),n+=16*h,4796277!==t.readInt32LE(n))throw new Error("End of replay marker mismatch");return[c,r]},e.parseFrames=function(t,e){for(var r=[],n=0;n<e;n++){var i=new u.Frame;i.bike=new o.Position(t.readFloatLE(4*n),t.readFloatLE(4*n+4*e)),i.leftWheel=new o.Position(t.readInt16LE(2*n+8*e),t.readInt16LE(2*n+10*e)),i.rightWheel=new o.Position(t.readInt16LE(2*n+12*e),t.readInt16LE(2*n+14*e)),i.head=new o.Position(t.readInt16LE(2*n+16*e),t.readInt16LE(2*n+18*e)),i.bikeRotation=t.readInt16LE(2*n+20*e),i.leftWheelRotation=t.readUInt8(n+22*e),i.rightWheelRotation=t.readUInt8(n+23*e),i.throttleAndDirection=t.readUInt8(n+24*e),i.backWheelSpeed=t.readUInt8(n+25*e),i.collisionStrength=t.readUInt8(n+26*e),r.push(i)}return r},e.parseEvents=function(t,e){for(var r=[],n=0,i=0;i<e;i++){var o=t.readDoubleLE(n);n+=8;var a=t.readInt16LE(n);n+=2;var u=t.readUInt8(n);n+=2;var s=t.readFloatLE(n);if(n+=4,u<0||u>7)throw new Error("Invalid event type value="+u+" at event offset="+n);r.push({time:o,touchInfo:a,type:u,groundInfo:s})}return r},e.prototype.toBuffer=function(){var e=this,r=this.rides.reduce((function(t,e){return t+(44+27*e.frames.length+16*e.events.length)}),0),n=t.alloc(r),i=0;return this.rides.forEach((function(t){var r=t.frames.length;n.writeUInt32LE(r,i),n.writeUInt32LE(131,i+4),n.writeUInt32LE(e.isMulti?1:0,i+8),n.writeUInt32LE(e.isFlagTag?1:0,i+12),n.writeUInt32LE(e.link,i+16),n.write(a.nullpadString(e.level,12),i+20,12,"ascii"),n.writeUInt32LE(0,i+32),i+=36;for(var o=0;o<r;o++)n.writeFloatLE(t.frames[o].bike.x,i+4*o),n.writeFloatLE(t.frames[o].bike.y,i+4*o+4*r),n.writeInt16LE(t.frames[o].leftWheel.x,i+2*o+8*r),n.writeInt16LE(t.frames[o].leftWheel.y,i+2*o+10*r),n.writeInt16LE(t.frames[o].rightWheel.x,i+2*o+12*r),n.writeInt16LE(t.frames[o].rightWheel.y,i+2*o+14*r),n.writeInt16LE(t.frames[o].head.x,i+2*o+16*r),n.writeInt16LE(t.frames[o].head.y,i+2*o+18*r),n.writeInt16LE(t.frames[o].bikeRotation,i+2*o+20*r),n.writeUInt8(t.frames[o].leftWheelRotation,i+o+22*r),n.writeUInt8(t.frames[o].rightWheelRotation,i+o+23*r),n.writeUInt8(t.frames[o].throttleAndDirection,i+o+24*r),n.writeUInt8(t.frames[o].backWheelSpeed,i+o+25*r),n.writeUInt8(t.frames[o].collisionStrength,i+o+26*r);i+=27*r,n.writeUInt32LE(t.events.length,i),i+=4,t.events.forEach((function(t){n.writeDoubleLE(t.time,i),i+=8;switch(t.type){case s.EventType.Touch:n.writeInt16LE(t.touchInfo,i),n.writeUInt8(t.type,i+2),n.writeUInt8(0,i+3),n.writeFloatLE(0,i+4);break;case s.EventType.Ground:n.writeInt16LE(-1,i),n.writeUInt8(t.type,i+2),n.writeUInt8(0,i+3),n.writeFloatLE(t.groundInfo,i+4);break;default:n.writeInt16LE(-1,i),n.writeUInt8(t.type,i+2),n.writeUInt8(0,i+3),n.writeFloatLE(.99,i+4)}i+=8})),n.writeUInt32LE(4796277,i),i+=4})),n},e.prototype.getTime=function(){var t=this.rides.reduce((function(t,e){var r=t?t.time:0,n=e.events.length>0?e.events[e.events.length-1]:void 0;return(n?n.time:0)>r?n:t}),void 0),e=33.333*this.rides.reduce((function(t,e){return e.frames.length>t?e.frames.length:t}),0);if(t&&t.type!==s.EventType.Touch||!t)return{finished:!1,reason:i.NoTouch,time:Math.round(e)};var r=2289.37728938*t.time;return e>r+34.333?{finished:!1,reason:i.FrameDifference,time:Math.round(e)}:{finished:!0,reason:i.Touch,time:Math.round(r)}},Object.defineProperty(e.prototype,"apples",{get:function(){return this.rides.reduce((function(t,e){return t+=e.events.filter((function(t){return 4===t.type})).length}),0)},enumerable:!1,configurable:!0}),e}();e.default=f}).call(this,r(1).Buffer)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(19);Object.defineProperty(e,"LGR",{enumerable:!0,get:function(){return n.default}});var i=r(20);Object.defineProperty(e,"PictureData",{enumerable:!0,get:function(){return i.default}});var o=r(21);Object.defineProperty(e,"PictureDeclaration",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(e,"PictureType",{enumerable:!0,get:function(){return o.PictureType}}),Object.defineProperty(e,"Transparency",{enumerable:!0,get:function(){return o.Transparency}})},function(t,e,r){"use strict";var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a};Object.defineProperty(e,"__esModule",{value:!0});var i=r(1),o=r(3),a=r(2),u=function(){function t(){this.pictureList=[],this.pictureData=[],this.path=""}return t.from=function(t){return this.parseBuffer(i.Buffer.from(t))},t.parseBuffer=function(e){var r=new t,i=e.toString("ascii",0,5);if("LGR12"!==i)throw new Error("Invalid LGR version: "+i);var o=e.readInt32LE(5),a=e.readInt32LE(9);if(1002!==a)throw new Error("Invalid header: "+a);var u=e.readInt32LE(13);r.pictureList=r.parseListData(e.slice(17,17+26*u),u);var s=n(r.parsePictureData(e.slice(17+26*u),o),2),f=s[0],l=s[1];if(r.pictureData=f,187565543!==e.readInt32LE(17+26*u+l))throw new Error("EOF marker expected at byte: "+(17+26*u+l));return r},t.prototype.toBuffer=function(){var t=this.pictureList.length,e=this.pictureData.reduce((function(t,e){return t+e.data.length+24}),21+26*t),r=i.Buffer.alloc(e),n=0;return r.write("LGR12",n,5,"ascii"),n+=5,r.writeUInt32LE(this.pictureData.length,n),n+=4,r.writeInt32LE(1002,n),n+=4,r.writeUInt32LE(t,n),n+=4,this.pictureList.forEach((function(e,i){r.write(a.nullpadString(e.name,10),n+10*i,10,"ascii"),r.writeUInt32LE(e.pictureType,n+10*t+4*i),r.writeUInt32LE(e.distance,n+14*t+4*i),r.writeUInt32LE(e.clipping,n+18*t+4*i),r.writeUInt32LE(e.transparency,n+22*t+4*i)})),n+=26*t,this.pictureData.forEach((function(t){r.write(a.nullpadString(t.name,20),n,20,"ascii"),n+=20,r.writeUInt32LE(t.data.length,n),n+=4,n+=t.data.copy(r,n)})),r.writeInt32LE(187565543,n),r},t.prototype.parseListData=function(t,e){var r=[],n=0,i=t.slice(n,n+10*e);n+=10*e;var u=t.slice(n,n+4*e);n+=4*e;var s=t.slice(n,n+4*e);n+=4*e;var f=t.slice(n,n+4*e);n+=4*e;for(var l=t.slice(n,n+4*e),c=0;c<e;c++){var h=new o.PictureDeclaration;h.name=a.trimString(i.slice(10*c,10*c+10)),h.pictureType=u.readInt32LE(4*c),h.distance=s.readInt32LE(4*c),h.clipping=f.readInt32LE(4*c),h.transparency=l.readInt32LE(4*c),r.push(h)}return r},t.prototype.parsePictureData=function(t,e){for(var r=[],n=0,i=0;i<e;i++){var u=a.trimString(t.slice(n,n+12));n+=20;var s=t.readUInt32LE(n);n+=4;var f=t.slice(n,n+s);r.push(new o.PictureData(u,f)),n+=s}return[r,n]},t}();e.default=u},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(t,e){this.name=t,this.data=e};e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Transparency=e.PictureType=void 0;var n,i,o=r(0);!function(t){t[t.Normal=100]="Normal",t[t.Texture=101]="Texture",t[t.Mask=102]="Mask"}(n=e.PictureType||(e.PictureType={})),function(t){t[t.Solid=10]="Solid",t[t.Palette=11]="Palette",t[t.TopLeft=12]="TopLeft",t[t.TopRight=13]="TopRight",t[t.BottomLeft=14]="BottomLeft",t[t.BottomRight=15]="BottomRight"}(i=e.Transparency||(e.Transparency={}));var a=function(){this.name="",this.pictureType=n.Normal,this.distance=450,this.clipping=o.Clip.Sky,this.transparency=i.TopLeft};e.default=a},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(23);Object.defineProperty(e,"State",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(e,"PlayMode",{enumerable:!0,get:function(){return n.PlayMode}}),Object.defineProperty(e,"VideoDetail",{enumerable:!0,get:function(){return n.VideoDetail}}),Object.defineProperty(e,"SoundOptimization",{enumerable:!0,get:function(){return n.SoundOptimization}})},function(t,e,r){"use strict";var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},i=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(n(arguments[e]));return t},o=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.VideoDetail=e.SoundOptimization=e.PlayMode=void 0;var a,u,s,f=r(1),l=r(2);!function(t){t[t.Single=1]="Single",t[t.Multi=0]="Multi"}(a=e.PlayMode||(e.PlayMode={})),function(t){t[t.Compatibility=1]="Compatibility",t[t.BestQuality=0]="BestQuality"}(u=e.SoundOptimization||(e.SoundOptimization={})),function(t){t[t.Low=0]="Low",t[t.High=1]="High"}(s=e.VideoDetail||(e.VideoDetail={}));var c=function(){function t(){this.version=200,this.times=Array(90).fill({single:[],multi:[]}),this.players=[],this.playerAName="",this.playerBName="",this.playerAKeys={brake:208,changeDirection:57,rotateLeft:203,rotateRight:205,throttle:200,toggleNavigator:47,toggleShowHide:2,toggleTimer:20},this.playerBKeys={brake:80,changeDirection:82,rotateLeft:79,rotateRight:81,throttle:76,toggleNavigator:48,toggleShowHide:3,toggleTimer:21},this.soundEnabled=!0,this.soundOptimization=u.BestQuality,this.playMode=a.Single,this.flagTag=!1,this.swapBikes=!1,this.videoDetail=s.High,this.animatedObjects=!0,this.animatedMenus=!0,this.incScreenSizeKey=13,this.decScreenSizeKey=12,this.screenshotKey=23,this.lastEditedLevName="",this.lastPlayedExternal=""}return t.from=function(t){if(67910!==t.length)throw Error("Invalid state.dat file, expected buffer length of 67910, got "+t.length);return this.parseBuffer(t)},t.parseBuffer=function(e){var r=new t,n=this.cryptState(e),i=0;if(200!==n.readUInt32LE(i))throw Error("Invalid state.dat file");i+=4;for(var o=0;o<90;o++){var a=n.slice(i,i+688),u=l.bufferToTop10(a);r.times[o]=u,i+=688}var s=n.readUInt32LE(i+5800);if(s>50)throw Error("Expected max 50 player entries, got "+s);for(o=0;o<s;o++){var f=i+116*o,c=this.parsePlayer(n.slice(f,f+116));r.players.push(c)}i+=5804,r.playerAName=l.trimString(n.slice(i,i+15)),i+=15,r.playerBName=l.trimString(n.slice(i,i+15)),i+=15,r.soundEnabled=Boolean(n.readInt32LE(i)),i+=4,r.soundOptimization=n.readInt32LE(i),i+=4,r.playMode=n.readInt32LE(i),i+=4,r.flagTag=Boolean(n.readInt32LE(i)),i+=4,r.swapBikes=!Boolean(n.readInt32LE(i)),i+=4,r.videoDetail=n.readInt32LE(i),i+=4,r.animatedObjects=Boolean(n.readInt32LE(i)),i+=4,r.animatedMenus=Boolean(n.readInt32LE(i)),i+=4,r.playerAKeys=this.parsePlayerKeys(n.slice(i,i+32)),i+=32,r.playerBKeys=this.parsePlayerKeys(n.slice(i,i+32)),i+=32,r.incScreenSizeKey=n.readUInt32LE(i),i+=4,r.decScreenSizeKey=n.readUInt32LE(i),i+=4,r.screenshotKey=n.readUInt32LE(i),i+=4,r.lastEditedLevName=l.trimString(n.slice(i,i+20)),i+=20,r.lastPlayedExternal=l.trimString(n.slice(i,i+20)),i+=20;var h=n.readUInt32LE(i);if(123432221!==h&&123432112!==h)throw Error("Expected EOF marker, got "+h);return r},t.parsePlayer=function(t){if(116!==t.length)throw Error("Expected buffer of length 116, got "+t.length);return{name:l.trimString(t.slice(0,16)),skippedInternals:i(t.slice(16,70)).map(Boolean),lastInternal:t.readUInt32LE(108),selectedInternal:t.readUInt32LE(112)}},t.parsePlayerKeys=function(t){if(32!==t.length)throw Error("Expected buffer of length 32, got "+t.length);var e=0,r=t.readUInt32LE(e);e+=4;var n=t.readUInt32LE(e);e+=4;var i=t.readUInt32LE(e);e+=4;var o=t.readUInt32LE(e);e+=4;var a=t.readUInt32LE(e);e+=4;var u=t.readUInt32LE(e);e+=4;var s=t.readUInt32LE(e);return e+=4,{throttle:r,brake:n,rotateRight:i,rotateLeft:o,changeDirection:a,toggleNavigator:u,toggleTimer:s,toggleShowHide:t.readUInt32LE(e)}},t.cryptState=function(t){var e,r,n=f.Buffer.from(t),i=[4,61920,5800,4,15,15,4,4,4,4,4,4,4,4,32,32,4,4,4,20,20],a=0;try{for(var u=o(i),s=u.next();!s.done;s=u.next()){var l=s.value;this.cryptStatePiece(n.slice(a,a+l)).copy(n,a),a+=l}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}return n},t.cryptStatePiece=function(t){for(var e=f.Buffer.from(t),r=23,n=9782,i=0;i<t.length;i++)e[i]^=255&r,r=(65535&(r=31*(n+=r%3391*3391)+3391))-2*(32768&r);return e},t.prototype.toBuffer=function(){var e,r,n,i,a=f.Buffer.alloc(67910),u=0;a.writeUInt32LE(200),u+=4;try{for(var s=o(this.times.slice(0,90)),c=s.next();!c.done;c=s.next()){var h=c.value;l.top10ToBuffer(h).copy(a,u),u+=688}}catch(t){e={error:t}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}u=61924;try{for(var p=o(this.players.slice(0,50)),d=p.next();!d.done;d=p.next()){var y=d.value,g=l.nullpadString(y.name,16);a.write(g,u,16,"ascii"),u+=16;var v=y.skippedInternals.slice(0,54);v.forEach((function(t){a.writeUInt8(t?1:0,u),u+=1})),v.length<54&&(u+=54-v.length),u+=38,a.writeInt32LE(y.lastInternal,u),u+=4,a.writeInt32LE(y.selectedInternal,u),u+=4}}catch(t){n={error:t}}finally{try{d&&!d.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}return this.players.length<50&&(a.fill(0,u,u+116*(50-this.players.length)),u+=116*(50-this.players.length)),a.writeUInt32LE(this.players.length,u),u+=4,a.write(l.nullpadString(this.playerAName,15),u,15,"ascii"),u+=15,a.write(l.nullpadString(this.playerBName,15),u,15,"ascii"),u+=15,a.writeInt32LE(this.soundEnabled?1:0,u),u+=4,a.writeInt32LE(this.soundOptimization,u),u+=4,a.writeInt32LE(this.playMode,u),u+=4,a.writeInt32LE(this.flagTag?1:0,u),u+=4,a.writeInt32LE(this.swapBikes?0:1,u),u+=4,a.writeInt32LE(this.videoDetail,u),u+=4,a.writeInt32LE(this.animatedObjects?1:0,u),u+=4,a.writeInt32LE(this.animatedMenus?1:0,u),u+=4,[this.playerAKeys,this.playerBKeys].forEach((function(t){a.writeUInt32LE(t.throttle,u),u+=4,a.writeUInt32LE(t.brake,u),u+=4,a.writeUInt32LE(t.rotateRight,u),u+=4,a.writeUInt32LE(t.rotateLeft,u),u+=4,a.writeUInt32LE(t.changeDirection,u),u+=4,a.writeUInt32LE(t.toggleNavigator,u),u+=4,a.writeUInt32LE(t.toggleTimer,u),u+=4,a.writeUInt32LE(t.toggleShowHide,u),u+=4})),a.writeUInt32LE(this.incScreenSizeKey,u),u+=4,a.writeUInt32LE(this.decScreenSizeKey,u),u+=4,a.writeUInt32LE(this.screenshotKey,u),u+=4,a.write(l.nullpadString(this.lastEditedLevName,20),u,20,"ascii"),u+=20,a.write(l.nullpadString(this.lastPlayedExternal,20),u,20,"ascii"),u+=20,a.writeUInt32LE(123432221,u),t.cryptState(a)},t}();e.default=c}])}));
var n=r(12),i=r(13),o=r(14);function a(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=s.prototype:(null===t&&(t=new s(e)),t.length=e),t}function s(t,e,r){if(!(s.TYPED_ARRAY_SUPPORT||this instanceof s))return new s(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(this,t)}return f(this,t,e,r)}function f(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);s.TYPED_ARRAY_SUPPORT?(t=e).__proto__=s.prototype:t=h(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!s.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(e,r),i=(t=u(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(s.isBuffer(e)){var r=0|p(e.length);return 0===(t=u(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?u(t,0):h(t,e);if("Buffer"===e.type&&o(e.data))return h(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function c(t,e){if(l(e),t=u(t,e<0?0:0|p(e)),!s.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function h(t,e){var r=e.length<0?0:0|p(e.length);t=u(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function p(t){if(t>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return N(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(n)return N(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,r);case"utf8":case"utf-8":return T(this,e,r);case"ascii":return _(this,e,r);case"latin1":case"binary":return A(this,e,r);case"base64":return S(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:w(t,e,r,n,i);if("number"==typeof e)return e&=255,s.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):w(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function w(t,e,r,n,i){var o,a=1,u=t.length,s=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,u/=2,s/=2,r/=2}function f(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var l=-1;for(o=r;o<u;o++)if(f(t,o)===f(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===s)return l*a}else-1!==l&&(o-=o-l),l=-1}else for(r+s>u&&(r=u-s),o=r;o>=0;o--){for(var c=!0,h=0;h<s;h++)if(f(t,o+h)!==f(e,h)){c=!1;break}if(c)return o}return-1}function E(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var u=parseInt(e.substr(2*a,2),16);if(isNaN(u))return a;t[r+a]=u}return a}function m(t,e,r,n){return z(N(e,t.length-r),t,r,n)}function b(t,e,r,n){return z(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function I(t,e,r,n){return b(t,e,r,n)}function L(t,e,r,n){return z(F(e),t,r,n)}function P(t,e,r,n){return z(function(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function S(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function T(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,a,u,s,f=t[i],l=null,c=f>239?4:f>223?3:f>191?2:1;if(i+c<=r)switch(c){case 1:f<128&&(l=f);break;case 2:128==(192&(o=t[i+1]))&&(s=(31&f)<<6|63&o)>127&&(l=s);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(s=(15&f)<<12|(63&o)<<6|63&a)>2047&&(s<55296||s>57343)&&(l=s);break;case 4:o=t[i+1],a=t[i+2],u=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&u)&&(s=(15&f)<<18|(63&o)<<12|(63&a)<<6|63&u)>65535&&s<1114112&&(l=s)}null===l?(l=65533,c=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=c}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}e.Buffer=s,e.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},e.INSPECT_MAX_BYTES=50,s.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=a(),s.poolSize=8192,s._augment=function(t){return t.__proto__=s.prototype,t},s.from=function(t,e,r){return f(null,t,e,r)},s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0})),s.alloc=function(t,e,r){return function(t,e,r,n){return l(e),e<=0?u(t,e):void 0!==r?"string"==typeof n?u(t,e).fill(r,n):u(t,e).fill(r):u(t,e)}(null,t,e,r)},s.allocUnsafe=function(t){return c(null,t)},s.allocUnsafeSlow=function(t){return c(null,t)},s.isBuffer=function(t){return!(null==t||!t._isBuffer)},s.compare=function(t,e){if(!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=s.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var a=t[r];if(!s.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},s.byteLength=d,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},s.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},s.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},s.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?T(this,0,t):y.apply(this,arguments)},s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},s.prototype.compare=function(t,e,r,n,i){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),u=Math.min(o,a),f=this.slice(n,i),l=t.slice(e,r),c=0;c<u;++c)if(f[c]!==l[c]){o=f[c],a=l[c];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},s.prototype.indexOf=function(t,e,r){return v(this,t,e,r,!0)},s.prototype.lastIndexOf=function(t,e,r){return v(this,t,e,r,!1)},s.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return E(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":return b(this,t,e,r);case"latin1":case"binary":return I(this,t,e,r);case"base64":return L(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function _(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function A(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function R(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=Y(t[o]);return i}function U(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function O(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function B(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function D(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function j(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function x(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(t,e,r,n,o){return o||x(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function k(t,e,r,n,o){return o||x(t,0,r,8),i.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),s.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=s.prototype;else{var i=e-t;r=new s(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},s.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},s.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUInt8=function(t,e){return e||O(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return e||O(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return e||O(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){e||O(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){e||O(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return e||O(t,4,this.length),i.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return e||O(t,4,this.length),i.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return e||O(t,8,this.length),i.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return e||O(t,8,this.length),i.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||B(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||B(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):D(this,t,e,!0),e+2},s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):D(this,t,e,!1),e+2},s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):j(this,t,e,!0),e+4},s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);B(this,t,e,r,i-1,-i)}var o=0,a=1,u=0;for(this[e]=255&t;++o<r&&(a*=256);)t<0&&0===u&&0!==this[e+o-1]&&(u=1),this[e+o]=(t/a>>0)-u&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);B(this,t,e,r,i-1,-i)}var o=r-1,a=1,u=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===u&&0!==this[e+o+1]&&(u=1),this[e+o]=(t/a>>0)-u&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):D(this,t,e,!0),e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):D(this,t,e,!1),e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):j(this,t,e,!0),e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},s.prototype.writeFloatLE=function(t,e,r){return M(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return M(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return k(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return k(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!s.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var a=s.isBuffer(t)?t:N(new s(t,n).toString()),u=a.length;for(o=0;o<r-e;++o)this[o+e]=a[o%u]}return this};var C=/[^+\/0-9A-Za-z-_]/g;function Y(t){return t<16?"0"+t.toString(16):t.toString(16)}function N(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function F(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(C,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(11))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.bufferToTop10=e.bufferToTop10Part=e.top10ToBuffer=e.trimString=e.nullpadString=e.formatTime=void 0;var n=r(1);function i(t,e){if(!/^[\x00-\x7F]*$/.test(t))throw new Error("String contains non-ASCII values");return t.length>e?t.slice(0,e):t.padEnd(e,"\0")}function o(t){var e=n.Buffer.from(t),r=e.indexOf("\0");return e.toString("ascii",0,-1!==r?r:void 0)}function a(t){var e=n.Buffer.from(t);if(344!==e.length)throw Error("Top10 buffer length expected to be 344, got "+e.length);for(var r=e.readInt32LE(0),i=[],a=0;a<r;a++){var u=4+4*a,s=44+15*a,f=s+15,l=194+15*a,c=l+15,h=e.readInt32LE(u),p=o(e.slice(s,f)),d=o(e.slice(l,c));i.push({time:h,name1:p,name2:d})}return i}e.formatTime=function(t){var e=Math.trunc(t%100),r=Math.trunc(t/100%60),n=Math.trunc(t/6e3%60),i=Math.trunc(t/36e4);return(i?i+":":"")+n.toString().padStart(2,"0")+":"+r.toString().padStart(2,"0")+","+e.toString().padStart(2,"0")},e.nullpadString=i,e.trimString=o,e.top10ToBuffer=function(t){var e=Object.values(t).map((function(t){t.sort((function(t,e){return t.time>e.time?1:t.time<e.time?-1:0}));var e=n.Buffer.alloc(344);e.writeUInt32LE(t.length>=10?10:t.length,0);for(var r=0;r<t.length;r++)r<10&&(e.writeUInt32LE(t[r].time,4+4*r),e.write(i(t[r].name1,15),44+15*r),e.write(i(t[r].name2,15),194+15*r));return e}));return n.Buffer.concat(e,688)},e.bufferToTop10Part=a,e.bufferToTop10=function(t){var e=n.Buffer.from(t);if(688!==e.length)throw Error("Top10 buffer length expected to be 688, got "+e.length);return{single:a(e.slice(0,344)),multi:a(e.slice(344))}}},function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||e.hasOwnProperty(r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(6),e),i(r(4),e),i(r(0),e),i(r(2),e),i(r(18),e),i(r(22),e)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(5);Object.defineProperty(e,"Event",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(e,"EventType",{enumerable:!0,get:function(){return n.EventType}});var i=r(15);Object.defineProperty(e,"Frame",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(e,"Direction",{enumerable:!0,get:function(){return i.Direction}});var o=r(16);Object.defineProperty(e,"Ride",{enumerable:!0,get:function(){return o.default}});var a=r(17);Object.defineProperty(e,"Replay",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(e,"ReplayFinishStateReason",{enumerable:!0,get:function(){return a.ReplayFinishStateReason}})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EventType=void 0;var n=function(){this.type=0,this.time=0,this.touchInfo=0,this.groundInfo=0};e.default=n,function(t){t[t.Touch=0]="Touch",t[t.Ground=1]="Ground",t[t.Apple=4]="Apple",t[t.Turn=5]="Turn",t[t.VoltRight=6]="VoltRight",t[t.VoltLeft=7]="VoltLeft"}(e.EventType||(e.EventType={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(7);Object.defineProperty(e,"ElmaObject",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(e,"Gravity",{enumerable:!0,get:function(){return n.Gravity}}),Object.defineProperty(e,"ObjectType",{enumerable:!0,get:function(){return n.ObjectType}});var i=r(8);Object.defineProperty(e,"Picture",{enumerable:!0,get:function(){return i.default}});var o=r(9);Object.defineProperty(e,"Polygon",{enumerable:!0,get:function(){return o.default}});var a=r(10);Object.defineProperty(e,"Level",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(e,"Version",{enumerable:!0,get:function(){return a.Version}})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Gravity=e.ObjectType=void 0;var n,i,o=r(0);!function(t){t[t.Exit=1]="Exit",t[t.Apple=2]="Apple",t[t.Killer=3]="Killer",t[t.Start=4]="Start"}(n=e.ObjectType||(e.ObjectType={})),function(t){t[t.None=0]="None",t[t.Up=1]="Up",t[t.Down=2]="Down",t[t.Left=3]="Left",t[t.Right=4]="Right"}(i=e.Gravity||(e.Gravity={}));var a=function(){this.position=new o.Position,this.type=n.Apple,this.gravity=i.None,this.animation=1};e.default=a},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),i=function(){this.name="barrel",this.texture="",this.mask="",this.position=new n.Position(0,0),this.distance=600,this.clip=n.Clip.Sky,this.grass=!1,this.vertices=[]};e.default=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){this.grass=!1,this.vertices=[]};e.default=n},function(t,e,r){"use strict";var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.Version=void 0;var o,a=r(1),u=r(3);!function(t){t[t.Across=0]="Across",t[t.Elma=1]="Elma"}(o=e.Version||(e.Version={}));var s=function(){function t(){this.version=o.Elma,this.link=0,this.integrity=[0,0,0,0],this.lgr="default",this.name="Unnamed level",this.ground="ground",this.sky="sky",this.polygons=[{grass:!1,vertices:[new u.Position(10,0),new u.Position(10,7),new u.Position(0,7),new u.Position(0,0)]}],this.objects=[{animation:1,gravity:u.Gravity.None,position:new u.Position(2,0+u.OBJECT_RADIUS),type:u.ObjectType.Start},{animation:1,gravity:u.Gravity.None,position:new u.Position(8,0+u.OBJECT_RADIUS),type:u.ObjectType.Exit}],this.pictures=[],this.top10={multi:[],single:[]}}return t.from=function(t){return this.parseBuffer(a.Buffer.from(t))},t.cryptTop10=function(t){for(var e=a.Buffer.from(t),r=21,n=9783,i=0;i<688;i++)e[i]^=255&r,r=(65535&(r=31*(n+=r%3389*3389)+3389))-2*(32768&r);return e},t.parseBuffer=function(e){var r=new t;r.polygons=[],r.objects=[];var i=0;switch(e.toString("ascii",0,5)){case"POT06":throw r.version=o.Across,new Error("Across levels are not supported");case"POT14":r.version=o.Elma;break;default:throw new Error("Not valid Elma level")}i+=7,r.link=e.readUInt32LE(i),i+=4;for(var a=0;a<4;a++)r.integrity[a]=e.readDoubleLE(i),i+=8;r.name=u.trimString(e.slice(i,i+51)),i+=51,r.lgr=u.trimString(e.slice(i,i+16)),i+=16,r.ground=u.trimString(e.slice(i,i+10)),i+=10,r.sky=u.trimString(e.slice(i,i+10)),i+=10;var s=e.readDoubleLE(i)-.4643643;i+=8;var f=n(this.parsePolygons(e,i,s),2),l=f[0],c=f[1];r.polygons=l,i=c;var h=e.readDoubleLE(i)-.4643643;i+=8,r.objects=this.parseObjects(e,i,h),i+=28*h;var p=e.readDoubleLE(i)-.2345672;if(i+=8,r.pictures=this.parsePictures(e,i,p),i+=54*p,6754362!==e.readInt32LE(i))throw new Error("End of data marker mismatch");i+=4;var d=t.cryptTop10(e.slice(i,i+688));if(r.top10=u.bufferToTop10(d),i+=688,8674642!==e.readInt32LE(i))throw new Error("End of file marker mismatch");return r},t.parsePolygons=function(t,e,r){for(var n=[],i=0;i<r;i++){var o=new u.Polygon;o.grass=Boolean(t.readInt32LE(e)),e+=4;var a=t.readInt32LE(e);e+=4;for(var s=0;s<a;s++){var f=t.readDoubleLE(e);e+=8;var l=t.readDoubleLE(e);e+=8,o.vertices.push(new u.Position(f,-l))}n.push(o)}return[n,e]},t.parseObjects=function(t,e,r){for(var n=[],i=0;i<r;i++){var o=new u.ElmaObject;if(o.position.x=t.readDoubleLE(e),e+=8,o.position.y=-t.readDoubleLE(e),e+=8,o.type=t.readInt32LE(e),o.type<1||o.type>4)throw new Error("Invalid object type value="+o.type+" at offset="+e);if(e+=4,o.gravity=t.readInt32LE(e),o.gravity<0||o.gravity>4)throw new Error("Invalid gravity value="+o.gravity+" at offset="+e);e+=4,o.animation=t.readInt32LE(e)+1,e+=4,n.push(o)}return n},t.parsePictures=function(t,e,r){for(var n=[],i=0;i<r;i++){var o=new u.Picture;if(o.name=u.trimString(t.slice(e,e+10)),e+=10,o.texture=u.trimString(t.slice(e,e+10)),e+=10,o.mask=u.trimString(t.slice(e,e+10)),e+=10,o.position.x=t.readDoubleLE(e),e+=8,o.position.y=-t.readDoubleLE(e),e+=8,o.distance=t.readInt32LE(e),e+=4,o.clip=t.readInt32LE(e),o.clip<0||o.clip>2)throw new Error("Invalid clip value="+o.clip+" at offset="+e);e+=4,n.push(o)}return n},t.prototype.toBuffer=function(){var e,r,n,s,f,l,c,h,p,d;this.integrity=this.calculateIntegrity();var y=850;try{for(var g=i(this.polygons),v=g.next();!v.done;v=g.next()){y+=8+16*(_=v.value).vertices.length}}catch(t){e={error:t}}finally{try{v&&!v.done&&(r=g.return)&&r.call(g)}finally{if(e)throw e.error}}y+=28*this.objects.length+54*this.pictures.length;var w=a.Buffer.alloc(y);if(this.version!==o.Elma)throw new Error("Only Elma levels are supported");w.write("POT14",0,5,"ascii"),w.writeUInt16LE(65535&this.link,5),w.writeUInt32LE(this.link,7);for(var E=0;E<this.integrity.length;E++)w.writeDoubleLE(this.integrity[E],11+8*E);var m=u.nullpadString(this.name,51);w.write(m,43,51,"ascii");var b=u.nullpadString(this.lgr,16);w.write(b,94,16,"ascii");var I=u.nullpadString(this.ground,10);w.write(I,110,10,"ascii");var L=u.nullpadString(this.sky,10);w.write(L,120,10,"ascii"),w.writeDoubleLE(this.polygons.length+.4643643,130);var P=138;try{for(var S=i(this.polygons),T=S.next();!T.done;T=S.next()){var _=T.value;w.writeInt32LE(_.grass?1:0,P),P+=4,w.writeInt32LE(_.vertices.length,P),P+=4;try{for(var A=(f=void 0,i(_.vertices)),R=A.next();!R.done;R=A.next()){var U=R.value;w.writeDoubleLE(U.x,P),P+=8,w.writeDoubleLE(-U.y,P),P+=8}}catch(t){f={error:t}}finally{try{R&&!R.done&&(l=A.return)&&l.call(A)}finally{if(f)throw f.error}}}}catch(t){n={error:t}}finally{try{T&&!T.done&&(s=S.return)&&s.call(S)}finally{if(n)throw n.error}}w.writeDoubleLE(this.objects.length+.4643643,P),P+=8;try{for(var O=i(this.objects),B=O.next();!B.done;B=O.next()){var D=B.value;w.writeDoubleLE(D.position.x,P),P+=8,w.writeDoubleLE(-D.position.y,P),P+=8,w.writeInt32LE(D.type,P),P+=4,w.writeInt32LE(D.gravity,P),P+=4,w.writeInt32LE(D.animation-1,P),P+=4}}catch(t){c={error:t}}finally{try{B&&!B.done&&(h=O.return)&&h.call(O)}finally{if(c)throw c.error}}w.writeDoubleLE(this.pictures.length+.2345672,P),P+=8;try{for(var j=i(this.pictures),x=j.next();!x.done;x=j.next()){var M=x.value,k=u.nullpadString(M.name,10);w.write(k,P,10,"ascii"),P+=10;var C=u.nullpadString(M.texture,10);w.write(C,P,10,"ascii"),P+=10;var Y=u.nullpadString(M.mask,10);w.write(Y,P,10,"ascii"),P+=10,w.writeDoubleLE(M.position.x,P),P+=8,w.writeDoubleLE(-M.position.y,P),P+=8,w.writeInt32LE(M.distance,P),P+=4,w.writeInt32LE(M.clip,P),P+=4}}catch(t){p={error:t}}finally{try{x&&!x.done&&(d=j.return)&&d.call(j)}finally{if(p)throw p.error}}w.writeInt32LE(6754362,P),P+=4;var N=u.top10ToBuffer(this.top10);return t.cryptTop10(N).copy(w,P),P+=688,w.writeInt32LE(8674642,P),w},t.prototype.calculateIntegrity=function(){var t=3247.764325643*(this.polygons.reduce((function(t,e){return t+e.vertices.reduce((function(t,e){return t+e.x+e.y}),0)}),0)+this.objects.reduce((function(t,e){var r=0;return e.type===u.ObjectType.Exit?r=1:e.type===u.ObjectType.Apple?r=2:e.type===u.ObjectType.Killer?r=3:e.type===u.ObjectType.Start&&(r=4),t+e.position.x+e.position.y+r}),0)+this.pictures.reduce((function(t,e){return t+e.position.x+e.position.y}),0));return[t,this.getRandomInt(0,5871)+11877-t,this.getRandomInt(0,5871)+11877-t,this.getRandomInt(0,6102)+12112-t]},t.prototype.getRandomInt=function(t,e){return t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t))+t},t}();e.default=s},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";e.byteLength=function(t){var e=f(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=f(t),a=n[0],u=n[1],s=new o(function(t,e,r){return 3*(e+r)/4-r}(0,a,u)),l=0,c=u>0?a-4:a;for(r=0;r<c;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],s[l++]=e>>16&255,s[l++]=e>>8&255,s[l++]=255&e;2===u&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,s[l++]=255&e);1===u&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,s[l++]=e>>8&255,s[l++]=255&e);return s},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=0,u=r-i;a<u;a+=16383)o.push(l(t,a,a+16383>u?u:a+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,s=a.length;u<s;++u)n[u]=a[u],i[a.charCodeAt(u)]=u;function f(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,r){for(var i,o,a=[],u=e;u<r;u+=3)i=(t[u]<<16&16711680)+(t[u+1]<<8&65280)+(255&t[u+2]),a.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,n,i){var o,a,u=8*i-n-1,s=(1<<u)-1,f=s>>1,l=-7,c=r?i-1:0,h=r?-1:1,p=t[e+c];for(c+=h,o=p&(1<<-l)-1,p>>=-l,l+=u;l>0;o=256*o+t[e+c],c+=h,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+t[e+c],c+=h,l-=8);if(0===o)o=1-f;else{if(o===s)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),o-=f}return(p?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,u,s,f=8*o-i-1,l=(1<<f)-1,c=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(s=Math.pow(2,-a))<1&&(a--,s*=2),(e+=a+c>=1?h/s:h*Math.pow(2,1-c))*s>=2&&(a++,s/=2),a+c>=l?(u=0,a=l):a+c>=1?(u=(e*s-1)*Math.pow(2,i),a+=c):(u=e*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;t[r+p]=255&u,p+=d,u/=256,i-=8);for(a=a<<i|u,f+=i;f>0;t[r+p]=255&a,p+=d,a/=256,f-=8);t[r+p-d]|=128*y}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Direction=void 0;var n=r(0);!function(t){t[t.Left=0]="Left",t[t.Right=1]="Right"}(e.Direction||(e.Direction={}));var i=function(){function t(){this.bike=new n.Position(0,0),this.leftWheel=new n.Position(0,0),this.rightWheel=new n.Position(0,0),this.head=new n.Position(0,0),this.bikeRotation=0,this.leftWheelRotation=0,this.rightWheelRotation=0,this.backWheelSpeed=0,this.collisionStrength=0,this.throttleAndDirection=0}return Object.defineProperty(t.prototype,"throttle",{get:function(){return 0!=(1&this.throttleAndDirection)},set:function(t){this.throttleAndDirection=-2&this.throttleAndDirection|(t?1:0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"direction",{get:function(){return 2&this.throttleAndDirection},set:function(t){this.throttleAndDirection=-5&this.throttleAndDirection|t<<2},enumerable:!1,configurable:!0}),t}();e.default=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){this.frames=[],this.events=[]};e.default=n},function(t,e,r){"use strict";(function(t){var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.ReplayFinishStateReason=void 0;var i,o=r(0),a=r(2),u=r(4),s=r(5);!function(t){t.Touch="Touch",t.NoTouch="NoTouch",t.FrameDifference="FrameDifference"}(i=e.ReplayFinishStateReason||(e.ReplayFinishStateReason={}));var f=function(){function e(){this.link=0,this.level="",this.isMulti=!1,this.isFlagTag=!1,this.rides=[],this.path=""}return e.from=function(e){return this.parseBuffer(t.from(e))},e.parseBuffer=function(t){for(var r=new e,i=0;i<t.length;){var o=n(this.parseRide(t.slice(i)),2),a=o[0],u=o[1];Object.assign(r,a),r.rides.push(u),i+=44+27*u.frames.length+16*u.events.length}return r},e.parseRide=function(t){var r=new u.Ride,n=0,i=t.readUInt32LE(n);n+=8;var o=Boolean(t.readInt32LE(n));n+=4;var s=Boolean(t.readInt32LE(n));n+=4;var f=t.readUInt32LE(n);n+=4;var l=a.trimString(t.slice(n,n+12));n+=16;var c={isMulti:o,isFlagTag:s,link:f,level:l};r.frames=e.parseFrames(t.slice(n,n+27*i),i),n+=27*i;var h=t.readUInt32LE(n);if(n+=4,r.events=e.parseEvents(t.slice(n,n+16*h),h),n+=16*h,4796277!==t.readInt32LE(n))throw new Error("End of replay marker mismatch");return[c,r]},e.parseFrames=function(t,e){for(var r=[],n=0;n<e;n++){var i=new u.Frame;i.bike=new o.Position(t.readFloatLE(4*n),t.readFloatLE(4*n+4*e)),i.leftWheel=new o.Position(t.readInt16LE(2*n+8*e),t.readInt16LE(2*n+10*e)),i.rightWheel=new o.Position(t.readInt16LE(2*n+12*e),t.readInt16LE(2*n+14*e)),i.head=new o.Position(t.readInt16LE(2*n+16*e),t.readInt16LE(2*n+18*e)),i.bikeRotation=t.readInt16LE(2*n+20*e),i.leftWheelRotation=t.readUInt8(n+22*e),i.rightWheelRotation=t.readUInt8(n+23*e),i.throttleAndDirection=t.readUInt8(n+24*e),i.backWheelSpeed=t.readUInt8(n+25*e),i.collisionStrength=t.readUInt8(n+26*e),r.push(i)}return r},e.parseEvents=function(t,e){for(var r=[],n=0,i=0;i<e;i++){var o=t.readDoubleLE(n);n+=8;var a=t.readInt16LE(n);n+=2;var u=t.readUInt8(n);n+=2;var s=t.readFloatLE(n);if(n+=4,u<0||u>7)throw new Error("Invalid event type value="+u+" at event offset="+n);r.push({time:o,touchInfo:a,type:u,groundInfo:s})}return r},e.prototype.toBuffer=function(){var e=this,r=this.rides.reduce((function(t,e){return t+(44+27*e.frames.length+16*e.events.length)}),0),n=t.alloc(r),i=0;return this.rides.forEach((function(t){var r=t.frames.length;n.writeUInt32LE(r,i),n.writeUInt32LE(131,i+4),n.writeUInt32LE(e.isMulti?1:0,i+8),n.writeUInt32LE(e.isFlagTag?1:0,i+12),n.writeUInt32LE(e.link,i+16),n.write(a.nullpadString(e.level,12),i+20,12,"ascii"),n.writeUInt32LE(0,i+32),i+=36;for(var o=0;o<r;o++)n.writeFloatLE(t.frames[o].bike.x,i+4*o),n.writeFloatLE(t.frames[o].bike.y,i+4*o+4*r),n.writeInt16LE(t.frames[o].leftWheel.x,i+2*o+8*r),n.writeInt16LE(t.frames[o].leftWheel.y,i+2*o+10*r),n.writeInt16LE(t.frames[o].rightWheel.x,i+2*o+12*r),n.writeInt16LE(t.frames[o].rightWheel.y,i+2*o+14*r),n.writeInt16LE(t.frames[o].head.x,i+2*o+16*r),n.writeInt16LE(t.frames[o].head.y,i+2*o+18*r),n.writeInt16LE(t.frames[o].bikeRotation,i+2*o+20*r),n.writeUInt8(t.frames[o].leftWheelRotation,i+o+22*r),n.writeUInt8(t.frames[o].rightWheelRotation,i+o+23*r),n.writeUInt8(t.frames[o].throttleAndDirection,i+o+24*r),n.writeUInt8(t.frames[o].backWheelSpeed,i+o+25*r),n.writeUInt8(t.frames[o].collisionStrength,i+o+26*r);i+=27*r,n.writeUInt32LE(t.events.length,i),i+=4,t.events.forEach((function(t){n.writeDoubleLE(t.time,i),i+=8;switch(t.type){case s.EventType.Touch:n.writeInt16LE(t.touchInfo,i),n.writeUInt8(t.type,i+2),n.writeUInt8(0,i+3),n.writeFloatLE(0,i+4);break;case s.EventType.Ground:n.writeInt16LE(-1,i),n.writeUInt8(t.type,i+2),n.writeUInt8(0,i+3),n.writeFloatLE(t.groundInfo,i+4);break;default:n.writeInt16LE(-1,i),n.writeUInt8(t.type,i+2),n.writeUInt8(0,i+3),n.writeFloatLE(.99,i+4)}i+=8})),n.writeUInt32LE(4796277,i),i+=4})),n},e.prototype.getTime=function(){var t=this.rides.reduce((function(t,e){var r=t?t.time:0,n=e.events.length>0?e.events[e.events.length-1]:void 0;return(n?n.time:0)>r?n:t}),void 0),e=33.333*this.rides.reduce((function(t,e){return e.frames.length>t?e.frames.length:t}),0);if(t&&t.type!==s.EventType.Touch||!t)return{finished:!1,reason:i.NoTouch,time:Math.round(e)};var r=2.2893772893772897*t.time*1e3;return e>r+33.333?{finished:!1,reason:i.FrameDifference,time:Math.round(e)}:{finished:!0,reason:i.Touch,time:Math.floor(r)}},Object.defineProperty(e.prototype,"apples",{get:function(){return this.rides.reduce((function(t,e){return t+=e.events.filter((function(t){return 4===t.type})).length}),0)},enumerable:!1,configurable:!0}),e}();e.default=f}).call(this,r(1).Buffer)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(19);Object.defineProperty(e,"LGR",{enumerable:!0,get:function(){return n.default}});var i=r(20);Object.defineProperty(e,"PictureData",{enumerable:!0,get:function(){return i.default}});var o=r(21);Object.defineProperty(e,"PictureDeclaration",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(e,"PictureType",{enumerable:!0,get:function(){return o.PictureType}}),Object.defineProperty(e,"Transparency",{enumerable:!0,get:function(){return o.Transparency}})},function(t,e,r){"use strict";var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a};Object.defineProperty(e,"__esModule",{value:!0});var i=r(1),o=r(3),a=r(2),u=function(){function t(){this.pictureList=[],this.pictureData=[],this.path=""}return t.from=function(t){return this.parseBuffer(i.Buffer.from(t))},t.parseBuffer=function(e){var r=new t,i=e.toString("ascii",0,5);if("LGR12"!==i)throw new Error("Invalid LGR version: "+i);var o=e.readInt32LE(5),a=e.readInt32LE(9);if(1002!==a)throw new Error("Invalid header: "+a);var u=e.readInt32LE(13);r.pictureList=r.parseListData(e.slice(17,17+26*u),u);var s=n(r.parsePictureData(e.slice(17+26*u),o),2),f=s[0],l=s[1];if(r.pictureData=f,187565543!==e.readInt32LE(17+26*u+l))throw new Error("EOF marker expected at byte: "+(17+26*u+l));return r},t.prototype.toBuffer=function(){var t=this.pictureList.length,e=this.pictureData.reduce((function(t,e){return t+e.data.length+24}),21+26*t),r=i.Buffer.alloc(e),n=0;return r.write("LGR12",n,5,"ascii"),n+=5,r.writeUInt32LE(this.pictureData.length,n),n+=4,r.writeInt32LE(1002,n),n+=4,r.writeUInt32LE(t,n),n+=4,this.pictureList.forEach((function(e,i){r.write(a.nullpadString(e.name,10),n+10*i,10,"ascii"),r.writeUInt32LE(e.pictureType,n+10*t+4*i),r.writeUInt32LE(e.distance,n+14*t+4*i),r.writeUInt32LE(e.clipping,n+18*t+4*i),r.writeUInt32LE(e.transparency,n+22*t+4*i)})),n+=26*t,this.pictureData.forEach((function(t){r.write(a.nullpadString(t.name,20),n,20,"ascii"),n+=20,r.writeUInt32LE(t.data.length,n),n+=4,n+=t.data.copy(r,n)})),r.writeInt32LE(187565543,n),r},t.prototype.parseListData=function(t,e){var r=[],n=0,i=t.slice(n,n+10*e);n+=10*e;var u=t.slice(n,n+4*e);n+=4*e;var s=t.slice(n,n+4*e);n+=4*e;var f=t.slice(n,n+4*e);n+=4*e;for(var l=t.slice(n,n+4*e),c=0;c<e;c++){var h=new o.PictureDeclaration;h.name=a.trimString(i.slice(10*c,10*c+10)),h.pictureType=u.readInt32LE(4*c),h.distance=s.readInt32LE(4*c),h.clipping=f.readInt32LE(4*c),h.transparency=l.readInt32LE(4*c),r.push(h)}return r},t.prototype.parsePictureData=function(t,e){for(var r=[],n=0,i=0;i<e;i++){var u=a.trimString(t.slice(n,n+12));n+=20;var s=t.readUInt32LE(n);n+=4;var f=t.slice(n,n+s);r.push(new o.PictureData(u,f)),n+=s}return[r,n]},t}();e.default=u},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(t,e){this.name=t,this.data=e};e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Transparency=e.PictureType=void 0;var n,i,o=r(0);!function(t){t[t.Normal=100]="Normal",t[t.Texture=101]="Texture",t[t.Mask=102]="Mask"}(n=e.PictureType||(e.PictureType={})),function(t){t[t.Solid=10]="Solid",t[t.Palette=11]="Palette",t[t.TopLeft=12]="TopLeft",t[t.TopRight=13]="TopRight",t[t.BottomLeft=14]="BottomLeft",t[t.BottomRight=15]="BottomRight"}(i=e.Transparency||(e.Transparency={}));var a=function(){this.name="",this.pictureType=n.Normal,this.distance=450,this.clipping=o.Clip.Sky,this.transparency=i.TopLeft};e.default=a},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(23);Object.defineProperty(e,"State",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(e,"PlayMode",{enumerable:!0,get:function(){return n.PlayMode}}),Object.defineProperty(e,"VideoDetail",{enumerable:!0,get:function(){return n.VideoDetail}}),Object.defineProperty(e,"SoundOptimization",{enumerable:!0,get:function(){return n.SoundOptimization}})},function(t,e,r){"use strict";var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},i=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(n(arguments[e]));return t},o=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.VideoDetail=e.SoundOptimization=e.PlayMode=void 0;var a,u,s,f=r(1),l=r(2);!function(t){t[t.Single=1]="Single",t[t.Multi=0]="Multi"}(a=e.PlayMode||(e.PlayMode={})),function(t){t[t.Compatibility=1]="Compatibility",t[t.BestQuality=0]="BestQuality"}(u=e.SoundOptimization||(e.SoundOptimization={})),function(t){t[t.Low=0]="Low",t[t.High=1]="High"}(s=e.VideoDetail||(e.VideoDetail={}));var c=function(){function t(){this.version=200,this.times=Array(90).fill({single:[],multi:[]}),this.players=[],this.playerAName="",this.playerBName="",this.playerAKeys={brake:208,changeDirection:57,rotateLeft:203,rotateRight:205,throttle:200,toggleNavigator:47,toggleShowHide:2,toggleTimer:20},this.playerBKeys={brake:80,changeDirection:82,rotateLeft:79,rotateRight:81,throttle:76,toggleNavigator:48,toggleShowHide:3,toggleTimer:21},this.soundEnabled=!0,this.soundOptimization=u.BestQuality,this.playMode=a.Single,this.flagTag=!1,this.swapBikes=!1,this.videoDetail=s.High,this.animatedObjects=!0,this.animatedMenus=!0,this.incScreenSizeKey=13,this.decScreenSizeKey=12,this.screenshotKey=23,this.lastEditedLevName="",this.lastPlayedExternal=""}return t.from=function(t){if(67910!==t.length)throw Error("Invalid state.dat file, expected buffer length of 67910, got "+t.length);return this.parseBuffer(t)},t.parseBuffer=function(e){var r=new t,n=this.cryptState(e),i=0;if(200!==n.readUInt32LE(i))throw Error("Invalid state.dat file");i+=4;for(var o=0;o<90;o++){var a=n.slice(i,i+688),u=l.bufferToTop10(a);r.times[o]=u,i+=688}var s=n.readUInt32LE(i+5800);if(s>50)throw Error("Expected max 50 player entries, got "+s);for(o=0;o<s;o++){var f=i+116*o,c=this.parsePlayer(n.slice(f,f+116));r.players.push(c)}i+=5804,r.playerAName=l.trimString(n.slice(i,i+15)),i+=15,r.playerBName=l.trimString(n.slice(i,i+15)),i+=15,r.soundEnabled=Boolean(n.readInt32LE(i)),i+=4,r.soundOptimization=n.readInt32LE(i),i+=4,r.playMode=n.readInt32LE(i),i+=4,r.flagTag=Boolean(n.readInt32LE(i)),i+=4,r.swapBikes=!Boolean(n.readInt32LE(i)),i+=4,r.videoDetail=n.readInt32LE(i),i+=4,r.animatedObjects=Boolean(n.readInt32LE(i)),i+=4,r.animatedMenus=Boolean(n.readInt32LE(i)),i+=4,r.playerAKeys=this.parsePlayerKeys(n.slice(i,i+32)),i+=32,r.playerBKeys=this.parsePlayerKeys(n.slice(i,i+32)),i+=32,r.incScreenSizeKey=n.readUInt32LE(i),i+=4,r.decScreenSizeKey=n.readUInt32LE(i),i+=4,r.screenshotKey=n.readUInt32LE(i),i+=4,r.lastEditedLevName=l.trimString(n.slice(i,i+20)),i+=20,r.lastPlayedExternal=l.trimString(n.slice(i,i+20)),i+=20;var h=n.readUInt32LE(i);if(123432221!==h&&123432112!==h)throw Error("Expected EOF marker, got "+h);return r},t.parsePlayer=function(t){if(116!==t.length)throw Error("Expected buffer of length 116, got "+t.length);return{name:l.trimString(t.slice(0,16)),skippedInternals:i(t.slice(16,70)).map(Boolean),lastInternal:t.readUInt32LE(108),selectedInternal:t.readUInt32LE(112)}},t.parsePlayerKeys=function(t){if(32!==t.length)throw Error("Expected buffer of length 32, got "+t.length);var e=0,r=t.readUInt32LE(e);e+=4;var n=t.readUInt32LE(e);e+=4;var i=t.readUInt32LE(e);e+=4;var o=t.readUInt32LE(e);e+=4;var a=t.readUInt32LE(e);e+=4;var u=t.readUInt32LE(e);e+=4;var s=t.readUInt32LE(e);return e+=4,{throttle:r,brake:n,rotateRight:i,rotateLeft:o,changeDirection:a,toggleNavigator:u,toggleTimer:s,toggleShowHide:t.readUInt32LE(e)}},t.cryptState=function(t){var e,r,n=f.Buffer.from(t),i=[4,61920,5800,4,15,15,4,4,4,4,4,4,4,4,32,32,4,4,4,20,20],a=0;try{for(var u=o(i),s=u.next();!s.done;s=u.next()){var l=s.value;this.cryptStatePiece(n.slice(a,a+l)).copy(n,a),a+=l}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}return n},t.cryptStatePiece=function(t){for(var e=f.Buffer.from(t),r=23,n=9782,i=0;i<t.length;i++)e[i]^=255&r,r=(65535&(r=31*(n+=r%3391*3391)+3391))-2*(32768&r);return e},t.prototype.toBuffer=function(){var e,r,n,i,a=f.Buffer.alloc(67910),u=0;a.writeUInt32LE(200),u+=4;try{for(var s=o(this.times.slice(0,90)),c=s.next();!c.done;c=s.next()){var h=c.value;l.top10ToBuffer(h).copy(a,u),u+=688}}catch(t){e={error:t}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}u=61924;try{for(var p=o(this.players.slice(0,50)),d=p.next();!d.done;d=p.next()){var y=d.value,g=l.nullpadString(y.name,16);a.write(g,u,16,"ascii"),u+=16;var v=y.skippedInternals.slice(0,54);v.forEach((function(t){a.writeUInt8(t?1:0,u),u+=1})),v.length<54&&(u+=54-v.length),u+=38,a.writeInt32LE(y.lastInternal,u),u+=4,a.writeInt32LE(y.selectedInternal,u),u+=4}}catch(t){n={error:t}}finally{try{d&&!d.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}return this.players.length<50&&(a.fill(0,u,u+116*(50-this.players.length)),u+=116*(50-this.players.length)),a.writeUInt32LE(this.players.length,u),u+=4,a.write(l.nullpadString(this.playerAName,15),u,15,"ascii"),u+=15,a.write(l.nullpadString(this.playerBName,15),u,15,"ascii"),u+=15,a.writeInt32LE(this.soundEnabled?1:0,u),u+=4,a.writeInt32LE(this.soundOptimization,u),u+=4,a.writeInt32LE(this.playMode,u),u+=4,a.writeInt32LE(this.flagTag?1:0,u),u+=4,a.writeInt32LE(this.swapBikes?0:1,u),u+=4,a.writeInt32LE(this.videoDetail,u),u+=4,a.writeInt32LE(this.animatedObjects?1:0,u),u+=4,a.writeInt32LE(this.animatedMenus?1:0,u),u+=4,[this.playerAKeys,this.playerBKeys].forEach((function(t){a.writeUInt32LE(t.throttle,u),u+=4,a.writeUInt32LE(t.brake,u),u+=4,a.writeUInt32LE(t.rotateRight,u),u+=4,a.writeUInt32LE(t.rotateLeft,u),u+=4,a.writeUInt32LE(t.changeDirection,u),u+=4,a.writeUInt32LE(t.toggleNavigator,u),u+=4,a.writeUInt32LE(t.toggleTimer,u),u+=4,a.writeUInt32LE(t.toggleShowHide,u),u+=4})),a.writeUInt32LE(this.incScreenSizeKey,u),u+=4,a.writeUInt32LE(this.decScreenSizeKey,u),u+=4,a.writeUInt32LE(this.screenshotKey,u),u+=4,a.write(l.nullpadString(this.lastEditedLevName,20),u,20,"ascii"),u+=20,a.write(l.nullpadString(this.lastPlayedExternal,20),u,20,"ascii"),u+=20,a.writeUInt32LE(123432221,u),t.cryptState(a)},t}();e.default=c}])}));
//# sourceMappingURL=main.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc