UNPKG

528 kBJavaScriptView Raw
1(function webpackUniversalModuleDefinition(root, factory) {
2 if(typeof exports === 'object' && typeof module === 'object')
3 module.exports = factory(require("vendor"));
4 else if(typeof define === 'function' && define.amd)
5 define(["vendor"], factory);
6 else if(typeof exports === 'object')
7 exports["mtproto"] = factory(require("vendor"));
8 else
9 root["mtproto"] = factory(root["vendor"]);
10})(this, function(__WEBPACK_EXTERNAL_MODULE_6__) {
11return /******/ (function(modules) { // webpackBootstrap
12/******/ // The module cache
13/******/ var installedModules = {};
14/******/
15/******/ // The require function
16/******/ function __webpack_require__(moduleId) {
17/******/
18/******/ // Check if module is in cache
19/******/ if(installedModules[moduleId])
20/******/ return installedModules[moduleId].exports;
21/******/
22/******/ // Create a new module (and put it into the cache)
23/******/ var module = installedModules[moduleId] = {
24/******/ i: moduleId,
25/******/ l: false,
26/******/ exports: {}
27/******/ };
28/******/
29/******/ // Execute the module function
30/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31/******/
32/******/ // Flag the module as loaded
33/******/ module.l = true;
34/******/
35/******/ // Return the exports of the module
36/******/ return module.exports;
37/******/ }
38/******/
39/******/
40/******/ // expose the modules object (__webpack_modules__)
41/******/ __webpack_require__.m = modules;
42/******/
43/******/ // expose the module cache
44/******/ __webpack_require__.c = installedModules;
45/******/
46/******/ // identity function for calling harmony imports with the correct context
47/******/ __webpack_require__.i = function(value) { return value; };
48/******/
49/******/ // define getter function for harmony exports
50/******/ __webpack_require__.d = function(exports, name, getter) {
51/******/ if(!__webpack_require__.o(exports, name)) {
52/******/ Object.defineProperty(exports, name, {
53/******/ configurable: false,
54/******/ enumerable: true,
55/******/ get: getter
56/******/ });
57/******/ }
58/******/ };
59/******/
60/******/ // getDefaultExport function for compatibility with non-harmony modules
61/******/ __webpack_require__.n = function(module) {
62/******/ var getter = module && module.__esModule ?
63/******/ function getDefault() { return module['default']; } :
64/******/ function getModuleExports() { return module; };
65/******/ __webpack_require__.d(getter, 'a', getter);
66/******/ return getter;
67/******/ };
68/******/
69/******/ // Object.prototype.hasOwnProperty.call
70/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
71/******/
72/******/ // __webpack_public_path__
73/******/ __webpack_require__.p = "";
74/******/
75/******/ // Load entry module and return exports
76/******/ return __webpack_require__(__webpack_require__.s = 42);
77/******/ })
78/************************************************************************/
79/******/ ([
80/* 0 */
81/***/ (function(module, exports, __webpack_require__) {
82
83module.exports = (__webpack_require__(6))(128);
84
85/***/ }),
86/* 1 */
87/***/ (function(module, exports, __webpack_require__) {
88
89module.exports = (__webpack_require__(6))(125);
90
91/***/ }),
92/* 2 */
93/***/ (function(module, __webpack_exports__, __webpack_require__) {
94
95"use strict";
96/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_ramda__ = __webpack_require__(0);
97/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_ramda___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_ramda__);
98/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_jsbn__ = __webpack_require__(19);
99/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_jsbn___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_jsbn__);
100/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rusha__ = __webpack_require__(36);
101/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rusha___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rusha__);
102/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__goodmind_node_cryptojs_aes__ = __webpack_require__(20);
103/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__goodmind_node_cryptojs_aes___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__goodmind_node_cryptojs_aes__);
104/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_pako_lib_inflate__ = __webpack_require__(41);
105/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_pako_lib_inflate___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_pako_lib_inflate__);
106/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__service_secure_random__ = __webpack_require__(7);
107/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__vendor_leemon__ = __webpack_require__(17);
108/* harmony export (immutable) */ __webpack_exports__["A"] = bigint;
109/* harmony export (immutable) */ __webpack_exports__["k"] = bigStringInt;
110/* harmony export (immutable) */ __webpack_exports__["f"] = bytesToHex;
111/* harmony export (immutable) */ __webpack_exports__["u"] = bytesFromHex;
112/* harmony export (immutable) */ __webpack_exports__["e"] = bytesCmp;
113/* harmony export (immutable) */ __webpack_exports__["w"] = bytesXor;
114/* unused harmony export bytesToWords */
115/* unused harmony export bytesFromWords */
116/* unused harmony export bytesFromLeemonBigInt */
117/* harmony export (immutable) */ __webpack_exports__["h"] = bytesToArrayBuffer;
118/* harmony export (immutable) */ __webpack_exports__["c"] = convertToArrayBuffer;
119/* harmony export (immutable) */ __webpack_exports__["b"] = convertToUint8Array;
120/* harmony export (immutable) */ __webpack_exports__["q"] = convertToByteArray;
121/* harmony export (immutable) */ __webpack_exports__["g"] = bytesFromArrayBuffer;
122/* unused harmony export bufferConcat */
123/* harmony export (immutable) */ __webpack_exports__["y"] = longToInts;
124/* harmony export (immutable) */ __webpack_exports__["i"] = longToBytes;
125/* harmony export (immutable) */ __webpack_exports__["t"] = longFromLem;
126/* harmony export (immutable) */ __webpack_exports__["z"] = intToUint;
127/* harmony export (immutable) */ __webpack_exports__["j"] = uintToInt;
128/* harmony export (immutable) */ __webpack_exports__["m"] = sha1HashSync;
129/* harmony export (immutable) */ __webpack_exports__["d"] = sha1BytesSync;
130/* harmony export (immutable) */ __webpack_exports__["n"] = sha256HashSync;
131/* harmony export (immutable) */ __webpack_exports__["v"] = rsaEncrypt;
132/* unused harmony export addPadding */
133/* harmony export (immutable) */ __webpack_exports__["o"] = aesEncryptSync;
134/* harmony export (immutable) */ __webpack_exports__["p"] = aesDecryptSync;
135/* harmony export (immutable) */ __webpack_exports__["B"] = gzipUncompress;
136/* harmony export (immutable) */ __webpack_exports__["l"] = nextRandomInt;
137/* harmony export (immutable) */ __webpack_exports__["r"] = pqPrimeFactorization;
138/* unused harmony export pqPrimeLeemon */
139/* harmony export (immutable) */ __webpack_exports__["s"] = bytesModPow;
140
141
142
143
144const { CryptoJS } = __WEBPACK_IMPORTED_MODULE_3__goodmind_node_cryptojs_aes__;
145
146
147// import Timer from 'hirestime' //TODO remove in prod!
148
149
150
151
152
153const rushaInstance = new __WEBPACK_IMPORTED_MODULE_2_rusha___default.a(1024 * 1024);
154
155function bigint(num) {
156 return new __WEBPACK_IMPORTED_MODULE_1_jsbn__["BigInteger"](num.toString(16), 16);
157}
158
159function bigStringInt(strNum) {
160 return new __WEBPACK_IMPORTED_MODULE_1_jsbn__["BigInteger"](strNum, 10);
161}
162
163const rShift32 = str => {
164 const num = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["a" /* str2bigInt */])(str, 10, 0);
165 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["b" /* rightShift_ */])(num, 32);
166 return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["c" /* bigInt2str */])(num, 10);
167};
168/* unused harmony export rShift32 */
169
170const strDecToHex = str => __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["toLower"])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["c" /* bigInt2str */])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["a" /* str2bigInt */])(str, 10, 0), 16));
171/* harmony export (immutable) */ __webpack_exports__["x"] = strDecToHex;
172
173
174function bytesToHex(bytes = []) {
175 const arr = [];
176 for (let i = 0; i < bytes.length; i++) {
177 arr.push((bytes[i] < 16 ? '0' : '') + (bytes[i] || 0).toString(16));
178 }
179 return arr.join('');
180}
181
182function bytesFromHex(hexString) {
183 const len = hexString.length;
184 let start = 0;
185 const bytes = [];
186
187 if (hexString.length % 2) {
188 bytes.push(parseInt(hexString.charAt(0), 16));
189 start++;
190 }
191
192 for (let i = start; i < len; i += 2) {
193 bytes.push(parseInt(hexString.substr(i, 2), 16));
194 }
195
196 return bytes;
197}
198
199function bytesCmp(bytes1, bytes2) {
200 const len = bytes1.length;
201 if (len !== bytes2.length) {
202 return false;
203 }
204
205 for (let i = 0; i < len; i++) {
206 if (bytes1[i] !== bytes2[i]) return false;
207 }
208 return true;
209}
210
211function bytesXor(bytes1, bytes2) {
212 const len = bytes1.length;
213 const bytes = [];
214
215 for (let i = 0; i < len; ++i) {
216 bytes[i] = bytes1[i] ^ bytes2[i];
217 }
218
219 return bytes;
220}
221
222function bytesToWords(bytes) {
223 if (bytes instanceof ArrayBuffer) {
224 bytes = new Uint8Array(bytes);
225 }
226 const len = bytes.length;
227 const words = [];
228 let i;
229 for (i = 0; i < len; i++) {
230 words[i >>> 2] |= bytes[i] << 24 - i % 4 * 8;
231 }
232
233 return new CryptoJS.lib.WordArray.init(words, len);
234}
235
236function bytesFromWords(wordArray) {
237 const words = wordArray.words;
238 const sigBytes = wordArray.sigBytes;
239 const bytes = [];
240
241 for (let i = 0; i < sigBytes; i++) {
242 bytes.push(words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff);
243 }
244
245 return bytes;
246}
247
248function bytesFromLeemonBigInt(bigInt) {
249 const str = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["c" /* bigInt2str */])(bigInt, 16);
250 return bytesFromHex(str);
251}
252
253function bytesToArrayBuffer(b) {
254 return new Uint8Array(b).buffer;
255}
256
257function convertToArrayBuffer(bytes) {
258 // Be careful with converting subarrays!!
259 if (bytes instanceof ArrayBuffer) {
260 return bytes;
261 }
262 if (bytes.buffer !== undefined && bytes.buffer.byteLength == bytes.length * bytes.BYTES_PER_ELEMENT) {
263 return bytes.buffer;
264 }
265 return bytesToArrayBuffer(bytes);
266}
267
268function convertToUint8Array(bytes) {
269 if (bytes.buffer !== undefined) return bytes;
270 return new Uint8Array(bytes);
271}
272
273function convertToByteArray(bytes) {
274 if (Array.isArray(bytes)) return bytes;
275 bytes = convertToUint8Array(bytes);
276 const newBytes = [];
277 for (let i = 0, len = bytes.length; i < len; i++) newBytes.push(bytes[i]);
278 return newBytes;
279}
280
281function bytesFromArrayBuffer(buffer) {
282 const byteView = new Uint8Array(buffer);
283 const bytes = Array.from(byteView);
284 return bytes;
285}
286
287function bufferConcat(buffer1, buffer2) {
288 const l1 = buffer1.byteLength || buffer1.length;
289 const l2 = buffer2.byteLength || buffer2.length;
290 const tmp = new Uint8Array(l1 + l2);
291 tmp.set(buffer1 instanceof ArrayBuffer ? new Uint8Array(buffer1) : buffer1, 0);
292 tmp.set(buffer2 instanceof ArrayBuffer ? new Uint8Array(buffer2) : buffer2, l1);
293
294 return tmp.buffer;
295}
296
297// const dividerBig = bigint(0x100000000)
298const dividerLem = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["a" /* str2bigInt */])('100000000', 16, 4);
299
300// const printTimers = (timeL, timeB, a, b, n) => setTimeout(
301// () => console.log(`Timer L ${timeL} B ${timeB}`, ...a, ...b, n || ''),
302// 100)
303
304function longToInts(sLong) {
305 /*const bigTime = Timer()
306 const divRem = bigStringInt(sLong).divideAndRemainder(dividerBig)
307 const divIntB = divRem[0].intValue()
308 const remIntB = divRem[1].intValue()
309 const resB = [
310 intToUint(divIntB),
311 intToUint(remIntB)
312 ]
313 const timeB = bigTime()*/
314
315 // const lemTime = Timer()
316 const lemNum = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["a" /* str2bigInt */])(sLong, 10, 6);
317 const div = new Array(lemNum.length);
318 const rem = new Array(lemNum.length);
319 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["d" /* divide_ */])(lemNum, dividerLem, div, rem);
320 const resL = [~~__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["c" /* bigInt2str */])(div, 10), ~~__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["c" /* bigInt2str */])(rem, 10)];
321 // const timeL = lemTime()
322
323 // printTimers(timeL, timeB, resL, resB)
324 return resL;
325}
326
327function longToBytes(sLong) {
328 return bytesFromWords({ words: longToInts(sLong), sigBytes: 8 }).reverse();
329}
330
331function longFromLem(high, low) {
332 const highNum = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["e" /* int2bigInt */])(high, 96, 0);
333 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["f" /* leftShift_ */])(highNum, 32);
334
335 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["g" /* addInt_ */])(highNum, low);
336 const res = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["c" /* bigInt2str */])(highNum, 10);
337 return res;
338}
339
340function intToUint(val) {
341 val = parseInt(val); //TODO PERF parseInt is a perfomance issue
342 if (val < 0) val = val + 4294967296;
343 return val;
344}
345
346function uintToInt(val) {
347 if (val > 2147483647) val = val - 4294967296;
348 return val;
349}
350
351function sha1HashSync(bytes) {
352 // console.log(dT(), 'SHA-1 hash start', bytes.byteLength || bytes.length)
353 const hashBytes = rushaInstance.rawDigest(bytes).buffer;
354 // console.log(dT(), 'SHA-1 hash finish')
355
356 return hashBytes;
357}
358
359function sha1BytesSync(bytes) {
360 return bytesFromArrayBuffer(sha1HashSync(bytes));
361}
362
363function sha256HashSync(bytes) {
364 // console.log(dT(), 'SHA-2 hash start', bytes.byteLength || bytes.length)
365 const hashWords = CryptoJS.SHA256(bytesToWords(bytes));
366 // console.log(dT(), 'SHA-2 hash finish')
367
368 const hashBytes = bytesFromWords(hashWords);
369
370 return hashBytes;
371}
372
373function rsaEncrypt(publicKey, bytes) {
374 bytes = addPadding(bytes, 255);
375
376 const N = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["a" /* str2bigInt */])(publicKey.modulus, 16, 256);
377 const E = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["a" /* str2bigInt */])(publicKey.exponent, 16, 256);
378 const X = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["a" /* str2bigInt */])(bytesToHex(bytes), 16, 256);
379 const encryptedBigInt = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["h" /* powMod */])(X, E, N),
380 encryptedBytes = bytesFromHex(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["c" /* bigInt2str */])(encryptedBigInt, 16));
381
382 return encryptedBytes;
383}
384
385function addPadding(bytes, blockSize, zeroes) {
386 blockSize = blockSize || 16;
387 const len = bytes.byteLength || bytes.length;
388 const needPadding = blockSize - len % blockSize;
389 if (needPadding > 0 && needPadding < blockSize) {
390 const padding = new Array(needPadding);
391 if (zeroes) {
392 for (let i = 0; i < needPadding; i++) padding[i] = 0;
393 } else __WEBPACK_IMPORTED_MODULE_5__service_secure_random__["a" /* default */].nextBytes(padding);
394
395 bytes = bytes instanceof ArrayBuffer ? bufferConcat(bytes, padding) : bytes.concat(padding);
396 }
397
398 return bytes;
399}
400
401function aesEncryptSync(bytes, keyBytes, ivBytes) {
402 const len = bytes.byteLength || bytes.length;
403
404 // console.log(dT(), 'AES encrypt start', len/*, bytesToHex(keyBytes), bytesToHex(ivBytes)*/)
405 bytes = addPadding(bytes);
406
407 const encryptedWords = CryptoJS.AES.encrypt(bytesToWords(bytes), bytesToWords(keyBytes), {
408 iv: bytesToWords(ivBytes),
409 padding: CryptoJS.pad.NoPadding,
410 mode: CryptoJS.mode.IGE
411 }).ciphertext;
412
413 const encryptedBytes = bytesFromWords(encryptedWords);
414 // console.log(dT(), 'AES encrypt finish')
415
416 return encryptedBytes;
417}
418
419function aesDecryptSync(encryptedBytes, keyBytes, ivBytes) {
420
421 // console.log(dT(), 'AES decrypt start', encryptedBytes.length)
422 const decryptedWords = CryptoJS.AES.decrypt({ ciphertext: bytesToWords(encryptedBytes) }, bytesToWords(keyBytes), {
423 iv: bytesToWords(ivBytes),
424 padding: CryptoJS.pad.NoPadding,
425 mode: CryptoJS.mode.IGE
426 });
427
428 const bytes = bytesFromWords(decryptedWords);
429 // console.log(dT(), 'AES decrypt finish')
430
431 return bytes;
432}
433
434function gzipUncompress(bytes) {
435 // console.log('Gzip uncompress start')
436 const result = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4_pako_lib_inflate__["inflate"])(bytes);
437 // console.log('Gzip uncompress finish')
438 return result;
439}
440
441function nextRandomInt(maxValue) {
442 return Math.floor(Math.random() * maxValue);
443}
444
445function pqPrimeFactorization(pqBytes) {
446 const minSize = Math.ceil(64 / __WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["i" /* bpe */]) + 1;
447
448 // const what = new BigInteger(pqBytes)
449 const hex = bytesToHex(pqBytes);
450 const lWhat = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["a" /* str2bigInt */])(hex, 16, minSize);
451 const result = pqPrimeLeemon(lWhat);
452 return result;
453}
454
455function pqPrimeLeemon(what) {
456 const minBits = 64;
457 const minLen = Math.ceil(minBits / __WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["i" /* bpe */]) + 1;
458 let it = 0;
459 let q, lim;
460 const a = new Array(minLen);
461 const b = new Array(minLen);
462 const c = new Array(minLen);
463 const g = new Array(minLen);
464 const z = new Array(minLen);
465 const x = new Array(minLen);
466 const y = new Array(minLen);
467
468 for (let i = 0; i < 3; i++) {
469 q = (nextRandomInt(128) & 15) + 17;
470 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["j" /* copyInt_ */])(x, nextRandomInt(1000000000) + 1);
471 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["k" /* copy_ */])(y, x);
472 lim = 1 << i + 18;
473
474 for (let j = 1; j < lim; j++) {
475 ++it;
476 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["k" /* copy_ */])(a, x);
477 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["k" /* copy_ */])(b, x);
478 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["j" /* copyInt_ */])(c, q);
479
480 while (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["l" /* isZero */])(b)) {
481 if (b[0] & 1) {
482 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["m" /* add_ */])(c, a);
483 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["n" /* greater */])(c, what)) {
484 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["o" /* sub_ */])(c, what);
485 }
486 }
487 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["m" /* add_ */])(a, a);
488 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["n" /* greater */])(a, what)) {
489 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["o" /* sub_ */])(a, what);
490 }
491 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["b" /* rightShift_ */])(b, 1);
492 }
493
494 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["k" /* copy_ */])(x, c);
495 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["n" /* greater */])(x, y)) {
496 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["k" /* copy_ */])(z, x);
497 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["o" /* sub_ */])(z, y);
498 } else {
499 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["k" /* copy_ */])(z, y);
500 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["o" /* sub_ */])(z, x);
501 }
502 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["p" /* eGCD_ */])(z, what, g, a, b);
503 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["q" /* equalsInt */])(g, 1)) {
504 break;
505 }
506 if ((j & j - 1) === 0) {
507 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["k" /* copy_ */])(y, x);
508 }
509 }
510 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["n" /* greater */])(g, __WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["r" /* one */])) {
511 break;
512 }
513 }
514
515 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["d" /* divide_ */])(what, g, x, y);
516
517 const [P, Q] = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["n" /* greater */])(g, x) ? [x, g] : [g, x];
518
519 // console.log(dT(), 'done', bigInt2str(what, 10), bigInt2str(P, 10), bigInt2str(Q, 10))
520
521 return [bytesFromLeemonBigInt(P), bytesFromLeemonBigInt(Q), it];
522}
523
524function bytesModPow(x, y, m) {
525 const xBigInt = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["a" /* str2bigInt */])(bytesToHex(x), 16);
526 const yBigInt = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["a" /* str2bigInt */])(bytesToHex(y), 16);
527 const mBigInt = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["a" /* str2bigInt */])(bytesToHex(m), 16);
528 const resBigInt = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["h" /* powMod */])(xBigInt, yBigInt, mBigInt);
529
530 return bytesFromHex(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__vendor_leemon__["c" /* bigInt2str */])(resBigInt, 16));
531}
532
533/***/ }),
534/* 3 */
535/***/ (function(module, exports) {
536
537/*
538CryptoJS v3.1.2
539code.google.com/p/crypto-js
540(c) 2009-2013 by Jeff Mott. All rights reserved.
541code.google.com/p/crypto-js/wiki/License
542*/
543/**
544 * CryptoJS core components.
545 */
546var CryptoJS = CryptoJS || (function (Math, undefined) {
547 /**
548 * CryptoJS namespace.
549 */
550 var C = {};
551
552 /**
553 * Library namespace.
554 */
555 var C_lib = C.lib = {};
556
557 /**
558 * Base object for prototypal inheritance.
559 */
560 var Base = C_lib.Base = (function () {
561 function F() {}
562
563 return {
564 /**
565 * Creates a new object that inherits from this object.
566 *
567 * @param {Object} overrides Properties to copy into the new object.
568 *
569 * @return {Object} The new object.
570 *
571 * @static
572 *
573 * @example
574 *
575 * var MyType = CryptoJS.lib.Base.extend({
576 * field: 'value',
577 *
578 * method: function () {
579 * }
580 * });
581 */
582 extend: function (overrides) {
583 // Spawn
584 F.prototype = this;
585 var subtype = new F();
586
587 // Augment
588 if (overrides) {
589 subtype.mixIn(overrides);
590 }
591
592 // Create default initializer
593 if (!subtype.hasOwnProperty('init')) {
594 subtype.init = function () {
595 subtype.$super.init.apply(this, arguments);
596 };
597 }
598
599 // Initializer's prototype is the subtype object
600 subtype.init.prototype = subtype;
601
602 // Reference supertype
603 subtype.$super = this;
604
605 return subtype;
606 },
607
608 /**
609 * Extends this object and runs the init method.
610 * Arguments to create() will be passed to init().
611 *
612 * @return {Object} The new object.
613 *
614 * @static
615 *
616 * @example
617 *
618 * var instance = MyType.create();
619 */
620 create: function () {
621 var instance = this.extend();
622 instance.init.apply(instance, arguments);
623
624 return instance;
625 },
626
627 /**
628 * Initializes a newly created object.
629 * Override this method to add some logic when your objects are created.
630 *
631 * @example
632 *
633 * var MyType = CryptoJS.lib.Base.extend({
634 * init: function () {
635 * // ...
636 * }
637 * });
638 */
639 init: function () {
640 },
641
642 /**
643 * Copies properties into this object.
644 *
645 * @param {Object} properties The properties to mix in.
646 *
647 * @example
648 *
649 * MyType.mixIn({
650 * field: 'value'
651 * });
652 */
653 mixIn: function (properties) {
654 for (var propertyName in properties) {
655 if (properties.hasOwnProperty(propertyName)) {
656 this[propertyName] = properties[propertyName];
657 }
658 }
659
660 // IE won't copy toString using the loop above
661 if (properties.hasOwnProperty('toString')) {
662 this.toString = properties.toString;
663 }
664 },
665
666 /**
667 * Creates a copy of this object.
668 *
669 * @return {Object} The clone.
670 *
671 * @example
672 *
673 * var clone = instance.clone();
674 */
675 clone: function () {
676 return this.init.prototype.extend(this);
677 }
678 };
679 }());
680
681 /**
682 * An array of 32-bit words.
683 *
684 * @property {Array} words The array of 32-bit words.
685 * @property {number} sigBytes The number of significant bytes in this word array.
686 */
687 var WordArray = C_lib.WordArray = Base.extend({
688 /**
689 * Initializes a newly created word array.
690 *
691 * @param {Array} words (Optional) An array of 32-bit words.
692 * @param {number} sigBytes (Optional) The number of significant bytes in the words.
693 *
694 * @example
695 *
696 * var wordArray = CryptoJS.lib.WordArray.create();
697 * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
698 * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
699 */
700 init: function (words, sigBytes) {
701 words = this.words = words || [];
702
703 if (sigBytes != undefined) {
704 this.sigBytes = sigBytes;
705 } else {
706 this.sigBytes = words.length * 4;
707 }
708 },
709
710 /**
711 * Converts this word array to a string.
712 *
713 * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
714 *
715 * @return {string} The stringified word array.
716 *
717 * @example
718 *
719 * var string = wordArray + '';
720 * var string = wordArray.toString();
721 * var string = wordArray.toString(CryptoJS.enc.Utf8);
722 */
723 toString: function (encoder) {
724 return (encoder || Hex).stringify(this);
725 },
726
727 /**
728 * Concatenates a word array to this word array.
729 *
730 * @param {WordArray} wordArray The word array to append.
731 *
732 * @return {WordArray} This word array.
733 *
734 * @example
735 *
736 * wordArray1.concat(wordArray2);
737 */
738 concat: function (wordArray) {
739 // Shortcuts
740 var thisWords = this.words;
741 var thatWords = wordArray.words;
742 var thisSigBytes = this.sigBytes;
743 var thatSigBytes = wordArray.sigBytes;
744
745 // Clamp excess bits
746 this.clamp();
747
748 // Concat
749 if (thisSigBytes % 4) {
750 // Copy one byte at a time
751 for (var i = 0; i < thatSigBytes; i++) {
752 var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
753 thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);
754 }
755 } else if (thatWords.length > 0xffff) {
756 // Copy one word at a time
757 for (var i = 0; i < thatSigBytes; i += 4) {
758 thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];
759 }
760 } else {
761 // Copy all words at once
762 thisWords.push.apply(thisWords, thatWords);
763 }
764 this.sigBytes += thatSigBytes;
765
766 // Chainable
767 return this;
768 },
769
770 /**
771 * Removes insignificant bits.
772 *
773 * @example
774 *
775 * wordArray.clamp();
776 */
777 clamp: function () {
778 // Shortcuts
779 var words = this.words;
780 var sigBytes = this.sigBytes;
781
782 // Clamp
783 words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);
784 words.length = Math.ceil(sigBytes / 4);
785 },
786
787 /**
788 * Creates a copy of this word array.
789 *
790 * @return {WordArray} The clone.
791 *
792 * @example
793 *
794 * var clone = wordArray.clone();
795 */
796 clone: function () {
797 var clone = Base.clone.call(this);
798 clone.words = this.words.slice(0);
799
800 return clone;
801 },
802
803 /**
804 * Creates a word array filled with random bytes.
805 *
806 * @param {number} nBytes The number of random bytes to generate.
807 *
808 * @return {WordArray} The random word array.
809 *
810 * @static
811 *
812 * @example
813 *
814 * var wordArray = CryptoJS.lib.WordArray.random(16);
815 */
816 random: function (nBytes) {
817 var words = [];
818 for (var i = 0; i < nBytes; i += 4) {
819 words.push((Math.random() * 0x100000000) | 0);
820 }
821
822 return new WordArray.init(words, nBytes);
823 }
824 });
825
826 /**
827 * Encoder namespace.
828 */
829 var C_enc = C.enc = {};
830
831 /**
832 * Hex encoding strategy.
833 */
834 var Hex = C_enc.Hex = {
835 /**
836 * Converts a word array to a hex string.
837 *
838 * @param {WordArray} wordArray The word array.
839 *
840 * @return {string} The hex string.
841 *
842 * @static
843 *
844 * @example
845 *
846 * var hexString = CryptoJS.enc.Hex.stringify(wordArray);
847 */
848 stringify: function (wordArray) {
849 // Shortcuts
850 var words = wordArray.words;
851 var sigBytes = wordArray.sigBytes;
852
853 // Convert
854 var hexChars = [];
855 for (var i = 0; i < sigBytes; i++) {
856 var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
857 hexChars.push((bite >>> 4).toString(16));
858 hexChars.push((bite & 0x0f).toString(16));
859 }
860
861 return hexChars.join('');
862 },
863
864 /**
865 * Converts a hex string to a word array.
866 *
867 * @param {string} hexStr The hex string.
868 *
869 * @return {WordArray} The word array.
870 *
871 * @static
872 *
873 * @example
874 *
875 * var wordArray = CryptoJS.enc.Hex.parse(hexString);
876 */
877 parse: function (hexStr) {
878 // Shortcut
879 var hexStrLength = hexStr.length;
880
881 // Convert
882 var words = [];
883 for (var i = 0; i < hexStrLength; i += 2) {
884 words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);
885 }
886
887 return new WordArray.init(words, hexStrLength / 2);
888 }
889 };
890
891 /**
892 * Latin1 encoding strategy.
893 */
894 var Latin1 = C_enc.Latin1 = {
895 /**
896 * Converts a word array to a Latin1 string.
897 *
898 * @param {WordArray} wordArray The word array.
899 *
900 * @return {string} The Latin1 string.
901 *
902 * @static
903 *
904 * @example
905 *
906 * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
907 */
908 stringify: function (wordArray) {
909 // Shortcuts
910 var words = wordArray.words;
911 var sigBytes = wordArray.sigBytes;
912
913 // Convert
914 var latin1Chars = [];
915 for (var i = 0; i < sigBytes; i++) {
916 var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
917 latin1Chars.push(String.fromCharCode(bite));
918 }
919
920 return latin1Chars.join('');
921 },
922
923 /**
924 * Converts a Latin1 string to a word array.
925 *
926 * @param {string} latin1Str The Latin1 string.
927 *
928 * @return {WordArray} The word array.
929 *
930 * @static
931 *
932 * @example
933 *
934 * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
935 */
936 parse: function (latin1Str) {
937 // Shortcut
938 var latin1StrLength = latin1Str.length;
939
940 // Convert
941 var words = [];
942 for (var i = 0; i < latin1StrLength; i++) {
943 words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
944 }
945
946 return new WordArray.init(words, latin1StrLength);
947 }
948 };
949
950 /**
951 * UTF-8 encoding strategy.
952 */
953 var Utf8 = C_enc.Utf8 = {
954 /**
955 * Converts a word array to a UTF-8 string.
956 *
957 * @param {WordArray} wordArray The word array.
958 *
959 * @return {string} The UTF-8 string.
960 *
961 * @static
962 *
963 * @example
964 *
965 * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
966 */
967 stringify: function (wordArray) {
968 try {
969 return decodeURIComponent(escape(Latin1.stringify(wordArray)));
970 } catch (e) {
971 throw new Error('Malformed UTF-8 data');
972 }
973 },
974
975 /**
976 * Converts a UTF-8 string to a word array.
977 *
978 * @param {string} utf8Str The UTF-8 string.
979 *
980 * @return {WordArray} The word array.
981 *
982 * @static
983 *
984 * @example
985 *
986 * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
987 */
988 parse: function (utf8Str) {
989 return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
990 }
991 };
992
993 /**
994 * Abstract buffered block algorithm template.
995 *
996 * The property blockSize must be implemented in a concrete subtype.
997 *
998 * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
999 */
1000 var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
1001 /**
1002 * Resets this block algorithm's data buffer to its initial state.
1003 *
1004 * @example
1005 *
1006 * bufferedBlockAlgorithm.reset();
1007 */
1008 reset: function () {
1009 // Initial values
1010 this._data = new WordArray.init();
1011 this._nDataBytes = 0;
1012 },
1013
1014 /**
1015 * Adds new data to this block algorithm's buffer.
1016 *
1017 * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
1018 *
1019 * @example
1020 *
1021 * bufferedBlockAlgorithm._append('data');
1022 * bufferedBlockAlgorithm._append(wordArray);
1023 */
1024 _append: function (data) {
1025 // Convert string to WordArray, else assume WordArray already
1026 if (typeof data == 'string') {
1027 data = Utf8.parse(data);
1028 }
1029
1030 // Append
1031 this._data.concat(data);
1032 this._nDataBytes += data.sigBytes;
1033 },
1034
1035 /**
1036 * Processes available data blocks.
1037 *
1038 * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
1039 *
1040 * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
1041 *
1042 * @return {WordArray} The processed data.
1043 *
1044 * @example
1045 *
1046 * var processedData = bufferedBlockAlgorithm._process();
1047 * var processedData = bufferedBlockAlgorithm._process(!!'flush');
1048 */
1049 _process: function (doFlush) {
1050 // Shortcuts
1051 var data = this._data;
1052 var dataWords = data.words;
1053 var dataSigBytes = data.sigBytes;
1054 var blockSize = this.blockSize;
1055 var blockSizeBytes = blockSize * 4;
1056
1057 // Count blocks ready
1058 var nBlocksReady = dataSigBytes / blockSizeBytes;
1059 if (doFlush) {
1060 // Round up to include partial blocks
1061 nBlocksReady = Math.ceil(nBlocksReady);
1062 } else {
1063 // Round down to include only full blocks,
1064 // less the number of blocks that must remain in the buffer
1065 nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
1066 }
1067
1068 // Count words ready
1069 var nWordsReady = nBlocksReady * blockSize;
1070
1071 // Count bytes ready
1072 var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
1073
1074 // Process blocks
1075 if (nWordsReady) {
1076 for (var offset = 0; offset < nWordsReady; offset += blockSize) {
1077 // Perform concrete-algorithm logic
1078 this._doProcessBlock(dataWords, offset);
1079 }
1080
1081 // Remove processed words
1082 var processedWords = dataWords.splice(0, nWordsReady);
1083 data.sigBytes -= nBytesReady;
1084 }
1085
1086 // Return processed words
1087 return new WordArray.init(processedWords, nBytesReady);
1088 },
1089
1090 /**
1091 * Creates a copy of this object.
1092 *
1093 * @return {Object} The clone.
1094 *
1095 * @example
1096 *
1097 * var clone = bufferedBlockAlgorithm.clone();
1098 */
1099 clone: function () {
1100 var clone = Base.clone.call(this);
1101 clone._data = this._data.clone();
1102
1103 return clone;
1104 },
1105
1106 _minBufferSize: 0
1107 });
1108
1109 /**
1110 * Abstract hasher template.
1111 *
1112 * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
1113 */
1114 var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
1115 /**
1116 * Configuration options.
1117 */
1118 cfg: Base.extend(),
1119
1120 /**
1121 * Initializes a newly created hasher.
1122 *
1123 * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
1124 *
1125 * @example
1126 *
1127 * var hasher = CryptoJS.algo.SHA256.create();
1128 */
1129 init: function (cfg) {
1130 // Apply config defaults
1131 this.cfg = this.cfg.extend(cfg);
1132
1133 // Set initial values
1134 this.reset();
1135 },
1136
1137 /**
1138 * Resets this hasher to its initial state.
1139 *
1140 * @example
1141 *
1142 * hasher.reset();
1143 */
1144 reset: function () {
1145 // Reset data buffer
1146 BufferedBlockAlgorithm.reset.call(this);
1147
1148 // Perform concrete-hasher logic
1149 this._doReset();
1150 },
1151
1152 /**
1153 * Updates this hasher with a message.
1154 *
1155 * @param {WordArray|string} messageUpdate The message to append.
1156 *
1157 * @return {Hasher} This hasher.
1158 *
1159 * @example
1160 *
1161 * hasher.update('message');
1162 * hasher.update(wordArray);
1163 */
1164 update: function (messageUpdate) {
1165 // Append
1166 this._append(messageUpdate);
1167
1168 // Update the hash
1169 this._process();
1170
1171 // Chainable
1172 return this;
1173 },
1174
1175 /**
1176 * Finalizes the hash computation.
1177 * Note that the finalize operation is effectively a destructive, read-once operation.
1178 *
1179 * @param {WordArray|string} messageUpdate (Optional) A final message update.
1180 *
1181 * @return {WordArray} The hash.
1182 *
1183 * @example
1184 *
1185 * var hash = hasher.finalize();
1186 * var hash = hasher.finalize('message');
1187 * var hash = hasher.finalize(wordArray);
1188 */
1189 finalize: function (messageUpdate) {
1190 // Final message update
1191 if (messageUpdate) {
1192 this._append(messageUpdate);
1193 }
1194
1195 // Perform concrete-hasher logic
1196 var hash = this._doFinalize();
1197
1198 return hash;
1199 },
1200
1201 blockSize: 512/32,
1202
1203 /**
1204 * Creates a shortcut function to a hasher's object interface.
1205 *
1206 * @param {Hasher} hasher The hasher to create a helper for.
1207 *
1208 * @return {Function} The shortcut function.
1209 *
1210 * @static
1211 *
1212 * @example
1213 *
1214 * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
1215 */
1216 _createHelper: function (hasher) {
1217 return function (message, cfg) {
1218 return new hasher.init(cfg).finalize(message);
1219 };
1220 },
1221
1222 /**
1223 * Creates a shortcut function to the HMAC's object interface.
1224 *
1225 * @param {Hasher} hasher The hasher to use in this HMAC helper.
1226 *
1227 * @return {Function} The shortcut function.
1228 *
1229 * @static
1230 *
1231 * @example
1232 *
1233 * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
1234 */
1235 _createHmacHelper: function (hasher) {
1236 return function (message, key) {
1237 return new C_algo.HMAC.init(hasher, key).finalize(message);
1238 };
1239 }
1240 });
1241
1242 /**
1243 * Algorithm namespace.
1244 */
1245 var C_algo = C.algo = {};
1246
1247 return C;
1248}(Math));
1249
1250exports.CryptoJS = CryptoJS;
1251
1252
1253/***/ }),
1254/* 4 */
1255/***/ (function(module, __webpack_exports__, __webpack_require__) {
1256
1257"use strict";
1258/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird__ = __webpack_require__(1);
1259/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_bluebird__);
1260
1261/**
1262 * Defered promise like in Q and $q
1263 *
1264 * @returns {{ resolve: (res: any) => void, reject: (res: any) => void, promise: Promise<{}> }}
1265 */
1266const blueDefer = () => {
1267 let resolve, reject;
1268 const promise = new __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a((rs, rj) => {
1269 resolve = rs;
1270 reject = rj;
1271 });
1272 return {
1273 resolve,
1274 reject,
1275 promise
1276 };
1277};
1278/* harmony export (immutable) */ __webpack_exports__["a"] = blueDefer;
1279
1280
1281/* harmony default export */ __webpack_exports__["b"] = blueDefer;
1282
1283/***/ }),
1284/* 5 */
1285/***/ (function(module, __webpack_exports__, __webpack_require__) {
1286
1287"use strict";
1288Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
1289/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_detect_node__ = __webpack_require__(13);
1290/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_detect_node___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_detect_node__);
1291/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__store__ = __webpack_require__(11);
1292/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bin__ = __webpack_require__(2);
1293/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "generateID", function() { return generateMessageID; });
1294
1295
1296
1297
1298
1299const tsNow = seconds => {
1300 let t = +new Date();
1301 //eslint-disable-next-line
1302 if (!__WEBPACK_IMPORTED_MODULE_0_detect_node___default.a) t += window.tsOffset || 0;
1303 return seconds ? Math.floor(t / 1000) : t;
1304};
1305/* harmony export (immutable) */ __webpack_exports__["tsNow"] = tsNow;
1306
1307
1308const logTimer = new Date().getTime();
1309
1310const dTime = () => `[${((new Date().getTime() - logTimer) / 1000).toFixed(3)}]`;
1311/* harmony export (immutable) */ __webpack_exports__["dTime"] = dTime;
1312
1313
1314let lastMessageID = [0, 0];
1315let timerOffset = 0;
1316
1317const offset = __WEBPACK_IMPORTED_MODULE_1__store__["b" /* TimeOffset */].get();
1318if (offset) timerOffset = offset;
1319
1320const generateMessageID = () => {
1321 const timeTicks = tsNow(),
1322 timeSec = Math.floor(timeTicks / 1000) + timerOffset,
1323 timeMSec = timeTicks % 1000,
1324 random = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["l" /* nextRandomInt */])(0xFFFF);
1325
1326 let messageID = [timeSec, timeMSec << 21 | random << 3 | 4];
1327 if (lastMessageID[0] > messageID[0] || lastMessageID[0] == messageID[0] && lastMessageID[1] >= messageID[1]) {
1328 messageID = [lastMessageID[0], lastMessageID[1] + 4];
1329 }
1330
1331 lastMessageID = messageID;
1332
1333 // console.log('generated msg id', messageID, timerOffset)
1334
1335 return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["t" /* longFromLem */])(messageID[0], messageID[1]);
1336};
1337
1338const applyServerTime = (serverTime, localTime) => {
1339 const newTimeOffset = serverTime - Math.floor((localTime || tsNow()) / 1000);
1340 const changed = Math.abs(timerOffset - newTimeOffset) > 10;
1341 __WEBPACK_IMPORTED_MODULE_1__store__["b" /* TimeOffset */].set(newTimeOffset);
1342
1343 lastMessageID = [0, 0];
1344 timerOffset = newTimeOffset;
1345 console.log(dTime(), 'Apply server time', serverTime, localTime, newTimeOffset, changed);
1346
1347 return changed;
1348};
1349/* harmony export (immutable) */ __webpack_exports__["applyServerTime"] = applyServerTime;
1350
1351
1352
1353
1354/***/ }),
1355/* 6 */
1356/***/ (function(module, exports) {
1357
1358module.exports = vendor;
1359
1360/***/ }),
1361/* 7 */
1362/***/ (function(module, __webpack_exports__, __webpack_require__) {
1363
1364"use strict";
1365/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jsbn__ = __webpack_require__(19);
1366/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jsbn___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jsbn__);
1367
1368
1369const random = new __WEBPACK_IMPORTED_MODULE_0_jsbn__["SecureRandom"]();
1370/* unused harmony export random */
1371
1372
1373/* harmony default export */ __webpack_exports__["a"] = random;
1374
1375/***/ }),
1376/* 8 */
1377/***/ (function(module, __webpack_exports__, __webpack_require__) {
1378
1379"use strict";
1380/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird__ = __webpack_require__(1);
1381/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_bluebird__);
1382
1383
1384const cancelToken = Symbol('cancel token');
1385
1386const timeoutRefs = new WeakSet();
1387
1388const pause = delay => new __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a(r => setTimeout(r, delay));
1389
1390const smartTimeout = (fn, delay = 0, ...args) => {
1391 const newToken = Symbol('cancel id');
1392 const checkRun = () => {
1393 if (timeoutRefs.has(newToken)) {
1394 timeoutRefs.delete(newToken);
1395 return fn(...args);
1396 } else return false;
1397 };
1398 const promise = pause(delay).then(checkRun);
1399 promise[cancelToken] = newToken;
1400 return promise;
1401};
1402/* harmony export (immutable) */ __webpack_exports__["a"] = smartTimeout;
1403
1404
1405smartTimeout.cancel = promise => {
1406 if (!promise || !promise[cancelToken]) return false;
1407 const token = promise[cancelToken];
1408 return timeoutRefs.has(token) ? timeoutRefs.delete(token) : false;
1409};
1410
1411smartTimeout.immediate = (fn, ...args) => __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.resolve().then(() => fn(...args));
1412
1413smartTimeout.promise = (fn, delay = 0, ...args) => pause(delay).then(() => fn(...args));
1414
1415/* harmony default export */ __webpack_exports__["b"] = smartTimeout;
1416
1417/***/ }),
1418/* 9 */
1419/***/ (function(module, __webpack_exports__, __webpack_require__) {
1420
1421"use strict";
1422/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_ramda__ = __webpack_require__(0);
1423/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_ramda___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_ramda__);
1424/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_detect_node__ = __webpack_require__(13);
1425/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_detect_node___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_detect_node__);
1426/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__defer__ = __webpack_require__(4);
1427/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__smart_timeout__ = __webpack_require__(8);
1428/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__bin__ = __webpack_require__(2);
1429
1430
1431
1432
1433
1434
1435
1436const convertIfArray = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["when"])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["is"])(Array), __WEBPACK_IMPORTED_MODULE_4__bin__["b" /* convertToUint8Array */]);
1437let webWorker = !__WEBPACK_IMPORTED_MODULE_1_detect_node___default.a;
1438let taskID = 0;
1439const awaiting = {};
1440const webCrypto = __WEBPACK_IMPORTED_MODULE_1_detect_node___default.a ? false
1441//eslint-disable-next-line
1442: window.crypto.subtle || window.crypto.webkitSubtle //TODO remove browser depends
1443//eslint-disable-next-line
1444|| window.msCrypto && window.msCrypto.subtle;
1445const useWebCrypto = webCrypto && !!webCrypto.digest;
1446let useSha1Crypto = useWebCrypto;
1447let useSha256Crypto = useWebCrypto;
1448const finalizeTask = (taskID, result) => {
1449 const deferred = awaiting[taskID];
1450 if (deferred) {
1451 // console.log(rework_d_T(), 'CW done')
1452 deferred.resolve(result); //TODO Possibly, can be used as
1453 delete awaiting[taskID]; //
1454 } // deferred = Promise.resolve()
1455}; // deferred.resolve( result )
1456
1457const isCryptoTask = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["both"])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["has"])('taskID'), __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["has"])('result'));
1458
1459//eslint-disable-next-line
1460const workerEnable = !__WEBPACK_IMPORTED_MODULE_1_detect_node___default.a && window.Worker;
1461if (workerEnable) {
1462 __webpack_require__(37);
1463 const tmpWorker = new Worker('./bundle/hash.worker.js');
1464 // tmpWorker.onmessage = function(event) {
1465 // console.info('CW tmpWorker.onmessage', event && event.data)
1466 // }
1467 tmpWorker.onmessage = e => {
1468 if (e.data === 'ready') {
1469 console.info('CW ready');
1470 } else if (!isCryptoTask(e.data)) {
1471 console.info('Not crypto task', e, e.data);
1472 return e;
1473 } else return webWorker ? finalizeTask(e.data.taskID, e.data.result) : webWorker = tmpWorker;
1474 };
1475
1476 tmpWorker.onerror = function (error) {
1477 console.error('CW error', error, error.stack);
1478 webWorker = false;
1479 };
1480 tmpWorker.postMessage('b');
1481 webWorker = tmpWorker;
1482}
1483
1484const performTaskWorker = (task, params, embed) => {
1485 // console.log(rework_d_T(), 'CW start', task)
1486 const deferred = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__defer__["b" /* default */])();
1487
1488 awaiting[taskID] = deferred;
1489
1490 params.task = task;
1491 params.taskID = taskID;(embed || webWorker).postMessage(params);
1492
1493 taskID++;
1494
1495 return deferred.promise;
1496};
1497
1498const sha1Hash = bytes => {
1499 if (useSha1Crypto) {
1500 // We don't use buffer since typedArray.subarray(...).buffer gives the whole buffer and not sliced one.
1501 // webCrypto.digest supports typed array
1502 const bytesTyped = convertIfArray(bytes);
1503 // console.log(rework_d_T(), 'Native sha1 start')
1504 return webCrypto.digest({ name: 'SHA-1' }, bytesTyped).then(digest =>
1505 // console.log(rework_d_T(), 'Native sha1 done')
1506 digest, e => {
1507 console.error('Crypto digest error', e);
1508 useSha1Crypto = false;
1509 return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__bin__["m" /* sha1HashSync */])(bytes);
1510 });
1511 }
1512 return __WEBPACK_IMPORTED_MODULE_3__smart_timeout__["b" /* default */].immediate(__WEBPACK_IMPORTED_MODULE_4__bin__["m" /* sha1HashSync */], bytes);
1513};
1514
1515const sha256Hash = bytes => {
1516 if (useSha256Crypto) {
1517 const bytesTyped = convertIfArray(bytes);
1518 // console.log(rework_d_T(), 'Native sha1 start')
1519 return webCrypto.digest({ name: 'SHA-256' }, bytesTyped).then(__WEBPACK_IMPORTED_MODULE_0_ramda__["identity"]
1520 // console.log(rework_d_T(), 'Native sha1 done')
1521 , e => {
1522 console.error('Crypto digest error', e);
1523 useSha256Crypto = false;
1524 return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__bin__["n" /* sha256HashSync */])(bytes);
1525 });
1526 }
1527 return __WEBPACK_IMPORTED_MODULE_3__smart_timeout__["b" /* default */].immediate(__WEBPACK_IMPORTED_MODULE_4__bin__["n" /* sha256HashSync */], bytes);
1528};
1529
1530const aesEncrypt = (bytes, keyBytes, ivBytes) => __WEBPACK_IMPORTED_MODULE_3__smart_timeout__["b" /* default */].immediate(() => __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__bin__["c" /* convertToArrayBuffer */])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__bin__["o" /* aesEncryptSync */])(bytes, keyBytes, ivBytes)));
1531
1532const aesDecrypt = (encryptedBytes, keyBytes, ivBytes) => __WEBPACK_IMPORTED_MODULE_3__smart_timeout__["b" /* default */].immediate(() => __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__bin__["c" /* convertToArrayBuffer */])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__bin__["p" /* aesDecryptSync */])(encryptedBytes, keyBytes, ivBytes)));
1533
1534const factorize = bytes => {
1535 bytes = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__bin__["q" /* convertToByteArray */])(bytes);
1536 return webWorker ? performTaskWorker('factorize', { bytes }) : __WEBPACK_IMPORTED_MODULE_3__smart_timeout__["b" /* default */].immediate(__WEBPACK_IMPORTED_MODULE_4__bin__["r" /* pqPrimeFactorization */], bytes);
1537};
1538
1539const modPow = (x, y, m) => webWorker ? performTaskWorker('mod-pow', {
1540 x,
1541 y,
1542 m
1543}) : __WEBPACK_IMPORTED_MODULE_3__smart_timeout__["b" /* default */].immediate(__WEBPACK_IMPORTED_MODULE_4__bin__["s" /* bytesModPow */], x, y, m);
1544
1545const CryptoWorker = {
1546 sha1Hash,
1547 sha256Hash,
1548 aesEncrypt,
1549 aesDecrypt,
1550 factorize,
1551 modPow
1552};
1553/* harmony export (immutable) */ __webpack_exports__["a"] = CryptoWorker;
1554
1555
1556/* harmony default export */ __webpack_exports__["b"] = CryptoWorker;
1557
1558/***/ }),
1559/* 10 */
1560/***/ (function(module, __webpack_exports__, __webpack_require__) {
1561
1562"use strict";
1563/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_axios__ = __webpack_require__(40);
1564/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_axios___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_axios__);
1565
1566
1567const httpClient = __WEBPACK_IMPORTED_MODULE_0_axios___default.a.create();
1568/* harmony export (immutable) */ __webpack_exports__["a"] = httpClient;
1569
1570delete httpClient.defaults.headers.post['Content-Type'];
1571delete httpClient.defaults.headers.common['Accept'];
1572
1573/* harmony default export */ __webpack_exports__["b"] = httpClient;
1574
1575/***/ }),
1576/* 11 */
1577/***/ (function(module, __webpack_exports__, __webpack_require__) {
1578
1579"use strict";
1580/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird__ = __webpack_require__(1);
1581/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_bluebird__);
1582/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ramda__ = __webpack_require__(0);
1583/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ramda___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_ramda__);
1584
1585
1586
1587
1588const ValueStore = () => {
1589 let val = null;
1590
1591 return {
1592 get: () => __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["clone"])(val),
1593 set: newVal => val = newVal
1594 };
1595};
1596/* unused harmony export ValueStore */
1597
1598
1599const ValueStoreMap = () => {
1600 const val = new Map();
1601
1602 return {
1603 get: key => __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["clone"])(val.get(key)),
1604 set: (key, newVal) => val.set(key, newVal)
1605 };
1606};
1607/* unused harmony export ValueStoreMap */
1608
1609
1610const TimeOffset = ValueStore();
1611/* harmony export (immutable) */ __webpack_exports__["b"] = TimeOffset;
1612
1613const dcList = ValueStoreMap();
1614/* unused harmony export dcList */
1615
1616
1617const flatProps = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["pipe"])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["flip"])(__WEBPACK_IMPORTED_MODULE_1_ramda__["props"]), __WEBPACK_IMPORTED_MODULE_1_ramda__["unapply"]);
1618
1619const AsyncStorage = () => {
1620 let store = {};
1621
1622 const flatGet = flatProps(store);
1623 const set = obj => store = Object.assign({}, store, obj);
1624 const remove = keys => store = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["omit"])(keys, store);
1625 const clr = () => store = {};
1626 return {
1627 get: (...keys) => __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.resolve(flatGet(...keys)),
1628 set: obj => __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.resolve(set(obj)),
1629 remove: (...keys) => __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.resolve(remove(keys)),
1630 clear: () => __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.resolve(clr()),
1631 noPrefix: () => ({})
1632 };
1633};
1634/* unused harmony export AsyncStorage */
1635
1636
1637const PureStorage = AsyncStorage();
1638/* harmony export (immutable) */ __webpack_exports__["a"] = PureStorage;
1639 /*{
1640 get : (...keys) => new Promise(rs => ConfigStorage.get(keys, rs)),
1641 set : obj => new Promise(rs => ConfigStorage.set(obj, rs)),
1642 remove : (...keys) => new Promise(rs => ConfigStorage.remove(...keys, rs)),
1643 noPrefix: () => ConfigStorage.noPrefix(),
1644 clear : () => new Promise(rs => ConfigStorage.clear(rs))
1645 }*/
1646
1647/***/ }),
1648/* 12 */
1649/***/ (function(module, __webpack_exports__, __webpack_require__) {
1650
1651"use strict";
1652/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird__ = __webpack_require__(1);
1653/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_bluebird__);
1654/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_eventemitter2__ = __webpack_require__(35);
1655/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_eventemitter2___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_eventemitter2__);
1656/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_ramda__ = __webpack_require__(0);
1657/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_ramda___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_ramda__);
1658/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__networker__ = __webpack_require__(16);
1659/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__authorizer__ = __webpack_require__(30);
1660/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__store__ = __webpack_require__(11);
1661/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__defer__ = __webpack_require__(4);
1662/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__time_manager__ = __webpack_require__(5);
1663/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__dc_configurator__ = __webpack_require__(15);
1664/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__tl__ = __webpack_require__(34);
1665/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__rsa_keys_manger__ = __webpack_require__(32);
1666/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__bin__ = __webpack_require__(2);
1667/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__error_cases__ = __webpack_require__(29);
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686const api57 = __webpack_require__(38);
1687const mtproto57 = __webpack_require__(39);
1688
1689const hasPath = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2_ramda__["pathSatisfies"])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2_ramda__["complement"])(__WEBPACK_IMPORTED_MODULE_2_ramda__["isNil"]));
1690const defDc = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2_ramda__["unless"])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2_ramda__["is"])(Number), __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2_ramda__["always"])(2));
1691const withoutNil = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2_ramda__["reject"])(__WEBPACK_IMPORTED_MODULE_2_ramda__["isNil"]);
1692
1693const baseDcID = 2;
1694
1695const Ln = (length, obj) => obj && __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2_ramda__["propEq"])('length', length, obj);
1696
1697class ApiManager {
1698
1699 constructor({
1700 server = {},
1701 api = {},
1702 app: {
1703 debug = false,
1704 storage = __WEBPACK_IMPORTED_MODULE_5__store__["a" /* PureStorage */]
1705 } = {},
1706 schema = api57,
1707 mtSchema = mtproto57
1708 } = {}) {
1709 this.emitter = new __WEBPACK_IMPORTED_MODULE_1_eventemitter2___default.a({
1710 wildcard: true
1711 });
1712 this.on = this.emitter.on.bind(this.emitter);
1713 this.emit = this.emitter.emit.bind(this.emitter);
1714 this.cache = {
1715 uploader: {},
1716 downloader: {},
1717 auth: {},
1718 servers: {}
1719 };
1720
1721 this.mtpGetNetworker = (dcID, options = {}) => {
1722 const isUpload = options.fileUpload || options.fileDownload;
1723 const cache = isUpload ? this.cache.uploader : this.cache.downloader;
1724 if (!dcID) throw new Error('get Networker without dcID');
1725
1726 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2_ramda__["isNil"])(cache[dcID])) return cache[dcID];
1727
1728 const akk = `dc${dcID}_auth_key`;
1729 const ssk = `dc${dcID}_server_salt`;
1730
1731 const dcUrl = this.chooseServer(dcID, isUpload);
1732
1733 const networkGetter = result => {
1734 if (cache[dcID]) return cache[dcID];
1735
1736 const authKeyHex = result[0];
1737 let serverSaltHex = result[1];
1738 // console.log('ass', dcID, authKeyHex, serverSaltHex)
1739 if (Ln(512, authKeyHex)) {
1740 if (!serverSaltHex || serverSaltHex.length !== 16) serverSaltHex = 'AAAAAAAAAAAAAAAA';
1741 const authKey = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_11__bin__["u" /* bytesFromHex */])(authKeyHex);
1742 const serverSalt = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_11__bin__["u" /* bytesFromHex */])(serverSaltHex);
1743
1744 return cache[dcID] = new this.networkFabric(dcID, authKey, serverSalt, options);
1745 }
1746
1747 if (!options.createNetworker) return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.reject({ type: 'AUTH_KEY_EMPTY', code: 401 });
1748
1749 const onDcAuth = ({ authKey, serverSalt }) => {
1750 const storeObj = {
1751 [akk]: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_11__bin__["f" /* bytesToHex */])(authKey),
1752 [ssk]: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_11__bin__["f" /* bytesToHex */])(serverSalt)
1753 };
1754 this.storage.set(storeObj);
1755
1756 return cache[dcID] = new this.networkFabric(dcID, authKey, serverSalt, options);
1757 };
1758
1759 return this.auth(dcID, this.cache.auth, dcUrl).then(onDcAuth, netError);
1760 };
1761
1762 return this.storage.get(akk, ssk).then(networkGetter);
1763 };
1764
1765 this.mtpClearStorage = function () {
1766 const saveKeys = [];
1767 for (let dcID = 1; dcID <= 5; dcID++) {
1768 saveKeys.push(`dc${dcID}_auth_key`);
1769 saveKeys.push(`t_dc${dcID}_auth_key`);
1770 }
1771 this.storage.noPrefix(); //TODO Remove noPrefix
1772 return this.storage.get(saveKeys).tap(this.storage.clear).then(values => {
1773 const restoreObj = {};
1774 saveKeys.forEach((key, i) => {
1775 const value = values[i];
1776 if (value !== false && value !== undefined) restoreObj[key] = value;
1777 });
1778 this.storage.noPrefix();
1779 return restoreObj;
1780 }).then(this.storage.set);
1781 };
1782
1783 this.storage = storage;
1784 this.serverConfig = server;
1785 this.debug = debug;
1786 this.schema = schema;
1787 this.mtSchema = mtSchema;
1788 this.chooseServer = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_8__dc_configurator__["chooseServer"])(this.cache.servers, server);
1789 this.mtpInvokeApi = this.mtpInvokeApi.bind(this);
1790 this.setUserAuth = this.setUserAuth.bind(this);
1791
1792 this.TL = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__tl__["a" /* default */])(schema, mtSchema);
1793 this.keyManager = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_10__rsa_keys_manger__["a" /* default */])(this.TL.Serialization);
1794 this.auth = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__authorizer__["a" /* default */])(this.TL, this.keyManager);
1795 this.apiConfig = Object.assign({}, ApiManager.apiConfig, withoutNil(api));
1796 this.networkFabric = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__networker__["default"])(this.apiConfig, this.chooseServer, this.TL, storage, this.emit, debug);
1797
1798 // return new Proxy(this, {
1799 // get(ctx, name) {
1800 // const result = Reflect.get(ctx, name)
1801 // console.info('get', name, type(result))
1802 // return result
1803 // }
1804 // })
1805 }
1806
1807 mtpInvokeApi(method, params, options = {}) {
1808 // const self = this
1809 const deferred = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__defer__["b" /* default */])();
1810 const rejectPromise = error => {
1811 if (!error) error = { type: 'ERROR_EMPTY' };else if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2_ramda__["is"])(Object, error)) error = { message: error };
1812 deferred.reject(error);
1813
1814 if (!options.noErrorBox) {
1815 //TODO weird code. `error` changed after `.reject`?
1816 error.input = method;
1817 error.stack = stack || hasPath(['originalError', 'stack'], error) || error.stack || new Error().stack;
1818 this.emit('error.invoke', error);
1819 }
1820 };
1821 let dcID, cachedNetworker;
1822
1823 const cachedNetThunk = () => performRequest(cachedNetworker);
1824 const requestThunk = waitTime => setTimeout(cachedNetThunk, waitTime * 1e3);
1825
1826 const defError = new Error();
1827 const stack = defError.stack || 'empty stack';
1828 const performRequest = networker => (cachedNetworker = networker).wrapApiCall(method, params, options).then(deferred.resolve, error => {
1829 const deferResolve = deferred.resolve;
1830 const apiSavedNet = () => cachedNetworker = networker;
1831 const apiRecall = networker => networker.wrapApiCall(method, params, options);
1832 console.error(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__time_manager__["dTime"])(), 'Error', error.code, error.type, baseDcID, dcID);
1833
1834 return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_12__error_cases__["a" /* switchErrors */])(error, options, dcID, baseDcID)(error, options, dcID, this.emit, rejectPromise, requestThunk, apiSavedNet, apiRecall, deferResolve, this.mtpInvokeApi, this.mtpGetNetworker, this.storage);
1835 });
1836 const getDcNetworker = (baseDcID = 2) => this.mtpGetNetworker(dcID = defDc(baseDcID), options);
1837
1838 dcID = options.dcID || baseDcID;
1839 if (dcID) __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.resolve(this.mtpGetNetworker(dcID, options)).then(performRequest).catch(rejectPromise);else this.storage.get('dc').then(getDcNetworker).then(performRequest).catch(rejectPromise);
1840
1841 return deferred.promise;
1842 }
1843 setUserAuth(dcID, userAuth) {
1844 const fullUserAuth = Object.assign({ dcID }, userAuth);
1845 this.storage.set({
1846 dc: dcID,
1847 user_auth: fullUserAuth
1848 });
1849 this.emit('auth.dc', { dc: dcID, auth: userAuth });
1850 }
1851}
1852/* harmony export (immutable) */ __webpack_exports__["a"] = ApiManager;
1853
1854
1855ApiManager.apiConfig = {
1856 invokeWithLayer: 0xda9b0d0d,
1857 layer: 57,
1858 initConnection: 0x69796de9,
1859 api_id: 49631,
1860 device_model: 'Unknown UserAgent',
1861 system_version: 'Unknown Platform',
1862 app_version: '1.0.1',
1863 lang_code: 'en'
1864};
1865const netError = error => {
1866 console.log('Get networker error', error, error.stack);
1867 return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.reject(error);
1868};
1869
1870/***/ }),
1871/* 13 */
1872/***/ (function(module, exports, __webpack_require__) {
1873
1874/* WEBPACK VAR INJECTION */(function(global) {module.exports = false;
1875
1876// Only Node.JS has a process variable that is of [[Class]] process
1877try {
1878 module.exports = Object.prototype.toString.call(global.process) === '[object process]'
1879} catch(e) {}
1880
1881/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18)))
1882
1883/***/ }),
1884/* 14 */
1885/***/ (function(module, __webpack_exports__, __webpack_require__) {
1886
1887"use strict";
1888/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_ramda__ = __webpack_require__(0);
1889/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_ramda___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_ramda__);
1890
1891
1892const indexedMap = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["addIndex"])(__WEBPACK_IMPORTED_MODULE_0_ramda__["map"]);
1893const forEach = (data, func) => __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["pipe"])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["reject"])(__WEBPACK_IMPORTED_MODULE_0_ramda__["isNil"]), __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["ifElse"])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["is"])(Array), indexedMap(func), __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["mapObjIndexed"])(func)))(data);
1894/* harmony export (immutable) */ __webpack_exports__["a"] = forEach;
1895
1896
1897/* harmony default export */ __webpack_exports__["b"] = forEach;
1898
1899/***/ }),
1900/* 15 */
1901/***/ (function(module, __webpack_exports__, __webpack_require__) {
1902
1903"use strict";
1904Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
1905/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_ramda__ = __webpack_require__(0);
1906/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_ramda___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_ramda__);
1907
1908
1909const sslSubdomains = ['pluto', 'venus', 'aurora', 'vesta', 'flora'];
1910
1911const devDC = [{ id: 1, host: '149.154.175.10', port: 80 }, { id: 2, host: '149.154.167.40', port: 80 }, { id: 3, host: '149.154.175.117', port: 80 }];
1912
1913const prodDC = [{ id: 1, host: '149.154.175.50', port: 80 }, { id: 2, host: '149.154.167.51', port: 80 }, { id: 3, host: '149.154.175.100', port: 80 }, { id: 4, host: '149.154.167.91', port: 80 }, { id: 5, host: '149.154.171.5', port: 80 }];
1914
1915const portString = ({ port = 80 }) => port === 80 ? '' : `:${port}`;
1916
1917const findById = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["pipe"])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["propEq"])('id'), __WEBPACK_IMPORTED_MODULE_0_ramda__["find"]);
1918
1919const chooseServer = (chosenServers, {
1920 dev = false,
1921 webogram = false,
1922 dcList = dev ? devDC : prodDC
1923} = {}) => (dcID, upload = false) => {
1924 const choosen = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["prop"])(dcID);
1925 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["has"])(dcID, chosenServers)) return choosen(chosenServers);
1926 let chosenServer = false;
1927
1928 if (webogram) {
1929 const subdomain = sslSubdomains[dcID - 1] + (upload ? '-1' : '');
1930 const path = dev ? 'apiw_test1' : 'apiw1';
1931 chosenServer = `https://${subdomain}.web.telegram.org/${path}`;
1932 return chosenServer; //TODO Possibly bug. Isn't it necessary? chosenServers[dcID] = chosenServer
1933 }
1934 const dcOption = findById(dcID)(dcList);
1935 if (dcOption) chosenServer = `http://${dcOption.host}${portString(dcOption)}/apiw1`;
1936 chosenServers[dcID] = chosenServer;
1937
1938 return choosen(chosenServers);
1939};
1940/* harmony export (immutable) */ __webpack_exports__["chooseServer"] = chooseServer;
1941
1942
1943/***/ }),
1944/* 16 */
1945/***/ (function(module, __webpack_exports__, __webpack_require__) {
1946
1947"use strict";
1948Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
1949/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird__ = __webpack_require__(1);
1950/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_bluebird__);
1951/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ramda__ = __webpack_require__(0);
1952/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ramda___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_ramda__);
1953/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__crypto__ = __webpack_require__(9);
1954/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__time_manager__ = __webpack_require__(5);
1955/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__secure_random__ = __webpack_require__(7);
1956/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__for_each__ = __webpack_require__(14);
1957/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__smart_timeout__ = __webpack_require__(8);
1958/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__defer__ = __webpack_require__(4);
1959/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__http__ = __webpack_require__(10);
1960/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__bin__ = __webpack_require__(2);
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975let updatesProcessor;
1976let iii = 0;
1977let offlineInited = false;
1978let akStopped = false;
1979// const chromeMatches = navigator.userAgent.match(/Chrome\/(\d+(\.\d+)?)/)
1980// const chromeVersion = chromeMatches && parseFloat(chromeMatches[1]) || false
1981// const xhrSendBuffer = !('ArrayBufferView' in window) && (!chromeVersion || chromeVersion < 30)
1982
1983
1984const NetworkerFabric = (appConfig, chooseServer, { Serialization, Deserialization }, storage, emit, debug) => {
1985 var _class, _temp, _initialiseProps;
1986
1987 return _temp = _class = class NetworkerThread {
1988 constructor(dc, authKey, serverSalt, options = {}) {
1989 _initialiseProps.call(this);
1990
1991 this.dcID = dc;
1992 this.iii = iii++;
1993
1994 this.authKey = authKey;
1995 this.authKeyUint8 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["b" /* convertToUint8Array */])(authKey);
1996 this.authKeyBuffer = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["c" /* convertToArrayBuffer */])(authKey);
1997 this.authKeyID = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["d" /* sha1BytesSync */])(authKey).slice(-8);
1998
1999 this.serverSalt = serverSalt;
2000
2001 this.upload = options.fileUpload || options.fileDownload || false;
2002
2003 this.updateSession();
2004
2005 this.lastServerMessages = [];
2006
2007 this.currentRequests = 0;
2008 this.checkConnectionPeriod = 0;
2009
2010 this.sentMessages = {};
2011 this.clientMessages = [];
2012
2013 this.pendingMessages = {};
2014 this.pendingAcks = [];
2015 this.pendingResends = [];
2016 this.connectionInited = false;
2017
2018 this.pendingTimeouts = [];
2019
2020 setInterval(this.checkLongPoll, 10000);
2021 this.checkLongPoll();
2022
2023 if (!offlineInited) offlineInited = true;
2024 }
2025 updateSession() {
2026 this.seqNo = 0;
2027 this.prevSessionID = this.sessionID;
2028 this.sessionID = new Array(8);
2029 __WEBPACK_IMPORTED_MODULE_4__secure_random__["a" /* default */].nextBytes(this.sessionID);
2030 }
2031
2032 updateSentMessage(sentMessageID) {
2033 const sentMessage = this.sentMessages[sentMessageID];
2034 if (!sentMessage) return false;
2035
2036 if (sentMessage.container) {
2037 const newInner = [];
2038 const updateInner = innerSentMessageID => {
2039 const innerSentMessage = this.updateSentMessage(innerSentMessageID);
2040 if (innerSentMessage) newInner.push(innerSentMessage.msg_id);
2041 };
2042 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__for_each__["b" /* default */])(sentMessage.inner, updateInner);
2043 sentMessage.inner = newInner;
2044 }
2045
2046 sentMessage.msg_id = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["generateID"])();
2047 sentMessage.seq_no = this.generateSeqNo(sentMessage.notContentRelated || sentMessage.container);
2048 this.sentMessages[sentMessage.msg_id] = sentMessage;
2049 delete this.sentMessages[sentMessageID];
2050
2051 return sentMessage;
2052 }
2053
2054 generateSeqNo(notContentRelated) {
2055 let seqNo = this.seqNo * 2;
2056
2057 if (!notContentRelated) {
2058 seqNo++;
2059 this.seqNo++;
2060 }
2061
2062 return seqNo;
2063 }
2064
2065 wrapMtpCall(method, params, options) {
2066 const serializer = new Serialization({ mtproto: true });
2067
2068 serializer.storeMethod(method, params);
2069
2070 const messageID = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["generateID"])();
2071 const seqNo = this.generateSeqNo();
2072 const message = {
2073 msg_id: messageID,
2074 seq_no: seqNo,
2075 body: serializer.getBytes()
2076 };
2077
2078 if (debug) console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'MT call', method, params, messageID, seqNo);
2079
2080 return this.pushMessage(message, options);
2081 }
2082
2083 wrapMtpMessage(object, options = {}) {
2084
2085 const serializer = new Serialization({ mtproto: true });
2086 serializer.storeObject(object, 'Object');
2087
2088 const messageID = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["generateID"])();
2089 const seqNo = this.generateSeqNo(options.notContentRelated);
2090 const message = {
2091 msg_id: messageID,
2092 seq_no: seqNo,
2093 body: serializer.getBytes()
2094 };
2095
2096 if (debug) console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'MT message', object, messageID, seqNo);
2097
2098 return this.pushMessage(message, options);
2099 }
2100
2101 wrapApiCall(method, params, options) {
2102 const serializer = new Serialization(options);
2103
2104 if (!this.connectionInited) {
2105 // serializer.storeInt(0xda9b0d0d, 'invokeWithLayer')
2106 // serializer.storeInt(Config.Schema.API.layer, 'layer')
2107 // serializer.storeInt(0x69796de9, 'initConnection')
2108 // serializer.storeInt(Config.App.id, 'api_id')
2109 // serializer.storeString(navigator.userAgent || 'Unknown UserAgent', 'device_model')
2110 // serializer.storeString(navigator.platform || 'Unknown Platform', 'system_version')
2111 // serializer.storeString(Config.App.version, 'app_version')
2112 // serializer.storeString(navigator.language || 'en', 'lang_code')
2113 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["mapObjIndexed"])(serializer.storeIntString, appConfig);
2114 }
2115
2116 if (options.afterMessageID) {
2117 serializer.storeInt(0xcb9f372d, 'invokeAfterMsg');
2118 serializer.storeLong(options.afterMessageID, 'msg_id');
2119 }
2120
2121 options.resultType = serializer.storeMethod(method, params);
2122
2123 const messageID = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["generateID"])();
2124 const seqNo = this.generateSeqNo();
2125 const message = {
2126 msg_id: messageID,
2127 seq_no: seqNo,
2128 body: serializer.getBytes(true),
2129 isAPI: true
2130 };
2131
2132 if (debug) console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Api call', method, params, messageID, seqNo, options);else console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Api call', method);
2133
2134 return this.pushMessage(message, options);
2135 }
2136
2137 pushMessage(message, options = {}) {
2138 const deferred = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__defer__["b" /* default */])();
2139
2140 this.sentMessages[message.msg_id] = Object.assign({}, message, options, { deferred });
2141 this.pendingMessages[message.msg_id] = 0;
2142
2143 if (!options || !options.noShedule) this.sheduleRequest();
2144 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["is"])(Object, options)) options.messageID = message.msg_id;
2145
2146 return deferred.promise;
2147 }
2148
2149 pushResend(messageID, delay) {
2150 const value = delay ? __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["tsNow"])() + delay : 0;
2151 const innerMap = innerMsg => this.pendingMessages[innerMsg] = value;
2152 const sentMessage = this.sentMessages[messageID];
2153 if (sentMessage.container) sentMessage.inner.forEach(innerMap);else this.pendingMessages[messageID] = value;
2154
2155 // console.log('Resend due', messageID, this.pendingMessages)
2156
2157 this.sheduleRequest(delay);
2158 }
2159
2160 getMsgKeyIv(msgKey, isOut) {
2161 const authKey = this.authKeyUint8;
2162 const x = isOut ? 0 : 8;
2163 const sha1aText = new Uint8Array(48);
2164 const sha1bText = new Uint8Array(48);
2165 const sha1cText = new Uint8Array(48);
2166 const sha1dText = new Uint8Array(48);
2167 const promises = {};
2168
2169 sha1aText.set(msgKey, 0);
2170 sha1aText.set(authKey.subarray(x, x + 32), 16);
2171 promises.sha1a = __WEBPACK_IMPORTED_MODULE_2__crypto__["b" /* default */].sha1Hash(sha1aText);
2172
2173 sha1bText.set(authKey.subarray(x + 32, x + 48), 0);
2174 sha1bText.set(msgKey, 16);
2175 sha1bText.set(authKey.subarray(x + 48, x + 64), 32);
2176 promises.sha1b = __WEBPACK_IMPORTED_MODULE_2__crypto__["b" /* default */].sha1Hash(sha1bText);
2177
2178 sha1cText.set(authKey.subarray(x + 64, x + 96), 0);
2179 sha1cText.set(msgKey, 32);
2180 promises.sha1c = __WEBPACK_IMPORTED_MODULE_2__crypto__["b" /* default */].sha1Hash(sha1cText);
2181
2182 sha1dText.set(msgKey, 0);
2183 sha1dText.set(authKey.subarray(x + 96, x + 128), 16);
2184 promises.sha1d = __WEBPACK_IMPORTED_MODULE_2__crypto__["b" /* default */].sha1Hash(sha1dText);
2185
2186 const onAll = result => {
2187 const aesKey = new Uint8Array(32),
2188 aesIv = new Uint8Array(32),
2189 sha1a = new Uint8Array(result[0]),
2190 sha1b = new Uint8Array(result[1]),
2191 sha1c = new Uint8Array(result[2]),
2192 sha1d = new Uint8Array(result[3]);
2193
2194 aesKey.set(sha1a.subarray(0, 8));
2195 aesKey.set(sha1b.subarray(8, 20), 8);
2196 aesKey.set(sha1c.subarray(4, 16), 20);
2197
2198 aesIv.set(sha1a.subarray(8, 20));
2199 aesIv.set(sha1b.subarray(0, 8), 12);
2200 aesIv.set(sha1c.subarray(16, 20), 20);
2201 aesIv.set(sha1d.subarray(0, 8), 24);
2202
2203 return [aesKey, aesIv];
2204 };
2205
2206 return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.all(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["values"])(promises)).then(onAll);
2207 }
2208
2209 toggleOffline(enabled) {
2210 // console.log('toggle ', enabled, this.dcID, this.iii)
2211 if (this.offline !== undefined && this.offline == enabled) return false;
2212
2213 this.offline = enabled;
2214
2215 if (this.offline) {
2216 __WEBPACK_IMPORTED_MODULE_6__smart_timeout__["b" /* default */].cancel(this.nextReqPromise);
2217 delete this.nextReq;
2218
2219 if (this.checkConnectionPeriod < 1.5) this.checkConnectionPeriod = 0;
2220
2221 this.checkConnectionPromise = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__smart_timeout__["b" /* default */])(this.checkConnection, parseInt(this.checkConnectionPeriod * 1000));
2222 this.checkConnectionPeriod = Math.min(30, (1 + this.checkConnectionPeriod) * 1.5);
2223
2224 this.onOnlineCb = this.checkConnection;
2225 emit('net.offline', this.onOnlineCb);
2226 } else {
2227 delete this.longPollPending;
2228 this.checkLongPoll();
2229 this.sheduleRequest();
2230
2231 if (this.onOnlineCb) emit('net.online', this.onOnlineCb);
2232
2233 __WEBPACK_IMPORTED_MODULE_6__smart_timeout__["b" /* default */].cancel(this.checkConnectionPromise);
2234 }
2235 }
2236
2237
2238 getEncryptedMessage(bytes) {
2239 let msgKey;
2240 const f1 = __WEBPACK_IMPORTED_MODULE_2__crypto__["b" /* default */].sha1Hash;
2241 const f2 = bytesHash => {
2242 msgKey = new Uint8Array(bytesHash).subarray(4, 20);
2243 return this.getMsgKeyIv(msgKey, true);
2244 };
2245 const f3 = keyIv => __WEBPACK_IMPORTED_MODULE_2__crypto__["b" /* default */].aesEncrypt(bytes, keyIv[0], keyIv[1]);
2246 const f4 = encryptedBytes => ({
2247 bytes: encryptedBytes,
2248 msgKey
2249 });
2250 const encryptFlow = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["pipeP"])(f1, f2, f3, f4);
2251 return encryptFlow(bytes);
2252 }
2253
2254 getDecryptedMessage(msgKey, encryptedData) {
2255 const getKeyCurry = key => this.getMsgKeyIv(key, false);
2256 const cryptoAesCurry = keyIv => __WEBPACK_IMPORTED_MODULE_2__crypto__["b" /* default */].aesDecrypt(encryptedData, keyIv[0], keyIv[1]);
2257 const decryptFlow = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["pipeP"])(getKeyCurry, cryptoAesCurry);
2258 return decryptFlow(msgKey);
2259 }
2260
2261 parseResponse(responseBuffer) {
2262 // console.log(dTime(), 'Start parsing response')
2263 // const self = this
2264
2265 const deserializer = new Deserialization(responseBuffer);
2266
2267 const authKeyID = deserializer.fetchIntBytes(64, false, 'auth_key_id');
2268 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["e" /* bytesCmp */])(authKeyID, this.authKeyID)) {
2269 throw new Error(`[MT] Invalid server auth_key_id: ${__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["f" /* bytesToHex */])(authKeyID)}`);
2270 }
2271 const msgKey = deserializer.fetchIntBytes(128, true, 'msg_key');
2272 const encryptedData = deserializer.fetchRawBytes(responseBuffer.byteLength - deserializer.getOffset(), true, 'encrypted_data');
2273
2274 const afterDecrypt = dataWithPadding => {
2275 // console.log(dTime(), 'after decrypt')
2276 const deserializer = new Deserialization(dataWithPadding, { mtproto: true });
2277
2278 const salt = deserializer.fetchIntBytes(64, false, 'salt');
2279 const sessionID = deserializer.fetchIntBytes(64, false, 'session_id');
2280 const messageID = deserializer.fetchLong('message_id');
2281
2282 const isInvalidSession = !__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["e" /* bytesCmp */])(sessionID, this.sessionID) && (!this.prevSessionID || !__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["e" /* bytesCmp */])(sessionID, this.prevSessionID));
2283 if (isInvalidSession) {
2284 console.warn('Sessions', sessionID, this.sessionID, this.prevSessionID);
2285 throw new Error(`[MT] Invalid server session_id: ${__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["f" /* bytesToHex */])(sessionID)}`);
2286 }
2287
2288 const seqNo = deserializer.fetchInt('seq_no');
2289
2290 let offset = deserializer.getOffset();
2291 const totalLength = dataWithPadding.byteLength;
2292
2293 const messageBodyLength = deserializer.fetchInt('message_data[length]');
2294 if (messageBodyLength % 4 || messageBodyLength > totalLength - offset) {
2295 throw new Error(`[MT] Invalid body length: ${messageBodyLength}`);
2296 }
2297 const messageBody = deserializer.fetchRawBytes(messageBodyLength, true, 'message_data');
2298
2299 offset = deserializer.getOffset();
2300 const paddingLength = totalLength - offset;
2301 if (paddingLength < 0 || paddingLength > 15) throw new Error(`[MT] Invalid padding length: ${paddingLength}`);
2302 const hashData = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["b" /* convertToUint8Array */])(dataWithPadding).subarray(0, offset);
2303
2304 const afterShaHash = dataHash => {
2305 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["e" /* bytesCmp */])(msgKey, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["g" /* bytesFromArrayBuffer */])(dataHash).slice(-16))) {
2306 console.warn(msgKey, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["g" /* bytesFromArrayBuffer */])(dataHash));
2307 throw new Error('[MT] server msgKey mismatch');
2308 }
2309
2310 const buffer = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["h" /* bytesToArrayBuffer */])(messageBody);
2311 const deserializerOptions = getDeserializeOpts(this.getMsgById);
2312 const deserializer = new Deserialization(buffer, deserializerOptions);
2313 const response = deserializer.fetchObject('', 'INPUT');
2314
2315 return {
2316 response,
2317 messageID,
2318 sessionID,
2319 seqNo
2320 };
2321 };
2322 return __WEBPACK_IMPORTED_MODULE_2__crypto__["b" /* default */].sha1Hash(hashData).then(afterShaHash);
2323 };
2324
2325 return this.getDecryptedMessage(msgKey, encryptedData).then(afterDecrypt);
2326 }
2327
2328 applyServerSalt(newServerSalt) {
2329 const serverSalt = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["i" /* longToBytes */])(newServerSalt);
2330
2331 const storeObj = {
2332 [`dc${this.dcID}_server_salt`]: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["f" /* bytesToHex */])(serverSalt)
2333 };
2334 storage.set(storeObj);
2335
2336 this.serverSalt = serverSalt;
2337 return true;
2338 }
2339
2340 sheduleRequest(delay = 0) {
2341 if (this.offline) this.checkConnection('forced shedule');
2342 const nextReq = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["tsNow"])() + delay;
2343
2344 if (delay && this.nextReq && this.nextReq <= nextReq) return false;
2345
2346 // console.log(dTime(), 'shedule req', delay)
2347 // console.trace()
2348 __WEBPACK_IMPORTED_MODULE_6__smart_timeout__["b" /* default */].cancel(this.nextReqPromise);
2349 if (delay > 0) this.nextReqPromise = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__smart_timeout__["b" /* default */])(this.performSheduledRequest, delay);else __WEBPACK_IMPORTED_MODULE_6__smart_timeout__["b" /* default */].immediate(this.performSheduledRequest);
2350
2351 this.nextReq = nextReq;
2352 }
2353
2354 ackMessage(msgID) {
2355 // console.log('ack message', msgID)
2356 this.pendingAcks.push(msgID);
2357 this.sheduleRequest(30000);
2358 }
2359
2360 reqResendMessage(msgID) {
2361 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Req resend', msgID);
2362 this.pendingResends.push(msgID);
2363 this.sheduleRequest(100);
2364 }
2365
2366 cleanupSent() {
2367 let notEmpty = false;
2368 // console.log('clean start', this.dcID/*, this.sentMessages*/)
2369 const cleanMessages = (message, msgID) => {
2370 // console.log('clean iter', msgID, message)
2371 if (message.notContentRelated && this.pendingMessages[msgID] === undefined) {
2372 // console.log('clean notContentRelated', msgID)
2373 delete this.sentMessages[msgID];
2374 } else if (message.container) {
2375 for (let i = 0; i < message.inner.length; i++) {
2376 if (this.sentMessages[message.inner[i]] !== undefined) {
2377 // console.log('clean failed, found', msgID, message.inner[i], this.sentMessages[message.inner[i]].seq_no)
2378 notEmpty = true;
2379 return;
2380 }
2381 }
2382 // console.log('clean container', msgID)
2383 delete this.sentMessages[msgID];
2384 } else {
2385 notEmpty = true;
2386 }
2387 };
2388 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__for_each__["b" /* default */])(this.sentMessages, cleanMessages);
2389
2390 return !notEmpty;
2391 }
2392
2393 processError(rawError) {
2394 const matches = (rawError.error_message || '').match(/^([A-Z_0-9]+\b)(: (.+))?/) || [];
2395 rawError.error_code = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["j" /* uintToInt */])(rawError.error_code);
2396
2397 return {
2398 code: !rawError.error_code || rawError.error_code <= 0 ? 500 : rawError.error_code,
2399 type: matches[1] || 'UNKNOWN',
2400 description: matches[3] || `CODE#${rawError.error_code} ${rawError.error_message}`,
2401 originalError: rawError
2402 };
2403 }
2404
2405 processMessage(message, messageID, sessionID) {
2406 const msgidInt = parseInt(messageID.toString(10).substr(0, -10), 10);
2407 if (msgidInt % 2) {
2408 console.warn('[MT] Server even message id: ', messageID, message);
2409 return;
2410 }
2411 // console.log('process message', message, messageID, sessionID)
2412 switch (message._) {
2413 case 'msg_container':
2414 {
2415 const len = message.messages.length;
2416 for (let i = 0; i < len; i++) {
2417 this.processMessage(message.messages[i], message.messages[i].msg_id, sessionID);
2418 }
2419 break;
2420 }
2421 case 'bad_server_salt':
2422 {
2423 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Bad server salt', message);
2424 const sentMessage = this.sentMessages[message.bad_msg_id];
2425 if (!sentMessage || sentMessage.seq_no != message.bad_msg_seqno) {
2426 console.log(message.bad_msg_id, message.bad_msg_seqno);
2427 throw new Error('[MT] Bad server salt for invalid message');
2428 }
2429
2430 this.applyServerSalt(message.new_server_salt);
2431 this.pushResend(message.bad_msg_id);
2432 this.ackMessage(messageID);
2433 break;
2434 }
2435 case 'bad_msg_notification':
2436 {
2437 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Bad msg notification', message);
2438 const sentMessage = this.sentMessages[message.bad_msg_id];
2439 if (!sentMessage || sentMessage.seq_no != message.bad_msg_seqno) {
2440 console.log(message.bad_msg_id, message.bad_msg_seqno);
2441 throw new Error('[MT] Bad msg notification for invalid message');
2442 }
2443
2444 if (message.error_code == 16 || message.error_code == 17) {
2445 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["applyServerTime"])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["k" /* bigStringInt */])(messageID).shiftRight(32).toString(10))) {
2446 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Update session');
2447 this.updateSession();
2448 }
2449 const badMessage = this.updateSentMessage(message.bad_msg_id);
2450 this.pushResend(badMessage.msg_id);
2451 this.ackMessage(messageID);
2452 }
2453 break;
2454 }
2455 case 'message':
2456 {
2457 if (this.lastServerMessages.indexOf(messageID) != -1) {
2458 // console.warn('[MT] Server same messageID: ', messageID)
2459 this.ackMessage(messageID);
2460 return;
2461 }
2462 this.lastServerMessages.push(messageID);
2463 if (this.lastServerMessages.length > 100) {
2464 this.lastServerMessages.shift();
2465 }
2466 this.processMessage(message.body, message.msg_id, sessionID);
2467 break;
2468 }
2469 case 'new_session_created':
2470 {
2471 this.ackMessage(messageID);
2472
2473 this.processMessageAck(message.first_msg_id);
2474 this.applyServerSalt(message.server_salt);
2475
2476 const onBaseDc = baseDcID => {
2477 const updateCond = baseDcID === this.dcID && !this.upload && updatesProcessor;
2478 if (updateCond) updatesProcessor(message, true);
2479 };
2480 storage.get('dc').then(onBaseDc);
2481 break;
2482 }
2483 case 'msgs_ack':
2484 {
2485 message.msg_ids.forEach(this.processMessageAck);
2486 break;
2487 }
2488 case 'msg_detailed_info':
2489 {
2490 if (!this.sentMessages[message.msg_id]) {
2491 this.ackMessage(message.answer_msg_id);
2492 break;
2493 }
2494 break;
2495 }
2496 case 'msg_new_detailed_info':
2497 {
2498 // this.ackMessage(message.answer_msg_id)
2499 this.reqResendMessage(message.answer_msg_id);
2500 break;
2501 }
2502 case 'msgs_state_info':
2503 {
2504 this.ackMessage(message.answer_msg_id);
2505 const spliceCond = this.lastResendReq && this.lastResendReq.req_msg_id == message.req_msg_id && this.pendingResends.length;
2506 if (spliceCond) this.lastResendReq.resend_msg_ids.forEach(this.spliceMessage);
2507 break;
2508 }
2509 case 'rpc_result':
2510 {
2511 this.ackMessage(messageID);
2512
2513 const sentMessageID = message.req_msg_id;
2514 const sentMessage = this.sentMessages[sentMessageID];
2515
2516 this.processMessageAck(sentMessageID);
2517 if (!sentMessage) break;
2518
2519 const deferred = sentMessage.deferred;
2520 if (message.result._ == 'rpc_error') {
2521 const error = this.processError(message.result);
2522 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Rpc error', error);
2523 if (deferred) {
2524 deferred.reject(error);
2525 }
2526 } else {
2527 if (deferred) {
2528 if (debug) {
2529 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Rpc response', message.result);
2530 } else {
2531 let dRes = message.result._;
2532 if (!dRes) dRes = message.result.length > 5 ? `[..${message.result.length}..]` : message.result;
2533 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Rpc response', dRes);
2534 }
2535 sentMessage.deferred.resolve(message.result);
2536 }
2537 if (sentMessage.isAPI) this.connectionInited = true;
2538 }
2539
2540 delete this.sentMessages[sentMessageID];
2541 break;
2542 }
2543 default:
2544 {
2545 this.ackMessage(messageID);
2546
2547 // console.log('Update', message)
2548 if (updatesProcessor) updatesProcessor(message, true);
2549 break;
2550 }
2551 }
2552 }
2553 }, _initialiseProps = function () {
2554 this.checkLongPollCond = () => this.longPollPending && this.longPollPending > __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["tsNow"])() || !!this.offline || akStopped;
2555
2556 this.checkLongPollAfterDcCond = (isClean, baseDc) => isClean && (this.dcID !== baseDc || this.upload || this.sleepAfter && this.sleepAfter < __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["tsNow"])());
2557
2558 this.checkLongPoll = force => {
2559 const isClean = this.cleanupSent();
2560 // console.log('Check lp', this.longPollPending, tsNow(), this.dcID, isClean)
2561 if (this.checkLongPollCond()) return false;
2562
2563 const afterGetDc = baseDc => {
2564 if (this.checkLongPollAfterDcCond(isClean, baseDc))
2565 // console.warn(dTime(), 'Send long-poll for DC is delayed', this.dcID, this.sleepAfter)
2566 return;
2567
2568 return this.sendLongPoll();
2569 };
2570
2571 storage.get('dc').then(afterGetDc);
2572 };
2573
2574 this.onHttpWait = () => {
2575 delete this.longPollPending;
2576 return __WEBPACK_IMPORTED_MODULE_6__smart_timeout__["b" /* default */].immediate(this.checkLongPoll);
2577 };
2578
2579 this.sendLongPoll = () => {
2580 const maxWait = 25000;
2581 this.longPollPending = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["tsNow"])() + maxWait;
2582 // console.log('Set lp', this.longPollPending, tsNow())
2583
2584 return this.wrapMtpCall('http_wait', {
2585 max_delay: 500,
2586 wait_after: 150,
2587 max_wait: maxWait
2588 }, {
2589 noResponse: true,
2590 longPoll: true
2591 }).then(this.onHttpWait, () => {
2592 console.log('Long-poll failed');
2593 });
2594 };
2595
2596 this.checkConnection = event => {
2597 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Check connection', event);
2598 __WEBPACK_IMPORTED_MODULE_6__smart_timeout__["b" /* default */].cancel(this.checkConnectionPromise);
2599
2600 const serializer = new Serialization({ mtproto: true });
2601 const pingID = [__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["l" /* nextRandomInt */])(0xFFFFFFFF), __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["l" /* nextRandomInt */])(0xFFFFFFFF)];
2602
2603 serializer.storeMethod('ping', { ping_id: pingID });
2604
2605 const pingMessage = {
2606 msg_id: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["generateID"])(),
2607 seq_no: this.generateSeqNo(true),
2608 body: serializer.getBytes()
2609 };
2610
2611 this.sendEncryptedRequest(pingMessage, { timeout: 15000 }).then(result => this.toggleOffline(false), () => {
2612 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Delay ', this.checkConnectionPeriod * 1000);
2613 this.checkConnectionPromise = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__smart_timeout__["b" /* default */])(this.checkConnection, parseInt(this.checkConnectionPeriod * 1000));
2614 this.checkConnectionPeriod = Math.min(60, this.checkConnectionPeriod * 1.5);
2615 });
2616 };
2617
2618 this.onNoResponseMsg = msgID => {
2619 if (this.sentMessages[msgID]) {
2620 const deferred = this.sentMessages[msgID].deferred;
2621 delete this.sentMessages[msgID];
2622 return deferred.resolve();
2623 }
2624 };
2625
2626 this.onNoResponseMsgReject = msgID => {
2627 if (this.sentMessages[msgID]) {
2628 const deferred = this.sentMessages[msgID].deferred;
2629 delete this.sentMessages[msgID];
2630 delete this.pendingMessages[msgID];
2631 return deferred.reject();
2632 }
2633 };
2634
2635 this.resetPendingMessage = msgID => this.pendingMessages[msgID] = 0;
2636
2637 this.performSheduledRequest = () => {
2638 //TODO extract huge method
2639 // console.log(dTime(), 'sheduled', this.dcID, this.iii)
2640 if (this.offline || akStopped) {
2641 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Cancel sheduled');
2642 return false;
2643 }
2644 delete this.nextReq;
2645 if (this.pendingAcks.length) {
2646 const ackMsgIDs = [];
2647 for (let i = 0; i < this.pendingAcks.length; i++) {
2648 ackMsgIDs.push(this.pendingAcks[i]);
2649 }
2650 // console.log('acking messages', ackMsgIDs)
2651 this.wrapMtpMessage({ _: 'msgs_ack', msg_ids: ackMsgIDs }, { notContentRelated: true, noShedule: true });
2652 }
2653
2654 if (this.pendingResends.length) {
2655 const resendMsgIDs = [];
2656 const resendOpts = { noShedule: true, notContentRelated: true };
2657 for (let i = 0; i < this.pendingResends.length; i++) {
2658 resendMsgIDs.push(this.pendingResends[i]);
2659 }
2660 // console.log('resendReq messages', resendMsgIDs)
2661 this.wrapMtpMessage({ _: 'msg_resend_req', msg_ids: resendMsgIDs }, resendOpts);
2662 this.lastResendReq = { req_msg_id: resendOpts.messageID, resend_msg_ids: resendMsgIDs };
2663 }
2664
2665 const messages = [];
2666 let message,
2667 messagesByteLen = 0;
2668 const currentTime = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["tsNow"])();
2669 let hasApiCall = false;
2670 let hasHttpWait = false;
2671 let lengthOverflow = false;
2672 let singlesCount = 0;
2673
2674 const onPendingMessage = (value, messageID) => {
2675 if (!(!value || value >= currentTime)) return;
2676 message = this.sentMessages[messageID];
2677 if (message) {
2678 const messageByteLength = (message.body.byteLength || message.body.length) + 32;
2679 const cond1 = !message.notContentRelated && lengthOverflow;
2680 const cond2 = !message.notContentRelated && messagesByteLen && messagesByteLen + messageByteLength > 655360; // 640 Kb
2681 if (cond1) return;
2682 if (cond2) {
2683 lengthOverflow = true;
2684 return;
2685 }
2686 if (message.singleInRequest) {
2687 singlesCount++;
2688 if (singlesCount > 1) return;
2689 }
2690 messages.push(message);
2691 messagesByteLen += messageByteLength;
2692 if (message.isAPI) hasApiCall = true;else if (message.longPoll) hasHttpWait = true;
2693 } else {
2694 // console.log(message, messageID)
2695 }
2696 delete this.pendingMessages[messageID];
2697 };
2698
2699 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__for_each__["b" /* default */])(this.pendingMessages, onPendingMessage);
2700
2701 if (hasApiCall && !hasHttpWait) {
2702 const serializer = new Serialization({ mtproto: true });
2703 serializer.storeMethod('http_wait', {
2704 max_delay: 500,
2705 wait_after: 150,
2706 max_wait: 3000
2707 });
2708 messages.push({
2709 msg_id: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["generateID"])(),
2710 seq_no: this.generateSeqNo(),
2711 body: serializer.getBytes()
2712 });
2713 }
2714
2715 if (!messages.length) {
2716 // console.log('no sheduled messages')
2717 return;
2718 }
2719
2720 const noResponseMsgs = [];
2721
2722 if (messages.length > 1) {
2723 const container = new Serialization({ mtproto: true, startMaxLength: messagesByteLen + 64 });
2724 container.storeInt(0x73f1f8dc, 'CONTAINER[id]');
2725 container.storeInt(messages.length, 'CONTAINER[count]');
2726 const onloads = [];
2727 const innerMessages = [];
2728 for (let i = 0; i < messages.length; i++) {
2729 container.storeLong(messages[i].msg_id, `CONTAINER[${i}][msg_id]`);
2730 innerMessages.push(messages[i].msg_id);
2731 container.storeInt(messages[i].seq_no, `CONTAINER[${i}][seq_no]`);
2732 container.storeInt(messages[i].body.length, `CONTAINER[${i}][bytes]`);
2733 container.storeRawBytes(messages[i].body, `CONTAINER[${i}][body]`);
2734 if (messages[i].noResponse) {
2735 noResponseMsgs.push(messages[i].msg_id);
2736 }
2737 }
2738
2739 const containerSentMessage = {
2740 msg_id: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["generateID"])(),
2741 seq_no: this.generateSeqNo(true),
2742 container: true,
2743 inner: innerMessages
2744 };
2745
2746 message = Object.assign({ body: container.getBytes(true) }, containerSentMessage);
2747
2748 this.sentMessages[message.msg_id] = containerSentMessage;
2749
2750 if (debug) console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Container', innerMessages, message.msg_id, message.seq_no);
2751 } else {
2752 if (message.noResponse) noResponseMsgs.push(message.msg_id);
2753 this.sentMessages[message.msg_id] = message;
2754 }
2755
2756 this.pendingAcks = [];
2757 const afterSendRequest = result => {
2758 this.toggleOffline(false);
2759 // console.log('parse for', message)
2760 this.parseResponse(result.data).then(afterResponseParse);
2761 };
2762 const afterResponseParse = response => {
2763 if (debug) console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Server response', this.dcID, response);
2764
2765 this.processMessage(response.response, response.messageID, response.sessionID);
2766
2767 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__for_each__["b" /* default */])(noResponseMsgs, this.onNoResponseMsg);
2768
2769 this.checkLongPoll();
2770
2771 this.checkConnectionPeriod = Math.max(1.1, Math.sqrt(this.checkConnectionPeriod));
2772 };
2773 const onRequestFail = error => {
2774 console.log('Encrypted request failed', error);
2775
2776 if (message.container) {
2777 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__for_each__["b" /* default */])(message.inner, this.resetPendingMessage);
2778 delete this.sentMessages[message.msg_id];
2779 } else this.pendingMessages[message.msg_id] = 0;
2780
2781 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__for_each__["b" /* default */])(noResponseMsgs, this.onNoResponseMsgReject);
2782
2783 this.toggleOffline(true);
2784 };
2785 this.sendEncryptedRequest(message).then(afterSendRequest).catch(onRequestFail);
2786
2787 if (lengthOverflow || singlesCount > 1) this.sheduleRequest();
2788 };
2789
2790 this.getRequestUrl = () => chooseServer(this.dcID, this.upload);
2791
2792 this.sendEncryptedRequest = (message, options = {}) => {
2793 // console.log(dTime(), 'Send encrypted'/*, message*/)
2794 // console.trace()
2795 const data = new Serialization({ startMaxLength: message.body.length + 64 });
2796
2797 data.storeIntBytes(this.serverSalt, 64, 'salt');
2798 data.storeIntBytes(this.sessionID, 64, 'session_id');
2799
2800 data.storeLong(message.msg_id, 'message_id');
2801 data.storeInt(message.seq_no, 'seq_no');
2802
2803 data.storeInt(message.body.length, 'message_data_length');
2804 data.storeRawBytes(message.body, 'message_data');
2805
2806 const url = this.getRequestUrl();
2807 const baseError = { code: 406, type: 'NETWORK_BAD_RESPONSE', url };
2808
2809 const afterRequestData = result => {
2810 if (!result.data || !result.data.byteLength) return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.reject(baseError);
2811 return result;
2812 };
2813
2814 const afterRequestReject = error => {
2815 if (!error.message && !error.type) error = Object.assign({ type: 'NETWORK_BAD_REQUEST', originalError: error }, baseError);
2816 return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.reject(error);
2817 };
2818
2819 const onEncryptedResult = encryptedResult => {
2820 // console.log(dTime(), 'Got encrypted out message'/*, encryptedResult*/)
2821 const request = new Serialization({ startMaxLength: encryptedResult.bytes.byteLength + 256 });
2822 request.storeIntBytes(this.authKeyID, 64, 'auth_key_id');
2823 request.storeIntBytes(encryptedResult.msgKey, 128, 'msg_key');
2824 request.storeRawBytes(encryptedResult.bytes, 'encrypted_data');
2825
2826 const requestData = /*xhrSendBuffer
2827 ? request.getBuffer()
2828 : */request.getArray();
2829
2830 try {
2831 options = Object.assign({ responseType: 'arraybuffer' }, options);
2832 return __WEBPACK_IMPORTED_MODULE_8__http__["a" /* httpClient */].post(url, requestData, options);
2833 } catch (e) {
2834 return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.reject(e);
2835 }
2836 };
2837
2838 return this.getEncryptedMessage(data.getBuffer()).then(onEncryptedResult).then(afterRequestData, afterRequestReject);
2839 };
2840
2841 this.getMsgById = ({ req_msg_id }) => this.sentMessages[req_msg_id];
2842
2843 this.processMessageAck = messageID => {
2844 const sentMessage = this.sentMessages[messageID];
2845 if (sentMessage && !sentMessage.acked) {
2846 delete sentMessage.body;
2847 sentMessage.acked = true;
2848
2849 return true;
2850 }
2851
2852 return false;
2853 };
2854
2855 this.spliceMessage = badMsgID => {
2856 const pos = this.pendingResends.indexOf(badMsgID);
2857 if (pos !== -1) this.pendingResends.splice(pos, 1);
2858 };
2859 }, _temp;
2860};
2861/* harmony export (immutable) */ __webpack_exports__["NetworkerFabric"] = NetworkerFabric;
2862
2863
2864const getDeserializeOpts = msgGetter => ({
2865 mtproto: true,
2866 override: {
2867 mt_message(result, field) {
2868 result.msg_id = this.fetchLong(`${field}[msg_id]`);
2869 result.seqno = this.fetchInt(`${field}[seqno]`);
2870 result.bytes = this.fetchInt(`${field}[bytes]`);
2871
2872 const offset = this.getOffset();
2873
2874 try {
2875 result.body = this.fetchObject('Object', `${field}[body]`);
2876 } catch (e) {
2877 console.error(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'parse error', e.message, e.stack);
2878 result.body = { _: 'parse_error', error: e };
2879 }
2880 if (this.offset != offset + result.bytes) {
2881 // console.warn(dTime(), 'set offset', this.offset, offset, result.bytes)
2882 // console.log(dTime(), result)
2883 this.offset = offset + result.bytes;
2884 }
2885 // console.log(dTime(), 'override message', result)
2886 },
2887 mt_rpc_result(result, field) {
2888 result.req_msg_id = this.fetchLong(`${field}[req_msg_id]`);
2889
2890 const sentMessage = msgGetter(result);
2891 const type = sentMessage && sentMessage.resultType || 'Object';
2892
2893 if (result.req_msg_id && !sentMessage) {
2894 // console.warn(dTime(), 'Result for unknown message', result)
2895 return;
2896 }
2897 result.result = this.fetchObject(type, `${field}[result]`);
2898 // console.log(dTime(), 'override rpc_result', sentMessage, type, result)
2899 }
2900 }
2901});
2902
2903const startAll = () => {
2904 if (akStopped) {
2905 akStopped = false;
2906 updatesProcessor({ _: 'new_session_created' }, true);
2907 }
2908};
2909/* harmony export (immutable) */ __webpack_exports__["startAll"] = startAll;
2910
2911
2912const stopAll = () => akStopped = true;
2913/* harmony export (immutable) */ __webpack_exports__["stopAll"] = stopAll;
2914
2915
2916const setUpdatesProcessor = callback => updatesProcessor = callback;
2917/* harmony export (immutable) */ __webpack_exports__["setUpdatesProcessor"] = setUpdatesProcessor;
2918
2919
2920/* harmony default export */ __webpack_exports__["default"] = NetworkerFabric;
2921
2922/***/ }),
2923/* 17 */
2924/***/ (function(module, __webpack_exports__, __webpack_require__) {
2925
2926"use strict";
2927/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return bpe; });
2928/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return one; });
2929/* harmony export (immutable) */ __webpack_exports__["h"] = powMod;
2930/* harmony export (immutable) */ __webpack_exports__["t"] = sub;
2931/* harmony export (immutable) */ __webpack_exports__["p"] = eGCD_;
2932/* harmony export (immutable) */ __webpack_exports__["n"] = greater;
2933/* harmony export (immutable) */ __webpack_exports__["d"] = divide_;
2934/* harmony export (immutable) */ __webpack_exports__["e"] = int2bigInt;
2935/* harmony export (immutable) */ __webpack_exports__["a"] = str2bigInt;
2936/* harmony export (immutable) */ __webpack_exports__["q"] = equalsInt;
2937/* harmony export (immutable) */ __webpack_exports__["l"] = isZero;
2938/* harmony export (immutable) */ __webpack_exports__["c"] = bigInt2str;
2939/* harmony export (immutable) */ __webpack_exports__["s"] = dup;
2940/* harmony export (immutable) */ __webpack_exports__["k"] = copy_;
2941/* harmony export (immutable) */ __webpack_exports__["j"] = copyInt_;
2942/* harmony export (immutable) */ __webpack_exports__["g"] = addInt_;
2943/* harmony export (immutable) */ __webpack_exports__["b"] = rightShift_;
2944/* harmony export (immutable) */ __webpack_exports__["f"] = leftShift_;
2945/* harmony export (immutable) */ __webpack_exports__["o"] = sub_;
2946/* harmony export (immutable) */ __webpack_exports__["m"] = add_;
2947////////////////////////////////////////////////////////////////////////////////////////
2948// Big Integer Library v. 5.5
2949// Created 2000, last modified 2013
2950// Leemon Baird
2951// www.leemon.com
2952//
2953// Version history:
2954// v 5.5 17 Mar 2013
2955// - two lines of a form like "if (x<0) x+=n" had the "if" changed to "while" to
2956// handle the case when x<-n. (Thanks to James Ansell for finding that bug)
2957// v 5.4 3 Oct 2009
2958// - added "var i" to greaterShift() so i is not global. (Thanks to PŽter Szab— for finding that bug)
2959//
2960// v 5.3 21 Sep 2009
2961// - added randProbPrime(k) for probable primes
2962// - unrolled loop in mont_ (slightly faster)
2963// - millerRabin now takes a bigInt parameter rather than an int
2964//
2965// v 5.2 15 Sep 2009
2966// - fixed capitalization in call to int2bigInt in randBigInt
2967// (thanks to Emili Evripidou, Reinhold Behringer, and Samuel Macaleese for finding that bug)
2968//
2969// v 5.1 8 Oct 2007
2970// - renamed inverseModInt_ to inverseModInt since it doesn't change its parameters
2971// - added functions GCD and randBigInt, which call GCD_ and randBigInt_
2972// - fixed a bug found by Rob Visser (see comment with his name below)
2973// - improved comments
2974//
2975// This file is public domain. You can use it for any purpose without restriction.
2976// I do not guarantee that it is correct, so use it at your own risk. If you use
2977// it for something interesting, I'd appreciate hearing about it. If you find
2978// any bugs or make any improvements, I'd appreciate hearing about those too.
2979// It would also be nice if my name and URL were left in the comments. But none
2980// of that is required.
2981//
2982// This code defines a bigInt library for arbitrary-precision integers.
2983// A bigInt is an array of integers storing the value in chunks of bpe bits,
2984// little endian (buff[0] is the least significant word).
2985// Negative bigInts are stored two's complement. Almost all the functions treat
2986// bigInts as nonnegative. The few that view them as two's complement say so
2987// in their comments. Some functions assume their parameters have at least one
2988// leading zero element. Functions with an underscore at the end of the name put
2989// their answer into one of the arrays passed in, and have unpredictable behavior
2990// in case of overflow, so the caller must make sure the arrays are big enough to
2991// hold the answer. But the average user should never have to call any of the
2992// underscored functions. Each important underscored function has a wrapper function
2993// of the same name without the underscore that takes care of the details for you.
2994// For each underscored function where a parameter is modified, that same variable
2995// must not be used as another argument too. So, you cannot square x by doing
2996// multMod_(x,x,n). You must use squareMod_(x,n) instead, or do y=dup(x); multMod_(x,y,n).
2997// Or simply use the multMod(x,x,n) function without the underscore, where
2998// such issues never arise, because non-underscored functions never change
2999// their parameters; they always allocate new memory for the answer that is returned.
3000//
3001// These functions are designed to avoid frequent dynamic memory allocation in the inner loop.
3002// For most functions, if it needs a BigInt as a local variable it will actually use
3003// a global, and will only allocate to it only when it's not the right size. This ensures
3004// that when a function is called repeatedly with same-sized parameters, it only allocates
3005// memory on the first call.
3006//
3007// Note that for cryptographic purposes, the calls to Math.random() must
3008// be replaced with calls to a better pseudorandom number generator.
3009//
3010// In the following, "bigInt" means a bigInt with at least one leading zero element,
3011// and "integer" means a nonnegative integer less than radix. In some cases, integer
3012// can be negative. Negative bigInts are 2s complement.
3013//
3014// The following functions do not modify their inputs.
3015// Those returning a bigInt, string, or Array will dynamically allocate memory for that value.
3016// Those returning a boolean will return the integer 0 (false) or 1 (true).
3017// Those returning boolean or int will not allocate memory except possibly on the first
3018// time they're called with a given parameter size.
3019//
3020// bigInt add(x,y) //return (x+y) for bigInts x and y.
3021// bigInt addInt(x,n) //return (x+n) where x is a bigInt and n is an integer.
3022// string bigInt2str(x,base) //return a string form of bigInt x in a given base, with 2 <= base <= 95
3023// int bitSize(x) //return how many bits long the bigInt x is, not counting leading zeros
3024// bigInt dup(x) //return a copy of bigInt x
3025// boolean equals(x,y) //is the bigInt x equal to the bigint y?
3026// boolean equalsInt(x,y) //is bigint x equal to integer y?
3027// bigInt expand(x,n) //return a copy of x with at least n elements, adding leading zeros if needed
3028// Array findPrimes(n) //return array of all primes less than integer n
3029// bigInt GCD(x,y) //return greatest common divisor of bigInts x and y (each with same number of elements).
3030// boolean greater(x,y) //is x>y? (x and y are nonnegative bigInts)
3031// boolean greaterShift(x,y,shift)//is (x <<(shift*bpe)) > y?
3032// bigInt int2bigInt(t,n,m) //return a bigInt equal to integer t, with at least n bits and m array elements
3033// bigInt inverseMod(x,n) //return (x**(-1) mod n) for bigInts x and n. If no inverse exists, it returns null
3034// int inverseModInt(x,n) //return x**(-1) mod n, for integers x and n. Return 0 if there is no inverse
3035// boolean isZero(x) //is the bigInt x equal to zero?
3036// boolean millerRabin(x,b) //does one round of Miller-Rabin base integer b say that bigInt x is possibly prime? (b is bigInt, 1<b<x)
3037// boolean millerRabinInt(x,b) //does one round of Miller-Rabin base integer b say that bigInt x is possibly prime? (b is int, 1<b<x)
3038// bigInt mod(x,n) //return a new bigInt equal to (x mod n) for bigInts x and n.
3039// int modInt(x,n) //return x mod n for bigInt x and integer n.
3040// bigInt mult(x,y) //return x*y for bigInts x and y. This is faster when y<x.
3041// bigInt multMod(x,y,n) //return (x*y mod n) for bigInts x,y,n. For greater speed, let y<x.
3042// boolean negative(x) //is bigInt x negative?
3043// bigInt powMod(x,y,n) //return (x**y mod n) where x,y,n are bigInts and ** is exponentiation. 0**0=1. Faster for odd n.
3044// bigInt randBigInt(n,s) //return an n-bit random BigInt (n>=1). If s=1, then the most significant of those n bits is set to 1.
3045// bigInt randTruePrime(k) //return a new, random, k-bit, true prime bigInt using Maurer's algorithm.
3046// bigInt randProbPrime(k) //return a new, random, k-bit, probable prime bigInt (probability it's composite less than 2^-80).
3047// bigInt str2bigInt(s,b,n,m) //return a bigInt for number represented in string s in base b with at least n bits and m array elements
3048// bigInt sub(x,y) //return (x-y) for bigInts x and y. Negative answers will be 2s complement
3049// bigInt trim(x,k) //return a copy of x with exactly k leading zero elements
3050//
3051//
3052// The following functions each have a non-underscored version, which most users should call instead.
3053// These functions each write to a single parameter, and the caller is responsible for ensuring the array
3054// passed in is large enough to hold the result.
3055//
3056// void addInt_(x,n) //do x=x+n where x is a bigInt and n is an integer
3057// void add_(x,y) //do x=x+y for bigInts x and y
3058// void copy_(x,y) //do x=y on bigInts x and y
3059// void copyInt_(x,n) //do x=n on bigInt x and integer n
3060// void GCD_(x,y) //set x to the greatest common divisor of bigInts x and y, (y is destroyed). (This never overflows its array).
3061// boolean inverseMod_(x,n) //do x=x**(-1) mod n, for bigInts x and n. Returns 1 (0) if inverse does (doesn't) exist
3062// void mod_(x,n) //do x=x mod n for bigInts x and n. (This never overflows its array).
3063// void mult_(x,y) //do x=x*y for bigInts x and y.
3064// void multMod_(x,y,n) //do x=x*y mod n for bigInts x,y,n.
3065// void powMod_(x,y,n) //do x=x**y mod n, where x,y,n are bigInts (n is odd) and ** is exponentiation. 0**0=1.
3066// void randBigInt_(b,n,s) //do b = an n-bit random BigInt. if s=1, then nth bit (most significant bit) is set to 1. n>=1.
3067// void randTruePrime_(ans,k) //do ans = a random k-bit true random prime (not just probable prime) with 1 in the msb.
3068// void sub_(x,y) //do x=x-y for bigInts x and y. Negative answers will be 2s complement.
3069//
3070// The following functions do NOT have a non-underscored version.
3071// They each write a bigInt result to one or more parameters. The caller is responsible for
3072// ensuring the arrays passed in are large enough to hold the results.
3073//
3074// void addShift_(x,y,ys) //do x=x+(y<<(ys*bpe))
3075// void carry_(x) //do carries and borrows so each element of the bigInt x fits in bpe bits.
3076// void divide_(x,y,q,r) //divide x by y giving quotient q and remainder r
3077// int divInt_(x,n) //do x=floor(x/n) for bigInt x and integer n, and return the remainder. (This never overflows its array).
3078// int eGCD_(x,y,d,a,b) //sets a,b,d to positive bigInts such that d = GCD_(x,y) = a*x-b*y
3079// void halve_(x) //do x=floor(|x|/2)*sgn(x) for bigInt x in 2's complement. (This never overflows its array).
3080// void leftShift_(x,n) //left shift bigInt x by n bits. n<bpe.
3081// void linComb_(x,y,a,b) //do x=a*x+b*y for bigInts x and y and integers a and b
3082// void linCombShift_(x,y,b,ys) //do x=x+b*(y<<(ys*bpe)) for bigInts x and y, and integers b and ys
3083// void mont_(x,y,n,np) //Montgomery multiplication (see comments where the function is defined)
3084// void multInt_(x,n) //do x=x*n where x is a bigInt and n is an integer.
3085// void rightShift_(x,n) //right shift bigInt x by n bits. 0 <= n < bpe. (This never overflows its array).
3086// void squareMod_(x,n) //do x=x*x mod n for bigInts x,n
3087// void subShift_(x,y,ys) //do x=x-(y<<(ys*bpe)). Negative answers will be 2s complement.
3088//
3089// The following functions are based on algorithms from the _Handbook of Applied Cryptography_
3090// powMod_() = algorithm 14.94, Montgomery exponentiation
3091// eGCD_,inverseMod_() = algorithm 14.61, Binary extended GCD_
3092// GCD_() = algorothm 14.57, Lehmer's algorithm
3093// mont_() = algorithm 14.36, Montgomery multiplication
3094// divide_() = algorithm 14.20 Multiple-precision division
3095// squareMod_() = algorithm 14.16 Multiple-precision squaring
3096// randTruePrime_() = algorithm 4.62, Maurer's algorithm
3097// millerRabin() = algorithm 4.24, Miller-Rabin algorithm
3098//
3099// Profiling shows:
3100// randTruePrime_() spends:
3101// 10% of its time in calls to powMod_()
3102// 85% of its time in calls to millerRabin()
3103// millerRabin() spends:
3104// 99% of its time in calls to powMod_() (always with a base of 2)
3105// powMod_() spends:
3106// 94% of its time in calls to mont_() (almost always with x==y)
3107//
3108// This suggests there are several ways to speed up this library slightly:
3109// - convert powMod_ to use a Montgomery form of k-ary window (or maybe a Montgomery form of sliding window)
3110// -- this should especially focus on being fast when raising 2 to a power mod n
3111// - convert randTruePrime_() to use a minimum r of 1/3 instead of 1/2 with the appropriate change to the test
3112// - tune the parameters in randTruePrime_(), including c, m, and recLimit
3113// - speed up the single loop in mont_() that takes 95% of the runtime, perhaps by reducing checking
3114// within the loop when all the parameters are the same length.
3115//
3116// There are several ideas that look like they wouldn't help much at all:
3117// - replacing trial division in randTruePrime_() with a sieve (that speeds up something taking almost no time anyway)
3118// - increase bpe from 15 to 30 (that would help if we had a 32*32->64 multiplier, but not with JavaScript's 32*32->32)
3119// - speeding up mont_(x,y,n,np) when x==y by doing a non-modular, non-Montgomery square
3120// followed by a Montgomery reduction. The intermediate answer will be twice as long as x, so that
3121// method would be slower. This is unfortunate because the code currently spends almost all of its time
3122// doing mont_(x,x,...), both for randTruePrime_() and powMod_(). A faster method for Montgomery squaring
3123// would have a large impact on the speed of randTruePrime_() and powMod_(). HAC has a couple of poorly-worded
3124// sentences that seem to imply it's faster to do a non-modular square followed by a single
3125// Montgomery reduction, but that's obviously wrong.
3126////////////////////////////////////////////////////////////////////////////////////////
3127
3128//globals
3129var bpe = 0; //bits stored per array element
3130var mask = 0; //AND this with an array element to chop it down to bpe bits
3131var radix = mask + 1; //equals 2^bpe. A single 1 bit to the left of the last bit of mask.
3132
3133//the digits for converting to different bases
3134var digitsStr = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_=!@#$%^&*()[]{}|;:,.<>/?`~ \\\'\"+-';
3135
3136//initialize the global variables
3137for (bpe = 0; 1 << bpe + 1 > 1 << bpe; bpe++); //bpe=number of bits in the mantissa on this platform
3138bpe >>= 1; //bpe=number of bits in one element of the array representing the bigInt
3139mask = (1 << bpe) - 1; //AND the mask with an integer to get its bpe least significant bits
3140radix = mask + 1; //2^bpe. a single 1 bit to the left of the first bit of mask
3141var one = int2bigInt(1, 1, 1); //constant used in powMod_()
3142
3143//the following global variables are scratchpad memory to
3144//reduce dynamic memory allocation in the inner loop
3145var t = new Array(0);
3146var ss = t; //used in mult_()
3147var s0 = t; //used in multMod_(), squareMod_()
3148// var s1=t; //used in powMod_(), multMod_(), squareMod_()
3149// var s2=t; //used in powMod_(), multMod_()
3150var s3 = t; //used in powMod_()
3151var s4 = t,
3152 s5 = t; //used in mod_()
3153var s6 = t; //used in bigInt2str()
3154var s7 = t; //used in powMod_()
3155var T = t; //used in GCD_()
3156var sa = t; //used in mont_()
3157var mr_x1 = t,
3158 mr_r = t,
3159 mr_a = t,
3160 //used in millerRabin()
3161eg_v = t,
3162 eg_u = t,
3163 eg_A = t,
3164 eg_B = t,
3165 eg_C = t,
3166 eg_D = t //used in eGCD_(), inverseMod_()
3167//, md_q1=t, md_q2=t, md_q3=t, md_r=t, md_r1=t, md_r2=t, md_tt=t, //used in mod_()
3168
3169,
3170 primes = t,
3171 pows = t,
3172 s_i = t,
3173 s_i2 = t,
3174 s_R = t,
3175 s_rm = t,
3176 s_q = t,
3177 s_n1 = t,
3178 s_a = t,
3179 s_r2 = t,
3180 s_n = t,
3181 s_b = t,
3182 s_d = t,
3183 s_x1 = t,
3184 s_x2 = t,
3185 s_aa = t,
3186 //used in randTruePrime_()
3187
3188rpprb = t; //used in randProbPrimeRounds() (which also uses "primes")
3189
3190////////////////////////////////////////////////////////////////////////////////////////
3191
3192var k, buff;
3193
3194//return array of all primes less than integer n
3195function findPrimes(n) {
3196 var i, s, p, ans;
3197 s = new Array(n);
3198 for (i = 0; i < n; i++) s[i] = 0;
3199 s[0] = 2;
3200 p = 0; //first p elements of s are primes, the rest are a sieve
3201 for (; s[p] < n;) {
3202 //s[p] is the pth prime
3203 for (i = s[p] * s[p]; i < n; i += s[p]) //mark multiples of s[p]
3204 s[i] = 1;
3205 p++;
3206 s[p] = s[p - 1] + 1;
3207 for (; s[p] < n && s[s[p]]; s[p]++); //find next prime (where s[p]==0)
3208 }
3209 ans = new Array(p);
3210 for (i = 0; i < p; i++) ans[i] = s[i];
3211 return ans;
3212}
3213
3214//does a single round of Miller-Rabin base b consider x to be a possible prime?
3215//x is a bigInt, and b is an integer, with b<x
3216function millerRabinInt(x, b) {
3217 if (mr_x1.length != x.length) {
3218 mr_x1 = dup(x);
3219 mr_r = dup(x);
3220 mr_a = dup(x);
3221 }
3222
3223 copyInt_(mr_a, b);
3224 return millerRabin(x, mr_a);
3225}
3226
3227//does a single round of Miller-Rabin base b consider x to be a possible prime?
3228//x and b are bigInts with b<x
3229function millerRabin(x, b) {
3230 var i, j, k, s;
3231
3232 if (mr_x1.length != x.length) {
3233 mr_x1 = dup(x);
3234 mr_r = dup(x);
3235 mr_a = dup(x);
3236 }
3237
3238 copy_(mr_a, b);
3239 copy_(mr_r, x);
3240 copy_(mr_x1, x);
3241
3242 addInt_(mr_r, -1);
3243 addInt_(mr_x1, -1);
3244
3245 //s=the highest power of two that divides mr_r
3246 k = 0;
3247 for (i = 0; i < mr_r.length; i++) for (j = 1; j < mask; j <<= 1) if (x[i] & j) {
3248 s = k < mr_r.length + bpe ? k : 0;
3249 i = mr_r.length;
3250 j = mask;
3251 } else k++;
3252
3253 if (s) rightShift_(mr_r, s);
3254
3255 powMod_(mr_a, mr_r, x);
3256
3257 if (!equalsInt(mr_a, 1) && !equals(mr_a, mr_x1)) {
3258 j = 1;
3259 while (j <= s - 1 && !equals(mr_a, mr_x1)) {
3260 squareMod_(mr_a, x);
3261 if (equalsInt(mr_a, 1)) {
3262 return 0;
3263 }
3264 j++;
3265 }
3266 if (!equals(mr_a, mr_x1)) {
3267 return 0;
3268 }
3269 }
3270 return 1;
3271}
3272
3273//returns how many bits long the bigInt is, not counting leading zeros.
3274function bitSize(x) {
3275 var j, z, w;
3276 for (j = x.length - 1; x[j] == 0 && j > 0; j--);
3277 for (z = 0, w = x[j]; w; w >>= 1, z++);
3278 z += bpe * j;
3279 return z;
3280}
3281
3282//return a copy of x with at least n elements, adding leading zeros if needed
3283function expand(x, n) {
3284 var ans = int2bigInt(0, (x.length > n ? x.length : n) * bpe, 0);
3285 copy_(ans, x);
3286 return ans;
3287}
3288
3289//return a k-bit true random prime using Maurer's algorithm.
3290function randTruePrime(k) {
3291 var ans = int2bigInt(0, k, 0);
3292 randTruePrime_(ans, k);
3293 return trim(ans, 1);
3294}
3295
3296//return a k-bit random probable prime with probability of error < 2^-80
3297function randProbPrime(k) {
3298 if (k >= 600) return randProbPrimeRounds(k, 2); //numbers from HAC table 4.3
3299 if (k >= 550) return randProbPrimeRounds(k, 4);
3300 if (k >= 500) return randProbPrimeRounds(k, 5);
3301 if (k >= 400) return randProbPrimeRounds(k, 6);
3302 if (k >= 350) return randProbPrimeRounds(k, 7);
3303 if (k >= 300) return randProbPrimeRounds(k, 9);
3304 if (k >= 250) return randProbPrimeRounds(k, 12); //numbers from HAC table 4.4
3305 if (k >= 200) return randProbPrimeRounds(k, 15);
3306 if (k >= 150) return randProbPrimeRounds(k, 18);
3307 if (k >= 100) return randProbPrimeRounds(k, 27);
3308 return randProbPrimeRounds(k, 40); //number from HAC remark 4.26 (only an estimate)
3309}
3310
3311//return a k-bit probable random prime using n rounds of Miller Rabin (after trial division with small primes)
3312function randProbPrimeRounds(k, n) {
3313 var ans, i, divisible, B;
3314 B = 30000; //B is largest prime to use in trial division
3315 ans = int2bigInt(0, k, 0);
3316
3317 //optimization: try larger and smaller B to find the best limit.
3318
3319 if (primes.length == 0) primes = findPrimes(30000); //check for divisibility by primes <=30000
3320
3321 if (rpprb.length != ans.length) rpprb = dup(ans);
3322
3323 for (;;) {
3324 //keep trying random values for ans until one appears to be prime
3325 //optimization: pick a random number times L=2*3*5*...*p, plus a
3326 // random element of the list of all numbers in [0,L) not divisible by any prime up to p.
3327 // This can reduce the amount of random number generation.
3328
3329 randBigInt_(ans, k, 0); //ans = a random odd number to check
3330 ans[0] |= 1;
3331 divisible = 0;
3332
3333 //check ans for divisibility by small primes up to B
3334 for (i = 0; i < primes.length && primes[i] <= B; i++) if (modInt(ans, primes[i]) == 0 && !equalsInt(ans, primes[i])) {
3335 divisible = 1;
3336 break;
3337 }
3338
3339 //optimization: change millerRabin so the base can be bigger than the number being checked, then eliminate the while here.
3340
3341 //do n rounds of Miller Rabin, with random bases less than ans
3342 for (i = 0; i < n && !divisible; i++) {
3343 randBigInt_(rpprb, k, 0);
3344 while (!greater(ans, rpprb)) //pick a random rpprb that's < ans
3345 randBigInt_(rpprb, k, 0);
3346 if (!millerRabin(ans, rpprb)) divisible = 1;
3347 }
3348
3349 if (!divisible) return ans;
3350 }
3351}
3352
3353//return a new bigInt equal to (x mod n) for bigInts x and n.
3354function mod(x, n) {
3355 var ans = dup(x);
3356 mod_(ans, n);
3357 return trim(ans, 1);
3358}
3359
3360//return (x+n) where x is a bigInt and n is an integer.
3361function addInt(x, n) {
3362 var ans = expand(x, x.length + 1);
3363 addInt_(ans, n);
3364 return trim(ans, 1);
3365}
3366
3367//return x*y for bigInts x and y. This is faster when y<x.
3368function mult(x, y) {
3369 var ans = expand(x, x.length + y.length);
3370 mult_(ans, y);
3371 return trim(ans, 1);
3372}
3373
3374//return (x**y mod n) where x,y,n are bigInts and ** is exponentiation. 0**0=1. Faster for odd n.
3375function powMod(x, y, n) {
3376 var ans = expand(x, n.length);
3377 powMod_(ans, trim(y, 2), trim(n, 2), 0); //this should work without the trim, but doesn't
3378 return trim(ans, 1);
3379}
3380
3381//return (x-y) for bigInts x and y. Negative answers will be 2s complement
3382function sub(x, y) {
3383 var ans = expand(x, x.length > y.length ? x.length + 1 : y.length + 1);
3384 sub_(ans, y);
3385 return trim(ans, 1);
3386}
3387
3388//return (x+y) for bigInts x and y.
3389function add(x, y) {
3390 var ans = expand(x, x.length > y.length ? x.length + 1 : y.length + 1);
3391 add_(ans, y);
3392 return trim(ans, 1);
3393}
3394
3395//return (x**(-1) mod n) for bigInts x and n. If no inverse exists, it returns null
3396function inverseMod(x, n) {
3397 var ans = expand(x, n.length);
3398 var s;
3399 s = inverseMod_(ans, n);
3400 return s ? trim(ans, 1) : null;
3401}
3402
3403//return (x*y mod n) for bigInts x,y,n. For greater speed, let y<x.
3404function multMod(x, y, n) {
3405 var ans = expand(x, n.length);
3406 multMod_(ans, y, n);
3407 return trim(ans, 1);
3408}
3409
3410//generate a k-bit true random prime using Maurer's algorithm,
3411//and put it into ans. The bigInt ans must be large enough to hold it.
3412function randTruePrime_(ans, k) {
3413 var c, m, pm, dd, j, r, B, divisible, z, zz, recSize;
3414 var w;
3415 if (primes.length == 0) primes = findPrimes(30000); //check for divisibility by primes <=30000
3416
3417 if (pows.length == 0) {
3418 pows = new Array(512);
3419 for (j = 0; j < 512; j++) {
3420 pows[j] = Math.pow(2, j / 511. - 1.);
3421 }
3422 }
3423
3424 //c and m should be tuned for a particular machine and value of k, to maximize speed
3425 c = 0.1; //c=0.1 in HAC
3426 m = 20; //generate this k-bit number by first recursively generating a number that has between k/2 and k-m bits
3427 var recLimit = 20; //stop recursion when k <=recLimit. Must have recLimit >= 2
3428
3429 if (s_i2.length != ans.length) {
3430 s_i2 = dup(ans);
3431 s_R = dup(ans);
3432 s_n1 = dup(ans);
3433 s_r2 = dup(ans);
3434 s_d = dup(ans);
3435 s_x1 = dup(ans); //TODO Seems like a bug in eslint, reports as unused
3436 s_x2 = dup(ans);
3437 s_b = dup(ans);
3438 s_n = dup(ans);
3439 s_i = dup(ans);
3440 s_rm = dup(ans);
3441 s_q = dup(ans);
3442 s_a = dup(ans);
3443 s_aa = dup(ans);
3444 }
3445
3446 if (k <= recLimit) {
3447 //generate small random primes by trial division up to its square root
3448 pm = (1 << (k + 2 >> 1)) - 1; //pm is binary number with all ones, just over sqrt(2^k)
3449 copyInt_(ans, 0);
3450 for (dd = 1; dd;) {
3451 dd = 0;
3452 ans[0] = 1 | 1 << k - 1 | Math.floor(Math.random() * (1 << k)); //random, k-bit, odd integer, with msb 1
3453 for (j = 1; j < primes.length && (primes[j] & pm) == primes[j]; j++) {
3454 //trial division by all primes 3...sqrt(2^k)
3455 if (0 == ans[0] % primes[j]) {
3456 dd = 1;
3457 break;
3458 }
3459 }
3460 }
3461 carry_(ans);
3462 return;
3463 }
3464
3465 B = c * k * k; //try small primes up to B (or all the primes[] array if the largest is less than B).
3466 if (k > 2 * m) //generate this k-bit number by first recursively generating a number that has between k/2 and k-m bits
3467 for (r = 1; k - k * r <= m;) r = pows[Math.floor(Math.random() * 512)]; //r=Math.pow(2,Math.random()-1);
3468 else r = .5;
3469
3470 //simulation suggests the more complex algorithm using r=.333 is only slightly faster.
3471
3472 recSize = Math.floor(r * k) + 1;
3473
3474 randTruePrime_(s_q, recSize);
3475 copyInt_(s_i2, 0);
3476 s_i2[Math.floor((k - 2) / bpe)] |= 1 << (k - 2) % bpe; //s_i2=2^(k-2)
3477 divide_(s_i2, s_q, s_i, s_rm); //s_i=floor((2^(k-1))/(2q))
3478
3479 z = bitSize(s_i);
3480
3481 for (;;) {
3482 for (;;) {
3483 //generate z-bit numbers until one falls in the range [0,s_i-1]
3484 randBigInt_(s_R, z, 0);
3485 if (greater(s_i, s_R)) break;
3486 } //now s_R is in the range [0,s_i-1]
3487 addInt_(s_R, 1); //now s_R is in the range [1,s_i]
3488 add_(s_R, s_i); //now s_R is in the range [s_i+1,2*s_i]
3489
3490 copy_(s_n, s_q);
3491 mult_(s_n, s_R);
3492 multInt_(s_n, 2);
3493 addInt_(s_n, 1); //s_n=2*s_R*s_q+1
3494
3495 copy_(s_r2, s_R);
3496 multInt_(s_r2, 2); //s_r2=2*s_R
3497
3498 //check s_n for divisibility by small primes up to B
3499 for (divisible = 0, j = 0; j < primes.length && primes[j] < B; j++) if (modInt(s_n, primes[j]) == 0 && !equalsInt(s_n, primes[j])) {
3500 divisible = 1;
3501 break;
3502 }
3503
3504 if (!divisible) //if it passes small primes check, then try a single Miller-Rabin base 2
3505 if (!millerRabinInt(s_n, 2)) //this line represents 75% of the total runtime for randTruePrime_
3506 divisible = 1;
3507
3508 if (!divisible) {
3509 //if it passes that test, continue checking s_n
3510 addInt_(s_n, -3);
3511 for (j = s_n.length - 1; s_n[j] == 0 && j > 0; j--); //strip leading zeros
3512 for (zz = 0, w = s_n[j]; w; w >>= 1, zz++);
3513 zz += bpe * j; //zz=number of bits in s_n, ignoring leading zeros
3514 for (;;) {
3515 //generate z-bit numbers until one falls in the range [0,s_n-1]
3516 randBigInt_(s_a, zz, 0);
3517 if (greater(s_n, s_a)) break;
3518 } //now s_a is in the range [0,s_n-1]
3519 addInt_(s_n, 3); //now s_a is in the range [0,s_n-4]
3520 addInt_(s_a, 2); //now s_a is in the range [2,s_n-2]
3521 copy_(s_b, s_a);
3522 copy_(s_n1, s_n);
3523 addInt_(s_n1, -1);
3524 powMod_(s_b, s_n1, s_n); //s_b=s_a^(s_n-1) modulo s_n
3525 addInt_(s_b, -1);
3526 if (isZero(s_b)) {
3527 copy_(s_b, s_a);
3528 powMod_(s_b, s_r2, s_n);
3529 addInt_(s_b, -1);
3530 copy_(s_aa, s_n);
3531 copy_(s_d, s_b);
3532 GCD_(s_d, s_n); //if s_b and s_n are relatively prime, then s_n is a prime
3533 if (equalsInt(s_d, 1)) {
3534 copy_(ans, s_aa);
3535 return; //if we've made it this far, then s_n is absolutely guaranteed to be prime
3536 }
3537 }
3538 }
3539 }
3540}
3541
3542//Return an n-bit random BigInt (n>=1). If s=1, then the most significant of those n bits is set to 1.
3543function randBigInt(n, s) {
3544 var a, b;
3545 a = Math.floor((n - 1) / bpe) + 2; //# array elements to hold the BigInt with a leading 0 element
3546 b = int2bigInt(0, 0, a);
3547 randBigInt_(b, n, s);
3548 return b;
3549}
3550
3551//Set b to an n-bit random BigInt. If s=1, then the most significant of those n bits is set to 1.
3552//Array b must be big enough to hold the result. Must have n>=1
3553function randBigInt_(b, n, s) {
3554 var i, a;
3555 for (i = 0; i < b.length; i++) b[i] = 0;
3556 a = Math.floor((n - 1) / bpe) + 1; //# array elements to hold the BigInt
3557 for (i = 0; i < a; i++) {
3558 b[i] = Math.floor(Math.random() * (1 << bpe - 1));
3559 }
3560 b[a - 1] &= (2 << (n - 1) % bpe) - 1;
3561 if (s == 1) b[a - 1] |= 1 << (n - 1) % bpe;
3562}
3563
3564//Return the greatest common divisor of bigInts x and y (each with same number of elements).
3565function GCD(x, y) {
3566 var xc, yc;
3567 xc = dup(x);
3568 yc = dup(y);
3569 GCD_(xc, yc);
3570 return xc;
3571}
3572
3573//set x to the greatest common divisor of bigInts x and y (each with same number of elements).
3574//y is destroyed.
3575function GCD_(x, y) {
3576 var i, xp, yp, A, B, C, D, q, sing;
3577 var qp;
3578 if (T.length != x.length) T = dup(x);
3579
3580 sing = 1;
3581 while (sing) {
3582 //while y has nonzero elements other than y[0]
3583 sing = 0;
3584 for (i = 1; i < y.length; i++) //check if y has nonzero elements other than 0
3585 if (y[i]) {
3586 sing = 1;
3587 break;
3588 }
3589 if (!sing) break; //quit when y all zero elements except possibly y[0]
3590
3591 for (i = x.length; !x[i] && i >= 0; i--); //find most significant element of x
3592 xp = x[i];
3593 yp = y[i];
3594 A = 1;B = 0;C = 0;D = 1;
3595 while (yp + C && yp + D) {
3596 q = Math.floor((xp + A) / (yp + C));
3597 qp = Math.floor((xp + B) / (yp + D));
3598 if (q != qp) break;
3599 t = A - q * C;A = C;C = t; // do (A,B,xp, C,D,yp) = (C,D,yp, A,B,xp) - q*(0,0,0, C,D,yp)
3600 t = B - q * D;B = D;D = t;
3601 t = xp - q * yp;xp = yp;yp = t;
3602 }
3603 if (B) {
3604 copy_(T, x);
3605 linComb_(x, y, A, B); //x=A*x+B*y
3606 linComb_(y, T, D, C); //y=D*y+C*T
3607 } else {
3608 mod_(x, y);
3609 copy_(T, x);
3610 copy_(x, y);
3611 copy_(y, T);
3612 }
3613 }
3614 if (y[0] == 0) return;
3615 t = modInt(x, y[0]);
3616 copyInt_(x, y[0]);
3617 y[0] = t;
3618 while (y[0]) {
3619 x[0] %= y[0];
3620 t = x[0];x[0] = y[0];y[0] = t;
3621 }
3622}
3623
3624//do x=x**(-1) mod n, for bigInts x and n.
3625//If no inverse exists, it sets x to zero and returns 0, else it returns 1.
3626//The x array must be at least as large as the n array.
3627function inverseMod_(x, n) {
3628 var k = 1 + 2 * Math.max(x.length, n.length);
3629
3630 if (!(x[0] & 1) && !(n[0] & 1)) {
3631 //if both inputs are even, then inverse doesn't exist
3632 copyInt_(x, 0);
3633 return 0;
3634 }
3635
3636 if (eg_u.length != k) {
3637 eg_u = new Array(k);
3638 eg_v = new Array(k);
3639 eg_A = new Array(k);
3640 eg_B = new Array(k);
3641 eg_C = new Array(k);
3642 eg_D = new Array(k);
3643 }
3644
3645 copy_(eg_u, x);
3646 copy_(eg_v, n);
3647 copyInt_(eg_A, 1);
3648 copyInt_(eg_B, 0);
3649 copyInt_(eg_C, 0);
3650 copyInt_(eg_D, 1);
3651 for (;;) {
3652 while (!(eg_u[0] & 1)) {
3653 //while eg_u is even
3654 halve_(eg_u);
3655 if (!(eg_A[0] & 1) && !(eg_B[0] & 1)) {
3656 //if eg_A==eg_B==0 mod 2
3657 halve_(eg_A);
3658 halve_(eg_B);
3659 } else {
3660 add_(eg_A, n);halve_(eg_A);
3661 sub_(eg_B, x);halve_(eg_B);
3662 }
3663 }
3664
3665 while (!(eg_v[0] & 1)) {
3666 //while eg_v is even
3667 halve_(eg_v);
3668 if (!(eg_C[0] & 1) && !(eg_D[0] & 1)) {
3669 //if eg_C==eg_D==0 mod 2
3670 halve_(eg_C);
3671 halve_(eg_D);
3672 } else {
3673 add_(eg_C, n);halve_(eg_C);
3674 sub_(eg_D, x);halve_(eg_D);
3675 }
3676 }
3677
3678 if (!greater(eg_v, eg_u)) {
3679 //eg_v <= eg_u
3680 sub_(eg_u, eg_v);
3681 sub_(eg_A, eg_C);
3682 sub_(eg_B, eg_D);
3683 } else {
3684 //eg_v > eg_u
3685 sub_(eg_v, eg_u);
3686 sub_(eg_C, eg_A);
3687 sub_(eg_D, eg_B);
3688 }
3689
3690 if (equalsInt(eg_u, 0)) {
3691 while (negative(eg_C)) //make sure answer is nonnegative
3692 add_(eg_C, n);
3693 copy_(x, eg_C);
3694
3695 if (!equalsInt(eg_v, 1)) {
3696 //if GCD_(x,n)!=1, then there is no inverse
3697 copyInt_(x, 0);
3698 return 0;
3699 }
3700 return 1;
3701 }
3702 }
3703}
3704
3705//return x**(-1) mod n, for integers x and n. Return 0 if there is no inverse
3706function inverseModInt(x, n) {
3707 var a = 1,
3708 b = 0,
3709 t;
3710 for (;;) {
3711 if (x == 1) return a;
3712 if (x == 0) return 0;
3713 b -= a * Math.floor(n / x);
3714 n %= x;
3715
3716 if (n == 1) return b; //to avoid negatives, change this b to n-b, and each -= to +=
3717 if (n == 0) return 0;
3718 a -= b * Math.floor(x / n);
3719 x %= n;
3720 }
3721}
3722
3723//this deprecated function is for backward compatibility only.
3724function inverseModInt_(x, n) {
3725 return inverseModInt(x, n);
3726}
3727
3728//Given positive bigInts x and y, change the bigints v, a, and b to positive bigInts such that:
3729// v = GCD_(x,y) = a*x-b*y
3730//The bigInts v, a, b, must have exactly as many elements as the larger of x and y.
3731function eGCD_(x, y, v, a, b) {
3732 var g = 0;
3733 var k = Math.max(x.length, y.length);
3734 if (eg_u.length != k) {
3735 eg_u = new Array(k);
3736 eg_A = new Array(k);
3737 eg_B = new Array(k);
3738 eg_C = new Array(k);
3739 eg_D = new Array(k);
3740 }
3741 while (!(x[0] & 1) && !(y[0] & 1)) {
3742 //while x and y both even
3743 halve_(x);
3744 halve_(y);
3745 g++;
3746 }
3747 copy_(eg_u, x);
3748 copy_(v, y);
3749 copyInt_(eg_A, 1);
3750 copyInt_(eg_B, 0);
3751 copyInt_(eg_C, 0);
3752 copyInt_(eg_D, 1);
3753 for (;;) {
3754 while (!(eg_u[0] & 1)) {
3755 //while u is even
3756 halve_(eg_u);
3757 if (!(eg_A[0] & 1) && !(eg_B[0] & 1)) {
3758 //if A==B==0 mod 2
3759 halve_(eg_A);
3760 halve_(eg_B);
3761 } else {
3762 add_(eg_A, y);halve_(eg_A);
3763 sub_(eg_B, x);halve_(eg_B);
3764 }
3765 }
3766
3767 while (!(v[0] & 1)) {
3768 //while v is even
3769 halve_(v);
3770 if (!(eg_C[0] & 1) && !(eg_D[0] & 1)) {
3771 //if C==D==0 mod 2
3772 halve_(eg_C);
3773 halve_(eg_D);
3774 } else {
3775 add_(eg_C, y);halve_(eg_C);
3776 sub_(eg_D, x);halve_(eg_D);
3777 }
3778 }
3779
3780 if (!greater(v, eg_u)) {
3781 //v<=u
3782 sub_(eg_u, v);
3783 sub_(eg_A, eg_C);
3784 sub_(eg_B, eg_D);
3785 } else {
3786 //v>u
3787 sub_(v, eg_u);
3788 sub_(eg_C, eg_A);
3789 sub_(eg_D, eg_B);
3790 }
3791 if (equalsInt(eg_u, 0)) {
3792 while (negative(eg_C)) {
3793 //make sure a (C) is nonnegative
3794 add_(eg_C, y);
3795 sub_(eg_D, x);
3796 }
3797 multInt_(eg_D, -1); ///make sure b (D) is nonnegative
3798 copy_(a, eg_C);
3799 copy_(b, eg_D);
3800 leftShift_(v, g);
3801 return;
3802 }
3803 }
3804}
3805
3806//is bigInt x negative?
3807function negative(x) {
3808 return x[x.length - 1] >> bpe - 1 & 1;
3809}
3810
3811//is (x << (shift*bpe)) > y?
3812//x and y are nonnegative bigInts
3813//shift is a nonnegative integer
3814function greaterShift(x, y, shift) {
3815 var i,
3816 kx = x.length,
3817 ky = y.length;
3818 k = kx + shift < ky ? kx + shift : ky;
3819 for (i = ky - 1 - shift; i < kx && i >= 0; i++) if (x[i] > 0) return 1; //if there are nonzeros in x to the left of the first column of y, then x is bigger
3820 for (i = kx - 1 + shift; i < ky; i++) if (y[i] > 0) return 0; //if there are nonzeros in y to the left of the first column of x, then x is not bigger
3821 for (i = k - 1; i >= shift; i--) if (x[i - shift] > y[i]) return 1;else if (x[i - shift] < y[i]) return 0;
3822 return 0;
3823}
3824
3825//is x > y? (x and y both nonnegative)
3826function greater(x, y) {
3827 var i;
3828 var k = x.length < y.length ? x.length : y.length;
3829
3830 for (i = x.length; i < y.length; i++) if (y[i]) return 0; //y has more digits
3831
3832 for (i = y.length; i < x.length; i++) if (x[i]) return 1; //x has more digits
3833
3834 for (i = k - 1; i >= 0; i--) if (x[i] > y[i]) return 1;else if (x[i] < y[i]) return 0;
3835 return 0;
3836}
3837
3838//divide x by y giving quotient q and remainder r. (q=floor(x/y), r=x mod y). All 4 are bigints.
3839//x must have at least one leading zero element.
3840//y must be nonzero.
3841//q and r must be arrays that are exactly the same length as x. (Or q can have more).
3842//Must have x.length >= y.length >= 2.
3843function divide_(x, y, q, r) {
3844 var kx, ky;
3845 var i, j, y1, y2, c, a, b;
3846 copy_(r, x);
3847 for (ky = y.length; y[ky - 1] == 0; ky--); //ky is number of elements in y, not including leading zeros
3848
3849 //normalize: ensure the most significant element of y has its highest bit set
3850 b = y[ky - 1];
3851 for (a = 0; b; a++) b >>= 1;
3852 a = bpe - a; //a is how many bits to shift so that the high order bit of y is leftmost in its array element
3853 leftShift_(y, a); //multiply both by 1<<a now, then divide both by that at the end
3854 leftShift_(r, a);
3855
3856 //Rob Visser discovered a bug: the following line was originally just before the normalization.
3857 for (kx = r.length; r[kx - 1] == 0 && kx > ky; kx--); //kx is number of elements in normalized x, not including leading zeros
3858
3859 copyInt_(q, 0); // q=0
3860 while (!greaterShift(y, r, kx - ky)) {
3861 // while (leftShift_(y,kx-ky) <= r) {
3862 subShift_(r, y, kx - ky); // r=r-leftShift_(y,kx-ky)
3863 q[kx - ky]++; // q[kx-ky]++;
3864 } // }
3865
3866 for (i = kx - 1; i >= ky; i--) {
3867 if (r[i] == y[ky - 1]) q[i - ky] = mask;else q[i - ky] = Math.floor((r[i] * radix + r[i - 1]) / y[ky - 1]);
3868
3869 //The following for(;;) loop is equivalent to the commented while loop,
3870 //except that the uncommented version avoids overflow.
3871 //The commented loop comes from HAC, which assumes r[-1]==y[-1]==0
3872 // while (q[i-ky]*(y[ky-1]*radix+y[ky-2]) > r[i]*radix*radix+r[i-1]*radix+r[i-2])
3873 // q[i-ky]--;
3874 for (;;) {
3875 y2 = (ky > 1 ? y[ky - 2] : 0) * q[i - ky];
3876 c = y2 >> bpe;
3877 y2 = y2 & mask;
3878 y1 = c + q[i - ky] * y[ky - 1];
3879 c = y1 >> bpe;
3880 y1 = y1 & mask;
3881
3882 if (c == r[i] ? y1 == r[i - 1] ? y2 > (i > 1 ? r[i - 2] : 0) : y1 > r[i - 1] : c > r[i]) q[i - ky]--;else break;
3883 }
3884
3885 linCombShift_(r, y, -q[i - ky], i - ky); //r=r-q[i-ky]*leftShift_(y,i-ky)
3886 if (negative(r)) {
3887 addShift_(r, y, i - ky); //r=r+leftShift_(y,i-ky)
3888 q[i - ky]--;
3889 }
3890 }
3891
3892 rightShift_(y, a); //undo the normalization step
3893 rightShift_(r, a); //undo the normalization step
3894}
3895
3896//do carries and borrows so each element of the bigInt x fits in bpe bits.
3897function carry_(x) {
3898 var i, k, c, b;
3899 k = x.length;
3900 c = 0;
3901 for (i = 0; i < k; i++) {
3902 c += x[i];
3903 b = 0;
3904 if (c < 0) {
3905 b = -(c >> bpe);
3906 c += b * radix;
3907 }
3908 x[i] = c & mask;
3909 c = (c >> bpe) - b;
3910 }
3911}
3912
3913//return x mod n for bigInt x and integer n.
3914function modInt(x, n) {
3915 var i,
3916 c = 0;
3917 for (i = x.length - 1; i >= 0; i--) c = (c * radix + x[i]) % n;
3918 return c;
3919}
3920
3921//convert the integer t into a bigInt with at least the given number of bits.
3922//the returned array stores the bigInt in bpe-bit chunks, little endian (buff[0] is least significant word)
3923//Pad the array with leading zeros so that it has at least minSize elements.
3924//There will always be at least one leading 0 element.
3925function int2bigInt(t, bits, minSize) {
3926 var i, k;
3927 k = Math.ceil(bits / bpe) + 1;
3928 k = minSize > k ? minSize : k;
3929 var buff = new Array(k);
3930 copyInt_(buff, t);
3931 return buff;
3932}
3933
3934//return the bigInt given a string representation in a given base.
3935//Pad the array with leading zeros so that it has at least minSize elements.
3936//If base=-1, then it reads in a space-separated list of array elements in decimal.
3937//The array will always have at least one leading zero, unless base=-1.
3938function str2bigInt(s, base, minSize) {
3939 var d, i, j, x, y, kk;
3940 var k = s.length;
3941 if (base == -1) {
3942 //comma-separated list of array elements in decimal
3943 x = new Array(0);
3944 for (;;) {
3945 y = new Array(x.length + 1);
3946 for (i = 0; i < x.length; i++) y[i + 1] = x[i];
3947 y[0] = parseInt(s, 10); //TODO PERF Should we replace that with ~~ (not not)? https://jsperf.com/number-vs-parseint-vs-plus/7
3948 x = y;
3949 d = s.indexOf(',', 0);
3950 if (d < 1) break;
3951 s = s.substring(d + 1);
3952 if (s.length == 0) break;
3953 }
3954 if (x.length < minSize) {
3955 y = new Array(minSize);
3956 copy_(y, x);
3957 return y;
3958 }
3959 return x;
3960 }
3961
3962 x = int2bigInt(0, base * k, 0);
3963 for (i = 0; i < k; i++) {
3964 d = digitsStr.indexOf(s.substring(i, i + 1), 0);
3965 if (base <= 36 && d >= 36) //convert lowercase to uppercase if base<=36
3966 d -= 26;
3967 if (d >= base || d < 0) {
3968 //stop at first illegal character
3969 break;
3970 }
3971 multInt_(x, base);
3972 addInt_(x, d);
3973 }
3974
3975 for (k = x.length; k > 0 && !x[k - 1]; k--); //strip off leading zeros
3976 k = minSize > k + 1 ? minSize : k + 1;
3977 y = new Array(k);
3978 kk = k < x.length ? k : x.length;
3979 for (i = 0; i < kk; i++) y[i] = x[i];
3980 for (; i < k; i++) y[i] = 0;
3981 return y;
3982}
3983
3984//is bigint x equal to integer y?
3985//y must have less than bpe bits
3986function equalsInt(x, y) {
3987 var i;
3988 if (x[0] != y) return 0;
3989 for (i = 1; i < x.length; i++) if (x[i]) return 0;
3990 return 1;
3991}
3992
3993//are bigints x and y equal?
3994//this works even if x and y are different lengths and have arbitrarily many leading zeros
3995function equals(x, y) {
3996 var i;
3997 var k = x.length < y.length ? x.length : y.length;
3998 for (i = 0; i < k; i++) if (x[i] != y[i]) return 0;
3999 if (x.length > y.length) {
4000 for (; i < x.length; i++) if (x[i]) return 0;
4001 } else {
4002 for (; i < y.length; i++) if (y[i]) return 0;
4003 }
4004 return 1;
4005}
4006
4007//is the bigInt x equal to zero?
4008function isZero(x) {
4009 var i;
4010 for (i = 0; i < x.length; i++) if (x[i]) return 0;
4011 return 1;
4012}
4013
4014//convert a bigInt into a string in a given base, from base 2 up to base 95.
4015//Base -1 prints the contents of the array representing the number.
4016function bigInt2str(x, base) {
4017 var i,
4018 t,
4019 s = '';
4020
4021 if (s6.length != x.length) s6 = dup(x);else copy_(s6, x);
4022
4023 if (base == -1) {
4024 //return the list of array contents
4025 for (i = x.length - 1; i > 0; i--) s += x[i] + ',';
4026 s += x[0];
4027 } else {
4028 //return it in the given base
4029 while (!isZero(s6)) {
4030 t = divInt_(s6, base); //t=s6 % base; s6=floor(s6/base);
4031 s = digitsStr.substring(t, t + 1) + s;
4032 }
4033 }
4034 if (s.length == 0) s = '0';
4035 return s;
4036}
4037
4038//returns a duplicate of bigInt x
4039function dup(x) {
4040 var i;
4041 buff = new Array(x.length);
4042 copy_(buff, x);
4043 return buff;
4044}
4045
4046//do x=y on bigInts x and y. x must be an array at least as big as y (not counting the leading zeros in y).
4047function copy_(x, y) {
4048 var i;
4049 var k = x.length < y.length ? x.length : y.length;
4050 for (i = 0; i < k; i++) x[i] = y[i];
4051 for (i = k; i < x.length; i++) x[i] = 0;
4052}
4053
4054//do x=y on bigInt x and integer y.
4055function copyInt_(x, n) {
4056 var i, c;
4057 var len = x.length; //TODO .length in for loop have perfomance costs. Bench this
4058 for (c = n, i = 0; i < len; i++) {
4059 x[i] = c & mask;
4060 c >>= bpe;
4061 }
4062}
4063
4064//do x=x+n where x is a bigInt and n is an integer.
4065//x must be large enough to hold the result.
4066function addInt_(x, n) {
4067 var i, k, c, b;
4068 x[0] += n;
4069 k = x.length;
4070 c = 0;
4071 for (i = 0; i < k; i++) {
4072 c += x[i];
4073 b = 0;
4074 if (c < 0) {
4075 b = -(c >> bpe);
4076 c += b * radix;
4077 }
4078 x[i] = c & mask;
4079 c = (c >> bpe) - b;
4080 if (!c) return; //stop carrying as soon as the carry is zero
4081 }
4082}
4083
4084//right shift bigInt x by n bits. 0 <= n < bpe.
4085function rightShift_(x, n) {
4086 var i;
4087 var k = Math.floor(n / bpe);
4088 if (k) {
4089 for (i = 0; i < x.length - k; i++) //right shift x by k elements
4090 x[i] = x[i + k];
4091 for (; i < x.length; i++) x[i] = 0;
4092 n %= bpe;
4093 }
4094 for (i = 0; i < x.length - 1; i++) {
4095 x[i] = mask & (x[i + 1] << bpe - n | x[i] >> n);
4096 }
4097 x[i] >>= n;
4098}
4099
4100//do x=floor(|x|/2)*sgn(x) for bigInt x in 2's complement
4101function halve_(x) {
4102 var i;
4103 for (i = 0; i < x.length - 1; i++) {
4104 x[i] = mask & (x[i + 1] << bpe - 1 | x[i] >> 1);
4105 }
4106 x[i] = x[i] >> 1 | x[i] & radix >> 1; //most significant bit stays the same
4107}
4108
4109//left shift bigInt x by n bits.
4110function leftShift_(x, n) {
4111 var i;
4112 var k = Math.floor(n / bpe);
4113 if (k) {
4114 for (i = x.length; i >= k; i--) //left shift x by k elements
4115 x[i] = x[i - k];
4116 for (; i >= 0; i--) x[i] = 0;
4117 n %= bpe;
4118 }
4119 if (!n) return;
4120 for (i = x.length - 1; i > 0; i--) {
4121 x[i] = mask & (x[i] << n | x[i - 1] >> bpe - n);
4122 }
4123 x[i] = mask & x[i] << n;
4124}
4125
4126//do x=x*n where x is a bigInt and n is an integer.
4127//x must be large enough to hold the result.
4128function multInt_(x, n) {
4129 var i, k, c, b;
4130 if (!n) return;
4131 k = x.length;
4132 c = 0;
4133 for (i = 0; i < k; i++) {
4134 c += x[i] * n;
4135 b = 0;
4136 if (c < 0) {
4137 b = -(c >> bpe);
4138 c += b * radix;
4139 }
4140 x[i] = c & mask;
4141 c = (c >> bpe) - b;
4142 }
4143}
4144
4145//do x=floor(x/n) for bigInt x and integer n, and return the remainder
4146function divInt_(x, n) {
4147 var i,
4148 r = 0,
4149 s;
4150 for (i = x.length - 1; i >= 0; i--) {
4151 s = r * radix + x[i];
4152 x[i] = Math.floor(s / n);
4153 r = s % n;
4154 }
4155 return r;
4156}
4157
4158//do the linear combination x=a*x+b*y for bigInts x and y, and integers a and b.
4159//x must be large enough to hold the answer.
4160function linComb_(x, y, a, b) {
4161 var i, c, k, kk;
4162 k = x.length < y.length ? x.length : y.length;
4163 kk = x.length;
4164 for (c = 0, i = 0; i < k; i++) {
4165 c += a * x[i] + b * y[i];
4166 x[i] = c & mask;
4167 c >>= bpe;
4168 }
4169 for (i = k; i < kk; i++) {
4170 c += a * x[i];
4171 x[i] = c & mask;
4172 c >>= bpe;
4173 }
4174}
4175
4176//do the linear combination x=a*x+b*(y<<(ys*bpe)) for bigInts x and y, and integers a, b and ys.
4177//x must be large enough to hold the answer.
4178function linCombShift_(x, y, b, ys) {
4179 var i, c, k, kk;
4180 k = x.length < ys + y.length ? x.length : ys + y.length;
4181 kk = x.length;
4182 for (c = 0, i = ys; i < k; i++) {
4183 c += x[i] + b * y[i - ys];
4184 x[i] = c & mask;
4185 c >>= bpe;
4186 }
4187 for (i = k; c && i < kk; i++) {
4188 c += x[i];
4189 x[i] = c & mask;
4190 c >>= bpe;
4191 }
4192}
4193
4194//do x=x+(y<<(ys*bpe)) for bigInts x and y, and integers a,b and ys.
4195//x must be large enough to hold the answer.
4196function addShift_(x, y, ys) {
4197 var i, c, k, kk;
4198 k = x.length < ys + y.length ? x.length : ys + y.length;
4199 kk = x.length;
4200 for (c = 0, i = ys; i < k; i++) {
4201 c += x[i] + y[i - ys];
4202 x[i] = c & mask;
4203 c >>= bpe;
4204 }
4205 for (i = k; c && i < kk; i++) {
4206 c += x[i];
4207 x[i] = c & mask;
4208 c >>= bpe;
4209 }
4210}
4211
4212//do x=x-(y<<(ys*bpe)) for bigInts x and y, and integers a,b and ys.
4213//x must be large enough to hold the answer.
4214function subShift_(x, y, ys) {
4215 var i, c, k, kk;
4216 k = x.length < ys + y.length ? x.length : ys + y.length;
4217 kk = x.length;
4218 for (c = 0, i = ys; i < k; i++) {
4219 c += x[i] - y[i - ys];
4220 x[i] = c & mask;
4221 c >>= bpe;
4222 }
4223 for (i = k; c && i < kk; i++) {
4224 c += x[i];
4225 x[i] = c & mask;
4226 c >>= bpe;
4227 }
4228}
4229
4230//do x=x-y for bigInts x and y.
4231//x must be large enough to hold the answer.
4232//negative answers will be 2s complement
4233function sub_(x, y) {
4234 var i, c, k, kk;
4235 k = x.length < y.length ? x.length : y.length;
4236 for (c = 0, i = 0; i < k; i++) {
4237 c += x[i] - y[i];
4238 x[i] = c & mask;
4239 c >>= bpe;
4240 }
4241 for (i = k; c && i < x.length; i++) {
4242 c += x[i];
4243 x[i] = c & mask;
4244 c >>= bpe;
4245 }
4246}
4247
4248//do x=x+y for bigInts x and y.
4249//x must be large enough to hold the answer.
4250function add_(x, y) {
4251 var i, c, k, kk;
4252 k = x.length < y.length ? x.length : y.length;
4253 for (c = 0, i = 0; i < k; i++) {
4254 c += x[i] + y[i];
4255 x[i] = c & mask;
4256 c >>= bpe;
4257 }
4258 for (i = k; c && i < x.length; i++) {
4259 c += x[i];
4260 x[i] = c & mask;
4261 c >>= bpe;
4262 }
4263}
4264
4265//do x=x*y for bigInts x and y. This is faster when y<x.
4266function mult_(x, y) {
4267 var i;
4268 if (ss.length != 2 * x.length) ss = new Array(2 * x.length);
4269 copyInt_(ss, 0);
4270 for (i = 0; i < y.length; i++) if (y[i]) linCombShift_(ss, x, y[i], i); //ss=1*ss+y[i]*(x<<(i*bpe))
4271 copy_(x, ss);
4272}
4273
4274//do x=x mod n for bigInts x and n.
4275function mod_(x, n) {
4276 if (s4.length != x.length) s4 = dup(x);else copy_(s4, x);
4277 if (s5.length != x.length) s5 = dup(x);
4278 divide_(s4, n, s5, x); //x = remainder of s4 / n
4279}
4280
4281//do x=x*y mod n for bigInts x,y,n.
4282//for greater speed, let y<x.
4283function multMod_(x, y, n) {
4284 var i;
4285 if (s0.length != 2 * x.length) s0 = new Array(2 * x.length);
4286 copyInt_(s0, 0);
4287 for (i = 0; i < y.length; i++) if (y[i]) linCombShift_(s0, x, y[i], i); //s0=1*s0+y[i]*(x<<(i*bpe))
4288 mod_(s0, n);
4289 copy_(x, s0);
4290}
4291
4292//do x=x*x mod n for bigInts x,n.
4293function squareMod_(x, n) {
4294 var i, j, d, c, kx, kn, k;
4295 for (kx = x.length; kx > 0 && !x[kx - 1]; kx--); //ignore leading zeros in x
4296 k = kx > n.length ? 2 * kx : 2 * n.length; //k=# elements in the product, which is twice the elements in the larger of x and n
4297 if (s0.length != k) s0 = new Array(k);
4298 copyInt_(s0, 0);
4299 for (i = 0; i < kx; i++) {
4300 c = s0[2 * i] + x[i] * x[i];
4301 s0[2 * i] = c & mask;
4302 c >>= bpe;
4303 for (j = i + 1; j < kx; j++) {
4304 c = s0[i + j] + 2 * x[i] * x[j] + c;
4305 s0[i + j] = c & mask;
4306 c >>= bpe;
4307 }
4308 s0[i + kx] = c;
4309 }
4310 mod_(s0, n);
4311 copy_(x, s0);
4312}
4313
4314//return x with exactly k leading zero elements
4315function trim(x, k) {
4316 var i, y;
4317 for (i = x.length; i > 0 && !x[i - 1]; i--);
4318 y = new Array(i + k);
4319 copy_(y, x);
4320 return y;
4321}
4322
4323//do x=x**y mod n, where x,y,n are bigInts and ** is exponentiation. 0**0=1.
4324//this is faster when n is odd. x usually needs to have as many elements as n.
4325function powMod_(x, y, n) {
4326 var k1, k2, kn, np;
4327 if (s7.length != n.length) s7 = dup(n);
4328
4329 //for even modulus, use a simple square-and-multiply algorithm,
4330 //rather than using the more complex Montgomery algorithm.
4331 if ((n[0] & 1) == 0) {
4332 copy_(s7, x);
4333 copyInt_(x, 1);
4334 while (!equalsInt(y, 0)) {
4335 if (y[0] & 1) multMod_(x, s7, n);
4336 divInt_(y, 2);
4337 squareMod_(s7, n);
4338 }
4339 return;
4340 }
4341
4342 //calculate np from n for the Montgomery multiplications
4343 copyInt_(s7, 0);
4344 for (kn = n.length; kn > 0 && !n[kn - 1]; kn--);
4345 np = radix - inverseModInt(modInt(n, radix), radix);
4346 s7[kn] = 1;
4347 multMod_(x, s7, n); // x = x * 2**(kn*bp) mod n
4348
4349 if (s3.length != x.length) s3 = dup(x);else copy_(s3, x);
4350
4351 for (k1 = y.length - 1; k1 > 0 & !y[k1]; k1--); //k1=first nonzero element of y
4352 if (y[k1] == 0) {
4353 //anything to the 0th power is 1
4354 copyInt_(x, 1);
4355 return;
4356 }
4357 for (k2 = 1 << bpe - 1; k2 && !(y[k1] & k2); k2 >>= 1); //k2=position of first 1 bit in y[k1]
4358 for (;;) {
4359 if (!(k2 >>= 1)) {
4360 //look at next bit of y
4361 k1--;
4362 if (k1 < 0) {
4363 mont_(x, one, n, np);
4364 return;
4365 }
4366 k2 = 1 << bpe - 1;
4367 }
4368 mont_(x, x, n, np);
4369
4370 if (k2 & y[k1]) //if next bit is a 1
4371 mont_(x, s3, n, np);
4372 }
4373}
4374
4375//do x=x*y*Ri mod n for bigInts x,y,n,
4376// where Ri = 2**(-kn*bpe) mod n, and kn is the
4377// number of elements in the n array, not
4378// counting leading zeros.
4379//x array must have at least as many elemnts as the n array
4380//It's OK if x and y are the same variable.
4381//must have:
4382// x,y < n
4383// n is odd
4384// np = -(n^(-1)) mod radix
4385function mont_(x, y, n, np) {
4386 var i, j, c, ui, t, ks;
4387 var kn = n.length;
4388 var ky = y.length;
4389
4390 if (sa.length != kn) sa = new Array(kn);
4391
4392 copyInt_(sa, 0);
4393
4394 for (; kn > 0 && n[kn - 1] == 0; kn--); //ignore leading zeros of n
4395 for (; ky > 0 && y[ky - 1] == 0; ky--); //ignore leading zeros of y
4396 ks = sa.length - 1; //sa will never have more than this many nonzero elements.
4397
4398 //the following loop consumes 95% of the runtime for randTruePrime_() and powMod_() for large numbers
4399 for (i = 0; i < kn; i++) {
4400 t = sa[0] + x[i] * y[0];
4401 ui = (t & mask) * np & mask; //the inner "& mask" was needed on Safari (but not MSIE) at one time
4402 c = t + ui * n[0] >> bpe;
4403 t = x[i];
4404
4405 //do sa=(sa+x[i]*y+ui*n)/b where b=2**bpe. Loop is unrolled 5-fold for speed
4406 j = 1;
4407 for (; j < ky - 4;) {
4408 c += sa[j] + ui * n[j] + t * y[j];sa[j - 1] = c & mask;c >>= bpe;j++;
4409 c += sa[j] + ui * n[j] + t * y[j];sa[j - 1] = c & mask;c >>= bpe;j++;
4410 c += sa[j] + ui * n[j] + t * y[j];sa[j - 1] = c & mask;c >>= bpe;j++;
4411 c += sa[j] + ui * n[j] + t * y[j];sa[j - 1] = c & mask;c >>= bpe;j++;
4412 c += sa[j] + ui * n[j] + t * y[j];sa[j - 1] = c & mask;c >>= bpe;j++;
4413 }
4414 for (; j < ky;) {
4415 c += sa[j] + ui * n[j] + t * y[j];sa[j - 1] = c & mask;c >>= bpe;j++;
4416 }
4417 for (; j < kn - 4;) {
4418 c += sa[j] + ui * n[j];sa[j - 1] = c & mask;c >>= bpe;j++;
4419 c += sa[j] + ui * n[j];sa[j - 1] = c & mask;c >>= bpe;j++;
4420 c += sa[j] + ui * n[j];sa[j - 1] = c & mask;c >>= bpe;j++;
4421 c += sa[j] + ui * n[j];sa[j - 1] = c & mask;c >>= bpe;j++;
4422 c += sa[j] + ui * n[j];sa[j - 1] = c & mask;c >>= bpe;j++;
4423 }
4424 for (; j < kn;) {
4425 c += sa[j] + ui * n[j];sa[j - 1] = c & mask;c >>= bpe;j++;
4426 }
4427 for (; j < ks;) {
4428 c += sa[j];sa[j - 1] = c & mask;c >>= bpe;j++;
4429 }
4430 sa[j - 1] = c & mask;
4431 }
4432
4433 if (!greater(n, sa)) sub_(sa, n);
4434 copy_(x, sa);
4435}
4436
4437/***/ }),
4438/* 18 */
4439/***/ (function(module, exports, __webpack_require__) {
4440
4441module.exports = (__webpack_require__(6))(123);
4442
4443/***/ }),
4444/* 19 */
4445/***/ (function(module, exports, __webpack_require__) {
4446
4447module.exports = (__webpack_require__(6))(126);
4448
4449/***/ }),
4450/* 20 */
4451/***/ (function(module, exports, __webpack_require__) {
4452
4453var CryptoJS = __webpack_require__(3).CryptoJS;
4454__webpack_require__(23);
4455__webpack_require__(26);
4456__webpack_require__(24);
4457__webpack_require__(22);
4458__webpack_require__(21);
4459__webpack_require__(27);
4460var JsonFormatter = __webpack_require__(25).JsonFormatter;
4461
4462exports.CryptoJS = CryptoJS;
4463exports.JsonFormatter = JsonFormatter;
4464
4465/***/ }),
4466/* 21 */
4467/***/ (function(module, exports, __webpack_require__) {
4468
4469var CryptoJS = __webpack_require__(3).CryptoJS;
4470
4471/*
4472CryptoJS v3.1.2
4473code.google.com/p/crypto-js
4474(c) 2009-2013 by Jeff Mott. All rights reserved.
4475code.google.com/p/crypto-js/wiki/License
4476*/
4477(function () {
4478 // Shortcuts
4479 var C = CryptoJS;
4480 var C_lib = C.lib;
4481 var BlockCipher = C_lib.BlockCipher;
4482 var C_algo = C.algo;
4483
4484 // Lookup tables
4485 var SBOX = [];
4486 var INV_SBOX = [];
4487 var SUB_MIX_0 = [];
4488 var SUB_MIX_1 = [];
4489 var SUB_MIX_2 = [];
4490 var SUB_MIX_3 = [];
4491 var INV_SUB_MIX_0 = [];
4492 var INV_SUB_MIX_1 = [];
4493 var INV_SUB_MIX_2 = [];
4494 var INV_SUB_MIX_3 = [];
4495
4496 // Compute lookup tables
4497 (function () {
4498 // Compute double table
4499 var d = [];
4500 for (var i = 0; i < 256; i++) {
4501 if (i < 128) {
4502 d[i] = i << 1;
4503 } else {
4504 d[i] = (i << 1) ^ 0x11b;
4505 }
4506 }
4507
4508 // Walk GF(2^8)
4509 var x = 0;
4510 var xi = 0;
4511 for (var i = 0; i < 256; i++) {
4512 // Compute sbox
4513 var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
4514 sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
4515 SBOX[x] = sx;
4516 INV_SBOX[sx] = x;
4517
4518 // Compute multiplication
4519 var x2 = d[x];
4520 var x4 = d[x2];
4521 var x8 = d[x4];
4522
4523 // Compute sub bytes, mix columns tables
4524 var t = (d[sx] * 0x101) ^ (sx * 0x1010100);
4525 SUB_MIX_0[x] = (t << 24) | (t >>> 8);
4526 SUB_MIX_1[x] = (t << 16) | (t >>> 16);
4527 SUB_MIX_2[x] = (t << 8) | (t >>> 24);
4528 SUB_MIX_3[x] = t;
4529
4530 // Compute inv sub bytes, inv mix columns tables
4531 var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);
4532 INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
4533 INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
4534 INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);
4535 INV_SUB_MIX_3[sx] = t;
4536
4537 // Compute next counter
4538 if (!x) {
4539 x = xi = 1;
4540 } else {
4541 x = x2 ^ d[d[d[x8 ^ x2]]];
4542 xi ^= d[d[xi]];
4543 }
4544 }
4545 }());
4546
4547 // Precomputed Rcon lookup
4548 var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
4549
4550 /**
4551 * AES block cipher algorithm.
4552 */
4553 var AES = C_algo.AES = BlockCipher.extend({
4554 _doReset: function () {
4555 // Shortcuts
4556 var key = this._key;
4557 var keyWords = key.words;
4558 var keySize = key.sigBytes / 4;
4559
4560 // Compute number of rounds
4561 var nRounds = this._nRounds = keySize + 6
4562
4563 // Compute number of key schedule rows
4564 var ksRows = (nRounds + 1) * 4;
4565
4566 // Compute key schedule
4567 var keySchedule = this._keySchedule = [];
4568 for (var ksRow = 0; ksRow < ksRows; ksRow++) {
4569 if (ksRow < keySize) {
4570 keySchedule[ksRow] = keyWords[ksRow];
4571 } else {
4572 var t = keySchedule[ksRow - 1];
4573
4574 if (!(ksRow % keySize)) {
4575 // Rot word
4576 t = (t << 8) | (t >>> 24);
4577
4578 // Sub word
4579 t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
4580
4581 // Mix Rcon
4582 t ^= RCON[(ksRow / keySize) | 0] << 24;
4583 } else if (keySize > 6 && ksRow % keySize == 4) {
4584 // Sub word
4585 t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
4586 }
4587
4588 keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
4589 }
4590 }
4591
4592 // Compute inv key schedule
4593 var invKeySchedule = this._invKeySchedule = [];
4594 for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
4595 var ksRow = ksRows - invKsRow;
4596
4597 if (invKsRow % 4) {
4598 var t = keySchedule[ksRow];
4599 } else {
4600 var t = keySchedule[ksRow - 4];
4601 }
4602
4603 if (invKsRow < 4 || ksRow <= 4) {
4604 invKeySchedule[invKsRow] = t;
4605 } else {
4606 invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
4607 INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
4608 }
4609 }
4610 },
4611
4612 encryptBlock: function (M, offset) {
4613 this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
4614 },
4615
4616 decryptBlock: function (M, offset) {
4617 // Swap 2nd and 4th rows
4618 var t = M[offset + 1];
4619 M[offset + 1] = M[offset + 3];
4620 M[offset + 3] = t;
4621
4622 this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
4623
4624 // Inv swap 2nd and 4th rows
4625 var t = M[offset + 1];
4626 M[offset + 1] = M[offset + 3];
4627 M[offset + 3] = t;
4628 },
4629
4630 _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
4631 // Shortcut
4632 var nRounds = this._nRounds;
4633
4634 // Get input, add round key
4635 var s0 = M[offset] ^ keySchedule[0];
4636 var s1 = M[offset + 1] ^ keySchedule[1];
4637 var s2 = M[offset + 2] ^ keySchedule[2];
4638 var s3 = M[offset + 3] ^ keySchedule[3];
4639
4640 // Key schedule row counter
4641 var ksRow = 4;
4642
4643 // Rounds
4644 for (var round = 1; round < nRounds; round++) {
4645 // Shift rows, sub bytes, mix columns, add round key
4646 var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++];
4647 var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++];
4648 var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];
4649 var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];
4650
4651 // Update state
4652 s0 = t0;
4653 s1 = t1;
4654 s2 = t2;
4655 s3 = t3;
4656 }
4657
4658 // Shift rows, sub bytes, add round key
4659 var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
4660 var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
4661 var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
4662 var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];
4663
4664 // Set output
4665 M[offset] = t0;
4666 M[offset + 1] = t1;
4667 M[offset + 2] = t2;
4668 M[offset + 3] = t3;
4669 },
4670
4671 keySize: 256/32
4672 });
4673
4674 /**
4675 * Shortcut functions to the cipher's object interface.
4676 *
4677 * @example
4678 *
4679 * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
4680 * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);
4681 */
4682 C.AES = BlockCipher._createHelper(AES);
4683}());
4684
4685
4686/***/ }),
4687/* 22 */
4688/***/ (function(module, exports, __webpack_require__) {
4689
4690var CryptoJS = __webpack_require__(3).CryptoJS;
4691
4692/*
4693CryptoJS v3.1.2
4694code.google.com/p/crypto-js
4695(c) 2009-2013 by Jeff Mott. All rights reserved.
4696code.google.com/p/crypto-js/wiki/License
4697*/
4698/**
4699 * Cipher core components.
4700 */
4701CryptoJS.lib.Cipher || (function (undefined) {
4702 // Shortcuts
4703 var C = CryptoJS;
4704 var C_lib = C.lib;
4705 var Base = C_lib.Base;
4706 var WordArray = C_lib.WordArray;
4707 var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
4708 var C_enc = C.enc;
4709 var Utf8 = C_enc.Utf8;
4710 var Base64 = C_enc.Base64;
4711 var C_algo = C.algo;
4712 var EvpKDF = C_algo.EvpKDF;
4713
4714 /**
4715 * Abstract base cipher template.
4716 *
4717 * @property {number} keySize This cipher's key size. Default: 4 (128 bits)
4718 * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
4719 * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
4720 * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
4721 */
4722 var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
4723 /**
4724 * Configuration options.
4725 *
4726 * @property {WordArray} iv The IV to use for this operation.
4727 */
4728 cfg: Base.extend(),
4729
4730 /**
4731 * Creates this cipher in encryption mode.
4732 *
4733 * @param {WordArray} key The key.
4734 * @param {Object} cfg (Optional) The configuration options to use for this operation.
4735 *
4736 * @return {Cipher} A cipher instance.
4737 *
4738 * @static
4739 *
4740 * @example
4741 *
4742 * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
4743 */
4744 createEncryptor: function (key, cfg) {
4745 return this.create(this._ENC_XFORM_MODE, key, cfg);
4746 },
4747
4748 /**
4749 * Creates this cipher in decryption mode.
4750 *
4751 * @param {WordArray} key The key.
4752 * @param {Object} cfg (Optional) The configuration options to use for this operation.
4753 *
4754 * @return {Cipher} A cipher instance.
4755 *
4756 * @static
4757 *
4758 * @example
4759 *
4760 * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
4761 */
4762 createDecryptor: function (key, cfg) {
4763 return this.create(this._DEC_XFORM_MODE, key, cfg);
4764 },
4765
4766 /**
4767 * Initializes a newly created cipher.
4768 *
4769 * @param {number} xformMode Either the encryption or decryption transormation mode constant.
4770 * @param {WordArray} key The key.
4771 * @param {Object} cfg (Optional) The configuration options to use for this operation.
4772 *
4773 * @example
4774 *
4775 * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
4776 */
4777 init: function (xformMode, key, cfg) {
4778 // Apply config defaults
4779 this.cfg = this.cfg.extend(cfg);
4780
4781 // Store transform mode and key
4782 this._xformMode = xformMode;
4783 this._key = key;
4784
4785 // Set initial values
4786 this.reset();
4787 },
4788
4789 /**
4790 * Resets this cipher to its initial state.
4791 *
4792 * @example
4793 *
4794 * cipher.reset();
4795 */
4796 reset: function () {
4797 // Reset data buffer
4798 BufferedBlockAlgorithm.reset.call(this);
4799
4800 // Perform concrete-cipher logic
4801 this._doReset();
4802 },
4803
4804 /**
4805 * Adds data to be encrypted or decrypted.
4806 *
4807 * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
4808 *
4809 * @return {WordArray} The data after processing.
4810 *
4811 * @example
4812 *
4813 * var encrypted = cipher.process('data');
4814 * var encrypted = cipher.process(wordArray);
4815 */
4816 process: function (dataUpdate) {
4817 // Append
4818 this._append(dataUpdate);
4819
4820 // Process available blocks
4821 return this._process();
4822 },
4823
4824 /**
4825 * Finalizes the encryption or decryption process.
4826 * Note that the finalize operation is effectively a destructive, read-once operation.
4827 *
4828 * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
4829 *
4830 * @return {WordArray} The data after final processing.
4831 *
4832 * @example
4833 *
4834 * var encrypted = cipher.finalize();
4835 * var encrypted = cipher.finalize('data');
4836 * var encrypted = cipher.finalize(wordArray);
4837 */
4838 finalize: function (dataUpdate) {
4839 // Final data update
4840 if (dataUpdate) {
4841 this._append(dataUpdate);
4842 }
4843
4844 // Perform concrete-cipher logic
4845 var finalProcessedData = this._doFinalize();
4846
4847 return finalProcessedData;
4848 },
4849
4850 keySize: 128/32,
4851
4852 ivSize: 128/32,
4853
4854 _ENC_XFORM_MODE: 1,
4855
4856 _DEC_XFORM_MODE: 2,
4857
4858 /**
4859 * Creates shortcut functions to a cipher's object interface.
4860 *
4861 * @param {Cipher} cipher The cipher to create a helper for.
4862 *
4863 * @return {Object} An object with encrypt and decrypt shortcut functions.
4864 *
4865 * @static
4866 *
4867 * @example
4868 *
4869 * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
4870 */
4871 _createHelper: (function () {
4872 function selectCipherStrategy(key) {
4873 if (typeof key == 'string') {
4874 return PasswordBasedCipher;
4875 } else {
4876 return SerializableCipher;
4877 }
4878 }
4879
4880 return function (cipher) {
4881 return {
4882 encrypt: function (message, key, cfg) {
4883 return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);
4884 },
4885
4886 decrypt: function (ciphertext, key, cfg) {
4887 return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
4888 }
4889 };
4890 };
4891 }())
4892 });
4893
4894 /**
4895 * Abstract base stream cipher template.
4896 *
4897 * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
4898 */
4899 var StreamCipher = C_lib.StreamCipher = Cipher.extend({
4900 _doFinalize: function () {
4901 // Process partial blocks
4902 var finalProcessedBlocks = this._process(!!'flush');
4903
4904 return finalProcessedBlocks;
4905 },
4906
4907 blockSize: 1
4908 });
4909
4910 /**
4911 * Mode namespace.
4912 */
4913 var C_mode = C.mode = {};
4914
4915 /**
4916 * Abstract base block cipher mode template.
4917 */
4918 var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
4919 /**
4920 * Creates this mode for encryption.
4921 *
4922 * @param {Cipher} cipher A block cipher instance.
4923 * @param {Array} iv The IV words.
4924 *
4925 * @static
4926 *
4927 * @example
4928 *
4929 * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
4930 */
4931 createEncryptor: function (cipher, iv) {
4932 return this.Encryptor.create(cipher, iv);
4933 },
4934
4935 /**
4936 * Creates this mode for decryption.
4937 *
4938 * @param {Cipher} cipher A block cipher instance.
4939 * @param {Array} iv The IV words.
4940 *
4941 * @static
4942 *
4943 * @example
4944 *
4945 * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
4946 */
4947 createDecryptor: function (cipher, iv) {
4948 return this.Decryptor.create(cipher, iv);
4949 },
4950
4951 /**
4952 * Initializes a newly created mode.
4953 *
4954 * @param {Cipher} cipher A block cipher instance.
4955 * @param {Array} iv The IV words.
4956 *
4957 * @example
4958 *
4959 * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
4960 */
4961 init: function (cipher, iv) {
4962 this._cipher = cipher;
4963 this._iv = iv;
4964 }
4965 });
4966
4967 /**
4968 * Cipher Block Chaining mode.
4969 */
4970 var CBC = C_mode.CBC = (function () {
4971 /**
4972 * Abstract base CBC mode.
4973 */
4974 var CBC = BlockCipherMode.extend();
4975
4976 /**
4977 * CBC encryptor.
4978 */
4979 CBC.Encryptor = CBC.extend({
4980 /**
4981 * Processes the data block at offset.
4982 *
4983 * @param {Array} words The data words to operate on.
4984 * @param {number} offset The offset where the block starts.
4985 *
4986 * @example
4987 *
4988 * mode.processBlock(data.words, offset);
4989 */
4990 processBlock: function (words, offset) {
4991 // Shortcuts
4992 var cipher = this._cipher;
4993 var blockSize = cipher.blockSize;
4994
4995 // XOR and encrypt
4996 xorBlock.call(this, words, offset, blockSize);
4997 cipher.encryptBlock(words, offset);
4998
4999 // Remember this block to use with next block
5000 this._prevBlock = words.slice(offset, offset + blockSize);
5001 }
5002 });
5003
5004 /**
5005 * CBC decryptor.
5006 */
5007 CBC.Decryptor = CBC.extend({
5008 /**
5009 * Processes the data block at offset.
5010 *
5011 * @param {Array} words The data words to operate on.
5012 * @param {number} offset The offset where the block starts.
5013 *
5014 * @example
5015 *
5016 * mode.processBlock(data.words, offset);
5017 */
5018 processBlock: function (words, offset) {
5019 // Shortcuts
5020 var cipher = this._cipher;
5021 var blockSize = cipher.blockSize;
5022
5023 // Remember this block to use with next block
5024 var thisBlock = words.slice(offset, offset + blockSize);
5025
5026 // Decrypt and XOR
5027 cipher.decryptBlock(words, offset);
5028 xorBlock.call(this, words, offset, blockSize);
5029
5030 // This block becomes the previous block
5031 this._prevBlock = thisBlock;
5032 }
5033 });
5034
5035 function xorBlock(words, offset, blockSize) {
5036 // Shortcut
5037 var iv = this._iv;
5038
5039 // Choose mixing block
5040 if (iv) {
5041 var block = iv;
5042
5043 // Remove IV for subsequent blocks
5044 this._iv = undefined;
5045 } else {
5046 var block = this._prevBlock;
5047 }
5048
5049 // XOR blocks
5050 for (var i = 0; i < blockSize; i++) {
5051 words[offset + i] ^= block[i];
5052 }
5053 }
5054
5055 return CBC;
5056 }());
5057
5058 /**
5059 * Infinite Garble Extension mode.
5060 */
5061 var IGE = C_mode.IGE = (function () {
5062 /**
5063 * Abstract base IGE mode.
5064 */
5065 var IGE = BlockCipherMode.extend();
5066
5067 /**
5068 * IGE encryptor.
5069 */
5070 IGE.Encryptor = IGE.extend({
5071 /**
5072 * Processes the data block at offset.
5073 *
5074 * @param {Array} words The data words to operate on.
5075 * @param {number} offset The offset where the block starts.
5076 *
5077 * @example
5078 *
5079 * mode.processBlock(data.words, offset);
5080 */
5081 processBlock: function (words, offset) {
5082 // Shortcuts
5083 var cipher = this._cipher;
5084 var blockSize = cipher.blockSize;
5085
5086 if (this._ivp === undefined) {
5087 this._ivp = this._iv.slice(0, blockSize);
5088 this._iv2p = this._iv.slice(blockSize, blockSize + blockSize);
5089 }
5090
5091
5092 // Remember this block to use with next block
5093 var nextIv2p = words.slice(offset, offset + blockSize);
5094
5095 // XOR with previous ciphertext
5096 xorBlock(words, this._ivp, offset, blockSize);
5097
5098 // Block cipher
5099 cipher.encryptBlock(words, offset);
5100
5101 // XOR with previous plaintext
5102 xorBlock(words, this._iv2p, offset, blockSize);
5103
5104 this._ivp = words.slice(offset, offset + blockSize);
5105 this._iv2p = nextIv2p;
5106 }
5107 });
5108
5109 /**
5110 * IGE decryptor.
5111 */
5112 IGE.Decryptor = IGE.extend({
5113 /**
5114 * Processes the data block at offset.
5115 *
5116 * @param {Array} words The data words to operate on.
5117 * @param {number} offset The offset where the block starts.
5118 *
5119 * @example
5120 *
5121 * mode.processBlock(data.words, offset);
5122 */
5123 processBlock: function (words, offset) {
5124 // Shortcuts
5125 var cipher = this._cipher;
5126 var blockSize = cipher.blockSize;
5127
5128 if (this._ivp === undefined) {
5129 this._ivp = this._iv.slice(0, blockSize);
5130 this._iv2p = this._iv.slice(blockSize, 2 * blockSize);
5131 }
5132
5133 // Remember this block to use with next block
5134 var nextIvp = words.slice(offset, offset + blockSize);
5135
5136 // XOR with previous ciphertext
5137 xorBlock(words, this._iv2p, offset, blockSize);
5138
5139 // Block cipher
5140 cipher.decryptBlock(words, offset);
5141
5142 // XOR with previous plaintext
5143 xorBlock(words, this._ivp, offset, blockSize);
5144
5145 this._ivp = nextIvp;
5146 this._iv2p = words.slice(offset, offset + blockSize);
5147 }
5148 });
5149
5150 function xorBlock(words, block, offset, blockSize) {
5151 for (var i = 0; i < blockSize; i++) {
5152 words[offset + i] ^= block[i];
5153 }
5154 }
5155
5156 return IGE;
5157 }());
5158
5159 /**
5160 * Padding namespace.
5161 */
5162 var C_pad = C.pad = {};
5163
5164 /**
5165 * PKCS #5/7 padding strategy.
5166 */
5167 var Pkcs7 = C_pad.Pkcs7 = {
5168 /**
5169 * Pads data using the algorithm defined in PKCS #5/7.
5170 *
5171 * @param {WordArray} data The data to pad.
5172 * @param {number} blockSize The multiple that the data should be padded to.
5173 *
5174 * @static
5175 *
5176 * @example
5177 *
5178 * CryptoJS.pad.Pkcs7.pad(wordArray, 4);
5179 */
5180 pad: function (data, blockSize) {
5181 // Shortcut
5182 var blockSizeBytes = blockSize * 4;
5183
5184 // Count padding bytes
5185 var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
5186
5187 // Create padding word
5188 var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes;
5189
5190 // Create padding
5191 var paddingWords = [];
5192 for (var i = 0; i < nPaddingBytes; i += 4) {
5193 paddingWords.push(paddingWord);
5194 }
5195 var padding = WordArray.create(paddingWords, nPaddingBytes);
5196
5197 // Add padding
5198 data.concat(padding);
5199 },
5200
5201 /**
5202 * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
5203 *
5204 * @param {WordArray} data The data to unpad.
5205 *
5206 * @static
5207 *
5208 * @example
5209 *
5210 * CryptoJS.pad.Pkcs7.unpad(wordArray);
5211 */
5212 unpad: function (data) {
5213 // Get number of padding bytes from last byte
5214 var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
5215
5216 // Remove padding
5217 data.sigBytes -= nPaddingBytes;
5218 }
5219 };
5220
5221 var NoPadding = C_pad.NoPadding = {
5222 pad: function () {
5223 },
5224
5225 unpad: function () {
5226 }
5227 };
5228
5229
5230 /**
5231 * Abstract base block cipher template.
5232 *
5233 * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
5234 */
5235 var BlockCipher = C_lib.BlockCipher = Cipher.extend({
5236 /**
5237 * Configuration options.
5238 *
5239 * @property {Mode} mode The block mode to use. Default: CBC
5240 * @property {Padding} padding The padding strategy to use. Default: Pkcs7
5241 */
5242 cfg: Cipher.cfg.extend({
5243 mode: CBC,
5244 padding: Pkcs7
5245 }),
5246
5247 reset: function () {
5248 // Reset cipher
5249 Cipher.reset.call(this);
5250
5251 // Shortcuts
5252 var cfg = this.cfg;
5253 var iv = cfg.iv;
5254 var mode = cfg.mode;
5255
5256 // Reset block mode
5257 if (this._xformMode == this._ENC_XFORM_MODE) {
5258 var modeCreator = mode.createEncryptor;
5259 } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
5260 var modeCreator = mode.createDecryptor;
5261
5262 // Keep at least one block in the buffer for unpadding
5263 this._minBufferSize = 1;
5264 }
5265 this._mode = modeCreator.call(mode, this, iv && iv.words);
5266 },
5267
5268 _doProcessBlock: function (words, offset) {
5269 this._mode.processBlock(words, offset);
5270 },
5271
5272 _doFinalize: function () {
5273 // Shortcut
5274 var padding = this.cfg.padding;
5275
5276 // Finalize
5277 if (this._xformMode == this._ENC_XFORM_MODE) {
5278 // Pad data
5279 padding.pad(this._data, this.blockSize);
5280
5281 // Process final blocks
5282 var finalProcessedBlocks = this._process(!!'flush');
5283 } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
5284 // Process final blocks
5285 var finalProcessedBlocks = this._process(!!'flush');
5286
5287 // Unpad data
5288 padding.unpad(finalProcessedBlocks);
5289 }
5290
5291 return finalProcessedBlocks;
5292 },
5293
5294 blockSize: 128/32
5295 });
5296
5297 /**
5298 * A collection of cipher parameters.
5299 *
5300 * @property {WordArray} ciphertext The raw ciphertext.
5301 * @property {WordArray} key The key to this ciphertext.
5302 * @property {WordArray} iv The IV used in the ciphering operation.
5303 * @property {WordArray} salt The salt used with a key derivation function.
5304 * @property {Cipher} algorithm The cipher algorithm.
5305 * @property {Mode} mode The block mode used in the ciphering operation.
5306 * @property {Padding} padding The padding scheme used in the ciphering operation.
5307 * @property {number} blockSize The block size of the cipher.
5308 * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
5309 */
5310 var CipherParams = C_lib.CipherParams = Base.extend({
5311 /**
5312 * Initializes a newly created cipher params object.
5313 *
5314 * @param {Object} cipherParams An object with any of the possible cipher parameters.
5315 *
5316 * @example
5317 *
5318 * var cipherParams = CryptoJS.lib.CipherParams.create({
5319 * ciphertext: ciphertextWordArray,
5320 * key: keyWordArray,
5321 * iv: ivWordArray,
5322 * salt: saltWordArray,
5323 * algorithm: CryptoJS.algo.AES,
5324 * mode: CryptoJS.mode.CBC,
5325 * padding: CryptoJS.pad.PKCS7,
5326 * blockSize: 4,
5327 * formatter: CryptoJS.format.OpenSSL
5328 * });
5329 */
5330 init: function (cipherParams) {
5331 this.mixIn(cipherParams);
5332 },
5333
5334 /**
5335 * Converts this cipher params object to a string.
5336 *
5337 * @param {Format} formatter (Optional) The formatting strategy to use.
5338 *
5339 * @return {string} The stringified cipher params.
5340 *
5341 * @throws Error If neither the formatter nor the default formatter is set.
5342 *
5343 * @example
5344 *
5345 * var string = cipherParams + '';
5346 * var string = cipherParams.toString();
5347 * var string = cipherParams.toString(CryptoJS.format.OpenSSL);
5348 */
5349 toString: function (formatter) {
5350 return (formatter || this.formatter).stringify(this);
5351 }
5352 });
5353
5354 /**
5355 * Format namespace.
5356 */
5357 var C_format = C.format = {};
5358
5359 /**
5360 * OpenSSL formatting strategy.
5361 */
5362 var OpenSSLFormatter = C_format.OpenSSL = {
5363 /**
5364 * Converts a cipher params object to an OpenSSL-compatible string.
5365 *
5366 * @param {CipherParams} cipherParams The cipher params object.
5367 *
5368 * @return {string} The OpenSSL-compatible string.
5369 *
5370 * @static
5371 *
5372 * @example
5373 *
5374 * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
5375 */
5376 stringify: function (cipherParams) {
5377 // Shortcuts
5378 var ciphertext = cipherParams.ciphertext;
5379 var salt = cipherParams.salt;
5380
5381 // Format
5382 if (salt) {
5383 var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);
5384 } else {
5385 var wordArray = ciphertext;
5386 }
5387
5388 return wordArray.toString(Base64);
5389 },
5390
5391 /**
5392 * Converts an OpenSSL-compatible string to a cipher params object.
5393 *
5394 * @param {string} openSSLStr The OpenSSL-compatible string.
5395 *
5396 * @return {CipherParams} The cipher params object.
5397 *
5398 * @static
5399 *
5400 * @example
5401 *
5402 * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
5403 */
5404 parse: function (openSSLStr) {
5405 // Parse base64
5406 var ciphertext = Base64.parse(openSSLStr);
5407
5408 // Shortcut
5409 var ciphertextWords = ciphertext.words;
5410
5411 // Test for salt
5412 if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {
5413 // Extract salt
5414 var salt = WordArray.create(ciphertextWords.slice(2, 4));
5415
5416 // Remove salt from ciphertext
5417 ciphertextWords.splice(0, 4);
5418 ciphertext.sigBytes -= 16;
5419 }
5420
5421 return CipherParams.create({ ciphertext: ciphertext, salt: salt });
5422 }
5423 };
5424
5425 /**
5426 * A cipher wrapper that returns ciphertext as a serializable cipher params object.
5427 */
5428 var SerializableCipher = C_lib.SerializableCipher = Base.extend({
5429 /**
5430 * Configuration options.
5431 *
5432 * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
5433 */
5434 cfg: Base.extend({
5435 format: OpenSSLFormatter
5436 }),
5437
5438 /**
5439 * Encrypts a message.
5440 *
5441 * @param {Cipher} cipher The cipher algorithm to use.
5442 * @param {WordArray|string} message The message to encrypt.
5443 * @param {WordArray} key The key.
5444 * @param {Object} cfg (Optional) The configuration options to use for this operation.
5445 *
5446 * @return {CipherParams} A cipher params object.
5447 *
5448 * @static
5449 *
5450 * @example
5451 *
5452 * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
5453 * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
5454 * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
5455 */
5456 encrypt: function (cipher, message, key, cfg) {
5457 // Apply config defaults
5458 cfg = this.cfg.extend(cfg);
5459
5460 // Encrypt
5461 var encryptor = cipher.createEncryptor(key, cfg);
5462 var ciphertext = encryptor.finalize(message);
5463
5464 // Shortcut
5465 var cipherCfg = encryptor.cfg;
5466
5467 // Create and return serializable cipher params
5468 return CipherParams.create({
5469 ciphertext: ciphertext,
5470 key: key,
5471 iv: cipherCfg.iv,
5472 algorithm: cipher,
5473 mode: cipherCfg.mode,
5474 padding: cipherCfg.padding,
5475 blockSize: cipher.blockSize,
5476 formatter: cfg.format
5477 });
5478 },
5479
5480 /**
5481 * Decrypts serialized ciphertext.
5482 *
5483 * @param {Cipher} cipher The cipher algorithm to use.
5484 * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
5485 * @param {WordArray} key The key.
5486 * @param {Object} cfg (Optional) The configuration options to use for this operation.
5487 *
5488 * @return {WordArray} The plaintext.
5489 *
5490 * @static
5491 *
5492 * @example
5493 *
5494 * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
5495 * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
5496 */
5497 decrypt: function (cipher, ciphertext, key, cfg) {
5498 // Apply config defaults
5499 cfg = this.cfg.extend(cfg);
5500
5501 // Convert string to CipherParams
5502 ciphertext = this._parse(ciphertext, cfg.format);
5503
5504 // Decrypt
5505 var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
5506
5507 return plaintext;
5508 },
5509
5510 /**
5511 * Converts serialized ciphertext to CipherParams,
5512 * else assumed CipherParams already and returns ciphertext unchanged.
5513 *
5514 * @param {CipherParams|string} ciphertext The ciphertext.
5515 * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
5516 *
5517 * @return {CipherParams} The unserialized ciphertext.
5518 *
5519 * @static
5520 *
5521 * @example
5522 *
5523 * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
5524 */
5525 _parse: function (ciphertext, format) {
5526 if (typeof ciphertext == 'string') {
5527 return format.parse(ciphertext, this);
5528 } else {
5529 return ciphertext;
5530 }
5531 }
5532 });
5533
5534 /**
5535 * Key derivation function namespace.
5536 */
5537 var C_kdf = C.kdf = {};
5538
5539 /**
5540 * OpenSSL key derivation function.
5541 */
5542 var OpenSSLKdf = C_kdf.OpenSSL = {
5543 /**
5544 * Derives a key and IV from a password.
5545 *
5546 * @param {string} password The password to derive from.
5547 * @param {number} keySize The size in words of the key to generate.
5548 * @param {number} ivSize The size in words of the IV to generate.
5549 * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
5550 *
5551 * @return {CipherParams} A cipher params object with the key, IV, and salt.
5552 *
5553 * @static
5554 *
5555 * @example
5556 *
5557 * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
5558 * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
5559 */
5560 execute: function (password, keySize, ivSize, salt) {
5561 // Generate random salt
5562 if (!salt) {
5563 salt = WordArray.random(64/8);
5564 }
5565
5566 // Derive key and IV
5567 var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
5568
5569 // Separate key and IV
5570 var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
5571 key.sigBytes = keySize * 4;
5572
5573 // Return params
5574 return CipherParams.create({ key: key, iv: iv, salt: salt });
5575 }
5576 };
5577
5578 /**
5579 * A serializable cipher wrapper that derives the key from a password,
5580 * and returns ciphertext as a serializable cipher params object.
5581 */
5582 var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
5583 /**
5584 * Configuration options.
5585 *
5586 * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
5587 */
5588 cfg: SerializableCipher.cfg.extend({
5589 kdf: OpenSSLKdf
5590 }),
5591
5592 /**
5593 * Encrypts a message using a password.
5594 *
5595 * @param {Cipher} cipher The cipher algorithm to use.
5596 * @param {WordArray|string} message The message to encrypt.
5597 * @param {string} password The password.
5598 * @param {Object} cfg (Optional) The configuration options to use for this operation.
5599 *
5600 * @return {CipherParams} A cipher params object.
5601 *
5602 * @static
5603 *
5604 * @example
5605 *
5606 * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
5607 * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
5608 */
5609 encrypt: function (cipher, message, password, cfg) {
5610 // Apply config defaults
5611 cfg = this.cfg.extend(cfg);
5612
5613 // Derive key and other params
5614 var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize);
5615
5616 // Add IV to config
5617 cfg.iv = derivedParams.iv;
5618
5619 // Encrypt
5620 var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);
5621
5622 // Mix in derived params
5623 ciphertext.mixIn(derivedParams);
5624
5625 return ciphertext;
5626 },
5627
5628 /**
5629 * Decrypts serialized ciphertext using a password.
5630 *
5631 * @param {Cipher} cipher The cipher algorithm to use.
5632 * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
5633 * @param {string} password The password.
5634 * @param {Object} cfg (Optional) The configuration options to use for this operation.
5635 *
5636 * @return {WordArray} The plaintext.
5637 *
5638 * @static
5639 *
5640 * @example
5641 *
5642 * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
5643 * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
5644 */
5645 decrypt: function (cipher, ciphertext, password, cfg) {
5646 // Apply config defaults
5647 cfg = this.cfg.extend(cfg);
5648
5649 // Convert string to CipherParams
5650 ciphertext = this._parse(ciphertext, cfg.format);
5651
5652 // Derive key and other params
5653 var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt);
5654
5655 // Add IV to config
5656 cfg.iv = derivedParams.iv;
5657
5658 // Decrypt
5659 var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);
5660
5661 return plaintext;
5662 }
5663 });
5664}());
5665
5666
5667/***/ }),
5668/* 23 */
5669/***/ (function(module, exports, __webpack_require__) {
5670
5671var CryptoJS = __webpack_require__(3).CryptoJS;
5672
5673/*
5674CryptoJS v3.1.2
5675code.google.com/p/crypto-js
5676(c) 2009-2013 by Jeff Mott. All rights reserved.
5677code.google.com/p/crypto-js/wiki/License
5678*/
5679(function () {
5680 // Shortcuts
5681 var C = CryptoJS;
5682 var C_lib = C.lib;
5683 var WordArray = C_lib.WordArray;
5684 var C_enc = C.enc;
5685
5686 /**
5687 * Base64 encoding strategy.
5688 */
5689 var Base64 = C_enc.Base64 = {
5690 /**
5691 * Converts a word array to a Base64 string.
5692 *
5693 * @param {WordArray} wordArray The word array.
5694 *
5695 * @return {string} The Base64 string.
5696 *
5697 * @static
5698 *
5699 * @example
5700 *
5701 * var base64String = CryptoJS.enc.Base64.stringify(wordArray);
5702 */
5703 stringify: function (wordArray) {
5704 // Shortcuts
5705 var words = wordArray.words;
5706 var sigBytes = wordArray.sigBytes;
5707 var map = this._map;
5708
5709 // Clamp excess bits
5710 wordArray.clamp();
5711
5712 // Convert
5713 var base64Chars = [];
5714 for (var i = 0; i < sigBytes; i += 3) {
5715 var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
5716 var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
5717 var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
5718
5719 var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
5720
5721 for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
5722 base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
5723 }
5724 }
5725
5726 // Add padding
5727 var paddingChar = map.charAt(64);
5728 if (paddingChar) {
5729 while (base64Chars.length % 4) {
5730 base64Chars.push(paddingChar);
5731 }
5732 }
5733
5734 return base64Chars.join('');
5735 },
5736
5737 /**
5738 * Converts a Base64 string to a word array.
5739 *
5740 * @param {string} base64Str The Base64 string.
5741 *
5742 * @return {WordArray} The word array.
5743 *
5744 * @static
5745 *
5746 * @example
5747 *
5748 * var wordArray = CryptoJS.enc.Base64.parse(base64String);
5749 */
5750 parse: function (base64Str) {
5751 // Shortcuts
5752 var base64StrLength = base64Str.length;
5753 var map = this._map;
5754
5755 // Ignore padding
5756 var paddingChar = map.charAt(64);
5757 if (paddingChar) {
5758 var paddingIndex = base64Str.indexOf(paddingChar);
5759 if (paddingIndex != -1) {
5760 base64StrLength = paddingIndex;
5761 }
5762 }
5763
5764 // Convert
5765 var words = [];
5766 var nBytes = 0;
5767 for (var i = 0; i < base64StrLength; i++) {
5768 if (i % 4) {
5769 var bits1 = map.indexOf(base64Str.charAt(i - 1)) << ((i % 4) * 2);
5770 var bits2 = map.indexOf(base64Str.charAt(i)) >>> (6 - (i % 4) * 2);
5771 words[nBytes >>> 2] |= (bits1 | bits2) << (24 - (nBytes % 4) * 8);
5772 nBytes++;
5773 }
5774 }
5775
5776 return WordArray.create(words, nBytes);
5777 },
5778
5779 _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
5780 };
5781}());
5782
5783
5784/***/ }),
5785/* 24 */
5786/***/ (function(module, exports, __webpack_require__) {
5787
5788var CryptoJS = __webpack_require__(3).CryptoJS;
5789
5790/*
5791CryptoJS v3.1.2
5792code.google.com/p/crypto-js
5793(c) 2009-2013 by Jeff Mott. All rights reserved.
5794code.google.com/p/crypto-js/wiki/License
5795*/
5796(function () {
5797 // Shortcuts
5798 var C = CryptoJS;
5799 var C_lib = C.lib;
5800 var Base = C_lib.Base;
5801 var WordArray = C_lib.WordArray;
5802 var C_algo = C.algo;
5803 var MD5 = C_algo.MD5;
5804
5805 /**
5806 * This key derivation function is meant to conform with EVP_BytesToKey.
5807 * www.openssl.org/docs/crypto/EVP_BytesToKey.html
5808 */
5809 var EvpKDF = C_algo.EvpKDF = Base.extend({
5810 /**
5811 * Configuration options.
5812 *
5813 * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
5814 * @property {Hasher} hasher The hash algorithm to use. Default: MD5
5815 * @property {number} iterations The number of iterations to perform. Default: 1
5816 */
5817 cfg: Base.extend({
5818 keySize: 128/32,
5819 hasher: MD5,
5820 iterations: 1
5821 }),
5822
5823 /**
5824 * Initializes a newly created key derivation function.
5825 *
5826 * @param {Object} cfg (Optional) The configuration options to use for the derivation.
5827 *
5828 * @example
5829 *
5830 * var kdf = CryptoJS.algo.EvpKDF.create();
5831 * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });
5832 * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });
5833 */
5834 init: function (cfg) {
5835 this.cfg = this.cfg.extend(cfg);
5836 },
5837
5838 /**
5839 * Derives a key from a password.
5840 *
5841 * @param {WordArray|string} password The password.
5842 * @param {WordArray|string} salt A salt.
5843 *
5844 * @return {WordArray} The derived key.
5845 *
5846 * @example
5847 *
5848 * var key = kdf.compute(password, salt);
5849 */
5850 compute: function (password, salt) {
5851 // Shortcut
5852 var cfg = this.cfg;
5853
5854 // Init hasher
5855 var hasher = cfg.hasher.create();
5856
5857 // Initial values
5858 var derivedKey = WordArray.create();
5859
5860 // Shortcuts
5861 var derivedKeyWords = derivedKey.words;
5862 var keySize = cfg.keySize;
5863 var iterations = cfg.iterations;
5864
5865 // Generate key
5866 while (derivedKeyWords.length < keySize) {
5867 if (block) {
5868 hasher.update(block);
5869 }
5870 var block = hasher.update(password).finalize(salt);
5871 hasher.reset();
5872
5873 // Iterations
5874 for (var i = 1; i < iterations; i++) {
5875 block = hasher.finalize(block);
5876 hasher.reset();
5877 }
5878
5879 derivedKey.concat(block);
5880 }
5881 derivedKey.sigBytes = keySize * 4;
5882
5883 return derivedKey;
5884 }
5885 });
5886
5887 /**
5888 * Derives a key from a password.
5889 *
5890 * @param {WordArray|string} password The password.
5891 * @param {WordArray|string} salt A salt.
5892 * @param {Object} cfg (Optional) The configuration options to use for this computation.
5893 *
5894 * @return {WordArray} The derived key.
5895 *
5896 * @static
5897 *
5898 * @example
5899 *
5900 * var key = CryptoJS.EvpKDF(password, salt);
5901 * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });
5902 * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });
5903 */
5904 C.EvpKDF = function (password, salt, cfg) {
5905 return EvpKDF.create(cfg).compute(password, salt);
5906 };
5907}());
5908
5909
5910/***/ }),
5911/* 25 */
5912/***/ (function(module, exports, __webpack_require__) {
5913
5914var CryptoJS = __webpack_require__(3).CryptoJS;
5915
5916// create custom json serialization format
5917var JsonFormatter = {
5918 stringify: function (cipherParams) {
5919 // create json object with ciphertext
5920 var jsonObj = {
5921 ct: cipherParams.ciphertext.toString(CryptoJS.enc.Base64)
5922 };
5923
5924 // optionally add iv and salt
5925 if (cipherParams.iv) {
5926 jsonObj.iv = cipherParams.iv.toString();
5927 }
5928
5929 if (cipherParams.salt) {
5930 jsonObj.s = cipherParams.salt.toString();
5931 }
5932
5933 // stringify json object
5934 return JSON.stringify(jsonObj)
5935 },
5936
5937 parse: function (jsonStr) {
5938 // parse json string
5939 var jsonObj = JSON.parse(jsonStr);
5940
5941 // extract ciphertext from json object, and create cipher params object
5942 var cipherParams = CryptoJS.lib.CipherParams.create({
5943 ciphertext: CryptoJS.enc.Base64.parse(jsonObj.ct)
5944 });
5945
5946 // optionally extract iv and salt
5947 if (jsonObj.iv) {
5948 cipherParams.iv = CryptoJS.enc.Hex.parse(jsonObj.iv);
5949 }
5950
5951 if (jsonObj.s) {
5952 cipherParams.salt = CryptoJS.enc.Hex.parse(jsonObj.s);
5953 }
5954
5955 return cipherParams;
5956 }
5957};
5958
5959exports.JsonFormatter = JsonFormatter;
5960
5961/***/ }),
5962/* 26 */
5963/***/ (function(module, exports, __webpack_require__) {
5964
5965var CryptoJS = __webpack_require__(3).CryptoJS;
5966
5967/*
5968CryptoJS v3.1.2
5969code.google.com/p/crypto-js
5970(c) 2009-2013 by Jeff Mott. All rights reserved.
5971code.google.com/p/crypto-js/wiki/License
5972*/
5973(function (Math) {
5974 // Shortcuts
5975 var C = CryptoJS;
5976 var C_lib = C.lib;
5977 var WordArray = C_lib.WordArray;
5978 var Hasher = C_lib.Hasher;
5979 var C_algo = C.algo;
5980
5981 // Constants table
5982 var T = [];
5983
5984 // Compute constants
5985 (function () {
5986 for (var i = 0; i < 64; i++) {
5987 T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;
5988 }
5989 }());
5990
5991 /**
5992 * MD5 hash algorithm.
5993 */
5994 var MD5 = C_algo.MD5 = Hasher.extend({
5995 _doReset: function () {
5996 this._hash = new WordArray.init([
5997 0x67452301, 0xefcdab89,
5998 0x98badcfe, 0x10325476
5999 ]);
6000 },
6001
6002 _doProcessBlock: function (M, offset) {
6003 // Swap endian
6004 for (var i = 0; i < 16; i++) {
6005 // Shortcuts
6006 var offset_i = offset + i;
6007 var M_offset_i = M[offset_i];
6008
6009 M[offset_i] = (
6010 (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
6011 (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
6012 );
6013 }
6014
6015 // Shortcuts
6016 var H = this._hash.words;
6017
6018 var M_offset_0 = M[offset + 0];
6019 var M_offset_1 = M[offset + 1];
6020 var M_offset_2 = M[offset + 2];
6021 var M_offset_3 = M[offset + 3];
6022 var M_offset_4 = M[offset + 4];
6023 var M_offset_5 = M[offset + 5];
6024 var M_offset_6 = M[offset + 6];
6025 var M_offset_7 = M[offset + 7];
6026 var M_offset_8 = M[offset + 8];
6027 var M_offset_9 = M[offset + 9];
6028 var M_offset_10 = M[offset + 10];
6029 var M_offset_11 = M[offset + 11];
6030 var M_offset_12 = M[offset + 12];
6031 var M_offset_13 = M[offset + 13];
6032 var M_offset_14 = M[offset + 14];
6033 var M_offset_15 = M[offset + 15];
6034
6035 // Working varialbes
6036 var a = H[0];
6037 var b = H[1];
6038 var c = H[2];
6039 var d = H[3];
6040
6041 // Computation
6042 a = FF(a, b, c, d, M_offset_0, 7, T[0]);
6043 d = FF(d, a, b, c, M_offset_1, 12, T[1]);
6044 c = FF(c, d, a, b, M_offset_2, 17, T[2]);
6045 b = FF(b, c, d, a, M_offset_3, 22, T[3]);
6046 a = FF(a, b, c, d, M_offset_4, 7, T[4]);
6047 d = FF(d, a, b, c, M_offset_5, 12, T[5]);
6048 c = FF(c, d, a, b, M_offset_6, 17, T[6]);
6049 b = FF(b, c, d, a, M_offset_7, 22, T[7]);
6050 a = FF(a, b, c, d, M_offset_8, 7, T[8]);
6051 d = FF(d, a, b, c, M_offset_9, 12, T[9]);
6052 c = FF(c, d, a, b, M_offset_10, 17, T[10]);
6053 b = FF(b, c, d, a, M_offset_11, 22, T[11]);
6054 a = FF(a, b, c, d, M_offset_12, 7, T[12]);
6055 d = FF(d, a, b, c, M_offset_13, 12, T[13]);
6056 c = FF(c, d, a, b, M_offset_14, 17, T[14]);
6057 b = FF(b, c, d, a, M_offset_15, 22, T[15]);
6058
6059 a = GG(a, b, c, d, M_offset_1, 5, T[16]);
6060 d = GG(d, a, b, c, M_offset_6, 9, T[17]);
6061 c = GG(c, d, a, b, M_offset_11, 14, T[18]);
6062 b = GG(b, c, d, a, M_offset_0, 20, T[19]);
6063 a = GG(a, b, c, d, M_offset_5, 5, T[20]);
6064 d = GG(d, a, b, c, M_offset_10, 9, T[21]);
6065 c = GG(c, d, a, b, M_offset_15, 14, T[22]);
6066 b = GG(b, c, d, a, M_offset_4, 20, T[23]);
6067 a = GG(a, b, c, d, M_offset_9, 5, T[24]);
6068 d = GG(d, a, b, c, M_offset_14, 9, T[25]);
6069 c = GG(c, d, a, b, M_offset_3, 14, T[26]);
6070 b = GG(b, c, d, a, M_offset_8, 20, T[27]);
6071 a = GG(a, b, c, d, M_offset_13, 5, T[28]);
6072 d = GG(d, a, b, c, M_offset_2, 9, T[29]);
6073 c = GG(c, d, a, b, M_offset_7, 14, T[30]);
6074 b = GG(b, c, d, a, M_offset_12, 20, T[31]);
6075
6076 a = HH(a, b, c, d, M_offset_5, 4, T[32]);
6077 d = HH(d, a, b, c, M_offset_8, 11, T[33]);
6078 c = HH(c, d, a, b, M_offset_11, 16, T[34]);
6079 b = HH(b, c, d, a, M_offset_14, 23, T[35]);
6080 a = HH(a, b, c, d, M_offset_1, 4, T[36]);
6081 d = HH(d, a, b, c, M_offset_4, 11, T[37]);
6082 c = HH(c, d, a, b, M_offset_7, 16, T[38]);
6083 b = HH(b, c, d, a, M_offset_10, 23, T[39]);
6084 a = HH(a, b, c, d, M_offset_13, 4, T[40]);
6085 d = HH(d, a, b, c, M_offset_0, 11, T[41]);
6086 c = HH(c, d, a, b, M_offset_3, 16, T[42]);
6087 b = HH(b, c, d, a, M_offset_6, 23, T[43]);
6088 a = HH(a, b, c, d, M_offset_9, 4, T[44]);
6089 d = HH(d, a, b, c, M_offset_12, 11, T[45]);
6090 c = HH(c, d, a, b, M_offset_15, 16, T[46]);
6091 b = HH(b, c, d, a, M_offset_2, 23, T[47]);
6092
6093 a = II(a, b, c, d, M_offset_0, 6, T[48]);
6094 d = II(d, a, b, c, M_offset_7, 10, T[49]);
6095 c = II(c, d, a, b, M_offset_14, 15, T[50]);
6096 b = II(b, c, d, a, M_offset_5, 21, T[51]);
6097 a = II(a, b, c, d, M_offset_12, 6, T[52]);
6098 d = II(d, a, b, c, M_offset_3, 10, T[53]);
6099 c = II(c, d, a, b, M_offset_10, 15, T[54]);
6100 b = II(b, c, d, a, M_offset_1, 21, T[55]);
6101 a = II(a, b, c, d, M_offset_8, 6, T[56]);
6102 d = II(d, a, b, c, M_offset_15, 10, T[57]);
6103 c = II(c, d, a, b, M_offset_6, 15, T[58]);
6104 b = II(b, c, d, a, M_offset_13, 21, T[59]);
6105 a = II(a, b, c, d, M_offset_4, 6, T[60]);
6106 d = II(d, a, b, c, M_offset_11, 10, T[61]);
6107 c = II(c, d, a, b, M_offset_2, 15, T[62]);
6108 b = II(b, c, d, a, M_offset_9, 21, T[63]);
6109
6110 // Intermediate hash value
6111 H[0] = (H[0] + a) | 0;
6112 H[1] = (H[1] + b) | 0;
6113 H[2] = (H[2] + c) | 0;
6114 H[3] = (H[3] + d) | 0;
6115 },
6116
6117 _doFinalize: function () {
6118 // Shortcuts
6119 var data = this._data;
6120 var dataWords = data.words;
6121
6122 var nBitsTotal = this._nDataBytes * 8;
6123 var nBitsLeft = data.sigBytes * 8;
6124
6125 // Add padding
6126 dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
6127
6128 var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
6129 var nBitsTotalL = nBitsTotal;
6130 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (
6131 (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) |
6132 (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00)
6133 );
6134 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
6135 (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) |
6136 (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00)
6137 );
6138
6139 data.sigBytes = (dataWords.length + 1) * 4;
6140
6141 // Hash final blocks
6142 this._process();
6143
6144 // Shortcuts
6145 var hash = this._hash;
6146 var H = hash.words;
6147
6148 // Swap endian
6149 for (var i = 0; i < 4; i++) {
6150 // Shortcut
6151 var H_i = H[i];
6152
6153 H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
6154 (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
6155 }
6156
6157 // Return final computed hash
6158 return hash;
6159 },
6160
6161 clone: function () {
6162 var clone = Hasher.clone.call(this);
6163 clone._hash = this._hash.clone();
6164
6165 return clone;
6166 }
6167 });
6168
6169 function FF(a, b, c, d, x, s, t) {
6170 var n = a + ((b & c) | (~b & d)) + x + t;
6171 return ((n << s) | (n >>> (32 - s))) + b;
6172 }
6173
6174 function GG(a, b, c, d, x, s, t) {
6175 var n = a + ((b & d) | (c & ~d)) + x + t;
6176 return ((n << s) | (n >>> (32 - s))) + b;
6177 }
6178
6179 function HH(a, b, c, d, x, s, t) {
6180 var n = a + (b ^ c ^ d) + x + t;
6181 return ((n << s) | (n >>> (32 - s))) + b;
6182 }
6183
6184 function II(a, b, c, d, x, s, t) {
6185 var n = a + (c ^ (b | ~d)) + x + t;
6186 return ((n << s) | (n >>> (32 - s))) + b;
6187 }
6188
6189 /**
6190 * Shortcut function to the hasher's object interface.
6191 *
6192 * @param {WordArray|string} message The message to hash.
6193 *
6194 * @return {WordArray} The hash.
6195 *
6196 * @static
6197 *
6198 * @example
6199 *
6200 * var hash = CryptoJS.MD5('message');
6201 * var hash = CryptoJS.MD5(wordArray);
6202 */
6203 C.MD5 = Hasher._createHelper(MD5);
6204
6205 /**
6206 * Shortcut function to the HMAC's object interface.
6207 *
6208 * @param {WordArray|string} message The message to hash.
6209 * @param {WordArray|string} key The secret key.
6210 *
6211 * @return {WordArray} The HMAC.
6212 *
6213 * @static
6214 *
6215 * @example
6216 *
6217 * var hmac = CryptoJS.HmacMD5(message, key);
6218 */
6219 C.HmacMD5 = Hasher._createHmacHelper(MD5);
6220}(Math));
6221
6222
6223/***/ }),
6224/* 27 */
6225/***/ (function(module, exports, __webpack_require__) {
6226
6227var CryptoJS = __webpack_require__(3).CryptoJS;
6228
6229(function (Math) {
6230 // Shortcuts
6231 var C = CryptoJS;
6232 var C_lib = C.lib;
6233 var WordArray = C_lib.WordArray;
6234 var Hasher = C_lib.Hasher;
6235 var C_algo = C.algo;
6236
6237 // Initialization and round constants tables
6238 var H = [];
6239 var K = [];
6240
6241 // Compute constants
6242 (function () {
6243 function isPrime(n) {
6244 var sqrtN = Math.sqrt(n);
6245 for (var factor = 2; factor <= sqrtN; factor++) {
6246 if (!(n % factor)) {
6247 return false;
6248 }
6249 }
6250
6251 return true;
6252 }
6253
6254 function getFractionalBits(n) {
6255 return ((n - (n | 0)) * 0x100000000) | 0;
6256 }
6257
6258 var n = 2;
6259 var nPrime = 0;
6260 while (nPrime < 64) {
6261 if (isPrime(n)) {
6262 if (nPrime < 8) {
6263 H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));
6264 }
6265 K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));
6266
6267 nPrime++;
6268 }
6269
6270 n++;
6271 }
6272 }());
6273
6274 // Reusable object
6275 var W = [];
6276
6277 /**
6278 * SHA-256 hash algorithm.
6279 */
6280 var SHA256 = C_algo.SHA256 = Hasher.extend({
6281 _doReset: function () {
6282 this._hash = new WordArray.init(H.slice(0));
6283 },
6284
6285 _doProcessBlock: function (M, offset) {
6286 // Shortcut
6287 var H = this._hash.words;
6288
6289 // Working variables
6290 var a = H[0];
6291 var b = H[1];
6292 var c = H[2];
6293 var d = H[3];
6294 var e = H[4];
6295 var f = H[5];
6296 var g = H[6];
6297 var h = H[7];
6298
6299 // Computation
6300 for (var i = 0; i < 64; i++) {
6301 if (i < 16) {
6302 W[i] = M[offset + i] | 0;
6303 } else {
6304 var gamma0x = W[i - 15];
6305 var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^
6306 ((gamma0x << 14) | (gamma0x >>> 18)) ^
6307 (gamma0x >>> 3);
6308
6309 var gamma1x = W[i - 2];
6310 var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^
6311 ((gamma1x << 13) | (gamma1x >>> 19)) ^
6312 (gamma1x >>> 10);
6313
6314 W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
6315 }
6316
6317 var ch = (e & f) ^ (~e & g);
6318 var maj = (a & b) ^ (a & c) ^ (b & c);
6319
6320 var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));
6321 var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25));
6322
6323 var t1 = h + sigma1 + ch + K[i] + W[i];
6324 var t2 = sigma0 + maj;
6325
6326 h = g;
6327 g = f;
6328 f = e;
6329 e = (d + t1) | 0;
6330 d = c;
6331 c = b;
6332 b = a;
6333 a = (t1 + t2) | 0;
6334 }
6335
6336 // Intermediate hash value
6337 H[0] = (H[0] + a) | 0;
6338 H[1] = (H[1] + b) | 0;
6339 H[2] = (H[2] + c) | 0;
6340 H[3] = (H[3] + d) | 0;
6341 H[4] = (H[4] + e) | 0;
6342 H[5] = (H[5] + f) | 0;
6343 H[6] = (H[6] + g) | 0;
6344 H[7] = (H[7] + h) | 0;
6345 },
6346
6347 _doFinalize: function () {
6348 // Shortcuts
6349 var data = this._data;
6350 var dataWords = data.words;
6351
6352 var nBitsTotal = this._nDataBytes * 8;
6353 var nBitsLeft = data.sigBytes * 8;
6354
6355 // Add padding
6356 dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
6357 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
6358 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
6359 data.sigBytes = dataWords.length * 4;
6360
6361 // Hash final blocks
6362 this._process();
6363
6364 // Return final computed hash
6365 return this._hash;
6366 },
6367
6368 clone: function () {
6369 var clone = Hasher.clone.call(this);
6370 clone._hash = this._hash.clone();
6371
6372 return clone;
6373 }
6374 });
6375
6376 /**
6377 * Shortcut function to the hasher's object interface.
6378 *
6379 * @param {WordArray|string} message The message to hash.
6380 *
6381 * @return {WordArray} The hash.
6382 *
6383 * @static
6384 *
6385 * @example
6386 *
6387 * var hash = CryptoJS.SHA256('message');
6388 * var hash = CryptoJS.SHA256(wordArray);
6389 */
6390 C.SHA256 = Hasher._createHelper(SHA256);
6391
6392 /**
6393 * Shortcut function to the HMAC's object interface.
6394 *
6395 * @param {WordArray|string} message The message to hash.
6396 * @param {WordArray|string} key The secret key.
6397 *
6398 * @return {WordArray} The HMAC.
6399 *
6400 * @static
6401 *
6402 * @example
6403 *
6404 * var hmac = CryptoJS.HmacSHA256(message, key);
6405 */
6406 C.HmacSHA256 = Hasher._createHmacHelper(SHA256);
6407}(Math));
6408
6409/***/ }),
6410/* 28 */
6411/***/ (function(module, __webpack_exports__, __webpack_require__) {
6412
6413"use strict";
6414
6415class MTError extends Error {
6416 static getMessage(code, type, message) {
6417 return `MT[${code}] ${type}: ${message}`;
6418 }
6419 constructor(code, type, message) {
6420 const fullMessage = MTError.getMessage(code, type, message);
6421 super(fullMessage);
6422 this.code = code;
6423 this.type = type;
6424 }
6425}
6426/* unused harmony export MTError */
6427
6428
6429class ErrorBadResponse extends MTError {
6430 constructor(url, originalError = null) {
6431 super(406, 'NETWORK_BAD_RESPONSE', url);
6432 if (originalError) this.originalError = originalError;
6433 }
6434}
6435/* harmony export (immutable) */ __webpack_exports__["b"] = ErrorBadResponse;
6436
6437
6438class ErrorNotFound extends MTError {
6439 constructor(err) {
6440 super(404, 'REQUEST_FAILED', err.config.url);
6441 // this.originalError = err
6442 }
6443}
6444/* harmony export (immutable) */ __webpack_exports__["a"] = ErrorNotFound;
6445
6446
6447/***/ }),
6448/* 29 */
6449/***/ (function(module, __webpack_exports__, __webpack_require__) {
6450
6451"use strict";
6452/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird__ = __webpack_require__(1);
6453/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_bluebird__);
6454/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ramda__ = __webpack_require__(0);
6455/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ramda___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_ramda__);
6456/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__defer__ = __webpack_require__(4);
6457/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__switch__ = __webpack_require__(33);
6458/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__time_manager__ = __webpack_require__(5);
6459
6460
6461
6462
6463
6464
6465
6466
6467const cachedExportPromise = {};
6468
6469const protect = ({ code = NaN, type = '' }, { rawError = null }, dcID, baseDcID) => ({
6470 base: baseDcID,
6471 errR: rawError,
6472 code,
6473 type,
6474 dcID
6475});
6476
6477const patterns = {
6478 noBaseAuth: ({ code, dcID, base }) => code === 401 && dcID === base,
6479 noDcAuth: ({ code, dcID, base }) => code === 401 && dcID !== base,
6480 migrate: ({ code }) => code === 303,
6481 floodWait: ({ code, errR }) => !errR && code === 420,
6482 waitFail: ({ code, type, errR }) => !errR && (code === 500 || type === 'MSG_WAIT_FAILED'),
6483 _: () => true
6484};
6485
6486const matchProtect = matched => (error, options, dcID, emit, rejectPromise, requestThunk, apiSavedNet, apiRecall, deferResolve, mtpInvokeApi, mtpGetNetworker, storage) => matched({
6487 invoke: mtpInvokeApi,
6488 throwNext: () => rejectPromise(error),
6489 reject: rejectPromise,
6490 getNet: mtpGetNetworker,
6491 error,
6492 options,
6493 dcID,
6494 emit,
6495 requestThunk,
6496 apiRecall,
6497 deferResolve,
6498 apiSavedNet,
6499 storage
6500});
6501
6502const noBaseAuth = ({ emit, throwNext, storage }) => {
6503 storage.remove('dc', 'user_auth');
6504 emit('error.401.base');
6505 throwNext();
6506};
6507
6508const noDcAuth = ({ dcID, reject, apiSavedNet, apiRecall, deferResolve, invoke }) => {
6509 const importAuth = ({ id, bytes }) => invoke('auth.importAuthorization', { id, bytes }, { dcID, noErrorBox: true });
6510
6511 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["isNil"])(cachedExportPromise[dcID])) {
6512 const exportDeferred = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__defer__["b" /* default */])();
6513
6514 invoke('auth.exportAuthorization', { dc_id: dcID }, { noErrorBox: true }).then(importAuth).then(exportDeferred.resolve).catch(exportDeferred.reject);
6515
6516 cachedExportPromise[dcID] = exportDeferred.promise;
6517 }
6518
6519 cachedExportPromise[dcID].then(apiSavedNet).then(apiRecall).then(deferResolve).catch(reject);
6520};
6521
6522const migrate = ({ error, dcID, options, reject,
6523 apiRecall, deferResolve, getNet, storage
6524}) => {
6525 const newDcID = error.type.match(/^(PHONE_MIGRATE_|NETWORK_MIGRATE_|USER_MIGRATE_)(\d+)/)[2];
6526 if (newDcID === dcID) return;
6527 if (options.dcID) options.dcID = newDcID;else storage.set({ dc: /*baseDcID =*/newDcID });
6528
6529 getNet(newDcID, options).then(apiRecall).then(deferResolve).catch(reject);
6530};
6531
6532const floodWait = ({ error, options, throwNext, requestThunk }) => {
6533 const waitTime = error.type.match(/^FLOOD_WAIT_(\d+)/)[1] || 10;
6534 if (waitTime > (options.timeout || 60)) return throwNext();
6535 requestThunk(waitTime);
6536};
6537
6538const waitFail = ({ options, throwNext, requestThunk }) => {
6539 const now = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__time_manager__["tsNow"])();
6540 if (options.stopTime) {
6541 if (now >= options.stopTime) return throwNext();
6542 } else options.stopTime = now + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["propOr"])(10, 'timeout', options) * 1000;
6543 options.waitTime = options.waitTime ? Math.min(60, options.waitTime * 1.5) : 1;
6544 requestThunk(options.waitTime);
6545};
6546
6547const def = ({ throwNext }) => throwNext();
6548
6549const switchErrors = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__switch__["a" /* default */])(patterns, protect)({
6550 noBaseAuth,
6551 noDcAuth,
6552 migrate,
6553 floodWait,
6554 waitFail,
6555 _: def
6556}, matchProtect);
6557/* harmony export (immutable) */ __webpack_exports__["a"] = switchErrors;
6558
6559
6560/***/ }),
6561/* 30 */
6562/***/ (function(module, __webpack_exports__, __webpack_require__) {
6563
6564"use strict";
6565/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird__ = __webpack_require__(1);
6566/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_bluebird__);
6567/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__defer__ = __webpack_require__(4);
6568/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__smart_timeout__ = __webpack_require__(8);
6569/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__crypto__ = __webpack_require__(9);
6570/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__secure_random__ = __webpack_require__(7);
6571/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__time_manager__ = __webpack_require__(5);
6572/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__bin__ = __webpack_require__(2);
6573/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__vendor_leemon__ = __webpack_require__(17);
6574/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__send_plain_req__ = __webpack_require__(31);
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587// import { ErrorBadResponse } from '../../error'
6588
6589
6590
6591const primeHex = 'c71caeb9c6b1c9048e6c522f70f13f73980d40238e3e21c14934d037563d93' + '0f48198a0aa7c14058229493d22530f4dbfa336f6e0ac925139543aed44cce7c3720fd51f6945' + '8705ac68cd4fe6b6b13abdc9746512969328454f18faf8c595f642477fe96bb2a941d5bcd1d4a' + 'c8cc49880708fa9b378e3c4f3a9060bee67cf9a4a4a695811051907e162753b56b0f6b410dba7' + '4d8a84b2a14b3144e0ef1284754fd17ed950d5965b4b9dd46582db1178d169c6bc465b0d6ff9c' + 'a3928fef5b9ae4e418fc15e83ebea0f87fa9ff5eed70050ded2849f47bf959d956850ce929851' + 'f0d8115f635b105ee2e4e15d04b2454bf6f4fadf034b10403119cd8e3b92fcc5b';
6592
6593const asyncLog = (...data) => {
6594 const time = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__time_manager__["dTime"])();
6595 console.log(time, ...data);
6596 // setTimeout(() => console.log(time, ...data), 300)
6597};
6598const Auth = ({ Serialization, Deserialization }, { select, prepare }) => {
6599 const sendPlainReq = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_8__send_plain_req__["a" /* default */])({ Serialization, Deserialization });
6600
6601 function mtpSendReqPQ(auth) {
6602 const deferred = auth.deferred;
6603 asyncLog('Send req_pq', __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["f" /* bytesToHex */])(auth.nonce));
6604
6605 const request = new Serialization({ mtproto: true });
6606
6607 request.storeMethod('req_pq', { nonce: auth.nonce });
6608
6609 const keyFoundCheck = key => key ? auth.publicKey = key : __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.reject(new Error('[MT] No public key found'));
6610
6611 const factorizeThunk = () => {
6612 asyncLog('PQ factorization start', auth.pq);
6613 return __WEBPACK_IMPORTED_MODULE_3__crypto__["b" /* default */].factorize(auth.pq);
6614 };
6615 const factDone = ([p, q, it]) => {
6616 auth.p = p;
6617 auth.q = q;
6618 asyncLog('PQ factorization done', it);
6619 return mtpSendReqDhParams(auth);
6620 };
6621
6622 const factFail = error => {
6623 asyncLog('Worker error', error, error.stack);
6624 deferred.reject(error);
6625 };
6626
6627 const factorizer = deserializer => {
6628 const response = deserializer.fetchObject('ResPQ');
6629
6630 if (response._ !== 'resPQ') throw new Error(`[MT] resPQ response invalid: ${response._}`);
6631
6632 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["e" /* bytesCmp */])(auth.nonce, response.nonce)) throw new Error('[MT] resPQ nonce mismatch');
6633
6634 auth.serverNonce = response.server_nonce;
6635 auth.pq = response.pq;
6636 auth.fingerprints = response.server_public_key_fingerprints;
6637
6638 asyncLog('Got ResPQ', __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["f" /* bytesToHex */])(auth.serverNonce), __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["f" /* bytesToHex */])(auth.pq), auth.fingerprints);
6639
6640 return select(auth.fingerprints).then(keyFoundCheck).then(factorizeThunk).then(factDone, factFail);
6641 };
6642
6643 const sendPlainThunk = () => sendPlainReq(auth.dcUrl, request.getBuffer());
6644
6645 return prepare().then(sendPlainThunk).then(factorizer, error => {
6646 console.error(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__time_manager__["dTime"])(), 'req_pq error', error.message);
6647 deferred.reject(error);
6648 });
6649 }
6650
6651 function mtpSendReqDhParams(auth) {
6652 const deferred = auth.deferred;
6653
6654 auth.newNonce = new Array(32);
6655 __WEBPACK_IMPORTED_MODULE_4__secure_random__["a" /* default */].nextBytes(auth.newNonce);
6656
6657 const data = new Serialization({ mtproto: true });
6658 data.storeObject({
6659 _: 'p_q_inner_data',
6660 pq: auth.pq,
6661 p: auth.p,
6662 q: auth.q,
6663 nonce: auth.nonce,
6664 server_nonce: auth.serverNonce,
6665 new_nonce: auth.newNonce
6666 }, 'P_Q_inner_data', 'DECRYPTED_DATA');
6667
6668 const dataWithHash = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["d" /* sha1BytesSync */])(data.getBuffer()).concat(data.getBytes());
6669
6670 const request = new Serialization({ mtproto: true });
6671 request.storeMethod('req_DH_params', {
6672 nonce: auth.nonce,
6673 server_nonce: auth.serverNonce,
6674 p: auth.p,
6675 q: auth.q,
6676 public_key_fingerprint: auth.publicKey.fingerprint,
6677 encrypted_data: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["v" /* rsaEncrypt */])(auth.publicKey, dataWithHash)
6678 });
6679
6680 const afterReqDH = deserializer => {
6681 const response = deserializer.fetchObject('Server_DH_Params', 'RESPONSE');
6682
6683 if (response._ !== 'server_DH_params_fail' && response._ !== 'server_DH_params_ok') {
6684 deferred.reject(new Error(`[MT] Server_DH_Params response invalid: ${response._}`));
6685 return false;
6686 }
6687
6688 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["e" /* bytesCmp */])(auth.nonce, response.nonce)) {
6689 deferred.reject(new Error('[MT] Server_DH_Params nonce mismatch'));
6690 return false;
6691 }
6692
6693 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["e" /* bytesCmp */])(auth.serverNonce, response.server_nonce)) {
6694 deferred.reject(new Error('[MT] Server_DH_Params server_nonce mismatch'));
6695 return false;
6696 }
6697
6698 if (response._ === 'server_DH_params_fail') {
6699 const newNonceHash = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["d" /* sha1BytesSync */])(auth.newNonce).slice(-16);
6700 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["e" /* bytesCmp */])(newNonceHash, response.new_nonce_hash)) {
6701 deferred.reject(new Error('[MT] server_DH_params_fail new_nonce_hash mismatch'));
6702 return false;
6703 }
6704 deferred.reject(new Error('[MT] server_DH_params_fail'));
6705 return false;
6706 }
6707
6708 // try {
6709 mtpDecryptServerDhDataAnswer(auth, response.encrypted_answer);
6710 // } catch (e) {
6711 // deferred.reject(e)
6712 // return false
6713 // }
6714
6715 mtpSendSetClientDhParams(auth);
6716 };
6717
6718 asyncLog('Send req_DH_params');
6719 return sendPlainReq(auth.dcUrl, request.getBuffer()).then(afterReqDH, deferred.reject);
6720 }
6721
6722 function mtpDecryptServerDhDataAnswer(auth, encryptedAnswer) {
6723 auth.tmpAesKey = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["d" /* sha1BytesSync */])(auth.newNonce.concat(auth.serverNonce)).concat(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["d" /* sha1BytesSync */])(auth.serverNonce.concat(auth.newNonce)).slice(0, 12));
6724 auth.tmpAesIv = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["d" /* sha1BytesSync */])(auth.serverNonce.concat(auth.newNonce)).slice(12).concat(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["d" /* sha1BytesSync */])([].concat(auth.newNonce, auth.newNonce)), auth.newNonce.slice(0, 4));
6725
6726 const answerWithHash = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["p" /* aesDecryptSync */])(encryptedAnswer, auth.tmpAesKey, auth.tmpAesIv);
6727
6728 const hash = answerWithHash.slice(0, 20);
6729 const answerWithPadding = answerWithHash.slice(20);
6730 const buffer = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["h" /* bytesToArrayBuffer */])(answerWithPadding);
6731
6732 const deserializer = new Deserialization(buffer, { mtproto: true });
6733 const response = deserializer.fetchObject('Server_DH_inner_data');
6734
6735 if (response._ !== 'server_DH_inner_data') throw new Error(`[MT] server_DH_inner_data response invalid`);
6736
6737 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["e" /* bytesCmp */])(auth.nonce, response.nonce)) throw new Error('[MT] server_DH_inner_data nonce mismatch');
6738
6739 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["e" /* bytesCmp */])(auth.serverNonce, response.server_nonce)) throw new Error('[MT] server_DH_inner_data serverNonce mismatch');
6740
6741 asyncLog('Done decrypting answer');
6742 auth.g = response.g;
6743 auth.dhPrime = response.dh_prime;
6744 auth.gA = response.g_a;
6745 auth.serverTime = response.server_time;
6746 auth.retry = 0;
6747
6748 mtpVerifyDhParams(auth.g, auth.dhPrime, auth.gA);
6749
6750 const offset = deserializer.getOffset();
6751
6752 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["e" /* bytesCmp */])(hash, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["d" /* sha1BytesSync */])(answerWithPadding.slice(0, offset)))) throw new Error('[MT] server_DH_inner_data SHA1-hash mismatch');
6753
6754 auth.localTime = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__time_manager__["tsNow"])();
6755 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__time_manager__["applyServerTime"])(auth.serverTime, auth.localTime);
6756 }
6757
6758 const minSize = Math.ceil(64 / __WEBPACK_IMPORTED_MODULE_7__vendor_leemon__["i" /* bpe */]) + 1;
6759
6760 const getTwoPow = () => {
6761 //Dirty hack to count 2^(2048 - 64)
6762 //This number contains 496 zeroes in hex
6763 const arr = Array(496).fill('0');
6764 arr.unshift('1');
6765 const hex = arr.join('');
6766 const res = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__vendor_leemon__["a" /* str2bigInt */])(hex, 16, minSize);
6767 return res;
6768 };
6769
6770 const leemonTwoPow = getTwoPow();
6771
6772 function mtpVerifyDhParams(g, dhPrime, gA) {
6773 asyncLog('Verifying DH params');
6774 const dhPrimeHex = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["f" /* bytesToHex */])(dhPrime);
6775 if (g !== 3 || dhPrimeHex !== primeHex)
6776 // The verified value is from https://core.telegram.org/mtproto/security_guidelines
6777 throw new Error('[MT] DH params are not verified: unknown dhPrime');
6778 asyncLog('dhPrime cmp OK');
6779
6780 // const gABigInt = new BigInteger(bytesToHex(gA), 16)
6781 // const dhPrimeBigInt = new BigInteger(dhPrimeHex, 16)
6782
6783 const dhPrimeLeemon = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__vendor_leemon__["a" /* str2bigInt */])(dhPrimeHex, 16, minSize);
6784 const gALeemon = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__vendor_leemon__["a" /* str2bigInt */])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["f" /* bytesToHex */])(gA), 16, minSize);
6785 const dhDec = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__vendor_leemon__["s" /* dup */])(dhPrimeLeemon);
6786 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__vendor_leemon__["o" /* sub_ */])(dhDec, __WEBPACK_IMPORTED_MODULE_7__vendor_leemon__["r" /* one */]);
6787 // const dhDecStr = bigInt2str(dhDec, 16)
6788 // const comp = dhPrimeBigInt.subtract(BigInteger.ONE).toString(16)
6789 // console.log(dhPrimeLeemon, dhDecStr === comp)
6790 const case1 = !__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__vendor_leemon__["n" /* greater */])(gALeemon, __WEBPACK_IMPORTED_MODULE_7__vendor_leemon__["r" /* one */]);
6791 //gABigInt.compareTo(BigInteger.ONE) <= 0
6792 const case2 = !__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__vendor_leemon__["n" /* greater */])(dhDec, gALeemon);
6793 //gABigInt.compareTo(dhPrimeBigInt.subtract(BigInteger.ONE)) >= 0
6794 if (case1) throw new Error('[MT] DH params are not verified: gA <= 1');
6795
6796 if (case2) throw new Error('[MT] DH params are not verified: gA >= dhPrime - 1');
6797 // console.log(dTime(), '1 < gA < dhPrime-1 OK')
6798
6799
6800 // const two = new BigInteger(null)
6801 // two.fromInt(2)
6802 // const twoPow = two.pow(2048 - 64)
6803
6804 const case3 = !!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__vendor_leemon__["n" /* greater */])(leemonTwoPow, gALeemon);
6805 //gABigInt.compareTo(twoPow) < 0
6806 const dhSubPow = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__vendor_leemon__["s" /* dup */])(dhPrimeLeemon);
6807 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__vendor_leemon__["t" /* sub */])(dhSubPow, leemonTwoPow);
6808 const case4 = !__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__vendor_leemon__["n" /* greater */])(dhSubPow, gALeemon);
6809 //gABigInt.compareTo(dhPrimeBigInt.subtract(twoPow)) >= 0
6810 // console.log(case3 === gABigInt.compareTo(twoPow) < 0)
6811 if (case3) throw new Error('[MT] DH params are not verified: gA < 2^{2048-64}');
6812 if (case4) throw new Error('[MT] DH params are not verified: gA > dhPrime - 2^{2048-64}');
6813 asyncLog('2^{2048-64} < gA < dhPrime-2^{2048-64} OK');
6814
6815 return true;
6816 }
6817
6818 function mtpSendSetClientDhParams(auth) {
6819 const deferred = auth.deferred;
6820 const gBytes = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["u" /* bytesFromHex */])(auth.g.toString(16));
6821
6822 auth.b = new Array(256);
6823 __WEBPACK_IMPORTED_MODULE_4__secure_random__["a" /* default */].nextBytes(auth.b);
6824
6825 const afterPlainRequest = deserializer => {
6826 const response = deserializer.fetchObject('Set_client_DH_params_answer');
6827
6828 const onAnswer = authKey => {
6829 const authKeyHash = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["d" /* sha1BytesSync */])(authKey),
6830 authKeyAux = authKeyHash.slice(0, 8),
6831 authKeyID = authKeyHash.slice(-8);
6832
6833 asyncLog('Got Set_client_DH_params_answer', response._);
6834 switch (response._) {
6835 case 'dh_gen_ok':
6836 {
6837 const newNonceHash1 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["d" /* sha1BytesSync */])(auth.newNonce.concat([1], authKeyAux)).slice(-16);
6838
6839 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["e" /* bytesCmp */])(newNonceHash1, response.new_nonce_hash1)) {
6840 deferred.reject(new Error('[MT] Set_client_DH_params_answer new_nonce_hash1 mismatch'));
6841 return false;
6842 }
6843
6844 const serverSalt = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["w" /* bytesXor */])(auth.newNonce.slice(0, 8), auth.serverNonce.slice(0, 8));
6845 // console.log('Auth successfull!', authKeyID, authKey, serverSalt)
6846
6847 auth.authKeyID = authKeyID;
6848 auth.authKey = authKey;
6849 auth.serverSalt = serverSalt;
6850
6851 deferred.resolve(auth);
6852 break;
6853 }
6854 case 'dh_gen_retry':
6855 {
6856 const newNonceHash2 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["d" /* sha1BytesSync */])(auth.newNonce.concat([2], authKeyAux)).slice(-16);
6857 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["e" /* bytesCmp */])(newNonceHash2, response.new_nonce_hash2)) {
6858 deferred.reject(new Error('[MT] Set_client_DH_params_answer new_nonce_hash2 mismatch'));
6859 return false;
6860 }
6861
6862 return mtpSendSetClientDhParams(auth);
6863 }
6864 case 'dh_gen_fail':
6865 {
6866 const newNonceHash3 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["d" /* sha1BytesSync */])(auth.newNonce.concat([3], authKeyAux)).slice(-16);
6867 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["e" /* bytesCmp */])(newNonceHash3, response.new_nonce_hash3)) {
6868 deferred.reject(new Error('[MT] Set_client_DH_params_answer new_nonce_hash3 mismatch'));
6869 return false;
6870 }
6871
6872 deferred.reject(new Error('[MT] Set_client_DH_params_answer fail'));
6873 return false;
6874 }
6875 }
6876 };
6877
6878 if (response._ != 'dh_gen_ok' && response._ != 'dh_gen_retry' && response._ != 'dh_gen_fail') {
6879 deferred.reject(new Error(`[MT] Set_client_DH_params_answer response invalid: ${response._}`));
6880 return false;
6881 }
6882
6883 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["e" /* bytesCmp */])(auth.nonce, response.nonce)) {
6884 deferred.reject(new Error('[MT] Set_client_DH_params_answer nonce mismatch'));
6885 return false;
6886 }
6887
6888 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["e" /* bytesCmp */])(auth.serverNonce, response.server_nonce)) {
6889 deferred.reject(new Error('[MT] Set_client_DH_params_answer server_nonce mismatch'));
6890 return false;
6891 }
6892
6893 return __WEBPACK_IMPORTED_MODULE_3__crypto__["b" /* default */].modPow(auth.gA, auth.b, auth.dhPrime).then(onAnswer);
6894 };
6895
6896 const onGb = gB => {
6897 const data = new Serialization({ mtproto: true });
6898 data.storeObject({
6899 _: 'client_DH_inner_data',
6900 nonce: auth.nonce,
6901 server_nonce: auth.serverNonce,
6902 retry_id: [0, auth.retry++],
6903 g_b: gB
6904 }, 'Client_DH_Inner_Data');
6905
6906 const dataWithHash = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["d" /* sha1BytesSync */])(data.getBuffer()).concat(data.getBytes());
6907
6908 const encryptedData = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["o" /* aesEncryptSync */])(dataWithHash, auth.tmpAesKey, auth.tmpAesIv);
6909
6910 const request = new Serialization({ mtproto: true });
6911 request.storeMethod('set_client_DH_params', {
6912 nonce: auth.nonce,
6913 server_nonce: auth.serverNonce,
6914 encrypted_data: encryptedData
6915 });
6916
6917 asyncLog('Send set_client_DH_params');
6918 return sendPlainReq(auth.dcUrl, request.getBuffer()).then(afterPlainRequest);
6919 };
6920
6921 return __WEBPACK_IMPORTED_MODULE_3__crypto__["b" /* default */].modPow(gBytes, auth.b, auth.dhPrime).then(onGb);
6922 }
6923
6924 function mtpAuth(dcID, cached, dcUrl) {
6925 if (cached[dcID]) return cached[dcID].promise;
6926 asyncLog('mtpAuth');
6927 const nonce = [];
6928 for (let i = 0; i < 16; i++) nonce.push(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__bin__["l" /* nextRandomInt */])(0xFF));
6929
6930 if (!dcUrl) return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.reject(new Error(`[MT] No server found for dc ${dcID} url ${dcUrl}`));
6931
6932 const auth = {
6933 dcID,
6934 dcUrl,
6935 nonce,
6936 deferred: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__defer__["b" /* default */])()
6937 };
6938
6939 __WEBPACK_IMPORTED_MODULE_2__smart_timeout__["a" /* smartTimeout */].immediate(() => mtpSendReqPQ(auth));
6940
6941 cached[dcID] = auth.deferred;
6942
6943 cached[dcID].promise.catch(() => {
6944 delete cached[dcID];
6945 });
6946
6947 return cached[dcID].promise;
6948 }
6949
6950 return mtpAuth;
6951};
6952/* unused harmony export Auth */
6953
6954/* harmony default export */ __webpack_exports__["a"] = Auth;
6955
6956/***/ }),
6957/* 31 */
6958/***/ (function(module, __webpack_exports__, __webpack_require__) {
6959
6960"use strict";
6961/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird__ = __webpack_require__(1);
6962/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_bluebird__);
6963/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ramda__ = __webpack_require__(0);
6964/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ramda___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_ramda__);
6965/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__http__ = __webpack_require__(10);
6966/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__error__ = __webpack_require__(28);
6967/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__time_manager__ = __webpack_require__(5);
6968
6969
6970
6971
6972
6973
6974
6975const is404 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["pathEq"])(['response', 'status'], 404);
6976const notError = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["allPass"])([__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["has"])('message'), __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["has"])('type')]);
6977
6978const SendPlain = ({ Serialization, Deserialization }) => {
6979 const onlySendPlainReq = (url, requestBuffer) => {
6980 const requestLength = requestBuffer.byteLength,
6981 requestArray = new Int32Array(requestBuffer);
6982
6983 const header = new Serialization();
6984 header.storeLongP(0, 0, 'auth_key_id'); // Auth key
6985 header.storeLong(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__time_manager__["generateID"])(), 'msg_id'); // Msg_id
6986 header.storeInt(requestLength, 'request_length');
6987
6988 const headerBuffer = header.getBuffer(),
6989 headerArray = new Int32Array(headerBuffer);
6990 const headerLength = headerBuffer.byteLength;
6991
6992 const resultBuffer = new ArrayBuffer(headerLength + requestLength),
6993 resultArray = new Int32Array(resultBuffer);
6994
6995 resultArray.set(headerArray);
6996 resultArray.set(requestArray, headerArray.length);
6997
6998 const requestData = resultArray;
6999 // let reqPromise
7000 // try {
7001 const reqPromise = __WEBPACK_IMPORTED_MODULE_2__http__["b" /* default */].post(url, requestData, {
7002 responseType: 'arraybuffer'
7003 });
7004 // } catch (e) {
7005 // reqPromise = Promise.reject(new ErrorBadResponse(url, e))
7006 // }
7007 return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.props({ url, req: reqPromise });
7008 };
7009
7010 const onlySendPlainErr = err => {
7011 let error;
7012 switch (true) {
7013 case is404(err):
7014 error = new __WEBPACK_IMPORTED_MODULE_3__error__["a" /* ErrorNotFound */](err);
7015 break;
7016 case notError(err):
7017 error = new __WEBPACK_IMPORTED_MODULE_3__error__["b" /* ErrorBadResponse */]('', err);
7018 break;
7019 default:
7020 error = err;
7021 }
7022 return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.reject(error);
7023 };
7024
7025 const onlySendPlainRes = ({ url, req }) => {
7026 if (!req.data || !req.data.byteLength) return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.reject(new __WEBPACK_IMPORTED_MODULE_3__error__["b" /* ErrorBadResponse */](url));
7027 let deserializer;
7028 try {
7029 deserializer = new Deserialization(req.data, { mtproto: true });
7030 const auth_key_id = deserializer.fetchLong('auth_key_id');
7031 const msg_id = deserializer.fetchLong('msg_id');
7032 const msg_len = deserializer.fetchInt('msg_len');
7033 } catch (e) {
7034 return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.reject(new __WEBPACK_IMPORTED_MODULE_3__error__["b" /* ErrorBadResponse */](url, e));
7035 }
7036
7037 return deserializer;
7038 };
7039
7040 const sendPlainReq = (url, requestBuffer) => onlySendPlainReq(url, requestBuffer).then(onlySendPlainRes, onlySendPlainErr);
7041
7042 return sendPlainReq;
7043};
7044
7045/* harmony default export */ __webpack_exports__["a"] = SendPlain;
7046
7047/***/ }),
7048/* 32 */
7049/***/ (function(module, __webpack_exports__, __webpack_require__) {
7050
7051"use strict";
7052/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird__ = __webpack_require__(1);
7053/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_bluebird__);
7054/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__bin__ = __webpack_require__(2);
7055
7056
7057
7058/**
7059* Server public key, obtained from here: https://core.telegram.org/api/obtaining_api_id
7060*
7061* -----BEGIN RSA PUBLIC KEY-----
7062* MIIBCgKCAQEAwVACPi9w23mF3tBkdZz+zwrzKOaaQdr01vAbU4E1pvkfj4sqDsm6
7063* lyDONS789sVoD/xCS9Y0hkkC3gtL1tSfTlgCMOOul9lcixlEKzwKENj1Yz/s7daS
7064* an9tqw3bfUV/nqgbhGX81v/+7RFAEd+RwFnK7a+XYl9sluzHRyVVaTTveB2GazTw
7065* Efzk2DWgkBluml8OREmvfraX3bkHZJTKX4EQSjBbbdJ2ZXIsRrYOXfaA+xayEGB+
7066* 8hdlLmAjbCVfaigxX0CDqWeR1yFL9kwd9P0NsZRPsmoqVwMbMu7mStFai6aIhc3n
7067* Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
7068* -----END RSA PUBLIC KEY-----
7069*/
7070
7071const publisKeysHex = [{
7072 //eslint-disable-next-line
7073 modulus: 'c150023e2f70db7985ded064759cfecf0af328e69a41daf4d6f01b538135a6f91f8f8b2a0ec9ba9720ce352efcf6c5680ffc424bd634864902de0b4bd6d49f4e580230e3ae97d95c8b19442b3c0a10d8f5633fecedd6926a7f6dab0ddb7d457f9ea81b8465fcd6fffeed114011df91c059caedaf97625f6c96ecc74725556934ef781d866b34f011fce4d835a090196e9a5f0e4449af7eb697ddb9076494ca5f81104a305b6dd27665722c46b60e5df680fb16b210607ef217652e60236c255f6a28315f4083a96791d7214bf64c1df4fd0db1944fb26a2a57031b32eee64ad15a8ba68885cde74a5bfc920f6abf59ba5c75506373e7130f9042da922179251f',
7074 exponent: '010001'
7075}];
7076
7077const publicKeysParsed = {}; //TODO Move cache to ApiManager
7078let prepared = false;
7079
7080const KeyManager = Serialization => {
7081
7082 const mapPrepare = ({ modulus, exponent }) => {
7083 const RSAPublicKey = new Serialization();
7084 RSAPublicKey.storeBytes(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__bin__["u" /* bytesFromHex */])(modulus), 'n');
7085 RSAPublicKey.storeBytes(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__bin__["u" /* bytesFromHex */])(exponent), 'e');
7086
7087 const buffer = RSAPublicKey.getBuffer();
7088
7089 const fingerprintBytes = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__bin__["d" /* sha1BytesSync */])(buffer).slice(-8);
7090 fingerprintBytes.reverse();
7091
7092 publicKeysParsed[__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__bin__["f" /* bytesToHex */])(fingerprintBytes)] = {
7093 modulus,
7094 exponent
7095 };
7096 };
7097
7098 const setPrepared = () => {
7099 prepared = true;
7100 };
7101
7102 const prepareRsaKeys = () => prepared ? __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.resolve() : __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.map(publisKeysHex, mapPrepare).then(setPrepared);
7103
7104 const selectRsaKey = fingerprints => () => {
7105 let fingerprintHex, foundKey;
7106 for (let i = 0; i < fingerprints.length; i++) {
7107 fingerprintHex = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__bin__["x" /* strDecToHex */])(fingerprints[i]);
7108 foundKey = publicKeysParsed[fingerprintHex];
7109 if (foundKey) return Object.assign({ fingerprint: fingerprints[i] }, foundKey);
7110 }
7111
7112 return false;
7113 };
7114
7115 const selectRsaKeyByFingerPrint = fingerprints => prepareRsaKeys().then(selectRsaKey(fingerprints));
7116
7117 return {
7118 prepare: prepareRsaKeys,
7119 select: selectRsaKeyByFingerPrint
7120 };
7121};
7122/* unused harmony export KeyManager */
7123
7124
7125/* harmony default export */ __webpack_exports__["a"] = KeyManager;
7126
7127/***/ }),
7128/* 33 */
7129/***/ (function(module, __webpack_exports__, __webpack_require__) {
7130
7131"use strict";
7132const Switch = (patterns, protector = e => e) => (matches, mProtector = e => e) => (...data) => {
7133 const keyList = Object.keys(patterns);
7134 const normalized = protector(...data);
7135 for (const key of keyList) if (patterns[key](normalized)) return mProtector(matches[key]);
7136};
7137/* unused harmony export Switch */
7138
7139
7140/* harmony default export */ __webpack_exports__["a"] = Switch;
7141
7142/***/ }),
7143/* 34 */
7144/***/ (function(module, __webpack_exports__, __webpack_require__) {
7145
7146"use strict";
7147/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_detect_node__ = __webpack_require__(13);
7148/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_detect_node___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_detect_node__);
7149/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ramda__ = __webpack_require__(0);
7150/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ramda___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_ramda__);
7151/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bin__ = __webpack_require__(2);
7152
7153
7154
7155
7156const toUint32 = buf => {
7157 let ln, res;
7158 if (!__WEBPACK_IMPORTED_MODULE_0_detect_node___default.a) //TODO browser behavior not equals, why?
7159 return new Uint32Array(buf);
7160 if (buf.readUInt32LE) {
7161 ln = buf.byteLength / 4;
7162 res = new Uint32Array(ln);
7163 for (let i = 0; i < ln; i++) res[i] = buf.readUInt32LE(i * 4);
7164 } else {
7165 const data = new DataView(buf);
7166 ln = data.byteLength / 4;
7167 res = new Uint32Array(ln);
7168 for (let i = 0; i < ln; i++) res[i] = data.getUint32(i * 4, true);
7169 }
7170 return res;
7171};
7172
7173const TL = (api, mtApi) => {
7174
7175 class Serialization {
7176 constructor({ mtproto = false, startMaxLength = 2048 /* 2Kb */ } = {}) {
7177 this.storeIntString = (value, field) => {
7178 const valType = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["type"])(value);
7179 switch (true) {
7180 case __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["is"])(String, value):
7181 return this.storeString(value, field);
7182 case __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["is"])(Number, value):
7183 return this.storeInt(value, field);
7184 default:
7185 throw new Error(`tl storeIntString field ${field} value type ${valType}`);
7186 }
7187 };
7188
7189 this.storeInt = (i, field = '') => {
7190 this.writeInt(i, `${field}:int`);
7191 };
7192
7193 this.maxLength = startMaxLength;
7194 this.offset = 0; // in bytes
7195
7196 this.createBuffer();
7197 this.mtproto = mtproto;
7198 }
7199
7200 createBuffer() {
7201 this.buffer = new ArrayBuffer(this.maxLength);
7202 this.intView = new Int32Array(this.buffer);
7203 this.byteView = new Uint8Array(this.buffer);
7204 }
7205
7206 getArray() {
7207 const resultBuffer = new ArrayBuffer(this.offset);
7208 const resultArray = new Int32Array(resultBuffer);
7209
7210 resultArray.set(this.intView.subarray(0, this.offset / 4));
7211
7212 return resultArray;
7213 }
7214
7215 getBuffer() {
7216 return this.getArray().buffer;
7217 }
7218
7219 getBytes(typed) {
7220 if (typed) {
7221 const resultBuffer = new ArrayBuffer(this.offset);
7222 const resultArray = new Uint8Array(resultBuffer);
7223
7224 resultArray.set(this.byteView.subarray(0, this.offset));
7225
7226 return resultArray;
7227 }
7228
7229 const bytes = [];
7230 for (let i = 0; i < this.offset; i++) {
7231 bytes.push(this.byteView[i]);
7232 }
7233 return bytes;
7234 }
7235
7236 checkLength(needBytes) {
7237 if (this.offset + needBytes < this.maxLength) {
7238 return;
7239 }
7240
7241 console.trace('Increase buffer', this.offset, needBytes, this.maxLength);
7242 this.maxLength = Math.ceil(Math.max(this.maxLength * 2, this.offset + needBytes + 16) / 4) * 4;
7243 const previousBuffer = this.buffer;
7244 const previousArray = new Int32Array(previousBuffer);
7245
7246 this.createBuffer();
7247
7248 new Int32Array(this.buffer).set(previousArray);
7249 }
7250
7251 writeInt(i, field) {
7252 this.debug && console.log('>>>', i.toString(16), i, field);
7253
7254 this.checkLength(4);
7255 this.intView[this.offset / 4] = i;
7256 this.offset += 4;
7257 }
7258
7259 storeBool(i, field = '') {
7260 if (i) {
7261 this.writeInt(0x997275b5, `${field}:bool`);
7262 } else {
7263 this.writeInt(0xbc799737, `${field}:bool`);
7264 }
7265 }
7266
7267 storeLongP(iHigh, iLow, field) {
7268 this.writeInt(iLow, `${field}:long[low]`);
7269 this.writeInt(iHigh, `${field}:long[high]`);
7270 }
7271
7272 storeLong(sLong, field = '') {
7273 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["is"])(Array, sLong)) return sLong.length === 2 ? this.storeLongP(sLong[0], sLong[1], field) : this.storeIntBytes(sLong, 64, field);
7274
7275 if (typeof sLong !== 'string') sLong = sLong ? sLong.toString() : '0';
7276 const [int1, int2] = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["y" /* longToInts */])(sLong);
7277 this.writeInt(int2, `${field}:long[low]`);
7278 this.writeInt(int1, `${field}:long[high]`);
7279 }
7280
7281 storeDouble(f, field = '') {
7282 const buffer = new ArrayBuffer(8);
7283 const intView = new Int32Array(buffer);
7284 const doubleView = new Float64Array(buffer);
7285
7286 doubleView[0] = f;
7287
7288 this.writeInt(intView[0], `${field}:double[low]`);
7289 this.writeInt(intView[1], `${field}:double[high]`);
7290 }
7291
7292 storeString(s, field = '') {
7293 this.debug && console.log('>>>', s, `${field}:string`);
7294
7295 if (s === undefined) {
7296 s = '';
7297 }
7298 const sUTF8 = unescape(encodeURIComponent(s));
7299
7300 this.checkLength(sUTF8.length + 8);
7301
7302 const len = sUTF8.length;
7303 if (len <= 253) {
7304 this.byteView[this.offset++] = len;
7305 } else {
7306 this.byteView[this.offset++] = 254;
7307 this.byteView[this.offset++] = len & 0xFF;
7308 this.byteView[this.offset++] = (len & 0xFF00) >> 8;
7309 this.byteView[this.offset++] = (len & 0xFF0000) >> 16;
7310 }
7311 for (let i = 0; i < len; i++) {
7312 this.byteView[this.offset++] = sUTF8.charCodeAt(i);
7313 }
7314
7315 // Padding
7316 while (this.offset % 4) {
7317 this.byteView[this.offset++] = 0;
7318 }
7319 }
7320
7321 storeBytes(bytes, field = '') {
7322 if (bytes instanceof ArrayBuffer) {
7323 bytes = new Uint8Array(bytes);
7324 } else if (bytes === undefined) {
7325 bytes = [];
7326 }
7327 this.debug && console.log('>>>', __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["f" /* bytesToHex */])(bytes), `${field}:bytes`);
7328
7329 const len = bytes.byteLength || bytes.length;
7330 this.checkLength(len + 8);
7331 if (len <= 253) {
7332 this.byteView[this.offset++] = len;
7333 } else {
7334 this.byteView[this.offset++] = 254;
7335 this.byteView[this.offset++] = len & 0xFF;
7336 this.byteView[this.offset++] = (len & 0xFF00) >> 8;
7337 this.byteView[this.offset++] = (len & 0xFF0000) >> 16;
7338 }
7339
7340 this.byteView.set(bytes, this.offset);
7341 this.offset += len;
7342
7343 // Padding
7344 while (this.offset % 4) {
7345 this.byteView[this.offset++] = 0;
7346 }
7347 }
7348
7349 storeIntBytes(bytes, bits, field = '') {
7350 if (bytes instanceof ArrayBuffer) {
7351 bytes = new Uint8Array(bytes);
7352 }
7353 const len = bytes.length;
7354 if (bits % 32 || len * 8 != bits) {
7355 throw new Error(`Invalid bits: ${bits}, ${bytes.length}`);
7356 }
7357
7358 this.debug && console.log('>>>', __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["f" /* bytesToHex */])(bytes), `${field}:int${bits}`);
7359 this.checkLength(len);
7360
7361 this.byteView.set(bytes, this.offset);
7362 this.offset += len;
7363 }
7364
7365 storeRawBytes(bytes, field = '') {
7366 if (bytes instanceof ArrayBuffer) {
7367 bytes = new Uint8Array(bytes);
7368 }
7369 const len = bytes.length;
7370
7371 this.debug && console.log('>>>', __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["f" /* bytesToHex */])(bytes), field);
7372 this.checkLength(len);
7373
7374 this.byteView.set(bytes, this.offset);
7375 this.offset += len;
7376 }
7377
7378 storeMethod(methodName, params) {
7379 const schema = this.mtproto ? mtApi : api;
7380 let methodData = false;
7381
7382 for (let i = 0; i < schema.methods.length; i++) {
7383 if (schema.methods[i].method == methodName) {
7384 methodData = schema.methods[i];
7385 break;
7386 }
7387 }
7388 if (!methodData) {
7389 throw new Error(`No method ${methodName} found`);
7390 }
7391
7392 this.storeInt(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["z" /* intToUint */])(methodData.id), `${methodName}[id]`);
7393
7394 let param, type;
7395 let condType;
7396 let fieldBit;
7397 const len = methodData.params.length;
7398 for (let i = 0; i < len; i++) {
7399 param = methodData.params[i];
7400 type = param.type;
7401 if (type.indexOf('?') !== -1) {
7402 condType = type.split('?');
7403 fieldBit = condType[0].split('.');
7404 if (!(params[fieldBit[0]] & 1 << fieldBit[1])) {
7405 continue;
7406 }
7407 type = condType[1];
7408 }
7409
7410 this.storeObject(params[param.name], type, `${methodName}[${param.name}]`);
7411 }
7412
7413 return methodData.type;
7414 }
7415
7416 storeObject(obj, type, field) {
7417 switch (type) {
7418 case '#':
7419 case 'int':
7420 return this.storeInt(obj, field);
7421 case 'long':
7422 return this.storeLong(obj, field);
7423 case 'int128':
7424 return this.storeIntBytes(obj, 128, field);
7425 case 'int256':
7426 return this.storeIntBytes(obj, 256, field);
7427 case 'int512':
7428 return this.storeIntBytes(obj, 512, field);
7429 case 'string':
7430 return this.storeString(obj, field);
7431 case 'bytes':
7432 return this.storeBytes(obj, field);
7433 case 'double':
7434 return this.storeDouble(obj, field);
7435 case 'Bool':
7436 return this.storeBool(obj, field);
7437 case 'true':
7438 return;
7439 }
7440
7441 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["is"])(Array, obj)) {
7442 if (type.substr(0, 6) == 'Vector') {
7443 this.writeInt(0x1cb5c415, `${field}[id]`);
7444 } else if (type.substr(0, 6) != 'vector') {
7445 throw new Error(`Invalid vector type ${type}`);
7446 }
7447 const itemType = type.substr(7, type.length - 8); // for "Vector<itemType>"
7448 this.writeInt(obj.length, `${field}[count]`);
7449 for (let i = 0; i < obj.length; i++) {
7450 this.storeObject(obj[i], itemType, `${field}[${i}]`);
7451 }
7452 return true;
7453 } else if (type.substr(0, 6).toLowerCase() == 'vector') {
7454 throw new Error('Invalid vector object');
7455 }
7456
7457 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["is"])(Object, obj)) throw new Error(`Invalid object for type ${type}`);
7458
7459 const schema = this.mtproto ? mtApi : api;
7460 const predicate = obj['_'];
7461 let isBare = false;
7462 let constructorData = false;
7463
7464 if (isBare = type.charAt(0) == '%') type = type.substr(1);
7465
7466 for (let i = 0; i < schema.constructors.length; i++) {
7467 if (schema.constructors[i].predicate == predicate) {
7468 constructorData = schema.constructors[i];
7469 break;
7470 }
7471 }
7472 if (!constructorData) throw new Error(`No predicate ${predicate} found`);
7473
7474 if (predicate == type) isBare = true;
7475
7476 if (!isBare) this.writeInt(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["z" /* intToUint */])(constructorData.id), `${field}[${predicate}][id]`);
7477
7478 let param;
7479 let condType;
7480 let fieldBit;
7481 const len = constructorData.params.length;
7482 for (let i = 0; i < len; i++) {
7483 param = constructorData.params[i];
7484 type = param.type;
7485 if (type.indexOf('?') !== -1) {
7486 condType = type.split('?');
7487 fieldBit = condType[0].split('.');
7488 if (!(obj[fieldBit[0]] & 1 << fieldBit[1])) {
7489 continue;
7490 }
7491 type = condType[1];
7492 }
7493
7494 this.storeObject(obj[param.name], type, `${field}[${predicate}][${param.name}]`);
7495 }
7496
7497 return constructorData.type;
7498 }
7499
7500 }
7501
7502 class Deserialization {
7503 constructor(buffer, { mtproto = false, override = {} } = {}) {
7504 this.offset = 0; // in bytes
7505 this.override = override;
7506
7507 this.buffer = buffer;
7508 this.intView = toUint32(this.buffer);
7509 this.byteView = new Uint8Array(this.buffer);
7510 this.mtproto = mtproto;
7511 }
7512
7513 readInt(field) {
7514 if (this.offset >= this.intView.length * 4) {
7515 throw new Error(`Nothing to fetch: ${field}`);
7516 }
7517
7518 const i = this.intView[this.offset / 4];
7519
7520 this.debug && console.log('<<<', i.toString(16), i, field);
7521
7522 this.offset += 4;
7523
7524 return i;
7525 }
7526
7527 fetchInt(field = '') {
7528 return this.readInt(`${field}:int`);
7529 }
7530
7531 fetchDouble(field = '') {
7532 const buffer = new ArrayBuffer(8);
7533 const intView = new Int32Array(buffer);
7534 const doubleView = new Float64Array(buffer);
7535
7536 intView[0] = this.readInt(`${field}:double[low]`), intView[1] = this.readInt(`${field}:double[high]`);
7537
7538 return doubleView[0];
7539 }
7540
7541 fetchLong(field = '') {
7542 const iLow = this.readInt(`${field}:long[low]`);
7543 const iHigh = this.readInt(`${field}:long[high]`);
7544
7545 const longDec = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["A" /* bigint */])(iHigh).shiftLeft(32).add(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["A" /* bigint */])(iLow)).toString();
7546
7547 return longDec;
7548 }
7549
7550 fetchBool(field = '') {
7551 const i = this.readInt(`${field}:bool`);
7552 switch (i) {
7553 case 0x997275b5:
7554 return true;
7555 case 0xbc799737:
7556 return false;
7557 default:
7558 {
7559 this.offset -= 4;
7560 return this.fetchObject('Object', field);
7561 }
7562 }
7563 }
7564
7565 fetchString(field = '') {
7566 let len = this.byteView[this.offset++];
7567
7568 if (len == 254) {
7569 len = this.byteView[this.offset++] | this.byteView[this.offset++] << 8 | this.byteView[this.offset++] << 16;
7570 }
7571
7572 let sUTF8 = '';
7573 for (let i = 0; i < len; i++) {
7574 sUTF8 += String.fromCharCode(this.byteView[this.offset++]);
7575 }
7576
7577 // Padding
7578 while (this.offset % 4) {
7579 this.offset++;
7580 }
7581 let s;
7582 try {
7583 s = decodeURIComponent(escape(sUTF8));
7584 } catch (e) {
7585 s = sUTF8;
7586 }
7587
7588 this.debug && console.log('<<<', s, `${field}:string`);
7589
7590 return s;
7591 }
7592
7593 fetchBytes(field = '') {
7594 let len = this.byteView[this.offset++];
7595
7596 if (len == 254) {
7597 len = this.byteView[this.offset++] | this.byteView[this.offset++] << 8 | this.byteView[this.offset++] << 16;
7598 }
7599
7600 const bytes = this.byteView.subarray(this.offset, this.offset + len);
7601 this.offset += len;
7602
7603 // Padding
7604 while (this.offset % 4) this.offset++;
7605
7606 this.debug && console.log('<<<', __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["f" /* bytesToHex */])(bytes), `${field}:bytes`);
7607
7608 return bytes;
7609 }
7610
7611 fetchIntBytes(bits, typed, field = '') {
7612 if (bits % 32) throw new Error(`Invalid bits: ${bits}`);
7613
7614 const len = bits / 8;
7615 if (typed) {
7616 const result = this.byteView.subarray(this.offset, this.offset + len);
7617 this.offset += len;
7618 return result;
7619 }
7620
7621 const bytes = [];
7622 for (let i = 0; i < len; i++) {
7623 bytes.push(this.byteView[this.offset++]);
7624 }
7625
7626 this.debug && console.log('<<<', __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["f" /* bytesToHex */])(bytes), `${field}:int${bits}`);
7627
7628 return bytes;
7629 }
7630
7631 fetchRawBytes(len, typed, field = '') {
7632 if (len === false) {
7633 len = this.readInt(`${field}_length`);
7634 if (len > this.byteView.byteLength) throw new Error(`Invalid raw bytes length: ${len}, buffer len: ${this.byteView.byteLength}`);
7635 }
7636 let bytes;
7637 if (typed) {
7638 bytes = new Uint8Array(len);
7639 bytes.set(this.byteView.subarray(this.offset, this.offset + len));
7640 this.offset += len;
7641 return bytes;
7642 }
7643
7644 bytes = [];
7645 for (let i = 0; i < len; i++) bytes.push(this.byteView[this.offset++]);
7646
7647 this.debug && console.log('<<<', __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["f" /* bytesToHex */])(bytes), field);
7648
7649 return bytes;
7650 }
7651
7652 fetchObject(type, field) {
7653 switch (type) {
7654 case '#':
7655 case 'int':
7656 return this.fetchInt(field);
7657 case 'long':
7658 return this.fetchLong(field);
7659 case 'int128':
7660 return this.fetchIntBytes(128, false, field);
7661 case 'int256':
7662 return this.fetchIntBytes(256, false, field);
7663 case 'int512':
7664 return this.fetchIntBytes(512, false, field);
7665 case 'string':
7666 return this.fetchString(field);
7667 case 'bytes':
7668 return this.fetchBytes(field);
7669 case 'double':
7670 return this.fetchDouble(field);
7671 case 'Bool':
7672 return this.fetchBool(field);
7673 case 'true':
7674 return true;
7675 }
7676 let fallback;
7677 field = field || type || 'Object';
7678 const subpart = type.substr(0, 6);
7679 if (subpart === 'Vector' || subpart === 'vector') {
7680 if (type.charAt(0) === 'V') {
7681 const constructor = this.readInt(`${field}[id]`);
7682 const constructorCmp = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["j" /* uintToInt */])(constructor);
7683
7684 if (constructorCmp === 0x3072cfa1) {
7685 // Gzip packed
7686 const compressed = this.fetchBytes(`${field}[packed_string]`);
7687 const uncompressed = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["B" /* gzipUncompress */])(compressed);
7688 const buffer = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["h" /* bytesToArrayBuffer */])(uncompressed);
7689 const newDeserializer = new Deserialization(buffer);
7690
7691 return newDeserializer.fetchObject(type, field);
7692 }
7693 if (constructorCmp !== 0x1cb5c415) throw new Error(`Invalid vector constructor ${constructor}`);
7694 }
7695 const len = this.readInt(`${field}[count]`);
7696 const result = [];
7697 if (len > 0) {
7698 const itemType = type.substr(7, type.length - 8); // for "Vector<itemType>"
7699 for (let i = 0; i < len; i++) result.push(this.fetchObject(itemType, `${field}[${i}]`));
7700 }
7701
7702 return result;
7703 }
7704
7705 const schema = this.mtproto ? mtApi : api;
7706 let predicate = false;
7707 let constructorData = false;
7708
7709 if (type.charAt(0) == '%') {
7710 const checkType = type.substr(1);
7711 for (let i = 0; i < schema.constructors.length; i++) {
7712 if (schema.constructors[i].type == checkType) {
7713 constructorData = schema.constructors[i];
7714 break;
7715 }
7716 }
7717 if (!constructorData) {
7718 throw new Error(`Constructor not found for type: ${type}`);
7719 }
7720 } else if (type.charAt(0) >= 97 && type.charAt(0) <= 122) {
7721 for (let i = 0; i < schema.constructors.length; i++) {
7722 if (schema.constructors[i].predicate == type) {
7723 constructorData = schema.constructors[i];
7724 break;
7725 }
7726 }
7727 if (!constructorData) throw new Error(`Constructor not found for predicate: ${type}`);
7728 } else {
7729 const constructor = this.readInt(`${field}[id]`);
7730 const constructorCmp = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["j" /* uintToInt */])(constructor);
7731
7732 if (constructorCmp == 0x3072cfa1) {
7733 // Gzip packed
7734 const compressed = this.fetchBytes(`${field}[packed_string]`);
7735 const uncompressed = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["B" /* gzipUncompress */])(compressed);
7736 const buffer = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["h" /* bytesToArrayBuffer */])(uncompressed);
7737 const newDeserializer = new Deserialization(buffer);
7738
7739 return newDeserializer.fetchObject(type, field);
7740 }
7741
7742 let index = schema.constructorsIndex;
7743 if (!index) {
7744 schema.constructorsIndex = index = {};
7745 for (let i = 0; i < schema.constructors.length; i++) index[schema.constructors[i].id] = i;
7746 }
7747 let i = index[constructorCmp];
7748 if (i) constructorData = schema.constructors[i];
7749
7750 fallback = false;
7751 if (!constructorData && this.mtproto) {
7752 const schemaFallback = api;
7753 for (i = 0; i < schemaFallback.constructors.length; i++) {
7754 if (schemaFallback.constructors[i].id == constructorCmp) {
7755 constructorData = schemaFallback.constructors[i];
7756
7757 delete this.mtproto;
7758 fallback = true;
7759 break;
7760 }
7761 }
7762 }
7763 if (!constructorData) {
7764 throw new Error(`Constructor not found: ${constructor} ${this.fetchInt()} ${this.fetchInt()}`);
7765 }
7766 }
7767
7768 predicate = constructorData.predicate;
7769
7770 const result = { '_': predicate };
7771 const overrideKey = (this.mtproto ? 'mt_' : '') + predicate;
7772
7773 if (this.override[overrideKey]) {
7774 this.override[overrideKey].apply(this, [result, `${field}[${predicate}]`]);
7775 } else {
7776 let param, isCond;
7777 let condType, fieldBit;
7778 let value;
7779 const len = constructorData.params.length;
7780 for (let i = 0; i < len; i++) {
7781 param = constructorData.params[i];
7782 type = param.type;
7783 if (type === '#' && __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["isNil"])(result.pFlags)) result.pFlags = {};
7784
7785 isCond = type.indexOf('?') !== -1;
7786 if (isCond) {
7787 condType = type.split('?');
7788 fieldBit = condType[0].split('.');
7789 if (!(result[fieldBit[0]] & 1 << fieldBit[1])) continue;
7790 type = condType[1];
7791 }
7792
7793 value = this.fetchObject(type, `${field}[${predicate}][${param.name}]`);
7794
7795 if (isCond && type === 'true') result.pFlags[param.name] = value;else result[param.name] = value;
7796 }
7797 }
7798
7799 if (fallback) this.mtproto = true;
7800
7801 return result;
7802 }
7803
7804 getOffset() {
7805 return this.offset;
7806 }
7807
7808 fetchEnd() {
7809 if (this.offset !== this.byteView.length) throw new Error('Fetch end with non-empty buffer');
7810 return true;
7811 }
7812
7813 }
7814
7815 return { Serialization, Deserialization };
7816};
7817/* unused harmony export TL */
7818
7819
7820/* harmony default export */ __webpack_exports__["a"] = TL;
7821
7822/***/ }),
7823/* 35 */
7824/***/ (function(module, exports, __webpack_require__) {
7825
7826var __WEBPACK_AMD_DEFINE_RESULT__;/*!
7827 * EventEmitter2
7828 * https://github.com/hij1nx/EventEmitter2
7829 *
7830 * Copyright (c) 2013 hij1nx
7831 * Licensed under the MIT license.
7832 */
7833;!function(undefined) {
7834
7835 var isArray = Array.isArray ? Array.isArray : function _isArray(obj) {
7836 return Object.prototype.toString.call(obj) === "[object Array]";
7837 };
7838 var defaultMaxListeners = 10;
7839
7840 function init() {
7841 this._events = {};
7842 if (this._conf) {
7843 configure.call(this, this._conf);
7844 }
7845 }
7846
7847 function configure(conf) {
7848 if (conf) {
7849 this._conf = conf;
7850
7851 conf.delimiter && (this.delimiter = conf.delimiter);
7852 this._events.maxListeners = conf.maxListeners !== undefined ? conf.maxListeners : defaultMaxListeners;
7853 conf.wildcard && (this.wildcard = conf.wildcard);
7854 conf.newListener && (this.newListener = conf.newListener);
7855 conf.verboseMemoryLeak && (this.verboseMemoryLeak = conf.verboseMemoryLeak);
7856
7857 if (this.wildcard) {
7858 this.listenerTree = {};
7859 }
7860 } else {
7861 this._events.maxListeners = defaultMaxListeners;
7862 }
7863 }
7864
7865 function logPossibleMemoryLeak(count, eventName) {
7866 var errorMsg = '(node) warning: possible EventEmitter memory ' +
7867 'leak detected. %d listeners added. ' +
7868 'Use emitter.setMaxListeners() to increase limit.';
7869
7870 if(this.verboseMemoryLeak){
7871 errorMsg += ' Event name: %s.';
7872 console.error(errorMsg, count, eventName);
7873 } else {
7874 console.error(errorMsg, count);
7875 }
7876
7877 if (console.trace){
7878 console.trace();
7879 }
7880 }
7881
7882 function EventEmitter(conf) {
7883 this._events = {};
7884 this.newListener = false;
7885 this.verboseMemoryLeak = false;
7886 configure.call(this, conf);
7887 }
7888 EventEmitter.EventEmitter2 = EventEmitter; // backwards compatibility for exporting EventEmitter property
7889
7890 //
7891 // Attention, function return type now is array, always !
7892 // It has zero elements if no any matches found and one or more
7893 // elements (leafs) if there are matches
7894 //
7895 function searchListenerTree(handlers, type, tree, i) {
7896 if (!tree) {
7897 return [];
7898 }
7899 var listeners=[], leaf, len, branch, xTree, xxTree, isolatedBranch, endReached,
7900 typeLength = type.length, currentType = type[i], nextType = type[i+1];
7901 if (i === typeLength && tree._listeners) {
7902 //
7903 // If at the end of the event(s) list and the tree has listeners
7904 // invoke those listeners.
7905 //
7906 if (typeof tree._listeners === 'function') {
7907 handlers && handlers.push(tree._listeners);
7908 return [tree];
7909 } else {
7910 for (leaf = 0, len = tree._listeners.length; leaf < len; leaf++) {
7911 handlers && handlers.push(tree._listeners[leaf]);
7912 }
7913 return [tree];
7914 }
7915 }
7916
7917 if ((currentType === '*' || currentType === '**') || tree[currentType]) {
7918 //
7919 // If the event emitted is '*' at this part
7920 // or there is a concrete match at this patch
7921 //
7922 if (currentType === '*') {
7923 for (branch in tree) {
7924 if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {
7925 listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+1));
7926 }
7927 }
7928 return listeners;
7929 } else if(currentType === '**') {
7930 endReached = (i+1 === typeLength || (i+2 === typeLength && nextType === '*'));
7931 if(endReached && tree._listeners) {
7932 // The next element has a _listeners, add it to the handlers.
7933 listeners = listeners.concat(searchListenerTree(handlers, type, tree, typeLength));
7934 }
7935
7936 for (branch in tree) {
7937 if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {
7938 if(branch === '*' || branch === '**') {
7939 if(tree[branch]._listeners && !endReached) {
7940 listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], typeLength));
7941 }
7942 listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i));
7943 } else if(branch === nextType) {
7944 listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+2));
7945 } else {
7946 // No match on this one, shift into the tree but not in the type array.
7947 listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i));
7948 }
7949 }
7950 }
7951 return listeners;
7952 }
7953
7954 listeners = listeners.concat(searchListenerTree(handlers, type, tree[currentType], i+1));
7955 }
7956
7957 xTree = tree['*'];
7958 if (xTree) {
7959 //
7960 // If the listener tree will allow any match for this part,
7961 // then recursively explore all branches of the tree
7962 //
7963 searchListenerTree(handlers, type, xTree, i+1);
7964 }
7965
7966 xxTree = tree['**'];
7967 if(xxTree) {
7968 if(i < typeLength) {
7969 if(xxTree._listeners) {
7970 // If we have a listener on a '**', it will catch all, so add its handler.
7971 searchListenerTree(handlers, type, xxTree, typeLength);
7972 }
7973
7974 // Build arrays of matching next branches and others.
7975 for(branch in xxTree) {
7976 if(branch !== '_listeners' && xxTree.hasOwnProperty(branch)) {
7977 if(branch === nextType) {
7978 // We know the next element will match, so jump twice.
7979 searchListenerTree(handlers, type, xxTree[branch], i+2);
7980 } else if(branch === currentType) {
7981 // Current node matches, move into the tree.
7982 searchListenerTree(handlers, type, xxTree[branch], i+1);
7983 } else {
7984 isolatedBranch = {};
7985 isolatedBranch[branch] = xxTree[branch];
7986 searchListenerTree(handlers, type, { '**': isolatedBranch }, i+1);
7987 }
7988 }
7989 }
7990 } else if(xxTree._listeners) {
7991 // We have reached the end and still on a '**'
7992 searchListenerTree(handlers, type, xxTree, typeLength);
7993 } else if(xxTree['*'] && xxTree['*']._listeners) {
7994 searchListenerTree(handlers, type, xxTree['*'], typeLength);
7995 }
7996 }
7997
7998 return listeners;
7999 }
8000
8001 function growListenerTree(type, listener) {
8002
8003 type = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
8004
8005 //
8006 // Looks for two consecutive '**', if so, don't add the event at all.
8007 //
8008 for(var i = 0, len = type.length; i+1 < len; i++) {
8009 if(type[i] === '**' && type[i+1] === '**') {
8010 return;
8011 }
8012 }
8013
8014 var tree = this.listenerTree;
8015 var name = type.shift();
8016
8017 while (name !== undefined) {
8018
8019 if (!tree[name]) {
8020 tree[name] = {};
8021 }
8022
8023 tree = tree[name];
8024
8025 if (type.length === 0) {
8026
8027 if (!tree._listeners) {
8028 tree._listeners = listener;
8029 }
8030 else {
8031 if (typeof tree._listeners === 'function') {
8032 tree._listeners = [tree._listeners];
8033 }
8034
8035 tree._listeners.push(listener);
8036
8037 if (
8038 !tree._listeners.warned &&
8039 this._events.maxListeners > 0 &&
8040 tree._listeners.length > this._events.maxListeners
8041 ) {
8042 tree._listeners.warned = true;
8043 logPossibleMemoryLeak.call(this, tree._listeners.length, name);
8044 }
8045 }
8046 return true;
8047 }
8048 name = type.shift();
8049 }
8050 return true;
8051 }
8052
8053 // By default EventEmitters will print a warning if more than
8054 // 10 listeners are added to it. This is a useful default which
8055 // helps finding memory leaks.
8056 //
8057 // Obviously not all Emitters should be limited to 10. This function allows
8058 // that to be increased. Set to zero for unlimited.
8059
8060 EventEmitter.prototype.delimiter = '.';
8061
8062 EventEmitter.prototype.setMaxListeners = function(n) {
8063 if (n !== undefined) {
8064 this._events || init.call(this);
8065 this._events.maxListeners = n;
8066 if (!this._conf) this._conf = {};
8067 this._conf.maxListeners = n;
8068 }
8069 };
8070
8071 EventEmitter.prototype.event = '';
8072
8073 EventEmitter.prototype.once = function(event, fn) {
8074 this.many(event, 1, fn);
8075 return this;
8076 };
8077
8078 EventEmitter.prototype.many = function(event, ttl, fn) {
8079 var self = this;
8080
8081 if (typeof fn !== 'function') {
8082 throw new Error('many only accepts instances of Function');
8083 }
8084
8085 function listener() {
8086 if (--ttl === 0) {
8087 self.off(event, listener);
8088 }
8089 fn.apply(this, arguments);
8090 }
8091
8092 listener._origin = fn;
8093
8094 this.on(event, listener);
8095
8096 return self;
8097 };
8098
8099 EventEmitter.prototype.emit = function() {
8100
8101 this._events || init.call(this);
8102
8103 var type = arguments[0];
8104
8105 if (type === 'newListener' && !this.newListener) {
8106 if (!this._events.newListener) {
8107 return false;
8108 }
8109 }
8110
8111 var al = arguments.length;
8112 var args,l,i,j;
8113 var handler;
8114
8115 if (this._all && this._all.length) {
8116 handler = this._all.slice();
8117 if (al > 3) {
8118 args = new Array(al);
8119 for (j = 0; j < al; j++) args[j] = arguments[j];
8120 }
8121
8122 for (i = 0, l = handler.length; i < l; i++) {
8123 this.event = type;
8124 switch (al) {
8125 case 1:
8126 handler[i].call(this, type);
8127 break;
8128 case 2:
8129 handler[i].call(this, type, arguments[1]);
8130 break;
8131 case 3:
8132 handler[i].call(this, type, arguments[1], arguments[2]);
8133 break;
8134 default:
8135 handler[i].apply(this, args);
8136 }
8137 }
8138 }
8139
8140 if (this.wildcard) {
8141 handler = [];
8142 var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
8143 searchListenerTree.call(this, handler, ns, this.listenerTree, 0);
8144 } else {
8145 handler = this._events[type];
8146 if (typeof handler === 'function') {
8147 this.event = type;
8148 switch (al) {
8149 case 1:
8150 handler.call(this);
8151 break;
8152 case 2:
8153 handler.call(this, arguments[1]);
8154 break;
8155 case 3:
8156 handler.call(this, arguments[1], arguments[2]);
8157 break;
8158 default:
8159 args = new Array(al - 1);
8160 for (j = 1; j < al; j++) args[j - 1] = arguments[j];
8161 handler.apply(this, args);
8162 }
8163 return true;
8164 } else if (handler) {
8165 // need to make copy of handlers because list can change in the middle
8166 // of emit call
8167 handler = handler.slice();
8168 }
8169 }
8170
8171 if (handler && handler.length) {
8172 if (al > 3) {
8173 args = new Array(al - 1);
8174 for (j = 1; j < al; j++) args[j - 1] = arguments[j];
8175 }
8176 for (i = 0, l = handler.length; i < l; i++) {
8177 this.event = type;
8178 switch (al) {
8179 case 1:
8180 handler[i].call(this);
8181 break;
8182 case 2:
8183 handler[i].call(this, arguments[1]);
8184 break;
8185 case 3:
8186 handler[i].call(this, arguments[1], arguments[2]);
8187 break;
8188 default:
8189 handler[i].apply(this, args);
8190 }
8191 }
8192 return true;
8193 } else if (!this._all && type === 'error') {
8194 if (arguments[1] instanceof Error) {
8195 throw arguments[1]; // Unhandled 'error' event
8196 } else {
8197 throw new Error("Uncaught, unspecified 'error' event.");
8198 }
8199 return false;
8200 }
8201
8202 return !!this._all;
8203 };
8204
8205 EventEmitter.prototype.emitAsync = function() {
8206
8207 this._events || init.call(this);
8208
8209 var type = arguments[0];
8210
8211 if (type === 'newListener' && !this.newListener) {
8212 if (!this._events.newListener) { return Promise.resolve([false]); }
8213 }
8214
8215 var promises= [];
8216
8217 var al = arguments.length;
8218 var args,l,i,j;
8219 var handler;
8220
8221 if (this._all) {
8222 if (al > 3) {
8223 args = new Array(al);
8224 for (j = 1; j < al; j++) args[j] = arguments[j];
8225 }
8226 for (i = 0, l = this._all.length; i < l; i++) {
8227 this.event = type;
8228 switch (al) {
8229 case 1:
8230 promises.push(this._all[i].call(this, type));
8231 break;
8232 case 2:
8233 promises.push(this._all[i].call(this, type, arguments[1]));
8234 break;
8235 case 3:
8236 promises.push(this._all[i].call(this, type, arguments[1], arguments[2]));
8237 break;
8238 default:
8239 promises.push(this._all[i].apply(this, args));
8240 }
8241 }
8242 }
8243
8244 if (this.wildcard) {
8245 handler = [];
8246 var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
8247 searchListenerTree.call(this, handler, ns, this.listenerTree, 0);
8248 } else {
8249 handler = this._events[type];
8250 }
8251
8252 if (typeof handler === 'function') {
8253 this.event = type;
8254 switch (al) {
8255 case 1:
8256 promises.push(handler.call(this));
8257 break;
8258 case 2:
8259 promises.push(handler.call(this, arguments[1]));
8260 break;
8261 case 3:
8262 promises.push(handler.call(this, arguments[1], arguments[2]));
8263 break;
8264 default:
8265 args = new Array(al - 1);
8266 for (j = 1; j < al; j++) args[j - 1] = arguments[j];
8267 promises.push(handler.apply(this, args));
8268 }
8269 } else if (handler && handler.length) {
8270 if (al > 3) {
8271 args = new Array(al - 1);
8272 for (j = 1; j < al; j++) args[j - 1] = arguments[j];
8273 }
8274 for (i = 0, l = handler.length; i < l; i++) {
8275 this.event = type;
8276 switch (al) {
8277 case 1:
8278 promises.push(handler[i].call(this));
8279 break;
8280 case 2:
8281 promises.push(handler[i].call(this, arguments[1]));
8282 break;
8283 case 3:
8284 promises.push(handler[i].call(this, arguments[1], arguments[2]));
8285 break;
8286 default:
8287 promises.push(handler[i].apply(this, args));
8288 }
8289 }
8290 } else if (!this._all && type === 'error') {
8291 if (arguments[1] instanceof Error) {
8292 return Promise.reject(arguments[1]); // Unhandled 'error' event
8293 } else {
8294 return Promise.reject("Uncaught, unspecified 'error' event.");
8295 }
8296 }
8297
8298 return Promise.all(promises);
8299 };
8300
8301 EventEmitter.prototype.on = function(type, listener) {
8302 if (typeof type === 'function') {
8303 this.onAny(type);
8304 return this;
8305 }
8306
8307 if (typeof listener !== 'function') {
8308 throw new Error('on only accepts instances of Function');
8309 }
8310 this._events || init.call(this);
8311
8312 // To avoid recursion in the case that type == "newListeners"! Before
8313 // adding it to the listeners, first emit "newListeners".
8314 this.emit('newListener', type, listener);
8315
8316 if (this.wildcard) {
8317 growListenerTree.call(this, type, listener);
8318 return this;
8319 }
8320
8321 if (!this._events[type]) {
8322 // Optimize the case of one listener. Don't need the extra array object.
8323 this._events[type] = listener;
8324 }
8325 else {
8326 if (typeof this._events[type] === 'function') {
8327 // Change to array.
8328 this._events[type] = [this._events[type]];
8329 }
8330
8331 // If we've already got an array, just append.
8332 this._events[type].push(listener);
8333
8334 // Check for listener leak
8335 if (
8336 !this._events[type].warned &&
8337 this._events.maxListeners > 0 &&
8338 this._events[type].length > this._events.maxListeners
8339 ) {
8340 this._events[type].warned = true;
8341 logPossibleMemoryLeak.call(this, this._events[type].length, type);
8342 }
8343 }
8344
8345 return this;
8346 };
8347
8348 EventEmitter.prototype.onAny = function(fn) {
8349 if (typeof fn !== 'function') {
8350 throw new Error('onAny only accepts instances of Function');
8351 }
8352
8353 if (!this._all) {
8354 this._all = [];
8355 }
8356
8357 // Add the function to the event listener collection.
8358 this._all.push(fn);
8359 return this;
8360 };
8361
8362 EventEmitter.prototype.addListener = EventEmitter.prototype.on;
8363
8364 EventEmitter.prototype.off = function(type, listener) {
8365 if (typeof listener !== 'function') {
8366 throw new Error('removeListener only takes instances of Function');
8367 }
8368
8369 var handlers,leafs=[];
8370
8371 if(this.wildcard) {
8372 var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
8373 leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0);
8374 }
8375 else {
8376 // does not use listeners(), so no side effect of creating _events[type]
8377 if (!this._events[type]) return this;
8378 handlers = this._events[type];
8379 leafs.push({_listeners:handlers});
8380 }
8381
8382 for (var iLeaf=0; iLeaf<leafs.length; iLeaf++) {
8383 var leaf = leafs[iLeaf];
8384 handlers = leaf._listeners;
8385 if (isArray(handlers)) {
8386
8387 var position = -1;
8388
8389 for (var i = 0, length = handlers.length; i < length; i++) {
8390 if (handlers[i] === listener ||
8391 (handlers[i].listener && handlers[i].listener === listener) ||
8392 (handlers[i]._origin && handlers[i]._origin === listener)) {
8393 position = i;
8394 break;
8395 }
8396 }
8397
8398 if (position < 0) {
8399 continue;
8400 }
8401
8402 if(this.wildcard) {
8403 leaf._listeners.splice(position, 1);
8404 }
8405 else {
8406 this._events[type].splice(position, 1);
8407 }
8408
8409 if (handlers.length === 0) {
8410 if(this.wildcard) {
8411 delete leaf._listeners;
8412 }
8413 else {
8414 delete this._events[type];
8415 }
8416 }
8417
8418 this.emit("removeListener", type, listener);
8419
8420 return this;
8421 }
8422 else if (handlers === listener ||
8423 (handlers.listener && handlers.listener === listener) ||
8424 (handlers._origin && handlers._origin === listener)) {
8425 if(this.wildcard) {
8426 delete leaf._listeners;
8427 }
8428 else {
8429 delete this._events[type];
8430 }
8431
8432 this.emit("removeListener", type, listener);
8433 }
8434 }
8435
8436 function recursivelyGarbageCollect(root) {
8437 if (root === undefined) {
8438 return;
8439 }
8440 var keys = Object.keys(root);
8441 for (var i in keys) {
8442 var key = keys[i];
8443 var obj = root[key];
8444 if ((obj instanceof Function) || (typeof obj !== "object") || (obj === null))
8445 continue;
8446 if (Object.keys(obj).length > 0) {
8447 recursivelyGarbageCollect(root[key]);
8448 }
8449 if (Object.keys(obj).length === 0) {
8450 delete root[key];
8451 }
8452 }
8453 }
8454 recursivelyGarbageCollect(this.listenerTree);
8455
8456 return this;
8457 };
8458
8459 EventEmitter.prototype.offAny = function(fn) {
8460 var i = 0, l = 0, fns;
8461 if (fn && this._all && this._all.length > 0) {
8462 fns = this._all;
8463 for(i = 0, l = fns.length; i < l; i++) {
8464 if(fn === fns[i]) {
8465 fns.splice(i, 1);
8466 this.emit("removeListenerAny", fn);
8467 return this;
8468 }
8469 }
8470 } else {
8471 fns = this._all;
8472 for(i = 0, l = fns.length; i < l; i++)
8473 this.emit("removeListenerAny", fns[i]);
8474 this._all = [];
8475 }
8476 return this;
8477 };
8478
8479 EventEmitter.prototype.removeListener = EventEmitter.prototype.off;
8480
8481 EventEmitter.prototype.removeAllListeners = function(type) {
8482 if (arguments.length === 0) {
8483 !this._events || init.call(this);
8484 return this;
8485 }
8486
8487 if (this.wildcard) {
8488 var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
8489 var leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0);
8490
8491 for (var iLeaf=0; iLeaf<leafs.length; iLeaf++) {
8492 var leaf = leafs[iLeaf];
8493 leaf._listeners = null;
8494 }
8495 }
8496 else if (this._events) {
8497 this._events[type] = null;
8498 }
8499 return this;
8500 };
8501
8502 EventEmitter.prototype.listeners = function(type) {
8503 if (this.wildcard) {
8504 var handlers = [];
8505 var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
8506 searchListenerTree.call(this, handlers, ns, this.listenerTree, 0);
8507 return handlers;
8508 }
8509
8510 this._events || init.call(this);
8511
8512 if (!this._events[type]) this._events[type] = [];
8513 if (!isArray(this._events[type])) {
8514 this._events[type] = [this._events[type]];
8515 }
8516 return this._events[type];
8517 };
8518
8519 EventEmitter.prototype.listenerCount = function(type) {
8520 return this.listeners(type).length;
8521 };
8522
8523 EventEmitter.prototype.listenersAny = function() {
8524
8525 if(this._all) {
8526 return this._all;
8527 }
8528 else {
8529 return [];
8530 }
8531
8532 };
8533
8534 if (true) {
8535 // AMD. Register as an anonymous module.
8536 !(__WEBPACK_AMD_DEFINE_RESULT__ = function() {
8537 return EventEmitter;
8538 }.call(exports, __webpack_require__, exports, module),
8539 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
8540 } else if (typeof exports === 'object') {
8541 // CommonJS
8542 module.exports = EventEmitter;
8543 }
8544 else {
8545 // Browser global.
8546 window.EventEmitter2 = EventEmitter;
8547 }
8548}();
8549
8550
8551/***/ }),
8552/* 36 */
8553/***/ (function(module, exports, __webpack_require__) {
8554
8555/* WEBPACK VAR INJECTION */(function(global) {(function () {
8556 var /*
8557 * Rusha, a JavaScript implementation of the Secure Hash Algorithm, SHA-1,
8558 * as defined in FIPS PUB 180-1, tuned for high performance with large inputs.
8559 * (http://github.com/srijs/rusha)
8560 *
8561 * Inspired by Paul Johnstons implementation (http://pajhome.org.uk/crypt/md5).
8562 *
8563 * Copyright (c) 2013 Sam Rijs (http://awesam.de).
8564 * Released under the terms of the MIT license as follows:
8565 *
8566 * Permission is hereby granted, free of charge, to any person obtaining a
8567 * copy of this software and associated documentation files (the "Software"),
8568 * to deal in the Software without restriction, including without limitation
8569 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8570 * and/or sell copies of the Software, and to permit persons to whom the
8571 * Software is furnished to do so, subject to the following conditions:
8572 *
8573 * The above copyright notice and this permission notice shall be included in
8574 * all copies or substantial portions of the Software.
8575 *
8576 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
8577 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
8578 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
8579 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
8580 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
8581 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
8582 * IN THE SOFTWARE.
8583 */
8584 util = {
8585 getDataType: function (data) {
8586 if (typeof data === 'string') {
8587 return 'string';
8588 }
8589 if (data instanceof Array) {
8590 return 'array';
8591 }
8592 if (typeof global !== 'undefined' && global.Buffer && global.Buffer.isBuffer(data)) {
8593 return 'buffer';
8594 }
8595 if (data instanceof ArrayBuffer) {
8596 return 'arraybuffer';
8597 }
8598 if (data.buffer instanceof ArrayBuffer) {
8599 return 'view';
8600 }
8601 if (data instanceof Blob) {
8602 return 'blob';
8603 }
8604 throw new Error('Unsupported data type.');
8605 }
8606 };
8607 function Rusha(chunkSize) {
8608 'use strict';
8609 var // Private object structure.
8610 self$2 = { fill: 0 };
8611 var // Calculate the length of buffer that the sha1 routine uses
8612 // including the padding.
8613 padlen = function (len) {
8614 for (len += 9; len % 64 > 0; len += 1);
8615 return len;
8616 };
8617 var padZeroes = function (bin, len) {
8618 var h8 = new Uint8Array(bin.buffer);
8619 var om = len % 4, align = len - om;
8620 switch (om) {
8621 case 0:
8622 h8[align + 3] = 0;
8623 case 1:
8624 h8[align + 2] = 0;
8625 case 2:
8626 h8[align + 1] = 0;
8627 case 3:
8628 h8[align + 0] = 0;
8629 }
8630 for (var i$2 = (len >> 2) + 1; i$2 < bin.length; i$2++)
8631 bin[i$2] = 0;
8632 };
8633 var padData = function (bin, chunkLen, msgLen) {
8634 bin[chunkLen >> 2] |= 128 << 24 - (chunkLen % 4 << 3);
8635 // To support msgLen >= 2 GiB, use a float division when computing the
8636 // high 32-bits of the big-endian message length in bits.
8637 bin[((chunkLen >> 2) + 2 & ~15) + 14] = msgLen / (1 << 29) | 0;
8638 bin[((chunkLen >> 2) + 2 & ~15) + 15] = msgLen << 3;
8639 };
8640 var // Convert a binary string and write it to the heap.
8641 // A binary string is expected to only contain char codes < 256.
8642 convStr = function (H8, H32, start, len, off) {
8643 var str = this, i$2, om = off % 4, lm = (len + om) % 4, j = len - lm;
8644 switch (om) {
8645 case 0:
8646 H8[off] = str.charCodeAt(start + 3);
8647 case 1:
8648 H8[off + 1 - (om << 1) | 0] = str.charCodeAt(start + 2);
8649 case 2:
8650 H8[off + 2 - (om << 1) | 0] = str.charCodeAt(start + 1);
8651 case 3:
8652 H8[off + 3 - (om << 1) | 0] = str.charCodeAt(start);
8653 }
8654 if (len < lm + om) {
8655 return;
8656 }
8657 for (i$2 = 4 - om; i$2 < j; i$2 = i$2 + 4 | 0) {
8658 H32[off + i$2 >> 2] = str.charCodeAt(start + i$2) << 24 | str.charCodeAt(start + i$2 + 1) << 16 | str.charCodeAt(start + i$2 + 2) << 8 | str.charCodeAt(start + i$2 + 3);
8659 }
8660 switch (lm) {
8661 case 3:
8662 H8[off + j + 1 | 0] = str.charCodeAt(start + j + 2);
8663 case 2:
8664 H8[off + j + 2 | 0] = str.charCodeAt(start + j + 1);
8665 case 1:
8666 H8[off + j + 3 | 0] = str.charCodeAt(start + j);
8667 }
8668 };
8669 var // Convert a buffer or array and write it to the heap.
8670 // The buffer or array is expected to only contain elements < 256.
8671 convBuf = function (H8, H32, start, len, off) {
8672 var buf = this, i$2, om = off % 4, lm = (len + om) % 4, j = len - lm;
8673 switch (om) {
8674 case 0:
8675 H8[off] = buf[start + 3];
8676 case 1:
8677 H8[off + 1 - (om << 1) | 0] = buf[start + 2];
8678 case 2:
8679 H8[off + 2 - (om << 1) | 0] = buf[start + 1];
8680 case 3:
8681 H8[off + 3 - (om << 1) | 0] = buf[start];
8682 }
8683 if (len < lm + om) {
8684 return;
8685 }
8686 for (i$2 = 4 - om; i$2 < j; i$2 = i$2 + 4 | 0) {
8687 H32[off + i$2 >> 2 | 0] = buf[start + i$2] << 24 | buf[start + i$2 + 1] << 16 | buf[start + i$2 + 2] << 8 | buf[start + i$2 + 3];
8688 }
8689 switch (lm) {
8690 case 3:
8691 H8[off + j + 1 | 0] = buf[start + j + 2];
8692 case 2:
8693 H8[off + j + 2 | 0] = buf[start + j + 1];
8694 case 1:
8695 H8[off + j + 3 | 0] = buf[start + j];
8696 }
8697 };
8698 var convBlob = function (H8, H32, start, len, off) {
8699 var blob = this, i$2, om = off % 4, lm = (len + om) % 4, j = len - lm;
8700 var buf = new Uint8Array(reader.readAsArrayBuffer(blob.slice(start, start + len)));
8701 switch (om) {
8702 case 0:
8703 H8[off] = buf[3];
8704 case 1:
8705 H8[off + 1 - (om << 1) | 0] = buf[2];
8706 case 2:
8707 H8[off + 2 - (om << 1) | 0] = buf[1];
8708 case 3:
8709 H8[off + 3 - (om << 1) | 0] = buf[0];
8710 }
8711 if (len < lm + om) {
8712 return;
8713 }
8714 for (i$2 = 4 - om; i$2 < j; i$2 = i$2 + 4 | 0) {
8715 H32[off + i$2 >> 2 | 0] = buf[i$2] << 24 | buf[i$2 + 1] << 16 | buf[i$2 + 2] << 8 | buf[i$2 + 3];
8716 }
8717 switch (lm) {
8718 case 3:
8719 H8[off + j + 1 | 0] = buf[j + 2];
8720 case 2:
8721 H8[off + j + 2 | 0] = buf[j + 1];
8722 case 1:
8723 H8[off + j + 3 | 0] = buf[j];
8724 }
8725 };
8726 var convFn = function (data) {
8727 switch (util.getDataType(data)) {
8728 case 'string':
8729 return convStr.bind(data);
8730 case 'array':
8731 return convBuf.bind(data);
8732 case 'buffer':
8733 return convBuf.bind(data);
8734 case 'arraybuffer':
8735 return convBuf.bind(new Uint8Array(data));
8736 case 'view':
8737 return convBuf.bind(new Uint8Array(data.buffer, data.byteOffset, data.byteLength));
8738 case 'blob':
8739 return convBlob.bind(data);
8740 }
8741 };
8742 var slice = function (data, offset) {
8743 switch (util.getDataType(data)) {
8744 case 'string':
8745 return data.slice(offset);
8746 case 'array':
8747 return data.slice(offset);
8748 case 'buffer':
8749 return data.slice(offset);
8750 case 'arraybuffer':
8751 return data.slice(offset);
8752 case 'view':
8753 return data.buffer.slice(offset);
8754 }
8755 };
8756 var // Precompute 00 - ff strings
8757 precomputedHex = new Array(256);
8758 for (var i = 0; i < 256; i++) {
8759 precomputedHex[i] = (i < 16 ? '0' : '') + i.toString(16);
8760 }
8761 var // Convert an ArrayBuffer into its hexadecimal string representation.
8762 hex = function (arrayBuffer) {
8763 var binarray = new Uint8Array(arrayBuffer);
8764 var res = new Array(arrayBuffer.byteLength);
8765 for (var i$2 = 0; i$2 < res.length; i$2++) {
8766 res[i$2] = precomputedHex[binarray[i$2]];
8767 }
8768 return res.join('');
8769 };
8770 var ceilHeapSize = function (v) {
8771 // The asm.js spec says:
8772 // The heap object's byteLength must be either
8773 // 2^n for n in [12, 24) or 2^24 * n for n ≥ 1.
8774 // Also, byteLengths smaller than 2^16 are deprecated.
8775 var p;
8776 if (// If v is smaller than 2^16, the smallest possible solution
8777 // is 2^16.
8778 v <= 65536)
8779 return 65536;
8780 if (// If v < 2^24, we round up to 2^n,
8781 // otherwise we round up to 2^24 * n.
8782 v < 16777216) {
8783 for (p = 1; p < v; p = p << 1);
8784 } else {
8785 for (p = 16777216; p < v; p += 16777216);
8786 }
8787 return p;
8788 };
8789 var // Initialize the internal data structures to a new capacity.
8790 init = function (size) {
8791 if (size % 64 > 0) {
8792 throw new Error('Chunk size must be a multiple of 128 bit');
8793 }
8794 self$2.offset = 0;
8795 self$2.maxChunkLen = size;
8796 self$2.padMaxChunkLen = padlen(size);
8797 // The size of the heap is the sum of:
8798 // 1. The padded input message size
8799 // 2. The extended space the algorithm needs (320 byte)
8800 // 3. The 160 bit state the algoritm uses
8801 self$2.heap = new ArrayBuffer(ceilHeapSize(self$2.padMaxChunkLen + 320 + 20));
8802 self$2.h32 = new Int32Array(self$2.heap);
8803 self$2.h8 = new Int8Array(self$2.heap);
8804 self$2.core = new Rusha._core({
8805 Int32Array: Int32Array,
8806 DataView: DataView
8807 }, {}, self$2.heap);
8808 self$2.buffer = null;
8809 };
8810 // Iinitializethe datastructures according
8811 // to a chunk siyze.
8812 init(chunkSize || 64 * 1024);
8813 var initState = function (heap, padMsgLen) {
8814 self$2.offset = 0;
8815 var io = new Int32Array(heap, padMsgLen + 320, 5);
8816 io[0] = 1732584193;
8817 io[1] = -271733879;
8818 io[2] = -1732584194;
8819 io[3] = 271733878;
8820 io[4] = -1009589776;
8821 };
8822 var padChunk = function (chunkLen, msgLen) {
8823 var padChunkLen = padlen(chunkLen);
8824 var view = new Int32Array(self$2.heap, 0, padChunkLen >> 2);
8825 padZeroes(view, chunkLen);
8826 padData(view, chunkLen, msgLen);
8827 return padChunkLen;
8828 };
8829 var // Write data to the heap.
8830 write = function (data, chunkOffset, chunkLen, off) {
8831 convFn(data)(self$2.h8, self$2.h32, chunkOffset, chunkLen, off || 0);
8832 };
8833 var // Initialize and call the RushaCore,
8834 // assuming an input buffer of length len * 4.
8835 coreCall = function (data, chunkOffset, chunkLen, msgLen, finalize) {
8836 var padChunkLen = chunkLen;
8837 write(data, chunkOffset, chunkLen);
8838 if (finalize) {
8839 padChunkLen = padChunk(chunkLen, msgLen);
8840 }
8841 self$2.core.hash(padChunkLen, self$2.padMaxChunkLen);
8842 };
8843 var getRawDigest = function (heap, padMaxChunkLen) {
8844 var io = new Int32Array(heap, padMaxChunkLen + 320, 5);
8845 var out = new Int32Array(5);
8846 var arr = new DataView(out.buffer);
8847 arr.setInt32(0, io[0], false);
8848 arr.setInt32(4, io[1], false);
8849 arr.setInt32(8, io[2], false);
8850 arr.setInt32(12, io[3], false);
8851 arr.setInt32(16, io[4], false);
8852 return out;
8853 };
8854 var // Calculate the hash digest as an array of 5 32bit integers.
8855 rawDigest = this.rawDigest = function (str) {
8856 var msgLen = str.byteLength || str.length || str.size || 0;
8857 initState(self$2.heap, self$2.padMaxChunkLen);
8858 var chunkOffset = 0, chunkLen = self$2.maxChunkLen, last;
8859 for (chunkOffset = 0; msgLen > chunkOffset + chunkLen; chunkOffset += chunkLen) {
8860 coreCall(str, chunkOffset, chunkLen, msgLen, false);
8861 }
8862 coreCall(str, chunkOffset, msgLen - chunkOffset, msgLen, true);
8863 return getRawDigest(self$2.heap, self$2.padMaxChunkLen);
8864 };
8865 // The digest and digestFrom* interface returns the hash digest
8866 // as a hex string.
8867 this.digest = this.digestFromString = this.digestFromBuffer = this.digestFromArrayBuffer = function (str) {
8868 return hex(rawDigest(str).buffer);
8869 };
8870 this.resetState = function () {
8871 initState(self$2.heap, self$2.padMaxChunkLen);
8872 return this;
8873 };
8874 this.append = function (chunk) {
8875 var chunkOffset = 0;
8876 var chunkLen = chunk.byteLength || chunk.length || chunk.size || 0;
8877 var turnOffset = self$2.offset % self$2.maxChunkLen;
8878 var inputLen;
8879 self$2.offset += chunkLen;
8880 while (chunkOffset < chunkLen) {
8881 inputLen = Math.min(chunkLen - chunkOffset, self$2.maxChunkLen - turnOffset);
8882 write(chunk, chunkOffset, inputLen, turnOffset);
8883 turnOffset += inputLen;
8884 chunkOffset += inputLen;
8885 if (turnOffset === self$2.maxChunkLen) {
8886 self$2.core.hash(self$2.maxChunkLen, self$2.padMaxChunkLen);
8887 turnOffset = 0;
8888 }
8889 }
8890 return this;
8891 };
8892 this.getState = function () {
8893 var turnOffset = self$2.offset % self$2.maxChunkLen;
8894 var heap;
8895 if (!turnOffset) {
8896 var io = new Int32Array(self$2.heap, self$2.padMaxChunkLen + 320, 5);
8897 heap = io.buffer.slice(io.byteOffset, io.byteOffset + io.byteLength);
8898 } else {
8899 heap = self$2.heap.slice(0);
8900 }
8901 return {
8902 offset: self$2.offset,
8903 heap: heap
8904 };
8905 };
8906 this.setState = function (state) {
8907 self$2.offset = state.offset;
8908 if (state.heap.byteLength === 20) {
8909 var io = new Int32Array(self$2.heap, self$2.padMaxChunkLen + 320, 5);
8910 io.set(new Int32Array(state.heap));
8911 } else {
8912 self$2.h32.set(new Int32Array(state.heap));
8913 }
8914 return this;
8915 };
8916 var rawEnd = this.rawEnd = function () {
8917 var msgLen = self$2.offset;
8918 var chunkLen = msgLen % self$2.maxChunkLen;
8919 var padChunkLen = padChunk(chunkLen, msgLen);
8920 self$2.core.hash(padChunkLen, self$2.padMaxChunkLen);
8921 var result = getRawDigest(self$2.heap, self$2.padMaxChunkLen);
8922 initState(self$2.heap, self$2.padMaxChunkLen);
8923 return result;
8924 };
8925 this.end = function () {
8926 return hex(rawEnd().buffer);
8927 };
8928 }
8929 ;
8930 // The low-level RushCore module provides the heart of Rusha,
8931 // a high-speed sha1 implementation working on an Int32Array heap.
8932 // At first glance, the implementation seems complicated, however
8933 // with the SHA1 spec at hand, it is obvious this almost a textbook
8934 // implementation that has a few functions hand-inlined and a few loops
8935 // hand-unrolled.
8936 Rusha._core = function RushaCore(stdlib, foreign, heap) {
8937 'use asm';
8938 var H = new stdlib.Int32Array(heap);
8939 function hash(k, x) {
8940 // k in bytes
8941 k = k | 0;
8942 x = x | 0;
8943 var i = 0, j = 0, y0 = 0, z0 = 0, y1 = 0, z1 = 0, y2 = 0, z2 = 0, y3 = 0, z3 = 0, y4 = 0, z4 = 0, t0 = 0, t1 = 0;
8944 y0 = H[x + 320 >> 2] | 0;
8945 y1 = H[x + 324 >> 2] | 0;
8946 y2 = H[x + 328 >> 2] | 0;
8947 y3 = H[x + 332 >> 2] | 0;
8948 y4 = H[x + 336 >> 2] | 0;
8949 for (i = 0; (i | 0) < (k | 0); i = i + 64 | 0) {
8950 z0 = y0;
8951 z1 = y1;
8952 z2 = y2;
8953 z3 = y3;
8954 z4 = y4;
8955 for (j = 0; (j | 0) < 64; j = j + 4 | 0) {
8956 t1 = H[i + j >> 2] | 0;
8957 t0 = ((y0 << 5 | y0 >>> 27) + (y1 & y2 | ~y1 & y3) | 0) + ((t1 + y4 | 0) + 1518500249 | 0) | 0;
8958 y4 = y3;
8959 y3 = y2;
8960 y2 = y1 << 30 | y1 >>> 2;
8961 y1 = y0;
8962 y0 = t0;
8963 H[k + j >> 2] = t1;
8964 }
8965 for (j = k + 64 | 0; (j | 0) < (k + 80 | 0); j = j + 4 | 0) {
8966 t1 = (H[j - 12 >> 2] ^ H[j - 32 >> 2] ^ H[j - 56 >> 2] ^ H[j - 64 >> 2]) << 1 | (H[j - 12 >> 2] ^ H[j - 32 >> 2] ^ H[j - 56 >> 2] ^ H[j - 64 >> 2]) >>> 31;
8967 t0 = ((y0 << 5 | y0 >>> 27) + (y1 & y2 | ~y1 & y3) | 0) + ((t1 + y4 | 0) + 1518500249 | 0) | 0;
8968 y4 = y3;
8969 y3 = y2;
8970 y2 = y1 << 30 | y1 >>> 2;
8971 y1 = y0;
8972 y0 = t0;
8973 H[j >> 2] = t1;
8974 }
8975 for (j = k + 80 | 0; (j | 0) < (k + 160 | 0); j = j + 4 | 0) {
8976 t1 = (H[j - 12 >> 2] ^ H[j - 32 >> 2] ^ H[j - 56 >> 2] ^ H[j - 64 >> 2]) << 1 | (H[j - 12 >> 2] ^ H[j - 32 >> 2] ^ H[j - 56 >> 2] ^ H[j - 64 >> 2]) >>> 31;
8977 t0 = ((y0 << 5 | y0 >>> 27) + (y1 ^ y2 ^ y3) | 0) + ((t1 + y4 | 0) + 1859775393 | 0) | 0;
8978 y4 = y3;
8979 y3 = y2;
8980 y2 = y1 << 30 | y1 >>> 2;
8981 y1 = y0;
8982 y0 = t0;
8983 H[j >> 2] = t1;
8984 }
8985 for (j = k + 160 | 0; (j | 0) < (k + 240 | 0); j = j + 4 | 0) {
8986 t1 = (H[j - 12 >> 2] ^ H[j - 32 >> 2] ^ H[j - 56 >> 2] ^ H[j - 64 >> 2]) << 1 | (H[j - 12 >> 2] ^ H[j - 32 >> 2] ^ H[j - 56 >> 2] ^ H[j - 64 >> 2]) >>> 31;
8987 t0 = ((y0 << 5 | y0 >>> 27) + (y1 & y2 | y1 & y3 | y2 & y3) | 0) + ((t1 + y4 | 0) - 1894007588 | 0) | 0;
8988 y4 = y3;
8989 y3 = y2;
8990 y2 = y1 << 30 | y1 >>> 2;
8991 y1 = y0;
8992 y0 = t0;
8993 H[j >> 2] = t1;
8994 }
8995 for (j = k + 240 | 0; (j | 0) < (k + 320 | 0); j = j + 4 | 0) {
8996 t1 = (H[j - 12 >> 2] ^ H[j - 32 >> 2] ^ H[j - 56 >> 2] ^ H[j - 64 >> 2]) << 1 | (H[j - 12 >> 2] ^ H[j - 32 >> 2] ^ H[j - 56 >> 2] ^ H[j - 64 >> 2]) >>> 31;
8997 t0 = ((y0 << 5 | y0 >>> 27) + (y1 ^ y2 ^ y3) | 0) + ((t1 + y4 | 0) - 899497514 | 0) | 0;
8998 y4 = y3;
8999 y3 = y2;
9000 y2 = y1 << 30 | y1 >>> 2;
9001 y1 = y0;
9002 y0 = t0;
9003 H[j >> 2] = t1;
9004 }
9005 y0 = y0 + z0 | 0;
9006 y1 = y1 + z1 | 0;
9007 y2 = y2 + z2 | 0;
9008 y3 = y3 + z3 | 0;
9009 y4 = y4 + z4 | 0;
9010 }
9011 H[x + 320 >> 2] = y0;
9012 H[x + 324 >> 2] = y1;
9013 H[x + 328 >> 2] = y2;
9014 H[x + 332 >> 2] = y3;
9015 H[x + 336 >> 2] = y4;
9016 }
9017 return { hash: hash };
9018 };
9019 if (// If we'e running in Node.JS, export a module.
9020 true) {
9021 module.exports = Rusha;
9022 } else if (// If we're running in a DOM context, export
9023 // the Rusha object to toplevel.
9024 typeof window !== 'undefined') {
9025 window.Rusha = Rusha;
9026 }
9027 if (// If we're running in a webworker, accept
9028 // messages containing a jobid and a buffer
9029 // or blob object, and return the hash result.
9030 typeof FileReaderSync !== 'undefined') {
9031 var reader = new FileReaderSync(), hasher = new Rusha(4 * 1024 * 1024);
9032 self.onmessage = function onMessage(event) {
9033 var hash, data = event.data.data;
9034 try {
9035 hash = hasher.digest(data);
9036 self.postMessage({
9037 id: event.data.id,
9038 hash: hash
9039 });
9040 } catch (e) {
9041 self.postMessage({
9042 id: event.data.id,
9043 error: e.name
9044 });
9045 }
9046 };
9047 }
9048}());
9049/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18)))
9050
9051/***/ }),
9052/* 37 */
9053/***/ (function(module, exports, __webpack_require__) {
9054
9055module.exports = function() {
9056 return new Worker(__webpack_require__.p + "hash.worker.js");
9057};
9058
9059/***/ }),
9060/* 38 */
9061/***/ (function(module, exports) {
9062
9063module.exports = {
9064 "constructors": [
9065 {
9066 "id": "-1132882121",
9067 "predicate": "boolFalse",
9068 "params": [],
9069 "type": "Bool"
9070 },
9071 {
9072 "id": "-1720552011",
9073 "predicate": "boolTrue",
9074 "params": [],
9075 "type": "Bool"
9076 },
9077 {
9078 "id": "1072550713",
9079 "predicate": "true",
9080 "params": [],
9081 "type": "True"
9082 },
9083 {
9084 "id": "481674261",
9085 "predicate": "vector",
9086 "params": [],
9087 "type": "Vector t"
9088 },
9089 {
9090 "id": "-994444869",
9091 "predicate": "error",
9092 "params": [
9093 {
9094 "name": "code",
9095 "type": "int"
9096 },
9097 {
9098 "name": "text",
9099 "type": "string"
9100 }
9101 ],
9102 "type": "Error"
9103 },
9104 {
9105 "id": "1450380236",
9106 "predicate": "null",
9107 "params": [],
9108 "type": "Null"
9109 },
9110 {
9111 "id": "2134579434",
9112 "predicate": "inputPeerEmpty",
9113 "params": [],
9114 "type": "InputPeer"
9115 },
9116 {
9117 "id": "2107670217",
9118 "predicate": "inputPeerSelf",
9119 "params": [],
9120 "type": "InputPeer"
9121 },
9122 {
9123 "id": "396093539",
9124 "predicate": "inputPeerChat",
9125 "params": [
9126 {
9127 "name": "chat_id",
9128 "type": "int"
9129 }
9130 ],
9131 "type": "InputPeer"
9132 },
9133 {
9134 "id": "-1182234929",
9135 "predicate": "inputUserEmpty",
9136 "params": [],
9137 "type": "InputUser"
9138 },
9139 {
9140 "id": "-138301121",
9141 "predicate": "inputUserSelf",
9142 "params": [],
9143 "type": "InputUser"
9144 },
9145 {
9146 "id": "-208488460",
9147 "predicate": "inputPhoneContact",
9148 "params": [
9149 {
9150 "name": "client_id",
9151 "type": "long"
9152 },
9153 {
9154 "name": "phone",
9155 "type": "string"
9156 },
9157 {
9158 "name": "first_name",
9159 "type": "string"
9160 },
9161 {
9162 "name": "last_name",
9163 "type": "string"
9164 }
9165 ],
9166 "type": "InputContact"
9167 },
9168 {
9169 "id": "-181407105",
9170 "predicate": "inputFile",
9171 "params": [
9172 {
9173 "name": "id",
9174 "type": "long"
9175 },
9176 {
9177 "name": "parts",
9178 "type": "int"
9179 },
9180 {
9181 "name": "name",
9182 "type": "string"
9183 },
9184 {
9185 "name": "md5_checksum",
9186 "type": "string"
9187 }
9188 ],
9189 "type": "InputFile"
9190 },
9191 {
9192 "id": "-1771768449",
9193 "predicate": "inputMediaEmpty",
9194 "params": [],
9195 "type": "InputMedia"
9196 },
9197 {
9198 "id": "1661770481",
9199 "predicate": "inputMediaUploadedPhoto",
9200 "params": [
9201 {
9202 "name": "flags",
9203 "type": "#"
9204 },
9205 {
9206 "name": "file",
9207 "type": "InputFile"
9208 },
9209 {
9210 "name": "caption",
9211 "type": "string"
9212 },
9213 {
9214 "name": "stickers",
9215 "type": "flags.0?Vector<InputDocument>"
9216 }
9217 ],
9218 "type": "InputMedia"
9219 },
9220 {
9221 "id": "-373312269",
9222 "predicate": "inputMediaPhoto",
9223 "params": [
9224 {
9225 "name": "id",
9226 "type": "InputPhoto"
9227 },
9228 {
9229 "name": "caption",
9230 "type": "string"
9231 }
9232 ],
9233 "type": "InputMedia"
9234 },
9235 {
9236 "id": "-104578748",
9237 "predicate": "inputMediaGeoPoint",
9238 "params": [
9239 {
9240 "name": "geo_point",
9241 "type": "InputGeoPoint"
9242 }
9243 ],
9244 "type": "InputMedia"
9245 },
9246 {
9247 "id": "-1494984313",
9248 "predicate": "inputMediaContact",
9249 "params": [
9250 {
9251 "name": "phone_number",
9252 "type": "string"
9253 },
9254 {
9255 "name": "first_name",
9256 "type": "string"
9257 },
9258 {
9259 "name": "last_name",
9260 "type": "string"
9261 }
9262 ],
9263 "type": "InputMedia"
9264 },
9265 {
9266 "id": "480546647",
9267 "predicate": "inputChatPhotoEmpty",
9268 "params": [],
9269 "type": "InputChatPhoto"
9270 },
9271 {
9272 "id": "-1837345356",
9273 "predicate": "inputChatUploadedPhoto",
9274 "params": [
9275 {
9276 "name": "file",
9277 "type": "InputFile"
9278 }
9279 ],
9280 "type": "InputChatPhoto"
9281 },
9282 {
9283 "id": "-1991004873",
9284 "predicate": "inputChatPhoto",
9285 "params": [
9286 {
9287 "name": "id",
9288 "type": "InputPhoto"
9289 }
9290 ],
9291 "type": "InputChatPhoto"
9292 },
9293 {
9294 "id": "-457104426",
9295 "predicate": "inputGeoPointEmpty",
9296 "params": [],
9297 "type": "InputGeoPoint"
9298 },
9299 {
9300 "id": "-206066487",
9301 "predicate": "inputGeoPoint",
9302 "params": [
9303 {
9304 "name": "lat",
9305 "type": "double"
9306 },
9307 {
9308 "name": "long",
9309 "type": "double"
9310 }
9311 ],
9312 "type": "InputGeoPoint"
9313 },
9314 {
9315 "id": "483901197",
9316 "predicate": "inputPhotoEmpty",
9317 "params": [],
9318 "type": "InputPhoto"
9319 },
9320 {
9321 "id": "-74070332",
9322 "predicate": "inputPhoto",
9323 "params": [
9324 {
9325 "name": "id",
9326 "type": "long"
9327 },
9328 {
9329 "name": "access_hash",
9330 "type": "long"
9331 }
9332 ],
9333 "type": "InputPhoto"
9334 },
9335 {
9336 "id": "342061462",
9337 "predicate": "inputFileLocation",
9338 "params": [
9339 {
9340 "name": "volume_id",
9341 "type": "long"
9342 },
9343 {
9344 "name": "local_id",
9345 "type": "int"
9346 },
9347 {
9348 "name": "secret",
9349 "type": "long"
9350 }
9351 ],
9352 "type": "InputFileLocation"
9353 },
9354 {
9355 "id": "1996904104",
9356 "predicate": "inputAppEvent",
9357 "params": [
9358 {
9359 "name": "time",
9360 "type": "double"
9361 },
9362 {
9363 "name": "type",
9364 "type": "string"
9365 },
9366 {
9367 "name": "peer",
9368 "type": "long"
9369 },
9370 {
9371 "name": "data",
9372 "type": "string"
9373 }
9374 ],
9375 "type": "InputAppEvent"
9376 },
9377 {
9378 "id": "-1649296275",
9379 "predicate": "peerUser",
9380 "params": [
9381 {
9382 "name": "user_id",
9383 "type": "int"
9384 }
9385 ],
9386 "type": "Peer"
9387 },
9388 {
9389 "id": "-1160714821",
9390 "predicate": "peerChat",
9391 "params": [
9392 {
9393 "name": "chat_id",
9394 "type": "int"
9395 }
9396 ],
9397 "type": "Peer"
9398 },
9399 {
9400 "id": "-1432995067",
9401 "predicate": "storage.fileUnknown",
9402 "params": [],
9403 "type": "storage.FileType"
9404 },
9405 {
9406 "id": "8322574",
9407 "predicate": "storage.fileJpeg",
9408 "params": [],
9409 "type": "storage.FileType"
9410 },
9411 {
9412 "id": "-891180321",
9413 "predicate": "storage.fileGif",
9414 "params": [],
9415 "type": "storage.FileType"
9416 },
9417 {
9418 "id": "172975040",
9419 "predicate": "storage.filePng",
9420 "params": [],
9421 "type": "storage.FileType"
9422 },
9423 {
9424 "id": "-1373745011",
9425 "predicate": "storage.filePdf",
9426 "params": [],
9427 "type": "storage.FileType"
9428 },
9429 {
9430 "id": "1384777335",
9431 "predicate": "storage.fileMp3",
9432 "params": [],
9433 "type": "storage.FileType"
9434 },
9435 {
9436 "id": "1258941372",
9437 "predicate": "storage.fileMov",
9438 "params": [],
9439 "type": "storage.FileType"
9440 },
9441 {
9442 "id": "1086091090",
9443 "predicate": "storage.filePartial",
9444 "params": [],
9445 "type": "storage.FileType"
9446 },
9447 {
9448 "id": "-1278304028",
9449 "predicate": "storage.fileMp4",
9450 "params": [],
9451 "type": "storage.FileType"
9452 },
9453 {
9454 "id": "276907596",
9455 "predicate": "storage.fileWebp",
9456 "params": [],
9457 "type": "storage.FileType"
9458 },
9459 {
9460 "id": "2086234950",
9461 "predicate": "fileLocationUnavailable",
9462 "params": [
9463 {
9464 "name": "volume_id",
9465 "type": "long"
9466 },
9467 {
9468 "name": "local_id",
9469 "type": "int"
9470 },
9471 {
9472 "name": "secret",
9473 "type": "long"
9474 }
9475 ],
9476 "type": "FileLocation"
9477 },
9478 {
9479 "id": "1406570614",
9480 "predicate": "fileLocation",
9481 "params": [
9482 {
9483 "name": "dc_id",
9484 "type": "int"
9485 },
9486 {
9487 "name": "volume_id",
9488 "type": "long"
9489 },
9490 {
9491 "name": "local_id",
9492 "type": "int"
9493 },
9494 {
9495 "name": "secret",
9496 "type": "long"
9497 }
9498 ],
9499 "type": "FileLocation"
9500 },
9501 {
9502 "id": "537022650",
9503 "predicate": "userEmpty",
9504 "params": [
9505 {
9506 "name": "id",
9507 "type": "int"
9508 }
9509 ],
9510 "type": "User"
9511 },
9512 {
9513 "id": "1326562017",
9514 "predicate": "userProfilePhotoEmpty",
9515 "params": [],
9516 "type": "UserProfilePhoto"
9517 },
9518 {
9519 "id": "-715532088",
9520 "predicate": "userProfilePhoto",
9521 "params": [
9522 {
9523 "name": "photo_id",
9524 "type": "long"
9525 },
9526 {
9527 "name": "photo_small",
9528 "type": "FileLocation"
9529 },
9530 {
9531 "name": "photo_big",
9532 "type": "FileLocation"
9533 }
9534 ],
9535 "type": "UserProfilePhoto"
9536 },
9537 {
9538 "id": "164646985",
9539 "predicate": "userStatusEmpty",
9540 "params": [],
9541 "type": "UserStatus"
9542 },
9543 {
9544 "id": "-306628279",
9545 "predicate": "userStatusOnline",
9546 "params": [
9547 {
9548 "name": "expires",
9549 "type": "int"
9550 }
9551 ],
9552 "type": "UserStatus"
9553 },
9554 {
9555 "id": "9203775",
9556 "predicate": "userStatusOffline",
9557 "params": [
9558 {
9559 "name": "was_online",
9560 "type": "int"
9561 }
9562 ],
9563 "type": "UserStatus"
9564 },
9565 {
9566 "id": "-1683826688",
9567 "predicate": "chatEmpty",
9568 "params": [
9569 {
9570 "name": "id",
9571 "type": "int"
9572 }
9573 ],
9574 "type": "Chat"
9575 },
9576 {
9577 "id": "-652419756",
9578 "predicate": "chat",
9579 "params": [
9580 {
9581 "name": "flags",
9582 "type": "#"
9583 },
9584 {
9585 "name": "creator",
9586 "type": "flags.0?true"
9587 },
9588 {
9589 "name": "kicked",
9590 "type": "flags.1?true"
9591 },
9592 {
9593 "name": "left",
9594 "type": "flags.2?true"
9595 },
9596 {
9597 "name": "admins_enabled",
9598 "type": "flags.3?true"
9599 },
9600 {
9601 "name": "admin",
9602 "type": "flags.4?true"
9603 },
9604 {
9605 "name": "deactivated",
9606 "type": "flags.5?true"
9607 },
9608 {
9609 "name": "id",
9610 "type": "int"
9611 },
9612 {
9613 "name": "title",
9614 "type": "string"
9615 },
9616 {
9617 "name": "photo",
9618 "type": "ChatPhoto"
9619 },
9620 {
9621 "name": "participants_count",
9622 "type": "int"
9623 },
9624 {
9625 "name": "date",
9626 "type": "int"
9627 },
9628 {
9629 "name": "version",
9630 "type": "int"
9631 },
9632 {
9633 "name": "migrated_to",
9634 "type": "flags.6?InputChannel"
9635 }
9636 ],
9637 "type": "Chat"
9638 },
9639 {
9640 "id": "120753115",
9641 "predicate": "chatForbidden",
9642 "params": [
9643 {
9644 "name": "id",
9645 "type": "int"
9646 },
9647 {
9648 "name": "title",
9649 "type": "string"
9650 }
9651 ],
9652 "type": "Chat"
9653 },
9654 {
9655 "id": "771925524",
9656 "predicate": "chatFull",
9657 "params": [
9658 {
9659 "name": "id",
9660 "type": "int"
9661 },
9662 {
9663 "name": "participants",
9664 "type": "ChatParticipants"
9665 },
9666 {
9667 "name": "chat_photo",
9668 "type": "Photo"
9669 },
9670 {
9671 "name": "notify_settings",
9672 "type": "PeerNotifySettings"
9673 },
9674 {
9675 "name": "exported_invite",
9676 "type": "ExportedChatInvite"
9677 },
9678 {
9679 "name": "bot_info",
9680 "type": "Vector<BotInfo>"
9681 }
9682 ],
9683 "type": "ChatFull"
9684 },
9685 {
9686 "id": "-925415106",
9687 "predicate": "chatParticipant",
9688 "params": [
9689 {
9690 "name": "user_id",
9691 "type": "int"
9692 },
9693 {
9694 "name": "inviter_id",
9695 "type": "int"
9696 },
9697 {
9698 "name": "date",
9699 "type": "int"
9700 }
9701 ],
9702 "type": "ChatParticipant"
9703 },
9704 {
9705 "id": "-57668565",
9706 "predicate": "chatParticipantsForbidden",
9707 "params": [
9708 {
9709 "name": "flags",
9710 "type": "#"
9711 },
9712 {
9713 "name": "chat_id",
9714 "type": "int"
9715 },
9716 {
9717 "name": "self_participant",
9718 "type": "flags.0?ChatParticipant"
9719 }
9720 ],
9721 "type": "ChatParticipants"
9722 },
9723 {
9724 "id": "1061556205",
9725 "predicate": "chatParticipants",
9726 "params": [
9727 {
9728 "name": "chat_id",
9729 "type": "int"
9730 },
9731 {
9732 "name": "participants",
9733 "type": "Vector<ChatParticipant>"
9734 },
9735 {
9736 "name": "version",
9737 "type": "int"
9738 }
9739 ],
9740 "type": "ChatParticipants"
9741 },
9742 {
9743 "id": "935395612",
9744 "predicate": "chatPhotoEmpty",
9745 "params": [],
9746 "type": "ChatPhoto"
9747 },
9748 {
9749 "id": "1632839530",
9750 "predicate": "chatPhoto",
9751 "params": [
9752 {
9753 "name": "photo_small",
9754 "type": "FileLocation"
9755 },
9756 {
9757 "name": "photo_big",
9758 "type": "FileLocation"
9759 }
9760 ],
9761 "type": "ChatPhoto"
9762 },
9763 {
9764 "id": "-2082087340",
9765 "predicate": "messageEmpty",
9766 "params": [
9767 {
9768 "name": "id",
9769 "type": "int"
9770 }
9771 ],
9772 "type": "Message"
9773 },
9774 {
9775 "id": "-1063525281",
9776 "predicate": "message",
9777 "params": [
9778 {
9779 "name": "flags",
9780 "type": "#"
9781 },
9782 {
9783 "name": "out",
9784 "type": "flags.1?true"
9785 },
9786 {
9787 "name": "mentioned",
9788 "type": "flags.4?true"
9789 },
9790 {
9791 "name": "media_unread",
9792 "type": "flags.5?true"
9793 },
9794 {
9795 "name": "silent",
9796 "type": "flags.13?true"
9797 },
9798 {
9799 "name": "post",
9800 "type": "flags.14?true"
9801 },
9802 {
9803 "name": "id",
9804 "type": "int"
9805 },
9806 {
9807 "name": "from_id",
9808 "type": "flags.8?int"
9809 },
9810 {
9811 "name": "to_id",
9812 "type": "Peer"
9813 },
9814 {
9815 "name": "fwd_from",
9816 "type": "flags.2?MessageFwdHeader"
9817 },
9818 {
9819 "name": "via_bot_id",
9820 "type": "flags.11?int"
9821 },
9822 {
9823 "name": "reply_to_msg_id",
9824 "type": "flags.3?int"
9825 },
9826 {
9827 "name": "date",
9828 "type": "int"
9829 },
9830 {
9831 "name": "message",
9832 "type": "string"
9833 },
9834 {
9835 "name": "media",
9836 "type": "flags.9?MessageMedia"
9837 },
9838 {
9839 "name": "reply_markup",
9840 "type": "flags.6?ReplyMarkup"
9841 },
9842 {
9843 "name": "entities",
9844 "type": "flags.7?Vector<MessageEntity>"
9845 },
9846 {
9847 "name": "views",
9848 "type": "flags.10?int"
9849 },
9850 {
9851 "name": "edit_date",
9852 "type": "flags.15?int"
9853 }
9854 ],
9855 "type": "Message"
9856 },
9857 {
9858 "id": "-1642487306",
9859 "predicate": "messageService",
9860 "params": [
9861 {
9862 "name": "flags",
9863 "type": "#"
9864 },
9865 {
9866 "name": "out",
9867 "type": "flags.1?true"
9868 },
9869 {
9870 "name": "mentioned",
9871 "type": "flags.4?true"
9872 },
9873 {
9874 "name": "media_unread",
9875 "type": "flags.5?true"
9876 },
9877 {
9878 "name": "silent",
9879 "type": "flags.13?true"
9880 },
9881 {
9882 "name": "post",
9883 "type": "flags.14?true"
9884 },
9885 {
9886 "name": "id",
9887 "type": "int"
9888 },
9889 {
9890 "name": "from_id",
9891 "type": "flags.8?int"
9892 },
9893 {
9894 "name": "to_id",
9895 "type": "Peer"
9896 },
9897 {
9898 "name": "reply_to_msg_id",
9899 "type": "flags.3?int"
9900 },
9901 {
9902 "name": "date",
9903 "type": "int"
9904 },
9905 {
9906 "name": "action",
9907 "type": "MessageAction"
9908 }
9909 ],
9910 "type": "Message"
9911 },
9912 {
9913 "id": "1038967584",
9914 "predicate": "messageMediaEmpty",
9915 "params": [],
9916 "type": "MessageMedia"
9917 },
9918 {
9919 "id": "1032643901",
9920 "predicate": "messageMediaPhoto",
9921 "params": [
9922 {
9923 "name": "photo",
9924 "type": "Photo"
9925 },
9926 {
9927 "name": "caption",
9928 "type": "string"
9929 }
9930 ],
9931 "type": "MessageMedia"
9932 },
9933 {
9934 "id": "1457575028",
9935 "predicate": "messageMediaGeo",
9936 "params": [
9937 {
9938 "name": "geo",
9939 "type": "GeoPoint"
9940 }
9941 ],
9942 "type": "MessageMedia"
9943 },
9944 {
9945 "id": "1585262393",
9946 "predicate": "messageMediaContact",
9947 "params": [
9948 {
9949 "name": "phone_number",
9950 "type": "string"
9951 },
9952 {
9953 "name": "first_name",
9954 "type": "string"
9955 },
9956 {
9957 "name": "last_name",
9958 "type": "string"
9959 },
9960 {
9961 "name": "user_id",
9962 "type": "int"
9963 }
9964 ],
9965 "type": "MessageMedia"
9966 },
9967 {
9968 "id": "-1618676578",
9969 "predicate": "messageMediaUnsupported",
9970 "params": [],
9971 "type": "MessageMedia"
9972 },
9973 {
9974 "id": "-1230047312",
9975 "predicate": "messageActionEmpty",
9976 "params": [],
9977 "type": "MessageAction"
9978 },
9979 {
9980 "id": "-1503425638",
9981 "predicate": "messageActionChatCreate",
9982 "params": [
9983 {
9984 "name": "title",
9985 "type": "string"
9986 },
9987 {
9988 "name": "users",
9989 "type": "Vector<int>"
9990 }
9991 ],
9992 "type": "MessageAction"
9993 },
9994 {
9995 "id": "-1247687078",
9996 "predicate": "messageActionChatEditTitle",
9997 "params": [
9998 {
9999 "name": "title",
10000 "type": "string"
10001 }
10002 ],
10003 "type": "MessageAction"
10004 },
10005 {
10006 "id": "2144015272",
10007 "predicate": "messageActionChatEditPhoto",
10008 "params": [
10009 {
10010 "name": "photo",
10011 "type": "Photo"
10012 }
10013 ],
10014 "type": "MessageAction"
10015 },
10016 {
10017 "id": "-1780220945",
10018 "predicate": "messageActionChatDeletePhoto",
10019 "params": [],
10020 "type": "MessageAction"
10021 },
10022 {
10023 "id": "1217033015",
10024 "predicate": "messageActionChatAddUser",
10025 "params": [
10026 {
10027 "name": "users",
10028 "type": "Vector<int>"
10029 }
10030 ],
10031 "type": "MessageAction"
10032 },
10033 {
10034 "id": "-1297179892",
10035 "predicate": "messageActionChatDeleteUser",
10036 "params": [
10037 {
10038 "name": "user_id",
10039 "type": "int"
10040 }
10041 ],
10042 "type": "MessageAction"
10043 },
10044 {
10045 "id": "1728035348",
10046 "predicate": "dialog",
10047 "params": [
10048 {
10049 "name": "flags",
10050 "type": "#"
10051 },
10052 {
10053 "name": "peer",
10054 "type": "Peer"
10055 },
10056 {
10057 "name": "top_message",
10058 "type": "int"
10059 },
10060 {
10061 "name": "read_inbox_max_id",
10062 "type": "int"
10063 },
10064 {
10065 "name": "read_outbox_max_id",
10066 "type": "int"
10067 },
10068 {
10069 "name": "unread_count",
10070 "type": "int"
10071 },
10072 {
10073 "name": "notify_settings",
10074 "type": "PeerNotifySettings"
10075 },
10076 {
10077 "name": "pts",
10078 "type": "flags.0?int"
10079 },
10080 {
10081 "name": "draft",
10082 "type": "flags.1?DraftMessage"
10083 }
10084 ],
10085 "type": "Dialog"
10086 },
10087 {
10088 "id": "590459437",
10089 "predicate": "photoEmpty",
10090 "params": [
10091 {
10092 "name": "id",
10093 "type": "long"
10094 }
10095 ],
10096 "type": "Photo"
10097 },
10098 {
10099 "id": "-1836524247",
10100 "predicate": "photo",
10101 "params": [
10102 {
10103 "name": "flags",
10104 "type": "#"
10105 },
10106 {
10107 "name": "has_stickers",
10108 "type": "flags.0?true"
10109 },
10110 {
10111 "name": "id",
10112 "type": "long"
10113 },
10114 {
10115 "name": "access_hash",
10116 "type": "long"
10117 },
10118 {
10119 "name": "date",
10120 "type": "int"
10121 },
10122 {
10123 "name": "sizes",
10124 "type": "Vector<PhotoSize>"
10125 }
10126 ],
10127 "type": "Photo"
10128 },
10129 {
10130 "id": "236446268",
10131 "predicate": "photoSizeEmpty",
10132 "params": [
10133 {
10134 "name": "type",
10135 "type": "string"
10136 }
10137 ],
10138 "type": "PhotoSize"
10139 },
10140 {
10141 "id": "2009052699",
10142 "predicate": "photoSize",
10143 "params": [
10144 {
10145 "name": "type",
10146 "type": "string"
10147 },
10148 {
10149 "name": "location",
10150 "type": "FileLocation"
10151 },
10152 {
10153 "name": "w",
10154 "type": "int"
10155 },
10156 {
10157 "name": "h",
10158 "type": "int"
10159 },
10160 {
10161 "name": "size",
10162 "type": "int"
10163 }
10164 ],
10165 "type": "PhotoSize"
10166 },
10167 {
10168 "id": "-374917894",
10169 "predicate": "photoCachedSize",
10170 "params": [
10171 {
10172 "name": "type",
10173 "type": "string"
10174 },
10175 {
10176 "name": "location",
10177 "type": "FileLocation"
10178 },
10179 {
10180 "name": "w",
10181 "type": "int"
10182 },
10183 {
10184 "name": "h",
10185 "type": "int"
10186 },
10187 {
10188 "name": "bytes",
10189 "type": "bytes"
10190 }
10191 ],
10192 "type": "PhotoSize"
10193 },
10194 {
10195 "id": "286776671",
10196 "predicate": "geoPointEmpty",
10197 "params": [],
10198 "type": "GeoPoint"
10199 },
10200 {
10201 "id": "541710092",
10202 "predicate": "geoPoint",
10203 "params": [
10204 {
10205 "name": "long",
10206 "type": "double"
10207 },
10208 {
10209 "name": "lat",
10210 "type": "double"
10211 }
10212 ],
10213 "type": "GeoPoint"
10214 },
10215 {
10216 "id": "-2128698738",
10217 "predicate": "auth.checkedPhone",
10218 "params": [
10219 {
10220 "name": "phone_registered",
10221 "type": "Bool"
10222 }
10223 ],
10224 "type": "auth.CheckedPhone"
10225 },
10226 {
10227 "id": "1577067778",
10228 "predicate": "auth.sentCode",
10229 "params": [
10230 {
10231 "name": "flags",
10232 "type": "#"
10233 },
10234 {
10235 "name": "phone_registered",
10236 "type": "flags.0?true"
10237 },
10238 {
10239 "name": "type",
10240 "type": "auth.SentCodeType"
10241 },
10242 {
10243 "name": "phone_code_hash",
10244 "type": "string"
10245 },
10246 {
10247 "name": "next_type",
10248 "type": "flags.1?auth.CodeType"
10249 },
10250 {
10251 "name": "timeout",
10252 "type": "flags.2?int"
10253 }
10254 ],
10255 "type": "auth.SentCode"
10256 },
10257 {
10258 "id": "-855308010",
10259 "predicate": "auth.authorization",
10260 "params": [
10261 {
10262 "name": "flags",
10263 "type": "#"
10264 },
10265 {
10266 "name": "tmp_sessions",
10267 "type": "flags.0?int"
10268 },
10269 {
10270 "name": "user",
10271 "type": "User"
10272 }
10273 ],
10274 "type": "auth.Authorization"
10275 },
10276 {
10277 "id": "-543777747",
10278 "predicate": "auth.exportedAuthorization",
10279 "params": [
10280 {
10281 "name": "id",
10282 "type": "int"
10283 },
10284 {
10285 "name": "bytes",
10286 "type": "bytes"
10287 }
10288 ],
10289 "type": "auth.ExportedAuthorization"
10290 },
10291 {
10292 "id": "-1195615476",
10293 "predicate": "inputNotifyPeer",
10294 "params": [
10295 {
10296 "name": "peer",
10297 "type": "InputPeer"
10298 }
10299 ],
10300 "type": "InputNotifyPeer"
10301 },
10302 {
10303 "id": "423314455",
10304 "predicate": "inputNotifyUsers",
10305 "params": [],
10306 "type": "InputNotifyPeer"
10307 },
10308 {
10309 "id": "1251338318",
10310 "predicate": "inputNotifyChats",
10311 "params": [],
10312 "type": "InputNotifyPeer"
10313 },
10314 {
10315 "id": "-1540769658",
10316 "predicate": "inputNotifyAll",
10317 "params": [],
10318 "type": "InputNotifyPeer"
10319 },
10320 {
10321 "id": "-265263912",
10322 "predicate": "inputPeerNotifyEventsEmpty",
10323 "params": [],
10324 "type": "InputPeerNotifyEvents"
10325 },
10326 {
10327 "id": "-395694988",
10328 "predicate": "inputPeerNotifyEventsAll",
10329 "params": [],
10330 "type": "InputPeerNotifyEvents"
10331 },
10332 {
10333 "id": "949182130",
10334 "predicate": "inputPeerNotifySettings",
10335 "params": [
10336 {
10337 "name": "flags",
10338 "type": "#"
10339 },
10340 {
10341 "name": "show_previews",
10342 "type": "flags.0?true"
10343 },
10344 {
10345 "name": "silent",
10346 "type": "flags.1?true"
10347 },
10348 {
10349 "name": "mute_until",
10350 "type": "int"
10351 },
10352 {
10353 "name": "sound",
10354 "type": "string"
10355 }
10356 ],
10357 "type": "InputPeerNotifySettings"
10358 },
10359 {
10360 "id": "-1378534221",
10361 "predicate": "peerNotifyEventsEmpty",
10362 "params": [],
10363 "type": "PeerNotifyEvents"
10364 },
10365 {
10366 "id": "1830677896",
10367 "predicate": "peerNotifyEventsAll",
10368 "params": [],
10369 "type": "PeerNotifyEvents"
10370 },
10371 {
10372 "id": "1889961234",
10373 "predicate": "peerNotifySettingsEmpty",
10374 "params": [],
10375 "type": "PeerNotifySettings"
10376 },
10377 {
10378 "id": "-1697798976",
10379 "predicate": "peerNotifySettings",
10380 "params": [
10381 {
10382 "name": "flags",
10383 "type": "#"
10384 },
10385 {
10386 "name": "show_previews",
10387 "type": "flags.0?true"
10388 },
10389 {
10390 "name": "silent",
10391 "type": "flags.1?true"
10392 },
10393 {
10394 "name": "mute_until",
10395 "type": "int"
10396 },
10397 {
10398 "name": "sound",
10399 "type": "string"
10400 }
10401 ],
10402 "type": "PeerNotifySettings"
10403 },
10404 {
10405 "id": "-2122045747",
10406 "predicate": "peerSettings",
10407 "params": [
10408 {
10409 "name": "flags",
10410 "type": "#"
10411 },
10412 {
10413 "name": "report_spam",
10414 "type": "flags.0?true"
10415 }
10416 ],
10417 "type": "PeerSettings"
10418 },
10419 {
10420 "id": "-860866985",
10421 "predicate": "wallPaper",
10422 "params": [
10423 {
10424 "name": "id",
10425 "type": "int"
10426 },
10427 {
10428 "name": "title",
10429 "type": "string"
10430 },
10431 {
10432 "name": "sizes",
10433 "type": "Vector<PhotoSize>"
10434 },
10435 {
10436 "name": "color",
10437 "type": "int"
10438 }
10439 ],
10440 "type": "WallPaper"
10441 },
10442 {
10443 "id": "1490799288",
10444 "predicate": "inputReportReasonSpam",
10445 "params": [],
10446 "type": "ReportReason"
10447 },
10448 {
10449 "id": "505595789",
10450 "predicate": "inputReportReasonViolence",
10451 "params": [],
10452 "type": "ReportReason"
10453 },
10454 {
10455 "id": "777640226",
10456 "predicate": "inputReportReasonPornography",
10457 "params": [],
10458 "type": "ReportReason"
10459 },
10460 {
10461 "id": "-512463606",
10462 "predicate": "inputReportReasonOther",
10463 "params": [
10464 {
10465 "name": "text",
10466 "type": "string"
10467 }
10468 ],
10469 "type": "ReportReason"
10470 },
10471 {
10472 "id": "1496513539",
10473 "predicate": "userFull",
10474 "params": [
10475 {
10476 "name": "flags",
10477 "type": "#"
10478 },
10479 {
10480 "name": "blocked",
10481 "type": "flags.0?true"
10482 },
10483 {
10484 "name": "user",
10485 "type": "User"
10486 },
10487 {
10488 "name": "about",
10489 "type": "flags.1?string"
10490 },
10491 {
10492 "name": "link",
10493 "type": "contacts.Link"
10494 },
10495 {
10496 "name": "profile_photo",
10497 "type": "flags.2?Photo"
10498 },
10499 {
10500 "name": "notify_settings",
10501 "type": "PeerNotifySettings"
10502 },
10503 {
10504 "name": "bot_info",
10505 "type": "flags.3?BotInfo"
10506 }
10507 ],
10508 "type": "UserFull"
10509 },
10510 {
10511 "id": "-116274796",
10512 "predicate": "contact",
10513 "params": [
10514 {
10515 "name": "user_id",
10516 "type": "int"
10517 },
10518 {
10519 "name": "mutual",
10520 "type": "Bool"
10521 }
10522 ],
10523 "type": "Contact"
10524 },
10525 {
10526 "id": "-805141448",
10527 "predicate": "importedContact",
10528 "params": [
10529 {
10530 "name": "user_id",
10531 "type": "int"
10532 },
10533 {
10534 "name": "client_id",
10535 "type": "long"
10536 }
10537 ],
10538 "type": "ImportedContact"
10539 },
10540 {
10541 "id": "1444661369",
10542 "predicate": "contactBlocked",
10543 "params": [
10544 {
10545 "name": "user_id",
10546 "type": "int"
10547 },
10548 {
10549 "name": "date",
10550 "type": "int"
10551 }
10552 ],
10553 "type": "ContactBlocked"
10554 },
10555 {
10556 "id": "-748155807",
10557 "predicate": "contactStatus",
10558 "params": [
10559 {
10560 "name": "user_id",
10561 "type": "int"
10562 },
10563 {
10564 "name": "status",
10565 "type": "UserStatus"
10566 }
10567 ],
10568 "type": "ContactStatus"
10569 },
10570 {
10571 "id": "986597452",
10572 "predicate": "contacts.link",
10573 "params": [
10574 {
10575 "name": "my_link",
10576 "type": "ContactLink"
10577 },
10578 {
10579 "name": "foreign_link",
10580 "type": "ContactLink"
10581 },
10582 {
10583 "name": "user",
10584 "type": "User"
10585 }
10586 ],
10587 "type": "contacts.Link"
10588 },
10589 {
10590 "id": "-1219778094",
10591 "predicate": "contacts.contactsNotModified",
10592 "params": [],
10593 "type": "contacts.Contacts"
10594 },
10595 {
10596 "id": "1871416498",
10597 "predicate": "contacts.contacts",
10598 "params": [
10599 {
10600 "name": "contacts",
10601 "type": "Vector<Contact>"
10602 },
10603 {
10604 "name": "users",
10605 "type": "Vector<User>"
10606 }
10607 ],
10608 "type": "contacts.Contacts"
10609 },
10610 {
10611 "id": "-1387117803",
10612 "predicate": "contacts.importedContacts",
10613 "params": [
10614 {
10615 "name": "imported",
10616 "type": "Vector<ImportedContact>"
10617 },
10618 {
10619 "name": "retry_contacts",
10620 "type": "Vector<long>"
10621 },
10622 {
10623 "name": "users",
10624 "type": "Vector<User>"
10625 }
10626 ],
10627 "type": "contacts.ImportedContacts"
10628 },
10629 {
10630 "id": "471043349",
10631 "predicate": "contacts.blocked",
10632 "params": [
10633 {
10634 "name": "blocked",
10635 "type": "Vector<ContactBlocked>"
10636 },
10637 {
10638 "name": "users",
10639 "type": "Vector<User>"
10640 }
10641 ],
10642 "type": "contacts.Blocked"
10643 },
10644 {
10645 "id": "-1878523231",
10646 "predicate": "contacts.blockedSlice",
10647 "params": [
10648 {
10649 "name": "count",
10650 "type": "int"
10651 },
10652 {
10653 "name": "blocked",
10654 "type": "Vector<ContactBlocked>"
10655 },
10656 {
10657 "name": "users",
10658 "type": "Vector<User>"
10659 }
10660 ],
10661 "type": "contacts.Blocked"
10662 },
10663 {
10664 "id": "364538944",
10665 "predicate": "messages.dialogs",
10666 "params": [
10667 {
10668 "name": "dialogs",
10669 "type": "Vector<Dialog>"
10670 },
10671 {
10672 "name": "messages",
10673 "type": "Vector<Message>"
10674 },
10675 {
10676 "name": "chats",
10677 "type": "Vector<Chat>"
10678 },
10679 {
10680 "name": "users",
10681 "type": "Vector<User>"
10682 }
10683 ],
10684 "type": "messages.Dialogs"
10685 },
10686 {
10687 "id": "1910543603",
10688 "predicate": "messages.dialogsSlice",
10689 "params": [
10690 {
10691 "name": "count",
10692 "type": "int"
10693 },
10694 {
10695 "name": "dialogs",
10696 "type": "Vector<Dialog>"
10697 },
10698 {
10699 "name": "messages",
10700 "type": "Vector<Message>"
10701 },
10702 {
10703 "name": "chats",
10704 "type": "Vector<Chat>"
10705 },
10706 {
10707 "name": "users",
10708 "type": "Vector<User>"
10709 }
10710 ],
10711 "type": "messages.Dialogs"
10712 },
10713 {
10714 "id": "-1938715001",
10715 "predicate": "messages.messages",
10716 "params": [
10717 {
10718 "name": "messages",
10719 "type": "Vector<Message>"
10720 },
10721 {
10722 "name": "chats",
10723 "type": "Vector<Chat>"
10724 },
10725 {
10726 "name": "users",
10727 "type": "Vector<User>"
10728 }
10729 ],
10730 "type": "messages.Messages"
10731 },
10732 {
10733 "id": "189033187",
10734 "predicate": "messages.messagesSlice",
10735 "params": [
10736 {
10737 "name": "count",
10738 "type": "int"
10739 },
10740 {
10741 "name": "messages",
10742 "type": "Vector<Message>"
10743 },
10744 {
10745 "name": "chats",
10746 "type": "Vector<Chat>"
10747 },
10748 {
10749 "name": "users",
10750 "type": "Vector<User>"
10751 }
10752 ],
10753 "type": "messages.Messages"
10754 },
10755 {
10756 "id": "1694474197",
10757 "predicate": "messages.chats",
10758 "params": [
10759 {
10760 "name": "chats",
10761 "type": "Vector<Chat>"
10762 }
10763 ],
10764 "type": "messages.Chats"
10765 },
10766 {
10767 "id": "-438840932",
10768 "predicate": "messages.chatFull",
10769 "params": [
10770 {
10771 "name": "full_chat",
10772 "type": "ChatFull"
10773 },
10774 {
10775 "name": "chats",
10776 "type": "Vector<Chat>"
10777 },
10778 {
10779 "name": "users",
10780 "type": "Vector<User>"
10781 }
10782 ],
10783 "type": "messages.ChatFull"
10784 },
10785 {
10786 "id": "-1269012015",
10787 "predicate": "messages.affectedHistory",
10788 "params": [
10789 {
10790 "name": "pts",
10791 "type": "int"
10792 },
10793 {
10794 "name": "pts_count",
10795 "type": "int"
10796 },
10797 {
10798 "name": "offset",
10799 "type": "int"
10800 }
10801 ],
10802 "type": "messages.AffectedHistory"
10803 },
10804 {
10805 "id": "1474492012",
10806 "predicate": "inputMessagesFilterEmpty",
10807 "params": [],
10808 "type": "MessagesFilter"
10809 },
10810 {
10811 "id": "-1777752804",
10812 "predicate": "inputMessagesFilterPhotos",
10813 "params": [],
10814 "type": "MessagesFilter"
10815 },
10816 {
10817 "id": "-1614803355",
10818 "predicate": "inputMessagesFilterVideo",
10819 "params": [],
10820 "type": "MessagesFilter"
10821 },
10822 {
10823 "id": "1458172132",
10824 "predicate": "inputMessagesFilterPhotoVideo",
10825 "params": [],
10826 "type": "MessagesFilter"
10827 },
10828 {
10829 "id": "-648121413",
10830 "predicate": "inputMessagesFilterPhotoVideoDocuments",
10831 "params": [],
10832 "type": "MessagesFilter"
10833 },
10834 {
10835 "id": "-1629621880",
10836 "predicate": "inputMessagesFilterDocument",
10837 "params": [],
10838 "type": "MessagesFilter"
10839 },
10840 {
10841 "id": "2129714567",
10842 "predicate": "inputMessagesFilterUrl",
10843 "params": [],
10844 "type": "MessagesFilter"
10845 },
10846 {
10847 "id": "-3644025",
10848 "predicate": "inputMessagesFilterGif",
10849 "params": [],
10850 "type": "MessagesFilter"
10851 },
10852 {
10853 "id": "522914557",
10854 "predicate": "updateNewMessage",
10855 "params": [
10856 {
10857 "name": "message",
10858 "type": "Message"
10859 },
10860 {
10861 "name": "pts",
10862 "type": "int"
10863 },
10864 {
10865 "name": "pts_count",
10866 "type": "int"
10867 }
10868 ],
10869 "type": "Update"
10870 },
10871 {
10872 "id": "1318109142",
10873 "predicate": "updateMessageID",
10874 "params": [
10875 {
10876 "name": "id",
10877 "type": "int"
10878 },
10879 {
10880 "name": "random_id",
10881 "type": "long"
10882 }
10883 ],
10884 "type": "Update"
10885 },
10886 {
10887 "id": "-1576161051",
10888 "predicate": "updateDeleteMessages",
10889 "params": [
10890 {
10891 "name": "messages",
10892 "type": "Vector<int>"
10893 },
10894 {
10895 "name": "pts",
10896 "type": "int"
10897 },
10898 {
10899 "name": "pts_count",
10900 "type": "int"
10901 }
10902 ],
10903 "type": "Update"
10904 },
10905 {
10906 "id": "1548249383",
10907 "predicate": "updateUserTyping",
10908 "params": [
10909 {
10910 "name": "user_id",
10911 "type": "int"
10912 },
10913 {
10914 "name": "action",
10915 "type": "SendMessageAction"
10916 }
10917 ],
10918 "type": "Update"
10919 },
10920 {
10921 "id": "-1704596961",
10922 "predicate": "updateChatUserTyping",
10923 "params": [
10924 {
10925 "name": "chat_id",
10926 "type": "int"
10927 },
10928 {
10929 "name": "user_id",
10930 "type": "int"
10931 },
10932 {
10933 "name": "action",
10934 "type": "SendMessageAction"
10935 }
10936 ],
10937 "type": "Update"
10938 },
10939 {
10940 "id": "125178264",
10941 "predicate": "updateChatParticipants",
10942 "params": [
10943 {
10944 "name": "participants",
10945 "type": "ChatParticipants"
10946 }
10947 ],
10948 "type": "Update"
10949 },
10950 {
10951 "id": "469489699",
10952 "predicate": "updateUserStatus",
10953 "params": [
10954 {
10955 "name": "user_id",
10956 "type": "int"
10957 },
10958 {
10959 "name": "status",
10960 "type": "UserStatus"
10961 }
10962 ],
10963 "type": "Update"
10964 },
10965 {
10966 "id": "-1489818765",
10967 "predicate": "updateUserName",
10968 "params": [
10969 {
10970 "name": "user_id",
10971 "type": "int"
10972 },
10973 {
10974 "name": "first_name",
10975 "type": "string"
10976 },
10977 {
10978 "name": "last_name",
10979 "type": "string"
10980 },
10981 {
10982 "name": "username",
10983 "type": "string"
10984 }
10985 ],
10986 "type": "Update"
10987 },
10988 {
10989 "id": "-1791935732",
10990 "predicate": "updateUserPhoto",
10991 "params": [
10992 {
10993 "name": "user_id",
10994 "type": "int"
10995 },
10996 {
10997 "name": "date",
10998 "type": "int"
10999 },
11000 {
11001 "name": "photo",
11002 "type": "UserProfilePhoto"
11003 },
11004 {
11005 "name": "previous",
11006 "type": "Bool"
11007 }
11008 ],
11009 "type": "Update"
11010 },
11011 {
11012 "id": "628472761",
11013 "predicate": "updateContactRegistered",
11014 "params": [
11015 {
11016 "name": "user_id",
11017 "type": "int"
11018 },
11019 {
11020 "name": "date",
11021 "type": "int"
11022 }
11023 ],
11024 "type": "Update"
11025 },
11026 {
11027 "id": "-1657903163",
11028 "predicate": "updateContactLink",
11029 "params": [
11030 {
11031 "name": "user_id",
11032 "type": "int"
11033 },
11034 {
11035 "name": "my_link",
11036 "type": "ContactLink"
11037 },
11038 {
11039 "name": "foreign_link",
11040 "type": "ContactLink"
11041 }
11042 ],
11043 "type": "Update"
11044 },
11045 {
11046 "id": "-1895411046",
11047 "predicate": "updateNewAuthorization",
11048 "params": [
11049 {
11050 "name": "auth_key_id",
11051 "type": "long"
11052 },
11053 {
11054 "name": "date",
11055 "type": "int"
11056 },
11057 {
11058 "name": "device",
11059 "type": "string"
11060 },
11061 {
11062 "name": "location",
11063 "type": "string"
11064 }
11065 ],
11066 "type": "Update"
11067 },
11068 {
11069 "id": "-1519637954",
11070 "predicate": "updates.state",
11071 "params": [
11072 {
11073 "name": "pts",
11074 "type": "int"
11075 },
11076 {
11077 "name": "qts",
11078 "type": "int"
11079 },
11080 {
11081 "name": "date",
11082 "type": "int"
11083 },
11084 {
11085 "name": "seq",
11086 "type": "int"
11087 },
11088 {
11089 "name": "unread_count",
11090 "type": "int"
11091 }
11092 ],
11093 "type": "updates.State"
11094 },
11095 {
11096 "id": "1567990072",
11097 "predicate": "updates.differenceEmpty",
11098 "params": [
11099 {
11100 "name": "date",
11101 "type": "int"
11102 },
11103 {
11104 "name": "seq",
11105 "type": "int"
11106 }
11107 ],
11108 "type": "updates.Difference"
11109 },
11110 {
11111 "id": "16030880",
11112 "predicate": "updates.difference",
11113 "params": [
11114 {
11115 "name": "new_messages",
11116 "type": "Vector<Message>"
11117 },
11118 {
11119 "name": "new_encrypted_messages",
11120 "type": "Vector<EncryptedMessage>"
11121 },
11122 {
11123 "name": "other_updates",
11124 "type": "Vector<Update>"
11125 },
11126 {
11127 "name": "chats",
11128 "type": "Vector<Chat>"
11129 },
11130 {
11131 "name": "users",
11132 "type": "Vector<User>"
11133 },
11134 {
11135 "name": "state",
11136 "type": "updates.State"
11137 }
11138 ],
11139 "type": "updates.Difference"
11140 },
11141 {
11142 "id": "-1459938943",
11143 "predicate": "updates.differenceSlice",
11144 "params": [
11145 {
11146 "name": "new_messages",
11147 "type": "Vector<Message>"
11148 },
11149 {
11150 "name": "new_encrypted_messages",
11151 "type": "Vector<EncryptedMessage>"
11152 },
11153 {
11154 "name": "other_updates",
11155 "type": "Vector<Update>"
11156 },
11157 {
11158 "name": "chats",
11159 "type": "Vector<Chat>"
11160 },
11161 {
11162 "name": "users",
11163 "type": "Vector<User>"
11164 },
11165 {
11166 "name": "intermediate_state",
11167 "type": "updates.State"
11168 }
11169 ],
11170 "type": "updates.Difference"
11171 },
11172 {
11173 "id": "-484987010",
11174 "predicate": "updatesTooLong",
11175 "params": [],
11176 "type": "Updates"
11177 },
11178 {
11179 "id": "-1857044719",
11180 "predicate": "updateShortMessage",
11181 "params": [
11182 {
11183 "name": "flags",
11184 "type": "#"
11185 },
11186 {
11187 "name": "out",
11188 "type": "flags.1?true"
11189 },
11190 {
11191 "name": "mentioned",
11192 "type": "flags.4?true"
11193 },
11194 {
11195 "name": "media_unread",
11196 "type": "flags.5?true"
11197 },
11198 {
11199 "name": "silent",
11200 "type": "flags.13?true"
11201 },
11202 {
11203 "name": "id",
11204 "type": "int"
11205 },
11206 {
11207 "name": "user_id",
11208 "type": "int"
11209 },
11210 {
11211 "name": "message",
11212 "type": "string"
11213 },
11214 {
11215 "name": "pts",
11216 "type": "int"
11217 },
11218 {
11219 "name": "pts_count",
11220 "type": "int"
11221 },
11222 {
11223 "name": "date",
11224 "type": "int"
11225 },
11226 {
11227 "name": "fwd_from",
11228 "type": "flags.2?MessageFwdHeader"
11229 },
11230 {
11231 "name": "via_bot_id",
11232 "type": "flags.11?int"
11233 },
11234 {
11235 "name": "reply_to_msg_id",
11236 "type": "flags.3?int"
11237 },
11238 {
11239 "name": "entities",
11240 "type": "flags.7?Vector<MessageEntity>"
11241 }
11242 ],
11243 "type": "Updates"
11244 },
11245 {
11246 "id": "377562760",
11247 "predicate": "updateShortChatMessage",
11248 "params": [
11249 {
11250 "name": "flags",
11251 "type": "#"
11252 },
11253 {
11254 "name": "out",
11255 "type": "flags.1?true"
11256 },
11257 {
11258 "name": "mentioned",
11259 "type": "flags.4?true"
11260 },
11261 {
11262 "name": "media_unread",
11263 "type": "flags.5?true"
11264 },
11265 {
11266 "name": "silent",
11267 "type": "flags.13?true"
11268 },
11269 {
11270 "name": "id",
11271 "type": "int"
11272 },
11273 {
11274 "name": "from_id",
11275 "type": "int"
11276 },
11277 {
11278 "name": "chat_id",
11279 "type": "int"
11280 },
11281 {
11282 "name": "message",
11283 "type": "string"
11284 },
11285 {
11286 "name": "pts",
11287 "type": "int"
11288 },
11289 {
11290 "name": "pts_count",
11291 "type": "int"
11292 },
11293 {
11294 "name": "date",
11295 "type": "int"
11296 },
11297 {
11298 "name": "fwd_from",
11299 "type": "flags.2?MessageFwdHeader"
11300 },
11301 {
11302 "name": "via_bot_id",
11303 "type": "flags.11?int"
11304 },
11305 {
11306 "name": "reply_to_msg_id",
11307 "type": "flags.3?int"
11308 },
11309 {
11310 "name": "entities",
11311 "type": "flags.7?Vector<MessageEntity>"
11312 }
11313 ],
11314 "type": "Updates"
11315 },
11316 {
11317 "id": "2027216577",
11318 "predicate": "updateShort",
11319 "params": [
11320 {
11321 "name": "update",
11322 "type": "Update"
11323 },
11324 {
11325 "name": "date",
11326 "type": "int"
11327 }
11328 ],
11329 "type": "Updates"
11330 },
11331 {
11332 "id": "1918567619",
11333 "predicate": "updatesCombined",
11334 "params": [
11335 {
11336 "name": "updates",
11337 "type": "Vector<Update>"
11338 },
11339 {
11340 "name": "users",
11341 "type": "Vector<User>"
11342 },
11343 {
11344 "name": "chats",
11345 "type": "Vector<Chat>"
11346 },
11347 {
11348 "name": "date",
11349 "type": "int"
11350 },
11351 {
11352 "name": "seq_start",
11353 "type": "int"
11354 },
11355 {
11356 "name": "seq",
11357 "type": "int"
11358 }
11359 ],
11360 "type": "Updates"
11361 },
11362 {
11363 "id": "1957577280",
11364 "predicate": "updates",
11365 "params": [
11366 {
11367 "name": "updates",
11368 "type": "Vector<Update>"
11369 },
11370 {
11371 "name": "users",
11372 "type": "Vector<User>"
11373 },
11374 {
11375 "name": "chats",
11376 "type": "Vector<Chat>"
11377 },
11378 {
11379 "name": "date",
11380 "type": "int"
11381 },
11382 {
11383 "name": "seq",
11384 "type": "int"
11385 }
11386 ],
11387 "type": "Updates"
11388 },
11389 {
11390 "id": "-1916114267",
11391 "predicate": "photos.photos",
11392 "params": [
11393 {
11394 "name": "photos",
11395 "type": "Vector<Photo>"
11396 },
11397 {
11398 "name": "users",
11399 "type": "Vector<User>"
11400 }
11401 ],
11402 "type": "photos.Photos"
11403 },
11404 {
11405 "id": "352657236",
11406 "predicate": "photos.photosSlice",
11407 "params": [
11408 {
11409 "name": "count",
11410 "type": "int"
11411 },
11412 {
11413 "name": "photos",
11414 "type": "Vector<Photo>"
11415 },
11416 {
11417 "name": "users",
11418 "type": "Vector<User>"
11419 }
11420 ],
11421 "type": "photos.Photos"
11422 },
11423 {
11424 "id": "539045032",
11425 "predicate": "photos.photo",
11426 "params": [
11427 {
11428 "name": "photo",
11429 "type": "Photo"
11430 },
11431 {
11432 "name": "users",
11433 "type": "Vector<User>"
11434 }
11435 ],
11436 "type": "photos.Photo"
11437 },
11438 {
11439 "id": "157948117",
11440 "predicate": "upload.file",
11441 "params": [
11442 {
11443 "name": "type",
11444 "type": "storage.FileType"
11445 },
11446 {
11447 "name": "mtime",
11448 "type": "int"
11449 },
11450 {
11451 "name": "bytes",
11452 "type": "bytes"
11453 }
11454 ],
11455 "type": "upload.File"
11456 },
11457 {
11458 "id": "98092748",
11459 "predicate": "dcOption",
11460 "params": [
11461 {
11462 "name": "flags",
11463 "type": "#"
11464 },
11465 {
11466 "name": "ipv6",
11467 "type": "flags.0?true"
11468 },
11469 {
11470 "name": "media_only",
11471 "type": "flags.1?true"
11472 },
11473 {
11474 "name": "tcpo_only",
11475 "type": "flags.2?true"
11476 },
11477 {
11478 "name": "id",
11479 "type": "int"
11480 },
11481 {
11482 "name": "ip_address",
11483 "type": "string"
11484 },
11485 {
11486 "name": "port",
11487 "type": "int"
11488 }
11489 ],
11490 "type": "DcOption"
11491 },
11492 {
11493 "id": "-1704251862",
11494 "predicate": "config",
11495 "params": [
11496 {
11497 "name": "flags",
11498 "type": "#"
11499 },
11500 {
11501 "name": "date",
11502 "type": "int"
11503 },
11504 {
11505 "name": "expires",
11506 "type": "int"
11507 },
11508 {
11509 "name": "test_mode",
11510 "type": "Bool"
11511 },
11512 {
11513 "name": "this_dc",
11514 "type": "int"
11515 },
11516 {
11517 "name": "dc_options",
11518 "type": "Vector<DcOption>"
11519 },
11520 {
11521 "name": "chat_size_max",
11522 "type": "int"
11523 },
11524 {
11525 "name": "megagroup_size_max",
11526 "type": "int"
11527 },
11528 {
11529 "name": "forwarded_count_max",
11530 "type": "int"
11531 },
11532 {
11533 "name": "online_update_period_ms",
11534 "type": "int"
11535 },
11536 {
11537 "name": "offline_blur_timeout_ms",
11538 "type": "int"
11539 },
11540 {
11541 "name": "offline_idle_timeout_ms",
11542 "type": "int"
11543 },
11544 {
11545 "name": "online_cloud_timeout_ms",
11546 "type": "int"
11547 },
11548 {
11549 "name": "notify_cloud_delay_ms",
11550 "type": "int"
11551 },
11552 {
11553 "name": "notify_default_delay_ms",
11554 "type": "int"
11555 },
11556 {
11557 "name": "chat_big_size",
11558 "type": "int"
11559 },
11560 {
11561 "name": "push_chat_period_ms",
11562 "type": "int"
11563 },
11564 {
11565 "name": "push_chat_limit",
11566 "type": "int"
11567 },
11568 {
11569 "name": "saved_gifs_limit",
11570 "type": "int"
11571 },
11572 {
11573 "name": "edit_time_limit",
11574 "type": "int"
11575 },
11576 {
11577 "name": "rating_e_decay",
11578 "type": "int"
11579 },
11580 {
11581 "name": "stickers_recent_limit",
11582 "type": "int"
11583 },
11584 {
11585 "name": "tmp_sessions",
11586 "type": "flags.0?int"
11587 },
11588 {
11589 "name": "disabled_features",
11590 "type": "Vector<DisabledFeature>"
11591 }
11592 ],
11593 "type": "Config"
11594 },
11595 {
11596 "id": "-1910892683",
11597 "predicate": "nearestDc",
11598 "params": [
11599 {
11600 "name": "country",
11601 "type": "string"
11602 },
11603 {
11604 "name": "this_dc",
11605 "type": "int"
11606 },
11607 {
11608 "name": "nearest_dc",
11609 "type": "int"
11610 }
11611 ],
11612 "type": "NearestDc"
11613 },
11614 {
11615 "id": "-1987579119",
11616 "predicate": "help.appUpdate",
11617 "params": [
11618 {
11619 "name": "id",
11620 "type": "int"
11621 },
11622 {
11623 "name": "critical",
11624 "type": "Bool"
11625 },
11626 {
11627 "name": "url",
11628 "type": "string"
11629 },
11630 {
11631 "name": "text",
11632 "type": "string"
11633 }
11634 ],
11635 "type": "help.AppUpdate"
11636 },
11637 {
11638 "id": "-1000708810",
11639 "predicate": "help.noAppUpdate",
11640 "params": [],
11641 "type": "help.AppUpdate"
11642 },
11643 {
11644 "id": "415997816",
11645 "predicate": "help.inviteText",
11646 "params": [
11647 {
11648 "name": "message",
11649 "type": "string"
11650 }
11651 ],
11652 "type": "help.InviteText"
11653 },
11654 {
11655 "id": "1662091044",
11656 "predicate": "wallPaperSolid",
11657 "params": [
11658 {
11659 "name": "id",
11660 "type": "int"
11661 },
11662 {
11663 "name": "title",
11664 "type": "string"
11665 },
11666 {
11667 "name": "bg_color",
11668 "type": "int"
11669 },
11670 {
11671 "name": "color",
11672 "type": "int"
11673 }
11674 ],
11675 "type": "WallPaper"
11676 },
11677 {
11678 "id": "314359194",
11679 "predicate": "updateNewEncryptedMessage",
11680 "params": [
11681 {
11682 "name": "message",
11683 "type": "EncryptedMessage"
11684 },
11685 {
11686 "name": "qts",
11687 "type": "int"
11688 }
11689 ],
11690 "type": "Update"
11691 },
11692 {
11693 "id": "386986326",
11694 "predicate": "updateEncryptedChatTyping",
11695 "params": [
11696 {
11697 "name": "chat_id",
11698 "type": "int"
11699 }
11700 ],
11701 "type": "Update"
11702 },
11703 {
11704 "id": "-1264392051",
11705 "predicate": "updateEncryption",
11706 "params": [
11707 {
11708 "name": "chat",
11709 "type": "EncryptedChat"
11710 },
11711 {
11712 "name": "date",
11713 "type": "int"
11714 }
11715 ],
11716 "type": "Update"
11717 },
11718 {
11719 "id": "956179895",
11720 "predicate": "updateEncryptedMessagesRead",
11721 "params": [
11722 {
11723 "name": "chat_id",
11724 "type": "int"
11725 },
11726 {
11727 "name": "max_date",
11728 "type": "int"
11729 },
11730 {
11731 "name": "date",
11732 "type": "int"
11733 }
11734 ],
11735 "type": "Update"
11736 },
11737 {
11738 "id": "-1417756512",
11739 "predicate": "encryptedChatEmpty",
11740 "params": [
11741 {
11742 "name": "id",
11743 "type": "int"
11744 }
11745 ],
11746 "type": "EncryptedChat"
11747 },
11748 {
11749 "id": "1006044124",
11750 "predicate": "encryptedChatWaiting",
11751 "params": [
11752 {
11753 "name": "id",
11754 "type": "int"
11755 },
11756 {
11757 "name": "access_hash",
11758 "type": "long"
11759 },
11760 {
11761 "name": "date",
11762 "type": "int"
11763 },
11764 {
11765 "name": "admin_id",
11766 "type": "int"
11767 },
11768 {
11769 "name": "participant_id",
11770 "type": "int"
11771 }
11772 ],
11773 "type": "EncryptedChat"
11774 },
11775 {
11776 "id": "-931638658",
11777 "predicate": "encryptedChatRequested",
11778 "params": [
11779 {
11780 "name": "id",
11781 "type": "int"
11782 },
11783 {
11784 "name": "access_hash",
11785 "type": "long"
11786 },
11787 {
11788 "name": "date",
11789 "type": "int"
11790 },
11791 {
11792 "name": "admin_id",
11793 "type": "int"
11794 },
11795 {
11796 "name": "participant_id",
11797 "type": "int"
11798 },
11799 {
11800 "name": "g_a",
11801 "type": "bytes"
11802 }
11803 ],
11804 "type": "EncryptedChat"
11805 },
11806 {
11807 "id": "-94974410",
11808 "predicate": "encryptedChat",
11809 "params": [
11810 {
11811 "name": "id",
11812 "type": "int"
11813 },
11814 {
11815 "name": "access_hash",
11816 "type": "long"
11817 },
11818 {
11819 "name": "date",
11820 "type": "int"
11821 },
11822 {
11823 "name": "admin_id",
11824 "type": "int"
11825 },
11826 {
11827 "name": "participant_id",
11828 "type": "int"
11829 },
11830 {
11831 "name": "g_a_or_b",
11832 "type": "bytes"
11833 },
11834 {
11835 "name": "key_fingerprint",
11836 "type": "long"
11837 }
11838 ],
11839 "type": "EncryptedChat"
11840 },
11841 {
11842 "id": "332848423",
11843 "predicate": "encryptedChatDiscarded",
11844 "params": [
11845 {
11846 "name": "id",
11847 "type": "int"
11848 }
11849 ],
11850 "type": "EncryptedChat"
11851 },
11852 {
11853 "id": "-247351839",
11854 "predicate": "inputEncryptedChat",
11855 "params": [
11856 {
11857 "name": "chat_id",
11858 "type": "int"
11859 },
11860 {
11861 "name": "access_hash",
11862 "type": "long"
11863 }
11864 ],
11865 "type": "InputEncryptedChat"
11866 },
11867 {
11868 "id": "-1038136962",
11869 "predicate": "encryptedFileEmpty",
11870 "params": [],
11871 "type": "EncryptedFile"
11872 },
11873 {
11874 "id": "1248893260",
11875 "predicate": "encryptedFile",
11876 "params": [
11877 {
11878 "name": "id",
11879 "type": "long"
11880 },
11881 {
11882 "name": "access_hash",
11883 "type": "long"
11884 },
11885 {
11886 "name": "size",
11887 "type": "int"
11888 },
11889 {
11890 "name": "dc_id",
11891 "type": "int"
11892 },
11893 {
11894 "name": "key_fingerprint",
11895 "type": "int"
11896 }
11897 ],
11898 "type": "EncryptedFile"
11899 },
11900 {
11901 "id": "406307684",
11902 "predicate": "inputEncryptedFileEmpty",
11903 "params": [],
11904 "type": "InputEncryptedFile"
11905 },
11906 {
11907 "id": "1690108678",
11908 "predicate": "inputEncryptedFileUploaded",
11909 "params": [
11910 {
11911 "name": "id",
11912 "type": "long"
11913 },
11914 {
11915 "name": "parts",
11916 "type": "int"
11917 },
11918 {
11919 "name": "md5_checksum",
11920 "type": "string"
11921 },
11922 {
11923 "name": "key_fingerprint",
11924 "type": "int"
11925 }
11926 ],
11927 "type": "InputEncryptedFile"
11928 },
11929 {
11930 "id": "1511503333",
11931 "predicate": "inputEncryptedFile",
11932 "params": [
11933 {
11934 "name": "id",
11935 "type": "long"
11936 },
11937 {
11938 "name": "access_hash",
11939 "type": "long"
11940 }
11941 ],
11942 "type": "InputEncryptedFile"
11943 },
11944 {
11945 "id": "-182231723",
11946 "predicate": "inputEncryptedFileLocation",
11947 "params": [
11948 {
11949 "name": "id",
11950 "type": "long"
11951 },
11952 {
11953 "name": "access_hash",
11954 "type": "long"
11955 }
11956 ],
11957 "type": "InputFileLocation"
11958 },
11959 {
11960 "id": "-317144808",
11961 "predicate": "encryptedMessage",
11962 "params": [
11963 {
11964 "name": "random_id",
11965 "type": "long"
11966 },
11967 {
11968 "name": "chat_id",
11969 "type": "int"
11970 },
11971 {
11972 "name": "date",
11973 "type": "int"
11974 },
11975 {
11976 "name": "bytes",
11977 "type": "bytes"
11978 },
11979 {
11980 "name": "file",
11981 "type": "EncryptedFile"
11982 }
11983 ],
11984 "type": "EncryptedMessage"
11985 },
11986 {
11987 "id": "594758406",
11988 "predicate": "encryptedMessageService",
11989 "params": [
11990 {
11991 "name": "random_id",
11992 "type": "long"
11993 },
11994 {
11995 "name": "chat_id",
11996 "type": "int"
11997 },
11998 {
11999 "name": "date",
12000 "type": "int"
12001 },
12002 {
12003 "name": "bytes",
12004 "type": "bytes"
12005 }
12006 ],
12007 "type": "EncryptedMessage"
12008 },
12009 {
12010 "id": "-1058912715",
12011 "predicate": "messages.dhConfigNotModified",
12012 "params": [
12013 {
12014 "name": "random",
12015 "type": "bytes"
12016 }
12017 ],
12018 "type": "messages.DhConfig"
12019 },
12020 {
12021 "id": "740433629",
12022 "predicate": "messages.dhConfig",
12023 "params": [
12024 {
12025 "name": "g",
12026 "type": "int"
12027 },
12028 {
12029 "name": "p",
12030 "type": "bytes"
12031 },
12032 {
12033 "name": "version",
12034 "type": "int"
12035 },
12036 {
12037 "name": "random",
12038 "type": "bytes"
12039 }
12040 ],
12041 "type": "messages.DhConfig"
12042 },
12043 {
12044 "id": "1443858741",
12045 "predicate": "messages.sentEncryptedMessage",
12046 "params": [
12047 {
12048 "name": "date",
12049 "type": "int"
12050 }
12051 ],
12052 "type": "messages.SentEncryptedMessage"
12053 },
12054 {
12055 "id": "-1802240206",
12056 "predicate": "messages.sentEncryptedFile",
12057 "params": [
12058 {
12059 "name": "date",
12060 "type": "int"
12061 },
12062 {
12063 "name": "file",
12064 "type": "EncryptedFile"
12065 }
12066 ],
12067 "type": "messages.SentEncryptedMessage"
12068 },
12069 {
12070 "id": "-95482955",
12071 "predicate": "inputFileBig",
12072 "params": [
12073 {
12074 "name": "id",
12075 "type": "long"
12076 },
12077 {
12078 "name": "parts",
12079 "type": "int"
12080 },
12081 {
12082 "name": "name",
12083 "type": "string"
12084 }
12085 ],
12086 "type": "InputFile"
12087 },
12088 {
12089 "id": "767652808",
12090 "predicate": "inputEncryptedFileBigUploaded",
12091 "params": [
12092 {
12093 "name": "id",
12094 "type": "long"
12095 },
12096 {
12097 "name": "parts",
12098 "type": "int"
12099 },
12100 {
12101 "name": "key_fingerprint",
12102 "type": "int"
12103 }
12104 ],
12105 "type": "InputEncryptedFile"
12106 },
12107 {
12108 "id": "-364179876",
12109 "predicate": "updateChatParticipantAdd",
12110 "params": [
12111 {
12112 "name": "chat_id",
12113 "type": "int"
12114 },
12115 {
12116 "name": "user_id",
12117 "type": "int"
12118 },
12119 {
12120 "name": "inviter_id",
12121 "type": "int"
12122 },
12123 {
12124 "name": "date",
12125 "type": "int"
12126 },
12127 {
12128 "name": "version",
12129 "type": "int"
12130 }
12131 ],
12132 "type": "Update"
12133 },
12134 {
12135 "id": "1851755554",
12136 "predicate": "updateChatParticipantDelete",
12137 "params": [
12138 {
12139 "name": "chat_id",
12140 "type": "int"
12141 },
12142 {
12143 "name": "user_id",
12144 "type": "int"
12145 },
12146 {
12147 "name": "version",
12148 "type": "int"
12149 }
12150 ],
12151 "type": "Update"
12152 },
12153 {
12154 "id": "-1906403213",
12155 "predicate": "updateDcOptions",
12156 "params": [
12157 {
12158 "name": "dc_options",
12159 "type": "Vector<DcOption>"
12160 }
12161 ],
12162 "type": "Update"
12163 },
12164 {
12165 "id": "-797904407",
12166 "predicate": "inputMediaUploadedDocument",
12167 "params": [
12168 {
12169 "name": "flags",
12170 "type": "#"
12171 },
12172 {
12173 "name": "file",
12174 "type": "InputFile"
12175 },
12176 {
12177 "name": "mime_type",
12178 "type": "string"
12179 },
12180 {
12181 "name": "attributes",
12182 "type": "Vector<DocumentAttribute>"
12183 },
12184 {
12185 "name": "caption",
12186 "type": "string"
12187 },
12188 {
12189 "name": "stickers",
12190 "type": "flags.0?Vector<InputDocument>"
12191 }
12192 ],
12193 "type": "InputMedia"
12194 },
12195 {
12196 "id": "1356369070",
12197 "predicate": "inputMediaUploadedThumbDocument",
12198 "params": [
12199 {
12200 "name": "flags",
12201 "type": "#"
12202 },
12203 {
12204 "name": "file",
12205 "type": "InputFile"
12206 },
12207 {
12208 "name": "thumb",
12209 "type": "InputFile"
12210 },
12211 {
12212 "name": "mime_type",
12213 "type": "string"
12214 },
12215 {
12216 "name": "attributes",
12217 "type": "Vector<DocumentAttribute>"
12218 },
12219 {
12220 "name": "caption",
12221 "type": "string"
12222 },
12223 {
12224 "name": "stickers",
12225 "type": "flags.0?Vector<InputDocument>"
12226 }
12227 ],
12228 "type": "InputMedia"
12229 },
12230 {
12231 "id": "444068508",
12232 "predicate": "inputMediaDocument",
12233 "params": [
12234 {
12235 "name": "id",
12236 "type": "InputDocument"
12237 },
12238 {
12239 "name": "caption",
12240 "type": "string"
12241 }
12242 ],
12243 "type": "InputMedia"
12244 },
12245 {
12246 "id": "-203411800",
12247 "predicate": "messageMediaDocument",
12248 "params": [
12249 {
12250 "name": "document",
12251 "type": "Document"
12252 },
12253 {
12254 "name": "caption",
12255 "type": "string"
12256 }
12257 ],
12258 "type": "MessageMedia"
12259 },
12260 {
12261 "id": "1928391342",
12262 "predicate": "inputDocumentEmpty",
12263 "params": [],
12264 "type": "InputDocument"
12265 },
12266 {
12267 "id": "410618194",
12268 "predicate": "inputDocument",
12269 "params": [
12270 {
12271 "name": "id",
12272 "type": "long"
12273 },
12274 {
12275 "name": "access_hash",
12276 "type": "long"
12277 }
12278 ],
12279 "type": "InputDocument"
12280 },
12281 {
12282 "id": "1125058340",
12283 "predicate": "inputDocumentFileLocation",
12284 "params": [
12285 {
12286 "name": "id",
12287 "type": "long"
12288 },
12289 {
12290 "name": "access_hash",
12291 "type": "long"
12292 },
12293 {
12294 "name": "version",
12295 "type": "int"
12296 }
12297 ],
12298 "type": "InputFileLocation"
12299 },
12300 {
12301 "id": "922273905",
12302 "predicate": "documentEmpty",
12303 "params": [
12304 {
12305 "name": "id",
12306 "type": "long"
12307 }
12308 ],
12309 "type": "Document"
12310 },
12311 {
12312 "id": "-2027738169",
12313 "predicate": "document",
12314 "params": [
12315 {
12316 "name": "id",
12317 "type": "long"
12318 },
12319 {
12320 "name": "access_hash",
12321 "type": "long"
12322 },
12323 {
12324 "name": "date",
12325 "type": "int"
12326 },
12327 {
12328 "name": "mime_type",
12329 "type": "string"
12330 },
12331 {
12332 "name": "size",
12333 "type": "int"
12334 },
12335 {
12336 "name": "thumb",
12337 "type": "PhotoSize"
12338 },
12339 {
12340 "name": "dc_id",
12341 "type": "int"
12342 },
12343 {
12344 "name": "version",
12345 "type": "int"
12346 },
12347 {
12348 "name": "attributes",
12349 "type": "Vector<DocumentAttribute>"
12350 }
12351 ],
12352 "type": "Document"
12353 },
12354 {
12355 "id": "398898678",
12356 "predicate": "help.support",
12357 "params": [
12358 {
12359 "name": "phone_number",
12360 "type": "string"
12361 },
12362 {
12363 "name": "user",
12364 "type": "User"
12365 }
12366 ],
12367 "type": "help.Support"
12368 },
12369 {
12370 "id": "-1613493288",
12371 "predicate": "notifyPeer",
12372 "params": [
12373 {
12374 "name": "peer",
12375 "type": "Peer"
12376 }
12377 ],
12378 "type": "NotifyPeer"
12379 },
12380 {
12381 "id": "-1261946036",
12382 "predicate": "notifyUsers",
12383 "params": [],
12384 "type": "NotifyPeer"
12385 },
12386 {
12387 "id": "-1073230141",
12388 "predicate": "notifyChats",
12389 "params": [],
12390 "type": "NotifyPeer"
12391 },
12392 {
12393 "id": "1959820384",
12394 "predicate": "notifyAll",
12395 "params": [],
12396 "type": "NotifyPeer"
12397 },
12398 {
12399 "id": "-2131957734",
12400 "predicate": "updateUserBlocked",
12401 "params": [
12402 {
12403 "name": "user_id",
12404 "type": "int"
12405 },
12406 {
12407 "name": "blocked",
12408 "type": "Bool"
12409 }
12410 ],
12411 "type": "Update"
12412 },
12413 {
12414 "id": "-1094555409",
12415 "predicate": "updateNotifySettings",
12416 "params": [
12417 {
12418 "name": "peer",
12419 "type": "NotifyPeer"
12420 },
12421 {
12422 "name": "notify_settings",
12423 "type": "PeerNotifySettings"
12424 }
12425 ],
12426 "type": "Update"
12427 },
12428 {
12429 "id": "381645902",
12430 "predicate": "sendMessageTypingAction",
12431 "params": [],
12432 "type": "SendMessageAction"
12433 },
12434 {
12435 "id": "-44119819",
12436 "predicate": "sendMessageCancelAction",
12437 "params": [],
12438 "type": "SendMessageAction"
12439 },
12440 {
12441 "id": "-1584933265",
12442 "predicate": "sendMessageRecordVideoAction",
12443 "params": [],
12444 "type": "SendMessageAction"
12445 },
12446 {
12447 "id": "-378127636",
12448 "predicate": "sendMessageUploadVideoAction",
12449 "params": [
12450 {
12451 "name": "progress",
12452 "type": "int"
12453 }
12454 ],
12455 "type": "SendMessageAction"
12456 },
12457 {
12458 "id": "-718310409",
12459 "predicate": "sendMessageRecordAudioAction",
12460 "params": [],
12461 "type": "SendMessageAction"
12462 },
12463 {
12464 "id": "-212740181",
12465 "predicate": "sendMessageUploadAudioAction",
12466 "params": [
12467 {
12468 "name": "progress",
12469 "type": "int"
12470 }
12471 ],
12472 "type": "SendMessageAction"
12473 },
12474 {
12475 "id": "-774682074",
12476 "predicate": "sendMessageUploadPhotoAction",
12477 "params": [
12478 {
12479 "name": "progress",
12480 "type": "int"
12481 }
12482 ],
12483 "type": "SendMessageAction"
12484 },
12485 {
12486 "id": "-1441998364",
12487 "predicate": "sendMessageUploadDocumentAction",
12488 "params": [
12489 {
12490 "name": "progress",
12491 "type": "int"
12492 }
12493 ],
12494 "type": "SendMessageAction"
12495 },
12496 {
12497 "id": "393186209",
12498 "predicate": "sendMessageGeoLocationAction",
12499 "params": [],
12500 "type": "SendMessageAction"
12501 },
12502 {
12503 "id": "1653390447",
12504 "predicate": "sendMessageChooseContactAction",
12505 "params": [],
12506 "type": "SendMessageAction"
12507 },
12508 {
12509 "id": "446822276",
12510 "predicate": "contacts.found",
12511 "params": [
12512 {
12513 "name": "results",
12514 "type": "Vector<Peer>"
12515 },
12516 {
12517 "name": "chats",
12518 "type": "Vector<Chat>"
12519 },
12520 {
12521 "name": "users",
12522 "type": "Vector<User>"
12523 }
12524 ],
12525 "type": "contacts.Found"
12526 },
12527 {
12528 "id": "942527460",
12529 "predicate": "updateServiceNotification",
12530 "params": [
12531 {
12532 "name": "type",
12533 "type": "string"
12534 },
12535 {
12536 "name": "message",
12537 "type": "string"
12538 },
12539 {
12540 "name": "media",
12541 "type": "MessageMedia"
12542 },
12543 {
12544 "name": "popup",
12545 "type": "Bool"
12546 }
12547 ],
12548 "type": "Update"
12549 },
12550 {
12551 "id": "-496024847",
12552 "predicate": "userStatusRecently",
12553 "params": [],
12554 "type": "UserStatus"
12555 },
12556 {
12557 "id": "129960444",
12558 "predicate": "userStatusLastWeek",
12559 "params": [],
12560 "type": "UserStatus"
12561 },
12562 {
12563 "id": "2011940674",
12564 "predicate": "userStatusLastMonth",
12565 "params": [],
12566 "type": "UserStatus"
12567 },
12568 {
12569 "id": "-298113238",
12570 "predicate": "updatePrivacy",
12571 "params": [
12572 {
12573 "name": "key",
12574 "type": "PrivacyKey"
12575 },
12576 {
12577 "name": "rules",
12578 "type": "Vector<PrivacyRule>"
12579 }
12580 ],
12581 "type": "Update"
12582 },
12583 {
12584 "id": "1335282456",
12585 "predicate": "inputPrivacyKeyStatusTimestamp",
12586 "params": [],
12587 "type": "InputPrivacyKey"
12588 },
12589 {
12590 "id": "-1137792208",
12591 "predicate": "privacyKeyStatusTimestamp",
12592 "params": [],
12593 "type": "PrivacyKey"
12594 },
12595 {
12596 "id": "218751099",
12597 "predicate": "inputPrivacyValueAllowContacts",
12598 "params": [],
12599 "type": "InputPrivacyRule"
12600 },
12601 {
12602 "id": "407582158",
12603 "predicate": "inputPrivacyValueAllowAll",
12604 "params": [],
12605 "type": "InputPrivacyRule"
12606 },
12607 {
12608 "id": "320652927",
12609 "predicate": "inputPrivacyValueAllowUsers",
12610 "params": [
12611 {
12612 "name": "users",
12613 "type": "Vector<InputUser>"
12614 }
12615 ],
12616 "type": "InputPrivacyRule"
12617 },
12618 {
12619 "id": "195371015",
12620 "predicate": "inputPrivacyValueDisallowContacts",
12621 "params": [],
12622 "type": "InputPrivacyRule"
12623 },
12624 {
12625 "id": "-697604407",
12626 "predicate": "inputPrivacyValueDisallowAll",
12627 "params": [],
12628 "type": "InputPrivacyRule"
12629 },
12630 {
12631 "id": "-1877932953",
12632 "predicate": "inputPrivacyValueDisallowUsers",
12633 "params": [
12634 {
12635 "name": "users",
12636 "type": "Vector<InputUser>"
12637 }
12638 ],
12639 "type": "InputPrivacyRule"
12640 },
12641 {
12642 "id": "-123988",
12643 "predicate": "privacyValueAllowContacts",
12644 "params": [],
12645 "type": "PrivacyRule"
12646 },
12647 {
12648 "id": "1698855810",
12649 "predicate": "privacyValueAllowAll",
12650 "params": [],
12651 "type": "PrivacyRule"
12652 },
12653 {
12654 "id": "1297858060",
12655 "predicate": "privacyValueAllowUsers",
12656 "params": [
12657 {
12658 "name": "users",
12659 "type": "Vector<int>"
12660 }
12661 ],
12662 "type": "PrivacyRule"
12663 },
12664 {
12665 "id": "-125240806",
12666 "predicate": "privacyValueDisallowContacts",
12667 "params": [],
12668 "type": "PrivacyRule"
12669 },
12670 {
12671 "id": "-1955338397",
12672 "predicate": "privacyValueDisallowAll",
12673 "params": [],
12674 "type": "PrivacyRule"
12675 },
12676 {
12677 "id": "209668535",
12678 "predicate": "privacyValueDisallowUsers",
12679 "params": [
12680 {
12681 "name": "users",
12682 "type": "Vector<int>"
12683 }
12684 ],
12685 "type": "PrivacyRule"
12686 },
12687 {
12688 "id": "1430961007",
12689 "predicate": "account.privacyRules",
12690 "params": [
12691 {
12692 "name": "rules",
12693 "type": "Vector<PrivacyRule>"
12694 },
12695 {
12696 "name": "users",
12697 "type": "Vector<User>"
12698 }
12699 ],
12700 "type": "account.PrivacyRules"
12701 },
12702 {
12703 "id": "-1194283041",
12704 "predicate": "accountDaysTTL",
12705 "params": [
12706 {
12707 "name": "days",
12708 "type": "int"
12709 }
12710 ],
12711 "type": "AccountDaysTTL"
12712 },
12713 {
12714 "id": "314130811",
12715 "predicate": "updateUserPhone",
12716 "params": [
12717 {
12718 "name": "user_id",
12719 "type": "int"
12720 },
12721 {
12722 "name": "phone",
12723 "type": "string"
12724 }
12725 ],
12726 "type": "Update"
12727 },
12728 {
12729 "id": "1815593308",
12730 "predicate": "documentAttributeImageSize",
12731 "params": [
12732 {
12733 "name": "w",
12734 "type": "int"
12735 },
12736 {
12737 "name": "h",
12738 "type": "int"
12739 }
12740 ],
12741 "type": "DocumentAttribute"
12742 },
12743 {
12744 "id": "297109817",
12745 "predicate": "documentAttributeAnimated",
12746 "params": [],
12747 "type": "DocumentAttribute"
12748 },
12749 {
12750 "id": "1662637586",
12751 "predicate": "documentAttributeSticker",
12752 "params": [
12753 {
12754 "name": "flags",
12755 "type": "#"
12756 },
12757 {
12758 "name": "mask",
12759 "type": "flags.1?true"
12760 },
12761 {
12762 "name": "alt",
12763 "type": "string"
12764 },
12765 {
12766 "name": "stickerset",
12767 "type": "InputStickerSet"
12768 },
12769 {
12770 "name": "mask_coords",
12771 "type": "flags.0?MaskCoords"
12772 }
12773 ],
12774 "type": "DocumentAttribute"
12775 },
12776 {
12777 "id": "1494273227",
12778 "predicate": "documentAttributeVideo",
12779 "params": [
12780 {
12781 "name": "duration",
12782 "type": "int"
12783 },
12784 {
12785 "name": "w",
12786 "type": "int"
12787 },
12788 {
12789 "name": "h",
12790 "type": "int"
12791 }
12792 ],
12793 "type": "DocumentAttribute"
12794 },
12795 {
12796 "id": "-1739392570",
12797 "predicate": "documentAttributeAudio",
12798 "params": [
12799 {
12800 "name": "flags",
12801 "type": "#"
12802 },
12803 {
12804 "name": "voice",
12805 "type": "flags.10?true"
12806 },
12807 {
12808 "name": "duration",
12809 "type": "int"
12810 },
12811 {
12812 "name": "title",
12813 "type": "flags.0?string"
12814 },
12815 {
12816 "name": "performer",
12817 "type": "flags.1?string"
12818 },
12819 {
12820 "name": "waveform",
12821 "type": "flags.2?bytes"
12822 }
12823 ],
12824 "type": "DocumentAttribute"
12825 },
12826 {
12827 "id": "358154344",
12828 "predicate": "documentAttributeFilename",
12829 "params": [
12830 {
12831 "name": "file_name",
12832 "type": "string"
12833 }
12834 ],
12835 "type": "DocumentAttribute"
12836 },
12837 {
12838 "id": "-244016606",
12839 "predicate": "messages.stickersNotModified",
12840 "params": [],
12841 "type": "messages.Stickers"
12842 },
12843 {
12844 "id": "-1970352846",
12845 "predicate": "messages.stickers",
12846 "params": [
12847 {
12848 "name": "hash",
12849 "type": "string"
12850 },
12851 {
12852 "name": "stickers",
12853 "type": "Vector<Document>"
12854 }
12855 ],
12856 "type": "messages.Stickers"
12857 },
12858 {
12859 "id": "313694676",
12860 "predicate": "stickerPack",
12861 "params": [
12862 {
12863 "name": "emoticon",
12864 "type": "string"
12865 },
12866 {
12867 "name": "documents",
12868 "type": "Vector<long>"
12869 }
12870 ],
12871 "type": "StickerPack"
12872 },
12873 {
12874 "id": "-395967805",
12875 "predicate": "messages.allStickersNotModified",
12876 "params": [],
12877 "type": "messages.AllStickers"
12878 },
12879 {
12880 "id": "-302170017",
12881 "predicate": "messages.allStickers",
12882 "params": [
12883 {
12884 "name": "hash",
12885 "type": "int"
12886 },
12887 {
12888 "name": "sets",
12889 "type": "Vector<StickerSet>"
12890 }
12891 ],
12892 "type": "messages.AllStickers"
12893 },
12894 {
12895 "id": "-1369215196",
12896 "predicate": "disabledFeature",
12897 "params": [
12898 {
12899 "name": "feature",
12900 "type": "string"
12901 },
12902 {
12903 "name": "description",
12904 "type": "string"
12905 }
12906 ],
12907 "type": "DisabledFeature"
12908 },
12909 {
12910 "id": "-1721631396",
12911 "predicate": "updateReadHistoryInbox",
12912 "params": [
12913 {
12914 "name": "peer",
12915 "type": "Peer"
12916 },
12917 {
12918 "name": "max_id",
12919 "type": "int"
12920 },
12921 {
12922 "name": "pts",
12923 "type": "int"
12924 },
12925 {
12926 "name": "pts_count",
12927 "type": "int"
12928 }
12929 ],
12930 "type": "Update"
12931 },
12932 {
12933 "id": "791617983",
12934 "predicate": "updateReadHistoryOutbox",
12935 "params": [
12936 {
12937 "name": "peer",
12938 "type": "Peer"
12939 },
12940 {
12941 "name": "max_id",
12942 "type": "int"
12943 },
12944 {
12945 "name": "pts",
12946 "type": "int"
12947 },
12948 {
12949 "name": "pts_count",
12950 "type": "int"
12951 }
12952 ],
12953 "type": "Update"
12954 },
12955 {
12956 "id": "-2066640507",
12957 "predicate": "messages.affectedMessages",
12958 "params": [
12959 {
12960 "name": "pts",
12961 "type": "int"
12962 },
12963 {
12964 "name": "pts_count",
12965 "type": "int"
12966 }
12967 ],
12968 "type": "messages.AffectedMessages"
12969 },
12970 {
12971 "id": "1599050311",
12972 "predicate": "contactLinkUnknown",
12973 "params": [],
12974 "type": "ContactLink"
12975 },
12976 {
12977 "id": "-17968211",
12978 "predicate": "contactLinkNone",
12979 "params": [],
12980 "type": "ContactLink"
12981 },
12982 {
12983 "id": "646922073",
12984 "predicate": "contactLinkHasPhone",
12985 "params": [],
12986 "type": "ContactLink"
12987 },
12988 {
12989 "id": "-721239344",
12990 "predicate": "contactLinkContact",
12991 "params": [],
12992 "type": "ContactLink"
12993 },
12994 {
12995 "id": "2139689491",
12996 "predicate": "updateWebPage",
12997 "params": [
12998 {
12999 "name": "webpage",
13000 "type": "WebPage"
13001 },
13002 {
13003 "name": "pts",
13004 "type": "int"
13005 },
13006 {
13007 "name": "pts_count",
13008 "type": "int"
13009 }
13010 ],
13011 "type": "Update"
13012 },
13013 {
13014 "id": "-350980120",
13015 "predicate": "webPageEmpty",
13016 "params": [
13017 {
13018 "name": "id",
13019 "type": "long"
13020 }
13021 ],
13022 "type": "WebPage"
13023 },
13024 {
13025 "id": "-981018084",
13026 "predicate": "webPagePending",
13027 "params": [
13028 {
13029 "name": "id",
13030 "type": "long"
13031 },
13032 {
13033 "name": "date",
13034 "type": "int"
13035 }
13036 ],
13037 "type": "WebPage"
13038 },
13039 {
13040 "id": "-897446185",
13041 "predicate": "webPage",
13042 "params": [
13043 {
13044 "name": "flags",
13045 "type": "#"
13046 },
13047 {
13048 "name": "id",
13049 "type": "long"
13050 },
13051 {
13052 "name": "url",
13053 "type": "string"
13054 },
13055 {
13056 "name": "display_url",
13057 "type": "string"
13058 },
13059 {
13060 "name": "type",
13061 "type": "flags.0?string"
13062 },
13063 {
13064 "name": "site_name",
13065 "type": "flags.1?string"
13066 },
13067 {
13068 "name": "title",
13069 "type": "flags.2?string"
13070 },
13071 {
13072 "name": "description",
13073 "type": "flags.3?string"
13074 },
13075 {
13076 "name": "photo",
13077 "type": "flags.4?Photo"
13078 },
13079 {
13080 "name": "embed_url",
13081 "type": "flags.5?string"
13082 },
13083 {
13084 "name": "embed_type",
13085 "type": "flags.5?string"
13086 },
13087 {
13088 "name": "embed_width",
13089 "type": "flags.6?int"
13090 },
13091 {
13092 "name": "embed_height",
13093 "type": "flags.6?int"
13094 },
13095 {
13096 "name": "duration",
13097 "type": "flags.7?int"
13098 },
13099 {
13100 "name": "author",
13101 "type": "flags.8?string"
13102 },
13103 {
13104 "name": "document",
13105 "type": "flags.9?Document"
13106 }
13107 ],
13108 "type": "WebPage"
13109 },
13110 {
13111 "id": "-1557277184",
13112 "predicate": "messageMediaWebPage",
13113 "params": [
13114 {
13115 "name": "webpage",
13116 "type": "WebPage"
13117 }
13118 ],
13119 "type": "MessageMedia"
13120 },
13121 {
13122 "id": "2079516406",
13123 "predicate": "authorization",
13124 "params": [
13125 {
13126 "name": "hash",
13127 "type": "long"
13128 },
13129 {
13130 "name": "flags",
13131 "type": "int"
13132 },
13133 {
13134 "name": "device_model",
13135 "type": "string"
13136 },
13137 {
13138 "name": "platform",
13139 "type": "string"
13140 },
13141 {
13142 "name": "system_version",
13143 "type": "string"
13144 },
13145 {
13146 "name": "api_id",
13147 "type": "int"
13148 },
13149 {
13150 "name": "app_name",
13151 "type": "string"
13152 },
13153 {
13154 "name": "app_version",
13155 "type": "string"
13156 },
13157 {
13158 "name": "date_created",
13159 "type": "int"
13160 },
13161 {
13162 "name": "date_active",
13163 "type": "int"
13164 },
13165 {
13166 "name": "ip",
13167 "type": "string"
13168 },
13169 {
13170 "name": "country",
13171 "type": "string"
13172 },
13173 {
13174 "name": "region",
13175 "type": "string"
13176 }
13177 ],
13178 "type": "Authorization"
13179 },
13180 {
13181 "id": "307276766",
13182 "predicate": "account.authorizations",
13183 "params": [
13184 {
13185 "name": "authorizations",
13186 "type": "Vector<Authorization>"
13187 }
13188 ],
13189 "type": "account.Authorizations"
13190 },
13191 {
13192 "id": "-1764049896",
13193 "predicate": "account.noPassword",
13194 "params": [
13195 {
13196 "name": "new_salt",
13197 "type": "bytes"
13198 },
13199 {
13200 "name": "email_unconfirmed_pattern",
13201 "type": "string"
13202 }
13203 ],
13204 "type": "account.Password"
13205 },
13206 {
13207 "id": "2081952796",
13208 "predicate": "account.password",
13209 "params": [
13210 {
13211 "name": "current_salt",
13212 "type": "bytes"
13213 },
13214 {
13215 "name": "new_salt",
13216 "type": "bytes"
13217 },
13218 {
13219 "name": "hint",
13220 "type": "string"
13221 },
13222 {
13223 "name": "has_recovery",
13224 "type": "Bool"
13225 },
13226 {
13227 "name": "email_unconfirmed_pattern",
13228 "type": "string"
13229 }
13230 ],
13231 "type": "account.Password"
13232 },
13233 {
13234 "id": "-1212732749",
13235 "predicate": "account.passwordSettings",
13236 "params": [
13237 {
13238 "name": "email",
13239 "type": "string"
13240 }
13241 ],
13242 "type": "account.PasswordSettings"
13243 },
13244 {
13245 "id": "-2037289493",
13246 "predicate": "account.passwordInputSettings",
13247 "params": [
13248 {
13249 "name": "flags",
13250 "type": "#"
13251 },
13252 {
13253 "name": "new_salt",
13254 "type": "flags.0?bytes"
13255 },
13256 {
13257 "name": "new_password_hash",
13258 "type": "flags.0?bytes"
13259 },
13260 {
13261 "name": "hint",
13262 "type": "flags.0?string"
13263 },
13264 {
13265 "name": "email",
13266 "type": "flags.1?string"
13267 }
13268 ],
13269 "type": "account.PasswordInputSettings"
13270 },
13271 {
13272 "id": "326715557",
13273 "predicate": "auth.passwordRecovery",
13274 "params": [
13275 {
13276 "name": "email_pattern",
13277 "type": "string"
13278 }
13279 ],
13280 "type": "auth.PasswordRecovery"
13281 },
13282 {
13283 "id": "673687578",
13284 "predicate": "inputMediaVenue",
13285 "params": [
13286 {
13287 "name": "geo_point",
13288 "type": "InputGeoPoint"
13289 },
13290 {
13291 "name": "title",
13292 "type": "string"
13293 },
13294 {
13295 "name": "address",
13296 "type": "string"
13297 },
13298 {
13299 "name": "provider",
13300 "type": "string"
13301 },
13302 {
13303 "name": "venue_id",
13304 "type": "string"
13305 }
13306 ],
13307 "type": "InputMedia"
13308 },
13309 {
13310 "id": "2031269663",
13311 "predicate": "messageMediaVenue",
13312 "params": [
13313 {
13314 "name": "geo",
13315 "type": "GeoPoint"
13316 },
13317 {
13318 "name": "title",
13319 "type": "string"
13320 },
13321 {
13322 "name": "address",
13323 "type": "string"
13324 },
13325 {
13326 "name": "provider",
13327 "type": "string"
13328 },
13329 {
13330 "name": "venue_id",
13331 "type": "string"
13332 }
13333 ],
13334 "type": "MessageMedia"
13335 },
13336 {
13337 "id": "-1551583367",
13338 "predicate": "receivedNotifyMessage",
13339 "params": [
13340 {
13341 "name": "id",
13342 "type": "int"
13343 },
13344 {
13345 "name": "flags",
13346 "type": "int"
13347 }
13348 ],
13349 "type": "ReceivedNotifyMessage"
13350 },
13351 {
13352 "id": "1776236393",
13353 "predicate": "chatInviteEmpty",
13354 "params": [],
13355 "type": "ExportedChatInvite"
13356 },
13357 {
13358 "id": "-64092740",
13359 "predicate": "chatInviteExported",
13360 "params": [
13361 {
13362 "name": "link",
13363 "type": "string"
13364 }
13365 ],
13366 "type": "ExportedChatInvite"
13367 },
13368 {
13369 "id": "1516793212",
13370 "predicate": "chatInviteAlready",
13371 "params": [
13372 {
13373 "name": "chat",
13374 "type": "Chat"
13375 }
13376 ],
13377 "type": "ChatInvite"
13378 },
13379 {
13380 "id": "-613092008",
13381 "predicate": "chatInvite",
13382 "params": [
13383 {
13384 "name": "flags",
13385 "type": "#"
13386 },
13387 {
13388 "name": "channel",
13389 "type": "flags.0?true"
13390 },
13391 {
13392 "name": "broadcast",
13393 "type": "flags.1?true"
13394 },
13395 {
13396 "name": "public",
13397 "type": "flags.2?true"
13398 },
13399 {
13400 "name": "megagroup",
13401 "type": "flags.3?true"
13402 },
13403 {
13404 "name": "title",
13405 "type": "string"
13406 },
13407 {
13408 "name": "photo",
13409 "type": "ChatPhoto"
13410 },
13411 {
13412 "name": "participants_count",
13413 "type": "int"
13414 },
13415 {
13416 "name": "participants",
13417 "type": "flags.4?Vector<User>"
13418 }
13419 ],
13420 "type": "ChatInvite"
13421 },
13422 {
13423 "id": "-123931160",
13424 "predicate": "messageActionChatJoinedByLink",
13425 "params": [
13426 {
13427 "name": "inviter_id",
13428 "type": "int"
13429 }
13430 ],
13431 "type": "MessageAction"
13432 },
13433 {
13434 "id": "1757493555",
13435 "predicate": "updateReadMessagesContents",
13436 "params": [
13437 {
13438 "name": "messages",
13439 "type": "Vector<int>"
13440 },
13441 {
13442 "name": "pts",
13443 "type": "int"
13444 },
13445 {
13446 "name": "pts_count",
13447 "type": "int"
13448 }
13449 ],
13450 "type": "Update"
13451 },
13452 {
13453 "id": "-4838507",
13454 "predicate": "inputStickerSetEmpty",
13455 "params": [],
13456 "type": "InputStickerSet"
13457 },
13458 {
13459 "id": "-1645763991",
13460 "predicate": "inputStickerSetID",
13461 "params": [
13462 {
13463 "name": "id",
13464 "type": "long"
13465 },
13466 {
13467 "name": "access_hash",
13468 "type": "long"
13469 }
13470 ],
13471 "type": "InputStickerSet"
13472 },
13473 {
13474 "id": "-2044933984",
13475 "predicate": "inputStickerSetShortName",
13476 "params": [
13477 {
13478 "name": "short_name",
13479 "type": "string"
13480 }
13481 ],
13482 "type": "InputStickerSet"
13483 },
13484 {
13485 "id": "-852477119",
13486 "predicate": "stickerSet",
13487 "params": [
13488 {
13489 "name": "flags",
13490 "type": "#"
13491 },
13492 {
13493 "name": "installed",
13494 "type": "flags.0?true"
13495 },
13496 {
13497 "name": "archived",
13498 "type": "flags.1?true"
13499 },
13500 {
13501 "name": "official",
13502 "type": "flags.2?true"
13503 },
13504 {
13505 "name": "masks",
13506 "type": "flags.3?true"
13507 },
13508 {
13509 "name": "id",
13510 "type": "long"
13511 },
13512 {
13513 "name": "access_hash",
13514 "type": "long"
13515 },
13516 {
13517 "name": "title",
13518 "type": "string"
13519 },
13520 {
13521 "name": "short_name",
13522 "type": "string"
13523 },
13524 {
13525 "name": "count",
13526 "type": "int"
13527 },
13528 {
13529 "name": "hash",
13530 "type": "int"
13531 }
13532 ],
13533 "type": "StickerSet"
13534 },
13535 {
13536 "id": "-1240849242",
13537 "predicate": "messages.stickerSet",
13538 "params": [
13539 {
13540 "name": "set",
13541 "type": "StickerSet"
13542 },
13543 {
13544 "name": "packs",
13545 "type": "Vector<StickerPack>"
13546 },
13547 {
13548 "name": "documents",
13549 "type": "Vector<Document>"
13550 }
13551 ],
13552 "type": "messages.StickerSet"
13553 },
13554 {
13555 "id": "-787638374",
13556 "predicate": "user",
13557 "params": [
13558 {
13559 "name": "flags",
13560 "type": "#"
13561 },
13562 {
13563 "name": "self",
13564 "type": "flags.10?true"
13565 },
13566 {
13567 "name": "contact",
13568 "type": "flags.11?true"
13569 },
13570 {
13571 "name": "mutual_contact",
13572 "type": "flags.12?true"
13573 },
13574 {
13575 "name": "deleted",
13576 "type": "flags.13?true"
13577 },
13578 {
13579 "name": "bot",
13580 "type": "flags.14?true"
13581 },
13582 {
13583 "name": "bot_chat_history",
13584 "type": "flags.15?true"
13585 },
13586 {
13587 "name": "bot_nochats",
13588 "type": "flags.16?true"
13589 },
13590 {
13591 "name": "verified",
13592 "type": "flags.17?true"
13593 },
13594 {
13595 "name": "restricted",
13596 "type": "flags.18?true"
13597 },
13598 {
13599 "name": "min",
13600 "type": "flags.20?true"
13601 },
13602 {
13603 "name": "bot_inline_geo",
13604 "type": "flags.21?true"
13605 },
13606 {
13607 "name": "id",
13608 "type": "int"
13609 },
13610 {
13611 "name": "access_hash",
13612 "type": "flags.0?long"
13613 },
13614 {
13615 "name": "first_name",
13616 "type": "flags.1?string"
13617 },
13618 {
13619 "name": "last_name",
13620 "type": "flags.2?string"
13621 },
13622 {
13623 "name": "username",
13624 "type": "flags.3?string"
13625 },
13626 {
13627 "name": "phone",
13628 "type": "flags.4?string"
13629 },
13630 {
13631 "name": "photo",
13632 "type": "flags.5?UserProfilePhoto"
13633 },
13634 {
13635 "name": "status",
13636 "type": "flags.6?UserStatus"
13637 },
13638 {
13639 "name": "bot_info_version",
13640 "type": "flags.14?int"
13641 },
13642 {
13643 "name": "restriction_reason",
13644 "type": "flags.18?string"
13645 },
13646 {
13647 "name": "bot_inline_placeholder",
13648 "type": "flags.19?string"
13649 }
13650 ],
13651 "type": "User"
13652 },
13653 {
13654 "id": "-1032140601",
13655 "predicate": "botCommand",
13656 "params": [
13657 {
13658 "name": "command",
13659 "type": "string"
13660 },
13661 {
13662 "name": "description",
13663 "type": "string"
13664 }
13665 ],
13666 "type": "BotCommand"
13667 },
13668 {
13669 "id": "-1729618630",
13670 "predicate": "botInfo",
13671 "params": [
13672 {
13673 "name": "user_id",
13674 "type": "int"
13675 },
13676 {
13677 "name": "description",
13678 "type": "string"
13679 },
13680 {
13681 "name": "commands",
13682 "type": "Vector<BotCommand>"
13683 }
13684 ],
13685 "type": "BotInfo"
13686 },
13687 {
13688 "id": "-1560655744",
13689 "predicate": "keyboardButton",
13690 "params": [
13691 {
13692 "name": "text",
13693 "type": "string"
13694 }
13695 ],
13696 "type": "KeyboardButton"
13697 },
13698 {
13699 "id": "2002815875",
13700 "predicate": "keyboardButtonRow",
13701 "params": [
13702 {
13703 "name": "buttons",
13704 "type": "Vector<KeyboardButton>"
13705 }
13706 ],
13707 "type": "KeyboardButtonRow"
13708 },
13709 {
13710 "id": "-1606526075",
13711 "predicate": "replyKeyboardHide",
13712 "params": [
13713 {
13714 "name": "flags",
13715 "type": "#"
13716 },
13717 {
13718 "name": "selective",
13719 "type": "flags.2?true"
13720 }
13721 ],
13722 "type": "ReplyMarkup"
13723 },
13724 {
13725 "id": "-200242528",
13726 "predicate": "replyKeyboardForceReply",
13727 "params": [
13728 {
13729 "name": "flags",
13730 "type": "#"
13731 },
13732 {
13733 "name": "single_use",
13734 "type": "flags.1?true"
13735 },
13736 {
13737 "name": "selective",
13738 "type": "flags.2?true"
13739 }
13740 ],
13741 "type": "ReplyMarkup"
13742 },
13743 {
13744 "id": "889353612",
13745 "predicate": "replyKeyboardMarkup",
13746 "params": [
13747 {
13748 "name": "flags",
13749 "type": "#"
13750 },
13751 {
13752 "name": "resize",
13753 "type": "flags.0?true"
13754 },
13755 {
13756 "name": "single_use",
13757 "type": "flags.1?true"
13758 },
13759 {
13760 "name": "selective",
13761 "type": "flags.2?true"
13762 },
13763 {
13764 "name": "rows",
13765 "type": "Vector<KeyboardButtonRow>"
13766 }
13767 ],
13768 "type": "ReplyMarkup"
13769 },
13770 {
13771 "id": "2072935910",
13772 "predicate": "inputPeerUser",
13773 "params": [
13774 {
13775 "name": "user_id",
13776 "type": "int"
13777 },
13778 {
13779 "name": "access_hash",
13780 "type": "long"
13781 }
13782 ],
13783 "type": "InputPeer"
13784 },
13785 {
13786 "id": "-668391402",
13787 "predicate": "inputUser",
13788 "params": [
13789 {
13790 "name": "user_id",
13791 "type": "int"
13792 },
13793 {
13794 "name": "access_hash",
13795 "type": "long"
13796 }
13797 ],
13798 "type": "InputUser"
13799 },
13800 {
13801 "id": "-1350696044",
13802 "predicate": "help.appChangelogEmpty",
13803 "params": [],
13804 "type": "help.AppChangelog"
13805 },
13806 {
13807 "id": "1181279933",
13808 "predicate": "help.appChangelog",
13809 "params": [
13810 {
13811 "name": "text",
13812 "type": "string"
13813 }
13814 ],
13815 "type": "help.AppChangelog"
13816 },
13817 {
13818 "id": "-1148011883",
13819 "predicate": "messageEntityUnknown",
13820 "params": [
13821 {
13822 "name": "offset",
13823 "type": "int"
13824 },
13825 {
13826 "name": "length",
13827 "type": "int"
13828 }
13829 ],
13830 "type": "MessageEntity"
13831 },
13832 {
13833 "id": "-100378723",
13834 "predicate": "messageEntityMention",
13835 "params": [
13836 {
13837 "name": "offset",
13838 "type": "int"
13839 },
13840 {
13841 "name": "length",
13842 "type": "int"
13843 }
13844 ],
13845 "type": "MessageEntity"
13846 },
13847 {
13848 "id": "1868782349",
13849 "predicate": "messageEntityHashtag",
13850 "params": [
13851 {
13852 "name": "offset",
13853 "type": "int"
13854 },
13855 {
13856 "name": "length",
13857 "type": "int"
13858 }
13859 ],
13860 "type": "MessageEntity"
13861 },
13862 {
13863 "id": "1827637959",
13864 "predicate": "messageEntityBotCommand",
13865 "params": [
13866 {
13867 "name": "offset",
13868 "type": "int"
13869 },
13870 {
13871 "name": "length",
13872 "type": "int"
13873 }
13874 ],
13875 "type": "MessageEntity"
13876 },
13877 {
13878 "id": "1859134776",
13879 "predicate": "messageEntityUrl",
13880 "params": [
13881 {
13882 "name": "offset",
13883 "type": "int"
13884 },
13885 {
13886 "name": "length",
13887 "type": "int"
13888 }
13889 ],
13890 "type": "MessageEntity"
13891 },
13892 {
13893 "id": "1692693954",
13894 "predicate": "messageEntityEmail",
13895 "params": [
13896 {
13897 "name": "offset",
13898 "type": "int"
13899 },
13900 {
13901 "name": "length",
13902 "type": "int"
13903 }
13904 ],
13905 "type": "MessageEntity"
13906 },
13907 {
13908 "id": "-1117713463",
13909 "predicate": "messageEntityBold",
13910 "params": [
13911 {
13912 "name": "offset",
13913 "type": "int"
13914 },
13915 {
13916 "name": "length",
13917 "type": "int"
13918 }
13919 ],
13920 "type": "MessageEntity"
13921 },
13922 {
13923 "id": "-2106619040",
13924 "predicate": "messageEntityItalic",
13925 "params": [
13926 {
13927 "name": "offset",
13928 "type": "int"
13929 },
13930 {
13931 "name": "length",
13932 "type": "int"
13933 }
13934 ],
13935 "type": "MessageEntity"
13936 },
13937 {
13938 "id": "681706865",
13939 "predicate": "messageEntityCode",
13940 "params": [
13941 {
13942 "name": "offset",
13943 "type": "int"
13944 },
13945 {
13946 "name": "length",
13947 "type": "int"
13948 }
13949 ],
13950 "type": "MessageEntity"
13951 },
13952 {
13953 "id": "1938967520",
13954 "predicate": "messageEntityPre",
13955 "params": [
13956 {
13957 "name": "offset",
13958 "type": "int"
13959 },
13960 {
13961 "name": "length",
13962 "type": "int"
13963 },
13964 {
13965 "name": "language",
13966 "type": "string"
13967 }
13968 ],
13969 "type": "MessageEntity"
13970 },
13971 {
13972 "id": "1990644519",
13973 "predicate": "messageEntityTextUrl",
13974 "params": [
13975 {
13976 "name": "offset",
13977 "type": "int"
13978 },
13979 {
13980 "name": "length",
13981 "type": "int"
13982 },
13983 {
13984 "name": "url",
13985 "type": "string"
13986 }
13987 ],
13988 "type": "MessageEntity"
13989 },
13990 {
13991 "id": "301019932",
13992 "predicate": "updateShortSentMessage",
13993 "params": [
13994 {
13995 "name": "flags",
13996 "type": "#"
13997 },
13998 {
13999 "name": "out",
14000 "type": "flags.1?true"
14001 },
14002 {
14003 "name": "id",
14004 "type": "int"
14005 },
14006 {
14007 "name": "pts",
14008 "type": "int"
14009 },
14010 {
14011 "name": "pts_count",
14012 "type": "int"
14013 },
14014 {
14015 "name": "date",
14016 "type": "int"
14017 },
14018 {
14019 "name": "media",
14020 "type": "flags.9?MessageMedia"
14021 },
14022 {
14023 "name": "entities",
14024 "type": "flags.7?Vector<MessageEntity>"
14025 }
14026 ],
14027 "type": "Updates"
14028 },
14029 {
14030 "id": "-292807034",
14031 "predicate": "inputChannelEmpty",
14032 "params": [],
14033 "type": "InputChannel"
14034 },
14035 {
14036 "id": "-1343524562",
14037 "predicate": "inputChannel",
14038 "params": [
14039 {
14040 "name": "channel_id",
14041 "type": "int"
14042 },
14043 {
14044 "name": "access_hash",
14045 "type": "long"
14046 }
14047 ],
14048 "type": "InputChannel"
14049 },
14050 {
14051 "id": "-1109531342",
14052 "predicate": "peerChannel",
14053 "params": [
14054 {
14055 "name": "channel_id",
14056 "type": "int"
14057 }
14058 ],
14059 "type": "Peer"
14060 },
14061 {
14062 "id": "548253432",
14063 "predicate": "inputPeerChannel",
14064 "params": [
14065 {
14066 "name": "channel_id",
14067 "type": "int"
14068 },
14069 {
14070 "name": "access_hash",
14071 "type": "long"
14072 }
14073 ],
14074 "type": "InputPeer"
14075 },
14076 {
14077 "id": "-1588737454",
14078 "predicate": "channel",
14079 "params": [
14080 {
14081 "name": "flags",
14082 "type": "#"
14083 },
14084 {
14085 "name": "creator",
14086 "type": "flags.0?true"
14087 },
14088 {
14089 "name": "kicked",
14090 "type": "flags.1?true"
14091 },
14092 {
14093 "name": "left",
14094 "type": "flags.2?true"
14095 },
14096 {
14097 "name": "editor",
14098 "type": "flags.3?true"
14099 },
14100 {
14101 "name": "moderator",
14102 "type": "flags.4?true"
14103 },
14104 {
14105 "name": "broadcast",
14106 "type": "flags.5?true"
14107 },
14108 {
14109 "name": "verified",
14110 "type": "flags.7?true"
14111 },
14112 {
14113 "name": "megagroup",
14114 "type": "flags.8?true"
14115 },
14116 {
14117 "name": "restricted",
14118 "type": "flags.9?true"
14119 },
14120 {
14121 "name": "democracy",
14122 "type": "flags.10?true"
14123 },
14124 {
14125 "name": "signatures",
14126 "type": "flags.11?true"
14127 },
14128 {
14129 "name": "min",
14130 "type": "flags.12?true"
14131 },
14132 {
14133 "name": "id",
14134 "type": "int"
14135 },
14136 {
14137 "name": "access_hash",
14138 "type": "flags.13?long"
14139 },
14140 {
14141 "name": "title",
14142 "type": "string"
14143 },
14144 {
14145 "name": "username",
14146 "type": "flags.6?string"
14147 },
14148 {
14149 "name": "photo",
14150 "type": "ChatPhoto"
14151 },
14152 {
14153 "name": "date",
14154 "type": "int"
14155 },
14156 {
14157 "name": "version",
14158 "type": "int"
14159 },
14160 {
14161 "name": "restriction_reason",
14162 "type": "flags.9?string"
14163 }
14164 ],
14165 "type": "Chat"
14166 },
14167 {
14168 "id": "-2059962289",
14169 "predicate": "channelForbidden",
14170 "params": [
14171 {
14172 "name": "flags",
14173 "type": "#"
14174 },
14175 {
14176 "name": "broadcast",
14177 "type": "flags.5?true"
14178 },
14179 {
14180 "name": "megagroup",
14181 "type": "flags.8?true"
14182 },
14183 {
14184 "name": "id",
14185 "type": "int"
14186 },
14187 {
14188 "name": "access_hash",
14189 "type": "long"
14190 },
14191 {
14192 "name": "title",
14193 "type": "string"
14194 }
14195 ],
14196 "type": "Chat"
14197 },
14198 {
14199 "id": "2131196633",
14200 "predicate": "contacts.resolvedPeer",
14201 "params": [
14202 {
14203 "name": "peer",
14204 "type": "Peer"
14205 },
14206 {
14207 "name": "chats",
14208 "type": "Vector<Chat>"
14209 },
14210 {
14211 "name": "users",
14212 "type": "Vector<User>"
14213 }
14214 ],
14215 "type": "contacts.ResolvedPeer"
14216 },
14217 {
14218 "id": "-1009430225",
14219 "predicate": "channelFull",
14220 "params": [
14221 {
14222 "name": "flags",
14223 "type": "#"
14224 },
14225 {
14226 "name": "can_view_participants",
14227 "type": "flags.3?true"
14228 },
14229 {
14230 "name": "can_set_username",
14231 "type": "flags.6?true"
14232 },
14233 {
14234 "name": "id",
14235 "type": "int"
14236 },
14237 {
14238 "name": "about",
14239 "type": "string"
14240 },
14241 {
14242 "name": "participants_count",
14243 "type": "flags.0?int"
14244 },
14245 {
14246 "name": "admins_count",
14247 "type": "flags.1?int"
14248 },
14249 {
14250 "name": "kicked_count",
14251 "type": "flags.2?int"
14252 },
14253 {
14254 "name": "read_inbox_max_id",
14255 "type": "int"
14256 },
14257 {
14258 "name": "read_outbox_max_id",
14259 "type": "int"
14260 },
14261 {
14262 "name": "unread_count",
14263 "type": "int"
14264 },
14265 {
14266 "name": "chat_photo",
14267 "type": "Photo"
14268 },
14269 {
14270 "name": "notify_settings",
14271 "type": "PeerNotifySettings"
14272 },
14273 {
14274 "name": "exported_invite",
14275 "type": "ExportedChatInvite"
14276 },
14277 {
14278 "name": "bot_info",
14279 "type": "Vector<BotInfo>"
14280 },
14281 {
14282 "name": "migrated_from_chat_id",
14283 "type": "flags.4?int"
14284 },
14285 {
14286 "name": "migrated_from_max_id",
14287 "type": "flags.4?int"
14288 },
14289 {
14290 "name": "pinned_msg_id",
14291 "type": "flags.5?int"
14292 }
14293 ],
14294 "type": "ChatFull"
14295 },
14296 {
14297 "id": "182649427",
14298 "predicate": "messageRange",
14299 "params": [
14300 {
14301 "name": "min_id",
14302 "type": "int"
14303 },
14304 {
14305 "name": "max_id",
14306 "type": "int"
14307 }
14308 ],
14309 "type": "MessageRange"
14310 },
14311 {
14312 "id": "-1725551049",
14313 "predicate": "messages.channelMessages",
14314 "params": [
14315 {
14316 "name": "flags",
14317 "type": "#"
14318 },
14319 {
14320 "name": "pts",
14321 "type": "int"
14322 },
14323 {
14324 "name": "count",
14325 "type": "int"
14326 },
14327 {
14328 "name": "messages",
14329 "type": "Vector<Message>"
14330 },
14331 {
14332 "name": "chats",
14333 "type": "Vector<Chat>"
14334 },
14335 {
14336 "name": "users",
14337 "type": "Vector<User>"
14338 }
14339 ],
14340 "type": "messages.Messages"
14341 },
14342 {
14343 "id": "-1781355374",
14344 "predicate": "messageActionChannelCreate",
14345 "params": [
14346 {
14347 "name": "title",
14348 "type": "string"
14349 }
14350 ],
14351 "type": "MessageAction"
14352 },
14353 {
14354 "id": "-352032773",
14355 "predicate": "updateChannelTooLong",
14356 "params": [
14357 {
14358 "name": "flags",
14359 "type": "#"
14360 },
14361 {
14362 "name": "channel_id",
14363 "type": "int"
14364 },
14365 {
14366 "name": "pts",
14367 "type": "flags.0?int"
14368 }
14369 ],
14370 "type": "Update"
14371 },
14372 {
14373 "id": "-1227598250",
14374 "predicate": "updateChannel",
14375 "params": [
14376 {
14377 "name": "channel_id",
14378 "type": "int"
14379 }
14380 ],
14381 "type": "Update"
14382 },
14383 {
14384 "id": "1656358105",
14385 "predicate": "updateNewChannelMessage",
14386 "params": [
14387 {
14388 "name": "message",
14389 "type": "Message"
14390 },
14391 {
14392 "name": "pts",
14393 "type": "int"
14394 },
14395 {
14396 "name": "pts_count",
14397 "type": "int"
14398 }
14399 ],
14400 "type": "Update"
14401 },
14402 {
14403 "id": "1108669311",
14404 "predicate": "updateReadChannelInbox",
14405 "params": [
14406 {
14407 "name": "channel_id",
14408 "type": "int"
14409 },
14410 {
14411 "name": "max_id",
14412 "type": "int"
14413 }
14414 ],
14415 "type": "Update"
14416 },
14417 {
14418 "id": "-1015733815",
14419 "predicate": "updateDeleteChannelMessages",
14420 "params": [
14421 {
14422 "name": "channel_id",
14423 "type": "int"
14424 },
14425 {
14426 "name": "messages",
14427 "type": "Vector<int>"
14428 },
14429 {
14430 "name": "pts",
14431 "type": "int"
14432 },
14433 {
14434 "name": "pts_count",
14435 "type": "int"
14436 }
14437 ],
14438 "type": "Update"
14439 },
14440 {
14441 "id": "-1734268085",
14442 "predicate": "updateChannelMessageViews",
14443 "params": [
14444 {
14445 "name": "channel_id",
14446 "type": "int"
14447 },
14448 {
14449 "name": "id",
14450 "type": "int"
14451 },
14452 {
14453 "name": "views",
14454 "type": "int"
14455 }
14456 ],
14457 "type": "Update"
14458 },
14459 {
14460 "id": "1041346555",
14461 "predicate": "updates.channelDifferenceEmpty",
14462 "params": [
14463 {
14464 "name": "flags",
14465 "type": "#"
14466 },
14467 {
14468 "name": "final",
14469 "type": "flags.0?true"
14470 },
14471 {
14472 "name": "pts",
14473 "type": "int"
14474 },
14475 {
14476 "name": "timeout",
14477 "type": "flags.1?int"
14478 }
14479 ],
14480 "type": "updates.ChannelDifference"
14481 },
14482 {
14483 "id": "1091431943",
14484 "predicate": "updates.channelDifferenceTooLong",
14485 "params": [
14486 {
14487 "name": "flags",
14488 "type": "#"
14489 },
14490 {
14491 "name": "final",
14492 "type": "flags.0?true"
14493 },
14494 {
14495 "name": "pts",
14496 "type": "int"
14497 },
14498 {
14499 "name": "timeout",
14500 "type": "flags.1?int"
14501 },
14502 {
14503 "name": "top_message",
14504 "type": "int"
14505 },
14506 {
14507 "name": "read_inbox_max_id",
14508 "type": "int"
14509 },
14510 {
14511 "name": "read_outbox_max_id",
14512 "type": "int"
14513 },
14514 {
14515 "name": "unread_count",
14516 "type": "int"
14517 },
14518 {
14519 "name": "messages",
14520 "type": "Vector<Message>"
14521 },
14522 {
14523 "name": "chats",
14524 "type": "Vector<Chat>"
14525 },
14526 {
14527 "name": "users",
14528 "type": "Vector<User>"
14529 }
14530 ],
14531 "type": "updates.ChannelDifference"
14532 },
14533 {
14534 "id": "543450958",
14535 "predicate": "updates.channelDifference",
14536 "params": [
14537 {
14538 "name": "flags",
14539 "type": "#"
14540 },
14541 {
14542 "name": "final",
14543 "type": "flags.0?true"
14544 },
14545 {
14546 "name": "pts",
14547 "type": "int"
14548 },
14549 {
14550 "name": "timeout",
14551 "type": "flags.1?int"
14552 },
14553 {
14554 "name": "new_messages",
14555 "type": "Vector<Message>"
14556 },
14557 {
14558 "name": "other_updates",
14559 "type": "Vector<Update>"
14560 },
14561 {
14562 "name": "chats",
14563 "type": "Vector<Chat>"
14564 },
14565 {
14566 "name": "users",
14567 "type": "Vector<User>"
14568 }
14569 ],
14570 "type": "updates.ChannelDifference"
14571 },
14572 {
14573 "id": "-1798033689",
14574 "predicate": "channelMessagesFilterEmpty",
14575 "params": [],
14576 "type": "ChannelMessagesFilter"
14577 },
14578 {
14579 "id": "-847783593",
14580 "predicate": "channelMessagesFilter",
14581 "params": [
14582 {
14583 "name": "flags",
14584 "type": "#"
14585 },
14586 {
14587 "name": "exclude_new_messages",
14588 "type": "flags.1?true"
14589 },
14590 {
14591 "name": "ranges",
14592 "type": "Vector<MessageRange>"
14593 }
14594 ],
14595 "type": "ChannelMessagesFilter"
14596 },
14597 {
14598 "id": "367766557",
14599 "predicate": "channelParticipant",
14600 "params": [
14601 {
14602 "name": "user_id",
14603 "type": "int"
14604 },
14605 {
14606 "name": "date",
14607 "type": "int"
14608 }
14609 ],
14610 "type": "ChannelParticipant"
14611 },
14612 {
14613 "id": "-1557620115",
14614 "predicate": "channelParticipantSelf",
14615 "params": [
14616 {
14617 "name": "user_id",
14618 "type": "int"
14619 },
14620 {
14621 "name": "inviter_id",
14622 "type": "int"
14623 },
14624 {
14625 "name": "date",
14626 "type": "int"
14627 }
14628 ],
14629 "type": "ChannelParticipant"
14630 },
14631 {
14632 "id": "-1861910545",
14633 "predicate": "channelParticipantModerator",
14634 "params": [
14635 {
14636 "name": "user_id",
14637 "type": "int"
14638 },
14639 {
14640 "name": "inviter_id",
14641 "type": "int"
14642 },
14643 {
14644 "name": "date",
14645 "type": "int"
14646 }
14647 ],
14648 "type": "ChannelParticipant"
14649 },
14650 {
14651 "id": "-1743180447",
14652 "predicate": "channelParticipantEditor",
14653 "params": [
14654 {
14655 "name": "user_id",
14656 "type": "int"
14657 },
14658 {
14659 "name": "inviter_id",
14660 "type": "int"
14661 },
14662 {
14663 "name": "date",
14664 "type": "int"
14665 }
14666 ],
14667 "type": "ChannelParticipant"
14668 },
14669 {
14670 "id": "-1933187430",
14671 "predicate": "channelParticipantKicked",
14672 "params": [
14673 {
14674 "name": "user_id",
14675 "type": "int"
14676 },
14677 {
14678 "name": "kicked_by",
14679 "type": "int"
14680 },
14681 {
14682 "name": "date",
14683 "type": "int"
14684 }
14685 ],
14686 "type": "ChannelParticipant"
14687 },
14688 {
14689 "id": "-471670279",
14690 "predicate": "channelParticipantCreator",
14691 "params": [
14692 {
14693 "name": "user_id",
14694 "type": "int"
14695 }
14696 ],
14697 "type": "ChannelParticipant"
14698 },
14699 {
14700 "id": "-566281095",
14701 "predicate": "channelParticipantsRecent",
14702 "params": [],
14703 "type": "ChannelParticipantsFilter"
14704 },
14705 {
14706 "id": "-1268741783",
14707 "predicate": "channelParticipantsAdmins",
14708 "params": [],
14709 "type": "ChannelParticipantsFilter"
14710 },
14711 {
14712 "id": "1010285434",
14713 "predicate": "channelParticipantsKicked",
14714 "params": [],
14715 "type": "ChannelParticipantsFilter"
14716 },
14717 {
14718 "id": "-1299865402",
14719 "predicate": "channelRoleEmpty",
14720 "params": [],
14721 "type": "ChannelParticipantRole"
14722 },
14723 {
14724 "id": "-1776756363",
14725 "predicate": "channelRoleModerator",
14726 "params": [],
14727 "type": "ChannelParticipantRole"
14728 },
14729 {
14730 "id": "-2113143156",
14731 "predicate": "channelRoleEditor",
14732 "params": [],
14733 "type": "ChannelParticipantRole"
14734 },
14735 {
14736 "id": "-177282392",
14737 "predicate": "channels.channelParticipants",
14738 "params": [
14739 {
14740 "name": "count",
14741 "type": "int"
14742 },
14743 {
14744 "name": "participants",
14745 "type": "Vector<ChannelParticipant>"
14746 },
14747 {
14748 "name": "users",
14749 "type": "Vector<User>"
14750 }
14751 ],
14752 "type": "channels.ChannelParticipants"
14753 },
14754 {
14755 "id": "-791039645",
14756 "predicate": "channels.channelParticipant",
14757 "params": [
14758 {
14759 "name": "participant",
14760 "type": "ChannelParticipant"
14761 },
14762 {
14763 "name": "users",
14764 "type": "Vector<User>"
14765 }
14766 ],
14767 "type": "channels.ChannelParticipant"
14768 },
14769 {
14770 "id": "-636267638",
14771 "predicate": "chatParticipantCreator",
14772 "params": [
14773 {
14774 "name": "user_id",
14775 "type": "int"
14776 }
14777 ],
14778 "type": "ChatParticipant"
14779 },
14780 {
14781 "id": "-489233354",
14782 "predicate": "chatParticipantAdmin",
14783 "params": [
14784 {
14785 "name": "user_id",
14786 "type": "int"
14787 },
14788 {
14789 "name": "inviter_id",
14790 "type": "int"
14791 },
14792 {
14793 "name": "date",
14794 "type": "int"
14795 }
14796 ],
14797 "type": "ChatParticipant"
14798 },
14799 {
14800 "id": "1855224129",
14801 "predicate": "updateChatAdmins",
14802 "params": [
14803 {
14804 "name": "chat_id",
14805 "type": "int"
14806 },
14807 {
14808 "name": "enabled",
14809 "type": "Bool"
14810 },
14811 {
14812 "name": "version",
14813 "type": "int"
14814 }
14815 ],
14816 "type": "Update"
14817 },
14818 {
14819 "id": "-1232070311",
14820 "predicate": "updateChatParticipantAdmin",
14821 "params": [
14822 {
14823 "name": "chat_id",
14824 "type": "int"
14825 },
14826 {
14827 "name": "user_id",
14828 "type": "int"
14829 },
14830 {
14831 "name": "is_admin",
14832 "type": "Bool"
14833 },
14834 {
14835 "name": "version",
14836 "type": "int"
14837 }
14838 ],
14839 "type": "Update"
14840 },
14841 {
14842 "id": "1371385889",
14843 "predicate": "messageActionChatMigrateTo",
14844 "params": [
14845 {
14846 "name": "channel_id",
14847 "type": "int"
14848 }
14849 ],
14850 "type": "MessageAction"
14851 },
14852 {
14853 "id": "-1336546578",
14854 "predicate": "messageActionChannelMigrateFrom",
14855 "params": [
14856 {
14857 "name": "title",
14858 "type": "string"
14859 },
14860 {
14861 "name": "chat_id",
14862 "type": "int"
14863 }
14864 ],
14865 "type": "MessageAction"
14866 },
14867 {
14868 "id": "-1328445861",
14869 "predicate": "channelParticipantsBots",
14870 "params": [],
14871 "type": "ChannelParticipantsFilter"
14872 },
14873 {
14874 "id": "-236044656",
14875 "predicate": "help.termsOfService",
14876 "params": [
14877 {
14878 "name": "text",
14879 "type": "string"
14880 }
14881 ],
14882 "type": "help.TermsOfService"
14883 },
14884 {
14885 "id": "1753886890",
14886 "predicate": "updateNewStickerSet",
14887 "params": [
14888 {
14889 "name": "stickerset",
14890 "type": "messages.StickerSet"
14891 }
14892 ],
14893 "type": "Update"
14894 },
14895 {
14896 "id": "196268545",
14897 "predicate": "updateStickerSetsOrder",
14898 "params": [
14899 {
14900 "name": "flags",
14901 "type": "#"
14902 },
14903 {
14904 "name": "masks",
14905 "type": "flags.0?true"
14906 },
14907 {
14908 "name": "order",
14909 "type": "Vector<long>"
14910 }
14911 ],
14912 "type": "Update"
14913 },
14914 {
14915 "id": "1135492588",
14916 "predicate": "updateStickerSets",
14917 "params": [],
14918 "type": "Update"
14919 },
14920 {
14921 "id": "372165663",
14922 "predicate": "foundGif",
14923 "params": [
14924 {
14925 "name": "url",
14926 "type": "string"
14927 },
14928 {
14929 "name": "thumb_url",
14930 "type": "string"
14931 },
14932 {
14933 "name": "content_url",
14934 "type": "string"
14935 },
14936 {
14937 "name": "content_type",
14938 "type": "string"
14939 },
14940 {
14941 "name": "w",
14942 "type": "int"
14943 },
14944 {
14945 "name": "h",
14946 "type": "int"
14947 }
14948 ],
14949 "type": "FoundGif"
14950 },
14951 {
14952 "id": "-1670052855",
14953 "predicate": "foundGifCached",
14954 "params": [
14955 {
14956 "name": "url",
14957 "type": "string"
14958 },
14959 {
14960 "name": "photo",
14961 "type": "Photo"
14962 },
14963 {
14964 "name": "document",
14965 "type": "Document"
14966 }
14967 ],
14968 "type": "FoundGif"
14969 },
14970 {
14971 "id": "1212395773",
14972 "predicate": "inputMediaGifExternal",
14973 "params": [
14974 {
14975 "name": "url",
14976 "type": "string"
14977 },
14978 {
14979 "name": "q",
14980 "type": "string"
14981 }
14982 ],
14983 "type": "InputMedia"
14984 },
14985 {
14986 "id": "1158290442",
14987 "predicate": "messages.foundGifs",
14988 "params": [
14989 {
14990 "name": "next_offset",
14991 "type": "int"
14992 },
14993 {
14994 "name": "results",
14995 "type": "Vector<FoundGif>"
14996 }
14997 ],
14998 "type": "messages.FoundGifs"
14999 },
15000 {
15001 "id": "-402498398",
15002 "predicate": "messages.savedGifsNotModified",
15003 "params": [],
15004 "type": "messages.SavedGifs"
15005 },
15006 {
15007 "id": "772213157",
15008 "predicate": "messages.savedGifs",
15009 "params": [
15010 {
15011 "name": "hash",
15012 "type": "int"
15013 },
15014 {
15015 "name": "gifs",
15016 "type": "Vector<Document>"
15017 }
15018 ],
15019 "type": "messages.SavedGifs"
15020 },
15021 {
15022 "id": "-1821035490",
15023 "predicate": "updateSavedGifs",
15024 "params": [],
15025 "type": "Update"
15026 },
15027 {
15028 "id": "691006739",
15029 "predicate": "inputBotInlineMessageMediaAuto",
15030 "params": [
15031 {
15032 "name": "flags",
15033 "type": "#"
15034 },
15035 {
15036 "name": "caption",
15037 "type": "string"
15038 },
15039 {
15040 "name": "reply_markup",
15041 "type": "flags.2?ReplyMarkup"
15042 }
15043 ],
15044 "type": "InputBotInlineMessage"
15045 },
15046 {
15047 "id": "1036876423",
15048 "predicate": "inputBotInlineMessageText",
15049 "params": [
15050 {
15051 "name": "flags",
15052 "type": "#"
15053 },
15054 {
15055 "name": "no_webpage",
15056 "type": "flags.0?true"
15057 },
15058 {
15059 "name": "message",
15060 "type": "string"
15061 },
15062 {
15063 "name": "entities",
15064 "type": "flags.1?Vector<MessageEntity>"
15065 },
15066 {
15067 "name": "reply_markup",
15068 "type": "flags.2?ReplyMarkup"
15069 }
15070 ],
15071 "type": "InputBotInlineMessage"
15072 },
15073 {
15074 "id": "750510426",
15075 "predicate": "inputBotInlineResult",
15076 "params": [
15077 {
15078 "name": "flags",
15079 "type": "#"
15080 },
15081 {
15082 "name": "id",
15083 "type": "string"
15084 },
15085 {
15086 "name": "type",
15087 "type": "string"
15088 },
15089 {
15090 "name": "title",
15091 "type": "flags.1?string"
15092 },
15093 {
15094 "name": "description",
15095 "type": "flags.2?string"
15096 },
15097 {
15098 "name": "url",
15099 "type": "flags.3?string"
15100 },
15101 {
15102 "name": "thumb_url",
15103 "type": "flags.4?string"
15104 },
15105 {
15106 "name": "content_url",
15107 "type": "flags.5?string"
15108 },
15109 {
15110 "name": "content_type",
15111 "type": "flags.5?string"
15112 },
15113 {
15114 "name": "w",
15115 "type": "flags.6?int"
15116 },
15117 {
15118 "name": "h",
15119 "type": "flags.6?int"
15120 },
15121 {
15122 "name": "duration",
15123 "type": "flags.7?int"
15124 },
15125 {
15126 "name": "send_message",
15127 "type": "InputBotInlineMessage"
15128 }
15129 ],
15130 "type": "InputBotInlineResult"
15131 },
15132 {
15133 "id": "175419739",
15134 "predicate": "botInlineMessageMediaAuto",
15135 "params": [
15136 {
15137 "name": "flags",
15138 "type": "#"
15139 },
15140 {
15141 "name": "caption",
15142 "type": "string"
15143 },
15144 {
15145 "name": "reply_markup",
15146 "type": "flags.2?ReplyMarkup"
15147 }
15148 ],
15149 "type": "BotInlineMessage"
15150 },
15151 {
15152 "id": "-1937807902",
15153 "predicate": "botInlineMessageText",
15154 "params": [
15155 {
15156 "name": "flags",
15157 "type": "#"
15158 },
15159 {
15160 "name": "no_webpage",
15161 "type": "flags.0?true"
15162 },
15163 {
15164 "name": "message",
15165 "type": "string"
15166 },
15167 {
15168 "name": "entities",
15169 "type": "flags.1?Vector<MessageEntity>"
15170 },
15171 {
15172 "name": "reply_markup",
15173 "type": "flags.2?ReplyMarkup"
15174 }
15175 ],
15176 "type": "BotInlineMessage"
15177 },
15178 {
15179 "id": "-1679053127",
15180 "predicate": "botInlineResult",
15181 "params": [
15182 {
15183 "name": "flags",
15184 "type": "#"
15185 },
15186 {
15187 "name": "id",
15188 "type": "string"
15189 },
15190 {
15191 "name": "type",
15192 "type": "string"
15193 },
15194 {
15195 "name": "title",
15196 "type": "flags.1?string"
15197 },
15198 {
15199 "name": "description",
15200 "type": "flags.2?string"
15201 },
15202 {
15203 "name": "url",
15204 "type": "flags.3?string"
15205 },
15206 {
15207 "name": "thumb_url",
15208 "type": "flags.4?string"
15209 },
15210 {
15211 "name": "content_url",
15212 "type": "flags.5?string"
15213 },
15214 {
15215 "name": "content_type",
15216 "type": "flags.5?string"
15217 },
15218 {
15219 "name": "w",
15220 "type": "flags.6?int"
15221 },
15222 {
15223 "name": "h",
15224 "type": "flags.6?int"
15225 },
15226 {
15227 "name": "duration",
15228 "type": "flags.7?int"
15229 },
15230 {
15231 "name": "send_message",
15232 "type": "BotInlineMessage"
15233 }
15234 ],
15235 "type": "BotInlineResult"
15236 },
15237 {
15238 "id": "627509670",
15239 "predicate": "messages.botResults",
15240 "params": [
15241 {
15242 "name": "flags",
15243 "type": "#"
15244 },
15245 {
15246 "name": "gallery",
15247 "type": "flags.0?true"
15248 },
15249 {
15250 "name": "query_id",
15251 "type": "long"
15252 },
15253 {
15254 "name": "next_offset",
15255 "type": "flags.1?string"
15256 },
15257 {
15258 "name": "switch_pm",
15259 "type": "flags.2?InlineBotSwitchPM"
15260 },
15261 {
15262 "name": "results",
15263 "type": "Vector<BotInlineResult>"
15264 }
15265 ],
15266 "type": "messages.BotResults"
15267 },
15268 {
15269 "id": "1417832080",
15270 "predicate": "updateBotInlineQuery",
15271 "params": [
15272 {
15273 "name": "flags",
15274 "type": "#"
15275 },
15276 {
15277 "name": "query_id",
15278 "type": "long"
15279 },
15280 {
15281 "name": "user_id",
15282 "type": "int"
15283 },
15284 {
15285 "name": "query",
15286 "type": "string"
15287 },
15288 {
15289 "name": "geo",
15290 "type": "flags.0?GeoPoint"
15291 },
15292 {
15293 "name": "offset",
15294 "type": "string"
15295 }
15296 ],
15297 "type": "Update"
15298 },
15299 {
15300 "id": "239663460",
15301 "predicate": "updateBotInlineSend",
15302 "params": [
15303 {
15304 "name": "flags",
15305 "type": "#"
15306 },
15307 {
15308 "name": "user_id",
15309 "type": "int"
15310 },
15311 {
15312 "name": "query",
15313 "type": "string"
15314 },
15315 {
15316 "name": "geo",
15317 "type": "flags.0?GeoPoint"
15318 },
15319 {
15320 "name": "id",
15321 "type": "string"
15322 },
15323 {
15324 "name": "msg_id",
15325 "type": "flags.1?InputBotInlineMessageID"
15326 }
15327 ],
15328 "type": "Update"
15329 },
15330 {
15331 "id": "1358283666",
15332 "predicate": "inputMessagesFilterVoice",
15333 "params": [],
15334 "type": "MessagesFilter"
15335 },
15336 {
15337 "id": "928101534",
15338 "predicate": "inputMessagesFilterMusic",
15339 "params": [],
15340 "type": "MessagesFilter"
15341 },
15342 {
15343 "id": "-1107622874",
15344 "predicate": "inputPrivacyKeyChatInvite",
15345 "params": [],
15346 "type": "InputPrivacyKey"
15347 },
15348 {
15349 "id": "1343122938",
15350 "predicate": "privacyKeyChatInvite",
15351 "params": [],
15352 "type": "PrivacyKey"
15353 },
15354 {
15355 "id": "524838915",
15356 "predicate": "exportedMessageLink",
15357 "params": [
15358 {
15359 "name": "link",
15360 "type": "string"
15361 }
15362 ],
15363 "type": "ExportedMessageLink"
15364 },
15365 {
15366 "id": "-947462709",
15367 "predicate": "messageFwdHeader",
15368 "params": [
15369 {
15370 "name": "flags",
15371 "type": "#"
15372 },
15373 {
15374 "name": "from_id",
15375 "type": "flags.0?int"
15376 },
15377 {
15378 "name": "date",
15379 "type": "int"
15380 },
15381 {
15382 "name": "channel_id",
15383 "type": "flags.1?int"
15384 },
15385 {
15386 "name": "channel_post",
15387 "type": "flags.2?int"
15388 }
15389 ],
15390 "type": "MessageFwdHeader"
15391 },
15392 {
15393 "id": "457133559",
15394 "predicate": "updateEditChannelMessage",
15395 "params": [
15396 {
15397 "name": "message",
15398 "type": "Message"
15399 },
15400 {
15401 "name": "pts",
15402 "type": "int"
15403 },
15404 {
15405 "name": "pts_count",
15406 "type": "int"
15407 }
15408 ],
15409 "type": "Update"
15410 },
15411 {
15412 "id": "-1738988427",
15413 "predicate": "updateChannelPinnedMessage",
15414 "params": [
15415 {
15416 "name": "channel_id",
15417 "type": "int"
15418 },
15419 {
15420 "name": "id",
15421 "type": "int"
15422 }
15423 ],
15424 "type": "Update"
15425 },
15426 {
15427 "id": "-1799538451",
15428 "predicate": "messageActionPinMessage",
15429 "params": [],
15430 "type": "MessageAction"
15431 },
15432 {
15433 "id": "1923290508",
15434 "predicate": "auth.codeTypeSms",
15435 "params": [],
15436 "type": "auth.CodeType"
15437 },
15438 {
15439 "id": "1948046307",
15440 "predicate": "auth.codeTypeCall",
15441 "params": [],
15442 "type": "auth.CodeType"
15443 },
15444 {
15445 "id": "577556219",
15446 "predicate": "auth.codeTypeFlashCall",
15447 "params": [],
15448 "type": "auth.CodeType"
15449 },
15450 {
15451 "id": "1035688326",
15452 "predicate": "auth.sentCodeTypeApp",
15453 "params": [
15454 {
15455 "name": "length",
15456 "type": "int"
15457 }
15458 ],
15459 "type": "auth.SentCodeType"
15460 },
15461 {
15462 "id": "-1073693790",
15463 "predicate": "auth.sentCodeTypeSms",
15464 "params": [
15465 {
15466 "name": "length",
15467 "type": "int"
15468 }
15469 ],
15470 "type": "auth.SentCodeType"
15471 },
15472 {
15473 "id": "1398007207",
15474 "predicate": "auth.sentCodeTypeCall",
15475 "params": [
15476 {
15477 "name": "length",
15478 "type": "int"
15479 }
15480 ],
15481 "type": "auth.SentCodeType"
15482 },
15483 {
15484 "id": "-1425815847",
15485 "predicate": "auth.sentCodeTypeFlashCall",
15486 "params": [
15487 {
15488 "name": "pattern",
15489 "type": "string"
15490 }
15491 ],
15492 "type": "auth.SentCodeType"
15493 },
15494 {
15495 "id": "629866245",
15496 "predicate": "keyboardButtonUrl",
15497 "params": [
15498 {
15499 "name": "text",
15500 "type": "string"
15501 },
15502 {
15503 "name": "url",
15504 "type": "string"
15505 }
15506 ],
15507 "type": "KeyboardButton"
15508 },
15509 {
15510 "id": "1748655686",
15511 "predicate": "keyboardButtonCallback",
15512 "params": [
15513 {
15514 "name": "text",
15515 "type": "string"
15516 },
15517 {
15518 "name": "data",
15519 "type": "bytes"
15520 }
15521 ],
15522 "type": "KeyboardButton"
15523 },
15524 {
15525 "id": "-1318425559",
15526 "predicate": "keyboardButtonRequestPhone",
15527 "params": [
15528 {
15529 "name": "text",
15530 "type": "string"
15531 }
15532 ],
15533 "type": "KeyboardButton"
15534 },
15535 {
15536 "id": "-59151553",
15537 "predicate": "keyboardButtonRequestGeoLocation",
15538 "params": [
15539 {
15540 "name": "text",
15541 "type": "string"
15542 }
15543 ],
15544 "type": "KeyboardButton"
15545 },
15546 {
15547 "id": "90744648",
15548 "predicate": "keyboardButtonSwitchInline",
15549 "params": [
15550 {
15551 "name": "flags",
15552 "type": "#"
15553 },
15554 {
15555 "name": "same_peer",
15556 "type": "flags.0?true"
15557 },
15558 {
15559 "name": "text",
15560 "type": "string"
15561 },
15562 {
15563 "name": "query",
15564 "type": "string"
15565 }
15566 ],
15567 "type": "KeyboardButton"
15568 },
15569 {
15570 "id": "1218642516",
15571 "predicate": "replyInlineMarkup",
15572 "params": [
15573 {
15574 "name": "rows",
15575 "type": "Vector<KeyboardButtonRow>"
15576 }
15577 ],
15578 "type": "ReplyMarkup"
15579 },
15580 {
15581 "id": "-1324486149",
15582 "predicate": "messages.botCallbackAnswer",
15583 "params": [
15584 {
15585 "name": "flags",
15586 "type": "#"
15587 },
15588 {
15589 "name": "alert",
15590 "type": "flags.1?true"
15591 },
15592 {
15593 "name": "has_url",
15594 "type": "flags.3?true"
15595 },
15596 {
15597 "name": "message",
15598 "type": "flags.0?string"
15599 },
15600 {
15601 "name": "url",
15602 "type": "flags.2?string"
15603 }
15604 ],
15605 "type": "messages.BotCallbackAnswer"
15606 },
15607 {
15608 "id": "-415938591",
15609 "predicate": "updateBotCallbackQuery",
15610 "params": [
15611 {
15612 "name": "flags",
15613 "type": "#"
15614 },
15615 {
15616 "name": "query_id",
15617 "type": "long"
15618 },
15619 {
15620 "name": "user_id",
15621 "type": "int"
15622 },
15623 {
15624 "name": "peer",
15625 "type": "Peer"
15626 },
15627 {
15628 "name": "msg_id",
15629 "type": "int"
15630 },
15631 {
15632 "name": "chat_instance",
15633 "type": "long"
15634 },
15635 {
15636 "name": "data",
15637 "type": "flags.0?bytes"
15638 },
15639 {
15640 "name": "game_short_name",
15641 "type": "flags.1?string"
15642 }
15643 ],
15644 "type": "Update"
15645 },
15646 {
15647 "id": "649453030",
15648 "predicate": "messages.messageEditData",
15649 "params": [
15650 {
15651 "name": "flags",
15652 "type": "#"
15653 },
15654 {
15655 "name": "caption",
15656 "type": "flags.0?true"
15657 }
15658 ],
15659 "type": "messages.MessageEditData"
15660 },
15661 {
15662 "id": "-469536605",
15663 "predicate": "updateEditMessage",
15664 "params": [
15665 {
15666 "name": "message",
15667 "type": "Message"
15668 },
15669 {
15670 "name": "pts",
15671 "type": "int"
15672 },
15673 {
15674 "name": "pts_count",
15675 "type": "int"
15676 }
15677 ],
15678 "type": "Update"
15679 },
15680 {
15681 "id": "-190472735",
15682 "predicate": "inputBotInlineMessageMediaGeo",
15683 "params": [
15684 {
15685 "name": "flags",
15686 "type": "#"
15687 },
15688 {
15689 "name": "geo_point",
15690 "type": "InputGeoPoint"
15691 },
15692 {
15693 "name": "reply_markup",
15694 "type": "flags.2?ReplyMarkup"
15695 }
15696 ],
15697 "type": "InputBotInlineMessage"
15698 },
15699 {
15700 "id": "-1431327288",
15701 "predicate": "inputBotInlineMessageMediaVenue",
15702 "params": [
15703 {
15704 "name": "flags",
15705 "type": "#"
15706 },
15707 {
15708 "name": "geo_point",
15709 "type": "InputGeoPoint"
15710 },
15711 {
15712 "name": "title",
15713 "type": "string"
15714 },
15715 {
15716 "name": "address",
15717 "type": "string"
15718 },
15719 {
15720 "name": "provider",
15721 "type": "string"
15722 },
15723 {
15724 "name": "venue_id",
15725 "type": "string"
15726 },
15727 {
15728 "name": "reply_markup",
15729 "type": "flags.2?ReplyMarkup"
15730 }
15731 ],
15732 "type": "InputBotInlineMessage"
15733 },
15734 {
15735 "id": "766443943",
15736 "predicate": "inputBotInlineMessageMediaContact",
15737 "params": [
15738 {
15739 "name": "flags",
15740 "type": "#"
15741 },
15742 {
15743 "name": "phone_number",
15744 "type": "string"
15745 },
15746 {
15747 "name": "first_name",
15748 "type": "string"
15749 },
15750 {
15751 "name": "last_name",
15752 "type": "string"
15753 },
15754 {
15755 "name": "reply_markup",
15756 "type": "flags.2?ReplyMarkup"
15757 }
15758 ],
15759 "type": "InputBotInlineMessage"
15760 },
15761 {
15762 "id": "982505656",
15763 "predicate": "botInlineMessageMediaGeo",
15764 "params": [
15765 {
15766 "name": "flags",
15767 "type": "#"
15768 },
15769 {
15770 "name": "geo",
15771 "type": "GeoPoint"
15772 },
15773 {
15774 "name": "reply_markup",
15775 "type": "flags.2?ReplyMarkup"
15776 }
15777 ],
15778 "type": "BotInlineMessage"
15779 },
15780 {
15781 "id": "1130767150",
15782 "predicate": "botInlineMessageMediaVenue",
15783 "params": [
15784 {
15785 "name": "flags",
15786 "type": "#"
15787 },
15788 {
15789 "name": "geo",
15790 "type": "GeoPoint"
15791 },
15792 {
15793 "name": "title",
15794 "type": "string"
15795 },
15796 {
15797 "name": "address",
15798 "type": "string"
15799 },
15800 {
15801 "name": "provider",
15802 "type": "string"
15803 },
15804 {
15805 "name": "venue_id",
15806 "type": "string"
15807 },
15808 {
15809 "name": "reply_markup",
15810 "type": "flags.2?ReplyMarkup"
15811 }
15812 ],
15813 "type": "BotInlineMessage"
15814 },
15815 {
15816 "id": "904770772",
15817 "predicate": "botInlineMessageMediaContact",
15818 "params": [
15819 {
15820 "name": "flags",
15821 "type": "#"
15822 },
15823 {
15824 "name": "phone_number",
15825 "type": "string"
15826 },
15827 {
15828 "name": "first_name",
15829 "type": "string"
15830 },
15831 {
15832 "name": "last_name",
15833 "type": "string"
15834 },
15835 {
15836 "name": "reply_markup",
15837 "type": "flags.2?ReplyMarkup"
15838 }
15839 ],
15840 "type": "BotInlineMessage"
15841 },
15842 {
15843 "id": "-1462213465",
15844 "predicate": "inputBotInlineResultPhoto",
15845 "params": [
15846 {
15847 "name": "id",
15848 "type": "string"
15849 },
15850 {
15851 "name": "type",
15852 "type": "string"
15853 },
15854 {
15855 "name": "photo",
15856 "type": "InputPhoto"
15857 },
15858 {
15859 "name": "send_message",
15860 "type": "InputBotInlineMessage"
15861 }
15862 ],
15863 "type": "InputBotInlineResult"
15864 },
15865 {
15866 "id": "-459324",
15867 "predicate": "inputBotInlineResultDocument",
15868 "params": [
15869 {
15870 "name": "flags",
15871 "type": "#"
15872 },
15873 {
15874 "name": "id",
15875 "type": "string"
15876 },
15877 {
15878 "name": "type",
15879 "type": "string"
15880 },
15881 {
15882 "name": "title",
15883 "type": "flags.1?string"
15884 },
15885 {
15886 "name": "description",
15887 "type": "flags.2?string"
15888 },
15889 {
15890 "name": "document",
15891 "type": "InputDocument"
15892 },
15893 {
15894 "name": "send_message",
15895 "type": "InputBotInlineMessage"
15896 }
15897 ],
15898 "type": "InputBotInlineResult"
15899 },
15900 {
15901 "id": "400266251",
15902 "predicate": "botInlineMediaResult",
15903 "params": [
15904 {
15905 "name": "flags",
15906 "type": "#"
15907 },
15908 {
15909 "name": "id",
15910 "type": "string"
15911 },
15912 {
15913 "name": "type",
15914 "type": "string"
15915 },
15916 {
15917 "name": "photo",
15918 "type": "flags.0?Photo"
15919 },
15920 {
15921 "name": "document",
15922 "type": "flags.1?Document"
15923 },
15924 {
15925 "name": "title",
15926 "type": "flags.2?string"
15927 },
15928 {
15929 "name": "description",
15930 "type": "flags.3?string"
15931 },
15932 {
15933 "name": "send_message",
15934 "type": "BotInlineMessage"
15935 }
15936 ],
15937 "type": "BotInlineResult"
15938 },
15939 {
15940 "id": "-1995686519",
15941 "predicate": "inputBotInlineMessageID",
15942 "params": [
15943 {
15944 "name": "dc_id",
15945 "type": "int"
15946 },
15947 {
15948 "name": "id",
15949 "type": "long"
15950 },
15951 {
15952 "name": "access_hash",
15953 "type": "long"
15954 }
15955 ],
15956 "type": "InputBotInlineMessageID"
15957 },
15958 {
15959 "id": "-103646630",
15960 "predicate": "updateInlineBotCallbackQuery",
15961 "params": [
15962 {
15963 "name": "flags",
15964 "type": "#"
15965 },
15966 {
15967 "name": "query_id",
15968 "type": "long"
15969 },
15970 {
15971 "name": "user_id",
15972 "type": "int"
15973 },
15974 {
15975 "name": "msg_id",
15976 "type": "InputBotInlineMessageID"
15977 },
15978 {
15979 "name": "chat_instance",
15980 "type": "long"
15981 },
15982 {
15983 "name": "data",
15984 "type": "flags.0?bytes"
15985 },
15986 {
15987 "name": "game_short_name",
15988 "type": "flags.1?string"
15989 }
15990 ],
15991 "type": "Update"
15992 },
15993 {
15994 "id": "1008755359",
15995 "predicate": "inlineBotSwitchPM",
15996 "params": [
15997 {
15998 "name": "text",
15999 "type": "string"
16000 },
16001 {
16002 "name": "start_param",
16003 "type": "string"
16004 }
16005 ],
16006 "type": "InlineBotSwitchPM"
16007 },
16008 {
16009 "id": "863093588",
16010 "predicate": "messages.peerDialogs",
16011 "params": [
16012 {
16013 "name": "dialogs",
16014 "type": "Vector<Dialog>"
16015 },
16016 {
16017 "name": "messages",
16018 "type": "Vector<Message>"
16019 },
16020 {
16021 "name": "chats",
16022 "type": "Vector<Chat>"
16023 },
16024 {
16025 "name": "users",
16026 "type": "Vector<User>"
16027 },
16028 {
16029 "name": "state",
16030 "type": "updates.State"
16031 }
16032 ],
16033 "type": "messages.PeerDialogs"
16034 },
16035 {
16036 "id": "-305282981",
16037 "predicate": "topPeer",
16038 "params": [
16039 {
16040 "name": "peer",
16041 "type": "Peer"
16042 },
16043 {
16044 "name": "rating",
16045 "type": "double"
16046 }
16047 ],
16048 "type": "TopPeer"
16049 },
16050 {
16051 "id": "-1419371685",
16052 "predicate": "topPeerCategoryBotsPM",
16053 "params": [],
16054 "type": "TopPeerCategory"
16055 },
16056 {
16057 "id": "344356834",
16058 "predicate": "topPeerCategoryBotsInline",
16059 "params": [],
16060 "type": "TopPeerCategory"
16061 },
16062 {
16063 "id": "104314861",
16064 "predicate": "topPeerCategoryCorrespondents",
16065 "params": [],
16066 "type": "TopPeerCategory"
16067 },
16068 {
16069 "id": "-1122524854",
16070 "predicate": "topPeerCategoryGroups",
16071 "params": [],
16072 "type": "TopPeerCategory"
16073 },
16074 {
16075 "id": "371037736",
16076 "predicate": "topPeerCategoryChannels",
16077 "params": [],
16078 "type": "TopPeerCategory"
16079 },
16080 {
16081 "id": "-75283823",
16082 "predicate": "topPeerCategoryPeers",
16083 "params": [
16084 {
16085 "name": "category",
16086 "type": "TopPeerCategory"
16087 },
16088 {
16089 "name": "count",
16090 "type": "int"
16091 },
16092 {
16093 "name": "peers",
16094 "type": "Vector<TopPeer>"
16095 }
16096 ],
16097 "type": "TopPeerCategoryPeers"
16098 },
16099 {
16100 "id": "-567906571",
16101 "predicate": "contacts.topPeersNotModified",
16102 "params": [],
16103 "type": "contacts.TopPeers"
16104 },
16105 {
16106 "id": "1891070632",
16107 "predicate": "contacts.topPeers",
16108 "params": [
16109 {
16110 "name": "categories",
16111 "type": "Vector<TopPeerCategoryPeers>"
16112 },
16113 {
16114 "name": "chats",
16115 "type": "Vector<Chat>"
16116 },
16117 {
16118 "name": "users",
16119 "type": "Vector<User>"
16120 }
16121 ],
16122 "type": "contacts.TopPeers"
16123 },
16124 {
16125 "id": "892193368",
16126 "predicate": "messageEntityMentionName",
16127 "params": [
16128 {
16129 "name": "offset",
16130 "type": "int"
16131 },
16132 {
16133 "name": "length",
16134 "type": "int"
16135 },
16136 {
16137 "name": "user_id",
16138 "type": "int"
16139 }
16140 ],
16141 "type": "MessageEntity"
16142 },
16143 {
16144 "id": "546203849",
16145 "predicate": "inputMessageEntityMentionName",
16146 "params": [
16147 {
16148 "name": "offset",
16149 "type": "int"
16150 },
16151 {
16152 "name": "length",
16153 "type": "int"
16154 },
16155 {
16156 "name": "user_id",
16157 "type": "InputUser"
16158 }
16159 ],
16160 "type": "MessageEntity"
16161 },
16162 {
16163 "id": "975236280",
16164 "predicate": "inputMessagesFilterChatPhotos",
16165 "params": [],
16166 "type": "MessagesFilter"
16167 },
16168 {
16169 "id": "634833351",
16170 "predicate": "updateReadChannelOutbox",
16171 "params": [
16172 {
16173 "name": "channel_id",
16174 "type": "int"
16175 },
16176 {
16177 "name": "max_id",
16178 "type": "int"
16179 }
16180 ],
16181 "type": "Update"
16182 },
16183 {
16184 "id": "-299124375",
16185 "predicate": "updateDraftMessage",
16186 "params": [
16187 {
16188 "name": "peer",
16189 "type": "Peer"
16190 },
16191 {
16192 "name": "draft",
16193 "type": "DraftMessage"
16194 }
16195 ],
16196 "type": "Update"
16197 },
16198 {
16199 "id": "-1169445179",
16200 "predicate": "draftMessageEmpty",
16201 "params": [],
16202 "type": "DraftMessage"
16203 },
16204 {
16205 "id": "-40996577",
16206 "predicate": "draftMessage",
16207 "params": [
16208 {
16209 "name": "flags",
16210 "type": "#"
16211 },
16212 {
16213 "name": "no_webpage",
16214 "type": "flags.1?true"
16215 },
16216 {
16217 "name": "reply_to_msg_id",
16218 "type": "flags.0?int"
16219 },
16220 {
16221 "name": "message",
16222 "type": "string"
16223 },
16224 {
16225 "name": "entities",
16226 "type": "flags.3?Vector<MessageEntity>"
16227 },
16228 {
16229 "name": "date",
16230 "type": "int"
16231 }
16232 ],
16233 "type": "DraftMessage"
16234 },
16235 {
16236 "id": "-1615153660",
16237 "predicate": "messageActionHistoryClear",
16238 "params": [],
16239 "type": "MessageAction"
16240 },
16241 {
16242 "id": "82699215",
16243 "predicate": "messages.featuredStickersNotModified",
16244 "params": [],
16245 "type": "messages.FeaturedStickers"
16246 },
16247 {
16248 "id": "-123893531",
16249 "predicate": "messages.featuredStickers",
16250 "params": [
16251 {
16252 "name": "hash",
16253 "type": "int"
16254 },
16255 {
16256 "name": "sets",
16257 "type": "Vector<StickerSetCovered>"
16258 },
16259 {
16260 "name": "unread",
16261 "type": "Vector<long>"
16262 }
16263 ],
16264 "type": "messages.FeaturedStickers"
16265 },
16266 {
16267 "id": "1461528386",
16268 "predicate": "updateReadFeaturedStickers",
16269 "params": [],
16270 "type": "Update"
16271 },
16272 {
16273 "id": "186120336",
16274 "predicate": "messages.recentStickersNotModified",
16275 "params": [],
16276 "type": "messages.RecentStickers"
16277 },
16278 {
16279 "id": "1558317424",
16280 "predicate": "messages.recentStickers",
16281 "params": [
16282 {
16283 "name": "hash",
16284 "type": "int"
16285 },
16286 {
16287 "name": "stickers",
16288 "type": "Vector<Document>"
16289 }
16290 ],
16291 "type": "messages.RecentStickers"
16292 },
16293 {
16294 "id": "-1706939360",
16295 "predicate": "updateRecentStickers",
16296 "params": [],
16297 "type": "Update"
16298 },
16299 {
16300 "id": "1338747336",
16301 "predicate": "messages.archivedStickers",
16302 "params": [
16303 {
16304 "name": "count",
16305 "type": "int"
16306 },
16307 {
16308 "name": "sets",
16309 "type": "Vector<StickerSetCovered>"
16310 }
16311 ],
16312 "type": "messages.ArchivedStickers"
16313 },
16314 {
16315 "id": "946083368",
16316 "predicate": "messages.stickerSetInstallResultSuccess",
16317 "params": [],
16318 "type": "messages.StickerSetInstallResult"
16319 },
16320 {
16321 "id": "904138920",
16322 "predicate": "messages.stickerSetInstallResultArchive",
16323 "params": [
16324 {
16325 "name": "sets",
16326 "type": "Vector<StickerSetCovered>"
16327 }
16328 ],
16329 "type": "messages.StickerSetInstallResult"
16330 },
16331 {
16332 "id": "1678812626",
16333 "predicate": "stickerSetCovered",
16334 "params": [
16335 {
16336 "name": "set",
16337 "type": "StickerSet"
16338 },
16339 {
16340 "name": "cover",
16341 "type": "Document"
16342 }
16343 ],
16344 "type": "StickerSetCovered"
16345 },
16346 {
16347 "id": "-1574314746",
16348 "predicate": "updateConfig",
16349 "params": [],
16350 "type": "Update"
16351 },
16352 {
16353 "id": "861169551",
16354 "predicate": "updatePtsChanged",
16355 "params": [],
16356 "type": "Update"
16357 },
16358 {
16359 "id": "-1252045032",
16360 "predicate": "inputMediaPhotoExternal",
16361 "params": [
16362 {
16363 "name": "url",
16364 "type": "string"
16365 },
16366 {
16367 "name": "caption",
16368 "type": "string"
16369 }
16370 ],
16371 "type": "InputMedia"
16372 },
16373 {
16374 "id": "-437690244",
16375 "predicate": "inputMediaDocumentExternal",
16376 "params": [
16377 {
16378 "name": "url",
16379 "type": "string"
16380 },
16381 {
16382 "name": "caption",
16383 "type": "string"
16384 }
16385 ],
16386 "type": "InputMedia"
16387 },
16388 {
16389 "id": "872932635",
16390 "predicate": "stickerSetMultiCovered",
16391 "params": [
16392 {
16393 "name": "set",
16394 "type": "StickerSet"
16395 },
16396 {
16397 "name": "covers",
16398 "type": "Vector<Document>"
16399 }
16400 ],
16401 "type": "StickerSetCovered"
16402 },
16403 {
16404 "id": "-1361650766",
16405 "predicate": "maskCoords",
16406 "params": [
16407 {
16408 "name": "n",
16409 "type": "int"
16410 },
16411 {
16412 "name": "x",
16413 "type": "double"
16414 },
16415 {
16416 "name": "y",
16417 "type": "double"
16418 },
16419 {
16420 "name": "zoom",
16421 "type": "double"
16422 }
16423 ],
16424 "type": "MaskCoords"
16425 },
16426 {
16427 "id": "-1744710921",
16428 "predicate": "documentAttributeHasStickers",
16429 "params": [],
16430 "type": "DocumentAttribute"
16431 },
16432 {
16433 "id": "1251549527",
16434 "predicate": "inputStickeredMediaPhoto",
16435 "params": [
16436 {
16437 "name": "id",
16438 "type": "InputPhoto"
16439 }
16440 ],
16441 "type": "InputStickeredMedia"
16442 },
16443 {
16444 "id": "70813275",
16445 "predicate": "inputStickeredMediaDocument",
16446 "params": [
16447 {
16448 "name": "id",
16449 "type": "InputDocument"
16450 }
16451 ],
16452 "type": "InputStickeredMedia"
16453 },
16454 {
16455 "id": "-1107729093",
16456 "predicate": "game",
16457 "params": [
16458 {
16459 "name": "flags",
16460 "type": "#"
16461 },
16462 {
16463 "name": "id",
16464 "type": "long"
16465 },
16466 {
16467 "name": "access_hash",
16468 "type": "long"
16469 },
16470 {
16471 "name": "short_name",
16472 "type": "string"
16473 },
16474 {
16475 "name": "title",
16476 "type": "string"
16477 },
16478 {
16479 "name": "description",
16480 "type": "string"
16481 },
16482 {
16483 "name": "photo",
16484 "type": "Photo"
16485 },
16486 {
16487 "name": "document",
16488 "type": "flags.0?Document"
16489 }
16490 ],
16491 "type": "Game"
16492 },
16493 {
16494 "id": "1336154098",
16495 "predicate": "inputBotInlineResultGame",
16496 "params": [
16497 {
16498 "name": "id",
16499 "type": "string"
16500 },
16501 {
16502 "name": "short_name",
16503 "type": "string"
16504 },
16505 {
16506 "name": "send_message",
16507 "type": "InputBotInlineMessage"
16508 }
16509 ],
16510 "type": "InputBotInlineResult"
16511 },
16512 {
16513 "id": "1262639204",
16514 "predicate": "inputBotInlineMessageGame",
16515 "params": [
16516 {
16517 "name": "flags",
16518 "type": "#"
16519 },
16520 {
16521 "name": "reply_markup",
16522 "type": "flags.2?ReplyMarkup"
16523 }
16524 ],
16525 "type": "InputBotInlineMessage"
16526 },
16527 {
16528 "id": "-580219064",
16529 "predicate": "sendMessageGamePlayAction",
16530 "params": [],
16531 "type": "SendMessageAction"
16532 },
16533 {
16534 "id": "-38694904",
16535 "predicate": "messageMediaGame",
16536 "params": [
16537 {
16538 "name": "game",
16539 "type": "Game"
16540 }
16541 ],
16542 "type": "MessageMedia"
16543 },
16544 {
16545 "id": "-750828557",
16546 "predicate": "inputMediaGame",
16547 "params": [
16548 {
16549 "name": "id",
16550 "type": "InputGame"
16551 }
16552 ],
16553 "type": "InputMedia"
16554 },
16555 {
16556 "id": "53231223",
16557 "predicate": "inputGameID",
16558 "params": [
16559 {
16560 "name": "id",
16561 "type": "long"
16562 },
16563 {
16564 "name": "access_hash",
16565 "type": "long"
16566 }
16567 ],
16568 "type": "InputGame"
16569 },
16570 {
16571 "id": "-1020139510",
16572 "predicate": "inputGameShortName",
16573 "params": [
16574 {
16575 "name": "bot_id",
16576 "type": "InputUser"
16577 },
16578 {
16579 "name": "short_name",
16580 "type": "string"
16581 }
16582 ],
16583 "type": "InputGame"
16584 },
16585 {
16586 "id": "1358175439",
16587 "predicate": "keyboardButtonGame",
16588 "params": [
16589 {
16590 "name": "text",
16591 "type": "string"
16592 }
16593 ],
16594 "type": "KeyboardButton"
16595 },
16596 {
16597 "id": "-1834538890",
16598 "predicate": "messageActionGameScore",
16599 "params": [
16600 {
16601 "name": "game_id",
16602 "type": "long"
16603 },
16604 {
16605 "name": "score",
16606 "type": "int"
16607 }
16608 ],
16609 "type": "MessageAction"
16610 },
16611 {
16612 "id": "1493171408",
16613 "predicate": "highScore",
16614 "params": [
16615 {
16616 "name": "pos",
16617 "type": "int"
16618 },
16619 {
16620 "name": "user_id",
16621 "type": "int"
16622 },
16623 {
16624 "name": "score",
16625 "type": "int"
16626 }
16627 ],
16628 "type": "HighScore"
16629 },
16630 {
16631 "id": "-1707344487",
16632 "predicate": "messages.highScores",
16633 "params": [
16634 {
16635 "name": "scores",
16636 "type": "Vector<HighScore>"
16637 },
16638 {
16639 "name": "users",
16640 "type": "Vector<User>"
16641 }
16642 ],
16643 "type": "messages.HighScores"
16644 }
16645 ],
16646 "methods": [
16647 {
16648 "id": "-878758099",
16649 "method": "invokeAfterMsg",
16650 "params": [
16651 {
16652 "name": "msg_id",
16653 "type": "long"
16654 },
16655 {
16656 "name": "query",
16657 "type": "!X"
16658 }
16659 ],
16660 "type": "X"
16661 },
16662 {
16663 "id": "1036301552",
16664 "method": "invokeAfterMsgs",
16665 "params": [
16666 {
16667 "name": "msg_ids",
16668 "type": "Vector<long>"
16669 },
16670 {
16671 "name": "query",
16672 "type": "!X"
16673 }
16674 ],
16675 "type": "X"
16676 },
16677 {
16678 "id": "1877286395",
16679 "method": "auth.checkPhone",
16680 "params": [
16681 {
16682 "name": "phone_number",
16683 "type": "string"
16684 }
16685 ],
16686 "type": "auth.CheckedPhone"
16687 },
16688 {
16689 "id": "-2035355412",
16690 "method": "auth.sendCode",
16691 "params": [
16692 {
16693 "name": "flags",
16694 "type": "#"
16695 },
16696 {
16697 "name": "allow_flashcall",
16698 "type": "flags.0?true"
16699 },
16700 {
16701 "name": "phone_number",
16702 "type": "string"
16703 },
16704 {
16705 "name": "current_number",
16706 "type": "flags.0?Bool"
16707 },
16708 {
16709 "name": "api_id",
16710 "type": "int"
16711 },
16712 {
16713 "name": "api_hash",
16714 "type": "string"
16715 }
16716 ],
16717 "type": "auth.SentCode"
16718 },
16719 {
16720 "id": "453408308",
16721 "method": "auth.signUp",
16722 "params": [
16723 {
16724 "name": "phone_number",
16725 "type": "string"
16726 },
16727 {
16728 "name": "phone_code_hash",
16729 "type": "string"
16730 },
16731 {
16732 "name": "phone_code",
16733 "type": "string"
16734 },
16735 {
16736 "name": "first_name",
16737 "type": "string"
16738 },
16739 {
16740 "name": "last_name",
16741 "type": "string"
16742 }
16743 ],
16744 "type": "auth.Authorization"
16745 },
16746 {
16747 "id": "-1126886015",
16748 "method": "auth.signIn",
16749 "params": [
16750 {
16751 "name": "phone_number",
16752 "type": "string"
16753 },
16754 {
16755 "name": "phone_code_hash",
16756 "type": "string"
16757 },
16758 {
16759 "name": "phone_code",
16760 "type": "string"
16761 }
16762 ],
16763 "type": "auth.Authorization"
16764 },
16765 {
16766 "id": "1461180992",
16767 "method": "auth.logOut",
16768 "params": [],
16769 "type": "Bool"
16770 },
16771 {
16772 "id": "-1616179942",
16773 "method": "auth.resetAuthorizations",
16774 "params": [],
16775 "type": "Bool"
16776 },
16777 {
16778 "id": "1998331287",
16779 "method": "auth.sendInvites",
16780 "params": [
16781 {
16782 "name": "phone_numbers",
16783 "type": "Vector<string>"
16784 },
16785 {
16786 "name": "message",
16787 "type": "string"
16788 }
16789 ],
16790 "type": "Bool"
16791 },
16792 {
16793 "id": "-440401971",
16794 "method": "auth.exportAuthorization",
16795 "params": [
16796 {
16797 "name": "dc_id",
16798 "type": "int"
16799 }
16800 ],
16801 "type": "auth.ExportedAuthorization"
16802 },
16803 {
16804 "id": "-470837741",
16805 "method": "auth.importAuthorization",
16806 "params": [
16807 {
16808 "name": "id",
16809 "type": "int"
16810 },
16811 {
16812 "name": "bytes",
16813 "type": "bytes"
16814 }
16815 ],
16816 "type": "auth.Authorization"
16817 },
16818 {
16819 "id": "-841733627",
16820 "method": "auth.bindTempAuthKey",
16821 "params": [
16822 {
16823 "name": "perm_auth_key_id",
16824 "type": "long"
16825 },
16826 {
16827 "name": "nonce",
16828 "type": "long"
16829 },
16830 {
16831 "name": "expires_at",
16832 "type": "int"
16833 },
16834 {
16835 "name": "encrypted_message",
16836 "type": "bytes"
16837 }
16838 ],
16839 "type": "Bool"
16840 },
16841 {
16842 "id": "1669245048",
16843 "method": "account.registerDevice",
16844 "params": [
16845 {
16846 "name": "token_type",
16847 "type": "int"
16848 },
16849 {
16850 "name": "token",
16851 "type": "string"
16852 }
16853 ],
16854 "type": "Bool"
16855 },
16856 {
16857 "id": "1707432768",
16858 "method": "account.unregisterDevice",
16859 "params": [
16860 {
16861 "name": "token_type",
16862 "type": "int"
16863 },
16864 {
16865 "name": "token",
16866 "type": "string"
16867 }
16868 ],
16869 "type": "Bool"
16870 },
16871 {
16872 "id": "-2067899501",
16873 "method": "account.updateNotifySettings",
16874 "params": [
16875 {
16876 "name": "peer",
16877 "type": "InputNotifyPeer"
16878 },
16879 {
16880 "name": "settings",
16881 "type": "InputPeerNotifySettings"
16882 }
16883 ],
16884 "type": "Bool"
16885 },
16886 {
16887 "id": "313765169",
16888 "method": "account.getNotifySettings",
16889 "params": [
16890 {
16891 "name": "peer",
16892 "type": "InputNotifyPeer"
16893 }
16894 ],
16895 "type": "PeerNotifySettings"
16896 },
16897 {
16898 "id": "-612493497",
16899 "method": "account.resetNotifySettings",
16900 "params": [],
16901 "type": "Bool"
16902 },
16903 {
16904 "id": "2018596725",
16905 "method": "account.updateProfile",
16906 "params": [
16907 {
16908 "name": "flags",
16909 "type": "#"
16910 },
16911 {
16912 "name": "first_name",
16913 "type": "flags.0?string"
16914 },
16915 {
16916 "name": "last_name",
16917 "type": "flags.1?string"
16918 },
16919 {
16920 "name": "about",
16921 "type": "flags.2?string"
16922 }
16923 ],
16924 "type": "User"
16925 },
16926 {
16927 "id": "1713919532",
16928 "method": "account.updateStatus",
16929 "params": [
16930 {
16931 "name": "offline",
16932 "type": "Bool"
16933 }
16934 ],
16935 "type": "Bool"
16936 },
16937 {
16938 "id": "-1068696894",
16939 "method": "account.getWallPapers",
16940 "params": [],
16941 "type": "Vector<WallPaper>"
16942 },
16943 {
16944 "id": "-1374118561",
16945 "method": "account.reportPeer",
16946 "params": [
16947 {
16948 "name": "peer",
16949 "type": "InputPeer"
16950 },
16951 {
16952 "name": "reason",
16953 "type": "ReportReason"
16954 }
16955 ],
16956 "type": "Bool"
16957 },
16958 {
16959 "id": "227648840",
16960 "method": "users.getUsers",
16961 "params": [
16962 {
16963 "name": "id",
16964 "type": "Vector<InputUser>"
16965 }
16966 ],
16967 "type": "Vector<User>"
16968 },
16969 {
16970 "id": "-902781519",
16971 "method": "users.getFullUser",
16972 "params": [
16973 {
16974 "name": "id",
16975 "type": "InputUser"
16976 }
16977 ],
16978 "type": "UserFull"
16979 },
16980 {
16981 "id": "-995929106",
16982 "method": "contacts.getStatuses",
16983 "params": [],
16984 "type": "Vector<ContactStatus>"
16985 },
16986 {
16987 "id": "583445000",
16988 "method": "contacts.getContacts",
16989 "params": [
16990 {
16991 "name": "hash",
16992 "type": "string"
16993 }
16994 ],
16995 "type": "contacts.Contacts"
16996 },
16997 {
16998 "id": "-634342611",
16999 "method": "contacts.importContacts",
17000 "params": [
17001 {
17002 "name": "contacts",
17003 "type": "Vector<InputContact>"
17004 },
17005 {
17006 "name": "replace",
17007 "type": "Bool"
17008 }
17009 ],
17010 "type": "contacts.ImportedContacts"
17011 },
17012 {
17013 "id": "-1902823612",
17014 "method": "contacts.deleteContact",
17015 "params": [
17016 {
17017 "name": "id",
17018 "type": "InputUser"
17019 }
17020 ],
17021 "type": "contacts.Link"
17022 },
17023 {
17024 "id": "1504393374",
17025 "method": "contacts.deleteContacts",
17026 "params": [
17027 {
17028 "name": "id",
17029 "type": "Vector<InputUser>"
17030 }
17031 ],
17032 "type": "Bool"
17033 },
17034 {
17035 "id": "858475004",
17036 "method": "contacts.block",
17037 "params": [
17038 {
17039 "name": "id",
17040 "type": "InputUser"
17041 }
17042 ],
17043 "type": "Bool"
17044 },
17045 {
17046 "id": "-448724803",
17047 "method": "contacts.unblock",
17048 "params": [
17049 {
17050 "name": "id",
17051 "type": "InputUser"
17052 }
17053 ],
17054 "type": "Bool"
17055 },
17056 {
17057 "id": "-176409329",
17058 "method": "contacts.getBlocked",
17059 "params": [
17060 {
17061 "name": "offset",
17062 "type": "int"
17063 },
17064 {
17065 "name": "limit",
17066 "type": "int"
17067 }
17068 ],
17069 "type": "contacts.Blocked"
17070 },
17071 {
17072 "id": "-2065352905",
17073 "method": "contacts.exportCard",
17074 "params": [],
17075 "type": "Vector<int>"
17076 },
17077 {
17078 "id": "1340184318",
17079 "method": "contacts.importCard",
17080 "params": [
17081 {
17082 "name": "export_card",
17083 "type": "Vector<int>"
17084 }
17085 ],
17086 "type": "User"
17087 },
17088 {
17089 "id": "1109588596",
17090 "method": "messages.getMessages",
17091 "params": [
17092 {
17093 "name": "id",
17094 "type": "Vector<int>"
17095 }
17096 ],
17097 "type": "messages.Messages"
17098 },
17099 {
17100 "id": "1799878989",
17101 "method": "messages.getDialogs",
17102 "params": [
17103 {
17104 "name": "offset_date",
17105 "type": "int"
17106 },
17107 {
17108 "name": "offset_id",
17109 "type": "int"
17110 },
17111 {
17112 "name": "offset_peer",
17113 "type": "InputPeer"
17114 },
17115 {
17116 "name": "limit",
17117 "type": "int"
17118 }
17119 ],
17120 "type": "messages.Dialogs"
17121 },
17122 {
17123 "id": "-1347868602",
17124 "method": "messages.getHistory",
17125 "params": [
17126 {
17127 "name": "peer",
17128 "type": "InputPeer"
17129 },
17130 {
17131 "name": "offset_id",
17132 "type": "int"
17133 },
17134 {
17135 "name": "offset_date",
17136 "type": "int"
17137 },
17138 {
17139 "name": "add_offset",
17140 "type": "int"
17141 },
17142 {
17143 "name": "limit",
17144 "type": "int"
17145 },
17146 {
17147 "name": "max_id",
17148 "type": "int"
17149 },
17150 {
17151 "name": "min_id",
17152 "type": "int"
17153 }
17154 ],
17155 "type": "messages.Messages"
17156 },
17157 {
17158 "id": "-732523960",
17159 "method": "messages.search",
17160 "params": [
17161 {
17162 "name": "flags",
17163 "type": "#"
17164 },
17165 {
17166 "name": "peer",
17167 "type": "InputPeer"
17168 },
17169 {
17170 "name": "q",
17171 "type": "string"
17172 },
17173 {
17174 "name": "filter",
17175 "type": "MessagesFilter"
17176 },
17177 {
17178 "name": "min_date",
17179 "type": "int"
17180 },
17181 {
17182 "name": "max_date",
17183 "type": "int"
17184 },
17185 {
17186 "name": "offset",
17187 "type": "int"
17188 },
17189 {
17190 "name": "max_id",
17191 "type": "int"
17192 },
17193 {
17194 "name": "limit",
17195 "type": "int"
17196 }
17197 ],
17198 "type": "messages.Messages"
17199 },
17200 {
17201 "id": "238054714",
17202 "method": "messages.readHistory",
17203 "params": [
17204 {
17205 "name": "peer",
17206 "type": "InputPeer"
17207 },
17208 {
17209 "name": "max_id",
17210 "type": "int"
17211 }
17212 ],
17213 "type": "messages.AffectedMessages"
17214 },
17215 {
17216 "id": "469850889",
17217 "method": "messages.deleteHistory",
17218 "params": [
17219 {
17220 "name": "flags",
17221 "type": "#"
17222 },
17223 {
17224 "name": "just_clear",
17225 "type": "flags.0?true"
17226 },
17227 {
17228 "name": "peer",
17229 "type": "InputPeer"
17230 },
17231 {
17232 "name": "max_id",
17233 "type": "int"
17234 }
17235 ],
17236 "type": "messages.AffectedHistory"
17237 },
17238 {
17239 "id": "-1510897371",
17240 "method": "messages.deleteMessages",
17241 "params": [
17242 {
17243 "name": "id",
17244 "type": "Vector<int>"
17245 }
17246 ],
17247 "type": "messages.AffectedMessages"
17248 },
17249 {
17250 "id": "94983360",
17251 "method": "messages.receivedMessages",
17252 "params": [
17253 {
17254 "name": "max_id",
17255 "type": "int"
17256 }
17257 ],
17258 "type": "Vector<ReceivedNotifyMessage>"
17259 },
17260 {
17261 "id": "-1551737264",
17262 "method": "messages.setTyping",
17263 "params": [
17264 {
17265 "name": "peer",
17266 "type": "InputPeer"
17267 },
17268 {
17269 "name": "action",
17270 "type": "SendMessageAction"
17271 }
17272 ],
17273 "type": "Bool"
17274 },
17275 {
17276 "id": "-91733382",
17277 "method": "messages.sendMessage",
17278 "params": [
17279 {
17280 "name": "flags",
17281 "type": "#"
17282 },
17283 {
17284 "name": "no_webpage",
17285 "type": "flags.1?true"
17286 },
17287 {
17288 "name": "silent",
17289 "type": "flags.5?true"
17290 },
17291 {
17292 "name": "background",
17293 "type": "flags.6?true"
17294 },
17295 {
17296 "name": "clear_draft",
17297 "type": "flags.7?true"
17298 },
17299 {
17300 "name": "peer",
17301 "type": "InputPeer"
17302 },
17303 {
17304 "name": "reply_to_msg_id",
17305 "type": "flags.0?int"
17306 },
17307 {
17308 "name": "message",
17309 "type": "string"
17310 },
17311 {
17312 "name": "random_id",
17313 "type": "long"
17314 },
17315 {
17316 "name": "reply_markup",
17317 "type": "flags.2?ReplyMarkup"
17318 },
17319 {
17320 "name": "entities",
17321 "type": "flags.3?Vector<MessageEntity>"
17322 }
17323 ],
17324 "type": "Updates"
17325 },
17326 {
17327 "id": "-923703407",
17328 "method": "messages.sendMedia",
17329 "params": [
17330 {
17331 "name": "flags",
17332 "type": "#"
17333 },
17334 {
17335 "name": "silent",
17336 "type": "flags.5?true"
17337 },
17338 {
17339 "name": "background",
17340 "type": "flags.6?true"
17341 },
17342 {
17343 "name": "clear_draft",
17344 "type": "flags.7?true"
17345 },
17346 {
17347 "name": "peer",
17348 "type": "InputPeer"
17349 },
17350 {
17351 "name": "reply_to_msg_id",
17352 "type": "flags.0?int"
17353 },
17354 {
17355 "name": "media",
17356 "type": "InputMedia"
17357 },
17358 {
17359 "name": "random_id",
17360 "type": "long"
17361 },
17362 {
17363 "name": "reply_markup",
17364 "type": "flags.2?ReplyMarkup"
17365 }
17366 ],
17367 "type": "Updates"
17368 },
17369 {
17370 "id": "1888354709",
17371 "method": "messages.forwardMessages",
17372 "params": [
17373 {
17374 "name": "flags",
17375 "type": "#"
17376 },
17377 {
17378 "name": "silent",
17379 "type": "flags.5?true"
17380 },
17381 {
17382 "name": "background",
17383 "type": "flags.6?true"
17384 },
17385 {
17386 "name": "with_my_score",
17387 "type": "flags.8?true"
17388 },
17389 {
17390 "name": "from_peer",
17391 "type": "InputPeer"
17392 },
17393 {
17394 "name": "id",
17395 "type": "Vector<int>"
17396 },
17397 {
17398 "name": "random_id",
17399 "type": "Vector<long>"
17400 },
17401 {
17402 "name": "to_peer",
17403 "type": "InputPeer"
17404 }
17405 ],
17406 "type": "Updates"
17407 },
17408 {
17409 "id": "-820669733",
17410 "method": "messages.reportSpam",
17411 "params": [
17412 {
17413 "name": "peer",
17414 "type": "InputPeer"
17415 }
17416 ],
17417 "type": "Bool"
17418 },
17419 {
17420 "id": "-1460572005",
17421 "method": "messages.hideReportSpam",
17422 "params": [
17423 {
17424 "name": "peer",
17425 "type": "InputPeer"
17426 }
17427 ],
17428 "type": "Bool"
17429 },
17430 {
17431 "id": "913498268",
17432 "method": "messages.getPeerSettings",
17433 "params": [
17434 {
17435 "name": "peer",
17436 "type": "InputPeer"
17437 }
17438 ],
17439 "type": "PeerSettings"
17440 },
17441 {
17442 "id": "1013621127",
17443 "method": "messages.getChats",
17444 "params": [
17445 {
17446 "name": "id",
17447 "type": "Vector<int>"
17448 }
17449 ],
17450 "type": "messages.Chats"
17451 },
17452 {
17453 "id": "998448230",
17454 "method": "messages.getFullChat",
17455 "params": [
17456 {
17457 "name": "chat_id",
17458 "type": "int"
17459 }
17460 ],
17461 "type": "messages.ChatFull"
17462 },
17463 {
17464 "id": "-599447467",
17465 "method": "messages.editChatTitle",
17466 "params": [
17467 {
17468 "name": "chat_id",
17469 "type": "int"
17470 },
17471 {
17472 "name": "title",
17473 "type": "string"
17474 }
17475 ],
17476 "type": "Updates"
17477 },
17478 {
17479 "id": "-900957736",
17480 "method": "messages.editChatPhoto",
17481 "params": [
17482 {
17483 "name": "chat_id",
17484 "type": "int"
17485 },
17486 {
17487 "name": "photo",
17488 "type": "InputChatPhoto"
17489 }
17490 ],
17491 "type": "Updates"
17492 },
17493 {
17494 "id": "-106911223",
17495 "method": "messages.addChatUser",
17496 "params": [
17497 {
17498 "name": "chat_id",
17499 "type": "int"
17500 },
17501 {
17502 "name": "user_id",
17503 "type": "InputUser"
17504 },
17505 {
17506 "name": "fwd_limit",
17507 "type": "int"
17508 }
17509 ],
17510 "type": "Updates"
17511 },
17512 {
17513 "id": "-530505962",
17514 "method": "messages.deleteChatUser",
17515 "params": [
17516 {
17517 "name": "chat_id",
17518 "type": "int"
17519 },
17520 {
17521 "name": "user_id",
17522 "type": "InputUser"
17523 }
17524 ],
17525 "type": "Updates"
17526 },
17527 {
17528 "id": "164303470",
17529 "method": "messages.createChat",
17530 "params": [
17531 {
17532 "name": "users",
17533 "type": "Vector<InputUser>"
17534 },
17535 {
17536 "name": "title",
17537 "type": "string"
17538 }
17539 ],
17540 "type": "Updates"
17541 },
17542 {
17543 "id": "-304838614",
17544 "method": "updates.getState",
17545 "params": [],
17546 "type": "updates.State"
17547 },
17548 {
17549 "id": "168039573",
17550 "method": "updates.getDifference",
17551 "params": [
17552 {
17553 "name": "pts",
17554 "type": "int"
17555 },
17556 {
17557 "name": "date",
17558 "type": "int"
17559 },
17560 {
17561 "name": "qts",
17562 "type": "int"
17563 }
17564 ],
17565 "type": "updates.Difference"
17566 },
17567 {
17568 "id": "-256159406",
17569 "method": "photos.updateProfilePhoto",
17570 "params": [
17571 {
17572 "name": "id",
17573 "type": "InputPhoto"
17574 }
17575 ],
17576 "type": "UserProfilePhoto"
17577 },
17578 {
17579 "id": "1328726168",
17580 "method": "photos.uploadProfilePhoto",
17581 "params": [
17582 {
17583 "name": "file",
17584 "type": "InputFile"
17585 }
17586 ],
17587 "type": "photos.Photo"
17588 },
17589 {
17590 "id": "-2016444625",
17591 "method": "photos.deletePhotos",
17592 "params": [
17593 {
17594 "name": "id",
17595 "type": "Vector<InputPhoto>"
17596 }
17597 ],
17598 "type": "Vector<long>"
17599 },
17600 {
17601 "id": "-1291540959",
17602 "method": "upload.saveFilePart",
17603 "params": [
17604 {
17605 "name": "file_id",
17606 "type": "long"
17607 },
17608 {
17609 "name": "file_part",
17610 "type": "int"
17611 },
17612 {
17613 "name": "bytes",
17614 "type": "bytes"
17615 }
17616 ],
17617 "type": "Bool"
17618 },
17619 {
17620 "id": "-475607115",
17621 "method": "upload.getFile",
17622 "params": [
17623 {
17624 "name": "location",
17625 "type": "InputFileLocation"
17626 },
17627 {
17628 "name": "offset",
17629 "type": "int"
17630 },
17631 {
17632 "name": "limit",
17633 "type": "int"
17634 }
17635 ],
17636 "type": "upload.File"
17637 },
17638 {
17639 "id": "-990308245",
17640 "method": "help.getConfig",
17641 "params": [],
17642 "type": "Config"
17643 },
17644 {
17645 "id": "531836966",
17646 "method": "help.getNearestDc",
17647 "params": [],
17648 "type": "NearestDc"
17649 },
17650 {
17651 "id": "-1372724842",
17652 "method": "help.getAppUpdate",
17653 "params": [],
17654 "type": "help.AppUpdate"
17655 },
17656 {
17657 "id": "1862465352",
17658 "method": "help.saveAppLog",
17659 "params": [
17660 {
17661 "name": "events",
17662 "type": "Vector<InputAppEvent>"
17663 }
17664 ],
17665 "type": "Bool"
17666 },
17667 {
17668 "id": "1295590211",
17669 "method": "help.getInviteText",
17670 "params": [],
17671 "type": "help.InviteText"
17672 },
17673 {
17674 "id": "-1848823128",
17675 "method": "photos.getUserPhotos",
17676 "params": [
17677 {
17678 "name": "user_id",
17679 "type": "InputUser"
17680 },
17681 {
17682 "name": "offset",
17683 "type": "int"
17684 },
17685 {
17686 "name": "max_id",
17687 "type": "long"
17688 },
17689 {
17690 "name": "limit",
17691 "type": "int"
17692 }
17693 ],
17694 "type": "photos.Photos"
17695 },
17696 {
17697 "id": "865483769",
17698 "method": "messages.forwardMessage",
17699 "params": [
17700 {
17701 "name": "peer",
17702 "type": "InputPeer"
17703 },
17704 {
17705 "name": "id",
17706 "type": "int"
17707 },
17708 {
17709 "name": "random_id",
17710 "type": "long"
17711 }
17712 ],
17713 "type": "Updates"
17714 },
17715 {
17716 "id": "651135312",
17717 "method": "messages.getDhConfig",
17718 "params": [
17719 {
17720 "name": "version",
17721 "type": "int"
17722 },
17723 {
17724 "name": "random_length",
17725 "type": "int"
17726 }
17727 ],
17728 "type": "messages.DhConfig"
17729 },
17730 {
17731 "id": "-162681021",
17732 "method": "messages.requestEncryption",
17733 "params": [
17734 {
17735 "name": "user_id",
17736 "type": "InputUser"
17737 },
17738 {
17739 "name": "random_id",
17740 "type": "int"
17741 },
17742 {
17743 "name": "g_a",
17744 "type": "bytes"
17745 }
17746 ],
17747 "type": "EncryptedChat"
17748 },
17749 {
17750 "id": "1035731989",
17751 "method": "messages.acceptEncryption",
17752 "params": [
17753 {
17754 "name": "peer",
17755 "type": "InputEncryptedChat"
17756 },
17757 {
17758 "name": "g_b",
17759 "type": "bytes"
17760 },
17761 {
17762 "name": "key_fingerprint",
17763 "type": "long"
17764 }
17765 ],
17766 "type": "EncryptedChat"
17767 },
17768 {
17769 "id": "-304536635",
17770 "method": "messages.discardEncryption",
17771 "params": [
17772 {
17773 "name": "chat_id",
17774 "type": "int"
17775 }
17776 ],
17777 "type": "Bool"
17778 },
17779 {
17780 "id": "2031374829",
17781 "method": "messages.setEncryptedTyping",
17782 "params": [
17783 {
17784 "name": "peer",
17785 "type": "InputEncryptedChat"
17786 },
17787 {
17788 "name": "typing",
17789 "type": "Bool"
17790 }
17791 ],
17792 "type": "Bool"
17793 },
17794 {
17795 "id": "2135648522",
17796 "method": "messages.readEncryptedHistory",
17797 "params": [
17798 {
17799 "name": "peer",
17800 "type": "InputEncryptedChat"
17801 },
17802 {
17803 "name": "max_date",
17804 "type": "int"
17805 }
17806 ],
17807 "type": "Bool"
17808 },
17809 {
17810 "id": "-1451792525",
17811 "method": "messages.sendEncrypted",
17812 "params": [
17813 {
17814 "name": "peer",
17815 "type": "InputEncryptedChat"
17816 },
17817 {
17818 "name": "random_id",
17819 "type": "long"
17820 },
17821 {
17822 "name": "data",
17823 "type": "bytes"
17824 }
17825 ],
17826 "type": "messages.SentEncryptedMessage"
17827 },
17828 {
17829 "id": "-1701831834",
17830 "method": "messages.sendEncryptedFile",
17831 "params": [
17832 {
17833 "name": "peer",
17834 "type": "InputEncryptedChat"
17835 },
17836 {
17837 "name": "random_id",
17838 "type": "long"
17839 },
17840 {
17841 "name": "data",
17842 "type": "bytes"
17843 },
17844 {
17845 "name": "file",
17846 "type": "InputEncryptedFile"
17847 }
17848 ],
17849 "type": "messages.SentEncryptedMessage"
17850 },
17851 {
17852 "id": "852769188",
17853 "method": "messages.sendEncryptedService",
17854 "params": [
17855 {
17856 "name": "peer",
17857 "type": "InputEncryptedChat"
17858 },
17859 {
17860 "name": "random_id",
17861 "type": "long"
17862 },
17863 {
17864 "name": "data",
17865 "type": "bytes"
17866 }
17867 ],
17868 "type": "messages.SentEncryptedMessage"
17869 },
17870 {
17871 "id": "1436924774",
17872 "method": "messages.receivedQueue",
17873 "params": [
17874 {
17875 "name": "max_qts",
17876 "type": "int"
17877 }
17878 ],
17879 "type": "Vector<long>"
17880 },
17881 {
17882 "id": "-562337987",
17883 "method": "upload.saveBigFilePart",
17884 "params": [
17885 {
17886 "name": "file_id",
17887 "type": "long"
17888 },
17889 {
17890 "name": "file_part",
17891 "type": "int"
17892 },
17893 {
17894 "name": "file_total_parts",
17895 "type": "int"
17896 },
17897 {
17898 "name": "bytes",
17899 "type": "bytes"
17900 }
17901 ],
17902 "type": "Bool"
17903 },
17904 {
17905 "id": "1769565673",
17906 "method": "initConnection",
17907 "params": [
17908 {
17909 "name": "api_id",
17910 "type": "int"
17911 },
17912 {
17913 "name": "device_model",
17914 "type": "string"
17915 },
17916 {
17917 "name": "system_version",
17918 "type": "string"
17919 },
17920 {
17921 "name": "app_version",
17922 "type": "string"
17923 },
17924 {
17925 "name": "lang_code",
17926 "type": "string"
17927 },
17928 {
17929 "name": "query",
17930 "type": "!X"
17931 }
17932 ],
17933 "type": "X"
17934 },
17935 {
17936 "id": "-1663104819",
17937 "method": "help.getSupport",
17938 "params": [],
17939 "type": "help.Support"
17940 },
17941 {
17942 "id": "916930423",
17943 "method": "messages.readMessageContents",
17944 "params": [
17945 {
17946 "name": "id",
17947 "type": "Vector<int>"
17948 }
17949 ],
17950 "type": "messages.AffectedMessages"
17951 },
17952 {
17953 "id": "655677548",
17954 "method": "account.checkUsername",
17955 "params": [
17956 {
17957 "name": "username",
17958 "type": "string"
17959 }
17960 ],
17961 "type": "Bool"
17962 },
17963 {
17964 "id": "1040964988",
17965 "method": "account.updateUsername",
17966 "params": [
17967 {
17968 "name": "username",
17969 "type": "string"
17970 }
17971 ],
17972 "type": "User"
17973 },
17974 {
17975 "id": "301470424",
17976 "method": "contacts.search",
17977 "params": [
17978 {
17979 "name": "q",
17980 "type": "string"
17981 },
17982 {
17983 "name": "limit",
17984 "type": "int"
17985 }
17986 ],
17987 "type": "contacts.Found"
17988 },
17989 {
17990 "id": "-623130288",
17991 "method": "account.getPrivacy",
17992 "params": [
17993 {
17994 "name": "key",
17995 "type": "InputPrivacyKey"
17996 }
17997 ],
17998 "type": "account.PrivacyRules"
17999 },
18000 {
18001 "id": "-906486552",
18002 "method": "account.setPrivacy",
18003 "params": [
18004 {
18005 "name": "key",
18006 "type": "InputPrivacyKey"
18007 },
18008 {
18009 "name": "rules",
18010 "type": "Vector<InputPrivacyRule>"
18011 }
18012 ],
18013 "type": "account.PrivacyRules"
18014 },
18015 {
18016 "id": "1099779595",
18017 "method": "account.deleteAccount",
18018 "params": [
18019 {
18020 "name": "reason",
18021 "type": "string"
18022 }
18023 ],
18024 "type": "Bool"
18025 },
18026 {
18027 "id": "150761757",
18028 "method": "account.getAccountTTL",
18029 "params": [],
18030 "type": "AccountDaysTTL"
18031 },
18032 {
18033 "id": "608323678",
18034 "method": "account.setAccountTTL",
18035 "params": [
18036 {
18037 "name": "ttl",
18038 "type": "AccountDaysTTL"
18039 }
18040 ],
18041 "type": "Bool"
18042 },
18043 {
18044 "id": "-627372787",
18045 "method": "invokeWithLayer",
18046 "params": [
18047 {
18048 "name": "layer",
18049 "type": "int"
18050 },
18051 {
18052 "name": "query",
18053 "type": "!X"
18054 }
18055 ],
18056 "type": "X"
18057 },
18058 {
18059 "id": "-113456221",
18060 "method": "contacts.resolveUsername",
18061 "params": [
18062 {
18063 "name": "username",
18064 "type": "string"
18065 }
18066 ],
18067 "type": "contacts.ResolvedPeer"
18068 },
18069 {
18070 "id": "149257707",
18071 "method": "account.sendChangePhoneCode",
18072 "params": [
18073 {
18074 "name": "flags",
18075 "type": "#"
18076 },
18077 {
18078 "name": "allow_flashcall",
18079 "type": "flags.0?true"
18080 },
18081 {
18082 "name": "phone_number",
18083 "type": "string"
18084 },
18085 {
18086 "name": "current_number",
18087 "type": "flags.0?Bool"
18088 }
18089 ],
18090 "type": "auth.SentCode"
18091 },
18092 {
18093 "id": "1891839707",
18094 "method": "account.changePhone",
18095 "params": [
18096 {
18097 "name": "phone_number",
18098 "type": "string"
18099 },
18100 {
18101 "name": "phone_code_hash",
18102 "type": "string"
18103 },
18104 {
18105 "name": "phone_code",
18106 "type": "string"
18107 }
18108 ],
18109 "type": "User"
18110 },
18111 {
18112 "id": "479598769",
18113 "method": "messages.getAllStickers",
18114 "params": [
18115 {
18116 "name": "hash",
18117 "type": "int"
18118 }
18119 ],
18120 "type": "messages.AllStickers"
18121 },
18122 {
18123 "id": "954152242",
18124 "method": "account.updateDeviceLocked",
18125 "params": [
18126 {
18127 "name": "period",
18128 "type": "int"
18129 }
18130 ],
18131 "type": "Bool"
18132 },
18133 {
18134 "id": "1738800940",
18135 "method": "auth.importBotAuthorization",
18136 "params": [
18137 {
18138 "name": "flags",
18139 "type": "int"
18140 },
18141 {
18142 "name": "api_id",
18143 "type": "int"
18144 },
18145 {
18146 "name": "api_hash",
18147 "type": "string"
18148 },
18149 {
18150 "name": "bot_auth_token",
18151 "type": "string"
18152 }
18153 ],
18154 "type": "auth.Authorization"
18155 },
18156 {
18157 "id": "623001124",
18158 "method": "messages.getWebPagePreview",
18159 "params": [
18160 {
18161 "name": "message",
18162 "type": "string"
18163 }
18164 ],
18165 "type": "MessageMedia"
18166 },
18167 {
18168 "id": "-484392616",
18169 "method": "account.getAuthorizations",
18170 "params": [],
18171 "type": "account.Authorizations"
18172 },
18173 {
18174 "id": "-545786948",
18175 "method": "account.resetAuthorization",
18176 "params": [
18177 {
18178 "name": "hash",
18179 "type": "long"
18180 }
18181 ],
18182 "type": "Bool"
18183 },
18184 {
18185 "id": "1418342645",
18186 "method": "account.getPassword",
18187 "params": [],
18188 "type": "account.Password"
18189 },
18190 {
18191 "id": "-1131605573",
18192 "method": "account.getPasswordSettings",
18193 "params": [
18194 {
18195 "name": "current_password_hash",
18196 "type": "bytes"
18197 }
18198 ],
18199 "type": "account.PasswordSettings"
18200 },
18201 {
18202 "id": "-92517498",
18203 "method": "account.updatePasswordSettings",
18204 "params": [
18205 {
18206 "name": "current_password_hash",
18207 "type": "bytes"
18208 },
18209 {
18210 "name": "new_settings",
18211 "type": "account.PasswordInputSettings"
18212 }
18213 ],
18214 "type": "Bool"
18215 },
18216 {
18217 "id": "174260510",
18218 "method": "auth.checkPassword",
18219 "params": [
18220 {
18221 "name": "password_hash",
18222 "type": "bytes"
18223 }
18224 ],
18225 "type": "auth.Authorization"
18226 },
18227 {
18228 "id": "-661144474",
18229 "method": "auth.requestPasswordRecovery",
18230 "params": [],
18231 "type": "auth.PasswordRecovery"
18232 },
18233 {
18234 "id": "1319464594",
18235 "method": "auth.recoverPassword",
18236 "params": [
18237 {
18238 "name": "code",
18239 "type": "string"
18240 }
18241 ],
18242 "type": "auth.Authorization"
18243 },
18244 {
18245 "id": "-1080796745",
18246 "method": "invokeWithoutUpdates",
18247 "params": [
18248 {
18249 "name": "query",
18250 "type": "!X"
18251 }
18252 ],
18253 "type": "X"
18254 },
18255 {
18256 "id": "2106086025",
18257 "method": "messages.exportChatInvite",
18258 "params": [
18259 {
18260 "name": "chat_id",
18261 "type": "int"
18262 }
18263 ],
18264 "type": "ExportedChatInvite"
18265 },
18266 {
18267 "id": "1051570619",
18268 "method": "messages.checkChatInvite",
18269 "params": [
18270 {
18271 "name": "hash",
18272 "type": "string"
18273 }
18274 ],
18275 "type": "ChatInvite"
18276 },
18277 {
18278 "id": "1817183516",
18279 "method": "messages.importChatInvite",
18280 "params": [
18281 {
18282 "name": "hash",
18283 "type": "string"
18284 }
18285 ],
18286 "type": "Updates"
18287 },
18288 {
18289 "id": "639215886",
18290 "method": "messages.getStickerSet",
18291 "params": [
18292 {
18293 "name": "stickerset",
18294 "type": "InputStickerSet"
18295 }
18296 ],
18297 "type": "messages.StickerSet"
18298 },
18299 {
18300 "id": "-946871200",
18301 "method": "messages.installStickerSet",
18302 "params": [
18303 {
18304 "name": "stickerset",
18305 "type": "InputStickerSet"
18306 },
18307 {
18308 "name": "archived",
18309 "type": "Bool"
18310 }
18311 ],
18312 "type": "messages.StickerSetInstallResult"
18313 },
18314 {
18315 "id": "-110209570",
18316 "method": "messages.uninstallStickerSet",
18317 "params": [
18318 {
18319 "name": "stickerset",
18320 "type": "InputStickerSet"
18321 }
18322 ],
18323 "type": "Bool"
18324 },
18325 {
18326 "id": "-421563528",
18327 "method": "messages.startBot",
18328 "params": [
18329 {
18330 "name": "bot",
18331 "type": "InputUser"
18332 },
18333 {
18334 "name": "peer",
18335 "type": "InputPeer"
18336 },
18337 {
18338 "name": "random_id",
18339 "type": "long"
18340 },
18341 {
18342 "name": "start_param",
18343 "type": "string"
18344 }
18345 ],
18346 "type": "Updates"
18347 },
18348 {
18349 "id": "-1189013126",
18350 "method": "help.getAppChangelog",
18351 "params": [],
18352 "type": "help.AppChangelog"
18353 },
18354 {
18355 "id": "-993483427",
18356 "method": "messages.getMessagesViews",
18357 "params": [
18358 {
18359 "name": "peer",
18360 "type": "InputPeer"
18361 },
18362 {
18363 "name": "id",
18364 "type": "Vector<int>"
18365 },
18366 {
18367 "name": "increment",
18368 "type": "Bool"
18369 }
18370 ],
18371 "type": "Vector<int>"
18372 },
18373 {
18374 "id": "-871347913",
18375 "method": "channels.readHistory",
18376 "params": [
18377 {
18378 "name": "channel",
18379 "type": "InputChannel"
18380 },
18381 {
18382 "name": "max_id",
18383 "type": "int"
18384 }
18385 ],
18386 "type": "Bool"
18387 },
18388 {
18389 "id": "-2067661490",
18390 "method": "channels.deleteMessages",
18391 "params": [
18392 {
18393 "name": "channel",
18394 "type": "InputChannel"
18395 },
18396 {
18397 "name": "id",
18398 "type": "Vector<int>"
18399 }
18400 ],
18401 "type": "messages.AffectedMessages"
18402 },
18403 {
18404 "id": "-787622117",
18405 "method": "channels.deleteUserHistory",
18406 "params": [
18407 {
18408 "name": "channel",
18409 "type": "InputChannel"
18410 },
18411 {
18412 "name": "user_id",
18413 "type": "InputUser"
18414 }
18415 ],
18416 "type": "messages.AffectedHistory"
18417 },
18418 {
18419 "id": "-32999408",
18420 "method": "channels.reportSpam",
18421 "params": [
18422 {
18423 "name": "channel",
18424 "type": "InputChannel"
18425 },
18426 {
18427 "name": "user_id",
18428 "type": "InputUser"
18429 },
18430 {
18431 "name": "id",
18432 "type": "Vector<int>"
18433 }
18434 ],
18435 "type": "Bool"
18436 },
18437 {
18438 "id": "-1814580409",
18439 "method": "channels.getMessages",
18440 "params": [
18441 {
18442 "name": "channel",
18443 "type": "InputChannel"
18444 },
18445 {
18446 "name": "id",
18447 "type": "Vector<int>"
18448 }
18449 ],
18450 "type": "messages.Messages"
18451 },
18452 {
18453 "id": "618237842",
18454 "method": "channels.getParticipants",
18455 "params": [
18456 {
18457 "name": "channel",
18458 "type": "InputChannel"
18459 },
18460 {
18461 "name": "filter",
18462 "type": "ChannelParticipantsFilter"
18463 },
18464 {
18465 "name": "offset",
18466 "type": "int"
18467 },
18468 {
18469 "name": "limit",
18470 "type": "int"
18471 }
18472 ],
18473 "type": "channels.ChannelParticipants"
18474 },
18475 {
18476 "id": "1416484774",
18477 "method": "channels.getParticipant",
18478 "params": [
18479 {
18480 "name": "channel",
18481 "type": "InputChannel"
18482 },
18483 {
18484 "name": "user_id",
18485 "type": "InputUser"
18486 }
18487 ],
18488 "type": "channels.ChannelParticipant"
18489 },
18490 {
18491 "id": "176122811",
18492 "method": "channels.getChannels",
18493 "params": [
18494 {
18495 "name": "id",
18496 "type": "Vector<InputChannel>"
18497 }
18498 ],
18499 "type": "messages.Chats"
18500 },
18501 {
18502 "id": "141781513",
18503 "method": "channels.getFullChannel",
18504 "params": [
18505 {
18506 "name": "channel",
18507 "type": "InputChannel"
18508 }
18509 ],
18510 "type": "messages.ChatFull"
18511 },
18512 {
18513 "id": "-192332417",
18514 "method": "channels.createChannel",
18515 "params": [
18516 {
18517 "name": "flags",
18518 "type": "#"
18519 },
18520 {
18521 "name": "broadcast",
18522 "type": "flags.0?true"
18523 },
18524 {
18525 "name": "megagroup",
18526 "type": "flags.1?true"
18527 },
18528 {
18529 "name": "title",
18530 "type": "string"
18531 },
18532 {
18533 "name": "about",
18534 "type": "string"
18535 }
18536 ],
18537 "type": "Updates"
18538 },
18539 {
18540 "id": "333610782",
18541 "method": "channels.editAbout",
18542 "params": [
18543 {
18544 "name": "channel",
18545 "type": "InputChannel"
18546 },
18547 {
18548 "name": "about",
18549 "type": "string"
18550 }
18551 ],
18552 "type": "Bool"
18553 },
18554 {
18555 "id": "-344583728",
18556 "method": "channels.editAdmin",
18557 "params": [
18558 {
18559 "name": "channel",
18560 "type": "InputChannel"
18561 },
18562 {
18563 "name": "user_id",
18564 "type": "InputUser"
18565 },
18566 {
18567 "name": "role",
18568 "type": "ChannelParticipantRole"
18569 }
18570 ],
18571 "type": "Updates"
18572 },
18573 {
18574 "id": "1450044624",
18575 "method": "channels.editTitle",
18576 "params": [
18577 {
18578 "name": "channel",
18579 "type": "InputChannel"
18580 },
18581 {
18582 "name": "title",
18583 "type": "string"
18584 }
18585 ],
18586 "type": "Updates"
18587 },
18588 {
18589 "id": "-248621111",
18590 "method": "channels.editPhoto",
18591 "params": [
18592 {
18593 "name": "channel",
18594 "type": "InputChannel"
18595 },
18596 {
18597 "name": "photo",
18598 "type": "InputChatPhoto"
18599 }
18600 ],
18601 "type": "Updates"
18602 },
18603 {
18604 "id": "283557164",
18605 "method": "channels.checkUsername",
18606 "params": [
18607 {
18608 "name": "channel",
18609 "type": "InputChannel"
18610 },
18611 {
18612 "name": "username",
18613 "type": "string"
18614 }
18615 ],
18616 "type": "Bool"
18617 },
18618 {
18619 "id": "890549214",
18620 "method": "channels.updateUsername",
18621 "params": [
18622 {
18623 "name": "channel",
18624 "type": "InputChannel"
18625 },
18626 {
18627 "name": "username",
18628 "type": "string"
18629 }
18630 ],
18631 "type": "Bool"
18632 },
18633 {
18634 "id": "615851205",
18635 "method": "channels.joinChannel",
18636 "params": [
18637 {
18638 "name": "channel",
18639 "type": "InputChannel"
18640 }
18641 ],
18642 "type": "Updates"
18643 },
18644 {
18645 "id": "-130635115",
18646 "method": "channels.leaveChannel",
18647 "params": [
18648 {
18649 "name": "channel",
18650 "type": "InputChannel"
18651 }
18652 ],
18653 "type": "Updates"
18654 },
18655 {
18656 "id": "429865580",
18657 "method": "channels.inviteToChannel",
18658 "params": [
18659 {
18660 "name": "channel",
18661 "type": "InputChannel"
18662 },
18663 {
18664 "name": "users",
18665 "type": "Vector<InputUser>"
18666 }
18667 ],
18668 "type": "Updates"
18669 },
18670 {
18671 "id": "-1502421484",
18672 "method": "channels.kickFromChannel",
18673 "params": [
18674 {
18675 "name": "channel",
18676 "type": "InputChannel"
18677 },
18678 {
18679 "name": "user_id",
18680 "type": "InputUser"
18681 },
18682 {
18683 "name": "kicked",
18684 "type": "Bool"
18685 }
18686 ],
18687 "type": "Updates"
18688 },
18689 {
18690 "id": "-950663035",
18691 "method": "channels.exportInvite",
18692 "params": [
18693 {
18694 "name": "channel",
18695 "type": "InputChannel"
18696 }
18697 ],
18698 "type": "ExportedChatInvite"
18699 },
18700 {
18701 "id": "-1072619549",
18702 "method": "channels.deleteChannel",
18703 "params": [
18704 {
18705 "name": "channel",
18706 "type": "InputChannel"
18707 }
18708 ],
18709 "type": "Updates"
18710 },
18711 {
18712 "id": "-1154295872",
18713 "method": "updates.getChannelDifference",
18714 "params": [
18715 {
18716 "name": "channel",
18717 "type": "InputChannel"
18718 },
18719 {
18720 "name": "filter",
18721 "type": "ChannelMessagesFilter"
18722 },
18723 {
18724 "name": "pts",
18725 "type": "int"
18726 },
18727 {
18728 "name": "limit",
18729 "type": "int"
18730 }
18731 ],
18732 "type": "updates.ChannelDifference"
18733 },
18734 {
18735 "id": "-326379039",
18736 "method": "messages.toggleChatAdmins",
18737 "params": [
18738 {
18739 "name": "chat_id",
18740 "type": "int"
18741 },
18742 {
18743 "name": "enabled",
18744 "type": "Bool"
18745 }
18746 ],
18747 "type": "Updates"
18748 },
18749 {
18750 "id": "-1444503762",
18751 "method": "messages.editChatAdmin",
18752 "params": [
18753 {
18754 "name": "chat_id",
18755 "type": "int"
18756 },
18757 {
18758 "name": "user_id",
18759 "type": "InputUser"
18760 },
18761 {
18762 "name": "is_admin",
18763 "type": "Bool"
18764 }
18765 ],
18766 "type": "Bool"
18767 },
18768 {
18769 "id": "363051235",
18770 "method": "messages.migrateChat",
18771 "params": [
18772 {
18773 "name": "chat_id",
18774 "type": "int"
18775 }
18776 ],
18777 "type": "Updates"
18778 },
18779 {
18780 "id": "-1640190800",
18781 "method": "messages.searchGlobal",
18782 "params": [
18783 {
18784 "name": "q",
18785 "type": "string"
18786 },
18787 {
18788 "name": "offset_date",
18789 "type": "int"
18790 },
18791 {
18792 "name": "offset_peer",
18793 "type": "InputPeer"
18794 },
18795 {
18796 "name": "offset_id",
18797 "type": "int"
18798 },
18799 {
18800 "name": "limit",
18801 "type": "int"
18802 }
18803 ],
18804 "type": "messages.Messages"
18805 },
18806 {
18807 "id": "889286899",
18808 "method": "help.getTermsOfService",
18809 "params": [],
18810 "type": "help.TermsOfService"
18811 },
18812 {
18813 "id": "2016638777",
18814 "method": "messages.reorderStickerSets",
18815 "params": [
18816 {
18817 "name": "flags",
18818 "type": "#"
18819 },
18820 {
18821 "name": "masks",
18822 "type": "flags.0?true"
18823 },
18824 {
18825 "name": "order",
18826 "type": "Vector<long>"
18827 }
18828 ],
18829 "type": "Bool"
18830 },
18831 {
18832 "id": "864953444",
18833 "method": "messages.getDocumentByHash",
18834 "params": [
18835 {
18836 "name": "sha256",
18837 "type": "bytes"
18838 },
18839 {
18840 "name": "size",
18841 "type": "int"
18842 },
18843 {
18844 "name": "mime_type",
18845 "type": "string"
18846 }
18847 ],
18848 "type": "Document"
18849 },
18850 {
18851 "id": "-1080395925",
18852 "method": "messages.searchGifs",
18853 "params": [
18854 {
18855 "name": "q",
18856 "type": "string"
18857 },
18858 {
18859 "name": "offset",
18860 "type": "int"
18861 }
18862 ],
18863 "type": "messages.FoundGifs"
18864 },
18865 {
18866 "id": "-2084618926",
18867 "method": "messages.getSavedGifs",
18868 "params": [
18869 {
18870 "name": "hash",
18871 "type": "int"
18872 }
18873 ],
18874 "type": "messages.SavedGifs"
18875 },
18876 {
18877 "id": "846868683",
18878 "method": "messages.saveGif",
18879 "params": [
18880 {
18881 "name": "id",
18882 "type": "InputDocument"
18883 },
18884 {
18885 "name": "unsave",
18886 "type": "Bool"
18887 }
18888 ],
18889 "type": "Bool"
18890 },
18891 {
18892 "id": "1364105629",
18893 "method": "messages.getInlineBotResults",
18894 "params": [
18895 {
18896 "name": "flags",
18897 "type": "#"
18898 },
18899 {
18900 "name": "bot",
18901 "type": "InputUser"
18902 },
18903 {
18904 "name": "peer",
18905 "type": "InputPeer"
18906 },
18907 {
18908 "name": "geo_point",
18909 "type": "flags.0?InputGeoPoint"
18910 },
18911 {
18912 "name": "query",
18913 "type": "string"
18914 },
18915 {
18916 "name": "offset",
18917 "type": "string"
18918 }
18919 ],
18920 "type": "messages.BotResults"
18921 },
18922 {
18923 "id": "-346119674",
18924 "method": "messages.setInlineBotResults",
18925 "params": [
18926 {
18927 "name": "flags",
18928 "type": "#"
18929 },
18930 {
18931 "name": "gallery",
18932 "type": "flags.0?true"
18933 },
18934 {
18935 "name": "private",
18936 "type": "flags.1?true"
18937 },
18938 {
18939 "name": "query_id",
18940 "type": "long"
18941 },
18942 {
18943 "name": "results",
18944 "type": "Vector<InputBotInlineResult>"
18945 },
18946 {
18947 "name": "cache_time",
18948 "type": "int"
18949 },
18950 {
18951 "name": "next_offset",
18952 "type": "flags.2?string"
18953 },
18954 {
18955 "name": "switch_pm",
18956 "type": "flags.3?InlineBotSwitchPM"
18957 }
18958 ],
18959 "type": "Bool"
18960 },
18961 {
18962 "id": "-1318189314",
18963 "method": "messages.sendInlineBotResult",
18964 "params": [
18965 {
18966 "name": "flags",
18967 "type": "#"
18968 },
18969 {
18970 "name": "silent",
18971 "type": "flags.5?true"
18972 },
18973 {
18974 "name": "background",
18975 "type": "flags.6?true"
18976 },
18977 {
18978 "name": "clear_draft",
18979 "type": "flags.7?true"
18980 },
18981 {
18982 "name": "peer",
18983 "type": "InputPeer"
18984 },
18985 {
18986 "name": "reply_to_msg_id",
18987 "type": "flags.0?int"
18988 },
18989 {
18990 "name": "random_id",
18991 "type": "long"
18992 },
18993 {
18994 "name": "query_id",
18995 "type": "long"
18996 },
18997 {
18998 "name": "id",
18999 "type": "string"
19000 }
19001 ],
19002 "type": "Updates"
19003 },
19004 {
19005 "id": "1231065863",
19006 "method": "channels.toggleInvites",
19007 "params": [
19008 {
19009 "name": "channel",
19010 "type": "InputChannel"
19011 },
19012 {
19013 "name": "enabled",
19014 "type": "Bool"
19015 }
19016 ],
19017 "type": "Updates"
19018 },
19019 {
19020 "id": "-934882771",
19021 "method": "channels.exportMessageLink",
19022 "params": [
19023 {
19024 "name": "channel",
19025 "type": "InputChannel"
19026 },
19027 {
19028 "name": "id",
19029 "type": "int"
19030 }
19031 ],
19032 "type": "ExportedMessageLink"
19033 },
19034 {
19035 "id": "527021574",
19036 "method": "channels.toggleSignatures",
19037 "params": [
19038 {
19039 "name": "channel",
19040 "type": "InputChannel"
19041 },
19042 {
19043 "name": "enabled",
19044 "type": "Bool"
19045 }
19046 ],
19047 "type": "Updates"
19048 },
19049 {
19050 "id": "-1490162350",
19051 "method": "channels.updatePinnedMessage",
19052 "params": [
19053 {
19054 "name": "flags",
19055 "type": "#"
19056 },
19057 {
19058 "name": "silent",
19059 "type": "flags.0?true"
19060 },
19061 {
19062 "name": "channel",
19063 "type": "InputChannel"
19064 },
19065 {
19066 "name": "id",
19067 "type": "int"
19068 }
19069 ],
19070 "type": "Updates"
19071 },
19072 {
19073 "id": "1056025023",
19074 "method": "auth.resendCode",
19075 "params": [
19076 {
19077 "name": "phone_number",
19078 "type": "string"
19079 },
19080 {
19081 "name": "phone_code_hash",
19082 "type": "string"
19083 }
19084 ],
19085 "type": "auth.SentCode"
19086 },
19087 {
19088 "id": "520357240",
19089 "method": "auth.cancelCode",
19090 "params": [
19091 {
19092 "name": "phone_number",
19093 "type": "string"
19094 },
19095 {
19096 "name": "phone_code_hash",
19097 "type": "string"
19098 }
19099 ],
19100 "type": "Bool"
19101 },
19102 {
19103 "id": "-39416522",
19104 "method": "messages.getMessageEditData",
19105 "params": [
19106 {
19107 "name": "peer",
19108 "type": "InputPeer"
19109 },
19110 {
19111 "name": "id",
19112 "type": "int"
19113 }
19114 ],
19115 "type": "messages.MessageEditData"
19116 },
19117 {
19118 "id": "-829299510",
19119 "method": "messages.editMessage",
19120 "params": [
19121 {
19122 "name": "flags",
19123 "type": "#"
19124 },
19125 {
19126 "name": "no_webpage",
19127 "type": "flags.1?true"
19128 },
19129 {
19130 "name": "peer",
19131 "type": "InputPeer"
19132 },
19133 {
19134 "name": "id",
19135 "type": "int"
19136 },
19137 {
19138 "name": "message",
19139 "type": "flags.11?string"
19140 },
19141 {
19142 "name": "reply_markup",
19143 "type": "flags.2?ReplyMarkup"
19144 },
19145 {
19146 "name": "entities",
19147 "type": "flags.3?Vector<MessageEntity>"
19148 }
19149 ],
19150 "type": "Updates"
19151 },
19152 {
19153 "id": "319564933",
19154 "method": "messages.editInlineBotMessage",
19155 "params": [
19156 {
19157 "name": "flags",
19158 "type": "#"
19159 },
19160 {
19161 "name": "no_webpage",
19162 "type": "flags.1?true"
19163 },
19164 {
19165 "name": "id",
19166 "type": "InputBotInlineMessageID"
19167 },
19168 {
19169 "name": "message",
19170 "type": "flags.11?string"
19171 },
19172 {
19173 "name": "reply_markup",
19174 "type": "flags.2?ReplyMarkup"
19175 },
19176 {
19177 "name": "entities",
19178 "type": "flags.3?Vector<MessageEntity>"
19179 }
19180 ],
19181 "type": "Bool"
19182 },
19183 {
19184 "id": "-2130010132",
19185 "method": "messages.getBotCallbackAnswer",
19186 "params": [
19187 {
19188 "name": "flags",
19189 "type": "#"
19190 },
19191 {
19192 "name": "game",
19193 "type": "flags.1?true"
19194 },
19195 {
19196 "name": "peer",
19197 "type": "InputPeer"
19198 },
19199 {
19200 "name": "msg_id",
19201 "type": "int"
19202 },
19203 {
19204 "name": "data",
19205 "type": "flags.0?bytes"
19206 }
19207 ],
19208 "type": "messages.BotCallbackAnswer"
19209 },
19210 {
19211 "id": "-920136629",
19212 "method": "messages.setBotCallbackAnswer",
19213 "params": [
19214 {
19215 "name": "flags",
19216 "type": "#"
19217 },
19218 {
19219 "name": "alert",
19220 "type": "flags.1?true"
19221 },
19222 {
19223 "name": "query_id",
19224 "type": "long"
19225 },
19226 {
19227 "name": "message",
19228 "type": "flags.0?string"
19229 },
19230 {
19231 "name": "url",
19232 "type": "flags.2?string"
19233 }
19234 ],
19235 "type": "Bool"
19236 },
19237 {
19238 "id": "-728224331",
19239 "method": "contacts.getTopPeers",
19240 "params": [
19241 {
19242 "name": "flags",
19243 "type": "#"
19244 },
19245 {
19246 "name": "correspondents",
19247 "type": "flags.0?true"
19248 },
19249 {
19250 "name": "bots_pm",
19251 "type": "flags.1?true"
19252 },
19253 {
19254 "name": "bots_inline",
19255 "type": "flags.2?true"
19256 },
19257 {
19258 "name": "groups",
19259 "type": "flags.10?true"
19260 },
19261 {
19262 "name": "channels",
19263 "type": "flags.15?true"
19264 },
19265 {
19266 "name": "offset",
19267 "type": "int"
19268 },
19269 {
19270 "name": "limit",
19271 "type": "int"
19272 },
19273 {
19274 "name": "hash",
19275 "type": "int"
19276 }
19277 ],
19278 "type": "contacts.TopPeers"
19279 },
19280 {
19281 "id": "451113900",
19282 "method": "contacts.resetTopPeerRating",
19283 "params": [
19284 {
19285 "name": "category",
19286 "type": "TopPeerCategory"
19287 },
19288 {
19289 "name": "peer",
19290 "type": "InputPeer"
19291 }
19292 ],
19293 "type": "Bool"
19294 },
19295 {
19296 "id": "764901049",
19297 "method": "messages.getPeerDialogs",
19298 "params": [
19299 {
19300 "name": "peers",
19301 "type": "Vector<InputPeer>"
19302 }
19303 ],
19304 "type": "messages.PeerDialogs"
19305 },
19306 {
19307 "id": "-1137057461",
19308 "method": "messages.saveDraft",
19309 "params": [
19310 {
19311 "name": "flags",
19312 "type": "#"
19313 },
19314 {
19315 "name": "no_webpage",
19316 "type": "flags.1?true"
19317 },
19318 {
19319 "name": "reply_to_msg_id",
19320 "type": "flags.0?int"
19321 },
19322 {
19323 "name": "peer",
19324 "type": "InputPeer"
19325 },
19326 {
19327 "name": "message",
19328 "type": "string"
19329 },
19330 {
19331 "name": "entities",
19332 "type": "flags.3?Vector<MessageEntity>"
19333 }
19334 ],
19335 "type": "Bool"
19336 },
19337 {
19338 "id": "1782549861",
19339 "method": "messages.getAllDrafts",
19340 "params": [],
19341 "type": "Updates"
19342 },
19343 {
19344 "id": "766298703",
19345 "method": "messages.getFeaturedStickers",
19346 "params": [
19347 {
19348 "name": "hash",
19349 "type": "int"
19350 }
19351 ],
19352 "type": "messages.FeaturedStickers"
19353 },
19354 {
19355 "id": "1527873830",
19356 "method": "messages.readFeaturedStickers",
19357 "params": [
19358 {
19359 "name": "id",
19360 "type": "Vector<long>"
19361 }
19362 ],
19363 "type": "Bool"
19364 },
19365 {
19366 "id": "1587647177",
19367 "method": "messages.getRecentStickers",
19368 "params": [
19369 {
19370 "name": "flags",
19371 "type": "#"
19372 },
19373 {
19374 "name": "attached",
19375 "type": "flags.0?true"
19376 },
19377 {
19378 "name": "hash",
19379 "type": "int"
19380 }
19381 ],
19382 "type": "messages.RecentStickers"
19383 },
19384 {
19385 "id": "958863608",
19386 "method": "messages.saveRecentSticker",
19387 "params": [
19388 {
19389 "name": "flags",
19390 "type": "#"
19391 },
19392 {
19393 "name": "attached",
19394 "type": "flags.0?true"
19395 },
19396 {
19397 "name": "id",
19398 "type": "InputDocument"
19399 },
19400 {
19401 "name": "unsave",
19402 "type": "Bool"
19403 }
19404 ],
19405 "type": "Bool"
19406 },
19407 {
19408 "id": "-1986437075",
19409 "method": "messages.clearRecentStickers",
19410 "params": [
19411 {
19412 "name": "flags",
19413 "type": "#"
19414 },
19415 {
19416 "name": "attached",
19417 "type": "flags.0?true"
19418 }
19419 ],
19420 "type": "Bool"
19421 },
19422 {
19423 "id": "1475442322",
19424 "method": "messages.getArchivedStickers",
19425 "params": [
19426 {
19427 "name": "flags",
19428 "type": "#"
19429 },
19430 {
19431 "name": "masks",
19432 "type": "flags.0?true"
19433 },
19434 {
19435 "name": "offset_id",
19436 "type": "long"
19437 },
19438 {
19439 "name": "limit",
19440 "type": "int"
19441 }
19442 ],
19443 "type": "messages.ArchivedStickers"
19444 },
19445 {
19446 "id": "353818557",
19447 "method": "account.sendConfirmPhoneCode",
19448 "params": [
19449 {
19450 "name": "flags",
19451 "type": "#"
19452 },
19453 {
19454 "name": "allow_flashcall",
19455 "type": "flags.0?true"
19456 },
19457 {
19458 "name": "hash",
19459 "type": "string"
19460 },
19461 {
19462 "name": "current_number",
19463 "type": "flags.0?Bool"
19464 }
19465 ],
19466 "type": "auth.SentCode"
19467 },
19468 {
19469 "id": "1596029123",
19470 "method": "account.confirmPhone",
19471 "params": [
19472 {
19473 "name": "phone_code_hash",
19474 "type": "string"
19475 },
19476 {
19477 "name": "phone_code",
19478 "type": "string"
19479 }
19480 ],
19481 "type": "Bool"
19482 },
19483 {
19484 "id": "-1920105769",
19485 "method": "channels.getAdminedPublicChannels",
19486 "params": [],
19487 "type": "messages.Chats"
19488 },
19489 {
19490 "id": "1706608543",
19491 "method": "messages.getMaskStickers",
19492 "params": [
19493 {
19494 "name": "hash",
19495 "type": "int"
19496 }
19497 ],
19498 "type": "messages.AllStickers"
19499 },
19500 {
19501 "id": "-866424884",
19502 "method": "messages.getAttachedStickers",
19503 "params": [
19504 {
19505 "name": "media",
19506 "type": "InputStickeredMedia"
19507 }
19508 ],
19509 "type": "Vector<StickerSetCovered>"
19510 },
19511 {
19512 "id": "-1907842680",
19513 "method": "auth.dropTempAuthKeys",
19514 "params": [
19515 {
19516 "name": "except_auth_keys",
19517 "type": "Vector<long>"
19518 }
19519 ],
19520 "type": "Bool"
19521 },
19522 {
19523 "id": "-1896289088",
19524 "method": "messages.setGameScore",
19525 "params": [
19526 {
19527 "name": "flags",
19528 "type": "#"
19529 },
19530 {
19531 "name": "edit_message",
19532 "type": "flags.0?true"
19533 },
19534 {
19535 "name": "peer",
19536 "type": "InputPeer"
19537 },
19538 {
19539 "name": "id",
19540 "type": "int"
19541 },
19542 {
19543 "name": "user_id",
19544 "type": "InputUser"
19545 },
19546 {
19547 "name": "score",
19548 "type": "int"
19549 }
19550 ],
19551 "type": "Updates"
19552 },
19553 {
19554 "id": "363700068",
19555 "method": "messages.setInlineGameScore",
19556 "params": [
19557 {
19558 "name": "flags",
19559 "type": "#"
19560 },
19561 {
19562 "name": "edit_message",
19563 "type": "flags.0?true"
19564 },
19565 {
19566 "name": "id",
19567 "type": "InputBotInlineMessageID"
19568 },
19569 {
19570 "name": "user_id",
19571 "type": "InputUser"
19572 },
19573 {
19574 "name": "score",
19575 "type": "int"
19576 }
19577 ],
19578 "type": "Bool"
19579 },
19580 {
19581 "id": "-400399203",
19582 "method": "messages.getGameHighScores",
19583 "params": [
19584 {
19585 "name": "peer",
19586 "type": "InputPeer"
19587 },
19588 {
19589 "name": "id",
19590 "type": "int"
19591 },
19592 {
19593 "name": "user_id",
19594 "type": "InputUser"
19595 }
19596 ],
19597 "type": "messages.HighScores"
19598 },
19599 {
19600 "id": "258170395",
19601 "method": "messages.getInlineGameHighScores",
19602 "params": [
19603 {
19604 "name": "id",
19605 "type": "InputBotInlineMessageID"
19606 },
19607 {
19608 "name": "user_id",
19609 "type": "InputUser"
19610 }
19611 ],
19612 "type": "messages.HighScores"
19613 }
19614 ]
19615};
19616
19617/***/ }),
19618/* 39 */
19619/***/ (function(module, exports) {
19620
19621module.exports = {
19622 "constructors": [
19623 {
19624 "id": "481674261",
19625 "predicate": "vector",
19626 "params": [],
19627 "type": "Vector t"
19628 },
19629 {
19630 "id": "85337187",
19631 "predicate": "resPQ",
19632 "params": [
19633 {
19634 "name": "nonce",
19635 "type": "int128"
19636 },
19637 {
19638 "name": "server_nonce",
19639 "type": "int128"
19640 },
19641 {
19642 "name": "pq",
19643 "type": "bytes"
19644 },
19645 {
19646 "name": "server_public_key_fingerprints",
19647 "type": "Vector<long>"
19648 }
19649 ],
19650 "type": "ResPQ"
19651 },
19652 {
19653 "id": "-2083955988",
19654 "predicate": "p_q_inner_data",
19655 "params": [
19656 {
19657 "name": "pq",
19658 "type": "bytes"
19659 },
19660 {
19661 "name": "p",
19662 "type": "bytes"
19663 },
19664 {
19665 "name": "q",
19666 "type": "bytes"
19667 },
19668 {
19669 "name": "nonce",
19670 "type": "int128"
19671 },
19672 {
19673 "name": "server_nonce",
19674 "type": "int128"
19675 },
19676 {
19677 "name": "new_nonce",
19678 "type": "int256"
19679 }
19680 ],
19681 "type": "P_Q_inner_data"
19682 },
19683 {
19684 "id": "2043348061",
19685 "predicate": "server_DH_params_fail",
19686 "params": [
19687 {
19688 "name": "nonce",
19689 "type": "int128"
19690 },
19691 {
19692 "name": "server_nonce",
19693 "type": "int128"
19694 },
19695 {
19696 "name": "new_nonce_hash",
19697 "type": "int128"
19698 }
19699 ],
19700 "type": "Server_DH_Params"
19701 },
19702 {
19703 "id": "-790100132",
19704 "predicate": "server_DH_params_ok",
19705 "params": [
19706 {
19707 "name": "nonce",
19708 "type": "int128"
19709 },
19710 {
19711 "name": "server_nonce",
19712 "type": "int128"
19713 },
19714 {
19715 "name": "encrypted_answer",
19716 "type": "bytes"
19717 }
19718 ],
19719 "type": "Server_DH_Params"
19720 },
19721 {
19722 "id": "-1249309254",
19723 "predicate": "server_DH_inner_data",
19724 "params": [
19725 {
19726 "name": "nonce",
19727 "type": "int128"
19728 },
19729 {
19730 "name": "server_nonce",
19731 "type": "int128"
19732 },
19733 {
19734 "name": "g",
19735 "type": "int"
19736 },
19737 {
19738 "name": "dh_prime",
19739 "type": "bytes"
19740 },
19741 {
19742 "name": "g_a",
19743 "type": "bytes"
19744 },
19745 {
19746 "name": "server_time",
19747 "type": "int"
19748 }
19749 ],
19750 "type": "Server_DH_inner_data"
19751 },
19752 {
19753 "id": "1715713620",
19754 "predicate": "client_DH_inner_data",
19755 "params": [
19756 {
19757 "name": "nonce",
19758 "type": "int128"
19759 },
19760 {
19761 "name": "server_nonce",
19762 "type": "int128"
19763 },
19764 {
19765 "name": "retry_id",
19766 "type": "long"
19767 },
19768 {
19769 "name": "g_b",
19770 "type": "bytes"
19771 }
19772 ],
19773 "type": "Client_DH_Inner_Data"
19774 },
19775 {
19776 "id": "1003222836",
19777 "predicate": "dh_gen_ok",
19778 "params": [
19779 {
19780 "name": "nonce",
19781 "type": "int128"
19782 },
19783 {
19784 "name": "server_nonce",
19785 "type": "int128"
19786 },
19787 {
19788 "name": "new_nonce_hash1",
19789 "type": "int128"
19790 }
19791 ],
19792 "type": "Set_client_DH_params_answer"
19793 },
19794 {
19795 "id": "1188831161",
19796 "predicate": "dh_gen_retry",
19797 "params": [
19798 {
19799 "name": "nonce",
19800 "type": "int128"
19801 },
19802 {
19803 "name": "server_nonce",
19804 "type": "int128"
19805 },
19806 {
19807 "name": "new_nonce_hash2",
19808 "type": "int128"
19809 }
19810 ],
19811 "type": "Set_client_DH_params_answer"
19812 },
19813 {
19814 "id": "-1499615742",
19815 "predicate": "dh_gen_fail",
19816 "params": [
19817 {
19818 "name": "nonce",
19819 "type": "int128"
19820 },
19821 {
19822 "name": "server_nonce",
19823 "type": "int128"
19824 },
19825 {
19826 "name": "new_nonce_hash3",
19827 "type": "int128"
19828 }
19829 ],
19830 "type": "Set_client_DH_params_answer"
19831 },
19832 {
19833 "id": "-212046591",
19834 "predicate": "rpc_result",
19835 "params": [
19836 {
19837 "name": "req_msg_id",
19838 "type": "long"
19839 },
19840 {
19841 "name": "result",
19842 "type": "Object"
19843 }
19844 ],
19845 "type": "RpcResult"
19846 },
19847 {
19848 "id": "558156313",
19849 "predicate": "rpc_error",
19850 "params": [
19851 {
19852 "name": "error_code",
19853 "type": "int"
19854 },
19855 {
19856 "name": "error_message",
19857 "type": "string"
19858 }
19859 ],
19860 "type": "RpcError"
19861 },
19862 {
19863 "id": "1579864942",
19864 "predicate": "rpc_answer_unknown",
19865 "params": [],
19866 "type": "RpcDropAnswer"
19867 },
19868 {
19869 "id": "-847714938",
19870 "predicate": "rpc_answer_dropped_running",
19871 "params": [],
19872 "type": "RpcDropAnswer"
19873 },
19874 {
19875 "id": "-1539647305",
19876 "predicate": "rpc_answer_dropped",
19877 "params": [
19878 {
19879 "name": "msg_id",
19880 "type": "long"
19881 },
19882 {
19883 "name": "seq_no",
19884 "type": "int"
19885 },
19886 {
19887 "name": "bytes",
19888 "type": "int"
19889 }
19890 ],
19891 "type": "RpcDropAnswer"
19892 },
19893 {
19894 "id": "155834844",
19895 "predicate": "future_salt",
19896 "params": [
19897 {
19898 "name": "valid_since",
19899 "type": "int"
19900 },
19901 {
19902 "name": "valid_until",
19903 "type": "int"
19904 },
19905 {
19906 "name": "salt",
19907 "type": "long"
19908 }
19909 ],
19910 "type": "FutureSalt"
19911 },
19912 {
19913 "id": "-1370486635",
19914 "predicate": "future_salts",
19915 "params": [
19916 {
19917 "name": "req_msg_id",
19918 "type": "long"
19919 },
19920 {
19921 "name": "now",
19922 "type": "int"
19923 },
19924 {
19925 "name": "salts",
19926 "type": "vector<future_salt>"
19927 }
19928 ],
19929 "type": "FutureSalts"
19930 },
19931 {
19932 "id": "880243653",
19933 "predicate": "pong",
19934 "params": [
19935 {
19936 "name": "msg_id",
19937 "type": "long"
19938 },
19939 {
19940 "name": "ping_id",
19941 "type": "long"
19942 }
19943 ],
19944 "type": "Pong"
19945 },
19946 {
19947 "id": "-501201412",
19948 "predicate": "destroy_session_ok",
19949 "params": [
19950 {
19951 "name": "session_id",
19952 "type": "long"
19953 }
19954 ],
19955 "type": "DestroySessionRes"
19956 },
19957 {
19958 "id": "1658015945",
19959 "predicate": "destroy_session_none",
19960 "params": [
19961 {
19962 "name": "session_id",
19963 "type": "long"
19964 }
19965 ],
19966 "type": "DestroySessionRes"
19967 },
19968 {
19969 "id": "-1631450872",
19970 "predicate": "new_session_created",
19971 "params": [
19972 {
19973 "name": "first_msg_id",
19974 "type": "long"
19975 },
19976 {
19977 "name": "unique_id",
19978 "type": "long"
19979 },
19980 {
19981 "name": "server_salt",
19982 "type": "long"
19983 }
19984 ],
19985 "type": "NewSession"
19986 },
19987 {
19988 "id": "1945237724",
19989 "predicate": "msg_container",
19990 "params": [
19991 {
19992 "name": "messages",
19993 "type": "vector<%Message>"
19994 }
19995 ],
19996 "type": "MessageContainer"
19997 },
19998 {
19999 "id": "1538843921",
20000 "predicate": "message",
20001 "params": [
20002 {
20003 "name": "msg_id",
20004 "type": "long"
20005 },
20006 {
20007 "name": "seqno",
20008 "type": "int"
20009 },
20010 {
20011 "name": "bytes",
20012 "type": "int"
20013 },
20014 {
20015 "name": "body",
20016 "type": "Object"
20017 }
20018 ],
20019 "type": "Message"
20020 },
20021 {
20022 "id": "-530561358",
20023 "predicate": "msg_copy",
20024 "params": [
20025 {
20026 "name": "orig_message",
20027 "type": "Message"
20028 }
20029 ],
20030 "type": "MessageCopy"
20031 },
20032 {
20033 "id": "812830625",
20034 "predicate": "gzip_packed",
20035 "params": [
20036 {
20037 "name": "packed_data",
20038 "type": "bytes"
20039 }
20040 ],
20041 "type": "Object"
20042 },
20043 {
20044 "id": "1658238041",
20045 "predicate": "msgs_ack",
20046 "params": [
20047 {
20048 "name": "msg_ids",
20049 "type": "Vector<long>"
20050 }
20051 ],
20052 "type": "MsgsAck"
20053 },
20054 {
20055 "id": "-1477445615",
20056 "predicate": "bad_msg_notification",
20057 "params": [
20058 {
20059 "name": "bad_msg_id",
20060 "type": "long"
20061 },
20062 {
20063 "name": "bad_msg_seqno",
20064 "type": "int"
20065 },
20066 {
20067 "name": "error_code",
20068 "type": "int"
20069 }
20070 ],
20071 "type": "BadMsgNotification"
20072 },
20073 {
20074 "id": "-307542917",
20075 "predicate": "bad_server_salt",
20076 "params": [
20077 {
20078 "name": "bad_msg_id",
20079 "type": "long"
20080 },
20081 {
20082 "name": "bad_msg_seqno",
20083 "type": "int"
20084 },
20085 {
20086 "name": "error_code",
20087 "type": "int"
20088 },
20089 {
20090 "name": "new_server_salt",
20091 "type": "long"
20092 }
20093 ],
20094 "type": "BadMsgNotification"
20095 },
20096 {
20097 "id": "2105940488",
20098 "predicate": "msg_resend_req",
20099 "params": [
20100 {
20101 "name": "msg_ids",
20102 "type": "Vector<long>"
20103 }
20104 ],
20105 "type": "MsgResendReq"
20106 },
20107 {
20108 "id": "-630588590",
20109 "predicate": "msgs_state_req",
20110 "params": [
20111 {
20112 "name": "msg_ids",
20113 "type": "Vector<long>"
20114 }
20115 ],
20116 "type": "MsgsStateReq"
20117 },
20118 {
20119 "id": "81704317",
20120 "predicate": "msgs_state_info",
20121 "params": [
20122 {
20123 "name": "req_msg_id",
20124 "type": "long"
20125 },
20126 {
20127 "name": "info",
20128 "type": "bytes"
20129 }
20130 ],
20131 "type": "MsgsStateInfo"
20132 },
20133 {
20134 "id": "-1933520591",
20135 "predicate": "msgs_all_info",
20136 "params": [
20137 {
20138 "name": "msg_ids",
20139 "type": "Vector<long>"
20140 },
20141 {
20142 "name": "info",
20143 "type": "bytes"
20144 }
20145 ],
20146 "type": "MsgsAllInfo"
20147 },
20148 {
20149 "id": "661470918",
20150 "predicate": "msg_detailed_info",
20151 "params": [
20152 {
20153 "name": "msg_id",
20154 "type": "long"
20155 },
20156 {
20157 "name": "answer_msg_id",
20158 "type": "long"
20159 },
20160 {
20161 "name": "bytes",
20162 "type": "int"
20163 },
20164 {
20165 "name": "status",
20166 "type": "int"
20167 }
20168 ],
20169 "type": "MsgDetailedInfo"
20170 },
20171 {
20172 "id": "-2137147681",
20173 "predicate": "msg_new_detailed_info",
20174 "params": [
20175 {
20176 "name": "answer_msg_id",
20177 "type": "long"
20178 },
20179 {
20180 "name": "bytes",
20181 "type": "int"
20182 },
20183 {
20184 "name": "status",
20185 "type": "int"
20186 }
20187 ],
20188 "type": "MsgDetailedInfo"
20189 }
20190 ],
20191 "methods": [
20192 {
20193 "id": "1615239032",
20194 "method": "req_pq",
20195 "params": [
20196 {
20197 "name": "nonce",
20198 "type": "int128"
20199 }
20200 ],
20201 "type": "ResPQ"
20202 },
20203 {
20204 "id": "-686627650",
20205 "method": "req_DH_params",
20206 "params": [
20207 {
20208 "name": "nonce",
20209 "type": "int128"
20210 },
20211 {
20212 "name": "server_nonce",
20213 "type": "int128"
20214 },
20215 {
20216 "name": "p",
20217 "type": "bytes"
20218 },
20219 {
20220 "name": "q",
20221 "type": "bytes"
20222 },
20223 {
20224 "name": "public_key_fingerprint",
20225 "type": "long"
20226 },
20227 {
20228 "name": "encrypted_data",
20229 "type": "bytes"
20230 }
20231 ],
20232 "type": "Server_DH_Params"
20233 },
20234 {
20235 "id": "-184262881",
20236 "method": "set_client_DH_params",
20237 "params": [
20238 {
20239 "name": "nonce",
20240 "type": "int128"
20241 },
20242 {
20243 "name": "server_nonce",
20244 "type": "int128"
20245 },
20246 {
20247 "name": "encrypted_data",
20248 "type": "bytes"
20249 }
20250 ],
20251 "type": "Set_client_DH_params_answer"
20252 },
20253 {
20254 "id": "1491380032",
20255 "method": "rpc_drop_answer",
20256 "params": [
20257 {
20258 "name": "req_msg_id",
20259 "type": "long"
20260 }
20261 ],
20262 "type": "RpcDropAnswer"
20263 },
20264 {
20265 "id": "-1188971260",
20266 "method": "get_future_salts",
20267 "params": [
20268 {
20269 "name": "num",
20270 "type": "int"
20271 }
20272 ],
20273 "type": "FutureSalts"
20274 },
20275 {
20276 "id": "2059302892",
20277 "method": "ping",
20278 "params": [
20279 {
20280 "name": "ping_id",
20281 "type": "long"
20282 }
20283 ],
20284 "type": "Pong"
20285 },
20286 {
20287 "id": "-213746804",
20288 "method": "ping_delay_disconnect",
20289 "params": [
20290 {
20291 "name": "ping_id",
20292 "type": "long"
20293 },
20294 {
20295 "name": "disconnect_delay",
20296 "type": "int"
20297 }
20298 ],
20299 "type": "Pong"
20300 },
20301 {
20302 "id": "-414113498",
20303 "method": "destroy_session",
20304 "params": [
20305 {
20306 "name": "session_id",
20307 "type": "long"
20308 }
20309 ],
20310 "type": "DestroySessionRes"
20311 },
20312 {
20313 "id": "-1835453025",
20314 "method": "http_wait",
20315 "params": [
20316 {
20317 "name": "max_delay",
20318 "type": "int"
20319 },
20320 {
20321 "name": "wait_after",
20322 "type": "int"
20323 },
20324 {
20325 "name": "max_wait",
20326 "type": "int"
20327 }
20328 ],
20329 "type": "HttpWait"
20330 }
20331 ]
20332};
20333
20334/***/ }),
20335/* 40 */
20336/***/ (function(module, exports, __webpack_require__) {
20337
20338module.exports = (__webpack_require__(6))(124);
20339
20340/***/ }),
20341/* 41 */
20342/***/ (function(module, exports, __webpack_require__) {
20343
20344module.exports = (__webpack_require__(6))(127);
20345
20346/***/ }),
20347/* 42 */
20348/***/ (function(module, __webpack_exports__, __webpack_require__) {
20349
20350"use strict";
20351Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
20352/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__smart_timeout__ = __webpack_require__(8);
20353/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "smartTimeout", function() { return __WEBPACK_IMPORTED_MODULE_0__smart_timeout__["a"]; });
20354/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__defer__ = __webpack_require__(4);
20355/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "blueDefer", function() { return __WEBPACK_IMPORTED_MODULE_1__defer__["a"]; });
20356/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__crypto__ = __webpack_require__(9);
20357/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "CryptoWorker", function() { return __WEBPACK_IMPORTED_MODULE_2__crypto__["a"]; });
20358/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__bin__ = __webpack_require__(2);
20359/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bin", function() { return __WEBPACK_IMPORTED_MODULE_3__bin__["bin"]; });
20360/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__for_each__ = __webpack_require__(14);
20361/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_4__for_each__["a"]; });
20362/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__service_api_manager_index_js__ = __webpack_require__(12);
20363/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "ApiManager", function() { return __WEBPACK_IMPORTED_MODULE_5__service_api_manager_index_js__["a"]; });
20364/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__store__ = __webpack_require__(11);
20365/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "PureStorage", function() { return __WEBPACK_IMPORTED_MODULE_6__store__["a"]; });
20366/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__service_time_manager__ = __webpack_require__(5);
20367/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "MtpTimeManager", function() { return __WEBPACK_IMPORTED_MODULE_7__service_time_manager__; });
20368/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__service_dc_configurator__ = __webpack_require__(15);
20369/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "MtpDcConfigurator", function() { return __WEBPACK_IMPORTED_MODULE_8__service_dc_configurator__; });
20370/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__service_secure_random__ = __webpack_require__(7);
20371/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MtpSecureRandom", function() { return __WEBPACK_IMPORTED_MODULE_9__service_secure_random__["a"]; });
20372/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__service_networker__ = __webpack_require__(16);
20373/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "MtpNetworker", function() { return __WEBPACK_IMPORTED_MODULE_10__service_networker__; });
20374/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__http__ = __webpack_require__(10);
20375/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "httpClient", function() { return __WEBPACK_IMPORTED_MODULE_11__http__["a"]; });
20376// import 'setimmediate'
20377
20378
20379
20380
20381
20382
20383
20384
20385
20386
20387
20388
20389
20390
20391
20392
20393
20394
20395
20396
20397
20398
20399
20400console.info('source loaded');
20401
20402
20403/* harmony default export */ __webpack_exports__["default"] = __WEBPACK_IMPORTED_MODULE_5__service_api_manager_index_js__["a" /* ApiManager */];
20404
20405/***/ })
20406/******/ ]);
20407});
20408//# sourceMappingURL=mtproto2-browser.js.map
\No newline at end of file