diff --git a/README.md b/README.md index 12074b0..ddba1be 100644 --- a/README.md +++ b/README.md @@ -302,7 +302,7 @@ const type = new sb.StructType({ 3 /*3 characters in first field's name*/, 0x6f /*o*/, 0x6e /*n*/, 0x65 /*e*/, 0x50 /*TupleType*/, 0x20 /*FloatType*/, - 0, 0, 0, 3 /*3 floats in the tuple*/, + 3 /*3 floats in the tuple*/, 3 /*3 characters in second field's name*/, 0x74 /*t*/, 0x77 /*w*/, 0x6f /*o*/, 0xff, /*type is defined previously*/ 0, 11 /*type is defined 11 bytes before the 0 on this line*/ @@ -327,14 +327,14 @@ In the following definitions, `type` means the binary type format. - `DoubleType`: identifier `0x21` - `BooleanType`: identifier `0x30` - `BooleanTupleType`: identifier `0x31`, payload: - - `length` - `uint32_t` + - `length` - `uint8_t` - `BooleanArrayType`: identifier `0x32` - `CharType`: identifier `0x40` - `StringType`: identifier `0x41` - `OctetsType`: identifier `0x42` - `TupleType`: identifier `0x50`, payload: - `elementType` - `type` - - `length` - `uint32_t` + - `length` - `uint8_t` - `StructType`: identifier `0x51`, payload: - `fieldCount` - `uint8_t` - `fieldCount` instances of `field`: diff --git a/compiled/download.js b/compiled/download.js index c03b1cd..dd1311f 100644 --- a/compiled/download.js +++ b/compiled/download.js @@ -1,117 +1,118 @@ -!function(){var f={scope:{}};f.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(b,e,a){if(a.get||a.set)throw new TypeError("ES3 does not support getters and setters.");b!=Array.prototype&&b!=Object.prototype&&(b[e]=a.value)};f.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global&&null!=global?global:b};f.global=f.getGlobal(this);f.SYMBOL_PREFIX="jscomp_symbol_"; -f.initSymbol=function(){f.initSymbol=function(){};f.global.Symbol||(f.global.Symbol=f.Symbol)};f.symbolCounter_=0;f.Symbol=function(b){return f.SYMBOL_PREFIX+(b||"")+f.symbolCounter_++};f.initSymbolIterator=function(){f.initSymbol();var b=f.global.Symbol.iterator;b||(b=f.global.Symbol.iterator=f.global.Symbol("iterator"));"function"!=typeof Array.prototype[b]&&f.defineProperty(Array.prototype,b,{configurable:!0,writable:!0,value:function(){return f.arrayIterator(this)}});f.initSymbolIterator=function(){}}; -f.arrayIterator=function(b){var e=0;return f.iteratorPrototype(function(){return e=c}},"es6-impl","es3"); -f.polyfill("String.prototype.repeat",function(b){return b?b:function(b){var a=f.checkStringArgs(this,null,"repeat");if(0>b||1342177279>>=1)a+=a;return h}},"es6-impl","es3"); -require=function qa(e,a,h){function d(r,n){if(!a[r]){if(!e[r]){var l="function"==typeof require&&require;if(!n&&l)return l(r,!0);if(c)return c(r,!0);n=Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n;}n=a[r]={exports:{}};e[r][0].call(n.exports,function(c){var a=e[r][1][c];return d(a?a:c)},n,n.exports,qa,e,a,h)}return a[r].exports}for(var c="function"==typeof require&&require,u=0;ua.status||304===a.status?c[r]=a.response:c.text=a.statusText;d(a.status,a.statusText,c,a.getAllResponseHeaders())}); -a.open(u,c,l);a.responseType=r;for(var e in h)({}).hasOwnProperty.call(h,e)&&a.setRequestHeader(e,h[e]);a.send(n)},abort:function(){a&&a.abort()}}}})})(jQuery)},{}],"/client-side/common.js":[function(b){var e=b("/lib/assert.js");e.instanceOf(window.Map,Function);e.instanceOf(window.Set,Function);e.instanceOf(window.ArrayBuffer,Function);e.instanceOf(window.Uint8Array,Function);e.instanceOf(window.Symbol,Function);b("/client-side/binary-ajax.js");if(!window.sb){window.sb=b("/structure-types.js");b= -b("/recursive-registry.js");for(var a in b)({}).hasOwnProperty.call(b,a)&&(window.sb[a]=b[a])}else if(!(window.sb instanceof Object))throw Error("window.sb is already defined");},{"/client-side/binary-ajax.js":"/client-side/binary-ajax.js","/lib/assert.js":"/lib/assert.js","/recursive-registry.js":"/recursive-registry.js","/structure-types.js":"/structure-types.js"}],"/config.js":[function(b,e){var a="/";"/"===a&&(a="");a=b(a+"/lib/assert.js");b=b("base64-js");a.between(0,9,65536);a=new ArrayBuffer(2); -(new DataView(a)).setUint16(0,9);b=b.fromByteArray(new Uint8Array(a));e.exports={VERSION_STRING:b}},{"base64-js":2}],"/constructor-registry.js":[function(b,e){(function(a){"/"===a&&(a="");var b=new Map;e.exports={get:function(a){var c=b.get(a);if(c)return c;c={};c=(c[a]=function(){},c)[a];b.set(a,c);return c}}}).call(this,"/")},{}],"/lib/assert.js":[function(b,e){function a(){}var h=b("/lib/util-inspect.js");a.instanceOf=function(a,c){c instanceof Array||(c=[c]);for(var d=!1,b=f.makeIterator(c),n= -b.next();!n.done;n=b.next())if(n=n.value,a instanceof n||void 0!==a&&null!==a&&a.constructor===n){d=!0;break}if(!d)throw new TypeError(h.inspect(a)+" is not an instance of "+c.map(function(c){return c.name}).join(" or "));};a.integer=function(d){a.instanceOf(d,Number);if(!Number.isSafeInteger(d))throw new RangeError(h.inspect(d)+" is not an integer");};a.between=function(a,c,b,r){if(c=b){a=h.inspect(c)+" is not in ["+h.inspect(a)+","+h.inspect(b)+")";if(void 0===r)throw new RangeError(a);throw new RangeError(r+ -" ("+a+")");}};a.byteUnsignedInteger=function(b){a.integer(b);a.between(0,b,256)};a.twoByteUnsignedInteger=function(b){a.integer(b);a.between(0,b,65536)};a.fourByteUnsignedInteger=function(b){a.integer(b);a.between(0,b,4294967296)};a.fail=function(a){throw Error(a);};a.assert=function(b,c){b||a.fail(c)};a.throws=function(b,c){var d=!0;try{b(),d=!1}catch(r){void 0!==c&&a.message(r,c)}a.assert(d,"Should throw an error")};a.equal=function(b,c){var d=new RangeError("Expected "+h.inspect(c)+" but got "+ -h.inspect(b));if(c){var r=!0;switch(c.constructor){case Object:if(!b||b.constructor!==Object)throw d;for(var n in c)if({}.hasOwnProperty.call(c,n))try{a.equal(b[n],c[n])}catch(y){throw d;}break;case Array:if(!b||b.constructor!==Array)throw d;try{a.equal(b.length,c.length)}catch(y){throw d;}for(n=0;n>>3},modEight:function(a){return a&7}}},{}],"/lib/buffer-string.js":[function(b,e){(function(a){var h=b(a+"/assert.js"),d=b(a+"/growable-buffer.js");e.exports={toString:function(c){c&&c.constructor===ArrayBuffer&&(c=new Uint8Array(c));h.instanceOf(c,Uint8Array);for(var a=[],b=0;bd&&(l=d);break;case 2:x=c[b+1]; -128===(x&192)&&(d=(d&31)<<6|x&63,127d||57343d&&(l=d))}}void 0===l?(l=65533,e=1):65535>>10&1023|55296),l=56320|l&1023);a.push(l);b+=e}c="";for(b=0;ba?b.add(a):(2048>a?b.add(192|a>>6):(55296>a||57344<=a?b.add(224|a>>12):(a=65536+((a&1023)<<10|a&1023),b.add(240|a>>18),b.add(128|a>>12&63)),b.add(128|a>>6&63)),b.add(128|a&63));return b.toBuffer()},toBinaryString:function(c){h.instanceOf(c,ArrayBuffer);var b="";c=new Uint8Array(c);c=f.makeIterator(c);for(var a=c.next();!a.done;a=c.next())b+= -String.fromCharCode(a.value);return b},fromBinaryString:function(c){h.instanceOf(c,String);for(var a=new ArrayBuffer(c.length),b=new Uint8Array(a),d=0;dthis.buffer.byteLength&&(c=new ArrayBuffer(c<<1),(new Uint8Array(c)).set((new Uint8Array(this.buffer)).subarray(0,this.size)),this.buffer=c);return this};h.prototype.set=function(c,a){d.integer(c);d.between(0,c,this.size,"Index out of bounds: "+String(c));d.integer(a);d.between(0,a,256,"Not a byte: "+String(a));(new Uint8Array(this.buffer))[c]=a;return this};h.prototype.setAll=function(c,a){d.instanceOf(a,ArrayBuffer);d.integer(c);d.between(0,c,this.size- -a.byteLength+1,"Index out of bounds: "+String(c));(new Uint8Array(this.buffer)).set(new Uint8Array(a),c);return this};h.prototype.get=function(c){d.integer(c);d.between(0,c,this.size,"Index out of bounds: "+String(c));return(new Uint8Array(this.buffer))[c]};h.prototype.add=function(c){d.integer(c);d.between(0,c,256,"Not a byte: "+String(c));var a=this.size,b=a+1;this.grow(b);this.size=b;(new Uint8Array(this.buffer))[a]=c;return this};h.prototype.addAll=function(c){d.instanceOf(c,ArrayBuffer);var a= -this.size,b=this.size+c.byteLength;this.grow(b);this.size=b;(new Uint8Array(this.buffer)).set(new Uint8Array(c),a);return this};h.prototype.toBuffer=function(){return this.buffer.slice(0,this.size)};f.global.Object.defineProperties(h.prototype,{length:{configurable:!0,enumerable:!0,get:function(){return this.size}},rawBuffer:{configurable:!0,enumerable:!0,get:function(){return this.buffer}}});e.exports=h}).call(this,"/lib")},{}],"/lib/strint.js":[function(b,e){var a={};(function(){function b(a){return g(a)? -a.length-1:a.length}function d(a,c){x(a);v(c,"number");return c>=b(a)?"0":a.charAt(a.length-c-1)}function c(a,c){y(a);E(c);for(var b=0;ba)throw Error("Expected a positive number: "+a);}function v(a,c){if(typeof a!==c)throw Error("Not a "+c+": "+a);}var q=a.subPositive=function(a, -b){y(a);y(b);if(!I(a,b))throw Error("x must be greater or equal to y");for(var k=Math.max(a.length,b.length),z="",h=0,t=0,l=0;ld)throw Error("Illegal state");}};a.div=function(a,c,b){b=void 0===b?!1:b;x(a);x(c);var d=z(H(a),H(c))[0];l(a,c)||(d=Q(d));!b||D(t(d,c),a)||l(a,c)||(d=O(d,"1"));return d};var D=a.eq=function(a,c){return K(a)===K(c)},k=a.lt=function(a,c){return g(a)&&N(c)?!0:N(a)&&g(c)?!1:g(a)&&g(c)?!D(a,c)&&!r(H(a), -H(c)):r(a,c)},I=a.ge=function(a,c){return!k(a,c)},p=a.gt=function(a,c){return D(a,c)?!1:I(a,c)},g=a.isNegative=function(a){x(a);return 0===a.indexOf("-")},N=a.isPositive=function(a){return!g(a)},H=a.abs=function(a){return g(a)?Q(a):a},Q=a.negate=function(a){return"0"===a?"0":g(a)?a.slice(1):"-"+a},W=/^(-?)0*([1-9][0-9]*)$/,X=/^0+$/,K=a.normalize=function(a){if(X.test(a))return"0";var c=W.exec(a);if(!c)throw Error("Illegal strint format: "+a);return c[1]+c[2]}})();a.LONG_UPPER_SHIFT="4294967296";a.BYTE_SHIFT= -"256";e.exports=a},{}],"/lib/util-inspect.js":[function(b,e,a){a.inspect=function(b){if(void 0===b)return"undefined";if(null===b||b.constructor===Object||b.constructor===Array||b.constructor===String||b.constructor===Number||b.constructor===Boolean||b.constructor===Date)return JSON.stringify(b);if(b.constructor===Set){var d="Set {";b=b.values();for(var c=b.next();!c.done;)d+=a.inspect(c.value),c=b.next(),c.done||(d+=", ");return d+"}"}if(b.constructor===Map){d="Map {";b=b.entries();for(c=b.next();!c.done;)d+= -a.inspect(c.value[0]),d+=" \x3d\x3e ",d+=a.inspect(c.value[1]),c=b.next(),c.done||(d+=", ");return d+"}"}return b.constructor.name?b.constructor.name+" "+JSON.stringify(b):JSON.stringify(b)}},{}],1:[function(b){(function(){function e(){var a={},b;for(b in c)a[b]={sig:c[b].sig,type:h.fromByteArray(new Uint8Array(c[b].type.toBuffer()))};localStorage.typeCache=JSON.stringify(a)}b("/client-side/common.js");var a=b("/lib/assert.js"),h=b("base64-js"),d=b("/read.js"),c={};if(localStorage.typeCache){var u= -JSON.parse(localStorage.typeCache),r;for(r in u)c[r]={sig:u[r].sig,type:d.type((new Uint8Array(h.toByteArray(u[r].type))).buffer)}}else e();sb.download=function(b,l){function h(a,c,b){if(r){r instanceof Array||(r=[r]);for(var d=f.makeIterator(r),l=d.next();!l.done;l=d.next())l=l.value,l(a,c,b)}}a.instanceOf(b,String);a.instanceOf(l,Object);l.dataType="arraybuffer";var n;c[b]?(n=!0,l.headers||(l.headers={}),l.headers.sig=c[b].sig):n=!1;var r=l.success;l.success=function(a,l,r){var q=r.getResponseHeader("sig"); -if(n&&c[b].sig===q)q=d.value({buffer:a,type:c[b].type}),h(q,l,r);else{var x=d._consumeType(a,0);a=d.value({buffer:a,offset:x.length,type:x.value});c[b]={sig:q,type:x.value};e();h(a,l,r)}};$.ajax(l)}})()},{"/client-side/common.js":"/client-side/common.js","/lib/assert.js":"/lib/assert.js","/read.js":"/read.js","base64-js":2}],2:[function(b,e,a){function h(a){var c=a.length;if(0>18&63]+c[b>>12&63]+c[b>>6&63]+c[b&63]);return l.join("")}a.byteLength=function(a){return 3*a.length/4-h(a)};a.toByteArray=function(a){var c,b,d,e,n;c=a.length;e=h(a);n=new r(3*c/4-e);b=0>16&255,n[v++]=d>>8&255,n[v++]=d&255;2===e?(d=u[a.charCodeAt(c)]<<2|u[a.charCodeAt(c+1)]>>4,n[v++]=d&255): -1===e&&(d=u[a.charCodeAt(c)]<<10|u[a.charCodeAt(c+1)]<<4|u[a.charCodeAt(c+2)]>>2,n[v++]=d>>8&255,n[v++]=d&255);return n};a.fromByteArray=function(a){for(var b=a.length,h=b%3,e="",r=[],n=0,u=b-h;nu?u:n+16383));1===h?(a=a[b-1],e+=c[a>>2],e+=c[a<<4&63],e+="\x3d\x3d"):2===h&&(a=(a[b-2]<<8)+a[b-1],e+=c[a>>10],e+=c[a>>4&63],e+=c[a<<2&63],e+="\x3d");r.push(e);return r.join("")};var c=[],u=[],r="undefined"!==typeof Uint8Array?Uint8Array:Array;for(b=0;64>b;++b)c[b]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b], -u["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(b)]=b;u[45]=62;u[95]=63},{}],3:[function(b,e){!function(a){function b(a){return a.map(function(a){a=a.toString(16);a=2>>5]|=e[r]<<24-E%32;a=8*a.length;n[a>>5]|=128<<24-a%32;n[(a+64>>9<<4)+15]=a;for(a=0;aD;D++){if(16>D)u[D]=r[E+ -D]|0;else{var k=u[D-15],I=u[D-2];u[D]=((k<<25|k>>>7)^(k<<14|k>>>18)^k>>>3)+u[D-7]+((I<<15|I>>>17)^(I<<13|I>>>19)^I>>>10)+u[D-16]}k=z+((G<<26|G>>>6)^(G<<21|G>>>11)^(G<<7|G>>>25))+(G&L^~G&t)+c[D]+u[D];I=((v<<30|v>>>2)^(v<<19|v>>>13)^(v<<10|v>>>22))+(v&q^v&J^q&J);z=t;t=L;L=G;G=O+k|0;O=J;J=q;q=v;v=k+I|0}e[0]=e[0]+v|0;e[1]=e[1]+q|0;e[2]=e[2]+J|0;e[3]=e[3]+O|0;e[4]=e[4]+G|0;e[5]=e[5]+L|0;e[6]=e[6]+t|0;e[7]=e[7]+z|0}n=[];for(a=0;a<32*h.length;a+=8)n.push(h[a>>>5]>>>24-a%32&255);return b&&b.asBytes?n:b&& -b.asString?d.convertString.bytesToString(n):d.bytesToHex(n)}var d={};"undefined"!==typeof e&&e.exports?(d.bytesToHex=b("convert-hex").bytesToHex,d.convertString=b("convert-string"),e.exports=h):(d.bytesToHex=a.convertHex.bytesToHex,d.convertString=a.convertString,a.sha256=h);var c=[];!function(){function a(a){for(var b=Math.sqrt(a),c=2;c<=b;c++)if(!(a%c))return!1;return!0}function b(a){return 4294967296*(a-(a|0))|0}for(var d=2,e=0;64>e;)a(d)&&(c[e]=b(Math.pow(d,1/3)),e++),d++}();var u=[];h.x2=function(a, -b){return h(h(a,{asBytes:!0}),b)}}(this)},{"convert-hex":3,"convert-string":4}],"/read.js":[function(b,e){(function(a){function h(a,b){try{return{value:(new DataView(a)).getUint32(b),length:4}}catch(D){l.fail("Buffer is not long enough")}}function d(a,b){return a.length=c+d,"Buffer is not long enough");b=new Uint8Array(b);for(e=0;eg;g++){var t=8*e+g;if(t===a.length)break;a[t]=!!(h&1<=k+g,"Buffer is not long enough");p=(new Int8Array(b))[k];break;case q.ShortType:g=2;l.assert(b.byteLength>=k+g,"Buffer is not long enough");p=(new DataView(b)).getInt16(k);break;case q.IntType:g=4;p=(new DataView(b)).getInt32(k);break;case q.LongType:case q.DateType:g=8;l.assert(b.byteLength>=k+g,"Buffer is not long enough");p=new DataView(b);b=p.getInt32(k);k=p.getUint32(k+4);p=v.add(v.mul(String(b),v.LONG_UPPER_SHIFT),String(k));e.constructor===q.DateType&&(p=new Date(Number(p))); -break;case q.BigIntType:g=2;l.assert(b.byteLength>=k+g,"Buffer is not long enough");d=new DataView(b);e=d.getUint16(k);l.assert(b.byteLength>=k+g+e,"Buffer is not long enough");p=e?String(d.getInt8(k+g)):"0";for(b=1;b=k+g,"Buffer is not long enough");p=(new Uint8Array(b))[k];break;case q.UnsignedShortType:g=2;l.assert(b.byteLength>=k+g,"Buffer is not long enough"); -p=(new DataView(b)).getUint16(k);break;case q.UnsignedIntType:g=4;l.assert(b.byteLength>=k+g,"Buffer is not long enough");p=(new DataView(b)).getUint32(k);break;case q.UnsignedLongType:g=8;l.assert(b.byteLength>=k+g,"Buffer is not long enough");p=new DataView(b);b=p.getUint32(k);k=p.getUint32(k+4);p=v.add(v.mul(String(b),v.LONG_UPPER_SHIFT),String(k));break;case q.BigUnsignedIntType:g=2;l.assert(b.byteLength>=k+g,"Buffer is not long enough");d=new DataView(b);e=d.getUint16(k);l.assert(b.byteLength>= -k+g+e,"Buffer is not long enough");p="0";for(b=0;b=k+g,"Buffer is not long enough");b=new DataView(b);k=(b.getInt16(k)<<8|b.getUint8(k+2))*q.MILLIS_PER_DAY;p=new Date(k+(new Date(k)).getTimezoneOffset()*q.MILLIS_PER_MINUTE);break;case q.TimeType:g=4;l.assert(b.byteLength>=k+g,"Buffer is not long enough");p=new Date((new DataView(b)).getUint32(k));break;case q.FloatType:g=4; -l.assert(b.byteLength>=k+g,"Buffer is not long enough");p=(new DataView(b)).getFloat32(k);break;case q.DoubleType:g=8;l.assert(b.byteLength>=k+g,"Buffer is not long enough");p=(new DataView(b)).getFloat64(k);break;case q.BooleanType:g=1;l.assert(b.byteLength>k,"Buffer is not long enough");k=(new Uint8Array(b))[k];l.assert(0===k||255===k,"0x"+k.toString(16)+" is an invalid Boolean value");p=!!k;break;case q.BooleanArrayType:p=h(b,k);g=p.length;k=u({buffer:b,offset:k+g,count:p.value,baseValue:a});g+= -k.length;p=k.value;break;case q.BooleanTupleType:g=u({buffer:b,offset:k,count:e.length,baseValue:a});p=g.value;g=g.length;break;case q.CharType:l.assert(b.byteLength>k,"Buffer is not long enough");p=x.toString((new Uint8Array(b)).subarray(k,k+4))[0];g=x.fromString(p).byteLength;break;case q.StringType:p=new Uint8Array(b);for(g=0;l.assert(b.byteLength>k+g,"Buffer is not long enough"),p[k+g];g++);p=x.toString((new Uint8Array(b)).subarray(k,k+g));g++;break;case q.OctetsType:p=h(b,k);g=p.length;d=g+p.value; -l.assert(b.byteLength>=k+d,"Buffer is not long enough");p=b.slice(k+g,k+d);g=d;break;case q.TupleType:g=0;p=a||c(e);for(a=0;ak,"Buffer is not long enough");k=(new Uint8Array(b))[k];p=e.values[k];void 0===p&&l.fail("Index "+String(k)+" is invalid");break;case q.ChoiceType:g=1;l.assert(b.byteLength>k,"Buffer is not long enough");p=(new Uint8Array(b))[k];k=r({buffer:b,pointerStart:d,offset:k+g,type:e.types[p]});g+=k.length;p=k.value;break;case q.NamedChoiceType:g=1;l.assert(b.byteLength>k,"Buffer is not long enough");p=(new Uint8Array(b))[k];a=e.indexConstructors.get(p).name;a=y.get(a);k=r({buffer:b, -pointerStart:d,offset:k+g,type:e.constructorTypes[p].type,baseValue:new a});g+=k.length;p=k.value;break;case q.RecursiveType:g=1;l.assert(b.byteLength>k,"Buffer is not long enough");p=(new Uint8Array(b))[k];l.assert(0===p||255===p,"0x"+p.toString(16)+" is an invalid Recursive byte");p?(e=e.type,p=c(e),G.has(b)||G.set(b,new Map),G.get(b).set(k+g,p),g+=r({buffer:b,pointerStart:d,offset:k+g,type:e,baseValue:p}).length):(d=h(b,k+g),k=k+g-d.value,p=G.get(b).get(k),l.assert(void 0!==p,"Cannot find target at "+ -String(k)),g+=d.length);break;case q.OptionalType:g=1;l.assert(b.byteLength>k,"Buffer is not long enough");p=(new Uint8Array(b))[k];l.assert(0===p||255===p,"0x"+p.toString(16)+" is an invalid Optional byte");p?(k=r({buffer:b,pointerStart:d,offset:k+g,type:e.type}),g+=k.length,p=k.value):p=null;break;case q.PointerType:k=h(b,k);g=k.length;p=r({buffer:b,pointerStart:d,offset:d+k.value,type:e.type}).value;break;default:l.fail("Not a structure type: "+J.inspect(e))}return{value:p,length:g}}function n(a, -b){l.assert(0<=b,"Offset is negative: "+String(b));l.assert(a.byteLength>b,"Buffer is not long enough");for(var c,e=1,u=(new Uint8Array(a))[b],p=f.makeIterator(O),g=p.next();!g.done;g=p.next())if(g=g.value,u===g._value)return{value:new g,length:e};switch(u){case q.BooleanTupleType._value:a=h(a,b+e);c=new q.BooleanTupleType(a.value);e+=a.length;break;case q.TupleType._value:var t=n(a,b+e),e=e+t.length;a=h(a,b+e);e+=a.length;c=new q.TupleType({type:t.value,length:a.value});break;case q.StructType._value:l.assert(a.byteLength> -b+e,"Buffer is not long enough");t=new Uint8Array(a);c=t[b+e];e++;u={};for(p=0;pb+e,"Buffer is not long enough");g=t[b+e];e++;var v=b+e,z=v+g;l.assert(a.byteLength>=z,"Buffer is not long enough");v=x.toString(t.subarray(v,z));e+=g;g=n(a,z);u[v]=g.value;e+=g.length}c=new q.StructType(u);break;case q.ArrayType._value:a=n(a,b+e);e+=a.length;c=new q.ArrayType(a.value);break;case q.SetType._value:a=n(a,b+e);e+=a.length;c=new q.SetType(a.value);break;case q.MapType._value:t= -n(a,b+e);e+=t.length;a=n(a,b+e);e+=a.length;c=new q.MapType(t.value,a.value);break;case q.EnumType._value:t=n(a,b+e);e+=t.length;l.assert(a.byteLength>b+e,"Buffer is not long enough");c=(new Uint8Array(a))[b+e];e++;u=Array(c);for(p=0;pb+e,"Buffer is not long enough");t=(new Uint8Array(a))[b+e];e++;c=Array(t);for(u= -0;ub+e,"Buffer is not long enough");t=new Uint8Array(a);c=t[b+e];e++;u=new Map;for(p=0;pb+e,"Buffer is not long enough"),g=t[b+e],e++,v=b+e,z=v+g,l.assert(a.byteLength>=z,"Buffer is not long enough"),v=x.toString(t.subarray(v,z)),e+=g,g=n(a,z),u.set(y.get(v),g.value),e+=g.length;c=new q.NamedChoiceType(u);break;case q.RecursiveType._value:l.assert(a.byteLength>= -b+e+2,"Buffer is not long enough");c=(new DataView(a)).getUint16(b+e);e+=2;(u=L.get(a))?t=u.get(c):(u=new Map,L.set(a,u));if(!t){do for(t="read-type",p=0;16>p;p++)t+=Math.floor(16*Math.random()).toString(16);while(E.isRegistered(t));u.set(c,t);a=n(a,b+e);e+=a.length;E.registerType({type:a.value,name:t})}c=new q.RecursiveType(t);break;case q.OptionalType._value:a=n(a,b+e);e+=a.length;c=new q.OptionalType(a.value);break;case q.PointerType._value:a=n(a,b+e);e+=a.length;c=new q.PointerType(a.value);break; -case q.REPEATED_TYPE:t=e+2;l.assert(a.byteLength>=b+t,"Buffer is not long enough");c=(new DataView(a)).getUint16(b+e);c=n(a,b+e-c).value;e=t;break;default:l.fail("No such type: 0x"+d((new Uint8Array(a))[b].toString(16),2))}return{value:c,length:e}}"/"===a&&(a="");var l=b(a+"/lib/assert.js"),M=b(a+"/lib/bit-math.js"),x=b(a+"/lib/buffer-string.js"),y=b(a+"/constructor-registry.js"),E=b(a+"/recursive-registry.js"),v=b(a+"/lib/strint.js"),q=b(a+"/structure-types.js"),J=b("/lib/util-inspect.js"),O=[q.ByteType, -q.ShortType,q.IntType,q.LongType,q.BigIntType,q.UnsignedByteType,q.UnsignedShortType,q.UnsignedIntType,q.UnsignedLongType,q.BigUnsignedIntType,q.DateType,q.DayType,q.TimeType,q.FloatType,q.DoubleType,q.BooleanType,q.BooleanArrayType,q.CharType,q.StringType,q.OctetsType],G=new WeakMap,L=new WeakMap;e.exports={_consumeType:n,type:function(a,b){b=void 0===b?!0:b;l.instanceOf(a,ArrayBuffer);var c=n(a,0),d=c.value,c=c.length;b&&l.assert(c===a.byteLength,"Did not consume all of the buffer");return d},value:function(a){var b= -a.buffer,c=a.type;a=void 0===a.offset?0:a.offset;l.instanceOf(b,ArrayBuffer);l.instanceOf(c,q.Type);l.instanceOf(a,Number);return r({buffer:b,offset:a,type:c,pointerStart:a}).value}}}).call(this,"/")},{"/lib/util-inspect.js":"/lib/util-inspect.js"}],"/recursive-registry.js":[function(b,e){(function(a){"/"===a&&(a="");var h=b(a+"/lib/assert.js"),d=b(a+"/structure-types.js"),c=new Map;e.exports={registerType:function(a){var b=a.type;a=a.name;h.instanceOf(b,[d.ArrayType,d.MapType,d.SetType,d.StructType, -d.TupleType]);h.instanceOf(a,String);h.assert(!c.has(a),'"'+a+'" is already a registered type');c.set(a,b)},getType:function(a){h.instanceOf(a,String);var b=c.get(a);h.assert(void 0!==b,'"'+a+'" is not a registered type');return b},isRegistered:function(a){return c.has(a)}}}).call(this,"/")},{}],"/structure-types.js":[function(b,e){(function(a){function h(a){m.instanceOf(a,w);this.type=a}function d(a){w.call(this);m.instanceOf(a,F);this.type=a}function c(a){w.call(this);m.instanceOf(a,String);this.name= -a}function u(a){w.call(this);m.instanceOf(a,Map);try{m.byteUnsignedInteger(a.size)}catch(U){m.fail(String(a.size)+" types is too many")}this.indexConstructors=new Map;this.constructorTypes=Array(a.size);var b=new Set;a=f.makeIterator(a);for(var c=a.next();!c.done;c=a.next()){var d=f.makeIterator(c.value),c=d.next().value,d=d.next().value;m.instanceOf(c,Function);var B=c.name;m.assert(B,'Function "'+String(B)+'" does not have a name');m.assert(!b.has(B),'Function name "'+B+'" is repeated');b.add(B); -var e=S.fromString(B);try{m.byteUnsignedInteger(e.byteLength)}catch(U){m.fail('Function name "'+B+'" is too long')}m.instanceOf(d,y);B=this.indexConstructors.size;this.indexConstructors.set(B,c);this.constructorTypes[B]={nameBuffer:e,type:d}}}function r(a){w.call(this);m.instanceOf(a,Array);try{m.byteUnsignedInteger(a.length)}catch(ra){m.fail(String(a.length)+" types is too many")}for(var b=f.makeIterator(a),c=b.next();!c.done;c=b.next())m.instanceOf(c.value,F);this.types=a}function n(a){var b=a.type; -a=a.values;m.instanceOf(b,w);m.instanceOf(a,Array);try{m.byteUnsignedInteger(a.length)}catch(U){m.fail(String(a.length)+" values is too many")}for(var c=new Map,d=0;db.name)return 1})}function E(a){var b=a.type;a=a.length;w.call(this);m.instanceOf(b,F);m.fourByteUnsignedInteger(a);this.type=b;this.length=a}function v(a){w.apply(this,arguments)}function q(a){w.apply(this,arguments)}function J(a){w.apply(this,arguments)}function O(a){w.apply(this,arguments)}function G(a){w.call(this);m.fourByteUnsignedInteger(a);this.length=a}function L(a){w.apply(this,arguments)} -function t(a){D.apply(this,arguments)}function z(a){D.apply(this,arguments)}function D(a){w.apply(this,arguments)}function k(a){g.apply(this,arguments)}function I(a){g.apply(this,arguments)}function p(a){g.apply(this,arguments)}function g(a){w.apply(this,arguments)}function N(a){K.apply(this,arguments)}function H(a){K.apply(this,arguments)}function Q(a){K.apply(this,arguments)}function W(a){K.apply(this,arguments)}function X(a){K.apply(this,arguments)}function K(a){w.apply(this,arguments)}function Y(a){P.apply(this, -arguments)}function Z(a){P.apply(this,arguments)}function aa(a){P.apply(this,arguments)}function ba(a){P.apply(this,arguments)}function ca(a){P.apply(this,arguments)}function P(a){w.apply(this,arguments)}function w(a){F.apply(this,arguments)}function F(){}function V(a){var b=new ArrayBuffer(4);(new DataView(b)).setUint32(0,a);return b}function R(a,b){if(b&&(b=fa.get(a))){b=f.makeIterator(b);for(var c=b.next();!c.done;c=b.next()){var d=f.makeIterator(c.value),c=d.next().value,d=d.next().value,e=a.length; -a.addAll(S.fromBinaryString(c));c=new ArrayBuffer(4);(new DataView(c)).setUint32(0,e);d=f.makeIterator(d);for(e=d.next();!e.done;e=d.next())a.setAll(e.value,c)}}}function T(a){if(a&&a.constructor===String&&(a=Number(a),!isNaN(a)))return a}function la(a,b){m.instanceOf(a,A);m.instanceOf(b,String);(C.gt(b,"9223372036854775807")||C.lt(b,"-9223372036854775808"))&&m.fail("Value out of range");var c=C.div(b,C.LONG_UPPER_SHIFT,!0);b=C.sub(b,C.mul(c,C.LONG_UPPER_SHIFT));var d=new ArrayBuffer(8),e=new DataView(d); -e.setInt32(0,Number(c));e.setUint32(4,Number(b));a.addAll(d)}function ma(a,b){m.instanceOf(b,Array);for(var c=ga(b.length),d=ha(b.length),c=new ArrayBuffer(c?d+1:d),d=new Uint8Array(c),e=0;e>8);d.setUint8(2,b&255);a.addAll(c)};f.global.Object.defineProperties(I,{_value:{configurable:!0,enumerable:!0,get:function(){return 27}}}); -f.inherits(k,g);k.prototype.writeValue=function(a,b){m.instanceOf(b,Date);var c=new ArrayBuffer(4);(new DataView(c)).setUint32(0,b.getTime()%864E5);a.addAll(c)};f.global.Object.defineProperties(k,{_value:{configurable:!0,enumerable:!0,get:function(){return 28}}});f.inherits(D,w);f.inherits(z,D);z.prototype.writeValue=function(a,b){m.instanceOf(a,A);var c=T(b);void 0!==c&&(b=c);m.instanceOf(b,Number);c=new ArrayBuffer(4);(new DataView(c)).setFloat32(0,b);a.addAll(c)};f.global.Object.defineProperties(z, -{_value:{configurable:!0,enumerable:!0,get:function(){return 32}}});f.inherits(t,D);t.prototype.writeValue=function(a,b){m.instanceOf(a,A);var c=T(b);void 0!==c&&(b=c);m.instanceOf(b,Number);c=new ArrayBuffer(8);(new DataView(c)).setFloat64(0,b);a.addAll(c)};f.global.Object.defineProperties(t,{_value:{configurable:!0,enumerable:!0,get:function(){return 33}}});f.inherits(L,w);L.prototype.writeValue=function(a,b){m.instanceOf(a,A);m.instanceOf(b,Boolean);b?a.add(255):a.add(0)};f.global.Object.defineProperties(L, -{_value:{configurable:!0,enumerable:!0,get:function(){return 48}}});f.inherits(G,w);G.prototype.addToBuffer=function(a){w.prototype.addToBuffer.call(this,a)&&a.addAll(V(this.length))};G.prototype.writeValue=function(a,b){m.instanceOf(a,A);m.instanceOf(b,Array);b.length!==this.length&&m.fail("Length does not match");ma(a,b)};f.global.Object.defineProperties(G,{_value:{configurable:!0,enumerable:!0,get:function(){return 49}}});f.inherits(O,w);O.prototype.writeValue=function(a,b){m.instanceOf(b,Array); -m.fourByteUnsignedInteger(b.length);a.addAll(V(b.length));ma(a,b)};f.global.Object.defineProperties(O,{_value:{configurable:!0,enumerable:!0,get:function(){return 50}}});f.inherits(J,w);J.prototype.writeValue=function(a,b){m.instanceOf(a,A);m.instanceOf(b,String);m.assert(1===b.length,"String must contain only 1 character");a.addAll(S.fromString(b))};f.global.Object.defineProperties(J,{_value:{configurable:!0,enumerable:!0,get:function(){return 64}}});f.inherits(q,w);q.prototype.writeValue=function(a, -b){m.instanceOf(a,A);m.instanceOf(b,String);b=S.fromString(b);a.addAll(b);a.add(0)};f.global.Object.defineProperties(q,{_value:{configurable:!0,enumerable:!0,get:function(){return 65}}});f.inherits(v,w);v.prototype.writeValue=function(a,b){m.instanceOf(a,A);m.instanceOf(b,ArrayBuffer);m.fourByteUnsignedInteger(b.byteLength);a.addAll(V(b.byteLength));a.addAll(b)};f.global.Object.defineProperties(v,{_value:{configurable:!0,enumerable:!0,get:function(){return 66}}});f.inherits(E,w);E.prototype.addToBuffer= -function(a){w.prototype.addToBuffer.call(this,a)&&(this.type.addToBuffer(a),a.addAll(V(this.length)))};E.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;m.instanceOf(a,A);m.instanceOf(b,Array);b.length!==this.length&&m.fail("Length does not match: expected "+String(this.length)+" but got "+b.length);b=f.makeIterator(b);for(var d=b.next();!d.done;d=b.next())this.type.writeValue(a,d.value,!1);R(a,c)};f.global.Object.defineProperties(E,{_value:{configurable:!0,enumerable:!0,get:function(){return 80}}}); -f.inherits(y,w);y.prototype.addToBuffer=function(a){if(w.prototype.addToBuffer.call(this,a)){a.add(this.fields.length);for(var b=f.makeIterator(this.fields),c=b.next();!c.done;c=b.next()){var c=c.value,d=c.buffer;a.add(d.byteLength);a.addAll(d);c.type.addToBuffer(a)}}};y.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;m.instanceOf(a,A);m.instanceOf(b,Object);for(var d=f.makeIterator(this.fields),e=d.next();!e.done;e=d.next()){var e=e.value,g=b[e.name];try{e.type.writeValue(a,g,!1)}catch(U){throw void 0=== -g&&m.fail('Value for field "'+e.name+'" missing'),U;}}R(a,c)};f.global.Object.defineProperties(y,{_value:{configurable:!0,enumerable:!0,get:function(){return 81}}});f.inherits(x,w);x.prototype.addToBuffer=function(a){w.prototype.addToBuffer.call(this,a)&&this.type.addToBuffer(a)};x.prototype._writeValue=function(a,b,c){m.instanceOf(a,A);var d=b.length;void 0===d&&(d=b.size);m.fourByteUnsignedInteger(d);a.addAll(V(d));b=f.makeIterator(b);for(d=b.next();!d.done;d=b.next())this.type.writeValue(a,d.value, -!1);R(a,c)};x.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;m.instanceOf(b,Array);this._writeValue(a,b,c)};f.global.Object.defineProperties(x,{_value:{configurable:!0,enumerable:!0,get:function(){return 82}}});f.inherits(M,x);M.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;m.instanceOf(b,Set);this._writeValue(a,b,c)};f.global.Object.defineProperties(M,{_value:{configurable:!0,enumerable:!0,get:function(){return 83}}});f.inherits(l,w);l.prototype.addToBuffer=function(a){w.prototype.addToBuffer.call(this, -a)&&(this.keyType.addToBuffer(a),this.valueType.addToBuffer(a))};l.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;m.instanceOf(a,A);m.instanceOf(b,Map);m.fourByteUnsignedInteger(b.size);a.addAll(V(b.size));b=f.makeIterator(b);for(var d=b.next();!d.done;d=b.next()){var e=f.makeIterator(d.value),d=e.next().value,e=e.next().value;this.keyType.writeValue(a,d,!1);this.valueType.writeValue(a,e,!1)}R(a,c)};f.global.Object.defineProperties(l,{_value:{configurable:!0,enumerable:!0,get:function(){return 84}}}); -f.inherits(n,F);n.prototype.addToBuffer=function(a){if(F.prototype.addToBuffer.call(this,a)){this.type.addToBuffer(a);a.add(this.valueIndices.size);for(var b=f.makeIterator(this.valueIndices),c=b.next();!c.done;c=b.next()){var c=f.makeIterator(c.value),d=c.next().value;c.next();a.addAll(S.fromBinaryString(d))}}};n.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;m.instanceOf(a,A);var d=new A;this.type.writeValue(d,b,!1);d=this.valueIndices.get(S.toBinaryString(d.toBuffer()));m.assert(void 0!== -d,"Not a valid enum value: "+da.inspect(b));a.add(d);R(a,c)};f.global.Object.defineProperties(n,{_value:{configurable:!0,enumerable:!0,get:function(){return 85}}});f.inherits(r,w);r.prototype.addToBuffer=function(a){if(w.prototype.addToBuffer.call(this,a)){a.add(this.types.length);for(var b=f.makeIterator(this.types),c=b.next();!c.done;c=b.next())c.value.addToBuffer(a)}};r.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;m.instanceOf(a,A);for(var d=!1,e=0;e=c}},"es6-impl","es3"); +h.polyfill("String.prototype.repeat",function(b){return b?b:function(b){var a=h.checkStringArgs(this,null,"repeat");if(0>b||1342177279>>=1)a+=a;return e}},"es6-impl","es3"); +require=function ra(g,a,e){function d(r,m){if(!a[r]){if(!g[r]){var p="function"==typeof require&&require;if(!m&&p)return p(r,!0);if(c)return c(r,!0);m=Error("Cannot find module '"+r+"'");throw m.code="MODULE_NOT_FOUND",m;}m=a[r]={exports:{}};g[r][0].call(m.exports,function(c){var a=g[r][1][c];return d(a?a:c)},m,m.exports,ra,g,a,e)}return a[r].exports}for(var c="function"==typeof require&&require,t=0;ta.status||304===a.status?c[r]=a.response:c.text=a.statusText;d(a.status,a.statusText,c,a.getAllResponseHeaders())}); +a.open(t,c,p);a.responseType=r;for(var g in e)({}).hasOwnProperty.call(e,g)&&a.setRequestHeader(g,e[g]);a.send(m)},abort:function(){a&&a.abort()}}}})})(jQuery)},{}],"/client-side/common.js":[function(b){var g=b("/lib/assert.js");g.instanceOf(window.Map,Function);g.instanceOf(window.Set,Function);g.instanceOf(window.ArrayBuffer,Function);g.instanceOf(window.Uint8Array,Function);g.instanceOf(window.Symbol,Function);b("/client-side/binary-ajax.js");if(!window.sb){window.sb=b("/structure-types.js");b= +b("/recursive-registry.js");for(var a in b)({}).hasOwnProperty.call(b,a)&&(window.sb[a]=b[a])}else if(!(window.sb instanceof Object))throw Error("window.sb is already defined");},{"/client-side/binary-ajax.js":"/client-side/binary-ajax.js","/lib/assert.js":"/lib/assert.js","/recursive-registry.js":"/recursive-registry.js","/structure-types.js":"/structure-types.js"}],"/config.js":[function(b,g){b=b("base64-js");var a=new ArrayBuffer(2);(new DataView(a)).setUint16(0,10);b=b.fromByteArray(new Uint8Array(a)); +g.exports={VERSION_STRING:b}},{"base64-js":2}],"/constructor-registry.js":[function(b,g){(function(a){"/"===a&&(a="");var b=new Map;g.exports={get:function(a){var c=b.get(a);if(c)return c;c={};c=(c[a]=function(){},c)[a];b.set(a,c);return c}}}).call(this,"/")},{}],"/lib/assert.js":[function(b,g){function a(){}var e=b("/lib/util-inspect.js");a.instanceOf=function(a,c){c instanceof Array||(c=[c]);for(var d=!1,b=h.makeIterator(c),m=b.next();!m.done;m=b.next())if(m=m.value,a instanceof m||void 0!==a&& +null!==a&&a.constructor===m){d=!0;break}if(!d)throw new TypeError(e.inspect(a)+" is not an instance of "+c.map(function(c){return c.name}).join(" or "));};a.integer=function(d){a.instanceOf(d,Number);if(!Number.isSafeInteger(d))throw new RangeError(e.inspect(d)+" is not an integer");};a.between=function(a,c,b,r){if(c=b){a=e.inspect(c)+" is not in ["+e.inspect(a)+","+e.inspect(b)+")";if(void 0===r)throw new RangeError(a);throw new RangeError(r+" ("+a+")");}};a.byteUnsignedInteger=function(b){a.integer(b); +a.between(0,b,256)};a.twoByteUnsignedInteger=function(b){a.integer(b);a.between(0,b,65536)};a.fourByteUnsignedInteger=function(b){a.integer(b);a.between(0,b,4294967296)};a.fail=function(a){throw Error(a);};a.assert=function(b,c){b||a.fail(c)};a.throws=function(b,c){var d=!0;try{b(),d=!1}catch(r){void 0!==c&&a.message(r,c)}a.assert(d,"Should throw an error")};a.equal=function(b,c){var d=new RangeError("Expected "+e.inspect(c)+" but got "+e.inspect(b));if(c){var r=!0;switch(c.constructor){case Object:if(!b|| +b.constructor!==Object)throw d;for(var m in c)if({}.hasOwnProperty.call(c,m))try{a.equal(b[m],c[m])}catch(x){throw d;}break;case Array:if(!b||b.constructor!==Array)throw d;try{a.equal(b.length,c.length)}catch(x){throw d;}for(m=0;m>> +3},modEight:function(b){return b&7}}},{}],"/lib/buffer-string.js":[function(b,g){(function(a){var e=b(a+"/assert.js"),d=b(a+"/growable-buffer.js");g.exports={toString:function(c){c&&c.constructor===ArrayBuffer&&(c=new Uint8Array(c));e.instanceOf(c,Uint8Array);for(var b=[],a=0;ad&&(p=d);break;case 2:w=c[a+1];128===(w&192)&&(d=(d&31)<<6|w&63,127d||57343d&&(p=d))}}void 0===p?(p=65533,g=1):65535>>10&1023|55296),p=56320|p&1023);b.push(p);a+=g}c="";for(a=0;aa?b.add(a):(2048>a?b.add(192|a>>6):(55296>a||57344<=a?b.add(224|a>>12):(a=65536+((a&1023)<<10|a&1023),b.add(240|a>>18),b.add(128|a>>12&63)),b.add(128|a>>6&63)),b.add(128|a&63));return b.toBuffer()},toBinaryString:function(c){e.instanceOf(c,ArrayBuffer);var a="";c=new Uint8Array(c);c=h.makeIterator(c);for(var b=c.next();!b.done;b=c.next())a+=String.fromCharCode(b.value);return a},fromBinaryString:function(c){e.instanceOf(c, +String);for(var a=new ArrayBuffer(c.length),b=new Uint8Array(a),d=0;dthis.buffer.byteLength&&(c=new ArrayBuffer(c<< +1),(new Uint8Array(c)).set((new Uint8Array(this.buffer)).subarray(0,this.size)),this.buffer=c);return this};e.prototype.set=function(c,a){d.integer(c);d.between(0,c,this.size,"Index out of bounds: "+String(c));d.integer(a);d.between(0,a,256,"Not a byte: "+String(a));(new Uint8Array(this.buffer))[c]=a;return this};e.prototype.setAll=function(c,a){d.instanceOf(a,ArrayBuffer);d.integer(c);d.between(0,c,this.size-a.byteLength+1,"Index out of bounds: "+String(c));(new Uint8Array(this.buffer)).set(new Uint8Array(a), +c);return this};e.prototype.get=function(c){d.integer(c);d.between(0,c,this.size,"Index out of bounds: "+String(c));return(new Uint8Array(this.buffer))[c]};e.prototype.add=function(c){d.integer(c);d.between(0,c,256,"Not a byte: "+String(c));var a=this.size,b=a+1;this.grow(b);this.size=b;(new Uint8Array(this.buffer))[a]=c;return this};e.prototype.addAll=function(c){d.instanceOf(c,ArrayBuffer);var a=this.size,b=this.size+c.byteLength;this.grow(b);this.size=b;(new Uint8Array(this.buffer)).set(new Uint8Array(c), +a);return this};e.prototype.toBuffer=function(){return this.buffer.slice(0,this.size)};h.global.Object.defineProperties(e.prototype,{length:{configurable:!0,enumerable:!0,get:function(){return this.size}},rawBuffer:{configurable:!0,enumerable:!0,get:function(){return this.buffer}}});g.exports=e}).call(this,"/lib")},{}],"/lib/strint.js":[function(b,g){var a={};(function(){function b(a){return l(a)?a.length-1:a.length}function d(a,c){w(a);v(c,"number");return c>=b(a)?"0":a.charAt(a.length-c-1)}function c(a, +c){x(a);G(c);for(var b=0;ba)throw Error("Expected a positive number: "+a);}function v(a,c){if(typeof a!==c)throw Error("Not a "+c+": "+a);}var q=a.subPositive=function(a,b){x(a);x(b);if(!K(a,b))throw Error("x must be greater or equal to y");for(var z=Math.max(a.length,b.length),k= +"",f=0,e=0,p=0;pd)throw Error("Illegal state");}};a.div=function(a,c,b){b=void 0===b?!1:b;w(a);w(c);var d=z(J(a),J(c))[0];p(a,c)||(d=R(d));!b||C(y(d,c),a)||p(a,c)||(d=P(d,"1"));return d};var C=a.eq=function(a,c){return M(a)===M(c)},k=a.lt=function(a,c){return l(a)&&O(c)?!0:O(a)&&l(c)?!1:l(a)&&l(c)?!C(a,c)&&!r(J(a),J(c)):r(a,c)},K=a.ge=function(a,c){return!k(a,c)},f=a.gt=function(a,c){return C(a,c)?!1:K(a,c)},l=a.isNegative= +function(a){w(a);return 0===a.indexOf("-")},O=a.isPositive=function(a){return!l(a)},J=a.abs=function(a){return l(a)?R(a):a},R=a.negate=function(a){return"0"===a?"0":l(a)?a.slice(1):"-"+a},V=/^(-?)0*([1-9][0-9]*)$/,W=/^0+$/,M=a.normalize=function(a){if(W.test(a))return"0";var c=V.exec(a);if(!c)throw Error("Illegal strint format: "+a);return c[1]+c[2]}})();a.LONG_UPPER_SHIFT="4294967296";a.BYTE_SHIFT="256";g.exports=a},{}],"/lib/util-inspect.js":[function(b,g,a){a.inspect=function(b){if(void 0===b)return"undefined"; +if(null===b||b.constructor===Object||b.constructor===Array||b.constructor===String||b.constructor===Number||b.constructor===Boolean||b.constructor===Date)return JSON.stringify(b);if(b.constructor===Set){var d="Set {";b=b.values();for(var c=b.next();!c.done;)d+=a.inspect(c.value),c=b.next(),c.done||(d+=", ");return d+"}"}if(b.constructor===Map){d="Map {";b=b.entries();for(c=b.next();!c.done;)d+=a.inspect(c.value[0]),d+=" \x3d\x3e ",d+=a.inspect(c.value[1]),c=b.next(),c.done||(d+=", ");return d+"}"}return b.constructor.name? +b.constructor.name+" "+JSON.stringify(b):JSON.stringify(b)}},{}],"/read.js":[function(b,g){(function(a){function e(a,c){try{return{value:(new DataView(a)).getUint32(c),length:4}}catch(C){p.fail("Buffer is not long enough")}}function d(a,c){return a.length=b+d,"Buffer is not long enough");c=new Uint8Array(c);for(e=0;el;l++){var y=8*e+l;if(y===a.length)break;a[y]=!!(f&1<=k+l,"Buffer is not long enough");f=(new Int8Array(b))[k];break;case q.ShortType:l=2;p.assert(b.byteLength>=k+l,"Buffer is not long enough");f=(new DataView(b)).getInt16(k);break;case q.IntType:l=4;f=(new DataView(b)).getInt32(k);break;case q.LongType:case q.DateType:l=8;p.assert(b.byteLength>=k+l,"Buffer is not long enough");f=new DataView(b);b=f.getInt32(k);k=f.getUint32(k+4);f=v.add(v.mul(String(b),v.LONG_UPPER_SHIFT),String(k));m.constructor===q.DateType&&(f=new Date(Number(f))); +break;case q.BigIntType:l=2;p.assert(b.byteLength>=k+l,"Buffer is not long enough");d=new DataView(b);m=d.getUint16(k);p.assert(b.byteLength>=k+l+m,"Buffer is not long enough");f=m?String(d.getInt8(k+l)):"0";for(b=1;b=k+l,"Buffer is not long enough");f=(new Uint8Array(b))[k];break;case q.UnsignedShortType:l=2;p.assert(b.byteLength>=k+l,"Buffer is not long enough"); +f=(new DataView(b)).getUint16(k);break;case q.UnsignedIntType:l=4;p.assert(b.byteLength>=k+l,"Buffer is not long enough");f=(new DataView(b)).getUint32(k);break;case q.UnsignedLongType:l=8;p.assert(b.byteLength>=k+l,"Buffer is not long enough");f=new DataView(b);b=f.getUint32(k);k=f.getUint32(k+4);f=v.add(v.mul(String(b),v.LONG_UPPER_SHIFT),String(k));break;case q.BigUnsignedIntType:l=2;p.assert(b.byteLength>=k+l,"Buffer is not long enough");d=new DataView(b);m=d.getUint16(k);p.assert(b.byteLength>= +k+l+m,"Buffer is not long enough");f="0";for(b=0;b=k+l,"Buffer is not long enough");b=new DataView(b);k=(b.getInt16(k)<<8|b.getUint8(k+2))*q.MILLIS_PER_DAY;f=new Date(k+(new Date(k)).getTimezoneOffset()*q.MILLIS_PER_MINUTE);break;case q.TimeType:l=4;p.assert(b.byteLength>=k+l,"Buffer is not long enough");f=new Date((new DataView(b)).getUint32(k));break;case q.FloatType:l=4; +p.assert(b.byteLength>=k+l,"Buffer is not long enough");f=(new DataView(b)).getFloat32(k);break;case q.DoubleType:l=8;p.assert(b.byteLength>=k+l,"Buffer is not long enough");f=(new DataView(b)).getFloat64(k);break;case q.BooleanType:l=1;p.assert(b.byteLength>k,"Buffer is not long enough");k=(new Uint8Array(b))[k];p.assert(0===k||255===k,"0x"+k.toString(16)+" is an invalid Boolean value");f=!!k;break;case q.BooleanArrayType:f=e(b,k);l=f.length;k=t({buffer:b,offset:k+l,count:f.value,baseValue:a});l+= +k.length;f=k.value;break;case q.BooleanTupleType:l=t({buffer:b,offset:k,count:m.length,baseValue:a});f=l.value;l=l.length;break;case q.CharType:p.assert(b.byteLength>k,"Buffer is not long enough");f=w.toString((new Uint8Array(b)).subarray(k,k+4))[0];l=w.fromString(f).byteLength;break;case q.StringType:f=new Uint8Array(b);for(l=0;p.assert(b.byteLength>k+l,"Buffer is not long enough"),f[k+l];l++);f=w.toString((new Uint8Array(b)).subarray(k,k+l));l++;break;case q.OctetsType:f=e(b,k);l=f.length;d=l+f.value; +p.assert(b.byteLength>=k+d,"Buffer is not long enough");f=b.slice(k+l,k+d);l=d;break;case q.TupleType:l=0;f=a||c(m);for(a=0;ak,"Buffer is not long enough");k=(new Uint8Array(b))[k];f=m.values[k];void 0===f&&p.fail("Index "+String(k)+" is invalid");break;case q.ChoiceType:l=1;p.assert(b.byteLength>k,"Buffer is not long enough");f=(new Uint8Array(b))[k];k=r({buffer:b,pointerStart:d,offset:k+l,type:m.types[f]});l+=k.length;f=k.value;break;case q.NamedChoiceType:l=1;p.assert(b.byteLength>k,"Buffer is not long enough");f=(new Uint8Array(b))[k];a=m.indexConstructors.get(f).name;a=x.get(a);k=r({buffer:b, +pointerStart:d,offset:k+l,type:m.constructorTypes[f].type,baseValue:new a});l+=k.length;f=k.value;break;case q.RecursiveType:l=1;p.assert(b.byteLength>k,"Buffer is not long enough");f=(new Uint8Array(b))[k];p.assert(0===f||255===f,"0x"+f.toString(16)+" is an invalid Recursive byte");f?(m=m.type,f=c(m),F.has(b)||F.set(b,new Map),F.get(b).set(k+l,f),l+=r({buffer:b,pointerStart:d,offset:k+l,type:m,baseValue:f}).length):(d=e(b,k+l),k=k+l-d.value,f=F.get(b).get(k),p.assert(void 0!==f,"Cannot find target at "+ +String(k)),l+=d.length);break;case q.OptionalType:l=1;p.assert(b.byteLength>k,"Buffer is not long enough");f=(new Uint8Array(b))[k];p.assert(0===f||255===f,"0x"+f.toString(16)+" is an invalid Optional byte");f?(k=r({buffer:b,pointerStart:d,offset:k+l,type:m.type}),l+=k.length,f=k.value):f=null;break;case q.PointerType:k=e(b,k);l=k.length;f=r({buffer:b,pointerStart:d,offset:d+k.value,type:m.type}).value;break;default:p.fail("Not a structure type: "+L.inspect(m))}return{value:f,length:l}}function m(a, +b){p.assert(0<=b,"Offset is negative: "+String(b));var c=new Uint8Array(a);p.assert(a.byteLength>b,"Buffer is not long enough");for(var k=c[b],e,f=1,l=h.makeIterator(P),g=l.next();!g.done;g=l.next())if(g=g.value,k===g._value)return{value:new g,length:f};switch(k){case q.BooleanTupleType._value:p.assert(a.byteLength>b+f,"Buffer is not long enough");a=c[b+f];f++;e=new q.BooleanTupleType(a);break;case q.TupleType._value:var t=m(a,b+f),f=f+t.length;p.assert(a.byteLength>b+f,"Buffer is not long enough"); +a=c[b+f];f++;e=new q.TupleType({type:t.value,length:a});break;case q.StructType._value:p.assert(a.byteLength>b+f,"Buffer is not long enough");t=c[b+f];f++;e={};for(k=0;kb+f,"Buffer is not long enough");l=c[b+f];f++;var D=b+f,g=D+l;p.assert(a.byteLength>=g,"Buffer is not long enough");D=w.toString(c.subarray(D,g));f+=l;l=m(a,g);e[D]=l.value;f+=l.length}e=new q.StructType(e);break;case q.ArrayType._value:a=m(a,b+f);f+=a.length;e=new q.ArrayType(a.value);break;case q.SetType._value:a= +m(a,b+f);f+=a.length;e=new q.SetType(a.value);break;case q.MapType._value:c=m(a,b+f);f+=c.length;a=m(a,b+f);f+=a.length;e=new q.MapType(c.value,a.value);break;case q.EnumType._value:c=m(a,b+f);f+=c.length;p.assert(a.byteLength>b+f,"Buffer is not long enough");t=(new Uint8Array(a))[b+f];f++;e=Array(t);for(k=0;kb+f, +"Buffer is not long enough");c=(new Uint8Array(a))[b+f];f++;t=Array(c);for(e=0;eb+f,"Buffer is not long enough");t=c[b+f];f++;e=new Map;for(k=0;kb+f,"Buffer is not long enough"),l=c[b+f],f++,D=b+f,g=D+l,p.assert(a.byteLength>=g,"Buffer is not long enough"),D=w.toString(c.subarray(D,g)),f+=l,l=m(a,g),e.set(x.get(D),l.value),f+=l.length;e=new q.NamedChoiceType(e); +break;case q.RecursiveType._value:p.assert(a.byteLength>=b+f+2,"Buffer is not long enough");c=(new DataView(a)).getUint16(b+f);f+=2;(e=N.get(a))?t=e.get(c):(e=new Map,N.set(a,e));if(!t){do for(t="read-type",k=0;16>k;k++)t+=Math.floor(16*Math.random()).toString(16);while(G.isRegistered(t));e.set(c,t);a=m(a,b+f);f+=a.length;G.registerType({type:a.value,name:t})}e=new q.RecursiveType(t);break;case q.OptionalType._value:a=m(a,b+f);f+=a.length;e=new q.OptionalType(a.value);break;case q.PointerType._value:a= +m(a,b+f);f+=a.length;e=new q.PointerType(a.value);break;case q.REPEATED_TYPE:c=f+2;p.assert(a.byteLength>=b+c,"Buffer is not long enough");t=(new DataView(a)).getUint16(b+f);e=m(a,b+f-t).value;f=c;break;default:p.fail("No such type: 0x"+d((new Uint8Array(a))[b].toString(16),2))}return{value:e,length:f}}"/"===a&&(a="");var p=b(a+"/lib/assert.js"),D=b(a+"/lib/bit-math.js"),w=b(a+"/lib/buffer-string.js"),x=b(a+"/constructor-registry.js"),G=b(a+"/recursive-registry.js"),v=b(a+"/lib/strint.js"),q=b(a+ +"/structure-types.js"),L=b("/lib/util-inspect.js"),P=[q.ByteType,q.ShortType,q.IntType,q.LongType,q.BigIntType,q.UnsignedByteType,q.UnsignedShortType,q.UnsignedIntType,q.UnsignedLongType,q.BigUnsignedIntType,q.DateType,q.DayType,q.TimeType,q.FloatType,q.DoubleType,q.BooleanType,q.BooleanArrayType,q.CharType,q.StringType,q.OctetsType],F=new WeakMap,N=new WeakMap;g.exports={_consumeType:m,type:function(a,b){b=void 0===b?!0:b;p.instanceOf(a,ArrayBuffer);var c=m(a,0),d=c.value,c=c.length;b&&p.assert(c=== +a.byteLength,"Did not consume all of the buffer");return d},value:function(a){var b=a.buffer,c=a.type;a=void 0===a.offset?0:a.offset;p.instanceOf(b,ArrayBuffer);p.instanceOf(c,q.Type);p.instanceOf(a,Number);return r({buffer:b,offset:a,type:c,pointerStart:a}).value}}}).call(this,"/")},{"/lib/util-inspect.js":"/lib/util-inspect.js"}],"/recursive-registry.js":[function(b,g){(function(a){"/"===a&&(a="");var e=b(a+"/lib/assert.js"),d=b(a+"/structure-types.js"),c=new Map;g.exports={registerType:function(a){var b= +a.type;a=a.name;e.instanceOf(b,[d.ArrayType,d.MapType,d.SetType,d.StructType,d.TupleType]);e.instanceOf(a,String);e.assert(!c.has(a),'"'+a+'" is already a registered type');c.set(a,b)},getType:function(a){e.instanceOf(a,String);var b=c.get(a);e.assert(void 0!==b,'"'+a+'" is not a registered type');return b},isRegistered:function(a){return c.has(a)}}}).call(this,"/")},{}],"/structure-types.js":[function(b,g){(function(a){function e(a){n.instanceOf(a,u);this.type=a;return this}function d(a){var b;b= +u.call(this)||this;n.instanceOf(a,E);b.type=a;return b}function c(a){var b;b=u.call(this)||this;n.instanceOf(a,String);b.name=a;return b}function t(a){var b;b=u.call(this)||this;n.instanceOf(a,Map);try{n.byteUnsignedInteger(a.size)}catch(X){n.fail(String(a.size)+" types is too many")}b.indexConstructors=new Map;b.constructorTypes=Array(a.size);var c=new Set;a=h.makeIterator(a);for(var H=a.next();!H.done;H=a.next()){var d=h.makeIterator(H.value),H=d.next().value,d=d.next().value;n.instanceOf(H,Function); +var e=H.name;n.assert(e,'Function "'+String(e)+'" does not have a name');n.assert(!c.has(e),'Function name "'+e+'" is repeated');c.add(e);var f=T.fromString(e);try{n.byteUnsignedInteger(f.byteLength)}catch(X){n.fail('Function name "'+e+'" is too long')}n.instanceOf(d,x);e=b.indexConstructors.size;b.indexConstructors.set(e,H);b.constructorTypes[e]={nameBuffer:f,type:d}}return b}function r(a){var b;b=u.call(this)||this;n.instanceOf(a,Array);try{n.byteUnsignedInteger(a.length)}catch(wa){n.fail(String(a.length)+ +" types is too many")}for(var c=h.makeIterator(a),d=c.next();!d.done;d=c.next())n.instanceOf(d.value,E);b.types=a;return b}function m(a){var b=a.type;a=a.values;n.instanceOf(b,u);n.instanceOf(a,Array);try{n.byteUnsignedInteger(a.length)}catch(la){n.fail(String(a.length)+" values is too many")}for(var c=new Map,d=0;db.name)return 1});return b}function G(a){var b=a.type,c=a.length;a=u.call(this)||this;n.instanceOf(b,E);n.byteUnsignedInteger(c);a.type=b;a.length=c;return a}function v(a){return u.apply(this, +arguments)||this}function q(a){return u.apply(this,arguments)||this}function L(a){return u.apply(this,arguments)||this}function P(a){return u.apply(this,arguments)||this}function F(a){var b;b=u.call(this)||this;n.byteUnsignedInteger(a);b.length=a;return b}function N(a){return u.apply(this,arguments)||this}function y(a){return C.apply(this,arguments)||this}function z(a){return C.apply(this,arguments)||this}function C(a){return u.apply(this,arguments)||this}function k(a){return l.apply(this,arguments)|| +this}function K(a){return l.apply(this,arguments)||this}function f(a){return l.apply(this,arguments)||this}function l(a){return u.apply(this,arguments)||this}function O(a){return M.apply(this,arguments)||this}function J(a){return M.apply(this,arguments)||this}function R(a){return M.apply(this,arguments)||this}function V(a){return M.apply(this,arguments)||this}function W(a){return M.apply(this,arguments)||this}function M(a){return u.apply(this,arguments)||this}function Y(a){return Q.apply(this,arguments)|| +this}function Z(a){return Q.apply(this,arguments)||this}function aa(a){return Q.apply(this,arguments)||this}function ba(a){return Q.apply(this,arguments)||this}function ca(a){return Q.apply(this,arguments)||this}function Q(a){return u.apply(this,arguments)||this}function u(a){return E.apply(this,arguments)||this}function E(){}function da(a){var b=new ArrayBuffer(4);(new DataView(b)).setUint32(0,a);return b}function S(a,b){if(b&&(b=ga.get(a))){b=h.makeIterator(b);for(var c=b.next();!c.done;c=b.next()){var d= +h.makeIterator(c.value),c=d.next().value,d=d.next().value,I=a.length;a.addAll(T.fromBinaryString(c));c=new ArrayBuffer(4);(new DataView(c)).setUint32(0,I);d=h.makeIterator(d);for(I=d.next();!I.done;I=d.next())a.setAll(I.value,c)}}}function U(a){if(a&&a.constructor===String&&(a=Number(a),!isNaN(a)))return a}function ma(a,b){n.instanceOf(a,A);n.instanceOf(b,String);(B.gt(b,"9223372036854775807")||B.lt(b,"-9223372036854775808"))&&n.fail("Value out of range");var c=B.div(b,B.LONG_UPPER_SHIFT,!0);b=B.sub(b, +B.mul(c,B.LONG_UPPER_SHIFT));var d=new ArrayBuffer(8),I=new DataView(d);I.setInt32(0,Number(c));I.setUint32(4,Number(b));a.addAll(d)}function na(a,b){n.instanceOf(b,Array);for(var c=ha(b.length),d=ia(b.length),c=new ArrayBuffer(c?d+1:d),d=new Uint8Array(c),I=0;I>8);d.setUint8(2,b&255);a.addAll(c)};h.global.Object.defineProperties(K,{_value:{configurable:!0, +enumerable:!0,get:function(){return 27}}});h.inherits(k,l);k.prototype.writeValue=function(a,b){n.instanceOf(b,Date);var c=new ArrayBuffer(4);(new DataView(c)).setUint32(0,b.getTime()%864E5);a.addAll(c)};h.global.Object.defineProperties(k,{_value:{configurable:!0,enumerable:!0,get:function(){return 28}}});h.inherits(C,u);h.inherits(z,C);z.prototype.writeValue=function(a,b){n.instanceOf(a,A);var c=U(b);void 0!==c&&(b=c);n.instanceOf(b,Number);c=new ArrayBuffer(4);(new DataView(c)).setFloat32(0,b); +a.addAll(c)};h.global.Object.defineProperties(z,{_value:{configurable:!0,enumerable:!0,get:function(){return 32}}});h.inherits(y,C);y.prototype.writeValue=function(a,b){n.instanceOf(a,A);var c=U(b);void 0!==c&&(b=c);n.instanceOf(b,Number);c=new ArrayBuffer(8);(new DataView(c)).setFloat64(0,b);a.addAll(c)};h.global.Object.defineProperties(y,{_value:{configurable:!0,enumerable:!0,get:function(){return 33}}});h.inherits(N,u);N.prototype.writeValue=function(a,b){n.instanceOf(a,A);n.instanceOf(b,Boolean); +b?a.add(255):a.add(0)};h.global.Object.defineProperties(N,{_value:{configurable:!0,enumerable:!0,get:function(){return 48}}});h.inherits(F,u);F.prototype.addToBuffer=function(a){u.prototype.addToBuffer.call(this,a)&&a.add(this.length)};F.prototype.writeValue=function(a,b){n.instanceOf(a,A);n.instanceOf(b,Array);b.length!==this.length&&n.fail("Length does not match");na(a,b)};h.global.Object.defineProperties(F,{_value:{configurable:!0,enumerable:!0,get:function(){return 49}}});h.inherits(P,u);P.prototype.writeValue= +function(a,b){n.instanceOf(b,Array);n.fourByteUnsignedInteger(b.length);a.addAll(da(b.length));na(a,b)};h.global.Object.defineProperties(P,{_value:{configurable:!0,enumerable:!0,get:function(){return 50}}});h.inherits(L,u);L.prototype.writeValue=function(a,b){n.instanceOf(a,A);n.instanceOf(b,String);n.assert(1===b.length,"String must contain only 1 character");a.addAll(T.fromString(b))};h.global.Object.defineProperties(L,{_value:{configurable:!0,enumerable:!0,get:function(){return 64}}});h.inherits(q, +u);q.prototype.writeValue=function(a,b){n.instanceOf(a,A);n.instanceOf(b,String);b=T.fromString(b);a.addAll(b);a.add(0)};h.global.Object.defineProperties(q,{_value:{configurable:!0,enumerable:!0,get:function(){return 65}}});h.inherits(v,u);v.prototype.writeValue=function(a,b){n.instanceOf(a,A);n.instanceOf(b,ArrayBuffer);n.fourByteUnsignedInteger(b.byteLength);a.addAll(da(b.byteLength));a.addAll(b)};h.global.Object.defineProperties(v,{_value:{configurable:!0,enumerable:!0,get:function(){return 66}}}); +h.inherits(G,u);G.prototype.addToBuffer=function(a){u.prototype.addToBuffer.call(this,a)&&(this.type.addToBuffer(a),a.add(this.length))};G.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;n.instanceOf(a,A);n.instanceOf(b,Array);b.length!==this.length&&n.fail("Length does not match: expected "+String(this.length)+" but got "+b.length);b=h.makeIterator(b);for(var d=b.next();!d.done;d=b.next())this.type.writeValue(a,d.value,!1);S(a,c)};h.global.Object.defineProperties(G,{_value:{configurable:!0, +enumerable:!0,get:function(){return 80}}});h.inherits(x,u);x.prototype.addToBuffer=function(a){if(u.prototype.addToBuffer.call(this,a)){a.add(this.fields.length);for(var b=h.makeIterator(this.fields),c=b.next();!c.done;c=b.next()){var c=c.value,d=c.buffer;a.add(d.byteLength);a.addAll(d);c.type.addToBuffer(a)}}};x.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;n.instanceOf(a,A);n.instanceOf(b,Object);for(var d=h.makeIterator(this.fields),e=d.next();!e.done;e=d.next()){var e=e.value,f=b[e.name]; +try{e.type.writeValue(a,f,!1)}catch(la){throw void 0===f&&n.fail('Value for field "'+e.name+'" missing'),la;}}S(a,c)};h.global.Object.defineProperties(x,{_value:{configurable:!0,enumerable:!0,get:function(){return 81}}});h.inherits(w,u);w.prototype.addToBuffer=function(a){u.prototype.addToBuffer.call(this,a)&&this.type.addToBuffer(a)};w.prototype._writeValue=function(a,b,c){n.instanceOf(a,A);var d=b.length;void 0===d&&(d=b.size);n.fourByteUnsignedInteger(d);a.addAll(da(d));b=h.makeIterator(b);for(d= +b.next();!d.done;d=b.next())this.type.writeValue(a,d.value,!1);S(a,c)};w.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;n.instanceOf(b,Array);this._writeValue(a,b,c)};h.global.Object.defineProperties(w,{_value:{configurable:!0,enumerable:!0,get:function(){return 82}}});h.inherits(D,w);D.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;n.instanceOf(b,Set);this._writeValue(a,b,c)};h.global.Object.defineProperties(D,{_value:{configurable:!0,enumerable:!0,get:function(){return 83}}});h.inherits(p, +u);p.prototype.addToBuffer=function(a){u.prototype.addToBuffer.call(this,a)&&(this.keyType.addToBuffer(a),this.valueType.addToBuffer(a))};p.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;n.instanceOf(a,A);n.instanceOf(b,Map);n.fourByteUnsignedInteger(b.size);a.addAll(da(b.size));b=h.makeIterator(b);for(var d=b.next();!d.done;d=b.next()){var e=h.makeIterator(d.value),d=e.next().value,e=e.next().value;this.keyType.writeValue(a,d,!1);this.valueType.writeValue(a,e,!1)}S(a,c)};h.global.Object.defineProperties(p, +{_value:{configurable:!0,enumerable:!0,get:function(){return 84}}});h.inherits(m,E);m.prototype.addToBuffer=function(a){if(E.prototype.addToBuffer.call(this,a)){this.type.addToBuffer(a);a.add(this.valueIndices.size);for(var b=h.makeIterator(this.valueIndices),c=b.next();!c.done;c=b.next()){var c=h.makeIterator(c.value),d=c.next().value;c.next();a.addAll(T.fromBinaryString(d))}}};m.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;n.instanceOf(a,A);var d=new A;this.type.writeValue(d,b,!1);d=this.valueIndices.get(T.toBinaryString(d.toBuffer())); +n.assert(void 0!==d,"Not a valid enum value: "+ea.inspect(b));a.add(d);S(a,c)};h.global.Object.defineProperties(m,{_value:{configurable:!0,enumerable:!0,get:function(){return 85}}});h.inherits(r,u);r.prototype.addToBuffer=function(a){if(u.prototype.addToBuffer.call(this,a)){a.add(this.types.length);for(var b=h.makeIterator(this.types),c=b.next();!c.done;c=b.next())c.value.addToBuffer(a)}};r.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;n.instanceOf(a,A);for(var d=!1,e=0;e>18&63]+c[b>>12&63]+c[b>>6&63]+c[b&63]);return e.join("")}a.byteLength=function(a){return 3*a.length/4-e(a)};a.toByteArray=function(a){var b,c,d,g,m;b=a.length;g=e(a);m=new r(3*b/ +4-g);c=0>16&255,m[v++]=d>>8&255,m[v++]=d&255;2===g?(d=t[a.charCodeAt(b)]<<2|t[a.charCodeAt(b+1)]>>4,m[v++]=d&255):1===g&&(d=t[a.charCodeAt(b)]<<10|t[a.charCodeAt(b+1)]<<4|t[a.charCodeAt(b+2)]>>2,m[v++]=d>>8&255,m[v++]=d&255);return m};a.fromByteArray=function(a){for(var b=a.length,e=b%3,g="",m=[],r=0,t=b-e;rt?t:r+16383));1===e?(a= +a[b-1],g+=c[a>>2],g+=c[a<<4&63],g+="\x3d\x3d"):2===e&&(a=(a[b-2]<<8)+a[b-1],g+=c[a>>10],g+=c[a>>4&63],g+=c[a<<2&63],g+="\x3d");m.push(g);return m.join("")};var c=[],t=[],r="undefined"!==typeof Uint8Array?Uint8Array:Array;for(b=0;64>b;++b)c[b]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b],t["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(b)]=b;t[45]=62;t[95]=63},{}],3:[function(b,g){!function(a){function b(a){return a.map(function(a){a=a.toString(16); +a=2>>5]|=g[r]<<24-G%32;a=8*a.length;m[a>>5]|=128<<24-a%32;m[(a+64>>9<<4)+15]=a;for(a=0;aC;C++){if(16>C)t[C]=r[G+C]|0;else{var k=t[C-15],K=t[C-2];t[C]=((k<<25|k>>>7)^(k<<14|k>>>18)^k>>>3)+t[C-7]+((K<<15|K>>>17)^(K<<13|K>>>19)^K>>>10)+t[C-16]}k=z+((F<<26|F>>>6)^(F<<21|F>>>11)^(F<<7|F>>>25))+(F&N^~F&y)+c[C]+t[C];K=((v<<30| +v>>>2)^(v<<19|v>>>13)^(v<<10|v>>>22))+(v&q^v&L^q&L);z=y;y=N;N=F;F=P+k|0;P=L;L=q;q=v;v=k+K|0}g[0]=g[0]+v|0;g[1]=g[1]+q|0;g[2]=g[2]+L|0;g[3]=g[3]+P|0;g[4]=g[4]+F|0;g[5]=g[5]+N|0;g[6]=g[6]+y|0;g[7]=g[7]+z|0}m=[];for(a=0;a<32*e.length;a+=8)m.push(e[a>>>5]>>>24-a%32&255);return b&&b.asBytes?m:b&&b.asString?d.convertString.bytesToString(m):d.bytesToHex(m)}var d={};"undefined"!==typeof g&&g.exports?(d.bytesToHex=b("convert-hex").bytesToHex,d.convertString=b("convert-string"),g.exports=e):(d.bytesToHex=a.convertHex.bytesToHex, +d.convertString=a.convertString,a.sha256=e);var c=[];!function(){function a(a){for(var b=Math.sqrt(a),c=2;c<=b;c++)if(!(a%c))return!1;return!0}function b(a){return 4294967296*(a-(a|0))|0}for(var d=2,e=0;64>e;)a(d)&&(c[e]=b(Math.pow(d,1/3)),e++),d++}();var t=[];e.x2=function(a,b){return e(e(a,{asBytes:!0}),b)}}(this)},{"convert-hex":3,"convert-string":4}]},{},[1]);}() \ No newline at end of file diff --git a/compiled/upload-download.js b/compiled/upload-download.js index 76be8bd..427b807 100644 --- a/compiled/upload-download.js +++ b/compiled/upload-download.js @@ -1,118 +1,119 @@ -!function(){var f={scope:{}};f.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(b,e,a){if(a.get||a.set)throw new TypeError("ES3 does not support getters and setters.");b!=Array.prototype&&b!=Object.prototype&&(b[e]=a.value)};f.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global&&null!=global?global:b};f.global=f.getGlobal(this);f.SYMBOL_PREFIX="jscomp_symbol_"; -f.initSymbol=function(){f.initSymbol=function(){};f.global.Symbol||(f.global.Symbol=f.Symbol)};f.symbolCounter_=0;f.Symbol=function(b){return f.SYMBOL_PREFIX+(b||"")+f.symbolCounter_++};f.initSymbolIterator=function(){f.initSymbol();var b=f.global.Symbol.iterator;b||(b=f.global.Symbol.iterator=f.global.Symbol("iterator"));"function"!=typeof Array.prototype[b]&&f.defineProperty(Array.prototype,b,{configurable:!0,writable:!0,value:function(){return f.arrayIterator(this)}});f.initSymbolIterator=function(){}}; -f.arrayIterator=function(b){var e=0;return f.iteratorPrototype(function(){return e=c}},"es6-impl","es3"); -f.polyfill("String.prototype.repeat",function(b){return b?b:function(b){var a=f.checkStringArgs(this,null,"repeat");if(0>b||1342177279>>=1)a+=a;return h}},"es6-impl","es3"); -require=function qa(e,a,h){function d(r,l){if(!a[r]){if(!e[r]){var m="function"==typeof require&&require;if(!l&&m)return m(r,!0);if(c)return c(r,!0);l=Error("Cannot find module '"+r+"'");throw l.code="MODULE_NOT_FOUND",l;}l=a[r]={exports:{}};e[r][0].call(l.exports,function(c){var a=e[r][1][c];return d(a?a:c)},l,l.exports,qa,e,a,h)}return a[r].exports}for(var c="function"==typeof require&&require,t=0;ta.status||304===a.status?c[r]=a.response:c.text=a.statusText;d(a.status,a.statusText,c,a.getAllResponseHeaders())}); -a.open(t,c,m);a.responseType=r;for(var e in h)({}).hasOwnProperty.call(h,e)&&a.setRequestHeader(e,h[e]);a.send(l)},abort:function(){a&&a.abort()}}}})})(jQuery)},{}],"/client-side/common.js":[function(b){var e=b("/lib/assert.js");e.instanceOf(window.Map,Function);e.instanceOf(window.Set,Function);e.instanceOf(window.ArrayBuffer,Function);e.instanceOf(window.Uint8Array,Function);e.instanceOf(window.Symbol,Function);b("/client-side/binary-ajax.js");if(!window.sb){window.sb=b("/structure-types.js");b= -b("/recursive-registry.js");for(var a in b)({}).hasOwnProperty.call(b,a)&&(window.sb[a]=b[a])}else if(!(window.sb instanceof Object))throw Error("window.sb is already defined");},{"/client-side/binary-ajax.js":"/client-side/binary-ajax.js","/lib/assert.js":"/lib/assert.js","/recursive-registry.js":"/recursive-registry.js","/structure-types.js":"/structure-types.js"}],"/config.js":[function(b,e){var a="/";"/"===a&&(a="");a=b(a+"/lib/assert.js");b=b("base64-js");a.between(0,9,65536);a=new ArrayBuffer(2); -(new DataView(a)).setUint16(0,9);b=b.fromByteArray(new Uint8Array(a));e.exports={VERSION_STRING:b}},{"base64-js":2}],"/constructor-registry.js":[function(b,e){(function(a){"/"===a&&(a="");var b=new Map;e.exports={get:function(a){var c=b.get(a);if(c)return c;c={};c=(c[a]=function(){},c)[a];b.set(a,c);return c}}}).call(this,"/")},{}],"/lib/assert.js":[function(b,e){function a(){}var h=b("/lib/util-inspect.js");a.instanceOf=function(a,c){c instanceof Array||(c=[c]);for(var d=!1,b=f.makeIterator(c),l= -b.next();!l.done;l=b.next())if(l=l.value,a instanceof l||void 0!==a&&null!==a&&a.constructor===l){d=!0;break}if(!d)throw new TypeError(h.inspect(a)+" is not an instance of "+c.map(function(c){return c.name}).join(" or "));};a.integer=function(d){a.instanceOf(d,Number);if(!Number.isSafeInteger(d))throw new RangeError(h.inspect(d)+" is not an integer");};a.between=function(a,c,b,r){if(c=b){a=h.inspect(c)+" is not in ["+h.inspect(a)+","+h.inspect(b)+")";if(void 0===r)throw new RangeError(a);throw new RangeError(r+ -" ("+a+")");}};a.byteUnsignedInteger=function(b){a.integer(b);a.between(0,b,256)};a.twoByteUnsignedInteger=function(b){a.integer(b);a.between(0,b,65536)};a.fourByteUnsignedInteger=function(b){a.integer(b);a.between(0,b,4294967296)};a.fail=function(a){throw Error(a);};a.assert=function(b,c){b||a.fail(c)};a.throws=function(b,c){var d=!0;try{b(),d=!1}catch(r){void 0!==c&&a.message(r,c)}a.assert(d,"Should throw an error")};a.equal=function(b,c){var d=new RangeError("Expected "+h.inspect(c)+" but got "+ -h.inspect(b));if(c){var r=!0;switch(c.constructor){case Object:if(!b||b.constructor!==Object)throw d;for(var l in c)if({}.hasOwnProperty.call(c,l))try{a.equal(b[l],c[l])}catch(y){throw d;}break;case Array:if(!b||b.constructor!==Array)throw d;try{a.equal(b.length,c.length)}catch(y){throw d;}for(l=0;l>>3},modEight:function(a){return a&7}}},{}],"/lib/buffer-string.js":[function(b,e){(function(a){var h=b(a+"/assert.js"),d=b(a+"/growable-buffer.js");e.exports={toString:function(c){c&&c.constructor===ArrayBuffer&&(c=new Uint8Array(c));h.instanceOf(c,Uint8Array);for(var a=[],b=0;bd&&(m=d);break;case 2:x=c[b+1]; -128===(x&192)&&(d=(d&31)<<6|x&63,127d||57343d&&(m=d))}}void 0===m?(m=65533,e=1):65535>>10&1023|55296),m=56320|m&1023);a.push(m);b+=e}c="";for(b=0;ba?b.add(a):(2048>a?b.add(192|a>>6):(55296>a||57344<=a?b.add(224|a>>12):(a=65536+((a&1023)<<10|a&1023),b.add(240|a>>18),b.add(128|a>>12&63)),b.add(128|a>>6&63)),b.add(128|a&63));return b.toBuffer()},toBinaryString:function(c){h.instanceOf(c,ArrayBuffer);var a="";c=new Uint8Array(c);c=f.makeIterator(c);for(var b=c.next();!b.done;b=c.next())a+= -String.fromCharCode(b.value);return a},fromBinaryString:function(c){h.instanceOf(c,String);for(var a=new ArrayBuffer(c.length),b=new Uint8Array(a),d=0;dthis.buffer.byteLength&&(c=new ArrayBuffer(c<<1),(new Uint8Array(c)).set((new Uint8Array(this.buffer)).subarray(0,this.size)),this.buffer=c);return this};h.prototype.set=function(c,a){d.integer(c);d.between(0,c,this.size,"Index out of bounds: "+String(c));d.integer(a);d.between(0,a,256,"Not a byte: "+String(a));(new Uint8Array(this.buffer))[c]=a;return this};h.prototype.setAll=function(c,a){d.instanceOf(a,ArrayBuffer);d.integer(c);d.between(0,c,this.size- -a.byteLength+1,"Index out of bounds: "+String(c));(new Uint8Array(this.buffer)).set(new Uint8Array(a),c);return this};h.prototype.get=function(a){d.integer(a);d.between(0,a,this.size,"Index out of bounds: "+String(a));return(new Uint8Array(this.buffer))[a]};h.prototype.add=function(a){d.integer(a);d.between(0,a,256,"Not a byte: "+String(a));var c=this.size,b=c+1;this.grow(b);this.size=b;(new Uint8Array(this.buffer))[c]=a;return this};h.prototype.addAll=function(a){d.instanceOf(a,ArrayBuffer);var b= -this.size,c=this.size+a.byteLength;this.grow(c);this.size=c;(new Uint8Array(this.buffer)).set(new Uint8Array(a),b);return this};h.prototype.toBuffer=function(){return this.buffer.slice(0,this.size)};f.global.Object.defineProperties(h.prototype,{length:{configurable:!0,enumerable:!0,get:function(){return this.size}},rawBuffer:{configurable:!0,enumerable:!0,get:function(){return this.buffer}}});e.exports=h}).call(this,"/lib")},{}],"/lib/strint.js":[function(b,e){var a={};(function(){function b(a){return g(a)? -a.length-1:a.length}function d(a,c){x(a);v(c,"number");return c>=b(a)?"0":a.charAt(a.length-c-1)}function c(a,b){y(a);E(b);for(var c=0;ca)throw Error("Expected a positive number: "+a);}function v(a,b){if(typeof a!==b)throw Error("Not a "+b+": "+a);}var q=a.subPositive=function(a, -b){y(a);y(b);if(!I(a,b))throw Error("x must be greater or equal to y");for(var k=Math.max(a.length,b.length),z="",h=0,u=0,m=0;md)throw Error("Illegal state");}};a.div=function(a,b,c){c=void 0===c?!1:c;x(a);x(b);var d=z(H(a),H(b))[0];m(a,b)||(d=Q(d));!c||D(u(d,b),a)||m(a,b)||(d=O(d,"1"));return d};var D=a.eq=function(a,b){return K(a)===K(b)},k=a.lt=function(a,b){return g(a)&&N(b)?!0:N(a)&&g(b)?!1:g(a)&&g(b)?!D(a,b)&&!r(H(a), -H(b)):r(a,b)},I=a.ge=function(a,b){return!k(a,b)},p=a.gt=function(a,b){return D(a,b)?!1:I(a,b)},g=a.isNegative=function(a){x(a);return 0===a.indexOf("-")},N=a.isPositive=function(a){return!g(a)},H=a.abs=function(a){return g(a)?Q(a):a},Q=a.negate=function(a){return"0"===a?"0":g(a)?a.slice(1):"-"+a},W=/^(-?)0*([1-9][0-9]*)$/,X=/^0+$/,K=a.normalize=function(a){if(X.test(a))return"0";var b=W.exec(a);if(!b)throw Error("Illegal strint format: "+a);return b[1]+b[2]}})();a.LONG_UPPER_SHIFT="4294967296";a.BYTE_SHIFT= -"256";e.exports=a},{}],"/lib/util-inspect.js":[function(b,e,a){a.inspect=function(b){if(void 0===b)return"undefined";if(null===b||b.constructor===Object||b.constructor===Array||b.constructor===String||b.constructor===Number||b.constructor===Boolean||b.constructor===Date)return JSON.stringify(b);if(b.constructor===Set){var d="Set {";b=b.values();for(var c=b.next();!c.done;)d+=a.inspect(c.value),c=b.next(),c.done||(d+=", ");return d+"}"}if(b.constructor===Map){d="Map {";b=b.entries();for(c=b.next();!c.done;)d+= -a.inspect(c.value[0]),d+=" \x3d\x3e ",d+=a.inspect(c.value[1]),c=b.next(),c.done||(d+=", ");return d+"}"}return b.constructor.name?b.constructor.name+" "+JSON.stringify(b):JSON.stringify(b)}},{}],1:[function(b){(function(){b("/client-side/common.js");var e=b("/lib/assert.js");sb.upload=function(a,b){var d=a.type;a=a.value;e.instanceOf(d,sb.Type);e.instanceOf(b,Object);"POST"!==b.type&&"POST"!==b.method&&e.fail("Must use POST when uploading");b.processData=!1;b.data=d.valueBuffer(a);$.ajax(b)}})(); -(function(){function e(){var a={},b;for(b in c)a[b]={sig:c[b].sig,type:h.fromByteArray(new Uint8Array(c[b].type.toBuffer()))};localStorage.typeCache=JSON.stringify(a)}b("/client-side/common.js");var a=b("/lib/assert.js"),h=b("base64-js"),d=b("/read.js"),c={};if(localStorage.typeCache){var t=JSON.parse(localStorage.typeCache),r;for(r in t)c[r]={sig:t[r].sig,type:d.type((new Uint8Array(h.toByteArray(t[r].type))).buffer)}}else e();sb.download=function(b,m){function h(a,b,c){if(r){r instanceof Array|| -(r=[r]);for(var d=f.makeIterator(r),m=d.next();!m.done;m=d.next())m=m.value,m(a,b,c)}}a.instanceOf(b,String);a.instanceOf(m,Object);m.dataType="arraybuffer";var l;c[b]?(l=!0,m.headers||(m.headers={}),m.headers.sig=c[b].sig):l=!1;var r=m.success;m.success=function(a,m,r){var q=r.getResponseHeader("sig");if(l&&c[b].sig===q)q=d.value({buffer:a,type:c[b].type}),h(q,m,r);else{var x=d._consumeType(a,0);a=d.value({buffer:a,offset:x.length,type:x.value});c[b]={sig:q,type:x.value};e();h(a,m,r)}};$.ajax(m)}})()}, -{"/client-side/common.js":"/client-side/common.js","/lib/assert.js":"/lib/assert.js","/read.js":"/read.js","base64-js":2}],2:[function(b,e,a){function h(a){var b=a.length;if(0>18&63]+c[b>>12&63]+c[b>>6&63]+c[b&63]);return m.join("")}a.byteLength=function(a){return 3*a.length/4-h(a)};a.toByteArray=function(a){var b, -c,d,e,l;b=a.length;e=h(a);l=new r(3*b/4-e);c=0>16&255,l[v++]=d>>8&255,l[v++]=d&255;2===e?(d=t[a.charCodeAt(b)]<<2|t[a.charCodeAt(b+1)]>>4,l[v++]=d&255):1===e&&(d=t[a.charCodeAt(b)]<<10|t[a.charCodeAt(b+1)]<<4|t[a.charCodeAt(b+2)]>>2,l[v++]=d>>8&255,l[v++]=d&255);return l};a.fromByteArray=function(a){for(var b=a.length,h=b%3,e="",r=[],l=0,t=b-h;lt?t:l+16383));1===h?(a=a[b-1],e+=c[a>>2],e+=c[a<<4&63],e+="\x3d\x3d"):2===h&&(a=(a[b-2]<<8)+a[b-1],e+=c[a>>10],e+=c[a>>4&63],e+=c[a<<2&63],e+="\x3d");r.push(e);return r.join("")};var c=[],t=[],r="undefined"!==typeof Uint8Array?Uint8Array:Array;for(b=0;64>b;++b)c[b]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b],t["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(b)]=b;t[45]=62;t[95]=63},{}],3:[function(b,e){!function(a){function b(a){return a.map(function(a){a= -a.toString(16);a=2>>5]|=e[r]<<24-E%32;a=8*a.length;l[a>>5]|=128<<24-a%32;l[(a+64>>9<<4)+15]=a;for(a=0;aD;D++){if(16>D)t[D]=r[E+D]|0;else{var k=t[D-15],I=t[D-2];t[D]=((k<<25|k>>>7)^(k<<14|k>>>18)^k>>>3)+t[D-7]+((I<<15|I>>>17)^(I<<13|I>>>19)^I>>>10)+t[D-16]}k=z+((G<<26|G>>>6)^(G<<21|G>>>11)^(G<<7|G>>>25))+(G&L^~G&u)+c[D]+t[D];I=((v<<30| -v>>>2)^(v<<19|v>>>13)^(v<<10|v>>>22))+(v&q^v&J^q&J);z=u;u=L;L=G;G=O+k|0;O=J;J=q;q=v;v=k+I|0}e[0]=e[0]+v|0;e[1]=e[1]+q|0;e[2]=e[2]+J|0;e[3]=e[3]+O|0;e[4]=e[4]+G|0;e[5]=e[5]+L|0;e[6]=e[6]+u|0;e[7]=e[7]+z|0}l=[];for(a=0;a<32*h.length;a+=8)l.push(h[a>>>5]>>>24-a%32&255);return b&&b.asBytes?l:b&&b.asString?d.convertString.bytesToString(l):d.bytesToHex(l)}var d={};"undefined"!==typeof e&&e.exports?(d.bytesToHex=b("convert-hex").bytesToHex,d.convertString=b("convert-string"),e.exports=h):(d.bytesToHex=a.convertHex.bytesToHex, -d.convertString=a.convertString,a.sha256=h);var c=[];!function(){function a(a){for(var b=Math.sqrt(a),c=2;c<=b;c++)if(!(a%c))return!1;return!0}function b(a){return 4294967296*(a-(a|0))|0}for(var d=2,e=0;64>e;)a(d)&&(c[e]=b(Math.pow(d,1/3)),e++),d++}();var t=[];h.x2=function(a,b){return h(h(a,{asBytes:!0}),b)}}(this)},{"convert-hex":3,"convert-string":4}],"/read.js":[function(b,e){(function(a){function h(a,b){try{return{value:(new DataView(a)).getUint32(b),length:4}}catch(D){m.fail("Buffer is not long enough")}} -function d(a,b){return a.length=c+d,"Buffer is not long enough"); -b=new Uint8Array(b);for(e=0;eg;g++){var u=8*e+g;if(u===a.length)break;a[u]=!!(h&1<=k+g,"Buffer is not long enough");p=(new Int8Array(b))[k];break;case q.ShortType:g=2;m.assert(b.byteLength>=k+g,"Buffer is not long enough");p=(new DataView(b)).getInt16(k);break;case q.IntType:g= -4;p=(new DataView(b)).getInt32(k);break;case q.LongType:case q.DateType:g=8;m.assert(b.byteLength>=k+g,"Buffer is not long enough");p=new DataView(b);b=p.getInt32(k);k=p.getUint32(k+4);p=v.add(v.mul(String(b),v.LONG_UPPER_SHIFT),String(k));e.constructor===q.DateType&&(p=new Date(Number(p)));break;case q.BigIntType:g=2;m.assert(b.byteLength>=k+g,"Buffer is not long enough");d=new DataView(b);e=d.getUint16(k);m.assert(b.byteLength>=k+g+e,"Buffer is not long enough");p=e?String(d.getInt8(k+g)):"0";for(b= -1;b=k+g,"Buffer is not long enough");p=(new Uint8Array(b))[k];break;case q.UnsignedShortType:g=2;m.assert(b.byteLength>=k+g,"Buffer is not long enough");p=(new DataView(b)).getUint16(k);break;case q.UnsignedIntType:g=4;m.assert(b.byteLength>=k+g,"Buffer is not long enough");p=(new DataView(b)).getUint32(k);break;case q.UnsignedLongType:g=8;m.assert(b.byteLength>=k+ -g,"Buffer is not long enough");p=new DataView(b);b=p.getUint32(k);k=p.getUint32(k+4);p=v.add(v.mul(String(b),v.LONG_UPPER_SHIFT),String(k));break;case q.BigUnsignedIntType:g=2;m.assert(b.byteLength>=k+g,"Buffer is not long enough");d=new DataView(b);e=d.getUint16(k);m.assert(b.byteLength>=k+g+e,"Buffer is not long enough");p="0";for(b=0;b=k+g,"Buffer is not long enough");b= -new DataView(b);k=(b.getInt16(k)<<8|b.getUint8(k+2))*q.MILLIS_PER_DAY;p=new Date(k+(new Date(k)).getTimezoneOffset()*q.MILLIS_PER_MINUTE);break;case q.TimeType:g=4;m.assert(b.byteLength>=k+g,"Buffer is not long enough");p=new Date((new DataView(b)).getUint32(k));break;case q.FloatType:g=4;m.assert(b.byteLength>=k+g,"Buffer is not long enough");p=(new DataView(b)).getFloat32(k);break;case q.DoubleType:g=8;m.assert(b.byteLength>=k+g,"Buffer is not long enough");p=(new DataView(b)).getFloat64(k);break; -case q.BooleanType:g=1;m.assert(b.byteLength>k,"Buffer is not long enough");k=(new Uint8Array(b))[k];m.assert(0===k||255===k,"0x"+k.toString(16)+" is an invalid Boolean value");p=!!k;break;case q.BooleanArrayType:p=h(b,k);g=p.length;k=t({buffer:b,offset:k+g,count:p.value,baseValue:a});g+=k.length;p=k.value;break;case q.BooleanTupleType:g=t({buffer:b,offset:k,count:e.length,baseValue:a});p=g.value;g=g.length;break;case q.CharType:m.assert(b.byteLength>k,"Buffer is not long enough");p=x.toString((new Uint8Array(b)).subarray(k, -k+4))[0];g=x.fromString(p).byteLength;break;case q.StringType:p=new Uint8Array(b);for(g=0;m.assert(b.byteLength>k+g,"Buffer is not long enough"),p[k+g];g++);p=x.toString((new Uint8Array(b)).subarray(k,k+g));g++;break;case q.OctetsType:p=h(b,k);g=p.length;d=g+p.value;m.assert(b.byteLength>=k+d,"Buffer is not long enough");p=b.slice(k+g,k+d);g=d;break;case q.TupleType:g=0;p=a||c(e);for(a=0;ak,"Buffer is not long enough");k=(new Uint8Array(b))[k];p=e.values[k];void 0===p&&m.fail("Index "+String(k)+" is invalid");break;case q.ChoiceType:g=1;m.assert(b.byteLength>k,"Buffer is not long enough");p=(new Uint8Array(b))[k];k=r({buffer:b, -pointerStart:d,offset:k+g,type:e.types[p]});g+=k.length;p=k.value;break;case q.NamedChoiceType:g=1;m.assert(b.byteLength>k,"Buffer is not long enough");p=(new Uint8Array(b))[k];a=e.indexConstructors.get(p).name;a=y.get(a);k=r({buffer:b,pointerStart:d,offset:k+g,type:e.constructorTypes[p].type,baseValue:new a});g+=k.length;p=k.value;break;case q.RecursiveType:g=1;m.assert(b.byteLength>k,"Buffer is not long enough");p=(new Uint8Array(b))[k];m.assert(0===p||255===p,"0x"+p.toString(16)+" is an invalid Recursive byte"); -p?(e=e.type,p=c(e),G.has(b)||G.set(b,new Map),G.get(b).set(k+g,p),g+=r({buffer:b,pointerStart:d,offset:k+g,type:e,baseValue:p}).length):(d=h(b,k+g),k=k+g-d.value,p=G.get(b).get(k),m.assert(void 0!==p,"Cannot find target at "+String(k)),g+=d.length);break;case q.OptionalType:g=1;m.assert(b.byteLength>k,"Buffer is not long enough");p=(new Uint8Array(b))[k];m.assert(0===p||255===p,"0x"+p.toString(16)+" is an invalid Optional byte");p?(k=r({buffer:b,pointerStart:d,offset:k+g,type:e.type}),g+=k.length, -p=k.value):p=null;break;case q.PointerType:k=h(b,k);g=k.length;p=r({buffer:b,pointerStart:d,offset:d+k.value,type:e.type}).value;break;default:m.fail("Not a structure type: "+J.inspect(e))}return{value:p,length:g}}function l(a,b){m.assert(0<=b,"Offset is negative: "+String(b));m.assert(a.byteLength>b,"Buffer is not long enough");for(var c,e=1,t=(new Uint8Array(a))[b],p=f.makeIterator(O),g=p.next();!g.done;g=p.next())if(g=g.value,t===g._value)return{value:new g,length:e};switch(t){case q.BooleanTupleType._value:a= -h(a,b+e);c=new q.BooleanTupleType(a.value);e+=a.length;break;case q.TupleType._value:var u=l(a,b+e),e=e+u.length;a=h(a,b+e);e+=a.length;c=new q.TupleType({type:u.value,length:a.value});break;case q.StructType._value:m.assert(a.byteLength>b+e,"Buffer is not long enough");u=new Uint8Array(a);c=u[b+e];e++;t={};for(p=0;pb+e,"Buffer is not long enough");g=u[b+e];e++;var v=b+e,z=v+g;m.assert(a.byteLength>=z,"Buffer is not long enough");v=x.toString(u.subarray(v,z));e+=g;g= -l(a,z);t[v]=g.value;e+=g.length}c=new q.StructType(t);break;case q.ArrayType._value:a=l(a,b+e);e+=a.length;c=new q.ArrayType(a.value);break;case q.SetType._value:a=l(a,b+e);e+=a.length;c=new q.SetType(a.value);break;case q.MapType._value:u=l(a,b+e);e+=u.length;a=l(a,b+e);e+=a.length;c=new q.MapType(u.value,a.value);break;case q.EnumType._value:u=l(a,b+e);e+=u.length;m.assert(a.byteLength>b+e,"Buffer is not long enough");c=(new Uint8Array(a))[b+e];e++;t=Array(c);for(p=0;pb+e,"Buffer is not long enough");u=(new Uint8Array(a))[b+e];e++;c=Array(u);for(t=0;tb+e,"Buffer is not long enough");u=new Uint8Array(a);c=u[b+e];e++;t=new Map;for(p=0;pb+e,"Buffer is not long enough"), -g=u[b+e],e++,v=b+e,z=v+g,m.assert(a.byteLength>=z,"Buffer is not long enough"),v=x.toString(u.subarray(v,z)),e+=g,g=l(a,z),t.set(y.get(v),g.value),e+=g.length;c=new q.NamedChoiceType(t);break;case q.RecursiveType._value:m.assert(a.byteLength>=b+e+2,"Buffer is not long enough");c=(new DataView(a)).getUint16(b+e);e+=2;(t=L.get(a))?u=t.get(c):(t=new Map,L.set(a,t));if(!u){do for(u="read-type",p=0;16>p;p++)u+=Math.floor(16*Math.random()).toString(16);while(E.isRegistered(u));t.set(c,u);a=l(a,b+e);e+= -a.length;E.registerType({type:a.value,name:u})}c=new q.RecursiveType(u);break;case q.OptionalType._value:a=l(a,b+e);e+=a.length;c=new q.OptionalType(a.value);break;case q.PointerType._value:a=l(a,b+e);e+=a.length;c=new q.PointerType(a.value);break;case q.REPEATED_TYPE:u=e+2;m.assert(a.byteLength>=b+u,"Buffer is not long enough");c=(new DataView(a)).getUint16(b+e);c=l(a,b+e-c).value;e=u;break;default:m.fail("No such type: 0x"+d((new Uint8Array(a))[b].toString(16),2))}return{value:c,length:e}}"/"=== -a&&(a="");var m=b(a+"/lib/assert.js"),M=b(a+"/lib/bit-math.js"),x=b(a+"/lib/buffer-string.js"),y=b(a+"/constructor-registry.js"),E=b(a+"/recursive-registry.js"),v=b(a+"/lib/strint.js"),q=b(a+"/structure-types.js"),J=b("/lib/util-inspect.js"),O=[q.ByteType,q.ShortType,q.IntType,q.LongType,q.BigIntType,q.UnsignedByteType,q.UnsignedShortType,q.UnsignedIntType,q.UnsignedLongType,q.BigUnsignedIntType,q.DateType,q.DayType,q.TimeType,q.FloatType,q.DoubleType,q.BooleanType,q.BooleanArrayType,q.CharType,q.StringType, -q.OctetsType],G=new WeakMap,L=new WeakMap;e.exports={_consumeType:l,type:function(a,b){b=void 0===b?!0:b;m.instanceOf(a,ArrayBuffer);var c=l(a,0),d=c.value,c=c.length;b&&m.assert(c===a.byteLength,"Did not consume all of the buffer");return d},value:function(a){var b=a.buffer,c=a.type;a=void 0===a.offset?0:a.offset;m.instanceOf(b,ArrayBuffer);m.instanceOf(c,q.Type);m.instanceOf(a,Number);return r({buffer:b,offset:a,type:c,pointerStart:a}).value}}}).call(this,"/")},{"/lib/util-inspect.js":"/lib/util-inspect.js"}], -"/recursive-registry.js":[function(b,e){(function(a){"/"===a&&(a="");var h=b(a+"/lib/assert.js"),d=b(a+"/structure-types.js"),c=new Map;e.exports={registerType:function(a){var b=a.type;a=a.name;h.instanceOf(b,[d.ArrayType,d.MapType,d.SetType,d.StructType,d.TupleType]);h.instanceOf(a,String);h.assert(!c.has(a),'"'+a+'" is already a registered type');c.set(a,b)},getType:function(a){h.instanceOf(a,String);var b=c.get(a);h.assert(void 0!==b,'"'+a+'" is not a registered type');return b},isRegistered:function(a){return c.has(a)}}}).call(this, -"/")},{}],"/structure-types.js":[function(b,e){(function(a){function h(a){n.instanceOf(a,w);this.type=a}function d(a){w.call(this);n.instanceOf(a,F);this.type=a}function c(a){w.call(this);n.instanceOf(a,String);this.name=a}function t(a){w.call(this);n.instanceOf(a,Map);try{n.byteUnsignedInteger(a.size)}catch(U){n.fail(String(a.size)+" types is too many")}this.indexConstructors=new Map;this.constructorTypes=Array(a.size);var b=new Set;a=f.makeIterator(a);for(var c=a.next();!c.done;c=a.next()){var d= -f.makeIterator(c.value),c=d.next().value,d=d.next().value;n.instanceOf(c,Function);var B=c.name;n.assert(B,'Function "'+String(B)+'" does not have a name');n.assert(!b.has(B),'Function name "'+B+'" is repeated');b.add(B);var e=S.fromString(B);try{n.byteUnsignedInteger(e.byteLength)}catch(U){n.fail('Function name "'+B+'" is too long')}n.instanceOf(d,y);B=this.indexConstructors.size;this.indexConstructors.set(B,c);this.constructorTypes[B]={nameBuffer:e,type:d}}}function r(a){w.call(this);n.instanceOf(a, -Array);try{n.byteUnsignedInteger(a.length)}catch(ra){n.fail(String(a.length)+" types is too many")}for(var b=f.makeIterator(a),c=b.next();!c.done;c=b.next())n.instanceOf(c.value,F);this.types=a}function l(a){var b=a.type;a=a.values;n.instanceOf(b,w);n.instanceOf(a,Array);try{n.byteUnsignedInteger(a.length)}catch(U){n.fail(String(a.length)+" values is too many")}for(var c=new Map,d=0;db.name)return 1})}function E(a){var b=a.type;a=a.length;w.call(this);n.instanceOf(b,F);n.fourByteUnsignedInteger(a);this.type=b;this.length=a}function v(a){w.apply(this,arguments)} -function q(a){w.apply(this,arguments)}function J(a){w.apply(this,arguments)}function O(a){w.apply(this,arguments)}function G(a){w.call(this);n.fourByteUnsignedInteger(a);this.length=a}function L(a){w.apply(this,arguments)}function u(a){D.apply(this,arguments)}function z(a){D.apply(this,arguments)}function D(a){w.apply(this,arguments)}function k(a){g.apply(this,arguments)}function I(a){g.apply(this,arguments)}function p(a){g.apply(this,arguments)}function g(a){w.apply(this,arguments)}function N(a){K.apply(this, -arguments)}function H(a){K.apply(this,arguments)}function Q(a){K.apply(this,arguments)}function W(a){K.apply(this,arguments)}function X(a){K.apply(this,arguments)}function K(a){w.apply(this,arguments)}function Y(a){P.apply(this,arguments)}function Z(a){P.apply(this,arguments)}function aa(a){P.apply(this,arguments)}function ba(a){P.apply(this,arguments)}function ca(a){P.apply(this,arguments)}function P(a){w.apply(this,arguments)}function w(a){F.apply(this,arguments)}function F(){}function V(a){var b= -new ArrayBuffer(4);(new DataView(b)).setUint32(0,a);return b}function R(a,b){if(b&&(b=fa.get(a))){b=f.makeIterator(b);for(var c=b.next();!c.done;c=b.next()){var d=f.makeIterator(c.value),c=d.next().value,d=d.next().value,e=a.length;a.addAll(S.fromBinaryString(c));c=new ArrayBuffer(4);(new DataView(c)).setUint32(0,e);d=f.makeIterator(d);for(e=d.next();!e.done;e=d.next())a.setAll(e.value,c)}}}function T(a){if(a&&a.constructor===String&&(a=Number(a),!isNaN(a)))return a}function la(a,b){n.instanceOf(a, -A);n.instanceOf(b,String);(C.gt(b,"9223372036854775807")||C.lt(b,"-9223372036854775808"))&&n.fail("Value out of range");var c=C.div(b,C.LONG_UPPER_SHIFT,!0);b=C.sub(b,C.mul(c,C.LONG_UPPER_SHIFT));var d=new ArrayBuffer(8),e=new DataView(d);e.setInt32(0,Number(c));e.setUint32(4,Number(b));a.addAll(d)}function ma(a,b){n.instanceOf(b,Array);for(var c=ga(b.length),d=ha(b.length),c=new ArrayBuffer(c?d+1:d),d=new Uint8Array(c),e=0;e>8);d.setUint8(2,b&255);a.addAll(c)};f.global.Object.defineProperties(I,{_value:{configurable:!0,enumerable:!0,get:function(){return 27}}});f.inherits(k,g);k.prototype.writeValue=function(a,b){n.instanceOf(b,Date);var c=new ArrayBuffer(4);(new DataView(c)).setUint32(0,b.getTime()%864E5);a.addAll(c)};f.global.Object.defineProperties(k,{_value:{configurable:!0,enumerable:!0,get:function(){return 28}}}); -f.inherits(D,w);f.inherits(z,D);z.prototype.writeValue=function(a,b){n.instanceOf(a,A);var c=T(b);void 0!==c&&(b=c);n.instanceOf(b,Number);c=new ArrayBuffer(4);(new DataView(c)).setFloat32(0,b);a.addAll(c)};f.global.Object.defineProperties(z,{_value:{configurable:!0,enumerable:!0,get:function(){return 32}}});f.inherits(u,D);u.prototype.writeValue=function(a,b){n.instanceOf(a,A);var c=T(b);void 0!==c&&(b=c);n.instanceOf(b,Number);c=new ArrayBuffer(8);(new DataView(c)).setFloat64(0,b);a.addAll(c)}; -f.global.Object.defineProperties(u,{_value:{configurable:!0,enumerable:!0,get:function(){return 33}}});f.inherits(L,w);L.prototype.writeValue=function(a,b){n.instanceOf(a,A);n.instanceOf(b,Boolean);b?a.add(255):a.add(0)};f.global.Object.defineProperties(L,{_value:{configurable:!0,enumerable:!0,get:function(){return 48}}});f.inherits(G,w);G.prototype.addToBuffer=function(a){w.prototype.addToBuffer.call(this,a)&&a.addAll(V(this.length))};G.prototype.writeValue=function(a,b){n.instanceOf(a,A);n.instanceOf(b, -Array);b.length!==this.length&&n.fail("Length does not match");ma(a,b)};f.global.Object.defineProperties(G,{_value:{configurable:!0,enumerable:!0,get:function(){return 49}}});f.inherits(O,w);O.prototype.writeValue=function(a,b){n.instanceOf(b,Array);n.fourByteUnsignedInteger(b.length);a.addAll(V(b.length));ma(a,b)};f.global.Object.defineProperties(O,{_value:{configurable:!0,enumerable:!0,get:function(){return 50}}});f.inherits(J,w);J.prototype.writeValue=function(a,b){n.instanceOf(a,A);n.instanceOf(b, -String);n.assert(1===b.length,"String must contain only 1 character");a.addAll(S.fromString(b))};f.global.Object.defineProperties(J,{_value:{configurable:!0,enumerable:!0,get:function(){return 64}}});f.inherits(q,w);q.prototype.writeValue=function(a,b){n.instanceOf(a,A);n.instanceOf(b,String);b=S.fromString(b);a.addAll(b);a.add(0)};f.global.Object.defineProperties(q,{_value:{configurable:!0,enumerable:!0,get:function(){return 65}}});f.inherits(v,w);v.prototype.writeValue=function(a,b){n.instanceOf(a, -A);n.instanceOf(b,ArrayBuffer);n.fourByteUnsignedInteger(b.byteLength);a.addAll(V(b.byteLength));a.addAll(b)};f.global.Object.defineProperties(v,{_value:{configurable:!0,enumerable:!0,get:function(){return 66}}});f.inherits(E,w);E.prototype.addToBuffer=function(a){w.prototype.addToBuffer.call(this,a)&&(this.type.addToBuffer(a),a.addAll(V(this.length)))};E.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;n.instanceOf(a,A);n.instanceOf(b,Array);b.length!==this.length&&n.fail("Length does not match: expected "+ -String(this.length)+" but got "+b.length);b=f.makeIterator(b);for(var d=b.next();!d.done;d=b.next())this.type.writeValue(a,d.value,!1);R(a,c)};f.global.Object.defineProperties(E,{_value:{configurable:!0,enumerable:!0,get:function(){return 80}}});f.inherits(y,w);y.prototype.addToBuffer=function(a){if(w.prototype.addToBuffer.call(this,a)){a.add(this.fields.length);for(var b=f.makeIterator(this.fields),c=b.next();!c.done;c=b.next()){var c=c.value,d=c.buffer;a.add(d.byteLength);a.addAll(d);c.type.addToBuffer(a)}}}; -y.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;n.instanceOf(a,A);n.instanceOf(b,Object);for(var d=f.makeIterator(this.fields),e=d.next();!e.done;e=d.next()){var e=e.value,g=b[e.name];try{e.type.writeValue(a,g,!1)}catch(U){throw void 0===g&&n.fail('Value for field "'+e.name+'" missing'),U;}}R(a,c)};f.global.Object.defineProperties(y,{_value:{configurable:!0,enumerable:!0,get:function(){return 81}}});f.inherits(x,w);x.prototype.addToBuffer=function(a){w.prototype.addToBuffer.call(this,a)&& -this.type.addToBuffer(a)};x.prototype._writeValue=function(a,b,c){n.instanceOf(a,A);var d=b.length;void 0===d&&(d=b.size);n.fourByteUnsignedInteger(d);a.addAll(V(d));b=f.makeIterator(b);for(d=b.next();!d.done;d=b.next())this.type.writeValue(a,d.value,!1);R(a,c)};x.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;n.instanceOf(b,Array);this._writeValue(a,b,c)};f.global.Object.defineProperties(x,{_value:{configurable:!0,enumerable:!0,get:function(){return 82}}});f.inherits(M,x);M.prototype.writeValue= -function(a,b,c){c=void 0===c?!0:c;n.instanceOf(b,Set);this._writeValue(a,b,c)};f.global.Object.defineProperties(M,{_value:{configurable:!0,enumerable:!0,get:function(){return 83}}});f.inherits(m,w);m.prototype.addToBuffer=function(a){w.prototype.addToBuffer.call(this,a)&&(this.keyType.addToBuffer(a),this.valueType.addToBuffer(a))};m.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;n.instanceOf(a,A);n.instanceOf(b,Map);n.fourByteUnsignedInteger(b.size);a.addAll(V(b.size));b=f.makeIterator(b); -for(var d=b.next();!d.done;d=b.next()){var e=f.makeIterator(d.value),d=e.next().value,e=e.next().value;this.keyType.writeValue(a,d,!1);this.valueType.writeValue(a,e,!1)}R(a,c)};f.global.Object.defineProperties(m,{_value:{configurable:!0,enumerable:!0,get:function(){return 84}}});f.inherits(l,F);l.prototype.addToBuffer=function(a){if(F.prototype.addToBuffer.call(this,a)){this.type.addToBuffer(a);a.add(this.valueIndices.size);for(var b=f.makeIterator(this.valueIndices),c=b.next();!c.done;c=b.next()){var c= -f.makeIterator(c.value),d=c.next().value;c.next();a.addAll(S.fromBinaryString(d))}}};l.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;n.instanceOf(a,A);var d=new A;this.type.writeValue(d,b,!1);d=this.valueIndices.get(S.toBinaryString(d.toBuffer()));n.assert(void 0!==d,"Not a valid enum value: "+da.inspect(b));a.add(d);R(a,c)};f.global.Object.defineProperties(l,{_value:{configurable:!0,enumerable:!0,get:function(){return 85}}});f.inherits(r,w);r.prototype.addToBuffer=function(a){if(w.prototype.addToBuffer.call(this, -a)){a.add(this.types.length);for(var b=f.makeIterator(this.types),c=b.next();!c.done;c=b.next())c.value.addToBuffer(a)}};r.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;n.instanceOf(a,A);for(var d=!1,e=0;e=c}},"es6-impl","es3"); +h.polyfill("String.prototype.repeat",function(a){return a?a:function(a){var b=h.checkStringArgs(this,null,"repeat");if(0>a||1342177279>>=1)b+=b;return e}},"es6-impl","es3"); +require=function ra(g,b,e){function d(r,m){if(!b[r]){if(!g[r]){var p="function"==typeof require&&require;if(!m&&p)return p(r,!0);if(c)return c(r,!0);m=Error("Cannot find module '"+r+"'");throw m.code="MODULE_NOT_FOUND",m;}m=b[r]={exports:{}};g[r][0].call(m.exports,function(c){var b=g[r][1][c];return d(b?b:c)},m,m.exports,ra,g,b,e)}return b[r].exports}for(var c="function"==typeof require&&require,t=0;tb.status||304===b.status?c[r]=b.response:c.text=b.statusText;d(b.status,b.statusText,c,b.getAllResponseHeaders())}); +b.open(t,c,p);b.responseType=r;for(var g in e)({}).hasOwnProperty.call(e,g)&&b.setRequestHeader(g,e[g]);b.send(m)},abort:function(){b&&b.abort()}}}})})(jQuery)},{}],"/client-side/common.js":[function(a){var g=a("/lib/assert.js");g.instanceOf(window.Map,Function);g.instanceOf(window.Set,Function);g.instanceOf(window.ArrayBuffer,Function);g.instanceOf(window.Uint8Array,Function);g.instanceOf(window.Symbol,Function);a("/client-side/binary-ajax.js");if(!window.sb){window.sb=a("/structure-types.js");a= +a("/recursive-registry.js");for(var b in a)({}).hasOwnProperty.call(a,b)&&(window.sb[b]=a[b])}else if(!(window.sb instanceof Object))throw Error("window.sb is already defined");},{"/client-side/binary-ajax.js":"/client-side/binary-ajax.js","/lib/assert.js":"/lib/assert.js","/recursive-registry.js":"/recursive-registry.js","/structure-types.js":"/structure-types.js"}],"/config.js":[function(a,g){a=a("base64-js");var b=new ArrayBuffer(2);(new DataView(b)).setUint16(0,10);a=a.fromByteArray(new Uint8Array(b)); +g.exports={VERSION_STRING:a}},{"base64-js":2}],"/constructor-registry.js":[function(a,g){(function(b){"/"===b&&(b="");var a=new Map;g.exports={get:function(b){var c=a.get(b);if(c)return c;c={};c=(c[b]=function(){},c)[b];a.set(b,c);return c}}}).call(this,"/")},{}],"/lib/assert.js":[function(a,g){function b(){}var e=a("/lib/util-inspect.js");b.instanceOf=function(b,c){c instanceof Array||(c=[c]);for(var d=!1,a=h.makeIterator(c),m=a.next();!m.done;m=a.next())if(m=m.value,b instanceof m||void 0!==b&& +null!==b&&b.constructor===m){d=!0;break}if(!d)throw new TypeError(e.inspect(b)+" is not an instance of "+c.map(function(c){return c.name}).join(" or "));};b.integer=function(d){b.instanceOf(d,Number);if(!Number.isSafeInteger(d))throw new RangeError(e.inspect(d)+" is not an integer");};b.between=function(b,c,a,r){if(c=a){b=e.inspect(c)+" is not in ["+e.inspect(b)+","+e.inspect(a)+")";if(void 0===r)throw new RangeError(b);throw new RangeError(r+" ("+b+")");}};b.byteUnsignedInteger=function(a){b.integer(a); +b.between(0,a,256)};b.twoByteUnsignedInteger=function(a){b.integer(a);b.between(0,a,65536)};b.fourByteUnsignedInteger=function(a){b.integer(a);b.between(0,a,4294967296)};b.fail=function(b){throw Error(b);};b.assert=function(a,c){a||b.fail(c)};b.throws=function(a,c){var d=!0;try{a(),d=!1}catch(r){void 0!==c&&b.message(r,c)}b.assert(d,"Should throw an error")};b.equal=function(a,c){var d=new RangeError("Expected "+e.inspect(c)+" but got "+e.inspect(a));if(c){var r=!0;switch(c.constructor){case Object:if(!a|| +a.constructor!==Object)throw d;for(var m in c)if({}.hasOwnProperty.call(c,m))try{b.equal(a[m],c[m])}catch(x){throw d;}break;case Array:if(!a||a.constructor!==Array)throw d;try{b.equal(a.length,c.length)}catch(x){throw d;}for(m=0;m>> +3},modEight:function(a){return a&7}}},{}],"/lib/buffer-string.js":[function(a,g){(function(b){var e=a(b+"/assert.js"),d=a(b+"/growable-buffer.js");g.exports={toString:function(c){c&&c.constructor===ArrayBuffer&&(c=new Uint8Array(c));e.instanceOf(c,Uint8Array);for(var a=[],b=0;bd&&(p=d);break;case 2:w=c[b+1];128===(w&192)&&(d=(d&31)<<6|w&63,127d||57343d&&(p=d))}}void 0===p?(p=65533,g=1):65535>>10&1023|55296),p=56320|p&1023);a.push(p);b+=g}c="";for(b=0;ba?b.add(a):(2048>a?b.add(192|a>>6):(55296>a||57344<=a?b.add(224|a>>12):(a=65536+((a&1023)<<10|a&1023),b.add(240|a>>18),b.add(128|a>>12&63)),b.add(128|a>>6&63)),b.add(128|a&63));return b.toBuffer()},toBinaryString:function(c){e.instanceOf(c,ArrayBuffer);var a="";c=new Uint8Array(c);c=h.makeIterator(c);for(var b=c.next();!b.done;b=c.next())a+=String.fromCharCode(b.value);return a},fromBinaryString:function(c){e.instanceOf(c, +String);for(var a=new ArrayBuffer(c.length),b=new Uint8Array(a),d=0;dthis.buffer.byteLength&&(c=new ArrayBuffer(c<< +1),(new Uint8Array(c)).set((new Uint8Array(this.buffer)).subarray(0,this.size)),this.buffer=c);return this};e.prototype.set=function(c,a){d.integer(c);d.between(0,c,this.size,"Index out of bounds: "+String(c));d.integer(a);d.between(0,a,256,"Not a byte: "+String(a));(new Uint8Array(this.buffer))[c]=a;return this};e.prototype.setAll=function(c,a){d.instanceOf(a,ArrayBuffer);d.integer(c);d.between(0,c,this.size-a.byteLength+1,"Index out of bounds: "+String(c));(new Uint8Array(this.buffer)).set(new Uint8Array(a), +c);return this};e.prototype.get=function(c){d.integer(c);d.between(0,c,this.size,"Index out of bounds: "+String(c));return(new Uint8Array(this.buffer))[c]};e.prototype.add=function(c){d.integer(c);d.between(0,c,256,"Not a byte: "+String(c));var a=this.size,b=a+1;this.grow(b);this.size=b;(new Uint8Array(this.buffer))[a]=c;return this};e.prototype.addAll=function(a){d.instanceOf(a,ArrayBuffer);var c=this.size,b=this.size+a.byteLength;this.grow(b);this.size=b;(new Uint8Array(this.buffer)).set(new Uint8Array(a), +c);return this};e.prototype.toBuffer=function(){return this.buffer.slice(0,this.size)};h.global.Object.defineProperties(e.prototype,{length:{configurable:!0,enumerable:!0,get:function(){return this.size}},rawBuffer:{configurable:!0,enumerable:!0,get:function(){return this.buffer}}});g.exports=e}).call(this,"/lib")},{}],"/lib/strint.js":[function(a,g){var b={};(function(){function a(a){return l(a)?a.length-1:a.length}function d(c,b){w(c);v(b,"number");return b>=a(c)?"0":c.charAt(c.length-b-1)}function c(a, +c){x(a);G(c);for(var b=0;ba)throw Error("Expected a positive number: "+a);}function v(a,c){if(typeof a!==c)throw Error("Not a "+c+": "+a);}var q=b.subPositive=function(a,b){x(a);x(b);if(!K(a,b))throw Error("x must be greater or equal to y");for(var z=Math.max(a.length,b.length),k= +"",f=0,e=0,p=0;pd)throw Error("Illegal state");}};b.div=function(a,c,b){b=void 0===b?!1:b;w(a);w(c);var d=z(J(a),J(c))[0];p(a,c)||(d=R(d));!b||C(y(d,c),a)||p(a,c)||(d=P(d,"1"));return d};var C=b.eq=function(a,c){return M(a)===M(c)},k=b.lt=function(a,c){return l(a)&&O(c)?!0:O(a)&&l(c)?!1:l(a)&&l(c)?!C(a,c)&&!r(J(a),J(c)):r(a,c)},K=b.ge=function(a,c){return!k(a,c)},f=b.gt=function(a,c){return C(a,c)?!1:K(a,c)},l=b.isNegative= +function(a){w(a);return 0===a.indexOf("-")},O=b.isPositive=function(a){return!l(a)},J=b.abs=function(a){return l(a)?R(a):a},R=b.negate=function(a){return"0"===a?"0":l(a)?a.slice(1):"-"+a},V=/^(-?)0*([1-9][0-9]*)$/,W=/^0+$/,M=b.normalize=function(a){if(W.test(a))return"0";var c=V.exec(a);if(!c)throw Error("Illegal strint format: "+a);return c[1]+c[2]}})();b.LONG_UPPER_SHIFT="4294967296";b.BYTE_SHIFT="256";g.exports=b},{}],"/lib/util-inspect.js":[function(a,g,b){b.inspect=function(a){if(void 0===a)return"undefined"; +if(null===a||a.constructor===Object||a.constructor===Array||a.constructor===String||a.constructor===Number||a.constructor===Boolean||a.constructor===Date)return JSON.stringify(a);if(a.constructor===Set){var d="Set {";a=a.values();for(var c=a.next();!c.done;)d+=b.inspect(c.value),c=a.next(),c.done||(d+=", ");return d+"}"}if(a.constructor===Map){d="Map {";a=a.entries();for(c=a.next();!c.done;)d+=b.inspect(c.value[0]),d+=" \x3d\x3e ",d+=b.inspect(c.value[1]),c=a.next(),c.done||(d+=", ");return d+"}"}return a.constructor.name? +a.constructor.name+" "+JSON.stringify(a):JSON.stringify(a)}},{}],"/read.js":[function(a,g){(function(b){function e(a,c){try{return{value:(new DataView(a)).getUint32(c),length:4}}catch(C){p.fail("Buffer is not long enough")}}function d(a,c){return a.length=b+d,"Buffer is not long enough");c=new Uint8Array(c);for(e=0;el;l++){var y=8*e+l;if(y===a.length)break;a[y]=!!(f&1<=k+l,"Buffer is not long enough");f=(new Int8Array(b))[k];break;case q.ShortType:l=2;p.assert(b.byteLength>=k+l,"Buffer is not long enough");f=(new DataView(b)).getInt16(k);break;case q.IntType:l=4;f=(new DataView(b)).getInt32(k);break;case q.LongType:case q.DateType:l=8;p.assert(b.byteLength>=k+l,"Buffer is not long enough");f=new DataView(b);b=f.getInt32(k);k=f.getUint32(k+4);f=v.add(v.mul(String(b),v.LONG_UPPER_SHIFT),String(k));m.constructor===q.DateType&&(f=new Date(Number(f))); +break;case q.BigIntType:l=2;p.assert(b.byteLength>=k+l,"Buffer is not long enough");d=new DataView(b);m=d.getUint16(k);p.assert(b.byteLength>=k+l+m,"Buffer is not long enough");f=m?String(d.getInt8(k+l)):"0";for(b=1;b=k+l,"Buffer is not long enough");f=(new Uint8Array(b))[k];break;case q.UnsignedShortType:l=2;p.assert(b.byteLength>=k+l,"Buffer is not long enough"); +f=(new DataView(b)).getUint16(k);break;case q.UnsignedIntType:l=4;p.assert(b.byteLength>=k+l,"Buffer is not long enough");f=(new DataView(b)).getUint32(k);break;case q.UnsignedLongType:l=8;p.assert(b.byteLength>=k+l,"Buffer is not long enough");f=new DataView(b);b=f.getUint32(k);k=f.getUint32(k+4);f=v.add(v.mul(String(b),v.LONG_UPPER_SHIFT),String(k));break;case q.BigUnsignedIntType:l=2;p.assert(b.byteLength>=k+l,"Buffer is not long enough");d=new DataView(b);m=d.getUint16(k);p.assert(b.byteLength>= +k+l+m,"Buffer is not long enough");f="0";for(b=0;b=k+l,"Buffer is not long enough");b=new DataView(b);k=(b.getInt16(k)<<8|b.getUint8(k+2))*q.MILLIS_PER_DAY;f=new Date(k+(new Date(k)).getTimezoneOffset()*q.MILLIS_PER_MINUTE);break;case q.TimeType:l=4;p.assert(b.byteLength>=k+l,"Buffer is not long enough");f=new Date((new DataView(b)).getUint32(k));break;case q.FloatType:l=4; +p.assert(b.byteLength>=k+l,"Buffer is not long enough");f=(new DataView(b)).getFloat32(k);break;case q.DoubleType:l=8;p.assert(b.byteLength>=k+l,"Buffer is not long enough");f=(new DataView(b)).getFloat64(k);break;case q.BooleanType:l=1;p.assert(b.byteLength>k,"Buffer is not long enough");k=(new Uint8Array(b))[k];p.assert(0===k||255===k,"0x"+k.toString(16)+" is an invalid Boolean value");f=!!k;break;case q.BooleanArrayType:f=e(b,k);l=f.length;k=t({buffer:b,offset:k+l,count:f.value,baseValue:a});l+= +k.length;f=k.value;break;case q.BooleanTupleType:l=t({buffer:b,offset:k,count:m.length,baseValue:a});f=l.value;l=l.length;break;case q.CharType:p.assert(b.byteLength>k,"Buffer is not long enough");f=w.toString((new Uint8Array(b)).subarray(k,k+4))[0];l=w.fromString(f).byteLength;break;case q.StringType:f=new Uint8Array(b);for(l=0;p.assert(b.byteLength>k+l,"Buffer is not long enough"),f[k+l];l++);f=w.toString((new Uint8Array(b)).subarray(k,k+l));l++;break;case q.OctetsType:f=e(b,k);l=f.length;d=l+f.value; +p.assert(b.byteLength>=k+d,"Buffer is not long enough");f=b.slice(k+l,k+d);l=d;break;case q.TupleType:l=0;f=a||c(m);for(a=0;ak,"Buffer is not long enough");k=(new Uint8Array(b))[k];f=m.values[k];void 0===f&&p.fail("Index "+String(k)+" is invalid");break;case q.ChoiceType:l=1;p.assert(b.byteLength>k,"Buffer is not long enough");f=(new Uint8Array(b))[k];k=r({buffer:b,pointerStart:d,offset:k+l,type:m.types[f]});l+=k.length;f=k.value;break;case q.NamedChoiceType:l=1;p.assert(b.byteLength>k,"Buffer is not long enough");f=(new Uint8Array(b))[k];a=m.indexConstructors.get(f).name;a=x.get(a);k=r({buffer:b, +pointerStart:d,offset:k+l,type:m.constructorTypes[f].type,baseValue:new a});l+=k.length;f=k.value;break;case q.RecursiveType:l=1;p.assert(b.byteLength>k,"Buffer is not long enough");f=(new Uint8Array(b))[k];p.assert(0===f||255===f,"0x"+f.toString(16)+" is an invalid Recursive byte");f?(m=m.type,f=c(m),F.has(b)||F.set(b,new Map),F.get(b).set(k+l,f),l+=r({buffer:b,pointerStart:d,offset:k+l,type:m,baseValue:f}).length):(d=e(b,k+l),k=k+l-d.value,f=F.get(b).get(k),p.assert(void 0!==f,"Cannot find target at "+ +String(k)),l+=d.length);break;case q.OptionalType:l=1;p.assert(b.byteLength>k,"Buffer is not long enough");f=(new Uint8Array(b))[k];p.assert(0===f||255===f,"0x"+f.toString(16)+" is an invalid Optional byte");f?(k=r({buffer:b,pointerStart:d,offset:k+l,type:m.type}),l+=k.length,f=k.value):f=null;break;case q.PointerType:k=e(b,k);l=k.length;f=r({buffer:b,pointerStart:d,offset:d+k.value,type:m.type}).value;break;default:p.fail("Not a structure type: "+L.inspect(m))}return{value:f,length:l}}function m(a, +b){p.assert(0<=b,"Offset is negative: "+String(b));var c=new Uint8Array(a);p.assert(a.byteLength>b,"Buffer is not long enough");for(var k=c[b],e,f=1,l=h.makeIterator(P),g=l.next();!g.done;g=l.next())if(g=g.value,k===g._value)return{value:new g,length:f};switch(k){case q.BooleanTupleType._value:p.assert(a.byteLength>b+f,"Buffer is not long enough");a=c[b+f];f++;e=new q.BooleanTupleType(a);break;case q.TupleType._value:var t=m(a,b+f),f=f+t.length;p.assert(a.byteLength>b+f,"Buffer is not long enough"); +a=c[b+f];f++;e=new q.TupleType({type:t.value,length:a});break;case q.StructType._value:p.assert(a.byteLength>b+f,"Buffer is not long enough");t=c[b+f];f++;e={};for(k=0;kb+f,"Buffer is not long enough");l=c[b+f];f++;var D=b+f,g=D+l;p.assert(a.byteLength>=g,"Buffer is not long enough");D=w.toString(c.subarray(D,g));f+=l;l=m(a,g);e[D]=l.value;f+=l.length}e=new q.StructType(e);break;case q.ArrayType._value:a=m(a,b+f);f+=a.length;e=new q.ArrayType(a.value);break;case q.SetType._value:a= +m(a,b+f);f+=a.length;e=new q.SetType(a.value);break;case q.MapType._value:c=m(a,b+f);f+=c.length;a=m(a,b+f);f+=a.length;e=new q.MapType(c.value,a.value);break;case q.EnumType._value:c=m(a,b+f);f+=c.length;p.assert(a.byteLength>b+f,"Buffer is not long enough");t=(new Uint8Array(a))[b+f];f++;e=Array(t);for(k=0;kb+f, +"Buffer is not long enough");c=(new Uint8Array(a))[b+f];f++;t=Array(c);for(e=0;eb+f,"Buffer is not long enough");t=c[b+f];f++;e=new Map;for(k=0;kb+f,"Buffer is not long enough"),l=c[b+f],f++,D=b+f,g=D+l,p.assert(a.byteLength>=g,"Buffer is not long enough"),D=w.toString(c.subarray(D,g)),f+=l,l=m(a,g),e.set(x.get(D),l.value),f+=l.length;e=new q.NamedChoiceType(e); +break;case q.RecursiveType._value:p.assert(a.byteLength>=b+f+2,"Buffer is not long enough");c=(new DataView(a)).getUint16(b+f);f+=2;(e=N.get(a))?t=e.get(c):(e=new Map,N.set(a,e));if(!t){do for(t="read-type",k=0;16>k;k++)t+=Math.floor(16*Math.random()).toString(16);while(G.isRegistered(t));e.set(c,t);a=m(a,b+f);f+=a.length;G.registerType({type:a.value,name:t})}e=new q.RecursiveType(t);break;case q.OptionalType._value:a=m(a,b+f);f+=a.length;e=new q.OptionalType(a.value);break;case q.PointerType._value:a= +m(a,b+f);f+=a.length;e=new q.PointerType(a.value);break;case q.REPEATED_TYPE:c=f+2;p.assert(a.byteLength>=b+c,"Buffer is not long enough");t=(new DataView(a)).getUint16(b+f);e=m(a,b+f-t).value;f=c;break;default:p.fail("No such type: 0x"+d((new Uint8Array(a))[b].toString(16),2))}return{value:e,length:f}}"/"===b&&(b="");var p=a(b+"/lib/assert.js"),D=a(b+"/lib/bit-math.js"),w=a(b+"/lib/buffer-string.js"),x=a(b+"/constructor-registry.js"),G=a(b+"/recursive-registry.js"),v=a(b+"/lib/strint.js"),q=a(b+ +"/structure-types.js"),L=a("/lib/util-inspect.js"),P=[q.ByteType,q.ShortType,q.IntType,q.LongType,q.BigIntType,q.UnsignedByteType,q.UnsignedShortType,q.UnsignedIntType,q.UnsignedLongType,q.BigUnsignedIntType,q.DateType,q.DayType,q.TimeType,q.FloatType,q.DoubleType,q.BooleanType,q.BooleanArrayType,q.CharType,q.StringType,q.OctetsType],F=new WeakMap,N=new WeakMap;g.exports={_consumeType:m,type:function(a,b){b=void 0===b?!0:b;p.instanceOf(a,ArrayBuffer);var c=m(a,0),d=c.value,c=c.length;b&&p.assert(c=== +a.byteLength,"Did not consume all of the buffer");return d},value:function(a){var b=a.buffer,c=a.type;a=void 0===a.offset?0:a.offset;p.instanceOf(b,ArrayBuffer);p.instanceOf(c,q.Type);p.instanceOf(a,Number);return r({buffer:b,offset:a,type:c,pointerStart:a}).value}}}).call(this,"/")},{"/lib/util-inspect.js":"/lib/util-inspect.js"}],"/recursive-registry.js":[function(a,g){(function(b){"/"===b&&(b="");var e=a(b+"/lib/assert.js"),d=a(b+"/structure-types.js"),c=new Map;g.exports={registerType:function(a){var b= +a.type;a=a.name;e.instanceOf(b,[d.ArrayType,d.MapType,d.SetType,d.StructType,d.TupleType]);e.instanceOf(a,String);e.assert(!c.has(a),'"'+a+'" is already a registered type');c.set(a,b)},getType:function(a){e.instanceOf(a,String);var b=c.get(a);e.assert(void 0!==b,'"'+a+'" is not a registered type');return b},isRegistered:function(a){return c.has(a)}}}).call(this,"/")},{}],"/structure-types.js":[function(a,g){(function(b){function e(a){n.instanceOf(a,u);this.type=a;return this}function d(a){var b;b= +u.call(this)||this;n.instanceOf(a,E);b.type=a;return b}function c(a){var b;b=u.call(this)||this;n.instanceOf(a,String);b.name=a;return b}function t(a){var b;b=u.call(this)||this;n.instanceOf(a,Map);try{n.byteUnsignedInteger(a.size)}catch(X){n.fail(String(a.size)+" types is too many")}b.indexConstructors=new Map;b.constructorTypes=Array(a.size);var c=new Set;a=h.makeIterator(a);for(var d=a.next();!d.done;d=a.next()){var I=h.makeIterator(d.value),d=I.next().value,I=I.next().value;n.instanceOf(d,Function); +var e=d.name;n.assert(e,'Function "'+String(e)+'" does not have a name');n.assert(!c.has(e),'Function name "'+e+'" is repeated');c.add(e);var f=T.fromString(e);try{n.byteUnsignedInteger(f.byteLength)}catch(X){n.fail('Function name "'+e+'" is too long')}n.instanceOf(I,x);e=b.indexConstructors.size;b.indexConstructors.set(e,d);b.constructorTypes[e]={nameBuffer:f,type:I}}return b}function r(a){var b;b=u.call(this)||this;n.instanceOf(a,Array);try{n.byteUnsignedInteger(a.length)}catch(wa){n.fail(String(a.length)+ +" types is too many")}for(var c=h.makeIterator(a),d=c.next();!d.done;d=c.next())n.instanceOf(d.value,E);b.types=a;return b}function m(a){var b=a.type;a=a.values;n.instanceOf(b,u);n.instanceOf(a,Array);try{n.byteUnsignedInteger(a.length)}catch(la){n.fail(String(a.length)+" values is too many")}for(var c=new Map,d=0;db.name)return 1});return b}function G(a){var b=a.type,c=a.length;a=u.call(this)||this;n.instanceOf(b,E);n.byteUnsignedInteger(c);a.type=b;a.length=c;return a}function v(a){return u.apply(this, +arguments)||this}function q(a){return u.apply(this,arguments)||this}function L(a){return u.apply(this,arguments)||this}function P(a){return u.apply(this,arguments)||this}function F(a){var b;b=u.call(this)||this;n.byteUnsignedInteger(a);b.length=a;return b}function N(a){return u.apply(this,arguments)||this}function y(a){return C.apply(this,arguments)||this}function z(a){return C.apply(this,arguments)||this}function C(a){return u.apply(this,arguments)||this}function k(a){return l.apply(this,arguments)|| +this}function K(a){return l.apply(this,arguments)||this}function f(a){return l.apply(this,arguments)||this}function l(a){return u.apply(this,arguments)||this}function O(a){return M.apply(this,arguments)||this}function J(a){return M.apply(this,arguments)||this}function R(a){return M.apply(this,arguments)||this}function V(a){return M.apply(this,arguments)||this}function W(a){return M.apply(this,arguments)||this}function M(a){return u.apply(this,arguments)||this}function Y(a){return Q.apply(this,arguments)|| +this}function Z(a){return Q.apply(this,arguments)||this}function aa(a){return Q.apply(this,arguments)||this}function ba(a){return Q.apply(this,arguments)||this}function ca(a){return Q.apply(this,arguments)||this}function Q(a){return u.apply(this,arguments)||this}function u(a){return E.apply(this,arguments)||this}function E(){}function da(a){var b=new ArrayBuffer(4);(new DataView(b)).setUint32(0,a);return b}function S(a,b){if(b&&(b=ga.get(a))){b=h.makeIterator(b);for(var c=b.next();!c.done;c=b.next()){var d= +h.makeIterator(c.value),c=d.next().value,d=d.next().value,H=a.length;a.addAll(T.fromBinaryString(c));c=new ArrayBuffer(4);(new DataView(c)).setUint32(0,H);d=h.makeIterator(d);for(H=d.next();!H.done;H=d.next())a.setAll(H.value,c)}}}function U(a){if(a&&a.constructor===String&&(a=Number(a),!isNaN(a)))return a}function ma(a,b){n.instanceOf(a,A);n.instanceOf(b,String);(B.gt(b,"9223372036854775807")||B.lt(b,"-9223372036854775808"))&&n.fail("Value out of range");var c=B.div(b,B.LONG_UPPER_SHIFT,!0);b=B.sub(b, +B.mul(c,B.LONG_UPPER_SHIFT));var d=new ArrayBuffer(8),H=new DataView(d);H.setInt32(0,Number(c));H.setUint32(4,Number(b));a.addAll(d)}function na(a,b){n.instanceOf(b,Array);for(var c=ha(b.length),d=ia(b.length),c=new ArrayBuffer(c?d+1:d),d=new Uint8Array(c),H=0;H>8);d.setUint8(2,b&255);a.addAll(c)};h.global.Object.defineProperties(K,{_value:{configurable:!0, +enumerable:!0,get:function(){return 27}}});h.inherits(k,l);k.prototype.writeValue=function(a,b){n.instanceOf(b,Date);var c=new ArrayBuffer(4);(new DataView(c)).setUint32(0,b.getTime()%864E5);a.addAll(c)};h.global.Object.defineProperties(k,{_value:{configurable:!0,enumerable:!0,get:function(){return 28}}});h.inherits(C,u);h.inherits(z,C);z.prototype.writeValue=function(a,b){n.instanceOf(a,A);var c=U(b);void 0!==c&&(b=c);n.instanceOf(b,Number);c=new ArrayBuffer(4);(new DataView(c)).setFloat32(0,b); +a.addAll(c)};h.global.Object.defineProperties(z,{_value:{configurable:!0,enumerable:!0,get:function(){return 32}}});h.inherits(y,C);y.prototype.writeValue=function(a,b){n.instanceOf(a,A);var c=U(b);void 0!==c&&(b=c);n.instanceOf(b,Number);c=new ArrayBuffer(8);(new DataView(c)).setFloat64(0,b);a.addAll(c)};h.global.Object.defineProperties(y,{_value:{configurable:!0,enumerable:!0,get:function(){return 33}}});h.inherits(N,u);N.prototype.writeValue=function(a,b){n.instanceOf(a,A);n.instanceOf(b,Boolean); +b?a.add(255):a.add(0)};h.global.Object.defineProperties(N,{_value:{configurable:!0,enumerable:!0,get:function(){return 48}}});h.inherits(F,u);F.prototype.addToBuffer=function(a){u.prototype.addToBuffer.call(this,a)&&a.add(this.length)};F.prototype.writeValue=function(a,b){n.instanceOf(a,A);n.instanceOf(b,Array);b.length!==this.length&&n.fail("Length does not match");na(a,b)};h.global.Object.defineProperties(F,{_value:{configurable:!0,enumerable:!0,get:function(){return 49}}});h.inherits(P,u);P.prototype.writeValue= +function(a,b){n.instanceOf(b,Array);n.fourByteUnsignedInteger(b.length);a.addAll(da(b.length));na(a,b)};h.global.Object.defineProperties(P,{_value:{configurable:!0,enumerable:!0,get:function(){return 50}}});h.inherits(L,u);L.prototype.writeValue=function(a,b){n.instanceOf(a,A);n.instanceOf(b,String);n.assert(1===b.length,"String must contain only 1 character");a.addAll(T.fromString(b))};h.global.Object.defineProperties(L,{_value:{configurable:!0,enumerable:!0,get:function(){return 64}}});h.inherits(q, +u);q.prototype.writeValue=function(a,b){n.instanceOf(a,A);n.instanceOf(b,String);b=T.fromString(b);a.addAll(b);a.add(0)};h.global.Object.defineProperties(q,{_value:{configurable:!0,enumerable:!0,get:function(){return 65}}});h.inherits(v,u);v.prototype.writeValue=function(a,b){n.instanceOf(a,A);n.instanceOf(b,ArrayBuffer);n.fourByteUnsignedInteger(b.byteLength);a.addAll(da(b.byteLength));a.addAll(b)};h.global.Object.defineProperties(v,{_value:{configurable:!0,enumerable:!0,get:function(){return 66}}}); +h.inherits(G,u);G.prototype.addToBuffer=function(a){u.prototype.addToBuffer.call(this,a)&&(this.type.addToBuffer(a),a.add(this.length))};G.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;n.instanceOf(a,A);n.instanceOf(b,Array);b.length!==this.length&&n.fail("Length does not match: expected "+String(this.length)+" but got "+b.length);b=h.makeIterator(b);for(var d=b.next();!d.done;d=b.next())this.type.writeValue(a,d.value,!1);S(a,c)};h.global.Object.defineProperties(G,{_value:{configurable:!0, +enumerable:!0,get:function(){return 80}}});h.inherits(x,u);x.prototype.addToBuffer=function(a){if(u.prototype.addToBuffer.call(this,a)){a.add(this.fields.length);for(var b=h.makeIterator(this.fields),c=b.next();!c.done;c=b.next()){var c=c.value,d=c.buffer;a.add(d.byteLength);a.addAll(d);c.type.addToBuffer(a)}}};x.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;n.instanceOf(a,A);n.instanceOf(b,Object);for(var d=h.makeIterator(this.fields),e=d.next();!e.done;e=d.next()){var e=e.value,f=b[e.name]; +try{e.type.writeValue(a,f,!1)}catch(la){throw void 0===f&&n.fail('Value for field "'+e.name+'" missing'),la;}}S(a,c)};h.global.Object.defineProperties(x,{_value:{configurable:!0,enumerable:!0,get:function(){return 81}}});h.inherits(w,u);w.prototype.addToBuffer=function(a){u.prototype.addToBuffer.call(this,a)&&this.type.addToBuffer(a)};w.prototype._writeValue=function(a,b,c){n.instanceOf(a,A);var d=b.length;void 0===d&&(d=b.size);n.fourByteUnsignedInteger(d);a.addAll(da(d));b=h.makeIterator(b);for(d= +b.next();!d.done;d=b.next())this.type.writeValue(a,d.value,!1);S(a,c)};w.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;n.instanceOf(b,Array);this._writeValue(a,b,c)};h.global.Object.defineProperties(w,{_value:{configurable:!0,enumerable:!0,get:function(){return 82}}});h.inherits(D,w);D.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;n.instanceOf(b,Set);this._writeValue(a,b,c)};h.global.Object.defineProperties(D,{_value:{configurable:!0,enumerable:!0,get:function(){return 83}}});h.inherits(p, +u);p.prototype.addToBuffer=function(a){u.prototype.addToBuffer.call(this,a)&&(this.keyType.addToBuffer(a),this.valueType.addToBuffer(a))};p.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;n.instanceOf(a,A);n.instanceOf(b,Map);n.fourByteUnsignedInteger(b.size);a.addAll(da(b.size));b=h.makeIterator(b);for(var d=b.next();!d.done;d=b.next()){var e=h.makeIterator(d.value),d=e.next().value,e=e.next().value;this.keyType.writeValue(a,d,!1);this.valueType.writeValue(a,e,!1)}S(a,c)};h.global.Object.defineProperties(p, +{_value:{configurable:!0,enumerable:!0,get:function(){return 84}}});h.inherits(m,E);m.prototype.addToBuffer=function(a){if(E.prototype.addToBuffer.call(this,a)){this.type.addToBuffer(a);a.add(this.valueIndices.size);for(var b=h.makeIterator(this.valueIndices),c=b.next();!c.done;c=b.next()){var c=h.makeIterator(c.value),d=c.next().value;c.next();a.addAll(T.fromBinaryString(d))}}};m.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;n.instanceOf(a,A);var d=new A;this.type.writeValue(d,b,!1);d=this.valueIndices.get(T.toBinaryString(d.toBuffer())); +n.assert(void 0!==d,"Not a valid enum value: "+ea.inspect(b));a.add(d);S(a,c)};h.global.Object.defineProperties(m,{_value:{configurable:!0,enumerable:!0,get:function(){return 85}}});h.inherits(r,u);r.prototype.addToBuffer=function(a){if(u.prototype.addToBuffer.call(this,a)){a.add(this.types.length);for(var b=h.makeIterator(this.types),c=b.next();!c.done;c=b.next())c.value.addToBuffer(a)}};r.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;n.instanceOf(a,A);for(var d=!1,e=0;e>18&63]+c[b>>12&63]+c[b>>6&63]+c[b&63]);return e.join("")}b.byteLength=function(a){return 3*a.length/4-e(a)};b.toByteArray=function(a){var b,c,d,g,m;b=a.length;g=e(a);m=new r(3*b/4-g);c=0>16&255,m[v++]=d>>8&255,m[v++]=d&255;2===g?(d=t[a.charCodeAt(b)]<< +2|t[a.charCodeAt(b+1)]>>4,m[v++]=d&255):1===g&&(d=t[a.charCodeAt(b)]<<10|t[a.charCodeAt(b+1)]<<4|t[a.charCodeAt(b+2)]>>2,m[v++]=d>>8&255,m[v++]=d&255);return m};b.fromByteArray=function(a){for(var b=a.length,e=b%3,g="",m=[],r=0,t=b-e;rt?t:r+16383));1===e?(a=a[b-1],g+=c[a>>2],g+=c[a<<4&63],g+="\x3d\x3d"):2===e&&(a=(a[b-2]<<8)+a[b-1],g+=c[a>>10],g+=c[a>>4&63],g+=c[a<<2&63],g+="\x3d");m.push(g);return m.join("")};var c=[],t=[],r="undefined"!==typeof Uint8Array?Uint8Array: +Array;for(a=0;64>a;++a)c[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[a],t["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(a)]=a;t[45]=62;t[95]=63},{}],3:[function(a,g){!function(a){function b(a){return a.map(function(a){a=a.toString(16);a=2>>5]|=g[r]<<24-G%32;a=8*a.length;m[a>>5]|=128<<24-a%32;m[(a+64>>9<<4)+15]=a;for(a=0;aC;C++){if(16>C)t[C]=r[G+C]|0;else{var k=t[C-15],K=t[C-2];t[C]=((k<<25|k>>>7)^(k<<14|k>>>18)^k>>>3)+t[C-7]+((K<<15|K>>>17)^(K<<13|K>>>19)^K>>>10)+t[C-16]}k=z+((F<<26|F>>>6)^(F<<21|F>>>11)^(F<<7|F>>>25))+(F&N^~F&y)+c[C]+t[C];K=((v<<30|v>>>2)^(v<<19|v>>>13)^(v<<10|v>>>22))+(v&q^v&L^q&L);z=y;y=N;N=F;F=P+k|0;P=L;L=q;q=v;v=k+K|0}g[0]=g[0]+v|0;g[1]=g[1]+q|0;g[2]=g[2]+L|0;g[3]=g[3]+P|0;g[4]=g[4]+F|0;g[5]=g[5]+N|0;g[6]=g[6]+y|0;g[7]=g[7]+z|0}m=[];for(a=0;a<32*e.length;a+=8)m.push(e[a>>>5]>>>24- +a%32&255);return b&&b.asBytes?m:b&&b.asString?d.convertString.bytesToString(m):d.bytesToHex(m)}var d={};"undefined"!==typeof g&&g.exports?(d.bytesToHex=a("convert-hex").bytesToHex,d.convertString=a("convert-string"),g.exports=e):(d.bytesToHex=b.convertHex.bytesToHex,d.convertString=b.convertString,b.sha256=e);var c=[];!function(){function a(a){for(var b=Math.sqrt(a),c=2;c<=b;c++)if(!(a%c))return!1;return!0}function b(a){return 4294967296*(a-(a|0))|0}for(var d=2,e=0;64>e;)a(d)&&(c[e]=b(Math.pow(d, +1/3)),e++),d++}();var t=[];e.x2=function(a,b){return e(e(a,{asBytes:!0}),b)}}(this)},{"convert-hex":3,"convert-string":4}]},{},[1]);}() \ No newline at end of file diff --git a/compiled/upload.js b/compiled/upload.js index 13a9503..2750da8 100644 --- a/compiled/upload.js +++ b/compiled/upload.js @@ -1,94 +1,95 @@ -!function(){var f={scope:{}};f.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(c,g,a){if(a.get||a.set)throw new TypeError("ES3 does not support getters and setters.");c!=Array.prototype&&c!=Object.prototype&&(c[g]=a.value)};f.getGlobal=function(c){return"undefined"!=typeof window&&window===c?c:"undefined"!=typeof global&&null!=global?global:c};f.global=f.getGlobal(this);f.SYMBOL_PREFIX="jscomp_symbol_"; -f.initSymbol=function(){f.initSymbol=function(){};f.global.Symbol||(f.global.Symbol=f.Symbol)};f.symbolCounter_=0;f.Symbol=function(c){return f.SYMBOL_PREFIX+(c||"")+f.symbolCounter_++};f.initSymbolIterator=function(){f.initSymbol();var c=f.global.Symbol.iterator;c||(c=f.global.Symbol.iterator=f.global.Symbol("iterator"));"function"!=typeof Array.prototype[c]&&f.defineProperty(Array.prototype,c,{configurable:!0,writable:!0,value:function(){return f.arrayIterator(this)}});f.initSymbolIterator=function(){}}; -f.arrayIterator=function(c){var g=0;return f.iteratorPrototype(function(){return g=b}},"es6-impl","es3"); -require=function qa(g,a,e){function d(k,m){if(!a[k]){if(!g[k]){var l="function"==typeof require&&require;if(!m&&l)return l(k,!0);if(b)return b(k,!0);m=Error("Cannot find module '"+k+"'");throw m.code="MODULE_NOT_FOUND",m;}m=a[k]={exports:{}};g[k][0].call(m.exports,function(b){var a=g[k][1][b];return d(a?a:b)},m,m.exports,qa,g,a,e)}return a[k].exports}for(var b="function"==typeof require&&require,m=0;ma.status||304===a.status?b[k]=a.response:b.text=a.statusText;d(a.status,a.statusText,b,a.getAllResponseHeaders())}); -a.open(m,b,g);a.responseType=k;for(var x in e)({}).hasOwnProperty.call(e,x)&&a.setRequestHeader(x,e[x]);a.send(l)},abort:function(){a&&a.abort()}}}})})(jQuery)},{}],"/client-side/common.js":[function(c){var g=c("/lib/assert.js");g.instanceOf(window.Map,Function);g.instanceOf(window.Set,Function);g.instanceOf(window.ArrayBuffer,Function);g.instanceOf(window.Uint8Array,Function);g.instanceOf(window.Symbol,Function);c("/client-side/binary-ajax.js");if(!window.sb){window.sb=c("/structure-types.js");c= -c("/recursive-registry.js");for(var a in c)({}).hasOwnProperty.call(c,a)&&(window.sb[a]=c[a])}else if(!(window.sb instanceof Object))throw Error("window.sb is already defined");},{"/client-side/binary-ajax.js":"/client-side/binary-ajax.js","/lib/assert.js":"/lib/assert.js","/recursive-registry.js":"/recursive-registry.js","/structure-types.js":"/structure-types.js"}],"/config.js":[function(c,g){var a="/";"/"===a&&(a="");a=c(a+"/lib/assert.js");c=c("base64-js");a.between(0,9,65536);a=new ArrayBuffer(2); -(new DataView(a)).setUint16(0,9);c=c.fromByteArray(new Uint8Array(a));g.exports={VERSION_STRING:c}},{"base64-js":2}],"/lib/assert.js":[function(c,g){function a(){}var e=c("/lib/util-inspect.js");a.instanceOf=function(a,b){b instanceof Array||(b=[b]);for(var d=!1,c=f.makeIterator(b),l=c.next();!l.done;l=c.next())if(l=l.value,a instanceof l||void 0!==a&&null!==a&&a.constructor===l){d=!0;break}if(!d)throw new TypeError(e.inspect(a)+" is not an instance of "+b.map(function(b){return b.name}).join(" or ")); -};a.integer=function(d){a.instanceOf(d,Number);if(!Number.isSafeInteger(d))throw new RangeError(e.inspect(d)+" is not an integer");};a.between=function(a,b,c,k){if(b=c){a=e.inspect(b)+" is not in ["+e.inspect(a)+","+e.inspect(c)+")";if(void 0===k)throw new RangeError(a);throw new RangeError(k+" ("+a+")");}};a.byteUnsignedInteger=function(d){a.integer(d);a.between(0,d,256)};a.twoByteUnsignedInteger=function(d){a.integer(d);a.between(0,d,65536)};a.fourByteUnsignedInteger=function(d){a.integer(d); -a.between(0,d,4294967296)};a.fail=function(a){throw Error(a);};a.assert=function(d,b){d||a.fail(b)};a.throws=function(d,b){var c=!0;try{d(),c=!1}catch(k){void 0!==b&&a.message(k,b)}a.assert(c,"Should throw an error")};a.equal=function(d,b){var c=new RangeError("Expected "+e.inspect(b)+" but got "+e.inspect(d));if(b){var k=!0;switch(b.constructor){case Object:if(!d||d.constructor!==Object)throw c;for(var l in b)if({}.hasOwnProperty.call(b,l))try{a.equal(d[l],b[l])}catch(q){throw c;}break;case Array:if(!d|| -d.constructor!==Array)throw c;try{a.equal(d.length,b.length)}catch(q){throw c;}for(l=0;l>>3},modEight:function(a){return a&7}}},{}],"/lib/buffer-string.js":[function(c,g){(function(a){var e=c(a+"/assert.js"),d=c(a+"/growable-buffer.js"); -g.exports={toString:function(b){b&&b.constructor===ArrayBuffer&&(b=new Uint8Array(b));e.instanceOf(b,Uint8Array);for(var a=[],c=0;cd&&(g=d);break;case 2:n=b[c+1];128===(n&192)&&(d=(d&31)<<6|n&63,127d||57343d&&(g=d))}}void 0===g?(g=65533,x=1):65535>>10&1023|55296),g=56320|g&1023);a.push(g);c+=x}b="";for(c=0;cc?a.add(c):(2048>c?a.add(192|c>>6): -(55296>c||57344<=c?a.add(224|c>>12):(c=65536+((c&1023)<<10|c&1023),a.add(240|c>>18),a.add(128|c>>12&63)),a.add(128|c>>6&63)),a.add(128|c&63));return a.toBuffer()},toBinaryString:function(b){e.instanceOf(b,ArrayBuffer);var a="";b=new Uint8Array(b);b=f.makeIterator(b);for(var c=b.next();!c.done;c=b.next())a+=String.fromCharCode(c.value);return a},fromBinaryString:function(b){e.instanceOf(b,String);for(var a=new ArrayBuffer(b.length),c=new Uint8Array(a),d=0;dthis.buffer.byteLength&&(b=new ArrayBuffer(b<<1),(new Uint8Array(b)).set((new Uint8Array(this.buffer)).subarray(0,this.size)),this.buffer=b);return this};e.prototype.set= -function(b,a){d.integer(b);d.between(0,b,this.size,"Index out of bounds: "+String(b));d.integer(a);d.between(0,a,256,"Not a byte: "+String(a));(new Uint8Array(this.buffer))[b]=a;return this};e.prototype.setAll=function(b,a){d.instanceOf(a,ArrayBuffer);d.integer(b);d.between(0,b,this.size-a.byteLength+1,"Index out of bounds: "+String(b));(new Uint8Array(this.buffer)).set(new Uint8Array(a),b);return this};e.prototype.get=function(b){d.integer(b);d.between(0,b,this.size,"Index out of bounds: "+String(b)); -return(new Uint8Array(this.buffer))[b]};e.prototype.add=function(b){d.integer(b);d.between(0,b,256,"Not a byte: "+String(b));var a=this.size,c=a+1;this.grow(c);this.size=c;(new Uint8Array(this.buffer))[a]=b;return this};e.prototype.addAll=function(b){d.instanceOf(b,ArrayBuffer);var a=this.size,c=this.size+b.byteLength;this.grow(c);this.size=c;(new Uint8Array(this.buffer)).set(new Uint8Array(b),a);return this};e.prototype.toBuffer=function(){return this.buffer.slice(0,this.size)};f.global.Object.defineProperties(e.prototype, -{length:{configurable:!0,enumerable:!0,get:function(){return this.size}},rawBuffer:{configurable:!0,enumerable:!0,get:function(){return this.buffer}}});g.exports=e}).call(this,"/lib")},{}],"/lib/strint.js":[function(c,g){var a={};(function(){function c(b){return z(b)?b.length-1:b.length}function d(b,a){n(b);u(a,"number");return a>=c(b)?"0":b.charAt(b.length-a-1)}function b(b,a){q(b);A(a);for(var c=0;cb)throw Error("Expected a positive number: "+b);}function u(b,a){if(typeof b!==a)throw Error("Not a "+a+": "+b);}var K=a.subPositive=function(a,c){q(a);q(c);if(!F(a,c))throw Error("x must be greater or equal to y");for(var e=Math.max(a.length,c.length),g="",k=0,l=0,y=0;yd)throw Error("Illegal state");}};a.div= -function(a,b,c){c=void 0===c?!1:c;n(a);n(b);var d=S(E(a),E(b))[0];R(a,b)||(d=N(d));!c||v(Q(d,b),a)||R(a,b)||(d=O(d,"1"));return d};var v=a.eq=function(a,b){return H(a)===H(b)},G=a.lt=function(a,b){return z(a)&&I(b)?!0:I(a)&&z(b)?!1:z(a)&&z(b)?!v(a,b)&&!k(E(a),E(b)):k(a,b)},F=a.ge=function(a,b){return!G(a,b)},W=a.gt=function(a,b){return v(a,b)?!1:F(a,b)},z=a.isNegative=function(a){n(a);return 0===a.indexOf("-")},I=a.isPositive=function(a){return!z(a)},E=a.abs=function(a){return z(a)?N(a):a},N=a.negate= -function(a){return"0"===a?"0":z(a)?a.slice(1):"-"+a},Z=/^(-?)0*([1-9][0-9]*)$/,aa=/^0+$/,H=a.normalize=function(a){if(aa.test(a))return"0";var b=Z.exec(a);if(!b)throw Error("Illegal strint format: "+a);return b[1]+b[2]}})();a.LONG_UPPER_SHIFT="4294967296";a.BYTE_SHIFT="256";g.exports=a},{}],"/lib/util-inspect.js":[function(c,g,a){a.inspect=function(c){if(void 0===c)return"undefined";if(null===c||c.constructor===Object||c.constructor===Array||c.constructor===String||c.constructor===Number||c.constructor=== -Boolean||c.constructor===Date)return JSON.stringify(c);if(c.constructor===Set){var d="Set {";c=c.values();for(var b=c.next();!b.done;)d+=a.inspect(b.value),b=c.next(),b.done||(d+=", ");return d+"}"}if(c.constructor===Map){d="Map {";c=c.entries();for(b=c.next();!b.done;)d+=a.inspect(b.value[0]),d+=" \x3d\x3e ",d+=a.inspect(b.value[1]),b=c.next(),b.done||(d+=", ");return d+"}"}return c.constructor.name?c.constructor.name+" "+JSON.stringify(c):JSON.stringify(c)}},{}],1:[function(c){(function(){c("/client-side/common.js"); -var g=c("/lib/assert.js");sb.upload=function(a,c){var d=a.type;a=a.value;g.instanceOf(d,sb.Type);g.instanceOf(c,Object);"POST"!==c.type&&"POST"!==c.method&&g.fail("Must use POST when uploading");c.processData=!1;c.data=d.valueBuffer(a);$.ajax(c)}})()},{"/client-side/common.js":"/client-side/common.js","/lib/assert.js":"/lib/assert.js"}],2:[function(c,g,a){function e(a){var b=a.length;if(0>18&63]+b[c>>12&63]+b[c>>6&63]+b[c&63]);return g.join("")}a.byteLength=function(a){return 3*a.length/4-e(a)};a.toByteArray=function(a){var b,c,d,g,l;b=a.length;g=e(a);l=new k(3*b/4-g);c=0>16&255,l[u++]=d>>8&255,l[u++]=d&255;2===g?(d=m[a.charCodeAt(b)]<<2|m[a.charCodeAt(b+1)]>> -4,l[u++]=d&255):1===g&&(d=m[a.charCodeAt(b)]<<10|m[a.charCodeAt(b+1)]<<4|m[a.charCodeAt(b+2)]>>2,l[u++]=d>>8&255,l[u++]=d&255);return l};a.fromByteArray=function(a){for(var c=a.length,g=c%3,e="",k=[],m=0,l=c-g;ml?l:m+16383));1===g?(a=a[c-1],e+=b[a>>2],e+=b[a<<4&63],e+="\x3d\x3d"):2===g&&(a=(a[c-2]<<8)+a[c-1],e+=b[a>>10],e+=b[a>>4&63],e+=b[a<<2&63],e+="\x3d");k.push(e);return k.join("")};var b=[],m=[],k="undefined"!==typeof Uint8Array?Uint8Array:Array;for(c=0;64>c;++c)b[c]= -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[c],m["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(c)]=c;m[45]=62;m[95]=63},{}],3:[function(c,g){!function(a){function c(a){return a.map(function(a){a=a.toString(16);a=2>>5]|=e[l]<<24-A%32;a=8*a.length;k[a>>5]|=128<<24-a%32;k[(a+64>>9<<4)+15]=a;for(a=0;av;v++){if(16>v)m[v]=l[A+v]|0;else{var G=m[v-15],F=m[v-2];m[v]=((G<<25|G>>>7)^(G<<14|G>>>18)^G>>>3)+m[v-7]+((F<<15|F>>>17)^(F<<13|F>>>19)^F>>>10)+m[v-16]}G=S+((B<<26|B>>>6)^(B<<21|B>>>11)^(B<<7|B>>>25))+(B&P^~B&Q)+b[v]+m[v];F=((u<<30|u>>>2)^(u<<19|u>>>13)^(u<<10|u>>>22))+(u&K^u&J^K&J);S=Q;Q=P;P=B;B=O+G|0;O=J;J=K;K=u;u=G+F|0}e[0]=e[0]+u|0;e[1]=e[1]+K|0;e[2]=e[2]+J|0;e[3]=e[3]+O|0;e[4]=e[4]+B|0;e[5]=e[5]+P|0;e[6]=e[6]+Q|0;e[7]=e[7]+S|0}k=[];for(a=0;a<32*g.length;a+=8)k.push(g[a>>>5]>>>24- -a%32&255);return c&&c.asBytes?k:c&&c.asString?d.convertString.bytesToString(k):d.bytesToHex(k)}var d={};"undefined"!==typeof g&&g.exports?(d.bytesToHex=c("convert-hex").bytesToHex,d.convertString=c("convert-string"),g.exports=e):(d.bytesToHex=a.convertHex.bytesToHex,d.convertString=a.convertString,a.sha256=e);var b=[];!function(){function a(a){for(var b=Math.sqrt(a),c=2;c<=b;c++)if(!(a%c))return!1;return!0}function c(a){return 4294967296*(a-(a|0))|0}for(var d=2,e=0;64>e;)a(d)&&(b[e]=c(Math.pow(d, -1/3)),e++),d++}();var m=[];e.x2=function(a,b){return e(e(a,{asBytes:!0}),b)}}(this)},{"convert-hex":3,"convert-string":4}],"/recursive-registry.js":[function(c,g){(function(a){"/"===a&&(a="");var e=c(a+"/lib/assert.js"),d=c(a+"/structure-types.js"),b=new Map;g.exports={registerType:function(a){var c=a.type;a=a.name;e.instanceOf(c,[d.ArrayType,d.MapType,d.SetType,d.StructType,d.TupleType]);e.instanceOf(a,String);e.assert(!b.has(a),'"'+a+'" is already a registered type');b.set(a,c)},getType:function(a){e.instanceOf(a, -String);var c=b.get(a);e.assert(void 0!==c,'"'+a+'" is not a registered type');return c},isRegistered:function(a){return b.has(a)}}}).call(this,"/")},{}],"/structure-types.js":[function(c,g){(function(a){function e(a){h.instanceOf(a,p);this.type=a}function d(a){p.call(this);h.instanceOf(a,w);this.type=a}function b(a){p.call(this);h.instanceOf(a,String);this.name=a}function m(a){p.call(this);h.instanceOf(a,Map);try{h.byteUnsignedInteger(a.size)}catch(X){h.fail(String(a.size)+" types is too many")}this.indexConstructors= -new Map;this.constructorTypes=Array(a.size);var b=new Set;a=f.makeIterator(a);for(var c=a.next();!c.done;c=a.next()){var C=f.makeIterator(c.value),c=C.next().value,C=C.next().value;h.instanceOf(c,Function);var d=c.name;h.assert(d,'Function "'+String(d)+'" does not have a name');h.assert(!b.has(d),'Function name "'+d+'" is repeated');b.add(d);var e=U.fromString(d);try{h.byteUnsignedInteger(e.byteLength)}catch(X){h.fail('Function name "'+d+'" is too long')}h.instanceOf(C,q);d=this.indexConstructors.size; -this.indexConstructors.set(d,c);this.constructorTypes[d]={nameBuffer:e,type:C}}}function k(a){p.call(this);h.instanceOf(a,Array);try{h.byteUnsignedInteger(a.length)}catch(ra){h.fail(String(a.length)+" types is too many")}for(var b=f.makeIterator(a),c=b.next();!c.done;c=b.next())h.instanceOf(c.value,w);this.types=a}function l(a){var b=a.type;a=a.values;h.instanceOf(b,p);h.instanceOf(a,Array);try{h.byteUnsignedInteger(a.length)}catch(X){h.fail(String(a.length)+" values is too many")}for(var c=new Map, -d=0;db.name)return 1})}function A(a){var b=a.type;a=a.length;p.call(this);h.instanceOf(b, -w);h.fourByteUnsignedInteger(a);this.type=b;this.length=a}function u(a){p.apply(this,arguments)}function K(a){p.apply(this,arguments)}function J(a){p.apply(this,arguments)}function O(a){p.apply(this,arguments)}function B(a){p.call(this);h.fourByteUnsignedInteger(a);this.length=a}function P(a){p.apply(this,arguments)}function Q(a){v.apply(this,arguments)}function S(a){v.apply(this,arguments)}function v(a){p.apply(this,arguments)}function G(a){z.apply(this,arguments)}function F(a){z.apply(this,arguments)} -function W(a){z.apply(this,arguments)}function z(a){p.apply(this,arguments)}function I(a){H.apply(this,arguments)}function E(a){H.apply(this,arguments)}function N(a){H.apply(this,arguments)}function Z(a){H.apply(this,arguments)}function aa(a){H.apply(this,arguments)}function H(a){p.apply(this,arguments)}function y(a){M.apply(this,arguments)}function L(a){M.apply(this,arguments)}function ba(a){M.apply(this,arguments)}function ca(a){M.apply(this,arguments)}function da(a){M.apply(this,arguments)}function M(a){p.apply(this, -arguments)}function p(a){w.apply(this,arguments)}function w(){}function Y(a){var b=new ArrayBuffer(4);(new DataView(b)).setUint32(0,a);return b}function T(a,b){if(b&&(b=ga.get(a))){b=f.makeIterator(b);for(var c=b.next();!c.done;c=b.next()){var d=f.makeIterator(c.value),c=d.next().value,d=d.next().value,D=a.length;a.addAll(U.fromBinaryString(c));c=new ArrayBuffer(4);(new DataView(c)).setUint32(0,D);d=f.makeIterator(d);for(D=d.next();!D.done;D=d.next())a.setAll(D.value,c)}}}function V(a){if(a&&a.constructor=== -String&&(a=Number(a),!isNaN(a)))return a}function la(a,b){h.instanceOf(a,r);h.instanceOf(b,String);(t.gt(b,"9223372036854775807")||t.lt(b,"-9223372036854775808"))&&h.fail("Value out of range");var c=t.div(b,t.LONG_UPPER_SHIFT,!0);b=t.sub(b,t.mul(c,t.LONG_UPPER_SHIFT));var d=new ArrayBuffer(8),D=new DataView(d);D.setInt32(0,Number(c));D.setUint32(4,Number(b));a.addAll(d)}function ma(a,b){h.instanceOf(b,Array);for(var c=ha(b.length),d=ia(b.length),c=new ArrayBuffer(c?d+1:d),d=new Uint8Array(c),D=0;D< -b.length;D++){var C=b[D];h.instanceOf(C,Boolean);var e=ha(~ha(D));C?d[ia(D)]|=1<>8);d.setUint8(2,b&255);a.addAll(c)};f.global.Object.defineProperties(F,{_value:{configurable:!0,enumerable:!0,get:function(){return 27}}});f.inherits(G,z);G.prototype.writeValue=function(a,b){h.instanceOf(b,Date);var c=new ArrayBuffer(4);(new DataView(c)).setUint32(0,b.getTime()%864E5);a.addAll(c)};f.global.Object.defineProperties(G, -{_value:{configurable:!0,enumerable:!0,get:function(){return 28}}});f.inherits(v,p);f.inherits(S,v);S.prototype.writeValue=function(a,b){h.instanceOf(a,r);var c=V(b);void 0!==c&&(b=c);h.instanceOf(b,Number);c=new ArrayBuffer(4);(new DataView(c)).setFloat32(0,b);a.addAll(c)};f.global.Object.defineProperties(S,{_value:{configurable:!0,enumerable:!0,get:function(){return 32}}});f.inherits(Q,v);Q.prototype.writeValue=function(a,b){h.instanceOf(a,r);var c=V(b);void 0!==c&&(b=c);h.instanceOf(b,Number); -c=new ArrayBuffer(8);(new DataView(c)).setFloat64(0,b);a.addAll(c)};f.global.Object.defineProperties(Q,{_value:{configurable:!0,enumerable:!0,get:function(){return 33}}});f.inherits(P,p);P.prototype.writeValue=function(a,b){h.instanceOf(a,r);h.instanceOf(b,Boolean);b?a.add(255):a.add(0)};f.global.Object.defineProperties(P,{_value:{configurable:!0,enumerable:!0,get:function(){return 48}}});f.inherits(B,p);B.prototype.addToBuffer=function(a){p.prototype.addToBuffer.call(this,a)&&a.addAll(Y(this.length))}; -B.prototype.writeValue=function(a,b){h.instanceOf(a,r);h.instanceOf(b,Array);b.length!==this.length&&h.fail("Length does not match");ma(a,b)};f.global.Object.defineProperties(B,{_value:{configurable:!0,enumerable:!0,get:function(){return 49}}});f.inherits(O,p);O.prototype.writeValue=function(a,b){h.instanceOf(b,Array);h.fourByteUnsignedInteger(b.length);a.addAll(Y(b.length));ma(a,b)};f.global.Object.defineProperties(O,{_value:{configurable:!0,enumerable:!0,get:function(){return 50}}});f.inherits(J, -p);J.prototype.writeValue=function(a,b){h.instanceOf(a,r);h.instanceOf(b,String);h.assert(1===b.length,"String must contain only 1 character");a.addAll(U.fromString(b))};f.global.Object.defineProperties(J,{_value:{configurable:!0,enumerable:!0,get:function(){return 64}}});f.inherits(K,p);K.prototype.writeValue=function(a,b){h.instanceOf(a,r);h.instanceOf(b,String);b=U.fromString(b);a.addAll(b);a.add(0)};f.global.Object.defineProperties(K,{_value:{configurable:!0,enumerable:!0,get:function(){return 65}}}); -f.inherits(u,p);u.prototype.writeValue=function(a,b){h.instanceOf(a,r);h.instanceOf(b,ArrayBuffer);h.fourByteUnsignedInteger(b.byteLength);a.addAll(Y(b.byteLength));a.addAll(b)};f.global.Object.defineProperties(u,{_value:{configurable:!0,enumerable:!0,get:function(){return 66}}});f.inherits(A,p);A.prototype.addToBuffer=function(a){p.prototype.addToBuffer.call(this,a)&&(this.type.addToBuffer(a),a.addAll(Y(this.length)))};A.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;h.instanceOf(a,r);h.instanceOf(b, -Array);b.length!==this.length&&h.fail("Length does not match: expected "+String(this.length)+" but got "+b.length);b=f.makeIterator(b);for(var d=b.next();!d.done;d=b.next())this.type.writeValue(a,d.value,!1);T(a,c)};f.global.Object.defineProperties(A,{_value:{configurable:!0,enumerable:!0,get:function(){return 80}}});f.inherits(q,p);q.prototype.addToBuffer=function(a){if(p.prototype.addToBuffer.call(this,a)){a.add(this.fields.length);for(var b=f.makeIterator(this.fields),c=b.next();!c.done;c=b.next()){var c= -c.value,d=c.buffer;a.add(d.byteLength);a.addAll(d);c.type.addToBuffer(a)}}};q.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;h.instanceOf(a,r);h.instanceOf(b,Object);for(var d=f.makeIterator(this.fields),e=d.next();!e.done;e=d.next()){var e=e.value,g=b[e.name];try{e.type.writeValue(a,g,!1)}catch(X){throw void 0===g&&h.fail('Value for field "'+e.name+'" missing'),X;}}T(a,c)};f.global.Object.defineProperties(q,{_value:{configurable:!0,enumerable:!0,get:function(){return 81}}});f.inherits(n, -p);n.prototype.addToBuffer=function(a){p.prototype.addToBuffer.call(this,a)&&this.type.addToBuffer(a)};n.prototype._writeValue=function(a,b,c){h.instanceOf(a,r);var d=b.length;void 0===d&&(d=b.size);h.fourByteUnsignedInteger(d);a.addAll(Y(d));b=f.makeIterator(b);for(d=b.next();!d.done;d=b.next())this.type.writeValue(a,d.value,!1);T(a,c)};n.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;h.instanceOf(b,Array);this._writeValue(a,b,c)};f.global.Object.defineProperties(n,{_value:{configurable:!0, -enumerable:!0,get:function(){return 82}}});f.inherits(x,n);x.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;h.instanceOf(b,Set);this._writeValue(a,b,c)};f.global.Object.defineProperties(x,{_value:{configurable:!0,enumerable:!0,get:function(){return 83}}});f.inherits(R,p);R.prototype.addToBuffer=function(a){p.prototype.addToBuffer.call(this,a)&&(this.keyType.addToBuffer(a),this.valueType.addToBuffer(a))};R.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;h.instanceOf(a,r);h.instanceOf(b, -Map);h.fourByteUnsignedInteger(b.size);a.addAll(Y(b.size));b=f.makeIterator(b);for(var d=b.next();!d.done;d=b.next()){var e=f.makeIterator(d.value),d=e.next().value,e=e.next().value;this.keyType.writeValue(a,d,!1);this.valueType.writeValue(a,e,!1)}T(a,c)};f.global.Object.defineProperties(R,{_value:{configurable:!0,enumerable:!0,get:function(){return 84}}});f.inherits(l,w);l.prototype.addToBuffer=function(a){if(w.prototype.addToBuffer.call(this,a)){this.type.addToBuffer(a);a.add(this.valueIndices.size); -for(var b=f.makeIterator(this.valueIndices),c=b.next();!c.done;c=b.next()){var c=f.makeIterator(c.value),d=c.next().value;c.next();a.addAll(U.fromBinaryString(d))}}};l.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;h.instanceOf(a,r);var d=new r;this.type.writeValue(d,b,!1);d=this.valueIndices.get(U.toBinaryString(d.toBuffer()));h.assert(void 0!==d,"Not a valid enum value: "+ea.inspect(b));a.add(d);T(a,c)};f.global.Object.defineProperties(l,{_value:{configurable:!0,enumerable:!0,get:function(){return 85}}}); -f.inherits(k,p);k.prototype.addToBuffer=function(a){if(p.prototype.addToBuffer.call(this,a)){a.add(this.types.length);for(var b=f.makeIterator(this.types),c=b.next();!c.done;c=b.next())c.value.addToBuffer(a)}};k.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;h.instanceOf(a,r);for(var d=!1,e=0;e=b}},"es6-impl","es3"); +require=function ra(e,c,f){function d(l,m){if(!c[l]){if(!e[l]){var k="function"==typeof require&&require;if(!m&&k)return k(l,!0);if(b)return b(l,!0);m=Error("Cannot find module '"+l+"'");throw m.code="MODULE_NOT_FOUND",m;}m=c[l]={exports:{}};e[l][0].call(m.exports,function(b){var c=e[l][1][b];return d(c?c:b)},m,m.exports,ra,e,c,f)}return c[l].exports}for(var b="function"==typeof require&&require,m=0;mc.status||304===c.status?b[l]=c.response:b.text=c.statusText;d(c.status,c.statusText,b,c.getAllResponseHeaders())}); +c.open(m,b,e);c.responseType=l;for(var y in f)({}).hasOwnProperty.call(f,y)&&c.setRequestHeader(y,f[y]);c.send(k)},abort:function(){c&&c.abort()}}}})})(jQuery)},{}],"/client-side/common.js":[function(a){var e=a("/lib/assert.js");e.instanceOf(window.Map,Function);e.instanceOf(window.Set,Function);e.instanceOf(window.ArrayBuffer,Function);e.instanceOf(window.Uint8Array,Function);e.instanceOf(window.Symbol,Function);a("/client-side/binary-ajax.js");if(!window.sb){window.sb=a("/structure-types.js");a= +a("/recursive-registry.js");for(var c in a)({}).hasOwnProperty.call(a,c)&&(window.sb[c]=a[c])}else if(!(window.sb instanceof Object))throw Error("window.sb is already defined");},{"/client-side/binary-ajax.js":"/client-side/binary-ajax.js","/lib/assert.js":"/lib/assert.js","/recursive-registry.js":"/recursive-registry.js","/structure-types.js":"/structure-types.js"}],"/config.js":[function(a,e){a=a("base64-js");var c=new ArrayBuffer(2);(new DataView(c)).setUint16(0,10);a=a.fromByteArray(new Uint8Array(c)); +e.exports={VERSION_STRING:a}},{"base64-js":2}],"/lib/assert.js":[function(a,e){function c(){}var f=a("/lib/util-inspect.js");c.instanceOf=function(c,b){b instanceof Array||(b=[b]);for(var d=!1,a=g.makeIterator(b),k=a.next();!k.done;k=a.next())if(k=k.value,c instanceof k||void 0!==c&&null!==c&&c.constructor===k){d=!0;break}if(!d)throw new TypeError(f.inspect(c)+" is not an instance of "+b.map(function(b){return b.name}).join(" or "));};c.integer=function(d){c.instanceOf(d,Number);if(!Number.isSafeInteger(d))throw new RangeError(f.inspect(d)+ +" is not an integer");};c.between=function(c,b,a,l){if(b=a){c=f.inspect(b)+" is not in ["+f.inspect(c)+","+f.inspect(a)+")";if(void 0===l)throw new RangeError(c);throw new RangeError(l+" ("+c+")");}};c.byteUnsignedInteger=function(d){c.integer(d);c.between(0,d,256)};c.twoByteUnsignedInteger=function(d){c.integer(d);c.between(0,d,65536)};c.fourByteUnsignedInteger=function(d){c.integer(d);c.between(0,d,4294967296)};c.fail=function(c){throw Error(c);};c.assert=function(d,b){d||c.fail(b)};c.throws= +function(d,b){var a=!0;try{d(),a=!1}catch(l){void 0!==b&&c.message(l,b)}c.assert(a,"Should throw an error")};c.equal=function(d,b){var a=new RangeError("Expected "+f.inspect(b)+" but got "+f.inspect(d));if(b){var l=!0;switch(b.constructor){case Object:if(!d||d.constructor!==Object)throw a;for(var k in b)if({}.hasOwnProperty.call(b,k))try{c.equal(d[k],b[k])}catch(q){throw a;}break;case Array:if(!d||d.constructor!==Array)throw a;try{c.equal(d.length,b.length)}catch(q){throw a;}for(k=0;k>>3},modEight:function(c){return c&7}}},{}],"/lib/buffer-string.js":[function(a,e){(function(c){var f=a(c+"/assert.js"),d=a(c+"/growable-buffer.js");e.exports={toString:function(b){b&&b.constructor===ArrayBuffer&&(b=new Uint8Array(b));f.instanceOf(b, +Uint8Array);for(var c=[],a=0;ad&&(e=d);break;case 2:n=b[a+1];128===(n&192)&&(d=(d&31)<<6|n&63,127d||57343d&&(e=d))}}void 0=== +e?(e=65533,y=1):65535>>10&1023|55296),e=56320|e&1023);c.push(e);a+=y}b="";for(a=0;aa?c.add(a):(2048>a?c.add(192|a>>6):(55296>a||57344<=a?c.add(224|a>>12):(a=65536+((a&1023)<<10|a&1023),c.add(240|a>>18),c.add(128|a>>12&63)), +c.add(128|a>>6&63)),c.add(128|a&63));return c.toBuffer()},toBinaryString:function(b){f.instanceOf(b,ArrayBuffer);var a="";b=new Uint8Array(b);b=g.makeIterator(b);for(var c=b.next();!c.done;c=b.next())a+=String.fromCharCode(c.value);return a},fromBinaryString:function(b){f.instanceOf(b,String);for(var a=new ArrayBuffer(b.length),c=new Uint8Array(a),d=0;dthis.buffer.byteLength&&(b=new ArrayBuffer(b<<1),(new Uint8Array(b)).set((new Uint8Array(this.buffer)).subarray(0,this.size)),this.buffer=b);return this};f.prototype.set=function(b,a){d.integer(b);d.between(0,b,this.size,"Index out of bounds: "+String(b)); +d.integer(a);d.between(0,a,256,"Not a byte: "+String(a));(new Uint8Array(this.buffer))[b]=a;return this};f.prototype.setAll=function(b,a){d.instanceOf(a,ArrayBuffer);d.integer(b);d.between(0,b,this.size-a.byteLength+1,"Index out of bounds: "+String(b));(new Uint8Array(this.buffer)).set(new Uint8Array(a),b);return this};f.prototype.get=function(b){d.integer(b);d.between(0,b,this.size,"Index out of bounds: "+String(b));return(new Uint8Array(this.buffer))[b]};f.prototype.add=function(b){d.integer(b); +d.between(0,b,256,"Not a byte: "+String(b));var a=this.size,c=a+1;this.grow(c);this.size=c;(new Uint8Array(this.buffer))[a]=b;return this};f.prototype.addAll=function(b){d.instanceOf(b,ArrayBuffer);var a=this.size,c=this.size+b.byteLength;this.grow(c);this.size=c;(new Uint8Array(this.buffer)).set(new Uint8Array(b),a);return this};f.prototype.toBuffer=function(){return this.buffer.slice(0,this.size)};g.global.Object.defineProperties(f.prototype,{length:{configurable:!0,enumerable:!0,get:function(){return this.size}}, +rawBuffer:{configurable:!0,enumerable:!0,get:function(){return this.buffer}}});e.exports=f}).call(this,"/lib")},{}],"/lib/strint.js":[function(a,e){var c={};(function(){function a(b){return A(b)?b.length-1:b.length}function d(b,c){n(b);v(c,"number");return c>=a(b)?"0":b.charAt(b.length-c-1)}function b(b,a){q(b);B(a);for(var c=0;cb)throw Error("Expected a positive number: "+b);}function v(b,a){if(typeof b!==a)throw Error("Not a "+a+": "+b);}var K=c.subPositive=function(a,c){q(a);q(c);if(!F(a,c))throw Error("x must be greater or equal to y");for(var f=Math.max(a.length,c.length),e="",l=0,k=0,z=0;zd)throw Error("Illegal state");}};c.div=function(b,a,c){c=void 0===c?!1:c;n(b);n(a);var d=S(E(b),E(a))[0]; +R(b,a)||(d=N(d));!c||w(Q(d,a),b)||R(b,a)||(d=O(d,"1"));return d};var w=c.eq=function(b,a){return H(b)===H(a)},G=c.lt=function(b,a){return A(b)&&I(a)?!0:I(b)&&A(a)?!1:A(b)&&A(a)?!w(b,a)&&!l(E(b),E(a)):l(b,a)},F=c.ge=function(b,a){return!G(b,a)},W=c.gt=function(b,a){return w(b,a)?!1:F(b,a)},A=c.isNegative=function(b){n(b);return 0===b.indexOf("-")},I=c.isPositive=function(b){return!A(b)},E=c.abs=function(b){return A(b)?N(b):b},N=c.negate=function(b){return"0"===b?"0":A(b)?b.slice(1):"-"+b},X=/^(-?)0*([1-9][0-9]*)$/, +Y=/^0+$/,H=c.normalize=function(b){if(Y.test(b))return"0";var a=X.exec(b);if(!a)throw Error("Illegal strint format: "+b);return a[1]+a[2]}})();c.LONG_UPPER_SHIFT="4294967296";c.BYTE_SHIFT="256";e.exports=c},{}],"/lib/util-inspect.js":[function(a,e,c){c.inspect=function(a){if(void 0===a)return"undefined";if(null===a||a.constructor===Object||a.constructor===Array||a.constructor===String||a.constructor===Number||a.constructor===Boolean||a.constructor===Date)return JSON.stringify(a);if(a.constructor=== +Set){var d="Set {";a=a.values();for(var b=a.next();!b.done;)d+=c.inspect(b.value),b=a.next(),b.done||(d+=", ");return d+"}"}if(a.constructor===Map){d="Map {";a=a.entries();for(b=a.next();!b.done;)d+=c.inspect(b.value[0]),d+=" \x3d\x3e ",d+=c.inspect(b.value[1]),b=a.next(),b.done||(d+=", ");return d+"}"}return a.constructor.name?a.constructor.name+" "+JSON.stringify(a):JSON.stringify(a)}},{}],"/recursive-registry.js":[function(a,e){(function(c){"/"===c&&(c="");var f=a(c+"/lib/assert.js"),d=a(c+"/structure-types.js"), +b=new Map;e.exports={registerType:function(a){var c=a.type;a=a.name;f.instanceOf(c,[d.ArrayType,d.MapType,d.SetType,d.StructType,d.TupleType]);f.instanceOf(a,String);f.assert(!b.has(a),'"'+a+'" is already a registered type');b.set(a,c)},getType:function(a){f.instanceOf(a,String);var c=b.get(a);f.assert(void 0!==c,'"'+a+'" is not a registered type');return c},isRegistered:function(a){return b.has(a)}}}).call(this,"/")},{}],"/structure-types.js":[function(a,e){(function(c){function f(a){h.instanceOf(a, +p);this.type=a;return this}function d(a){var b;b=p.call(this)||this;h.instanceOf(a,x);b.type=a;return b}function b(a){var b;b=p.call(this)||this;h.instanceOf(a,String);b.name=a;return b}function m(a){var b;b=p.call(this)||this;h.instanceOf(a,Map);try{h.byteUnsignedInteger(a.size)}catch(Z){h.fail(String(a.size)+" types is too many")}b.indexConstructors=new Map;b.constructorTypes=Array(a.size);var c=new Set;a=g.makeIterator(a);for(var r=a.next();!r.done;r=a.next()){var d=g.makeIterator(r.value),r=d.next().value, +d=d.next().value;h.instanceOf(r,Function);var f=r.name;h.assert(f,'Function "'+String(f)+'" does not have a name');h.assert(!c.has(f),'Function name "'+f+'" is repeated');c.add(f);var e=U.fromString(f);try{h.byteUnsignedInteger(e.byteLength)}catch(Z){h.fail('Function name "'+f+'" is too long')}h.instanceOf(d,q);f=b.indexConstructors.size;b.indexConstructors.set(f,r);b.constructorTypes[f]={nameBuffer:e,type:d}}return b}function l(a){var b;b=p.call(this)||this;h.instanceOf(a,Array);try{h.byteUnsignedInteger(a.length)}catch(wa){h.fail(String(a.length)+ +" types is too many")}for(var c=g.makeIterator(a),r=c.next();!r.done;r=c.next())h.instanceOf(r.value,x);b.types=a;return b}function k(a){var b=a.type;a=a.values;h.instanceOf(b,p);h.instanceOf(a,Array);try{h.byteUnsignedInteger(a.length)}catch(la){h.fail(String(a.length)+" values is too many")}for(var c=new Map,r=0;rb.name)return 1});return b}function B(a){var b=a.type,c=a.length;a=p.call(this)||this;h.instanceOf(b,x);h.byteUnsignedInteger(c);a.type=b;a.length=c;return a}function v(a){return p.apply(this, +arguments)||this}function K(a){return p.apply(this,arguments)||this}function J(a){return p.apply(this,arguments)||this}function O(a){return p.apply(this,arguments)||this}function C(a){var b;b=p.call(this)||this;h.byteUnsignedInteger(a);b.length=a;return b}function P(a){return p.apply(this,arguments)||this}function Q(a){return w.apply(this,arguments)||this}function S(a){return w.apply(this,arguments)||this}function w(a){return p.apply(this,arguments)||this}function G(a){return A.apply(this,arguments)|| +this}function F(a){return A.apply(this,arguments)||this}function W(a){return A.apply(this,arguments)||this}function A(a){return p.apply(this,arguments)||this}function I(a){return H.apply(this,arguments)||this}function E(a){return H.apply(this,arguments)||this}function N(a){return H.apply(this,arguments)||this}function X(a){return H.apply(this,arguments)||this}function Y(a){return H.apply(this,arguments)||this}function H(a){return p.apply(this,arguments)||this}function z(a){return M.apply(this,arguments)|| +this}function L(a){return M.apply(this,arguments)||this}function aa(a){return M.apply(this,arguments)||this}function ba(a){return M.apply(this,arguments)||this}function ca(a){return M.apply(this,arguments)||this}function M(a){return p.apply(this,arguments)||this}function p(a){return x.apply(this,arguments)||this}function x(){}function da(a){var b=new ArrayBuffer(4);(new DataView(b)).setUint32(0,a);return b}function T(a,b){if(b&&(b=ga.get(a))){b=g.makeIterator(b);for(var c=b.next();!c.done;c=b.next()){var d= +g.makeIterator(c.value),c=d.next().value,d=d.next().value,D=a.length;a.addAll(U.fromBinaryString(c));c=new ArrayBuffer(4);(new DataView(c)).setUint32(0,D);d=g.makeIterator(d);for(D=d.next();!D.done;D=d.next())a.setAll(D.value,c)}}}function V(a){if(a&&a.constructor===String&&(a=Number(a),!isNaN(a)))return a}function ma(a,b){h.instanceOf(a,t);h.instanceOf(b,String);(u.gt(b,"9223372036854775807")||u.lt(b,"-9223372036854775808"))&&h.fail("Value out of range");var c=u.div(b,u.LONG_UPPER_SHIFT,!0);b=u.sub(b, +u.mul(c,u.LONG_UPPER_SHIFT));var d=new ArrayBuffer(8),D=new DataView(d);D.setInt32(0,Number(c));D.setUint32(4,Number(b));a.addAll(d)}function na(a,b){h.instanceOf(b,Array);for(var c=ha(b.length),d=ia(b.length),c=new ArrayBuffer(c?d+1:d),d=new Uint8Array(c),D=0;D>8);d.setUint8(2,b&255);a.addAll(c)};g.global.Object.defineProperties(F,{_value:{configurable:!0, +enumerable:!0,get:function(){return 27}}});g.inherits(G,A);G.prototype.writeValue=function(b,a){h.instanceOf(a,Date);var c=new ArrayBuffer(4);(new DataView(c)).setUint32(0,a.getTime()%864E5);b.addAll(c)};g.global.Object.defineProperties(G,{_value:{configurable:!0,enumerable:!0,get:function(){return 28}}});g.inherits(w,p);g.inherits(S,w);S.prototype.writeValue=function(b,a){h.instanceOf(b,t);var c=V(a);void 0!==c&&(a=c);h.instanceOf(a,Number);c=new ArrayBuffer(4);(new DataView(c)).setFloat32(0,a); +b.addAll(c)};g.global.Object.defineProperties(S,{_value:{configurable:!0,enumerable:!0,get:function(){return 32}}});g.inherits(Q,w);Q.prototype.writeValue=function(b,a){h.instanceOf(b,t);var c=V(a);void 0!==c&&(a=c);h.instanceOf(a,Number);c=new ArrayBuffer(8);(new DataView(c)).setFloat64(0,a);b.addAll(c)};g.global.Object.defineProperties(Q,{_value:{configurable:!0,enumerable:!0,get:function(){return 33}}});g.inherits(P,p);P.prototype.writeValue=function(b,a){h.instanceOf(b,t);h.instanceOf(a,Boolean); +a?b.add(255):b.add(0)};g.global.Object.defineProperties(P,{_value:{configurable:!0,enumerable:!0,get:function(){return 48}}});g.inherits(C,p);C.prototype.addToBuffer=function(b){p.prototype.addToBuffer.call(this,b)&&b.add(this.length)};C.prototype.writeValue=function(b,a){h.instanceOf(b,t);h.instanceOf(a,Array);a.length!==this.length&&h.fail("Length does not match");na(b,a)};g.global.Object.defineProperties(C,{_value:{configurable:!0,enumerable:!0,get:function(){return 49}}});g.inherits(O,p);O.prototype.writeValue= +function(b,a){h.instanceOf(a,Array);h.fourByteUnsignedInteger(a.length);b.addAll(da(a.length));na(b,a)};g.global.Object.defineProperties(O,{_value:{configurable:!0,enumerable:!0,get:function(){return 50}}});g.inherits(J,p);J.prototype.writeValue=function(b,a){h.instanceOf(b,t);h.instanceOf(a,String);h.assert(1===a.length,"String must contain only 1 character");b.addAll(U.fromString(a))};g.global.Object.defineProperties(J,{_value:{configurable:!0,enumerable:!0,get:function(){return 64}}});g.inherits(K, +p);K.prototype.writeValue=function(b,a){h.instanceOf(b,t);h.instanceOf(a,String);a=U.fromString(a);b.addAll(a);b.add(0)};g.global.Object.defineProperties(K,{_value:{configurable:!0,enumerable:!0,get:function(){return 65}}});g.inherits(v,p);v.prototype.writeValue=function(b,a){h.instanceOf(b,t);h.instanceOf(a,ArrayBuffer);h.fourByteUnsignedInteger(a.byteLength);b.addAll(da(a.byteLength));b.addAll(a)};g.global.Object.defineProperties(v,{_value:{configurable:!0,enumerable:!0,get:function(){return 66}}}); +g.inherits(B,p);B.prototype.addToBuffer=function(a){p.prototype.addToBuffer.call(this,a)&&(this.type.addToBuffer(a),a.add(this.length))};B.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;h.instanceOf(a,t);h.instanceOf(b,Array);b.length!==this.length&&h.fail("Length does not match: expected "+String(this.length)+" but got "+b.length);b=g.makeIterator(b);for(var d=b.next();!d.done;d=b.next())this.type.writeValue(a,d.value,!1);T(a,c)};g.global.Object.defineProperties(B,{_value:{configurable:!0, +enumerable:!0,get:function(){return 80}}});g.inherits(q,p);q.prototype.addToBuffer=function(a){if(p.prototype.addToBuffer.call(this,a)){a.add(this.fields.length);for(var b=g.makeIterator(this.fields),c=b.next();!c.done;c=b.next()){var c=c.value,d=c.buffer;a.add(d.byteLength);a.addAll(d);c.type.addToBuffer(a)}}};q.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;h.instanceOf(a,t);h.instanceOf(b,Object);for(var d=g.makeIterator(this.fields),f=d.next();!f.done;f=d.next()){var f=f.value,e=b[f.name]; +try{f.type.writeValue(a,e,!1)}catch(la){throw void 0===e&&h.fail('Value for field "'+f.name+'" missing'),la;}}T(a,c)};g.global.Object.defineProperties(q,{_value:{configurable:!0,enumerable:!0,get:function(){return 81}}});g.inherits(n,p);n.prototype.addToBuffer=function(a){p.prototype.addToBuffer.call(this,a)&&this.type.addToBuffer(a)};n.prototype._writeValue=function(a,b,c){h.instanceOf(a,t);var d=b.length;void 0===d&&(d=b.size);h.fourByteUnsignedInteger(d);a.addAll(da(d));b=g.makeIterator(b);for(d= +b.next();!d.done;d=b.next())this.type.writeValue(a,d.value,!1);T(a,c)};n.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;h.instanceOf(b,Array);this._writeValue(a,b,c)};g.global.Object.defineProperties(n,{_value:{configurable:!0,enumerable:!0,get:function(){return 82}}});g.inherits(y,n);y.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;h.instanceOf(b,Set);this._writeValue(a,b,c)};g.global.Object.defineProperties(y,{_value:{configurable:!0,enumerable:!0,get:function(){return 83}}});g.inherits(R, +p);R.prototype.addToBuffer=function(a){p.prototype.addToBuffer.call(this,a)&&(this.keyType.addToBuffer(a),this.valueType.addToBuffer(a))};R.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;h.instanceOf(a,t);h.instanceOf(b,Map);h.fourByteUnsignedInteger(b.size);a.addAll(da(b.size));b=g.makeIterator(b);for(var d=b.next();!d.done;d=b.next()){var f=g.makeIterator(d.value),d=f.next().value,f=f.next().value;this.keyType.writeValue(a,d,!1);this.valueType.writeValue(a,f,!1)}T(a,c)};g.global.Object.defineProperties(R, +{_value:{configurable:!0,enumerable:!0,get:function(){return 84}}});g.inherits(k,x);k.prototype.addToBuffer=function(a){if(x.prototype.addToBuffer.call(this,a)){this.type.addToBuffer(a);a.add(this.valueIndices.size);for(var b=g.makeIterator(this.valueIndices),c=b.next();!c.done;c=b.next()){var c=g.makeIterator(c.value),d=c.next().value;c.next();a.addAll(U.fromBinaryString(d))}}};k.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;h.instanceOf(a,t);var d=new t;this.type.writeValue(d,b,!1);d=this.valueIndices.get(U.toBinaryString(d.toBuffer())); +h.assert(void 0!==d,"Not a valid enum value: "+ea.inspect(b));a.add(d);T(a,c)};g.global.Object.defineProperties(k,{_value:{configurable:!0,enumerable:!0,get:function(){return 85}}});g.inherits(l,p);l.prototype.addToBuffer=function(a){if(p.prototype.addToBuffer.call(this,a)){a.add(this.types.length);for(var b=g.makeIterator(this.types),c=b.next();!c.done;c=b.next())c.value.addToBuffer(a)}};l.prototype.writeValue=function(a,b,c){c=void 0===c?!0:c;h.instanceOf(a,t);for(var d=!1,f=0;f>18&63]+b[c>>12&63]+b[c>>6&63]+b[c&63]);return f.join("")}c.byteLength=function(a){return 3*a.length/4-f(a)};c.toByteArray=function(a){var b,c,d,e,k;b=a.length;e=f(a);k=new l(3*b/4-e);c=0>16&255,k[v++]=d>>8&255,k[v++]=d&255;2===e?(d=m[a.charCodeAt(b)]<<2|m[a.charCodeAt(b+1)]>> +4,k[v++]=d&255):1===e&&(d=m[a.charCodeAt(b)]<<10|m[a.charCodeAt(b+1)]<<4|m[a.charCodeAt(b+2)]>>2,k[v++]=d>>8&255,k[v++]=d&255);return k};c.fromByteArray=function(a){for(var c=a.length,f=c%3,e="",l=[],k=0,m=c-f;km?m:k+16383));1===f?(a=a[c-1],e+=b[a>>2],e+=b[a<<4&63],e+="\x3d\x3d"):2===f&&(a=(a[c-2]<<8)+a[c-1],e+=b[a>>10],e+=b[a>>4&63],e+=b[a<<2&63],e+="\x3d");l.push(e);return l.join("")};var b=[],m=[],l="undefined"!==typeof Uint8Array?Uint8Array:Array;for(a=0;64>a;++a)b[a]= +"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[a],m["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(a)]=a;m[45]=62;m[95]=63},{}],3:[function(a,e){!function(a){function c(a){return a.map(function(a){a=a.toString(16);a=2>>5]|=e[l]<<24-B%32;a=8*a.length;k[a>>5]|=128<<24-a%32;k[(a+64>>9<<4)+15]=a;for(a=0;aw;w++){if(16>w)m[w]=l[B+w]|0;else{var G=m[w-15],F=m[w-2];m[w]=((G<<25|G>>>7)^(G<<14|G>>>18)^G>>>3)+m[w-7]+((F<<15|F>>>17)^(F<<13|F>>>19)^F>>>10)+m[w-16]}G=S+((C<<26|C>>>6)^(C<<21|C>>>11)^(C<<7|C>>>25))+(C&P^~C&Q)+b[w]+m[w];F=((v<<30|v>>>2)^(v<<19|v>>>13)^(v<<10|v>>>22))+(v&K^v&J^K&J);S=Q;Q=P;P=C;C=O+G|0;O=J;J=K;K=v;v=G+F|0}e[0]=e[0]+v|0;e[1]=e[1]+K|0;e[2]=e[2]+J|0;e[3]=e[3]+O|0;e[4]=e[4]+C|0;e[5]=e[5]+P|0;e[6]=e[6]+Q|0;e[7]=e[7]+S|0}k=[];for(a=0;a<32*f.length;a+=8)k.push(f[a>>>5]>>>24- +a%32&255);return c&&c.asBytes?k:c&&c.asString?d.convertString.bytesToString(k):d.bytesToHex(k)}var d={};"undefined"!==typeof e&&e.exports?(d.bytesToHex=a("convert-hex").bytesToHex,d.convertString=a("convert-string"),e.exports=f):(d.bytesToHex=c.convertHex.bytesToHex,d.convertString=c.convertString,c.sha256=f);var b=[];!function(){function a(a){for(var b=Math.sqrt(a),c=2;c<=b;c++)if(!(a%c))return!1;return!0}function c(a){return 4294967296*(a-(a|0))|0}for(var d=2,e=0;64>e;)a(d)&&(b[e]=c(Math.pow(d, +1/3)),e++),d++}();var m=[];f.x2=function(a,b){return f(f(a,{asBytes:!0}),b)}}(this)},{"convert-hex":3,"convert-string":4}]},{},[1]);}() \ No newline at end of file diff --git a/config.js b/config.js index 24c50f1..ed8505e 100644 --- a/config.js +++ b/config.js @@ -1,11 +1,9 @@ //For use with browserify if (__dirname === '/') __dirname = '' -const assert = require(__dirname + '/lib/assert.js') const base64 = require('base64-js') -const VERSION = 9 -assert.between(0, VERSION, 65536) +const VERSION = 10 const VERSION_BYTES = 2 const VERSION_BUFFER = new ArrayBuffer(VERSION_BYTES) new DataView(VERSION_BUFFER).setUint16(0, VERSION) diff --git a/docs/ArrayType.html b/docs/ArrayType.html index 846c0d5..db69081 100644 --- a/docs/ArrayType.html +++ b/docs/ArrayType.html @@ -141,7 +141,7 @@
Parameters:
Source:
@@ -1152,7 +1152,7 @@
Parameters:
Source:
diff --git a/docs/BooleanArrayType.html b/docs/BooleanArrayType.html index 41dfc2b..d5c3e14 100644 --- a/docs/BooleanArrayType.html +++ b/docs/BooleanArrayType.html @@ -91,7 +91,7 @@

new B
Source:
@@ -1102,7 +1102,7 @@

Parameters:
Source:
diff --git a/docs/BooleanTupleType.html b/docs/BooleanTupleType.html index a1501e3..a45f3e0 100644 --- a/docs/BooleanTupleType.html +++ b/docs/BooleanTupleType.html @@ -30,7 +30,8 @@

Class: BooleanTupleType

BooleanTupleType

-
A type storing a fixed-length array of Boolean values
+
A type storing a fixed-length array of Boolean values. +The length must be less than 256.
@@ -99,7 +100,8 @@
Parameters:
- The number of Booleans in each value of this type + The number of Booleans in each value of this type. +Must fit in a 1-byte unsigned integer. @@ -140,7 +142,7 @@
Parameters:
Source:
@@ -1153,7 +1155,7 @@
Parameters:
Source:
diff --git a/docs/CharType.html b/docs/CharType.html index f6d79d9..9b380d2 100644 --- a/docs/CharType.html +++ b/docs/CharType.html @@ -91,7 +91,7 @@

new CharType<
Source:
@@ -1095,7 +1095,7 @@

Parameters:
Source:
diff --git a/docs/ChoiceType.html b/docs/ChoiceType.html index 757edc4..f0f1fff 100644 --- a/docs/ChoiceType.html +++ b/docs/ChoiceType.html @@ -145,7 +145,7 @@
Parameters:
Source:
@@ -1159,7 +1159,7 @@
Parameters:
Source:
diff --git a/docs/EnumType.html b/docs/EnumType.html index d96d640..973105b 100644 --- a/docs/EnumType.html +++ b/docs/EnumType.html @@ -214,7 +214,7 @@
Properties
Source:
@@ -1232,7 +1232,7 @@
Parameters:
Source:
diff --git a/docs/MapType.html b/docs/MapType.html index d9a91d8..27639e1 100644 --- a/docs/MapType.html +++ b/docs/MapType.html @@ -164,7 +164,7 @@
Parameters:
Source:
@@ -1178,7 +1178,7 @@
Parameters:
Source:
diff --git a/docs/NamedChoiceType.html b/docs/NamedChoiceType.html index d75a307..f137770 100644 --- a/docs/NamedChoiceType.html +++ b/docs/NamedChoiceType.html @@ -156,7 +156,7 @@
Parameters:
Source:
@@ -1189,7 +1189,7 @@
Parameters:
Source:
diff --git a/docs/OctetsType.html b/docs/OctetsType.html index 110575b..61e9a7c 100644 --- a/docs/OctetsType.html +++ b/docs/OctetsType.html @@ -93,7 +93,7 @@

new OctetsT
Source:
@@ -1097,7 +1097,7 @@

Parameters:
Source:
diff --git a/docs/OptionalType.html b/docs/OptionalType.html index 452a98a..ba96d3b 100644 --- a/docs/OptionalType.html +++ b/docs/OptionalType.html @@ -142,7 +142,7 @@
Parameters:
Source:
@@ -1162,7 +1162,7 @@
Parameters:
Source:
diff --git a/docs/PointerType.html b/docs/PointerType.html index 9869d7b..9efd801 100644 --- a/docs/PointerType.html +++ b/docs/PointerType.html @@ -144,7 +144,7 @@
Parameters:
Source:
@@ -1165,7 +1165,7 @@
Parameters:
Source:
diff --git a/docs/RecursiveType.html b/docs/RecursiveType.html index 3059ef7..bee0d71 100644 --- a/docs/RecursiveType.html +++ b/docs/RecursiveType.html @@ -145,7 +145,7 @@
Parameters:
Source:
@@ -1163,7 +1163,7 @@
Parameters:
Source:
diff --git a/docs/SetType.html b/docs/SetType.html index 3ca3b68..867a8ad 100644 --- a/docs/SetType.html +++ b/docs/SetType.html @@ -93,7 +93,7 @@

new SetTypeSource:
@@ -1104,7 +1104,7 @@
Parameters:
Source:
diff --git a/docs/StringType.html b/docs/StringType.html index 359fa3d..d8378a1 100644 --- a/docs/StringType.html +++ b/docs/StringType.html @@ -91,7 +91,7 @@

new StringT
Source:
@@ -1095,7 +1095,7 @@

Parameters:
Source:
diff --git a/docs/StructType.html b/docs/StructType.html index 5267a64..e97c775 100644 --- a/docs/StructType.html +++ b/docs/StructType.html @@ -142,7 +142,7 @@
Parameters:
Source:
@@ -1156,7 +1156,7 @@
Parameters:
Source:
diff --git a/docs/TupleType.html b/docs/TupleType.html index fdc5e6e..a874d26 100644 --- a/docs/TupleType.html +++ b/docs/TupleType.html @@ -31,7 +31,7 @@

Class: TupleType

TupleType

A type storing a fixed-length array of values of the same type. -The length must fit in a 4-byte unsigned integer.
+The length must be less than 256. @@ -165,8 +165,8 @@
Properties
- The number of elements in the tuple -Must fit in a 4-byte unsigned integer. + The number of elements in the tuple. +Must fit in a 1-byte unsigned integer. @@ -214,7 +214,7 @@
Properties
Source:
@@ -1224,7 +1224,7 @@
Parameters:
Source:
diff --git a/docs/index.html b/docs/index.html index 16900bc..3661aa9 100644 --- a/docs/index.html +++ b/docs/index.html @@ -87,7 +87,7 @@

Data types

  • BooleanArray (a variable-length array of Booleans)
  • Char (a single UTF-8 character)
  • String (an array of UTF-8 characters that also stores its total byte length)
  • -
  • Octets (a Buffer (raw binary data))
  • +
  • Octets (an ArrayBuffer (raw binary data))
  • Recursive types
      @@ -98,6 +98,7 @@

      Data types

      • Map<KeyType, ValueType> (a mapping of KeyType instances to ValueType instances)
      • Enum<Type> (a fixed set of up to 255 Types; useful when only a small subset of Type instances represent possible values, especially with Strings)
      • Choice (a fixed set of up to 255 types that values can take on)
      • +
      • NamedChoice (a fixed set of up to 255 named types that values can take on, each associated with a constructor)
      • Recursive<Type> (a type that can reference itself and be used to serialize circular data structures)
      • Optional<Type> (either null or an instance of Type)
      • Pointer<Type> (allows multiple long instances of Type with the same bytes to be stored only once)
      • @@ -275,11 +276,254 @@

        Examples

        Type creation

        [
        +    0x51 /*StructType*/,
        +        2 /*2 fields*/,
        +            3 /*3 characters in first field's name*/, 0x61 /*a*/, 0x62 /*b*/, 0x63 /*c*/, 0x01 /*ByteType*/,
        +            3 /*3 characters in second field's name*/, 0x64 /*d*/, 0x65 /*e*/, 0x66 /*f*/, 0x41 /*StringType*/
        +]

        If the type has already been written to the buffer, it is also valid to serialize the type as:

        +
          +
        • 0xFF
        • +
        • offset ([position of first byte of offset in buffer] - [position of type in buffer]) - uint16_t
        • +
        +

        For example:

        +
        const someType = new sb.TupleType({
        +    type: new sb.FloatType,
        +    length: 3
        +})
        +const type = new sb.StructType({
        +    one: someType,
        +    two: someType
        +})
        +//type translates into
        +[
        +    0x51 /*StructType*/,
        +        2 /*2 fields*/,
        +            3 /*3 characters in first field's name*/, 0x6f /*o*/, 0x6e /*n*/, 0x65 /*e*/,
        +                0x50 /*TupleType*/,
        +                    0x20 /*FloatType*/,
        +                    3 /*3 floats in the tuple*/,
        +            3 /*3 characters in second field's name*/, 0x74 /*t*/, 0x77 /*w*/, 0x6f /*o*/,
        +                0xff, /*type is defined previously*/
        +                    0, 11 /*type is defined 11 bytes before the 0 on this line*/
        +]

        In the following definitions, type means the binary type format.

        +
          +
        • ByteType: identifier 0x01
        • +
        • ShortType: identifier 0x02
        • +
        • IntType: identifier 0x03
        • +
        • LongType: identifier 0x04
        • +
        • BigIntType: identifier 0x05
        • +
        • UnsignedByteType: identifier 0x11
        • +
        • UnsignedShortType: identifier 0x12
        • +
        • UnsignedIntType: identifier 0x13
        • +
        • UnsignedLongType: identifier 0x14
        • +
        • BigUnsignedIntType: identifier 0x15
        • +
        • DateType: identifier 0x1A
        • +
        • DayType: identifier 0x1B
        • +
        • TimeType: identifier 0x1C
        • +
        • FloatType: identifier 0x20
        • +
        • DoubleType: identifier 0x21
        • +
        • BooleanType: identifier 0x30
        • +
        • BooleanTupleType: identifier 0x31, payload:
            +
          • length - uint8_t
          • +
          +
        • +
        • BooleanArrayType: identifier 0x32
        • +
        • CharType: identifier 0x40
        • +
        • StringType: identifier 0x41
        • +
        • OctetsType: identifier 0x42
        • +
        • TupleType: identifier 0x50, payload:
            +
          • elementType - type
          • +
          • length - uint8_t
          • +
          +
        • +
        • StructType: identifier 0x51, payload:
            +
          • fieldCount - uint8_t
          • +
          • fieldCount instances of field:
              +
            • nameLength - uint8_t
            • +
            • name - a UTF-8 string containing nameLength bytes
            • +
            • fieldType - type
            • +
            +
          • +
          +
        • +
        • ArrayType: identifier 0x52, payload:
            +
          • elementType - type
          • +
          +
        • +
        • SetType: identifier 0x53, payload identical to ArrayType:
            +
          • elementType - type
          • +
          +
        • +
        • MapType: identifier 0x54, payload:
            +
          • keyType - type
          • +
          • valueType - type
          • +
          +
        • +
        • EnumType: identifier 0x55, payload:
            +
          • valueType - type
          • +
          • valueCount - uint8_t
          • +
          • valueCount instances of value:
              +
            • value - a value that conforms to valueType
            • +
            +
          • +
          +
        • +
        • ChoiceType: identifier 0x56, payload:
            +
          • typeCount - uint8_t
          • +
          • typeCount instances of possibleType:
              +
            • possibleType - type
            • +
            +
          • +
          +
        • +
        • NamedChoiceType: identifier 0x58, payload:
            +
          • typeCount - uint8_t
          • +
          • typeCount instances of possibleType:
              +
            • typeNameLength - uint8_t
            • +
            • typeName - a UTF-8 string containing typeNameLength bytes
            • +
            • typeType - type
            • +
            +
          • +
          +
        • +
        • RecursiveType: identifier 0x57, payload:
            +
          • recursiveID (an identifier unique to this recursive type in this type buffer) - uint16_t
          • +
          • If this is the first instance of this recursive type in this buffer:
              +
            • recursiveType (the type definition of this type) - type
            • +
            +
          • +
          +
        • +
        • OptionalType: identifier 0x60, payload:
            +
          • typeIfNonNull - type
          • +
          +
        • +
        • PointerType: identifier 0x70, payload:
            +
          • targetType - type
          • +
          +
        • +
        +

        Value

          +
        • ByteType: 1-byte integer
        • +
        • ShortType: 2-byte integer
        • +
        • IntType: 4-byte integer
        • +
        • LongType: 8-byte integer
        • +
        • BigIntType:
            +
          • byteCount - uint16_t
          • +
          • number - byteCount-byte integer
          • +
          +
        • +
        • UnsignedByteType: 1-byte unsigned integer
        • +
        • UnsignedShortType: 2-byte unsigned integer
        • +
        • UnsignedIntType: 4-byte unsigned integer
        • +
        • UnsignedLongType: 8-byte unsigned integer
        • +
        • BigUnsignedIntType:
            +
          • byteCount - uint16_t
          • +
          • number - byteCount-byte unsigned integer
          • +
          +
        • +
        • DateType: 8-byte unsigned integer storing milliseconds in Unix time
        • +
        • DayType: 3-byte unsigned integer storing days since the Unix time epoch
        • +
        • TimeType: 4-byte unsigned integer storing milliseconds since the start of the day
        • +
        • FloatType: single precision (4-byte) IEEE floating point
        • +
        • DoubleType: double precision (8-byte) IEEE floating point
        • +
        • BooleanType: 1-byte value, either 0x00 for false or 0xFF for true
        • +
        • BooleanTupleType: ceil(length / 8) bytes, where the nth boolean is stored at the (n % 8)th MSB (0-indexed) of the floor(n / 8)th byte (0-indexed)
        • +
        • BooleanArrayType:
            +
          • length - uint32_t
          • +
          • booleans - ceil(length / 8) bytes, where the nth boolean is stored at the (n % 8)th MSB (0-indexed) of the floor(n / 8)th byte (0-indexed)
          • +
          +
        • +
        • CharType: UTF-8 codepoint (somewhere between 1 and 4 bytes long)
        • +
        • StringType:
            +
          • string - a UTF-8 string of any length not containing '\0'
          • +
          • 0x00 to mark the end of the string
          • +
          +
        • +
        • OctetsType:
            +
          • length - uint32_t
          • +
          • octets - length bytes
          • +
          +
        • +
        • TupleType:
            +
          • length values serialized by elementType
          • +
          +
        • +
        • StructType:
            +
          • For each field in order of declaration in the type format:
              +
            • The field's value serialized by fieldType
            • +
            +
          • +
          +
        • +
        • ArrayType:
            +
          • length - uint32_t
          • +
          • length values serialized by elementType
          • +
          +
        • +
        • SetType:
            +
          • size - uint32_t
          • +
          • size values serialized by elementType
          • +
          +
        • +
        • MapType:
            +
          • size - uint32_t
          • +
          • size instances of keyValuePair:
              +
            • key - value serialized by keyType
            • +
            • value - value serialized by valueType
            • +
            +
          • +
          +
        • +
        • EnumType:
            +
          • index of value in values array - uint8_t
          • +
          +
        • +
        • ChoiceType:
            +
          • index of type in possible types array - uint8_t
          • +
          • value - value serialized by specified type
          • +
          +
        • +
        • NamedChoiceType:
            +
          • index of type in possible types array - uint8_t
          • +
          • value - value serialized by specified type
          • +
          +
        • +
        • RecursiveType:
            +
          • valueNotYetWrittenInBuffer - byte containing either 0x00 or 0xFF
          • +
          • If valueNotYetWrittenInBuffer:
              +
            • value - value serialized by recursiveType
            • +
            +
          • +
          • Else:
              +
            • offset ([position of first byte of offset in buffer] - [position of value in buffer]) - uint32_t
            • +
            +
          • +
          +
        • +
        • OptionalType:
            +
          • valueIsNonNull - byte containing either 0x00 or 0xFF
          • +
          • If valueIsNonNull:
              +
            • value - value serialized by typeIfNonNull
            • +
            +
          • +
          +
        • +
        • PointerType:
            +
          • index of value in buffer (note: if buffer contains both a type and a value, this index is relative to the start of the value data) - uint32_t
          • +
          +
        • +
        +

        Versioning

        Versions will be of the form x.y.z. x is the major release; changes to it represent significant or breaking changes to the API. Before the full release, it was 0. y is the minor release; changes to it represent bug-fixing, non-breaking releases. z is the version of the type and value specification, which is independent of the API version. It should match the version set in config.js.

        -

        Testing

        To test the NodeJS code, run npm test. +

        Testing

        To test the Node.js code, run npm test. To test the HTTP transaction code, run node client-test/server.js and open localhost:8080 in your browser. Open each link in a new page. Upload and Download should each alert Success, while Upload & Download should alert Upload: Success and Download: Success.

        Caleb Sander, 2016

        diff --git a/docs/r.html b/docs/r.html index 8dd3da1..7ad0f6c 100644 --- a/docs/r.html +++ b/docs/r.html @@ -70,7 +70,7 @@

        r

        Source:
        @@ -262,7 +262,7 @@
        Parameters:
        Source:
        @@ -555,7 +555,7 @@
        Properties
        Source:
        diff --git a/docs/read.js.html b/docs/read.js.html index 9a44cca..f144aca 100644 --- a/docs/read.js.html +++ b/docs/read.js.html @@ -435,34 +435,36 @@

        Source: read.js

        //Returns the type that was read and the number of bytes consumed function consumeType(typeBuffer, offset) { assert.assert(offset >= 0, 'Offset is negative: ' + String(offset)) + const castBuffer = new Uint8Array(typeBuffer) assert.assert(typeBuffer.byteLength > offset, NOT_LONG_ENOUGH) //make sure there is a type byte + const typeByte = castBuffer[offset] let value, length = 1 - const typeByte = new Uint8Array(typeBuffer)[offset] for (const testType of SINGLE_BYTE_TYPES) { if (typeByte === testType._value) return {value: new testType, length} //eslint-disable-line new-cap } switch (typeByte) { case t.BooleanTupleType._value: { - const tupleLength = readLengthBuffer(typeBuffer, offset + length) - value = new t.BooleanTupleType(tupleLength.value) - length += tupleLength.length + assert.assert(typeBuffer.byteLength > offset + length, NOT_LONG_ENOUGH) + const tupleLength = castBuffer[offset + length] + length++ + value = new t.BooleanTupleType(tupleLength) break } case t.TupleType._value: { const type = consumeType(typeBuffer, offset + length) length += type.length - const tupleLength = readLengthBuffer(typeBuffer, offset + length) - length += tupleLength.length + assert.assert(typeBuffer.byteLength > offset + length, NOT_LONG_ENOUGH) + const tupleLength = castBuffer[offset + length] + length++ value = new t.TupleType({ type: type.value, - length: tupleLength.value + length: tupleLength }) break } case t.StructType._value: { assert.assert(typeBuffer.byteLength > offset + length, NOT_LONG_ENOUGH) - const castBuffer = new Uint8Array(typeBuffer) const fieldCount = castBuffer[offset + length] length++ const fields = {} @@ -541,7 +543,6 @@

        Source: read.js

        } case t.NamedChoiceType._value: { assert.assert(typeBuffer.byteLength > offset + length, NOT_LONG_ENOUGH) - const castBuffer = new Uint8Array(typeBuffer) const typeCount = castBuffer[offset + length] length++ const constructorTypes = new Map diff --git a/docs/structure-types.js.html b/docs/structure-types.js.html index e85c150..4381e21 100644 --- a/docs/structure-types.js.html +++ b/docs/structure-types.js.html @@ -743,7 +743,8 @@

        Source: structure-types.js

        buffer.addAll(byteBuffer) } /** - * A type storing a fixed-length array of {@link Boolean} values + * A type storing a fixed-length array of {@link Boolean} values. + * The length must be less than 256. * @see BooleanType * @see TupleType * @extends Type @@ -754,15 +755,16 @@

        Source: structure-types.js

        return 0x31 } /** - * @param {number} length The number of {@link Boolean}s in each value of this type + * @param {number} length The number of {@link Boolean}s in each value of this type. + * Must fit in a 1-byte unsigned integer. */ constructor(length) { super() - assert.fourByteUnsignedInteger(length) + assert.byteUnsignedInteger(length) this.length = length } addToBuffer(buffer) { - if (super.addToBuffer(buffer)) buffer.addAll(lengthBuffer(this.length)) + if (super.addToBuffer(buffer)) buffer.add(this.length) } /** * Appends value bytes to a {@link GrowableBuffer} according to the type @@ -874,7 +876,7 @@

        Source: structure-types.js

        /** * A type storing a fixed-length array of values of the same type. - * The length must fit in a 4-byte unsigned integer. + * The length must be less than 256. * @example * //For storing 5 4-byte unsigned integers * let type = new sb.TupleType({type: new sb.UnsignedIntType, length: 5}) @@ -888,20 +890,20 @@

        Source: structure-types.js

        /** * @param {{type, length}} params * @param {Type} params.type The type of each element in the tuple - * @param {number} params.length The number of elements in the tuple - * Must fit in a 4-byte unsigned integer. + * @param {number} params.length The number of elements in the tuple. + * Must fit in a 1-byte unsigned integer. */ constructor({type, length}) { super() assert.instanceOf(type, Type) - assert.fourByteUnsignedInteger(length) + assert.byteUnsignedInteger(length) this.type = type this.length = length } addToBuffer(buffer) { if (super.addToBuffer(buffer)) { this.type.addToBuffer(buffer) - buffer.addAll(lengthBuffer(this.length)) + buffer.add(this.length) } } /** diff --git a/eslint.sh b/eslint.sh index afcc7ab..5864c99 100755 --- a/eslint.sh +++ b/eslint.sh @@ -1,3 +1,3 @@ #!/bin/bash which eslint > /dev/null || npm install -g eslint -eslint --quiet $(find . -name "*.js") \ No newline at end of file +eslint --quiet $(find . -name "*.js" | grep -v "node_modules") #Removing node_modules files because Windows throws an error if argument list is too long \ No newline at end of file diff --git a/package.json b/package.json index b6e788c..fac85ac 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "structure-bytes", - "version": "2.23.9", - "description": "A library for more efficient data transfers by separating the structure from the values and efficiently storing each as binary data", + "version": "3.0.10", + "description": "A library for more efficient data transfers by separating the structure from the values and storing each as binary data", "main": "index.js", "dependencies": { "accepts": "1.3.x", @@ -14,7 +14,7 @@ "babel-preset-es2015": "6.18.x", "browserify": "13.1.x", "coveralls": "2.11.x", - "google-closure-compiler-js": "20161024.0.0", + "google-closure-compiler-js": "20161201.0.0", "nyc": "10.0.x", "simultaneity": "1.0.x" }, diff --git a/read.js b/read.js index 618284a..4cf98ad 100644 --- a/read.js +++ b/read.js @@ -407,34 +407,36 @@ const recursiveNames = new WeakMap //Returns the type that was read and the number of bytes consumed function consumeType(typeBuffer, offset) { assert.assert(offset >= 0, 'Offset is negative: ' + String(offset)) + const castBuffer = new Uint8Array(typeBuffer) assert.assert(typeBuffer.byteLength > offset, NOT_LONG_ENOUGH) //make sure there is a type byte + const typeByte = castBuffer[offset] let value, length = 1 - const typeByte = new Uint8Array(typeBuffer)[offset] for (const testType of SINGLE_BYTE_TYPES) { if (typeByte === testType._value) return {value: new testType, length} //eslint-disable-line new-cap } switch (typeByte) { case t.BooleanTupleType._value: { - const tupleLength = readLengthBuffer(typeBuffer, offset + length) - value = new t.BooleanTupleType(tupleLength.value) - length += tupleLength.length + assert.assert(typeBuffer.byteLength > offset + length, NOT_LONG_ENOUGH) + const tupleLength = castBuffer[offset + length] + length++ + value = new t.BooleanTupleType(tupleLength) break } case t.TupleType._value: { const type = consumeType(typeBuffer, offset + length) length += type.length - const tupleLength = readLengthBuffer(typeBuffer, offset + length) - length += tupleLength.length + assert.assert(typeBuffer.byteLength > offset + length, NOT_LONG_ENOUGH) + const tupleLength = castBuffer[offset + length] + length++ value = new t.TupleType({ type: type.value, - length: tupleLength.value + length: tupleLength }) break } case t.StructType._value: { assert.assert(typeBuffer.byteLength > offset + length, NOT_LONG_ENOUGH) - const castBuffer = new Uint8Array(typeBuffer) const fieldCount = castBuffer[offset + length] length++ const fields = {} @@ -513,7 +515,6 @@ function consumeType(typeBuffer, offset) { } case t.NamedChoiceType._value: { assert.assert(typeBuffer.byteLength > offset + length, NOT_LONG_ENOUGH) - const castBuffer = new Uint8Array(typeBuffer) const typeCount = castBuffer[offset + length] length++ const constructorTypes = new Map diff --git a/structure-types.js b/structure-types.js index d9189bb..2ce886f 100644 --- a/structure-types.js +++ b/structure-types.js @@ -715,7 +715,8 @@ function writeBooleans(buffer, booleans) { buffer.addAll(byteBuffer) } /** - * A type storing a fixed-length array of {@link Boolean} values + * A type storing a fixed-length array of {@link Boolean} values. + * The length must be less than 256. * @see BooleanType * @see TupleType * @extends Type @@ -726,15 +727,16 @@ class BooleanTupleType extends AbsoluteType { return 0x31 } /** - * @param {number} length The number of {@link Boolean}s in each value of this type + * @param {number} length The number of {@link Boolean}s in each value of this type. + * Must fit in a 1-byte unsigned integer. */ constructor(length) { super() - assert.fourByteUnsignedInteger(length) + assert.byteUnsignedInteger(length) this.length = length } addToBuffer(buffer) { - if (super.addToBuffer(buffer)) buffer.addAll(lengthBuffer(this.length)) + if (super.addToBuffer(buffer)) buffer.add(this.length) } /** * Appends value bytes to a {@link GrowableBuffer} according to the type @@ -846,7 +848,7 @@ class OctetsType extends AbsoluteType { /** * A type storing a fixed-length array of values of the same type. - * The length must fit in a 4-byte unsigned integer. + * The length must be less than 256. * @example * //For storing 5 4-byte unsigned integers * let type = new sb.TupleType({type: new sb.UnsignedIntType, length: 5}) @@ -860,20 +862,20 @@ class TupleType extends AbsoluteType { /** * @param {{type, length}} params * @param {Type} params.type The type of each element in the tuple - * @param {number} params.length The number of elements in the tuple - * Must fit in a 4-byte unsigned integer. + * @param {number} params.length The number of elements in the tuple. + * Must fit in a 1-byte unsigned integer. */ constructor({type, length}) { super() assert.instanceOf(type, Type) - assert.fourByteUnsignedInteger(length) + assert.byteUnsignedInteger(length) this.type = type this.length = length } addToBuffer(buffer) { if (super.addToBuffer(buffer)) { this.type.addToBuffer(buffer) - buffer.addAll(lengthBuffer(this.length)) + buffer.add(this.length) } } /** diff --git a/test/errors/read.js b/test/errors/read.js index 45fb95a..8d8f2ed 100644 --- a/test/errors/read.js +++ b/test/errors/read.js @@ -1,6 +1,6 @@ /*eslint-disable no-undef*/ assert.throws( - () => r.type(bufferFrom([t.BooleanTupleType._value, 0, 0, 1])), + () => r.type(bufferFrom([t.TupleType._value, t.ByteType._value])), 'Buffer is not long enough' ) assert.throws( diff --git a/test/type-bytes/boolean-tuple.js b/test/type-bytes/boolean-tuple.js index 8260e87..0835c6e 100644 --- a/test/type-bytes/boolean-tuple.js +++ b/test/type-bytes/boolean-tuple.js @@ -1,6 +1,10 @@ /*eslint-disable no-undef*/ -let type = new t.BooleanTupleType(1200) +let type = new t.BooleanTupleType(12) let buffer = type.toBuffer() -assert.equal(buffer, bufferFrom([0x31, 0, 0, 0x04, 0xb0])) +assert.equal(buffer, bufferFrom([0x31, 12])) let readType = r.type(buffer) -assert.equal(readType, type) \ No newline at end of file +assert.equal(readType, type) +assert.throws( + () => new t.BooleanTupleType(256), + '256 is not in [0,256)' +) \ No newline at end of file diff --git a/test/type-bytes/signature.js b/test/type-bytes/signature.js index 6eb8a53..f7308e7 100644 --- a/test/type-bytes/signature.js +++ b/test/type-bytes/signature.js @@ -1,5 +1,5 @@ /*eslint-disable no-undef*/ -assert.equal(new t.ByteType().getSignature(), 'AAk=S/USLzRFVMU73i67jNK349FgCtYxw4Wl18ziPHeFRZo=') +assert.equal(new t.ByteType().getSignature(), 'AAo=S/USLzRFVMU73i67jNK349FgCtYxw4Wl18ziPHeFRZo=') let type = new t.StructType({ bcd: new t.PointerType( new t.OptionalType( @@ -17,4 +17,4 @@ let type = new t.StructType({ ) ) }) -assert.equal(type.getSignature(), 'AAk=URZ81sn26XuBj9ckIE65/aNkAylI8xHXWB+8V34RJBs=') \ No newline at end of file +assert.equal(type.getSignature(), 'AAo=YwJi4ZvHdopqQNW0lf2i8zQ37DEDMWmT9gFoqInimHw=') \ No newline at end of file diff --git a/test/type-bytes/tuple.js b/test/type-bytes/tuple.js index 92c78ba..b097139 100644 --- a/test/type-bytes/tuple.js +++ b/test/type-bytes/tuple.js @@ -4,5 +4,9 @@ let type = new t.TupleType({ length: 3 }) let buffer = type.toBuffer() -assert.equal(buffer, bufferFrom([0x50, 0x32, 0, 0, 0, 3])) -assert.equal(r.type(buffer), type) \ No newline at end of file +assert.equal(buffer, bufferFrom([0x50, 0x32, 3])) +assert.equal(r.type(buffer), type) +assert.throws( + () => new t.TupleType({type: new t.StringType, length: 256}), + '256 is not in [0,256)' +) \ No newline at end of file