UNPKG

1.49 MBJavaScriptView Raw
1(function webpackUniversalModuleDefinition(root, factory) {
2 if(typeof exports === 'object' && typeof module === 'object')
3 module.exports = factory();
4 else if(typeof define === 'function' && define.amd)
5 define([], factory);
6 else if(typeof exports === 'object')
7 exports["AV"] = factory();
8 else
9 root["AV"] = factory();
10})(typeof self !== 'undefined' ? self : this, function() {
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/******/ // define getter function for harmony exports
47/******/ __webpack_require__.d = function(exports, name, getter) {
48/******/ if(!__webpack_require__.o(exports, name)) {
49/******/ Object.defineProperty(exports, name, {
50/******/ configurable: false,
51/******/ enumerable: true,
52/******/ get: getter
53/******/ });
54/******/ }
55/******/ };
56/******/
57/******/ // getDefaultExport function for compatibility with non-harmony modules
58/******/ __webpack_require__.n = function(module) {
59/******/ var getter = module && module.__esModule ?
60/******/ function getDefault() { return module['default']; } :
61/******/ function getModuleExports() { return module; };
62/******/ __webpack_require__.d(getter, 'a', getter);
63/******/ return getter;
64/******/ };
65/******/
66/******/ // Object.prototype.hasOwnProperty.call
67/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
68/******/
69/******/ // __webpack_public_path__
70/******/ __webpack_require__.p = "";
71/******/
72/******/ // Load entry module and return exports
73/******/ return __webpack_require__(__webpack_require__.s = 283);
74/******/ })
75/************************************************************************/
76/******/ ([
77/* 0 */
78/***/ (function(module, exports, __webpack_require__) {
79
80"use strict";
81
82var global = __webpack_require__(8);
83var apply = __webpack_require__(79);
84var uncurryThis = __webpack_require__(4);
85var isCallable = __webpack_require__(9);
86var getOwnPropertyDescriptor = __webpack_require__(64).f;
87var isForced = __webpack_require__(160);
88var path = __webpack_require__(7);
89var bind = __webpack_require__(52);
90var createNonEnumerableProperty = __webpack_require__(39);
91var hasOwn = __webpack_require__(13);
92
93var wrapConstructor = function (NativeConstructor) {
94 var Wrapper = function (a, b, c) {
95 if (this instanceof Wrapper) {
96 switch (arguments.length) {
97 case 0: return new NativeConstructor();
98 case 1: return new NativeConstructor(a);
99 case 2: return new NativeConstructor(a, b);
100 } return new NativeConstructor(a, b, c);
101 } return apply(NativeConstructor, this, arguments);
102 };
103 Wrapper.prototype = NativeConstructor.prototype;
104 return Wrapper;
105};
106
107/*
108 options.target - name of the target object
109 options.global - target is the global object
110 options.stat - export as static methods of target
111 options.proto - export as prototype methods of target
112 options.real - real prototype method for the `pure` version
113 options.forced - export even if the native feature is available
114 options.bind - bind methods to the target, required for the `pure` version
115 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
116 options.unsafe - use the simple assignment of property instead of delete + defineProperty
117 options.sham - add a flag to not completely full polyfills
118 options.enumerable - export as enumerable property
119 options.dontCallGetSet - prevent calling a getter on target
120 options.name - the .name of the function if it does not match the key
121*/
122module.exports = function (options, source) {
123 var TARGET = options.target;
124 var GLOBAL = options.global;
125 var STATIC = options.stat;
126 var PROTO = options.proto;
127
128 var nativeSource = GLOBAL ? global : STATIC ? global[TARGET] : (global[TARGET] || {}).prototype;
129
130 var target = GLOBAL ? path : path[TARGET] || createNonEnumerableProperty(path, TARGET, {})[TARGET];
131 var targetPrototype = target.prototype;
132
133 var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
134 var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;
135
136 for (key in source) {
137 FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
138 // contains in native
139 USE_NATIVE = !FORCED && nativeSource && hasOwn(nativeSource, key);
140
141 targetProperty = target[key];
142
143 if (USE_NATIVE) if (options.dontCallGetSet) {
144 descriptor = getOwnPropertyDescriptor(nativeSource, key);
145 nativeProperty = descriptor && descriptor.value;
146 } else nativeProperty = nativeSource[key];
147
148 // export native or implementation
149 sourceProperty = (USE_NATIVE && nativeProperty) ? nativeProperty : source[key];
150
151 if (USE_NATIVE && typeof targetProperty == typeof sourceProperty) continue;
152
153 // bind timers to global for call from export context
154 if (options.bind && USE_NATIVE) resultProperty = bind(sourceProperty, global);
155 // wrap global constructors for prevent changs in this version
156 else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty);
157 // make static versions for prototype methods
158 else if (PROTO && isCallable(sourceProperty)) resultProperty = uncurryThis(sourceProperty);
159 // default case
160 else resultProperty = sourceProperty;
161
162 // add a flag to not completely full polyfills
163 if (options.sham || (sourceProperty && sourceProperty.sham) || (targetProperty && targetProperty.sham)) {
164 createNonEnumerableProperty(resultProperty, 'sham', true);
165 }
166
167 createNonEnumerableProperty(target, key, resultProperty);
168
169 if (PROTO) {
170 VIRTUAL_PROTOTYPE = TARGET + 'Prototype';
171 if (!hasOwn(path, VIRTUAL_PROTOTYPE)) {
172 createNonEnumerableProperty(path, VIRTUAL_PROTOTYPE, {});
173 }
174 // export virtual prototype methods
175 createNonEnumerableProperty(path[VIRTUAL_PROTOTYPE], key, sourceProperty);
176 // export real prototype methods
177 if (options.real && targetPrototype && !targetPrototype[key]) {
178 createNonEnumerableProperty(targetPrototype, key, sourceProperty);
179 }
180 }
181 }
182};
183
184
185/***/ }),
186/* 1 */
187/***/ (function(module, exports) {
188
189function _interopRequireDefault(obj) {
190 return obj && obj.__esModule ? obj : {
191 "default": obj
192 };
193}
194
195module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
196
197/***/ }),
198/* 2 */
199/***/ (function(module, exports) {
200
201module.exports = function (exec) {
202 try {
203 return !!exec();
204 } catch (error) {
205 return true;
206 }
207};
208
209
210/***/ }),
211/* 3 */
212/***/ (function(module, __webpack_exports__, __webpack_require__) {
213
214"use strict";
215Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
216/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_default_js__ = __webpack_require__(323);
217/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_0__index_default_js__["a"]; });
218/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__index_js__ = __webpack_require__(135);
219/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["VERSION"]; });
220/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "restArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["restArguments"]; });
221/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isObject"]; });
222/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isNull"]; });
223/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isUndefined"]; });
224/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isBoolean", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isBoolean"]; });
225/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isElement", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isElement"]; });
226/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isString"]; });
227/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isNumber"]; });
228/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isDate"]; });
229/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isRegExp"]; });
230/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isError", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isError"]; });
231/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isSymbol", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isSymbol"]; });
232/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isArrayBuffer"]; });
233/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isDataView", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isDataView"]; });
234/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isArray"]; });
235/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isFunction"]; });
236/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isArguments"]; });
237/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isFinite", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isFinite"]; });
238/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isNaN", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isNaN"]; });
239/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isTypedArray"]; });
240/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isEmpty"]; });
241/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isMatch", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isMatch"]; });
242/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isEqual"]; });
243/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isMap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isMap"]; });
244/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isWeakMap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isWeakMap"]; });
245/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isSet", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isSet"]; });
246/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isWeakSet", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isWeakSet"]; });
247/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["keys"]; });
248/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "allKeys", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["allKeys"]; });
249/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "values", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["values"]; });
250/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["pairs"]; });
251/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["invert"]; });
252/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "functions", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["functions"]; });
253/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "methods", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["methods"]; });
254/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["extend"]; });
255/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "extendOwn", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["extendOwn"]; });
256/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["assign"]; });
257/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["defaults"]; });
258/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "create", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["create"]; });
259/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["clone"]; });
260/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["tap"]; });
261/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "get", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["get"]; });
262/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "has", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["has"]; });
263/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "mapObject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["mapObject"]; });
264/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["identity"]; });
265/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "constant", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["constant"]; });
266/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["noop"]; });
267/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "toPath", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["toPath"]; });
268/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "property", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["property"]; });
269/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "propertyOf", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["propertyOf"]; });
270/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "matcher", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["matcher"]; });
271/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["matches"]; });
272/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "times", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["times"]; });
273/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "random", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["random"]; });
274/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "now", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["now"]; });
275/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "escape", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["escape"]; });
276/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "unescape", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["unescape"]; });
277/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "templateSettings", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["templateSettings"]; });
278/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "template", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["template"]; });
279/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "result", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["result"]; });
280/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "uniqueId", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["uniqueId"]; });
281/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "chain", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["chain"]; });
282/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "iteratee", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["iteratee"]; });
283/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "partial", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["partial"]; });
284/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["bind"]; });
285/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "bindAll", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["bindAll"]; });
286/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "memoize", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["memoize"]; });
287/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["delay"]; });
288/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["defer"]; });
289/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["throttle"]; });
290/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["debounce"]; });
291/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "wrap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["wrap"]; });
292/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["negate"]; });
293/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["compose"]; });
294/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "after", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["after"]; });
295/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "before", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["before"]; });
296/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "once", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["once"]; });
297/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findKey", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findKey"]; });
298/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findIndex"]; });
299/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findLastIndex"]; });
300/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "sortedIndex", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["sortedIndex"]; });
301/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["indexOf"]; });
302/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["lastIndexOf"]; });
303/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "find", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["find"]; });
304/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "detect", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["detect"]; });
305/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findWhere", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findWhere"]; });
306/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "each", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["each"]; });
307/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["forEach"]; });
308/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "map", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["map"]; });
309/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "collect", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["collect"]; });
310/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["reduce"]; });
311/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "foldl", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["foldl"]; });
312/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["inject"]; });
313/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "reduceRight", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["reduceRight"]; });
314/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "foldr", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["foldr"]; });
315/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["filter"]; });
316/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["select"]; });
317/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["reject"]; });
318/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "every", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["every"]; });
319/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "all", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["all"]; });
320/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "some", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["some"]; });
321/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "any", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["any"]; });
322/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["contains"]; });
323/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["includes"]; });
324/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "include", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["include"]; });
325/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "invoke", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["invoke"]; });
326/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["pluck"]; });
327/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "where", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["where"]; });
328/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "max", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["max"]; });
329/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "min", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["min"]; });
330/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "shuffle", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["shuffle"]; });
331/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["sample"]; });
332/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["sortBy"]; });
333/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["groupBy"]; });
334/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "indexBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["indexBy"]; });
335/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "countBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["countBy"]; });
336/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["partition"]; });
337/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["toArray"]; });
338/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "size", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["size"]; });
339/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["pick"]; });
340/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "omit", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["omit"]; });
341/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "first", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["first"]; });
342/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "head", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["head"]; });
343/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "take", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["take"]; });
344/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "initial", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["initial"]; });
345/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "last", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["last"]; });
346/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "rest", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["rest"]; });
347/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "tail", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["tail"]; });
348/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "drop", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["drop"]; });
349/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "compact", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["compact"]; });
350/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["flatten"]; });
351/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "without", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["without"]; });
352/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["uniq"]; });
353/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["unique"]; });
354/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "union", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["union"]; });
355/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["intersection"]; });
356/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["difference"]; });
357/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "unzip", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["unzip"]; });
358/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["transpose"]; });
359/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["zip"]; });
360/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "object", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["object"]; });
361/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["range"]; });
362/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "chunk", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["chunk"]; });
363/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "mixin", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["mixin"]; });
364// ESM Exports
365// ===========
366// This module is the package entry point for ES module users. In other words,
367// it is the module they are interfacing with when they import from the whole
368// package instead of from a submodule, like this:
369//
370// ```js
371// import { map } from 'underscore';
372// ```
373//
374// The difference with `./index-default`, which is the package entry point for
375// CommonJS, AMD and UMD users, is purely technical. In ES modules, named and
376// default exports are considered to be siblings, so when you have a default
377// export, its properties are not automatically available as named exports. For
378// this reason, we re-export the named exports in addition to providing the same
379// default export as in `./index-default`.
380
381
382
383
384/***/ }),
385/* 4 */
386/***/ (function(module, exports, __webpack_require__) {
387
388var NATIVE_BIND = __webpack_require__(80);
389
390var FunctionPrototype = Function.prototype;
391var bind = FunctionPrototype.bind;
392var call = FunctionPrototype.call;
393var uncurryThis = NATIVE_BIND && bind.bind(call, call);
394
395module.exports = NATIVE_BIND ? function (fn) {
396 return fn && uncurryThis(fn);
397} : function (fn) {
398 return fn && function () {
399 return call.apply(fn, arguments);
400 };
401};
402
403
404/***/ }),
405/* 5 */
406/***/ (function(module, exports, __webpack_require__) {
407
408var global = __webpack_require__(8);
409var shared = __webpack_require__(82);
410var hasOwn = __webpack_require__(13);
411var uid = __webpack_require__(101);
412var NATIVE_SYMBOL = __webpack_require__(65);
413var USE_SYMBOL_AS_UID = __webpack_require__(158);
414
415var WellKnownSymbolsStore = shared('wks');
416var Symbol = global.Symbol;
417var symbolFor = Symbol && Symbol['for'];
418var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
419
420module.exports = function (name) {
421 if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
422 var description = 'Symbol.' + name;
423 if (NATIVE_SYMBOL && hasOwn(Symbol, name)) {
424 WellKnownSymbolsStore[name] = Symbol[name];
425 } else if (USE_SYMBOL_AS_UID && symbolFor) {
426 WellKnownSymbolsStore[name] = symbolFor(description);
427 } else {
428 WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
429 }
430 } return WellKnownSymbolsStore[name];
431};
432
433
434/***/ }),
435/* 6 */
436/***/ (function(module, __webpack_exports__, __webpack_require__) {
437
438"use strict";
439/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return VERSION; });
440/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return root; });
441/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ArrayProto; });
442/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ObjProto; });
443/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return SymbolProto; });
444/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return push; });
445/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return slice; });
446/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return toString; });
447/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return hasOwnProperty; });
448/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return supportsArrayBuffer; });
449/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return supportsDataView; });
450/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return nativeIsArray; });
451/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return nativeKeys; });
452/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return nativeCreate; });
453/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return nativeIsView; });
454/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return _isNaN; });
455/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return _isFinite; });
456/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return hasEnumBug; });
457/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return nonEnumerableProps; });
458/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return MAX_ARRAY_INDEX; });
459// Current version.
460var VERSION = '1.12.1';
461
462// Establish the root object, `window` (`self`) in the browser, `global`
463// on the server, or `this` in some virtual machines. We use `self`
464// instead of `window` for `WebWorker` support.
465var root = typeof self == 'object' && self.self === self && self ||
466 typeof global == 'object' && global.global === global && global ||
467 Function('return this')() ||
468 {};
469
470// Save bytes in the minified (but not gzipped) version:
471var ArrayProto = Array.prototype, ObjProto = Object.prototype;
472var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null;
473
474// Create quick reference variables for speed access to core prototypes.
475var push = ArrayProto.push,
476 slice = ArrayProto.slice,
477 toString = ObjProto.toString,
478 hasOwnProperty = ObjProto.hasOwnProperty;
479
480// Modern feature detection.
481var supportsArrayBuffer = typeof ArrayBuffer !== 'undefined',
482 supportsDataView = typeof DataView !== 'undefined';
483
484// All **ECMAScript 5+** native function implementations that we hope to use
485// are declared here.
486var nativeIsArray = Array.isArray,
487 nativeKeys = Object.keys,
488 nativeCreate = Object.create,
489 nativeIsView = supportsArrayBuffer && ArrayBuffer.isView;
490
491// Create references to these builtin functions because we override them.
492var _isNaN = isNaN,
493 _isFinite = isFinite;
494
495// Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
496var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');
497var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',
498 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];
499
500// The largest integer that can be represented exactly.
501var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
502
503/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(78)))
504
505/***/ }),
506/* 7 */
507/***/ (function(module, exports) {
508
509module.exports = {};
510
511
512/***/ }),
513/* 8 */
514/***/ (function(module, exports, __webpack_require__) {
515
516/* WEBPACK VAR INJECTION */(function(global) {var check = function (it) {
517 return it && it.Math == Math && it;
518};
519
520// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
521module.exports =
522 // eslint-disable-next-line es-x/no-global-this -- safe
523 check(typeof globalThis == 'object' && globalThis) ||
524 check(typeof window == 'object' && window) ||
525 // eslint-disable-next-line no-restricted-globals -- safe
526 check(typeof self == 'object' && self) ||
527 check(typeof global == 'object' && global) ||
528 // eslint-disable-next-line no-new-func -- fallback
529 (function () { return this; })() || Function('return this')();
530
531/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(78)))
532
533/***/ }),
534/* 9 */
535/***/ (function(module, exports) {
536
537// `IsCallable` abstract operation
538// https://tc39.es/ecma262/#sec-iscallable
539module.exports = function (argument) {
540 return typeof argument == 'function';
541};
542
543
544/***/ }),
545/* 10 */
546/***/ (function(module, exports, __webpack_require__) {
547
548var path = __webpack_require__(7);
549var hasOwn = __webpack_require__(13);
550var wrappedWellKnownSymbolModule = __webpack_require__(152);
551var defineProperty = __webpack_require__(23).f;
552
553module.exports = function (NAME) {
554 var Symbol = path.Symbol || (path.Symbol = {});
555 if (!hasOwn(Symbol, NAME)) defineProperty(Symbol, NAME, {
556 value: wrappedWellKnownSymbolModule.f(NAME)
557 });
558};
559
560
561/***/ }),
562/* 11 */
563/***/ (function(module, exports, __webpack_require__) {
564
565var isCallable = __webpack_require__(9);
566
567module.exports = function (it) {
568 return typeof it == 'object' ? it !== null : isCallable(it);
569};
570
571
572/***/ }),
573/* 12 */
574/***/ (function(module, exports, __webpack_require__) {
575
576module.exports = __webpack_require__(287);
577
578/***/ }),
579/* 13 */
580/***/ (function(module, exports, __webpack_require__) {
581
582var uncurryThis = __webpack_require__(4);
583var toObject = __webpack_require__(33);
584
585var hasOwnProperty = uncurryThis({}.hasOwnProperty);
586
587// `HasOwnProperty` abstract operation
588// https://tc39.es/ecma262/#sec-hasownproperty
589// eslint-disable-next-line es-x/no-object-hasown -- safe
590module.exports = Object.hasOwn || function hasOwn(it, key) {
591 return hasOwnProperty(toObject(it), key);
592};
593
594
595/***/ }),
596/* 14 */
597/***/ (function(module, exports, __webpack_require__) {
598
599var fails = __webpack_require__(2);
600
601// Detect IE8's incomplete defineProperty implementation
602module.exports = !fails(function () {
603 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
604 return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
605});
606
607
608/***/ }),
609/* 15 */
610/***/ (function(module, exports, __webpack_require__) {
611
612var NATIVE_BIND = __webpack_require__(80);
613
614var call = Function.prototype.call;
615
616module.exports = NATIVE_BIND ? call.bind(call) : function () {
617 return call.apply(call, arguments);
618};
619
620
621/***/ }),
622/* 16 */
623/***/ (function(module, exports, __webpack_require__) {
624
625var uncurryThis = __webpack_require__(4);
626
627module.exports = uncurryThis({}.isPrototypeOf);
628
629
630/***/ }),
631/* 17 */
632/***/ (function(module, __webpack_exports__, __webpack_require__) {
633
634"use strict";
635/* harmony export (immutable) */ __webpack_exports__["a"] = keys;
636/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(58);
637/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
638/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(47);
639/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__collectNonEnumProps_js__ = __webpack_require__(190);
640
641
642
643
644
645// Retrieve the names of an object's own properties.
646// Delegates to **ECMAScript 5**'s native `Object.keys`.
647function keys(obj) {
648 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return [];
649 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["m" /* nativeKeys */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["m" /* nativeKeys */])(obj);
650 var keys = [];
651 for (var key in obj) if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, key)) keys.push(key);
652 // Ahem, IE < 9.
653 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_3__collectNonEnumProps_js__["a" /* default */])(obj, keys);
654 return keys;
655}
656
657
658/***/ }),
659/* 18 */
660/***/ (function(module, __webpack_exports__, __webpack_require__) {
661
662"use strict";
663/* harmony export (immutable) */ __webpack_exports__["a"] = tagTester;
664/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
665
666
667// Internal function for creating a `toString`-based type tester.
668function tagTester(name) {
669 var tag = '[object ' + name + ']';
670 return function(obj) {
671 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === tag;
672 };
673}
674
675
676/***/ }),
677/* 19 */
678/***/ (function(module, exports, __webpack_require__) {
679
680module.exports = __webpack_require__(395);
681
682/***/ }),
683/* 20 */
684/***/ (function(module, exports, __webpack_require__) {
685
686var path = __webpack_require__(7);
687var global = __webpack_require__(8);
688var isCallable = __webpack_require__(9);
689
690var aFunction = function (variable) {
691 return isCallable(variable) ? variable : undefined;
692};
693
694module.exports = function (namespace, method) {
695 return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])
696 : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];
697};
698
699
700/***/ }),
701/* 21 */
702/***/ (function(module, exports, __webpack_require__) {
703
704var isObject = __webpack_require__(11);
705
706var $String = String;
707var $TypeError = TypeError;
708
709// `Assert: Type(argument) is Object`
710module.exports = function (argument) {
711 if (isObject(argument)) return argument;
712 throw $TypeError($String(argument) + ' is not an object');
713};
714
715
716/***/ }),
717/* 22 */
718/***/ (function(module, __webpack_exports__, __webpack_require__) {
719
720"use strict";
721/* harmony export (immutable) */ __webpack_exports__["a"] = cb;
722/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
723/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(200);
724/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__iteratee_js__ = __webpack_require__(201);
725
726
727
728
729// The function we call internally to generate a callback. It invokes
730// `_.iteratee` if overridden, otherwise `baseIteratee`.
731function cb(value, context, argCount) {
732 if (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].iteratee !== __WEBPACK_IMPORTED_MODULE_2__iteratee_js__["a" /* default */]) return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].iteratee(value, context);
733 return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, argCount);
734}
735
736
737/***/ }),
738/* 23 */
739/***/ (function(module, exports, __webpack_require__) {
740
741var DESCRIPTORS = __webpack_require__(14);
742var IE8_DOM_DEFINE = __webpack_require__(159);
743var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(161);
744var anObject = __webpack_require__(21);
745var toPropertyKey = __webpack_require__(99);
746
747var $TypeError = TypeError;
748// eslint-disable-next-line es-x/no-object-defineproperty -- safe
749var $defineProperty = Object.defineProperty;
750// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
751var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
752var ENUMERABLE = 'enumerable';
753var CONFIGURABLE = 'configurable';
754var WRITABLE = 'writable';
755
756// `Object.defineProperty` method
757// https://tc39.es/ecma262/#sec-object.defineproperty
758exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
759 anObject(O);
760 P = toPropertyKey(P);
761 anObject(Attributes);
762 if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
763 var current = $getOwnPropertyDescriptor(O, P);
764 if (current && current[WRITABLE]) {
765 O[P] = Attributes.value;
766 Attributes = {
767 configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
768 enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
769 writable: false
770 };
771 }
772 } return $defineProperty(O, P, Attributes);
773} : $defineProperty : function defineProperty(O, P, Attributes) {
774 anObject(O);
775 P = toPropertyKey(P);
776 anObject(Attributes);
777 if (IE8_DOM_DEFINE) try {
778 return $defineProperty(O, P, Attributes);
779 } catch (error) { /* empty */ }
780 if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');
781 if ('value' in Attributes) O[P] = Attributes.value;
782 return O;
783};
784
785
786/***/ }),
787/* 24 */
788/***/ (function(module, __webpack_exports__, __webpack_require__) {
789
790"use strict";
791/* harmony export (immutable) */ __webpack_exports__["a"] = restArguments;
792// Some functions take a variable number of arguments, or a few expected
793// arguments at the beginning and then a variable number of values to operate
794// on. This helper accumulates all remaining arguments past the function’s
795// argument length (or an explicit `startIndex`), into an array that becomes
796// the last argument. Similar to ES6’s "rest parameter".
797function restArguments(func, startIndex) {
798 startIndex = startIndex == null ? func.length - 1 : +startIndex;
799 return function() {
800 var length = Math.max(arguments.length - startIndex, 0),
801 rest = Array(length),
802 index = 0;
803 for (; index < length; index++) {
804 rest[index] = arguments[index + startIndex];
805 }
806 switch (startIndex) {
807 case 0: return func.call(this, rest);
808 case 1: return func.call(this, arguments[0], rest);
809 case 2: return func.call(this, arguments[0], arguments[1], rest);
810 }
811 var args = Array(startIndex + 1);
812 for (index = 0; index < startIndex; index++) {
813 args[index] = arguments[index];
814 }
815 args[startIndex] = rest;
816 return func.apply(this, args);
817 };
818}
819
820
821/***/ }),
822/* 25 */
823/***/ (function(module, __webpack_exports__, __webpack_require__) {
824
825"use strict";
826/* harmony export (immutable) */ __webpack_exports__["a"] = _;
827/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
828
829
830// If Underscore is called as a function, it returns a wrapped object that can
831// be used OO-style. This wrapper holds altered versions of all functions added
832// through `_.mixin`. Wrapped objects may be chained.
833function _(obj) {
834 if (obj instanceof _) return obj;
835 if (!(this instanceof _)) return new _(obj);
836 this._wrapped = obj;
837}
838
839_.VERSION = __WEBPACK_IMPORTED_MODULE_0__setup_js__["e" /* VERSION */];
840
841// Extracts the result from a wrapped and chained object.
842_.prototype.value = function() {
843 return this._wrapped;
844};
845
846// Provide unwrapping proxies for some methods used in engine operations
847// such as arithmetic and JSON stringification.
848_.prototype.valueOf = _.prototype.toJSON = _.prototype.value;
849
850_.prototype.toString = function() {
851 return String(this._wrapped);
852};
853
854
855/***/ }),
856/* 26 */
857/***/ (function(module, __webpack_exports__, __webpack_require__) {
858
859"use strict";
860/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(188);
861/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(31);
862
863
864
865// Internal helper for collection methods to determine whether a collection
866// should be iterated as an array or as an object.
867// Related: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
868// Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094
869/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */]));
870
871
872/***/ }),
873/* 27 */
874/***/ (function(module, exports, __webpack_require__) {
875
876var path = __webpack_require__(7);
877
878module.exports = function (CONSTRUCTOR) {
879 return path[CONSTRUCTOR + 'Prototype'];
880};
881
882
883/***/ }),
884/* 28 */
885/***/ (function(module, exports, __webpack_require__) {
886
887"use strict";
888
889
890var _interopRequireDefault = __webpack_require__(1);
891
892var _concat = _interopRequireDefault(__webpack_require__(19));
893
894var _promise = _interopRequireDefault(__webpack_require__(12));
895
896var _ = __webpack_require__(3);
897
898var md5 = __webpack_require__(531);
899
900var _require = __webpack_require__(3),
901 extend = _require.extend;
902
903var AV = __webpack_require__(74);
904
905var AVError = __webpack_require__(48);
906
907var _require2 = __webpack_require__(32),
908 getSessionToken = _require2.getSessionToken;
909
910var ajax = __webpack_require__(117); // 计算 X-LC-Sign 的签名方法
911
912
913var sign = function sign(key, isMasterKey) {
914 var _context2;
915
916 var now = new Date().getTime();
917 var signature = md5(now + key);
918
919 if (isMasterKey) {
920 var _context;
921
922 return (0, _concat.default)(_context = "".concat(signature, ",")).call(_context, now, ",master");
923 }
924
925 return (0, _concat.default)(_context2 = "".concat(signature, ",")).call(_context2, now);
926};
927
928var setAppKey = function setAppKey(headers, signKey) {
929 if (signKey) {
930 headers['X-LC-Sign'] = sign(AV.applicationKey);
931 } else {
932 headers['X-LC-Key'] = AV.applicationKey;
933 }
934};
935
936var setHeaders = function setHeaders() {
937 var authOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
938 var signKey = arguments.length > 1 ? arguments[1] : undefined;
939 var headers = {
940 'X-LC-Id': AV.applicationId,
941 'Content-Type': 'application/json;charset=UTF-8'
942 };
943 var useMasterKey = false;
944
945 if (typeof authOptions.useMasterKey === 'boolean') {
946 useMasterKey = authOptions.useMasterKey;
947 } else if (typeof AV._config.useMasterKey === 'boolean') {
948 useMasterKey = AV._config.useMasterKey;
949 }
950
951 if (useMasterKey) {
952 if (AV.masterKey) {
953 if (signKey) {
954 headers['X-LC-Sign'] = sign(AV.masterKey, true);
955 } else {
956 headers['X-LC-Key'] = "".concat(AV.masterKey, ",master");
957 }
958 } else {
959 console.warn('masterKey is not set, fall back to use appKey');
960 setAppKey(headers, signKey);
961 }
962 } else {
963 setAppKey(headers, signKey);
964 }
965
966 if (AV.hookKey) {
967 headers['X-LC-Hook-Key'] = AV.hookKey;
968 }
969
970 if (AV._config.production !== null) {
971 headers['X-LC-Prod'] = String(AV._config.production);
972 }
973
974 headers[ false ? 'User-Agent' : 'X-LC-UA'] = AV._sharedConfig.userAgent;
975 return _promise.default.resolve().then(function () {
976 // Pass the session token
977 var sessionToken = getSessionToken(authOptions);
978
979 if (sessionToken) {
980 headers['X-LC-Session'] = sessionToken;
981 } else if (!AV._config.disableCurrentUser) {
982 return AV.User.currentAsync().then(function (currentUser) {
983 if (currentUser && currentUser._sessionToken) {
984 headers['X-LC-Session'] = currentUser._sessionToken;
985 }
986
987 return headers;
988 });
989 }
990
991 return headers;
992 });
993};
994
995var createApiUrl = function createApiUrl(_ref) {
996 var _ref$service = _ref.service,
997 service = _ref$service === void 0 ? 'api' : _ref$service,
998 _ref$version = _ref.version,
999 version = _ref$version === void 0 ? '1.1' : _ref$version,
1000 path = _ref.path;
1001 var apiURL = AV._config.serverURLs[service];
1002 if (!apiURL) throw new Error("undefined server URL for ".concat(service));
1003
1004 if (apiURL.charAt(apiURL.length - 1) !== '/') {
1005 apiURL += '/';
1006 }
1007
1008 apiURL += version;
1009
1010 if (path) {
1011 apiURL += path;
1012 }
1013
1014 return apiURL;
1015};
1016/**
1017 * Low level REST API client. Call REST endpoints with authorization headers.
1018 * @function AV.request
1019 * @since 3.0.0
1020 * @param {Object} options
1021 * @param {String} options.method HTTP method
1022 * @param {String} options.path endpoint path, e.g. `/classes/Test/55759577e4b029ae6015ac20`
1023 * @param {Object} [options.query] query string dict
1024 * @param {Object} [options.data] HTTP body
1025 * @param {AuthOptions} [options.authOptions]
1026 * @param {String} [options.service = 'api']
1027 * @param {String} [options.version = '1.1']
1028 */
1029
1030
1031var request = function request(_ref2) {
1032 var service = _ref2.service,
1033 version = _ref2.version,
1034 method = _ref2.method,
1035 path = _ref2.path,
1036 query = _ref2.query,
1037 data = _ref2.data,
1038 authOptions = _ref2.authOptions,
1039 _ref2$signKey = _ref2.signKey,
1040 signKey = _ref2$signKey === void 0 ? true : _ref2$signKey;
1041
1042 if (!(AV.applicationId && (AV.applicationKey || AV.masterKey))) {
1043 throw new Error('Not initialized');
1044 }
1045
1046 if (AV._appRouter) {
1047 AV._appRouter.refresh();
1048 }
1049
1050 var timeout = AV._config.requestTimeout;
1051 var url = createApiUrl({
1052 service: service,
1053 path: path,
1054 version: version
1055 });
1056 return setHeaders(authOptions, signKey).then(function (headers) {
1057 return ajax({
1058 method: method,
1059 url: url,
1060 query: query,
1061 data: data,
1062 headers: headers,
1063 timeout: timeout
1064 }).catch(function (error) {
1065 var errorJSON = {
1066 code: error.code || -1,
1067 error: error.message || error.responseText
1068 };
1069
1070 if (error.response && error.response.code) {
1071 errorJSON = error.response;
1072 } else if (error.responseText) {
1073 try {
1074 errorJSON = JSON.parse(error.responseText);
1075 } catch (e) {// If we fail to parse the error text, that's okay.
1076 }
1077 }
1078
1079 errorJSON.rawMessage = errorJSON.rawMessage || errorJSON.error;
1080
1081 if (!AV._sharedConfig.keepErrorRawMessage) {
1082 var _context3, _context4;
1083
1084 errorJSON.error += (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = " [".concat(error.statusCode || 'N/A', " ")).call(_context4, method, " ")).call(_context3, url, "]");
1085 } // Transform the error into an instance of AVError by trying to parse
1086 // the error string as JSON.
1087
1088
1089 var err = new AVError(errorJSON.code, errorJSON.error);
1090 delete errorJSON.error;
1091 throw _.extend(err, errorJSON);
1092 });
1093 });
1094}; // lagecy request
1095
1096
1097var _request = function _request(route, className, objectId, method, data, authOptions, query) {
1098 var path = '';
1099 if (route) path += "/".concat(route);
1100 if (className) path += "/".concat(className);
1101 if (objectId) path += "/".concat(objectId); // for migeration
1102
1103 if (data && data._fetchWhenSave) throw new Error('_fetchWhenSave should be in the query');
1104 if (data && data._where) throw new Error('_where should be in the query');
1105
1106 if (method && method.toLowerCase() === 'get') {
1107 query = extend({}, query, data);
1108 data = null;
1109 }
1110
1111 return request({
1112 method: method,
1113 path: path,
1114 query: query,
1115 data: data,
1116 authOptions: authOptions
1117 });
1118};
1119
1120AV.request = request;
1121module.exports = {
1122 _request: _request,
1123 request: request
1124};
1125
1126/***/ }),
1127/* 29 */
1128/***/ (function(module, exports, __webpack_require__) {
1129
1130var isCallable = __webpack_require__(9);
1131var tryToString = __webpack_require__(67);
1132
1133var $TypeError = TypeError;
1134
1135// `Assert: IsCallable(argument) is true`
1136module.exports = function (argument) {
1137 if (isCallable(argument)) return argument;
1138 throw $TypeError(tryToString(argument) + ' is not a function');
1139};
1140
1141
1142/***/ }),
1143/* 30 */
1144/***/ (function(module, __webpack_exports__, __webpack_require__) {
1145
1146"use strict";
1147/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
1148/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
1149
1150
1151
1152var isFunction = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Function');
1153
1154// Optimize `isFunction` if appropriate. Work around some `typeof` bugs in old
1155// v8, IE 11 (#1621), Safari 8 (#1929), and PhantomJS (#2236).
1156var nodelist = __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document && __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document.childNodes;
1157if (typeof /./ != 'function' && typeof Int8Array != 'object' && typeof nodelist != 'function') {
1158 isFunction = function(obj) {
1159 return typeof obj == 'function' || false;
1160 };
1161}
1162
1163/* harmony default export */ __webpack_exports__["a"] = (isFunction);
1164
1165
1166/***/ }),
1167/* 31 */
1168/***/ (function(module, __webpack_exports__, __webpack_require__) {
1169
1170"use strict";
1171/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(189);
1172
1173
1174// Internal helper to obtain the `length` property of an object.
1175/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('length'));
1176
1177
1178/***/ }),
1179/* 32 */
1180/***/ (function(module, exports, __webpack_require__) {
1181
1182"use strict";
1183
1184
1185var _interopRequireDefault = __webpack_require__(1);
1186
1187var _keys = _interopRequireDefault(__webpack_require__(62));
1188
1189var _getPrototypeOf = _interopRequireDefault(__webpack_require__(232));
1190
1191var _promise = _interopRequireDefault(__webpack_require__(12));
1192
1193var _ = __webpack_require__(3); // Helper function to check null or undefined.
1194
1195
1196var isNullOrUndefined = function isNullOrUndefined(x) {
1197 return _.isNull(x) || _.isUndefined(x);
1198};
1199
1200var ensureArray = function ensureArray(target) {
1201 if (_.isArray(target)) {
1202 return target;
1203 }
1204
1205 if (target === undefined || target === null) {
1206 return [];
1207 }
1208
1209 return [target];
1210};
1211
1212var transformFetchOptions = function transformFetchOptions() {
1213 var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1214 keys = (0, _keys.default)(_ref),
1215 include = _ref.include,
1216 includeACL = _ref.includeACL;
1217
1218 var fetchOptions = {};
1219
1220 if (keys) {
1221 fetchOptions.keys = ensureArray(keys).join(',');
1222 }
1223
1224 if (include) {
1225 fetchOptions.include = ensureArray(include).join(',');
1226 }
1227
1228 if (includeACL) {
1229 fetchOptions.returnACL = includeACL;
1230 }
1231
1232 return fetchOptions;
1233};
1234
1235var getSessionToken = function getSessionToken(authOptions) {
1236 if (authOptions.sessionToken) {
1237 return authOptions.sessionToken;
1238 }
1239
1240 if (authOptions.user && typeof authOptions.user.getSessionToken === 'function') {
1241 return authOptions.user.getSessionToken();
1242 }
1243};
1244
1245var tap = function tap(interceptor) {
1246 return function (value) {
1247 return interceptor(value), value;
1248 };
1249}; // Shared empty constructor function to aid in prototype-chain creation.
1250
1251
1252var EmptyConstructor = function EmptyConstructor() {}; // Helper function to correctly set up the prototype chain, for subclasses.
1253// Similar to `goog.inherits`, but uses a hash of prototype properties and
1254// class properties to be extended.
1255
1256
1257var inherits = function inherits(parent, protoProps, staticProps) {
1258 var child; // The constructor function for the new subclass is either defined by you
1259 // (the "constructor" property in your `extend` definition), or defaulted
1260 // by us to simply call the parent's constructor.
1261
1262 if (protoProps && protoProps.hasOwnProperty('constructor')) {
1263 child = protoProps.constructor;
1264 } else {
1265 /** @ignore */
1266 child = function child() {
1267 parent.apply(this, arguments);
1268 };
1269 } // Inherit class (static) properties from parent.
1270
1271
1272 _.extend(child, parent); // Set the prototype chain to inherit from `parent`, without calling
1273 // `parent`'s constructor function.
1274
1275
1276 EmptyConstructor.prototype = parent.prototype;
1277 child.prototype = new EmptyConstructor(); // Add prototype properties (instance properties) to the subclass,
1278 // if supplied.
1279
1280 if (protoProps) {
1281 _.extend(child.prototype, protoProps);
1282 } // Add static properties to the constructor function, if supplied.
1283
1284
1285 if (staticProps) {
1286 _.extend(child, staticProps);
1287 } // Correctly set child's `prototype.constructor`.
1288
1289
1290 child.prototype.constructor = child; // Set a convenience property in case the parent's prototype is
1291 // needed later.
1292
1293 child.__super__ = parent.prototype;
1294 return child;
1295}; // Suppress the date string format warning in Weixin DevTools
1296// Link: https://developers.weixin.qq.com/community/minihome/doc/00080c6f244718053550067736b401
1297
1298
1299var parseDate = typeof wx === 'undefined' ? function (iso8601) {
1300 return new Date(iso8601);
1301} : function (iso8601) {
1302 return new Date(Date.parse(iso8601));
1303};
1304
1305var setValue = function setValue(target, key, value) {
1306 // '.' is not allowed in Class keys, escaping is not in concern now.
1307 var segs = key.split('.');
1308 var lastSeg = segs.pop();
1309 var currentTarget = target;
1310 segs.forEach(function (seg) {
1311 if (currentTarget[seg] === undefined) currentTarget[seg] = {};
1312 currentTarget = currentTarget[seg];
1313 });
1314 currentTarget[lastSeg] = value;
1315 return target;
1316};
1317
1318var findValue = function findValue(target, key) {
1319 var segs = key.split('.');
1320 var firstSeg = segs[0];
1321 var lastSeg = segs.pop();
1322 var currentTarget = target;
1323
1324 for (var i = 0; i < segs.length; i++) {
1325 currentTarget = currentTarget[segs[i]];
1326
1327 if (currentTarget === undefined) {
1328 return [undefined, undefined, lastSeg];
1329 }
1330 }
1331
1332 var value = currentTarget[lastSeg];
1333 return [value, currentTarget, lastSeg, firstSeg];
1334};
1335
1336var isPlainObject = function isPlainObject(obj) {
1337 return _.isObject(obj) && (0, _getPrototypeOf.default)(obj) === Object.prototype;
1338};
1339
1340var continueWhile = function continueWhile(predicate, asyncFunction) {
1341 if (predicate()) {
1342 return asyncFunction().then(function () {
1343 return continueWhile(predicate, asyncFunction);
1344 });
1345 }
1346
1347 return _promise.default.resolve();
1348};
1349
1350module.exports = {
1351 isNullOrUndefined: isNullOrUndefined,
1352 ensureArray: ensureArray,
1353 transformFetchOptions: transformFetchOptions,
1354 getSessionToken: getSessionToken,
1355 tap: tap,
1356 inherits: inherits,
1357 parseDate: parseDate,
1358 setValue: setValue,
1359 findValue: findValue,
1360 isPlainObject: isPlainObject,
1361 continueWhile: continueWhile
1362};
1363
1364/***/ }),
1365/* 33 */
1366/***/ (function(module, exports, __webpack_require__) {
1367
1368var requireObjectCoercible = __webpack_require__(81);
1369
1370var $Object = Object;
1371
1372// `ToObject` abstract operation
1373// https://tc39.es/ecma262/#sec-toobject
1374module.exports = function (argument) {
1375 return $Object(requireObjectCoercible(argument));
1376};
1377
1378
1379/***/ }),
1380/* 34 */
1381/***/ (function(module, exports, __webpack_require__) {
1382
1383module.exports = __webpack_require__(239);
1384
1385/***/ }),
1386/* 35 */
1387/***/ (function(module, exports, __webpack_require__) {
1388
1389// toObject with fallback for non-array-like ES3 strings
1390var IndexedObject = __webpack_require__(98);
1391var requireObjectCoercible = __webpack_require__(81);
1392
1393module.exports = function (it) {
1394 return IndexedObject(requireObjectCoercible(it));
1395};
1396
1397
1398/***/ }),
1399/* 36 */
1400/***/ (function(module, exports) {
1401
1402module.exports = true;
1403
1404
1405/***/ }),
1406/* 37 */
1407/***/ (function(module, exports, __webpack_require__) {
1408
1409module.exports = __webpack_require__(400);
1410
1411/***/ }),
1412/* 38 */
1413/***/ (function(module, exports, __webpack_require__) {
1414
1415module.exports = __webpack_require__(407);
1416
1417/***/ }),
1418/* 39 */
1419/***/ (function(module, exports, __webpack_require__) {
1420
1421var DESCRIPTORS = __webpack_require__(14);
1422var definePropertyModule = __webpack_require__(23);
1423var createPropertyDescriptor = __webpack_require__(49);
1424
1425module.exports = DESCRIPTORS ? function (object, key, value) {
1426 return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
1427} : function (object, key, value) {
1428 object[key] = value;
1429 return object;
1430};
1431
1432
1433/***/ }),
1434/* 40 */
1435/***/ (function(module, exports, __webpack_require__) {
1436
1437var toLength = __webpack_require__(297);
1438
1439// `LengthOfArrayLike` abstract operation
1440// https://tc39.es/ecma262/#sec-lengthofarraylike
1441module.exports = function (obj) {
1442 return toLength(obj.length);
1443};
1444
1445
1446/***/ }),
1447/* 41 */
1448/***/ (function(module, exports, __webpack_require__) {
1449
1450var bind = __webpack_require__(52);
1451var call = __webpack_require__(15);
1452var anObject = __webpack_require__(21);
1453var tryToString = __webpack_require__(67);
1454var isArrayIteratorMethod = __webpack_require__(166);
1455var lengthOfArrayLike = __webpack_require__(40);
1456var isPrototypeOf = __webpack_require__(16);
1457var getIterator = __webpack_require__(167);
1458var getIteratorMethod = __webpack_require__(108);
1459var iteratorClose = __webpack_require__(168);
1460
1461var $TypeError = TypeError;
1462
1463var Result = function (stopped, result) {
1464 this.stopped = stopped;
1465 this.result = result;
1466};
1467
1468var ResultPrototype = Result.prototype;
1469
1470module.exports = function (iterable, unboundFunction, options) {
1471 var that = options && options.that;
1472 var AS_ENTRIES = !!(options && options.AS_ENTRIES);
1473 var IS_ITERATOR = !!(options && options.IS_ITERATOR);
1474 var INTERRUPTED = !!(options && options.INTERRUPTED);
1475 var fn = bind(unboundFunction, that);
1476 var iterator, iterFn, index, length, result, next, step;
1477
1478 var stop = function (condition) {
1479 if (iterator) iteratorClose(iterator, 'normal', condition);
1480 return new Result(true, condition);
1481 };
1482
1483 var callFn = function (value) {
1484 if (AS_ENTRIES) {
1485 anObject(value);
1486 return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
1487 } return INTERRUPTED ? fn(value, stop) : fn(value);
1488 };
1489
1490 if (IS_ITERATOR) {
1491 iterator = iterable;
1492 } else {
1493 iterFn = getIteratorMethod(iterable);
1494 if (!iterFn) throw $TypeError(tryToString(iterable) + ' is not iterable');
1495 // optimisation for array iterators
1496 if (isArrayIteratorMethod(iterFn)) {
1497 for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
1498 result = callFn(iterable[index]);
1499 if (result && isPrototypeOf(ResultPrototype, result)) return result;
1500 } return new Result(false);
1501 }
1502 iterator = getIterator(iterable, iterFn);
1503 }
1504
1505 next = iterator.next;
1506 while (!(step = call(next, iterator)).done) {
1507 try {
1508 result = callFn(step.value);
1509 } catch (error) {
1510 iteratorClose(iterator, 'throw', error);
1511 }
1512 if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
1513 } return new Result(false);
1514};
1515
1516
1517/***/ }),
1518/* 42 */
1519/***/ (function(module, exports, __webpack_require__) {
1520
1521var classof = __webpack_require__(55);
1522
1523var $String = String;
1524
1525module.exports = function (argument) {
1526 if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
1527 return $String(argument);
1528};
1529
1530
1531/***/ }),
1532/* 43 */
1533/***/ (function(module, exports, __webpack_require__) {
1534
1535"use strict";
1536
1537var toIndexedObject = __webpack_require__(35);
1538var addToUnscopables = __webpack_require__(132);
1539var Iterators = __webpack_require__(54);
1540var InternalStateModule = __webpack_require__(44);
1541var defineProperty = __webpack_require__(23).f;
1542var defineIterator = __webpack_require__(134);
1543var IS_PURE = __webpack_require__(36);
1544var DESCRIPTORS = __webpack_require__(14);
1545
1546var ARRAY_ITERATOR = 'Array Iterator';
1547var setInternalState = InternalStateModule.set;
1548var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
1549
1550// `Array.prototype.entries` method
1551// https://tc39.es/ecma262/#sec-array.prototype.entries
1552// `Array.prototype.keys` method
1553// https://tc39.es/ecma262/#sec-array.prototype.keys
1554// `Array.prototype.values` method
1555// https://tc39.es/ecma262/#sec-array.prototype.values
1556// `Array.prototype[@@iterator]` method
1557// https://tc39.es/ecma262/#sec-array.prototype-@@iterator
1558// `CreateArrayIterator` internal method
1559// https://tc39.es/ecma262/#sec-createarrayiterator
1560module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
1561 setInternalState(this, {
1562 type: ARRAY_ITERATOR,
1563 target: toIndexedObject(iterated), // target
1564 index: 0, // next index
1565 kind: kind // kind
1566 });
1567// `%ArrayIteratorPrototype%.next` method
1568// https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
1569}, function () {
1570 var state = getInternalState(this);
1571 var target = state.target;
1572 var kind = state.kind;
1573 var index = state.index++;
1574 if (!target || index >= target.length) {
1575 state.target = undefined;
1576 return { value: undefined, done: true };
1577 }
1578 if (kind == 'keys') return { value: index, done: false };
1579 if (kind == 'values') return { value: target[index], done: false };
1580 return { value: [index, target[index]], done: false };
1581}, 'values');
1582
1583// argumentsList[@@iterator] is %ArrayProto_values%
1584// https://tc39.es/ecma262/#sec-createunmappedargumentsobject
1585// https://tc39.es/ecma262/#sec-createmappedargumentsobject
1586var values = Iterators.Arguments = Iterators.Array;
1587
1588// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1589addToUnscopables('keys');
1590addToUnscopables('values');
1591addToUnscopables('entries');
1592
1593// V8 ~ Chrome 45- bug
1594if (!IS_PURE && DESCRIPTORS && values.name !== 'values') try {
1595 defineProperty(values, 'name', { value: 'values' });
1596} catch (error) { /* empty */ }
1597
1598
1599/***/ }),
1600/* 44 */
1601/***/ (function(module, exports, __webpack_require__) {
1602
1603var NATIVE_WEAK_MAP = __webpack_require__(169);
1604var global = __webpack_require__(8);
1605var uncurryThis = __webpack_require__(4);
1606var isObject = __webpack_require__(11);
1607var createNonEnumerableProperty = __webpack_require__(39);
1608var hasOwn = __webpack_require__(13);
1609var shared = __webpack_require__(124);
1610var sharedKey = __webpack_require__(103);
1611var hiddenKeys = __webpack_require__(83);
1612
1613var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
1614var TypeError = global.TypeError;
1615var WeakMap = global.WeakMap;
1616var set, get, has;
1617
1618var enforce = function (it) {
1619 return has(it) ? get(it) : set(it, {});
1620};
1621
1622var getterFor = function (TYPE) {
1623 return function (it) {
1624 var state;
1625 if (!isObject(it) || (state = get(it)).type !== TYPE) {
1626 throw TypeError('Incompatible receiver, ' + TYPE + ' required');
1627 } return state;
1628 };
1629};
1630
1631if (NATIVE_WEAK_MAP || shared.state) {
1632 var store = shared.state || (shared.state = new WeakMap());
1633 var wmget = uncurryThis(store.get);
1634 var wmhas = uncurryThis(store.has);
1635 var wmset = uncurryThis(store.set);
1636 set = function (it, metadata) {
1637 if (wmhas(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
1638 metadata.facade = it;
1639 wmset(store, it, metadata);
1640 return metadata;
1641 };
1642 get = function (it) {
1643 return wmget(store, it) || {};
1644 };
1645 has = function (it) {
1646 return wmhas(store, it);
1647 };
1648} else {
1649 var STATE = sharedKey('state');
1650 hiddenKeys[STATE] = true;
1651 set = function (it, metadata) {
1652 if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
1653 metadata.facade = it;
1654 createNonEnumerableProperty(it, STATE, metadata);
1655 return metadata;
1656 };
1657 get = function (it) {
1658 return hasOwn(it, STATE) ? it[STATE] : {};
1659 };
1660 has = function (it) {
1661 return hasOwn(it, STATE);
1662 };
1663}
1664
1665module.exports = {
1666 set: set,
1667 get: get,
1668 has: has,
1669 enforce: enforce,
1670 getterFor: getterFor
1671};
1672
1673
1674/***/ }),
1675/* 45 */
1676/***/ (function(module, exports, __webpack_require__) {
1677
1678var createNonEnumerableProperty = __webpack_require__(39);
1679
1680module.exports = function (target, key, value, options) {
1681 if (options && options.enumerable) target[key] = value;
1682 else createNonEnumerableProperty(target, key, value);
1683 return target;
1684};
1685
1686
1687/***/ }),
1688/* 46 */
1689/***/ (function(module, exports, __webpack_require__) {
1690
1691__webpack_require__(43);
1692var DOMIterables = __webpack_require__(322);
1693var global = __webpack_require__(8);
1694var classof = __webpack_require__(55);
1695var createNonEnumerableProperty = __webpack_require__(39);
1696var Iterators = __webpack_require__(54);
1697var wellKnownSymbol = __webpack_require__(5);
1698
1699var TO_STRING_TAG = wellKnownSymbol('toStringTag');
1700
1701for (var COLLECTION_NAME in DOMIterables) {
1702 var Collection = global[COLLECTION_NAME];
1703 var CollectionPrototype = Collection && Collection.prototype;
1704 if (CollectionPrototype && classof(CollectionPrototype) !== TO_STRING_TAG) {
1705 createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
1706 }
1707 Iterators[COLLECTION_NAME] = Iterators.Array;
1708}
1709
1710
1711/***/ }),
1712/* 47 */
1713/***/ (function(module, __webpack_exports__, __webpack_require__) {
1714
1715"use strict";
1716/* harmony export (immutable) */ __webpack_exports__["a"] = has;
1717/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
1718
1719
1720// Internal function to check whether `key` is an own property name of `obj`.
1721function has(obj, key) {
1722 return obj != null && __WEBPACK_IMPORTED_MODULE_0__setup_js__["i" /* hasOwnProperty */].call(obj, key);
1723}
1724
1725
1726/***/ }),
1727/* 48 */
1728/***/ (function(module, exports, __webpack_require__) {
1729
1730"use strict";
1731
1732
1733var _interopRequireDefault = __webpack_require__(1);
1734
1735var _setPrototypeOf = _interopRequireDefault(__webpack_require__(422));
1736
1737var _getPrototypeOf = _interopRequireDefault(__webpack_require__(232));
1738
1739var _ = __webpack_require__(3);
1740/**
1741 * @class AV.Error
1742 */
1743
1744
1745function AVError(code, message) {
1746 if (this instanceof AVError ? this.constructor : void 0) {
1747 var error = new Error(message);
1748 (0, _setPrototypeOf.default)(error, (0, _getPrototypeOf.default)(this));
1749 error.code = code;
1750 return error;
1751 }
1752
1753 return new AVError(code, message);
1754}
1755
1756AVError.prototype = Object.create(Error.prototype, {
1757 constructor: {
1758 value: Error,
1759 enumerable: false,
1760 writable: true,
1761 configurable: true
1762 }
1763});
1764(0, _setPrototypeOf.default)(AVError, Error);
1765
1766_.extend(AVError,
1767/** @lends AV.Error */
1768{
1769 /**
1770 * Error code indicating some error other than those enumerated here.
1771 * @constant
1772 */
1773 OTHER_CAUSE: -1,
1774
1775 /**
1776 * Error code indicating that something has gone wrong with the server.
1777 * If you get this error code, it is AV's fault.
1778 * @constant
1779 */
1780 INTERNAL_SERVER_ERROR: 1,
1781
1782 /**
1783 * Error code indicating the connection to the AV servers failed.
1784 * @constant
1785 */
1786 CONNECTION_FAILED: 100,
1787
1788 /**
1789 * Error code indicating the specified object doesn't exist.
1790 * @constant
1791 */
1792 OBJECT_NOT_FOUND: 101,
1793
1794 /**
1795 * Error code indicating you tried to query with a datatype that doesn't
1796 * support it, like exact matching an array or object.
1797 * @constant
1798 */
1799 INVALID_QUERY: 102,
1800
1801 /**
1802 * Error code indicating a missing or invalid classname. Classnames are
1803 * case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the
1804 * only valid characters.
1805 * @constant
1806 */
1807 INVALID_CLASS_NAME: 103,
1808
1809 /**
1810 * Error code indicating an unspecified object id.
1811 * @constant
1812 */
1813 MISSING_OBJECT_ID: 104,
1814
1815 /**
1816 * Error code indicating an invalid key name. Keys are case-sensitive. They
1817 * must start with a letter, and a-zA-Z0-9_ are the only valid characters.
1818 * @constant
1819 */
1820 INVALID_KEY_NAME: 105,
1821
1822 /**
1823 * Error code indicating a malformed pointer. You should not see this unless
1824 * you have been mucking about changing internal AV code.
1825 * @constant
1826 */
1827 INVALID_POINTER: 106,
1828
1829 /**
1830 * Error code indicating that badly formed JSON was received upstream. This
1831 * either indicates you have done something unusual with modifying how
1832 * things encode to JSON, or the network is failing badly.
1833 * @constant
1834 */
1835 INVALID_JSON: 107,
1836
1837 /**
1838 * Error code indicating that the feature you tried to access is only
1839 * available internally for testing purposes.
1840 * @constant
1841 */
1842 COMMAND_UNAVAILABLE: 108,
1843
1844 /**
1845 * You must call AV.initialize before using the AV library.
1846 * @constant
1847 */
1848 NOT_INITIALIZED: 109,
1849
1850 /**
1851 * Error code indicating that a field was set to an inconsistent type.
1852 * @constant
1853 */
1854 INCORRECT_TYPE: 111,
1855
1856 /**
1857 * Error code indicating an invalid channel name. A channel name is either
1858 * an empty string (the broadcast channel) or contains only a-zA-Z0-9_
1859 * characters.
1860 * @constant
1861 */
1862 INVALID_CHANNEL_NAME: 112,
1863
1864 /**
1865 * Error code indicating that push is misconfigured.
1866 * @constant
1867 */
1868 PUSH_MISCONFIGURED: 115,
1869
1870 /**
1871 * Error code indicating that the object is too large.
1872 * @constant
1873 */
1874 OBJECT_TOO_LARGE: 116,
1875
1876 /**
1877 * Error code indicating that the operation isn't allowed for clients.
1878 * @constant
1879 */
1880 OPERATION_FORBIDDEN: 119,
1881
1882 /**
1883 * Error code indicating the result was not found in the cache.
1884 * @constant
1885 */
1886 CACHE_MISS: 120,
1887
1888 /**
1889 * Error code indicating that an invalid key was used in a nested
1890 * JSONObject.
1891 * @constant
1892 */
1893 INVALID_NESTED_KEY: 121,
1894
1895 /**
1896 * Error code indicating that an invalid filename was used for AVFile.
1897 * A valid file name contains only a-zA-Z0-9_. characters and is between 1
1898 * and 128 characters.
1899 * @constant
1900 */
1901 INVALID_FILE_NAME: 122,
1902
1903 /**
1904 * Error code indicating an invalid ACL was provided.
1905 * @constant
1906 */
1907 INVALID_ACL: 123,
1908
1909 /**
1910 * Error code indicating that the request timed out on the server. Typically
1911 * this indicates that the request is too expensive to run.
1912 * @constant
1913 */
1914 TIMEOUT: 124,
1915
1916 /**
1917 * Error code indicating that the email address was invalid.
1918 * @constant
1919 */
1920 INVALID_EMAIL_ADDRESS: 125,
1921
1922 /**
1923 * Error code indicating a missing content type.
1924 * @constant
1925 */
1926 MISSING_CONTENT_TYPE: 126,
1927
1928 /**
1929 * Error code indicating a missing content length.
1930 * @constant
1931 */
1932 MISSING_CONTENT_LENGTH: 127,
1933
1934 /**
1935 * Error code indicating an invalid content length.
1936 * @constant
1937 */
1938 INVALID_CONTENT_LENGTH: 128,
1939
1940 /**
1941 * Error code indicating a file that was too large.
1942 * @constant
1943 */
1944 FILE_TOO_LARGE: 129,
1945
1946 /**
1947 * Error code indicating an error saving a file.
1948 * @constant
1949 */
1950 FILE_SAVE_ERROR: 130,
1951
1952 /**
1953 * Error code indicating an error deleting a file.
1954 * @constant
1955 */
1956 FILE_DELETE_ERROR: 153,
1957
1958 /**
1959 * Error code indicating that a unique field was given a value that is
1960 * already taken.
1961 * @constant
1962 */
1963 DUPLICATE_VALUE: 137,
1964
1965 /**
1966 * Error code indicating that a role's name is invalid.
1967 * @constant
1968 */
1969 INVALID_ROLE_NAME: 139,
1970
1971 /**
1972 * Error code indicating that an application quota was exceeded. Upgrade to
1973 * resolve.
1974 * @constant
1975 */
1976 EXCEEDED_QUOTA: 140,
1977
1978 /**
1979 * Error code indicating that a Cloud Code script failed.
1980 * @constant
1981 */
1982 SCRIPT_FAILED: 141,
1983
1984 /**
1985 * Error code indicating that a Cloud Code validation failed.
1986 * @constant
1987 */
1988 VALIDATION_ERROR: 142,
1989
1990 /**
1991 * Error code indicating that invalid image data was provided.
1992 * @constant
1993 */
1994 INVALID_IMAGE_DATA: 150,
1995
1996 /**
1997 * Error code indicating an unsaved file.
1998 * @constant
1999 */
2000 UNSAVED_FILE_ERROR: 151,
2001
2002 /**
2003 * Error code indicating an invalid push time.
2004 * @constant
2005 */
2006 INVALID_PUSH_TIME_ERROR: 152,
2007
2008 /**
2009 * Error code indicating that the username is missing or empty.
2010 * @constant
2011 */
2012 USERNAME_MISSING: 200,
2013
2014 /**
2015 * Error code indicating that the password is missing or empty.
2016 * @constant
2017 */
2018 PASSWORD_MISSING: 201,
2019
2020 /**
2021 * Error code indicating that the username has already been taken.
2022 * @constant
2023 */
2024 USERNAME_TAKEN: 202,
2025
2026 /**
2027 * Error code indicating that the email has already been taken.
2028 * @constant
2029 */
2030 EMAIL_TAKEN: 203,
2031
2032 /**
2033 * Error code indicating that the email is missing, but must be specified.
2034 * @constant
2035 */
2036 EMAIL_MISSING: 204,
2037
2038 /**
2039 * Error code indicating that a user with the specified email was not found.
2040 * @constant
2041 */
2042 EMAIL_NOT_FOUND: 205,
2043
2044 /**
2045 * Error code indicating that a user object without a valid session could
2046 * not be altered.
2047 * @constant
2048 */
2049 SESSION_MISSING: 206,
2050
2051 /**
2052 * Error code indicating that a user can only be created through signup.
2053 * @constant
2054 */
2055 MUST_CREATE_USER_THROUGH_SIGNUP: 207,
2056
2057 /**
2058 * Error code indicating that an an account being linked is already linked
2059 * to another user.
2060 * @constant
2061 */
2062 ACCOUNT_ALREADY_LINKED: 208,
2063
2064 /**
2065 * Error code indicating that a user cannot be linked to an account because
2066 * that account's id could not be found.
2067 * @constant
2068 */
2069 LINKED_ID_MISSING: 250,
2070
2071 /**
2072 * Error code indicating that a user with a linked (e.g. Facebook) account
2073 * has an invalid session.
2074 * @constant
2075 */
2076 INVALID_LINKED_SESSION: 251,
2077
2078 /**
2079 * Error code indicating that a service being linked (e.g. Facebook or
2080 * Twitter) is unsupported.
2081 * @constant
2082 */
2083 UNSUPPORTED_SERVICE: 252,
2084
2085 /**
2086 * Error code indicating a real error code is unavailable because
2087 * we had to use an XDomainRequest object to allow CORS requests in
2088 * Internet Explorer, which strips the body from HTTP responses that have
2089 * a non-2XX status code.
2090 * @constant
2091 */
2092 X_DOMAIN_REQUEST: 602
2093});
2094
2095module.exports = AVError;
2096
2097/***/ }),
2098/* 49 */
2099/***/ (function(module, exports) {
2100
2101module.exports = function (bitmap, value) {
2102 return {
2103 enumerable: !(bitmap & 1),
2104 configurable: !(bitmap & 2),
2105 writable: !(bitmap & 4),
2106 value: value
2107 };
2108};
2109
2110
2111/***/ }),
2112/* 50 */
2113/***/ (function(module, exports, __webpack_require__) {
2114
2115var uncurryThis = __webpack_require__(4);
2116
2117var toString = uncurryThis({}.toString);
2118var stringSlice = uncurryThis(''.slice);
2119
2120module.exports = function (it) {
2121 return stringSlice(toString(it), 8, -1);
2122};
2123
2124
2125/***/ }),
2126/* 51 */
2127/***/ (function(module, exports, __webpack_require__) {
2128
2129var getBuiltIn = __webpack_require__(20);
2130
2131module.exports = getBuiltIn('navigator', 'userAgent') || '';
2132
2133
2134/***/ }),
2135/* 52 */
2136/***/ (function(module, exports, __webpack_require__) {
2137
2138var uncurryThis = __webpack_require__(4);
2139var aCallable = __webpack_require__(29);
2140var NATIVE_BIND = __webpack_require__(80);
2141
2142var bind = uncurryThis(uncurryThis.bind);
2143
2144// optional / simple context binding
2145module.exports = function (fn, that) {
2146 aCallable(fn);
2147 return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) {
2148 return fn.apply(that, arguments);
2149 };
2150};
2151
2152
2153/***/ }),
2154/* 53 */
2155/***/ (function(module, exports, __webpack_require__) {
2156
2157/* global ActiveXObject -- old IE, WSH */
2158var anObject = __webpack_require__(21);
2159var definePropertiesModule = __webpack_require__(130);
2160var enumBugKeys = __webpack_require__(129);
2161var hiddenKeys = __webpack_require__(83);
2162var html = __webpack_require__(165);
2163var documentCreateElement = __webpack_require__(125);
2164var sharedKey = __webpack_require__(103);
2165
2166var GT = '>';
2167var LT = '<';
2168var PROTOTYPE = 'prototype';
2169var SCRIPT = 'script';
2170var IE_PROTO = sharedKey('IE_PROTO');
2171
2172var EmptyConstructor = function () { /* empty */ };
2173
2174var scriptTag = function (content) {
2175 return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
2176};
2177
2178// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
2179var NullProtoObjectViaActiveX = function (activeXDocument) {
2180 activeXDocument.write(scriptTag(''));
2181 activeXDocument.close();
2182 var temp = activeXDocument.parentWindow.Object;
2183 activeXDocument = null; // avoid memory leak
2184 return temp;
2185};
2186
2187// Create object with fake `null` prototype: use iframe Object with cleared prototype
2188var NullProtoObjectViaIFrame = function () {
2189 // Thrash, waste and sodomy: IE GC bug
2190 var iframe = documentCreateElement('iframe');
2191 var JS = 'java' + SCRIPT + ':';
2192 var iframeDocument;
2193 iframe.style.display = 'none';
2194 html.appendChild(iframe);
2195 // https://github.com/zloirock/core-js/issues/475
2196 iframe.src = String(JS);
2197 iframeDocument = iframe.contentWindow.document;
2198 iframeDocument.open();
2199 iframeDocument.write(scriptTag('document.F=Object'));
2200 iframeDocument.close();
2201 return iframeDocument.F;
2202};
2203
2204// Check for document.domain and active x support
2205// No need to use active x approach when document.domain is not set
2206// see https://github.com/es-shims/es5-shim/issues/150
2207// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
2208// avoid IE GC bug
2209var activeXDocument;
2210var NullProtoObject = function () {
2211 try {
2212 activeXDocument = new ActiveXObject('htmlfile');
2213 } catch (error) { /* ignore */ }
2214 NullProtoObject = typeof document != 'undefined'
2215 ? document.domain && activeXDocument
2216 ? NullProtoObjectViaActiveX(activeXDocument) // old IE
2217 : NullProtoObjectViaIFrame()
2218 : NullProtoObjectViaActiveX(activeXDocument); // WSH
2219 var length = enumBugKeys.length;
2220 while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
2221 return NullProtoObject();
2222};
2223
2224hiddenKeys[IE_PROTO] = true;
2225
2226// `Object.create` method
2227// https://tc39.es/ecma262/#sec-object.create
2228// eslint-disable-next-line es-x/no-object-create -- safe
2229module.exports = Object.create || function create(O, Properties) {
2230 var result;
2231 if (O !== null) {
2232 EmptyConstructor[PROTOTYPE] = anObject(O);
2233 result = new EmptyConstructor();
2234 EmptyConstructor[PROTOTYPE] = null;
2235 // add "__proto__" for Object.getPrototypeOf polyfill
2236 result[IE_PROTO] = O;
2237 } else result = NullProtoObject();
2238 return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
2239};
2240
2241
2242/***/ }),
2243/* 54 */
2244/***/ (function(module, exports) {
2245
2246module.exports = {};
2247
2248
2249/***/ }),
2250/* 55 */
2251/***/ (function(module, exports, __webpack_require__) {
2252
2253var TO_STRING_TAG_SUPPORT = __webpack_require__(131);
2254var isCallable = __webpack_require__(9);
2255var classofRaw = __webpack_require__(50);
2256var wellKnownSymbol = __webpack_require__(5);
2257
2258var TO_STRING_TAG = wellKnownSymbol('toStringTag');
2259var $Object = Object;
2260
2261// ES3 wrong here
2262var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
2263
2264// fallback for IE11 Script Access Denied error
2265var tryGet = function (it, key) {
2266 try {
2267 return it[key];
2268 } catch (error) { /* empty */ }
2269};
2270
2271// getting tag from ES6+ `Object.prototype.toString`
2272module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
2273 var O, tag, result;
2274 return it === undefined ? 'Undefined' : it === null ? 'Null'
2275 // @@toStringTag case
2276 : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
2277 // builtinTag case
2278 : CORRECT_ARGUMENTS ? classofRaw(O)
2279 // ES3 arguments fallback
2280 : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
2281};
2282
2283
2284/***/ }),
2285/* 56 */
2286/***/ (function(module, exports, __webpack_require__) {
2287
2288var TO_STRING_TAG_SUPPORT = __webpack_require__(131);
2289var defineProperty = __webpack_require__(23).f;
2290var createNonEnumerableProperty = __webpack_require__(39);
2291var hasOwn = __webpack_require__(13);
2292var toString = __webpack_require__(303);
2293var wellKnownSymbol = __webpack_require__(5);
2294
2295var TO_STRING_TAG = wellKnownSymbol('toStringTag');
2296
2297module.exports = function (it, TAG, STATIC, SET_METHOD) {
2298 if (it) {
2299 var target = STATIC ? it : it.prototype;
2300 if (!hasOwn(target, TO_STRING_TAG)) {
2301 defineProperty(target, TO_STRING_TAG, { configurable: true, value: TAG });
2302 }
2303 if (SET_METHOD && !TO_STRING_TAG_SUPPORT) {
2304 createNonEnumerableProperty(target, 'toString', toString);
2305 }
2306 }
2307};
2308
2309
2310/***/ }),
2311/* 57 */
2312/***/ (function(module, exports, __webpack_require__) {
2313
2314"use strict";
2315
2316var aCallable = __webpack_require__(29);
2317
2318var PromiseCapability = function (C) {
2319 var resolve, reject;
2320 this.promise = new C(function ($$resolve, $$reject) {
2321 if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
2322 resolve = $$resolve;
2323 reject = $$reject;
2324 });
2325 this.resolve = aCallable(resolve);
2326 this.reject = aCallable(reject);
2327};
2328
2329// `NewPromiseCapability` abstract operation
2330// https://tc39.es/ecma262/#sec-newpromisecapability
2331module.exports.f = function (C) {
2332 return new PromiseCapability(C);
2333};
2334
2335
2336/***/ }),
2337/* 58 */
2338/***/ (function(module, __webpack_exports__, __webpack_require__) {
2339
2340"use strict";
2341/* harmony export (immutable) */ __webpack_exports__["a"] = isObject;
2342// Is a given variable an object?
2343function isObject(obj) {
2344 var type = typeof obj;
2345 return type === 'function' || type === 'object' && !!obj;
2346}
2347
2348
2349/***/ }),
2350/* 59 */
2351/***/ (function(module, __webpack_exports__, __webpack_require__) {
2352
2353"use strict";
2354/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
2355/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__tagTester_js__ = __webpack_require__(18);
2356
2357
2358
2359// Is a given value an array?
2360// Delegates to ECMA5's native `Array.isArray`.
2361/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__setup_js__["k" /* nativeIsArray */] || Object(__WEBPACK_IMPORTED_MODULE_1__tagTester_js__["a" /* default */])('Array'));
2362
2363
2364/***/ }),
2365/* 60 */
2366/***/ (function(module, __webpack_exports__, __webpack_require__) {
2367
2368"use strict";
2369/* harmony export (immutable) */ __webpack_exports__["a"] = each;
2370/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(89);
2371/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
2372/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(17);
2373
2374
2375
2376
2377// The cornerstone for collection functions, an `each`
2378// implementation, aka `forEach`.
2379// Handles raw objects in addition to array-likes. Treats all
2380// sparse array-likes as if they were dense.
2381function each(obj, iteratee, context) {
2382 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context);
2383 var i, length;
2384 if (Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj)) {
2385 for (i = 0, length = obj.length; i < length; i++) {
2386 iteratee(obj[i], i, obj);
2387 }
2388 } else {
2389 var _keys = Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj);
2390 for (i = 0, length = _keys.length; i < length; i++) {
2391 iteratee(obj[_keys[i]], _keys[i], obj);
2392 }
2393 }
2394 return obj;
2395}
2396
2397
2398/***/ }),
2399/* 61 */
2400/***/ (function(module, exports, __webpack_require__) {
2401
2402module.exports = __webpack_require__(409);
2403
2404/***/ }),
2405/* 62 */
2406/***/ (function(module, exports, __webpack_require__) {
2407
2408module.exports = __webpack_require__(413);
2409
2410/***/ }),
2411/* 63 */
2412/***/ (function(module, exports, __webpack_require__) {
2413
2414"use strict";
2415
2416
2417function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2418
2419/* eslint-env browser */
2420
2421/**
2422 * This is the web browser implementation of `debug()`.
2423 */
2424exports.log = log;
2425exports.formatArgs = formatArgs;
2426exports.save = save;
2427exports.load = load;
2428exports.useColors = useColors;
2429exports.storage = localstorage();
2430/**
2431 * Colors.
2432 */
2433
2434exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
2435/**
2436 * Currently only WebKit-based Web Inspectors, Firefox >= v31,
2437 * and the Firebug extension (any Firefox version) are known
2438 * to support "%c" CSS customizations.
2439 *
2440 * TODO: add a `localStorage` variable to explicitly enable/disable colors
2441 */
2442// eslint-disable-next-line complexity
2443
2444function useColors() {
2445 // NB: In an Electron preload script, document will be defined but not fully
2446 // initialized. Since we know we're in Chrome, we'll just detect this case
2447 // explicitly
2448 if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
2449 return true;
2450 } // Internet Explorer and Edge do not support colors.
2451
2452
2453 if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
2454 return false;
2455 } // Is webkit? http://stackoverflow.com/a/16459606/376773
2456 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
2457
2458
2459 return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
2460 typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
2461 // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
2462 typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
2463 typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
2464}
2465/**
2466 * Colorize log arguments if enabled.
2467 *
2468 * @api public
2469 */
2470
2471
2472function formatArgs(args) {
2473 args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
2474
2475 if (!this.useColors) {
2476 return;
2477 }
2478
2479 var c = 'color: ' + this.color;
2480 args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
2481 // arguments passed either before or after the %c, so we need to
2482 // figure out the correct index to insert the CSS into
2483
2484 var index = 0;
2485 var lastC = 0;
2486 args[0].replace(/%[a-zA-Z%]/g, function (match) {
2487 if (match === '%%') {
2488 return;
2489 }
2490
2491 index++;
2492
2493 if (match === '%c') {
2494 // We only are interested in the *last* %c
2495 // (the user may have provided their own)
2496 lastC = index;
2497 }
2498 });
2499 args.splice(lastC, 0, c);
2500}
2501/**
2502 * Invokes `console.log()` when available.
2503 * No-op when `console.log` is not a "function".
2504 *
2505 * @api public
2506 */
2507
2508
2509function log() {
2510 var _console;
2511
2512 // This hackery is required for IE8/9, where
2513 // the `console.log` function doesn't have 'apply'
2514 return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
2515}
2516/**
2517 * Save `namespaces`.
2518 *
2519 * @param {String} namespaces
2520 * @api private
2521 */
2522
2523
2524function save(namespaces) {
2525 try {
2526 if (namespaces) {
2527 exports.storage.setItem('debug', namespaces);
2528 } else {
2529 exports.storage.removeItem('debug');
2530 }
2531 } catch (error) {// Swallow
2532 // XXX (@Qix-) should we be logging these?
2533 }
2534}
2535/**
2536 * Load `namespaces`.
2537 *
2538 * @return {String} returns the previously persisted debug modes
2539 * @api private
2540 */
2541
2542
2543function load() {
2544 var r;
2545
2546 try {
2547 r = exports.storage.getItem('debug');
2548 } catch (error) {} // Swallow
2549 // XXX (@Qix-) should we be logging these?
2550 // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
2551
2552
2553 if (!r && typeof process !== 'undefined' && 'env' in process) {
2554 r = process.env.DEBUG;
2555 }
2556
2557 return r;
2558}
2559/**
2560 * Localstorage attempts to return the localstorage.
2561 *
2562 * This is necessary because safari throws
2563 * when a user disables cookies/localstorage
2564 * and you attempt to access it.
2565 *
2566 * @return {LocalStorage}
2567 * @api private
2568 */
2569
2570
2571function localstorage() {
2572 try {
2573 // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
2574 // The Browser also has localStorage in the global context.
2575 return localStorage;
2576 } catch (error) {// Swallow
2577 // XXX (@Qix-) should we be logging these?
2578 }
2579}
2580
2581module.exports = __webpack_require__(418)(exports);
2582var formatters = module.exports.formatters;
2583/**
2584 * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
2585 */
2586
2587formatters.j = function (v) {
2588 try {
2589 return JSON.stringify(v);
2590 } catch (error) {
2591 return '[UnexpectedJSONParseError]: ' + error.message;
2592 }
2593};
2594
2595
2596
2597/***/ }),
2598/* 64 */
2599/***/ (function(module, exports, __webpack_require__) {
2600
2601var DESCRIPTORS = __webpack_require__(14);
2602var call = __webpack_require__(15);
2603var propertyIsEnumerableModule = __webpack_require__(122);
2604var createPropertyDescriptor = __webpack_require__(49);
2605var toIndexedObject = __webpack_require__(35);
2606var toPropertyKey = __webpack_require__(99);
2607var hasOwn = __webpack_require__(13);
2608var IE8_DOM_DEFINE = __webpack_require__(159);
2609
2610// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
2611var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
2612
2613// `Object.getOwnPropertyDescriptor` method
2614// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
2615exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
2616 O = toIndexedObject(O);
2617 P = toPropertyKey(P);
2618 if (IE8_DOM_DEFINE) try {
2619 return $getOwnPropertyDescriptor(O, P);
2620 } catch (error) { /* empty */ }
2621 if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
2622};
2623
2624
2625/***/ }),
2626/* 65 */
2627/***/ (function(module, exports, __webpack_require__) {
2628
2629/* eslint-disable es-x/no-symbol -- required for testing */
2630var V8_VERSION = __webpack_require__(66);
2631var fails = __webpack_require__(2);
2632
2633// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
2634module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
2635 var symbol = Symbol();
2636 // Chrome 38 Symbol has incorrect toString conversion
2637 // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
2638 return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
2639 // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
2640 !Symbol.sham && V8_VERSION && V8_VERSION < 41;
2641});
2642
2643
2644/***/ }),
2645/* 66 */
2646/***/ (function(module, exports, __webpack_require__) {
2647
2648var global = __webpack_require__(8);
2649var userAgent = __webpack_require__(51);
2650
2651var process = global.process;
2652var Deno = global.Deno;
2653var versions = process && process.versions || Deno && Deno.version;
2654var v8 = versions && versions.v8;
2655var match, version;
2656
2657if (v8) {
2658 match = v8.split('.');
2659 // in old Chrome, versions of V8 isn't V8 = Chrome / 10
2660 // but their correct versions are not interesting for us
2661 version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
2662}
2663
2664// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
2665// so check `userAgent` even if `.v8` exists, but 0
2666if (!version && userAgent) {
2667 match = userAgent.match(/Edge\/(\d+)/);
2668 if (!match || match[1] >= 74) {
2669 match = userAgent.match(/Chrome\/(\d+)/);
2670 if (match) version = +match[1];
2671 }
2672}
2673
2674module.exports = version;
2675
2676
2677/***/ }),
2678/* 67 */
2679/***/ (function(module, exports) {
2680
2681var $String = String;
2682
2683module.exports = function (argument) {
2684 try {
2685 return $String(argument);
2686 } catch (error) {
2687 return 'Object';
2688 }
2689};
2690
2691
2692/***/ }),
2693/* 68 */
2694/***/ (function(module, exports) {
2695
2696// empty
2697
2698
2699/***/ }),
2700/* 69 */
2701/***/ (function(module, exports, __webpack_require__) {
2702
2703var global = __webpack_require__(8);
2704
2705module.exports = global.Promise;
2706
2707
2708/***/ }),
2709/* 70 */
2710/***/ (function(module, exports, __webpack_require__) {
2711
2712"use strict";
2713
2714var charAt = __webpack_require__(321).charAt;
2715var toString = __webpack_require__(42);
2716var InternalStateModule = __webpack_require__(44);
2717var defineIterator = __webpack_require__(134);
2718
2719var STRING_ITERATOR = 'String Iterator';
2720var setInternalState = InternalStateModule.set;
2721var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
2722
2723// `String.prototype[@@iterator]` method
2724// https://tc39.es/ecma262/#sec-string.prototype-@@iterator
2725defineIterator(String, 'String', function (iterated) {
2726 setInternalState(this, {
2727 type: STRING_ITERATOR,
2728 string: toString(iterated),
2729 index: 0
2730 });
2731// `%StringIteratorPrototype%.next` method
2732// https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
2733}, function next() {
2734 var state = getInternalState(this);
2735 var string = state.string;
2736 var index = state.index;
2737 var point;
2738 if (index >= string.length) return { value: undefined, done: true };
2739 point = charAt(string, index);
2740 state.index += point.length;
2741 return { value: point, done: false };
2742});
2743
2744
2745/***/ }),
2746/* 71 */
2747/***/ (function(module, __webpack_exports__, __webpack_require__) {
2748
2749"use strict";
2750/* harmony export (immutable) */ __webpack_exports__["a"] = values;
2751/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(17);
2752
2753
2754// Retrieve the values of an object's properties.
2755function values(obj) {
2756 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
2757 var length = _keys.length;
2758 var values = Array(length);
2759 for (var i = 0; i < length; i++) {
2760 values[i] = obj[_keys[i]];
2761 }
2762 return values;
2763}
2764
2765
2766/***/ }),
2767/* 72 */
2768/***/ (function(module, __webpack_exports__, __webpack_require__) {
2769
2770"use strict";
2771/* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
2772/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(31);
2773/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
2774/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArray_js__ = __webpack_require__(59);
2775/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(138);
2776
2777
2778
2779
2780
2781// Internal implementation of a recursive `flatten` function.
2782function flatten(input, depth, strict, output) {
2783 output = output || [];
2784 if (!depth && depth !== 0) {
2785 depth = Infinity;
2786 } else if (depth <= 0) {
2787 return output.concat(input);
2788 }
2789 var idx = output.length;
2790 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(input); i < length; i++) {
2791 var value = input[i];
2792 if (Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(value) && (Object(__WEBPACK_IMPORTED_MODULE_2__isArray_js__["a" /* default */])(value) || Object(__WEBPACK_IMPORTED_MODULE_3__isArguments_js__["a" /* default */])(value))) {
2793 // Flatten current level of array or arguments object.
2794 if (depth > 1) {
2795 flatten(value, depth - 1, strict, output);
2796 idx = output.length;
2797 } else {
2798 var j = 0, len = value.length;
2799 while (j < len) output[idx++] = value[j++];
2800 }
2801 } else if (!strict) {
2802 output[idx++] = value;
2803 }
2804 }
2805 return output;
2806}
2807
2808
2809/***/ }),
2810/* 73 */
2811/***/ (function(module, __webpack_exports__, __webpack_require__) {
2812
2813"use strict";
2814/* harmony export (immutable) */ __webpack_exports__["a"] = map;
2815/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
2816/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
2817/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(17);
2818
2819
2820
2821
2822// Return the results of applying the iteratee to each element.
2823function map(obj, iteratee, context) {
2824 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
2825 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
2826 length = (_keys || obj).length,
2827 results = Array(length);
2828 for (var index = 0; index < length; index++) {
2829 var currentKey = _keys ? _keys[index] : index;
2830 results[index] = iteratee(obj[currentKey], currentKey, obj);
2831 }
2832 return results;
2833}
2834
2835
2836/***/ }),
2837/* 74 */
2838/***/ (function(module, exports, __webpack_require__) {
2839
2840"use strict";
2841/* WEBPACK VAR INJECTION */(function(global) {
2842
2843var _interopRequireDefault = __webpack_require__(1);
2844
2845var _promise = _interopRequireDefault(__webpack_require__(12));
2846
2847var _concat = _interopRequireDefault(__webpack_require__(19));
2848
2849var _map = _interopRequireDefault(__webpack_require__(37));
2850
2851var _keys = _interopRequireDefault(__webpack_require__(150));
2852
2853var _stringify = _interopRequireDefault(__webpack_require__(38));
2854
2855var _indexOf = _interopRequireDefault(__webpack_require__(61));
2856
2857var _keys2 = _interopRequireDefault(__webpack_require__(62));
2858
2859var _ = __webpack_require__(3);
2860
2861var uuid = __webpack_require__(231);
2862
2863var debug = __webpack_require__(63);
2864
2865var _require = __webpack_require__(32),
2866 inherits = _require.inherits,
2867 parseDate = _require.parseDate;
2868
2869var version = __webpack_require__(234);
2870
2871var _require2 = __webpack_require__(76),
2872 setAdapters = _require2.setAdapters,
2873 adapterManager = _require2.adapterManager;
2874
2875var AV = global.AV || {}; // All internal configuration items
2876
2877AV._config = {
2878 serverURLs: {},
2879 useMasterKey: false,
2880 production: null,
2881 realtime: null,
2882 requestTimeout: null
2883};
2884var initialUserAgent = "LeanCloud-JS-SDK/".concat(version); // configs shared by all AV instances
2885
2886AV._sharedConfig = {
2887 userAgent: initialUserAgent,
2888 liveQueryRealtime: null
2889};
2890adapterManager.on('platformInfo', function (platformInfo) {
2891 var ua = initialUserAgent;
2892
2893 if (platformInfo) {
2894 if (platformInfo.userAgent) {
2895 ua = platformInfo.userAgent;
2896 } else {
2897 var comments = platformInfo.name;
2898
2899 if (platformInfo.version) {
2900 comments += "/".concat(platformInfo.version);
2901 }
2902
2903 if (platformInfo.extra) {
2904 comments += "; ".concat(platformInfo.extra);
2905 }
2906
2907 ua += " (".concat(comments, ")");
2908 }
2909 }
2910
2911 AV._sharedConfig.userAgent = ua;
2912});
2913/**
2914 * Contains all AV API classes and functions.
2915 * @namespace AV
2916 */
2917
2918/**
2919 * Returns prefix for localStorage keys used by this instance of AV.
2920 * @param {String} path The relative suffix to append to it.
2921 * null or undefined is treated as the empty string.
2922 * @return {String} The full key name.
2923 * @private
2924 */
2925
2926AV._getAVPath = function (path) {
2927 if (!AV.applicationId) {
2928 throw new Error('You need to call AV.initialize before using AV.');
2929 }
2930
2931 if (!path) {
2932 path = '';
2933 }
2934
2935 if (!_.isString(path)) {
2936 throw new Error("Tried to get a localStorage path that wasn't a String.");
2937 }
2938
2939 if (path[0] === '/') {
2940 path = path.substring(1);
2941 }
2942
2943 return 'AV/' + AV.applicationId + '/' + path;
2944};
2945/**
2946 * Returns the unique string for this app on this machine.
2947 * Gets reset when localStorage is cleared.
2948 * @private
2949 */
2950
2951
2952AV._installationId = null;
2953
2954AV._getInstallationId = function () {
2955 // See if it's cached in RAM.
2956 if (AV._installationId) {
2957 return _promise.default.resolve(AV._installationId);
2958 } // Try to get it from localStorage.
2959
2960
2961 var path = AV._getAVPath('installationId');
2962
2963 return AV.localStorage.getItemAsync(path).then(function (_installationId) {
2964 AV._installationId = _installationId;
2965
2966 if (!AV._installationId) {
2967 // It wasn't in localStorage, so create a new one.
2968 AV._installationId = _installationId = uuid();
2969 return AV.localStorage.setItemAsync(path, _installationId).then(function () {
2970 return _installationId;
2971 });
2972 }
2973
2974 return _installationId;
2975 });
2976};
2977
2978AV._subscriptionId = null;
2979
2980AV._refreshSubscriptionId = function () {
2981 var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : AV._getAVPath('subscriptionId');
2982 var subscriptionId = AV._subscriptionId = uuid();
2983 return AV.localStorage.setItemAsync(path, subscriptionId).then(function () {
2984 return subscriptionId;
2985 });
2986};
2987
2988AV._getSubscriptionId = function () {
2989 // See if it's cached in RAM.
2990 if (AV._subscriptionId) {
2991 return _promise.default.resolve(AV._subscriptionId);
2992 } // Try to get it from localStorage.
2993
2994
2995 var path = AV._getAVPath('subscriptionId');
2996
2997 return AV.localStorage.getItemAsync(path).then(function (_subscriptionId) {
2998 AV._subscriptionId = _subscriptionId;
2999
3000 if (!AV._subscriptionId) {
3001 // It wasn't in localStorage, so create a new one.
3002 _subscriptionId = AV._refreshSubscriptionId(path);
3003 }
3004
3005 return _subscriptionId;
3006 });
3007};
3008
3009AV._parseDate = parseDate; // A self-propagating extend function.
3010
3011AV._extend = function (protoProps, classProps) {
3012 var child = inherits(this, protoProps, classProps);
3013 child.extend = this.extend;
3014 return child;
3015};
3016/**
3017 * Converts a value in a AV Object into the appropriate representation.
3018 * This is the JS equivalent of Java's AV.maybeReferenceAndEncode(Object)
3019 * if seenObjects is falsey. Otherwise any AV.Objects not in
3020 * seenObjects will be fully embedded rather than encoded
3021 * as a pointer. This array will be used to prevent going into an infinite
3022 * loop because we have circular references. If <seenObjects>
3023 * is set, then none of the AV Objects that are serialized can be dirty.
3024 * @private
3025 */
3026
3027
3028AV._encode = function (value, seenObjects, disallowObjects) {
3029 var full = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
3030
3031 if (value instanceof AV.Object) {
3032 if (disallowObjects) {
3033 throw new Error('AV.Objects not allowed here');
3034 }
3035
3036 if (!seenObjects || _.include(seenObjects, value) || !value._hasData) {
3037 return value._toPointer();
3038 }
3039
3040 return value._toFullJSON((0, _concat.default)(seenObjects).call(seenObjects, value), full);
3041 }
3042
3043 if (value instanceof AV.ACL) {
3044 return value.toJSON();
3045 }
3046
3047 if (_.isDate(value)) {
3048 return full ? {
3049 __type: 'Date',
3050 iso: value.toJSON()
3051 } : value.toJSON();
3052 }
3053
3054 if (value instanceof AV.GeoPoint) {
3055 return value.toJSON();
3056 }
3057
3058 if (_.isArray(value)) {
3059 return (0, _map.default)(_).call(_, value, function (x) {
3060 return AV._encode(x, seenObjects, disallowObjects, full);
3061 });
3062 }
3063
3064 if (_.isRegExp(value)) {
3065 return value.source;
3066 }
3067
3068 if (value instanceof AV.Relation) {
3069 return value.toJSON();
3070 }
3071
3072 if (value instanceof AV.Op) {
3073 return value.toJSON();
3074 }
3075
3076 if (value instanceof AV.File) {
3077 if (!value.url() && !value.id) {
3078 throw new Error('Tried to save an object containing an unsaved file.');
3079 }
3080
3081 return value._toFullJSON(seenObjects, full);
3082 }
3083
3084 if (_.isObject(value)) {
3085 return _.mapObject(value, function (v, k) {
3086 return AV._encode(v, seenObjects, disallowObjects, full);
3087 });
3088 }
3089
3090 return value;
3091};
3092/**
3093 * The inverse function of AV._encode.
3094 * @private
3095 */
3096
3097
3098AV._decode = function (value, key) {
3099 if (!_.isObject(value) || _.isDate(value)) {
3100 return value;
3101 }
3102
3103 if (_.isArray(value)) {
3104 return (0, _map.default)(_).call(_, value, function (v) {
3105 return AV._decode(v);
3106 });
3107 }
3108
3109 if (value instanceof AV.Object) {
3110 return value;
3111 }
3112
3113 if (value instanceof AV.File) {
3114 return value;
3115 }
3116
3117 if (value instanceof AV.Op) {
3118 return value;
3119 }
3120
3121 if (value instanceof AV.GeoPoint) {
3122 return value;
3123 }
3124
3125 if (value instanceof AV.ACL) {
3126 return value;
3127 }
3128
3129 if (key === 'ACL') {
3130 return new AV.ACL(value);
3131 }
3132
3133 if (value.__op) {
3134 return AV.Op._decode(value);
3135 }
3136
3137 var className;
3138
3139 if (value.__type === 'Pointer') {
3140 className = value.className;
3141
3142 var pointer = AV.Object._create(className);
3143
3144 if ((0, _keys.default)(value).length > 3) {
3145 var v = _.clone(value);
3146
3147 delete v.__type;
3148 delete v.className;
3149
3150 pointer._finishFetch(v, true);
3151 } else {
3152 pointer._finishFetch({
3153 objectId: value.objectId
3154 }, false);
3155 }
3156
3157 return pointer;
3158 }
3159
3160 if (value.__type === 'Object') {
3161 // It's an Object included in a query result.
3162 className = value.className;
3163
3164 var _v = _.clone(value);
3165
3166 delete _v.__type;
3167 delete _v.className;
3168
3169 var object = AV.Object._create(className);
3170
3171 object._finishFetch(_v, true);
3172
3173 return object;
3174 }
3175
3176 if (value.__type === 'Date') {
3177 return AV._parseDate(value.iso);
3178 }
3179
3180 if (value.__type === 'GeoPoint') {
3181 return new AV.GeoPoint({
3182 latitude: value.latitude,
3183 longitude: value.longitude
3184 });
3185 }
3186
3187 if (value.__type === 'Relation') {
3188 if (!key) throw new Error('key missing decoding a Relation');
3189 var relation = new AV.Relation(null, key);
3190 relation.targetClassName = value.className;
3191 return relation;
3192 }
3193
3194 if (value.__type === 'File') {
3195 var file = new AV.File(value.name);
3196
3197 var _v2 = _.clone(value);
3198
3199 delete _v2.__type;
3200
3201 file._finishFetch(_v2);
3202
3203 return file;
3204 }
3205
3206 return _.mapObject(value, AV._decode);
3207};
3208/**
3209 * The inverse function of {@link AV.Object#toFullJSON}.
3210 * @since 3.0.0
3211 * @method
3212 * @param {Object}
3213 * return {AV.Object|AV.File|any}
3214 */
3215
3216
3217AV.parseJSON = AV._decode;
3218/**
3219 * Similar to JSON.parse, except that AV internal types will be used if possible.
3220 * Inverse to {@link AV.stringify}
3221 * @since 3.14.0
3222 * @param {string} text the string to parse.
3223 * @return {AV.Object|AV.File|any}
3224 */
3225
3226AV.parse = function (text) {
3227 return AV.parseJSON(JSON.parse(text));
3228};
3229/**
3230 * Serialize a target containing AV.Object, similar to JSON.stringify.
3231 * Inverse to {@link AV.parse}
3232 * @since 3.14.0
3233 * @return {string}
3234 */
3235
3236
3237AV.stringify = function (target) {
3238 return (0, _stringify.default)(AV._encode(target, [], false, true));
3239};
3240
3241AV._encodeObjectOrArray = function (value) {
3242 var encodeAVObject = function encodeAVObject(object) {
3243 if (object && object._toFullJSON) {
3244 object = object._toFullJSON([]);
3245 }
3246
3247 return _.mapObject(object, function (value) {
3248 return AV._encode(value, []);
3249 });
3250 };
3251
3252 if (_.isArray(value)) {
3253 return (0, _map.default)(value).call(value, function (object) {
3254 return encodeAVObject(object);
3255 });
3256 } else {
3257 return encodeAVObject(value);
3258 }
3259};
3260
3261AV._arrayEach = _.each;
3262/**
3263 * Does a deep traversal of every item in object, calling func on every one.
3264 * @param {Object} object The object or array to traverse deeply.
3265 * @param {Function} func The function to call for every item. It will
3266 * be passed the item as an argument. If it returns a truthy value, that
3267 * value will replace the item in its parent container.
3268 * @returns {} the result of calling func on the top-level object itself.
3269 * @private
3270 */
3271
3272AV._traverse = function (object, func, seen) {
3273 if (object instanceof AV.Object) {
3274 seen = seen || [];
3275
3276 if ((0, _indexOf.default)(_).call(_, seen, object) >= 0) {
3277 // We've already visited this object in this call.
3278 return;
3279 }
3280
3281 seen.push(object);
3282
3283 AV._traverse(object.attributes, func, seen);
3284
3285 return func(object);
3286 }
3287
3288 if (object instanceof AV.Relation || object instanceof AV.File) {
3289 // Nothing needs to be done, but we don't want to recurse into the
3290 // object's parent infinitely, so we catch this case.
3291 return func(object);
3292 }
3293
3294 if (_.isArray(object)) {
3295 _.each(object, function (child, index) {
3296 var newChild = AV._traverse(child, func, seen);
3297
3298 if (newChild) {
3299 object[index] = newChild;
3300 }
3301 });
3302
3303 return func(object);
3304 }
3305
3306 if (_.isObject(object)) {
3307 AV._each(object, function (child, key) {
3308 var newChild = AV._traverse(child, func, seen);
3309
3310 if (newChild) {
3311 object[key] = newChild;
3312 }
3313 });
3314
3315 return func(object);
3316 }
3317
3318 return func(object);
3319};
3320/**
3321 * This is like _.each, except:
3322 * * it doesn't work for so-called array-like objects,
3323 * * it does work for dictionaries with a "length" attribute.
3324 * @private
3325 */
3326
3327
3328AV._objectEach = AV._each = function (obj, callback) {
3329 if (_.isObject(obj)) {
3330 _.each((0, _keys2.default)(_).call(_, obj), function (key) {
3331 callback(obj[key], key);
3332 });
3333 } else {
3334 _.each(obj, callback);
3335 }
3336};
3337/**
3338 * @namespace
3339 * @since 3.14.0
3340 */
3341
3342
3343AV.debug = {
3344 /**
3345 * Enable debug
3346 */
3347 enable: function enable() {
3348 var namespaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'leancloud*';
3349 return debug.enable(namespaces);
3350 },
3351
3352 /**
3353 * Disable debug
3354 */
3355 disable: debug.disable
3356};
3357/**
3358 * Specify Adapters
3359 * @since 4.4.0
3360 * @function
3361 * @param {Adapters} newAdapters See {@link https://url.leanapp.cn/adapter-type-definitions @leancloud/adapter-types} for detailed definitions.
3362 */
3363
3364AV.setAdapters = setAdapters;
3365module.exports = AV;
3366/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(78)))
3367
3368/***/ }),
3369/* 75 */
3370/***/ (function(module, exports, __webpack_require__) {
3371
3372var bind = __webpack_require__(52);
3373var uncurryThis = __webpack_require__(4);
3374var IndexedObject = __webpack_require__(98);
3375var toObject = __webpack_require__(33);
3376var lengthOfArrayLike = __webpack_require__(40);
3377var arraySpeciesCreate = __webpack_require__(229);
3378
3379var push = uncurryThis([].push);
3380
3381// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
3382var createMethod = function (TYPE) {
3383 var IS_MAP = TYPE == 1;
3384 var IS_FILTER = TYPE == 2;
3385 var IS_SOME = TYPE == 3;
3386 var IS_EVERY = TYPE == 4;
3387 var IS_FIND_INDEX = TYPE == 6;
3388 var IS_FILTER_REJECT = TYPE == 7;
3389 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
3390 return function ($this, callbackfn, that, specificCreate) {
3391 var O = toObject($this);
3392 var self = IndexedObject(O);
3393 var boundFunction = bind(callbackfn, that);
3394 var length = lengthOfArrayLike(self);
3395 var index = 0;
3396 var create = specificCreate || arraySpeciesCreate;
3397 var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
3398 var value, result;
3399 for (;length > index; index++) if (NO_HOLES || index in self) {
3400 value = self[index];
3401 result = boundFunction(value, index, O);
3402 if (TYPE) {
3403 if (IS_MAP) target[index] = result; // map
3404 else if (result) switch (TYPE) {
3405 case 3: return true; // some
3406 case 5: return value; // find
3407 case 6: return index; // findIndex
3408 case 2: push(target, value); // filter
3409 } else switch (TYPE) {
3410 case 4: return false; // every
3411 case 7: push(target, value); // filterReject
3412 }
3413 }
3414 }
3415 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
3416 };
3417};
3418
3419module.exports = {
3420 // `Array.prototype.forEach` method
3421 // https://tc39.es/ecma262/#sec-array.prototype.foreach
3422 forEach: createMethod(0),
3423 // `Array.prototype.map` method
3424 // https://tc39.es/ecma262/#sec-array.prototype.map
3425 map: createMethod(1),
3426 // `Array.prototype.filter` method
3427 // https://tc39.es/ecma262/#sec-array.prototype.filter
3428 filter: createMethod(2),
3429 // `Array.prototype.some` method
3430 // https://tc39.es/ecma262/#sec-array.prototype.some
3431 some: createMethod(3),
3432 // `Array.prototype.every` method
3433 // https://tc39.es/ecma262/#sec-array.prototype.every
3434 every: createMethod(4),
3435 // `Array.prototype.find` method
3436 // https://tc39.es/ecma262/#sec-array.prototype.find
3437 find: createMethod(5),
3438 // `Array.prototype.findIndex` method
3439 // https://tc39.es/ecma262/#sec-array.prototype.findIndex
3440 findIndex: createMethod(6),
3441 // `Array.prototype.filterReject` method
3442 // https://github.com/tc39/proposal-array-filtering
3443 filterReject: createMethod(7)
3444};
3445
3446
3447/***/ }),
3448/* 76 */
3449/***/ (function(module, exports, __webpack_require__) {
3450
3451"use strict";
3452
3453
3454var _interopRequireDefault = __webpack_require__(1);
3455
3456var _keys = _interopRequireDefault(__webpack_require__(62));
3457
3458var _ = __webpack_require__(3);
3459
3460var EventEmitter = __webpack_require__(235);
3461
3462var _require = __webpack_require__(32),
3463 inherits = _require.inherits;
3464
3465var AdapterManager = inherits(EventEmitter, {
3466 constructor: function constructor() {
3467 EventEmitter.apply(this);
3468 this._adapters = {};
3469 },
3470 getAdapter: function getAdapter(name) {
3471 var adapter = this._adapters[name];
3472
3473 if (adapter === undefined) {
3474 throw new Error("".concat(name, " adapter is not configured"));
3475 }
3476
3477 return adapter;
3478 },
3479 setAdapters: function setAdapters(newAdapters) {
3480 var _this = this;
3481
3482 _.extend(this._adapters, newAdapters);
3483
3484 (0, _keys.default)(_).call(_, newAdapters).forEach(function (name) {
3485 return _this.emit(name, newAdapters[name]);
3486 });
3487 }
3488});
3489var adapterManager = new AdapterManager();
3490module.exports = {
3491 getAdapter: adapterManager.getAdapter.bind(adapterManager),
3492 setAdapters: adapterManager.setAdapters.bind(adapterManager),
3493 adapterManager: adapterManager
3494};
3495
3496/***/ }),
3497/* 77 */
3498/***/ (function(module, exports, __webpack_require__) {
3499
3500module.exports = __webpack_require__(242);
3501
3502/***/ }),
3503/* 78 */
3504/***/ (function(module, exports) {
3505
3506var g;
3507
3508// This works in non-strict mode
3509g = (function() {
3510 return this;
3511})();
3512
3513try {
3514 // This works if eval is allowed (see CSP)
3515 g = g || Function("return this")() || (1,eval)("this");
3516} catch(e) {
3517 // This works if the window reference is available
3518 if(typeof window === "object")
3519 g = window;
3520}
3521
3522// g can still be undefined, but nothing to do about it...
3523// We return undefined, instead of nothing here, so it's
3524// easier to handle this case. if(!global) { ...}
3525
3526module.exports = g;
3527
3528
3529/***/ }),
3530/* 79 */
3531/***/ (function(module, exports, __webpack_require__) {
3532
3533var NATIVE_BIND = __webpack_require__(80);
3534
3535var FunctionPrototype = Function.prototype;
3536var apply = FunctionPrototype.apply;
3537var call = FunctionPrototype.call;
3538
3539// eslint-disable-next-line es-x/no-reflect -- safe
3540module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () {
3541 return call.apply(apply, arguments);
3542});
3543
3544
3545/***/ }),
3546/* 80 */
3547/***/ (function(module, exports, __webpack_require__) {
3548
3549var fails = __webpack_require__(2);
3550
3551module.exports = !fails(function () {
3552 // eslint-disable-next-line es-x/no-function-prototype-bind -- safe
3553 var test = (function () { /* empty */ }).bind();
3554 // eslint-disable-next-line no-prototype-builtins -- safe
3555 return typeof test != 'function' || test.hasOwnProperty('prototype');
3556});
3557
3558
3559/***/ }),
3560/* 81 */
3561/***/ (function(module, exports) {
3562
3563var $TypeError = TypeError;
3564
3565// `RequireObjectCoercible` abstract operation
3566// https://tc39.es/ecma262/#sec-requireobjectcoercible
3567module.exports = function (it) {
3568 if (it == undefined) throw $TypeError("Can't call method on " + it);
3569 return it;
3570};
3571
3572
3573/***/ }),
3574/* 82 */
3575/***/ (function(module, exports, __webpack_require__) {
3576
3577var IS_PURE = __webpack_require__(36);
3578var store = __webpack_require__(124);
3579
3580(module.exports = function (key, value) {
3581 return store[key] || (store[key] = value !== undefined ? value : {});
3582})('versions', []).push({
3583 version: '3.23.3',
3584 mode: IS_PURE ? 'pure' : 'global',
3585 copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
3586 license: 'https://github.com/zloirock/core-js/blob/v3.23.3/LICENSE',
3587 source: 'https://github.com/zloirock/core-js'
3588});
3589
3590
3591/***/ }),
3592/* 83 */
3593/***/ (function(module, exports) {
3594
3595module.exports = {};
3596
3597
3598/***/ }),
3599/* 84 */
3600/***/ (function(module, exports) {
3601
3602module.exports = function (exec) {
3603 try {
3604 return { error: false, value: exec() };
3605 } catch (error) {
3606 return { error: true, value: error };
3607 }
3608};
3609
3610
3611/***/ }),
3612/* 85 */
3613/***/ (function(module, exports, __webpack_require__) {
3614
3615var global = __webpack_require__(8);
3616var NativePromiseConstructor = __webpack_require__(69);
3617var isCallable = __webpack_require__(9);
3618var isForced = __webpack_require__(160);
3619var inspectSource = __webpack_require__(133);
3620var wellKnownSymbol = __webpack_require__(5);
3621var IS_BROWSER = __webpack_require__(312);
3622var IS_PURE = __webpack_require__(36);
3623var V8_VERSION = __webpack_require__(66);
3624
3625var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
3626var SPECIES = wellKnownSymbol('species');
3627var SUBCLASSING = false;
3628var NATIVE_PROMISE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent);
3629
3630var FORCED_PROMISE_CONSTRUCTOR = isForced('Promise', function () {
3631 var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor);
3632 var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor);
3633 // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
3634 // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
3635 // We can't detect it synchronously, so just check versions
3636 if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
3637 // We need Promise#{ catch, finally } in the pure version for preventing prototype pollution
3638 if (IS_PURE && !(NativePromisePrototype['catch'] && NativePromisePrototype['finally'])) return true;
3639 // We can't use @@species feature detection in V8 since it causes
3640 // deoptimization and performance degradation
3641 // https://github.com/zloirock/core-js/issues/679
3642 if (V8_VERSION >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
3643 // Detect correctness of subclassing with @@species support
3644 var promise = new NativePromiseConstructor(function (resolve) { resolve(1); });
3645 var FakePromise = function (exec) {
3646 exec(function () { /* empty */ }, function () { /* empty */ });
3647 };
3648 var constructor = promise.constructor = {};
3649 constructor[SPECIES] = FakePromise;
3650 SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
3651 if (!SUBCLASSING) return true;
3652 // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
3653 return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_PROMISE_REJECTION_EVENT;
3654});
3655
3656module.exports = {
3657 CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR,
3658 REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT,
3659 SUBCLASSING: SUBCLASSING
3660};
3661
3662
3663/***/ }),
3664/* 86 */
3665/***/ (function(module, __webpack_exports__, __webpack_require__) {
3666
3667"use strict";
3668/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hasStringTagBug; });
3669/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isIE11; });
3670/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
3671/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__ = __webpack_require__(329);
3672
3673
3674
3675// In IE 10 - Edge 13, `DataView` has string tag `'[object Object]'`.
3676// In IE 11, the most common among them, this problem also applies to
3677// `Map`, `WeakMap` and `Set`.
3678var hasStringTagBug = (
3679 __WEBPACK_IMPORTED_MODULE_0__setup_js__["s" /* supportsDataView */] && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new DataView(new ArrayBuffer(8)))
3680 ),
3681 isIE11 = (typeof Map !== 'undefined' && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new Map));
3682
3683
3684/***/ }),
3685/* 87 */
3686/***/ (function(module, __webpack_exports__, __webpack_require__) {
3687
3688"use strict";
3689/* harmony export (immutable) */ __webpack_exports__["a"] = allKeys;
3690/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(58);
3691/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
3692/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__ = __webpack_require__(190);
3693
3694
3695
3696
3697// Retrieve all the enumerable property names of an object.
3698function allKeys(obj) {
3699 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return [];
3700 var keys = [];
3701 for (var key in obj) keys.push(key);
3702 // Ahem, IE < 9.
3703 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__["a" /* default */])(obj, keys);
3704 return keys;
3705}
3706
3707
3708/***/ }),
3709/* 88 */
3710/***/ (function(module, __webpack_exports__, __webpack_require__) {
3711
3712"use strict";
3713/* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
3714/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
3715/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(199);
3716
3717
3718
3719// Internal wrapper for `_.toPath` to enable minification.
3720// Similar to `cb` for `_.iteratee`.
3721function toPath(path) {
3722 return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath(path);
3723}
3724
3725
3726/***/ }),
3727/* 89 */
3728/***/ (function(module, __webpack_exports__, __webpack_require__) {
3729
3730"use strict";
3731/* harmony export (immutable) */ __webpack_exports__["a"] = optimizeCb;
3732// Internal function that returns an efficient (for current engines) version
3733// of the passed-in callback, to be repeatedly applied in other Underscore
3734// functions.
3735function optimizeCb(func, context, argCount) {
3736 if (context === void 0) return func;
3737 switch (argCount == null ? 3 : argCount) {
3738 case 1: return function(value) {
3739 return func.call(context, value);
3740 };
3741 // The 2-argument case is omitted because we’re not using it.
3742 case 3: return function(value, index, collection) {
3743 return func.call(context, value, index, collection);
3744 };
3745 case 4: return function(accumulator, value, index, collection) {
3746 return func.call(context, accumulator, value, index, collection);
3747 };
3748 }
3749 return function() {
3750 return func.apply(context, arguments);
3751 };
3752}
3753
3754
3755/***/ }),
3756/* 90 */
3757/***/ (function(module, __webpack_exports__, __webpack_require__) {
3758
3759"use strict";
3760/* harmony export (immutable) */ __webpack_exports__["a"] = filter;
3761/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
3762/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(60);
3763
3764
3765
3766// Return all the elements that pass a truth test.
3767function filter(obj, predicate, context) {
3768 var results = [];
3769 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
3770 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index, list) {
3771 if (predicate(value, index, list)) results.push(value);
3772 });
3773 return results;
3774}
3775
3776
3777/***/ }),
3778/* 91 */
3779/***/ (function(module, __webpack_exports__, __webpack_require__) {
3780
3781"use strict";
3782/* harmony export (immutable) */ __webpack_exports__["a"] = contains;
3783/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
3784/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(71);
3785/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__indexOf_js__ = __webpack_require__(215);
3786
3787
3788
3789
3790// Determine if the array or object contains a given item (using `===`).
3791function contains(obj, item, fromIndex, guard) {
3792 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
3793 if (typeof fromIndex != 'number' || guard) fromIndex = 0;
3794 return Object(__WEBPACK_IMPORTED_MODULE_2__indexOf_js__["a" /* default */])(obj, item, fromIndex) >= 0;
3795}
3796
3797
3798/***/ }),
3799/* 92 */
3800/***/ (function(module, exports, __webpack_require__) {
3801
3802var classof = __webpack_require__(50);
3803
3804// `IsArray` abstract operation
3805// https://tc39.es/ecma262/#sec-isarray
3806// eslint-disable-next-line es-x/no-array-isarray -- safe
3807module.exports = Array.isArray || function isArray(argument) {
3808 return classof(argument) == 'Array';
3809};
3810
3811
3812/***/ }),
3813/* 93 */
3814/***/ (function(module, exports, __webpack_require__) {
3815
3816"use strict";
3817
3818var toPropertyKey = __webpack_require__(99);
3819var definePropertyModule = __webpack_require__(23);
3820var createPropertyDescriptor = __webpack_require__(49);
3821
3822module.exports = function (object, key, value) {
3823 var propertyKey = toPropertyKey(key);
3824 if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
3825 else object[propertyKey] = value;
3826};
3827
3828
3829/***/ }),
3830/* 94 */
3831/***/ (function(module, exports, __webpack_require__) {
3832
3833module.exports = __webpack_require__(240);
3834
3835/***/ }),
3836/* 95 */
3837/***/ (function(module, exports, __webpack_require__) {
3838
3839var _Symbol = __webpack_require__(241);
3840
3841var _Symbol$iterator = __webpack_require__(464);
3842
3843function _typeof(obj) {
3844 "@babel/helpers - typeof";
3845
3846 return (module.exports = _typeof = "function" == typeof _Symbol && "symbol" == typeof _Symbol$iterator ? function (obj) {
3847 return typeof obj;
3848 } : function (obj) {
3849 return obj && "function" == typeof _Symbol && obj.constructor === _Symbol && obj !== _Symbol.prototype ? "symbol" : typeof obj;
3850 }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
3851}
3852
3853module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
3854
3855/***/ }),
3856/* 96 */
3857/***/ (function(module, exports, __webpack_require__) {
3858
3859module.exports = __webpack_require__(477);
3860
3861/***/ }),
3862/* 97 */
3863/***/ (function(module, exports, __webpack_require__) {
3864
3865var $ = __webpack_require__(0);
3866var uncurryThis = __webpack_require__(4);
3867var hiddenKeys = __webpack_require__(83);
3868var isObject = __webpack_require__(11);
3869var hasOwn = __webpack_require__(13);
3870var defineProperty = __webpack_require__(23).f;
3871var getOwnPropertyNamesModule = __webpack_require__(105);
3872var getOwnPropertyNamesExternalModule = __webpack_require__(244);
3873var isExtensible = __webpack_require__(265);
3874var uid = __webpack_require__(101);
3875var FREEZING = __webpack_require__(264);
3876
3877var REQUIRED = false;
3878var METADATA = uid('meta');
3879var id = 0;
3880
3881var setMetadata = function (it) {
3882 defineProperty(it, METADATA, { value: {
3883 objectID: 'O' + id++, // object ID
3884 weakData: {} // weak collections IDs
3885 } });
3886};
3887
3888var fastKey = function (it, create) {
3889 // return a primitive with prefix
3890 if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
3891 if (!hasOwn(it, METADATA)) {
3892 // can't set metadata to uncaught frozen object
3893 if (!isExtensible(it)) return 'F';
3894 // not necessary to add metadata
3895 if (!create) return 'E';
3896 // add missing metadata
3897 setMetadata(it);
3898 // return object ID
3899 } return it[METADATA].objectID;
3900};
3901
3902var getWeakData = function (it, create) {
3903 if (!hasOwn(it, METADATA)) {
3904 // can't set metadata to uncaught frozen object
3905 if (!isExtensible(it)) return true;
3906 // not necessary to add metadata
3907 if (!create) return false;
3908 // add missing metadata
3909 setMetadata(it);
3910 // return the store of weak collections IDs
3911 } return it[METADATA].weakData;
3912};
3913
3914// add metadata on freeze-family methods calling
3915var onFreeze = function (it) {
3916 if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA)) setMetadata(it);
3917 return it;
3918};
3919
3920var enable = function () {
3921 meta.enable = function () { /* empty */ };
3922 REQUIRED = true;
3923 var getOwnPropertyNames = getOwnPropertyNamesModule.f;
3924 var splice = uncurryThis([].splice);
3925 var test = {};
3926 test[METADATA] = 1;
3927
3928 // prevent exposing of metadata key
3929 if (getOwnPropertyNames(test).length) {
3930 getOwnPropertyNamesModule.f = function (it) {
3931 var result = getOwnPropertyNames(it);
3932 for (var i = 0, length = result.length; i < length; i++) {
3933 if (result[i] === METADATA) {
3934 splice(result, i, 1);
3935 break;
3936 }
3937 } return result;
3938 };
3939
3940 $({ target: 'Object', stat: true, forced: true }, {
3941 getOwnPropertyNames: getOwnPropertyNamesExternalModule.f
3942 });
3943 }
3944};
3945
3946var meta = module.exports = {
3947 enable: enable,
3948 fastKey: fastKey,
3949 getWeakData: getWeakData,
3950 onFreeze: onFreeze
3951};
3952
3953hiddenKeys[METADATA] = true;
3954
3955
3956/***/ }),
3957/* 98 */
3958/***/ (function(module, exports, __webpack_require__) {
3959
3960var uncurryThis = __webpack_require__(4);
3961var fails = __webpack_require__(2);
3962var classof = __webpack_require__(50);
3963
3964var $Object = Object;
3965var split = uncurryThis(''.split);
3966
3967// fallback for non-array-like ES3 and non-enumerable old V8 strings
3968module.exports = fails(function () {
3969 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
3970 // eslint-disable-next-line no-prototype-builtins -- safe
3971 return !$Object('z').propertyIsEnumerable(0);
3972}) ? function (it) {
3973 return classof(it) == 'String' ? split(it, '') : $Object(it);
3974} : $Object;
3975
3976
3977/***/ }),
3978/* 99 */
3979/***/ (function(module, exports, __webpack_require__) {
3980
3981var toPrimitive = __webpack_require__(291);
3982var isSymbol = __webpack_require__(100);
3983
3984// `ToPropertyKey` abstract operation
3985// https://tc39.es/ecma262/#sec-topropertykey
3986module.exports = function (argument) {
3987 var key = toPrimitive(argument, 'string');
3988 return isSymbol(key) ? key : key + '';
3989};
3990
3991
3992/***/ }),
3993/* 100 */
3994/***/ (function(module, exports, __webpack_require__) {
3995
3996var getBuiltIn = __webpack_require__(20);
3997var isCallable = __webpack_require__(9);
3998var isPrototypeOf = __webpack_require__(16);
3999var USE_SYMBOL_AS_UID = __webpack_require__(158);
4000
4001var $Object = Object;
4002
4003module.exports = USE_SYMBOL_AS_UID ? function (it) {
4004 return typeof it == 'symbol';
4005} : function (it) {
4006 var $Symbol = getBuiltIn('Symbol');
4007 return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
4008};
4009
4010
4011/***/ }),
4012/* 101 */
4013/***/ (function(module, exports, __webpack_require__) {
4014
4015var uncurryThis = __webpack_require__(4);
4016
4017var id = 0;
4018var postfix = Math.random();
4019var toString = uncurryThis(1.0.toString);
4020
4021module.exports = function (key) {
4022 return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
4023};
4024
4025
4026/***/ }),
4027/* 102 */
4028/***/ (function(module, exports, __webpack_require__) {
4029
4030var hasOwn = __webpack_require__(13);
4031var isCallable = __webpack_require__(9);
4032var toObject = __webpack_require__(33);
4033var sharedKey = __webpack_require__(103);
4034var CORRECT_PROTOTYPE_GETTER = __webpack_require__(162);
4035
4036var IE_PROTO = sharedKey('IE_PROTO');
4037var $Object = Object;
4038var ObjectPrototype = $Object.prototype;
4039
4040// `Object.getPrototypeOf` method
4041// https://tc39.es/ecma262/#sec-object.getprototypeof
4042// eslint-disable-next-line es-x/no-object-getprototypeof -- safe
4043module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
4044 var object = toObject(O);
4045 if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];
4046 var constructor = object.constructor;
4047 if (isCallable(constructor) && object instanceof constructor) {
4048 return constructor.prototype;
4049 } return object instanceof $Object ? ObjectPrototype : null;
4050};
4051
4052
4053/***/ }),
4054/* 103 */
4055/***/ (function(module, exports, __webpack_require__) {
4056
4057var shared = __webpack_require__(82);
4058var uid = __webpack_require__(101);
4059
4060var keys = shared('keys');
4061
4062module.exports = function (key) {
4063 return keys[key] || (keys[key] = uid(key));
4064};
4065
4066
4067/***/ }),
4068/* 104 */
4069/***/ (function(module, exports, __webpack_require__) {
4070
4071/* eslint-disable no-proto -- safe */
4072var uncurryThis = __webpack_require__(4);
4073var anObject = __webpack_require__(21);
4074var aPossiblePrototype = __webpack_require__(294);
4075
4076// `Object.setPrototypeOf` method
4077// https://tc39.es/ecma262/#sec-object.setprototypeof
4078// Works with __proto__ only. Old v8 can't work with null proto objects.
4079// eslint-disable-next-line es-x/no-object-setprototypeof -- safe
4080module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
4081 var CORRECT_SETTER = false;
4082 var test = {};
4083 var setter;
4084 try {
4085 // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
4086 setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
4087 setter(test, []);
4088 CORRECT_SETTER = test instanceof Array;
4089 } catch (error) { /* empty */ }
4090 return function setPrototypeOf(O, proto) {
4091 anObject(O);
4092 aPossiblePrototype(proto);
4093 if (CORRECT_SETTER) setter(O, proto);
4094 else O.__proto__ = proto;
4095 return O;
4096 };
4097}() : undefined);
4098
4099
4100/***/ }),
4101/* 105 */
4102/***/ (function(module, exports, __webpack_require__) {
4103
4104var internalObjectKeys = __webpack_require__(164);
4105var enumBugKeys = __webpack_require__(129);
4106
4107var hiddenKeys = enumBugKeys.concat('length', 'prototype');
4108
4109// `Object.getOwnPropertyNames` method
4110// https://tc39.es/ecma262/#sec-object.getownpropertynames
4111// eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
4112exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
4113 return internalObjectKeys(O, hiddenKeys);
4114};
4115
4116
4117/***/ }),
4118/* 106 */
4119/***/ (function(module, exports) {
4120
4121// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
4122exports.f = Object.getOwnPropertySymbols;
4123
4124
4125/***/ }),
4126/* 107 */
4127/***/ (function(module, exports, __webpack_require__) {
4128
4129var internalObjectKeys = __webpack_require__(164);
4130var enumBugKeys = __webpack_require__(129);
4131
4132// `Object.keys` method
4133// https://tc39.es/ecma262/#sec-object.keys
4134// eslint-disable-next-line es-x/no-object-keys -- safe
4135module.exports = Object.keys || function keys(O) {
4136 return internalObjectKeys(O, enumBugKeys);
4137};
4138
4139
4140/***/ }),
4141/* 108 */
4142/***/ (function(module, exports, __webpack_require__) {
4143
4144var classof = __webpack_require__(55);
4145var getMethod = __webpack_require__(123);
4146var Iterators = __webpack_require__(54);
4147var wellKnownSymbol = __webpack_require__(5);
4148
4149var ITERATOR = wellKnownSymbol('iterator');
4150
4151module.exports = function (it) {
4152 if (it != undefined) return getMethod(it, ITERATOR)
4153 || getMethod(it, '@@iterator')
4154 || Iterators[classof(it)];
4155};
4156
4157
4158/***/ }),
4159/* 109 */
4160/***/ (function(module, exports, __webpack_require__) {
4161
4162var classof = __webpack_require__(50);
4163var global = __webpack_require__(8);
4164
4165module.exports = classof(global.process) == 'process';
4166
4167
4168/***/ }),
4169/* 110 */
4170/***/ (function(module, exports, __webpack_require__) {
4171
4172var isPrototypeOf = __webpack_require__(16);
4173
4174var $TypeError = TypeError;
4175
4176module.exports = function (it, Prototype) {
4177 if (isPrototypeOf(Prototype, it)) return it;
4178 throw $TypeError('Incorrect invocation');
4179};
4180
4181
4182/***/ }),
4183/* 111 */
4184/***/ (function(module, exports, __webpack_require__) {
4185
4186var uncurryThis = __webpack_require__(4);
4187var fails = __webpack_require__(2);
4188var isCallable = __webpack_require__(9);
4189var classof = __webpack_require__(55);
4190var getBuiltIn = __webpack_require__(20);
4191var inspectSource = __webpack_require__(133);
4192
4193var noop = function () { /* empty */ };
4194var empty = [];
4195var construct = getBuiltIn('Reflect', 'construct');
4196var constructorRegExp = /^\s*(?:class|function)\b/;
4197var exec = uncurryThis(constructorRegExp.exec);
4198var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
4199
4200var isConstructorModern = function isConstructor(argument) {
4201 if (!isCallable(argument)) return false;
4202 try {
4203 construct(noop, empty, argument);
4204 return true;
4205 } catch (error) {
4206 return false;
4207 }
4208};
4209
4210var isConstructorLegacy = function isConstructor(argument) {
4211 if (!isCallable(argument)) return false;
4212 switch (classof(argument)) {
4213 case 'AsyncFunction':
4214 case 'GeneratorFunction':
4215 case 'AsyncGeneratorFunction': return false;
4216 }
4217 try {
4218 // we can't check .prototype since constructors produced by .bind haven't it
4219 // `Function#toString` throws on some built-it function in some legacy engines
4220 // (for example, `DOMQuad` and similar in FF41-)
4221 return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
4222 } catch (error) {
4223 return true;
4224 }
4225};
4226
4227isConstructorLegacy.sham = true;
4228
4229// `IsConstructor` abstract operation
4230// https://tc39.es/ecma262/#sec-isconstructor
4231module.exports = !construct || fails(function () {
4232 var called;
4233 return isConstructorModern(isConstructorModern.call)
4234 || !isConstructorModern(Object)
4235 || !isConstructorModern(function () { called = true; })
4236 || called;
4237}) ? isConstructorLegacy : isConstructorModern;
4238
4239
4240/***/ }),
4241/* 112 */
4242/***/ (function(module, exports, __webpack_require__) {
4243
4244var uncurryThis = __webpack_require__(4);
4245
4246module.exports = uncurryThis([].slice);
4247
4248
4249/***/ }),
4250/* 113 */
4251/***/ (function(module, __webpack_exports__, __webpack_require__) {
4252
4253"use strict";
4254/* harmony export (immutable) */ __webpack_exports__["a"] = matcher;
4255/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__extendOwn_js__ = __webpack_require__(142);
4256/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isMatch_js__ = __webpack_require__(191);
4257
4258
4259
4260// Returns a predicate for checking whether an object has a given set of
4261// `key:value` pairs.
4262function matcher(attrs) {
4263 attrs = Object(__WEBPACK_IMPORTED_MODULE_0__extendOwn_js__["a" /* default */])({}, attrs);
4264 return function(obj) {
4265 return Object(__WEBPACK_IMPORTED_MODULE_1__isMatch_js__["a" /* default */])(obj, attrs);
4266 };
4267}
4268
4269
4270/***/ }),
4271/* 114 */
4272/***/ (function(module, __webpack_exports__, __webpack_require__) {
4273
4274"use strict";
4275/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
4276/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__executeBound_js__ = __webpack_require__(207);
4277/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(25);
4278
4279
4280
4281
4282// Partially apply a function by creating a version that has had some of its
4283// arguments pre-filled, without changing its dynamic `this` context. `_` acts
4284// as a placeholder by default, allowing any combination of arguments to be
4285// pre-filled. Set `_.partial.placeholder` for a custom placeholder argument.
4286var partial = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, boundArgs) {
4287 var placeholder = partial.placeholder;
4288 var bound = function() {
4289 var position = 0, length = boundArgs.length;
4290 var args = Array(length);
4291 for (var i = 0; i < length; i++) {
4292 args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i];
4293 }
4294 while (position < arguments.length) args.push(arguments[position++]);
4295 return Object(__WEBPACK_IMPORTED_MODULE_1__executeBound_js__["a" /* default */])(func, bound, this, this, args);
4296 };
4297 return bound;
4298});
4299
4300partial.placeholder = __WEBPACK_IMPORTED_MODULE_2__underscore_js__["a" /* default */];
4301/* harmony default export */ __webpack_exports__["a"] = (partial);
4302
4303
4304/***/ }),
4305/* 115 */
4306/***/ (function(module, __webpack_exports__, __webpack_require__) {
4307
4308"use strict";
4309/* harmony export (immutable) */ __webpack_exports__["a"] = group;
4310/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
4311/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(60);
4312
4313
4314
4315// An internal function used for aggregate "group by" operations.
4316function group(behavior, partition) {
4317 return function(obj, iteratee, context) {
4318 var result = partition ? [[], []] : {};
4319 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
4320 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index) {
4321 var key = iteratee(value, index, obj);
4322 behavior(result, value, key);
4323 });
4324 return result;
4325 };
4326}
4327
4328
4329/***/ }),
4330/* 116 */
4331/***/ (function(module, exports, __webpack_require__) {
4332
4333var fails = __webpack_require__(2);
4334var wellKnownSymbol = __webpack_require__(5);
4335var V8_VERSION = __webpack_require__(66);
4336
4337var SPECIES = wellKnownSymbol('species');
4338
4339module.exports = function (METHOD_NAME) {
4340 // We can't use this feature detection in V8 since it causes
4341 // deoptimization and serious performance degradation
4342 // https://github.com/zloirock/core-js/issues/677
4343 return V8_VERSION >= 51 || !fails(function () {
4344 var array = [];
4345 var constructor = array.constructor = {};
4346 constructor[SPECIES] = function () {
4347 return { foo: 1 };
4348 };
4349 return array[METHOD_NAME](Boolean).foo !== 1;
4350 });
4351};
4352
4353
4354/***/ }),
4355/* 117 */
4356/***/ (function(module, exports, __webpack_require__) {
4357
4358"use strict";
4359
4360
4361var _interopRequireDefault = __webpack_require__(1);
4362
4363var _typeof2 = _interopRequireDefault(__webpack_require__(95));
4364
4365var _filter = _interopRequireDefault(__webpack_require__(250));
4366
4367var _map = _interopRequireDefault(__webpack_require__(37));
4368
4369var _keys = _interopRequireDefault(__webpack_require__(150));
4370
4371var _stringify = _interopRequireDefault(__webpack_require__(38));
4372
4373var _concat = _interopRequireDefault(__webpack_require__(19));
4374
4375var _ = __webpack_require__(3);
4376
4377var _require = __webpack_require__(251),
4378 timeout = _require.timeout;
4379
4380var debug = __webpack_require__(63);
4381
4382var debugRequest = debug('leancloud:request');
4383var debugRequestError = debug('leancloud:request:error');
4384
4385var _require2 = __webpack_require__(76),
4386 getAdapter = _require2.getAdapter;
4387
4388var requestsCount = 0;
4389
4390var ajax = function ajax(_ref) {
4391 var method = _ref.method,
4392 url = _ref.url,
4393 query = _ref.query,
4394 data = _ref.data,
4395 _ref$headers = _ref.headers,
4396 headers = _ref$headers === void 0 ? {} : _ref$headers,
4397 time = _ref.timeout,
4398 onprogress = _ref.onprogress;
4399
4400 if (query) {
4401 var _context, _context2, _context4;
4402
4403 var queryString = (0, _filter.default)(_context = (0, _map.default)(_context2 = (0, _keys.default)(query)).call(_context2, function (key) {
4404 var _context3;
4405
4406 var value = query[key];
4407 if (value === undefined) return undefined;
4408 var v = (0, _typeof2.default)(value) === 'object' ? (0, _stringify.default)(value) : value;
4409 return (0, _concat.default)(_context3 = "".concat(encodeURIComponent(key), "=")).call(_context3, encodeURIComponent(v));
4410 })).call(_context, function (qs) {
4411 return qs;
4412 }).join('&');
4413 url = (0, _concat.default)(_context4 = "".concat(url, "?")).call(_context4, queryString);
4414 }
4415
4416 var count = requestsCount++;
4417 debugRequest('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
4418 var request = getAdapter('request');
4419 var promise = request(url, {
4420 method: method,
4421 headers: headers,
4422 data: data,
4423 onprogress: onprogress
4424 }).then(function (response) {
4425 debugRequest('response(%d) %d %O %o', count, response.status, response.data || response.text, response.header);
4426
4427 if (response.ok === false) {
4428 var error = new Error();
4429 error.response = response;
4430 throw error;
4431 }
4432
4433 return response.data;
4434 }).catch(function (error) {
4435 if (error.response) {
4436 if (!debug.enabled('leancloud:request')) {
4437 debugRequestError('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
4438 }
4439
4440 debugRequestError('response(%d) %d %O %o', count, error.response.status, error.response.data || error.response.text, error.response.header);
4441 error.statusCode = error.response.status;
4442 error.responseText = error.response.text;
4443 error.response = error.response.data;
4444 }
4445
4446 throw error;
4447 });
4448 return time ? timeout(promise, time) : promise;
4449};
4450
4451module.exports = ajax;
4452
4453/***/ }),
4454/* 118 */
4455/***/ (function(module, exports) {
4456
4457/* (ignored) */
4458
4459/***/ }),
4460/* 119 */
4461/***/ (function(module, exports) {
4462
4463function _typeof(o) {
4464 "@babel/helpers - typeof";
4465
4466 return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
4467 return typeof o;
4468 } : function (o) {
4469 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
4470 }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
4471}
4472module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
4473
4474/***/ }),
4475/* 120 */
4476/***/ (function(module, exports, __webpack_require__) {
4477
4478var Symbol = __webpack_require__(276),
4479 getRawTag = __webpack_require__(684),
4480 objectToString = __webpack_require__(685);
4481
4482/** `Object#toString` result references. */
4483var nullTag = '[object Null]',
4484 undefinedTag = '[object Undefined]';
4485
4486/** Built-in value references. */
4487var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
4488
4489/**
4490 * The base implementation of `getTag` without fallbacks for buggy environments.
4491 *
4492 * @private
4493 * @param {*} value The value to query.
4494 * @returns {string} Returns the `toStringTag`.
4495 */
4496function baseGetTag(value) {
4497 if (value == null) {
4498 return value === undefined ? undefinedTag : nullTag;
4499 }
4500 return (symToStringTag && symToStringTag in Object(value))
4501 ? getRawTag(value)
4502 : objectToString(value);
4503}
4504
4505module.exports = baseGetTag;
4506
4507
4508/***/ }),
4509/* 121 */
4510/***/ (function(module, exports) {
4511
4512/**
4513 * Checks if `value` is object-like. A value is object-like if it's not `null`
4514 * and has a `typeof` result of "object".
4515 *
4516 * @static
4517 * @memberOf _
4518 * @since 4.0.0
4519 * @category Lang
4520 * @param {*} value The value to check.
4521 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
4522 * @example
4523 *
4524 * _.isObjectLike({});
4525 * // => true
4526 *
4527 * _.isObjectLike([1, 2, 3]);
4528 * // => true
4529 *
4530 * _.isObjectLike(_.noop);
4531 * // => false
4532 *
4533 * _.isObjectLike(null);
4534 * // => false
4535 */
4536function isObjectLike(value) {
4537 return value != null && typeof value == 'object';
4538}
4539
4540module.exports = isObjectLike;
4541
4542
4543/***/ }),
4544/* 122 */
4545/***/ (function(module, exports, __webpack_require__) {
4546
4547"use strict";
4548
4549var $propertyIsEnumerable = {}.propertyIsEnumerable;
4550// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
4551var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
4552
4553// Nashorn ~ JDK8 bug
4554var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
4555
4556// `Object.prototype.propertyIsEnumerable` method implementation
4557// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
4558exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
4559 var descriptor = getOwnPropertyDescriptor(this, V);
4560 return !!descriptor && descriptor.enumerable;
4561} : $propertyIsEnumerable;
4562
4563
4564/***/ }),
4565/* 123 */
4566/***/ (function(module, exports, __webpack_require__) {
4567
4568var aCallable = __webpack_require__(29);
4569
4570// `GetMethod` abstract operation
4571// https://tc39.es/ecma262/#sec-getmethod
4572module.exports = function (V, P) {
4573 var func = V[P];
4574 return func == null ? undefined : aCallable(func);
4575};
4576
4577
4578/***/ }),
4579/* 124 */
4580/***/ (function(module, exports, __webpack_require__) {
4581
4582var global = __webpack_require__(8);
4583var defineGlobalProperty = __webpack_require__(293);
4584
4585var SHARED = '__core-js_shared__';
4586var store = global[SHARED] || defineGlobalProperty(SHARED, {});
4587
4588module.exports = store;
4589
4590
4591/***/ }),
4592/* 125 */
4593/***/ (function(module, exports, __webpack_require__) {
4594
4595var global = __webpack_require__(8);
4596var isObject = __webpack_require__(11);
4597
4598var document = global.document;
4599// typeof document.createElement is 'object' in old IE
4600var EXISTS = isObject(document) && isObject(document.createElement);
4601
4602module.exports = function (it) {
4603 return EXISTS ? document.createElement(it) : {};
4604};
4605
4606
4607/***/ }),
4608/* 126 */
4609/***/ (function(module, exports, __webpack_require__) {
4610
4611var toIndexedObject = __webpack_require__(35);
4612var toAbsoluteIndex = __webpack_require__(127);
4613var lengthOfArrayLike = __webpack_require__(40);
4614
4615// `Array.prototype.{ indexOf, includes }` methods implementation
4616var createMethod = function (IS_INCLUDES) {
4617 return function ($this, el, fromIndex) {
4618 var O = toIndexedObject($this);
4619 var length = lengthOfArrayLike(O);
4620 var index = toAbsoluteIndex(fromIndex, length);
4621 var value;
4622 // Array#includes uses SameValueZero equality algorithm
4623 // eslint-disable-next-line no-self-compare -- NaN check
4624 if (IS_INCLUDES && el != el) while (length > index) {
4625 value = O[index++];
4626 // eslint-disable-next-line no-self-compare -- NaN check
4627 if (value != value) return true;
4628 // Array#indexOf ignores holes, Array#includes - not
4629 } else for (;length > index; index++) {
4630 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
4631 } return !IS_INCLUDES && -1;
4632 };
4633};
4634
4635module.exports = {
4636 // `Array.prototype.includes` method
4637 // https://tc39.es/ecma262/#sec-array.prototype.includes
4638 includes: createMethod(true),
4639 // `Array.prototype.indexOf` method
4640 // https://tc39.es/ecma262/#sec-array.prototype.indexof
4641 indexOf: createMethod(false)
4642};
4643
4644
4645/***/ }),
4646/* 127 */
4647/***/ (function(module, exports, __webpack_require__) {
4648
4649var toIntegerOrInfinity = __webpack_require__(128);
4650
4651var max = Math.max;
4652var min = Math.min;
4653
4654// Helper for a popular repeating case of the spec:
4655// Let integer be ? ToInteger(index).
4656// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
4657module.exports = function (index, length) {
4658 var integer = toIntegerOrInfinity(index);
4659 return integer < 0 ? max(integer + length, 0) : min(integer, length);
4660};
4661
4662
4663/***/ }),
4664/* 128 */
4665/***/ (function(module, exports, __webpack_require__) {
4666
4667var trunc = __webpack_require__(296);
4668
4669// `ToIntegerOrInfinity` abstract operation
4670// https://tc39.es/ecma262/#sec-tointegerorinfinity
4671module.exports = function (argument) {
4672 var number = +argument;
4673 // eslint-disable-next-line no-self-compare -- NaN check
4674 return number !== number || number === 0 ? 0 : trunc(number);
4675};
4676
4677
4678/***/ }),
4679/* 129 */
4680/***/ (function(module, exports) {
4681
4682// IE8- don't enum bug keys
4683module.exports = [
4684 'constructor',
4685 'hasOwnProperty',
4686 'isPrototypeOf',
4687 'propertyIsEnumerable',
4688 'toLocaleString',
4689 'toString',
4690 'valueOf'
4691];
4692
4693
4694/***/ }),
4695/* 130 */
4696/***/ (function(module, exports, __webpack_require__) {
4697
4698var DESCRIPTORS = __webpack_require__(14);
4699var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(161);
4700var definePropertyModule = __webpack_require__(23);
4701var anObject = __webpack_require__(21);
4702var toIndexedObject = __webpack_require__(35);
4703var objectKeys = __webpack_require__(107);
4704
4705// `Object.defineProperties` method
4706// https://tc39.es/ecma262/#sec-object.defineproperties
4707// eslint-disable-next-line es-x/no-object-defineproperties -- safe
4708exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
4709 anObject(O);
4710 var props = toIndexedObject(Properties);
4711 var keys = objectKeys(Properties);
4712 var length = keys.length;
4713 var index = 0;
4714 var key;
4715 while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
4716 return O;
4717};
4718
4719
4720/***/ }),
4721/* 131 */
4722/***/ (function(module, exports, __webpack_require__) {
4723
4724var wellKnownSymbol = __webpack_require__(5);
4725
4726var TO_STRING_TAG = wellKnownSymbol('toStringTag');
4727var test = {};
4728
4729test[TO_STRING_TAG] = 'z';
4730
4731module.exports = String(test) === '[object z]';
4732
4733
4734/***/ }),
4735/* 132 */
4736/***/ (function(module, exports) {
4737
4738module.exports = function () { /* empty */ };
4739
4740
4741/***/ }),
4742/* 133 */
4743/***/ (function(module, exports, __webpack_require__) {
4744
4745var uncurryThis = __webpack_require__(4);
4746var isCallable = __webpack_require__(9);
4747var store = __webpack_require__(124);
4748
4749var functionToString = uncurryThis(Function.toString);
4750
4751// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
4752if (!isCallable(store.inspectSource)) {
4753 store.inspectSource = function (it) {
4754 return functionToString(it);
4755 };
4756}
4757
4758module.exports = store.inspectSource;
4759
4760
4761/***/ }),
4762/* 134 */
4763/***/ (function(module, exports, __webpack_require__) {
4764
4765"use strict";
4766
4767var $ = __webpack_require__(0);
4768var call = __webpack_require__(15);
4769var IS_PURE = __webpack_require__(36);
4770var FunctionName = __webpack_require__(170);
4771var isCallable = __webpack_require__(9);
4772var createIteratorConstructor = __webpack_require__(302);
4773var getPrototypeOf = __webpack_require__(102);
4774var setPrototypeOf = __webpack_require__(104);
4775var setToStringTag = __webpack_require__(56);
4776var createNonEnumerableProperty = __webpack_require__(39);
4777var defineBuiltIn = __webpack_require__(45);
4778var wellKnownSymbol = __webpack_require__(5);
4779var Iterators = __webpack_require__(54);
4780var IteratorsCore = __webpack_require__(171);
4781
4782var PROPER_FUNCTION_NAME = FunctionName.PROPER;
4783var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
4784var IteratorPrototype = IteratorsCore.IteratorPrototype;
4785var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
4786var ITERATOR = wellKnownSymbol('iterator');
4787var KEYS = 'keys';
4788var VALUES = 'values';
4789var ENTRIES = 'entries';
4790
4791var returnThis = function () { return this; };
4792
4793module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
4794 createIteratorConstructor(IteratorConstructor, NAME, next);
4795
4796 var getIterationMethod = function (KIND) {
4797 if (KIND === DEFAULT && defaultIterator) return defaultIterator;
4798 if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
4799 switch (KIND) {
4800 case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
4801 case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
4802 case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
4803 } return function () { return new IteratorConstructor(this); };
4804 };
4805
4806 var TO_STRING_TAG = NAME + ' Iterator';
4807 var INCORRECT_VALUES_NAME = false;
4808 var IterablePrototype = Iterable.prototype;
4809 var nativeIterator = IterablePrototype[ITERATOR]
4810 || IterablePrototype['@@iterator']
4811 || DEFAULT && IterablePrototype[DEFAULT];
4812 var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
4813 var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
4814 var CurrentIteratorPrototype, methods, KEY;
4815
4816 // fix native
4817 if (anyNativeIterator) {
4818 CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
4819 if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
4820 if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
4821 if (setPrototypeOf) {
4822 setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
4823 } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {
4824 defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);
4825 }
4826 }
4827 // Set @@toStringTag to native iterators
4828 setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
4829 if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
4830 }
4831 }
4832
4833 // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
4834 if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
4835 if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {
4836 createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
4837 } else {
4838 INCORRECT_VALUES_NAME = true;
4839 defaultIterator = function values() { return call(nativeIterator, this); };
4840 }
4841 }
4842
4843 // export additional methods
4844 if (DEFAULT) {
4845 methods = {
4846 values: getIterationMethod(VALUES),
4847 keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
4848 entries: getIterationMethod(ENTRIES)
4849 };
4850 if (FORCED) for (KEY in methods) {
4851 if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
4852 defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
4853 }
4854 } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
4855 }
4856
4857 // define iterator
4858 if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
4859 defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });
4860 }
4861 Iterators[NAME] = defaultIterator;
4862
4863 return methods;
4864};
4865
4866
4867/***/ }),
4868/* 135 */
4869/***/ (function(module, __webpack_exports__, __webpack_require__) {
4870
4871"use strict";
4872Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
4873/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
4874/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return __WEBPACK_IMPORTED_MODULE_0__setup_js__["e"]; });
4875/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__restArguments_js__ = __webpack_require__(24);
4876/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "restArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__restArguments_js__["a"]; });
4877/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(58);
4878/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return __WEBPACK_IMPORTED_MODULE_2__isObject_js__["a"]; });
4879/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isNull_js__ = __webpack_require__(324);
4880/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return __WEBPACK_IMPORTED_MODULE_3__isNull_js__["a"]; });
4881/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__ = __webpack_require__(180);
4882/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__["a"]; });
4883/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__ = __webpack_require__(181);
4884/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isBoolean", function() { return __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__["a"]; });
4885/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isElement_js__ = __webpack_require__(325);
4886/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isElement", function() { return __WEBPACK_IMPORTED_MODULE_6__isElement_js__["a"]; });
4887/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__isString_js__ = __webpack_require__(136);
4888/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return __WEBPACK_IMPORTED_MODULE_7__isString_js__["a"]; });
4889/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__isNumber_js__ = __webpack_require__(182);
4890/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return __WEBPACK_IMPORTED_MODULE_8__isNumber_js__["a"]; });
4891/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__isDate_js__ = __webpack_require__(326);
4892/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return __WEBPACK_IMPORTED_MODULE_9__isDate_js__["a"]; });
4893/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__ = __webpack_require__(327);
4894/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__["a"]; });
4895/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__isError_js__ = __webpack_require__(328);
4896/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isError", function() { return __WEBPACK_IMPORTED_MODULE_11__isError_js__["a"]; });
4897/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__ = __webpack_require__(183);
4898/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSymbol", function() { return __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__["a"]; });
4899/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__ = __webpack_require__(184);
4900/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__["a"]; });
4901/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__isDataView_js__ = __webpack_require__(137);
4902/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDataView", function() { return __WEBPACK_IMPORTED_MODULE_14__isDataView_js__["a"]; });
4903/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__isArray_js__ = __webpack_require__(59);
4904/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return __WEBPACK_IMPORTED_MODULE_15__isArray_js__["a"]; });
4905/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__isFunction_js__ = __webpack_require__(30);
4906/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return __WEBPACK_IMPORTED_MODULE_16__isFunction_js__["a"]; });
4907/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__isArguments_js__ = __webpack_require__(138);
4908/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArguments", function() { return __WEBPACK_IMPORTED_MODULE_17__isArguments_js__["a"]; });
4909/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__isFinite_js__ = __webpack_require__(330);
4910/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFinite", function() { return __WEBPACK_IMPORTED_MODULE_18__isFinite_js__["a"]; });
4911/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__isNaN_js__ = __webpack_require__(185);
4912/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNaN", function() { return __WEBPACK_IMPORTED_MODULE_19__isNaN_js__["a"]; });
4913/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__ = __webpack_require__(186);
4914/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__["a"]; });
4915/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__ = __webpack_require__(332);
4916/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__["a"]; });
4917/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__isMatch_js__ = __webpack_require__(191);
4918/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMatch", function() { return __WEBPACK_IMPORTED_MODULE_22__isMatch_js__["a"]; });
4919/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__isEqual_js__ = __webpack_require__(333);
4920/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return __WEBPACK_IMPORTED_MODULE_23__isEqual_js__["a"]; });
4921/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__isMap_js__ = __webpack_require__(335);
4922/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMap", function() { return __WEBPACK_IMPORTED_MODULE_24__isMap_js__["a"]; });
4923/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__ = __webpack_require__(336);
4924/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakMap", function() { return __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__["a"]; });
4925/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__isSet_js__ = __webpack_require__(337);
4926/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSet", function() { return __WEBPACK_IMPORTED_MODULE_26__isSet_js__["a"]; });
4927/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__ = __webpack_require__(338);
4928/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakSet", function() { return __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__["a"]; });
4929/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__keys_js__ = __webpack_require__(17);
4930/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return __WEBPACK_IMPORTED_MODULE_28__keys_js__["a"]; });
4931/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__allKeys_js__ = __webpack_require__(87);
4932/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "allKeys", function() { return __WEBPACK_IMPORTED_MODULE_29__allKeys_js__["a"]; });
4933/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__values_js__ = __webpack_require__(71);
4934/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "values", function() { return __WEBPACK_IMPORTED_MODULE_30__values_js__["a"]; });
4935/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__pairs_js__ = __webpack_require__(339);
4936/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return __WEBPACK_IMPORTED_MODULE_31__pairs_js__["a"]; });
4937/* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__invert_js__ = __webpack_require__(192);
4938/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return __WEBPACK_IMPORTED_MODULE_32__invert_js__["a"]; });
4939/* harmony import */ var __WEBPACK_IMPORTED_MODULE_33__functions_js__ = __webpack_require__(193);
4940/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "functions", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
4941/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "methods", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
4942/* harmony import */ var __WEBPACK_IMPORTED_MODULE_34__extend_js__ = __webpack_require__(194);
4943/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return __WEBPACK_IMPORTED_MODULE_34__extend_js__["a"]; });
4944/* harmony import */ var __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__ = __webpack_require__(142);
4945/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extendOwn", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
4946/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
4947/* harmony import */ var __WEBPACK_IMPORTED_MODULE_36__defaults_js__ = __webpack_require__(195);
4948/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return __WEBPACK_IMPORTED_MODULE_36__defaults_js__["a"]; });
4949/* harmony import */ var __WEBPACK_IMPORTED_MODULE_37__create_js__ = __webpack_require__(340);
4950/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return __WEBPACK_IMPORTED_MODULE_37__create_js__["a"]; });
4951/* harmony import */ var __WEBPACK_IMPORTED_MODULE_38__clone_js__ = __webpack_require__(197);
4952/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return __WEBPACK_IMPORTED_MODULE_38__clone_js__["a"]; });
4953/* harmony import */ var __WEBPACK_IMPORTED_MODULE_39__tap_js__ = __webpack_require__(341);
4954/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return __WEBPACK_IMPORTED_MODULE_39__tap_js__["a"]; });
4955/* harmony import */ var __WEBPACK_IMPORTED_MODULE_40__get_js__ = __webpack_require__(198);
4956/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return __WEBPACK_IMPORTED_MODULE_40__get_js__["a"]; });
4957/* harmony import */ var __WEBPACK_IMPORTED_MODULE_41__has_js__ = __webpack_require__(342);
4958/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "has", function() { return __WEBPACK_IMPORTED_MODULE_41__has_js__["a"]; });
4959/* harmony import */ var __WEBPACK_IMPORTED_MODULE_42__mapObject_js__ = __webpack_require__(343);
4960/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mapObject", function() { return __WEBPACK_IMPORTED_MODULE_42__mapObject_js__["a"]; });
4961/* harmony import */ var __WEBPACK_IMPORTED_MODULE_43__identity_js__ = __webpack_require__(144);
4962/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return __WEBPACK_IMPORTED_MODULE_43__identity_js__["a"]; });
4963/* harmony import */ var __WEBPACK_IMPORTED_MODULE_44__constant_js__ = __webpack_require__(187);
4964/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "constant", function() { return __WEBPACK_IMPORTED_MODULE_44__constant_js__["a"]; });
4965/* harmony import */ var __WEBPACK_IMPORTED_MODULE_45__noop_js__ = __webpack_require__(202);
4966/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return __WEBPACK_IMPORTED_MODULE_45__noop_js__["a"]; });
4967/* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__toPath_js__ = __webpack_require__(199);
4968/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toPath", function() { return __WEBPACK_IMPORTED_MODULE_46__toPath_js__["a"]; });
4969/* harmony import */ var __WEBPACK_IMPORTED_MODULE_47__property_js__ = __webpack_require__(145);
4970/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "property", function() { return __WEBPACK_IMPORTED_MODULE_47__property_js__["a"]; });
4971/* harmony import */ var __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__ = __webpack_require__(344);
4972/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "propertyOf", function() { return __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__["a"]; });
4973/* harmony import */ var __WEBPACK_IMPORTED_MODULE_49__matcher_js__ = __webpack_require__(113);
4974/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matcher", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
4975/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
4976/* harmony import */ var __WEBPACK_IMPORTED_MODULE_50__times_js__ = __webpack_require__(345);
4977/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "times", function() { return __WEBPACK_IMPORTED_MODULE_50__times_js__["a"]; });
4978/* harmony import */ var __WEBPACK_IMPORTED_MODULE_51__random_js__ = __webpack_require__(203);
4979/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return __WEBPACK_IMPORTED_MODULE_51__random_js__["a"]; });
4980/* harmony import */ var __WEBPACK_IMPORTED_MODULE_52__now_js__ = __webpack_require__(146);
4981/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "now", function() { return __WEBPACK_IMPORTED_MODULE_52__now_js__["a"]; });
4982/* harmony import */ var __WEBPACK_IMPORTED_MODULE_53__escape_js__ = __webpack_require__(346);
4983/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "escape", function() { return __WEBPACK_IMPORTED_MODULE_53__escape_js__["a"]; });
4984/* harmony import */ var __WEBPACK_IMPORTED_MODULE_54__unescape_js__ = __webpack_require__(347);
4985/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unescape", function() { return __WEBPACK_IMPORTED_MODULE_54__unescape_js__["a"]; });
4986/* harmony import */ var __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__ = __webpack_require__(206);
4987/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "templateSettings", function() { return __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__["a"]; });
4988/* harmony import */ var __WEBPACK_IMPORTED_MODULE_56__template_js__ = __webpack_require__(349);
4989/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "template", function() { return __WEBPACK_IMPORTED_MODULE_56__template_js__["a"]; });
4990/* harmony import */ var __WEBPACK_IMPORTED_MODULE_57__result_js__ = __webpack_require__(350);
4991/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "result", function() { return __WEBPACK_IMPORTED_MODULE_57__result_js__["a"]; });
4992/* harmony import */ var __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__ = __webpack_require__(351);
4993/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniqueId", function() { return __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__["a"]; });
4994/* harmony import */ var __WEBPACK_IMPORTED_MODULE_59__chain_js__ = __webpack_require__(352);
4995/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chain", function() { return __WEBPACK_IMPORTED_MODULE_59__chain_js__["a"]; });
4996/* harmony import */ var __WEBPACK_IMPORTED_MODULE_60__iteratee_js__ = __webpack_require__(201);
4997/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "iteratee", function() { return __WEBPACK_IMPORTED_MODULE_60__iteratee_js__["a"]; });
4998/* harmony import */ var __WEBPACK_IMPORTED_MODULE_61__partial_js__ = __webpack_require__(114);
4999/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partial", function() { return __WEBPACK_IMPORTED_MODULE_61__partial_js__["a"]; });
5000/* harmony import */ var __WEBPACK_IMPORTED_MODULE_62__bind_js__ = __webpack_require__(208);
5001/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return __WEBPACK_IMPORTED_MODULE_62__bind_js__["a"]; });
5002/* harmony import */ var __WEBPACK_IMPORTED_MODULE_63__bindAll_js__ = __webpack_require__(353);
5003/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bindAll", function() { return __WEBPACK_IMPORTED_MODULE_63__bindAll_js__["a"]; });
5004/* harmony import */ var __WEBPACK_IMPORTED_MODULE_64__memoize_js__ = __webpack_require__(354);
5005/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "memoize", function() { return __WEBPACK_IMPORTED_MODULE_64__memoize_js__["a"]; });
5006/* harmony import */ var __WEBPACK_IMPORTED_MODULE_65__delay_js__ = __webpack_require__(209);
5007/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return __WEBPACK_IMPORTED_MODULE_65__delay_js__["a"]; });
5008/* harmony import */ var __WEBPACK_IMPORTED_MODULE_66__defer_js__ = __webpack_require__(355);
5009/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return __WEBPACK_IMPORTED_MODULE_66__defer_js__["a"]; });
5010/* harmony import */ var __WEBPACK_IMPORTED_MODULE_67__throttle_js__ = __webpack_require__(356);
5011/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return __WEBPACK_IMPORTED_MODULE_67__throttle_js__["a"]; });
5012/* harmony import */ var __WEBPACK_IMPORTED_MODULE_68__debounce_js__ = __webpack_require__(357);
5013/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return __WEBPACK_IMPORTED_MODULE_68__debounce_js__["a"]; });
5014/* harmony import */ var __WEBPACK_IMPORTED_MODULE_69__wrap_js__ = __webpack_require__(358);
5015/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "wrap", function() { return __WEBPACK_IMPORTED_MODULE_69__wrap_js__["a"]; });
5016/* harmony import */ var __WEBPACK_IMPORTED_MODULE_70__negate_js__ = __webpack_require__(147);
5017/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return __WEBPACK_IMPORTED_MODULE_70__negate_js__["a"]; });
5018/* harmony import */ var __WEBPACK_IMPORTED_MODULE_71__compose_js__ = __webpack_require__(359);
5019/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return __WEBPACK_IMPORTED_MODULE_71__compose_js__["a"]; });
5020/* harmony import */ var __WEBPACK_IMPORTED_MODULE_72__after_js__ = __webpack_require__(360);
5021/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "after", function() { return __WEBPACK_IMPORTED_MODULE_72__after_js__["a"]; });
5022/* harmony import */ var __WEBPACK_IMPORTED_MODULE_73__before_js__ = __webpack_require__(210);
5023/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "before", function() { return __WEBPACK_IMPORTED_MODULE_73__before_js__["a"]; });
5024/* harmony import */ var __WEBPACK_IMPORTED_MODULE_74__once_js__ = __webpack_require__(361);
5025/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "once", function() { return __WEBPACK_IMPORTED_MODULE_74__once_js__["a"]; });
5026/* harmony import */ var __WEBPACK_IMPORTED_MODULE_75__findKey_js__ = __webpack_require__(211);
5027/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findKey", function() { return __WEBPACK_IMPORTED_MODULE_75__findKey_js__["a"]; });
5028/* harmony import */ var __WEBPACK_IMPORTED_MODULE_76__findIndex_js__ = __webpack_require__(148);
5029/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return __WEBPACK_IMPORTED_MODULE_76__findIndex_js__["a"]; });
5030/* harmony import */ var __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__ = __webpack_require__(213);
5031/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__["a"]; });
5032/* harmony import */ var __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__ = __webpack_require__(214);
5033/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortedIndex", function() { return __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__["a"]; });
5034/* harmony import */ var __WEBPACK_IMPORTED_MODULE_79__indexOf_js__ = __webpack_require__(215);
5035/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return __WEBPACK_IMPORTED_MODULE_79__indexOf_js__["a"]; });
5036/* harmony import */ var __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__ = __webpack_require__(362);
5037/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__["a"]; });
5038/* harmony import */ var __WEBPACK_IMPORTED_MODULE_81__find_js__ = __webpack_require__(217);
5039/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "find", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
5040/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "detect", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
5041/* harmony import */ var __WEBPACK_IMPORTED_MODULE_82__findWhere_js__ = __webpack_require__(363);
5042/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findWhere", function() { return __WEBPACK_IMPORTED_MODULE_82__findWhere_js__["a"]; });
5043/* harmony import */ var __WEBPACK_IMPORTED_MODULE_83__each_js__ = __webpack_require__(60);
5044/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "each", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
5045/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
5046/* harmony import */ var __WEBPACK_IMPORTED_MODULE_84__map_js__ = __webpack_require__(73);
5047/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "map", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
5048/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "collect", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
5049/* harmony import */ var __WEBPACK_IMPORTED_MODULE_85__reduce_js__ = __webpack_require__(364);
5050/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
5051/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldl", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
5052/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
5053/* harmony import */ var __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__ = __webpack_require__(365);
5054/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduceRight", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
5055/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldr", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
5056/* harmony import */ var __WEBPACK_IMPORTED_MODULE_87__filter_js__ = __webpack_require__(90);
5057/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
5058/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
5059/* harmony import */ var __WEBPACK_IMPORTED_MODULE_88__reject_js__ = __webpack_require__(366);
5060/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return __WEBPACK_IMPORTED_MODULE_88__reject_js__["a"]; });
5061/* harmony import */ var __WEBPACK_IMPORTED_MODULE_89__every_js__ = __webpack_require__(367);
5062/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "every", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
5063/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "all", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
5064/* harmony import */ var __WEBPACK_IMPORTED_MODULE_90__some_js__ = __webpack_require__(368);
5065/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "some", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
5066/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "any", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
5067/* harmony import */ var __WEBPACK_IMPORTED_MODULE_91__contains_js__ = __webpack_require__(91);
5068/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
5069/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
5070/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "include", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
5071/* harmony import */ var __WEBPACK_IMPORTED_MODULE_92__invoke_js__ = __webpack_require__(369);
5072/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invoke", function() { return __WEBPACK_IMPORTED_MODULE_92__invoke_js__["a"]; });
5073/* harmony import */ var __WEBPACK_IMPORTED_MODULE_93__pluck_js__ = __webpack_require__(149);
5074/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return __WEBPACK_IMPORTED_MODULE_93__pluck_js__["a"]; });
5075/* harmony import */ var __WEBPACK_IMPORTED_MODULE_94__where_js__ = __webpack_require__(370);
5076/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "where", function() { return __WEBPACK_IMPORTED_MODULE_94__where_js__["a"]; });
5077/* harmony import */ var __WEBPACK_IMPORTED_MODULE_95__max_js__ = __webpack_require__(219);
5078/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "max", function() { return __WEBPACK_IMPORTED_MODULE_95__max_js__["a"]; });
5079/* harmony import */ var __WEBPACK_IMPORTED_MODULE_96__min_js__ = __webpack_require__(371);
5080/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "min", function() { return __WEBPACK_IMPORTED_MODULE_96__min_js__["a"]; });
5081/* harmony import */ var __WEBPACK_IMPORTED_MODULE_97__shuffle_js__ = __webpack_require__(372);
5082/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "shuffle", function() { return __WEBPACK_IMPORTED_MODULE_97__shuffle_js__["a"]; });
5083/* harmony import */ var __WEBPACK_IMPORTED_MODULE_98__sample_js__ = __webpack_require__(220);
5084/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return __WEBPACK_IMPORTED_MODULE_98__sample_js__["a"]; });
5085/* harmony import */ var __WEBPACK_IMPORTED_MODULE_99__sortBy_js__ = __webpack_require__(373);
5086/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return __WEBPACK_IMPORTED_MODULE_99__sortBy_js__["a"]; });
5087/* harmony import */ var __WEBPACK_IMPORTED_MODULE_100__groupBy_js__ = __webpack_require__(374);
5088/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return __WEBPACK_IMPORTED_MODULE_100__groupBy_js__["a"]; });
5089/* harmony import */ var __WEBPACK_IMPORTED_MODULE_101__indexBy_js__ = __webpack_require__(375);
5090/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexBy", function() { return __WEBPACK_IMPORTED_MODULE_101__indexBy_js__["a"]; });
5091/* harmony import */ var __WEBPACK_IMPORTED_MODULE_102__countBy_js__ = __webpack_require__(376);
5092/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "countBy", function() { return __WEBPACK_IMPORTED_MODULE_102__countBy_js__["a"]; });
5093/* harmony import */ var __WEBPACK_IMPORTED_MODULE_103__partition_js__ = __webpack_require__(377);
5094/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return __WEBPACK_IMPORTED_MODULE_103__partition_js__["a"]; });
5095/* harmony import */ var __WEBPACK_IMPORTED_MODULE_104__toArray_js__ = __webpack_require__(378);
5096/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return __WEBPACK_IMPORTED_MODULE_104__toArray_js__["a"]; });
5097/* harmony import */ var __WEBPACK_IMPORTED_MODULE_105__size_js__ = __webpack_require__(379);
5098/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "size", function() { return __WEBPACK_IMPORTED_MODULE_105__size_js__["a"]; });
5099/* harmony import */ var __WEBPACK_IMPORTED_MODULE_106__pick_js__ = __webpack_require__(221);
5100/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return __WEBPACK_IMPORTED_MODULE_106__pick_js__["a"]; });
5101/* harmony import */ var __WEBPACK_IMPORTED_MODULE_107__omit_js__ = __webpack_require__(381);
5102/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "omit", function() { return __WEBPACK_IMPORTED_MODULE_107__omit_js__["a"]; });
5103/* harmony import */ var __WEBPACK_IMPORTED_MODULE_108__first_js__ = __webpack_require__(382);
5104/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "first", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
5105/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "head", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
5106/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "take", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
5107/* harmony import */ var __WEBPACK_IMPORTED_MODULE_109__initial_js__ = __webpack_require__(222);
5108/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "initial", function() { return __WEBPACK_IMPORTED_MODULE_109__initial_js__["a"]; });
5109/* harmony import */ var __WEBPACK_IMPORTED_MODULE_110__last_js__ = __webpack_require__(383);
5110/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "last", function() { return __WEBPACK_IMPORTED_MODULE_110__last_js__["a"]; });
5111/* harmony import */ var __WEBPACK_IMPORTED_MODULE_111__rest_js__ = __webpack_require__(223);
5112/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "rest", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
5113/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tail", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
5114/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "drop", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
5115/* harmony import */ var __WEBPACK_IMPORTED_MODULE_112__compact_js__ = __webpack_require__(384);
5116/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compact", function() { return __WEBPACK_IMPORTED_MODULE_112__compact_js__["a"]; });
5117/* harmony import */ var __WEBPACK_IMPORTED_MODULE_113__flatten_js__ = __webpack_require__(385);
5118/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return __WEBPACK_IMPORTED_MODULE_113__flatten_js__["a"]; });
5119/* harmony import */ var __WEBPACK_IMPORTED_MODULE_114__without_js__ = __webpack_require__(386);
5120/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "without", function() { return __WEBPACK_IMPORTED_MODULE_114__without_js__["a"]; });
5121/* harmony import */ var __WEBPACK_IMPORTED_MODULE_115__uniq_js__ = __webpack_require__(225);
5122/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
5123/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
5124/* harmony import */ var __WEBPACK_IMPORTED_MODULE_116__union_js__ = __webpack_require__(387);
5125/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "union", function() { return __WEBPACK_IMPORTED_MODULE_116__union_js__["a"]; });
5126/* harmony import */ var __WEBPACK_IMPORTED_MODULE_117__intersection_js__ = __webpack_require__(388);
5127/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return __WEBPACK_IMPORTED_MODULE_117__intersection_js__["a"]; });
5128/* harmony import */ var __WEBPACK_IMPORTED_MODULE_118__difference_js__ = __webpack_require__(224);
5129/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return __WEBPACK_IMPORTED_MODULE_118__difference_js__["a"]; });
5130/* harmony import */ var __WEBPACK_IMPORTED_MODULE_119__unzip_js__ = __webpack_require__(226);
5131/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unzip", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
5132/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
5133/* harmony import */ var __WEBPACK_IMPORTED_MODULE_120__zip_js__ = __webpack_require__(389);
5134/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return __WEBPACK_IMPORTED_MODULE_120__zip_js__["a"]; });
5135/* harmony import */ var __WEBPACK_IMPORTED_MODULE_121__object_js__ = __webpack_require__(390);
5136/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "object", function() { return __WEBPACK_IMPORTED_MODULE_121__object_js__["a"]; });
5137/* harmony import */ var __WEBPACK_IMPORTED_MODULE_122__range_js__ = __webpack_require__(391);
5138/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_122__range_js__["a"]; });
5139/* harmony import */ var __WEBPACK_IMPORTED_MODULE_123__chunk_js__ = __webpack_require__(392);
5140/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chunk", function() { return __WEBPACK_IMPORTED_MODULE_123__chunk_js__["a"]; });
5141/* harmony import */ var __WEBPACK_IMPORTED_MODULE_124__mixin_js__ = __webpack_require__(393);
5142/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mixin", function() { return __WEBPACK_IMPORTED_MODULE_124__mixin_js__["a"]; });
5143/* harmony import */ var __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__ = __webpack_require__(394);
5144/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__["a"]; });
5145// Named Exports
5146// =============
5147
5148// Underscore.js 1.12.1
5149// https://underscorejs.org
5150// (c) 2009-2020 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
5151// Underscore may be freely distributed under the MIT license.
5152
5153// Baseline setup.
5154
5155
5156
5157// Object Functions
5158// ----------------
5159// Our most fundamental functions operate on any JavaScript object.
5160// Most functions in Underscore depend on at least one function in this section.
5161
5162// A group of functions that check the types of core JavaScript values.
5163// These are often informally referred to as the "isType" functions.
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191// Functions that treat an object as a dictionary of key-value pairs.
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208// Utility Functions
5209// -----------------
5210// A bit of a grab bag: Predicate-generating functions for use with filters and
5211// loops, string escaping and templating, create random numbers and unique ids,
5212// and functions that facilitate Underscore's chaining and iteration conventions.
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232// Function (ahem) Functions
5233// -------------------------
5234// These functions take a function as an argument and return a new function
5235// as the result. Also known as higher-order functions.
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251// Finders
5252// -------
5253// Functions that extract (the position of) a single element from an object
5254// or array based on some criterion.
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264// Collection Functions
5265// --------------------
5266// Functions that work on any collection of elements: either an array, or
5267// an object of key-value pairs.
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292// `_.pick` and `_.omit` are actually object functions, but we put
5293// them here in order to create a more natural reading order in the
5294// monolithic build as they depend on `_.contains`.
5295
5296
5297
5298// Array Functions
5299// ---------------
5300// Functions that operate on arrays (and array-likes) only, because they’re
5301// expressed in terms of operations on an ordered list of values.
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319// OOP
5320// ---
5321// These modules support the "object-oriented" calling style. See also
5322// `underscore.js` and `index-default.js`.
5323
5324
5325
5326
5327/***/ }),
5328/* 136 */
5329/***/ (function(module, __webpack_exports__, __webpack_require__) {
5330
5331"use strict";
5332/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
5333
5334
5335/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('String'));
5336
5337
5338/***/ }),
5339/* 137 */
5340/***/ (function(module, __webpack_exports__, __webpack_require__) {
5341
5342"use strict";
5343/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
5344/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
5345/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArrayBuffer_js__ = __webpack_require__(184);
5346/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__ = __webpack_require__(86);
5347
5348
5349
5350
5351
5352var isDataView = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('DataView');
5353
5354// In IE 10 - Edge 13, we need a different heuristic
5355// to determine whether an object is a `DataView`.
5356function ie10IsDataView(obj) {
5357 return obj != null && Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj.getInt8) && Object(__WEBPACK_IMPORTED_MODULE_2__isArrayBuffer_js__["a" /* default */])(obj.buffer);
5358}
5359
5360/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__["a" /* hasStringTagBug */] ? ie10IsDataView : isDataView);
5361
5362
5363/***/ }),
5364/* 138 */
5365/***/ (function(module, __webpack_exports__, __webpack_require__) {
5366
5367"use strict";
5368/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
5369/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(47);
5370
5371
5372
5373var isArguments = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Arguments');
5374
5375// Define a fallback version of the method in browsers (ahem, IE < 9), where
5376// there isn't any inspectable "Arguments" type.
5377(function() {
5378 if (!isArguments(arguments)) {
5379 isArguments = function(obj) {
5380 return Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(obj, 'callee');
5381 };
5382 }
5383}());
5384
5385/* harmony default export */ __webpack_exports__["a"] = (isArguments);
5386
5387
5388/***/ }),
5389/* 139 */
5390/***/ (function(module, __webpack_exports__, __webpack_require__) {
5391
5392"use strict";
5393/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(189);
5394
5395
5396// Internal helper to obtain the `byteLength` property of an object.
5397/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('byteLength'));
5398
5399
5400/***/ }),
5401/* 140 */
5402/***/ (function(module, __webpack_exports__, __webpack_require__) {
5403
5404"use strict";
5405/* harmony export (immutable) */ __webpack_exports__["a"] = ie11fingerprint;
5406/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return mapMethods; });
5407/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return weakMapMethods; });
5408/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setMethods; });
5409/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(31);
5410/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
5411/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__allKeys_js__ = __webpack_require__(87);
5412
5413
5414
5415
5416// Since the regular `Object.prototype.toString` type tests don't work for
5417// some types in IE 11, we use a fingerprinting heuristic instead, based
5418// on the methods. It's not great, but it's the best we got.
5419// The fingerprint method lists are defined below.
5420function ie11fingerprint(methods) {
5421 var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(methods);
5422 return function(obj) {
5423 if (obj == null) return false;
5424 // `Map`, `WeakMap` and `Set` have no enumerable keys.
5425 var keys = Object(__WEBPACK_IMPORTED_MODULE_2__allKeys_js__["a" /* default */])(obj);
5426 if (Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(keys)) return false;
5427 for (var i = 0; i < length; i++) {
5428 if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[methods[i]])) return false;
5429 }
5430 // If we are testing against `WeakMap`, we need to ensure that
5431 // `obj` doesn't have a `forEach` method in order to distinguish
5432 // it from a regular `Map`.
5433 return methods !== weakMapMethods || !Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[forEachName]);
5434 };
5435}
5436
5437// In the interest of compact minification, we write
5438// each string in the fingerprints only once.
5439var forEachName = 'forEach',
5440 hasName = 'has',
5441 commonInit = ['clear', 'delete'],
5442 mapTail = ['get', hasName, 'set'];
5443
5444// `Map`, `WeakMap` and `Set` each have slightly different
5445// combinations of the above sublists.
5446var mapMethods = commonInit.concat(forEachName, mapTail),
5447 weakMapMethods = commonInit.concat(mapTail),
5448 setMethods = ['add'].concat(commonInit, forEachName, hasName);
5449
5450
5451/***/ }),
5452/* 141 */
5453/***/ (function(module, __webpack_exports__, __webpack_require__) {
5454
5455"use strict";
5456/* harmony export (immutable) */ __webpack_exports__["a"] = createAssigner;
5457// An internal function for creating assigner functions.
5458function createAssigner(keysFunc, defaults) {
5459 return function(obj) {
5460 var length = arguments.length;
5461 if (defaults) obj = Object(obj);
5462 if (length < 2 || obj == null) return obj;
5463 for (var index = 1; index < length; index++) {
5464 var source = arguments[index],
5465 keys = keysFunc(source),
5466 l = keys.length;
5467 for (var i = 0; i < l; i++) {
5468 var key = keys[i];
5469 if (!defaults || obj[key] === void 0) obj[key] = source[key];
5470 }
5471 }
5472 return obj;
5473 };
5474}
5475
5476
5477/***/ }),
5478/* 142 */
5479/***/ (function(module, __webpack_exports__, __webpack_require__) {
5480
5481"use strict";
5482/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(141);
5483/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(17);
5484
5485
5486
5487// Assigns a given object with all the own properties in the passed-in
5488// object(s).
5489// (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
5490/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */]));
5491
5492
5493/***/ }),
5494/* 143 */
5495/***/ (function(module, __webpack_exports__, __webpack_require__) {
5496
5497"use strict";
5498/* harmony export (immutable) */ __webpack_exports__["a"] = deepGet;
5499// Internal function to obtain a nested property in `obj` along `path`.
5500function deepGet(obj, path) {
5501 var length = path.length;
5502 for (var i = 0; i < length; i++) {
5503 if (obj == null) return void 0;
5504 obj = obj[path[i]];
5505 }
5506 return length ? obj : void 0;
5507}
5508
5509
5510/***/ }),
5511/* 144 */
5512/***/ (function(module, __webpack_exports__, __webpack_require__) {
5513
5514"use strict";
5515/* harmony export (immutable) */ __webpack_exports__["a"] = identity;
5516// Keep the identity function around for default iteratees.
5517function identity(value) {
5518 return value;
5519}
5520
5521
5522/***/ }),
5523/* 145 */
5524/***/ (function(module, __webpack_exports__, __webpack_require__) {
5525
5526"use strict";
5527/* harmony export (immutable) */ __webpack_exports__["a"] = property;
5528/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__deepGet_js__ = __webpack_require__(143);
5529/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(88);
5530
5531
5532
5533// Creates a function that, when passed an object, will traverse that object’s
5534// properties down the given `path`, specified as an array of keys or indices.
5535function property(path) {
5536 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
5537 return function(obj) {
5538 return Object(__WEBPACK_IMPORTED_MODULE_0__deepGet_js__["a" /* default */])(obj, path);
5539 };
5540}
5541
5542
5543/***/ }),
5544/* 146 */
5545/***/ (function(module, __webpack_exports__, __webpack_require__) {
5546
5547"use strict";
5548// A (possibly faster) way to get the current timestamp as an integer.
5549/* harmony default export */ __webpack_exports__["a"] = (Date.now || function() {
5550 return new Date().getTime();
5551});
5552
5553
5554/***/ }),
5555/* 147 */
5556/***/ (function(module, __webpack_exports__, __webpack_require__) {
5557
5558"use strict";
5559/* harmony export (immutable) */ __webpack_exports__["a"] = negate;
5560// Returns a negated version of the passed-in predicate.
5561function negate(predicate) {
5562 return function() {
5563 return !predicate.apply(this, arguments);
5564 };
5565}
5566
5567
5568/***/ }),
5569/* 148 */
5570/***/ (function(module, __webpack_exports__, __webpack_require__) {
5571
5572"use strict";
5573/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(212);
5574
5575
5576// Returns the first index on an array-like that passes a truth test.
5577/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(1));
5578
5579
5580/***/ }),
5581/* 149 */
5582/***/ (function(module, __webpack_exports__, __webpack_require__) {
5583
5584"use strict";
5585/* harmony export (immutable) */ __webpack_exports__["a"] = pluck;
5586/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__map_js__ = __webpack_require__(73);
5587/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__property_js__ = __webpack_require__(145);
5588
5589
5590
5591// Convenience version of a common use case of `_.map`: fetching a property.
5592function pluck(obj, key) {
5593 return Object(__WEBPACK_IMPORTED_MODULE_0__map_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__property_js__["a" /* default */])(key));
5594}
5595
5596
5597/***/ }),
5598/* 150 */
5599/***/ (function(module, exports, __webpack_require__) {
5600
5601module.exports = __webpack_require__(404);
5602
5603/***/ }),
5604/* 151 */
5605/***/ (function(module, exports, __webpack_require__) {
5606
5607"use strict";
5608
5609var fails = __webpack_require__(2);
5610
5611module.exports = function (METHOD_NAME, argument) {
5612 var method = [][METHOD_NAME];
5613 return !!method && fails(function () {
5614 // eslint-disable-next-line no-useless-call -- required for testing
5615 method.call(null, argument || function () { return 1; }, 1);
5616 });
5617};
5618
5619
5620/***/ }),
5621/* 152 */
5622/***/ (function(module, exports, __webpack_require__) {
5623
5624var wellKnownSymbol = __webpack_require__(5);
5625
5626exports.f = wellKnownSymbol;
5627
5628
5629/***/ }),
5630/* 153 */
5631/***/ (function(module, exports, __webpack_require__) {
5632
5633module.exports = __webpack_require__(252);
5634
5635/***/ }),
5636/* 154 */
5637/***/ (function(module, exports, __webpack_require__) {
5638
5639module.exports = __webpack_require__(506);
5640
5641/***/ }),
5642/* 155 */
5643/***/ (function(module, exports, __webpack_require__) {
5644
5645module.exports = __webpack_require__(249);
5646
5647/***/ }),
5648/* 156 */
5649/***/ (function(module, exports, __webpack_require__) {
5650
5651"use strict";
5652
5653
5654module.exports = __webpack_require__(623);
5655
5656/***/ }),
5657/* 157 */
5658/***/ (function(module, exports, __webpack_require__) {
5659
5660var defineBuiltIn = __webpack_require__(45);
5661
5662module.exports = function (target, src, options) {
5663 for (var key in src) {
5664 if (options && options.unsafe && target[key]) target[key] = src[key];
5665 else defineBuiltIn(target, key, src[key], options);
5666 } return target;
5667};
5668
5669
5670/***/ }),
5671/* 158 */
5672/***/ (function(module, exports, __webpack_require__) {
5673
5674/* eslint-disable es-x/no-symbol -- required for testing */
5675var NATIVE_SYMBOL = __webpack_require__(65);
5676
5677module.exports = NATIVE_SYMBOL
5678 && !Symbol.sham
5679 && typeof Symbol.iterator == 'symbol';
5680
5681
5682/***/ }),
5683/* 159 */
5684/***/ (function(module, exports, __webpack_require__) {
5685
5686var DESCRIPTORS = __webpack_require__(14);
5687var fails = __webpack_require__(2);
5688var createElement = __webpack_require__(125);
5689
5690// Thanks to IE8 for its funny defineProperty
5691module.exports = !DESCRIPTORS && !fails(function () {
5692 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
5693 return Object.defineProperty(createElement('div'), 'a', {
5694 get: function () { return 7; }
5695 }).a != 7;
5696});
5697
5698
5699/***/ }),
5700/* 160 */
5701/***/ (function(module, exports, __webpack_require__) {
5702
5703var fails = __webpack_require__(2);
5704var isCallable = __webpack_require__(9);
5705
5706var replacement = /#|\.prototype\./;
5707
5708var isForced = function (feature, detection) {
5709 var value = data[normalize(feature)];
5710 return value == POLYFILL ? true
5711 : value == NATIVE ? false
5712 : isCallable(detection) ? fails(detection)
5713 : !!detection;
5714};
5715
5716var normalize = isForced.normalize = function (string) {
5717 return String(string).replace(replacement, '.').toLowerCase();
5718};
5719
5720var data = isForced.data = {};
5721var NATIVE = isForced.NATIVE = 'N';
5722var POLYFILL = isForced.POLYFILL = 'P';
5723
5724module.exports = isForced;
5725
5726
5727/***/ }),
5728/* 161 */
5729/***/ (function(module, exports, __webpack_require__) {
5730
5731var DESCRIPTORS = __webpack_require__(14);
5732var fails = __webpack_require__(2);
5733
5734// V8 ~ Chrome 36-
5735// https://bugs.chromium.org/p/v8/issues/detail?id=3334
5736module.exports = DESCRIPTORS && fails(function () {
5737 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
5738 return Object.defineProperty(function () { /* empty */ }, 'prototype', {
5739 value: 42,
5740 writable: false
5741 }).prototype != 42;
5742});
5743
5744
5745/***/ }),
5746/* 162 */
5747/***/ (function(module, exports, __webpack_require__) {
5748
5749var fails = __webpack_require__(2);
5750
5751module.exports = !fails(function () {
5752 function F() { /* empty */ }
5753 F.prototype.constructor = null;
5754 // eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing
5755 return Object.getPrototypeOf(new F()) !== F.prototype;
5756});
5757
5758
5759/***/ }),
5760/* 163 */
5761/***/ (function(module, exports, __webpack_require__) {
5762
5763var getBuiltIn = __webpack_require__(20);
5764var uncurryThis = __webpack_require__(4);
5765var getOwnPropertyNamesModule = __webpack_require__(105);
5766var getOwnPropertySymbolsModule = __webpack_require__(106);
5767var anObject = __webpack_require__(21);
5768
5769var concat = uncurryThis([].concat);
5770
5771// all object keys, includes non-enumerable and symbols
5772module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
5773 var keys = getOwnPropertyNamesModule.f(anObject(it));
5774 var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
5775 return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
5776};
5777
5778
5779/***/ }),
5780/* 164 */
5781/***/ (function(module, exports, __webpack_require__) {
5782
5783var uncurryThis = __webpack_require__(4);
5784var hasOwn = __webpack_require__(13);
5785var toIndexedObject = __webpack_require__(35);
5786var indexOf = __webpack_require__(126).indexOf;
5787var hiddenKeys = __webpack_require__(83);
5788
5789var push = uncurryThis([].push);
5790
5791module.exports = function (object, names) {
5792 var O = toIndexedObject(object);
5793 var i = 0;
5794 var result = [];
5795 var key;
5796 for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
5797 // Don't enum bug & hidden keys
5798 while (names.length > i) if (hasOwn(O, key = names[i++])) {
5799 ~indexOf(result, key) || push(result, key);
5800 }
5801 return result;
5802};
5803
5804
5805/***/ }),
5806/* 165 */
5807/***/ (function(module, exports, __webpack_require__) {
5808
5809var getBuiltIn = __webpack_require__(20);
5810
5811module.exports = getBuiltIn('document', 'documentElement');
5812
5813
5814/***/ }),
5815/* 166 */
5816/***/ (function(module, exports, __webpack_require__) {
5817
5818var wellKnownSymbol = __webpack_require__(5);
5819var Iterators = __webpack_require__(54);
5820
5821var ITERATOR = wellKnownSymbol('iterator');
5822var ArrayPrototype = Array.prototype;
5823
5824// check on default Array iterator
5825module.exports = function (it) {
5826 return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
5827};
5828
5829
5830/***/ }),
5831/* 167 */
5832/***/ (function(module, exports, __webpack_require__) {
5833
5834var call = __webpack_require__(15);
5835var aCallable = __webpack_require__(29);
5836var anObject = __webpack_require__(21);
5837var tryToString = __webpack_require__(67);
5838var getIteratorMethod = __webpack_require__(108);
5839
5840var $TypeError = TypeError;
5841
5842module.exports = function (argument, usingIterator) {
5843 var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
5844 if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));
5845 throw $TypeError(tryToString(argument) + ' is not iterable');
5846};
5847
5848
5849/***/ }),
5850/* 168 */
5851/***/ (function(module, exports, __webpack_require__) {
5852
5853var call = __webpack_require__(15);
5854var anObject = __webpack_require__(21);
5855var getMethod = __webpack_require__(123);
5856
5857module.exports = function (iterator, kind, value) {
5858 var innerResult, innerError;
5859 anObject(iterator);
5860 try {
5861 innerResult = getMethod(iterator, 'return');
5862 if (!innerResult) {
5863 if (kind === 'throw') throw value;
5864 return value;
5865 }
5866 innerResult = call(innerResult, iterator);
5867 } catch (error) {
5868 innerError = true;
5869 innerResult = error;
5870 }
5871 if (kind === 'throw') throw value;
5872 if (innerError) throw innerResult;
5873 anObject(innerResult);
5874 return value;
5875};
5876
5877
5878/***/ }),
5879/* 169 */
5880/***/ (function(module, exports, __webpack_require__) {
5881
5882var global = __webpack_require__(8);
5883var isCallable = __webpack_require__(9);
5884var inspectSource = __webpack_require__(133);
5885
5886var WeakMap = global.WeakMap;
5887
5888module.exports = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap));
5889
5890
5891/***/ }),
5892/* 170 */
5893/***/ (function(module, exports, __webpack_require__) {
5894
5895var DESCRIPTORS = __webpack_require__(14);
5896var hasOwn = __webpack_require__(13);
5897
5898var FunctionPrototype = Function.prototype;
5899// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
5900var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
5901
5902var EXISTS = hasOwn(FunctionPrototype, 'name');
5903// additional protection from minified / mangled / dropped function names
5904var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
5905var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
5906
5907module.exports = {
5908 EXISTS: EXISTS,
5909 PROPER: PROPER,
5910 CONFIGURABLE: CONFIGURABLE
5911};
5912
5913
5914/***/ }),
5915/* 171 */
5916/***/ (function(module, exports, __webpack_require__) {
5917
5918"use strict";
5919
5920var fails = __webpack_require__(2);
5921var isCallable = __webpack_require__(9);
5922var create = __webpack_require__(53);
5923var getPrototypeOf = __webpack_require__(102);
5924var defineBuiltIn = __webpack_require__(45);
5925var wellKnownSymbol = __webpack_require__(5);
5926var IS_PURE = __webpack_require__(36);
5927
5928var ITERATOR = wellKnownSymbol('iterator');
5929var BUGGY_SAFARI_ITERATORS = false;
5930
5931// `%IteratorPrototype%` object
5932// https://tc39.es/ecma262/#sec-%iteratorprototype%-object
5933var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
5934
5935/* eslint-disable es-x/no-array-prototype-keys -- safe */
5936if ([].keys) {
5937 arrayIterator = [].keys();
5938 // Safari 8 has buggy iterators w/o `next`
5939 if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
5940 else {
5941 PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
5942 if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
5943 }
5944}
5945
5946var NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function () {
5947 var test = {};
5948 // FF44- legacy iterators case
5949 return IteratorPrototype[ITERATOR].call(test) !== test;
5950});
5951
5952if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
5953else if (IS_PURE) IteratorPrototype = create(IteratorPrototype);
5954
5955// `%IteratorPrototype%[@@iterator]()` method
5956// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
5957if (!isCallable(IteratorPrototype[ITERATOR])) {
5958 defineBuiltIn(IteratorPrototype, ITERATOR, function () {
5959 return this;
5960 });
5961}
5962
5963module.exports = {
5964 IteratorPrototype: IteratorPrototype,
5965 BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
5966};
5967
5968
5969/***/ }),
5970/* 172 */
5971/***/ (function(module, exports, __webpack_require__) {
5972
5973"use strict";
5974
5975var getBuiltIn = __webpack_require__(20);
5976var definePropertyModule = __webpack_require__(23);
5977var wellKnownSymbol = __webpack_require__(5);
5978var DESCRIPTORS = __webpack_require__(14);
5979
5980var SPECIES = wellKnownSymbol('species');
5981
5982module.exports = function (CONSTRUCTOR_NAME) {
5983 var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
5984 var defineProperty = definePropertyModule.f;
5985
5986 if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
5987 defineProperty(Constructor, SPECIES, {
5988 configurable: true,
5989 get: function () { return this; }
5990 });
5991 }
5992};
5993
5994
5995/***/ }),
5996/* 173 */
5997/***/ (function(module, exports, __webpack_require__) {
5998
5999var anObject = __webpack_require__(21);
6000var aConstructor = __webpack_require__(174);
6001var wellKnownSymbol = __webpack_require__(5);
6002
6003var SPECIES = wellKnownSymbol('species');
6004
6005// `SpeciesConstructor` abstract operation
6006// https://tc39.es/ecma262/#sec-speciesconstructor
6007module.exports = function (O, defaultConstructor) {
6008 var C = anObject(O).constructor;
6009 var S;
6010 return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aConstructor(S);
6011};
6012
6013
6014/***/ }),
6015/* 174 */
6016/***/ (function(module, exports, __webpack_require__) {
6017
6018var isConstructor = __webpack_require__(111);
6019var tryToString = __webpack_require__(67);
6020
6021var $TypeError = TypeError;
6022
6023// `Assert: IsConstructor(argument) is true`
6024module.exports = function (argument) {
6025 if (isConstructor(argument)) return argument;
6026 throw $TypeError(tryToString(argument) + ' is not a constructor');
6027};
6028
6029
6030/***/ }),
6031/* 175 */
6032/***/ (function(module, exports, __webpack_require__) {
6033
6034var global = __webpack_require__(8);
6035var apply = __webpack_require__(79);
6036var bind = __webpack_require__(52);
6037var isCallable = __webpack_require__(9);
6038var hasOwn = __webpack_require__(13);
6039var fails = __webpack_require__(2);
6040var html = __webpack_require__(165);
6041var arraySlice = __webpack_require__(112);
6042var createElement = __webpack_require__(125);
6043var validateArgumentsLength = __webpack_require__(306);
6044var IS_IOS = __webpack_require__(176);
6045var IS_NODE = __webpack_require__(109);
6046
6047var set = global.setImmediate;
6048var clear = global.clearImmediate;
6049var process = global.process;
6050var Dispatch = global.Dispatch;
6051var Function = global.Function;
6052var MessageChannel = global.MessageChannel;
6053var String = global.String;
6054var counter = 0;
6055var queue = {};
6056var ONREADYSTATECHANGE = 'onreadystatechange';
6057var location, defer, channel, port;
6058
6059try {
6060 // Deno throws a ReferenceError on `location` access without `--location` flag
6061 location = global.location;
6062} catch (error) { /* empty */ }
6063
6064var run = function (id) {
6065 if (hasOwn(queue, id)) {
6066 var fn = queue[id];
6067 delete queue[id];
6068 fn();
6069 }
6070};
6071
6072var runner = function (id) {
6073 return function () {
6074 run(id);
6075 };
6076};
6077
6078var listener = function (event) {
6079 run(event.data);
6080};
6081
6082var post = function (id) {
6083 // old engines have not location.origin
6084 global.postMessage(String(id), location.protocol + '//' + location.host);
6085};
6086
6087// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
6088if (!set || !clear) {
6089 set = function setImmediate(handler) {
6090 validateArgumentsLength(arguments.length, 1);
6091 var fn = isCallable(handler) ? handler : Function(handler);
6092 var args = arraySlice(arguments, 1);
6093 queue[++counter] = function () {
6094 apply(fn, undefined, args);
6095 };
6096 defer(counter);
6097 return counter;
6098 };
6099 clear = function clearImmediate(id) {
6100 delete queue[id];
6101 };
6102 // Node.js 0.8-
6103 if (IS_NODE) {
6104 defer = function (id) {
6105 process.nextTick(runner(id));
6106 };
6107 // Sphere (JS game engine) Dispatch API
6108 } else if (Dispatch && Dispatch.now) {
6109 defer = function (id) {
6110 Dispatch.now(runner(id));
6111 };
6112 // Browsers with MessageChannel, includes WebWorkers
6113 // except iOS - https://github.com/zloirock/core-js/issues/624
6114 } else if (MessageChannel && !IS_IOS) {
6115 channel = new MessageChannel();
6116 port = channel.port2;
6117 channel.port1.onmessage = listener;
6118 defer = bind(port.postMessage, port);
6119 // Browsers with postMessage, skip WebWorkers
6120 // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
6121 } else if (
6122 global.addEventListener &&
6123 isCallable(global.postMessage) &&
6124 !global.importScripts &&
6125 location && location.protocol !== 'file:' &&
6126 !fails(post)
6127 ) {
6128 defer = post;
6129 global.addEventListener('message', listener, false);
6130 // IE8-
6131 } else if (ONREADYSTATECHANGE in createElement('script')) {
6132 defer = function (id) {
6133 html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
6134 html.removeChild(this);
6135 run(id);
6136 };
6137 };
6138 // Rest old browsers
6139 } else {
6140 defer = function (id) {
6141 setTimeout(runner(id), 0);
6142 };
6143 }
6144}
6145
6146module.exports = {
6147 set: set,
6148 clear: clear
6149};
6150
6151
6152/***/ }),
6153/* 176 */
6154/***/ (function(module, exports, __webpack_require__) {
6155
6156var userAgent = __webpack_require__(51);
6157
6158module.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent);
6159
6160
6161/***/ }),
6162/* 177 */
6163/***/ (function(module, exports, __webpack_require__) {
6164
6165var NativePromiseConstructor = __webpack_require__(69);
6166var checkCorrectnessOfIteration = __webpack_require__(178);
6167var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(85).CONSTRUCTOR;
6168
6169module.exports = FORCED_PROMISE_CONSTRUCTOR || !checkCorrectnessOfIteration(function (iterable) {
6170 NativePromiseConstructor.all(iterable).then(undefined, function () { /* empty */ });
6171});
6172
6173
6174/***/ }),
6175/* 178 */
6176/***/ (function(module, exports, __webpack_require__) {
6177
6178var wellKnownSymbol = __webpack_require__(5);
6179
6180var ITERATOR = wellKnownSymbol('iterator');
6181var SAFE_CLOSING = false;
6182
6183try {
6184 var called = 0;
6185 var iteratorWithReturn = {
6186 next: function () {
6187 return { done: !!called++ };
6188 },
6189 'return': function () {
6190 SAFE_CLOSING = true;
6191 }
6192 };
6193 iteratorWithReturn[ITERATOR] = function () {
6194 return this;
6195 };
6196 // eslint-disable-next-line es-x/no-array-from, no-throw-literal -- required for testing
6197 Array.from(iteratorWithReturn, function () { throw 2; });
6198} catch (error) { /* empty */ }
6199
6200module.exports = function (exec, SKIP_CLOSING) {
6201 if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
6202 var ITERATION_SUPPORT = false;
6203 try {
6204 var object = {};
6205 object[ITERATOR] = function () {
6206 return {
6207 next: function () {
6208 return { done: ITERATION_SUPPORT = true };
6209 }
6210 };
6211 };
6212 exec(object);
6213 } catch (error) { /* empty */ }
6214 return ITERATION_SUPPORT;
6215};
6216
6217
6218/***/ }),
6219/* 179 */
6220/***/ (function(module, exports, __webpack_require__) {
6221
6222var anObject = __webpack_require__(21);
6223var isObject = __webpack_require__(11);
6224var newPromiseCapability = __webpack_require__(57);
6225
6226module.exports = function (C, x) {
6227 anObject(C);
6228 if (isObject(x) && x.constructor === C) return x;
6229 var promiseCapability = newPromiseCapability.f(C);
6230 var resolve = promiseCapability.resolve;
6231 resolve(x);
6232 return promiseCapability.promise;
6233};
6234
6235
6236/***/ }),
6237/* 180 */
6238/***/ (function(module, __webpack_exports__, __webpack_require__) {
6239
6240"use strict";
6241/* harmony export (immutable) */ __webpack_exports__["a"] = isUndefined;
6242// Is a given variable undefined?
6243function isUndefined(obj) {
6244 return obj === void 0;
6245}
6246
6247
6248/***/ }),
6249/* 181 */
6250/***/ (function(module, __webpack_exports__, __webpack_require__) {
6251
6252"use strict";
6253/* harmony export (immutable) */ __webpack_exports__["a"] = isBoolean;
6254/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6255
6256
6257// Is a given value a boolean?
6258function isBoolean(obj) {
6259 return obj === true || obj === false || __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === '[object Boolean]';
6260}
6261
6262
6263/***/ }),
6264/* 182 */
6265/***/ (function(module, __webpack_exports__, __webpack_require__) {
6266
6267"use strict";
6268/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
6269
6270
6271/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Number'));
6272
6273
6274/***/ }),
6275/* 183 */
6276/***/ (function(module, __webpack_exports__, __webpack_require__) {
6277
6278"use strict";
6279/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
6280
6281
6282/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Symbol'));
6283
6284
6285/***/ }),
6286/* 184 */
6287/***/ (function(module, __webpack_exports__, __webpack_require__) {
6288
6289"use strict";
6290/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
6291
6292
6293/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('ArrayBuffer'));
6294
6295
6296/***/ }),
6297/* 185 */
6298/***/ (function(module, __webpack_exports__, __webpack_require__) {
6299
6300"use strict";
6301/* harmony export (immutable) */ __webpack_exports__["a"] = isNaN;
6302/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6303/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isNumber_js__ = __webpack_require__(182);
6304
6305
6306
6307// Is the given value `NaN`?
6308function isNaN(obj) {
6309 return Object(__WEBPACK_IMPORTED_MODULE_1__isNumber_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["g" /* _isNaN */])(obj);
6310}
6311
6312
6313/***/ }),
6314/* 186 */
6315/***/ (function(module, __webpack_exports__, __webpack_require__) {
6316
6317"use strict";
6318/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6319/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isDataView_js__ = __webpack_require__(137);
6320/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constant_js__ = __webpack_require__(187);
6321/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__ = __webpack_require__(331);
6322
6323
6324
6325
6326
6327// Is a given value a typed array?
6328var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
6329function isTypedArray(obj) {
6330 // `ArrayBuffer.isView` is the most future-proof, so use it when available.
6331 // Otherwise, fall back on the above regular expression.
6332 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["l" /* nativeIsView */] ? (Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["l" /* nativeIsView */])(obj) && !Object(__WEBPACK_IMPORTED_MODULE_1__isDataView_js__["a" /* default */])(obj)) :
6333 Object(__WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__["a" /* default */])(obj) && typedArrayPattern.test(__WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj));
6334}
6335
6336/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__setup_js__["r" /* supportsArrayBuffer */] ? isTypedArray : Object(__WEBPACK_IMPORTED_MODULE_2__constant_js__["a" /* default */])(false));
6337
6338
6339/***/ }),
6340/* 187 */
6341/***/ (function(module, __webpack_exports__, __webpack_require__) {
6342
6343"use strict";
6344/* harmony export (immutable) */ __webpack_exports__["a"] = constant;
6345// Predicate-generating function. Often useful outside of Underscore.
6346function constant(value) {
6347 return function() {
6348 return value;
6349 };
6350}
6351
6352
6353/***/ }),
6354/* 188 */
6355/***/ (function(module, __webpack_exports__, __webpack_require__) {
6356
6357"use strict";
6358/* harmony export (immutable) */ __webpack_exports__["a"] = createSizePropertyCheck;
6359/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6360
6361
6362// Common internal logic for `isArrayLike` and `isBufferLike`.
6363function createSizePropertyCheck(getSizeProperty) {
6364 return function(collection) {
6365 var sizeProperty = getSizeProperty(collection);
6366 return typeof sizeProperty == 'number' && sizeProperty >= 0 && sizeProperty <= __WEBPACK_IMPORTED_MODULE_0__setup_js__["b" /* MAX_ARRAY_INDEX */];
6367 }
6368}
6369
6370
6371/***/ }),
6372/* 189 */
6373/***/ (function(module, __webpack_exports__, __webpack_require__) {
6374
6375"use strict";
6376/* harmony export (immutable) */ __webpack_exports__["a"] = shallowProperty;
6377// Internal helper to generate a function to obtain property `key` from `obj`.
6378function shallowProperty(key) {
6379 return function(obj) {
6380 return obj == null ? void 0 : obj[key];
6381 };
6382}
6383
6384
6385/***/ }),
6386/* 190 */
6387/***/ (function(module, __webpack_exports__, __webpack_require__) {
6388
6389"use strict";
6390/* harmony export (immutable) */ __webpack_exports__["a"] = collectNonEnumProps;
6391/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6392/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
6393/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(47);
6394
6395
6396
6397
6398// Internal helper to create a simple lookup structure.
6399// `collectNonEnumProps` used to depend on `_.contains`, but this led to
6400// circular imports. `emulatedSet` is a one-off solution that only works for
6401// arrays of strings.
6402function emulatedSet(keys) {
6403 var hash = {};
6404 for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true;
6405 return {
6406 contains: function(key) { return hash[key]; },
6407 push: function(key) {
6408 hash[key] = true;
6409 return keys.push(key);
6410 }
6411 };
6412}
6413
6414// Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't
6415// be iterated by `for key in ...` and thus missed. Extends `keys` in place if
6416// needed.
6417function collectNonEnumProps(obj, keys) {
6418 keys = emulatedSet(keys);
6419 var nonEnumIdx = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */].length;
6420 var constructor = obj.constructor;
6421 var proto = Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(constructor) && constructor.prototype || __WEBPACK_IMPORTED_MODULE_0__setup_js__["c" /* ObjProto */];
6422
6423 // Constructor is a special case.
6424 var prop = 'constructor';
6425 if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, prop) && !keys.contains(prop)) keys.push(prop);
6426
6427 while (nonEnumIdx--) {
6428 prop = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */][nonEnumIdx];
6429 if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) {
6430 keys.push(prop);
6431 }
6432 }
6433}
6434
6435
6436/***/ }),
6437/* 191 */
6438/***/ (function(module, __webpack_exports__, __webpack_require__) {
6439
6440"use strict";
6441/* harmony export (immutable) */ __webpack_exports__["a"] = isMatch;
6442/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(17);
6443
6444
6445// Returns whether an object has a given set of `key:value` pairs.
6446function isMatch(object, attrs) {
6447 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(attrs), length = _keys.length;
6448 if (object == null) return !length;
6449 var obj = Object(object);
6450 for (var i = 0; i < length; i++) {
6451 var key = _keys[i];
6452 if (attrs[key] !== obj[key] || !(key in obj)) return false;
6453 }
6454 return true;
6455}
6456
6457
6458/***/ }),
6459/* 192 */
6460/***/ (function(module, __webpack_exports__, __webpack_require__) {
6461
6462"use strict";
6463/* harmony export (immutable) */ __webpack_exports__["a"] = invert;
6464/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(17);
6465
6466
6467// Invert the keys and values of an object. The values must be serializable.
6468function invert(obj) {
6469 var result = {};
6470 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
6471 for (var i = 0, length = _keys.length; i < length; i++) {
6472 result[obj[_keys[i]]] = _keys[i];
6473 }
6474 return result;
6475}
6476
6477
6478/***/ }),
6479/* 193 */
6480/***/ (function(module, __webpack_exports__, __webpack_require__) {
6481
6482"use strict";
6483/* harmony export (immutable) */ __webpack_exports__["a"] = functions;
6484/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(30);
6485
6486
6487// Return a sorted list of the function names available on the object.
6488function functions(obj) {
6489 var names = [];
6490 for (var key in obj) {
6491 if (Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(obj[key])) names.push(key);
6492 }
6493 return names.sort();
6494}
6495
6496
6497/***/ }),
6498/* 194 */
6499/***/ (function(module, __webpack_exports__, __webpack_require__) {
6500
6501"use strict";
6502/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(141);
6503/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(87);
6504
6505
6506
6507// Extend a given object with all the properties in passed-in object(s).
6508/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */]));
6509
6510
6511/***/ }),
6512/* 195 */
6513/***/ (function(module, __webpack_exports__, __webpack_require__) {
6514
6515"use strict";
6516/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(141);
6517/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(87);
6518
6519
6520
6521// Fill in a given object with default properties.
6522/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */], true));
6523
6524
6525/***/ }),
6526/* 196 */
6527/***/ (function(module, __webpack_exports__, __webpack_require__) {
6528
6529"use strict";
6530/* harmony export (immutable) */ __webpack_exports__["a"] = baseCreate;
6531/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(58);
6532/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
6533
6534
6535
6536// Create a naked function reference for surrogate-prototype-swapping.
6537function ctor() {
6538 return function(){};
6539}
6540
6541// An internal function for creating a new object that inherits from another.
6542function baseCreate(prototype) {
6543 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(prototype)) return {};
6544 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */])(prototype);
6545 var Ctor = ctor();
6546 Ctor.prototype = prototype;
6547 var result = new Ctor;
6548 Ctor.prototype = null;
6549 return result;
6550}
6551
6552
6553/***/ }),
6554/* 197 */
6555/***/ (function(module, __webpack_exports__, __webpack_require__) {
6556
6557"use strict";
6558/* harmony export (immutable) */ __webpack_exports__["a"] = clone;
6559/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(58);
6560/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(59);
6561/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__extend_js__ = __webpack_require__(194);
6562
6563
6564
6565
6566// Create a (shallow-cloned) duplicate of an object.
6567function clone(obj) {
6568 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return obj;
6569 return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(obj) ? obj.slice() : Object(__WEBPACK_IMPORTED_MODULE_2__extend_js__["a" /* default */])({}, obj);
6570}
6571
6572
6573/***/ }),
6574/* 198 */
6575/***/ (function(module, __webpack_exports__, __webpack_require__) {
6576
6577"use strict";
6578/* harmony export (immutable) */ __webpack_exports__["a"] = get;
6579/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__toPath_js__ = __webpack_require__(88);
6580/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__deepGet_js__ = __webpack_require__(143);
6581/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isUndefined_js__ = __webpack_require__(180);
6582
6583
6584
6585
6586// Get the value of the (deep) property on `path` from `object`.
6587// If any property in `path` does not exist or if the value is
6588// `undefined`, return `defaultValue` instead.
6589// The `path` is normalized through `_.toPath`.
6590function get(object, path, defaultValue) {
6591 var value = Object(__WEBPACK_IMPORTED_MODULE_1__deepGet_js__["a" /* default */])(object, Object(__WEBPACK_IMPORTED_MODULE_0__toPath_js__["a" /* default */])(path));
6592 return Object(__WEBPACK_IMPORTED_MODULE_2__isUndefined_js__["a" /* default */])(value) ? defaultValue : value;
6593}
6594
6595
6596/***/ }),
6597/* 199 */
6598/***/ (function(module, __webpack_exports__, __webpack_require__) {
6599
6600"use strict";
6601/* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
6602/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
6603/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(59);
6604
6605
6606
6607// Normalize a (deep) property `path` to array.
6608// Like `_.iteratee`, this function can be customized.
6609function toPath(path) {
6610 return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(path) ? path : [path];
6611}
6612__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath = toPath;
6613
6614
6615/***/ }),
6616/* 200 */
6617/***/ (function(module, __webpack_exports__, __webpack_require__) {
6618
6619"use strict";
6620/* harmony export (immutable) */ __webpack_exports__["a"] = baseIteratee;
6621/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__identity_js__ = __webpack_require__(144);
6622/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
6623/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(58);
6624/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArray_js__ = __webpack_require__(59);
6625/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__matcher_js__ = __webpack_require__(113);
6626/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__property_js__ = __webpack_require__(145);
6627/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__ = __webpack_require__(89);
6628
6629
6630
6631
6632
6633
6634
6635
6636// An internal function to generate callbacks that can be applied to each
6637// element in a collection, returning the desired result — either `_.identity`,
6638// an arbitrary callback, a property matcher, or a property accessor.
6639function baseIteratee(value, context, argCount) {
6640 if (value == null) return __WEBPACK_IMPORTED_MODULE_0__identity_js__["a" /* default */];
6641 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(value)) return Object(__WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__["a" /* default */])(value, context, argCount);
6642 if (Object(__WEBPACK_IMPORTED_MODULE_2__isObject_js__["a" /* default */])(value) && !Object(__WEBPACK_IMPORTED_MODULE_3__isArray_js__["a" /* default */])(value)) return Object(__WEBPACK_IMPORTED_MODULE_4__matcher_js__["a" /* default */])(value);
6643 return Object(__WEBPACK_IMPORTED_MODULE_5__property_js__["a" /* default */])(value);
6644}
6645
6646
6647/***/ }),
6648/* 201 */
6649/***/ (function(module, __webpack_exports__, __webpack_require__) {
6650
6651"use strict";
6652/* harmony export (immutable) */ __webpack_exports__["a"] = iteratee;
6653/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
6654/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(200);
6655
6656
6657
6658// External wrapper for our callback generator. Users may customize
6659// `_.iteratee` if they want additional predicate/iteratee shorthand styles.
6660// This abstraction hides the internal-only `argCount` argument.
6661function iteratee(value, context) {
6662 return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, Infinity);
6663}
6664__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].iteratee = iteratee;
6665
6666
6667/***/ }),
6668/* 202 */
6669/***/ (function(module, __webpack_exports__, __webpack_require__) {
6670
6671"use strict";
6672/* harmony export (immutable) */ __webpack_exports__["a"] = noop;
6673// Predicate-generating function. Often useful outside of Underscore.
6674function noop(){}
6675
6676
6677/***/ }),
6678/* 203 */
6679/***/ (function(module, __webpack_exports__, __webpack_require__) {
6680
6681"use strict";
6682/* harmony export (immutable) */ __webpack_exports__["a"] = random;
6683// Return a random integer between `min` and `max` (inclusive).
6684function random(min, max) {
6685 if (max == null) {
6686 max = min;
6687 min = 0;
6688 }
6689 return min + Math.floor(Math.random() * (max - min + 1));
6690}
6691
6692
6693/***/ }),
6694/* 204 */
6695/***/ (function(module, __webpack_exports__, __webpack_require__) {
6696
6697"use strict";
6698/* harmony export (immutable) */ __webpack_exports__["a"] = createEscaper;
6699/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(17);
6700
6701
6702// Internal helper to generate functions for escaping and unescaping strings
6703// to/from HTML interpolation.
6704function createEscaper(map) {
6705 var escaper = function(match) {
6706 return map[match];
6707 };
6708 // Regexes for identifying a key that needs to be escaped.
6709 var source = '(?:' + Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(map).join('|') + ')';
6710 var testRegexp = RegExp(source);
6711 var replaceRegexp = RegExp(source, 'g');
6712 return function(string) {
6713 string = string == null ? '' : '' + string;
6714 return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
6715 };
6716}
6717
6718
6719/***/ }),
6720/* 205 */
6721/***/ (function(module, __webpack_exports__, __webpack_require__) {
6722
6723"use strict";
6724// Internal list of HTML entities for escaping.
6725/* harmony default export */ __webpack_exports__["a"] = ({
6726 '&': '&amp;',
6727 '<': '&lt;',
6728 '>': '&gt;',
6729 '"': '&quot;',
6730 "'": '&#x27;',
6731 '`': '&#x60;'
6732});
6733
6734
6735/***/ }),
6736/* 206 */
6737/***/ (function(module, __webpack_exports__, __webpack_require__) {
6738
6739"use strict";
6740/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
6741
6742
6743// By default, Underscore uses ERB-style template delimiters. Change the
6744// following template settings to use alternative delimiters.
6745/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].templateSettings = {
6746 evaluate: /<%([\s\S]+?)%>/g,
6747 interpolate: /<%=([\s\S]+?)%>/g,
6748 escape: /<%-([\s\S]+?)%>/g
6749});
6750
6751
6752/***/ }),
6753/* 207 */
6754/***/ (function(module, __webpack_exports__, __webpack_require__) {
6755
6756"use strict";
6757/* harmony export (immutable) */ __webpack_exports__["a"] = executeBound;
6758/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(196);
6759/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isObject_js__ = __webpack_require__(58);
6760
6761
6762
6763// Internal function to execute `sourceFunc` bound to `context` with optional
6764// `args`. Determines whether to execute a function as a constructor or as a
6765// normal function.
6766function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
6767 if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
6768 var self = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(sourceFunc.prototype);
6769 var result = sourceFunc.apply(self, args);
6770 if (Object(__WEBPACK_IMPORTED_MODULE_1__isObject_js__["a" /* default */])(result)) return result;
6771 return self;
6772}
6773
6774
6775/***/ }),
6776/* 208 */
6777/***/ (function(module, __webpack_exports__, __webpack_require__) {
6778
6779"use strict";
6780/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
6781/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
6782/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__executeBound_js__ = __webpack_require__(207);
6783
6784
6785
6786
6787// Create a function bound to a given object (assigning `this`, and arguments,
6788// optionally).
6789/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, context, args) {
6790 if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(func)) throw new TypeError('Bind must be called on a function');
6791 var bound = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(callArgs) {
6792 return Object(__WEBPACK_IMPORTED_MODULE_2__executeBound_js__["a" /* default */])(func, bound, context, this, args.concat(callArgs));
6793 });
6794 return bound;
6795}));
6796
6797
6798/***/ }),
6799/* 209 */
6800/***/ (function(module, __webpack_exports__, __webpack_require__) {
6801
6802"use strict";
6803/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
6804
6805
6806// Delays a function for the given number of milliseconds, and then calls
6807// it with the arguments supplied.
6808/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, wait, args) {
6809 return setTimeout(function() {
6810 return func.apply(null, args);
6811 }, wait);
6812}));
6813
6814
6815/***/ }),
6816/* 210 */
6817/***/ (function(module, __webpack_exports__, __webpack_require__) {
6818
6819"use strict";
6820/* harmony export (immutable) */ __webpack_exports__["a"] = before;
6821// Returns a function that will only be executed up to (but not including) the
6822// Nth call.
6823function before(times, func) {
6824 var memo;
6825 return function() {
6826 if (--times > 0) {
6827 memo = func.apply(this, arguments);
6828 }
6829 if (times <= 1) func = null;
6830 return memo;
6831 };
6832}
6833
6834
6835/***/ }),
6836/* 211 */
6837/***/ (function(module, __webpack_exports__, __webpack_require__) {
6838
6839"use strict";
6840/* harmony export (immutable) */ __webpack_exports__["a"] = findKey;
6841/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
6842/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(17);
6843
6844
6845
6846// Returns the first key on an object that passes a truth test.
6847function findKey(obj, predicate, context) {
6848 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
6849 var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj), key;
6850 for (var i = 0, length = _keys.length; i < length; i++) {
6851 key = _keys[i];
6852 if (predicate(obj[key], key, obj)) return key;
6853 }
6854}
6855
6856
6857/***/ }),
6858/* 212 */
6859/***/ (function(module, __webpack_exports__, __webpack_require__) {
6860
6861"use strict";
6862/* harmony export (immutable) */ __webpack_exports__["a"] = createPredicateIndexFinder;
6863/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
6864/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(31);
6865
6866
6867
6868// Internal function to generate `_.findIndex` and `_.findLastIndex`.
6869function createPredicateIndexFinder(dir) {
6870 return function(array, predicate, context) {
6871 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
6872 var length = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
6873 var index = dir > 0 ? 0 : length - 1;
6874 for (; index >= 0 && index < length; index += dir) {
6875 if (predicate(array[index], index, array)) return index;
6876 }
6877 return -1;
6878 };
6879}
6880
6881
6882/***/ }),
6883/* 213 */
6884/***/ (function(module, __webpack_exports__, __webpack_require__) {
6885
6886"use strict";
6887/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(212);
6888
6889
6890// Returns the last index on an array-like that passes a truth test.
6891/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(-1));
6892
6893
6894/***/ }),
6895/* 214 */
6896/***/ (function(module, __webpack_exports__, __webpack_require__) {
6897
6898"use strict";
6899/* harmony export (immutable) */ __webpack_exports__["a"] = sortedIndex;
6900/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
6901/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(31);
6902
6903
6904
6905// Use a comparator function to figure out the smallest index at which
6906// an object should be inserted so as to maintain order. Uses binary search.
6907function sortedIndex(array, obj, iteratee, context) {
6908 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context, 1);
6909 var value = iteratee(obj);
6910 var low = 0, high = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
6911 while (low < high) {
6912 var mid = Math.floor((low + high) / 2);
6913 if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
6914 }
6915 return low;
6916}
6917
6918
6919/***/ }),
6920/* 215 */
6921/***/ (function(module, __webpack_exports__, __webpack_require__) {
6922
6923"use strict";
6924/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sortedIndex_js__ = __webpack_require__(214);
6925/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(148);
6926/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__createIndexFinder_js__ = __webpack_require__(216);
6927
6928
6929
6930
6931// Return the position of the first occurrence of an item in an array,
6932// or -1 if the item is not included in the array.
6933// If the array is large and already in sort order, pass `true`
6934// for **isSorted** to use binary search.
6935/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_2__createIndexFinder_js__["a" /* default */])(1, __WEBPACK_IMPORTED_MODULE_1__findIndex_js__["a" /* default */], __WEBPACK_IMPORTED_MODULE_0__sortedIndex_js__["a" /* default */]));
6936
6937
6938/***/ }),
6939/* 216 */
6940/***/ (function(module, __webpack_exports__, __webpack_require__) {
6941
6942"use strict";
6943/* harmony export (immutable) */ __webpack_exports__["a"] = createIndexFinder;
6944/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(31);
6945/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
6946/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isNaN_js__ = __webpack_require__(185);
6947
6948
6949
6950
6951// Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions.
6952function createIndexFinder(dir, predicateFind, sortedIndex) {
6953 return function(array, item, idx) {
6954 var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array);
6955 if (typeof idx == 'number') {
6956 if (dir > 0) {
6957 i = idx >= 0 ? idx : Math.max(idx + length, i);
6958 } else {
6959 length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
6960 }
6961 } else if (sortedIndex && idx && length) {
6962 idx = sortedIndex(array, item);
6963 return array[idx] === item ? idx : -1;
6964 }
6965 if (item !== item) {
6966 idx = predicateFind(__WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(array, i, length), __WEBPACK_IMPORTED_MODULE_2__isNaN_js__["a" /* default */]);
6967 return idx >= 0 ? idx + i : -1;
6968 }
6969 for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
6970 if (array[idx] === item) return idx;
6971 }
6972 return -1;
6973 };
6974}
6975
6976
6977/***/ }),
6978/* 217 */
6979/***/ (function(module, __webpack_exports__, __webpack_require__) {
6980
6981"use strict";
6982/* harmony export (immutable) */ __webpack_exports__["a"] = find;
6983/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
6984/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(148);
6985/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__findKey_js__ = __webpack_require__(211);
6986
6987
6988
6989
6990// Return the first value which passes a truth test.
6991function find(obj, predicate, context) {
6992 var keyFinder = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? __WEBPACK_IMPORTED_MODULE_1__findIndex_js__["a" /* default */] : __WEBPACK_IMPORTED_MODULE_2__findKey_js__["a" /* default */];
6993 var key = keyFinder(obj, predicate, context);
6994 if (key !== void 0 && key !== -1) return obj[key];
6995}
6996
6997
6998/***/ }),
6999/* 218 */
7000/***/ (function(module, __webpack_exports__, __webpack_require__) {
7001
7002"use strict";
7003/* harmony export (immutable) */ __webpack_exports__["a"] = createReduce;
7004/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
7005/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(17);
7006/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(89);
7007
7008
7009
7010
7011// Internal helper to create a reducing function, iterating left or right.
7012function createReduce(dir) {
7013 // Wrap code that reassigns argument variables in a separate function than
7014 // the one that accesses `arguments.length` to avoid a perf hit. (#1991)
7015 var reducer = function(obj, iteratee, memo, initial) {
7016 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
7017 length = (_keys || obj).length,
7018 index = dir > 0 ? 0 : length - 1;
7019 if (!initial) {
7020 memo = obj[_keys ? _keys[index] : index];
7021 index += dir;
7022 }
7023 for (; index >= 0 && index < length; index += dir) {
7024 var currentKey = _keys ? _keys[index] : index;
7025 memo = iteratee(memo, obj[currentKey], currentKey, obj);
7026 }
7027 return memo;
7028 };
7029
7030 return function(obj, iteratee, memo, context) {
7031 var initial = arguments.length >= 3;
7032 return reducer(obj, Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, context, 4), memo, initial);
7033 };
7034}
7035
7036
7037/***/ }),
7038/* 219 */
7039/***/ (function(module, __webpack_exports__, __webpack_require__) {
7040
7041"use strict";
7042/* harmony export (immutable) */ __webpack_exports__["a"] = max;
7043/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
7044/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(71);
7045/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(22);
7046/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(60);
7047
7048
7049
7050
7051
7052// Return the maximum element (or element-based computation).
7053function max(obj, iteratee, context) {
7054 var result = -Infinity, lastComputed = -Infinity,
7055 value, computed;
7056 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
7057 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
7058 for (var i = 0, length = obj.length; i < length; i++) {
7059 value = obj[i];
7060 if (value != null && value > result) {
7061 result = value;
7062 }
7063 }
7064 } else {
7065 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
7066 Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
7067 computed = iteratee(v, index, list);
7068 if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
7069 result = v;
7070 lastComputed = computed;
7071 }
7072 });
7073 }
7074 return result;
7075}
7076
7077
7078/***/ }),
7079/* 220 */
7080/***/ (function(module, __webpack_exports__, __webpack_require__) {
7081
7082"use strict";
7083/* harmony export (immutable) */ __webpack_exports__["a"] = sample;
7084/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
7085/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__clone_js__ = __webpack_require__(197);
7086/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__values_js__ = __webpack_require__(71);
7087/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__getLength_js__ = __webpack_require__(31);
7088/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__random_js__ = __webpack_require__(203);
7089
7090
7091
7092
7093
7094
7095// Sample **n** random values from a collection using the modern version of the
7096// [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
7097// If **n** is not specified, returns a single random element.
7098// The internal `guard` argument allows it to work with `_.map`.
7099function sample(obj, n, guard) {
7100 if (n == null || guard) {
7101 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_2__values_js__["a" /* default */])(obj);
7102 return obj[Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(obj.length - 1)];
7103 }
7104 var sample = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? Object(__WEBPACK_IMPORTED_MODULE_1__clone_js__["a" /* default */])(obj) : Object(__WEBPACK_IMPORTED_MODULE_2__values_js__["a" /* default */])(obj);
7105 var length = Object(__WEBPACK_IMPORTED_MODULE_3__getLength_js__["a" /* default */])(sample);
7106 n = Math.max(Math.min(n, length), 0);
7107 var last = length - 1;
7108 for (var index = 0; index < n; index++) {
7109 var rand = Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(index, last);
7110 var temp = sample[index];
7111 sample[index] = sample[rand];
7112 sample[rand] = temp;
7113 }
7114 return sample.slice(0, n);
7115}
7116
7117
7118/***/ }),
7119/* 221 */
7120/***/ (function(module, __webpack_exports__, __webpack_require__) {
7121
7122"use strict";
7123/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
7124/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
7125/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(89);
7126/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__allKeys_js__ = __webpack_require__(87);
7127/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__ = __webpack_require__(380);
7128/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__flatten_js__ = __webpack_require__(72);
7129
7130
7131
7132
7133
7134
7135
7136// Return a copy of the object only containing the allowed properties.
7137/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
7138 var result = {}, iteratee = keys[0];
7139 if (obj == null) return result;
7140 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
7141 if (keys.length > 1) iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, keys[1]);
7142 keys = Object(__WEBPACK_IMPORTED_MODULE_3__allKeys_js__["a" /* default */])(obj);
7143 } else {
7144 iteratee = __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__["a" /* default */];
7145 keys = Object(__WEBPACK_IMPORTED_MODULE_5__flatten_js__["a" /* default */])(keys, false, false);
7146 obj = Object(obj);
7147 }
7148 for (var i = 0, length = keys.length; i < length; i++) {
7149 var key = keys[i];
7150 var value = obj[key];
7151 if (iteratee(value, key, obj)) result[key] = value;
7152 }
7153 return result;
7154}));
7155
7156
7157/***/ }),
7158/* 222 */
7159/***/ (function(module, __webpack_exports__, __webpack_require__) {
7160
7161"use strict";
7162/* harmony export (immutable) */ __webpack_exports__["a"] = initial;
7163/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
7164
7165
7166// Returns everything but the last entry of the array. Especially useful on
7167// the arguments object. Passing **n** will return all the values in
7168// the array, excluding the last N.
7169function initial(array, n, guard) {
7170 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
7171}
7172
7173
7174/***/ }),
7175/* 223 */
7176/***/ (function(module, __webpack_exports__, __webpack_require__) {
7177
7178"use strict";
7179/* harmony export (immutable) */ __webpack_exports__["a"] = rest;
7180/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
7181
7182
7183// Returns everything but the first entry of the `array`. Especially useful on
7184// the `arguments` object. Passing an **n** will return the rest N values in the
7185// `array`.
7186function rest(array, n, guard) {
7187 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, n == null || guard ? 1 : n);
7188}
7189
7190
7191/***/ }),
7192/* 224 */
7193/***/ (function(module, __webpack_exports__, __webpack_require__) {
7194
7195"use strict";
7196/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
7197/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(72);
7198/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__filter_js__ = __webpack_require__(90);
7199/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(91);
7200
7201
7202
7203
7204
7205// Take the difference between one array and a number of other arrays.
7206// Only the elements present in just the first array will remain.
7207/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, rest) {
7208 rest = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(rest, true, true);
7209 return Object(__WEBPACK_IMPORTED_MODULE_2__filter_js__["a" /* default */])(array, function(value){
7210 return !Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(rest, value);
7211 });
7212}));
7213
7214
7215/***/ }),
7216/* 225 */
7217/***/ (function(module, __webpack_exports__, __webpack_require__) {
7218
7219"use strict";
7220/* harmony export (immutable) */ __webpack_exports__["a"] = uniq;
7221/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isBoolean_js__ = __webpack_require__(181);
7222/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__cb_js__ = __webpack_require__(22);
7223/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getLength_js__ = __webpack_require__(31);
7224/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(91);
7225
7226
7227
7228
7229
7230// Produce a duplicate-free version of the array. If the array has already
7231// been sorted, you have the option of using a faster algorithm.
7232// The faster algorithm will not work with an iteratee if the iteratee
7233// is not a one-to-one function, so providing an iteratee will disable
7234// the faster algorithm.
7235function uniq(array, isSorted, iteratee, context) {
7236 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isBoolean_js__["a" /* default */])(isSorted)) {
7237 context = iteratee;
7238 iteratee = isSorted;
7239 isSorted = false;
7240 }
7241 if (iteratee != null) iteratee = Object(__WEBPACK_IMPORTED_MODULE_1__cb_js__["a" /* default */])(iteratee, context);
7242 var result = [];
7243 var seen = [];
7244 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_2__getLength_js__["a" /* default */])(array); i < length; i++) {
7245 var value = array[i],
7246 computed = iteratee ? iteratee(value, i, array) : value;
7247 if (isSorted && !iteratee) {
7248 if (!i || seen !== computed) result.push(value);
7249 seen = computed;
7250 } else if (iteratee) {
7251 if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(seen, computed)) {
7252 seen.push(computed);
7253 result.push(value);
7254 }
7255 } else if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(result, value)) {
7256 result.push(value);
7257 }
7258 }
7259 return result;
7260}
7261
7262
7263/***/ }),
7264/* 226 */
7265/***/ (function(module, __webpack_exports__, __webpack_require__) {
7266
7267"use strict";
7268/* harmony export (immutable) */ __webpack_exports__["a"] = unzip;
7269/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__max_js__ = __webpack_require__(219);
7270/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(31);
7271/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__pluck_js__ = __webpack_require__(149);
7272
7273
7274
7275
7276// Complement of zip. Unzip accepts an array of arrays and groups
7277// each array's elements on shared indices.
7278function unzip(array) {
7279 var length = array && Object(__WEBPACK_IMPORTED_MODULE_0__max_js__["a" /* default */])(array, __WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */]).length || 0;
7280 var result = Array(length);
7281
7282 for (var index = 0; index < length; index++) {
7283 result[index] = Object(__WEBPACK_IMPORTED_MODULE_2__pluck_js__["a" /* default */])(array, index);
7284 }
7285 return result;
7286}
7287
7288
7289/***/ }),
7290/* 227 */
7291/***/ (function(module, __webpack_exports__, __webpack_require__) {
7292
7293"use strict";
7294/* harmony export (immutable) */ __webpack_exports__["a"] = chainResult;
7295/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
7296
7297
7298// Helper function to continue chaining intermediate results.
7299function chainResult(instance, obj) {
7300 return instance._chain ? Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj).chain() : obj;
7301}
7302
7303
7304/***/ }),
7305/* 228 */
7306/***/ (function(module, exports, __webpack_require__) {
7307
7308"use strict";
7309
7310var $ = __webpack_require__(0);
7311var fails = __webpack_require__(2);
7312var isArray = __webpack_require__(92);
7313var isObject = __webpack_require__(11);
7314var toObject = __webpack_require__(33);
7315var lengthOfArrayLike = __webpack_require__(40);
7316var doesNotExceedSafeInteger = __webpack_require__(398);
7317var createProperty = __webpack_require__(93);
7318var arraySpeciesCreate = __webpack_require__(229);
7319var arrayMethodHasSpeciesSupport = __webpack_require__(116);
7320var wellKnownSymbol = __webpack_require__(5);
7321var V8_VERSION = __webpack_require__(66);
7322
7323var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
7324
7325// We can't use this feature detection in V8 since it causes
7326// deoptimization and serious performance degradation
7327// https://github.com/zloirock/core-js/issues/679
7328var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
7329 var array = [];
7330 array[IS_CONCAT_SPREADABLE] = false;
7331 return array.concat()[0] !== array;
7332});
7333
7334var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
7335
7336var isConcatSpreadable = function (O) {
7337 if (!isObject(O)) return false;
7338 var spreadable = O[IS_CONCAT_SPREADABLE];
7339 return spreadable !== undefined ? !!spreadable : isArray(O);
7340};
7341
7342var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
7343
7344// `Array.prototype.concat` method
7345// https://tc39.es/ecma262/#sec-array.prototype.concat
7346// with adding support of @@isConcatSpreadable and @@species
7347$({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
7348 // eslint-disable-next-line no-unused-vars -- required for `.length`
7349 concat: function concat(arg) {
7350 var O = toObject(this);
7351 var A = arraySpeciesCreate(O, 0);
7352 var n = 0;
7353 var i, k, length, len, E;
7354 for (i = -1, length = arguments.length; i < length; i++) {
7355 E = i === -1 ? O : arguments[i];
7356 if (isConcatSpreadable(E)) {
7357 len = lengthOfArrayLike(E);
7358 doesNotExceedSafeInteger(n + len);
7359 for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
7360 } else {
7361 doesNotExceedSafeInteger(n + 1);
7362 createProperty(A, n++, E);
7363 }
7364 }
7365 A.length = n;
7366 return A;
7367 }
7368});
7369
7370
7371/***/ }),
7372/* 229 */
7373/***/ (function(module, exports, __webpack_require__) {
7374
7375var arraySpeciesConstructor = __webpack_require__(399);
7376
7377// `ArraySpeciesCreate` abstract operation
7378// https://tc39.es/ecma262/#sec-arrayspeciescreate
7379module.exports = function (originalArray, length) {
7380 return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
7381};
7382
7383
7384/***/ }),
7385/* 230 */
7386/***/ (function(module, exports, __webpack_require__) {
7387
7388var $ = __webpack_require__(0);
7389var getBuiltIn = __webpack_require__(20);
7390var apply = __webpack_require__(79);
7391var call = __webpack_require__(15);
7392var uncurryThis = __webpack_require__(4);
7393var fails = __webpack_require__(2);
7394var isArray = __webpack_require__(92);
7395var isCallable = __webpack_require__(9);
7396var isObject = __webpack_require__(11);
7397var isSymbol = __webpack_require__(100);
7398var arraySlice = __webpack_require__(112);
7399var NATIVE_SYMBOL = __webpack_require__(65);
7400
7401var $stringify = getBuiltIn('JSON', 'stringify');
7402var exec = uncurryThis(/./.exec);
7403var charAt = uncurryThis(''.charAt);
7404var charCodeAt = uncurryThis(''.charCodeAt);
7405var replace = uncurryThis(''.replace);
7406var numberToString = uncurryThis(1.0.toString);
7407
7408var tester = /[\uD800-\uDFFF]/g;
7409var low = /^[\uD800-\uDBFF]$/;
7410var hi = /^[\uDC00-\uDFFF]$/;
7411
7412var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails(function () {
7413 var symbol = getBuiltIn('Symbol')();
7414 // MS Edge converts symbol values to JSON as {}
7415 return $stringify([symbol]) != '[null]'
7416 // WebKit converts symbol values to JSON as null
7417 || $stringify({ a: symbol }) != '{}'
7418 // V8 throws on boxed symbols
7419 || $stringify(Object(symbol)) != '{}';
7420});
7421
7422// https://github.com/tc39/proposal-well-formed-stringify
7423var ILL_FORMED_UNICODE = fails(function () {
7424 return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"'
7425 || $stringify('\uDEAD') !== '"\\udead"';
7426});
7427
7428var stringifyWithSymbolsFix = function (it, replacer) {
7429 var args = arraySlice(arguments);
7430 var $replacer = replacer;
7431 if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
7432 if (!isArray(replacer)) replacer = function (key, value) {
7433 if (isCallable($replacer)) value = call($replacer, this, key, value);
7434 if (!isSymbol(value)) return value;
7435 };
7436 args[1] = replacer;
7437 return apply($stringify, null, args);
7438};
7439
7440var fixIllFormed = function (match, offset, string) {
7441 var prev = charAt(string, offset - 1);
7442 var next = charAt(string, offset + 1);
7443 if ((exec(low, match) && !exec(hi, next)) || (exec(hi, match) && !exec(low, prev))) {
7444 return '\\u' + numberToString(charCodeAt(match, 0), 16);
7445 } return match;
7446};
7447
7448if ($stringify) {
7449 // `JSON.stringify` method
7450 // https://tc39.es/ecma262/#sec-json.stringify
7451 $({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {
7452 // eslint-disable-next-line no-unused-vars -- required for `.length`
7453 stringify: function stringify(it, replacer, space) {
7454 var args = arraySlice(arguments);
7455 var result = apply(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args);
7456 return ILL_FORMED_UNICODE && typeof result == 'string' ? replace(result, tester, fixIllFormed) : result;
7457 }
7458 });
7459}
7460
7461
7462/***/ }),
7463/* 231 */
7464/***/ (function(module, exports, __webpack_require__) {
7465
7466var rng = __webpack_require__(416);
7467var bytesToUuid = __webpack_require__(417);
7468
7469function v4(options, buf, offset) {
7470 var i = buf && offset || 0;
7471
7472 if (typeof(options) == 'string') {
7473 buf = options === 'binary' ? new Array(16) : null;
7474 options = null;
7475 }
7476 options = options || {};
7477
7478 var rnds = options.random || (options.rng || rng)();
7479
7480 // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
7481 rnds[6] = (rnds[6] & 0x0f) | 0x40;
7482 rnds[8] = (rnds[8] & 0x3f) | 0x80;
7483
7484 // Copy bytes to buffer, if provided
7485 if (buf) {
7486 for (var ii = 0; ii < 16; ++ii) {
7487 buf[i + ii] = rnds[ii];
7488 }
7489 }
7490
7491 return buf || bytesToUuid(rnds);
7492}
7493
7494module.exports = v4;
7495
7496
7497/***/ }),
7498/* 232 */
7499/***/ (function(module, exports, __webpack_require__) {
7500
7501module.exports = __webpack_require__(233);
7502
7503/***/ }),
7504/* 233 */
7505/***/ (function(module, exports, __webpack_require__) {
7506
7507var parent = __webpack_require__(420);
7508
7509module.exports = parent;
7510
7511
7512/***/ }),
7513/* 234 */
7514/***/ (function(module, exports, __webpack_require__) {
7515
7516"use strict";
7517
7518
7519module.exports = '4.15.2';
7520
7521/***/ }),
7522/* 235 */
7523/***/ (function(module, exports, __webpack_require__) {
7524
7525"use strict";
7526
7527
7528var has = Object.prototype.hasOwnProperty
7529 , prefix = '~';
7530
7531/**
7532 * Constructor to create a storage for our `EE` objects.
7533 * An `Events` instance is a plain object whose properties are event names.
7534 *
7535 * @constructor
7536 * @api private
7537 */
7538function Events() {}
7539
7540//
7541// We try to not inherit from `Object.prototype`. In some engines creating an
7542// instance in this way is faster than calling `Object.create(null)` directly.
7543// If `Object.create(null)` is not supported we prefix the event names with a
7544// character to make sure that the built-in object properties are not
7545// overridden or used as an attack vector.
7546//
7547if (Object.create) {
7548 Events.prototype = Object.create(null);
7549
7550 //
7551 // This hack is needed because the `__proto__` property is still inherited in
7552 // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
7553 //
7554 if (!new Events().__proto__) prefix = false;
7555}
7556
7557/**
7558 * Representation of a single event listener.
7559 *
7560 * @param {Function} fn The listener function.
7561 * @param {Mixed} context The context to invoke the listener with.
7562 * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
7563 * @constructor
7564 * @api private
7565 */
7566function EE(fn, context, once) {
7567 this.fn = fn;
7568 this.context = context;
7569 this.once = once || false;
7570}
7571
7572/**
7573 * Minimal `EventEmitter` interface that is molded against the Node.js
7574 * `EventEmitter` interface.
7575 *
7576 * @constructor
7577 * @api public
7578 */
7579function EventEmitter() {
7580 this._events = new Events();
7581 this._eventsCount = 0;
7582}
7583
7584/**
7585 * Return an array listing the events for which the emitter has registered
7586 * listeners.
7587 *
7588 * @returns {Array}
7589 * @api public
7590 */
7591EventEmitter.prototype.eventNames = function eventNames() {
7592 var names = []
7593 , events
7594 , name;
7595
7596 if (this._eventsCount === 0) return names;
7597
7598 for (name in (events = this._events)) {
7599 if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
7600 }
7601
7602 if (Object.getOwnPropertySymbols) {
7603 return names.concat(Object.getOwnPropertySymbols(events));
7604 }
7605
7606 return names;
7607};
7608
7609/**
7610 * Return the listeners registered for a given event.
7611 *
7612 * @param {String|Symbol} event The event name.
7613 * @param {Boolean} exists Only check if there are listeners.
7614 * @returns {Array|Boolean}
7615 * @api public
7616 */
7617EventEmitter.prototype.listeners = function listeners(event, exists) {
7618 var evt = prefix ? prefix + event : event
7619 , available = this._events[evt];
7620
7621 if (exists) return !!available;
7622 if (!available) return [];
7623 if (available.fn) return [available.fn];
7624
7625 for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {
7626 ee[i] = available[i].fn;
7627 }
7628
7629 return ee;
7630};
7631
7632/**
7633 * Calls each of the listeners registered for a given event.
7634 *
7635 * @param {String|Symbol} event The event name.
7636 * @returns {Boolean} `true` if the event had listeners, else `false`.
7637 * @api public
7638 */
7639EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
7640 var evt = prefix ? prefix + event : event;
7641
7642 if (!this._events[evt]) return false;
7643
7644 var listeners = this._events[evt]
7645 , len = arguments.length
7646 , args
7647 , i;
7648
7649 if (listeners.fn) {
7650 if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
7651
7652 switch (len) {
7653 case 1: return listeners.fn.call(listeners.context), true;
7654 case 2: return listeners.fn.call(listeners.context, a1), true;
7655 case 3: return listeners.fn.call(listeners.context, a1, a2), true;
7656 case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
7657 case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
7658 case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
7659 }
7660
7661 for (i = 1, args = new Array(len -1); i < len; i++) {
7662 args[i - 1] = arguments[i];
7663 }
7664
7665 listeners.fn.apply(listeners.context, args);
7666 } else {
7667 var length = listeners.length
7668 , j;
7669
7670 for (i = 0; i < length; i++) {
7671 if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
7672
7673 switch (len) {
7674 case 1: listeners[i].fn.call(listeners[i].context); break;
7675 case 2: listeners[i].fn.call(listeners[i].context, a1); break;
7676 case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
7677 case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
7678 default:
7679 if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
7680 args[j - 1] = arguments[j];
7681 }
7682
7683 listeners[i].fn.apply(listeners[i].context, args);
7684 }
7685 }
7686 }
7687
7688 return true;
7689};
7690
7691/**
7692 * Add a listener for a given event.
7693 *
7694 * @param {String|Symbol} event The event name.
7695 * @param {Function} fn The listener function.
7696 * @param {Mixed} [context=this] The context to invoke the listener with.
7697 * @returns {EventEmitter} `this`.
7698 * @api public
7699 */
7700EventEmitter.prototype.on = function on(event, fn, context) {
7701 var listener = new EE(fn, context || this)
7702 , evt = prefix ? prefix + event : event;
7703
7704 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
7705 else if (!this._events[evt].fn) this._events[evt].push(listener);
7706 else this._events[evt] = [this._events[evt], listener];
7707
7708 return this;
7709};
7710
7711/**
7712 * Add a one-time listener for a given event.
7713 *
7714 * @param {String|Symbol} event The event name.
7715 * @param {Function} fn The listener function.
7716 * @param {Mixed} [context=this] The context to invoke the listener with.
7717 * @returns {EventEmitter} `this`.
7718 * @api public
7719 */
7720EventEmitter.prototype.once = function once(event, fn, context) {
7721 var listener = new EE(fn, context || this, true)
7722 , evt = prefix ? prefix + event : event;
7723
7724 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
7725 else if (!this._events[evt].fn) this._events[evt].push(listener);
7726 else this._events[evt] = [this._events[evt], listener];
7727
7728 return this;
7729};
7730
7731/**
7732 * Remove the listeners of a given event.
7733 *
7734 * @param {String|Symbol} event The event name.
7735 * @param {Function} fn Only remove the listeners that match this function.
7736 * @param {Mixed} context Only remove the listeners that have this context.
7737 * @param {Boolean} once Only remove one-time listeners.
7738 * @returns {EventEmitter} `this`.
7739 * @api public
7740 */
7741EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
7742 var evt = prefix ? prefix + event : event;
7743
7744 if (!this._events[evt]) return this;
7745 if (!fn) {
7746 if (--this._eventsCount === 0) this._events = new Events();
7747 else delete this._events[evt];
7748 return this;
7749 }
7750
7751 var listeners = this._events[evt];
7752
7753 if (listeners.fn) {
7754 if (
7755 listeners.fn === fn
7756 && (!once || listeners.once)
7757 && (!context || listeners.context === context)
7758 ) {
7759 if (--this._eventsCount === 0) this._events = new Events();
7760 else delete this._events[evt];
7761 }
7762 } else {
7763 for (var i = 0, events = [], length = listeners.length; i < length; i++) {
7764 if (
7765 listeners[i].fn !== fn
7766 || (once && !listeners[i].once)
7767 || (context && listeners[i].context !== context)
7768 ) {
7769 events.push(listeners[i]);
7770 }
7771 }
7772
7773 //
7774 // Reset the array, or remove it completely if we have no more listeners.
7775 //
7776 if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
7777 else if (--this._eventsCount === 0) this._events = new Events();
7778 else delete this._events[evt];
7779 }
7780
7781 return this;
7782};
7783
7784/**
7785 * Remove all listeners, or those of the specified event.
7786 *
7787 * @param {String|Symbol} [event] The event name.
7788 * @returns {EventEmitter} `this`.
7789 * @api public
7790 */
7791EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
7792 var evt;
7793
7794 if (event) {
7795 evt = prefix ? prefix + event : event;
7796 if (this._events[evt]) {
7797 if (--this._eventsCount === 0) this._events = new Events();
7798 else delete this._events[evt];
7799 }
7800 } else {
7801 this._events = new Events();
7802 this._eventsCount = 0;
7803 }
7804
7805 return this;
7806};
7807
7808//
7809// Alias methods names because people roll like that.
7810//
7811EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
7812EventEmitter.prototype.addListener = EventEmitter.prototype.on;
7813
7814//
7815// This function doesn't apply anymore.
7816//
7817EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
7818 return this;
7819};
7820
7821//
7822// Expose the prefix.
7823//
7824EventEmitter.prefixed = prefix;
7825
7826//
7827// Allow `EventEmitter` to be imported as module namespace.
7828//
7829EventEmitter.EventEmitter = EventEmitter;
7830
7831//
7832// Expose the module.
7833//
7834if (true) {
7835 module.exports = EventEmitter;
7836}
7837
7838
7839/***/ }),
7840/* 236 */
7841/***/ (function(module, exports, __webpack_require__) {
7842
7843"use strict";
7844
7845
7846var _interopRequireDefault = __webpack_require__(1);
7847
7848var _promise = _interopRequireDefault(__webpack_require__(12));
7849
7850var _require = __webpack_require__(76),
7851 getAdapter = _require.getAdapter;
7852
7853var syncApiNames = ['getItem', 'setItem', 'removeItem', 'clear'];
7854var localStorage = {
7855 get async() {
7856 return getAdapter('storage').async;
7857 }
7858
7859}; // wrap sync apis with async ones.
7860
7861syncApiNames.forEach(function (apiName) {
7862 localStorage[apiName + 'Async'] = function () {
7863 var storage = getAdapter('storage');
7864 return _promise.default.resolve(storage[apiName].apply(storage, arguments));
7865 };
7866
7867 localStorage[apiName] = function () {
7868 var storage = getAdapter('storage');
7869
7870 if (!storage.async) {
7871 return storage[apiName].apply(storage, arguments);
7872 }
7873
7874 var error = new Error('Synchronous API [' + apiName + '] is not available in this runtime.');
7875 error.code = 'SYNC_API_NOT_AVAILABLE';
7876 throw error;
7877 };
7878});
7879module.exports = localStorage;
7880
7881/***/ }),
7882/* 237 */
7883/***/ (function(module, exports, __webpack_require__) {
7884
7885"use strict";
7886
7887
7888var _interopRequireDefault = __webpack_require__(1);
7889
7890var _concat = _interopRequireDefault(__webpack_require__(19));
7891
7892var _stringify = _interopRequireDefault(__webpack_require__(38));
7893
7894var storage = __webpack_require__(236);
7895
7896var AV = __webpack_require__(74);
7897
7898var removeAsync = exports.removeAsync = storage.removeItemAsync.bind(storage);
7899
7900var getCacheData = function getCacheData(cacheData, key) {
7901 try {
7902 cacheData = JSON.parse(cacheData);
7903 } catch (e) {
7904 return null;
7905 }
7906
7907 if (cacheData) {
7908 var expired = cacheData.expiredAt && cacheData.expiredAt < Date.now();
7909
7910 if (!expired) {
7911 return cacheData.value;
7912 }
7913
7914 return removeAsync(key).then(function () {
7915 return null;
7916 });
7917 }
7918
7919 return null;
7920};
7921
7922exports.getAsync = function (key) {
7923 var _context;
7924
7925 key = (0, _concat.default)(_context = "AV/".concat(AV.applicationId, "/")).call(_context, key);
7926 return storage.getItemAsync(key).then(function (cache) {
7927 return getCacheData(cache, key);
7928 });
7929};
7930
7931exports.setAsync = function (key, value, ttl) {
7932 var _context2;
7933
7934 var cache = {
7935 value: value
7936 };
7937
7938 if (typeof ttl === 'number') {
7939 cache.expiredAt = Date.now() + ttl;
7940 }
7941
7942 return storage.setItemAsync((0, _concat.default)(_context2 = "AV/".concat(AV.applicationId, "/")).call(_context2, key), (0, _stringify.default)(cache));
7943};
7944
7945/***/ }),
7946/* 238 */
7947/***/ (function(module, exports, __webpack_require__) {
7948
7949var parent = __webpack_require__(423);
7950
7951module.exports = parent;
7952
7953
7954/***/ }),
7955/* 239 */
7956/***/ (function(module, exports, __webpack_require__) {
7957
7958var parent = __webpack_require__(426);
7959
7960module.exports = parent;
7961
7962
7963/***/ }),
7964/* 240 */
7965/***/ (function(module, exports, __webpack_require__) {
7966
7967var parent = __webpack_require__(429);
7968
7969module.exports = parent;
7970
7971
7972/***/ }),
7973/* 241 */
7974/***/ (function(module, exports, __webpack_require__) {
7975
7976module.exports = __webpack_require__(432);
7977
7978/***/ }),
7979/* 242 */
7980/***/ (function(module, exports, __webpack_require__) {
7981
7982var parent = __webpack_require__(435);
7983__webpack_require__(46);
7984
7985module.exports = parent;
7986
7987
7988/***/ }),
7989/* 243 */
7990/***/ (function(module, exports, __webpack_require__) {
7991
7992// TODO: Remove this module from `core-js@4` since it's split to modules listed below
7993__webpack_require__(436);
7994__webpack_require__(437);
7995__webpack_require__(438);
7996__webpack_require__(230);
7997__webpack_require__(439);
7998
7999
8000/***/ }),
8001/* 244 */
8002/***/ (function(module, exports, __webpack_require__) {
8003
8004/* eslint-disable es-x/no-object-getownpropertynames -- safe */
8005var classof = __webpack_require__(50);
8006var toIndexedObject = __webpack_require__(35);
8007var $getOwnPropertyNames = __webpack_require__(105).f;
8008var arraySlice = __webpack_require__(245);
8009
8010var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
8011 ? Object.getOwnPropertyNames(window) : [];
8012
8013var getWindowNames = function (it) {
8014 try {
8015 return $getOwnPropertyNames(it);
8016 } catch (error) {
8017 return arraySlice(windowNames);
8018 }
8019};
8020
8021// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
8022module.exports.f = function getOwnPropertyNames(it) {
8023 return windowNames && classof(it) == 'Window'
8024 ? getWindowNames(it)
8025 : $getOwnPropertyNames(toIndexedObject(it));
8026};
8027
8028
8029/***/ }),
8030/* 245 */
8031/***/ (function(module, exports, __webpack_require__) {
8032
8033var toAbsoluteIndex = __webpack_require__(127);
8034var lengthOfArrayLike = __webpack_require__(40);
8035var createProperty = __webpack_require__(93);
8036
8037var $Array = Array;
8038var max = Math.max;
8039
8040module.exports = function (O, start, end) {
8041 var length = lengthOfArrayLike(O);
8042 var k = toAbsoluteIndex(start, length);
8043 var fin = toAbsoluteIndex(end === undefined ? length : end, length);
8044 var result = $Array(max(fin - k, 0));
8045 for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
8046 result.length = n;
8047 return result;
8048};
8049
8050
8051/***/ }),
8052/* 246 */
8053/***/ (function(module, exports, __webpack_require__) {
8054
8055var call = __webpack_require__(15);
8056var getBuiltIn = __webpack_require__(20);
8057var wellKnownSymbol = __webpack_require__(5);
8058var defineBuiltIn = __webpack_require__(45);
8059
8060module.exports = function () {
8061 var Symbol = getBuiltIn('Symbol');
8062 var SymbolPrototype = Symbol && Symbol.prototype;
8063 var valueOf = SymbolPrototype && SymbolPrototype.valueOf;
8064 var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
8065
8066 if (SymbolPrototype && !SymbolPrototype[TO_PRIMITIVE]) {
8067 // `Symbol.prototype[@@toPrimitive]` method
8068 // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
8069 // eslint-disable-next-line no-unused-vars -- required for .length
8070 defineBuiltIn(SymbolPrototype, TO_PRIMITIVE, function (hint) {
8071 return call(valueOf, this);
8072 }, { arity: 1 });
8073 }
8074};
8075
8076
8077/***/ }),
8078/* 247 */
8079/***/ (function(module, exports, __webpack_require__) {
8080
8081var NATIVE_SYMBOL = __webpack_require__(65);
8082
8083/* eslint-disable es-x/no-symbol -- safe */
8084module.exports = NATIVE_SYMBOL && !!Symbol['for'] && !!Symbol.keyFor;
8085
8086
8087/***/ }),
8088/* 248 */
8089/***/ (function(module, exports, __webpack_require__) {
8090
8091var defineWellKnownSymbol = __webpack_require__(10);
8092
8093// `Symbol.iterator` well-known symbol
8094// https://tc39.es/ecma262/#sec-symbol.iterator
8095defineWellKnownSymbol('iterator');
8096
8097
8098/***/ }),
8099/* 249 */
8100/***/ (function(module, exports, __webpack_require__) {
8101
8102var parent = __webpack_require__(468);
8103__webpack_require__(46);
8104
8105module.exports = parent;
8106
8107
8108/***/ }),
8109/* 250 */
8110/***/ (function(module, exports, __webpack_require__) {
8111
8112module.exports = __webpack_require__(469);
8113
8114/***/ }),
8115/* 251 */
8116/***/ (function(module, exports, __webpack_require__) {
8117
8118"use strict";
8119// Copyright (c) 2015-2017 David M. Lee, II
8120
8121
8122/**
8123 * Local reference to TimeoutError
8124 * @private
8125 */
8126var TimeoutError;
8127
8128/**
8129 * Rejects a promise with a {@link TimeoutError} if it does not settle within
8130 * the specified timeout.
8131 *
8132 * @param {Promise} promise The promise.
8133 * @param {number} timeoutMillis Number of milliseconds to wait on settling.
8134 * @returns {Promise} Either resolves/rejects with `promise`, or rejects with
8135 * `TimeoutError`, whichever settles first.
8136 */
8137var timeout = module.exports.timeout = function(promise, timeoutMillis) {
8138 var error = new TimeoutError(),
8139 timeout;
8140
8141 return Promise.race([
8142 promise,
8143 new Promise(function(resolve, reject) {
8144 timeout = setTimeout(function() {
8145 reject(error);
8146 }, timeoutMillis);
8147 }),
8148 ]).then(function(v) {
8149 clearTimeout(timeout);
8150 return v;
8151 }, function(err) {
8152 clearTimeout(timeout);
8153 throw err;
8154 });
8155};
8156
8157/**
8158 * Exception indicating that the timeout expired.
8159 */
8160TimeoutError = module.exports.TimeoutError = function() {
8161 Error.call(this)
8162 this.stack = Error().stack
8163 this.message = 'Timeout';
8164};
8165
8166TimeoutError.prototype = Object.create(Error.prototype);
8167TimeoutError.prototype.name = "TimeoutError";
8168
8169
8170/***/ }),
8171/* 252 */
8172/***/ (function(module, exports, __webpack_require__) {
8173
8174var parent = __webpack_require__(485);
8175
8176module.exports = parent;
8177
8178
8179/***/ }),
8180/* 253 */
8181/***/ (function(module, exports, __webpack_require__) {
8182
8183module.exports = __webpack_require__(489);
8184
8185/***/ }),
8186/* 254 */
8187/***/ (function(module, exports, __webpack_require__) {
8188
8189"use strict";
8190
8191var uncurryThis = __webpack_require__(4);
8192var aCallable = __webpack_require__(29);
8193var isObject = __webpack_require__(11);
8194var hasOwn = __webpack_require__(13);
8195var arraySlice = __webpack_require__(112);
8196var NATIVE_BIND = __webpack_require__(80);
8197
8198var $Function = Function;
8199var concat = uncurryThis([].concat);
8200var join = uncurryThis([].join);
8201var factories = {};
8202
8203var construct = function (C, argsLength, args) {
8204 if (!hasOwn(factories, argsLength)) {
8205 for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']';
8206 factories[argsLength] = $Function('C,a', 'return new C(' + join(list, ',') + ')');
8207 } return factories[argsLength](C, args);
8208};
8209
8210// `Function.prototype.bind` method implementation
8211// https://tc39.es/ecma262/#sec-function.prototype.bind
8212module.exports = NATIVE_BIND ? $Function.bind : function bind(that /* , ...args */) {
8213 var F = aCallable(this);
8214 var Prototype = F.prototype;
8215 var partArgs = arraySlice(arguments, 1);
8216 var boundFunction = function bound(/* args... */) {
8217 var args = concat(partArgs, arraySlice(arguments));
8218 return this instanceof boundFunction ? construct(F, args.length, args) : F.apply(that, args);
8219 };
8220 if (isObject(Prototype)) boundFunction.prototype = Prototype;
8221 return boundFunction;
8222};
8223
8224
8225/***/ }),
8226/* 255 */
8227/***/ (function(module, exports, __webpack_require__) {
8228
8229module.exports = __webpack_require__(510);
8230
8231/***/ }),
8232/* 256 */
8233/***/ (function(module, exports, __webpack_require__) {
8234
8235module.exports = __webpack_require__(513);
8236
8237/***/ }),
8238/* 257 */
8239/***/ (function(module, exports) {
8240
8241var charenc = {
8242 // UTF-8 encoding
8243 utf8: {
8244 // Convert a string to a byte array
8245 stringToBytes: function(str) {
8246 return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
8247 },
8248
8249 // Convert a byte array to a string
8250 bytesToString: function(bytes) {
8251 return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
8252 }
8253 },
8254
8255 // Binary encoding
8256 bin: {
8257 // Convert a string to a byte array
8258 stringToBytes: function(str) {
8259 for (var bytes = [], i = 0; i < str.length; i++)
8260 bytes.push(str.charCodeAt(i) & 0xFF);
8261 return bytes;
8262 },
8263
8264 // Convert a byte array to a string
8265 bytesToString: function(bytes) {
8266 for (var str = [], i = 0; i < bytes.length; i++)
8267 str.push(String.fromCharCode(bytes[i]));
8268 return str.join('');
8269 }
8270 }
8271};
8272
8273module.exports = charenc;
8274
8275
8276/***/ }),
8277/* 258 */
8278/***/ (function(module, exports, __webpack_require__) {
8279
8280module.exports = __webpack_require__(557);
8281
8282/***/ }),
8283/* 259 */
8284/***/ (function(module, exports, __webpack_require__) {
8285
8286"use strict";
8287
8288
8289var adapters = __webpack_require__(574);
8290
8291module.exports = function (AV) {
8292 AV.setAdapters(adapters);
8293 return AV;
8294};
8295
8296/***/ }),
8297/* 260 */
8298/***/ (function(module, exports) {
8299
8300// a string of all valid unicode whitespaces
8301module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
8302 '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
8303
8304
8305/***/ }),
8306/* 261 */
8307/***/ (function(module, exports, __webpack_require__) {
8308
8309"use strict";
8310
8311
8312var _interopRequireDefault = __webpack_require__(1);
8313
8314var _symbol = _interopRequireDefault(__webpack_require__(77));
8315
8316var _iterator = _interopRequireDefault(__webpack_require__(155));
8317
8318function _typeof(obj) {
8319 "@babel/helpers - typeof";
8320
8321 if (typeof _symbol.default === "function" && typeof _iterator.default === "symbol") {
8322 _typeof = function _typeof(obj) {
8323 return typeof obj;
8324 };
8325 } else {
8326 _typeof = function _typeof(obj) {
8327 return obj && typeof _symbol.default === "function" && obj.constructor === _symbol.default && obj !== _symbol.default.prototype ? "symbol" : typeof obj;
8328 };
8329 }
8330
8331 return _typeof(obj);
8332}
8333/**
8334 * Check if `obj` is an object.
8335 *
8336 * @param {Object} obj
8337 * @return {Boolean}
8338 * @api private
8339 */
8340
8341
8342function isObject(obj) {
8343 return obj !== null && _typeof(obj) === 'object';
8344}
8345
8346module.exports = isObject;
8347
8348/***/ }),
8349/* 262 */
8350/***/ (function(module, exports, __webpack_require__) {
8351
8352module.exports = __webpack_require__(610);
8353
8354/***/ }),
8355/* 263 */
8356/***/ (function(module, exports, __webpack_require__) {
8357
8358module.exports = __webpack_require__(616);
8359
8360/***/ }),
8361/* 264 */
8362/***/ (function(module, exports, __webpack_require__) {
8363
8364var fails = __webpack_require__(2);
8365
8366module.exports = !fails(function () {
8367 // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-preventextensions -- required for testing
8368 return Object.isExtensible(Object.preventExtensions({}));
8369});
8370
8371
8372/***/ }),
8373/* 265 */
8374/***/ (function(module, exports, __webpack_require__) {
8375
8376var fails = __webpack_require__(2);
8377var isObject = __webpack_require__(11);
8378var classof = __webpack_require__(50);
8379var ARRAY_BUFFER_NON_EXTENSIBLE = __webpack_require__(628);
8380
8381// eslint-disable-next-line es-x/no-object-isextensible -- safe
8382var $isExtensible = Object.isExtensible;
8383var FAILS_ON_PRIMITIVES = fails(function () { $isExtensible(1); });
8384
8385// `Object.isExtensible` method
8386// https://tc39.es/ecma262/#sec-object.isextensible
8387module.exports = (FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE) ? function isExtensible(it) {
8388 if (!isObject(it)) return false;
8389 if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return false;
8390 return $isExtensible ? $isExtensible(it) : true;
8391} : $isExtensible;
8392
8393
8394/***/ }),
8395/* 266 */
8396/***/ (function(module, exports, __webpack_require__) {
8397
8398module.exports = __webpack_require__(629);
8399
8400/***/ }),
8401/* 267 */
8402/***/ (function(module, exports, __webpack_require__) {
8403
8404module.exports = __webpack_require__(633);
8405
8406/***/ }),
8407/* 268 */
8408/***/ (function(module, exports, __webpack_require__) {
8409
8410"use strict";
8411
8412var $ = __webpack_require__(0);
8413var global = __webpack_require__(8);
8414var InternalMetadataModule = __webpack_require__(97);
8415var fails = __webpack_require__(2);
8416var createNonEnumerableProperty = __webpack_require__(39);
8417var iterate = __webpack_require__(41);
8418var anInstance = __webpack_require__(110);
8419var isCallable = __webpack_require__(9);
8420var isObject = __webpack_require__(11);
8421var setToStringTag = __webpack_require__(56);
8422var defineProperty = __webpack_require__(23).f;
8423var forEach = __webpack_require__(75).forEach;
8424var DESCRIPTORS = __webpack_require__(14);
8425var InternalStateModule = __webpack_require__(44);
8426
8427var setInternalState = InternalStateModule.set;
8428var internalStateGetterFor = InternalStateModule.getterFor;
8429
8430module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
8431 var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
8432 var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
8433 var ADDER = IS_MAP ? 'set' : 'add';
8434 var NativeConstructor = global[CONSTRUCTOR_NAME];
8435 var NativePrototype = NativeConstructor && NativeConstructor.prototype;
8436 var exported = {};
8437 var Constructor;
8438
8439 if (!DESCRIPTORS || !isCallable(NativeConstructor)
8440 || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); }))
8441 ) {
8442 // create collection constructor
8443 Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
8444 InternalMetadataModule.enable();
8445 } else {
8446 Constructor = wrapper(function (target, iterable) {
8447 setInternalState(anInstance(target, Prototype), {
8448 type: CONSTRUCTOR_NAME,
8449 collection: new NativeConstructor()
8450 });
8451 if (iterable != undefined) iterate(iterable, target[ADDER], { that: target, AS_ENTRIES: IS_MAP });
8452 });
8453
8454 var Prototype = Constructor.prototype;
8455
8456 var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
8457
8458 forEach(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) {
8459 var IS_ADDER = KEY == 'add' || KEY == 'set';
8460 if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) {
8461 createNonEnumerableProperty(Prototype, KEY, function (a, b) {
8462 var collection = getInternalState(this).collection;
8463 if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;
8464 var result = collection[KEY](a === 0 ? 0 : a, b);
8465 return IS_ADDER ? this : result;
8466 });
8467 }
8468 });
8469
8470 IS_WEAK || defineProperty(Prototype, 'size', {
8471 configurable: true,
8472 get: function () {
8473 return getInternalState(this).collection.size;
8474 }
8475 });
8476 }
8477
8478 setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true);
8479
8480 exported[CONSTRUCTOR_NAME] = Constructor;
8481 $({ global: true, forced: true }, exported);
8482
8483 if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
8484
8485 return Constructor;
8486};
8487
8488
8489/***/ }),
8490/* 269 */
8491/***/ (function(module, exports, __webpack_require__) {
8492
8493module.exports = __webpack_require__(649);
8494
8495/***/ }),
8496/* 270 */
8497/***/ (function(module, exports) {
8498
8499function _arrayLikeToArray(arr, len) {
8500 if (len == null || len > arr.length) len = arr.length;
8501 for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
8502 return arr2;
8503}
8504module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
8505
8506/***/ }),
8507/* 271 */
8508/***/ (function(module, exports) {
8509
8510function _iterableToArray(iter) {
8511 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
8512}
8513module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
8514
8515/***/ }),
8516/* 272 */
8517/***/ (function(module, exports, __webpack_require__) {
8518
8519var arrayLikeToArray = __webpack_require__(270);
8520function _unsupportedIterableToArray(o, minLen) {
8521 if (!o) return;
8522 if (typeof o === "string") return arrayLikeToArray(o, minLen);
8523 var n = Object.prototype.toString.call(o).slice(8, -1);
8524 if (n === "Object" && o.constructor) n = o.constructor.name;
8525 if (n === "Map" || n === "Set") return Array.from(o);
8526 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
8527}
8528module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
8529
8530/***/ }),
8531/* 273 */
8532/***/ (function(module, exports, __webpack_require__) {
8533
8534var _typeof = __webpack_require__(119)["default"];
8535var toPrimitive = __webpack_require__(664);
8536function _toPropertyKey(arg) {
8537 var key = toPrimitive(arg, "string");
8538 return _typeof(key) === "symbol" ? key : String(key);
8539}
8540module.exports = _toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
8541
8542/***/ }),
8543/* 274 */
8544/***/ (function(module, exports, __webpack_require__) {
8545
8546var baseRandom = __webpack_require__(675);
8547
8548/**
8549 * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
8550 *
8551 * @private
8552 * @param {Array} array The array to shuffle.
8553 * @param {number} [size=array.length] The size of `array`.
8554 * @returns {Array} Returns `array`.
8555 */
8556function shuffleSelf(array, size) {
8557 var index = -1,
8558 length = array.length,
8559 lastIndex = length - 1;
8560
8561 size = size === undefined ? length : size;
8562 while (++index < size) {
8563 var rand = baseRandom(index, lastIndex),
8564 value = array[rand];
8565
8566 array[rand] = array[index];
8567 array[index] = value;
8568 }
8569 array.length = size;
8570 return array;
8571}
8572
8573module.exports = shuffleSelf;
8574
8575
8576/***/ }),
8577/* 275 */
8578/***/ (function(module, exports, __webpack_require__) {
8579
8580var baseValues = __webpack_require__(677),
8581 keys = __webpack_require__(679);
8582
8583/**
8584 * Creates an array of the own enumerable string keyed property values of `object`.
8585 *
8586 * **Note:** Non-object values are coerced to objects.
8587 *
8588 * @static
8589 * @since 0.1.0
8590 * @memberOf _
8591 * @category Object
8592 * @param {Object} object The object to query.
8593 * @returns {Array} Returns the array of property values.
8594 * @example
8595 *
8596 * function Foo() {
8597 * this.a = 1;
8598 * this.b = 2;
8599 * }
8600 *
8601 * Foo.prototype.c = 3;
8602 *
8603 * _.values(new Foo);
8604 * // => [1, 2] (iteration order is not guaranteed)
8605 *
8606 * _.values('hi');
8607 * // => ['h', 'i']
8608 */
8609function values(object) {
8610 return object == null ? [] : baseValues(object, keys(object));
8611}
8612
8613module.exports = values;
8614
8615
8616/***/ }),
8617/* 276 */
8618/***/ (function(module, exports, __webpack_require__) {
8619
8620var root = __webpack_require__(277);
8621
8622/** Built-in value references. */
8623var Symbol = root.Symbol;
8624
8625module.exports = Symbol;
8626
8627
8628/***/ }),
8629/* 277 */
8630/***/ (function(module, exports, __webpack_require__) {
8631
8632var freeGlobal = __webpack_require__(278);
8633
8634/** Detect free variable `self`. */
8635var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
8636
8637/** Used as a reference to the global object. */
8638var root = freeGlobal || freeSelf || Function('return this')();
8639
8640module.exports = root;
8641
8642
8643/***/ }),
8644/* 278 */
8645/***/ (function(module, exports, __webpack_require__) {
8646
8647/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
8648var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
8649
8650module.exports = freeGlobal;
8651
8652/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(78)))
8653
8654/***/ }),
8655/* 279 */
8656/***/ (function(module, exports) {
8657
8658/**
8659 * Checks if `value` is classified as an `Array` object.
8660 *
8661 * @static
8662 * @memberOf _
8663 * @since 0.1.0
8664 * @category Lang
8665 * @param {*} value The value to check.
8666 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
8667 * @example
8668 *
8669 * _.isArray([1, 2, 3]);
8670 * // => true
8671 *
8672 * _.isArray(document.body.children);
8673 * // => false
8674 *
8675 * _.isArray('abc');
8676 * // => false
8677 *
8678 * _.isArray(_.noop);
8679 * // => false
8680 */
8681var isArray = Array.isArray;
8682
8683module.exports = isArray;
8684
8685
8686/***/ }),
8687/* 280 */
8688/***/ (function(module, exports) {
8689
8690module.exports = function(module) {
8691 if(!module.webpackPolyfill) {
8692 module.deprecate = function() {};
8693 module.paths = [];
8694 // module.parent = undefined by default
8695 if(!module.children) module.children = [];
8696 Object.defineProperty(module, "loaded", {
8697 enumerable: true,
8698 get: function() {
8699 return module.l;
8700 }
8701 });
8702 Object.defineProperty(module, "id", {
8703 enumerable: true,
8704 get: function() {
8705 return module.i;
8706 }
8707 });
8708 module.webpackPolyfill = 1;
8709 }
8710 return module;
8711};
8712
8713
8714/***/ }),
8715/* 281 */
8716/***/ (function(module, exports) {
8717
8718/** Used as references for various `Number` constants. */
8719var MAX_SAFE_INTEGER = 9007199254740991;
8720
8721/**
8722 * Checks if `value` is a valid array-like length.
8723 *
8724 * **Note:** This method is loosely based on
8725 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
8726 *
8727 * @static
8728 * @memberOf _
8729 * @since 4.0.0
8730 * @category Lang
8731 * @param {*} value The value to check.
8732 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
8733 * @example
8734 *
8735 * _.isLength(3);
8736 * // => true
8737 *
8738 * _.isLength(Number.MIN_VALUE);
8739 * // => false
8740 *
8741 * _.isLength(Infinity);
8742 * // => false
8743 *
8744 * _.isLength('3');
8745 * // => false
8746 */
8747function isLength(value) {
8748 return typeof value == 'number' &&
8749 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
8750}
8751
8752module.exports = isLength;
8753
8754
8755/***/ }),
8756/* 282 */
8757/***/ (function(module, exports) {
8758
8759/**
8760 * Creates a unary function that invokes `func` with its argument transformed.
8761 *
8762 * @private
8763 * @param {Function} func The function to wrap.
8764 * @param {Function} transform The argument transform.
8765 * @returns {Function} Returns the new function.
8766 */
8767function overArg(func, transform) {
8768 return function(arg) {
8769 return func(transform(arg));
8770 };
8771}
8772
8773module.exports = overArg;
8774
8775
8776/***/ }),
8777/* 283 */
8778/***/ (function(module, exports, __webpack_require__) {
8779
8780"use strict";
8781
8782
8783var AV = __webpack_require__(284);
8784
8785var useLiveQuery = __webpack_require__(622);
8786
8787var useAdatpers = __webpack_require__(259);
8788
8789module.exports = useAdatpers(useLiveQuery(AV));
8790
8791/***/ }),
8792/* 284 */
8793/***/ (function(module, exports, __webpack_require__) {
8794
8795"use strict";
8796
8797
8798var AV = __webpack_require__(285);
8799
8800var useAdatpers = __webpack_require__(259);
8801
8802module.exports = useAdatpers(AV);
8803
8804/***/ }),
8805/* 285 */
8806/***/ (function(module, exports, __webpack_require__) {
8807
8808"use strict";
8809
8810
8811module.exports = __webpack_require__(286);
8812
8813/***/ }),
8814/* 286 */
8815/***/ (function(module, exports, __webpack_require__) {
8816
8817"use strict";
8818
8819
8820var _interopRequireDefault = __webpack_require__(1);
8821
8822var _promise = _interopRequireDefault(__webpack_require__(12));
8823
8824/*!
8825 * LeanCloud JavaScript SDK
8826 * https://leancloud.cn
8827 *
8828 * Copyright 2016 LeanCloud.cn, Inc.
8829 * The LeanCloud JavaScript SDK is freely distributable under the MIT license.
8830 */
8831var _ = __webpack_require__(3);
8832
8833var AV = __webpack_require__(74);
8834
8835AV._ = _;
8836AV.version = __webpack_require__(234);
8837AV.Promise = _promise.default;
8838AV.localStorage = __webpack_require__(236);
8839AV.Cache = __webpack_require__(237);
8840AV.Error = __webpack_require__(48);
8841
8842__webpack_require__(425);
8843
8844__webpack_require__(473)(AV);
8845
8846__webpack_require__(474)(AV);
8847
8848__webpack_require__(475)(AV);
8849
8850__webpack_require__(476)(AV);
8851
8852__webpack_require__(481)(AV);
8853
8854__webpack_require__(482)(AV);
8855
8856__webpack_require__(535)(AV);
8857
8858__webpack_require__(560)(AV);
8859
8860__webpack_require__(561)(AV);
8861
8862__webpack_require__(563)(AV);
8863
8864__webpack_require__(564)(AV);
8865
8866__webpack_require__(565)(AV);
8867
8868__webpack_require__(566)(AV);
8869
8870__webpack_require__(567)(AV);
8871
8872__webpack_require__(568)(AV);
8873
8874__webpack_require__(569)(AV);
8875
8876__webpack_require__(570)(AV);
8877
8878__webpack_require__(571)(AV);
8879
8880AV.Conversation = __webpack_require__(572);
8881
8882__webpack_require__(573);
8883
8884module.exports = AV;
8885/**
8886 * Options to controll the authentication for an operation
8887 * @typedef {Object} AuthOptions
8888 * @property {String} [sessionToken] Specify a user to excute the operation as.
8889 * @property {AV.User} [user] Specify a user to excute the operation as. The user must have _sessionToken. This option will be ignored if sessionToken option provided.
8890 * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
8891 */
8892
8893/**
8894 * Options to controll the authentication for an SMS operation
8895 * @typedef {Object} SMSAuthOptions
8896 * @property {String} [sessionToken] Specify a user to excute the operation as.
8897 * @property {AV.User} [user] Specify a user to excute the operation as. The user must have _sessionToken. This option will be ignored if sessionToken option provided.
8898 * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
8899 * @property {String} [validateToken] a validate token returned by {@link AV.Cloud.verifyCaptcha}
8900 */
8901
8902/***/ }),
8903/* 287 */
8904/***/ (function(module, exports, __webpack_require__) {
8905
8906var parent = __webpack_require__(288);
8907__webpack_require__(46);
8908
8909module.exports = parent;
8910
8911
8912/***/ }),
8913/* 288 */
8914/***/ (function(module, exports, __webpack_require__) {
8915
8916__webpack_require__(289);
8917__webpack_require__(43);
8918__webpack_require__(68);
8919__webpack_require__(304);
8920__webpack_require__(318);
8921__webpack_require__(319);
8922__webpack_require__(320);
8923__webpack_require__(70);
8924var path = __webpack_require__(7);
8925
8926module.exports = path.Promise;
8927
8928
8929/***/ }),
8930/* 289 */
8931/***/ (function(module, exports, __webpack_require__) {
8932
8933// TODO: Remove this module from `core-js@4` since it's replaced to module below
8934__webpack_require__(290);
8935
8936
8937/***/ }),
8938/* 290 */
8939/***/ (function(module, exports, __webpack_require__) {
8940
8941"use strict";
8942
8943var $ = __webpack_require__(0);
8944var isPrototypeOf = __webpack_require__(16);
8945var getPrototypeOf = __webpack_require__(102);
8946var setPrototypeOf = __webpack_require__(104);
8947var copyConstructorProperties = __webpack_require__(295);
8948var create = __webpack_require__(53);
8949var createNonEnumerableProperty = __webpack_require__(39);
8950var createPropertyDescriptor = __webpack_require__(49);
8951var clearErrorStack = __webpack_require__(298);
8952var installErrorCause = __webpack_require__(299);
8953var iterate = __webpack_require__(41);
8954var normalizeStringArgument = __webpack_require__(300);
8955var wellKnownSymbol = __webpack_require__(5);
8956var ERROR_STACK_INSTALLABLE = __webpack_require__(301);
8957
8958var TO_STRING_TAG = wellKnownSymbol('toStringTag');
8959var $Error = Error;
8960var push = [].push;
8961
8962var $AggregateError = function AggregateError(errors, message /* , options */) {
8963 var options = arguments.length > 2 ? arguments[2] : undefined;
8964 var isInstance = isPrototypeOf(AggregateErrorPrototype, this);
8965 var that;
8966 if (setPrototypeOf) {
8967 that = setPrototypeOf(new $Error(), isInstance ? getPrototypeOf(this) : AggregateErrorPrototype);
8968 } else {
8969 that = isInstance ? this : create(AggregateErrorPrototype);
8970 createNonEnumerableProperty(that, TO_STRING_TAG, 'Error');
8971 }
8972 if (message !== undefined) createNonEnumerableProperty(that, 'message', normalizeStringArgument(message));
8973 if (ERROR_STACK_INSTALLABLE) createNonEnumerableProperty(that, 'stack', clearErrorStack(that.stack, 1));
8974 installErrorCause(that, options);
8975 var errorsArray = [];
8976 iterate(errors, push, { that: errorsArray });
8977 createNonEnumerableProperty(that, 'errors', errorsArray);
8978 return that;
8979};
8980
8981if (setPrototypeOf) setPrototypeOf($AggregateError, $Error);
8982else copyConstructorProperties($AggregateError, $Error, { name: true });
8983
8984var AggregateErrorPrototype = $AggregateError.prototype = create($Error.prototype, {
8985 constructor: createPropertyDescriptor(1, $AggregateError),
8986 message: createPropertyDescriptor(1, ''),
8987 name: createPropertyDescriptor(1, 'AggregateError')
8988});
8989
8990// `AggregateError` constructor
8991// https://tc39.es/ecma262/#sec-aggregate-error-constructor
8992$({ global: true, constructor: true, arity: 2 }, {
8993 AggregateError: $AggregateError
8994});
8995
8996
8997/***/ }),
8998/* 291 */
8999/***/ (function(module, exports, __webpack_require__) {
9000
9001var call = __webpack_require__(15);
9002var isObject = __webpack_require__(11);
9003var isSymbol = __webpack_require__(100);
9004var getMethod = __webpack_require__(123);
9005var ordinaryToPrimitive = __webpack_require__(292);
9006var wellKnownSymbol = __webpack_require__(5);
9007
9008var $TypeError = TypeError;
9009var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
9010
9011// `ToPrimitive` abstract operation
9012// https://tc39.es/ecma262/#sec-toprimitive
9013module.exports = function (input, pref) {
9014 if (!isObject(input) || isSymbol(input)) return input;
9015 var exoticToPrim = getMethod(input, TO_PRIMITIVE);
9016 var result;
9017 if (exoticToPrim) {
9018 if (pref === undefined) pref = 'default';
9019 result = call(exoticToPrim, input, pref);
9020 if (!isObject(result) || isSymbol(result)) return result;
9021 throw $TypeError("Can't convert object to primitive value");
9022 }
9023 if (pref === undefined) pref = 'number';
9024 return ordinaryToPrimitive(input, pref);
9025};
9026
9027
9028/***/ }),
9029/* 292 */
9030/***/ (function(module, exports, __webpack_require__) {
9031
9032var call = __webpack_require__(15);
9033var isCallable = __webpack_require__(9);
9034var isObject = __webpack_require__(11);
9035
9036var $TypeError = TypeError;
9037
9038// `OrdinaryToPrimitive` abstract operation
9039// https://tc39.es/ecma262/#sec-ordinarytoprimitive
9040module.exports = function (input, pref) {
9041 var fn, val;
9042 if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
9043 if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
9044 if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
9045 throw $TypeError("Can't convert object to primitive value");
9046};
9047
9048
9049/***/ }),
9050/* 293 */
9051/***/ (function(module, exports, __webpack_require__) {
9052
9053var global = __webpack_require__(8);
9054
9055// eslint-disable-next-line es-x/no-object-defineproperty -- safe
9056var defineProperty = Object.defineProperty;
9057
9058module.exports = function (key, value) {
9059 try {
9060 defineProperty(global, key, { value: value, configurable: true, writable: true });
9061 } catch (error) {
9062 global[key] = value;
9063 } return value;
9064};
9065
9066
9067/***/ }),
9068/* 294 */
9069/***/ (function(module, exports, __webpack_require__) {
9070
9071var isCallable = __webpack_require__(9);
9072
9073var $String = String;
9074var $TypeError = TypeError;
9075
9076module.exports = function (argument) {
9077 if (typeof argument == 'object' || isCallable(argument)) return argument;
9078 throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
9079};
9080
9081
9082/***/ }),
9083/* 295 */
9084/***/ (function(module, exports, __webpack_require__) {
9085
9086var hasOwn = __webpack_require__(13);
9087var ownKeys = __webpack_require__(163);
9088var getOwnPropertyDescriptorModule = __webpack_require__(64);
9089var definePropertyModule = __webpack_require__(23);
9090
9091module.exports = function (target, source, exceptions) {
9092 var keys = ownKeys(source);
9093 var defineProperty = definePropertyModule.f;
9094 var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
9095 for (var i = 0; i < keys.length; i++) {
9096 var key = keys[i];
9097 if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
9098 defineProperty(target, key, getOwnPropertyDescriptor(source, key));
9099 }
9100 }
9101};
9102
9103
9104/***/ }),
9105/* 296 */
9106/***/ (function(module, exports) {
9107
9108var ceil = Math.ceil;
9109var floor = Math.floor;
9110
9111// `Math.trunc` method
9112// https://tc39.es/ecma262/#sec-math.trunc
9113// eslint-disable-next-line es-x/no-math-trunc -- safe
9114module.exports = Math.trunc || function trunc(x) {
9115 var n = +x;
9116 return (n > 0 ? floor : ceil)(n);
9117};
9118
9119
9120/***/ }),
9121/* 297 */
9122/***/ (function(module, exports, __webpack_require__) {
9123
9124var toIntegerOrInfinity = __webpack_require__(128);
9125
9126var min = Math.min;
9127
9128// `ToLength` abstract operation
9129// https://tc39.es/ecma262/#sec-tolength
9130module.exports = function (argument) {
9131 return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
9132};
9133
9134
9135/***/ }),
9136/* 298 */
9137/***/ (function(module, exports, __webpack_require__) {
9138
9139var uncurryThis = __webpack_require__(4);
9140
9141var $Error = Error;
9142var replace = uncurryThis(''.replace);
9143
9144var TEST = (function (arg) { return String($Error(arg).stack); })('zxcasd');
9145var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
9146var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
9147
9148module.exports = function (stack, dropEntries) {
9149 if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {
9150 while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');
9151 } return stack;
9152};
9153
9154
9155/***/ }),
9156/* 299 */
9157/***/ (function(module, exports, __webpack_require__) {
9158
9159var isObject = __webpack_require__(11);
9160var createNonEnumerableProperty = __webpack_require__(39);
9161
9162// `InstallErrorCause` abstract operation
9163// https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause
9164module.exports = function (O, options) {
9165 if (isObject(options) && 'cause' in options) {
9166 createNonEnumerableProperty(O, 'cause', options.cause);
9167 }
9168};
9169
9170
9171/***/ }),
9172/* 300 */
9173/***/ (function(module, exports, __webpack_require__) {
9174
9175var toString = __webpack_require__(42);
9176
9177module.exports = function (argument, $default) {
9178 return argument === undefined ? arguments.length < 2 ? '' : $default : toString(argument);
9179};
9180
9181
9182/***/ }),
9183/* 301 */
9184/***/ (function(module, exports, __webpack_require__) {
9185
9186var fails = __webpack_require__(2);
9187var createPropertyDescriptor = __webpack_require__(49);
9188
9189module.exports = !fails(function () {
9190 var error = Error('a');
9191 if (!('stack' in error)) return true;
9192 // eslint-disable-next-line es-x/no-object-defineproperty -- safe
9193 Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
9194 return error.stack !== 7;
9195});
9196
9197
9198/***/ }),
9199/* 302 */
9200/***/ (function(module, exports, __webpack_require__) {
9201
9202"use strict";
9203
9204var IteratorPrototype = __webpack_require__(171).IteratorPrototype;
9205var create = __webpack_require__(53);
9206var createPropertyDescriptor = __webpack_require__(49);
9207var setToStringTag = __webpack_require__(56);
9208var Iterators = __webpack_require__(54);
9209
9210var returnThis = function () { return this; };
9211
9212module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
9213 var TO_STRING_TAG = NAME + ' Iterator';
9214 IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
9215 setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
9216 Iterators[TO_STRING_TAG] = returnThis;
9217 return IteratorConstructor;
9218};
9219
9220
9221/***/ }),
9222/* 303 */
9223/***/ (function(module, exports, __webpack_require__) {
9224
9225"use strict";
9226
9227var TO_STRING_TAG_SUPPORT = __webpack_require__(131);
9228var classof = __webpack_require__(55);
9229
9230// `Object.prototype.toString` method implementation
9231// https://tc39.es/ecma262/#sec-object.prototype.tostring
9232module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
9233 return '[object ' + classof(this) + ']';
9234};
9235
9236
9237/***/ }),
9238/* 304 */
9239/***/ (function(module, exports, __webpack_require__) {
9240
9241// TODO: Remove this module from `core-js@4` since it's split to modules listed below
9242__webpack_require__(305);
9243__webpack_require__(313);
9244__webpack_require__(314);
9245__webpack_require__(315);
9246__webpack_require__(316);
9247__webpack_require__(317);
9248
9249
9250/***/ }),
9251/* 305 */
9252/***/ (function(module, exports, __webpack_require__) {
9253
9254"use strict";
9255
9256var $ = __webpack_require__(0);
9257var IS_PURE = __webpack_require__(36);
9258var IS_NODE = __webpack_require__(109);
9259var global = __webpack_require__(8);
9260var call = __webpack_require__(15);
9261var defineBuiltIn = __webpack_require__(45);
9262var setPrototypeOf = __webpack_require__(104);
9263var setToStringTag = __webpack_require__(56);
9264var setSpecies = __webpack_require__(172);
9265var aCallable = __webpack_require__(29);
9266var isCallable = __webpack_require__(9);
9267var isObject = __webpack_require__(11);
9268var anInstance = __webpack_require__(110);
9269var speciesConstructor = __webpack_require__(173);
9270var task = __webpack_require__(175).set;
9271var microtask = __webpack_require__(307);
9272var hostReportErrors = __webpack_require__(310);
9273var perform = __webpack_require__(84);
9274var Queue = __webpack_require__(311);
9275var InternalStateModule = __webpack_require__(44);
9276var NativePromiseConstructor = __webpack_require__(69);
9277var PromiseConstructorDetection = __webpack_require__(85);
9278var newPromiseCapabilityModule = __webpack_require__(57);
9279
9280var PROMISE = 'Promise';
9281var FORCED_PROMISE_CONSTRUCTOR = PromiseConstructorDetection.CONSTRUCTOR;
9282var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;
9283var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;
9284var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
9285var setInternalState = InternalStateModule.set;
9286var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
9287var PromiseConstructor = NativePromiseConstructor;
9288var PromisePrototype = NativePromisePrototype;
9289var TypeError = global.TypeError;
9290var document = global.document;
9291var process = global.process;
9292var newPromiseCapability = newPromiseCapabilityModule.f;
9293var newGenericPromiseCapability = newPromiseCapability;
9294
9295var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
9296var UNHANDLED_REJECTION = 'unhandledrejection';
9297var REJECTION_HANDLED = 'rejectionhandled';
9298var PENDING = 0;
9299var FULFILLED = 1;
9300var REJECTED = 2;
9301var HANDLED = 1;
9302var UNHANDLED = 2;
9303
9304var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
9305
9306// helpers
9307var isThenable = function (it) {
9308 var then;
9309 return isObject(it) && isCallable(then = it.then) ? then : false;
9310};
9311
9312var callReaction = function (reaction, state) {
9313 var value = state.value;
9314 var ok = state.state == FULFILLED;
9315 var handler = ok ? reaction.ok : reaction.fail;
9316 var resolve = reaction.resolve;
9317 var reject = reaction.reject;
9318 var domain = reaction.domain;
9319 var result, then, exited;
9320 try {
9321 if (handler) {
9322 if (!ok) {
9323 if (state.rejection === UNHANDLED) onHandleUnhandled(state);
9324 state.rejection = HANDLED;
9325 }
9326 if (handler === true) result = value;
9327 else {
9328 if (domain) domain.enter();
9329 result = handler(value); // can throw
9330 if (domain) {
9331 domain.exit();
9332 exited = true;
9333 }
9334 }
9335 if (result === reaction.promise) {
9336 reject(TypeError('Promise-chain cycle'));
9337 } else if (then = isThenable(result)) {
9338 call(then, result, resolve, reject);
9339 } else resolve(result);
9340 } else reject(value);
9341 } catch (error) {
9342 if (domain && !exited) domain.exit();
9343 reject(error);
9344 }
9345};
9346
9347var notify = function (state, isReject) {
9348 if (state.notified) return;
9349 state.notified = true;
9350 microtask(function () {
9351 var reactions = state.reactions;
9352 var reaction;
9353 while (reaction = reactions.get()) {
9354 callReaction(reaction, state);
9355 }
9356 state.notified = false;
9357 if (isReject && !state.rejection) onUnhandled(state);
9358 });
9359};
9360
9361var dispatchEvent = function (name, promise, reason) {
9362 var event, handler;
9363 if (DISPATCH_EVENT) {
9364 event = document.createEvent('Event');
9365 event.promise = promise;
9366 event.reason = reason;
9367 event.initEvent(name, false, true);
9368 global.dispatchEvent(event);
9369 } else event = { promise: promise, reason: reason };
9370 if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global['on' + name])) handler(event);
9371 else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
9372};
9373
9374var onUnhandled = function (state) {
9375 call(task, global, function () {
9376 var promise = state.facade;
9377 var value = state.value;
9378 var IS_UNHANDLED = isUnhandled(state);
9379 var result;
9380 if (IS_UNHANDLED) {
9381 result = perform(function () {
9382 if (IS_NODE) {
9383 process.emit('unhandledRejection', value, promise);
9384 } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
9385 });
9386 // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
9387 state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
9388 if (result.error) throw result.value;
9389 }
9390 });
9391};
9392
9393var isUnhandled = function (state) {
9394 return state.rejection !== HANDLED && !state.parent;
9395};
9396
9397var onHandleUnhandled = function (state) {
9398 call(task, global, function () {
9399 var promise = state.facade;
9400 if (IS_NODE) {
9401 process.emit('rejectionHandled', promise);
9402 } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
9403 });
9404};
9405
9406var bind = function (fn, state, unwrap) {
9407 return function (value) {
9408 fn(state, value, unwrap);
9409 };
9410};
9411
9412var internalReject = function (state, value, unwrap) {
9413 if (state.done) return;
9414 state.done = true;
9415 if (unwrap) state = unwrap;
9416 state.value = value;
9417 state.state = REJECTED;
9418 notify(state, true);
9419};
9420
9421var internalResolve = function (state, value, unwrap) {
9422 if (state.done) return;
9423 state.done = true;
9424 if (unwrap) state = unwrap;
9425 try {
9426 if (state.facade === value) throw TypeError("Promise can't be resolved itself");
9427 var then = isThenable(value);
9428 if (then) {
9429 microtask(function () {
9430 var wrapper = { done: false };
9431 try {
9432 call(then, value,
9433 bind(internalResolve, wrapper, state),
9434 bind(internalReject, wrapper, state)
9435 );
9436 } catch (error) {
9437 internalReject(wrapper, error, state);
9438 }
9439 });
9440 } else {
9441 state.value = value;
9442 state.state = FULFILLED;
9443 notify(state, false);
9444 }
9445 } catch (error) {
9446 internalReject({ done: false }, error, state);
9447 }
9448};
9449
9450// constructor polyfill
9451if (FORCED_PROMISE_CONSTRUCTOR) {
9452 // 25.4.3.1 Promise(executor)
9453 PromiseConstructor = function Promise(executor) {
9454 anInstance(this, PromisePrototype);
9455 aCallable(executor);
9456 call(Internal, this);
9457 var state = getInternalPromiseState(this);
9458 try {
9459 executor(bind(internalResolve, state), bind(internalReject, state));
9460 } catch (error) {
9461 internalReject(state, error);
9462 }
9463 };
9464
9465 PromisePrototype = PromiseConstructor.prototype;
9466
9467 // eslint-disable-next-line no-unused-vars -- required for `.length`
9468 Internal = function Promise(executor) {
9469 setInternalState(this, {
9470 type: PROMISE,
9471 done: false,
9472 notified: false,
9473 parent: false,
9474 reactions: new Queue(),
9475 rejection: false,
9476 state: PENDING,
9477 value: undefined
9478 });
9479 };
9480
9481 // `Promise.prototype.then` method
9482 // https://tc39.es/ecma262/#sec-promise.prototype.then
9483 Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
9484 var state = getInternalPromiseState(this);
9485 var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
9486 state.parent = true;
9487 reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
9488 reaction.fail = isCallable(onRejected) && onRejected;
9489 reaction.domain = IS_NODE ? process.domain : undefined;
9490 if (state.state == PENDING) state.reactions.add(reaction);
9491 else microtask(function () {
9492 callReaction(reaction, state);
9493 });
9494 return reaction.promise;
9495 });
9496
9497 OwnPromiseCapability = function () {
9498 var promise = new Internal();
9499 var state = getInternalPromiseState(promise);
9500 this.promise = promise;
9501 this.resolve = bind(internalResolve, state);
9502 this.reject = bind(internalReject, state);
9503 };
9504
9505 newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
9506 return C === PromiseConstructor || C === PromiseWrapper
9507 ? new OwnPromiseCapability(C)
9508 : newGenericPromiseCapability(C);
9509 };
9510
9511 if (!IS_PURE && isCallable(NativePromiseConstructor) && NativePromisePrototype !== Object.prototype) {
9512 nativeThen = NativePromisePrototype.then;
9513
9514 if (!NATIVE_PROMISE_SUBCLASSING) {
9515 // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
9516 defineBuiltIn(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
9517 var that = this;
9518 return new PromiseConstructor(function (resolve, reject) {
9519 call(nativeThen, that, resolve, reject);
9520 }).then(onFulfilled, onRejected);
9521 // https://github.com/zloirock/core-js/issues/640
9522 }, { unsafe: true });
9523 }
9524
9525 // make `.constructor === Promise` work for native promise-based APIs
9526 try {
9527 delete NativePromisePrototype.constructor;
9528 } catch (error) { /* empty */ }
9529
9530 // make `instanceof Promise` work for native promise-based APIs
9531 if (setPrototypeOf) {
9532 setPrototypeOf(NativePromisePrototype, PromisePrototype);
9533 }
9534 }
9535}
9536
9537$({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
9538 Promise: PromiseConstructor
9539});
9540
9541setToStringTag(PromiseConstructor, PROMISE, false, true);
9542setSpecies(PROMISE);
9543
9544
9545/***/ }),
9546/* 306 */
9547/***/ (function(module, exports) {
9548
9549var $TypeError = TypeError;
9550
9551module.exports = function (passed, required) {
9552 if (passed < required) throw $TypeError('Not enough arguments');
9553 return passed;
9554};
9555
9556
9557/***/ }),
9558/* 307 */
9559/***/ (function(module, exports, __webpack_require__) {
9560
9561var global = __webpack_require__(8);
9562var bind = __webpack_require__(52);
9563var getOwnPropertyDescriptor = __webpack_require__(64).f;
9564var macrotask = __webpack_require__(175).set;
9565var IS_IOS = __webpack_require__(176);
9566var IS_IOS_PEBBLE = __webpack_require__(308);
9567var IS_WEBOS_WEBKIT = __webpack_require__(309);
9568var IS_NODE = __webpack_require__(109);
9569
9570var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
9571var document = global.document;
9572var process = global.process;
9573var Promise = global.Promise;
9574// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
9575var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
9576var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
9577
9578var flush, head, last, notify, toggle, node, promise, then;
9579
9580// modern engines have queueMicrotask method
9581if (!queueMicrotask) {
9582 flush = function () {
9583 var parent, fn;
9584 if (IS_NODE && (parent = process.domain)) parent.exit();
9585 while (head) {
9586 fn = head.fn;
9587 head = head.next;
9588 try {
9589 fn();
9590 } catch (error) {
9591 if (head) notify();
9592 else last = undefined;
9593 throw error;
9594 }
9595 } last = undefined;
9596 if (parent) parent.enter();
9597 };
9598
9599 // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
9600 // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
9601 if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) {
9602 toggle = true;
9603 node = document.createTextNode('');
9604 new MutationObserver(flush).observe(node, { characterData: true });
9605 notify = function () {
9606 node.data = toggle = !toggle;
9607 };
9608 // environments with maybe non-completely correct, but existent Promise
9609 } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) {
9610 // Promise.resolve without an argument throws an error in LG WebOS 2
9611 promise = Promise.resolve(undefined);
9612 // workaround of WebKit ~ iOS Safari 10.1 bug
9613 promise.constructor = Promise;
9614 then = bind(promise.then, promise);
9615 notify = function () {
9616 then(flush);
9617 };
9618 // Node.js without promises
9619 } else if (IS_NODE) {
9620 notify = function () {
9621 process.nextTick(flush);
9622 };
9623 // for other environments - macrotask based on:
9624 // - setImmediate
9625 // - MessageChannel
9626 // - window.postMessage
9627 // - onreadystatechange
9628 // - setTimeout
9629 } else {
9630 // strange IE + webpack dev server bug - use .bind(global)
9631 macrotask = bind(macrotask, global);
9632 notify = function () {
9633 macrotask(flush);
9634 };
9635 }
9636}
9637
9638module.exports = queueMicrotask || function (fn) {
9639 var task = { fn: fn, next: undefined };
9640 if (last) last.next = task;
9641 if (!head) {
9642 head = task;
9643 notify();
9644 } last = task;
9645};
9646
9647
9648/***/ }),
9649/* 308 */
9650/***/ (function(module, exports, __webpack_require__) {
9651
9652var userAgent = __webpack_require__(51);
9653var global = __webpack_require__(8);
9654
9655module.exports = /ipad|iphone|ipod/i.test(userAgent) && global.Pebble !== undefined;
9656
9657
9658/***/ }),
9659/* 309 */
9660/***/ (function(module, exports, __webpack_require__) {
9661
9662var userAgent = __webpack_require__(51);
9663
9664module.exports = /web0s(?!.*chrome)/i.test(userAgent);
9665
9666
9667/***/ }),
9668/* 310 */
9669/***/ (function(module, exports, __webpack_require__) {
9670
9671var global = __webpack_require__(8);
9672
9673module.exports = function (a, b) {
9674 var console = global.console;
9675 if (console && console.error) {
9676 arguments.length == 1 ? console.error(a) : console.error(a, b);
9677 }
9678};
9679
9680
9681/***/ }),
9682/* 311 */
9683/***/ (function(module, exports) {
9684
9685var Queue = function () {
9686 this.head = null;
9687 this.tail = null;
9688};
9689
9690Queue.prototype = {
9691 add: function (item) {
9692 var entry = { item: item, next: null };
9693 if (this.head) this.tail.next = entry;
9694 else this.head = entry;
9695 this.tail = entry;
9696 },
9697 get: function () {
9698 var entry = this.head;
9699 if (entry) {
9700 this.head = entry.next;
9701 if (this.tail === entry) this.tail = null;
9702 return entry.item;
9703 }
9704 }
9705};
9706
9707module.exports = Queue;
9708
9709
9710/***/ }),
9711/* 312 */
9712/***/ (function(module, exports) {
9713
9714module.exports = typeof window == 'object' && typeof Deno != 'object';
9715
9716
9717/***/ }),
9718/* 313 */
9719/***/ (function(module, exports, __webpack_require__) {
9720
9721"use strict";
9722
9723var $ = __webpack_require__(0);
9724var call = __webpack_require__(15);
9725var aCallable = __webpack_require__(29);
9726var newPromiseCapabilityModule = __webpack_require__(57);
9727var perform = __webpack_require__(84);
9728var iterate = __webpack_require__(41);
9729var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(177);
9730
9731// `Promise.all` method
9732// https://tc39.es/ecma262/#sec-promise.all
9733$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
9734 all: function all(iterable) {
9735 var C = this;
9736 var capability = newPromiseCapabilityModule.f(C);
9737 var resolve = capability.resolve;
9738 var reject = capability.reject;
9739 var result = perform(function () {
9740 var $promiseResolve = aCallable(C.resolve);
9741 var values = [];
9742 var counter = 0;
9743 var remaining = 1;
9744 iterate(iterable, function (promise) {
9745 var index = counter++;
9746 var alreadyCalled = false;
9747 remaining++;
9748 call($promiseResolve, C, promise).then(function (value) {
9749 if (alreadyCalled) return;
9750 alreadyCalled = true;
9751 values[index] = value;
9752 --remaining || resolve(values);
9753 }, reject);
9754 });
9755 --remaining || resolve(values);
9756 });
9757 if (result.error) reject(result.value);
9758 return capability.promise;
9759 }
9760});
9761
9762
9763/***/ }),
9764/* 314 */
9765/***/ (function(module, exports, __webpack_require__) {
9766
9767"use strict";
9768
9769var $ = __webpack_require__(0);
9770var IS_PURE = __webpack_require__(36);
9771var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(85).CONSTRUCTOR;
9772var NativePromiseConstructor = __webpack_require__(69);
9773var getBuiltIn = __webpack_require__(20);
9774var isCallable = __webpack_require__(9);
9775var defineBuiltIn = __webpack_require__(45);
9776
9777var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
9778
9779// `Promise.prototype.catch` method
9780// https://tc39.es/ecma262/#sec-promise.prototype.catch
9781$({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR, real: true }, {
9782 'catch': function (onRejected) {
9783 return this.then(undefined, onRejected);
9784 }
9785});
9786
9787// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
9788if (!IS_PURE && isCallable(NativePromiseConstructor)) {
9789 var method = getBuiltIn('Promise').prototype['catch'];
9790 if (NativePromisePrototype['catch'] !== method) {
9791 defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });
9792 }
9793}
9794
9795
9796/***/ }),
9797/* 315 */
9798/***/ (function(module, exports, __webpack_require__) {
9799
9800"use strict";
9801
9802var $ = __webpack_require__(0);
9803var call = __webpack_require__(15);
9804var aCallable = __webpack_require__(29);
9805var newPromiseCapabilityModule = __webpack_require__(57);
9806var perform = __webpack_require__(84);
9807var iterate = __webpack_require__(41);
9808var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(177);
9809
9810// `Promise.race` method
9811// https://tc39.es/ecma262/#sec-promise.race
9812$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
9813 race: function race(iterable) {
9814 var C = this;
9815 var capability = newPromiseCapabilityModule.f(C);
9816 var reject = capability.reject;
9817 var result = perform(function () {
9818 var $promiseResolve = aCallable(C.resolve);
9819 iterate(iterable, function (promise) {
9820 call($promiseResolve, C, promise).then(capability.resolve, reject);
9821 });
9822 });
9823 if (result.error) reject(result.value);
9824 return capability.promise;
9825 }
9826});
9827
9828
9829/***/ }),
9830/* 316 */
9831/***/ (function(module, exports, __webpack_require__) {
9832
9833"use strict";
9834
9835var $ = __webpack_require__(0);
9836var call = __webpack_require__(15);
9837var newPromiseCapabilityModule = __webpack_require__(57);
9838var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(85).CONSTRUCTOR;
9839
9840// `Promise.reject` method
9841// https://tc39.es/ecma262/#sec-promise.reject
9842$({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
9843 reject: function reject(r) {
9844 var capability = newPromiseCapabilityModule.f(this);
9845 call(capability.reject, undefined, r);
9846 return capability.promise;
9847 }
9848});
9849
9850
9851/***/ }),
9852/* 317 */
9853/***/ (function(module, exports, __webpack_require__) {
9854
9855"use strict";
9856
9857var $ = __webpack_require__(0);
9858var getBuiltIn = __webpack_require__(20);
9859var IS_PURE = __webpack_require__(36);
9860var NativePromiseConstructor = __webpack_require__(69);
9861var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(85).CONSTRUCTOR;
9862var promiseResolve = __webpack_require__(179);
9863
9864var PromiseConstructorWrapper = getBuiltIn('Promise');
9865var CHECK_WRAPPER = IS_PURE && !FORCED_PROMISE_CONSTRUCTOR;
9866
9867// `Promise.resolve` method
9868// https://tc39.es/ecma262/#sec-promise.resolve
9869$({ target: 'Promise', stat: true, forced: IS_PURE || FORCED_PROMISE_CONSTRUCTOR }, {
9870 resolve: function resolve(x) {
9871 return promiseResolve(CHECK_WRAPPER && this === PromiseConstructorWrapper ? NativePromiseConstructor : this, x);
9872 }
9873});
9874
9875
9876/***/ }),
9877/* 318 */
9878/***/ (function(module, exports, __webpack_require__) {
9879
9880"use strict";
9881
9882var $ = __webpack_require__(0);
9883var call = __webpack_require__(15);
9884var aCallable = __webpack_require__(29);
9885var newPromiseCapabilityModule = __webpack_require__(57);
9886var perform = __webpack_require__(84);
9887var iterate = __webpack_require__(41);
9888
9889// `Promise.allSettled` method
9890// https://tc39.es/ecma262/#sec-promise.allsettled
9891$({ target: 'Promise', stat: true }, {
9892 allSettled: function allSettled(iterable) {
9893 var C = this;
9894 var capability = newPromiseCapabilityModule.f(C);
9895 var resolve = capability.resolve;
9896 var reject = capability.reject;
9897 var result = perform(function () {
9898 var promiseResolve = aCallable(C.resolve);
9899 var values = [];
9900 var counter = 0;
9901 var remaining = 1;
9902 iterate(iterable, function (promise) {
9903 var index = counter++;
9904 var alreadyCalled = false;
9905 remaining++;
9906 call(promiseResolve, C, promise).then(function (value) {
9907 if (alreadyCalled) return;
9908 alreadyCalled = true;
9909 values[index] = { status: 'fulfilled', value: value };
9910 --remaining || resolve(values);
9911 }, function (error) {
9912 if (alreadyCalled) return;
9913 alreadyCalled = true;
9914 values[index] = { status: 'rejected', reason: error };
9915 --remaining || resolve(values);
9916 });
9917 });
9918 --remaining || resolve(values);
9919 });
9920 if (result.error) reject(result.value);
9921 return capability.promise;
9922 }
9923});
9924
9925
9926/***/ }),
9927/* 319 */
9928/***/ (function(module, exports, __webpack_require__) {
9929
9930"use strict";
9931
9932var $ = __webpack_require__(0);
9933var call = __webpack_require__(15);
9934var aCallable = __webpack_require__(29);
9935var getBuiltIn = __webpack_require__(20);
9936var newPromiseCapabilityModule = __webpack_require__(57);
9937var perform = __webpack_require__(84);
9938var iterate = __webpack_require__(41);
9939
9940var PROMISE_ANY_ERROR = 'No one promise resolved';
9941
9942// `Promise.any` method
9943// https://tc39.es/ecma262/#sec-promise.any
9944$({ target: 'Promise', stat: true }, {
9945 any: function any(iterable) {
9946 var C = this;
9947 var AggregateError = getBuiltIn('AggregateError');
9948 var capability = newPromiseCapabilityModule.f(C);
9949 var resolve = capability.resolve;
9950 var reject = capability.reject;
9951 var result = perform(function () {
9952 var promiseResolve = aCallable(C.resolve);
9953 var errors = [];
9954 var counter = 0;
9955 var remaining = 1;
9956 var alreadyResolved = false;
9957 iterate(iterable, function (promise) {
9958 var index = counter++;
9959 var alreadyRejected = false;
9960 remaining++;
9961 call(promiseResolve, C, promise).then(function (value) {
9962 if (alreadyRejected || alreadyResolved) return;
9963 alreadyResolved = true;
9964 resolve(value);
9965 }, function (error) {
9966 if (alreadyRejected || alreadyResolved) return;
9967 alreadyRejected = true;
9968 errors[index] = error;
9969 --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
9970 });
9971 });
9972 --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
9973 });
9974 if (result.error) reject(result.value);
9975 return capability.promise;
9976 }
9977});
9978
9979
9980/***/ }),
9981/* 320 */
9982/***/ (function(module, exports, __webpack_require__) {
9983
9984"use strict";
9985
9986var $ = __webpack_require__(0);
9987var IS_PURE = __webpack_require__(36);
9988var NativePromiseConstructor = __webpack_require__(69);
9989var fails = __webpack_require__(2);
9990var getBuiltIn = __webpack_require__(20);
9991var isCallable = __webpack_require__(9);
9992var speciesConstructor = __webpack_require__(173);
9993var promiseResolve = __webpack_require__(179);
9994var defineBuiltIn = __webpack_require__(45);
9995
9996var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
9997
9998// Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829
9999var NON_GENERIC = !!NativePromiseConstructor && fails(function () {
10000 // eslint-disable-next-line unicorn/no-thenable -- required for testing
10001 NativePromisePrototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ });
10002});
10003
10004// `Promise.prototype.finally` method
10005// https://tc39.es/ecma262/#sec-promise.prototype.finally
10006$({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, {
10007 'finally': function (onFinally) {
10008 var C = speciesConstructor(this, getBuiltIn('Promise'));
10009 var isFunction = isCallable(onFinally);
10010 return this.then(
10011 isFunction ? function (x) {
10012 return promiseResolve(C, onFinally()).then(function () { return x; });
10013 } : onFinally,
10014 isFunction ? function (e) {
10015 return promiseResolve(C, onFinally()).then(function () { throw e; });
10016 } : onFinally
10017 );
10018 }
10019});
10020
10021// makes sure that native promise-based APIs `Promise#finally` properly works with patched `Promise#then`
10022if (!IS_PURE && isCallable(NativePromiseConstructor)) {
10023 var method = getBuiltIn('Promise').prototype['finally'];
10024 if (NativePromisePrototype['finally'] !== method) {
10025 defineBuiltIn(NativePromisePrototype, 'finally', method, { unsafe: true });
10026 }
10027}
10028
10029
10030/***/ }),
10031/* 321 */
10032/***/ (function(module, exports, __webpack_require__) {
10033
10034var uncurryThis = __webpack_require__(4);
10035var toIntegerOrInfinity = __webpack_require__(128);
10036var toString = __webpack_require__(42);
10037var requireObjectCoercible = __webpack_require__(81);
10038
10039var charAt = uncurryThis(''.charAt);
10040var charCodeAt = uncurryThis(''.charCodeAt);
10041var stringSlice = uncurryThis(''.slice);
10042
10043var createMethod = function (CONVERT_TO_STRING) {
10044 return function ($this, pos) {
10045 var S = toString(requireObjectCoercible($this));
10046 var position = toIntegerOrInfinity(pos);
10047 var size = S.length;
10048 var first, second;
10049 if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
10050 first = charCodeAt(S, position);
10051 return first < 0xD800 || first > 0xDBFF || position + 1 === size
10052 || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
10053 ? CONVERT_TO_STRING
10054 ? charAt(S, position)
10055 : first
10056 : CONVERT_TO_STRING
10057 ? stringSlice(S, position, position + 2)
10058 : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
10059 };
10060};
10061
10062module.exports = {
10063 // `String.prototype.codePointAt` method
10064 // https://tc39.es/ecma262/#sec-string.prototype.codepointat
10065 codeAt: createMethod(false),
10066 // `String.prototype.at` method
10067 // https://github.com/mathiasbynens/String.prototype.at
10068 charAt: createMethod(true)
10069};
10070
10071
10072/***/ }),
10073/* 322 */
10074/***/ (function(module, exports) {
10075
10076// iterable DOM collections
10077// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
10078module.exports = {
10079 CSSRuleList: 0,
10080 CSSStyleDeclaration: 0,
10081 CSSValueList: 0,
10082 ClientRectList: 0,
10083 DOMRectList: 0,
10084 DOMStringList: 0,
10085 DOMTokenList: 1,
10086 DataTransferItemList: 0,
10087 FileList: 0,
10088 HTMLAllCollection: 0,
10089 HTMLCollection: 0,
10090 HTMLFormElement: 0,
10091 HTMLSelectElement: 0,
10092 MediaList: 0,
10093 MimeTypeArray: 0,
10094 NamedNodeMap: 0,
10095 NodeList: 1,
10096 PaintRequestList: 0,
10097 Plugin: 0,
10098 PluginArray: 0,
10099 SVGLengthList: 0,
10100 SVGNumberList: 0,
10101 SVGPathSegList: 0,
10102 SVGPointList: 0,
10103 SVGStringList: 0,
10104 SVGTransformList: 0,
10105 SourceBufferList: 0,
10106 StyleSheetList: 0,
10107 TextTrackCueList: 0,
10108 TextTrackList: 0,
10109 TouchList: 0
10110};
10111
10112
10113/***/ }),
10114/* 323 */
10115/***/ (function(module, __webpack_exports__, __webpack_require__) {
10116
10117"use strict";
10118/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_js__ = __webpack_require__(135);
10119// Default Export
10120// ==============
10121// In this module, we mix our bundled exports into the `_` object and export
10122// the result. This is analogous to setting `module.exports = _` in CommonJS.
10123// Hence, this module is also the entry point of our UMD bundle and the package
10124// entry point for CommonJS and AMD users. In other words, this is (the source
10125// of) the module you are interfacing with when you do any of the following:
10126//
10127// ```js
10128// // CommonJS
10129// var _ = require('underscore');
10130//
10131// // AMD
10132// define(['underscore'], function(_) {...});
10133//
10134// // UMD in the browser
10135// // _ is available as a global variable
10136// ```
10137
10138
10139
10140// Add all of the Underscore functions to the wrapper object.
10141var _ = Object(__WEBPACK_IMPORTED_MODULE_0__index_js__["mixin"])(__WEBPACK_IMPORTED_MODULE_0__index_js__);
10142// Legacy Node.js API.
10143_._ = _;
10144// Export the Underscore API.
10145/* harmony default export */ __webpack_exports__["a"] = (_);
10146
10147
10148/***/ }),
10149/* 324 */
10150/***/ (function(module, __webpack_exports__, __webpack_require__) {
10151
10152"use strict";
10153/* harmony export (immutable) */ __webpack_exports__["a"] = isNull;
10154// Is a given value equal to null?
10155function isNull(obj) {
10156 return obj === null;
10157}
10158
10159
10160/***/ }),
10161/* 325 */
10162/***/ (function(module, __webpack_exports__, __webpack_require__) {
10163
10164"use strict";
10165/* harmony export (immutable) */ __webpack_exports__["a"] = isElement;
10166// Is a given value a DOM element?
10167function isElement(obj) {
10168 return !!(obj && obj.nodeType === 1);
10169}
10170
10171
10172/***/ }),
10173/* 326 */
10174/***/ (function(module, __webpack_exports__, __webpack_require__) {
10175
10176"use strict";
10177/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10178
10179
10180/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Date'));
10181
10182
10183/***/ }),
10184/* 327 */
10185/***/ (function(module, __webpack_exports__, __webpack_require__) {
10186
10187"use strict";
10188/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10189
10190
10191/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('RegExp'));
10192
10193
10194/***/ }),
10195/* 328 */
10196/***/ (function(module, __webpack_exports__, __webpack_require__) {
10197
10198"use strict";
10199/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10200
10201
10202/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Error'));
10203
10204
10205/***/ }),
10206/* 329 */
10207/***/ (function(module, __webpack_exports__, __webpack_require__) {
10208
10209"use strict";
10210/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10211
10212
10213/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Object'));
10214
10215
10216/***/ }),
10217/* 330 */
10218/***/ (function(module, __webpack_exports__, __webpack_require__) {
10219
10220"use strict";
10221/* harmony export (immutable) */ __webpack_exports__["a"] = isFinite;
10222/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
10223/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isSymbol_js__ = __webpack_require__(183);
10224
10225
10226
10227// Is a given object a finite number?
10228function isFinite(obj) {
10229 return !Object(__WEBPACK_IMPORTED_MODULE_1__isSymbol_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["f" /* _isFinite */])(obj) && !isNaN(parseFloat(obj));
10230}
10231
10232
10233/***/ }),
10234/* 331 */
10235/***/ (function(module, __webpack_exports__, __webpack_require__) {
10236
10237"use strict";
10238/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(188);
10239/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getByteLength_js__ = __webpack_require__(139);
10240
10241
10242
10243// Internal helper to determine whether we should spend extensive checks against
10244// `ArrayBuffer` et al.
10245/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__getByteLength_js__["a" /* default */]));
10246
10247
10248/***/ }),
10249/* 332 */
10250/***/ (function(module, __webpack_exports__, __webpack_require__) {
10251
10252"use strict";
10253/* harmony export (immutable) */ __webpack_exports__["a"] = isEmpty;
10254/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(31);
10255/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(59);
10256/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(136);
10257/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(138);
10258/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keys_js__ = __webpack_require__(17);
10259
10260
10261
10262
10263
10264
10265// Is a given array, string, or object empty?
10266// An "empty" object has no enumerable own-properties.
10267function isEmpty(obj) {
10268 if (obj == null) return true;
10269 // Skip the more expensive `toString`-based type checks if `obj` has no
10270 // `.length`.
10271 var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(obj);
10272 if (typeof length == 'number' && (
10273 Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(obj) || Object(__WEBPACK_IMPORTED_MODULE_2__isString_js__["a" /* default */])(obj) || Object(__WEBPACK_IMPORTED_MODULE_3__isArguments_js__["a" /* default */])(obj)
10274 )) return length === 0;
10275 return Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__keys_js__["a" /* default */])(obj)) === 0;
10276}
10277
10278
10279/***/ }),
10280/* 333 */
10281/***/ (function(module, __webpack_exports__, __webpack_require__) {
10282
10283"use strict";
10284/* harmony export (immutable) */ __webpack_exports__["a"] = isEqual;
10285/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
10286/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
10287/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getByteLength_js__ = __webpack_require__(139);
10288/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__ = __webpack_require__(186);
10289/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isFunction_js__ = __webpack_require__(30);
10290/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__ = __webpack_require__(86);
10291/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isDataView_js__ = __webpack_require__(137);
10292/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__keys_js__ = __webpack_require__(17);
10293/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__has_js__ = __webpack_require__(47);
10294/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__toBufferView_js__ = __webpack_require__(334);
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306// We use this string twice, so give it a name for minification.
10307var tagDataView = '[object DataView]';
10308
10309// Internal recursive comparison function for `_.isEqual`.
10310function eq(a, b, aStack, bStack) {
10311 // Identical objects are equal. `0 === -0`, but they aren't identical.
10312 // See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal).
10313 if (a === b) return a !== 0 || 1 / a === 1 / b;
10314 // `null` or `undefined` only equal to itself (strict comparison).
10315 if (a == null || b == null) return false;
10316 // `NaN`s are equivalent, but non-reflexive.
10317 if (a !== a) return b !== b;
10318 // Exhaust primitive checks
10319 var type = typeof a;
10320 if (type !== 'function' && type !== 'object' && typeof b != 'object') return false;
10321 return deepEq(a, b, aStack, bStack);
10322}
10323
10324// Internal recursive comparison function for `_.isEqual`.
10325function deepEq(a, b, aStack, bStack) {
10326 // Unwrap any wrapped objects.
10327 if (a instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) a = a._wrapped;
10328 if (b instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) b = b._wrapped;
10329 // Compare `[[Class]]` names.
10330 var className = __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(a);
10331 if (className !== __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(b)) return false;
10332 // Work around a bug in IE 10 - Edge 13.
10333 if (__WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__["a" /* hasStringTagBug */] && className == '[object Object]' && Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(a)) {
10334 if (!Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(b)) return false;
10335 className = tagDataView;
10336 }
10337 switch (className) {
10338 // These types are compared by value.
10339 case '[object RegExp]':
10340 // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
10341 case '[object String]':
10342 // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
10343 // equivalent to `new String("5")`.
10344 return '' + a === '' + b;
10345 case '[object Number]':
10346 // `NaN`s are equivalent, but non-reflexive.
10347 // Object(NaN) is equivalent to NaN.
10348 if (+a !== +a) return +b !== +b;
10349 // An `egal` comparison is performed for other numeric values.
10350 return +a === 0 ? 1 / +a === 1 / b : +a === +b;
10351 case '[object Date]':
10352 case '[object Boolean]':
10353 // Coerce dates and booleans to numeric primitive values. Dates are compared by their
10354 // millisecond representations. Note that invalid dates with millisecond representations
10355 // of `NaN` are not equivalent.
10356 return +a === +b;
10357 case '[object Symbol]':
10358 return __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(a) === __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(b);
10359 case '[object ArrayBuffer]':
10360 case tagDataView:
10361 // Coerce to typed array so we can fall through.
10362 return deepEq(Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(a), Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(b), aStack, bStack);
10363 }
10364
10365 var areArrays = className === '[object Array]';
10366 if (!areArrays && Object(__WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__["a" /* default */])(a)) {
10367 var byteLength = Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(a);
10368 if (byteLength !== Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(b)) return false;
10369 if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true;
10370 areArrays = true;
10371 }
10372 if (!areArrays) {
10373 if (typeof a != 'object' || typeof b != 'object') return false;
10374
10375 // Objects with different constructors are not equivalent, but `Object`s or `Array`s
10376 // from different frames are.
10377 var aCtor = a.constructor, bCtor = b.constructor;
10378 if (aCtor !== bCtor && !(Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(aCtor) && aCtor instanceof aCtor &&
10379 Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(bCtor) && bCtor instanceof bCtor)
10380 && ('constructor' in a && 'constructor' in b)) {
10381 return false;
10382 }
10383 }
10384 // Assume equality for cyclic structures. The algorithm for detecting cyclic
10385 // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
10386
10387 // Initializing stack of traversed objects.
10388 // It's done here since we only need them for objects and arrays comparison.
10389 aStack = aStack || [];
10390 bStack = bStack || [];
10391 var length = aStack.length;
10392 while (length--) {
10393 // Linear search. Performance is inversely proportional to the number of
10394 // unique nested structures.
10395 if (aStack[length] === a) return bStack[length] === b;
10396 }
10397
10398 // Add the first object to the stack of traversed objects.
10399 aStack.push(a);
10400 bStack.push(b);
10401
10402 // Recursively compare objects and arrays.
10403 if (areArrays) {
10404 // Compare array lengths to determine if a deep comparison is necessary.
10405 length = a.length;
10406 if (length !== b.length) return false;
10407 // Deep compare the contents, ignoring non-numeric properties.
10408 while (length--) {
10409 if (!eq(a[length], b[length], aStack, bStack)) return false;
10410 }
10411 } else {
10412 // Deep compare objects.
10413 var _keys = Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(a), key;
10414 length = _keys.length;
10415 // Ensure that both objects contain the same number of properties before comparing deep equality.
10416 if (Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(b).length !== length) return false;
10417 while (length--) {
10418 // Deep compare each member
10419 key = _keys[length];
10420 if (!(Object(__WEBPACK_IMPORTED_MODULE_8__has_js__["a" /* default */])(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
10421 }
10422 }
10423 // Remove the first object from the stack of traversed objects.
10424 aStack.pop();
10425 bStack.pop();
10426 return true;
10427}
10428
10429// Perform a deep comparison to check if two objects are equal.
10430function isEqual(a, b) {
10431 return eq(a, b);
10432}
10433
10434
10435/***/ }),
10436/* 334 */
10437/***/ (function(module, __webpack_exports__, __webpack_require__) {
10438
10439"use strict";
10440/* harmony export (immutable) */ __webpack_exports__["a"] = toBufferView;
10441/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getByteLength_js__ = __webpack_require__(139);
10442
10443
10444// Internal function to wrap or shallow-copy an ArrayBuffer,
10445// typed array or DataView to a new view, reusing the buffer.
10446function toBufferView(bufferSource) {
10447 return new Uint8Array(
10448 bufferSource.buffer || bufferSource,
10449 bufferSource.byteOffset || 0,
10450 Object(__WEBPACK_IMPORTED_MODULE_0__getByteLength_js__["a" /* default */])(bufferSource)
10451 );
10452}
10453
10454
10455/***/ }),
10456/* 335 */
10457/***/ (function(module, __webpack_exports__, __webpack_require__) {
10458
10459"use strict";
10460/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10461/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(86);
10462/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(140);
10463
10464
10465
10466
10467/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__["b" /* isIE11 */] ? Object(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["a" /* ie11fingerprint */])(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["b" /* mapMethods */]) : Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Map'));
10468
10469
10470/***/ }),
10471/* 336 */
10472/***/ (function(module, __webpack_exports__, __webpack_require__) {
10473
10474"use strict";
10475/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10476/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(86);
10477/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(140);
10478
10479
10480
10481
10482/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__["b" /* isIE11 */] ? Object(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["a" /* ie11fingerprint */])(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["d" /* weakMapMethods */]) : Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('WeakMap'));
10483
10484
10485/***/ }),
10486/* 337 */
10487/***/ (function(module, __webpack_exports__, __webpack_require__) {
10488
10489"use strict";
10490/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10491/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(86);
10492/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(140);
10493
10494
10495
10496
10497/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__["b" /* isIE11 */] ? Object(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["a" /* ie11fingerprint */])(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["c" /* setMethods */]) : Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Set'));
10498
10499
10500/***/ }),
10501/* 338 */
10502/***/ (function(module, __webpack_exports__, __webpack_require__) {
10503
10504"use strict";
10505/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10506
10507
10508/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('WeakSet'));
10509
10510
10511/***/ }),
10512/* 339 */
10513/***/ (function(module, __webpack_exports__, __webpack_require__) {
10514
10515"use strict";
10516/* harmony export (immutable) */ __webpack_exports__["a"] = pairs;
10517/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(17);
10518
10519
10520// Convert an object into a list of `[key, value]` pairs.
10521// The opposite of `_.object` with one argument.
10522function pairs(obj) {
10523 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
10524 var length = _keys.length;
10525 var pairs = Array(length);
10526 for (var i = 0; i < length; i++) {
10527 pairs[i] = [_keys[i], obj[_keys[i]]];
10528 }
10529 return pairs;
10530}
10531
10532
10533/***/ }),
10534/* 340 */
10535/***/ (function(module, __webpack_exports__, __webpack_require__) {
10536
10537"use strict";
10538/* harmony export (immutable) */ __webpack_exports__["a"] = create;
10539/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(196);
10540/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__extendOwn_js__ = __webpack_require__(142);
10541
10542
10543
10544// Creates an object that inherits from the given prototype object.
10545// If additional properties are provided then they will be added to the
10546// created object.
10547function create(prototype, props) {
10548 var result = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(prototype);
10549 if (props) Object(__WEBPACK_IMPORTED_MODULE_1__extendOwn_js__["a" /* default */])(result, props);
10550 return result;
10551}
10552
10553
10554/***/ }),
10555/* 341 */
10556/***/ (function(module, __webpack_exports__, __webpack_require__) {
10557
10558"use strict";
10559/* harmony export (immutable) */ __webpack_exports__["a"] = tap;
10560// Invokes `interceptor` with the `obj` and then returns `obj`.
10561// The primary purpose of this method is to "tap into" a method chain, in
10562// order to perform operations on intermediate results within the chain.
10563function tap(obj, interceptor) {
10564 interceptor(obj);
10565 return obj;
10566}
10567
10568
10569/***/ }),
10570/* 342 */
10571/***/ (function(module, __webpack_exports__, __webpack_require__) {
10572
10573"use strict";
10574/* harmony export (immutable) */ __webpack_exports__["a"] = has;
10575/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(47);
10576/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(88);
10577
10578
10579
10580// Shortcut function for checking if an object has a given property directly on
10581// itself (in other words, not on a prototype). Unlike the internal `has`
10582// function, this public version can also traverse nested properties.
10583function has(obj, path) {
10584 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
10585 var length = path.length;
10586 for (var i = 0; i < length; i++) {
10587 var key = path[i];
10588 if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(obj, key)) return false;
10589 obj = obj[key];
10590 }
10591 return !!length;
10592}
10593
10594
10595/***/ }),
10596/* 343 */
10597/***/ (function(module, __webpack_exports__, __webpack_require__) {
10598
10599"use strict";
10600/* harmony export (immutable) */ __webpack_exports__["a"] = mapObject;
10601/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
10602/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(17);
10603
10604
10605
10606// Returns the results of applying the `iteratee` to each element of `obj`.
10607// In contrast to `_.map` it returns an object.
10608function mapObject(obj, iteratee, context) {
10609 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
10610 var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
10611 length = _keys.length,
10612 results = {};
10613 for (var index = 0; index < length; index++) {
10614 var currentKey = _keys[index];
10615 results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
10616 }
10617 return results;
10618}
10619
10620
10621/***/ }),
10622/* 344 */
10623/***/ (function(module, __webpack_exports__, __webpack_require__) {
10624
10625"use strict";
10626/* harmony export (immutable) */ __webpack_exports__["a"] = propertyOf;
10627/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__noop_js__ = __webpack_require__(202);
10628/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__get_js__ = __webpack_require__(198);
10629
10630
10631
10632// Generates a function for a given object that returns a given property.
10633function propertyOf(obj) {
10634 if (obj == null) return __WEBPACK_IMPORTED_MODULE_0__noop_js__["a" /* default */];
10635 return function(path) {
10636 return Object(__WEBPACK_IMPORTED_MODULE_1__get_js__["a" /* default */])(obj, path);
10637 };
10638}
10639
10640
10641/***/ }),
10642/* 345 */
10643/***/ (function(module, __webpack_exports__, __webpack_require__) {
10644
10645"use strict";
10646/* harmony export (immutable) */ __webpack_exports__["a"] = times;
10647/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(89);
10648
10649
10650// Run a function **n** times.
10651function times(n, iteratee, context) {
10652 var accum = Array(Math.max(0, n));
10653 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context, 1);
10654 for (var i = 0; i < n; i++) accum[i] = iteratee(i);
10655 return accum;
10656}
10657
10658
10659/***/ }),
10660/* 346 */
10661/***/ (function(module, __webpack_exports__, __webpack_require__) {
10662
10663"use strict";
10664/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(204);
10665/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(205);
10666
10667
10668
10669// Function for escaping strings to HTML interpolation.
10670/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
10671
10672
10673/***/ }),
10674/* 347 */
10675/***/ (function(module, __webpack_exports__, __webpack_require__) {
10676
10677"use strict";
10678/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(204);
10679/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__ = __webpack_require__(348);
10680
10681
10682
10683// Function for unescaping strings from HTML interpolation.
10684/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__["a" /* default */]));
10685
10686
10687/***/ }),
10688/* 348 */
10689/***/ (function(module, __webpack_exports__, __webpack_require__) {
10690
10691"use strict";
10692/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__invert_js__ = __webpack_require__(192);
10693/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(205);
10694
10695
10696
10697// Internal list of HTML entities for unescaping.
10698/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__invert_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
10699
10700
10701/***/ }),
10702/* 349 */
10703/***/ (function(module, __webpack_exports__, __webpack_require__) {
10704
10705"use strict";
10706/* harmony export (immutable) */ __webpack_exports__["a"] = template;
10707/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__defaults_js__ = __webpack_require__(195);
10708/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__underscore_js__ = __webpack_require__(25);
10709/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__templateSettings_js__ = __webpack_require__(206);
10710
10711
10712
10713
10714// When customizing `_.templateSettings`, if you don't want to define an
10715// interpolation, evaluation or escaping regex, we need one that is
10716// guaranteed not to match.
10717var noMatch = /(.)^/;
10718
10719// Certain characters need to be escaped so that they can be put into a
10720// string literal.
10721var escapes = {
10722 "'": "'",
10723 '\\': '\\',
10724 '\r': 'r',
10725 '\n': 'n',
10726 '\u2028': 'u2028',
10727 '\u2029': 'u2029'
10728};
10729
10730var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g;
10731
10732function escapeChar(match) {
10733 return '\\' + escapes[match];
10734}
10735
10736var bareIdentifier = /^\s*(\w|\$)+\s*$/;
10737
10738// JavaScript micro-templating, similar to John Resig's implementation.
10739// Underscore templating handles arbitrary delimiters, preserves whitespace,
10740// and correctly escapes quotes within interpolated code.
10741// NB: `oldSettings` only exists for backwards compatibility.
10742function template(text, settings, oldSettings) {
10743 if (!settings && oldSettings) settings = oldSettings;
10744 settings = Object(__WEBPACK_IMPORTED_MODULE_0__defaults_js__["a" /* default */])({}, settings, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */].templateSettings);
10745
10746 // Combine delimiters into one regular expression via alternation.
10747 var matcher = RegExp([
10748 (settings.escape || noMatch).source,
10749 (settings.interpolate || noMatch).source,
10750 (settings.evaluate || noMatch).source
10751 ].join('|') + '|$', 'g');
10752
10753 // Compile the template source, escaping string literals appropriately.
10754 var index = 0;
10755 var source = "__p+='";
10756 text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
10757 source += text.slice(index, offset).replace(escapeRegExp, escapeChar);
10758 index = offset + match.length;
10759
10760 if (escape) {
10761 source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
10762 } else if (interpolate) {
10763 source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
10764 } else if (evaluate) {
10765 source += "';\n" + evaluate + "\n__p+='";
10766 }
10767
10768 // Adobe VMs need the match returned to produce the correct offset.
10769 return match;
10770 });
10771 source += "';\n";
10772
10773 var argument = settings.variable;
10774 if (argument) {
10775 if (!bareIdentifier.test(argument)) throw new Error(argument);
10776 } else {
10777 // If a variable is not specified, place data values in local scope.
10778 source = 'with(obj||{}){\n' + source + '}\n';
10779 argument = 'obj';
10780 }
10781
10782 source = "var __t,__p='',__j=Array.prototype.join," +
10783 "print=function(){__p+=__j.call(arguments,'');};\n" +
10784 source + 'return __p;\n';
10785
10786 var render;
10787 try {
10788 render = new Function(argument, '_', source);
10789 } catch (e) {
10790 e.source = source;
10791 throw e;
10792 }
10793
10794 var template = function(data) {
10795 return render.call(this, data, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */]);
10796 };
10797
10798 // Provide the compiled source as a convenience for precompilation.
10799 template.source = 'function(' + argument + '){\n' + source + '}';
10800
10801 return template;
10802}
10803
10804
10805/***/ }),
10806/* 350 */
10807/***/ (function(module, __webpack_exports__, __webpack_require__) {
10808
10809"use strict";
10810/* harmony export (immutable) */ __webpack_exports__["a"] = result;
10811/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(30);
10812/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(88);
10813
10814
10815
10816// Traverses the children of `obj` along `path`. If a child is a function, it
10817// is invoked with its parent as context. Returns the value of the final
10818// child, or `fallback` if any child is undefined.
10819function result(obj, path, fallback) {
10820 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
10821 var length = path.length;
10822 if (!length) {
10823 return Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(fallback) ? fallback.call(obj) : fallback;
10824 }
10825 for (var i = 0; i < length; i++) {
10826 var prop = obj == null ? void 0 : obj[path[i]];
10827 if (prop === void 0) {
10828 prop = fallback;
10829 i = length; // Ensure we don't continue iterating.
10830 }
10831 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(prop) ? prop.call(obj) : prop;
10832 }
10833 return obj;
10834}
10835
10836
10837/***/ }),
10838/* 351 */
10839/***/ (function(module, __webpack_exports__, __webpack_require__) {
10840
10841"use strict";
10842/* harmony export (immutable) */ __webpack_exports__["a"] = uniqueId;
10843// Generate a unique integer id (unique within the entire client session).
10844// Useful for temporary DOM ids.
10845var idCounter = 0;
10846function uniqueId(prefix) {
10847 var id = ++idCounter + '';
10848 return prefix ? prefix + id : id;
10849}
10850
10851
10852/***/ }),
10853/* 352 */
10854/***/ (function(module, __webpack_exports__, __webpack_require__) {
10855
10856"use strict";
10857/* harmony export (immutable) */ __webpack_exports__["a"] = chain;
10858/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
10859
10860
10861// Start chaining a wrapped Underscore object.
10862function chain(obj) {
10863 var instance = Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj);
10864 instance._chain = true;
10865 return instance;
10866}
10867
10868
10869/***/ }),
10870/* 353 */
10871/***/ (function(module, __webpack_exports__, __webpack_require__) {
10872
10873"use strict";
10874/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
10875/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(72);
10876/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bind_js__ = __webpack_require__(208);
10877
10878
10879
10880
10881// Bind a number of an object's methods to that object. Remaining arguments
10882// are the method names to be bound. Useful for ensuring that all callbacks
10883// defined on an object belong to it.
10884/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
10885 keys = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(keys, false, false);
10886 var index = keys.length;
10887 if (index < 1) throw new Error('bindAll must be passed function names');
10888 while (index--) {
10889 var key = keys[index];
10890 obj[key] = Object(__WEBPACK_IMPORTED_MODULE_2__bind_js__["a" /* default */])(obj[key], obj);
10891 }
10892 return obj;
10893}));
10894
10895
10896/***/ }),
10897/* 354 */
10898/***/ (function(module, __webpack_exports__, __webpack_require__) {
10899
10900"use strict";
10901/* harmony export (immutable) */ __webpack_exports__["a"] = memoize;
10902/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(47);
10903
10904
10905// Memoize an expensive function by storing its results.
10906function memoize(func, hasher) {
10907 var memoize = function(key) {
10908 var cache = memoize.cache;
10909 var address = '' + (hasher ? hasher.apply(this, arguments) : key);
10910 if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(cache, address)) cache[address] = func.apply(this, arguments);
10911 return cache[address];
10912 };
10913 memoize.cache = {};
10914 return memoize;
10915}
10916
10917
10918/***/ }),
10919/* 355 */
10920/***/ (function(module, __webpack_exports__, __webpack_require__) {
10921
10922"use strict";
10923/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(114);
10924/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__delay_js__ = __webpack_require__(209);
10925/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(25);
10926
10927
10928
10929
10930// Defers a function, scheduling it to run after the current call stack has
10931// cleared.
10932/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__delay_js__["a" /* default */], __WEBPACK_IMPORTED_MODULE_2__underscore_js__["a" /* default */], 1));
10933
10934
10935/***/ }),
10936/* 356 */
10937/***/ (function(module, __webpack_exports__, __webpack_require__) {
10938
10939"use strict";
10940/* harmony export (immutable) */ __webpack_exports__["a"] = throttle;
10941/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__now_js__ = __webpack_require__(146);
10942
10943
10944// Returns a function, that, when invoked, will only be triggered at most once
10945// during a given window of time. Normally, the throttled function will run
10946// as much as it can, without ever going more than once per `wait` duration;
10947// but if you'd like to disable the execution on the leading edge, pass
10948// `{leading: false}`. To disable execution on the trailing edge, ditto.
10949function throttle(func, wait, options) {
10950 var timeout, context, args, result;
10951 var previous = 0;
10952 if (!options) options = {};
10953
10954 var later = function() {
10955 previous = options.leading === false ? 0 : Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
10956 timeout = null;
10957 result = func.apply(context, args);
10958 if (!timeout) context = args = null;
10959 };
10960
10961 var throttled = function() {
10962 var _now = Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
10963 if (!previous && options.leading === false) previous = _now;
10964 var remaining = wait - (_now - previous);
10965 context = this;
10966 args = arguments;
10967 if (remaining <= 0 || remaining > wait) {
10968 if (timeout) {
10969 clearTimeout(timeout);
10970 timeout = null;
10971 }
10972 previous = _now;
10973 result = func.apply(context, args);
10974 if (!timeout) context = args = null;
10975 } else if (!timeout && options.trailing !== false) {
10976 timeout = setTimeout(later, remaining);
10977 }
10978 return result;
10979 };
10980
10981 throttled.cancel = function() {
10982 clearTimeout(timeout);
10983 previous = 0;
10984 timeout = context = args = null;
10985 };
10986
10987 return throttled;
10988}
10989
10990
10991/***/ }),
10992/* 357 */
10993/***/ (function(module, __webpack_exports__, __webpack_require__) {
10994
10995"use strict";
10996/* harmony export (immutable) */ __webpack_exports__["a"] = debounce;
10997/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
10998/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__now_js__ = __webpack_require__(146);
10999
11000
11001
11002// When a sequence of calls of the returned function ends, the argument
11003// function is triggered. The end of a sequence is defined by the `wait`
11004// parameter. If `immediate` is passed, the argument function will be
11005// triggered at the beginning of the sequence instead of at the end.
11006function debounce(func, wait, immediate) {
11007 var timeout, previous, args, result, context;
11008
11009 var later = function() {
11010 var passed = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])() - previous;
11011 if (wait > passed) {
11012 timeout = setTimeout(later, wait - passed);
11013 } else {
11014 timeout = null;
11015 if (!immediate) result = func.apply(context, args);
11016 // This check is needed because `func` can recursively invoke `debounced`.
11017 if (!timeout) args = context = null;
11018 }
11019 };
11020
11021 var debounced = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(_args) {
11022 context = this;
11023 args = _args;
11024 previous = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])();
11025 if (!timeout) {
11026 timeout = setTimeout(later, wait);
11027 if (immediate) result = func.apply(context, args);
11028 }
11029 return result;
11030 });
11031
11032 debounced.cancel = function() {
11033 clearTimeout(timeout);
11034 timeout = args = context = null;
11035 };
11036
11037 return debounced;
11038}
11039
11040
11041/***/ }),
11042/* 358 */
11043/***/ (function(module, __webpack_exports__, __webpack_require__) {
11044
11045"use strict";
11046/* harmony export (immutable) */ __webpack_exports__["a"] = wrap;
11047/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(114);
11048
11049
11050// Returns the first function passed as an argument to the second,
11051// allowing you to adjust arguments, run code before and after, and
11052// conditionally execute the original function.
11053function wrap(func, wrapper) {
11054 return Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(wrapper, func);
11055}
11056
11057
11058/***/ }),
11059/* 359 */
11060/***/ (function(module, __webpack_exports__, __webpack_require__) {
11061
11062"use strict";
11063/* harmony export (immutable) */ __webpack_exports__["a"] = compose;
11064// Returns a function that is the composition of a list of functions, each
11065// consuming the return value of the function that follows.
11066function compose() {
11067 var args = arguments;
11068 var start = args.length - 1;
11069 return function() {
11070 var i = start;
11071 var result = args[start].apply(this, arguments);
11072 while (i--) result = args[i].call(this, result);
11073 return result;
11074 };
11075}
11076
11077
11078/***/ }),
11079/* 360 */
11080/***/ (function(module, __webpack_exports__, __webpack_require__) {
11081
11082"use strict";
11083/* harmony export (immutable) */ __webpack_exports__["a"] = after;
11084// Returns a function that will only be executed on and after the Nth call.
11085function after(times, func) {
11086 return function() {
11087 if (--times < 1) {
11088 return func.apply(this, arguments);
11089 }
11090 };
11091}
11092
11093
11094/***/ }),
11095/* 361 */
11096/***/ (function(module, __webpack_exports__, __webpack_require__) {
11097
11098"use strict";
11099/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(114);
11100/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__before_js__ = __webpack_require__(210);
11101
11102
11103
11104// Returns a function that will be executed at most one time, no matter how
11105// often you call it. Useful for lazy initialization.
11106/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__before_js__["a" /* default */], 2));
11107
11108
11109/***/ }),
11110/* 362 */
11111/***/ (function(module, __webpack_exports__, __webpack_require__) {
11112
11113"use strict";
11114/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__ = __webpack_require__(213);
11115/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__ = __webpack_require__(216);
11116
11117
11118
11119// Return the position of the last occurrence of an item in an array,
11120// or -1 if the item is not included in the array.
11121/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__["a" /* default */])(-1, __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__["a" /* default */]));
11122
11123
11124/***/ }),
11125/* 363 */
11126/***/ (function(module, __webpack_exports__, __webpack_require__) {
11127
11128"use strict";
11129/* harmony export (immutable) */ __webpack_exports__["a"] = findWhere;
11130/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__find_js__ = __webpack_require__(217);
11131/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(113);
11132
11133
11134
11135// Convenience version of a common use case of `_.find`: getting the first
11136// object containing specific `key:value` pairs.
11137function findWhere(obj, attrs) {
11138 return Object(__WEBPACK_IMPORTED_MODULE_0__find_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
11139}
11140
11141
11142/***/ }),
11143/* 364 */
11144/***/ (function(module, __webpack_exports__, __webpack_require__) {
11145
11146"use strict";
11147/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(218);
11148
11149
11150// **Reduce** builds up a single result from a list of values, aka `inject`,
11151// or `foldl`.
11152/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(1));
11153
11154
11155/***/ }),
11156/* 365 */
11157/***/ (function(module, __webpack_exports__, __webpack_require__) {
11158
11159"use strict";
11160/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(218);
11161
11162
11163// The right-associative version of reduce, also known as `foldr`.
11164/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(-1));
11165
11166
11167/***/ }),
11168/* 366 */
11169/***/ (function(module, __webpack_exports__, __webpack_require__) {
11170
11171"use strict";
11172/* harmony export (immutable) */ __webpack_exports__["a"] = reject;
11173/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(90);
11174/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__negate_js__ = __webpack_require__(147);
11175/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(22);
11176
11177
11178
11179
11180// Return all the elements for which a truth test fails.
11181function reject(obj, predicate, context) {
11182 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__negate_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(predicate)), context);
11183}
11184
11185
11186/***/ }),
11187/* 367 */
11188/***/ (function(module, __webpack_exports__, __webpack_require__) {
11189
11190"use strict";
11191/* harmony export (immutable) */ __webpack_exports__["a"] = every;
11192/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
11193/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
11194/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(17);
11195
11196
11197
11198
11199// Determine whether all of the elements pass a truth test.
11200function every(obj, predicate, context) {
11201 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
11202 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
11203 length = (_keys || obj).length;
11204 for (var index = 0; index < length; index++) {
11205 var currentKey = _keys ? _keys[index] : index;
11206 if (!predicate(obj[currentKey], currentKey, obj)) return false;
11207 }
11208 return true;
11209}
11210
11211
11212/***/ }),
11213/* 368 */
11214/***/ (function(module, __webpack_exports__, __webpack_require__) {
11215
11216"use strict";
11217/* harmony export (immutable) */ __webpack_exports__["a"] = some;
11218/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
11219/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
11220/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(17);
11221
11222
11223
11224
11225// Determine if at least one element in the object passes a truth test.
11226function some(obj, predicate, context) {
11227 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
11228 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
11229 length = (_keys || obj).length;
11230 for (var index = 0; index < length; index++) {
11231 var currentKey = _keys ? _keys[index] : index;
11232 if (predicate(obj[currentKey], currentKey, obj)) return true;
11233 }
11234 return false;
11235}
11236
11237
11238/***/ }),
11239/* 369 */
11240/***/ (function(module, __webpack_exports__, __webpack_require__) {
11241
11242"use strict";
11243/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11244/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
11245/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(73);
11246/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__deepGet_js__ = __webpack_require__(143);
11247/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__toPath_js__ = __webpack_require__(88);
11248
11249
11250
11251
11252
11253
11254// Invoke a method (with arguments) on every item in a collection.
11255/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, path, args) {
11256 var contextPath, func;
11257 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(path)) {
11258 func = path;
11259 } else {
11260 path = Object(__WEBPACK_IMPORTED_MODULE_4__toPath_js__["a" /* default */])(path);
11261 contextPath = path.slice(0, -1);
11262 path = path[path.length - 1];
11263 }
11264 return Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(context) {
11265 var method = func;
11266 if (!method) {
11267 if (contextPath && contextPath.length) {
11268 context = Object(__WEBPACK_IMPORTED_MODULE_3__deepGet_js__["a" /* default */])(context, contextPath);
11269 }
11270 if (context == null) return void 0;
11271 method = context[path];
11272 }
11273 return method == null ? method : method.apply(context, args);
11274 });
11275}));
11276
11277
11278/***/ }),
11279/* 370 */
11280/***/ (function(module, __webpack_exports__, __webpack_require__) {
11281
11282"use strict";
11283/* harmony export (immutable) */ __webpack_exports__["a"] = where;
11284/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(90);
11285/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(113);
11286
11287
11288
11289// Convenience version of a common use case of `_.filter`: selecting only
11290// objects containing specific `key:value` pairs.
11291function where(obj, attrs) {
11292 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
11293}
11294
11295
11296/***/ }),
11297/* 371 */
11298/***/ (function(module, __webpack_exports__, __webpack_require__) {
11299
11300"use strict";
11301/* harmony export (immutable) */ __webpack_exports__["a"] = min;
11302/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
11303/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(71);
11304/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(22);
11305/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(60);
11306
11307
11308
11309
11310
11311// Return the minimum element (or element-based computation).
11312function min(obj, iteratee, context) {
11313 var result = Infinity, lastComputed = Infinity,
11314 value, computed;
11315 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
11316 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
11317 for (var i = 0, length = obj.length; i < length; i++) {
11318 value = obj[i];
11319 if (value != null && value < result) {
11320 result = value;
11321 }
11322 }
11323 } else {
11324 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
11325 Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
11326 computed = iteratee(v, index, list);
11327 if (computed < lastComputed || computed === Infinity && result === Infinity) {
11328 result = v;
11329 lastComputed = computed;
11330 }
11331 });
11332 }
11333 return result;
11334}
11335
11336
11337/***/ }),
11338/* 372 */
11339/***/ (function(module, __webpack_exports__, __webpack_require__) {
11340
11341"use strict";
11342/* harmony export (immutable) */ __webpack_exports__["a"] = shuffle;
11343/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sample_js__ = __webpack_require__(220);
11344
11345
11346// Shuffle a collection.
11347function shuffle(obj) {
11348 return Object(__WEBPACK_IMPORTED_MODULE_0__sample_js__["a" /* default */])(obj, Infinity);
11349}
11350
11351
11352/***/ }),
11353/* 373 */
11354/***/ (function(module, __webpack_exports__, __webpack_require__) {
11355
11356"use strict";
11357/* harmony export (immutable) */ __webpack_exports__["a"] = sortBy;
11358/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
11359/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__pluck_js__ = __webpack_require__(149);
11360/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(73);
11361
11362
11363
11364
11365// Sort the object's values by a criterion produced by an iteratee.
11366function sortBy(obj, iteratee, context) {
11367 var index = 0;
11368 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
11369 return Object(__WEBPACK_IMPORTED_MODULE_1__pluck_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(value, key, list) {
11370 return {
11371 value: value,
11372 index: index++,
11373 criteria: iteratee(value, key, list)
11374 };
11375 }).sort(function(left, right) {
11376 var a = left.criteria;
11377 var b = right.criteria;
11378 if (a !== b) {
11379 if (a > b || a === void 0) return 1;
11380 if (a < b || b === void 0) return -1;
11381 }
11382 return left.index - right.index;
11383 }), 'value');
11384}
11385
11386
11387/***/ }),
11388/* 374 */
11389/***/ (function(module, __webpack_exports__, __webpack_require__) {
11390
11391"use strict";
11392/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(115);
11393/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(47);
11394
11395
11396
11397// Groups the object's values by a criterion. Pass either a string attribute
11398// to group by, or a function that returns the criterion.
11399/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
11400 if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key].push(value); else result[key] = [value];
11401}));
11402
11403
11404/***/ }),
11405/* 375 */
11406/***/ (function(module, __webpack_exports__, __webpack_require__) {
11407
11408"use strict";
11409/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(115);
11410
11411
11412// Indexes the object's values by a criterion, similar to `_.groupBy`, but for
11413// when you know that your index values will be unique.
11414/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
11415 result[key] = value;
11416}));
11417
11418
11419/***/ }),
11420/* 376 */
11421/***/ (function(module, __webpack_exports__, __webpack_require__) {
11422
11423"use strict";
11424/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(115);
11425/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(47);
11426
11427
11428
11429// Counts instances of an object that group by a certain criterion. Pass
11430// either a string attribute to count by, or a function that returns the
11431// criterion.
11432/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
11433 if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key]++; else result[key] = 1;
11434}));
11435
11436
11437/***/ }),
11438/* 377 */
11439/***/ (function(module, __webpack_exports__, __webpack_require__) {
11440
11441"use strict";
11442/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(115);
11443
11444
11445// Split a collection into two arrays: one whose elements all pass the given
11446// truth test, and one whose elements all do not pass the truth test.
11447/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, pass) {
11448 result[pass ? 0 : 1].push(value);
11449}, true));
11450
11451
11452/***/ }),
11453/* 378 */
11454/***/ (function(module, __webpack_exports__, __webpack_require__) {
11455
11456"use strict";
11457/* harmony export (immutable) */ __webpack_exports__["a"] = toArray;
11458/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArray_js__ = __webpack_require__(59);
11459/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
11460/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(136);
11461/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArrayLike_js__ = __webpack_require__(26);
11462/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__map_js__ = __webpack_require__(73);
11463/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__identity_js__ = __webpack_require__(144);
11464/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__values_js__ = __webpack_require__(71);
11465
11466
11467
11468
11469
11470
11471
11472
11473// Safely create a real, live array from anything iterable.
11474var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
11475function toArray(obj) {
11476 if (!obj) return [];
11477 if (Object(__WEBPACK_IMPORTED_MODULE_0__isArray_js__["a" /* default */])(obj)) return __WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(obj);
11478 if (Object(__WEBPACK_IMPORTED_MODULE_2__isString_js__["a" /* default */])(obj)) {
11479 // Keep surrogate pair characters together.
11480 return obj.match(reStrSymbol);
11481 }
11482 if (Object(__WEBPACK_IMPORTED_MODULE_3__isArrayLike_js__["a" /* default */])(obj)) return Object(__WEBPACK_IMPORTED_MODULE_4__map_js__["a" /* default */])(obj, __WEBPACK_IMPORTED_MODULE_5__identity_js__["a" /* default */]);
11483 return Object(__WEBPACK_IMPORTED_MODULE_6__values_js__["a" /* default */])(obj);
11484}
11485
11486
11487/***/ }),
11488/* 379 */
11489/***/ (function(module, __webpack_exports__, __webpack_require__) {
11490
11491"use strict";
11492/* harmony export (immutable) */ __webpack_exports__["a"] = size;
11493/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
11494/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(17);
11495
11496
11497
11498// Return the number of elements in a collection.
11499function size(obj) {
11500 if (obj == null) return 0;
11501 return Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj.length : Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj).length;
11502}
11503
11504
11505/***/ }),
11506/* 380 */
11507/***/ (function(module, __webpack_exports__, __webpack_require__) {
11508
11509"use strict";
11510/* harmony export (immutable) */ __webpack_exports__["a"] = keyInObj;
11511// Internal `_.pick` helper function to determine whether `key` is an enumerable
11512// property name of `obj`.
11513function keyInObj(value, key, obj) {
11514 return key in obj;
11515}
11516
11517
11518/***/ }),
11519/* 381 */
11520/***/ (function(module, __webpack_exports__, __webpack_require__) {
11521
11522"use strict";
11523/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11524/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
11525/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__negate_js__ = __webpack_require__(147);
11526/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__map_js__ = __webpack_require__(73);
11527/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__flatten_js__ = __webpack_require__(72);
11528/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__contains_js__ = __webpack_require__(91);
11529/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__pick_js__ = __webpack_require__(221);
11530
11531
11532
11533
11534
11535
11536
11537
11538// Return a copy of the object without the disallowed properties.
11539/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
11540 var iteratee = keys[0], context;
11541 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
11542 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__negate_js__["a" /* default */])(iteratee);
11543 if (keys.length > 1) context = keys[1];
11544 } else {
11545 keys = Object(__WEBPACK_IMPORTED_MODULE_3__map_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__flatten_js__["a" /* default */])(keys, false, false), String);
11546 iteratee = function(value, key) {
11547 return !Object(__WEBPACK_IMPORTED_MODULE_5__contains_js__["a" /* default */])(keys, key);
11548 };
11549 }
11550 return Object(__WEBPACK_IMPORTED_MODULE_6__pick_js__["a" /* default */])(obj, iteratee, context);
11551}));
11552
11553
11554/***/ }),
11555/* 382 */
11556/***/ (function(module, __webpack_exports__, __webpack_require__) {
11557
11558"use strict";
11559/* harmony export (immutable) */ __webpack_exports__["a"] = first;
11560/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__initial_js__ = __webpack_require__(222);
11561
11562
11563// Get the first element of an array. Passing **n** will return the first N
11564// values in the array. The **guard** check allows it to work with `_.map`.
11565function first(array, n, guard) {
11566 if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
11567 if (n == null || guard) return array[0];
11568 return Object(__WEBPACK_IMPORTED_MODULE_0__initial_js__["a" /* default */])(array, array.length - n);
11569}
11570
11571
11572/***/ }),
11573/* 383 */
11574/***/ (function(module, __webpack_exports__, __webpack_require__) {
11575
11576"use strict";
11577/* harmony export (immutable) */ __webpack_exports__["a"] = last;
11578/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__rest_js__ = __webpack_require__(223);
11579
11580
11581// Get the last element of an array. Passing **n** will return the last N
11582// values in the array.
11583function last(array, n, guard) {
11584 if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
11585 if (n == null || guard) return array[array.length - 1];
11586 return Object(__WEBPACK_IMPORTED_MODULE_0__rest_js__["a" /* default */])(array, Math.max(0, array.length - n));
11587}
11588
11589
11590/***/ }),
11591/* 384 */
11592/***/ (function(module, __webpack_exports__, __webpack_require__) {
11593
11594"use strict";
11595/* harmony export (immutable) */ __webpack_exports__["a"] = compact;
11596/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(90);
11597
11598
11599// Trim out all falsy values from an array.
11600function compact(array) {
11601 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(array, Boolean);
11602}
11603
11604
11605/***/ }),
11606/* 385 */
11607/***/ (function(module, __webpack_exports__, __webpack_require__) {
11608
11609"use strict";
11610/* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
11611/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__flatten_js__ = __webpack_require__(72);
11612
11613
11614// Flatten out an array, either recursively (by default), or up to `depth`.
11615// Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively.
11616function flatten(array, depth) {
11617 return Object(__WEBPACK_IMPORTED_MODULE_0__flatten_js__["a" /* default */])(array, depth, false);
11618}
11619
11620
11621/***/ }),
11622/* 386 */
11623/***/ (function(module, __webpack_exports__, __webpack_require__) {
11624
11625"use strict";
11626/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11627/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__difference_js__ = __webpack_require__(224);
11628
11629
11630
11631// Return a version of the array that does not contain the specified value(s).
11632/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, otherArrays) {
11633 return Object(__WEBPACK_IMPORTED_MODULE_1__difference_js__["a" /* default */])(array, otherArrays);
11634}));
11635
11636
11637/***/ }),
11638/* 387 */
11639/***/ (function(module, __webpack_exports__, __webpack_require__) {
11640
11641"use strict";
11642/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11643/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__uniq_js__ = __webpack_require__(225);
11644/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__flatten_js__ = __webpack_require__(72);
11645
11646
11647
11648
11649// Produce an array that contains the union: each distinct element from all of
11650// the passed-in arrays.
11651/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(arrays) {
11652 return Object(__WEBPACK_IMPORTED_MODULE_1__uniq_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__flatten_js__["a" /* default */])(arrays, true, true));
11653}));
11654
11655
11656/***/ }),
11657/* 388 */
11658/***/ (function(module, __webpack_exports__, __webpack_require__) {
11659
11660"use strict";
11661/* harmony export (immutable) */ __webpack_exports__["a"] = intersection;
11662/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(31);
11663/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__contains_js__ = __webpack_require__(91);
11664
11665
11666
11667// Produce an array that contains every item shared between all the
11668// passed-in arrays.
11669function intersection(array) {
11670 var result = [];
11671 var argsLength = arguments.length;
11672 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array); i < length; i++) {
11673 var item = array[i];
11674 if (Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(result, item)) continue;
11675 var j;
11676 for (j = 1; j < argsLength; j++) {
11677 if (!Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(arguments[j], item)) break;
11678 }
11679 if (j === argsLength) result.push(item);
11680 }
11681 return result;
11682}
11683
11684
11685/***/ }),
11686/* 389 */
11687/***/ (function(module, __webpack_exports__, __webpack_require__) {
11688
11689"use strict";
11690/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11691/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unzip_js__ = __webpack_require__(226);
11692
11693
11694
11695// Zip together multiple lists into a single array -- elements that share
11696// an index go together.
11697/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unzip_js__["a" /* default */]));
11698
11699
11700/***/ }),
11701/* 390 */
11702/***/ (function(module, __webpack_exports__, __webpack_require__) {
11703
11704"use strict";
11705/* harmony export (immutable) */ __webpack_exports__["a"] = object;
11706/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(31);
11707
11708
11709// Converts lists into objects. Pass either a single array of `[key, value]`
11710// pairs, or two parallel arrays of the same length -- one of keys, and one of
11711// the corresponding values. Passing by pairs is the reverse of `_.pairs`.
11712function object(list, values) {
11713 var result = {};
11714 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(list); i < length; i++) {
11715 if (values) {
11716 result[list[i]] = values[i];
11717 } else {
11718 result[list[i][0]] = list[i][1];
11719 }
11720 }
11721 return result;
11722}
11723
11724
11725/***/ }),
11726/* 391 */
11727/***/ (function(module, __webpack_exports__, __webpack_require__) {
11728
11729"use strict";
11730/* harmony export (immutable) */ __webpack_exports__["a"] = range;
11731// Generate an integer Array containing an arithmetic progression. A port of
11732// the native Python `range()` function. See
11733// [the Python documentation](https://docs.python.org/library/functions.html#range).
11734function range(start, stop, step) {
11735 if (stop == null) {
11736 stop = start || 0;
11737 start = 0;
11738 }
11739 if (!step) {
11740 step = stop < start ? -1 : 1;
11741 }
11742
11743 var length = Math.max(Math.ceil((stop - start) / step), 0);
11744 var range = Array(length);
11745
11746 for (var idx = 0; idx < length; idx++, start += step) {
11747 range[idx] = start;
11748 }
11749
11750 return range;
11751}
11752
11753
11754/***/ }),
11755/* 392 */
11756/***/ (function(module, __webpack_exports__, __webpack_require__) {
11757
11758"use strict";
11759/* harmony export (immutable) */ __webpack_exports__["a"] = chunk;
11760/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
11761
11762
11763// Chunk a single array into multiple arrays, each containing `count` or fewer
11764// items.
11765function chunk(array, count) {
11766 if (count == null || count < 1) return [];
11767 var result = [];
11768 var i = 0, length = array.length;
11769 while (i < length) {
11770 result.push(__WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, i, i += count));
11771 }
11772 return result;
11773}
11774
11775
11776/***/ }),
11777/* 393 */
11778/***/ (function(module, __webpack_exports__, __webpack_require__) {
11779
11780"use strict";
11781/* harmony export (immutable) */ __webpack_exports__["a"] = mixin;
11782/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
11783/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(60);
11784/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__functions_js__ = __webpack_require__(193);
11785/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__setup_js__ = __webpack_require__(6);
11786/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__chainResult_js__ = __webpack_require__(227);
11787
11788
11789
11790
11791
11792
11793// Add your own custom functions to the Underscore object.
11794function mixin(obj) {
11795 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__functions_js__["a" /* default */])(obj), function(name) {
11796 var func = __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */][name] = obj[name];
11797 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
11798 var args = [this._wrapped];
11799 __WEBPACK_IMPORTED_MODULE_3__setup_js__["o" /* push */].apply(args, arguments);
11800 return Object(__WEBPACK_IMPORTED_MODULE_4__chainResult_js__["a" /* default */])(this, func.apply(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */], args));
11801 };
11802 });
11803 return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */];
11804}
11805
11806
11807/***/ }),
11808/* 394 */
11809/***/ (function(module, __webpack_exports__, __webpack_require__) {
11810
11811"use strict";
11812/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
11813/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(60);
11814/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__setup_js__ = __webpack_require__(6);
11815/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__chainResult_js__ = __webpack_require__(227);
11816
11817
11818
11819
11820
11821// Add all mutator `Array` functions to the wrapper.
11822Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
11823 var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
11824 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
11825 var obj = this._wrapped;
11826 if (obj != null) {
11827 method.apply(obj, arguments);
11828 if ((name === 'shift' || name === 'splice') && obj.length === 0) {
11829 delete obj[0];
11830 }
11831 }
11832 return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
11833 };
11834});
11835
11836// Add all accessor `Array` functions to the wrapper.
11837Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['concat', 'join', 'slice'], function(name) {
11838 var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
11839 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
11840 var obj = this._wrapped;
11841 if (obj != null) obj = method.apply(obj, arguments);
11842 return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
11843 };
11844});
11845
11846/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]);
11847
11848
11849/***/ }),
11850/* 395 */
11851/***/ (function(module, exports, __webpack_require__) {
11852
11853var parent = __webpack_require__(396);
11854
11855module.exports = parent;
11856
11857
11858/***/ }),
11859/* 396 */
11860/***/ (function(module, exports, __webpack_require__) {
11861
11862var isPrototypeOf = __webpack_require__(16);
11863var method = __webpack_require__(397);
11864
11865var ArrayPrototype = Array.prototype;
11866
11867module.exports = function (it) {
11868 var own = it.concat;
11869 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.concat) ? method : own;
11870};
11871
11872
11873/***/ }),
11874/* 397 */
11875/***/ (function(module, exports, __webpack_require__) {
11876
11877__webpack_require__(228);
11878var entryVirtual = __webpack_require__(27);
11879
11880module.exports = entryVirtual('Array').concat;
11881
11882
11883/***/ }),
11884/* 398 */
11885/***/ (function(module, exports) {
11886
11887var $TypeError = TypeError;
11888var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
11889
11890module.exports = function (it) {
11891 if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
11892 return it;
11893};
11894
11895
11896/***/ }),
11897/* 399 */
11898/***/ (function(module, exports, __webpack_require__) {
11899
11900var isArray = __webpack_require__(92);
11901var isConstructor = __webpack_require__(111);
11902var isObject = __webpack_require__(11);
11903var wellKnownSymbol = __webpack_require__(5);
11904
11905var SPECIES = wellKnownSymbol('species');
11906var $Array = Array;
11907
11908// a part of `ArraySpeciesCreate` abstract operation
11909// https://tc39.es/ecma262/#sec-arrayspeciescreate
11910module.exports = function (originalArray) {
11911 var C;
11912 if (isArray(originalArray)) {
11913 C = originalArray.constructor;
11914 // cross-realm fallback
11915 if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined;
11916 else if (isObject(C)) {
11917 C = C[SPECIES];
11918 if (C === null) C = undefined;
11919 }
11920 } return C === undefined ? $Array : C;
11921};
11922
11923
11924/***/ }),
11925/* 400 */
11926/***/ (function(module, exports, __webpack_require__) {
11927
11928var parent = __webpack_require__(401);
11929
11930module.exports = parent;
11931
11932
11933/***/ }),
11934/* 401 */
11935/***/ (function(module, exports, __webpack_require__) {
11936
11937var isPrototypeOf = __webpack_require__(16);
11938var method = __webpack_require__(402);
11939
11940var ArrayPrototype = Array.prototype;
11941
11942module.exports = function (it) {
11943 var own = it.map;
11944 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.map) ? method : own;
11945};
11946
11947
11948/***/ }),
11949/* 402 */
11950/***/ (function(module, exports, __webpack_require__) {
11951
11952__webpack_require__(403);
11953var entryVirtual = __webpack_require__(27);
11954
11955module.exports = entryVirtual('Array').map;
11956
11957
11958/***/ }),
11959/* 403 */
11960/***/ (function(module, exports, __webpack_require__) {
11961
11962"use strict";
11963
11964var $ = __webpack_require__(0);
11965var $map = __webpack_require__(75).map;
11966var arrayMethodHasSpeciesSupport = __webpack_require__(116);
11967
11968var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');
11969
11970// `Array.prototype.map` method
11971// https://tc39.es/ecma262/#sec-array.prototype.map
11972// with adding support of @@species
11973$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
11974 map: function map(callbackfn /* , thisArg */) {
11975 return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
11976 }
11977});
11978
11979
11980/***/ }),
11981/* 404 */
11982/***/ (function(module, exports, __webpack_require__) {
11983
11984var parent = __webpack_require__(405);
11985
11986module.exports = parent;
11987
11988
11989/***/ }),
11990/* 405 */
11991/***/ (function(module, exports, __webpack_require__) {
11992
11993__webpack_require__(406);
11994var path = __webpack_require__(7);
11995
11996module.exports = path.Object.keys;
11997
11998
11999/***/ }),
12000/* 406 */
12001/***/ (function(module, exports, __webpack_require__) {
12002
12003var $ = __webpack_require__(0);
12004var toObject = __webpack_require__(33);
12005var nativeKeys = __webpack_require__(107);
12006var fails = __webpack_require__(2);
12007
12008var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); });
12009
12010// `Object.keys` method
12011// https://tc39.es/ecma262/#sec-object.keys
12012$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
12013 keys: function keys(it) {
12014 return nativeKeys(toObject(it));
12015 }
12016});
12017
12018
12019/***/ }),
12020/* 407 */
12021/***/ (function(module, exports, __webpack_require__) {
12022
12023var parent = __webpack_require__(408);
12024
12025module.exports = parent;
12026
12027
12028/***/ }),
12029/* 408 */
12030/***/ (function(module, exports, __webpack_require__) {
12031
12032__webpack_require__(230);
12033var path = __webpack_require__(7);
12034var apply = __webpack_require__(79);
12035
12036// eslint-disable-next-line es-x/no-json -- safe
12037if (!path.JSON) path.JSON = { stringify: JSON.stringify };
12038
12039// eslint-disable-next-line no-unused-vars -- required for `.length`
12040module.exports = function stringify(it, replacer, space) {
12041 return apply(path.JSON.stringify, null, arguments);
12042};
12043
12044
12045/***/ }),
12046/* 409 */
12047/***/ (function(module, exports, __webpack_require__) {
12048
12049var parent = __webpack_require__(410);
12050
12051module.exports = parent;
12052
12053
12054/***/ }),
12055/* 410 */
12056/***/ (function(module, exports, __webpack_require__) {
12057
12058var isPrototypeOf = __webpack_require__(16);
12059var method = __webpack_require__(411);
12060
12061var ArrayPrototype = Array.prototype;
12062
12063module.exports = function (it) {
12064 var own = it.indexOf;
12065 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.indexOf) ? method : own;
12066};
12067
12068
12069/***/ }),
12070/* 411 */
12071/***/ (function(module, exports, __webpack_require__) {
12072
12073__webpack_require__(412);
12074var entryVirtual = __webpack_require__(27);
12075
12076module.exports = entryVirtual('Array').indexOf;
12077
12078
12079/***/ }),
12080/* 412 */
12081/***/ (function(module, exports, __webpack_require__) {
12082
12083"use strict";
12084
12085/* eslint-disable es-x/no-array-prototype-indexof -- required for testing */
12086var $ = __webpack_require__(0);
12087var uncurryThis = __webpack_require__(4);
12088var $IndexOf = __webpack_require__(126).indexOf;
12089var arrayMethodIsStrict = __webpack_require__(151);
12090
12091var un$IndexOf = uncurryThis([].indexOf);
12092
12093var NEGATIVE_ZERO = !!un$IndexOf && 1 / un$IndexOf([1], 1, -0) < 0;
12094var STRICT_METHOD = arrayMethodIsStrict('indexOf');
12095
12096// `Array.prototype.indexOf` method
12097// https://tc39.es/ecma262/#sec-array.prototype.indexof
12098$({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {
12099 indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
12100 var fromIndex = arguments.length > 1 ? arguments[1] : undefined;
12101 return NEGATIVE_ZERO
12102 // convert -0 to +0
12103 ? un$IndexOf(this, searchElement, fromIndex) || 0
12104 : $IndexOf(this, searchElement, fromIndex);
12105 }
12106});
12107
12108
12109/***/ }),
12110/* 413 */
12111/***/ (function(module, exports, __webpack_require__) {
12112
12113__webpack_require__(46);
12114var classof = __webpack_require__(55);
12115var hasOwn = __webpack_require__(13);
12116var isPrototypeOf = __webpack_require__(16);
12117var method = __webpack_require__(414);
12118
12119var ArrayPrototype = Array.prototype;
12120
12121var DOMIterables = {
12122 DOMTokenList: true,
12123 NodeList: true
12124};
12125
12126module.exports = function (it) {
12127 var own = it.keys;
12128 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.keys)
12129 || hasOwn(DOMIterables, classof(it)) ? method : own;
12130};
12131
12132
12133/***/ }),
12134/* 414 */
12135/***/ (function(module, exports, __webpack_require__) {
12136
12137var parent = __webpack_require__(415);
12138
12139module.exports = parent;
12140
12141
12142/***/ }),
12143/* 415 */
12144/***/ (function(module, exports, __webpack_require__) {
12145
12146__webpack_require__(43);
12147__webpack_require__(68);
12148var entryVirtual = __webpack_require__(27);
12149
12150module.exports = entryVirtual('Array').keys;
12151
12152
12153/***/ }),
12154/* 416 */
12155/***/ (function(module, exports) {
12156
12157// Unique ID creation requires a high quality random # generator. In the
12158// browser this is a little complicated due to unknown quality of Math.random()
12159// and inconsistent support for the `crypto` API. We do the best we can via
12160// feature-detection
12161
12162// getRandomValues needs to be invoked in a context where "this" is a Crypto
12163// implementation. Also, find the complete implementation of crypto on IE11.
12164var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
12165 (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
12166
12167if (getRandomValues) {
12168 // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
12169 var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
12170
12171 module.exports = function whatwgRNG() {
12172 getRandomValues(rnds8);
12173 return rnds8;
12174 };
12175} else {
12176 // Math.random()-based (RNG)
12177 //
12178 // If all else fails, use Math.random(). It's fast, but is of unspecified
12179 // quality.
12180 var rnds = new Array(16);
12181
12182 module.exports = function mathRNG() {
12183 for (var i = 0, r; i < 16; i++) {
12184 if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
12185 rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
12186 }
12187
12188 return rnds;
12189 };
12190}
12191
12192
12193/***/ }),
12194/* 417 */
12195/***/ (function(module, exports) {
12196
12197/**
12198 * Convert array of 16 byte values to UUID string format of the form:
12199 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
12200 */
12201var byteToHex = [];
12202for (var i = 0; i < 256; ++i) {
12203 byteToHex[i] = (i + 0x100).toString(16).substr(1);
12204}
12205
12206function bytesToUuid(buf, offset) {
12207 var i = offset || 0;
12208 var bth = byteToHex;
12209 // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
12210 return ([bth[buf[i++]], bth[buf[i++]],
12211 bth[buf[i++]], bth[buf[i++]], '-',
12212 bth[buf[i++]], bth[buf[i++]], '-',
12213 bth[buf[i++]], bth[buf[i++]], '-',
12214 bth[buf[i++]], bth[buf[i++]], '-',
12215 bth[buf[i++]], bth[buf[i++]],
12216 bth[buf[i++]], bth[buf[i++]],
12217 bth[buf[i++]], bth[buf[i++]]]).join('');
12218}
12219
12220module.exports = bytesToUuid;
12221
12222
12223/***/ }),
12224/* 418 */
12225/***/ (function(module, exports, __webpack_require__) {
12226
12227"use strict";
12228
12229
12230/**
12231 * This is the common logic for both the Node.js and web browser
12232 * implementations of `debug()`.
12233 */
12234function setup(env) {
12235 createDebug.debug = createDebug;
12236 createDebug.default = createDebug;
12237 createDebug.coerce = coerce;
12238 createDebug.disable = disable;
12239 createDebug.enable = enable;
12240 createDebug.enabled = enabled;
12241 createDebug.humanize = __webpack_require__(419);
12242 Object.keys(env).forEach(function (key) {
12243 createDebug[key] = env[key];
12244 });
12245 /**
12246 * Active `debug` instances.
12247 */
12248
12249 createDebug.instances = [];
12250 /**
12251 * The currently active debug mode names, and names to skip.
12252 */
12253
12254 createDebug.names = [];
12255 createDebug.skips = [];
12256 /**
12257 * Map of special "%n" handling functions, for the debug "format" argument.
12258 *
12259 * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
12260 */
12261
12262 createDebug.formatters = {};
12263 /**
12264 * Selects a color for a debug namespace
12265 * @param {String} namespace The namespace string for the for the debug instance to be colored
12266 * @return {Number|String} An ANSI color code for the given namespace
12267 * @api private
12268 */
12269
12270 function selectColor(namespace) {
12271 var hash = 0;
12272
12273 for (var i = 0; i < namespace.length; i++) {
12274 hash = (hash << 5) - hash + namespace.charCodeAt(i);
12275 hash |= 0; // Convert to 32bit integer
12276 }
12277
12278 return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
12279 }
12280
12281 createDebug.selectColor = selectColor;
12282 /**
12283 * Create a debugger with the given `namespace`.
12284 *
12285 * @param {String} namespace
12286 * @return {Function}
12287 * @api public
12288 */
12289
12290 function createDebug(namespace) {
12291 var prevTime;
12292
12293 function debug() {
12294 // Disabled?
12295 if (!debug.enabled) {
12296 return;
12297 }
12298
12299 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
12300 args[_key] = arguments[_key];
12301 }
12302
12303 var self = debug; // Set `diff` timestamp
12304
12305 var curr = Number(new Date());
12306 var ms = curr - (prevTime || curr);
12307 self.diff = ms;
12308 self.prev = prevTime;
12309 self.curr = curr;
12310 prevTime = curr;
12311 args[0] = createDebug.coerce(args[0]);
12312
12313 if (typeof args[0] !== 'string') {
12314 // Anything else let's inspect with %O
12315 args.unshift('%O');
12316 } // Apply any `formatters` transformations
12317
12318
12319 var index = 0;
12320 args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
12321 // If we encounter an escaped % then don't increase the array index
12322 if (match === '%%') {
12323 return match;
12324 }
12325
12326 index++;
12327 var formatter = createDebug.formatters[format];
12328
12329 if (typeof formatter === 'function') {
12330 var val = args[index];
12331 match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
12332
12333 args.splice(index, 1);
12334 index--;
12335 }
12336
12337 return match;
12338 }); // Apply env-specific formatting (colors, etc.)
12339
12340 createDebug.formatArgs.call(self, args);
12341 var logFn = self.log || createDebug.log;
12342 logFn.apply(self, args);
12343 }
12344
12345 debug.namespace = namespace;
12346 debug.enabled = createDebug.enabled(namespace);
12347 debug.useColors = createDebug.useColors();
12348 debug.color = selectColor(namespace);
12349 debug.destroy = destroy;
12350 debug.extend = extend; // Debug.formatArgs = formatArgs;
12351 // debug.rawLog = rawLog;
12352 // env-specific initialization logic for debug instances
12353
12354 if (typeof createDebug.init === 'function') {
12355 createDebug.init(debug);
12356 }
12357
12358 createDebug.instances.push(debug);
12359 return debug;
12360 }
12361
12362 function destroy() {
12363 var index = createDebug.instances.indexOf(this);
12364
12365 if (index !== -1) {
12366 createDebug.instances.splice(index, 1);
12367 return true;
12368 }
12369
12370 return false;
12371 }
12372
12373 function extend(namespace, delimiter) {
12374 return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
12375 }
12376 /**
12377 * Enables a debug mode by namespaces. This can include modes
12378 * separated by a colon and wildcards.
12379 *
12380 * @param {String} namespaces
12381 * @api public
12382 */
12383
12384
12385 function enable(namespaces) {
12386 createDebug.save(namespaces);
12387 createDebug.names = [];
12388 createDebug.skips = [];
12389 var i;
12390 var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
12391 var len = split.length;
12392
12393 for (i = 0; i < len; i++) {
12394 if (!split[i]) {
12395 // ignore empty strings
12396 continue;
12397 }
12398
12399 namespaces = split[i].replace(/\*/g, '.*?');
12400
12401 if (namespaces[0] === '-') {
12402 createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
12403 } else {
12404 createDebug.names.push(new RegExp('^' + namespaces + '$'));
12405 }
12406 }
12407
12408 for (i = 0; i < createDebug.instances.length; i++) {
12409 var instance = createDebug.instances[i];
12410 instance.enabled = createDebug.enabled(instance.namespace);
12411 }
12412 }
12413 /**
12414 * Disable debug output.
12415 *
12416 * @api public
12417 */
12418
12419
12420 function disable() {
12421 createDebug.enable('');
12422 }
12423 /**
12424 * Returns true if the given mode name is enabled, false otherwise.
12425 *
12426 * @param {String} name
12427 * @return {Boolean}
12428 * @api public
12429 */
12430
12431
12432 function enabled(name) {
12433 if (name[name.length - 1] === '*') {
12434 return true;
12435 }
12436
12437 var i;
12438 var len;
12439
12440 for (i = 0, len = createDebug.skips.length; i < len; i++) {
12441 if (createDebug.skips[i].test(name)) {
12442 return false;
12443 }
12444 }
12445
12446 for (i = 0, len = createDebug.names.length; i < len; i++) {
12447 if (createDebug.names[i].test(name)) {
12448 return true;
12449 }
12450 }
12451
12452 return false;
12453 }
12454 /**
12455 * Coerce `val`.
12456 *
12457 * @param {Mixed} val
12458 * @return {Mixed}
12459 * @api private
12460 */
12461
12462
12463 function coerce(val) {
12464 if (val instanceof Error) {
12465 return val.stack || val.message;
12466 }
12467
12468 return val;
12469 }
12470
12471 createDebug.enable(createDebug.load());
12472 return createDebug;
12473}
12474
12475module.exports = setup;
12476
12477
12478
12479/***/ }),
12480/* 419 */
12481/***/ (function(module, exports) {
12482
12483/**
12484 * Helpers.
12485 */
12486
12487var s = 1000;
12488var m = s * 60;
12489var h = m * 60;
12490var d = h * 24;
12491var w = d * 7;
12492var y = d * 365.25;
12493
12494/**
12495 * Parse or format the given `val`.
12496 *
12497 * Options:
12498 *
12499 * - `long` verbose formatting [false]
12500 *
12501 * @param {String|Number} val
12502 * @param {Object} [options]
12503 * @throws {Error} throw an error if val is not a non-empty string or a number
12504 * @return {String|Number}
12505 * @api public
12506 */
12507
12508module.exports = function(val, options) {
12509 options = options || {};
12510 var type = typeof val;
12511 if (type === 'string' && val.length > 0) {
12512 return parse(val);
12513 } else if (type === 'number' && isFinite(val)) {
12514 return options.long ? fmtLong(val) : fmtShort(val);
12515 }
12516 throw new Error(
12517 'val is not a non-empty string or a valid number. val=' +
12518 JSON.stringify(val)
12519 );
12520};
12521
12522/**
12523 * Parse the given `str` and return milliseconds.
12524 *
12525 * @param {String} str
12526 * @return {Number}
12527 * @api private
12528 */
12529
12530function parse(str) {
12531 str = String(str);
12532 if (str.length > 100) {
12533 return;
12534 }
12535 var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
12536 str
12537 );
12538 if (!match) {
12539 return;
12540 }
12541 var n = parseFloat(match[1]);
12542 var type = (match[2] || 'ms').toLowerCase();
12543 switch (type) {
12544 case 'years':
12545 case 'year':
12546 case 'yrs':
12547 case 'yr':
12548 case 'y':
12549 return n * y;
12550 case 'weeks':
12551 case 'week':
12552 case 'w':
12553 return n * w;
12554 case 'days':
12555 case 'day':
12556 case 'd':
12557 return n * d;
12558 case 'hours':
12559 case 'hour':
12560 case 'hrs':
12561 case 'hr':
12562 case 'h':
12563 return n * h;
12564 case 'minutes':
12565 case 'minute':
12566 case 'mins':
12567 case 'min':
12568 case 'm':
12569 return n * m;
12570 case 'seconds':
12571 case 'second':
12572 case 'secs':
12573 case 'sec':
12574 case 's':
12575 return n * s;
12576 case 'milliseconds':
12577 case 'millisecond':
12578 case 'msecs':
12579 case 'msec':
12580 case 'ms':
12581 return n;
12582 default:
12583 return undefined;
12584 }
12585}
12586
12587/**
12588 * Short format for `ms`.
12589 *
12590 * @param {Number} ms
12591 * @return {String}
12592 * @api private
12593 */
12594
12595function fmtShort(ms) {
12596 var msAbs = Math.abs(ms);
12597 if (msAbs >= d) {
12598 return Math.round(ms / d) + 'd';
12599 }
12600 if (msAbs >= h) {
12601 return Math.round(ms / h) + 'h';
12602 }
12603 if (msAbs >= m) {
12604 return Math.round(ms / m) + 'm';
12605 }
12606 if (msAbs >= s) {
12607 return Math.round(ms / s) + 's';
12608 }
12609 return ms + 'ms';
12610}
12611
12612/**
12613 * Long format for `ms`.
12614 *
12615 * @param {Number} ms
12616 * @return {String}
12617 * @api private
12618 */
12619
12620function fmtLong(ms) {
12621 var msAbs = Math.abs(ms);
12622 if (msAbs >= d) {
12623 return plural(ms, msAbs, d, 'day');
12624 }
12625 if (msAbs >= h) {
12626 return plural(ms, msAbs, h, 'hour');
12627 }
12628 if (msAbs >= m) {
12629 return plural(ms, msAbs, m, 'minute');
12630 }
12631 if (msAbs >= s) {
12632 return plural(ms, msAbs, s, 'second');
12633 }
12634 return ms + ' ms';
12635}
12636
12637/**
12638 * Pluralization helper.
12639 */
12640
12641function plural(ms, msAbs, n, name) {
12642 var isPlural = msAbs >= n * 1.5;
12643 return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
12644}
12645
12646
12647/***/ }),
12648/* 420 */
12649/***/ (function(module, exports, __webpack_require__) {
12650
12651__webpack_require__(421);
12652var path = __webpack_require__(7);
12653
12654module.exports = path.Object.getPrototypeOf;
12655
12656
12657/***/ }),
12658/* 421 */
12659/***/ (function(module, exports, __webpack_require__) {
12660
12661var $ = __webpack_require__(0);
12662var fails = __webpack_require__(2);
12663var toObject = __webpack_require__(33);
12664var nativeGetPrototypeOf = __webpack_require__(102);
12665var CORRECT_PROTOTYPE_GETTER = __webpack_require__(162);
12666
12667var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); });
12668
12669// `Object.getPrototypeOf` method
12670// https://tc39.es/ecma262/#sec-object.getprototypeof
12671$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, {
12672 getPrototypeOf: function getPrototypeOf(it) {
12673 return nativeGetPrototypeOf(toObject(it));
12674 }
12675});
12676
12677
12678
12679/***/ }),
12680/* 422 */
12681/***/ (function(module, exports, __webpack_require__) {
12682
12683module.exports = __webpack_require__(238);
12684
12685/***/ }),
12686/* 423 */
12687/***/ (function(module, exports, __webpack_require__) {
12688
12689__webpack_require__(424);
12690var path = __webpack_require__(7);
12691
12692module.exports = path.Object.setPrototypeOf;
12693
12694
12695/***/ }),
12696/* 424 */
12697/***/ (function(module, exports, __webpack_require__) {
12698
12699var $ = __webpack_require__(0);
12700var setPrototypeOf = __webpack_require__(104);
12701
12702// `Object.setPrototypeOf` method
12703// https://tc39.es/ecma262/#sec-object.setprototypeof
12704$({ target: 'Object', stat: true }, {
12705 setPrototypeOf: setPrototypeOf
12706});
12707
12708
12709/***/ }),
12710/* 425 */
12711/***/ (function(module, exports, __webpack_require__) {
12712
12713"use strict";
12714
12715
12716var _interopRequireDefault = __webpack_require__(1);
12717
12718var _slice = _interopRequireDefault(__webpack_require__(34));
12719
12720var _concat = _interopRequireDefault(__webpack_require__(19));
12721
12722var _defineProperty = _interopRequireDefault(__webpack_require__(94));
12723
12724var AV = __webpack_require__(74);
12725
12726var AppRouter = __webpack_require__(431);
12727
12728var _require = __webpack_require__(32),
12729 isNullOrUndefined = _require.isNullOrUndefined;
12730
12731var _require2 = __webpack_require__(3),
12732 extend = _require2.extend,
12733 isObject = _require2.isObject,
12734 isEmpty = _require2.isEmpty;
12735
12736var isCNApp = function isCNApp(appId) {
12737 return (0, _slice.default)(appId).call(appId, -9) !== '-MdYXbMMI';
12738};
12739
12740var fillServerURLs = function fillServerURLs(url) {
12741 return {
12742 push: url,
12743 stats: url,
12744 engine: url,
12745 api: url,
12746 rtm: url
12747 };
12748};
12749
12750function getDefaultServerURLs(appId) {
12751 var _context, _context2, _context3, _context4, _context5;
12752
12753 if (isCNApp(appId)) {
12754 return {};
12755 }
12756
12757 var id = (0, _slice.default)(appId).call(appId, 0, 8).toLowerCase();
12758 var domain = 'lncldglobal.com';
12759 return {
12760 push: (0, _concat.default)(_context = "https://".concat(id, ".push.")).call(_context, domain),
12761 stats: (0, _concat.default)(_context2 = "https://".concat(id, ".stats.")).call(_context2, domain),
12762 engine: (0, _concat.default)(_context3 = "https://".concat(id, ".engine.")).call(_context3, domain),
12763 api: (0, _concat.default)(_context4 = "https://".concat(id, ".api.")).call(_context4, domain),
12764 rtm: (0, _concat.default)(_context5 = "https://".concat(id, ".rtm.")).call(_context5, domain)
12765 };
12766}
12767
12768var _disableAppRouter = false;
12769var _initialized = false;
12770/**
12771 * URLs for services
12772 * @typedef {Object} ServerURLs
12773 * @property {String} [api] serverURL for API service
12774 * @property {String} [engine] serverURL for engine service
12775 * @property {String} [stats] serverURL for stats service
12776 * @property {String} [push] serverURL for push service
12777 * @property {String} [rtm] serverURL for LiveQuery service
12778 */
12779
12780/**
12781 * Call this method first to set up your authentication tokens for AV.
12782 * You can get your app keys from the LeanCloud dashboard on http://leancloud.cn .
12783 * @function AV.init
12784 * @param {Object} options
12785 * @param {String} options.appId application id
12786 * @param {String} options.appKey application key
12787 * @param {String} [options.masterKey] application master key
12788 * @param {Boolean} [options.production]
12789 * @param {String|ServerURLs} [options.serverURL] URLs for services. if a string was given, it will be applied for all services.
12790 * @param {Boolean} [options.disableCurrentUser]
12791 */
12792
12793AV.init = function init(options) {
12794 if (!isObject(options)) {
12795 return AV.init({
12796 appId: options,
12797 appKey: arguments.length <= 1 ? undefined : arguments[1],
12798 masterKey: arguments.length <= 2 ? undefined : arguments[2]
12799 });
12800 }
12801
12802 var appId = options.appId,
12803 appKey = options.appKey,
12804 masterKey = options.masterKey,
12805 hookKey = options.hookKey,
12806 serverURL = options.serverURL,
12807 _options$serverURLs = options.serverURLs,
12808 serverURLs = _options$serverURLs === void 0 ? serverURL : _options$serverURLs,
12809 disableCurrentUser = options.disableCurrentUser,
12810 production = options.production,
12811 realtime = options.realtime;
12812 if (_initialized) console.warn('Initializing LeanCloud Storage SDK which has already been initialized. Reinitializing the SDK might cause problems like unexpected cross-app data writing and invalid relations.');
12813 if (!appId) throw new TypeError('appId must be a string');
12814 if (!appKey) throw new TypeError('appKey must be a string');
12815 if ("Browser" !== 'NODE_JS' && masterKey) console.warn('MasterKey is not supposed to be used at client side.');
12816
12817 if (isCNApp(appId)) {
12818 if (!serverURLs && isEmpty(AV._config.serverURLs)) {
12819 throw new TypeError("serverURL option is required for apps from CN region");
12820 }
12821 }
12822
12823 if (appId !== AV._config.applicationId) {
12824 // overwrite all keys when reinitializing as a new app
12825 AV._config.masterKey = masterKey;
12826 AV._config.hookKey = hookKey;
12827 } else {
12828 if (masterKey) AV._config.masterKey = masterKey;
12829 if (hookKey) AV._config.hookKey = hookKey;
12830 }
12831
12832 AV._config.applicationId = appId;
12833 AV._config.applicationKey = appKey;
12834
12835 if (!isNullOrUndefined(production)) {
12836 AV.setProduction(production);
12837 }
12838
12839 if (typeof disableCurrentUser !== 'undefined') AV._config.disableCurrentUser = disableCurrentUser;
12840 var disableAppRouter = _disableAppRouter || typeof serverURLs !== 'undefined';
12841
12842 if (!disableAppRouter) {
12843 AV._appRouter = new AppRouter(AV);
12844 }
12845
12846 AV._setServerURLs(extend({}, getDefaultServerURLs(appId), AV._config.serverURLs, typeof serverURLs === 'string' ? fillServerURLs(serverURLs) : serverURLs), disableAppRouter);
12847
12848 if (realtime) {
12849 AV._config.realtime = realtime;
12850 } else if (AV._sharedConfig.liveQueryRealtime) {
12851 var _AV$_config$serverURL = AV._config.serverURLs,
12852 api = _AV$_config$serverURL.api,
12853 rtm = _AV$_config$serverURL.rtm;
12854 AV._config.realtime = new AV._sharedConfig.liveQueryRealtime({
12855 appId: appId,
12856 appKey: appKey,
12857 server: {
12858 api: api,
12859 RTMRouter: rtm
12860 }
12861 });
12862 }
12863
12864 _initialized = true;
12865}; // If we're running in node.js, allow using the master key.
12866
12867
12868if (false) {
12869 AV.Cloud = AV.Cloud || {};
12870 /**
12871 * Switches the LeanCloud SDK to using the Master key. The Master key grants
12872 * priveleged access to the data in LeanCloud and can be used to bypass ACLs and
12873 * other restrictions that are applied to the client SDKs.
12874 * <p><strong><em>Available in Cloud Code and Node.js only.</em></strong>
12875 * </p>
12876 */
12877
12878 AV.Cloud.useMasterKey = function () {
12879 AV._config.useMasterKey = true;
12880 };
12881}
12882/**
12883 * Call this method to set production environment variable.
12884 * @function AV.setProduction
12885 * @param {Boolean} production True is production environment,and
12886 * it's true by default.
12887 */
12888
12889
12890AV.setProduction = function (production) {
12891 if (!isNullOrUndefined(production)) {
12892 AV._config.production = production ? 1 : 0;
12893 } else {
12894 // change to default value
12895 AV._config.production = null;
12896 }
12897};
12898
12899AV._setServerURLs = function (urls) {
12900 var disableAppRouter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
12901
12902 if (typeof urls !== 'string') {
12903 extend(AV._config.serverURLs, urls);
12904 } else {
12905 AV._config.serverURLs = fillServerURLs(urls);
12906 }
12907
12908 if (disableAppRouter) {
12909 if (AV._appRouter) {
12910 AV._appRouter.disable();
12911 } else {
12912 _disableAppRouter = true;
12913 }
12914 }
12915};
12916/**
12917 * Set server URLs for services.
12918 * @function AV.setServerURL
12919 * @since 4.3.0
12920 * @param {String|ServerURLs} urls URLs for services. if a string was given, it will be applied for all services.
12921 * You can also set them when initializing SDK with `options.serverURL`
12922 */
12923
12924
12925AV.setServerURL = function (urls) {
12926 return AV._setServerURLs(urls);
12927};
12928
12929AV.setServerURLs = AV.setServerURL;
12930
12931AV.keepErrorRawMessage = function (value) {
12932 AV._sharedConfig.keepErrorRawMessage = value;
12933};
12934/**
12935 * Set a deadline for requests to complete.
12936 * Note that file upload requests are not affected.
12937 * @function AV.setRequestTimeout
12938 * @since 3.6.0
12939 * @param {number} ms
12940 */
12941
12942
12943AV.setRequestTimeout = function (ms) {
12944 AV._config.requestTimeout = ms;
12945}; // backword compatible
12946
12947
12948AV.initialize = AV.init;
12949
12950var defineConfig = function defineConfig(property) {
12951 return (0, _defineProperty.default)(AV, property, {
12952 get: function get() {
12953 return AV._config[property];
12954 },
12955 set: function set(value) {
12956 AV._config[property] = value;
12957 }
12958 });
12959};
12960
12961['applicationId', 'applicationKey', 'masterKey', 'hookKey'].forEach(defineConfig);
12962
12963/***/ }),
12964/* 426 */
12965/***/ (function(module, exports, __webpack_require__) {
12966
12967var isPrototypeOf = __webpack_require__(16);
12968var method = __webpack_require__(427);
12969
12970var ArrayPrototype = Array.prototype;
12971
12972module.exports = function (it) {
12973 var own = it.slice;
12974 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.slice) ? method : own;
12975};
12976
12977
12978/***/ }),
12979/* 427 */
12980/***/ (function(module, exports, __webpack_require__) {
12981
12982__webpack_require__(428);
12983var entryVirtual = __webpack_require__(27);
12984
12985module.exports = entryVirtual('Array').slice;
12986
12987
12988/***/ }),
12989/* 428 */
12990/***/ (function(module, exports, __webpack_require__) {
12991
12992"use strict";
12993
12994var $ = __webpack_require__(0);
12995var isArray = __webpack_require__(92);
12996var isConstructor = __webpack_require__(111);
12997var isObject = __webpack_require__(11);
12998var toAbsoluteIndex = __webpack_require__(127);
12999var lengthOfArrayLike = __webpack_require__(40);
13000var toIndexedObject = __webpack_require__(35);
13001var createProperty = __webpack_require__(93);
13002var wellKnownSymbol = __webpack_require__(5);
13003var arrayMethodHasSpeciesSupport = __webpack_require__(116);
13004var un$Slice = __webpack_require__(112);
13005
13006var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
13007
13008var SPECIES = wellKnownSymbol('species');
13009var $Array = Array;
13010var max = Math.max;
13011
13012// `Array.prototype.slice` method
13013// https://tc39.es/ecma262/#sec-array.prototype.slice
13014// fallback for not array-like ES3 strings and DOM objects
13015$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
13016 slice: function slice(start, end) {
13017 var O = toIndexedObject(this);
13018 var length = lengthOfArrayLike(O);
13019 var k = toAbsoluteIndex(start, length);
13020 var fin = toAbsoluteIndex(end === undefined ? length : end, length);
13021 // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
13022 var Constructor, result, n;
13023 if (isArray(O)) {
13024 Constructor = O.constructor;
13025 // cross-realm fallback
13026 if (isConstructor(Constructor) && (Constructor === $Array || isArray(Constructor.prototype))) {
13027 Constructor = undefined;
13028 } else if (isObject(Constructor)) {
13029 Constructor = Constructor[SPECIES];
13030 if (Constructor === null) Constructor = undefined;
13031 }
13032 if (Constructor === $Array || Constructor === undefined) {
13033 return un$Slice(O, k, fin);
13034 }
13035 }
13036 result = new (Constructor === undefined ? $Array : Constructor)(max(fin - k, 0));
13037 for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
13038 result.length = n;
13039 return result;
13040 }
13041});
13042
13043
13044/***/ }),
13045/* 429 */
13046/***/ (function(module, exports, __webpack_require__) {
13047
13048__webpack_require__(430);
13049var path = __webpack_require__(7);
13050
13051var Object = path.Object;
13052
13053var defineProperty = module.exports = function defineProperty(it, key, desc) {
13054 return Object.defineProperty(it, key, desc);
13055};
13056
13057if (Object.defineProperty.sham) defineProperty.sham = true;
13058
13059
13060/***/ }),
13061/* 430 */
13062/***/ (function(module, exports, __webpack_require__) {
13063
13064var $ = __webpack_require__(0);
13065var DESCRIPTORS = __webpack_require__(14);
13066var defineProperty = __webpack_require__(23).f;
13067
13068// `Object.defineProperty` method
13069// https://tc39.es/ecma262/#sec-object.defineproperty
13070// eslint-disable-next-line es-x/no-object-defineproperty -- safe
13071$({ target: 'Object', stat: true, forced: Object.defineProperty !== defineProperty, sham: !DESCRIPTORS }, {
13072 defineProperty: defineProperty
13073});
13074
13075
13076/***/ }),
13077/* 431 */
13078/***/ (function(module, exports, __webpack_require__) {
13079
13080"use strict";
13081
13082
13083var ajax = __webpack_require__(117);
13084
13085var Cache = __webpack_require__(237);
13086
13087function AppRouter(AV) {
13088 var _this = this;
13089
13090 this.AV = AV;
13091 this.lockedUntil = 0;
13092 Cache.getAsync('serverURLs').then(function (data) {
13093 if (_this.disabled) return;
13094 if (!data) return _this.lock(0);
13095 var serverURLs = data.serverURLs,
13096 lockedUntil = data.lockedUntil;
13097
13098 _this.AV._setServerURLs(serverURLs, false);
13099
13100 _this.lockedUntil = lockedUntil;
13101 }).catch(function () {
13102 return _this.lock(0);
13103 });
13104}
13105
13106AppRouter.prototype.disable = function disable() {
13107 this.disabled = true;
13108};
13109
13110AppRouter.prototype.lock = function lock(ttl) {
13111 this.lockedUntil = Date.now() + ttl;
13112};
13113
13114AppRouter.prototype.refresh = function refresh() {
13115 var _this2 = this;
13116
13117 if (this.disabled) return;
13118 if (Date.now() < this.lockedUntil) return;
13119 this.lock(10);
13120 var url = 'https://app-router.com/2/route';
13121 return ajax({
13122 method: 'get',
13123 url: url,
13124 query: {
13125 appId: this.AV.applicationId
13126 }
13127 }).then(function (servers) {
13128 if (_this2.disabled) return;
13129 var ttl = servers.ttl;
13130 if (!ttl) throw new Error('missing ttl');
13131 ttl = ttl * 1000;
13132 var protocal = 'https://';
13133 var serverURLs = {
13134 push: protocal + servers.push_server,
13135 stats: protocal + servers.stats_server,
13136 engine: protocal + servers.engine_server,
13137 api: protocal + servers.api_server
13138 };
13139
13140 _this2.AV._setServerURLs(serverURLs, false);
13141
13142 _this2.lock(ttl);
13143
13144 return Cache.setAsync('serverURLs', {
13145 serverURLs: serverURLs,
13146 lockedUntil: _this2.lockedUntil
13147 }, ttl);
13148 }).catch(function (error) {
13149 // bypass all errors
13150 console.warn("refresh server URLs failed: ".concat(error.message));
13151
13152 _this2.lock(600);
13153 });
13154};
13155
13156module.exports = AppRouter;
13157
13158/***/ }),
13159/* 432 */
13160/***/ (function(module, exports, __webpack_require__) {
13161
13162module.exports = __webpack_require__(433);
13163
13164
13165/***/ }),
13166/* 433 */
13167/***/ (function(module, exports, __webpack_require__) {
13168
13169var parent = __webpack_require__(434);
13170__webpack_require__(456);
13171__webpack_require__(457);
13172__webpack_require__(458);
13173__webpack_require__(459);
13174__webpack_require__(460);
13175// TODO: Remove from `core-js@4`
13176__webpack_require__(461);
13177__webpack_require__(462);
13178__webpack_require__(463);
13179
13180module.exports = parent;
13181
13182
13183/***/ }),
13184/* 434 */
13185/***/ (function(module, exports, __webpack_require__) {
13186
13187var parent = __webpack_require__(242);
13188
13189module.exports = parent;
13190
13191
13192/***/ }),
13193/* 435 */
13194/***/ (function(module, exports, __webpack_require__) {
13195
13196__webpack_require__(228);
13197__webpack_require__(68);
13198__webpack_require__(243);
13199__webpack_require__(440);
13200__webpack_require__(441);
13201__webpack_require__(442);
13202__webpack_require__(443);
13203__webpack_require__(248);
13204__webpack_require__(444);
13205__webpack_require__(445);
13206__webpack_require__(446);
13207__webpack_require__(447);
13208__webpack_require__(448);
13209__webpack_require__(449);
13210__webpack_require__(450);
13211__webpack_require__(451);
13212__webpack_require__(452);
13213__webpack_require__(453);
13214__webpack_require__(454);
13215__webpack_require__(455);
13216var path = __webpack_require__(7);
13217
13218module.exports = path.Symbol;
13219
13220
13221/***/ }),
13222/* 436 */
13223/***/ (function(module, exports, __webpack_require__) {
13224
13225"use strict";
13226
13227var $ = __webpack_require__(0);
13228var global = __webpack_require__(8);
13229var call = __webpack_require__(15);
13230var uncurryThis = __webpack_require__(4);
13231var IS_PURE = __webpack_require__(36);
13232var DESCRIPTORS = __webpack_require__(14);
13233var NATIVE_SYMBOL = __webpack_require__(65);
13234var fails = __webpack_require__(2);
13235var hasOwn = __webpack_require__(13);
13236var isPrototypeOf = __webpack_require__(16);
13237var anObject = __webpack_require__(21);
13238var toIndexedObject = __webpack_require__(35);
13239var toPropertyKey = __webpack_require__(99);
13240var $toString = __webpack_require__(42);
13241var createPropertyDescriptor = __webpack_require__(49);
13242var nativeObjectCreate = __webpack_require__(53);
13243var objectKeys = __webpack_require__(107);
13244var getOwnPropertyNamesModule = __webpack_require__(105);
13245var getOwnPropertyNamesExternal = __webpack_require__(244);
13246var getOwnPropertySymbolsModule = __webpack_require__(106);
13247var getOwnPropertyDescriptorModule = __webpack_require__(64);
13248var definePropertyModule = __webpack_require__(23);
13249var definePropertiesModule = __webpack_require__(130);
13250var propertyIsEnumerableModule = __webpack_require__(122);
13251var defineBuiltIn = __webpack_require__(45);
13252var shared = __webpack_require__(82);
13253var sharedKey = __webpack_require__(103);
13254var hiddenKeys = __webpack_require__(83);
13255var uid = __webpack_require__(101);
13256var wellKnownSymbol = __webpack_require__(5);
13257var wrappedWellKnownSymbolModule = __webpack_require__(152);
13258var defineWellKnownSymbol = __webpack_require__(10);
13259var defineSymbolToPrimitive = __webpack_require__(246);
13260var setToStringTag = __webpack_require__(56);
13261var InternalStateModule = __webpack_require__(44);
13262var $forEach = __webpack_require__(75).forEach;
13263
13264var HIDDEN = sharedKey('hidden');
13265var SYMBOL = 'Symbol';
13266var PROTOTYPE = 'prototype';
13267
13268var setInternalState = InternalStateModule.set;
13269var getInternalState = InternalStateModule.getterFor(SYMBOL);
13270
13271var ObjectPrototype = Object[PROTOTYPE];
13272var $Symbol = global.Symbol;
13273var SymbolPrototype = $Symbol && $Symbol[PROTOTYPE];
13274var TypeError = global.TypeError;
13275var QObject = global.QObject;
13276var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
13277var nativeDefineProperty = definePropertyModule.f;
13278var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
13279var nativePropertyIsEnumerable = propertyIsEnumerableModule.f;
13280var push = uncurryThis([].push);
13281
13282var AllSymbols = shared('symbols');
13283var ObjectPrototypeSymbols = shared('op-symbols');
13284var WellKnownSymbolsStore = shared('wks');
13285
13286// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
13287var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
13288
13289// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
13290var setSymbolDescriptor = DESCRIPTORS && fails(function () {
13291 return nativeObjectCreate(nativeDefineProperty({}, 'a', {
13292 get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; }
13293 })).a != 7;
13294}) ? function (O, P, Attributes) {
13295 var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);
13296 if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
13297 nativeDefineProperty(O, P, Attributes);
13298 if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
13299 nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);
13300 }
13301} : nativeDefineProperty;
13302
13303var wrap = function (tag, description) {
13304 var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype);
13305 setInternalState(symbol, {
13306 type: SYMBOL,
13307 tag: tag,
13308 description: description
13309 });
13310 if (!DESCRIPTORS) symbol.description = description;
13311 return symbol;
13312};
13313
13314var $defineProperty = function defineProperty(O, P, Attributes) {
13315 if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
13316 anObject(O);
13317 var key = toPropertyKey(P);
13318 anObject(Attributes);
13319 if (hasOwn(AllSymbols, key)) {
13320 if (!Attributes.enumerable) {
13321 if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));
13322 O[HIDDEN][key] = true;
13323 } else {
13324 if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
13325 Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
13326 } return setSymbolDescriptor(O, key, Attributes);
13327 } return nativeDefineProperty(O, key, Attributes);
13328};
13329
13330var $defineProperties = function defineProperties(O, Properties) {
13331 anObject(O);
13332 var properties = toIndexedObject(Properties);
13333 var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
13334 $forEach(keys, function (key) {
13335 if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]);
13336 });
13337 return O;
13338};
13339
13340var $create = function create(O, Properties) {
13341 return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);
13342};
13343
13344var $propertyIsEnumerable = function propertyIsEnumerable(V) {
13345 var P = toPropertyKey(V);
13346 var enumerable = call(nativePropertyIsEnumerable, this, P);
13347 if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false;
13348 return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P]
13349 ? enumerable : true;
13350};
13351
13352var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
13353 var it = toIndexedObject(O);
13354 var key = toPropertyKey(P);
13355 if (it === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return;
13356 var descriptor = nativeGetOwnPropertyDescriptor(it, key);
13357 if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it, HIDDEN) && it[HIDDEN][key])) {
13358 descriptor.enumerable = true;
13359 }
13360 return descriptor;
13361};
13362
13363var $getOwnPropertyNames = function getOwnPropertyNames(O) {
13364 var names = nativeGetOwnPropertyNames(toIndexedObject(O));
13365 var result = [];
13366 $forEach(names, function (key) {
13367 if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key);
13368 });
13369 return result;
13370};
13371
13372var $getOwnPropertySymbols = function (O) {
13373 var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
13374 var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
13375 var result = [];
13376 $forEach(names, function (key) {
13377 if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) {
13378 push(result, AllSymbols[key]);
13379 }
13380 });
13381 return result;
13382};
13383
13384// `Symbol` constructor
13385// https://tc39.es/ecma262/#sec-symbol-constructor
13386if (!NATIVE_SYMBOL) {
13387 $Symbol = function Symbol() {
13388 if (isPrototypeOf(SymbolPrototype, this)) throw TypeError('Symbol is not a constructor');
13389 var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]);
13390 var tag = uid(description);
13391 var setter = function (value) {
13392 if (this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value);
13393 if (hasOwn(this, HIDDEN) && hasOwn(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
13394 setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
13395 };
13396 if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
13397 return wrap(tag, description);
13398 };
13399
13400 SymbolPrototype = $Symbol[PROTOTYPE];
13401
13402 defineBuiltIn(SymbolPrototype, 'toString', function toString() {
13403 return getInternalState(this).tag;
13404 });
13405
13406 defineBuiltIn($Symbol, 'withoutSetter', function (description) {
13407 return wrap(uid(description), description);
13408 });
13409
13410 propertyIsEnumerableModule.f = $propertyIsEnumerable;
13411 definePropertyModule.f = $defineProperty;
13412 definePropertiesModule.f = $defineProperties;
13413 getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;
13414 getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;
13415 getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;
13416
13417 wrappedWellKnownSymbolModule.f = function (name) {
13418 return wrap(wellKnownSymbol(name), name);
13419 };
13420
13421 if (DESCRIPTORS) {
13422 // https://github.com/tc39/proposal-Symbol-description
13423 nativeDefineProperty(SymbolPrototype, 'description', {
13424 configurable: true,
13425 get: function description() {
13426 return getInternalState(this).description;
13427 }
13428 });
13429 if (!IS_PURE) {
13430 defineBuiltIn(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
13431 }
13432 }
13433}
13434
13435$({ global: true, constructor: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {
13436 Symbol: $Symbol
13437});
13438
13439$forEach(objectKeys(WellKnownSymbolsStore), function (name) {
13440 defineWellKnownSymbol(name);
13441});
13442
13443$({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, {
13444 useSetter: function () { USE_SETTER = true; },
13445 useSimple: function () { USE_SETTER = false; }
13446});
13447
13448$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, {
13449 // `Object.create` method
13450 // https://tc39.es/ecma262/#sec-object.create
13451 create: $create,
13452 // `Object.defineProperty` method
13453 // https://tc39.es/ecma262/#sec-object.defineproperty
13454 defineProperty: $defineProperty,
13455 // `Object.defineProperties` method
13456 // https://tc39.es/ecma262/#sec-object.defineproperties
13457 defineProperties: $defineProperties,
13458 // `Object.getOwnPropertyDescriptor` method
13459 // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
13460 getOwnPropertyDescriptor: $getOwnPropertyDescriptor
13461});
13462
13463$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, {
13464 // `Object.getOwnPropertyNames` method
13465 // https://tc39.es/ecma262/#sec-object.getownpropertynames
13466 getOwnPropertyNames: $getOwnPropertyNames
13467});
13468
13469// `Symbol.prototype[@@toPrimitive]` method
13470// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
13471defineSymbolToPrimitive();
13472
13473// `Symbol.prototype[@@toStringTag]` property
13474// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
13475setToStringTag($Symbol, SYMBOL);
13476
13477hiddenKeys[HIDDEN] = true;
13478
13479
13480/***/ }),
13481/* 437 */
13482/***/ (function(module, exports, __webpack_require__) {
13483
13484var $ = __webpack_require__(0);
13485var getBuiltIn = __webpack_require__(20);
13486var hasOwn = __webpack_require__(13);
13487var toString = __webpack_require__(42);
13488var shared = __webpack_require__(82);
13489var NATIVE_SYMBOL_REGISTRY = __webpack_require__(247);
13490
13491var StringToSymbolRegistry = shared('string-to-symbol-registry');
13492var SymbolToStringRegistry = shared('symbol-to-string-registry');
13493
13494// `Symbol.for` method
13495// https://tc39.es/ecma262/#sec-symbol.for
13496$({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
13497 'for': function (key) {
13498 var string = toString(key);
13499 if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
13500 var symbol = getBuiltIn('Symbol')(string);
13501 StringToSymbolRegistry[string] = symbol;
13502 SymbolToStringRegistry[symbol] = string;
13503 return symbol;
13504 }
13505});
13506
13507
13508/***/ }),
13509/* 438 */
13510/***/ (function(module, exports, __webpack_require__) {
13511
13512var $ = __webpack_require__(0);
13513var hasOwn = __webpack_require__(13);
13514var isSymbol = __webpack_require__(100);
13515var tryToString = __webpack_require__(67);
13516var shared = __webpack_require__(82);
13517var NATIVE_SYMBOL_REGISTRY = __webpack_require__(247);
13518
13519var SymbolToStringRegistry = shared('symbol-to-string-registry');
13520
13521// `Symbol.keyFor` method
13522// https://tc39.es/ecma262/#sec-symbol.keyfor
13523$({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
13524 keyFor: function keyFor(sym) {
13525 if (!isSymbol(sym)) throw TypeError(tryToString(sym) + ' is not a symbol');
13526 if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
13527 }
13528});
13529
13530
13531/***/ }),
13532/* 439 */
13533/***/ (function(module, exports, __webpack_require__) {
13534
13535var $ = __webpack_require__(0);
13536var NATIVE_SYMBOL = __webpack_require__(65);
13537var fails = __webpack_require__(2);
13538var getOwnPropertySymbolsModule = __webpack_require__(106);
13539var toObject = __webpack_require__(33);
13540
13541// V8 ~ Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
13542// https://bugs.chromium.org/p/v8/issues/detail?id=3443
13543var FORCED = !NATIVE_SYMBOL || fails(function () { getOwnPropertySymbolsModule.f(1); });
13544
13545// `Object.getOwnPropertySymbols` method
13546// https://tc39.es/ecma262/#sec-object.getownpropertysymbols
13547$({ target: 'Object', stat: true, forced: FORCED }, {
13548 getOwnPropertySymbols: function getOwnPropertySymbols(it) {
13549 var $getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
13550 return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject(it)) : [];
13551 }
13552});
13553
13554
13555/***/ }),
13556/* 440 */
13557/***/ (function(module, exports, __webpack_require__) {
13558
13559var defineWellKnownSymbol = __webpack_require__(10);
13560
13561// `Symbol.asyncIterator` well-known symbol
13562// https://tc39.es/ecma262/#sec-symbol.asynciterator
13563defineWellKnownSymbol('asyncIterator');
13564
13565
13566/***/ }),
13567/* 441 */
13568/***/ (function(module, exports) {
13569
13570// empty
13571
13572
13573/***/ }),
13574/* 442 */
13575/***/ (function(module, exports, __webpack_require__) {
13576
13577var defineWellKnownSymbol = __webpack_require__(10);
13578
13579// `Symbol.hasInstance` well-known symbol
13580// https://tc39.es/ecma262/#sec-symbol.hasinstance
13581defineWellKnownSymbol('hasInstance');
13582
13583
13584/***/ }),
13585/* 443 */
13586/***/ (function(module, exports, __webpack_require__) {
13587
13588var defineWellKnownSymbol = __webpack_require__(10);
13589
13590// `Symbol.isConcatSpreadable` well-known symbol
13591// https://tc39.es/ecma262/#sec-symbol.isconcatspreadable
13592defineWellKnownSymbol('isConcatSpreadable');
13593
13594
13595/***/ }),
13596/* 444 */
13597/***/ (function(module, exports, __webpack_require__) {
13598
13599var defineWellKnownSymbol = __webpack_require__(10);
13600
13601// `Symbol.match` well-known symbol
13602// https://tc39.es/ecma262/#sec-symbol.match
13603defineWellKnownSymbol('match');
13604
13605
13606/***/ }),
13607/* 445 */
13608/***/ (function(module, exports, __webpack_require__) {
13609
13610var defineWellKnownSymbol = __webpack_require__(10);
13611
13612// `Symbol.matchAll` well-known symbol
13613// https://tc39.es/ecma262/#sec-symbol.matchall
13614defineWellKnownSymbol('matchAll');
13615
13616
13617/***/ }),
13618/* 446 */
13619/***/ (function(module, exports, __webpack_require__) {
13620
13621var defineWellKnownSymbol = __webpack_require__(10);
13622
13623// `Symbol.replace` well-known symbol
13624// https://tc39.es/ecma262/#sec-symbol.replace
13625defineWellKnownSymbol('replace');
13626
13627
13628/***/ }),
13629/* 447 */
13630/***/ (function(module, exports, __webpack_require__) {
13631
13632var defineWellKnownSymbol = __webpack_require__(10);
13633
13634// `Symbol.search` well-known symbol
13635// https://tc39.es/ecma262/#sec-symbol.search
13636defineWellKnownSymbol('search');
13637
13638
13639/***/ }),
13640/* 448 */
13641/***/ (function(module, exports, __webpack_require__) {
13642
13643var defineWellKnownSymbol = __webpack_require__(10);
13644
13645// `Symbol.species` well-known symbol
13646// https://tc39.es/ecma262/#sec-symbol.species
13647defineWellKnownSymbol('species');
13648
13649
13650/***/ }),
13651/* 449 */
13652/***/ (function(module, exports, __webpack_require__) {
13653
13654var defineWellKnownSymbol = __webpack_require__(10);
13655
13656// `Symbol.split` well-known symbol
13657// https://tc39.es/ecma262/#sec-symbol.split
13658defineWellKnownSymbol('split');
13659
13660
13661/***/ }),
13662/* 450 */
13663/***/ (function(module, exports, __webpack_require__) {
13664
13665var defineWellKnownSymbol = __webpack_require__(10);
13666var defineSymbolToPrimitive = __webpack_require__(246);
13667
13668// `Symbol.toPrimitive` well-known symbol
13669// https://tc39.es/ecma262/#sec-symbol.toprimitive
13670defineWellKnownSymbol('toPrimitive');
13671
13672// `Symbol.prototype[@@toPrimitive]` method
13673// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
13674defineSymbolToPrimitive();
13675
13676
13677/***/ }),
13678/* 451 */
13679/***/ (function(module, exports, __webpack_require__) {
13680
13681var getBuiltIn = __webpack_require__(20);
13682var defineWellKnownSymbol = __webpack_require__(10);
13683var setToStringTag = __webpack_require__(56);
13684
13685// `Symbol.toStringTag` well-known symbol
13686// https://tc39.es/ecma262/#sec-symbol.tostringtag
13687defineWellKnownSymbol('toStringTag');
13688
13689// `Symbol.prototype[@@toStringTag]` property
13690// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
13691setToStringTag(getBuiltIn('Symbol'), 'Symbol');
13692
13693
13694/***/ }),
13695/* 452 */
13696/***/ (function(module, exports, __webpack_require__) {
13697
13698var defineWellKnownSymbol = __webpack_require__(10);
13699
13700// `Symbol.unscopables` well-known symbol
13701// https://tc39.es/ecma262/#sec-symbol.unscopables
13702defineWellKnownSymbol('unscopables');
13703
13704
13705/***/ }),
13706/* 453 */
13707/***/ (function(module, exports, __webpack_require__) {
13708
13709var global = __webpack_require__(8);
13710var setToStringTag = __webpack_require__(56);
13711
13712// JSON[@@toStringTag] property
13713// https://tc39.es/ecma262/#sec-json-@@tostringtag
13714setToStringTag(global.JSON, 'JSON', true);
13715
13716
13717/***/ }),
13718/* 454 */
13719/***/ (function(module, exports) {
13720
13721// empty
13722
13723
13724/***/ }),
13725/* 455 */
13726/***/ (function(module, exports) {
13727
13728// empty
13729
13730
13731/***/ }),
13732/* 456 */
13733/***/ (function(module, exports, __webpack_require__) {
13734
13735var defineWellKnownSymbol = __webpack_require__(10);
13736
13737// `Symbol.asyncDispose` well-known symbol
13738// https://github.com/tc39/proposal-using-statement
13739defineWellKnownSymbol('asyncDispose');
13740
13741
13742/***/ }),
13743/* 457 */
13744/***/ (function(module, exports, __webpack_require__) {
13745
13746var defineWellKnownSymbol = __webpack_require__(10);
13747
13748// `Symbol.dispose` well-known symbol
13749// https://github.com/tc39/proposal-using-statement
13750defineWellKnownSymbol('dispose');
13751
13752
13753/***/ }),
13754/* 458 */
13755/***/ (function(module, exports, __webpack_require__) {
13756
13757var defineWellKnownSymbol = __webpack_require__(10);
13758
13759// `Symbol.matcher` well-known symbol
13760// https://github.com/tc39/proposal-pattern-matching
13761defineWellKnownSymbol('matcher');
13762
13763
13764/***/ }),
13765/* 459 */
13766/***/ (function(module, exports, __webpack_require__) {
13767
13768var defineWellKnownSymbol = __webpack_require__(10);
13769
13770// `Symbol.metadataKey` well-known symbol
13771// https://github.com/tc39/proposal-decorator-metadata
13772defineWellKnownSymbol('metadataKey');
13773
13774
13775/***/ }),
13776/* 460 */
13777/***/ (function(module, exports, __webpack_require__) {
13778
13779var defineWellKnownSymbol = __webpack_require__(10);
13780
13781// `Symbol.observable` well-known symbol
13782// https://github.com/tc39/proposal-observable
13783defineWellKnownSymbol('observable');
13784
13785
13786/***/ }),
13787/* 461 */
13788/***/ (function(module, exports, __webpack_require__) {
13789
13790// TODO: Remove from `core-js@4`
13791var defineWellKnownSymbol = __webpack_require__(10);
13792
13793// `Symbol.metadata` well-known symbol
13794// https://github.com/tc39/proposal-decorators
13795defineWellKnownSymbol('metadata');
13796
13797
13798/***/ }),
13799/* 462 */
13800/***/ (function(module, exports, __webpack_require__) {
13801
13802// TODO: remove from `core-js@4`
13803var defineWellKnownSymbol = __webpack_require__(10);
13804
13805// `Symbol.patternMatch` well-known symbol
13806// https://github.com/tc39/proposal-pattern-matching
13807defineWellKnownSymbol('patternMatch');
13808
13809
13810/***/ }),
13811/* 463 */
13812/***/ (function(module, exports, __webpack_require__) {
13813
13814// TODO: remove from `core-js@4`
13815var defineWellKnownSymbol = __webpack_require__(10);
13816
13817defineWellKnownSymbol('replaceAll');
13818
13819
13820/***/ }),
13821/* 464 */
13822/***/ (function(module, exports, __webpack_require__) {
13823
13824module.exports = __webpack_require__(465);
13825
13826/***/ }),
13827/* 465 */
13828/***/ (function(module, exports, __webpack_require__) {
13829
13830module.exports = __webpack_require__(466);
13831
13832
13833/***/ }),
13834/* 466 */
13835/***/ (function(module, exports, __webpack_require__) {
13836
13837var parent = __webpack_require__(467);
13838
13839module.exports = parent;
13840
13841
13842/***/ }),
13843/* 467 */
13844/***/ (function(module, exports, __webpack_require__) {
13845
13846var parent = __webpack_require__(249);
13847
13848module.exports = parent;
13849
13850
13851/***/ }),
13852/* 468 */
13853/***/ (function(module, exports, __webpack_require__) {
13854
13855__webpack_require__(43);
13856__webpack_require__(68);
13857__webpack_require__(70);
13858__webpack_require__(248);
13859var WrappedWellKnownSymbolModule = __webpack_require__(152);
13860
13861module.exports = WrappedWellKnownSymbolModule.f('iterator');
13862
13863
13864/***/ }),
13865/* 469 */
13866/***/ (function(module, exports, __webpack_require__) {
13867
13868var parent = __webpack_require__(470);
13869
13870module.exports = parent;
13871
13872
13873/***/ }),
13874/* 470 */
13875/***/ (function(module, exports, __webpack_require__) {
13876
13877var isPrototypeOf = __webpack_require__(16);
13878var method = __webpack_require__(471);
13879
13880var ArrayPrototype = Array.prototype;
13881
13882module.exports = function (it) {
13883 var own = it.filter;
13884 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.filter) ? method : own;
13885};
13886
13887
13888/***/ }),
13889/* 471 */
13890/***/ (function(module, exports, __webpack_require__) {
13891
13892__webpack_require__(472);
13893var entryVirtual = __webpack_require__(27);
13894
13895module.exports = entryVirtual('Array').filter;
13896
13897
13898/***/ }),
13899/* 472 */
13900/***/ (function(module, exports, __webpack_require__) {
13901
13902"use strict";
13903
13904var $ = __webpack_require__(0);
13905var $filter = __webpack_require__(75).filter;
13906var arrayMethodHasSpeciesSupport = __webpack_require__(116);
13907
13908var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
13909
13910// `Array.prototype.filter` method
13911// https://tc39.es/ecma262/#sec-array.prototype.filter
13912// with adding support of @@species
13913$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
13914 filter: function filter(callbackfn /* , thisArg */) {
13915 return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
13916 }
13917});
13918
13919
13920/***/ }),
13921/* 473 */
13922/***/ (function(module, exports, __webpack_require__) {
13923
13924"use strict";
13925
13926
13927var _interopRequireDefault = __webpack_require__(1);
13928
13929var _slice = _interopRequireDefault(__webpack_require__(34));
13930
13931var _keys = _interopRequireDefault(__webpack_require__(62));
13932
13933var _concat = _interopRequireDefault(__webpack_require__(19));
13934
13935var _ = __webpack_require__(3);
13936
13937module.exports = function (AV) {
13938 var eventSplitter = /\s+/;
13939 var slice = (0, _slice.default)(Array.prototype);
13940 /**
13941 * @class
13942 *
13943 * <p>AV.Events is a fork of Backbone's Events module, provided for your
13944 * convenience.</p>
13945 *
13946 * <p>A module that can be mixed in to any object in order to provide
13947 * it with custom events. You may bind callback functions to an event
13948 * with `on`, or remove these functions with `off`.
13949 * Triggering an event fires all callbacks in the order that `on` was
13950 * called.
13951 *
13952 * @private
13953 * @example
13954 * var object = {};
13955 * _.extend(object, AV.Events);
13956 * object.on('expand', function(){ alert('expanded'); });
13957 * object.trigger('expand');</pre></p>
13958 *
13959 */
13960
13961 AV.Events = {
13962 /**
13963 * Bind one or more space separated events, `events`, to a `callback`
13964 * function. Passing `"all"` will bind the callback to all events fired.
13965 */
13966 on: function on(events, callback, context) {
13967 var calls, event, node, tail, list;
13968
13969 if (!callback) {
13970 return this;
13971 }
13972
13973 events = events.split(eventSplitter);
13974 calls = this._callbacks || (this._callbacks = {}); // Create an immutable callback list, allowing traversal during
13975 // modification. The tail is an empty object that will always be used
13976 // as the next node.
13977
13978 event = events.shift();
13979
13980 while (event) {
13981 list = calls[event];
13982 node = list ? list.tail : {};
13983 node.next = tail = {};
13984 node.context = context;
13985 node.callback = callback;
13986 calls[event] = {
13987 tail: tail,
13988 next: list ? list.next : node
13989 };
13990 event = events.shift();
13991 }
13992
13993 return this;
13994 },
13995
13996 /**
13997 * Remove one or many callbacks. If `context` is null, removes all callbacks
13998 * with that function. If `callback` is null, removes all callbacks for the
13999 * event. If `events` is null, removes all bound callbacks for all events.
14000 */
14001 off: function off(events, callback, context) {
14002 var event, calls, node, tail, cb, ctx; // No events, or removing *all* events.
14003
14004 if (!(calls = this._callbacks)) {
14005 return;
14006 }
14007
14008 if (!(events || callback || context)) {
14009 delete this._callbacks;
14010 return this;
14011 } // Loop through the listed events and contexts, splicing them out of the
14012 // linked list of callbacks if appropriate.
14013
14014
14015 events = events ? events.split(eventSplitter) : (0, _keys.default)(_).call(_, calls);
14016 event = events.shift();
14017
14018 while (event) {
14019 node = calls[event];
14020 delete calls[event];
14021
14022 if (!node || !(callback || context)) {
14023 continue;
14024 } // Create a new list, omitting the indicated callbacks.
14025
14026
14027 tail = node.tail;
14028 node = node.next;
14029
14030 while (node !== tail) {
14031 cb = node.callback;
14032 ctx = node.context;
14033
14034 if (callback && cb !== callback || context && ctx !== context) {
14035 this.on(event, cb, ctx);
14036 }
14037
14038 node = node.next;
14039 }
14040
14041 event = events.shift();
14042 }
14043
14044 return this;
14045 },
14046
14047 /**
14048 * Trigger one or many events, firing all bound callbacks. Callbacks are
14049 * passed the same arguments as `trigger` is, apart from the event name
14050 * (unless you're listening on `"all"`, which will cause your callback to
14051 * receive the true name of the event as the first argument).
14052 */
14053 trigger: function trigger(events) {
14054 var event, node, calls, tail, args, all, rest;
14055
14056 if (!(calls = this._callbacks)) {
14057 return this;
14058 }
14059
14060 all = calls.all;
14061 events = events.split(eventSplitter);
14062 rest = slice.call(arguments, 1); // For each event, walk through the linked list of callbacks twice,
14063 // first to trigger the event, then to trigger any `"all"` callbacks.
14064
14065 event = events.shift();
14066
14067 while (event) {
14068 node = calls[event];
14069
14070 if (node) {
14071 tail = node.tail;
14072
14073 while ((node = node.next) !== tail) {
14074 node.callback.apply(node.context || this, rest);
14075 }
14076 }
14077
14078 node = all;
14079
14080 if (node) {
14081 var _context;
14082
14083 tail = node.tail;
14084 args = (0, _concat.default)(_context = [event]).call(_context, rest);
14085
14086 while ((node = node.next) !== tail) {
14087 node.callback.apply(node.context || this, args);
14088 }
14089 }
14090
14091 event = events.shift();
14092 }
14093
14094 return this;
14095 }
14096 };
14097 /**
14098 * @function
14099 */
14100
14101 AV.Events.bind = AV.Events.on;
14102 /**
14103 * @function
14104 */
14105
14106 AV.Events.unbind = AV.Events.off;
14107};
14108
14109/***/ }),
14110/* 474 */
14111/***/ (function(module, exports, __webpack_require__) {
14112
14113"use strict";
14114
14115
14116var _interopRequireDefault = __webpack_require__(1);
14117
14118var _promise = _interopRequireDefault(__webpack_require__(12));
14119
14120var _ = __webpack_require__(3);
14121/*global navigator: false */
14122
14123
14124module.exports = function (AV) {
14125 /**
14126 * Creates a new GeoPoint with any of the following forms:<br>
14127 * @example
14128 * new GeoPoint(otherGeoPoint)
14129 * new GeoPoint(30, 30)
14130 * new GeoPoint([30, 30])
14131 * new GeoPoint({latitude: 30, longitude: 30})
14132 * new GeoPoint() // defaults to (0, 0)
14133 * @class
14134 *
14135 * <p>Represents a latitude / longitude point that may be associated
14136 * with a key in a AVObject or used as a reference point for geo queries.
14137 * This allows proximity-based queries on the key.</p>
14138 *
14139 * <p>Only one key in a class may contain a GeoPoint.</p>
14140 *
14141 * <p>Example:<pre>
14142 * var point = new AV.GeoPoint(30.0, -20.0);
14143 * var object = new AV.Object("PlaceObject");
14144 * object.set("location", point);
14145 * object.save();</pre></p>
14146 */
14147 AV.GeoPoint = function (arg1, arg2) {
14148 if (_.isArray(arg1)) {
14149 AV.GeoPoint._validate(arg1[0], arg1[1]);
14150
14151 this.latitude = arg1[0];
14152 this.longitude = arg1[1];
14153 } else if (_.isObject(arg1)) {
14154 AV.GeoPoint._validate(arg1.latitude, arg1.longitude);
14155
14156 this.latitude = arg1.latitude;
14157 this.longitude = arg1.longitude;
14158 } else if (_.isNumber(arg1) && _.isNumber(arg2)) {
14159 AV.GeoPoint._validate(arg1, arg2);
14160
14161 this.latitude = arg1;
14162 this.longitude = arg2;
14163 } else {
14164 this.latitude = 0;
14165 this.longitude = 0;
14166 } // Add properties so that anyone using Webkit or Mozilla will get an error
14167 // if they try to set values that are out of bounds.
14168
14169
14170 var self = this;
14171
14172 if (this.__defineGetter__ && this.__defineSetter__) {
14173 // Use _latitude and _longitude to actually store the values, and add
14174 // getters and setters for latitude and longitude.
14175 this._latitude = this.latitude;
14176 this._longitude = this.longitude;
14177
14178 this.__defineGetter__('latitude', function () {
14179 return self._latitude;
14180 });
14181
14182 this.__defineGetter__('longitude', function () {
14183 return self._longitude;
14184 });
14185
14186 this.__defineSetter__('latitude', function (val) {
14187 AV.GeoPoint._validate(val, self.longitude);
14188
14189 self._latitude = val;
14190 });
14191
14192 this.__defineSetter__('longitude', function (val) {
14193 AV.GeoPoint._validate(self.latitude, val);
14194
14195 self._longitude = val;
14196 });
14197 }
14198 };
14199 /**
14200 * @lends AV.GeoPoint.prototype
14201 * @property {float} latitude North-south portion of the coordinate, in range
14202 * [-90, 90]. Throws an exception if set out of range in a modern browser.
14203 * @property {float} longitude East-west portion of the coordinate, in range
14204 * [-180, 180]. Throws if set out of range in a modern browser.
14205 */
14206
14207 /**
14208 * Throws an exception if the given lat-long is out of bounds.
14209 * @private
14210 */
14211
14212
14213 AV.GeoPoint._validate = function (latitude, longitude) {
14214 if (latitude < -90.0) {
14215 throw new Error('AV.GeoPoint latitude ' + latitude + ' < -90.0.');
14216 }
14217
14218 if (latitude > 90.0) {
14219 throw new Error('AV.GeoPoint latitude ' + latitude + ' > 90.0.');
14220 }
14221
14222 if (longitude < -180.0) {
14223 throw new Error('AV.GeoPoint longitude ' + longitude + ' < -180.0.');
14224 }
14225
14226 if (longitude > 180.0) {
14227 throw new Error('AV.GeoPoint longitude ' + longitude + ' > 180.0.');
14228 }
14229 };
14230 /**
14231 * Creates a GeoPoint with the user's current location, if available.
14232 * @return {Promise.<AV.GeoPoint>}
14233 */
14234
14235
14236 AV.GeoPoint.current = function () {
14237 return new _promise.default(function (resolve, reject) {
14238 navigator.geolocation.getCurrentPosition(function (location) {
14239 resolve(new AV.GeoPoint({
14240 latitude: location.coords.latitude,
14241 longitude: location.coords.longitude
14242 }));
14243 }, reject);
14244 });
14245 };
14246
14247 _.extend(AV.GeoPoint.prototype,
14248 /** @lends AV.GeoPoint.prototype */
14249 {
14250 /**
14251 * Returns a JSON representation of the GeoPoint, suitable for AV.
14252 * @return {Object}
14253 */
14254 toJSON: function toJSON() {
14255 AV.GeoPoint._validate(this.latitude, this.longitude);
14256
14257 return {
14258 __type: 'GeoPoint',
14259 latitude: this.latitude,
14260 longitude: this.longitude
14261 };
14262 },
14263
14264 /**
14265 * Returns the distance from this GeoPoint to another in radians.
14266 * @param {AV.GeoPoint} point the other AV.GeoPoint.
14267 * @return {Number}
14268 */
14269 radiansTo: function radiansTo(point) {
14270 var d2r = Math.PI / 180.0;
14271 var lat1rad = this.latitude * d2r;
14272 var long1rad = this.longitude * d2r;
14273 var lat2rad = point.latitude * d2r;
14274 var long2rad = point.longitude * d2r;
14275 var deltaLat = lat1rad - lat2rad;
14276 var deltaLong = long1rad - long2rad;
14277 var sinDeltaLatDiv2 = Math.sin(deltaLat / 2);
14278 var sinDeltaLongDiv2 = Math.sin(deltaLong / 2); // Square of half the straight line chord distance between both points.
14279
14280 var a = sinDeltaLatDiv2 * sinDeltaLatDiv2 + Math.cos(lat1rad) * Math.cos(lat2rad) * sinDeltaLongDiv2 * sinDeltaLongDiv2;
14281 a = Math.min(1.0, a);
14282 return 2 * Math.asin(Math.sqrt(a));
14283 },
14284
14285 /**
14286 * Returns the distance from this GeoPoint to another in kilometers.
14287 * @param {AV.GeoPoint} point the other AV.GeoPoint.
14288 * @return {Number}
14289 */
14290 kilometersTo: function kilometersTo(point) {
14291 return this.radiansTo(point) * 6371.0;
14292 },
14293
14294 /**
14295 * Returns the distance from this GeoPoint to another in miles.
14296 * @param {AV.GeoPoint} point the other AV.GeoPoint.
14297 * @return {Number}
14298 */
14299 milesTo: function milesTo(point) {
14300 return this.radiansTo(point) * 3958.8;
14301 }
14302 });
14303};
14304
14305/***/ }),
14306/* 475 */
14307/***/ (function(module, exports, __webpack_require__) {
14308
14309"use strict";
14310
14311
14312var _ = __webpack_require__(3);
14313
14314module.exports = function (AV) {
14315 var PUBLIC_KEY = '*';
14316 /**
14317 * Creates a new ACL.
14318 * If no argument is given, the ACL has no permissions for anyone.
14319 * If the argument is a AV.User, the ACL will have read and write
14320 * permission for only that user.
14321 * If the argument is any other JSON object, that object will be interpretted
14322 * as a serialized ACL created with toJSON().
14323 * @see AV.Object#setACL
14324 * @class
14325 *
14326 * <p>An ACL, or Access Control List can be added to any
14327 * <code>AV.Object</code> to restrict access to only a subset of users
14328 * of your application.</p>
14329 */
14330
14331 AV.ACL = function (arg1) {
14332 var self = this;
14333 self.permissionsById = {};
14334
14335 if (_.isObject(arg1)) {
14336 if (arg1 instanceof AV.User) {
14337 self.setReadAccess(arg1, true);
14338 self.setWriteAccess(arg1, true);
14339 } else {
14340 if (_.isFunction(arg1)) {
14341 throw new Error('AV.ACL() called with a function. Did you forget ()?');
14342 }
14343
14344 AV._objectEach(arg1, function (accessList, userId) {
14345 if (!_.isString(userId)) {
14346 throw new Error('Tried to create an ACL with an invalid userId.');
14347 }
14348
14349 self.permissionsById[userId] = {};
14350
14351 AV._objectEach(accessList, function (allowed, permission) {
14352 if (permission !== 'read' && permission !== 'write') {
14353 throw new Error('Tried to create an ACL with an invalid permission type.');
14354 }
14355
14356 if (!_.isBoolean(allowed)) {
14357 throw new Error('Tried to create an ACL with an invalid permission value.');
14358 }
14359
14360 self.permissionsById[userId][permission] = allowed;
14361 });
14362 });
14363 }
14364 }
14365 };
14366 /**
14367 * Returns a JSON-encoded version of the ACL.
14368 * @return {Object}
14369 */
14370
14371
14372 AV.ACL.prototype.toJSON = function () {
14373 return _.clone(this.permissionsById);
14374 };
14375
14376 AV.ACL.prototype._setAccess = function (accessType, userId, allowed) {
14377 if (userId instanceof AV.User) {
14378 userId = userId.id;
14379 } else if (userId instanceof AV.Role) {
14380 userId = 'role:' + userId.getName();
14381 }
14382
14383 if (!_.isString(userId)) {
14384 throw new Error('userId must be a string.');
14385 }
14386
14387 if (!_.isBoolean(allowed)) {
14388 throw new Error('allowed must be either true or false.');
14389 }
14390
14391 var permissions = this.permissionsById[userId];
14392
14393 if (!permissions) {
14394 if (!allowed) {
14395 // The user already doesn't have this permission, so no action needed.
14396 return;
14397 } else {
14398 permissions = {};
14399 this.permissionsById[userId] = permissions;
14400 }
14401 }
14402
14403 if (allowed) {
14404 this.permissionsById[userId][accessType] = true;
14405 } else {
14406 delete permissions[accessType];
14407
14408 if (_.isEmpty(permissions)) {
14409 delete this.permissionsById[userId];
14410 }
14411 }
14412 };
14413
14414 AV.ACL.prototype._getAccess = function (accessType, userId) {
14415 if (userId instanceof AV.User) {
14416 userId = userId.id;
14417 } else if (userId instanceof AV.Role) {
14418 userId = 'role:' + userId.getName();
14419 }
14420
14421 var permissions = this.permissionsById[userId];
14422
14423 if (!permissions) {
14424 return false;
14425 }
14426
14427 return permissions[accessType] ? true : false;
14428 };
14429 /**
14430 * Set whether the given user is allowed to read this object.
14431 * @param userId An instance of AV.User or its objectId.
14432 * @param {Boolean} allowed Whether that user should have read access.
14433 */
14434
14435
14436 AV.ACL.prototype.setReadAccess = function (userId, allowed) {
14437 this._setAccess('read', userId, allowed);
14438 };
14439 /**
14440 * Get whether the given user id is *explicitly* allowed to read this object.
14441 * Even if this returns false, the user may still be able to access it if
14442 * getPublicReadAccess returns true or a role that the user belongs to has
14443 * write access.
14444 * @param userId An instance of AV.User or its objectId, or a AV.Role.
14445 * @return {Boolean}
14446 */
14447
14448
14449 AV.ACL.prototype.getReadAccess = function (userId) {
14450 return this._getAccess('read', userId);
14451 };
14452 /**
14453 * Set whether the given user id is allowed to write this object.
14454 * @param userId An instance of AV.User or its objectId, or a AV.Role..
14455 * @param {Boolean} allowed Whether that user should have write access.
14456 */
14457
14458
14459 AV.ACL.prototype.setWriteAccess = function (userId, allowed) {
14460 this._setAccess('write', userId, allowed);
14461 };
14462 /**
14463 * Get whether the given user id is *explicitly* allowed to write this object.
14464 * Even if this returns false, the user may still be able to write it if
14465 * getPublicWriteAccess returns true or a role that the user belongs to has
14466 * write access.
14467 * @param userId An instance of AV.User or its objectId, or a AV.Role.
14468 * @return {Boolean}
14469 */
14470
14471
14472 AV.ACL.prototype.getWriteAccess = function (userId) {
14473 return this._getAccess('write', userId);
14474 };
14475 /**
14476 * Set whether the public is allowed to read this object.
14477 * @param {Boolean} allowed
14478 */
14479
14480
14481 AV.ACL.prototype.setPublicReadAccess = function (allowed) {
14482 this.setReadAccess(PUBLIC_KEY, allowed);
14483 };
14484 /**
14485 * Get whether the public is allowed to read this object.
14486 * @return {Boolean}
14487 */
14488
14489
14490 AV.ACL.prototype.getPublicReadAccess = function () {
14491 return this.getReadAccess(PUBLIC_KEY);
14492 };
14493 /**
14494 * Set whether the public is allowed to write this object.
14495 * @param {Boolean} allowed
14496 */
14497
14498
14499 AV.ACL.prototype.setPublicWriteAccess = function (allowed) {
14500 this.setWriteAccess(PUBLIC_KEY, allowed);
14501 };
14502 /**
14503 * Get whether the public is allowed to write this object.
14504 * @return {Boolean}
14505 */
14506
14507
14508 AV.ACL.prototype.getPublicWriteAccess = function () {
14509 return this.getWriteAccess(PUBLIC_KEY);
14510 };
14511 /**
14512 * Get whether users belonging to the given role are allowed
14513 * to read this object. Even if this returns false, the role may
14514 * still be able to write it if a parent role has read access.
14515 *
14516 * @param role The name of the role, or a AV.Role object.
14517 * @return {Boolean} true if the role has read access. false otherwise.
14518 * @throws {String} If role is neither a AV.Role nor a String.
14519 */
14520
14521
14522 AV.ACL.prototype.getRoleReadAccess = function (role) {
14523 if (role instanceof AV.Role) {
14524 // Normalize to the String name
14525 role = role.getName();
14526 }
14527
14528 if (_.isString(role)) {
14529 return this.getReadAccess('role:' + role);
14530 }
14531
14532 throw new Error('role must be a AV.Role or a String');
14533 };
14534 /**
14535 * Get whether users belonging to the given role are allowed
14536 * to write this object. Even if this returns false, the role may
14537 * still be able to write it if a parent role has write access.
14538 *
14539 * @param role The name of the role, or a AV.Role object.
14540 * @return {Boolean} true if the role has write access. false otherwise.
14541 * @throws {String} If role is neither a AV.Role nor a String.
14542 */
14543
14544
14545 AV.ACL.prototype.getRoleWriteAccess = function (role) {
14546 if (role instanceof AV.Role) {
14547 // Normalize to the String name
14548 role = role.getName();
14549 }
14550
14551 if (_.isString(role)) {
14552 return this.getWriteAccess('role:' + role);
14553 }
14554
14555 throw new Error('role must be a AV.Role or a String');
14556 };
14557 /**
14558 * Set whether users belonging to the given role are allowed
14559 * to read this object.
14560 *
14561 * @param role The name of the role, or a AV.Role object.
14562 * @param {Boolean} allowed Whether the given role can read this object.
14563 * @throws {String} If role is neither a AV.Role nor a String.
14564 */
14565
14566
14567 AV.ACL.prototype.setRoleReadAccess = function (role, allowed) {
14568 if (role instanceof AV.Role) {
14569 // Normalize to the String name
14570 role = role.getName();
14571 }
14572
14573 if (_.isString(role)) {
14574 this.setReadAccess('role:' + role, allowed);
14575 return;
14576 }
14577
14578 throw new Error('role must be a AV.Role or a String');
14579 };
14580 /**
14581 * Set whether users belonging to the given role are allowed
14582 * to write this object.
14583 *
14584 * @param role The name of the role, or a AV.Role object.
14585 * @param {Boolean} allowed Whether the given role can write this object.
14586 * @throws {String} If role is neither a AV.Role nor a String.
14587 */
14588
14589
14590 AV.ACL.prototype.setRoleWriteAccess = function (role, allowed) {
14591 if (role instanceof AV.Role) {
14592 // Normalize to the String name
14593 role = role.getName();
14594 }
14595
14596 if (_.isString(role)) {
14597 this.setWriteAccess('role:' + role, allowed);
14598 return;
14599 }
14600
14601 throw new Error('role must be a AV.Role or a String');
14602 };
14603};
14604
14605/***/ }),
14606/* 476 */
14607/***/ (function(module, exports, __webpack_require__) {
14608
14609"use strict";
14610
14611
14612var _interopRequireDefault = __webpack_require__(1);
14613
14614var _concat = _interopRequireDefault(__webpack_require__(19));
14615
14616var _find = _interopRequireDefault(__webpack_require__(96));
14617
14618var _indexOf = _interopRequireDefault(__webpack_require__(61));
14619
14620var _map = _interopRequireDefault(__webpack_require__(37));
14621
14622var _ = __webpack_require__(3);
14623
14624module.exports = function (AV) {
14625 /**
14626 * @private
14627 * @class
14628 * A AV.Op is an atomic operation that can be applied to a field in a
14629 * AV.Object. For example, calling <code>object.set("foo", "bar")</code>
14630 * is an example of a AV.Op.Set. Calling <code>object.unset("foo")</code>
14631 * is a AV.Op.Unset. These operations are stored in a AV.Object and
14632 * sent to the server as part of <code>object.save()</code> operations.
14633 * Instances of AV.Op should be immutable.
14634 *
14635 * You should not create subclasses of AV.Op or instantiate AV.Op
14636 * directly.
14637 */
14638 AV.Op = function () {
14639 this._initialize.apply(this, arguments);
14640 };
14641
14642 _.extend(AV.Op.prototype,
14643 /** @lends AV.Op.prototype */
14644 {
14645 _initialize: function _initialize() {}
14646 });
14647
14648 _.extend(AV.Op, {
14649 /**
14650 * To create a new Op, call AV.Op._extend();
14651 * @private
14652 */
14653 _extend: AV._extend,
14654 // A map of __op string to decoder function.
14655 _opDecoderMap: {},
14656
14657 /**
14658 * Registers a function to convert a json object with an __op field into an
14659 * instance of a subclass of AV.Op.
14660 * @private
14661 */
14662 _registerDecoder: function _registerDecoder(opName, decoder) {
14663 AV.Op._opDecoderMap[opName] = decoder;
14664 },
14665
14666 /**
14667 * Converts a json object into an instance of a subclass of AV.Op.
14668 * @private
14669 */
14670 _decode: function _decode(json) {
14671 var decoder = AV.Op._opDecoderMap[json.__op];
14672
14673 if (decoder) {
14674 return decoder(json);
14675 } else {
14676 return undefined;
14677 }
14678 }
14679 });
14680 /*
14681 * Add a handler for Batch ops.
14682 */
14683
14684
14685 AV.Op._registerDecoder('Batch', function (json) {
14686 var op = null;
14687
14688 AV._arrayEach(json.ops, function (nextOp) {
14689 nextOp = AV.Op._decode(nextOp);
14690 op = nextOp._mergeWithPrevious(op);
14691 });
14692
14693 return op;
14694 });
14695 /**
14696 * @private
14697 * @class
14698 * A Set operation indicates that either the field was changed using
14699 * AV.Object.set, or it is a mutable container that was detected as being
14700 * changed.
14701 */
14702
14703
14704 AV.Op.Set = AV.Op._extend(
14705 /** @lends AV.Op.Set.prototype */
14706 {
14707 _initialize: function _initialize(value) {
14708 this._value = value;
14709 },
14710
14711 /**
14712 * Returns the new value of this field after the set.
14713 */
14714 value: function value() {
14715 return this._value;
14716 },
14717
14718 /**
14719 * Returns a JSON version of the operation suitable for sending to AV.
14720 * @return {Object}
14721 */
14722 toJSON: function toJSON() {
14723 return AV._encode(this.value());
14724 },
14725 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14726 return this;
14727 },
14728 _estimate: function _estimate(oldValue) {
14729 return this.value();
14730 }
14731 });
14732 /**
14733 * A sentinel value that is returned by AV.Op.Unset._estimate to
14734 * indicate the field should be deleted. Basically, if you find _UNSET as a
14735 * value in your object, you should remove that key.
14736 */
14737
14738 AV.Op._UNSET = {};
14739 /**
14740 * @private
14741 * @class
14742 * An Unset operation indicates that this field has been deleted from the
14743 * object.
14744 */
14745
14746 AV.Op.Unset = AV.Op._extend(
14747 /** @lends AV.Op.Unset.prototype */
14748 {
14749 /**
14750 * Returns a JSON version of the operation suitable for sending to AV.
14751 * @return {Object}
14752 */
14753 toJSON: function toJSON() {
14754 return {
14755 __op: 'Delete'
14756 };
14757 },
14758 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14759 return this;
14760 },
14761 _estimate: function _estimate(oldValue) {
14762 return AV.Op._UNSET;
14763 }
14764 });
14765
14766 AV.Op._registerDecoder('Delete', function (json) {
14767 return new AV.Op.Unset();
14768 });
14769 /**
14770 * @private
14771 * @class
14772 * An Increment is an atomic operation where the numeric value for the field
14773 * will be increased by a given amount.
14774 */
14775
14776
14777 AV.Op.Increment = AV.Op._extend(
14778 /** @lends AV.Op.Increment.prototype */
14779 {
14780 _initialize: function _initialize(amount) {
14781 this._amount = amount;
14782 },
14783
14784 /**
14785 * Returns the amount to increment by.
14786 * @return {Number} the amount to increment by.
14787 */
14788 amount: function amount() {
14789 return this._amount;
14790 },
14791
14792 /**
14793 * Returns a JSON version of the operation suitable for sending to AV.
14794 * @return {Object}
14795 */
14796 toJSON: function toJSON() {
14797 return {
14798 __op: 'Increment',
14799 amount: this._amount
14800 };
14801 },
14802 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14803 if (!previous) {
14804 return this;
14805 } else if (previous instanceof AV.Op.Unset) {
14806 return new AV.Op.Set(this.amount());
14807 } else if (previous instanceof AV.Op.Set) {
14808 return new AV.Op.Set(previous.value() + this.amount());
14809 } else if (previous instanceof AV.Op.Increment) {
14810 return new AV.Op.Increment(this.amount() + previous.amount());
14811 } else {
14812 throw new Error('Op is invalid after previous op.');
14813 }
14814 },
14815 _estimate: function _estimate(oldValue) {
14816 if (!oldValue) {
14817 return this.amount();
14818 }
14819
14820 return oldValue + this.amount();
14821 }
14822 });
14823
14824 AV.Op._registerDecoder('Increment', function (json) {
14825 return new AV.Op.Increment(json.amount);
14826 });
14827 /**
14828 * @private
14829 * @class
14830 * BitAnd is an atomic operation where the given value will be bit and to the
14831 * value than is stored in this field.
14832 */
14833
14834
14835 AV.Op.BitAnd = AV.Op._extend(
14836 /** @lends AV.Op.BitAnd.prototype */
14837 {
14838 _initialize: function _initialize(value) {
14839 this._value = value;
14840 },
14841 value: function value() {
14842 return this._value;
14843 },
14844
14845 /**
14846 * Returns a JSON version of the operation suitable for sending to AV.
14847 * @return {Object}
14848 */
14849 toJSON: function toJSON() {
14850 return {
14851 __op: 'BitAnd',
14852 value: this.value()
14853 };
14854 },
14855 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14856 if (!previous) {
14857 return this;
14858 } else if (previous instanceof AV.Op.Unset) {
14859 return new AV.Op.Set(0);
14860 } else if (previous instanceof AV.Op.Set) {
14861 return new AV.Op.Set(previous.value() & this.value());
14862 } else {
14863 throw new Error('Op is invalid after previous op.');
14864 }
14865 },
14866 _estimate: function _estimate(oldValue) {
14867 return oldValue & this.value();
14868 }
14869 });
14870
14871 AV.Op._registerDecoder('BitAnd', function (json) {
14872 return new AV.Op.BitAnd(json.value);
14873 });
14874 /**
14875 * @private
14876 * @class
14877 * BitOr is an atomic operation where the given value will be bit and to the
14878 * value than is stored in this field.
14879 */
14880
14881
14882 AV.Op.BitOr = AV.Op._extend(
14883 /** @lends AV.Op.BitOr.prototype */
14884 {
14885 _initialize: function _initialize(value) {
14886 this._value = value;
14887 },
14888 value: function value() {
14889 return this._value;
14890 },
14891
14892 /**
14893 * Returns a JSON version of the operation suitable for sending to AV.
14894 * @return {Object}
14895 */
14896 toJSON: function toJSON() {
14897 return {
14898 __op: 'BitOr',
14899 value: this.value()
14900 };
14901 },
14902 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14903 if (!previous) {
14904 return this;
14905 } else if (previous instanceof AV.Op.Unset) {
14906 return new AV.Op.Set(this.value());
14907 } else if (previous instanceof AV.Op.Set) {
14908 return new AV.Op.Set(previous.value() | this.value());
14909 } else {
14910 throw new Error('Op is invalid after previous op.');
14911 }
14912 },
14913 _estimate: function _estimate(oldValue) {
14914 return oldValue | this.value();
14915 }
14916 });
14917
14918 AV.Op._registerDecoder('BitOr', function (json) {
14919 return new AV.Op.BitOr(json.value);
14920 });
14921 /**
14922 * @private
14923 * @class
14924 * BitXor is an atomic operation where the given value will be bit and to the
14925 * value than is stored in this field.
14926 */
14927
14928
14929 AV.Op.BitXor = AV.Op._extend(
14930 /** @lends AV.Op.BitXor.prototype */
14931 {
14932 _initialize: function _initialize(value) {
14933 this._value = value;
14934 },
14935 value: function value() {
14936 return this._value;
14937 },
14938
14939 /**
14940 * Returns a JSON version of the operation suitable for sending to AV.
14941 * @return {Object}
14942 */
14943 toJSON: function toJSON() {
14944 return {
14945 __op: 'BitXor',
14946 value: this.value()
14947 };
14948 },
14949 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14950 if (!previous) {
14951 return this;
14952 } else if (previous instanceof AV.Op.Unset) {
14953 return new AV.Op.Set(this.value());
14954 } else if (previous instanceof AV.Op.Set) {
14955 return new AV.Op.Set(previous.value() ^ this.value());
14956 } else {
14957 throw new Error('Op is invalid after previous op.');
14958 }
14959 },
14960 _estimate: function _estimate(oldValue) {
14961 return oldValue ^ this.value();
14962 }
14963 });
14964
14965 AV.Op._registerDecoder('BitXor', function (json) {
14966 return new AV.Op.BitXor(json.value);
14967 });
14968 /**
14969 * @private
14970 * @class
14971 * Add is an atomic operation where the given objects will be appended to the
14972 * array that is stored in this field.
14973 */
14974
14975
14976 AV.Op.Add = AV.Op._extend(
14977 /** @lends AV.Op.Add.prototype */
14978 {
14979 _initialize: function _initialize(objects) {
14980 this._objects = objects;
14981 },
14982
14983 /**
14984 * Returns the objects to be added to the array.
14985 * @return {Array} The objects to be added to the array.
14986 */
14987 objects: function objects() {
14988 return this._objects;
14989 },
14990
14991 /**
14992 * Returns a JSON version of the operation suitable for sending to AV.
14993 * @return {Object}
14994 */
14995 toJSON: function toJSON() {
14996 return {
14997 __op: 'Add',
14998 objects: AV._encode(this.objects())
14999 };
15000 },
15001 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15002 if (!previous) {
15003 return this;
15004 } else if (previous instanceof AV.Op.Unset) {
15005 return new AV.Op.Set(this.objects());
15006 } else if (previous instanceof AV.Op.Set) {
15007 return new AV.Op.Set(this._estimate(previous.value()));
15008 } else if (previous instanceof AV.Op.Add) {
15009 var _context;
15010
15011 return new AV.Op.Add((0, _concat.default)(_context = previous.objects()).call(_context, this.objects()));
15012 } else {
15013 throw new Error('Op is invalid after previous op.');
15014 }
15015 },
15016 _estimate: function _estimate(oldValue) {
15017 if (!oldValue) {
15018 return _.clone(this.objects());
15019 } else {
15020 return (0, _concat.default)(oldValue).call(oldValue, this.objects());
15021 }
15022 }
15023 });
15024
15025 AV.Op._registerDecoder('Add', function (json) {
15026 return new AV.Op.Add(AV._decode(json.objects));
15027 });
15028 /**
15029 * @private
15030 * @class
15031 * AddUnique is an atomic operation where the given items will be appended to
15032 * the array that is stored in this field only if they were not already
15033 * present in the array.
15034 */
15035
15036
15037 AV.Op.AddUnique = AV.Op._extend(
15038 /** @lends AV.Op.AddUnique.prototype */
15039 {
15040 _initialize: function _initialize(objects) {
15041 this._objects = _.uniq(objects);
15042 },
15043
15044 /**
15045 * Returns the objects to be added to the array.
15046 * @return {Array} The objects to be added to the array.
15047 */
15048 objects: function objects() {
15049 return this._objects;
15050 },
15051
15052 /**
15053 * Returns a JSON version of the operation suitable for sending to AV.
15054 * @return {Object}
15055 */
15056 toJSON: function toJSON() {
15057 return {
15058 __op: 'AddUnique',
15059 objects: AV._encode(this.objects())
15060 };
15061 },
15062 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15063 if (!previous) {
15064 return this;
15065 } else if (previous instanceof AV.Op.Unset) {
15066 return new AV.Op.Set(this.objects());
15067 } else if (previous instanceof AV.Op.Set) {
15068 return new AV.Op.Set(this._estimate(previous.value()));
15069 } else if (previous instanceof AV.Op.AddUnique) {
15070 return new AV.Op.AddUnique(this._estimate(previous.objects()));
15071 } else {
15072 throw new Error('Op is invalid after previous op.');
15073 }
15074 },
15075 _estimate: function _estimate(oldValue) {
15076 if (!oldValue) {
15077 return _.clone(this.objects());
15078 } else {
15079 // We can't just take the _.uniq(_.union(...)) of oldValue and
15080 // this.objects, because the uniqueness may not apply to oldValue
15081 // (especially if the oldValue was set via .set())
15082 var newValue = _.clone(oldValue);
15083
15084 AV._arrayEach(this.objects(), function (obj) {
15085 if (obj instanceof AV.Object && obj.id) {
15086 var matchingObj = (0, _find.default)(_).call(_, newValue, function (anObj) {
15087 return anObj instanceof AV.Object && anObj.id === obj.id;
15088 });
15089
15090 if (!matchingObj) {
15091 newValue.push(obj);
15092 } else {
15093 var index = (0, _indexOf.default)(_).call(_, newValue, matchingObj);
15094 newValue[index] = obj;
15095 }
15096 } else if (!_.contains(newValue, obj)) {
15097 newValue.push(obj);
15098 }
15099 });
15100
15101 return newValue;
15102 }
15103 }
15104 });
15105
15106 AV.Op._registerDecoder('AddUnique', function (json) {
15107 return new AV.Op.AddUnique(AV._decode(json.objects));
15108 });
15109 /**
15110 * @private
15111 * @class
15112 * Remove is an atomic operation where the given objects will be removed from
15113 * the array that is stored in this field.
15114 */
15115
15116
15117 AV.Op.Remove = AV.Op._extend(
15118 /** @lends AV.Op.Remove.prototype */
15119 {
15120 _initialize: function _initialize(objects) {
15121 this._objects = _.uniq(objects);
15122 },
15123
15124 /**
15125 * Returns the objects to be removed from the array.
15126 * @return {Array} The objects to be removed from the array.
15127 */
15128 objects: function objects() {
15129 return this._objects;
15130 },
15131
15132 /**
15133 * Returns a JSON version of the operation suitable for sending to AV.
15134 * @return {Object}
15135 */
15136 toJSON: function toJSON() {
15137 return {
15138 __op: 'Remove',
15139 objects: AV._encode(this.objects())
15140 };
15141 },
15142 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15143 if (!previous) {
15144 return this;
15145 } else if (previous instanceof AV.Op.Unset) {
15146 return previous;
15147 } else if (previous instanceof AV.Op.Set) {
15148 return new AV.Op.Set(this._estimate(previous.value()));
15149 } else if (previous instanceof AV.Op.Remove) {
15150 return new AV.Op.Remove(_.union(previous.objects(), this.objects()));
15151 } else {
15152 throw new Error('Op is invalid after previous op.');
15153 }
15154 },
15155 _estimate: function _estimate(oldValue) {
15156 if (!oldValue) {
15157 return [];
15158 } else {
15159 var newValue = _.difference(oldValue, this.objects()); // If there are saved AV Objects being removed, also remove them.
15160
15161
15162 AV._arrayEach(this.objects(), function (obj) {
15163 if (obj instanceof AV.Object && obj.id) {
15164 newValue = _.reject(newValue, function (other) {
15165 return other instanceof AV.Object && other.id === obj.id;
15166 });
15167 }
15168 });
15169
15170 return newValue;
15171 }
15172 }
15173 });
15174
15175 AV.Op._registerDecoder('Remove', function (json) {
15176 return new AV.Op.Remove(AV._decode(json.objects));
15177 });
15178 /**
15179 * @private
15180 * @class
15181 * A Relation operation indicates that the field is an instance of
15182 * AV.Relation, and objects are being added to, or removed from, that
15183 * relation.
15184 */
15185
15186
15187 AV.Op.Relation = AV.Op._extend(
15188 /** @lends AV.Op.Relation.prototype */
15189 {
15190 _initialize: function _initialize(adds, removes) {
15191 this._targetClassName = null;
15192 var self = this;
15193
15194 var pointerToId = function pointerToId(object) {
15195 if (object instanceof AV.Object) {
15196 if (!object.id) {
15197 throw new Error("You can't add an unsaved AV.Object to a relation.");
15198 }
15199
15200 if (!self._targetClassName) {
15201 self._targetClassName = object.className;
15202 }
15203
15204 if (self._targetClassName !== object.className) {
15205 throw new Error('Tried to create a AV.Relation with 2 different types: ' + self._targetClassName + ' and ' + object.className + '.');
15206 }
15207
15208 return object.id;
15209 }
15210
15211 return object;
15212 };
15213
15214 this.relationsToAdd = _.uniq((0, _map.default)(_).call(_, adds, pointerToId));
15215 this.relationsToRemove = _.uniq((0, _map.default)(_).call(_, removes, pointerToId));
15216 },
15217
15218 /**
15219 * Returns an array of unfetched AV.Object that are being added to the
15220 * relation.
15221 * @return {Array}
15222 */
15223 added: function added() {
15224 var self = this;
15225 return (0, _map.default)(_).call(_, this.relationsToAdd, function (objectId) {
15226 var object = AV.Object._create(self._targetClassName);
15227
15228 object.id = objectId;
15229 return object;
15230 });
15231 },
15232
15233 /**
15234 * Returns an array of unfetched AV.Object that are being removed from
15235 * the relation.
15236 * @return {Array}
15237 */
15238 removed: function removed() {
15239 var self = this;
15240 return (0, _map.default)(_).call(_, this.relationsToRemove, function (objectId) {
15241 var object = AV.Object._create(self._targetClassName);
15242
15243 object.id = objectId;
15244 return object;
15245 });
15246 },
15247
15248 /**
15249 * Returns a JSON version of the operation suitable for sending to AV.
15250 * @return {Object}
15251 */
15252 toJSON: function toJSON() {
15253 var adds = null;
15254 var removes = null;
15255 var self = this;
15256
15257 var idToPointer = function idToPointer(id) {
15258 return {
15259 __type: 'Pointer',
15260 className: self._targetClassName,
15261 objectId: id
15262 };
15263 };
15264
15265 var pointers = null;
15266
15267 if (this.relationsToAdd.length > 0) {
15268 pointers = (0, _map.default)(_).call(_, this.relationsToAdd, idToPointer);
15269 adds = {
15270 __op: 'AddRelation',
15271 objects: pointers
15272 };
15273 }
15274
15275 if (this.relationsToRemove.length > 0) {
15276 pointers = (0, _map.default)(_).call(_, this.relationsToRemove, idToPointer);
15277 removes = {
15278 __op: 'RemoveRelation',
15279 objects: pointers
15280 };
15281 }
15282
15283 if (adds && removes) {
15284 return {
15285 __op: 'Batch',
15286 ops: [adds, removes]
15287 };
15288 }
15289
15290 return adds || removes || {};
15291 },
15292 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15293 if (!previous) {
15294 return this;
15295 } else if (previous instanceof AV.Op.Unset) {
15296 throw new Error("You can't modify a relation after deleting it.");
15297 } else if (previous instanceof AV.Op.Relation) {
15298 if (previous._targetClassName && previous._targetClassName !== this._targetClassName) {
15299 throw new Error('Related object must be of class ' + previous._targetClassName + ', but ' + this._targetClassName + ' was passed in.');
15300 }
15301
15302 var newAdd = _.union(_.difference(previous.relationsToAdd, this.relationsToRemove), this.relationsToAdd);
15303
15304 var newRemove = _.union(_.difference(previous.relationsToRemove, this.relationsToAdd), this.relationsToRemove);
15305
15306 var newRelation = new AV.Op.Relation(newAdd, newRemove);
15307 newRelation._targetClassName = this._targetClassName;
15308 return newRelation;
15309 } else {
15310 throw new Error('Op is invalid after previous op.');
15311 }
15312 },
15313 _estimate: function _estimate(oldValue, object, key) {
15314 if (!oldValue) {
15315 var relation = new AV.Relation(object, key);
15316 relation.targetClassName = this._targetClassName;
15317 } else if (oldValue instanceof AV.Relation) {
15318 if (this._targetClassName) {
15319 if (oldValue.targetClassName) {
15320 if (oldValue.targetClassName !== this._targetClassName) {
15321 throw new Error('Related object must be a ' + oldValue.targetClassName + ', but a ' + this._targetClassName + ' was passed in.');
15322 }
15323 } else {
15324 oldValue.targetClassName = this._targetClassName;
15325 }
15326 }
15327
15328 return oldValue;
15329 } else {
15330 throw new Error('Op is invalid after previous op.');
15331 }
15332 }
15333 });
15334
15335 AV.Op._registerDecoder('AddRelation', function (json) {
15336 return new AV.Op.Relation(AV._decode(json.objects), []);
15337 });
15338
15339 AV.Op._registerDecoder('RemoveRelation', function (json) {
15340 return new AV.Op.Relation([], AV._decode(json.objects));
15341 });
15342};
15343
15344/***/ }),
15345/* 477 */
15346/***/ (function(module, exports, __webpack_require__) {
15347
15348var parent = __webpack_require__(478);
15349
15350module.exports = parent;
15351
15352
15353/***/ }),
15354/* 478 */
15355/***/ (function(module, exports, __webpack_require__) {
15356
15357var isPrototypeOf = __webpack_require__(16);
15358var method = __webpack_require__(479);
15359
15360var ArrayPrototype = Array.prototype;
15361
15362module.exports = function (it) {
15363 var own = it.find;
15364 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.find) ? method : own;
15365};
15366
15367
15368/***/ }),
15369/* 479 */
15370/***/ (function(module, exports, __webpack_require__) {
15371
15372__webpack_require__(480);
15373var entryVirtual = __webpack_require__(27);
15374
15375module.exports = entryVirtual('Array').find;
15376
15377
15378/***/ }),
15379/* 480 */
15380/***/ (function(module, exports, __webpack_require__) {
15381
15382"use strict";
15383
15384var $ = __webpack_require__(0);
15385var $find = __webpack_require__(75).find;
15386var addToUnscopables = __webpack_require__(132);
15387
15388var FIND = 'find';
15389var SKIPS_HOLES = true;
15390
15391// Shouldn't skip holes
15392if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
15393
15394// `Array.prototype.find` method
15395// https://tc39.es/ecma262/#sec-array.prototype.find
15396$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
15397 find: function find(callbackfn /* , that = undefined */) {
15398 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
15399 }
15400});
15401
15402// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
15403addToUnscopables(FIND);
15404
15405
15406/***/ }),
15407/* 481 */
15408/***/ (function(module, exports, __webpack_require__) {
15409
15410"use strict";
15411
15412
15413var _ = __webpack_require__(3);
15414
15415module.exports = function (AV) {
15416 /**
15417 * Creates a new Relation for the given parent object and key. This
15418 * constructor should rarely be used directly, but rather created by
15419 * {@link AV.Object#relation}.
15420 * @param {AV.Object} parent The parent of this relation.
15421 * @param {String} key The key for this relation on the parent.
15422 * @see AV.Object#relation
15423 * @class
15424 *
15425 * <p>
15426 * A class that is used to access all of the children of a many-to-many
15427 * relationship. Each instance of AV.Relation is associated with a
15428 * particular parent object and key.
15429 * </p>
15430 */
15431 AV.Relation = function (parent, key) {
15432 if (!_.isString(key)) {
15433 throw new TypeError('key must be a string');
15434 }
15435
15436 this.parent = parent;
15437 this.key = key;
15438 this.targetClassName = null;
15439 };
15440 /**
15441 * Creates a query that can be used to query the parent objects in this relation.
15442 * @param {String} parentClass The parent class or name.
15443 * @param {String} relationKey The relation field key in parent.
15444 * @param {AV.Object} child The child object.
15445 * @return {AV.Query}
15446 */
15447
15448
15449 AV.Relation.reverseQuery = function (parentClass, relationKey, child) {
15450 var query = new AV.Query(parentClass);
15451 query.equalTo(relationKey, child._toPointer());
15452 return query;
15453 };
15454
15455 _.extend(AV.Relation.prototype,
15456 /** @lends AV.Relation.prototype */
15457 {
15458 /**
15459 * Makes sure that this relation has the right parent and key.
15460 * @private
15461 */
15462 _ensureParentAndKey: function _ensureParentAndKey(parent, key) {
15463 this.parent = this.parent || parent;
15464 this.key = this.key || key;
15465
15466 if (this.parent !== parent) {
15467 throw new Error('Internal Error. Relation retrieved from two different Objects.');
15468 }
15469
15470 if (this.key !== key) {
15471 throw new Error('Internal Error. Relation retrieved from two different keys.');
15472 }
15473 },
15474
15475 /**
15476 * Adds a AV.Object or an array of AV.Objects to the relation.
15477 * @param {AV.Object|AV.Object[]} objects The item or items to add.
15478 */
15479 add: function add(objects) {
15480 if (!_.isArray(objects)) {
15481 objects = [objects];
15482 }
15483
15484 var change = new AV.Op.Relation(objects, []);
15485 this.parent.set(this.key, change);
15486 this.targetClassName = change._targetClassName;
15487 },
15488
15489 /**
15490 * Removes a AV.Object or an array of AV.Objects from this relation.
15491 * @param {AV.Object|AV.Object[]} objects The item or items to remove.
15492 */
15493 remove: function remove(objects) {
15494 if (!_.isArray(objects)) {
15495 objects = [objects];
15496 }
15497
15498 var change = new AV.Op.Relation([], objects);
15499 this.parent.set(this.key, change);
15500 this.targetClassName = change._targetClassName;
15501 },
15502
15503 /**
15504 * Returns a JSON version of the object suitable for saving to disk.
15505 * @return {Object}
15506 */
15507 toJSON: function toJSON() {
15508 return {
15509 __type: 'Relation',
15510 className: this.targetClassName
15511 };
15512 },
15513
15514 /**
15515 * Returns a AV.Query that is limited to objects in this
15516 * relation.
15517 * @return {AV.Query}
15518 */
15519 query: function query() {
15520 var targetClass;
15521 var query;
15522
15523 if (!this.targetClassName) {
15524 targetClass = AV.Object._getSubclass(this.parent.className);
15525 query = new AV.Query(targetClass);
15526 query._defaultParams.redirectClassNameForKey = this.key;
15527 } else {
15528 targetClass = AV.Object._getSubclass(this.targetClassName);
15529 query = new AV.Query(targetClass);
15530 }
15531
15532 query._addCondition('$relatedTo', 'object', this.parent._toPointer());
15533
15534 query._addCondition('$relatedTo', 'key', this.key);
15535
15536 return query;
15537 }
15538 });
15539};
15540
15541/***/ }),
15542/* 482 */
15543/***/ (function(module, exports, __webpack_require__) {
15544
15545"use strict";
15546
15547
15548var _interopRequireDefault = __webpack_require__(1);
15549
15550var _promise = _interopRequireDefault(__webpack_require__(12));
15551
15552var _ = __webpack_require__(3);
15553
15554var cos = __webpack_require__(483);
15555
15556var qiniu = __webpack_require__(484);
15557
15558var s3 = __webpack_require__(530);
15559
15560var AVError = __webpack_require__(48);
15561
15562var _require = __webpack_require__(28),
15563 request = _require.request,
15564 AVRequest = _require._request;
15565
15566var _require2 = __webpack_require__(32),
15567 tap = _require2.tap,
15568 transformFetchOptions = _require2.transformFetchOptions;
15569
15570var debug = __webpack_require__(63)('leancloud:file');
15571
15572var parseBase64 = __webpack_require__(534);
15573
15574module.exports = function (AV) {
15575 // port from browserify path module
15576 // since react-native packager won't shim node modules.
15577 var extname = function extname(path) {
15578 if (!_.isString(path)) return '';
15579 return path.match(/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/)[4];
15580 };
15581
15582 var b64Digit = function b64Digit(number) {
15583 if (number < 26) {
15584 return String.fromCharCode(65 + number);
15585 }
15586
15587 if (number < 52) {
15588 return String.fromCharCode(97 + (number - 26));
15589 }
15590
15591 if (number < 62) {
15592 return String.fromCharCode(48 + (number - 52));
15593 }
15594
15595 if (number === 62) {
15596 return '+';
15597 }
15598
15599 if (number === 63) {
15600 return '/';
15601 }
15602
15603 throw new Error('Tried to encode large digit ' + number + ' in base64.');
15604 };
15605
15606 var encodeBase64 = function encodeBase64(array) {
15607 var chunks = [];
15608 chunks.length = Math.ceil(array.length / 3);
15609
15610 _.times(chunks.length, function (i) {
15611 var b1 = array[i * 3];
15612 var b2 = array[i * 3 + 1] || 0;
15613 var b3 = array[i * 3 + 2] || 0;
15614 var has2 = i * 3 + 1 < array.length;
15615 var has3 = i * 3 + 2 < array.length;
15616 chunks[i] = [b64Digit(b1 >> 2 & 0x3f), b64Digit(b1 << 4 & 0x30 | b2 >> 4 & 0x0f), has2 ? b64Digit(b2 << 2 & 0x3c | b3 >> 6 & 0x03) : '=', has3 ? b64Digit(b3 & 0x3f) : '='].join('');
15617 });
15618
15619 return chunks.join('');
15620 };
15621 /**
15622 * An AV.File is a local representation of a file that is saved to the AV
15623 * cloud.
15624 * @param name {String} The file's name. This will change to a unique value
15625 * once the file has finished saving.
15626 * @param data {Array} The data for the file, as either:
15627 * 1. an Array of byte value Numbers, or
15628 * 2. an Object like { base64: "..." } with a base64-encoded String.
15629 * 3. a Blob(File) selected with a file upload control in a browser.
15630 * 4. an Object like { blob: {uri: "..."} } that mimics Blob
15631 * in some non-browser environments such as React Native.
15632 * 5. a Buffer in Node.js runtime.
15633 * 6. a Stream in Node.js runtime.
15634 *
15635 * For example:<pre>
15636 * var fileUploadControl = $("#profilePhotoFileUpload")[0];
15637 * if (fileUploadControl.files.length > 0) {
15638 * var file = fileUploadControl.files[0];
15639 * var name = "photo.jpg";
15640 * var file = new AV.File(name, file);
15641 * file.save().then(function() {
15642 * // The file has been saved to AV.
15643 * }, function(error) {
15644 * // The file either could not be read, or could not be saved to AV.
15645 * });
15646 * }</pre>
15647 *
15648 * @class
15649 * @param [mimeType] {String} Content-Type header to use for the file. If
15650 * this is omitted, the content type will be inferred from the name's
15651 * extension.
15652 */
15653
15654
15655 AV.File = function (name, data, mimeType) {
15656 this.attributes = {
15657 name: name,
15658 url: '',
15659 metaData: {},
15660 // 用来存储转换后要上传的 base64 String
15661 base64: ''
15662 };
15663
15664 if (_.isString(data)) {
15665 throw new TypeError('Creating an AV.File from a String is not yet supported.');
15666 }
15667
15668 if (_.isArray(data)) {
15669 this.attributes.metaData.size = data.length;
15670 data = {
15671 base64: encodeBase64(data)
15672 };
15673 }
15674
15675 this._extName = '';
15676 this._data = data;
15677 this._uploadHeaders = {};
15678
15679 if (data && data.blob && typeof data.blob.uri === 'string') {
15680 this._extName = extname(data.blob.uri);
15681 }
15682
15683 if (typeof Blob !== 'undefined' && data instanceof Blob) {
15684 if (data.size) {
15685 this.attributes.metaData.size = data.size;
15686 }
15687
15688 if (data.name) {
15689 this._extName = extname(data.name);
15690 }
15691 }
15692
15693 var owner;
15694
15695 if (data && data.owner) {
15696 owner = data.owner;
15697 } else if (!AV._config.disableCurrentUser) {
15698 try {
15699 owner = AV.User.current();
15700 } catch (error) {
15701 if ('SYNC_API_NOT_AVAILABLE' !== error.code) {
15702 throw error;
15703 }
15704 }
15705 }
15706
15707 this.attributes.metaData.owner = owner ? owner.id : 'unknown';
15708 this.set('mime_type', mimeType);
15709 };
15710 /**
15711 * Creates a fresh AV.File object with exists url for saving to AVOS Cloud.
15712 * @param {String} name the file name
15713 * @param {String} url the file url.
15714 * @param {Object} [metaData] the file metadata object.
15715 * @param {String} [type] Content-Type header to use for the file. If
15716 * this is omitted, the content type will be inferred from the name's
15717 * extension.
15718 * @return {AV.File} the file object
15719 */
15720
15721
15722 AV.File.withURL = function (name, url, metaData, type) {
15723 if (!name || !url) {
15724 throw new Error('Please provide file name and url');
15725 }
15726
15727 var file = new AV.File(name, null, type); //copy metaData properties to file.
15728
15729 if (metaData) {
15730 for (var prop in metaData) {
15731 if (!file.attributes.metaData[prop]) file.attributes.metaData[prop] = metaData[prop];
15732 }
15733 }
15734
15735 file.attributes.url = url; //Mark the file is from external source.
15736
15737 file.attributes.metaData.__source = 'external';
15738 file.attributes.metaData.size = 0;
15739 return file;
15740 };
15741 /**
15742 * Creates a file object with exists objectId.
15743 * @param {String} objectId The objectId string
15744 * @return {AV.File} the file object
15745 */
15746
15747
15748 AV.File.createWithoutData = function (objectId) {
15749 if (!objectId) {
15750 throw new TypeError('The objectId must be provided');
15751 }
15752
15753 var file = new AV.File();
15754 file.id = objectId;
15755 return file;
15756 };
15757 /**
15758 * Request file censor.
15759 * @since 4.13.0
15760 * @param {String} objectId
15761 * @return {Promise.<string>}
15762 */
15763
15764
15765 AV.File.censor = function (objectId) {
15766 if (!AV._config.masterKey) {
15767 throw new Error('Cannot censor a file without masterKey');
15768 }
15769
15770 return request({
15771 method: 'POST',
15772 path: "/files/".concat(objectId, "/censor"),
15773 authOptions: {
15774 useMasterKey: true
15775 }
15776 }).then(function (res) {
15777 return res.censorResult;
15778 });
15779 };
15780
15781 _.extend(AV.File.prototype,
15782 /** @lends AV.File.prototype */
15783 {
15784 className: '_File',
15785 _toFullJSON: function _toFullJSON(seenObjects) {
15786 var _this = this;
15787
15788 var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
15789
15790 var json = _.clone(this.attributes);
15791
15792 AV._objectEach(json, function (val, key) {
15793 json[key] = AV._encode(val, seenObjects, undefined, full);
15794 });
15795
15796 AV._objectEach(this._operations, function (val, key) {
15797 json[key] = val;
15798 });
15799
15800 if (_.has(this, 'id')) {
15801 json.objectId = this.id;
15802 }
15803
15804 ['createdAt', 'updatedAt'].forEach(function (key) {
15805 if (_.has(_this, key)) {
15806 var val = _this[key];
15807 json[key] = _.isDate(val) ? val.toJSON() : val;
15808 }
15809 });
15810
15811 if (full) {
15812 json.__type = 'File';
15813 }
15814
15815 return json;
15816 },
15817
15818 /**
15819 * Returns a JSON version of the file with meta data.
15820 * Inverse to {@link AV.parseJSON}
15821 * @since 3.0.0
15822 * @return {Object}
15823 */
15824 toFullJSON: function toFullJSON() {
15825 var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
15826 return this._toFullJSON(seenObjects);
15827 },
15828
15829 /**
15830 * Returns a JSON version of the object.
15831 * @return {Object}
15832 */
15833 toJSON: function toJSON(key, holder) {
15834 var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [this];
15835 return this._toFullJSON(seenObjects, false);
15836 },
15837
15838 /**
15839 * Gets a Pointer referencing this file.
15840 * @private
15841 */
15842 _toPointer: function _toPointer() {
15843 return {
15844 __type: 'Pointer',
15845 className: this.className,
15846 objectId: this.id
15847 };
15848 },
15849
15850 /**
15851 * Returns the ACL for this file.
15852 * @returns {AV.ACL} An instance of AV.ACL.
15853 */
15854 getACL: function getACL() {
15855 return this._acl;
15856 },
15857
15858 /**
15859 * Sets the ACL to be used for this file.
15860 * @param {AV.ACL} acl An instance of AV.ACL.
15861 */
15862 setACL: function setACL(acl) {
15863 if (!(acl instanceof AV.ACL)) {
15864 return new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
15865 }
15866
15867 this._acl = acl;
15868 return this;
15869 },
15870
15871 /**
15872 * Gets the name of the file. Before save is called, this is the filename
15873 * given by the user. After save is called, that name gets prefixed with a
15874 * unique identifier.
15875 */
15876 name: function name() {
15877 return this.get('name');
15878 },
15879
15880 /**
15881 * Gets the url of the file. It is only available after you save the file or
15882 * after you get the file from a AV.Object.
15883 * @return {String}
15884 */
15885 url: function url() {
15886 return this.get('url');
15887 },
15888
15889 /**
15890 * Gets the attributs of the file object.
15891 * @param {String} The attribute name which want to get.
15892 * @returns {Any}
15893 */
15894 get: function get(attrName) {
15895 switch (attrName) {
15896 case 'objectId':
15897 return this.id;
15898
15899 case 'url':
15900 case 'name':
15901 case 'mime_type':
15902 case 'metaData':
15903 case 'createdAt':
15904 case 'updatedAt':
15905 return this.attributes[attrName];
15906
15907 default:
15908 return this.attributes.metaData[attrName];
15909 }
15910 },
15911
15912 /**
15913 * Set the metaData of the file object.
15914 * @param {Object} Object is an key value Object for setting metaData.
15915 * @param {String} attr is an optional metadata key.
15916 * @param {Object} value is an optional metadata value.
15917 * @returns {String|Number|Array|Object}
15918 */
15919 set: function set() {
15920 var _this2 = this;
15921
15922 var set = function set(attrName, value) {
15923 switch (attrName) {
15924 case 'name':
15925 case 'url':
15926 case 'mime_type':
15927 case 'base64':
15928 case 'metaData':
15929 _this2.attributes[attrName] = value;
15930 break;
15931
15932 default:
15933 // File 并非一个 AVObject,不能完全自定义其他属性,所以只能都放在 metaData 上面
15934 _this2.attributes.metaData[attrName] = value;
15935 break;
15936 }
15937 };
15938
15939 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
15940 args[_key] = arguments[_key];
15941 }
15942
15943 switch (args.length) {
15944 case 1:
15945 // 传入一个 Object
15946 for (var k in args[0]) {
15947 set(k, args[0][k]);
15948 }
15949
15950 break;
15951
15952 case 2:
15953 set(args[0], args[1]);
15954 break;
15955 }
15956
15957 return this;
15958 },
15959
15960 /**
15961 * Set a header for the upload request.
15962 * For more infomation, go to https://url.leanapp.cn/avfile-upload-headers
15963 *
15964 * @param {String} key header key
15965 * @param {String} value header value
15966 * @return {AV.File} this
15967 */
15968 setUploadHeader: function setUploadHeader(key, value) {
15969 this._uploadHeaders[key] = value;
15970 return this;
15971 },
15972
15973 /**
15974 * <p>Returns the file's metadata JSON object if no arguments is given.Returns the
15975 * metadata value if a key is given.Set metadata value if key and value are both given.</p>
15976 * <p><pre>
15977 * var metadata = file.metaData(); //Get metadata JSON object.
15978 * var size = file.metaData('size'); // Get the size metadata value.
15979 * file.metaData('format', 'jpeg'); //set metadata attribute and value.
15980 *</pre></p>
15981 * @return {Object} The file's metadata JSON object.
15982 * @param {String} attr an optional metadata key.
15983 * @param {Object} value an optional metadata value.
15984 **/
15985 metaData: function metaData(attr, value) {
15986 if (attr && value) {
15987 this.attributes.metaData[attr] = value;
15988 return this;
15989 } else if (attr && !value) {
15990 return this.attributes.metaData[attr];
15991 } else {
15992 return this.attributes.metaData;
15993 }
15994 },
15995
15996 /**
15997 * 如果文件是图片,获取图片的缩略图URL。可以传入宽度、高度、质量、格式等参数。
15998 * @return {String} 缩略图URL
15999 * @param {Number} width 宽度,单位:像素
16000 * @param {Number} heigth 高度,单位:像素
16001 * @param {Number} quality 质量,1-100的数字,默认100
16002 * @param {Number} scaleToFit 是否将图片自适应大小。默认为true。
16003 * @param {String} fmt 格式,默认为png,也可以为jpeg,gif等格式。
16004 */
16005 thumbnailURL: function thumbnailURL(width, height) {
16006 var quality = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
16007 var scaleToFit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
16008 var fmt = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'png';
16009 var url = this.attributes.url;
16010
16011 if (!url) {
16012 throw new Error('Invalid url.');
16013 }
16014
16015 if (!width || !height || width <= 0 || height <= 0) {
16016 throw new Error('Invalid width or height value.');
16017 }
16018
16019 if (quality <= 0 || quality > 100) {
16020 throw new Error('Invalid quality value.');
16021 }
16022
16023 var mode = scaleToFit ? 2 : 1;
16024 return url + '?imageView/' + mode + '/w/' + width + '/h/' + height + '/q/' + quality + '/format/' + fmt;
16025 },
16026
16027 /**
16028 * Returns the file's size.
16029 * @return {Number} The file's size in bytes.
16030 **/
16031 size: function size() {
16032 return this.metaData().size;
16033 },
16034
16035 /**
16036 * Returns the file's owner.
16037 * @return {String} The file's owner id.
16038 */
16039 ownerId: function ownerId() {
16040 return this.metaData().owner;
16041 },
16042
16043 /**
16044 * Destroy the file.
16045 * @param {AuthOptions} options
16046 * @return {Promise} A promise that is fulfilled when the destroy
16047 * completes.
16048 */
16049 destroy: function destroy(options) {
16050 if (!this.id) {
16051 return _promise.default.reject(new Error('The file id does not eixst.'));
16052 }
16053
16054 var request = AVRequest('files', null, this.id, 'DELETE', null, options);
16055 return request;
16056 },
16057
16058 /**
16059 * Request Qiniu upload token
16060 * @param {string} type
16061 * @return {Promise} Resolved with the response
16062 * @private
16063 */
16064 _fileToken: function _fileToken(type, authOptions) {
16065 var name = this.attributes.name;
16066 var extName = extname(name);
16067
16068 if (!extName && this._extName) {
16069 name += this._extName;
16070 extName = this._extName;
16071 }
16072
16073 var data = {
16074 name: name,
16075 keep_file_name: authOptions.keepFileName,
16076 key: authOptions.key,
16077 ACL: this._acl,
16078 mime_type: type,
16079 metaData: this.attributes.metaData
16080 };
16081 return AVRequest('fileTokens', null, null, 'POST', data, authOptions);
16082 },
16083
16084 /**
16085 * @callback UploadProgressCallback
16086 * @param {XMLHttpRequestProgressEvent} event - The progress event with 'loaded' and 'total' attributes
16087 */
16088
16089 /**
16090 * Saves the file to the AV cloud.
16091 * @param {AuthOptions} [options] AuthOptions plus:
16092 * @param {UploadProgressCallback} [options.onprogress] 文件上传进度,在 Node.js 中无效,回调参数说明详见 {@link UploadProgressCallback}。
16093 * @param {boolean} [options.keepFileName = false] 保留下载文件的文件名。
16094 * @param {string} [options.key] 指定文件的 key。设置该选项需要使用 masterKey
16095 * @return {Promise} Promise that is resolved when the save finishes.
16096 */
16097 save: function save() {
16098 var _this3 = this;
16099
16100 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
16101
16102 if (this.id) {
16103 throw new Error('File is already saved.');
16104 }
16105
16106 if (!this._previousSave) {
16107 if (this._data) {
16108 var mimeType = this.get('mime_type');
16109 this._previousSave = this._fileToken(mimeType, options).then(function (uploadInfo) {
16110 if (uploadInfo.mime_type) {
16111 mimeType = uploadInfo.mime_type;
16112
16113 _this3.set('mime_type', mimeType);
16114 }
16115
16116 _this3._token = uploadInfo.token;
16117 return _promise.default.resolve().then(function () {
16118 var data = _this3._data;
16119
16120 if (data && data.base64) {
16121 return parseBase64(data.base64, mimeType);
16122 }
16123
16124 if (data && data.blob) {
16125 if (!data.blob.type && mimeType) {
16126 data.blob.type = mimeType;
16127 }
16128
16129 if (!data.blob.name) {
16130 data.blob.name = _this3.get('name');
16131 }
16132
16133 return data.blob;
16134 }
16135
16136 if (typeof Blob !== 'undefined' && data instanceof Blob) {
16137 return data;
16138 }
16139
16140 throw new TypeError('malformed file data');
16141 }).then(function (data) {
16142 var _options = _.extend({}, options); // filter out download progress events
16143
16144
16145 if (options.onprogress) {
16146 _options.onprogress = function (event) {
16147 if (event.direction === 'download') return;
16148 return options.onprogress(event);
16149 };
16150 }
16151
16152 switch (uploadInfo.provider) {
16153 case 's3':
16154 return s3(uploadInfo, data, _this3, _options);
16155
16156 case 'qcloud':
16157 return cos(uploadInfo, data, _this3, _options);
16158
16159 case 'qiniu':
16160 default:
16161 return qiniu(uploadInfo, data, _this3, _options);
16162 }
16163 }).then(tap(function () {
16164 return _this3._callback(true);
16165 }), function (error) {
16166 _this3._callback(false);
16167
16168 throw error;
16169 });
16170 });
16171 } else if (this.attributes.url && this.attributes.metaData.__source === 'external') {
16172 // external link file.
16173 var data = {
16174 name: this.attributes.name,
16175 ACL: this._acl,
16176 metaData: this.attributes.metaData,
16177 mime_type: this.mimeType,
16178 url: this.attributes.url
16179 };
16180 this._previousSave = AVRequest('files', null, null, 'post', data, options).then(function (response) {
16181 _this3.id = response.objectId;
16182 return _this3;
16183 });
16184 }
16185 }
16186
16187 return this._previousSave;
16188 },
16189 _callback: function _callback(success) {
16190 AVRequest('fileCallback', null, null, 'post', {
16191 token: this._token,
16192 result: success
16193 }).catch(debug);
16194 delete this._token;
16195 delete this._data;
16196 },
16197
16198 /**
16199 * fetch the file from server. If the server's representation of the
16200 * model differs from its current attributes, they will be overriden,
16201 * @param {Object} fetchOptions Optional options to set 'keys',
16202 * 'include' and 'includeACL' option.
16203 * @param {AuthOptions} options
16204 * @return {Promise} A promise that is fulfilled when the fetch
16205 * completes.
16206 */
16207 fetch: function fetch(fetchOptions, options) {
16208 if (!this.id) {
16209 throw new Error('Cannot fetch unsaved file');
16210 }
16211
16212 var request = AVRequest('files', null, this.id, 'GET', transformFetchOptions(fetchOptions), options);
16213 return request.then(this._finishFetch.bind(this));
16214 },
16215 _finishFetch: function _finishFetch(response) {
16216 var value = AV.Object.prototype.parse(response);
16217 value.attributes = {
16218 name: value.name,
16219 url: value.url,
16220 mime_type: value.mime_type,
16221 bucket: value.bucket
16222 };
16223 value.attributes.metaData = value.metaData || {};
16224 value.id = value.objectId; // clean
16225
16226 delete value.objectId;
16227 delete value.metaData;
16228 delete value.url;
16229 delete value.name;
16230 delete value.mime_type;
16231 delete value.bucket;
16232
16233 _.extend(this, value);
16234
16235 return this;
16236 },
16237
16238 /**
16239 * Request file censor
16240 * @since 4.13.0
16241 * @return {Promise.<string>}
16242 */
16243 censor: function censor() {
16244 if (!this.id) {
16245 throw new Error('Cannot censor an unsaved file');
16246 }
16247
16248 return AV.File.censor(this.id);
16249 }
16250 });
16251};
16252
16253/***/ }),
16254/* 483 */
16255/***/ (function(module, exports, __webpack_require__) {
16256
16257"use strict";
16258
16259
16260var _require = __webpack_require__(76),
16261 getAdapter = _require.getAdapter;
16262
16263var debug = __webpack_require__(63)('cos');
16264
16265module.exports = function (uploadInfo, data, file) {
16266 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
16267 var url = uploadInfo.upload_url + '?sign=' + encodeURIComponent(uploadInfo.token);
16268 var fileFormData = {
16269 field: 'fileContent',
16270 data: data,
16271 name: file.attributes.name
16272 };
16273 var options = {
16274 headers: file._uploadHeaders,
16275 data: {
16276 op: 'upload'
16277 },
16278 onprogress: saveOptions.onprogress
16279 };
16280 debug('url: %s, file: %o, options: %o', url, fileFormData, options);
16281 var upload = getAdapter('upload');
16282 return upload(url, fileFormData, options).then(function (response) {
16283 debug(response.status, response.data);
16284
16285 if (response.ok === false) {
16286 var error = new Error(response.status);
16287 error.response = response;
16288 throw error;
16289 }
16290
16291 file.attributes.url = uploadInfo.url;
16292 file._bucket = uploadInfo.bucket;
16293 file.id = uploadInfo.objectId;
16294 return file;
16295 }, function (error) {
16296 var response = error.response;
16297
16298 if (response) {
16299 debug(response.status, response.data);
16300 error.statusCode = response.status;
16301 error.response = response.data;
16302 }
16303
16304 throw error;
16305 });
16306};
16307
16308/***/ }),
16309/* 484 */
16310/***/ (function(module, exports, __webpack_require__) {
16311
16312"use strict";
16313
16314
16315var _sliceInstanceProperty2 = __webpack_require__(34);
16316
16317var _Array$from = __webpack_require__(153);
16318
16319var _Symbol = __webpack_require__(77);
16320
16321var _getIteratorMethod = __webpack_require__(253);
16322
16323var _Reflect$construct = __webpack_require__(494);
16324
16325var _interopRequireDefault = __webpack_require__(1);
16326
16327var _inherits2 = _interopRequireDefault(__webpack_require__(498));
16328
16329var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(520));
16330
16331var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(522));
16332
16333var _classCallCheck2 = _interopRequireDefault(__webpack_require__(527));
16334
16335var _createClass2 = _interopRequireDefault(__webpack_require__(528));
16336
16337var _stringify = _interopRequireDefault(__webpack_require__(38));
16338
16339var _concat = _interopRequireDefault(__webpack_require__(19));
16340
16341var _promise = _interopRequireDefault(__webpack_require__(12));
16342
16343var _slice = _interopRequireDefault(__webpack_require__(34));
16344
16345function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
16346
16347function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
16348
16349function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
16350
16351function _unsupportedIterableToArray(o, minLen) { var _context8; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty2(_context8 = Object.prototype.toString.call(o)).call(_context8, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
16352
16353function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
16354
16355var _require = __webpack_require__(76),
16356 getAdapter = _require.getAdapter;
16357
16358var debug = __webpack_require__(63)('leancloud:qiniu');
16359
16360var ajax = __webpack_require__(117);
16361
16362var btoa = __webpack_require__(529);
16363
16364var SHARD_THRESHOLD = 1024 * 1024 * 64;
16365var CHUNK_SIZE = 1024 * 1024 * 16;
16366
16367function upload(uploadInfo, data, file) {
16368 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
16369 // Get the uptoken to upload files to qiniu.
16370 var uptoken = uploadInfo.token;
16371 var url = uploadInfo.upload_url || 'https://upload.qiniup.com';
16372 var fileFormData = {
16373 field: 'file',
16374 data: data,
16375 name: file.attributes.name
16376 };
16377 var options = {
16378 headers: file._uploadHeaders,
16379 data: {
16380 name: file.attributes.name,
16381 key: uploadInfo.key,
16382 token: uptoken
16383 },
16384 onprogress: saveOptions.onprogress
16385 };
16386 debug('url: %s, file: %o, options: %o', url, fileFormData, options);
16387 var upload = getAdapter('upload');
16388 return upload(url, fileFormData, options).then(function (response) {
16389 debug(response.status, response.data);
16390
16391 if (response.ok === false) {
16392 var message = response.status;
16393
16394 if (response.data) {
16395 if (response.data.error) {
16396 message = response.data.error;
16397 } else {
16398 message = (0, _stringify.default)(response.data);
16399 }
16400 }
16401
16402 var error = new Error(message);
16403 error.response = response;
16404 throw error;
16405 }
16406
16407 file.attributes.url = uploadInfo.url;
16408 file._bucket = uploadInfo.bucket;
16409 file.id = uploadInfo.objectId;
16410 return file;
16411 }, function (error) {
16412 var response = error.response;
16413
16414 if (response) {
16415 debug(response.status, response.data);
16416 error.statusCode = response.status;
16417 error.response = response.data;
16418 }
16419
16420 throw error;
16421 });
16422}
16423
16424function urlSafeBase64(string) {
16425 var base64 = btoa(unescape(encodeURIComponent(string)));
16426 var result = '';
16427
16428 var _iterator = _createForOfIteratorHelper(base64),
16429 _step;
16430
16431 try {
16432 for (_iterator.s(); !(_step = _iterator.n()).done;) {
16433 var ch = _step.value;
16434
16435 switch (ch) {
16436 case '+':
16437 result += '-';
16438 break;
16439
16440 case '/':
16441 result += '_';
16442 break;
16443
16444 default:
16445 result += ch;
16446 }
16447 }
16448 } catch (err) {
16449 _iterator.e(err);
16450 } finally {
16451 _iterator.f();
16452 }
16453
16454 return result;
16455}
16456
16457var ShardUploader = /*#__PURE__*/function () {
16458 function ShardUploader(uploadInfo, data, file, saveOptions) {
16459 var _context,
16460 _context2,
16461 _this = this;
16462
16463 (0, _classCallCheck2.default)(this, ShardUploader);
16464 this.uploadInfo = uploadInfo;
16465 this.data = data;
16466 this.file = file;
16467 this.size = undefined;
16468 this.offset = 0;
16469 this.uploadedChunks = 0;
16470 var key = urlSafeBase64(uploadInfo.key);
16471 var uploadURL = uploadInfo.upload_url || 'https://upload.qiniup.com';
16472 this.baseURL = (0, _concat.default)(_context = (0, _concat.default)(_context2 = "".concat(uploadURL, "/buckets/")).call(_context2, uploadInfo.bucket, "/objects/")).call(_context, key, "/uploads");
16473 this.upToken = 'UpToken ' + uploadInfo.token;
16474 this.uploaded = 0;
16475
16476 if (saveOptions && saveOptions.onprogress) {
16477 this.onProgress = function (_ref) {
16478 var loaded = _ref.loaded;
16479 loaded += _this.uploadedChunks * CHUNK_SIZE;
16480
16481 if (loaded <= _this.uploaded) {
16482 return;
16483 }
16484
16485 if (_this.size) {
16486 saveOptions.onprogress({
16487 loaded: loaded,
16488 total: _this.size,
16489 percent: loaded / _this.size * 100
16490 });
16491 } else {
16492 saveOptions.onprogress({
16493 loaded: loaded
16494 });
16495 }
16496
16497 _this.uploaded = loaded;
16498 };
16499 }
16500 }
16501 /**
16502 * @returns {Promise<string>}
16503 */
16504
16505
16506 (0, _createClass2.default)(ShardUploader, [{
16507 key: "getUploadId",
16508 value: function getUploadId() {
16509 return ajax({
16510 method: 'POST',
16511 url: this.baseURL,
16512 headers: {
16513 Authorization: this.upToken
16514 }
16515 }).then(function (res) {
16516 return res.uploadId;
16517 });
16518 }
16519 }, {
16520 key: "getChunk",
16521 value: function getChunk() {
16522 throw new Error('Not implemented');
16523 }
16524 /**
16525 * @param {string} uploadId
16526 * @param {number} partNumber
16527 * @param {any} data
16528 * @returns {Promise<{ partNumber: number, etag: string }>}
16529 */
16530
16531 }, {
16532 key: "uploadPart",
16533 value: function uploadPart(uploadId, partNumber, data) {
16534 var _context3, _context4;
16535
16536 return ajax({
16537 method: 'PUT',
16538 url: (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = "".concat(this.baseURL, "/")).call(_context4, uploadId, "/")).call(_context3, partNumber),
16539 headers: {
16540 Authorization: this.upToken
16541 },
16542 data: data,
16543 onprogress: this.onProgress
16544 }).then(function (_ref2) {
16545 var etag = _ref2.etag;
16546 return {
16547 partNumber: partNumber,
16548 etag: etag
16549 };
16550 });
16551 }
16552 }, {
16553 key: "stopUpload",
16554 value: function stopUpload(uploadId) {
16555 var _context5;
16556
16557 return ajax({
16558 method: 'DELETE',
16559 url: (0, _concat.default)(_context5 = "".concat(this.baseURL, "/")).call(_context5, uploadId),
16560 headers: {
16561 Authorization: this.upToken
16562 }
16563 });
16564 }
16565 }, {
16566 key: "upload",
16567 value: function upload() {
16568 var _this2 = this;
16569
16570 var parts = [];
16571 return this.getUploadId().then(function (uploadId) {
16572 var uploadPart = function uploadPart() {
16573 return _promise.default.resolve(_this2.getChunk()).then(function (chunk) {
16574 if (!chunk) {
16575 return;
16576 }
16577
16578 var partNumber = parts.length + 1;
16579 return _this2.uploadPart(uploadId, partNumber, chunk).then(function (part) {
16580 parts.push(part);
16581 _this2.uploadedChunks++;
16582 return uploadPart();
16583 });
16584 }).catch(function (error) {
16585 return _this2.stopUpload(uploadId).then(function () {
16586 return _promise.default.reject(error);
16587 });
16588 });
16589 };
16590
16591 return uploadPart().then(function () {
16592 var _context6;
16593
16594 return ajax({
16595 method: 'POST',
16596 url: (0, _concat.default)(_context6 = "".concat(_this2.baseURL, "/")).call(_context6, uploadId),
16597 headers: {
16598 Authorization: _this2.upToken
16599 },
16600 data: {
16601 parts: parts,
16602 fname: _this2.file.attributes.name,
16603 mimeType: _this2.file.attributes.mime_type
16604 }
16605 });
16606 });
16607 }).then(function () {
16608 _this2.file.attributes.url = _this2.uploadInfo.url;
16609 _this2.file._bucket = _this2.uploadInfo.bucket;
16610 _this2.file.id = _this2.uploadInfo.objectId;
16611 return _this2.file;
16612 });
16613 }
16614 }]);
16615 return ShardUploader;
16616}();
16617
16618var BlobUploader = /*#__PURE__*/function (_ShardUploader) {
16619 (0, _inherits2.default)(BlobUploader, _ShardUploader);
16620
16621 var _super = _createSuper(BlobUploader);
16622
16623 function BlobUploader(uploadInfo, data, file, saveOptions) {
16624 var _this3;
16625
16626 (0, _classCallCheck2.default)(this, BlobUploader);
16627 _this3 = _super.call(this, uploadInfo, data, file, saveOptions);
16628 _this3.size = data.size;
16629 return _this3;
16630 }
16631 /**
16632 * @returns {Blob | null}
16633 */
16634
16635
16636 (0, _createClass2.default)(BlobUploader, [{
16637 key: "getChunk",
16638 value: function getChunk() {
16639 var _context7;
16640
16641 if (this.offset >= this.size) {
16642 return null;
16643 }
16644
16645 var chunk = (0, _slice.default)(_context7 = this.data).call(_context7, this.offset, this.offset + CHUNK_SIZE);
16646 this.offset += chunk.size;
16647 return chunk;
16648 }
16649 }]);
16650 return BlobUploader;
16651}(ShardUploader);
16652
16653function isBlob(data) {
16654 return typeof Blob !== 'undefined' && data instanceof Blob;
16655}
16656
16657module.exports = function (uploadInfo, data, file) {
16658 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
16659
16660 if (isBlob(data) && data.size >= SHARD_THRESHOLD) {
16661 return new BlobUploader(uploadInfo, data, file, saveOptions).upload();
16662 }
16663
16664 return upload(uploadInfo, data, file, saveOptions);
16665};
16666
16667/***/ }),
16668/* 485 */
16669/***/ (function(module, exports, __webpack_require__) {
16670
16671__webpack_require__(70);
16672__webpack_require__(486);
16673var path = __webpack_require__(7);
16674
16675module.exports = path.Array.from;
16676
16677
16678/***/ }),
16679/* 486 */
16680/***/ (function(module, exports, __webpack_require__) {
16681
16682var $ = __webpack_require__(0);
16683var from = __webpack_require__(487);
16684var checkCorrectnessOfIteration = __webpack_require__(178);
16685
16686var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
16687 // eslint-disable-next-line es-x/no-array-from -- required for testing
16688 Array.from(iterable);
16689});
16690
16691// `Array.from` method
16692// https://tc39.es/ecma262/#sec-array.from
16693$({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
16694 from: from
16695});
16696
16697
16698/***/ }),
16699/* 487 */
16700/***/ (function(module, exports, __webpack_require__) {
16701
16702"use strict";
16703
16704var bind = __webpack_require__(52);
16705var call = __webpack_require__(15);
16706var toObject = __webpack_require__(33);
16707var callWithSafeIterationClosing = __webpack_require__(488);
16708var isArrayIteratorMethod = __webpack_require__(166);
16709var isConstructor = __webpack_require__(111);
16710var lengthOfArrayLike = __webpack_require__(40);
16711var createProperty = __webpack_require__(93);
16712var getIterator = __webpack_require__(167);
16713var getIteratorMethod = __webpack_require__(108);
16714
16715var $Array = Array;
16716
16717// `Array.from` method implementation
16718// https://tc39.es/ecma262/#sec-array.from
16719module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
16720 var O = toObject(arrayLike);
16721 var IS_CONSTRUCTOR = isConstructor(this);
16722 var argumentsLength = arguments.length;
16723 var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
16724 var mapping = mapfn !== undefined;
16725 if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined);
16726 var iteratorMethod = getIteratorMethod(O);
16727 var index = 0;
16728 var length, result, step, iterator, next, value;
16729 // if the target is not iterable or it's an array with the default iterator - use a simple case
16730 if (iteratorMethod && !(this === $Array && isArrayIteratorMethod(iteratorMethod))) {
16731 iterator = getIterator(O, iteratorMethod);
16732 next = iterator.next;
16733 result = IS_CONSTRUCTOR ? new this() : [];
16734 for (;!(step = call(next, iterator)).done; index++) {
16735 value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
16736 createProperty(result, index, value);
16737 }
16738 } else {
16739 length = lengthOfArrayLike(O);
16740 result = IS_CONSTRUCTOR ? new this(length) : $Array(length);
16741 for (;length > index; index++) {
16742 value = mapping ? mapfn(O[index], index) : O[index];
16743 createProperty(result, index, value);
16744 }
16745 }
16746 result.length = index;
16747 return result;
16748};
16749
16750
16751/***/ }),
16752/* 488 */
16753/***/ (function(module, exports, __webpack_require__) {
16754
16755var anObject = __webpack_require__(21);
16756var iteratorClose = __webpack_require__(168);
16757
16758// call something on iterator step with safe closing on error
16759module.exports = function (iterator, fn, value, ENTRIES) {
16760 try {
16761 return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
16762 } catch (error) {
16763 iteratorClose(iterator, 'throw', error);
16764 }
16765};
16766
16767
16768/***/ }),
16769/* 489 */
16770/***/ (function(module, exports, __webpack_require__) {
16771
16772module.exports = __webpack_require__(490);
16773
16774
16775/***/ }),
16776/* 490 */
16777/***/ (function(module, exports, __webpack_require__) {
16778
16779var parent = __webpack_require__(491);
16780
16781module.exports = parent;
16782
16783
16784/***/ }),
16785/* 491 */
16786/***/ (function(module, exports, __webpack_require__) {
16787
16788var parent = __webpack_require__(492);
16789
16790module.exports = parent;
16791
16792
16793/***/ }),
16794/* 492 */
16795/***/ (function(module, exports, __webpack_require__) {
16796
16797var parent = __webpack_require__(493);
16798__webpack_require__(46);
16799
16800module.exports = parent;
16801
16802
16803/***/ }),
16804/* 493 */
16805/***/ (function(module, exports, __webpack_require__) {
16806
16807__webpack_require__(43);
16808__webpack_require__(70);
16809var getIteratorMethod = __webpack_require__(108);
16810
16811module.exports = getIteratorMethod;
16812
16813
16814/***/ }),
16815/* 494 */
16816/***/ (function(module, exports, __webpack_require__) {
16817
16818module.exports = __webpack_require__(495);
16819
16820/***/ }),
16821/* 495 */
16822/***/ (function(module, exports, __webpack_require__) {
16823
16824var parent = __webpack_require__(496);
16825
16826module.exports = parent;
16827
16828
16829/***/ }),
16830/* 496 */
16831/***/ (function(module, exports, __webpack_require__) {
16832
16833__webpack_require__(497);
16834var path = __webpack_require__(7);
16835
16836module.exports = path.Reflect.construct;
16837
16838
16839/***/ }),
16840/* 497 */
16841/***/ (function(module, exports, __webpack_require__) {
16842
16843var $ = __webpack_require__(0);
16844var getBuiltIn = __webpack_require__(20);
16845var apply = __webpack_require__(79);
16846var bind = __webpack_require__(254);
16847var aConstructor = __webpack_require__(174);
16848var anObject = __webpack_require__(21);
16849var isObject = __webpack_require__(11);
16850var create = __webpack_require__(53);
16851var fails = __webpack_require__(2);
16852
16853var nativeConstruct = getBuiltIn('Reflect', 'construct');
16854var ObjectPrototype = Object.prototype;
16855var push = [].push;
16856
16857// `Reflect.construct` method
16858// https://tc39.es/ecma262/#sec-reflect.construct
16859// MS Edge supports only 2 arguments and argumentsList argument is optional
16860// FF Nightly sets third argument as `new.target`, but does not create `this` from it
16861var NEW_TARGET_BUG = fails(function () {
16862 function F() { /* empty */ }
16863 return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F);
16864});
16865
16866var ARGS_BUG = !fails(function () {
16867 nativeConstruct(function () { /* empty */ });
16868});
16869
16870var FORCED = NEW_TARGET_BUG || ARGS_BUG;
16871
16872$({ target: 'Reflect', stat: true, forced: FORCED, sham: FORCED }, {
16873 construct: function construct(Target, args /* , newTarget */) {
16874 aConstructor(Target);
16875 anObject(args);
16876 var newTarget = arguments.length < 3 ? Target : aConstructor(arguments[2]);
16877 if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget);
16878 if (Target == newTarget) {
16879 // w/o altered newTarget, optimization for 0-4 arguments
16880 switch (args.length) {
16881 case 0: return new Target();
16882 case 1: return new Target(args[0]);
16883 case 2: return new Target(args[0], args[1]);
16884 case 3: return new Target(args[0], args[1], args[2]);
16885 case 4: return new Target(args[0], args[1], args[2], args[3]);
16886 }
16887 // w/o altered newTarget, lot of arguments case
16888 var $args = [null];
16889 apply(push, $args, args);
16890 return new (apply(bind, Target, $args))();
16891 }
16892 // with altered newTarget, not support built-in constructors
16893 var proto = newTarget.prototype;
16894 var instance = create(isObject(proto) ? proto : ObjectPrototype);
16895 var result = apply(Target, instance, args);
16896 return isObject(result) ? result : instance;
16897 }
16898});
16899
16900
16901/***/ }),
16902/* 498 */
16903/***/ (function(module, exports, __webpack_require__) {
16904
16905var _Object$create = __webpack_require__(499);
16906
16907var _Object$defineProperty = __webpack_require__(154);
16908
16909var setPrototypeOf = __webpack_require__(509);
16910
16911function _inherits(subClass, superClass) {
16912 if (typeof superClass !== "function" && superClass !== null) {
16913 throw new TypeError("Super expression must either be null or a function");
16914 }
16915
16916 subClass.prototype = _Object$create(superClass && superClass.prototype, {
16917 constructor: {
16918 value: subClass,
16919 writable: true,
16920 configurable: true
16921 }
16922 });
16923
16924 _Object$defineProperty(subClass, "prototype", {
16925 writable: false
16926 });
16927
16928 if (superClass) setPrototypeOf(subClass, superClass);
16929}
16930
16931module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
16932
16933/***/ }),
16934/* 499 */
16935/***/ (function(module, exports, __webpack_require__) {
16936
16937module.exports = __webpack_require__(500);
16938
16939/***/ }),
16940/* 500 */
16941/***/ (function(module, exports, __webpack_require__) {
16942
16943module.exports = __webpack_require__(501);
16944
16945
16946/***/ }),
16947/* 501 */
16948/***/ (function(module, exports, __webpack_require__) {
16949
16950var parent = __webpack_require__(502);
16951
16952module.exports = parent;
16953
16954
16955/***/ }),
16956/* 502 */
16957/***/ (function(module, exports, __webpack_require__) {
16958
16959var parent = __webpack_require__(503);
16960
16961module.exports = parent;
16962
16963
16964/***/ }),
16965/* 503 */
16966/***/ (function(module, exports, __webpack_require__) {
16967
16968var parent = __webpack_require__(504);
16969
16970module.exports = parent;
16971
16972
16973/***/ }),
16974/* 504 */
16975/***/ (function(module, exports, __webpack_require__) {
16976
16977__webpack_require__(505);
16978var path = __webpack_require__(7);
16979
16980var Object = path.Object;
16981
16982module.exports = function create(P, D) {
16983 return Object.create(P, D);
16984};
16985
16986
16987/***/ }),
16988/* 505 */
16989/***/ (function(module, exports, __webpack_require__) {
16990
16991// TODO: Remove from `core-js@4`
16992var $ = __webpack_require__(0);
16993var DESCRIPTORS = __webpack_require__(14);
16994var create = __webpack_require__(53);
16995
16996// `Object.create` method
16997// https://tc39.es/ecma262/#sec-object.create
16998$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
16999 create: create
17000});
17001
17002
17003/***/ }),
17004/* 506 */
17005/***/ (function(module, exports, __webpack_require__) {
17006
17007module.exports = __webpack_require__(507);
17008
17009
17010/***/ }),
17011/* 507 */
17012/***/ (function(module, exports, __webpack_require__) {
17013
17014var parent = __webpack_require__(508);
17015
17016module.exports = parent;
17017
17018
17019/***/ }),
17020/* 508 */
17021/***/ (function(module, exports, __webpack_require__) {
17022
17023var parent = __webpack_require__(240);
17024
17025module.exports = parent;
17026
17027
17028/***/ }),
17029/* 509 */
17030/***/ (function(module, exports, __webpack_require__) {
17031
17032var _Object$setPrototypeOf = __webpack_require__(255);
17033
17034var _bindInstanceProperty = __webpack_require__(256);
17035
17036function _setPrototypeOf(o, p) {
17037 var _context;
17038
17039 module.exports = _setPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$setPrototypeOf).call(_context) : function _setPrototypeOf(o, p) {
17040 o.__proto__ = p;
17041 return o;
17042 }, module.exports.__esModule = true, module.exports["default"] = module.exports;
17043 return _setPrototypeOf(o, p);
17044}
17045
17046module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
17047
17048/***/ }),
17049/* 510 */
17050/***/ (function(module, exports, __webpack_require__) {
17051
17052module.exports = __webpack_require__(511);
17053
17054
17055/***/ }),
17056/* 511 */
17057/***/ (function(module, exports, __webpack_require__) {
17058
17059var parent = __webpack_require__(512);
17060
17061module.exports = parent;
17062
17063
17064/***/ }),
17065/* 512 */
17066/***/ (function(module, exports, __webpack_require__) {
17067
17068var parent = __webpack_require__(238);
17069
17070module.exports = parent;
17071
17072
17073/***/ }),
17074/* 513 */
17075/***/ (function(module, exports, __webpack_require__) {
17076
17077module.exports = __webpack_require__(514);
17078
17079
17080/***/ }),
17081/* 514 */
17082/***/ (function(module, exports, __webpack_require__) {
17083
17084var parent = __webpack_require__(515);
17085
17086module.exports = parent;
17087
17088
17089/***/ }),
17090/* 515 */
17091/***/ (function(module, exports, __webpack_require__) {
17092
17093var parent = __webpack_require__(516);
17094
17095module.exports = parent;
17096
17097
17098/***/ }),
17099/* 516 */
17100/***/ (function(module, exports, __webpack_require__) {
17101
17102var parent = __webpack_require__(517);
17103
17104module.exports = parent;
17105
17106
17107/***/ }),
17108/* 517 */
17109/***/ (function(module, exports, __webpack_require__) {
17110
17111var isPrototypeOf = __webpack_require__(16);
17112var method = __webpack_require__(518);
17113
17114var FunctionPrototype = Function.prototype;
17115
17116module.exports = function (it) {
17117 var own = it.bind;
17118 return it === FunctionPrototype || (isPrototypeOf(FunctionPrototype, it) && own === FunctionPrototype.bind) ? method : own;
17119};
17120
17121
17122/***/ }),
17123/* 518 */
17124/***/ (function(module, exports, __webpack_require__) {
17125
17126__webpack_require__(519);
17127var entryVirtual = __webpack_require__(27);
17128
17129module.exports = entryVirtual('Function').bind;
17130
17131
17132/***/ }),
17133/* 519 */
17134/***/ (function(module, exports, __webpack_require__) {
17135
17136// TODO: Remove from `core-js@4`
17137var $ = __webpack_require__(0);
17138var bind = __webpack_require__(254);
17139
17140// `Function.prototype.bind` method
17141// https://tc39.es/ecma262/#sec-function.prototype.bind
17142$({ target: 'Function', proto: true, forced: Function.bind !== bind }, {
17143 bind: bind
17144});
17145
17146
17147/***/ }),
17148/* 520 */
17149/***/ (function(module, exports, __webpack_require__) {
17150
17151var _typeof = __webpack_require__(95)["default"];
17152
17153var assertThisInitialized = __webpack_require__(521);
17154
17155function _possibleConstructorReturn(self, call) {
17156 if (call && (_typeof(call) === "object" || typeof call === "function")) {
17157 return call;
17158 } else if (call !== void 0) {
17159 throw new TypeError("Derived constructors may only return object or undefined");
17160 }
17161
17162 return assertThisInitialized(self);
17163}
17164
17165module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
17166
17167/***/ }),
17168/* 521 */
17169/***/ (function(module, exports) {
17170
17171function _assertThisInitialized(self) {
17172 if (self === void 0) {
17173 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
17174 }
17175
17176 return self;
17177}
17178
17179module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
17180
17181/***/ }),
17182/* 522 */
17183/***/ (function(module, exports, __webpack_require__) {
17184
17185var _Object$setPrototypeOf = __webpack_require__(255);
17186
17187var _bindInstanceProperty = __webpack_require__(256);
17188
17189var _Object$getPrototypeOf = __webpack_require__(523);
17190
17191function _getPrototypeOf(o) {
17192 var _context;
17193
17194 module.exports = _getPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$getPrototypeOf).call(_context) : function _getPrototypeOf(o) {
17195 return o.__proto__ || _Object$getPrototypeOf(o);
17196 }, module.exports.__esModule = true, module.exports["default"] = module.exports;
17197 return _getPrototypeOf(o);
17198}
17199
17200module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
17201
17202/***/ }),
17203/* 523 */
17204/***/ (function(module, exports, __webpack_require__) {
17205
17206module.exports = __webpack_require__(524);
17207
17208/***/ }),
17209/* 524 */
17210/***/ (function(module, exports, __webpack_require__) {
17211
17212module.exports = __webpack_require__(525);
17213
17214
17215/***/ }),
17216/* 525 */
17217/***/ (function(module, exports, __webpack_require__) {
17218
17219var parent = __webpack_require__(526);
17220
17221module.exports = parent;
17222
17223
17224/***/ }),
17225/* 526 */
17226/***/ (function(module, exports, __webpack_require__) {
17227
17228var parent = __webpack_require__(233);
17229
17230module.exports = parent;
17231
17232
17233/***/ }),
17234/* 527 */
17235/***/ (function(module, exports) {
17236
17237function _classCallCheck(instance, Constructor) {
17238 if (!(instance instanceof Constructor)) {
17239 throw new TypeError("Cannot call a class as a function");
17240 }
17241}
17242
17243module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
17244
17245/***/ }),
17246/* 528 */
17247/***/ (function(module, exports, __webpack_require__) {
17248
17249var _Object$defineProperty = __webpack_require__(154);
17250
17251function _defineProperties(target, props) {
17252 for (var i = 0; i < props.length; i++) {
17253 var descriptor = props[i];
17254 descriptor.enumerable = descriptor.enumerable || false;
17255 descriptor.configurable = true;
17256 if ("value" in descriptor) descriptor.writable = true;
17257
17258 _Object$defineProperty(target, descriptor.key, descriptor);
17259 }
17260}
17261
17262function _createClass(Constructor, protoProps, staticProps) {
17263 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
17264 if (staticProps) _defineProperties(Constructor, staticProps);
17265
17266 _Object$defineProperty(Constructor, "prototype", {
17267 writable: false
17268 });
17269
17270 return Constructor;
17271}
17272
17273module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
17274
17275/***/ }),
17276/* 529 */
17277/***/ (function(module, exports, __webpack_require__) {
17278
17279"use strict";
17280
17281
17282var _interopRequireDefault = __webpack_require__(1);
17283
17284var _slice = _interopRequireDefault(__webpack_require__(34));
17285
17286// base64 character set, plus padding character (=)
17287var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
17288
17289module.exports = function (string) {
17290 var result = '';
17291
17292 for (var i = 0; i < string.length;) {
17293 var a = string.charCodeAt(i++);
17294 var b = string.charCodeAt(i++);
17295 var c = string.charCodeAt(i++);
17296
17297 if (a > 255 || b > 255 || c > 255) {
17298 throw new TypeError('Failed to encode base64: The string to be encoded contains characters outside of the Latin1 range.');
17299 }
17300
17301 var bitmap = a << 16 | b << 8 | c;
17302 result += b64.charAt(bitmap >> 18 & 63) + b64.charAt(bitmap >> 12 & 63) + b64.charAt(bitmap >> 6 & 63) + b64.charAt(bitmap & 63);
17303 } // To determine the final padding
17304
17305
17306 var rest = string.length % 3; // If there's need of padding, replace the last 'A's with equal signs
17307
17308 return rest ? (0, _slice.default)(result).call(result, 0, rest - 3) + '==='.substring(rest) : result;
17309};
17310
17311/***/ }),
17312/* 530 */
17313/***/ (function(module, exports, __webpack_require__) {
17314
17315"use strict";
17316
17317
17318var _ = __webpack_require__(3);
17319
17320var ajax = __webpack_require__(117);
17321
17322module.exports = function upload(uploadInfo, data, file) {
17323 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
17324 return ajax({
17325 url: uploadInfo.upload_url,
17326 method: 'PUT',
17327 data: data,
17328 headers: _.extend({
17329 'Content-Type': file.get('mime_type'),
17330 'Cache-Control': 'public, max-age=31536000'
17331 }, file._uploadHeaders),
17332 onprogress: saveOptions.onprogress
17333 }).then(function () {
17334 file.attributes.url = uploadInfo.url;
17335 file._bucket = uploadInfo.bucket;
17336 file.id = uploadInfo.objectId;
17337 return file;
17338 });
17339};
17340
17341/***/ }),
17342/* 531 */
17343/***/ (function(module, exports, __webpack_require__) {
17344
17345(function(){
17346 var crypt = __webpack_require__(532),
17347 utf8 = __webpack_require__(257).utf8,
17348 isBuffer = __webpack_require__(533),
17349 bin = __webpack_require__(257).bin,
17350
17351 // The core
17352 md5 = function (message, options) {
17353 // Convert to byte array
17354 if (message.constructor == String)
17355 if (options && options.encoding === 'binary')
17356 message = bin.stringToBytes(message);
17357 else
17358 message = utf8.stringToBytes(message);
17359 else if (isBuffer(message))
17360 message = Array.prototype.slice.call(message, 0);
17361 else if (!Array.isArray(message))
17362 message = message.toString();
17363 // else, assume byte array already
17364
17365 var m = crypt.bytesToWords(message),
17366 l = message.length * 8,
17367 a = 1732584193,
17368 b = -271733879,
17369 c = -1732584194,
17370 d = 271733878;
17371
17372 // Swap endian
17373 for (var i = 0; i < m.length; i++) {
17374 m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |
17375 ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;
17376 }
17377
17378 // Padding
17379 m[l >>> 5] |= 0x80 << (l % 32);
17380 m[(((l + 64) >>> 9) << 4) + 14] = l;
17381
17382 // Method shortcuts
17383 var FF = md5._ff,
17384 GG = md5._gg,
17385 HH = md5._hh,
17386 II = md5._ii;
17387
17388 for (var i = 0; i < m.length; i += 16) {
17389
17390 var aa = a,
17391 bb = b,
17392 cc = c,
17393 dd = d;
17394
17395 a = FF(a, b, c, d, m[i+ 0], 7, -680876936);
17396 d = FF(d, a, b, c, m[i+ 1], 12, -389564586);
17397 c = FF(c, d, a, b, m[i+ 2], 17, 606105819);
17398 b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);
17399 a = FF(a, b, c, d, m[i+ 4], 7, -176418897);
17400 d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);
17401 c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);
17402 b = FF(b, c, d, a, m[i+ 7], 22, -45705983);
17403 a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);
17404 d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);
17405 c = FF(c, d, a, b, m[i+10], 17, -42063);
17406 b = FF(b, c, d, a, m[i+11], 22, -1990404162);
17407 a = FF(a, b, c, d, m[i+12], 7, 1804603682);
17408 d = FF(d, a, b, c, m[i+13], 12, -40341101);
17409 c = FF(c, d, a, b, m[i+14], 17, -1502002290);
17410 b = FF(b, c, d, a, m[i+15], 22, 1236535329);
17411
17412 a = GG(a, b, c, d, m[i+ 1], 5, -165796510);
17413 d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);
17414 c = GG(c, d, a, b, m[i+11], 14, 643717713);
17415 b = GG(b, c, d, a, m[i+ 0], 20, -373897302);
17416 a = GG(a, b, c, d, m[i+ 5], 5, -701558691);
17417 d = GG(d, a, b, c, m[i+10], 9, 38016083);
17418 c = GG(c, d, a, b, m[i+15], 14, -660478335);
17419 b = GG(b, c, d, a, m[i+ 4], 20, -405537848);
17420 a = GG(a, b, c, d, m[i+ 9], 5, 568446438);
17421 d = GG(d, a, b, c, m[i+14], 9, -1019803690);
17422 c = GG(c, d, a, b, m[i+ 3], 14, -187363961);
17423 b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);
17424 a = GG(a, b, c, d, m[i+13], 5, -1444681467);
17425 d = GG(d, a, b, c, m[i+ 2], 9, -51403784);
17426 c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);
17427 b = GG(b, c, d, a, m[i+12], 20, -1926607734);
17428
17429 a = HH(a, b, c, d, m[i+ 5], 4, -378558);
17430 d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);
17431 c = HH(c, d, a, b, m[i+11], 16, 1839030562);
17432 b = HH(b, c, d, a, m[i+14], 23, -35309556);
17433 a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);
17434 d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);
17435 c = HH(c, d, a, b, m[i+ 7], 16, -155497632);
17436 b = HH(b, c, d, a, m[i+10], 23, -1094730640);
17437 a = HH(a, b, c, d, m[i+13], 4, 681279174);
17438 d = HH(d, a, b, c, m[i+ 0], 11, -358537222);
17439 c = HH(c, d, a, b, m[i+ 3], 16, -722521979);
17440 b = HH(b, c, d, a, m[i+ 6], 23, 76029189);
17441 a = HH(a, b, c, d, m[i+ 9], 4, -640364487);
17442 d = HH(d, a, b, c, m[i+12], 11, -421815835);
17443 c = HH(c, d, a, b, m[i+15], 16, 530742520);
17444 b = HH(b, c, d, a, m[i+ 2], 23, -995338651);
17445
17446 a = II(a, b, c, d, m[i+ 0], 6, -198630844);
17447 d = II(d, a, b, c, m[i+ 7], 10, 1126891415);
17448 c = II(c, d, a, b, m[i+14], 15, -1416354905);
17449 b = II(b, c, d, a, m[i+ 5], 21, -57434055);
17450 a = II(a, b, c, d, m[i+12], 6, 1700485571);
17451 d = II(d, a, b, c, m[i+ 3], 10, -1894986606);
17452 c = II(c, d, a, b, m[i+10], 15, -1051523);
17453 b = II(b, c, d, a, m[i+ 1], 21, -2054922799);
17454 a = II(a, b, c, d, m[i+ 8], 6, 1873313359);
17455 d = II(d, a, b, c, m[i+15], 10, -30611744);
17456 c = II(c, d, a, b, m[i+ 6], 15, -1560198380);
17457 b = II(b, c, d, a, m[i+13], 21, 1309151649);
17458 a = II(a, b, c, d, m[i+ 4], 6, -145523070);
17459 d = II(d, a, b, c, m[i+11], 10, -1120210379);
17460 c = II(c, d, a, b, m[i+ 2], 15, 718787259);
17461 b = II(b, c, d, a, m[i+ 9], 21, -343485551);
17462
17463 a = (a + aa) >>> 0;
17464 b = (b + bb) >>> 0;
17465 c = (c + cc) >>> 0;
17466 d = (d + dd) >>> 0;
17467 }
17468
17469 return crypt.endian([a, b, c, d]);
17470 };
17471
17472 // Auxiliary functions
17473 md5._ff = function (a, b, c, d, x, s, t) {
17474 var n = a + (b & c | ~b & d) + (x >>> 0) + t;
17475 return ((n << s) | (n >>> (32 - s))) + b;
17476 };
17477 md5._gg = function (a, b, c, d, x, s, t) {
17478 var n = a + (b & d | c & ~d) + (x >>> 0) + t;
17479 return ((n << s) | (n >>> (32 - s))) + b;
17480 };
17481 md5._hh = function (a, b, c, d, x, s, t) {
17482 var n = a + (b ^ c ^ d) + (x >>> 0) + t;
17483 return ((n << s) | (n >>> (32 - s))) + b;
17484 };
17485 md5._ii = function (a, b, c, d, x, s, t) {
17486 var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
17487 return ((n << s) | (n >>> (32 - s))) + b;
17488 };
17489
17490 // Package private blocksize
17491 md5._blocksize = 16;
17492 md5._digestsize = 16;
17493
17494 module.exports = function (message, options) {
17495 if (message === undefined || message === null)
17496 throw new Error('Illegal argument ' + message);
17497
17498 var digestbytes = crypt.wordsToBytes(md5(message, options));
17499 return options && options.asBytes ? digestbytes :
17500 options && options.asString ? bin.bytesToString(digestbytes) :
17501 crypt.bytesToHex(digestbytes);
17502 };
17503
17504})();
17505
17506
17507/***/ }),
17508/* 532 */
17509/***/ (function(module, exports) {
17510
17511(function() {
17512 var base64map
17513 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
17514
17515 crypt = {
17516 // Bit-wise rotation left
17517 rotl: function(n, b) {
17518 return (n << b) | (n >>> (32 - b));
17519 },
17520
17521 // Bit-wise rotation right
17522 rotr: function(n, b) {
17523 return (n << (32 - b)) | (n >>> b);
17524 },
17525
17526 // Swap big-endian to little-endian and vice versa
17527 endian: function(n) {
17528 // If number given, swap endian
17529 if (n.constructor == Number) {
17530 return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
17531 }
17532
17533 // Else, assume array and swap all items
17534 for (var i = 0; i < n.length; i++)
17535 n[i] = crypt.endian(n[i]);
17536 return n;
17537 },
17538
17539 // Generate an array of any length of random bytes
17540 randomBytes: function(n) {
17541 for (var bytes = []; n > 0; n--)
17542 bytes.push(Math.floor(Math.random() * 256));
17543 return bytes;
17544 },
17545
17546 // Convert a byte array to big-endian 32-bit words
17547 bytesToWords: function(bytes) {
17548 for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
17549 words[b >>> 5] |= bytes[i] << (24 - b % 32);
17550 return words;
17551 },
17552
17553 // Convert big-endian 32-bit words to a byte array
17554 wordsToBytes: function(words) {
17555 for (var bytes = [], b = 0; b < words.length * 32; b += 8)
17556 bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
17557 return bytes;
17558 },
17559
17560 // Convert a byte array to a hex string
17561 bytesToHex: function(bytes) {
17562 for (var hex = [], i = 0; i < bytes.length; i++) {
17563 hex.push((bytes[i] >>> 4).toString(16));
17564 hex.push((bytes[i] & 0xF).toString(16));
17565 }
17566 return hex.join('');
17567 },
17568
17569 // Convert a hex string to a byte array
17570 hexToBytes: function(hex) {
17571 for (var bytes = [], c = 0; c < hex.length; c += 2)
17572 bytes.push(parseInt(hex.substr(c, 2), 16));
17573 return bytes;
17574 },
17575
17576 // Convert a byte array to a base-64 string
17577 bytesToBase64: function(bytes) {
17578 for (var base64 = [], i = 0; i < bytes.length; i += 3) {
17579 var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
17580 for (var j = 0; j < 4; j++)
17581 if (i * 8 + j * 6 <= bytes.length * 8)
17582 base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
17583 else
17584 base64.push('=');
17585 }
17586 return base64.join('');
17587 },
17588
17589 // Convert a base-64 string to a byte array
17590 base64ToBytes: function(base64) {
17591 // Remove non-base-64 characters
17592 base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
17593
17594 for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
17595 imod4 = ++i % 4) {
17596 if (imod4 == 0) continue;
17597 bytes.push(((base64map.indexOf(base64.charAt(i - 1))
17598 & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
17599 | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
17600 }
17601 return bytes;
17602 }
17603 };
17604
17605 module.exports = crypt;
17606})();
17607
17608
17609/***/ }),
17610/* 533 */
17611/***/ (function(module, exports) {
17612
17613/*!
17614 * Determine if an object is a Buffer
17615 *
17616 * @author Feross Aboukhadijeh <https://feross.org>
17617 * @license MIT
17618 */
17619
17620// The _isBuffer check is for Safari 5-7 support, because it's missing
17621// Object.prototype.constructor. Remove this eventually
17622module.exports = function (obj) {
17623 return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
17624}
17625
17626function isBuffer (obj) {
17627 return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
17628}
17629
17630// For Node v0.10 support. Remove this eventually.
17631function isSlowBuffer (obj) {
17632 return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
17633}
17634
17635
17636/***/ }),
17637/* 534 */
17638/***/ (function(module, exports, __webpack_require__) {
17639
17640"use strict";
17641
17642
17643var _interopRequireDefault = __webpack_require__(1);
17644
17645var _indexOf = _interopRequireDefault(__webpack_require__(61));
17646
17647var dataURItoBlob = function dataURItoBlob(dataURI, type) {
17648 var _context;
17649
17650 var byteString; // 传入的 base64,不是 dataURL
17651
17652 if ((0, _indexOf.default)(dataURI).call(dataURI, 'base64') < 0) {
17653 byteString = atob(dataURI);
17654 } else if ((0, _indexOf.default)(_context = dataURI.split(',')[0]).call(_context, 'base64') >= 0) {
17655 type = type || dataURI.split(',')[0].split(':')[1].split(';')[0];
17656 byteString = atob(dataURI.split(',')[1]);
17657 } else {
17658 byteString = unescape(dataURI.split(',')[1]);
17659 }
17660
17661 var ia = new Uint8Array(byteString.length);
17662
17663 for (var i = 0; i < byteString.length; i++) {
17664 ia[i] = byteString.charCodeAt(i);
17665 }
17666
17667 return new Blob([ia], {
17668 type: type
17669 });
17670};
17671
17672module.exports = dataURItoBlob;
17673
17674/***/ }),
17675/* 535 */
17676/***/ (function(module, exports, __webpack_require__) {
17677
17678"use strict";
17679
17680
17681var _interopRequireDefault = __webpack_require__(1);
17682
17683var _slicedToArray2 = _interopRequireDefault(__webpack_require__(536));
17684
17685var _map = _interopRequireDefault(__webpack_require__(37));
17686
17687var _indexOf = _interopRequireDefault(__webpack_require__(61));
17688
17689var _find = _interopRequireDefault(__webpack_require__(96));
17690
17691var _promise = _interopRequireDefault(__webpack_require__(12));
17692
17693var _concat = _interopRequireDefault(__webpack_require__(19));
17694
17695var _keys2 = _interopRequireDefault(__webpack_require__(62));
17696
17697var _stringify = _interopRequireDefault(__webpack_require__(38));
17698
17699var _defineProperty = _interopRequireDefault(__webpack_require__(94));
17700
17701var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(258));
17702
17703var _ = __webpack_require__(3);
17704
17705var AVError = __webpack_require__(48);
17706
17707var _require = __webpack_require__(28),
17708 _request = _require._request;
17709
17710var _require2 = __webpack_require__(32),
17711 isNullOrUndefined = _require2.isNullOrUndefined,
17712 ensureArray = _require2.ensureArray,
17713 transformFetchOptions = _require2.transformFetchOptions,
17714 setValue = _require2.setValue,
17715 findValue = _require2.findValue,
17716 isPlainObject = _require2.isPlainObject,
17717 continueWhile = _require2.continueWhile;
17718
17719var recursiveToPointer = function recursiveToPointer(value) {
17720 if (_.isArray(value)) return (0, _map.default)(value).call(value, recursiveToPointer);
17721 if (isPlainObject(value)) return _.mapObject(value, recursiveToPointer);
17722 if (_.isObject(value) && value._toPointer) return value._toPointer();
17723 return value;
17724};
17725
17726var RESERVED_KEYS = ['objectId', 'createdAt', 'updatedAt'];
17727
17728var checkReservedKey = function checkReservedKey(key) {
17729 if ((0, _indexOf.default)(RESERVED_KEYS).call(RESERVED_KEYS, key) !== -1) {
17730 throw new Error("key[".concat(key, "] is reserved"));
17731 }
17732};
17733
17734var handleBatchResults = function handleBatchResults(results) {
17735 var firstError = (0, _find.default)(_).call(_, results, function (result) {
17736 return result instanceof Error;
17737 });
17738
17739 if (!firstError) {
17740 return results;
17741 }
17742
17743 var error = new AVError(firstError.code, firstError.message);
17744 error.results = results;
17745 throw error;
17746}; // Helper function to get a value from a Backbone object as a property
17747// or as a function.
17748
17749
17750function getValue(object, prop) {
17751 if (!(object && object[prop])) {
17752 return null;
17753 }
17754
17755 return _.isFunction(object[prop]) ? object[prop]() : object[prop];
17756} // AV.Object is analogous to the Java AVObject.
17757// It also implements the same interface as a Backbone model.
17758
17759
17760module.exports = function (AV) {
17761 /**
17762 * Creates a new model with defined attributes. A client id (cid) is
17763 * automatically generated and assigned for you.
17764 *
17765 * <p>You won't normally call this method directly. It is recommended that
17766 * you use a subclass of <code>AV.Object</code> instead, created by calling
17767 * <code>extend</code>.</p>
17768 *
17769 * <p>However, if you don't want to use a subclass, or aren't sure which
17770 * subclass is appropriate, you can use this form:<pre>
17771 * var object = new AV.Object("ClassName");
17772 * </pre>
17773 * That is basically equivalent to:<pre>
17774 * var MyClass = AV.Object.extend("ClassName");
17775 * var object = new MyClass();
17776 * </pre></p>
17777 *
17778 * @param {Object} attributes The initial set of data to store in the object.
17779 * @param {Object} options A set of Backbone-like options for creating the
17780 * object. The only option currently supported is "collection".
17781 * @see AV.Object.extend
17782 *
17783 * @class
17784 *
17785 * <p>The fundamental unit of AV data, which implements the Backbone Model
17786 * interface.</p>
17787 */
17788 AV.Object = function (attributes, options) {
17789 // Allow new AV.Object("ClassName") as a shortcut to _create.
17790 if (_.isString(attributes)) {
17791 return AV.Object._create.apply(this, arguments);
17792 }
17793
17794 attributes = attributes || {};
17795
17796 if (options && options.parse) {
17797 attributes = this.parse(attributes);
17798 attributes = this._mergeMagicFields(attributes);
17799 }
17800
17801 var defaults = getValue(this, 'defaults');
17802
17803 if (defaults) {
17804 attributes = _.extend({}, defaults, attributes);
17805 }
17806
17807 if (options && options.collection) {
17808 this.collection = options.collection;
17809 }
17810
17811 this._serverData = {}; // The last known data for this object from cloud.
17812
17813 this._opSetQueue = [{}]; // List of sets of changes to the data.
17814
17815 this._flags = {};
17816 this.attributes = {}; // The best estimate of this's current data.
17817
17818 this._hashedJSON = {}; // Hash of values of containers at last save.
17819
17820 this._escapedAttributes = {};
17821 this.cid = _.uniqueId('c');
17822 this.changed = {};
17823 this._silent = {};
17824 this._pending = {};
17825 this.set(attributes, {
17826 silent: true
17827 });
17828 this.changed = {};
17829 this._silent = {};
17830 this._pending = {};
17831 this._hasData = true;
17832 this._previousAttributes = _.clone(this.attributes);
17833 this.initialize.apply(this, arguments);
17834 };
17835 /**
17836 * @lends AV.Object.prototype
17837 * @property {String} id The objectId of the AV Object.
17838 */
17839
17840 /**
17841 * Saves the given list of AV.Object.
17842 * If any error is encountered, stops and calls the error handler.
17843 *
17844 * @example
17845 * AV.Object.saveAll([object1, object2, ...]).then(function(list) {
17846 * // All the objects were saved.
17847 * }, function(error) {
17848 * // An error occurred while saving one of the objects.
17849 * });
17850 *
17851 * @param {Array} list A list of <code>AV.Object</code>.
17852 */
17853
17854
17855 AV.Object.saveAll = function (list, options) {
17856 return AV.Object._deepSaveAsync(list, null, options);
17857 };
17858 /**
17859 * Fetch the given list of AV.Object.
17860 *
17861 * @param {AV.Object[]} objects A list of <code>AV.Object</code>
17862 * @param {AuthOptions} options
17863 * @return {Promise.<AV.Object[]>} The given list of <code>AV.Object</code>, updated
17864 */
17865
17866
17867 AV.Object.fetchAll = function (objects, options) {
17868 return _promise.default.resolve().then(function () {
17869 return _request('batch', null, null, 'POST', {
17870 requests: (0, _map.default)(_).call(_, objects, function (object) {
17871 var _context;
17872
17873 if (!object.className) throw new Error('object must have className to fetch');
17874 if (!object.id) throw new Error('object must have id to fetch');
17875 if (object.dirty()) throw new Error('object is modified but not saved');
17876 return {
17877 method: 'GET',
17878 path: (0, _concat.default)(_context = "/1.1/classes/".concat(object.className, "/")).call(_context, object.id)
17879 };
17880 })
17881 }, options);
17882 }).then(function (response) {
17883 var results = (0, _map.default)(_).call(_, objects, function (object, i) {
17884 if (response[i].success) {
17885 var fetchedAttrs = object.parse(response[i].success);
17886
17887 object._cleanupUnsetKeys(fetchedAttrs);
17888
17889 object._finishFetch(fetchedAttrs);
17890
17891 return object;
17892 }
17893
17894 if (response[i].success === null) {
17895 return new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
17896 }
17897
17898 return new AVError(response[i].error.code, response[i].error.error);
17899 });
17900 return handleBatchResults(results);
17901 });
17902 }; // Attach all inheritable methods to the AV.Object prototype.
17903
17904
17905 _.extend(AV.Object.prototype, AV.Events,
17906 /** @lends AV.Object.prototype */
17907 {
17908 _fetchWhenSave: false,
17909
17910 /**
17911 * Initialize is an empty function by default. Override it with your own
17912 * initialization logic.
17913 */
17914 initialize: function initialize() {},
17915
17916 /**
17917 * Set whether to enable fetchWhenSave option when updating object.
17918 * When set true, SDK would fetch the latest object after saving.
17919 * Default is false.
17920 *
17921 * @deprecated use AV.Object#save with options.fetchWhenSave instead
17922 * @param {boolean} enable true to enable fetchWhenSave option.
17923 */
17924 fetchWhenSave: function fetchWhenSave(enable) {
17925 console.warn('AV.Object#fetchWhenSave is deprecated, use AV.Object#save with options.fetchWhenSave instead.');
17926
17927 if (!_.isBoolean(enable)) {
17928 throw new Error('Expect boolean value for fetchWhenSave');
17929 }
17930
17931 this._fetchWhenSave = enable;
17932 },
17933
17934 /**
17935 * Returns the object's objectId.
17936 * @return {String} the objectId.
17937 */
17938 getObjectId: function getObjectId() {
17939 return this.id;
17940 },
17941
17942 /**
17943 * Returns the object's createdAt attribute.
17944 * @return {Date}
17945 */
17946 getCreatedAt: function getCreatedAt() {
17947 return this.createdAt;
17948 },
17949
17950 /**
17951 * Returns the object's updatedAt attribute.
17952 * @return {Date}
17953 */
17954 getUpdatedAt: function getUpdatedAt() {
17955 return this.updatedAt;
17956 },
17957
17958 /**
17959 * Returns a JSON version of the object.
17960 * @return {Object}
17961 */
17962 toJSON: function toJSON(key, holder) {
17963 var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
17964 return this._toFullJSON(seenObjects, false);
17965 },
17966
17967 /**
17968 * Returns a JSON version of the object with meta data.
17969 * Inverse to {@link AV.parseJSON}
17970 * @since 3.0.0
17971 * @return {Object}
17972 */
17973 toFullJSON: function toFullJSON() {
17974 var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
17975 return this._toFullJSON(seenObjects);
17976 },
17977 _toFullJSON: function _toFullJSON(seenObjects) {
17978 var _this = this;
17979
17980 var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
17981
17982 var json = _.clone(this.attributes);
17983
17984 if (_.isArray(seenObjects)) {
17985 var newSeenObjects = (0, _concat.default)(seenObjects).call(seenObjects, this);
17986 }
17987
17988 AV._objectEach(json, function (val, key) {
17989 json[key] = AV._encode(val, newSeenObjects, undefined, full);
17990 });
17991
17992 AV._objectEach(this._operations, function (val, key) {
17993 json[key] = val;
17994 });
17995
17996 if (_.has(this, 'id')) {
17997 json.objectId = this.id;
17998 }
17999
18000 ['createdAt', 'updatedAt'].forEach(function (key) {
18001 if (_.has(_this, key)) {
18002 var val = _this[key];
18003 json[key] = _.isDate(val) ? val.toJSON() : val;
18004 }
18005 });
18006
18007 if (full) {
18008 json.__type = 'Object';
18009 if (_.isArray(seenObjects) && seenObjects.length) json.__type = 'Pointer';
18010 json.className = this.className;
18011 }
18012
18013 return json;
18014 },
18015
18016 /**
18017 * Updates _hashedJSON to reflect the current state of this object.
18018 * Adds any changed hash values to the set of pending changes.
18019 * @private
18020 */
18021 _refreshCache: function _refreshCache() {
18022 var self = this;
18023
18024 if (self._refreshingCache) {
18025 return;
18026 }
18027
18028 self._refreshingCache = true;
18029
18030 AV._objectEach(this.attributes, function (value, key) {
18031 if (value instanceof AV.Object) {
18032 value._refreshCache();
18033 } else if (_.isObject(value)) {
18034 if (self._resetCacheForKey(key)) {
18035 self.set(key, new AV.Op.Set(value), {
18036 silent: true
18037 });
18038 }
18039 }
18040 });
18041
18042 delete self._refreshingCache;
18043 },
18044
18045 /**
18046 * Returns true if this object has been modified since its last
18047 * save/refresh. If an attribute is specified, it returns true only if that
18048 * particular attribute has been modified since the last save/refresh.
18049 * @param {String} attr An attribute name (optional).
18050 * @return {Boolean}
18051 */
18052 dirty: function dirty(attr) {
18053 this._refreshCache();
18054
18055 var currentChanges = _.last(this._opSetQueue);
18056
18057 if (attr) {
18058 return currentChanges[attr] ? true : false;
18059 }
18060
18061 if (!this.id) {
18062 return true;
18063 }
18064
18065 if ((0, _keys2.default)(_).call(_, currentChanges).length > 0) {
18066 return true;
18067 }
18068
18069 return false;
18070 },
18071
18072 /**
18073 * Returns the keys of the modified attribute since its last save/refresh.
18074 * @return {String[]}
18075 */
18076 dirtyKeys: function dirtyKeys() {
18077 this._refreshCache();
18078
18079 var currentChanges = _.last(this._opSetQueue);
18080
18081 return (0, _keys2.default)(_).call(_, currentChanges);
18082 },
18083
18084 /**
18085 * Gets a Pointer referencing this Object.
18086 * @private
18087 */
18088 _toPointer: function _toPointer() {
18089 // if (!this.id) {
18090 // throw new Error("Can't serialize an unsaved AV.Object");
18091 // }
18092 return {
18093 __type: 'Pointer',
18094 className: this.className,
18095 objectId: this.id
18096 };
18097 },
18098
18099 /**
18100 * Gets the value of an attribute.
18101 * @param {String} attr The string name of an attribute.
18102 */
18103 get: function get(attr) {
18104 switch (attr) {
18105 case 'objectId':
18106 return this.id;
18107
18108 case 'createdAt':
18109 case 'updatedAt':
18110 return this[attr];
18111
18112 default:
18113 return this.attributes[attr];
18114 }
18115 },
18116
18117 /**
18118 * Gets a relation on the given class for the attribute.
18119 * @param {String} attr The attribute to get the relation for.
18120 * @return {AV.Relation}
18121 */
18122 relation: function relation(attr) {
18123 var value = this.get(attr);
18124
18125 if (value) {
18126 if (!(value instanceof AV.Relation)) {
18127 throw new Error('Called relation() on non-relation field ' + attr);
18128 }
18129
18130 value._ensureParentAndKey(this, attr);
18131
18132 return value;
18133 } else {
18134 return new AV.Relation(this, attr);
18135 }
18136 },
18137
18138 /**
18139 * Gets the HTML-escaped value of an attribute.
18140 */
18141 escape: function escape(attr) {
18142 var html = this._escapedAttributes[attr];
18143
18144 if (html) {
18145 return html;
18146 }
18147
18148 var val = this.attributes[attr];
18149 var escaped;
18150
18151 if (isNullOrUndefined(val)) {
18152 escaped = '';
18153 } else {
18154 escaped = _.escape(val.toString());
18155 }
18156
18157 this._escapedAttributes[attr] = escaped;
18158 return escaped;
18159 },
18160
18161 /**
18162 * Returns <code>true</code> if the attribute contains a value that is not
18163 * null or undefined.
18164 * @param {String} attr The string name of the attribute.
18165 * @return {Boolean}
18166 */
18167 has: function has(attr) {
18168 return !isNullOrUndefined(this.attributes[attr]);
18169 },
18170
18171 /**
18172 * Pulls "special" fields like objectId, createdAt, etc. out of attrs
18173 * and puts them on "this" directly. Removes them from attrs.
18174 * @param attrs - A dictionary with the data for this AV.Object.
18175 * @private
18176 */
18177 _mergeMagicFields: function _mergeMagicFields(attrs) {
18178 // Check for changes of magic fields.
18179 var model = this;
18180 var specialFields = ['objectId', 'createdAt', 'updatedAt'];
18181
18182 AV._arrayEach(specialFields, function (attr) {
18183 if (attrs[attr]) {
18184 if (attr === 'objectId') {
18185 model.id = attrs[attr];
18186 } else if ((attr === 'createdAt' || attr === 'updatedAt') && !_.isDate(attrs[attr])) {
18187 model[attr] = AV._parseDate(attrs[attr]);
18188 } else {
18189 model[attr] = attrs[attr];
18190 }
18191
18192 delete attrs[attr];
18193 }
18194 });
18195
18196 return attrs;
18197 },
18198
18199 /**
18200 * Returns the json to be sent to the server.
18201 * @private
18202 */
18203 _startSave: function _startSave() {
18204 this._opSetQueue.push({});
18205 },
18206
18207 /**
18208 * Called when a save fails because of an error. Any changes that were part
18209 * of the save need to be merged with changes made after the save. This
18210 * might throw an exception is you do conflicting operations. For example,
18211 * if you do:
18212 * object.set("foo", "bar");
18213 * object.set("invalid field name", "baz");
18214 * object.save();
18215 * object.increment("foo");
18216 * then this will throw when the save fails and the client tries to merge
18217 * "bar" with the +1.
18218 * @private
18219 */
18220 _cancelSave: function _cancelSave() {
18221 var failedChanges = _.first(this._opSetQueue);
18222
18223 this._opSetQueue = _.rest(this._opSetQueue);
18224
18225 var nextChanges = _.first(this._opSetQueue);
18226
18227 AV._objectEach(failedChanges, function (op, key) {
18228 var op1 = failedChanges[key];
18229 var op2 = nextChanges[key];
18230
18231 if (op1 && op2) {
18232 nextChanges[key] = op2._mergeWithPrevious(op1);
18233 } else if (op1) {
18234 nextChanges[key] = op1;
18235 }
18236 });
18237
18238 this._saving = this._saving - 1;
18239 },
18240
18241 /**
18242 * Called when a save completes successfully. This merges the changes that
18243 * were saved into the known server data, and overrides it with any data
18244 * sent directly from the server.
18245 * @private
18246 */
18247 _finishSave: function _finishSave(serverData) {
18248 var _context2;
18249
18250 // Grab a copy of any object referenced by this object. These instances
18251 // may have already been fetched, and we don't want to lose their data.
18252 // Note that doing it like this means we will unify separate copies of the
18253 // same object, but that's a risk we have to take.
18254 var fetchedObjects = {};
18255
18256 AV._traverse(this.attributes, function (object) {
18257 if (object instanceof AV.Object && object.id && object._hasData) {
18258 fetchedObjects[object.id] = object;
18259 }
18260 });
18261
18262 var savedChanges = _.first(this._opSetQueue);
18263
18264 this._opSetQueue = _.rest(this._opSetQueue);
18265
18266 this._applyOpSet(savedChanges, this._serverData);
18267
18268 this._mergeMagicFields(serverData);
18269
18270 var self = this;
18271
18272 AV._objectEach(serverData, function (value, key) {
18273 self._serverData[key] = AV._decode(value, key); // Look for any objects that might have become unfetched and fix them
18274 // by replacing their values with the previously observed values.
18275
18276 var fetched = AV._traverse(self._serverData[key], function (object) {
18277 if (object instanceof AV.Object && fetchedObjects[object.id]) {
18278 return fetchedObjects[object.id];
18279 }
18280 });
18281
18282 if (fetched) {
18283 self._serverData[key] = fetched;
18284 }
18285 });
18286
18287 this._rebuildAllEstimatedData();
18288
18289 var opSetQueue = (0, _map.default)(_context2 = this._opSetQueue).call(_context2, _.clone);
18290
18291 this._refreshCache();
18292
18293 this._opSetQueue = opSetQueue;
18294 this._saving = this._saving - 1;
18295 },
18296
18297 /**
18298 * Called when a fetch or login is complete to set the known server data to
18299 * the given object.
18300 * @private
18301 */
18302 _finishFetch: function _finishFetch(serverData, hasData) {
18303 // Clear out any changes the user might have made previously.
18304 this._opSetQueue = [{}]; // Bring in all the new server data.
18305
18306 this._mergeMagicFields(serverData);
18307
18308 var self = this;
18309
18310 AV._objectEach(serverData, function (value, key) {
18311 self._serverData[key] = AV._decode(value, key);
18312 }); // Refresh the attributes.
18313
18314
18315 this._rebuildAllEstimatedData(); // Clear out the cache of mutable containers.
18316
18317
18318 this._refreshCache();
18319
18320 this._opSetQueue = [{}];
18321 this._hasData = hasData;
18322 },
18323
18324 /**
18325 * Applies the set of AV.Op in opSet to the object target.
18326 * @private
18327 */
18328 _applyOpSet: function _applyOpSet(opSet, target) {
18329 var self = this;
18330
18331 AV._objectEach(opSet, function (change, key) {
18332 var _findValue = findValue(target, key),
18333 _findValue2 = (0, _slicedToArray2.default)(_findValue, 3),
18334 value = _findValue2[0],
18335 actualTarget = _findValue2[1],
18336 actualKey = _findValue2[2];
18337
18338 setValue(target, key, change._estimate(value, self, key));
18339
18340 if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
18341 delete actualTarget[actualKey];
18342 }
18343 });
18344 },
18345
18346 /**
18347 * Replaces the cached value for key with the current value.
18348 * Returns true if the new value is different than the old value.
18349 * @private
18350 */
18351 _resetCacheForKey: function _resetCacheForKey(key) {
18352 var value = this.attributes[key];
18353
18354 if (_.isObject(value) && !(value instanceof AV.Object) && !(value instanceof AV.File)) {
18355 var json = (0, _stringify.default)(recursiveToPointer(value));
18356
18357 if (this._hashedJSON[key] !== json) {
18358 var wasSet = !!this._hashedJSON[key];
18359 this._hashedJSON[key] = json;
18360 return wasSet;
18361 }
18362 }
18363
18364 return false;
18365 },
18366
18367 /**
18368 * Populates attributes[key] by starting with the last known data from the
18369 * server, and applying all of the local changes that have been made to that
18370 * key since then.
18371 * @private
18372 */
18373 _rebuildEstimatedDataForKey: function _rebuildEstimatedDataForKey(key) {
18374 var self = this;
18375 delete this.attributes[key];
18376
18377 if (this._serverData[key]) {
18378 this.attributes[key] = this._serverData[key];
18379 }
18380
18381 AV._arrayEach(this._opSetQueue, function (opSet) {
18382 var op = opSet[key];
18383
18384 if (op) {
18385 var _findValue3 = findValue(self.attributes, key),
18386 _findValue4 = (0, _slicedToArray2.default)(_findValue3, 4),
18387 value = _findValue4[0],
18388 actualTarget = _findValue4[1],
18389 actualKey = _findValue4[2],
18390 firstKey = _findValue4[3];
18391
18392 setValue(self.attributes, key, op._estimate(value, self, key));
18393
18394 if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
18395 delete actualTarget[actualKey];
18396 }
18397
18398 self._resetCacheForKey(firstKey);
18399 }
18400 });
18401 },
18402
18403 /**
18404 * Populates attributes by starting with the last known data from the
18405 * server, and applying all of the local changes that have been made since
18406 * then.
18407 * @private
18408 */
18409 _rebuildAllEstimatedData: function _rebuildAllEstimatedData() {
18410 var self = this;
18411
18412 var previousAttributes = _.clone(this.attributes);
18413
18414 this.attributes = _.clone(this._serverData);
18415
18416 AV._arrayEach(this._opSetQueue, function (opSet) {
18417 self._applyOpSet(opSet, self.attributes);
18418
18419 AV._objectEach(opSet, function (op, key) {
18420 self._resetCacheForKey(key);
18421 });
18422 }); // Trigger change events for anything that changed because of the fetch.
18423
18424
18425 AV._objectEach(previousAttributes, function (oldValue, key) {
18426 if (self.attributes[key] !== oldValue) {
18427 self.trigger('change:' + key, self, self.attributes[key], {});
18428 }
18429 });
18430
18431 AV._objectEach(this.attributes, function (newValue, key) {
18432 if (!_.has(previousAttributes, key)) {
18433 self.trigger('change:' + key, self, newValue, {});
18434 }
18435 });
18436 },
18437
18438 /**
18439 * Sets a hash of model attributes on the object, firing
18440 * <code>"change"</code> unless you choose to silence it.
18441 *
18442 * <p>You can call it with an object containing keys and values, or with one
18443 * key and value. For example:</p>
18444 *
18445 * @example
18446 * gameTurn.set({
18447 * player: player1,
18448 * diceRoll: 2
18449 * });
18450 *
18451 * game.set("currentPlayer", player2);
18452 *
18453 * game.set("finished", true);
18454 *
18455 * @param {String} key The key to set.
18456 * @param {Any} value The value to give it.
18457 * @param {Object} [options]
18458 * @param {Boolean} [options.silent]
18459 * @return {AV.Object} self if succeeded, throws if the value is not valid.
18460 * @see AV.Object#validate
18461 */
18462 set: function set(key, value, options) {
18463 var attrs;
18464
18465 if (_.isObject(key) || isNullOrUndefined(key)) {
18466 attrs = _.mapObject(key, function (v, k) {
18467 checkReservedKey(k);
18468 return AV._decode(v, k);
18469 });
18470 options = value;
18471 } else {
18472 attrs = {};
18473 checkReservedKey(key);
18474 attrs[key] = AV._decode(value, key);
18475 } // Extract attributes and options.
18476
18477
18478 options = options || {};
18479
18480 if (!attrs) {
18481 return this;
18482 }
18483
18484 if (attrs instanceof AV.Object) {
18485 attrs = attrs.attributes;
18486 } // If the unset option is used, every attribute should be a Unset.
18487
18488
18489 if (options.unset) {
18490 AV._objectEach(attrs, function (unused_value, key) {
18491 attrs[key] = new AV.Op.Unset();
18492 });
18493 } // Apply all the attributes to get the estimated values.
18494
18495
18496 var dataToValidate = _.clone(attrs);
18497
18498 var self = this;
18499
18500 AV._objectEach(dataToValidate, function (value, key) {
18501 if (value instanceof AV.Op) {
18502 dataToValidate[key] = value._estimate(self.attributes[key], self, key);
18503
18504 if (dataToValidate[key] === AV.Op._UNSET) {
18505 delete dataToValidate[key];
18506 }
18507 }
18508 }); // Run validation.
18509
18510
18511 this._validate(attrs, options);
18512
18513 options.changes = {};
18514 var escaped = this._escapedAttributes; // Update attributes.
18515
18516 AV._arrayEach((0, _keys2.default)(_).call(_, attrs), function (attr) {
18517 var val = attrs[attr]; // If this is a relation object we need to set the parent correctly,
18518 // since the location where it was parsed does not have access to
18519 // this object.
18520
18521 if (val instanceof AV.Relation) {
18522 val.parent = self;
18523 }
18524
18525 if (!(val instanceof AV.Op)) {
18526 val = new AV.Op.Set(val);
18527 } // See if this change will actually have any effect.
18528
18529
18530 var isRealChange = true;
18531
18532 if (val instanceof AV.Op.Set && _.isEqual(self.attributes[attr], val.value)) {
18533 isRealChange = false;
18534 }
18535
18536 if (isRealChange) {
18537 delete escaped[attr];
18538
18539 if (options.silent) {
18540 self._silent[attr] = true;
18541 } else {
18542 options.changes[attr] = true;
18543 }
18544 }
18545
18546 var currentChanges = _.last(self._opSetQueue);
18547
18548 currentChanges[attr] = val._mergeWithPrevious(currentChanges[attr]);
18549
18550 self._rebuildEstimatedDataForKey(attr);
18551
18552 if (isRealChange) {
18553 self.changed[attr] = self.attributes[attr];
18554
18555 if (!options.silent) {
18556 self._pending[attr] = true;
18557 }
18558 } else {
18559 delete self.changed[attr];
18560 delete self._pending[attr];
18561 }
18562 });
18563
18564 if (!options.silent) {
18565 this.change(options);
18566 }
18567
18568 return this;
18569 },
18570
18571 /**
18572 * Remove an attribute from the model, firing <code>"change"</code> unless
18573 * you choose to silence it. This is a noop if the attribute doesn't
18574 * exist.
18575 * @param key {String} The key.
18576 */
18577 unset: function unset(attr, options) {
18578 options = options || {};
18579 options.unset = true;
18580 return this.set(attr, null, options);
18581 },
18582
18583 /**
18584 * Atomically increments the value of the given attribute the next time the
18585 * object is saved. If no amount is specified, 1 is used by default.
18586 *
18587 * @param key {String} The key.
18588 * @param amount {Number} The amount to increment by.
18589 */
18590 increment: function increment(attr, amount) {
18591 if (_.isUndefined(amount) || _.isNull(amount)) {
18592 amount = 1;
18593 }
18594
18595 return this.set(attr, new AV.Op.Increment(amount));
18596 },
18597
18598 /**
18599 * Atomically add an object to the end of the array associated with a given
18600 * key.
18601 * @param key {String} The key.
18602 * @param item {} The item to add.
18603 */
18604 add: function add(attr, item) {
18605 return this.set(attr, new AV.Op.Add(ensureArray(item)));
18606 },
18607
18608 /**
18609 * Atomically add an object to the array associated with a given key, only
18610 * if it is not already present in the array. The position of the insert is
18611 * not guaranteed.
18612 *
18613 * @param key {String} The key.
18614 * @param item {} The object to add.
18615 */
18616 addUnique: function addUnique(attr, item) {
18617 return this.set(attr, new AV.Op.AddUnique(ensureArray(item)));
18618 },
18619
18620 /**
18621 * Atomically remove all instances of an object from the array associated
18622 * with a given key.
18623 *
18624 * @param key {String} The key.
18625 * @param item {} The object to remove.
18626 */
18627 remove: function remove(attr, item) {
18628 return this.set(attr, new AV.Op.Remove(ensureArray(item)));
18629 },
18630
18631 /**
18632 * Atomically apply a "bit and" operation on the value associated with a
18633 * given key.
18634 *
18635 * @param key {String} The key.
18636 * @param value {Number} The value to apply.
18637 */
18638 bitAnd: function bitAnd(attr, value) {
18639 return this.set(attr, new AV.Op.BitAnd(value));
18640 },
18641
18642 /**
18643 * Atomically apply a "bit or" operation on the value associated with a
18644 * given key.
18645 *
18646 * @param key {String} The key.
18647 * @param value {Number} The value to apply.
18648 */
18649 bitOr: function bitOr(attr, value) {
18650 return this.set(attr, new AV.Op.BitOr(value));
18651 },
18652
18653 /**
18654 * Atomically apply a "bit xor" operation on the value associated with a
18655 * given key.
18656 *
18657 * @param key {String} The key.
18658 * @param value {Number} The value to apply.
18659 */
18660 bitXor: function bitXor(attr, value) {
18661 return this.set(attr, new AV.Op.BitXor(value));
18662 },
18663
18664 /**
18665 * Returns an instance of a subclass of AV.Op describing what kind of
18666 * modification has been performed on this field since the last time it was
18667 * saved. For example, after calling object.increment("x"), calling
18668 * object.op("x") would return an instance of AV.Op.Increment.
18669 *
18670 * @param key {String} The key.
18671 * @returns {AV.Op} The operation, or undefined if none.
18672 */
18673 op: function op(attr) {
18674 return _.last(this._opSetQueue)[attr];
18675 },
18676
18677 /**
18678 * Clear all attributes on the model, firing <code>"change"</code> unless
18679 * you choose to silence it.
18680 */
18681 clear: function clear(options) {
18682 options = options || {};
18683 options.unset = true;
18684
18685 var keysToClear = _.extend(this.attributes, this._operations);
18686
18687 return this.set(keysToClear, options);
18688 },
18689
18690 /**
18691 * Clears any (or specific) changes to the model made since the last save.
18692 * @param {string|string[]} [keys] specify keys to revert.
18693 */
18694 revert: function revert(keys) {
18695 var lastOp = _.last(this._opSetQueue);
18696
18697 var _keys = ensureArray(keys || (0, _keys2.default)(_).call(_, lastOp));
18698
18699 _keys.forEach(function (key) {
18700 delete lastOp[key];
18701 });
18702
18703 this._rebuildAllEstimatedData();
18704
18705 return this;
18706 },
18707
18708 /**
18709 * Returns a JSON-encoded set of operations to be sent with the next save
18710 * request.
18711 * @private
18712 */
18713 _getSaveJSON: function _getSaveJSON() {
18714 var json = _.clone(_.first(this._opSetQueue));
18715
18716 AV._objectEach(json, function (op, key) {
18717 json[key] = op.toJSON();
18718 });
18719
18720 return json;
18721 },
18722
18723 /**
18724 * Returns true if this object can be serialized for saving.
18725 * @private
18726 */
18727 _canBeSerialized: function _canBeSerialized() {
18728 return AV.Object._canBeSerializedAsValue(this.attributes);
18729 },
18730
18731 /**
18732 * Fetch the model from the server. If the server's representation of the
18733 * model differs from its current attributes, they will be overriden,
18734 * triggering a <code>"change"</code> event.
18735 * @param {Object} fetchOptions Optional options to set 'keys',
18736 * 'include' and 'includeACL' option.
18737 * @param {AuthOptions} options
18738 * @return {Promise} A promise that is fulfilled when the fetch
18739 * completes.
18740 */
18741 fetch: function fetch() {
18742 var fetchOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18743 var options = arguments.length > 1 ? arguments[1] : undefined;
18744
18745 if (!this.id) {
18746 throw new Error('Cannot fetch unsaved object');
18747 }
18748
18749 var self = this;
18750
18751 var request = _request('classes', this.className, this.id, 'GET', transformFetchOptions(fetchOptions), options);
18752
18753 return request.then(function (response) {
18754 var fetchedAttrs = self.parse(response);
18755
18756 self._cleanupUnsetKeys(fetchedAttrs, (0, _keys2.default)(fetchOptions) ? ensureArray((0, _keys2.default)(fetchOptions)).join(',').split(',') : undefined);
18757
18758 self._finishFetch(fetchedAttrs, true);
18759
18760 return self;
18761 });
18762 },
18763 _cleanupUnsetKeys: function _cleanupUnsetKeys(fetchedAttrs) {
18764 var _this2 = this;
18765
18766 var fetchedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _keys2.default)(_).call(_, this._serverData);
18767
18768 _.forEach(fetchedKeys, function (key) {
18769 if (fetchedAttrs[key] === undefined) delete _this2._serverData[key];
18770 });
18771 },
18772
18773 /**
18774 * Set a hash of model attributes, and save the model to the server.
18775 * updatedAt will be updated when the request returns.
18776 * You can either call it as:<pre>
18777 * object.save();</pre>
18778 * or<pre>
18779 * object.save(null, options);</pre>
18780 * or<pre>
18781 * object.save(attrs, options);</pre>
18782 * or<pre>
18783 * object.save(key, value, options);</pre>
18784 *
18785 * @example
18786 * gameTurn.save({
18787 * player: "Jake Cutter",
18788 * diceRoll: 2
18789 * }).then(function(gameTurnAgain) {
18790 * // The save was successful.
18791 * }, function(error) {
18792 * // The save failed. Error is an instance of AVError.
18793 * });
18794 *
18795 * @param {AuthOptions} options AuthOptions plus:
18796 * @param {Boolean} options.fetchWhenSave fetch and update object after save succeeded
18797 * @param {AV.Query} options.query Save object only when it matches the query
18798 * @return {Promise} A promise that is fulfilled when the save
18799 * completes.
18800 * @see AVError
18801 */
18802 save: function save(arg1, arg2, arg3) {
18803 var attrs, current, options;
18804
18805 if (_.isObject(arg1) || isNullOrUndefined(arg1)) {
18806 attrs = arg1;
18807 options = arg2;
18808 } else {
18809 attrs = {};
18810 attrs[arg1] = arg2;
18811 options = arg3;
18812 }
18813
18814 options = _.clone(options) || {};
18815
18816 if (options.wait) {
18817 current = _.clone(this.attributes);
18818 }
18819
18820 var setOptions = _.clone(options) || {};
18821
18822 if (setOptions.wait) {
18823 setOptions.silent = true;
18824 }
18825
18826 if (attrs) {
18827 this.set(attrs, setOptions);
18828 }
18829
18830 var model = this;
18831 var unsavedChildren = [];
18832 var unsavedFiles = [];
18833
18834 AV.Object._findUnsavedChildren(model, unsavedChildren, unsavedFiles);
18835
18836 if (unsavedChildren.length + unsavedFiles.length > 1) {
18837 return AV.Object._deepSaveAsync(this, model, options);
18838 }
18839
18840 this._startSave();
18841
18842 this._saving = (this._saving || 0) + 1;
18843 this._allPreviousSaves = this._allPreviousSaves || _promise.default.resolve();
18844 this._allPreviousSaves = this._allPreviousSaves.catch(function (e) {}).then(function () {
18845 var method = model.id ? 'PUT' : 'POST';
18846
18847 var json = model._getSaveJSON();
18848
18849 var query = {};
18850
18851 if (model._fetchWhenSave || options.fetchWhenSave) {
18852 query['new'] = 'true';
18853 } // user login option
18854
18855
18856 if (options._failOnNotExist) {
18857 query.failOnNotExist = 'true';
18858 }
18859
18860 if (options.query) {
18861 var queryParams;
18862
18863 if (typeof options.query._getParams === 'function') {
18864 queryParams = options.query._getParams();
18865
18866 if (queryParams) {
18867 query.where = queryParams.where;
18868 }
18869 }
18870
18871 if (!query.where) {
18872 var error = new Error('options.query is not an AV.Query');
18873 throw error;
18874 }
18875 }
18876
18877 _.extend(json, model._flags);
18878
18879 var route = 'classes';
18880 var className = model.className;
18881
18882 if (model.className === '_User' && !model.id) {
18883 // Special-case user sign-up.
18884 route = 'users';
18885 className = null;
18886 } //hook makeRequest in options.
18887
18888
18889 var makeRequest = options._makeRequest || _request;
18890 var requestPromise = makeRequest(route, className, model.id, method, json, options, query);
18891 requestPromise = requestPromise.then(function (resp) {
18892 var serverAttrs = model.parse(resp);
18893
18894 if (options.wait) {
18895 serverAttrs = _.extend(attrs || {}, serverAttrs);
18896 }
18897
18898 model._finishSave(serverAttrs);
18899
18900 if (options.wait) {
18901 model.set(current, setOptions);
18902 }
18903
18904 return model;
18905 }, function (error) {
18906 model._cancelSave();
18907
18908 throw error;
18909 });
18910 return requestPromise;
18911 });
18912 return this._allPreviousSaves;
18913 },
18914
18915 /**
18916 * Destroy this model on the server if it was already persisted.
18917 * Optimistically removes the model from its collection, if it has one.
18918 * @param {AuthOptions} options AuthOptions plus:
18919 * @param {Boolean} [options.wait] wait for the server to respond
18920 * before removal.
18921 *
18922 * @return {Promise} A promise that is fulfilled when the destroy
18923 * completes.
18924 */
18925 destroy: function destroy(options) {
18926 options = options || {};
18927 var model = this;
18928
18929 var triggerDestroy = function triggerDestroy() {
18930 model.trigger('destroy', model, model.collection, options);
18931 };
18932
18933 if (!this.id) {
18934 return triggerDestroy();
18935 }
18936
18937 if (!options.wait) {
18938 triggerDestroy();
18939 }
18940
18941 var request = _request('classes', this.className, this.id, 'DELETE', this._flags, options);
18942
18943 return request.then(function () {
18944 if (options.wait) {
18945 triggerDestroy();
18946 }
18947
18948 return model;
18949 });
18950 },
18951
18952 /**
18953 * Converts a response into the hash of attributes to be set on the model.
18954 * @ignore
18955 */
18956 parse: function parse(resp) {
18957 var output = _.clone(resp);
18958
18959 ['createdAt', 'updatedAt'].forEach(function (key) {
18960 if (output[key]) {
18961 output[key] = AV._parseDate(output[key]);
18962 }
18963 });
18964
18965 if (output.createdAt && !output.updatedAt) {
18966 output.updatedAt = output.createdAt;
18967 }
18968
18969 return output;
18970 },
18971
18972 /**
18973 * Creates a new model with identical attributes to this one.
18974 * @return {AV.Object}
18975 */
18976 clone: function clone() {
18977 return new this.constructor(this.attributes);
18978 },
18979
18980 /**
18981 * Returns true if this object has never been saved to AV.
18982 * @return {Boolean}
18983 */
18984 isNew: function isNew() {
18985 return !this.id;
18986 },
18987
18988 /**
18989 * Call this method to manually fire a `"change"` event for this model and
18990 * a `"change:attribute"` event for each changed attribute.
18991 * Calling this will cause all objects observing the model to update.
18992 */
18993 change: function change(options) {
18994 options = options || {};
18995 var changing = this._changing;
18996 this._changing = true; // Silent changes become pending changes.
18997
18998 var self = this;
18999
19000 AV._objectEach(this._silent, function (attr) {
19001 self._pending[attr] = true;
19002 }); // Silent changes are triggered.
19003
19004
19005 var changes = _.extend({}, options.changes, this._silent);
19006
19007 this._silent = {};
19008
19009 AV._objectEach(changes, function (unused_value, attr) {
19010 self.trigger('change:' + attr, self, self.get(attr), options);
19011 });
19012
19013 if (changing) {
19014 return this;
19015 } // This is to get around lint not letting us make a function in a loop.
19016
19017
19018 var deleteChanged = function deleteChanged(value, attr) {
19019 if (!self._pending[attr] && !self._silent[attr]) {
19020 delete self.changed[attr];
19021 }
19022 }; // Continue firing `"change"` events while there are pending changes.
19023
19024
19025 while (!_.isEmpty(this._pending)) {
19026 this._pending = {};
19027 this.trigger('change', this, options); // Pending and silent changes still remain.
19028
19029 AV._objectEach(this.changed, deleteChanged);
19030
19031 self._previousAttributes = _.clone(this.attributes);
19032 }
19033
19034 this._changing = false;
19035 return this;
19036 },
19037
19038 /**
19039 * Gets the previous value of an attribute, recorded at the time the last
19040 * <code>"change"</code> event was fired.
19041 * @param {String} attr Name of the attribute to get.
19042 */
19043 previous: function previous(attr) {
19044 if (!arguments.length || !this._previousAttributes) {
19045 return null;
19046 }
19047
19048 return this._previousAttributes[attr];
19049 },
19050
19051 /**
19052 * Gets all of the attributes of the model at the time of the previous
19053 * <code>"change"</code> event.
19054 * @return {Object}
19055 */
19056 previousAttributes: function previousAttributes() {
19057 return _.clone(this._previousAttributes);
19058 },
19059
19060 /**
19061 * Checks if the model is currently in a valid state. It's only possible to
19062 * get into an *invalid* state if you're using silent changes.
19063 * @return {Boolean}
19064 */
19065 isValid: function isValid() {
19066 try {
19067 this.validate(this.attributes);
19068 } catch (error) {
19069 return false;
19070 }
19071
19072 return true;
19073 },
19074
19075 /**
19076 * You should not call this function directly unless you subclass
19077 * <code>AV.Object</code>, in which case you can override this method
19078 * to provide additional validation on <code>set</code> and
19079 * <code>save</code>. Your implementation should throw an Error if
19080 * the attrs is invalid
19081 *
19082 * @param {Object} attrs The current data to validate.
19083 * @see AV.Object#set
19084 */
19085 validate: function validate(attrs) {
19086 if (_.has(attrs, 'ACL') && !(attrs.ACL instanceof AV.ACL)) {
19087 throw new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
19088 }
19089 },
19090
19091 /**
19092 * Run validation against a set of incoming attributes, returning `true`
19093 * if all is well. If a specific `error` callback has been passed,
19094 * call that instead of firing the general `"error"` event.
19095 * @private
19096 */
19097 _validate: function _validate(attrs, options) {
19098 if (options.silent || !this.validate) {
19099 return;
19100 }
19101
19102 attrs = _.extend({}, this.attributes, attrs);
19103 this.validate(attrs);
19104 },
19105
19106 /**
19107 * Returns the ACL for this object.
19108 * @returns {AV.ACL} An instance of AV.ACL.
19109 * @see AV.Object#get
19110 */
19111 getACL: function getACL() {
19112 return this.get('ACL');
19113 },
19114
19115 /**
19116 * Sets the ACL to be used for this object.
19117 * @param {AV.ACL} acl An instance of AV.ACL.
19118 * @param {Object} options Optional Backbone-like options object to be
19119 * passed in to set.
19120 * @return {AV.Object} self
19121 * @see AV.Object#set
19122 */
19123 setACL: function setACL(acl, options) {
19124 return this.set('ACL', acl, options);
19125 },
19126 disableBeforeHook: function disableBeforeHook() {
19127 this.ignoreHook('beforeSave');
19128 this.ignoreHook('beforeUpdate');
19129 this.ignoreHook('beforeDelete');
19130 },
19131 disableAfterHook: function disableAfterHook() {
19132 this.ignoreHook('afterSave');
19133 this.ignoreHook('afterUpdate');
19134 this.ignoreHook('afterDelete');
19135 },
19136 ignoreHook: function ignoreHook(hookName) {
19137 if (!_.contains(['beforeSave', 'afterSave', 'beforeUpdate', 'afterUpdate', 'beforeDelete', 'afterDelete'], hookName)) {
19138 throw new Error('Unsupported hookName: ' + hookName);
19139 }
19140
19141 if (!AV.hookKey) {
19142 throw new Error('ignoreHook required hookKey');
19143 }
19144
19145 if (!this._flags.__ignore_hooks) {
19146 this._flags.__ignore_hooks = [];
19147 }
19148
19149 this._flags.__ignore_hooks.push(hookName);
19150 }
19151 });
19152 /**
19153 * Creates an instance of a subclass of AV.Object for the give classname
19154 * and id.
19155 * @param {String|Function} class the className or a subclass of AV.Object.
19156 * @param {String} id The object id of this model.
19157 * @return {AV.Object} A new subclass instance of AV.Object.
19158 */
19159
19160
19161 AV.Object.createWithoutData = function (klass, id, hasData) {
19162 var _klass;
19163
19164 if (_.isString(klass)) {
19165 _klass = AV.Object._getSubclass(klass);
19166 } else if (klass.prototype && klass.prototype instanceof AV.Object) {
19167 _klass = klass;
19168 } else {
19169 throw new Error('class must be a string or a subclass of AV.Object.');
19170 }
19171
19172 if (!id) {
19173 throw new TypeError('The objectId must be provided');
19174 }
19175
19176 var object = new _klass();
19177 object.id = id;
19178 object._hasData = hasData;
19179 return object;
19180 };
19181 /**
19182 * Delete objects in batch.
19183 * @param {AV.Object[]} objects The <code>AV.Object</code> array to be deleted.
19184 * @param {AuthOptions} options
19185 * @return {Promise} A promise that is fulfilled when the save
19186 * completes.
19187 */
19188
19189
19190 AV.Object.destroyAll = function (objects) {
19191 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19192
19193 if (!objects || objects.length === 0) {
19194 return _promise.default.resolve();
19195 }
19196
19197 var objectsByClassNameAndFlags = _.groupBy(objects, function (object) {
19198 return (0, _stringify.default)({
19199 className: object.className,
19200 flags: object._flags
19201 });
19202 });
19203
19204 var body = {
19205 requests: (0, _map.default)(_).call(_, objectsByClassNameAndFlags, function (objects) {
19206 var _context3;
19207
19208 var ids = (0, _map.default)(_).call(_, objects, 'id').join(',');
19209 return {
19210 method: 'DELETE',
19211 path: (0, _concat.default)(_context3 = "/1.1/classes/".concat(objects[0].className, "/")).call(_context3, ids),
19212 body: objects[0]._flags
19213 };
19214 })
19215 };
19216 return _request('batch', null, null, 'POST', body, options).then(function (response) {
19217 var firstError = (0, _find.default)(_).call(_, response, function (result) {
19218 return !result.success;
19219 });
19220 if (firstError) throw new AVError(firstError.error.code, firstError.error.error);
19221 return undefined;
19222 });
19223 };
19224 /**
19225 * Returns the appropriate subclass for making new instances of the given
19226 * className string.
19227 * @private
19228 */
19229
19230
19231 AV.Object._getSubclass = function (className) {
19232 if (!_.isString(className)) {
19233 throw new Error('AV.Object._getSubclass requires a string argument.');
19234 }
19235
19236 var ObjectClass = AV.Object._classMap[className];
19237
19238 if (!ObjectClass) {
19239 ObjectClass = AV.Object.extend(className);
19240 AV.Object._classMap[className] = ObjectClass;
19241 }
19242
19243 return ObjectClass;
19244 };
19245 /**
19246 * Creates an instance of a subclass of AV.Object for the given classname.
19247 * @private
19248 */
19249
19250
19251 AV.Object._create = function (className, attributes, options) {
19252 var ObjectClass = AV.Object._getSubclass(className);
19253
19254 return new ObjectClass(attributes, options);
19255 }; // Set up a map of className to class so that we can create new instances of
19256 // AV Objects from JSON automatically.
19257
19258
19259 AV.Object._classMap = {};
19260 AV.Object._extend = AV._extend;
19261 /**
19262 * Creates a new model with defined attributes,
19263 * It's the same with
19264 * <pre>
19265 * new AV.Object(attributes, options);
19266 * </pre>
19267 * @param {Object} attributes The initial set of data to store in the object.
19268 * @param {Object} options A set of Backbone-like options for creating the
19269 * object. The only option currently supported is "collection".
19270 * @return {AV.Object}
19271 * @since v0.4.4
19272 * @see AV.Object
19273 * @see AV.Object.extend
19274 */
19275
19276 AV.Object['new'] = function (attributes, options) {
19277 return new AV.Object(attributes, options);
19278 };
19279 /**
19280 * Creates a new subclass of AV.Object for the given AV class name.
19281 *
19282 * <p>Every extension of a AV class will inherit from the most recent
19283 * previous extension of that class. When a AV.Object is automatically
19284 * created by parsing JSON, it will use the most recent extension of that
19285 * class.</p>
19286 *
19287 * @example
19288 * var MyClass = AV.Object.extend("MyClass", {
19289 * // Instance properties
19290 * }, {
19291 * // Class properties
19292 * });
19293 *
19294 * @param {String} className The name of the AV class backing this model.
19295 * @param {Object} protoProps Instance properties to add to instances of the
19296 * class returned from this method.
19297 * @param {Object} classProps Class properties to add the class returned from
19298 * this method.
19299 * @return {Class} A new subclass of AV.Object.
19300 */
19301
19302
19303 AV.Object.extend = function (className, protoProps, classProps) {
19304 // Handle the case with only two args.
19305 if (!_.isString(className)) {
19306 if (className && _.has(className, 'className')) {
19307 return AV.Object.extend(className.className, className, protoProps);
19308 } else {
19309 throw new Error("AV.Object.extend's first argument should be the className.");
19310 }
19311 } // If someone tries to subclass "User", coerce it to the right type.
19312
19313
19314 if (className === 'User') {
19315 className = '_User';
19316 }
19317
19318 var NewClassObject = null;
19319
19320 if (_.has(AV.Object._classMap, className)) {
19321 var OldClassObject = AV.Object._classMap[className]; // This new subclass has been told to extend both from "this" and from
19322 // OldClassObject. This is multiple inheritance, which isn't supported.
19323 // For now, let's just pick one.
19324
19325 if (protoProps || classProps) {
19326 NewClassObject = OldClassObject._extend(protoProps, classProps);
19327 } else {
19328 return OldClassObject;
19329 }
19330 } else {
19331 protoProps = protoProps || {};
19332 protoProps._className = className;
19333 NewClassObject = this._extend(protoProps, classProps);
19334 } // Extending a subclass should reuse the classname automatically.
19335
19336
19337 NewClassObject.extend = function (arg0) {
19338 var _context4;
19339
19340 if (_.isString(arg0) || arg0 && _.has(arg0, 'className')) {
19341 return AV.Object.extend.apply(NewClassObject, arguments);
19342 }
19343
19344 var newArguments = (0, _concat.default)(_context4 = [className]).call(_context4, _.toArray(arguments));
19345 return AV.Object.extend.apply(NewClassObject, newArguments);
19346 }; // Add the query property descriptor.
19347
19348
19349 (0, _defineProperty.default)(NewClassObject, 'query', (0, _getOwnPropertyDescriptor.default)(AV.Object, 'query'));
19350
19351 NewClassObject['new'] = function (attributes, options) {
19352 return new NewClassObject(attributes, options);
19353 };
19354
19355 AV.Object._classMap[className] = NewClassObject;
19356 return NewClassObject;
19357 }; // ES6 class syntax support
19358
19359
19360 (0, _defineProperty.default)(AV.Object.prototype, 'className', {
19361 get: function get() {
19362 var className = this._className || this.constructor._LCClassName || this.constructor.name; // If someone tries to subclass "User", coerce it to the right type.
19363
19364 if (className === 'User') {
19365 return '_User';
19366 }
19367
19368 return className;
19369 }
19370 });
19371 /**
19372 * Register a class.
19373 * If a subclass of <code>AV.Object</code> is defined with your own implement
19374 * rather then <code>AV.Object.extend</code>, the subclass must be registered.
19375 * @param {Function} klass A subclass of <code>AV.Object</code>
19376 * @param {String} [name] Specify the name of the class. Useful when the class might be uglified.
19377 * @example
19378 * class Person extend AV.Object {}
19379 * AV.Object.register(Person);
19380 */
19381
19382 AV.Object.register = function (klass, name) {
19383 if (!(klass.prototype instanceof AV.Object)) {
19384 throw new Error('registered class is not a subclass of AV.Object');
19385 }
19386
19387 var className = name || klass.name;
19388
19389 if (!className.length) {
19390 throw new Error('registered class must be named');
19391 }
19392
19393 if (name) {
19394 klass._LCClassName = name;
19395 }
19396
19397 AV.Object._classMap[className] = klass;
19398 };
19399 /**
19400 * Get a new Query of the current class
19401 * @name query
19402 * @memberof AV.Object
19403 * @type AV.Query
19404 * @readonly
19405 * @since v3.1.0
19406 * @example
19407 * const Post = AV.Object.extend('Post');
19408 * Post.query.equalTo('author', 'leancloud').find().then();
19409 */
19410
19411
19412 (0, _defineProperty.default)(AV.Object, 'query', {
19413 get: function get() {
19414 return new AV.Query(this.prototype.className);
19415 }
19416 });
19417
19418 AV.Object._findUnsavedChildren = function (objects, children, files) {
19419 AV._traverse(objects, function (object) {
19420 if (object instanceof AV.Object) {
19421 if (object.dirty()) {
19422 children.push(object);
19423 }
19424
19425 return;
19426 }
19427
19428 if (object instanceof AV.File) {
19429 if (!object.id) {
19430 files.push(object);
19431 }
19432
19433 return;
19434 }
19435 });
19436 };
19437
19438 AV.Object._canBeSerializedAsValue = function (object) {
19439 var canBeSerializedAsValue = true;
19440
19441 if (object instanceof AV.Object || object instanceof AV.File) {
19442 canBeSerializedAsValue = !!object.id;
19443 } else if (_.isArray(object)) {
19444 AV._arrayEach(object, function (child) {
19445 if (!AV.Object._canBeSerializedAsValue(child)) {
19446 canBeSerializedAsValue = false;
19447 }
19448 });
19449 } else if (_.isObject(object)) {
19450 AV._objectEach(object, function (child) {
19451 if (!AV.Object._canBeSerializedAsValue(child)) {
19452 canBeSerializedAsValue = false;
19453 }
19454 });
19455 }
19456
19457 return canBeSerializedAsValue;
19458 };
19459
19460 AV.Object._deepSaveAsync = function (object, model, options) {
19461 var unsavedChildren = [];
19462 var unsavedFiles = [];
19463
19464 AV.Object._findUnsavedChildren(object, unsavedChildren, unsavedFiles);
19465
19466 unsavedFiles = _.uniq(unsavedFiles);
19467
19468 var promise = _promise.default.resolve();
19469
19470 _.each(unsavedFiles, function (file) {
19471 promise = promise.then(function () {
19472 return file.save();
19473 });
19474 });
19475
19476 var objects = _.uniq(unsavedChildren);
19477
19478 var remaining = _.uniq(objects);
19479
19480 return promise.then(function () {
19481 return continueWhile(function () {
19482 return remaining.length > 0;
19483 }, function () {
19484 // Gather up all the objects that can be saved in this batch.
19485 var batch = [];
19486 var newRemaining = [];
19487
19488 AV._arrayEach(remaining, function (object) {
19489 if (object._canBeSerialized()) {
19490 batch.push(object);
19491 } else {
19492 newRemaining.push(object);
19493 }
19494 });
19495
19496 remaining = newRemaining; // If we can't save any objects, there must be a circular reference.
19497
19498 if (batch.length === 0) {
19499 return _promise.default.reject(new AVError(AVError.OTHER_CAUSE, 'Tried to save a batch with a cycle.'));
19500 } // Reserve a spot in every object's save queue.
19501
19502
19503 var readyToStart = _promise.default.resolve((0, _map.default)(_).call(_, batch, function (object) {
19504 return object._allPreviousSaves || _promise.default.resolve();
19505 })); // Save a single batch, whether previous saves succeeded or failed.
19506
19507
19508 var bathSavePromise = readyToStart.then(function () {
19509 return _request('batch', null, null, 'POST', {
19510 requests: (0, _map.default)(_).call(_, batch, function (object) {
19511 var method = object.id ? 'PUT' : 'POST';
19512
19513 var json = object._getSaveJSON();
19514
19515 _.extend(json, object._flags);
19516
19517 var route = 'classes';
19518 var className = object.className;
19519 var path = "/".concat(route, "/").concat(className);
19520
19521 if (object.className === '_User' && !object.id) {
19522 // Special-case user sign-up.
19523 path = '/users';
19524 }
19525
19526 var path = "/1.1".concat(path);
19527
19528 if (object.id) {
19529 path = path + '/' + object.id;
19530 }
19531
19532 object._startSave();
19533
19534 return {
19535 method: method,
19536 path: path,
19537 body: json,
19538 params: options && options.fetchWhenSave ? {
19539 fetchWhenSave: true
19540 } : undefined
19541 };
19542 })
19543 }, options).then(function (response) {
19544 var results = (0, _map.default)(_).call(_, batch, function (object, i) {
19545 if (response[i].success) {
19546 object._finishSave(object.parse(response[i].success));
19547
19548 return object;
19549 }
19550
19551 object._cancelSave();
19552
19553 return new AVError(response[i].error.code, response[i].error.error);
19554 });
19555 return handleBatchResults(results);
19556 });
19557 });
19558
19559 AV._arrayEach(batch, function (object) {
19560 object._allPreviousSaves = bathSavePromise;
19561 });
19562
19563 return bathSavePromise;
19564 });
19565 }).then(function () {
19566 return object;
19567 });
19568 };
19569};
19570
19571/***/ }),
19572/* 536 */
19573/***/ (function(module, exports, __webpack_require__) {
19574
19575var arrayWithHoles = __webpack_require__(537);
19576
19577var iterableToArrayLimit = __webpack_require__(545);
19578
19579var unsupportedIterableToArray = __webpack_require__(546);
19580
19581var nonIterableRest = __webpack_require__(556);
19582
19583function _slicedToArray(arr, i) {
19584 return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
19585}
19586
19587module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
19588
19589/***/ }),
19590/* 537 */
19591/***/ (function(module, exports, __webpack_require__) {
19592
19593var _Array$isArray = __webpack_require__(538);
19594
19595function _arrayWithHoles(arr) {
19596 if (_Array$isArray(arr)) return arr;
19597}
19598
19599module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
19600
19601/***/ }),
19602/* 538 */
19603/***/ (function(module, exports, __webpack_require__) {
19604
19605module.exports = __webpack_require__(539);
19606
19607/***/ }),
19608/* 539 */
19609/***/ (function(module, exports, __webpack_require__) {
19610
19611module.exports = __webpack_require__(540);
19612
19613
19614/***/ }),
19615/* 540 */
19616/***/ (function(module, exports, __webpack_require__) {
19617
19618var parent = __webpack_require__(541);
19619
19620module.exports = parent;
19621
19622
19623/***/ }),
19624/* 541 */
19625/***/ (function(module, exports, __webpack_require__) {
19626
19627var parent = __webpack_require__(542);
19628
19629module.exports = parent;
19630
19631
19632/***/ }),
19633/* 542 */
19634/***/ (function(module, exports, __webpack_require__) {
19635
19636var parent = __webpack_require__(543);
19637
19638module.exports = parent;
19639
19640
19641/***/ }),
19642/* 543 */
19643/***/ (function(module, exports, __webpack_require__) {
19644
19645__webpack_require__(544);
19646var path = __webpack_require__(7);
19647
19648module.exports = path.Array.isArray;
19649
19650
19651/***/ }),
19652/* 544 */
19653/***/ (function(module, exports, __webpack_require__) {
19654
19655var $ = __webpack_require__(0);
19656var isArray = __webpack_require__(92);
19657
19658// `Array.isArray` method
19659// https://tc39.es/ecma262/#sec-array.isarray
19660$({ target: 'Array', stat: true }, {
19661 isArray: isArray
19662});
19663
19664
19665/***/ }),
19666/* 545 */
19667/***/ (function(module, exports, __webpack_require__) {
19668
19669var _Symbol = __webpack_require__(241);
19670
19671var _getIteratorMethod = __webpack_require__(253);
19672
19673function _iterableToArrayLimit(arr, i) {
19674 var _i = arr == null ? null : typeof _Symbol !== "undefined" && _getIteratorMethod(arr) || arr["@@iterator"];
19675
19676 if (_i == null) return;
19677 var _arr = [];
19678 var _n = true;
19679 var _d = false;
19680
19681 var _s, _e;
19682
19683 try {
19684 for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
19685 _arr.push(_s.value);
19686
19687 if (i && _arr.length === i) break;
19688 }
19689 } catch (err) {
19690 _d = true;
19691 _e = err;
19692 } finally {
19693 try {
19694 if (!_n && _i["return"] != null) _i["return"]();
19695 } finally {
19696 if (_d) throw _e;
19697 }
19698 }
19699
19700 return _arr;
19701}
19702
19703module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
19704
19705/***/ }),
19706/* 546 */
19707/***/ (function(module, exports, __webpack_require__) {
19708
19709var _sliceInstanceProperty = __webpack_require__(547);
19710
19711var _Array$from = __webpack_require__(551);
19712
19713var arrayLikeToArray = __webpack_require__(555);
19714
19715function _unsupportedIterableToArray(o, minLen) {
19716 var _context;
19717
19718 if (!o) return;
19719 if (typeof o === "string") return arrayLikeToArray(o, minLen);
19720
19721 var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 8, -1);
19722
19723 if (n === "Object" && o.constructor) n = o.constructor.name;
19724 if (n === "Map" || n === "Set") return _Array$from(o);
19725 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
19726}
19727
19728module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
19729
19730/***/ }),
19731/* 547 */
19732/***/ (function(module, exports, __webpack_require__) {
19733
19734module.exports = __webpack_require__(548);
19735
19736/***/ }),
19737/* 548 */
19738/***/ (function(module, exports, __webpack_require__) {
19739
19740module.exports = __webpack_require__(549);
19741
19742
19743/***/ }),
19744/* 549 */
19745/***/ (function(module, exports, __webpack_require__) {
19746
19747var parent = __webpack_require__(550);
19748
19749module.exports = parent;
19750
19751
19752/***/ }),
19753/* 550 */
19754/***/ (function(module, exports, __webpack_require__) {
19755
19756var parent = __webpack_require__(239);
19757
19758module.exports = parent;
19759
19760
19761/***/ }),
19762/* 551 */
19763/***/ (function(module, exports, __webpack_require__) {
19764
19765module.exports = __webpack_require__(552);
19766
19767/***/ }),
19768/* 552 */
19769/***/ (function(module, exports, __webpack_require__) {
19770
19771module.exports = __webpack_require__(553);
19772
19773
19774/***/ }),
19775/* 553 */
19776/***/ (function(module, exports, __webpack_require__) {
19777
19778var parent = __webpack_require__(554);
19779
19780module.exports = parent;
19781
19782
19783/***/ }),
19784/* 554 */
19785/***/ (function(module, exports, __webpack_require__) {
19786
19787var parent = __webpack_require__(252);
19788
19789module.exports = parent;
19790
19791
19792/***/ }),
19793/* 555 */
19794/***/ (function(module, exports) {
19795
19796function _arrayLikeToArray(arr, len) {
19797 if (len == null || len > arr.length) len = arr.length;
19798
19799 for (var i = 0, arr2 = new Array(len); i < len; i++) {
19800 arr2[i] = arr[i];
19801 }
19802
19803 return arr2;
19804}
19805
19806module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
19807
19808/***/ }),
19809/* 556 */
19810/***/ (function(module, exports) {
19811
19812function _nonIterableRest() {
19813 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
19814}
19815
19816module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
19817
19818/***/ }),
19819/* 557 */
19820/***/ (function(module, exports, __webpack_require__) {
19821
19822var parent = __webpack_require__(558);
19823
19824module.exports = parent;
19825
19826
19827/***/ }),
19828/* 558 */
19829/***/ (function(module, exports, __webpack_require__) {
19830
19831__webpack_require__(559);
19832var path = __webpack_require__(7);
19833
19834var Object = path.Object;
19835
19836var getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) {
19837 return Object.getOwnPropertyDescriptor(it, key);
19838};
19839
19840if (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true;
19841
19842
19843/***/ }),
19844/* 559 */
19845/***/ (function(module, exports, __webpack_require__) {
19846
19847var $ = __webpack_require__(0);
19848var fails = __webpack_require__(2);
19849var toIndexedObject = __webpack_require__(35);
19850var nativeGetOwnPropertyDescriptor = __webpack_require__(64).f;
19851var DESCRIPTORS = __webpack_require__(14);
19852
19853var FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); });
19854var FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES;
19855
19856// `Object.getOwnPropertyDescriptor` method
19857// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
19858$({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, {
19859 getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
19860 return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key);
19861 }
19862});
19863
19864
19865/***/ }),
19866/* 560 */
19867/***/ (function(module, exports, __webpack_require__) {
19868
19869"use strict";
19870
19871
19872var _ = __webpack_require__(3);
19873
19874var AVError = __webpack_require__(48);
19875
19876module.exports = function (AV) {
19877 AV.Role = AV.Object.extend('_Role',
19878 /** @lends AV.Role.prototype */
19879 {
19880 // Instance Methods
19881
19882 /**
19883 * Represents a Role on the AV server. Roles represent groupings of
19884 * Users for the purposes of granting permissions (e.g. specifying an ACL
19885 * for an Object). Roles are specified by their sets of child users and
19886 * child roles, all of which are granted any permissions that the parent
19887 * role has.
19888 *
19889 * <p>Roles must have a name (which cannot be changed after creation of the
19890 * role), and must specify an ACL.</p>
19891 * An AV.Role is a local representation of a role persisted to the AV
19892 * cloud.
19893 * @class AV.Role
19894 * @param {String} name The name of the Role to create.
19895 * @param {AV.ACL} acl The ACL for this role.
19896 */
19897 constructor: function constructor(name, acl) {
19898 if (_.isString(name)) {
19899 AV.Object.prototype.constructor.call(this, null, null);
19900 this.setName(name);
19901 } else {
19902 AV.Object.prototype.constructor.call(this, name, acl);
19903 }
19904
19905 if (acl) {
19906 if (!(acl instanceof AV.ACL)) {
19907 throw new TypeError('acl must be an instance of AV.ACL');
19908 } else {
19909 this.setACL(acl);
19910 }
19911 }
19912 },
19913
19914 /**
19915 * Gets the name of the role. You can alternatively call role.get("name")
19916 *
19917 * @return {String} the name of the role.
19918 */
19919 getName: function getName() {
19920 return this.get('name');
19921 },
19922
19923 /**
19924 * Sets the name for a role. This value must be set before the role has
19925 * been saved to the server, and cannot be set once the role has been
19926 * saved.
19927 *
19928 * <p>
19929 * A role's name can only contain alphanumeric characters, _, -, and
19930 * spaces.
19931 * </p>
19932 *
19933 * <p>This is equivalent to calling role.set("name", name)</p>
19934 *
19935 * @param {String} name The name of the role.
19936 */
19937 setName: function setName(name, options) {
19938 return this.set('name', name, options);
19939 },
19940
19941 /**
19942 * Gets the AV.Relation for the AV.Users that are direct
19943 * children of this role. These users are granted any privileges that this
19944 * role has been granted (e.g. read or write access through ACLs). You can
19945 * add or remove users from the role through this relation.
19946 *
19947 * <p>This is equivalent to calling role.relation("users")</p>
19948 *
19949 * @return {AV.Relation} the relation for the users belonging to this
19950 * role.
19951 */
19952 getUsers: function getUsers() {
19953 return this.relation('users');
19954 },
19955
19956 /**
19957 * Gets the AV.Relation for the AV.Roles that are direct
19958 * children of this role. These roles' users are granted any privileges that
19959 * this role has been granted (e.g. read or write access through ACLs). You
19960 * can add or remove child roles from this role through this relation.
19961 *
19962 * <p>This is equivalent to calling role.relation("roles")</p>
19963 *
19964 * @return {AV.Relation} the relation for the roles belonging to this
19965 * role.
19966 */
19967 getRoles: function getRoles() {
19968 return this.relation('roles');
19969 },
19970
19971 /**
19972 * @ignore
19973 */
19974 validate: function validate(attrs, options) {
19975 if ('name' in attrs && attrs.name !== this.getName()) {
19976 var newName = attrs.name;
19977
19978 if (this.id && this.id !== attrs.objectId) {
19979 // Check to see if the objectId being set matches this.id.
19980 // This happens during a fetch -- the id is set before calling fetch.
19981 // Let the name be set in this case.
19982 return new AVError(AVError.OTHER_CAUSE, "A role's name can only be set before it has been saved.");
19983 }
19984
19985 if (!_.isString(newName)) {
19986 return new AVError(AVError.OTHER_CAUSE, "A role's name must be a String.");
19987 }
19988
19989 if (!/^[0-9a-zA-Z\-_ ]+$/.test(newName)) {
19990 return new AVError(AVError.OTHER_CAUSE, "A role's name can only contain alphanumeric characters, _," + ' -, and spaces.');
19991 }
19992 }
19993
19994 if (AV.Object.prototype.validate) {
19995 return AV.Object.prototype.validate.call(this, attrs, options);
19996 }
19997
19998 return false;
19999 }
20000 });
20001};
20002
20003/***/ }),
20004/* 561 */
20005/***/ (function(module, exports, __webpack_require__) {
20006
20007"use strict";
20008
20009
20010var _interopRequireDefault = __webpack_require__(1);
20011
20012var _defineProperty2 = _interopRequireDefault(__webpack_require__(562));
20013
20014var _promise = _interopRequireDefault(__webpack_require__(12));
20015
20016var _map = _interopRequireDefault(__webpack_require__(37));
20017
20018var _find = _interopRequireDefault(__webpack_require__(96));
20019
20020var _stringify = _interopRequireDefault(__webpack_require__(38));
20021
20022var _ = __webpack_require__(3);
20023
20024var uuid = __webpack_require__(231);
20025
20026var AVError = __webpack_require__(48);
20027
20028var _require = __webpack_require__(28),
20029 AVRequest = _require._request,
20030 request = _require.request;
20031
20032var _require2 = __webpack_require__(76),
20033 getAdapter = _require2.getAdapter;
20034
20035var PLATFORM_ANONYMOUS = 'anonymous';
20036var PLATFORM_QQAPP = 'lc_qqapp';
20037
20038var mergeUnionDataIntoAuthData = function mergeUnionDataIntoAuthData() {
20039 var defaultUnionIdPlatform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'weixin';
20040 return function (authData, unionId) {
20041 var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
20042 _ref$unionIdPlatform = _ref.unionIdPlatform,
20043 unionIdPlatform = _ref$unionIdPlatform === void 0 ? defaultUnionIdPlatform : _ref$unionIdPlatform,
20044 _ref$asMainAccount = _ref.asMainAccount,
20045 asMainAccount = _ref$asMainAccount === void 0 ? false : _ref$asMainAccount;
20046
20047 if (typeof unionId !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionId is not a string');
20048 if (typeof unionIdPlatform !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionIdPlatform is not a string');
20049 return _.extend({}, authData, {
20050 platform: unionIdPlatform,
20051 unionid: unionId,
20052 main_account: Boolean(asMainAccount)
20053 });
20054 };
20055};
20056
20057module.exports = function (AV) {
20058 /**
20059 * @class
20060 *
20061 * <p>An AV.User object is a local representation of a user persisted to the
20062 * LeanCloud server. This class is a subclass of an AV.Object, and retains the
20063 * same functionality of an AV.Object, but also extends it with various
20064 * user specific methods, like authentication, signing up, and validation of
20065 * uniqueness.</p>
20066 */
20067 AV.User = AV.Object.extend('_User',
20068 /** @lends AV.User.prototype */
20069 {
20070 // Instance Variables
20071 _isCurrentUser: false,
20072 // Instance Methods
20073
20074 /**
20075 * Internal method to handle special fields in a _User response.
20076 * @private
20077 */
20078 _mergeMagicFields: function _mergeMagicFields(attrs) {
20079 if (attrs.sessionToken) {
20080 this._sessionToken = attrs.sessionToken;
20081 delete attrs.sessionToken;
20082 }
20083
20084 return AV.User.__super__._mergeMagicFields.call(this, attrs);
20085 },
20086
20087 /**
20088 * Removes null values from authData (which exist temporarily for
20089 * unlinking)
20090 * @private
20091 */
20092 _cleanupAuthData: function _cleanupAuthData() {
20093 if (!this.isCurrent()) {
20094 return;
20095 }
20096
20097 var authData = this.get('authData');
20098
20099 if (!authData) {
20100 return;
20101 }
20102
20103 AV._objectEach(this.get('authData'), function (value, key) {
20104 if (!authData[key]) {
20105 delete authData[key];
20106 }
20107 });
20108 },
20109
20110 /**
20111 * Synchronizes authData for all providers.
20112 * @private
20113 */
20114 _synchronizeAllAuthData: function _synchronizeAllAuthData() {
20115 var authData = this.get('authData');
20116
20117 if (!authData) {
20118 return;
20119 }
20120
20121 var self = this;
20122
20123 AV._objectEach(this.get('authData'), function (value, key) {
20124 self._synchronizeAuthData(key);
20125 });
20126 },
20127
20128 /**
20129 * Synchronizes auth data for a provider (e.g. puts the access token in the
20130 * right place to be used by the Facebook SDK).
20131 * @private
20132 */
20133 _synchronizeAuthData: function _synchronizeAuthData(provider) {
20134 if (!this.isCurrent()) {
20135 return;
20136 }
20137
20138 var authType;
20139
20140 if (_.isString(provider)) {
20141 authType = provider;
20142 provider = AV.User._authProviders[authType];
20143 } else {
20144 authType = provider.getAuthType();
20145 }
20146
20147 var authData = this.get('authData');
20148
20149 if (!authData || !provider) {
20150 return;
20151 }
20152
20153 var success = provider.restoreAuthentication(authData[authType]);
20154
20155 if (!success) {
20156 this.dissociateAuthData(provider);
20157 }
20158 },
20159 _handleSaveResult: function _handleSaveResult(makeCurrent) {
20160 // Clean up and synchronize the authData object, removing any unset values
20161 if (makeCurrent && !AV._config.disableCurrentUser) {
20162 this._isCurrentUser = true;
20163 }
20164
20165 this._cleanupAuthData();
20166
20167 this._synchronizeAllAuthData(); // Don't keep the password around.
20168
20169
20170 delete this._serverData.password;
20171
20172 this._rebuildEstimatedDataForKey('password');
20173
20174 this._refreshCache();
20175
20176 if ((makeCurrent || this.isCurrent()) && !AV._config.disableCurrentUser) {
20177 // Some old version of leanengine-node-sdk will overwrite
20178 // AV.User._saveCurrentUser which returns no Promise.
20179 // So we need a Promise wrapper.
20180 return _promise.default.resolve(AV.User._saveCurrentUser(this));
20181 } else {
20182 return _promise.default.resolve();
20183 }
20184 },
20185
20186 /**
20187 * Unlike in the Android/iOS SDKs, logInWith is unnecessary, since you can
20188 * call linkWith on the user (even if it doesn't exist yet on the server).
20189 * @private
20190 */
20191 _linkWith: function _linkWith(provider, data) {
20192 var _this = this;
20193
20194 var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
20195 _ref2$failOnNotExist = _ref2.failOnNotExist,
20196 failOnNotExist = _ref2$failOnNotExist === void 0 ? false : _ref2$failOnNotExist,
20197 useMasterKey = _ref2.useMasterKey,
20198 sessionToken = _ref2.sessionToken,
20199 user = _ref2.user;
20200
20201 var authType;
20202
20203 if (_.isString(provider)) {
20204 authType = provider;
20205 provider = AV.User._authProviders[provider];
20206 } else {
20207 authType = provider.getAuthType();
20208 }
20209
20210 if (data) {
20211 return this.save({
20212 authData: (0, _defineProperty2.default)({}, authType, data)
20213 }, {
20214 useMasterKey: useMasterKey,
20215 sessionToken: sessionToken,
20216 user: user,
20217 fetchWhenSave: !!this.get('authData'),
20218 _failOnNotExist: failOnNotExist
20219 }).then(function (model) {
20220 return model._handleSaveResult(true).then(function () {
20221 return model;
20222 });
20223 });
20224 } else {
20225 return provider.authenticate().then(function (result) {
20226 return _this._linkWith(provider, result);
20227 });
20228 }
20229 },
20230
20231 /**
20232 * Associate the user with a third party authData.
20233 * @since 3.3.0
20234 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
20235 * @param {string} platform Available platform for sign up.
20236 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
20237 * @example user.associateWithAuthData({
20238 * openid: 'abc123',
20239 * access_token: '123abc',
20240 * expires_in: 1382686496
20241 * }, 'weixin').then(function(user) {
20242 * //Access user here
20243 * }).catch(function(error) {
20244 * //console.error("error: ", error);
20245 * });
20246 */
20247 associateWithAuthData: function associateWithAuthData(authData, platform) {
20248 return this._linkWith(platform, authData);
20249 },
20250
20251 /**
20252 * Associate the user with a third party authData and unionId.
20253 * @since 3.5.0
20254 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
20255 * @param {string} platform Available platform for sign up.
20256 * @param {string} unionId
20257 * @param {Object} [unionLoginOptions]
20258 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
20259 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
20260 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
20261 * @example user.associateWithAuthDataAndUnionId({
20262 * openid: 'abc123',
20263 * access_token: '123abc',
20264 * expires_in: 1382686496
20265 * }, 'weixin', 'union123', {
20266 * unionIdPlatform: 'weixin',
20267 * asMainAccount: true,
20268 * }).then(function(user) {
20269 * //Access user here
20270 * }).catch(function(error) {
20271 * //console.error("error: ", error);
20272 * });
20273 */
20274 associateWithAuthDataAndUnionId: function associateWithAuthDataAndUnionId(authData, platform, unionId, unionOptions) {
20275 return this._linkWith(platform, mergeUnionDataIntoAuthData()(authData, unionId, unionOptions));
20276 },
20277
20278 /**
20279 * Associate the user with the identity of the current mini-app.
20280 * @since 4.6.0
20281 * @param {Object} [authInfo]
20282 * @param {Object} [option]
20283 * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
20284 * @return {Promise<AV.User>}
20285 */
20286 associateWithMiniApp: function associateWithMiniApp(authInfo, option) {
20287 var _this2 = this;
20288
20289 if (authInfo === undefined) {
20290 var getAuthInfo = getAdapter('getAuthInfo');
20291 return getAuthInfo().then(function (authInfo) {
20292 return _this2._linkWith(authInfo.provider, authInfo.authData, option);
20293 });
20294 }
20295
20296 return this._linkWith(authInfo.provider, authInfo.authData, option);
20297 },
20298
20299 /**
20300 * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的微信帐号。
20301 * 仅在 QQ 小程序中可用。
20302 *
20303 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20304 * @since 4.2.0
20305 * @param {Object} [options]
20306 * @param {boolean} [options.preferUnionId = false] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
20307 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
20308 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20309 * @return {Promise<AV.User>}
20310 */
20311 associateWithQQApp: function associateWithQQApp() {
20312 var _this3 = this;
20313
20314 var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20315 _ref3$preferUnionId = _ref3.preferUnionId,
20316 preferUnionId = _ref3$preferUnionId === void 0 ? false : _ref3$preferUnionId,
20317 _ref3$unionIdPlatform = _ref3.unionIdPlatform,
20318 unionIdPlatform = _ref3$unionIdPlatform === void 0 ? 'qq' : _ref3$unionIdPlatform,
20319 _ref3$asMainAccount = _ref3.asMainAccount,
20320 asMainAccount = _ref3$asMainAccount === void 0 ? true : _ref3$asMainAccount;
20321
20322 var getAuthInfo = getAdapter('getAuthInfo');
20323 return getAuthInfo({
20324 preferUnionId: preferUnionId,
20325 asMainAccount: asMainAccount,
20326 platform: unionIdPlatform
20327 }).then(function (authInfo) {
20328 authInfo.provider = PLATFORM_QQAPP;
20329 return _this3.associateWithMiniApp(authInfo);
20330 });
20331 },
20332
20333 /**
20334 * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
20335 * 仅在微信小程序中可用。
20336 *
20337 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20338 * @since 3.13.0
20339 * @param {Object} [options]
20340 * @param {boolean} [options.preferUnionId = false] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否将 UnionId 保存在用户账号中。
20341 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
20342 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20343 * @return {Promise<AV.User>}
20344 */
20345 associateWithWeapp: function associateWithWeapp() {
20346 var _this4 = this;
20347
20348 var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20349 _ref4$preferUnionId = _ref4.preferUnionId,
20350 preferUnionId = _ref4$preferUnionId === void 0 ? false : _ref4$preferUnionId,
20351 _ref4$unionIdPlatform = _ref4.unionIdPlatform,
20352 unionIdPlatform = _ref4$unionIdPlatform === void 0 ? 'weixin' : _ref4$unionIdPlatform,
20353 _ref4$asMainAccount = _ref4.asMainAccount,
20354 asMainAccount = _ref4$asMainAccount === void 0 ? true : _ref4$asMainAccount;
20355
20356 var getAuthInfo = getAdapter('getAuthInfo');
20357 return getAuthInfo({
20358 preferUnionId: preferUnionId,
20359 asMainAccount: asMainAccount,
20360 platform: unionIdPlatform
20361 }).then(function (authInfo) {
20362 return _this4.associateWithMiniApp(authInfo);
20363 });
20364 },
20365
20366 /**
20367 * @deprecated renamed to {@link AV.User#associateWithWeapp}
20368 * @return {Promise<AV.User>}
20369 */
20370 linkWithWeapp: function linkWithWeapp(options) {
20371 console.warn('DEPRECATED: User#linkWithWeapp 已废弃,请使用 User#associateWithWeapp 代替');
20372 return this.associateWithWeapp(options);
20373 },
20374
20375 /**
20376 * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的 QQ 帐号。
20377 * 仅在 QQ 小程序中可用。
20378 *
20379 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20380 * @since 4.2.0
20381 * @param {string} unionId
20382 * @param {Object} [unionOptions]
20383 * @param {string} [unionOptions.unionIdPlatform = 'qq'] unionId platform
20384 * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
20385 * @return {Promise<AV.User>}
20386 */
20387 associateWithQQAppWithUnionId: function associateWithQQAppWithUnionId(unionId) {
20388 var _this5 = this;
20389
20390 var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20391 _ref5$unionIdPlatform = _ref5.unionIdPlatform,
20392 unionIdPlatform = _ref5$unionIdPlatform === void 0 ? 'qq' : _ref5$unionIdPlatform,
20393 _ref5$asMainAccount = _ref5.asMainAccount,
20394 asMainAccount = _ref5$asMainAccount === void 0 ? false : _ref5$asMainAccount;
20395
20396 var getAuthInfo = getAdapter('getAuthInfo');
20397 return getAuthInfo({
20398 platform: unionIdPlatform
20399 }).then(function (authInfo) {
20400 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20401 asMainAccount: asMainAccount
20402 });
20403 authInfo.provider = PLATFORM_QQAPP;
20404 return _this5.associateWithMiniApp(authInfo);
20405 });
20406 },
20407
20408 /**
20409 * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
20410 * 仅在微信小程序中可用。
20411 *
20412 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20413 * @since 3.13.0
20414 * @param {string} unionId
20415 * @param {Object} [unionOptions]
20416 * @param {string} [unionOptions.unionIdPlatform = 'weixin'] unionId platform
20417 * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
20418 * @return {Promise<AV.User>}
20419 */
20420 associateWithWeappWithUnionId: function associateWithWeappWithUnionId(unionId) {
20421 var _this6 = this;
20422
20423 var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20424 _ref6$unionIdPlatform = _ref6.unionIdPlatform,
20425 unionIdPlatform = _ref6$unionIdPlatform === void 0 ? 'weixin' : _ref6$unionIdPlatform,
20426 _ref6$asMainAccount = _ref6.asMainAccount,
20427 asMainAccount = _ref6$asMainAccount === void 0 ? false : _ref6$asMainAccount;
20428
20429 var getAuthInfo = getAdapter('getAuthInfo');
20430 return getAuthInfo({
20431 platform: unionIdPlatform
20432 }).then(function (authInfo) {
20433 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20434 asMainAccount: asMainAccount
20435 });
20436 return _this6.associateWithMiniApp(authInfo);
20437 });
20438 },
20439
20440 /**
20441 * Unlinks a user from a service.
20442 * @param {string} platform
20443 * @return {Promise<AV.User>}
20444 * @since 3.3.0
20445 */
20446 dissociateAuthData: function dissociateAuthData(provider) {
20447 this.unset("authData.".concat(provider));
20448 return this.save().then(function (model) {
20449 return model._handleSaveResult(true).then(function () {
20450 return model;
20451 });
20452 });
20453 },
20454
20455 /**
20456 * @private
20457 * @deprecated
20458 */
20459 _unlinkFrom: function _unlinkFrom(provider) {
20460 console.warn('DEPRECATED: User#_unlinkFrom 已废弃,请使用 User#dissociateAuthData 代替');
20461 return this.dissociateAuthData(provider);
20462 },
20463
20464 /**
20465 * Checks whether a user is linked to a service.
20466 * @private
20467 */
20468 _isLinked: function _isLinked(provider) {
20469 var authType;
20470
20471 if (_.isString(provider)) {
20472 authType = provider;
20473 } else {
20474 authType = provider.getAuthType();
20475 }
20476
20477 var authData = this.get('authData') || {};
20478 return !!authData[authType];
20479 },
20480
20481 /**
20482 * Checks whether a user is anonymous.
20483 * @since 3.9.0
20484 * @return {boolean}
20485 */
20486 isAnonymous: function isAnonymous() {
20487 return this._isLinked(PLATFORM_ANONYMOUS);
20488 },
20489 logOut: function logOut() {
20490 this._logOutWithAll();
20491
20492 this._isCurrentUser = false;
20493 },
20494
20495 /**
20496 * Deauthenticates all providers.
20497 * @private
20498 */
20499 _logOutWithAll: function _logOutWithAll() {
20500 var authData = this.get('authData');
20501
20502 if (!authData) {
20503 return;
20504 }
20505
20506 var self = this;
20507
20508 AV._objectEach(this.get('authData'), function (value, key) {
20509 self._logOutWith(key);
20510 });
20511 },
20512
20513 /**
20514 * Deauthenticates a single provider (e.g. removing access tokens from the
20515 * Facebook SDK).
20516 * @private
20517 */
20518 _logOutWith: function _logOutWith(provider) {
20519 if (!this.isCurrent()) {
20520 return;
20521 }
20522
20523 if (_.isString(provider)) {
20524 provider = AV.User._authProviders[provider];
20525 }
20526
20527 if (provider && provider.deauthenticate) {
20528 provider.deauthenticate();
20529 }
20530 },
20531
20532 /**
20533 * Signs up a new user. You should call this instead of save for
20534 * new AV.Users. This will create a new AV.User on the server, and
20535 * also persist the session on disk so that you can access the user using
20536 * <code>current</code>.
20537 *
20538 * <p>A username and password must be set before calling signUp.</p>
20539 *
20540 * @param {Object} attrs Extra fields to set on the new user, or null.
20541 * @param {AuthOptions} options
20542 * @return {Promise} A promise that is fulfilled when the signup
20543 * finishes.
20544 * @see AV.User.signUp
20545 */
20546 signUp: function signUp(attrs, options) {
20547 var error;
20548 var username = attrs && attrs.username || this.get('username');
20549
20550 if (!username || username === '') {
20551 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty name.');
20552 throw error;
20553 }
20554
20555 var password = attrs && attrs.password || this.get('password');
20556
20557 if (!password || password === '') {
20558 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty password.');
20559 throw error;
20560 }
20561
20562 return this.save(attrs, options).then(function (model) {
20563 if (model.isAnonymous()) {
20564 model.unset("authData.".concat(PLATFORM_ANONYMOUS));
20565 model._opSetQueue = [{}];
20566 }
20567
20568 return model._handleSaveResult(true).then(function () {
20569 return model;
20570 });
20571 });
20572 },
20573
20574 /**
20575 * Signs up a new user with mobile phone and sms code.
20576 * You should call this instead of save for
20577 * new AV.Users. This will create a new AV.User on the server, and
20578 * also persist the session on disk so that you can access the user using
20579 * <code>current</code>.
20580 *
20581 * <p>A username and password must be set before calling signUp.</p>
20582 *
20583 * @param {Object} attrs Extra fields to set on the new user, or null.
20584 * @param {AuthOptions} options
20585 * @return {Promise} A promise that is fulfilled when the signup
20586 * finishes.
20587 * @see AV.User.signUpOrlogInWithMobilePhone
20588 * @see AV.Cloud.requestSmsCode
20589 */
20590 signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(attrs) {
20591 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20592 var error;
20593 var mobilePhoneNumber = attrs && attrs.mobilePhoneNumber || this.get('mobilePhoneNumber');
20594
20595 if (!mobilePhoneNumber || mobilePhoneNumber === '') {
20596 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty mobilePhoneNumber.');
20597 throw error;
20598 }
20599
20600 var smsCode = attrs && attrs.smsCode || this.get('smsCode');
20601
20602 if (!smsCode || smsCode === '') {
20603 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty smsCode.');
20604 throw error;
20605 }
20606
20607 options._makeRequest = function (route, className, id, method, json) {
20608 return AVRequest('usersByMobilePhone', null, null, 'POST', json);
20609 };
20610
20611 return this.save(attrs, options).then(function (model) {
20612 delete model.attributes.smsCode;
20613 delete model._serverData.smsCode;
20614 return model._handleSaveResult(true).then(function () {
20615 return model;
20616 });
20617 });
20618 },
20619
20620 /**
20621 * The same with {@link AV.User.loginWithAuthData}, except that you can set attributes before login.
20622 * @since 3.7.0
20623 */
20624 loginWithAuthData: function loginWithAuthData(authData, platform, options) {
20625 return this._linkWith(platform, authData, options);
20626 },
20627
20628 /**
20629 * The same with {@link AV.User.loginWithAuthDataAndUnionId}, except that you can set attributes before login.
20630 * @since 3.7.0
20631 */
20632 loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
20633 return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
20634 },
20635
20636 /**
20637 * The same with {@link AV.User.loginWithWeapp}, except that you can set attributes before login.
20638 * @deprecated please use {@link AV.User#loginWithMiniApp}
20639 * @since 3.7.0
20640 * @param {Object} [options]
20641 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
20642 * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
20643 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
20644 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20645 * @return {Promise<AV.User>}
20646 */
20647 loginWithWeapp: function loginWithWeapp() {
20648 var _this7 = this;
20649
20650 var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20651 _ref7$preferUnionId = _ref7.preferUnionId,
20652 preferUnionId = _ref7$preferUnionId === void 0 ? false : _ref7$preferUnionId,
20653 _ref7$unionIdPlatform = _ref7.unionIdPlatform,
20654 unionIdPlatform = _ref7$unionIdPlatform === void 0 ? 'weixin' : _ref7$unionIdPlatform,
20655 _ref7$asMainAccount = _ref7.asMainAccount,
20656 asMainAccount = _ref7$asMainAccount === void 0 ? true : _ref7$asMainAccount,
20657 _ref7$failOnNotExist = _ref7.failOnNotExist,
20658 failOnNotExist = _ref7$failOnNotExist === void 0 ? false : _ref7$failOnNotExist,
20659 useMasterKey = _ref7.useMasterKey,
20660 sessionToken = _ref7.sessionToken,
20661 user = _ref7.user;
20662
20663 var getAuthInfo = getAdapter('getAuthInfo');
20664 return getAuthInfo({
20665 preferUnionId: preferUnionId,
20666 asMainAccount: asMainAccount,
20667 platform: unionIdPlatform
20668 }).then(function (authInfo) {
20669 return _this7.loginWithMiniApp(authInfo, {
20670 failOnNotExist: failOnNotExist,
20671 useMasterKey: useMasterKey,
20672 sessionToken: sessionToken,
20673 user: user
20674 });
20675 });
20676 },
20677
20678 /**
20679 * The same with {@link AV.User.loginWithWeappWithUnionId}, except that you can set attributes before login.
20680 * @deprecated please use {@link AV.User#loginWithMiniApp}
20681 * @since 3.13.0
20682 */
20683 loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
20684 var _this8 = this;
20685
20686 var _ref8 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20687 _ref8$unionIdPlatform = _ref8.unionIdPlatform,
20688 unionIdPlatform = _ref8$unionIdPlatform === void 0 ? 'weixin' : _ref8$unionIdPlatform,
20689 _ref8$asMainAccount = _ref8.asMainAccount,
20690 asMainAccount = _ref8$asMainAccount === void 0 ? false : _ref8$asMainAccount,
20691 _ref8$failOnNotExist = _ref8.failOnNotExist,
20692 failOnNotExist = _ref8$failOnNotExist === void 0 ? false : _ref8$failOnNotExist,
20693 useMasterKey = _ref8.useMasterKey,
20694 sessionToken = _ref8.sessionToken,
20695 user = _ref8.user;
20696
20697 var getAuthInfo = getAdapter('getAuthInfo');
20698 return getAuthInfo({
20699 platform: unionIdPlatform
20700 }).then(function (authInfo) {
20701 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20702 asMainAccount: asMainAccount
20703 });
20704 return _this8.loginWithMiniApp(authInfo, {
20705 failOnNotExist: failOnNotExist,
20706 useMasterKey: useMasterKey,
20707 sessionToken: sessionToken,
20708 user: user
20709 });
20710 });
20711 },
20712
20713 /**
20714 * The same with {@link AV.User.loginWithQQApp}, except that you can set attributes before login.
20715 * @deprecated please use {@link AV.User#loginWithMiniApp}
20716 * @since 4.2.0
20717 * @param {Object} [options]
20718 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
20719 * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
20720 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
20721 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20722 */
20723 loginWithQQApp: function loginWithQQApp() {
20724 var _this9 = this;
20725
20726 var _ref9 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20727 _ref9$preferUnionId = _ref9.preferUnionId,
20728 preferUnionId = _ref9$preferUnionId === void 0 ? false : _ref9$preferUnionId,
20729 _ref9$unionIdPlatform = _ref9.unionIdPlatform,
20730 unionIdPlatform = _ref9$unionIdPlatform === void 0 ? 'qq' : _ref9$unionIdPlatform,
20731 _ref9$asMainAccount = _ref9.asMainAccount,
20732 asMainAccount = _ref9$asMainAccount === void 0 ? true : _ref9$asMainAccount,
20733 _ref9$failOnNotExist = _ref9.failOnNotExist,
20734 failOnNotExist = _ref9$failOnNotExist === void 0 ? false : _ref9$failOnNotExist,
20735 useMasterKey = _ref9.useMasterKey,
20736 sessionToken = _ref9.sessionToken,
20737 user = _ref9.user;
20738
20739 var getAuthInfo = getAdapter('getAuthInfo');
20740 return getAuthInfo({
20741 preferUnionId: preferUnionId,
20742 asMainAccount: asMainAccount,
20743 platform: unionIdPlatform
20744 }).then(function (authInfo) {
20745 authInfo.provider = PLATFORM_QQAPP;
20746 return _this9.loginWithMiniApp(authInfo, {
20747 failOnNotExist: failOnNotExist,
20748 useMasterKey: useMasterKey,
20749 sessionToken: sessionToken,
20750 user: user
20751 });
20752 });
20753 },
20754
20755 /**
20756 * The same with {@link AV.User.loginWithQQAppWithUnionId}, except that you can set attributes before login.
20757 * @deprecated please use {@link AV.User#loginWithMiniApp}
20758 * @since 4.2.0
20759 */
20760 loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
20761 var _this10 = this;
20762
20763 var _ref10 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20764 _ref10$unionIdPlatfor = _ref10.unionIdPlatform,
20765 unionIdPlatform = _ref10$unionIdPlatfor === void 0 ? 'qq' : _ref10$unionIdPlatfor,
20766 _ref10$asMainAccount = _ref10.asMainAccount,
20767 asMainAccount = _ref10$asMainAccount === void 0 ? false : _ref10$asMainAccount,
20768 _ref10$failOnNotExist = _ref10.failOnNotExist,
20769 failOnNotExist = _ref10$failOnNotExist === void 0 ? false : _ref10$failOnNotExist,
20770 useMasterKey = _ref10.useMasterKey,
20771 sessionToken = _ref10.sessionToken,
20772 user = _ref10.user;
20773
20774 var getAuthInfo = getAdapter('getAuthInfo');
20775 return getAuthInfo({
20776 platform: unionIdPlatform
20777 }).then(function (authInfo) {
20778 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20779 asMainAccount: asMainAccount
20780 });
20781 authInfo.provider = PLATFORM_QQAPP;
20782 return _this10.loginWithMiniApp(authInfo, {
20783 failOnNotExist: failOnNotExist,
20784 useMasterKey: useMasterKey,
20785 sessionToken: sessionToken,
20786 user: user
20787 });
20788 });
20789 },
20790
20791 /**
20792 * The same with {@link AV.User.loginWithMiniApp}, except that you can set attributes before login.
20793 * @since 4.6.0
20794 */
20795 loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
20796 var _this11 = this;
20797
20798 if (authInfo === undefined) {
20799 var getAuthInfo = getAdapter('getAuthInfo');
20800 return getAuthInfo().then(function (authInfo) {
20801 return _this11.loginWithAuthData(authInfo.authData, authInfo.provider, option);
20802 });
20803 }
20804
20805 return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
20806 },
20807
20808 /**
20809 * Logs in a AV.User. On success, this saves the session to localStorage,
20810 * so you can retrieve the currently logged in user using
20811 * <code>current</code>.
20812 *
20813 * <p>A username and password must be set before calling logIn.</p>
20814 *
20815 * @see AV.User.logIn
20816 * @return {Promise} A promise that is fulfilled with the user when
20817 * the login is complete.
20818 */
20819 logIn: function logIn() {
20820 var model = this;
20821 var request = AVRequest('login', null, null, 'POST', this.toJSON());
20822 return request.then(function (resp) {
20823 var serverAttrs = model.parse(resp);
20824
20825 model._finishFetch(serverAttrs);
20826
20827 return model._handleSaveResult(true).then(function () {
20828 if (!serverAttrs.smsCode) delete model.attributes['smsCode'];
20829 return model;
20830 });
20831 });
20832 },
20833
20834 /**
20835 * @see AV.Object#save
20836 */
20837 save: function save(arg1, arg2, arg3) {
20838 var attrs, options;
20839
20840 if (_.isObject(arg1) || _.isNull(arg1) || _.isUndefined(arg1)) {
20841 attrs = arg1;
20842 options = arg2;
20843 } else {
20844 attrs = {};
20845 attrs[arg1] = arg2;
20846 options = arg3;
20847 }
20848
20849 options = options || {};
20850 return AV.Object.prototype.save.call(this, attrs, options).then(function (model) {
20851 return model._handleSaveResult(false).then(function () {
20852 return model;
20853 });
20854 });
20855 },
20856
20857 /**
20858 * Follow a user
20859 * @since 0.3.0
20860 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
20861 * @param {AV.User | String} options.user The target user or user's objectId to follow.
20862 * @param {Object} [options.attributes] key-value attributes dictionary to be used as
20863 * conditions of followerQuery/followeeQuery.
20864 * @param {AuthOptions} [authOptions]
20865 */
20866 follow: function follow(options, authOptions) {
20867 if (!this.id) {
20868 throw new Error('Please signin.');
20869 }
20870
20871 var user;
20872 var attributes;
20873
20874 if (options.user) {
20875 user = options.user;
20876 attributes = options.attributes;
20877 } else {
20878 user = options;
20879 }
20880
20881 var userObjectId = _.isString(user) ? user : user.id;
20882
20883 if (!userObjectId) {
20884 throw new Error('Invalid target user.');
20885 }
20886
20887 var route = 'users/' + this.id + '/friendship/' + userObjectId;
20888 var request = AVRequest(route, null, null, 'POST', AV._encode(attributes), authOptions);
20889 return request;
20890 },
20891
20892 /**
20893 * Unfollow a user.
20894 * @since 0.3.0
20895 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
20896 * @param {AV.User | String} options.user The target user or user's objectId to unfollow.
20897 * @param {AuthOptions} [authOptions]
20898 */
20899 unfollow: function unfollow(options, authOptions) {
20900 if (!this.id) {
20901 throw new Error('Please signin.');
20902 }
20903
20904 var user;
20905
20906 if (options.user) {
20907 user = options.user;
20908 } else {
20909 user = options;
20910 }
20911
20912 var userObjectId = _.isString(user) ? user : user.id;
20913
20914 if (!userObjectId) {
20915 throw new Error('Invalid target user.');
20916 }
20917
20918 var route = 'users/' + this.id + '/friendship/' + userObjectId;
20919 var request = AVRequest(route, null, null, 'DELETE', null, authOptions);
20920 return request;
20921 },
20922
20923 /**
20924 * Get the user's followers and followees.
20925 * @since 4.8.0
20926 * @param {Object} [options]
20927 * @param {Number} [options.skip]
20928 * @param {Number} [options.limit]
20929 * @param {AuthOptions} [authOptions]
20930 */
20931 getFollowersAndFollowees: function getFollowersAndFollowees(options, authOptions) {
20932 if (!this.id) {
20933 throw new Error('Please signin.');
20934 }
20935
20936 return request({
20937 method: 'GET',
20938 path: "/users/".concat(this.id, "/followersAndFollowees"),
20939 query: {
20940 skip: options && options.skip,
20941 limit: options && options.limit,
20942 include: 'follower,followee',
20943 keys: 'follower,followee'
20944 },
20945 authOptions: authOptions
20946 }).then(function (_ref11) {
20947 var followers = _ref11.followers,
20948 followees = _ref11.followees;
20949 return {
20950 followers: (0, _map.default)(followers).call(followers, function (_ref12) {
20951 var follower = _ref12.follower;
20952 return AV._decode(follower);
20953 }),
20954 followees: (0, _map.default)(followees).call(followees, function (_ref13) {
20955 var followee = _ref13.followee;
20956 return AV._decode(followee);
20957 })
20958 };
20959 });
20960 },
20961
20962 /**
20963 *Create a follower query to query the user's followers.
20964 * @since 0.3.0
20965 * @see AV.User#followerQuery
20966 */
20967 followerQuery: function followerQuery() {
20968 return AV.User.followerQuery(this.id);
20969 },
20970
20971 /**
20972 *Create a followee query to query the user's followees.
20973 * @since 0.3.0
20974 * @see AV.User#followeeQuery
20975 */
20976 followeeQuery: function followeeQuery() {
20977 return AV.User.followeeQuery(this.id);
20978 },
20979
20980 /**
20981 * @see AV.Object#fetch
20982 */
20983 fetch: function fetch(fetchOptions, options) {
20984 return AV.Object.prototype.fetch.call(this, fetchOptions, options).then(function (model) {
20985 return model._handleSaveResult(false).then(function () {
20986 return model;
20987 });
20988 });
20989 },
20990
20991 /**
20992 * Update user's new password safely based on old password.
20993 * @param {String} oldPassword the old password.
20994 * @param {String} newPassword the new password.
20995 * @param {AuthOptions} options
20996 */
20997 updatePassword: function updatePassword(oldPassword, newPassword, options) {
20998 var _this12 = this;
20999
21000 var route = 'users/' + this.id + '/updatePassword';
21001 var params = {
21002 old_password: oldPassword,
21003 new_password: newPassword
21004 };
21005 var request = AVRequest(route, null, null, 'PUT', params, options);
21006 return request.then(function (resp) {
21007 _this12._finishFetch(_this12.parse(resp));
21008
21009 return _this12._handleSaveResult(true).then(function () {
21010 return resp;
21011 });
21012 });
21013 },
21014
21015 /**
21016 * Returns true if <code>current</code> would return this user.
21017 * @see AV.User#current
21018 */
21019 isCurrent: function isCurrent() {
21020 return this._isCurrentUser;
21021 },
21022
21023 /**
21024 * Returns get("username").
21025 * @return {String}
21026 * @see AV.Object#get
21027 */
21028 getUsername: function getUsername() {
21029 return this.get('username');
21030 },
21031
21032 /**
21033 * Returns get("mobilePhoneNumber").
21034 * @return {String}
21035 * @see AV.Object#get
21036 */
21037 getMobilePhoneNumber: function getMobilePhoneNumber() {
21038 return this.get('mobilePhoneNumber');
21039 },
21040
21041 /**
21042 * Calls set("mobilePhoneNumber", phoneNumber, options) and returns the result.
21043 * @param {String} mobilePhoneNumber
21044 * @return {Boolean}
21045 * @see AV.Object#set
21046 */
21047 setMobilePhoneNumber: function setMobilePhoneNumber(phone, options) {
21048 return this.set('mobilePhoneNumber', phone, options);
21049 },
21050
21051 /**
21052 * Calls set("username", username, options) and returns the result.
21053 * @param {String} username
21054 * @return {Boolean}
21055 * @see AV.Object#set
21056 */
21057 setUsername: function setUsername(username, options) {
21058 return this.set('username', username, options);
21059 },
21060
21061 /**
21062 * Calls set("password", password, options) and returns the result.
21063 * @param {String} password
21064 * @return {Boolean}
21065 * @see AV.Object#set
21066 */
21067 setPassword: function setPassword(password, options) {
21068 return this.set('password', password, options);
21069 },
21070
21071 /**
21072 * Returns get("email").
21073 * @return {String}
21074 * @see AV.Object#get
21075 */
21076 getEmail: function getEmail() {
21077 return this.get('email');
21078 },
21079
21080 /**
21081 * Calls set("email", email, options) and returns the result.
21082 * @param {String} email
21083 * @param {AuthOptions} options
21084 * @return {Boolean}
21085 * @see AV.Object#set
21086 */
21087 setEmail: function setEmail(email, options) {
21088 return this.set('email', email, options);
21089 },
21090
21091 /**
21092 * Checks whether this user is the current user and has been authenticated.
21093 * @deprecated 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),
21094 * 如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id
21095 * @return (Boolean) whether this user is the current user and is logged in.
21096 */
21097 authenticated: function authenticated() {
21098 console.warn('DEPRECATED: 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id。');
21099 return !!this._sessionToken && !AV._config.disableCurrentUser && AV.User.current() && AV.User.current().id === this.id;
21100 },
21101
21102 /**
21103 * Detects if current sessionToken is valid.
21104 *
21105 * @since 2.0.0
21106 * @return Promise.<Boolean>
21107 */
21108 isAuthenticated: function isAuthenticated() {
21109 var _this13 = this;
21110
21111 return _promise.default.resolve().then(function () {
21112 return !!_this13._sessionToken && AV.User._fetchUserBySessionToken(_this13._sessionToken).then(function () {
21113 return true;
21114 }, function (error) {
21115 if (error.code === 211) {
21116 return false;
21117 }
21118
21119 throw error;
21120 });
21121 });
21122 },
21123
21124 /**
21125 * Get sessionToken of current user.
21126 * @return {String} sessionToken
21127 */
21128 getSessionToken: function getSessionToken() {
21129 return this._sessionToken;
21130 },
21131
21132 /**
21133 * Refresh sessionToken of current user.
21134 * @since 2.1.0
21135 * @param {AuthOptions} [options]
21136 * @return {Promise.<AV.User>} user with refreshed sessionToken
21137 */
21138 refreshSessionToken: function refreshSessionToken(options) {
21139 var _this14 = this;
21140
21141 return AVRequest("users/".concat(this.id, "/refreshSessionToken"), null, null, 'PUT', null, options).then(function (response) {
21142 _this14._finishFetch(response);
21143
21144 return _this14._handleSaveResult(true).then(function () {
21145 return _this14;
21146 });
21147 });
21148 },
21149
21150 /**
21151 * Get this user's Roles.
21152 * @param {AuthOptions} [options]
21153 * @return {Promise.<AV.Role[]>} A promise that is fulfilled with the roles when
21154 * the query is complete.
21155 */
21156 getRoles: function getRoles(options) {
21157 var _context;
21158
21159 return (0, _find.default)(_context = AV.Relation.reverseQuery('_Role', 'users', this)).call(_context, options);
21160 }
21161 },
21162 /** @lends AV.User */
21163 {
21164 // Class Variables
21165 // The currently logged-in user.
21166 _currentUser: null,
21167 // Whether currentUser is known to match the serialized version on disk.
21168 // This is useful for saving a localstorage check if you try to load
21169 // _currentUser frequently while there is none stored.
21170 _currentUserMatchesDisk: false,
21171 // The localStorage key suffix that the current user is stored under.
21172 _CURRENT_USER_KEY: 'currentUser',
21173 // The mapping of auth provider names to actual providers
21174 _authProviders: {},
21175 // Class Methods
21176
21177 /**
21178 * Signs up a new user with a username (or email) and password.
21179 * This will create a new AV.User on the server, and also persist the
21180 * session in localStorage so that you can access the user using
21181 * {@link #current}.
21182 *
21183 * @param {String} username The username (or email) to sign up with.
21184 * @param {String} password The password to sign up with.
21185 * @param {Object} [attrs] Extra fields to set on the new user.
21186 * @param {AuthOptions} [options]
21187 * @return {Promise} A promise that is fulfilled with the user when
21188 * the signup completes.
21189 * @see AV.User#signUp
21190 */
21191 signUp: function signUp(username, password, attrs, options) {
21192 attrs = attrs || {};
21193 attrs.username = username;
21194 attrs.password = password;
21195
21196 var user = AV.Object._create('_User');
21197
21198 return user.signUp(attrs, options);
21199 },
21200
21201 /**
21202 * Logs in a user with a username (or email) and password. On success, this
21203 * saves the session to disk, so you can retrieve the currently logged in
21204 * user using <code>current</code>.
21205 *
21206 * @param {String} username The username (or email) to log in with.
21207 * @param {String} password The password to log in with.
21208 * @return {Promise} A promise that is fulfilled with the user when
21209 * the login completes.
21210 * @see AV.User#logIn
21211 */
21212 logIn: function logIn(username, password) {
21213 var user = AV.Object._create('_User');
21214
21215 user._finishFetch({
21216 username: username,
21217 password: password
21218 });
21219
21220 return user.logIn();
21221 },
21222
21223 /**
21224 * Logs in a user with a session token. On success, this saves the session
21225 * to disk, so you can retrieve the currently logged in user using
21226 * <code>current</code>.
21227 *
21228 * @param {String} sessionToken The sessionToken to log in with.
21229 * @return {Promise} A promise that is fulfilled with the user when
21230 * the login completes.
21231 */
21232 become: function become(sessionToken) {
21233 return this._fetchUserBySessionToken(sessionToken).then(function (user) {
21234 return user._handleSaveResult(true).then(function () {
21235 return user;
21236 });
21237 });
21238 },
21239 _fetchUserBySessionToken: function _fetchUserBySessionToken(sessionToken) {
21240 if (sessionToken === undefined) {
21241 return _promise.default.reject(new Error('The sessionToken cannot be undefined'));
21242 }
21243
21244 var user = AV.Object._create('_User');
21245
21246 return request({
21247 method: 'GET',
21248 path: '/users/me',
21249 authOptions: {
21250 sessionToken: sessionToken
21251 }
21252 }).then(function (resp) {
21253 var serverAttrs = user.parse(resp);
21254
21255 user._finishFetch(serverAttrs);
21256
21257 return user;
21258 });
21259 },
21260
21261 /**
21262 * Logs in a user with a mobile phone number and sms code sent by
21263 * AV.User.requestLoginSmsCode.On success, this
21264 * saves the session to disk, so you can retrieve the currently logged in
21265 * user using <code>current</code>.
21266 *
21267 * @param {String} mobilePhone The user's mobilePhoneNumber
21268 * @param {String} smsCode The sms code sent by AV.User.requestLoginSmsCode
21269 * @return {Promise} A promise that is fulfilled with the user when
21270 * the login completes.
21271 * @see AV.User#logIn
21272 */
21273 logInWithMobilePhoneSmsCode: function logInWithMobilePhoneSmsCode(mobilePhone, smsCode) {
21274 var user = AV.Object._create('_User');
21275
21276 user._finishFetch({
21277 mobilePhoneNumber: mobilePhone,
21278 smsCode: smsCode
21279 });
21280
21281 return user.logIn();
21282 },
21283
21284 /**
21285 * Signs up or logs in a user with a mobilePhoneNumber and smsCode.
21286 * On success, this saves the session to disk, so you can retrieve the currently
21287 * logged in user using <code>current</code>.
21288 *
21289 * @param {String} mobilePhoneNumber The user's mobilePhoneNumber.
21290 * @param {String} smsCode The sms code sent by AV.Cloud.requestSmsCode
21291 * @param {Object} attributes The user's other attributes such as username etc.
21292 * @param {AuthOptions} options
21293 * @return {Promise} A promise that is fulfilled with the user when
21294 * the login completes.
21295 * @see AV.User#signUpOrlogInWithMobilePhone
21296 * @see AV.Cloud.requestSmsCode
21297 */
21298 signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(mobilePhoneNumber, smsCode, attrs, options) {
21299 attrs = attrs || {};
21300 attrs.mobilePhoneNumber = mobilePhoneNumber;
21301 attrs.smsCode = smsCode;
21302
21303 var user = AV.Object._create('_User');
21304
21305 return user.signUpOrlogInWithMobilePhone(attrs, options);
21306 },
21307
21308 /**
21309 * Logs in a user with a mobile phone number and password. On success, this
21310 * saves the session to disk, so you can retrieve the currently logged in
21311 * user using <code>current</code>.
21312 *
21313 * @param {String} mobilePhone The user's mobilePhoneNumber
21314 * @param {String} password The password to log in with.
21315 * @return {Promise} A promise that is fulfilled with the user when
21316 * the login completes.
21317 * @see AV.User#logIn
21318 */
21319 logInWithMobilePhone: function logInWithMobilePhone(mobilePhone, password) {
21320 var user = AV.Object._create('_User');
21321
21322 user._finishFetch({
21323 mobilePhoneNumber: mobilePhone,
21324 password: password
21325 });
21326
21327 return user.logIn();
21328 },
21329
21330 /**
21331 * Logs in a user with email and password.
21332 *
21333 * @since 3.13.0
21334 * @param {String} email The user's email.
21335 * @param {String} password The password to log in with.
21336 * @return {Promise} A promise that is fulfilled with the user when
21337 * the login completes.
21338 */
21339 loginWithEmail: function loginWithEmail(email, password) {
21340 var user = AV.Object._create('_User');
21341
21342 user._finishFetch({
21343 email: email,
21344 password: password
21345 });
21346
21347 return user.logIn();
21348 },
21349
21350 /**
21351 * Signs up or logs in a user with a third party auth data(AccessToken).
21352 * On success, this saves the session to disk, so you can retrieve the currently
21353 * logged in user using <code>current</code>.
21354 *
21355 * @since 3.7.0
21356 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
21357 * @param {string} platform Available platform for sign up.
21358 * @param {Object} [options]
21359 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
21360 * @return {Promise} A promise that is fulfilled with the user when
21361 * the login completes.
21362 * @example AV.User.loginWithAuthData({
21363 * openid: 'abc123',
21364 * access_token: '123abc',
21365 * expires_in: 1382686496
21366 * }, 'weixin').then(function(user) {
21367 * //Access user here
21368 * }).catch(function(error) {
21369 * //console.error("error: ", error);
21370 * });
21371 * @see {@link https://leancloud.cn/docs/js_guide.html#绑定第三方平台账户}
21372 */
21373 loginWithAuthData: function loginWithAuthData(authData, platform, options) {
21374 return AV.User._logInWith(platform, authData, options);
21375 },
21376
21377 /**
21378 * @deprecated renamed to {@link AV.User.loginWithAuthData}
21379 */
21380 signUpOrlogInWithAuthData: function signUpOrlogInWithAuthData() {
21381 console.warn('DEPRECATED: User.signUpOrlogInWithAuthData 已废弃,请使用 User#loginWithAuthData 代替');
21382 return this.loginWithAuthData.apply(this, arguments);
21383 },
21384
21385 /**
21386 * Signs up or logs in a user with a third party authData and unionId.
21387 * @since 3.7.0
21388 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
21389 * @param {string} platform Available platform for sign up.
21390 * @param {string} unionId
21391 * @param {Object} [unionLoginOptions]
21392 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
21393 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
21394 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
21395 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
21396 * @example AV.User.loginWithAuthDataAndUnionId({
21397 * openid: 'abc123',
21398 * access_token: '123abc',
21399 * expires_in: 1382686496
21400 * }, 'weixin', 'union123', {
21401 * unionIdPlatform: 'weixin',
21402 * asMainAccount: true,
21403 * }).then(function(user) {
21404 * //Access user here
21405 * }).catch(function(error) {
21406 * //console.error("error: ", error);
21407 * });
21408 */
21409 loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
21410 return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
21411 },
21412
21413 /**
21414 * @deprecated renamed to {@link AV.User.loginWithAuthDataAndUnionId}
21415 * @since 3.5.0
21416 */
21417 signUpOrlogInWithAuthDataAndUnionId: function signUpOrlogInWithAuthDataAndUnionId() {
21418 console.warn('DEPRECATED: User.signUpOrlogInWithAuthDataAndUnionId 已废弃,请使用 User#loginWithAuthDataAndUnionId 代替');
21419 return this.loginWithAuthDataAndUnionId.apply(this, arguments);
21420 },
21421
21422 /**
21423 * Merge unionId into authInfo.
21424 * @since 4.6.0
21425 * @param {Object} authInfo
21426 * @param {String} unionId
21427 * @param {Object} [unionIdOption]
21428 * @param {Boolean} [unionIdOption.asMainAccount] If true, the unionId will be associated with the user.
21429 */
21430 mergeUnionId: function mergeUnionId(authInfo, unionId) {
21431 var _ref14 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
21432 _ref14$asMainAccount = _ref14.asMainAccount,
21433 asMainAccount = _ref14$asMainAccount === void 0 ? false : _ref14$asMainAccount;
21434
21435 authInfo = JSON.parse((0, _stringify.default)(authInfo));
21436 var _authInfo = authInfo,
21437 authData = _authInfo.authData,
21438 platform = _authInfo.platform;
21439 authData.platform = platform;
21440 authData.main_account = asMainAccount;
21441 authData.unionid = unionId;
21442 return authInfo;
21443 },
21444
21445 /**
21446 * 使用当前使用微信小程序的微信用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
21447 * 仅在微信小程序中可用。
21448 *
21449 * @deprecated please use {@link AV.User.loginWithMiniApp}
21450 * @since 2.0.0
21451 * @param {Object} [options]
21452 * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
21453 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
21454 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
21455 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
21456 * @return {Promise.<AV.User>}
21457 */
21458 loginWithWeapp: function loginWithWeapp() {
21459 var _this15 = this;
21460
21461 var _ref15 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
21462 _ref15$preferUnionId = _ref15.preferUnionId,
21463 preferUnionId = _ref15$preferUnionId === void 0 ? false : _ref15$preferUnionId,
21464 _ref15$unionIdPlatfor = _ref15.unionIdPlatform,
21465 unionIdPlatform = _ref15$unionIdPlatfor === void 0 ? 'weixin' : _ref15$unionIdPlatfor,
21466 _ref15$asMainAccount = _ref15.asMainAccount,
21467 asMainAccount = _ref15$asMainAccount === void 0 ? true : _ref15$asMainAccount,
21468 _ref15$failOnNotExist = _ref15.failOnNotExist,
21469 failOnNotExist = _ref15$failOnNotExist === void 0 ? false : _ref15$failOnNotExist,
21470 useMasterKey = _ref15.useMasterKey,
21471 sessionToken = _ref15.sessionToken,
21472 user = _ref15.user;
21473
21474 var getAuthInfo = getAdapter('getAuthInfo');
21475 return getAuthInfo({
21476 preferUnionId: preferUnionId,
21477 asMainAccount: asMainAccount,
21478 platform: unionIdPlatform
21479 }).then(function (authInfo) {
21480 return _this15.loginWithMiniApp(authInfo, {
21481 failOnNotExist: failOnNotExist,
21482 useMasterKey: useMasterKey,
21483 sessionToken: sessionToken,
21484 user: user
21485 });
21486 });
21487 },
21488
21489 /**
21490 * 使用当前使用微信小程序的微信用户身份注册或登录,
21491 * 仅在微信小程序中可用。
21492 *
21493 * @deprecated please use {@link AV.User.loginWithMiniApp}
21494 * @since 3.13.0
21495 * @param {Object} [unionLoginOptions]
21496 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
21497 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
21498 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists. * @return {Promise.<AV.User>}
21499 */
21500 loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
21501 var _this16 = this;
21502
21503 var _ref16 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
21504 _ref16$unionIdPlatfor = _ref16.unionIdPlatform,
21505 unionIdPlatform = _ref16$unionIdPlatfor === void 0 ? 'weixin' : _ref16$unionIdPlatfor,
21506 _ref16$asMainAccount = _ref16.asMainAccount,
21507 asMainAccount = _ref16$asMainAccount === void 0 ? false : _ref16$asMainAccount,
21508 _ref16$failOnNotExist = _ref16.failOnNotExist,
21509 failOnNotExist = _ref16$failOnNotExist === void 0 ? false : _ref16$failOnNotExist,
21510 useMasterKey = _ref16.useMasterKey,
21511 sessionToken = _ref16.sessionToken,
21512 user = _ref16.user;
21513
21514 var getAuthInfo = getAdapter('getAuthInfo');
21515 return getAuthInfo({
21516 platform: unionIdPlatform
21517 }).then(function (authInfo) {
21518 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
21519 asMainAccount: asMainAccount
21520 });
21521 return _this16.loginWithMiniApp(authInfo, {
21522 failOnNotExist: failOnNotExist,
21523 useMasterKey: useMasterKey,
21524 sessionToken: sessionToken,
21525 user: user
21526 });
21527 });
21528 },
21529
21530 /**
21531 * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
21532 * 仅在 QQ 小程序中可用。
21533 *
21534 * @deprecated please use {@link AV.User.loginWithMiniApp}
21535 * @since 4.2.0
21536 * @param {Object} [options]
21537 * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
21538 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
21539 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
21540 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
21541 * @return {Promise.<AV.User>}
21542 */
21543 loginWithQQApp: function loginWithQQApp() {
21544 var _this17 = this;
21545
21546 var _ref17 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
21547 _ref17$preferUnionId = _ref17.preferUnionId,
21548 preferUnionId = _ref17$preferUnionId === void 0 ? false : _ref17$preferUnionId,
21549 _ref17$unionIdPlatfor = _ref17.unionIdPlatform,
21550 unionIdPlatform = _ref17$unionIdPlatfor === void 0 ? 'qq' : _ref17$unionIdPlatfor,
21551 _ref17$asMainAccount = _ref17.asMainAccount,
21552 asMainAccount = _ref17$asMainAccount === void 0 ? true : _ref17$asMainAccount,
21553 _ref17$failOnNotExist = _ref17.failOnNotExist,
21554 failOnNotExist = _ref17$failOnNotExist === void 0 ? false : _ref17$failOnNotExist,
21555 useMasterKey = _ref17.useMasterKey,
21556 sessionToken = _ref17.sessionToken,
21557 user = _ref17.user;
21558
21559 var getAuthInfo = getAdapter('getAuthInfo');
21560 return getAuthInfo({
21561 preferUnionId: preferUnionId,
21562 asMainAccount: asMainAccount,
21563 platform: unionIdPlatform
21564 }).then(function (authInfo) {
21565 authInfo.provider = PLATFORM_QQAPP;
21566 return _this17.loginWithMiniApp(authInfo, {
21567 failOnNotExist: failOnNotExist,
21568 useMasterKey: useMasterKey,
21569 sessionToken: sessionToken,
21570 user: user
21571 });
21572 });
21573 },
21574
21575 /**
21576 * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,
21577 * 仅在 QQ 小程序中可用。
21578 *
21579 * @deprecated please use {@link AV.User.loginWithMiniApp}
21580 * @since 4.2.0
21581 * @param {Object} [unionLoginOptions]
21582 * @param {string} [unionLoginOptions.unionIdPlatform = 'qq'] unionId platform
21583 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
21584 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
21585 * @return {Promise.<AV.User>}
21586 */
21587 loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
21588 var _this18 = this;
21589
21590 var _ref18 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
21591 _ref18$unionIdPlatfor = _ref18.unionIdPlatform,
21592 unionIdPlatform = _ref18$unionIdPlatfor === void 0 ? 'qq' : _ref18$unionIdPlatfor,
21593 _ref18$asMainAccount = _ref18.asMainAccount,
21594 asMainAccount = _ref18$asMainAccount === void 0 ? false : _ref18$asMainAccount,
21595 _ref18$failOnNotExist = _ref18.failOnNotExist,
21596 failOnNotExist = _ref18$failOnNotExist === void 0 ? false : _ref18$failOnNotExist,
21597 useMasterKey = _ref18.useMasterKey,
21598 sessionToken = _ref18.sessionToken,
21599 user = _ref18.user;
21600
21601 var getAuthInfo = getAdapter('getAuthInfo');
21602 return getAuthInfo({
21603 platform: unionIdPlatform
21604 }).then(function (authInfo) {
21605 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
21606 asMainAccount: asMainAccount
21607 });
21608 authInfo.provider = PLATFORM_QQAPP;
21609 return _this18.loginWithMiniApp(authInfo, {
21610 failOnNotExist: failOnNotExist,
21611 useMasterKey: useMasterKey,
21612 sessionToken: sessionToken,
21613 user: user
21614 });
21615 });
21616 },
21617
21618 /**
21619 * Register or login using the identity of the current mini-app.
21620 * @param {Object} authInfo
21621 * @param {Object} [option]
21622 * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
21623 */
21624 loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
21625 var _this19 = this;
21626
21627 if (authInfo === undefined) {
21628 var getAuthInfo = getAdapter('getAuthInfo');
21629 return getAuthInfo().then(function (authInfo) {
21630 return _this19.loginWithAuthData(authInfo.authData, authInfo.provider, option);
21631 });
21632 }
21633
21634 return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
21635 },
21636
21637 /**
21638 * Only use for DI in tests to produce deterministic IDs.
21639 */
21640 _genId: function _genId() {
21641 return uuid();
21642 },
21643
21644 /**
21645 * Creates an anonymous user.
21646 *
21647 * @since 3.9.0
21648 * @return {Promise.<AV.User>}
21649 */
21650 loginAnonymously: function loginAnonymously() {
21651 return this.loginWithAuthData({
21652 id: AV.User._genId()
21653 }, 'anonymous');
21654 },
21655 associateWithAuthData: function associateWithAuthData(userObj, platform, authData) {
21656 console.warn('DEPRECATED: User.associateWithAuthData 已废弃,请使用 User#associateWithAuthData 代替');
21657 return userObj._linkWith(platform, authData);
21658 },
21659
21660 /**
21661 * Logs out the currently logged in user session. This will remove the
21662 * session from disk, log out of linked services, and future calls to
21663 * <code>current</code> will return <code>null</code>.
21664 * @return {Promise}
21665 */
21666 logOut: function logOut() {
21667 if (AV._config.disableCurrentUser) {
21668 console.warn('AV.User.current() was disabled in multi-user environment, call logOut() from user object instead https://leancloud.cn/docs/leanengine-node-sdk-upgrade-1.html');
21669 return _promise.default.resolve(null);
21670 }
21671
21672 if (AV.User._currentUser !== null) {
21673 AV.User._currentUser._logOutWithAll();
21674
21675 AV.User._currentUser._isCurrentUser = false;
21676 }
21677
21678 AV.User._currentUserMatchesDisk = true;
21679 AV.User._currentUser = null;
21680 return AV.localStorage.removeItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function () {
21681 return AV._refreshSubscriptionId();
21682 });
21683 },
21684
21685 /**
21686 *Create a follower query for special user to query the user's followers.
21687 * @param {String} userObjectId The user object id.
21688 * @return {AV.FriendShipQuery}
21689 * @since 0.3.0
21690 */
21691 followerQuery: function followerQuery(userObjectId) {
21692 if (!userObjectId || !_.isString(userObjectId)) {
21693 throw new Error('Invalid user object id.');
21694 }
21695
21696 var query = new AV.FriendShipQuery('_Follower');
21697 query._friendshipTag = 'follower';
21698 query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
21699 return query;
21700 },
21701
21702 /**
21703 *Create a followee query for special user to query the user's followees.
21704 * @param {String} userObjectId The user object id.
21705 * @return {AV.FriendShipQuery}
21706 * @since 0.3.0
21707 */
21708 followeeQuery: function followeeQuery(userObjectId) {
21709 if (!userObjectId || !_.isString(userObjectId)) {
21710 throw new Error('Invalid user object id.');
21711 }
21712
21713 var query = new AV.FriendShipQuery('_Followee');
21714 query._friendshipTag = 'followee';
21715 query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
21716 return query;
21717 },
21718
21719 /**
21720 * Requests a password reset email to be sent to the specified email address
21721 * associated with the user account. This email allows the user to securely
21722 * reset their password on the AV site.
21723 *
21724 * @param {String} email The email address associated with the user that
21725 * forgot their password.
21726 * @return {Promise}
21727 */
21728 requestPasswordReset: function requestPasswordReset(email) {
21729 var json = {
21730 email: email
21731 };
21732 var request = AVRequest('requestPasswordReset', null, null, 'POST', json);
21733 return request;
21734 },
21735
21736 /**
21737 * Requests a verify email to be sent to the specified email address
21738 * associated with the user account. This email allows the user to securely
21739 * verify their email address on the AV site.
21740 *
21741 * @param {String} email The email address associated with the user that
21742 * doesn't verify their email address.
21743 * @return {Promise}
21744 */
21745 requestEmailVerify: function requestEmailVerify(email) {
21746 var json = {
21747 email: email
21748 };
21749 var request = AVRequest('requestEmailVerify', null, null, 'POST', json);
21750 return request;
21751 },
21752
21753 /**
21754 * Requests a verify sms code to be sent to the specified mobile phone
21755 * number associated with the user account. This sms code allows the user to
21756 * verify their mobile phone number by calling AV.User.verifyMobilePhone
21757 *
21758 * @param {String} mobilePhoneNumber The mobile phone number associated with the
21759 * user that doesn't verify their mobile phone number.
21760 * @param {SMSAuthOptions} [options]
21761 * @return {Promise}
21762 */
21763 requestMobilePhoneVerify: function requestMobilePhoneVerify(mobilePhoneNumber) {
21764 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21765 var data = {
21766 mobilePhoneNumber: mobilePhoneNumber
21767 };
21768
21769 if (options.validateToken) {
21770 data.validate_token = options.validateToken;
21771 }
21772
21773 var request = AVRequest('requestMobilePhoneVerify', null, null, 'POST', data, options);
21774 return request;
21775 },
21776
21777 /**
21778 * Requests a reset password sms code to be sent to the specified mobile phone
21779 * number associated with the user account. This sms code allows the user to
21780 * reset their account's password by calling AV.User.resetPasswordBySmsCode
21781 *
21782 * @param {String} mobilePhoneNumber The mobile phone number associated with the
21783 * user that doesn't verify their mobile phone number.
21784 * @param {SMSAuthOptions} [options]
21785 * @return {Promise}
21786 */
21787 requestPasswordResetBySmsCode: function requestPasswordResetBySmsCode(mobilePhoneNumber) {
21788 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21789 var data = {
21790 mobilePhoneNumber: mobilePhoneNumber
21791 };
21792
21793 if (options.validateToken) {
21794 data.validate_token = options.validateToken;
21795 }
21796
21797 var request = AVRequest('requestPasswordResetBySmsCode', null, null, 'POST', data, options);
21798 return request;
21799 },
21800
21801 /**
21802 * Requests a change mobile phone number sms code to be sent to the mobilePhoneNumber.
21803 * This sms code allows current user to reset it's mobilePhoneNumber by
21804 * calling {@link AV.User.changePhoneNumber}
21805 * @since 4.7.0
21806 * @param {String} mobilePhoneNumber
21807 * @param {Number} [ttl] ttl of sms code (default is 6 minutes)
21808 * @param {SMSAuthOptions} [options]
21809 * @return {Promise}
21810 */
21811 requestChangePhoneNumber: function requestChangePhoneNumber(mobilePhoneNumber, ttl, options) {
21812 var data = {
21813 mobilePhoneNumber: mobilePhoneNumber
21814 };
21815
21816 if (ttl) {
21817 data.ttl = options.ttl;
21818 }
21819
21820 if (options && options.validateToken) {
21821 data.validate_token = options.validateToken;
21822 }
21823
21824 return AVRequest('requestChangePhoneNumber', null, null, 'POST', data, options);
21825 },
21826
21827 /**
21828 * Makes a call to reset user's account mobilePhoneNumber by sms code.
21829 * The sms code is sent by {@link AV.User.requestChangePhoneNumber}
21830 * @since 4.7.0
21831 * @param {String} mobilePhoneNumber
21832 * @param {String} code The sms code.
21833 * @return {Promise}
21834 */
21835 changePhoneNumber: function changePhoneNumber(mobilePhoneNumber, code) {
21836 var data = {
21837 mobilePhoneNumber: mobilePhoneNumber,
21838 code: code
21839 };
21840 return AVRequest('changePhoneNumber', null, null, 'POST', data);
21841 },
21842
21843 /**
21844 * Makes a call to reset user's account password by sms code and new password.
21845 * The sms code is sent by AV.User.requestPasswordResetBySmsCode.
21846 * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
21847 * @param {String} password The new password.
21848 * @return {Promise} A promise that will be resolved with the result
21849 * of the function.
21850 */
21851 resetPasswordBySmsCode: function resetPasswordBySmsCode(code, password) {
21852 var json = {
21853 password: password
21854 };
21855 var request = AVRequest('resetPasswordBySmsCode', null, code, 'PUT', json);
21856 return request;
21857 },
21858
21859 /**
21860 * Makes a call to verify sms code that sent by AV.User.Cloud.requestSmsCode
21861 * If verify successfully,the user mobilePhoneVerified attribute will be true.
21862 * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
21863 * @return {Promise} A promise that will be resolved with the result
21864 * of the function.
21865 */
21866 verifyMobilePhone: function verifyMobilePhone(code) {
21867 var request = AVRequest('verifyMobilePhone', null, code, 'POST', null);
21868 return request;
21869 },
21870
21871 /**
21872 * Requests a logIn sms code to be sent to the specified mobile phone
21873 * number associated with the user account. This sms code allows the user to
21874 * login by AV.User.logInWithMobilePhoneSmsCode function.
21875 *
21876 * @param {String} mobilePhoneNumber The mobile phone number associated with the
21877 * user that want to login by AV.User.logInWithMobilePhoneSmsCode
21878 * @param {SMSAuthOptions} [options]
21879 * @return {Promise}
21880 */
21881 requestLoginSmsCode: function requestLoginSmsCode(mobilePhoneNumber) {
21882 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21883 var data = {
21884 mobilePhoneNumber: mobilePhoneNumber
21885 };
21886
21887 if (options.validateToken) {
21888 data.validate_token = options.validateToken;
21889 }
21890
21891 var request = AVRequest('requestLoginSmsCode', null, null, 'POST', data, options);
21892 return request;
21893 },
21894
21895 /**
21896 * Retrieves the currently logged in AVUser with a valid session,
21897 * either from memory or localStorage, if necessary.
21898 * @return {Promise.<AV.User>} resolved with the currently logged in AV.User.
21899 */
21900 currentAsync: function currentAsync() {
21901 if (AV._config.disableCurrentUser) {
21902 console.warn('AV.User.currentAsync() was disabled in multi-user environment, access user from request instead https://leancloud.cn/docs/leanengine-node-sdk-upgrade-1.html');
21903 return _promise.default.resolve(null);
21904 }
21905
21906 if (AV.User._currentUser) {
21907 return _promise.default.resolve(AV.User._currentUser);
21908 }
21909
21910 if (AV.User._currentUserMatchesDisk) {
21911 return _promise.default.resolve(AV.User._currentUser);
21912 }
21913
21914 return AV.localStorage.getItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function (userData) {
21915 if (!userData) {
21916 return null;
21917 } // Load the user from local storage.
21918
21919
21920 AV.User._currentUserMatchesDisk = true;
21921 AV.User._currentUser = AV.Object._create('_User');
21922 AV.User._currentUser._isCurrentUser = true;
21923 var json = JSON.parse(userData);
21924 AV.User._currentUser.id = json._id;
21925 delete json._id;
21926 AV.User._currentUser._sessionToken = json._sessionToken;
21927 delete json._sessionToken;
21928
21929 AV.User._currentUser._finishFetch(json); //AV.User._currentUser.set(json);
21930
21931
21932 AV.User._currentUser._synchronizeAllAuthData();
21933
21934 AV.User._currentUser._refreshCache();
21935
21936 AV.User._currentUser._opSetQueue = [{}];
21937 return AV.User._currentUser;
21938 });
21939 },
21940
21941 /**
21942 * Retrieves the currently logged in AVUser with a valid session,
21943 * either from memory or localStorage, if necessary.
21944 * @return {AV.User} The currently logged in AV.User.
21945 */
21946 current: function current() {
21947 if (AV._config.disableCurrentUser) {
21948 console.warn('AV.User.current() was disabled in multi-user environment, access user from request instead https://leancloud.cn/docs/leanengine-node-sdk-upgrade-1.html');
21949 return null;
21950 }
21951
21952 if (AV.localStorage.async) {
21953 var error = new Error('Synchronous API User.current() is not available in this runtime. Use User.currentAsync() instead.');
21954 error.code = 'SYNC_API_NOT_AVAILABLE';
21955 throw error;
21956 }
21957
21958 if (AV.User._currentUser) {
21959 return AV.User._currentUser;
21960 }
21961
21962 if (AV.User._currentUserMatchesDisk) {
21963 return AV.User._currentUser;
21964 } // Load the user from local storage.
21965
21966
21967 AV.User._currentUserMatchesDisk = true;
21968 var userData = AV.localStorage.getItem(AV._getAVPath(AV.User._CURRENT_USER_KEY));
21969
21970 if (!userData) {
21971 return null;
21972 }
21973
21974 AV.User._currentUser = AV.Object._create('_User');
21975 AV.User._currentUser._isCurrentUser = true;
21976 var json = JSON.parse(userData);
21977 AV.User._currentUser.id = json._id;
21978 delete json._id;
21979 AV.User._currentUser._sessionToken = json._sessionToken;
21980 delete json._sessionToken;
21981
21982 AV.User._currentUser._finishFetch(json); //AV.User._currentUser.set(json);
21983
21984
21985 AV.User._currentUser._synchronizeAllAuthData();
21986
21987 AV.User._currentUser._refreshCache();
21988
21989 AV.User._currentUser._opSetQueue = [{}];
21990 return AV.User._currentUser;
21991 },
21992
21993 /**
21994 * Persists a user as currentUser to localStorage, and into the singleton.
21995 * @private
21996 */
21997 _saveCurrentUser: function _saveCurrentUser(user) {
21998 var promise;
21999
22000 if (AV.User._currentUser !== user) {
22001 promise = AV.User.logOut();
22002 } else {
22003 promise = _promise.default.resolve();
22004 }
22005
22006 return promise.then(function () {
22007 user._isCurrentUser = true;
22008 AV.User._currentUser = user;
22009
22010 var json = user._toFullJSON();
22011
22012 json._id = user.id;
22013 json._sessionToken = user._sessionToken;
22014 return AV.localStorage.setItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY), (0, _stringify.default)(json)).then(function () {
22015 AV.User._currentUserMatchesDisk = true;
22016 return AV._refreshSubscriptionId();
22017 });
22018 });
22019 },
22020 _registerAuthenticationProvider: function _registerAuthenticationProvider(provider) {
22021 AV.User._authProviders[provider.getAuthType()] = provider; // Synchronize the current user with the auth provider.
22022
22023 if (!AV._config.disableCurrentUser && AV.User.current()) {
22024 AV.User.current()._synchronizeAuthData(provider.getAuthType());
22025 }
22026 },
22027 _logInWith: function _logInWith(provider, authData, options) {
22028 var user = AV.Object._create('_User');
22029
22030 return user._linkWith(provider, authData, options);
22031 }
22032 });
22033};
22034
22035/***/ }),
22036/* 562 */
22037/***/ (function(module, exports, __webpack_require__) {
22038
22039var _Object$defineProperty = __webpack_require__(154);
22040
22041function _defineProperty(obj, key, value) {
22042 if (key in obj) {
22043 _Object$defineProperty(obj, key, {
22044 value: value,
22045 enumerable: true,
22046 configurable: true,
22047 writable: true
22048 });
22049 } else {
22050 obj[key] = value;
22051 }
22052
22053 return obj;
22054}
22055
22056module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
22057
22058/***/ }),
22059/* 563 */
22060/***/ (function(module, exports, __webpack_require__) {
22061
22062"use strict";
22063
22064
22065var _interopRequireDefault = __webpack_require__(1);
22066
22067var _map = _interopRequireDefault(__webpack_require__(37));
22068
22069var _promise = _interopRequireDefault(__webpack_require__(12));
22070
22071var _keys = _interopRequireDefault(__webpack_require__(62));
22072
22073var _stringify = _interopRequireDefault(__webpack_require__(38));
22074
22075var _find = _interopRequireDefault(__webpack_require__(96));
22076
22077var _concat = _interopRequireDefault(__webpack_require__(19));
22078
22079var _ = __webpack_require__(3);
22080
22081var debug = __webpack_require__(63)('leancloud:query');
22082
22083var AVError = __webpack_require__(48);
22084
22085var _require = __webpack_require__(28),
22086 _request = _require._request,
22087 request = _require.request;
22088
22089var _require2 = __webpack_require__(32),
22090 ensureArray = _require2.ensureArray,
22091 transformFetchOptions = _require2.transformFetchOptions,
22092 continueWhile = _require2.continueWhile;
22093
22094var requires = function requires(value, message) {
22095 if (value === undefined) {
22096 throw new Error(message);
22097 }
22098}; // AV.Query is a way to create a list of AV.Objects.
22099
22100
22101module.exports = function (AV) {
22102 /**
22103 * Creates a new AV.Query for the given AV.Object subclass.
22104 * @param {Class|String} objectClass An instance of a subclass of AV.Object, or a AV className string.
22105 * @class
22106 *
22107 * <p>AV.Query defines a query that is used to fetch AV.Objects. The
22108 * most common use case is finding all objects that match a query through the
22109 * <code>find</code> method. For example, this sample code fetches all objects
22110 * of class <code>MyClass</code>. It calls a different function depending on
22111 * whether the fetch succeeded or not.
22112 *
22113 * <pre>
22114 * var query = new AV.Query(MyClass);
22115 * query.find().then(function(results) {
22116 * // results is an array of AV.Object.
22117 * }, function(error) {
22118 * // error is an instance of AVError.
22119 * });</pre></p>
22120 *
22121 * <p>An AV.Query can also be used to retrieve a single object whose id is
22122 * known, through the get method. For example, this sample code fetches an
22123 * object of class <code>MyClass</code> and id <code>myId</code>. It calls a
22124 * different function depending on whether the fetch succeeded or not.
22125 *
22126 * <pre>
22127 * var query = new AV.Query(MyClass);
22128 * query.get(myId).then(function(object) {
22129 * // object is an instance of AV.Object.
22130 * }, function(error) {
22131 * // error is an instance of AVError.
22132 * });</pre></p>
22133 *
22134 * <p>An AV.Query can also be used to count the number of objects that match
22135 * the query without retrieving all of those objects. For example, this
22136 * sample code counts the number of objects of the class <code>MyClass</code>
22137 * <pre>
22138 * var query = new AV.Query(MyClass);
22139 * query.count().then(function(number) {
22140 * // There are number instances of MyClass.
22141 * }, function(error) {
22142 * // error is an instance of AVError.
22143 * });</pre></p>
22144 */
22145 AV.Query = function (objectClass) {
22146 if (_.isString(objectClass)) {
22147 objectClass = AV.Object._getSubclass(objectClass);
22148 }
22149
22150 this.objectClass = objectClass;
22151 this.className = objectClass.prototype.className;
22152 this._where = {};
22153 this._include = [];
22154 this._select = [];
22155 this._limit = -1; // negative limit means, do not send a limit
22156
22157 this._skip = 0;
22158 this._defaultParams = {};
22159 };
22160 /**
22161 * Constructs a AV.Query that is the OR of the passed in queries. For
22162 * example:
22163 * <pre>var compoundQuery = AV.Query.or(query1, query2, query3);</pre>
22164 *
22165 * will create a compoundQuery that is an or of the query1, query2, and
22166 * query3.
22167 * @param {...AV.Query} var_args The list of queries to OR.
22168 * @return {AV.Query} The query that is the OR of the passed in queries.
22169 */
22170
22171
22172 AV.Query.or = function () {
22173 var queries = _.toArray(arguments);
22174
22175 var className = null;
22176
22177 AV._arrayEach(queries, function (q) {
22178 if (_.isNull(className)) {
22179 className = q.className;
22180 }
22181
22182 if (className !== q.className) {
22183 throw new Error('All queries must be for the same class');
22184 }
22185 });
22186
22187 var query = new AV.Query(className);
22188
22189 query._orQuery(queries);
22190
22191 return query;
22192 };
22193 /**
22194 * Constructs a AV.Query that is the AND of the passed in queries. For
22195 * example:
22196 * <pre>var compoundQuery = AV.Query.and(query1, query2, query3);</pre>
22197 *
22198 * will create a compoundQuery that is an 'and' of the query1, query2, and
22199 * query3.
22200 * @param {...AV.Query} var_args The list of queries to AND.
22201 * @return {AV.Query} The query that is the AND of the passed in queries.
22202 */
22203
22204
22205 AV.Query.and = function () {
22206 var queries = _.toArray(arguments);
22207
22208 var className = null;
22209
22210 AV._arrayEach(queries, function (q) {
22211 if (_.isNull(className)) {
22212 className = q.className;
22213 }
22214
22215 if (className !== q.className) {
22216 throw new Error('All queries must be for the same class');
22217 }
22218 });
22219
22220 var query = new AV.Query(className);
22221
22222 query._andQuery(queries);
22223
22224 return query;
22225 };
22226 /**
22227 * Retrieves a list of AVObjects that satisfy the CQL.
22228 * CQL syntax please see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
22229 *
22230 * @param {String} cql A CQL string, see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
22231 * @param {Array} pvalues An array contains placeholder values.
22232 * @param {AuthOptions} options
22233 * @return {Promise} A promise that is resolved with the results when
22234 * the query completes.
22235 */
22236
22237
22238 AV.Query.doCloudQuery = function (cql, pvalues, options) {
22239 var params = {
22240 cql: cql
22241 };
22242
22243 if (_.isArray(pvalues)) {
22244 params.pvalues = pvalues;
22245 } else {
22246 options = pvalues;
22247 }
22248
22249 var request = _request('cloudQuery', null, null, 'GET', params, options);
22250
22251 return request.then(function (response) {
22252 //query to process results.
22253 var query = new AV.Query(response.className);
22254 var results = (0, _map.default)(_).call(_, response.results, function (json) {
22255 var obj = query._newObject(response);
22256
22257 if (obj._finishFetch) {
22258 obj._finishFetch(query._processResult(json), true);
22259 }
22260
22261 return obj;
22262 });
22263 return {
22264 results: results,
22265 count: response.count,
22266 className: response.className
22267 };
22268 });
22269 };
22270 /**
22271 * Return a query with conditions from json.
22272 * This can be useful to send a query from server side to client side.
22273 * @since 4.0.0
22274 * @param {Object} json from {@link AV.Query#toJSON}
22275 * @return {AV.Query}
22276 */
22277
22278
22279 AV.Query.fromJSON = function (_ref) {
22280 var className = _ref.className,
22281 where = _ref.where,
22282 include = _ref.include,
22283 select = _ref.select,
22284 includeACL = _ref.includeACL,
22285 limit = _ref.limit,
22286 skip = _ref.skip,
22287 order = _ref.order;
22288
22289 if (typeof className !== 'string') {
22290 throw new TypeError('Invalid Query JSON, className must be a String.');
22291 }
22292
22293 var query = new AV.Query(className);
22294
22295 _.extend(query, {
22296 _where: where,
22297 _include: include,
22298 _select: select,
22299 _includeACL: includeACL,
22300 _limit: limit,
22301 _skip: skip,
22302 _order: order
22303 });
22304
22305 return query;
22306 };
22307
22308 AV.Query._extend = AV._extend;
22309
22310 _.extend(AV.Query.prototype,
22311 /** @lends AV.Query.prototype */
22312 {
22313 //hook to iterate result. Added by dennis<xzhuang@avoscloud.com>.
22314 _processResult: function _processResult(obj) {
22315 return obj;
22316 },
22317
22318 /**
22319 * Constructs an AV.Object whose id is already known by fetching data from
22320 * the server.
22321 *
22322 * @param {String} objectId The id of the object to be fetched.
22323 * @param {AuthOptions} options
22324 * @return {Promise.<AV.Object>}
22325 */
22326 get: function get(objectId, options) {
22327 if (!_.isString(objectId)) {
22328 throw new Error('objectId must be a string');
22329 }
22330
22331 if (objectId === '') {
22332 return _promise.default.reject(new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.'));
22333 }
22334
22335 var obj = this._newObject();
22336
22337 obj.id = objectId;
22338
22339 var queryJSON = this._getParams();
22340
22341 var fetchOptions = {};
22342 if ((0, _keys.default)(queryJSON)) fetchOptions.keys = (0, _keys.default)(queryJSON);
22343 if (queryJSON.include) fetchOptions.include = queryJSON.include;
22344 if (queryJSON.includeACL) fetchOptions.includeACL = queryJSON.includeACL;
22345 return _request('classes', this.className, objectId, 'GET', transformFetchOptions(fetchOptions), options).then(function (response) {
22346 if (_.isEmpty(response)) throw new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
22347
22348 obj._finishFetch(obj.parse(response), true);
22349
22350 return obj;
22351 });
22352 },
22353
22354 /**
22355 * Returns a JSON representation of this query.
22356 * @return {Object}
22357 */
22358 toJSON: function toJSON() {
22359 var className = this.className,
22360 where = this._where,
22361 include = this._include,
22362 select = this._select,
22363 includeACL = this._includeACL,
22364 limit = this._limit,
22365 skip = this._skip,
22366 order = this._order;
22367 return {
22368 className: className,
22369 where: where,
22370 include: include,
22371 select: select,
22372 includeACL: includeACL,
22373 limit: limit,
22374 skip: skip,
22375 order: order
22376 };
22377 },
22378 _getParams: function _getParams() {
22379 var params = _.extend({}, this._defaultParams, {
22380 where: this._where
22381 });
22382
22383 if (this._include.length > 0) {
22384 params.include = this._include.join(',');
22385 }
22386
22387 if (this._select.length > 0) {
22388 params.keys = this._select.join(',');
22389 }
22390
22391 if (this._includeACL !== undefined) {
22392 params.returnACL = this._includeACL;
22393 }
22394
22395 if (this._limit >= 0) {
22396 params.limit = this._limit;
22397 }
22398
22399 if (this._skip > 0) {
22400 params.skip = this._skip;
22401 }
22402
22403 if (this._order !== undefined) {
22404 params.order = this._order;
22405 }
22406
22407 return params;
22408 },
22409 _newObject: function _newObject(response) {
22410 var obj;
22411
22412 if (response && response.className) {
22413 obj = new AV.Object(response.className);
22414 } else {
22415 obj = new this.objectClass();
22416 }
22417
22418 return obj;
22419 },
22420 _createRequest: function _createRequest() {
22421 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._getParams();
22422 var options = arguments.length > 1 ? arguments[1] : undefined;
22423 var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "/classes/".concat(this.className);
22424
22425 if (encodeURIComponent((0, _stringify.default)(params)).length > 2000) {
22426 var body = {
22427 requests: [{
22428 method: 'GET',
22429 path: "/1.1".concat(path),
22430 params: params
22431 }]
22432 };
22433 return request({
22434 path: '/batch',
22435 method: 'POST',
22436 data: body,
22437 authOptions: options
22438 }).then(function (response) {
22439 var result = response[0];
22440
22441 if (result.success) {
22442 return result.success;
22443 }
22444
22445 var error = new AVError(result.error.code, result.error.error || 'Unknown batch error');
22446 throw error;
22447 });
22448 }
22449
22450 return request({
22451 method: 'GET',
22452 path: path,
22453 query: params,
22454 authOptions: options
22455 });
22456 },
22457 _parseResponse: function _parseResponse(response) {
22458 var _this = this;
22459
22460 return (0, _map.default)(_).call(_, response.results, function (json) {
22461 var obj = _this._newObject(response);
22462
22463 if (obj._finishFetch) {
22464 obj._finishFetch(_this._processResult(json), true);
22465 }
22466
22467 return obj;
22468 });
22469 },
22470
22471 /**
22472 * Retrieves a list of AVObjects that satisfy this query.
22473 *
22474 * @param {AuthOptions} options
22475 * @return {Promise} A promise that is resolved with the results when
22476 * the query completes.
22477 */
22478 find: function find(options) {
22479 var request = this._createRequest(undefined, options);
22480
22481 return request.then(this._parseResponse.bind(this));
22482 },
22483
22484 /**
22485 * Retrieves both AVObjects and total count.
22486 *
22487 * @since 4.12.0
22488 * @param {AuthOptions} options
22489 * @return {Promise} A tuple contains results and count.
22490 */
22491 findAndCount: function findAndCount(options) {
22492 var _this2 = this;
22493
22494 var params = this._getParams();
22495
22496 params.count = 1;
22497
22498 var request = this._createRequest(params, options);
22499
22500 return request.then(function (response) {
22501 return [_this2._parseResponse(response), response.count];
22502 });
22503 },
22504
22505 /**
22506 * scan a Query. masterKey required.
22507 *
22508 * @since 2.1.0
22509 * @param {object} [options]
22510 * @param {string} [options.orderedBy] specify the key to sort
22511 * @param {number} [options.batchSize] specify the batch size for each request
22512 * @param {AuthOptions} [authOptions]
22513 * @return {AsyncIterator.<AV.Object>}
22514 * @example const testIterator = {
22515 * [Symbol.asyncIterator]() {
22516 * return new Query('Test').scan(undefined, { useMasterKey: true });
22517 * },
22518 * };
22519 * for await (const test of testIterator) {
22520 * console.log(test.id);
22521 * }
22522 */
22523 scan: function scan() {
22524 var _this3 = this;
22525
22526 var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
22527 orderedBy = _ref2.orderedBy,
22528 batchSize = _ref2.batchSize;
22529
22530 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
22531
22532 var condition = this._getParams();
22533
22534 debug('scan %O', condition);
22535
22536 if (condition.order) {
22537 console.warn('The order of the query is ignored for Query#scan. Checkout the orderedBy option of Query#scan.');
22538 delete condition.order;
22539 }
22540
22541 if (condition.skip) {
22542 console.warn('The skip option of the query is ignored for Query#scan.');
22543 delete condition.skip;
22544 }
22545
22546 if (condition.limit) {
22547 console.warn('The limit option of the query is ignored for Query#scan.');
22548 delete condition.limit;
22549 }
22550
22551 if (orderedBy) condition.scan_key = orderedBy;
22552 if (batchSize) condition.limit = batchSize;
22553 var cursor;
22554 var remainResults = [];
22555 return {
22556 next: function next() {
22557 if (remainResults.length) {
22558 return _promise.default.resolve({
22559 done: false,
22560 value: remainResults.shift()
22561 });
22562 }
22563
22564 if (cursor === null) {
22565 return _promise.default.resolve({
22566 done: true
22567 });
22568 }
22569
22570 return _request('scan/classes', _this3.className, null, 'GET', cursor ? _.extend({}, condition, {
22571 cursor: cursor
22572 }) : condition, authOptions).then(function (response) {
22573 cursor = response.cursor;
22574
22575 if (response.results.length) {
22576 var results = _this3._parseResponse(response);
22577
22578 results.forEach(function (result) {
22579 return remainResults.push(result);
22580 });
22581 }
22582
22583 if (cursor === null && remainResults.length === 0) {
22584 return {
22585 done: true
22586 };
22587 }
22588
22589 return {
22590 done: false,
22591 value: remainResults.shift()
22592 };
22593 });
22594 }
22595 };
22596 },
22597
22598 /**
22599 * Delete objects retrieved by this query.
22600 * @param {AuthOptions} options
22601 * @return {Promise} A promise that is fulfilled when the save
22602 * completes.
22603 */
22604 destroyAll: function destroyAll(options) {
22605 var self = this;
22606 return (0, _find.default)(self).call(self, options).then(function (objects) {
22607 return AV.Object.destroyAll(objects, options);
22608 });
22609 },
22610
22611 /**
22612 * Counts the number of objects that match this query.
22613 *
22614 * @param {AuthOptions} options
22615 * @return {Promise} A promise that is resolved with the count when
22616 * the query completes.
22617 */
22618 count: function count(options) {
22619 var params = this._getParams();
22620
22621 params.limit = 0;
22622 params.count = 1;
22623
22624 var request = this._createRequest(params, options);
22625
22626 return request.then(function (response) {
22627 return response.count;
22628 });
22629 },
22630
22631 /**
22632 * Retrieves at most one AV.Object that satisfies this query.
22633 *
22634 * @param {AuthOptions} options
22635 * @return {Promise} A promise that is resolved with the object when
22636 * the query completes.
22637 */
22638 first: function first(options) {
22639 var self = this;
22640
22641 var params = this._getParams();
22642
22643 params.limit = 1;
22644
22645 var request = this._createRequest(params, options);
22646
22647 return request.then(function (response) {
22648 return (0, _map.default)(_).call(_, response.results, function (json) {
22649 var obj = self._newObject();
22650
22651 if (obj._finishFetch) {
22652 obj._finishFetch(self._processResult(json), true);
22653 }
22654
22655 return obj;
22656 })[0];
22657 });
22658 },
22659
22660 /**
22661 * Sets the number of results to skip before returning any results.
22662 * This is useful for pagination.
22663 * Default is to skip zero results.
22664 * @param {Number} n the number of results to skip.
22665 * @return {AV.Query} Returns the query, so you can chain this call.
22666 */
22667 skip: function skip(n) {
22668 requires(n, 'undefined is not a valid skip value');
22669 this._skip = n;
22670 return this;
22671 },
22672
22673 /**
22674 * Sets the limit of the number of results to return. The default limit is
22675 * 100, with a maximum of 1000 results being returned at a time.
22676 * @param {Number} n the number of results to limit to.
22677 * @return {AV.Query} Returns the query, so you can chain this call.
22678 */
22679 limit: function limit(n) {
22680 requires(n, 'undefined is not a valid limit value');
22681 this._limit = n;
22682 return this;
22683 },
22684
22685 /**
22686 * Add a constraint to the query that requires a particular key's value to
22687 * be equal to the provided value.
22688 * @param {String} key The key to check.
22689 * @param value The value that the AV.Object must contain.
22690 * @return {AV.Query} Returns the query, so you can chain this call.
22691 */
22692 equalTo: function equalTo(key, value) {
22693 requires(key, 'undefined is not a valid key');
22694 requires(value, 'undefined is not a valid value');
22695 this._where[key] = AV._encode(value);
22696 return this;
22697 },
22698
22699 /**
22700 * Helper for condition queries
22701 * @private
22702 */
22703 _addCondition: function _addCondition(key, condition, value) {
22704 requires(key, 'undefined is not a valid condition key');
22705 requires(condition, 'undefined is not a valid condition');
22706 requires(value, 'undefined is not a valid condition value'); // Check if we already have a condition
22707
22708 if (!this._where[key]) {
22709 this._where[key] = {};
22710 }
22711
22712 this._where[key][condition] = AV._encode(value);
22713 return this;
22714 },
22715
22716 /**
22717 * Add a constraint to the query that requires a particular
22718 * <strong>array</strong> key's length to be equal to the provided value.
22719 * @param {String} key The array key to check.
22720 * @param {number} value The length value.
22721 * @return {AV.Query} Returns the query, so you can chain this call.
22722 */
22723 sizeEqualTo: function sizeEqualTo(key, value) {
22724 this._addCondition(key, '$size', value);
22725
22726 return this;
22727 },
22728
22729 /**
22730 * Add a constraint to the query that requires a particular key's value to
22731 * be not equal to the provided value.
22732 * @param {String} key The key to check.
22733 * @param value The value that must not be equalled.
22734 * @return {AV.Query} Returns the query, so you can chain this call.
22735 */
22736 notEqualTo: function notEqualTo(key, value) {
22737 this._addCondition(key, '$ne', value);
22738
22739 return this;
22740 },
22741
22742 /**
22743 * Add a constraint to the query that requires a particular key's value to
22744 * be less than the provided value.
22745 * @param {String} key The key to check.
22746 * @param value The value that provides an upper bound.
22747 * @return {AV.Query} Returns the query, so you can chain this call.
22748 */
22749 lessThan: function lessThan(key, value) {
22750 this._addCondition(key, '$lt', value);
22751
22752 return this;
22753 },
22754
22755 /**
22756 * Add a constraint to the query that requires a particular key's value to
22757 * be greater than the provided value.
22758 * @param {String} key The key to check.
22759 * @param value The value that provides an lower bound.
22760 * @return {AV.Query} Returns the query, so you can chain this call.
22761 */
22762 greaterThan: function greaterThan(key, value) {
22763 this._addCondition(key, '$gt', value);
22764
22765 return this;
22766 },
22767
22768 /**
22769 * Add a constraint to the query that requires a particular key's value to
22770 * be less than or equal to the provided value.
22771 * @param {String} key The key to check.
22772 * @param value The value that provides an upper bound.
22773 * @return {AV.Query} Returns the query, so you can chain this call.
22774 */
22775 lessThanOrEqualTo: function lessThanOrEqualTo(key, value) {
22776 this._addCondition(key, '$lte', value);
22777
22778 return this;
22779 },
22780
22781 /**
22782 * Add a constraint to the query that requires a particular key's value to
22783 * be greater than or equal to the provided value.
22784 * @param {String} key The key to check.
22785 * @param value The value that provides an lower bound.
22786 * @return {AV.Query} Returns the query, so you can chain this call.
22787 */
22788 greaterThanOrEqualTo: function greaterThanOrEqualTo(key, value) {
22789 this._addCondition(key, '$gte', value);
22790
22791 return this;
22792 },
22793
22794 /**
22795 * Add a constraint to the query that requires a particular key's value to
22796 * be contained in the provided list of values.
22797 * @param {String} key The key to check.
22798 * @param {Array} values The values that will match.
22799 * @return {AV.Query} Returns the query, so you can chain this call.
22800 */
22801 containedIn: function containedIn(key, values) {
22802 this._addCondition(key, '$in', values);
22803
22804 return this;
22805 },
22806
22807 /**
22808 * Add a constraint to the query that requires a particular key's value to
22809 * not be contained in the provided list of values.
22810 * @param {String} key The key to check.
22811 * @param {Array} values The values that will not match.
22812 * @return {AV.Query} Returns the query, so you can chain this call.
22813 */
22814 notContainedIn: function notContainedIn(key, values) {
22815 this._addCondition(key, '$nin', values);
22816
22817 return this;
22818 },
22819
22820 /**
22821 * Add a constraint to the query that requires a particular key's value to
22822 * contain each one of the provided list of values.
22823 * @param {String} key The key to check. This key's value must be an array.
22824 * @param {Array} values The values that will match.
22825 * @return {AV.Query} Returns the query, so you can chain this call.
22826 */
22827 containsAll: function containsAll(key, values) {
22828 this._addCondition(key, '$all', values);
22829
22830 return this;
22831 },
22832
22833 /**
22834 * Add a constraint for finding objects that contain the given key.
22835 * @param {String} key The key that should exist.
22836 * @return {AV.Query} Returns the query, so you can chain this call.
22837 */
22838 exists: function exists(key) {
22839 this._addCondition(key, '$exists', true);
22840
22841 return this;
22842 },
22843
22844 /**
22845 * Add a constraint for finding objects that do not contain a given key.
22846 * @param {String} key The key that should not exist
22847 * @return {AV.Query} Returns the query, so you can chain this call.
22848 */
22849 doesNotExist: function doesNotExist(key) {
22850 this._addCondition(key, '$exists', false);
22851
22852 return this;
22853 },
22854
22855 /**
22856 * Add a regular expression constraint for finding string values that match
22857 * the provided regular expression.
22858 * This may be slow for large datasets.
22859 * @param {String} key The key that the string to match is stored in.
22860 * @param {RegExp} regex The regular expression pattern to match.
22861 * @return {AV.Query} Returns the query, so you can chain this call.
22862 */
22863 matches: function matches(key, regex, modifiers) {
22864 this._addCondition(key, '$regex', regex);
22865
22866 if (!modifiers) {
22867 modifiers = '';
22868 } // Javascript regex options support mig as inline options but store them
22869 // as properties of the object. We support mi & should migrate them to
22870 // modifiers
22871
22872
22873 if (regex.ignoreCase) {
22874 modifiers += 'i';
22875 }
22876
22877 if (regex.multiline) {
22878 modifiers += 'm';
22879 }
22880
22881 if (modifiers && modifiers.length) {
22882 this._addCondition(key, '$options', modifiers);
22883 }
22884
22885 return this;
22886 },
22887
22888 /**
22889 * Add a constraint that requires that a key's value matches a AV.Query
22890 * constraint.
22891 * @param {String} key The key that the contains the object to match the
22892 * query.
22893 * @param {AV.Query} query The query that should match.
22894 * @return {AV.Query} Returns the query, so you can chain this call.
22895 */
22896 matchesQuery: function matchesQuery(key, query) {
22897 var queryJSON = query._getParams();
22898
22899 queryJSON.className = query.className;
22900
22901 this._addCondition(key, '$inQuery', queryJSON);
22902
22903 return this;
22904 },
22905
22906 /**
22907 * Add a constraint that requires that a key's value not matches a
22908 * AV.Query constraint.
22909 * @param {String} key The key that the contains the object to match the
22910 * query.
22911 * @param {AV.Query} query The query that should not match.
22912 * @return {AV.Query} Returns the query, so you can chain this call.
22913 */
22914 doesNotMatchQuery: function doesNotMatchQuery(key, query) {
22915 var queryJSON = query._getParams();
22916
22917 queryJSON.className = query.className;
22918
22919 this._addCondition(key, '$notInQuery', queryJSON);
22920
22921 return this;
22922 },
22923
22924 /**
22925 * Add a constraint that requires that a key's value matches a value in
22926 * an object returned by a different AV.Query.
22927 * @param {String} key The key that contains the value that is being
22928 * matched.
22929 * @param {String} queryKey The key in the objects returned by the query to
22930 * match against.
22931 * @param {AV.Query} query The query to run.
22932 * @return {AV.Query} Returns the query, so you can chain this call.
22933 */
22934 matchesKeyInQuery: function matchesKeyInQuery(key, queryKey, query) {
22935 var queryJSON = query._getParams();
22936
22937 queryJSON.className = query.className;
22938
22939 this._addCondition(key, '$select', {
22940 key: queryKey,
22941 query: queryJSON
22942 });
22943
22944 return this;
22945 },
22946
22947 /**
22948 * Add a constraint that requires that a key's value not match a value in
22949 * an object returned by a different AV.Query.
22950 * @param {String} key The key that contains the value that is being
22951 * excluded.
22952 * @param {String} queryKey The key in the objects returned by the query to
22953 * match against.
22954 * @param {AV.Query} query The query to run.
22955 * @return {AV.Query} Returns the query, so you can chain this call.
22956 */
22957 doesNotMatchKeyInQuery: function doesNotMatchKeyInQuery(key, queryKey, query) {
22958 var queryJSON = query._getParams();
22959
22960 queryJSON.className = query.className;
22961
22962 this._addCondition(key, '$dontSelect', {
22963 key: queryKey,
22964 query: queryJSON
22965 });
22966
22967 return this;
22968 },
22969
22970 /**
22971 * Add constraint that at least one of the passed in queries matches.
22972 * @param {Array} queries
22973 * @return {AV.Query} Returns the query, so you can chain this call.
22974 * @private
22975 */
22976 _orQuery: function _orQuery(queries) {
22977 var queryJSON = (0, _map.default)(_).call(_, queries, function (q) {
22978 return q._getParams().where;
22979 });
22980 this._where.$or = queryJSON;
22981 return this;
22982 },
22983
22984 /**
22985 * Add constraint that both of the passed in queries matches.
22986 * @param {Array} queries
22987 * @return {AV.Query} Returns the query, so you can chain this call.
22988 * @private
22989 */
22990 _andQuery: function _andQuery(queries) {
22991 var queryJSON = (0, _map.default)(_).call(_, queries, function (q) {
22992 return q._getParams().where;
22993 });
22994 this._where.$and = queryJSON;
22995 return this;
22996 },
22997
22998 /**
22999 * Converts a string into a regex that matches it.
23000 * Surrounding with \Q .. \E does this, we just need to escape \E's in
23001 * the text separately.
23002 * @private
23003 */
23004 _quote: function _quote(s) {
23005 return '\\Q' + s.replace('\\E', '\\E\\\\E\\Q') + '\\E';
23006 },
23007
23008 /**
23009 * Add a constraint for finding string values that contain a provided
23010 * string. This may be slow for large datasets.
23011 * @param {String} key The key that the string to match is stored in.
23012 * @param {String} substring The substring that the value must contain.
23013 * @return {AV.Query} Returns the query, so you can chain this call.
23014 */
23015 contains: function contains(key, value) {
23016 this._addCondition(key, '$regex', this._quote(value));
23017
23018 return this;
23019 },
23020
23021 /**
23022 * Add a constraint for finding string values that start with a provided
23023 * string. This query will use the backend index, so it will be fast even
23024 * for large datasets.
23025 * @param {String} key The key that the string to match is stored in.
23026 * @param {String} prefix The substring that the value must start with.
23027 * @return {AV.Query} Returns the query, so you can chain this call.
23028 */
23029 startsWith: function startsWith(key, value) {
23030 this._addCondition(key, '$regex', '^' + this._quote(value));
23031
23032 return this;
23033 },
23034
23035 /**
23036 * Add a constraint for finding string values that end with a provided
23037 * string. This will be slow for large datasets.
23038 * @param {String} key The key that the string to match is stored in.
23039 * @param {String} suffix The substring that the value must end with.
23040 * @return {AV.Query} Returns the query, so you can chain this call.
23041 */
23042 endsWith: function endsWith(key, value) {
23043 this._addCondition(key, '$regex', this._quote(value) + '$');
23044
23045 return this;
23046 },
23047
23048 /**
23049 * Sorts the results in ascending order by the given key.
23050 *
23051 * @param {String} key The key to order by.
23052 * @return {AV.Query} Returns the query, so you can chain this call.
23053 */
23054 ascending: function ascending(key) {
23055 requires(key, 'undefined is not a valid key');
23056 this._order = key;
23057 return this;
23058 },
23059
23060 /**
23061 * Also sorts the results in ascending order by the given key. The previous sort keys have
23062 * precedence over this key.
23063 *
23064 * @param {String} key The key to order by
23065 * @return {AV.Query} Returns the query so you can chain this call.
23066 */
23067 addAscending: function addAscending(key) {
23068 requires(key, 'undefined is not a valid key');
23069 if (this._order) this._order += ',' + key;else this._order = key;
23070 return this;
23071 },
23072
23073 /**
23074 * Sorts the results in descending order by the given key.
23075 *
23076 * @param {String} key The key to order by.
23077 * @return {AV.Query} Returns the query, so you can chain this call.
23078 */
23079 descending: function descending(key) {
23080 requires(key, 'undefined is not a valid key');
23081 this._order = '-' + key;
23082 return this;
23083 },
23084
23085 /**
23086 * Also sorts the results in descending order by the given key. The previous sort keys have
23087 * precedence over this key.
23088 *
23089 * @param {String} key The key to order by
23090 * @return {AV.Query} Returns the query so you can chain this call.
23091 */
23092 addDescending: function addDescending(key) {
23093 requires(key, 'undefined is not a valid key');
23094 if (this._order) this._order += ',-' + key;else this._order = '-' + key;
23095 return this;
23096 },
23097
23098 /**
23099 * Add a proximity based constraint for finding objects with key point
23100 * values near the point given.
23101 * @param {String} key The key that the AV.GeoPoint is stored in.
23102 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
23103 * @return {AV.Query} Returns the query, so you can chain this call.
23104 */
23105 near: function near(key, point) {
23106 if (!(point instanceof AV.GeoPoint)) {
23107 // Try to cast it to a GeoPoint, so that near("loc", [20,30]) works.
23108 point = new AV.GeoPoint(point);
23109 }
23110
23111 this._addCondition(key, '$nearSphere', point);
23112
23113 return this;
23114 },
23115
23116 /**
23117 * Add a proximity based constraint for finding objects with key point
23118 * values near the point given and within the maximum distance given.
23119 * @param {String} key The key that the AV.GeoPoint is stored in.
23120 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
23121 * @param maxDistance Maximum distance (in radians) of results to return.
23122 * @return {AV.Query} Returns the query, so you can chain this call.
23123 */
23124 withinRadians: function withinRadians(key, point, distance) {
23125 this.near(key, point);
23126
23127 this._addCondition(key, '$maxDistance', distance);
23128
23129 return this;
23130 },
23131
23132 /**
23133 * Add a proximity based constraint for finding objects with key point
23134 * values near the point given and within the maximum distance given.
23135 * Radius of earth used is 3958.8 miles.
23136 * @param {String} key The key that the AV.GeoPoint is stored in.
23137 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
23138 * @param {Number} maxDistance Maximum distance (in miles) of results to
23139 * return.
23140 * @return {AV.Query} Returns the query, so you can chain this call.
23141 */
23142 withinMiles: function withinMiles(key, point, distance) {
23143 return this.withinRadians(key, point, distance / 3958.8);
23144 },
23145
23146 /**
23147 * Add a proximity based constraint for finding objects with key point
23148 * values near the point given and within the maximum distance given.
23149 * Radius of earth used is 6371.0 kilometers.
23150 * @param {String} key The key that the AV.GeoPoint is stored in.
23151 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
23152 * @param {Number} maxDistance Maximum distance (in kilometers) of results
23153 * to return.
23154 * @return {AV.Query} Returns the query, so you can chain this call.
23155 */
23156 withinKilometers: function withinKilometers(key, point, distance) {
23157 return this.withinRadians(key, point, distance / 6371.0);
23158 },
23159
23160 /**
23161 * Add a constraint to the query that requires a particular key's
23162 * coordinates be contained within a given rectangular geographic bounding
23163 * box.
23164 * @param {String} key The key to be constrained.
23165 * @param {AV.GeoPoint} southwest
23166 * The lower-left inclusive corner of the box.
23167 * @param {AV.GeoPoint} northeast
23168 * The upper-right inclusive corner of the box.
23169 * @return {AV.Query} Returns the query, so you can chain this call.
23170 */
23171 withinGeoBox: function withinGeoBox(key, southwest, northeast) {
23172 if (!(southwest instanceof AV.GeoPoint)) {
23173 southwest = new AV.GeoPoint(southwest);
23174 }
23175
23176 if (!(northeast instanceof AV.GeoPoint)) {
23177 northeast = new AV.GeoPoint(northeast);
23178 }
23179
23180 this._addCondition(key, '$within', {
23181 $box: [southwest, northeast]
23182 });
23183
23184 return this;
23185 },
23186
23187 /**
23188 * Include nested AV.Objects for the provided key. You can use dot
23189 * notation to specify which fields in the included object are also fetch.
23190 * @param {String[]} keys The name of the key to include.
23191 * @return {AV.Query} Returns the query, so you can chain this call.
23192 */
23193 include: function include(keys) {
23194 var _this4 = this;
23195
23196 requires(keys, 'undefined is not a valid key');
23197
23198 _.forEach(arguments, function (keys) {
23199 var _context;
23200
23201 _this4._include = (0, _concat.default)(_context = _this4._include).call(_context, ensureArray(keys));
23202 });
23203
23204 return this;
23205 },
23206
23207 /**
23208 * Include the ACL.
23209 * @param {Boolean} [value=true] Whether to include the ACL
23210 * @return {AV.Query} Returns the query, so you can chain this call.
23211 */
23212 includeACL: function includeACL() {
23213 var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
23214 this._includeACL = value;
23215 return this;
23216 },
23217
23218 /**
23219 * Restrict the fields of the returned AV.Objects to include only the
23220 * provided keys. If this is called multiple times, then all of the keys
23221 * specified in each of the calls will be included.
23222 * @param {String[]} keys The names of the keys to include.
23223 * @return {AV.Query} Returns the query, so you can chain this call.
23224 */
23225 select: function select(keys) {
23226 var _this5 = this;
23227
23228 requires(keys, 'undefined is not a valid key');
23229
23230 _.forEach(arguments, function (keys) {
23231 var _context2;
23232
23233 _this5._select = (0, _concat.default)(_context2 = _this5._select).call(_context2, ensureArray(keys));
23234 });
23235
23236 return this;
23237 },
23238
23239 /**
23240 * Iterates over each result of a query, calling a callback for each one. If
23241 * the callback returns a promise, the iteration will not continue until
23242 * that promise has been fulfilled. If the callback returns a rejected
23243 * promise, then iteration will stop with that error. The items are
23244 * processed in an unspecified order. The query may not have any sort order,
23245 * and may not use limit or skip.
23246 * @param callback {Function} Callback that will be called with each result
23247 * of the query.
23248 * @return {Promise} A promise that will be fulfilled once the
23249 * iteration has completed.
23250 */
23251 each: function each(callback) {
23252 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23253
23254 if (this._order || this._skip || this._limit >= 0) {
23255 var error = new Error('Cannot iterate on a query with sort, skip, or limit.');
23256 return _promise.default.reject(error);
23257 }
23258
23259 var query = new AV.Query(this.objectClass); // We can override the batch size from the options.
23260 // This is undocumented, but useful for testing.
23261
23262 query._limit = options.batchSize || 100;
23263 query._where = _.clone(this._where);
23264 query._include = _.clone(this._include);
23265 query.ascending('objectId');
23266 var finished = false;
23267 return continueWhile(function () {
23268 return !finished;
23269 }, function () {
23270 return (0, _find.default)(query).call(query, options).then(function (results) {
23271 var callbacksDone = _promise.default.resolve();
23272
23273 _.each(results, function (result) {
23274 callbacksDone = callbacksDone.then(function () {
23275 return callback(result);
23276 });
23277 });
23278
23279 return callbacksDone.then(function () {
23280 if (results.length >= query._limit) {
23281 query.greaterThan('objectId', results[results.length - 1].id);
23282 } else {
23283 finished = true;
23284 }
23285 });
23286 });
23287 });
23288 },
23289
23290 /**
23291 * Subscribe the changes of this query.
23292 *
23293 * LiveQuery is not included in the default bundle: {@link https://url.leanapp.cn/enable-live-query}.
23294 *
23295 * @since 3.0.0
23296 * @return {AV.LiveQuery} An eventemitter which can be used to get LiveQuery updates;
23297 */
23298 subscribe: function subscribe(options) {
23299 return AV.LiveQuery.init(this, options);
23300 }
23301 });
23302
23303 AV.FriendShipQuery = AV.Query._extend({
23304 _newObject: function _newObject() {
23305 var UserClass = AV.Object._getSubclass('_User');
23306
23307 return new UserClass();
23308 },
23309 _processResult: function _processResult(json) {
23310 if (json && json[this._friendshipTag]) {
23311 var user = json[this._friendshipTag];
23312
23313 if (user.__type === 'Pointer' && user.className === '_User') {
23314 delete user.__type;
23315 delete user.className;
23316 }
23317
23318 return user;
23319 } else {
23320 return null;
23321 }
23322 }
23323 });
23324};
23325
23326/***/ }),
23327/* 564 */
23328/***/ (function(module, exports, __webpack_require__) {
23329
23330"use strict";
23331
23332
23333var _interopRequireDefault = __webpack_require__(1);
23334
23335var _promise = _interopRequireDefault(__webpack_require__(12));
23336
23337var _keys = _interopRequireDefault(__webpack_require__(62));
23338
23339var _ = __webpack_require__(3);
23340
23341var EventEmitter = __webpack_require__(235);
23342
23343var _require = __webpack_require__(32),
23344 inherits = _require.inherits;
23345
23346var _require2 = __webpack_require__(28),
23347 request = _require2.request;
23348
23349var subscribe = function subscribe(queryJSON, subscriptionId) {
23350 return request({
23351 method: 'POST',
23352 path: '/LiveQuery/subscribe',
23353 data: {
23354 query: queryJSON,
23355 id: subscriptionId
23356 }
23357 });
23358};
23359
23360module.exports = function (AV) {
23361 var requireRealtime = function requireRealtime() {
23362 if (!AV._config.realtime) {
23363 throw new Error('LiveQuery not supported. Please use the LiveQuery bundle. https://url.leanapp.cn/enable-live-query');
23364 }
23365 };
23366 /**
23367 * @class
23368 * A LiveQuery, created by {@link AV.Query#subscribe} is an EventEmitter notifies changes of the Query.
23369 * @since 3.0.0
23370 */
23371
23372
23373 AV.LiveQuery = inherits(EventEmitter,
23374 /** @lends AV.LiveQuery.prototype */
23375 {
23376 constructor: function constructor(id, client, queryJSON, subscriptionId) {
23377 var _this = this;
23378
23379 EventEmitter.apply(this);
23380 this.id = id;
23381 this._client = client;
23382
23383 this._client.register(this);
23384
23385 this._queryJSON = queryJSON;
23386 this._subscriptionId = subscriptionId;
23387 this._onMessage = this._dispatch.bind(this);
23388
23389 this._onReconnect = function () {
23390 subscribe(_this._queryJSON, _this._subscriptionId).catch(function (error) {
23391 return console.error("LiveQuery resubscribe error: ".concat(error.message));
23392 });
23393 };
23394
23395 client.on('message', this._onMessage);
23396 client.on('reconnect', this._onReconnect);
23397 },
23398 _dispatch: function _dispatch(message) {
23399 var _this2 = this;
23400
23401 message.forEach(function (_ref) {
23402 var op = _ref.op,
23403 object = _ref.object,
23404 queryId = _ref.query_id,
23405 updatedKeys = _ref.updatedKeys;
23406 if (queryId !== _this2.id) return;
23407 var target = AV.parseJSON(_.extend({
23408 __type: object.className === '_File' ? 'File' : 'Object'
23409 }, object));
23410
23411 if (updatedKeys) {
23412 /**
23413 * An existing AV.Object which fulfills the Query you subscribe is updated.
23414 * @event AV.LiveQuery#update
23415 * @param {AV.Object|AV.File} target updated object
23416 * @param {String[]} updatedKeys updated keys
23417 */
23418
23419 /**
23420 * An existing AV.Object which doesn't fulfill the Query is updated and now it fulfills the Query.
23421 * @event AV.LiveQuery#enter
23422 * @param {AV.Object|AV.File} target updated object
23423 * @param {String[]} updatedKeys updated keys
23424 */
23425
23426 /**
23427 * An existing AV.Object which fulfills the Query is updated and now it doesn't fulfill the Query.
23428 * @event AV.LiveQuery#leave
23429 * @param {AV.Object|AV.File} target updated object
23430 * @param {String[]} updatedKeys updated keys
23431 */
23432 _this2.emit(op, target, updatedKeys);
23433 } else {
23434 /**
23435 * A new AV.Object which fulfills the Query you subscribe is created.
23436 * @event AV.LiveQuery#create
23437 * @param {AV.Object|AV.File} target updated object
23438 */
23439
23440 /**
23441 * An existing AV.Object which fulfills the Query you subscribe is deleted.
23442 * @event AV.LiveQuery#delete
23443 * @param {AV.Object|AV.File} target updated object
23444 */
23445 _this2.emit(op, target);
23446 }
23447 });
23448 },
23449
23450 /**
23451 * unsubscribe the query
23452 *
23453 * @return {Promise}
23454 */
23455 unsubscribe: function unsubscribe() {
23456 var client = this._client;
23457 client.off('message', this._onMessage);
23458 client.off('reconnect', this._onReconnect);
23459 client.deregister(this);
23460 return request({
23461 method: 'POST',
23462 path: '/LiveQuery/unsubscribe',
23463 data: {
23464 id: client.id,
23465 query_id: this.id
23466 }
23467 });
23468 }
23469 },
23470 /** @lends AV.LiveQuery */
23471 {
23472 init: function init(query) {
23473 var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
23474 _ref2$subscriptionId = _ref2.subscriptionId,
23475 userDefinedSubscriptionId = _ref2$subscriptionId === void 0 ? AV._getSubscriptionId() : _ref2$subscriptionId;
23476
23477 requireRealtime();
23478 if (!(query instanceof AV.Query)) throw new TypeError('LiveQuery must be inited with a Query');
23479 return _promise.default.resolve(userDefinedSubscriptionId).then(function (subscriptionId) {
23480 return AV._config.realtime.createLiveQueryClient(subscriptionId).then(function (liveQueryClient) {
23481 var _query$_getParams = query._getParams(),
23482 where = _query$_getParams.where,
23483 keys = (0, _keys.default)(_query$_getParams),
23484 returnACL = _query$_getParams.returnACL;
23485
23486 var queryJSON = {
23487 where: where,
23488 keys: keys,
23489 returnACL: returnACL,
23490 className: query.className
23491 };
23492 var promise = subscribe(queryJSON, subscriptionId).then(function (_ref3) {
23493 var queryId = _ref3.query_id;
23494 return new AV.LiveQuery(queryId, liveQueryClient, queryJSON, subscriptionId);
23495 }).finally(function () {
23496 liveQueryClient.deregister(promise);
23497 });
23498 liveQueryClient.register(promise);
23499 return promise;
23500 });
23501 });
23502 },
23503
23504 /**
23505 * Pause the LiveQuery connection. This is useful to deactivate the SDK when the app is swtiched to background.
23506 * @static
23507 * @return void
23508 */
23509 pause: function pause() {
23510 requireRealtime();
23511 return AV._config.realtime.pause();
23512 },
23513
23514 /**
23515 * Resume the LiveQuery connection. All subscriptions will be restored after reconnection.
23516 * @static
23517 * @return void
23518 */
23519 resume: function resume() {
23520 requireRealtime();
23521 return AV._config.realtime.resume();
23522 }
23523 });
23524};
23525
23526/***/ }),
23527/* 565 */
23528/***/ (function(module, exports, __webpack_require__) {
23529
23530"use strict";
23531
23532
23533var _ = __webpack_require__(3);
23534
23535var _require = __webpack_require__(32),
23536 tap = _require.tap;
23537
23538module.exports = function (AV) {
23539 /**
23540 * @class
23541 * @example
23542 * AV.Captcha.request().then(captcha => {
23543 * captcha.bind({
23544 * textInput: 'code', // the id for textInput
23545 * image: 'captcha',
23546 * verifyButton: 'verify',
23547 * }, {
23548 * success: (validateCode) => {}, // next step
23549 * error: (error) => {}, // present error.message to user
23550 * });
23551 * });
23552 */
23553 AV.Captcha = function Captcha(options, authOptions) {
23554 this._options = options;
23555 this._authOptions = authOptions;
23556 /**
23557 * The image url of the captcha
23558 * @type string
23559 */
23560
23561 this.url = undefined;
23562 /**
23563 * The captchaToken of the captcha.
23564 * @type string
23565 */
23566
23567 this.captchaToken = undefined;
23568 /**
23569 * The validateToken of the captcha.
23570 * @type string
23571 */
23572
23573 this.validateToken = undefined;
23574 };
23575 /**
23576 * Refresh the captcha
23577 * @return {Promise.<string>} a new capcha url
23578 */
23579
23580
23581 AV.Captcha.prototype.refresh = function refresh() {
23582 var _this = this;
23583
23584 return AV.Cloud._requestCaptcha(this._options, this._authOptions).then(function (_ref) {
23585 var captchaToken = _ref.captchaToken,
23586 url = _ref.url;
23587
23588 _.extend(_this, {
23589 captchaToken: captchaToken,
23590 url: url
23591 });
23592
23593 return url;
23594 });
23595 };
23596 /**
23597 * Verify the captcha
23598 * @param {String} code The code from user input
23599 * @return {Promise.<string>} validateToken if the code is valid
23600 */
23601
23602
23603 AV.Captcha.prototype.verify = function verify(code) {
23604 var _this2 = this;
23605
23606 return AV.Cloud.verifyCaptcha(code, this.captchaToken).then(tap(function (validateToken) {
23607 return _this2.validateToken = validateToken;
23608 }));
23609 };
23610
23611 if (true) {
23612 /**
23613 * Bind the captcha to HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
23614 * @param [elements]
23615 * @param {String|HTMLInputElement} [elements.textInput] An input element typed text, or the id for the element.
23616 * @param {String|HTMLImageElement} [elements.image] An image element, or the id for the element.
23617 * @param {String|HTMLElement} [elements.verifyButton] A button element, or the id for the element.
23618 * @param [callbacks]
23619 * @param {Function} [callbacks.success] Success callback will be called if the code is verified. The param `validateCode` can be used for further SMS request.
23620 * @param {Function} [callbacks.error] Error callback will be called if something goes wrong, detailed in param `error.message`.
23621 */
23622 AV.Captcha.prototype.bind = function bind(_ref2, _ref3) {
23623 var _this3 = this;
23624
23625 var textInput = _ref2.textInput,
23626 image = _ref2.image,
23627 verifyButton = _ref2.verifyButton;
23628 var success = _ref3.success,
23629 error = _ref3.error;
23630
23631 if (typeof textInput === 'string') {
23632 textInput = document.getElementById(textInput);
23633 if (!textInput) throw new Error("textInput with id ".concat(textInput, " not found"));
23634 }
23635
23636 if (typeof image === 'string') {
23637 image = document.getElementById(image);
23638 if (!image) throw new Error("image with id ".concat(image, " not found"));
23639 }
23640
23641 if (typeof verifyButton === 'string') {
23642 verifyButton = document.getElementById(verifyButton);
23643 if (!verifyButton) throw new Error("verifyButton with id ".concat(verifyButton, " not found"));
23644 }
23645
23646 this.__refresh = function () {
23647 return _this3.refresh().then(function (url) {
23648 image.src = url;
23649
23650 if (textInput) {
23651 textInput.value = '';
23652 textInput.focus();
23653 }
23654 }).catch(function (err) {
23655 return console.warn("refresh captcha fail: ".concat(err.message));
23656 });
23657 };
23658
23659 if (image) {
23660 this.__image = image;
23661 image.src = this.url;
23662 image.addEventListener('click', this.__refresh);
23663 }
23664
23665 this.__verify = function () {
23666 var code = textInput.value;
23667
23668 _this3.verify(code).catch(function (err) {
23669 _this3.__refresh();
23670
23671 throw err;
23672 }).then(success, error).catch(function (err) {
23673 return console.warn("verify captcha fail: ".concat(err.message));
23674 });
23675 };
23676
23677 if (textInput && verifyButton) {
23678 this.__verifyButton = verifyButton;
23679 verifyButton.addEventListener('click', this.__verify);
23680 }
23681 };
23682 /**
23683 * unbind the captcha from HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
23684 */
23685
23686
23687 AV.Captcha.prototype.unbind = function unbind() {
23688 if (this.__image) this.__image.removeEventListener('click', this.__refresh);
23689 if (this.__verifyButton) this.__verifyButton.removeEventListener('click', this.__verify);
23690 };
23691 }
23692 /**
23693 * Request a captcha
23694 * @param [options]
23695 * @param {Number} [options.width] width(px) of the captcha, ranged 60-200
23696 * @param {Number} [options.height] height(px) of the captcha, ranged 30-100
23697 * @param {Number} [options.size=4] length of the captcha, ranged 3-6. MasterKey required.
23698 * @param {Number} [options.ttl=60] time to live(s), ranged 10-180. MasterKey required.
23699 * @return {Promise.<AV.Captcha>}
23700 */
23701
23702
23703 AV.Captcha.request = function (options, authOptions) {
23704 var captcha = new AV.Captcha(options, authOptions);
23705 return captcha.refresh().then(function () {
23706 return captcha;
23707 });
23708 };
23709};
23710
23711/***/ }),
23712/* 566 */
23713/***/ (function(module, exports, __webpack_require__) {
23714
23715"use strict";
23716
23717
23718var _interopRequireDefault = __webpack_require__(1);
23719
23720var _promise = _interopRequireDefault(__webpack_require__(12));
23721
23722var _ = __webpack_require__(3);
23723
23724var _require = __webpack_require__(28),
23725 _request = _require._request,
23726 request = _require.request;
23727
23728module.exports = function (AV) {
23729 /**
23730 * Contains functions for calling and declaring
23731 * <p><strong><em>
23732 * Some functions are only available from Cloud Code.
23733 * </em></strong></p>
23734 *
23735 * @namespace
23736 * @borrows AV.Captcha.request as requestCaptcha
23737 */
23738 AV.Cloud = AV.Cloud || {};
23739
23740 _.extend(AV.Cloud,
23741 /** @lends AV.Cloud */
23742 {
23743 /**
23744 * Makes a call to a cloud function.
23745 * @param {String} name The function name.
23746 * @param {Object} [data] The parameters to send to the cloud function.
23747 * @param {AuthOptions} [options]
23748 * @return {Promise} A promise that will be resolved with the result
23749 * of the function.
23750 */
23751 run: function run(name, data, options) {
23752 return request({
23753 service: 'engine',
23754 method: 'POST',
23755 path: "/functions/".concat(name),
23756 data: AV._encode(data, null, true),
23757 authOptions: options
23758 }).then(function (resp) {
23759 return AV._decode(resp).result;
23760 });
23761 },
23762
23763 /**
23764 * Makes a call to a cloud function, you can send {AV.Object} as param or a field of param; the response
23765 * from server will also be parsed as an {AV.Object}, array of {AV.Object}, or object includes {AV.Object}
23766 * @param {String} name The function name.
23767 * @param {Object} [data] The parameters to send to the cloud function.
23768 * @param {AuthOptions} [options]
23769 * @return {Promise} A promise that will be resolved with the result of the function.
23770 */
23771 rpc: function rpc(name, data, options) {
23772 if (_.isArray(data)) {
23773 return _promise.default.reject(new Error("Can't pass Array as the param of rpc function in JavaScript SDK."));
23774 }
23775
23776 return request({
23777 service: 'engine',
23778 method: 'POST',
23779 path: "/call/".concat(name),
23780 data: AV._encodeObjectOrArray(data),
23781 authOptions: options
23782 }).then(function (resp) {
23783 return AV._decode(resp).result;
23784 });
23785 },
23786
23787 /**
23788 * Make a call to request server date time.
23789 * @return {Promise.<Date>} A promise that will be resolved with the result
23790 * of the function.
23791 * @since 0.5.9
23792 */
23793 getServerDate: function getServerDate() {
23794 return _request('date', null, null, 'GET').then(function (resp) {
23795 return AV._decode(resp);
23796 });
23797 },
23798
23799 /**
23800 * Makes a call to request an sms code for operation verification.
23801 * @param {String|Object} data The mobile phone number string or a JSON
23802 * object that contains mobilePhoneNumber,template,sign,op,ttl,name etc.
23803 * @param {String} data.mobilePhoneNumber
23804 * @param {String} [data.template] sms template name
23805 * @param {String} [data.sign] sms signature name
23806 * @param {String} [data.smsType] sending code by `sms` (default) or `voice` call
23807 * @param {SMSAuthOptions} [options]
23808 * @return {Promise} A promise that will be resolved if the request succeed
23809 */
23810 requestSmsCode: function requestSmsCode(data) {
23811 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23812
23813 if (_.isString(data)) {
23814 data = {
23815 mobilePhoneNumber: data
23816 };
23817 }
23818
23819 if (!data.mobilePhoneNumber) {
23820 throw new Error('Missing mobilePhoneNumber.');
23821 }
23822
23823 if (options.validateToken) {
23824 data = _.extend({}, data, {
23825 validate_token: options.validateToken
23826 });
23827 }
23828
23829 return _request('requestSmsCode', null, null, 'POST', data, options);
23830 },
23831
23832 /**
23833 * Makes a call to verify sms code that sent by AV.Cloud.requestSmsCode
23834 * @param {String} code The sms code sent by AV.Cloud.requestSmsCode
23835 * @param {phone} phone The mobile phoner number.
23836 * @return {Promise} A promise that will be resolved with the result
23837 * of the function.
23838 */
23839 verifySmsCode: function verifySmsCode(code, phone) {
23840 if (!code) throw new Error('Missing sms code.');
23841 var params = {};
23842
23843 if (_.isString(phone)) {
23844 params['mobilePhoneNumber'] = phone;
23845 }
23846
23847 return _request('verifySmsCode', code, null, 'POST', params);
23848 },
23849 _requestCaptcha: function _requestCaptcha(options, authOptions) {
23850 return _request('requestCaptcha', null, null, 'GET', options, authOptions).then(function (_ref) {
23851 var url = _ref.captcha_url,
23852 captchaToken = _ref.captcha_token;
23853 return {
23854 captchaToken: captchaToken,
23855 url: url
23856 };
23857 });
23858 },
23859
23860 /**
23861 * Request a captcha.
23862 */
23863 requestCaptcha: AV.Captcha.request,
23864
23865 /**
23866 * Verify captcha code. This is the low-level API for captcha.
23867 * Checkout {@link AV.Captcha} for high abstract APIs.
23868 * @param {String} code the code from user input
23869 * @param {String} captchaToken captchaToken returned by {@link AV.Cloud.requestCaptcha}
23870 * @return {Promise.<String>} validateToken if the code is valid
23871 */
23872 verifyCaptcha: function verifyCaptcha(code, captchaToken) {
23873 return _request('verifyCaptcha', null, null, 'POST', {
23874 captcha_code: code,
23875 captcha_token: captchaToken
23876 }).then(function (_ref2) {
23877 var validateToken = _ref2.validate_token;
23878 return validateToken;
23879 });
23880 }
23881 });
23882};
23883
23884/***/ }),
23885/* 567 */
23886/***/ (function(module, exports, __webpack_require__) {
23887
23888"use strict";
23889
23890
23891var request = __webpack_require__(28).request;
23892
23893module.exports = function (AV) {
23894 AV.Installation = AV.Object.extend('_Installation');
23895 /**
23896 * @namespace
23897 */
23898
23899 AV.Push = AV.Push || {};
23900 /**
23901 * Sends a push notification.
23902 * @param {Object} data The data of the push notification.
23903 * @param {String[]} [data.channels] An Array of channels to push to.
23904 * @param {Date} [data.push_time] A Date object for when to send the push.
23905 * @param {Date} [data.expiration_time] A Date object for when to expire
23906 * the push.
23907 * @param {Number} [data.expiration_interval] The seconds from now to expire the push.
23908 * @param {Number} [data.flow_control] The clients to notify per second
23909 * @param {AV.Query} [data.where] An AV.Query over AV.Installation that is used to match
23910 * a set of installations to push to.
23911 * @param {String} [data.cql] A CQL statement over AV.Installation that is used to match
23912 * a set of installations to push to.
23913 * @param {Object} data.data The data to send as part of the push.
23914 More details: https://url.leanapp.cn/pushData
23915 * @param {AuthOptions} [options]
23916 * @return {Promise}
23917 */
23918
23919 AV.Push.send = function (data, options) {
23920 if (data.where) {
23921 data.where = data.where._getParams().where;
23922 }
23923
23924 if (data.where && data.cql) {
23925 throw new Error("Both where and cql can't be set");
23926 }
23927
23928 if (data.push_time) {
23929 data.push_time = data.push_time.toJSON();
23930 }
23931
23932 if (data.expiration_time) {
23933 data.expiration_time = data.expiration_time.toJSON();
23934 }
23935
23936 if (data.expiration_time && data.expiration_interval) {
23937 throw new Error("Both expiration_time and expiration_interval can't be set");
23938 }
23939
23940 return request({
23941 service: 'push',
23942 method: 'POST',
23943 path: '/push',
23944 data: data,
23945 authOptions: options
23946 });
23947 };
23948};
23949
23950/***/ }),
23951/* 568 */
23952/***/ (function(module, exports, __webpack_require__) {
23953
23954"use strict";
23955
23956
23957var _interopRequireDefault = __webpack_require__(1);
23958
23959var _promise = _interopRequireDefault(__webpack_require__(12));
23960
23961var _typeof2 = _interopRequireDefault(__webpack_require__(95));
23962
23963var _ = __webpack_require__(3);
23964
23965var AVRequest = __webpack_require__(28)._request;
23966
23967var _require = __webpack_require__(32),
23968 getSessionToken = _require.getSessionToken;
23969
23970module.exports = function (AV) {
23971 var getUser = function getUser() {
23972 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
23973 var sessionToken = getSessionToken(options);
23974
23975 if (sessionToken) {
23976 return AV.User._fetchUserBySessionToken(getSessionToken(options));
23977 }
23978
23979 return AV.User.currentAsync();
23980 };
23981
23982 var getUserPointer = function getUserPointer(options) {
23983 return getUser(options).then(function (currUser) {
23984 return AV.Object.createWithoutData('_User', currUser.id)._toPointer();
23985 });
23986 };
23987 /**
23988 * Contains functions to deal with Status in LeanCloud.
23989 * @class
23990 */
23991
23992
23993 AV.Status = function (imageUrl, message) {
23994 this.data = {};
23995 this.inboxType = 'default';
23996 this.query = null;
23997
23998 if (imageUrl && (0, _typeof2.default)(imageUrl) === 'object') {
23999 this.data = imageUrl;
24000 } else {
24001 if (imageUrl) {
24002 this.data.image = imageUrl;
24003 }
24004
24005 if (message) {
24006 this.data.message = message;
24007 }
24008 }
24009
24010 return this;
24011 };
24012
24013 _.extend(AV.Status.prototype,
24014 /** @lends AV.Status.prototype */
24015 {
24016 /**
24017 * Gets the value of an attribute in status data.
24018 * @param {String} attr The string name of an attribute.
24019 */
24020 get: function get(attr) {
24021 return this.data[attr];
24022 },
24023
24024 /**
24025 * Sets a hash of model attributes on the status data.
24026 * @param {String} key The key to set.
24027 * @param {any} value The value to give it.
24028 */
24029 set: function set(key, value) {
24030 this.data[key] = value;
24031 return this;
24032 },
24033
24034 /**
24035 * Destroy this status,then it will not be avaiable in other user's inboxes.
24036 * @param {AuthOptions} options
24037 * @return {Promise} A promise that is fulfilled when the destroy
24038 * completes.
24039 */
24040 destroy: function destroy(options) {
24041 if (!this.id) return _promise.default.reject(new Error('The status id is not exists.'));
24042 var request = AVRequest('statuses', null, this.id, 'DELETE', options);
24043 return request;
24044 },
24045
24046 /**
24047 * Cast the AV.Status object to an AV.Object pointer.
24048 * @return {AV.Object} A AV.Object pointer.
24049 */
24050 toObject: function toObject() {
24051 if (!this.id) return null;
24052 return AV.Object.createWithoutData('_Status', this.id);
24053 },
24054 _getDataJSON: function _getDataJSON() {
24055 var json = _.clone(this.data);
24056
24057 return AV._encode(json);
24058 },
24059
24060 /**
24061 * Send a status by a AV.Query object.
24062 * @since 0.3.0
24063 * @param {AuthOptions} options
24064 * @return {Promise} A promise that is fulfilled when the send
24065 * completes.
24066 * @example
24067 * // send a status to male users
24068 * var status = new AVStatus('image url', 'a message');
24069 * status.query = new AV.Query('_User');
24070 * status.query.equalTo('gender', 'male');
24071 * status.send().then(function(){
24072 * //send status successfully.
24073 * }, function(err){
24074 * //an error threw.
24075 * console.dir(err);
24076 * });
24077 */
24078 send: function send() {
24079 var _this = this;
24080
24081 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
24082
24083 if (!getSessionToken(options) && !AV.User.current()) {
24084 throw new Error('Please signin an user.');
24085 }
24086
24087 if (!this.query) {
24088 return AV.Status.sendStatusToFollowers(this, options);
24089 }
24090
24091 return getUserPointer(options).then(function (currUser) {
24092 var query = _this.query._getParams();
24093
24094 query.className = _this.query.className;
24095 var data = {};
24096 data.query = query;
24097 _this.data = _this.data || {};
24098 _this.data.source = _this.data.source || currUser;
24099 data.data = _this._getDataJSON();
24100 data.inboxType = _this.inboxType || 'default';
24101 return AVRequest('statuses', null, null, 'POST', data, options);
24102 }).then(function (response) {
24103 _this.id = response.objectId;
24104 _this.createdAt = AV._parseDate(response.createdAt);
24105 return _this;
24106 });
24107 },
24108 _finishFetch: function _finishFetch(serverData) {
24109 this.id = serverData.objectId;
24110 this.createdAt = AV._parseDate(serverData.createdAt);
24111 this.updatedAt = AV._parseDate(serverData.updatedAt);
24112 this.messageId = serverData.messageId;
24113 delete serverData.messageId;
24114 delete serverData.objectId;
24115 delete serverData.createdAt;
24116 delete serverData.updatedAt;
24117 this.data = AV._decode(serverData);
24118 }
24119 });
24120 /**
24121 * Send a status to current signined user's followers.
24122 * @since 0.3.0
24123 * @param {AV.Status} status A status object to be send to followers.
24124 * @param {AuthOptions} options
24125 * @return {Promise} A promise that is fulfilled when the send
24126 * completes.
24127 * @example
24128 * var status = new AVStatus('image url', 'a message');
24129 * AV.Status.sendStatusToFollowers(status).then(function(){
24130 * //send status successfully.
24131 * }, function(err){
24132 * //an error threw.
24133 * console.dir(err);
24134 * });
24135 */
24136
24137
24138 AV.Status.sendStatusToFollowers = function (status) {
24139 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24140
24141 if (!getSessionToken(options) && !AV.User.current()) {
24142 throw new Error('Please signin an user.');
24143 }
24144
24145 return getUserPointer(options).then(function (currUser) {
24146 var query = {};
24147 query.className = '_Follower';
24148 query.keys = 'follower';
24149 query.where = {
24150 user: currUser
24151 };
24152 var data = {};
24153 data.query = query;
24154 status.data = status.data || {};
24155 status.data.source = status.data.source || currUser;
24156 data.data = status._getDataJSON();
24157 data.inboxType = status.inboxType || 'default';
24158 var request = AVRequest('statuses', null, null, 'POST', data, options);
24159 return request.then(function (response) {
24160 status.id = response.objectId;
24161 status.createdAt = AV._parseDate(response.createdAt);
24162 return status;
24163 });
24164 });
24165 };
24166 /**
24167 * <p>Send a status from current signined user to other user's private status inbox.</p>
24168 * @since 0.3.0
24169 * @param {AV.Status} status A status object to be send to followers.
24170 * @param {String} target The target user or user's objectId.
24171 * @param {AuthOptions} options
24172 * @return {Promise} A promise that is fulfilled when the send
24173 * completes.
24174 * @example
24175 * // send a private status to user '52e84e47e4b0f8de283b079b'
24176 * var status = new AVStatus('image url', 'a message');
24177 * AV.Status.sendPrivateStatus(status, '52e84e47e4b0f8de283b079b').then(function(){
24178 * //send status successfully.
24179 * }, function(err){
24180 * //an error threw.
24181 * console.dir(err);
24182 * });
24183 */
24184
24185
24186 AV.Status.sendPrivateStatus = function (status, target) {
24187 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
24188
24189 if (!getSessionToken(options) && !AV.User.current()) {
24190 throw new Error('Please signin an user.');
24191 }
24192
24193 if (!target) {
24194 throw new Error('Invalid target user.');
24195 }
24196
24197 var userObjectId = _.isString(target) ? target : target.id;
24198
24199 if (!userObjectId) {
24200 throw new Error('Invalid target user.');
24201 }
24202
24203 return getUserPointer(options).then(function (currUser) {
24204 var query = {};
24205 query.className = '_User';
24206 query.where = {
24207 objectId: userObjectId
24208 };
24209 var data = {};
24210 data.query = query;
24211 status.data = status.data || {};
24212 status.data.source = status.data.source || currUser;
24213 data.data = status._getDataJSON();
24214 data.inboxType = 'private';
24215 status.inboxType = 'private';
24216 var request = AVRequest('statuses', null, null, 'POST', data, options);
24217 return request.then(function (response) {
24218 status.id = response.objectId;
24219 status.createdAt = AV._parseDate(response.createdAt);
24220 return status;
24221 });
24222 });
24223 };
24224 /**
24225 * Count unread statuses in someone's inbox.
24226 * @since 0.3.0
24227 * @param {AV.User} owner The status owner.
24228 * @param {String} inboxType The inbox type, 'default' by default.
24229 * @param {AuthOptions} options
24230 * @return {Promise} A promise that is fulfilled when the count
24231 * completes.
24232 * @example
24233 * AV.Status.countUnreadStatuses(AV.User.current()).then(function(response){
24234 * console.log(response.unread); //unread statuses number.
24235 * console.log(response.total); //total statuses number.
24236 * });
24237 */
24238
24239
24240 AV.Status.countUnreadStatuses = function (owner) {
24241 var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
24242 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
24243 if (!_.isString(inboxType)) options = inboxType;
24244
24245 if (!getSessionToken(options) && owner == null && !AV.User.current()) {
24246 throw new Error('Please signin an user or pass the owner objectId.');
24247 }
24248
24249 return _promise.default.resolve(owner || getUser(options)).then(function (owner) {
24250 var params = {};
24251 params.inboxType = AV._encode(inboxType);
24252 params.owner = AV._encode(owner);
24253 return AVRequest('subscribe/statuses/count', null, null, 'GET', params, options);
24254 });
24255 };
24256 /**
24257 * reset unread statuses count in someone's inbox.
24258 * @since 2.1.0
24259 * @param {AV.User} owner The status owner.
24260 * @param {String} inboxType The inbox type, 'default' by default.
24261 * @param {AuthOptions} options
24262 * @return {Promise} A promise that is fulfilled when the reset
24263 * completes.
24264 * @example
24265 * AV.Status.resetUnreadCount(AV.User.current()).then(function(response){
24266 * console.log(response.unread); //unread statuses number.
24267 * console.log(response.total); //total statuses number.
24268 * });
24269 */
24270
24271
24272 AV.Status.resetUnreadCount = function (owner) {
24273 var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
24274 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
24275 if (!_.isString(inboxType)) options = inboxType;
24276
24277 if (!getSessionToken(options) && owner == null && !AV.User.current()) {
24278 throw new Error('Please signin an user or pass the owner objectId.');
24279 }
24280
24281 return _promise.default.resolve(owner || getUser(options)).then(function (owner) {
24282 var params = {};
24283 params.inboxType = AV._encode(inboxType);
24284 params.owner = AV._encode(owner);
24285 return AVRequest('subscribe/statuses/resetUnreadCount', null, null, 'POST', params, options);
24286 });
24287 };
24288 /**
24289 * Create a status query to find someone's published statuses.
24290 * @since 0.3.0
24291 * @param {AV.User} source The status source, typically the publisher.
24292 * @return {AV.Query} The query object for status.
24293 * @example
24294 * //Find current user's published statuses.
24295 * var query = AV.Status.statusQuery(AV.User.current());
24296 * query.find().then(function(statuses){
24297 * //process statuses
24298 * });
24299 */
24300
24301
24302 AV.Status.statusQuery = function (source) {
24303 var query = new AV.Query('_Status');
24304
24305 if (source) {
24306 query.equalTo('source', source);
24307 }
24308
24309 return query;
24310 };
24311 /**
24312 * <p>AV.InboxQuery defines a query that is used to fetch somebody's inbox statuses.</p>
24313 * @class
24314 */
24315
24316
24317 AV.InboxQuery = AV.Query._extend(
24318 /** @lends AV.InboxQuery.prototype */
24319 {
24320 _objectClass: AV.Status,
24321 _sinceId: 0,
24322 _maxId: 0,
24323 _inboxType: 'default',
24324 _owner: null,
24325 _newObject: function _newObject() {
24326 return new AV.Status();
24327 },
24328 _createRequest: function _createRequest(params, options) {
24329 return AV.InboxQuery.__super__._createRequest.call(this, params, options, '/subscribe/statuses');
24330 },
24331
24332 /**
24333 * Sets the messageId of results to skip before returning any results.
24334 * This is useful for pagination.
24335 * Default is zero.
24336 * @param {Number} n the mesage id.
24337 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24338 */
24339 sinceId: function sinceId(id) {
24340 this._sinceId = id;
24341 return this;
24342 },
24343
24344 /**
24345 * Sets the maximal messageId of results。
24346 * This is useful for pagination.
24347 * Default is zero that is no limition.
24348 * @param {Number} n the mesage id.
24349 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24350 */
24351 maxId: function maxId(id) {
24352 this._maxId = id;
24353 return this;
24354 },
24355
24356 /**
24357 * Sets the owner of the querying inbox.
24358 * @param {AV.User} owner The inbox owner.
24359 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24360 */
24361 owner: function owner(_owner) {
24362 this._owner = _owner;
24363 return this;
24364 },
24365
24366 /**
24367 * Sets the querying inbox type.default is 'default'.
24368 * @param {String} type The inbox type.
24369 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24370 */
24371 inboxType: function inboxType(type) {
24372 this._inboxType = type;
24373 return this;
24374 },
24375 _getParams: function _getParams() {
24376 var params = AV.InboxQuery.__super__._getParams.call(this);
24377
24378 params.owner = AV._encode(this._owner);
24379 params.inboxType = AV._encode(this._inboxType);
24380 params.sinceId = AV._encode(this._sinceId);
24381 params.maxId = AV._encode(this._maxId);
24382 return params;
24383 }
24384 });
24385 /**
24386 * Create a inbox status query to find someone's inbox statuses.
24387 * @since 0.3.0
24388 * @param {AV.User} owner The inbox's owner
24389 * @param {String} inboxType The inbox type,'default' by default.
24390 * @return {AV.InboxQuery} The inbox query object.
24391 * @see AV.InboxQuery
24392 * @example
24393 * //Find current user's default inbox statuses.
24394 * var query = AV.Status.inboxQuery(AV.User.current());
24395 * //find the statuses after the last message id
24396 * query.sinceId(lastMessageId);
24397 * query.find().then(function(statuses){
24398 * //process statuses
24399 * });
24400 */
24401
24402 AV.Status.inboxQuery = function (owner, inboxType) {
24403 var query = new AV.InboxQuery(AV.Status);
24404
24405 if (owner) {
24406 query._owner = owner;
24407 }
24408
24409 if (inboxType) {
24410 query._inboxType = inboxType;
24411 }
24412
24413 return query;
24414 };
24415};
24416
24417/***/ }),
24418/* 569 */
24419/***/ (function(module, exports, __webpack_require__) {
24420
24421"use strict";
24422
24423
24424var _interopRequireDefault = __webpack_require__(1);
24425
24426var _stringify = _interopRequireDefault(__webpack_require__(38));
24427
24428var _map = _interopRequireDefault(__webpack_require__(37));
24429
24430var _ = __webpack_require__(3);
24431
24432var AVRequest = __webpack_require__(28)._request;
24433
24434module.exports = function (AV) {
24435 /**
24436 * A builder to generate sort string for app searching.For example:
24437 * @class
24438 * @since 0.5.1
24439 * @example
24440 * var builder = new AV.SearchSortBuilder();
24441 * builder.ascending('key1').descending('key2','max');
24442 * var query = new AV.SearchQuery('Player');
24443 * query.sortBy(builder);
24444 * query.find().then();
24445 */
24446 AV.SearchSortBuilder = function () {
24447 this._sortFields = [];
24448 };
24449
24450 _.extend(AV.SearchSortBuilder.prototype,
24451 /** @lends AV.SearchSortBuilder.prototype */
24452 {
24453 _addField: function _addField(key, order, mode, missing) {
24454 var field = {};
24455 field[key] = {
24456 order: order || 'asc',
24457 mode: mode || 'avg',
24458 missing: '_' + (missing || 'last')
24459 };
24460
24461 this._sortFields.push(field);
24462
24463 return this;
24464 },
24465
24466 /**
24467 * Sorts the results in ascending order by the given key and options.
24468 *
24469 * @param {String} key The key to order by.
24470 * @param {String} mode The sort mode, default is 'avg', you can choose
24471 * 'max' or 'min' too.
24472 * @param {String} missing The missing key behaviour, default is 'last',
24473 * you can choose 'first' too.
24474 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
24475 */
24476 ascending: function ascending(key, mode, missing) {
24477 return this._addField(key, 'asc', mode, missing);
24478 },
24479
24480 /**
24481 * Sorts the results in descending order by the given key and options.
24482 *
24483 * @param {String} key The key to order by.
24484 * @param {String} mode The sort mode, default is 'avg', you can choose
24485 * 'max' or 'min' too.
24486 * @param {String} missing The missing key behaviour, default is 'last',
24487 * you can choose 'first' too.
24488 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
24489 */
24490 descending: function descending(key, mode, missing) {
24491 return this._addField(key, 'desc', mode, missing);
24492 },
24493
24494 /**
24495 * Add a proximity based constraint for finding objects with key point
24496 * values near the point given.
24497 * @param {String} key The key that the AV.GeoPoint is stored in.
24498 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
24499 * @param {Object} options The other options such as mode,order, unit etc.
24500 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
24501 */
24502 whereNear: function whereNear(key, point, options) {
24503 options = options || {};
24504 var field = {};
24505 var geo = {
24506 lat: point.latitude,
24507 lon: point.longitude
24508 };
24509 var m = {
24510 order: options.order || 'asc',
24511 mode: options.mode || 'avg',
24512 unit: options.unit || 'km'
24513 };
24514 m[key] = geo;
24515 field['_geo_distance'] = m;
24516
24517 this._sortFields.push(field);
24518
24519 return this;
24520 },
24521
24522 /**
24523 * Build a sort string by configuration.
24524 * @return {String} the sort string.
24525 */
24526 build: function build() {
24527 return (0, _stringify.default)(AV._encode(this._sortFields));
24528 }
24529 });
24530 /**
24531 * App searching query.Use just like AV.Query:
24532 *
24533 * Visit <a href='https://leancloud.cn/docs/app_search_guide.html'>App Searching Guide</a>
24534 * for more details.
24535 * @class
24536 * @since 0.5.1
24537 * @example
24538 * var query = new AV.SearchQuery('Player');
24539 * query.queryString('*');
24540 * query.find().then(function(results) {
24541 * console.log('Found %d objects', query.hits());
24542 * //Process results
24543 * });
24544 */
24545
24546
24547 AV.SearchQuery = AV.Query._extend(
24548 /** @lends AV.SearchQuery.prototype */
24549 {
24550 _sid: null,
24551 _hits: 0,
24552 _queryString: null,
24553 _highlights: null,
24554 _sortBuilder: null,
24555 _clazz: null,
24556 constructor: function constructor(className) {
24557 if (className) {
24558 this._clazz = className;
24559 } else {
24560 className = '__INVALID_CLASS';
24561 }
24562
24563 AV.Query.call(this, className);
24564 },
24565 _createRequest: function _createRequest(params, options) {
24566 return AVRequest('search/select', null, null, 'GET', params || this._getParams(), options);
24567 },
24568
24569 /**
24570 * Sets the sid of app searching query.Default is null.
24571 * @param {String} sid Scroll id for searching.
24572 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24573 */
24574 sid: function sid(_sid) {
24575 this._sid = _sid;
24576 return this;
24577 },
24578
24579 /**
24580 * Sets the query string of app searching.
24581 * @param {String} q The query string.
24582 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24583 */
24584 queryString: function queryString(q) {
24585 this._queryString = q;
24586 return this;
24587 },
24588
24589 /**
24590 * Sets the highlight fields. Such as
24591 * <pre><code>
24592 * query.highlights('title');
24593 * //or pass an array.
24594 * query.highlights(['title', 'content'])
24595 * </code></pre>
24596 * @param {String|String[]} highlights a list of fields.
24597 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24598 */
24599 highlights: function highlights(_highlights) {
24600 var objects;
24601
24602 if (_highlights && _.isString(_highlights)) {
24603 objects = _.toArray(arguments);
24604 } else {
24605 objects = _highlights;
24606 }
24607
24608 this._highlights = objects;
24609 return this;
24610 },
24611
24612 /**
24613 * Sets the sort builder for this query.
24614 * @see AV.SearchSortBuilder
24615 * @param { AV.SearchSortBuilder} builder The sort builder.
24616 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24617 *
24618 */
24619 sortBy: function sortBy(builder) {
24620 this._sortBuilder = builder;
24621 return this;
24622 },
24623
24624 /**
24625 * Returns the number of objects that match this query.
24626 * @return {Number}
24627 */
24628 hits: function hits() {
24629 if (!this._hits) {
24630 this._hits = 0;
24631 }
24632
24633 return this._hits;
24634 },
24635 _processResult: function _processResult(json) {
24636 delete json['className'];
24637 delete json['_app_url'];
24638 delete json['_deeplink'];
24639 return json;
24640 },
24641
24642 /**
24643 * Returns true when there are more documents can be retrieved by this
24644 * query instance, you can call find function to get more results.
24645 * @see AV.SearchQuery#find
24646 * @return {Boolean}
24647 */
24648 hasMore: function hasMore() {
24649 return !this._hitEnd;
24650 },
24651
24652 /**
24653 * Reset current query instance state(such as sid, hits etc) except params
24654 * for a new searching. After resetting, hasMore() will return true.
24655 */
24656 reset: function reset() {
24657 this._hitEnd = false;
24658 this._sid = null;
24659 this._hits = 0;
24660 },
24661
24662 /**
24663 * Retrieves a list of AVObjects that satisfy this query.
24664 * Either options.success or options.error is called when the find
24665 * completes.
24666 *
24667 * @see AV.Query#find
24668 * @param {AuthOptions} options
24669 * @return {Promise} A promise that is resolved with the results when
24670 * the query completes.
24671 */
24672 find: function find(options) {
24673 var self = this;
24674
24675 var request = this._createRequest(undefined, options);
24676
24677 return request.then(function (response) {
24678 //update sid for next querying.
24679 if (response.sid) {
24680 self._oldSid = self._sid;
24681 self._sid = response.sid;
24682 } else {
24683 self._sid = null;
24684 self._hitEnd = true;
24685 }
24686
24687 self._hits = response.hits || 0;
24688 return (0, _map.default)(_).call(_, response.results, function (json) {
24689 if (json.className) {
24690 response.className = json.className;
24691 }
24692
24693 var obj = self._newObject(response);
24694
24695 obj.appURL = json['_app_url'];
24696
24697 obj._finishFetch(self._processResult(json), true);
24698
24699 return obj;
24700 });
24701 });
24702 },
24703 _getParams: function _getParams() {
24704 var params = AV.SearchQuery.__super__._getParams.call(this);
24705
24706 delete params.where;
24707
24708 if (this._clazz) {
24709 params.clazz = this.className;
24710 }
24711
24712 if (this._sid) {
24713 params.sid = this._sid;
24714 }
24715
24716 if (!this._queryString) {
24717 throw new Error('Please set query string.');
24718 } else {
24719 params.q = this._queryString;
24720 }
24721
24722 if (this._highlights) {
24723 params.highlights = this._highlights.join(',');
24724 }
24725
24726 if (this._sortBuilder && params.order) {
24727 throw new Error('sort and order can not be set at same time.');
24728 }
24729
24730 if (this._sortBuilder) {
24731 params.sort = this._sortBuilder.build();
24732 }
24733
24734 return params;
24735 }
24736 });
24737};
24738/**
24739 * Sorts the results in ascending order by the given key.
24740 *
24741 * @method AV.SearchQuery#ascending
24742 * @param {String} key The key to order by.
24743 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24744 */
24745
24746/**
24747 * Also sorts the results in ascending order by the given key. The previous sort keys have
24748 * precedence over this key.
24749 *
24750 * @method AV.SearchQuery#addAscending
24751 * @param {String} key The key to order by
24752 * @return {AV.SearchQuery} Returns the query so you can chain this call.
24753 */
24754
24755/**
24756 * Sorts the results in descending order by the given key.
24757 *
24758 * @method AV.SearchQuery#descending
24759 * @param {String} key The key to order by.
24760 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24761 */
24762
24763/**
24764 * Also sorts the results in descending order by the given key. The previous sort keys have
24765 * precedence over this key.
24766 *
24767 * @method AV.SearchQuery#addDescending
24768 * @param {String} key The key to order by
24769 * @return {AV.SearchQuery} Returns the query so you can chain this call.
24770 */
24771
24772/**
24773 * Include nested AV.Objects for the provided key. You can use dot
24774 * notation to specify which fields in the included object are also fetch.
24775 * @method AV.SearchQuery#include
24776 * @param {String[]} keys The name of the key to include.
24777 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24778 */
24779
24780/**
24781 * Sets the number of results to skip before returning any results.
24782 * This is useful for pagination.
24783 * Default is to skip zero results.
24784 * @method AV.SearchQuery#skip
24785 * @param {Number} n the number of results to skip.
24786 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24787 */
24788
24789/**
24790 * Sets the limit of the number of results to return. The default limit is
24791 * 100, with a maximum of 1000 results being returned at a time.
24792 * @method AV.SearchQuery#limit
24793 * @param {Number} n the number of results to limit to.
24794 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24795 */
24796
24797/***/ }),
24798/* 570 */
24799/***/ (function(module, exports, __webpack_require__) {
24800
24801"use strict";
24802
24803
24804var _interopRequireDefault = __webpack_require__(1);
24805
24806var _promise = _interopRequireDefault(__webpack_require__(12));
24807
24808var _ = __webpack_require__(3);
24809
24810var AVError = __webpack_require__(48);
24811
24812var _require = __webpack_require__(28),
24813 request = _require.request;
24814
24815module.exports = function (AV) {
24816 /**
24817 * 包含了使用了 LeanCloud
24818 * <a href='/docs/leaninsight_guide.html'>离线数据分析功能</a>的函数。
24819 * <p><strong><em>
24820 * 仅在云引擎运行环境下有效。
24821 * </em></strong></p>
24822 * @namespace
24823 */
24824 AV.Insight = AV.Insight || {};
24825
24826 _.extend(AV.Insight,
24827 /** @lends AV.Insight */
24828 {
24829 /**
24830 * 开始一个 Insight 任务。结果里将返回 Job id,你可以拿得到的 id 使用
24831 * AV.Insight.JobQuery 查询任务状态和结果。
24832 * @param {Object} jobConfig 任务配置的 JSON 对象,例如:<code><pre>
24833 * { "sql" : "select count(*) as c,gender from _User group by gender",
24834 * "saveAs": {
24835 * "className" : "UserGender",
24836 * "limit": 1
24837 * }
24838 * }
24839 * </pre></code>
24840 * sql 指定任务执行的 SQL 语句, saveAs(可选) 指定将结果保存在哪张表里,limit 最大 1000。
24841 * @param {AuthOptions} [options]
24842 * @return {Promise} A promise that will be resolved with the result
24843 * of the function.
24844 */
24845 startJob: function startJob(jobConfig, options) {
24846 if (!jobConfig || !jobConfig.sql) {
24847 throw new Error('Please provide the sql to run the job.');
24848 }
24849
24850 var data = {
24851 jobConfig: jobConfig,
24852 appId: AV.applicationId
24853 };
24854 return request({
24855 path: '/bigquery/jobs',
24856 method: 'POST',
24857 data: AV._encode(data, null, true),
24858 authOptions: options,
24859 signKey: false
24860 }).then(function (resp) {
24861 return AV._decode(resp).id;
24862 });
24863 },
24864
24865 /**
24866 * 监听 Insight 任务事件(未来推出独立部署的离线分析服务后开放)
24867 * <p><strong><em>
24868 * 仅在云引擎运行环境下有效。
24869 * </em></strong></p>
24870 * @param {String} event 监听的事件,目前尚不支持。
24871 * @param {Function} 监听回调函数,接收 (err, id) 两个参数,err 表示错误信息,
24872 * id 表示任务 id。接下来你可以拿这个 id 使用AV.Insight.JobQuery 查询任务状态和结果。
24873 *
24874 */
24875 on: function on(event, cb) {}
24876 });
24877 /**
24878 * 创建一个对象,用于查询 Insight 任务状态和结果。
24879 * @class
24880 * @param {String} id 任务 id
24881 * @since 0.5.5
24882 */
24883
24884
24885 AV.Insight.JobQuery = function (id, className) {
24886 if (!id) {
24887 throw new Error('Please provide the job id.');
24888 }
24889
24890 this.id = id;
24891 this.className = className;
24892 this._skip = 0;
24893 this._limit = 100;
24894 };
24895
24896 _.extend(AV.Insight.JobQuery.prototype,
24897 /** @lends AV.Insight.JobQuery.prototype */
24898 {
24899 /**
24900 * Sets the number of results to skip before returning any results.
24901 * This is useful for pagination.
24902 * Default is to skip zero results.
24903 * @param {Number} n the number of results to skip.
24904 * @return {AV.Query} Returns the query, so you can chain this call.
24905 */
24906 skip: function skip(n) {
24907 this._skip = n;
24908 return this;
24909 },
24910
24911 /**
24912 * Sets the limit of the number of results to return. The default limit is
24913 * 100, with a maximum of 1000 results being returned at a time.
24914 * @param {Number} n the number of results to limit to.
24915 * @return {AV.Query} Returns the query, so you can chain this call.
24916 */
24917 limit: function limit(n) {
24918 this._limit = n;
24919 return this;
24920 },
24921
24922 /**
24923 * 查询任务状态和结果,任务结果为一个 JSON 对象,包括 status 表示任务状态, totalCount 表示总数,
24924 * results 数组表示任务结果数组,previewCount 表示可以返回的结果总数,任务的开始和截止时间
24925 * startTime、endTime 等信息。
24926 *
24927 * @param {AuthOptions} [options]
24928 * @return {Promise} A promise that will be resolved with the result
24929 * of the function.
24930 *
24931 */
24932 find: function find(options) {
24933 var params = {
24934 skip: this._skip,
24935 limit: this._limit
24936 };
24937 return request({
24938 path: "/bigquery/jobs/".concat(this.id),
24939 method: 'GET',
24940 query: params,
24941 authOptions: options,
24942 signKey: false
24943 }).then(function (response) {
24944 if (response.error) {
24945 return _promise.default.reject(new AVError(response.code, response.error));
24946 }
24947
24948 return _promise.default.resolve(response);
24949 });
24950 }
24951 });
24952};
24953
24954/***/ }),
24955/* 571 */
24956/***/ (function(module, exports, __webpack_require__) {
24957
24958"use strict";
24959
24960
24961var _interopRequireDefault = __webpack_require__(1);
24962
24963var _promise = _interopRequireDefault(__webpack_require__(12));
24964
24965var _ = __webpack_require__(3);
24966
24967var _require = __webpack_require__(28),
24968 LCRequest = _require.request;
24969
24970var _require2 = __webpack_require__(32),
24971 getSessionToken = _require2.getSessionToken;
24972
24973module.exports = function (AV) {
24974 var getUserWithSessionToken = function getUserWithSessionToken(authOptions) {
24975 if (authOptions.user) {
24976 if (!authOptions.user._sessionToken) {
24977 throw new Error('authOptions.user is not signed in.');
24978 }
24979
24980 return _promise.default.resolve(authOptions.user);
24981 }
24982
24983 if (authOptions.sessionToken) {
24984 return AV.User._fetchUserBySessionToken(authOptions.sessionToken);
24985 }
24986
24987 return AV.User.currentAsync();
24988 };
24989
24990 var getSessionTokenAsync = function getSessionTokenAsync(authOptions) {
24991 var sessionToken = getSessionToken(authOptions);
24992
24993 if (sessionToken) {
24994 return _promise.default.resolve(sessionToken);
24995 }
24996
24997 return AV.User.currentAsync().then(function (user) {
24998 if (user) {
24999 return user.getSessionToken();
25000 }
25001 });
25002 };
25003 /**
25004 * Contains functions to deal with Friendship in LeanCloud.
25005 * @class
25006 */
25007
25008
25009 AV.Friendship = {
25010 /**
25011 * Request friendship.
25012 * @since 4.8.0
25013 * @param {String | AV.User | Object} options if an AV.User or string is given, it will be used as the friend.
25014 * @param {AV.User | string} options.friend The friend (or friend's objectId) to follow.
25015 * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of followeeQuery.
25016 * @param {AuthOptions} [authOptions]
25017 * @return {Promise<void>}
25018 */
25019 request: function request(options) {
25020 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25021 var friend;
25022 var attributes;
25023
25024 if (options.friend) {
25025 friend = options.friend;
25026 attributes = options.attributes;
25027 } else {
25028 friend = options;
25029 }
25030
25031 var friendObj = _.isString(friend) ? AV.Object.createWithoutData('_User', friend) : friend;
25032 return getUserWithSessionToken(authOptions).then(function (userObj) {
25033 if (!userObj) {
25034 throw new Error('Please signin an user.');
25035 }
25036
25037 return LCRequest({
25038 method: 'POST',
25039 path: '/users/friendshipRequests',
25040 data: {
25041 user: userObj._toPointer(),
25042 friend: friendObj._toPointer(),
25043 friendship: attributes
25044 },
25045 authOptions: authOptions
25046 });
25047 });
25048 },
25049
25050 /**
25051 * Accept a friendship request.
25052 * @since 4.8.0
25053 * @param {AV.Object | string | Object} options if an AV.Object or string is given, it will be used as the request in _FriendshipRequest.
25054 * @param {AV.Object} options.request The request (or it's objectId) to be accepted.
25055 * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of {@link AV#followeeQuery}.
25056 * @param {AuthOptions} [authOptions]
25057 * @return {Promise<void>}
25058 */
25059 acceptRequest: function acceptRequest(options) {
25060 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25061 var request;
25062 var attributes;
25063
25064 if (options.request) {
25065 request = options.request;
25066 attributes = options.attributes;
25067 } else {
25068 request = options;
25069 }
25070
25071 var requestId = _.isString(request) ? request : request.id;
25072 return getSessionTokenAsync(authOptions).then(function (sessionToken) {
25073 if (!sessionToken) {
25074 throw new Error('Please signin an user.');
25075 }
25076
25077 return LCRequest({
25078 method: 'PUT',
25079 path: '/users/friendshipRequests/' + requestId + '/accept',
25080 data: {
25081 friendship: AV._encode(attributes)
25082 },
25083 authOptions: authOptions
25084 });
25085 });
25086 },
25087
25088 /**
25089 * Decline a friendship request.
25090 * @param {AV.Object | string} request The request (or it's objectId) to be declined.
25091 * @param {AuthOptions} [authOptions]
25092 * @return {Promise<void>}
25093 */
25094 declineRequest: function declineRequest(request) {
25095 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25096 var requestId = _.isString(request) ? request : request.id;
25097 return getSessionTokenAsync(authOptions).then(function (sessionToken) {
25098 if (!sessionToken) {
25099 throw new Error('Please signin an user.');
25100 }
25101
25102 return LCRequest({
25103 method: 'PUT',
25104 path: '/users/friendshipRequests/' + requestId + '/decline',
25105 authOptions: authOptions
25106 });
25107 });
25108 }
25109 };
25110};
25111
25112/***/ }),
25113/* 572 */
25114/***/ (function(module, exports, __webpack_require__) {
25115
25116"use strict";
25117
25118
25119var _interopRequireDefault = __webpack_require__(1);
25120
25121var _stringify = _interopRequireDefault(__webpack_require__(38));
25122
25123var _ = __webpack_require__(3);
25124
25125var _require = __webpack_require__(28),
25126 _request = _require._request;
25127
25128var AV = __webpack_require__(74);
25129
25130var serializeMessage = function serializeMessage(message) {
25131 if (typeof message === 'string') {
25132 return message;
25133 }
25134
25135 if (typeof message.getPayload === 'function') {
25136 return (0, _stringify.default)(message.getPayload());
25137 }
25138
25139 return (0, _stringify.default)(message);
25140};
25141/**
25142 * <p>An AV.Conversation is a local representation of a LeanCloud realtime's
25143 * conversation. This class is a subclass of AV.Object, and retains the
25144 * same functionality of an AV.Object, but also extends it with various
25145 * conversation specific methods, like get members, creators of this conversation.
25146 * </p>
25147 *
25148 * @class AV.Conversation
25149 * @param {String} name The name of the Role to create.
25150 * @param {Object} [options]
25151 * @param {Boolean} [options.isSystem] Set this conversation as system conversation.
25152 * @param {Boolean} [options.isTransient] Set this conversation as transient conversation.
25153 */
25154
25155
25156module.exports = AV.Object.extend('_Conversation',
25157/** @lends AV.Conversation.prototype */
25158{
25159 constructor: function constructor(name) {
25160 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25161 AV.Object.prototype.constructor.call(this, null, null);
25162 this.set('name', name);
25163
25164 if (options.isSystem !== undefined) {
25165 this.set('sys', options.isSystem ? true : false);
25166 }
25167
25168 if (options.isTransient !== undefined) {
25169 this.set('tr', options.isTransient ? true : false);
25170 }
25171 },
25172
25173 /**
25174 * Get current conversation's creator.
25175 *
25176 * @return {String}
25177 */
25178 getCreator: function getCreator() {
25179 return this.get('c');
25180 },
25181
25182 /**
25183 * Get the last message's time.
25184 *
25185 * @return {Date}
25186 */
25187 getLastMessageAt: function getLastMessageAt() {
25188 return this.get('lm');
25189 },
25190
25191 /**
25192 * Get this conversation's members
25193 *
25194 * @return {String[]}
25195 */
25196 getMembers: function getMembers() {
25197 return this.get('m');
25198 },
25199
25200 /**
25201 * Add a member to this conversation
25202 *
25203 * @param {String} member
25204 */
25205 addMember: function addMember(member) {
25206 return this.add('m', member);
25207 },
25208
25209 /**
25210 * Get this conversation's members who set this conversation as muted.
25211 *
25212 * @return {String[]}
25213 */
25214 getMutedMembers: function getMutedMembers() {
25215 return this.get('mu');
25216 },
25217
25218 /**
25219 * Get this conversation's name field.
25220 *
25221 * @return String
25222 */
25223 getName: function getName() {
25224 return this.get('name');
25225 },
25226
25227 /**
25228 * Returns true if this conversation is transient conversation.
25229 *
25230 * @return {Boolean}
25231 */
25232 isTransient: function isTransient() {
25233 return this.get('tr');
25234 },
25235
25236 /**
25237 * Returns true if this conversation is system conversation.
25238 *
25239 * @return {Boolean}
25240 */
25241 isSystem: function isSystem() {
25242 return this.get('sys');
25243 },
25244
25245 /**
25246 * Send realtime message to this conversation, using HTTP request.
25247 *
25248 * @param {String} fromClient Sender's client id.
25249 * @param {String|Object} message The message which will send to conversation.
25250 * It could be a raw string, or an object with a `toJSON` method, like a
25251 * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}
25252 * @param {Object} [options]
25253 * @param {Boolean} [options.transient] Whether send this message as transient message or not.
25254 * @param {String[]} [options.toClients] Ids of clients to send to. This option can be used only in system conversation.
25255 * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}
25256 * @param {AuthOptions} [authOptions]
25257 * @return {Promise}
25258 */
25259 send: function send(fromClient, message) {
25260 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25261 var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
25262 var data = {
25263 from_peer: fromClient,
25264 conv_id: this.id,
25265 transient: false,
25266 message: serializeMessage(message)
25267 };
25268
25269 if (options.toClients !== undefined) {
25270 data.to_peers = options.toClients;
25271 }
25272
25273 if (options.transient !== undefined) {
25274 data.transient = options.transient ? true : false;
25275 }
25276
25277 if (options.pushData !== undefined) {
25278 data.push_data = options.pushData;
25279 }
25280
25281 return _request('rtm', 'messages', null, 'POST', data, authOptions);
25282 },
25283
25284 /**
25285 * Send realtime broadcast message to all clients, via this conversation, using HTTP request.
25286 *
25287 * @param {String} fromClient Sender's client id.
25288 * @param {String|Object} message The message which will send to conversation.
25289 * It could be a raw string, or an object with a `toJSON` method, like a
25290 * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}.
25291 * @param {Object} [options]
25292 * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}.
25293 * @param {Object} [options.validTill] The message will valid till this time.
25294 * @param {AuthOptions} [authOptions]
25295 * @return {Promise}
25296 */
25297 broadcast: function broadcast(fromClient, message) {
25298 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25299 var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
25300 var data = {
25301 from_peer: fromClient,
25302 conv_id: this.id,
25303 message: serializeMessage(message)
25304 };
25305
25306 if (options.pushData !== undefined) {
25307 data.push = options.pushData;
25308 }
25309
25310 if (options.validTill !== undefined) {
25311 var ts = options.validTill;
25312
25313 if (_.isDate(ts)) {
25314 ts = ts.getTime();
25315 }
25316
25317 options.valid_till = ts;
25318 }
25319
25320 return _request('rtm', 'broadcast', null, 'POST', data, authOptions);
25321 }
25322});
25323
25324/***/ }),
25325/* 573 */
25326/***/ (function(module, exports, __webpack_require__) {
25327
25328"use strict";
25329
25330
25331var _interopRequireDefault = __webpack_require__(1);
25332
25333var _promise = _interopRequireDefault(__webpack_require__(12));
25334
25335var _map = _interopRequireDefault(__webpack_require__(37));
25336
25337var _concat = _interopRequireDefault(__webpack_require__(19));
25338
25339var _ = __webpack_require__(3);
25340
25341var _require = __webpack_require__(28),
25342 request = _require.request;
25343
25344var _require2 = __webpack_require__(32),
25345 ensureArray = _require2.ensureArray,
25346 parseDate = _require2.parseDate;
25347
25348var AV = __webpack_require__(74);
25349/**
25350 * The version change interval for Leaderboard
25351 * @enum
25352 */
25353
25354
25355AV.LeaderboardVersionChangeInterval = {
25356 NEVER: 'never',
25357 DAY: 'day',
25358 WEEK: 'week',
25359 MONTH: 'month'
25360};
25361/**
25362 * The order of the leaderboard results
25363 * @enum
25364 */
25365
25366AV.LeaderboardOrder = {
25367 ASCENDING: 'ascending',
25368 DESCENDING: 'descending'
25369};
25370/**
25371 * The update strategy for Leaderboard
25372 * @enum
25373 */
25374
25375AV.LeaderboardUpdateStrategy = {
25376 /** Only keep the best statistic. If the leaderboard is in descending order, the best statistic is the highest one. */
25377 BETTER: 'better',
25378
25379 /** Keep the last updated statistic */
25380 LAST: 'last',
25381
25382 /** Keep the sum of all updated statistics */
25383 SUM: 'sum'
25384};
25385/**
25386 * @typedef {Object} Ranking
25387 * @property {number} rank Starts at 0
25388 * @property {number} value the statistic value of this ranking
25389 * @property {AV.User} user The user of this ranking
25390 * @property {Statistic[]} [includedStatistics] Other statistics of the user, specified by the `includeStatistic` option of `AV.Leaderboard.getResults()`
25391 */
25392
25393/**
25394 * @typedef {Object} LeaderboardArchive
25395 * @property {string} statisticName
25396 * @property {number} version version of the leaderboard
25397 * @property {string} status
25398 * @property {string} url URL for the downloadable archive
25399 * @property {Date} activatedAt time when this version became active
25400 * @property {Date} deactivatedAt time when this version was deactivated by a version incrementing
25401 */
25402
25403/**
25404 * @class
25405 */
25406
25407function Statistic(_ref) {
25408 var name = _ref.name,
25409 value = _ref.value,
25410 version = _ref.version;
25411
25412 /**
25413 * @type {string}
25414 */
25415 this.name = name;
25416 /**
25417 * @type {number}
25418 */
25419
25420 this.value = value;
25421 /**
25422 * @type {number?}
25423 */
25424
25425 this.version = version;
25426}
25427
25428var parseStatisticData = function parseStatisticData(statisticData) {
25429 var _AV$_decode = AV._decode(statisticData),
25430 name = _AV$_decode.statisticName,
25431 value = _AV$_decode.statisticValue,
25432 version = _AV$_decode.version;
25433
25434 return new Statistic({
25435 name: name,
25436 value: value,
25437 version: version
25438 });
25439};
25440/**
25441 * @class
25442 */
25443
25444
25445AV.Leaderboard = function Leaderboard(statisticName) {
25446 /**
25447 * @type {string}
25448 */
25449 this.statisticName = statisticName;
25450 /**
25451 * @type {AV.LeaderboardOrder}
25452 */
25453
25454 this.order = undefined;
25455 /**
25456 * @type {AV.LeaderboardUpdateStrategy}
25457 */
25458
25459 this.updateStrategy = undefined;
25460 /**
25461 * @type {AV.LeaderboardVersionChangeInterval}
25462 */
25463
25464 this.versionChangeInterval = undefined;
25465 /**
25466 * @type {number}
25467 */
25468
25469 this.version = undefined;
25470 /**
25471 * @type {Date?}
25472 */
25473
25474 this.nextResetAt = undefined;
25475 /**
25476 * @type {Date?}
25477 */
25478
25479 this.createdAt = undefined;
25480};
25481
25482var Leaderboard = AV.Leaderboard;
25483/**
25484 * Create an instance of Leaderboard for the give statistic name.
25485 * @param {string} statisticName
25486 * @return {AV.Leaderboard}
25487 */
25488
25489AV.Leaderboard.createWithoutData = function (statisticName) {
25490 return new Leaderboard(statisticName);
25491};
25492/**
25493 * (masterKey required) Create a new Leaderboard.
25494 * @param {Object} options
25495 * @param {string} options.statisticName
25496 * @param {AV.LeaderboardOrder} options.order
25497 * @param {AV.LeaderboardVersionChangeInterval} [options.versionChangeInterval] default to WEEK
25498 * @param {AV.LeaderboardUpdateStrategy} [options.updateStrategy] default to BETTER
25499 * @param {AuthOptions} [authOptions]
25500 * @return {Promise<AV.Leaderboard>}
25501 */
25502
25503
25504AV.Leaderboard.createLeaderboard = function (_ref2, authOptions) {
25505 var statisticName = _ref2.statisticName,
25506 order = _ref2.order,
25507 versionChangeInterval = _ref2.versionChangeInterval,
25508 updateStrategy = _ref2.updateStrategy;
25509 return request({
25510 method: 'POST',
25511 path: '/leaderboard/leaderboards',
25512 data: {
25513 statisticName: statisticName,
25514 order: order,
25515 versionChangeInterval: versionChangeInterval,
25516 updateStrategy: updateStrategy
25517 },
25518 authOptions: authOptions
25519 }).then(function (data) {
25520 var leaderboard = new Leaderboard(statisticName);
25521 return leaderboard._finishFetch(data);
25522 });
25523};
25524/**
25525 * Get the Leaderboard with the specified statistic name.
25526 * @param {string} statisticName
25527 * @param {AuthOptions} [authOptions]
25528 * @return {Promise<AV.Leaderboard>}
25529 */
25530
25531
25532AV.Leaderboard.getLeaderboard = function (statisticName, authOptions) {
25533 return Leaderboard.createWithoutData(statisticName).fetch(authOptions);
25534};
25535/**
25536 * Get Statistics for the specified user.
25537 * @param {AV.User} user The specified AV.User pointer.
25538 * @param {Object} [options]
25539 * @param {string[]} [options.statisticNames] Specify the statisticNames. If not set, all statistics of the user will be fetched.
25540 * @param {AuthOptions} [authOptions]
25541 * @return {Promise<Statistic[]>}
25542 */
25543
25544
25545AV.Leaderboard.getStatistics = function (user) {
25546 var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
25547 statisticNames = _ref3.statisticNames;
25548
25549 var authOptions = arguments.length > 2 ? arguments[2] : undefined;
25550 return _promise.default.resolve().then(function () {
25551 if (!(user && user.id)) throw new Error('user must be an AV.User');
25552 return request({
25553 method: 'GET',
25554 path: "/leaderboard/users/".concat(user.id, "/statistics"),
25555 query: {
25556 statistics: statisticNames ? ensureArray(statisticNames).join(',') : undefined
25557 },
25558 authOptions: authOptions
25559 }).then(function (_ref4) {
25560 var results = _ref4.results;
25561 return (0, _map.default)(results).call(results, parseStatisticData);
25562 });
25563 });
25564};
25565/**
25566 * Update Statistics for the specified user.
25567 * @param {AV.User} user The specified AV.User pointer.
25568 * @param {Object} statistics A name-value pair representing the statistics to update.
25569 * @param {AuthOptions} [options] AuthOptions plus:
25570 * @param {boolean} [options.overwrite] Wethere to overwrite these statistics disregarding the updateStrategy of there leaderboards
25571 * @return {Promise<Statistic[]>}
25572 */
25573
25574
25575AV.Leaderboard.updateStatistics = function (user, statistics) {
25576 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25577 return _promise.default.resolve().then(function () {
25578 if (!(user && user.id)) throw new Error('user must be an AV.User');
25579 var data = (0, _map.default)(_).call(_, statistics, function (value, key) {
25580 return {
25581 statisticName: key,
25582 statisticValue: value
25583 };
25584 });
25585 var overwrite = options.overwrite;
25586 return request({
25587 method: 'POST',
25588 path: "/leaderboard/users/".concat(user.id, "/statistics"),
25589 query: {
25590 overwrite: overwrite ? 1 : undefined
25591 },
25592 data: data,
25593 authOptions: options
25594 }).then(function (_ref5) {
25595 var results = _ref5.results;
25596 return (0, _map.default)(results).call(results, parseStatisticData);
25597 });
25598 });
25599};
25600/**
25601 * Delete Statistics for the specified user.
25602 * @param {AV.User} user The specified AV.User pointer.
25603 * @param {Object} statistics A name-value pair representing the statistics to delete.
25604 * @param {AuthOptions} [options]
25605 * @return {Promise<void>}
25606 */
25607
25608
25609AV.Leaderboard.deleteStatistics = function (user, statisticNames, authOptions) {
25610 return _promise.default.resolve().then(function () {
25611 if (!(user && user.id)) throw new Error('user must be an AV.User');
25612 return request({
25613 method: 'DELETE',
25614 path: "/leaderboard/users/".concat(user.id, "/statistics"),
25615 query: {
25616 statistics: ensureArray(statisticNames).join(',')
25617 },
25618 authOptions: authOptions
25619 }).then(function () {
25620 return undefined;
25621 });
25622 });
25623};
25624
25625_.extend(Leaderboard.prototype,
25626/** @lends AV.Leaderboard.prototype */
25627{
25628 _finishFetch: function _finishFetch(data) {
25629 var _this = this;
25630
25631 _.forEach(data, function (value, key) {
25632 if (key === 'updatedAt' || key === 'objectId') return;
25633
25634 if (key === 'expiredAt') {
25635 key = 'nextResetAt';
25636 }
25637
25638 if (key === 'createdAt') {
25639 value = parseDate(value);
25640 }
25641
25642 if (value && value.__type === 'Date') {
25643 value = parseDate(value.iso);
25644 }
25645
25646 _this[key] = value;
25647 });
25648
25649 return this;
25650 },
25651
25652 /**
25653 * Fetch data from the srever.
25654 * @param {AuthOptions} [authOptions]
25655 * @return {Promise<AV.Leaderboard>}
25656 */
25657 fetch: function fetch(authOptions) {
25658 var _this2 = this;
25659
25660 return request({
25661 method: 'GET',
25662 path: "/leaderboard/leaderboards/".concat(this.statisticName),
25663 authOptions: authOptions
25664 }).then(function (data) {
25665 return _this2._finishFetch(data);
25666 });
25667 },
25668
25669 /**
25670 * Counts the number of users participated in this leaderboard
25671 * @param {Object} [options]
25672 * @param {number} [options.version] Specify the version of the leaderboard
25673 * @param {AuthOptions} [authOptions]
25674 * @return {Promise<number>}
25675 */
25676 count: function count() {
25677 var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
25678 version = _ref6.version;
25679
25680 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
25681 return request({
25682 method: 'GET',
25683 path: "/leaderboard/leaderboards/".concat(this.statisticName, "/ranks"),
25684 query: {
25685 count: 1,
25686 limit: 0,
25687 version: version
25688 },
25689 authOptions: authOptions
25690 }).then(function (_ref7) {
25691 var count = _ref7.count;
25692 return count;
25693 });
25694 },
25695 _getResults: function _getResults(_ref8, authOptions, userId) {
25696 var _context;
25697
25698 var skip = _ref8.skip,
25699 limit = _ref8.limit,
25700 selectUserKeys = _ref8.selectUserKeys,
25701 includeUserKeys = _ref8.includeUserKeys,
25702 includeStatistics = _ref8.includeStatistics,
25703 version = _ref8.version;
25704 return request({
25705 method: 'GET',
25706 path: (0, _concat.default)(_context = "/leaderboard/leaderboards/".concat(this.statisticName, "/ranks")).call(_context, userId ? "/".concat(userId) : ''),
25707 query: {
25708 skip: skip,
25709 limit: limit,
25710 selectUserKeys: _.union(ensureArray(selectUserKeys), ensureArray(includeUserKeys)).join(',') || undefined,
25711 includeUser: includeUserKeys ? ensureArray(includeUserKeys).join(',') : undefined,
25712 includeStatistics: includeStatistics ? ensureArray(includeStatistics).join(',') : undefined,
25713 version: version
25714 },
25715 authOptions: authOptions
25716 }).then(function (_ref9) {
25717 var rankings = _ref9.results;
25718 return (0, _map.default)(rankings).call(rankings, function (rankingData) {
25719 var _AV$_decode2 = AV._decode(rankingData),
25720 user = _AV$_decode2.user,
25721 value = _AV$_decode2.statisticValue,
25722 rank = _AV$_decode2.rank,
25723 _AV$_decode2$statisti = _AV$_decode2.statistics,
25724 statistics = _AV$_decode2$statisti === void 0 ? [] : _AV$_decode2$statisti;
25725
25726 return {
25727 user: user,
25728 value: value,
25729 rank: rank,
25730 includedStatistics: (0, _map.default)(statistics).call(statistics, parseStatisticData)
25731 };
25732 });
25733 });
25734 },
25735
25736 /**
25737 * Retrieve a list of ranked users for this Leaderboard.
25738 * @param {Object} [options]
25739 * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
25740 * @param {number} [options.limit] The limit of the number of results.
25741 * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
25742 * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
25743 * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
25744 * @param {number} [options.version] Specify the version of the leaderboard
25745 * @param {AuthOptions} [authOptions]
25746 * @return {Promise<Ranking[]>}
25747 */
25748 getResults: function getResults() {
25749 var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
25750 skip = _ref10.skip,
25751 limit = _ref10.limit,
25752 selectUserKeys = _ref10.selectUserKeys,
25753 includeUserKeys = _ref10.includeUserKeys,
25754 includeStatistics = _ref10.includeStatistics,
25755 version = _ref10.version;
25756
25757 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
25758 return this._getResults({
25759 skip: skip,
25760 limit: limit,
25761 selectUserKeys: selectUserKeys,
25762 includeUserKeys: includeUserKeys,
25763 includeStatistics: includeStatistics,
25764 version: version
25765 }, authOptions);
25766 },
25767
25768 /**
25769 * Retrieve a list of ranked users for this Leaderboard, centered on the specified user.
25770 * @param {AV.User} user The specified AV.User pointer.
25771 * @param {Object} [options]
25772 * @param {number} [options.limit] The limit of the number of results.
25773 * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
25774 * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
25775 * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
25776 * @param {number} [options.version] Specify the version of the leaderboard
25777 * @param {AuthOptions} [authOptions]
25778 * @return {Promise<Ranking[]>}
25779 */
25780 getResultsAroundUser: function getResultsAroundUser(user) {
25781 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25782 var authOptions = arguments.length > 2 ? arguments[2] : undefined;
25783
25784 // getResultsAroundUser(options, authOptions)
25785 if (user && typeof user.id !== 'string') {
25786 return this.getResultsAroundUser(undefined, user, options);
25787 }
25788
25789 var limit = options.limit,
25790 selectUserKeys = options.selectUserKeys,
25791 includeUserKeys = options.includeUserKeys,
25792 includeStatistics = options.includeStatistics,
25793 version = options.version;
25794 return this._getResults({
25795 limit: limit,
25796 selectUserKeys: selectUserKeys,
25797 includeUserKeys: includeUserKeys,
25798 includeStatistics: includeStatistics,
25799 version: version
25800 }, authOptions, user ? user.id : 'self');
25801 },
25802 _update: function _update(data, authOptions) {
25803 var _this3 = this;
25804
25805 return request({
25806 method: 'PUT',
25807 path: "/leaderboard/leaderboards/".concat(this.statisticName),
25808 data: data,
25809 authOptions: authOptions
25810 }).then(function (result) {
25811 return _this3._finishFetch(result);
25812 });
25813 },
25814
25815 /**
25816 * (masterKey required) Update the version change interval of the Leaderboard.
25817 * @param {AV.LeaderboardVersionChangeInterval} versionChangeInterval
25818 * @param {AuthOptions} [authOptions]
25819 * @return {Promise<AV.Leaderboard>}
25820 */
25821 updateVersionChangeInterval: function updateVersionChangeInterval(versionChangeInterval, authOptions) {
25822 return this._update({
25823 versionChangeInterval: versionChangeInterval
25824 }, authOptions);
25825 },
25826
25827 /**
25828 * (masterKey required) Update the version change interval of the Leaderboard.
25829 * @param {AV.LeaderboardUpdateStrategy} updateStrategy
25830 * @param {AuthOptions} [authOptions]
25831 * @return {Promise<AV.Leaderboard>}
25832 */
25833 updateUpdateStrategy: function updateUpdateStrategy(updateStrategy, authOptions) {
25834 return this._update({
25835 updateStrategy: updateStrategy
25836 }, authOptions);
25837 },
25838
25839 /**
25840 * (masterKey required) Reset the Leaderboard. The version of the Leaderboard will be incremented by 1.
25841 * @param {AuthOptions} [authOptions]
25842 * @return {Promise<AV.Leaderboard>}
25843 */
25844 reset: function reset(authOptions) {
25845 var _this4 = this;
25846
25847 return request({
25848 method: 'PUT',
25849 path: "/leaderboard/leaderboards/".concat(this.statisticName, "/incrementVersion"),
25850 authOptions: authOptions
25851 }).then(function (data) {
25852 return _this4._finishFetch(data);
25853 });
25854 },
25855
25856 /**
25857 * (masterKey required) Delete the Leaderboard and its all archived versions.
25858 * @param {AuthOptions} [authOptions]
25859 * @return {void}
25860 */
25861 destroy: function destroy(authOptions) {
25862 return AV.request({
25863 method: 'DELETE',
25864 path: "/leaderboard/leaderboards/".concat(this.statisticName),
25865 authOptions: authOptions
25866 }).then(function () {
25867 return undefined;
25868 });
25869 },
25870
25871 /**
25872 * (masterKey required) Get archived versions.
25873 * @param {Object} [options]
25874 * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
25875 * @param {number} [options.limit] The limit of the number of results.
25876 * @param {AuthOptions} [authOptions]
25877 * @return {Promise<LeaderboardArchive[]>}
25878 */
25879 getArchives: function getArchives() {
25880 var _this5 = this;
25881
25882 var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
25883 skip = _ref11.skip,
25884 limit = _ref11.limit;
25885
25886 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
25887 return request({
25888 method: 'GET',
25889 path: "/leaderboard/leaderboards/".concat(this.statisticName, "/archives"),
25890 query: {
25891 skip: skip,
25892 limit: limit
25893 },
25894 authOptions: authOptions
25895 }).then(function (_ref12) {
25896 var results = _ref12.results;
25897 return (0, _map.default)(results).call(results, function (_ref13) {
25898 var version = _ref13.version,
25899 status = _ref13.status,
25900 url = _ref13.url,
25901 activatedAt = _ref13.activatedAt,
25902 deactivatedAt = _ref13.deactivatedAt;
25903 return {
25904 statisticName: _this5.statisticName,
25905 version: version,
25906 status: status,
25907 url: url,
25908 activatedAt: parseDate(activatedAt.iso),
25909 deactivatedAt: parseDate(deactivatedAt.iso)
25910 };
25911 });
25912 });
25913 }
25914});
25915
25916/***/ }),
25917/* 574 */
25918/***/ (function(module, exports, __webpack_require__) {
25919
25920"use strict";
25921
25922
25923var _Object$defineProperty = __webpack_require__(94);
25924
25925_Object$defineProperty(exports, "__esModule", {
25926 value: true
25927});
25928
25929exports.platformInfo = exports.WebSocket = void 0;
25930
25931_Object$defineProperty(exports, "request", {
25932 enumerable: true,
25933 get: function get() {
25934 return _adaptersSuperagent.request;
25935 }
25936});
25937
25938exports.storage = void 0;
25939
25940_Object$defineProperty(exports, "upload", {
25941 enumerable: true,
25942 get: function get() {
25943 return _adaptersSuperagent.upload;
25944 }
25945});
25946
25947var _adaptersSuperagent = __webpack_require__(575);
25948
25949var storage = window.localStorage;
25950exports.storage = storage;
25951var WebSocket = window.WebSocket;
25952exports.WebSocket = WebSocket;
25953var platformInfo = {
25954 name: "Browser"
25955};
25956exports.platformInfo = platformInfo;
25957
25958/***/ }),
25959/* 575 */
25960/***/ (function(module, exports, __webpack_require__) {
25961
25962"use strict";
25963
25964var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
25965 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
25966 return new (P || (P = Promise))(function (resolve, reject) {
25967 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25968 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
25969 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
25970 step((generator = generator.apply(thisArg, _arguments || [])).next());
25971 });
25972};
25973var __generator = (this && this.__generator) || function (thisArg, body) {
25974 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
25975 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25976 function verb(n) { return function (v) { return step([n, v]); }; }
25977 function step(op) {
25978 if (f) throw new TypeError("Generator is already executing.");
25979 while (_) try {
25980 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
25981 if (y = 0, t) op = [op[0] & 2, t.value];
25982 switch (op[0]) {
25983 case 0: case 1: t = op; break;
25984 case 4: _.label++; return { value: op[1], done: false };
25985 case 5: _.label++; y = op[1]; op = [0]; continue;
25986 case 7: op = _.ops.pop(); _.trys.pop(); continue;
25987 default:
25988 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
25989 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
25990 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
25991 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
25992 if (t[2]) _.ops.pop();
25993 _.trys.pop(); continue;
25994 }
25995 op = body.call(thisArg, _);
25996 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
25997 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
25998 }
25999};
26000Object.defineProperty(exports, "__esModule", { value: true });
26001exports.upload = exports.request = void 0;
26002var adapter_utils_1 = __webpack_require__(576);
26003var superagent = __webpack_require__(577);
26004function convertResponse(res) {
26005 return {
26006 ok: res.ok,
26007 status: res.status,
26008 headers: res.header,
26009 data: res.body,
26010 };
26011}
26012var request = function (url, options) {
26013 if (options === void 0) { options = {}; }
26014 return __awaiter(void 0, void 0, void 0, function () {
26015 var _a, method, data, headers, onprogress, signal, req, aborted, onAbort, res, error_1;
26016 return __generator(this, function (_b) {
26017 switch (_b.label) {
26018 case 0:
26019 _a = options.method, method = _a === void 0 ? "GET" : _a, data = options.data, headers = options.headers, onprogress = options.onprogress, signal = options.signal;
26020 if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
26021 throw new adapter_utils_1.AbortError("Request aborted");
26022 }
26023 req = superagent(method, url).ok(function () { return true; });
26024 if (headers) {
26025 req.set(headers);
26026 }
26027 if (onprogress) {
26028 req.on("progress", onprogress);
26029 }
26030 aborted = false;
26031 onAbort = function () {
26032 aborted = true;
26033 req.abort();
26034 };
26035 signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", onAbort);
26036 _b.label = 1;
26037 case 1:
26038 _b.trys.push([1, 3, 4, 5]);
26039 return [4 /*yield*/, req.send(data)];
26040 case 2:
26041 res = _b.sent();
26042 return [2 /*return*/, convertResponse(res)];
26043 case 3:
26044 error_1 = _b.sent();
26045 if (aborted) {
26046 throw new adapter_utils_1.AbortError("Request aborted");
26047 }
26048 throw error_1;
26049 case 4:
26050 signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", onAbort);
26051 return [7 /*endfinally*/];
26052 case 5: return [2 /*return*/];
26053 }
26054 });
26055 });
26056};
26057exports.request = request;
26058var upload = function (url, file, options) {
26059 if (options === void 0) { options = {}; }
26060 return __awaiter(void 0, void 0, void 0, function () {
26061 var _a, method, data, headers, onprogress, signal, req, aborted, onAbort, res, error_2;
26062 return __generator(this, function (_b) {
26063 switch (_b.label) {
26064 case 0:
26065 _a = options.method, method = _a === void 0 ? "POST" : _a, data = options.data, headers = options.headers, onprogress = options.onprogress, signal = options.signal;
26066 if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
26067 throw new adapter_utils_1.AbortError("Request aborted");
26068 }
26069 req = superagent(method, url)
26070 .ok(function () { return true; })
26071 .attach(file.field, file.data, file.name);
26072 if (data) {
26073 req.field(data);
26074 }
26075 if (headers) {
26076 req.set(headers);
26077 }
26078 if (onprogress) {
26079 req.on("progress", onprogress);
26080 }
26081 aborted = false;
26082 onAbort = function () {
26083 aborted = true;
26084 req.abort();
26085 };
26086 signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", onAbort);
26087 _b.label = 1;
26088 case 1:
26089 _b.trys.push([1, 3, 4, 5]);
26090 return [4 /*yield*/, req];
26091 case 2:
26092 res = _b.sent();
26093 return [2 /*return*/, convertResponse(res)];
26094 case 3:
26095 error_2 = _b.sent();
26096 if (aborted) {
26097 throw new adapter_utils_1.AbortError("Request aborted");
26098 }
26099 throw error_2;
26100 case 4:
26101 signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", onAbort);
26102 return [7 /*endfinally*/];
26103 case 5: return [2 /*return*/];
26104 }
26105 });
26106 });
26107};
26108exports.upload = upload;
26109//# sourceMappingURL=index.js.map
26110
26111/***/ }),
26112/* 576 */
26113/***/ (function(module, __webpack_exports__, __webpack_require__) {
26114
26115"use strict";
26116Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
26117/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbortError", function() { return AbortError; });
26118/*! *****************************************************************************
26119Copyright (c) Microsoft Corporation.
26120
26121Permission to use, copy, modify, and/or distribute this software for any
26122purpose with or without fee is hereby granted.
26123
26124THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
26125REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
26126AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
26127INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
26128LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
26129OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
26130PERFORMANCE OF THIS SOFTWARE.
26131***************************************************************************** */
26132/* global Reflect, Promise */
26133
26134var extendStatics = function(d, b) {
26135 extendStatics = Object.setPrototypeOf ||
26136 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26137 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
26138 return extendStatics(d, b);
26139};
26140
26141function __extends(d, b) {
26142 extendStatics(d, b);
26143 function __() { this.constructor = d; }
26144 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26145}
26146
26147var AbortError = /** @class */ (function (_super) {
26148 __extends(AbortError, _super);
26149 function AbortError() {
26150 var _this = _super !== null && _super.apply(this, arguments) || this;
26151 _this.name = "AbortError";
26152 return _this;
26153 }
26154 return AbortError;
26155}(Error));
26156
26157
26158//# sourceMappingURL=index.es.js.map
26159
26160
26161/***/ }),
26162/* 577 */
26163/***/ (function(module, exports, __webpack_require__) {
26164
26165"use strict";
26166
26167
26168var _interopRequireDefault = __webpack_require__(1);
26169
26170var _symbol = _interopRequireDefault(__webpack_require__(77));
26171
26172var _iterator = _interopRequireDefault(__webpack_require__(155));
26173
26174var _trim = _interopRequireDefault(__webpack_require__(578));
26175
26176var _concat = _interopRequireDefault(__webpack_require__(19));
26177
26178var _indexOf = _interopRequireDefault(__webpack_require__(61));
26179
26180var _slice = _interopRequireDefault(__webpack_require__(34));
26181
26182function _typeof(obj) {
26183 "@babel/helpers - typeof";
26184
26185 if (typeof _symbol.default === "function" && typeof _iterator.default === "symbol") {
26186 _typeof = function _typeof(obj) {
26187 return typeof obj;
26188 };
26189 } else {
26190 _typeof = function _typeof(obj) {
26191 return obj && typeof _symbol.default === "function" && obj.constructor === _symbol.default && obj !== _symbol.default.prototype ? "symbol" : typeof obj;
26192 };
26193 }
26194
26195 return _typeof(obj);
26196}
26197/**
26198 * Root reference for iframes.
26199 */
26200
26201
26202var root;
26203
26204if (typeof window !== 'undefined') {
26205 // Browser window
26206 root = window;
26207} else if (typeof self === 'undefined') {
26208 // Other environments
26209 console.warn('Using browser-only version of superagent in non-browser environment');
26210 root = void 0;
26211} else {
26212 // Web Worker
26213 root = self;
26214}
26215
26216var Emitter = __webpack_require__(585);
26217
26218var safeStringify = __webpack_require__(586);
26219
26220var RequestBase = __webpack_require__(587);
26221
26222var isObject = __webpack_require__(261);
26223
26224var ResponseBase = __webpack_require__(608);
26225
26226var Agent = __webpack_require__(615);
26227/**
26228 * Noop.
26229 */
26230
26231
26232function noop() {}
26233/**
26234 * Expose `request`.
26235 */
26236
26237
26238module.exports = function (method, url) {
26239 // callback
26240 if (typeof url === 'function') {
26241 return new exports.Request('GET', method).end(url);
26242 } // url first
26243
26244
26245 if (arguments.length === 1) {
26246 return new exports.Request('GET', method);
26247 }
26248
26249 return new exports.Request(method, url);
26250};
26251
26252exports = module.exports;
26253var request = exports;
26254exports.Request = Request;
26255/**
26256 * Determine XHR.
26257 */
26258
26259request.getXHR = function () {
26260 if (root.XMLHttpRequest && (!root.location || root.location.protocol !== 'file:' || !root.ActiveXObject)) {
26261 return new XMLHttpRequest();
26262 }
26263
26264 try {
26265 return new ActiveXObject('Microsoft.XMLHTTP');
26266 } catch (_unused) {}
26267
26268 try {
26269 return new ActiveXObject('Msxml2.XMLHTTP.6.0');
26270 } catch (_unused2) {}
26271
26272 try {
26273 return new ActiveXObject('Msxml2.XMLHTTP.3.0');
26274 } catch (_unused3) {}
26275
26276 try {
26277 return new ActiveXObject('Msxml2.XMLHTTP');
26278 } catch (_unused4) {}
26279
26280 throw new Error('Browser-only version of superagent could not find XHR');
26281};
26282/**
26283 * Removes leading and trailing whitespace, added to support IE.
26284 *
26285 * @param {String} s
26286 * @return {String}
26287 * @api private
26288 */
26289
26290
26291var trim = (0, _trim.default)('') ? function (s) {
26292 return (0, _trim.default)(s).call(s);
26293} : function (s) {
26294 return s.replace(/(^\s*|\s*$)/g, '');
26295};
26296/**
26297 * Serialize the given `obj`.
26298 *
26299 * @param {Object} obj
26300 * @return {String}
26301 * @api private
26302 */
26303
26304function serialize(obj) {
26305 if (!isObject(obj)) return obj;
26306 var pairs = [];
26307
26308 for (var key in obj) {
26309 if (Object.prototype.hasOwnProperty.call(obj, key)) pushEncodedKeyValuePair(pairs, key, obj[key]);
26310 }
26311
26312 return pairs.join('&');
26313}
26314/**
26315 * Helps 'serialize' with serializing arrays.
26316 * Mutates the pairs array.
26317 *
26318 * @param {Array} pairs
26319 * @param {String} key
26320 * @param {Mixed} val
26321 */
26322
26323
26324function pushEncodedKeyValuePair(pairs, key, val) {
26325 if (val === undefined) return;
26326
26327 if (val === null) {
26328 pairs.push(encodeURI(key));
26329 return;
26330 }
26331
26332 if (Array.isArray(val)) {
26333 val.forEach(function (v) {
26334 pushEncodedKeyValuePair(pairs, key, v);
26335 });
26336 } else if (isObject(val)) {
26337 for (var subkey in val) {
26338 var _context;
26339
26340 if (Object.prototype.hasOwnProperty.call(val, subkey)) pushEncodedKeyValuePair(pairs, (0, _concat.default)(_context = "".concat(key, "[")).call(_context, subkey, "]"), val[subkey]);
26341 }
26342 } else {
26343 pairs.push(encodeURI(key) + '=' + encodeURIComponent(val));
26344 }
26345}
26346/**
26347 * Expose serialization method.
26348 */
26349
26350
26351request.serializeObject = serialize;
26352/**
26353 * Parse the given x-www-form-urlencoded `str`.
26354 *
26355 * @param {String} str
26356 * @return {Object}
26357 * @api private
26358 */
26359
26360function parseString(str) {
26361 var obj = {};
26362 var pairs = str.split('&');
26363 var pair;
26364 var pos;
26365
26366 for (var i = 0, len = pairs.length; i < len; ++i) {
26367 pair = pairs[i];
26368 pos = (0, _indexOf.default)(pair).call(pair, '=');
26369
26370 if (pos === -1) {
26371 obj[decodeURIComponent(pair)] = '';
26372 } else {
26373 obj[decodeURIComponent((0, _slice.default)(pair).call(pair, 0, pos))] = decodeURIComponent((0, _slice.default)(pair).call(pair, pos + 1));
26374 }
26375 }
26376
26377 return obj;
26378}
26379/**
26380 * Expose parser.
26381 */
26382
26383
26384request.parseString = parseString;
26385/**
26386 * Default MIME type map.
26387 *
26388 * superagent.types.xml = 'application/xml';
26389 *
26390 */
26391
26392request.types = {
26393 html: 'text/html',
26394 json: 'application/json',
26395 xml: 'text/xml',
26396 urlencoded: 'application/x-www-form-urlencoded',
26397 form: 'application/x-www-form-urlencoded',
26398 'form-data': 'application/x-www-form-urlencoded'
26399};
26400/**
26401 * Default serialization map.
26402 *
26403 * superagent.serialize['application/xml'] = function(obj){
26404 * return 'generated xml here';
26405 * };
26406 *
26407 */
26408
26409request.serialize = {
26410 'application/x-www-form-urlencoded': serialize,
26411 'application/json': safeStringify
26412};
26413/**
26414 * Default parsers.
26415 *
26416 * superagent.parse['application/xml'] = function(str){
26417 * return { object parsed from str };
26418 * };
26419 *
26420 */
26421
26422request.parse = {
26423 'application/x-www-form-urlencoded': parseString,
26424 'application/json': JSON.parse
26425};
26426/**
26427 * Parse the given header `str` into
26428 * an object containing the mapped fields.
26429 *
26430 * @param {String} str
26431 * @return {Object}
26432 * @api private
26433 */
26434
26435function parseHeader(str) {
26436 var lines = str.split(/\r?\n/);
26437 var fields = {};
26438 var index;
26439 var line;
26440 var field;
26441 var val;
26442
26443 for (var i = 0, len = lines.length; i < len; ++i) {
26444 line = lines[i];
26445 index = (0, _indexOf.default)(line).call(line, ':');
26446
26447 if (index === -1) {
26448 // could be empty line, just skip it
26449 continue;
26450 }
26451
26452 field = (0, _slice.default)(line).call(line, 0, index).toLowerCase();
26453 val = trim((0, _slice.default)(line).call(line, index + 1));
26454 fields[field] = val;
26455 }
26456
26457 return fields;
26458}
26459/**
26460 * Check if `mime` is json or has +json structured syntax suffix.
26461 *
26462 * @param {String} mime
26463 * @return {Boolean}
26464 * @api private
26465 */
26466
26467
26468function isJSON(mime) {
26469 // should match /json or +json
26470 // but not /json-seq
26471 return /[/+]json($|[^-\w])/.test(mime);
26472}
26473/**
26474 * Initialize a new `Response` with the given `xhr`.
26475 *
26476 * - set flags (.ok, .error, etc)
26477 * - parse header
26478 *
26479 * Examples:
26480 *
26481 * Aliasing `superagent` as `request` is nice:
26482 *
26483 * request = superagent;
26484 *
26485 * We can use the promise-like API, or pass callbacks:
26486 *
26487 * request.get('/').end(function(res){});
26488 * request.get('/', function(res){});
26489 *
26490 * Sending data can be chained:
26491 *
26492 * request
26493 * .post('/user')
26494 * .send({ name: 'tj' })
26495 * .end(function(res){});
26496 *
26497 * Or passed to `.send()`:
26498 *
26499 * request
26500 * .post('/user')
26501 * .send({ name: 'tj' }, function(res){});
26502 *
26503 * Or passed to `.post()`:
26504 *
26505 * request
26506 * .post('/user', { name: 'tj' })
26507 * .end(function(res){});
26508 *
26509 * Or further reduced to a single call for simple cases:
26510 *
26511 * request
26512 * .post('/user', { name: 'tj' }, function(res){});
26513 *
26514 * @param {XMLHTTPRequest} xhr
26515 * @param {Object} options
26516 * @api private
26517 */
26518
26519
26520function Response(req) {
26521 this.req = req;
26522 this.xhr = this.req.xhr; // responseText is accessible only if responseType is '' or 'text' and on older browsers
26523
26524 this.text = this.req.method !== 'HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text') || typeof this.xhr.responseType === 'undefined' ? this.xhr.responseText : null;
26525 this.statusText = this.req.xhr.statusText;
26526 var status = this.xhr.status; // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request
26527
26528 if (status === 1223) {
26529 status = 204;
26530 }
26531
26532 this._setStatusProperties(status);
26533
26534 this.headers = parseHeader(this.xhr.getAllResponseHeaders());
26535 this.header = this.headers; // getAllResponseHeaders sometimes falsely returns "" for CORS requests, but
26536 // getResponseHeader still works. so we get content-type even if getting
26537 // other headers fails.
26538
26539 this.header['content-type'] = this.xhr.getResponseHeader('content-type');
26540
26541 this._setHeaderProperties(this.header);
26542
26543 if (this.text === null && req._responseType) {
26544 this.body = this.xhr.response;
26545 } else {
26546 this.body = this.req.method === 'HEAD' ? null : this._parseBody(this.text ? this.text : this.xhr.response);
26547 }
26548} // eslint-disable-next-line new-cap
26549
26550
26551ResponseBase(Response.prototype);
26552/**
26553 * Parse the given body `str`.
26554 *
26555 * Used for auto-parsing of bodies. Parsers
26556 * are defined on the `superagent.parse` object.
26557 *
26558 * @param {String} str
26559 * @return {Mixed}
26560 * @api private
26561 */
26562
26563Response.prototype._parseBody = function (str) {
26564 var parse = request.parse[this.type];
26565
26566 if (this.req._parser) {
26567 return this.req._parser(this, str);
26568 }
26569
26570 if (!parse && isJSON(this.type)) {
26571 parse = request.parse['application/json'];
26572 }
26573
26574 return parse && str && (str.length > 0 || str instanceof Object) ? parse(str) : null;
26575};
26576/**
26577 * Return an `Error` representative of this response.
26578 *
26579 * @return {Error}
26580 * @api public
26581 */
26582
26583
26584Response.prototype.toError = function () {
26585 var _context2, _context3;
26586
26587 var req = this.req;
26588 var method = req.method;
26589 var url = req.url;
26590 var msg = (0, _concat.default)(_context2 = (0, _concat.default)(_context3 = "cannot ".concat(method, " ")).call(_context3, url, " (")).call(_context2, this.status, ")");
26591 var err = new Error(msg);
26592 err.status = this.status;
26593 err.method = method;
26594 err.url = url;
26595 return err;
26596};
26597/**
26598 * Expose `Response`.
26599 */
26600
26601
26602request.Response = Response;
26603/**
26604 * Initialize a new `Request` with the given `method` and `url`.
26605 *
26606 * @param {String} method
26607 * @param {String} url
26608 * @api public
26609 */
26610
26611function Request(method, url) {
26612 var self = this;
26613 this._query = this._query || [];
26614 this.method = method;
26615 this.url = url;
26616 this.header = {}; // preserves header name case
26617
26618 this._header = {}; // coerces header names to lowercase
26619
26620 this.on('end', function () {
26621 var err = null;
26622 var res = null;
26623
26624 try {
26625 res = new Response(self);
26626 } catch (err_) {
26627 err = new Error('Parser is unable to parse the response');
26628 err.parse = true;
26629 err.original = err_; // issue #675: return the raw response if the response parsing fails
26630
26631 if (self.xhr) {
26632 // ie9 doesn't have 'response' property
26633 err.rawResponse = typeof self.xhr.responseType === 'undefined' ? self.xhr.responseText : self.xhr.response; // issue #876: return the http status code if the response parsing fails
26634
26635 err.status = self.xhr.status ? self.xhr.status : null;
26636 err.statusCode = err.status; // backwards-compat only
26637 } else {
26638 err.rawResponse = null;
26639 err.status = null;
26640 }
26641
26642 return self.callback(err);
26643 }
26644
26645 self.emit('response', res);
26646 var new_err;
26647
26648 try {
26649 if (!self._isResponseOK(res)) {
26650 new_err = new Error(res.statusText || res.text || 'Unsuccessful HTTP response');
26651 }
26652 } catch (err_) {
26653 new_err = err_; // ok() callback can throw
26654 } // #1000 don't catch errors from the callback to avoid double calling it
26655
26656
26657 if (new_err) {
26658 new_err.original = err;
26659 new_err.response = res;
26660 new_err.status = res.status;
26661 self.callback(new_err, res);
26662 } else {
26663 self.callback(null, res);
26664 }
26665 });
26666}
26667/**
26668 * Mixin `Emitter` and `RequestBase`.
26669 */
26670// eslint-disable-next-line new-cap
26671
26672
26673Emitter(Request.prototype); // eslint-disable-next-line new-cap
26674
26675RequestBase(Request.prototype);
26676/**
26677 * Set Content-Type to `type`, mapping values from `request.types`.
26678 *
26679 * Examples:
26680 *
26681 * superagent.types.xml = 'application/xml';
26682 *
26683 * request.post('/')
26684 * .type('xml')
26685 * .send(xmlstring)
26686 * .end(callback);
26687 *
26688 * request.post('/')
26689 * .type('application/xml')
26690 * .send(xmlstring)
26691 * .end(callback);
26692 *
26693 * @param {String} type
26694 * @return {Request} for chaining
26695 * @api public
26696 */
26697
26698Request.prototype.type = function (type) {
26699 this.set('Content-Type', request.types[type] || type);
26700 return this;
26701};
26702/**
26703 * Set Accept to `type`, mapping values from `request.types`.
26704 *
26705 * Examples:
26706 *
26707 * superagent.types.json = 'application/json';
26708 *
26709 * request.get('/agent')
26710 * .accept('json')
26711 * .end(callback);
26712 *
26713 * request.get('/agent')
26714 * .accept('application/json')
26715 * .end(callback);
26716 *
26717 * @param {String} accept
26718 * @return {Request} for chaining
26719 * @api public
26720 */
26721
26722
26723Request.prototype.accept = function (type) {
26724 this.set('Accept', request.types[type] || type);
26725 return this;
26726};
26727/**
26728 * Set Authorization field value with `user` and `pass`.
26729 *
26730 * @param {String} user
26731 * @param {String} [pass] optional in case of using 'bearer' as type
26732 * @param {Object} options with 'type' property 'auto', 'basic' or 'bearer' (default 'basic')
26733 * @return {Request} for chaining
26734 * @api public
26735 */
26736
26737
26738Request.prototype.auth = function (user, pass, options) {
26739 if (arguments.length === 1) pass = '';
26740
26741 if (_typeof(pass) === 'object' && pass !== null) {
26742 // pass is optional and can be replaced with options
26743 options = pass;
26744 pass = '';
26745 }
26746
26747 if (!options) {
26748 options = {
26749 type: typeof btoa === 'function' ? 'basic' : 'auto'
26750 };
26751 }
26752
26753 var encoder = function encoder(string) {
26754 if (typeof btoa === 'function') {
26755 return btoa(string);
26756 }
26757
26758 throw new Error('Cannot use basic auth, btoa is not a function');
26759 };
26760
26761 return this._auth(user, pass, options, encoder);
26762};
26763/**
26764 * Add query-string `val`.
26765 *
26766 * Examples:
26767 *
26768 * request.get('/shoes')
26769 * .query('size=10')
26770 * .query({ color: 'blue' })
26771 *
26772 * @param {Object|String} val
26773 * @return {Request} for chaining
26774 * @api public
26775 */
26776
26777
26778Request.prototype.query = function (val) {
26779 if (typeof val !== 'string') val = serialize(val);
26780 if (val) this._query.push(val);
26781 return this;
26782};
26783/**
26784 * Queue the given `file` as an attachment to the specified `field`,
26785 * with optional `options` (or filename).
26786 *
26787 * ``` js
26788 * request.post('/upload')
26789 * .attach('content', new Blob(['<a id="a"><b id="b">hey!</b></a>'], { type: "text/html"}))
26790 * .end(callback);
26791 * ```
26792 *
26793 * @param {String} field
26794 * @param {Blob|File} file
26795 * @param {String|Object} options
26796 * @return {Request} for chaining
26797 * @api public
26798 */
26799
26800
26801Request.prototype.attach = function (field, file, options) {
26802 if (file) {
26803 if (this._data) {
26804 throw new Error("superagent can't mix .send() and .attach()");
26805 }
26806
26807 this._getFormData().append(field, file, options || file.name);
26808 }
26809
26810 return this;
26811};
26812
26813Request.prototype._getFormData = function () {
26814 if (!this._formData) {
26815 this._formData = new root.FormData();
26816 }
26817
26818 return this._formData;
26819};
26820/**
26821 * Invoke the callback with `err` and `res`
26822 * and handle arity check.
26823 *
26824 * @param {Error} err
26825 * @param {Response} res
26826 * @api private
26827 */
26828
26829
26830Request.prototype.callback = function (err, res) {
26831 if (this._shouldRetry(err, res)) {
26832 return this._retry();
26833 }
26834
26835 var fn = this._callback;
26836 this.clearTimeout();
26837
26838 if (err) {
26839 if (this._maxRetries) err.retries = this._retries - 1;
26840 this.emit('error', err);
26841 }
26842
26843 fn(err, res);
26844};
26845/**
26846 * Invoke callback with x-domain error.
26847 *
26848 * @api private
26849 */
26850
26851
26852Request.prototype.crossDomainError = function () {
26853 var err = new Error('Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.');
26854 err.crossDomain = true;
26855 err.status = this.status;
26856 err.method = this.method;
26857 err.url = this.url;
26858 this.callback(err);
26859}; // This only warns, because the request is still likely to work
26860
26861
26862Request.prototype.agent = function () {
26863 console.warn('This is not supported in browser version of superagent');
26864 return this;
26865};
26866
26867Request.prototype.ca = Request.prototype.agent;
26868Request.prototype.buffer = Request.prototype.ca; // This throws, because it can't send/receive data as expected
26869
26870Request.prototype.write = function () {
26871 throw new Error('Streaming is not supported in browser version of superagent');
26872};
26873
26874Request.prototype.pipe = Request.prototype.write;
26875/**
26876 * Check if `obj` is a host object,
26877 * we don't want to serialize these :)
26878 *
26879 * @param {Object} obj host object
26880 * @return {Boolean} is a host object
26881 * @api private
26882 */
26883
26884Request.prototype._isHost = function (obj) {
26885 // Native objects stringify to [object File], [object Blob], [object FormData], etc.
26886 return obj && _typeof(obj) === 'object' && !Array.isArray(obj) && Object.prototype.toString.call(obj) !== '[object Object]';
26887};
26888/**
26889 * Initiate request, invoking callback `fn(res)`
26890 * with an instanceof `Response`.
26891 *
26892 * @param {Function} fn
26893 * @return {Request} for chaining
26894 * @api public
26895 */
26896
26897
26898Request.prototype.end = function (fn) {
26899 if (this._endCalled) {
26900 console.warn('Warning: .end() was called twice. This is not supported in superagent');
26901 }
26902
26903 this._endCalled = true; // store callback
26904
26905 this._callback = fn || noop; // querystring
26906
26907 this._finalizeQueryString();
26908
26909 this._end();
26910};
26911
26912Request.prototype._setUploadTimeout = function () {
26913 var self = this; // upload timeout it's wokrs only if deadline timeout is off
26914
26915 if (this._uploadTimeout && !this._uploadTimeoutTimer) {
26916 this._uploadTimeoutTimer = setTimeout(function () {
26917 self._timeoutError('Upload timeout of ', self._uploadTimeout, 'ETIMEDOUT');
26918 }, this._uploadTimeout);
26919 }
26920}; // eslint-disable-next-line complexity
26921
26922
26923Request.prototype._end = function () {
26924 if (this._aborted) return this.callback(new Error('The request has been aborted even before .end() was called'));
26925 var self = this;
26926 this.xhr = request.getXHR();
26927 var xhr = this.xhr;
26928 var data = this._formData || this._data;
26929
26930 this._setTimeouts(); // state change
26931
26932
26933 xhr.onreadystatechange = function () {
26934 var readyState = xhr.readyState;
26935
26936 if (readyState >= 2 && self._responseTimeoutTimer) {
26937 clearTimeout(self._responseTimeoutTimer);
26938 }
26939
26940 if (readyState !== 4) {
26941 return;
26942 } // In IE9, reads to any property (e.g. status) off of an aborted XHR will
26943 // result in the error "Could not complete the operation due to error c00c023f"
26944
26945
26946 var status;
26947
26948 try {
26949 status = xhr.status;
26950 } catch (_unused5) {
26951 status = 0;
26952 }
26953
26954 if (!status) {
26955 if (self.timedout || self._aborted) return;
26956 return self.crossDomainError();
26957 }
26958
26959 self.emit('end');
26960 }; // progress
26961
26962
26963 var handleProgress = function handleProgress(direction, e) {
26964 if (e.total > 0) {
26965 e.percent = e.loaded / e.total * 100;
26966
26967 if (e.percent === 100) {
26968 clearTimeout(self._uploadTimeoutTimer);
26969 }
26970 }
26971
26972 e.direction = direction;
26973 self.emit('progress', e);
26974 };
26975
26976 if (this.hasListeners('progress')) {
26977 try {
26978 xhr.addEventListener('progress', handleProgress.bind(null, 'download'));
26979
26980 if (xhr.upload) {
26981 xhr.upload.addEventListener('progress', handleProgress.bind(null, 'upload'));
26982 }
26983 } catch (_unused6) {// Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist.
26984 // Reported here:
26985 // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context
26986 }
26987 }
26988
26989 if (xhr.upload) {
26990 this._setUploadTimeout();
26991 } // initiate request
26992
26993
26994 try {
26995 if (this.username && this.password) {
26996 xhr.open(this.method, this.url, true, this.username, this.password);
26997 } else {
26998 xhr.open(this.method, this.url, true);
26999 }
27000 } catch (err) {
27001 // see #1149
27002 return this.callback(err);
27003 } // CORS
27004
27005
27006 if (this._withCredentials) xhr.withCredentials = true; // body
27007
27008 if (!this._formData && this.method !== 'GET' && this.method !== 'HEAD' && typeof data !== 'string' && !this._isHost(data)) {
27009 // serialize stuff
27010 var contentType = this._header['content-type'];
27011
27012 var _serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : ''];
27013
27014 if (!_serialize && isJSON(contentType)) {
27015 _serialize = request.serialize['application/json'];
27016 }
27017
27018 if (_serialize) data = _serialize(data);
27019 } // set header fields
27020
27021
27022 for (var field in this.header) {
27023 if (this.header[field] === null) continue;
27024 if (Object.prototype.hasOwnProperty.call(this.header, field)) xhr.setRequestHeader(field, this.header[field]);
27025 }
27026
27027 if (this._responseType) {
27028 xhr.responseType = this._responseType;
27029 } // send stuff
27030
27031
27032 this.emit('request', this); // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing)
27033 // We need null here if data is undefined
27034
27035 xhr.send(typeof data === 'undefined' ? null : data);
27036};
27037
27038request.agent = function () {
27039 return new Agent();
27040};
27041
27042['GET', 'POST', 'OPTIONS', 'PATCH', 'PUT', 'DELETE'].forEach(function (method) {
27043 Agent.prototype[method.toLowerCase()] = function (url, fn) {
27044 var req = new request.Request(method, url);
27045
27046 this._setDefaults(req);
27047
27048 if (fn) {
27049 req.end(fn);
27050 }
27051
27052 return req;
27053 };
27054});
27055Agent.prototype.del = Agent.prototype.delete;
27056/**
27057 * GET `url` with optional callback `fn(res)`.
27058 *
27059 * @param {String} url
27060 * @param {Mixed|Function} [data] or fn
27061 * @param {Function} [fn]
27062 * @return {Request}
27063 * @api public
27064 */
27065
27066request.get = function (url, data, fn) {
27067 var req = request('GET', url);
27068
27069 if (typeof data === 'function') {
27070 fn = data;
27071 data = null;
27072 }
27073
27074 if (data) req.query(data);
27075 if (fn) req.end(fn);
27076 return req;
27077};
27078/**
27079 * HEAD `url` with optional callback `fn(res)`.
27080 *
27081 * @param {String} url
27082 * @param {Mixed|Function} [data] or fn
27083 * @param {Function} [fn]
27084 * @return {Request}
27085 * @api public
27086 */
27087
27088
27089request.head = function (url, data, fn) {
27090 var req = request('HEAD', url);
27091
27092 if (typeof data === 'function') {
27093 fn = data;
27094 data = null;
27095 }
27096
27097 if (data) req.query(data);
27098 if (fn) req.end(fn);
27099 return req;
27100};
27101/**
27102 * OPTIONS query to `url` with optional callback `fn(res)`.
27103 *
27104 * @param {String} url
27105 * @param {Mixed|Function} [data] or fn
27106 * @param {Function} [fn]
27107 * @return {Request}
27108 * @api public
27109 */
27110
27111
27112request.options = function (url, data, fn) {
27113 var req = request('OPTIONS', url);
27114
27115 if (typeof data === 'function') {
27116 fn = data;
27117 data = null;
27118 }
27119
27120 if (data) req.send(data);
27121 if (fn) req.end(fn);
27122 return req;
27123};
27124/**
27125 * DELETE `url` with optional `data` and callback `fn(res)`.
27126 *
27127 * @param {String} url
27128 * @param {Mixed} [data]
27129 * @param {Function} [fn]
27130 * @return {Request}
27131 * @api public
27132 */
27133
27134
27135function del(url, data, fn) {
27136 var req = request('DELETE', url);
27137
27138 if (typeof data === 'function') {
27139 fn = data;
27140 data = null;
27141 }
27142
27143 if (data) req.send(data);
27144 if (fn) req.end(fn);
27145 return req;
27146}
27147
27148request.del = del;
27149request.delete = del;
27150/**
27151 * PATCH `url` with optional `data` and callback `fn(res)`.
27152 *
27153 * @param {String} url
27154 * @param {Mixed} [data]
27155 * @param {Function} [fn]
27156 * @return {Request}
27157 * @api public
27158 */
27159
27160request.patch = function (url, data, fn) {
27161 var req = request('PATCH', url);
27162
27163 if (typeof data === 'function') {
27164 fn = data;
27165 data = null;
27166 }
27167
27168 if (data) req.send(data);
27169 if (fn) req.end(fn);
27170 return req;
27171};
27172/**
27173 * POST `url` with optional `data` and callback `fn(res)`.
27174 *
27175 * @param {String} url
27176 * @param {Mixed} [data]
27177 * @param {Function} [fn]
27178 * @return {Request}
27179 * @api public
27180 */
27181
27182
27183request.post = function (url, data, fn) {
27184 var req = request('POST', url);
27185
27186 if (typeof data === 'function') {
27187 fn = data;
27188 data = null;
27189 }
27190
27191 if (data) req.send(data);
27192 if (fn) req.end(fn);
27193 return req;
27194};
27195/**
27196 * PUT `url` with optional `data` and callback `fn(res)`.
27197 *
27198 * @param {String} url
27199 * @param {Mixed|Function} [data] or fn
27200 * @param {Function} [fn]
27201 * @return {Request}
27202 * @api public
27203 */
27204
27205
27206request.put = function (url, data, fn) {
27207 var req = request('PUT', url);
27208
27209 if (typeof data === 'function') {
27210 fn = data;
27211 data = null;
27212 }
27213
27214 if (data) req.send(data);
27215 if (fn) req.end(fn);
27216 return req;
27217};
27218
27219/***/ }),
27220/* 578 */
27221/***/ (function(module, exports, __webpack_require__) {
27222
27223module.exports = __webpack_require__(579);
27224
27225/***/ }),
27226/* 579 */
27227/***/ (function(module, exports, __webpack_require__) {
27228
27229var parent = __webpack_require__(580);
27230
27231module.exports = parent;
27232
27233
27234/***/ }),
27235/* 580 */
27236/***/ (function(module, exports, __webpack_require__) {
27237
27238var isPrototypeOf = __webpack_require__(16);
27239var method = __webpack_require__(581);
27240
27241var StringPrototype = String.prototype;
27242
27243module.exports = function (it) {
27244 var own = it.trim;
27245 return typeof it == 'string' || it === StringPrototype
27246 || (isPrototypeOf(StringPrototype, it) && own === StringPrototype.trim) ? method : own;
27247};
27248
27249
27250/***/ }),
27251/* 581 */
27252/***/ (function(module, exports, __webpack_require__) {
27253
27254__webpack_require__(582);
27255var entryVirtual = __webpack_require__(27);
27256
27257module.exports = entryVirtual('String').trim;
27258
27259
27260/***/ }),
27261/* 582 */
27262/***/ (function(module, exports, __webpack_require__) {
27263
27264"use strict";
27265
27266var $ = __webpack_require__(0);
27267var $trim = __webpack_require__(583).trim;
27268var forcedStringTrimMethod = __webpack_require__(584);
27269
27270// `String.prototype.trim` method
27271// https://tc39.es/ecma262/#sec-string.prototype.trim
27272$({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
27273 trim: function trim() {
27274 return $trim(this);
27275 }
27276});
27277
27278
27279/***/ }),
27280/* 583 */
27281/***/ (function(module, exports, __webpack_require__) {
27282
27283var uncurryThis = __webpack_require__(4);
27284var requireObjectCoercible = __webpack_require__(81);
27285var toString = __webpack_require__(42);
27286var whitespaces = __webpack_require__(260);
27287
27288var replace = uncurryThis(''.replace);
27289var whitespace = '[' + whitespaces + ']';
27290var ltrim = RegExp('^' + whitespace + whitespace + '*');
27291var rtrim = RegExp(whitespace + whitespace + '*$');
27292
27293// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
27294var createMethod = function (TYPE) {
27295 return function ($this) {
27296 var string = toString(requireObjectCoercible($this));
27297 if (TYPE & 1) string = replace(string, ltrim, '');
27298 if (TYPE & 2) string = replace(string, rtrim, '');
27299 return string;
27300 };
27301};
27302
27303module.exports = {
27304 // `String.prototype.{ trimLeft, trimStart }` methods
27305 // https://tc39.es/ecma262/#sec-string.prototype.trimstart
27306 start: createMethod(1),
27307 // `String.prototype.{ trimRight, trimEnd }` methods
27308 // https://tc39.es/ecma262/#sec-string.prototype.trimend
27309 end: createMethod(2),
27310 // `String.prototype.trim` method
27311 // https://tc39.es/ecma262/#sec-string.prototype.trim
27312 trim: createMethod(3)
27313};
27314
27315
27316/***/ }),
27317/* 584 */
27318/***/ (function(module, exports, __webpack_require__) {
27319
27320var PROPER_FUNCTION_NAME = __webpack_require__(170).PROPER;
27321var fails = __webpack_require__(2);
27322var whitespaces = __webpack_require__(260);
27323
27324var non = '\u200B\u0085\u180E';
27325
27326// check that a method works with the correct list
27327// of whitespaces and has a correct name
27328module.exports = function (METHOD_NAME) {
27329 return fails(function () {
27330 return !!whitespaces[METHOD_NAME]()
27331 || non[METHOD_NAME]() !== non
27332 || (PROPER_FUNCTION_NAME && whitespaces[METHOD_NAME].name !== METHOD_NAME);
27333 });
27334};
27335
27336
27337/***/ }),
27338/* 585 */
27339/***/ (function(module, exports, __webpack_require__) {
27340
27341
27342/**
27343 * Expose `Emitter`.
27344 */
27345
27346if (true) {
27347 module.exports = Emitter;
27348}
27349
27350/**
27351 * Initialize a new `Emitter`.
27352 *
27353 * @api public
27354 */
27355
27356function Emitter(obj) {
27357 if (obj) return mixin(obj);
27358};
27359
27360/**
27361 * Mixin the emitter properties.
27362 *
27363 * @param {Object} obj
27364 * @return {Object}
27365 * @api private
27366 */
27367
27368function mixin(obj) {
27369 for (var key in Emitter.prototype) {
27370 obj[key] = Emitter.prototype[key];
27371 }
27372 return obj;
27373}
27374
27375/**
27376 * Listen on the given `event` with `fn`.
27377 *
27378 * @param {String} event
27379 * @param {Function} fn
27380 * @return {Emitter}
27381 * @api public
27382 */
27383
27384Emitter.prototype.on =
27385Emitter.prototype.addEventListener = function(event, fn){
27386 this._callbacks = this._callbacks || {};
27387 (this._callbacks['$' + event] = this._callbacks['$' + event] || [])
27388 .push(fn);
27389 return this;
27390};
27391
27392/**
27393 * Adds an `event` listener that will be invoked a single
27394 * time then automatically removed.
27395 *
27396 * @param {String} event
27397 * @param {Function} fn
27398 * @return {Emitter}
27399 * @api public
27400 */
27401
27402Emitter.prototype.once = function(event, fn){
27403 function on() {
27404 this.off(event, on);
27405 fn.apply(this, arguments);
27406 }
27407
27408 on.fn = fn;
27409 this.on(event, on);
27410 return this;
27411};
27412
27413/**
27414 * Remove the given callback for `event` or all
27415 * registered callbacks.
27416 *
27417 * @param {String} event
27418 * @param {Function} fn
27419 * @return {Emitter}
27420 * @api public
27421 */
27422
27423Emitter.prototype.off =
27424Emitter.prototype.removeListener =
27425Emitter.prototype.removeAllListeners =
27426Emitter.prototype.removeEventListener = function(event, fn){
27427 this._callbacks = this._callbacks || {};
27428
27429 // all
27430 if (0 == arguments.length) {
27431 this._callbacks = {};
27432 return this;
27433 }
27434
27435 // specific event
27436 var callbacks = this._callbacks['$' + event];
27437 if (!callbacks) return this;
27438
27439 // remove all handlers
27440 if (1 == arguments.length) {
27441 delete this._callbacks['$' + event];
27442 return this;
27443 }
27444
27445 // remove specific handler
27446 var cb;
27447 for (var i = 0; i < callbacks.length; i++) {
27448 cb = callbacks[i];
27449 if (cb === fn || cb.fn === fn) {
27450 callbacks.splice(i, 1);
27451 break;
27452 }
27453 }
27454
27455 // Remove event specific arrays for event types that no
27456 // one is subscribed for to avoid memory leak.
27457 if (callbacks.length === 0) {
27458 delete this._callbacks['$' + event];
27459 }
27460
27461 return this;
27462};
27463
27464/**
27465 * Emit `event` with the given args.
27466 *
27467 * @param {String} event
27468 * @param {Mixed} ...
27469 * @return {Emitter}
27470 */
27471
27472Emitter.prototype.emit = function(event){
27473 this._callbacks = this._callbacks || {};
27474
27475 var args = new Array(arguments.length - 1)
27476 , callbacks = this._callbacks['$' + event];
27477
27478 for (var i = 1; i < arguments.length; i++) {
27479 args[i - 1] = arguments[i];
27480 }
27481
27482 if (callbacks) {
27483 callbacks = callbacks.slice(0);
27484 for (var i = 0, len = callbacks.length; i < len; ++i) {
27485 callbacks[i].apply(this, args);
27486 }
27487 }
27488
27489 return this;
27490};
27491
27492/**
27493 * Return array of callbacks for `event`.
27494 *
27495 * @param {String} event
27496 * @return {Array}
27497 * @api public
27498 */
27499
27500Emitter.prototype.listeners = function(event){
27501 this._callbacks = this._callbacks || {};
27502 return this._callbacks['$' + event] || [];
27503};
27504
27505/**
27506 * Check if this emitter has `event` handlers.
27507 *
27508 * @param {String} event
27509 * @return {Boolean}
27510 * @api public
27511 */
27512
27513Emitter.prototype.hasListeners = function(event){
27514 return !! this.listeners(event).length;
27515};
27516
27517
27518/***/ }),
27519/* 586 */
27520/***/ (function(module, exports) {
27521
27522module.exports = stringify
27523stringify.default = stringify
27524stringify.stable = deterministicStringify
27525stringify.stableStringify = deterministicStringify
27526
27527var LIMIT_REPLACE_NODE = '[...]'
27528var CIRCULAR_REPLACE_NODE = '[Circular]'
27529
27530var arr = []
27531var replacerStack = []
27532
27533function defaultOptions () {
27534 return {
27535 depthLimit: Number.MAX_SAFE_INTEGER,
27536 edgesLimit: Number.MAX_SAFE_INTEGER
27537 }
27538}
27539
27540// Regular stringify
27541function stringify (obj, replacer, spacer, options) {
27542 if (typeof options === 'undefined') {
27543 options = defaultOptions()
27544 }
27545
27546 decirc(obj, '', 0, [], undefined, 0, options)
27547 var res
27548 try {
27549 if (replacerStack.length === 0) {
27550 res = JSON.stringify(obj, replacer, spacer)
27551 } else {
27552 res = JSON.stringify(obj, replaceGetterValues(replacer), spacer)
27553 }
27554 } catch (_) {
27555 return JSON.stringify('[unable to serialize, circular reference is too complex to analyze]')
27556 } finally {
27557 while (arr.length !== 0) {
27558 var part = arr.pop()
27559 if (part.length === 4) {
27560 Object.defineProperty(part[0], part[1], part[3])
27561 } else {
27562 part[0][part[1]] = part[2]
27563 }
27564 }
27565 }
27566 return res
27567}
27568
27569function setReplace (replace, val, k, parent) {
27570 var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k)
27571 if (propertyDescriptor.get !== undefined) {
27572 if (propertyDescriptor.configurable) {
27573 Object.defineProperty(parent, k, { value: replace })
27574 arr.push([parent, k, val, propertyDescriptor])
27575 } else {
27576 replacerStack.push([val, k, replace])
27577 }
27578 } else {
27579 parent[k] = replace
27580 arr.push([parent, k, val])
27581 }
27582}
27583
27584function decirc (val, k, edgeIndex, stack, parent, depth, options) {
27585 depth += 1
27586 var i
27587 if (typeof val === 'object' && val !== null) {
27588 for (i = 0; i < stack.length; i++) {
27589 if (stack[i] === val) {
27590 setReplace(CIRCULAR_REPLACE_NODE, val, k, parent)
27591 return
27592 }
27593 }
27594
27595 if (
27596 typeof options.depthLimit !== 'undefined' &&
27597 depth > options.depthLimit
27598 ) {
27599 setReplace(LIMIT_REPLACE_NODE, val, k, parent)
27600 return
27601 }
27602
27603 if (
27604 typeof options.edgesLimit !== 'undefined' &&
27605 edgeIndex + 1 > options.edgesLimit
27606 ) {
27607 setReplace(LIMIT_REPLACE_NODE, val, k, parent)
27608 return
27609 }
27610
27611 stack.push(val)
27612 // Optimize for Arrays. Big arrays could kill the performance otherwise!
27613 if (Array.isArray(val)) {
27614 for (i = 0; i < val.length; i++) {
27615 decirc(val[i], i, i, stack, val, depth, options)
27616 }
27617 } else {
27618 var keys = Object.keys(val)
27619 for (i = 0; i < keys.length; i++) {
27620 var key = keys[i]
27621 decirc(val[key], key, i, stack, val, depth, options)
27622 }
27623 }
27624 stack.pop()
27625 }
27626}
27627
27628// Stable-stringify
27629function compareFunction (a, b) {
27630 if (a < b) {
27631 return -1
27632 }
27633 if (a > b) {
27634 return 1
27635 }
27636 return 0
27637}
27638
27639function deterministicStringify (obj, replacer, spacer, options) {
27640 if (typeof options === 'undefined') {
27641 options = defaultOptions()
27642 }
27643
27644 var tmp = deterministicDecirc(obj, '', 0, [], undefined, 0, options) || obj
27645 var res
27646 try {
27647 if (replacerStack.length === 0) {
27648 res = JSON.stringify(tmp, replacer, spacer)
27649 } else {
27650 res = JSON.stringify(tmp, replaceGetterValues(replacer), spacer)
27651 }
27652 } catch (_) {
27653 return JSON.stringify('[unable to serialize, circular reference is too complex to analyze]')
27654 } finally {
27655 // Ensure that we restore the object as it was.
27656 while (arr.length !== 0) {
27657 var part = arr.pop()
27658 if (part.length === 4) {
27659 Object.defineProperty(part[0], part[1], part[3])
27660 } else {
27661 part[0][part[1]] = part[2]
27662 }
27663 }
27664 }
27665 return res
27666}
27667
27668function deterministicDecirc (val, k, edgeIndex, stack, parent, depth, options) {
27669 depth += 1
27670 var i
27671 if (typeof val === 'object' && val !== null) {
27672 for (i = 0; i < stack.length; i++) {
27673 if (stack[i] === val) {
27674 setReplace(CIRCULAR_REPLACE_NODE, val, k, parent)
27675 return
27676 }
27677 }
27678 try {
27679 if (typeof val.toJSON === 'function') {
27680 return
27681 }
27682 } catch (_) {
27683 return
27684 }
27685
27686 if (
27687 typeof options.depthLimit !== 'undefined' &&
27688 depth > options.depthLimit
27689 ) {
27690 setReplace(LIMIT_REPLACE_NODE, val, k, parent)
27691 return
27692 }
27693
27694 if (
27695 typeof options.edgesLimit !== 'undefined' &&
27696 edgeIndex + 1 > options.edgesLimit
27697 ) {
27698 setReplace(LIMIT_REPLACE_NODE, val, k, parent)
27699 return
27700 }
27701
27702 stack.push(val)
27703 // Optimize for Arrays. Big arrays could kill the performance otherwise!
27704 if (Array.isArray(val)) {
27705 for (i = 0; i < val.length; i++) {
27706 deterministicDecirc(val[i], i, i, stack, val, depth, options)
27707 }
27708 } else {
27709 // Create a temporary object in the required way
27710 var tmp = {}
27711 var keys = Object.keys(val).sort(compareFunction)
27712 for (i = 0; i < keys.length; i++) {
27713 var key = keys[i]
27714 deterministicDecirc(val[key], key, i, stack, val, depth, options)
27715 tmp[key] = val[key]
27716 }
27717 if (typeof parent !== 'undefined') {
27718 arr.push([parent, k, val])
27719 parent[k] = tmp
27720 } else {
27721 return tmp
27722 }
27723 }
27724 stack.pop()
27725 }
27726}
27727
27728// wraps replacer function to handle values we couldn't replace
27729// and mark them as replaced value
27730function replaceGetterValues (replacer) {
27731 replacer =
27732 typeof replacer !== 'undefined'
27733 ? replacer
27734 : function (k, v) {
27735 return v
27736 }
27737 return function (key, val) {
27738 if (replacerStack.length > 0) {
27739 for (var i = 0; i < replacerStack.length; i++) {
27740 var part = replacerStack[i]
27741 if (part[1] === key && part[0] === val) {
27742 val = part[2]
27743 replacerStack.splice(i, 1)
27744 break
27745 }
27746 }
27747 }
27748 return replacer.call(this, key, val)
27749 }
27750}
27751
27752
27753/***/ }),
27754/* 587 */
27755/***/ (function(module, exports, __webpack_require__) {
27756
27757"use strict";
27758
27759
27760var _interopRequireDefault = __webpack_require__(1);
27761
27762var _symbol = _interopRequireDefault(__webpack_require__(77));
27763
27764var _iterator = _interopRequireDefault(__webpack_require__(155));
27765
27766var _includes = _interopRequireDefault(__webpack_require__(588));
27767
27768var _promise = _interopRequireDefault(__webpack_require__(12));
27769
27770var _concat = _interopRequireDefault(__webpack_require__(19));
27771
27772var _indexOf = _interopRequireDefault(__webpack_require__(61));
27773
27774var _slice = _interopRequireDefault(__webpack_require__(34));
27775
27776var _sort = _interopRequireDefault(__webpack_require__(598));
27777
27778function _typeof(obj) {
27779 "@babel/helpers - typeof";
27780
27781 if (typeof _symbol.default === "function" && typeof _iterator.default === "symbol") {
27782 _typeof = function _typeof(obj) {
27783 return typeof obj;
27784 };
27785 } else {
27786 _typeof = function _typeof(obj) {
27787 return obj && typeof _symbol.default === "function" && obj.constructor === _symbol.default && obj !== _symbol.default.prototype ? "symbol" : typeof obj;
27788 };
27789 }
27790
27791 return _typeof(obj);
27792}
27793/**
27794 * Module of mixed-in functions shared between node and client code
27795 */
27796
27797
27798var isObject = __webpack_require__(261);
27799/**
27800 * Expose `RequestBase`.
27801 */
27802
27803
27804module.exports = RequestBase;
27805/**
27806 * Initialize a new `RequestBase`.
27807 *
27808 * @api public
27809 */
27810
27811function RequestBase(obj) {
27812 if (obj) return mixin(obj);
27813}
27814/**
27815 * Mixin the prototype properties.
27816 *
27817 * @param {Object} obj
27818 * @return {Object}
27819 * @api private
27820 */
27821
27822
27823function mixin(obj) {
27824 for (var key in RequestBase.prototype) {
27825 if (Object.prototype.hasOwnProperty.call(RequestBase.prototype, key)) obj[key] = RequestBase.prototype[key];
27826 }
27827
27828 return obj;
27829}
27830/**
27831 * Clear previous timeout.
27832 *
27833 * @return {Request} for chaining
27834 * @api public
27835 */
27836
27837
27838RequestBase.prototype.clearTimeout = function () {
27839 clearTimeout(this._timer);
27840 clearTimeout(this._responseTimeoutTimer);
27841 clearTimeout(this._uploadTimeoutTimer);
27842 delete this._timer;
27843 delete this._responseTimeoutTimer;
27844 delete this._uploadTimeoutTimer;
27845 return this;
27846};
27847/**
27848 * Override default response body parser
27849 *
27850 * This function will be called to convert incoming data into request.body
27851 *
27852 * @param {Function}
27853 * @api public
27854 */
27855
27856
27857RequestBase.prototype.parse = function (fn) {
27858 this._parser = fn;
27859 return this;
27860};
27861/**
27862 * Set format of binary response body.
27863 * In browser valid formats are 'blob' and 'arraybuffer',
27864 * which return Blob and ArrayBuffer, respectively.
27865 *
27866 * In Node all values result in Buffer.
27867 *
27868 * Examples:
27869 *
27870 * req.get('/')
27871 * .responseType('blob')
27872 * .end(callback);
27873 *
27874 * @param {String} val
27875 * @return {Request} for chaining
27876 * @api public
27877 */
27878
27879
27880RequestBase.prototype.responseType = function (val) {
27881 this._responseType = val;
27882 return this;
27883};
27884/**
27885 * Override default request body serializer
27886 *
27887 * This function will be called to convert data set via .send or .attach into payload to send
27888 *
27889 * @param {Function}
27890 * @api public
27891 */
27892
27893
27894RequestBase.prototype.serialize = function (fn) {
27895 this._serializer = fn;
27896 return this;
27897};
27898/**
27899 * Set timeouts.
27900 *
27901 * - response timeout is time between sending request and receiving the first byte of the response. Includes DNS and connection time.
27902 * - deadline is the time from start of the request to receiving response body in full. If the deadline is too short large files may not load at all on slow connections.
27903 * - upload is the time since last bit of data was sent or received. This timeout works only if deadline timeout is off
27904 *
27905 * Value of 0 or false means no timeout.
27906 *
27907 * @param {Number|Object} ms or {response, deadline}
27908 * @return {Request} for chaining
27909 * @api public
27910 */
27911
27912
27913RequestBase.prototype.timeout = function (options) {
27914 if (!options || _typeof(options) !== 'object') {
27915 this._timeout = options;
27916 this._responseTimeout = 0;
27917 this._uploadTimeout = 0;
27918 return this;
27919 }
27920
27921 for (var option in options) {
27922 if (Object.prototype.hasOwnProperty.call(options, option)) {
27923 switch (option) {
27924 case 'deadline':
27925 this._timeout = options.deadline;
27926 break;
27927
27928 case 'response':
27929 this._responseTimeout = options.response;
27930 break;
27931
27932 case 'upload':
27933 this._uploadTimeout = options.upload;
27934 break;
27935
27936 default:
27937 console.warn('Unknown timeout option', option);
27938 }
27939 }
27940 }
27941
27942 return this;
27943};
27944/**
27945 * Set number of retry attempts on error.
27946 *
27947 * Failed requests will be retried 'count' times if timeout or err.code >= 500.
27948 *
27949 * @param {Number} count
27950 * @param {Function} [fn]
27951 * @return {Request} for chaining
27952 * @api public
27953 */
27954
27955
27956RequestBase.prototype.retry = function (count, fn) {
27957 // Default to 1 if no count passed or true
27958 if (arguments.length === 0 || count === true) count = 1;
27959 if (count <= 0) count = 0;
27960 this._maxRetries = count;
27961 this._retries = 0;
27962 this._retryCallback = fn;
27963 return this;
27964};
27965
27966var ERROR_CODES = ['ECONNRESET', 'ETIMEDOUT', 'EADDRINFO', 'ESOCKETTIMEDOUT'];
27967/**
27968 * Determine if a request should be retried.
27969 * (Borrowed from segmentio/superagent-retry)
27970 *
27971 * @param {Error} err an error
27972 * @param {Response} [res] response
27973 * @returns {Boolean} if segment should be retried
27974 */
27975
27976RequestBase.prototype._shouldRetry = function (err, res) {
27977 if (!this._maxRetries || this._retries++ >= this._maxRetries) {
27978 return false;
27979 }
27980
27981 if (this._retryCallback) {
27982 try {
27983 var override = this._retryCallback(err, res);
27984
27985 if (override === true) return true;
27986 if (override === false) return false; // undefined falls back to defaults
27987 } catch (err_) {
27988 console.error(err_);
27989 }
27990 }
27991
27992 if (res && res.status && res.status >= 500 && res.status !== 501) return true;
27993
27994 if (err) {
27995 if (err.code && (0, _includes.default)(ERROR_CODES).call(ERROR_CODES, err.code)) return true; // Superagent timeout
27996
27997 if (err.timeout && err.code === 'ECONNABORTED') return true;
27998 if (err.crossDomain) return true;
27999 }
28000
28001 return false;
28002};
28003/**
28004 * Retry request
28005 *
28006 * @return {Request} for chaining
28007 * @api private
28008 */
28009
28010
28011RequestBase.prototype._retry = function () {
28012 this.clearTimeout(); // node
28013
28014 if (this.req) {
28015 this.req = null;
28016 this.req = this.request();
28017 }
28018
28019 this._aborted = false;
28020 this.timedout = false;
28021 this.timedoutError = null;
28022 return this._end();
28023};
28024/**
28025 * Promise support
28026 *
28027 * @param {Function} resolve
28028 * @param {Function} [reject]
28029 * @return {Request}
28030 */
28031
28032
28033RequestBase.prototype.then = function (resolve, reject) {
28034 var _this = this;
28035
28036 if (!this._fullfilledPromise) {
28037 var self = this;
28038
28039 if (this._endCalled) {
28040 console.warn('Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises');
28041 }
28042
28043 this._fullfilledPromise = new _promise.default(function (resolve, reject) {
28044 self.on('abort', function () {
28045 if (_this._maxRetries && _this._maxRetries > _this._retries) {
28046 return;
28047 }
28048
28049 if (_this.timedout && _this.timedoutError) {
28050 reject(_this.timedoutError);
28051 return;
28052 }
28053
28054 var err = new Error('Aborted');
28055 err.code = 'ABORTED';
28056 err.status = _this.status;
28057 err.method = _this.method;
28058 err.url = _this.url;
28059 reject(err);
28060 });
28061 self.end(function (err, res) {
28062 if (err) reject(err);else resolve(res);
28063 });
28064 });
28065 }
28066
28067 return this._fullfilledPromise.then(resolve, reject);
28068};
28069
28070RequestBase.prototype.catch = function (cb) {
28071 return this.then(undefined, cb);
28072};
28073/**
28074 * Allow for extension
28075 */
28076
28077
28078RequestBase.prototype.use = function (fn) {
28079 fn(this);
28080 return this;
28081};
28082
28083RequestBase.prototype.ok = function (cb) {
28084 if (typeof cb !== 'function') throw new Error('Callback required');
28085 this._okCallback = cb;
28086 return this;
28087};
28088
28089RequestBase.prototype._isResponseOK = function (res) {
28090 if (!res) {
28091 return false;
28092 }
28093
28094 if (this._okCallback) {
28095 return this._okCallback(res);
28096 }
28097
28098 return res.status >= 200 && res.status < 300;
28099};
28100/**
28101 * Get request header `field`.
28102 * Case-insensitive.
28103 *
28104 * @param {String} field
28105 * @return {String}
28106 * @api public
28107 */
28108
28109
28110RequestBase.prototype.get = function (field) {
28111 return this._header[field.toLowerCase()];
28112};
28113/**
28114 * Get case-insensitive header `field` value.
28115 * This is a deprecated internal API. Use `.get(field)` instead.
28116 *
28117 * (getHeader is no longer used internally by the superagent code base)
28118 *
28119 * @param {String} field
28120 * @return {String}
28121 * @api private
28122 * @deprecated
28123 */
28124
28125
28126RequestBase.prototype.getHeader = RequestBase.prototype.get;
28127/**
28128 * Set header `field` to `val`, or multiple fields with one object.
28129 * Case-insensitive.
28130 *
28131 * Examples:
28132 *
28133 * req.get('/')
28134 * .set('Accept', 'application/json')
28135 * .set('X-API-Key', 'foobar')
28136 * .end(callback);
28137 *
28138 * req.get('/')
28139 * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })
28140 * .end(callback);
28141 *
28142 * @param {String|Object} field
28143 * @param {String} val
28144 * @return {Request} for chaining
28145 * @api public
28146 */
28147
28148RequestBase.prototype.set = function (field, val) {
28149 if (isObject(field)) {
28150 for (var key in field) {
28151 if (Object.prototype.hasOwnProperty.call(field, key)) this.set(key, field[key]);
28152 }
28153
28154 return this;
28155 }
28156
28157 this._header[field.toLowerCase()] = val;
28158 this.header[field] = val;
28159 return this;
28160};
28161/**
28162 * Remove header `field`.
28163 * Case-insensitive.
28164 *
28165 * Example:
28166 *
28167 * req.get('/')
28168 * .unset('User-Agent')
28169 * .end(callback);
28170 *
28171 * @param {String} field field name
28172 */
28173
28174
28175RequestBase.prototype.unset = function (field) {
28176 delete this._header[field.toLowerCase()];
28177 delete this.header[field];
28178 return this;
28179};
28180/**
28181 * Write the field `name` and `val`, or multiple fields with one object
28182 * for "multipart/form-data" request bodies.
28183 *
28184 * ``` js
28185 * request.post('/upload')
28186 * .field('foo', 'bar')
28187 * .end(callback);
28188 *
28189 * request.post('/upload')
28190 * .field({ foo: 'bar', baz: 'qux' })
28191 * .end(callback);
28192 * ```
28193 *
28194 * @param {String|Object} name name of field
28195 * @param {String|Blob|File|Buffer|fs.ReadStream} val value of field
28196 * @return {Request} for chaining
28197 * @api public
28198 */
28199
28200
28201RequestBase.prototype.field = function (name, val) {
28202 // name should be either a string or an object.
28203 if (name === null || undefined === name) {
28204 throw new Error('.field(name, val) name can not be empty');
28205 }
28206
28207 if (this._data) {
28208 throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");
28209 }
28210
28211 if (isObject(name)) {
28212 for (var key in name) {
28213 if (Object.prototype.hasOwnProperty.call(name, key)) this.field(key, name[key]);
28214 }
28215
28216 return this;
28217 }
28218
28219 if (Array.isArray(val)) {
28220 for (var i in val) {
28221 if (Object.prototype.hasOwnProperty.call(val, i)) this.field(name, val[i]);
28222 }
28223
28224 return this;
28225 } // val should be defined now
28226
28227
28228 if (val === null || undefined === val) {
28229 throw new Error('.field(name, val) val can not be empty');
28230 }
28231
28232 if (typeof val === 'boolean') {
28233 val = String(val);
28234 }
28235
28236 this._getFormData().append(name, val);
28237
28238 return this;
28239};
28240/**
28241 * Abort the request, and clear potential timeout.
28242 *
28243 * @return {Request} request
28244 * @api public
28245 */
28246
28247
28248RequestBase.prototype.abort = function () {
28249 if (this._aborted) {
28250 return this;
28251 }
28252
28253 this._aborted = true;
28254 if (this.xhr) this.xhr.abort(); // browser
28255
28256 if (this.req) this.req.abort(); // node
28257
28258 this.clearTimeout();
28259 this.emit('abort');
28260 return this;
28261};
28262
28263RequestBase.prototype._auth = function (user, pass, options, base64Encoder) {
28264 var _context;
28265
28266 switch (options.type) {
28267 case 'basic':
28268 this.set('Authorization', "Basic ".concat(base64Encoder((0, _concat.default)(_context = "".concat(user, ":")).call(_context, pass))));
28269 break;
28270
28271 case 'auto':
28272 this.username = user;
28273 this.password = pass;
28274 break;
28275
28276 case 'bearer':
28277 // usage would be .auth(accessToken, { type: 'bearer' })
28278 this.set('Authorization', "Bearer ".concat(user));
28279 break;
28280
28281 default:
28282 break;
28283 }
28284
28285 return this;
28286};
28287/**
28288 * Enable transmission of cookies with x-domain requests.
28289 *
28290 * Note that for this to work the origin must not be
28291 * using "Access-Control-Allow-Origin" with a wildcard,
28292 * and also must set "Access-Control-Allow-Credentials"
28293 * to "true".
28294 *
28295 * @api public
28296 */
28297
28298
28299RequestBase.prototype.withCredentials = function (on) {
28300 // This is browser-only functionality. Node side is no-op.
28301 if (on === undefined) on = true;
28302 this._withCredentials = on;
28303 return this;
28304};
28305/**
28306 * Set the max redirects to `n`. Does nothing in browser XHR implementation.
28307 *
28308 * @param {Number} n
28309 * @return {Request} for chaining
28310 * @api public
28311 */
28312
28313
28314RequestBase.prototype.redirects = function (n) {
28315 this._maxRedirects = n;
28316 return this;
28317};
28318/**
28319 * Maximum size of buffered response body, in bytes. Counts uncompressed size.
28320 * Default 200MB.
28321 *
28322 * @param {Number} n number of bytes
28323 * @return {Request} for chaining
28324 */
28325
28326
28327RequestBase.prototype.maxResponseSize = function (n) {
28328 if (typeof n !== 'number') {
28329 throw new TypeError('Invalid argument');
28330 }
28331
28332 this._maxResponseSize = n;
28333 return this;
28334};
28335/**
28336 * Convert to a plain javascript object (not JSON string) of scalar properties.
28337 * Note as this method is designed to return a useful non-this value,
28338 * it cannot be chained.
28339 *
28340 * @return {Object} describing method, url, and data of this request
28341 * @api public
28342 */
28343
28344
28345RequestBase.prototype.toJSON = function () {
28346 return {
28347 method: this.method,
28348 url: this.url,
28349 data: this._data,
28350 headers: this._header
28351 };
28352};
28353/**
28354 * Send `data` as the request body, defaulting the `.type()` to "json" when
28355 * an object is given.
28356 *
28357 * Examples:
28358 *
28359 * // manual json
28360 * request.post('/user')
28361 * .type('json')
28362 * .send('{"name":"tj"}')
28363 * .end(callback)
28364 *
28365 * // auto json
28366 * request.post('/user')
28367 * .send({ name: 'tj' })
28368 * .end(callback)
28369 *
28370 * // manual x-www-form-urlencoded
28371 * request.post('/user')
28372 * .type('form')
28373 * .send('name=tj')
28374 * .end(callback)
28375 *
28376 * // auto x-www-form-urlencoded
28377 * request.post('/user')
28378 * .type('form')
28379 * .send({ name: 'tj' })
28380 * .end(callback)
28381 *
28382 * // defaults to x-www-form-urlencoded
28383 * request.post('/user')
28384 * .send('name=tobi')
28385 * .send('species=ferret')
28386 * .end(callback)
28387 *
28388 * @param {String|Object} data
28389 * @return {Request} for chaining
28390 * @api public
28391 */
28392// eslint-disable-next-line complexity
28393
28394
28395RequestBase.prototype.send = function (data) {
28396 var isObj = isObject(data);
28397 var type = this._header['content-type'];
28398
28399 if (this._formData) {
28400 throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");
28401 }
28402
28403 if (isObj && !this._data) {
28404 if (Array.isArray(data)) {
28405 this._data = [];
28406 } else if (!this._isHost(data)) {
28407 this._data = {};
28408 }
28409 } else if (data && this._data && this._isHost(this._data)) {
28410 throw new Error("Can't merge these send calls");
28411 } // merge
28412
28413
28414 if (isObj && isObject(this._data)) {
28415 for (var key in data) {
28416 if (Object.prototype.hasOwnProperty.call(data, key)) this._data[key] = data[key];
28417 }
28418 } else if (typeof data === 'string') {
28419 // default to x-www-form-urlencoded
28420 if (!type) this.type('form');
28421 type = this._header['content-type'];
28422
28423 if (type === 'application/x-www-form-urlencoded') {
28424 var _context2;
28425
28426 this._data = this._data ? (0, _concat.default)(_context2 = "".concat(this._data, "&")).call(_context2, data) : data;
28427 } else {
28428 this._data = (this._data || '') + data;
28429 }
28430 } else {
28431 this._data = data;
28432 }
28433
28434 if (!isObj || this._isHost(data)) {
28435 return this;
28436 } // default to json
28437
28438
28439 if (!type) this.type('json');
28440 return this;
28441};
28442/**
28443 * Sort `querystring` by the sort function
28444 *
28445 *
28446 * Examples:
28447 *
28448 * // default order
28449 * request.get('/user')
28450 * .query('name=Nick')
28451 * .query('search=Manny')
28452 * .sortQuery()
28453 * .end(callback)
28454 *
28455 * // customized sort function
28456 * request.get('/user')
28457 * .query('name=Nick')
28458 * .query('search=Manny')
28459 * .sortQuery(function(a, b){
28460 * return a.length - b.length;
28461 * })
28462 * .end(callback)
28463 *
28464 *
28465 * @param {Function} sort
28466 * @return {Request} for chaining
28467 * @api public
28468 */
28469
28470
28471RequestBase.prototype.sortQuery = function (sort) {
28472 // _sort default to true but otherwise can be a function or boolean
28473 this._sort = typeof sort === 'undefined' ? true : sort;
28474 return this;
28475};
28476/**
28477 * Compose querystring to append to req.url
28478 *
28479 * @api private
28480 */
28481
28482
28483RequestBase.prototype._finalizeQueryString = function () {
28484 var query = this._query.join('&');
28485
28486 if (query) {
28487 var _context3;
28488
28489 this.url += ((0, _includes.default)(_context3 = this.url).call(_context3, '?') ? '&' : '?') + query;
28490 }
28491
28492 this._query.length = 0; // Makes the call idempotent
28493
28494 if (this._sort) {
28495 var _context4;
28496
28497 var index = (0, _indexOf.default)(_context4 = this.url).call(_context4, '?');
28498
28499 if (index >= 0) {
28500 var _context5, _context6;
28501
28502 var queryArr = (0, _slice.default)(_context5 = this.url).call(_context5, index + 1).split('&');
28503
28504 if (typeof this._sort === 'function') {
28505 (0, _sort.default)(queryArr).call(queryArr, this._sort);
28506 } else {
28507 (0, _sort.default)(queryArr).call(queryArr);
28508 }
28509
28510 this.url = (0, _slice.default)(_context6 = this.url).call(_context6, 0, index) + '?' + queryArr.join('&');
28511 }
28512 }
28513}; // For backwards compat only
28514
28515
28516RequestBase.prototype._appendQueryString = function () {
28517 console.warn('Unsupported');
28518};
28519/**
28520 * Invoke callback with timeout error.
28521 *
28522 * @api private
28523 */
28524
28525
28526RequestBase.prototype._timeoutError = function (reason, timeout, errno) {
28527 if (this._aborted) {
28528 return;
28529 }
28530
28531 var err = new Error("".concat(reason + timeout, "ms exceeded"));
28532 err.timeout = timeout;
28533 err.code = 'ECONNABORTED';
28534 err.errno = errno;
28535 this.timedout = true;
28536 this.timedoutError = err;
28537 this.abort();
28538 this.callback(err);
28539};
28540
28541RequestBase.prototype._setTimeouts = function () {
28542 var self = this; // deadline
28543
28544 if (this._timeout && !this._timer) {
28545 this._timer = setTimeout(function () {
28546 self._timeoutError('Timeout of ', self._timeout, 'ETIME');
28547 }, this._timeout);
28548 } // response timeout
28549
28550
28551 if (this._responseTimeout && !this._responseTimeoutTimer) {
28552 this._responseTimeoutTimer = setTimeout(function () {
28553 self._timeoutError('Response timeout of ', self._responseTimeout, 'ETIMEDOUT');
28554 }, this._responseTimeout);
28555 }
28556};
28557
28558/***/ }),
28559/* 588 */
28560/***/ (function(module, exports, __webpack_require__) {
28561
28562module.exports = __webpack_require__(589);
28563
28564/***/ }),
28565/* 589 */
28566/***/ (function(module, exports, __webpack_require__) {
28567
28568var parent = __webpack_require__(590);
28569
28570module.exports = parent;
28571
28572
28573/***/ }),
28574/* 590 */
28575/***/ (function(module, exports, __webpack_require__) {
28576
28577var isPrototypeOf = __webpack_require__(16);
28578var arrayMethod = __webpack_require__(591);
28579var stringMethod = __webpack_require__(593);
28580
28581var ArrayPrototype = Array.prototype;
28582var StringPrototype = String.prototype;
28583
28584module.exports = function (it) {
28585 var own = it.includes;
28586 if (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.includes)) return arrayMethod;
28587 if (typeof it == 'string' || it === StringPrototype || (isPrototypeOf(StringPrototype, it) && own === StringPrototype.includes)) {
28588 return stringMethod;
28589 } return own;
28590};
28591
28592
28593/***/ }),
28594/* 591 */
28595/***/ (function(module, exports, __webpack_require__) {
28596
28597__webpack_require__(592);
28598var entryVirtual = __webpack_require__(27);
28599
28600module.exports = entryVirtual('Array').includes;
28601
28602
28603/***/ }),
28604/* 592 */
28605/***/ (function(module, exports, __webpack_require__) {
28606
28607"use strict";
28608
28609var $ = __webpack_require__(0);
28610var $includes = __webpack_require__(126).includes;
28611var fails = __webpack_require__(2);
28612var addToUnscopables = __webpack_require__(132);
28613
28614// FF99+ bug
28615var BROKEN_ON_SPARSE = fails(function () {
28616 return !Array(1).includes();
28617});
28618
28619// `Array.prototype.includes` method
28620// https://tc39.es/ecma262/#sec-array.prototype.includes
28621$({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
28622 includes: function includes(el /* , fromIndex = 0 */) {
28623 return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
28624 }
28625});
28626
28627// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
28628addToUnscopables('includes');
28629
28630
28631/***/ }),
28632/* 593 */
28633/***/ (function(module, exports, __webpack_require__) {
28634
28635__webpack_require__(594);
28636var entryVirtual = __webpack_require__(27);
28637
28638module.exports = entryVirtual('String').includes;
28639
28640
28641/***/ }),
28642/* 594 */
28643/***/ (function(module, exports, __webpack_require__) {
28644
28645"use strict";
28646
28647var $ = __webpack_require__(0);
28648var uncurryThis = __webpack_require__(4);
28649var notARegExp = __webpack_require__(595);
28650var requireObjectCoercible = __webpack_require__(81);
28651var toString = __webpack_require__(42);
28652var correctIsRegExpLogic = __webpack_require__(597);
28653
28654var stringIndexOf = uncurryThis(''.indexOf);
28655
28656// `String.prototype.includes` method
28657// https://tc39.es/ecma262/#sec-string.prototype.includes
28658$({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
28659 includes: function includes(searchString /* , position = 0 */) {
28660 return !!~stringIndexOf(
28661 toString(requireObjectCoercible(this)),
28662 toString(notARegExp(searchString)),
28663 arguments.length > 1 ? arguments[1] : undefined
28664 );
28665 }
28666});
28667
28668
28669/***/ }),
28670/* 595 */
28671/***/ (function(module, exports, __webpack_require__) {
28672
28673var isRegExp = __webpack_require__(596);
28674
28675var $TypeError = TypeError;
28676
28677module.exports = function (it) {
28678 if (isRegExp(it)) {
28679 throw $TypeError("The method doesn't accept regular expressions");
28680 } return it;
28681};
28682
28683
28684/***/ }),
28685/* 596 */
28686/***/ (function(module, exports, __webpack_require__) {
28687
28688var isObject = __webpack_require__(11);
28689var classof = __webpack_require__(50);
28690var wellKnownSymbol = __webpack_require__(5);
28691
28692var MATCH = wellKnownSymbol('match');
28693
28694// `IsRegExp` abstract operation
28695// https://tc39.es/ecma262/#sec-isregexp
28696module.exports = function (it) {
28697 var isRegExp;
28698 return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp');
28699};
28700
28701
28702/***/ }),
28703/* 597 */
28704/***/ (function(module, exports, __webpack_require__) {
28705
28706var wellKnownSymbol = __webpack_require__(5);
28707
28708var MATCH = wellKnownSymbol('match');
28709
28710module.exports = function (METHOD_NAME) {
28711 var regexp = /./;
28712 try {
28713 '/./'[METHOD_NAME](regexp);
28714 } catch (error1) {
28715 try {
28716 regexp[MATCH] = false;
28717 return '/./'[METHOD_NAME](regexp);
28718 } catch (error2) { /* empty */ }
28719 } return false;
28720};
28721
28722
28723/***/ }),
28724/* 598 */
28725/***/ (function(module, exports, __webpack_require__) {
28726
28727module.exports = __webpack_require__(599);
28728
28729/***/ }),
28730/* 599 */
28731/***/ (function(module, exports, __webpack_require__) {
28732
28733var parent = __webpack_require__(600);
28734
28735module.exports = parent;
28736
28737
28738/***/ }),
28739/* 600 */
28740/***/ (function(module, exports, __webpack_require__) {
28741
28742var isPrototypeOf = __webpack_require__(16);
28743var method = __webpack_require__(601);
28744
28745var ArrayPrototype = Array.prototype;
28746
28747module.exports = function (it) {
28748 var own = it.sort;
28749 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.sort) ? method : own;
28750};
28751
28752
28753/***/ }),
28754/* 601 */
28755/***/ (function(module, exports, __webpack_require__) {
28756
28757__webpack_require__(602);
28758var entryVirtual = __webpack_require__(27);
28759
28760module.exports = entryVirtual('Array').sort;
28761
28762
28763/***/ }),
28764/* 602 */
28765/***/ (function(module, exports, __webpack_require__) {
28766
28767"use strict";
28768
28769var $ = __webpack_require__(0);
28770var uncurryThis = __webpack_require__(4);
28771var aCallable = __webpack_require__(29);
28772var toObject = __webpack_require__(33);
28773var lengthOfArrayLike = __webpack_require__(40);
28774var deletePropertyOrThrow = __webpack_require__(603);
28775var toString = __webpack_require__(42);
28776var fails = __webpack_require__(2);
28777var internalSort = __webpack_require__(604);
28778var arrayMethodIsStrict = __webpack_require__(151);
28779var FF = __webpack_require__(605);
28780var IE_OR_EDGE = __webpack_require__(606);
28781var V8 = __webpack_require__(66);
28782var WEBKIT = __webpack_require__(607);
28783
28784var test = [];
28785var un$Sort = uncurryThis(test.sort);
28786var push = uncurryThis(test.push);
28787
28788// IE8-
28789var FAILS_ON_UNDEFINED = fails(function () {
28790 test.sort(undefined);
28791});
28792// V8 bug
28793var FAILS_ON_NULL = fails(function () {
28794 test.sort(null);
28795});
28796// Old WebKit
28797var STRICT_METHOD = arrayMethodIsStrict('sort');
28798
28799var STABLE_SORT = !fails(function () {
28800 // feature detection can be too slow, so check engines versions
28801 if (V8) return V8 < 70;
28802 if (FF && FF > 3) return;
28803 if (IE_OR_EDGE) return true;
28804 if (WEBKIT) return WEBKIT < 603;
28805
28806 var result = '';
28807 var code, chr, value, index;
28808
28809 // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
28810 for (code = 65; code < 76; code++) {
28811 chr = String.fromCharCode(code);
28812
28813 switch (code) {
28814 case 66: case 69: case 70: case 72: value = 3; break;
28815 case 68: case 71: value = 4; break;
28816 default: value = 2;
28817 }
28818
28819 for (index = 0; index < 47; index++) {
28820 test.push({ k: chr + index, v: value });
28821 }
28822 }
28823
28824 test.sort(function (a, b) { return b.v - a.v; });
28825
28826 for (index = 0; index < test.length; index++) {
28827 chr = test[index].k.charAt(0);
28828 if (result.charAt(result.length - 1) !== chr) result += chr;
28829 }
28830
28831 return result !== 'DGBEFHACIJK';
28832});
28833
28834var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
28835
28836var getSortCompare = function (comparefn) {
28837 return function (x, y) {
28838 if (y === undefined) return -1;
28839 if (x === undefined) return 1;
28840 if (comparefn !== undefined) return +comparefn(x, y) || 0;
28841 return toString(x) > toString(y) ? 1 : -1;
28842 };
28843};
28844
28845// `Array.prototype.sort` method
28846// https://tc39.es/ecma262/#sec-array.prototype.sort
28847$({ target: 'Array', proto: true, forced: FORCED }, {
28848 sort: function sort(comparefn) {
28849 if (comparefn !== undefined) aCallable(comparefn);
28850
28851 var array = toObject(this);
28852
28853 if (STABLE_SORT) return comparefn === undefined ? un$Sort(array) : un$Sort(array, comparefn);
28854
28855 var items = [];
28856 var arrayLength = lengthOfArrayLike(array);
28857 var itemsLength, index;
28858
28859 for (index = 0; index < arrayLength; index++) {
28860 if (index in array) push(items, array[index]);
28861 }
28862
28863 internalSort(items, getSortCompare(comparefn));
28864
28865 itemsLength = items.length;
28866 index = 0;
28867
28868 while (index < itemsLength) array[index] = items[index++];
28869 while (index < arrayLength) deletePropertyOrThrow(array, index++);
28870
28871 return array;
28872 }
28873});
28874
28875
28876/***/ }),
28877/* 603 */
28878/***/ (function(module, exports, __webpack_require__) {
28879
28880"use strict";
28881
28882var tryToString = __webpack_require__(67);
28883
28884var $TypeError = TypeError;
28885
28886module.exports = function (O, P) {
28887 if (!delete O[P]) throw $TypeError('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
28888};
28889
28890
28891/***/ }),
28892/* 604 */
28893/***/ (function(module, exports, __webpack_require__) {
28894
28895var arraySlice = __webpack_require__(245);
28896
28897var floor = Math.floor;
28898
28899var mergeSort = function (array, comparefn) {
28900 var length = array.length;
28901 var middle = floor(length / 2);
28902 return length < 8 ? insertionSort(array, comparefn) : merge(
28903 array,
28904 mergeSort(arraySlice(array, 0, middle), comparefn),
28905 mergeSort(arraySlice(array, middle), comparefn),
28906 comparefn
28907 );
28908};
28909
28910var insertionSort = function (array, comparefn) {
28911 var length = array.length;
28912 var i = 1;
28913 var element, j;
28914
28915 while (i < length) {
28916 j = i;
28917 element = array[i];
28918 while (j && comparefn(array[j - 1], element) > 0) {
28919 array[j] = array[--j];
28920 }
28921 if (j !== i++) array[j] = element;
28922 } return array;
28923};
28924
28925var merge = function (array, left, right, comparefn) {
28926 var llength = left.length;
28927 var rlength = right.length;
28928 var lindex = 0;
28929 var rindex = 0;
28930
28931 while (lindex < llength || rindex < rlength) {
28932 array[lindex + rindex] = (lindex < llength && rindex < rlength)
28933 ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
28934 : lindex < llength ? left[lindex++] : right[rindex++];
28935 } return array;
28936};
28937
28938module.exports = mergeSort;
28939
28940
28941/***/ }),
28942/* 605 */
28943/***/ (function(module, exports, __webpack_require__) {
28944
28945var userAgent = __webpack_require__(51);
28946
28947var firefox = userAgent.match(/firefox\/(\d+)/i);
28948
28949module.exports = !!firefox && +firefox[1];
28950
28951
28952/***/ }),
28953/* 606 */
28954/***/ (function(module, exports, __webpack_require__) {
28955
28956var UA = __webpack_require__(51);
28957
28958module.exports = /MSIE|Trident/.test(UA);
28959
28960
28961/***/ }),
28962/* 607 */
28963/***/ (function(module, exports, __webpack_require__) {
28964
28965var userAgent = __webpack_require__(51);
28966
28967var webkit = userAgent.match(/AppleWebKit\/(\d+)\./);
28968
28969module.exports = !!webkit && +webkit[1];
28970
28971
28972/***/ }),
28973/* 608 */
28974/***/ (function(module, exports, __webpack_require__) {
28975
28976"use strict";
28977
28978/**
28979 * Module dependencies.
28980 */
28981
28982var utils = __webpack_require__(609);
28983/**
28984 * Expose `ResponseBase`.
28985 */
28986
28987
28988module.exports = ResponseBase;
28989/**
28990 * Initialize a new `ResponseBase`.
28991 *
28992 * @api public
28993 */
28994
28995function ResponseBase(obj) {
28996 if (obj) return mixin(obj);
28997}
28998/**
28999 * Mixin the prototype properties.
29000 *
29001 * @param {Object} obj
29002 * @return {Object}
29003 * @api private
29004 */
29005
29006
29007function mixin(obj) {
29008 for (var key in ResponseBase.prototype) {
29009 if (Object.prototype.hasOwnProperty.call(ResponseBase.prototype, key)) obj[key] = ResponseBase.prototype[key];
29010 }
29011
29012 return obj;
29013}
29014/**
29015 * Get case-insensitive `field` value.
29016 *
29017 * @param {String} field
29018 * @return {String}
29019 * @api public
29020 */
29021
29022
29023ResponseBase.prototype.get = function (field) {
29024 return this.header[field.toLowerCase()];
29025};
29026/**
29027 * Set header related properties:
29028 *
29029 * - `.type` the content type without params
29030 *
29031 * A response of "Content-Type: text/plain; charset=utf-8"
29032 * will provide you with a `.type` of "text/plain".
29033 *
29034 * @param {Object} header
29035 * @api private
29036 */
29037
29038
29039ResponseBase.prototype._setHeaderProperties = function (header) {
29040 // TODO: moar!
29041 // TODO: make this a util
29042 // content-type
29043 var ct = header['content-type'] || '';
29044 this.type = utils.type(ct); // params
29045
29046 var params = utils.params(ct);
29047
29048 for (var key in params) {
29049 if (Object.prototype.hasOwnProperty.call(params, key)) this[key] = params[key];
29050 }
29051
29052 this.links = {}; // links
29053
29054 try {
29055 if (header.link) {
29056 this.links = utils.parseLinks(header.link);
29057 }
29058 } catch (_unused) {// ignore
29059 }
29060};
29061/**
29062 * Set flags such as `.ok` based on `status`.
29063 *
29064 * For example a 2xx response will give you a `.ok` of __true__
29065 * whereas 5xx will be __false__ and `.error` will be __true__. The
29066 * `.clientError` and `.serverError` are also available to be more
29067 * specific, and `.statusType` is the class of error ranging from 1..5
29068 * sometimes useful for mapping respond colors etc.
29069 *
29070 * "sugar" properties are also defined for common cases. Currently providing:
29071 *
29072 * - .noContent
29073 * - .badRequest
29074 * - .unauthorized
29075 * - .notAcceptable
29076 * - .notFound
29077 *
29078 * @param {Number} status
29079 * @api private
29080 */
29081
29082
29083ResponseBase.prototype._setStatusProperties = function (status) {
29084 var type = status / 100 | 0; // status / class
29085
29086 this.statusCode = status;
29087 this.status = this.statusCode;
29088 this.statusType = type; // basics
29089
29090 this.info = type === 1;
29091 this.ok = type === 2;
29092 this.redirect = type === 3;
29093 this.clientError = type === 4;
29094 this.serverError = type === 5;
29095 this.error = type === 4 || type === 5 ? this.toError() : false; // sugar
29096
29097 this.created = status === 201;
29098 this.accepted = status === 202;
29099 this.noContent = status === 204;
29100 this.badRequest = status === 400;
29101 this.unauthorized = status === 401;
29102 this.notAcceptable = status === 406;
29103 this.forbidden = status === 403;
29104 this.notFound = status === 404;
29105 this.unprocessableEntity = status === 422;
29106};
29107
29108/***/ }),
29109/* 609 */
29110/***/ (function(module, exports, __webpack_require__) {
29111
29112"use strict";
29113
29114/**
29115 * Return the mime type for the given `str`.
29116 *
29117 * @param {String} str
29118 * @return {String}
29119 * @api private
29120 */
29121
29122var _interopRequireDefault = __webpack_require__(1);
29123
29124var _reduce = _interopRequireDefault(__webpack_require__(262));
29125
29126var _slice = _interopRequireDefault(__webpack_require__(34));
29127
29128exports.type = function (str) {
29129 return str.split(/ *; */).shift();
29130};
29131/**
29132 * Return header field parameters.
29133 *
29134 * @param {String} str
29135 * @return {Object}
29136 * @api private
29137 */
29138
29139
29140exports.params = function (str) {
29141 var _context;
29142
29143 return (0, _reduce.default)(_context = str.split(/ *; */)).call(_context, function (obj, str) {
29144 var parts = str.split(/ *= */);
29145 var key = parts.shift();
29146 var val = parts.shift();
29147 if (key && val) obj[key] = val;
29148 return obj;
29149 }, {});
29150};
29151/**
29152 * Parse Link header fields.
29153 *
29154 * @param {String} str
29155 * @return {Object}
29156 * @api private
29157 */
29158
29159
29160exports.parseLinks = function (str) {
29161 var _context2;
29162
29163 return (0, _reduce.default)(_context2 = str.split(/ *, */)).call(_context2, function (obj, str) {
29164 var _context3, _context4;
29165
29166 var parts = str.split(/ *; */);
29167 var url = (0, _slice.default)(_context3 = parts[0]).call(_context3, 1, -1);
29168 var rel = (0, _slice.default)(_context4 = parts[1].split(/ *= */)[1]).call(_context4, 1, -1);
29169 obj[rel] = url;
29170 return obj;
29171 }, {});
29172};
29173/**
29174 * Strip content related fields from `header`.
29175 *
29176 * @param {Object} header
29177 * @return {Object} header
29178 * @api private
29179 */
29180
29181
29182exports.cleanHeader = function (header, changesOrigin) {
29183 delete header['content-type'];
29184 delete header['content-length'];
29185 delete header['transfer-encoding'];
29186 delete header.host; // secuirty
29187
29188 if (changesOrigin) {
29189 delete header.authorization;
29190 delete header.cookie;
29191 }
29192
29193 return header;
29194};
29195
29196/***/ }),
29197/* 610 */
29198/***/ (function(module, exports, __webpack_require__) {
29199
29200var parent = __webpack_require__(611);
29201
29202module.exports = parent;
29203
29204
29205/***/ }),
29206/* 611 */
29207/***/ (function(module, exports, __webpack_require__) {
29208
29209var isPrototypeOf = __webpack_require__(16);
29210var method = __webpack_require__(612);
29211
29212var ArrayPrototype = Array.prototype;
29213
29214module.exports = function (it) {
29215 var own = it.reduce;
29216 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.reduce) ? method : own;
29217};
29218
29219
29220/***/ }),
29221/* 612 */
29222/***/ (function(module, exports, __webpack_require__) {
29223
29224__webpack_require__(613);
29225var entryVirtual = __webpack_require__(27);
29226
29227module.exports = entryVirtual('Array').reduce;
29228
29229
29230/***/ }),
29231/* 613 */
29232/***/ (function(module, exports, __webpack_require__) {
29233
29234"use strict";
29235
29236var $ = __webpack_require__(0);
29237var $reduce = __webpack_require__(614).left;
29238var arrayMethodIsStrict = __webpack_require__(151);
29239var CHROME_VERSION = __webpack_require__(66);
29240var IS_NODE = __webpack_require__(109);
29241
29242var STRICT_METHOD = arrayMethodIsStrict('reduce');
29243// Chrome 80-82 has a critical bug
29244// https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
29245var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
29246
29247// `Array.prototype.reduce` method
29248// https://tc39.es/ecma262/#sec-array.prototype.reduce
29249$({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
29250 reduce: function reduce(callbackfn /* , initialValue */) {
29251 var length = arguments.length;
29252 return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
29253 }
29254});
29255
29256
29257/***/ }),
29258/* 614 */
29259/***/ (function(module, exports, __webpack_require__) {
29260
29261var aCallable = __webpack_require__(29);
29262var toObject = __webpack_require__(33);
29263var IndexedObject = __webpack_require__(98);
29264var lengthOfArrayLike = __webpack_require__(40);
29265
29266var $TypeError = TypeError;
29267
29268// `Array.prototype.{ reduce, reduceRight }` methods implementation
29269var createMethod = function (IS_RIGHT) {
29270 return function (that, callbackfn, argumentsLength, memo) {
29271 aCallable(callbackfn);
29272 var O = toObject(that);
29273 var self = IndexedObject(O);
29274 var length = lengthOfArrayLike(O);
29275 var index = IS_RIGHT ? length - 1 : 0;
29276 var i = IS_RIGHT ? -1 : 1;
29277 if (argumentsLength < 2) while (true) {
29278 if (index in self) {
29279 memo = self[index];
29280 index += i;
29281 break;
29282 }
29283 index += i;
29284 if (IS_RIGHT ? index < 0 : length <= index) {
29285 throw $TypeError('Reduce of empty array with no initial value');
29286 }
29287 }
29288 for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
29289 memo = callbackfn(memo, self[index], index, O);
29290 }
29291 return memo;
29292 };
29293};
29294
29295module.exports = {
29296 // `Array.prototype.reduce` method
29297 // https://tc39.es/ecma262/#sec-array.prototype.reduce
29298 left: createMethod(false),
29299 // `Array.prototype.reduceRight` method
29300 // https://tc39.es/ecma262/#sec-array.prototype.reduceright
29301 right: createMethod(true)
29302};
29303
29304
29305/***/ }),
29306/* 615 */
29307/***/ (function(module, exports, __webpack_require__) {
29308
29309"use strict";
29310
29311
29312var _interopRequireDefault = __webpack_require__(1);
29313
29314var _slice = _interopRequireDefault(__webpack_require__(34));
29315
29316var _from = _interopRequireDefault(__webpack_require__(153));
29317
29318var _symbol = _interopRequireDefault(__webpack_require__(77));
29319
29320var _isIterable2 = _interopRequireDefault(__webpack_require__(263));
29321
29322function _toConsumableArray(arr) {
29323 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
29324}
29325
29326function _nonIterableSpread() {
29327 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
29328}
29329
29330function _unsupportedIterableToArray(o, minLen) {
29331 var _context;
29332
29333 if (!o) return;
29334 if (typeof o === "string") return _arrayLikeToArray(o, minLen);
29335 var n = (0, _slice.default)(_context = Object.prototype.toString.call(o)).call(_context, 8, -1);
29336 if (n === "Object" && o.constructor) n = o.constructor.name;
29337 if (n === "Map" || n === "Set") return (0, _from.default)(o);
29338 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
29339}
29340
29341function _iterableToArray(iter) {
29342 if (typeof _symbol.default !== "undefined" && (0, _isIterable2.default)(Object(iter))) return (0, _from.default)(iter);
29343}
29344
29345function _arrayWithoutHoles(arr) {
29346 if (Array.isArray(arr)) return _arrayLikeToArray(arr);
29347}
29348
29349function _arrayLikeToArray(arr, len) {
29350 if (len == null || len > arr.length) len = arr.length;
29351
29352 for (var i = 0, arr2 = new Array(len); i < len; i++) {
29353 arr2[i] = arr[i];
29354 }
29355
29356 return arr2;
29357}
29358
29359function Agent() {
29360 this._defaults = [];
29361}
29362
29363['use', 'on', 'once', 'set', 'query', 'type', 'accept', 'auth', 'withCredentials', 'sortQuery', 'retry', 'ok', 'redirects', 'timeout', 'buffer', 'serialize', 'parse', 'ca', 'key', 'pfx', 'cert', 'disableTLSCerts'].forEach(function (fn) {
29364 // Default setting for all requests from this agent
29365 Agent.prototype[fn] = function () {
29366 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
29367 args[_key] = arguments[_key];
29368 }
29369
29370 this._defaults.push({
29371 fn: fn,
29372 args: args
29373 });
29374
29375 return this;
29376 };
29377});
29378
29379Agent.prototype._setDefaults = function (req) {
29380 this._defaults.forEach(function (def) {
29381 req[def.fn].apply(req, _toConsumableArray(def.args));
29382 });
29383};
29384
29385module.exports = Agent;
29386
29387/***/ }),
29388/* 616 */
29389/***/ (function(module, exports, __webpack_require__) {
29390
29391module.exports = __webpack_require__(617);
29392
29393
29394/***/ }),
29395/* 617 */
29396/***/ (function(module, exports, __webpack_require__) {
29397
29398var parent = __webpack_require__(618);
29399
29400module.exports = parent;
29401
29402
29403/***/ }),
29404/* 618 */
29405/***/ (function(module, exports, __webpack_require__) {
29406
29407var parent = __webpack_require__(619);
29408
29409module.exports = parent;
29410
29411
29412/***/ }),
29413/* 619 */
29414/***/ (function(module, exports, __webpack_require__) {
29415
29416var parent = __webpack_require__(620);
29417__webpack_require__(46);
29418
29419module.exports = parent;
29420
29421
29422/***/ }),
29423/* 620 */
29424/***/ (function(module, exports, __webpack_require__) {
29425
29426__webpack_require__(43);
29427__webpack_require__(70);
29428var isIterable = __webpack_require__(621);
29429
29430module.exports = isIterable;
29431
29432
29433/***/ }),
29434/* 621 */
29435/***/ (function(module, exports, __webpack_require__) {
29436
29437var classof = __webpack_require__(55);
29438var hasOwn = __webpack_require__(13);
29439var wellKnownSymbol = __webpack_require__(5);
29440var Iterators = __webpack_require__(54);
29441
29442var ITERATOR = wellKnownSymbol('iterator');
29443var $Object = Object;
29444
29445module.exports = function (it) {
29446 var O = $Object(it);
29447 return O[ITERATOR] !== undefined
29448 || '@@iterator' in O
29449 || hasOwn(Iterators, classof(O));
29450};
29451
29452
29453/***/ }),
29454/* 622 */
29455/***/ (function(module, exports, __webpack_require__) {
29456
29457"use strict";
29458
29459
29460var _require = __webpack_require__(156),
29461 Realtime = _require.Realtime,
29462 setRTMAdapters = _require.setAdapters;
29463
29464var _require2 = __webpack_require__(707),
29465 LiveQueryPlugin = _require2.LiveQueryPlugin;
29466
29467Realtime.__preRegisteredPlugins = [LiveQueryPlugin];
29468
29469module.exports = function (AV) {
29470 AV._sharedConfig.liveQueryRealtime = Realtime;
29471 var setAdapters = AV.setAdapters;
29472
29473 AV.setAdapters = function (adapters) {
29474 setAdapters(adapters);
29475 setRTMAdapters(adapters);
29476 };
29477
29478 return AV;
29479};
29480
29481/***/ }),
29482/* 623 */
29483/***/ (function(module, exports, __webpack_require__) {
29484
29485"use strict";
29486/* WEBPACK VAR INJECTION */(function(global) {
29487
29488var _interopRequireDefault = __webpack_require__(1);
29489
29490var _typeof3 = _interopRequireDefault(__webpack_require__(95));
29491
29492var _defineProperty2 = _interopRequireDefault(__webpack_require__(94));
29493
29494var _freeze = _interopRequireDefault(__webpack_require__(624));
29495
29496var _assign = _interopRequireDefault(__webpack_require__(266));
29497
29498var _symbol = _interopRequireDefault(__webpack_require__(77));
29499
29500var _concat = _interopRequireDefault(__webpack_require__(19));
29501
29502var _keys = _interopRequireDefault(__webpack_require__(150));
29503
29504var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(267));
29505
29506var _filter = _interopRequireDefault(__webpack_require__(250));
29507
29508var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(258));
29509
29510var _getOwnPropertyDescriptors = _interopRequireDefault(__webpack_require__(635));
29511
29512var _defineProperties = _interopRequireDefault(__webpack_require__(639));
29513
29514var _promise = _interopRequireDefault(__webpack_require__(12));
29515
29516var _slice = _interopRequireDefault(__webpack_require__(34));
29517
29518var _indexOf = _interopRequireDefault(__webpack_require__(61));
29519
29520var _weakMap = _interopRequireDefault(__webpack_require__(643));
29521
29522var _stringify = _interopRequireDefault(__webpack_require__(38));
29523
29524var _map = _interopRequireDefault(__webpack_require__(37));
29525
29526var _reduce = _interopRequireDefault(__webpack_require__(262));
29527
29528var _find = _interopRequireDefault(__webpack_require__(96));
29529
29530var _set = _interopRequireDefault(__webpack_require__(269));
29531
29532var _context6, _context15;
29533
29534(0, _defineProperty2.default)(exports, '__esModule', {
29535 value: true
29536});
29537
29538function _interopDefault(ex) {
29539 return ex && (0, _typeof3.default)(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
29540}
29541
29542var protobufLight = _interopDefault(__webpack_require__(654));
29543
29544var EventEmitter = _interopDefault(__webpack_require__(658));
29545
29546var _asyncToGenerator = _interopDefault(__webpack_require__(659));
29547
29548var _toConsumableArray = _interopDefault(__webpack_require__(660));
29549
29550var _defineProperty = _interopDefault(__webpack_require__(663));
29551
29552var _objectWithoutProperties = _interopDefault(__webpack_require__(665));
29553
29554var _assertThisInitialized = _interopDefault(__webpack_require__(667));
29555
29556var _inheritsLoose = _interopDefault(__webpack_require__(668));
29557
29558var _regeneratorRuntime = _interopDefault(__webpack_require__(670));
29559
29560var d = _interopDefault(__webpack_require__(63));
29561
29562var shuffle = _interopDefault(__webpack_require__(672));
29563
29564var values = _interopDefault(__webpack_require__(275));
29565
29566var _toArray = _interopDefault(__webpack_require__(699));
29567
29568var _createClass = _interopDefault(__webpack_require__(702));
29569
29570var _applyDecoratedDescriptor = _interopDefault(__webpack_require__(703));
29571
29572var StateMachine = _interopDefault(__webpack_require__(704));
29573
29574var _typeof = _interopDefault(__webpack_require__(119));
29575
29576var isPlainObject = _interopDefault(__webpack_require__(705));
29577
29578var promiseTimeout = __webpack_require__(251);
29579
29580var messageCompiled = protobufLight.newBuilder({})['import']({
29581 "package": 'push_server.messages2',
29582 syntax: 'proto2',
29583 options: {
29584 objc_class_prefix: 'AVIM'
29585 },
29586 messages: [{
29587 name: 'JsonObjectMessage',
29588 syntax: 'proto2',
29589 fields: [{
29590 rule: 'required',
29591 type: 'string',
29592 name: 'data',
29593 id: 1
29594 }]
29595 }, {
29596 name: 'UnreadTuple',
29597 syntax: 'proto2',
29598 fields: [{
29599 rule: 'required',
29600 type: 'string',
29601 name: 'cid',
29602 id: 1
29603 }, {
29604 rule: 'required',
29605 type: 'int32',
29606 name: 'unread',
29607 id: 2
29608 }, {
29609 rule: 'optional',
29610 type: 'string',
29611 name: 'mid',
29612 id: 3
29613 }, {
29614 rule: 'optional',
29615 type: 'int64',
29616 name: 'timestamp',
29617 id: 4
29618 }, {
29619 rule: 'optional',
29620 type: 'string',
29621 name: 'from',
29622 id: 5
29623 }, {
29624 rule: 'optional',
29625 type: 'string',
29626 name: 'data',
29627 id: 6
29628 }, {
29629 rule: 'optional',
29630 type: 'int64',
29631 name: 'patchTimestamp',
29632 id: 7
29633 }, {
29634 rule: 'optional',
29635 type: 'bool',
29636 name: 'mentioned',
29637 id: 8
29638 }, {
29639 rule: 'optional',
29640 type: 'bytes',
29641 name: 'binaryMsg',
29642 id: 9
29643 }, {
29644 rule: 'optional',
29645 type: 'int32',
29646 name: 'convType',
29647 id: 10
29648 }]
29649 }, {
29650 name: 'LogItem',
29651 syntax: 'proto2',
29652 fields: [{
29653 rule: 'optional',
29654 type: 'string',
29655 name: 'from',
29656 id: 1
29657 }, {
29658 rule: 'optional',
29659 type: 'string',
29660 name: 'data',
29661 id: 2
29662 }, {
29663 rule: 'optional',
29664 type: 'int64',
29665 name: 'timestamp',
29666 id: 3
29667 }, {
29668 rule: 'optional',
29669 type: 'string',
29670 name: 'msgId',
29671 id: 4
29672 }, {
29673 rule: 'optional',
29674 type: 'int64',
29675 name: 'ackAt',
29676 id: 5
29677 }, {
29678 rule: 'optional',
29679 type: 'int64',
29680 name: 'readAt',
29681 id: 6
29682 }, {
29683 rule: 'optional',
29684 type: 'int64',
29685 name: 'patchTimestamp',
29686 id: 7
29687 }, {
29688 rule: 'optional',
29689 type: 'bool',
29690 name: 'mentionAll',
29691 id: 8
29692 }, {
29693 rule: 'repeated',
29694 type: 'string',
29695 name: 'mentionPids',
29696 id: 9
29697 }, {
29698 rule: 'optional',
29699 type: 'bool',
29700 name: 'bin',
29701 id: 10
29702 }, {
29703 rule: 'optional',
29704 type: 'int32',
29705 name: 'convType',
29706 id: 11
29707 }]
29708 }, {
29709 name: 'ConvMemberInfo',
29710 syntax: 'proto2',
29711 fields: [{
29712 rule: 'optional',
29713 type: 'string',
29714 name: 'pid',
29715 id: 1
29716 }, {
29717 rule: 'optional',
29718 type: 'string',
29719 name: 'role',
29720 id: 2
29721 }, {
29722 rule: 'optional',
29723 type: 'string',
29724 name: 'infoId',
29725 id: 3
29726 }]
29727 }, {
29728 name: 'DataCommand',
29729 syntax: 'proto2',
29730 fields: [{
29731 rule: 'repeated',
29732 type: 'string',
29733 name: 'ids',
29734 id: 1
29735 }, {
29736 rule: 'repeated',
29737 type: 'JsonObjectMessage',
29738 name: 'msg',
29739 id: 2
29740 }, {
29741 rule: 'optional',
29742 type: 'bool',
29743 name: 'offline',
29744 id: 3
29745 }]
29746 }, {
29747 name: 'SessionCommand',
29748 syntax: 'proto2',
29749 fields: [{
29750 rule: 'optional',
29751 type: 'int64',
29752 name: 't',
29753 id: 1
29754 }, {
29755 rule: 'optional',
29756 type: 'string',
29757 name: 'n',
29758 id: 2
29759 }, {
29760 rule: 'optional',
29761 type: 'string',
29762 name: 's',
29763 id: 3
29764 }, {
29765 rule: 'optional',
29766 type: 'string',
29767 name: 'ua',
29768 id: 4
29769 }, {
29770 rule: 'optional',
29771 type: 'bool',
29772 name: 'r',
29773 id: 5
29774 }, {
29775 rule: 'optional',
29776 type: 'string',
29777 name: 'tag',
29778 id: 6
29779 }, {
29780 rule: 'optional',
29781 type: 'string',
29782 name: 'deviceId',
29783 id: 7
29784 }, {
29785 rule: 'repeated',
29786 type: 'string',
29787 name: 'sessionPeerIds',
29788 id: 8
29789 }, {
29790 rule: 'repeated',
29791 type: 'string',
29792 name: 'onlineSessionPeerIds',
29793 id: 9
29794 }, {
29795 rule: 'optional',
29796 type: 'string',
29797 name: 'st',
29798 id: 10
29799 }, {
29800 rule: 'optional',
29801 type: 'int32',
29802 name: 'stTtl',
29803 id: 11
29804 }, {
29805 rule: 'optional',
29806 type: 'int32',
29807 name: 'code',
29808 id: 12
29809 }, {
29810 rule: 'optional',
29811 type: 'string',
29812 name: 'reason',
29813 id: 13
29814 }, {
29815 rule: 'optional',
29816 type: 'string',
29817 name: 'deviceToken',
29818 id: 14
29819 }, {
29820 rule: 'optional',
29821 type: 'bool',
29822 name: 'sp',
29823 id: 15
29824 }, {
29825 rule: 'optional',
29826 type: 'string',
29827 name: 'detail',
29828 id: 16
29829 }, {
29830 rule: 'optional',
29831 type: 'int64',
29832 name: 'lastUnreadNotifTime',
29833 id: 17
29834 }, {
29835 rule: 'optional',
29836 type: 'int64',
29837 name: 'lastPatchTime',
29838 id: 18
29839 }, {
29840 rule: 'optional',
29841 type: 'int64',
29842 name: 'configBitmap',
29843 id: 19
29844 }]
29845 }, {
29846 name: 'ErrorCommand',
29847 syntax: 'proto2',
29848 fields: [{
29849 rule: 'required',
29850 type: 'int32',
29851 name: 'code',
29852 id: 1
29853 }, {
29854 rule: 'required',
29855 type: 'string',
29856 name: 'reason',
29857 id: 2
29858 }, {
29859 rule: 'optional',
29860 type: 'int32',
29861 name: 'appCode',
29862 id: 3
29863 }, {
29864 rule: 'optional',
29865 type: 'string',
29866 name: 'detail',
29867 id: 4
29868 }, {
29869 rule: 'repeated',
29870 type: 'string',
29871 name: 'pids',
29872 id: 5
29873 }, {
29874 rule: 'optional',
29875 type: 'string',
29876 name: 'appMsg',
29877 id: 6
29878 }]
29879 }, {
29880 name: 'DirectCommand',
29881 syntax: 'proto2',
29882 fields: [{
29883 rule: 'optional',
29884 type: 'string',
29885 name: 'msg',
29886 id: 1
29887 }, {
29888 rule: 'optional',
29889 type: 'string',
29890 name: 'uid',
29891 id: 2
29892 }, {
29893 rule: 'optional',
29894 type: 'string',
29895 name: 'fromPeerId',
29896 id: 3
29897 }, {
29898 rule: 'optional',
29899 type: 'int64',
29900 name: 'timestamp',
29901 id: 4
29902 }, {
29903 rule: 'optional',
29904 type: 'bool',
29905 name: 'offline',
29906 id: 5
29907 }, {
29908 rule: 'optional',
29909 type: 'bool',
29910 name: 'hasMore',
29911 id: 6
29912 }, {
29913 rule: 'repeated',
29914 type: 'string',
29915 name: 'toPeerIds',
29916 id: 7
29917 }, {
29918 rule: 'optional',
29919 type: 'bool',
29920 name: 'r',
29921 id: 10
29922 }, {
29923 rule: 'optional',
29924 type: 'string',
29925 name: 'cid',
29926 id: 11
29927 }, {
29928 rule: 'optional',
29929 type: 'string',
29930 name: 'id',
29931 id: 12
29932 }, {
29933 rule: 'optional',
29934 type: 'bool',
29935 name: 'transient',
29936 id: 13
29937 }, {
29938 rule: 'optional',
29939 type: 'string',
29940 name: 'dt',
29941 id: 14
29942 }, {
29943 rule: 'optional',
29944 type: 'string',
29945 name: 'roomId',
29946 id: 15
29947 }, {
29948 rule: 'optional',
29949 type: 'string',
29950 name: 'pushData',
29951 id: 16
29952 }, {
29953 rule: 'optional',
29954 type: 'bool',
29955 name: 'will',
29956 id: 17
29957 }, {
29958 rule: 'optional',
29959 type: 'int64',
29960 name: 'patchTimestamp',
29961 id: 18
29962 }, {
29963 rule: 'optional',
29964 type: 'bytes',
29965 name: 'binaryMsg',
29966 id: 19
29967 }, {
29968 rule: 'repeated',
29969 type: 'string',
29970 name: 'mentionPids',
29971 id: 20
29972 }, {
29973 rule: 'optional',
29974 type: 'bool',
29975 name: 'mentionAll',
29976 id: 21
29977 }, {
29978 rule: 'optional',
29979 type: 'int32',
29980 name: 'convType',
29981 id: 22
29982 }]
29983 }, {
29984 name: 'AckCommand',
29985 syntax: 'proto2',
29986 fields: [{
29987 rule: 'optional',
29988 type: 'int32',
29989 name: 'code',
29990 id: 1
29991 }, {
29992 rule: 'optional',
29993 type: 'string',
29994 name: 'reason',
29995 id: 2
29996 }, {
29997 rule: 'optional',
29998 type: 'string',
29999 name: 'mid',
30000 id: 3
30001 }, {
30002 rule: 'optional',
30003 type: 'string',
30004 name: 'cid',
30005 id: 4
30006 }, {
30007 rule: 'optional',
30008 type: 'int64',
30009 name: 't',
30010 id: 5
30011 }, {
30012 rule: 'optional',
30013 type: 'string',
30014 name: 'uid',
30015 id: 6
30016 }, {
30017 rule: 'optional',
30018 type: 'int64',
30019 name: 'fromts',
30020 id: 7
30021 }, {
30022 rule: 'optional',
30023 type: 'int64',
30024 name: 'tots',
30025 id: 8
30026 }, {
30027 rule: 'optional',
30028 type: 'string',
30029 name: 'type',
30030 id: 9
30031 }, {
30032 rule: 'repeated',
30033 type: 'string',
30034 name: 'ids',
30035 id: 10
30036 }, {
30037 rule: 'optional',
30038 type: 'int32',
30039 name: 'appCode',
30040 id: 11
30041 }, {
30042 rule: 'optional',
30043 type: 'string',
30044 name: 'appMsg',
30045 id: 12
30046 }]
30047 }, {
30048 name: 'UnreadCommand',
30049 syntax: 'proto2',
30050 fields: [{
30051 rule: 'repeated',
30052 type: 'UnreadTuple',
30053 name: 'convs',
30054 id: 1
30055 }, {
30056 rule: 'optional',
30057 type: 'int64',
30058 name: 'notifTime',
30059 id: 2
30060 }]
30061 }, {
30062 name: 'ConvCommand',
30063 syntax: 'proto2',
30064 fields: [{
30065 rule: 'repeated',
30066 type: 'string',
30067 name: 'm',
30068 id: 1
30069 }, {
30070 rule: 'optional',
30071 type: 'bool',
30072 name: 'transient',
30073 id: 2
30074 }, {
30075 rule: 'optional',
30076 type: 'bool',
30077 name: 'unique',
30078 id: 3
30079 }, {
30080 rule: 'optional',
30081 type: 'string',
30082 name: 'cid',
30083 id: 4
30084 }, {
30085 rule: 'optional',
30086 type: 'string',
30087 name: 'cdate',
30088 id: 5
30089 }, {
30090 rule: 'optional',
30091 type: 'string',
30092 name: 'initBy',
30093 id: 6
30094 }, {
30095 rule: 'optional',
30096 type: 'string',
30097 name: 'sort',
30098 id: 7
30099 }, {
30100 rule: 'optional',
30101 type: 'int32',
30102 name: 'limit',
30103 id: 8
30104 }, {
30105 rule: 'optional',
30106 type: 'int32',
30107 name: 'skip',
30108 id: 9
30109 }, {
30110 rule: 'optional',
30111 type: 'int32',
30112 name: 'flag',
30113 id: 10
30114 }, {
30115 rule: 'optional',
30116 type: 'int32',
30117 name: 'count',
30118 id: 11
30119 }, {
30120 rule: 'optional',
30121 type: 'string',
30122 name: 'udate',
30123 id: 12
30124 }, {
30125 rule: 'optional',
30126 type: 'int64',
30127 name: 't',
30128 id: 13
30129 }, {
30130 rule: 'optional',
30131 type: 'string',
30132 name: 'n',
30133 id: 14
30134 }, {
30135 rule: 'optional',
30136 type: 'string',
30137 name: 's',
30138 id: 15
30139 }, {
30140 rule: 'optional',
30141 type: 'bool',
30142 name: 'statusSub',
30143 id: 16
30144 }, {
30145 rule: 'optional',
30146 type: 'bool',
30147 name: 'statusPub',
30148 id: 17
30149 }, {
30150 rule: 'optional',
30151 type: 'int32',
30152 name: 'statusTTL',
30153 id: 18
30154 }, {
30155 rule: 'optional',
30156 type: 'string',
30157 name: 'uniqueId',
30158 id: 19
30159 }, {
30160 rule: 'optional',
30161 type: 'string',
30162 name: 'targetClientId',
30163 id: 20
30164 }, {
30165 rule: 'optional',
30166 type: 'int64',
30167 name: 'maxReadTimestamp',
30168 id: 21
30169 }, {
30170 rule: 'optional',
30171 type: 'int64',
30172 name: 'maxAckTimestamp',
30173 id: 22
30174 }, {
30175 rule: 'optional',
30176 type: 'bool',
30177 name: 'queryAllMembers',
30178 id: 23
30179 }, {
30180 rule: 'repeated',
30181 type: 'MaxReadTuple',
30182 name: 'maxReadTuples',
30183 id: 24
30184 }, {
30185 rule: 'repeated',
30186 type: 'string',
30187 name: 'cids',
30188 id: 25
30189 }, {
30190 rule: 'optional',
30191 type: 'ConvMemberInfo',
30192 name: 'info',
30193 id: 26
30194 }, {
30195 rule: 'optional',
30196 type: 'bool',
30197 name: 'tempConv',
30198 id: 27
30199 }, {
30200 rule: 'optional',
30201 type: 'int32',
30202 name: 'tempConvTTL',
30203 id: 28
30204 }, {
30205 rule: 'repeated',
30206 type: 'string',
30207 name: 'tempConvIds',
30208 id: 29
30209 }, {
30210 rule: 'repeated',
30211 type: 'string',
30212 name: 'allowedPids',
30213 id: 30
30214 }, {
30215 rule: 'repeated',
30216 type: 'ErrorCommand',
30217 name: 'failedPids',
30218 id: 31
30219 }, {
30220 rule: 'optional',
30221 type: 'string',
30222 name: 'next',
30223 id: 40
30224 }, {
30225 rule: 'optional',
30226 type: 'JsonObjectMessage',
30227 name: 'results',
30228 id: 100
30229 }, {
30230 rule: 'optional',
30231 type: 'JsonObjectMessage',
30232 name: 'where',
30233 id: 101
30234 }, {
30235 rule: 'optional',
30236 type: 'JsonObjectMessage',
30237 name: 'attr',
30238 id: 103
30239 }, {
30240 rule: 'optional',
30241 type: 'JsonObjectMessage',
30242 name: 'attrModified',
30243 id: 104
30244 }]
30245 }, {
30246 name: 'RoomCommand',
30247 syntax: 'proto2',
30248 fields: [{
30249 rule: 'optional',
30250 type: 'string',
30251 name: 'roomId',
30252 id: 1
30253 }, {
30254 rule: 'optional',
30255 type: 'string',
30256 name: 's',
30257 id: 2
30258 }, {
30259 rule: 'optional',
30260 type: 'int64',
30261 name: 't',
30262 id: 3
30263 }, {
30264 rule: 'optional',
30265 type: 'string',
30266 name: 'n',
30267 id: 4
30268 }, {
30269 rule: 'optional',
30270 type: 'bool',
30271 name: 'transient',
30272 id: 5
30273 }, {
30274 rule: 'repeated',
30275 type: 'string',
30276 name: 'roomPeerIds',
30277 id: 6
30278 }, {
30279 rule: 'optional',
30280 type: 'string',
30281 name: 'byPeerId',
30282 id: 7
30283 }]
30284 }, {
30285 name: 'LogsCommand',
30286 syntax: 'proto2',
30287 fields: [{
30288 rule: 'optional',
30289 type: 'string',
30290 name: 'cid',
30291 id: 1
30292 }, {
30293 rule: 'optional',
30294 type: 'int32',
30295 name: 'l',
30296 id: 2
30297 }, {
30298 rule: 'optional',
30299 type: 'int32',
30300 name: 'limit',
30301 id: 3
30302 }, {
30303 rule: 'optional',
30304 type: 'int64',
30305 name: 't',
30306 id: 4
30307 }, {
30308 rule: 'optional',
30309 type: 'int64',
30310 name: 'tt',
30311 id: 5
30312 }, {
30313 rule: 'optional',
30314 type: 'string',
30315 name: 'tmid',
30316 id: 6
30317 }, {
30318 rule: 'optional',
30319 type: 'string',
30320 name: 'mid',
30321 id: 7
30322 }, {
30323 rule: 'optional',
30324 type: 'string',
30325 name: 'checksum',
30326 id: 8
30327 }, {
30328 rule: 'optional',
30329 type: 'bool',
30330 name: 'stored',
30331 id: 9
30332 }, {
30333 rule: 'optional',
30334 type: 'QueryDirection',
30335 name: 'direction',
30336 id: 10,
30337 options: {
30338 "default": 'OLD'
30339 }
30340 }, {
30341 rule: 'optional',
30342 type: 'bool',
30343 name: 'tIncluded',
30344 id: 11
30345 }, {
30346 rule: 'optional',
30347 type: 'bool',
30348 name: 'ttIncluded',
30349 id: 12
30350 }, {
30351 rule: 'optional',
30352 type: 'int32',
30353 name: 'lctype',
30354 id: 13
30355 }, {
30356 rule: 'repeated',
30357 type: 'LogItem',
30358 name: 'logs',
30359 id: 105
30360 }],
30361 enums: [{
30362 name: 'QueryDirection',
30363 syntax: 'proto2',
30364 values: [{
30365 name: 'OLD',
30366 id: 1
30367 }, {
30368 name: 'NEW',
30369 id: 2
30370 }]
30371 }]
30372 }, {
30373 name: 'RcpCommand',
30374 syntax: 'proto2',
30375 fields: [{
30376 rule: 'optional',
30377 type: 'string',
30378 name: 'id',
30379 id: 1
30380 }, {
30381 rule: 'optional',
30382 type: 'string',
30383 name: 'cid',
30384 id: 2
30385 }, {
30386 rule: 'optional',
30387 type: 'int64',
30388 name: 't',
30389 id: 3
30390 }, {
30391 rule: 'optional',
30392 type: 'bool',
30393 name: 'read',
30394 id: 4
30395 }, {
30396 rule: 'optional',
30397 type: 'string',
30398 name: 'from',
30399 id: 5
30400 }]
30401 }, {
30402 name: 'ReadTuple',
30403 syntax: 'proto2',
30404 fields: [{
30405 rule: 'required',
30406 type: 'string',
30407 name: 'cid',
30408 id: 1
30409 }, {
30410 rule: 'optional',
30411 type: 'int64',
30412 name: 'timestamp',
30413 id: 2
30414 }, {
30415 rule: 'optional',
30416 type: 'string',
30417 name: 'mid',
30418 id: 3
30419 }]
30420 }, {
30421 name: 'MaxReadTuple',
30422 syntax: 'proto2',
30423 fields: [{
30424 rule: 'optional',
30425 type: 'string',
30426 name: 'pid',
30427 id: 1
30428 }, {
30429 rule: 'optional',
30430 type: 'int64',
30431 name: 'maxAckTimestamp',
30432 id: 2
30433 }, {
30434 rule: 'optional',
30435 type: 'int64',
30436 name: 'maxReadTimestamp',
30437 id: 3
30438 }]
30439 }, {
30440 name: 'ReadCommand',
30441 syntax: 'proto2',
30442 fields: [{
30443 rule: 'optional',
30444 type: 'string',
30445 name: 'cid',
30446 id: 1
30447 }, {
30448 rule: 'repeated',
30449 type: 'string',
30450 name: 'cids',
30451 id: 2
30452 }, {
30453 rule: 'repeated',
30454 type: 'ReadTuple',
30455 name: 'convs',
30456 id: 3
30457 }]
30458 }, {
30459 name: 'PresenceCommand',
30460 syntax: 'proto2',
30461 fields: [{
30462 rule: 'optional',
30463 type: 'StatusType',
30464 name: 'status',
30465 id: 1
30466 }, {
30467 rule: 'repeated',
30468 type: 'string',
30469 name: 'sessionPeerIds',
30470 id: 2
30471 }, {
30472 rule: 'optional',
30473 type: 'string',
30474 name: 'cid',
30475 id: 3
30476 }]
30477 }, {
30478 name: 'ReportCommand',
30479 syntax: 'proto2',
30480 fields: [{
30481 rule: 'optional',
30482 type: 'bool',
30483 name: 'initiative',
30484 id: 1
30485 }, {
30486 rule: 'optional',
30487 type: 'string',
30488 name: 'type',
30489 id: 2
30490 }, {
30491 rule: 'optional',
30492 type: 'string',
30493 name: 'data',
30494 id: 3
30495 }]
30496 }, {
30497 name: 'PatchItem',
30498 syntax: 'proto2',
30499 fields: [{
30500 rule: 'optional',
30501 type: 'string',
30502 name: 'cid',
30503 id: 1
30504 }, {
30505 rule: 'optional',
30506 type: 'string',
30507 name: 'mid',
30508 id: 2
30509 }, {
30510 rule: 'optional',
30511 type: 'int64',
30512 name: 'timestamp',
30513 id: 3
30514 }, {
30515 rule: 'optional',
30516 type: 'bool',
30517 name: 'recall',
30518 id: 4
30519 }, {
30520 rule: 'optional',
30521 type: 'string',
30522 name: 'data',
30523 id: 5
30524 }, {
30525 rule: 'optional',
30526 type: 'int64',
30527 name: 'patchTimestamp',
30528 id: 6
30529 }, {
30530 rule: 'optional',
30531 type: 'string',
30532 name: 'from',
30533 id: 7
30534 }, {
30535 rule: 'optional',
30536 type: 'bytes',
30537 name: 'binaryMsg',
30538 id: 8
30539 }, {
30540 rule: 'optional',
30541 type: 'bool',
30542 name: 'mentionAll',
30543 id: 9
30544 }, {
30545 rule: 'repeated',
30546 type: 'string',
30547 name: 'mentionPids',
30548 id: 10
30549 }, {
30550 rule: 'optional',
30551 type: 'int64',
30552 name: 'patchCode',
30553 id: 11
30554 }, {
30555 rule: 'optional',
30556 type: 'string',
30557 name: 'patchReason',
30558 id: 12
30559 }]
30560 }, {
30561 name: 'PatchCommand',
30562 syntax: 'proto2',
30563 fields: [{
30564 rule: 'repeated',
30565 type: 'PatchItem',
30566 name: 'patches',
30567 id: 1
30568 }, {
30569 rule: 'optional',
30570 type: 'int64',
30571 name: 'lastPatchTime',
30572 id: 2
30573 }]
30574 }, {
30575 name: 'PubsubCommand',
30576 syntax: 'proto2',
30577 fields: [{
30578 rule: 'optional',
30579 type: 'string',
30580 name: 'cid',
30581 id: 1
30582 }, {
30583 rule: 'repeated',
30584 type: 'string',
30585 name: 'cids',
30586 id: 2
30587 }, {
30588 rule: 'optional',
30589 type: 'string',
30590 name: 'topic',
30591 id: 3
30592 }, {
30593 rule: 'optional',
30594 type: 'string',
30595 name: 'subtopic',
30596 id: 4
30597 }, {
30598 rule: 'repeated',
30599 type: 'string',
30600 name: 'topics',
30601 id: 5
30602 }, {
30603 rule: 'repeated',
30604 type: 'string',
30605 name: 'subtopics',
30606 id: 6
30607 }, {
30608 rule: 'optional',
30609 type: 'JsonObjectMessage',
30610 name: 'results',
30611 id: 7
30612 }]
30613 }, {
30614 name: 'BlacklistCommand',
30615 syntax: 'proto2',
30616 fields: [{
30617 rule: 'optional',
30618 type: 'string',
30619 name: 'srcCid',
30620 id: 1
30621 }, {
30622 rule: 'repeated',
30623 type: 'string',
30624 name: 'toPids',
30625 id: 2
30626 }, {
30627 rule: 'optional',
30628 type: 'string',
30629 name: 'srcPid',
30630 id: 3
30631 }, {
30632 rule: 'repeated',
30633 type: 'string',
30634 name: 'toCids',
30635 id: 4
30636 }, {
30637 rule: 'optional',
30638 type: 'int32',
30639 name: 'limit',
30640 id: 5
30641 }, {
30642 rule: 'optional',
30643 type: 'string',
30644 name: 'next',
30645 id: 6
30646 }, {
30647 rule: 'repeated',
30648 type: 'string',
30649 name: 'blockedPids',
30650 id: 8
30651 }, {
30652 rule: 'repeated',
30653 type: 'string',
30654 name: 'blockedCids',
30655 id: 9
30656 }, {
30657 rule: 'repeated',
30658 type: 'string',
30659 name: 'allowedPids',
30660 id: 10
30661 }, {
30662 rule: 'repeated',
30663 type: 'ErrorCommand',
30664 name: 'failedPids',
30665 id: 11
30666 }, {
30667 rule: 'optional',
30668 type: 'int64',
30669 name: 't',
30670 id: 12
30671 }, {
30672 rule: 'optional',
30673 type: 'string',
30674 name: 'n',
30675 id: 13
30676 }, {
30677 rule: 'optional',
30678 type: 'string',
30679 name: 's',
30680 id: 14
30681 }]
30682 }, {
30683 name: 'GenericCommand',
30684 syntax: 'proto2',
30685 fields: [{
30686 rule: 'optional',
30687 type: 'CommandType',
30688 name: 'cmd',
30689 id: 1
30690 }, {
30691 rule: 'optional',
30692 type: 'OpType',
30693 name: 'op',
30694 id: 2
30695 }, {
30696 rule: 'optional',
30697 type: 'string',
30698 name: 'appId',
30699 id: 3
30700 }, {
30701 rule: 'optional',
30702 type: 'string',
30703 name: 'peerId',
30704 id: 4
30705 }, {
30706 rule: 'optional',
30707 type: 'int32',
30708 name: 'i',
30709 id: 5
30710 }, {
30711 rule: 'optional',
30712 type: 'string',
30713 name: 'installationId',
30714 id: 6
30715 }, {
30716 rule: 'optional',
30717 type: 'int32',
30718 name: 'priority',
30719 id: 7
30720 }, {
30721 rule: 'optional',
30722 type: 'int32',
30723 name: 'service',
30724 id: 8
30725 }, {
30726 rule: 'optional',
30727 type: 'int64',
30728 name: 'serverTs',
30729 id: 9
30730 }, {
30731 rule: 'optional',
30732 type: 'int64',
30733 name: 'clientTs',
30734 id: 10
30735 }, {
30736 rule: 'optional',
30737 type: 'int32',
30738 name: 'notificationType',
30739 id: 11
30740 }, {
30741 rule: 'optional',
30742 type: 'DataCommand',
30743 name: 'dataMessage',
30744 id: 101
30745 }, {
30746 rule: 'optional',
30747 type: 'SessionCommand',
30748 name: 'sessionMessage',
30749 id: 102
30750 }, {
30751 rule: 'optional',
30752 type: 'ErrorCommand',
30753 name: 'errorMessage',
30754 id: 103
30755 }, {
30756 rule: 'optional',
30757 type: 'DirectCommand',
30758 name: 'directMessage',
30759 id: 104
30760 }, {
30761 rule: 'optional',
30762 type: 'AckCommand',
30763 name: 'ackMessage',
30764 id: 105
30765 }, {
30766 rule: 'optional',
30767 type: 'UnreadCommand',
30768 name: 'unreadMessage',
30769 id: 106
30770 }, {
30771 rule: 'optional',
30772 type: 'ReadCommand',
30773 name: 'readMessage',
30774 id: 107
30775 }, {
30776 rule: 'optional',
30777 type: 'RcpCommand',
30778 name: 'rcpMessage',
30779 id: 108
30780 }, {
30781 rule: 'optional',
30782 type: 'LogsCommand',
30783 name: 'logsMessage',
30784 id: 109
30785 }, {
30786 rule: 'optional',
30787 type: 'ConvCommand',
30788 name: 'convMessage',
30789 id: 110
30790 }, {
30791 rule: 'optional',
30792 type: 'RoomCommand',
30793 name: 'roomMessage',
30794 id: 111
30795 }, {
30796 rule: 'optional',
30797 type: 'PresenceCommand',
30798 name: 'presenceMessage',
30799 id: 112
30800 }, {
30801 rule: 'optional',
30802 type: 'ReportCommand',
30803 name: 'reportMessage',
30804 id: 113
30805 }, {
30806 rule: 'optional',
30807 type: 'PatchCommand',
30808 name: 'patchMessage',
30809 id: 114
30810 }, {
30811 rule: 'optional',
30812 type: 'PubsubCommand',
30813 name: 'pubsubMessage',
30814 id: 115
30815 }, {
30816 rule: 'optional',
30817 type: 'BlacklistCommand',
30818 name: 'blacklistMessage',
30819 id: 116
30820 }]
30821 }],
30822 enums: [{
30823 name: 'CommandType',
30824 syntax: 'proto2',
30825 values: [{
30826 name: 'session',
30827 id: 0
30828 }, {
30829 name: 'conv',
30830 id: 1
30831 }, {
30832 name: 'direct',
30833 id: 2
30834 }, {
30835 name: 'ack',
30836 id: 3
30837 }, {
30838 name: 'rcp',
30839 id: 4
30840 }, {
30841 name: 'unread',
30842 id: 5
30843 }, {
30844 name: 'logs',
30845 id: 6
30846 }, {
30847 name: 'error',
30848 id: 7
30849 }, {
30850 name: 'login',
30851 id: 8
30852 }, {
30853 name: 'data',
30854 id: 9
30855 }, {
30856 name: 'room',
30857 id: 10
30858 }, {
30859 name: 'read',
30860 id: 11
30861 }, {
30862 name: 'presence',
30863 id: 12
30864 }, {
30865 name: 'report',
30866 id: 13
30867 }, {
30868 name: 'echo',
30869 id: 14
30870 }, {
30871 name: 'loggedin',
30872 id: 15
30873 }, {
30874 name: 'logout',
30875 id: 16
30876 }, {
30877 name: 'loggedout',
30878 id: 17
30879 }, {
30880 name: 'patch',
30881 id: 18
30882 }, {
30883 name: 'pubsub',
30884 id: 19
30885 }, {
30886 name: 'blacklist',
30887 id: 20
30888 }, {
30889 name: 'goaway',
30890 id: 21
30891 }]
30892 }, {
30893 name: 'OpType',
30894 syntax: 'proto2',
30895 values: [{
30896 name: 'open',
30897 id: 1
30898 }, {
30899 name: 'add',
30900 id: 2
30901 }, {
30902 name: 'remove',
30903 id: 3
30904 }, {
30905 name: 'close',
30906 id: 4
30907 }, {
30908 name: 'opened',
30909 id: 5
30910 }, {
30911 name: 'closed',
30912 id: 6
30913 }, {
30914 name: 'query',
30915 id: 7
30916 }, {
30917 name: 'query_result',
30918 id: 8
30919 }, {
30920 name: 'conflict',
30921 id: 9
30922 }, {
30923 name: 'added',
30924 id: 10
30925 }, {
30926 name: 'removed',
30927 id: 11
30928 }, {
30929 name: 'refresh',
30930 id: 12
30931 }, {
30932 name: 'refreshed',
30933 id: 13
30934 }, {
30935 name: 'start',
30936 id: 30
30937 }, {
30938 name: 'started',
30939 id: 31
30940 }, {
30941 name: 'joined',
30942 id: 32
30943 }, {
30944 name: 'members_joined',
30945 id: 33
30946 }, {
30947 name: 'left',
30948 id: 39
30949 }, {
30950 name: 'members_left',
30951 id: 40
30952 }, {
30953 name: 'results',
30954 id: 42
30955 }, {
30956 name: 'count',
30957 id: 43
30958 }, {
30959 name: 'result',
30960 id: 44
30961 }, {
30962 name: 'update',
30963 id: 45
30964 }, {
30965 name: 'updated',
30966 id: 46
30967 }, {
30968 name: 'mute',
30969 id: 47
30970 }, {
30971 name: 'unmute',
30972 id: 48
30973 }, {
30974 name: 'status',
30975 id: 49
30976 }, {
30977 name: 'members',
30978 id: 50
30979 }, {
30980 name: 'max_read',
30981 id: 51
30982 }, {
30983 name: 'is_member',
30984 id: 52
30985 }, {
30986 name: 'member_info_update',
30987 id: 53
30988 }, {
30989 name: 'member_info_updated',
30990 id: 54
30991 }, {
30992 name: 'member_info_changed',
30993 id: 55
30994 }, {
30995 name: 'join',
30996 id: 80
30997 }, {
30998 name: 'invite',
30999 id: 81
31000 }, {
31001 name: 'leave',
31002 id: 82
31003 }, {
31004 name: 'kick',
31005 id: 83
31006 }, {
31007 name: 'reject',
31008 id: 84
31009 }, {
31010 name: 'invited',
31011 id: 85
31012 }, {
31013 name: 'kicked',
31014 id: 86
31015 }, {
31016 name: 'upload',
31017 id: 100
31018 }, {
31019 name: 'uploaded',
31020 id: 101
31021 }, {
31022 name: 'subscribe',
31023 id: 120
31024 }, {
31025 name: 'subscribed',
31026 id: 121
31027 }, {
31028 name: 'unsubscribe',
31029 id: 122
31030 }, {
31031 name: 'unsubscribed',
31032 id: 123
31033 }, {
31034 name: 'is_subscribed',
31035 id: 124
31036 }, {
31037 name: 'modify',
31038 id: 150
31039 }, {
31040 name: 'modified',
31041 id: 151
31042 }, {
31043 name: 'block',
31044 id: 170
31045 }, {
31046 name: 'unblock',
31047 id: 171
31048 }, {
31049 name: 'blocked',
31050 id: 172
31051 }, {
31052 name: 'unblocked',
31053 id: 173
31054 }, {
31055 name: 'members_blocked',
31056 id: 174
31057 }, {
31058 name: 'members_unblocked',
31059 id: 175
31060 }, {
31061 name: 'check_block',
31062 id: 176
31063 }, {
31064 name: 'check_result',
31065 id: 177
31066 }, {
31067 name: 'add_shutup',
31068 id: 180
31069 }, {
31070 name: 'remove_shutup',
31071 id: 181
31072 }, {
31073 name: 'query_shutup',
31074 id: 182
31075 }, {
31076 name: 'shutup_added',
31077 id: 183
31078 }, {
31079 name: 'shutup_removed',
31080 id: 184
31081 }, {
31082 name: 'shutup_result',
31083 id: 185
31084 }, {
31085 name: 'shutuped',
31086 id: 186
31087 }, {
31088 name: 'unshutuped',
31089 id: 187
31090 }, {
31091 name: 'members_shutuped',
31092 id: 188
31093 }, {
31094 name: 'members_unshutuped',
31095 id: 189
31096 }, {
31097 name: 'check_shutup',
31098 id: 190
31099 }]
31100 }, {
31101 name: 'StatusType',
31102 syntax: 'proto2',
31103 values: [{
31104 name: 'on',
31105 id: 1
31106 }, {
31107 name: 'off',
31108 id: 2
31109 }]
31110 }],
31111 isNamespace: true
31112}).build();
31113var _messages$push_server = messageCompiled.push_server.messages2,
31114 JsonObjectMessage = _messages$push_server.JsonObjectMessage,
31115 UnreadTuple = _messages$push_server.UnreadTuple,
31116 LogItem = _messages$push_server.LogItem,
31117 DataCommand = _messages$push_server.DataCommand,
31118 SessionCommand = _messages$push_server.SessionCommand,
31119 ErrorCommand = _messages$push_server.ErrorCommand,
31120 DirectCommand = _messages$push_server.DirectCommand,
31121 AckCommand = _messages$push_server.AckCommand,
31122 UnreadCommand = _messages$push_server.UnreadCommand,
31123 ConvCommand = _messages$push_server.ConvCommand,
31124 RoomCommand = _messages$push_server.RoomCommand,
31125 LogsCommand = _messages$push_server.LogsCommand,
31126 RcpCommand = _messages$push_server.RcpCommand,
31127 ReadTuple = _messages$push_server.ReadTuple,
31128 MaxReadTuple = _messages$push_server.MaxReadTuple,
31129 ReadCommand = _messages$push_server.ReadCommand,
31130 PresenceCommand = _messages$push_server.PresenceCommand,
31131 ReportCommand = _messages$push_server.ReportCommand,
31132 GenericCommand = _messages$push_server.GenericCommand,
31133 BlacklistCommand = _messages$push_server.BlacklistCommand,
31134 PatchCommand = _messages$push_server.PatchCommand,
31135 PatchItem = _messages$push_server.PatchItem,
31136 ConvMemberInfo = _messages$push_server.ConvMemberInfo,
31137 CommandType = _messages$push_server.CommandType,
31138 OpType = _messages$push_server.OpType,
31139 StatusType = _messages$push_server.StatusType;
31140var message = /*#__PURE__*/(0, _freeze.default)({
31141 __proto__: null,
31142 JsonObjectMessage: JsonObjectMessage,
31143 UnreadTuple: UnreadTuple,
31144 LogItem: LogItem,
31145 DataCommand: DataCommand,
31146 SessionCommand: SessionCommand,
31147 ErrorCommand: ErrorCommand,
31148 DirectCommand: DirectCommand,
31149 AckCommand: AckCommand,
31150 UnreadCommand: UnreadCommand,
31151 ConvCommand: ConvCommand,
31152 RoomCommand: RoomCommand,
31153 LogsCommand: LogsCommand,
31154 RcpCommand: RcpCommand,
31155 ReadTuple: ReadTuple,
31156 MaxReadTuple: MaxReadTuple,
31157 ReadCommand: ReadCommand,
31158 PresenceCommand: PresenceCommand,
31159 ReportCommand: ReportCommand,
31160 GenericCommand: GenericCommand,
31161 BlacklistCommand: BlacklistCommand,
31162 PatchCommand: PatchCommand,
31163 PatchItem: PatchItem,
31164 ConvMemberInfo: ConvMemberInfo,
31165 CommandType: CommandType,
31166 OpType: OpType,
31167 StatusType: StatusType
31168});
31169var adapters = {};
31170
31171var getAdapter = function getAdapter(name) {
31172 var adapter = adapters[name];
31173
31174 if (adapter === undefined) {
31175 throw new Error("".concat(name, " adapter is not configured"));
31176 }
31177
31178 return adapter;
31179};
31180/**
31181 * 指定 Adapters
31182 * @function
31183 * @memberof module:leancloud-realtime
31184 * @param {Adapters} newAdapters Adapters 的类型请参考 {@link https://url.leanapp.cn/adapter-type-definitions @leancloud/adapter-types} 中的定义
31185 */
31186
31187
31188var setAdapters = function setAdapters(newAdapters) {
31189 (0, _assign.default)(adapters, newAdapters);
31190};
31191/* eslint-disable */
31192
31193
31194var global$1 = typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : {};
31195var EXPIRED = (0, _symbol.default)('expired');
31196var debug = d('LC:Expirable');
31197
31198var Expirable = /*#__PURE__*/function () {
31199 function Expirable(value, ttl) {
31200 this.originalValue = value;
31201
31202 if (typeof ttl === 'number') {
31203 this.expiredAt = Date.now() + ttl;
31204 }
31205 }
31206
31207 _createClass(Expirable, [{
31208 key: "value",
31209 get: function get() {
31210 var expired = this.expiredAt && this.expiredAt <= Date.now();
31211 if (expired) debug("expired: ".concat(this.originalValue));
31212 return expired ? EXPIRED : this.originalValue;
31213 }
31214 }]);
31215
31216 return Expirable;
31217}();
31218
31219Expirable.EXPIRED = EXPIRED;
31220var debug$1 = d('LC:Cache');
31221
31222var Cache = /*#__PURE__*/function () {
31223 function Cache() {
31224 var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'anonymous';
31225 this.name = name;
31226 this._map = {};
31227 }
31228
31229 var _proto = Cache.prototype;
31230
31231 _proto.get = function get(key) {
31232 var _context5;
31233
31234 var cache = this._map[key];
31235
31236 if (cache) {
31237 var value = cache.value;
31238
31239 if (value !== Expirable.EXPIRED) {
31240 debug$1('[%s] hit: %s', this.name, key);
31241 return value;
31242 }
31243
31244 delete this._map[key];
31245 }
31246
31247 debug$1((0, _concat.default)(_context5 = "[".concat(this.name, "] missed: ")).call(_context5, key));
31248 return null;
31249 };
31250
31251 _proto.set = function set(key, value, ttl) {
31252 debug$1('[%s] set: %s %d', this.name, key, ttl);
31253 this._map[key] = new Expirable(value, ttl);
31254 };
31255
31256 return Cache;
31257}();
31258
31259function ownKeys(object, enumerableOnly) {
31260 var keys = (0, _keys.default)(object);
31261
31262 if (_getOwnPropertySymbols.default) {
31263 var symbols = (0, _getOwnPropertySymbols.default)(object);
31264 enumerableOnly && (symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
31265 return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
31266 })), keys.push.apply(keys, symbols);
31267 }
31268
31269 return keys;
31270}
31271
31272function _objectSpread(target) {
31273 for (var i = 1; i < arguments.length; i++) {
31274 var source = null != arguments[i] ? arguments[i] : {};
31275 i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
31276 _defineProperty(target, key, source[key]);
31277 }) : _getOwnPropertyDescriptors.default ? (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source)) : ownKeys(Object(source)).forEach(function (key) {
31278 (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
31279 });
31280 }
31281
31282 return target;
31283}
31284/**
31285 * 调试日志控制器
31286 * @const
31287 * @memberof module:leancloud-realtime
31288 * @example
31289 * debug.enable(); // 启用调试日志
31290 * debug.disable(); // 关闭调试日志
31291 */
31292
31293
31294var debug$2 = {
31295 enable: function enable() {
31296 var namespaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'LC*';
31297 return d.enable(namespaces);
31298 },
31299 disable: d.disable
31300};
31301
31302var tryAll = function tryAll(promiseConstructors) {
31303 var promise = new _promise.default(promiseConstructors[0]);
31304
31305 if (promiseConstructors.length === 1) {
31306 return promise;
31307 }
31308
31309 return promise["catch"](function () {
31310 return tryAll((0, _slice.default)(promiseConstructors).call(promiseConstructors, 1));
31311 });
31312}; // eslint-disable-next-line no-sequences
31313
31314
31315var tap = function tap(interceptor) {
31316 return function (value) {
31317 return interceptor(value), value;
31318 };
31319};
31320
31321var isIE10 = global$1.navigator && global$1.navigator.userAgent && (0, _indexOf.default)(_context6 = global$1.navigator.userAgent).call(_context6, 'MSIE 10.') !== -1;
31322var map = new _weakMap.default(); // protected property helper
31323
31324var internal = function internal(object) {
31325 if (!map.has(object)) {
31326 map.set(object, {});
31327 }
31328
31329 return map.get(object);
31330};
31331
31332var compact = function compact(obj, filter) {
31333 if (!isPlainObject(obj)) return obj;
31334
31335 var object = _objectSpread({}, obj);
31336
31337 (0, _keys.default)(object).forEach(function (prop) {
31338 var value = object[prop];
31339
31340 if (value === filter) {
31341 delete object[prop];
31342 } else {
31343 object[prop] = compact(value, filter);
31344 }
31345 });
31346 return object;
31347}; // debug utility
31348
31349
31350var removeNull = function removeNull(obj) {
31351 return compact(obj, null);
31352};
31353
31354var trim = function trim(message) {
31355 return removeNull(JSON.parse((0, _stringify.default)(message)));
31356};
31357
31358var ensureArray = function ensureArray(target) {
31359 if (Array.isArray(target)) {
31360 return target;
31361 }
31362
31363 if (target === undefined || target === null) {
31364 return [];
31365 }
31366
31367 return [target];
31368};
31369
31370var isWeapp = // eslint-disable-next-line no-undef
31371(typeof wx === "undefined" ? "undefined" : _typeof(wx)) === 'object' && typeof wx.connectSocket === 'function';
31372
31373var isCNApp = function isCNApp(appId) {
31374 return (0, _slice.default)(appId).call(appId, -9) !== '-MdYXbMMI';
31375};
31376
31377var equalBuffer = function equalBuffer(buffer1, buffer2) {
31378 if (!buffer1 || !buffer2) return false;
31379 if (buffer1.byteLength !== buffer2.byteLength) return false;
31380 var a = new Uint8Array(buffer1);
31381 var b = new Uint8Array(buffer2);
31382 return !a.some(function (value, index) {
31383 return value !== b[index];
31384 });
31385};
31386
31387var _class;
31388
31389function ownKeys$1(object, enumerableOnly) {
31390 var keys = (0, _keys.default)(object);
31391
31392 if (_getOwnPropertySymbols.default) {
31393 var symbols = (0, _getOwnPropertySymbols.default)(object);
31394 enumerableOnly && (symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
31395 return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
31396 })), keys.push.apply(keys, symbols);
31397 }
31398
31399 return keys;
31400}
31401
31402function _objectSpread$1(target) {
31403 for (var i = 1; i < arguments.length; i++) {
31404 var source = null != arguments[i] ? arguments[i] : {};
31405 i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) {
31406 _defineProperty(target, key, source[key]);
31407 }) : _getOwnPropertyDescriptors.default ? (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source)) : ownKeys$1(Object(source)).forEach(function (key) {
31408 (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
31409 });
31410 }
31411
31412 return target;
31413}
31414
31415var debug$3 = d('LC:WebSocketPlus');
31416var OPEN = 'open';
31417var DISCONNECT = 'disconnect';
31418var RECONNECT = 'reconnect';
31419var RETRY = 'retry';
31420var SCHEDULE = 'schedule';
31421var OFFLINE = 'offline';
31422var ONLINE = 'online';
31423var ERROR = 'error';
31424var MESSAGE = 'message';
31425var HEARTBEAT_TIME = 180000;
31426var TIMEOUT_TIME = 380000;
31427
31428var DEFAULT_RETRY_STRATEGY = function DEFAULT_RETRY_STRATEGY(attempt) {
31429 return Math.min(1000 * Math.pow(2, attempt), 300000);
31430};
31431
31432var requireConnected = function requireConnected(target, name, descriptor) {
31433 return _objectSpread$1(_objectSpread$1({}, descriptor), {}, {
31434 value: function requireConnectedWrapper() {
31435 var _context7;
31436
31437 var _descriptor$value;
31438
31439 this.checkConnectionAvailability(name);
31440
31441 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
31442 args[_key] = arguments[_key];
31443 }
31444
31445 return (_descriptor$value = descriptor.value).call.apply(_descriptor$value, (0, _concat.default)(_context7 = [this]).call(_context7, args));
31446 }
31447 });
31448};
31449
31450var WebSocketPlus = (_class = /*#__PURE__*/function (_EventEmitter) {
31451 _inheritsLoose(WebSocketPlus, _EventEmitter);
31452
31453 function WebSocketPlus(getUrls, protocol) {
31454 var _this;
31455
31456 _this = _EventEmitter.call(this) || this;
31457
31458 _this.init();
31459
31460 _this._protocol = protocol;
31461
31462 _promise.default.resolve(typeof getUrls === 'function' ? getUrls() : getUrls).then(ensureArray).then(function (urls) {
31463 _this._urls = urls;
31464 return _this._open();
31465 }).then(function () {
31466 _this.__postponeTimeoutTimer = _this._postponeTimeoutTimer.bind(_assertThisInitialized(_this));
31467
31468 if (global$1.addEventListener) {
31469 _this.__pause = function () {
31470 if (_this.can('pause')) _this.pause();
31471 };
31472
31473 _this.__resume = function () {
31474 if (_this.can('resume')) _this.resume();
31475 };
31476
31477 global$1.addEventListener('offline', _this.__pause);
31478 global$1.addEventListener('online', _this.__resume);
31479 }
31480
31481 _this.open();
31482 })["catch"](_this["throw"].bind(_assertThisInitialized(_this)));
31483
31484 return _this;
31485 }
31486
31487 var _proto = WebSocketPlus.prototype;
31488
31489 _proto._open = function _open() {
31490 var _this2 = this;
31491
31492 return this._createWs(this._urls, this._protocol).then(function (ws) {
31493 var _context8;
31494
31495 var _this2$_urls = _toArray(_this2._urls),
31496 first = _this2$_urls[0],
31497 reset = (0, _slice.default)(_this2$_urls).call(_this2$_urls, 1);
31498
31499 _this2._urls = (0, _concat.default)(_context8 = []).call(_context8, _toConsumableArray(reset), [first]);
31500 return ws;
31501 });
31502 };
31503
31504 _proto._createWs = function _createWs(urls, protocol) {
31505 var _this3 = this;
31506
31507 return tryAll((0, _map.default)(urls).call(urls, function (url) {
31508 return function (resolve, reject) {
31509 var _context9;
31510
31511 debug$3((0, _concat.default)(_context9 = "connect [".concat(url, "] ")).call(_context9, protocol));
31512 var WebSocket = getAdapter('WebSocket');
31513 var ws = protocol ? new WebSocket(url, protocol) : new WebSocket(url);
31514 ws.binaryType = _this3.binaryType || 'arraybuffer';
31515
31516 ws.onopen = function () {
31517 return resolve(ws);
31518 };
31519
31520 ws.onclose = function (error) {
31521 if (error instanceof Error) {
31522 return reject(error);
31523 } // in browser, error event is useless
31524
31525
31526 return reject(new Error("Failed to connect [".concat(url, "]")));
31527 };
31528
31529 ws.onerror = ws.onclose;
31530 };
31531 })).then(function (ws) {
31532 _this3._ws = ws;
31533 _this3._ws.onclose = _this3._handleClose.bind(_this3);
31534 _this3._ws.onmessage = _this3._handleMessage.bind(_this3);
31535 return ws;
31536 });
31537 };
31538
31539 _proto._destroyWs = function _destroyWs() {
31540 var ws = this._ws;
31541 if (!ws) return;
31542 ws.onopen = null;
31543 ws.onclose = null;
31544 ws.onerror = null;
31545 ws.onmessage = null;
31546 this._ws = null;
31547 ws.close();
31548 } // eslint-disable-next-line class-methods-use-this
31549 ;
31550
31551 _proto.onbeforeevent = function onbeforeevent(event, from, to) {
31552 var _context10, _context11;
31553
31554 for (var _len2 = arguments.length, payload = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
31555 payload[_key2 - 3] = arguments[_key2];
31556 }
31557
31558 debug$3((0, _concat.default)(_context10 = (0, _concat.default)(_context11 = "".concat(event, ": ")).call(_context11, from, " -> ")).call(_context10, to, " %o"), payload);
31559 };
31560
31561 _proto.onopen = function onopen() {
31562 this.emit(OPEN);
31563 };
31564
31565 _proto.onconnected = function onconnected() {
31566 this._startConnectionKeeper();
31567 };
31568
31569 _proto.onleaveconnected = function onleaveconnected(event, from, to) {
31570 this._stopConnectionKeeper();
31571
31572 this._destroyWs();
31573
31574 if (to === 'offline' || to === 'disconnected') {
31575 this.emit(DISCONNECT);
31576 }
31577 };
31578
31579 _proto.onpause = function onpause() {
31580 this.emit(OFFLINE);
31581 };
31582
31583 _proto.onbeforeresume = function onbeforeresume() {
31584 this.emit(ONLINE);
31585 };
31586
31587 _proto.onreconnect = function onreconnect() {
31588 this.emit(RECONNECT);
31589 };
31590
31591 _proto.ondisconnected = function ondisconnected(event, from, to) {
31592 var _context12;
31593
31594 var _this4 = this;
31595
31596 var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
31597 var delay = from === OFFLINE ? 0 : DEFAULT_RETRY_STRATEGY.call(null, attempt);
31598 debug$3((0, _concat.default)(_context12 = "schedule attempt=".concat(attempt, " delay=")).call(_context12, delay));
31599 this.emit(SCHEDULE, attempt, delay);
31600
31601 if (this.__scheduledRetry) {
31602 clearTimeout(this.__scheduledRetry);
31603 }
31604
31605 this.__scheduledRetry = setTimeout(function () {
31606 if (_this4.is('disconnected')) {
31607 _this4.retry(attempt);
31608 }
31609 }, delay);
31610 };
31611
31612 _proto.onretry = function onretry(event, from, to) {
31613 var _this5 = this;
31614
31615 var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
31616 this.emit(RETRY, attempt);
31617
31618 this._open().then(function () {
31619 return _this5.can('reconnect') && _this5.reconnect();
31620 }, function () {
31621 return _this5.can('fail') && _this5.fail(attempt + 1);
31622 });
31623 };
31624
31625 _proto.onerror = function onerror(event, from, to, error) {
31626 this.emit(ERROR, error);
31627 };
31628
31629 _proto.onclose = function onclose() {
31630 if (global$1.removeEventListener) {
31631 if (this.__pause) global$1.removeEventListener('offline', this.__pause);
31632 if (this.__resume) global$1.removeEventListener('online', this.__resume);
31633 }
31634 };
31635
31636 _proto.checkConnectionAvailability = function checkConnectionAvailability() {
31637 var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'API';
31638
31639 if (!this.is('connected')) {
31640 var _context13;
31641
31642 var currentState = this.current;
31643 console.warn((0, _concat.default)(_context13 = "".concat(name, " should not be called when the connection is ")).call(_context13, currentState));
31644
31645 if (this.is('disconnected') || this.is('reconnecting')) {
31646 console.warn('disconnect and reconnect event should be handled to avoid such calls.');
31647 }
31648
31649 throw new Error('Connection unavailable');
31650 }
31651 } // jsdoc-ignore-start
31652 ;
31653
31654 _proto. // jsdoc-ignore-end
31655 _ping = function _ping() {
31656 debug$3('ping');
31657
31658 try {
31659 this.ping();
31660 } catch (error) {
31661 console.warn("websocket ping error: ".concat(error.message));
31662 }
31663 };
31664
31665 _proto.ping = function ping() {
31666 if (this._ws.ping) {
31667 this._ws.ping();
31668 } else {
31669 console.warn("The WebSocket implement does not support sending ping frame.\n Override ping method to use application defined ping/pong mechanism.");
31670 }
31671 };
31672
31673 _proto._postponeTimeoutTimer = function _postponeTimeoutTimer() {
31674 var _this6 = this;
31675
31676 debug$3('_postponeTimeoutTimer');
31677
31678 this._clearTimeoutTimers();
31679
31680 this._timeoutTimer = setTimeout(function () {
31681 debug$3('timeout');
31682
31683 _this6.disconnect();
31684 }, TIMEOUT_TIME);
31685 };
31686
31687 _proto._clearTimeoutTimers = function _clearTimeoutTimers() {
31688 if (this._timeoutTimer) {
31689 clearTimeout(this._timeoutTimer);
31690 }
31691 };
31692
31693 _proto._startConnectionKeeper = function _startConnectionKeeper() {
31694 debug$3('start connection keeper');
31695 this._heartbeatTimer = setInterval(this._ping.bind(this), HEARTBEAT_TIME);
31696 var addListener = this._ws.addListener || this._ws.addEventListener;
31697
31698 if (!addListener) {
31699 debug$3('connection keeper disabled due to the lack of #addEventListener.');
31700 return;
31701 }
31702
31703 addListener.call(this._ws, 'message', this.__postponeTimeoutTimer);
31704 addListener.call(this._ws, 'pong', this.__postponeTimeoutTimer);
31705
31706 this._postponeTimeoutTimer();
31707 };
31708
31709 _proto._stopConnectionKeeper = function _stopConnectionKeeper() {
31710 debug$3('stop connection keeper'); // websockets/ws#489
31711
31712 var removeListener = this._ws.removeListener || this._ws.removeEventListener;
31713
31714 if (removeListener) {
31715 removeListener.call(this._ws, 'message', this.__postponeTimeoutTimer);
31716 removeListener.call(this._ws, 'pong', this.__postponeTimeoutTimer);
31717
31718 this._clearTimeoutTimers();
31719 }
31720
31721 if (this._heartbeatTimer) {
31722 clearInterval(this._heartbeatTimer);
31723 }
31724 };
31725
31726 _proto._handleClose = function _handleClose(event) {
31727 var _context14;
31728
31729 debug$3((0, _concat.default)(_context14 = "ws closed [".concat(event.code, "] ")).call(_context14, event.reason)); // socket closed manually, ignore close event.
31730
31731 if (this.isFinished()) return;
31732 this.handleClose(event);
31733 };
31734
31735 _proto.handleClose = function handleClose() {
31736 // reconnect
31737 this.disconnect();
31738 } // jsdoc-ignore-start
31739 ;
31740
31741 _proto. // jsdoc-ignore-end
31742 send = function send(data) {
31743 debug$3('send', data);
31744
31745 this._ws.send(data);
31746 };
31747
31748 _proto._handleMessage = function _handleMessage(event) {
31749 debug$3('message', event.data);
31750 this.handleMessage(event.data);
31751 };
31752
31753 _proto.handleMessage = function handleMessage(message) {
31754 this.emit(MESSAGE, message);
31755 };
31756
31757 _createClass(WebSocketPlus, [{
31758 key: "urls",
31759 get: function get() {
31760 return this._urls;
31761 },
31762 set: function set(urls) {
31763 this._urls = ensureArray(urls);
31764 }
31765 }]);
31766
31767 return WebSocketPlus;
31768}(EventEmitter), (_applyDecoratedDescriptor(_class.prototype, "_ping", [requireConnected], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "_ping"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "send", [requireConnected], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "send"), _class.prototype)), _class);
31769StateMachine.create({
31770 target: WebSocketPlus.prototype,
31771 initial: {
31772 state: 'initialized',
31773 event: 'init',
31774 defer: true
31775 },
31776 terminal: 'closed',
31777 events: [{
31778 name: 'open',
31779 from: 'initialized',
31780 to: 'connected'
31781 }, {
31782 name: 'disconnect',
31783 from: 'connected',
31784 to: 'disconnected'
31785 }, {
31786 name: 'retry',
31787 from: 'disconnected',
31788 to: 'reconnecting'
31789 }, {
31790 name: 'fail',
31791 from: 'reconnecting',
31792 to: 'disconnected'
31793 }, {
31794 name: 'reconnect',
31795 from: 'reconnecting',
31796 to: 'connected'
31797 }, {
31798 name: 'pause',
31799 from: ['connected', 'disconnected', 'reconnecting'],
31800 to: 'offline'
31801 }, {}, {
31802 name: 'resume',
31803 from: 'offline',
31804 to: 'disconnected'
31805 }, {
31806 name: 'close',
31807 from: ['connected', 'disconnected', 'reconnecting', 'offline'],
31808 to: 'closed'
31809 }, {
31810 name: 'throw',
31811 from: '*',
31812 to: 'error'
31813 }]
31814});
31815var error = (0, _freeze.default)({
31816 1000: {
31817 name: 'CLOSE_NORMAL'
31818 },
31819 1006: {
31820 name: 'CLOSE_ABNORMAL'
31821 },
31822 4100: {
31823 name: 'APP_NOT_AVAILABLE',
31824 message: 'App not exists or realtime message service is disabled.'
31825 },
31826 4102: {
31827 name: 'SIGNATURE_FAILED',
31828 message: 'Login signature mismatch.'
31829 },
31830 4103: {
31831 name: 'INVALID_LOGIN',
31832 message: 'Malformed clientId.'
31833 },
31834 4105: {
31835 name: 'SESSION_REQUIRED',
31836 message: 'Message sent before session opened.'
31837 },
31838 4107: {
31839 name: 'READ_TIMEOUT'
31840 },
31841 4108: {
31842 name: 'LOGIN_TIMEOUT'
31843 },
31844 4109: {
31845 name: 'FRAME_TOO_LONG'
31846 },
31847 4110: {
31848 name: 'INVALID_ORIGIN',
31849 message: 'Access denied by domain whitelist.'
31850 },
31851 4111: {
31852 name: 'SESSION_CONFLICT'
31853 },
31854 4112: {
31855 name: 'SESSION_TOKEN_EXPIRED'
31856 },
31857 4113: {
31858 name: 'APP_QUOTA_EXCEEDED',
31859 message: 'The daily active users limit exceeded.'
31860 },
31861 4116: {
31862 name: 'MESSAGE_SENT_QUOTA_EXCEEDED',
31863 message: 'Command sent too fast.'
31864 },
31865 4200: {
31866 name: 'INTERNAL_ERROR',
31867 message: 'Internal error, please contact LeanCloud for support.'
31868 },
31869 4301: {
31870 name: 'CONVERSATION_API_FAILED',
31871 message: 'Upstream Conversatoin API failed, see error.detail for details.'
31872 },
31873 4302: {
31874 name: 'CONVERSATION_SIGNATURE_FAILED',
31875 message: 'Conversation action signature mismatch.'
31876 },
31877 4303: {
31878 name: 'CONVERSATION_NOT_FOUND'
31879 },
31880 4304: {
31881 name: 'CONVERSATION_FULL'
31882 },
31883 4305: {
31884 name: 'CONVERSATION_REJECTED_BY_APP',
31885 message: 'Conversation action rejected by hook.'
31886 },
31887 4306: {
31888 name: 'CONVERSATION_UPDATE_FAILED'
31889 },
31890 4307: {
31891 name: 'CONVERSATION_READ_ONLY'
31892 },
31893 4308: {
31894 name: 'CONVERSATION_NOT_ALLOWED'
31895 },
31896 4309: {
31897 name: 'CONVERSATION_UPDATE_REJECTED',
31898 message: 'Conversation update rejected because the client is not a member.'
31899 },
31900 4310: {
31901 name: 'CONVERSATION_QUERY_FAILED',
31902 message: 'Conversation query failed because it is too expansive.'
31903 },
31904 4311: {
31905 name: 'CONVERSATION_LOG_FAILED'
31906 },
31907 4312: {
31908 name: 'CONVERSATION_LOG_REJECTED',
31909 message: 'Message query rejected because the client is not a member of the conversation.'
31910 },
31911 4313: {
31912 name: 'SYSTEM_CONVERSATION_REQUIRED'
31913 },
31914 4314: {
31915 name: 'NORMAL_CONVERSATION_REQUIRED'
31916 },
31917 4315: {
31918 name: 'CONVERSATION_BLACKLISTED',
31919 message: 'Blacklisted in the conversation.'
31920 },
31921 4316: {
31922 name: 'TRANSIENT_CONVERSATION_REQUIRED'
31923 },
31924 4317: {
31925 name: 'CONVERSATION_MEMBERSHIP_REQUIRED'
31926 },
31927 4318: {
31928 name: 'CONVERSATION_API_QUOTA_EXCEEDED',
31929 message: 'LeanCloud API quota exceeded. You may upgrade your plan.'
31930 },
31931 4323: {
31932 name: 'TEMPORARY_CONVERSATION_EXPIRED',
31933 message: 'Temporary conversation expired or does not exist.'
31934 },
31935 4401: {
31936 name: 'INVALID_MESSAGING_TARGET',
31937 message: 'Conversation does not exist or client is not a member.'
31938 },
31939 4402: {
31940 name: 'MESSAGE_REJECTED_BY_APP',
31941 message: 'Message rejected by hook.'
31942 },
31943 4403: {
31944 name: 'MESSAGE_OWNERSHIP_REQUIRED'
31945 },
31946 4404: {
31947 name: 'MESSAGE_NOT_FOUND'
31948 },
31949 4405: {
31950 name: 'MESSAGE_UPDATE_REJECTED_BY_APP',
31951 message: 'Message update rejected by hook.'
31952 },
31953 4406: {
31954 name: 'MESSAGE_EDIT_DISABLED'
31955 },
31956 4407: {
31957 name: 'MESSAGE_RECALL_DISABLED'
31958 },
31959 5130: {
31960 name: 'OWNER_PROMOTION_NOT_ALLOWED',
31961 message: "Updating a member's role to owner is not allowed."
31962 }
31963});
31964var ErrorCode = (0, _freeze.default)((0, _reduce.default)(_context15 = (0, _keys.default)(error)).call(_context15, function (result, code) {
31965 return (0, _assign.default)(result, _defineProperty({}, error[code].name, Number(code)));
31966}, {}));
31967
31968var createError = function createError(_ref) {
31969 var code = _ref.code,
31970 reason = _ref.reason,
31971 appCode = _ref.appCode,
31972 detail = _ref.detail,
31973 errorMessage = _ref.error;
31974 var message = reason || detail || errorMessage;
31975 var name = reason;
31976
31977 if (!message && error[code]) {
31978 name = error[code].name;
31979 message = error[code].message || name;
31980 }
31981
31982 if (!message) {
31983 message = "Unknow Error: ".concat(code);
31984 }
31985
31986 var err = new Error(message);
31987 return (0, _assign.default)(err, {
31988 code: code,
31989 appCode: appCode,
31990 detail: detail,
31991 name: name
31992 });
31993};
31994
31995var debug$4 = d('LC:Connection');
31996var COMMAND_TIMEOUT = 20000;
31997var EXPIRE = (0, _symbol.default)('expire');
31998
31999var isIdempotentCommand = function isIdempotentCommand(command) {
32000 return !(command.cmd === CommandType.direct || command.cmd === CommandType.session && command.op === OpType.open || command.cmd === CommandType.conv && (command.op === OpType.start || command.op === OpType.update || command.op === OpType.members));
32001};
32002
32003var Connection = /*#__PURE__*/function (_WebSocketPlus) {
32004 _inheritsLoose(Connection, _WebSocketPlus);
32005
32006 function Connection(getUrl, _ref) {
32007 var _context16;
32008
32009 var _this;
32010
32011 var format = _ref.format,
32012 version = _ref.version;
32013 debug$4('initializing Connection');
32014 var protocolString = (0, _concat.default)(_context16 = "lc.".concat(format, ".")).call(_context16, version);
32015 _this = _WebSocketPlus.call(this, getUrl, protocolString) || this;
32016 _this._protocolFormat = format;
32017 _this._commands = {};
32018 _this._serialId = 0;
32019 return _this;
32020 }
32021
32022 var _proto = Connection.prototype;
32023
32024 _proto.send = /*#__PURE__*/function () {
32025 var _send = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(command) {
32026 var _this2 = this;
32027
32028 var waitingForRespond,
32029 buffer,
32030 serialId,
32031 duplicatedCommand,
32032 message,
32033 promise,
32034 _args = arguments;
32035 return _regeneratorRuntime.wrap(function _callee$(_context) {
32036 var _context17, _context18;
32037
32038 while (1) {
32039 switch (_context.prev = _context.next) {
32040 case 0:
32041 waitingForRespond = _args.length > 1 && _args[1] !== undefined ? _args[1] : true;
32042
32043 if (!waitingForRespond) {
32044 _context.next = 11;
32045 break;
32046 }
32047
32048 if (!isIdempotentCommand(command)) {
32049 _context.next = 8;
32050 break;
32051 }
32052
32053 buffer = command.toArrayBuffer();
32054 duplicatedCommand = (0, _find.default)(_context17 = values(this._commands)).call(_context17, function (_ref2) {
32055 var targetBuffer = _ref2.buffer,
32056 targetCommand = _ref2.command;
32057 return targetCommand.cmd === command.cmd && targetCommand.op === command.op && equalBuffer(targetBuffer, buffer);
32058 });
32059
32060 if (!duplicatedCommand) {
32061 _context.next = 8;
32062 break;
32063 }
32064
32065 console.warn((0, _concat.default)(_context18 = "Duplicated command [cmd:".concat(command.cmd, " op:")).call(_context18, command.op, "] is throttled."));
32066 return _context.abrupt("return", duplicatedCommand.promise);
32067
32068 case 8:
32069 this._serialId += 1;
32070 serialId = this._serialId;
32071 command.i = serialId;
32072 // eslint-disable-line no-param-reassign
32073
32074 case 11:
32075 if (debug$4.enabled) debug$4('↑ %O sent', trim(command));
32076
32077 if (this._protocolFormat === 'proto2base64') {
32078 message = command.toBase64();
32079 } else if (command.toArrayBuffer) {
32080 message = command.toArrayBuffer();
32081 }
32082
32083 if (message) {
32084 _context.next = 15;
32085 break;
32086 }
32087
32088 throw new TypeError("".concat(command, " is not a GenericCommand"));
32089
32090 case 15:
32091 _WebSocketPlus.prototype.send.call(this, message);
32092
32093 if (waitingForRespond) {
32094 _context.next = 18;
32095 break;
32096 }
32097
32098 return _context.abrupt("return", undefined);
32099
32100 case 18:
32101 promise = new _promise.default(function (resolve, reject) {
32102 _this2._commands[serialId] = {
32103 command: command,
32104 buffer: buffer,
32105 resolve: resolve,
32106 reject: reject,
32107 timeout: setTimeout(function () {
32108 if (_this2._commands[serialId]) {
32109 var _context19;
32110
32111 if (debug$4.enabled) debug$4('✗ %O timeout', trim(command));
32112 reject(createError({
32113 error: (0, _concat.default)(_context19 = "Command Timeout [cmd:".concat(command.cmd, " op:")).call(_context19, command.op, "]"),
32114 name: 'COMMAND_TIMEOUT'
32115 }));
32116 delete _this2._commands[serialId];
32117 }
32118 }, COMMAND_TIMEOUT)
32119 };
32120 });
32121 this._commands[serialId].promise = promise;
32122 return _context.abrupt("return", promise);
32123
32124 case 21:
32125 case "end":
32126 return _context.stop();
32127 }
32128 }
32129 }, _callee, this);
32130 }));
32131
32132 function send(_x) {
32133 return _send.apply(this, arguments);
32134 }
32135
32136 return send;
32137 }();
32138
32139 _proto.handleMessage = function handleMessage(msg) {
32140 var message;
32141
32142 try {
32143 message = GenericCommand.decode(msg);
32144 if (debug$4.enabled) debug$4('↓ %O received', trim(message));
32145 } catch (e) {
32146 console.warn('Decode message failed:', e.message, msg);
32147 return;
32148 }
32149
32150 var serialId = message.i;
32151
32152 if (serialId) {
32153 if (this._commands[serialId]) {
32154 clearTimeout(this._commands[serialId].timeout);
32155
32156 if (message.cmd === CommandType.error) {
32157 this._commands[serialId].reject(createError(message.errorMessage));
32158 } else {
32159 this._commands[serialId].resolve(message);
32160 }
32161
32162 delete this._commands[serialId];
32163 } else {
32164 console.warn("Unexpected command received with serialId [".concat(serialId, "],\n which have timed out or never been requested."));
32165 }
32166 } else {
32167 switch (message.cmd) {
32168 case CommandType.error:
32169 {
32170 this.emit(ERROR, createError(message.errorMessage));
32171 return;
32172 }
32173
32174 case CommandType.goaway:
32175 {
32176 this.emit(EXPIRE);
32177 return;
32178 }
32179
32180 default:
32181 {
32182 this.emit(MESSAGE, message);
32183 }
32184 }
32185 }
32186 };
32187
32188 _proto.ping = function ping() {
32189 return this.send(new GenericCommand({
32190 cmd: CommandType.echo
32191 }))["catch"](function (error) {
32192 return debug$4('ping failed:', error);
32193 });
32194 };
32195
32196 return Connection;
32197}(WebSocketPlus);
32198
32199var debug$5 = d('LC:request');
32200
32201var request = function request(_ref) {
32202 var _ref$method = _ref.method,
32203 method = _ref$method === void 0 ? 'GET' : _ref$method,
32204 _url = _ref.url,
32205 query = _ref.query,
32206 headers = _ref.headers,
32207 data = _ref.data,
32208 time = _ref.timeout;
32209 var url = _url;
32210
32211 if (query) {
32212 var _context20, _context21, _context23;
32213
32214 var queryString = (0, _filter.default)(_context20 = (0, _map.default)(_context21 = (0, _keys.default)(query)).call(_context21, function (key) {
32215 var _context22;
32216
32217 var value = query[key];
32218 if (value === undefined) return undefined;
32219 var v = isPlainObject(value) ? (0, _stringify.default)(value) : value;
32220 return (0, _concat.default)(_context22 = "".concat(encodeURIComponent(key), "=")).call(_context22, encodeURIComponent(v));
32221 })).call(_context20, function (qs) {
32222 return qs;
32223 }).join('&');
32224 url = (0, _concat.default)(_context23 = "".concat(url, "?")).call(_context23, queryString);
32225 }
32226
32227 debug$5('Req: %O %O %O', method, url, {
32228 headers: headers,
32229 data: data
32230 });
32231 var request = getAdapter('request');
32232 var promise = request(url, {
32233 method: method,
32234 headers: headers,
32235 data: data
32236 }).then(function (response) {
32237 if (response.ok === false) {
32238 var error = createError(response.data);
32239 error.response = response;
32240 throw error;
32241 }
32242
32243 debug$5('Res: %O %O %O', url, response.status, response.data);
32244 return response.data;
32245 })["catch"](function (error) {
32246 if (error.response) {
32247 debug$5('Error: %O %O %O', url, error.response.status, error.response.data);
32248 }
32249
32250 throw error;
32251 });
32252 return time ? promiseTimeout.timeout(promise, time) : promise;
32253};
32254
32255var applyDecorators = function applyDecorators(decorators, target) {
32256 if (decorators) {
32257 decorators.forEach(function (decorator) {
32258 try {
32259 decorator(target);
32260 } catch (error) {
32261 if (decorator._pluginName) {
32262 error.message += "[".concat(decorator._pluginName, "]");
32263 }
32264
32265 throw error;
32266 }
32267 });
32268 }
32269};
32270
32271var applyDispatcher = function applyDispatcher(dispatchers, payload) {
32272 var _context24;
32273
32274 return (0, _reduce.default)(_context24 = ensureArray(dispatchers)).call(_context24, function (resultPromise, dispatcher) {
32275 return resultPromise.then(function (shouldDispatch) {
32276 return shouldDispatch === false ? false : dispatcher.apply(void 0, _toConsumableArray(payload));
32277 })["catch"](function (error) {
32278 if (dispatcher._pluginName) {
32279 // eslint-disable-next-line no-param-reassign
32280 error.message += "[".concat(dispatcher._pluginName, "]");
32281 }
32282
32283 throw error;
32284 });
32285 }, _promise.default.resolve(true));
32286};
32287
32288var version = "5.0.0-rc.8";
32289var _excluded = ["plugins"];
32290
32291function ownKeys$2(object, enumerableOnly) {
32292 var keys = (0, _keys.default)(object);
32293
32294 if (_getOwnPropertySymbols.default) {
32295 var symbols = (0, _getOwnPropertySymbols.default)(object);
32296 enumerableOnly && (symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
32297 return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
32298 })), keys.push.apply(keys, symbols);
32299 }
32300
32301 return keys;
32302}
32303
32304function _objectSpread$2(target) {
32305 for (var i = 1; i < arguments.length; i++) {
32306 var source = null != arguments[i] ? arguments[i] : {};
32307 i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) {
32308 _defineProperty(target, key, source[key]);
32309 }) : _getOwnPropertyDescriptors.default ? (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source)) : ownKeys$2(Object(source)).forEach(function (key) {
32310 (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
32311 });
32312 }
32313
32314 return target;
32315}
32316
32317var debug$6 = d('LC:Realtime');
32318var routerCache = new Cache('push-router');
32319var initializedApp = {};
32320
32321var Realtime = /*#__PURE__*/function (_EventEmitter) {
32322 _inheritsLoose(Realtime, _EventEmitter);
32323 /**
32324 * @extends EventEmitter
32325 * @param {Object} options
32326 * @param {String} options.appId
32327 * @param {String} options.appKey (since 4.0.0)
32328 * @param {String|Object} [options.server] 指定服务器域名,中国节点应用此参数必填(since 4.0.0)
32329 * @param {Boolean} [options.noBinary=false] 设置 WebSocket 使用字符串格式收发消息(默认为二进制格式)。
32330 * 适用于 WebSocket 实现不支持二进制数据格式的情况
32331 * @param {Boolean} [options.ssl=true] 使用 wss 进行连接
32332 * @param {String|String[]} [options.RTMServers] 指定私有部署的 RTM 服务器地址(since 4.0.0)
32333 * @param {Plugin[]} [options.plugins] 加载插件(since 3.1.0)
32334 */
32335
32336
32337 function Realtime(_ref) {
32338 var _context25;
32339
32340 var _this2;
32341
32342 var plugins = _ref.plugins,
32343 options = _objectWithoutProperties(_ref, _excluded);
32344
32345 debug$6('initializing Realtime %s %O', version, options);
32346 _this2 = _EventEmitter.call(this) || this;
32347 var appId = options.appId;
32348
32349 if (typeof appId !== 'string') {
32350 throw new TypeError("appId [".concat(appId, "] is not a string"));
32351 }
32352
32353 if (initializedApp[appId]) {
32354 throw new Error("App [".concat(appId, "] is already initialized."));
32355 }
32356
32357 initializedApp[appId] = true;
32358
32359 if (typeof options.appKey !== 'string') {
32360 throw new TypeError("appKey [".concat(options.appKey, "] is not a string"));
32361 }
32362
32363 if (isCNApp(appId)) {
32364 if (!options.server) {
32365 throw new TypeError("server option is required for apps from CN region");
32366 }
32367 }
32368
32369 _this2._options = _objectSpread$2({
32370 appId: undefined,
32371 appKey: undefined,
32372 noBinary: false,
32373 ssl: true,
32374 RTMServerName: typeof process !== 'undefined' ? process.env.RTM_SERVER_NAME : undefined
32375 }, options);
32376 _this2._cache = new Cache('endpoints');
32377
32378 var _this = internal(_assertThisInitialized(_this2));
32379
32380 _this.clients = new _set.default();
32381 _this.pendingClients = new _set.default();
32382 var mergedPlugins = (0, _concat.default)(_context25 = []).call(_context25, _toConsumableArray(ensureArray(Realtime.__preRegisteredPlugins)), _toConsumableArray(ensureArray(plugins)));
32383 debug$6('Using plugins %o', (0, _map.default)(mergedPlugins).call(mergedPlugins, function (plugin) {
32384 return plugin.name;
32385 }));
32386 _this2._plugins = (0, _reduce.default)(mergedPlugins).call(mergedPlugins, function (result, plugin) {
32387 (0, _keys.default)(plugin).forEach(function (hook) {
32388 if ({}.hasOwnProperty.call(plugin, hook) && hook !== 'name') {
32389 var _context26;
32390
32391 if (plugin.name) {
32392 ensureArray(plugin[hook]).forEach(function (value) {
32393 // eslint-disable-next-line no-param-reassign
32394 value._pluginName = plugin.name;
32395 });
32396 } // eslint-disable-next-line no-param-reassign
32397
32398
32399 result[hook] = (0, _concat.default)(_context26 = ensureArray(result[hook])).call(_context26, plugin[hook]);
32400 }
32401 });
32402 return result;
32403 }, {}); // onRealtimeCreate hook
32404
32405 applyDecorators(_this2._plugins.onRealtimeCreate, _assertThisInitialized(_this2));
32406 return _this2;
32407 }
32408
32409 var _proto = Realtime.prototype;
32410
32411 _proto._request = /*#__PURE__*/function () {
32412 var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
32413 var method, _url, _ref2$version, version, path, query, headers, data, url, _this$_options, appId, server, _yield$this$construct, api;
32414
32415 return _regeneratorRuntime.wrap(function _callee$(_context) {
32416 var _context27, _context28;
32417
32418 while (1) {
32419 switch (_context.prev = _context.next) {
32420 case 0:
32421 method = _ref2.method, _url = _ref2.url, _ref2$version = _ref2.version, version = _ref2$version === void 0 ? '1.1' : _ref2$version, path = _ref2.path, query = _ref2.query, headers = _ref2.headers, data = _ref2.data;
32422 url = _url;
32423
32424 if (url) {
32425 _context.next = 9;
32426 break;
32427 }
32428
32429 _this$_options = this._options, appId = _this$_options.appId, server = _this$_options.server;
32430 _context.next = 6;
32431 return this.constructor._getServerUrls({
32432 appId: appId,
32433 server: server
32434 });
32435
32436 case 6:
32437 _yield$this$construct = _context.sent;
32438 api = _yield$this$construct.api;
32439 url = (0, _concat.default)(_context27 = (0, _concat.default)(_context28 = "".concat(api, "/")).call(_context28, version)).call(_context27, path);
32440
32441 case 9:
32442 return _context.abrupt("return", request({
32443 url: url,
32444 method: method,
32445 query: query,
32446 headers: _objectSpread$2({
32447 'X-LC-Id': this._options.appId,
32448 'X-LC-Key': this._options.appKey
32449 }, headers),
32450 data: data
32451 }));
32452
32453 case 10:
32454 case "end":
32455 return _context.stop();
32456 }
32457 }
32458 }, _callee, this);
32459 }));
32460
32461 function _request(_x) {
32462 return _request2.apply(this, arguments);
32463 }
32464
32465 return _request;
32466 }();
32467
32468 _proto._open = function _open() {
32469 var _this3 = this;
32470
32471 if (this._openPromise) return this._openPromise;
32472 var format = 'protobuf2';
32473
32474 if (this._options.noBinary) {
32475 // 不发送 binary data,fallback to base64 string
32476 format = 'proto2base64';
32477 }
32478
32479 var version = 3;
32480 var protocol = {
32481 format: format,
32482 version: version
32483 };
32484 this._openPromise = new _promise.default(function (resolve, reject) {
32485 debug$6('No connection established, create a new one.');
32486 var connection = new Connection(function () {
32487 return _this3._getRTMServers(_this3._options);
32488 }, protocol);
32489 connection.on(OPEN, function () {
32490 return resolve(connection);
32491 }).on(ERROR, function (error) {
32492 delete _this3._openPromise;
32493 reject(error);
32494 }).on(EXPIRE, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
32495 return _regeneratorRuntime.wrap(function _callee2$(_context2) {
32496 while (1) {
32497 switch (_context2.prev = _context2.next) {
32498 case 0:
32499 debug$6('Connection expired. Refresh endpoints.');
32500
32501 _this3._cache.set('endpoints', null, 0);
32502
32503 _context2.next = 4;
32504 return _this3._getRTMServers(_this3._options);
32505
32506 case 4:
32507 connection.urls = _context2.sent;
32508 connection.disconnect();
32509
32510 case 6:
32511 case "end":
32512 return _context2.stop();
32513 }
32514 }
32515 }, _callee2);
32516 }))).on(MESSAGE, _this3._dispatchCommand.bind(_this3));
32517 /**
32518 * 连接断开。
32519 * 连接断开可能是因为 SDK 进入了离线状态(see {@link Realtime#event:OFFLINE}),或长时间没有收到服务器心跳。
32520 * 连接断开后所有的网络操作都会失败,请在连接断开后禁用相关的 UI 元素。
32521 * @event Realtime#DISCONNECT
32522 */
32523
32524 /**
32525 * 计划在一段时间后尝试重新连接
32526 * @event Realtime#SCHEDULE
32527 * @param {Number} attempt 尝试重连的次数
32528 * @param {Number} delay 延迟的毫秒数
32529 */
32530
32531 /**
32532 * 正在尝试重新连接
32533 * @event Realtime#RETRY
32534 * @param {Number} attempt 尝试重连的次数
32535 */
32536
32537 /**
32538 * 连接恢复正常。
32539 * 请重新启用在 {@link Realtime#event:DISCONNECT} 事件中禁用的相关 UI 元素
32540 * @event Realtime#RECONNECT
32541 */
32542
32543 /**
32544 * 客户端连接断开
32545 * @event IMClient#DISCONNECT
32546 * @see Realtime#event:DISCONNECT
32547 * @since 3.2.0
32548 */
32549
32550 /**
32551 * 计划在一段时间后尝试重新连接
32552 * @event IMClient#SCHEDULE
32553 * @param {Number} attempt 尝试重连的次数
32554 * @param {Number} delay 延迟的毫秒数
32555 * @since 3.2.0
32556 */
32557
32558 /**
32559 * 正在尝试重新连接
32560 * @event IMClient#RETRY
32561 * @param {Number} attempt 尝试重连的次数
32562 * @since 3.2.0
32563 */
32564
32565 /**
32566 * 客户端进入离线状态。
32567 * 这通常意味着网络已断开,或者 {@link Realtime#pause} 被调用
32568 * @event Realtime#OFFLINE
32569 * @since 3.4.0
32570 */
32571
32572 /**
32573 * 客户端恢复在线状态
32574 * 这通常意味着网络已恢复,或者 {@link Realtime#resume} 被调用
32575 * @event Realtime#ONLINE
32576 * @since 3.4.0
32577 */
32578
32579 /**
32580 * 进入离线状态。
32581 * 这通常意味着网络已断开,或者 {@link Realtime#pause} 被调用
32582 * @event IMClient#OFFLINE
32583 * @since 3.4.0
32584 */
32585
32586 /**
32587 * 恢复在线状态
32588 * 这通常意味着网络已恢复,或者 {@link Realtime#resume} 被调用
32589 * @event IMClient#ONLINE
32590 * @since 3.4.0
32591 */
32592 // event proxy
32593
32594 [DISCONNECT, RECONNECT, RETRY, SCHEDULE, OFFLINE, ONLINE].forEach(function (event) {
32595 return connection.on(event, function () {
32596 var _context29;
32597
32598 for (var _len = arguments.length, payload = new Array(_len), _key = 0; _key < _len; _key++) {
32599 payload[_key] = arguments[_key];
32600 }
32601
32602 debug$6("".concat(event, " event emitted. %o"), payload);
32603
32604 _this3.emit.apply(_this3, (0, _concat.default)(_context29 = [event]).call(_context29, payload));
32605
32606 if (event !== RECONNECT) {
32607 internal(_this3).clients.forEach(function (client) {
32608 var _context30;
32609
32610 client.emit.apply(client, (0, _concat.default)(_context30 = [event]).call(_context30, payload));
32611 });
32612 }
32613 });
32614 }); // override handleClose
32615
32616 connection.handleClose = function handleClose(event) {
32617 var isFatal = [ErrorCode.APP_NOT_AVAILABLE, ErrorCode.INVALID_LOGIN, ErrorCode.INVALID_ORIGIN].some(function (errorCode) {
32618 return errorCode === event.code;
32619 });
32620
32621 if (isFatal) {
32622 // in these cases, SDK should throw.
32623 this["throw"](createError(event));
32624 } else {
32625 // reconnect
32626 this.disconnect();
32627 }
32628 };
32629
32630 internal(_this3).connection = connection;
32631 });
32632 return this._openPromise;
32633 };
32634
32635 _proto._getRTMServers = /*#__PURE__*/function () {
32636 var _getRTMServers2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(options) {
32637 var info, cachedEndPoints, _info, server, secondary, ttl;
32638
32639 return _regeneratorRuntime.wrap(function _callee3$(_context3) {
32640 while (1) {
32641 switch (_context3.prev = _context3.next) {
32642 case 0:
32643 if (!options.RTMServers) {
32644 _context3.next = 2;
32645 break;
32646 }
32647
32648 return _context3.abrupt("return", shuffle(ensureArray(options.RTMServers)));
32649
32650 case 2:
32651 cachedEndPoints = this._cache.get('endpoints');
32652
32653 if (!cachedEndPoints) {
32654 _context3.next = 7;
32655 break;
32656 }
32657
32658 info = cachedEndPoints;
32659 _context3.next = 14;
32660 break;
32661
32662 case 7:
32663 _context3.next = 9;
32664 return this.constructor._fetchRTMServers(options);
32665
32666 case 9:
32667 info = _context3.sent;
32668 _info = info, server = _info.server, secondary = _info.secondary, ttl = _info.ttl;
32669
32670 if (!(typeof server !== 'string' && typeof secondary !== 'string' && typeof ttl !== 'number')) {
32671 _context3.next = 13;
32672 break;
32673 }
32674
32675 throw new Error("malformed RTM route response: ".concat((0, _stringify.default)(info)));
32676
32677 case 13:
32678 this._cache.set('endpoints', info, info.ttl * 1000);
32679
32680 case 14:
32681 debug$6('endpoint info: %O', info);
32682 return _context3.abrupt("return", [info.server, info.secondary]);
32683
32684 case 16:
32685 case "end":
32686 return _context3.stop();
32687 }
32688 }
32689 }, _callee3, this);
32690 }));
32691
32692 function _getRTMServers(_x2) {
32693 return _getRTMServers2.apply(this, arguments);
32694 }
32695
32696 return _getRTMServers;
32697 }();
32698
32699 Realtime._getServerUrls = /*#__PURE__*/function () {
32700 var _getServerUrls2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref4) {
32701 var appId, server, cachedRouter, defaultProtocol;
32702 return _regeneratorRuntime.wrap(function _callee4$(_context4) {
32703 while (1) {
32704 switch (_context4.prev = _context4.next) {
32705 case 0:
32706 appId = _ref4.appId, server = _ref4.server;
32707 debug$6('fetch server urls');
32708
32709 if (!server) {
32710 _context4.next = 6;
32711 break;
32712 }
32713
32714 if (!(typeof server !== 'string')) {
32715 _context4.next = 5;
32716 break;
32717 }
32718
32719 return _context4.abrupt("return", server);
32720
32721 case 5:
32722 return _context4.abrupt("return", {
32723 RTMRouter: server,
32724 api: server
32725 });
32726
32727 case 6:
32728 cachedRouter = routerCache.get(appId);
32729
32730 if (!cachedRouter) {
32731 _context4.next = 9;
32732 break;
32733 }
32734
32735 return _context4.abrupt("return", cachedRouter);
32736
32737 case 9:
32738 defaultProtocol = 'https://';
32739 return _context4.abrupt("return", request({
32740 url: 'https://app-router.com/2/route',
32741 query: {
32742 appId: appId
32743 },
32744 timeout: 20000
32745 }).then(tap(debug$6)).then(function (_ref5) {
32746 var _context31, _context32;
32747
32748 var RTMRouterServer = _ref5.rtm_router_server,
32749 APIServer = _ref5.api_server,
32750 _ref5$ttl = _ref5.ttl,
32751 ttl = _ref5$ttl === void 0 ? 3600 : _ref5$ttl;
32752
32753 if (!RTMRouterServer) {
32754 throw new Error('rtm router not exists');
32755 }
32756
32757 var serverUrls = {
32758 RTMRouter: (0, _concat.default)(_context31 = "".concat(defaultProtocol)).call(_context31, RTMRouterServer),
32759 api: (0, _concat.default)(_context32 = "".concat(defaultProtocol)).call(_context32, APIServer)
32760 };
32761 routerCache.set(appId, serverUrls, ttl * 1000);
32762 return serverUrls;
32763 })["catch"](function () {
32764 var _context33, _context34, _context35, _context36;
32765
32766 var id = (0, _slice.default)(appId).call(appId, 0, 8).toLowerCase();
32767 var domain = 'lncldglobal.com';
32768 return {
32769 RTMRouter: (0, _concat.default)(_context33 = (0, _concat.default)(_context34 = "".concat(defaultProtocol)).call(_context34, id, ".rtm.")).call(_context33, domain),
32770 api: (0, _concat.default)(_context35 = (0, _concat.default)(_context36 = "".concat(defaultProtocol)).call(_context36, id, ".api.")).call(_context35, domain)
32771 };
32772 }));
32773
32774 case 11:
32775 case "end":
32776 return _context4.stop();
32777 }
32778 }
32779 }, _callee4);
32780 }));
32781
32782 function _getServerUrls(_x3) {
32783 return _getServerUrls2.apply(this, arguments);
32784 }
32785
32786 return _getServerUrls;
32787 }();
32788
32789 Realtime._fetchRTMServers = function _fetchRTMServers(_ref6) {
32790 var appId = _ref6.appId,
32791 ssl = _ref6.ssl,
32792 server = _ref6.server,
32793 RTMServerName = _ref6.RTMServerName;
32794 debug$6('fetch endpoint info');
32795 return this._getServerUrls({
32796 appId: appId,
32797 server: server
32798 }).then(tap(debug$6)).then(function (_ref7) {
32799 var RTMRouter = _ref7.RTMRouter;
32800 return request({
32801 url: "".concat(RTMRouter, "/v1/route"),
32802 query: {
32803 appId: appId,
32804 secure: ssl,
32805 features: isWeapp ? 'wechat' : undefined,
32806 server: RTMServerName,
32807 _t: Date.now()
32808 },
32809 timeout: 20000
32810 }).then(tap(debug$6));
32811 });
32812 };
32813
32814 _proto._close = function _close() {
32815 if (this._openPromise) {
32816 this._openPromise.then(function (connection) {
32817 return connection.close();
32818 });
32819 }
32820
32821 delete this._openPromise;
32822 }
32823 /**
32824 * 手动进行重连。
32825 * SDK 在网络出现异常时会自动按照一定的时间间隔尝试重连,调用该方法会立即尝试重连并重置重连尝试计数器。
32826 * 只能在 `SCHEDULE` 事件之后,`RETRY` 事件之前调用,如果当前网络正常或者正在进行重连,调用该方法会抛异常。
32827 */
32828 ;
32829
32830 _proto.retry = function retry() {
32831 var _internal = internal(this),
32832 connection = _internal.connection;
32833
32834 if (!connection) {
32835 throw new Error('no connection established');
32836 }
32837
32838 if (connection.cannot('retry')) {
32839 throw new Error("retrying not allowed when not disconnected. the connection is now ".concat(connection.current));
32840 }
32841
32842 return connection.retry();
32843 }
32844 /**
32845 * 暂停,使 SDK 进入离线状态。
32846 * 你可以在网络断开、应用进入后台等时刻调用该方法让 SDK 进入离线状态,离线状态下不会尝试重连。
32847 * 在浏览器中 SDK 会自动监听网络变化,因此无需手动调用该方法。
32848 *
32849 * @since 3.4.0
32850 * @see Realtime#event:OFFLINE
32851 */
32852 ;
32853
32854 _proto.pause = function pause() {
32855 // 这个方法常常在网络断开、进入后台时被调用,此时 connection 可能没有建立或者已经 close。
32856 // 因此不像 retry,这个方法应该尽可能 loose
32857 var _internal2 = internal(this),
32858 connection = _internal2.connection;
32859
32860 if (!connection) return;
32861 if (connection.can('pause')) connection.pause();
32862 }
32863 /**
32864 * 恢复在线状态。
32865 * 你可以在网络恢复、应用回到前台等时刻调用该方法让 SDK 恢复在线状态,恢复在线状态后 SDK 会开始尝试重连。
32866 *
32867 * @since 3.4.0
32868 * @see Realtime#event:ONLINE
32869 */
32870 ;
32871
32872 _proto.resume = function resume() {
32873 // 与 pause 一样,这个方法应该尽可能 loose
32874 var _internal3 = internal(this),
32875 connection = _internal3.connection;
32876
32877 if (!connection) return;
32878 if (connection.can('resume')) connection.resume();
32879 };
32880
32881 _proto._registerPending = function _registerPending(value) {
32882 internal(this).pendingClients.add(value);
32883 };
32884
32885 _proto._deregisterPending = function _deregisterPending(client) {
32886 internal(this).pendingClients["delete"](client);
32887 };
32888
32889 _proto._register = function _register(client) {
32890 internal(this).clients.add(client);
32891 };
32892
32893 _proto._deregister = function _deregister(client) {
32894 var _this = internal(this);
32895
32896 _this.clients["delete"](client);
32897
32898 if (_this.clients.size + _this.pendingClients.size === 0) {
32899 this._close();
32900 }
32901 };
32902
32903 _proto._dispatchCommand = function _dispatchCommand(command) {
32904 return applyDispatcher(this._plugins.beforeCommandDispatch, [command, this]).then(function (shouldDispatch) {
32905 // no plugin handled this command
32906 if (shouldDispatch) return debug$6('[WARN] Unexpected message received: %O', trim(command));
32907 return false;
32908 });
32909 };
32910
32911 return Realtime;
32912}(EventEmitter); // For test purpose only
32913
32914
32915var polyfilledPromise = _promise.default;
32916exports.EventEmitter = EventEmitter;
32917exports.Promise = polyfilledPromise;
32918exports.Protocals = message;
32919exports.Protocols = message;
32920exports.Realtime = Realtime;
32921exports.debug = debug$2;
32922exports.getAdapter = getAdapter;
32923exports.setAdapters = setAdapters;
32924/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(78)))
32925
32926/***/ }),
32927/* 624 */
32928/***/ (function(module, exports, __webpack_require__) {
32929
32930module.exports = __webpack_require__(625);
32931
32932/***/ }),
32933/* 625 */
32934/***/ (function(module, exports, __webpack_require__) {
32935
32936var parent = __webpack_require__(626);
32937
32938module.exports = parent;
32939
32940
32941/***/ }),
32942/* 626 */
32943/***/ (function(module, exports, __webpack_require__) {
32944
32945__webpack_require__(627);
32946var path = __webpack_require__(7);
32947
32948module.exports = path.Object.freeze;
32949
32950
32951/***/ }),
32952/* 627 */
32953/***/ (function(module, exports, __webpack_require__) {
32954
32955var $ = __webpack_require__(0);
32956var FREEZING = __webpack_require__(264);
32957var fails = __webpack_require__(2);
32958var isObject = __webpack_require__(11);
32959var onFreeze = __webpack_require__(97).onFreeze;
32960
32961// eslint-disable-next-line es-x/no-object-freeze -- safe
32962var $freeze = Object.freeze;
32963var FAILS_ON_PRIMITIVES = fails(function () { $freeze(1); });
32964
32965// `Object.freeze` method
32966// https://tc39.es/ecma262/#sec-object.freeze
32967$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !FREEZING }, {
32968 freeze: function freeze(it) {
32969 return $freeze && isObject(it) ? $freeze(onFreeze(it)) : it;
32970 }
32971});
32972
32973
32974/***/ }),
32975/* 628 */
32976/***/ (function(module, exports, __webpack_require__) {
32977
32978// FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it
32979var fails = __webpack_require__(2);
32980
32981module.exports = fails(function () {
32982 if (typeof ArrayBuffer == 'function') {
32983 var buffer = new ArrayBuffer(8);
32984 // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-defineproperty -- safe
32985 if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 });
32986 }
32987});
32988
32989
32990/***/ }),
32991/* 629 */
32992/***/ (function(module, exports, __webpack_require__) {
32993
32994var parent = __webpack_require__(630);
32995
32996module.exports = parent;
32997
32998
32999/***/ }),
33000/* 630 */
33001/***/ (function(module, exports, __webpack_require__) {
33002
33003__webpack_require__(631);
33004var path = __webpack_require__(7);
33005
33006module.exports = path.Object.assign;
33007
33008
33009/***/ }),
33010/* 631 */
33011/***/ (function(module, exports, __webpack_require__) {
33012
33013var $ = __webpack_require__(0);
33014var assign = __webpack_require__(632);
33015
33016// `Object.assign` method
33017// https://tc39.es/ecma262/#sec-object.assign
33018// eslint-disable-next-line es-x/no-object-assign -- required for testing
33019$({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
33020 assign: assign
33021});
33022
33023
33024/***/ }),
33025/* 632 */
33026/***/ (function(module, exports, __webpack_require__) {
33027
33028"use strict";
33029
33030var DESCRIPTORS = __webpack_require__(14);
33031var uncurryThis = __webpack_require__(4);
33032var call = __webpack_require__(15);
33033var fails = __webpack_require__(2);
33034var objectKeys = __webpack_require__(107);
33035var getOwnPropertySymbolsModule = __webpack_require__(106);
33036var propertyIsEnumerableModule = __webpack_require__(122);
33037var toObject = __webpack_require__(33);
33038var IndexedObject = __webpack_require__(98);
33039
33040// eslint-disable-next-line es-x/no-object-assign -- safe
33041var $assign = Object.assign;
33042// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
33043var defineProperty = Object.defineProperty;
33044var concat = uncurryThis([].concat);
33045
33046// `Object.assign` method
33047// https://tc39.es/ecma262/#sec-object.assign
33048module.exports = !$assign || fails(function () {
33049 // should have correct order of operations (Edge bug)
33050 if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
33051 enumerable: true,
33052 get: function () {
33053 defineProperty(this, 'b', {
33054 value: 3,
33055 enumerable: false
33056 });
33057 }
33058 }), { b: 2 })).b !== 1) return true;
33059 // should work with symbols and should have deterministic property order (V8 bug)
33060 var A = {};
33061 var B = {};
33062 // eslint-disable-next-line es-x/no-symbol -- safe
33063 var symbol = Symbol();
33064 var alphabet = 'abcdefghijklmnopqrst';
33065 A[symbol] = 7;
33066 alphabet.split('').forEach(function (chr) { B[chr] = chr; });
33067 return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
33068}) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
33069 var T = toObject(target);
33070 var argumentsLength = arguments.length;
33071 var index = 1;
33072 var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
33073 var propertyIsEnumerable = propertyIsEnumerableModule.f;
33074 while (argumentsLength > index) {
33075 var S = IndexedObject(arguments[index++]);
33076 var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
33077 var length = keys.length;
33078 var j = 0;
33079 var key;
33080 while (length > j) {
33081 key = keys[j++];
33082 if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key];
33083 }
33084 } return T;
33085} : $assign;
33086
33087
33088/***/ }),
33089/* 633 */
33090/***/ (function(module, exports, __webpack_require__) {
33091
33092var parent = __webpack_require__(634);
33093
33094module.exports = parent;
33095
33096
33097/***/ }),
33098/* 634 */
33099/***/ (function(module, exports, __webpack_require__) {
33100
33101__webpack_require__(243);
33102var path = __webpack_require__(7);
33103
33104module.exports = path.Object.getOwnPropertySymbols;
33105
33106
33107/***/ }),
33108/* 635 */
33109/***/ (function(module, exports, __webpack_require__) {
33110
33111module.exports = __webpack_require__(636);
33112
33113/***/ }),
33114/* 636 */
33115/***/ (function(module, exports, __webpack_require__) {
33116
33117var parent = __webpack_require__(637);
33118
33119module.exports = parent;
33120
33121
33122/***/ }),
33123/* 637 */
33124/***/ (function(module, exports, __webpack_require__) {
33125
33126__webpack_require__(638);
33127var path = __webpack_require__(7);
33128
33129module.exports = path.Object.getOwnPropertyDescriptors;
33130
33131
33132/***/ }),
33133/* 638 */
33134/***/ (function(module, exports, __webpack_require__) {
33135
33136var $ = __webpack_require__(0);
33137var DESCRIPTORS = __webpack_require__(14);
33138var ownKeys = __webpack_require__(163);
33139var toIndexedObject = __webpack_require__(35);
33140var getOwnPropertyDescriptorModule = __webpack_require__(64);
33141var createProperty = __webpack_require__(93);
33142
33143// `Object.getOwnPropertyDescriptors` method
33144// https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
33145$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
33146 getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
33147 var O = toIndexedObject(object);
33148 var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
33149 var keys = ownKeys(O);
33150 var result = {};
33151 var index = 0;
33152 var key, descriptor;
33153 while (keys.length > index) {
33154 descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
33155 if (descriptor !== undefined) createProperty(result, key, descriptor);
33156 }
33157 return result;
33158 }
33159});
33160
33161
33162/***/ }),
33163/* 639 */
33164/***/ (function(module, exports, __webpack_require__) {
33165
33166module.exports = __webpack_require__(640);
33167
33168/***/ }),
33169/* 640 */
33170/***/ (function(module, exports, __webpack_require__) {
33171
33172var parent = __webpack_require__(641);
33173
33174module.exports = parent;
33175
33176
33177/***/ }),
33178/* 641 */
33179/***/ (function(module, exports, __webpack_require__) {
33180
33181__webpack_require__(642);
33182var path = __webpack_require__(7);
33183
33184var Object = path.Object;
33185
33186var defineProperties = module.exports = function defineProperties(T, D) {
33187 return Object.defineProperties(T, D);
33188};
33189
33190if (Object.defineProperties.sham) defineProperties.sham = true;
33191
33192
33193/***/ }),
33194/* 642 */
33195/***/ (function(module, exports, __webpack_require__) {
33196
33197var $ = __webpack_require__(0);
33198var DESCRIPTORS = __webpack_require__(14);
33199var defineProperties = __webpack_require__(130).f;
33200
33201// `Object.defineProperties` method
33202// https://tc39.es/ecma262/#sec-object.defineproperties
33203// eslint-disable-next-line es-x/no-object-defineproperties -- safe
33204$({ target: 'Object', stat: true, forced: Object.defineProperties !== defineProperties, sham: !DESCRIPTORS }, {
33205 defineProperties: defineProperties
33206});
33207
33208
33209/***/ }),
33210/* 643 */
33211/***/ (function(module, exports, __webpack_require__) {
33212
33213module.exports = __webpack_require__(644);
33214
33215/***/ }),
33216/* 644 */
33217/***/ (function(module, exports, __webpack_require__) {
33218
33219var parent = __webpack_require__(645);
33220__webpack_require__(46);
33221
33222module.exports = parent;
33223
33224
33225/***/ }),
33226/* 645 */
33227/***/ (function(module, exports, __webpack_require__) {
33228
33229__webpack_require__(43);
33230__webpack_require__(68);
33231__webpack_require__(646);
33232var path = __webpack_require__(7);
33233
33234module.exports = path.WeakMap;
33235
33236
33237/***/ }),
33238/* 646 */
33239/***/ (function(module, exports, __webpack_require__) {
33240
33241// TODO: Remove this module from `core-js@4` since it's replaced to module below
33242__webpack_require__(647);
33243
33244
33245/***/ }),
33246/* 647 */
33247/***/ (function(module, exports, __webpack_require__) {
33248
33249"use strict";
33250
33251var global = __webpack_require__(8);
33252var uncurryThis = __webpack_require__(4);
33253var defineBuiltIns = __webpack_require__(157);
33254var InternalMetadataModule = __webpack_require__(97);
33255var collection = __webpack_require__(268);
33256var collectionWeak = __webpack_require__(648);
33257var isObject = __webpack_require__(11);
33258var isExtensible = __webpack_require__(265);
33259var enforceInternalState = __webpack_require__(44).enforce;
33260var NATIVE_WEAK_MAP = __webpack_require__(169);
33261
33262var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
33263var InternalWeakMap;
33264
33265var wrapper = function (init) {
33266 return function WeakMap() {
33267 return init(this, arguments.length ? arguments[0] : undefined);
33268 };
33269};
33270
33271// `WeakMap` constructor
33272// https://tc39.es/ecma262/#sec-weakmap-constructor
33273var $WeakMap = collection('WeakMap', wrapper, collectionWeak);
33274
33275// IE11 WeakMap frozen keys fix
33276// We can't use feature detection because it crash some old IE builds
33277// https://github.com/zloirock/core-js/issues/485
33278if (NATIVE_WEAK_MAP && IS_IE11) {
33279 InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);
33280 InternalMetadataModule.enable();
33281 var WeakMapPrototype = $WeakMap.prototype;
33282 var nativeDelete = uncurryThis(WeakMapPrototype['delete']);
33283 var nativeHas = uncurryThis(WeakMapPrototype.has);
33284 var nativeGet = uncurryThis(WeakMapPrototype.get);
33285 var nativeSet = uncurryThis(WeakMapPrototype.set);
33286 defineBuiltIns(WeakMapPrototype, {
33287 'delete': function (key) {
33288 if (isObject(key) && !isExtensible(key)) {
33289 var state = enforceInternalState(this);
33290 if (!state.frozen) state.frozen = new InternalWeakMap();
33291 return nativeDelete(this, key) || state.frozen['delete'](key);
33292 } return nativeDelete(this, key);
33293 },
33294 has: function has(key) {
33295 if (isObject(key) && !isExtensible(key)) {
33296 var state = enforceInternalState(this);
33297 if (!state.frozen) state.frozen = new InternalWeakMap();
33298 return nativeHas(this, key) || state.frozen.has(key);
33299 } return nativeHas(this, key);
33300 },
33301 get: function get(key) {
33302 if (isObject(key) && !isExtensible(key)) {
33303 var state = enforceInternalState(this);
33304 if (!state.frozen) state.frozen = new InternalWeakMap();
33305 return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key);
33306 } return nativeGet(this, key);
33307 },
33308 set: function set(key, value) {
33309 if (isObject(key) && !isExtensible(key)) {
33310 var state = enforceInternalState(this);
33311 if (!state.frozen) state.frozen = new InternalWeakMap();
33312 nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value);
33313 } else nativeSet(this, key, value);
33314 return this;
33315 }
33316 });
33317}
33318
33319
33320/***/ }),
33321/* 648 */
33322/***/ (function(module, exports, __webpack_require__) {
33323
33324"use strict";
33325
33326var uncurryThis = __webpack_require__(4);
33327var defineBuiltIns = __webpack_require__(157);
33328var getWeakData = __webpack_require__(97).getWeakData;
33329var anObject = __webpack_require__(21);
33330var isObject = __webpack_require__(11);
33331var anInstance = __webpack_require__(110);
33332var iterate = __webpack_require__(41);
33333var ArrayIterationModule = __webpack_require__(75);
33334var hasOwn = __webpack_require__(13);
33335var InternalStateModule = __webpack_require__(44);
33336
33337var setInternalState = InternalStateModule.set;
33338var internalStateGetterFor = InternalStateModule.getterFor;
33339var find = ArrayIterationModule.find;
33340var findIndex = ArrayIterationModule.findIndex;
33341var splice = uncurryThis([].splice);
33342var id = 0;
33343
33344// fallback for uncaught frozen keys
33345var uncaughtFrozenStore = function (store) {
33346 return store.frozen || (store.frozen = new UncaughtFrozenStore());
33347};
33348
33349var UncaughtFrozenStore = function () {
33350 this.entries = [];
33351};
33352
33353var findUncaughtFrozen = function (store, key) {
33354 return find(store.entries, function (it) {
33355 return it[0] === key;
33356 });
33357};
33358
33359UncaughtFrozenStore.prototype = {
33360 get: function (key) {
33361 var entry = findUncaughtFrozen(this, key);
33362 if (entry) return entry[1];
33363 },
33364 has: function (key) {
33365 return !!findUncaughtFrozen(this, key);
33366 },
33367 set: function (key, value) {
33368 var entry = findUncaughtFrozen(this, key);
33369 if (entry) entry[1] = value;
33370 else this.entries.push([key, value]);
33371 },
33372 'delete': function (key) {
33373 var index = findIndex(this.entries, function (it) {
33374 return it[0] === key;
33375 });
33376 if (~index) splice(this.entries, index, 1);
33377 return !!~index;
33378 }
33379};
33380
33381module.exports = {
33382 getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
33383 var Constructor = wrapper(function (that, iterable) {
33384 anInstance(that, Prototype);
33385 setInternalState(that, {
33386 type: CONSTRUCTOR_NAME,
33387 id: id++,
33388 frozen: undefined
33389 });
33390 if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
33391 });
33392
33393 var Prototype = Constructor.prototype;
33394
33395 var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
33396
33397 var define = function (that, key, value) {
33398 var state = getInternalState(that);
33399 var data = getWeakData(anObject(key), true);
33400 if (data === true) uncaughtFrozenStore(state).set(key, value);
33401 else data[state.id] = value;
33402 return that;
33403 };
33404
33405 defineBuiltIns(Prototype, {
33406 // `{ WeakMap, WeakSet }.prototype.delete(key)` methods
33407 // https://tc39.es/ecma262/#sec-weakmap.prototype.delete
33408 // https://tc39.es/ecma262/#sec-weakset.prototype.delete
33409 'delete': function (key) {
33410 var state = getInternalState(this);
33411 if (!isObject(key)) return false;
33412 var data = getWeakData(key);
33413 if (data === true) return uncaughtFrozenStore(state)['delete'](key);
33414 return data && hasOwn(data, state.id) && delete data[state.id];
33415 },
33416 // `{ WeakMap, WeakSet }.prototype.has(key)` methods
33417 // https://tc39.es/ecma262/#sec-weakmap.prototype.has
33418 // https://tc39.es/ecma262/#sec-weakset.prototype.has
33419 has: function has(key) {
33420 var state = getInternalState(this);
33421 if (!isObject(key)) return false;
33422 var data = getWeakData(key);
33423 if (data === true) return uncaughtFrozenStore(state).has(key);
33424 return data && hasOwn(data, state.id);
33425 }
33426 });
33427
33428 defineBuiltIns(Prototype, IS_MAP ? {
33429 // `WeakMap.prototype.get(key)` method
33430 // https://tc39.es/ecma262/#sec-weakmap.prototype.get
33431 get: function get(key) {
33432 var state = getInternalState(this);
33433 if (isObject(key)) {
33434 var data = getWeakData(key);
33435 if (data === true) return uncaughtFrozenStore(state).get(key);
33436 return data ? data[state.id] : undefined;
33437 }
33438 },
33439 // `WeakMap.prototype.set(key, value)` method
33440 // https://tc39.es/ecma262/#sec-weakmap.prototype.set
33441 set: function set(key, value) {
33442 return define(this, key, value);
33443 }
33444 } : {
33445 // `WeakSet.prototype.add(value)` method
33446 // https://tc39.es/ecma262/#sec-weakset.prototype.add
33447 add: function add(value) {
33448 return define(this, value, true);
33449 }
33450 });
33451
33452 return Constructor;
33453 }
33454};
33455
33456
33457/***/ }),
33458/* 649 */
33459/***/ (function(module, exports, __webpack_require__) {
33460
33461var parent = __webpack_require__(650);
33462__webpack_require__(46);
33463
33464module.exports = parent;
33465
33466
33467/***/ }),
33468/* 650 */
33469/***/ (function(module, exports, __webpack_require__) {
33470
33471__webpack_require__(43);
33472__webpack_require__(68);
33473__webpack_require__(651);
33474__webpack_require__(70);
33475var path = __webpack_require__(7);
33476
33477module.exports = path.Set;
33478
33479
33480/***/ }),
33481/* 651 */
33482/***/ (function(module, exports, __webpack_require__) {
33483
33484// TODO: Remove this module from `core-js@4` since it's replaced to module below
33485__webpack_require__(652);
33486
33487
33488/***/ }),
33489/* 652 */
33490/***/ (function(module, exports, __webpack_require__) {
33491
33492"use strict";
33493
33494var collection = __webpack_require__(268);
33495var collectionStrong = __webpack_require__(653);
33496
33497// `Set` constructor
33498// https://tc39.es/ecma262/#sec-set-objects
33499collection('Set', function (init) {
33500 return function Set() { return init(this, arguments.length ? arguments[0] : undefined); };
33501}, collectionStrong);
33502
33503
33504/***/ }),
33505/* 653 */
33506/***/ (function(module, exports, __webpack_require__) {
33507
33508"use strict";
33509
33510var defineProperty = __webpack_require__(23).f;
33511var create = __webpack_require__(53);
33512var defineBuiltIns = __webpack_require__(157);
33513var bind = __webpack_require__(52);
33514var anInstance = __webpack_require__(110);
33515var iterate = __webpack_require__(41);
33516var defineIterator = __webpack_require__(134);
33517var setSpecies = __webpack_require__(172);
33518var DESCRIPTORS = __webpack_require__(14);
33519var fastKey = __webpack_require__(97).fastKey;
33520var InternalStateModule = __webpack_require__(44);
33521
33522var setInternalState = InternalStateModule.set;
33523var internalStateGetterFor = InternalStateModule.getterFor;
33524
33525module.exports = {
33526 getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
33527 var Constructor = wrapper(function (that, iterable) {
33528 anInstance(that, Prototype);
33529 setInternalState(that, {
33530 type: CONSTRUCTOR_NAME,
33531 index: create(null),
33532 first: undefined,
33533 last: undefined,
33534 size: 0
33535 });
33536 if (!DESCRIPTORS) that.size = 0;
33537 if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
33538 });
33539
33540 var Prototype = Constructor.prototype;
33541
33542 var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
33543
33544 var define = function (that, key, value) {
33545 var state = getInternalState(that);
33546 var entry = getEntry(that, key);
33547 var previous, index;
33548 // change existing entry
33549 if (entry) {
33550 entry.value = value;
33551 // create new entry
33552 } else {
33553 state.last = entry = {
33554 index: index = fastKey(key, true),
33555 key: key,
33556 value: value,
33557 previous: previous = state.last,
33558 next: undefined,
33559 removed: false
33560 };
33561 if (!state.first) state.first = entry;
33562 if (previous) previous.next = entry;
33563 if (DESCRIPTORS) state.size++;
33564 else that.size++;
33565 // add to index
33566 if (index !== 'F') state.index[index] = entry;
33567 } return that;
33568 };
33569
33570 var getEntry = function (that, key) {
33571 var state = getInternalState(that);
33572 // fast case
33573 var index = fastKey(key);
33574 var entry;
33575 if (index !== 'F') return state.index[index];
33576 // frozen object case
33577 for (entry = state.first; entry; entry = entry.next) {
33578 if (entry.key == key) return entry;
33579 }
33580 };
33581
33582 defineBuiltIns(Prototype, {
33583 // `{ Map, Set }.prototype.clear()` methods
33584 // https://tc39.es/ecma262/#sec-map.prototype.clear
33585 // https://tc39.es/ecma262/#sec-set.prototype.clear
33586 clear: function clear() {
33587 var that = this;
33588 var state = getInternalState(that);
33589 var data = state.index;
33590 var entry = state.first;
33591 while (entry) {
33592 entry.removed = true;
33593 if (entry.previous) entry.previous = entry.previous.next = undefined;
33594 delete data[entry.index];
33595 entry = entry.next;
33596 }
33597 state.first = state.last = undefined;
33598 if (DESCRIPTORS) state.size = 0;
33599 else that.size = 0;
33600 },
33601 // `{ Map, Set }.prototype.delete(key)` methods
33602 // https://tc39.es/ecma262/#sec-map.prototype.delete
33603 // https://tc39.es/ecma262/#sec-set.prototype.delete
33604 'delete': function (key) {
33605 var that = this;
33606 var state = getInternalState(that);
33607 var entry = getEntry(that, key);
33608 if (entry) {
33609 var next = entry.next;
33610 var prev = entry.previous;
33611 delete state.index[entry.index];
33612 entry.removed = true;
33613 if (prev) prev.next = next;
33614 if (next) next.previous = prev;
33615 if (state.first == entry) state.first = next;
33616 if (state.last == entry) state.last = prev;
33617 if (DESCRIPTORS) state.size--;
33618 else that.size--;
33619 } return !!entry;
33620 },
33621 // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods
33622 // https://tc39.es/ecma262/#sec-map.prototype.foreach
33623 // https://tc39.es/ecma262/#sec-set.prototype.foreach
33624 forEach: function forEach(callbackfn /* , that = undefined */) {
33625 var state = getInternalState(this);
33626 var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
33627 var entry;
33628 while (entry = entry ? entry.next : state.first) {
33629 boundFunction(entry.value, entry.key, this);
33630 // revert to the last existing entry
33631 while (entry && entry.removed) entry = entry.previous;
33632 }
33633 },
33634 // `{ Map, Set}.prototype.has(key)` methods
33635 // https://tc39.es/ecma262/#sec-map.prototype.has
33636 // https://tc39.es/ecma262/#sec-set.prototype.has
33637 has: function has(key) {
33638 return !!getEntry(this, key);
33639 }
33640 });
33641
33642 defineBuiltIns(Prototype, IS_MAP ? {
33643 // `Map.prototype.get(key)` method
33644 // https://tc39.es/ecma262/#sec-map.prototype.get
33645 get: function get(key) {
33646 var entry = getEntry(this, key);
33647 return entry && entry.value;
33648 },
33649 // `Map.prototype.set(key, value)` method
33650 // https://tc39.es/ecma262/#sec-map.prototype.set
33651 set: function set(key, value) {
33652 return define(this, key === 0 ? 0 : key, value);
33653 }
33654 } : {
33655 // `Set.prototype.add(value)` method
33656 // https://tc39.es/ecma262/#sec-set.prototype.add
33657 add: function add(value) {
33658 return define(this, value = value === 0 ? 0 : value, value);
33659 }
33660 });
33661 if (DESCRIPTORS) defineProperty(Prototype, 'size', {
33662 get: function () {
33663 return getInternalState(this).size;
33664 }
33665 });
33666 return Constructor;
33667 },
33668 setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) {
33669 var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
33670 var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
33671 var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
33672 // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods
33673 // https://tc39.es/ecma262/#sec-map.prototype.entries
33674 // https://tc39.es/ecma262/#sec-map.prototype.keys
33675 // https://tc39.es/ecma262/#sec-map.prototype.values
33676 // https://tc39.es/ecma262/#sec-map.prototype-@@iterator
33677 // https://tc39.es/ecma262/#sec-set.prototype.entries
33678 // https://tc39.es/ecma262/#sec-set.prototype.keys
33679 // https://tc39.es/ecma262/#sec-set.prototype.values
33680 // https://tc39.es/ecma262/#sec-set.prototype-@@iterator
33681 defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) {
33682 setInternalState(this, {
33683 type: ITERATOR_NAME,
33684 target: iterated,
33685 state: getInternalCollectionState(iterated),
33686 kind: kind,
33687 last: undefined
33688 });
33689 }, function () {
33690 var state = getInternalIteratorState(this);
33691 var kind = state.kind;
33692 var entry = state.last;
33693 // revert to the last existing entry
33694 while (entry && entry.removed) entry = entry.previous;
33695 // get next entry
33696 if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
33697 // or finish the iteration
33698 state.target = undefined;
33699 return { value: undefined, done: true };
33700 }
33701 // return step by kind
33702 if (kind == 'keys') return { value: entry.key, done: false };
33703 if (kind == 'values') return { value: entry.value, done: false };
33704 return { value: [entry.key, entry.value], done: false };
33705 }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
33706
33707 // `{ Map, Set }.prototype[@@species]` accessors
33708 // https://tc39.es/ecma262/#sec-get-map-@@species
33709 // https://tc39.es/ecma262/#sec-get-set-@@species
33710 setSpecies(CONSTRUCTOR_NAME);
33711 }
33712};
33713
33714
33715/***/ }),
33716/* 654 */
33717/***/ (function(module, exports, __webpack_require__) {
33718
33719var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
33720 Copyright 2013 Daniel Wirtz <dcode@dcode.io>
33721
33722 Licensed under the Apache License, Version 2.0 (the "License");
33723 you may not use this file except in compliance with the License.
33724 You may obtain a copy of the License at
33725
33726 http://www.apache.org/licenses/LICENSE-2.0
33727
33728 Unless required by applicable law or agreed to in writing, software
33729 distributed under the License is distributed on an "AS IS" BASIS,
33730 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33731 See the License for the specific language governing permissions and
33732 limitations under the License.
33733 */
33734
33735/**
33736 * @license protobuf.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
33737 * Released under the Apache License, Version 2.0
33738 * see: https://github.com/dcodeIO/protobuf.js for details
33739 */
33740(function(global, factory) {
33741
33742 /* AMD */ if (true)
33743 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(655)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
33744 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
33745 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
33746 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
33747 /* CommonJS */ else if (typeof require === "function" && typeof module === "object" && module && module["exports"])
33748 module["exports"] = factory(require("bytebuffer"), true);
33749 /* Global */ else
33750 (global["dcodeIO"] = global["dcodeIO"] || {})["ProtoBuf"] = factory(global["dcodeIO"]["ByteBuffer"]);
33751
33752})(this, function(ByteBuffer, isCommonJS) {
33753 "use strict";
33754
33755 /**
33756 * The ProtoBuf namespace.
33757 * @exports ProtoBuf
33758 * @namespace
33759 * @expose
33760 */
33761 var ProtoBuf = {};
33762
33763 /**
33764 * @type {!function(new: ByteBuffer, ...[*])}
33765 * @expose
33766 */
33767 ProtoBuf.ByteBuffer = ByteBuffer;
33768
33769 /**
33770 * @type {?function(new: Long, ...[*])}
33771 * @expose
33772 */
33773 ProtoBuf.Long = ByteBuffer.Long || null;
33774
33775 /**
33776 * ProtoBuf.js version.
33777 * @type {string}
33778 * @const
33779 * @expose
33780 */
33781 ProtoBuf.VERSION = "5.0.3";
33782
33783 /**
33784 * Wire types.
33785 * @type {Object.<string,number>}
33786 * @const
33787 * @expose
33788 */
33789 ProtoBuf.WIRE_TYPES = {};
33790
33791 /**
33792 * Varint wire type.
33793 * @type {number}
33794 * @expose
33795 */
33796 ProtoBuf.WIRE_TYPES.VARINT = 0;
33797
33798 /**
33799 * Fixed 64 bits wire type.
33800 * @type {number}
33801 * @const
33802 * @expose
33803 */
33804 ProtoBuf.WIRE_TYPES.BITS64 = 1;
33805
33806 /**
33807 * Length delimited wire type.
33808 * @type {number}
33809 * @const
33810 * @expose
33811 */
33812 ProtoBuf.WIRE_TYPES.LDELIM = 2;
33813
33814 /**
33815 * Start group wire type.
33816 * @type {number}
33817 * @const
33818 * @expose
33819 */
33820 ProtoBuf.WIRE_TYPES.STARTGROUP = 3;
33821
33822 /**
33823 * End group wire type.
33824 * @type {number}
33825 * @const
33826 * @expose
33827 */
33828 ProtoBuf.WIRE_TYPES.ENDGROUP = 4;
33829
33830 /**
33831 * Fixed 32 bits wire type.
33832 * @type {number}
33833 * @const
33834 * @expose
33835 */
33836 ProtoBuf.WIRE_TYPES.BITS32 = 5;
33837
33838 /**
33839 * Packable wire types.
33840 * @type {!Array.<number>}
33841 * @const
33842 * @expose
33843 */
33844 ProtoBuf.PACKABLE_WIRE_TYPES = [
33845 ProtoBuf.WIRE_TYPES.VARINT,
33846 ProtoBuf.WIRE_TYPES.BITS64,
33847 ProtoBuf.WIRE_TYPES.BITS32
33848 ];
33849
33850 /**
33851 * Types.
33852 * @dict
33853 * @type {!Object.<string,{name: string, wireType: number, defaultValue: *}>}
33854 * @const
33855 * @expose
33856 */
33857 ProtoBuf.TYPES = {
33858 // According to the protobuf spec.
33859 "int32": {
33860 name: "int32",
33861 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33862 defaultValue: 0
33863 },
33864 "uint32": {
33865 name: "uint32",
33866 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33867 defaultValue: 0
33868 },
33869 "sint32": {
33870 name: "sint32",
33871 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33872 defaultValue: 0
33873 },
33874 "int64": {
33875 name: "int64",
33876 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33877 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
33878 },
33879 "uint64": {
33880 name: "uint64",
33881 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33882 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
33883 },
33884 "sint64": {
33885 name: "sint64",
33886 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33887 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
33888 },
33889 "bool": {
33890 name: "bool",
33891 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33892 defaultValue: false
33893 },
33894 "double": {
33895 name: "double",
33896 wireType: ProtoBuf.WIRE_TYPES.BITS64,
33897 defaultValue: 0
33898 },
33899 "string": {
33900 name: "string",
33901 wireType: ProtoBuf.WIRE_TYPES.LDELIM,
33902 defaultValue: ""
33903 },
33904 "bytes": {
33905 name: "bytes",
33906 wireType: ProtoBuf.WIRE_TYPES.LDELIM,
33907 defaultValue: null // overridden in the code, must be a unique instance
33908 },
33909 "fixed32": {
33910 name: "fixed32",
33911 wireType: ProtoBuf.WIRE_TYPES.BITS32,
33912 defaultValue: 0
33913 },
33914 "sfixed32": {
33915 name: "sfixed32",
33916 wireType: ProtoBuf.WIRE_TYPES.BITS32,
33917 defaultValue: 0
33918 },
33919 "fixed64": {
33920 name: "fixed64",
33921 wireType: ProtoBuf.WIRE_TYPES.BITS64,
33922 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
33923 },
33924 "sfixed64": {
33925 name: "sfixed64",
33926 wireType: ProtoBuf.WIRE_TYPES.BITS64,
33927 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
33928 },
33929 "float": {
33930 name: "float",
33931 wireType: ProtoBuf.WIRE_TYPES.BITS32,
33932 defaultValue: 0
33933 },
33934 "enum": {
33935 name: "enum",
33936 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33937 defaultValue: 0
33938 },
33939 "message": {
33940 name: "message",
33941 wireType: ProtoBuf.WIRE_TYPES.LDELIM,
33942 defaultValue: null
33943 },
33944 "group": {
33945 name: "group",
33946 wireType: ProtoBuf.WIRE_TYPES.STARTGROUP,
33947 defaultValue: null
33948 }
33949 };
33950
33951 /**
33952 * Valid map key types.
33953 * @type {!Array.<!Object.<string,{name: string, wireType: number, defaultValue: *}>>}
33954 * @const
33955 * @expose
33956 */
33957 ProtoBuf.MAP_KEY_TYPES = [
33958 ProtoBuf.TYPES["int32"],
33959 ProtoBuf.TYPES["sint32"],
33960 ProtoBuf.TYPES["sfixed32"],
33961 ProtoBuf.TYPES["uint32"],
33962 ProtoBuf.TYPES["fixed32"],
33963 ProtoBuf.TYPES["int64"],
33964 ProtoBuf.TYPES["sint64"],
33965 ProtoBuf.TYPES["sfixed64"],
33966 ProtoBuf.TYPES["uint64"],
33967 ProtoBuf.TYPES["fixed64"],
33968 ProtoBuf.TYPES["bool"],
33969 ProtoBuf.TYPES["string"],
33970 ProtoBuf.TYPES["bytes"]
33971 ];
33972
33973 /**
33974 * Minimum field id.
33975 * @type {number}
33976 * @const
33977 * @expose
33978 */
33979 ProtoBuf.ID_MIN = 1;
33980
33981 /**
33982 * Maximum field id.
33983 * @type {number}
33984 * @const
33985 * @expose
33986 */
33987 ProtoBuf.ID_MAX = 0x1FFFFFFF;
33988
33989 /**
33990 * If set to `true`, field names will be converted from underscore notation to camel case. Defaults to `false`.
33991 * Must be set prior to parsing.
33992 * @type {boolean}
33993 * @expose
33994 */
33995 ProtoBuf.convertFieldsToCamelCase = false;
33996
33997 /**
33998 * By default, messages are populated with (setX, set_x) accessors for each field. This can be disabled by
33999 * setting this to `false` prior to building messages.
34000 * @type {boolean}
34001 * @expose
34002 */
34003 ProtoBuf.populateAccessors = true;
34004
34005 /**
34006 * By default, messages are populated with default values if a field is not present on the wire. To disable
34007 * this behavior, set this setting to `false`.
34008 * @type {boolean}
34009 * @expose
34010 */
34011 ProtoBuf.populateDefaults = true;
34012
34013 /**
34014 * @alias ProtoBuf.Util
34015 * @expose
34016 */
34017 ProtoBuf.Util = (function() {
34018 "use strict";
34019
34020 /**
34021 * ProtoBuf utilities.
34022 * @exports ProtoBuf.Util
34023 * @namespace
34024 */
34025 var Util = {};
34026
34027 /**
34028 * Flag if running in node or not.
34029 * @type {boolean}
34030 * @const
34031 * @expose
34032 */
34033 Util.IS_NODE = !!(
34034 typeof process === 'object' && process+'' === '[object process]' && !process['browser']
34035 );
34036
34037 /**
34038 * Constructs a XMLHttpRequest object.
34039 * @return {XMLHttpRequest}
34040 * @throws {Error} If XMLHttpRequest is not supported
34041 * @expose
34042 */
34043 Util.XHR = function() {
34044 // No dependencies please, ref: http://www.quirksmode.org/js/xmlhttp.html
34045 var XMLHttpFactories = [
34046 function () {return new XMLHttpRequest()},
34047 function () {return new ActiveXObject("Msxml2.XMLHTTP")},
34048 function () {return new ActiveXObject("Msxml3.XMLHTTP")},
34049 function () {return new ActiveXObject("Microsoft.XMLHTTP")}
34050 ];
34051 /** @type {?XMLHttpRequest} */
34052 var xhr = null;
34053 for (var i=0;i<XMLHttpFactories.length;i++) {
34054 try { xhr = XMLHttpFactories[i](); }
34055 catch (e) { continue; }
34056 break;
34057 }
34058 if (!xhr)
34059 throw Error("XMLHttpRequest is not supported");
34060 return xhr;
34061 };
34062
34063 /**
34064 * Fetches a resource.
34065 * @param {string} path Resource path
34066 * @param {function(?string)=} callback Callback receiving the resource's contents. If omitted the resource will
34067 * be fetched synchronously. If the request failed, contents will be null.
34068 * @return {?string|undefined} Resource contents if callback is omitted (null if the request failed), else undefined.
34069 * @expose
34070 */
34071 Util.fetch = function(path, callback) {
34072 if (callback && typeof callback != 'function')
34073 callback = null;
34074 if (Util.IS_NODE) {
34075 var fs = __webpack_require__(657);
34076 if (callback) {
34077 fs.readFile(path, function(err, data) {
34078 if (err)
34079 callback(null);
34080 else
34081 callback(""+data);
34082 });
34083 } else
34084 try {
34085 return fs.readFileSync(path);
34086 } catch (e) {
34087 return null;
34088 }
34089 } else {
34090 var xhr = Util.XHR();
34091 xhr.open('GET', path, callback ? true : false);
34092 // xhr.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
34093 xhr.setRequestHeader('Accept', 'text/plain');
34094 if (typeof xhr.overrideMimeType === 'function') xhr.overrideMimeType('text/plain');
34095 if (callback) {
34096 xhr.onreadystatechange = function() {
34097 if (xhr.readyState != 4) return;
34098 if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
34099 callback(xhr.responseText);
34100 else
34101 callback(null);
34102 };
34103 if (xhr.readyState == 4)
34104 return;
34105 xhr.send(null);
34106 } else {
34107 xhr.send(null);
34108 if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
34109 return xhr.responseText;
34110 return null;
34111 }
34112 }
34113 };
34114
34115 /**
34116 * Converts a string to camel case.
34117 * @param {string} str
34118 * @returns {string}
34119 * @expose
34120 */
34121 Util.toCamelCase = function(str) {
34122 return str.replace(/_([a-zA-Z])/g, function ($0, $1) {
34123 return $1.toUpperCase();
34124 });
34125 };
34126
34127 return Util;
34128 })();
34129
34130 /**
34131 * Language expressions.
34132 * @type {!Object.<string,!RegExp>}
34133 * @expose
34134 */
34135 ProtoBuf.Lang = {
34136
34137 // Characters always ending a statement
34138 DELIM: /[\s\{\}=;:\[\],'"\(\)<>]/g,
34139
34140 // Field rules
34141 RULE: /^(?:required|optional|repeated|map)$/,
34142
34143 // Field types
34144 TYPE: /^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,
34145
34146 // Names
34147 NAME: /^[a-zA-Z_][a-zA-Z_0-9]*$/,
34148
34149 // Type definitions
34150 TYPEDEF: /^[a-zA-Z][a-zA-Z_0-9]*$/,
34151
34152 // Type references
34153 TYPEREF: /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,
34154
34155 // Fully qualified type references
34156 FQTYPEREF: /^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/,
34157
34158 // All numbers
34159 NUMBER: /^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,
34160
34161 // Decimal numbers
34162 NUMBER_DEC: /^(?:[1-9][0-9]*|0)$/,
34163
34164 // Hexadecimal numbers
34165 NUMBER_HEX: /^0[xX][0-9a-fA-F]+$/,
34166
34167 // Octal numbers
34168 NUMBER_OCT: /^0[0-7]+$/,
34169
34170 // Floating point numbers
34171 NUMBER_FLT: /^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,
34172
34173 // Booleans
34174 BOOL: /^(?:true|false)$/i,
34175
34176 // Id numbers
34177 ID: /^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
34178
34179 // Negative id numbers (enum values)
34180 NEGID: /^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
34181
34182 // Whitespaces
34183 WHITESPACE: /\s/,
34184
34185 // All strings
34186 STRING: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,
34187
34188 // Double quoted strings
34189 STRING_DQ: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,
34190
34191 // Single quoted strings
34192 STRING_SQ: /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g
34193 };
34194
34195
34196 /**
34197 * @alias ProtoBuf.Reflect
34198 * @expose
34199 */
34200 ProtoBuf.Reflect = (function(ProtoBuf) {
34201 "use strict";
34202
34203 /**
34204 * Reflection types.
34205 * @exports ProtoBuf.Reflect
34206 * @namespace
34207 */
34208 var Reflect = {};
34209
34210 /**
34211 * Constructs a Reflect base class.
34212 * @exports ProtoBuf.Reflect.T
34213 * @constructor
34214 * @abstract
34215 * @param {!ProtoBuf.Builder} builder Builder reference
34216 * @param {?ProtoBuf.Reflect.T} parent Parent object
34217 * @param {string} name Object name
34218 */
34219 var T = function(builder, parent, name) {
34220
34221 /**
34222 * Builder reference.
34223 * @type {!ProtoBuf.Builder}
34224 * @expose
34225 */
34226 this.builder = builder;
34227
34228 /**
34229 * Parent object.
34230 * @type {?ProtoBuf.Reflect.T}
34231 * @expose
34232 */
34233 this.parent = parent;
34234
34235 /**
34236 * Object name in namespace.
34237 * @type {string}
34238 * @expose
34239 */
34240 this.name = name;
34241
34242 /**
34243 * Fully qualified class name
34244 * @type {string}
34245 * @expose
34246 */
34247 this.className;
34248 };
34249
34250 /**
34251 * @alias ProtoBuf.Reflect.T.prototype
34252 * @inner
34253 */
34254 var TPrototype = T.prototype;
34255
34256 /**
34257 * Returns the fully qualified name of this object.
34258 * @returns {string} Fully qualified name as of ".PATH.TO.THIS"
34259 * @expose
34260 */
34261 TPrototype.fqn = function() {
34262 var name = this.name,
34263 ptr = this;
34264 do {
34265 ptr = ptr.parent;
34266 if (ptr == null)
34267 break;
34268 name = ptr.name+"."+name;
34269 } while (true);
34270 return name;
34271 };
34272
34273 /**
34274 * Returns a string representation of this Reflect object (its fully qualified name).
34275 * @param {boolean=} includeClass Set to true to include the class name. Defaults to false.
34276 * @return String representation
34277 * @expose
34278 */
34279 TPrototype.toString = function(includeClass) {
34280 return (includeClass ? this.className + " " : "") + this.fqn();
34281 };
34282
34283 /**
34284 * Builds this type.
34285 * @throws {Error} If this type cannot be built directly
34286 * @expose
34287 */
34288 TPrototype.build = function() {
34289 throw Error(this.toString(true)+" cannot be built directly");
34290 };
34291
34292 /**
34293 * @alias ProtoBuf.Reflect.T
34294 * @expose
34295 */
34296 Reflect.T = T;
34297
34298 /**
34299 * Constructs a new Namespace.
34300 * @exports ProtoBuf.Reflect.Namespace
34301 * @param {!ProtoBuf.Builder} builder Builder reference
34302 * @param {?ProtoBuf.Reflect.Namespace} parent Namespace parent
34303 * @param {string} name Namespace name
34304 * @param {Object.<string,*>=} options Namespace options
34305 * @param {string?} syntax The syntax level of this definition (e.g., proto3)
34306 * @constructor
34307 * @extends ProtoBuf.Reflect.T
34308 */
34309 var Namespace = function(builder, parent, name, options, syntax) {
34310 T.call(this, builder, parent, name);
34311
34312 /**
34313 * @override
34314 */
34315 this.className = "Namespace";
34316
34317 /**
34318 * Children inside the namespace.
34319 * @type {!Array.<ProtoBuf.Reflect.T>}
34320 */
34321 this.children = [];
34322
34323 /**
34324 * Options.
34325 * @type {!Object.<string, *>}
34326 */
34327 this.options = options || {};
34328
34329 /**
34330 * Syntax level (e.g., proto2 or proto3).
34331 * @type {!string}
34332 */
34333 this.syntax = syntax || "proto2";
34334 };
34335
34336 /**
34337 * @alias ProtoBuf.Reflect.Namespace.prototype
34338 * @inner
34339 */
34340 var NamespacePrototype = Namespace.prototype = Object.create(T.prototype);
34341
34342 /**
34343 * Returns an array of the namespace's children.
34344 * @param {ProtoBuf.Reflect.T=} type Filter type (returns instances of this type only). Defaults to null (all children).
34345 * @return {Array.<ProtoBuf.Reflect.T>}
34346 * @expose
34347 */
34348 NamespacePrototype.getChildren = function(type) {
34349 type = type || null;
34350 if (type == null)
34351 return this.children.slice();
34352 var children = [];
34353 for (var i=0, k=this.children.length; i<k; ++i)
34354 if (this.children[i] instanceof type)
34355 children.push(this.children[i]);
34356 return children;
34357 };
34358
34359 /**
34360 * Adds a child to the namespace.
34361 * @param {ProtoBuf.Reflect.T} child Child
34362 * @throws {Error} If the child cannot be added (duplicate)
34363 * @expose
34364 */
34365 NamespacePrototype.addChild = function(child) {
34366 var other;
34367 if (other = this.getChild(child.name)) {
34368 // Try to revert camelcase transformation on collision
34369 if (other instanceof Message.Field && other.name !== other.originalName && this.getChild(other.originalName) === null)
34370 other.name = other.originalName; // Revert previous first (effectively keeps both originals)
34371 else if (child instanceof Message.Field && child.name !== child.originalName && this.getChild(child.originalName) === null)
34372 child.name = child.originalName;
34373 else
34374 throw Error("Duplicate name in namespace "+this.toString(true)+": "+child.name);
34375 }
34376 this.children.push(child);
34377 };
34378
34379 /**
34380 * Gets a child by its name or id.
34381 * @param {string|number} nameOrId Child name or id
34382 * @return {?ProtoBuf.Reflect.T} The child or null if not found
34383 * @expose
34384 */
34385 NamespacePrototype.getChild = function(nameOrId) {
34386 var key = typeof nameOrId === 'number' ? 'id' : 'name';
34387 for (var i=0, k=this.children.length; i<k; ++i)
34388 if (this.children[i][key] === nameOrId)
34389 return this.children[i];
34390 return null;
34391 };
34392
34393 /**
34394 * Resolves a reflect object inside of this namespace.
34395 * @param {string|!Array.<string>} qn Qualified name to resolve
34396 * @param {boolean=} excludeNonNamespace Excludes non-namespace types, defaults to `false`
34397 * @return {?ProtoBuf.Reflect.Namespace} The resolved type or null if not found
34398 * @expose
34399 */
34400 NamespacePrototype.resolve = function(qn, excludeNonNamespace) {
34401 var part = typeof qn === 'string' ? qn.split(".") : qn,
34402 ptr = this,
34403 i = 0;
34404 if (part[i] === "") { // Fully qualified name, e.g. ".My.Message'
34405 while (ptr.parent !== null)
34406 ptr = ptr.parent;
34407 i++;
34408 }
34409 var child;
34410 do {
34411 do {
34412 if (!(ptr instanceof Reflect.Namespace)) {
34413 ptr = null;
34414 break;
34415 }
34416 child = ptr.getChild(part[i]);
34417 if (!child || !(child instanceof Reflect.T) || (excludeNonNamespace && !(child instanceof Reflect.Namespace))) {
34418 ptr = null;
34419 break;
34420 }
34421 ptr = child; i++;
34422 } while (i < part.length);
34423 if (ptr != null)
34424 break; // Found
34425 // Else search the parent
34426 if (this.parent !== null)
34427 return this.parent.resolve(qn, excludeNonNamespace);
34428 } while (ptr != null);
34429 return ptr;
34430 };
34431
34432 /**
34433 * Determines the shortest qualified name of the specified type, if any, relative to this namespace.
34434 * @param {!ProtoBuf.Reflect.T} t Reflection type
34435 * @returns {string} The shortest qualified name or, if there is none, the fqn
34436 * @expose
34437 */
34438 NamespacePrototype.qn = function(t) {
34439 var part = [], ptr = t;
34440 do {
34441 part.unshift(ptr.name);
34442 ptr = ptr.parent;
34443 } while (ptr !== null);
34444 for (var len=1; len <= part.length; len++) {
34445 var qn = part.slice(part.length-len);
34446 if (t === this.resolve(qn, t instanceof Reflect.Namespace))
34447 return qn.join(".");
34448 }
34449 return t.fqn();
34450 };
34451
34452 /**
34453 * Builds the namespace and returns the runtime counterpart.
34454 * @return {Object.<string,Function|Object>} Runtime namespace
34455 * @expose
34456 */
34457 NamespacePrototype.build = function() {
34458 /** @dict */
34459 var ns = {};
34460 var children = this.children;
34461 for (var i=0, k=children.length, child; i<k; ++i) {
34462 child = children[i];
34463 if (child instanceof Namespace)
34464 ns[child.name] = child.build();
34465 }
34466 if (Object.defineProperty)
34467 Object.defineProperty(ns, "$options", { "value": this.buildOpt() });
34468 return ns;
34469 };
34470
34471 /**
34472 * Builds the namespace's '$options' property.
34473 * @return {Object.<string,*>}
34474 */
34475 NamespacePrototype.buildOpt = function() {
34476 var opt = {},
34477 keys = Object.keys(this.options);
34478 for (var i=0, k=keys.length; i<k; ++i) {
34479 var key = keys[i],
34480 val = this.options[keys[i]];
34481 // TODO: Options are not resolved, yet.
34482 // if (val instanceof Namespace) {
34483 // opt[key] = val.build();
34484 // } else {
34485 opt[key] = val;
34486 // }
34487 }
34488 return opt;
34489 };
34490
34491 /**
34492 * Gets the value assigned to the option with the specified name.
34493 * @param {string=} name Returns the option value if specified, otherwise all options are returned.
34494 * @return {*|Object.<string,*>}null} Option value or NULL if there is no such option
34495 */
34496 NamespacePrototype.getOption = function(name) {
34497 if (typeof name === 'undefined')
34498 return this.options;
34499 return typeof this.options[name] !== 'undefined' ? this.options[name] : null;
34500 };
34501
34502 /**
34503 * @alias ProtoBuf.Reflect.Namespace
34504 * @expose
34505 */
34506 Reflect.Namespace = Namespace;
34507
34508 /**
34509 * Constructs a new Element implementation that checks and converts values for a
34510 * particular field type, as appropriate.
34511 *
34512 * An Element represents a single value: either the value of a singular field,
34513 * or a value contained in one entry of a repeated field or map field. This
34514 * class does not implement these higher-level concepts; it only encapsulates
34515 * the low-level typechecking and conversion.
34516 *
34517 * @exports ProtoBuf.Reflect.Element
34518 * @param {{name: string, wireType: number}} type Resolved data type
34519 * @param {ProtoBuf.Reflect.T|null} resolvedType Resolved type, if relevant
34520 * (e.g. submessage field).
34521 * @param {boolean} isMapKey Is this element a Map key? The value will be
34522 * converted to string form if so.
34523 * @param {string} syntax Syntax level of defining message type, e.g.,
34524 * proto2 or proto3.
34525 * @param {string} name Name of the field containing this element (for error
34526 * messages)
34527 * @constructor
34528 */
34529 var Element = function(type, resolvedType, isMapKey, syntax, name) {
34530
34531 /**
34532 * Element type, as a string (e.g., int32).
34533 * @type {{name: string, wireType: number}}
34534 */
34535 this.type = type;
34536
34537 /**
34538 * Element type reference to submessage or enum definition, if needed.
34539 * @type {ProtoBuf.Reflect.T|null}
34540 */
34541 this.resolvedType = resolvedType;
34542
34543 /**
34544 * Element is a map key.
34545 * @type {boolean}
34546 */
34547 this.isMapKey = isMapKey;
34548
34549 /**
34550 * Syntax level of defining message type, e.g., proto2 or proto3.
34551 * @type {string}
34552 */
34553 this.syntax = syntax;
34554
34555 /**
34556 * Name of the field containing this element (for error messages)
34557 * @type {string}
34558 */
34559 this.name = name;
34560
34561 if (isMapKey && ProtoBuf.MAP_KEY_TYPES.indexOf(type) < 0)
34562 throw Error("Invalid map key type: " + type.name);
34563 };
34564
34565 var ElementPrototype = Element.prototype;
34566
34567 /**
34568 * Obtains a (new) default value for the specified type.
34569 * @param type {string|{name: string, wireType: number}} Field type
34570 * @returns {*} Default value
34571 * @inner
34572 */
34573 function mkDefault(type) {
34574 if (typeof type === 'string')
34575 type = ProtoBuf.TYPES[type];
34576 if (typeof type.defaultValue === 'undefined')
34577 throw Error("default value for type "+type.name+" is not supported");
34578 if (type == ProtoBuf.TYPES["bytes"])
34579 return new ByteBuffer(0);
34580 return type.defaultValue;
34581 }
34582
34583 /**
34584 * Returns the default value for this field in proto3.
34585 * @function
34586 * @param type {string|{name: string, wireType: number}} the field type
34587 * @returns {*} Default value
34588 */
34589 Element.defaultFieldValue = mkDefault;
34590
34591 /**
34592 * Makes a Long from a value.
34593 * @param {{low: number, high: number, unsigned: boolean}|string|number} value Value
34594 * @param {boolean=} unsigned Whether unsigned or not, defaults to reuse it from Long-like objects or to signed for
34595 * strings and numbers
34596 * @returns {!Long}
34597 * @throws {Error} If the value cannot be converted to a Long
34598 * @inner
34599 */
34600 function mkLong(value, unsigned) {
34601 if (value && typeof value.low === 'number' && typeof value.high === 'number' && typeof value.unsigned === 'boolean'
34602 && value.low === value.low && value.high === value.high)
34603 return new ProtoBuf.Long(value.low, value.high, typeof unsigned === 'undefined' ? value.unsigned : unsigned);
34604 if (typeof value === 'string')
34605 return ProtoBuf.Long.fromString(value, unsigned || false, 10);
34606 if (typeof value === 'number')
34607 return ProtoBuf.Long.fromNumber(value, unsigned || false);
34608 throw Error("not convertible to Long");
34609 }
34610
34611 ElementPrototype.toString = function() {
34612 return (this.name || '') + (this.isMapKey ? 'map' : 'value') + ' element';
34613 }
34614
34615 /**
34616 * Checks if the given value can be set for an element of this type (singular
34617 * field or one element of a repeated field or map).
34618 * @param {*} value Value to check
34619 * @return {*} Verified, maybe adjusted, value
34620 * @throws {Error} If the value cannot be verified for this element slot
34621 * @expose
34622 */
34623 ElementPrototype.verifyValue = function(value) {
34624 var self = this;
34625 function fail(val, msg) {
34626 throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
34627 }
34628 switch (this.type) {
34629 // Signed 32bit
34630 case ProtoBuf.TYPES["int32"]:
34631 case ProtoBuf.TYPES["sint32"]:
34632 case ProtoBuf.TYPES["sfixed32"]:
34633 // Account for !NaN: value === value
34634 if (typeof value !== 'number' || (value === value && value % 1 !== 0))
34635 fail(typeof value, "not an integer");
34636 return value > 4294967295 ? value | 0 : value;
34637
34638 // Unsigned 32bit
34639 case ProtoBuf.TYPES["uint32"]:
34640 case ProtoBuf.TYPES["fixed32"]:
34641 if (typeof value !== 'number' || (value === value && value % 1 !== 0))
34642 fail(typeof value, "not an integer");
34643 return value < 0 ? value >>> 0 : value;
34644
34645 // Signed 64bit
34646 case ProtoBuf.TYPES["int64"]:
34647 case ProtoBuf.TYPES["sint64"]:
34648 case ProtoBuf.TYPES["sfixed64"]: {
34649 if (ProtoBuf.Long)
34650 try {
34651 return mkLong(value, false);
34652 } catch (e) {
34653 fail(typeof value, e.message);
34654 }
34655 else
34656 fail(typeof value, "requires Long.js");
34657 }
34658
34659 // Unsigned 64bit
34660 case ProtoBuf.TYPES["uint64"]:
34661 case ProtoBuf.TYPES["fixed64"]: {
34662 if (ProtoBuf.Long)
34663 try {
34664 return mkLong(value, true);
34665 } catch (e) {
34666 fail(typeof value, e.message);
34667 }
34668 else
34669 fail(typeof value, "requires Long.js");
34670 }
34671
34672 // Bool
34673 case ProtoBuf.TYPES["bool"]:
34674 if (typeof value !== 'boolean')
34675 fail(typeof value, "not a boolean");
34676 return value;
34677
34678 // Float
34679 case ProtoBuf.TYPES["float"]:
34680 case ProtoBuf.TYPES["double"]:
34681 if (typeof value !== 'number')
34682 fail(typeof value, "not a number");
34683 return value;
34684
34685 // Length-delimited string
34686 case ProtoBuf.TYPES["string"]:
34687 if (typeof value !== 'string' && !(value && value instanceof String))
34688 fail(typeof value, "not a string");
34689 return ""+value; // Convert String object to string
34690
34691 // Length-delimited bytes
34692 case ProtoBuf.TYPES["bytes"]:
34693 if (ByteBuffer.isByteBuffer(value))
34694 return value;
34695 return ByteBuffer.wrap(value, "base64");
34696
34697 // Constant enum value
34698 case ProtoBuf.TYPES["enum"]: {
34699 var values = this.resolvedType.getChildren(ProtoBuf.Reflect.Enum.Value);
34700 for (i=0; i<values.length; i++)
34701 if (values[i].name == value)
34702 return values[i].id;
34703 else if (values[i].id == value)
34704 return values[i].id;
34705
34706 if (this.syntax === 'proto3') {
34707 // proto3: just make sure it's an integer.
34708 if (typeof value !== 'number' || (value === value && value % 1 !== 0))
34709 fail(typeof value, "not an integer");
34710 if (value > 4294967295 || value < 0)
34711 fail(typeof value, "not in range for uint32")
34712 return value;
34713 } else {
34714 // proto2 requires enum values to be valid.
34715 fail(value, "not a valid enum value");
34716 }
34717 }
34718 // Embedded message
34719 case ProtoBuf.TYPES["group"]:
34720 case ProtoBuf.TYPES["message"]: {
34721 if (!value || typeof value !== 'object')
34722 fail(typeof value, "object expected");
34723 if (value instanceof this.resolvedType.clazz)
34724 return value;
34725 if (value instanceof ProtoBuf.Builder.Message) {
34726 // Mismatched type: Convert to object (see: https://github.com/dcodeIO/ProtoBuf.js/issues/180)
34727 var obj = {};
34728 for (var i in value)
34729 if (value.hasOwnProperty(i))
34730 obj[i] = value[i];
34731 value = obj;
34732 }
34733 // Else let's try to construct one from a key-value object
34734 return new (this.resolvedType.clazz)(value); // May throw for a hundred of reasons
34735 }
34736 }
34737
34738 // We should never end here
34739 throw Error("[INTERNAL] Illegal value for "+this.toString(true)+": "+value+" (undefined type "+this.type+")");
34740 };
34741
34742 /**
34743 * Calculates the byte length of an element on the wire.
34744 * @param {number} id Field number
34745 * @param {*} value Field value
34746 * @returns {number} Byte length
34747 * @throws {Error} If the value cannot be calculated
34748 * @expose
34749 */
34750 ElementPrototype.calculateLength = function(id, value) {
34751 if (value === null) return 0; // Nothing to encode
34752 // Tag has already been written
34753 var n;
34754 switch (this.type) {
34755 case ProtoBuf.TYPES["int32"]:
34756 return value < 0 ? ByteBuffer.calculateVarint64(value) : ByteBuffer.calculateVarint32(value);
34757 case ProtoBuf.TYPES["uint32"]:
34758 return ByteBuffer.calculateVarint32(value);
34759 case ProtoBuf.TYPES["sint32"]:
34760 return ByteBuffer.calculateVarint32(ByteBuffer.zigZagEncode32(value));
34761 case ProtoBuf.TYPES["fixed32"]:
34762 case ProtoBuf.TYPES["sfixed32"]:
34763 case ProtoBuf.TYPES["float"]:
34764 return 4;
34765 case ProtoBuf.TYPES["int64"]:
34766 case ProtoBuf.TYPES["uint64"]:
34767 return ByteBuffer.calculateVarint64(value);
34768 case ProtoBuf.TYPES["sint64"]:
34769 return ByteBuffer.calculateVarint64(ByteBuffer.zigZagEncode64(value));
34770 case ProtoBuf.TYPES["fixed64"]:
34771 case ProtoBuf.TYPES["sfixed64"]:
34772 return 8;
34773 case ProtoBuf.TYPES["bool"]:
34774 return 1;
34775 case ProtoBuf.TYPES["enum"]:
34776 return ByteBuffer.calculateVarint32(value);
34777 case ProtoBuf.TYPES["double"]:
34778 return 8;
34779 case ProtoBuf.TYPES["string"]:
34780 n = ByteBuffer.calculateUTF8Bytes(value);
34781 return ByteBuffer.calculateVarint32(n) + n;
34782 case ProtoBuf.TYPES["bytes"]:
34783 if (value.remaining() < 0)
34784 throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
34785 return ByteBuffer.calculateVarint32(value.remaining()) + value.remaining();
34786 case ProtoBuf.TYPES["message"]:
34787 n = this.resolvedType.calculate(value);
34788 return ByteBuffer.calculateVarint32(n) + n;
34789 case ProtoBuf.TYPES["group"]:
34790 n = this.resolvedType.calculate(value);
34791 return n + ByteBuffer.calculateVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
34792 }
34793 // We should never end here
34794 throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
34795 };
34796
34797 /**
34798 * Encodes a value to the specified buffer. Does not encode the key.
34799 * @param {number} id Field number
34800 * @param {*} value Field value
34801 * @param {ByteBuffer} buffer ByteBuffer to encode to
34802 * @return {ByteBuffer} The ByteBuffer for chaining
34803 * @throws {Error} If the value cannot be encoded
34804 * @expose
34805 */
34806 ElementPrototype.encodeValue = function(id, value, buffer) {
34807 if (value === null) return buffer; // Nothing to encode
34808 // Tag has already been written
34809
34810 switch (this.type) {
34811 // 32bit signed varint
34812 case ProtoBuf.TYPES["int32"]:
34813 // "If you use int32 or int64 as the type for a negative number, the resulting varint is always ten bytes
34814 // long – it is, effectively, treated like a very large unsigned integer." (see #122)
34815 if (value < 0)
34816 buffer.writeVarint64(value);
34817 else
34818 buffer.writeVarint32(value);
34819 break;
34820
34821 // 32bit unsigned varint
34822 case ProtoBuf.TYPES["uint32"]:
34823 buffer.writeVarint32(value);
34824 break;
34825
34826 // 32bit varint zig-zag
34827 case ProtoBuf.TYPES["sint32"]:
34828 buffer.writeVarint32ZigZag(value);
34829 break;
34830
34831 // Fixed unsigned 32bit
34832 case ProtoBuf.TYPES["fixed32"]:
34833 buffer.writeUint32(value);
34834 break;
34835
34836 // Fixed signed 32bit
34837 case ProtoBuf.TYPES["sfixed32"]:
34838 buffer.writeInt32(value);
34839 break;
34840
34841 // 64bit varint as-is
34842 case ProtoBuf.TYPES["int64"]:
34843 case ProtoBuf.TYPES["uint64"]:
34844 buffer.writeVarint64(value); // throws
34845 break;
34846
34847 // 64bit varint zig-zag
34848 case ProtoBuf.TYPES["sint64"]:
34849 buffer.writeVarint64ZigZag(value); // throws
34850 break;
34851
34852 // Fixed unsigned 64bit
34853 case ProtoBuf.TYPES["fixed64"]:
34854 buffer.writeUint64(value); // throws
34855 break;
34856
34857 // Fixed signed 64bit
34858 case ProtoBuf.TYPES["sfixed64"]:
34859 buffer.writeInt64(value); // throws
34860 break;
34861
34862 // Bool
34863 case ProtoBuf.TYPES["bool"]:
34864 if (typeof value === 'string')
34865 buffer.writeVarint32(value.toLowerCase() === 'false' ? 0 : !!value);
34866 else
34867 buffer.writeVarint32(value ? 1 : 0);
34868 break;
34869
34870 // Constant enum value
34871 case ProtoBuf.TYPES["enum"]:
34872 buffer.writeVarint32(value);
34873 break;
34874
34875 // 32bit float
34876 case ProtoBuf.TYPES["float"]:
34877 buffer.writeFloat32(value);
34878 break;
34879
34880 // 64bit float
34881 case ProtoBuf.TYPES["double"]:
34882 buffer.writeFloat64(value);
34883 break;
34884
34885 // Length-delimited string
34886 case ProtoBuf.TYPES["string"]:
34887 buffer.writeVString(value);
34888 break;
34889
34890 // Length-delimited bytes
34891 case ProtoBuf.TYPES["bytes"]:
34892 if (value.remaining() < 0)
34893 throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
34894 var prevOffset = value.offset;
34895 buffer.writeVarint32(value.remaining());
34896 buffer.append(value);
34897 value.offset = prevOffset;
34898 break;
34899
34900 // Embedded message
34901 case ProtoBuf.TYPES["message"]:
34902 var bb = new ByteBuffer().LE();
34903 this.resolvedType.encode(value, bb);
34904 buffer.writeVarint32(bb.offset);
34905 buffer.append(bb.flip());
34906 break;
34907
34908 // Legacy group
34909 case ProtoBuf.TYPES["group"]:
34910 this.resolvedType.encode(value, buffer);
34911 buffer.writeVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
34912 break;
34913
34914 default:
34915 // We should never end here
34916 throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
34917 }
34918 return buffer;
34919 };
34920
34921 /**
34922 * Decode one element value from the specified buffer.
34923 * @param {ByteBuffer} buffer ByteBuffer to decode from
34924 * @param {number} wireType The field wire type
34925 * @param {number} id The field number
34926 * @return {*} Decoded value
34927 * @throws {Error} If the field cannot be decoded
34928 * @expose
34929 */
34930 ElementPrototype.decode = function(buffer, wireType, id) {
34931 if (wireType != this.type.wireType)
34932 throw Error("Unexpected wire type for element");
34933
34934 var value, nBytes;
34935 switch (this.type) {
34936 // 32bit signed varint
34937 case ProtoBuf.TYPES["int32"]:
34938 return buffer.readVarint32() | 0;
34939
34940 // 32bit unsigned varint
34941 case ProtoBuf.TYPES["uint32"]:
34942 return buffer.readVarint32() >>> 0;
34943
34944 // 32bit signed varint zig-zag
34945 case ProtoBuf.TYPES["sint32"]:
34946 return buffer.readVarint32ZigZag() | 0;
34947
34948 // Fixed 32bit unsigned
34949 case ProtoBuf.TYPES["fixed32"]:
34950 return buffer.readUint32() >>> 0;
34951
34952 case ProtoBuf.TYPES["sfixed32"]:
34953 return buffer.readInt32() | 0;
34954
34955 // 64bit signed varint
34956 case ProtoBuf.TYPES["int64"]:
34957 return buffer.readVarint64();
34958
34959 // 64bit unsigned varint
34960 case ProtoBuf.TYPES["uint64"]:
34961 return buffer.readVarint64().toUnsigned();
34962
34963 // 64bit signed varint zig-zag
34964 case ProtoBuf.TYPES["sint64"]:
34965 return buffer.readVarint64ZigZag();
34966
34967 // Fixed 64bit unsigned
34968 case ProtoBuf.TYPES["fixed64"]:
34969 return buffer.readUint64();
34970
34971 // Fixed 64bit signed
34972 case ProtoBuf.TYPES["sfixed64"]:
34973 return buffer.readInt64();
34974
34975 // Bool varint
34976 case ProtoBuf.TYPES["bool"]:
34977 return !!buffer.readVarint32();
34978
34979 // Constant enum value (varint)
34980 case ProtoBuf.TYPES["enum"]:
34981 // The following Builder.Message#set will already throw
34982 return buffer.readVarint32();
34983
34984 // 32bit float
34985 case ProtoBuf.TYPES["float"]:
34986 return buffer.readFloat();
34987
34988 // 64bit float
34989 case ProtoBuf.TYPES["double"]:
34990 return buffer.readDouble();
34991
34992 // Length-delimited string
34993 case ProtoBuf.TYPES["string"]:
34994 return buffer.readVString();
34995
34996 // Length-delimited bytes
34997 case ProtoBuf.TYPES["bytes"]: {
34998 nBytes = buffer.readVarint32();
34999 if (buffer.remaining() < nBytes)
35000 throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
35001 value = buffer.clone(); // Offset already set
35002 value.limit = value.offset+nBytes;
35003 buffer.offset += nBytes;
35004 return value;
35005 }
35006
35007 // Length-delimited embedded message
35008 case ProtoBuf.TYPES["message"]: {
35009 nBytes = buffer.readVarint32();
35010 return this.resolvedType.decode(buffer, nBytes);
35011 }
35012
35013 // Legacy group
35014 case ProtoBuf.TYPES["group"]:
35015 return this.resolvedType.decode(buffer, -1, id);
35016 }
35017
35018 // We should never end here
35019 throw Error("[INTERNAL] Illegal decode type");
35020 };
35021
35022 /**
35023 * Converts a value from a string to the canonical element type.
35024 *
35025 * Legal only when isMapKey is true.
35026 *
35027 * @param {string} str The string value
35028 * @returns {*} The value
35029 */
35030 ElementPrototype.valueFromString = function(str) {
35031 if (!this.isMapKey) {
35032 throw Error("valueFromString() called on non-map-key element");
35033 }
35034
35035 switch (this.type) {
35036 case ProtoBuf.TYPES["int32"]:
35037 case ProtoBuf.TYPES["sint32"]:
35038 case ProtoBuf.TYPES["sfixed32"]:
35039 case ProtoBuf.TYPES["uint32"]:
35040 case ProtoBuf.TYPES["fixed32"]:
35041 return this.verifyValue(parseInt(str));
35042
35043 case ProtoBuf.TYPES["int64"]:
35044 case ProtoBuf.TYPES["sint64"]:
35045 case ProtoBuf.TYPES["sfixed64"]:
35046 case ProtoBuf.TYPES["uint64"]:
35047 case ProtoBuf.TYPES["fixed64"]:
35048 // Long-based fields support conversions from string already.
35049 return this.verifyValue(str);
35050
35051 case ProtoBuf.TYPES["bool"]:
35052 return str === "true";
35053
35054 case ProtoBuf.TYPES["string"]:
35055 return this.verifyValue(str);
35056
35057 case ProtoBuf.TYPES["bytes"]:
35058 return ByteBuffer.fromBinary(str);
35059 }
35060 };
35061
35062 /**
35063 * Converts a value from the canonical element type to a string.
35064 *
35065 * It should be the case that `valueFromString(valueToString(val))` returns
35066 * a value equivalent to `verifyValue(val)` for every legal value of `val`
35067 * according to this element type.
35068 *
35069 * This may be used when the element must be stored or used as a string,
35070 * e.g., as a map key on an Object.
35071 *
35072 * Legal only when isMapKey is true.
35073 *
35074 * @param {*} val The value
35075 * @returns {string} The string form of the value.
35076 */
35077 ElementPrototype.valueToString = function(value) {
35078 if (!this.isMapKey) {
35079 throw Error("valueToString() called on non-map-key element");
35080 }
35081
35082 if (this.type === ProtoBuf.TYPES["bytes"]) {
35083 return value.toString("binary");
35084 } else {
35085 return value.toString();
35086 }
35087 };
35088
35089 /**
35090 * @alias ProtoBuf.Reflect.Element
35091 * @expose
35092 */
35093 Reflect.Element = Element;
35094
35095 /**
35096 * Constructs a new Message.
35097 * @exports ProtoBuf.Reflect.Message
35098 * @param {!ProtoBuf.Builder} builder Builder reference
35099 * @param {!ProtoBuf.Reflect.Namespace} parent Parent message or namespace
35100 * @param {string} name Message name
35101 * @param {Object.<string,*>=} options Message options
35102 * @param {boolean=} isGroup `true` if this is a legacy group
35103 * @param {string?} syntax The syntax level of this definition (e.g., proto3)
35104 * @constructor
35105 * @extends ProtoBuf.Reflect.Namespace
35106 */
35107 var Message = function(builder, parent, name, options, isGroup, syntax) {
35108 Namespace.call(this, builder, parent, name, options, syntax);
35109
35110 /**
35111 * @override
35112 */
35113 this.className = "Message";
35114
35115 /**
35116 * Extensions range.
35117 * @type {!Array.<number>|undefined}
35118 * @expose
35119 */
35120 this.extensions = undefined;
35121
35122 /**
35123 * Runtime message class.
35124 * @type {?function(new:ProtoBuf.Builder.Message)}
35125 * @expose
35126 */
35127 this.clazz = null;
35128
35129 /**
35130 * Whether this is a legacy group or not.
35131 * @type {boolean}
35132 * @expose
35133 */
35134 this.isGroup = !!isGroup;
35135
35136 // The following cached collections are used to efficiently iterate over or look up fields when decoding.
35137
35138 /**
35139 * Cached fields.
35140 * @type {?Array.<!ProtoBuf.Reflect.Message.Field>}
35141 * @private
35142 */
35143 this._fields = null;
35144
35145 /**
35146 * Cached fields by id.
35147 * @type {?Object.<number,!ProtoBuf.Reflect.Message.Field>}
35148 * @private
35149 */
35150 this._fieldsById = null;
35151
35152 /**
35153 * Cached fields by name.
35154 * @type {?Object.<string,!ProtoBuf.Reflect.Message.Field>}
35155 * @private
35156 */
35157 this._fieldsByName = null;
35158 };
35159
35160 /**
35161 * @alias ProtoBuf.Reflect.Message.prototype
35162 * @inner
35163 */
35164 var MessagePrototype = Message.prototype = Object.create(Namespace.prototype);
35165
35166 /**
35167 * Builds the message and returns the runtime counterpart, which is a fully functional class.
35168 * @see ProtoBuf.Builder.Message
35169 * @param {boolean=} rebuild Whether to rebuild or not, defaults to false
35170 * @return {ProtoBuf.Reflect.Message} Message class
35171 * @throws {Error} If the message cannot be built
35172 * @expose
35173 */
35174 MessagePrototype.build = function(rebuild) {
35175 if (this.clazz && !rebuild)
35176 return this.clazz;
35177
35178 // Create the runtime Message class in its own scope
35179 var clazz = (function(ProtoBuf, T) {
35180
35181 var fields = T.getChildren(ProtoBuf.Reflect.Message.Field),
35182 oneofs = T.getChildren(ProtoBuf.Reflect.Message.OneOf);
35183
35184 /**
35185 * Constructs a new runtime Message.
35186 * @name ProtoBuf.Builder.Message
35187 * @class Barebone of all runtime messages.
35188 * @param {!Object.<string,*>|string} values Preset values
35189 * @param {...string} var_args
35190 * @constructor
35191 * @throws {Error} If the message cannot be created
35192 */
35193 var Message = function(values, var_args) {
35194 ProtoBuf.Builder.Message.call(this);
35195
35196 // Create virtual oneof properties
35197 for (var i=0, k=oneofs.length; i<k; ++i)
35198 this[oneofs[i].name] = null;
35199 // Create fields and set default values
35200 for (i=0, k=fields.length; i<k; ++i) {
35201 var field = fields[i];
35202 this[field.name] =
35203 field.repeated ? [] :
35204 (field.map ? new ProtoBuf.Map(field) : null);
35205 if ((field.required || T.syntax === 'proto3') &&
35206 field.defaultValue !== null)
35207 this[field.name] = field.defaultValue;
35208 }
35209
35210 if (arguments.length > 0) {
35211 var value;
35212 // Set field values from a values object
35213 if (arguments.length === 1 && values !== null && typeof values === 'object' &&
35214 /* not _another_ Message */ (typeof values.encode !== 'function' || values instanceof Message) &&
35215 /* not a repeated field */ !Array.isArray(values) &&
35216 /* not a Map */ !(values instanceof ProtoBuf.Map) &&
35217 /* not a ByteBuffer */ !ByteBuffer.isByteBuffer(values) &&
35218 /* not an ArrayBuffer */ !(values instanceof ArrayBuffer) &&
35219 /* not a Long */ !(ProtoBuf.Long && values instanceof ProtoBuf.Long)) {
35220 this.$set(values);
35221 } else // Set field values from arguments, in declaration order
35222 for (i=0, k=arguments.length; i<k; ++i)
35223 if (typeof (value = arguments[i]) !== 'undefined')
35224 this.$set(fields[i].name, value); // May throw
35225 }
35226 };
35227
35228 /**
35229 * @alias ProtoBuf.Builder.Message.prototype
35230 * @inner
35231 */
35232 var MessagePrototype = Message.prototype = Object.create(ProtoBuf.Builder.Message.prototype);
35233
35234 /**
35235 * Adds a value to a repeated field.
35236 * @name ProtoBuf.Builder.Message#add
35237 * @function
35238 * @param {string} key Field name
35239 * @param {*} value Value to add
35240 * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
35241 * @returns {!ProtoBuf.Builder.Message} this
35242 * @throws {Error} If the value cannot be added
35243 * @expose
35244 */
35245 MessagePrototype.add = function(key, value, noAssert) {
35246 var field = T._fieldsByName[key];
35247 if (!noAssert) {
35248 if (!field)
35249 throw Error(this+"#"+key+" is undefined");
35250 if (!(field instanceof ProtoBuf.Reflect.Message.Field))
35251 throw Error(this+"#"+key+" is not a field: "+field.toString(true)); // May throw if it's an enum or embedded message
35252 if (!field.repeated)
35253 throw Error(this+"#"+key+" is not a repeated field");
35254 value = field.verifyValue(value, true);
35255 }
35256 if (this[key] === null)
35257 this[key] = [];
35258 this[key].push(value);
35259 return this;
35260 };
35261
35262 /**
35263 * Adds a value to a repeated field. This is an alias for {@link ProtoBuf.Builder.Message#add}.
35264 * @name ProtoBuf.Builder.Message#$add
35265 * @function
35266 * @param {string} key Field name
35267 * @param {*} value Value to add
35268 * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
35269 * @returns {!ProtoBuf.Builder.Message} this
35270 * @throws {Error} If the value cannot be added
35271 * @expose
35272 */
35273 MessagePrototype.$add = MessagePrototype.add;
35274
35275 /**
35276 * Sets a field's value.
35277 * @name ProtoBuf.Builder.Message#set
35278 * @function
35279 * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
35280 * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
35281 * @param {boolean=} noAssert Whether to not assert for an actual field / proper value type, defaults to `false`
35282 * @returns {!ProtoBuf.Builder.Message} this
35283 * @throws {Error} If the value cannot be set
35284 * @expose
35285 */
35286 MessagePrototype.set = function(keyOrObj, value, noAssert) {
35287 if (keyOrObj && typeof keyOrObj === 'object') {
35288 noAssert = value;
35289 for (var ikey in keyOrObj) {
35290 // Check if virtual oneof field - don't set these
35291 if (keyOrObj.hasOwnProperty(ikey) && typeof (value = keyOrObj[ikey]) !== 'undefined' && T._oneofsByName[ikey] === undefined)
35292 this.$set(ikey, value, noAssert);
35293 }
35294 return this;
35295 }
35296 var field = T._fieldsByName[keyOrObj];
35297 if (!noAssert) {
35298 if (!field)
35299 throw Error(this+"#"+keyOrObj+" is not a field: undefined");
35300 if (!(field instanceof ProtoBuf.Reflect.Message.Field))
35301 throw Error(this+"#"+keyOrObj+" is not a field: "+field.toString(true));
35302 this[field.name] = (value = field.verifyValue(value)); // May throw
35303 } else
35304 this[keyOrObj] = value;
35305 if (field && field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
35306 var currentField = this[field.oneof.name]; // Virtual field references currently set field
35307 if (value !== null) {
35308 if (currentField !== null && currentField !== field.name)
35309 this[currentField] = null; // Clear currently set field
35310 this[field.oneof.name] = field.name; // Point virtual field at this field
35311 } else if (/* value === null && */currentField === keyOrObj)
35312 this[field.oneof.name] = null; // Clear virtual field (current field explicitly cleared)
35313 }
35314 return this;
35315 };
35316
35317 /**
35318 * Sets a field's value. This is an alias for [@link ProtoBuf.Builder.Message#set}.
35319 * @name ProtoBuf.Builder.Message#$set
35320 * @function
35321 * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
35322 * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
35323 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
35324 * @throws {Error} If the value cannot be set
35325 * @expose
35326 */
35327 MessagePrototype.$set = MessagePrototype.set;
35328
35329 /**
35330 * Gets a field's value.
35331 * @name ProtoBuf.Builder.Message#get
35332 * @function
35333 * @param {string} key Key
35334 * @param {boolean=} noAssert Whether to not assert for an actual field, defaults to `false`
35335 * @return {*} Value
35336 * @throws {Error} If there is no such field
35337 * @expose
35338 */
35339 MessagePrototype.get = function(key, noAssert) {
35340 if (noAssert)
35341 return this[key];
35342 var field = T._fieldsByName[key];
35343 if (!field || !(field instanceof ProtoBuf.Reflect.Message.Field))
35344 throw Error(this+"#"+key+" is not a field: undefined");
35345 if (!(field instanceof ProtoBuf.Reflect.Message.Field))
35346 throw Error(this+"#"+key+" is not a field: "+field.toString(true));
35347 return this[field.name];
35348 };
35349
35350 /**
35351 * Gets a field's value. This is an alias for {@link ProtoBuf.Builder.Message#$get}.
35352 * @name ProtoBuf.Builder.Message#$get
35353 * @function
35354 * @param {string} key Key
35355 * @return {*} Value
35356 * @throws {Error} If there is no such field
35357 * @expose
35358 */
35359 MessagePrototype.$get = MessagePrototype.get;
35360
35361 // Getters and setters
35362
35363 for (var i=0; i<fields.length; i++) {
35364 var field = fields[i];
35365 // no setters for extension fields as these are named by their fqn
35366 if (field instanceof ProtoBuf.Reflect.Message.ExtensionField)
35367 continue;
35368
35369 if (T.builder.options['populateAccessors'])
35370 (function(field) {
35371 // set/get[SomeValue]
35372 var Name = field.originalName.replace(/(_[a-zA-Z])/g, function(match) {
35373 return match.toUpperCase().replace('_','');
35374 });
35375 Name = Name.substring(0,1).toUpperCase() + Name.substring(1);
35376
35377 // set/get_[some_value] FIXME: Do we really need these?
35378 var name = field.originalName.replace(/([A-Z])/g, function(match) {
35379 return "_"+match;
35380 });
35381
35382 /**
35383 * The current field's unbound setter function.
35384 * @function
35385 * @param {*} value
35386 * @param {boolean=} noAssert
35387 * @returns {!ProtoBuf.Builder.Message}
35388 * @inner
35389 */
35390 var setter = function(value, noAssert) {
35391 this[field.name] = noAssert ? value : field.verifyValue(value);
35392 return this;
35393 };
35394
35395 /**
35396 * The current field's unbound getter function.
35397 * @function
35398 * @returns {*}
35399 * @inner
35400 */
35401 var getter = function() {
35402 return this[field.name];
35403 };
35404
35405 if (T.getChild("set"+Name) === null)
35406 /**
35407 * Sets a value. This method is present for each field, but only if there is no name conflict with
35408 * another field.
35409 * @name ProtoBuf.Builder.Message#set[SomeField]
35410 * @function
35411 * @param {*} value Value to set
35412 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
35413 * @returns {!ProtoBuf.Builder.Message} this
35414 * @abstract
35415 * @throws {Error} If the value cannot be set
35416 */
35417 MessagePrototype["set"+Name] = setter;
35418
35419 if (T.getChild("set_"+name) === null)
35420 /**
35421 * Sets a value. This method is present for each field, but only if there is no name conflict with
35422 * another field.
35423 * @name ProtoBuf.Builder.Message#set_[some_field]
35424 * @function
35425 * @param {*} value Value to set
35426 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
35427 * @returns {!ProtoBuf.Builder.Message} this
35428 * @abstract
35429 * @throws {Error} If the value cannot be set
35430 */
35431 MessagePrototype["set_"+name] = setter;
35432
35433 if (T.getChild("get"+Name) === null)
35434 /**
35435 * Gets a value. This method is present for each field, but only if there is no name conflict with
35436 * another field.
35437 * @name ProtoBuf.Builder.Message#get[SomeField]
35438 * @function
35439 * @abstract
35440 * @return {*} The value
35441 */
35442 MessagePrototype["get"+Name] = getter;
35443
35444 if (T.getChild("get_"+name) === null)
35445 /**
35446 * Gets a value. This method is present for each field, but only if there is no name conflict with
35447 * another field.
35448 * @name ProtoBuf.Builder.Message#get_[some_field]
35449 * @function
35450 * @return {*} The value
35451 * @abstract
35452 */
35453 MessagePrototype["get_"+name] = getter;
35454
35455 })(field);
35456 }
35457
35458 // En-/decoding
35459
35460 /**
35461 * Encodes the message.
35462 * @name ProtoBuf.Builder.Message#$encode
35463 * @function
35464 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
35465 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
35466 * @return {!ByteBuffer} Encoded message as a ByteBuffer
35467 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
35468 * returns the encoded ByteBuffer in the `encoded` property on the error.
35469 * @expose
35470 * @see ProtoBuf.Builder.Message#encode64
35471 * @see ProtoBuf.Builder.Message#encodeHex
35472 * @see ProtoBuf.Builder.Message#encodeAB
35473 */
35474 MessagePrototype.encode = function(buffer, noVerify) {
35475 if (typeof buffer === 'boolean')
35476 noVerify = buffer,
35477 buffer = undefined;
35478 var isNew = false;
35479 if (!buffer)
35480 buffer = new ByteBuffer(),
35481 isNew = true;
35482 var le = buffer.littleEndian;
35483 try {
35484 T.encode(this, buffer.LE(), noVerify);
35485 return (isNew ? buffer.flip() : buffer).LE(le);
35486 } catch (e) {
35487 buffer.LE(le);
35488 throw(e);
35489 }
35490 };
35491
35492 /**
35493 * Encodes a message using the specified data payload.
35494 * @param {!Object.<string,*>} data Data payload
35495 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
35496 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
35497 * @return {!ByteBuffer} Encoded message as a ByteBuffer
35498 * @expose
35499 */
35500 Message.encode = function(data, buffer, noVerify) {
35501 return new Message(data).encode(buffer, noVerify);
35502 };
35503
35504 /**
35505 * Calculates the byte length of the message.
35506 * @name ProtoBuf.Builder.Message#calculate
35507 * @function
35508 * @returns {number} Byte length
35509 * @throws {Error} If the message cannot be calculated or if required fields are missing.
35510 * @expose
35511 */
35512 MessagePrototype.calculate = function() {
35513 return T.calculate(this);
35514 };
35515
35516 /**
35517 * Encodes the varint32 length-delimited message.
35518 * @name ProtoBuf.Builder.Message#encodeDelimited
35519 * @function
35520 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
35521 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
35522 * @return {!ByteBuffer} Encoded message as a ByteBuffer
35523 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
35524 * returns the encoded ByteBuffer in the `encoded` property on the error.
35525 * @expose
35526 */
35527 MessagePrototype.encodeDelimited = function(buffer, noVerify) {
35528 var isNew = false;
35529 if (!buffer)
35530 buffer = new ByteBuffer(),
35531 isNew = true;
35532 var enc = new ByteBuffer().LE();
35533 T.encode(this, enc, noVerify).flip();
35534 buffer.writeVarint32(enc.remaining());
35535 buffer.append(enc);
35536 return isNew ? buffer.flip() : buffer;
35537 };
35538
35539 /**
35540 * Directly encodes the message to an ArrayBuffer.
35541 * @name ProtoBuf.Builder.Message#encodeAB
35542 * @function
35543 * @return {ArrayBuffer} Encoded message as ArrayBuffer
35544 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
35545 * returns the encoded ArrayBuffer in the `encoded` property on the error.
35546 * @expose
35547 */
35548 MessagePrototype.encodeAB = function() {
35549 try {
35550 return this.encode().toArrayBuffer();
35551 } catch (e) {
35552 if (e["encoded"]) e["encoded"] = e["encoded"].toArrayBuffer();
35553 throw(e);
35554 }
35555 };
35556
35557 /**
35558 * Returns the message as an ArrayBuffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeAB}.
35559 * @name ProtoBuf.Builder.Message#toArrayBuffer
35560 * @function
35561 * @return {ArrayBuffer} Encoded message as ArrayBuffer
35562 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
35563 * returns the encoded ArrayBuffer in the `encoded` property on the error.
35564 * @expose
35565 */
35566 MessagePrototype.toArrayBuffer = MessagePrototype.encodeAB;
35567
35568 /**
35569 * Directly encodes the message to a node Buffer.
35570 * @name ProtoBuf.Builder.Message#encodeNB
35571 * @function
35572 * @return {!Buffer}
35573 * @throws {Error} If the message cannot be encoded, not running under node.js or if required fields are
35574 * missing. The later still returns the encoded node Buffer in the `encoded` property on the error.
35575 * @expose
35576 */
35577 MessagePrototype.encodeNB = function() {
35578 try {
35579 return this.encode().toBuffer();
35580 } catch (e) {
35581 if (e["encoded"]) e["encoded"] = e["encoded"].toBuffer();
35582 throw(e);
35583 }
35584 };
35585
35586 /**
35587 * Returns the message as a node Buffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeNB}.
35588 * @name ProtoBuf.Builder.Message#toBuffer
35589 * @function
35590 * @return {!Buffer}
35591 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
35592 * returns the encoded node Buffer in the `encoded` property on the error.
35593 * @expose
35594 */
35595 MessagePrototype.toBuffer = MessagePrototype.encodeNB;
35596
35597 /**
35598 * Directly encodes the message to a base64 encoded string.
35599 * @name ProtoBuf.Builder.Message#encode64
35600 * @function
35601 * @return {string} Base64 encoded string
35602 * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
35603 * still returns the encoded base64 string in the `encoded` property on the error.
35604 * @expose
35605 */
35606 MessagePrototype.encode64 = function() {
35607 try {
35608 return this.encode().toBase64();
35609 } catch (e) {
35610 if (e["encoded"]) e["encoded"] = e["encoded"].toBase64();
35611 throw(e);
35612 }
35613 };
35614
35615 /**
35616 * Returns the message as a base64 encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encode64}.
35617 * @name ProtoBuf.Builder.Message#toBase64
35618 * @function
35619 * @return {string} Base64 encoded string
35620 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
35621 * returns the encoded base64 string in the `encoded` property on the error.
35622 * @expose
35623 */
35624 MessagePrototype.toBase64 = MessagePrototype.encode64;
35625
35626 /**
35627 * Directly encodes the message to a hex encoded string.
35628 * @name ProtoBuf.Builder.Message#encodeHex
35629 * @function
35630 * @return {string} Hex encoded string
35631 * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
35632 * still returns the encoded hex string in the `encoded` property on the error.
35633 * @expose
35634 */
35635 MessagePrototype.encodeHex = function() {
35636 try {
35637 return this.encode().toHex();
35638 } catch (e) {
35639 if (e["encoded"]) e["encoded"] = e["encoded"].toHex();
35640 throw(e);
35641 }
35642 };
35643
35644 /**
35645 * Returns the message as a hex encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encodeHex}.
35646 * @name ProtoBuf.Builder.Message#toHex
35647 * @function
35648 * @return {string} Hex encoded string
35649 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
35650 * returns the encoded hex string in the `encoded` property on the error.
35651 * @expose
35652 */
35653 MessagePrototype.toHex = MessagePrototype.encodeHex;
35654
35655 /**
35656 * Clones a message object or field value to a raw object.
35657 * @param {*} obj Object to clone
35658 * @param {boolean} binaryAsBase64 Whether to include binary data as base64 strings or as a buffer otherwise
35659 * @param {boolean} longsAsStrings Whether to encode longs as strings
35660 * @param {!ProtoBuf.Reflect.T=} resolvedType The resolved field type if a field
35661 * @returns {*} Cloned object
35662 * @inner
35663 */
35664 function cloneRaw(obj, binaryAsBase64, longsAsStrings, resolvedType) {
35665 if (obj === null || typeof obj !== 'object') {
35666 // Convert enum values to their respective names
35667 if (resolvedType && resolvedType instanceof ProtoBuf.Reflect.Enum) {
35668 var name = ProtoBuf.Reflect.Enum.getName(resolvedType.object, obj);
35669 if (name !== null)
35670 return name;
35671 }
35672 // Pass-through string, number, boolean, null...
35673 return obj;
35674 }
35675 // Convert ByteBuffers to raw buffer or strings
35676 if (ByteBuffer.isByteBuffer(obj))
35677 return binaryAsBase64 ? obj.toBase64() : obj.toBuffer();
35678 // Convert Longs to proper objects or strings
35679 if (ProtoBuf.Long.isLong(obj))
35680 return longsAsStrings ? obj.toString() : ProtoBuf.Long.fromValue(obj);
35681 var clone;
35682 // Clone arrays
35683 if (Array.isArray(obj)) {
35684 clone = [];
35685 obj.forEach(function(v, k) {
35686 clone[k] = cloneRaw(v, binaryAsBase64, longsAsStrings, resolvedType);
35687 });
35688 return clone;
35689 }
35690 clone = {};
35691 // Convert maps to objects
35692 if (obj instanceof ProtoBuf.Map) {
35693 var it = obj.entries();
35694 for (var e = it.next(); !e.done; e = it.next())
35695 clone[obj.keyElem.valueToString(e.value[0])] = cloneRaw(e.value[1], binaryAsBase64, longsAsStrings, obj.valueElem.resolvedType);
35696 return clone;
35697 }
35698 // Everything else is a non-null object
35699 var type = obj.$type,
35700 field = undefined;
35701 for (var i in obj)
35702 if (obj.hasOwnProperty(i)) {
35703 if (type && (field = type.getChild(i)))
35704 clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings, field.resolvedType);
35705 else
35706 clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings);
35707 }
35708 return clone;
35709 }
35710
35711 /**
35712 * Returns the message's raw payload.
35713 * @param {boolean=} binaryAsBase64 Whether to include binary data as base64 strings instead of Buffers, defaults to `false`
35714 * @param {boolean} longsAsStrings Whether to encode longs as strings
35715 * @returns {Object.<string,*>} Raw payload
35716 * @expose
35717 */
35718 MessagePrototype.toRaw = function(binaryAsBase64, longsAsStrings) {
35719 return cloneRaw(this, !!binaryAsBase64, !!longsAsStrings, this.$type);
35720 };
35721
35722 /**
35723 * Encodes a message to JSON.
35724 * @returns {string} JSON string
35725 * @expose
35726 */
35727 MessagePrototype.encodeJSON = function() {
35728 return JSON.stringify(
35729 cloneRaw(this,
35730 /* binary-as-base64 */ true,
35731 /* longs-as-strings */ true,
35732 this.$type
35733 )
35734 );
35735 };
35736
35737 /**
35738 * Decodes a message from the specified buffer or string.
35739 * @name ProtoBuf.Builder.Message.decode
35740 * @function
35741 * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
35742 * @param {(number|string)=} length Message length. Defaults to decode all the remainig data.
35743 * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
35744 * @return {!ProtoBuf.Builder.Message} Decoded message
35745 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
35746 * returns the decoded message with missing fields in the `decoded` property on the error.
35747 * @expose
35748 * @see ProtoBuf.Builder.Message.decode64
35749 * @see ProtoBuf.Builder.Message.decodeHex
35750 */
35751 Message.decode = function(buffer, length, enc) {
35752 if (typeof length === 'string')
35753 enc = length,
35754 length = -1;
35755 if (typeof buffer === 'string')
35756 buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
35757 else if (!ByteBuffer.isByteBuffer(buffer))
35758 buffer = ByteBuffer.wrap(buffer); // May throw
35759 var le = buffer.littleEndian;
35760 try {
35761 var msg = T.decode(buffer.LE(), length);
35762 buffer.LE(le);
35763 return msg;
35764 } catch (e) {
35765 buffer.LE(le);
35766 throw(e);
35767 }
35768 };
35769
35770 /**
35771 * Decodes a varint32 length-delimited message from the specified buffer or string.
35772 * @name ProtoBuf.Builder.Message.decodeDelimited
35773 * @function
35774 * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
35775 * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
35776 * @return {ProtoBuf.Builder.Message} Decoded message or `null` if not enough bytes are available yet
35777 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
35778 * returns the decoded message with missing fields in the `decoded` property on the error.
35779 * @expose
35780 */
35781 Message.decodeDelimited = function(buffer, enc) {
35782 if (typeof buffer === 'string')
35783 buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
35784 else if (!ByteBuffer.isByteBuffer(buffer))
35785 buffer = ByteBuffer.wrap(buffer); // May throw
35786 if (buffer.remaining() < 1)
35787 return null;
35788 var off = buffer.offset,
35789 len = buffer.readVarint32();
35790 if (buffer.remaining() < len) {
35791 buffer.offset = off;
35792 return null;
35793 }
35794 try {
35795 var msg = T.decode(buffer.slice(buffer.offset, buffer.offset + len).LE());
35796 buffer.offset += len;
35797 return msg;
35798 } catch (err) {
35799 buffer.offset += len;
35800 throw err;
35801 }
35802 };
35803
35804 /**
35805 * Decodes the message from the specified base64 encoded string.
35806 * @name ProtoBuf.Builder.Message.decode64
35807 * @function
35808 * @param {string} str String to decode from
35809 * @return {!ProtoBuf.Builder.Message} Decoded message
35810 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
35811 * returns the decoded message with missing fields in the `decoded` property on the error.
35812 * @expose
35813 */
35814 Message.decode64 = function(str) {
35815 return Message.decode(str, "base64");
35816 };
35817
35818 /**
35819 * Decodes the message from the specified hex encoded string.
35820 * @name ProtoBuf.Builder.Message.decodeHex
35821 * @function
35822 * @param {string} str String to decode from
35823 * @return {!ProtoBuf.Builder.Message} Decoded message
35824 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
35825 * returns the decoded message with missing fields in the `decoded` property on the error.
35826 * @expose
35827 */
35828 Message.decodeHex = function(str) {
35829 return Message.decode(str, "hex");
35830 };
35831
35832 /**
35833 * Decodes the message from a JSON string.
35834 * @name ProtoBuf.Builder.Message.decodeJSON
35835 * @function
35836 * @param {string} str String to decode from
35837 * @return {!ProtoBuf.Builder.Message} Decoded message
35838 * @throws {Error} If the message cannot be decoded or if required fields are
35839 * missing.
35840 * @expose
35841 */
35842 Message.decodeJSON = function(str) {
35843 return new Message(JSON.parse(str));
35844 };
35845
35846 // Utility
35847
35848 /**
35849 * Returns a string representation of this Message.
35850 * @name ProtoBuf.Builder.Message#toString
35851 * @function
35852 * @return {string} String representation as of ".Fully.Qualified.MessageName"
35853 * @expose
35854 */
35855 MessagePrototype.toString = function() {
35856 return T.toString();
35857 };
35858
35859 // Properties
35860
35861 /**
35862 * Message options.
35863 * @name ProtoBuf.Builder.Message.$options
35864 * @type {Object.<string,*>}
35865 * @expose
35866 */
35867 var $optionsS; // cc needs this
35868
35869 /**
35870 * Message options.
35871 * @name ProtoBuf.Builder.Message#$options
35872 * @type {Object.<string,*>}
35873 * @expose
35874 */
35875 var $options;
35876
35877 /**
35878 * Reflection type.
35879 * @name ProtoBuf.Builder.Message.$type
35880 * @type {!ProtoBuf.Reflect.Message}
35881 * @expose
35882 */
35883 var $typeS;
35884
35885 /**
35886 * Reflection type.
35887 * @name ProtoBuf.Builder.Message#$type
35888 * @type {!ProtoBuf.Reflect.Message}
35889 * @expose
35890 */
35891 var $type;
35892
35893 if (Object.defineProperty)
35894 Object.defineProperty(Message, '$options', { "value": T.buildOpt() }),
35895 Object.defineProperty(MessagePrototype, "$options", { "value": Message["$options"] }),
35896 Object.defineProperty(Message, "$type", { "value": T }),
35897 Object.defineProperty(MessagePrototype, "$type", { "value": T });
35898
35899 return Message;
35900
35901 })(ProtoBuf, this);
35902
35903 // Static enums and prototyped sub-messages / cached collections
35904 this._fields = [];
35905 this._fieldsById = {};
35906 this._fieldsByName = {};
35907 this._oneofsByName = {};
35908 for (var i=0, k=this.children.length, child; i<k; i++) {
35909 child = this.children[i];
35910 if (child instanceof Enum || child instanceof Message || child instanceof Service) {
35911 if (clazz.hasOwnProperty(child.name))
35912 throw Error("Illegal reflect child of "+this.toString(true)+": "+child.toString(true)+" cannot override static property '"+child.name+"'");
35913 clazz[child.name] = child.build();
35914 } else if (child instanceof Message.Field)
35915 child.build(),
35916 this._fields.push(child),
35917 this._fieldsById[child.id] = child,
35918 this._fieldsByName[child.name] = child;
35919 else if (child instanceof Message.OneOf) {
35920 this._oneofsByName[child.name] = child;
35921 }
35922 else if (!(child instanceof Message.OneOf) && !(child instanceof Extension)) // Not built
35923 throw Error("Illegal reflect child of "+this.toString(true)+": "+this.children[i].toString(true));
35924 }
35925
35926 return this.clazz = clazz;
35927 };
35928
35929 /**
35930 * Encodes a runtime message's contents to the specified buffer.
35931 * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
35932 * @param {ByteBuffer} buffer ByteBuffer to write to
35933 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
35934 * @return {ByteBuffer} The ByteBuffer for chaining
35935 * @throws {Error} If required fields are missing or the message cannot be encoded for another reason
35936 * @expose
35937 */
35938 MessagePrototype.encode = function(message, buffer, noVerify) {
35939 var fieldMissing = null,
35940 field;
35941 for (var i=0, k=this._fields.length, val; i<k; ++i) {
35942 field = this._fields[i];
35943 val = message[field.name];
35944 if (field.required && val === null) {
35945 if (fieldMissing === null)
35946 fieldMissing = field;
35947 } else
35948 field.encode(noVerify ? val : field.verifyValue(val), buffer, message);
35949 }
35950 if (fieldMissing !== null) {
35951 var err = Error("Missing at least one required field for "+this.toString(true)+": "+fieldMissing);
35952 err["encoded"] = buffer; // Still expose what we got
35953 throw(err);
35954 }
35955 return buffer;
35956 };
35957
35958 /**
35959 * Calculates a runtime message's byte length.
35960 * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
35961 * @returns {number} Byte length
35962 * @throws {Error} If required fields are missing or the message cannot be calculated for another reason
35963 * @expose
35964 */
35965 MessagePrototype.calculate = function(message) {
35966 for (var n=0, i=0, k=this._fields.length, field, val; i<k; ++i) {
35967 field = this._fields[i];
35968 val = message[field.name];
35969 if (field.required && val === null)
35970 throw Error("Missing at least one required field for "+this.toString(true)+": "+field);
35971 else
35972 n += field.calculate(val, message);
35973 }
35974 return n;
35975 };
35976
35977 /**
35978 * Skips all data until the end of the specified group has been reached.
35979 * @param {number} expectedId Expected GROUPEND id
35980 * @param {!ByteBuffer} buf ByteBuffer
35981 * @returns {boolean} `true` if a value as been skipped, `false` if the end has been reached
35982 * @throws {Error} If it wasn't possible to find the end of the group (buffer overrun or end tag mismatch)
35983 * @inner
35984 */
35985 function skipTillGroupEnd(expectedId, buf) {
35986 var tag = buf.readVarint32(), // Throws on OOB
35987 wireType = tag & 0x07,
35988 id = tag >>> 3;
35989 switch (wireType) {
35990 case ProtoBuf.WIRE_TYPES.VARINT:
35991 do tag = buf.readUint8();
35992 while ((tag & 0x80) === 0x80);
35993 break;
35994 case ProtoBuf.WIRE_TYPES.BITS64:
35995 buf.offset += 8;
35996 break;
35997 case ProtoBuf.WIRE_TYPES.LDELIM:
35998 tag = buf.readVarint32(); // reads the varint
35999 buf.offset += tag; // skips n bytes
36000 break;
36001 case ProtoBuf.WIRE_TYPES.STARTGROUP:
36002 skipTillGroupEnd(id, buf);
36003 break;
36004 case ProtoBuf.WIRE_TYPES.ENDGROUP:
36005 if (id === expectedId)
36006 return false;
36007 else
36008 throw Error("Illegal GROUPEND after unknown group: "+id+" ("+expectedId+" expected)");
36009 case ProtoBuf.WIRE_TYPES.BITS32:
36010 buf.offset += 4;
36011 break;
36012 default:
36013 throw Error("Illegal wire type in unknown group "+expectedId+": "+wireType);
36014 }
36015 return true;
36016 }
36017
36018 /**
36019 * Decodes an encoded message and returns the decoded message.
36020 * @param {ByteBuffer} buffer ByteBuffer to decode from
36021 * @param {number=} length Message length. Defaults to decode all remaining data.
36022 * @param {number=} expectedGroupEndId Expected GROUPEND id if this is a legacy group
36023 * @return {ProtoBuf.Builder.Message} Decoded message
36024 * @throws {Error} If the message cannot be decoded
36025 * @expose
36026 */
36027 MessagePrototype.decode = function(buffer, length, expectedGroupEndId) {
36028 if (typeof length !== 'number')
36029 length = -1;
36030 var start = buffer.offset,
36031 msg = new (this.clazz)(),
36032 tag, wireType, id, field;
36033 while (buffer.offset < start+length || (length === -1 && buffer.remaining() > 0)) {
36034 tag = buffer.readVarint32();
36035 wireType = tag & 0x07;
36036 id = tag >>> 3;
36037 if (wireType === ProtoBuf.WIRE_TYPES.ENDGROUP) {
36038 if (id !== expectedGroupEndId)
36039 throw Error("Illegal group end indicator for "+this.toString(true)+": "+id+" ("+(expectedGroupEndId ? expectedGroupEndId+" expected" : "not a group")+")");
36040 break;
36041 }
36042 if (!(field = this._fieldsById[id])) {
36043 // "messages created by your new code can be parsed by your old code: old binaries simply ignore the new field when parsing."
36044 switch (wireType) {
36045 case ProtoBuf.WIRE_TYPES.VARINT:
36046 buffer.readVarint32();
36047 break;
36048 case ProtoBuf.WIRE_TYPES.BITS32:
36049 buffer.offset += 4;
36050 break;
36051 case ProtoBuf.WIRE_TYPES.BITS64:
36052 buffer.offset += 8;
36053 break;
36054 case ProtoBuf.WIRE_TYPES.LDELIM:
36055 var len = buffer.readVarint32();
36056 buffer.offset += len;
36057 break;
36058 case ProtoBuf.WIRE_TYPES.STARTGROUP:
36059 while (skipTillGroupEnd(id, buffer)) {}
36060 break;
36061 default:
36062 throw Error("Illegal wire type for unknown field "+id+" in "+this.toString(true)+"#decode: "+wireType);
36063 }
36064 continue;
36065 }
36066 if (field.repeated && !field.options["packed"]) {
36067 msg[field.name].push(field.decode(wireType, buffer));
36068 } else if (field.map) {
36069 var keyval = field.decode(wireType, buffer);
36070 msg[field.name].set(keyval[0], keyval[1]);
36071 } else {
36072 msg[field.name] = field.decode(wireType, buffer);
36073 if (field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
36074 var currentField = msg[field.oneof.name]; // Virtual field references currently set field
36075 if (currentField !== null && currentField !== field.name)
36076 msg[currentField] = null; // Clear currently set field
36077 msg[field.oneof.name] = field.name; // Point virtual field at this field
36078 }
36079 }
36080 }
36081
36082 // Check if all required fields are present and set default values for optional fields that are not
36083 for (var i=0, k=this._fields.length; i<k; ++i) {
36084 field = this._fields[i];
36085 if (msg[field.name] === null) {
36086 if (this.syntax === "proto3") { // Proto3 sets default values by specification
36087 msg[field.name] = field.defaultValue;
36088 } else if (field.required) {
36089 var err = Error("Missing at least one required field for " + this.toString(true) + ": " + field.name);
36090 err["decoded"] = msg; // Still expose what we got
36091 throw(err);
36092 } else if (ProtoBuf.populateDefaults && field.defaultValue !== null)
36093 msg[field.name] = field.defaultValue;
36094 }
36095 }
36096 return msg;
36097 };
36098
36099 /**
36100 * @alias ProtoBuf.Reflect.Message
36101 * @expose
36102 */
36103 Reflect.Message = Message;
36104
36105 /**
36106 * Constructs a new Message Field.
36107 * @exports ProtoBuf.Reflect.Message.Field
36108 * @param {!ProtoBuf.Builder} builder Builder reference
36109 * @param {!ProtoBuf.Reflect.Message} message Message reference
36110 * @param {string} rule Rule, one of requried, optional, repeated
36111 * @param {string?} keytype Key data type, if any.
36112 * @param {string} type Data type, e.g. int32
36113 * @param {string} name Field name
36114 * @param {number} id Unique field id
36115 * @param {Object.<string,*>=} options Options
36116 * @param {!ProtoBuf.Reflect.Message.OneOf=} oneof Enclosing OneOf
36117 * @param {string?} syntax The syntax level of this definition (e.g., proto3)
36118 * @constructor
36119 * @extends ProtoBuf.Reflect.T
36120 */
36121 var Field = function(builder, message, rule, keytype, type, name, id, options, oneof, syntax) {
36122 T.call(this, builder, message, name);
36123
36124 /**
36125 * @override
36126 */
36127 this.className = "Message.Field";
36128
36129 /**
36130 * Message field required flag.
36131 * @type {boolean}
36132 * @expose
36133 */
36134 this.required = rule === "required";
36135
36136 /**
36137 * Message field repeated flag.
36138 * @type {boolean}
36139 * @expose
36140 */
36141 this.repeated = rule === "repeated";
36142
36143 /**
36144 * Message field map flag.
36145 * @type {boolean}
36146 * @expose
36147 */
36148 this.map = rule === "map";
36149
36150 /**
36151 * Message field key type. Type reference string if unresolved, protobuf
36152 * type if resolved. Valid only if this.map === true, null otherwise.
36153 * @type {string|{name: string, wireType: number}|null}
36154 * @expose
36155 */
36156 this.keyType = keytype || null;
36157
36158 /**
36159 * Message field type. Type reference string if unresolved, protobuf type if
36160 * resolved. In a map field, this is the value type.
36161 * @type {string|{name: string, wireType: number}}
36162 * @expose
36163 */
36164 this.type = type;
36165
36166 /**
36167 * Resolved type reference inside the global namespace.
36168 * @type {ProtoBuf.Reflect.T|null}
36169 * @expose
36170 */
36171 this.resolvedType = null;
36172
36173 /**
36174 * Unique message field id.
36175 * @type {number}
36176 * @expose
36177 */
36178 this.id = id;
36179
36180 /**
36181 * Message field options.
36182 * @type {!Object.<string,*>}
36183 * @dict
36184 * @expose
36185 */
36186 this.options = options || {};
36187
36188 /**
36189 * Default value.
36190 * @type {*}
36191 * @expose
36192 */
36193 this.defaultValue = null;
36194
36195 /**
36196 * Enclosing OneOf.
36197 * @type {?ProtoBuf.Reflect.Message.OneOf}
36198 * @expose
36199 */
36200 this.oneof = oneof || null;
36201
36202 /**
36203 * Syntax level of this definition (e.g., proto3).
36204 * @type {string}
36205 * @expose
36206 */
36207 this.syntax = syntax || 'proto2';
36208
36209 /**
36210 * Original field name.
36211 * @type {string}
36212 * @expose
36213 */
36214 this.originalName = this.name; // Used to revert camelcase transformation on naming collisions
36215
36216 /**
36217 * Element implementation. Created in build() after types are resolved.
36218 * @type {ProtoBuf.Element}
36219 * @expose
36220 */
36221 this.element = null;
36222
36223 /**
36224 * Key element implementation, for map fields. Created in build() after
36225 * types are resolved.
36226 * @type {ProtoBuf.Element}
36227 * @expose
36228 */
36229 this.keyElement = null;
36230
36231 // Convert field names to camel case notation if the override is set
36232 if (this.builder.options['convertFieldsToCamelCase'] && !(this instanceof Message.ExtensionField))
36233 this.name = ProtoBuf.Util.toCamelCase(this.name);
36234 };
36235
36236 /**
36237 * @alias ProtoBuf.Reflect.Message.Field.prototype
36238 * @inner
36239 */
36240 var FieldPrototype = Field.prototype = Object.create(T.prototype);
36241
36242 /**
36243 * Builds the field.
36244 * @override
36245 * @expose
36246 */
36247 FieldPrototype.build = function() {
36248 this.element = new Element(this.type, this.resolvedType, false, this.syntax, this.name);
36249 if (this.map)
36250 this.keyElement = new Element(this.keyType, undefined, true, this.syntax, this.name);
36251
36252 // In proto3, fields do not have field presence, and every field is set to
36253 // its type's default value ("", 0, 0.0, or false).
36254 if (this.syntax === 'proto3' && !this.repeated && !this.map)
36255 this.defaultValue = Element.defaultFieldValue(this.type);
36256
36257 // Otherwise, default values are present when explicitly specified
36258 else if (typeof this.options['default'] !== 'undefined')
36259 this.defaultValue = this.verifyValue(this.options['default']);
36260 };
36261
36262 /**
36263 * Checks if the given value can be set for this field.
36264 * @param {*} value Value to check
36265 * @param {boolean=} skipRepeated Whether to skip the repeated value check or not. Defaults to false.
36266 * @return {*} Verified, maybe adjusted, value
36267 * @throws {Error} If the value cannot be set for this field
36268 * @expose
36269 */
36270 FieldPrototype.verifyValue = function(value, skipRepeated) {
36271 skipRepeated = skipRepeated || false;
36272 var self = this;
36273 function fail(val, msg) {
36274 throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
36275 }
36276 if (value === null) { // NULL values for optional fields
36277 if (this.required)
36278 fail(typeof value, "required");
36279 if (this.syntax === 'proto3' && this.type !== ProtoBuf.TYPES["message"])
36280 fail(typeof value, "proto3 field without field presence cannot be null");
36281 return null;
36282 }
36283 var i;
36284 if (this.repeated && !skipRepeated) { // Repeated values as arrays
36285 if (!Array.isArray(value))
36286 value = [value];
36287 var res = [];
36288 for (i=0; i<value.length; i++)
36289 res.push(this.element.verifyValue(value[i]));
36290 return res;
36291 }
36292 if (this.map && !skipRepeated) { // Map values as objects
36293 if (!(value instanceof ProtoBuf.Map)) {
36294 // If not already a Map, attempt to convert.
36295 if (!(value instanceof Object)) {
36296 fail(typeof value,
36297 "expected ProtoBuf.Map or raw object for map field");
36298 }
36299 return new ProtoBuf.Map(this, value);
36300 } else {
36301 return value;
36302 }
36303 }
36304 // All non-repeated fields expect no array
36305 if (!this.repeated && Array.isArray(value))
36306 fail(typeof value, "no array expected");
36307
36308 return this.element.verifyValue(value);
36309 };
36310
36311 /**
36312 * Determines whether the field will have a presence on the wire given its
36313 * value.
36314 * @param {*} value Verified field value
36315 * @param {!ProtoBuf.Builder.Message} message Runtime message
36316 * @return {boolean} Whether the field will be present on the wire
36317 */
36318 FieldPrototype.hasWirePresence = function(value, message) {
36319 if (this.syntax !== 'proto3')
36320 return (value !== null);
36321 if (this.oneof && message[this.oneof.name] === this.name)
36322 return true;
36323 switch (this.type) {
36324 case ProtoBuf.TYPES["int32"]:
36325 case ProtoBuf.TYPES["sint32"]:
36326 case ProtoBuf.TYPES["sfixed32"]:
36327 case ProtoBuf.TYPES["uint32"]:
36328 case ProtoBuf.TYPES["fixed32"]:
36329 return value !== 0;
36330
36331 case ProtoBuf.TYPES["int64"]:
36332 case ProtoBuf.TYPES["sint64"]:
36333 case ProtoBuf.TYPES["sfixed64"]:
36334 case ProtoBuf.TYPES["uint64"]:
36335 case ProtoBuf.TYPES["fixed64"]:
36336 return value.low !== 0 || value.high !== 0;
36337
36338 case ProtoBuf.TYPES["bool"]:
36339 return value;
36340
36341 case ProtoBuf.TYPES["float"]:
36342 case ProtoBuf.TYPES["double"]:
36343 return value !== 0.0;
36344
36345 case ProtoBuf.TYPES["string"]:
36346 return value.length > 0;
36347
36348 case ProtoBuf.TYPES["bytes"]:
36349 return value.remaining() > 0;
36350
36351 case ProtoBuf.TYPES["enum"]:
36352 return value !== 0;
36353
36354 case ProtoBuf.TYPES["message"]:
36355 return value !== null;
36356 default:
36357 return true;
36358 }
36359 };
36360
36361 /**
36362 * Encodes the specified field value to the specified buffer.
36363 * @param {*} value Verified field value
36364 * @param {ByteBuffer} buffer ByteBuffer to encode to
36365 * @param {!ProtoBuf.Builder.Message} message Runtime message
36366 * @return {ByteBuffer} The ByteBuffer for chaining
36367 * @throws {Error} If the field cannot be encoded
36368 * @expose
36369 */
36370 FieldPrototype.encode = function(value, buffer, message) {
36371 if (this.type === null || typeof this.type !== 'object')
36372 throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
36373 if (value === null || (this.repeated && value.length == 0))
36374 return buffer; // Optional omitted
36375 try {
36376 if (this.repeated) {
36377 var i;
36378 // "Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire
36379 // types) can be declared 'packed'."
36380 if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
36381 // "All of the elements of the field are packed into a single key-value pair with wire type 2
36382 // (length-delimited). Each element is encoded the same way it would be normally, except without a
36383 // tag preceding it."
36384 buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
36385 buffer.ensureCapacity(buffer.offset += 1); // We do not know the length yet, so let's assume a varint of length 1
36386 var start = buffer.offset; // Remember where the contents begin
36387 for (i=0; i<value.length; i++)
36388 this.element.encodeValue(this.id, value[i], buffer);
36389 var len = buffer.offset-start,
36390 varintLen = ByteBuffer.calculateVarint32(len);
36391 if (varintLen > 1) { // We need to move the contents
36392 var contents = buffer.slice(start, buffer.offset);
36393 start += varintLen-1;
36394 buffer.offset = start;
36395 buffer.append(contents);
36396 }
36397 buffer.writeVarint32(len, start-varintLen);
36398 } else {
36399 // "If your message definition has repeated elements (without the [packed=true] option), the encoded
36400 // message has zero or more key-value pairs with the same tag number"
36401 for (i=0; i<value.length; i++)
36402 buffer.writeVarint32((this.id << 3) | this.type.wireType),
36403 this.element.encodeValue(this.id, value[i], buffer);
36404 }
36405 } else if (this.map) {
36406 // Write out each map entry as a submessage.
36407 value.forEach(function(val, key, m) {
36408 // Compute the length of the submessage (key, val) pair.
36409 var length =
36410 ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
36411 this.keyElement.calculateLength(1, key) +
36412 ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
36413 this.element.calculateLength(2, val);
36414
36415 // Submessage with wire type of length-delimited.
36416 buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
36417 buffer.writeVarint32(length);
36418
36419 // Write out the key and val.
36420 buffer.writeVarint32((1 << 3) | this.keyType.wireType);
36421 this.keyElement.encodeValue(1, key, buffer);
36422 buffer.writeVarint32((2 << 3) | this.type.wireType);
36423 this.element.encodeValue(2, val, buffer);
36424 }, this);
36425 } else {
36426 if (this.hasWirePresence(value, message)) {
36427 buffer.writeVarint32((this.id << 3) | this.type.wireType);
36428 this.element.encodeValue(this.id, value, buffer);
36429 }
36430 }
36431 } catch (e) {
36432 throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
36433 }
36434 return buffer;
36435 };
36436
36437 /**
36438 * Calculates the length of this field's value on the network level.
36439 * @param {*} value Field value
36440 * @param {!ProtoBuf.Builder.Message} message Runtime message
36441 * @returns {number} Byte length
36442 * @expose
36443 */
36444 FieldPrototype.calculate = function(value, message) {
36445 value = this.verifyValue(value); // May throw
36446 if (this.type === null || typeof this.type !== 'object')
36447 throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
36448 if (value === null || (this.repeated && value.length == 0))
36449 return 0; // Optional omitted
36450 var n = 0;
36451 try {
36452 if (this.repeated) {
36453 var i, ni;
36454 if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
36455 n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
36456 ni = 0;
36457 for (i=0; i<value.length; i++)
36458 ni += this.element.calculateLength(this.id, value[i]);
36459 n += ByteBuffer.calculateVarint32(ni);
36460 n += ni;
36461 } else {
36462 for (i=0; i<value.length; i++)
36463 n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType),
36464 n += this.element.calculateLength(this.id, value[i]);
36465 }
36466 } else if (this.map) {
36467 // Each map entry becomes a submessage.
36468 value.forEach(function(val, key, m) {
36469 // Compute the length of the submessage (key, val) pair.
36470 var length =
36471 ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
36472 this.keyElement.calculateLength(1, key) +
36473 ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
36474 this.element.calculateLength(2, val);
36475
36476 n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
36477 n += ByteBuffer.calculateVarint32(length);
36478 n += length;
36479 }, this);
36480 } else {
36481 if (this.hasWirePresence(value, message)) {
36482 n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType);
36483 n += this.element.calculateLength(this.id, value);
36484 }
36485 }
36486 } catch (e) {
36487 throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
36488 }
36489 return n;
36490 };
36491
36492 /**
36493 * Decode the field value from the specified buffer.
36494 * @param {number} wireType Leading wire type
36495 * @param {ByteBuffer} buffer ByteBuffer to decode from
36496 * @param {boolean=} skipRepeated Whether to skip the repeated check or not. Defaults to false.
36497 * @return {*} Decoded value: array for packed repeated fields, [key, value] for
36498 * map fields, or an individual value otherwise.
36499 * @throws {Error} If the field cannot be decoded
36500 * @expose
36501 */
36502 FieldPrototype.decode = function(wireType, buffer, skipRepeated) {
36503 var value, nBytes;
36504
36505 // We expect wireType to match the underlying type's wireType unless we see
36506 // a packed repeated field, or unless this is a map field.
36507 var wireTypeOK =
36508 (!this.map && wireType == this.type.wireType) ||
36509 (!skipRepeated && this.repeated && this.options["packed"] &&
36510 wireType == ProtoBuf.WIRE_TYPES.LDELIM) ||
36511 (this.map && wireType == ProtoBuf.WIRE_TYPES.LDELIM);
36512 if (!wireTypeOK)
36513 throw Error("Illegal wire type for field "+this.toString(true)+": "+wireType+" ("+this.type.wireType+" expected)");
36514
36515 // Handle packed repeated fields.
36516 if (wireType == ProtoBuf.WIRE_TYPES.LDELIM && this.repeated && this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
36517 if (!skipRepeated) {
36518 nBytes = buffer.readVarint32();
36519 nBytes = buffer.offset + nBytes; // Limit
36520 var values = [];
36521 while (buffer.offset < nBytes)
36522 values.push(this.decode(this.type.wireType, buffer, true));
36523 return values;
36524 }
36525 // Read the next value otherwise...
36526 }
36527
36528 // Handle maps.
36529 if (this.map) {
36530 // Read one (key, value) submessage, and return [key, value]
36531 var key = Element.defaultFieldValue(this.keyType);
36532 value = Element.defaultFieldValue(this.type);
36533
36534 // Read the length
36535 nBytes = buffer.readVarint32();
36536 if (buffer.remaining() < nBytes)
36537 throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
36538
36539 // Get a sub-buffer of this key/value submessage
36540 var msgbuf = buffer.clone();
36541 msgbuf.limit = msgbuf.offset + nBytes;
36542 buffer.offset += nBytes;
36543
36544 while (msgbuf.remaining() > 0) {
36545 var tag = msgbuf.readVarint32();
36546 wireType = tag & 0x07;
36547 var id = tag >>> 3;
36548 if (id === 1) {
36549 key = this.keyElement.decode(msgbuf, wireType, id);
36550 } else if (id === 2) {
36551 value = this.element.decode(msgbuf, wireType, id);
36552 } else {
36553 throw Error("Unexpected tag in map field key/value submessage");
36554 }
36555 }
36556
36557 return [key, value];
36558 }
36559
36560 // Handle singular and non-packed repeated field values.
36561 return this.element.decode(buffer, wireType, this.id);
36562 };
36563
36564 /**
36565 * @alias ProtoBuf.Reflect.Message.Field
36566 * @expose
36567 */
36568 Reflect.Message.Field = Field;
36569
36570 /**
36571 * Constructs a new Message ExtensionField.
36572 * @exports ProtoBuf.Reflect.Message.ExtensionField
36573 * @param {!ProtoBuf.Builder} builder Builder reference
36574 * @param {!ProtoBuf.Reflect.Message} message Message reference
36575 * @param {string} rule Rule, one of requried, optional, repeated
36576 * @param {string} type Data type, e.g. int32
36577 * @param {string} name Field name
36578 * @param {number} id Unique field id
36579 * @param {!Object.<string,*>=} options Options
36580 * @constructor
36581 * @extends ProtoBuf.Reflect.Message.Field
36582 */
36583 var ExtensionField = function(builder, message, rule, type, name, id, options) {
36584 Field.call(this, builder, message, rule, /* keytype = */ null, type, name, id, options);
36585
36586 /**
36587 * Extension reference.
36588 * @type {!ProtoBuf.Reflect.Extension}
36589 * @expose
36590 */
36591 this.extension;
36592 };
36593
36594 // Extends Field
36595 ExtensionField.prototype = Object.create(Field.prototype);
36596
36597 /**
36598 * @alias ProtoBuf.Reflect.Message.ExtensionField
36599 * @expose
36600 */
36601 Reflect.Message.ExtensionField = ExtensionField;
36602
36603 /**
36604 * Constructs a new Message OneOf.
36605 * @exports ProtoBuf.Reflect.Message.OneOf
36606 * @param {!ProtoBuf.Builder} builder Builder reference
36607 * @param {!ProtoBuf.Reflect.Message} message Message reference
36608 * @param {string} name OneOf name
36609 * @constructor
36610 * @extends ProtoBuf.Reflect.T
36611 */
36612 var OneOf = function(builder, message, name) {
36613 T.call(this, builder, message, name);
36614
36615 /**
36616 * Enclosed fields.
36617 * @type {!Array.<!ProtoBuf.Reflect.Message.Field>}
36618 * @expose
36619 */
36620 this.fields = [];
36621 };
36622
36623 /**
36624 * @alias ProtoBuf.Reflect.Message.OneOf
36625 * @expose
36626 */
36627 Reflect.Message.OneOf = OneOf;
36628
36629 /**
36630 * Constructs a new Enum.
36631 * @exports ProtoBuf.Reflect.Enum
36632 * @param {!ProtoBuf.Builder} builder Builder reference
36633 * @param {!ProtoBuf.Reflect.T} parent Parent Reflect object
36634 * @param {string} name Enum name
36635 * @param {Object.<string,*>=} options Enum options
36636 * @param {string?} syntax The syntax level (e.g., proto3)
36637 * @constructor
36638 * @extends ProtoBuf.Reflect.Namespace
36639 */
36640 var Enum = function(builder, parent, name, options, syntax) {
36641 Namespace.call(this, builder, parent, name, options, syntax);
36642
36643 /**
36644 * @override
36645 */
36646 this.className = "Enum";
36647
36648 /**
36649 * Runtime enum object.
36650 * @type {Object.<string,number>|null}
36651 * @expose
36652 */
36653 this.object = null;
36654 };
36655
36656 /**
36657 * Gets the string name of an enum value.
36658 * @param {!ProtoBuf.Builder.Enum} enm Runtime enum
36659 * @param {number} value Enum value
36660 * @returns {?string} Name or `null` if not present
36661 * @expose
36662 */
36663 Enum.getName = function(enm, value) {
36664 var keys = Object.keys(enm);
36665 for (var i=0, key; i<keys.length; ++i)
36666 if (enm[key = keys[i]] === value)
36667 return key;
36668 return null;
36669 };
36670
36671 /**
36672 * @alias ProtoBuf.Reflect.Enum.prototype
36673 * @inner
36674 */
36675 var EnumPrototype = Enum.prototype = Object.create(Namespace.prototype);
36676
36677 /**
36678 * Builds this enum and returns the runtime counterpart.
36679 * @param {boolean} rebuild Whether to rebuild or not, defaults to false
36680 * @returns {!Object.<string,number>}
36681 * @expose
36682 */
36683 EnumPrototype.build = function(rebuild) {
36684 if (this.object && !rebuild)
36685 return this.object;
36686 var enm = new ProtoBuf.Builder.Enum(),
36687 values = this.getChildren(Enum.Value);
36688 for (var i=0, k=values.length; i<k; ++i)
36689 enm[values[i]['name']] = values[i]['id'];
36690 if (Object.defineProperty)
36691 Object.defineProperty(enm, '$options', {
36692 "value": this.buildOpt(),
36693 "enumerable": false
36694 });
36695 return this.object = enm;
36696 };
36697
36698 /**
36699 * @alias ProtoBuf.Reflect.Enum
36700 * @expose
36701 */
36702 Reflect.Enum = Enum;
36703
36704 /**
36705 * Constructs a new Enum Value.
36706 * @exports ProtoBuf.Reflect.Enum.Value
36707 * @param {!ProtoBuf.Builder} builder Builder reference
36708 * @param {!ProtoBuf.Reflect.Enum} enm Enum reference
36709 * @param {string} name Field name
36710 * @param {number} id Unique field id
36711 * @constructor
36712 * @extends ProtoBuf.Reflect.T
36713 */
36714 var Value = function(builder, enm, name, id) {
36715 T.call(this, builder, enm, name);
36716
36717 /**
36718 * @override
36719 */
36720 this.className = "Enum.Value";
36721
36722 /**
36723 * Unique enum value id.
36724 * @type {number}
36725 * @expose
36726 */
36727 this.id = id;
36728 };
36729
36730 // Extends T
36731 Value.prototype = Object.create(T.prototype);
36732
36733 /**
36734 * @alias ProtoBuf.Reflect.Enum.Value
36735 * @expose
36736 */
36737 Reflect.Enum.Value = Value;
36738
36739 /**
36740 * An extension (field).
36741 * @exports ProtoBuf.Reflect.Extension
36742 * @constructor
36743 * @param {!ProtoBuf.Builder} builder Builder reference
36744 * @param {!ProtoBuf.Reflect.T} parent Parent object
36745 * @param {string} name Object name
36746 * @param {!ProtoBuf.Reflect.Message.Field} field Extension field
36747 */
36748 var Extension = function(builder, parent, name, field) {
36749 T.call(this, builder, parent, name);
36750
36751 /**
36752 * Extended message field.
36753 * @type {!ProtoBuf.Reflect.Message.Field}
36754 * @expose
36755 */
36756 this.field = field;
36757 };
36758
36759 // Extends T
36760 Extension.prototype = Object.create(T.prototype);
36761
36762 /**
36763 * @alias ProtoBuf.Reflect.Extension
36764 * @expose
36765 */
36766 Reflect.Extension = Extension;
36767
36768 /**
36769 * Constructs a new Service.
36770 * @exports ProtoBuf.Reflect.Service
36771 * @param {!ProtoBuf.Builder} builder Builder reference
36772 * @param {!ProtoBuf.Reflect.Namespace} root Root
36773 * @param {string} name Service name
36774 * @param {Object.<string,*>=} options Options
36775 * @constructor
36776 * @extends ProtoBuf.Reflect.Namespace
36777 */
36778 var Service = function(builder, root, name, options) {
36779 Namespace.call(this, builder, root, name, options);
36780
36781 /**
36782 * @override
36783 */
36784 this.className = "Service";
36785
36786 /**
36787 * Built runtime service class.
36788 * @type {?function(new:ProtoBuf.Builder.Service)}
36789 */
36790 this.clazz = null;
36791 };
36792
36793 /**
36794 * @alias ProtoBuf.Reflect.Service.prototype
36795 * @inner
36796 */
36797 var ServicePrototype = Service.prototype = Object.create(Namespace.prototype);
36798
36799 /**
36800 * Builds the service and returns the runtime counterpart, which is a fully functional class.
36801 * @see ProtoBuf.Builder.Service
36802 * @param {boolean=} rebuild Whether to rebuild or not
36803 * @return {Function} Service class
36804 * @throws {Error} If the message cannot be built
36805 * @expose
36806 */
36807 ServicePrototype.build = function(rebuild) {
36808 if (this.clazz && !rebuild)
36809 return this.clazz;
36810
36811 // Create the runtime Service class in its own scope
36812 return this.clazz = (function(ProtoBuf, T) {
36813
36814 /**
36815 * Constructs a new runtime Service.
36816 * @name ProtoBuf.Builder.Service
36817 * @param {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))=} rpcImpl RPC implementation receiving the method name and the message
36818 * @class Barebone of all runtime services.
36819 * @constructor
36820 * @throws {Error} If the service cannot be created
36821 */
36822 var Service = function(rpcImpl) {
36823 ProtoBuf.Builder.Service.call(this);
36824
36825 /**
36826 * Service implementation.
36827 * @name ProtoBuf.Builder.Service#rpcImpl
36828 * @type {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))}
36829 * @expose
36830 */
36831 this.rpcImpl = rpcImpl || function(name, msg, callback) {
36832 // This is what a user has to implement: A function receiving the method name, the actual message to
36833 // send (type checked) and the callback that's either provided with the error as its first
36834 // argument or null and the actual response message.
36835 setTimeout(callback.bind(this, Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")), 0); // Must be async!
36836 };
36837 };
36838
36839 /**
36840 * @alias ProtoBuf.Builder.Service.prototype
36841 * @inner
36842 */
36843 var ServicePrototype = Service.prototype = Object.create(ProtoBuf.Builder.Service.prototype);
36844
36845 /**
36846 * Asynchronously performs an RPC call using the given RPC implementation.
36847 * @name ProtoBuf.Builder.Service.[Method]
36848 * @function
36849 * @param {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} rpcImpl RPC implementation
36850 * @param {ProtoBuf.Builder.Message} req Request
36851 * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
36852 * the error if any and the response either as a pre-parsed message or as its raw bytes
36853 * @abstract
36854 */
36855
36856 /**
36857 * Asynchronously performs an RPC call using the instance's RPC implementation.
36858 * @name ProtoBuf.Builder.Service#[Method]
36859 * @function
36860 * @param {ProtoBuf.Builder.Message} req Request
36861 * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
36862 * the error if any and the response either as a pre-parsed message or as its raw bytes
36863 * @abstract
36864 */
36865
36866 var rpc = T.getChildren(ProtoBuf.Reflect.Service.RPCMethod);
36867 for (var i=0; i<rpc.length; i++) {
36868 (function(method) {
36869
36870 // service#Method(message, callback)
36871 ServicePrototype[method.name] = function(req, callback) {
36872 try {
36873 try {
36874 // If given as a buffer, decode the request. Will throw a TypeError if not a valid buffer.
36875 req = method.resolvedRequestType.clazz.decode(ByteBuffer.wrap(req));
36876 } catch (err) {
36877 if (!(err instanceof TypeError))
36878 throw err;
36879 }
36880 if (req === null || typeof req !== 'object')
36881 throw Error("Illegal arguments");
36882 if (!(req instanceof method.resolvedRequestType.clazz))
36883 req = new method.resolvedRequestType.clazz(req);
36884 this.rpcImpl(method.fqn(), req, function(err, res) { // Assumes that this is properly async
36885 if (err) {
36886 callback(err);
36887 return;
36888 }
36889 // Coalesce to empty string when service response has empty content
36890 if (res === null)
36891 res = ''
36892 try { res = method.resolvedResponseType.clazz.decode(res); } catch (notABuffer) {}
36893 if (!res || !(res instanceof method.resolvedResponseType.clazz)) {
36894 callback(Error("Illegal response type received in service method "+ T.name+"#"+method.name));
36895 return;
36896 }
36897 callback(null, res);
36898 });
36899 } catch (err) {
36900 setTimeout(callback.bind(this, err), 0);
36901 }
36902 };
36903
36904 // Service.Method(rpcImpl, message, callback)
36905 Service[method.name] = function(rpcImpl, req, callback) {
36906 new Service(rpcImpl)[method.name](req, callback);
36907 };
36908
36909 if (Object.defineProperty)
36910 Object.defineProperty(Service[method.name], "$options", { "value": method.buildOpt() }),
36911 Object.defineProperty(ServicePrototype[method.name], "$options", { "value": Service[method.name]["$options"] });
36912 })(rpc[i]);
36913 }
36914
36915 // Properties
36916
36917 /**
36918 * Service options.
36919 * @name ProtoBuf.Builder.Service.$options
36920 * @type {Object.<string,*>}
36921 * @expose
36922 */
36923 var $optionsS; // cc needs this
36924
36925 /**
36926 * Service options.
36927 * @name ProtoBuf.Builder.Service#$options
36928 * @type {Object.<string,*>}
36929 * @expose
36930 */
36931 var $options;
36932
36933 /**
36934 * Reflection type.
36935 * @name ProtoBuf.Builder.Service.$type
36936 * @type {!ProtoBuf.Reflect.Service}
36937 * @expose
36938 */
36939 var $typeS;
36940
36941 /**
36942 * Reflection type.
36943 * @name ProtoBuf.Builder.Service#$type
36944 * @type {!ProtoBuf.Reflect.Service}
36945 * @expose
36946 */
36947 var $type;
36948
36949 if (Object.defineProperty)
36950 Object.defineProperty(Service, "$options", { "value": T.buildOpt() }),
36951 Object.defineProperty(ServicePrototype, "$options", { "value": Service["$options"] }),
36952 Object.defineProperty(Service, "$type", { "value": T }),
36953 Object.defineProperty(ServicePrototype, "$type", { "value": T });
36954
36955 return Service;
36956
36957 })(ProtoBuf, this);
36958 };
36959
36960 /**
36961 * @alias ProtoBuf.Reflect.Service
36962 * @expose
36963 */
36964 Reflect.Service = Service;
36965
36966 /**
36967 * Abstract service method.
36968 * @exports ProtoBuf.Reflect.Service.Method
36969 * @param {!ProtoBuf.Builder} builder Builder reference
36970 * @param {!ProtoBuf.Reflect.Service} svc Service
36971 * @param {string} name Method name
36972 * @param {Object.<string,*>=} options Options
36973 * @constructor
36974 * @extends ProtoBuf.Reflect.T
36975 */
36976 var Method = function(builder, svc, name, options) {
36977 T.call(this, builder, svc, name);
36978
36979 /**
36980 * @override
36981 */
36982 this.className = "Service.Method";
36983
36984 /**
36985 * Options.
36986 * @type {Object.<string, *>}
36987 * @expose
36988 */
36989 this.options = options || {};
36990 };
36991
36992 /**
36993 * @alias ProtoBuf.Reflect.Service.Method.prototype
36994 * @inner
36995 */
36996 var MethodPrototype = Method.prototype = Object.create(T.prototype);
36997
36998 /**
36999 * Builds the method's '$options' property.
37000 * @name ProtoBuf.Reflect.Service.Method#buildOpt
37001 * @function
37002 * @return {Object.<string,*>}
37003 */
37004 MethodPrototype.buildOpt = NamespacePrototype.buildOpt;
37005
37006 /**
37007 * @alias ProtoBuf.Reflect.Service.Method
37008 * @expose
37009 */
37010 Reflect.Service.Method = Method;
37011
37012 /**
37013 * RPC service method.
37014 * @exports ProtoBuf.Reflect.Service.RPCMethod
37015 * @param {!ProtoBuf.Builder} builder Builder reference
37016 * @param {!ProtoBuf.Reflect.Service} svc Service
37017 * @param {string} name Method name
37018 * @param {string} request Request message name
37019 * @param {string} response Response message name
37020 * @param {boolean} request_stream Whether requests are streamed
37021 * @param {boolean} response_stream Whether responses are streamed
37022 * @param {Object.<string,*>=} options Options
37023 * @constructor
37024 * @extends ProtoBuf.Reflect.Service.Method
37025 */
37026 var RPCMethod = function(builder, svc, name, request, response, request_stream, response_stream, options) {
37027 Method.call(this, builder, svc, name, options);
37028
37029 /**
37030 * @override
37031 */
37032 this.className = "Service.RPCMethod";
37033
37034 /**
37035 * Request message name.
37036 * @type {string}
37037 * @expose
37038 */
37039 this.requestName = request;
37040
37041 /**
37042 * Response message name.
37043 * @type {string}
37044 * @expose
37045 */
37046 this.responseName = response;
37047
37048 /**
37049 * Whether requests are streamed
37050 * @type {bool}
37051 * @expose
37052 */
37053 this.requestStream = request_stream;
37054
37055 /**
37056 * Whether responses are streamed
37057 * @type {bool}
37058 * @expose
37059 */
37060 this.responseStream = response_stream;
37061
37062 /**
37063 * Resolved request message type.
37064 * @type {ProtoBuf.Reflect.Message}
37065 * @expose
37066 */
37067 this.resolvedRequestType = null;
37068
37069 /**
37070 * Resolved response message type.
37071 * @type {ProtoBuf.Reflect.Message}
37072 * @expose
37073 */
37074 this.resolvedResponseType = null;
37075 };
37076
37077 // Extends Method
37078 RPCMethod.prototype = Object.create(Method.prototype);
37079
37080 /**
37081 * @alias ProtoBuf.Reflect.Service.RPCMethod
37082 * @expose
37083 */
37084 Reflect.Service.RPCMethod = RPCMethod;
37085
37086 return Reflect;
37087
37088 })(ProtoBuf);
37089
37090 /**
37091 * @alias ProtoBuf.Builder
37092 * @expose
37093 */
37094 ProtoBuf.Builder = (function(ProtoBuf, Lang, Reflect) {
37095 "use strict";
37096
37097 /**
37098 * Constructs a new Builder.
37099 * @exports ProtoBuf.Builder
37100 * @class Provides the functionality to build protocol messages.
37101 * @param {Object.<string,*>=} options Options
37102 * @constructor
37103 */
37104 var Builder = function(options) {
37105
37106 /**
37107 * Namespace.
37108 * @type {ProtoBuf.Reflect.Namespace}
37109 * @expose
37110 */
37111 this.ns = new Reflect.Namespace(this, null, ""); // Global namespace
37112
37113 /**
37114 * Namespace pointer.
37115 * @type {ProtoBuf.Reflect.T}
37116 * @expose
37117 */
37118 this.ptr = this.ns;
37119
37120 /**
37121 * Resolved flag.
37122 * @type {boolean}
37123 * @expose
37124 */
37125 this.resolved = false;
37126
37127 /**
37128 * The current building result.
37129 * @type {Object.<string,ProtoBuf.Builder.Message|Object>|null}
37130 * @expose
37131 */
37132 this.result = null;
37133
37134 /**
37135 * Imported files.
37136 * @type {Array.<string>}
37137 * @expose
37138 */
37139 this.files = {};
37140
37141 /**
37142 * Import root override.
37143 * @type {?string}
37144 * @expose
37145 */
37146 this.importRoot = null;
37147
37148 /**
37149 * Options.
37150 * @type {!Object.<string, *>}
37151 * @expose
37152 */
37153 this.options = options || {};
37154 };
37155
37156 /**
37157 * @alias ProtoBuf.Builder.prototype
37158 * @inner
37159 */
37160 var BuilderPrototype = Builder.prototype;
37161
37162 // ----- Definition tests -----
37163
37164 /**
37165 * Tests if a definition most likely describes a message.
37166 * @param {!Object} def
37167 * @returns {boolean}
37168 * @expose
37169 */
37170 Builder.isMessage = function(def) {
37171 // Messages require a string name
37172 if (typeof def["name"] !== 'string')
37173 return false;
37174 // Messages do not contain values (enum) or rpc methods (service)
37175 if (typeof def["values"] !== 'undefined' || typeof def["rpc"] !== 'undefined')
37176 return false;
37177 return true;
37178 };
37179
37180 /**
37181 * Tests if a definition most likely describes a message field.
37182 * @param {!Object} def
37183 * @returns {boolean}
37184 * @expose
37185 */
37186 Builder.isMessageField = function(def) {
37187 // Message fields require a string rule, name and type and an id
37188 if (typeof def["rule"] !== 'string' || typeof def["name"] !== 'string' || typeof def["type"] !== 'string' || typeof def["id"] === 'undefined')
37189 return false;
37190 return true;
37191 };
37192
37193 /**
37194 * Tests if a definition most likely describes an enum.
37195 * @param {!Object} def
37196 * @returns {boolean}
37197 * @expose
37198 */
37199 Builder.isEnum = function(def) {
37200 // Enums require a string name
37201 if (typeof def["name"] !== 'string')
37202 return false;
37203 // Enums require at least one value
37204 if (typeof def["values"] === 'undefined' || !Array.isArray(def["values"]) || def["values"].length === 0)
37205 return false;
37206 return true;
37207 };
37208
37209 /**
37210 * Tests if a definition most likely describes a service.
37211 * @param {!Object} def
37212 * @returns {boolean}
37213 * @expose
37214 */
37215 Builder.isService = function(def) {
37216 // Services require a string name and an rpc object
37217 if (typeof def["name"] !== 'string' || typeof def["rpc"] !== 'object' || !def["rpc"])
37218 return false;
37219 return true;
37220 };
37221
37222 /**
37223 * Tests if a definition most likely describes an extended message
37224 * @param {!Object} def
37225 * @returns {boolean}
37226 * @expose
37227 */
37228 Builder.isExtend = function(def) {
37229 // Extends rquire a string ref
37230 if (typeof def["ref"] !== 'string')
37231 return false;
37232 return true;
37233 };
37234
37235 // ----- Building -----
37236
37237 /**
37238 * Resets the pointer to the root namespace.
37239 * @returns {!ProtoBuf.Builder} this
37240 * @expose
37241 */
37242 BuilderPrototype.reset = function() {
37243 this.ptr = this.ns;
37244 return this;
37245 };
37246
37247 /**
37248 * Defines a namespace on top of the current pointer position and places the pointer on it.
37249 * @param {string} namespace
37250 * @return {!ProtoBuf.Builder} this
37251 * @expose
37252 */
37253 BuilderPrototype.define = function(namespace) {
37254 if (typeof namespace !== 'string' || !Lang.TYPEREF.test(namespace))
37255 throw Error("illegal namespace: "+namespace);
37256 namespace.split(".").forEach(function(part) {
37257 var ns = this.ptr.getChild(part);
37258 if (ns === null) // Keep existing
37259 this.ptr.addChild(ns = new Reflect.Namespace(this, this.ptr, part));
37260 this.ptr = ns;
37261 }, this);
37262 return this;
37263 };
37264
37265 /**
37266 * Creates the specified definitions at the current pointer position.
37267 * @param {!Array.<!Object>} defs Messages, enums or services to create
37268 * @returns {!ProtoBuf.Builder} this
37269 * @throws {Error} If a message definition is invalid
37270 * @expose
37271 */
37272 BuilderPrototype.create = function(defs) {
37273 if (!defs)
37274 return this; // Nothing to create
37275 if (!Array.isArray(defs))
37276 defs = [defs];
37277 else {
37278 if (defs.length === 0)
37279 return this;
37280 defs = defs.slice();
37281 }
37282
37283 // It's quite hard to keep track of scopes and memory here, so let's do this iteratively.
37284 var stack = [defs];
37285 while (stack.length > 0) {
37286 defs = stack.pop();
37287
37288 if (!Array.isArray(defs)) // Stack always contains entire namespaces
37289 throw Error("not a valid namespace: "+JSON.stringify(defs));
37290
37291 while (defs.length > 0) {
37292 var def = defs.shift(); // Namespaces always contain an array of messages, enums and services
37293
37294 if (Builder.isMessage(def)) {
37295 var obj = new Reflect.Message(this, this.ptr, def["name"], def["options"], def["isGroup"], def["syntax"]);
37296
37297 // Create OneOfs
37298 var oneofs = {};
37299 if (def["oneofs"])
37300 Object.keys(def["oneofs"]).forEach(function(name) {
37301 obj.addChild(oneofs[name] = new Reflect.Message.OneOf(this, obj, name));
37302 }, this);
37303
37304 // Create fields
37305 if (def["fields"])
37306 def["fields"].forEach(function(fld) {
37307 if (obj.getChild(fld["id"]|0) !== null)
37308 throw Error("duplicate or invalid field id in "+obj.name+": "+fld['id']);
37309 if (fld["options"] && typeof fld["options"] !== 'object')
37310 throw Error("illegal field options in "+obj.name+"#"+fld["name"]);
37311 var oneof = null;
37312 if (typeof fld["oneof"] === 'string' && !(oneof = oneofs[fld["oneof"]]))
37313 throw Error("illegal oneof in "+obj.name+"#"+fld["name"]+": "+fld["oneof"]);
37314 fld = new Reflect.Message.Field(this, obj, fld["rule"], fld["keytype"], fld["type"], fld["name"], fld["id"], fld["options"], oneof, def["syntax"]);
37315 if (oneof)
37316 oneof.fields.push(fld);
37317 obj.addChild(fld);
37318 }, this);
37319
37320 // Push children to stack
37321 var subObj = [];
37322 if (def["enums"])
37323 def["enums"].forEach(function(enm) {
37324 subObj.push(enm);
37325 });
37326 if (def["messages"])
37327 def["messages"].forEach(function(msg) {
37328 subObj.push(msg);
37329 });
37330 if (def["services"])
37331 def["services"].forEach(function(svc) {
37332 subObj.push(svc);
37333 });
37334
37335 // Set extension ranges
37336 if (def["extensions"]) {
37337 if (typeof def["extensions"][0] === 'number') // pre 5.0.1
37338 obj.extensions = [ def["extensions"] ];
37339 else
37340 obj.extensions = def["extensions"];
37341 }
37342
37343 // Create on top of current namespace
37344 this.ptr.addChild(obj);
37345 if (subObj.length > 0) {
37346 stack.push(defs); // Push the current level back
37347 defs = subObj; // Continue processing sub level
37348 subObj = null;
37349 this.ptr = obj; // And move the pointer to this namespace
37350 obj = null;
37351 continue;
37352 }
37353 subObj = null;
37354
37355 } else if (Builder.isEnum(def)) {
37356
37357 obj = new Reflect.Enum(this, this.ptr, def["name"], def["options"], def["syntax"]);
37358 def["values"].forEach(function(val) {
37359 obj.addChild(new Reflect.Enum.Value(this, obj, val["name"], val["id"]));
37360 }, this);
37361 this.ptr.addChild(obj);
37362
37363 } else if (Builder.isService(def)) {
37364
37365 obj = new Reflect.Service(this, this.ptr, def["name"], def["options"]);
37366 Object.keys(def["rpc"]).forEach(function(name) {
37367 var mtd = def["rpc"][name];
37368 obj.addChild(new Reflect.Service.RPCMethod(this, obj, name, mtd["request"], mtd["response"], !!mtd["request_stream"], !!mtd["response_stream"], mtd["options"]));
37369 }, this);
37370 this.ptr.addChild(obj);
37371
37372 } else if (Builder.isExtend(def)) {
37373
37374 obj = this.ptr.resolve(def["ref"], true);
37375 if (obj) {
37376 def["fields"].forEach(function(fld) {
37377 if (obj.getChild(fld['id']|0) !== null)
37378 throw Error("duplicate extended field id in "+obj.name+": "+fld['id']);
37379 // Check if field id is allowed to be extended
37380 if (obj.extensions) {
37381 var valid = false;
37382 obj.extensions.forEach(function(range) {
37383 if (fld["id"] >= range[0] && fld["id"] <= range[1])
37384 valid = true;
37385 });
37386 if (!valid)
37387 throw Error("illegal extended field id in "+obj.name+": "+fld['id']+" (not within valid ranges)");
37388 }
37389 // Convert extension field names to camel case notation if the override is set
37390 var name = fld["name"];
37391 if (this.options['convertFieldsToCamelCase'])
37392 name = ProtoBuf.Util.toCamelCase(name);
37393 // see #161: Extensions use their fully qualified name as their runtime key and...
37394 var field = new Reflect.Message.ExtensionField(this, obj, fld["rule"], fld["type"], this.ptr.fqn()+'.'+name, fld["id"], fld["options"]);
37395 // ...are added on top of the current namespace as an extension which is used for
37396 // resolving their type later on (the extension always keeps the original name to
37397 // prevent naming collisions)
37398 var ext = new Reflect.Extension(this, this.ptr, fld["name"], field);
37399 field.extension = ext;
37400 this.ptr.addChild(ext);
37401 obj.addChild(field);
37402 }, this);
37403
37404 } else if (!/\.?google\.protobuf\./.test(def["ref"])) // Silently skip internal extensions
37405 throw Error("extended message "+def["ref"]+" is not defined");
37406
37407 } else
37408 throw Error("not a valid definition: "+JSON.stringify(def));
37409
37410 def = null;
37411 obj = null;
37412 }
37413 // Break goes here
37414 defs = null;
37415 this.ptr = this.ptr.parent; // Namespace done, continue at parent
37416 }
37417 this.resolved = false; // Require re-resolve
37418 this.result = null; // Require re-build
37419 return this;
37420 };
37421
37422 /**
37423 * Propagates syntax to all children.
37424 * @param {!Object} parent
37425 * @inner
37426 */
37427 function propagateSyntax(parent) {
37428 if (parent['messages']) {
37429 parent['messages'].forEach(function(child) {
37430 child["syntax"] = parent["syntax"];
37431 propagateSyntax(child);
37432 });
37433 }
37434 if (parent['enums']) {
37435 parent['enums'].forEach(function(child) {
37436 child["syntax"] = parent["syntax"];
37437 });
37438 }
37439 }
37440
37441 /**
37442 * Imports another definition into this builder.
37443 * @param {Object.<string,*>} json Parsed import
37444 * @param {(string|{root: string, file: string})=} filename Imported file name
37445 * @returns {!ProtoBuf.Builder} this
37446 * @throws {Error} If the definition or file cannot be imported
37447 * @expose
37448 */
37449 BuilderPrototype["import"] = function(json, filename) {
37450 var delim = '/';
37451
37452 // Make sure to skip duplicate imports
37453
37454 if (typeof filename === 'string') {
37455
37456 if (ProtoBuf.Util.IS_NODE)
37457 filename = __webpack_require__(118)['resolve'](filename);
37458 if (this.files[filename] === true)
37459 return this.reset();
37460 this.files[filename] = true;
37461
37462 } else if (typeof filename === 'object') { // Object with root, file.
37463
37464 var root = filename.root;
37465 if (ProtoBuf.Util.IS_NODE)
37466 root = __webpack_require__(118)['resolve'](root);
37467 if (root.indexOf("\\") >= 0 || filename.file.indexOf("\\") >= 0)
37468 delim = '\\';
37469 var fname;
37470 if (ProtoBuf.Util.IS_NODE)
37471 fname = __webpack_require__(118)['join'](root, filename.file);
37472 else
37473 fname = root + delim + filename.file;
37474 if (this.files[fname] === true)
37475 return this.reset();
37476 this.files[fname] = true;
37477 }
37478
37479 // Import imports
37480
37481 if (json['imports'] && json['imports'].length > 0) {
37482 var importRoot,
37483 resetRoot = false;
37484
37485 if (typeof filename === 'object') { // If an import root is specified, override
37486
37487 this.importRoot = filename["root"]; resetRoot = true; // ... and reset afterwards
37488 importRoot = this.importRoot;
37489 filename = filename["file"];
37490 if (importRoot.indexOf("\\") >= 0 || filename.indexOf("\\") >= 0)
37491 delim = '\\';
37492
37493 } else if (typeof filename === 'string') {
37494
37495 if (this.importRoot) // If import root is overridden, use it
37496 importRoot = this.importRoot;
37497 else { // Otherwise compute from filename
37498 if (filename.indexOf("/") >= 0) { // Unix
37499 importRoot = filename.replace(/\/[^\/]*$/, "");
37500 if (/* /file.proto */ importRoot === "")
37501 importRoot = "/";
37502 } else if (filename.indexOf("\\") >= 0) { // Windows
37503 importRoot = filename.replace(/\\[^\\]*$/, "");
37504 delim = '\\';
37505 } else
37506 importRoot = ".";
37507 }
37508
37509 } else
37510 importRoot = null;
37511
37512 for (var i=0; i<json['imports'].length; i++) {
37513 if (typeof json['imports'][i] === 'string') { // Import file
37514 if (!importRoot)
37515 throw Error("cannot determine import root");
37516 var importFilename = json['imports'][i];
37517 if (importFilename === "google/protobuf/descriptor.proto")
37518 continue; // Not needed and therefore not used
37519 if (ProtoBuf.Util.IS_NODE)
37520 importFilename = __webpack_require__(118)['join'](importRoot, importFilename);
37521 else
37522 importFilename = importRoot + delim + importFilename;
37523 if (this.files[importFilename] === true)
37524 continue; // Already imported
37525 if (/\.proto$/i.test(importFilename) && !ProtoBuf.DotProto) // If this is a light build
37526 importFilename = importFilename.replace(/\.proto$/, ".json"); // always load the JSON file
37527 var contents = ProtoBuf.Util.fetch(importFilename);
37528 if (contents === null)
37529 throw Error("failed to import '"+importFilename+"' in '"+filename+"': file not found");
37530 if (/\.json$/i.test(importFilename)) // Always possible
37531 this["import"](JSON.parse(contents+""), importFilename); // May throw
37532 else
37533 this["import"](ProtoBuf.DotProto.Parser.parse(contents), importFilename); // May throw
37534 } else // Import structure
37535 if (!filename)
37536 this["import"](json['imports'][i]);
37537 else if (/\.(\w+)$/.test(filename)) // With extension: Append _importN to the name portion to make it unique
37538 this["import"](json['imports'][i], filename.replace(/^(.+)\.(\w+)$/, function($0, $1, $2) { return $1+"_import"+i+"."+$2; }));
37539 else // Without extension: Append _importN to make it unique
37540 this["import"](json['imports'][i], filename+"_import"+i);
37541 }
37542 if (resetRoot) // Reset import root override when all imports are done
37543 this.importRoot = null;
37544 }
37545
37546 // Import structures
37547
37548 if (json['package'])
37549 this.define(json['package']);
37550 if (json['syntax'])
37551 propagateSyntax(json);
37552 var base = this.ptr;
37553 if (json['options'])
37554 Object.keys(json['options']).forEach(function(key) {
37555 base.options[key] = json['options'][key];
37556 });
37557 if (json['messages'])
37558 this.create(json['messages']),
37559 this.ptr = base;
37560 if (json['enums'])
37561 this.create(json['enums']),
37562 this.ptr = base;
37563 if (json['services'])
37564 this.create(json['services']),
37565 this.ptr = base;
37566 if (json['extends'])
37567 this.create(json['extends']);
37568
37569 return this.reset();
37570 };
37571
37572 /**
37573 * Resolves all namespace objects.
37574 * @throws {Error} If a type cannot be resolved
37575 * @returns {!ProtoBuf.Builder} this
37576 * @expose
37577 */
37578 BuilderPrototype.resolveAll = function() {
37579 // Resolve all reflected objects
37580 var res;
37581 if (this.ptr == null || typeof this.ptr.type === 'object')
37582 return this; // Done (already resolved)
37583
37584 if (this.ptr instanceof Reflect.Namespace) { // Resolve children
37585
37586 this.ptr.children.forEach(function(child) {
37587 this.ptr = child;
37588 this.resolveAll();
37589 }, this);
37590
37591 } else if (this.ptr instanceof Reflect.Message.Field) { // Resolve type
37592
37593 if (!Lang.TYPE.test(this.ptr.type)) {
37594 if (!Lang.TYPEREF.test(this.ptr.type))
37595 throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
37596 res = (this.ptr instanceof Reflect.Message.ExtensionField ? this.ptr.extension.parent : this.ptr.parent).resolve(this.ptr.type, true);
37597 if (!res)
37598 throw Error("unresolvable type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
37599 this.ptr.resolvedType = res;
37600 if (res instanceof Reflect.Enum) {
37601 this.ptr.type = ProtoBuf.TYPES["enum"];
37602 if (this.ptr.syntax === 'proto3' && res.syntax !== 'proto3')
37603 throw Error("proto3 message cannot reference proto2 enum");
37604 }
37605 else if (res instanceof Reflect.Message)
37606 this.ptr.type = res.isGroup ? ProtoBuf.TYPES["group"] : ProtoBuf.TYPES["message"];
37607 else
37608 throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
37609 } else
37610 this.ptr.type = ProtoBuf.TYPES[this.ptr.type];
37611
37612 // If it's a map field, also resolve the key type. The key type can be only a numeric, string, or bool type
37613 // (i.e., no enums or messages), so we don't need to resolve against the current namespace.
37614 if (this.ptr.map) {
37615 if (!Lang.TYPE.test(this.ptr.keyType))
37616 throw Error("illegal key type for map field in "+this.ptr.toString(true)+": "+this.ptr.keyType);
37617 this.ptr.keyType = ProtoBuf.TYPES[this.ptr.keyType];
37618 }
37619
37620 // If it's a repeated and packable field then proto3 mandates it should be packed by
37621 // default
37622 if (
37623 this.ptr.syntax === 'proto3' &&
37624 this.ptr.repeated && this.ptr.options.packed === undefined &&
37625 ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.ptr.type.wireType) !== -1
37626 ) {
37627 this.ptr.options.packed = true;
37628 }
37629
37630 } else if (this.ptr instanceof ProtoBuf.Reflect.Service.Method) {
37631
37632 if (this.ptr instanceof ProtoBuf.Reflect.Service.RPCMethod) {
37633 res = this.ptr.parent.resolve(this.ptr.requestName, true);
37634 if (!res || !(res instanceof ProtoBuf.Reflect.Message))
37635 throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.requestName);
37636 this.ptr.resolvedRequestType = res;
37637 res = this.ptr.parent.resolve(this.ptr.responseName, true);
37638 if (!res || !(res instanceof ProtoBuf.Reflect.Message))
37639 throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.responseName);
37640 this.ptr.resolvedResponseType = res;
37641 } else // Should not happen as nothing else is implemented
37642 throw Error("illegal service type in "+this.ptr.toString(true));
37643
37644 } else if (
37645 !(this.ptr instanceof ProtoBuf.Reflect.Message.OneOf) && // Not built
37646 !(this.ptr instanceof ProtoBuf.Reflect.Extension) && // Not built
37647 !(this.ptr instanceof ProtoBuf.Reflect.Enum.Value) // Built in enum
37648 )
37649 throw Error("illegal object in namespace: "+typeof(this.ptr)+": "+this.ptr);
37650
37651 return this.reset();
37652 };
37653
37654 /**
37655 * Builds the protocol. This will first try to resolve all definitions and, if this has been successful,
37656 * return the built package.
37657 * @param {(string|Array.<string>)=} path Specifies what to return. If omitted, the entire namespace will be returned.
37658 * @returns {!ProtoBuf.Builder.Message|!Object.<string,*>}
37659 * @throws {Error} If a type could not be resolved
37660 * @expose
37661 */
37662 BuilderPrototype.build = function(path) {
37663 this.reset();
37664 if (!this.resolved)
37665 this.resolveAll(),
37666 this.resolved = true,
37667 this.result = null; // Require re-build
37668 if (this.result === null) // (Re-)Build
37669 this.result = this.ns.build();
37670 if (!path)
37671 return this.result;
37672 var part = typeof path === 'string' ? path.split(".") : path,
37673 ptr = this.result; // Build namespace pointer (no hasChild etc.)
37674 for (var i=0; i<part.length; i++)
37675 if (ptr[part[i]])
37676 ptr = ptr[part[i]];
37677 else {
37678 ptr = null;
37679 break;
37680 }
37681 return ptr;
37682 };
37683
37684 /**
37685 * Similar to {@link ProtoBuf.Builder#build}, but looks up the internal reflection descriptor.
37686 * @param {string=} path Specifies what to return. If omitted, the entire namespace wiil be returned.
37687 * @param {boolean=} excludeNonNamespace Excludes non-namespace types like fields, defaults to `false`
37688 * @returns {?ProtoBuf.Reflect.T} Reflection descriptor or `null` if not found
37689 */
37690 BuilderPrototype.lookup = function(path, excludeNonNamespace) {
37691 return path ? this.ns.resolve(path, excludeNonNamespace) : this.ns;
37692 };
37693
37694 /**
37695 * Returns a string representation of this object.
37696 * @return {string} String representation as of "Builder"
37697 * @expose
37698 */
37699 BuilderPrototype.toString = function() {
37700 return "Builder";
37701 };
37702
37703 // ----- Base classes -----
37704 // Exist for the sole purpose of being able to "... instanceof ProtoBuf.Builder.Message" etc.
37705
37706 /**
37707 * @alias ProtoBuf.Builder.Message
37708 */
37709 Builder.Message = function() {};
37710
37711 /**
37712 * @alias ProtoBuf.Builder.Enum
37713 */
37714 Builder.Enum = function() {};
37715
37716 /**
37717 * @alias ProtoBuf.Builder.Message
37718 */
37719 Builder.Service = function() {};
37720
37721 return Builder;
37722
37723 })(ProtoBuf, ProtoBuf.Lang, ProtoBuf.Reflect);
37724
37725 /**
37726 * @alias ProtoBuf.Map
37727 * @expose
37728 */
37729 ProtoBuf.Map = (function(ProtoBuf, Reflect) {
37730 "use strict";
37731
37732 /**
37733 * Constructs a new Map. A Map is a container that is used to implement map
37734 * fields on message objects. It closely follows the ES6 Map API; however,
37735 * it is distinct because we do not want to depend on external polyfills or
37736 * on ES6 itself.
37737 *
37738 * @exports ProtoBuf.Map
37739 * @param {!ProtoBuf.Reflect.Field} field Map field
37740 * @param {Object.<string,*>=} contents Initial contents
37741 * @constructor
37742 */
37743 var Map = function(field, contents) {
37744 if (!field.map)
37745 throw Error("field is not a map");
37746
37747 /**
37748 * The field corresponding to this map.
37749 * @type {!ProtoBuf.Reflect.Field}
37750 */
37751 this.field = field;
37752
37753 /**
37754 * Element instance corresponding to key type.
37755 * @type {!ProtoBuf.Reflect.Element}
37756 */
37757 this.keyElem = new Reflect.Element(field.keyType, null, true, field.syntax);
37758
37759 /**
37760 * Element instance corresponding to value type.
37761 * @type {!ProtoBuf.Reflect.Element}
37762 */
37763 this.valueElem = new Reflect.Element(field.type, field.resolvedType, false, field.syntax);
37764
37765 /**
37766 * Internal map: stores mapping of (string form of key) -> (key, value)
37767 * pair.
37768 *
37769 * We provide map semantics for arbitrary key types, but we build on top
37770 * of an Object, which has only string keys. In order to avoid the need
37771 * to convert a string key back to its native type in many situations,
37772 * we store the native key value alongside the value. Thus, we only need
37773 * a one-way mapping from a key type to its string form that guarantees
37774 * uniqueness and equality (i.e., str(K1) === str(K2) if and only if K1
37775 * === K2).
37776 *
37777 * @type {!Object<string, {key: *, value: *}>}
37778 */
37779 this.map = {};
37780
37781 /**
37782 * Returns the number of elements in the map.
37783 */
37784 Object.defineProperty(this, "size", {
37785 get: function() { return Object.keys(this.map).length; }
37786 });
37787
37788 // Fill initial contents from a raw object.
37789 if (contents) {
37790 var keys = Object.keys(contents);
37791 for (var i = 0; i < keys.length; i++) {
37792 var key = this.keyElem.valueFromString(keys[i]);
37793 var val = this.valueElem.verifyValue(contents[keys[i]]);
37794 this.map[this.keyElem.valueToString(key)] =
37795 { key: key, value: val };
37796 }
37797 }
37798 };
37799
37800 var MapPrototype = Map.prototype;
37801
37802 /**
37803 * Helper: return an iterator over an array.
37804 * @param {!Array<*>} arr the array
37805 * @returns {!Object} an iterator
37806 * @inner
37807 */
37808 function arrayIterator(arr) {
37809 var idx = 0;
37810 return {
37811 next: function() {
37812 if (idx < arr.length)
37813 return { done: false, value: arr[idx++] };
37814 return { done: true };
37815 }
37816 }
37817 }
37818
37819 /**
37820 * Clears the map.
37821 */
37822 MapPrototype.clear = function() {
37823 this.map = {};
37824 };
37825
37826 /**
37827 * Deletes a particular key from the map.
37828 * @returns {boolean} Whether any entry with this key was deleted.
37829 */
37830 MapPrototype["delete"] = function(key) {
37831 var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
37832 var hadKey = keyValue in this.map;
37833 delete this.map[keyValue];
37834 return hadKey;
37835 };
37836
37837 /**
37838 * Returns an iterator over [key, value] pairs in the map.
37839 * @returns {Object} The iterator
37840 */
37841 MapPrototype.entries = function() {
37842 var entries = [];
37843 var strKeys = Object.keys(this.map);
37844 for (var i = 0, entry; i < strKeys.length; i++)
37845 entries.push([(entry=this.map[strKeys[i]]).key, entry.value]);
37846 return arrayIterator(entries);
37847 };
37848
37849 /**
37850 * Returns an iterator over keys in the map.
37851 * @returns {Object} The iterator
37852 */
37853 MapPrototype.keys = function() {
37854 var keys = [];
37855 var strKeys = Object.keys(this.map);
37856 for (var i = 0; i < strKeys.length; i++)
37857 keys.push(this.map[strKeys[i]].key);
37858 return arrayIterator(keys);
37859 };
37860
37861 /**
37862 * Returns an iterator over values in the map.
37863 * @returns {!Object} The iterator
37864 */
37865 MapPrototype.values = function() {
37866 var values = [];
37867 var strKeys = Object.keys(this.map);
37868 for (var i = 0; i < strKeys.length; i++)
37869 values.push(this.map[strKeys[i]].value);
37870 return arrayIterator(values);
37871 };
37872
37873 /**
37874 * Iterates over entries in the map, calling a function on each.
37875 * @param {function(this:*, *, *, *)} cb The callback to invoke with value, key, and map arguments.
37876 * @param {Object=} thisArg The `this` value for the callback
37877 */
37878 MapPrototype.forEach = function(cb, thisArg) {
37879 var strKeys = Object.keys(this.map);
37880 for (var i = 0, entry; i < strKeys.length; i++)
37881 cb.call(thisArg, (entry=this.map[strKeys[i]]).value, entry.key, this);
37882 };
37883
37884 /**
37885 * Sets a key in the map to the given value.
37886 * @param {*} key The key
37887 * @param {*} value The value
37888 * @returns {!ProtoBuf.Map} The map instance
37889 */
37890 MapPrototype.set = function(key, value) {
37891 var keyValue = this.keyElem.verifyValue(key);
37892 var valValue = this.valueElem.verifyValue(value);
37893 this.map[this.keyElem.valueToString(keyValue)] =
37894 { key: keyValue, value: valValue };
37895 return this;
37896 };
37897
37898 /**
37899 * Gets the value corresponding to a key in the map.
37900 * @param {*} key The key
37901 * @returns {*|undefined} The value, or `undefined` if key not present
37902 */
37903 MapPrototype.get = function(key) {
37904 var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
37905 if (!(keyValue in this.map))
37906 return undefined;
37907 return this.map[keyValue].value;
37908 };
37909
37910 /**
37911 * Determines whether the given key is present in the map.
37912 * @param {*} key The key
37913 * @returns {boolean} `true` if the key is present
37914 */
37915 MapPrototype.has = function(key) {
37916 var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
37917 return (keyValue in this.map);
37918 };
37919
37920 return Map;
37921 })(ProtoBuf, ProtoBuf.Reflect);
37922
37923
37924 /**
37925 * Constructs a new empty Builder.
37926 * @param {Object.<string,*>=} options Builder options, defaults to global options set on ProtoBuf
37927 * @return {!ProtoBuf.Builder} Builder
37928 * @expose
37929 */
37930 ProtoBuf.newBuilder = function(options) {
37931 options = options || {};
37932 if (typeof options['convertFieldsToCamelCase'] === 'undefined')
37933 options['convertFieldsToCamelCase'] = ProtoBuf.convertFieldsToCamelCase;
37934 if (typeof options['populateAccessors'] === 'undefined')
37935 options['populateAccessors'] = ProtoBuf.populateAccessors;
37936 return new ProtoBuf.Builder(options);
37937 };
37938
37939 /**
37940 * Loads a .json definition and returns the Builder.
37941 * @param {!*|string} json JSON definition
37942 * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted.
37943 * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.
37944 * @return {ProtoBuf.Builder} Builder to create new messages
37945 * @throws {Error} If the definition cannot be parsed or built
37946 * @expose
37947 */
37948 ProtoBuf.loadJson = function(json, builder, filename) {
37949 if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string'))
37950 filename = builder,
37951 builder = null;
37952 if (!builder || typeof builder !== 'object')
37953 builder = ProtoBuf.newBuilder();
37954 if (typeof json === 'string')
37955 json = JSON.parse(json);
37956 builder["import"](json, filename);
37957 builder.resolveAll();
37958 return builder;
37959 };
37960
37961 /**
37962 * Loads a .json file and returns the Builder.
37963 * @param {string|!{root: string, file: string}} filename Path to json file or an object specifying 'file' with
37964 * an overridden 'root' path for all imported files.
37965 * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and
37966 * the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the
37967 * file will be read synchronously and this function will return the Builder.
37968 * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.
37969 * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the
37970 * request has failed), else undefined
37971 * @expose
37972 */
37973 ProtoBuf.loadJsonFile = function(filename, callback, builder) {
37974 if (callback && typeof callback === 'object')
37975 builder = callback,
37976 callback = null;
37977 else if (!callback || typeof callback !== 'function')
37978 callback = null;
37979 if (callback)
37980 return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) {
37981 if (contents === null) {
37982 callback(Error("Failed to fetch file"));
37983 return;
37984 }
37985 try {
37986 callback(null, ProtoBuf.loadJson(JSON.parse(contents), builder, filename));
37987 } catch (e) {
37988 callback(e);
37989 }
37990 });
37991 var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename);
37992 return contents === null ? null : ProtoBuf.loadJson(JSON.parse(contents), builder, filename);
37993 };
37994
37995 return ProtoBuf;
37996});
37997
37998
37999/***/ }),
38000/* 655 */
38001/***/ (function(module, exports, __webpack_require__) {
38002
38003var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
38004 Copyright 2013-2014 Daniel Wirtz <dcode@dcode.io>
38005
38006 Licensed under the Apache License, Version 2.0 (the "License");
38007 you may not use this file except in compliance with the License.
38008 You may obtain a copy of the License at
38009
38010 http://www.apache.org/licenses/LICENSE-2.0
38011
38012 Unless required by applicable law or agreed to in writing, software
38013 distributed under the License is distributed on an "AS IS" BASIS,
38014 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
38015 See the License for the specific language governing permissions and
38016 limitations under the License.
38017 */
38018
38019/**
38020 * @license bytebuffer.js (c) 2015 Daniel Wirtz <dcode@dcode.io>
38021 * Backing buffer: ArrayBuffer, Accessor: Uint8Array
38022 * Released under the Apache License, Version 2.0
38023 * see: https://github.com/dcodeIO/bytebuffer.js for details
38024 */
38025(function(global, factory) {
38026
38027 /* AMD */ if (true)
38028 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(656)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
38029 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
38030 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
38031 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
38032 /* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"])
38033 module['exports'] = (function() {
38034 var Long; try { Long = require("long"); } catch (e) {}
38035 return factory(Long);
38036 })();
38037 /* Global */ else
38038 (global["dcodeIO"] = global["dcodeIO"] || {})["ByteBuffer"] = factory(global["dcodeIO"]["Long"]);
38039
38040})(this, function(Long) {
38041 "use strict";
38042
38043 /**
38044 * Constructs a new ByteBuffer.
38045 * @class The swiss army knife for binary data in JavaScript.
38046 * @exports ByteBuffer
38047 * @constructor
38048 * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
38049 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
38050 * {@link ByteBuffer.DEFAULT_ENDIAN}.
38051 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
38052 * {@link ByteBuffer.DEFAULT_NOASSERT}.
38053 * @expose
38054 */
38055 var ByteBuffer = function(capacity, littleEndian, noAssert) {
38056 if (typeof capacity === 'undefined')
38057 capacity = ByteBuffer.DEFAULT_CAPACITY;
38058 if (typeof littleEndian === 'undefined')
38059 littleEndian = ByteBuffer.DEFAULT_ENDIAN;
38060 if (typeof noAssert === 'undefined')
38061 noAssert = ByteBuffer.DEFAULT_NOASSERT;
38062 if (!noAssert) {
38063 capacity = capacity | 0;
38064 if (capacity < 0)
38065 throw RangeError("Illegal capacity");
38066 littleEndian = !!littleEndian;
38067 noAssert = !!noAssert;
38068 }
38069
38070 /**
38071 * Backing ArrayBuffer.
38072 * @type {!ArrayBuffer}
38073 * @expose
38074 */
38075 this.buffer = capacity === 0 ? EMPTY_BUFFER : new ArrayBuffer(capacity);
38076
38077 /**
38078 * Uint8Array utilized to manipulate the backing buffer. Becomes `null` if the backing buffer has a capacity of `0`.
38079 * @type {?Uint8Array}
38080 * @expose
38081 */
38082 this.view = capacity === 0 ? null : new Uint8Array(this.buffer);
38083
38084 /**
38085 * Absolute read/write offset.
38086 * @type {number}
38087 * @expose
38088 * @see ByteBuffer#flip
38089 * @see ByteBuffer#clear
38090 */
38091 this.offset = 0;
38092
38093 /**
38094 * Marked offset.
38095 * @type {number}
38096 * @expose
38097 * @see ByteBuffer#mark
38098 * @see ByteBuffer#reset
38099 */
38100 this.markedOffset = -1;
38101
38102 /**
38103 * Absolute limit of the contained data. Set to the backing buffer's capacity upon allocation.
38104 * @type {number}
38105 * @expose
38106 * @see ByteBuffer#flip
38107 * @see ByteBuffer#clear
38108 */
38109 this.limit = capacity;
38110
38111 /**
38112 * Whether to use little endian byte order, defaults to `false` for big endian.
38113 * @type {boolean}
38114 * @expose
38115 */
38116 this.littleEndian = littleEndian;
38117
38118 /**
38119 * Whether to skip assertions of offsets and values, defaults to `false`.
38120 * @type {boolean}
38121 * @expose
38122 */
38123 this.noAssert = noAssert;
38124 };
38125
38126 /**
38127 * ByteBuffer version.
38128 * @type {string}
38129 * @const
38130 * @expose
38131 */
38132 ByteBuffer.VERSION = "5.0.1";
38133
38134 /**
38135 * Little endian constant that can be used instead of its boolean value. Evaluates to `true`.
38136 * @type {boolean}
38137 * @const
38138 * @expose
38139 */
38140 ByteBuffer.LITTLE_ENDIAN = true;
38141
38142 /**
38143 * Big endian constant that can be used instead of its boolean value. Evaluates to `false`.
38144 * @type {boolean}
38145 * @const
38146 * @expose
38147 */
38148 ByteBuffer.BIG_ENDIAN = false;
38149
38150 /**
38151 * Default initial capacity of `16`.
38152 * @type {number}
38153 * @expose
38154 */
38155 ByteBuffer.DEFAULT_CAPACITY = 16;
38156
38157 /**
38158 * Default endianess of `false` for big endian.
38159 * @type {boolean}
38160 * @expose
38161 */
38162 ByteBuffer.DEFAULT_ENDIAN = ByteBuffer.BIG_ENDIAN;
38163
38164 /**
38165 * Default no assertions flag of `false`.
38166 * @type {boolean}
38167 * @expose
38168 */
38169 ByteBuffer.DEFAULT_NOASSERT = false;
38170
38171 /**
38172 * A `Long` class for representing a 64-bit two's-complement integer value. May be `null` if Long.js has not been loaded
38173 * and int64 support is not available.
38174 * @type {?Long}
38175 * @const
38176 * @see https://github.com/dcodeIO/long.js
38177 * @expose
38178 */
38179 ByteBuffer.Long = Long || null;
38180
38181 /**
38182 * @alias ByteBuffer.prototype
38183 * @inner
38184 */
38185 var ByteBufferPrototype = ByteBuffer.prototype;
38186
38187 /**
38188 * An indicator used to reliably determine if an object is a ByteBuffer or not.
38189 * @type {boolean}
38190 * @const
38191 * @expose
38192 * @private
38193 */
38194 ByteBufferPrototype.__isByteBuffer__;
38195
38196 Object.defineProperty(ByteBufferPrototype, "__isByteBuffer__", {
38197 value: true,
38198 enumerable: false,
38199 configurable: false
38200 });
38201
38202 // helpers
38203
38204 /**
38205 * @type {!ArrayBuffer}
38206 * @inner
38207 */
38208 var EMPTY_BUFFER = new ArrayBuffer(0);
38209
38210 /**
38211 * String.fromCharCode reference for compile-time renaming.
38212 * @type {function(...number):string}
38213 * @inner
38214 */
38215 var stringFromCharCode = String.fromCharCode;
38216
38217 /**
38218 * Creates a source function for a string.
38219 * @param {string} s String to read from
38220 * @returns {function():number|null} Source function returning the next char code respectively `null` if there are
38221 * no more characters left.
38222 * @throws {TypeError} If the argument is invalid
38223 * @inner
38224 */
38225 function stringSource(s) {
38226 var i=0; return function() {
38227 return i < s.length ? s.charCodeAt(i++) : null;
38228 };
38229 }
38230
38231 /**
38232 * Creates a destination function for a string.
38233 * @returns {function(number=):undefined|string} Destination function successively called with the next char code.
38234 * Returns the final string when called without arguments.
38235 * @inner
38236 */
38237 function stringDestination() {
38238 var cs = [], ps = []; return function() {
38239 if (arguments.length === 0)
38240 return ps.join('')+stringFromCharCode.apply(String, cs);
38241 if (cs.length + arguments.length > 1024)
38242 ps.push(stringFromCharCode.apply(String, cs)),
38243 cs.length = 0;
38244 Array.prototype.push.apply(cs, arguments);
38245 };
38246 }
38247
38248 /**
38249 * Gets the accessor type.
38250 * @returns {Function} `Buffer` under node.js, `Uint8Array` respectively `DataView` in the browser (classes)
38251 * @expose
38252 */
38253 ByteBuffer.accessor = function() {
38254 return Uint8Array;
38255 };
38256 /**
38257 * Allocates a new ByteBuffer backed by a buffer of the specified capacity.
38258 * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
38259 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
38260 * {@link ByteBuffer.DEFAULT_ENDIAN}.
38261 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
38262 * {@link ByteBuffer.DEFAULT_NOASSERT}.
38263 * @returns {!ByteBuffer}
38264 * @expose
38265 */
38266 ByteBuffer.allocate = function(capacity, littleEndian, noAssert) {
38267 return new ByteBuffer(capacity, littleEndian, noAssert);
38268 };
38269
38270 /**
38271 * Concatenates multiple ByteBuffers into one.
38272 * @param {!Array.<!ByteBuffer|!ArrayBuffer|!Uint8Array|string>} buffers Buffers to concatenate
38273 * @param {(string|boolean)=} encoding String encoding if `buffers` contains a string ("base64", "hex", "binary",
38274 * defaults to "utf8")
38275 * @param {boolean=} littleEndian Whether to use little or big endian byte order for the resulting ByteBuffer. Defaults
38276 * to {@link ByteBuffer.DEFAULT_ENDIAN}.
38277 * @param {boolean=} noAssert Whether to skip assertions of offsets and values for the resulting ByteBuffer. Defaults to
38278 * {@link ByteBuffer.DEFAULT_NOASSERT}.
38279 * @returns {!ByteBuffer} Concatenated ByteBuffer
38280 * @expose
38281 */
38282 ByteBuffer.concat = function(buffers, encoding, littleEndian, noAssert) {
38283 if (typeof encoding === 'boolean' || typeof encoding !== 'string') {
38284 noAssert = littleEndian;
38285 littleEndian = encoding;
38286 encoding = undefined;
38287 }
38288 var capacity = 0;
38289 for (var i=0, k=buffers.length, length; i<k; ++i) {
38290 if (!ByteBuffer.isByteBuffer(buffers[i]))
38291 buffers[i] = ByteBuffer.wrap(buffers[i], encoding);
38292 length = buffers[i].limit - buffers[i].offset;
38293 if (length > 0) capacity += length;
38294 }
38295 if (capacity === 0)
38296 return new ByteBuffer(0, littleEndian, noAssert);
38297 var bb = new ByteBuffer(capacity, littleEndian, noAssert),
38298 bi;
38299 i=0; while (i<k) {
38300 bi = buffers[i++];
38301 length = bi.limit - bi.offset;
38302 if (length <= 0) continue;
38303 bb.view.set(bi.view.subarray(bi.offset, bi.limit), bb.offset);
38304 bb.offset += length;
38305 }
38306 bb.limit = bb.offset;
38307 bb.offset = 0;
38308 return bb;
38309 };
38310
38311 /**
38312 * Tests if the specified type is a ByteBuffer.
38313 * @param {*} bb ByteBuffer to test
38314 * @returns {boolean} `true` if it is a ByteBuffer, otherwise `false`
38315 * @expose
38316 */
38317 ByteBuffer.isByteBuffer = function(bb) {
38318 return (bb && bb["__isByteBuffer__"]) === true;
38319 };
38320 /**
38321 * Gets the backing buffer type.
38322 * @returns {Function} `Buffer` under node.js, `ArrayBuffer` in the browser (classes)
38323 * @expose
38324 */
38325 ByteBuffer.type = function() {
38326 return ArrayBuffer;
38327 };
38328 /**
38329 * Wraps a buffer or a string. Sets the allocated ByteBuffer's {@link ByteBuffer#offset} to `0` and its
38330 * {@link ByteBuffer#limit} to the length of the wrapped data.
38331 * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string|!Array.<number>} buffer Anything that can be wrapped
38332 * @param {(string|boolean)=} encoding String encoding if `buffer` is a string ("base64", "hex", "binary", defaults to
38333 * "utf8")
38334 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
38335 * {@link ByteBuffer.DEFAULT_ENDIAN}.
38336 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
38337 * {@link ByteBuffer.DEFAULT_NOASSERT}.
38338 * @returns {!ByteBuffer} A ByteBuffer wrapping `buffer`
38339 * @expose
38340 */
38341 ByteBuffer.wrap = function(buffer, encoding, littleEndian, noAssert) {
38342 if (typeof encoding !== 'string') {
38343 noAssert = littleEndian;
38344 littleEndian = encoding;
38345 encoding = undefined;
38346 }
38347 if (typeof buffer === 'string') {
38348 if (typeof encoding === 'undefined')
38349 encoding = "utf8";
38350 switch (encoding) {
38351 case "base64":
38352 return ByteBuffer.fromBase64(buffer, littleEndian);
38353 case "hex":
38354 return ByteBuffer.fromHex(buffer, littleEndian);
38355 case "binary":
38356 return ByteBuffer.fromBinary(buffer, littleEndian);
38357 case "utf8":
38358 return ByteBuffer.fromUTF8(buffer, littleEndian);
38359 case "debug":
38360 return ByteBuffer.fromDebug(buffer, littleEndian);
38361 default:
38362 throw Error("Unsupported encoding: "+encoding);
38363 }
38364 }
38365 if (buffer === null || typeof buffer !== 'object')
38366 throw TypeError("Illegal buffer");
38367 var bb;
38368 if (ByteBuffer.isByteBuffer(buffer)) {
38369 bb = ByteBufferPrototype.clone.call(buffer);
38370 bb.markedOffset = -1;
38371 return bb;
38372 }
38373 if (buffer instanceof Uint8Array) { // Extract ArrayBuffer from Uint8Array
38374 bb = new ByteBuffer(0, littleEndian, noAssert);
38375 if (buffer.length > 0) { // Avoid references to more than one EMPTY_BUFFER
38376 bb.buffer = buffer.buffer;
38377 bb.offset = buffer.byteOffset;
38378 bb.limit = buffer.byteOffset + buffer.byteLength;
38379 bb.view = new Uint8Array(buffer.buffer);
38380 }
38381 } else if (buffer instanceof ArrayBuffer) { // Reuse ArrayBuffer
38382 bb = new ByteBuffer(0, littleEndian, noAssert);
38383 if (buffer.byteLength > 0) {
38384 bb.buffer = buffer;
38385 bb.offset = 0;
38386 bb.limit = buffer.byteLength;
38387 bb.view = buffer.byteLength > 0 ? new Uint8Array(buffer) : null;
38388 }
38389 } else if (Object.prototype.toString.call(buffer) === "[object Array]") { // Create from octets
38390 bb = new ByteBuffer(buffer.length, littleEndian, noAssert);
38391 bb.limit = buffer.length;
38392 for (var i=0; i<buffer.length; ++i)
38393 bb.view[i] = buffer[i];
38394 } else
38395 throw TypeError("Illegal buffer"); // Otherwise fail
38396 return bb;
38397 };
38398
38399 /**
38400 * Writes the array as a bitset.
38401 * @param {Array<boolean>} value Array of booleans to write
38402 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
38403 * @returns {!ByteBuffer}
38404 * @expose
38405 */
38406 ByteBufferPrototype.writeBitSet = function(value, offset) {
38407 var relative = typeof offset === 'undefined';
38408 if (relative) offset = this.offset;
38409 if (!this.noAssert) {
38410 if (!(value instanceof Array))
38411 throw TypeError("Illegal BitSet: Not an array");
38412 if (typeof offset !== 'number' || offset % 1 !== 0)
38413 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38414 offset >>>= 0;
38415 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38416 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38417 }
38418
38419 var start = offset,
38420 bits = value.length,
38421 bytes = (bits >> 3),
38422 bit = 0,
38423 k;
38424
38425 offset += this.writeVarint32(bits,offset);
38426
38427 while(bytes--) {
38428 k = (!!value[bit++] & 1) |
38429 ((!!value[bit++] & 1) << 1) |
38430 ((!!value[bit++] & 1) << 2) |
38431 ((!!value[bit++] & 1) << 3) |
38432 ((!!value[bit++] & 1) << 4) |
38433 ((!!value[bit++] & 1) << 5) |
38434 ((!!value[bit++] & 1) << 6) |
38435 ((!!value[bit++] & 1) << 7);
38436 this.writeByte(k,offset++);
38437 }
38438
38439 if(bit < bits) {
38440 var m = 0; k = 0;
38441 while(bit < bits) k = k | ((!!value[bit++] & 1) << (m++));
38442 this.writeByte(k,offset++);
38443 }
38444
38445 if (relative) {
38446 this.offset = offset;
38447 return this;
38448 }
38449 return offset - start;
38450 }
38451
38452 /**
38453 * Reads a BitSet as an array of booleans.
38454 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
38455 * @returns {Array<boolean>
38456 * @expose
38457 */
38458 ByteBufferPrototype.readBitSet = function(offset) {
38459 var relative = typeof offset === 'undefined';
38460 if (relative) offset = this.offset;
38461
38462 var ret = this.readVarint32(offset),
38463 bits = ret.value,
38464 bytes = (bits >> 3),
38465 bit = 0,
38466 value = [],
38467 k;
38468
38469 offset += ret.length;
38470
38471 while(bytes--) {
38472 k = this.readByte(offset++);
38473 value[bit++] = !!(k & 0x01);
38474 value[bit++] = !!(k & 0x02);
38475 value[bit++] = !!(k & 0x04);
38476 value[bit++] = !!(k & 0x08);
38477 value[bit++] = !!(k & 0x10);
38478 value[bit++] = !!(k & 0x20);
38479 value[bit++] = !!(k & 0x40);
38480 value[bit++] = !!(k & 0x80);
38481 }
38482
38483 if(bit < bits) {
38484 var m = 0;
38485 k = this.readByte(offset++);
38486 while(bit < bits) value[bit++] = !!((k >> (m++)) & 1);
38487 }
38488
38489 if (relative) {
38490 this.offset = offset;
38491 }
38492 return value;
38493 }
38494 /**
38495 * Reads the specified number of bytes.
38496 * @param {number} length Number of bytes to read
38497 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
38498 * @returns {!ByteBuffer}
38499 * @expose
38500 */
38501 ByteBufferPrototype.readBytes = function(length, offset) {
38502 var relative = typeof offset === 'undefined';
38503 if (relative) offset = this.offset;
38504 if (!this.noAssert) {
38505 if (typeof offset !== 'number' || offset % 1 !== 0)
38506 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38507 offset >>>= 0;
38508 if (offset < 0 || offset + length > this.buffer.byteLength)
38509 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength);
38510 }
38511 var slice = this.slice(offset, offset + length);
38512 if (relative) this.offset += length;
38513 return slice;
38514 };
38515
38516 /**
38517 * Writes a payload of bytes. This is an alias of {@link ByteBuffer#append}.
38518 * @function
38519 * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to write. If `source` is a ByteBuffer, its offsets
38520 * will be modified according to the performed read operation.
38521 * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
38522 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38523 * written if omitted.
38524 * @returns {!ByteBuffer} this
38525 * @expose
38526 */
38527 ByteBufferPrototype.writeBytes = ByteBufferPrototype.append;
38528
38529 // types/ints/int8
38530
38531 /**
38532 * Writes an 8bit signed integer.
38533 * @param {number} value Value to write
38534 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38535 * @returns {!ByteBuffer} this
38536 * @expose
38537 */
38538 ByteBufferPrototype.writeInt8 = function(value, offset) {
38539 var relative = typeof offset === 'undefined';
38540 if (relative) offset = this.offset;
38541 if (!this.noAssert) {
38542 if (typeof value !== 'number' || value % 1 !== 0)
38543 throw TypeError("Illegal value: "+value+" (not an integer)");
38544 value |= 0;
38545 if (typeof offset !== 'number' || offset % 1 !== 0)
38546 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38547 offset >>>= 0;
38548 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38549 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38550 }
38551 offset += 1;
38552 var capacity0 = this.buffer.byteLength;
38553 if (offset > capacity0)
38554 this.resize((capacity0 *= 2) > offset ? capacity0 : offset);
38555 offset -= 1;
38556 this.view[offset] = value;
38557 if (relative) this.offset += 1;
38558 return this;
38559 };
38560
38561 /**
38562 * Writes an 8bit signed integer. This is an alias of {@link ByteBuffer#writeInt8}.
38563 * @function
38564 * @param {number} value Value to write
38565 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38566 * @returns {!ByteBuffer} this
38567 * @expose
38568 */
38569 ByteBufferPrototype.writeByte = ByteBufferPrototype.writeInt8;
38570
38571 /**
38572 * Reads an 8bit signed integer.
38573 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38574 * @returns {number} Value read
38575 * @expose
38576 */
38577 ByteBufferPrototype.readInt8 = function(offset) {
38578 var relative = typeof offset === 'undefined';
38579 if (relative) offset = this.offset;
38580 if (!this.noAssert) {
38581 if (typeof offset !== 'number' || offset % 1 !== 0)
38582 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38583 offset >>>= 0;
38584 if (offset < 0 || offset + 1 > this.buffer.byteLength)
38585 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
38586 }
38587 var value = this.view[offset];
38588 if ((value & 0x80) === 0x80) value = -(0xFF - value + 1); // Cast to signed
38589 if (relative) this.offset += 1;
38590 return value;
38591 };
38592
38593 /**
38594 * Reads an 8bit signed integer. This is an alias of {@link ByteBuffer#readInt8}.
38595 * @function
38596 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38597 * @returns {number} Value read
38598 * @expose
38599 */
38600 ByteBufferPrototype.readByte = ByteBufferPrototype.readInt8;
38601
38602 /**
38603 * Writes an 8bit unsigned integer.
38604 * @param {number} value Value to write
38605 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38606 * @returns {!ByteBuffer} this
38607 * @expose
38608 */
38609 ByteBufferPrototype.writeUint8 = function(value, offset) {
38610 var relative = typeof offset === 'undefined';
38611 if (relative) offset = this.offset;
38612 if (!this.noAssert) {
38613 if (typeof value !== 'number' || value % 1 !== 0)
38614 throw TypeError("Illegal value: "+value+" (not an integer)");
38615 value >>>= 0;
38616 if (typeof offset !== 'number' || offset % 1 !== 0)
38617 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38618 offset >>>= 0;
38619 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38620 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38621 }
38622 offset += 1;
38623 var capacity1 = this.buffer.byteLength;
38624 if (offset > capacity1)
38625 this.resize((capacity1 *= 2) > offset ? capacity1 : offset);
38626 offset -= 1;
38627 this.view[offset] = value;
38628 if (relative) this.offset += 1;
38629 return this;
38630 };
38631
38632 /**
38633 * Writes an 8bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint8}.
38634 * @function
38635 * @param {number} value Value to write
38636 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38637 * @returns {!ByteBuffer} this
38638 * @expose
38639 */
38640 ByteBufferPrototype.writeUInt8 = ByteBufferPrototype.writeUint8;
38641
38642 /**
38643 * Reads an 8bit unsigned integer.
38644 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38645 * @returns {number} Value read
38646 * @expose
38647 */
38648 ByteBufferPrototype.readUint8 = function(offset) {
38649 var relative = typeof offset === 'undefined';
38650 if (relative) offset = this.offset;
38651 if (!this.noAssert) {
38652 if (typeof offset !== 'number' || offset % 1 !== 0)
38653 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38654 offset >>>= 0;
38655 if (offset < 0 || offset + 1 > this.buffer.byteLength)
38656 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
38657 }
38658 var value = this.view[offset];
38659 if (relative) this.offset += 1;
38660 return value;
38661 };
38662
38663 /**
38664 * Reads an 8bit unsigned integer. This is an alias of {@link ByteBuffer#readUint8}.
38665 * @function
38666 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38667 * @returns {number} Value read
38668 * @expose
38669 */
38670 ByteBufferPrototype.readUInt8 = ByteBufferPrototype.readUint8;
38671
38672 // types/ints/int16
38673
38674 /**
38675 * Writes a 16bit signed integer.
38676 * @param {number} value Value to write
38677 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38678 * @throws {TypeError} If `offset` or `value` is not a valid number
38679 * @throws {RangeError} If `offset` is out of bounds
38680 * @expose
38681 */
38682 ByteBufferPrototype.writeInt16 = function(value, offset) {
38683 var relative = typeof offset === 'undefined';
38684 if (relative) offset = this.offset;
38685 if (!this.noAssert) {
38686 if (typeof value !== 'number' || value % 1 !== 0)
38687 throw TypeError("Illegal value: "+value+" (not an integer)");
38688 value |= 0;
38689 if (typeof offset !== 'number' || offset % 1 !== 0)
38690 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38691 offset >>>= 0;
38692 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38693 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38694 }
38695 offset += 2;
38696 var capacity2 = this.buffer.byteLength;
38697 if (offset > capacity2)
38698 this.resize((capacity2 *= 2) > offset ? capacity2 : offset);
38699 offset -= 2;
38700 if (this.littleEndian) {
38701 this.view[offset+1] = (value & 0xFF00) >>> 8;
38702 this.view[offset ] = value & 0x00FF;
38703 } else {
38704 this.view[offset] = (value & 0xFF00) >>> 8;
38705 this.view[offset+1] = value & 0x00FF;
38706 }
38707 if (relative) this.offset += 2;
38708 return this;
38709 };
38710
38711 /**
38712 * Writes a 16bit signed integer. This is an alias of {@link ByteBuffer#writeInt16}.
38713 * @function
38714 * @param {number} value Value to write
38715 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38716 * @throws {TypeError} If `offset` or `value` is not a valid number
38717 * @throws {RangeError} If `offset` is out of bounds
38718 * @expose
38719 */
38720 ByteBufferPrototype.writeShort = ByteBufferPrototype.writeInt16;
38721
38722 /**
38723 * Reads a 16bit signed integer.
38724 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38725 * @returns {number} Value read
38726 * @throws {TypeError} If `offset` is not a valid number
38727 * @throws {RangeError} If `offset` is out of bounds
38728 * @expose
38729 */
38730 ByteBufferPrototype.readInt16 = function(offset) {
38731 var relative = typeof offset === 'undefined';
38732 if (relative) offset = this.offset;
38733 if (!this.noAssert) {
38734 if (typeof offset !== 'number' || offset % 1 !== 0)
38735 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38736 offset >>>= 0;
38737 if (offset < 0 || offset + 2 > this.buffer.byteLength)
38738 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength);
38739 }
38740 var value = 0;
38741 if (this.littleEndian) {
38742 value = this.view[offset ];
38743 value |= this.view[offset+1] << 8;
38744 } else {
38745 value = this.view[offset ] << 8;
38746 value |= this.view[offset+1];
38747 }
38748 if ((value & 0x8000) === 0x8000) value = -(0xFFFF - value + 1); // Cast to signed
38749 if (relative) this.offset += 2;
38750 return value;
38751 };
38752
38753 /**
38754 * Reads a 16bit signed integer. This is an alias of {@link ByteBuffer#readInt16}.
38755 * @function
38756 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38757 * @returns {number} Value read
38758 * @throws {TypeError} If `offset` is not a valid number
38759 * @throws {RangeError} If `offset` is out of bounds
38760 * @expose
38761 */
38762 ByteBufferPrototype.readShort = ByteBufferPrototype.readInt16;
38763
38764 /**
38765 * Writes a 16bit unsigned integer.
38766 * @param {number} value Value to write
38767 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38768 * @throws {TypeError} If `offset` or `value` is not a valid number
38769 * @throws {RangeError} If `offset` is out of bounds
38770 * @expose
38771 */
38772 ByteBufferPrototype.writeUint16 = function(value, offset) {
38773 var relative = typeof offset === 'undefined';
38774 if (relative) offset = this.offset;
38775 if (!this.noAssert) {
38776 if (typeof value !== 'number' || value % 1 !== 0)
38777 throw TypeError("Illegal value: "+value+" (not an integer)");
38778 value >>>= 0;
38779 if (typeof offset !== 'number' || offset % 1 !== 0)
38780 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38781 offset >>>= 0;
38782 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38783 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38784 }
38785 offset += 2;
38786 var capacity3 = this.buffer.byteLength;
38787 if (offset > capacity3)
38788 this.resize((capacity3 *= 2) > offset ? capacity3 : offset);
38789 offset -= 2;
38790 if (this.littleEndian) {
38791 this.view[offset+1] = (value & 0xFF00) >>> 8;
38792 this.view[offset ] = value & 0x00FF;
38793 } else {
38794 this.view[offset] = (value & 0xFF00) >>> 8;
38795 this.view[offset+1] = value & 0x00FF;
38796 }
38797 if (relative) this.offset += 2;
38798 return this;
38799 };
38800
38801 /**
38802 * Writes a 16bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint16}.
38803 * @function
38804 * @param {number} value Value to write
38805 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38806 * @throws {TypeError} If `offset` or `value` is not a valid number
38807 * @throws {RangeError} If `offset` is out of bounds
38808 * @expose
38809 */
38810 ByteBufferPrototype.writeUInt16 = ByteBufferPrototype.writeUint16;
38811
38812 /**
38813 * Reads a 16bit unsigned integer.
38814 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38815 * @returns {number} Value read
38816 * @throws {TypeError} If `offset` is not a valid number
38817 * @throws {RangeError} If `offset` is out of bounds
38818 * @expose
38819 */
38820 ByteBufferPrototype.readUint16 = function(offset) {
38821 var relative = typeof offset === 'undefined';
38822 if (relative) offset = this.offset;
38823 if (!this.noAssert) {
38824 if (typeof offset !== 'number' || offset % 1 !== 0)
38825 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38826 offset >>>= 0;
38827 if (offset < 0 || offset + 2 > this.buffer.byteLength)
38828 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength);
38829 }
38830 var value = 0;
38831 if (this.littleEndian) {
38832 value = this.view[offset ];
38833 value |= this.view[offset+1] << 8;
38834 } else {
38835 value = this.view[offset ] << 8;
38836 value |= this.view[offset+1];
38837 }
38838 if (relative) this.offset += 2;
38839 return value;
38840 };
38841
38842 /**
38843 * Reads a 16bit unsigned integer. This is an alias of {@link ByteBuffer#readUint16}.
38844 * @function
38845 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38846 * @returns {number} Value read
38847 * @throws {TypeError} If `offset` is not a valid number
38848 * @throws {RangeError} If `offset` is out of bounds
38849 * @expose
38850 */
38851 ByteBufferPrototype.readUInt16 = ByteBufferPrototype.readUint16;
38852
38853 // types/ints/int32
38854
38855 /**
38856 * Writes a 32bit signed integer.
38857 * @param {number} value Value to write
38858 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
38859 * @expose
38860 */
38861 ByteBufferPrototype.writeInt32 = function(value, offset) {
38862 var relative = typeof offset === 'undefined';
38863 if (relative) offset = this.offset;
38864 if (!this.noAssert) {
38865 if (typeof value !== 'number' || value % 1 !== 0)
38866 throw TypeError("Illegal value: "+value+" (not an integer)");
38867 value |= 0;
38868 if (typeof offset !== 'number' || offset % 1 !== 0)
38869 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38870 offset >>>= 0;
38871 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38872 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38873 }
38874 offset += 4;
38875 var capacity4 = this.buffer.byteLength;
38876 if (offset > capacity4)
38877 this.resize((capacity4 *= 2) > offset ? capacity4 : offset);
38878 offset -= 4;
38879 if (this.littleEndian) {
38880 this.view[offset+3] = (value >>> 24) & 0xFF;
38881 this.view[offset+2] = (value >>> 16) & 0xFF;
38882 this.view[offset+1] = (value >>> 8) & 0xFF;
38883 this.view[offset ] = value & 0xFF;
38884 } else {
38885 this.view[offset ] = (value >>> 24) & 0xFF;
38886 this.view[offset+1] = (value >>> 16) & 0xFF;
38887 this.view[offset+2] = (value >>> 8) & 0xFF;
38888 this.view[offset+3] = value & 0xFF;
38889 }
38890 if (relative) this.offset += 4;
38891 return this;
38892 };
38893
38894 /**
38895 * Writes a 32bit signed integer. This is an alias of {@link ByteBuffer#writeInt32}.
38896 * @param {number} value Value to write
38897 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
38898 * @expose
38899 */
38900 ByteBufferPrototype.writeInt = ByteBufferPrototype.writeInt32;
38901
38902 /**
38903 * Reads a 32bit signed integer.
38904 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
38905 * @returns {number} Value read
38906 * @expose
38907 */
38908 ByteBufferPrototype.readInt32 = function(offset) {
38909 var relative = typeof offset === 'undefined';
38910 if (relative) offset = this.offset;
38911 if (!this.noAssert) {
38912 if (typeof offset !== 'number' || offset % 1 !== 0)
38913 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38914 offset >>>= 0;
38915 if (offset < 0 || offset + 4 > this.buffer.byteLength)
38916 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
38917 }
38918 var value = 0;
38919 if (this.littleEndian) {
38920 value = this.view[offset+2] << 16;
38921 value |= this.view[offset+1] << 8;
38922 value |= this.view[offset ];
38923 value += this.view[offset+3] << 24 >>> 0;
38924 } else {
38925 value = this.view[offset+1] << 16;
38926 value |= this.view[offset+2] << 8;
38927 value |= this.view[offset+3];
38928 value += this.view[offset ] << 24 >>> 0;
38929 }
38930 value |= 0; // Cast to signed
38931 if (relative) this.offset += 4;
38932 return value;
38933 };
38934
38935 /**
38936 * Reads a 32bit signed integer. This is an alias of {@link ByteBuffer#readInt32}.
38937 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `4` if omitted.
38938 * @returns {number} Value read
38939 * @expose
38940 */
38941 ByteBufferPrototype.readInt = ByteBufferPrototype.readInt32;
38942
38943 /**
38944 * Writes a 32bit unsigned integer.
38945 * @param {number} value Value to write
38946 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
38947 * @expose
38948 */
38949 ByteBufferPrototype.writeUint32 = function(value, offset) {
38950 var relative = typeof offset === 'undefined';
38951 if (relative) offset = this.offset;
38952 if (!this.noAssert) {
38953 if (typeof value !== 'number' || value % 1 !== 0)
38954 throw TypeError("Illegal value: "+value+" (not an integer)");
38955 value >>>= 0;
38956 if (typeof offset !== 'number' || offset % 1 !== 0)
38957 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38958 offset >>>= 0;
38959 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38960 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38961 }
38962 offset += 4;
38963 var capacity5 = this.buffer.byteLength;
38964 if (offset > capacity5)
38965 this.resize((capacity5 *= 2) > offset ? capacity5 : offset);
38966 offset -= 4;
38967 if (this.littleEndian) {
38968 this.view[offset+3] = (value >>> 24) & 0xFF;
38969 this.view[offset+2] = (value >>> 16) & 0xFF;
38970 this.view[offset+1] = (value >>> 8) & 0xFF;
38971 this.view[offset ] = value & 0xFF;
38972 } else {
38973 this.view[offset ] = (value >>> 24) & 0xFF;
38974 this.view[offset+1] = (value >>> 16) & 0xFF;
38975 this.view[offset+2] = (value >>> 8) & 0xFF;
38976 this.view[offset+3] = value & 0xFF;
38977 }
38978 if (relative) this.offset += 4;
38979 return this;
38980 };
38981
38982 /**
38983 * Writes a 32bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint32}.
38984 * @function
38985 * @param {number} value Value to write
38986 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
38987 * @expose
38988 */
38989 ByteBufferPrototype.writeUInt32 = ByteBufferPrototype.writeUint32;
38990
38991 /**
38992 * Reads a 32bit unsigned integer.
38993 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
38994 * @returns {number} Value read
38995 * @expose
38996 */
38997 ByteBufferPrototype.readUint32 = function(offset) {
38998 var relative = typeof offset === 'undefined';
38999 if (relative) offset = this.offset;
39000 if (!this.noAssert) {
39001 if (typeof offset !== 'number' || offset % 1 !== 0)
39002 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39003 offset >>>= 0;
39004 if (offset < 0 || offset + 4 > this.buffer.byteLength)
39005 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
39006 }
39007 var value = 0;
39008 if (this.littleEndian) {
39009 value = this.view[offset+2] << 16;
39010 value |= this.view[offset+1] << 8;
39011 value |= this.view[offset ];
39012 value += this.view[offset+3] << 24 >>> 0;
39013 } else {
39014 value = this.view[offset+1] << 16;
39015 value |= this.view[offset+2] << 8;
39016 value |= this.view[offset+3];
39017 value += this.view[offset ] << 24 >>> 0;
39018 }
39019 if (relative) this.offset += 4;
39020 return value;
39021 };
39022
39023 /**
39024 * Reads a 32bit unsigned integer. This is an alias of {@link ByteBuffer#readUint32}.
39025 * @function
39026 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
39027 * @returns {number} Value read
39028 * @expose
39029 */
39030 ByteBufferPrototype.readUInt32 = ByteBufferPrototype.readUint32;
39031
39032 // types/ints/int64
39033
39034 if (Long) {
39035
39036 /**
39037 * Writes a 64bit signed integer.
39038 * @param {number|!Long} value Value to write
39039 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39040 * @returns {!ByteBuffer} this
39041 * @expose
39042 */
39043 ByteBufferPrototype.writeInt64 = function(value, offset) {
39044 var relative = typeof offset === 'undefined';
39045 if (relative) offset = this.offset;
39046 if (!this.noAssert) {
39047 if (typeof value === 'number')
39048 value = Long.fromNumber(value);
39049 else if (typeof value === 'string')
39050 value = Long.fromString(value);
39051 else if (!(value && value instanceof Long))
39052 throw TypeError("Illegal value: "+value+" (not an integer or Long)");
39053 if (typeof offset !== 'number' || offset % 1 !== 0)
39054 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39055 offset >>>= 0;
39056 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39057 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39058 }
39059 if (typeof value === 'number')
39060 value = Long.fromNumber(value);
39061 else if (typeof value === 'string')
39062 value = Long.fromString(value);
39063 offset += 8;
39064 var capacity6 = this.buffer.byteLength;
39065 if (offset > capacity6)
39066 this.resize((capacity6 *= 2) > offset ? capacity6 : offset);
39067 offset -= 8;
39068 var lo = value.low,
39069 hi = value.high;
39070 if (this.littleEndian) {
39071 this.view[offset+3] = (lo >>> 24) & 0xFF;
39072 this.view[offset+2] = (lo >>> 16) & 0xFF;
39073 this.view[offset+1] = (lo >>> 8) & 0xFF;
39074 this.view[offset ] = lo & 0xFF;
39075 offset += 4;
39076 this.view[offset+3] = (hi >>> 24) & 0xFF;
39077 this.view[offset+2] = (hi >>> 16) & 0xFF;
39078 this.view[offset+1] = (hi >>> 8) & 0xFF;
39079 this.view[offset ] = hi & 0xFF;
39080 } else {
39081 this.view[offset ] = (hi >>> 24) & 0xFF;
39082 this.view[offset+1] = (hi >>> 16) & 0xFF;
39083 this.view[offset+2] = (hi >>> 8) & 0xFF;
39084 this.view[offset+3] = hi & 0xFF;
39085 offset += 4;
39086 this.view[offset ] = (lo >>> 24) & 0xFF;
39087 this.view[offset+1] = (lo >>> 16) & 0xFF;
39088 this.view[offset+2] = (lo >>> 8) & 0xFF;
39089 this.view[offset+3] = lo & 0xFF;
39090 }
39091 if (relative) this.offset += 8;
39092 return this;
39093 };
39094
39095 /**
39096 * Writes a 64bit signed integer. This is an alias of {@link ByteBuffer#writeInt64}.
39097 * @param {number|!Long} value Value to write
39098 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39099 * @returns {!ByteBuffer} this
39100 * @expose
39101 */
39102 ByteBufferPrototype.writeLong = ByteBufferPrototype.writeInt64;
39103
39104 /**
39105 * Reads a 64bit signed integer.
39106 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39107 * @returns {!Long}
39108 * @expose
39109 */
39110 ByteBufferPrototype.readInt64 = function(offset) {
39111 var relative = typeof offset === 'undefined';
39112 if (relative) offset = this.offset;
39113 if (!this.noAssert) {
39114 if (typeof offset !== 'number' || offset % 1 !== 0)
39115 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39116 offset >>>= 0;
39117 if (offset < 0 || offset + 8 > this.buffer.byteLength)
39118 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
39119 }
39120 var lo = 0,
39121 hi = 0;
39122 if (this.littleEndian) {
39123 lo = this.view[offset+2] << 16;
39124 lo |= this.view[offset+1] << 8;
39125 lo |= this.view[offset ];
39126 lo += this.view[offset+3] << 24 >>> 0;
39127 offset += 4;
39128 hi = this.view[offset+2] << 16;
39129 hi |= this.view[offset+1] << 8;
39130 hi |= this.view[offset ];
39131 hi += this.view[offset+3] << 24 >>> 0;
39132 } else {
39133 hi = this.view[offset+1] << 16;
39134 hi |= this.view[offset+2] << 8;
39135 hi |= this.view[offset+3];
39136 hi += this.view[offset ] << 24 >>> 0;
39137 offset += 4;
39138 lo = this.view[offset+1] << 16;
39139 lo |= this.view[offset+2] << 8;
39140 lo |= this.view[offset+3];
39141 lo += this.view[offset ] << 24 >>> 0;
39142 }
39143 var value = new Long(lo, hi, false);
39144 if (relative) this.offset += 8;
39145 return value;
39146 };
39147
39148 /**
39149 * Reads a 64bit signed integer. This is an alias of {@link ByteBuffer#readInt64}.
39150 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39151 * @returns {!Long}
39152 * @expose
39153 */
39154 ByteBufferPrototype.readLong = ByteBufferPrototype.readInt64;
39155
39156 /**
39157 * Writes a 64bit unsigned integer.
39158 * @param {number|!Long} value Value to write
39159 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39160 * @returns {!ByteBuffer} this
39161 * @expose
39162 */
39163 ByteBufferPrototype.writeUint64 = function(value, offset) {
39164 var relative = typeof offset === 'undefined';
39165 if (relative) offset = this.offset;
39166 if (!this.noAssert) {
39167 if (typeof value === 'number')
39168 value = Long.fromNumber(value);
39169 else if (typeof value === 'string')
39170 value = Long.fromString(value);
39171 else if (!(value && value instanceof Long))
39172 throw TypeError("Illegal value: "+value+" (not an integer or Long)");
39173 if (typeof offset !== 'number' || offset % 1 !== 0)
39174 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39175 offset >>>= 0;
39176 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39177 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39178 }
39179 if (typeof value === 'number')
39180 value = Long.fromNumber(value);
39181 else if (typeof value === 'string')
39182 value = Long.fromString(value);
39183 offset += 8;
39184 var capacity7 = this.buffer.byteLength;
39185 if (offset > capacity7)
39186 this.resize((capacity7 *= 2) > offset ? capacity7 : offset);
39187 offset -= 8;
39188 var lo = value.low,
39189 hi = value.high;
39190 if (this.littleEndian) {
39191 this.view[offset+3] = (lo >>> 24) & 0xFF;
39192 this.view[offset+2] = (lo >>> 16) & 0xFF;
39193 this.view[offset+1] = (lo >>> 8) & 0xFF;
39194 this.view[offset ] = lo & 0xFF;
39195 offset += 4;
39196 this.view[offset+3] = (hi >>> 24) & 0xFF;
39197 this.view[offset+2] = (hi >>> 16) & 0xFF;
39198 this.view[offset+1] = (hi >>> 8) & 0xFF;
39199 this.view[offset ] = hi & 0xFF;
39200 } else {
39201 this.view[offset ] = (hi >>> 24) & 0xFF;
39202 this.view[offset+1] = (hi >>> 16) & 0xFF;
39203 this.view[offset+2] = (hi >>> 8) & 0xFF;
39204 this.view[offset+3] = hi & 0xFF;
39205 offset += 4;
39206 this.view[offset ] = (lo >>> 24) & 0xFF;
39207 this.view[offset+1] = (lo >>> 16) & 0xFF;
39208 this.view[offset+2] = (lo >>> 8) & 0xFF;
39209 this.view[offset+3] = lo & 0xFF;
39210 }
39211 if (relative) this.offset += 8;
39212 return this;
39213 };
39214
39215 /**
39216 * Writes a 64bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint64}.
39217 * @function
39218 * @param {number|!Long} value Value to write
39219 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39220 * @returns {!ByteBuffer} this
39221 * @expose
39222 */
39223 ByteBufferPrototype.writeUInt64 = ByteBufferPrototype.writeUint64;
39224
39225 /**
39226 * Reads a 64bit unsigned integer.
39227 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39228 * @returns {!Long}
39229 * @expose
39230 */
39231 ByteBufferPrototype.readUint64 = function(offset) {
39232 var relative = typeof offset === 'undefined';
39233 if (relative) offset = this.offset;
39234 if (!this.noAssert) {
39235 if (typeof offset !== 'number' || offset % 1 !== 0)
39236 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39237 offset >>>= 0;
39238 if (offset < 0 || offset + 8 > this.buffer.byteLength)
39239 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
39240 }
39241 var lo = 0,
39242 hi = 0;
39243 if (this.littleEndian) {
39244 lo = this.view[offset+2] << 16;
39245 lo |= this.view[offset+1] << 8;
39246 lo |= this.view[offset ];
39247 lo += this.view[offset+3] << 24 >>> 0;
39248 offset += 4;
39249 hi = this.view[offset+2] << 16;
39250 hi |= this.view[offset+1] << 8;
39251 hi |= this.view[offset ];
39252 hi += this.view[offset+3] << 24 >>> 0;
39253 } else {
39254 hi = this.view[offset+1] << 16;
39255 hi |= this.view[offset+2] << 8;
39256 hi |= this.view[offset+3];
39257 hi += this.view[offset ] << 24 >>> 0;
39258 offset += 4;
39259 lo = this.view[offset+1] << 16;
39260 lo |= this.view[offset+2] << 8;
39261 lo |= this.view[offset+3];
39262 lo += this.view[offset ] << 24 >>> 0;
39263 }
39264 var value = new Long(lo, hi, true);
39265 if (relative) this.offset += 8;
39266 return value;
39267 };
39268
39269 /**
39270 * Reads a 64bit unsigned integer. This is an alias of {@link ByteBuffer#readUint64}.
39271 * @function
39272 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39273 * @returns {!Long}
39274 * @expose
39275 */
39276 ByteBufferPrototype.readUInt64 = ByteBufferPrototype.readUint64;
39277
39278 } // Long
39279
39280
39281 // types/floats/float32
39282
39283 /*
39284 ieee754 - https://github.com/feross/ieee754
39285
39286 The MIT License (MIT)
39287
39288 Copyright (c) Feross Aboukhadijeh
39289
39290 Permission is hereby granted, free of charge, to any person obtaining a copy
39291 of this software and associated documentation files (the "Software"), to deal
39292 in the Software without restriction, including without limitation the rights
39293 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
39294 copies of the Software, and to permit persons to whom the Software is
39295 furnished to do so, subject to the following conditions:
39296
39297 The above copyright notice and this permission notice shall be included in
39298 all copies or substantial portions of the Software.
39299
39300 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39301 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39302 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
39303 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39304 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
39305 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
39306 THE SOFTWARE.
39307 */
39308
39309 /**
39310 * Reads an IEEE754 float from a byte array.
39311 * @param {!Array} buffer
39312 * @param {number} offset
39313 * @param {boolean} isLE
39314 * @param {number} mLen
39315 * @param {number} nBytes
39316 * @returns {number}
39317 * @inner
39318 */
39319 function ieee754_read(buffer, offset, isLE, mLen, nBytes) {
39320 var e, m,
39321 eLen = nBytes * 8 - mLen - 1,
39322 eMax = (1 << eLen) - 1,
39323 eBias = eMax >> 1,
39324 nBits = -7,
39325 i = isLE ? (nBytes - 1) : 0,
39326 d = isLE ? -1 : 1,
39327 s = buffer[offset + i];
39328
39329 i += d;
39330
39331 e = s & ((1 << (-nBits)) - 1);
39332 s >>= (-nBits);
39333 nBits += eLen;
39334 for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
39335
39336 m = e & ((1 << (-nBits)) - 1);
39337 e >>= (-nBits);
39338 nBits += mLen;
39339 for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
39340
39341 if (e === 0) {
39342 e = 1 - eBias;
39343 } else if (e === eMax) {
39344 return m ? NaN : ((s ? -1 : 1) * Infinity);
39345 } else {
39346 m = m + Math.pow(2, mLen);
39347 e = e - eBias;
39348 }
39349 return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
39350 }
39351
39352 /**
39353 * Writes an IEEE754 float to a byte array.
39354 * @param {!Array} buffer
39355 * @param {number} value
39356 * @param {number} offset
39357 * @param {boolean} isLE
39358 * @param {number} mLen
39359 * @param {number} nBytes
39360 * @inner
39361 */
39362 function ieee754_write(buffer, value, offset, isLE, mLen, nBytes) {
39363 var e, m, c,
39364 eLen = nBytes * 8 - mLen - 1,
39365 eMax = (1 << eLen) - 1,
39366 eBias = eMax >> 1,
39367 rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),
39368 i = isLE ? 0 : (nBytes - 1),
39369 d = isLE ? 1 : -1,
39370 s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
39371
39372 value = Math.abs(value);
39373
39374 if (isNaN(value) || value === Infinity) {
39375 m = isNaN(value) ? 1 : 0;
39376 e = eMax;
39377 } else {
39378 e = Math.floor(Math.log(value) / Math.LN2);
39379 if (value * (c = Math.pow(2, -e)) < 1) {
39380 e--;
39381 c *= 2;
39382 }
39383 if (e + eBias >= 1) {
39384 value += rt / c;
39385 } else {
39386 value += rt * Math.pow(2, 1 - eBias);
39387 }
39388 if (value * c >= 2) {
39389 e++;
39390 c /= 2;
39391 }
39392
39393 if (e + eBias >= eMax) {
39394 m = 0;
39395 e = eMax;
39396 } else if (e + eBias >= 1) {
39397 m = (value * c - 1) * Math.pow(2, mLen);
39398 e = e + eBias;
39399 } else {
39400 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
39401 e = 0;
39402 }
39403 }
39404
39405 for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
39406
39407 e = (e << mLen) | m;
39408 eLen += mLen;
39409 for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
39410
39411 buffer[offset + i - d] |= s * 128;
39412 }
39413
39414 /**
39415 * Writes a 32bit float.
39416 * @param {number} value Value to write
39417 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
39418 * @returns {!ByteBuffer} this
39419 * @expose
39420 */
39421 ByteBufferPrototype.writeFloat32 = function(value, offset) {
39422 var relative = typeof offset === 'undefined';
39423 if (relative) offset = this.offset;
39424 if (!this.noAssert) {
39425 if (typeof value !== 'number')
39426 throw TypeError("Illegal value: "+value+" (not a number)");
39427 if (typeof offset !== 'number' || offset % 1 !== 0)
39428 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39429 offset >>>= 0;
39430 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39431 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39432 }
39433 offset += 4;
39434 var capacity8 = this.buffer.byteLength;
39435 if (offset > capacity8)
39436 this.resize((capacity8 *= 2) > offset ? capacity8 : offset);
39437 offset -= 4;
39438 ieee754_write(this.view, value, offset, this.littleEndian, 23, 4);
39439 if (relative) this.offset += 4;
39440 return this;
39441 };
39442
39443 /**
39444 * Writes a 32bit float. This is an alias of {@link ByteBuffer#writeFloat32}.
39445 * @function
39446 * @param {number} value Value to write
39447 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
39448 * @returns {!ByteBuffer} this
39449 * @expose
39450 */
39451 ByteBufferPrototype.writeFloat = ByteBufferPrototype.writeFloat32;
39452
39453 /**
39454 * Reads a 32bit float.
39455 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
39456 * @returns {number}
39457 * @expose
39458 */
39459 ByteBufferPrototype.readFloat32 = function(offset) {
39460 var relative = typeof offset === 'undefined';
39461 if (relative) offset = this.offset;
39462 if (!this.noAssert) {
39463 if (typeof offset !== 'number' || offset % 1 !== 0)
39464 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39465 offset >>>= 0;
39466 if (offset < 0 || offset + 4 > this.buffer.byteLength)
39467 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
39468 }
39469 var value = ieee754_read(this.view, offset, this.littleEndian, 23, 4);
39470 if (relative) this.offset += 4;
39471 return value;
39472 };
39473
39474 /**
39475 * Reads a 32bit float. This is an alias of {@link ByteBuffer#readFloat32}.
39476 * @function
39477 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
39478 * @returns {number}
39479 * @expose
39480 */
39481 ByteBufferPrototype.readFloat = ByteBufferPrototype.readFloat32;
39482
39483 // types/floats/float64
39484
39485 /**
39486 * Writes a 64bit float.
39487 * @param {number} value Value to write
39488 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39489 * @returns {!ByteBuffer} this
39490 * @expose
39491 */
39492 ByteBufferPrototype.writeFloat64 = function(value, offset) {
39493 var relative = typeof offset === 'undefined';
39494 if (relative) offset = this.offset;
39495 if (!this.noAssert) {
39496 if (typeof value !== 'number')
39497 throw TypeError("Illegal value: "+value+" (not a number)");
39498 if (typeof offset !== 'number' || offset % 1 !== 0)
39499 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39500 offset >>>= 0;
39501 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39502 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39503 }
39504 offset += 8;
39505 var capacity9 = this.buffer.byteLength;
39506 if (offset > capacity9)
39507 this.resize((capacity9 *= 2) > offset ? capacity9 : offset);
39508 offset -= 8;
39509 ieee754_write(this.view, value, offset, this.littleEndian, 52, 8);
39510 if (relative) this.offset += 8;
39511 return this;
39512 };
39513
39514 /**
39515 * Writes a 64bit float. This is an alias of {@link ByteBuffer#writeFloat64}.
39516 * @function
39517 * @param {number} value Value to write
39518 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39519 * @returns {!ByteBuffer} this
39520 * @expose
39521 */
39522 ByteBufferPrototype.writeDouble = ByteBufferPrototype.writeFloat64;
39523
39524 /**
39525 * Reads a 64bit float.
39526 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39527 * @returns {number}
39528 * @expose
39529 */
39530 ByteBufferPrototype.readFloat64 = function(offset) {
39531 var relative = typeof offset === 'undefined';
39532 if (relative) offset = this.offset;
39533 if (!this.noAssert) {
39534 if (typeof offset !== 'number' || offset % 1 !== 0)
39535 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39536 offset >>>= 0;
39537 if (offset < 0 || offset + 8 > this.buffer.byteLength)
39538 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
39539 }
39540 var value = ieee754_read(this.view, offset, this.littleEndian, 52, 8);
39541 if (relative) this.offset += 8;
39542 return value;
39543 };
39544
39545 /**
39546 * Reads a 64bit float. This is an alias of {@link ByteBuffer#readFloat64}.
39547 * @function
39548 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39549 * @returns {number}
39550 * @expose
39551 */
39552 ByteBufferPrototype.readDouble = ByteBufferPrototype.readFloat64;
39553
39554
39555 // types/varints/varint32
39556
39557 /**
39558 * Maximum number of bytes required to store a 32bit base 128 variable-length integer.
39559 * @type {number}
39560 * @const
39561 * @expose
39562 */
39563 ByteBuffer.MAX_VARINT32_BYTES = 5;
39564
39565 /**
39566 * Calculates the actual number of bytes required to store a 32bit base 128 variable-length integer.
39567 * @param {number} value Value to encode
39568 * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT32_BYTES}
39569 * @expose
39570 */
39571 ByteBuffer.calculateVarint32 = function(value) {
39572 // ref: src/google/protobuf/io/coded_stream.cc
39573 value = value >>> 0;
39574 if (value < 1 << 7 ) return 1;
39575 else if (value < 1 << 14) return 2;
39576 else if (value < 1 << 21) return 3;
39577 else if (value < 1 << 28) return 4;
39578 else return 5;
39579 };
39580
39581 /**
39582 * Zigzag encodes a signed 32bit integer so that it can be effectively used with varint encoding.
39583 * @param {number} n Signed 32bit integer
39584 * @returns {number} Unsigned zigzag encoded 32bit integer
39585 * @expose
39586 */
39587 ByteBuffer.zigZagEncode32 = function(n) {
39588 return (((n |= 0) << 1) ^ (n >> 31)) >>> 0; // ref: src/google/protobuf/wire_format_lite.h
39589 };
39590
39591 /**
39592 * Decodes a zigzag encoded signed 32bit integer.
39593 * @param {number} n Unsigned zigzag encoded 32bit integer
39594 * @returns {number} Signed 32bit integer
39595 * @expose
39596 */
39597 ByteBuffer.zigZagDecode32 = function(n) {
39598 return ((n >>> 1) ^ -(n & 1)) | 0; // // ref: src/google/protobuf/wire_format_lite.h
39599 };
39600
39601 /**
39602 * Writes a 32bit base 128 variable-length integer.
39603 * @param {number} value Value to write
39604 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39605 * written if omitted.
39606 * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written
39607 * @expose
39608 */
39609 ByteBufferPrototype.writeVarint32 = function(value, offset) {
39610 var relative = typeof offset === 'undefined';
39611 if (relative) offset = this.offset;
39612 if (!this.noAssert) {
39613 if (typeof value !== 'number' || value % 1 !== 0)
39614 throw TypeError("Illegal value: "+value+" (not an integer)");
39615 value |= 0;
39616 if (typeof offset !== 'number' || offset % 1 !== 0)
39617 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39618 offset >>>= 0;
39619 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39620 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39621 }
39622 var size = ByteBuffer.calculateVarint32(value),
39623 b;
39624 offset += size;
39625 var capacity10 = this.buffer.byteLength;
39626 if (offset > capacity10)
39627 this.resize((capacity10 *= 2) > offset ? capacity10 : offset);
39628 offset -= size;
39629 value >>>= 0;
39630 while (value >= 0x80) {
39631 b = (value & 0x7f) | 0x80;
39632 this.view[offset++] = b;
39633 value >>>= 7;
39634 }
39635 this.view[offset++] = value;
39636 if (relative) {
39637 this.offset = offset;
39638 return this;
39639 }
39640 return size;
39641 };
39642
39643 /**
39644 * Writes a zig-zag encoded (signed) 32bit base 128 variable-length integer.
39645 * @param {number} value Value to write
39646 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39647 * written if omitted.
39648 * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written
39649 * @expose
39650 */
39651 ByteBufferPrototype.writeVarint32ZigZag = function(value, offset) {
39652 return this.writeVarint32(ByteBuffer.zigZagEncode32(value), offset);
39653 };
39654
39655 /**
39656 * Reads a 32bit base 128 variable-length integer.
39657 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39658 * written if omitted.
39659 * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read
39660 * and the actual number of bytes read.
39661 * @throws {Error} If it's not a valid varint. Has a property `truncated = true` if there is not enough data available
39662 * to fully decode the varint.
39663 * @expose
39664 */
39665 ByteBufferPrototype.readVarint32 = function(offset) {
39666 var relative = typeof offset === 'undefined';
39667 if (relative) offset = this.offset;
39668 if (!this.noAssert) {
39669 if (typeof offset !== 'number' || offset % 1 !== 0)
39670 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39671 offset >>>= 0;
39672 if (offset < 0 || offset + 1 > this.buffer.byteLength)
39673 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
39674 }
39675 var c = 0,
39676 value = 0 >>> 0,
39677 b;
39678 do {
39679 if (!this.noAssert && offset > this.limit) {
39680 var err = Error("Truncated");
39681 err['truncated'] = true;
39682 throw err;
39683 }
39684 b = this.view[offset++];
39685 if (c < 5)
39686 value |= (b & 0x7f) << (7*c);
39687 ++c;
39688 } while ((b & 0x80) !== 0);
39689 value |= 0;
39690 if (relative) {
39691 this.offset = offset;
39692 return value;
39693 }
39694 return {
39695 "value": value,
39696 "length": c
39697 };
39698 };
39699
39700 /**
39701 * Reads a zig-zag encoded (signed) 32bit base 128 variable-length integer.
39702 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39703 * written if omitted.
39704 * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read
39705 * and the actual number of bytes read.
39706 * @throws {Error} If it's not a valid varint
39707 * @expose
39708 */
39709 ByteBufferPrototype.readVarint32ZigZag = function(offset) {
39710 var val = this.readVarint32(offset);
39711 if (typeof val === 'object')
39712 val["value"] = ByteBuffer.zigZagDecode32(val["value"]);
39713 else
39714 val = ByteBuffer.zigZagDecode32(val);
39715 return val;
39716 };
39717
39718 // types/varints/varint64
39719
39720 if (Long) {
39721
39722 /**
39723 * Maximum number of bytes required to store a 64bit base 128 variable-length integer.
39724 * @type {number}
39725 * @const
39726 * @expose
39727 */
39728 ByteBuffer.MAX_VARINT64_BYTES = 10;
39729
39730 /**
39731 * Calculates the actual number of bytes required to store a 64bit base 128 variable-length integer.
39732 * @param {number|!Long} value Value to encode
39733 * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT64_BYTES}
39734 * @expose
39735 */
39736 ByteBuffer.calculateVarint64 = function(value) {
39737 if (typeof value === 'number')
39738 value = Long.fromNumber(value);
39739 else if (typeof value === 'string')
39740 value = Long.fromString(value);
39741 // ref: src/google/protobuf/io/coded_stream.cc
39742 var part0 = value.toInt() >>> 0,
39743 part1 = value.shiftRightUnsigned(28).toInt() >>> 0,
39744 part2 = value.shiftRightUnsigned(56).toInt() >>> 0;
39745 if (part2 == 0) {
39746 if (part1 == 0) {
39747 if (part0 < 1 << 14)
39748 return part0 < 1 << 7 ? 1 : 2;
39749 else
39750 return part0 < 1 << 21 ? 3 : 4;
39751 } else {
39752 if (part1 < 1 << 14)
39753 return part1 < 1 << 7 ? 5 : 6;
39754 else
39755 return part1 < 1 << 21 ? 7 : 8;
39756 }
39757 } else
39758 return part2 < 1 << 7 ? 9 : 10;
39759 };
39760
39761 /**
39762 * Zigzag encodes a signed 64bit integer so that it can be effectively used with varint encoding.
39763 * @param {number|!Long} value Signed long
39764 * @returns {!Long} Unsigned zigzag encoded long
39765 * @expose
39766 */
39767 ByteBuffer.zigZagEncode64 = function(value) {
39768 if (typeof value === 'number')
39769 value = Long.fromNumber(value, false);
39770 else if (typeof value === 'string')
39771 value = Long.fromString(value, false);
39772 else if (value.unsigned !== false) value = value.toSigned();
39773 // ref: src/google/protobuf/wire_format_lite.h
39774 return value.shiftLeft(1).xor(value.shiftRight(63)).toUnsigned();
39775 };
39776
39777 /**
39778 * Decodes a zigzag encoded signed 64bit integer.
39779 * @param {!Long|number} value Unsigned zigzag encoded long or JavaScript number
39780 * @returns {!Long} Signed long
39781 * @expose
39782 */
39783 ByteBuffer.zigZagDecode64 = function(value) {
39784 if (typeof value === 'number')
39785 value = Long.fromNumber(value, false);
39786 else if (typeof value === 'string')
39787 value = Long.fromString(value, false);
39788 else if (value.unsigned !== false) value = value.toSigned();
39789 // ref: src/google/protobuf/wire_format_lite.h
39790 return value.shiftRightUnsigned(1).xor(value.and(Long.ONE).toSigned().negate()).toSigned();
39791 };
39792
39793 /**
39794 * Writes a 64bit base 128 variable-length integer.
39795 * @param {number|Long} value Value to write
39796 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39797 * written if omitted.
39798 * @returns {!ByteBuffer|number} `this` if offset is omitted, else the actual number of bytes written.
39799 * @expose
39800 */
39801 ByteBufferPrototype.writeVarint64 = function(value, offset) {
39802 var relative = typeof offset === 'undefined';
39803 if (relative) offset = this.offset;
39804 if (!this.noAssert) {
39805 if (typeof value === 'number')
39806 value = Long.fromNumber(value);
39807 else if (typeof value === 'string')
39808 value = Long.fromString(value);
39809 else if (!(value && value instanceof Long))
39810 throw TypeError("Illegal value: "+value+" (not an integer or Long)");
39811 if (typeof offset !== 'number' || offset % 1 !== 0)
39812 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39813 offset >>>= 0;
39814 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39815 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39816 }
39817 if (typeof value === 'number')
39818 value = Long.fromNumber(value, false);
39819 else if (typeof value === 'string')
39820 value = Long.fromString(value, false);
39821 else if (value.unsigned !== false) value = value.toSigned();
39822 var size = ByteBuffer.calculateVarint64(value),
39823 part0 = value.toInt() >>> 0,
39824 part1 = value.shiftRightUnsigned(28).toInt() >>> 0,
39825 part2 = value.shiftRightUnsigned(56).toInt() >>> 0;
39826 offset += size;
39827 var capacity11 = this.buffer.byteLength;
39828 if (offset > capacity11)
39829 this.resize((capacity11 *= 2) > offset ? capacity11 : offset);
39830 offset -= size;
39831 switch (size) {
39832 case 10: this.view[offset+9] = (part2 >>> 7) & 0x01;
39833 case 9 : this.view[offset+8] = size !== 9 ? (part2 ) | 0x80 : (part2 ) & 0x7F;
39834 case 8 : this.view[offset+7] = size !== 8 ? (part1 >>> 21) | 0x80 : (part1 >>> 21) & 0x7F;
39835 case 7 : this.view[offset+6] = size !== 7 ? (part1 >>> 14) | 0x80 : (part1 >>> 14) & 0x7F;
39836 case 6 : this.view[offset+5] = size !== 6 ? (part1 >>> 7) | 0x80 : (part1 >>> 7) & 0x7F;
39837 case 5 : this.view[offset+4] = size !== 5 ? (part1 ) | 0x80 : (part1 ) & 0x7F;
39838 case 4 : this.view[offset+3] = size !== 4 ? (part0 >>> 21) | 0x80 : (part0 >>> 21) & 0x7F;
39839 case 3 : this.view[offset+2] = size !== 3 ? (part0 >>> 14) | 0x80 : (part0 >>> 14) & 0x7F;
39840 case 2 : this.view[offset+1] = size !== 2 ? (part0 >>> 7) | 0x80 : (part0 >>> 7) & 0x7F;
39841 case 1 : this.view[offset ] = size !== 1 ? (part0 ) | 0x80 : (part0 ) & 0x7F;
39842 }
39843 if (relative) {
39844 this.offset += size;
39845 return this;
39846 } else {
39847 return size;
39848 }
39849 };
39850
39851 /**
39852 * Writes a zig-zag encoded 64bit base 128 variable-length integer.
39853 * @param {number|Long} value Value to write
39854 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39855 * written if omitted.
39856 * @returns {!ByteBuffer|number} `this` if offset is omitted, else the actual number of bytes written.
39857 * @expose
39858 */
39859 ByteBufferPrototype.writeVarint64ZigZag = function(value, offset) {
39860 return this.writeVarint64(ByteBuffer.zigZagEncode64(value), offset);
39861 };
39862
39863 /**
39864 * Reads a 64bit base 128 variable-length integer. Requires Long.js.
39865 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39866 * read if omitted.
39867 * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and
39868 * the actual number of bytes read.
39869 * @throws {Error} If it's not a valid varint
39870 * @expose
39871 */
39872 ByteBufferPrototype.readVarint64 = function(offset) {
39873 var relative = typeof offset === 'undefined';
39874 if (relative) offset = this.offset;
39875 if (!this.noAssert) {
39876 if (typeof offset !== 'number' || offset % 1 !== 0)
39877 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39878 offset >>>= 0;
39879 if (offset < 0 || offset + 1 > this.buffer.byteLength)
39880 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
39881 }
39882 // ref: src/google/protobuf/io/coded_stream.cc
39883 var start = offset,
39884 part0 = 0,
39885 part1 = 0,
39886 part2 = 0,
39887 b = 0;
39888 b = this.view[offset++]; part0 = (b & 0x7F) ; if ( b & 0x80 ) {
39889 b = this.view[offset++]; part0 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39890 b = this.view[offset++]; part0 |= (b & 0x7F) << 14; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39891 b = this.view[offset++]; part0 |= (b & 0x7F) << 21; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39892 b = this.view[offset++]; part1 = (b & 0x7F) ; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39893 b = this.view[offset++]; part1 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39894 b = this.view[offset++]; part1 |= (b & 0x7F) << 14; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39895 b = this.view[offset++]; part1 |= (b & 0x7F) << 21; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39896 b = this.view[offset++]; part2 = (b & 0x7F) ; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39897 b = this.view[offset++]; part2 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39898 throw Error("Buffer overrun"); }}}}}}}}}}
39899 var value = Long.fromBits(part0 | (part1 << 28), (part1 >>> 4) | (part2) << 24, false);
39900 if (relative) {
39901 this.offset = offset;
39902 return value;
39903 } else {
39904 return {
39905 'value': value,
39906 'length': offset-start
39907 };
39908 }
39909 };
39910
39911 /**
39912 * Reads a zig-zag encoded 64bit base 128 variable-length integer. Requires Long.js.
39913 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39914 * read if omitted.
39915 * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and
39916 * the actual number of bytes read.
39917 * @throws {Error} If it's not a valid varint
39918 * @expose
39919 */
39920 ByteBufferPrototype.readVarint64ZigZag = function(offset) {
39921 var val = this.readVarint64(offset);
39922 if (val && val['value'] instanceof Long)
39923 val["value"] = ByteBuffer.zigZagDecode64(val["value"]);
39924 else
39925 val = ByteBuffer.zigZagDecode64(val);
39926 return val;
39927 };
39928
39929 } // Long
39930
39931
39932 // types/strings/cstring
39933
39934 /**
39935 * Writes a NULL-terminated UTF8 encoded string. For this to work the specified string must not contain any NULL
39936 * characters itself.
39937 * @param {string} str String to write
39938 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39939 * contained in `str` + 1 if omitted.
39940 * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written
39941 * @expose
39942 */
39943 ByteBufferPrototype.writeCString = function(str, offset) {
39944 var relative = typeof offset === 'undefined';
39945 if (relative) offset = this.offset;
39946 var i,
39947 k = str.length;
39948 if (!this.noAssert) {
39949 if (typeof str !== 'string')
39950 throw TypeError("Illegal str: Not a string");
39951 for (i=0; i<k; ++i) {
39952 if (str.charCodeAt(i) === 0)
39953 throw RangeError("Illegal str: Contains NULL-characters");
39954 }
39955 if (typeof offset !== 'number' || offset % 1 !== 0)
39956 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39957 offset >>>= 0;
39958 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39959 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39960 }
39961 // UTF8 strings do not contain zero bytes in between except for the zero character, so:
39962 k = utfx.calculateUTF16asUTF8(stringSource(str))[1];
39963 offset += k+1;
39964 var capacity12 = this.buffer.byteLength;
39965 if (offset > capacity12)
39966 this.resize((capacity12 *= 2) > offset ? capacity12 : offset);
39967 offset -= k+1;
39968 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
39969 this.view[offset++] = b;
39970 }.bind(this));
39971 this.view[offset++] = 0;
39972 if (relative) {
39973 this.offset = offset;
39974 return this;
39975 }
39976 return k;
39977 };
39978
39979 /**
39980 * Reads a NULL-terminated UTF8 encoded string. For this to work the string read must not contain any NULL characters
39981 * itself.
39982 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39983 * read if omitted.
39984 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
39985 * read and the actual number of bytes read.
39986 * @expose
39987 */
39988 ByteBufferPrototype.readCString = function(offset) {
39989 var relative = typeof offset === 'undefined';
39990 if (relative) offset = this.offset;
39991 if (!this.noAssert) {
39992 if (typeof offset !== 'number' || offset % 1 !== 0)
39993 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39994 offset >>>= 0;
39995 if (offset < 0 || offset + 1 > this.buffer.byteLength)
39996 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
39997 }
39998 var start = offset,
39999 temp;
40000 // UTF8 strings do not contain zero bytes in between except for the zero character itself, so:
40001 var sd, b = -1;
40002 utfx.decodeUTF8toUTF16(function() {
40003 if (b === 0) return null;
40004 if (offset >= this.limit)
40005 throw RangeError("Illegal range: Truncated data, "+offset+" < "+this.limit);
40006 b = this.view[offset++];
40007 return b === 0 ? null : b;
40008 }.bind(this), sd = stringDestination(), true);
40009 if (relative) {
40010 this.offset = offset;
40011 return sd();
40012 } else {
40013 return {
40014 "string": sd(),
40015 "length": offset - start
40016 };
40017 }
40018 };
40019
40020 // types/strings/istring
40021
40022 /**
40023 * Writes a length as uint32 prefixed UTF8 encoded string.
40024 * @param {string} str String to write
40025 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40026 * written if omitted.
40027 * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written
40028 * @expose
40029 * @see ByteBuffer#writeVarint32
40030 */
40031 ByteBufferPrototype.writeIString = function(str, offset) {
40032 var relative = typeof offset === 'undefined';
40033 if (relative) offset = this.offset;
40034 if (!this.noAssert) {
40035 if (typeof str !== 'string')
40036 throw TypeError("Illegal str: Not a string");
40037 if (typeof offset !== 'number' || offset % 1 !== 0)
40038 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40039 offset >>>= 0;
40040 if (offset < 0 || offset + 0 > this.buffer.byteLength)
40041 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
40042 }
40043 var start = offset,
40044 k;
40045 k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1];
40046 offset += 4+k;
40047 var capacity13 = this.buffer.byteLength;
40048 if (offset > capacity13)
40049 this.resize((capacity13 *= 2) > offset ? capacity13 : offset);
40050 offset -= 4+k;
40051 if (this.littleEndian) {
40052 this.view[offset+3] = (k >>> 24) & 0xFF;
40053 this.view[offset+2] = (k >>> 16) & 0xFF;
40054 this.view[offset+1] = (k >>> 8) & 0xFF;
40055 this.view[offset ] = k & 0xFF;
40056 } else {
40057 this.view[offset ] = (k >>> 24) & 0xFF;
40058 this.view[offset+1] = (k >>> 16) & 0xFF;
40059 this.view[offset+2] = (k >>> 8) & 0xFF;
40060 this.view[offset+3] = k & 0xFF;
40061 }
40062 offset += 4;
40063 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
40064 this.view[offset++] = b;
40065 }.bind(this));
40066 if (offset !== start + 4 + k)
40067 throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+4+k));
40068 if (relative) {
40069 this.offset = offset;
40070 return this;
40071 }
40072 return offset - start;
40073 };
40074
40075 /**
40076 * Reads a length as uint32 prefixed UTF8 encoded string.
40077 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40078 * read if omitted.
40079 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
40080 * read and the actual number of bytes read.
40081 * @expose
40082 * @see ByteBuffer#readVarint32
40083 */
40084 ByteBufferPrototype.readIString = function(offset) {
40085 var relative = typeof offset === 'undefined';
40086 if (relative) offset = this.offset;
40087 if (!this.noAssert) {
40088 if (typeof offset !== 'number' || offset % 1 !== 0)
40089 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40090 offset >>>= 0;
40091 if (offset < 0 || offset + 4 > this.buffer.byteLength)
40092 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
40093 }
40094 var start = offset;
40095 var len = this.readUint32(offset);
40096 var str = this.readUTF8String(len, ByteBuffer.METRICS_BYTES, offset += 4);
40097 offset += str['length'];
40098 if (relative) {
40099 this.offset = offset;
40100 return str['string'];
40101 } else {
40102 return {
40103 'string': str['string'],
40104 'length': offset - start
40105 };
40106 }
40107 };
40108
40109 // types/strings/utf8string
40110
40111 /**
40112 * Metrics representing number of UTF8 characters. Evaluates to `c`.
40113 * @type {string}
40114 * @const
40115 * @expose
40116 */
40117 ByteBuffer.METRICS_CHARS = 'c';
40118
40119 /**
40120 * Metrics representing number of bytes. Evaluates to `b`.
40121 * @type {string}
40122 * @const
40123 * @expose
40124 */
40125 ByteBuffer.METRICS_BYTES = 'b';
40126
40127 /**
40128 * Writes an UTF8 encoded string.
40129 * @param {string} str String to write
40130 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted.
40131 * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written.
40132 * @expose
40133 */
40134 ByteBufferPrototype.writeUTF8String = function(str, offset) {
40135 var relative = typeof offset === 'undefined';
40136 if (relative) offset = this.offset;
40137 if (!this.noAssert) {
40138 if (typeof offset !== 'number' || offset % 1 !== 0)
40139 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40140 offset >>>= 0;
40141 if (offset < 0 || offset + 0 > this.buffer.byteLength)
40142 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
40143 }
40144 var k;
40145 var start = offset;
40146 k = utfx.calculateUTF16asUTF8(stringSource(str))[1];
40147 offset += k;
40148 var capacity14 = this.buffer.byteLength;
40149 if (offset > capacity14)
40150 this.resize((capacity14 *= 2) > offset ? capacity14 : offset);
40151 offset -= k;
40152 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
40153 this.view[offset++] = b;
40154 }.bind(this));
40155 if (relative) {
40156 this.offset = offset;
40157 return this;
40158 }
40159 return offset - start;
40160 };
40161
40162 /**
40163 * Writes an UTF8 encoded string. This is an alias of {@link ByteBuffer#writeUTF8String}.
40164 * @function
40165 * @param {string} str String to write
40166 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted.
40167 * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written.
40168 * @expose
40169 */
40170 ByteBufferPrototype.writeString = ByteBufferPrototype.writeUTF8String;
40171
40172 /**
40173 * Calculates the number of UTF8 characters of a string. JavaScript itself uses UTF-16, so that a string's
40174 * `length` property does not reflect its actual UTF8 size if it contains code points larger than 0xFFFF.
40175 * @param {string} str String to calculate
40176 * @returns {number} Number of UTF8 characters
40177 * @expose
40178 */
40179 ByteBuffer.calculateUTF8Chars = function(str) {
40180 return utfx.calculateUTF16asUTF8(stringSource(str))[0];
40181 };
40182
40183 /**
40184 * Calculates the number of UTF8 bytes of a string.
40185 * @param {string} str String to calculate
40186 * @returns {number} Number of UTF8 bytes
40187 * @expose
40188 */
40189 ByteBuffer.calculateUTF8Bytes = function(str) {
40190 return utfx.calculateUTF16asUTF8(stringSource(str))[1];
40191 };
40192
40193 /**
40194 * Calculates the number of UTF8 bytes of a string. This is an alias of {@link ByteBuffer.calculateUTF8Bytes}.
40195 * @function
40196 * @param {string} str String to calculate
40197 * @returns {number} Number of UTF8 bytes
40198 * @expose
40199 */
40200 ByteBuffer.calculateString = ByteBuffer.calculateUTF8Bytes;
40201
40202 /**
40203 * Reads an UTF8 encoded string.
40204 * @param {number} length Number of characters or bytes to read.
40205 * @param {string=} metrics Metrics specifying what `length` is meant to count. Defaults to
40206 * {@link ByteBuffer.METRICS_CHARS}.
40207 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40208 * read if omitted.
40209 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
40210 * read and the actual number of bytes read.
40211 * @expose
40212 */
40213 ByteBufferPrototype.readUTF8String = function(length, metrics, offset) {
40214 if (typeof metrics === 'number') {
40215 offset = metrics;
40216 metrics = undefined;
40217 }
40218 var relative = typeof offset === 'undefined';
40219 if (relative) offset = this.offset;
40220 if (typeof metrics === 'undefined') metrics = ByteBuffer.METRICS_CHARS;
40221 if (!this.noAssert) {
40222 if (typeof length !== 'number' || length % 1 !== 0)
40223 throw TypeError("Illegal length: "+length+" (not an integer)");
40224 length |= 0;
40225 if (typeof offset !== 'number' || offset % 1 !== 0)
40226 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40227 offset >>>= 0;
40228 if (offset < 0 || offset + 0 > this.buffer.byteLength)
40229 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
40230 }
40231 var i = 0,
40232 start = offset,
40233 sd;
40234 if (metrics === ByteBuffer.METRICS_CHARS) { // The same for node and the browser
40235 sd = stringDestination();
40236 utfx.decodeUTF8(function() {
40237 return i < length && offset < this.limit ? this.view[offset++] : null;
40238 }.bind(this), function(cp) {
40239 ++i; utfx.UTF8toUTF16(cp, sd);
40240 });
40241 if (i !== length)
40242 throw RangeError("Illegal range: Truncated data, "+i+" == "+length);
40243 if (relative) {
40244 this.offset = offset;
40245 return sd();
40246 } else {
40247 return {
40248 "string": sd(),
40249 "length": offset - start
40250 };
40251 }
40252 } else if (metrics === ByteBuffer.METRICS_BYTES) {
40253 if (!this.noAssert) {
40254 if (typeof offset !== 'number' || offset % 1 !== 0)
40255 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40256 offset >>>= 0;
40257 if (offset < 0 || offset + length > this.buffer.byteLength)
40258 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength);
40259 }
40260 var k = offset + length;
40261 utfx.decodeUTF8toUTF16(function() {
40262 return offset < k ? this.view[offset++] : null;
40263 }.bind(this), sd = stringDestination(), this.noAssert);
40264 if (offset !== k)
40265 throw RangeError("Illegal range: Truncated data, "+offset+" == "+k);
40266 if (relative) {
40267 this.offset = offset;
40268 return sd();
40269 } else {
40270 return {
40271 'string': sd(),
40272 'length': offset - start
40273 };
40274 }
40275 } else
40276 throw TypeError("Unsupported metrics: "+metrics);
40277 };
40278
40279 /**
40280 * Reads an UTF8 encoded string. This is an alias of {@link ByteBuffer#readUTF8String}.
40281 * @function
40282 * @param {number} length Number of characters or bytes to read
40283 * @param {number=} metrics Metrics specifying what `n` is meant to count. Defaults to
40284 * {@link ByteBuffer.METRICS_CHARS}.
40285 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40286 * read if omitted.
40287 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
40288 * read and the actual number of bytes read.
40289 * @expose
40290 */
40291 ByteBufferPrototype.readString = ByteBufferPrototype.readUTF8String;
40292
40293 // types/strings/vstring
40294
40295 /**
40296 * Writes a length as varint32 prefixed UTF8 encoded string.
40297 * @param {string} str String to write
40298 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40299 * written if omitted.
40300 * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written
40301 * @expose
40302 * @see ByteBuffer#writeVarint32
40303 */
40304 ByteBufferPrototype.writeVString = function(str, offset) {
40305 var relative = typeof offset === 'undefined';
40306 if (relative) offset = this.offset;
40307 if (!this.noAssert) {
40308 if (typeof str !== 'string')
40309 throw TypeError("Illegal str: Not a string");
40310 if (typeof offset !== 'number' || offset % 1 !== 0)
40311 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40312 offset >>>= 0;
40313 if (offset < 0 || offset + 0 > this.buffer.byteLength)
40314 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
40315 }
40316 var start = offset,
40317 k, l;
40318 k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1];
40319 l = ByteBuffer.calculateVarint32(k);
40320 offset += l+k;
40321 var capacity15 = this.buffer.byteLength;
40322 if (offset > capacity15)
40323 this.resize((capacity15 *= 2) > offset ? capacity15 : offset);
40324 offset -= l+k;
40325 offset += this.writeVarint32(k, offset);
40326 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
40327 this.view[offset++] = b;
40328 }.bind(this));
40329 if (offset !== start+k+l)
40330 throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+k+l));
40331 if (relative) {
40332 this.offset = offset;
40333 return this;
40334 }
40335 return offset - start;
40336 };
40337
40338 /**
40339 * Reads a length as varint32 prefixed UTF8 encoded string.
40340 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40341 * read if omitted.
40342 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
40343 * read and the actual number of bytes read.
40344 * @expose
40345 * @see ByteBuffer#readVarint32
40346 */
40347 ByteBufferPrototype.readVString = function(offset) {
40348 var relative = typeof offset === 'undefined';
40349 if (relative) offset = this.offset;
40350 if (!this.noAssert) {
40351 if (typeof offset !== 'number' || offset % 1 !== 0)
40352 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40353 offset >>>= 0;
40354 if (offset < 0 || offset + 1 > this.buffer.byteLength)
40355 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
40356 }
40357 var start = offset;
40358 var len = this.readVarint32(offset);
40359 var str = this.readUTF8String(len['value'], ByteBuffer.METRICS_BYTES, offset += len['length']);
40360 offset += str['length'];
40361 if (relative) {
40362 this.offset = offset;
40363 return str['string'];
40364 } else {
40365 return {
40366 'string': str['string'],
40367 'length': offset - start
40368 };
40369 }
40370 };
40371
40372
40373 /**
40374 * Appends some data to this ByteBuffer. This will overwrite any contents behind the specified offset up to the appended
40375 * data's length.
40376 * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to append. If `source` is a ByteBuffer, its offsets
40377 * will be modified according to the performed read operation.
40378 * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
40379 * @param {number=} offset Offset to append at. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40380 * written if omitted.
40381 * @returns {!ByteBuffer} this
40382 * @expose
40383 * @example A relative `<01 02>03.append(<04 05>)` will result in `<01 02 04 05>, 04 05|`
40384 * @example An absolute `<01 02>03.append(04 05>, 1)` will result in `<01 04>05, 04 05|`
40385 */
40386 ByteBufferPrototype.append = function(source, encoding, offset) {
40387 if (typeof encoding === 'number' || typeof encoding !== 'string') {
40388 offset = encoding;
40389 encoding = undefined;
40390 }
40391 var relative = typeof offset === 'undefined';
40392 if (relative) offset = this.offset;
40393 if (!this.noAssert) {
40394 if (typeof offset !== 'number' || offset % 1 !== 0)
40395 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40396 offset >>>= 0;
40397 if (offset < 0 || offset + 0 > this.buffer.byteLength)
40398 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
40399 }
40400 if (!(source instanceof ByteBuffer))
40401 source = ByteBuffer.wrap(source, encoding);
40402 var length = source.limit - source.offset;
40403 if (length <= 0) return this; // Nothing to append
40404 offset += length;
40405 var capacity16 = this.buffer.byteLength;
40406 if (offset > capacity16)
40407 this.resize((capacity16 *= 2) > offset ? capacity16 : offset);
40408 offset -= length;
40409 this.view.set(source.view.subarray(source.offset, source.limit), offset);
40410 source.offset += length;
40411 if (relative) this.offset += length;
40412 return this;
40413 };
40414
40415 /**
40416 * Appends this ByteBuffer's contents to another ByteBuffer. This will overwrite any contents at and after the
40417 specified offset up to the length of this ByteBuffer's data.
40418 * @param {!ByteBuffer} target Target ByteBuffer
40419 * @param {number=} offset Offset to append to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40420 * read if omitted.
40421 * @returns {!ByteBuffer} this
40422 * @expose
40423 * @see ByteBuffer#append
40424 */
40425 ByteBufferPrototype.appendTo = function(target, offset) {
40426 target.append(this, offset);
40427 return this;
40428 };
40429
40430 /**
40431 * Enables or disables assertions of argument types and offsets. Assertions are enabled by default but you can opt to
40432 * disable them if your code already makes sure that everything is valid.
40433 * @param {boolean} assert `true` to enable assertions, otherwise `false`
40434 * @returns {!ByteBuffer} this
40435 * @expose
40436 */
40437 ByteBufferPrototype.assert = function(assert) {
40438 this.noAssert = !assert;
40439 return this;
40440 };
40441
40442 /**
40443 * Gets the capacity of this ByteBuffer's backing buffer.
40444 * @returns {number} Capacity of the backing buffer
40445 * @expose
40446 */
40447 ByteBufferPrototype.capacity = function() {
40448 return this.buffer.byteLength;
40449 };
40450 /**
40451 * Clears this ByteBuffer's offsets by setting {@link ByteBuffer#offset} to `0` and {@link ByteBuffer#limit} to the
40452 * backing buffer's capacity. Discards {@link ByteBuffer#markedOffset}.
40453 * @returns {!ByteBuffer} this
40454 * @expose
40455 */
40456 ByteBufferPrototype.clear = function() {
40457 this.offset = 0;
40458 this.limit = this.buffer.byteLength;
40459 this.markedOffset = -1;
40460 return this;
40461 };
40462
40463 /**
40464 * Creates a cloned instance of this ByteBuffer, preset with this ByteBuffer's values for {@link ByteBuffer#offset},
40465 * {@link ByteBuffer#markedOffset} and {@link ByteBuffer#limit}.
40466 * @param {boolean=} copy Whether to copy the backing buffer or to return another view on the same, defaults to `false`
40467 * @returns {!ByteBuffer} Cloned instance
40468 * @expose
40469 */
40470 ByteBufferPrototype.clone = function(copy) {
40471 var bb = new ByteBuffer(0, this.littleEndian, this.noAssert);
40472 if (copy) {
40473 bb.buffer = new ArrayBuffer(this.buffer.byteLength);
40474 bb.view = new Uint8Array(bb.buffer);
40475 } else {
40476 bb.buffer = this.buffer;
40477 bb.view = this.view;
40478 }
40479 bb.offset = this.offset;
40480 bb.markedOffset = this.markedOffset;
40481 bb.limit = this.limit;
40482 return bb;
40483 };
40484
40485 /**
40486 * Compacts this ByteBuffer to be backed by a {@link ByteBuffer#buffer} of its contents' length. Contents are the bytes
40487 * between {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. Will set `offset = 0` and `limit = capacity` and
40488 * adapt {@link ByteBuffer#markedOffset} to the same relative position if set.
40489 * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
40490 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
40491 * @returns {!ByteBuffer} this
40492 * @expose
40493 */
40494 ByteBufferPrototype.compact = function(begin, end) {
40495 if (typeof begin === 'undefined') begin = this.offset;
40496 if (typeof end === 'undefined') end = this.limit;
40497 if (!this.noAssert) {
40498 if (typeof begin !== 'number' || begin % 1 !== 0)
40499 throw TypeError("Illegal begin: Not an integer");
40500 begin >>>= 0;
40501 if (typeof end !== 'number' || end % 1 !== 0)
40502 throw TypeError("Illegal end: Not an integer");
40503 end >>>= 0;
40504 if (begin < 0 || begin > end || end > this.buffer.byteLength)
40505 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
40506 }
40507 if (begin === 0 && end === this.buffer.byteLength)
40508 return this; // Already compacted
40509 var len = end - begin;
40510 if (len === 0) {
40511 this.buffer = EMPTY_BUFFER;
40512 this.view = null;
40513 if (this.markedOffset >= 0) this.markedOffset -= begin;
40514 this.offset = 0;
40515 this.limit = 0;
40516 return this;
40517 }
40518 var buffer = new ArrayBuffer(len);
40519 var view = new Uint8Array(buffer);
40520 view.set(this.view.subarray(begin, end));
40521 this.buffer = buffer;
40522 this.view = view;
40523 if (this.markedOffset >= 0) this.markedOffset -= begin;
40524 this.offset = 0;
40525 this.limit = len;
40526 return this;
40527 };
40528
40529 /**
40530 * Creates a copy of this ByteBuffer's contents. Contents are the bytes between {@link ByteBuffer#offset} and
40531 * {@link ByteBuffer#limit}.
40532 * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
40533 * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
40534 * @returns {!ByteBuffer} Copy
40535 * @expose
40536 */
40537 ByteBufferPrototype.copy = function(begin, end) {
40538 if (typeof begin === 'undefined') begin = this.offset;
40539 if (typeof end === 'undefined') end = this.limit;
40540 if (!this.noAssert) {
40541 if (typeof begin !== 'number' || begin % 1 !== 0)
40542 throw TypeError("Illegal begin: Not an integer");
40543 begin >>>= 0;
40544 if (typeof end !== 'number' || end % 1 !== 0)
40545 throw TypeError("Illegal end: Not an integer");
40546 end >>>= 0;
40547 if (begin < 0 || begin > end || end > this.buffer.byteLength)
40548 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
40549 }
40550 if (begin === end)
40551 return new ByteBuffer(0, this.littleEndian, this.noAssert);
40552 var capacity = end - begin,
40553 bb = new ByteBuffer(capacity, this.littleEndian, this.noAssert);
40554 bb.offset = 0;
40555 bb.limit = capacity;
40556 if (bb.markedOffset >= 0) bb.markedOffset -= begin;
40557 this.copyTo(bb, 0, begin, end);
40558 return bb;
40559 };
40560
40561 /**
40562 * Copies this ByteBuffer's contents to another ByteBuffer. Contents are the bytes between {@link ByteBuffer#offset} and
40563 * {@link ByteBuffer#limit}.
40564 * @param {!ByteBuffer} target Target ByteBuffer
40565 * @param {number=} targetOffset Offset to copy to. Will use and increase the target's {@link ByteBuffer#offset}
40566 * by the number of bytes copied if omitted.
40567 * @param {number=} sourceOffset Offset to start copying from. Will use and increase {@link ByteBuffer#offset} by the
40568 * number of bytes copied if omitted.
40569 * @param {number=} sourceLimit Offset to end copying from, defaults to {@link ByteBuffer#limit}
40570 * @returns {!ByteBuffer} this
40571 * @expose
40572 */
40573 ByteBufferPrototype.copyTo = function(target, targetOffset, sourceOffset, sourceLimit) {
40574 var relative,
40575 targetRelative;
40576 if (!this.noAssert) {
40577 if (!ByteBuffer.isByteBuffer(target))
40578 throw TypeError("Illegal target: Not a ByteBuffer");
40579 }
40580 targetOffset = (targetRelative = typeof targetOffset === 'undefined') ? target.offset : targetOffset | 0;
40581 sourceOffset = (relative = typeof sourceOffset === 'undefined') ? this.offset : sourceOffset | 0;
40582 sourceLimit = typeof sourceLimit === 'undefined' ? this.limit : sourceLimit | 0;
40583
40584 if (targetOffset < 0 || targetOffset > target.buffer.byteLength)
40585 throw RangeError("Illegal target range: 0 <= "+targetOffset+" <= "+target.buffer.byteLength);
40586 if (sourceOffset < 0 || sourceLimit > this.buffer.byteLength)
40587 throw RangeError("Illegal source range: 0 <= "+sourceOffset+" <= "+this.buffer.byteLength);
40588
40589 var len = sourceLimit - sourceOffset;
40590 if (len === 0)
40591 return target; // Nothing to copy
40592
40593 target.ensureCapacity(targetOffset + len);
40594
40595 target.view.set(this.view.subarray(sourceOffset, sourceLimit), targetOffset);
40596
40597 if (relative) this.offset += len;
40598 if (targetRelative) target.offset += len;
40599
40600 return this;
40601 };
40602
40603 /**
40604 * Makes sure that this ByteBuffer is backed by a {@link ByteBuffer#buffer} of at least the specified capacity. If the
40605 * current capacity is exceeded, it will be doubled. If double the current capacity is less than the required capacity,
40606 * the required capacity will be used instead.
40607 * @param {number} capacity Required capacity
40608 * @returns {!ByteBuffer} this
40609 * @expose
40610 */
40611 ByteBufferPrototype.ensureCapacity = function(capacity) {
40612 var current = this.buffer.byteLength;
40613 if (current < capacity)
40614 return this.resize((current *= 2) > capacity ? current : capacity);
40615 return this;
40616 };
40617
40618 /**
40619 * Overwrites this ByteBuffer's contents with the specified value. Contents are the bytes between
40620 * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
40621 * @param {number|string} value Byte value to fill with. If given as a string, the first character is used.
40622 * @param {number=} begin Begin offset. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40623 * written if omitted. defaults to {@link ByteBuffer#offset}.
40624 * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
40625 * @returns {!ByteBuffer} this
40626 * @expose
40627 * @example `someByteBuffer.clear().fill(0)` fills the entire backing buffer with zeroes
40628 */
40629 ByteBufferPrototype.fill = function(value, begin, end) {
40630 var relative = typeof begin === 'undefined';
40631 if (relative) begin = this.offset;
40632 if (typeof value === 'string' && value.length > 0)
40633 value = value.charCodeAt(0);
40634 if (typeof begin === 'undefined') begin = this.offset;
40635 if (typeof end === 'undefined') end = this.limit;
40636 if (!this.noAssert) {
40637 if (typeof value !== 'number' || value % 1 !== 0)
40638 throw TypeError("Illegal value: "+value+" (not an integer)");
40639 value |= 0;
40640 if (typeof begin !== 'number' || begin % 1 !== 0)
40641 throw TypeError("Illegal begin: Not an integer");
40642 begin >>>= 0;
40643 if (typeof end !== 'number' || end % 1 !== 0)
40644 throw TypeError("Illegal end: Not an integer");
40645 end >>>= 0;
40646 if (begin < 0 || begin > end || end > this.buffer.byteLength)
40647 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
40648 }
40649 if (begin >= end)
40650 return this; // Nothing to fill
40651 while (begin < end) this.view[begin++] = value;
40652 if (relative) this.offset = begin;
40653 return this;
40654 };
40655
40656 /**
40657 * Makes this ByteBuffer ready for a new sequence of write or relative read operations. Sets `limit = offset` and
40658 * `offset = 0`. Make sure always to flip a ByteBuffer when all relative read or write operations are complete.
40659 * @returns {!ByteBuffer} this
40660 * @expose
40661 */
40662 ByteBufferPrototype.flip = function() {
40663 this.limit = this.offset;
40664 this.offset = 0;
40665 return this;
40666 };
40667 /**
40668 * Marks an offset on this ByteBuffer to be used later.
40669 * @param {number=} offset Offset to mark. Defaults to {@link ByteBuffer#offset}.
40670 * @returns {!ByteBuffer} this
40671 * @throws {TypeError} If `offset` is not a valid number
40672 * @throws {RangeError} If `offset` is out of bounds
40673 * @see ByteBuffer#reset
40674 * @expose
40675 */
40676 ByteBufferPrototype.mark = function(offset) {
40677 offset = typeof offset === 'undefined' ? this.offset : offset;
40678 if (!this.noAssert) {
40679 if (typeof offset !== 'number' || offset % 1 !== 0)
40680 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40681 offset >>>= 0;
40682 if (offset < 0 || offset + 0 > this.buffer.byteLength)
40683 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
40684 }
40685 this.markedOffset = offset;
40686 return this;
40687 };
40688 /**
40689 * Sets the byte order.
40690 * @param {boolean} littleEndian `true` for little endian byte order, `false` for big endian
40691 * @returns {!ByteBuffer} this
40692 * @expose
40693 */
40694 ByteBufferPrototype.order = function(littleEndian) {
40695 if (!this.noAssert) {
40696 if (typeof littleEndian !== 'boolean')
40697 throw TypeError("Illegal littleEndian: Not a boolean");
40698 }
40699 this.littleEndian = !!littleEndian;
40700 return this;
40701 };
40702
40703 /**
40704 * Switches (to) little endian byte order.
40705 * @param {boolean=} littleEndian Defaults to `true`, otherwise uses big endian
40706 * @returns {!ByteBuffer} this
40707 * @expose
40708 */
40709 ByteBufferPrototype.LE = function(littleEndian) {
40710 this.littleEndian = typeof littleEndian !== 'undefined' ? !!littleEndian : true;
40711 return this;
40712 };
40713
40714 /**
40715 * Switches (to) big endian byte order.
40716 * @param {boolean=} bigEndian Defaults to `true`, otherwise uses little endian
40717 * @returns {!ByteBuffer} this
40718 * @expose
40719 */
40720 ByteBufferPrototype.BE = function(bigEndian) {
40721 this.littleEndian = typeof bigEndian !== 'undefined' ? !bigEndian : false;
40722 return this;
40723 };
40724 /**
40725 * Prepends some data to this ByteBuffer. This will overwrite any contents before the specified offset up to the
40726 * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
40727 * will be resized and its contents moved accordingly.
40728 * @param {!ByteBuffer|string|!ArrayBuffer} source Data to prepend. If `source` is a ByteBuffer, its offset will be
40729 * modified according to the performed read operation.
40730 * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
40731 * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
40732 * prepended if omitted.
40733 * @returns {!ByteBuffer} this
40734 * @expose
40735 * @example A relative `00<01 02 03>.prepend(<04 05>)` results in `<04 05 01 02 03>, 04 05|`
40736 * @example An absolute `00<01 02 03>.prepend(<04 05>, 2)` results in `04<05 02 03>, 04 05|`
40737 */
40738 ByteBufferPrototype.prepend = function(source, encoding, offset) {
40739 if (typeof encoding === 'number' || typeof encoding !== 'string') {
40740 offset = encoding;
40741 encoding = undefined;
40742 }
40743 var relative = typeof offset === 'undefined';
40744 if (relative) offset = this.offset;
40745 if (!this.noAssert) {
40746 if (typeof offset !== 'number' || offset % 1 !== 0)
40747 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40748 offset >>>= 0;
40749 if (offset < 0 || offset + 0 > this.buffer.byteLength)
40750 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
40751 }
40752 if (!(source instanceof ByteBuffer))
40753 source = ByteBuffer.wrap(source, encoding);
40754 var len = source.limit - source.offset;
40755 if (len <= 0) return this; // Nothing to prepend
40756 var diff = len - offset;
40757 if (diff > 0) { // Not enough space before offset, so resize + move
40758 var buffer = new ArrayBuffer(this.buffer.byteLength + diff);
40759 var view = new Uint8Array(buffer);
40760 view.set(this.view.subarray(offset, this.buffer.byteLength), len);
40761 this.buffer = buffer;
40762 this.view = view;
40763 this.offset += diff;
40764 if (this.markedOffset >= 0) this.markedOffset += diff;
40765 this.limit += diff;
40766 offset += diff;
40767 } else {
40768 var arrayView = new Uint8Array(this.buffer);
40769 }
40770 this.view.set(source.view.subarray(source.offset, source.limit), offset - len);
40771
40772 source.offset = source.limit;
40773 if (relative)
40774 this.offset -= len;
40775 return this;
40776 };
40777
40778 /**
40779 * Prepends this ByteBuffer to another ByteBuffer. This will overwrite any contents before the specified offset up to the
40780 * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
40781 * will be resized and its contents moved accordingly.
40782 * @param {!ByteBuffer} target Target ByteBuffer
40783 * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
40784 * prepended if omitted.
40785 * @returns {!ByteBuffer} this
40786 * @expose
40787 * @see ByteBuffer#prepend
40788 */
40789 ByteBufferPrototype.prependTo = function(target, offset) {
40790 target.prepend(this, offset);
40791 return this;
40792 };
40793 /**
40794 * Prints debug information about this ByteBuffer's contents.
40795 * @param {function(string)=} out Output function to call, defaults to console.log
40796 * @expose
40797 */
40798 ByteBufferPrototype.printDebug = function(out) {
40799 if (typeof out !== 'function') out = console.log.bind(console);
40800 out(
40801 this.toString()+"\n"+
40802 "-------------------------------------------------------------------\n"+
40803 this.toDebug(/* columns */ true)
40804 );
40805 };
40806
40807 /**
40808 * Gets the number of remaining readable bytes. Contents are the bytes between {@link ByteBuffer#offset} and
40809 * {@link ByteBuffer#limit}, so this returns `limit - offset`.
40810 * @returns {number} Remaining readable bytes. May be negative if `offset > limit`.
40811 * @expose
40812 */
40813 ByteBufferPrototype.remaining = function() {
40814 return this.limit - this.offset;
40815 };
40816 /**
40817 * Resets this ByteBuffer's {@link ByteBuffer#offset}. If an offset has been marked through {@link ByteBuffer#mark}
40818 * before, `offset` will be set to {@link ByteBuffer#markedOffset}, which will then be discarded. If no offset has been
40819 * marked, sets `offset = 0`.
40820 * @returns {!ByteBuffer} this
40821 * @see ByteBuffer#mark
40822 * @expose
40823 */
40824 ByteBufferPrototype.reset = function() {
40825 if (this.markedOffset >= 0) {
40826 this.offset = this.markedOffset;
40827 this.markedOffset = -1;
40828 } else {
40829 this.offset = 0;
40830 }
40831 return this;
40832 };
40833 /**
40834 * Resizes this ByteBuffer to be backed by a buffer of at least the given capacity. Will do nothing if already that
40835 * large or larger.
40836 * @param {number} capacity Capacity required
40837 * @returns {!ByteBuffer} this
40838 * @throws {TypeError} If `capacity` is not a number
40839 * @throws {RangeError} If `capacity < 0`
40840 * @expose
40841 */
40842 ByteBufferPrototype.resize = function(capacity) {
40843 if (!this.noAssert) {
40844 if (typeof capacity !== 'number' || capacity % 1 !== 0)
40845 throw TypeError("Illegal capacity: "+capacity+" (not an integer)");
40846 capacity |= 0;
40847 if (capacity < 0)
40848 throw RangeError("Illegal capacity: 0 <= "+capacity);
40849 }
40850 if (this.buffer.byteLength < capacity) {
40851 var buffer = new ArrayBuffer(capacity);
40852 var view = new Uint8Array(buffer);
40853 view.set(this.view);
40854 this.buffer = buffer;
40855 this.view = view;
40856 }
40857 return this;
40858 };
40859 /**
40860 * Reverses this ByteBuffer's contents.
40861 * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
40862 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
40863 * @returns {!ByteBuffer} this
40864 * @expose
40865 */
40866 ByteBufferPrototype.reverse = function(begin, end) {
40867 if (typeof begin === 'undefined') begin = this.offset;
40868 if (typeof end === 'undefined') end = this.limit;
40869 if (!this.noAssert) {
40870 if (typeof begin !== 'number' || begin % 1 !== 0)
40871 throw TypeError("Illegal begin: Not an integer");
40872 begin >>>= 0;
40873 if (typeof end !== 'number' || end % 1 !== 0)
40874 throw TypeError("Illegal end: Not an integer");
40875 end >>>= 0;
40876 if (begin < 0 || begin > end || end > this.buffer.byteLength)
40877 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
40878 }
40879 if (begin === end)
40880 return this; // Nothing to reverse
40881 Array.prototype.reverse.call(this.view.subarray(begin, end));
40882 return this;
40883 };
40884 /**
40885 * Skips the next `length` bytes. This will just advance
40886 * @param {number} length Number of bytes to skip. May also be negative to move the offset back.
40887 * @returns {!ByteBuffer} this
40888 * @expose
40889 */
40890 ByteBufferPrototype.skip = function(length) {
40891 if (!this.noAssert) {
40892 if (typeof length !== 'number' || length % 1 !== 0)
40893 throw TypeError("Illegal length: "+length+" (not an integer)");
40894 length |= 0;
40895 }
40896 var offset = this.offset + length;
40897 if (!this.noAssert) {
40898 if (offset < 0 || offset > this.buffer.byteLength)
40899 throw RangeError("Illegal length: 0 <= "+this.offset+" + "+length+" <= "+this.buffer.byteLength);
40900 }
40901 this.offset = offset;
40902 return this;
40903 };
40904
40905 /**
40906 * Slices this ByteBuffer by creating a cloned instance with `offset = begin` and `limit = end`.
40907 * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
40908 * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
40909 * @returns {!ByteBuffer} Clone of this ByteBuffer with slicing applied, backed by the same {@link ByteBuffer#buffer}
40910 * @expose
40911 */
40912 ByteBufferPrototype.slice = function(begin, end) {
40913 if (typeof begin === 'undefined') begin = this.offset;
40914 if (typeof end === 'undefined') end = this.limit;
40915 if (!this.noAssert) {
40916 if (typeof begin !== 'number' || begin % 1 !== 0)
40917 throw TypeError("Illegal begin: Not an integer");
40918 begin >>>= 0;
40919 if (typeof end !== 'number' || end % 1 !== 0)
40920 throw TypeError("Illegal end: Not an integer");
40921 end >>>= 0;
40922 if (begin < 0 || begin > end || end > this.buffer.byteLength)
40923 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
40924 }
40925 var bb = this.clone();
40926 bb.offset = begin;
40927 bb.limit = end;
40928 return bb;
40929 };
40930 /**
40931 * Returns a copy of the backing buffer that contains this ByteBuffer's contents. Contents are the bytes between
40932 * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
40933 * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory if
40934 * possible. Defaults to `false`
40935 * @returns {!ArrayBuffer} Contents as an ArrayBuffer
40936 * @expose
40937 */
40938 ByteBufferPrototype.toBuffer = function(forceCopy) {
40939 var offset = this.offset,
40940 limit = this.limit;
40941 if (!this.noAssert) {
40942 if (typeof offset !== 'number' || offset % 1 !== 0)
40943 throw TypeError("Illegal offset: Not an integer");
40944 offset >>>= 0;
40945 if (typeof limit !== 'number' || limit % 1 !== 0)
40946 throw TypeError("Illegal limit: Not an integer");
40947 limit >>>= 0;
40948 if (offset < 0 || offset > limit || limit > this.buffer.byteLength)
40949 throw RangeError("Illegal range: 0 <= "+offset+" <= "+limit+" <= "+this.buffer.byteLength);
40950 }
40951 // NOTE: It's not possible to have another ArrayBuffer reference the same memory as the backing buffer. This is
40952 // possible with Uint8Array#subarray only, but we have to return an ArrayBuffer by contract. So:
40953 if (!forceCopy && offset === 0 && limit === this.buffer.byteLength)
40954 return this.buffer;
40955 if (offset === limit)
40956 return EMPTY_BUFFER;
40957 var buffer = new ArrayBuffer(limit - offset);
40958 new Uint8Array(buffer).set(new Uint8Array(this.buffer).subarray(offset, limit), 0);
40959 return buffer;
40960 };
40961
40962 /**
40963 * Returns a raw buffer compacted to contain this ByteBuffer's contents. Contents are the bytes between
40964 * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. This is an alias of {@link ByteBuffer#toBuffer}.
40965 * @function
40966 * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory.
40967 * Defaults to `false`
40968 * @returns {!ArrayBuffer} Contents as an ArrayBuffer
40969 * @expose
40970 */
40971 ByteBufferPrototype.toArrayBuffer = ByteBufferPrototype.toBuffer;
40972
40973 /**
40974 * Converts the ByteBuffer's contents to a string.
40975 * @param {string=} encoding Output encoding. Returns an informative string representation if omitted but also allows
40976 * direct conversion to "utf8", "hex", "base64" and "binary" encoding. "debug" returns a hex representation with
40977 * highlighted offsets.
40978 * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}
40979 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
40980 * @returns {string} String representation
40981 * @throws {Error} If `encoding` is invalid
40982 * @expose
40983 */
40984 ByteBufferPrototype.toString = function(encoding, begin, end) {
40985 if (typeof encoding === 'undefined')
40986 return "ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";
40987 if (typeof encoding === 'number')
40988 encoding = "utf8",
40989 begin = encoding,
40990 end = begin;
40991 switch (encoding) {
40992 case "utf8":
40993 return this.toUTF8(begin, end);
40994 case "base64":
40995 return this.toBase64(begin, end);
40996 case "hex":
40997 return this.toHex(begin, end);
40998 case "binary":
40999 return this.toBinary(begin, end);
41000 case "debug":
41001 return this.toDebug();
41002 case "columns":
41003 return this.toColumns();
41004 default:
41005 throw Error("Unsupported encoding: "+encoding);
41006 }
41007 };
41008
41009 // lxiv-embeddable
41010
41011 /**
41012 * lxiv-embeddable (c) 2014 Daniel Wirtz <dcode@dcode.io>
41013 * Released under the Apache License, Version 2.0
41014 * see: https://github.com/dcodeIO/lxiv for details
41015 */
41016 var lxiv = function() {
41017 "use strict";
41018
41019 /**
41020 * lxiv namespace.
41021 * @type {!Object.<string,*>}
41022 * @exports lxiv
41023 */
41024 var lxiv = {};
41025
41026 /**
41027 * Character codes for output.
41028 * @type {!Array.<number>}
41029 * @inner
41030 */
41031 var aout = [
41032 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
41033 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102,
41034 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
41035 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47
41036 ];
41037
41038 /**
41039 * Character codes for input.
41040 * @type {!Array.<number>}
41041 * @inner
41042 */
41043 var ain = [];
41044 for (var i=0, k=aout.length; i<k; ++i)
41045 ain[aout[i]] = i;
41046
41047 /**
41048 * Encodes bytes to base64 char codes.
41049 * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if
41050 * there are no more bytes left.
41051 * @param {!function(number)} dst Characters destination as a function successively called with each encoded char
41052 * code.
41053 */
41054 lxiv.encode = function(src, dst) {
41055 var b, t;
41056 while ((b = src()) !== null) {
41057 dst(aout[(b>>2)&0x3f]);
41058 t = (b&0x3)<<4;
41059 if ((b = src()) !== null) {
41060 t |= (b>>4)&0xf;
41061 dst(aout[(t|((b>>4)&0xf))&0x3f]);
41062 t = (b&0xf)<<2;
41063 if ((b = src()) !== null)
41064 dst(aout[(t|((b>>6)&0x3))&0x3f]),
41065 dst(aout[b&0x3f]);
41066 else
41067 dst(aout[t&0x3f]),
41068 dst(61);
41069 } else
41070 dst(aout[t&0x3f]),
41071 dst(61),
41072 dst(61);
41073 }
41074 };
41075
41076 /**
41077 * Decodes base64 char codes to bytes.
41078 * @param {!function():number|null} src Characters source as a function returning the next char code respectively
41079 * `null` if there are no more characters left.
41080 * @param {!function(number)} dst Bytes destination as a function successively called with the next byte.
41081 * @throws {Error} If a character code is invalid
41082 */
41083 lxiv.decode = function(src, dst) {
41084 var c, t1, t2;
41085 function fail(c) {
41086 throw Error("Illegal character code: "+c);
41087 }
41088 while ((c = src()) !== null) {
41089 t1 = ain[c];
41090 if (typeof t1 === 'undefined') fail(c);
41091 if ((c = src()) !== null) {
41092 t2 = ain[c];
41093 if (typeof t2 === 'undefined') fail(c);
41094 dst((t1<<2)>>>0|(t2&0x30)>>4);
41095 if ((c = src()) !== null) {
41096 t1 = ain[c];
41097 if (typeof t1 === 'undefined')
41098 if (c === 61) break; else fail(c);
41099 dst(((t2&0xf)<<4)>>>0|(t1&0x3c)>>2);
41100 if ((c = src()) !== null) {
41101 t2 = ain[c];
41102 if (typeof t2 === 'undefined')
41103 if (c === 61) break; else fail(c);
41104 dst(((t1&0x3)<<6)>>>0|t2);
41105 }
41106 }
41107 }
41108 }
41109 };
41110
41111 /**
41112 * Tests if a string is valid base64.
41113 * @param {string} str String to test
41114 * @returns {boolean} `true` if valid, otherwise `false`
41115 */
41116 lxiv.test = function(str) {
41117 return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(str);
41118 };
41119
41120 return lxiv;
41121 }();
41122
41123 // encodings/base64
41124
41125 /**
41126 * Encodes this ByteBuffer's contents to a base64 encoded string.
41127 * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}.
41128 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}.
41129 * @returns {string} Base64 encoded string
41130 * @throws {RangeError} If `begin` or `end` is out of bounds
41131 * @expose
41132 */
41133 ByteBufferPrototype.toBase64 = function(begin, end) {
41134 if (typeof begin === 'undefined')
41135 begin = this.offset;
41136 if (typeof end === 'undefined')
41137 end = this.limit;
41138 begin = begin | 0; end = end | 0;
41139 if (begin < 0 || end > this.capacity || begin > end)
41140 throw RangeError("begin, end");
41141 var sd; lxiv.encode(function() {
41142 return begin < end ? this.view[begin++] : null;
41143 }.bind(this), sd = stringDestination());
41144 return sd();
41145 };
41146
41147 /**
41148 * Decodes a base64 encoded string to a ByteBuffer.
41149 * @param {string} str String to decode
41150 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
41151 * {@link ByteBuffer.DEFAULT_ENDIAN}.
41152 * @returns {!ByteBuffer} ByteBuffer
41153 * @expose
41154 */
41155 ByteBuffer.fromBase64 = function(str, littleEndian) {
41156 if (typeof str !== 'string')
41157 throw TypeError("str");
41158 var bb = new ByteBuffer(str.length/4*3, littleEndian),
41159 i = 0;
41160 lxiv.decode(stringSource(str), function(b) {
41161 bb.view[i++] = b;
41162 });
41163 bb.limit = i;
41164 return bb;
41165 };
41166
41167 /**
41168 * Encodes a binary string to base64 like `window.btoa` does.
41169 * @param {string} str Binary string
41170 * @returns {string} Base64 encoded string
41171 * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.btoa
41172 * @expose
41173 */
41174 ByteBuffer.btoa = function(str) {
41175 return ByteBuffer.fromBinary(str).toBase64();
41176 };
41177
41178 /**
41179 * Decodes a base64 encoded string to binary like `window.atob` does.
41180 * @param {string} b64 Base64 encoded string
41181 * @returns {string} Binary string
41182 * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.atob
41183 * @expose
41184 */
41185 ByteBuffer.atob = function(b64) {
41186 return ByteBuffer.fromBase64(b64).toBinary();
41187 };
41188
41189 // encodings/binary
41190
41191 /**
41192 * Encodes this ByteBuffer to a binary encoded string, that is using only characters 0x00-0xFF as bytes.
41193 * @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
41194 * @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
41195 * @returns {string} Binary encoded string
41196 * @throws {RangeError} If `offset > limit`
41197 * @expose
41198 */
41199 ByteBufferPrototype.toBinary = function(begin, end) {
41200 if (typeof begin === 'undefined')
41201 begin = this.offset;
41202 if (typeof end === 'undefined')
41203 end = this.limit;
41204 begin |= 0; end |= 0;
41205 if (begin < 0 || end > this.capacity() || begin > end)
41206 throw RangeError("begin, end");
41207 if (begin === end)
41208 return "";
41209 var chars = [],
41210 parts = [];
41211 while (begin < end) {
41212 chars.push(this.view[begin++]);
41213 if (chars.length >= 1024)
41214 parts.push(String.fromCharCode.apply(String, chars)),
41215 chars = [];
41216 }
41217 return parts.join('') + String.fromCharCode.apply(String, chars);
41218 };
41219
41220 /**
41221 * Decodes a binary encoded string, that is using only characters 0x00-0xFF as bytes, to a ByteBuffer.
41222 * @param {string} str String to decode
41223 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
41224 * {@link ByteBuffer.DEFAULT_ENDIAN}.
41225 * @returns {!ByteBuffer} ByteBuffer
41226 * @expose
41227 */
41228 ByteBuffer.fromBinary = function(str, littleEndian) {
41229 if (typeof str !== 'string')
41230 throw TypeError("str");
41231 var i = 0,
41232 k = str.length,
41233 charCode,
41234 bb = new ByteBuffer(k, littleEndian);
41235 while (i<k) {
41236 charCode = str.charCodeAt(i);
41237 if (charCode > 0xff)
41238 throw RangeError("illegal char code: "+charCode);
41239 bb.view[i++] = charCode;
41240 }
41241 bb.limit = k;
41242 return bb;
41243 };
41244
41245 // encodings/debug
41246
41247 /**
41248 * Encodes this ByteBuffer to a hex encoded string with marked offsets. Offset symbols are:
41249 * * `<` : offset,
41250 * * `'` : markedOffset,
41251 * * `>` : limit,
41252 * * `|` : offset and limit,
41253 * * `[` : offset and markedOffset,
41254 * * `]` : markedOffset and limit,
41255 * * `!` : offset, markedOffset and limit
41256 * @param {boolean=} columns If `true` returns two columns hex + ascii, defaults to `false`
41257 * @returns {string|!Array.<string>} Debug string or array of lines if `asArray = true`
41258 * @expose
41259 * @example `>00'01 02<03` contains four bytes with `limit=0, markedOffset=1, offset=3`
41260 * @example `00[01 02 03>` contains four bytes with `offset=markedOffset=1, limit=4`
41261 * @example `00|01 02 03` contains four bytes with `offset=limit=1, markedOffset=-1`
41262 * @example `|` contains zero bytes with `offset=limit=0, markedOffset=-1`
41263 */
41264 ByteBufferPrototype.toDebug = function(columns) {
41265 var i = -1,
41266 k = this.buffer.byteLength,
41267 b,
41268 hex = "",
41269 asc = "",
41270 out = "";
41271 while (i<k) {
41272 if (i !== -1) {
41273 b = this.view[i];
41274 if (b < 0x10) hex += "0"+b.toString(16).toUpperCase();
41275 else hex += b.toString(16).toUpperCase();
41276 if (columns)
41277 asc += b > 32 && b < 127 ? String.fromCharCode(b) : '.';
41278 }
41279 ++i;
41280 if (columns) {
41281 if (i > 0 && i % 16 === 0 && i !== k) {
41282 while (hex.length < 3*16+3) hex += " ";
41283 out += hex+asc+"\n";
41284 hex = asc = "";
41285 }
41286 }
41287 if (i === this.offset && i === this.limit)
41288 hex += i === this.markedOffset ? "!" : "|";
41289 else if (i === this.offset)
41290 hex += i === this.markedOffset ? "[" : "<";
41291 else if (i === this.limit)
41292 hex += i === this.markedOffset ? "]" : ">";
41293 else
41294 hex += i === this.markedOffset ? "'" : (columns || (i !== 0 && i !== k) ? " " : "");
41295 }
41296 if (columns && hex !== " ") {
41297 while (hex.length < 3*16+3)
41298 hex += " ";
41299 out += hex + asc + "\n";
41300 }
41301 return columns ? out : hex;
41302 };
41303
41304 /**
41305 * Decodes a hex encoded string with marked offsets to a ByteBuffer.
41306 * @param {string} str Debug string to decode (not be generated with `columns = true`)
41307 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
41308 * {@link ByteBuffer.DEFAULT_ENDIAN}.
41309 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
41310 * {@link ByteBuffer.DEFAULT_NOASSERT}.
41311 * @returns {!ByteBuffer} ByteBuffer
41312 * @expose
41313 * @see ByteBuffer#toDebug
41314 */
41315 ByteBuffer.fromDebug = function(str, littleEndian, noAssert) {
41316 var k = str.length,
41317 bb = new ByteBuffer(((k+1)/3)|0, littleEndian, noAssert);
41318 var i = 0, j = 0, ch, b,
41319 rs = false, // Require symbol next
41320 ho = false, hm = false, hl = false, // Already has offset (ho), markedOffset (hm), limit (hl)?
41321 fail = false;
41322 while (i<k) {
41323 switch (ch = str.charAt(i++)) {
41324 case '!':
41325 if (!noAssert) {
41326 if (ho || hm || hl) {
41327 fail = true;
41328 break;
41329 }
41330 ho = hm = hl = true;
41331 }
41332 bb.offset = bb.markedOffset = bb.limit = j;
41333 rs = false;
41334 break;
41335 case '|':
41336 if (!noAssert) {
41337 if (ho || hl) {
41338 fail = true;
41339 break;
41340 }
41341 ho = hl = true;
41342 }
41343 bb.offset = bb.limit = j;
41344 rs = false;
41345 break;
41346 case '[':
41347 if (!noAssert) {
41348 if (ho || hm) {
41349 fail = true;
41350 break;
41351 }
41352 ho = hm = true;
41353 }
41354 bb.offset = bb.markedOffset = j;
41355 rs = false;
41356 break;
41357 case '<':
41358 if (!noAssert) {
41359 if (ho) {
41360 fail = true;
41361 break;
41362 }
41363 ho = true;
41364 }
41365 bb.offset = j;
41366 rs = false;
41367 break;
41368 case ']':
41369 if (!noAssert) {
41370 if (hl || hm) {
41371 fail = true;
41372 break;
41373 }
41374 hl = hm = true;
41375 }
41376 bb.limit = bb.markedOffset = j;
41377 rs = false;
41378 break;
41379 case '>':
41380 if (!noAssert) {
41381 if (hl) {
41382 fail = true;
41383 break;
41384 }
41385 hl = true;
41386 }
41387 bb.limit = j;
41388 rs = false;
41389 break;
41390 case "'":
41391 if (!noAssert) {
41392 if (hm) {
41393 fail = true;
41394 break;
41395 }
41396 hm = true;
41397 }
41398 bb.markedOffset = j;
41399 rs = false;
41400 break;
41401 case ' ':
41402 rs = false;
41403 break;
41404 default:
41405 if (!noAssert) {
41406 if (rs) {
41407 fail = true;
41408 break;
41409 }
41410 }
41411 b = parseInt(ch+str.charAt(i++), 16);
41412 if (!noAssert) {
41413 if (isNaN(b) || b < 0 || b > 255)
41414 throw TypeError("Illegal str: Not a debug encoded string");
41415 }
41416 bb.view[j++] = b;
41417 rs = true;
41418 }
41419 if (fail)
41420 throw TypeError("Illegal str: Invalid symbol at "+i);
41421 }
41422 if (!noAssert) {
41423 if (!ho || !hl)
41424 throw TypeError("Illegal str: Missing offset or limit");
41425 if (j<bb.buffer.byteLength)
41426 throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+j+" < "+k);
41427 }
41428 return bb;
41429 };
41430
41431 // encodings/hex
41432
41433 /**
41434 * Encodes this ByteBuffer's contents to a hex encoded string.
41435 * @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
41436 * @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
41437 * @returns {string} Hex encoded string
41438 * @expose
41439 */
41440 ByteBufferPrototype.toHex = function(begin, end) {
41441 begin = typeof begin === 'undefined' ? this.offset : begin;
41442 end = typeof end === 'undefined' ? this.limit : end;
41443 if (!this.noAssert) {
41444 if (typeof begin !== 'number' || begin % 1 !== 0)
41445 throw TypeError("Illegal begin: Not an integer");
41446 begin >>>= 0;
41447 if (typeof end !== 'number' || end % 1 !== 0)
41448 throw TypeError("Illegal end: Not an integer");
41449 end >>>= 0;
41450 if (begin < 0 || begin > end || end > this.buffer.byteLength)
41451 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
41452 }
41453 var out = new Array(end - begin),
41454 b;
41455 while (begin < end) {
41456 b = this.view[begin++];
41457 if (b < 0x10)
41458 out.push("0", b.toString(16));
41459 else out.push(b.toString(16));
41460 }
41461 return out.join('');
41462 };
41463
41464 /**
41465 * Decodes a hex encoded string to a ByteBuffer.
41466 * @param {string} str String to decode
41467 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
41468 * {@link ByteBuffer.DEFAULT_ENDIAN}.
41469 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
41470 * {@link ByteBuffer.DEFAULT_NOASSERT}.
41471 * @returns {!ByteBuffer} ByteBuffer
41472 * @expose
41473 */
41474 ByteBuffer.fromHex = function(str, littleEndian, noAssert) {
41475 if (!noAssert) {
41476 if (typeof str !== 'string')
41477 throw TypeError("Illegal str: Not a string");
41478 if (str.length % 2 !== 0)
41479 throw TypeError("Illegal str: Length not a multiple of 2");
41480 }
41481 var k = str.length,
41482 bb = new ByteBuffer((k / 2) | 0, littleEndian),
41483 b;
41484 for (var i=0, j=0; i<k; i+=2) {
41485 b = parseInt(str.substring(i, i+2), 16);
41486 if (!noAssert)
41487 if (!isFinite(b) || b < 0 || b > 255)
41488 throw TypeError("Illegal str: Contains non-hex characters");
41489 bb.view[j++] = b;
41490 }
41491 bb.limit = j;
41492 return bb;
41493 };
41494
41495 // utfx-embeddable
41496
41497 /**
41498 * utfx-embeddable (c) 2014 Daniel Wirtz <dcode@dcode.io>
41499 * Released under the Apache License, Version 2.0
41500 * see: https://github.com/dcodeIO/utfx for details
41501 */
41502 var utfx = function() {
41503 "use strict";
41504
41505 /**
41506 * utfx namespace.
41507 * @inner
41508 * @type {!Object.<string,*>}
41509 */
41510 var utfx = {};
41511
41512 /**
41513 * Maximum valid code point.
41514 * @type {number}
41515 * @const
41516 */
41517 utfx.MAX_CODEPOINT = 0x10FFFF;
41518
41519 /**
41520 * Encodes UTF8 code points to UTF8 bytes.
41521 * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
41522 * respectively `null` if there are no more code points left or a single numeric code point.
41523 * @param {!function(number)} dst Bytes destination as a function successively called with the next byte
41524 */
41525 utfx.encodeUTF8 = function(src, dst) {
41526 var cp = null;
41527 if (typeof src === 'number')
41528 cp = src,
41529 src = function() { return null; };
41530 while (cp !== null || (cp = src()) !== null) {
41531 if (cp < 0x80)
41532 dst(cp&0x7F);
41533 else if (cp < 0x800)
41534 dst(((cp>>6)&0x1F)|0xC0),
41535 dst((cp&0x3F)|0x80);
41536 else if (cp < 0x10000)
41537 dst(((cp>>12)&0x0F)|0xE0),
41538 dst(((cp>>6)&0x3F)|0x80),
41539 dst((cp&0x3F)|0x80);
41540 else
41541 dst(((cp>>18)&0x07)|0xF0),
41542 dst(((cp>>12)&0x3F)|0x80),
41543 dst(((cp>>6)&0x3F)|0x80),
41544 dst((cp&0x3F)|0x80);
41545 cp = null;
41546 }
41547 };
41548
41549 /**
41550 * Decodes UTF8 bytes to UTF8 code points.
41551 * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
41552 * are no more bytes left.
41553 * @param {!function(number)} dst Code points destination as a function successively called with each decoded code point.
41554 * @throws {RangeError} If a starting byte is invalid in UTF8
41555 * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the
41556 * remaining bytes.
41557 */
41558 utfx.decodeUTF8 = function(src, dst) {
41559 var a, b, c, d, fail = function(b) {
41560 b = b.slice(0, b.indexOf(null));
41561 var err = Error(b.toString());
41562 err.name = "TruncatedError";
41563 err['bytes'] = b;
41564 throw err;
41565 };
41566 while ((a = src()) !== null) {
41567 if ((a&0x80) === 0)
41568 dst(a);
41569 else if ((a&0xE0) === 0xC0)
41570 ((b = src()) === null) && fail([a, b]),
41571 dst(((a&0x1F)<<6) | (b&0x3F));
41572 else if ((a&0xF0) === 0xE0)
41573 ((b=src()) === null || (c=src()) === null) && fail([a, b, c]),
41574 dst(((a&0x0F)<<12) | ((b&0x3F)<<6) | (c&0x3F));
41575 else if ((a&0xF8) === 0xF0)
41576 ((b=src()) === null || (c=src()) === null || (d=src()) === null) && fail([a, b, c ,d]),
41577 dst(((a&0x07)<<18) | ((b&0x3F)<<12) | ((c&0x3F)<<6) | (d&0x3F));
41578 else throw RangeError("Illegal starting byte: "+a);
41579 }
41580 };
41581
41582 /**
41583 * Converts UTF16 characters to UTF8 code points.
41584 * @param {!function():number|null} src Characters source as a function returning the next char code respectively
41585 * `null` if there are no more characters left.
41586 * @param {!function(number)} dst Code points destination as a function successively called with each converted code
41587 * point.
41588 */
41589 utfx.UTF16toUTF8 = function(src, dst) {
41590 var c1, c2 = null;
41591 while (true) {
41592 if ((c1 = c2 !== null ? c2 : src()) === null)
41593 break;
41594 if (c1 >= 0xD800 && c1 <= 0xDFFF) {
41595 if ((c2 = src()) !== null) {
41596 if (c2 >= 0xDC00 && c2 <= 0xDFFF) {
41597 dst((c1-0xD800)*0x400+c2-0xDC00+0x10000);
41598 c2 = null; continue;
41599 }
41600 }
41601 }
41602 dst(c1);
41603 }
41604 if (c2 !== null) dst(c2);
41605 };
41606
41607 /**
41608 * Converts UTF8 code points to UTF16 characters.
41609 * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
41610 * respectively `null` if there are no more code points left or a single numeric code point.
41611 * @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
41612 * @throws {RangeError} If a code point is out of range
41613 */
41614 utfx.UTF8toUTF16 = function(src, dst) {
41615 var cp = null;
41616 if (typeof src === 'number')
41617 cp = src, src = function() { return null; };
41618 while (cp !== null || (cp = src()) !== null) {
41619 if (cp <= 0xFFFF)
41620 dst(cp);
41621 else
41622 cp -= 0x10000,
41623 dst((cp>>10)+0xD800),
41624 dst((cp%0x400)+0xDC00);
41625 cp = null;
41626 }
41627 };
41628
41629 /**
41630 * Converts and encodes UTF16 characters to UTF8 bytes.
41631 * @param {!function():number|null} src Characters source as a function returning the next char code respectively `null`
41632 * if there are no more characters left.
41633 * @param {!function(number)} dst Bytes destination as a function successively called with the next byte.
41634 */
41635 utfx.encodeUTF16toUTF8 = function(src, dst) {
41636 utfx.UTF16toUTF8(src, function(cp) {
41637 utfx.encodeUTF8(cp, dst);
41638 });
41639 };
41640
41641 /**
41642 * Decodes and converts UTF8 bytes to UTF16 characters.
41643 * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
41644 * are no more bytes left.
41645 * @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
41646 * @throws {RangeError} If a starting byte is invalid in UTF8
41647 * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the remaining bytes.
41648 */
41649 utfx.decodeUTF8toUTF16 = function(src, dst) {
41650 utfx.decodeUTF8(src, function(cp) {
41651 utfx.UTF8toUTF16(cp, dst);
41652 });
41653 };
41654
41655 /**
41656 * Calculates the byte length of an UTF8 code point.
41657 * @param {number} cp UTF8 code point
41658 * @returns {number} Byte length
41659 */
41660 utfx.calculateCodePoint = function(cp) {
41661 return (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
41662 };
41663
41664 /**
41665 * Calculates the number of UTF8 bytes required to store UTF8 code points.
41666 * @param {(!function():number|null)} src Code points source as a function returning the next code point respectively
41667 * `null` if there are no more code points left.
41668 * @returns {number} The number of UTF8 bytes required
41669 */
41670 utfx.calculateUTF8 = function(src) {
41671 var cp, l=0;
41672 while ((cp = src()) !== null)
41673 l += (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
41674 return l;
41675 };
41676
41677 /**
41678 * Calculates the number of UTF8 code points respectively UTF8 bytes required to store UTF16 char codes.
41679 * @param {(!function():number|null)} src Characters source as a function returning the next char code respectively
41680 * `null` if there are no more characters left.
41681 * @returns {!Array.<number>} The number of UTF8 code points at index 0 and the number of UTF8 bytes required at index 1.
41682 */
41683 utfx.calculateUTF16asUTF8 = function(src) {
41684 var n=0, l=0;
41685 utfx.UTF16toUTF8(src, function(cp) {
41686 ++n; l += (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
41687 });
41688 return [n,l];
41689 };
41690
41691 return utfx;
41692 }();
41693
41694 // encodings/utf8
41695
41696 /**
41697 * Encodes this ByteBuffer's contents between {@link ByteBuffer#offset} and {@link ByteBuffer#limit} to an UTF8 encoded
41698 * string.
41699 * @returns {string} Hex encoded string
41700 * @throws {RangeError} If `offset > limit`
41701 * @expose
41702 */
41703 ByteBufferPrototype.toUTF8 = function(begin, end) {
41704 if (typeof begin === 'undefined') begin = this.offset;
41705 if (typeof end === 'undefined') end = this.limit;
41706 if (!this.noAssert) {
41707 if (typeof begin !== 'number' || begin % 1 !== 0)
41708 throw TypeError("Illegal begin: Not an integer");
41709 begin >>>= 0;
41710 if (typeof end !== 'number' || end % 1 !== 0)
41711 throw TypeError("Illegal end: Not an integer");
41712 end >>>= 0;
41713 if (begin < 0 || begin > end || end > this.buffer.byteLength)
41714 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
41715 }
41716 var sd; try {
41717 utfx.decodeUTF8toUTF16(function() {
41718 return begin < end ? this.view[begin++] : null;
41719 }.bind(this), sd = stringDestination());
41720 } catch (e) {
41721 if (begin !== end)
41722 throw RangeError("Illegal range: Truncated data, "+begin+" != "+end);
41723 }
41724 return sd();
41725 };
41726
41727 /**
41728 * Decodes an UTF8 encoded string to a ByteBuffer.
41729 * @param {string} str String to decode
41730 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
41731 * {@link ByteBuffer.DEFAULT_ENDIAN}.
41732 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
41733 * {@link ByteBuffer.DEFAULT_NOASSERT}.
41734 * @returns {!ByteBuffer} ByteBuffer
41735 * @expose
41736 */
41737 ByteBuffer.fromUTF8 = function(str, littleEndian, noAssert) {
41738 if (!noAssert)
41739 if (typeof str !== 'string')
41740 throw TypeError("Illegal str: Not a string");
41741 var bb = new ByteBuffer(utfx.calculateUTF16asUTF8(stringSource(str), true)[1], littleEndian, noAssert),
41742 i = 0;
41743 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
41744 bb.view[i++] = b;
41745 });
41746 bb.limit = i;
41747 return bb;
41748 };
41749
41750 return ByteBuffer;
41751});
41752
41753
41754/***/ }),
41755/* 656 */
41756/***/ (function(module, exports, __webpack_require__) {
41757
41758var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
41759 Copyright 2013 Daniel Wirtz <dcode@dcode.io>
41760 Copyright 2009 The Closure Library Authors. All Rights Reserved.
41761
41762 Licensed under the Apache License, Version 2.0 (the "License");
41763 you may not use this file except in compliance with the License.
41764 You may obtain a copy of the License at
41765
41766 http://www.apache.org/licenses/LICENSE-2.0
41767
41768 Unless required by applicable law or agreed to in writing, software
41769 distributed under the License is distributed on an "AS-IS" BASIS,
41770 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
41771 See the License for the specific language governing permissions and
41772 limitations under the License.
41773 */
41774
41775/**
41776 * @license long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
41777 * Released under the Apache License, Version 2.0
41778 * see: https://github.com/dcodeIO/long.js for details
41779 */
41780(function(global, factory) {
41781
41782 /* AMD */ if (true)
41783 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
41784 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
41785 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
41786 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
41787 /* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"])
41788 module["exports"] = factory();
41789 /* Global */ else
41790 (global["dcodeIO"] = global["dcodeIO"] || {})["Long"] = factory();
41791
41792})(this, function() {
41793 "use strict";
41794
41795 /**
41796 * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
41797 * See the from* functions below for more convenient ways of constructing Longs.
41798 * @exports Long
41799 * @class A Long class for representing a 64 bit two's-complement integer value.
41800 * @param {number} low The low (signed) 32 bits of the long
41801 * @param {number} high The high (signed) 32 bits of the long
41802 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
41803 * @constructor
41804 */
41805 function Long(low, high, unsigned) {
41806
41807 /**
41808 * The low 32 bits as a signed value.
41809 * @type {number}
41810 */
41811 this.low = low | 0;
41812
41813 /**
41814 * The high 32 bits as a signed value.
41815 * @type {number}
41816 */
41817 this.high = high | 0;
41818
41819 /**
41820 * Whether unsigned or not.
41821 * @type {boolean}
41822 */
41823 this.unsigned = !!unsigned;
41824 }
41825
41826 // The internal representation of a long is the two given signed, 32-bit values.
41827 // We use 32-bit pieces because these are the size of integers on which
41828 // Javascript performs bit-operations. For operations like addition and
41829 // multiplication, we split each number into 16 bit pieces, which can easily be
41830 // multiplied within Javascript's floating-point representation without overflow
41831 // or change in sign.
41832 //
41833 // In the algorithms below, we frequently reduce the negative case to the
41834 // positive case by negating the input(s) and then post-processing the result.
41835 // Note that we must ALWAYS check specially whether those values are MIN_VALUE
41836 // (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
41837 // a positive number, it overflows back into a negative). Not handling this
41838 // case would often result in infinite recursion.
41839 //
41840 // Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
41841 // methods on which they depend.
41842
41843 /**
41844 * An indicator used to reliably determine if an object is a Long or not.
41845 * @type {boolean}
41846 * @const
41847 * @private
41848 */
41849 Long.prototype.__isLong__;
41850
41851 Object.defineProperty(Long.prototype, "__isLong__", {
41852 value: true,
41853 enumerable: false,
41854 configurable: false
41855 });
41856
41857 /**
41858 * @function
41859 * @param {*} obj Object
41860 * @returns {boolean}
41861 * @inner
41862 */
41863 function isLong(obj) {
41864 return (obj && obj["__isLong__"]) === true;
41865 }
41866
41867 /**
41868 * Tests if the specified object is a Long.
41869 * @function
41870 * @param {*} obj Object
41871 * @returns {boolean}
41872 */
41873 Long.isLong = isLong;
41874
41875 /**
41876 * A cache of the Long representations of small integer values.
41877 * @type {!Object}
41878 * @inner
41879 */
41880 var INT_CACHE = {};
41881
41882 /**
41883 * A cache of the Long representations of small unsigned integer values.
41884 * @type {!Object}
41885 * @inner
41886 */
41887 var UINT_CACHE = {};
41888
41889 /**
41890 * @param {number} value
41891 * @param {boolean=} unsigned
41892 * @returns {!Long}
41893 * @inner
41894 */
41895 function fromInt(value, unsigned) {
41896 var obj, cachedObj, cache;
41897 if (unsigned) {
41898 value >>>= 0;
41899 if (cache = (0 <= value && value < 256)) {
41900 cachedObj = UINT_CACHE[value];
41901 if (cachedObj)
41902 return cachedObj;
41903 }
41904 obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);
41905 if (cache)
41906 UINT_CACHE[value] = obj;
41907 return obj;
41908 } else {
41909 value |= 0;
41910 if (cache = (-128 <= value && value < 128)) {
41911 cachedObj = INT_CACHE[value];
41912 if (cachedObj)
41913 return cachedObj;
41914 }
41915 obj = fromBits(value, value < 0 ? -1 : 0, false);
41916 if (cache)
41917 INT_CACHE[value] = obj;
41918 return obj;
41919 }
41920 }
41921
41922 /**
41923 * Returns a Long representing the given 32 bit integer value.
41924 * @function
41925 * @param {number} value The 32 bit integer in question
41926 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
41927 * @returns {!Long} The corresponding Long value
41928 */
41929 Long.fromInt = fromInt;
41930
41931 /**
41932 * @param {number} value
41933 * @param {boolean=} unsigned
41934 * @returns {!Long}
41935 * @inner
41936 */
41937 function fromNumber(value, unsigned) {
41938 if (isNaN(value) || !isFinite(value))
41939 return unsigned ? UZERO : ZERO;
41940 if (unsigned) {
41941 if (value < 0)
41942 return UZERO;
41943 if (value >= TWO_PWR_64_DBL)
41944 return MAX_UNSIGNED_VALUE;
41945 } else {
41946 if (value <= -TWO_PWR_63_DBL)
41947 return MIN_VALUE;
41948 if (value + 1 >= TWO_PWR_63_DBL)
41949 return MAX_VALUE;
41950 }
41951 if (value < 0)
41952 return fromNumber(-value, unsigned).neg();
41953 return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
41954 }
41955
41956 /**
41957 * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
41958 * @function
41959 * @param {number} value The number in question
41960 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
41961 * @returns {!Long} The corresponding Long value
41962 */
41963 Long.fromNumber = fromNumber;
41964
41965 /**
41966 * @param {number} lowBits
41967 * @param {number} highBits
41968 * @param {boolean=} unsigned
41969 * @returns {!Long}
41970 * @inner
41971 */
41972 function fromBits(lowBits, highBits, unsigned) {
41973 return new Long(lowBits, highBits, unsigned);
41974 }
41975
41976 /**
41977 * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
41978 * assumed to use 32 bits.
41979 * @function
41980 * @param {number} lowBits The low 32 bits
41981 * @param {number} highBits The high 32 bits
41982 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
41983 * @returns {!Long} The corresponding Long value
41984 */
41985 Long.fromBits = fromBits;
41986
41987 /**
41988 * @function
41989 * @param {number} base
41990 * @param {number} exponent
41991 * @returns {number}
41992 * @inner
41993 */
41994 var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)
41995
41996 /**
41997 * @param {string} str
41998 * @param {(boolean|number)=} unsigned
41999 * @param {number=} radix
42000 * @returns {!Long}
42001 * @inner
42002 */
42003 function fromString(str, unsigned, radix) {
42004 if (str.length === 0)
42005 throw Error('empty string');
42006 if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
42007 return ZERO;
42008 if (typeof unsigned === 'number') {
42009 // For goog.math.long compatibility
42010 radix = unsigned,
42011 unsigned = false;
42012 } else {
42013 unsigned = !! unsigned;
42014 }
42015 radix = radix || 10;
42016 if (radix < 2 || 36 < radix)
42017 throw RangeError('radix');
42018
42019 var p;
42020 if ((p = str.indexOf('-')) > 0)
42021 throw Error('interior hyphen');
42022 else if (p === 0) {
42023 return fromString(str.substring(1), unsigned, radix).neg();
42024 }
42025
42026 // Do several (8) digits each time through the loop, so as to
42027 // minimize the calls to the very expensive emulated div.
42028 var radixToPower = fromNumber(pow_dbl(radix, 8));
42029
42030 var result = ZERO;
42031 for (var i = 0; i < str.length; i += 8) {
42032 var size = Math.min(8, str.length - i),
42033 value = parseInt(str.substring(i, i + size), radix);
42034 if (size < 8) {
42035 var power = fromNumber(pow_dbl(radix, size));
42036 result = result.mul(power).add(fromNumber(value));
42037 } else {
42038 result = result.mul(radixToPower);
42039 result = result.add(fromNumber(value));
42040 }
42041 }
42042 result.unsigned = unsigned;
42043 return result;
42044 }
42045
42046 /**
42047 * Returns a Long representation of the given string, written using the specified radix.
42048 * @function
42049 * @param {string} str The textual representation of the Long
42050 * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to `false` for signed
42051 * @param {number=} radix The radix in which the text is written (2-36), defaults to 10
42052 * @returns {!Long} The corresponding Long value
42053 */
42054 Long.fromString = fromString;
42055
42056 /**
42057 * @function
42058 * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
42059 * @returns {!Long}
42060 * @inner
42061 */
42062 function fromValue(val) {
42063 if (val /* is compatible */ instanceof Long)
42064 return val;
42065 if (typeof val === 'number')
42066 return fromNumber(val);
42067 if (typeof val === 'string')
42068 return fromString(val);
42069 // Throws for non-objects, converts non-instanceof Long:
42070 return fromBits(val.low, val.high, val.unsigned);
42071 }
42072
42073 /**
42074 * Converts the specified value to a Long.
42075 * @function
42076 * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value
42077 * @returns {!Long}
42078 */
42079 Long.fromValue = fromValue;
42080
42081 // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
42082 // no runtime penalty for these.
42083
42084 /**
42085 * @type {number}
42086 * @const
42087 * @inner
42088 */
42089 var TWO_PWR_16_DBL = 1 << 16;
42090
42091 /**
42092 * @type {number}
42093 * @const
42094 * @inner
42095 */
42096 var TWO_PWR_24_DBL = 1 << 24;
42097
42098 /**
42099 * @type {number}
42100 * @const
42101 * @inner
42102 */
42103 var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
42104
42105 /**
42106 * @type {number}
42107 * @const
42108 * @inner
42109 */
42110 var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
42111
42112 /**
42113 * @type {number}
42114 * @const
42115 * @inner
42116 */
42117 var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
42118
42119 /**
42120 * @type {!Long}
42121 * @const
42122 * @inner
42123 */
42124 var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
42125
42126 /**
42127 * @type {!Long}
42128 * @inner
42129 */
42130 var ZERO = fromInt(0);
42131
42132 /**
42133 * Signed zero.
42134 * @type {!Long}
42135 */
42136 Long.ZERO = ZERO;
42137
42138 /**
42139 * @type {!Long}
42140 * @inner
42141 */
42142 var UZERO = fromInt(0, true);
42143
42144 /**
42145 * Unsigned zero.
42146 * @type {!Long}
42147 */
42148 Long.UZERO = UZERO;
42149
42150 /**
42151 * @type {!Long}
42152 * @inner
42153 */
42154 var ONE = fromInt(1);
42155
42156 /**
42157 * Signed one.
42158 * @type {!Long}
42159 */
42160 Long.ONE = ONE;
42161
42162 /**
42163 * @type {!Long}
42164 * @inner
42165 */
42166 var UONE = fromInt(1, true);
42167
42168 /**
42169 * Unsigned one.
42170 * @type {!Long}
42171 */
42172 Long.UONE = UONE;
42173
42174 /**
42175 * @type {!Long}
42176 * @inner
42177 */
42178 var NEG_ONE = fromInt(-1);
42179
42180 /**
42181 * Signed negative one.
42182 * @type {!Long}
42183 */
42184 Long.NEG_ONE = NEG_ONE;
42185
42186 /**
42187 * @type {!Long}
42188 * @inner
42189 */
42190 var MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);
42191
42192 /**
42193 * Maximum signed value.
42194 * @type {!Long}
42195 */
42196 Long.MAX_VALUE = MAX_VALUE;
42197
42198 /**
42199 * @type {!Long}
42200 * @inner
42201 */
42202 var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);
42203
42204 /**
42205 * Maximum unsigned value.
42206 * @type {!Long}
42207 */
42208 Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
42209
42210 /**
42211 * @type {!Long}
42212 * @inner
42213 */
42214 var MIN_VALUE = fromBits(0, 0x80000000|0, false);
42215
42216 /**
42217 * Minimum signed value.
42218 * @type {!Long}
42219 */
42220 Long.MIN_VALUE = MIN_VALUE;
42221
42222 /**
42223 * @alias Long.prototype
42224 * @inner
42225 */
42226 var LongPrototype = Long.prototype;
42227
42228 /**
42229 * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
42230 * @returns {number}
42231 */
42232 LongPrototype.toInt = function toInt() {
42233 return this.unsigned ? this.low >>> 0 : this.low;
42234 };
42235
42236 /**
42237 * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
42238 * @returns {number}
42239 */
42240 LongPrototype.toNumber = function toNumber() {
42241 if (this.unsigned)
42242 return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);
42243 return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
42244 };
42245
42246 /**
42247 * Converts the Long to a string written in the specified radix.
42248 * @param {number=} radix Radix (2-36), defaults to 10
42249 * @returns {string}
42250 * @override
42251 * @throws {RangeError} If `radix` is out of range
42252 */
42253 LongPrototype.toString = function toString(radix) {
42254 radix = radix || 10;
42255 if (radix < 2 || 36 < radix)
42256 throw RangeError('radix');
42257 if (this.isZero())
42258 return '0';
42259 if (this.isNegative()) { // Unsigned Longs are never negative
42260 if (this.eq(MIN_VALUE)) {
42261 // We need to change the Long value before it can be negated, so we remove
42262 // the bottom-most digit in this base and then recurse to do the rest.
42263 var radixLong = fromNumber(radix),
42264 div = this.div(radixLong),
42265 rem1 = div.mul(radixLong).sub(this);
42266 return div.toString(radix) + rem1.toInt().toString(radix);
42267 } else
42268 return '-' + this.neg().toString(radix);
42269 }
42270
42271 // Do several (6) digits each time through the loop, so as to
42272 // minimize the calls to the very expensive emulated div.
42273 var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),
42274 rem = this;
42275 var result = '';
42276 while (true) {
42277 var remDiv = rem.div(radixToPower),
42278 intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,
42279 digits = intval.toString(radix);
42280 rem = remDiv;
42281 if (rem.isZero())
42282 return digits + result;
42283 else {
42284 while (digits.length < 6)
42285 digits = '0' + digits;
42286 result = '' + digits + result;
42287 }
42288 }
42289 };
42290
42291 /**
42292 * Gets the high 32 bits as a signed integer.
42293 * @returns {number} Signed high bits
42294 */
42295 LongPrototype.getHighBits = function getHighBits() {
42296 return this.high;
42297 };
42298
42299 /**
42300 * Gets the high 32 bits as an unsigned integer.
42301 * @returns {number} Unsigned high bits
42302 */
42303 LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
42304 return this.high >>> 0;
42305 };
42306
42307 /**
42308 * Gets the low 32 bits as a signed integer.
42309 * @returns {number} Signed low bits
42310 */
42311 LongPrototype.getLowBits = function getLowBits() {
42312 return this.low;
42313 };
42314
42315 /**
42316 * Gets the low 32 bits as an unsigned integer.
42317 * @returns {number} Unsigned low bits
42318 */
42319 LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
42320 return this.low >>> 0;
42321 };
42322
42323 /**
42324 * Gets the number of bits needed to represent the absolute value of this Long.
42325 * @returns {number}
42326 */
42327 LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
42328 if (this.isNegative()) // Unsigned Longs are never negative
42329 return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
42330 var val = this.high != 0 ? this.high : this.low;
42331 for (var bit = 31; bit > 0; bit--)
42332 if ((val & (1 << bit)) != 0)
42333 break;
42334 return this.high != 0 ? bit + 33 : bit + 1;
42335 };
42336
42337 /**
42338 * Tests if this Long's value equals zero.
42339 * @returns {boolean}
42340 */
42341 LongPrototype.isZero = function isZero() {
42342 return this.high === 0 && this.low === 0;
42343 };
42344
42345 /**
42346 * Tests if this Long's value is negative.
42347 * @returns {boolean}
42348 */
42349 LongPrototype.isNegative = function isNegative() {
42350 return !this.unsigned && this.high < 0;
42351 };
42352
42353 /**
42354 * Tests if this Long's value is positive.
42355 * @returns {boolean}
42356 */
42357 LongPrototype.isPositive = function isPositive() {
42358 return this.unsigned || this.high >= 0;
42359 };
42360
42361 /**
42362 * Tests if this Long's value is odd.
42363 * @returns {boolean}
42364 */
42365 LongPrototype.isOdd = function isOdd() {
42366 return (this.low & 1) === 1;
42367 };
42368
42369 /**
42370 * Tests if this Long's value is even.
42371 * @returns {boolean}
42372 */
42373 LongPrototype.isEven = function isEven() {
42374 return (this.low & 1) === 0;
42375 };
42376
42377 /**
42378 * Tests if this Long's value equals the specified's.
42379 * @param {!Long|number|string} other Other value
42380 * @returns {boolean}
42381 */
42382 LongPrototype.equals = function equals(other) {
42383 if (!isLong(other))
42384 other = fromValue(other);
42385 if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)
42386 return false;
42387 return this.high === other.high && this.low === other.low;
42388 };
42389
42390 /**
42391 * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.
42392 * @function
42393 * @param {!Long|number|string} other Other value
42394 * @returns {boolean}
42395 */
42396 LongPrototype.eq = LongPrototype.equals;
42397
42398 /**
42399 * Tests if this Long's value differs from the specified's.
42400 * @param {!Long|number|string} other Other value
42401 * @returns {boolean}
42402 */
42403 LongPrototype.notEquals = function notEquals(other) {
42404 return !this.eq(/* validates */ other);
42405 };
42406
42407 /**
42408 * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
42409 * @function
42410 * @param {!Long|number|string} other Other value
42411 * @returns {boolean}
42412 */
42413 LongPrototype.neq = LongPrototype.notEquals;
42414
42415 /**
42416 * Tests if this Long's value is less than the specified's.
42417 * @param {!Long|number|string} other Other value
42418 * @returns {boolean}
42419 */
42420 LongPrototype.lessThan = function lessThan(other) {
42421 return this.comp(/* validates */ other) < 0;
42422 };
42423
42424 /**
42425 * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.
42426 * @function
42427 * @param {!Long|number|string} other Other value
42428 * @returns {boolean}
42429 */
42430 LongPrototype.lt = LongPrototype.lessThan;
42431
42432 /**
42433 * Tests if this Long's value is less than or equal the specified's.
42434 * @param {!Long|number|string} other Other value
42435 * @returns {boolean}
42436 */
42437 LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
42438 return this.comp(/* validates */ other) <= 0;
42439 };
42440
42441 /**
42442 * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
42443 * @function
42444 * @param {!Long|number|string} other Other value
42445 * @returns {boolean}
42446 */
42447 LongPrototype.lte = LongPrototype.lessThanOrEqual;
42448
42449 /**
42450 * Tests if this Long's value is greater than the specified's.
42451 * @param {!Long|number|string} other Other value
42452 * @returns {boolean}
42453 */
42454 LongPrototype.greaterThan = function greaterThan(other) {
42455 return this.comp(/* validates */ other) > 0;
42456 };
42457
42458 /**
42459 * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.
42460 * @function
42461 * @param {!Long|number|string} other Other value
42462 * @returns {boolean}
42463 */
42464 LongPrototype.gt = LongPrototype.greaterThan;
42465
42466 /**
42467 * Tests if this Long's value is greater than or equal the specified's.
42468 * @param {!Long|number|string} other Other value
42469 * @returns {boolean}
42470 */
42471 LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
42472 return this.comp(/* validates */ other) >= 0;
42473 };
42474
42475 /**
42476 * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
42477 * @function
42478 * @param {!Long|number|string} other Other value
42479 * @returns {boolean}
42480 */
42481 LongPrototype.gte = LongPrototype.greaterThanOrEqual;
42482
42483 /**
42484 * Compares this Long's value with the specified's.
42485 * @param {!Long|number|string} other Other value
42486 * @returns {number} 0 if they are the same, 1 if the this is greater and -1
42487 * if the given one is greater
42488 */
42489 LongPrototype.compare = function compare(other) {
42490 if (!isLong(other))
42491 other = fromValue(other);
42492 if (this.eq(other))
42493 return 0;
42494 var thisNeg = this.isNegative(),
42495 otherNeg = other.isNegative();
42496 if (thisNeg && !otherNeg)
42497 return -1;
42498 if (!thisNeg && otherNeg)
42499 return 1;
42500 // At this point the sign bits are the same
42501 if (!this.unsigned)
42502 return this.sub(other).isNegative() ? -1 : 1;
42503 // Both are positive if at least one is unsigned
42504 return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;
42505 };
42506
42507 /**
42508 * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.
42509 * @function
42510 * @param {!Long|number|string} other Other value
42511 * @returns {number} 0 if they are the same, 1 if the this is greater and -1
42512 * if the given one is greater
42513 */
42514 LongPrototype.comp = LongPrototype.compare;
42515
42516 /**
42517 * Negates this Long's value.
42518 * @returns {!Long} Negated Long
42519 */
42520 LongPrototype.negate = function negate() {
42521 if (!this.unsigned && this.eq(MIN_VALUE))
42522 return MIN_VALUE;
42523 return this.not().add(ONE);
42524 };
42525
42526 /**
42527 * Negates this Long's value. This is an alias of {@link Long#negate}.
42528 * @function
42529 * @returns {!Long} Negated Long
42530 */
42531 LongPrototype.neg = LongPrototype.negate;
42532
42533 /**
42534 * Returns the sum of this and the specified Long.
42535 * @param {!Long|number|string} addend Addend
42536 * @returns {!Long} Sum
42537 */
42538 LongPrototype.add = function add(addend) {
42539 if (!isLong(addend))
42540 addend = fromValue(addend);
42541
42542 // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
42543
42544 var a48 = this.high >>> 16;
42545 var a32 = this.high & 0xFFFF;
42546 var a16 = this.low >>> 16;
42547 var a00 = this.low & 0xFFFF;
42548
42549 var b48 = addend.high >>> 16;
42550 var b32 = addend.high & 0xFFFF;
42551 var b16 = addend.low >>> 16;
42552 var b00 = addend.low & 0xFFFF;
42553
42554 var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
42555 c00 += a00 + b00;
42556 c16 += c00 >>> 16;
42557 c00 &= 0xFFFF;
42558 c16 += a16 + b16;
42559 c32 += c16 >>> 16;
42560 c16 &= 0xFFFF;
42561 c32 += a32 + b32;
42562 c48 += c32 >>> 16;
42563 c32 &= 0xFFFF;
42564 c48 += a48 + b48;
42565 c48 &= 0xFFFF;
42566 return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
42567 };
42568
42569 /**
42570 * Returns the difference of this and the specified Long.
42571 * @param {!Long|number|string} subtrahend Subtrahend
42572 * @returns {!Long} Difference
42573 */
42574 LongPrototype.subtract = function subtract(subtrahend) {
42575 if (!isLong(subtrahend))
42576 subtrahend = fromValue(subtrahend);
42577 return this.add(subtrahend.neg());
42578 };
42579
42580 /**
42581 * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.
42582 * @function
42583 * @param {!Long|number|string} subtrahend Subtrahend
42584 * @returns {!Long} Difference
42585 */
42586 LongPrototype.sub = LongPrototype.subtract;
42587
42588 /**
42589 * Returns the product of this and the specified Long.
42590 * @param {!Long|number|string} multiplier Multiplier
42591 * @returns {!Long} Product
42592 */
42593 LongPrototype.multiply = function multiply(multiplier) {
42594 if (this.isZero())
42595 return ZERO;
42596 if (!isLong(multiplier))
42597 multiplier = fromValue(multiplier);
42598 if (multiplier.isZero())
42599 return ZERO;
42600 if (this.eq(MIN_VALUE))
42601 return multiplier.isOdd() ? MIN_VALUE : ZERO;
42602 if (multiplier.eq(MIN_VALUE))
42603 return this.isOdd() ? MIN_VALUE : ZERO;
42604
42605 if (this.isNegative()) {
42606 if (multiplier.isNegative())
42607 return this.neg().mul(multiplier.neg());
42608 else
42609 return this.neg().mul(multiplier).neg();
42610 } else if (multiplier.isNegative())
42611 return this.mul(multiplier.neg()).neg();
42612
42613 // If both longs are small, use float multiplication
42614 if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
42615 return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
42616
42617 // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
42618 // We can skip products that would overflow.
42619
42620 var a48 = this.high >>> 16;
42621 var a32 = this.high & 0xFFFF;
42622 var a16 = this.low >>> 16;
42623 var a00 = this.low & 0xFFFF;
42624
42625 var b48 = multiplier.high >>> 16;
42626 var b32 = multiplier.high & 0xFFFF;
42627 var b16 = multiplier.low >>> 16;
42628 var b00 = multiplier.low & 0xFFFF;
42629
42630 var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
42631 c00 += a00 * b00;
42632 c16 += c00 >>> 16;
42633 c00 &= 0xFFFF;
42634 c16 += a16 * b00;
42635 c32 += c16 >>> 16;
42636 c16 &= 0xFFFF;
42637 c16 += a00 * b16;
42638 c32 += c16 >>> 16;
42639 c16 &= 0xFFFF;
42640 c32 += a32 * b00;
42641 c48 += c32 >>> 16;
42642 c32 &= 0xFFFF;
42643 c32 += a16 * b16;
42644 c48 += c32 >>> 16;
42645 c32 &= 0xFFFF;
42646 c32 += a00 * b32;
42647 c48 += c32 >>> 16;
42648 c32 &= 0xFFFF;
42649 c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
42650 c48 &= 0xFFFF;
42651 return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
42652 };
42653
42654 /**
42655 * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.
42656 * @function
42657 * @param {!Long|number|string} multiplier Multiplier
42658 * @returns {!Long} Product
42659 */
42660 LongPrototype.mul = LongPrototype.multiply;
42661
42662 /**
42663 * Returns this Long divided by the specified. The result is signed if this Long is signed or
42664 * unsigned if this Long is unsigned.
42665 * @param {!Long|number|string} divisor Divisor
42666 * @returns {!Long} Quotient
42667 */
42668 LongPrototype.divide = function divide(divisor) {
42669 if (!isLong(divisor))
42670 divisor = fromValue(divisor);
42671 if (divisor.isZero())
42672 throw Error('division by zero');
42673 if (this.isZero())
42674 return this.unsigned ? UZERO : ZERO;
42675 var approx, rem, res;
42676 if (!this.unsigned) {
42677 // This section is only relevant for signed longs and is derived from the
42678 // closure library as a whole.
42679 if (this.eq(MIN_VALUE)) {
42680 if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
42681 return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
42682 else if (divisor.eq(MIN_VALUE))
42683 return ONE;
42684 else {
42685 // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
42686 var halfThis = this.shr(1);
42687 approx = halfThis.div(divisor).shl(1);
42688 if (approx.eq(ZERO)) {
42689 return divisor.isNegative() ? ONE : NEG_ONE;
42690 } else {
42691 rem = this.sub(divisor.mul(approx));
42692 res = approx.add(rem.div(divisor));
42693 return res;
42694 }
42695 }
42696 } else if (divisor.eq(MIN_VALUE))
42697 return this.unsigned ? UZERO : ZERO;
42698 if (this.isNegative()) {
42699 if (divisor.isNegative())
42700 return this.neg().div(divisor.neg());
42701 return this.neg().div(divisor).neg();
42702 } else if (divisor.isNegative())
42703 return this.div(divisor.neg()).neg();
42704 res = ZERO;
42705 } else {
42706 // The algorithm below has not been made for unsigned longs. It's therefore
42707 // required to take special care of the MSB prior to running it.
42708 if (!divisor.unsigned)
42709 divisor = divisor.toUnsigned();
42710 if (divisor.gt(this))
42711 return UZERO;
42712 if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true
42713 return UONE;
42714 res = UZERO;
42715 }
42716
42717 // Repeat the following until the remainder is less than other: find a
42718 // floating-point that approximates remainder / other *from below*, add this
42719 // into the result, and subtract it from the remainder. It is critical that
42720 // the approximate value is less than or equal to the real value so that the
42721 // remainder never becomes negative.
42722 rem = this;
42723 while (rem.gte(divisor)) {
42724 // Approximate the result of division. This may be a little greater or
42725 // smaller than the actual value.
42726 approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
42727
42728 // We will tweak the approximate result by changing it in the 48-th digit or
42729 // the smallest non-fractional digit, whichever is larger.
42730 var log2 = Math.ceil(Math.log(approx) / Math.LN2),
42731 delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),
42732
42733 // Decrease the approximation until it is smaller than the remainder. Note
42734 // that if it is too large, the product overflows and is negative.
42735 approxRes = fromNumber(approx),
42736 approxRem = approxRes.mul(divisor);
42737 while (approxRem.isNegative() || approxRem.gt(rem)) {
42738 approx -= delta;
42739 approxRes = fromNumber(approx, this.unsigned);
42740 approxRem = approxRes.mul(divisor);
42741 }
42742
42743 // We know the answer can't be zero... and actually, zero would cause
42744 // infinite recursion since we would make no progress.
42745 if (approxRes.isZero())
42746 approxRes = ONE;
42747
42748 res = res.add(approxRes);
42749 rem = rem.sub(approxRem);
42750 }
42751 return res;
42752 };
42753
42754 /**
42755 * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.
42756 * @function
42757 * @param {!Long|number|string} divisor Divisor
42758 * @returns {!Long} Quotient
42759 */
42760 LongPrototype.div = LongPrototype.divide;
42761
42762 /**
42763 * Returns this Long modulo the specified.
42764 * @param {!Long|number|string} divisor Divisor
42765 * @returns {!Long} Remainder
42766 */
42767 LongPrototype.modulo = function modulo(divisor) {
42768 if (!isLong(divisor))
42769 divisor = fromValue(divisor);
42770 return this.sub(this.div(divisor).mul(divisor));
42771 };
42772
42773 /**
42774 * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
42775 * @function
42776 * @param {!Long|number|string} divisor Divisor
42777 * @returns {!Long} Remainder
42778 */
42779 LongPrototype.mod = LongPrototype.modulo;
42780
42781 /**
42782 * Returns the bitwise NOT of this Long.
42783 * @returns {!Long}
42784 */
42785 LongPrototype.not = function not() {
42786 return fromBits(~this.low, ~this.high, this.unsigned);
42787 };
42788
42789 /**
42790 * Returns the bitwise AND of this Long and the specified.
42791 * @param {!Long|number|string} other Other Long
42792 * @returns {!Long}
42793 */
42794 LongPrototype.and = function and(other) {
42795 if (!isLong(other))
42796 other = fromValue(other);
42797 return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
42798 };
42799
42800 /**
42801 * Returns the bitwise OR of this Long and the specified.
42802 * @param {!Long|number|string} other Other Long
42803 * @returns {!Long}
42804 */
42805 LongPrototype.or = function or(other) {
42806 if (!isLong(other))
42807 other = fromValue(other);
42808 return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
42809 };
42810
42811 /**
42812 * Returns the bitwise XOR of this Long and the given one.
42813 * @param {!Long|number|string} other Other Long
42814 * @returns {!Long}
42815 */
42816 LongPrototype.xor = function xor(other) {
42817 if (!isLong(other))
42818 other = fromValue(other);
42819 return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
42820 };
42821
42822 /**
42823 * Returns this Long with bits shifted to the left by the given amount.
42824 * @param {number|!Long} numBits Number of bits
42825 * @returns {!Long} Shifted Long
42826 */
42827 LongPrototype.shiftLeft = function shiftLeft(numBits) {
42828 if (isLong(numBits))
42829 numBits = numBits.toInt();
42830 if ((numBits &= 63) === 0)
42831 return this;
42832 else if (numBits < 32)
42833 return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
42834 else
42835 return fromBits(0, this.low << (numBits - 32), this.unsigned);
42836 };
42837
42838 /**
42839 * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.
42840 * @function
42841 * @param {number|!Long} numBits Number of bits
42842 * @returns {!Long} Shifted Long
42843 */
42844 LongPrototype.shl = LongPrototype.shiftLeft;
42845
42846 /**
42847 * Returns this Long with bits arithmetically shifted to the right by the given amount.
42848 * @param {number|!Long} numBits Number of bits
42849 * @returns {!Long} Shifted Long
42850 */
42851 LongPrototype.shiftRight = function shiftRight(numBits) {
42852 if (isLong(numBits))
42853 numBits = numBits.toInt();
42854 if ((numBits &= 63) === 0)
42855 return this;
42856 else if (numBits < 32)
42857 return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
42858 else
42859 return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
42860 };
42861
42862 /**
42863 * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.
42864 * @function
42865 * @param {number|!Long} numBits Number of bits
42866 * @returns {!Long} Shifted Long
42867 */
42868 LongPrototype.shr = LongPrototype.shiftRight;
42869
42870 /**
42871 * Returns this Long with bits logically shifted to the right by the given amount.
42872 * @param {number|!Long} numBits Number of bits
42873 * @returns {!Long} Shifted Long
42874 */
42875 LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
42876 if (isLong(numBits))
42877 numBits = numBits.toInt();
42878 numBits &= 63;
42879 if (numBits === 0)
42880 return this;
42881 else {
42882 var high = this.high;
42883 if (numBits < 32) {
42884 var low = this.low;
42885 return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);
42886 } else if (numBits === 32)
42887 return fromBits(high, 0, this.unsigned);
42888 else
42889 return fromBits(high >>> (numBits - 32), 0, this.unsigned);
42890 }
42891 };
42892
42893 /**
42894 * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
42895 * @function
42896 * @param {number|!Long} numBits Number of bits
42897 * @returns {!Long} Shifted Long
42898 */
42899 LongPrototype.shru = LongPrototype.shiftRightUnsigned;
42900
42901 /**
42902 * Converts this Long to signed.
42903 * @returns {!Long} Signed long
42904 */
42905 LongPrototype.toSigned = function toSigned() {
42906 if (!this.unsigned)
42907 return this;
42908 return fromBits(this.low, this.high, false);
42909 };
42910
42911 /**
42912 * Converts this Long to unsigned.
42913 * @returns {!Long} Unsigned long
42914 */
42915 LongPrototype.toUnsigned = function toUnsigned() {
42916 if (this.unsigned)
42917 return this;
42918 return fromBits(this.low, this.high, true);
42919 };
42920
42921 /**
42922 * Converts this Long to its byte representation.
42923 * @param {boolean=} le Whether little or big endian, defaults to big endian
42924 * @returns {!Array.<number>} Byte representation
42925 */
42926 LongPrototype.toBytes = function(le) {
42927 return le ? this.toBytesLE() : this.toBytesBE();
42928 }
42929
42930 /**
42931 * Converts this Long to its little endian byte representation.
42932 * @returns {!Array.<number>} Little endian byte representation
42933 */
42934 LongPrototype.toBytesLE = function() {
42935 var hi = this.high,
42936 lo = this.low;
42937 return [
42938 lo & 0xff,
42939 (lo >>> 8) & 0xff,
42940 (lo >>> 16) & 0xff,
42941 (lo >>> 24) & 0xff,
42942 hi & 0xff,
42943 (hi >>> 8) & 0xff,
42944 (hi >>> 16) & 0xff,
42945 (hi >>> 24) & 0xff
42946 ];
42947 }
42948
42949 /**
42950 * Converts this Long to its big endian byte representation.
42951 * @returns {!Array.<number>} Big endian byte representation
42952 */
42953 LongPrototype.toBytesBE = function() {
42954 var hi = this.high,
42955 lo = this.low;
42956 return [
42957 (hi >>> 24) & 0xff,
42958 (hi >>> 16) & 0xff,
42959 (hi >>> 8) & 0xff,
42960 hi & 0xff,
42961 (lo >>> 24) & 0xff,
42962 (lo >>> 16) & 0xff,
42963 (lo >>> 8) & 0xff,
42964 lo & 0xff
42965 ];
42966 }
42967
42968 return Long;
42969});
42970
42971
42972/***/ }),
42973/* 657 */
42974/***/ (function(module, exports) {
42975
42976/* (ignored) */
42977
42978/***/ }),
42979/* 658 */
42980/***/ (function(module, exports, __webpack_require__) {
42981
42982"use strict";
42983
42984
42985var _interopRequireDefault = __webpack_require__(1);
42986
42987var _slice = _interopRequireDefault(__webpack_require__(34));
42988
42989var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(267));
42990
42991var _concat = _interopRequireDefault(__webpack_require__(19));
42992
42993var has = Object.prototype.hasOwnProperty,
42994 prefix = '~';
42995/**
42996 * Constructor to create a storage for our `EE` objects.
42997 * An `Events` instance is a plain object whose properties are event names.
42998 *
42999 * @constructor
43000 * @private
43001 */
43002
43003function Events() {} //
43004// We try to not inherit from `Object.prototype`. In some engines creating an
43005// instance in this way is faster than calling `Object.create(null)` directly.
43006// If `Object.create(null)` is not supported we prefix the event names with a
43007// character to make sure that the built-in object properties are not
43008// overridden or used as an attack vector.
43009//
43010
43011
43012if (Object.create) {
43013 Events.prototype = Object.create(null); //
43014 // This hack is needed because the `__proto__` property is still inherited in
43015 // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
43016 //
43017
43018 if (!new Events().__proto__) prefix = false;
43019}
43020/**
43021 * Representation of a single event listener.
43022 *
43023 * @param {Function} fn The listener function.
43024 * @param {*} context The context to invoke the listener with.
43025 * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
43026 * @constructor
43027 * @private
43028 */
43029
43030
43031function EE(fn, context, once) {
43032 this.fn = fn;
43033 this.context = context;
43034 this.once = once || false;
43035}
43036/**
43037 * Add a listener for a given event.
43038 *
43039 * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
43040 * @param {(String|Symbol)} event The event name.
43041 * @param {Function} fn The listener function.
43042 * @param {*} context The context to invoke the listener with.
43043 * @param {Boolean} once Specify if the listener is a one-time listener.
43044 * @returns {EventEmitter}
43045 * @private
43046 */
43047
43048
43049function addListener(emitter, event, fn, context, once) {
43050 if (typeof fn !== 'function') {
43051 throw new TypeError('The listener must be a function');
43052 }
43053
43054 var listener = new EE(fn, context || emitter, once),
43055 evt = prefix ? prefix + event : event;
43056 if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);else emitter._events[evt] = [emitter._events[evt], listener];
43057 return emitter;
43058}
43059/**
43060 * Clear event by name.
43061 *
43062 * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
43063 * @param {(String|Symbol)} evt The Event name.
43064 * @private
43065 */
43066
43067
43068function clearEvent(emitter, evt) {
43069 if (--emitter._eventsCount === 0) emitter._events = new Events();else delete emitter._events[evt];
43070}
43071/**
43072 * Minimal `EventEmitter` interface that is molded against the Node.js
43073 * `EventEmitter` interface.
43074 *
43075 * @constructor
43076 * @public
43077 */
43078
43079
43080function EventEmitter() {
43081 this._events = new Events();
43082 this._eventsCount = 0;
43083}
43084/**
43085 * Return an array listing the events for which the emitter has registered
43086 * listeners.
43087 *
43088 * @returns {Array}
43089 * @public
43090 */
43091
43092
43093EventEmitter.prototype.eventNames = function eventNames() {
43094 var names = [],
43095 events,
43096 name;
43097 if (this._eventsCount === 0) return names;
43098
43099 for (name in events = this._events) {
43100 if (has.call(events, name)) names.push(prefix ? (0, _slice.default)(name).call(name, 1) : name);
43101 }
43102
43103 if (_getOwnPropertySymbols.default) {
43104 return (0, _concat.default)(names).call(names, (0, _getOwnPropertySymbols.default)(events));
43105 }
43106
43107 return names;
43108};
43109/**
43110 * Return the listeners registered for a given event.
43111 *
43112 * @param {(String|Symbol)} event The event name.
43113 * @returns {Array} The registered listeners.
43114 * @public
43115 */
43116
43117
43118EventEmitter.prototype.listeners = function listeners(event) {
43119 var evt = prefix ? prefix + event : event,
43120 handlers = this._events[evt];
43121 if (!handlers) return [];
43122 if (handlers.fn) return [handlers.fn];
43123
43124 for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
43125 ee[i] = handlers[i].fn;
43126 }
43127
43128 return ee;
43129};
43130/**
43131 * Return the number of listeners listening to a given event.
43132 *
43133 * @param {(String|Symbol)} event The event name.
43134 * @returns {Number} The number of listeners.
43135 * @public
43136 */
43137
43138
43139EventEmitter.prototype.listenerCount = function listenerCount(event) {
43140 var evt = prefix ? prefix + event : event,
43141 listeners = this._events[evt];
43142 if (!listeners) return 0;
43143 if (listeners.fn) return 1;
43144 return listeners.length;
43145};
43146/**
43147 * Calls each of the listeners registered for a given event.
43148 *
43149 * @param {(String|Symbol)} event The event name.
43150 * @returns {Boolean} `true` if the event had listeners, else `false`.
43151 * @public
43152 */
43153
43154
43155EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
43156 var evt = prefix ? prefix + event : event;
43157 if (!this._events[evt]) return false;
43158 var listeners = this._events[evt],
43159 len = arguments.length,
43160 args,
43161 i;
43162
43163 if (listeners.fn) {
43164 if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
43165
43166 switch (len) {
43167 case 1:
43168 return listeners.fn.call(listeners.context), true;
43169
43170 case 2:
43171 return listeners.fn.call(listeners.context, a1), true;
43172
43173 case 3:
43174 return listeners.fn.call(listeners.context, a1, a2), true;
43175
43176 case 4:
43177 return listeners.fn.call(listeners.context, a1, a2, a3), true;
43178
43179 case 5:
43180 return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
43181
43182 case 6:
43183 return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
43184 }
43185
43186 for (i = 1, args = new Array(len - 1); i < len; i++) {
43187 args[i - 1] = arguments[i];
43188 }
43189
43190 listeners.fn.apply(listeners.context, args);
43191 } else {
43192 var length = listeners.length,
43193 j;
43194
43195 for (i = 0; i < length; i++) {
43196 if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
43197
43198 switch (len) {
43199 case 1:
43200 listeners[i].fn.call(listeners[i].context);
43201 break;
43202
43203 case 2:
43204 listeners[i].fn.call(listeners[i].context, a1);
43205 break;
43206
43207 case 3:
43208 listeners[i].fn.call(listeners[i].context, a1, a2);
43209 break;
43210
43211 case 4:
43212 listeners[i].fn.call(listeners[i].context, a1, a2, a3);
43213 break;
43214
43215 default:
43216 if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) {
43217 args[j - 1] = arguments[j];
43218 }
43219 listeners[i].fn.apply(listeners[i].context, args);
43220 }
43221 }
43222 }
43223
43224 return true;
43225};
43226/**
43227 * Add a listener for a given event.
43228 *
43229 * @param {(String|Symbol)} event The event name.
43230 * @param {Function} fn The listener function.
43231 * @param {*} [context=this] The context to invoke the listener with.
43232 * @returns {EventEmitter} `this`.
43233 * @public
43234 */
43235
43236
43237EventEmitter.prototype.on = function on(event, fn, context) {
43238 return addListener(this, event, fn, context, false);
43239};
43240/**
43241 * Add a one-time listener for a given event.
43242 *
43243 * @param {(String|Symbol)} event The event name.
43244 * @param {Function} fn The listener function.
43245 * @param {*} [context=this] The context to invoke the listener with.
43246 * @returns {EventEmitter} `this`.
43247 * @public
43248 */
43249
43250
43251EventEmitter.prototype.once = function once(event, fn, context) {
43252 return addListener(this, event, fn, context, true);
43253};
43254/**
43255 * Remove the listeners of a given event.
43256 *
43257 * @param {(String|Symbol)} event The event name.
43258 * @param {Function} fn Only remove the listeners that match this function.
43259 * @param {*} context Only remove the listeners that have this context.
43260 * @param {Boolean} once Only remove one-time listeners.
43261 * @returns {EventEmitter} `this`.
43262 * @public
43263 */
43264
43265
43266EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
43267 var evt = prefix ? prefix + event : event;
43268 if (!this._events[evt]) return this;
43269
43270 if (!fn) {
43271 clearEvent(this, evt);
43272 return this;
43273 }
43274
43275 var listeners = this._events[evt];
43276
43277 if (listeners.fn) {
43278 if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
43279 clearEvent(this, evt);
43280 }
43281 } else {
43282 for (var i = 0, events = [], length = listeners.length; i < length; i++) {
43283 if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) {
43284 events.push(listeners[i]);
43285 }
43286 } //
43287 // Reset the array, or remove it completely if we have no more listeners.
43288 //
43289
43290
43291 if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;else clearEvent(this, evt);
43292 }
43293
43294 return this;
43295};
43296/**
43297 * Remove all listeners, or those of the specified event.
43298 *
43299 * @param {(String|Symbol)} [event] The event name.
43300 * @returns {EventEmitter} `this`.
43301 * @public
43302 */
43303
43304
43305EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
43306 var evt;
43307
43308 if (event) {
43309 evt = prefix ? prefix + event : event;
43310 if (this._events[evt]) clearEvent(this, evt);
43311 } else {
43312 this._events = new Events();
43313 this._eventsCount = 0;
43314 }
43315
43316 return this;
43317}; //
43318// Alias methods names because people roll like that.
43319//
43320
43321
43322EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
43323EventEmitter.prototype.addListener = EventEmitter.prototype.on; //
43324// Expose the prefix.
43325//
43326
43327EventEmitter.prefixed = prefix; //
43328// Allow `EventEmitter` to be imported as module namespace.
43329//
43330
43331EventEmitter.EventEmitter = EventEmitter; //
43332// Expose the module.
43333//
43334
43335if (true) {
43336 module.exports = EventEmitter;
43337}
43338
43339/***/ }),
43340/* 659 */
43341/***/ (function(module, exports) {
43342
43343function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
43344 try {
43345 var info = gen[key](arg);
43346 var value = info.value;
43347 } catch (error) {
43348 reject(error);
43349 return;
43350 }
43351 if (info.done) {
43352 resolve(value);
43353 } else {
43354 Promise.resolve(value).then(_next, _throw);
43355 }
43356}
43357function _asyncToGenerator(fn) {
43358 return function () {
43359 var self = this,
43360 args = arguments;
43361 return new Promise(function (resolve, reject) {
43362 var gen = fn.apply(self, args);
43363 function _next(value) {
43364 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
43365 }
43366 function _throw(err) {
43367 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
43368 }
43369 _next(undefined);
43370 });
43371 };
43372}
43373module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
43374
43375/***/ }),
43376/* 660 */
43377/***/ (function(module, exports, __webpack_require__) {
43378
43379var arrayWithoutHoles = __webpack_require__(661);
43380var iterableToArray = __webpack_require__(271);
43381var unsupportedIterableToArray = __webpack_require__(272);
43382var nonIterableSpread = __webpack_require__(662);
43383function _toConsumableArray(arr) {
43384 return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
43385}
43386module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
43387
43388/***/ }),
43389/* 661 */
43390/***/ (function(module, exports, __webpack_require__) {
43391
43392var arrayLikeToArray = __webpack_require__(270);
43393function _arrayWithoutHoles(arr) {
43394 if (Array.isArray(arr)) return arrayLikeToArray(arr);
43395}
43396module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
43397
43398/***/ }),
43399/* 662 */
43400/***/ (function(module, exports) {
43401
43402function _nonIterableSpread() {
43403 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
43404}
43405module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
43406
43407/***/ }),
43408/* 663 */
43409/***/ (function(module, exports, __webpack_require__) {
43410
43411var toPropertyKey = __webpack_require__(273);
43412function _defineProperty(obj, key, value) {
43413 key = toPropertyKey(key);
43414 if (key in obj) {
43415 Object.defineProperty(obj, key, {
43416 value: value,
43417 enumerable: true,
43418 configurable: true,
43419 writable: true
43420 });
43421 } else {
43422 obj[key] = value;
43423 }
43424 return obj;
43425}
43426module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
43427
43428/***/ }),
43429/* 664 */
43430/***/ (function(module, exports, __webpack_require__) {
43431
43432var _typeof = __webpack_require__(119)["default"];
43433function _toPrimitive(input, hint) {
43434 if (_typeof(input) !== "object" || input === null) return input;
43435 var prim = input[Symbol.toPrimitive];
43436 if (prim !== undefined) {
43437 var res = prim.call(input, hint || "default");
43438 if (_typeof(res) !== "object") return res;
43439 throw new TypeError("@@toPrimitive must return a primitive value.");
43440 }
43441 return (hint === "string" ? String : Number)(input);
43442}
43443module.exports = _toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
43444
43445/***/ }),
43446/* 665 */
43447/***/ (function(module, exports, __webpack_require__) {
43448
43449var objectWithoutPropertiesLoose = __webpack_require__(666);
43450function _objectWithoutProperties(source, excluded) {
43451 if (source == null) return {};
43452 var target = objectWithoutPropertiesLoose(source, excluded);
43453 var key, i;
43454 if (Object.getOwnPropertySymbols) {
43455 var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
43456 for (i = 0; i < sourceSymbolKeys.length; i++) {
43457 key = sourceSymbolKeys[i];
43458 if (excluded.indexOf(key) >= 0) continue;
43459 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
43460 target[key] = source[key];
43461 }
43462 }
43463 return target;
43464}
43465module.exports = _objectWithoutProperties, module.exports.__esModule = true, module.exports["default"] = module.exports;
43466
43467/***/ }),
43468/* 666 */
43469/***/ (function(module, exports) {
43470
43471function _objectWithoutPropertiesLoose(source, excluded) {
43472 if (source == null) return {};
43473 var target = {};
43474 var sourceKeys = Object.keys(source);
43475 var key, i;
43476 for (i = 0; i < sourceKeys.length; i++) {
43477 key = sourceKeys[i];
43478 if (excluded.indexOf(key) >= 0) continue;
43479 target[key] = source[key];
43480 }
43481 return target;
43482}
43483module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
43484
43485/***/ }),
43486/* 667 */
43487/***/ (function(module, exports) {
43488
43489function _assertThisInitialized(self) {
43490 if (self === void 0) {
43491 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
43492 }
43493 return self;
43494}
43495module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
43496
43497/***/ }),
43498/* 668 */
43499/***/ (function(module, exports, __webpack_require__) {
43500
43501var setPrototypeOf = __webpack_require__(669);
43502function _inheritsLoose(subClass, superClass) {
43503 subClass.prototype = Object.create(superClass.prototype);
43504 subClass.prototype.constructor = subClass;
43505 setPrototypeOf(subClass, superClass);
43506}
43507module.exports = _inheritsLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
43508
43509/***/ }),
43510/* 669 */
43511/***/ (function(module, exports) {
43512
43513function _setPrototypeOf(o, p) {
43514 module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
43515 o.__proto__ = p;
43516 return o;
43517 }, module.exports.__esModule = true, module.exports["default"] = module.exports;
43518 return _setPrototypeOf(o, p);
43519}
43520module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
43521
43522/***/ }),
43523/* 670 */
43524/***/ (function(module, exports, __webpack_require__) {
43525
43526// TODO(Babel 8): Remove this file.
43527
43528var runtime = __webpack_require__(671)();
43529module.exports = runtime;
43530
43531// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
43532try {
43533 regeneratorRuntime = runtime;
43534} catch (accidentalStrictMode) {
43535 if (typeof globalThis === "object") {
43536 globalThis.regeneratorRuntime = runtime;
43537 } else {
43538 Function("r", "regeneratorRuntime = r")(runtime);
43539 }
43540}
43541
43542
43543/***/ }),
43544/* 671 */
43545/***/ (function(module, exports, __webpack_require__) {
43546
43547var _typeof = __webpack_require__(119)["default"];
43548function _regeneratorRuntime() {
43549 "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
43550 module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
43551 return e;
43552 }, module.exports.__esModule = true, module.exports["default"] = module.exports;
43553 var t,
43554 e = {},
43555 r = Object.prototype,
43556 n = r.hasOwnProperty,
43557 o = Object.defineProperty || function (t, e, r) {
43558 t[e] = r.value;
43559 },
43560 i = "function" == typeof Symbol ? Symbol : {},
43561 a = i.iterator || "@@iterator",
43562 c = i.asyncIterator || "@@asyncIterator",
43563 u = i.toStringTag || "@@toStringTag";
43564 function define(t, e, r) {
43565 return Object.defineProperty(t, e, {
43566 value: r,
43567 enumerable: !0,
43568 configurable: !0,
43569 writable: !0
43570 }), t[e];
43571 }
43572 try {
43573 define({}, "");
43574 } catch (t) {
43575 define = function define(t, e, r) {
43576 return t[e] = r;
43577 };
43578 }
43579 function wrap(t, e, r, n) {
43580 var i = e && e.prototype instanceof Generator ? e : Generator,
43581 a = Object.create(i.prototype),
43582 c = new Context(n || []);
43583 return o(a, "_invoke", {
43584 value: makeInvokeMethod(t, r, c)
43585 }), a;
43586 }
43587 function tryCatch(t, e, r) {
43588 try {
43589 return {
43590 type: "normal",
43591 arg: t.call(e, r)
43592 };
43593 } catch (t) {
43594 return {
43595 type: "throw",
43596 arg: t
43597 };
43598 }
43599 }
43600 e.wrap = wrap;
43601 var h = "suspendedStart",
43602 l = "suspendedYield",
43603 f = "executing",
43604 s = "completed",
43605 y = {};
43606 function Generator() {}
43607 function GeneratorFunction() {}
43608 function GeneratorFunctionPrototype() {}
43609 var p = {};
43610 define(p, a, function () {
43611 return this;
43612 });
43613 var d = Object.getPrototypeOf,
43614 v = d && d(d(values([])));
43615 v && v !== r && n.call(v, a) && (p = v);
43616 var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
43617 function defineIteratorMethods(t) {
43618 ["next", "throw", "return"].forEach(function (e) {
43619 define(t, e, function (t) {
43620 return this._invoke(e, t);
43621 });
43622 });
43623 }
43624 function AsyncIterator(t, e) {
43625 function invoke(r, o, i, a) {
43626 var c = tryCatch(t[r], t, o);
43627 if ("throw" !== c.type) {
43628 var u = c.arg,
43629 h = u.value;
43630 return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
43631 invoke("next", t, i, a);
43632 }, function (t) {
43633 invoke("throw", t, i, a);
43634 }) : e.resolve(h).then(function (t) {
43635 u.value = t, i(u);
43636 }, function (t) {
43637 return invoke("throw", t, i, a);
43638 });
43639 }
43640 a(c.arg);
43641 }
43642 var r;
43643 o(this, "_invoke", {
43644 value: function value(t, n) {
43645 function callInvokeWithMethodAndArg() {
43646 return new e(function (e, r) {
43647 invoke(t, n, e, r);
43648 });
43649 }
43650 return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
43651 }
43652 });
43653 }
43654 function makeInvokeMethod(e, r, n) {
43655 var o = h;
43656 return function (i, a) {
43657 if (o === f) throw new Error("Generator is already running");
43658 if (o === s) {
43659 if ("throw" === i) throw a;
43660 return {
43661 value: t,
43662 done: !0
43663 };
43664 }
43665 for (n.method = i, n.arg = a;;) {
43666 var c = n.delegate;
43667 if (c) {
43668 var u = maybeInvokeDelegate(c, n);
43669 if (u) {
43670 if (u === y) continue;
43671 return u;
43672 }
43673 }
43674 if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
43675 if (o === h) throw o = s, n.arg;
43676 n.dispatchException(n.arg);
43677 } else "return" === n.method && n.abrupt("return", n.arg);
43678 o = f;
43679 var p = tryCatch(e, r, n);
43680 if ("normal" === p.type) {
43681 if (o = n.done ? s : l, p.arg === y) continue;
43682 return {
43683 value: p.arg,
43684 done: n.done
43685 };
43686 }
43687 "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
43688 }
43689 };
43690 }
43691 function maybeInvokeDelegate(e, r) {
43692 var n = r.method,
43693 o = e.iterator[n];
43694 if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
43695 var i = tryCatch(o, e.iterator, r.arg);
43696 if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
43697 var a = i.arg;
43698 return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
43699 }
43700 function pushTryEntry(t) {
43701 var e = {
43702 tryLoc: t[0]
43703 };
43704 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
43705 }
43706 function resetTryEntry(t) {
43707 var e = t.completion || {};
43708 e.type = "normal", delete e.arg, t.completion = e;
43709 }
43710 function Context(t) {
43711 this.tryEntries = [{
43712 tryLoc: "root"
43713 }], t.forEach(pushTryEntry, this), this.reset(!0);
43714 }
43715 function values(e) {
43716 if (e || "" === e) {
43717 var r = e[a];
43718 if (r) return r.call(e);
43719 if ("function" == typeof e.next) return e;
43720 if (!isNaN(e.length)) {
43721 var o = -1,
43722 i = function next() {
43723 for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
43724 return next.value = t, next.done = !0, next;
43725 };
43726 return i.next = i;
43727 }
43728 }
43729 throw new TypeError(_typeof(e) + " is not iterable");
43730 }
43731 return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
43732 value: GeneratorFunctionPrototype,
43733 configurable: !0
43734 }), o(GeneratorFunctionPrototype, "constructor", {
43735 value: GeneratorFunction,
43736 configurable: !0
43737 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
43738 var e = "function" == typeof t && t.constructor;
43739 return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
43740 }, e.mark = function (t) {
43741 return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
43742 }, e.awrap = function (t) {
43743 return {
43744 __await: t
43745 };
43746 }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
43747 return this;
43748 }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
43749 void 0 === i && (i = Promise);
43750 var a = new AsyncIterator(wrap(t, r, n, o), i);
43751 return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
43752 return t.done ? t.value : a.next();
43753 });
43754 }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
43755 return this;
43756 }), define(g, "toString", function () {
43757 return "[object Generator]";
43758 }), e.keys = function (t) {
43759 var e = Object(t),
43760 r = [];
43761 for (var n in e) r.push(n);
43762 return r.reverse(), function next() {
43763 for (; r.length;) {
43764 var t = r.pop();
43765 if (t in e) return next.value = t, next.done = !1, next;
43766 }
43767 return next.done = !0, next;
43768 };
43769 }, e.values = values, Context.prototype = {
43770 constructor: Context,
43771 reset: function reset(e) {
43772 if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
43773 },
43774 stop: function stop() {
43775 this.done = !0;
43776 var t = this.tryEntries[0].completion;
43777 if ("throw" === t.type) throw t.arg;
43778 return this.rval;
43779 },
43780 dispatchException: function dispatchException(e) {
43781 if (this.done) throw e;
43782 var r = this;
43783 function handle(n, o) {
43784 return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
43785 }
43786 for (var o = this.tryEntries.length - 1; o >= 0; --o) {
43787 var i = this.tryEntries[o],
43788 a = i.completion;
43789 if ("root" === i.tryLoc) return handle("end");
43790 if (i.tryLoc <= this.prev) {
43791 var c = n.call(i, "catchLoc"),
43792 u = n.call(i, "finallyLoc");
43793 if (c && u) {
43794 if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
43795 if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
43796 } else if (c) {
43797 if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
43798 } else {
43799 if (!u) throw new Error("try statement without catch or finally");
43800 if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
43801 }
43802 }
43803 }
43804 },
43805 abrupt: function abrupt(t, e) {
43806 for (var r = this.tryEntries.length - 1; r >= 0; --r) {
43807 var o = this.tryEntries[r];
43808 if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
43809 var i = o;
43810 break;
43811 }
43812 }
43813 i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
43814 var a = i ? i.completion : {};
43815 return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
43816 },
43817 complete: function complete(t, e) {
43818 if ("throw" === t.type) throw t.arg;
43819 return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
43820 },
43821 finish: function finish(t) {
43822 for (var e = this.tryEntries.length - 1; e >= 0; --e) {
43823 var r = this.tryEntries[e];
43824 if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
43825 }
43826 },
43827 "catch": function _catch(t) {
43828 for (var e = this.tryEntries.length - 1; e >= 0; --e) {
43829 var r = this.tryEntries[e];
43830 if (r.tryLoc === t) {
43831 var n = r.completion;
43832 if ("throw" === n.type) {
43833 var o = n.arg;
43834 resetTryEntry(r);
43835 }
43836 return o;
43837 }
43838 }
43839 throw new Error("illegal catch attempt");
43840 },
43841 delegateYield: function delegateYield(e, r, n) {
43842 return this.delegate = {
43843 iterator: values(e),
43844 resultName: r,
43845 nextLoc: n
43846 }, "next" === this.method && (this.arg = t), y;
43847 }
43848 }, e;
43849}
43850module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
43851
43852/***/ }),
43853/* 672 */
43854/***/ (function(module, exports, __webpack_require__) {
43855
43856var arrayShuffle = __webpack_require__(673),
43857 baseShuffle = __webpack_require__(676),
43858 isArray = __webpack_require__(279);
43859
43860/**
43861 * Creates an array of shuffled values, using a version of the
43862 * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
43863 *
43864 * @static
43865 * @memberOf _
43866 * @since 0.1.0
43867 * @category Collection
43868 * @param {Array|Object} collection The collection to shuffle.
43869 * @returns {Array} Returns the new shuffled array.
43870 * @example
43871 *
43872 * _.shuffle([1, 2, 3, 4]);
43873 * // => [4, 1, 3, 2]
43874 */
43875function shuffle(collection) {
43876 var func = isArray(collection) ? arrayShuffle : baseShuffle;
43877 return func(collection);
43878}
43879
43880module.exports = shuffle;
43881
43882
43883/***/ }),
43884/* 673 */
43885/***/ (function(module, exports, __webpack_require__) {
43886
43887var copyArray = __webpack_require__(674),
43888 shuffleSelf = __webpack_require__(274);
43889
43890/**
43891 * A specialized version of `_.shuffle` for arrays.
43892 *
43893 * @private
43894 * @param {Array} array The array to shuffle.
43895 * @returns {Array} Returns the new shuffled array.
43896 */
43897function arrayShuffle(array) {
43898 return shuffleSelf(copyArray(array));
43899}
43900
43901module.exports = arrayShuffle;
43902
43903
43904/***/ }),
43905/* 674 */
43906/***/ (function(module, exports) {
43907
43908/**
43909 * Copies the values of `source` to `array`.
43910 *
43911 * @private
43912 * @param {Array} source The array to copy values from.
43913 * @param {Array} [array=[]] The array to copy values to.
43914 * @returns {Array} Returns `array`.
43915 */
43916function copyArray(source, array) {
43917 var index = -1,
43918 length = source.length;
43919
43920 array || (array = Array(length));
43921 while (++index < length) {
43922 array[index] = source[index];
43923 }
43924 return array;
43925}
43926
43927module.exports = copyArray;
43928
43929
43930/***/ }),
43931/* 675 */
43932/***/ (function(module, exports) {
43933
43934/* Built-in method references for those with the same name as other `lodash` methods. */
43935var nativeFloor = Math.floor,
43936 nativeRandom = Math.random;
43937
43938/**
43939 * The base implementation of `_.random` without support for returning
43940 * floating-point numbers.
43941 *
43942 * @private
43943 * @param {number} lower The lower bound.
43944 * @param {number} upper The upper bound.
43945 * @returns {number} Returns the random number.
43946 */
43947function baseRandom(lower, upper) {
43948 return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
43949}
43950
43951module.exports = baseRandom;
43952
43953
43954/***/ }),
43955/* 676 */
43956/***/ (function(module, exports, __webpack_require__) {
43957
43958var shuffleSelf = __webpack_require__(274),
43959 values = __webpack_require__(275);
43960
43961/**
43962 * The base implementation of `_.shuffle`.
43963 *
43964 * @private
43965 * @param {Array|Object} collection The collection to shuffle.
43966 * @returns {Array} Returns the new shuffled array.
43967 */
43968function baseShuffle(collection) {
43969 return shuffleSelf(values(collection));
43970}
43971
43972module.exports = baseShuffle;
43973
43974
43975/***/ }),
43976/* 677 */
43977/***/ (function(module, exports, __webpack_require__) {
43978
43979var arrayMap = __webpack_require__(678);
43980
43981/**
43982 * The base implementation of `_.values` and `_.valuesIn` which creates an
43983 * array of `object` property values corresponding to the property names
43984 * of `props`.
43985 *
43986 * @private
43987 * @param {Object} object The object to query.
43988 * @param {Array} props The property names to get values for.
43989 * @returns {Object} Returns the array of property values.
43990 */
43991function baseValues(object, props) {
43992 return arrayMap(props, function(key) {
43993 return object[key];
43994 });
43995}
43996
43997module.exports = baseValues;
43998
43999
44000/***/ }),
44001/* 678 */
44002/***/ (function(module, exports) {
44003
44004/**
44005 * A specialized version of `_.map` for arrays without support for iteratee
44006 * shorthands.
44007 *
44008 * @private
44009 * @param {Array} [array] The array to iterate over.
44010 * @param {Function} iteratee The function invoked per iteration.
44011 * @returns {Array} Returns the new mapped array.
44012 */
44013function arrayMap(array, iteratee) {
44014 var index = -1,
44015 length = array == null ? 0 : array.length,
44016 result = Array(length);
44017
44018 while (++index < length) {
44019 result[index] = iteratee(array[index], index, array);
44020 }
44021 return result;
44022}
44023
44024module.exports = arrayMap;
44025
44026
44027/***/ }),
44028/* 679 */
44029/***/ (function(module, exports, __webpack_require__) {
44030
44031var arrayLikeKeys = __webpack_require__(680),
44032 baseKeys = __webpack_require__(693),
44033 isArrayLike = __webpack_require__(696);
44034
44035/**
44036 * Creates an array of the own enumerable property names of `object`.
44037 *
44038 * **Note:** Non-object values are coerced to objects. See the
44039 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
44040 * for more details.
44041 *
44042 * @static
44043 * @since 0.1.0
44044 * @memberOf _
44045 * @category Object
44046 * @param {Object} object The object to query.
44047 * @returns {Array} Returns the array of property names.
44048 * @example
44049 *
44050 * function Foo() {
44051 * this.a = 1;
44052 * this.b = 2;
44053 * }
44054 *
44055 * Foo.prototype.c = 3;
44056 *
44057 * _.keys(new Foo);
44058 * // => ['a', 'b'] (iteration order is not guaranteed)
44059 *
44060 * _.keys('hi');
44061 * // => ['0', '1']
44062 */
44063function keys(object) {
44064 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
44065}
44066
44067module.exports = keys;
44068
44069
44070/***/ }),
44071/* 680 */
44072/***/ (function(module, exports, __webpack_require__) {
44073
44074var baseTimes = __webpack_require__(681),
44075 isArguments = __webpack_require__(682),
44076 isArray = __webpack_require__(279),
44077 isBuffer = __webpack_require__(686),
44078 isIndex = __webpack_require__(688),
44079 isTypedArray = __webpack_require__(689);
44080
44081/** Used for built-in method references. */
44082var objectProto = Object.prototype;
44083
44084/** Used to check objects for own properties. */
44085var hasOwnProperty = objectProto.hasOwnProperty;
44086
44087/**
44088 * Creates an array of the enumerable property names of the array-like `value`.
44089 *
44090 * @private
44091 * @param {*} value The value to query.
44092 * @param {boolean} inherited Specify returning inherited property names.
44093 * @returns {Array} Returns the array of property names.
44094 */
44095function arrayLikeKeys(value, inherited) {
44096 var isArr = isArray(value),
44097 isArg = !isArr && isArguments(value),
44098 isBuff = !isArr && !isArg && isBuffer(value),
44099 isType = !isArr && !isArg && !isBuff && isTypedArray(value),
44100 skipIndexes = isArr || isArg || isBuff || isType,
44101 result = skipIndexes ? baseTimes(value.length, String) : [],
44102 length = result.length;
44103
44104 for (var key in value) {
44105 if ((inherited || hasOwnProperty.call(value, key)) &&
44106 !(skipIndexes && (
44107 // Safari 9 has enumerable `arguments.length` in strict mode.
44108 key == 'length' ||
44109 // Node.js 0.10 has enumerable non-index properties on buffers.
44110 (isBuff && (key == 'offset' || key == 'parent')) ||
44111 // PhantomJS 2 has enumerable non-index properties on typed arrays.
44112 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
44113 // Skip index properties.
44114 isIndex(key, length)
44115 ))) {
44116 result.push(key);
44117 }
44118 }
44119 return result;
44120}
44121
44122module.exports = arrayLikeKeys;
44123
44124
44125/***/ }),
44126/* 681 */
44127/***/ (function(module, exports) {
44128
44129/**
44130 * The base implementation of `_.times` without support for iteratee shorthands
44131 * or max array length checks.
44132 *
44133 * @private
44134 * @param {number} n The number of times to invoke `iteratee`.
44135 * @param {Function} iteratee The function invoked per iteration.
44136 * @returns {Array} Returns the array of results.
44137 */
44138function baseTimes(n, iteratee) {
44139 var index = -1,
44140 result = Array(n);
44141
44142 while (++index < n) {
44143 result[index] = iteratee(index);
44144 }
44145 return result;
44146}
44147
44148module.exports = baseTimes;
44149
44150
44151/***/ }),
44152/* 682 */
44153/***/ (function(module, exports, __webpack_require__) {
44154
44155var baseIsArguments = __webpack_require__(683),
44156 isObjectLike = __webpack_require__(121);
44157
44158/** Used for built-in method references. */
44159var objectProto = Object.prototype;
44160
44161/** Used to check objects for own properties. */
44162var hasOwnProperty = objectProto.hasOwnProperty;
44163
44164/** Built-in value references. */
44165var propertyIsEnumerable = objectProto.propertyIsEnumerable;
44166
44167/**
44168 * Checks if `value` is likely an `arguments` object.
44169 *
44170 * @static
44171 * @memberOf _
44172 * @since 0.1.0
44173 * @category Lang
44174 * @param {*} value The value to check.
44175 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
44176 * else `false`.
44177 * @example
44178 *
44179 * _.isArguments(function() { return arguments; }());
44180 * // => true
44181 *
44182 * _.isArguments([1, 2, 3]);
44183 * // => false
44184 */
44185var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
44186 return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
44187 !propertyIsEnumerable.call(value, 'callee');
44188};
44189
44190module.exports = isArguments;
44191
44192
44193/***/ }),
44194/* 683 */
44195/***/ (function(module, exports, __webpack_require__) {
44196
44197var baseGetTag = __webpack_require__(120),
44198 isObjectLike = __webpack_require__(121);
44199
44200/** `Object#toString` result references. */
44201var argsTag = '[object Arguments]';
44202
44203/**
44204 * The base implementation of `_.isArguments`.
44205 *
44206 * @private
44207 * @param {*} value The value to check.
44208 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
44209 */
44210function baseIsArguments(value) {
44211 return isObjectLike(value) && baseGetTag(value) == argsTag;
44212}
44213
44214module.exports = baseIsArguments;
44215
44216
44217/***/ }),
44218/* 684 */
44219/***/ (function(module, exports, __webpack_require__) {
44220
44221var Symbol = __webpack_require__(276);
44222
44223/** Used for built-in method references. */
44224var objectProto = Object.prototype;
44225
44226/** Used to check objects for own properties. */
44227var hasOwnProperty = objectProto.hasOwnProperty;
44228
44229/**
44230 * Used to resolve the
44231 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
44232 * of values.
44233 */
44234var nativeObjectToString = objectProto.toString;
44235
44236/** Built-in value references. */
44237var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
44238
44239/**
44240 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
44241 *
44242 * @private
44243 * @param {*} value The value to query.
44244 * @returns {string} Returns the raw `toStringTag`.
44245 */
44246function getRawTag(value) {
44247 var isOwn = hasOwnProperty.call(value, symToStringTag),
44248 tag = value[symToStringTag];
44249
44250 try {
44251 value[symToStringTag] = undefined;
44252 var unmasked = true;
44253 } catch (e) {}
44254
44255 var result = nativeObjectToString.call(value);
44256 if (unmasked) {
44257 if (isOwn) {
44258 value[symToStringTag] = tag;
44259 } else {
44260 delete value[symToStringTag];
44261 }
44262 }
44263 return result;
44264}
44265
44266module.exports = getRawTag;
44267
44268
44269/***/ }),
44270/* 685 */
44271/***/ (function(module, exports) {
44272
44273/** Used for built-in method references. */
44274var objectProto = Object.prototype;
44275
44276/**
44277 * Used to resolve the
44278 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
44279 * of values.
44280 */
44281var nativeObjectToString = objectProto.toString;
44282
44283/**
44284 * Converts `value` to a string using `Object.prototype.toString`.
44285 *
44286 * @private
44287 * @param {*} value The value to convert.
44288 * @returns {string} Returns the converted string.
44289 */
44290function objectToString(value) {
44291 return nativeObjectToString.call(value);
44292}
44293
44294module.exports = objectToString;
44295
44296
44297/***/ }),
44298/* 686 */
44299/***/ (function(module, exports, __webpack_require__) {
44300
44301/* WEBPACK VAR INJECTION */(function(module) {var root = __webpack_require__(277),
44302 stubFalse = __webpack_require__(687);
44303
44304/** Detect free variable `exports`. */
44305var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
44306
44307/** Detect free variable `module`. */
44308var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
44309
44310/** Detect the popular CommonJS extension `module.exports`. */
44311var moduleExports = freeModule && freeModule.exports === freeExports;
44312
44313/** Built-in value references. */
44314var Buffer = moduleExports ? root.Buffer : undefined;
44315
44316/* Built-in method references for those with the same name as other `lodash` methods. */
44317var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
44318
44319/**
44320 * Checks if `value` is a buffer.
44321 *
44322 * @static
44323 * @memberOf _
44324 * @since 4.3.0
44325 * @category Lang
44326 * @param {*} value The value to check.
44327 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
44328 * @example
44329 *
44330 * _.isBuffer(new Buffer(2));
44331 * // => true
44332 *
44333 * _.isBuffer(new Uint8Array(2));
44334 * // => false
44335 */
44336var isBuffer = nativeIsBuffer || stubFalse;
44337
44338module.exports = isBuffer;
44339
44340/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(280)(module)))
44341
44342/***/ }),
44343/* 687 */
44344/***/ (function(module, exports) {
44345
44346/**
44347 * This method returns `false`.
44348 *
44349 * @static
44350 * @memberOf _
44351 * @since 4.13.0
44352 * @category Util
44353 * @returns {boolean} Returns `false`.
44354 * @example
44355 *
44356 * _.times(2, _.stubFalse);
44357 * // => [false, false]
44358 */
44359function stubFalse() {
44360 return false;
44361}
44362
44363module.exports = stubFalse;
44364
44365
44366/***/ }),
44367/* 688 */
44368/***/ (function(module, exports) {
44369
44370/** Used as references for various `Number` constants. */
44371var MAX_SAFE_INTEGER = 9007199254740991;
44372
44373/** Used to detect unsigned integer values. */
44374var reIsUint = /^(?:0|[1-9]\d*)$/;
44375
44376/**
44377 * Checks if `value` is a valid array-like index.
44378 *
44379 * @private
44380 * @param {*} value The value to check.
44381 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
44382 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
44383 */
44384function isIndex(value, length) {
44385 var type = typeof value;
44386 length = length == null ? MAX_SAFE_INTEGER : length;
44387
44388 return !!length &&
44389 (type == 'number' ||
44390 (type != 'symbol' && reIsUint.test(value))) &&
44391 (value > -1 && value % 1 == 0 && value < length);
44392}
44393
44394module.exports = isIndex;
44395
44396
44397/***/ }),
44398/* 689 */
44399/***/ (function(module, exports, __webpack_require__) {
44400
44401var baseIsTypedArray = __webpack_require__(690),
44402 baseUnary = __webpack_require__(691),
44403 nodeUtil = __webpack_require__(692);
44404
44405/* Node.js helper references. */
44406var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
44407
44408/**
44409 * Checks if `value` is classified as a typed array.
44410 *
44411 * @static
44412 * @memberOf _
44413 * @since 3.0.0
44414 * @category Lang
44415 * @param {*} value The value to check.
44416 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
44417 * @example
44418 *
44419 * _.isTypedArray(new Uint8Array);
44420 * // => true
44421 *
44422 * _.isTypedArray([]);
44423 * // => false
44424 */
44425var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
44426
44427module.exports = isTypedArray;
44428
44429
44430/***/ }),
44431/* 690 */
44432/***/ (function(module, exports, __webpack_require__) {
44433
44434var baseGetTag = __webpack_require__(120),
44435 isLength = __webpack_require__(281),
44436 isObjectLike = __webpack_require__(121);
44437
44438/** `Object#toString` result references. */
44439var argsTag = '[object Arguments]',
44440 arrayTag = '[object Array]',
44441 boolTag = '[object Boolean]',
44442 dateTag = '[object Date]',
44443 errorTag = '[object Error]',
44444 funcTag = '[object Function]',
44445 mapTag = '[object Map]',
44446 numberTag = '[object Number]',
44447 objectTag = '[object Object]',
44448 regexpTag = '[object RegExp]',
44449 setTag = '[object Set]',
44450 stringTag = '[object String]',
44451 weakMapTag = '[object WeakMap]';
44452
44453var arrayBufferTag = '[object ArrayBuffer]',
44454 dataViewTag = '[object DataView]',
44455 float32Tag = '[object Float32Array]',
44456 float64Tag = '[object Float64Array]',
44457 int8Tag = '[object Int8Array]',
44458 int16Tag = '[object Int16Array]',
44459 int32Tag = '[object Int32Array]',
44460 uint8Tag = '[object Uint8Array]',
44461 uint8ClampedTag = '[object Uint8ClampedArray]',
44462 uint16Tag = '[object Uint16Array]',
44463 uint32Tag = '[object Uint32Array]';
44464
44465/** Used to identify `toStringTag` values of typed arrays. */
44466var typedArrayTags = {};
44467typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
44468typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
44469typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
44470typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
44471typedArrayTags[uint32Tag] = true;
44472typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
44473typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
44474typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
44475typedArrayTags[errorTag] = typedArrayTags[funcTag] =
44476typedArrayTags[mapTag] = typedArrayTags[numberTag] =
44477typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
44478typedArrayTags[setTag] = typedArrayTags[stringTag] =
44479typedArrayTags[weakMapTag] = false;
44480
44481/**
44482 * The base implementation of `_.isTypedArray` without Node.js optimizations.
44483 *
44484 * @private
44485 * @param {*} value The value to check.
44486 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
44487 */
44488function baseIsTypedArray(value) {
44489 return isObjectLike(value) &&
44490 isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
44491}
44492
44493module.exports = baseIsTypedArray;
44494
44495
44496/***/ }),
44497/* 691 */
44498/***/ (function(module, exports) {
44499
44500/**
44501 * The base implementation of `_.unary` without support for storing metadata.
44502 *
44503 * @private
44504 * @param {Function} func The function to cap arguments for.
44505 * @returns {Function} Returns the new capped function.
44506 */
44507function baseUnary(func) {
44508 return function(value) {
44509 return func(value);
44510 };
44511}
44512
44513module.exports = baseUnary;
44514
44515
44516/***/ }),
44517/* 692 */
44518/***/ (function(module, exports, __webpack_require__) {
44519
44520/* WEBPACK VAR INJECTION */(function(module) {var freeGlobal = __webpack_require__(278);
44521
44522/** Detect free variable `exports`. */
44523var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
44524
44525/** Detect free variable `module`. */
44526var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
44527
44528/** Detect the popular CommonJS extension `module.exports`. */
44529var moduleExports = freeModule && freeModule.exports === freeExports;
44530
44531/** Detect free variable `process` from Node.js. */
44532var freeProcess = moduleExports && freeGlobal.process;
44533
44534/** Used to access faster Node.js helpers. */
44535var nodeUtil = (function() {
44536 try {
44537 // Use `util.types` for Node.js 10+.
44538 var types = freeModule && freeModule.require && freeModule.require('util').types;
44539
44540 if (types) {
44541 return types;
44542 }
44543
44544 // Legacy `process.binding('util')` for Node.js < 10.
44545 return freeProcess && freeProcess.binding && freeProcess.binding('util');
44546 } catch (e) {}
44547}());
44548
44549module.exports = nodeUtil;
44550
44551/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(280)(module)))
44552
44553/***/ }),
44554/* 693 */
44555/***/ (function(module, exports, __webpack_require__) {
44556
44557var isPrototype = __webpack_require__(694),
44558 nativeKeys = __webpack_require__(695);
44559
44560/** Used for built-in method references. */
44561var objectProto = Object.prototype;
44562
44563/** Used to check objects for own properties. */
44564var hasOwnProperty = objectProto.hasOwnProperty;
44565
44566/**
44567 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
44568 *
44569 * @private
44570 * @param {Object} object The object to query.
44571 * @returns {Array} Returns the array of property names.
44572 */
44573function baseKeys(object) {
44574 if (!isPrototype(object)) {
44575 return nativeKeys(object);
44576 }
44577 var result = [];
44578 for (var key in Object(object)) {
44579 if (hasOwnProperty.call(object, key) && key != 'constructor') {
44580 result.push(key);
44581 }
44582 }
44583 return result;
44584}
44585
44586module.exports = baseKeys;
44587
44588
44589/***/ }),
44590/* 694 */
44591/***/ (function(module, exports) {
44592
44593/** Used for built-in method references. */
44594var objectProto = Object.prototype;
44595
44596/**
44597 * Checks if `value` is likely a prototype object.
44598 *
44599 * @private
44600 * @param {*} value The value to check.
44601 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
44602 */
44603function isPrototype(value) {
44604 var Ctor = value && value.constructor,
44605 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
44606
44607 return value === proto;
44608}
44609
44610module.exports = isPrototype;
44611
44612
44613/***/ }),
44614/* 695 */
44615/***/ (function(module, exports, __webpack_require__) {
44616
44617var overArg = __webpack_require__(282);
44618
44619/* Built-in method references for those with the same name as other `lodash` methods. */
44620var nativeKeys = overArg(Object.keys, Object);
44621
44622module.exports = nativeKeys;
44623
44624
44625/***/ }),
44626/* 696 */
44627/***/ (function(module, exports, __webpack_require__) {
44628
44629var isFunction = __webpack_require__(697),
44630 isLength = __webpack_require__(281);
44631
44632/**
44633 * Checks if `value` is array-like. A value is considered array-like if it's
44634 * not a function and has a `value.length` that's an integer greater than or
44635 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
44636 *
44637 * @static
44638 * @memberOf _
44639 * @since 4.0.0
44640 * @category Lang
44641 * @param {*} value The value to check.
44642 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
44643 * @example
44644 *
44645 * _.isArrayLike([1, 2, 3]);
44646 * // => true
44647 *
44648 * _.isArrayLike(document.body.children);
44649 * // => true
44650 *
44651 * _.isArrayLike('abc');
44652 * // => true
44653 *
44654 * _.isArrayLike(_.noop);
44655 * // => false
44656 */
44657function isArrayLike(value) {
44658 return value != null && isLength(value.length) && !isFunction(value);
44659}
44660
44661module.exports = isArrayLike;
44662
44663
44664/***/ }),
44665/* 697 */
44666/***/ (function(module, exports, __webpack_require__) {
44667
44668var baseGetTag = __webpack_require__(120),
44669 isObject = __webpack_require__(698);
44670
44671/** `Object#toString` result references. */
44672var asyncTag = '[object AsyncFunction]',
44673 funcTag = '[object Function]',
44674 genTag = '[object GeneratorFunction]',
44675 proxyTag = '[object Proxy]';
44676
44677/**
44678 * Checks if `value` is classified as a `Function` object.
44679 *
44680 * @static
44681 * @memberOf _
44682 * @since 0.1.0
44683 * @category Lang
44684 * @param {*} value The value to check.
44685 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
44686 * @example
44687 *
44688 * _.isFunction(_);
44689 * // => true
44690 *
44691 * _.isFunction(/abc/);
44692 * // => false
44693 */
44694function isFunction(value) {
44695 if (!isObject(value)) {
44696 return false;
44697 }
44698 // The use of `Object#toString` avoids issues with the `typeof` operator
44699 // in Safari 9 which returns 'object' for typed arrays and other constructors.
44700 var tag = baseGetTag(value);
44701 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
44702}
44703
44704module.exports = isFunction;
44705
44706
44707/***/ }),
44708/* 698 */
44709/***/ (function(module, exports) {
44710
44711/**
44712 * Checks if `value` is the
44713 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
44714 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
44715 *
44716 * @static
44717 * @memberOf _
44718 * @since 0.1.0
44719 * @category Lang
44720 * @param {*} value The value to check.
44721 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
44722 * @example
44723 *
44724 * _.isObject({});
44725 * // => true
44726 *
44727 * _.isObject([1, 2, 3]);
44728 * // => true
44729 *
44730 * _.isObject(_.noop);
44731 * // => true
44732 *
44733 * _.isObject(null);
44734 * // => false
44735 */
44736function isObject(value) {
44737 var type = typeof value;
44738 return value != null && (type == 'object' || type == 'function');
44739}
44740
44741module.exports = isObject;
44742
44743
44744/***/ }),
44745/* 699 */
44746/***/ (function(module, exports, __webpack_require__) {
44747
44748var arrayWithHoles = __webpack_require__(700);
44749var iterableToArray = __webpack_require__(271);
44750var unsupportedIterableToArray = __webpack_require__(272);
44751var nonIterableRest = __webpack_require__(701);
44752function _toArray(arr) {
44753 return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest();
44754}
44755module.exports = _toArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
44756
44757/***/ }),
44758/* 700 */
44759/***/ (function(module, exports) {
44760
44761function _arrayWithHoles(arr) {
44762 if (Array.isArray(arr)) return arr;
44763}
44764module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
44765
44766/***/ }),
44767/* 701 */
44768/***/ (function(module, exports) {
44769
44770function _nonIterableRest() {
44771 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
44772}
44773module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
44774
44775/***/ }),
44776/* 702 */
44777/***/ (function(module, exports, __webpack_require__) {
44778
44779var toPropertyKey = __webpack_require__(273);
44780function _defineProperties(target, props) {
44781 for (var i = 0; i < props.length; i++) {
44782 var descriptor = props[i];
44783 descriptor.enumerable = descriptor.enumerable || false;
44784 descriptor.configurable = true;
44785 if ("value" in descriptor) descriptor.writable = true;
44786 Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
44787 }
44788}
44789function _createClass(Constructor, protoProps, staticProps) {
44790 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
44791 if (staticProps) _defineProperties(Constructor, staticProps);
44792 Object.defineProperty(Constructor, "prototype", {
44793 writable: false
44794 });
44795 return Constructor;
44796}
44797module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
44798
44799/***/ }),
44800/* 703 */
44801/***/ (function(module, exports) {
44802
44803function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
44804 var desc = {};
44805 Object.keys(descriptor).forEach(function (key) {
44806 desc[key] = descriptor[key];
44807 });
44808 desc.enumerable = !!desc.enumerable;
44809 desc.configurable = !!desc.configurable;
44810 if ('value' in desc || desc.initializer) {
44811 desc.writable = true;
44812 }
44813 desc = decorators.slice().reverse().reduce(function (desc, decorator) {
44814 return decorator(target, property, desc) || desc;
44815 }, desc);
44816 if (context && desc.initializer !== void 0) {
44817 desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
44818 desc.initializer = undefined;
44819 }
44820 if (desc.initializer === void 0) {
44821 Object.defineProperty(target, property, desc);
44822 desc = null;
44823 }
44824 return desc;
44825}
44826module.exports = _applyDecoratedDescriptor, module.exports.__esModule = true, module.exports["default"] = module.exports;
44827
44828/***/ }),
44829/* 704 */
44830/***/ (function(module, exports, __webpack_require__) {
44831
44832/*
44833
44834 Javascript State Machine Library - https://github.com/jakesgordon/javascript-state-machine
44835
44836 Copyright (c) 2012, 2013, 2014, 2015, Jake Gordon and contributors
44837 Released under the MIT license - https://github.com/jakesgordon/javascript-state-machine/blob/master/LICENSE
44838
44839*/
44840
44841(function () {
44842
44843 var StateMachine = {
44844
44845 //---------------------------------------------------------------------------
44846
44847 VERSION: "2.4.0",
44848
44849 //---------------------------------------------------------------------------
44850
44851 Result: {
44852 SUCCEEDED: 1, // the event transitioned successfully from one state to another
44853 NOTRANSITION: 2, // the event was successfull but no state transition was necessary
44854 CANCELLED: 3, // the event was cancelled by the caller in a beforeEvent callback
44855 PENDING: 4 // the event is asynchronous and the caller is in control of when the transition occurs
44856 },
44857
44858 Error: {
44859 INVALID_TRANSITION: 100, // caller tried to fire an event that was innapropriate in the current state
44860 PENDING_TRANSITION: 200, // caller tried to fire an event while an async transition was still pending
44861 INVALID_CALLBACK: 300 // caller provided callback function threw an exception
44862 },
44863
44864 WILDCARD: '*',
44865 ASYNC: 'async',
44866
44867 //---------------------------------------------------------------------------
44868
44869 create: function(cfg, target) {
44870
44871 var initial = (typeof cfg.initial == 'string') ? { state: cfg.initial } : cfg.initial; // allow for a simple string, or an object with { state: 'foo', event: 'setup', defer: true|false }
44872 var terminal = cfg.terminal || cfg['final'];
44873 var fsm = target || cfg.target || {};
44874 var events = cfg.events || [];
44875 var callbacks = cfg.callbacks || {};
44876 var map = {}; // track state transitions allowed for an event { event: { from: [ to ] } }
44877 var transitions = {}; // track events allowed from a state { state: [ event ] }
44878
44879 var add = function(e) {
44880 var from = Array.isArray(e.from) ? e.from : (e.from ? [e.from] : [StateMachine.WILDCARD]); // allow 'wildcard' transition if 'from' is not specified
44881 map[e.name] = map[e.name] || {};
44882 for (var n = 0 ; n < from.length ; n++) {
44883 transitions[from[n]] = transitions[from[n]] || [];
44884 transitions[from[n]].push(e.name);
44885
44886 map[e.name][from[n]] = e.to || from[n]; // allow no-op transition if 'to' is not specified
44887 }
44888 if (e.to)
44889 transitions[e.to] = transitions[e.to] || [];
44890 };
44891
44892 if (initial) {
44893 initial.event = initial.event || 'startup';
44894 add({ name: initial.event, from: 'none', to: initial.state });
44895 }
44896
44897 for(var n = 0 ; n < events.length ; n++)
44898 add(events[n]);
44899
44900 for(var name in map) {
44901 if (map.hasOwnProperty(name))
44902 fsm[name] = StateMachine.buildEvent(name, map[name]);
44903 }
44904
44905 for(var name in callbacks) {
44906 if (callbacks.hasOwnProperty(name))
44907 fsm[name] = callbacks[name]
44908 }
44909
44910 fsm.current = 'none';
44911 fsm.is = function(state) { return Array.isArray(state) ? (state.indexOf(this.current) >= 0) : (this.current === state); };
44912 fsm.can = function(event) { return !this.transition && (map[event] !== undefined) && (map[event].hasOwnProperty(this.current) || map[event].hasOwnProperty(StateMachine.WILDCARD)); }
44913 fsm.cannot = function(event) { return !this.can(event); };
44914 fsm.transitions = function() { return (transitions[this.current] || []).concat(transitions[StateMachine.WILDCARD] || []); };
44915 fsm.isFinished = function() { return this.is(terminal); };
44916 fsm.error = cfg.error || function(name, from, to, args, error, msg, e) { throw e || msg; }; // default behavior when something unexpected happens is to throw an exception, but caller can override this behavior if desired (see github issue #3 and #17)
44917 fsm.states = function() { return Object.keys(transitions).sort() };
44918
44919 if (initial && !initial.defer)
44920 fsm[initial.event]();
44921
44922 return fsm;
44923
44924 },
44925
44926 //===========================================================================
44927
44928 doCallback: function(fsm, func, name, from, to, args) {
44929 if (func) {
44930 try {
44931 return func.apply(fsm, [name, from, to].concat(args));
44932 }
44933 catch(e) {
44934 return fsm.error(name, from, to, args, StateMachine.Error.INVALID_CALLBACK, "an exception occurred in a caller-provided callback function", e);
44935 }
44936 }
44937 },
44938
44939 beforeAnyEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onbeforeevent'], name, from, to, args); },
44940 afterAnyEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onafterevent'] || fsm['onevent'], name, from, to, args); },
44941 leaveAnyState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onleavestate'], name, from, to, args); },
44942 enterAnyState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onenterstate'] || fsm['onstate'], name, from, to, args); },
44943 changeState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onchangestate'], name, from, to, args); },
44944
44945 beforeThisEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onbefore' + name], name, from, to, args); },
44946 afterThisEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onafter' + name] || fsm['on' + name], name, from, to, args); },
44947 leaveThisState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onleave' + from], name, from, to, args); },
44948 enterThisState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onenter' + to] || fsm['on' + to], name, from, to, args); },
44949
44950 beforeEvent: function(fsm, name, from, to, args) {
44951 if ((false === StateMachine.beforeThisEvent(fsm, name, from, to, args)) ||
44952 (false === StateMachine.beforeAnyEvent( fsm, name, from, to, args)))
44953 return false;
44954 },
44955
44956 afterEvent: function(fsm, name, from, to, args) {
44957 StateMachine.afterThisEvent(fsm, name, from, to, args);
44958 StateMachine.afterAnyEvent( fsm, name, from, to, args);
44959 },
44960
44961 leaveState: function(fsm, name, from, to, args) {
44962 var specific = StateMachine.leaveThisState(fsm, name, from, to, args),
44963 general = StateMachine.leaveAnyState( fsm, name, from, to, args);
44964 if ((false === specific) || (false === general))
44965 return false;
44966 else if ((StateMachine.ASYNC === specific) || (StateMachine.ASYNC === general))
44967 return StateMachine.ASYNC;
44968 },
44969
44970 enterState: function(fsm, name, from, to, args) {
44971 StateMachine.enterThisState(fsm, name, from, to, args);
44972 StateMachine.enterAnyState( fsm, name, from, to, args);
44973 },
44974
44975 //===========================================================================
44976
44977 buildEvent: function(name, map) {
44978 return function() {
44979
44980 var from = this.current;
44981 var to = map[from] || (map[StateMachine.WILDCARD] != StateMachine.WILDCARD ? map[StateMachine.WILDCARD] : from) || from;
44982 var args = Array.prototype.slice.call(arguments); // turn arguments into pure array
44983
44984 if (this.transition)
44985 return this.error(name, from, to, args, StateMachine.Error.PENDING_TRANSITION, "event " + name + " inappropriate because previous transition did not complete");
44986
44987 if (this.cannot(name))
44988 return this.error(name, from, to, args, StateMachine.Error.INVALID_TRANSITION, "event " + name + " inappropriate in current state " + this.current);
44989
44990 if (false === StateMachine.beforeEvent(this, name, from, to, args))
44991 return StateMachine.Result.CANCELLED;
44992
44993 if (from === to) {
44994 StateMachine.afterEvent(this, name, from, to, args);
44995 return StateMachine.Result.NOTRANSITION;
44996 }
44997
44998 // prepare a transition method for use EITHER lower down, or by caller if they want an async transition (indicated by an ASYNC return value from leaveState)
44999 var fsm = this;
45000 this.transition = function() {
45001 fsm.transition = null; // this method should only ever be called once
45002 fsm.current = to;
45003 StateMachine.enterState( fsm, name, from, to, args);
45004 StateMachine.changeState(fsm, name, from, to, args);
45005 StateMachine.afterEvent( fsm, name, from, to, args);
45006 return StateMachine.Result.SUCCEEDED;
45007 };
45008 this.transition.cancel = function() { // provide a way for caller to cancel async transition if desired (issue #22)
45009 fsm.transition = null;
45010 StateMachine.afterEvent(fsm, name, from, to, args);
45011 }
45012
45013 var leave = StateMachine.leaveState(this, name, from, to, args);
45014 if (false === leave) {
45015 this.transition = null;
45016 return StateMachine.Result.CANCELLED;
45017 }
45018 else if (StateMachine.ASYNC === leave) {
45019 return StateMachine.Result.PENDING;
45020 }
45021 else {
45022 if (this.transition) // need to check in case user manually called transition() but forgot to return StateMachine.ASYNC
45023 return this.transition();
45024 }
45025
45026 };
45027 }
45028
45029 }; // StateMachine
45030
45031 //===========================================================================
45032
45033 //======
45034 // NODE
45035 //======
45036 if (true) {
45037 if (typeof module !== 'undefined' && module.exports) {
45038 exports = module.exports = StateMachine;
45039 }
45040 exports.StateMachine = StateMachine;
45041 }
45042 //============
45043 // AMD/REQUIRE
45044 //============
45045 else if (typeof define === 'function' && define.amd) {
45046 define(function(require) { return StateMachine; });
45047 }
45048 //========
45049 // BROWSER
45050 //========
45051 else if (typeof window !== 'undefined') {
45052 window.StateMachine = StateMachine;
45053 }
45054 //===========
45055 // WEB WORKER
45056 //===========
45057 else if (typeof self !== 'undefined') {
45058 self.StateMachine = StateMachine;
45059 }
45060
45061}());
45062
45063
45064/***/ }),
45065/* 705 */
45066/***/ (function(module, exports, __webpack_require__) {
45067
45068var baseGetTag = __webpack_require__(120),
45069 getPrototype = __webpack_require__(706),
45070 isObjectLike = __webpack_require__(121);
45071
45072/** `Object#toString` result references. */
45073var objectTag = '[object Object]';
45074
45075/** Used for built-in method references. */
45076var funcProto = Function.prototype,
45077 objectProto = Object.prototype;
45078
45079/** Used to resolve the decompiled source of functions. */
45080var funcToString = funcProto.toString;
45081
45082/** Used to check objects for own properties. */
45083var hasOwnProperty = objectProto.hasOwnProperty;
45084
45085/** Used to infer the `Object` constructor. */
45086var objectCtorString = funcToString.call(Object);
45087
45088/**
45089 * Checks if `value` is a plain object, that is, an object created by the
45090 * `Object` constructor or one with a `[[Prototype]]` of `null`.
45091 *
45092 * @static
45093 * @memberOf _
45094 * @since 0.8.0
45095 * @category Lang
45096 * @param {*} value The value to check.
45097 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
45098 * @example
45099 *
45100 * function Foo() {
45101 * this.a = 1;
45102 * }
45103 *
45104 * _.isPlainObject(new Foo);
45105 * // => false
45106 *
45107 * _.isPlainObject([1, 2, 3]);
45108 * // => false
45109 *
45110 * _.isPlainObject({ 'x': 0, 'y': 0 });
45111 * // => true
45112 *
45113 * _.isPlainObject(Object.create(null));
45114 * // => true
45115 */
45116function isPlainObject(value) {
45117 if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
45118 return false;
45119 }
45120 var proto = getPrototype(value);
45121 if (proto === null) {
45122 return true;
45123 }
45124 var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
45125 return typeof Ctor == 'function' && Ctor instanceof Ctor &&
45126 funcToString.call(Ctor) == objectCtorString;
45127}
45128
45129module.exports = isPlainObject;
45130
45131
45132/***/ }),
45133/* 706 */
45134/***/ (function(module, exports, __webpack_require__) {
45135
45136var overArg = __webpack_require__(282);
45137
45138/** Built-in value references. */
45139var getPrototype = overArg(Object.getPrototypeOf, Object);
45140
45141module.exports = getPrototype;
45142
45143
45144/***/ }),
45145/* 707 */
45146/***/ (function(module, exports, __webpack_require__) {
45147
45148"use strict";
45149var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
45150
45151var _interopRequireDefault = __webpack_require__(1);
45152
45153var _isIterable2 = _interopRequireDefault(__webpack_require__(263));
45154
45155var _from = _interopRequireDefault(__webpack_require__(153));
45156
45157var _set = _interopRequireDefault(__webpack_require__(269));
45158
45159var _concat = _interopRequireDefault(__webpack_require__(19));
45160
45161var _assign = _interopRequireDefault(__webpack_require__(266));
45162
45163var _map = _interopRequireDefault(__webpack_require__(37));
45164
45165var _defineProperty = _interopRequireDefault(__webpack_require__(94));
45166
45167var _typeof2 = _interopRequireDefault(__webpack_require__(95));
45168
45169(function (global, factory) {
45170 ( false ? "undefined" : (0, _typeof2.default)(exports)) === 'object' && typeof module !== 'undefined' ? factory(exports, __webpack_require__(156)) : true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(156)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
45171 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
45172 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
45173 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : (global = global || self, factory(global.AV = global.AV || {}, global.AV));
45174})(void 0, function (exports, core) {
45175 'use strict';
45176
45177 function _inheritsLoose(subClass, superClass) {
45178 subClass.prototype = Object.create(superClass.prototype);
45179 subClass.prototype.constructor = subClass;
45180 subClass.__proto__ = superClass;
45181 }
45182
45183 function _toConsumableArray(arr) {
45184 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
45185 }
45186
45187 function _arrayWithoutHoles(arr) {
45188 if (Array.isArray(arr)) {
45189 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
45190 arr2[i] = arr[i];
45191 }
45192
45193 return arr2;
45194 }
45195 }
45196
45197 function _iterableToArray(iter) {
45198 if ((0, _isIterable2.default)(Object(iter)) || Object.prototype.toString.call(iter) === "[object Arguments]") return (0, _from.default)(iter);
45199 }
45200
45201 function _nonIterableSpread() {
45202 throw new TypeError("Invalid attempt to spread non-iterable instance");
45203 }
45204 /* eslint-disable import/no-unresolved */
45205
45206
45207 if (!core.Protocals) {
45208 throw new Error('LeanCloud Realtime SDK not installed');
45209 }
45210
45211 var CommandType = core.Protocals.CommandType,
45212 GenericCommand = core.Protocals.GenericCommand,
45213 AckCommand = core.Protocals.AckCommand;
45214
45215 var warn = function warn(error) {
45216 return console.warn(error.message);
45217 };
45218
45219 var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
45220 _inheritsLoose(LiveQueryClient, _EventEmitter);
45221
45222 function LiveQueryClient(appId, subscriptionId, connection) {
45223 var _this;
45224
45225 _this = _EventEmitter.call(this) || this;
45226 _this._appId = appId;
45227 _this.id = subscriptionId;
45228 _this._connection = connection;
45229 _this._eventemitter = new core.EventEmitter();
45230 _this._querys = new _set.default();
45231 return _this;
45232 }
45233
45234 var _proto = LiveQueryClient.prototype;
45235
45236 _proto._send = function _send(cmd) {
45237 var _context;
45238
45239 var _this$_connection;
45240
45241 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
45242 args[_key - 1] = arguments[_key];
45243 }
45244
45245 return (_this$_connection = this._connection).send.apply(_this$_connection, (0, _concat.default)(_context = [(0, _assign.default)(cmd, {
45246 appId: this._appId,
45247 installationId: this.id,
45248 service: 1
45249 })]).call(_context, args));
45250 };
45251
45252 _proto._open = function _open() {
45253 return this._send(new GenericCommand({
45254 cmd: CommandType.login
45255 }));
45256 };
45257
45258 _proto.close = function close() {
45259 var _ee = this._eventemitter;
45260
45261 _ee.emit('beforeclose');
45262
45263 return this._send(new GenericCommand({
45264 cmd: CommandType.logout
45265 })).then(function () {
45266 return _ee.emit('close');
45267 });
45268 };
45269
45270 _proto.register = function register(liveQuery) {
45271 this._querys.add(liveQuery);
45272 };
45273
45274 _proto.deregister = function deregister(liveQuery) {
45275 var _this2 = this;
45276
45277 this._querys.delete(liveQuery);
45278
45279 setTimeout(function () {
45280 if (!_this2._querys.size) _this2.close().catch(warn);
45281 }, 0);
45282 };
45283
45284 _proto._dispatchCommand = function _dispatchCommand(command) {
45285 if (command.cmd !== CommandType.data) {
45286 this.emit('unhandledmessage', command);
45287 return core.Promise.resolve();
45288 }
45289
45290 return this._dispatchDataCommand(command);
45291 };
45292
45293 _proto._dispatchDataCommand = function _dispatchDataCommand(_ref) {
45294 var _ref$dataMessage = _ref.dataMessage,
45295 ids = _ref$dataMessage.ids,
45296 msg = _ref$dataMessage.msg;
45297 this.emit('message', (0, _map.default)(msg).call(msg, function (_ref2) {
45298 var data = _ref2.data;
45299 return JSON.parse(data);
45300 })); // send ack
45301
45302 var command = new GenericCommand({
45303 cmd: CommandType.ack,
45304 ackMessage: new AckCommand({
45305 ids: ids
45306 })
45307 });
45308 return this._send(command, false).catch(warn);
45309 };
45310
45311 return LiveQueryClient;
45312 }(core.EventEmitter);
45313
45314 var finalize = function finalize(callback) {
45315 return [// eslint-disable-next-line no-sequences
45316 function (value) {
45317 return callback(), value;
45318 }, function (error) {
45319 callback();
45320 throw error;
45321 }];
45322 };
45323
45324 var onRealtimeCreate = function onRealtimeCreate(realtime) {
45325 /* eslint-disable no-param-reassign */
45326 realtime._liveQueryClients = {};
45327
45328 realtime.createLiveQueryClient = function (subscriptionId) {
45329 var _realtime$_open$then;
45330
45331 if (realtime._liveQueryClients[subscriptionId] !== undefined) {
45332 return core.Promise.resolve(realtime._liveQueryClients[subscriptionId]);
45333 }
45334
45335 var promise = (_realtime$_open$then = realtime._open().then(function (connection) {
45336 var client = new LiveQueryClient(realtime._options.appId, subscriptionId, connection);
45337 connection.on('reconnect', function () {
45338 return client._open().then(function () {
45339 return client.emit('reconnect');
45340 }, function (error) {
45341 return client.emit('reconnecterror', error);
45342 });
45343 });
45344
45345 client._eventemitter.on('beforeclose', function () {
45346 delete realtime._liveQueryClients[client.id];
45347 }, realtime);
45348
45349 client._eventemitter.on('close', function () {
45350 realtime._deregister(client);
45351 }, realtime);
45352
45353 return client._open().then(function () {
45354 realtime._liveQueryClients[client.id] = client;
45355
45356 realtime._register(client);
45357
45358 return client;
45359 });
45360 })).then.apply(_realtime$_open$then, _toConsumableArray(finalize(function () {
45361 if (realtime._deregisterPending) realtime._deregisterPending(promise);
45362 })));
45363
45364 realtime._liveQueryClients[subscriptionId] = promise;
45365 if (realtime._registerPending) realtime._registerPending(promise);
45366 return promise;
45367 };
45368 /* eslint-enable no-param-reassign */
45369
45370 };
45371
45372 var beforeCommandDispatch = function beforeCommandDispatch(command, realtime) {
45373 var isLiveQueryCommand = command.installationId && command.service === 1;
45374 if (!isLiveQueryCommand) return true;
45375 var targetClient = realtime._liveQueryClients[command.installationId];
45376
45377 if (targetClient) {
45378 targetClient._dispatchCommand(command).catch(function (error) {
45379 return console.warn(error);
45380 });
45381 } else {
45382 console.warn('Unexpected message received without any live client match: %O', command);
45383 }
45384
45385 return false;
45386 }; // eslint-disable-next-line import/prefer-default-export
45387
45388
45389 var LiveQueryPlugin = {
45390 name: 'leancloud-realtime-plugin-live-query',
45391 onRealtimeCreate: onRealtimeCreate,
45392 beforeCommandDispatch: beforeCommandDispatch
45393 };
45394 exports.LiveQueryPlugin = LiveQueryPlugin;
45395 (0, _defineProperty.default)(exports, '__esModule', {
45396 value: true
45397 });
45398});
45399
45400/***/ })
45401/******/ ]);
45402});
45403//# sourceMappingURL=av-live-query.js.map
\No newline at end of file