1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-06-17 01:16:00 +00:00
This commit is contained in:
MatteZ02
2020-03-03 22:30:50 +02:00
parent edfcc6f474
commit 30022c7634
11800 changed files with 1984416 additions and 1 deletions

3
node_modules/bytebuffer/.npmignore generated vendored Normal file
View File

@ -0,0 +1,3 @@
node_modules/
npm-debug.log
.idea/

5
node_modules/bytebuffer/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,5 @@
language: node_js
node_js:
- 0.12
- 4.2
sudo: false

202
node_modules/bytebuffer/LICENSE generated vendored Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

64
node_modules/bytebuffer/README.md generated vendored Normal file
View File

@ -0,0 +1,64 @@
![bytebuffer.js - The swiss army knife for binary data in JavaScript.](https://raw.github.com/dcodeIO/bytebuffer.js/master/bytebuffer.png)
======================================
A fast and complete ByteBuffer implementation using either ArrayBuffers in the browser or node Buffers under node.js,
generated from a single source tree through [MetaScript](https://github.com/dcodeIO/MetaScript).
[![Build Status](https://travis-ci.org/dcodeIO/bytebuffer.js.svg?branch=master)](https://travis-ci.org/dcodeIO/bytebuffer.js)
[![Donate](https://raw.githubusercontent.com/dcodeIO/bytebuffer.js/master/donate.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=dcode%40dcode.io&item_name=%3C3%20bytebuffer.js)
Features
--------
* Three API-compatible versions:
* **bytebuffer**   Backing buffer: ArrayBuffer, Accessor: Uint8Array
* **bytebuffer-dataview**   Backing buffer: ArrayBuffer, Accessor: DataView
* **bytebuffer-node**   Backing buffer / Accessor: node Buffer
* 8, 16, 32 and 64 bit (through [long.js](https://github.com/dcodeIO/long.js)) signed and unsigned integers
* 32 and 64 bit floats
* Varints as used in protobuf (32 and 64 bit, zig-zag)
* [Base64](https://github.com/dcodeIO/lxiv), [utf8](https://github.com/dcodeIO/utfx), binary, hex and debug encodings
* Handy string and debugging utilities
* Big and little endianness
* Relative and absolute zero-copy operations wherever possible
* Transparent resizing when using unknown-length data
* Chaining of all operations that do not return a specific value
* Slicing, appending, prepending, reversing, flip, mark, reset, etc.
Usage
-----
The library is compatible with CommonJS and AMD loaders and is exposed globally as `dcodeIO.ByteBuffer` if neither is
available.
```javascript
var ByteBuffer = require("bytebuffer");
var bb = new ByteBuffer()
.writeIString("Hello world!")
.flip();
console.log(bb.readIString()+" from bytebuffer.js");
```
In the browser, 64 bit integer support is optional and present only if [Long.js](https://github.com/dcodeIO/long.js) has
been loaded prior to bytebuffer.js.
API
---
* [View the API documentation](https://github.com/dcodeIO/bytebuffer.js/wiki/API)
* [Check the wiki](https://github.com/dcodeIO/bytebuffer.js/wiki)
Downloads
---------
* [Distributions](https://github.com/dcodeIO/bytebuffer.js/tree/master/dist)
* [ZIP-Archive](https://github.com/dcodeIO/bytebuffer.js/archive/master.zip)
* [Tarball](https://github.com/dcodeIO/bytebuffer.js/tarball/master)
Support for IE<10, FF<15, Chrome<9 etc.
---------------------------------------
* Use bytebuffer-dataview with a polyfill ([see](https://github.com/dcodeIO/bytebuffer.js/tree/master/dist))
Contributors
------------
[Dretch](https://github.com/Dretch) (IE8 compatibility)
License
-------
**License:** [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) - Logo derived from [W3C HTML5 Logos](http://www.w3.org/html/logo/) (CC A 3.0)

12
node_modules/bytebuffer/bower.json generated vendored Normal file
View File

@ -0,0 +1,12 @@
{
"name": "bytebuffer",
"version": "5.0.1",
"author": "Daniel Wirtz <dcode@dcode.io>",
"description": "A full-featured ByteBuffer implementation using typed arrays.",
"main": "dist/bytebuffer.js",
"keywords": ["net", "array", "buffer", "arraybuffer", "typed array", "bytebuffer", "json", "websocket", "webrtc"],
"dependencies": {
"long": "latest"
},
"license": "Apache-2.0"
}

BIN
node_modules/bytebuffer/bytebuffer.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

47
node_modules/bytebuffer/dist/README.md generated vendored Normal file
View File

@ -0,0 +1,47 @@
Distributions
=============
ByteBuffer.js uses either ArrayBuffers in the browser or Buffers under node.js.
### Browser: [ArrayBuffer](https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)-backed
##### Accessed through Typed Arrays
Using Typed Arrays here is pretty much ideal, but it [requires a somewhat recent browser](http://caniuse.com/#feat=typedarrays).
* **[bytebuffer.js](https://raw.githubusercontent.com/dcodeIO/ByteBuffer.js/master/dist/bytebuffer.js)**
uses an ArrayBuffer as its backing buffer, accessed through an [Uint8Array](https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).
* **[bytebuffer.min.js](https://raw.githubusercontent.com/dcodeIO/ByteBuffer.js/master/dist/bytebuffer.min.js)**
has been compiled with Closure Compiler using advanced optimizations.
* **[bytebuffer.min.js.gz](https://raw.githubusercontent.com/dcodeIO/ByteBuffer.js/master/dist/bytebuffer.min.js.gz)**
has also been gzipped using `-9`.
* **[bytebuffer.min.map](https://raw.githubusercontent.com/dcodeIO/ByteBuffer.js/master/dist/bytebuffer.min.map)**
is the source map generated by Closure Compiler.
##### Accessed through a DataView ([polyfill](https://github.com/inexorabletash/polyfill/blob/master/typedarray.js) compatible)
Using DataViews is [generally slower](https://github.com/dcodeIO/ByteBuffer.js/issues/16) but works well with common polyfills for
older browsers (avoids array access operators on Typed Arrays).
* **[bytebuffer-dataview.js](https://raw.githubusercontent.com/dcodeIO/ByteBuffer.js/master/dist/bytebuffer-dataview.js)**
uses an ArrayBuffer as its backing buffer, accessed through a [DataView](https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/DataView).
* **[bytebuffer-dataview.min.js](https://raw.githubusercontent.com/dcodeIO/ByteBuffer.js/master/dist/bytebuffer-dataview.min.js)**
has been compiled with Closure Compiler using advanced optimizations.
* **[bytebuffer-dataview.min.js.gz](https://raw.githubusercontent.com/dcodeIO/ByteBuffer.js/master/dist/bytebuffer-dataview.min.js.gz)**
has also been gzipped using `-9`.
* **[bytebuffer-dataview.min.map](https://raw.githubusercontent.com/dcodeIO/ByteBuffer.js/master/dist/bytebuffer-dataview.min.map)**
is the source map generated by Closure Compiler.
### node.js: [Buffer](https://nodejs.org/api/buffer.html)-backed
* **[bytebuffer-node.js](https://raw.githubusercontent.com/dcodeIO/ByteBuffer.js/master/dist/bytebuffer-node.js)**
uses a [node Buffer](https://nodejs.org/api/buffer.html) as its backing buffer and accessor.
Also available as `bytebuffer` on [npm](https://www.npmjs.org/package/bytebuffer) and
[bower](http://bower.io/search/?q=bytebuffer).

3461
node_modules/bytebuffer/dist/bytebuffer-dataview.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,88 @@
/*
bytebuffer.js (c) 2015 Daniel Wirtz <dcode@dcode.io>
Backing buffer: ArrayBuffer, Accessor: DataView
Released under the Apache License, Version 2.0
see: https://github.com/dcodeIO/bytebuffer.js for details
*/
(function(h,m){if("function"===typeof define&&define.amd)define(["long"],m);else if("function"===typeof require&&"object"===typeof module&&module&&module.exports){var s=module,f;try{f=require("long")}catch(d){}f=m(f);s.exports=f}else(h.dcodeIO=h.dcodeIO||{}).ByteBuffer=m(h.dcodeIO.Long)})(this,function(h){function m(a){var b=0;return function(){return b<a.length?a.charCodeAt(b++):null}}function s(){var a=[],b=[];return function(){if(0===arguments.length)return b.join("")+u.apply(String,a);1024<a.length+
arguments.length&&(b.push(u.apply(String,a)),a.length=0);Array.prototype.push.apply(a,arguments)}}var f=function(a,b,c){"undefined"===typeof a&&(a=f.DEFAULT_CAPACITY);"undefined"===typeof b&&(b=f.DEFAULT_ENDIAN);"undefined"===typeof c&&(c=f.DEFAULT_NOASSERT);if(!c){a|=0;if(0>a)throw RangeError("Illegal capacity");b=!!b;c=!!c}this.buffer=0===a?t:new ArrayBuffer(a);this.view=0===a?null:new DataView(this.buffer);this.offset=0;this.markedOffset=-1;this.limit=a;this.littleEndian=b;this.noAssert=c};f.VERSION=
"5.0.1";f.LITTLE_ENDIAN=!0;f.BIG_ENDIAN=!1;f.DEFAULT_CAPACITY=16;f.DEFAULT_ENDIAN=f.BIG_ENDIAN;f.DEFAULT_NOASSERT=!1;f.Long=h||null;var d=f.prototype;Object.defineProperty(d,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1});var t=new ArrayBuffer(0),u=String.fromCharCode;f.accessor=function(){return DataView};f.allocate=function(a,b,c){return new f(a,b,c)};f.concat=function(a,b,c,e){if("boolean"===typeof b||"string"!==typeof b)e=c,c=b,b=void 0;for(var k=0,d=0,g=a.length,p;d<g;++d)f.isByteBuffer(a[d])||
(a[d]=f.wrap(a[d],b)),p=a[d].limit-a[d].offset,0<p&&(k+=p);if(0===k)return new f(0,c,e);b=new f(k,c,e);e=new Uint8Array(b.buffer);for(d=0;d<g;)c=a[d++],p=c.limit-c.offset,0>=p||(e.set((new Uint8Array(c.buffer)).subarray(c.offset,c.limit),b.offset),b.offset+=p);b.limit=b.offset;b.offset=0;return b};f.isByteBuffer=function(a){return!0===(a&&a.__isByteBuffer__)};f.type=function(){return ArrayBuffer};f.wrap=function(a,b,c,e){"string"!==typeof b&&(e=c,c=b,b=void 0);if("string"===typeof a)switch("undefined"===
typeof b&&(b="utf8"),b){case "base64":return f.fromBase64(a,c);case "hex":return f.fromHex(a,c);case "binary":return f.fromBinary(a,c);case "utf8":return f.fromUTF8(a,c);case "debug":return f.fromDebug(a,c);default:throw Error("Unsupported encoding: "+b);}if(null===a||"object"!==typeof a)throw TypeError("Illegal buffer");if(f.isByteBuffer(a))return b=d.clone.call(a),b.markedOffset=-1,b;if(a instanceof Uint8Array)b=new f(0,c,e),0<a.length&&(b.buffer=a.buffer,b.offset=a.byteOffset,b.limit=a.byteOffset+
a.byteLength,b.view=new DataView(a.buffer));else if(a instanceof ArrayBuffer)b=new f(0,c,e),0<a.byteLength&&(b.buffer=a,b.offset=0,b.limit=a.byteLength,b.view=0<a.byteLength?new DataView(a):null);else if("[object Array]"===Object.prototype.toString.call(a))for(b=new f(a.length,c,e),b.limit=a.length,c=0;c<a.length;++c)b.view.setUint8(c,a[c]);else throw TypeError("Illegal buffer");return b};d.writeBitSet=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if(!(a instanceof
Array))throw TypeError("Illegal BitSet: Not an array");if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}var e=b,k=a.length,d=k>>3,g=0,f;for(b+=this.writeVarint32(k,b);d--;)f=!!a[g++]&1|(!!a[g++]&1)<<1|(!!a[g++]&1)<<2|(!!a[g++]&1)<<3|(!!a[g++]&1)<<4|(!!a[g++]&1)<<5|(!!a[g++]&1)<<6|(!!a[g++]&1)<<7,this.writeByte(f,b++);if(g<k){for(f=d=0;g<
k;)f|=(!!a[g++]&1)<<d++;this.writeByte(f,b++)}return c?(this.offset=b,this):b-e};d.readBitSet=function(a){var b="undefined"===typeof a;b&&(a=this.offset);var c=this.readVarint32(a),e=c.value,k=e>>3,d=0,g=[];for(a+=c.length;k--;)c=this.readByte(a++),g[d++]=!!(c&1),g[d++]=!!(c&2),g[d++]=!!(c&4),g[d++]=!!(c&8),g[d++]=!!(c&16),g[d++]=!!(c&32),g[d++]=!!(c&64),g[d++]=!!(c&128);if(d<e)for(k=0,c=this.readByte(a++);d<e;)g[d++]=!!(c>>k++&1);b&&(this.offset=a);return g};d.readBytes=function(a,b){var c="undefined"===
typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+a>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+"+a+") <= "+this.buffer.byteLength);}var e=this.slice(b,b+a);c&&(this.offset+=a);return e};d.writeBytes=d.append;d.writeInt8=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");
a|=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}b+=1;var e=this.buffer.byteLength;b>e&&this.resize((e*=2)>b?e:b);this.view.setInt8(b-1,a);c&&(this.offset+=1);return this};d.writeByte=d.writeInt8;d.readInt8=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+
a+" (not an integer)");a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength);}a=this.view.getInt8(a);b&&(this.offset+=1);return a};d.readByte=d.readInt8;d.writeUint8=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=
0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}b+=1;var e=this.buffer.byteLength;b>e&&this.resize((e*=2)>b?e:b);this.view.setUint8(b-1,a);c&&(this.offset+=1);return this};d.writeUInt8=d.writeUint8;d.readUint8=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+
a+" (+1) <= "+this.buffer.byteLength);}a=this.view.getUint8(a);b&&(this.offset+=1);return a};d.readUInt8=d.readUint8;d.writeInt16=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a|=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);
}b+=2;var e=this.buffer.byteLength;b>e&&this.resize((e*=2)>b?e:b);this.view.setInt16(b-2,a,this.littleEndian);c&&(this.offset+=2);return this};d.writeShort=d.writeInt16;d.readInt16=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+2) <= "+this.buffer.byteLength);}a=this.view.getInt16(a,this.littleEndian);
b&&(this.offset+=2);return a};d.readShort=d.readInt16;d.writeUint16=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}b+=2;var e=this.buffer.byteLength;b>e&&this.resize((e*=
2)>b?e:b);this.view.setUint16(b-2,a,this.littleEndian);c&&(this.offset+=2);return this};d.writeUInt16=d.writeUint16;d.readUint16=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+2) <= "+this.buffer.byteLength);}a=this.view.getUint16(a,this.littleEndian);b&&(this.offset+=2);return a};d.readUInt16=
d.readUint16;d.writeInt32=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a|=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}b+=4;var e=this.buffer.byteLength;b>e&&this.resize((e*=2)>b?e:b);this.view.setInt32(b-4,
a,this.littleEndian);c&&(this.offset+=4);return this};d.writeInt=d.writeInt32;d.readInt32=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+4) <= "+this.buffer.byteLength);}a=this.view.getInt32(a,this.littleEndian);b&&(this.offset+=4);return a};d.readInt=d.readInt32;d.writeUint32=function(a,b){var c=
"undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}b+=4;var e=this.buffer.byteLength;b>e&&this.resize((e*=2)>b?e:b);this.view.setUint32(b-4,a,this.littleEndian);c&&(this.offset+=4);return this};
d.writeUInt32=d.writeUint32;d.readUint32=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+4) <= "+this.buffer.byteLength);}a=this.view.getUint32(a,this.littleEndian);b&&(this.offset+=4);return a};d.readUInt32=d.readUint32;h&&(d.writeInt64=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);
if(!this.noAssert){if("number"===typeof a)a=h.fromNumber(a);else if("string"===typeof a)a=h.fromString(a);else if(!(a&&a instanceof h))throw TypeError("Illegal value: "+a+" (not an integer or Long)");if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}"number"===typeof a?a=h.fromNumber(a):"string"===typeof a&&(a=h.fromString(a));b+=8;var e=
this.buffer.byteLength;b>e&&this.resize((e*=2)>b?e:b);b-=8;this.littleEndian?(this.view.setInt32(b,a.low,!0),this.view.setInt32(b+4,a.high,!0)):(this.view.setInt32(b,a.high,!1),this.view.setInt32(b+4,a.low,!1));c&&(this.offset+=8);return this},d.writeLong=d.writeInt64,d.readInt64=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+
a+" (+8) <= "+this.buffer.byteLength);}a=this.littleEndian?new h(this.view.getInt32(a,!0),this.view.getInt32(a+4,!0),!1):new h(this.view.getInt32(a+4,!1),this.view.getInt32(a,!1),!1);b&&(this.offset+=8);return a},d.readLong=d.readInt64,d.writeUint64=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"===typeof a)a=h.fromNumber(a);else if("string"===typeof a)a=h.fromString(a);else if(!(a&&a instanceof h))throw TypeError("Illegal value: "+a+" (not an integer or Long)");
if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}"number"===typeof a?a=h.fromNumber(a):"string"===typeof a&&(a=h.fromString(a));b+=8;var e=this.buffer.byteLength;b>e&&this.resize((e*=2)>b?e:b);b-=8;this.littleEndian?(this.view.setInt32(b,a.low,!0),this.view.setInt32(b+4,a.high,!0)):(this.view.setInt32(b,a.high,!1),this.view.setInt32(b+4,
a.low,!1));c&&(this.offset+=8);return this},d.writeUInt64=d.writeUint64,d.readUint64=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+8) <= "+this.buffer.byteLength);}a=this.littleEndian?new h(this.view.getInt32(a,!0),this.view.getInt32(a+4,!0),!0):new h(this.view.getInt32(a+4,!1),this.view.getInt32(a,
!1),!0);b&&(this.offset+=8);return a},d.readUInt64=d.readUint64);d.writeFloat32=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a)throw TypeError("Illegal value: "+a+" (not a number)");if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}b+=4;var e=this.buffer.byteLength;b>e&&this.resize((e*=
2)>b?e:b);this.view.setFloat32(b-4,a,this.littleEndian);c&&(this.offset+=4);return this};d.writeFloat=d.writeFloat32;d.readFloat32=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+4) <= "+this.buffer.byteLength);}a=this.view.getFloat32(a,this.littleEndian);b&&(this.offset+=4);return a};d.readFloat=
d.readFloat32;d.writeFloat64=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a)throw TypeError("Illegal value: "+a+" (not a number)");if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}b+=8;var e=this.buffer.byteLength;b>e&&this.resize((e*=2)>b?e:b);this.view.setFloat64(b-8,a,this.littleEndian);
c&&(this.offset+=8);return this};d.writeDouble=d.writeFloat64;d.readFloat64=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+8) <= "+this.buffer.byteLength);}a=this.view.getFloat64(a,this.littleEndian);b&&(this.offset+=8);return a};d.readDouble=d.readFloat64;f.MAX_VARINT32_BYTES=5;f.calculateVarint32=
function(a){a>>>=0;return 128>a?1:16384>a?2:2097152>a?3:268435456>a?4:5};f.zigZagEncode32=function(a){return((a|=0)<<1^a>>31)>>>0};f.zigZagDecode32=function(a){return a>>>1^-(a&1)|0};d.writeVarint32=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a|=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+
b+" (+0) <= "+this.buffer.byteLength);}var e=f.calculateVarint32(a),k;b+=e;k=this.buffer.byteLength;b>k&&this.resize((k*=2)>b?k:b);b-=e;for(a>>>=0;128<=a;)k=a&127|128,this.view.setUint8(b++,k),a>>>=7;this.view.setUint8(b++,a);return c?(this.offset=b,this):e};d.writeVarint32ZigZag=function(a,b){return this.writeVarint32(f.zigZagEncode32(a),b)};d.readVarint32=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+
a+" (not an integer)");a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength);}var c=0,e=0,k;do{if(!this.noAssert&&a>this.limit)throw a=Error("Truncated"),a.truncated=!0,a;k=this.view.getUint8(a++);5>c&&(e|=(k&127)<<7*c);++c}while(0!==(k&128));e|=0;return b?(this.offset=a,e):{value:e,length:c}};d.readVarint32ZigZag=function(a){a=this.readVarint32(a);"object"===typeof a?a.value=f.zigZagDecode32(a.value):a=f.zigZagDecode32(a);return a};
h&&(f.MAX_VARINT64_BYTES=10,f.calculateVarint64=function(a){"number"===typeof a?a=h.fromNumber(a):"string"===typeof a&&(a=h.fromString(a));var b=a.toInt()>>>0,c=a.shiftRightUnsigned(28).toInt()>>>0;a=a.shiftRightUnsigned(56).toInt()>>>0;return 0==a?0==c?16384>b?128>b?1:2:2097152>b?3:4:16384>c?128>c?5:6:2097152>c?7:8:128>a?9:10},f.zigZagEncode64=function(a){"number"===typeof a?a=h.fromNumber(a,!1):"string"===typeof a?a=h.fromString(a,!1):!1!==a.unsigned&&(a=a.toSigned());return a.shiftLeft(1).xor(a.shiftRight(63)).toUnsigned()},
f.zigZagDecode64=function(a){"number"===typeof a?a=h.fromNumber(a,!1):"string"===typeof a?a=h.fromString(a,!1):!1!==a.unsigned&&(a=a.toSigned());return a.shiftRightUnsigned(1).xor(a.and(h.ONE).toSigned().negate()).toSigned()},d.writeVarint64=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"===typeof a)a=h.fromNumber(a);else if("string"===typeof a)a=h.fromString(a);else if(!(a&&a instanceof h))throw TypeError("Illegal value: "+a+" (not an integer or Long)");
if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}"number"===typeof a?a=h.fromNumber(a,!1):"string"===typeof a?a=h.fromString(a,!1):!1!==a.unsigned&&(a=a.toSigned());var e=f.calculateVarint64(a),k=a.toInt()>>>0,d=a.shiftRightUnsigned(28).toInt()>>>0,g=a.shiftRightUnsigned(56).toInt()>>>0;b+=e;var p=this.buffer.byteLength;b>p&&this.resize((p*=
2)>b?p:b);b-=e;switch(e){case 10:this.view.setUint8(b+9,g>>>7&1);case 9:this.view.setUint8(b+8,9!==e?g|128:g&127);case 8:this.view.setUint8(b+7,8!==e?d>>>21|128:d>>>21&127);case 7:this.view.setUint8(b+6,7!==e?d>>>14|128:d>>>14&127);case 6:this.view.setUint8(b+5,6!==e?d>>>7|128:d>>>7&127);case 5:this.view.setUint8(b+4,5!==e?d|128:d&127);case 4:this.view.setUint8(b+3,4!==e?k>>>21|128:k>>>21&127);case 3:this.view.setUint8(b+2,3!==e?k>>>14|128:k>>>14&127);case 2:this.view.setUint8(b+1,2!==e?k>>>7|128:
k>>>7&127);case 1:this.view.setUint8(b,1!==e?k|128:k&127)}return c?(this.offset+=e,this):e},d.writeVarint64ZigZag=function(a,b){return this.writeVarint64(f.zigZagEncode64(a),b)},d.readVarint64=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength);}var c=a,e=0,k=0,d=
0,g=0,g=this.view.getUint8(a++),e=g&127;if(g&128&&(g=this.view.getUint8(a++),e|=(g&127)<<7,g&128&&(g=this.view.getUint8(a++),e|=(g&127)<<14,g&128&&(g=this.view.getUint8(a++),e|=(g&127)<<21,g&128&&(g=this.view.getUint8(a++),k=g&127,g&128&&(g=this.view.getUint8(a++),k|=(g&127)<<7,g&128&&(g=this.view.getUint8(a++),k|=(g&127)<<14,g&128&&(g=this.view.getUint8(a++),k|=(g&127)<<21,g&128&&(g=this.view.getUint8(a++),d=g&127,g&128&&(g=this.view.getUint8(a++),d|=(g&127)<<7,g&128))))))))))throw Error("Buffer overrun");
e=h.fromBits(e|k<<28,k>>>4|d<<24,!1);return b?(this.offset=a,e):{value:e,length:a-c}},d.readVarint64ZigZag=function(a){(a=this.readVarint64(a))&&a.value instanceof h?a.value=f.zigZagDecode64(a.value):a=f.zigZagDecode64(a);return a});d.writeCString=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);var e,d=a.length;if(!this.noAssert){if("string"!==typeof a)throw TypeError("Illegal str: Not a string");for(e=0;e<d;++e)if(0===a.charCodeAt(e))throw RangeError("Illegal str: Contains NULL-characters");
if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}d=n.calculateUTF16asUTF8(m(a))[1];b+=d+1;e=this.buffer.byteLength;b>e&&this.resize((e*=2)>b?e:b);b-=d+1;n.encodeUTF16toUTF8(m(a),function(a){this.view.setUint8(b++,a)}.bind(this));this.view.setUint8(b++,0);return c?(this.offset=b,this):d};d.readCString=function(a){var b="undefined"===typeof a;
b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength);}var c=a,e,d=-1;n.decodeUTF8toUTF16(function(){if(0===d)return null;if(a>=this.limit)throw RangeError("Illegal range: Truncated data, "+a+" < "+this.limit);d=this.view.getUint8(a++);return 0===d?null:d}.bind(this),e=s(),!0);return b?(this.offset=a,e()):
{string:e(),length:a-c}};d.writeIString=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("string"!==typeof a)throw TypeError("Illegal str: Not a string");if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}var e=b,d;d=n.calculateUTF16asUTF8(m(a),this.noAssert)[1];b+=4+d;var f=this.buffer.byteLength;b>f&&this.resize((f*=
2)>b?f:b);b-=4+d;this.view.setUint32(b,d,this.littleEndian);b+=4;n.encodeUTF16toUTF8(m(a),function(a){this.view.setUint8(b++,a)}.bind(this));if(b!==e+4+d)throw RangeError("Illegal range: Truncated data, "+b+" == "+(b+4+d));return c?(this.offset=b,this):b-e};d.readIString=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+
a+" (+4) <= "+this.buffer.byteLength);}var c=a,e=this.readUint32(a),e=this.readUTF8String(e,f.METRICS_BYTES,a+=4);a+=e.length;return b?(this.offset=a,e.string):{string:e.string,length:a-c}};f.METRICS_CHARS="c";f.METRICS_BYTES="b";d.writeUTF8String=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+
b+" (+0) <= "+this.buffer.byteLength);}var e,d=b;e=n.calculateUTF16asUTF8(m(a))[1];b+=e;var f=this.buffer.byteLength;b>f&&this.resize((f*=2)>b?f:b);b-=e;n.encodeUTF16toUTF8(m(a),function(a){this.view.setUint8(b++,a)}.bind(this));return c?(this.offset=b,this):b-d};d.writeString=d.writeUTF8String;f.calculateUTF8Chars=function(a){return n.calculateUTF16asUTF8(m(a))[0]};f.calculateUTF8Bytes=function(a){return n.calculateUTF16asUTF8(m(a))[1]};f.calculateString=f.calculateUTF8Bytes;d.readUTF8String=function(a,
b,c){"number"===typeof b&&(c=b,b=void 0);var e="undefined"===typeof c;e&&(c=this.offset);"undefined"===typeof b&&(b=f.METRICS_CHARS);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal length: "+a+" (not an integer)");a|=0;if("number"!==typeof c||0!==c%1)throw TypeError("Illegal offset: "+c+" (not an integer)");c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength);}var d=0,l=c,g;if(b===f.METRICS_CHARS){g=s();
n.decodeUTF8(function(){return d<a&&c<this.limit?this.view.getUint8(c++):null}.bind(this),function(a){++d;n.UTF8toUTF16(a,g)});if(d!==a)throw RangeError("Illegal range: Truncated data, "+d+" == "+a);return e?(this.offset=c,g()):{string:g(),length:c-l}}if(b===f.METRICS_BYTES){if(!this.noAssert){if("number"!==typeof c||0!==c%1)throw TypeError("Illegal offset: "+c+" (not an integer)");c>>>=0;if(0>c||c+a>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+"+a+") <= "+this.buffer.byteLength);
}var p=c+a;n.decodeUTF8toUTF16(function(){return c<p?this.view.getUint8(c++):null}.bind(this),g=s(),this.noAssert);if(c!==p)throw RangeError("Illegal range: Truncated data, "+c+" == "+p);return e?(this.offset=c,g()):{string:g(),length:c-l}}throw TypeError("Unsupported metrics: "+b);};d.readString=d.readUTF8String;d.writeVString=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("string"!==typeof a)throw TypeError("Illegal str: Not a string");if("number"!==typeof b||
0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}var e=b,d,l;d=n.calculateUTF16asUTF8(m(a),this.noAssert)[1];l=f.calculateVarint32(d);b+=l+d;var g=this.buffer.byteLength;b>g&&this.resize((g*=2)>b?g:b);b-=l+d;b+=this.writeVarint32(d,b);n.encodeUTF16toUTF8(m(a),function(a){this.view.setUint8(b++,a)}.bind(this));if(b!==e+d+l)throw RangeError("Illegal range: Truncated data, "+
b+" == "+(b+d+l));return c?(this.offset=b,this):b-e};d.readVString=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength);}var c=a,e=this.readVarint32(a),e=this.readUTF8String(e.value,f.METRICS_BYTES,a+=e.length);a+=e.length;return b?(this.offset=a,e.string):{string:e.string,
length:a-c}};d.append=function(a,b,c){if("number"===typeof b||"string"!==typeof b)c=b,b=void 0;var e="undefined"===typeof c;e&&(c=this.offset);if(!this.noAssert){if("number"!==typeof c||0!==c%1)throw TypeError("Illegal offset: "+c+" (not an integer)");c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength);}a instanceof f||(a=f.wrap(a,b));b=a.limit-a.offset;if(0>=b)return this;c+=b;var d=this.buffer.byteLength;c>d&&this.resize((d*=2)>
c?d:c);(new Uint8Array(this.buffer,c-b)).set((new Uint8Array(a.buffer)).subarray(a.offset,a.limit));a.offset+=b;e&&(this.offset+=b);return this};d.appendTo=function(a,b){a.append(this,b);return this};d.assert=function(a){this.noAssert=!a;return this};d.capacity=function(){return this.buffer.byteLength};d.clear=function(){this.offset=0;this.limit=this.buffer.byteLength;this.markedOffset=-1;return this};d.clone=function(a){var b=new f(0,this.littleEndian,this.noAssert);a?(b.buffer=new ArrayBuffer(this.buffer.byteLength),
(new Uint8Array(b.buffer)).set(this.buffer),b.view=new DataView(b.buffer)):(b.buffer=this.buffer,b.view=this.view);b.offset=this.offset;b.markedOffset=this.markedOffset;b.limit=this.limit;return b};d.compact=function(a,b){"undefined"===typeof a&&(a=this.offset);"undefined"===typeof b&&(b=this.limit);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal begin: Not an integer");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal end: Not an integer");b>>>=0;if(0>a||
a>b||b>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+b+" <= "+this.buffer.byteLength);}if(0===a&&b===this.buffer.byteLength)return this;var c=b-a;if(0===c)return this.buffer=t,this.view=null,0<=this.markedOffset&&(this.markedOffset-=a),this.limit=this.offset=0,this;var e=new ArrayBuffer(c);(new Uint8Array(e)).set((new Uint8Array(this.buffer)).subarray(a,b));this.buffer=e;this.view=new DataView(e);0<=this.markedOffset&&(this.markedOffset-=a);this.offset=0;this.limit=c;return this};
d.copy=function(a,b){"undefined"===typeof a&&(a=this.offset);"undefined"===typeof b&&(b=this.limit);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal begin: Not an integer");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal end: Not an integer");b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+b+" <= "+this.buffer.byteLength);}if(a===b)return new f(0,this.littleEndian,this.noAssert);var c=b-a,e=new f(c,this.littleEndian,
this.noAssert);e.offset=0;e.limit=c;0<=e.markedOffset&&(e.markedOffset-=a);this.copyTo(e,0,a,b);return e};d.copyTo=function(a,b,c,e){var d,l;if(!this.noAssert&&!f.isByteBuffer(a))throw TypeError("Illegal target: Not a ByteBuffer");b=(l="undefined"===typeof b)?a.offset:b|0;c=(d="undefined"===typeof c)?this.offset:c|0;e="undefined"===typeof e?this.limit:e|0;if(0>b||b>a.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+b+" <= "+a.buffer.byteLength);if(0>c||e>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+
c+" <= "+this.buffer.byteLength);var g=e-c;if(0===g)return a;a.ensureCapacity(b+g);(new Uint8Array(a.buffer)).set((new Uint8Array(this.buffer)).subarray(c,e),b);d&&(this.offset+=g);l&&(a.offset+=g);return this};d.ensureCapacity=function(a){var b=this.buffer.byteLength;return b<a?this.resize((b*=2)>a?b:a):this};d.fill=function(a,b,c){var e="undefined"===typeof b;e&&(b=this.offset);"string"===typeof a&&0<a.length&&(a=a.charCodeAt(0));"undefined"===typeof b&&(b=this.offset);"undefined"===typeof c&&(c=
this.limit);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a|=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal begin: Not an integer");b>>>=0;if("number"!==typeof c||0!==c%1)throw TypeError("Illegal end: Not an integer");c>>>=0;if(0>b||b>c||c>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+b+" <= "+c+" <= "+this.buffer.byteLength);}if(b>=c)return this;for(;b<c;)this.view.setUint8(b++,a);e&&(this.offset=b);return this};
d.flip=function(){this.limit=this.offset;this.offset=0;return this};d.mark=function(a){a="undefined"===typeof a?this.offset:a;if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+0) <= "+this.buffer.byteLength);}this.markedOffset=a;return this};d.order=function(a){if(!this.noAssert&&"boolean"!==typeof a)throw TypeError("Illegal littleEndian: Not a boolean");
this.littleEndian=!!a;return this};d.LE=function(a){this.littleEndian="undefined"!==typeof a?!!a:!0;return this};d.BE=function(a){this.littleEndian="undefined"!==typeof a?!a:!1;return this};d.prepend=function(a,b,c){if("number"===typeof b||"string"!==typeof b)c=b,b=void 0;var e="undefined"===typeof c;e&&(c=this.offset);if(!this.noAssert){if("number"!==typeof c||0!==c%1)throw TypeError("Illegal offset: "+c+" (not an integer)");c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+
c+" (+0) <= "+this.buffer.byteLength);}a instanceof f||(a=f.wrap(a,b));b=a.limit-a.offset;if(0>=b)return this;var d=b-c;if(0<d){var l=new ArrayBuffer(this.buffer.byteLength+d),g=new Uint8Array(l);g.set((new Uint8Array(this.buffer)).subarray(c,this.buffer.byteLength),b);this.buffer=l;this.view=new DataView(l);this.offset+=d;0<=this.markedOffset&&(this.markedOffset+=d);this.limit+=d;c+=d}else g=new Uint8Array(this.buffer);g.set((new Uint8Array(a.buffer)).subarray(a.offset,a.limit),c-b);a.offset=a.limit;
e&&(this.offset-=b);return this};d.prependTo=function(a,b){a.prepend(this,b);return this};d.printDebug=function(a){"function"!==typeof a&&(a=console.log.bind(console));a(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))};d.remaining=function(){return this.limit-this.offset};d.reset=function(){0<=this.markedOffset?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0;return this};d.resize=function(a){if(!this.noAssert){if("number"!==
typeof a||0!==a%1)throw TypeError("Illegal capacity: "+a+" (not an integer)");a|=0;if(0>a)throw RangeError("Illegal capacity: 0 <= "+a);}this.buffer.byteLength<a&&(a=new ArrayBuffer(a),(new Uint8Array(a)).set(new Uint8Array(this.buffer)),this.buffer=a,this.view=new DataView(a));return this};d.reverse=function(a,b){"undefined"===typeof a&&(a=this.offset);"undefined"===typeof b&&(b=this.limit);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal begin: Not an integer");a>>>=0;
if("number"!==typeof b||0!==b%1)throw TypeError("Illegal end: Not an integer");b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+b+" <= "+this.buffer.byteLength);}if(a===b)return this;Array.prototype.reverse.call((new Uint8Array(this.buffer)).subarray(a,b));this.view=new DataView(this.buffer);return this};d.skip=function(a){if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal length: "+a+" (not an integer)");a|=0}var b=this.offset+
a;if(!this.noAssert&&(0>b||b>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+a+" <= "+this.buffer.byteLength);this.offset=b;return this};d.slice=function(a,b){"undefined"===typeof a&&(a=this.offset);"undefined"===typeof b&&(b=this.limit);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal begin: Not an integer");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal end: Not an integer");b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+
a+" <= "+b+" <= "+this.buffer.byteLength);}var c=this.clone();c.offset=a;c.limit=b;return c};d.toBuffer=function(a){var b=this.offset,c=this.limit;if(!this.noAssert){if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: Not an integer");b>>>=0;if("number"!==typeof c||0!==c%1)throw TypeError("Illegal limit: Not an integer");c>>>=0;if(0>b||b>c||c>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+b+" <= "+c+" <= "+this.buffer.byteLength);}if(!a&&0===b&&c===this.buffer.byteLength)return this.buffer;
if(b===c)return t;a=new ArrayBuffer(c-b);(new Uint8Array(a)).set((new Uint8Array(this.buffer)).subarray(b,c),0);return a};d.toArrayBuffer=d.toBuffer;d.toString=function(a,b,c){if("undefined"===typeof a)return"ByteBufferAB_DataView(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";"number"===typeof a&&(c=b=a="utf8");switch(a){case "utf8":return this.toUTF8(b,c);case "base64":return this.toBase64(b,c);case "hex":return this.toHex(b,c);case "binary":return this.toBinary(b,
c);case "debug":return this.toDebug();case "columns":return this.toColumns();default:throw Error("Unsupported encoding: "+a);}};var v=function(){for(var a={},b=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],c=[],e=0,d=b.length;e<d;++e)c[b[e]]=e;a.encode=function(a,c){for(var e,d;null!==(e=a());)c(b[e>>2&63]),d=(e&3)<<4,null!==(e=
a())?(d|=e>>4&15,c(b[(d|e>>4&15)&63]),d=(e&15)<<2,null!==(e=a())?(c(b[(d|e>>6&3)&63]),c(b[e&63])):(c(b[d&63]),c(61))):(c(b[d&63]),c(61),c(61))};a.decode=function(a,b){function e(a){throw Error("Illegal character code: "+a);}for(var d,k,f;null!==(d=a());)if(k=c[d],"undefined"===typeof k&&e(d),null!==(d=a())&&(f=c[d],"undefined"===typeof f&&e(d),b(k<<2>>>0|(f&48)>>4),null!==(d=a()))){k=c[d];if("undefined"===typeof k)if(61===d)break;else e(d);b((f&15)<<4>>>0|(k&60)>>2);if(null!==(d=a())){f=c[d];if("undefined"===
typeof f)if(61===d)break;else e(d);b((k&3)<<6>>>0|f)}}};a.test=function(a){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(a)};return a}();d.toBase64=function(a,b){"undefined"===typeof a&&(a=this.offset);"undefined"===typeof b&&(b=this.limit);a|=0;b|=0;if(0>a||b>this.capacity||a>b)throw RangeError("begin, end");var c;v.encode(function(){return a<b?this.view.getUint8(a++):null}.bind(this),c=s());return c()};f.fromBase64=function(a,b){if("string"!==typeof a)throw TypeError("str");
var c=new f(a.length/4*3,b),e=0;v.decode(m(a),function(a){c.view.setUint8(e++,a)});c.limit=e;return c};f.btoa=function(a){return f.fromBinary(a).toBase64()};f.atob=function(a){return f.fromBase64(a).toBinary()};d.toBinary=function(a,b){"undefined"===typeof a&&(a=this.offset);"undefined"===typeof b&&(b=this.limit);a|=0;b|=0;if(0>a||b>this.capacity()||a>b)throw RangeError("begin, end");if(a===b)return"";for(var c=[],e=[];a<b;)c.push(this.view.getUint8(a++)),1024<=c.length&&(e.push(String.fromCharCode.apply(String,
c)),c=[]);return e.join("")+String.fromCharCode.apply(String,c)};f.fromBinary=function(a,b){if("string"!==typeof a)throw TypeError("str");for(var c=0,e=a.length,d,l=new f(e,b);c<e;){d=a.charCodeAt(c);if(255<d)throw RangeError("illegal char code: "+d);l.view.setUint8(c++,d)}l.limit=e;return l};d.toDebug=function(a){for(var b=-1,c=this.buffer.byteLength,e,d="",f="",g="";b<c;){-1!==b&&(e=this.view.getUint8(b),d=16>e?d+("0"+e.toString(16).toUpperCase()):d+e.toString(16).toUpperCase(),a&&(f+=32<e&&127>
e?String.fromCharCode(e):"."));++b;if(a&&0<b&&0===b%16&&b!==c){for(;51>d.length;)d+=" ";g+=d+f+"\n";d=f=""}d=b===this.offset&&b===this.limit?d+(b===this.markedOffset?"!":"|"):b===this.offset?d+(b===this.markedOffset?"[":"<"):b===this.limit?d+(b===this.markedOffset?"]":">"):d+(b===this.markedOffset?"'":a||0!==b&&b!==c?" ":"")}if(a&&" "!==d){for(;51>d.length;)d+=" ";g+=d+f+"\n"}return a?g:d};f.fromDebug=function(a,b,c){var e=a.length;b=new f((e+1)/3|0,b,c);for(var d=0,l=0,g,h=!1,m=!1,n=!1,r=!1,q=!1;d<
e;){switch(g=a.charAt(d++)){case "!":if(!c){if(m||n||r){q=!0;break}m=n=r=!0}b.offset=b.markedOffset=b.limit=l;h=!1;break;case "|":if(!c){if(m||r){q=!0;break}m=r=!0}b.offset=b.limit=l;h=!1;break;case "[":if(!c){if(m||n){q=!0;break}m=n=!0}b.offset=b.markedOffset=l;h=!1;break;case "<":if(!c){if(m){q=!0;break}m=!0}b.offset=l;h=!1;break;case "]":if(!c){if(r||n){q=!0;break}r=n=!0}b.limit=b.markedOffset=l;h=!1;break;case ">":if(!c){if(r){q=!0;break}r=!0}b.limit=l;h=!1;break;case "'":if(!c){if(n){q=!0;break}n=
!0}b.markedOffset=l;h=!1;break;case " ":h=!1;break;default:if(!c&&h){q=!0;break}g=parseInt(g+a.charAt(d++),16);if(!c&&(isNaN(g)||0>g||255<g))throw TypeError("Illegal str: Not a debug encoded string");b.view.setUint8(l++,g);h=!0}if(q)throw TypeError("Illegal str: Invalid symbol at "+d);}if(!c){if(!m||!r)throw TypeError("Illegal str: Missing offset or limit");if(l<b.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+l+" < "+e);}return b};d.toHex=function(a,b){a=
"undefined"===typeof a?this.offset:a;b="undefined"===typeof b?this.limit:b;if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal begin: Not an integer");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal end: Not an integer");b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+b+" <= "+this.buffer.byteLength);}for(var c=Array(b-a),e;a<b;)e=this.view.getUint8(a++),16>e?c.push("0",e.toString(16)):c.push(e.toString(16));return c.join("")};
f.fromHex=function(a,b,c){if(!c){if("string"!==typeof a)throw TypeError("Illegal str: Not a string");if(0!==a.length%2)throw TypeError("Illegal str: Length not a multiple of 2");}var e=a.length;b=new f(e/2|0,b);for(var d,h=0,g=0;h<e;h+=2){d=parseInt(a.substring(h,h+2),16);if(!c&&(!isFinite(d)||0>d||255<d))throw TypeError("Illegal str: Contains non-hex characters");b.view.setUint8(g++,d)}b.limit=g;return b};var n=function(){var a={MAX_CODEPOINT:1114111,encodeUTF8:function(a,c){var e=null;"number"===
typeof a&&(e=a,a=function(){return null});for(;null!==e||null!==(e=a());)128>e?c(e&127):(2048>e?c(e>>6&31|192):(65536>e?c(e>>12&15|224):(c(e>>18&7|240),c(e>>12&63|128)),c(e>>6&63|128)),c(e&63|128)),e=null},decodeUTF8:function(a,c){for(var e,d,f,g,h=function(a){a=a.slice(0,a.indexOf(null));var b=Error(a.toString());b.name="TruncatedError";b.bytes=a;throw b;};null!==(e=a());)if(0===(e&128))c(e);else if(192===(e&224))null===(d=a())&&h([e,d]),c((e&31)<<6|d&63);else if(224===(e&240))null!==(d=a())&&null!==
(f=a())||h([e,d,f]),c((e&15)<<12|(d&63)<<6|f&63);else if(240===(e&248))null!==(d=a())&&null!==(f=a())&&null!==(g=a())||h([e,d,f,g]),c((e&7)<<18|(d&63)<<12|(f&63)<<6|g&63);else throw RangeError("Illegal starting byte: "+e);},UTF16toUTF8:function(a,c){for(var e,d=null;null!==(e=null!==d?d:a());)55296<=e&&57343>=e&&null!==(d=a())&&56320<=d&&57343>=d?(c(1024*(e-55296)+d-56320+65536),d=null):c(e);null!==d&&c(d)},UTF8toUTF16:function(a,c){var d=null;"number"===typeof a&&(d=a,a=function(){return null});
for(;null!==d||null!==(d=a());)65535>=d?c(d):(d-=65536,c((d>>10)+55296),c(d%1024+56320)),d=null},encodeUTF16toUTF8:function(b,c){a.UTF16toUTF8(b,function(b){a.encodeUTF8(b,c)})},decodeUTF8toUTF16:function(b,c){a.decodeUTF8(b,function(b){a.UTF8toUTF16(b,c)})},calculateCodePoint:function(a){return 128>a?1:2048>a?2:65536>a?3:4},calculateUTF8:function(a){for(var c,d=0;null!==(c=a());)d+=128>c?1:2048>c?2:65536>c?3:4;return d},calculateUTF16asUTF8:function(b){var c=0,d=0;a.UTF16toUTF8(b,function(a){++c;
d+=128>a?1:2048>a?2:65536>a?3:4});return[c,d]}};return a}();d.toUTF8=function(a,b){"undefined"===typeof a&&(a=this.offset);"undefined"===typeof b&&(b=this.limit);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal begin: Not an integer");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal end: Not an integer");b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+b+" <= "+this.buffer.byteLength);}var c;try{n.decodeUTF8toUTF16(function(){return a<
b?this.view.getUint8(a++):null}.bind(this),c=s())}catch(d){if(a!==b)throw RangeError("Illegal range: Truncated data, "+a+" != "+b);}return c()};f.fromUTF8=function(a,b,c){if(!c&&"string"!==typeof a)throw TypeError("Illegal str: Not a string");var d=new f(n.calculateUTF16asUTF8(m(a),!0)[1],b,c),h=0;n.encodeUTF16toUTF8(m(a),function(a){d.view.setUint8(h++,a)});d.limit=h;return d};return f});

Binary file not shown.

File diff suppressed because one or more lines are too long

3454
node_modules/bytebuffer/dist/bytebuffer-node.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

3746
node_modules/bytebuffer/dist/bytebuffer.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

93
node_modules/bytebuffer/dist/bytebuffer.min.js generated vendored Normal file
View File

@ -0,0 +1,93 @@
/*
bytebuffer.js (c) 2015 Daniel Wirtz <dcode@dcode.io>
Backing buffer: ArrayBuffer, Accessor: Uint8Array
Released under the Apache License, Version 2.0
see: https://github.com/dcodeIO/bytebuffer.js for details
*/
(function(k,m){if("function"===typeof define&&define.amd)define(["long"],m);else if("function"===typeof require&&"object"===typeof module&&module&&module.exports){var r=module,s;try{s=require("long")}catch(u){}s=m(s);r.exports=s}else(k.dcodeIO=k.dcodeIO||{}).ByteBuffer=m(k.dcodeIO.Long)})(this,function(k){function m(a){var b=0;return function(){return b<a.length?a.charCodeAt(b++):null}}function r(){var a=[],b=[];return function(){if(0===arguments.length)return b.join("")+w.apply(String,a);1024<a.length+
arguments.length&&(b.push(w.apply(String,a)),a.length=0);Array.prototype.push.apply(a,arguments)}}function s(a,b,c,d,f){var l;l=8*f-d-1;var g=(1<<l)-1,e=g>>1,h=-7;f=c?f-1:0;var k=c?-1:1,p=a[b+f];f+=k;c=p&(1<<-h)-1;p>>=-h;for(h+=l;0<h;c=256*c+a[b+f],f+=k,h-=8);l=c&(1<<-h)-1;c>>=-h;for(h+=d;0<h;l=256*l+a[b+f],f+=k,h-=8);if(0===c)c=1-e;else{if(c===g)return l?NaN:Infinity*(p?-1:1);l+=Math.pow(2,d);c-=e}return(p?-1:1)*l*Math.pow(2,c-d)}function u(a,b,c,d,f,l){var g,e=8*l-f-1,h=(1<<e)-1,k=h>>1,p=23===f?
Math.pow(2,-24)-Math.pow(2,-77):0;l=d?0:l-1;var m=d?1:-1,n=0>b||0===b&&0>1/b?1:0;b=Math.abs(b);isNaN(b)||Infinity===b?(b=isNaN(b)?1:0,d=h):(d=Math.floor(Math.log(b)/Math.LN2),1>b*(g=Math.pow(2,-d))&&(d--,g*=2),b=1<=d+k?b+p/g:b+p*Math.pow(2,1-k),2<=b*g&&(d++,g/=2),d+k>=h?(b=0,d=h):1<=d+k?(b=(b*g-1)*Math.pow(2,f),d+=k):(b=b*Math.pow(2,k-1)*Math.pow(2,f),d=0));for(;8<=f;a[c+l]=b&255,l+=m,b/=256,f-=8);d=d<<f|b;for(e+=f;0<e;a[c+l]=d&255,l+=m,d/=256,e-=8);a[c+l-m]|=128*n}var h=function(a,b,c){"undefined"===
typeof a&&(a=h.DEFAULT_CAPACITY);"undefined"===typeof b&&(b=h.DEFAULT_ENDIAN);"undefined"===typeof c&&(c=h.DEFAULT_NOASSERT);if(!c){a|=0;if(0>a)throw RangeError("Illegal capacity");b=!!b;c=!!c}this.buffer=0===a?v:new ArrayBuffer(a);this.view=0===a?null:new Uint8Array(this.buffer);this.offset=0;this.markedOffset=-1;this.limit=a;this.littleEndian=b;this.noAssert=c};h.VERSION="5.0.1";h.LITTLE_ENDIAN=!0;h.BIG_ENDIAN=!1;h.DEFAULT_CAPACITY=16;h.DEFAULT_ENDIAN=h.BIG_ENDIAN;h.DEFAULT_NOASSERT=!1;h.Long=k||
null;var e=h.prototype;Object.defineProperty(e,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1});var v=new ArrayBuffer(0),w=String.fromCharCode;h.accessor=function(){return Uint8Array};h.allocate=function(a,b,c){return new h(a,b,c)};h.concat=function(a,b,c,d){if("boolean"===typeof b||"string"!==typeof b)d=c,c=b,b=void 0;for(var f=0,l=0,g=a.length,e;l<g;++l)h.isByteBuffer(a[l])||(a[l]=h.wrap(a[l],b)),e=a[l].limit-a[l].offset,0<e&&(f+=e);if(0===f)return new h(0,c,d);b=new h(f,c,d);for(l=
0;l<g;)c=a[l++],e=c.limit-c.offset,0>=e||(b.view.set(c.view.subarray(c.offset,c.limit),b.offset),b.offset+=e);b.limit=b.offset;b.offset=0;return b};h.isByteBuffer=function(a){return!0===(a&&a.__isByteBuffer__)};h.type=function(){return ArrayBuffer};h.wrap=function(a,b,c,d){"string"!==typeof b&&(d=c,c=b,b=void 0);if("string"===typeof a)switch("undefined"===typeof b&&(b="utf8"),b){case "base64":return h.fromBase64(a,c);case "hex":return h.fromHex(a,c);case "binary":return h.fromBinary(a,c);case "utf8":return h.fromUTF8(a,
c);case "debug":return h.fromDebug(a,c);default:throw Error("Unsupported encoding: "+b);}if(null===a||"object"!==typeof a)throw TypeError("Illegal buffer");if(h.isByteBuffer(a))return b=e.clone.call(a),b.markedOffset=-1,b;if(a instanceof Uint8Array)b=new h(0,c,d),0<a.length&&(b.buffer=a.buffer,b.offset=a.byteOffset,b.limit=a.byteOffset+a.byteLength,b.view=new Uint8Array(a.buffer));else if(a instanceof ArrayBuffer)b=new h(0,c,d),0<a.byteLength&&(b.buffer=a,b.offset=0,b.limit=a.byteLength,b.view=0<
a.byteLength?new Uint8Array(a):null);else if("[object Array]"===Object.prototype.toString.call(a))for(b=new h(a.length,c,d),b.limit=a.length,c=0;c<a.length;++c)b.view[c]=a[c];else throw TypeError("Illegal buffer");return b};e.writeBitSet=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if(!(a instanceof Array))throw TypeError("Illegal BitSet: Not an array");if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>
this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}var d=b,f=a.length,e=f>>3,g=0,h;for(b+=this.writeVarint32(f,b);e--;)h=!!a[g++]&1|(!!a[g++]&1)<<1|(!!a[g++]&1)<<2|(!!a[g++]&1)<<3|(!!a[g++]&1)<<4|(!!a[g++]&1)<<5|(!!a[g++]&1)<<6|(!!a[g++]&1)<<7,this.writeByte(h,b++);if(g<f){for(h=e=0;g<f;)h|=(!!a[g++]&1)<<e++;this.writeByte(h,b++)}return c?(this.offset=b,this):b-d};e.readBitSet=function(a){var b="undefined"===typeof a;b&&(a=this.offset);var c=this.readVarint32(a),
d=c.value,f=d>>3,e=0,g=[];for(a+=c.length;f--;)c=this.readByte(a++),g[e++]=!!(c&1),g[e++]=!!(c&2),g[e++]=!!(c&4),g[e++]=!!(c&8),g[e++]=!!(c&16),g[e++]=!!(c&32),g[e++]=!!(c&64),g[e++]=!!(c&128);if(e<d)for(f=0,c=this.readByte(a++);e<d;)g[e++]=!!(c>>f++&1);b&&(this.offset=a);return g};e.readBytes=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+a>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+
b+" (+"+a+") <= "+this.buffer.byteLength);}var d=this.slice(b,b+a);c&&(this.offset+=a);return d};e.writeBytes=e.append;e.writeInt8=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a|=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);
}b+=1;var d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b);this.view[b-1]=a;c&&(this.offset+=1);return this};e.writeByte=e.writeInt8;e.readInt8=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength);}a=this.view[a];128===(a&128)&&(a=-(255-a+1));b&&(this.offset+=
1);return a};e.readByte=e.readInt8;e.writeUint8=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}b+=1;var d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b);
this.view[b-1]=a;c&&(this.offset+=1);return this};e.writeUInt8=e.writeUint8;e.readUint8=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength);}a=this.view[a];b&&(this.offset+=1);return a};e.readUInt8=e.readUint8;e.writeInt16=function(a,b){var c="undefined"===typeof b;
c&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a|=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}b+=2;var d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b);b-=2;this.littleEndian?(this.view[b+1]=(a&65280)>>>8,this.view[b]=a&255):(this.view[b]=(a&65280)>>>
8,this.view[b+1]=a&255);c&&(this.offset+=2);return this};e.writeShort=e.writeInt16;e.readInt16=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+2) <= "+this.buffer.byteLength);}var c=0;this.littleEndian?(c=this.view[a],c|=this.view[a+1]<<8):(c=this.view[a]<<8,c|=this.view[a+1]);32768===(c&32768)&&
(c=-(65535-c+1));b&&(this.offset+=2);return c};e.readShort=e.readInt16;e.writeUint16=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}b+=2;var d=this.buffer.byteLength;
b>d&&this.resize((d*=2)>b?d:b);b-=2;this.littleEndian?(this.view[b+1]=(a&65280)>>>8,this.view[b]=a&255):(this.view[b]=(a&65280)>>>8,this.view[b+1]=a&255);c&&(this.offset+=2);return this};e.writeUInt16=e.writeUint16;e.readUint16=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+2) <= "+this.buffer.byteLength);
}var c=0;this.littleEndian?(c=this.view[a],c|=this.view[a+1]<<8):(c=this.view[a]<<8,c|=this.view[a+1]);b&&(this.offset+=2);return c};e.readUInt16=e.readUint16;e.writeInt32=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a|=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+
b+" (+0) <= "+this.buffer.byteLength);}b+=4;var d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b);b-=4;this.littleEndian?(this.view[b+3]=a>>>24&255,this.view[b+2]=a>>>16&255,this.view[b+1]=a>>>8&255,this.view[b]=a&255):(this.view[b]=a>>>24&255,this.view[b+1]=a>>>16&255,this.view[b+2]=a>>>8&255,this.view[b+3]=a&255);c&&(this.offset+=4);return this};e.writeInt=e.writeInt32;e.readInt32=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%
1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+4) <= "+this.buffer.byteLength);}var c=0;this.littleEndian?(c=this.view[a+2]<<16,c|=this.view[a+1]<<8,c|=this.view[a],c+=this.view[a+3]<<24>>>0):(c=this.view[a+1]<<16,c|=this.view[a+2]<<8,c|=this.view[a+3],c+=this.view[a]<<24>>>0);b&&(this.offset+=4);return c|0};e.readInt=e.readInt32;e.writeUint32=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);
if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}b+=4;var d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b);b-=4;this.littleEndian?(this.view[b+3]=a>>>24&255,this.view[b+2]=a>>>16&255,this.view[b+1]=a>>>8&255,this.view[b]=
a&255):(this.view[b]=a>>>24&255,this.view[b+1]=a>>>16&255,this.view[b+2]=a>>>8&255,this.view[b+3]=a&255);c&&(this.offset+=4);return this};e.writeUInt32=e.writeUint32;e.readUint32=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+4) <= "+this.buffer.byteLength);}var c=0;this.littleEndian?(c=this.view[a+
2]<<16,c|=this.view[a+1]<<8,c|=this.view[a],c+=this.view[a+3]<<24>>>0):(c=this.view[a+1]<<16,c|=this.view[a+2]<<8,c|=this.view[a+3],c+=this.view[a]<<24>>>0);b&&(this.offset+=4);return c};e.readUInt32=e.readUint32;k&&(e.writeInt64=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"===typeof a)a=k.fromNumber(a);else if("string"===typeof a)a=k.fromString(a);else if(!(a&&a instanceof k))throw TypeError("Illegal value: "+a+" (not an integer or Long)");if("number"!==
typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}"number"===typeof a?a=k.fromNumber(a):"string"===typeof a&&(a=k.fromString(a));b+=8;var d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b);b-=8;var d=a.low,f=a.high;this.littleEndian?(this.view[b+3]=d>>>24&255,this.view[b+2]=d>>>16&255,this.view[b+1]=d>>>8&255,this.view[b]=d&255,b+=4,this.view[b+3]=
f>>>24&255,this.view[b+2]=f>>>16&255,this.view[b+1]=f>>>8&255,this.view[b]=f&255):(this.view[b]=f>>>24&255,this.view[b+1]=f>>>16&255,this.view[b+2]=f>>>8&255,this.view[b+3]=f&255,b+=4,this.view[b]=d>>>24&255,this.view[b+1]=d>>>16&255,this.view[b+2]=d>>>8&255,this.view[b+3]=d&255);c&&(this.offset+=8);return this},e.writeLong=e.writeInt64,e.readInt64=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");
a>>>=0;if(0>a||a+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+8) <= "+this.buffer.byteLength);}var c=0,d=0;this.littleEndian?(c=this.view[a+2]<<16,c|=this.view[a+1]<<8,c|=this.view[a],c+=this.view[a+3]<<24>>>0,a+=4,d=this.view[a+2]<<16,d|=this.view[a+1]<<8,d|=this.view[a],d+=this.view[a+3]<<24>>>0):(d=this.view[a+1]<<16,d|=this.view[a+2]<<8,d|=this.view[a+3],d+=this.view[a]<<24>>>0,a+=4,c=this.view[a+1]<<16,c|=this.view[a+2]<<8,c|=this.view[a+3],c+=this.view[a]<<24>>>0);
a=new k(c,d,!1);b&&(this.offset+=8);return a},e.readLong=e.readInt64,e.writeUint64=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"===typeof a)a=k.fromNumber(a);else if("string"===typeof a)a=k.fromString(a);else if(!(a&&a instanceof k))throw TypeError("Illegal value: "+a+" (not an integer or Long)");if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+
b+" (+0) <= "+this.buffer.byteLength);}"number"===typeof a?a=k.fromNumber(a):"string"===typeof a&&(a=k.fromString(a));b+=8;var d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b);b-=8;var d=a.low,f=a.high;this.littleEndian?(this.view[b+3]=d>>>24&255,this.view[b+2]=d>>>16&255,this.view[b+1]=d>>>8&255,this.view[b]=d&255,b+=4,this.view[b+3]=f>>>24&255,this.view[b+2]=f>>>16&255,this.view[b+1]=f>>>8&255,this.view[b]=f&255):(this.view[b]=f>>>24&255,this.view[b+1]=f>>>16&255,this.view[b+2]=f>>>8&255,
this.view[b+3]=f&255,b+=4,this.view[b]=d>>>24&255,this.view[b+1]=d>>>16&255,this.view[b+2]=d>>>8&255,this.view[b+3]=d&255);c&&(this.offset+=8);return this},e.writeUInt64=e.writeUint64,e.readUint64=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+8) <= "+this.buffer.byteLength);}var c=0,d=0;this.littleEndian?
(c=this.view[a+2]<<16,c|=this.view[a+1]<<8,c|=this.view[a],c+=this.view[a+3]<<24>>>0,a+=4,d=this.view[a+2]<<16,d|=this.view[a+1]<<8,d|=this.view[a],d+=this.view[a+3]<<24>>>0):(d=this.view[a+1]<<16,d|=this.view[a+2]<<8,d|=this.view[a+3],d+=this.view[a]<<24>>>0,a+=4,c=this.view[a+1]<<16,c|=this.view[a+2]<<8,c|=this.view[a+3],c+=this.view[a]<<24>>>0);a=new k(c,d,!0);b&&(this.offset+=8);return a},e.readUInt64=e.readUint64);e.writeFloat32=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"!==
typeof a)throw TypeError("Illegal value: "+a+" (not a number)");if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}b+=4;var d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b);u(this.view,a,b-4,this.littleEndian,23,4);c&&(this.offset+=4);return this};e.writeFloat=e.writeFloat32;e.readFloat32=function(a){var b="undefined"===typeof a;b&&
(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+4) <= "+this.buffer.byteLength);}a=s(this.view,a,this.littleEndian,23,4);b&&(this.offset+=4);return a};e.readFloat=e.readFloat32;e.writeFloat64=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a)throw TypeError("Illegal value: "+a+" (not a number)");
if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}b+=8;var d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b);u(this.view,a,b-8,this.littleEndian,52,8);c&&(this.offset+=8);return this};e.writeDouble=e.writeFloat64;e.readFloat64=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==
a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+8) <= "+this.buffer.byteLength);}a=s(this.view,a,this.littleEndian,52,8);b&&(this.offset+=8);return a};e.readDouble=e.readFloat64;h.MAX_VARINT32_BYTES=5;h.calculateVarint32=function(a){a>>>=0;return 128>a?1:16384>a?2:2097152>a?3:268435456>a?4:5};h.zigZagEncode32=function(a){return((a|=0)<<1^a>>31)>>>0};h.zigZagDecode32=function(a){return a>>>1^-(a&
1)|0};e.writeVarint32=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a|=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}var d=h.calculateVarint32(a),f;b+=d;f=this.buffer.byteLength;b>f&&this.resize((f*=2)>b?f:b);
b-=d;for(a>>>=0;128<=a;)f=a&127|128,this.view[b++]=f,a>>>=7;this.view[b++]=a;return c?(this.offset=b,this):d};e.writeVarint32ZigZag=function(a,b){return this.writeVarint32(h.zigZagEncode32(a),b)};e.readVarint32=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength);
}var c=0,d=0,f;do{if(!this.noAssert&&a>this.limit)throw a=Error("Truncated"),a.truncated=!0,a;f=this.view[a++];5>c&&(d|=(f&127)<<7*c);++c}while(0!==(f&128));d|=0;return b?(this.offset=a,d):{value:d,length:c}};e.readVarint32ZigZag=function(a){a=this.readVarint32(a);"object"===typeof a?a.value=h.zigZagDecode32(a.value):a=h.zigZagDecode32(a);return a};k&&(h.MAX_VARINT64_BYTES=10,h.calculateVarint64=function(a){"number"===typeof a?a=k.fromNumber(a):"string"===typeof a&&(a=k.fromString(a));var b=a.toInt()>>>
0,c=a.shiftRightUnsigned(28).toInt()>>>0;a=a.shiftRightUnsigned(56).toInt()>>>0;return 0==a?0==c?16384>b?128>b?1:2:2097152>b?3:4:16384>c?128>c?5:6:2097152>c?7:8:128>a?9:10},h.zigZagEncode64=function(a){"number"===typeof a?a=k.fromNumber(a,!1):"string"===typeof a?a=k.fromString(a,!1):!1!==a.unsigned&&(a=a.toSigned());return a.shiftLeft(1).xor(a.shiftRight(63)).toUnsigned()},h.zigZagDecode64=function(a){"number"===typeof a?a=k.fromNumber(a,!1):"string"===typeof a?a=k.fromString(a,!1):!1!==a.unsigned&&
(a=a.toSigned());return a.shiftRightUnsigned(1).xor(a.and(k.ONE).toSigned().negate()).toSigned()},e.writeVarint64=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"===typeof a)a=k.fromNumber(a);else if("string"===typeof a)a=k.fromString(a);else if(!(a&&a instanceof k))throw TypeError("Illegal value: "+a+" (not an integer or Long)");if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+
b+" (+0) <= "+this.buffer.byteLength);}"number"===typeof a?a=k.fromNumber(a,!1):"string"===typeof a?a=k.fromString(a,!1):!1!==a.unsigned&&(a=a.toSigned());var d=h.calculateVarint64(a),f=a.toInt()>>>0,e=a.shiftRightUnsigned(28).toInt()>>>0,g=a.shiftRightUnsigned(56).toInt()>>>0;b+=d;var t=this.buffer.byteLength;b>t&&this.resize((t*=2)>b?t:b);b-=d;switch(d){case 10:this.view[b+9]=g>>>7&1;case 9:this.view[b+8]=9!==d?g|128:g&127;case 8:this.view[b+7]=8!==d?e>>>21|128:e>>>21&127;case 7:this.view[b+6]=
7!==d?e>>>14|128:e>>>14&127;case 6:this.view[b+5]=6!==d?e>>>7|128:e>>>7&127;case 5:this.view[b+4]=5!==d?e|128:e&127;case 4:this.view[b+3]=4!==d?f>>>21|128:f>>>21&127;case 3:this.view[b+2]=3!==d?f>>>14|128:f>>>14&127;case 2:this.view[b+1]=2!==d?f>>>7|128:f>>>7&127;case 1:this.view[b]=1!==d?f|128:f&127}return c?(this.offset+=d,this):d},e.writeVarint64ZigZag=function(a,b){return this.writeVarint64(h.zigZagEncode64(a),b)},e.readVarint64=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==
typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength);}var c=a,d=0,f=0,e=0,g=0,g=this.view[a++],d=g&127;if(g&128&&(g=this.view[a++],d|=(g&127)<<7,g&128||this.noAssert&&"undefined"===typeof g)&&(g=this.view[a++],d|=(g&127)<<14,g&128||this.noAssert&&"undefined"===typeof g)&&(g=this.view[a++],d|=(g&127)<<21,g&128||this.noAssert&&"undefined"===typeof g)&&(g=this.view[a++],
f=g&127,g&128||this.noAssert&&"undefined"===typeof g)&&(g=this.view[a++],f|=(g&127)<<7,g&128||this.noAssert&&"undefined"===typeof g)&&(g=this.view[a++],f|=(g&127)<<14,g&128||this.noAssert&&"undefined"===typeof g)&&(g=this.view[a++],f|=(g&127)<<21,g&128||this.noAssert&&"undefined"===typeof g)&&(g=this.view[a++],e=g&127,g&128||this.noAssert&&"undefined"===typeof g)&&(g=this.view[a++],e|=(g&127)<<7,g&128||this.noAssert&&"undefined"===typeof g))throw Error("Buffer overrun");d=k.fromBits(d|f<<28,f>>>4|
e<<24,!1);return b?(this.offset=a,d):{value:d,length:a-c}},e.readVarint64ZigZag=function(a){(a=this.readVarint64(a))&&a.value instanceof k?a.value=h.zigZagDecode64(a.value):a=h.zigZagDecode64(a);return a});e.writeCString=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);var d,f=a.length;if(!this.noAssert){if("string"!==typeof a)throw TypeError("Illegal str: Not a string");for(d=0;d<f;++d)if(0===a.charCodeAt(d))throw RangeError("Illegal str: Contains NULL-characters");if("number"!==typeof b||
0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}f=n.calculateUTF16asUTF8(m(a))[1];b+=f+1;d=this.buffer.byteLength;b>d&&this.resize((d*=2)>b?d:b);b-=f+1;n.encodeUTF16toUTF8(m(a),function(a){this.view[b++]=a}.bind(this));this.view[b++]=0;return c?(this.offset=b,this):f};e.readCString=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==
typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength);}var c=a,d,f=-1;n.decodeUTF8toUTF16(function(){if(0===f)return null;if(a>=this.limit)throw RangeError("Illegal range: Truncated data, "+a+" < "+this.limit);f=this.view[a++];return 0===f?null:f}.bind(this),d=r(),!0);return b?(this.offset=a,d()):{string:d(),length:a-c}};e.writeIString=function(a,b){var c=
"undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("string"!==typeof a)throw TypeError("Illegal str: Not a string");if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}var d=b,f;f=n.calculateUTF16asUTF8(m(a),this.noAssert)[1];b+=4+f;var e=this.buffer.byteLength;b>e&&this.resize((e*=2)>b?e:b);b-=4+f;this.littleEndian?(this.view[b+
3]=f>>>24&255,this.view[b+2]=f>>>16&255,this.view[b+1]=f>>>8&255,this.view[b]=f&255):(this.view[b]=f>>>24&255,this.view[b+1]=f>>>16&255,this.view[b+2]=f>>>8&255,this.view[b+3]=f&255);b+=4;n.encodeUTF16toUTF8(m(a),function(a){this.view[b++]=a}.bind(this));if(b!==d+4+f)throw RangeError("Illegal range: Truncated data, "+b+" == "+(b+4+f));return c?(this.offset=b,this):b-d};e.readIString=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+
a+" (not an integer)");a>>>=0;if(0>a||a+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+4) <= "+this.buffer.byteLength);}var c=a,d=this.readUint32(a),d=this.readUTF8String(d,h.METRICS_BYTES,a+=4);a+=d.length;return b?(this.offset=a,d.string):{string:d.string,length:a-c}};h.METRICS_CHARS="c";h.METRICS_BYTES="b";e.writeUTF8String=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+
b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}var d,f=b;d=n.calculateUTF16asUTF8(m(a))[1];b+=d;var e=this.buffer.byteLength;b>e&&this.resize((e*=2)>b?e:b);b-=d;n.encodeUTF16toUTF8(m(a),function(a){this.view[b++]=a}.bind(this));return c?(this.offset=b,this):b-f};e.writeString=e.writeUTF8String;h.calculateUTF8Chars=function(a){return n.calculateUTF16asUTF8(m(a))[0]};h.calculateUTF8Bytes=function(a){return n.calculateUTF16asUTF8(m(a))[1]};
h.calculateString=h.calculateUTF8Bytes;e.readUTF8String=function(a,b,c){"number"===typeof b&&(c=b,b=void 0);var d="undefined"===typeof c;d&&(c=this.offset);"undefined"===typeof b&&(b=h.METRICS_CHARS);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal length: "+a+" (not an integer)");a|=0;if("number"!==typeof c||0!==c%1)throw TypeError("Illegal offset: "+c+" (not an integer)");c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+
this.buffer.byteLength);}var f=0,e=c,g;if(b===h.METRICS_CHARS){g=r();n.decodeUTF8(function(){return f<a&&c<this.limit?this.view[c++]:null}.bind(this),function(a){++f;n.UTF8toUTF16(a,g)});if(f!==a)throw RangeError("Illegal range: Truncated data, "+f+" == "+a);return d?(this.offset=c,g()):{string:g(),length:c-e}}if(b===h.METRICS_BYTES){if(!this.noAssert){if("number"!==typeof c||0!==c%1)throw TypeError("Illegal offset: "+c+" (not an integer)");c>>>=0;if(0>c||c+a>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+
c+" (+"+a+") <= "+this.buffer.byteLength);}var k=c+a;n.decodeUTF8toUTF16(function(){return c<k?this.view[c++]:null}.bind(this),g=r(),this.noAssert);if(c!==k)throw RangeError("Illegal range: Truncated data, "+c+" == "+k);return d?(this.offset=c,g()):{string:g(),length:c-e}}throw TypeError("Unsupported metrics: "+b);};e.readString=e.readUTF8String;e.writeVString=function(a,b){var c="undefined"===typeof b;c&&(b=this.offset);if(!this.noAssert){if("string"!==typeof a)throw TypeError("Illegal str: Not a string");
if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: "+b+" (not an integer)");b>>>=0;if(0>b||b+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+b+" (+0) <= "+this.buffer.byteLength);}var d=b,f,e;f=n.calculateUTF16asUTF8(m(a),this.noAssert)[1];e=h.calculateVarint32(f);b+=e+f;var g=this.buffer.byteLength;b>g&&this.resize((g*=2)>b?g:b);b-=e+f;b+=this.writeVarint32(f,b);n.encodeUTF16toUTF8(m(a),function(a){this.view[b++]=a}.bind(this));if(b!==d+f+e)throw RangeError("Illegal range: Truncated data, "+
b+" == "+(b+f+e));return c?(this.offset=b,this):b-d};e.readVString=function(a){var b="undefined"===typeof a;b&&(a=this.offset);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength);}var c=a,d=this.readVarint32(a),d=this.readUTF8String(d.value,h.METRICS_BYTES,a+=d.length);a+=d.length;return b?(this.offset=a,d.string):{string:d.string,
length:a-c}};e.append=function(a,b,c){if("number"===typeof b||"string"!==typeof b)c=b,b=void 0;var d="undefined"===typeof c;d&&(c=this.offset);if(!this.noAssert){if("number"!==typeof c||0!==c%1)throw TypeError("Illegal offset: "+c+" (not an integer)");c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength);}a instanceof h||(a=h.wrap(a,b));b=a.limit-a.offset;if(0>=b)return this;c+=b;var f=this.buffer.byteLength;c>f&&this.resize((f*=2)>
c?f:c);c-=b;this.view.set(a.view.subarray(a.offset,a.limit),c);a.offset+=b;d&&(this.offset+=b);return this};e.appendTo=function(a,b){a.append(this,b);return this};e.assert=function(a){this.noAssert=!a;return this};e.capacity=function(){return this.buffer.byteLength};e.clear=function(){this.offset=0;this.limit=this.buffer.byteLength;this.markedOffset=-1;return this};e.clone=function(a){var b=new h(0,this.littleEndian,this.noAssert);a?(b.buffer=new ArrayBuffer(this.buffer.byteLength),b.view=new Uint8Array(b.buffer)):
(b.buffer=this.buffer,b.view=this.view);b.offset=this.offset;b.markedOffset=this.markedOffset;b.limit=this.limit;return b};e.compact=function(a,b){"undefined"===typeof a&&(a=this.offset);"undefined"===typeof b&&(b=this.limit);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal begin: Not an integer");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal end: Not an integer");b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+
b+" <= "+this.buffer.byteLength);}if(0===a&&b===this.buffer.byteLength)return this;var c=b-a;if(0===c)return this.buffer=v,this.view=null,0<=this.markedOffset&&(this.markedOffset-=a),this.limit=this.offset=0,this;var d=new ArrayBuffer(c),f=new Uint8Array(d);f.set(this.view.subarray(a,b));this.buffer=d;this.view=f;0<=this.markedOffset&&(this.markedOffset-=a);this.offset=0;this.limit=c;return this};e.copy=function(a,b){"undefined"===typeof a&&(a=this.offset);"undefined"===typeof b&&(b=this.limit);if(!this.noAssert){if("number"!==
typeof a||0!==a%1)throw TypeError("Illegal begin: Not an integer");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal end: Not an integer");b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+b+" <= "+this.buffer.byteLength);}if(a===b)return new h(0,this.littleEndian,this.noAssert);var c=b-a,d=new h(c,this.littleEndian,this.noAssert);d.offset=0;d.limit=c;0<=d.markedOffset&&(d.markedOffset-=a);this.copyTo(d,0,a,b);return d};e.copyTo=function(a,
b,c,d){var f,e;if(!this.noAssert&&!h.isByteBuffer(a))throw TypeError("Illegal target: Not a ByteBuffer");b=(e="undefined"===typeof b)?a.offset:b|0;c=(f="undefined"===typeof c)?this.offset:c|0;d="undefined"===typeof d?this.limit:d|0;if(0>b||b>a.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+b+" <= "+a.buffer.byteLength);if(0>c||d>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+c+" <= "+this.buffer.byteLength);var g=d-c;if(0===g)return a;a.ensureCapacity(b+g);
a.view.set(this.view.subarray(c,d),b);f&&(this.offset+=g);e&&(a.offset+=g);return this};e.ensureCapacity=function(a){var b=this.buffer.byteLength;return b<a?this.resize((b*=2)>a?b:a):this};e.fill=function(a,b,c){var d="undefined"===typeof b;d&&(b=this.offset);"string"===typeof a&&0<a.length&&(a=a.charCodeAt(0));"undefined"===typeof b&&(b=this.offset);"undefined"===typeof c&&(c=this.limit);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal value: "+a+" (not an integer)");a|=
0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal begin: Not an integer");b>>>=0;if("number"!==typeof c||0!==c%1)throw TypeError("Illegal end: Not an integer");c>>>=0;if(0>b||b>c||c>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+b+" <= "+c+" <= "+this.buffer.byteLength);}if(b>=c)return this;for(;b<c;)this.view[b++]=a;d&&(this.offset=b);return this};e.flip=function(){this.limit=this.offset;this.offset=0;return this};e.mark=function(a){a="undefined"===typeof a?this.offset:a;
if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal offset: "+a+" (not an integer)");a>>>=0;if(0>a||a+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+0) <= "+this.buffer.byteLength);}this.markedOffset=a;return this};e.order=function(a){if(!this.noAssert&&"boolean"!==typeof a)throw TypeError("Illegal littleEndian: Not a boolean");this.littleEndian=!!a;return this};e.LE=function(a){this.littleEndian="undefined"!==typeof a?!!a:!0;return this};e.BE=function(a){this.littleEndian=
"undefined"!==typeof a?!a:!1;return this};e.prepend=function(a,b,c){if("number"===typeof b||"string"!==typeof b)c=b,b=void 0;var d="undefined"===typeof c;d&&(c=this.offset);if(!this.noAssert){if("number"!==typeof c||0!==c%1)throw TypeError("Illegal offset: "+c+" (not an integer)");c>>>=0;if(0>c||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength);}a instanceof h||(a=h.wrap(a,b));b=a.limit-a.offset;if(0>=b)return this;var f=b-c;if(0<f){var e=new ArrayBuffer(this.buffer.byteLength+
f),g=new Uint8Array(e);g.set(this.view.subarray(c,this.buffer.byteLength),b);this.buffer=e;this.view=g;this.offset+=f;0<=this.markedOffset&&(this.markedOffset+=f);this.limit+=f;c+=f}else new Uint8Array(this.buffer);this.view.set(a.view.subarray(a.offset,a.limit),c-b);a.offset=a.limit;d&&(this.offset-=b);return this};e.prependTo=function(a,b){a.prepend(this,b);return this};e.printDebug=function(a){"function"!==typeof a&&(a=console.log.bind(console));a(this.toString()+"\n-------------------------------------------------------------------\n"+
this.toDebug(!0))};e.remaining=function(){return this.limit-this.offset};e.reset=function(){0<=this.markedOffset?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0;return this};e.resize=function(a){if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal capacity: "+a+" (not an integer)");a|=0;if(0>a)throw RangeError("Illegal capacity: 0 <= "+a);}if(this.buffer.byteLength<a){a=new ArrayBuffer(a);var b=new Uint8Array(a);b.set(this.view);this.buffer=a;this.view=b}return this};
e.reverse=function(a,b){"undefined"===typeof a&&(a=this.offset);"undefined"===typeof b&&(b=this.limit);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal begin: Not an integer");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal end: Not an integer");b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+b+" <= "+this.buffer.byteLength);}if(a===b)return this;Array.prototype.reverse.call(this.view.subarray(a,b));return this};
e.skip=function(a){if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal length: "+a+" (not an integer)");a|=0}var b=this.offset+a;if(!this.noAssert&&(0>b||b>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+a+" <= "+this.buffer.byteLength);this.offset=b;return this};e.slice=function(a,b){"undefined"===typeof a&&(a=this.offset);"undefined"===typeof b&&(b=this.limit);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal begin: Not an integer");
a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal end: Not an integer");b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+b+" <= "+this.buffer.byteLength);}var c=this.clone();c.offset=a;c.limit=b;return c};e.toBuffer=function(a){var b=this.offset,c=this.limit;if(!this.noAssert){if("number"!==typeof b||0!==b%1)throw TypeError("Illegal offset: Not an integer");b>>>=0;if("number"!==typeof c||0!==c%1)throw TypeError("Illegal limit: Not an integer");
c>>>=0;if(0>b||b>c||c>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+b+" <= "+c+" <= "+this.buffer.byteLength);}if(!a&&0===b&&c===this.buffer.byteLength)return this.buffer;if(b===c)return v;a=new ArrayBuffer(c-b);(new Uint8Array(a)).set((new Uint8Array(this.buffer)).subarray(b,c),0);return a};e.toArrayBuffer=e.toBuffer;e.toString=function(a,b,c){if("undefined"===typeof a)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+
")";"number"===typeof a&&(c=b=a="utf8");switch(a){case "utf8":return this.toUTF8(b,c);case "base64":return this.toBase64(b,c);case "hex":return this.toHex(b,c);case "binary":return this.toBinary(b,c);case "debug":return this.toDebug();case "columns":return this.toColumns();default:throw Error("Unsupported encoding: "+a);}};var x=function(){for(var a={},b=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,
114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],c=[],d=0,f=b.length;d<f;++d)c[b[d]]=d;a.encode=function(a,c){for(var d,f;null!==(d=a());)c(b[d>>2&63]),f=(d&3)<<4,null!==(d=a())?(f|=d>>4&15,c(b[(f|d>>4&15)&63]),f=(d&15)<<2,null!==(d=a())?(c(b[(f|d>>6&3)&63]),c(b[d&63])):(c(b[f&63]),c(61))):(c(b[f&63]),c(61),c(61))};a.decode=function(a,b){function d(a){throw Error("Illegal character code: "+a);}for(var f,e,h;null!==(f=a());)if(e=c[f],"undefined"===typeof e&&d(f),null!==(f=a())&&
(h=c[f],"undefined"===typeof h&&d(f),b(e<<2>>>0|(h&48)>>4),null!==(f=a()))){e=c[f];if("undefined"===typeof e)if(61===f)break;else d(f);b((h&15)<<4>>>0|(e&60)>>2);if(null!==(f=a())){h=c[f];if("undefined"===typeof h)if(61===f)break;else d(f);b((e&3)<<6>>>0|h)}}};a.test=function(a){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(a)};return a}();e.toBase64=function(a,b){"undefined"===typeof a&&(a=this.offset);"undefined"===typeof b&&(b=this.limit);a|=0;b|=0;if(0>a||b>this.capacity||
a>b)throw RangeError("begin, end");var c;x.encode(function(){return a<b?this.view[a++]:null}.bind(this),c=r());return c()};h.fromBase64=function(a,b){if("string"!==typeof a)throw TypeError("str");var c=new h(a.length/4*3,b),d=0;x.decode(m(a),function(a){c.view[d++]=a});c.limit=d;return c};h.btoa=function(a){return h.fromBinary(a).toBase64()};h.atob=function(a){return h.fromBase64(a).toBinary()};e.toBinary=function(a,b){"undefined"===typeof a&&(a=this.offset);"undefined"===typeof b&&(b=this.limit);
a|=0;b|=0;if(0>a||b>this.capacity()||a>b)throw RangeError("begin, end");if(a===b)return"";for(var c=[],d=[];a<b;)c.push(this.view[a++]),1024<=c.length&&(d.push(String.fromCharCode.apply(String,c)),c=[]);return d.join("")+String.fromCharCode.apply(String,c)};h.fromBinary=function(a,b){if("string"!==typeof a)throw TypeError("str");for(var c=0,d=a.length,f,e=new h(d,b);c<d;){f=a.charCodeAt(c);if(255<f)throw RangeError("illegal char code: "+f);e.view[c++]=f}e.limit=d;return e};e.toDebug=function(a){for(var b=
-1,c=this.buffer.byteLength,d,f="",e="",g="";b<c;){-1!==b&&(d=this.view[b],f=16>d?f+("0"+d.toString(16).toUpperCase()):f+d.toString(16).toUpperCase(),a&&(e+=32<d&&127>d?String.fromCharCode(d):"."));++b;if(a&&0<b&&0===b%16&&b!==c){for(;51>f.length;)f+=" ";g+=f+e+"\n";f=e=""}f=b===this.offset&&b===this.limit?f+(b===this.markedOffset?"!":"|"):b===this.offset?f+(b===this.markedOffset?"[":"<"):b===this.limit?f+(b===this.markedOffset?"]":">"):f+(b===this.markedOffset?"'":a||0!==b&&b!==c?" ":"")}if(a&&" "!==
f){for(;51>f.length;)f+=" ";g+=f+e+"\n"}return a?g:f};h.fromDebug=function(a,b,c){var d=a.length;b=new h((d+1)/3|0,b,c);for(var f=0,e=0,g,k=!1,m=!1,n=!1,p=!1,q=!1;f<d;){switch(g=a.charAt(f++)){case "!":if(!c){if(m||n||p){q=!0;break}m=n=p=!0}b.offset=b.markedOffset=b.limit=e;k=!1;break;case "|":if(!c){if(m||p){q=!0;break}m=p=!0}b.offset=b.limit=e;k=!1;break;case "[":if(!c){if(m||n){q=!0;break}m=n=!0}b.offset=b.markedOffset=e;k=!1;break;case "<":if(!c){if(m){q=!0;break}m=!0}b.offset=e;k=!1;break;case "]":if(!c){if(p||
n){q=!0;break}p=n=!0}b.limit=b.markedOffset=e;k=!1;break;case ">":if(!c){if(p){q=!0;break}p=!0}b.limit=e;k=!1;break;case "'":if(!c){if(n){q=!0;break}n=!0}b.markedOffset=e;k=!1;break;case " ":k=!1;break;default:if(!c&&k){q=!0;break}g=parseInt(g+a.charAt(f++),16);if(!c&&(isNaN(g)||0>g||255<g))throw TypeError("Illegal str: Not a debug encoded string");b.view[e++]=g;k=!0}if(q)throw TypeError("Illegal str: Invalid symbol at "+f);}if(!c){if(!m||!p)throw TypeError("Illegal str: Missing offset or limit");
if(e<b.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+e+" < "+d);}return b};e.toHex=function(a,b){a="undefined"===typeof a?this.offset:a;b="undefined"===typeof b?this.limit:b;if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal begin: Not an integer");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal end: Not an integer");b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+b+" <= "+
this.buffer.byteLength);}for(var c=Array(b-a),d;a<b;)d=this.view[a++],16>d?c.push("0",d.toString(16)):c.push(d.toString(16));return c.join("")};h.fromHex=function(a,b,c){if(!c){if("string"!==typeof a)throw TypeError("Illegal str: Not a string");if(0!==a.length%2)throw TypeError("Illegal str: Length not a multiple of 2");}var d=a.length;b=new h(d/2|0,b);for(var f,e=0,g=0;e<d;e+=2){f=parseInt(a.substring(e,e+2),16);if(!c&&(!isFinite(f)||0>f||255<f))throw TypeError("Illegal str: Contains non-hex characters");
b.view[g++]=f}b.limit=g;return b};var n=function(){var a={MAX_CODEPOINT:1114111,encodeUTF8:function(a,c){var d=null;"number"===typeof a&&(d=a,a=function(){return null});for(;null!==d||null!==(d=a());)128>d?c(d&127):(2048>d?c(d>>6&31|192):(65536>d?c(d>>12&15|224):(c(d>>18&7|240),c(d>>12&63|128)),c(d>>6&63|128)),c(d&63|128)),d=null},decodeUTF8:function(a,c){for(var d,f,e,g,h=function(a){a=a.slice(0,a.indexOf(null));var b=Error(a.toString());b.name="TruncatedError";b.bytes=a;throw b;};null!==(d=a());)if(0===
(d&128))c(d);else if(192===(d&224))null===(f=a())&&h([d,f]),c((d&31)<<6|f&63);else if(224===(d&240))null!==(f=a())&&null!==(e=a())||h([d,f,e]),c((d&15)<<12|(f&63)<<6|e&63);else if(240===(d&248))null!==(f=a())&&null!==(e=a())&&null!==(g=a())||h([d,f,e,g]),c((d&7)<<18|(f&63)<<12|(e&63)<<6|g&63);else throw RangeError("Illegal starting byte: "+d);},UTF16toUTF8:function(a,c){for(var d,e=null;null!==(d=null!==e?e:a());)55296<=d&&57343>=d&&null!==(e=a())&&56320<=e&&57343>=e?(c(1024*(d-55296)+e-56320+65536),
e=null):c(d);null!==e&&c(e)},UTF8toUTF16:function(a,c){var d=null;"number"===typeof a&&(d=a,a=function(){return null});for(;null!==d||null!==(d=a());)65535>=d?c(d):(d-=65536,c((d>>10)+55296),c(d%1024+56320)),d=null},encodeUTF16toUTF8:function(b,c){a.UTF16toUTF8(b,function(b){a.encodeUTF8(b,c)})},decodeUTF8toUTF16:function(b,c){a.decodeUTF8(b,function(b){a.UTF8toUTF16(b,c)})},calculateCodePoint:function(a){return 128>a?1:2048>a?2:65536>a?3:4},calculateUTF8:function(a){for(var c,d=0;null!==(c=a());)d+=
128>c?1:2048>c?2:65536>c?3:4;return d},calculateUTF16asUTF8:function(b){var c=0,d=0;a.UTF16toUTF8(b,function(a){++c;d+=128>a?1:2048>a?2:65536>a?3:4});return[c,d]}};return a}();e.toUTF8=function(a,b){"undefined"===typeof a&&(a=this.offset);"undefined"===typeof b&&(b=this.limit);if(!this.noAssert){if("number"!==typeof a||0!==a%1)throw TypeError("Illegal begin: Not an integer");a>>>=0;if("number"!==typeof b||0!==b%1)throw TypeError("Illegal end: Not an integer");b>>>=0;if(0>a||a>b||b>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+
a+" <= "+b+" <= "+this.buffer.byteLength);}var c;try{n.decodeUTF8toUTF16(function(){return a<b?this.view[a++]:null}.bind(this),c=r())}catch(d){if(a!==b)throw RangeError("Illegal range: Truncated data, "+a+" != "+b);}return c()};h.fromUTF8=function(a,b,c){if(!c&&"string"!==typeof a)throw TypeError("Illegal str: Not a string");var d=new h(n.calculateUTF16asUTF8(m(a),!0)[1],b,c),e=0;n.encodeUTF16toUTF8(m(a),function(a){d.view[e++]=a});d.limit=e;return d};return h});

BIN
node_modules/bytebuffer/dist/bytebuffer.min.js.gz generated vendored Normal file

Binary file not shown.

8
node_modules/bytebuffer/dist/bytebuffer.min.map generated vendored Normal file

File diff suppressed because one or more lines are too long

BIN
node_modules/bytebuffer/donate.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

862
node_modules/bytebuffer/externs/bytebuffer.js generated vendored Normal file
View File

@ -0,0 +1,862 @@
/*
* Copyright 2012 The Closure Compiler Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Externs for ByteBuffer.js.
* @see https://github.com/dcodeIO/ByteBuffer.js
* @externs
*/
/**
BEGIN_NODE_INCLUDE
var ByteBuffer = require('bytebuffer');
END_NODE_INCLUDE
*/
/**
* @param {number=} capacity
* @param {boolean=} littleEndian
* @param {boolean=} sparse
* @constructor
*/
function ByteBuffer(capacity, littleEndian, sparse) {};
/**
* @type {?ArrayBuffer}
*/
ByteBuffer.prototype.array;
/**
* @type {number}
*/
ByteBuffer.prototype.offset;
/**
* @type {number}
*/
ByteBuffer.prototype.markedOffset;
/**
* @type {number}
*/
ByteBuffer.prototype.limit;
/**
* @type {boolean}
*/
ByteBuffer.prototype.littleEndian;
/**
* @type {string}
* @const
*/
ByteBuffer.VERSION;
/**
* @type {number}
* @const
*/
ByteBuffer.DEFAULT_CAPACITY = 32;
/**
* @type {boolean}
* @const
*/
ByteBuffer.LITTLE_ENDIAN = true;
/**
* @type {boolean}
* @const
*/
ByteBuffer.BIG_ENDIAN = false;
/**
* @param {number=} capacity
* @param {boolean=} littleEndian
* @returns {!ByteBuffer}
* @nosideeffects
*/
ByteBuffer.allocate = function(capacity, littleEndian) {};
/**
* @param {!ArrayBuffer|!Buffer|!{array: ArrayBuffer}|!{buffer: ArrayBuffer}|string} buffer
* @param {(string|boolean)=} enc
* @param {boolean=} littleEndian
* @returns {!ByteBuffer}
* @throws {Error}
* @nosideeffects
*/
ByteBuffer.wrap = function(buffer, enc, littleEndian) {};
/**
* @param {boolean=} littleEndian
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.LE = function(littleEndian) {};
/**
* @param {boolean=} bigEndian
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.BE = function(bigEndian) {};
/**
* @param {string} str
* @param {boolean} littleEndian
* @param {boolean} noAssert
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.fromBase64 = function(str, littleEndian, noAssert) {};
/**
* @param {string} str
* @param {boolean} littleEndian
* @param {boolean} noAssert
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.fromBinary = function(str, littleEndian, noAssert) {};
/**
* @param {string} str
* @param {boolean} littleEndian
* @param {boolean} noAssert
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.fromDebug = function(str, littleEndian, noAssert) {};
/**
* @param {string} str
* @param {boolean} littleEndian
* @param {boolean} noAssert
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.fromHex = function(str, littleEndian, noAssert) {};
/**
* @param {string} str
* @param {boolean} littleEndian
* @param {boolean} noAssert
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.fromUTF8 = function(str, littleEndian, noAssert) {};
/**
* @param {number} capacity
* @returns {boolean}
*/
ByteBuffer.prototype.resize = function(capacity) {};
/**
* @param {number} begin
* @param {number} end
* @returns {!ByteBuffer}
* @throws {Error}
* @nosideeffects
*/
ByteBuffer.prototype.slice = function(begin, end) {};
/**
* @param {number} begin
* @param {number} end
* @returns {!ByteBuffer}
* @throws {Error}
* @nosideeffects
*/
ByteBuffer.prototype.sliceAndCompact = function(begin, end) {};
/**
* @param {number} capacity
* @returns {boolean}
*/
ByteBuffer.prototype.ensureCapacity = function(capacity) {};
/**
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.flip = function() {};
/**
* @param {number=} offset
* @returns {!ByteBuffer}
* @throws {Error}
*/
ByteBuffer.prototype.mark = function(offset) {};
/**
* @returns {!ByteBuffer} this
*/
ByteBuffer.prototype.reset = function() {};
/**
* @returns {!ByteBuffer}
* @nosideeffects
*/
ByteBuffer.prototype.clone = function() {};
/**
* @returns {!ByteBuffer}
* @nosideeffects
*/
ByteBuffer.prototype.copy = function() {};
/**
* @returns {number}
* @nosideeffects
*/
ByteBuffer.prototype.remaining = function() {};
/**
* @returns {number}
* @nosideeffects
*/
ByteBuffer.prototype.capacity = function() {};
/**
* @returns {!ByteBuffer}
* @throws {Error}
*/
ByteBuffer.prototype.compact = function() {};
/**
* @returns {!ByteBuffer}
* @throws {Error}
*/
ByteBuffer.prototype.reverse = function() {};
/**
* @param {!ByteBuffer} src
* @param {number=} offset
* @returns {!ByteBuffer}
* @throws {Error}
*/
ByteBuffer.prototype.append = function(src, offset) {};
/**
* @param {!ByteBuffer} src
* @param {number=} offset
* @returns {!ByteBuffer}
* @throws {Error}
*/
ByteBuffer.prototype.prepend = function(src, offset) {};
/**
* @param {number|string} value
* @param {number} begin
* @param {number} end
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.fill = function(value, begin, end) {};
/**
* @param {number} value
* @param {number=} offset
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.writeInt8 = function(value, offset) {};
/**
* @param {number=} offset
* @returns {number}
* @throws {Error}
*/
ByteBuffer.prototype.readInt8 = function(offset) {};
/**
* @param {number} value
* @param {number=} offset
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.writeByte = function(value, offset) {};
/**
* @param {number=} offset
* @returns {number}
* @throws {Error}
*/
ByteBuffer.prototype.readByte = function(offset) {};
/**
* @param {number} value
* @param {number=} offset
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.writeUint8 = function(value, offset) {};
/**
* @param {number=} offset
* @returns {number}
* @throws {Error}
*/
ByteBuffer.prototype.readUint8 = function(offset) {};
/**
* @param {number} value
* @param {number=} offset
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.writeInt16 = function(value, offset) {};
/**
* @param {number=} offset
* @returns {number}
* @throws {Error}
*/
ByteBuffer.prototype.readInt16 = function(offset) {};
/**
* @param {number} value
* @param {number=} offset
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.writeShort = function(value, offset) {};
/**
* @param {number=} offset
* @returns {number}
* @throws {Error}
*/
ByteBuffer.prototype.readShort = function (offset) {};
/**
* @param {number} value
* @param {number=} offset
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.writeUint16 = function(value, offset) {};
/**
* @param {number=} offset
* @returns {number}
* @throws {Error}
*/
ByteBuffer.prototype.readUint16 = function(offset) {};
/**
* @param {number} value
* @param {number=} offset
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.writeInt32 = function(value, offset) {};
/**
* @param {number=} offset
* @returns {number}
* @throws {Error}
*/
ByteBuffer.prototype.readInt32 = function(offset) {};
/**
* @param {number} value
* @param {number=} offset
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.writeInt = function(value, offset) {};
/**
* @param {number=} offset
* @returns {number}
* @throws {Error}
*/
ByteBuffer.prototype.readInt = function(offset) {};
/**
* @param {number} value
* @param {number=} offset
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.writeUint32 = function(value, offset) {};
/**
* @param {number=} offset
* @returns {number}
* @throws {Error}
*/
ByteBuffer.prototype.readUint32 = function(offset) {};
/**
* @param {number|Long} value
* @param {number=} offset
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.writeInt64 = function(value, offset) {};
/**
* @param {number=} offset
* @returns {Long}
* @throws {Error}
*/
ByteBuffer.prototype.readInt64 = function(offset) {};
/**
* @param {number|Long} value
* @param {number=} offset
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.writeUint64 = function(value, offset) {};
/**
* @param {number=} offset
* @returns {Long}
* @throws {Error}
*/
ByteBuffer.prototype.readUint64 = function(offset) {};
/**
* @param {number} value
* @param {number=} offset
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.writeFloat32 = function(value, offset) {};
/**
* @param {number=} offset
* @returns {number}
* @throws {Error}
*/
ByteBuffer.prototype.readFloat32 = function(offset) {};
/**
* @param {number} value
* @param {number=} offset
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.writeFloat = function(value, offset) {};
/**
* @param {number=} offset
* @returns {number}
* @throws {Error}
*/
ByteBuffer.prototype.readFloat = function(offset) {};
/**
* @param {number} value
* @param {number=} offset
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.writeFloat64 = function(value, offset) {};
/**
* @param {number=} offset
* @returns {number}
* @throws {Error}
*/
ByteBuffer.prototype.readFloat64 = function(offset) {};
/**
* @param {number} value
* @param {number=} offset
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.writeDouble = function(value, offset) {};
/**
* @param {number=} offset
* @returns {number}
* @throws {Error}
*/
ByteBuffer.prototype.readDouble = function(offset) {};
/**
* @param {number} value
* @param {number=} offset
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.writeLong = function(value, offset) {};
/**
* @param {number=} offset
* @returns {number}
* @throws {Error}
*/
ByteBuffer.prototype.readLong = function(offset) {};
/**
* @param {number} value
* @param {number=} offset
* @returns {!ByteBuffer|number}
*/
ByteBuffer.prototype.writeVarint32 = function(value, offset) {};
/**
* @param {number=} offset
* @returns {number|!{value: number, length: number}}
* @throws {Error}
*/
ByteBuffer.prototype.readVarint32 = function(offset) {};
/**
* @param {number} value
* @param {number=} offset
* @returns {!ByteBuffer|number}
*/
ByteBuffer.prototype.writeZigZagVarint32 = function(value, offset) {};
/**
* @param {number=} offset
* @returns {number|{value: number, length: number}}
* @throws {Error}
*/
ByteBuffer.prototype.readZigZagVarint32 = function(offset) {};
/**
* @param {number|Long} value
* @param {number=} offset
* @returns {!ByteBuffer|number}
* @throws {Error}
*/
ByteBuffer.prototype.writeVarint64 = function(value, offset) {};
/**
* @param {number=} offset
* @returns {!Long|{value: !Long, length: number}}
* @throws {Error}
*/
ByteBuffer.prototype.readVarint64 = function(offset) {};
/**
* @param {number|Long} value
* @param {number=} offset
* @returns {!ByteBuffer|number}
* @throws {Error}
*/
ByteBuffer.prototype.writeZigZagVarint64 = function(value, offset) {};
/**
* @param {number=} offset
* @returns {!Long|!{value: !Long, length: number}}
* @throws {Error}
*/
ByteBuffer.prototype.readZigZagVarint64 = function(offset) {};
/**
* @param {number|Long} value
* @param {number=} offset
* @returns {!ByteBuffer|number}
* @throws {Error}
*/
ByteBuffer.prototype.writeVarint64ZigZag = function(value, offset) {};
/**
* @param {number=} offset
* @returns {!Long|{value: !Long, length: number}}
* @throws {Error}
*/
ByteBuffer.prototype.readVarint64ZigZag = function(offset) {};
/**
* @param {number} value
* @param {number=} offset
* @returns {!ByteBuffer|number}
*/
ByteBuffer.prototype.writeVarint = function(value, offset) {};
/**
* @param {number=} offset
* @returns {number|!{value: number, length: number}}
* @throws {Error}
*/
ByteBuffer.prototype.readVarint = function(offset) {};
/**
* @param {number} value
* @param {number=} offset
* @returns {!ByteBuffer|number}
*/
ByteBuffer.prototype.writeZigZagVarint = function(value, offset) {};
/**
* @param {number=} offset
* @returns {number|{value: number, length: number}}
* @throws {Error}
*/
ByteBuffer.prototype.readZigZagVarint = function(offset) {};
/**
* @param {number} value
* @returns {number}
* @throws {Error}
* @nosideeffects
*/
ByteBuffer.calculateVarint32 = function(value) {};
/**
* @param {number} value
* @returns {number}
* @throws {Error}
* @nosideeffects
*/
ByteBuffer.calculateVarint64 = function(value) {};
/**
* @param {string} str
* @returns {number}
* @nosideeffects
*/
ByteBuffer.calculateUTF8String = function(str) {};
/**
* @param {string} str
* @returns {number}
*/
ByteBuffer.prototype.calculateUTF8Bytes = function(str) {};
/**
* @param {string} str
* @param {number=} offset
* @returns {!ByteBuffer|number}
*/
ByteBuffer.prototype.writeUTF8String = function(str, offset) {};
/**
* @param {number} chars
* @param {number=} offset
* @returns {string|!{string: string, length: number}}
* @throws {Error}
*/
ByteBuffer.prototype.readUTF8String = function(chars, offset) {};
/**
* @param {number} length
* @param {number} offset
* @throws {Error}
*/
ByteBuffer.prototype.readUTF8StringBytes = function(length, offset) {};
/**
* @param {string} str
* @param {number=} offset
* @returns {!ByteBuffer|number}
*/
ByteBuffer.prototype.writeLString = function(str, offset) {};
/**
* @param {number=} offset
* @returns {string|!{string: string, length: number}}
* @throws {Error}
*/
ByteBuffer.prototype.readLString = function(offset) {};
/**
* @param {string} str
* @param {number=} offset
* @returns {!ByteBuffer|number}
*/
ByteBuffer.prototype.writeVString = function(str, offset) {};
/**
* @param {number=} offset
* @returns {string|!{string: string, length: number}}
* @throws {Error}
*/
ByteBuffer.prototype.readVString = function(offset) {};
/**
* @param {string} str
* @param {number=} offset
* @returns {!ByteBuffer|number}
*/
ByteBuffer.prototype.writeCString = function(str, offset) {};
/**
* @param {number=} offset
* @returns {string|!{string: string, length: number}}
* @throws {Error}
*/
ByteBuffer.prototype.readCString = function(offset) {};
/**
* @param {number} length
* @param {number=} offset
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.readBytes = function(length, offset) {};
/**
* @param {!ByteBuffer} src
* @param {number=} offset
* @returns {!ByteBuffer}
* @throws {Error}
*/
ByteBuffer.prototype.writeBytes = function(src, offset) {};
/**
* @param {number=} offset
* @returns {Array<boolean>}
*/
ByteBufferPrototype.readBitSet = function(offset) {};
/**
* @param {Array<boolean>}
* @param {number=}
* @returns {!ByteBuffer}
*/
ByteBuffer.prototype.writeBitSet = function(value, offset) {};
/**
* @param {number=} wrap
* @returns {string}
* @nosideeffects
*/
ByteBuffer.prototype.toColumns = function(wrap) {};
/**
* @param {function(string)=} out
*/
ByteBuffer.prototype.printDebug = function(out) {};
/**
* @param {boolean=} debug
* @returns {string}
* @nosideeffects
*/
ByteBuffer.prototype.toHex = function(debug) {};
/**
* @returns {string}
* @nosideeffects
*/
ByteBuffer.prototype.toBinary = function() {};
/**
* @returns {string}
* @nosideeffects
*/
ByteBuffer.prototype.toUTF8 = function() {};
/**
* @returns {string}
* @nosideeffects
*/
ByteBuffer.prototype.toBase64 = function() {};
/**
* @param {string=} enc
* @returns {string}
* @nosideeffects
*/
ByteBuffer.prototype.toString = function(enc) {};
/**
* @param {boolean=} forceCopy
* @returns {ArrayBuffer}
* @nosideeffects
*/
ByteBuffer.prototype.toArrayBuffer = function(forceCopy) {};
/**
* @param {!ByteBuffer} src
* @param {number} offset
* @returns {!{char: number, length: number}}
* @nosideeffects
*/
ByteBuffer.decodeUTF8Char = function(src, offset) {};
/**
* @param {number} charCode
* @param {!ByteBuffer} dst
* @param {number} offset
* @returns {number}
* @throws {Error}
*/
ByteBuffer.encodeUTF8Char = function(charCode, dst, offset) {};
/**
* @param {number} charCode
* @returns {number}
* @throws {Error}
* @nosideeffects
*/
ByteBuffer.calculateUTF8Char = function(charCode) {};
/**
* @param {number} n
* @returns {number}
* @nosideeffects
*/
ByteBuffer.zigZagEncode32 = function(n) {};
/**
* @param {number} n
* @returns {number}
* @nosideeffects
*/
ByteBuffer.zigZagDecode32 = function(n) {};
/**
* @param {!ByteBuffer} bb
* @returns {string}
* @throws {Error}
* @nosideeffects
*/
ByteBuffer.encode64 = function(bb) {};
/**
* @param {string} str
* @param {boolean=} littleEndian
* @returns {!ByteBuffer}
* @throws {Error}
* @nosideeffects
*/
ByteBuffer.decode64 = function(str, littleEndian) {};
/**
* @param {!ByteBuffer} bb
* @returns {string}
* @throws {Error}
* @nosideeffects
*/
ByteBuffer.encodeHex = function(bb) {};
/**
* @param {string} str
* @param {boolean=} littleEndian
* @returns {!ByteBuffer}
* @throws {Error}
* @nosideeffects
*/
ByteBuffer.decodeHex = function(str, littleEndian) {};
/**
* @param {!ByteBuffer} bb
* @returns {string}
* @throws {Error}
* @nosideeffects
*/
ByteBuffer.encodeBinary = function(bb) {};
/**
* @param {string} str
* @param {boolean=} littleEndian
* @returns {!ByteBuffer}
* @throws {Error}
* @nosideeffects
*/
ByteBuffer.decodeBinary = function(str, littleEndian) {};
/**
* @type {number}
* @const
*/
ByteBuffer.MAX_VARINT32_BYTES = 5;
/**
* @type {number}
* @const
*/
ByteBuffer.MAX_VARINT64_BYTES = 10;

52
node_modules/bytebuffer/externs/minimal-env.js generated vendored Normal file
View File

@ -0,0 +1,52 @@
/**
* @param {string} moduleName
* @returns {?}
*/
function require(moduleName) {};
/**
* @param {string} name
* @param {Array.<string>} deps
* @param {function(...[*])} f
*/
function define(name, deps, f) {};
/**
* @param {number} size
* @constructor
* @extends Array
*/
function Buffer(size) {};
/**
* @param {*} buf
* @return {boolean}
*/
Buffer.isBuffer = function(buf) {};
/**
* @type {Object.<string,*>}
*/
var console = {};
/**
* @param {string} s
*/
console.log = function(s) {};
/**
* @type {*}
*/
var module = {};
/**
* @param {...*} var_args
* @returns {string}
*/
String.fromCodePoint = function(var_args) {};
/**
* @param {number} offset
* @returns {number}
*/
String.prototype.codePointAt = function(offset) {};

1
node_modules/bytebuffer/index.js generated vendored Normal file
View File

@ -0,0 +1 @@
module.exports = require("./dist/bytebuffer-node.js");

13
node_modules/bytebuffer/jsdoc.json generated vendored Normal file
View File

@ -0,0 +1,13 @@
{
"tags": {
"allowUnknownTags": true
},
"source": {
"include": ["dist/ByteBufferAB.js"]
},
"opts": {
"template": "templates/esoccer",
"destination": "docs"
},
"plugins": ["plugins/markdown"]
}

3
node_modules/bytebuffer/node_modules/long/.npmignore generated vendored Normal file
View File

@ -0,0 +1,3 @@
node_modules
npm-debug.log
.idea/

View File

@ -0,0 +1,5 @@
language: node_js
node_js:
- 0.12
- 4.2
sudo: false

202
node_modules/bytebuffer/node_modules/long/LICENSE generated vendored Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

513
node_modules/bytebuffer/node_modules/long/README.md generated vendored Normal file
View File

@ -0,0 +1,513 @@
![long.js - A Long class for representing a 64 bit two's-complement integer ](https://raw.github.com/dcodeIO/long.js/master/long.png)
=======
A Long class for representing a 64 bit two's-complement integer value derived from the [Closure Library](https://github.com/google/closure-library)
for stand-alone use and extended with unsigned support.
[![Build Status](https://travis-ci.org/dcodeIO/long.js.svg)](https://travis-ci.org/dcodeIO/long.js)
[![Donate](https://raw.githubusercontent.com/dcodeIO/long.js/master/donate.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=dcode%40dcode.io&item_name=%3C3%20long.js)
Background
----------
As of [ECMA-262 5th Edition](http://ecma262-5.com/ELS5_HTML.htm#Section_8.5), "all the positive and negative integers
whose magnitude is no greater than 2<sup>53</sup> are representable in the Number type", which is "representing the
doubleprecision 64-bit format IEEE 754 values as specified in the IEEE Standard for Binary Floating-Point Arithmetic".
The [maximum safe integer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)
in JavaScript is 2<sup>53</sup>-1.
Example: 2<sup>64</sup>-1 is 18446744073709551615 but in JavaScript it evaluates to `18446744073709552000`.
Furthermore, bitwise operators in JavaScript "deal only with integers in the range 2<sup>31</sup> through
2<sup>31</sup>1, inclusive, or in the range 0 through 2<sup>32</sup>1, inclusive. These operators accept any value of
the Number type but first convert each such value to one of 2<sup>32</sup> integer values."
In some use cases, however, it is required to be able to reliably work with and perform bitwise operations on the full
64 bits. This is where long.js comes into play.
Usage
-----
The class is compatible with CommonJS and AMD loaders and is exposed globally as `dcodeIO.Long` if neither is available.
```javascript
var Long = require("long");
var longVal = new Long(0xFFFFFFFF, 0x7FFFFFFF);
console.log(longVal.toString());
...
```
API
---
#### new Long(low, high=, unsigned=)
Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
See the from* functions below for more convenient ways of constructing Longs.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| low | *number* | The low (signed) 32 bits of the long
| high | *number* | The high (signed) 32 bits of the long
| unsigned | *boolean* | Whether unsigned or not, defaults to `false` for signed
---
#### Long.MAX_UNSIGNED_VALUE
Maximum unsigned value.
| | |
|-----------------|-----------------|
| **@type** | *!Long* |
#### Long.MAX_VALUE
Maximum signed value.
| | |
|-----------------|-----------------|
| **@type** | *!Long* |
#### Long.MIN_VALUE
Minimum signed value.
| | |
|-----------------|-----------------|
| **@type** | *!Long* |
#### Long.NEG_ONE
Signed negative one.
| | |
|-----------------|-----------------|
| **@type** | *!Long* |
#### Long.ONE
Signed one.
| | |
|-----------------|-----------------|
| **@type** | *!Long* |
#### Long.UONE
Unsigned one.
| | |
|-----------------|-----------------|
| **@type** | *!Long* |
#### Long.UZERO
Unsigned zero.
| | |
|-----------------|-----------------|
| **@type** | *!Long* |
#### Long.ZERO
Signed zero.
| | |
|-----------------|-----------------|
| **@type** | *!Long* |
#### Long.fromBits(lowBits, highBits, unsigned=)
Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
assumed to use 32 bits.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| lowBits | *number* | The low 32 bits
| highBits | *number* | The high 32 bits
| unsigned | *boolean* | Whether unsigned or not, defaults to `false` for signed
| **@returns** | *!Long* | The corresponding Long value
#### Long.fromInt(value, unsigned=)
Returns a Long representing the given 32 bit integer value.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| value | *number* | The 32 bit integer in question
| unsigned | *boolean* | Whether unsigned or not, defaults to `false` for signed
| **@returns** | *!Long* | The corresponding Long value
#### Long.fromNumber(value, unsigned=)
Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| value | *number* | The number in question
| unsigned | *boolean* | Whether unsigned or not, defaults to `false` for signed
| **@returns** | *!Long* | The corresponding Long value
#### Long.fromString(str, unsigned=, radix=)
Returns a Long representation of the given string, written using the specified radix.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| str | *string* | The textual representation of the Long
| unsigned | *boolean &#124; number* | Whether unsigned or not, defaults to `false` for signed
| radix | *number* | The radix in which the text is written (2-36), defaults to 10
| **@returns** | *!Long* | The corresponding Long value
#### Long.isLong(obj)
Tests if the specified object is a Long.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| obj | *** | Object
| **@returns** | *boolean* |
#### Long.fromValue(val)
Converts the specified value to a Long.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| val | *!Long &#124; number &#124; string &#124; !{low: number, high: number, unsigned: boolean}* | Value
| **@returns** | *!Long* |
---
#### Long#high
The high 32 bits as a signed value.
| | |
|-----------------|-----------------|
| **@type** | *number* |
#### Long#low
The low 32 bits as a signed value.
| | |
|-----------------|-----------------|
| **@type** | *number* |
#### Long#unsigned
Whether unsigned or not.
| | |
|-----------------|-----------------|
| **@type** | *boolean* |
#### Long#add(addend)
Returns the sum of this and the specified Long.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| addend | *!Long &#124; number &#124; string* | Addend
| **@returns** | *!Long* | Sum
#### Long#and(other)
Returns the bitwise AND of this Long and the specified.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| other | *!Long &#124; number &#124; string* | Other Long
| **@returns** | *!Long* |
#### Long#compare/comp(other)
Compares this Long's value with the specified's.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| other | *!Long &#124; number &#124; string* | Other value
| **@returns** | *number* | 0 if they are the same, 1 if the this is greater and -1 if the given one is greater
#### Long#divide/div(divisor)
Returns this Long divided by the specified.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| divisor | *!Long &#124; number &#124; string* | Divisor
| **@returns** | *!Long* | Quotient
#### Long#equals/eq(other)
Tests if this Long's value equals the specified's.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| other | *!Long &#124; number &#124; string* | Other value
| **@returns** | *boolean* |
#### Long#getHighBits()
Gets the high 32 bits as a signed integer.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *number* | Signed high bits
#### Long#getHighBitsUnsigned()
Gets the high 32 bits as an unsigned integer.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *number* | Unsigned high bits
#### Long#getLowBits()
Gets the low 32 bits as a signed integer.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *number* | Signed low bits
#### Long#getLowBitsUnsigned()
Gets the low 32 bits as an unsigned integer.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *number* | Unsigned low bits
#### Long#getNumBitsAbs()
Gets the number of bits needed to represent the absolute value of this Long.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *number* |
#### Long#greaterThan/gt(other)
Tests if this Long's value is greater than the specified's.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| other | *!Long &#124; number &#124; string* | Other value
| **@returns** | *boolean* |
#### Long#greaterThanOrEqual/gte(other)
Tests if this Long's value is greater than or equal the specified's.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| other | *!Long &#124; number &#124; string* | Other value
| **@returns** | *boolean* |
#### Long#isEven()
Tests if this Long's value is even.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *boolean* |
#### Long#isNegative()
Tests if this Long's value is negative.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *boolean* |
#### Long#isOdd()
Tests if this Long's value is odd.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *boolean* |
#### Long#isPositive()
Tests if this Long's value is positive.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *boolean* |
#### Long#isZero()
Tests if this Long's value equals zero.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *boolean* |
#### Long#lessThan/lt(other)
Tests if this Long's value is less than the specified's.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| other | *!Long &#124; number &#124; string* | Other value
| **@returns** | *boolean* |
#### Long#lessThanOrEqual/lte(other)
Tests if this Long's value is less than or equal the specified's.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| other | *!Long &#124; number &#124; string* | Other value
| **@returns** | *boolean* |
#### Long#modulo/mod(divisor)
Returns this Long modulo the specified.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| divisor | *!Long &#124; number &#124; string* | Divisor
| **@returns** | *!Long* | Remainder
#### Long#multiply/mul(multiplier)
Returns the product of this and the specified Long.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| multiplier | *!Long &#124; number &#124; string* | Multiplier
| **@returns** | *!Long* | Product
#### Long#negate/neg()
Negates this Long's value.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *!Long* | Negated Long
#### Long#not()
Returns the bitwise NOT of this Long.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *!Long* |
#### Long#notEquals/neq(other)
Tests if this Long's value differs from the specified's.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| other | *!Long &#124; number &#124; string* | Other value
| **@returns** | *boolean* |
#### Long#or(other)
Returns the bitwise OR of this Long and the specified.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| other | *!Long &#124; number &#124; string* | Other Long
| **@returns** | *!Long* |
#### Long#shiftLeft/shl(numBits)
Returns this Long with bits shifted to the left by the given amount.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| numBits | *number &#124; !Long* | Number of bits
| **@returns** | *!Long* | Shifted Long
#### Long#shiftRight/shr(numBits)
Returns this Long with bits arithmetically shifted to the right by the given amount.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| numBits | *number &#124; !Long* | Number of bits
| **@returns** | *!Long* | Shifted Long
#### Long#shiftRightUnsigned/shru(numBits)
Returns this Long with bits logically shifted to the right by the given amount.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| numBits | *number &#124; !Long* | Number of bits
| **@returns** | *!Long* | Shifted Long
#### Long#subtract/sub(subtrahend)
Returns the difference of this and the specified Long.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| subtrahend | *!Long &#124; number &#124; string* | Subtrahend
| **@returns** | *!Long* | Difference
#### Long#toInt()
Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *number* |
#### Long#toNumber()
Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *number* |
#### Long#toSigned()
Converts this Long to signed.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *!Long* | Signed long
#### Long#toString(radix=)
Converts the Long to a string written in the specified radix.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| radix | *number* | Radix (2-36), defaults to 10
| **@returns** | *string* |
| **@throws** | *RangeError* | If `radix` is out of range
#### Long#toUnsigned()
Converts this Long to unsigned.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *!Long* | Unsigned long
#### Long#xor(other)
Returns the bitwise XOR of this Long and the given one.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| other | *!Long &#124; number &#124; string* | Other Long
| **@returns** | *!Long* |
Downloads
---------
* [Distributions](https://github.com/dcodeIO/long.js/tree/master/dist)
* [ZIP-Archive](https://github.com/dcodeIO/long.js/archive/master.zip)
* [Tarball](https://github.com/dcodeIO/long.js/tarball/master)
License
-------
Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.html

9
node_modules/bytebuffer/node_modules/long/bower.json generated vendored Normal file
View File

@ -0,0 +1,9 @@
{
"name": "long",
"version": "3.2.0",
"author": "Daniel Wirtz <dcode@dcode.io>",
"description": "A Long class for representing a 64 bit two's-complement integer value.",
"main": "dist/long.js",
"keywords": ["math"],
"license": "Apache-2.0"
}

View File

@ -0,0 +1,16 @@
Distributions
=============
* **[long.js](https://raw.githubusercontent.com/dcodeIO/Long.js/master/dist/long.js)**
contains the commented source.
* **[long.min.js](https://raw.githubusercontent.com/dcodeIO/Long.js/master/dist/long.min.js)**
has been compiled with Closure Compiler.
* **[long.min.js.gz](https://raw.githubusercontent.com/dcodeIO/Long.js/master/dist/long.min.js.gz)**
has also been gzipped using `-9`.
* **[long.min.map](https://raw.githubusercontent.com/dcodeIO/Long.js/master/dist/long.min.map)**
is the source map generated by Closure Compiler.
Also available as `long` on [npm](https://www.npmjs.org/package/long) and [bower](http://bower.io/search/?q=long).

1209
node_modules/bytebuffer/node_modules/long/dist/long.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
/*
long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
Released under the Apache License, Version 2.0
see: https://github.com/dcodeIO/long.js for details
*/
(function(d,g){"function"===typeof define&&define.amd?define([],g):"function"===typeof require&&"object"===typeof module&&module&&module.exports?module.exports=g():(d.dcodeIO=d.dcodeIO||{}).Long=g()})(this,function(){function d(a,b,c){this.low=a|0;this.high=b|0;this.unsigned=!!c}function g(a){return!0===(a&&a.__isLong__)}function m(a,b){var c,t;if(b){a>>>=0;if(t=0<=a&&256>a)if(c=z[a])return c;c=e(a,0>(a|0)?-1:0,!0);t&&(z[a]=c)}else{a|=0;if(t=-128<=a&&128>a)if(c=A[a])return c;c=e(a,0>a?-1:0,!1);t&&
(A[a]=c)}return c}function n(a,b){if(isNaN(a)||!isFinite(a))return b?p:k;if(b){if(0>a)return p;if(a>=B)return C}else{if(a<=-D)return l;if(a+1>=D)return E}return 0>a?n(-a,b).neg():e(a%4294967296|0,a/4294967296|0,b)}function e(a,b,c){return new d(a,b,c)}function x(a,b,c){if(0===a.length)throw Error("empty string");if("NaN"===a||"Infinity"===a||"+Infinity"===a||"-Infinity"===a)return k;"number"===typeof b?(c=b,b=!1):b=!!b;c=c||10;if(2>c||36<c)throw RangeError("radix");var t;if(0<(t=a.indexOf("-")))throw Error("interior hyphen");
if(0===t)return x(a.substring(1),b,c).neg();t=n(v(c,8));for(var e=k,f=0;f<a.length;f+=8){var d=Math.min(8,a.length-f),g=parseInt(a.substring(f,f+d),c);8>d?(d=n(v(c,d)),e=e.mul(d).add(n(g))):(e=e.mul(t),e=e.add(n(g)))}e.unsigned=b;return e}function q(a){return a instanceof d?a:"number"===typeof a?n(a):"string"===typeof a?x(a):e(a.low,a.high,a.unsigned)}Object.defineProperty(d.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1});d.isLong=g;var A={},z={};d.fromInt=m;d.fromNumber=n;d.fromBits=
e;var v=Math.pow;d.fromString=x;d.fromValue=q;var B=4294967296*4294967296,D=B/2,F=m(16777216),k=m(0);d.ZERO=k;var p=m(0,!0);d.UZERO=p;var r=m(1);d.ONE=r;var G=m(1,!0);d.UONE=G;var y=m(-1);d.NEG_ONE=y;var E=e(-1,2147483647,!1);d.MAX_VALUE=E;var C=e(-1,-1,!0);d.MAX_UNSIGNED_VALUE=C;var l=e(0,-2147483648,!1);d.MIN_VALUE=l;var b=d.prototype;b.toInt=function(){return this.unsigned?this.low>>>0:this.low};b.toNumber=function(){return this.unsigned?4294967296*(this.high>>>0)+(this.low>>>0):4294967296*this.high+
(this.low>>>0)};b.toString=function(a){a=a||10;if(2>a||36<a)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(l)){var b=n(a),c=this.div(b),b=c.mul(b).sub(this);return c.toString(a)+b.toInt().toString(a)}return"-"+this.neg().toString(a)}for(var c=n(v(a,6),this.unsigned),b=this,e="";;){var d=b.div(c),f=(b.sub(d.mul(c)).toInt()>>>0).toString(a),b=d;if(b.isZero())return f+e;for(;6>f.length;)f="0"+f;e=""+f+e}};b.getHighBits=function(){return this.high};b.getHighBitsUnsigned=
function(){return this.high>>>0};b.getLowBits=function(){return this.low};b.getLowBitsUnsigned=function(){return this.low>>>0};b.getNumBitsAbs=function(){if(this.isNegative())return this.eq(l)?64:this.neg().getNumBitsAbs();for(var a=0!=this.high?this.high:this.low,b=31;0<b&&0==(a&1<<b);b--);return 0!=this.high?b+33:b+1};b.isZero=function(){return 0===this.high&&0===this.low};b.isNegative=function(){return!this.unsigned&&0>this.high};b.isPositive=function(){return this.unsigned||0<=this.high};b.isOdd=
function(){return 1===(this.low&1)};b.isEven=function(){return 0===(this.low&1)};b.equals=function(a){g(a)||(a=q(a));return this.unsigned!==a.unsigned&&1===this.high>>>31&&1===a.high>>>31?!1:this.high===a.high&&this.low===a.low};b.eq=b.equals;b.notEquals=function(a){return!this.eq(a)};b.neq=b.notEquals;b.lessThan=function(a){return 0>this.comp(a)};b.lt=b.lessThan;b.lessThanOrEqual=function(a){return 0>=this.comp(a)};b.lte=b.lessThanOrEqual;b.greaterThan=function(a){return 0<this.comp(a)};b.gt=b.greaterThan;
b.greaterThanOrEqual=function(a){return 0<=this.comp(a)};b.gte=b.greaterThanOrEqual;b.compare=function(a){g(a)||(a=q(a));if(this.eq(a))return 0;var b=this.isNegative(),c=a.isNegative();return b&&!c?-1:!b&&c?1:this.unsigned?a.high>>>0>this.high>>>0||a.high===this.high&&a.low>>>0>this.low>>>0?-1:1:this.sub(a).isNegative()?-1:1};b.comp=b.compare;b.negate=function(){return!this.unsigned&&this.eq(l)?l:this.not().add(r)};b.neg=b.negate;b.add=function(a){g(a)||(a=q(a));var b=this.high>>>16,c=this.high&65535,
d=this.low>>>16,l=a.high>>>16,f=a.high&65535,n=a.low>>>16,k;k=0+((this.low&65535)+(a.low&65535));a=0+(k>>>16);a+=d+n;d=0+(a>>>16);d+=c+f;c=0+(d>>>16);c=c+(b+l)&65535;return e((a&65535)<<16|k&65535,c<<16|d&65535,this.unsigned)};b.subtract=function(a){g(a)||(a=q(a));return this.add(a.neg())};b.sub=b.subtract;b.multiply=function(a){if(this.isZero())return k;g(a)||(a=q(a));if(a.isZero())return k;if(this.eq(l))return a.isOdd()?l:k;if(a.eq(l))return this.isOdd()?l:k;if(this.isNegative())return a.isNegative()?
this.neg().mul(a.neg()):this.neg().mul(a).neg();if(a.isNegative())return this.mul(a.neg()).neg();if(this.lt(F)&&a.lt(F))return n(this.toNumber()*a.toNumber(),this.unsigned);var b=this.high>>>16,c=this.high&65535,d=this.low>>>16,w=this.low&65535,f=a.high>>>16,m=a.high&65535,p=a.low>>>16;a=a.low&65535;var u,h,s,r;r=0+w*a;s=0+(r>>>16);s+=d*a;h=0+(s>>>16);s=(s&65535)+w*p;h+=s>>>16;s&=65535;h+=c*a;u=0+(h>>>16);h=(h&65535)+d*p;u+=h>>>16;h&=65535;h+=w*m;u+=h>>>16;h&=65535;u=u+(b*a+c*p+d*m+w*f)&65535;return e(s<<
16|r&65535,u<<16|h,this.unsigned)};b.mul=b.multiply;b.divide=function(a){g(a)||(a=q(a));if(a.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?p:k;var b,c,d;if(this.unsigned){a.unsigned||(a=a.toUnsigned());if(a.gt(this))return p;if(a.gt(this.shru(1)))return G;d=p}else{if(this.eq(l)){if(a.eq(r)||a.eq(y))return l;if(a.eq(l))return r;b=this.shr(1).div(a).shl(1);if(b.eq(k))return a.isNegative()?r:y;c=this.sub(a.mul(b));return d=b.add(c.div(a))}if(a.eq(l))return this.unsigned?
p:k;if(this.isNegative())return a.isNegative()?this.neg().div(a.neg()):this.neg().div(a).neg();if(a.isNegative())return this.div(a.neg()).neg();d=k}for(c=this;c.gte(a);){b=Math.max(1,Math.floor(c.toNumber()/a.toNumber()));for(var e=Math.ceil(Math.log(b)/Math.LN2),e=48>=e?1:v(2,e-48),f=n(b),m=f.mul(a);m.isNegative()||m.gt(c);)b-=e,f=n(b,this.unsigned),m=f.mul(a);f.isZero()&&(f=r);d=d.add(f);c=c.sub(m)}return d};b.div=b.divide;b.modulo=function(a){g(a)||(a=q(a));return this.sub(this.div(a).mul(a))};
b.mod=b.modulo;b.not=function(){return e(~this.low,~this.high,this.unsigned)};b.and=function(a){g(a)||(a=q(a));return e(this.low&a.low,this.high&a.high,this.unsigned)};b.or=function(a){g(a)||(a=q(a));return e(this.low|a.low,this.high|a.high,this.unsigned)};b.xor=function(a){g(a)||(a=q(a));return e(this.low^a.low,this.high^a.high,this.unsigned)};b.shiftLeft=function(a){g(a)&&(a=a.toInt());return 0===(a&=63)?this:32>a?e(this.low<<a,this.high<<a|this.low>>>32-a,this.unsigned):e(0,this.low<<a-32,this.unsigned)};
b.shl=b.shiftLeft;b.shiftRight=function(a){g(a)&&(a=a.toInt());return 0===(a&=63)?this:32>a?e(this.low>>>a|this.high<<32-a,this.high>>a,this.unsigned):e(this.high>>a-32,0<=this.high?0:-1,this.unsigned)};b.shr=b.shiftRight;b.shiftRightUnsigned=function(a){g(a)&&(a=a.toInt());a&=63;if(0===a)return this;var b=this.high;return 32>a?e(this.low>>>a|b<<32-a,b>>>a,this.unsigned):32===a?e(b,0,this.unsigned):e(b>>>a-32,0,this.unsigned)};b.shru=b.shiftRightUnsigned;b.toSigned=function(){return this.unsigned?
e(this.low,this.high,!1):this};b.toUnsigned=function(){return this.unsigned?this:e(this.low,this.high,!0)};b.toBytes=function(a){return a?this.toBytesLE():this.toBytesBE()};b.toBytesLE=function(){var a=this.high,b=this.low;return[b&255,b>>>8&255,b>>>16&255,b>>>24&255,a&255,a>>>8&255,a>>>16&255,a>>>24&255]};b.toBytesBE=function(){var a=this.high,b=this.low;return[a>>>24&255,a>>>16&255,a>>>8&255,a&255,b>>>24&255,b>>>16&255,b>>>8&255,b&255]};return d});

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
### Class [Long](Long.md)
A Long class for representing a 64 bit two's-complement integer value.
---
*Generated with [doco](https://github.com/dcodeIO/doco) v0.3.0*

473
node_modules/bytebuffer/node_modules/long/doco/Long.md generated vendored Normal file
View File

@ -0,0 +1,473 @@
## Class Long
A Long class for representing a 64 bit two's-complement integer value.
---
#### new Long(low, high=, unsigned=)
Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
See the from* functions below for more convenient ways of constructing Longs.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| low | *number* | The low (signed) 32 bits of the long
| high | *number* | The high (signed) 32 bits of the long
| unsigned | *boolean* | Whether unsigned or not, defaults to `false` for signed
---
#### Long.MAX_UNSIGNED_VALUE
Maximum unsigned value.
| | |
|-----------------|-----------------|
| **@type** | *!Long* |
#### Long.MAX_VALUE
Maximum signed value.
| | |
|-----------------|-----------------|
| **@type** | *!Long* |
#### Long.MIN_VALUE
Minimum signed value.
| | |
|-----------------|-----------------|
| **@type** | *!Long* |
#### Long.NEG_ONE
Signed negative one.
| | |
|-----------------|-----------------|
| **@type** | *!Long* |
#### Long.ONE
Signed one.
| | |
|-----------------|-----------------|
| **@type** | *!Long* |
#### Long.UONE
Unsigned one.
| | |
|-----------------|-----------------|
| **@type** | *!Long* |
#### Long.UZERO
Unsigned zero.
| | |
|-----------------|-----------------|
| **@type** | *!Long* |
#### Long.ZERO
Signed zero.
| | |
|-----------------|-----------------|
| **@type** | *!Long* |
#### Long.fromBits(lowBits, highBits, unsigned=)
Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
assumed to use 32 bits.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| lowBits | *number* | The low 32 bits
| highBits | *number* | The high 32 bits
| unsigned | *boolean* | Whether unsigned or not, defaults to `false` for signed
| **@returns** | *!Long* | The corresponding Long value
#### Long.fromInt(value, unsigned=)
Returns a Long representing the given 32 bit integer value.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| value | *number* | The 32 bit integer in question
| unsigned | *boolean* | Whether unsigned or not, defaults to `false` for signed
| **@returns** | *!Long* | The corresponding Long value
#### Long.fromNumber(value, unsigned=)
Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| value | *number* | The number in question
| unsigned | *boolean* | Whether unsigned or not, defaults to `false` for signed
| **@returns** | *!Long* | The corresponding Long value
#### Long.fromString(str, unsigned=, radix=)
Returns a Long representation of the given string, written using the specified radix.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| str | *string* | The textual representation of the Long
| unsigned | *boolean &#124; number* | Whether unsigned or not, defaults to `false` for signed
| radix | *number* | The radix in which the text is written (2-36), defaults to 10
| **@returns** | *!Long* | The corresponding Long value
#### Long.isLong(obj)
Tests if the specified object is a Long.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| obj | *** | Object
| **@returns** | *boolean* |
#### Long.fromValue(val)
Converts the specified value to a Long.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| val | *!Long &#124; number &#124; string &#124; !{low: number, high: number, unsigned: boolean}* | Value
| **@returns** | *!Long* |
---
#### Long#high
The high 32 bits as a signed value.
| | |
|-----------------|-----------------|
| **@type** | *number* |
#### Long#low
The low 32 bits as a signed value.
| | |
|-----------------|-----------------|
| **@type** | *number* |
#### Long#unsigned
Whether unsigned or not.
| | |
|-----------------|-----------------|
| **@type** | *boolean* |
#### Long#add(addend)
Returns the sum of this and the specified Long.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| addend | *!Long &#124; number &#124; string* | Addend
| **@returns** | *!Long* | Sum
#### Long#and(other)
Returns the bitwise AND of this Long and the specified.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| other | *!Long &#124; number &#124; string* | Other Long
| **@returns** | *!Long* |
#### Long#compare(other)
Compares this Long's value with the specified's.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| other | *!Long &#124; number &#124; string* | Other value
| **@returns** | *number* | 0 if they are the same, 1 if the this is greater and -1 if the given one is greater
#### Long#div(divisor)
Returns this Long divided by the specified.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| divisor | *!Long &#124; number &#124; string* | Divisor
| **@returns** | *!Long* | Quotient
#### Long#equals(other)
Tests if this Long's value equals the specified's.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| other | *!Long &#124; number &#124; string* | Other value
| **@returns** | *boolean* |
#### Long#getHighBits()
Gets the high 32 bits as a signed integer.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *number* | Signed high bits
#### Long#getHighBitsUnsigned()
Gets the high 32 bits as an unsigned integer.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *number* | Unsigned high bits
#### Long#getLowBits()
Gets the low 32 bits as a signed integer.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *number* | Signed low bits
#### Long#getLowBitsUnsigned()
Gets the low 32 bits as an unsigned integer.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *number* | Unsigned low bits
#### Long#getNumBitsAbs()
Gets the number of bits needed to represent the absolute value of this Long.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *number* |
#### Long#greaterThan(other)
Tests if this Long's value is greater than the specified's.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| other | *!Long &#124; number &#124; string* | Other value
| **@returns** | *boolean* |
#### Long#greaterThanOrEqual(other)
Tests if this Long's value is greater than or equal the specified's.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| other | *!Long &#124; number &#124; string* | Other value
| **@returns** | *boolean* |
#### Long#isEven()
Tests if this Long's value is even.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *boolean* |
#### Long#isNegative()
Tests if this Long's value is negative.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *boolean* |
#### Long#isOdd()
Tests if this Long's value is odd.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *boolean* |
#### Long#isPositive()
Tests if this Long's value is positive.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *boolean* |
#### Long#isZero()
Tests if this Long's value equals zero.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *boolean* |
#### Long#lessThan(other)
Tests if this Long's value is less than the specified's.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| other | *!Long &#124; number &#124; string* | Other value
| **@returns** | *boolean* |
#### Long#lessThanOrEqual(other)
Tests if this Long's value is less than or equal the specified's.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| other | *!Long &#124; number &#124; string* | Other value
| **@returns** | *boolean* |
#### Long#modulo(divisor)
Returns this Long modulo the specified.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| divisor | *!Long &#124; number &#124; string* | Divisor
| **@returns** | *!Long* | Remainder
#### Long#multiply(multiplier)
Returns the product of this and the specified Long.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| multiplier | *!Long &#124; number &#124; string* | Multiplier
| **@returns** | *!Long* | Product
#### Long#negate()
Negates this Long's value.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *!Long* | Negated Long
#### Long#not()
Returns the bitwise NOT of this Long.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *!Long* |
#### Long#notEquals(other)
Tests if this Long's value differs from the specified's.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| other | *!Long &#124; number &#124; string* | Other value
| **@returns** | *boolean* |
#### Long#or(other)
Returns the bitwise OR of this Long and the specified.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| other | *!Long &#124; number &#124; string* | Other Long
| **@returns** | *!Long* |
#### Long#shiftLeft(numBits)
Returns this Long with bits shifted to the left by the given amount.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| numBits | *number &#124; !Long* | Number of bits
| **@returns** | *!Long* | Shifted Long
#### Long#shiftRight(numBits)
Returns this Long with bits arithmetically shifted to the right by the given amount.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| numBits | *number &#124; !Long* | Number of bits
| **@returns** | *!Long* | Shifted Long
#### Long#shiftRightUnsigned(numBits)
Returns this Long with bits logically shifted to the right by the given amount.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| numBits | *number &#124; !Long* | Number of bits
| **@returns** | *!Long* | Shifted Long
#### Long#subtract(subtrahend)
Returns the difference of this and the specified Long.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| subtrahend | *!Long &#124; number &#124; string* | Subtrahend
| **@returns** | *!Long* | Difference
#### Long#toInt()
Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *number* |
#### Long#toNumber()
Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *number* |
#### Long#toSigned()
Converts this Long to signed.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *!Long* | Signed long
#### Long#toString(radix=)
Converts the Long to a string written in the specified radix.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| radix | *number* | Radix (2-36), defaults to 10
| **@returns** | *string* |
| **@throws** | *RangeError* | If `radix` is out of range
#### Long#toUnsigned()
Converts this Long to unsigned.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| **@returns** | *!Long* | Unsigned long
#### Long#xor(other)
Returns the bitwise XOR of this Long and the given one.
| Parameter | Type | Description
|-----------------|-----------------|---------------
| other | *!Long &#124; number &#124; string* | Other Long
| **@returns** | *!Long* |
---
*Generated with [doco](https://github.com/dcodeIO/doco) v0.3.0*

BIN
node_modules/bytebuffer/node_modules/long/donate.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,416 @@
/*
* Copyright 2012 The Closure Compiler Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Externs for Long.js.
* @see https://github.com/dcodeIO/Long.js
* @externs
*/
/**
BEGIN_NODE_INCLUDE
var Long = require('long');
END_NODE_INCLUDE
*/
/**
* @param {number|!{low: number, high: number, unsigned: boolean}} low
* @param {number=} high
* @param {boolean=} unsigned
* @constructor
*/
var Long = function(low, high, unsigned) {};
/**
* @param {*} obj
* @returns {boolean}
*/
Long.isLong = function(obj) {};
/**
* @param {number} value
* @param {boolean=} unsigned
* @return {!Long}
*/
Long.fromInt = function(value, unsigned) {};
/**
* @param {number} value
* @param {boolean=} unsigned
* @return {!Long}
*/
Long.fromNumber = function(value, unsigned) {};
/**
* @param {number} lowBits
* @param {number} highBits
* @param {boolean=} unsigned
* @return {!Long}
*/
Long.fromBits = function(lowBits, highBits, unsigned) {};
/**
* @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
* @returns {!Long}
*/
Long.fromValue = function(val) {};
/**
* @param {string} str
* @param {(boolean|number)=} unsigned
* @param {number=} radix
* @return {!Long}
*/
Long.fromString = function(str, unsigned, radix) {};
/**
* @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
* @return {!Long}
*/
Long.valueOf = function(val) {};
/**
* @type {!Long}
*/
Long.ZERO;
/**
* @type {!Long}
*/
Long.UZERO;
/**
* @type {!Long}
*/
Long.ONE;
/**
* @type {!Long}
*/
Long.UONE;
/**
* @type {!Long}
*/
Long.NEG_ONE;
/**
* @type {!Long}
*/
Long.MAX_VALUE;
/**
* @type {!Long}
*/
Long.MIN_VALUE;
/**
* @type {!Long}
*/
Long.MAX_UNSIGNED_VALUE;
/**
* @type {number}
*/
Long.prototype.low;
/**
* @type {number}
*/
Long.prototype.high;
/**
* @type {boolean}
*/
Long.prototype.unsigned;
/**
* @return {number}
*/
Long.prototype.toInt = function() {};
/**
* @return {number}
*/
Long.prototype.toNumber = function() {};
/**
* @param {number=} radix
* @return {string}
*/
Long.prototype.toString = function(radix) {};
/**
* @return {number}
*/
Long.prototype.getHighBits = function() {};
/**
* @return {number}
*/
Long.prototype.getHighBitsUnsigned = function() {};
/**
* @return {number}
*/
Long.prototype.getLowBits = function() {};
/**
* @return {number}
*/
Long.prototype.getLowBitsUnsigned = function() {};
/**
* @return {number}
*/
Long.prototype.getNumBitsAbs = function() {};
/**
* @return {boolean}
*/
Long.prototype.isZero = function() {};
/**
* @return {boolean}
*/
Long.prototype.isNegative = function() {};
/**
* @return {boolean}
*/
Long.prototype.isOdd = function() {};
/**
* @return {boolean}
*/
Long.prototype.isEven = function() {};
/**
* @param {!Long|number|string} other
* @return {boolean}
*/
Long.prototype.equals = function(other) {};
/**
* @param {!Long|number|string} other
* @return {boolean}
*/
Long.prototype.eq = function(other) {};
/**
* @param {!Long|number|string} other
* @return {boolean}
*/
Long.prototype.notEquals = function(other) {};
/**
* @param {!Long|number|string} other
* @return {boolean}
*/
Long.prototype.neq = function(other) {};
/**
* @param {!Long|number|string} other
* @return {boolean}
*/
Long.prototype.lessThan = function(other) {};
/**
* @param {!Long|number|string} other
* @return {boolean}
*/
Long.prototype.lt = function(other) {};
/**
* @param {!Long|number|string} other
* @return {boolean}
*/
Long.prototype.lessThanOrEqual = function(other) {};
/**
* @param {!Long|number|string} other
* @return {boolean}
*/
Long.prototype.lte = function(other) {};
/**
* @param {!Long|number|string} other
* @return {boolean}
*/
Long.prototype.greaterThan = function(other) {};
/**
* @param {!Long|number|string} other
* @return {boolean}
*/
Long.prototype.gt = function(other) {};
/**
* @param {!Long|number|string} other
* @return {boolean}
*/
Long.prototype.greaterThanOrEqual = function(other) {};
/**
* @param {!Long|number|string} other
* @return {boolean}
*/
Long.prototype.gte = function(other) {};
/**
* @param {!Long|number|string} other
* @return {number}
*/
Long.prototype.compare = function(other) {};
/**
* @param {!Long|number|string} other
* @return {number}
*/
Long.prototype.comp = function(other) {};
/**
* @return {!Long}
*/
Long.prototype.negate = function() {};
/**
* @return {!Long}
*/
Long.prototype.neg = function() {};
/**
* @param {!Long|number|string} other
* @return {!Long}
*/
Long.prototype.add = function(other) {};
/**
* @param {!Long|number|string} other
* @return {!Long}
*/
Long.prototype.subtract = function(other) {};
/**
* @param {!Long|number|string} other
* @return {!Long}
*/
Long.prototype.sub = function(other) {};
/**
* @param {!Long|number|string} other
* @return {!Long}
*/
Long.prototype.multiply = function(other) {};
/**
* @param {!Long|number|string} other
* @return {!Long}
*/
Long.prototype.mul = function(other) {};
/**
* @param {!Long|number|string} other
* @return {!Long}
*/
Long.prototype.divide = function(other) {};
/**
* @param {!Long|number|string} other
* @return {!Long}
*/
Long.prototype.div = function(other) {};
/**
* @param {!Long|number|string} other
* @return {!Long}
*/
Long.prototype.modulo = function(other) {};
/**
* @param {!Long|number|string} other
* @return {!Long}
*/
Long.prototype.mod = function(other) {};
/**
* @return {!Long}
*/
Long.prototype.not = function() {};
/**
* @param {!Long|number|string} other
* @return {!Long}
*/
Long.prototype.and = function(other) {};
/**
* @param {!Long|number|string} other
* @return {!Long}
*/
Long.prototype.or = function(other) {};
/**
* @param {!Long|number|string} other
* @return {!Long}
*/
Long.prototype.xor = function(other) {};
/**
* @param {number|!Long} numBits
* @return {!Long}
*/
Long.prototype.shiftLeft = function(numBits) {};
/**
* @param {number|!Long} numBits
* @return {!Long}
*/
Long.prototype.shl = function(numBits) {};
/**
* @param {number|!Long} numBits
* @return {!Long}
*/
Long.prototype.shiftRight = function(numBits) {};
/**
* @param {number|!Long} numBits
* @return {!Long}
*/
Long.prototype.shr = function(numBits) {};
/**
* @param {number|!Long} numBits
* @return {!Long}
*/
Long.prototype.shiftRightUnsigned = function(numBits) {};
/**
* @param {number|!Long} numBits
* @return {!Long}
*/
Long.prototype.shru = function(numBits) {};
/**
* @return {!Long}
*/
Long.prototype.toSigned = function() {};
/**
* @return {!Long}
*/
Long.prototype.toUnsigned = function() {};

1
node_modules/bytebuffer/node_modules/long/index.js generated vendored Normal file
View File

@ -0,0 +1 @@
module.exports = require("./dist/long.js");

13
node_modules/bytebuffer/node_modules/long/jsdoc.json generated vendored Normal file
View File

@ -0,0 +1,13 @@
{
"tags": {
"allowUnknownTags": true
},
"source": {
"include": ["dist/long.js"]
},
"opts": {
"template": "templates/esoccer",
"destination": "docs"
},
"plugins": []
}

BIN
node_modules/bytebuffer/node_modules/long/long.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

66
node_modules/bytebuffer/node_modules/long/package.json generated vendored Normal file
View File

@ -0,0 +1,66 @@
{
"_args": [
[
"long@3.2.0",
"C:\\Users\\matia\\Musix"
]
],
"_from": "long@3.2.0",
"_id": "long@3.2.0",
"_inBundle": false,
"_integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=",
"_location": "/bytebuffer/long",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "long@3.2.0",
"name": "long",
"escapedName": "long",
"rawSpec": "3.2.0",
"saveSpec": null,
"fetchSpec": "3.2.0"
},
"_requiredBy": [
"/bytebuffer"
],
"_resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz",
"_spec": "3.2.0",
"_where": "C:\\Users\\matia\\Musix",
"author": {
"name": "Daniel Wirtz",
"email": "dcode@dcode.io"
},
"bugs": {
"url": "https://github.com/dcodeIO/long.js/issues"
},
"dependencies": {},
"description": "A Long class for representing a 64-bit two's-complement integer value.",
"devDependencies": {
"closurecompiler": "^1.6",
"metascript": "~0",
"testjs": "latest"
},
"engines": {
"node": ">=0.6"
},
"homepage": "https://github.com/dcodeIO/long.js#readme",
"keywords": [
"math"
],
"license": "Apache-2.0",
"main": "dist/long.js",
"name": "long",
"repository": {
"type": "git",
"url": "git+https://github.com/dcodeIO/long.js.git"
},
"scripts": {
"build": "node scripts/build.js",
"compile": "ccjs dist/long.js --compilation_level=SIMPLE_OPTIMIZATIONS --create_source_map=dist/long.min.map > dist/long.min.js",
"compress": "gzip -c -9 dist/long.min.js > dist/long.min.js.gz",
"make": "npm run-script build && npm run-script compile && npm run-script compress && npm test",
"test": "node node_modules/testjs/bin/testjs tests/suite.js"
},
"version": "3.2.0"
}

View File

@ -0,0 +1,28 @@
var MetaScript = require("metascript"),
path = require("path"),
fs = require("fs");
var rootDir = path.join(__dirname, ".."),
srcDir = path.join(__dirname, "..", "src"),
distDir = path.join(__dirname, "..", "dist"),
pkg = require(path.join(rootDir, "package.json")),
filename;
var scope = {};
// Build
console.log("Building long.js with scope", JSON.stringify(scope, null, 2));
fs.writeFileSync(
path.join(distDir, "long.js"),
MetaScript.transform(fs.readFileSync(filename = path.join(srcDir, "wrap.js")), filename, scope, srcDir)
);
// Update bower.json
scope = { VERSION: pkg.version };
console.log("Updating bower.json with scope", JSON.stringify(scope, null, 2));
fs.writeFileSync(
path.join(rootDir, "bower.json"),
MetaScript.transform(fs.readFileSync(filename = path.join(srcDir, "bower.json")), filename, scope, srcDir)
);
console.log("Done");

View File

@ -0,0 +1,9 @@
{
"name": "long",
"version": "/*?= VERSION */",
"author": "Daniel Wirtz <dcode@dcode.io>",
"description": "A Long class for representing a 64 bit two's-complement integer value.",
"main": "dist/long.js",
"keywords": ["math"],
"license": "Apache-2.0"
}

1172
node_modules/bytebuffer/node_modules/long/src/long.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

38
node_modules/bytebuffer/node_modules/long/src/wrap.js generated vendored Normal file
View File

@ -0,0 +1,38 @@
/*
Copyright 2013 Daniel Wirtz <dcode@dcode.io>
Copyright 2009 The Closure Library Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* @license long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
* Released under the Apache License, Version 2.0
* see: https://github.com/dcodeIO/long.js for details
*/
(function(global, factory) {
/* AMD */ if (typeof define === 'function' && define["amd"])
define([], factory);
/* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"])
module["exports"] = factory();
/* Global */ else
(global["dcodeIO"] = global["dcodeIO"] || {})["Long"] = factory();
})(this, function() {
"use strict";
//? include("long.js");
return Long;
});

View File

@ -0,0 +1,807 @@
// Copyright 2009 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Defines a Long class for representing a 64-bit two's-complement
* integer value, which faithfully simulates the behavior of a Java "long". This
* implementation is derived from LongLib in GWT.
*
*/
// goog.provide('goog.math.Long');
var goog = {}; goog.math = {};
/**
* Constructs a 64-bit two's-complement integer, given its low and high 32-bit
* values as *signed* integers. See the from* functions below for more
* convenient ways of constructing Longs.
*
* The internal representation of a long is the two given signed, 32-bit values.
* We use 32-bit pieces because these are the size of integers on which
* Javascript performs bit-operations. For operations like addition and
* multiplication, we split each number into 16-bit pieces, which can easily be
* multiplied within Javascript's floating-point representation without overflow
* or change in sign.
*
* In the algorithms below, we frequently reduce the negative case to the
* positive case by negating the input(s) and then post-processing the result.
* Note that we must ALWAYS check specially whether those values are MIN_VALUE
* (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
* a positive number, it overflows back into a negative). Not handling this
* case would often result in infinite recursion.
*
* @param {number} low The low (signed) 32 bits of the long.
* @param {number} high The high (signed) 32 bits of the long.
* @constructor
* @final
*/
goog.math.Long = function(low, high) {
/**
* @type {number}
* @private
*/
this.low_ = low | 0; // force into 32 signed bits.
/**
* @type {number}
* @private
*/
this.high_ = high | 0; // force into 32 signed bits.
};
// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the
// from* methods on which they depend.
/**
* A cache of the Long representations of small integer values.
* @type {!Object}
* @private
*/
goog.math.Long.IntCache_ = {};
/**
* Returns a Long representing the given (32-bit) integer value.
* @param {number} value The 32-bit integer in question.
* @return {!goog.math.Long} The corresponding Long value.
*/
goog.math.Long.fromInt = function(value) {
if (-128 <= value && value < 128) {
var cachedObj = goog.math.Long.IntCache_[value];
if (cachedObj) {
return cachedObj;
}
}
var obj = new goog.math.Long(value | 0, value < 0 ? -1 : 0);
if (-128 <= value && value < 128) {
goog.math.Long.IntCache_[value] = obj;
}
return obj;
};
/**
* Returns a Long representing the given value, provided that it is a finite
* number. Otherwise, zero is returned.
* @param {number} value The number in question.
* @return {!goog.math.Long} The corresponding Long value.
*/
goog.math.Long.fromNumber = function(value) {
if (isNaN(value) || !isFinite(value)) {
return goog.math.Long.ZERO;
} else if (value <= -goog.math.Long.TWO_PWR_63_DBL_) {
return goog.math.Long.MIN_VALUE;
} else if (value + 1 >= goog.math.Long.TWO_PWR_63_DBL_) {
return goog.math.Long.MAX_VALUE;
} else if (value < 0) {
return goog.math.Long.fromNumber(-value).negate();
} else {
return new goog.math.Long(
(value % goog.math.Long.TWO_PWR_32_DBL_) | 0,
(value / goog.math.Long.TWO_PWR_32_DBL_) | 0);
}
};
/**
* Returns a Long representing the 64-bit integer that comes by concatenating
* the given high and low bits. Each is assumed to use 32 bits.
* @param {number} lowBits The low 32-bits.
* @param {number} highBits The high 32-bits.
* @return {!goog.math.Long} The corresponding Long value.
*/
goog.math.Long.fromBits = function(lowBits, highBits) {
return new goog.math.Long(lowBits, highBits);
};
/**
* Returns a Long representation of the given string, written using the given
* radix.
* @param {string} str The textual representation of the Long.
* @param {number=} opt_radix The radix in which the text is written.
* @return {!goog.math.Long} The corresponding Long value.
*/
goog.math.Long.fromString = function(str, opt_radix) {
if (str.length == 0) {
throw Error('number format error: empty string');
}
var radix = opt_radix || 10;
if (radix < 2 || 36 < radix) {
throw Error('radix out of range: ' + radix);
}
if (str.charAt(0) == '-') {
return goog.math.Long.fromString(str.substring(1), radix).negate();
} else if (str.indexOf('-') >= 0) {
throw Error('number format error: interior "-" character: ' + str);
}
// Do several (8) digits each time through the loop, so as to
// minimize the calls to the very expensive emulated div.
var radixToPower = goog.math.Long.fromNumber(Math.pow(radix, 8));
var result = goog.math.Long.ZERO;
for (var i = 0; i < str.length; i += 8) {
var size = Math.min(8, str.length - i);
var value = parseInt(str.substring(i, i + size), radix);
if (size < 8) {
var power = goog.math.Long.fromNumber(Math.pow(radix, size));
result = result.multiply(power).add(goog.math.Long.fromNumber(value));
} else {
result = result.multiply(radixToPower);
result = result.add(goog.math.Long.fromNumber(value));
}
}
return result;
};
// NOTE: the compiler should inline these constant values below and then remove
// these variables, so there should be no runtime penalty for these.
/**
* Number used repeated below in calculations. This must appear before the
* first call to any from* function below.
* @type {number}
* @private
*/
goog.math.Long.TWO_PWR_16_DBL_ = 1 << 16;
/**
* @type {number}
* @private
*/
goog.math.Long.TWO_PWR_24_DBL_ = 1 << 24;
/**
* @type {number}
* @private
*/
goog.math.Long.TWO_PWR_32_DBL_ =
goog.math.Long.TWO_PWR_16_DBL_ * goog.math.Long.TWO_PWR_16_DBL_;
/**
* @type {number}
* @private
*/
goog.math.Long.TWO_PWR_31_DBL_ =
goog.math.Long.TWO_PWR_32_DBL_ / 2;
/**
* @type {number}
* @private
*/
goog.math.Long.TWO_PWR_48_DBL_ =
goog.math.Long.TWO_PWR_32_DBL_ * goog.math.Long.TWO_PWR_16_DBL_;
/**
* @type {number}
* @private
*/
goog.math.Long.TWO_PWR_64_DBL_ =
goog.math.Long.TWO_PWR_32_DBL_ * goog.math.Long.TWO_PWR_32_DBL_;
/**
* @type {number}
* @private
*/
goog.math.Long.TWO_PWR_63_DBL_ =
goog.math.Long.TWO_PWR_64_DBL_ / 2;
/** @type {!goog.math.Long} */
goog.math.Long.ZERO = goog.math.Long.fromInt(0);
/** @type {!goog.math.Long} */
goog.math.Long.ONE = goog.math.Long.fromInt(1);
/** @type {!goog.math.Long} */
goog.math.Long.NEG_ONE = goog.math.Long.fromInt(-1);
/** @type {!goog.math.Long} */
goog.math.Long.MAX_VALUE =
goog.math.Long.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0);
/** @type {!goog.math.Long} */
goog.math.Long.MIN_VALUE = goog.math.Long.fromBits(0, 0x80000000 | 0);
/**
* @type {!goog.math.Long}
* @private
*/
goog.math.Long.TWO_PWR_24_ = goog.math.Long.fromInt(1 << 24);
/** @return {number} The value, assuming it is a 32-bit integer. */
goog.math.Long.prototype.toInt = function() {
return this.low_;
};
/** @return {number} The closest floating-point representation to this value. */
goog.math.Long.prototype.toNumber = function() {
return this.high_ * goog.math.Long.TWO_PWR_32_DBL_ +
this.getLowBitsUnsigned();
};
/**
* @param {number=} opt_radix The radix in which the text should be written.
* @return {string} The textual representation of this value.
* @override
*/
goog.math.Long.prototype.toString = function(opt_radix) {
var radix = opt_radix || 10;
if (radix < 2 || 36 < radix) {
throw Error('radix out of range: ' + radix);
}
if (this.isZero()) {
return '0';
}
if (this.isNegative()) {
if (this.equals(goog.math.Long.MIN_VALUE)) {
// We need to change the Long value before it can be negated, so we remove
// the bottom-most digit in this base and then recurse to do the rest.
var radixLong = goog.math.Long.fromNumber(radix);
var div = this.div(radixLong);
var rem = div.multiply(radixLong).subtract(this);
return div.toString(radix) + rem.toInt().toString(radix);
} else {
return '-' + this.negate().toString(radix);
}
}
// Do several (6) digits each time through the loop, so as to
// minimize the calls to the very expensive emulated div.
var radixToPower = goog.math.Long.fromNumber(Math.pow(radix, 6));
var rem = this;
var result = '';
while (true) {
var remDiv = rem.div(radixToPower);
var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt() >>> 0; // wraps around for base 36 (dcode)
console.log(intval);
var digits = intval.toString(radix);
rem = remDiv;
if (rem.isZero()) {
return digits + result;
} else {
while (digits.length < 6) {
digits = '0' + digits;
}
result = '' + digits + result;
}
}
};
/** @return {number} The high 32-bits as a signed value. */
goog.math.Long.prototype.getHighBits = function() {
return this.high_;
};
/** @return {number} The low 32-bits as a signed value. */
goog.math.Long.prototype.getLowBits = function() {
return this.low_;
};
/** @return {number} The low 32-bits as an unsigned value. */
goog.math.Long.prototype.getLowBitsUnsigned = function() {
return (this.low_ >= 0) ?
this.low_ : goog.math.Long.TWO_PWR_32_DBL_ + this.low_;
};
/**
* @return {number} Returns the number of bits needed to represent the absolute
* value of this Long.
*/
goog.math.Long.prototype.getNumBitsAbs = function() {
if (this.isNegative()) {
if (this.equals(goog.math.Long.MIN_VALUE)) {
return 64;
} else {
return this.negate().getNumBitsAbs();
}
} else {
var val = this.high_ != 0 ? this.high_ : this.low_;
for (var bit = 31; bit > 0; bit--) {
if ((val & (1 << bit)) != 0) {
break;
}
}
return this.high_ != 0 ? bit + 33 : bit + 1;
}
};
/** @return {boolean} Whether this value is zero. */
goog.math.Long.prototype.isZero = function() {
return this.high_ == 0 && this.low_ == 0;
};
/** @return {boolean} Whether this value is negative. */
goog.math.Long.prototype.isNegative = function() {
return this.high_ < 0;
};
/** @return {boolean} Whether this value is odd. */
goog.math.Long.prototype.isOdd = function() {
return (this.low_ & 1) == 1;
};
/**
* @param {goog.math.Long} other Long to compare against.
* @return {boolean} Whether this Long equals the other.
*/
goog.math.Long.prototype.equals = function(other) {
return (this.high_ == other.high_) && (this.low_ == other.low_);
};
/**
* @param {goog.math.Long} other Long to compare against.
* @return {boolean} Whether this Long does not equal the other.
*/
goog.math.Long.prototype.notEquals = function(other) {
return (this.high_ != other.high_) || (this.low_ != other.low_);
};
/**
* @param {goog.math.Long} other Long to compare against.
* @return {boolean} Whether this Long is less than the other.
*/
goog.math.Long.prototype.lessThan = function(other) {
return this.compare(other) < 0;
};
/**
* @param {goog.math.Long} other Long to compare against.
* @return {boolean} Whether this Long is less than or equal to the other.
*/
goog.math.Long.prototype.lessThanOrEqual = function(other) {
return this.compare(other) <= 0;
};
/**
* @param {goog.math.Long} other Long to compare against.
* @return {boolean} Whether this Long is greater than the other.
*/
goog.math.Long.prototype.greaterThan = function(other) {
return this.compare(other) > 0;
};
/**
* @param {goog.math.Long} other Long to compare against.
* @return {boolean} Whether this Long is greater than or equal to the other.
*/
goog.math.Long.prototype.greaterThanOrEqual = function(other) {
return this.compare(other) >= 0;
};
/**
* Compares this Long with the given one.
* @param {goog.math.Long} other Long to compare against.
* @return {number} 0 if they are the same, 1 if the this is greater, and -1
* if the given one is greater.
*/
goog.math.Long.prototype.compare = function(other) {
if (this.equals(other)) {
return 0;
}
var thisNeg = this.isNegative();
var otherNeg = other.isNegative();
if (thisNeg && !otherNeg) {
return -1;
}
if (!thisNeg && otherNeg) {
return 1;
}
// at this point, the signs are the same, so subtraction will not overflow
if (this.subtract(other).isNegative()) {
return -1;
} else {
return 1;
}
};
/** @return {!goog.math.Long} The negation of this value. */
goog.math.Long.prototype.negate = function() {
if (this.equals(goog.math.Long.MIN_VALUE)) {
return goog.math.Long.MIN_VALUE;
} else {
return this.not().add(goog.math.Long.ONE);
}
};
/**
* Returns the sum of this and the given Long.
* @param {goog.math.Long} other Long to add to this one.
* @return {!goog.math.Long} The sum of this and the given Long.
*/
goog.math.Long.prototype.add = function(other) {
// Divide each number into 4 chunks of 16 bits, and then sum the chunks.
var a48 = this.high_ >>> 16;
var a32 = this.high_ & 0xFFFF;
var a16 = this.low_ >>> 16;
var a00 = this.low_ & 0xFFFF;
var b48 = other.high_ >>> 16;
var b32 = other.high_ & 0xFFFF;
var b16 = other.low_ >>> 16;
var b00 = other.low_ & 0xFFFF;
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
c00 += a00 + b00;
c16 += c00 >>> 16;
c00 &= 0xFFFF;
c16 += a16 + b16;
c32 += c16 >>> 16;
c16 &= 0xFFFF;
c32 += a32 + b32;
c48 += c32 >>> 16;
c32 &= 0xFFFF;
c48 += a48 + b48;
c48 &= 0xFFFF;
return goog.math.Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);
};
/**
* Returns the difference of this and the given Long.
* @param {goog.math.Long} other Long to subtract from this.
* @return {!goog.math.Long} The difference of this and the given Long.
*/
goog.math.Long.prototype.subtract = function(other) {
return this.add(other.negate());
};
/**
* Returns the product of this and the given long.
* @param {goog.math.Long} other Long to multiply with this.
* @return {!goog.math.Long} The product of this and the other.
*/
goog.math.Long.prototype.multiply = function(other) {
if (this.isZero()) {
return goog.math.Long.ZERO;
} else if (other.isZero()) {
return goog.math.Long.ZERO;
}
if (this.equals(goog.math.Long.MIN_VALUE)) {
return other.isOdd() ? goog.math.Long.MIN_VALUE : goog.math.Long.ZERO;
} else if (other.equals(goog.math.Long.MIN_VALUE)) {
return this.isOdd() ? goog.math.Long.MIN_VALUE : goog.math.Long.ZERO;
}
if (this.isNegative()) {
if (other.isNegative()) {
return this.negate().multiply(other.negate());
} else {
return this.negate().multiply(other).negate();
}
} else if (other.isNegative()) {
return this.multiply(other.negate()).negate();
}
// If both longs are small, use float multiplication
if (this.lessThan(goog.math.Long.TWO_PWR_24_) &&
other.lessThan(goog.math.Long.TWO_PWR_24_)) {
return goog.math.Long.fromNumber(this.toNumber() * other.toNumber());
}
// Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
// We can skip products that would overflow.
var a48 = this.high_ >>> 16;
var a32 = this.high_ & 0xFFFF;
var a16 = this.low_ >>> 16;
var a00 = this.low_ & 0xFFFF;
var b48 = other.high_ >>> 16;
var b32 = other.high_ & 0xFFFF;
var b16 = other.low_ >>> 16;
var b00 = other.low_ & 0xFFFF;
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
c00 += a00 * b00;
c16 += c00 >>> 16;
c00 &= 0xFFFF;
c16 += a16 * b00;
c32 += c16 >>> 16;
c16 &= 0xFFFF;
c16 += a00 * b16;
c32 += c16 >>> 16;
c16 &= 0xFFFF;
c32 += a32 * b00;
c48 += c32 >>> 16;
c32 &= 0xFFFF;
c32 += a16 * b16;
c48 += c32 >>> 16;
c32 &= 0xFFFF;
c32 += a00 * b32;
c48 += c32 >>> 16;
c32 &= 0xFFFF;
c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
c48 &= 0xFFFF;
return goog.math.Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);
};
/**
* Returns this Long divided by the given one.
* @param {goog.math.Long} other Long by which to divide.
* @return {!goog.math.Long} This Long divided by the given one.
*/
goog.math.Long.prototype.div = function(other) {
if (other.isZero()) {
throw Error('division by zero');
} else if (this.isZero()) {
return goog.math.Long.ZERO;
}
if (this.equals(goog.math.Long.MIN_VALUE)) {
if (other.equals(goog.math.Long.ONE) ||
other.equals(goog.math.Long.NEG_ONE)) {
return goog.math.Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
} else if (other.equals(goog.math.Long.MIN_VALUE)) {
return goog.math.Long.ONE;
} else {
// At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
var halfThis = this.shiftRight(1);
var approx = halfThis.div(other).shiftLeft(1);
if (approx.equals(goog.math.Long.ZERO)) {
return other.isNegative() ? goog.math.Long.ONE : goog.math.Long.NEG_ONE;
} else {
var rem = this.subtract(other.multiply(approx));
var result = approx.add(rem.div(other));
return result;
}
}
} else if (other.equals(goog.math.Long.MIN_VALUE)) {
return goog.math.Long.ZERO;
}
if (this.isNegative()) {
if (other.isNegative()) {
return this.negate().div(other.negate());
} else {
return this.negate().div(other).negate();
}
} else if (other.isNegative()) {
return this.div(other.negate()).negate();
}
// Repeat the following until the remainder is less than other: find a
// floating-point that approximates remainder / other *from below*, add this
// into the result, and subtract it from the remainder. It is critical that
// the approximate value is less than or equal to the real value so that the
// remainder never becomes negative.
var res = goog.math.Long.ZERO;
var rem = this;
while (rem.greaterThanOrEqual(other)) {
// Approximate the result of division. This may be a little greater or
// smaller than the actual value.
var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber()));
// We will tweak the approximate result by changing it in the 48-th digit or
// the smallest non-fractional digit, whichever is larger.
var log2 = Math.ceil(Math.log(approx) / Math.LN2);
var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48);
// Decrease the approximation until it is smaller than the remainder. Note
// that if it is too large, the product overflows and is negative.
var approxRes = goog.math.Long.fromNumber(approx);
var approxRem = approxRes.multiply(other);
while (approxRem.isNegative() || approxRem.greaterThan(rem)) {
approx -= delta;
approxRes = goog.math.Long.fromNumber(approx);
approxRem = approxRes.multiply(other);
}
// We know the answer can't be zero... and actually, zero would cause
// infinite recursion since we would make no progress.
if (approxRes.isZero()) {
approxRes = goog.math.Long.ONE;
}
res = res.add(approxRes);
rem = rem.subtract(approxRem);
}
return res;
};
/**
* Returns this Long modulo the given one.
* @param {goog.math.Long} other Long by which to mod.
* @return {!goog.math.Long} This Long modulo the given one.
*/
goog.math.Long.prototype.modulo = function(other) {
return this.subtract(this.div(other).multiply(other));
};
/** @return {!goog.math.Long} The bitwise-NOT of this value. */
goog.math.Long.prototype.not = function() {
return goog.math.Long.fromBits(~this.low_, ~this.high_);
};
/**
* Returns the bitwise-AND of this Long and the given one.
* @param {goog.math.Long} other The Long with which to AND.
* @return {!goog.math.Long} The bitwise-AND of this and the other.
*/
goog.math.Long.prototype.and = function(other) {
return goog.math.Long.fromBits(this.low_ & other.low_,
this.high_ & other.high_);
};
/**
* Returns the bitwise-OR of this Long and the given one.
* @param {goog.math.Long} other The Long with which to OR.
* @return {!goog.math.Long} The bitwise-OR of this and the other.
*/
goog.math.Long.prototype.or = function(other) {
return goog.math.Long.fromBits(this.low_ | other.low_,
this.high_ | other.high_);
};
/**
* Returns the bitwise-XOR of this Long and the given one.
* @param {goog.math.Long} other The Long with which to XOR.
* @return {!goog.math.Long} The bitwise-XOR of this and the other.
*/
goog.math.Long.prototype.xor = function(other) {
return goog.math.Long.fromBits(this.low_ ^ other.low_,
this.high_ ^ other.high_);
};
/**
* Returns this Long with bits shifted to the left by the given amount.
* @param {number} numBits The number of bits by which to shift.
* @return {!goog.math.Long} This shifted to the left by the given amount.
*/
goog.math.Long.prototype.shiftLeft = function(numBits) {
numBits &= 63;
if (numBits == 0) {
return this;
} else {
var low = this.low_;
if (numBits < 32) {
var high = this.high_;
return goog.math.Long.fromBits(
low << numBits,
(high << numBits) | (low >>> (32 - numBits)));
} else {
return goog.math.Long.fromBits(0, low << (numBits - 32));
}
}
};
/**
* Returns this Long with bits shifted to the right by the given amount.
* @param {number} numBits The number of bits by which to shift.
* @return {!goog.math.Long} This shifted to the right by the given amount.
*/
goog.math.Long.prototype.shiftRight = function(numBits) {
numBits &= 63;
if (numBits == 0) {
return this;
} else {
var high = this.high_;
if (numBits < 32) {
var low = this.low_;
return goog.math.Long.fromBits(
(low >>> numBits) | (high << (32 - numBits)),
high >> numBits);
} else {
return goog.math.Long.fromBits(
high >> (numBits - 32),
high >= 0 ? 0 : -1);
}
}
};
/**
* Returns this Long with bits shifted to the right by the given amount, with
* zeros placed into the new leading bits.
* @param {number} numBits The number of bits by which to shift.
* @return {!goog.math.Long} This shifted to the right by the given amount, with
* zeros placed into the new leading bits.
*/
goog.math.Long.prototype.shiftRightUnsigned = function(numBits) {
numBits &= 63;
if (numBits == 0) {
return this;
} else {
var high = this.high_;
if (numBits < 32) {
var low = this.low_;
return goog.math.Long.fromBits(
(low >>> numBits) | (high << (32 - numBits)),
high >>> numBits);
} else if (numBits == 32) {
return goog.math.Long.fromBits(high, 0);
} else {
return goog.math.Long.fromBits(high >>> (numBits - 32), 0);
}
}
};
module.exports = goog.math.Long;

View File

@ -0,0 +1,195 @@
/*
Copyright 2013 Daniel Wirtz <dcode@dcode.io>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var Long = require(__dirname+"/../index.js"),
gmLong = require("./goog.math.long.js");
var suite = {
"basic": function(test) {
var longVal = new Long(0xFFFFFFFF, 0x7FFFFFFF);
test.equal(longVal.toNumber(), 9223372036854775807);
test.equal(longVal.toString(), "9223372036854775807");
var longVal2 = Long.fromValue(longVal);
test.equal(longVal2.toNumber(), 9223372036854775807);
test.equal(longVal2.toString(), "9223372036854775807");
test.equal(longVal2.unsigned, longVal.unsigned);
test.done();
},
"isLong": function(test) {
var longVal = new Long(0xFFFFFFFF, 0x7FFFFFFF);
test.strictEqual(Long.isLong(longVal), true);
longVal = {"__isLong__": true};
test.strictEqual(Long.isLong(longVal), true);
test.done();
},
// Let's assume goog.math.Long has been tested properly and focus on our extensions:
"toString": function(test) {
var longVal = Long.fromBits(0xFFFFFFFF, 0xFFFFFFFF, true);
// #10
test.equal(longVal.toString(16), "ffffffffffffffff");
test.equal(longVal.toString(10), "18446744073709551615");
test.equal(longVal.toString(8), "1777777777777777777777");
// #7, obviously wrong in goog.math.Long
test.equal(Long.fromString("zzzzzz", 36).toString(36), "zzzzzz");
test.equal(Long.fromString("-zzzzzz", 36).toString(36), "-zzzzzz");
test.done();
},
"toBytes": function(test) {
var longVal = Long.fromBits(0x01234567, 0x12345678);
test.deepEqual(longVal.toBytesBE(), [
0x12, 0x34, 0x56, 0x78,
0x01, 0x23, 0x45, 0x67
]);
test.deepEqual(longVal.toBytesLE(), [
0x67, 0x45, 0x23, 0x01,
0x78, 0x56, 0x34, 0x12
]);
test.done();
},
"unsigned": {
"min/max": function(test) {
test.equal(Long.MIN_VALUE.toString(), "-9223372036854775808");
test.equal(Long.MAX_VALUE.toString(), "9223372036854775807");
test.equal(Long.MAX_UNSIGNED_VALUE.toString(), "18446744073709551615");
test.done();
},
"construct_negint": function(test) {
var longVal = Long.fromInt(-1, true);
test.equal(longVal.low, -1);
test.equal(longVal.high, -1);
test.equal(longVal.unsigned, true);
test.equal(longVal.toNumber(), 18446744073709551615);
test.equal(longVal.toString(), "18446744073709551615");
test.done();
},
"construct_highlow": function(test) {
var longVal = new Long(0xFFFFFFFF, 0xFFFFFFFF, true);
test.equal(longVal.low, -1);
test.equal(longVal.high, -1);
test.equal(longVal.unsigned, true);
test.equal(longVal.toNumber(), 18446744073709551615);
test.equal(longVal.toString(), "18446744073709551615");
test.done();
},
"construct_number": function(test) {
var longVal = Long.fromNumber(0xFFFFFFFFFFFFFFFF, true);
test.equal(longVal.low, -1);
test.equal(longVal.high, -1);
test.equal(longVal.unsigned, true);
test.equal(longVal.toNumber(), 18446744073709551615);
test.equal(longVal.toString(), "18446744073709551615");
test.done();
},
"toSigned/Unsigned": function(test) {
var longVal = Long.fromNumber(-1, false);
test.equal(longVal.toNumber(), -1);
longVal = longVal.toUnsigned();
test.equal(longVal.toNumber(), 0xFFFFFFFFFFFFFFFF);
test.equal(longVal.toString(16), 'ffffffffffffffff');
longVal = longVal.toSigned();
test.equal(longVal.toNumber(), -1);
test.done();
},
"max_unsigned_sub_max_signed": function(test) {
var longVal = Long.MAX_UNSIGNED_VALUE.subtract(Long.MAX_VALUE).subtract(Long.ONE);
test.equal(longVal.toNumber(), Long.MAX_VALUE.toNumber());
test.equal(longVal.toString(), Long.MAX_VALUE.toString());
test.done();
},
"max_sub_max": function(test) {
var longVal = Long.MAX_UNSIGNED_VALUE.subtract(Long.MAX_UNSIGNED_VALUE);
test.equal(longVal, 0);
test.equal(longVal.low, 0);
test.equal(longVal.high, 0);
test.equal(longVal.unsigned, true);
test.equal(longVal.toNumber(), 0);
test.equal(longVal.toString(), "0");
test.done();
},
"zero_sub_signed": function(test) {
var longVal = Long.fromInt(0, true).add(Long.fromInt(-1, false));
test.equal(longVal.low, -1);
test.equal(longVal.high, -1);
test.equal(longVal.unsigned, true);
test.equal(longVal.toNumber(), 18446744073709551615);
test.equal(longVal.toString(), "18446744073709551615");
test.done();
},
"max_unsigned_div_max_signed": function(test) {
var longVal = Long.MAX_UNSIGNED_VALUE.div(Long.MAX_VALUE);
test.equal(longVal.toNumber(), 2);
test.equal(longVal.toString(), "2");
test.done();
},
"max_unsigned_div_max_unsigned": function(test) {
var longVal = Long.MAX_UNSIGNED_VALUE;
test.strictEqual(longVal.div(longVal).toString(), '1');
test.done();
},
"max_unsigned_div_neg_signed": function(test) {
var a = Long.MAX_UNSIGNED_VALUE;
var b = Long.fromInt(-2);
test.strictEqual(b.toUnsigned().toString(), Long.MAX_UNSIGNED_VALUE.sub(1).toString());
var longVal = a.div(b);
test.strictEqual(longVal.toString(), '1');
test.done();
},
"min_signed_div_one": function(test) {
var longVal = Long.MIN_VALUE.div(Long.ONE);
test.strictEqual(longVal.toString(), Long.MIN_VALUE.toString());
test.done();
},
"msb_unsigned": function(test) {
var longVal = Long.UONE.shiftLeft(63);
test.ok(longVal.notEquals(Long.MIN_VALUE));
test.equal(longVal.toString(), "9223372036854775808");
test.equal(Long.fromString("9223372036854775808", true).toString(), "9223372036854775808");
test.done();
},
"issue31": function(test) {
var a = new Long(0, 8, true);
var b = Long.fromNumber(2656901066, true);
test.strictEqual(a.unsigned, true);
test.strictEqual(b.unsigned, true);
var x = a.div(b);
test.strictEqual(x.toString(), '12');
test.strictEqual(x.unsigned, true);
test.done();
}
}
};
module.exports = suite;

83
node_modules/bytebuffer/package.json generated vendored Normal file
View File

@ -0,0 +1,83 @@
{
"_args": [
[
"bytebuffer@5.0.1",
"C:\\Users\\matia\\Musix"
]
],
"_from": "bytebuffer@5.0.1",
"_id": "bytebuffer@5.0.1",
"_inBundle": false,
"_integrity": "sha1-WC7qSxqHO20CCkjVjfhfC7ps/d0=",
"_location": "/bytebuffer",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "bytebuffer@5.0.1",
"name": "bytebuffer",
"escapedName": "bytebuffer",
"rawSpec": "5.0.1",
"saveSpec": null,
"fetchSpec": "5.0.1"
},
"_requiredBy": [
"/grpc/protobufjs"
],
"_resolved": "https://registry.npmjs.org/bytebuffer/-/bytebuffer-5.0.1.tgz",
"_spec": "5.0.1",
"_where": "C:\\Users\\matia\\Musix",
"author": {
"name": "Daniel Wirtz",
"email": "dcode@dcode.io"
},
"browser": "dist/bytebuffer.js",
"bugs": {
"url": "https://github.com/dcodeIO/bytebuffer.js/issues"
},
"dependencies": {
"long": "~3"
},
"description": "The swiss army knife for binary data in JavaScript.",
"devDependencies": {
"closurecompiler": "~1",
"lxiv": "~0.2",
"metascript": "~0",
"pretty-hrtime": "^1.0.0",
"testjs": "~1",
"utfx": "^1.0.1"
},
"engines": {
"node": ">=0.8"
},
"homepage": "https://github.com/dcodeIO/bytebuffer.js#readme",
"keywords": [
"net",
"array",
"buffer",
"arraybuffer",
"typed array",
"bytebuffer",
"json",
"websocket",
"webrtc"
],
"license": "Apache-2.0",
"main": "dist/bytebuffer-node.js",
"name": "bytebuffer",
"repository": {
"type": "git",
"url": "git+https://github.com/dcodeIO/bytebuffer.js.git"
},
"scripts": {
"build": "node scripts/build.js",
"compile": "npm run-script compile-default && npm run-script compile-dataview",
"compile-dataview": "ccjs dist/bytebuffer-dataview.js --create_source_map=dist/bytebuffer-dataview.min.map --externs=externs/minimal-env.js --externs=node_modules/long/externs/long.js > dist/bytebuffer-dataview.min.js",
"compile-default": "ccjs dist/bytebuffer.js --create_source_map=dist/bytebuffer.min.map --externs=externs/minimal-env.js --externs=node_modules/long/externs/long.js > dist/bytebuffer.min.js",
"compress": "gzip -c -9 dist/bytebuffer.min.js > dist/bytebuffer.min.js.gz && gzip -c -9 dist/bytebuffer-dataview.min.js > dist/bytebuffer-dataview.min.js.gz",
"make": "npm run-script build && npm run-script compile && npm run-script compress && npm test",
"prepublish": "npm test",
"test": "node node_modules/testjs/bin/testjs tests/suite.js"
},
"version": "5.0.1"
}

113
node_modules/bytebuffer/scripts/build.js generated vendored Normal file
View File

@ -0,0 +1,113 @@
/*
Copyright 2013 Daniel Wirtz <dcode@dcode.io>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var MetaScript = require("metascript"),
path = require("path"),
fs = require("fs");
var rootDir = path.join(__dirname, ".."),
srcDir = path.join(__dirname, "..", "src"),
distDir = path.join(__dirname, "..", "dist"),
pkg = require(path.join(rootDir, "package.json")),
filename;
var scope = {
VERSION : pkg.version, // Version
// Encodings
ENCODINGS : true, // Include encodings in general (catches all)
BASE64 : true, // Include base64 encoding
BINARY : true, // Include binary encoding
DEBUG : true, // Include debug encoding
HEX : true, // Include hex encoding
UTF8 : true, // Include utf8 encoding (required for STRINGS)
// Primitive types
BYTES : true, // Include bytes
INTS : true, // Include int types in general (catches all)
INT8 : true, // Include int8/uint8
INT16 : true, // Include int16/uint16
INT32 : true, // Include int32/uint32
INT64 : true, // Include int64/uint64 with Long.js
FLOATS : true, // Include float types in general (catches all)
FLOAT32 : true, // Include float32
FLOAT64 : true, // Include float64
// Varint encoding
VARINTS : true, // Include varint encoding in general (catches all)
VARINT32 : true, // Include varint32/zigZagVarint32
VARINT64 : true, // Include varint64/zigZagVarint32 with Long.js
// String support
STRINGS : true, // Include string support in general (catches all)
UTF8STRING : true, // Include UTF8 encoded strings
CSTRING : true, // Include C-like null terminated strings
VSTRING : true, // Include varint32 length prefixed strings
ISTRING : true, // Include uint32 length prefixed strings
// Other
ALIASES : true, // Include aliases like writeByte, writeShort ..
INLINE : true, // Inline any assertion code
VERBOSE_MS : false // Include MetaScript details as comments
};
// Optimize for size : INLINE=false, ALIASES=false, VERBOSE_MS=false, WHATEVERYOUDONTNEED=false
// Optimize for speed : INLINE=true
if (!scope.UTF8) scope.STRINGS = false;
// Build node version using Buffers
scope.NODE = true;
console.log("Building bytebuffer-node with scope", JSON.stringify(scope, null, 2));
fs.writeFileSync(
path.join(distDir, "bytebuffer-node.js"),
MetaScript.transform(fs.readFileSync(filename = path.join(srcDir, "wrap-node.js")), filename, scope, srcDir)
);
// Build browser version using Typed Arrays
scope.NODE = false;
scope.DATAVIEW = false;
delete scope.BUFFERVIEW;
console.log("Building bytebuffer.js with scope", JSON.stringify(scope, null, 2));
fs.writeFileSync(
path.join(distDir, "bytebuffer.js"),
MetaScript.transform(fs.readFileSync(filename = path.join(srcDir, "wrap.js")), filename, scope)
);
// Build alternative browser version using a DataView
scope.NODE = false;
scope.DATAVIEW = true;
console.log("Building bytebuffer-dataview with scope", JSON.stringify(scope, null, 2));
fs.writeFileSync(
path.join(distDir, "bytebuffer-dataview.js"),
MetaScript.transform(fs.readFileSync(filename = path.join(srcDir, "wrap.js")), filename, scope)
);
// Update bower.json
scope = { VERSION: pkg.version };
console.log("Updating bower.json with scope", JSON.stringify(scope, null, 2));
fs.writeFileSync(
path.join(rootDir, "bower.json"),
MetaScript.transform(fs.readFileSync(filename = path.join(srcDir, "bower.json")), filename, scope, srcDir)
);
console.log("Done");

12
node_modules/bytebuffer/src/bower.json generated vendored Normal file
View File

@ -0,0 +1,12 @@
{
"name": "bytebuffer",
"version": "/*?= VERSION */",
"author": "Daniel Wirtz <dcode@dcode.io>",
"description": "A full-featured ByteBuffer implementation using typed arrays.",
"main": "dist/bytebuffer.js",
"keywords": ["net", "array", "buffer", "arraybuffer", "typed array", "bytebuffer", "json", "websocket", "webrtc"],
"dependencies": {
"long": "latest"
},
"license": "Apache-2.0"
}

220
node_modules/bytebuffer/src/bytebuffer.js generated vendored Normal file
View File

@ -0,0 +1,220 @@
//? include("macros.js");
/**
* Constructs a new ByteBuffer.
* @class The swiss army knife for binary data in JavaScript.
* @exports ByteBuffer
* @constructor
* @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
* @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
* {@link ByteBuffer.DEFAULT_ENDIAN}.
* @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
* {@link ByteBuffer.DEFAULT_NOASSERT}.
* @expose
*/
var ByteBuffer = function(capacity, littleEndian, noAssert) {
if (typeof capacity === 'undefined')
capacity = ByteBuffer.DEFAULT_CAPACITY;
if (typeof littleEndian === 'undefined')
littleEndian = ByteBuffer.DEFAULT_ENDIAN;
if (typeof noAssert === 'undefined')
noAssert = ByteBuffer.DEFAULT_NOASSERT;
if (!noAssert) {
capacity = capacity | 0;
if (capacity < 0)
throw RangeError("Illegal capacity");
littleEndian = !!littleEndian;
noAssert = !!noAssert;
}
//? if (NODE) {
/**
* Backing node Buffer.
* @type {!Buffer}
* @expose
*/
this.buffer = capacity === 0 ? EMPTY_BUFFER : new Buffer(capacity);
//? } else {
/**
* Backing ArrayBuffer.
* @type {!ArrayBuffer}
* @expose
*/
this.buffer = capacity === 0 ? EMPTY_BUFFER : new ArrayBuffer(capacity);
//? if (DATAVIEW) {
/**
* DataView utilized to manipulate the backing buffer. Becomes `null` if the backing buffer has a capacity of `0`.
* @type {?DataView}
* @expose
*/
this.view = capacity === 0 ? null : new DataView(this.buffer);
//? } else {
/**
* Uint8Array utilized to manipulate the backing buffer. Becomes `null` if the backing buffer has a capacity of `0`.
* @type {?Uint8Array}
* @expose
*/
this.view = capacity === 0 ? null : new Uint8Array(this.buffer);
//? }
//? }
/**
* Absolute read/write offset.
* @type {number}
* @expose
* @see ByteBuffer#flip
* @see ByteBuffer#clear
*/
this.offset = 0;
/**
* Marked offset.
* @type {number}
* @expose
* @see ByteBuffer#mark
* @see ByteBuffer#reset
*/
this.markedOffset = -1;
/**
* Absolute limit of the contained data. Set to the backing buffer's capacity upon allocation.
* @type {number}
* @expose
* @see ByteBuffer#flip
* @see ByteBuffer#clear
*/
this.limit = capacity;
/**
* Whether to use little endian byte order, defaults to `false` for big endian.
* @type {boolean}
* @expose
*/
this.littleEndian = littleEndian;
/**
* Whether to skip assertions of offsets and values, defaults to `false`.
* @type {boolean}
* @expose
*/
this.noAssert = noAssert;
};
/**
* ByteBuffer version.
* @type {string}
* @const
* @expose
*/
ByteBuffer.VERSION = "/*?= VERSION */";
/**
* Little endian constant that can be used instead of its boolean value. Evaluates to `true`.
* @type {boolean}
* @const
* @expose
*/
ByteBuffer.LITTLE_ENDIAN = true;
/**
* Big endian constant that can be used instead of its boolean value. Evaluates to `false`.
* @type {boolean}
* @const
* @expose
*/
ByteBuffer.BIG_ENDIAN = false;
/**
* Default initial capacity of `16`.
* @type {number}
* @expose
*/
ByteBuffer.DEFAULT_CAPACITY = 16;
/**
* Default endianess of `false` for big endian.
* @type {boolean}
* @expose
*/
ByteBuffer.DEFAULT_ENDIAN = ByteBuffer.BIG_ENDIAN;
/**
* Default no assertions flag of `false`.
* @type {boolean}
* @expose
*/
ByteBuffer.DEFAULT_NOASSERT = false;
//? if (NODE) {
/**
* A `Long` class for representing a 64-bit two's-complement integer value.
* @type {!Long}
* @const
* @see https://npmjs.org/package/long
* @expose
*/
ByteBuffer.Long = Long;
//? } else {
/**
* A `Long` class for representing a 64-bit two's-complement integer value. May be `null` if Long.js has not been loaded
* and int64 support is not available.
* @type {?Long}
* @const
* @see https://github.com/dcodeIO/long.js
* @expose
*/
ByteBuffer.Long = Long || null;
//? }
/**
* @alias ByteBuffer.prototype
* @inner
*/
var ByteBufferPrototype = ByteBuffer.prototype;
/**
* An indicator used to reliably determine if an object is a ByteBuffer or not.
* @type {boolean}
* @const
* @expose
* @private
*/
ByteBufferPrototype.__isByteBuffer__;
Object.defineProperty(ByteBufferPrototype, "__isByteBuffer__", {
value: true,
enumerable: false,
configurable: false
});
//? include("helpers.js");
//? include("methods/static/*.js");
//? if (BYTES) {
//? include("types/bytes/*.js");
//? }
//? if (INTS) {
//? include("types/ints/*.js");
//? }
//? if (FLOATS) {
//? include("types/floats/float*.js");
//? }
//? if (VARINTS) {
//? include("types/varints/*.js");
//? }
//? if (UTF8 && STRINGS) {
//? include("types/strings/*.js");
//? }
//? include("methods/*.js");
//? if (ENCODINGS) {
//? include("encodings/*.js");
//? }

88
node_modules/bytebuffer/src/encodings/base64.js generated vendored Normal file
View File

@ -0,0 +1,88 @@
//? if (BASE64) {
//? if (!NODE) {
// lxiv-embeddable
//? include("../../node_modules/lxiv/dist/lxiv-embeddable.js");
//? }
// encodings/base64
/**
* Encodes this ByteBuffer's contents to a base64 encoded string.
* @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}.
* @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}.
* @returns {string} Base64 encoded string
* @throws {RangeError} If `begin` or `end` is out of bounds
* @expose
*/
ByteBufferPrototype.toBase64 = function(begin, end) {
if (typeof begin === 'undefined')
begin = this.offset;
if (typeof end === 'undefined')
end = this.limit;
begin = begin | 0; end = end | 0;
if (begin < 0 || end > this.capacity || begin > end)
throw RangeError("begin, end");
//? if (NODE)
return this.buffer.toString("base64", begin, end);
//? else {
var sd; lxiv.encode(function() {
//? if (DATAVIEW)
return begin < end ? this.view.getUint8(begin++) : null;
//? else
return begin < end ? this.view[begin++] : null;
}.bind(this), sd = stringDestination());
return sd();
//? }
};
/**
* Decodes a base64 encoded string to a ByteBuffer.
* @param {string} str String to decode
* @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
* {@link ByteBuffer.DEFAULT_ENDIAN}.
* @returns {!ByteBuffer} ByteBuffer
* @expose
*/
ByteBuffer.fromBase64 = function(str, littleEndian) {
//? if (NODE) {
return ByteBuffer.wrap(new Buffer(str, "base64"), littleEndian);
//? } else {
if (typeof str !== 'string')
throw TypeError("str");
var bb = new ByteBuffer(str.length/4*3, littleEndian),
i = 0;
lxiv.decode(stringSource(str), function(b) {
//? if (DATAVIEW)
bb.view.setUint8(i++, b);
//? else
bb.view[i++] = b;
});
bb.limit = i;
//? }
return bb;
};
/**
* Encodes a binary string to base64 like `window.btoa` does.
* @param {string} str Binary string
* @returns {string} Base64 encoded string
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window.btoa
* @expose
*/
ByteBuffer.btoa = function(str) {
return ByteBuffer.fromBinary(str).toBase64();
};
/**
* Decodes a base64 encoded string to binary like `window.atob` does.
* @param {string} b64 Base64 encoded string
* @returns {string} Binary string
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window.atob
* @expose
*/
ByteBuffer.atob = function(b64) {
return ByteBuffer.fromBase64(b64).toBinary();
};
//? }

74
node_modules/bytebuffer/src/encodings/binary.js generated vendored Normal file
View File

@ -0,0 +1,74 @@
//? if (BINARY) {
// encodings/binary
/**
* Encodes this ByteBuffer to a binary encoded string, that is using only characters 0x00-0xFF as bytes.
* @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
* @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
* @returns {string} Binary encoded string
* @throws {RangeError} If `offset > limit`
* @expose
*/
ByteBufferPrototype.toBinary = function(begin, end) {
if (typeof begin === 'undefined')
begin = this.offset;
if (typeof end === 'undefined')
end = this.limit;
begin |= 0; end |= 0;
if (begin < 0 || end > this.capacity() || begin > end)
throw RangeError("begin, end");
//? if (NODE)
return this.buffer.toString("binary", begin, end);
//? else {
if (begin === end)
return "";
var chars = [],
parts = [];
while (begin < end) {
//? if (NODE)
chars.push(this.buffer[begin++]);
//? else if (DATAVIEW)
chars.push(this.view.getUint8(begin++));
//? else
chars.push(this.view[begin++]);
if (chars.length >= 1024)
parts.push(String.fromCharCode.apply(String, chars)),
chars = [];
}
return parts.join('') + String.fromCharCode.apply(String, chars);
//? }
};
/**
* Decodes a binary encoded string, that is using only characters 0x00-0xFF as bytes, to a ByteBuffer.
* @param {string} str String to decode
* @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
* {@link ByteBuffer.DEFAULT_ENDIAN}.
* @returns {!ByteBuffer} ByteBuffer
* @expose
*/
ByteBuffer.fromBinary = function(str, littleEndian) {
//? if (NODE) {
return ByteBuffer.wrap(new Buffer(str, "binary"), littleEndian);
//? } else {
if (typeof str !== 'string')
throw TypeError("str");
var i = 0,
k = str.length,
charCode,
bb = new ByteBuffer(k, littleEndian);
while (i<k) {
charCode = str.charCodeAt(i);
if (charCode > 0xff)
throw RangeError("illegal char code: "+charCode);
//? if (DATAVIEW)
bb.view.setUint8(i++, charCode);
//? else
bb.view[i++] = charCode;
}
bb.limit = k;
//? }
return bb;
};
//? }

211
node_modules/bytebuffer/src/encodings/debug.js generated vendored Normal file
View File

@ -0,0 +1,211 @@
//? if (DEBUG) {
// encodings/debug
/**
* Encodes this ByteBuffer to a hex encoded string with marked offsets. Offset symbols are:
* * `<` : offset,
* * `'` : markedOffset,
* * `>` : limit,
* * `|` : offset and limit,
* * `[` : offset and markedOffset,
* * `]` : markedOffset and limit,
* * `!` : offset, markedOffset and limit
* @param {boolean=} columns If `true` returns two columns hex + ascii, defaults to `false`
* @returns {string|!Array.<string>} Debug string or array of lines if `asArray = true`
* @expose
* @example `>00'01 02<03` contains four bytes with `limit=0, markedOffset=1, offset=3`
* @example `00[01 02 03>` contains four bytes with `offset=markedOffset=1, limit=4`
* @example `00|01 02 03` contains four bytes with `offset=limit=1, markedOffset=-1`
* @example `|` contains zero bytes with `offset=limit=0, markedOffset=-1`
*/
ByteBufferPrototype.toDebug = function(columns) {
var i = -1,
//? if (NODE)
k = this.buffer.length,
//? else
k = this.buffer.byteLength,
b,
hex = "",
asc = "",
out = "";
while (i<k) {
if (i !== -1) {
//? if (NODE)
b = this.buffer[i];
//? else if (DATAVIEW)
b = this.view.getUint8(i);
//? else
b = this.view[i];
if (b < 0x10) hex += "0"+b.toString(16).toUpperCase();
else hex += b.toString(16).toUpperCase();
if (columns)
asc += b > 32 && b < 127 ? String.fromCharCode(b) : '.';
}
++i;
if (columns) {
if (i > 0 && i % 16 === 0 && i !== k) {
while (hex.length < 3*16+3) hex += " ";
out += hex+asc+"\n";
hex = asc = "";
}
}
if (i === this.offset && i === this.limit)
hex += i === this.markedOffset ? "!" : "|";
else if (i === this.offset)
hex += i === this.markedOffset ? "[" : "<";
else if (i === this.limit)
hex += i === this.markedOffset ? "]" : ">";
else
hex += i === this.markedOffset ? "'" : (columns || (i !== 0 && i !== k) ? " " : "");
}
if (columns && hex !== " ") {
while (hex.length < 3*16+3)
hex += " ";
out += hex + asc + "\n";
}
return columns ? out : hex;
};
/**
* Decodes a hex encoded string with marked offsets to a ByteBuffer.
* @param {string} str Debug string to decode (not be generated with `columns = true`)
* @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
* {@link ByteBuffer.DEFAULT_ENDIAN}.
* @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
* {@link ByteBuffer.DEFAULT_NOASSERT}.
* @returns {!ByteBuffer} ByteBuffer
* @expose
* @see ByteBuffer#toDebug
*/
ByteBuffer.fromDebug = function(str, littleEndian, noAssert) {
/*?
// "<60 61 62 63>"; // 13 = 4
// "60<61 62]63" // 11 = 4
// "<61 61 61>"; // 10 = 3 => C = ((L+1)/3) | 0
// "61<61>61"; // 8 = 3
// "<61 61>"; // 7 = 2
*/
var k = str.length,
bb = new ByteBuffer(((k+1)/3)|0, littleEndian, noAssert);
var i = 0, j = 0, ch, b,
rs = false, // Require symbol next
ho = false, hm = false, hl = false, // Already has offset (ho), markedOffset (hm), limit (hl)?
fail = false;
while (i<k) {
switch (ch = str.charAt(i++)) {
case '!':
if (!noAssert) {
if (ho || hm || hl) {
fail = true;
break;
}
ho = hm = hl = true;
}
bb.offset = bb.markedOffset = bb.limit = j;
rs = false;
break;
case '|':
if (!noAssert) {
if (ho || hl) {
fail = true;
break;
}
ho = hl = true;
}
bb.offset = bb.limit = j;
rs = false;
break;
case '[':
if (!noAssert) {
if (ho || hm) {
fail = true;
break;
}
ho = hm = true;
}
bb.offset = bb.markedOffset = j;
rs = false;
break;
case '<':
if (!noAssert) {
if (ho) {
fail = true;
break;
}
ho = true;
}
bb.offset = j;
rs = false;
break;
case ']':
if (!noAssert) {
if (hl || hm) {
fail = true;
break;
}
hl = hm = true;
}
bb.limit = bb.markedOffset = j;
rs = false;
break;
case '>':
if (!noAssert) {
if (hl) {
fail = true;
break;
}
hl = true;
}
bb.limit = j;
rs = false;
break;
case "'":
if (!noAssert) {
if (hm) {
fail = true;
break;
}
hm = true;
}
bb.markedOffset = j;
rs = false;
break;
case ' ':
rs = false;
break;
default:
if (!noAssert) {
if (rs) {
fail = true;
break;
}
}
b = parseInt(ch+str.charAt(i++), 16);
if (!noAssert) {
if (isNaN(b) || b < 0 || b > 255)
throw TypeError("Illegal str: Not a debug encoded string");
}
//? if (NODE)
bb.buffer[j++] = b;
//? else if (DATAVIEW)
bb.view.setUint8(j++, b);
//? else
bb.view[j++] = b;
rs = true;
}
if (fail)
throw TypeError("Illegal str: Invalid symbol at "+i);
}
if (!noAssert) {
if (!ho || !hl)
throw TypeError("Illegal str: Missing offset or limit");
//? if (NODE)
if (j<bb.buffer.length)
//? else
if (j<bb.buffer.byteLength)
throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+j+" < "+k);
}
return bb;
};
//? }

75
node_modules/bytebuffer/src/encodings/hex.js generated vendored Normal file
View File

@ -0,0 +1,75 @@
//? if (HEX) {
// encodings/hex
/**
* Encodes this ByteBuffer's contents to a hex encoded string.
* @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
* @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
* @returns {string} Hex encoded string
* @expose
*/
ByteBufferPrototype.toHex = function(begin, end) {
begin = typeof begin === 'undefined' ? this.offset : begin;
end = typeof end === 'undefined' ? this.limit : end;
if (!this.noAssert) {
//? ASSERT_RANGE();
}
//? if (NODE)
return this.buffer.toString("hex", begin, end);
//? else {
var out = new Array(end - begin),
b;
while (begin < end) {
//? if (DATAVIEW)
b = this.view.getUint8(begin++);
//? else
b = this.view[begin++];
if (b < 0x10)
out.push("0", b.toString(16));
else out.push(b.toString(16));
}
return out.join('');
//? }
};
/**
* Decodes a hex encoded string to a ByteBuffer.
* @param {string} str String to decode
* @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
* {@link ByteBuffer.DEFAULT_ENDIAN}.
* @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
* {@link ByteBuffer.DEFAULT_NOASSERT}.
* @returns {!ByteBuffer} ByteBuffer
* @expose
*/
ByteBuffer.fromHex = function(str, littleEndian, noAssert) {
if (!noAssert) {
if (typeof str !== 'string')
throw TypeError("Illegal str: Not a string");
if (str.length % 2 !== 0)
throw TypeError("Illegal str: Length not a multiple of 2");
}
//? if (NODE) {
var bb = new ByteBuffer(0, littleEndian, true);
bb.buffer = new Buffer(str, "hex");
bb.limit = bb.buffer.length;
//? } else {
var k = str.length,
bb = new ByteBuffer((k / 2) | 0, littleEndian),
b;
for (var i=0, j=0; i<k; i+=2) {
b = parseInt(str.substring(i, i+2), 16);
if (!noAssert)
if (!isFinite(b) || b < 0 || b > 255)
throw TypeError("Illegal str: Contains non-hex characters");
//? if (DATAVIEW)
bb.view.setUint8(j++, b);
//? else
bb.view[j++] = b;
}
bb.limit = j;
//? }
return bb;
};
//? }

3
node_modules/bytebuffer/src/encodings/impl/base64.js generated vendored Normal file
View File

@ -0,0 +1,3 @@
// encodings/impl/base64
// TODO

65
node_modules/bytebuffer/src/encodings/impl/binary.js generated vendored Normal file
View File

@ -0,0 +1,65 @@
// encodings/impl/binary
/**
* Encodes a binary JavaScript string to bytes.
* @param {string} src Source string
* @param {number} srcOffset Source offset
* @param {!ByteBuffer} dst Destination ByteBuffer
* @param {number} dstOffset Destination offset
* @param {number} count Number of char codes to encode
* @returns {number} Number of bytes encoded
* @inner
*/
function binary_encode(src, srcOffset, dst, dstOffset, count) {
var n = 0;
while (count--) {
var cc = src.charCodeAt(srcOffset++);
if (cc > 255)
throw Error("illegal binary char code: "+cc);
//? SET('cc', 'dstOffset++', 'dst');
++n;
}
return n;
}
/**
* Decodes bytes to a binary JavaScript string.
* @param {!ByteBuffer} src Source ByteBuffer
* @param {number} srcOffset Source offset
* @param {number} count Number of bytes to decode
* @returns {string} Decoded string
* @inner
*/
function binary_decode(src, srcOffset, count) {
if (count === 0)
return "";
var parts = [], // readily assembled parts
batch = []; // char codes for batch processing
while (count--) {
batch.push(/*? GET('srcOffset++', 'src') */);
if (batch.length > 1023) {
parts.push(String.fromCharCode.apply(String, batch));
batch.length = 0;
}
}
if (batch.length > 0) {
if (parts.length === 0)
return String.fromCharCode.apply(String, batch);
parts.push(String.fromCharCode.apply(String, batch));
}
return parts.join('');
}
/**
* Calculates the number of bytes required to store a binary JavaScript string.
* @param {string} src Source string
* @param {number} srcOffset Source offset
* @param {number} count Number of char codes to calculate
* @returns {number} Number of bytes required
* @inner
*/
function binary_calculate(src, srcOffset, count) {
return count;
}
ByteBuffer.registerEncoding("binary", binary_encode, binary_decode, binary_calculate);

3
node_modules/bytebuffer/src/encodings/impl/debug.js generated vendored Normal file
View File

@ -0,0 +1,3 @@
// encodings/impl/debug
// TODO

101
node_modules/bytebuffer/src/encodings/impl/hex.js generated vendored Normal file
View File

@ -0,0 +1,101 @@
// encodings/impl/hex
/**
* Encodes a hexadecimal JavaScript string to bytes.
* @param {string} src Source string
* @param {number} srcOffset Source offset
* @param {!ByteBuffer} dst Destination ByteBuffer
* @param {number} dstOffset Destination offset
* @param {number} count Number of char codes to encode
* @returns {number} Number of bytes encoded
* @inner
*/
function hex_encode(src, srcOffset, dst, dstOffset, count) {
if (count === 0)
return 0;
var n = 0;
while (count--) {
if (count === 0)
throw Error("truncated hex sequence");
--count;
var value = 0,
shift = 0;
for (var i=0; i<2; ++i) {
var cc = src.charCodeAt(srcOffset++);
switch (cc) {
case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: case 0x38: case 0x39:
value |= (cc - 0x30) << shift;
break;
case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46:
value |= (cc - 0x4B) << shift;
break;
case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66:
value |= (cc - 0x6B) << shift;
break;
default:
throw Error("illegal hex char code: "+cc);
}
shift += 4;
}
//? SET('value', 'dstOffset++', 'dst');
++n;
}
return n;
}
/**
* Decodes bytes to a hexadecimal JavaScript string.
* @param {!ByteBuffer} src Source ByteBuffer
* @param {number} srcOffset Source offset
* @param {number} count Number of bytes to decode
* @returns {string} Decoded string
* @inner
*/
function hex_decode(src, srcOffset, count) {
if (count === 0)
return "";
var parts = [], // readily assembled parts
batch = []; // char codes for batch processing
while (count--) {
var value = /*? GET('srcOffset++', 'src') */,
shift = 4;
for (var i=0; i<2; ++i) {
var c = (value >>> shift) & 0xf;
switch (c) {
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9:
batch.push(0x30 + c);
break;
case 10: case 11: case 12: case 13: case 14: case 15:
batch.push(0x37 + c);
break;
}
shift = 0;
}
if (batch.length > 1023) {
parts.push(String.fromCharCode.apply(String, batch));
batch.length = 0;
}
}
if (batch.length > 0) {
if (parts.length === 0)
return String.fromCharCode.apply(String, batch);
parts.push(String.fromCharCode.apply(String, batch));
}
return parts.join('');
}
/**
* Calculates the number of bytes required to store a hexadecimal JavaScript string.
* @param {string} src Source string
* @param {number} srcOffset Source offset
* @param {number} count Number of char codes to calculate
* @returns {number} Number of bytes required
* @inner
*/
function hex_calculate(src, srcOffset, count) {
if ((count % 2) !== 0)
throw Error("illegal number of hex char codes: "+count);
return count / 2;
}
ByteBuffer.registerEncoding("hex", hex_encode, hex_decode, hex_calculate);

126
node_modules/bytebuffer/src/encodings/impl/utf8.js generated vendored Normal file
View File

@ -0,0 +1,126 @@
// encodings/impl/utf8
/**
* Encodes a standard JavaScript string to UTF8 bytes.
* @param {string} src Source string
* @param {number} srcOffset Source offset
* @param {!ByteBuffer} dst Destination ByteBuffer
* @param {number} dstOffset Destination offset
* @param {number} count Number of char codes to encode
* @returns {number} Number of bytes encoded
* @inner
*/
function utf8_encode(src, srcOffset, dst, dstOffset, count) {
if (count === 0)
return 0;
var n = 0;
//? // SET(varValue, varOffset, varTarget) with varTarget referencing a ByteBuffer
do {
var cc = src.charCodeAt(srcOffset++);
--count;
if (cc < 0x80) {
n += 1;
//? SET('cc', 'dstOffset++', 'dst');
} else if (cc < 0x800) {
n += 2;
//? SET('0xC0 | (cc >> 6)', 'dstOffset++', 'dst');
//? SET('0x80 | (cc & 0x3F)', 'dstOffset++', 'dst');
} else if (cc < 0xD800 || cc >= 0xE000) {
n += 3;
//? SET('0xE0 | (cc >> 12)', 'dstOffset++', 'dst');
//? SET('0x80 | ((cc >> 6) & 0x3F)', 'dstOffset++', 'dst');
//? SET('0x80 | (cc & 0x3F)', 'dstOffset++', 'dst');
} else { // surrogate
if (count === 0)
throw Error("truncated utf8 surrogate");
cc = 0x10000 + (((cc & 0x3FF) << 10) | (src.charCodeAt(srcOffset++) & 0x3FF));
--count;
n += 4;
//? SET('0xF0 | (cc >> 18)', 'dstOffset++', 'dst');
//? SET('0x80 | ((cc >> 12) & 0x3F)', 'dstOffset++', 'dst');
//? SET('0x80 | ((cc >> 6) & 0x3F)', 'dstOffset++', 'dst');
//? SET('0x80 | (cc & 0x3F)', 'dstOffset++', 'dst');
}
} while (count > 0);
return n;
}
/**
* Decodes UTF8 bytes to a standard JavaScript string.
* @param {!ByteBuffer} src Source ByteBuffer
* @param {number} srcOffset Source offset
* @param {number} count Number of bytes to decode
* @returns {string} Decoded string
* @inner
*/
function utf8_decode(src, srcOffset, count) {
if (count === 0)
return "";
var parts = [], // readily assembled parts
batch = []; // char codes for batch processing
//? // GET(varOffset, varTarget) with varTarget referencing a ByteBuffer
while (count--) {
var c = /*? GET('srcOffset++', 'src') */,
c2, c3;
switch (c >> 4) {
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
batch.push(c);
break;
case 12: case 13:
if (count < 1)
throw Error("truncated utf8 sequence");
c2 = /*? GET('srcOffset++', 'src') */;
--count;
batch.push(((c & 0x1F) << 6) | (c2 & 0x3F));
break;
case 14:
if (count < 2)
throw Error("truncated utf8 sequence");
c2 = /*? GET('srcOffset++', 'src') */;
c3 = /*? GET('srcOffset++', 'src') */;
count -= 2;
batch.push(((c & 0x0F) << 12) | ((c2 & 0x3F) << 6) | ((c3 & 0x3F) << 0));
break;
}
if (batch.length > 1023) {
parts.push(String.fromCharCode.apply(String, batch));
batch.length = 0;
}
}
if (batch.length > 0) {
if (parts.length === 0)
return String.fromCharCode.apply(String, batch);
parts.push(String.fromCharCode.apply(String, batch));
}
return parts.join('');
}
/**
* Calculates the number of UTF8 bytes required to store a standard JavaScript string.
* @param {string} src Source string
* @param {number} srcOffset Source offset
* @param {number} count Number of char codes to calculate
* @returns {number} Number of bytes required
* @inner
*/
function utf8_calculate(src, srcOffset, count) {
if (count === 0)
return 0;
var n = 0;
do {
var cc = src.charCodeAt(srcOffset++);
--count;
if (cc < 0x80) {
n += 1;
} else if (cc < 0x800) {
n += 2;
} else if (cc < 0xD800 || cc >= 0xE000) {
n += 3;
} else {
n += 4;
}
} while (count > 0);
return n;
}
ByteBuffer.registerEncoding("utf8", utf8_encode, utf8_decode, utf8_calculate);

71
node_modules/bytebuffer/src/encodings/utf8.js generated vendored Normal file
View File

@ -0,0 +1,71 @@
//? if (UTF8) {
// utfx-embeddable
//? include("../../node_modules/utfx/dist/utfx-embeddable.js");
// encodings/utf8
/**
* Encodes this ByteBuffer's contents between {@link ByteBuffer#offset} and {@link ByteBuffer#limit} to an UTF8 encoded
* string.
* @returns {string} Hex encoded string
* @throws {RangeError} If `offset > limit`
* @expose
*/
ByteBufferPrototype.toUTF8 = function(begin, end) {
if (typeof begin === 'undefined') begin = this.offset;
if (typeof end === 'undefined') end = this.limit;
if (!this.noAssert) {
//? ASSERT_RANGE();
}
//? if (NODE)
return this.buffer.toString("utf8", begin, end);
//? else {
var sd; try {
utfx.decodeUTF8toUTF16(function() {
//? if (DATAVIEW)
return begin < end ? this.view.getUint8(begin++) : null;
//? else
return begin < end ? this.view[begin++] : null;
}.bind(this), sd = stringDestination());
} catch (e) {
if (begin !== end)
throw RangeError("Illegal range: Truncated data, "+begin+" != "+end);
}
return sd();
//? }
};
/**
* Decodes an UTF8 encoded string to a ByteBuffer.
* @param {string} str String to decode
* @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
* {@link ByteBuffer.DEFAULT_ENDIAN}.
* @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
* {@link ByteBuffer.DEFAULT_NOASSERT}.
* @returns {!ByteBuffer} ByteBuffer
* @expose
*/
ByteBuffer.fromUTF8 = function(str, littleEndian, noAssert) {
if (!noAssert)
if (typeof str !== 'string')
throw TypeError("Illegal str: Not a string");
//? if (NODE) {
var bb = new ByteBuffer(0, littleEndian, noAssert);
bb.buffer = new Buffer(str, "utf8");
bb.limit = bb.buffer.length;
//? } else {
var bb = new ByteBuffer(utfx.calculateUTF16asUTF8(stringSource(str), true)[1], littleEndian, noAssert),
i = 0;
utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
//? if (DATAVIEW)
bb.view.setUint8(i++, b);
//? else
bb.view[i++] = b;
});
bb.limit = i;
//? }
return bb;
};
//? }

143
node_modules/bytebuffer/src/helpers.js generated vendored Normal file
View File

@ -0,0 +1,143 @@
// helpers
//? if (NODE) {
/**
* @type {!Buffer}
* @inner
*/
var EMPTY_BUFFER = new Buffer(0);
//? } else {
/**
* @type {!ArrayBuffer}
* @inner
*/
var EMPTY_BUFFER = new ArrayBuffer(0);
//? }
//? if (!INLINE) {
/**
* Asserts that a value is an integer and returns the type-safe value.
* @param {number} value Value to assert
* @param {boolean=} unsigned Whether explicitly unsigned
* @returns {number} Type-safe value
* @throws {TypeError} If `value` is not an integer
* @inner
*/
function assertInteger(value, unsigned) {
if (typeof value !== 'number' || value % 1 !== 0)
throw TypeError("Illegal value: "+offset+" (not an integer)");
return unsigned ? value >>> 0 : value | 0;
}
/**
* Asserts that a value is an integer or Long.
* @param {number|!Long} value Value to assert
* @param {boolean=} unsigned Whether explicitly unsigned
* @returns {number|!Long} Type-safe value
* @throws {TypeError} If `value` is not an integer or Long
* @inner
*/
function assertLong(value, unsigned) {
if (typeof value === 'number') {
return Long.fromNumber(value, unsigned);
} else if (typeof value === 'string') {
return Long.fromString(value, unsigned);
} else if (value && value instanceof Long) {
if (typeof unsigned !== 'undefined') {
if (unsigned && !value.unsigned) return value.toUnsigned();
if (!unsigned && value.unsigned) return value.toSigned();
}
return value;
} else
throw TypeError("Illegal value: "+value+" (not an integer or Long)");
}
/**
* Asserts that `min <= offset <= cap-size` and returns the type-safe offset.
* @param {number} offset Offset to assert
* @param {number} min Minimum offset
* @param {number} cap Cap offset
* @param {number} size Required size in bytes
* @returns {number} Type-safe offset
* @throws {TypeError} If `offset` is not an integer
* @throws {RangeError} If `offset < min || offset > cap-size`
* @inner
*/
function assertOffset(offset, min, cap, size) {
if (typeof offset !== 'number' || offset % 1 !== 0)
throw TypeError("Illegal offset: "+offset+" (not an integer)");
offset = offset | 0;
if (offset < min || offset > cap-size)
throw RangeError("Illegal offset: "+min+" <= "+value+" <= "+cap+"-"+size);
return offset;
}
/**
* assertRange return value.
* @type {Array.<number>}
*/
var rangeVal = new Array(2);
/**
* Asserts that `min <= begin <= end <= cap`. Updates `rangeVal` with the type-safe range.
* @param {number} begin Begin offset
* @param {number} end End offset
* @param {number} min Minimum offset
* @param {number} cap Cap offset
* @throws {TypeError} If `begin` or `end` is not an integer
* @throws {RangeError} If `begin < min || begin > end || end > cap`
* @inner
*/
function assertRange(begin, end, min, cap) {
if (typeof begin !== 'number' || begin % 1 !== 0)
throw TypeError("Illegal begin: "+begin+" (not a number)");
begin = begin | 0;
if (typeof end !== 'number' || end % 1 !== 0)
throw TypeError("Illegal end: "+range[1]+" (not a number)");
end = end | 0;
if (begin < min || begin > end || end > cap)
throw RangeError("Illegal range: "+min+" <= "+begin+" <= "+end+" <= "+cap);
rangeVal[0] = begin; rangeVal[1] = end;
}
//? }
//? if (BASE64 || UTF8) {
/**
* String.fromCharCode reference for compile-time renaming.
* @type {function(...number):string}
* @inner
*/
var stringFromCharCode = String.fromCharCode;
/**
* Creates a source function for a string.
* @param {string} s String to read from
* @returns {function():number|null} Source function returning the next char code respectively `null` if there are
* no more characters left.
* @throws {TypeError} If the argument is invalid
* @inner
*/
function stringSource(s) {
var i=0; return function() {
return i < s.length ? s.charCodeAt(i++) : null;
};
}
/**
* Creates a destination function for a string.
* @returns {function(number=):undefined|string} Destination function successively called with the next char code.
* Returns the final string when called without arguments.
* @inner
*/
function stringDestination() {
var cs = [], ps = []; return function() {
if (arguments.length === 0)
return ps.join('')+stringFromCharCode.apply(String, cs);
if (cs.length + arguments.length > 1024)
ps.push(stringFromCharCode.apply(String, cs)),
cs.length = 0;
Array.prototype.push.apply(cs, arguments);
};
}
//? }

222
node_modules/bytebuffer/src/macros.js generated vendored Normal file
View File

@ -0,0 +1,222 @@
//?...
// Welcome to the crazy world of MetaScript! Tell it what you need, it will not moan, and there it is.
// Substitute for the backing buffer's capacity
CAPACITY = NODE ? 'this.buffer.length' : 'this.buffer.byteLength';
// Asserts that a variable is an integer
ASSERT_INTEGER = function(varValue, unsigned) {
if (VERBOSE_MS) writeln(__+'// <ASSERT_INTEGER>');
if (INLINE) {
writeln(__+'if (typeof '+varValue+' !== \'number\' || '+varValue+' % 1 !== 0)');
writeln(__+' throw TypeError("Illegal '+varValue+': "+'+varValue+'+" (not an integer)");');
writeln(__+varValue+' '+(unsigned ? '>>>' : '|')+'= 0;');
} else {
writeln(__+varValue+' = assertInteger('+varValue+(typeof unsigned !== 'undefined' ? ', '+unsigned : '')+');');
}
if (VERBOSE_MS) writeln(__+'// </ASSERT_INTEGER>');
};
// Asserts that a variable is a number or Long
ASSERT_LONG = function(varValue, unsigned) {
if (typeof varValue === 'undefined') varValue = 'value';
if (VERBOSE_MS) writeln(__+'// <ASSERT_LONG>');
if (INLINE) {
writeln(__+'if (typeof '+varValue+' === \'number\')');
writeln(__+' '+varValue+' = Long.fromNumber('+varValue+');');
writeln(__+'else if (typeof '+varValue+' === \'string\')');
writeln(__+' '+varValue+' = Long.fromString('+varValue+');');
if (typeof unsigned !== 'undefined') { // When explicitly specified only
writeln(__+'else if ('+varValue+' && '+varValue+' instanceof Long)');
if (unsigned) {
writeln(__+' if (!'+varValue+'.unsigned) '+varValue+' = '+varValue+'.toUnsigned();');
} else {
writeln(__+' if ('+varValue+'.unsigned) '+varValue+' = '+varValue+'.toSigned();');
}
writeln(__+'else');
} else {
writeln(__+'else if (!('+varValue+' && '+varValue+' instanceof Long))');
}
writeln(__+' throw TypeError("Illegal '+varValue+': "+'+varValue+'+" (not an integer or Long)");');
} else {
writeln(__+varValue+' = assertLong('+varValue+(typeof unsigned !== 'undefined' ? ', '+unsigned : '')+');');
}
if (VERBOSE_MS) writeln(__+'// </ASSERT_LONG>');
};
// Casts a variable to a Long if necessary
LONG = function(varValue, unsigned) {
if (typeof varValue === 'undefined') varValue = 'value';
if (VERBOSE_MS) writeln(__+'// <LONG'+(typeof unsigned === 'boolean' ? ' unsigned='+unsigned : '')+'>');
writeln(__+'if (typeof '+varValue+' === \'number\')');
writeln(__+' '+varValue+' = Long.fromNumber('+varValue+(typeof unsigned === 'boolean' ? ', '+unsigned : '')+');');
writeln(__+'else if (typeof '+varValue+' === \'string\')');
writeln(__+' '+varValue+' = Long.fromString('+varValue+(typeof unsigned === 'boolean' ? ', '+unsigned : '')+');');
if (typeof unsigned === 'boolean') {
writeln(__+'else if ('+varValue+'.unsigned !== '+unsigned+') '+varValue+' = '+varValue+'.'+(unsigned ? 'toUnsigned' : 'toSigned')+'();');
}
if (VERBOSE_MS) writeln(__+'// </LONG>');
};
// Asserts that an offset is valid
ASSERT_OFFSET = function(size, varOffset) {
if (typeof size === 'undefined') size = 0;
if (typeof varOffset === 'undefined') varOffset = 'offset';
if (VERBOSE_MS) writeln(__+'// <ASSERT_OFFSET>');
if (INLINE) {
writeln(__+'if (typeof '+varOffset+' !== \'number\' || '+varOffset+' % 1 !== 0)');
writeln(__+' throw TypeError("Illegal '+varOffset+': "+'+varOffset+'+" (not an integer)");');
writeln(__+varOffset+' >>>= 0;');
writeln(__+'if ('+varOffset+' < 0 || '+varOffset+' + '+size+' > '+CAPACITY+')');
writeln(__+' throw RangeError("Illegal '+varOffset+': 0 <= "+'+varOffset+'+" (+"+'+size+'+") <= "+'+CAPACITY+');');
} else {
writeln(__+varOffset+' = assertOffset('+varOffset+', 0, '+CAPACITY+', '+size+');');
}
if (VERBOSE_MS) writeln(__+'// </ASSERT_OFFSET>');
};
// Asserts that a range is valid
ASSERT_RANGE = function(varBegin, varEnd) {
if (typeof varBegin === 'undefined') varBegin = 'begin';
if (typeof varEnd === 'undefined') varEnd = 'end';
if (VERBOSE_MS) writeln(__+'// <ASSERT_RANGE>');
if (INLINE) {
writeln(__+'if (typeof '+varBegin+' !== \'number\' || '+varBegin+' % 1 !== 0)');
writeln(__+' throw TypeError("Illegal '+varBegin+': Not an integer");');
writeln(__+varBegin+' >>>= 0;');
writeln(__+'if (typeof '+varEnd+' !== \'number\' || '+varEnd+' % 1 !== 0)');
writeln(__+' throw TypeError("Illegal '+varEnd+': Not an integer");');
writeln(__+varEnd+' >>>= 0;');
writeln(__+'if ('+varBegin+' < 0 || '+varBegin+' > '+varEnd+' || '+varEnd+' > '+CAPACITY+')');
writeln(__+' throw RangeError("Illegal range: 0 <= "+'+varBegin+'+" <= "+'+varEnd+'+" <= "+'+CAPACITY+');');
} else {
writeln(__+'assertRange('+varBegin+', '+varEnd+', 0, '+CAPACITY+');');
writeln(__+varBegin+' = rangeVal[0]; '+varEnd+' = rangeVal[1];');
}
if (VERBOSE_MS) writeln(__+'// </ASSERT_RANGE>');
};
// ENSURE_CAPACITY counter in case that multiple calls are used in a single method
var ECN = 0;
// Ensures that a ByteBuffer is backed by a buffer that takes `size` additional capacity
ENSURE_CAPACITY = function(size, varOffset) {
if (typeof varOffset === 'undefined') varOffset = 'offset';
if (VERBOSE_MS) writeln(__+'// <ENSURE_CAPACITY size='+size+'>');
if (INLINE) {
writeln(__+varOffset+' += '+size+';');
writeln(__+'var capacity'+ECN+' = '+CAPACITY+';');
writeln(__+'if ('+varOffset+' > capacity'+ECN+')');
writeln(__+' this.resize((capacity'+ECN+' *= 2) > '+varOffset+' ? capacity'+ECN+' : '+varOffset+');');
writeln(__+varOffset+' -= '+size+';');
} else {
writeln(__+'this.ensureCapacity('+varOffset+'+'+size+');');
}
if (VERBOSE_MS) writeln(__+'// </ENSURE_CAPACITY>');
++ECN;
};
// Sets up a relative operation if `size` is omitted, else increases offset by `size`
RELATIVE = function(size, varOffset, varRelOffset) {
if (VERBOSE_MS) writeln(__+'// <RELATIVE'+(typeof size !== 'undefined' ? ' size='+size : '')+'>');
if (typeof size === 'undefined') {
if (typeof varOffset === 'undefined') varOffset = "offset";
if (typeof varRelOffset === 'undefined') varRelOffset = "this.offset";
writeln(__+'var relative = typeof '+varOffset+' === \'undefined\';');
writeln(__+'if (relative) '+varOffset+' = '+varRelOffset+';');
} else {
if (typeof varOffset === 'undefined') varOffset = "this.offset";
writeln(__+'if (relative) this.offset += '+size+';');
}
if (VERBOSE_MS) writeln(__+'// </RELATIVE>');
};
// Reads an uint32 from an array
READ_UINT32_ARRAY = function(varValue, varOffset, varTarget, varEndian) {
if (typeof varValue === 'undefined') varValue = 'value';
if (typeof varOffset === 'undefined') varOffset = 'offset';
if (typeof varTarget === 'undefined') varTarget = NODE ? 'this.buffer' : 'this.view';
var ____ = typeof varEndian !== 'boolean' ? ' ' : '';
if (VERBOSE_MS) writeln(__+'// <READ_UINT32'+(typeof varEndian === 'boolean' ? ' le='+varEndian : '')+'>');
if (NODE || !DATAVIEW) {
if (typeof varEndian !== 'boolean')
writeln(__+'if ('+(varEndian || 'this.littleEndian')+') {');
if (typeof varEndian !== 'boolean' || varEndian === true) {
writeln(__+____+varValue+' = '+varTarget+'['+varOffset+'+2] << 16;');
writeln(__+____+varValue+' |= '+varTarget+'['+varOffset+'+1] << 8;');
writeln(__+____+varValue+' |= '+varTarget+'['+varOffset+' ];');
writeln(__+____+varValue+' += '+varTarget+'['+varOffset+'+3] << 24 >>> 0;');
}
if (typeof varEndian !== 'boolean')
writeln(__+'} else {');
if (typeof varEndian !== 'boolean' || varEndian === false) {
writeln(__+____+varValue+' = '+varTarget+'['+varOffset+'+1] << 16;');
writeln(__+____+varValue+' |= '+varTarget+'['+varOffset+'+2] << 8;');
writeln(__+____+varValue+' |= '+varTarget+'['+varOffset+'+3];');
writeln(__+____+varValue+' += '+varTarget+'['+varOffset+' ] << 24 >>> 0;');
}
if (typeof varEndian !== 'boolean')
writeln(__+'}');
} else {
writeln(__+varTarget+'.getUint32('+varOffset+', '+varEndian+');');
}
if (VERBOSE_MS) writeln(__+'// </READ_UINT32>');
};
// Writes an uint32 to an array
WRITE_UINT32_ARRAY = function(varValue, varOffset, varTarget, varEndian) {
if (typeof varValue === 'undefined') varValue = 'value';
if (typeof varOffset === 'undefined') varOffset = 'offset';
if (typeof varTarget === 'undefined') varTarget = NODE ? 'this.buffer' : 'this.view';
var ____ = typeof varEndian !== 'boolean' ? ' ' : '';
if (VERBOSE_MS) writeln(__+'// <WRITE_UINT32'+(typeof varEndian === 'boolean' ? ' le='+varEndian : '')+'>');
if (NODE || !DATAVIEW) {
if (typeof varEndian !== 'boolean')
writeln(__+'if ('+(varEndian || 'this.littleEndian')+') {');
if (typeof varEndian !== 'boolean' || varEndian === true) {
writeln(__+____+varTarget+'['+varOffset+'+3] = ('+varValue+' >>> 24) & 0xFF;');
writeln(__+____+varTarget+'['+varOffset+'+2] = ('+varValue+' >>> 16) & 0xFF;');
writeln(__+____+varTarget+'['+varOffset+'+1] = ('+varValue+' >>> 8) & 0xFF;');
writeln(__+____+varTarget+'['+varOffset+' ] = '+varValue+' & 0xFF;');
}
if (typeof varEndian !== 'boolean')
writeln(__+'} else {');
if (typeof varEndian !== 'boolean' || varEndian === false) {
writeln(__+____+varTarget+'['+varOffset+' ] = ('+varValue+' >>> 24) & 0xFF;');
writeln(__+____+varTarget+'['+varOffset+'+1] = ('+varValue+' >>> 16) & 0xFF;');
writeln(__+____+varTarget+'['+varOffset+'+2] = ('+varValue+' >>> 8) & 0xFF;');
writeln(__+____+varTarget+'['+varOffset+'+3] = '+varValue+' & 0xFF;');
}
if (typeof varEndian !== 'boolean')
writeln(__+'}');
} else {
writeln(__+varTarget+'.setUint32('+varValue+', '+varOffset+', '+varEndian+');');
}
if (VERBOSE_MS) writeln(__+'// </WRITE_UINT32>');
};
SET = function(varValue, varOffset, varTarget) { // with varTarget referencing a ByteBuffer
if (typeof varValue === 'undefined') varValue = 'value';
if (typeof varOffset === 'undefined') varOffset = 'offset';
if (typeof varTarget === 'undefined') varTarget = 'this';
if (NODE) {
writeln(__+varTarget+'.buffer['+varOffset+'] = '+varValue+';');
} else if (DATAVIEW) {
writeln(__+varTarget+'.view.setUint8('+varValue+', '+varOffset+');');
} else {
writeln(__+varTarget+'.view['+varOffset+'] = '+varValue+';');
}
};
GET = function(varOffset, varTarget) { // with varTarget referencing a ByteBuffer
if (typeof varOffset === 'undefined') varOffset = 'offset';
if (typeof varTarget === 'undefined') varTarget = 'this';
if (NODE) {
write(varTarget+'.buffer['+varOffset+']');
} else if (DATAVIEW) {
write(varTarget+'.view.getUint8('+varOffset+')');
} else {
write(varTarget+'.view['+varOffset+']');
}
};
//?.

58
node_modules/bytebuffer/src/methods/append.js generated vendored Normal file
View File

@ -0,0 +1,58 @@
/**
* Appends some data to this ByteBuffer. This will overwrite any contents behind the specified offset up to the appended
* data's length.
//? if (NODE) {
* @param {!ByteBuffer|!Buffer|!ArrayBuffer|!Uint8Array|string} source Data to append. If `source` is a ByteBuffer, its
* offsets will be modified according to the performed read operation.
//? } else {
* @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to append. If `source` is a ByteBuffer, its offsets
* will be modified according to the performed read operation.
//? }
* @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
* @param {number=} offset Offset to append at. Will use and increase {@link ByteBuffer#offset} by the number of bytes
* written if omitted.
* @returns {!ByteBuffer} this
* @expose
* @example A relative `<01 02>03.append(<04 05>)` will result in `<01 02 04 05>, 04 05|`
* @example An absolute `<01 02>03.append(04 05>, 1)` will result in `<01 04>05, 04 05|`
*/
ByteBufferPrototype.append = function(source, encoding, offset) {
if (typeof encoding === 'number' || typeof encoding !== 'string') {
offset = encoding;
encoding = undefined;
}
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_OFFSET();
}
if (!(source instanceof ByteBuffer))
source = ByteBuffer.wrap(source, encoding);
var length = source.limit - source.offset;
if (length <= 0) return this; // Nothing to append
//? ENSURE_CAPACITY('length');
//? if (NODE)
source.buffer.copy(this.buffer, offset, source.offset, source.limit);
//? else if (DATAVIEW)
new Uint8Array(this.buffer, offset).set(new Uint8Array(source.buffer).subarray(source.offset, source.limit));
//? else
this.view.set(source.view.subarray(source.offset, source.limit), offset);
source.offset += length;
//? RELATIVE('length');
return this;
};
/**
* Appends this ByteBuffer's contents to another ByteBuffer. This will overwrite any contents at and after the
specified offset up to the length of this ByteBuffer's data.
* @param {!ByteBuffer} target Target ByteBuffer
* @param {number=} offset Offset to append to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
* read if omitted.
* @returns {!ByteBuffer} this
* @expose
* @see ByteBuffer#append
*/
ByteBufferPrototype.appendTo = function(target, offset) {
target.append(this, offset);
return this;
};

12
node_modules/bytebuffer/src/methods/assert.js generated vendored Normal file
View File

@ -0,0 +1,12 @@
/**
* Enables or disables assertions of argument types and offsets. Assertions are enabled by default but you can opt to
* disable them if your code already makes sure that everything is valid.
* @param {boolean} assert `true` to enable assertions, otherwise `false`
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.assert = function(assert) {
this.noAssert = !assert;
return this;
};

8
node_modules/bytebuffer/src/methods/capacity.js generated vendored Normal file
View File

@ -0,0 +1,8 @@
/**
* Gets the capacity of this ByteBuffer's backing buffer.
* @returns {number} Capacity of the backing buffer
* @expose
*/
ByteBufferPrototype.capacity = function() {
return /*?= CAPACITY */;
};

13
node_modules/bytebuffer/src/methods/clear.js generated vendored Normal file
View File

@ -0,0 +1,13 @@
/**
* Clears this ByteBuffer's offsets by setting {@link ByteBuffer#offset} to `0` and {@link ByteBuffer#limit} to the
* backing buffer's capacity. Discards {@link ByteBuffer#markedOffset}.
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.clear = function() {
this.offset = 0;
this.limit = /*?= CAPACITY */;
this.markedOffset = -1;
return this;
};

34
node_modules/bytebuffer/src/methods/clone.js generated vendored Normal file
View File

@ -0,0 +1,34 @@
/**
* Creates a cloned instance of this ByteBuffer, preset with this ByteBuffer's values for {@link ByteBuffer#offset},
* {@link ByteBuffer#markedOffset} and {@link ByteBuffer#limit}.
* @param {boolean=} copy Whether to copy the backing buffer or to return another view on the same, defaults to `false`
* @returns {!ByteBuffer} Cloned instance
* @expose
*/
ByteBufferPrototype.clone = function(copy) {
var bb = new ByteBuffer(0, this.littleEndian, this.noAssert);
if (copy) {
//? if (NODE) {
var buffer = new Buffer(this.buffer.length);
this.buffer.copy(buffer);
bb.buffer = buffer;
//? } else {
bb.buffer = new ArrayBuffer(this.buffer.byteLength);
//? if (DATAVIEW) {
new Uint8Array(bb.buffer).set(this.buffer);
bb.view = new DataView(bb.buffer);
//? } else {
bb.view = new Uint8Array(bb.buffer);
//? }
//? }
} else {
bb.buffer = this.buffer;
//? if (!NODE)
bb.view = this.view;
}
bb.offset = this.offset;
bb.markedOffset = this.markedOffset;
bb.limit = this.limit;
return bb;
};

49
node_modules/bytebuffer/src/methods/compact.js generated vendored Normal file
View File

@ -0,0 +1,49 @@
/**
* Compacts this ByteBuffer to be backed by a {@link ByteBuffer#buffer} of its contents' length. Contents are the bytes
* between {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. Will set `offset = 0` and `limit = capacity` and
* adapt {@link ByteBuffer#markedOffset} to the same relative position if set.
* @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
* @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.compact = function(begin, end) {
if (typeof begin === 'undefined') begin = this.offset;
if (typeof end === 'undefined') end = this.limit;
if (!this.noAssert) {
//? ASSERT_RANGE();
}
if (begin === 0 && end === /*?= CAPACITY */)
return this; // Already compacted
var len = end - begin;
if (len === 0) {
this.buffer = EMPTY_BUFFER;
//? if (!NODE)
this.view = null;
if (this.markedOffset >= 0) this.markedOffset -= begin;
this.offset = 0;
this.limit = 0;
return this;
}
//? if (NODE) {
var buffer = new Buffer(len);
this.buffer.copy(buffer, 0, begin, end);
this.buffer = buffer;
//? } else if (DATAVIEW) {
var buffer = new ArrayBuffer(len);
new Uint8Array(buffer).set(new Uint8Array(this.buffer).subarray(begin, end));
this.buffer = buffer;
this.view = new DataView(buffer);
//? } else {
var buffer = new ArrayBuffer(len);
var view = new Uint8Array(buffer);
view.set(this.view.subarray(begin, end));
this.buffer = buffer;
this.view = view;
//? }
if (this.markedOffset >= 0) this.markedOffset -= begin;
this.offset = 0;
this.limit = len;
return this;
};

73
node_modules/bytebuffer/src/methods/copy.js generated vendored Normal file
View File

@ -0,0 +1,73 @@
/**
* Creates a copy of this ByteBuffer's contents. Contents are the bytes between {@link ByteBuffer#offset} and
* {@link ByteBuffer#limit}.
* @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
* @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
* @returns {!ByteBuffer} Copy
* @expose
*/
ByteBufferPrototype.copy = function(begin, end) {
if (typeof begin === 'undefined') begin = this.offset;
if (typeof end === 'undefined') end = this.limit;
if (!this.noAssert) {
//? ASSERT_RANGE();
}
if (begin === end)
return new ByteBuffer(0, this.littleEndian, this.noAssert);
var capacity = end - begin,
bb = new ByteBuffer(capacity, this.littleEndian, this.noAssert);
bb.offset = 0;
bb.limit = capacity;
if (bb.markedOffset >= 0) bb.markedOffset -= begin;
this.copyTo(bb, 0, begin, end);
return bb;
};
/**
* Copies this ByteBuffer's contents to another ByteBuffer. Contents are the bytes between {@link ByteBuffer#offset} and
* {@link ByteBuffer#limit}.
* @param {!ByteBuffer} target Target ByteBuffer
* @param {number=} targetOffset Offset to copy to. Will use and increase the target's {@link ByteBuffer#offset}
* by the number of bytes copied if omitted.
* @param {number=} sourceOffset Offset to start copying from. Will use and increase {@link ByteBuffer#offset} by the
* number of bytes copied if omitted.
* @param {number=} sourceLimit Offset to end copying from, defaults to {@link ByteBuffer#limit}
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.copyTo = function(target, targetOffset, sourceOffset, sourceLimit) {
var relative,
targetRelative;
if (!this.noAssert) {
if (!ByteBuffer.isByteBuffer(target))
throw TypeError("Illegal target: Not a ByteBuffer");
}
targetOffset = (targetRelative = typeof targetOffset === 'undefined') ? target.offset : targetOffset | 0;
sourceOffset = (relative = typeof sourceOffset === 'undefined') ? this.offset : sourceOffset | 0;
sourceLimit = typeof sourceLimit === 'undefined' ? this.limit : sourceLimit | 0;
//? var TARGET_CAPACITY = NODE ? 'target.buffer.length' : 'target.buffer.byteLength';
if (targetOffset < 0 || targetOffset > /*?= TARGET_CAPACITY */)
throw RangeError("Illegal target range: 0 <= "+targetOffset+" <= "+/*?= TARGET_CAPACITY */);
if (sourceOffset < 0 || sourceLimit > /*?= CAPACITY */)
throw RangeError("Illegal source range: 0 <= "+sourceOffset+" <= "+/*?= CAPACITY */);
var len = sourceLimit - sourceOffset;
if (len === 0)
return target; // Nothing to copy
target.ensureCapacity(targetOffset + len);
//? if (NODE)
this.buffer.copy(target.buffer, targetOffset, sourceOffset, sourceLimit);
//? else if (DATAVIEW)
new Uint8Array(target.buffer).set(new Uint8Array(this.buffer).subarray(sourceOffset, sourceLimit), targetOffset);
//? else
target.view.set(this.view.subarray(sourceOffset, sourceLimit), targetOffset);
if (relative) this.offset += len;
if (targetRelative) target.offset += len;
return this;
};

15
node_modules/bytebuffer/src/methods/ensureCapacity.js generated vendored Normal file
View File

@ -0,0 +1,15 @@
/**
* Makes sure that this ByteBuffer is backed by a {@link ByteBuffer#buffer} of at least the specified capacity. If the
* current capacity is exceeded, it will be doubled. If double the current capacity is less than the required capacity,
* the required capacity will be used instead.
* @param {number} capacity Required capacity
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.ensureCapacity = function(capacity) {
var current = /*?= CAPACITY */;
if (current < capacity)
return this.resize((current *= 2) > capacity ? current : capacity);
return this;
};

35
node_modules/bytebuffer/src/methods/fill.js generated vendored Normal file
View File

@ -0,0 +1,35 @@
/**
* Overwrites this ByteBuffer's contents with the specified value. Contents are the bytes between
* {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
* @param {number|string} value Byte value to fill with. If given as a string, the first character is used.
* @param {number=} begin Begin offset. Will use and increase {@link ByteBuffer#offset} by the number of bytes
* written if omitted. defaults to {@link ByteBuffer#offset}.
* @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
* @returns {!ByteBuffer} this
* @expose
* @example `someByteBuffer.clear().fill(0)` fills the entire backing buffer with zeroes
*/
ByteBufferPrototype.fill = function(value, begin, end) {
//? RELATIVE(undefined, 'begin');
if (typeof value === 'string' && value.length > 0)
value = value.charCodeAt(0);
if (typeof begin === 'undefined') begin = this.offset;
if (typeof end === 'undefined') end = this.limit;
if (!this.noAssert) {
//? ASSERT_INTEGER('value');
//? ASSERT_RANGE();
}
if (begin >= end)
return this; // Nothing to fill
//? if (NODE) {
this.buffer.fill(value, begin, end);
begin = end;
//? } else if (DATAVIEW) {
while (begin < end) this.view.setUint8(begin++, value);
//? } else {
while (begin < end) this.view[begin++] = value;
//? }
if (relative) this.offset = begin;
return this;
};

11
node_modules/bytebuffer/src/methods/flip.js generated vendored Normal file
View File

@ -0,0 +1,11 @@
/**
* Makes this ByteBuffer ready for a new sequence of write or relative read operations. Sets `limit = offset` and
* `offset = 0`. Make sure always to flip a ByteBuffer when all relative read or write operations are complete.
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.flip = function() {
this.limit = this.offset;
this.offset = 0;
return this;
};

17
node_modules/bytebuffer/src/methods/mark.js generated vendored Normal file
View File

@ -0,0 +1,17 @@
/**
* Marks an offset on this ByteBuffer to be used later.
* @param {number=} offset Offset to mark. Defaults to {@link ByteBuffer#offset}.
* @returns {!ByteBuffer} this
* @throws {TypeError} If `offset` is not a valid number
* @throws {RangeError} If `offset` is out of bounds
* @see ByteBuffer#reset
* @expose
*/
ByteBufferPrototype.mark = function(offset) {
offset = typeof offset === 'undefined' ? this.offset : offset;
if (!this.noAssert) {
//? ASSERT_OFFSET();
}
this.markedOffset = offset;
return this;
};

36
node_modules/bytebuffer/src/methods/order.js generated vendored Normal file
View File

@ -0,0 +1,36 @@
/**
* Sets the byte order.
* @param {boolean} littleEndian `true` for little endian byte order, `false` for big endian
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.order = function(littleEndian) {
if (!this.noAssert) {
if (typeof littleEndian !== 'boolean')
throw TypeError("Illegal littleEndian: Not a boolean");
}
this.littleEndian = !!littleEndian;
return this;
};
/**
* Switches (to) little endian byte order.
* @param {boolean=} littleEndian Defaults to `true`, otherwise uses big endian
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.LE = function(littleEndian) {
this.littleEndian = typeof littleEndian !== 'undefined' ? !!littleEndian : true;
return this;
};
/**
* Switches (to) big endian byte order.
* @param {boolean=} bigEndian Defaults to `true`, otherwise uses little endian
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.BE = function(bigEndian) {
this.littleEndian = typeof bigEndian !== 'undefined' ? !bigEndian : false;
return this;
};

87
node_modules/bytebuffer/src/methods/prepend.js generated vendored Normal file
View File

@ -0,0 +1,87 @@
/**
* Prepends some data to this ByteBuffer. This will overwrite any contents before the specified offset up to the
* prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
* will be resized and its contents moved accordingly.
//? if (NODE) {
* @param {!ByteBuffer|string||!Buffer} source Data to prepend. If `source` is a ByteBuffer, its offset will be modified
* according to the performed read operation.
//? } else {
* @param {!ByteBuffer|string|!ArrayBuffer} source Data to prepend. If `source` is a ByteBuffer, its offset will be
* modified according to the performed read operation.
//? }
* @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
* @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
* prepended if omitted.
* @returns {!ByteBuffer} this
* @expose
* @example A relative `00<01 02 03>.prepend(<04 05>)` results in `<04 05 01 02 03>, 04 05|`
* @example An absolute `00<01 02 03>.prepend(<04 05>, 2)` results in `04<05 02 03>, 04 05|`
*/
ByteBufferPrototype.prepend = function(source, encoding, offset) {
if (typeof encoding === 'number' || typeof encoding !== 'string') {
offset = encoding;
encoding = undefined;
}
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_OFFSET();
}
if (!(source instanceof ByteBuffer))
source = ByteBuffer.wrap(source, encoding);
var len = source.limit - source.offset;
if (len <= 0) return this; // Nothing to prepend
var diff = len - offset;
if (diff > 0) { // Not enough space before offset, so resize + move
//? if (NODE) {
var buffer = new Buffer(this.buffer.length + diff);
this.buffer.copy(buffer, len, offset, this.buffer.length);
this.buffer = buffer;
//? } else if (DATAVIEW) {
var buffer = new ArrayBuffer(this.buffer.byteLength + diff);
var arrayView = new Uint8Array(buffer);
arrayView.set(new Uint8Array(this.buffer).subarray(offset, this.buffer.byteLength), len);
this.buffer = buffer;
this.view = new DataView(buffer);
//? } else {
var buffer = new ArrayBuffer(this.buffer.byteLength + diff);
var view = new Uint8Array(buffer);
view.set(this.view.subarray(offset, this.buffer.byteLength), len);
this.buffer = buffer;
this.view = view;
//? }
this.offset += diff;
if (this.markedOffset >= 0) this.markedOffset += diff;
this.limit += diff;
offset += diff;
}/*? if (!NODE) { */ else {
var arrayView = new Uint8Array(this.buffer);
}
//? }
//? if (NODE)
source.buffer.copy(this.buffer, offset - len, source.offset, source.limit);
//? else if (DATAVIEW)
arrayView.set(new Uint8Array(source.buffer).subarray(source.offset, source.limit), offset - len);
//? else
this.view.set(source.view.subarray(source.offset, source.limit), offset - len);
source.offset = source.limit;
if (relative)
this.offset -= len;
return this;
};
/**
* Prepends this ByteBuffer to another ByteBuffer. This will overwrite any contents before the specified offset up to the
* prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
* will be resized and its contents moved accordingly.
* @param {!ByteBuffer} target Target ByteBuffer
* @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
* prepended if omitted.
* @returns {!ByteBuffer} this
* @expose
* @see ByteBuffer#prepend
*/
ByteBufferPrototype.prependTo = function(target, offset) {
target.prepend(this, offset);
return this;
};

16
node_modules/bytebuffer/src/methods/printDebug.js generated vendored Normal file
View File

@ -0,0 +1,16 @@
//? if (DEBUG) {
/**
* Prints debug information about this ByteBuffer's contents.
* @param {function(string)=} out Output function to call, defaults to console.log
* @expose
*/
ByteBufferPrototype.printDebug = function(out) {
if (typeof out !== 'function') out = console.log.bind(console);
out(
this.toString()+"\n"+
"-------------------------------------------------------------------\n"+
this.toDebug(/* columns */ true)
);
};
//? }

9
node_modules/bytebuffer/src/methods/remaining.js generated vendored Normal file
View File

@ -0,0 +1,9 @@
/**
* Gets the number of remaining readable bytes. Contents are the bytes between {@link ByteBuffer#offset} and
* {@link ByteBuffer#limit}, so this returns `limit - offset`.
* @returns {number} Remaining readable bytes. May be negative if `offset > limit`.
* @expose
*/
ByteBufferPrototype.remaining = function() {
return this.limit - this.offset;
};

17
node_modules/bytebuffer/src/methods/reset.js generated vendored Normal file
View File

@ -0,0 +1,17 @@
/**
* Resets this ByteBuffer's {@link ByteBuffer#offset}. If an offset has been marked through {@link ByteBuffer#mark}
* before, `offset` will be set to {@link ByteBuffer#markedOffset}, which will then be discarded. If no offset has been
* marked, sets `offset = 0`.
* @returns {!ByteBuffer} this
* @see ByteBuffer#mark
* @expose
*/
ByteBufferPrototype.reset = function() {
if (this.markedOffset >= 0) {
this.offset = this.markedOffset;
this.markedOffset = -1;
} else {
this.offset = 0;
}
return this;
};

39
node_modules/bytebuffer/src/methods/resize.js generated vendored Normal file
View File

@ -0,0 +1,39 @@
/**
* Resizes this ByteBuffer to be backed by a buffer of at least the given capacity. Will do nothing if already that
* large or larger.
* @param {number} capacity Capacity required
* @returns {!ByteBuffer} this
* @throws {TypeError} If `capacity` is not a number
* @throws {RangeError} If `capacity < 0`
* @expose
*/
ByteBufferPrototype.resize = function(capacity) {
if (!this.noAssert) {
//? ASSERT_INTEGER('capacity');
if (capacity < 0)
throw RangeError("Illegal capacity: 0 <= "+capacity);
}
//? if (NODE) {
if (this.buffer.length < capacity) {
var buffer = new Buffer(capacity);
this.buffer.copy(buffer);
this.buffer = buffer;
}
//? } else {
if (this.buffer.byteLength < capacity) {
//? if (DATAVIEW) {
var buffer = new ArrayBuffer(capacity);
new Uint8Array(buffer).set(new Uint8Array(this.buffer));
this.buffer = buffer;
this.view = new DataView(buffer);
//? } else {
var buffer = new ArrayBuffer(capacity);
var view = new Uint8Array(buffer);
view.set(this.view);
this.buffer = buffer;
this.view = view;
//? }
}
//? }
return this;
};

25
node_modules/bytebuffer/src/methods/reverse.js generated vendored Normal file
View File

@ -0,0 +1,25 @@
/**
* Reverses this ByteBuffer's contents.
* @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
* @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.reverse = function(begin, end) {
if (typeof begin === 'undefined') begin = this.offset;
if (typeof end === 'undefined') end = this.limit;
if (!this.noAssert) {
//? ASSERT_RANGE();
}
if (begin === end)
return this; // Nothing to reverse
//? if (NODE)
Array.prototype.reverse.call(this.buffer.slice(begin, end));
//? else if (DATAVIEW) {
Array.prototype.reverse.call(new Uint8Array(this.buffer).subarray(begin, end));
this.view = new DataView(this.buffer); // FIXME: Why exactly is this necessary?
//? } else {
Array.prototype.reverse.call(this.view.subarray(begin, end));
//? }
return this;
};

19
node_modules/bytebuffer/src/methods/skip.js generated vendored Normal file
View File

@ -0,0 +1,19 @@
/**
* Skips the next `length` bytes. This will just advance
* @param {number} length Number of bytes to skip. May also be negative to move the offset back.
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.skip = function(length) {
if (!this.noAssert) {
//? ASSERT_INTEGER('length');
}
var offset = this.offset + length;
if (!this.noAssert) {
if (offset < 0 || offset > /*?= CAPACITY */)
throw RangeError("Illegal length: 0 <= "+this.offset+" + "+length+" <= "+/*?= CAPACITY */);
}
this.offset = offset;
return this;
};

18
node_modules/bytebuffer/src/methods/slice.js generated vendored Normal file
View File

@ -0,0 +1,18 @@
/**
* Slices this ByteBuffer by creating a cloned instance with `offset = begin` and `limit = end`.
* @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
* @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
* @returns {!ByteBuffer} Clone of this ByteBuffer with slicing applied, backed by the same {@link ByteBuffer#buffer}
* @expose
*/
ByteBufferPrototype.slice = function(begin, end) {
if (typeof begin === 'undefined') begin = this.offset;
if (typeof end === 'undefined') end = this.limit;
if (!this.noAssert) {
//? ASSERT_RANGE();
}
var bb = this.clone();
bb.offset = begin;
bb.limit = end;
return bb;
};

13
node_modules/bytebuffer/src/methods/static/accessor.js generated vendored Normal file
View File

@ -0,0 +1,13 @@
/**
* Gets the accessor type.
* @returns {Function} `Buffer` under node.js, `Uint8Array` respectively `DataView` in the browser (classes)
* @expose
*/
ByteBuffer.accessor = function() {
//? if (NODE)
return Buffer;
//? else if (DATAVIEW)
return DataView;
//? else
return Uint8Array;
};

14
node_modules/bytebuffer/src/methods/static/allocate.js generated vendored Normal file
View File

@ -0,0 +1,14 @@
/**
* Allocates a new ByteBuffer backed by a buffer of the specified capacity.
* @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
* @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
* {@link ByteBuffer.DEFAULT_ENDIAN}.
* @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
* {@link ByteBuffer.DEFAULT_NOASSERT}.
* @returns {!ByteBuffer}
* @expose
*/
ByteBuffer.allocate = function(capacity, littleEndian, noAssert) {
return new ByteBuffer(capacity, littleEndian, noAssert);
};

55
node_modules/bytebuffer/src/methods/static/concat.js generated vendored Normal file
View File

@ -0,0 +1,55 @@
/**
* Concatenates multiple ByteBuffers into one.
//? if (NODE) {
* @param {!Array.<!ByteBuffer|!Buffer|!ArrayBuffer|!Uint8Array|string>} buffers Buffers to concatenate
//? } else {
* @param {!Array.<!ByteBuffer|!ArrayBuffer|!Uint8Array|string>} buffers Buffers to concatenate
//? }
* @param {(string|boolean)=} encoding String encoding if `buffers` contains a string ("base64", "hex", "binary",
* defaults to "utf8")
* @param {boolean=} littleEndian Whether to use little or big endian byte order for the resulting ByteBuffer. Defaults
* to {@link ByteBuffer.DEFAULT_ENDIAN}.
* @param {boolean=} noAssert Whether to skip assertions of offsets and values for the resulting ByteBuffer. Defaults to
* {@link ByteBuffer.DEFAULT_NOASSERT}.
* @returns {!ByteBuffer} Concatenated ByteBuffer
* @expose
*/
ByteBuffer.concat = function(buffers, encoding, littleEndian, noAssert) {
if (typeof encoding === 'boolean' || typeof encoding !== 'string') {
noAssert = littleEndian;
littleEndian = encoding;
encoding = undefined;
}
var capacity = 0;
for (var i=0, k=buffers.length, length; i<k; ++i) {
if (!ByteBuffer.isByteBuffer(buffers[i]))
buffers[i] = ByteBuffer.wrap(buffers[i], encoding);
length = buffers[i].limit - buffers[i].offset;
if (length > 0) capacity += length;
}
if (capacity === 0)
return new ByteBuffer(0, littleEndian, noAssert);
var bb = new ByteBuffer(capacity, littleEndian, noAssert),
bi;
//? if (!NODE && DATAVIEW)
var view = new Uint8Array(bb.buffer);
i=0; while (i<k) {
bi = buffers[i++];
length = bi.limit - bi.offset;
if (length <= 0) continue;
//? if (NODE) {
bi.buffer.copy(bb.buffer, bb.offset, bi.offset, bi.limit);
bb.offset += length;
//? } else {
//? if (DATAVIEW)
view.set(new Uint8Array(bi.buffer).subarray(bi.offset, bi.limit), bb.offset);
//? else
bb.view.set(bi.view.subarray(bi.offset, bi.limit), bb.offset);
bb.offset += length;
//? }
}
bb.limit = bb.offset;
bb.offset = 0;
return bb;
};

View File

@ -0,0 +1,9 @@
/**
* Tests if the specified type is a ByteBuffer.
* @param {*} bb ByteBuffer to test
* @returns {boolean} `true` if it is a ByteBuffer, otherwise `false`
* @expose
*/
ByteBuffer.isByteBuffer = function(bb) {
return (bb && bb["__isByteBuffer__"]) === true;
};

11
node_modules/bytebuffer/src/methods/static/type.js generated vendored Normal file
View File

@ -0,0 +1,11 @@
/**
* Gets the backing buffer type.
* @returns {Function} `Buffer` under node.js, `ArrayBuffer` in the browser (classes)
* @expose
*/
ByteBuffer.type = function() {
//? if (NODE)
return Buffer;
//? else
return ArrayBuffer;
};

125
node_modules/bytebuffer/src/methods/static/wrap.js generated vendored Normal file
View File

@ -0,0 +1,125 @@
/**
* Wraps a buffer or a string. Sets the allocated ByteBuffer's {@link ByteBuffer#offset} to `0` and its
* {@link ByteBuffer#limit} to the length of the wrapped data.
//? if (NODE) {
* @param {!ByteBuffer|!Buffer|!ArrayBuffer|!Uint8Array|string|!Array.<number>} buffer Anything that can be wrapped
//? } else {
* @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string|!Array.<number>} buffer Anything that can be wrapped
//? }
* @param {(string|boolean)=} encoding String encoding if `buffer` is a string ("base64", "hex", "binary", defaults to
* "utf8")
* @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
* {@link ByteBuffer.DEFAULT_ENDIAN}.
* @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
* {@link ByteBuffer.DEFAULT_NOASSERT}.
* @returns {!ByteBuffer} A ByteBuffer wrapping `buffer`
* @expose
*/
ByteBuffer.wrap = function(buffer, encoding, littleEndian, noAssert) {
if (typeof encoding !== 'string') {
noAssert = littleEndian;
littleEndian = encoding;
encoding = undefined;
}
if (typeof buffer === 'string') {
if (typeof encoding === 'undefined')
encoding = "utf8";
switch (encoding) {
//? if (BASE64) {
case "base64":
return ByteBuffer.fromBase64(buffer, littleEndian);
//? } if (HEX) {
case "hex":
return ByteBuffer.fromHex(buffer, littleEndian);
//? } if (BINARY) {
case "binary":
return ByteBuffer.fromBinary(buffer, littleEndian);
//? } if (UTF8) {
case "utf8":
return ByteBuffer.fromUTF8(buffer, littleEndian);
//? } if (DEBUG) {
case "debug":
return ByteBuffer.fromDebug(buffer, littleEndian);
//? }
default:
throw Error("Unsupported encoding: "+encoding);
}
}
if (buffer === null || typeof buffer !== 'object')
throw TypeError("Illegal buffer");
var bb;
if (ByteBuffer.isByteBuffer(buffer)) {
bb = ByteBufferPrototype.clone.call(buffer);
bb.markedOffset = -1;
return bb;
}
//? if (NODE) {
var i = 0,
k = 0,
b;
if (buffer instanceof Uint8Array) { // Extract bytes from Uint8Array
b = new Buffer(buffer.length);
if (memcpy) { // Fast
memcpy(b, 0, buffer.buffer, buffer.byteOffset, buffer.byteOffset + buffer.length);
} else { // Slow
for (i=0, k=buffer.length; i<k; ++i)
b[i] = buffer[i];
}
buffer = b;
} else if (buffer instanceof ArrayBuffer) { // Convert ArrayBuffer to Buffer
b = new Buffer(buffer.byteLength);
if (memcpy) { // Fast
memcpy(b, 0, buffer, 0, buffer.byteLength);
} else { // Slow
buffer = new Uint8Array(buffer);
for (i=0, k=buffer.length; i<k; ++i) {
b[i] = buffer[i];
}
}
buffer = b;
} else if (!(buffer instanceof Buffer)) { // Create from octets if it is an error, otherwise fail
if (Object.prototype.toString.call(buffer) !== "[object Array]")
throw TypeError("Illegal buffer");
buffer = new Buffer(buffer);
}
bb = new ByteBuffer(0, littleEndian, noAssert);
if (buffer.length > 0) { // Avoid references to more than one EMPTY_BUFFER
bb.buffer = buffer;
bb.limit = buffer.length;
}
//? } else {
if (buffer instanceof Uint8Array) { // Extract ArrayBuffer from Uint8Array
bb = new ByteBuffer(0, littleEndian, noAssert);
if (buffer.length > 0) { // Avoid references to more than one EMPTY_BUFFER
bb.buffer = buffer.buffer;
bb.offset = buffer.byteOffset;
bb.limit = buffer.byteOffset + buffer.byteLength;
//? if (DATAVIEW)
bb.view = new DataView(buffer.buffer);
//? else
bb.view = new Uint8Array(buffer.buffer);
}
} else if (buffer instanceof ArrayBuffer) { // Reuse ArrayBuffer
bb = new ByteBuffer(0, littleEndian, noAssert);
if (buffer.byteLength > 0) {
bb.buffer = buffer;
bb.offset = 0;
bb.limit = buffer.byteLength;
//? if (DATAVIEW)
bb.view = buffer.byteLength > 0 ? new DataView(buffer) : null;
//? else
bb.view = buffer.byteLength > 0 ? new Uint8Array(buffer) : null;
}
} else if (Object.prototype.toString.call(buffer) === "[object Array]") { // Create from octets
bb = new ByteBuffer(buffer.length, littleEndian, noAssert);
bb.limit = buffer.length;
for (var i=0; i<buffer.length; ++i)
//? if (DATAVIEW)
bb.view.setUint8(i, buffer[i]);
//? else
bb.view[i] = buffer[i];
} else
throw TypeError("Illegal buffer"); // Otherwise fail
//? }
return bb;
};

77
node_modules/bytebuffer/src/methods/toBuffer.js generated vendored Normal file
View File

@ -0,0 +1,77 @@
/**
* Returns a copy of the backing buffer that contains this ByteBuffer's contents. Contents are the bytes between
* {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
* @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory if
* possible. Defaults to `false`
//? if (NODE) {
* @returns {!Buffer} Contents as a Buffer
//? } else {
* @returns {!ArrayBuffer} Contents as an ArrayBuffer
//? }
* @expose
*/
ByteBufferPrototype.toBuffer = function(forceCopy) {
var offset = this.offset,
limit = this.limit;
if (!this.noAssert) {
//? ASSERT_RANGE('offset', 'limit');
}
//? if (NODE) {
if (forceCopy) {
var buffer = new Buffer(limit - offset);
this.buffer.copy(buffer, 0, offset, limit);
return buffer;
} else {
if (offset === 0 && limit === this.buffer.length)
return this.buffer;
else
return this.buffer.slice(offset, limit);
}
//? } else {
// NOTE: It's not possible to have another ArrayBuffer reference the same memory as the backing buffer. This is
// possible with Uint8Array#subarray only, but we have to return an ArrayBuffer by contract. So:
if (!forceCopy && offset === 0 && limit === this.buffer.byteLength)
return this.buffer;
if (offset === limit)
return EMPTY_BUFFER;
var buffer = new ArrayBuffer(limit - offset);
new Uint8Array(buffer).set(new Uint8Array(this.buffer).subarray(offset, limit), 0);
return buffer;
//? }
};
//? if (NODE) {
/**
* Returns a copy of the backing buffer compacted to contain this ByteBuffer's contents. Contents are the bytes between
* {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
* @returns {!ArrayBuffer} Contents as an ArrayBuffer
*/
ByteBufferPrototype.toArrayBuffer = function() {
var offset = this.offset,
limit = this.limit;
if (!this.noAssert) {
//? ASSERT_RANGE('offset', 'limit');
}
var ab = new ArrayBuffer(limit - offset);
if (memcpy) { // Fast
memcpy(ab, 0, this.buffer, offset, limit);
} else { // Slow
var dst = new Uint8Array(ab);
for (var i=offset; i<limit; ++i)
dst[i-offset] = this.buffer[i];
}
return ab;
};
//? } else {
/**
* Returns a raw buffer compacted to contain this ByteBuffer's contents. Contents are the bytes between
* {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. This is an alias of {@link ByteBuffer#toBuffer}.
* @function
* @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory.
* Defaults to `false`
* @returns {!ArrayBuffer} Contents as an ArrayBuffer
* @expose
*/
ByteBufferPrototype.toArrayBuffer = ByteBufferPrototype.toBuffer;
//? }

43
node_modules/bytebuffer/src/methods/toString.js generated vendored Normal file
View File

@ -0,0 +1,43 @@
/**
* Converts the ByteBuffer's contents to a string.
* @param {string=} encoding Output encoding. Returns an informative string representation if omitted but also allows
* direct conversion to "utf8", "hex", "base64" and "binary" encoding. "debug" returns a hex representation with
* highlighted offsets.
* @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}
* @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
* @returns {string} String representation
* @throws {Error} If `encoding` is invalid
* @expose
*/
ByteBufferPrototype.toString = function(encoding, begin, end) {
if (typeof encoding === 'undefined')
return "ByteBuffer/*?= NODE ? 'NB' : 'AB'+(DATAVIEW ? '_DataView' : '') */(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";
if (typeof encoding === 'number')
encoding = "utf8",
begin = encoding,
end = begin;
switch (encoding) {
//? if (ENCODINGS) {
//? if (UTF8) {
case "utf8":
return this.toUTF8(begin, end);
//? } if (BASE64) {
case "base64":
return this.toBase64(begin, end);
//? } if (HEX) {
case "hex":
return this.toHex(begin, end);
//? } if (BINARY) {
case "binary":
return this.toBinary(begin, end);
//? } if (DEBUG) {
case "debug":
return this.toDebug();
case "columns":
return this.toColumns();
//? }
//? } // ENCODINGS
default:
throw Error("Unsupported encoding: "+encoding);
}
};

89
node_modules/bytebuffer/src/types/bytes/bitset.js generated vendored Normal file
View File

@ -0,0 +1,89 @@
/**
* Writes the array as a bitset.
* @param {Array<boolean>} value Array of booleans to write
* @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
* @returns {!ByteBuffer}
* @expose
*/
ByteBufferPrototype.writeBitSet = function(value, offset) {
//? RELATIVE()
if (!this.noAssert) {
if (!(value instanceof Array))
throw TypeError("Illegal BitSet: Not an array");
//? ASSERT_OFFSET();
}
var start = offset,
bits = value.length,
bytes = (bits >> 3),
bit = 0,
k;
offset += this.writeVarint32(bits,offset);
while(bytes--) {
k = (!!value[bit++] & 1) |
((!!value[bit++] & 1) << 1) |
((!!value[bit++] & 1) << 2) |
((!!value[bit++] & 1) << 3) |
((!!value[bit++] & 1) << 4) |
((!!value[bit++] & 1) << 5) |
((!!value[bit++] & 1) << 6) |
((!!value[bit++] & 1) << 7);
this.writeByte(k,offset++);
}
if(bit < bits) {
var m = 0; k = 0;
while(bit < bits) k = k | ((!!value[bit++] & 1) << (m++));
this.writeByte(k,offset++);
}
if (relative) {
this.offset = offset;
return this;
}
return offset - start;
}
/**
* Reads a BitSet as an array of booleans.
* @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
* @returns {Array<boolean>
* @expose
*/
ByteBufferPrototype.readBitSet = function(offset) {
//? RELATIVE()
var ret = this.readVarint32(offset),
bits = ret.value,
bytes = (bits >> 3),
bit = 0,
value = [],
k;
offset += ret.length;
while(bytes--) {
k = this.readByte(offset++);
value[bit++] = !!(k & 0x01);
value[bit++] = !!(k & 0x02);
value[bit++] = !!(k & 0x04);
value[bit++] = !!(k & 0x08);
value[bit++] = !!(k & 0x10);
value[bit++] = !!(k & 0x20);
value[bit++] = !!(k & 0x40);
value[bit++] = !!(k & 0x80);
}
if(bit < bits) {
var m = 0;
k = this.readByte(offset++);
while(bit < bits) value[bit++] = !!((k >> (m++)) & 1);
}
if (relative) {
this.offset = offset;
}
return value;
}

34
node_modules/bytebuffer/src/types/bytes/bytes.js generated vendored Normal file
View File

@ -0,0 +1,34 @@
/**
* Reads the specified number of bytes.
* @param {number} length Number of bytes to read
* @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
* @returns {!ByteBuffer}
* @expose
*/
ByteBufferPrototype.readBytes = function(length, offset) {
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_OFFSET('length');
}
var slice = this.slice(offset, offset + length);
//? RELATIVE('length');
return slice;
};
/**
* Writes a payload of bytes. This is an alias of {@link ByteBuffer#append}.
* @function
//? if (NODE) {
* @param {!ByteBuffer|!Buffer|!ArrayBuffer|!Uint8Array|string} source Data to write. If `source` is a ByteBuffer, its
* offsets will be modified according to the performed read operation.
//? } else {
* @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to write. If `source` is a ByteBuffer, its offsets
* will be modified according to the performed read operation.
//? }
* @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
* @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
* written if omitted.
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.writeBytes = ByteBufferPrototype.append;

81
node_modules/bytebuffer/src/types/floats/float32.js generated vendored Normal file
View File

@ -0,0 +1,81 @@
//? if (FLOAT32) {
// types/floats/float32
//? if (!NODE && !DATAVIEW) {
//? include("ieee754.js");
//? }
/**
* Writes a 32bit float.
* @param {number} value Value to write
* @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.writeFloat32 = function(value, offset) {
//? RELATIVE();
if (!this.noAssert) {
if (typeof value !== 'number')
throw TypeError("Illegal value: "+value+" (not a number)");
//? ASSERT_OFFSET();
}
//? ENSURE_CAPACITY(4);
//? if (NODE) { // FIXME: Is there any way to inline the following in a sane way?
this.littleEndian
? this.buffer.writeFloatLE(value, offset, true)
: this.buffer.writeFloatBE(value, offset, true);
//? } else if (DATAVIEW)
this.view.setFloat32(offset, value, this.littleEndian);
//? else
ieee754_write(this.view, value, offset, this.littleEndian, 23, 4);
//? RELATIVE(4);
return this;
};
//? if (ALIASES) {
/**
* Writes a 32bit float. This is an alias of {@link ByteBuffer#writeFloat32}.
* @function
* @param {number} value Value to write
* @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.writeFloat = ByteBufferPrototype.writeFloat32;
//? }
/**
* Reads a 32bit float.
* @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
* @returns {number}
* @expose
*/
ByteBufferPrototype.readFloat32 = function(offset) {
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_OFFSET(4);
}
//? if (NODE) {
var value = this.littleEndian
? this.buffer.readFloatLE(offset, true)
: this.buffer.readFloatBE(offset, true);
//? } else if (DATAVIEW)
var value = this.view.getFloat32(offset, this.littleEndian);
//? else
var value = ieee754_read(this.view, offset, this.littleEndian, 23, 4);
//? RELATIVE(4);
return value;
};
//? if (ALIASES) {
/**
* Reads a 32bit float. This is an alias of {@link ByteBuffer#readFloat32}.
* @function
* @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
* @returns {number}
* @expose
*/
ByteBufferPrototype.readFloat = ByteBufferPrototype.readFloat32;
//? }
//? }

77
node_modules/bytebuffer/src/types/floats/float64.js generated vendored Normal file
View File

@ -0,0 +1,77 @@
//? if (FLOAT64) {
// types/floats/float64
/**
* Writes a 64bit float.
* @param {number} value Value to write
* @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.writeFloat64 = function(value, offset) {
//? RELATIVE();
if (!this.noAssert) {
if (typeof value !== 'number')
throw TypeError("Illegal value: "+value+" (not a number)");
//? ASSERT_OFFSET();
}
//? ENSURE_CAPACITY(8);
//? if (NODE) {
this.littleEndian
? this.buffer.writeDoubleLE(value, offset, true)
: this.buffer.writeDoubleBE(value, offset, true);
//? } else if (DATAVIEW)
this.view.setFloat64(offset, value, this.littleEndian);
//? else
ieee754_write(this.view, value, offset, this.littleEndian, 52, 8);
//? RELATIVE(8);
return this;
};
//? if (ALIASES) {
/**
* Writes a 64bit float. This is an alias of {@link ByteBuffer#writeFloat64}.
* @function
* @param {number} value Value to write
* @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.writeDouble = ByteBufferPrototype.writeFloat64;
//? }
/**
* Reads a 64bit float.
* @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
* @returns {number}
* @expose
*/
ByteBufferPrototype.readFloat64 = function(offset) {
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_OFFSET(8);
}
//? if (NODE) {
var value = this.littleEndian
? this.buffer.readDoubleLE(offset, true)
: this.buffer.readDoubleBE(offset, true);
//? } else if (DATAVIEW)
var value = this.view.getFloat64(offset, this.littleEndian);
//? else
var value = ieee754_read(this.view, offset, this.littleEndian, 52, 8);
//? RELATIVE(8);
return value;
};
//? if (ALIASES) {
/**
* Reads a 64bit float. This is an alias of {@link ByteBuffer#readFloat64}.
* @function
* @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
* @returns {number}
* @expose
*/
ByteBufferPrototype.readDouble = ByteBufferPrototype.readFloat64;
//? }
//? }

130
node_modules/bytebuffer/src/types/floats/ieee754.js generated vendored Normal file
View File

@ -0,0 +1,130 @@
/*
ieee754 - https://github.com/feross/ieee754
The MIT License (MIT)
Copyright (c) Feross Aboukhadijeh
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/**
* Reads an IEEE754 float from a byte array.
* @param {!Array} buffer
* @param {number} offset
* @param {boolean} isLE
* @param {number} mLen
* @param {number} nBytes
* @returns {number}
* @inner
*/
function ieee754_read(buffer, offset, isLE, mLen, nBytes) {
var e, m,
eLen = nBytes * 8 - mLen - 1,
eMax = (1 << eLen) - 1,
eBias = eMax >> 1,
nBits = -7,
i = isLE ? (nBytes - 1) : 0,
d = isLE ? -1 : 1,
s = buffer[offset + i];
i += d;
e = s & ((1 << (-nBits)) - 1);
s >>= (-nBits);
nBits += eLen;
for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
m = e & ((1 << (-nBits)) - 1);
e >>= (-nBits);
nBits += mLen;
for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
if (e === 0) {
e = 1 - eBias;
} else if (e === eMax) {
return m ? NaN : ((s ? -1 : 1) * Infinity);
} else {
m = m + Math.pow(2, mLen);
e = e - eBias;
}
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
}
/**
* Writes an IEEE754 float to a byte array.
* @param {!Array} buffer
* @param {number} value
* @param {number} offset
* @param {boolean} isLE
* @param {number} mLen
* @param {number} nBytes
* @inner
*/
function ieee754_write(buffer, value, offset, isLE, mLen, nBytes) {
var e, m, c,
eLen = nBytes * 8 - mLen - 1,
eMax = (1 << eLen) - 1,
eBias = eMax >> 1,
rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),
i = isLE ? 0 : (nBytes - 1),
d = isLE ? 1 : -1,
s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
value = Math.abs(value);
if (isNaN(value) || value === Infinity) {
m = isNaN(value) ? 1 : 0;
e = eMax;
} else {
e = Math.floor(Math.log(value) / Math.LN2);
if (value * (c = Math.pow(2, -e)) < 1) {
e--;
c *= 2;
}
if (e + eBias >= 1) {
value += rt / c;
} else {
value += rt * Math.pow(2, 1 - eBias);
}
if (value * c >= 2) {
e++;
c /= 2;
}
if (e + eBias >= eMax) {
m = 0;
e = eMax;
} else if (e + eBias >= 1) {
m = (value * c - 1) * Math.pow(2, mLen);
e = e + eBias;
} else {
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
e = 0;
}
}
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
e = (e << mLen) | m;
eLen += mLen;
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
buffer[offset + i - d] |= s * 128;
}

167
node_modules/bytebuffer/src/types/ints/int16.js generated vendored Normal file
View File

@ -0,0 +1,167 @@
//? if (INT16) {
// types/ints/int16
/**
* Writes a 16bit signed integer.
* @param {number} value Value to write
* @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
* @throws {TypeError} If `offset` or `value` is not a valid number
* @throws {RangeError} If `offset` is out of bounds
* @expose
*/
ByteBufferPrototype.writeInt16 = function(value, offset) {
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_INTEGER('value');
//? ASSERT_OFFSET();
}
//? ENSURE_CAPACITY(2);
//? if (NODE || !DATAVIEW) { var dst = NODE ? 'this.buffer' : 'this.view';
if (this.littleEndian) {
/*?= dst */[offset+1] = (value & 0xFF00) >>> 8;
/*?= dst */[offset ] = value & 0x00FF;
} else {
/*?= dst */[offset] = (value & 0xFF00) >>> 8;
/*?= dst */[offset+1] = value & 0x00FF;
}
//? } else
this.view.setInt16(offset, value, this.littleEndian);
//? RELATIVE(2);
return this;
};
//? if (ALIASES) {
/**
* Writes a 16bit signed integer. This is an alias of {@link ByteBuffer#writeInt16}.
* @function
* @param {number} value Value to write
* @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
* @throws {TypeError} If `offset` or `value` is not a valid number
* @throws {RangeError} If `offset` is out of bounds
* @expose
*/
ByteBufferPrototype.writeShort = ByteBufferPrototype.writeInt16;
//? }
/**
* Reads a 16bit signed integer.
* @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
* @returns {number} Value read
* @throws {TypeError} If `offset` is not a valid number
* @throws {RangeError} If `offset` is out of bounds
* @expose
*/
ByteBufferPrototype.readInt16 = function(offset) {
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_OFFSET(2);
}
//? if (NODE || !DATAVIEW) { var dst = NODE ? 'this.buffer' : 'this.view';
var value = 0;
if (this.littleEndian) {
value = /*?= dst */[offset ];
value |= /*?= dst */[offset+1] << 8;
} else {
value = /*?= dst */[offset ] << 8;
value |= /*?= dst */[offset+1];
}
if ((value & 0x8000) === 0x8000) value = -(0xFFFF - value + 1); // Cast to signed
//? } else
var value = this.view.getInt16(offset, this.littleEndian);
//? RELATIVE(2);
return value;
};
//? if (ALIASES) {
/**
* Reads a 16bit signed integer. This is an alias of {@link ByteBuffer#readInt16}.
* @function
* @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
* @returns {number} Value read
* @throws {TypeError} If `offset` is not a valid number
* @throws {RangeError} If `offset` is out of bounds
* @expose
*/
ByteBufferPrototype.readShort = ByteBufferPrototype.readInt16;
//? }
/**
* Writes a 16bit unsigned integer.
* @param {number} value Value to write
* @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
* @throws {TypeError} If `offset` or `value` is not a valid number
* @throws {RangeError} If `offset` is out of bounds
* @expose
*/
ByteBufferPrototype.writeUint16 = function(value, offset) {
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_INTEGER('value', true);
//? ASSERT_OFFSET();
}
//? ENSURE_CAPACITY(2);
//? if (NODE || !DATAVIEW) { var dst = NODE ? 'this.buffer' : 'this.view';
if (this.littleEndian) {
/*?= dst */[offset+1] = (value & 0xFF00) >>> 8;
/*?= dst */[offset ] = value & 0x00FF;
} else {
/*?= dst */[offset] = (value & 0xFF00) >>> 8;
/*?= dst */[offset+1] = value & 0x00FF;
}
//? } else
this.view.setUint16(offset, value, this.littleEndian);
//? RELATIVE(2);
return this;
};
/**
* Writes a 16bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint16}.
* @function
* @param {number} value Value to write
* @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
* @throws {TypeError} If `offset` or `value` is not a valid number
* @throws {RangeError} If `offset` is out of bounds
* @expose
*/
ByteBufferPrototype.writeUInt16 = ByteBufferPrototype.writeUint16;
/**
* Reads a 16bit unsigned integer.
* @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
* @returns {number} Value read
* @throws {TypeError} If `offset` is not a valid number
* @throws {RangeError} If `offset` is out of bounds
* @expose
*/
ByteBufferPrototype.readUint16 = function(offset) {
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_OFFSET(2);
}
//? if (NODE || !DATAVIEW) { var dst = NODE ? 'this.buffer' : 'this.view';
var value = 0;
if (this.littleEndian) {
value = /*?= dst */[offset ];
value |= /*?= dst */[offset+1] << 8;
} else {
value = /*?= dst */[offset ] << 8;
value |= /*?= dst */[offset+1];
}
//? } else
var value = this.view.getUint16(offset, this.littleEndian);
//? RELATIVE(2);
return value;
};
/**
* Reads a 16bit unsigned integer. This is an alias of {@link ByteBuffer#readUint16}.
* @function
* @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
* @returns {number} Value read
* @throws {TypeError} If `offset` is not a valid number
* @throws {RangeError} If `offset` is out of bounds
* @expose
*/
ByteBufferPrototype.readUInt16 = ByteBufferPrototype.readUint16;
//? }

125
node_modules/bytebuffer/src/types/ints/int32.js generated vendored Normal file
View File

@ -0,0 +1,125 @@
//? if (INT32) {
// types/ints/int32
/**
* Writes a 32bit signed integer.
* @param {number} value Value to write
* @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
* @expose
*/
ByteBufferPrototype.writeInt32 = function(value, offset) {
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_INTEGER('value');
//? ASSERT_OFFSET();
}
//? ENSURE_CAPACITY(4);
//? if (NODE || !DATAVIEW) {
//? WRITE_UINT32_ARRAY();
//? } else
this.view.setInt32(offset, value, this.littleEndian);
//? RELATIVE(4);
return this;
};
//? if (ALIASES) {
/**
* Writes a 32bit signed integer. This is an alias of {@link ByteBuffer#writeInt32}.
* @param {number} value Value to write
* @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
* @expose
*/
ByteBufferPrototype.writeInt = ByteBufferPrototype.writeInt32;
//? }
/**
* Reads a 32bit signed integer.
* @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
* @returns {number} Value read
* @expose
*/
ByteBufferPrototype.readInt32 = function(offset) {
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_OFFSET(4);
}
//? if (NODE || !DATAVIEW) {
var value = 0;
//? READ_UINT32_ARRAY();
value |= 0; // Cast to signed
//? } else
var value = this.view.getInt32(offset, this.littleEndian);
//? RELATIVE(4);
return value;
};
//? if (ALIASES) {
/**
* Reads a 32bit signed integer. This is an alias of {@link ByteBuffer#readInt32}.
* @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `4` if omitted.
* @returns {number} Value read
* @expose
*/
ByteBufferPrototype.readInt = ByteBufferPrototype.readInt32;
//? }
/**
* Writes a 32bit unsigned integer.
* @param {number} value Value to write
* @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
* @expose
*/
ByteBufferPrototype.writeUint32 = function(value, offset) {
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_INTEGER('value', true);
//? ASSERT_OFFSET();
}
//? ENSURE_CAPACITY(4);
//? if (NODE || !DATAVIEW) {
//? WRITE_UINT32_ARRAY();
//? } else
this.view.setUint32(offset, value, this.littleEndian);
//? RELATIVE(4);
return this;
};
/**
* Writes a 32bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint32}.
* @function
* @param {number} value Value to write
* @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
* @expose
*/
ByteBufferPrototype.writeUInt32 = ByteBufferPrototype.writeUint32;
/**
* Reads a 32bit unsigned integer.
* @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
* @returns {number} Value read
* @expose
*/
ByteBufferPrototype.readUint32 = function(offset) {
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_OFFSET(4);
}
//? if (NODE || !DATAVIEW) {
var value = 0;
//? READ_UINT32_ARRAY();
//? } else
var value = this.view.getUint32(offset, this.littleEndian);
//? RELATIVE(4);
return value;
};
/**
* Reads a 32bit unsigned integer. This is an alias of {@link ByteBuffer#readUint32}.
* @function
* @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
* @returns {number} Value read
* @expose
*/
ByteBufferPrototype.readUInt32 = ByteBufferPrototype.readUint32;
//? }

194
node_modules/bytebuffer/src/types/ints/int64.js generated vendored Normal file
View File

@ -0,0 +1,194 @@
//? if (INT64) {
// types/ints/int64
if (Long) {
/**
* Writes a 64bit signed integer.
* @param {number|!Long} value Value to write
* @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.writeInt64 = function(value, offset) {
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_LONG('value');
//? ASSERT_OFFSET();
}
//? LONG('value');
//? ENSURE_CAPACITY(8);
//? if (NODE || !DATAVIEW) {
var lo = value.low,
hi = value.high;
if (this.littleEndian) {
//? WRITE_UINT32_ARRAY('lo', undefined, undefined, true);
offset += 4;
//? WRITE_UINT32_ARRAY('hi', undefined, undefined, true);
} else {
//? WRITE_UINT32_ARRAY('hi', undefined, undefined, false);
offset += 4;
//? WRITE_UINT32_ARRAY('lo', undefined, undefined, false);
}
//? } else {
if (this.littleEndian) {
this.view.setInt32(offset , value.low , true);
this.view.setInt32(offset+4, value.high, true);
} else {
this.view.setInt32(offset , value.high, false);
this.view.setInt32(offset+4, value.low , false);
}
//? }
//? RELATIVE(8);
return this;
};
//? if (ALIASES) {
/**
* Writes a 64bit signed integer. This is an alias of {@link ByteBuffer#writeInt64}.
* @param {number|!Long} value Value to write
* @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.writeLong = ByteBufferPrototype.writeInt64;
//? }
/**
* Reads a 64bit signed integer.
* @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
* @returns {!Long}
* @expose
*/
ByteBufferPrototype.readInt64 = function(offset) {
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_OFFSET(8);
}
//? if (NODE || !DATAVIEW) {
var lo = 0,
hi = 0;
if (this.littleEndian) {
//? READ_UINT32_ARRAY('lo', undefined, undefined, true);
offset += 4;
//? READ_UINT32_ARRAY('hi', undefined, undefined, true);
} else {
//? READ_UINT32_ARRAY('hi', undefined, undefined, false);
offset += 4;
//? READ_UINT32_ARRAY('lo', undefined, undefined, false);
}
var value = new Long(lo, hi, false);
//? } else {
var value = this.littleEndian
? new Long(this.view.getInt32(offset , true ), this.view.getInt32(offset+4, true ), false)
: new Long(this.view.getInt32(offset+4, false), this.view.getInt32(offset , false), false);
//? }
//? RELATIVE(8);
return value;
};
//? if (ALIASES) {
/**
* Reads a 64bit signed integer. This is an alias of {@link ByteBuffer#readInt64}.
* @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
* @returns {!Long}
* @expose
*/
ByteBufferPrototype.readLong = ByteBufferPrototype.readInt64;
//? }
/**
* Writes a 64bit unsigned integer.
* @param {number|!Long} value Value to write
* @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.writeUint64 = function(value, offset) {
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_LONG('value');
//? ASSERT_OFFSET();
}
//? LONG('value');
//? ENSURE_CAPACITY(8);
//? if (NODE || !DATAVIEW) {
var lo = value.low,
hi = value.high;
if (this.littleEndian) {
//? WRITE_UINT32_ARRAY('lo', undefined, undefined, true);
offset += 4;
//? WRITE_UINT32_ARRAY('hi', undefined, undefined, true);
} else {
//? WRITE_UINT32_ARRAY('hi', undefined, undefined, false);
offset += 4;
//? WRITE_UINT32_ARRAY('lo', undefined, undefined, false);
}
//? } else {
if (this.littleEndian) {
this.view.setInt32(offset , value.low , true);
this.view.setInt32(offset+4, value.high, true);
} else {
this.view.setInt32(offset , value.high, false);
this.view.setInt32(offset+4, value.low , false);
}
//? }
//? RELATIVE(8);
return this;
};
/**
* Writes a 64bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint64}.
* @function
* @param {number|!Long} value Value to write
* @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.writeUInt64 = ByteBufferPrototype.writeUint64;
/**
* Reads a 64bit unsigned integer.
* @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
* @returns {!Long}
* @expose
*/
ByteBufferPrototype.readUint64 = function(offset) {
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_OFFSET(8);
}
//? if (NODE || !DATAVIEW) {
var lo = 0,
hi = 0;
if (this.littleEndian) {
//? READ_UINT32_ARRAY('lo', undefined, undefined, true);
offset += 4;
//? READ_UINT32_ARRAY('hi', undefined, undefined, true);
} else {
//? READ_UINT32_ARRAY('hi', undefined, undefined, false);
offset += 4;
//? READ_UINT32_ARRAY('lo', undefined, undefined, false);
}
var value = new Long(lo, hi, true);
//? } else {
var value = this.littleEndian
? new Long(this.view.getInt32(offset , true ), this.view.getInt32(offset+4, true ), true)
: new Long(this.view.getInt32(offset+4, false), this.view.getInt32(offset , false), true);
//? }
//? RELATIVE(8);
return value;
};
/**
* Reads a 64bit unsigned integer. This is an alias of {@link ByteBuffer#readUint64}.
* @function
* @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
* @returns {!Long}
* @expose
*/
ByteBufferPrototype.readUInt64 = ByteBufferPrototype.readUint64;
} // Long
//? }

137
node_modules/bytebuffer/src/types/ints/int8.js generated vendored Normal file
View File

@ -0,0 +1,137 @@
//? if (INT8) {
// types/ints/int8
/**
* Writes an 8bit signed integer.
* @param {number} value Value to write
* @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.writeInt8 = function(value, offset) {
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_INTEGER('value');
//? ASSERT_OFFSET();
}
//? ENSURE_CAPACITY(1);
//? if (NODE)
this.buffer[offset] = value;
//? else if (DATAVIEW)
this.view.setInt8(offset, value);
//? else
this.view[offset] = value;
//? RELATIVE(1);
return this;
};
/**
* Writes an 8bit signed integer. This is an alias of {@link ByteBuffer#writeInt8}.
* @function
* @param {number} value Value to write
* @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.writeByte = ByteBufferPrototype.writeInt8;
/**
* Reads an 8bit signed integer.
* @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
* @returns {number} Value read
* @expose
*/
ByteBufferPrototype.readInt8 = function(offset) {
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_OFFSET(1);
}
//? if (NODE) {
var value = this.buffer[offset];
if ((value & 0x80) === 0x80) value = -(0xFF - value + 1); // Cast to signed
//? } else if (DATAVIEW) {
var value = this.view.getInt8(offset);
//? } else {
var value = this.view[offset];
if ((value & 0x80) === 0x80) value = -(0xFF - value + 1); // Cast to signed
//? }
//? RELATIVE(1);
return value;
};
//? if (ALIASES) {
/**
* Reads an 8bit signed integer. This is an alias of {@link ByteBuffer#readInt8}.
* @function
* @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
* @returns {number} Value read
* @expose
*/
ByteBufferPrototype.readByte = ByteBufferPrototype.readInt8;
//? }
/**
* Writes an 8bit unsigned integer.
* @param {number} value Value to write
* @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.writeUint8 = function(value, offset) {
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_INTEGER('value', true);
//? ASSERT_OFFSET();
}
//? ENSURE_CAPACITY(1);
//? if (NODE)
this.buffer[offset] = value;
//? else if (DATAVIEW)
this.view.setUint8(offset, value);
//? else
this.view[offset] = value;
//? RELATIVE(1);
return this;
};
/**
* Writes an 8bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint8}.
* @function
* @param {number} value Value to write
* @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
* @returns {!ByteBuffer} this
* @expose
*/
ByteBufferPrototype.writeUInt8 = ByteBufferPrototype.writeUint8;
/**
* Reads an 8bit unsigned integer.
* @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
* @returns {number} Value read
* @expose
*/
ByteBufferPrototype.readUint8 = function(offset) {
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_OFFSET(1);
}
//? if (NODE)
var value = this.buffer[offset];
//? else if (DATAVIEW)
var value = this.view.getUint8(offset);
//? else
var value = this.view[offset];
//? RELATIVE(1);
return value;
};
/**
* Reads an 8bit unsigned integer. This is an alias of {@link ByteBuffer#readUint8}.
* @function
* @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
* @returns {number} Value read
* @expose
*/
ByteBufferPrototype.readUInt8 = ByteBufferPrototype.readUint8;
//? }

110
node_modules/bytebuffer/src/types/strings/cstring.js generated vendored Normal file
View File

@ -0,0 +1,110 @@
//? if (CSTRING) {
// types/strings/cstring
/**
* Writes a NULL-terminated UTF8 encoded string. For this to work the specified string must not contain any NULL
* characters itself.
* @param {string} str String to write
* @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
* contained in `str` + 1 if omitted.
* @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written
* @expose
*/
ByteBufferPrototype.writeCString = function(str, offset) {
//? RELATIVE();
var i,
k = str.length;
if (!this.noAssert) {
if (typeof str !== 'string')
throw TypeError("Illegal str: Not a string");
for (i=0; i<k; ++i) {
if (str.charCodeAt(i) === 0)
throw RangeError("Illegal str: Contains NULL-characters");
}
//? ASSERT_OFFSET();
}
// UTF8 strings do not contain zero bytes in between except for the zero character, so:
//? if (NODE) {
k = Buffer.byteLength(str, "utf8");
//? ENSURE_CAPACITY('k+1');
offset += this.buffer.write(str, offset, k, "utf8");
this.buffer[offset++] = 0;
//? } else {
k = utfx.calculateUTF16asUTF8(stringSource(str))[1];
//? ENSURE_CAPACITY('k+1');
utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
//? if (DATAVIEW)
this.view.setUint8(offset++, b);
//? else
this.view[offset++] = b;
}.bind(this));
//? if (DATAVIEW)
this.view.setUint8(offset++, 0);
//? else
this.view[offset++] = 0;
//? }
if (relative) {
this.offset = offset;
return this;
}
return k;
};
/**
* Reads a NULL-terminated UTF8 encoded string. For this to work the string read must not contain any NULL characters
* itself.
* @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
* read if omitted.
* @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
* read and the actual number of bytes read.
* @expose
*/
ByteBufferPrototype.readCString = function(offset) {
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_OFFSET(1);
}
var start = offset,
temp;
// UTF8 strings do not contain zero bytes in between except for the zero character itself, so:
//? if (NODE) {
do {
if (offset >= this.buffer.length)
throw RangeError("Index out of range: "+offset+" <= "+this.buffer.length);
temp = this.buffer[offset++];
} while (temp !== 0);
var str = this.buffer.toString("utf8", start, offset-1);
if (relative) {
this.offset = offset;
return str;
} else {
return {
"string": str,
"length": offset - start
};
}
//? } else { // getUint8 asserts on its own
var sd, b = -1;
utfx.decodeUTF8toUTF16(function() {
if (b === 0) return null;
if (offset >= this.limit)
throw RangeError("Illegal range: Truncated data, "+offset+" < "+this.limit);
//? if (DATAVIEW)
b = this.view.getUint8(offset++);
//? else
b = this.view[offset++];
return b === 0 ? null : b;
}.bind(this), sd = stringDestination(), true);
if (relative) {
this.offset = offset;
return sd();
} else {
return {
"string": sd(),
"length": offset - start
};
}
//? }
};
//? }

81
node_modules/bytebuffer/src/types/strings/istring.js generated vendored Normal file
View File

@ -0,0 +1,81 @@
//? if (ISTRING) {
// types/strings/istring
/**
* Writes a length as uint32 prefixed UTF8 encoded string.
* @param {string} str String to write
* @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
* written if omitted.
* @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written
* @expose
* @see ByteBuffer#writeVarint32
*/
ByteBufferPrototype.writeIString = function(str, offset) {
//? RELATIVE();
if (!this.noAssert) {
if (typeof str !== 'string')
throw TypeError("Illegal str: Not a string");
//? ASSERT_OFFSET();
}
var start = offset,
k;
//? if (NODE) {
k = Buffer.byteLength(str, "utf8");
//? ENSURE_CAPACITY('4+k');
//? WRITE_UINT32_ARRAY('k');
offset += 4;
offset += this.buffer.write(str, offset, k, "utf8");
//? } else {
k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1];
//? ENSURE_CAPACITY('4+k');
//? if (DATAVIEW)
this.view.setUint32(offset, k, this.littleEndian);
//? else
//? WRITE_UINT32_ARRAY('k');
offset += 4;
utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
//? if (DATAVIEW)
this.view.setUint8(offset++, b);
//? else
this.view[offset++] = b;
}.bind(this));
if (offset !== start + 4 + k)
throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+4+k));
//? }
if (relative) {
this.offset = offset;
return this;
}
return offset - start;
};
/**
* Reads a length as uint32 prefixed UTF8 encoded string.
* @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
* read if omitted.
* @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
* read and the actual number of bytes read.
* @expose
* @see ByteBuffer#readVarint32
*/
ByteBufferPrototype.readIString = function(offset) {
//? RELATIVE();
if (!this.noAssert) {
//? ASSERT_OFFSET(4);
}
var start = offset;
var len = this.readUint32(offset);
var str = this.readUTF8String(len, ByteBuffer.METRICS_BYTES, offset += 4);
offset += str['length'];
if (relative) {
this.offset = offset;
return str['string'];
} else {
return {
'string': str['string'],
'length': offset - start
};
}
};
//? }

Some files were not shown because too many files have changed in this diff Show More