12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714 |
-
- (function(undefined){"use strict";(function prelude(modules, cache, entries) {
-
-
-
-
-
-
- function $require(name) {
- var $module = cache[name];
- if (!$module)
- modules[name][0].call($module = cache[name] = { exports: {} }, $require, $module, $module.exports);
- return $module.exports;
- }
-
- var protobuf = $require(entries[0]);
-
-
- protobuf.util.global.protobuf = protobuf;
-
-
- if (typeof define === "function" && define.amd)
- define(["long"], function(Long) {
- if (Long && Long.isLong) {
- protobuf.util.Long = Long;
- protobuf.configure();
- }
- return protobuf;
- });
-
-
- if (typeof module === "object" && module && module.exports)
- module.exports = protobuf;
-
- })({1:[function(require,module,exports){
- "use strict";
- module.exports = asPromise;
-
-
-
-
- function asPromise(fn, ctx/*, varargs */) {
- var params = new Array(arguments.length - 1),
- offset = 0,
- index = 2,
- pending = true;
- while (index < arguments.length)
- params[offset++] = arguments[index++];
- return new Promise(function executor(resolve, reject) {
- params[offset] = function callback(err/*, varargs */) {
- if (pending) {
- pending = false;
- if (err)
- reject(err);
- else {
- var params = new Array(arguments.length - 1),
- offset = 0;
- while (offset < params.length)
- params[offset++] = arguments[offset];
- resolve.apply(null, params);
- }
- }
- };
- try {
- fn.apply(ctx || null, params);
- } catch (err) {
- if (pending) {
- pending = false;
- reject(err);
- }
- }
- });
- }
-
- },{}],2:[function(require,module,exports){
- "use strict";
-
-
- var base64 = exports;
-
-
- base64.length = function length(string) {
- var p = string.length;
- if (!p)
- return 0;
- var n = 0;
- while (--p % 4 > 1 && string.charAt(p) === "=")
- ++n;
- return Math.ceil(string.length * 3) / 4 - n;
- };
-
-
- var b64 = new Array(64);
-
-
- var s64 = new Array(123);
-
-
- for (var i = 0; i < 64;)
- s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;
-
-
- base64.encode = function encode(buffer, start, end) {
- var parts = null,
- chunk = [];
- var i = 0,
- j = 0,
- t;
- while (start < end) {
- var b = buffer[start++];
- switch (j) {
- case 0:
- chunk[i++] = b64[b >> 2];
- t = (b & 3) << 4;
- j = 1;
- break;
- case 1:
- chunk[i++] = b64[t | b >> 4];
- t = (b & 15) << 2;
- j = 2;
- break;
- case 2:
- chunk[i++] = b64[t | b >> 6];
- chunk[i++] = b64[b & 63];
- j = 0;
- break;
- }
- if (i > 8191) {
- (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
- i = 0;
- }
- }
- if (j) {
- chunk[i++] = b64[t];
- chunk[i++] = 61;
- if (j === 1)
- chunk[i++] = 61;
- }
- if (parts) {
- if (i)
- parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
- return parts.join("");
- }
- return String.fromCharCode.apply(String, chunk.slice(0, i));
- };
-
- var invalidEncoding = "invalid encoding";
-
-
- base64.decode = function decode(string, buffer, offset) {
- var start = offset;
- var j = 0,
- t;
- for (var i = 0; i < string.length;) {
- var c = string.charCodeAt(i++);
- if (c === 61 && j > 1)
- break;
- if ((c = s64[c]) === undefined)
- throw Error(invalidEncoding);
- switch (j) {
- case 0:
- t = c;
- j = 1;
- break;
- case 1:
- buffer[offset++] = t << 2 | (c & 48) >> 4;
- t = c;
- j = 2;
- break;
- case 2:
- buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;
- t = c;
- j = 3;
- break;
- case 3:
- buffer[offset++] = (t & 3) << 6 | c;
- j = 0;
- break;
- }
- }
- if (j === 1)
- throw Error(invalidEncoding);
- return offset - start;
- };
-
-
- base64.test = function test(string) {
- return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);
- };
-
- },{}],3:[function(require,module,exports){
- "use strict";
- module.exports = EventEmitter;
-
-
- function EventEmitter() {
-
-
-
- this._listeners = {};
- }
-
-
- EventEmitter.prototype.on = function on(evt, fn, ctx) {
- (this._listeners[evt] || (this._listeners[evt] = [])).push({
- fn : fn,
- ctx : ctx || this
- });
- return this;
- };
-
-
- EventEmitter.prototype.off = function off(evt, fn) {
- if (evt === undefined)
- this._listeners = {};
- else {
- if (fn === undefined)
- this._listeners[evt] = [];
- else {
- var listeners = this._listeners[evt];
- for (var i = 0; i < listeners.length;)
- if (listeners[i].fn === fn)
- listeners.splice(i, 1);
- else
- ++i;
- }
- }
- return this;
- };
-
-
- EventEmitter.prototype.emit = function emit(evt) {
- var listeners = this._listeners[evt];
- if (listeners) {
- var args = [],
- i = 1;
- for (; i < arguments.length;)
- args.push(arguments[i++]);
- for (i = 0; i < listeners.length;)
- listeners[i].fn.apply(listeners[i++].ctx, args);
- }
- return this;
- };
-
- },{}],4:[function(require,module,exports){
- "use strict";
-
- module.exports = factory(factory);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- function factory(exports) {
-
-
- if (typeof Float32Array !== "undefined") (function() {
-
- var f32 = new Float32Array([ -0 ]),
- f8b = new Uint8Array(f32.buffer),
- le = f8b[3] === 128;
-
- function writeFloat_f32_cpy(val, buf, pos) {
- f32[0] = val;
- buf[pos ] = f8b[0];
- buf[pos + 1] = f8b[1];
- buf[pos + 2] = f8b[2];
- buf[pos + 3] = f8b[3];
- }
-
- function writeFloat_f32_rev(val, buf, pos) {
- f32[0] = val;
- buf[pos ] = f8b[3];
- buf[pos + 1] = f8b[2];
- buf[pos + 2] = f8b[1];
- buf[pos + 3] = f8b[0];
- }
-
-
- exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;
-
- exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;
-
- function readFloat_f32_cpy(buf, pos) {
- f8b[0] = buf[pos ];
- f8b[1] = buf[pos + 1];
- f8b[2] = buf[pos + 2];
- f8b[3] = buf[pos + 3];
- return f32[0];
- }
-
- function readFloat_f32_rev(buf, pos) {
- f8b[3] = buf[pos ];
- f8b[2] = buf[pos + 1];
- f8b[1] = buf[pos + 2];
- f8b[0] = buf[pos + 3];
- return f32[0];
- }
-
-
- exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;
-
- exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;
-
-
- })(); else (function() {
-
- function writeFloat_ieee754(writeUint, val, buf, pos) {
- var sign = val < 0 ? 1 : 0;
- if (sign)
- val = -val;
- if (val === 0)
- writeUint(1 / val > 0 ? 0 : 2147483648, buf, pos);
- else if (isNaN(val))
- writeUint(2143289344, buf, pos);
- else if (val > 3.4028234663852886e+38)
- writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);
- else if (val < 1.1754943508222875e-38)
- writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);
- else {
- var exponent = Math.floor(Math.log(val) / Math.LN2),
- mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;
- writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);
- }
- }
-
- exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);
- exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);
-
- function readFloat_ieee754(readUint, buf, pos) {
- var uint = readUint(buf, pos),
- sign = (uint >> 31) * 2 + 1,
- exponent = uint >>> 23 & 255,
- mantissa = uint & 8388607;
- return exponent === 255
- ? mantissa
- ? NaN
- : sign * Infinity
- : exponent === 0
- ? sign * 1.401298464324817e-45 * mantissa
- : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);
- }
-
- exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE);
- exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE);
-
- })();
-
-
- if (typeof Float64Array !== "undefined") (function() {
-
- var f64 = new Float64Array([-0]),
- f8b = new Uint8Array(f64.buffer),
- le = f8b[7] === 128;
-
- function writeDouble_f64_cpy(val, buf, pos) {
- f64[0] = val;
- buf[pos ] = f8b[0];
- buf[pos + 1] = f8b[1];
- buf[pos + 2] = f8b[2];
- buf[pos + 3] = f8b[3];
- buf[pos + 4] = f8b[4];
- buf[pos + 5] = f8b[5];
- buf[pos + 6] = f8b[6];
- buf[pos + 7] = f8b[7];
- }
-
- function writeDouble_f64_rev(val, buf, pos) {
- f64[0] = val;
- buf[pos ] = f8b[7];
- buf[pos + 1] = f8b[6];
- buf[pos + 2] = f8b[5];
- buf[pos + 3] = f8b[4];
- buf[pos + 4] = f8b[3];
- buf[pos + 5] = f8b[2];
- buf[pos + 6] = f8b[1];
- buf[pos + 7] = f8b[0];
- }
-
-
- exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;
-
- exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;
-
- function readDouble_f64_cpy(buf, pos) {
- f8b[0] = buf[pos ];
- f8b[1] = buf[pos + 1];
- f8b[2] = buf[pos + 2];
- f8b[3] = buf[pos + 3];
- f8b[4] = buf[pos + 4];
- f8b[5] = buf[pos + 5];
- f8b[6] = buf[pos + 6];
- f8b[7] = buf[pos + 7];
- return f64[0];
- }
-
- function readDouble_f64_rev(buf, pos) {
- f8b[7] = buf[pos ];
- f8b[6] = buf[pos + 1];
- f8b[5] = buf[pos + 2];
- f8b[4] = buf[pos + 3];
- f8b[3] = buf[pos + 4];
- f8b[2] = buf[pos + 5];
- f8b[1] = buf[pos + 6];
- f8b[0] = buf[pos + 7];
- return f64[0];
- }
-
-
- exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;
-
- exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;
-
-
- })(); else (function() {
-
- function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {
- var sign = val < 0 ? 1 : 0;
- if (sign)
- val = -val;
- if (val === 0) {
- writeUint(0, buf, pos + off0);
- writeUint(1 / val > 0 ? 0 : 2147483648, buf, pos + off1);
- } else if (isNaN(val)) {
- writeUint(0, buf, pos + off0);
- writeUint(2146959360, buf, pos + off1);
- } else if (val > 1.7976931348623157e+308) {
- writeUint(0, buf, pos + off0);
- writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);
- } else {
- var mantissa;
- if (val < 2.2250738585072014e-308) {
- mantissa = val / 5e-324;
- writeUint(mantissa >>> 0, buf, pos + off0);
- writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);
- } else {
- var exponent = Math.floor(Math.log(val) / Math.LN2);
- if (exponent === 1024)
- exponent = 1023;
- mantissa = val * Math.pow(2, -exponent);
- writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);
- writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);
- }
- }
- }
-
- exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);
- exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);
-
- function readDouble_ieee754(readUint, off0, off1, buf, pos) {
- var lo = readUint(buf, pos + off0),
- hi = readUint(buf, pos + off1);
- var sign = (hi >> 31) * 2 + 1,
- exponent = hi >>> 20 & 2047,
- mantissa = 4294967296 * (hi & 1048575) + lo;
- return exponent === 2047
- ? mantissa
- ? NaN
- : sign * Infinity
- : exponent === 0
- ? sign * 5e-324 * mantissa
- : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);
- }
-
- exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);
- exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);
-
- })();
-
- return exports;
- }
-
-
-
- function writeUintLE(val, buf, pos) {
- buf[pos ] = val & 255;
- buf[pos + 1] = val >>> 8 & 255;
- buf[pos + 2] = val >>> 16 & 255;
- buf[pos + 3] = val >>> 24;
- }
-
- function writeUintBE(val, buf, pos) {
- buf[pos ] = val >>> 24;
- buf[pos + 1] = val >>> 16 & 255;
- buf[pos + 2] = val >>> 8 & 255;
- buf[pos + 3] = val & 255;
- }
-
- function readUintLE(buf, pos) {
- return (buf[pos ]
- | buf[pos + 1] << 8
- | buf[pos + 2] << 16
- | buf[pos + 3] << 24) >>> 0;
- }
-
- function readUintBE(buf, pos) {
- return (buf[pos ] << 24
- | buf[pos + 1] << 16
- | buf[pos + 2] << 8
- | buf[pos + 3]) >>> 0;
- }
-
- },{}],5:[function(require,module,exports){
- "use strict";
- module.exports = inquire;
-
-
- function inquire(moduleName) {
- try {
- var mod = eval("quire".replace(/^/,"re"))(moduleName);
- if (mod && (mod.length || Object.keys(mod).length))
- return mod;
- } catch (e) {}
- return null;
- }
-
- },{}],6:[function(require,module,exports){
- "use strict";
- module.exports = pool;
-
-
-
-
-
-
- function pool(alloc, slice, size) {
- var SIZE = size || 8192;
- var MAX = SIZE >>> 1;
- var slab = null;
- var offset = SIZE;
- return function pool_alloc(size) {
- if (size < 1 || size > MAX)
- return alloc(size);
- if (offset + size > SIZE) {
- slab = alloc(SIZE);
- offset = 0;
- }
- var buf = slice.call(slab, offset, offset += size);
- if (offset & 7)
- offset = (offset | 7) + 1;
- return buf;
- };
- }
-
- },{}],7:[function(require,module,exports){
- "use strict";
-
-
- var utf8 = exports;
-
-
- utf8.length = function utf8_length(string) {
- var len = 0,
- c = 0;
- for (var i = 0; i < string.length; ++i) {
- c = string.charCodeAt(i);
- if (c < 128)
- len += 1;
- else if (c < 2048)
- len += 2;
- else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {
- ++i;
- len += 4;
- } else
- len += 3;
- }
- return len;
- };
-
-
- utf8.read = function utf8_read(buffer, start, end) {
- var len = end - start;
- if (len < 1)
- return "";
- var parts = null,
- chunk = [],
- i = 0,
- t;
- while (start < end) {
- t = buffer[start++];
- if (t < 128)
- chunk[i++] = t;
- else if (t > 191 && t < 224)
- chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;
- else if (t > 239 && t < 365) {
- t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;
- chunk[i++] = 0xD800 + (t >> 10);
- chunk[i++] = 0xDC00 + (t & 1023);
- } else
- chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;
- if (i > 8191) {
- (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
- i = 0;
- }
- }
- if (parts) {
- if (i)
- parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
- return parts.join("");
- }
- return String.fromCharCode.apply(String, chunk.slice(0, i));
- };
-
-
- utf8.write = function utf8_write(string, buffer, offset) {
- var start = offset,
- c1,
- c2;
- for (var i = 0; i < string.length; ++i) {
- c1 = string.charCodeAt(i);
- if (c1 < 128) {
- buffer[offset++] = c1;
- } else if (c1 < 2048) {
- buffer[offset++] = c1 >> 6 | 192;
- buffer[offset++] = c1 & 63 | 128;
- } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {
- c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);
- ++i;
- buffer[offset++] = c1 >> 18 | 240;
- buffer[offset++] = c1 >> 12 & 63 | 128;
- buffer[offset++] = c1 >> 6 & 63 | 128;
- buffer[offset++] = c1 & 63 | 128;
- } else {
- buffer[offset++] = c1 >> 12 | 224;
- buffer[offset++] = c1 >> 6 & 63 | 128;
- buffer[offset++] = c1 & 63 | 128;
- }
- }
- return offset - start;
- };
-
- },{}],8:[function(require,module,exports){
- "use strict";
- var protobuf = exports;
-
-
- protobuf.build = "minimal";
-
-
- protobuf.Writer = require(16);
- protobuf.BufferWriter = require(17);
- protobuf.Reader = require(9);
- protobuf.BufferReader = require(10);
-
-
- protobuf.util = require(15);
- protobuf.rpc = require(12);
- protobuf.roots = require(11);
- protobuf.configure = configure;
-
-
-
- function configure() {
- protobuf.util._configure();
- protobuf.Writer._configure(protobuf.BufferWriter);
- protobuf.Reader._configure(protobuf.BufferReader);
- }
-
-
- configure();
-
- },{"10":10,"11":11,"12":12,"15":15,"16":16,"17":17,"9":9}],9:[function(require,module,exports){
- "use strict";
- module.exports = Reader;
-
- var util = require(15);
-
- var BufferReader;
-
- var LongBits = util.LongBits,
- utf8 = util.utf8;
-
-
- function indexOutOfRange(reader, writeLength) {
- return RangeError("index out of range: " + reader.pos + " + " + (writeLength || 1) + " > " + reader.len);
- }
-
-
- function Reader(buffer) {
-
-
-
- this.buf = buffer;
-
-
-
- this.pos = 0;
-
-
-
- this.len = buffer.length;
- }
-
- var create_array = typeof Uint8Array !== "undefined"
- ? function create_typed_array(buffer) {
- if (buffer instanceof Uint8Array || Array.isArray(buffer))
- return new Reader(buffer);
- throw Error("illegal buffer");
- }
-
- : function create_array(buffer) {
- if (Array.isArray(buffer))
- return new Reader(buffer);
- throw Error("illegal buffer");
- };
-
- var create = function create() {
- return util.Buffer
- ? function create_buffer_setup(buffer) {
- return (Reader.create = function create_buffer(buffer) {
- return util.Buffer.isBuffer(buffer)
- ? new BufferReader(buffer)
-
- : create_array(buffer);
- })(buffer);
- }
-
- : create_array;
- };
-
-
- Reader.create = create();
-
- Reader.prototype._slice = util.Array.prototype.subarray || util.Array.prototype.slice;
-
-
- Reader.prototype.uint32 = (function read_uint32_setup() {
- var value = 4294967295;
- return function read_uint32() {
- value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;
- value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;
- value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;
- value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;
- value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;
-
-
- if ((this.pos += 5) > this.len) {
- this.pos = this.len;
- throw indexOutOfRange(this, 10);
- }
- return value;
- };
- })();
-
-
- Reader.prototype.int32 = function read_int32() {
- return this.uint32() | 0;
- };
-
-
- Reader.prototype.sint32 = function read_sint32() {
- var value = this.uint32();
- return value >>> 1 ^ -(value & 1) | 0;
- };
-
-
-
- function readLongVarint() {
-
- var bits = new LongBits(0, 0);
- var i = 0;
- if (this.len - this.pos > 4) {
- for (; i < 4; ++i) {
-
- bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;
- if (this.buf[this.pos++] < 128)
- return bits;
- }
-
- bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;
- bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;
- if (this.buf[this.pos++] < 128)
- return bits;
- i = 0;
- } else {
- for (; i < 3; ++i) {
-
- if (this.pos >= this.len)
- throw indexOutOfRange(this);
-
- bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;
- if (this.buf[this.pos++] < 128)
- return bits;
- }
-
- bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;
- return bits;
- }
- if (this.len - this.pos > 4) {
- for (; i < 5; ++i) {
-
- bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;
- if (this.buf[this.pos++] < 128)
- return bits;
- }
- } else {
- for (; i < 5; ++i) {
-
- if (this.pos >= this.len)
- throw indexOutOfRange(this);
-
- bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;
- if (this.buf[this.pos++] < 128)
- return bits;
- }
- }
-
- throw Error("invalid varint encoding");
- }
-
-
-
-
-
-
-
-
-
-
- Reader.prototype.bool = function read_bool() {
- return this.uint32() !== 0;
- };
-
- function readFixed32_end(buf, end) {
- return (buf[end - 4]
- | buf[end - 3] << 8
- | buf[end - 2] << 16
- | buf[end - 1] << 24) >>> 0;
- }
-
-
- Reader.prototype.fixed32 = function read_fixed32() {
-
-
- if (this.pos + 4 > this.len)
- throw indexOutOfRange(this, 4);
-
- return readFixed32_end(this.buf, this.pos += 4);
- };
-
-
- Reader.prototype.sfixed32 = function read_sfixed32() {
-
-
- if (this.pos + 4 > this.len)
- throw indexOutOfRange(this, 4);
-
- return readFixed32_end(this.buf, this.pos += 4) | 0;
- };
-
-
-
- function readFixed64(/* this: Reader */) {
-
-
- if (this.pos + 8 > this.len)
- throw indexOutOfRange(this, 8);
-
- return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));
- }
-
-
-
-
-
-
-
-
- Reader.prototype.float = function read_float() {
-
-
- if (this.pos + 4 > this.len)
- throw indexOutOfRange(this, 4);
-
- var value = util.float.readFloatLE(this.buf, this.pos);
- this.pos += 4;
- return value;
- };
-
-
- Reader.prototype.double = function read_double() {
-
-
- if (this.pos + 8 > this.len)
- throw indexOutOfRange(this, 4);
-
- var value = util.float.readDoubleLE(this.buf, this.pos);
- this.pos += 8;
- return value;
- };
-
-
- Reader.prototype.bytes = function read_bytes() {
- var length = this.uint32(),
- start = this.pos,
- end = this.pos + length;
-
-
- if (end > this.len)
- throw indexOutOfRange(this, length);
-
- this.pos += length;
- if (Array.isArray(this.buf))
- return this.buf.slice(start, end);
- return start === end
- ? new this.buf.constructor(0)
- : this._slice.call(this.buf, start, end);
- };
-
-
- Reader.prototype.string = function read_string() {
- var bytes = this.bytes();
- return utf8.read(bytes, 0, bytes.length);
- };
-
-
- Reader.prototype.skip = function skip(length) {
- if (typeof length === "number") {
-
- if (this.pos + length > this.len)
- throw indexOutOfRange(this, length);
- this.pos += length;
- } else {
- do {
-
- if (this.pos >= this.len)
- throw indexOutOfRange(this);
- } while (this.buf[this.pos++] & 128);
- }
- return this;
- };
-
-
- Reader.prototype.skipType = function(wireType) {
- switch (wireType) {
- case 0:
- this.skip();
- break;
- case 1:
- this.skip(8);
- break;
- case 2:
- this.skip(this.uint32());
- break;
- case 3:
- while ((wireType = this.uint32() & 7) !== 4) {
- this.skipType(wireType);
- }
- break;
- case 5:
- this.skip(4);
- break;
-
-
- default:
- throw Error("invalid wire type " + wireType + " at offset " + this.pos);
- }
- return this;
- };
-
- Reader._configure = function(BufferReader_) {
- BufferReader = BufferReader_;
- Reader.create = create();
- BufferReader._configure();
-
- var fn = util.Long ? "toLong" : "toNumber";
- util.merge(Reader.prototype, {
-
- int64: function read_int64() {
- return readLongVarint.call(this)[fn](false);
- },
-
- uint64: function read_uint64() {
- return readLongVarint.call(this)[fn](true);
- },
-
- sint64: function read_sint64() {
- return readLongVarint.call(this).zzDecode()[fn](false);
- },
-
- fixed64: function read_fixed64() {
- return readFixed64.call(this)[fn](true);
- },
-
- sfixed64: function read_sfixed64() {
- return readFixed64.call(this)[fn](false);
- }
-
- });
- };
-
- },{"15":15}],10:[function(require,module,exports){
- "use strict";
- module.exports = BufferReader;
-
-
- var Reader = require(9);
- (BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;
-
- var util = require(15);
-
-
- function BufferReader(buffer) {
- Reader.call(this, buffer);
-
-
-
- }
-
- BufferReader._configure = function () {
-
- if (util.Buffer)
- BufferReader.prototype._slice = util.Buffer.prototype.slice;
- };
-
-
-
- BufferReader.prototype.string = function read_string_buffer() {
- var len = this.uint32();
- return this.buf.utf8Slice
- ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len))
- : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + len, this.len));
- };
-
-
-
- BufferReader._configure();
-
- },{"15":15,"9":9}],11:[function(require,module,exports){
- "use strict";
- module.exports = {};
-
-
-
- },{}],12:[function(require,module,exports){
- "use strict";
-
-
- var rpc = exports;
-
-
-
-
-
- rpc.Service = require(13);
-
- },{"13":13}],13:[function(require,module,exports){
- "use strict";
- module.exports = Service;
-
- var util = require(15);
-
-
- (Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;
-
-
-
-
-
-
- function Service(rpcImpl, requestDelimited, responseDelimited) {
-
- if (typeof rpcImpl !== "function")
- throw TypeError("rpcImpl must be a function");
-
- util.EventEmitter.call(this);
-
-
-
- this.rpcImpl = rpcImpl;
-
-
-
- this.requestDelimited = Boolean(requestDelimited);
-
-
-
- this.responseDelimited = Boolean(responseDelimited);
- }
-
-
- Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) {
-
- if (!request)
- throw TypeError("request must be specified");
-
- var self = this;
- if (!callback)
- return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request);
-
- if (!self.rpcImpl) {
- setTimeout(function() { callback(Error("already ended")); }, 0);
- return undefined;
- }
-
- try {
- return self.rpcImpl(
- method,
- requestCtor[self.requestDelimited ? "encodeDelimited" : "encode"](request).finish(),
- function rpcCallback(err, response) {
-
- if (err) {
- self.emit("error", err, method);
- return callback(err);
- }
-
- if (response === null) {
- self.end( true);
- return undefined;
- }
-
- if (!(response instanceof responseCtor)) {
- try {
- response = responseCtor[self.responseDelimited ? "decodeDelimited" : "decode"](response);
- } catch (err) {
- self.emit("error", err, method);
- return callback(err);
- }
- }
-
- self.emit("data", response, method);
- return callback(null, response);
- }
- );
- } catch (err) {
- self.emit("error", err, method);
- setTimeout(function() { callback(err); }, 0);
- return undefined;
- }
- };
-
-
- Service.prototype.end = function end(endedByRPC) {
- if (this.rpcImpl) {
- if (!endedByRPC)
- this.rpcImpl(null, null, null);
- this.rpcImpl = null;
- this.emit("end").off();
- }
- return this;
- };
-
- },{"15":15}],14:[function(require,module,exports){
- "use strict";
- module.exports = LongBits;
-
- var util = require(15);
-
-
- function LongBits(lo, hi) {
-
-
-
-
-
-
- this.lo = lo >>> 0;
-
-
-
- this.hi = hi >>> 0;
- }
-
-
- var zero = LongBits.zero = new LongBits(0, 0);
-
- zero.toNumber = function() { return 0; };
- zero.zzEncode = zero.zzDecode = function() { return this; };
- zero.length = function() { return 1; };
-
-
- var zeroHash = LongBits.zeroHash = "\0\0\0\0\0\0\0\0";
-
-
- LongBits.fromNumber = function fromNumber(value) {
- if (value === 0)
- return zero;
- var sign = value < 0;
- if (sign)
- value = -value;
- var lo = value >>> 0,
- hi = (value - lo) / 4294967296 >>> 0;
- if (sign) {
- hi = ~hi >>> 0;
- lo = ~lo >>> 0;
- if (++lo > 4294967295) {
- lo = 0;
- if (++hi > 4294967295)
- hi = 0;
- }
- }
- return new LongBits(lo, hi);
- };
-
-
- LongBits.from = function from(value) {
- if (typeof value === "number")
- return LongBits.fromNumber(value);
- if (util.isString(value)) {
-
- if (util.Long)
- value = util.Long.fromString(value);
- else
- return LongBits.fromNumber(parseInt(value, 10));
- }
- return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;
- };
-
-
- LongBits.prototype.toNumber = function toNumber(unsigned) {
- if (!unsigned && this.hi >>> 31) {
- var lo = ~this.lo + 1 >>> 0,
- hi = ~this.hi >>> 0;
- if (!lo)
- hi = hi + 1 >>> 0;
- return -(lo + hi * 4294967296);
- }
- return this.lo + this.hi * 4294967296;
- };
-
-
- LongBits.prototype.toLong = function toLong(unsigned) {
- return util.Long
- ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))
-
- : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };
- };
-
- var charCodeAt = String.prototype.charCodeAt;
-
-
- LongBits.fromHash = function fromHash(hash) {
- if (hash === zeroHash)
- return zero;
- return new LongBits(
- ( charCodeAt.call(hash, 0)
- | charCodeAt.call(hash, 1) << 8
- | charCodeAt.call(hash, 2) << 16
- | charCodeAt.call(hash, 3) << 24) >>> 0
- ,
- ( charCodeAt.call(hash, 4)
- | charCodeAt.call(hash, 5) << 8
- | charCodeAt.call(hash, 6) << 16
- | charCodeAt.call(hash, 7) << 24) >>> 0
- );
- };
-
-
- LongBits.prototype.toHash = function toHash() {
- return String.fromCharCode(
- this.lo & 255,
- this.lo >>> 8 & 255,
- this.lo >>> 16 & 255,
- this.lo >>> 24 ,
- this.hi & 255,
- this.hi >>> 8 & 255,
- this.hi >>> 16 & 255,
- this.hi >>> 24
- );
- };
-
-
- LongBits.prototype.zzEncode = function zzEncode() {
- var mask = this.hi >> 31;
- this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;
- this.lo = ( this.lo << 1 ^ mask) >>> 0;
- return this;
- };
-
-
- LongBits.prototype.zzDecode = function zzDecode() {
- var mask = -(this.lo & 1);
- this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;
- this.hi = ( this.hi >>> 1 ^ mask) >>> 0;
- return this;
- };
-
-
- LongBits.prototype.length = function length() {
- var part0 = this.lo,
- part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,
- part2 = this.hi >>> 24;
- return part2 === 0
- ? part1 === 0
- ? part0 < 16384
- ? part0 < 128 ? 1 : 2
- : part0 < 2097152 ? 3 : 4
- : part1 < 16384
- ? part1 < 128 ? 5 : 6
- : part1 < 2097152 ? 7 : 8
- : part2 < 128 ? 9 : 10;
- };
-
- },{"15":15}],15:[function(require,module,exports){
- "use strict";
- var util = exports;
-
-
- util.asPromise = require(1);
-
-
- util.base64 = require(2);
-
-
- util.EventEmitter = require(3);
-
-
- util.float = require(4);
-
-
- util.inquire = require(5);
-
-
- util.utf8 = require(7);
-
-
- util.pool = require(6);
-
-
- util.LongBits = require(14);
-
-
- util.isNode = Boolean(typeof global !== "undefined"
- && global
- && global.process
- && global.process.versions
- && global.process.versions.node);
-
-
- util.global = util.isNode && global
- || typeof window !== "undefined" && window
- || typeof self !== "undefined" && self
- || this;
-
-
- util.emptyArray = Object.freeze ? Object.freeze([]) : [];
-
-
- util.emptyObject = Object.freeze ? Object.freeze({}) : {};
-
-
- util.isInteger = Number.isInteger || function isInteger(value) {
- return typeof value === "number" && isFinite(value) && Math.floor(value) === value;
- };
-
-
- util.isString = function isString(value) {
- return typeof value === "string" || value instanceof String;
- };
-
-
- util.isObject = function isObject(value) {
- return value && typeof value === "object";
- };
-
-
- util.isset =
-
-
- util.isSet = function isSet(obj, prop) {
- var value = obj[prop];
- if (value != null && obj.hasOwnProperty(prop))
- return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;
- return false;
- };
-
-
-
-
- util.Buffer = (function() {
- try {
- var Buffer = util.inquire("buffer").Buffer;
-
- return Buffer.prototype.utf8Write ? Buffer : null;
- } catch (e) {
-
- return null;
- }
- })();
-
-
- util._Buffer_from = null;
-
-
- util._Buffer_allocUnsafe = null;
-
-
- util.newBuffer = function newBuffer(sizeOrArray) {
-
- return typeof sizeOrArray === "number"
- ? util.Buffer
- ? util._Buffer_allocUnsafe(sizeOrArray)
- : new util.Array(sizeOrArray)
- : util.Buffer
- ? util._Buffer_from(sizeOrArray)
- : typeof Uint8Array === "undefined"
- ? sizeOrArray
- : new Uint8Array(sizeOrArray);
- };
-
-
- util.Array = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
-
-
-
-
- util.Long = util.global.dcodeIO && util.global.dcodeIO.Long
- || util.global.Long
- || util.inquire("long");
-
-
- util.key2Re = /^true|false|0|1$/;
-
-
- util.key32Re = /^-?(?:0|[1-9][0-9]*)$/;
-
-
- util.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;
-
-
- util.longToHash = function longToHash(value) {
- return value
- ? util.LongBits.from(value).toHash()
- : util.LongBits.zeroHash;
- };
-
-
- util.longFromHash = function longFromHash(hash, unsigned) {
- var bits = util.LongBits.fromHash(hash);
- if (util.Long)
- return util.Long.fromBits(bits.lo, bits.hi, unsigned);
- return bits.toNumber(Boolean(unsigned));
- };
-
-
- function merge(dst, src, ifNotSet) {
- for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)
- if (dst[keys[i]] === undefined || !ifNotSet)
- dst[keys[i]] = src[keys[i]];
- return dst;
- }
-
- util.merge = merge;
-
-
- util.lcFirst = function lcFirst(str) {
- return str.charAt(0).toLowerCase() + str.substring(1);
- };
-
-
- function newError(name) {
-
- function CustomError(message, properties) {
-
- if (!(this instanceof CustomError))
- return new CustomError(message, properties);
-
-
-
-
- Object.defineProperty(this, "message", { get: function() { return message; } });
-
-
- if (Error.captureStackTrace)
- Error.captureStackTrace(this, CustomError);
- else
- Object.defineProperty(this, "stack", { value: new Error().stack || "" });
-
- if (properties)
- merge(this, properties);
- }
-
- (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError;
-
- Object.defineProperty(CustomError.prototype, "name", { get: function() { return name; } });
-
- CustomError.prototype.toString = function toString() {
- return this.name + ": " + this.message;
- };
-
- return CustomError;
- }
-
- util.newError = newError;
-
-
- util.ProtocolError = newError("ProtocolError");
-
-
-
-
-
-
- util.oneOfGetter = function getOneOf(fieldNames) {
- var fieldMap = {};
- for (var i = 0; i < fieldNames.length; ++i)
- fieldMap[fieldNames[i]] = 1;
-
-
-
- return function() {
- for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)
- if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)
- return keys[i];
- };
- };
-
-
-
-
- util.oneOfSetter = function setOneOf(fieldNames) {
-
-
-
- return function(name) {
- for (var i = 0; i < fieldNames.length; ++i)
- if (fieldNames[i] !== name)
- delete this[fieldNames[i]];
- };
- };
-
-
- util.toJSONOptions = {
- longs: String,
- enums: String,
- bytes: String,
- json: true
- };
-
-
- util._configure = function() {
- var Buffer = util.Buffer;
-
- if (!Buffer) {
- util._Buffer_from = util._Buffer_allocUnsafe = null;
- return;
- }
-
-
- util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||
-
- function Buffer_from(value, encoding) {
- return new Buffer(value, encoding);
- };
- util._Buffer_allocUnsafe = Buffer.allocUnsafe ||
-
- function Buffer_allocUnsafe(size) {
- return new Buffer(size);
- };
- };
-
- },{"1":1,"14":14,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7}],16:[function(require,module,exports){
- "use strict";
- module.exports = Writer;
-
- var util = require(15);
-
- var BufferWriter;
-
- var LongBits = util.LongBits,
- base64 = util.base64,
- utf8 = util.utf8;
-
-
- function Op(fn, len, val) {
-
-
-
- this.fn = fn;
-
-
-
- this.len = len;
-
-
-
- this.next = undefined;
-
-
-
- this.val = val;
- }
-
-
- function noop() {}
-
-
- function State(writer) {
-
-
-
- this.head = writer.head;
-
-
-
- this.tail = writer.tail;
-
-
-
- this.len = writer.len;
-
-
-
- this.next = writer.states;
- }
-
-
- function Writer() {
-
-
-
- this.len = 0;
-
-
-
- this.head = new Op(noop, 0, 0);
-
-
-
- this.tail = this.head;
-
-
-
- this.states = null;
-
-
-
-
-
-
- }
-
- var create = function create() {
- return util.Buffer
- ? function create_buffer_setup() {
- return (Writer.create = function create_buffer() {
- return new BufferWriter();
- })();
- }
-
- : function create_array() {
- return new Writer();
- };
- };
-
-
- Writer.create = create();
-
-
- Writer.alloc = function alloc(size) {
- return new util.Array(size);
- };
-
-
-
- if (util.Array !== Array)
- Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);
-
-
- Writer.prototype._push = function push(fn, len, val) {
- this.tail = this.tail.next = new Op(fn, len, val);
- this.len += len;
- return this;
- };
-
- function writeByte(val, buf, pos) {
- buf[pos] = val & 255;
- }
-
- function writeVarint32(val, buf, pos) {
- while (val > 127) {
- buf[pos++] = val & 127 | 128;
- val >>>= 7;
- }
- buf[pos] = val;
- }
-
-
- function VarintOp(len, val) {
- this.len = len;
- this.next = undefined;
- this.val = val;
- }
-
- VarintOp.prototype = Object.create(Op.prototype);
- VarintOp.prototype.fn = writeVarint32;
-
-
- Writer.prototype.uint32 = function write_uint32(value) {
-
-
- this.len += (this.tail = this.tail.next = new VarintOp(
- (value = value >>> 0)
- < 128 ? 1
- : value < 16384 ? 2
- : value < 2097152 ? 3
- : value < 268435456 ? 4
- : 5,
- value)).len;
- return this;
- };
-
-
- Writer.prototype.int32 = function write_int32(value) {
- return value < 0
- ? this._push(writeVarint64, 10, LongBits.fromNumber(value))
- : this.uint32(value);
- };
-
-
- Writer.prototype.sint32 = function write_sint32(value) {
- return this.uint32((value << 1 ^ value >> 31) >>> 0);
- };
-
- function writeVarint64(val, buf, pos) {
- while (val.hi) {
- buf[pos++] = val.lo & 127 | 128;
- val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;
- val.hi >>>= 7;
- }
- while (val.lo > 127) {
- buf[pos++] = val.lo & 127 | 128;
- val.lo = val.lo >>> 7;
- }
- buf[pos++] = val.lo;
- }
-
-
- Writer.prototype.uint64 = function write_uint64(value) {
- var bits = LongBits.from(value);
- return this._push(writeVarint64, bits.length(), bits);
- };
-
-
- Writer.prototype.int64 = Writer.prototype.uint64;
-
-
- Writer.prototype.sint64 = function write_sint64(value) {
- var bits = LongBits.from(value).zzEncode();
- return this._push(writeVarint64, bits.length(), bits);
- };
-
-
- Writer.prototype.bool = function write_bool(value) {
- return this._push(writeByte, 1, value ? 1 : 0);
- };
-
- function writeFixed32(val, buf, pos) {
- buf[pos ] = val & 255;
- buf[pos + 1] = val >>> 8 & 255;
- buf[pos + 2] = val >>> 16 & 255;
- buf[pos + 3] = val >>> 24;
- }
-
-
- Writer.prototype.fixed32 = function write_fixed32(value) {
- return this._push(writeFixed32, 4, value >>> 0);
- };
-
-
- Writer.prototype.sfixed32 = Writer.prototype.fixed32;
-
-
- Writer.prototype.fixed64 = function write_fixed64(value) {
- var bits = LongBits.from(value);
- return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);
- };
-
-
- Writer.prototype.sfixed64 = Writer.prototype.fixed64;
-
-
- Writer.prototype.float = function write_float(value) {
- return this._push(util.float.writeFloatLE, 4, value);
- };
-
-
- Writer.prototype.double = function write_double(value) {
- return this._push(util.float.writeDoubleLE, 8, value);
- };
-
- var writeBytes = util.Array.prototype.set
- ? function writeBytes_set(val, buf, pos) {
- buf.set(val, pos);
- }
-
- : function writeBytes_for(val, buf, pos) {
- for (var i = 0; i < val.length; ++i)
- buf[pos + i] = val[i];
- };
-
-
- Writer.prototype.bytes = function write_bytes(value) {
- var len = value.length >>> 0;
- if (!len)
- return this._push(writeByte, 1, 0);
- if (util.isString(value)) {
- var buf = Writer.alloc(len = base64.length(value));
- base64.decode(value, buf, 0);
- value = buf;
- }
- return this.uint32(len)._push(writeBytes, len, value);
- };
-
-
- Writer.prototype.string = function write_string(value) {
- var len = utf8.length(value);
- return len
- ? this.uint32(len)._push(utf8.write, len, value)
- : this._push(writeByte, 1, 0);
- };
-
-
- Writer.prototype.fork = function fork() {
- this.states = new State(this);
- this.head = this.tail = new Op(noop, 0, 0);
- this.len = 0;
- return this;
- };
-
-
- Writer.prototype.reset = function reset() {
- if (this.states) {
- this.head = this.states.head;
- this.tail = this.states.tail;
- this.len = this.states.len;
- this.states = this.states.next;
- } else {
- this.head = this.tail = new Op(noop, 0, 0);
- this.len = 0;
- }
- return this;
- };
-
-
- Writer.prototype.ldelim = function ldelim() {
- var head = this.head,
- tail = this.tail,
- len = this.len;
- this.reset().uint32(len);
- if (len) {
- this.tail.next = head.next;
- this.tail = tail;
- this.len += len;
- }
- return this;
- };
-
-
- Writer.prototype.finish = function finish() {
- var head = this.head.next,
- buf = this.constructor.alloc(this.len),
- pos = 0;
- while (head) {
- head.fn(head.val, buf, pos);
- pos += head.len;
- head = head.next;
- }
-
- return buf;
- };
-
- Writer._configure = function(BufferWriter_) {
- BufferWriter = BufferWriter_;
- Writer.create = create();
- BufferWriter._configure();
- };
-
- },{"15":15}],17:[function(require,module,exports){
- "use strict";
- module.exports = BufferWriter;
-
-
- var Writer = require(16);
- (BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;
-
- var util = require(15);
-
-
- function BufferWriter() {
- Writer.call(this);
- }
-
- BufferWriter._configure = function () {
-
-
- BufferWriter.alloc = util._Buffer_allocUnsafe;
-
- BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === "set"
- ? function writeBytesBuffer_set(val, buf, pos) {
- buf.set(val, pos);
-
- }
-
- : function writeBytesBuffer_copy(val, buf, pos) {
- if (val.copy)
- val.copy(buf, pos, 0, val.length);
- else for (var i = 0; i < val.length;)
- buf[pos++] = val[i++];
- };
- };
-
-
-
- BufferWriter.prototype.bytes = function write_bytes_buffer(value) {
- if (util.isString(value))
- value = util._Buffer_from(value, "base64");
- var len = value.length >>> 0;
- this.uint32(len);
- if (len)
- this._push(BufferWriter.writeBytesBuffer, len, value);
- return this;
- };
-
- function writeStringBuffer(val, buf, pos) {
- if (val.length < 40)
- util.utf8.write(val, buf, pos);
- else if (buf.utf8Write)
- buf.utf8Write(val, pos);
- else
- buf.write(val, pos);
- }
-
-
- BufferWriter.prototype.string = function write_string_buffer(value) {
- var len = util.Buffer.byteLength(value);
- this.uint32(len);
- if (len)
- this._push(writeStringBuffer, len, value);
- return this;
- };
-
-
-
-
- BufferWriter._configure();
-
- },{"15":15,"16":16}]},{},[8])
-
- })();
|