UNPKG

1.41 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 = 272);
74/******/ })
75/************************************************************************/
76/******/ ([
77/* 0 */
78/***/ (function(module, exports, __webpack_require__) {
79
80"use strict";
81
82var global = __webpack_require__(7);
83var apply = __webpack_require__(73);
84var uncurryThis = __webpack_require__(4);
85var isCallable = __webpack_require__(8);
86var getOwnPropertyDescriptor = __webpack_require__(60).f;
87var isForced = __webpack_require__(153);
88var path = __webpack_require__(6);
89var bind = __webpack_require__(48);
90var createNonEnumerableProperty = __webpack_require__(37);
91var hasOwn = __webpack_require__(12);
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__(312);
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__(131);
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__(74);
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, __webpack_exports__, __webpack_require__) {
407
408"use strict";
409/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return VERSION; });
410/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return root; });
411/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ArrayProto; });
412/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ObjProto; });
413/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return SymbolProto; });
414/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return push; });
415/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return slice; });
416/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return toString; });
417/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return hasOwnProperty; });
418/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return supportsArrayBuffer; });
419/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return supportsDataView; });
420/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return nativeIsArray; });
421/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return nativeKeys; });
422/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return nativeCreate; });
423/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return nativeIsView; });
424/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return _isNaN; });
425/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return _isFinite; });
426/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return hasEnumBug; });
427/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return nonEnumerableProps; });
428/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return MAX_ARRAY_INDEX; });
429// Current version.
430var VERSION = '1.12.1';
431
432// Establish the root object, `window` (`self`) in the browser, `global`
433// on the server, or `this` in some virtual machines. We use `self`
434// instead of `window` for `WebWorker` support.
435var root = typeof self == 'object' && self.self === self && self ||
436 typeof global == 'object' && global.global === global && global ||
437 Function('return this')() ||
438 {};
439
440// Save bytes in the minified (but not gzipped) version:
441var ArrayProto = Array.prototype, ObjProto = Object.prototype;
442var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null;
443
444// Create quick reference variables for speed access to core prototypes.
445var push = ArrayProto.push,
446 slice = ArrayProto.slice,
447 toString = ObjProto.toString,
448 hasOwnProperty = ObjProto.hasOwnProperty;
449
450// Modern feature detection.
451var supportsArrayBuffer = typeof ArrayBuffer !== 'undefined',
452 supportsDataView = typeof DataView !== 'undefined';
453
454// All **ECMAScript 5+** native function implementations that we hope to use
455// are declared here.
456var nativeIsArray = Array.isArray,
457 nativeKeys = Object.keys,
458 nativeCreate = Object.create,
459 nativeIsView = supportsArrayBuffer && ArrayBuffer.isView;
460
461// Create references to these builtin functions because we override them.
462var _isNaN = isNaN,
463 _isFinite = isFinite;
464
465// Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
466var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');
467var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',
468 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];
469
470// The largest integer that can be represented exactly.
471var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
472
473/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(72)))
474
475/***/ }),
476/* 6 */
477/***/ (function(module, exports) {
478
479module.exports = {};
480
481
482/***/ }),
483/* 7 */
484/***/ (function(module, exports, __webpack_require__) {
485
486/* WEBPACK VAR INJECTION */(function(global) {var check = function (it) {
487 return it && it.Math == Math && it;
488};
489
490// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
491module.exports =
492 // eslint-disable-next-line es-x/no-global-this -- safe
493 check(typeof globalThis == 'object' && globalThis) ||
494 check(typeof window == 'object' && window) ||
495 // eslint-disable-next-line no-restricted-globals -- safe
496 check(typeof self == 'object' && self) ||
497 check(typeof global == 'object' && global) ||
498 // eslint-disable-next-line no-new-func -- fallback
499 (function () { return this; })() || Function('return this')();
500
501/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(72)))
502
503/***/ }),
504/* 8 */
505/***/ (function(module, exports) {
506
507// `IsCallable` abstract operation
508// https://tc39.es/ecma262/#sec-iscallable
509module.exports = function (argument) {
510 return typeof argument == 'function';
511};
512
513
514/***/ }),
515/* 9 */
516/***/ (function(module, exports, __webpack_require__) {
517
518var global = __webpack_require__(7);
519var shared = __webpack_require__(77);
520var hasOwn = __webpack_require__(12);
521var uid = __webpack_require__(98);
522var NATIVE_SYMBOL = __webpack_require__(62);
523var USE_SYMBOL_AS_UID = __webpack_require__(151);
524
525var WellKnownSymbolsStore = shared('wks');
526var Symbol = global.Symbol;
527var symbolFor = Symbol && Symbol['for'];
528var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
529
530module.exports = function (name) {
531 if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
532 var description = 'Symbol.' + name;
533 if (NATIVE_SYMBOL && hasOwn(Symbol, name)) {
534 WellKnownSymbolsStore[name] = Symbol[name];
535 } else if (USE_SYMBOL_AS_UID && symbolFor) {
536 WellKnownSymbolsStore[name] = symbolFor(description);
537 } else {
538 WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
539 }
540 } return WellKnownSymbolsStore[name];
541};
542
543
544/***/ }),
545/* 10 */
546/***/ (function(module, exports, __webpack_require__) {
547
548var path = __webpack_require__(6);
549var hasOwn = __webpack_require__(12);
550var wrappedWellKnownSymbolModule = __webpack_require__(147);
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__(8);
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
576var uncurryThis = __webpack_require__(4);
577var toObject = __webpack_require__(34);
578
579var hasOwnProperty = uncurryThis({}.hasOwnProperty);
580
581// `HasOwnProperty` abstract operation
582// https://tc39.es/ecma262/#sec-hasownproperty
583// eslint-disable-next-line es-x/no-object-hasown -- safe
584module.exports = Object.hasOwn || function hasOwn(it, key) {
585 return hasOwnProperty(toObject(it), key);
586};
587
588
589/***/ }),
590/* 13 */
591/***/ (function(module, exports, __webpack_require__) {
592
593module.exports = __webpack_require__(275);
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__(74);
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, __webpack_exports__, __webpack_require__) {
624
625"use strict";
626/* harmony export (immutable) */ __webpack_exports__["a"] = keys;
627/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(54);
628/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(5);
629/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(45);
630/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__collectNonEnumProps_js__ = __webpack_require__(184);
631
632
633
634
635
636// Retrieve the names of an object's own properties.
637// Delegates to **ECMAScript 5**'s native `Object.keys`.
638function keys(obj) {
639 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return [];
640 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["m" /* nativeKeys */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["m" /* nativeKeys */])(obj);
641 var keys = [];
642 for (var key in obj) if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, key)) keys.push(key);
643 // Ahem, IE < 9.
644 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_3__collectNonEnumProps_js__["a" /* default */])(obj, keys);
645 return keys;
646}
647
648
649/***/ }),
650/* 17 */
651/***/ (function(module, __webpack_exports__, __webpack_require__) {
652
653"use strict";
654/* harmony export (immutable) */ __webpack_exports__["a"] = tagTester;
655/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(5);
656
657
658// Internal function for creating a `toString`-based type tester.
659function tagTester(name) {
660 var tag = '[object ' + name + ']';
661 return function(obj) {
662 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === tag;
663 };
664}
665
666
667/***/ }),
668/* 18 */
669/***/ (function(module, exports, __webpack_require__) {
670
671var path = __webpack_require__(6);
672var global = __webpack_require__(7);
673var isCallable = __webpack_require__(8);
674
675var aFunction = function (variable) {
676 return isCallable(variable) ? variable : undefined;
677};
678
679module.exports = function (namespace, method) {
680 return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])
681 : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];
682};
683
684
685/***/ }),
686/* 19 */
687/***/ (function(module, exports, __webpack_require__) {
688
689var uncurryThis = __webpack_require__(4);
690
691module.exports = uncurryThis({}.isPrototypeOf);
692
693
694/***/ }),
695/* 20 */
696/***/ (function(module, exports, __webpack_require__) {
697
698var isObject = __webpack_require__(11);
699
700var $String = String;
701var $TypeError = TypeError;
702
703// `Assert: Type(argument) is Object`
704module.exports = function (argument) {
705 if (isObject(argument)) return argument;
706 throw $TypeError($String(argument) + ' is not an object');
707};
708
709
710/***/ }),
711/* 21 */
712/***/ (function(module, __webpack_exports__, __webpack_require__) {
713
714"use strict";
715/* harmony export (immutable) */ __webpack_exports__["a"] = cb;
716/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
717/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(194);
718/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__iteratee_js__ = __webpack_require__(195);
719
720
721
722
723// The function we call internally to generate a callback. It invokes
724// `_.iteratee` if overridden, otherwise `baseIteratee`.
725function cb(value, context, argCount) {
726 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);
727 return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, argCount);
728}
729
730
731/***/ }),
732/* 22 */
733/***/ (function(module, exports, __webpack_require__) {
734
735module.exports = __webpack_require__(384);
736
737/***/ }),
738/* 23 */
739/***/ (function(module, exports, __webpack_require__) {
740
741var DESCRIPTORS = __webpack_require__(14);
742var IE8_DOM_DEFINE = __webpack_require__(152);
743var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(154);
744var anObject = __webpack_require__(20);
745var toPropertyKey = __webpack_require__(95);
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__(5);
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__(182);
861/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29);
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
876"use strict";
877
878
879var _interopRequireDefault = __webpack_require__(1);
880
881var _concat = _interopRequireDefault(__webpack_require__(22));
882
883var _promise = _interopRequireDefault(__webpack_require__(13));
884
885var _ = __webpack_require__(3);
886
887var md5 = __webpack_require__(522);
888
889var _require = __webpack_require__(3),
890 extend = _require.extend;
891
892var AV = __webpack_require__(69);
893
894var AVError = __webpack_require__(46);
895
896var _require2 = __webpack_require__(30),
897 getSessionToken = _require2.getSessionToken;
898
899var ajax = __webpack_require__(115); // 计算 X-LC-Sign 的签名方法
900
901
902var sign = function sign(key, isMasterKey) {
903 var _context2;
904
905 var now = new Date().getTime();
906 var signature = md5(now + key);
907
908 if (isMasterKey) {
909 var _context;
910
911 return (0, _concat.default)(_context = "".concat(signature, ",")).call(_context, now, ",master");
912 }
913
914 return (0, _concat.default)(_context2 = "".concat(signature, ",")).call(_context2, now);
915};
916
917var setAppKey = function setAppKey(headers, signKey) {
918 if (signKey) {
919 headers['X-LC-Sign'] = sign(AV.applicationKey);
920 } else {
921 headers['X-LC-Key'] = AV.applicationKey;
922 }
923};
924
925var setHeaders = function setHeaders() {
926 var authOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
927 var signKey = arguments.length > 1 ? arguments[1] : undefined;
928 var headers = {
929 'X-LC-Id': AV.applicationId,
930 'Content-Type': 'application/json;charset=UTF-8'
931 };
932 var useMasterKey = false;
933
934 if (typeof authOptions.useMasterKey === 'boolean') {
935 useMasterKey = authOptions.useMasterKey;
936 } else if (typeof AV._config.useMasterKey === 'boolean') {
937 useMasterKey = AV._config.useMasterKey;
938 }
939
940 if (useMasterKey) {
941 if (AV.masterKey) {
942 if (signKey) {
943 headers['X-LC-Sign'] = sign(AV.masterKey, true);
944 } else {
945 headers['X-LC-Key'] = "".concat(AV.masterKey, ",master");
946 }
947 } else {
948 console.warn('masterKey is not set, fall back to use appKey');
949 setAppKey(headers, signKey);
950 }
951 } else {
952 setAppKey(headers, signKey);
953 }
954
955 if (AV.hookKey) {
956 headers['X-LC-Hook-Key'] = AV.hookKey;
957 }
958
959 if (AV._config.production !== null) {
960 headers['X-LC-Prod'] = String(AV._config.production);
961 }
962
963 headers[undefined === 'NODE_JS' ? 'User-Agent' : 'X-LC-UA'] = AV._sharedConfig.userAgent;
964 return _promise.default.resolve().then(function () {
965 // Pass the session token
966 var sessionToken = getSessionToken(authOptions);
967
968 if (sessionToken) {
969 headers['X-LC-Session'] = sessionToken;
970 } else if (!AV._config.disableCurrentUser) {
971 return AV.User.currentAsync().then(function (currentUser) {
972 if (currentUser && currentUser._sessionToken) {
973 headers['X-LC-Session'] = currentUser._sessionToken;
974 }
975
976 return headers;
977 });
978 }
979
980 return headers;
981 });
982};
983
984var createApiUrl = function createApiUrl(_ref) {
985 var _ref$service = _ref.service,
986 service = _ref$service === void 0 ? 'api' : _ref$service,
987 _ref$version = _ref.version,
988 version = _ref$version === void 0 ? '1.1' : _ref$version,
989 path = _ref.path;
990 var apiURL = AV._config.serverURLs[service];
991 if (!apiURL) throw new Error("undefined server URL for ".concat(service));
992
993 if (apiURL.charAt(apiURL.length - 1) !== '/') {
994 apiURL += '/';
995 }
996
997 apiURL += version;
998
999 if (path) {
1000 apiURL += path;
1001 }
1002
1003 return apiURL;
1004};
1005/**
1006 * Low level REST API client. Call REST endpoints with authorization headers.
1007 * @function AV.request
1008 * @since 3.0.0
1009 * @param {Object} options
1010 * @param {String} options.method HTTP method
1011 * @param {String} options.path endpoint path, e.g. `/classes/Test/55759577e4b029ae6015ac20`
1012 * @param {Object} [options.query] query string dict
1013 * @param {Object} [options.data] HTTP body
1014 * @param {AuthOptions} [options.authOptions]
1015 * @param {String} [options.service = 'api']
1016 * @param {String} [options.version = '1.1']
1017 */
1018
1019
1020var request = function request(_ref2) {
1021 var service = _ref2.service,
1022 version = _ref2.version,
1023 method = _ref2.method,
1024 path = _ref2.path,
1025 query = _ref2.query,
1026 data = _ref2.data,
1027 authOptions = _ref2.authOptions,
1028 _ref2$signKey = _ref2.signKey,
1029 signKey = _ref2$signKey === void 0 ? true : _ref2$signKey;
1030
1031 if (!(AV.applicationId && (AV.applicationKey || AV.masterKey))) {
1032 throw new Error('Not initialized');
1033 }
1034
1035 if (AV._appRouter) {
1036 AV._appRouter.refresh();
1037 }
1038
1039 var timeout = AV._config.requestTimeout;
1040 var url = createApiUrl({
1041 service: service,
1042 path: path,
1043 version: version
1044 });
1045 return setHeaders(authOptions, signKey).then(function (headers) {
1046 return ajax({
1047 method: method,
1048 url: url,
1049 query: query,
1050 data: data,
1051 headers: headers,
1052 timeout: timeout
1053 }).catch(function (error) {
1054 var errorJSON = {
1055 code: error.code || -1,
1056 error: error.message || error.responseText
1057 };
1058
1059 if (error.response && error.response.code) {
1060 errorJSON = error.response;
1061 } else if (error.responseText) {
1062 try {
1063 errorJSON = JSON.parse(error.responseText);
1064 } catch (e) {// If we fail to parse the error text, that's okay.
1065 }
1066 }
1067
1068 errorJSON.rawMessage = errorJSON.rawMessage || errorJSON.error;
1069
1070 if (!AV._sharedConfig.keepErrorRawMessage) {
1071 var _context3, _context4;
1072
1073 errorJSON.error += (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = " [".concat(error.statusCode || 'N/A', " ")).call(_context4, method, " ")).call(_context3, url, "]");
1074 } // Transform the error into an instance of AVError by trying to parse
1075 // the error string as JSON.
1076
1077
1078 var err = new AVError(errorJSON.code, errorJSON.error);
1079 delete errorJSON.error;
1080 throw _.extend(err, errorJSON);
1081 });
1082 });
1083}; // lagecy request
1084
1085
1086var _request = function _request(route, className, objectId, method, data, authOptions, query) {
1087 var path = '';
1088 if (route) path += "/".concat(route);
1089 if (className) path += "/".concat(className);
1090 if (objectId) path += "/".concat(objectId); // for migeration
1091
1092 if (data && data._fetchWhenSave) throw new Error('_fetchWhenSave should be in the query');
1093 if (data && data._where) throw new Error('_where should be in the query');
1094
1095 if (method && method.toLowerCase() === 'get') {
1096 query = extend({}, query, data);
1097 data = null;
1098 }
1099
1100 return request({
1101 method: method,
1102 path: path,
1103 query: query,
1104 data: data,
1105 authOptions: authOptions
1106 });
1107};
1108
1109AV.request = request;
1110module.exports = {
1111 _request: _request,
1112 request: request
1113};
1114
1115/***/ }),
1116/* 28 */
1117/***/ (function(module, __webpack_exports__, __webpack_require__) {
1118
1119"use strict";
1120/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
1121/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(5);
1122
1123
1124
1125var isFunction = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Function');
1126
1127// Optimize `isFunction` if appropriate. Work around some `typeof` bugs in old
1128// v8, IE 11 (#1621), Safari 8 (#1929), and PhantomJS (#2236).
1129var nodelist = __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document && __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document.childNodes;
1130if (typeof /./ != 'function' && typeof Int8Array != 'object' && typeof nodelist != 'function') {
1131 isFunction = function(obj) {
1132 return typeof obj == 'function' || false;
1133 };
1134}
1135
1136/* harmony default export */ __webpack_exports__["a"] = (isFunction);
1137
1138
1139/***/ }),
1140/* 29 */
1141/***/ (function(module, __webpack_exports__, __webpack_require__) {
1142
1143"use strict";
1144/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(183);
1145
1146
1147// Internal helper to obtain the `length` property of an object.
1148/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('length'));
1149
1150
1151/***/ }),
1152/* 30 */
1153/***/ (function(module, exports, __webpack_require__) {
1154
1155"use strict";
1156
1157
1158var _interopRequireDefault = __webpack_require__(1);
1159
1160var _keys = _interopRequireDefault(__webpack_require__(57));
1161
1162var _getPrototypeOf = _interopRequireDefault(__webpack_require__(227));
1163
1164var _promise = _interopRequireDefault(__webpack_require__(13));
1165
1166var _ = __webpack_require__(3); // Helper function to check null or undefined.
1167
1168
1169var isNullOrUndefined = function isNullOrUndefined(x) {
1170 return _.isNull(x) || _.isUndefined(x);
1171};
1172
1173var ensureArray = function ensureArray(target) {
1174 if (_.isArray(target)) {
1175 return target;
1176 }
1177
1178 if (target === undefined || target === null) {
1179 return [];
1180 }
1181
1182 return [target];
1183};
1184
1185var transformFetchOptions = function transformFetchOptions() {
1186 var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1187 keys = (0, _keys.default)(_ref),
1188 include = _ref.include,
1189 includeACL = _ref.includeACL;
1190
1191 var fetchOptions = {};
1192
1193 if (keys) {
1194 fetchOptions.keys = ensureArray(keys).join(',');
1195 }
1196
1197 if (include) {
1198 fetchOptions.include = ensureArray(include).join(',');
1199 }
1200
1201 if (includeACL) {
1202 fetchOptions.returnACL = includeACL;
1203 }
1204
1205 return fetchOptions;
1206};
1207
1208var getSessionToken = function getSessionToken(authOptions) {
1209 if (authOptions.sessionToken) {
1210 return authOptions.sessionToken;
1211 }
1212
1213 if (authOptions.user && typeof authOptions.user.getSessionToken === 'function') {
1214 return authOptions.user.getSessionToken();
1215 }
1216};
1217
1218var tap = function tap(interceptor) {
1219 return function (value) {
1220 return interceptor(value), value;
1221 };
1222}; // Shared empty constructor function to aid in prototype-chain creation.
1223
1224
1225var EmptyConstructor = function EmptyConstructor() {}; // Helper function to correctly set up the prototype chain, for subclasses.
1226// Similar to `goog.inherits`, but uses a hash of prototype properties and
1227// class properties to be extended.
1228
1229
1230var inherits = function inherits(parent, protoProps, staticProps) {
1231 var child; // The constructor function for the new subclass is either defined by you
1232 // (the "constructor" property in your `extend` definition), or defaulted
1233 // by us to simply call the parent's constructor.
1234
1235 if (protoProps && protoProps.hasOwnProperty('constructor')) {
1236 child = protoProps.constructor;
1237 } else {
1238 /** @ignore */
1239 child = function child() {
1240 parent.apply(this, arguments);
1241 };
1242 } // Inherit class (static) properties from parent.
1243
1244
1245 _.extend(child, parent); // Set the prototype chain to inherit from `parent`, without calling
1246 // `parent`'s constructor function.
1247
1248
1249 EmptyConstructor.prototype = parent.prototype;
1250 child.prototype = new EmptyConstructor(); // Add prototype properties (instance properties) to the subclass,
1251 // if supplied.
1252
1253 if (protoProps) {
1254 _.extend(child.prototype, protoProps);
1255 } // Add static properties to the constructor function, if supplied.
1256
1257
1258 if (staticProps) {
1259 _.extend(child, staticProps);
1260 } // Correctly set child's `prototype.constructor`.
1261
1262
1263 child.prototype.constructor = child; // Set a convenience property in case the parent's prototype is
1264 // needed later.
1265
1266 child.__super__ = parent.prototype;
1267 return child;
1268};
1269
1270var parseDate = function parseDate(iso8601) {
1271 return new Date(iso8601);
1272};
1273
1274var setValue = function setValue(target, key, value) {
1275 // '.' is not allowed in Class keys, escaping is not in concern now.
1276 var segs = key.split('.');
1277 var lastSeg = segs.pop();
1278 var currentTarget = target;
1279 segs.forEach(function (seg) {
1280 if (currentTarget[seg] === undefined) currentTarget[seg] = {};
1281 currentTarget = currentTarget[seg];
1282 });
1283 currentTarget[lastSeg] = value;
1284 return target;
1285};
1286
1287var findValue = function findValue(target, key) {
1288 var segs = key.split('.');
1289 var firstSeg = segs[0];
1290 var lastSeg = segs.pop();
1291 var currentTarget = target;
1292
1293 for (var i = 0; i < segs.length; i++) {
1294 currentTarget = currentTarget[segs[i]];
1295
1296 if (currentTarget === undefined) {
1297 return [undefined, undefined, lastSeg];
1298 }
1299 }
1300
1301 var value = currentTarget[lastSeg];
1302 return [value, currentTarget, lastSeg, firstSeg];
1303};
1304
1305var isPlainObject = function isPlainObject(obj) {
1306 return _.isObject(obj) && (0, _getPrototypeOf.default)(obj) === Object.prototype;
1307};
1308
1309var continueWhile = function continueWhile(predicate, asyncFunction) {
1310 if (predicate()) {
1311 return asyncFunction().then(function () {
1312 return continueWhile(predicate, asyncFunction);
1313 });
1314 }
1315
1316 return _promise.default.resolve();
1317};
1318
1319module.exports = {
1320 isNullOrUndefined: isNullOrUndefined,
1321 ensureArray: ensureArray,
1322 transformFetchOptions: transformFetchOptions,
1323 getSessionToken: getSessionToken,
1324 tap: tap,
1325 inherits: inherits,
1326 parseDate: parseDate,
1327 setValue: setValue,
1328 findValue: findValue,
1329 isPlainObject: isPlainObject,
1330 continueWhile: continueWhile
1331};
1332
1333/***/ }),
1334/* 31 */
1335/***/ (function(module, exports, __webpack_require__) {
1336
1337var isCallable = __webpack_require__(8);
1338var tryToString = __webpack_require__(76);
1339
1340var $TypeError = TypeError;
1341
1342// `Assert: IsCallable(argument) is true`
1343module.exports = function (argument) {
1344 if (isCallable(argument)) return argument;
1345 throw $TypeError(tryToString(argument) + ' is not a function');
1346};
1347
1348
1349/***/ }),
1350/* 32 */
1351/***/ (function(module, exports, __webpack_require__) {
1352
1353// toObject with fallback for non-array-like ES3 strings
1354var IndexedObject = __webpack_require__(94);
1355var requireObjectCoercible = __webpack_require__(120);
1356
1357module.exports = function (it) {
1358 return IndexedObject(requireObjectCoercible(it));
1359};
1360
1361
1362/***/ }),
1363/* 33 */
1364/***/ (function(module, exports) {
1365
1366module.exports = true;
1367
1368
1369/***/ }),
1370/* 34 */
1371/***/ (function(module, exports, __webpack_require__) {
1372
1373var requireObjectCoercible = __webpack_require__(120);
1374
1375var $Object = Object;
1376
1377// `ToObject` abstract operation
1378// https://tc39.es/ecma262/#sec-toobject
1379module.exports = function (argument) {
1380 return $Object(requireObjectCoercible(argument));
1381};
1382
1383
1384/***/ }),
1385/* 35 */
1386/***/ (function(module, exports, __webpack_require__) {
1387
1388module.exports = __webpack_require__(389);
1389
1390/***/ }),
1391/* 36 */
1392/***/ (function(module, exports, __webpack_require__) {
1393
1394module.exports = __webpack_require__(396);
1395
1396/***/ }),
1397/* 37 */
1398/***/ (function(module, exports, __webpack_require__) {
1399
1400var DESCRIPTORS = __webpack_require__(14);
1401var definePropertyModule = __webpack_require__(23);
1402var createPropertyDescriptor = __webpack_require__(47);
1403
1404module.exports = DESCRIPTORS ? function (object, key, value) {
1405 return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
1406} : function (object, key, value) {
1407 object[key] = value;
1408 return object;
1409};
1410
1411
1412/***/ }),
1413/* 38 */
1414/***/ (function(module, exports, __webpack_require__) {
1415
1416var path = __webpack_require__(6);
1417
1418module.exports = function (CONSTRUCTOR) {
1419 return path[CONSTRUCTOR + 'Prototype'];
1420};
1421
1422
1423/***/ }),
1424/* 39 */
1425/***/ (function(module, exports, __webpack_require__) {
1426
1427var toLength = __webpack_require__(285);
1428
1429// `LengthOfArrayLike` abstract operation
1430// https://tc39.es/ecma262/#sec-lengthofarraylike
1431module.exports = function (obj) {
1432 return toLength(obj.length);
1433};
1434
1435
1436/***/ }),
1437/* 40 */
1438/***/ (function(module, exports, __webpack_require__) {
1439
1440var bind = __webpack_require__(48);
1441var call = __webpack_require__(15);
1442var anObject = __webpack_require__(20);
1443var tryToString = __webpack_require__(76);
1444var isArrayIteratorMethod = __webpack_require__(160);
1445var lengthOfArrayLike = __webpack_require__(39);
1446var isPrototypeOf = __webpack_require__(19);
1447var getIterator = __webpack_require__(161);
1448var getIteratorMethod = __webpack_require__(105);
1449var iteratorClose = __webpack_require__(162);
1450
1451var $TypeError = TypeError;
1452
1453var Result = function (stopped, result) {
1454 this.stopped = stopped;
1455 this.result = result;
1456};
1457
1458var ResultPrototype = Result.prototype;
1459
1460module.exports = function (iterable, unboundFunction, options) {
1461 var that = options && options.that;
1462 var AS_ENTRIES = !!(options && options.AS_ENTRIES);
1463 var IS_ITERATOR = !!(options && options.IS_ITERATOR);
1464 var INTERRUPTED = !!(options && options.INTERRUPTED);
1465 var fn = bind(unboundFunction, that);
1466 var iterator, iterFn, index, length, result, next, step;
1467
1468 var stop = function (condition) {
1469 if (iterator) iteratorClose(iterator, 'normal', condition);
1470 return new Result(true, condition);
1471 };
1472
1473 var callFn = function (value) {
1474 if (AS_ENTRIES) {
1475 anObject(value);
1476 return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
1477 } return INTERRUPTED ? fn(value, stop) : fn(value);
1478 };
1479
1480 if (IS_ITERATOR) {
1481 iterator = iterable;
1482 } else {
1483 iterFn = getIteratorMethod(iterable);
1484 if (!iterFn) throw $TypeError(tryToString(iterable) + ' is not iterable');
1485 // optimisation for array iterators
1486 if (isArrayIteratorMethod(iterFn)) {
1487 for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
1488 result = callFn(iterable[index]);
1489 if (result && isPrototypeOf(ResultPrototype, result)) return result;
1490 } return new Result(false);
1491 }
1492 iterator = getIterator(iterable, iterFn);
1493 }
1494
1495 next = iterator.next;
1496 while (!(step = call(next, iterator)).done) {
1497 try {
1498 result = callFn(step.value);
1499 } catch (error) {
1500 iteratorClose(iterator, 'throw', error);
1501 }
1502 if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
1503 } return new Result(false);
1504};
1505
1506
1507/***/ }),
1508/* 41 */
1509/***/ (function(module, exports, __webpack_require__) {
1510
1511"use strict";
1512
1513var toIndexedObject = __webpack_require__(32);
1514var addToUnscopables = __webpack_require__(163);
1515var Iterators = __webpack_require__(50);
1516var InternalStateModule = __webpack_require__(42);
1517var defineProperty = __webpack_require__(23).f;
1518var defineIterator = __webpack_require__(130);
1519var IS_PURE = __webpack_require__(33);
1520var DESCRIPTORS = __webpack_require__(14);
1521
1522var ARRAY_ITERATOR = 'Array Iterator';
1523var setInternalState = InternalStateModule.set;
1524var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
1525
1526// `Array.prototype.entries` method
1527// https://tc39.es/ecma262/#sec-array.prototype.entries
1528// `Array.prototype.keys` method
1529// https://tc39.es/ecma262/#sec-array.prototype.keys
1530// `Array.prototype.values` method
1531// https://tc39.es/ecma262/#sec-array.prototype.values
1532// `Array.prototype[@@iterator]` method
1533// https://tc39.es/ecma262/#sec-array.prototype-@@iterator
1534// `CreateArrayIterator` internal method
1535// https://tc39.es/ecma262/#sec-createarrayiterator
1536module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
1537 setInternalState(this, {
1538 type: ARRAY_ITERATOR,
1539 target: toIndexedObject(iterated), // target
1540 index: 0, // next index
1541 kind: kind // kind
1542 });
1543// `%ArrayIteratorPrototype%.next` method
1544// https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
1545}, function () {
1546 var state = getInternalState(this);
1547 var target = state.target;
1548 var kind = state.kind;
1549 var index = state.index++;
1550 if (!target || index >= target.length) {
1551 state.target = undefined;
1552 return { value: undefined, done: true };
1553 }
1554 if (kind == 'keys') return { value: index, done: false };
1555 if (kind == 'values') return { value: target[index], done: false };
1556 return { value: [index, target[index]], done: false };
1557}, 'values');
1558
1559// argumentsList[@@iterator] is %ArrayProto_values%
1560// https://tc39.es/ecma262/#sec-createunmappedargumentsobject
1561// https://tc39.es/ecma262/#sec-createmappedargumentsobject
1562var values = Iterators.Arguments = Iterators.Array;
1563
1564// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1565addToUnscopables('keys');
1566addToUnscopables('values');
1567addToUnscopables('entries');
1568
1569// V8 ~ Chrome 45- bug
1570if (!IS_PURE && DESCRIPTORS && values.name !== 'values') try {
1571 defineProperty(values, 'name', { value: 'values' });
1572} catch (error) { /* empty */ }
1573
1574
1575/***/ }),
1576/* 42 */
1577/***/ (function(module, exports, __webpack_require__) {
1578
1579var NATIVE_WEAK_MAP = __webpack_require__(164);
1580var global = __webpack_require__(7);
1581var uncurryThis = __webpack_require__(4);
1582var isObject = __webpack_require__(11);
1583var createNonEnumerableProperty = __webpack_require__(37);
1584var hasOwn = __webpack_require__(12);
1585var shared = __webpack_require__(122);
1586var sharedKey = __webpack_require__(100);
1587var hiddenKeys = __webpack_require__(78);
1588
1589var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
1590var TypeError = global.TypeError;
1591var WeakMap = global.WeakMap;
1592var set, get, has;
1593
1594var enforce = function (it) {
1595 return has(it) ? get(it) : set(it, {});
1596};
1597
1598var getterFor = function (TYPE) {
1599 return function (it) {
1600 var state;
1601 if (!isObject(it) || (state = get(it)).type !== TYPE) {
1602 throw TypeError('Incompatible receiver, ' + TYPE + ' required');
1603 } return state;
1604 };
1605};
1606
1607if (NATIVE_WEAK_MAP || shared.state) {
1608 var store = shared.state || (shared.state = new WeakMap());
1609 var wmget = uncurryThis(store.get);
1610 var wmhas = uncurryThis(store.has);
1611 var wmset = uncurryThis(store.set);
1612 set = function (it, metadata) {
1613 if (wmhas(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
1614 metadata.facade = it;
1615 wmset(store, it, metadata);
1616 return metadata;
1617 };
1618 get = function (it) {
1619 return wmget(store, it) || {};
1620 };
1621 has = function (it) {
1622 return wmhas(store, it);
1623 };
1624} else {
1625 var STATE = sharedKey('state');
1626 hiddenKeys[STATE] = true;
1627 set = function (it, metadata) {
1628 if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
1629 metadata.facade = it;
1630 createNonEnumerableProperty(it, STATE, metadata);
1631 return metadata;
1632 };
1633 get = function (it) {
1634 return hasOwn(it, STATE) ? it[STATE] : {};
1635 };
1636 has = function (it) {
1637 return hasOwn(it, STATE);
1638 };
1639}
1640
1641module.exports = {
1642 set: set,
1643 get: get,
1644 has: has,
1645 enforce: enforce,
1646 getterFor: getterFor
1647};
1648
1649
1650/***/ }),
1651/* 43 */
1652/***/ (function(module, exports, __webpack_require__) {
1653
1654var createNonEnumerableProperty = __webpack_require__(37);
1655
1656module.exports = function (target, key, value, options) {
1657 if (options && options.enumerable) target[key] = value;
1658 else createNonEnumerableProperty(target, key, value);
1659 return target;
1660};
1661
1662
1663/***/ }),
1664/* 44 */
1665/***/ (function(module, exports, __webpack_require__) {
1666
1667__webpack_require__(41);
1668var DOMIterables = __webpack_require__(311);
1669var global = __webpack_require__(7);
1670var classof = __webpack_require__(51);
1671var createNonEnumerableProperty = __webpack_require__(37);
1672var Iterators = __webpack_require__(50);
1673var wellKnownSymbol = __webpack_require__(9);
1674
1675var TO_STRING_TAG = wellKnownSymbol('toStringTag');
1676
1677for (var COLLECTION_NAME in DOMIterables) {
1678 var Collection = global[COLLECTION_NAME];
1679 var CollectionPrototype = Collection && Collection.prototype;
1680 if (CollectionPrototype && classof(CollectionPrototype) !== TO_STRING_TAG) {
1681 createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
1682 }
1683 Iterators[COLLECTION_NAME] = Iterators.Array;
1684}
1685
1686
1687/***/ }),
1688/* 45 */
1689/***/ (function(module, __webpack_exports__, __webpack_require__) {
1690
1691"use strict";
1692/* harmony export (immutable) */ __webpack_exports__["a"] = has;
1693/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(5);
1694
1695
1696// Internal function to check whether `key` is an own property name of `obj`.
1697function has(obj, key) {
1698 return obj != null && __WEBPACK_IMPORTED_MODULE_0__setup_js__["i" /* hasOwnProperty */].call(obj, key);
1699}
1700
1701
1702/***/ }),
1703/* 46 */
1704/***/ (function(module, exports, __webpack_require__) {
1705
1706"use strict";
1707
1708
1709var _interopRequireDefault = __webpack_require__(1);
1710
1711var _setPrototypeOf = _interopRequireDefault(__webpack_require__(411));
1712
1713var _getPrototypeOf = _interopRequireDefault(__webpack_require__(227));
1714
1715var _ = __webpack_require__(3);
1716/**
1717 * @class AV.Error
1718 */
1719
1720
1721function AVError(code, message) {
1722 if (this instanceof AVError ? this.constructor : void 0) {
1723 var error = new Error(message);
1724 (0, _setPrototypeOf.default)(error, (0, _getPrototypeOf.default)(this));
1725 error.code = code;
1726 return error;
1727 }
1728
1729 return new AVError(code, message);
1730}
1731
1732AVError.prototype = Object.create(Error.prototype, {
1733 constructor: {
1734 value: Error,
1735 enumerable: false,
1736 writable: true,
1737 configurable: true
1738 }
1739});
1740(0, _setPrototypeOf.default)(AVError, Error);
1741
1742_.extend(AVError,
1743/** @lends AV.Error */
1744{
1745 /**
1746 * Error code indicating some error other than those enumerated here.
1747 * @constant
1748 */
1749 OTHER_CAUSE: -1,
1750
1751 /**
1752 * Error code indicating that something has gone wrong with the server.
1753 * If you get this error code, it is AV's fault.
1754 * @constant
1755 */
1756 INTERNAL_SERVER_ERROR: 1,
1757
1758 /**
1759 * Error code indicating the connection to the AV servers failed.
1760 * @constant
1761 */
1762 CONNECTION_FAILED: 100,
1763
1764 /**
1765 * Error code indicating the specified object doesn't exist.
1766 * @constant
1767 */
1768 OBJECT_NOT_FOUND: 101,
1769
1770 /**
1771 * Error code indicating you tried to query with a datatype that doesn't
1772 * support it, like exact matching an array or object.
1773 * @constant
1774 */
1775 INVALID_QUERY: 102,
1776
1777 /**
1778 * Error code indicating a missing or invalid classname. Classnames are
1779 * case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the
1780 * only valid characters.
1781 * @constant
1782 */
1783 INVALID_CLASS_NAME: 103,
1784
1785 /**
1786 * Error code indicating an unspecified object id.
1787 * @constant
1788 */
1789 MISSING_OBJECT_ID: 104,
1790
1791 /**
1792 * Error code indicating an invalid key name. Keys are case-sensitive. They
1793 * must start with a letter, and a-zA-Z0-9_ are the only valid characters.
1794 * @constant
1795 */
1796 INVALID_KEY_NAME: 105,
1797
1798 /**
1799 * Error code indicating a malformed pointer. You should not see this unless
1800 * you have been mucking about changing internal AV code.
1801 * @constant
1802 */
1803 INVALID_POINTER: 106,
1804
1805 /**
1806 * Error code indicating that badly formed JSON was received upstream. This
1807 * either indicates you have done something unusual with modifying how
1808 * things encode to JSON, or the network is failing badly.
1809 * @constant
1810 */
1811 INVALID_JSON: 107,
1812
1813 /**
1814 * Error code indicating that the feature you tried to access is only
1815 * available internally for testing purposes.
1816 * @constant
1817 */
1818 COMMAND_UNAVAILABLE: 108,
1819
1820 /**
1821 * You must call AV.initialize before using the AV library.
1822 * @constant
1823 */
1824 NOT_INITIALIZED: 109,
1825
1826 /**
1827 * Error code indicating that a field was set to an inconsistent type.
1828 * @constant
1829 */
1830 INCORRECT_TYPE: 111,
1831
1832 /**
1833 * Error code indicating an invalid channel name. A channel name is either
1834 * an empty string (the broadcast channel) or contains only a-zA-Z0-9_
1835 * characters.
1836 * @constant
1837 */
1838 INVALID_CHANNEL_NAME: 112,
1839
1840 /**
1841 * Error code indicating that push is misconfigured.
1842 * @constant
1843 */
1844 PUSH_MISCONFIGURED: 115,
1845
1846 /**
1847 * Error code indicating that the object is too large.
1848 * @constant
1849 */
1850 OBJECT_TOO_LARGE: 116,
1851
1852 /**
1853 * Error code indicating that the operation isn't allowed for clients.
1854 * @constant
1855 */
1856 OPERATION_FORBIDDEN: 119,
1857
1858 /**
1859 * Error code indicating the result was not found in the cache.
1860 * @constant
1861 */
1862 CACHE_MISS: 120,
1863
1864 /**
1865 * Error code indicating that an invalid key was used in a nested
1866 * JSONObject.
1867 * @constant
1868 */
1869 INVALID_NESTED_KEY: 121,
1870
1871 /**
1872 * Error code indicating that an invalid filename was used for AVFile.
1873 * A valid file name contains only a-zA-Z0-9_. characters and is between 1
1874 * and 128 characters.
1875 * @constant
1876 */
1877 INVALID_FILE_NAME: 122,
1878
1879 /**
1880 * Error code indicating an invalid ACL was provided.
1881 * @constant
1882 */
1883 INVALID_ACL: 123,
1884
1885 /**
1886 * Error code indicating that the request timed out on the server. Typically
1887 * this indicates that the request is too expensive to run.
1888 * @constant
1889 */
1890 TIMEOUT: 124,
1891
1892 /**
1893 * Error code indicating that the email address was invalid.
1894 * @constant
1895 */
1896 INVALID_EMAIL_ADDRESS: 125,
1897
1898 /**
1899 * Error code indicating a missing content type.
1900 * @constant
1901 */
1902 MISSING_CONTENT_TYPE: 126,
1903
1904 /**
1905 * Error code indicating a missing content length.
1906 * @constant
1907 */
1908 MISSING_CONTENT_LENGTH: 127,
1909
1910 /**
1911 * Error code indicating an invalid content length.
1912 * @constant
1913 */
1914 INVALID_CONTENT_LENGTH: 128,
1915
1916 /**
1917 * Error code indicating a file that was too large.
1918 * @constant
1919 */
1920 FILE_TOO_LARGE: 129,
1921
1922 /**
1923 * Error code indicating an error saving a file.
1924 * @constant
1925 */
1926 FILE_SAVE_ERROR: 130,
1927
1928 /**
1929 * Error code indicating an error deleting a file.
1930 * @constant
1931 */
1932 FILE_DELETE_ERROR: 153,
1933
1934 /**
1935 * Error code indicating that a unique field was given a value that is
1936 * already taken.
1937 * @constant
1938 */
1939 DUPLICATE_VALUE: 137,
1940
1941 /**
1942 * Error code indicating that a role's name is invalid.
1943 * @constant
1944 */
1945 INVALID_ROLE_NAME: 139,
1946
1947 /**
1948 * Error code indicating that an application quota was exceeded. Upgrade to
1949 * resolve.
1950 * @constant
1951 */
1952 EXCEEDED_QUOTA: 140,
1953
1954 /**
1955 * Error code indicating that a Cloud Code script failed.
1956 * @constant
1957 */
1958 SCRIPT_FAILED: 141,
1959
1960 /**
1961 * Error code indicating that a Cloud Code validation failed.
1962 * @constant
1963 */
1964 VALIDATION_ERROR: 142,
1965
1966 /**
1967 * Error code indicating that invalid image data was provided.
1968 * @constant
1969 */
1970 INVALID_IMAGE_DATA: 150,
1971
1972 /**
1973 * Error code indicating an unsaved file.
1974 * @constant
1975 */
1976 UNSAVED_FILE_ERROR: 151,
1977
1978 /**
1979 * Error code indicating an invalid push time.
1980 * @constant
1981 */
1982 INVALID_PUSH_TIME_ERROR: 152,
1983
1984 /**
1985 * Error code indicating that the username is missing or empty.
1986 * @constant
1987 */
1988 USERNAME_MISSING: 200,
1989
1990 /**
1991 * Error code indicating that the password is missing or empty.
1992 * @constant
1993 */
1994 PASSWORD_MISSING: 201,
1995
1996 /**
1997 * Error code indicating that the username has already been taken.
1998 * @constant
1999 */
2000 USERNAME_TAKEN: 202,
2001
2002 /**
2003 * Error code indicating that the email has already been taken.
2004 * @constant
2005 */
2006 EMAIL_TAKEN: 203,
2007
2008 /**
2009 * Error code indicating that the email is missing, but must be specified.
2010 * @constant
2011 */
2012 EMAIL_MISSING: 204,
2013
2014 /**
2015 * Error code indicating that a user with the specified email was not found.
2016 * @constant
2017 */
2018 EMAIL_NOT_FOUND: 205,
2019
2020 /**
2021 * Error code indicating that a user object without a valid session could
2022 * not be altered.
2023 * @constant
2024 */
2025 SESSION_MISSING: 206,
2026
2027 /**
2028 * Error code indicating that a user can only be created through signup.
2029 * @constant
2030 */
2031 MUST_CREATE_USER_THROUGH_SIGNUP: 207,
2032
2033 /**
2034 * Error code indicating that an an account being linked is already linked
2035 * to another user.
2036 * @constant
2037 */
2038 ACCOUNT_ALREADY_LINKED: 208,
2039
2040 /**
2041 * Error code indicating that a user cannot be linked to an account because
2042 * that account's id could not be found.
2043 * @constant
2044 */
2045 LINKED_ID_MISSING: 250,
2046
2047 /**
2048 * Error code indicating that a user with a linked (e.g. Facebook) account
2049 * has an invalid session.
2050 * @constant
2051 */
2052 INVALID_LINKED_SESSION: 251,
2053
2054 /**
2055 * Error code indicating that a service being linked (e.g. Facebook or
2056 * Twitter) is unsupported.
2057 * @constant
2058 */
2059 UNSUPPORTED_SERVICE: 252,
2060
2061 /**
2062 * Error code indicating a real error code is unavailable because
2063 * we had to use an XDomainRequest object to allow CORS requests in
2064 * Internet Explorer, which strips the body from HTTP responses that have
2065 * a non-2XX status code.
2066 * @constant
2067 */
2068 X_DOMAIN_REQUEST: 602
2069});
2070
2071module.exports = AVError;
2072
2073/***/ }),
2074/* 47 */
2075/***/ (function(module, exports) {
2076
2077module.exports = function (bitmap, value) {
2078 return {
2079 enumerable: !(bitmap & 1),
2080 configurable: !(bitmap & 2),
2081 writable: !(bitmap & 4),
2082 value: value
2083 };
2084};
2085
2086
2087/***/ }),
2088/* 48 */
2089/***/ (function(module, exports, __webpack_require__) {
2090
2091var uncurryThis = __webpack_require__(4);
2092var aCallable = __webpack_require__(31);
2093var NATIVE_BIND = __webpack_require__(74);
2094
2095var bind = uncurryThis(uncurryThis.bind);
2096
2097// optional / simple context binding
2098module.exports = function (fn, that) {
2099 aCallable(fn);
2100 return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) {
2101 return fn.apply(that, arguments);
2102 };
2103};
2104
2105
2106/***/ }),
2107/* 49 */
2108/***/ (function(module, exports, __webpack_require__) {
2109
2110/* global ActiveXObject -- old IE, WSH */
2111var anObject = __webpack_require__(20);
2112var definePropertiesModule = __webpack_require__(127);
2113var enumBugKeys = __webpack_require__(126);
2114var hiddenKeys = __webpack_require__(78);
2115var html = __webpack_require__(159);
2116var documentCreateElement = __webpack_require__(123);
2117var sharedKey = __webpack_require__(100);
2118
2119var GT = '>';
2120var LT = '<';
2121var PROTOTYPE = 'prototype';
2122var SCRIPT = 'script';
2123var IE_PROTO = sharedKey('IE_PROTO');
2124
2125var EmptyConstructor = function () { /* empty */ };
2126
2127var scriptTag = function (content) {
2128 return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
2129};
2130
2131// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
2132var NullProtoObjectViaActiveX = function (activeXDocument) {
2133 activeXDocument.write(scriptTag(''));
2134 activeXDocument.close();
2135 var temp = activeXDocument.parentWindow.Object;
2136 activeXDocument = null; // avoid memory leak
2137 return temp;
2138};
2139
2140// Create object with fake `null` prototype: use iframe Object with cleared prototype
2141var NullProtoObjectViaIFrame = function () {
2142 // Thrash, waste and sodomy: IE GC bug
2143 var iframe = documentCreateElement('iframe');
2144 var JS = 'java' + SCRIPT + ':';
2145 var iframeDocument;
2146 iframe.style.display = 'none';
2147 html.appendChild(iframe);
2148 // https://github.com/zloirock/core-js/issues/475
2149 iframe.src = String(JS);
2150 iframeDocument = iframe.contentWindow.document;
2151 iframeDocument.open();
2152 iframeDocument.write(scriptTag('document.F=Object'));
2153 iframeDocument.close();
2154 return iframeDocument.F;
2155};
2156
2157// Check for document.domain and active x support
2158// No need to use active x approach when document.domain is not set
2159// see https://github.com/es-shims/es5-shim/issues/150
2160// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
2161// avoid IE GC bug
2162var activeXDocument;
2163var NullProtoObject = function () {
2164 try {
2165 activeXDocument = new ActiveXObject('htmlfile');
2166 } catch (error) { /* ignore */ }
2167 NullProtoObject = typeof document != 'undefined'
2168 ? document.domain && activeXDocument
2169 ? NullProtoObjectViaActiveX(activeXDocument) // old IE
2170 : NullProtoObjectViaIFrame()
2171 : NullProtoObjectViaActiveX(activeXDocument); // WSH
2172 var length = enumBugKeys.length;
2173 while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
2174 return NullProtoObject();
2175};
2176
2177hiddenKeys[IE_PROTO] = true;
2178
2179// `Object.create` method
2180// https://tc39.es/ecma262/#sec-object.create
2181// eslint-disable-next-line es-x/no-object-create -- safe
2182module.exports = Object.create || function create(O, Properties) {
2183 var result;
2184 if (O !== null) {
2185 EmptyConstructor[PROTOTYPE] = anObject(O);
2186 result = new EmptyConstructor();
2187 EmptyConstructor[PROTOTYPE] = null;
2188 // add "__proto__" for Object.getPrototypeOf polyfill
2189 result[IE_PROTO] = O;
2190 } else result = NullProtoObject();
2191 return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
2192};
2193
2194
2195/***/ }),
2196/* 50 */
2197/***/ (function(module, exports) {
2198
2199module.exports = {};
2200
2201
2202/***/ }),
2203/* 51 */
2204/***/ (function(module, exports, __webpack_require__) {
2205
2206var TO_STRING_TAG_SUPPORT = __webpack_require__(128);
2207var isCallable = __webpack_require__(8);
2208var classofRaw = __webpack_require__(61);
2209var wellKnownSymbol = __webpack_require__(9);
2210
2211var TO_STRING_TAG = wellKnownSymbol('toStringTag');
2212var $Object = Object;
2213
2214// ES3 wrong here
2215var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
2216
2217// fallback for IE11 Script Access Denied error
2218var tryGet = function (it, key) {
2219 try {
2220 return it[key];
2221 } catch (error) { /* empty */ }
2222};
2223
2224// getting tag from ES6+ `Object.prototype.toString`
2225module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
2226 var O, tag, result;
2227 return it === undefined ? 'Undefined' : it === null ? 'Null'
2228 // @@toStringTag case
2229 : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
2230 // builtinTag case
2231 : CORRECT_ARGUMENTS ? classofRaw(O)
2232 // ES3 arguments fallback
2233 : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
2234};
2235
2236
2237/***/ }),
2238/* 52 */
2239/***/ (function(module, exports, __webpack_require__) {
2240
2241var TO_STRING_TAG_SUPPORT = __webpack_require__(128);
2242var defineProperty = __webpack_require__(23).f;
2243var createNonEnumerableProperty = __webpack_require__(37);
2244var hasOwn = __webpack_require__(12);
2245var toString = __webpack_require__(292);
2246var wellKnownSymbol = __webpack_require__(9);
2247
2248var TO_STRING_TAG = wellKnownSymbol('toStringTag');
2249
2250module.exports = function (it, TAG, STATIC, SET_METHOD) {
2251 if (it) {
2252 var target = STATIC ? it : it.prototype;
2253 if (!hasOwn(target, TO_STRING_TAG)) {
2254 defineProperty(target, TO_STRING_TAG, { configurable: true, value: TAG });
2255 }
2256 if (SET_METHOD && !TO_STRING_TAG_SUPPORT) {
2257 createNonEnumerableProperty(target, 'toString', toString);
2258 }
2259 }
2260};
2261
2262
2263/***/ }),
2264/* 53 */
2265/***/ (function(module, exports, __webpack_require__) {
2266
2267"use strict";
2268
2269var aCallable = __webpack_require__(31);
2270
2271var PromiseCapability = function (C) {
2272 var resolve, reject;
2273 this.promise = new C(function ($$resolve, $$reject) {
2274 if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
2275 resolve = $$resolve;
2276 reject = $$reject;
2277 });
2278 this.resolve = aCallable(resolve);
2279 this.reject = aCallable(reject);
2280};
2281
2282// `NewPromiseCapability` abstract operation
2283// https://tc39.es/ecma262/#sec-newpromisecapability
2284module.exports.f = function (C) {
2285 return new PromiseCapability(C);
2286};
2287
2288
2289/***/ }),
2290/* 54 */
2291/***/ (function(module, __webpack_exports__, __webpack_require__) {
2292
2293"use strict";
2294/* harmony export (immutable) */ __webpack_exports__["a"] = isObject;
2295// Is a given variable an object?
2296function isObject(obj) {
2297 var type = typeof obj;
2298 return type === 'function' || type === 'object' && !!obj;
2299}
2300
2301
2302/***/ }),
2303/* 55 */
2304/***/ (function(module, __webpack_exports__, __webpack_require__) {
2305
2306"use strict";
2307/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(5);
2308/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__tagTester_js__ = __webpack_require__(17);
2309
2310
2311
2312// Is a given value an array?
2313// Delegates to ECMA5's native `Array.isArray`.
2314/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__setup_js__["k" /* nativeIsArray */] || Object(__WEBPACK_IMPORTED_MODULE_1__tagTester_js__["a" /* default */])('Array'));
2315
2316
2317/***/ }),
2318/* 56 */
2319/***/ (function(module, __webpack_exports__, __webpack_require__) {
2320
2321"use strict";
2322/* harmony export (immutable) */ __webpack_exports__["a"] = each;
2323/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(85);
2324/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
2325/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16);
2326
2327
2328
2329
2330// The cornerstone for collection functions, an `each`
2331// implementation, aka `forEach`.
2332// Handles raw objects in addition to array-likes. Treats all
2333// sparse array-likes as if they were dense.
2334function each(obj, iteratee, context) {
2335 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context);
2336 var i, length;
2337 if (Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj)) {
2338 for (i = 0, length = obj.length; i < length; i++) {
2339 iteratee(obj[i], i, obj);
2340 }
2341 } else {
2342 var _keys = Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj);
2343 for (i = 0, length = _keys.length; i < length; i++) {
2344 iteratee(obj[_keys[i]], _keys[i], obj);
2345 }
2346 }
2347 return obj;
2348}
2349
2350
2351/***/ }),
2352/* 57 */
2353/***/ (function(module, exports, __webpack_require__) {
2354
2355module.exports = __webpack_require__(402);
2356
2357/***/ }),
2358/* 58 */
2359/***/ (function(module, exports, __webpack_require__) {
2360
2361"use strict";
2362
2363
2364function _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); }
2365
2366/* eslint-env browser */
2367
2368/**
2369 * This is the web browser implementation of `debug()`.
2370 */
2371exports.log = log;
2372exports.formatArgs = formatArgs;
2373exports.save = save;
2374exports.load = load;
2375exports.useColors = useColors;
2376exports.storage = localstorage();
2377/**
2378 * Colors.
2379 */
2380
2381exports.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'];
2382/**
2383 * Currently only WebKit-based Web Inspectors, Firefox >= v31,
2384 * and the Firebug extension (any Firefox version) are known
2385 * to support "%c" CSS customizations.
2386 *
2387 * TODO: add a `localStorage` variable to explicitly enable/disable colors
2388 */
2389// eslint-disable-next-line complexity
2390
2391function useColors() {
2392 // NB: In an Electron preload script, document will be defined but not fully
2393 // initialized. Since we know we're in Chrome, we'll just detect this case
2394 // explicitly
2395 if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
2396 return true;
2397 } // Internet Explorer and Edge do not support colors.
2398
2399
2400 if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
2401 return false;
2402 } // Is webkit? http://stackoverflow.com/a/16459606/376773
2403 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
2404
2405
2406 return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
2407 typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
2408 // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
2409 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
2410 typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
2411}
2412/**
2413 * Colorize log arguments if enabled.
2414 *
2415 * @api public
2416 */
2417
2418
2419function formatArgs(args) {
2420 args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
2421
2422 if (!this.useColors) {
2423 return;
2424 }
2425
2426 var c = 'color: ' + this.color;
2427 args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
2428 // arguments passed either before or after the %c, so we need to
2429 // figure out the correct index to insert the CSS into
2430
2431 var index = 0;
2432 var lastC = 0;
2433 args[0].replace(/%[a-zA-Z%]/g, function (match) {
2434 if (match === '%%') {
2435 return;
2436 }
2437
2438 index++;
2439
2440 if (match === '%c') {
2441 // We only are interested in the *last* %c
2442 // (the user may have provided their own)
2443 lastC = index;
2444 }
2445 });
2446 args.splice(lastC, 0, c);
2447}
2448/**
2449 * Invokes `console.log()` when available.
2450 * No-op when `console.log` is not a "function".
2451 *
2452 * @api public
2453 */
2454
2455
2456function log() {
2457 var _console;
2458
2459 // This hackery is required for IE8/9, where
2460 // the `console.log` function doesn't have 'apply'
2461 return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
2462}
2463/**
2464 * Save `namespaces`.
2465 *
2466 * @param {String} namespaces
2467 * @api private
2468 */
2469
2470
2471function save(namespaces) {
2472 try {
2473 if (namespaces) {
2474 exports.storage.setItem('debug', namespaces);
2475 } else {
2476 exports.storage.removeItem('debug');
2477 }
2478 } catch (error) {// Swallow
2479 // XXX (@Qix-) should we be logging these?
2480 }
2481}
2482/**
2483 * Load `namespaces`.
2484 *
2485 * @return {String} returns the previously persisted debug modes
2486 * @api private
2487 */
2488
2489
2490function load() {
2491 var r;
2492
2493 try {
2494 r = exports.storage.getItem('debug');
2495 } catch (error) {} // Swallow
2496 // XXX (@Qix-) should we be logging these?
2497 // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
2498
2499
2500 if (!r && typeof process !== 'undefined' && 'env' in process) {
2501 r = process.env.DEBUG;
2502 }
2503
2504 return r;
2505}
2506/**
2507 * Localstorage attempts to return the localstorage.
2508 *
2509 * This is necessary because safari throws
2510 * when a user disables cookies/localstorage
2511 * and you attempt to access it.
2512 *
2513 * @return {LocalStorage}
2514 * @api private
2515 */
2516
2517
2518function localstorage() {
2519 try {
2520 // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
2521 // The Browser also has localStorage in the global context.
2522 return localStorage;
2523 } catch (error) {// Swallow
2524 // XXX (@Qix-) should we be logging these?
2525 }
2526}
2527
2528module.exports = __webpack_require__(407)(exports);
2529var formatters = module.exports.formatters;
2530/**
2531 * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
2532 */
2533
2534formatters.j = function (v) {
2535 try {
2536 return JSON.stringify(v);
2537 } catch (error) {
2538 return '[UnexpectedJSONParseError]: ' + error.message;
2539 }
2540};
2541
2542
2543
2544/***/ }),
2545/* 59 */
2546/***/ (function(module, exports, __webpack_require__) {
2547
2548module.exports = __webpack_require__(234);
2549
2550/***/ }),
2551/* 60 */
2552/***/ (function(module, exports, __webpack_require__) {
2553
2554var DESCRIPTORS = __webpack_require__(14);
2555var call = __webpack_require__(15);
2556var propertyIsEnumerableModule = __webpack_require__(119);
2557var createPropertyDescriptor = __webpack_require__(47);
2558var toIndexedObject = __webpack_require__(32);
2559var toPropertyKey = __webpack_require__(95);
2560var hasOwn = __webpack_require__(12);
2561var IE8_DOM_DEFINE = __webpack_require__(152);
2562
2563// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
2564var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
2565
2566// `Object.getOwnPropertyDescriptor` method
2567// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
2568exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
2569 O = toIndexedObject(O);
2570 P = toPropertyKey(P);
2571 if (IE8_DOM_DEFINE) try {
2572 return $getOwnPropertyDescriptor(O, P);
2573 } catch (error) { /* empty */ }
2574 if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
2575};
2576
2577
2578/***/ }),
2579/* 61 */
2580/***/ (function(module, exports, __webpack_require__) {
2581
2582var uncurryThis = __webpack_require__(4);
2583
2584var toString = uncurryThis({}.toString);
2585var stringSlice = uncurryThis(''.slice);
2586
2587module.exports = function (it) {
2588 return stringSlice(toString(it), 8, -1);
2589};
2590
2591
2592/***/ }),
2593/* 62 */
2594/***/ (function(module, exports, __webpack_require__) {
2595
2596/* eslint-disable es-x/no-symbol -- required for testing */
2597var V8_VERSION = __webpack_require__(75);
2598var fails = __webpack_require__(2);
2599
2600// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
2601module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
2602 var symbol = Symbol();
2603 // Chrome 38 Symbol has incorrect toString conversion
2604 // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
2605 return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
2606 // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
2607 !Symbol.sham && V8_VERSION && V8_VERSION < 41;
2608});
2609
2610
2611/***/ }),
2612/* 63 */
2613/***/ (function(module, exports) {
2614
2615// empty
2616
2617
2618/***/ }),
2619/* 64 */
2620/***/ (function(module, exports, __webpack_require__) {
2621
2622var global = __webpack_require__(7);
2623
2624module.exports = global.Promise;
2625
2626
2627/***/ }),
2628/* 65 */
2629/***/ (function(module, exports, __webpack_require__) {
2630
2631"use strict";
2632
2633var charAt = __webpack_require__(310).charAt;
2634var toString = __webpack_require__(79);
2635var InternalStateModule = __webpack_require__(42);
2636var defineIterator = __webpack_require__(130);
2637
2638var STRING_ITERATOR = 'String Iterator';
2639var setInternalState = InternalStateModule.set;
2640var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
2641
2642// `String.prototype[@@iterator]` method
2643// https://tc39.es/ecma262/#sec-string.prototype-@@iterator
2644defineIterator(String, 'String', function (iterated) {
2645 setInternalState(this, {
2646 type: STRING_ITERATOR,
2647 string: toString(iterated),
2648 index: 0
2649 });
2650// `%StringIteratorPrototype%.next` method
2651// https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
2652}, function next() {
2653 var state = getInternalState(this);
2654 var string = state.string;
2655 var index = state.index;
2656 var point;
2657 if (index >= string.length) return { value: undefined, done: true };
2658 point = charAt(string, index);
2659 state.index += point.length;
2660 return { value: point, done: false };
2661});
2662
2663
2664/***/ }),
2665/* 66 */
2666/***/ (function(module, __webpack_exports__, __webpack_require__) {
2667
2668"use strict";
2669/* harmony export (immutable) */ __webpack_exports__["a"] = values;
2670/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
2671
2672
2673// Retrieve the values of an object's properties.
2674function values(obj) {
2675 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
2676 var length = _keys.length;
2677 var values = Array(length);
2678 for (var i = 0; i < length; i++) {
2679 values[i] = obj[_keys[i]];
2680 }
2681 return values;
2682}
2683
2684
2685/***/ }),
2686/* 67 */
2687/***/ (function(module, __webpack_exports__, __webpack_require__) {
2688
2689"use strict";
2690/* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
2691/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
2692/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
2693/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArray_js__ = __webpack_require__(55);
2694/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(134);
2695
2696
2697
2698
2699
2700// Internal implementation of a recursive `flatten` function.
2701function flatten(input, depth, strict, output) {
2702 output = output || [];
2703 if (!depth && depth !== 0) {
2704 depth = Infinity;
2705 } else if (depth <= 0) {
2706 return output.concat(input);
2707 }
2708 var idx = output.length;
2709 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(input); i < length; i++) {
2710 var value = input[i];
2711 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))) {
2712 // Flatten current level of array or arguments object.
2713 if (depth > 1) {
2714 flatten(value, depth - 1, strict, output);
2715 idx = output.length;
2716 } else {
2717 var j = 0, len = value.length;
2718 while (j < len) output[idx++] = value[j++];
2719 }
2720 } else if (!strict) {
2721 output[idx++] = value;
2722 }
2723 }
2724 return output;
2725}
2726
2727
2728/***/ }),
2729/* 68 */
2730/***/ (function(module, __webpack_exports__, __webpack_require__) {
2731
2732"use strict";
2733/* harmony export (immutable) */ __webpack_exports__["a"] = map;
2734/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
2735/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
2736/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16);
2737
2738
2739
2740
2741// Return the results of applying the iteratee to each element.
2742function map(obj, iteratee, context) {
2743 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
2744 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
2745 length = (_keys || obj).length,
2746 results = Array(length);
2747 for (var index = 0; index < length; index++) {
2748 var currentKey = _keys ? _keys[index] : index;
2749 results[index] = iteratee(obj[currentKey], currentKey, obj);
2750 }
2751 return results;
2752}
2753
2754
2755/***/ }),
2756/* 69 */
2757/***/ (function(module, exports, __webpack_require__) {
2758
2759"use strict";
2760/* WEBPACK VAR INJECTION */(function(global) {
2761
2762var _interopRequireDefault = __webpack_require__(1);
2763
2764var _promise = _interopRequireDefault(__webpack_require__(13));
2765
2766var _concat = _interopRequireDefault(__webpack_require__(22));
2767
2768var _map = _interopRequireDefault(__webpack_require__(35));
2769
2770var _keys = _interopRequireDefault(__webpack_require__(146));
2771
2772var _stringify = _interopRequireDefault(__webpack_require__(36));
2773
2774var _indexOf = _interopRequireDefault(__webpack_require__(90));
2775
2776var _keys2 = _interopRequireDefault(__webpack_require__(57));
2777
2778var _ = __webpack_require__(3);
2779
2780var uuid = __webpack_require__(226);
2781
2782var debug = __webpack_require__(58);
2783
2784var _require = __webpack_require__(30),
2785 inherits = _require.inherits,
2786 parseDate = _require.parseDate;
2787
2788var version = __webpack_require__(229);
2789
2790var _require2 = __webpack_require__(71),
2791 setAdapters = _require2.setAdapters,
2792 adapterManager = _require2.adapterManager;
2793
2794var AV = global.AV || {}; // All internal configuration items
2795
2796AV._config = {
2797 serverURLs: {},
2798 useMasterKey: false,
2799 production: null,
2800 realtime: null,
2801 requestTimeout: null
2802};
2803var initialUserAgent = "LeanCloud-JS-SDK/".concat(version); // configs shared by all AV instances
2804
2805AV._sharedConfig = {
2806 userAgent: initialUserAgent,
2807 liveQueryRealtime: null
2808};
2809adapterManager.on('platformInfo', function (platformInfo) {
2810 var ua = initialUserAgent;
2811
2812 if (platformInfo) {
2813 if (platformInfo.userAgent) {
2814 ua = platformInfo.userAgent;
2815 } else {
2816 var comments = platformInfo.name;
2817
2818 if (platformInfo.version) {
2819 comments += "/".concat(platformInfo.version);
2820 }
2821
2822 if (platformInfo.extra) {
2823 comments += "; ".concat(platformInfo.extra);
2824 }
2825
2826 ua += " (".concat(comments, ")");
2827 }
2828 }
2829
2830 AV._sharedConfig.userAgent = ua;
2831});
2832/**
2833 * Contains all AV API classes and functions.
2834 * @namespace AV
2835 */
2836
2837/**
2838 * Returns prefix for localStorage keys used by this instance of AV.
2839 * @param {String} path The relative suffix to append to it.
2840 * null or undefined is treated as the empty string.
2841 * @return {String} The full key name.
2842 * @private
2843 */
2844
2845AV._getAVPath = function (path) {
2846 if (!AV.applicationId) {
2847 throw new Error('You need to call AV.initialize before using AV.');
2848 }
2849
2850 if (!path) {
2851 path = '';
2852 }
2853
2854 if (!_.isString(path)) {
2855 throw new Error("Tried to get a localStorage path that wasn't a String.");
2856 }
2857
2858 if (path[0] === '/') {
2859 path = path.substring(1);
2860 }
2861
2862 return 'AV/' + AV.applicationId + '/' + path;
2863};
2864/**
2865 * Returns the unique string for this app on this machine.
2866 * Gets reset when localStorage is cleared.
2867 * @private
2868 */
2869
2870
2871AV._installationId = null;
2872
2873AV._getInstallationId = function () {
2874 // See if it's cached in RAM.
2875 if (AV._installationId) {
2876 return _promise.default.resolve(AV._installationId);
2877 } // Try to get it from localStorage.
2878
2879
2880 var path = AV._getAVPath('installationId');
2881
2882 return AV.localStorage.getItemAsync(path).then(function (_installationId) {
2883 AV._installationId = _installationId;
2884
2885 if (!AV._installationId) {
2886 // It wasn't in localStorage, so create a new one.
2887 AV._installationId = _installationId = uuid();
2888 return AV.localStorage.setItemAsync(path, _installationId).then(function () {
2889 return _installationId;
2890 });
2891 }
2892
2893 return _installationId;
2894 });
2895};
2896
2897AV._subscriptionId = null;
2898
2899AV._refreshSubscriptionId = function () {
2900 var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : AV._getAVPath('subscriptionId');
2901 var subscriptionId = AV._subscriptionId = uuid();
2902 return AV.localStorage.setItemAsync(path, subscriptionId).then(function () {
2903 return subscriptionId;
2904 });
2905};
2906
2907AV._getSubscriptionId = function () {
2908 // See if it's cached in RAM.
2909 if (AV._subscriptionId) {
2910 return _promise.default.resolve(AV._subscriptionId);
2911 } // Try to get it from localStorage.
2912
2913
2914 var path = AV._getAVPath('subscriptionId');
2915
2916 return AV.localStorage.getItemAsync(path).then(function (_subscriptionId) {
2917 AV._subscriptionId = _subscriptionId;
2918
2919 if (!AV._subscriptionId) {
2920 // It wasn't in localStorage, so create a new one.
2921 _subscriptionId = AV._refreshSubscriptionId(path);
2922 }
2923
2924 return _subscriptionId;
2925 });
2926};
2927
2928AV._parseDate = parseDate; // A self-propagating extend function.
2929
2930AV._extend = function (protoProps, classProps) {
2931 var child = inherits(this, protoProps, classProps);
2932 child.extend = this.extend;
2933 return child;
2934};
2935/**
2936 * Converts a value in a AV Object into the appropriate representation.
2937 * This is the JS equivalent of Java's AV.maybeReferenceAndEncode(Object)
2938 * if seenObjects is falsey. Otherwise any AV.Objects not in
2939 * seenObjects will be fully embedded rather than encoded
2940 * as a pointer. This array will be used to prevent going into an infinite
2941 * loop because we have circular references. If <seenObjects>
2942 * is set, then none of the AV Objects that are serialized can be dirty.
2943 * @private
2944 */
2945
2946
2947AV._encode = function (value, seenObjects, disallowObjects) {
2948 var full = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
2949
2950 if (value instanceof AV.Object) {
2951 if (disallowObjects) {
2952 throw new Error('AV.Objects not allowed here');
2953 }
2954
2955 if (!seenObjects || _.include(seenObjects, value) || !value._hasData) {
2956 return value._toPointer();
2957 }
2958
2959 return value._toFullJSON((0, _concat.default)(seenObjects).call(seenObjects, value), full);
2960 }
2961
2962 if (value instanceof AV.ACL) {
2963 return value.toJSON();
2964 }
2965
2966 if (_.isDate(value)) {
2967 return full ? {
2968 __type: 'Date',
2969 iso: value.toJSON()
2970 } : value.toJSON();
2971 }
2972
2973 if (value instanceof AV.GeoPoint) {
2974 return value.toJSON();
2975 }
2976
2977 if (_.isArray(value)) {
2978 return (0, _map.default)(_).call(_, value, function (x) {
2979 return AV._encode(x, seenObjects, disallowObjects, full);
2980 });
2981 }
2982
2983 if (_.isRegExp(value)) {
2984 return value.source;
2985 }
2986
2987 if (value instanceof AV.Relation) {
2988 return value.toJSON();
2989 }
2990
2991 if (value instanceof AV.Op) {
2992 return value.toJSON();
2993 }
2994
2995 if (value instanceof AV.File) {
2996 if (!value.url() && !value.id) {
2997 throw new Error('Tried to save an object containing an unsaved file.');
2998 }
2999
3000 return value._toFullJSON(seenObjects, full);
3001 }
3002
3003 if (_.isObject(value)) {
3004 return _.mapObject(value, function (v, k) {
3005 return AV._encode(v, seenObjects, disallowObjects, full);
3006 });
3007 }
3008
3009 return value;
3010};
3011/**
3012 * The inverse function of AV._encode.
3013 * @private
3014 */
3015
3016
3017AV._decode = function (value, key) {
3018 if (!_.isObject(value) || _.isDate(value)) {
3019 return value;
3020 }
3021
3022 if (_.isArray(value)) {
3023 return (0, _map.default)(_).call(_, value, function (v) {
3024 return AV._decode(v);
3025 });
3026 }
3027
3028 if (value instanceof AV.Object) {
3029 return value;
3030 }
3031
3032 if (value instanceof AV.File) {
3033 return value;
3034 }
3035
3036 if (value instanceof AV.Op) {
3037 return value;
3038 }
3039
3040 if (value instanceof AV.GeoPoint) {
3041 return value;
3042 }
3043
3044 if (value instanceof AV.ACL) {
3045 return value;
3046 }
3047
3048 if (key === 'ACL') {
3049 return new AV.ACL(value);
3050 }
3051
3052 if (value.__op) {
3053 return AV.Op._decode(value);
3054 }
3055
3056 var className;
3057
3058 if (value.__type === 'Pointer') {
3059 className = value.className;
3060
3061 var pointer = AV.Object._create(className);
3062
3063 if ((0, _keys.default)(value).length > 3) {
3064 var v = _.clone(value);
3065
3066 delete v.__type;
3067 delete v.className;
3068
3069 pointer._finishFetch(v, true);
3070 } else {
3071 pointer._finishFetch({
3072 objectId: value.objectId
3073 }, false);
3074 }
3075
3076 return pointer;
3077 }
3078
3079 if (value.__type === 'Object') {
3080 // It's an Object included in a query result.
3081 className = value.className;
3082
3083 var _v = _.clone(value);
3084
3085 delete _v.__type;
3086 delete _v.className;
3087
3088 var object = AV.Object._create(className);
3089
3090 object._finishFetch(_v, true);
3091
3092 return object;
3093 }
3094
3095 if (value.__type === 'Date') {
3096 return AV._parseDate(value.iso);
3097 }
3098
3099 if (value.__type === 'GeoPoint') {
3100 return new AV.GeoPoint({
3101 latitude: value.latitude,
3102 longitude: value.longitude
3103 });
3104 }
3105
3106 if (value.__type === 'Relation') {
3107 if (!key) throw new Error('key missing decoding a Relation');
3108 var relation = new AV.Relation(null, key);
3109 relation.targetClassName = value.className;
3110 return relation;
3111 }
3112
3113 if (value.__type === 'File') {
3114 var file = new AV.File(value.name);
3115
3116 var _v2 = _.clone(value);
3117
3118 delete _v2.__type;
3119
3120 file._finishFetch(_v2);
3121
3122 return file;
3123 }
3124
3125 return _.mapObject(value, AV._decode);
3126};
3127/**
3128 * The inverse function of {@link AV.Object#toFullJSON}.
3129 * @since 3.0.0
3130 * @method
3131 * @param {Object}
3132 * return {AV.Object|AV.File|any}
3133 */
3134
3135
3136AV.parseJSON = AV._decode;
3137/**
3138 * Similar to JSON.parse, except that AV internal types will be used if possible.
3139 * Inverse to {@link AV.stringify}
3140 * @since 3.14.0
3141 * @param {string} text the string to parse.
3142 * @return {AV.Object|AV.File|any}
3143 */
3144
3145AV.parse = function (text) {
3146 return AV.parseJSON(JSON.parse(text));
3147};
3148/**
3149 * Serialize a target containing AV.Object, similar to JSON.stringify.
3150 * Inverse to {@link AV.parse}
3151 * @since 3.14.0
3152 * @return {string}
3153 */
3154
3155
3156AV.stringify = function (target) {
3157 return (0, _stringify.default)(AV._encode(target, [], false, true));
3158};
3159
3160AV._encodeObjectOrArray = function (value) {
3161 var encodeAVObject = function encodeAVObject(object) {
3162 if (object && object._toFullJSON) {
3163 object = object._toFullJSON([]);
3164 }
3165
3166 return _.mapObject(object, function (value) {
3167 return AV._encode(value, []);
3168 });
3169 };
3170
3171 if (_.isArray(value)) {
3172 return (0, _map.default)(value).call(value, function (object) {
3173 return encodeAVObject(object);
3174 });
3175 } else {
3176 return encodeAVObject(value);
3177 }
3178};
3179
3180AV._arrayEach = _.each;
3181/**
3182 * Does a deep traversal of every item in object, calling func on every one.
3183 * @param {Object} object The object or array to traverse deeply.
3184 * @param {Function} func The function to call for every item. It will
3185 * be passed the item as an argument. If it returns a truthy value, that
3186 * value will replace the item in its parent container.
3187 * @returns {} the result of calling func on the top-level object itself.
3188 * @private
3189 */
3190
3191AV._traverse = function (object, func, seen) {
3192 if (object instanceof AV.Object) {
3193 seen = seen || [];
3194
3195 if ((0, _indexOf.default)(_).call(_, seen, object) >= 0) {
3196 // We've already visited this object in this call.
3197 return;
3198 }
3199
3200 seen.push(object);
3201
3202 AV._traverse(object.attributes, func, seen);
3203
3204 return func(object);
3205 }
3206
3207 if (object instanceof AV.Relation || object instanceof AV.File) {
3208 // Nothing needs to be done, but we don't want to recurse into the
3209 // object's parent infinitely, so we catch this case.
3210 return func(object);
3211 }
3212
3213 if (_.isArray(object)) {
3214 _.each(object, function (child, index) {
3215 var newChild = AV._traverse(child, func, seen);
3216
3217 if (newChild) {
3218 object[index] = newChild;
3219 }
3220 });
3221
3222 return func(object);
3223 }
3224
3225 if (_.isObject(object)) {
3226 AV._each(object, function (child, key) {
3227 var newChild = AV._traverse(child, func, seen);
3228
3229 if (newChild) {
3230 object[key] = newChild;
3231 }
3232 });
3233
3234 return func(object);
3235 }
3236
3237 return func(object);
3238};
3239/**
3240 * This is like _.each, except:
3241 * * it doesn't work for so-called array-like objects,
3242 * * it does work for dictionaries with a "length" attribute.
3243 * @private
3244 */
3245
3246
3247AV._objectEach = AV._each = function (obj, callback) {
3248 if (_.isObject(obj)) {
3249 _.each((0, _keys2.default)(_).call(_, obj), function (key) {
3250 callback(obj[key], key);
3251 });
3252 } else {
3253 _.each(obj, callback);
3254 }
3255};
3256/**
3257 * @namespace
3258 * @since 3.14.0
3259 */
3260
3261
3262AV.debug = {
3263 /**
3264 * Enable debug
3265 */
3266 enable: function enable() {
3267 var namespaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'leancloud*';
3268 return debug.enable(namespaces);
3269 },
3270
3271 /**
3272 * Disable debug
3273 */
3274 disable: debug.disable
3275};
3276/**
3277 * Specify Adapters
3278 * @since 4.4.0
3279 * @function
3280 * @param {Adapters} newAdapters See {@link https://url.leanapp.cn/adapter-type-definitions @leancloud/adapter-types} for detailed definitions.
3281 */
3282
3283AV.setAdapters = setAdapters;
3284module.exports = AV;
3285/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(72)))
3286
3287/***/ }),
3288/* 70 */
3289/***/ (function(module, exports, __webpack_require__) {
3290
3291var bind = __webpack_require__(48);
3292var uncurryThis = __webpack_require__(4);
3293var IndexedObject = __webpack_require__(94);
3294var toObject = __webpack_require__(34);
3295var lengthOfArrayLike = __webpack_require__(39);
3296var arraySpeciesCreate = __webpack_require__(223);
3297
3298var push = uncurryThis([].push);
3299
3300// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
3301var createMethod = function (TYPE) {
3302 var IS_MAP = TYPE == 1;
3303 var IS_FILTER = TYPE == 2;
3304 var IS_SOME = TYPE == 3;
3305 var IS_EVERY = TYPE == 4;
3306 var IS_FIND_INDEX = TYPE == 6;
3307 var IS_FILTER_REJECT = TYPE == 7;
3308 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
3309 return function ($this, callbackfn, that, specificCreate) {
3310 var O = toObject($this);
3311 var self = IndexedObject(O);
3312 var boundFunction = bind(callbackfn, that);
3313 var length = lengthOfArrayLike(self);
3314 var index = 0;
3315 var create = specificCreate || arraySpeciesCreate;
3316 var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
3317 var value, result;
3318 for (;length > index; index++) if (NO_HOLES || index in self) {
3319 value = self[index];
3320 result = boundFunction(value, index, O);
3321 if (TYPE) {
3322 if (IS_MAP) target[index] = result; // map
3323 else if (result) switch (TYPE) {
3324 case 3: return true; // some
3325 case 5: return value; // find
3326 case 6: return index; // findIndex
3327 case 2: push(target, value); // filter
3328 } else switch (TYPE) {
3329 case 4: return false; // every
3330 case 7: push(target, value); // filterReject
3331 }
3332 }
3333 }
3334 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
3335 };
3336};
3337
3338module.exports = {
3339 // `Array.prototype.forEach` method
3340 // https://tc39.es/ecma262/#sec-array.prototype.foreach
3341 forEach: createMethod(0),
3342 // `Array.prototype.map` method
3343 // https://tc39.es/ecma262/#sec-array.prototype.map
3344 map: createMethod(1),
3345 // `Array.prototype.filter` method
3346 // https://tc39.es/ecma262/#sec-array.prototype.filter
3347 filter: createMethod(2),
3348 // `Array.prototype.some` method
3349 // https://tc39.es/ecma262/#sec-array.prototype.some
3350 some: createMethod(3),
3351 // `Array.prototype.every` method
3352 // https://tc39.es/ecma262/#sec-array.prototype.every
3353 every: createMethod(4),
3354 // `Array.prototype.find` method
3355 // https://tc39.es/ecma262/#sec-array.prototype.find
3356 find: createMethod(5),
3357 // `Array.prototype.findIndex` method
3358 // https://tc39.es/ecma262/#sec-array.prototype.findIndex
3359 findIndex: createMethod(6),
3360 // `Array.prototype.filterReject` method
3361 // https://github.com/tc39/proposal-array-filtering
3362 filterReject: createMethod(7)
3363};
3364
3365
3366/***/ }),
3367/* 71 */
3368/***/ (function(module, exports, __webpack_require__) {
3369
3370"use strict";
3371
3372
3373var _interopRequireDefault = __webpack_require__(1);
3374
3375var _keys = _interopRequireDefault(__webpack_require__(57));
3376
3377var _ = __webpack_require__(3);
3378
3379var EventEmitter = __webpack_require__(230);
3380
3381var _require = __webpack_require__(30),
3382 inherits = _require.inherits;
3383
3384var AdapterManager = inherits(EventEmitter, {
3385 constructor: function constructor() {
3386 EventEmitter.apply(this);
3387 this._adapters = {};
3388 },
3389 getAdapter: function getAdapter(name) {
3390 var adapter = this._adapters[name];
3391
3392 if (adapter === undefined) {
3393 throw new Error("".concat(name, " adapter is not configured"));
3394 }
3395
3396 return adapter;
3397 },
3398 setAdapters: function setAdapters(newAdapters) {
3399 var _this = this;
3400
3401 _.extend(this._adapters, newAdapters);
3402
3403 (0, _keys.default)(_).call(_, newAdapters).forEach(function (name) {
3404 return _this.emit(name, newAdapters[name]);
3405 });
3406 }
3407});
3408var adapterManager = new AdapterManager();
3409module.exports = {
3410 getAdapter: adapterManager.getAdapter.bind(adapterManager),
3411 setAdapters: adapterManager.setAdapters.bind(adapterManager),
3412 adapterManager: adapterManager
3413};
3414
3415/***/ }),
3416/* 72 */
3417/***/ (function(module, exports) {
3418
3419var g;
3420
3421// This works in non-strict mode
3422g = (function() {
3423 return this;
3424})();
3425
3426try {
3427 // This works if eval is allowed (see CSP)
3428 g = g || Function("return this")() || (1,eval)("this");
3429} catch(e) {
3430 // This works if the window reference is available
3431 if(typeof window === "object")
3432 g = window;
3433}
3434
3435// g can still be undefined, but nothing to do about it...
3436// We return undefined, instead of nothing here, so it's
3437// easier to handle this case. if(!global) { ...}
3438
3439module.exports = g;
3440
3441
3442/***/ }),
3443/* 73 */
3444/***/ (function(module, exports, __webpack_require__) {
3445
3446var NATIVE_BIND = __webpack_require__(74);
3447
3448var FunctionPrototype = Function.prototype;
3449var apply = FunctionPrototype.apply;
3450var call = FunctionPrototype.call;
3451
3452// eslint-disable-next-line es-x/no-reflect -- safe
3453module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () {
3454 return call.apply(apply, arguments);
3455});
3456
3457
3458/***/ }),
3459/* 74 */
3460/***/ (function(module, exports, __webpack_require__) {
3461
3462var fails = __webpack_require__(2);
3463
3464module.exports = !fails(function () {
3465 // eslint-disable-next-line es-x/no-function-prototype-bind -- safe
3466 var test = (function () { /* empty */ }).bind();
3467 // eslint-disable-next-line no-prototype-builtins -- safe
3468 return typeof test != 'function' || test.hasOwnProperty('prototype');
3469});
3470
3471
3472/***/ }),
3473/* 75 */
3474/***/ (function(module, exports, __webpack_require__) {
3475
3476var global = __webpack_require__(7);
3477var userAgent = __webpack_require__(97);
3478
3479var process = global.process;
3480var Deno = global.Deno;
3481var versions = process && process.versions || Deno && Deno.version;
3482var v8 = versions && versions.v8;
3483var match, version;
3484
3485if (v8) {
3486 match = v8.split('.');
3487 // in old Chrome, versions of V8 isn't V8 = Chrome / 10
3488 // but their correct versions are not interesting for us
3489 version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
3490}
3491
3492// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
3493// so check `userAgent` even if `.v8` exists, but 0
3494if (!version && userAgent) {
3495 match = userAgent.match(/Edge\/(\d+)/);
3496 if (!match || match[1] >= 74) {
3497 match = userAgent.match(/Chrome\/(\d+)/);
3498 if (match) version = +match[1];
3499 }
3500}
3501
3502module.exports = version;
3503
3504
3505/***/ }),
3506/* 76 */
3507/***/ (function(module, exports) {
3508
3509var $String = String;
3510
3511module.exports = function (argument) {
3512 try {
3513 return $String(argument);
3514 } catch (error) {
3515 return 'Object';
3516 }
3517};
3518
3519
3520/***/ }),
3521/* 77 */
3522/***/ (function(module, exports, __webpack_require__) {
3523
3524var IS_PURE = __webpack_require__(33);
3525var store = __webpack_require__(122);
3526
3527(module.exports = function (key, value) {
3528 return store[key] || (store[key] = value !== undefined ? value : {});
3529})('versions', []).push({
3530 version: '3.23.3',
3531 mode: IS_PURE ? 'pure' : 'global',
3532 copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
3533 license: 'https://github.com/zloirock/core-js/blob/v3.23.3/LICENSE',
3534 source: 'https://github.com/zloirock/core-js'
3535});
3536
3537
3538/***/ }),
3539/* 78 */
3540/***/ (function(module, exports) {
3541
3542module.exports = {};
3543
3544
3545/***/ }),
3546/* 79 */
3547/***/ (function(module, exports, __webpack_require__) {
3548
3549var classof = __webpack_require__(51);
3550
3551var $String = String;
3552
3553module.exports = function (argument) {
3554 if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
3555 return $String(argument);
3556};
3557
3558
3559/***/ }),
3560/* 80 */
3561/***/ (function(module, exports) {
3562
3563module.exports = function (exec) {
3564 try {
3565 return { error: false, value: exec() };
3566 } catch (error) {
3567 return { error: true, value: error };
3568 }
3569};
3570
3571
3572/***/ }),
3573/* 81 */
3574/***/ (function(module, exports, __webpack_require__) {
3575
3576var global = __webpack_require__(7);
3577var NativePromiseConstructor = __webpack_require__(64);
3578var isCallable = __webpack_require__(8);
3579var isForced = __webpack_require__(153);
3580var inspectSource = __webpack_require__(129);
3581var wellKnownSymbol = __webpack_require__(9);
3582var IS_BROWSER = __webpack_require__(301);
3583var IS_PURE = __webpack_require__(33);
3584var V8_VERSION = __webpack_require__(75);
3585
3586var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
3587var SPECIES = wellKnownSymbol('species');
3588var SUBCLASSING = false;
3589var NATIVE_PROMISE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent);
3590
3591var FORCED_PROMISE_CONSTRUCTOR = isForced('Promise', function () {
3592 var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor);
3593 var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor);
3594 // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
3595 // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
3596 // We can't detect it synchronously, so just check versions
3597 if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
3598 // We need Promise#{ catch, finally } in the pure version for preventing prototype pollution
3599 if (IS_PURE && !(NativePromisePrototype['catch'] && NativePromisePrototype['finally'])) return true;
3600 // We can't use @@species feature detection in V8 since it causes
3601 // deoptimization and performance degradation
3602 // https://github.com/zloirock/core-js/issues/679
3603 if (V8_VERSION >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
3604 // Detect correctness of subclassing with @@species support
3605 var promise = new NativePromiseConstructor(function (resolve) { resolve(1); });
3606 var FakePromise = function (exec) {
3607 exec(function () { /* empty */ }, function () { /* empty */ });
3608 };
3609 var constructor = promise.constructor = {};
3610 constructor[SPECIES] = FakePromise;
3611 SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
3612 if (!SUBCLASSING) return true;
3613 // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
3614 return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_PROMISE_REJECTION_EVENT;
3615});
3616
3617module.exports = {
3618 CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR,
3619 REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT,
3620 SUBCLASSING: SUBCLASSING
3621};
3622
3623
3624/***/ }),
3625/* 82 */
3626/***/ (function(module, __webpack_exports__, __webpack_require__) {
3627
3628"use strict";
3629/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hasStringTagBug; });
3630/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isIE11; });
3631/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(5);
3632/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__ = __webpack_require__(318);
3633
3634
3635
3636// In IE 10 - Edge 13, `DataView` has string tag `'[object Object]'`.
3637// In IE 11, the most common among them, this problem also applies to
3638// `Map`, `WeakMap` and `Set`.
3639var hasStringTagBug = (
3640 __WEBPACK_IMPORTED_MODULE_0__setup_js__["s" /* supportsDataView */] && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new DataView(new ArrayBuffer(8)))
3641 ),
3642 isIE11 = (typeof Map !== 'undefined' && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new Map));
3643
3644
3645/***/ }),
3646/* 83 */
3647/***/ (function(module, __webpack_exports__, __webpack_require__) {
3648
3649"use strict";
3650/* harmony export (immutable) */ __webpack_exports__["a"] = allKeys;
3651/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(54);
3652/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(5);
3653/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__ = __webpack_require__(184);
3654
3655
3656
3657
3658// Retrieve all the enumerable property names of an object.
3659function allKeys(obj) {
3660 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return [];
3661 var keys = [];
3662 for (var key in obj) keys.push(key);
3663 // Ahem, IE < 9.
3664 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__["a" /* default */])(obj, keys);
3665 return keys;
3666}
3667
3668
3669/***/ }),
3670/* 84 */
3671/***/ (function(module, __webpack_exports__, __webpack_require__) {
3672
3673"use strict";
3674/* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
3675/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
3676/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(193);
3677
3678
3679
3680// Internal wrapper for `_.toPath` to enable minification.
3681// Similar to `cb` for `_.iteratee`.
3682function toPath(path) {
3683 return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath(path);
3684}
3685
3686
3687/***/ }),
3688/* 85 */
3689/***/ (function(module, __webpack_exports__, __webpack_require__) {
3690
3691"use strict";
3692/* harmony export (immutable) */ __webpack_exports__["a"] = optimizeCb;
3693// Internal function that returns an efficient (for current engines) version
3694// of the passed-in callback, to be repeatedly applied in other Underscore
3695// functions.
3696function optimizeCb(func, context, argCount) {
3697 if (context === void 0) return func;
3698 switch (argCount == null ? 3 : argCount) {
3699 case 1: return function(value) {
3700 return func.call(context, value);
3701 };
3702 // The 2-argument case is omitted because we’re not using it.
3703 case 3: return function(value, index, collection) {
3704 return func.call(context, value, index, collection);
3705 };
3706 case 4: return function(accumulator, value, index, collection) {
3707 return func.call(context, accumulator, value, index, collection);
3708 };
3709 }
3710 return function() {
3711 return func.apply(context, arguments);
3712 };
3713}
3714
3715
3716/***/ }),
3717/* 86 */
3718/***/ (function(module, __webpack_exports__, __webpack_require__) {
3719
3720"use strict";
3721/* harmony export (immutable) */ __webpack_exports__["a"] = filter;
3722/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
3723/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(56);
3724
3725
3726
3727// Return all the elements that pass a truth test.
3728function filter(obj, predicate, context) {
3729 var results = [];
3730 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
3731 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index, list) {
3732 if (predicate(value, index, list)) results.push(value);
3733 });
3734 return results;
3735}
3736
3737
3738/***/ }),
3739/* 87 */
3740/***/ (function(module, __webpack_exports__, __webpack_require__) {
3741
3742"use strict";
3743/* harmony export (immutable) */ __webpack_exports__["a"] = contains;
3744/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
3745/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(66);
3746/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__indexOf_js__ = __webpack_require__(209);
3747
3748
3749
3750
3751// Determine if the array or object contains a given item (using `===`).
3752function contains(obj, item, fromIndex, guard) {
3753 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
3754 if (typeof fromIndex != 'number' || guard) fromIndex = 0;
3755 return Object(__WEBPACK_IMPORTED_MODULE_2__indexOf_js__["a" /* default */])(obj, item, fromIndex) >= 0;
3756}
3757
3758
3759/***/ }),
3760/* 88 */
3761/***/ (function(module, exports, __webpack_require__) {
3762
3763var classof = __webpack_require__(61);
3764
3765// `IsArray` abstract operation
3766// https://tc39.es/ecma262/#sec-isarray
3767// eslint-disable-next-line es-x/no-array-isarray -- safe
3768module.exports = Array.isArray || function isArray(argument) {
3769 return classof(argument) == 'Array';
3770};
3771
3772
3773/***/ }),
3774/* 89 */
3775/***/ (function(module, exports, __webpack_require__) {
3776
3777"use strict";
3778
3779var toPropertyKey = __webpack_require__(95);
3780var definePropertyModule = __webpack_require__(23);
3781var createPropertyDescriptor = __webpack_require__(47);
3782
3783module.exports = function (object, key, value) {
3784 var propertyKey = toPropertyKey(key);
3785 if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
3786 else object[propertyKey] = value;
3787};
3788
3789
3790/***/ }),
3791/* 90 */
3792/***/ (function(module, exports, __webpack_require__) {
3793
3794module.exports = __webpack_require__(398);
3795
3796/***/ }),
3797/* 91 */
3798/***/ (function(module, exports, __webpack_require__) {
3799
3800var _Symbol = __webpack_require__(236);
3801
3802var _Symbol$iterator = __webpack_require__(454);
3803
3804function _typeof(obj) {
3805 "@babel/helpers - typeof";
3806
3807 return (module.exports = _typeof = "function" == typeof _Symbol && "symbol" == typeof _Symbol$iterator ? function (obj) {
3808 return typeof obj;
3809 } : function (obj) {
3810 return obj && "function" == typeof _Symbol && obj.constructor === _Symbol && obj !== _Symbol.prototype ? "symbol" : typeof obj;
3811 }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
3812}
3813
3814module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
3815
3816/***/ }),
3817/* 92 */
3818/***/ (function(module, exports, __webpack_require__) {
3819
3820module.exports = __webpack_require__(468);
3821
3822/***/ }),
3823/* 93 */
3824/***/ (function(module, exports, __webpack_require__) {
3825
3826var $ = __webpack_require__(0);
3827var uncurryThis = __webpack_require__(4);
3828var hiddenKeys = __webpack_require__(78);
3829var isObject = __webpack_require__(11);
3830var hasOwn = __webpack_require__(12);
3831var defineProperty = __webpack_require__(23).f;
3832var getOwnPropertyNamesModule = __webpack_require__(102);
3833var getOwnPropertyNamesExternalModule = __webpack_require__(239);
3834var isExtensible = __webpack_require__(255);
3835var uid = __webpack_require__(98);
3836var FREEZING = __webpack_require__(254);
3837
3838var REQUIRED = false;
3839var METADATA = uid('meta');
3840var id = 0;
3841
3842var setMetadata = function (it) {
3843 defineProperty(it, METADATA, { value: {
3844 objectID: 'O' + id++, // object ID
3845 weakData: {} // weak collections IDs
3846 } });
3847};
3848
3849var fastKey = function (it, create) {
3850 // return a primitive with prefix
3851 if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
3852 if (!hasOwn(it, METADATA)) {
3853 // can't set metadata to uncaught frozen object
3854 if (!isExtensible(it)) return 'F';
3855 // not necessary to add metadata
3856 if (!create) return 'E';
3857 // add missing metadata
3858 setMetadata(it);
3859 // return object ID
3860 } return it[METADATA].objectID;
3861};
3862
3863var getWeakData = function (it, create) {
3864 if (!hasOwn(it, METADATA)) {
3865 // can't set metadata to uncaught frozen object
3866 if (!isExtensible(it)) return true;
3867 // not necessary to add metadata
3868 if (!create) return false;
3869 // add missing metadata
3870 setMetadata(it);
3871 // return the store of weak collections IDs
3872 } return it[METADATA].weakData;
3873};
3874
3875// add metadata on freeze-family methods calling
3876var onFreeze = function (it) {
3877 if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA)) setMetadata(it);
3878 return it;
3879};
3880
3881var enable = function () {
3882 meta.enable = function () { /* empty */ };
3883 REQUIRED = true;
3884 var getOwnPropertyNames = getOwnPropertyNamesModule.f;
3885 var splice = uncurryThis([].splice);
3886 var test = {};
3887 test[METADATA] = 1;
3888
3889 // prevent exposing of metadata key
3890 if (getOwnPropertyNames(test).length) {
3891 getOwnPropertyNamesModule.f = function (it) {
3892 var result = getOwnPropertyNames(it);
3893 for (var i = 0, length = result.length; i < length; i++) {
3894 if (result[i] === METADATA) {
3895 splice(result, i, 1);
3896 break;
3897 }
3898 } return result;
3899 };
3900
3901 $({ target: 'Object', stat: true, forced: true }, {
3902 getOwnPropertyNames: getOwnPropertyNamesExternalModule.f
3903 });
3904 }
3905};
3906
3907var meta = module.exports = {
3908 enable: enable,
3909 fastKey: fastKey,
3910 getWeakData: getWeakData,
3911 onFreeze: onFreeze
3912};
3913
3914hiddenKeys[METADATA] = true;
3915
3916
3917/***/ }),
3918/* 94 */
3919/***/ (function(module, exports, __webpack_require__) {
3920
3921var uncurryThis = __webpack_require__(4);
3922var fails = __webpack_require__(2);
3923var classof = __webpack_require__(61);
3924
3925var $Object = Object;
3926var split = uncurryThis(''.split);
3927
3928// fallback for non-array-like ES3 and non-enumerable old V8 strings
3929module.exports = fails(function () {
3930 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
3931 // eslint-disable-next-line no-prototype-builtins -- safe
3932 return !$Object('z').propertyIsEnumerable(0);
3933}) ? function (it) {
3934 return classof(it) == 'String' ? split(it, '') : $Object(it);
3935} : $Object;
3936
3937
3938/***/ }),
3939/* 95 */
3940/***/ (function(module, exports, __webpack_require__) {
3941
3942var toPrimitive = __webpack_require__(279);
3943var isSymbol = __webpack_require__(96);
3944
3945// `ToPropertyKey` abstract operation
3946// https://tc39.es/ecma262/#sec-topropertykey
3947module.exports = function (argument) {
3948 var key = toPrimitive(argument, 'string');
3949 return isSymbol(key) ? key : key + '';
3950};
3951
3952
3953/***/ }),
3954/* 96 */
3955/***/ (function(module, exports, __webpack_require__) {
3956
3957var getBuiltIn = __webpack_require__(18);
3958var isCallable = __webpack_require__(8);
3959var isPrototypeOf = __webpack_require__(19);
3960var USE_SYMBOL_AS_UID = __webpack_require__(151);
3961
3962var $Object = Object;
3963
3964module.exports = USE_SYMBOL_AS_UID ? function (it) {
3965 return typeof it == 'symbol';
3966} : function (it) {
3967 var $Symbol = getBuiltIn('Symbol');
3968 return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
3969};
3970
3971
3972/***/ }),
3973/* 97 */
3974/***/ (function(module, exports, __webpack_require__) {
3975
3976var getBuiltIn = __webpack_require__(18);
3977
3978module.exports = getBuiltIn('navigator', 'userAgent') || '';
3979
3980
3981/***/ }),
3982/* 98 */
3983/***/ (function(module, exports, __webpack_require__) {
3984
3985var uncurryThis = __webpack_require__(4);
3986
3987var id = 0;
3988var postfix = Math.random();
3989var toString = uncurryThis(1.0.toString);
3990
3991module.exports = function (key) {
3992 return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
3993};
3994
3995
3996/***/ }),
3997/* 99 */
3998/***/ (function(module, exports, __webpack_require__) {
3999
4000var hasOwn = __webpack_require__(12);
4001var isCallable = __webpack_require__(8);
4002var toObject = __webpack_require__(34);
4003var sharedKey = __webpack_require__(100);
4004var CORRECT_PROTOTYPE_GETTER = __webpack_require__(155);
4005
4006var IE_PROTO = sharedKey('IE_PROTO');
4007var $Object = Object;
4008var ObjectPrototype = $Object.prototype;
4009
4010// `Object.getPrototypeOf` method
4011// https://tc39.es/ecma262/#sec-object.getprototypeof
4012// eslint-disable-next-line es-x/no-object-getprototypeof -- safe
4013module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
4014 var object = toObject(O);
4015 if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];
4016 var constructor = object.constructor;
4017 if (isCallable(constructor) && object instanceof constructor) {
4018 return constructor.prototype;
4019 } return object instanceof $Object ? ObjectPrototype : null;
4020};
4021
4022
4023/***/ }),
4024/* 100 */
4025/***/ (function(module, exports, __webpack_require__) {
4026
4027var shared = __webpack_require__(77);
4028var uid = __webpack_require__(98);
4029
4030var keys = shared('keys');
4031
4032module.exports = function (key) {
4033 return keys[key] || (keys[key] = uid(key));
4034};
4035
4036
4037/***/ }),
4038/* 101 */
4039/***/ (function(module, exports, __webpack_require__) {
4040
4041/* eslint-disable no-proto -- safe */
4042var uncurryThis = __webpack_require__(4);
4043var anObject = __webpack_require__(20);
4044var aPossiblePrototype = __webpack_require__(282);
4045
4046// `Object.setPrototypeOf` method
4047// https://tc39.es/ecma262/#sec-object.setprototypeof
4048// Works with __proto__ only. Old v8 can't work with null proto objects.
4049// eslint-disable-next-line es-x/no-object-setprototypeof -- safe
4050module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
4051 var CORRECT_SETTER = false;
4052 var test = {};
4053 var setter;
4054 try {
4055 // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
4056 setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
4057 setter(test, []);
4058 CORRECT_SETTER = test instanceof Array;
4059 } catch (error) { /* empty */ }
4060 return function setPrototypeOf(O, proto) {
4061 anObject(O);
4062 aPossiblePrototype(proto);
4063 if (CORRECT_SETTER) setter(O, proto);
4064 else O.__proto__ = proto;
4065 return O;
4066 };
4067}() : undefined);
4068
4069
4070/***/ }),
4071/* 102 */
4072/***/ (function(module, exports, __webpack_require__) {
4073
4074var internalObjectKeys = __webpack_require__(157);
4075var enumBugKeys = __webpack_require__(126);
4076
4077var hiddenKeys = enumBugKeys.concat('length', 'prototype');
4078
4079// `Object.getOwnPropertyNames` method
4080// https://tc39.es/ecma262/#sec-object.getownpropertynames
4081// eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
4082exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
4083 return internalObjectKeys(O, hiddenKeys);
4084};
4085
4086
4087/***/ }),
4088/* 103 */
4089/***/ (function(module, exports) {
4090
4091// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
4092exports.f = Object.getOwnPropertySymbols;
4093
4094
4095/***/ }),
4096/* 104 */
4097/***/ (function(module, exports, __webpack_require__) {
4098
4099var internalObjectKeys = __webpack_require__(157);
4100var enumBugKeys = __webpack_require__(126);
4101
4102// `Object.keys` method
4103// https://tc39.es/ecma262/#sec-object.keys
4104// eslint-disable-next-line es-x/no-object-keys -- safe
4105module.exports = Object.keys || function keys(O) {
4106 return internalObjectKeys(O, enumBugKeys);
4107};
4108
4109
4110/***/ }),
4111/* 105 */
4112/***/ (function(module, exports, __webpack_require__) {
4113
4114var classof = __webpack_require__(51);
4115var getMethod = __webpack_require__(121);
4116var Iterators = __webpack_require__(50);
4117var wellKnownSymbol = __webpack_require__(9);
4118
4119var ITERATOR = wellKnownSymbol('iterator');
4120
4121module.exports = function (it) {
4122 if (it != undefined) return getMethod(it, ITERATOR)
4123 || getMethod(it, '@@iterator')
4124 || Iterators[classof(it)];
4125};
4126
4127
4128/***/ }),
4129/* 106 */
4130/***/ (function(module, exports, __webpack_require__) {
4131
4132var classof = __webpack_require__(61);
4133var global = __webpack_require__(7);
4134
4135module.exports = classof(global.process) == 'process';
4136
4137
4138/***/ }),
4139/* 107 */
4140/***/ (function(module, exports, __webpack_require__) {
4141
4142var isPrototypeOf = __webpack_require__(19);
4143
4144var $TypeError = TypeError;
4145
4146module.exports = function (it, Prototype) {
4147 if (isPrototypeOf(Prototype, it)) return it;
4148 throw $TypeError('Incorrect invocation');
4149};
4150
4151
4152/***/ }),
4153/* 108 */
4154/***/ (function(module, exports, __webpack_require__) {
4155
4156var uncurryThis = __webpack_require__(4);
4157var fails = __webpack_require__(2);
4158var isCallable = __webpack_require__(8);
4159var classof = __webpack_require__(51);
4160var getBuiltIn = __webpack_require__(18);
4161var inspectSource = __webpack_require__(129);
4162
4163var noop = function () { /* empty */ };
4164var empty = [];
4165var construct = getBuiltIn('Reflect', 'construct');
4166var constructorRegExp = /^\s*(?:class|function)\b/;
4167var exec = uncurryThis(constructorRegExp.exec);
4168var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
4169
4170var isConstructorModern = function isConstructor(argument) {
4171 if (!isCallable(argument)) return false;
4172 try {
4173 construct(noop, empty, argument);
4174 return true;
4175 } catch (error) {
4176 return false;
4177 }
4178};
4179
4180var isConstructorLegacy = function isConstructor(argument) {
4181 if (!isCallable(argument)) return false;
4182 switch (classof(argument)) {
4183 case 'AsyncFunction':
4184 case 'GeneratorFunction':
4185 case 'AsyncGeneratorFunction': return false;
4186 }
4187 try {
4188 // we can't check .prototype since constructors produced by .bind haven't it
4189 // `Function#toString` throws on some built-it function in some legacy engines
4190 // (for example, `DOMQuad` and similar in FF41-)
4191 return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
4192 } catch (error) {
4193 return true;
4194 }
4195};
4196
4197isConstructorLegacy.sham = true;
4198
4199// `IsConstructor` abstract operation
4200// https://tc39.es/ecma262/#sec-isconstructor
4201module.exports = !construct || fails(function () {
4202 var called;
4203 return isConstructorModern(isConstructorModern.call)
4204 || !isConstructorModern(Object)
4205 || !isConstructorModern(function () { called = true; })
4206 || called;
4207}) ? isConstructorLegacy : isConstructorModern;
4208
4209
4210/***/ }),
4211/* 109 */
4212/***/ (function(module, exports, __webpack_require__) {
4213
4214var uncurryThis = __webpack_require__(4);
4215
4216module.exports = uncurryThis([].slice);
4217
4218
4219/***/ }),
4220/* 110 */
4221/***/ (function(module, __webpack_exports__, __webpack_require__) {
4222
4223"use strict";
4224/* harmony export (immutable) */ __webpack_exports__["a"] = matcher;
4225/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__extendOwn_js__ = __webpack_require__(138);
4226/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isMatch_js__ = __webpack_require__(185);
4227
4228
4229
4230// Returns a predicate for checking whether an object has a given set of
4231// `key:value` pairs.
4232function matcher(attrs) {
4233 attrs = Object(__WEBPACK_IMPORTED_MODULE_0__extendOwn_js__["a" /* default */])({}, attrs);
4234 return function(obj) {
4235 return Object(__WEBPACK_IMPORTED_MODULE_1__isMatch_js__["a" /* default */])(obj, attrs);
4236 };
4237}
4238
4239
4240/***/ }),
4241/* 111 */
4242/***/ (function(module, __webpack_exports__, __webpack_require__) {
4243
4244"use strict";
4245/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
4246/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__executeBound_js__ = __webpack_require__(201);
4247/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(25);
4248
4249
4250
4251
4252// Partially apply a function by creating a version that has had some of its
4253// arguments pre-filled, without changing its dynamic `this` context. `_` acts
4254// as a placeholder by default, allowing any combination of arguments to be
4255// pre-filled. Set `_.partial.placeholder` for a custom placeholder argument.
4256var partial = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, boundArgs) {
4257 var placeholder = partial.placeholder;
4258 var bound = function() {
4259 var position = 0, length = boundArgs.length;
4260 var args = Array(length);
4261 for (var i = 0; i < length; i++) {
4262 args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i];
4263 }
4264 while (position < arguments.length) args.push(arguments[position++]);
4265 return Object(__WEBPACK_IMPORTED_MODULE_1__executeBound_js__["a" /* default */])(func, bound, this, this, args);
4266 };
4267 return bound;
4268});
4269
4270partial.placeholder = __WEBPACK_IMPORTED_MODULE_2__underscore_js__["a" /* default */];
4271/* harmony default export */ __webpack_exports__["a"] = (partial);
4272
4273
4274/***/ }),
4275/* 112 */
4276/***/ (function(module, __webpack_exports__, __webpack_require__) {
4277
4278"use strict";
4279/* harmony export (immutable) */ __webpack_exports__["a"] = group;
4280/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
4281/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(56);
4282
4283
4284
4285// An internal function used for aggregate "group by" operations.
4286function group(behavior, partition) {
4287 return function(obj, iteratee, context) {
4288 var result = partition ? [[], []] : {};
4289 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
4290 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index) {
4291 var key = iteratee(value, index, obj);
4292 behavior(result, value, key);
4293 });
4294 return result;
4295 };
4296}
4297
4298
4299/***/ }),
4300/* 113 */
4301/***/ (function(module, exports, __webpack_require__) {
4302
4303var fails = __webpack_require__(2);
4304var wellKnownSymbol = __webpack_require__(9);
4305var V8_VERSION = __webpack_require__(75);
4306
4307var SPECIES = wellKnownSymbol('species');
4308
4309module.exports = function (METHOD_NAME) {
4310 // We can't use this feature detection in V8 since it causes
4311 // deoptimization and serious performance degradation
4312 // https://github.com/zloirock/core-js/issues/677
4313 return V8_VERSION >= 51 || !fails(function () {
4314 var array = [];
4315 var constructor = array.constructor = {};
4316 constructor[SPECIES] = function () {
4317 return { foo: 1 };
4318 };
4319 return array[METHOD_NAME](Boolean).foo !== 1;
4320 });
4321};
4322
4323
4324/***/ }),
4325/* 114 */
4326/***/ (function(module, exports, __webpack_require__) {
4327
4328module.exports = __webpack_require__(235);
4329
4330/***/ }),
4331/* 115 */
4332/***/ (function(module, exports, __webpack_require__) {
4333
4334"use strict";
4335
4336
4337var _interopRequireDefault = __webpack_require__(1);
4338
4339var _typeof2 = _interopRequireDefault(__webpack_require__(91));
4340
4341var _filter = _interopRequireDefault(__webpack_require__(243));
4342
4343var _map = _interopRequireDefault(__webpack_require__(35));
4344
4345var _keys = _interopRequireDefault(__webpack_require__(146));
4346
4347var _stringify = _interopRequireDefault(__webpack_require__(36));
4348
4349var _concat = _interopRequireDefault(__webpack_require__(22));
4350
4351var _ = __webpack_require__(3);
4352
4353var _require = __webpack_require__(244),
4354 timeout = _require.timeout;
4355
4356var debug = __webpack_require__(58);
4357
4358var debugRequest = debug('leancloud:request');
4359var debugRequestError = debug('leancloud:request:error');
4360
4361var _require2 = __webpack_require__(71),
4362 getAdapter = _require2.getAdapter;
4363
4364var requestsCount = 0;
4365
4366var ajax = function ajax(_ref) {
4367 var method = _ref.method,
4368 url = _ref.url,
4369 query = _ref.query,
4370 data = _ref.data,
4371 _ref$headers = _ref.headers,
4372 headers = _ref$headers === void 0 ? {} : _ref$headers,
4373 time = _ref.timeout,
4374 onprogress = _ref.onprogress;
4375
4376 if (query) {
4377 var _context, _context2, _context4;
4378
4379 var queryString = (0, _filter.default)(_context = (0, _map.default)(_context2 = (0, _keys.default)(query)).call(_context2, function (key) {
4380 var _context3;
4381
4382 var value = query[key];
4383 if (value === undefined) return undefined;
4384 var v = (0, _typeof2.default)(value) === 'object' ? (0, _stringify.default)(value) : value;
4385 return (0, _concat.default)(_context3 = "".concat(encodeURIComponent(key), "=")).call(_context3, encodeURIComponent(v));
4386 })).call(_context, function (qs) {
4387 return qs;
4388 }).join('&');
4389 url = (0, _concat.default)(_context4 = "".concat(url, "?")).call(_context4, queryString);
4390 }
4391
4392 var count = requestsCount++;
4393 debugRequest('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
4394 var request = getAdapter('request');
4395 var promise = request(url, {
4396 method: method,
4397 headers: headers,
4398 data: data,
4399 onprogress: onprogress
4400 }).then(function (response) {
4401 debugRequest('response(%d) %d %O %o', count, response.status, response.data || response.text, response.header);
4402
4403 if (response.ok === false) {
4404 var error = new Error();
4405 error.response = response;
4406 throw error;
4407 }
4408
4409 return response.data;
4410 }).catch(function (error) {
4411 if (error.response) {
4412 if (!debug.enabled('leancloud:request')) {
4413 debugRequestError('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
4414 }
4415
4416 debugRequestError('response(%d) %d %O %o', count, error.response.status, error.response.data || error.response.text, error.response.header);
4417 error.statusCode = error.response.status;
4418 error.responseText = error.response.text;
4419 error.response = error.response.data;
4420 }
4421
4422 throw error;
4423 });
4424 return time ? timeout(promise, time) : promise;
4425};
4426
4427module.exports = ajax;
4428
4429/***/ }),
4430/* 116 */
4431/***/ (function(module, exports) {
4432
4433/* (ignored) */
4434
4435/***/ }),
4436/* 117 */
4437/***/ (function(module, exports, __webpack_require__) {
4438
4439var Symbol = __webpack_require__(265),
4440 getRawTag = __webpack_require__(631),
4441 objectToString = __webpack_require__(632);
4442
4443/** `Object#toString` result references. */
4444var nullTag = '[object Null]',
4445 undefinedTag = '[object Undefined]';
4446
4447/** Built-in value references. */
4448var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
4449
4450/**
4451 * The base implementation of `getTag` without fallbacks for buggy environments.
4452 *
4453 * @private
4454 * @param {*} value The value to query.
4455 * @returns {string} Returns the `toStringTag`.
4456 */
4457function baseGetTag(value) {
4458 if (value == null) {
4459 return value === undefined ? undefinedTag : nullTag;
4460 }
4461 return (symToStringTag && symToStringTag in Object(value))
4462 ? getRawTag(value)
4463 : objectToString(value);
4464}
4465
4466module.exports = baseGetTag;
4467
4468
4469/***/ }),
4470/* 118 */
4471/***/ (function(module, exports) {
4472
4473/**
4474 * Checks if `value` is object-like. A value is object-like if it's not `null`
4475 * and has a `typeof` result of "object".
4476 *
4477 * @static
4478 * @memberOf _
4479 * @since 4.0.0
4480 * @category Lang
4481 * @param {*} value The value to check.
4482 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
4483 * @example
4484 *
4485 * _.isObjectLike({});
4486 * // => true
4487 *
4488 * _.isObjectLike([1, 2, 3]);
4489 * // => true
4490 *
4491 * _.isObjectLike(_.noop);
4492 * // => false
4493 *
4494 * _.isObjectLike(null);
4495 * // => false
4496 */
4497function isObjectLike(value) {
4498 return value != null && typeof value == 'object';
4499}
4500
4501module.exports = isObjectLike;
4502
4503
4504/***/ }),
4505/* 119 */
4506/***/ (function(module, exports, __webpack_require__) {
4507
4508"use strict";
4509
4510var $propertyIsEnumerable = {}.propertyIsEnumerable;
4511// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
4512var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
4513
4514// Nashorn ~ JDK8 bug
4515var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
4516
4517// `Object.prototype.propertyIsEnumerable` method implementation
4518// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
4519exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
4520 var descriptor = getOwnPropertyDescriptor(this, V);
4521 return !!descriptor && descriptor.enumerable;
4522} : $propertyIsEnumerable;
4523
4524
4525/***/ }),
4526/* 120 */
4527/***/ (function(module, exports) {
4528
4529var $TypeError = TypeError;
4530
4531// `RequireObjectCoercible` abstract operation
4532// https://tc39.es/ecma262/#sec-requireobjectcoercible
4533module.exports = function (it) {
4534 if (it == undefined) throw $TypeError("Can't call method on " + it);
4535 return it;
4536};
4537
4538
4539/***/ }),
4540/* 121 */
4541/***/ (function(module, exports, __webpack_require__) {
4542
4543var aCallable = __webpack_require__(31);
4544
4545// `GetMethod` abstract operation
4546// https://tc39.es/ecma262/#sec-getmethod
4547module.exports = function (V, P) {
4548 var func = V[P];
4549 return func == null ? undefined : aCallable(func);
4550};
4551
4552
4553/***/ }),
4554/* 122 */
4555/***/ (function(module, exports, __webpack_require__) {
4556
4557var global = __webpack_require__(7);
4558var defineGlobalProperty = __webpack_require__(281);
4559
4560var SHARED = '__core-js_shared__';
4561var store = global[SHARED] || defineGlobalProperty(SHARED, {});
4562
4563module.exports = store;
4564
4565
4566/***/ }),
4567/* 123 */
4568/***/ (function(module, exports, __webpack_require__) {
4569
4570var global = __webpack_require__(7);
4571var isObject = __webpack_require__(11);
4572
4573var document = global.document;
4574// typeof document.createElement is 'object' in old IE
4575var EXISTS = isObject(document) && isObject(document.createElement);
4576
4577module.exports = function (it) {
4578 return EXISTS ? document.createElement(it) : {};
4579};
4580
4581
4582/***/ }),
4583/* 124 */
4584/***/ (function(module, exports, __webpack_require__) {
4585
4586var toIntegerOrInfinity = __webpack_require__(125);
4587
4588var max = Math.max;
4589var min = Math.min;
4590
4591// Helper for a popular repeating case of the spec:
4592// Let integer be ? ToInteger(index).
4593// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
4594module.exports = function (index, length) {
4595 var integer = toIntegerOrInfinity(index);
4596 return integer < 0 ? max(integer + length, 0) : min(integer, length);
4597};
4598
4599
4600/***/ }),
4601/* 125 */
4602/***/ (function(module, exports, __webpack_require__) {
4603
4604var trunc = __webpack_require__(284);
4605
4606// `ToIntegerOrInfinity` abstract operation
4607// https://tc39.es/ecma262/#sec-tointegerorinfinity
4608module.exports = function (argument) {
4609 var number = +argument;
4610 // eslint-disable-next-line no-self-compare -- NaN check
4611 return number !== number || number === 0 ? 0 : trunc(number);
4612};
4613
4614
4615/***/ }),
4616/* 126 */
4617/***/ (function(module, exports) {
4618
4619// IE8- don't enum bug keys
4620module.exports = [
4621 'constructor',
4622 'hasOwnProperty',
4623 'isPrototypeOf',
4624 'propertyIsEnumerable',
4625 'toLocaleString',
4626 'toString',
4627 'valueOf'
4628];
4629
4630
4631/***/ }),
4632/* 127 */
4633/***/ (function(module, exports, __webpack_require__) {
4634
4635var DESCRIPTORS = __webpack_require__(14);
4636var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(154);
4637var definePropertyModule = __webpack_require__(23);
4638var anObject = __webpack_require__(20);
4639var toIndexedObject = __webpack_require__(32);
4640var objectKeys = __webpack_require__(104);
4641
4642// `Object.defineProperties` method
4643// https://tc39.es/ecma262/#sec-object.defineproperties
4644// eslint-disable-next-line es-x/no-object-defineproperties -- safe
4645exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
4646 anObject(O);
4647 var props = toIndexedObject(Properties);
4648 var keys = objectKeys(Properties);
4649 var length = keys.length;
4650 var index = 0;
4651 var key;
4652 while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
4653 return O;
4654};
4655
4656
4657/***/ }),
4658/* 128 */
4659/***/ (function(module, exports, __webpack_require__) {
4660
4661var wellKnownSymbol = __webpack_require__(9);
4662
4663var TO_STRING_TAG = wellKnownSymbol('toStringTag');
4664var test = {};
4665
4666test[TO_STRING_TAG] = 'z';
4667
4668module.exports = String(test) === '[object z]';
4669
4670
4671/***/ }),
4672/* 129 */
4673/***/ (function(module, exports, __webpack_require__) {
4674
4675var uncurryThis = __webpack_require__(4);
4676var isCallable = __webpack_require__(8);
4677var store = __webpack_require__(122);
4678
4679var functionToString = uncurryThis(Function.toString);
4680
4681// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
4682if (!isCallable(store.inspectSource)) {
4683 store.inspectSource = function (it) {
4684 return functionToString(it);
4685 };
4686}
4687
4688module.exports = store.inspectSource;
4689
4690
4691/***/ }),
4692/* 130 */
4693/***/ (function(module, exports, __webpack_require__) {
4694
4695"use strict";
4696
4697var $ = __webpack_require__(0);
4698var call = __webpack_require__(15);
4699var IS_PURE = __webpack_require__(33);
4700var FunctionName = __webpack_require__(290);
4701var isCallable = __webpack_require__(8);
4702var createIteratorConstructor = __webpack_require__(291);
4703var getPrototypeOf = __webpack_require__(99);
4704var setPrototypeOf = __webpack_require__(101);
4705var setToStringTag = __webpack_require__(52);
4706var createNonEnumerableProperty = __webpack_require__(37);
4707var defineBuiltIn = __webpack_require__(43);
4708var wellKnownSymbol = __webpack_require__(9);
4709var Iterators = __webpack_require__(50);
4710var IteratorsCore = __webpack_require__(165);
4711
4712var PROPER_FUNCTION_NAME = FunctionName.PROPER;
4713var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
4714var IteratorPrototype = IteratorsCore.IteratorPrototype;
4715var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
4716var ITERATOR = wellKnownSymbol('iterator');
4717var KEYS = 'keys';
4718var VALUES = 'values';
4719var ENTRIES = 'entries';
4720
4721var returnThis = function () { return this; };
4722
4723module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
4724 createIteratorConstructor(IteratorConstructor, NAME, next);
4725
4726 var getIterationMethod = function (KIND) {
4727 if (KIND === DEFAULT && defaultIterator) return defaultIterator;
4728 if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
4729 switch (KIND) {
4730 case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
4731 case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
4732 case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
4733 } return function () { return new IteratorConstructor(this); };
4734 };
4735
4736 var TO_STRING_TAG = NAME + ' Iterator';
4737 var INCORRECT_VALUES_NAME = false;
4738 var IterablePrototype = Iterable.prototype;
4739 var nativeIterator = IterablePrototype[ITERATOR]
4740 || IterablePrototype['@@iterator']
4741 || DEFAULT && IterablePrototype[DEFAULT];
4742 var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
4743 var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
4744 var CurrentIteratorPrototype, methods, KEY;
4745
4746 // fix native
4747 if (anyNativeIterator) {
4748 CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
4749 if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
4750 if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
4751 if (setPrototypeOf) {
4752 setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
4753 } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {
4754 defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);
4755 }
4756 }
4757 // Set @@toStringTag to native iterators
4758 setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
4759 if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
4760 }
4761 }
4762
4763 // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
4764 if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
4765 if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {
4766 createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
4767 } else {
4768 INCORRECT_VALUES_NAME = true;
4769 defaultIterator = function values() { return call(nativeIterator, this); };
4770 }
4771 }
4772
4773 // export additional methods
4774 if (DEFAULT) {
4775 methods = {
4776 values: getIterationMethod(VALUES),
4777 keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
4778 entries: getIterationMethod(ENTRIES)
4779 };
4780 if (FORCED) for (KEY in methods) {
4781 if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
4782 defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
4783 }
4784 } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
4785 }
4786
4787 // define iterator
4788 if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
4789 defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });
4790 }
4791 Iterators[NAME] = defaultIterator;
4792
4793 return methods;
4794};
4795
4796
4797/***/ }),
4798/* 131 */
4799/***/ (function(module, __webpack_exports__, __webpack_require__) {
4800
4801"use strict";
4802Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
4803/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(5);
4804/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return __WEBPACK_IMPORTED_MODULE_0__setup_js__["e"]; });
4805/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__restArguments_js__ = __webpack_require__(24);
4806/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "restArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__restArguments_js__["a"]; });
4807/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(54);
4808/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return __WEBPACK_IMPORTED_MODULE_2__isObject_js__["a"]; });
4809/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isNull_js__ = __webpack_require__(313);
4810/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return __WEBPACK_IMPORTED_MODULE_3__isNull_js__["a"]; });
4811/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__ = __webpack_require__(174);
4812/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__["a"]; });
4813/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__ = __webpack_require__(175);
4814/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isBoolean", function() { return __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__["a"]; });
4815/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isElement_js__ = __webpack_require__(314);
4816/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isElement", function() { return __WEBPACK_IMPORTED_MODULE_6__isElement_js__["a"]; });
4817/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__isString_js__ = __webpack_require__(132);
4818/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return __WEBPACK_IMPORTED_MODULE_7__isString_js__["a"]; });
4819/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__isNumber_js__ = __webpack_require__(176);
4820/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return __WEBPACK_IMPORTED_MODULE_8__isNumber_js__["a"]; });
4821/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__isDate_js__ = __webpack_require__(315);
4822/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return __WEBPACK_IMPORTED_MODULE_9__isDate_js__["a"]; });
4823/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__ = __webpack_require__(316);
4824/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__["a"]; });
4825/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__isError_js__ = __webpack_require__(317);
4826/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isError", function() { return __WEBPACK_IMPORTED_MODULE_11__isError_js__["a"]; });
4827/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__ = __webpack_require__(177);
4828/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSymbol", function() { return __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__["a"]; });
4829/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__ = __webpack_require__(178);
4830/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__["a"]; });
4831/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__isDataView_js__ = __webpack_require__(133);
4832/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDataView", function() { return __WEBPACK_IMPORTED_MODULE_14__isDataView_js__["a"]; });
4833/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__isArray_js__ = __webpack_require__(55);
4834/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return __WEBPACK_IMPORTED_MODULE_15__isArray_js__["a"]; });
4835/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__isFunction_js__ = __webpack_require__(28);
4836/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return __WEBPACK_IMPORTED_MODULE_16__isFunction_js__["a"]; });
4837/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__isArguments_js__ = __webpack_require__(134);
4838/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArguments", function() { return __WEBPACK_IMPORTED_MODULE_17__isArguments_js__["a"]; });
4839/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__isFinite_js__ = __webpack_require__(319);
4840/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFinite", function() { return __WEBPACK_IMPORTED_MODULE_18__isFinite_js__["a"]; });
4841/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__isNaN_js__ = __webpack_require__(179);
4842/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNaN", function() { return __WEBPACK_IMPORTED_MODULE_19__isNaN_js__["a"]; });
4843/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__ = __webpack_require__(180);
4844/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__["a"]; });
4845/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__ = __webpack_require__(321);
4846/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__["a"]; });
4847/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__isMatch_js__ = __webpack_require__(185);
4848/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMatch", function() { return __WEBPACK_IMPORTED_MODULE_22__isMatch_js__["a"]; });
4849/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__isEqual_js__ = __webpack_require__(322);
4850/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return __WEBPACK_IMPORTED_MODULE_23__isEqual_js__["a"]; });
4851/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__isMap_js__ = __webpack_require__(324);
4852/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMap", function() { return __WEBPACK_IMPORTED_MODULE_24__isMap_js__["a"]; });
4853/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__ = __webpack_require__(325);
4854/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakMap", function() { return __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__["a"]; });
4855/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__isSet_js__ = __webpack_require__(326);
4856/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSet", function() { return __WEBPACK_IMPORTED_MODULE_26__isSet_js__["a"]; });
4857/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__ = __webpack_require__(327);
4858/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakSet", function() { return __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__["a"]; });
4859/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__keys_js__ = __webpack_require__(16);
4860/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return __WEBPACK_IMPORTED_MODULE_28__keys_js__["a"]; });
4861/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__allKeys_js__ = __webpack_require__(83);
4862/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "allKeys", function() { return __WEBPACK_IMPORTED_MODULE_29__allKeys_js__["a"]; });
4863/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__values_js__ = __webpack_require__(66);
4864/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "values", function() { return __WEBPACK_IMPORTED_MODULE_30__values_js__["a"]; });
4865/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__pairs_js__ = __webpack_require__(328);
4866/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return __WEBPACK_IMPORTED_MODULE_31__pairs_js__["a"]; });
4867/* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__invert_js__ = __webpack_require__(186);
4868/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return __WEBPACK_IMPORTED_MODULE_32__invert_js__["a"]; });
4869/* harmony import */ var __WEBPACK_IMPORTED_MODULE_33__functions_js__ = __webpack_require__(187);
4870/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "functions", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
4871/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "methods", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
4872/* harmony import */ var __WEBPACK_IMPORTED_MODULE_34__extend_js__ = __webpack_require__(188);
4873/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return __WEBPACK_IMPORTED_MODULE_34__extend_js__["a"]; });
4874/* harmony import */ var __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__ = __webpack_require__(138);
4875/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extendOwn", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
4876/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
4877/* harmony import */ var __WEBPACK_IMPORTED_MODULE_36__defaults_js__ = __webpack_require__(189);
4878/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return __WEBPACK_IMPORTED_MODULE_36__defaults_js__["a"]; });
4879/* harmony import */ var __WEBPACK_IMPORTED_MODULE_37__create_js__ = __webpack_require__(329);
4880/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return __WEBPACK_IMPORTED_MODULE_37__create_js__["a"]; });
4881/* harmony import */ var __WEBPACK_IMPORTED_MODULE_38__clone_js__ = __webpack_require__(191);
4882/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return __WEBPACK_IMPORTED_MODULE_38__clone_js__["a"]; });
4883/* harmony import */ var __WEBPACK_IMPORTED_MODULE_39__tap_js__ = __webpack_require__(330);
4884/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return __WEBPACK_IMPORTED_MODULE_39__tap_js__["a"]; });
4885/* harmony import */ var __WEBPACK_IMPORTED_MODULE_40__get_js__ = __webpack_require__(192);
4886/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return __WEBPACK_IMPORTED_MODULE_40__get_js__["a"]; });
4887/* harmony import */ var __WEBPACK_IMPORTED_MODULE_41__has_js__ = __webpack_require__(331);
4888/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "has", function() { return __WEBPACK_IMPORTED_MODULE_41__has_js__["a"]; });
4889/* harmony import */ var __WEBPACK_IMPORTED_MODULE_42__mapObject_js__ = __webpack_require__(332);
4890/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mapObject", function() { return __WEBPACK_IMPORTED_MODULE_42__mapObject_js__["a"]; });
4891/* harmony import */ var __WEBPACK_IMPORTED_MODULE_43__identity_js__ = __webpack_require__(140);
4892/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return __WEBPACK_IMPORTED_MODULE_43__identity_js__["a"]; });
4893/* harmony import */ var __WEBPACK_IMPORTED_MODULE_44__constant_js__ = __webpack_require__(181);
4894/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "constant", function() { return __WEBPACK_IMPORTED_MODULE_44__constant_js__["a"]; });
4895/* harmony import */ var __WEBPACK_IMPORTED_MODULE_45__noop_js__ = __webpack_require__(196);
4896/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return __WEBPACK_IMPORTED_MODULE_45__noop_js__["a"]; });
4897/* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__toPath_js__ = __webpack_require__(193);
4898/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toPath", function() { return __WEBPACK_IMPORTED_MODULE_46__toPath_js__["a"]; });
4899/* harmony import */ var __WEBPACK_IMPORTED_MODULE_47__property_js__ = __webpack_require__(141);
4900/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "property", function() { return __WEBPACK_IMPORTED_MODULE_47__property_js__["a"]; });
4901/* harmony import */ var __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__ = __webpack_require__(333);
4902/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "propertyOf", function() { return __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__["a"]; });
4903/* harmony import */ var __WEBPACK_IMPORTED_MODULE_49__matcher_js__ = __webpack_require__(110);
4904/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matcher", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
4905/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
4906/* harmony import */ var __WEBPACK_IMPORTED_MODULE_50__times_js__ = __webpack_require__(334);
4907/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "times", function() { return __WEBPACK_IMPORTED_MODULE_50__times_js__["a"]; });
4908/* harmony import */ var __WEBPACK_IMPORTED_MODULE_51__random_js__ = __webpack_require__(197);
4909/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return __WEBPACK_IMPORTED_MODULE_51__random_js__["a"]; });
4910/* harmony import */ var __WEBPACK_IMPORTED_MODULE_52__now_js__ = __webpack_require__(142);
4911/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "now", function() { return __WEBPACK_IMPORTED_MODULE_52__now_js__["a"]; });
4912/* harmony import */ var __WEBPACK_IMPORTED_MODULE_53__escape_js__ = __webpack_require__(335);
4913/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "escape", function() { return __WEBPACK_IMPORTED_MODULE_53__escape_js__["a"]; });
4914/* harmony import */ var __WEBPACK_IMPORTED_MODULE_54__unescape_js__ = __webpack_require__(336);
4915/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unescape", function() { return __WEBPACK_IMPORTED_MODULE_54__unescape_js__["a"]; });
4916/* harmony import */ var __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__ = __webpack_require__(200);
4917/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "templateSettings", function() { return __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__["a"]; });
4918/* harmony import */ var __WEBPACK_IMPORTED_MODULE_56__template_js__ = __webpack_require__(338);
4919/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "template", function() { return __WEBPACK_IMPORTED_MODULE_56__template_js__["a"]; });
4920/* harmony import */ var __WEBPACK_IMPORTED_MODULE_57__result_js__ = __webpack_require__(339);
4921/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "result", function() { return __WEBPACK_IMPORTED_MODULE_57__result_js__["a"]; });
4922/* harmony import */ var __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__ = __webpack_require__(340);
4923/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniqueId", function() { return __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__["a"]; });
4924/* harmony import */ var __WEBPACK_IMPORTED_MODULE_59__chain_js__ = __webpack_require__(341);
4925/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chain", function() { return __WEBPACK_IMPORTED_MODULE_59__chain_js__["a"]; });
4926/* harmony import */ var __WEBPACK_IMPORTED_MODULE_60__iteratee_js__ = __webpack_require__(195);
4927/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "iteratee", function() { return __WEBPACK_IMPORTED_MODULE_60__iteratee_js__["a"]; });
4928/* harmony import */ var __WEBPACK_IMPORTED_MODULE_61__partial_js__ = __webpack_require__(111);
4929/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partial", function() { return __WEBPACK_IMPORTED_MODULE_61__partial_js__["a"]; });
4930/* harmony import */ var __WEBPACK_IMPORTED_MODULE_62__bind_js__ = __webpack_require__(202);
4931/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return __WEBPACK_IMPORTED_MODULE_62__bind_js__["a"]; });
4932/* harmony import */ var __WEBPACK_IMPORTED_MODULE_63__bindAll_js__ = __webpack_require__(342);
4933/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bindAll", function() { return __WEBPACK_IMPORTED_MODULE_63__bindAll_js__["a"]; });
4934/* harmony import */ var __WEBPACK_IMPORTED_MODULE_64__memoize_js__ = __webpack_require__(343);
4935/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "memoize", function() { return __WEBPACK_IMPORTED_MODULE_64__memoize_js__["a"]; });
4936/* harmony import */ var __WEBPACK_IMPORTED_MODULE_65__delay_js__ = __webpack_require__(203);
4937/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return __WEBPACK_IMPORTED_MODULE_65__delay_js__["a"]; });
4938/* harmony import */ var __WEBPACK_IMPORTED_MODULE_66__defer_js__ = __webpack_require__(344);
4939/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return __WEBPACK_IMPORTED_MODULE_66__defer_js__["a"]; });
4940/* harmony import */ var __WEBPACK_IMPORTED_MODULE_67__throttle_js__ = __webpack_require__(345);
4941/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return __WEBPACK_IMPORTED_MODULE_67__throttle_js__["a"]; });
4942/* harmony import */ var __WEBPACK_IMPORTED_MODULE_68__debounce_js__ = __webpack_require__(346);
4943/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return __WEBPACK_IMPORTED_MODULE_68__debounce_js__["a"]; });
4944/* harmony import */ var __WEBPACK_IMPORTED_MODULE_69__wrap_js__ = __webpack_require__(347);
4945/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "wrap", function() { return __WEBPACK_IMPORTED_MODULE_69__wrap_js__["a"]; });
4946/* harmony import */ var __WEBPACK_IMPORTED_MODULE_70__negate_js__ = __webpack_require__(143);
4947/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return __WEBPACK_IMPORTED_MODULE_70__negate_js__["a"]; });
4948/* harmony import */ var __WEBPACK_IMPORTED_MODULE_71__compose_js__ = __webpack_require__(348);
4949/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return __WEBPACK_IMPORTED_MODULE_71__compose_js__["a"]; });
4950/* harmony import */ var __WEBPACK_IMPORTED_MODULE_72__after_js__ = __webpack_require__(349);
4951/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "after", function() { return __WEBPACK_IMPORTED_MODULE_72__after_js__["a"]; });
4952/* harmony import */ var __WEBPACK_IMPORTED_MODULE_73__before_js__ = __webpack_require__(204);
4953/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "before", function() { return __WEBPACK_IMPORTED_MODULE_73__before_js__["a"]; });
4954/* harmony import */ var __WEBPACK_IMPORTED_MODULE_74__once_js__ = __webpack_require__(350);
4955/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "once", function() { return __WEBPACK_IMPORTED_MODULE_74__once_js__["a"]; });
4956/* harmony import */ var __WEBPACK_IMPORTED_MODULE_75__findKey_js__ = __webpack_require__(205);
4957/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findKey", function() { return __WEBPACK_IMPORTED_MODULE_75__findKey_js__["a"]; });
4958/* harmony import */ var __WEBPACK_IMPORTED_MODULE_76__findIndex_js__ = __webpack_require__(144);
4959/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return __WEBPACK_IMPORTED_MODULE_76__findIndex_js__["a"]; });
4960/* harmony import */ var __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__ = __webpack_require__(207);
4961/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__["a"]; });
4962/* harmony import */ var __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__ = __webpack_require__(208);
4963/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortedIndex", function() { return __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__["a"]; });
4964/* harmony import */ var __WEBPACK_IMPORTED_MODULE_79__indexOf_js__ = __webpack_require__(209);
4965/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return __WEBPACK_IMPORTED_MODULE_79__indexOf_js__["a"]; });
4966/* harmony import */ var __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__ = __webpack_require__(351);
4967/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__["a"]; });
4968/* harmony import */ var __WEBPACK_IMPORTED_MODULE_81__find_js__ = __webpack_require__(211);
4969/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "find", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
4970/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "detect", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
4971/* harmony import */ var __WEBPACK_IMPORTED_MODULE_82__findWhere_js__ = __webpack_require__(352);
4972/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findWhere", function() { return __WEBPACK_IMPORTED_MODULE_82__findWhere_js__["a"]; });
4973/* harmony import */ var __WEBPACK_IMPORTED_MODULE_83__each_js__ = __webpack_require__(56);
4974/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "each", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
4975/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
4976/* harmony import */ var __WEBPACK_IMPORTED_MODULE_84__map_js__ = __webpack_require__(68);
4977/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "map", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
4978/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "collect", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
4979/* harmony import */ var __WEBPACK_IMPORTED_MODULE_85__reduce_js__ = __webpack_require__(353);
4980/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
4981/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldl", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
4982/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
4983/* harmony import */ var __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__ = __webpack_require__(354);
4984/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduceRight", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
4985/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldr", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
4986/* harmony import */ var __WEBPACK_IMPORTED_MODULE_87__filter_js__ = __webpack_require__(86);
4987/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
4988/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
4989/* harmony import */ var __WEBPACK_IMPORTED_MODULE_88__reject_js__ = __webpack_require__(355);
4990/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return __WEBPACK_IMPORTED_MODULE_88__reject_js__["a"]; });
4991/* harmony import */ var __WEBPACK_IMPORTED_MODULE_89__every_js__ = __webpack_require__(356);
4992/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "every", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
4993/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "all", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
4994/* harmony import */ var __WEBPACK_IMPORTED_MODULE_90__some_js__ = __webpack_require__(357);
4995/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "some", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
4996/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "any", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
4997/* harmony import */ var __WEBPACK_IMPORTED_MODULE_91__contains_js__ = __webpack_require__(87);
4998/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
4999/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
5000/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "include", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
5001/* harmony import */ var __WEBPACK_IMPORTED_MODULE_92__invoke_js__ = __webpack_require__(358);
5002/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invoke", function() { return __WEBPACK_IMPORTED_MODULE_92__invoke_js__["a"]; });
5003/* harmony import */ var __WEBPACK_IMPORTED_MODULE_93__pluck_js__ = __webpack_require__(145);
5004/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return __WEBPACK_IMPORTED_MODULE_93__pluck_js__["a"]; });
5005/* harmony import */ var __WEBPACK_IMPORTED_MODULE_94__where_js__ = __webpack_require__(359);
5006/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "where", function() { return __WEBPACK_IMPORTED_MODULE_94__where_js__["a"]; });
5007/* harmony import */ var __WEBPACK_IMPORTED_MODULE_95__max_js__ = __webpack_require__(213);
5008/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "max", function() { return __WEBPACK_IMPORTED_MODULE_95__max_js__["a"]; });
5009/* harmony import */ var __WEBPACK_IMPORTED_MODULE_96__min_js__ = __webpack_require__(360);
5010/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "min", function() { return __WEBPACK_IMPORTED_MODULE_96__min_js__["a"]; });
5011/* harmony import */ var __WEBPACK_IMPORTED_MODULE_97__shuffle_js__ = __webpack_require__(361);
5012/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "shuffle", function() { return __WEBPACK_IMPORTED_MODULE_97__shuffle_js__["a"]; });
5013/* harmony import */ var __WEBPACK_IMPORTED_MODULE_98__sample_js__ = __webpack_require__(214);
5014/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return __WEBPACK_IMPORTED_MODULE_98__sample_js__["a"]; });
5015/* harmony import */ var __WEBPACK_IMPORTED_MODULE_99__sortBy_js__ = __webpack_require__(362);
5016/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return __WEBPACK_IMPORTED_MODULE_99__sortBy_js__["a"]; });
5017/* harmony import */ var __WEBPACK_IMPORTED_MODULE_100__groupBy_js__ = __webpack_require__(363);
5018/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return __WEBPACK_IMPORTED_MODULE_100__groupBy_js__["a"]; });
5019/* harmony import */ var __WEBPACK_IMPORTED_MODULE_101__indexBy_js__ = __webpack_require__(364);
5020/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexBy", function() { return __WEBPACK_IMPORTED_MODULE_101__indexBy_js__["a"]; });
5021/* harmony import */ var __WEBPACK_IMPORTED_MODULE_102__countBy_js__ = __webpack_require__(365);
5022/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "countBy", function() { return __WEBPACK_IMPORTED_MODULE_102__countBy_js__["a"]; });
5023/* harmony import */ var __WEBPACK_IMPORTED_MODULE_103__partition_js__ = __webpack_require__(366);
5024/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return __WEBPACK_IMPORTED_MODULE_103__partition_js__["a"]; });
5025/* harmony import */ var __WEBPACK_IMPORTED_MODULE_104__toArray_js__ = __webpack_require__(367);
5026/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return __WEBPACK_IMPORTED_MODULE_104__toArray_js__["a"]; });
5027/* harmony import */ var __WEBPACK_IMPORTED_MODULE_105__size_js__ = __webpack_require__(368);
5028/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "size", function() { return __WEBPACK_IMPORTED_MODULE_105__size_js__["a"]; });
5029/* harmony import */ var __WEBPACK_IMPORTED_MODULE_106__pick_js__ = __webpack_require__(215);
5030/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return __WEBPACK_IMPORTED_MODULE_106__pick_js__["a"]; });
5031/* harmony import */ var __WEBPACK_IMPORTED_MODULE_107__omit_js__ = __webpack_require__(370);
5032/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "omit", function() { return __WEBPACK_IMPORTED_MODULE_107__omit_js__["a"]; });
5033/* harmony import */ var __WEBPACK_IMPORTED_MODULE_108__first_js__ = __webpack_require__(371);
5034/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "first", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
5035/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "head", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
5036/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "take", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
5037/* harmony import */ var __WEBPACK_IMPORTED_MODULE_109__initial_js__ = __webpack_require__(216);
5038/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "initial", function() { return __WEBPACK_IMPORTED_MODULE_109__initial_js__["a"]; });
5039/* harmony import */ var __WEBPACK_IMPORTED_MODULE_110__last_js__ = __webpack_require__(372);
5040/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "last", function() { return __WEBPACK_IMPORTED_MODULE_110__last_js__["a"]; });
5041/* harmony import */ var __WEBPACK_IMPORTED_MODULE_111__rest_js__ = __webpack_require__(217);
5042/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "rest", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
5043/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tail", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
5044/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "drop", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
5045/* harmony import */ var __WEBPACK_IMPORTED_MODULE_112__compact_js__ = __webpack_require__(373);
5046/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compact", function() { return __WEBPACK_IMPORTED_MODULE_112__compact_js__["a"]; });
5047/* harmony import */ var __WEBPACK_IMPORTED_MODULE_113__flatten_js__ = __webpack_require__(374);
5048/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return __WEBPACK_IMPORTED_MODULE_113__flatten_js__["a"]; });
5049/* harmony import */ var __WEBPACK_IMPORTED_MODULE_114__without_js__ = __webpack_require__(375);
5050/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "without", function() { return __WEBPACK_IMPORTED_MODULE_114__without_js__["a"]; });
5051/* harmony import */ var __WEBPACK_IMPORTED_MODULE_115__uniq_js__ = __webpack_require__(219);
5052/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
5053/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
5054/* harmony import */ var __WEBPACK_IMPORTED_MODULE_116__union_js__ = __webpack_require__(376);
5055/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "union", function() { return __WEBPACK_IMPORTED_MODULE_116__union_js__["a"]; });
5056/* harmony import */ var __WEBPACK_IMPORTED_MODULE_117__intersection_js__ = __webpack_require__(377);
5057/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return __WEBPACK_IMPORTED_MODULE_117__intersection_js__["a"]; });
5058/* harmony import */ var __WEBPACK_IMPORTED_MODULE_118__difference_js__ = __webpack_require__(218);
5059/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return __WEBPACK_IMPORTED_MODULE_118__difference_js__["a"]; });
5060/* harmony import */ var __WEBPACK_IMPORTED_MODULE_119__unzip_js__ = __webpack_require__(220);
5061/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unzip", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
5062/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
5063/* harmony import */ var __WEBPACK_IMPORTED_MODULE_120__zip_js__ = __webpack_require__(378);
5064/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return __WEBPACK_IMPORTED_MODULE_120__zip_js__["a"]; });
5065/* harmony import */ var __WEBPACK_IMPORTED_MODULE_121__object_js__ = __webpack_require__(379);
5066/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "object", function() { return __WEBPACK_IMPORTED_MODULE_121__object_js__["a"]; });
5067/* harmony import */ var __WEBPACK_IMPORTED_MODULE_122__range_js__ = __webpack_require__(380);
5068/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_122__range_js__["a"]; });
5069/* harmony import */ var __WEBPACK_IMPORTED_MODULE_123__chunk_js__ = __webpack_require__(381);
5070/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chunk", function() { return __WEBPACK_IMPORTED_MODULE_123__chunk_js__["a"]; });
5071/* harmony import */ var __WEBPACK_IMPORTED_MODULE_124__mixin_js__ = __webpack_require__(382);
5072/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mixin", function() { return __WEBPACK_IMPORTED_MODULE_124__mixin_js__["a"]; });
5073/* harmony import */ var __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__ = __webpack_require__(383);
5074/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__["a"]; });
5075// Named Exports
5076// =============
5077
5078// Underscore.js 1.12.1
5079// https://underscorejs.org
5080// (c) 2009-2020 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
5081// Underscore may be freely distributed under the MIT license.
5082
5083// Baseline setup.
5084
5085
5086
5087// Object Functions
5088// ----------------
5089// Our most fundamental functions operate on any JavaScript object.
5090// Most functions in Underscore depend on at least one function in this section.
5091
5092// A group of functions that check the types of core JavaScript values.
5093// These are often informally referred to as the "isType" functions.
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121// Functions that treat an object as a dictionary of key-value pairs.
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138// Utility Functions
5139// -----------------
5140// A bit of a grab bag: Predicate-generating functions for use with filters and
5141// loops, string escaping and templating, create random numbers and unique ids,
5142// and functions that facilitate Underscore's chaining and iteration conventions.
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162// Function (ahem) Functions
5163// -------------------------
5164// These functions take a function as an argument and return a new function
5165// as the result. Also known as higher-order functions.
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181// Finders
5182// -------
5183// Functions that extract (the position of) a single element from an object
5184// or array based on some criterion.
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194// Collection Functions
5195// --------------------
5196// Functions that work on any collection of elements: either an array, or
5197// an object of key-value pairs.
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222// `_.pick` and `_.omit` are actually object functions, but we put
5223// them here in order to create a more natural reading order in the
5224// monolithic build as they depend on `_.contains`.
5225
5226
5227
5228// Array Functions
5229// ---------------
5230// Functions that operate on arrays (and array-likes) only, because they’re
5231// expressed in terms of operations on an ordered list of values.
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249// OOP
5250// ---
5251// These modules support the "object-oriented" calling style. See also
5252// `underscore.js` and `index-default.js`.
5253
5254
5255
5256
5257/***/ }),
5258/* 132 */
5259/***/ (function(module, __webpack_exports__, __webpack_require__) {
5260
5261"use strict";
5262/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
5263
5264
5265/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('String'));
5266
5267
5268/***/ }),
5269/* 133 */
5270/***/ (function(module, __webpack_exports__, __webpack_require__) {
5271
5272"use strict";
5273/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
5274/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
5275/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArrayBuffer_js__ = __webpack_require__(178);
5276/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__ = __webpack_require__(82);
5277
5278
5279
5280
5281
5282var isDataView = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('DataView');
5283
5284// In IE 10 - Edge 13, we need a different heuristic
5285// to determine whether an object is a `DataView`.
5286function ie10IsDataView(obj) {
5287 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);
5288}
5289
5290/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__["a" /* hasStringTagBug */] ? ie10IsDataView : isDataView);
5291
5292
5293/***/ }),
5294/* 134 */
5295/***/ (function(module, __webpack_exports__, __webpack_require__) {
5296
5297"use strict";
5298/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
5299/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(45);
5300
5301
5302
5303var isArguments = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Arguments');
5304
5305// Define a fallback version of the method in browsers (ahem, IE < 9), where
5306// there isn't any inspectable "Arguments" type.
5307(function() {
5308 if (!isArguments(arguments)) {
5309 isArguments = function(obj) {
5310 return Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(obj, 'callee');
5311 };
5312 }
5313}());
5314
5315/* harmony default export */ __webpack_exports__["a"] = (isArguments);
5316
5317
5318/***/ }),
5319/* 135 */
5320/***/ (function(module, __webpack_exports__, __webpack_require__) {
5321
5322"use strict";
5323/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(183);
5324
5325
5326// Internal helper to obtain the `byteLength` property of an object.
5327/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('byteLength'));
5328
5329
5330/***/ }),
5331/* 136 */
5332/***/ (function(module, __webpack_exports__, __webpack_require__) {
5333
5334"use strict";
5335/* harmony export (immutable) */ __webpack_exports__["a"] = ie11fingerprint;
5336/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return mapMethods; });
5337/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return weakMapMethods; });
5338/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setMethods; });
5339/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
5340/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
5341/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__allKeys_js__ = __webpack_require__(83);
5342
5343
5344
5345
5346// Since the regular `Object.prototype.toString` type tests don't work for
5347// some types in IE 11, we use a fingerprinting heuristic instead, based
5348// on the methods. It's not great, but it's the best we got.
5349// The fingerprint method lists are defined below.
5350function ie11fingerprint(methods) {
5351 var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(methods);
5352 return function(obj) {
5353 if (obj == null) return false;
5354 // `Map`, `WeakMap` and `Set` have no enumerable keys.
5355 var keys = Object(__WEBPACK_IMPORTED_MODULE_2__allKeys_js__["a" /* default */])(obj);
5356 if (Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(keys)) return false;
5357 for (var i = 0; i < length; i++) {
5358 if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[methods[i]])) return false;
5359 }
5360 // If we are testing against `WeakMap`, we need to ensure that
5361 // `obj` doesn't have a `forEach` method in order to distinguish
5362 // it from a regular `Map`.
5363 return methods !== weakMapMethods || !Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[forEachName]);
5364 };
5365}
5366
5367// In the interest of compact minification, we write
5368// each string in the fingerprints only once.
5369var forEachName = 'forEach',
5370 hasName = 'has',
5371 commonInit = ['clear', 'delete'],
5372 mapTail = ['get', hasName, 'set'];
5373
5374// `Map`, `WeakMap` and `Set` each have slightly different
5375// combinations of the above sublists.
5376var mapMethods = commonInit.concat(forEachName, mapTail),
5377 weakMapMethods = commonInit.concat(mapTail),
5378 setMethods = ['add'].concat(commonInit, forEachName, hasName);
5379
5380
5381/***/ }),
5382/* 137 */
5383/***/ (function(module, __webpack_exports__, __webpack_require__) {
5384
5385"use strict";
5386/* harmony export (immutable) */ __webpack_exports__["a"] = createAssigner;
5387// An internal function for creating assigner functions.
5388function createAssigner(keysFunc, defaults) {
5389 return function(obj) {
5390 var length = arguments.length;
5391 if (defaults) obj = Object(obj);
5392 if (length < 2 || obj == null) return obj;
5393 for (var index = 1; index < length; index++) {
5394 var source = arguments[index],
5395 keys = keysFunc(source),
5396 l = keys.length;
5397 for (var i = 0; i < l; i++) {
5398 var key = keys[i];
5399 if (!defaults || obj[key] === void 0) obj[key] = source[key];
5400 }
5401 }
5402 return obj;
5403 };
5404}
5405
5406
5407/***/ }),
5408/* 138 */
5409/***/ (function(module, __webpack_exports__, __webpack_require__) {
5410
5411"use strict";
5412/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(137);
5413/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
5414
5415
5416
5417// Assigns a given object with all the own properties in the passed-in
5418// object(s).
5419// (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
5420/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */]));
5421
5422
5423/***/ }),
5424/* 139 */
5425/***/ (function(module, __webpack_exports__, __webpack_require__) {
5426
5427"use strict";
5428/* harmony export (immutable) */ __webpack_exports__["a"] = deepGet;
5429// Internal function to obtain a nested property in `obj` along `path`.
5430function deepGet(obj, path) {
5431 var length = path.length;
5432 for (var i = 0; i < length; i++) {
5433 if (obj == null) return void 0;
5434 obj = obj[path[i]];
5435 }
5436 return length ? obj : void 0;
5437}
5438
5439
5440/***/ }),
5441/* 140 */
5442/***/ (function(module, __webpack_exports__, __webpack_require__) {
5443
5444"use strict";
5445/* harmony export (immutable) */ __webpack_exports__["a"] = identity;
5446// Keep the identity function around for default iteratees.
5447function identity(value) {
5448 return value;
5449}
5450
5451
5452/***/ }),
5453/* 141 */
5454/***/ (function(module, __webpack_exports__, __webpack_require__) {
5455
5456"use strict";
5457/* harmony export (immutable) */ __webpack_exports__["a"] = property;
5458/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__deepGet_js__ = __webpack_require__(139);
5459/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(84);
5460
5461
5462
5463// Creates a function that, when passed an object, will traverse that object’s
5464// properties down the given `path`, specified as an array of keys or indices.
5465function property(path) {
5466 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
5467 return function(obj) {
5468 return Object(__WEBPACK_IMPORTED_MODULE_0__deepGet_js__["a" /* default */])(obj, path);
5469 };
5470}
5471
5472
5473/***/ }),
5474/* 142 */
5475/***/ (function(module, __webpack_exports__, __webpack_require__) {
5476
5477"use strict";
5478// A (possibly faster) way to get the current timestamp as an integer.
5479/* harmony default export */ __webpack_exports__["a"] = (Date.now || function() {
5480 return new Date().getTime();
5481});
5482
5483
5484/***/ }),
5485/* 143 */
5486/***/ (function(module, __webpack_exports__, __webpack_require__) {
5487
5488"use strict";
5489/* harmony export (immutable) */ __webpack_exports__["a"] = negate;
5490// Returns a negated version of the passed-in predicate.
5491function negate(predicate) {
5492 return function() {
5493 return !predicate.apply(this, arguments);
5494 };
5495}
5496
5497
5498/***/ }),
5499/* 144 */
5500/***/ (function(module, __webpack_exports__, __webpack_require__) {
5501
5502"use strict";
5503/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(206);
5504
5505
5506// Returns the first index on an array-like that passes a truth test.
5507/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(1));
5508
5509
5510/***/ }),
5511/* 145 */
5512/***/ (function(module, __webpack_exports__, __webpack_require__) {
5513
5514"use strict";
5515/* harmony export (immutable) */ __webpack_exports__["a"] = pluck;
5516/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__map_js__ = __webpack_require__(68);
5517/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__property_js__ = __webpack_require__(141);
5518
5519
5520
5521// Convenience version of a common use case of `_.map`: fetching a property.
5522function pluck(obj, key) {
5523 return Object(__WEBPACK_IMPORTED_MODULE_0__map_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__property_js__["a" /* default */])(key));
5524}
5525
5526
5527/***/ }),
5528/* 146 */
5529/***/ (function(module, exports, __webpack_require__) {
5530
5531module.exports = __webpack_require__(393);
5532
5533/***/ }),
5534/* 147 */
5535/***/ (function(module, exports, __webpack_require__) {
5536
5537var wellKnownSymbol = __webpack_require__(9);
5538
5539exports.f = wellKnownSymbol;
5540
5541
5542/***/ }),
5543/* 148 */
5544/***/ (function(module, exports, __webpack_require__) {
5545
5546module.exports = __webpack_require__(497);
5547
5548/***/ }),
5549/* 149 */
5550/***/ (function(module, exports, __webpack_require__) {
5551
5552"use strict";
5553
5554
5555module.exports = __webpack_require__(566);
5556
5557/***/ }),
5558/* 150 */
5559/***/ (function(module, exports, __webpack_require__) {
5560
5561var defineBuiltIn = __webpack_require__(43);
5562
5563module.exports = function (target, src, options) {
5564 for (var key in src) {
5565 if (options && options.unsafe && target[key]) target[key] = src[key];
5566 else defineBuiltIn(target, key, src[key], options);
5567 } return target;
5568};
5569
5570
5571/***/ }),
5572/* 151 */
5573/***/ (function(module, exports, __webpack_require__) {
5574
5575/* eslint-disable es-x/no-symbol -- required for testing */
5576var NATIVE_SYMBOL = __webpack_require__(62);
5577
5578module.exports = NATIVE_SYMBOL
5579 && !Symbol.sham
5580 && typeof Symbol.iterator == 'symbol';
5581
5582
5583/***/ }),
5584/* 152 */
5585/***/ (function(module, exports, __webpack_require__) {
5586
5587var DESCRIPTORS = __webpack_require__(14);
5588var fails = __webpack_require__(2);
5589var createElement = __webpack_require__(123);
5590
5591// Thanks to IE8 for its funny defineProperty
5592module.exports = !DESCRIPTORS && !fails(function () {
5593 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
5594 return Object.defineProperty(createElement('div'), 'a', {
5595 get: function () { return 7; }
5596 }).a != 7;
5597});
5598
5599
5600/***/ }),
5601/* 153 */
5602/***/ (function(module, exports, __webpack_require__) {
5603
5604var fails = __webpack_require__(2);
5605var isCallable = __webpack_require__(8);
5606
5607var replacement = /#|\.prototype\./;
5608
5609var isForced = function (feature, detection) {
5610 var value = data[normalize(feature)];
5611 return value == POLYFILL ? true
5612 : value == NATIVE ? false
5613 : isCallable(detection) ? fails(detection)
5614 : !!detection;
5615};
5616
5617var normalize = isForced.normalize = function (string) {
5618 return String(string).replace(replacement, '.').toLowerCase();
5619};
5620
5621var data = isForced.data = {};
5622var NATIVE = isForced.NATIVE = 'N';
5623var POLYFILL = isForced.POLYFILL = 'P';
5624
5625module.exports = isForced;
5626
5627
5628/***/ }),
5629/* 154 */
5630/***/ (function(module, exports, __webpack_require__) {
5631
5632var DESCRIPTORS = __webpack_require__(14);
5633var fails = __webpack_require__(2);
5634
5635// V8 ~ Chrome 36-
5636// https://bugs.chromium.org/p/v8/issues/detail?id=3334
5637module.exports = DESCRIPTORS && fails(function () {
5638 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
5639 return Object.defineProperty(function () { /* empty */ }, 'prototype', {
5640 value: 42,
5641 writable: false
5642 }).prototype != 42;
5643});
5644
5645
5646/***/ }),
5647/* 155 */
5648/***/ (function(module, exports, __webpack_require__) {
5649
5650var fails = __webpack_require__(2);
5651
5652module.exports = !fails(function () {
5653 function F() { /* empty */ }
5654 F.prototype.constructor = null;
5655 // eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing
5656 return Object.getPrototypeOf(new F()) !== F.prototype;
5657});
5658
5659
5660/***/ }),
5661/* 156 */
5662/***/ (function(module, exports, __webpack_require__) {
5663
5664var getBuiltIn = __webpack_require__(18);
5665var uncurryThis = __webpack_require__(4);
5666var getOwnPropertyNamesModule = __webpack_require__(102);
5667var getOwnPropertySymbolsModule = __webpack_require__(103);
5668var anObject = __webpack_require__(20);
5669
5670var concat = uncurryThis([].concat);
5671
5672// all object keys, includes non-enumerable and symbols
5673module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
5674 var keys = getOwnPropertyNamesModule.f(anObject(it));
5675 var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
5676 return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
5677};
5678
5679
5680/***/ }),
5681/* 157 */
5682/***/ (function(module, exports, __webpack_require__) {
5683
5684var uncurryThis = __webpack_require__(4);
5685var hasOwn = __webpack_require__(12);
5686var toIndexedObject = __webpack_require__(32);
5687var indexOf = __webpack_require__(158).indexOf;
5688var hiddenKeys = __webpack_require__(78);
5689
5690var push = uncurryThis([].push);
5691
5692module.exports = function (object, names) {
5693 var O = toIndexedObject(object);
5694 var i = 0;
5695 var result = [];
5696 var key;
5697 for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
5698 // Don't enum bug & hidden keys
5699 while (names.length > i) if (hasOwn(O, key = names[i++])) {
5700 ~indexOf(result, key) || push(result, key);
5701 }
5702 return result;
5703};
5704
5705
5706/***/ }),
5707/* 158 */
5708/***/ (function(module, exports, __webpack_require__) {
5709
5710var toIndexedObject = __webpack_require__(32);
5711var toAbsoluteIndex = __webpack_require__(124);
5712var lengthOfArrayLike = __webpack_require__(39);
5713
5714// `Array.prototype.{ indexOf, includes }` methods implementation
5715var createMethod = function (IS_INCLUDES) {
5716 return function ($this, el, fromIndex) {
5717 var O = toIndexedObject($this);
5718 var length = lengthOfArrayLike(O);
5719 var index = toAbsoluteIndex(fromIndex, length);
5720 var value;
5721 // Array#includes uses SameValueZero equality algorithm
5722 // eslint-disable-next-line no-self-compare -- NaN check
5723 if (IS_INCLUDES && el != el) while (length > index) {
5724 value = O[index++];
5725 // eslint-disable-next-line no-self-compare -- NaN check
5726 if (value != value) return true;
5727 // Array#indexOf ignores holes, Array#includes - not
5728 } else for (;length > index; index++) {
5729 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
5730 } return !IS_INCLUDES && -1;
5731 };
5732};
5733
5734module.exports = {
5735 // `Array.prototype.includes` method
5736 // https://tc39.es/ecma262/#sec-array.prototype.includes
5737 includes: createMethod(true),
5738 // `Array.prototype.indexOf` method
5739 // https://tc39.es/ecma262/#sec-array.prototype.indexof
5740 indexOf: createMethod(false)
5741};
5742
5743
5744/***/ }),
5745/* 159 */
5746/***/ (function(module, exports, __webpack_require__) {
5747
5748var getBuiltIn = __webpack_require__(18);
5749
5750module.exports = getBuiltIn('document', 'documentElement');
5751
5752
5753/***/ }),
5754/* 160 */
5755/***/ (function(module, exports, __webpack_require__) {
5756
5757var wellKnownSymbol = __webpack_require__(9);
5758var Iterators = __webpack_require__(50);
5759
5760var ITERATOR = wellKnownSymbol('iterator');
5761var ArrayPrototype = Array.prototype;
5762
5763// check on default Array iterator
5764module.exports = function (it) {
5765 return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
5766};
5767
5768
5769/***/ }),
5770/* 161 */
5771/***/ (function(module, exports, __webpack_require__) {
5772
5773var call = __webpack_require__(15);
5774var aCallable = __webpack_require__(31);
5775var anObject = __webpack_require__(20);
5776var tryToString = __webpack_require__(76);
5777var getIteratorMethod = __webpack_require__(105);
5778
5779var $TypeError = TypeError;
5780
5781module.exports = function (argument, usingIterator) {
5782 var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
5783 if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));
5784 throw $TypeError(tryToString(argument) + ' is not iterable');
5785};
5786
5787
5788/***/ }),
5789/* 162 */
5790/***/ (function(module, exports, __webpack_require__) {
5791
5792var call = __webpack_require__(15);
5793var anObject = __webpack_require__(20);
5794var getMethod = __webpack_require__(121);
5795
5796module.exports = function (iterator, kind, value) {
5797 var innerResult, innerError;
5798 anObject(iterator);
5799 try {
5800 innerResult = getMethod(iterator, 'return');
5801 if (!innerResult) {
5802 if (kind === 'throw') throw value;
5803 return value;
5804 }
5805 innerResult = call(innerResult, iterator);
5806 } catch (error) {
5807 innerError = true;
5808 innerResult = error;
5809 }
5810 if (kind === 'throw') throw value;
5811 if (innerError) throw innerResult;
5812 anObject(innerResult);
5813 return value;
5814};
5815
5816
5817/***/ }),
5818/* 163 */
5819/***/ (function(module, exports) {
5820
5821module.exports = function () { /* empty */ };
5822
5823
5824/***/ }),
5825/* 164 */
5826/***/ (function(module, exports, __webpack_require__) {
5827
5828var global = __webpack_require__(7);
5829var isCallable = __webpack_require__(8);
5830var inspectSource = __webpack_require__(129);
5831
5832var WeakMap = global.WeakMap;
5833
5834module.exports = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap));
5835
5836
5837/***/ }),
5838/* 165 */
5839/***/ (function(module, exports, __webpack_require__) {
5840
5841"use strict";
5842
5843var fails = __webpack_require__(2);
5844var isCallable = __webpack_require__(8);
5845var create = __webpack_require__(49);
5846var getPrototypeOf = __webpack_require__(99);
5847var defineBuiltIn = __webpack_require__(43);
5848var wellKnownSymbol = __webpack_require__(9);
5849var IS_PURE = __webpack_require__(33);
5850
5851var ITERATOR = wellKnownSymbol('iterator');
5852var BUGGY_SAFARI_ITERATORS = false;
5853
5854// `%IteratorPrototype%` object
5855// https://tc39.es/ecma262/#sec-%iteratorprototype%-object
5856var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
5857
5858/* eslint-disable es-x/no-array-prototype-keys -- safe */
5859if ([].keys) {
5860 arrayIterator = [].keys();
5861 // Safari 8 has buggy iterators w/o `next`
5862 if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
5863 else {
5864 PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
5865 if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
5866 }
5867}
5868
5869var NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function () {
5870 var test = {};
5871 // FF44- legacy iterators case
5872 return IteratorPrototype[ITERATOR].call(test) !== test;
5873});
5874
5875if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
5876else if (IS_PURE) IteratorPrototype = create(IteratorPrototype);
5877
5878// `%IteratorPrototype%[@@iterator]()` method
5879// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
5880if (!isCallable(IteratorPrototype[ITERATOR])) {
5881 defineBuiltIn(IteratorPrototype, ITERATOR, function () {
5882 return this;
5883 });
5884}
5885
5886module.exports = {
5887 IteratorPrototype: IteratorPrototype,
5888 BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
5889};
5890
5891
5892/***/ }),
5893/* 166 */
5894/***/ (function(module, exports, __webpack_require__) {
5895
5896"use strict";
5897
5898var getBuiltIn = __webpack_require__(18);
5899var definePropertyModule = __webpack_require__(23);
5900var wellKnownSymbol = __webpack_require__(9);
5901var DESCRIPTORS = __webpack_require__(14);
5902
5903var SPECIES = wellKnownSymbol('species');
5904
5905module.exports = function (CONSTRUCTOR_NAME) {
5906 var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
5907 var defineProperty = definePropertyModule.f;
5908
5909 if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
5910 defineProperty(Constructor, SPECIES, {
5911 configurable: true,
5912 get: function () { return this; }
5913 });
5914 }
5915};
5916
5917
5918/***/ }),
5919/* 167 */
5920/***/ (function(module, exports, __webpack_require__) {
5921
5922var anObject = __webpack_require__(20);
5923var aConstructor = __webpack_require__(168);
5924var wellKnownSymbol = __webpack_require__(9);
5925
5926var SPECIES = wellKnownSymbol('species');
5927
5928// `SpeciesConstructor` abstract operation
5929// https://tc39.es/ecma262/#sec-speciesconstructor
5930module.exports = function (O, defaultConstructor) {
5931 var C = anObject(O).constructor;
5932 var S;
5933 return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aConstructor(S);
5934};
5935
5936
5937/***/ }),
5938/* 168 */
5939/***/ (function(module, exports, __webpack_require__) {
5940
5941var isConstructor = __webpack_require__(108);
5942var tryToString = __webpack_require__(76);
5943
5944var $TypeError = TypeError;
5945
5946// `Assert: IsConstructor(argument) is true`
5947module.exports = function (argument) {
5948 if (isConstructor(argument)) return argument;
5949 throw $TypeError(tryToString(argument) + ' is not a constructor');
5950};
5951
5952
5953/***/ }),
5954/* 169 */
5955/***/ (function(module, exports, __webpack_require__) {
5956
5957var global = __webpack_require__(7);
5958var apply = __webpack_require__(73);
5959var bind = __webpack_require__(48);
5960var isCallable = __webpack_require__(8);
5961var hasOwn = __webpack_require__(12);
5962var fails = __webpack_require__(2);
5963var html = __webpack_require__(159);
5964var arraySlice = __webpack_require__(109);
5965var createElement = __webpack_require__(123);
5966var validateArgumentsLength = __webpack_require__(295);
5967var IS_IOS = __webpack_require__(170);
5968var IS_NODE = __webpack_require__(106);
5969
5970var set = global.setImmediate;
5971var clear = global.clearImmediate;
5972var process = global.process;
5973var Dispatch = global.Dispatch;
5974var Function = global.Function;
5975var MessageChannel = global.MessageChannel;
5976var String = global.String;
5977var counter = 0;
5978var queue = {};
5979var ONREADYSTATECHANGE = 'onreadystatechange';
5980var location, defer, channel, port;
5981
5982try {
5983 // Deno throws a ReferenceError on `location` access without `--location` flag
5984 location = global.location;
5985} catch (error) { /* empty */ }
5986
5987var run = function (id) {
5988 if (hasOwn(queue, id)) {
5989 var fn = queue[id];
5990 delete queue[id];
5991 fn();
5992 }
5993};
5994
5995var runner = function (id) {
5996 return function () {
5997 run(id);
5998 };
5999};
6000
6001var listener = function (event) {
6002 run(event.data);
6003};
6004
6005var post = function (id) {
6006 // old engines have not location.origin
6007 global.postMessage(String(id), location.protocol + '//' + location.host);
6008};
6009
6010// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
6011if (!set || !clear) {
6012 set = function setImmediate(handler) {
6013 validateArgumentsLength(arguments.length, 1);
6014 var fn = isCallable(handler) ? handler : Function(handler);
6015 var args = arraySlice(arguments, 1);
6016 queue[++counter] = function () {
6017 apply(fn, undefined, args);
6018 };
6019 defer(counter);
6020 return counter;
6021 };
6022 clear = function clearImmediate(id) {
6023 delete queue[id];
6024 };
6025 // Node.js 0.8-
6026 if (IS_NODE) {
6027 defer = function (id) {
6028 process.nextTick(runner(id));
6029 };
6030 // Sphere (JS game engine) Dispatch API
6031 } else if (Dispatch && Dispatch.now) {
6032 defer = function (id) {
6033 Dispatch.now(runner(id));
6034 };
6035 // Browsers with MessageChannel, includes WebWorkers
6036 // except iOS - https://github.com/zloirock/core-js/issues/624
6037 } else if (MessageChannel && !IS_IOS) {
6038 channel = new MessageChannel();
6039 port = channel.port2;
6040 channel.port1.onmessage = listener;
6041 defer = bind(port.postMessage, port);
6042 // Browsers with postMessage, skip WebWorkers
6043 // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
6044 } else if (
6045 global.addEventListener &&
6046 isCallable(global.postMessage) &&
6047 !global.importScripts &&
6048 location && location.protocol !== 'file:' &&
6049 !fails(post)
6050 ) {
6051 defer = post;
6052 global.addEventListener('message', listener, false);
6053 // IE8-
6054 } else if (ONREADYSTATECHANGE in createElement('script')) {
6055 defer = function (id) {
6056 html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
6057 html.removeChild(this);
6058 run(id);
6059 };
6060 };
6061 // Rest old browsers
6062 } else {
6063 defer = function (id) {
6064 setTimeout(runner(id), 0);
6065 };
6066 }
6067}
6068
6069module.exports = {
6070 set: set,
6071 clear: clear
6072};
6073
6074
6075/***/ }),
6076/* 170 */
6077/***/ (function(module, exports, __webpack_require__) {
6078
6079var userAgent = __webpack_require__(97);
6080
6081module.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent);
6082
6083
6084/***/ }),
6085/* 171 */
6086/***/ (function(module, exports, __webpack_require__) {
6087
6088var NativePromiseConstructor = __webpack_require__(64);
6089var checkCorrectnessOfIteration = __webpack_require__(172);
6090var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(81).CONSTRUCTOR;
6091
6092module.exports = FORCED_PROMISE_CONSTRUCTOR || !checkCorrectnessOfIteration(function (iterable) {
6093 NativePromiseConstructor.all(iterable).then(undefined, function () { /* empty */ });
6094});
6095
6096
6097/***/ }),
6098/* 172 */
6099/***/ (function(module, exports, __webpack_require__) {
6100
6101var wellKnownSymbol = __webpack_require__(9);
6102
6103var ITERATOR = wellKnownSymbol('iterator');
6104var SAFE_CLOSING = false;
6105
6106try {
6107 var called = 0;
6108 var iteratorWithReturn = {
6109 next: function () {
6110 return { done: !!called++ };
6111 },
6112 'return': function () {
6113 SAFE_CLOSING = true;
6114 }
6115 };
6116 iteratorWithReturn[ITERATOR] = function () {
6117 return this;
6118 };
6119 // eslint-disable-next-line es-x/no-array-from, no-throw-literal -- required for testing
6120 Array.from(iteratorWithReturn, function () { throw 2; });
6121} catch (error) { /* empty */ }
6122
6123module.exports = function (exec, SKIP_CLOSING) {
6124 if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
6125 var ITERATION_SUPPORT = false;
6126 try {
6127 var object = {};
6128 object[ITERATOR] = function () {
6129 return {
6130 next: function () {
6131 return { done: ITERATION_SUPPORT = true };
6132 }
6133 };
6134 };
6135 exec(object);
6136 } catch (error) { /* empty */ }
6137 return ITERATION_SUPPORT;
6138};
6139
6140
6141/***/ }),
6142/* 173 */
6143/***/ (function(module, exports, __webpack_require__) {
6144
6145var anObject = __webpack_require__(20);
6146var isObject = __webpack_require__(11);
6147var newPromiseCapability = __webpack_require__(53);
6148
6149module.exports = function (C, x) {
6150 anObject(C);
6151 if (isObject(x) && x.constructor === C) return x;
6152 var promiseCapability = newPromiseCapability.f(C);
6153 var resolve = promiseCapability.resolve;
6154 resolve(x);
6155 return promiseCapability.promise;
6156};
6157
6158
6159/***/ }),
6160/* 174 */
6161/***/ (function(module, __webpack_exports__, __webpack_require__) {
6162
6163"use strict";
6164/* harmony export (immutable) */ __webpack_exports__["a"] = isUndefined;
6165// Is a given variable undefined?
6166function isUndefined(obj) {
6167 return obj === void 0;
6168}
6169
6170
6171/***/ }),
6172/* 175 */
6173/***/ (function(module, __webpack_exports__, __webpack_require__) {
6174
6175"use strict";
6176/* harmony export (immutable) */ __webpack_exports__["a"] = isBoolean;
6177/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(5);
6178
6179
6180// Is a given value a boolean?
6181function isBoolean(obj) {
6182 return obj === true || obj === false || __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === '[object Boolean]';
6183}
6184
6185
6186/***/ }),
6187/* 176 */
6188/***/ (function(module, __webpack_exports__, __webpack_require__) {
6189
6190"use strict";
6191/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
6192
6193
6194/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Number'));
6195
6196
6197/***/ }),
6198/* 177 */
6199/***/ (function(module, __webpack_exports__, __webpack_require__) {
6200
6201"use strict";
6202/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
6203
6204
6205/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Symbol'));
6206
6207
6208/***/ }),
6209/* 178 */
6210/***/ (function(module, __webpack_exports__, __webpack_require__) {
6211
6212"use strict";
6213/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
6214
6215
6216/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('ArrayBuffer'));
6217
6218
6219/***/ }),
6220/* 179 */
6221/***/ (function(module, __webpack_exports__, __webpack_require__) {
6222
6223"use strict";
6224/* harmony export (immutable) */ __webpack_exports__["a"] = isNaN;
6225/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(5);
6226/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isNumber_js__ = __webpack_require__(176);
6227
6228
6229
6230// Is the given value `NaN`?
6231function isNaN(obj) {
6232 return Object(__WEBPACK_IMPORTED_MODULE_1__isNumber_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["g" /* _isNaN */])(obj);
6233}
6234
6235
6236/***/ }),
6237/* 180 */
6238/***/ (function(module, __webpack_exports__, __webpack_require__) {
6239
6240"use strict";
6241/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(5);
6242/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isDataView_js__ = __webpack_require__(133);
6243/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constant_js__ = __webpack_require__(181);
6244/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__ = __webpack_require__(320);
6245
6246
6247
6248
6249
6250// Is a given value a typed array?
6251var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
6252function isTypedArray(obj) {
6253 // `ArrayBuffer.isView` is the most future-proof, so use it when available.
6254 // Otherwise, fall back on the above regular expression.
6255 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)) :
6256 Object(__WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__["a" /* default */])(obj) && typedArrayPattern.test(__WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj));
6257}
6258
6259/* 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));
6260
6261
6262/***/ }),
6263/* 181 */
6264/***/ (function(module, __webpack_exports__, __webpack_require__) {
6265
6266"use strict";
6267/* harmony export (immutable) */ __webpack_exports__["a"] = constant;
6268// Predicate-generating function. Often useful outside of Underscore.
6269function constant(value) {
6270 return function() {
6271 return value;
6272 };
6273}
6274
6275
6276/***/ }),
6277/* 182 */
6278/***/ (function(module, __webpack_exports__, __webpack_require__) {
6279
6280"use strict";
6281/* harmony export (immutable) */ __webpack_exports__["a"] = createSizePropertyCheck;
6282/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(5);
6283
6284
6285// Common internal logic for `isArrayLike` and `isBufferLike`.
6286function createSizePropertyCheck(getSizeProperty) {
6287 return function(collection) {
6288 var sizeProperty = getSizeProperty(collection);
6289 return typeof sizeProperty == 'number' && sizeProperty >= 0 && sizeProperty <= __WEBPACK_IMPORTED_MODULE_0__setup_js__["b" /* MAX_ARRAY_INDEX */];
6290 }
6291}
6292
6293
6294/***/ }),
6295/* 183 */
6296/***/ (function(module, __webpack_exports__, __webpack_require__) {
6297
6298"use strict";
6299/* harmony export (immutable) */ __webpack_exports__["a"] = shallowProperty;
6300// Internal helper to generate a function to obtain property `key` from `obj`.
6301function shallowProperty(key) {
6302 return function(obj) {
6303 return obj == null ? void 0 : obj[key];
6304 };
6305}
6306
6307
6308/***/ }),
6309/* 184 */
6310/***/ (function(module, __webpack_exports__, __webpack_require__) {
6311
6312"use strict";
6313/* harmony export (immutable) */ __webpack_exports__["a"] = collectNonEnumProps;
6314/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(5);
6315/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
6316/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(45);
6317
6318
6319
6320
6321// Internal helper to create a simple lookup structure.
6322// `collectNonEnumProps` used to depend on `_.contains`, but this led to
6323// circular imports. `emulatedSet` is a one-off solution that only works for
6324// arrays of strings.
6325function emulatedSet(keys) {
6326 var hash = {};
6327 for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true;
6328 return {
6329 contains: function(key) { return hash[key]; },
6330 push: function(key) {
6331 hash[key] = true;
6332 return keys.push(key);
6333 }
6334 };
6335}
6336
6337// Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't
6338// be iterated by `for key in ...` and thus missed. Extends `keys` in place if
6339// needed.
6340function collectNonEnumProps(obj, keys) {
6341 keys = emulatedSet(keys);
6342 var nonEnumIdx = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */].length;
6343 var constructor = obj.constructor;
6344 var proto = Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(constructor) && constructor.prototype || __WEBPACK_IMPORTED_MODULE_0__setup_js__["c" /* ObjProto */];
6345
6346 // Constructor is a special case.
6347 var prop = 'constructor';
6348 if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, prop) && !keys.contains(prop)) keys.push(prop);
6349
6350 while (nonEnumIdx--) {
6351 prop = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */][nonEnumIdx];
6352 if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) {
6353 keys.push(prop);
6354 }
6355 }
6356}
6357
6358
6359/***/ }),
6360/* 185 */
6361/***/ (function(module, __webpack_exports__, __webpack_require__) {
6362
6363"use strict";
6364/* harmony export (immutable) */ __webpack_exports__["a"] = isMatch;
6365/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
6366
6367
6368// Returns whether an object has a given set of `key:value` pairs.
6369function isMatch(object, attrs) {
6370 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(attrs), length = _keys.length;
6371 if (object == null) return !length;
6372 var obj = Object(object);
6373 for (var i = 0; i < length; i++) {
6374 var key = _keys[i];
6375 if (attrs[key] !== obj[key] || !(key in obj)) return false;
6376 }
6377 return true;
6378}
6379
6380
6381/***/ }),
6382/* 186 */
6383/***/ (function(module, __webpack_exports__, __webpack_require__) {
6384
6385"use strict";
6386/* harmony export (immutable) */ __webpack_exports__["a"] = invert;
6387/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
6388
6389
6390// Invert the keys and values of an object. The values must be serializable.
6391function invert(obj) {
6392 var result = {};
6393 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
6394 for (var i = 0, length = _keys.length; i < length; i++) {
6395 result[obj[_keys[i]]] = _keys[i];
6396 }
6397 return result;
6398}
6399
6400
6401/***/ }),
6402/* 187 */
6403/***/ (function(module, __webpack_exports__, __webpack_require__) {
6404
6405"use strict";
6406/* harmony export (immutable) */ __webpack_exports__["a"] = functions;
6407/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(28);
6408
6409
6410// Return a sorted list of the function names available on the object.
6411function functions(obj) {
6412 var names = [];
6413 for (var key in obj) {
6414 if (Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(obj[key])) names.push(key);
6415 }
6416 return names.sort();
6417}
6418
6419
6420/***/ }),
6421/* 188 */
6422/***/ (function(module, __webpack_exports__, __webpack_require__) {
6423
6424"use strict";
6425/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(137);
6426/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(83);
6427
6428
6429
6430// Extend a given object with all the properties in passed-in object(s).
6431/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */]));
6432
6433
6434/***/ }),
6435/* 189 */
6436/***/ (function(module, __webpack_exports__, __webpack_require__) {
6437
6438"use strict";
6439/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(137);
6440/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(83);
6441
6442
6443
6444// Fill in a given object with default properties.
6445/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */], true));
6446
6447
6448/***/ }),
6449/* 190 */
6450/***/ (function(module, __webpack_exports__, __webpack_require__) {
6451
6452"use strict";
6453/* harmony export (immutable) */ __webpack_exports__["a"] = baseCreate;
6454/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(54);
6455/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(5);
6456
6457
6458
6459// Create a naked function reference for surrogate-prototype-swapping.
6460function ctor() {
6461 return function(){};
6462}
6463
6464// An internal function for creating a new object that inherits from another.
6465function baseCreate(prototype) {
6466 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(prototype)) return {};
6467 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */])(prototype);
6468 var Ctor = ctor();
6469 Ctor.prototype = prototype;
6470 var result = new Ctor;
6471 Ctor.prototype = null;
6472 return result;
6473}
6474
6475
6476/***/ }),
6477/* 191 */
6478/***/ (function(module, __webpack_exports__, __webpack_require__) {
6479
6480"use strict";
6481/* harmony export (immutable) */ __webpack_exports__["a"] = clone;
6482/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(54);
6483/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(55);
6484/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__extend_js__ = __webpack_require__(188);
6485
6486
6487
6488
6489// Create a (shallow-cloned) duplicate of an object.
6490function clone(obj) {
6491 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return obj;
6492 return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(obj) ? obj.slice() : Object(__WEBPACK_IMPORTED_MODULE_2__extend_js__["a" /* default */])({}, obj);
6493}
6494
6495
6496/***/ }),
6497/* 192 */
6498/***/ (function(module, __webpack_exports__, __webpack_require__) {
6499
6500"use strict";
6501/* harmony export (immutable) */ __webpack_exports__["a"] = get;
6502/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__toPath_js__ = __webpack_require__(84);
6503/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__deepGet_js__ = __webpack_require__(139);
6504/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isUndefined_js__ = __webpack_require__(174);
6505
6506
6507
6508
6509// Get the value of the (deep) property on `path` from `object`.
6510// If any property in `path` does not exist or if the value is
6511// `undefined`, return `defaultValue` instead.
6512// The `path` is normalized through `_.toPath`.
6513function get(object, path, defaultValue) {
6514 var value = Object(__WEBPACK_IMPORTED_MODULE_1__deepGet_js__["a" /* default */])(object, Object(__WEBPACK_IMPORTED_MODULE_0__toPath_js__["a" /* default */])(path));
6515 return Object(__WEBPACK_IMPORTED_MODULE_2__isUndefined_js__["a" /* default */])(value) ? defaultValue : value;
6516}
6517
6518
6519/***/ }),
6520/* 193 */
6521/***/ (function(module, __webpack_exports__, __webpack_require__) {
6522
6523"use strict";
6524/* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
6525/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
6526/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(55);
6527
6528
6529
6530// Normalize a (deep) property `path` to array.
6531// Like `_.iteratee`, this function can be customized.
6532function toPath(path) {
6533 return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(path) ? path : [path];
6534}
6535__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath = toPath;
6536
6537
6538/***/ }),
6539/* 194 */
6540/***/ (function(module, __webpack_exports__, __webpack_require__) {
6541
6542"use strict";
6543/* harmony export (immutable) */ __webpack_exports__["a"] = baseIteratee;
6544/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__identity_js__ = __webpack_require__(140);
6545/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
6546/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(54);
6547/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArray_js__ = __webpack_require__(55);
6548/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__matcher_js__ = __webpack_require__(110);
6549/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__property_js__ = __webpack_require__(141);
6550/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__ = __webpack_require__(85);
6551
6552
6553
6554
6555
6556
6557
6558
6559// An internal function to generate callbacks that can be applied to each
6560// element in a collection, returning the desired result — either `_.identity`,
6561// an arbitrary callback, a property matcher, or a property accessor.
6562function baseIteratee(value, context, argCount) {
6563 if (value == null) return __WEBPACK_IMPORTED_MODULE_0__identity_js__["a" /* default */];
6564 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(value)) return Object(__WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__["a" /* default */])(value, context, argCount);
6565 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);
6566 return Object(__WEBPACK_IMPORTED_MODULE_5__property_js__["a" /* default */])(value);
6567}
6568
6569
6570/***/ }),
6571/* 195 */
6572/***/ (function(module, __webpack_exports__, __webpack_require__) {
6573
6574"use strict";
6575/* harmony export (immutable) */ __webpack_exports__["a"] = iteratee;
6576/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
6577/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(194);
6578
6579
6580
6581// External wrapper for our callback generator. Users may customize
6582// `_.iteratee` if they want additional predicate/iteratee shorthand styles.
6583// This abstraction hides the internal-only `argCount` argument.
6584function iteratee(value, context) {
6585 return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, Infinity);
6586}
6587__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].iteratee = iteratee;
6588
6589
6590/***/ }),
6591/* 196 */
6592/***/ (function(module, __webpack_exports__, __webpack_require__) {
6593
6594"use strict";
6595/* harmony export (immutable) */ __webpack_exports__["a"] = noop;
6596// Predicate-generating function. Often useful outside of Underscore.
6597function noop(){}
6598
6599
6600/***/ }),
6601/* 197 */
6602/***/ (function(module, __webpack_exports__, __webpack_require__) {
6603
6604"use strict";
6605/* harmony export (immutable) */ __webpack_exports__["a"] = random;
6606// Return a random integer between `min` and `max` (inclusive).
6607function random(min, max) {
6608 if (max == null) {
6609 max = min;
6610 min = 0;
6611 }
6612 return min + Math.floor(Math.random() * (max - min + 1));
6613}
6614
6615
6616/***/ }),
6617/* 198 */
6618/***/ (function(module, __webpack_exports__, __webpack_require__) {
6619
6620"use strict";
6621/* harmony export (immutable) */ __webpack_exports__["a"] = createEscaper;
6622/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
6623
6624
6625// Internal helper to generate functions for escaping and unescaping strings
6626// to/from HTML interpolation.
6627function createEscaper(map) {
6628 var escaper = function(match) {
6629 return map[match];
6630 };
6631 // Regexes for identifying a key that needs to be escaped.
6632 var source = '(?:' + Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(map).join('|') + ')';
6633 var testRegexp = RegExp(source);
6634 var replaceRegexp = RegExp(source, 'g');
6635 return function(string) {
6636 string = string == null ? '' : '' + string;
6637 return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
6638 };
6639}
6640
6641
6642/***/ }),
6643/* 199 */
6644/***/ (function(module, __webpack_exports__, __webpack_require__) {
6645
6646"use strict";
6647// Internal list of HTML entities for escaping.
6648/* harmony default export */ __webpack_exports__["a"] = ({
6649 '&': '&amp;',
6650 '<': '&lt;',
6651 '>': '&gt;',
6652 '"': '&quot;',
6653 "'": '&#x27;',
6654 '`': '&#x60;'
6655});
6656
6657
6658/***/ }),
6659/* 200 */
6660/***/ (function(module, __webpack_exports__, __webpack_require__) {
6661
6662"use strict";
6663/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
6664
6665
6666// By default, Underscore uses ERB-style template delimiters. Change the
6667// following template settings to use alternative delimiters.
6668/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].templateSettings = {
6669 evaluate: /<%([\s\S]+?)%>/g,
6670 interpolate: /<%=([\s\S]+?)%>/g,
6671 escape: /<%-([\s\S]+?)%>/g
6672});
6673
6674
6675/***/ }),
6676/* 201 */
6677/***/ (function(module, __webpack_exports__, __webpack_require__) {
6678
6679"use strict";
6680/* harmony export (immutable) */ __webpack_exports__["a"] = executeBound;
6681/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(190);
6682/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isObject_js__ = __webpack_require__(54);
6683
6684
6685
6686// Internal function to execute `sourceFunc` bound to `context` with optional
6687// `args`. Determines whether to execute a function as a constructor or as a
6688// normal function.
6689function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
6690 if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
6691 var self = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(sourceFunc.prototype);
6692 var result = sourceFunc.apply(self, args);
6693 if (Object(__WEBPACK_IMPORTED_MODULE_1__isObject_js__["a" /* default */])(result)) return result;
6694 return self;
6695}
6696
6697
6698/***/ }),
6699/* 202 */
6700/***/ (function(module, __webpack_exports__, __webpack_require__) {
6701
6702"use strict";
6703/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
6704/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
6705/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__executeBound_js__ = __webpack_require__(201);
6706
6707
6708
6709
6710// Create a function bound to a given object (assigning `this`, and arguments,
6711// optionally).
6712/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, context, args) {
6713 if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(func)) throw new TypeError('Bind must be called on a function');
6714 var bound = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(callArgs) {
6715 return Object(__WEBPACK_IMPORTED_MODULE_2__executeBound_js__["a" /* default */])(func, bound, context, this, args.concat(callArgs));
6716 });
6717 return bound;
6718}));
6719
6720
6721/***/ }),
6722/* 203 */
6723/***/ (function(module, __webpack_exports__, __webpack_require__) {
6724
6725"use strict";
6726/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
6727
6728
6729// Delays a function for the given number of milliseconds, and then calls
6730// it with the arguments supplied.
6731/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, wait, args) {
6732 return setTimeout(function() {
6733 return func.apply(null, args);
6734 }, wait);
6735}));
6736
6737
6738/***/ }),
6739/* 204 */
6740/***/ (function(module, __webpack_exports__, __webpack_require__) {
6741
6742"use strict";
6743/* harmony export (immutable) */ __webpack_exports__["a"] = before;
6744// Returns a function that will only be executed up to (but not including) the
6745// Nth call.
6746function before(times, func) {
6747 var memo;
6748 return function() {
6749 if (--times > 0) {
6750 memo = func.apply(this, arguments);
6751 }
6752 if (times <= 1) func = null;
6753 return memo;
6754 };
6755}
6756
6757
6758/***/ }),
6759/* 205 */
6760/***/ (function(module, __webpack_exports__, __webpack_require__) {
6761
6762"use strict";
6763/* harmony export (immutable) */ __webpack_exports__["a"] = findKey;
6764/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
6765/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
6766
6767
6768
6769// Returns the first key on an object that passes a truth test.
6770function findKey(obj, predicate, context) {
6771 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
6772 var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj), key;
6773 for (var i = 0, length = _keys.length; i < length; i++) {
6774 key = _keys[i];
6775 if (predicate(obj[key], key, obj)) return key;
6776 }
6777}
6778
6779
6780/***/ }),
6781/* 206 */
6782/***/ (function(module, __webpack_exports__, __webpack_require__) {
6783
6784"use strict";
6785/* harmony export (immutable) */ __webpack_exports__["a"] = createPredicateIndexFinder;
6786/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
6787/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29);
6788
6789
6790
6791// Internal function to generate `_.findIndex` and `_.findLastIndex`.
6792function createPredicateIndexFinder(dir) {
6793 return function(array, predicate, context) {
6794 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
6795 var length = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
6796 var index = dir > 0 ? 0 : length - 1;
6797 for (; index >= 0 && index < length; index += dir) {
6798 if (predicate(array[index], index, array)) return index;
6799 }
6800 return -1;
6801 };
6802}
6803
6804
6805/***/ }),
6806/* 207 */
6807/***/ (function(module, __webpack_exports__, __webpack_require__) {
6808
6809"use strict";
6810/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(206);
6811
6812
6813// Returns the last index on an array-like that passes a truth test.
6814/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(-1));
6815
6816
6817/***/ }),
6818/* 208 */
6819/***/ (function(module, __webpack_exports__, __webpack_require__) {
6820
6821"use strict";
6822/* harmony export (immutable) */ __webpack_exports__["a"] = sortedIndex;
6823/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
6824/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29);
6825
6826
6827
6828// Use a comparator function to figure out the smallest index at which
6829// an object should be inserted so as to maintain order. Uses binary search.
6830function sortedIndex(array, obj, iteratee, context) {
6831 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context, 1);
6832 var value = iteratee(obj);
6833 var low = 0, high = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
6834 while (low < high) {
6835 var mid = Math.floor((low + high) / 2);
6836 if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
6837 }
6838 return low;
6839}
6840
6841
6842/***/ }),
6843/* 209 */
6844/***/ (function(module, __webpack_exports__, __webpack_require__) {
6845
6846"use strict";
6847/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sortedIndex_js__ = __webpack_require__(208);
6848/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(144);
6849/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__createIndexFinder_js__ = __webpack_require__(210);
6850
6851
6852
6853
6854// Return the position of the first occurrence of an item in an array,
6855// or -1 if the item is not included in the array.
6856// If the array is large and already in sort order, pass `true`
6857// for **isSorted** to use binary search.
6858/* 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 */]));
6859
6860
6861/***/ }),
6862/* 210 */
6863/***/ (function(module, __webpack_exports__, __webpack_require__) {
6864
6865"use strict";
6866/* harmony export (immutable) */ __webpack_exports__["a"] = createIndexFinder;
6867/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
6868/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(5);
6869/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isNaN_js__ = __webpack_require__(179);
6870
6871
6872
6873
6874// Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions.
6875function createIndexFinder(dir, predicateFind, sortedIndex) {
6876 return function(array, item, idx) {
6877 var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array);
6878 if (typeof idx == 'number') {
6879 if (dir > 0) {
6880 i = idx >= 0 ? idx : Math.max(idx + length, i);
6881 } else {
6882 length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
6883 }
6884 } else if (sortedIndex && idx && length) {
6885 idx = sortedIndex(array, item);
6886 return array[idx] === item ? idx : -1;
6887 }
6888 if (item !== item) {
6889 idx = predicateFind(__WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(array, i, length), __WEBPACK_IMPORTED_MODULE_2__isNaN_js__["a" /* default */]);
6890 return idx >= 0 ? idx + i : -1;
6891 }
6892 for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
6893 if (array[idx] === item) return idx;
6894 }
6895 return -1;
6896 };
6897}
6898
6899
6900/***/ }),
6901/* 211 */
6902/***/ (function(module, __webpack_exports__, __webpack_require__) {
6903
6904"use strict";
6905/* harmony export (immutable) */ __webpack_exports__["a"] = find;
6906/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
6907/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(144);
6908/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__findKey_js__ = __webpack_require__(205);
6909
6910
6911
6912
6913// Return the first value which passes a truth test.
6914function find(obj, predicate, context) {
6915 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 */];
6916 var key = keyFinder(obj, predicate, context);
6917 if (key !== void 0 && key !== -1) return obj[key];
6918}
6919
6920
6921/***/ }),
6922/* 212 */
6923/***/ (function(module, __webpack_exports__, __webpack_require__) {
6924
6925"use strict";
6926/* harmony export (immutable) */ __webpack_exports__["a"] = createReduce;
6927/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
6928/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
6929/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(85);
6930
6931
6932
6933
6934// Internal helper to create a reducing function, iterating left or right.
6935function createReduce(dir) {
6936 // Wrap code that reassigns argument variables in a separate function than
6937 // the one that accesses `arguments.length` to avoid a perf hit. (#1991)
6938 var reducer = function(obj, iteratee, memo, initial) {
6939 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
6940 length = (_keys || obj).length,
6941 index = dir > 0 ? 0 : length - 1;
6942 if (!initial) {
6943 memo = obj[_keys ? _keys[index] : index];
6944 index += dir;
6945 }
6946 for (; index >= 0 && index < length; index += dir) {
6947 var currentKey = _keys ? _keys[index] : index;
6948 memo = iteratee(memo, obj[currentKey], currentKey, obj);
6949 }
6950 return memo;
6951 };
6952
6953 return function(obj, iteratee, memo, context) {
6954 var initial = arguments.length >= 3;
6955 return reducer(obj, Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, context, 4), memo, initial);
6956 };
6957}
6958
6959
6960/***/ }),
6961/* 213 */
6962/***/ (function(module, __webpack_exports__, __webpack_require__) {
6963
6964"use strict";
6965/* harmony export (immutable) */ __webpack_exports__["a"] = max;
6966/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
6967/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(66);
6968/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(21);
6969/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(56);
6970
6971
6972
6973
6974
6975// Return the maximum element (or element-based computation).
6976function max(obj, iteratee, context) {
6977 var result = -Infinity, lastComputed = -Infinity,
6978 value, computed;
6979 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
6980 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
6981 for (var i = 0, length = obj.length; i < length; i++) {
6982 value = obj[i];
6983 if (value != null && value > result) {
6984 result = value;
6985 }
6986 }
6987 } else {
6988 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
6989 Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
6990 computed = iteratee(v, index, list);
6991 if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
6992 result = v;
6993 lastComputed = computed;
6994 }
6995 });
6996 }
6997 return result;
6998}
6999
7000
7001/***/ }),
7002/* 214 */
7003/***/ (function(module, __webpack_exports__, __webpack_require__) {
7004
7005"use strict";
7006/* harmony export (immutable) */ __webpack_exports__["a"] = sample;
7007/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
7008/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__clone_js__ = __webpack_require__(191);
7009/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__values_js__ = __webpack_require__(66);
7010/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__getLength_js__ = __webpack_require__(29);
7011/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__random_js__ = __webpack_require__(197);
7012
7013
7014
7015
7016
7017
7018// Sample **n** random values from a collection using the modern version of the
7019// [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
7020// If **n** is not specified, returns a single random element.
7021// The internal `guard` argument allows it to work with `_.map`.
7022function sample(obj, n, guard) {
7023 if (n == null || guard) {
7024 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_2__values_js__["a" /* default */])(obj);
7025 return obj[Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(obj.length - 1)];
7026 }
7027 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);
7028 var length = Object(__WEBPACK_IMPORTED_MODULE_3__getLength_js__["a" /* default */])(sample);
7029 n = Math.max(Math.min(n, length), 0);
7030 var last = length - 1;
7031 for (var index = 0; index < n; index++) {
7032 var rand = Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(index, last);
7033 var temp = sample[index];
7034 sample[index] = sample[rand];
7035 sample[rand] = temp;
7036 }
7037 return sample.slice(0, n);
7038}
7039
7040
7041/***/ }),
7042/* 215 */
7043/***/ (function(module, __webpack_exports__, __webpack_require__) {
7044
7045"use strict";
7046/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
7047/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
7048/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(85);
7049/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__allKeys_js__ = __webpack_require__(83);
7050/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__ = __webpack_require__(369);
7051/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__flatten_js__ = __webpack_require__(67);
7052
7053
7054
7055
7056
7057
7058
7059// Return a copy of the object only containing the allowed properties.
7060/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
7061 var result = {}, iteratee = keys[0];
7062 if (obj == null) return result;
7063 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
7064 if (keys.length > 1) iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, keys[1]);
7065 keys = Object(__WEBPACK_IMPORTED_MODULE_3__allKeys_js__["a" /* default */])(obj);
7066 } else {
7067 iteratee = __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__["a" /* default */];
7068 keys = Object(__WEBPACK_IMPORTED_MODULE_5__flatten_js__["a" /* default */])(keys, false, false);
7069 obj = Object(obj);
7070 }
7071 for (var i = 0, length = keys.length; i < length; i++) {
7072 var key = keys[i];
7073 var value = obj[key];
7074 if (iteratee(value, key, obj)) result[key] = value;
7075 }
7076 return result;
7077}));
7078
7079
7080/***/ }),
7081/* 216 */
7082/***/ (function(module, __webpack_exports__, __webpack_require__) {
7083
7084"use strict";
7085/* harmony export (immutable) */ __webpack_exports__["a"] = initial;
7086/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(5);
7087
7088
7089// Returns everything but the last entry of the array. Especially useful on
7090// the arguments object. Passing **n** will return all the values in
7091// the array, excluding the last N.
7092function initial(array, n, guard) {
7093 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
7094}
7095
7096
7097/***/ }),
7098/* 217 */
7099/***/ (function(module, __webpack_exports__, __webpack_require__) {
7100
7101"use strict";
7102/* harmony export (immutable) */ __webpack_exports__["a"] = rest;
7103/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(5);
7104
7105
7106// Returns everything but the first entry of the `array`. Especially useful on
7107// the `arguments` object. Passing an **n** will return the rest N values in the
7108// `array`.
7109function rest(array, n, guard) {
7110 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, n == null || guard ? 1 : n);
7111}
7112
7113
7114/***/ }),
7115/* 218 */
7116/***/ (function(module, __webpack_exports__, __webpack_require__) {
7117
7118"use strict";
7119/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
7120/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(67);
7121/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__filter_js__ = __webpack_require__(86);
7122/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(87);
7123
7124
7125
7126
7127
7128// Take the difference between one array and a number of other arrays.
7129// Only the elements present in just the first array will remain.
7130/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, rest) {
7131 rest = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(rest, true, true);
7132 return Object(__WEBPACK_IMPORTED_MODULE_2__filter_js__["a" /* default */])(array, function(value){
7133 return !Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(rest, value);
7134 });
7135}));
7136
7137
7138/***/ }),
7139/* 219 */
7140/***/ (function(module, __webpack_exports__, __webpack_require__) {
7141
7142"use strict";
7143/* harmony export (immutable) */ __webpack_exports__["a"] = uniq;
7144/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isBoolean_js__ = __webpack_require__(175);
7145/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__cb_js__ = __webpack_require__(21);
7146/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getLength_js__ = __webpack_require__(29);
7147/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(87);
7148
7149
7150
7151
7152
7153// Produce a duplicate-free version of the array. If the array has already
7154// been sorted, you have the option of using a faster algorithm.
7155// The faster algorithm will not work with an iteratee if the iteratee
7156// is not a one-to-one function, so providing an iteratee will disable
7157// the faster algorithm.
7158function uniq(array, isSorted, iteratee, context) {
7159 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isBoolean_js__["a" /* default */])(isSorted)) {
7160 context = iteratee;
7161 iteratee = isSorted;
7162 isSorted = false;
7163 }
7164 if (iteratee != null) iteratee = Object(__WEBPACK_IMPORTED_MODULE_1__cb_js__["a" /* default */])(iteratee, context);
7165 var result = [];
7166 var seen = [];
7167 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_2__getLength_js__["a" /* default */])(array); i < length; i++) {
7168 var value = array[i],
7169 computed = iteratee ? iteratee(value, i, array) : value;
7170 if (isSorted && !iteratee) {
7171 if (!i || seen !== computed) result.push(value);
7172 seen = computed;
7173 } else if (iteratee) {
7174 if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(seen, computed)) {
7175 seen.push(computed);
7176 result.push(value);
7177 }
7178 } else if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(result, value)) {
7179 result.push(value);
7180 }
7181 }
7182 return result;
7183}
7184
7185
7186/***/ }),
7187/* 220 */
7188/***/ (function(module, __webpack_exports__, __webpack_require__) {
7189
7190"use strict";
7191/* harmony export (immutable) */ __webpack_exports__["a"] = unzip;
7192/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__max_js__ = __webpack_require__(213);
7193/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29);
7194/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__pluck_js__ = __webpack_require__(145);
7195
7196
7197
7198
7199// Complement of zip. Unzip accepts an array of arrays and groups
7200// each array's elements on shared indices.
7201function unzip(array) {
7202 var length = array && Object(__WEBPACK_IMPORTED_MODULE_0__max_js__["a" /* default */])(array, __WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */]).length || 0;
7203 var result = Array(length);
7204
7205 for (var index = 0; index < length; index++) {
7206 result[index] = Object(__WEBPACK_IMPORTED_MODULE_2__pluck_js__["a" /* default */])(array, index);
7207 }
7208 return result;
7209}
7210
7211
7212/***/ }),
7213/* 221 */
7214/***/ (function(module, __webpack_exports__, __webpack_require__) {
7215
7216"use strict";
7217/* harmony export (immutable) */ __webpack_exports__["a"] = chainResult;
7218/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
7219
7220
7221// Helper function to continue chaining intermediate results.
7222function chainResult(instance, obj) {
7223 return instance._chain ? Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj).chain() : obj;
7224}
7225
7226
7227/***/ }),
7228/* 222 */
7229/***/ (function(module, exports, __webpack_require__) {
7230
7231"use strict";
7232
7233var $ = __webpack_require__(0);
7234var fails = __webpack_require__(2);
7235var isArray = __webpack_require__(88);
7236var isObject = __webpack_require__(11);
7237var toObject = __webpack_require__(34);
7238var lengthOfArrayLike = __webpack_require__(39);
7239var doesNotExceedSafeInteger = __webpack_require__(387);
7240var createProperty = __webpack_require__(89);
7241var arraySpeciesCreate = __webpack_require__(223);
7242var arrayMethodHasSpeciesSupport = __webpack_require__(113);
7243var wellKnownSymbol = __webpack_require__(9);
7244var V8_VERSION = __webpack_require__(75);
7245
7246var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
7247
7248// We can't use this feature detection in V8 since it causes
7249// deoptimization and serious performance degradation
7250// https://github.com/zloirock/core-js/issues/679
7251var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
7252 var array = [];
7253 array[IS_CONCAT_SPREADABLE] = false;
7254 return array.concat()[0] !== array;
7255});
7256
7257var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
7258
7259var isConcatSpreadable = function (O) {
7260 if (!isObject(O)) return false;
7261 var spreadable = O[IS_CONCAT_SPREADABLE];
7262 return spreadable !== undefined ? !!spreadable : isArray(O);
7263};
7264
7265var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
7266
7267// `Array.prototype.concat` method
7268// https://tc39.es/ecma262/#sec-array.prototype.concat
7269// with adding support of @@isConcatSpreadable and @@species
7270$({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
7271 // eslint-disable-next-line no-unused-vars -- required for `.length`
7272 concat: function concat(arg) {
7273 var O = toObject(this);
7274 var A = arraySpeciesCreate(O, 0);
7275 var n = 0;
7276 var i, k, length, len, E;
7277 for (i = -1, length = arguments.length; i < length; i++) {
7278 E = i === -1 ? O : arguments[i];
7279 if (isConcatSpreadable(E)) {
7280 len = lengthOfArrayLike(E);
7281 doesNotExceedSafeInteger(n + len);
7282 for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
7283 } else {
7284 doesNotExceedSafeInteger(n + 1);
7285 createProperty(A, n++, E);
7286 }
7287 }
7288 A.length = n;
7289 return A;
7290 }
7291});
7292
7293
7294/***/ }),
7295/* 223 */
7296/***/ (function(module, exports, __webpack_require__) {
7297
7298var arraySpeciesConstructor = __webpack_require__(388);
7299
7300// `ArraySpeciesCreate` abstract operation
7301// https://tc39.es/ecma262/#sec-arrayspeciescreate
7302module.exports = function (originalArray, length) {
7303 return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
7304};
7305
7306
7307/***/ }),
7308/* 224 */
7309/***/ (function(module, exports, __webpack_require__) {
7310
7311var $ = __webpack_require__(0);
7312var getBuiltIn = __webpack_require__(18);
7313var apply = __webpack_require__(73);
7314var call = __webpack_require__(15);
7315var uncurryThis = __webpack_require__(4);
7316var fails = __webpack_require__(2);
7317var isArray = __webpack_require__(88);
7318var isCallable = __webpack_require__(8);
7319var isObject = __webpack_require__(11);
7320var isSymbol = __webpack_require__(96);
7321var arraySlice = __webpack_require__(109);
7322var NATIVE_SYMBOL = __webpack_require__(62);
7323
7324var $stringify = getBuiltIn('JSON', 'stringify');
7325var exec = uncurryThis(/./.exec);
7326var charAt = uncurryThis(''.charAt);
7327var charCodeAt = uncurryThis(''.charCodeAt);
7328var replace = uncurryThis(''.replace);
7329var numberToString = uncurryThis(1.0.toString);
7330
7331var tester = /[\uD800-\uDFFF]/g;
7332var low = /^[\uD800-\uDBFF]$/;
7333var hi = /^[\uDC00-\uDFFF]$/;
7334
7335var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails(function () {
7336 var symbol = getBuiltIn('Symbol')();
7337 // MS Edge converts symbol values to JSON as {}
7338 return $stringify([symbol]) != '[null]'
7339 // WebKit converts symbol values to JSON as null
7340 || $stringify({ a: symbol }) != '{}'
7341 // V8 throws on boxed symbols
7342 || $stringify(Object(symbol)) != '{}';
7343});
7344
7345// https://github.com/tc39/proposal-well-formed-stringify
7346var ILL_FORMED_UNICODE = fails(function () {
7347 return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"'
7348 || $stringify('\uDEAD') !== '"\\udead"';
7349});
7350
7351var stringifyWithSymbolsFix = function (it, replacer) {
7352 var args = arraySlice(arguments);
7353 var $replacer = replacer;
7354 if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
7355 if (!isArray(replacer)) replacer = function (key, value) {
7356 if (isCallable($replacer)) value = call($replacer, this, key, value);
7357 if (!isSymbol(value)) return value;
7358 };
7359 args[1] = replacer;
7360 return apply($stringify, null, args);
7361};
7362
7363var fixIllFormed = function (match, offset, string) {
7364 var prev = charAt(string, offset - 1);
7365 var next = charAt(string, offset + 1);
7366 if ((exec(low, match) && !exec(hi, next)) || (exec(hi, match) && !exec(low, prev))) {
7367 return '\\u' + numberToString(charCodeAt(match, 0), 16);
7368 } return match;
7369};
7370
7371if ($stringify) {
7372 // `JSON.stringify` method
7373 // https://tc39.es/ecma262/#sec-json.stringify
7374 $({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {
7375 // eslint-disable-next-line no-unused-vars -- required for `.length`
7376 stringify: function stringify(it, replacer, space) {
7377 var args = arraySlice(arguments);
7378 var result = apply(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args);
7379 return ILL_FORMED_UNICODE && typeof result == 'string' ? replace(result, tester, fixIllFormed) : result;
7380 }
7381 });
7382}
7383
7384
7385/***/ }),
7386/* 225 */
7387/***/ (function(module, exports, __webpack_require__) {
7388
7389"use strict";
7390
7391var fails = __webpack_require__(2);
7392
7393module.exports = function (METHOD_NAME, argument) {
7394 var method = [][METHOD_NAME];
7395 return !!method && fails(function () {
7396 // eslint-disable-next-line no-useless-call -- required for testing
7397 method.call(null, argument || function () { return 1; }, 1);
7398 });
7399};
7400
7401
7402/***/ }),
7403/* 226 */
7404/***/ (function(module, exports, __webpack_require__) {
7405
7406var rng = __webpack_require__(405);
7407var bytesToUuid = __webpack_require__(406);
7408
7409function v4(options, buf, offset) {
7410 var i = buf && offset || 0;
7411
7412 if (typeof(options) == 'string') {
7413 buf = options === 'binary' ? new Array(16) : null;
7414 options = null;
7415 }
7416 options = options || {};
7417
7418 var rnds = options.random || (options.rng || rng)();
7419
7420 // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
7421 rnds[6] = (rnds[6] & 0x0f) | 0x40;
7422 rnds[8] = (rnds[8] & 0x3f) | 0x80;
7423
7424 // Copy bytes to buffer, if provided
7425 if (buf) {
7426 for (var ii = 0; ii < 16; ++ii) {
7427 buf[i + ii] = rnds[ii];
7428 }
7429 }
7430
7431 return buf || bytesToUuid(rnds);
7432}
7433
7434module.exports = v4;
7435
7436
7437/***/ }),
7438/* 227 */
7439/***/ (function(module, exports, __webpack_require__) {
7440
7441module.exports = __webpack_require__(228);
7442
7443/***/ }),
7444/* 228 */
7445/***/ (function(module, exports, __webpack_require__) {
7446
7447var parent = __webpack_require__(409);
7448
7449module.exports = parent;
7450
7451
7452/***/ }),
7453/* 229 */
7454/***/ (function(module, exports, __webpack_require__) {
7455
7456"use strict";
7457
7458
7459module.exports = '4.13.3';
7460
7461/***/ }),
7462/* 230 */
7463/***/ (function(module, exports, __webpack_require__) {
7464
7465"use strict";
7466
7467
7468var has = Object.prototype.hasOwnProperty
7469 , prefix = '~';
7470
7471/**
7472 * Constructor to create a storage for our `EE` objects.
7473 * An `Events` instance is a plain object whose properties are event names.
7474 *
7475 * @constructor
7476 * @api private
7477 */
7478function Events() {}
7479
7480//
7481// We try to not inherit from `Object.prototype`. In some engines creating an
7482// instance in this way is faster than calling `Object.create(null)` directly.
7483// If `Object.create(null)` is not supported we prefix the event names with a
7484// character to make sure that the built-in object properties are not
7485// overridden or used as an attack vector.
7486//
7487if (Object.create) {
7488 Events.prototype = Object.create(null);
7489
7490 //
7491 // This hack is needed because the `__proto__` property is still inherited in
7492 // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
7493 //
7494 if (!new Events().__proto__) prefix = false;
7495}
7496
7497/**
7498 * Representation of a single event listener.
7499 *
7500 * @param {Function} fn The listener function.
7501 * @param {Mixed} context The context to invoke the listener with.
7502 * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
7503 * @constructor
7504 * @api private
7505 */
7506function EE(fn, context, once) {
7507 this.fn = fn;
7508 this.context = context;
7509 this.once = once || false;
7510}
7511
7512/**
7513 * Minimal `EventEmitter` interface that is molded against the Node.js
7514 * `EventEmitter` interface.
7515 *
7516 * @constructor
7517 * @api public
7518 */
7519function EventEmitter() {
7520 this._events = new Events();
7521 this._eventsCount = 0;
7522}
7523
7524/**
7525 * Return an array listing the events for which the emitter has registered
7526 * listeners.
7527 *
7528 * @returns {Array}
7529 * @api public
7530 */
7531EventEmitter.prototype.eventNames = function eventNames() {
7532 var names = []
7533 , events
7534 , name;
7535
7536 if (this._eventsCount === 0) return names;
7537
7538 for (name in (events = this._events)) {
7539 if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
7540 }
7541
7542 if (Object.getOwnPropertySymbols) {
7543 return names.concat(Object.getOwnPropertySymbols(events));
7544 }
7545
7546 return names;
7547};
7548
7549/**
7550 * Return the listeners registered for a given event.
7551 *
7552 * @param {String|Symbol} event The event name.
7553 * @param {Boolean} exists Only check if there are listeners.
7554 * @returns {Array|Boolean}
7555 * @api public
7556 */
7557EventEmitter.prototype.listeners = function listeners(event, exists) {
7558 var evt = prefix ? prefix + event : event
7559 , available = this._events[evt];
7560
7561 if (exists) return !!available;
7562 if (!available) return [];
7563 if (available.fn) return [available.fn];
7564
7565 for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {
7566 ee[i] = available[i].fn;
7567 }
7568
7569 return ee;
7570};
7571
7572/**
7573 * Calls each of the listeners registered for a given event.
7574 *
7575 * @param {String|Symbol} event The event name.
7576 * @returns {Boolean} `true` if the event had listeners, else `false`.
7577 * @api public
7578 */
7579EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
7580 var evt = prefix ? prefix + event : event;
7581
7582 if (!this._events[evt]) return false;
7583
7584 var listeners = this._events[evt]
7585 , len = arguments.length
7586 , args
7587 , i;
7588
7589 if (listeners.fn) {
7590 if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
7591
7592 switch (len) {
7593 case 1: return listeners.fn.call(listeners.context), true;
7594 case 2: return listeners.fn.call(listeners.context, a1), true;
7595 case 3: return listeners.fn.call(listeners.context, a1, a2), true;
7596 case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
7597 case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
7598 case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
7599 }
7600
7601 for (i = 1, args = new Array(len -1); i < len; i++) {
7602 args[i - 1] = arguments[i];
7603 }
7604
7605 listeners.fn.apply(listeners.context, args);
7606 } else {
7607 var length = listeners.length
7608 , j;
7609
7610 for (i = 0; i < length; i++) {
7611 if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
7612
7613 switch (len) {
7614 case 1: listeners[i].fn.call(listeners[i].context); break;
7615 case 2: listeners[i].fn.call(listeners[i].context, a1); break;
7616 case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
7617 case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
7618 default:
7619 if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
7620 args[j - 1] = arguments[j];
7621 }
7622
7623 listeners[i].fn.apply(listeners[i].context, args);
7624 }
7625 }
7626 }
7627
7628 return true;
7629};
7630
7631/**
7632 * Add a listener for a given event.
7633 *
7634 * @param {String|Symbol} event The event name.
7635 * @param {Function} fn The listener function.
7636 * @param {Mixed} [context=this] The context to invoke the listener with.
7637 * @returns {EventEmitter} `this`.
7638 * @api public
7639 */
7640EventEmitter.prototype.on = function on(event, fn, context) {
7641 var listener = new EE(fn, context || this)
7642 , evt = prefix ? prefix + event : event;
7643
7644 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
7645 else if (!this._events[evt].fn) this._events[evt].push(listener);
7646 else this._events[evt] = [this._events[evt], listener];
7647
7648 return this;
7649};
7650
7651/**
7652 * Add a one-time listener for a given event.
7653 *
7654 * @param {String|Symbol} event The event name.
7655 * @param {Function} fn The listener function.
7656 * @param {Mixed} [context=this] The context to invoke the listener with.
7657 * @returns {EventEmitter} `this`.
7658 * @api public
7659 */
7660EventEmitter.prototype.once = function once(event, fn, context) {
7661 var listener = new EE(fn, context || this, true)
7662 , evt = prefix ? prefix + event : event;
7663
7664 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
7665 else if (!this._events[evt].fn) this._events[evt].push(listener);
7666 else this._events[evt] = [this._events[evt], listener];
7667
7668 return this;
7669};
7670
7671/**
7672 * Remove the listeners of a given event.
7673 *
7674 * @param {String|Symbol} event The event name.
7675 * @param {Function} fn Only remove the listeners that match this function.
7676 * @param {Mixed} context Only remove the listeners that have this context.
7677 * @param {Boolean} once Only remove one-time listeners.
7678 * @returns {EventEmitter} `this`.
7679 * @api public
7680 */
7681EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
7682 var evt = prefix ? prefix + event : event;
7683
7684 if (!this._events[evt]) return this;
7685 if (!fn) {
7686 if (--this._eventsCount === 0) this._events = new Events();
7687 else delete this._events[evt];
7688 return this;
7689 }
7690
7691 var listeners = this._events[evt];
7692
7693 if (listeners.fn) {
7694 if (
7695 listeners.fn === fn
7696 && (!once || listeners.once)
7697 && (!context || listeners.context === context)
7698 ) {
7699 if (--this._eventsCount === 0) this._events = new Events();
7700 else delete this._events[evt];
7701 }
7702 } else {
7703 for (var i = 0, events = [], length = listeners.length; i < length; i++) {
7704 if (
7705 listeners[i].fn !== fn
7706 || (once && !listeners[i].once)
7707 || (context && listeners[i].context !== context)
7708 ) {
7709 events.push(listeners[i]);
7710 }
7711 }
7712
7713 //
7714 // Reset the array, or remove it completely if we have no more listeners.
7715 //
7716 if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
7717 else if (--this._eventsCount === 0) this._events = new Events();
7718 else delete this._events[evt];
7719 }
7720
7721 return this;
7722};
7723
7724/**
7725 * Remove all listeners, or those of the specified event.
7726 *
7727 * @param {String|Symbol} [event] The event name.
7728 * @returns {EventEmitter} `this`.
7729 * @api public
7730 */
7731EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
7732 var evt;
7733
7734 if (event) {
7735 evt = prefix ? prefix + event : event;
7736 if (this._events[evt]) {
7737 if (--this._eventsCount === 0) this._events = new Events();
7738 else delete this._events[evt];
7739 }
7740 } else {
7741 this._events = new Events();
7742 this._eventsCount = 0;
7743 }
7744
7745 return this;
7746};
7747
7748//
7749// Alias methods names because people roll like that.
7750//
7751EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
7752EventEmitter.prototype.addListener = EventEmitter.prototype.on;
7753
7754//
7755// This function doesn't apply anymore.
7756//
7757EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
7758 return this;
7759};
7760
7761//
7762// Expose the prefix.
7763//
7764EventEmitter.prefixed = prefix;
7765
7766//
7767// Allow `EventEmitter` to be imported as module namespace.
7768//
7769EventEmitter.EventEmitter = EventEmitter;
7770
7771//
7772// Expose the module.
7773//
7774if (true) {
7775 module.exports = EventEmitter;
7776}
7777
7778
7779/***/ }),
7780/* 231 */
7781/***/ (function(module, exports, __webpack_require__) {
7782
7783"use strict";
7784
7785
7786var _interopRequireDefault = __webpack_require__(1);
7787
7788var _promise = _interopRequireDefault(__webpack_require__(13));
7789
7790var _require = __webpack_require__(71),
7791 getAdapter = _require.getAdapter;
7792
7793var syncApiNames = ['getItem', 'setItem', 'removeItem', 'clear'];
7794var localStorage = {
7795 get async() {
7796 return getAdapter('storage').async;
7797 }
7798
7799}; // wrap sync apis with async ones.
7800
7801syncApiNames.forEach(function (apiName) {
7802 localStorage[apiName + 'Async'] = function () {
7803 var storage = getAdapter('storage');
7804 return _promise.default.resolve(storage[apiName].apply(storage, arguments));
7805 };
7806
7807 localStorage[apiName] = function () {
7808 var storage = getAdapter('storage');
7809
7810 if (!storage.async) {
7811 return storage[apiName].apply(storage, arguments);
7812 }
7813
7814 var error = new Error('Synchronous API [' + apiName + '] is not available in this runtime.');
7815 error.code = 'SYNC_API_NOT_AVAILABLE';
7816 throw error;
7817 };
7818});
7819module.exports = localStorage;
7820
7821/***/ }),
7822/* 232 */
7823/***/ (function(module, exports, __webpack_require__) {
7824
7825"use strict";
7826
7827
7828var _interopRequireDefault = __webpack_require__(1);
7829
7830var _concat = _interopRequireDefault(__webpack_require__(22));
7831
7832var _stringify = _interopRequireDefault(__webpack_require__(36));
7833
7834var storage = __webpack_require__(231);
7835
7836var AV = __webpack_require__(69);
7837
7838var removeAsync = exports.removeAsync = storage.removeItemAsync.bind(storage);
7839
7840var getCacheData = function getCacheData(cacheData, key) {
7841 try {
7842 cacheData = JSON.parse(cacheData);
7843 } catch (e) {
7844 return null;
7845 }
7846
7847 if (cacheData) {
7848 var expired = cacheData.expiredAt && cacheData.expiredAt < Date.now();
7849
7850 if (!expired) {
7851 return cacheData.value;
7852 }
7853
7854 return removeAsync(key).then(function () {
7855 return null;
7856 });
7857 }
7858
7859 return null;
7860};
7861
7862exports.getAsync = function (key) {
7863 var _context;
7864
7865 key = (0, _concat.default)(_context = "AV/".concat(AV.applicationId, "/")).call(_context, key);
7866 return storage.getItemAsync(key).then(function (cache) {
7867 return getCacheData(cache, key);
7868 });
7869};
7870
7871exports.setAsync = function (key, value, ttl) {
7872 var _context2;
7873
7874 var cache = {
7875 value: value
7876 };
7877
7878 if (typeof ttl === 'number') {
7879 cache.expiredAt = Date.now() + ttl;
7880 }
7881
7882 return storage.setItemAsync((0, _concat.default)(_context2 = "AV/".concat(AV.applicationId, "/")).call(_context2, key), (0, _stringify.default)(cache));
7883};
7884
7885/***/ }),
7886/* 233 */
7887/***/ (function(module, exports, __webpack_require__) {
7888
7889var parent = __webpack_require__(412);
7890
7891module.exports = parent;
7892
7893
7894/***/ }),
7895/* 234 */
7896/***/ (function(module, exports, __webpack_require__) {
7897
7898var parent = __webpack_require__(415);
7899
7900module.exports = parent;
7901
7902
7903/***/ }),
7904/* 235 */
7905/***/ (function(module, exports, __webpack_require__) {
7906
7907var parent = __webpack_require__(418);
7908
7909module.exports = parent;
7910
7911
7912/***/ }),
7913/* 236 */
7914/***/ (function(module, exports, __webpack_require__) {
7915
7916module.exports = __webpack_require__(421);
7917
7918/***/ }),
7919/* 237 */
7920/***/ (function(module, exports, __webpack_require__) {
7921
7922var parent = __webpack_require__(424);
7923__webpack_require__(44);
7924
7925module.exports = parent;
7926
7927
7928/***/ }),
7929/* 238 */
7930/***/ (function(module, exports, __webpack_require__) {
7931
7932// TODO: Remove this module from `core-js@4` since it's split to modules listed below
7933__webpack_require__(425);
7934__webpack_require__(427);
7935__webpack_require__(428);
7936__webpack_require__(224);
7937__webpack_require__(429);
7938
7939
7940/***/ }),
7941/* 239 */
7942/***/ (function(module, exports, __webpack_require__) {
7943
7944/* eslint-disable es-x/no-object-getownpropertynames -- safe */
7945var classof = __webpack_require__(61);
7946var toIndexedObject = __webpack_require__(32);
7947var $getOwnPropertyNames = __webpack_require__(102).f;
7948var arraySlice = __webpack_require__(426);
7949
7950var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
7951 ? Object.getOwnPropertyNames(window) : [];
7952
7953var getWindowNames = function (it) {
7954 try {
7955 return $getOwnPropertyNames(it);
7956 } catch (error) {
7957 return arraySlice(windowNames);
7958 }
7959};
7960
7961// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
7962module.exports.f = function getOwnPropertyNames(it) {
7963 return windowNames && classof(it) == 'Window'
7964 ? getWindowNames(it)
7965 : $getOwnPropertyNames(toIndexedObject(it));
7966};
7967
7968
7969/***/ }),
7970/* 240 */
7971/***/ (function(module, exports, __webpack_require__) {
7972
7973var call = __webpack_require__(15);
7974var getBuiltIn = __webpack_require__(18);
7975var wellKnownSymbol = __webpack_require__(9);
7976var defineBuiltIn = __webpack_require__(43);
7977
7978module.exports = function () {
7979 var Symbol = getBuiltIn('Symbol');
7980 var SymbolPrototype = Symbol && Symbol.prototype;
7981 var valueOf = SymbolPrototype && SymbolPrototype.valueOf;
7982 var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
7983
7984 if (SymbolPrototype && !SymbolPrototype[TO_PRIMITIVE]) {
7985 // `Symbol.prototype[@@toPrimitive]` method
7986 // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
7987 // eslint-disable-next-line no-unused-vars -- required for .length
7988 defineBuiltIn(SymbolPrototype, TO_PRIMITIVE, function (hint) {
7989 return call(valueOf, this);
7990 }, { arity: 1 });
7991 }
7992};
7993
7994
7995/***/ }),
7996/* 241 */
7997/***/ (function(module, exports, __webpack_require__) {
7998
7999var NATIVE_SYMBOL = __webpack_require__(62);
8000
8001/* eslint-disable es-x/no-symbol -- safe */
8002module.exports = NATIVE_SYMBOL && !!Symbol['for'] && !!Symbol.keyFor;
8003
8004
8005/***/ }),
8006/* 242 */
8007/***/ (function(module, exports, __webpack_require__) {
8008
8009var defineWellKnownSymbol = __webpack_require__(10);
8010
8011// `Symbol.iterator` well-known symbol
8012// https://tc39.es/ecma262/#sec-symbol.iterator
8013defineWellKnownSymbol('iterator');
8014
8015
8016/***/ }),
8017/* 243 */
8018/***/ (function(module, exports, __webpack_require__) {
8019
8020module.exports = __webpack_require__(460);
8021
8022/***/ }),
8023/* 244 */
8024/***/ (function(module, exports, __webpack_require__) {
8025
8026"use strict";
8027// Copyright (c) 2015-2017 David M. Lee, II
8028
8029
8030/**
8031 * Local reference to TimeoutError
8032 * @private
8033 */
8034var TimeoutError;
8035
8036/**
8037 * Rejects a promise with a {@link TimeoutError} if it does not settle within
8038 * the specified timeout.
8039 *
8040 * @param {Promise} promise The promise.
8041 * @param {number} timeoutMillis Number of milliseconds to wait on settling.
8042 * @returns {Promise} Either resolves/rejects with `promise`, or rejects with
8043 * `TimeoutError`, whichever settles first.
8044 */
8045var timeout = module.exports.timeout = function(promise, timeoutMillis) {
8046 var error = new TimeoutError(),
8047 timeout;
8048
8049 return Promise.race([
8050 promise,
8051 new Promise(function(resolve, reject) {
8052 timeout = setTimeout(function() {
8053 reject(error);
8054 }, timeoutMillis);
8055 }),
8056 ]).then(function(v) {
8057 clearTimeout(timeout);
8058 return v;
8059 }, function(err) {
8060 clearTimeout(timeout);
8061 throw err;
8062 });
8063};
8064
8065/**
8066 * Exception indicating that the timeout expired.
8067 */
8068TimeoutError = module.exports.TimeoutError = function() {
8069 Error.call(this)
8070 this.stack = Error().stack
8071 this.message = 'Timeout';
8072};
8073
8074TimeoutError.prototype = Object.create(Error.prototype);
8075TimeoutError.prototype.name = "TimeoutError";
8076
8077
8078/***/ }),
8079/* 245 */
8080/***/ (function(module, exports, __webpack_require__) {
8081
8082module.exports = __webpack_require__(246);
8083
8084/***/ }),
8085/* 246 */
8086/***/ (function(module, exports, __webpack_require__) {
8087
8088var parent = __webpack_require__(476);
8089
8090module.exports = parent;
8091
8092
8093/***/ }),
8094/* 247 */
8095/***/ (function(module, exports, __webpack_require__) {
8096
8097module.exports = __webpack_require__(237);
8098
8099/***/ }),
8100/* 248 */
8101/***/ (function(module, exports, __webpack_require__) {
8102
8103module.exports = __webpack_require__(480);
8104
8105/***/ }),
8106/* 249 */
8107/***/ (function(module, exports, __webpack_require__) {
8108
8109"use strict";
8110
8111var uncurryThis = __webpack_require__(4);
8112var aCallable = __webpack_require__(31);
8113var isObject = __webpack_require__(11);
8114var hasOwn = __webpack_require__(12);
8115var arraySlice = __webpack_require__(109);
8116var NATIVE_BIND = __webpack_require__(74);
8117
8118var $Function = Function;
8119var concat = uncurryThis([].concat);
8120var join = uncurryThis([].join);
8121var factories = {};
8122
8123var construct = function (C, argsLength, args) {
8124 if (!hasOwn(factories, argsLength)) {
8125 for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']';
8126 factories[argsLength] = $Function('C,a', 'return new C(' + join(list, ',') + ')');
8127 } return factories[argsLength](C, args);
8128};
8129
8130// `Function.prototype.bind` method implementation
8131// https://tc39.es/ecma262/#sec-function.prototype.bind
8132module.exports = NATIVE_BIND ? $Function.bind : function bind(that /* , ...args */) {
8133 var F = aCallable(this);
8134 var Prototype = F.prototype;
8135 var partArgs = arraySlice(arguments, 1);
8136 var boundFunction = function bound(/* args... */) {
8137 var args = concat(partArgs, arraySlice(arguments));
8138 return this instanceof boundFunction ? construct(F, args.length, args) : F.apply(that, args);
8139 };
8140 if (isObject(Prototype)) boundFunction.prototype = Prototype;
8141 return boundFunction;
8142};
8143
8144
8145/***/ }),
8146/* 250 */
8147/***/ (function(module, exports, __webpack_require__) {
8148
8149module.exports = __webpack_require__(501);
8150
8151/***/ }),
8152/* 251 */
8153/***/ (function(module, exports, __webpack_require__) {
8154
8155module.exports = __webpack_require__(504);
8156
8157/***/ }),
8158/* 252 */
8159/***/ (function(module, exports) {
8160
8161var charenc = {
8162 // UTF-8 encoding
8163 utf8: {
8164 // Convert a string to a byte array
8165 stringToBytes: function(str) {
8166 return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
8167 },
8168
8169 // Convert a byte array to a string
8170 bytesToString: function(bytes) {
8171 return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
8172 }
8173 },
8174
8175 // Binary encoding
8176 bin: {
8177 // Convert a string to a byte array
8178 stringToBytes: function(str) {
8179 for (var bytes = [], i = 0; i < str.length; i++)
8180 bytes.push(str.charCodeAt(i) & 0xFF);
8181 return bytes;
8182 },
8183
8184 // Convert a byte array to a string
8185 bytesToString: function(bytes) {
8186 for (var str = [], i = 0; i < bytes.length; i++)
8187 str.push(String.fromCharCode(bytes[i]));
8188 return str.join('');
8189 }
8190 }
8191};
8192
8193module.exports = charenc;
8194
8195
8196/***/ }),
8197/* 253 */
8198/***/ (function(module, exports, __webpack_require__) {
8199
8200module.exports = __webpack_require__(548);
8201
8202/***/ }),
8203/* 254 */
8204/***/ (function(module, exports, __webpack_require__) {
8205
8206var fails = __webpack_require__(2);
8207
8208module.exports = !fails(function () {
8209 // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-preventextensions -- required for testing
8210 return Object.isExtensible(Object.preventExtensions({}));
8211});
8212
8213
8214/***/ }),
8215/* 255 */
8216/***/ (function(module, exports, __webpack_require__) {
8217
8218var fails = __webpack_require__(2);
8219var isObject = __webpack_require__(11);
8220var classof = __webpack_require__(61);
8221var ARRAY_BUFFER_NON_EXTENSIBLE = __webpack_require__(571);
8222
8223// eslint-disable-next-line es-x/no-object-isextensible -- safe
8224var $isExtensible = Object.isExtensible;
8225var FAILS_ON_PRIMITIVES = fails(function () { $isExtensible(1); });
8226
8227// `Object.isExtensible` method
8228// https://tc39.es/ecma262/#sec-object.isextensible
8229module.exports = (FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE) ? function isExtensible(it) {
8230 if (!isObject(it)) return false;
8231 if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return false;
8232 return $isExtensible ? $isExtensible(it) : true;
8233} : $isExtensible;
8234
8235
8236/***/ }),
8237/* 256 */
8238/***/ (function(module, exports, __webpack_require__) {
8239
8240module.exports = __webpack_require__(572);
8241
8242/***/ }),
8243/* 257 */
8244/***/ (function(module, exports, __webpack_require__) {
8245
8246module.exports = __webpack_require__(576);
8247
8248/***/ }),
8249/* 258 */
8250/***/ (function(module, exports, __webpack_require__) {
8251
8252"use strict";
8253
8254var $ = __webpack_require__(0);
8255var global = __webpack_require__(7);
8256var InternalMetadataModule = __webpack_require__(93);
8257var fails = __webpack_require__(2);
8258var createNonEnumerableProperty = __webpack_require__(37);
8259var iterate = __webpack_require__(40);
8260var anInstance = __webpack_require__(107);
8261var isCallable = __webpack_require__(8);
8262var isObject = __webpack_require__(11);
8263var setToStringTag = __webpack_require__(52);
8264var defineProperty = __webpack_require__(23).f;
8265var forEach = __webpack_require__(70).forEach;
8266var DESCRIPTORS = __webpack_require__(14);
8267var InternalStateModule = __webpack_require__(42);
8268
8269var setInternalState = InternalStateModule.set;
8270var internalStateGetterFor = InternalStateModule.getterFor;
8271
8272module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
8273 var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
8274 var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
8275 var ADDER = IS_MAP ? 'set' : 'add';
8276 var NativeConstructor = global[CONSTRUCTOR_NAME];
8277 var NativePrototype = NativeConstructor && NativeConstructor.prototype;
8278 var exported = {};
8279 var Constructor;
8280
8281 if (!DESCRIPTORS || !isCallable(NativeConstructor)
8282 || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); }))
8283 ) {
8284 // create collection constructor
8285 Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
8286 InternalMetadataModule.enable();
8287 } else {
8288 Constructor = wrapper(function (target, iterable) {
8289 setInternalState(anInstance(target, Prototype), {
8290 type: CONSTRUCTOR_NAME,
8291 collection: new NativeConstructor()
8292 });
8293 if (iterable != undefined) iterate(iterable, target[ADDER], { that: target, AS_ENTRIES: IS_MAP });
8294 });
8295
8296 var Prototype = Constructor.prototype;
8297
8298 var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
8299
8300 forEach(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) {
8301 var IS_ADDER = KEY == 'add' || KEY == 'set';
8302 if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) {
8303 createNonEnumerableProperty(Prototype, KEY, function (a, b) {
8304 var collection = getInternalState(this).collection;
8305 if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;
8306 var result = collection[KEY](a === 0 ? 0 : a, b);
8307 return IS_ADDER ? this : result;
8308 });
8309 }
8310 });
8311
8312 IS_WEAK || defineProperty(Prototype, 'size', {
8313 configurable: true,
8314 get: function () {
8315 return getInternalState(this).collection.size;
8316 }
8317 });
8318 }
8319
8320 setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true);
8321
8322 exported[CONSTRUCTOR_NAME] = Constructor;
8323 $({ global: true, forced: true }, exported);
8324
8325 if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
8326
8327 return Constructor;
8328};
8329
8330
8331/***/ }),
8332/* 259 */
8333/***/ (function(module, exports, __webpack_require__) {
8334
8335module.exports = __webpack_require__(598);
8336
8337/***/ }),
8338/* 260 */
8339/***/ (function(module, exports) {
8340
8341function _arrayLikeToArray(arr, len) {
8342 if (len == null || len > arr.length) len = arr.length;
8343
8344 for (var i = 0, arr2 = new Array(len); i < len; i++) {
8345 arr2[i] = arr[i];
8346 }
8347
8348 return arr2;
8349}
8350
8351module.exports = _arrayLikeToArray;
8352
8353/***/ }),
8354/* 261 */
8355/***/ (function(module, exports) {
8356
8357function _iterableToArray(iter) {
8358 if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
8359}
8360
8361module.exports = _iterableToArray;
8362
8363/***/ }),
8364/* 262 */
8365/***/ (function(module, exports, __webpack_require__) {
8366
8367var arrayLikeToArray = __webpack_require__(260);
8368
8369function _unsupportedIterableToArray(o, minLen) {
8370 if (!o) return;
8371 if (typeof o === "string") return arrayLikeToArray(o, minLen);
8372 var n = Object.prototype.toString.call(o).slice(8, -1);
8373 if (n === "Object" && o.constructor) n = o.constructor.name;
8374 if (n === "Map" || n === "Set") return Array.from(o);
8375 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
8376}
8377
8378module.exports = _unsupportedIterableToArray;
8379
8380/***/ }),
8381/* 263 */
8382/***/ (function(module, exports, __webpack_require__) {
8383
8384var baseRandom = __webpack_require__(622);
8385
8386/**
8387 * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
8388 *
8389 * @private
8390 * @param {Array} array The array to shuffle.
8391 * @param {number} [size=array.length] The size of `array`.
8392 * @returns {Array} Returns `array`.
8393 */
8394function shuffleSelf(array, size) {
8395 var index = -1,
8396 length = array.length,
8397 lastIndex = length - 1;
8398
8399 size = size === undefined ? length : size;
8400 while (++index < size) {
8401 var rand = baseRandom(index, lastIndex),
8402 value = array[rand];
8403
8404 array[rand] = array[index];
8405 array[index] = value;
8406 }
8407 array.length = size;
8408 return array;
8409}
8410
8411module.exports = shuffleSelf;
8412
8413
8414/***/ }),
8415/* 264 */
8416/***/ (function(module, exports, __webpack_require__) {
8417
8418var baseValues = __webpack_require__(624),
8419 keys = __webpack_require__(626);
8420
8421/**
8422 * Creates an array of the own enumerable string keyed property values of `object`.
8423 *
8424 * **Note:** Non-object values are coerced to objects.
8425 *
8426 * @static
8427 * @since 0.1.0
8428 * @memberOf _
8429 * @category Object
8430 * @param {Object} object The object to query.
8431 * @returns {Array} Returns the array of property values.
8432 * @example
8433 *
8434 * function Foo() {
8435 * this.a = 1;
8436 * this.b = 2;
8437 * }
8438 *
8439 * Foo.prototype.c = 3;
8440 *
8441 * _.values(new Foo);
8442 * // => [1, 2] (iteration order is not guaranteed)
8443 *
8444 * _.values('hi');
8445 * // => ['h', 'i']
8446 */
8447function values(object) {
8448 return object == null ? [] : baseValues(object, keys(object));
8449}
8450
8451module.exports = values;
8452
8453
8454/***/ }),
8455/* 265 */
8456/***/ (function(module, exports, __webpack_require__) {
8457
8458var root = __webpack_require__(266);
8459
8460/** Built-in value references. */
8461var Symbol = root.Symbol;
8462
8463module.exports = Symbol;
8464
8465
8466/***/ }),
8467/* 266 */
8468/***/ (function(module, exports, __webpack_require__) {
8469
8470var freeGlobal = __webpack_require__(267);
8471
8472/** Detect free variable `self`. */
8473var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
8474
8475/** Used as a reference to the global object. */
8476var root = freeGlobal || freeSelf || Function('return this')();
8477
8478module.exports = root;
8479
8480
8481/***/ }),
8482/* 267 */
8483/***/ (function(module, exports, __webpack_require__) {
8484
8485/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
8486var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
8487
8488module.exports = freeGlobal;
8489
8490/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(72)))
8491
8492/***/ }),
8493/* 268 */
8494/***/ (function(module, exports) {
8495
8496/**
8497 * Checks if `value` is classified as an `Array` object.
8498 *
8499 * @static
8500 * @memberOf _
8501 * @since 0.1.0
8502 * @category Lang
8503 * @param {*} value The value to check.
8504 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
8505 * @example
8506 *
8507 * _.isArray([1, 2, 3]);
8508 * // => true
8509 *
8510 * _.isArray(document.body.children);
8511 * // => false
8512 *
8513 * _.isArray('abc');
8514 * // => false
8515 *
8516 * _.isArray(_.noop);
8517 * // => false
8518 */
8519var isArray = Array.isArray;
8520
8521module.exports = isArray;
8522
8523
8524/***/ }),
8525/* 269 */
8526/***/ (function(module, exports) {
8527
8528module.exports = function(module) {
8529 if(!module.webpackPolyfill) {
8530 module.deprecate = function() {};
8531 module.paths = [];
8532 // module.parent = undefined by default
8533 if(!module.children) module.children = [];
8534 Object.defineProperty(module, "loaded", {
8535 enumerable: true,
8536 get: function() {
8537 return module.l;
8538 }
8539 });
8540 Object.defineProperty(module, "id", {
8541 enumerable: true,
8542 get: function() {
8543 return module.i;
8544 }
8545 });
8546 module.webpackPolyfill = 1;
8547 }
8548 return module;
8549};
8550
8551
8552/***/ }),
8553/* 270 */
8554/***/ (function(module, exports) {
8555
8556/** Used as references for various `Number` constants. */
8557var MAX_SAFE_INTEGER = 9007199254740991;
8558
8559/**
8560 * Checks if `value` is a valid array-like length.
8561 *
8562 * **Note:** This method is loosely based on
8563 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
8564 *
8565 * @static
8566 * @memberOf _
8567 * @since 4.0.0
8568 * @category Lang
8569 * @param {*} value The value to check.
8570 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
8571 * @example
8572 *
8573 * _.isLength(3);
8574 * // => true
8575 *
8576 * _.isLength(Number.MIN_VALUE);
8577 * // => false
8578 *
8579 * _.isLength(Infinity);
8580 * // => false
8581 *
8582 * _.isLength('3');
8583 * // => false
8584 */
8585function isLength(value) {
8586 return typeof value == 'number' &&
8587 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
8588}
8589
8590module.exports = isLength;
8591
8592
8593/***/ }),
8594/* 271 */
8595/***/ (function(module, exports) {
8596
8597/**
8598 * Creates a unary function that invokes `func` with its argument transformed.
8599 *
8600 * @private
8601 * @param {Function} func The function to wrap.
8602 * @param {Function} transform The argument transform.
8603 * @returns {Function} Returns the new function.
8604 */
8605function overArg(func, transform) {
8606 return function(arg) {
8607 return func(transform(arg));
8608 };
8609}
8610
8611module.exports = overArg;
8612
8613
8614/***/ }),
8615/* 272 */
8616/***/ (function(module, exports, __webpack_require__) {
8617
8618"use strict";
8619
8620
8621var AV = __webpack_require__(273);
8622
8623var useLiveQuery = __webpack_require__(565);
8624
8625module.exports = useLiveQuery(AV);
8626
8627/***/ }),
8628/* 273 */
8629/***/ (function(module, exports, __webpack_require__) {
8630
8631"use strict";
8632
8633
8634module.exports = __webpack_require__(274);
8635
8636/***/ }),
8637/* 274 */
8638/***/ (function(module, exports, __webpack_require__) {
8639
8640"use strict";
8641
8642
8643var _interopRequireDefault = __webpack_require__(1);
8644
8645var _promise = _interopRequireDefault(__webpack_require__(13));
8646
8647/*!
8648 * LeanCloud JavaScript SDK
8649 * https://leancloud.cn
8650 *
8651 * Copyright 2016 LeanCloud.cn, Inc.
8652 * The LeanCloud JavaScript SDK is freely distributable under the MIT license.
8653 */
8654var _ = __webpack_require__(3);
8655
8656var AV = __webpack_require__(69);
8657
8658AV._ = _;
8659AV.version = __webpack_require__(229);
8660AV.Promise = _promise.default;
8661AV.localStorage = __webpack_require__(231);
8662AV.Cache = __webpack_require__(232);
8663AV.Error = __webpack_require__(46);
8664
8665__webpack_require__(414);
8666
8667__webpack_require__(464)(AV);
8668
8669__webpack_require__(465)(AV);
8670
8671__webpack_require__(466)(AV);
8672
8673__webpack_require__(467)(AV);
8674
8675__webpack_require__(472)(AV);
8676
8677__webpack_require__(473)(AV);
8678
8679__webpack_require__(526)(AV);
8680
8681__webpack_require__(551)(AV);
8682
8683__webpack_require__(552)(AV);
8684
8685__webpack_require__(554)(AV);
8686
8687__webpack_require__(555)(AV);
8688
8689__webpack_require__(556)(AV);
8690
8691__webpack_require__(557)(AV);
8692
8693__webpack_require__(558)(AV);
8694
8695__webpack_require__(559)(AV);
8696
8697__webpack_require__(560)(AV);
8698
8699__webpack_require__(561)(AV);
8700
8701__webpack_require__(562)(AV);
8702
8703AV.Conversation = __webpack_require__(563);
8704
8705__webpack_require__(564);
8706
8707module.exports = AV;
8708/**
8709 * Options to controll the authentication for an operation
8710 * @typedef {Object} AuthOptions
8711 * @property {String} [sessionToken] Specify a user to excute the operation as.
8712 * @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.
8713 * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
8714 */
8715
8716/**
8717 * Options to controll the authentication for an SMS operation
8718 * @typedef {Object} SMSAuthOptions
8719 * @property {String} [sessionToken] Specify a user to excute the operation as.
8720 * @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.
8721 * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
8722 * @property {String} [validateToken] a validate token returned by {@link AV.Cloud.verifyCaptcha}
8723 */
8724
8725/***/ }),
8726/* 275 */
8727/***/ (function(module, exports, __webpack_require__) {
8728
8729var parent = __webpack_require__(276);
8730__webpack_require__(44);
8731
8732module.exports = parent;
8733
8734
8735/***/ }),
8736/* 276 */
8737/***/ (function(module, exports, __webpack_require__) {
8738
8739__webpack_require__(277);
8740__webpack_require__(41);
8741__webpack_require__(63);
8742__webpack_require__(293);
8743__webpack_require__(307);
8744__webpack_require__(308);
8745__webpack_require__(309);
8746__webpack_require__(65);
8747var path = __webpack_require__(6);
8748
8749module.exports = path.Promise;
8750
8751
8752/***/ }),
8753/* 277 */
8754/***/ (function(module, exports, __webpack_require__) {
8755
8756// TODO: Remove this module from `core-js@4` since it's replaced to module below
8757__webpack_require__(278);
8758
8759
8760/***/ }),
8761/* 278 */
8762/***/ (function(module, exports, __webpack_require__) {
8763
8764"use strict";
8765
8766var $ = __webpack_require__(0);
8767var isPrototypeOf = __webpack_require__(19);
8768var getPrototypeOf = __webpack_require__(99);
8769var setPrototypeOf = __webpack_require__(101);
8770var copyConstructorProperties = __webpack_require__(283);
8771var create = __webpack_require__(49);
8772var createNonEnumerableProperty = __webpack_require__(37);
8773var createPropertyDescriptor = __webpack_require__(47);
8774var clearErrorStack = __webpack_require__(286);
8775var installErrorCause = __webpack_require__(287);
8776var iterate = __webpack_require__(40);
8777var normalizeStringArgument = __webpack_require__(288);
8778var wellKnownSymbol = __webpack_require__(9);
8779var ERROR_STACK_INSTALLABLE = __webpack_require__(289);
8780
8781var TO_STRING_TAG = wellKnownSymbol('toStringTag');
8782var $Error = Error;
8783var push = [].push;
8784
8785var $AggregateError = function AggregateError(errors, message /* , options */) {
8786 var options = arguments.length > 2 ? arguments[2] : undefined;
8787 var isInstance = isPrototypeOf(AggregateErrorPrototype, this);
8788 var that;
8789 if (setPrototypeOf) {
8790 that = setPrototypeOf(new $Error(), isInstance ? getPrototypeOf(this) : AggregateErrorPrototype);
8791 } else {
8792 that = isInstance ? this : create(AggregateErrorPrototype);
8793 createNonEnumerableProperty(that, TO_STRING_TAG, 'Error');
8794 }
8795 if (message !== undefined) createNonEnumerableProperty(that, 'message', normalizeStringArgument(message));
8796 if (ERROR_STACK_INSTALLABLE) createNonEnumerableProperty(that, 'stack', clearErrorStack(that.stack, 1));
8797 installErrorCause(that, options);
8798 var errorsArray = [];
8799 iterate(errors, push, { that: errorsArray });
8800 createNonEnumerableProperty(that, 'errors', errorsArray);
8801 return that;
8802};
8803
8804if (setPrototypeOf) setPrototypeOf($AggregateError, $Error);
8805else copyConstructorProperties($AggregateError, $Error, { name: true });
8806
8807var AggregateErrorPrototype = $AggregateError.prototype = create($Error.prototype, {
8808 constructor: createPropertyDescriptor(1, $AggregateError),
8809 message: createPropertyDescriptor(1, ''),
8810 name: createPropertyDescriptor(1, 'AggregateError')
8811});
8812
8813// `AggregateError` constructor
8814// https://tc39.es/ecma262/#sec-aggregate-error-constructor
8815$({ global: true, constructor: true, arity: 2 }, {
8816 AggregateError: $AggregateError
8817});
8818
8819
8820/***/ }),
8821/* 279 */
8822/***/ (function(module, exports, __webpack_require__) {
8823
8824var call = __webpack_require__(15);
8825var isObject = __webpack_require__(11);
8826var isSymbol = __webpack_require__(96);
8827var getMethod = __webpack_require__(121);
8828var ordinaryToPrimitive = __webpack_require__(280);
8829var wellKnownSymbol = __webpack_require__(9);
8830
8831var $TypeError = TypeError;
8832var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
8833
8834// `ToPrimitive` abstract operation
8835// https://tc39.es/ecma262/#sec-toprimitive
8836module.exports = function (input, pref) {
8837 if (!isObject(input) || isSymbol(input)) return input;
8838 var exoticToPrim = getMethod(input, TO_PRIMITIVE);
8839 var result;
8840 if (exoticToPrim) {
8841 if (pref === undefined) pref = 'default';
8842 result = call(exoticToPrim, input, pref);
8843 if (!isObject(result) || isSymbol(result)) return result;
8844 throw $TypeError("Can't convert object to primitive value");
8845 }
8846 if (pref === undefined) pref = 'number';
8847 return ordinaryToPrimitive(input, pref);
8848};
8849
8850
8851/***/ }),
8852/* 280 */
8853/***/ (function(module, exports, __webpack_require__) {
8854
8855var call = __webpack_require__(15);
8856var isCallable = __webpack_require__(8);
8857var isObject = __webpack_require__(11);
8858
8859var $TypeError = TypeError;
8860
8861// `OrdinaryToPrimitive` abstract operation
8862// https://tc39.es/ecma262/#sec-ordinarytoprimitive
8863module.exports = function (input, pref) {
8864 var fn, val;
8865 if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
8866 if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
8867 if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
8868 throw $TypeError("Can't convert object to primitive value");
8869};
8870
8871
8872/***/ }),
8873/* 281 */
8874/***/ (function(module, exports, __webpack_require__) {
8875
8876var global = __webpack_require__(7);
8877
8878// eslint-disable-next-line es-x/no-object-defineproperty -- safe
8879var defineProperty = Object.defineProperty;
8880
8881module.exports = function (key, value) {
8882 try {
8883 defineProperty(global, key, { value: value, configurable: true, writable: true });
8884 } catch (error) {
8885 global[key] = value;
8886 } return value;
8887};
8888
8889
8890/***/ }),
8891/* 282 */
8892/***/ (function(module, exports, __webpack_require__) {
8893
8894var isCallable = __webpack_require__(8);
8895
8896var $String = String;
8897var $TypeError = TypeError;
8898
8899module.exports = function (argument) {
8900 if (typeof argument == 'object' || isCallable(argument)) return argument;
8901 throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
8902};
8903
8904
8905/***/ }),
8906/* 283 */
8907/***/ (function(module, exports, __webpack_require__) {
8908
8909var hasOwn = __webpack_require__(12);
8910var ownKeys = __webpack_require__(156);
8911var getOwnPropertyDescriptorModule = __webpack_require__(60);
8912var definePropertyModule = __webpack_require__(23);
8913
8914module.exports = function (target, source, exceptions) {
8915 var keys = ownKeys(source);
8916 var defineProperty = definePropertyModule.f;
8917 var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
8918 for (var i = 0; i < keys.length; i++) {
8919 var key = keys[i];
8920 if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
8921 defineProperty(target, key, getOwnPropertyDescriptor(source, key));
8922 }
8923 }
8924};
8925
8926
8927/***/ }),
8928/* 284 */
8929/***/ (function(module, exports) {
8930
8931var ceil = Math.ceil;
8932var floor = Math.floor;
8933
8934// `Math.trunc` method
8935// https://tc39.es/ecma262/#sec-math.trunc
8936// eslint-disable-next-line es-x/no-math-trunc -- safe
8937module.exports = Math.trunc || function trunc(x) {
8938 var n = +x;
8939 return (n > 0 ? floor : ceil)(n);
8940};
8941
8942
8943/***/ }),
8944/* 285 */
8945/***/ (function(module, exports, __webpack_require__) {
8946
8947var toIntegerOrInfinity = __webpack_require__(125);
8948
8949var min = Math.min;
8950
8951// `ToLength` abstract operation
8952// https://tc39.es/ecma262/#sec-tolength
8953module.exports = function (argument) {
8954 return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
8955};
8956
8957
8958/***/ }),
8959/* 286 */
8960/***/ (function(module, exports, __webpack_require__) {
8961
8962var uncurryThis = __webpack_require__(4);
8963
8964var $Error = Error;
8965var replace = uncurryThis(''.replace);
8966
8967var TEST = (function (arg) { return String($Error(arg).stack); })('zxcasd');
8968var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
8969var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
8970
8971module.exports = function (stack, dropEntries) {
8972 if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {
8973 while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');
8974 } return stack;
8975};
8976
8977
8978/***/ }),
8979/* 287 */
8980/***/ (function(module, exports, __webpack_require__) {
8981
8982var isObject = __webpack_require__(11);
8983var createNonEnumerableProperty = __webpack_require__(37);
8984
8985// `InstallErrorCause` abstract operation
8986// https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause
8987module.exports = function (O, options) {
8988 if (isObject(options) && 'cause' in options) {
8989 createNonEnumerableProperty(O, 'cause', options.cause);
8990 }
8991};
8992
8993
8994/***/ }),
8995/* 288 */
8996/***/ (function(module, exports, __webpack_require__) {
8997
8998var toString = __webpack_require__(79);
8999
9000module.exports = function (argument, $default) {
9001 return argument === undefined ? arguments.length < 2 ? '' : $default : toString(argument);
9002};
9003
9004
9005/***/ }),
9006/* 289 */
9007/***/ (function(module, exports, __webpack_require__) {
9008
9009var fails = __webpack_require__(2);
9010var createPropertyDescriptor = __webpack_require__(47);
9011
9012module.exports = !fails(function () {
9013 var error = Error('a');
9014 if (!('stack' in error)) return true;
9015 // eslint-disable-next-line es-x/no-object-defineproperty -- safe
9016 Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
9017 return error.stack !== 7;
9018});
9019
9020
9021/***/ }),
9022/* 290 */
9023/***/ (function(module, exports, __webpack_require__) {
9024
9025var DESCRIPTORS = __webpack_require__(14);
9026var hasOwn = __webpack_require__(12);
9027
9028var FunctionPrototype = Function.prototype;
9029// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
9030var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
9031
9032var EXISTS = hasOwn(FunctionPrototype, 'name');
9033// additional protection from minified / mangled / dropped function names
9034var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
9035var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
9036
9037module.exports = {
9038 EXISTS: EXISTS,
9039 PROPER: PROPER,
9040 CONFIGURABLE: CONFIGURABLE
9041};
9042
9043
9044/***/ }),
9045/* 291 */
9046/***/ (function(module, exports, __webpack_require__) {
9047
9048"use strict";
9049
9050var IteratorPrototype = __webpack_require__(165).IteratorPrototype;
9051var create = __webpack_require__(49);
9052var createPropertyDescriptor = __webpack_require__(47);
9053var setToStringTag = __webpack_require__(52);
9054var Iterators = __webpack_require__(50);
9055
9056var returnThis = function () { return this; };
9057
9058module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
9059 var TO_STRING_TAG = NAME + ' Iterator';
9060 IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
9061 setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
9062 Iterators[TO_STRING_TAG] = returnThis;
9063 return IteratorConstructor;
9064};
9065
9066
9067/***/ }),
9068/* 292 */
9069/***/ (function(module, exports, __webpack_require__) {
9070
9071"use strict";
9072
9073var TO_STRING_TAG_SUPPORT = __webpack_require__(128);
9074var classof = __webpack_require__(51);
9075
9076// `Object.prototype.toString` method implementation
9077// https://tc39.es/ecma262/#sec-object.prototype.tostring
9078module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
9079 return '[object ' + classof(this) + ']';
9080};
9081
9082
9083/***/ }),
9084/* 293 */
9085/***/ (function(module, exports, __webpack_require__) {
9086
9087// TODO: Remove this module from `core-js@4` since it's split to modules listed below
9088__webpack_require__(294);
9089__webpack_require__(302);
9090__webpack_require__(303);
9091__webpack_require__(304);
9092__webpack_require__(305);
9093__webpack_require__(306);
9094
9095
9096/***/ }),
9097/* 294 */
9098/***/ (function(module, exports, __webpack_require__) {
9099
9100"use strict";
9101
9102var $ = __webpack_require__(0);
9103var IS_PURE = __webpack_require__(33);
9104var IS_NODE = __webpack_require__(106);
9105var global = __webpack_require__(7);
9106var call = __webpack_require__(15);
9107var defineBuiltIn = __webpack_require__(43);
9108var setPrototypeOf = __webpack_require__(101);
9109var setToStringTag = __webpack_require__(52);
9110var setSpecies = __webpack_require__(166);
9111var aCallable = __webpack_require__(31);
9112var isCallable = __webpack_require__(8);
9113var isObject = __webpack_require__(11);
9114var anInstance = __webpack_require__(107);
9115var speciesConstructor = __webpack_require__(167);
9116var task = __webpack_require__(169).set;
9117var microtask = __webpack_require__(296);
9118var hostReportErrors = __webpack_require__(299);
9119var perform = __webpack_require__(80);
9120var Queue = __webpack_require__(300);
9121var InternalStateModule = __webpack_require__(42);
9122var NativePromiseConstructor = __webpack_require__(64);
9123var PromiseConstructorDetection = __webpack_require__(81);
9124var newPromiseCapabilityModule = __webpack_require__(53);
9125
9126var PROMISE = 'Promise';
9127var FORCED_PROMISE_CONSTRUCTOR = PromiseConstructorDetection.CONSTRUCTOR;
9128var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;
9129var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;
9130var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
9131var setInternalState = InternalStateModule.set;
9132var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
9133var PromiseConstructor = NativePromiseConstructor;
9134var PromisePrototype = NativePromisePrototype;
9135var TypeError = global.TypeError;
9136var document = global.document;
9137var process = global.process;
9138var newPromiseCapability = newPromiseCapabilityModule.f;
9139var newGenericPromiseCapability = newPromiseCapability;
9140
9141var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
9142var UNHANDLED_REJECTION = 'unhandledrejection';
9143var REJECTION_HANDLED = 'rejectionhandled';
9144var PENDING = 0;
9145var FULFILLED = 1;
9146var REJECTED = 2;
9147var HANDLED = 1;
9148var UNHANDLED = 2;
9149
9150var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
9151
9152// helpers
9153var isThenable = function (it) {
9154 var then;
9155 return isObject(it) && isCallable(then = it.then) ? then : false;
9156};
9157
9158var callReaction = function (reaction, state) {
9159 var value = state.value;
9160 var ok = state.state == FULFILLED;
9161 var handler = ok ? reaction.ok : reaction.fail;
9162 var resolve = reaction.resolve;
9163 var reject = reaction.reject;
9164 var domain = reaction.domain;
9165 var result, then, exited;
9166 try {
9167 if (handler) {
9168 if (!ok) {
9169 if (state.rejection === UNHANDLED) onHandleUnhandled(state);
9170 state.rejection = HANDLED;
9171 }
9172 if (handler === true) result = value;
9173 else {
9174 if (domain) domain.enter();
9175 result = handler(value); // can throw
9176 if (domain) {
9177 domain.exit();
9178 exited = true;
9179 }
9180 }
9181 if (result === reaction.promise) {
9182 reject(TypeError('Promise-chain cycle'));
9183 } else if (then = isThenable(result)) {
9184 call(then, result, resolve, reject);
9185 } else resolve(result);
9186 } else reject(value);
9187 } catch (error) {
9188 if (domain && !exited) domain.exit();
9189 reject(error);
9190 }
9191};
9192
9193var notify = function (state, isReject) {
9194 if (state.notified) return;
9195 state.notified = true;
9196 microtask(function () {
9197 var reactions = state.reactions;
9198 var reaction;
9199 while (reaction = reactions.get()) {
9200 callReaction(reaction, state);
9201 }
9202 state.notified = false;
9203 if (isReject && !state.rejection) onUnhandled(state);
9204 });
9205};
9206
9207var dispatchEvent = function (name, promise, reason) {
9208 var event, handler;
9209 if (DISPATCH_EVENT) {
9210 event = document.createEvent('Event');
9211 event.promise = promise;
9212 event.reason = reason;
9213 event.initEvent(name, false, true);
9214 global.dispatchEvent(event);
9215 } else event = { promise: promise, reason: reason };
9216 if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global['on' + name])) handler(event);
9217 else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
9218};
9219
9220var onUnhandled = function (state) {
9221 call(task, global, function () {
9222 var promise = state.facade;
9223 var value = state.value;
9224 var IS_UNHANDLED = isUnhandled(state);
9225 var result;
9226 if (IS_UNHANDLED) {
9227 result = perform(function () {
9228 if (IS_NODE) {
9229 process.emit('unhandledRejection', value, promise);
9230 } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
9231 });
9232 // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
9233 state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
9234 if (result.error) throw result.value;
9235 }
9236 });
9237};
9238
9239var isUnhandled = function (state) {
9240 return state.rejection !== HANDLED && !state.parent;
9241};
9242
9243var onHandleUnhandled = function (state) {
9244 call(task, global, function () {
9245 var promise = state.facade;
9246 if (IS_NODE) {
9247 process.emit('rejectionHandled', promise);
9248 } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
9249 });
9250};
9251
9252var bind = function (fn, state, unwrap) {
9253 return function (value) {
9254 fn(state, value, unwrap);
9255 };
9256};
9257
9258var internalReject = function (state, value, unwrap) {
9259 if (state.done) return;
9260 state.done = true;
9261 if (unwrap) state = unwrap;
9262 state.value = value;
9263 state.state = REJECTED;
9264 notify(state, true);
9265};
9266
9267var internalResolve = function (state, value, unwrap) {
9268 if (state.done) return;
9269 state.done = true;
9270 if (unwrap) state = unwrap;
9271 try {
9272 if (state.facade === value) throw TypeError("Promise can't be resolved itself");
9273 var then = isThenable(value);
9274 if (then) {
9275 microtask(function () {
9276 var wrapper = { done: false };
9277 try {
9278 call(then, value,
9279 bind(internalResolve, wrapper, state),
9280 bind(internalReject, wrapper, state)
9281 );
9282 } catch (error) {
9283 internalReject(wrapper, error, state);
9284 }
9285 });
9286 } else {
9287 state.value = value;
9288 state.state = FULFILLED;
9289 notify(state, false);
9290 }
9291 } catch (error) {
9292 internalReject({ done: false }, error, state);
9293 }
9294};
9295
9296// constructor polyfill
9297if (FORCED_PROMISE_CONSTRUCTOR) {
9298 // 25.4.3.1 Promise(executor)
9299 PromiseConstructor = function Promise(executor) {
9300 anInstance(this, PromisePrototype);
9301 aCallable(executor);
9302 call(Internal, this);
9303 var state = getInternalPromiseState(this);
9304 try {
9305 executor(bind(internalResolve, state), bind(internalReject, state));
9306 } catch (error) {
9307 internalReject(state, error);
9308 }
9309 };
9310
9311 PromisePrototype = PromiseConstructor.prototype;
9312
9313 // eslint-disable-next-line no-unused-vars -- required for `.length`
9314 Internal = function Promise(executor) {
9315 setInternalState(this, {
9316 type: PROMISE,
9317 done: false,
9318 notified: false,
9319 parent: false,
9320 reactions: new Queue(),
9321 rejection: false,
9322 state: PENDING,
9323 value: undefined
9324 });
9325 };
9326
9327 // `Promise.prototype.then` method
9328 // https://tc39.es/ecma262/#sec-promise.prototype.then
9329 Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
9330 var state = getInternalPromiseState(this);
9331 var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
9332 state.parent = true;
9333 reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
9334 reaction.fail = isCallable(onRejected) && onRejected;
9335 reaction.domain = IS_NODE ? process.domain : undefined;
9336 if (state.state == PENDING) state.reactions.add(reaction);
9337 else microtask(function () {
9338 callReaction(reaction, state);
9339 });
9340 return reaction.promise;
9341 });
9342
9343 OwnPromiseCapability = function () {
9344 var promise = new Internal();
9345 var state = getInternalPromiseState(promise);
9346 this.promise = promise;
9347 this.resolve = bind(internalResolve, state);
9348 this.reject = bind(internalReject, state);
9349 };
9350
9351 newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
9352 return C === PromiseConstructor || C === PromiseWrapper
9353 ? new OwnPromiseCapability(C)
9354 : newGenericPromiseCapability(C);
9355 };
9356
9357 if (!IS_PURE && isCallable(NativePromiseConstructor) && NativePromisePrototype !== Object.prototype) {
9358 nativeThen = NativePromisePrototype.then;
9359
9360 if (!NATIVE_PROMISE_SUBCLASSING) {
9361 // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
9362 defineBuiltIn(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
9363 var that = this;
9364 return new PromiseConstructor(function (resolve, reject) {
9365 call(nativeThen, that, resolve, reject);
9366 }).then(onFulfilled, onRejected);
9367 // https://github.com/zloirock/core-js/issues/640
9368 }, { unsafe: true });
9369 }
9370
9371 // make `.constructor === Promise` work for native promise-based APIs
9372 try {
9373 delete NativePromisePrototype.constructor;
9374 } catch (error) { /* empty */ }
9375
9376 // make `instanceof Promise` work for native promise-based APIs
9377 if (setPrototypeOf) {
9378 setPrototypeOf(NativePromisePrototype, PromisePrototype);
9379 }
9380 }
9381}
9382
9383$({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
9384 Promise: PromiseConstructor
9385});
9386
9387setToStringTag(PromiseConstructor, PROMISE, false, true);
9388setSpecies(PROMISE);
9389
9390
9391/***/ }),
9392/* 295 */
9393/***/ (function(module, exports) {
9394
9395var $TypeError = TypeError;
9396
9397module.exports = function (passed, required) {
9398 if (passed < required) throw $TypeError('Not enough arguments');
9399 return passed;
9400};
9401
9402
9403/***/ }),
9404/* 296 */
9405/***/ (function(module, exports, __webpack_require__) {
9406
9407var global = __webpack_require__(7);
9408var bind = __webpack_require__(48);
9409var getOwnPropertyDescriptor = __webpack_require__(60).f;
9410var macrotask = __webpack_require__(169).set;
9411var IS_IOS = __webpack_require__(170);
9412var IS_IOS_PEBBLE = __webpack_require__(297);
9413var IS_WEBOS_WEBKIT = __webpack_require__(298);
9414var IS_NODE = __webpack_require__(106);
9415
9416var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
9417var document = global.document;
9418var process = global.process;
9419var Promise = global.Promise;
9420// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
9421var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
9422var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
9423
9424var flush, head, last, notify, toggle, node, promise, then;
9425
9426// modern engines have queueMicrotask method
9427if (!queueMicrotask) {
9428 flush = function () {
9429 var parent, fn;
9430 if (IS_NODE && (parent = process.domain)) parent.exit();
9431 while (head) {
9432 fn = head.fn;
9433 head = head.next;
9434 try {
9435 fn();
9436 } catch (error) {
9437 if (head) notify();
9438 else last = undefined;
9439 throw error;
9440 }
9441 } last = undefined;
9442 if (parent) parent.enter();
9443 };
9444
9445 // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
9446 // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
9447 if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) {
9448 toggle = true;
9449 node = document.createTextNode('');
9450 new MutationObserver(flush).observe(node, { characterData: true });
9451 notify = function () {
9452 node.data = toggle = !toggle;
9453 };
9454 // environments with maybe non-completely correct, but existent Promise
9455 } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) {
9456 // Promise.resolve without an argument throws an error in LG WebOS 2
9457 promise = Promise.resolve(undefined);
9458 // workaround of WebKit ~ iOS Safari 10.1 bug
9459 promise.constructor = Promise;
9460 then = bind(promise.then, promise);
9461 notify = function () {
9462 then(flush);
9463 };
9464 // Node.js without promises
9465 } else if (IS_NODE) {
9466 notify = function () {
9467 process.nextTick(flush);
9468 };
9469 // for other environments - macrotask based on:
9470 // - setImmediate
9471 // - MessageChannel
9472 // - window.postMessage
9473 // - onreadystatechange
9474 // - setTimeout
9475 } else {
9476 // strange IE + webpack dev server bug - use .bind(global)
9477 macrotask = bind(macrotask, global);
9478 notify = function () {
9479 macrotask(flush);
9480 };
9481 }
9482}
9483
9484module.exports = queueMicrotask || function (fn) {
9485 var task = { fn: fn, next: undefined };
9486 if (last) last.next = task;
9487 if (!head) {
9488 head = task;
9489 notify();
9490 } last = task;
9491};
9492
9493
9494/***/ }),
9495/* 297 */
9496/***/ (function(module, exports, __webpack_require__) {
9497
9498var userAgent = __webpack_require__(97);
9499var global = __webpack_require__(7);
9500
9501module.exports = /ipad|iphone|ipod/i.test(userAgent) && global.Pebble !== undefined;
9502
9503
9504/***/ }),
9505/* 298 */
9506/***/ (function(module, exports, __webpack_require__) {
9507
9508var userAgent = __webpack_require__(97);
9509
9510module.exports = /web0s(?!.*chrome)/i.test(userAgent);
9511
9512
9513/***/ }),
9514/* 299 */
9515/***/ (function(module, exports, __webpack_require__) {
9516
9517var global = __webpack_require__(7);
9518
9519module.exports = function (a, b) {
9520 var console = global.console;
9521 if (console && console.error) {
9522 arguments.length == 1 ? console.error(a) : console.error(a, b);
9523 }
9524};
9525
9526
9527/***/ }),
9528/* 300 */
9529/***/ (function(module, exports) {
9530
9531var Queue = function () {
9532 this.head = null;
9533 this.tail = null;
9534};
9535
9536Queue.prototype = {
9537 add: function (item) {
9538 var entry = { item: item, next: null };
9539 if (this.head) this.tail.next = entry;
9540 else this.head = entry;
9541 this.tail = entry;
9542 },
9543 get: function () {
9544 var entry = this.head;
9545 if (entry) {
9546 this.head = entry.next;
9547 if (this.tail === entry) this.tail = null;
9548 return entry.item;
9549 }
9550 }
9551};
9552
9553module.exports = Queue;
9554
9555
9556/***/ }),
9557/* 301 */
9558/***/ (function(module, exports) {
9559
9560module.exports = typeof window == 'object' && typeof Deno != 'object';
9561
9562
9563/***/ }),
9564/* 302 */
9565/***/ (function(module, exports, __webpack_require__) {
9566
9567"use strict";
9568
9569var $ = __webpack_require__(0);
9570var call = __webpack_require__(15);
9571var aCallable = __webpack_require__(31);
9572var newPromiseCapabilityModule = __webpack_require__(53);
9573var perform = __webpack_require__(80);
9574var iterate = __webpack_require__(40);
9575var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(171);
9576
9577// `Promise.all` method
9578// https://tc39.es/ecma262/#sec-promise.all
9579$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
9580 all: function all(iterable) {
9581 var C = this;
9582 var capability = newPromiseCapabilityModule.f(C);
9583 var resolve = capability.resolve;
9584 var reject = capability.reject;
9585 var result = perform(function () {
9586 var $promiseResolve = aCallable(C.resolve);
9587 var values = [];
9588 var counter = 0;
9589 var remaining = 1;
9590 iterate(iterable, function (promise) {
9591 var index = counter++;
9592 var alreadyCalled = false;
9593 remaining++;
9594 call($promiseResolve, C, promise).then(function (value) {
9595 if (alreadyCalled) return;
9596 alreadyCalled = true;
9597 values[index] = value;
9598 --remaining || resolve(values);
9599 }, reject);
9600 });
9601 --remaining || resolve(values);
9602 });
9603 if (result.error) reject(result.value);
9604 return capability.promise;
9605 }
9606});
9607
9608
9609/***/ }),
9610/* 303 */
9611/***/ (function(module, exports, __webpack_require__) {
9612
9613"use strict";
9614
9615var $ = __webpack_require__(0);
9616var IS_PURE = __webpack_require__(33);
9617var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(81).CONSTRUCTOR;
9618var NativePromiseConstructor = __webpack_require__(64);
9619var getBuiltIn = __webpack_require__(18);
9620var isCallable = __webpack_require__(8);
9621var defineBuiltIn = __webpack_require__(43);
9622
9623var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
9624
9625// `Promise.prototype.catch` method
9626// https://tc39.es/ecma262/#sec-promise.prototype.catch
9627$({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR, real: true }, {
9628 'catch': function (onRejected) {
9629 return this.then(undefined, onRejected);
9630 }
9631});
9632
9633// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
9634if (!IS_PURE && isCallable(NativePromiseConstructor)) {
9635 var method = getBuiltIn('Promise').prototype['catch'];
9636 if (NativePromisePrototype['catch'] !== method) {
9637 defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });
9638 }
9639}
9640
9641
9642/***/ }),
9643/* 304 */
9644/***/ (function(module, exports, __webpack_require__) {
9645
9646"use strict";
9647
9648var $ = __webpack_require__(0);
9649var call = __webpack_require__(15);
9650var aCallable = __webpack_require__(31);
9651var newPromiseCapabilityModule = __webpack_require__(53);
9652var perform = __webpack_require__(80);
9653var iterate = __webpack_require__(40);
9654var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(171);
9655
9656// `Promise.race` method
9657// https://tc39.es/ecma262/#sec-promise.race
9658$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
9659 race: function race(iterable) {
9660 var C = this;
9661 var capability = newPromiseCapabilityModule.f(C);
9662 var reject = capability.reject;
9663 var result = perform(function () {
9664 var $promiseResolve = aCallable(C.resolve);
9665 iterate(iterable, function (promise) {
9666 call($promiseResolve, C, promise).then(capability.resolve, reject);
9667 });
9668 });
9669 if (result.error) reject(result.value);
9670 return capability.promise;
9671 }
9672});
9673
9674
9675/***/ }),
9676/* 305 */
9677/***/ (function(module, exports, __webpack_require__) {
9678
9679"use strict";
9680
9681var $ = __webpack_require__(0);
9682var call = __webpack_require__(15);
9683var newPromiseCapabilityModule = __webpack_require__(53);
9684var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(81).CONSTRUCTOR;
9685
9686// `Promise.reject` method
9687// https://tc39.es/ecma262/#sec-promise.reject
9688$({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
9689 reject: function reject(r) {
9690 var capability = newPromiseCapabilityModule.f(this);
9691 call(capability.reject, undefined, r);
9692 return capability.promise;
9693 }
9694});
9695
9696
9697/***/ }),
9698/* 306 */
9699/***/ (function(module, exports, __webpack_require__) {
9700
9701"use strict";
9702
9703var $ = __webpack_require__(0);
9704var getBuiltIn = __webpack_require__(18);
9705var IS_PURE = __webpack_require__(33);
9706var NativePromiseConstructor = __webpack_require__(64);
9707var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(81).CONSTRUCTOR;
9708var promiseResolve = __webpack_require__(173);
9709
9710var PromiseConstructorWrapper = getBuiltIn('Promise');
9711var CHECK_WRAPPER = IS_PURE && !FORCED_PROMISE_CONSTRUCTOR;
9712
9713// `Promise.resolve` method
9714// https://tc39.es/ecma262/#sec-promise.resolve
9715$({ target: 'Promise', stat: true, forced: IS_PURE || FORCED_PROMISE_CONSTRUCTOR }, {
9716 resolve: function resolve(x) {
9717 return promiseResolve(CHECK_WRAPPER && this === PromiseConstructorWrapper ? NativePromiseConstructor : this, x);
9718 }
9719});
9720
9721
9722/***/ }),
9723/* 307 */
9724/***/ (function(module, exports, __webpack_require__) {
9725
9726"use strict";
9727
9728var $ = __webpack_require__(0);
9729var call = __webpack_require__(15);
9730var aCallable = __webpack_require__(31);
9731var newPromiseCapabilityModule = __webpack_require__(53);
9732var perform = __webpack_require__(80);
9733var iterate = __webpack_require__(40);
9734
9735// `Promise.allSettled` method
9736// https://tc39.es/ecma262/#sec-promise.allsettled
9737$({ target: 'Promise', stat: true }, {
9738 allSettled: function allSettled(iterable) {
9739 var C = this;
9740 var capability = newPromiseCapabilityModule.f(C);
9741 var resolve = capability.resolve;
9742 var reject = capability.reject;
9743 var result = perform(function () {
9744 var promiseResolve = aCallable(C.resolve);
9745 var values = [];
9746 var counter = 0;
9747 var remaining = 1;
9748 iterate(iterable, function (promise) {
9749 var index = counter++;
9750 var alreadyCalled = false;
9751 remaining++;
9752 call(promiseResolve, C, promise).then(function (value) {
9753 if (alreadyCalled) return;
9754 alreadyCalled = true;
9755 values[index] = { status: 'fulfilled', value: value };
9756 --remaining || resolve(values);
9757 }, function (error) {
9758 if (alreadyCalled) return;
9759 alreadyCalled = true;
9760 values[index] = { status: 'rejected', reason: error };
9761 --remaining || resolve(values);
9762 });
9763 });
9764 --remaining || resolve(values);
9765 });
9766 if (result.error) reject(result.value);
9767 return capability.promise;
9768 }
9769});
9770
9771
9772/***/ }),
9773/* 308 */
9774/***/ (function(module, exports, __webpack_require__) {
9775
9776"use strict";
9777
9778var $ = __webpack_require__(0);
9779var call = __webpack_require__(15);
9780var aCallable = __webpack_require__(31);
9781var getBuiltIn = __webpack_require__(18);
9782var newPromiseCapabilityModule = __webpack_require__(53);
9783var perform = __webpack_require__(80);
9784var iterate = __webpack_require__(40);
9785
9786var PROMISE_ANY_ERROR = 'No one promise resolved';
9787
9788// `Promise.any` method
9789// https://tc39.es/ecma262/#sec-promise.any
9790$({ target: 'Promise', stat: true }, {
9791 any: function any(iterable) {
9792 var C = this;
9793 var AggregateError = getBuiltIn('AggregateError');
9794 var capability = newPromiseCapabilityModule.f(C);
9795 var resolve = capability.resolve;
9796 var reject = capability.reject;
9797 var result = perform(function () {
9798 var promiseResolve = aCallable(C.resolve);
9799 var errors = [];
9800 var counter = 0;
9801 var remaining = 1;
9802 var alreadyResolved = false;
9803 iterate(iterable, function (promise) {
9804 var index = counter++;
9805 var alreadyRejected = false;
9806 remaining++;
9807 call(promiseResolve, C, promise).then(function (value) {
9808 if (alreadyRejected || alreadyResolved) return;
9809 alreadyResolved = true;
9810 resolve(value);
9811 }, function (error) {
9812 if (alreadyRejected || alreadyResolved) return;
9813 alreadyRejected = true;
9814 errors[index] = error;
9815 --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
9816 });
9817 });
9818 --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
9819 });
9820 if (result.error) reject(result.value);
9821 return capability.promise;
9822 }
9823});
9824
9825
9826/***/ }),
9827/* 309 */
9828/***/ (function(module, exports, __webpack_require__) {
9829
9830"use strict";
9831
9832var $ = __webpack_require__(0);
9833var IS_PURE = __webpack_require__(33);
9834var NativePromiseConstructor = __webpack_require__(64);
9835var fails = __webpack_require__(2);
9836var getBuiltIn = __webpack_require__(18);
9837var isCallable = __webpack_require__(8);
9838var speciesConstructor = __webpack_require__(167);
9839var promiseResolve = __webpack_require__(173);
9840var defineBuiltIn = __webpack_require__(43);
9841
9842var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
9843
9844// Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829
9845var NON_GENERIC = !!NativePromiseConstructor && fails(function () {
9846 // eslint-disable-next-line unicorn/no-thenable -- required for testing
9847 NativePromisePrototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ });
9848});
9849
9850// `Promise.prototype.finally` method
9851// https://tc39.es/ecma262/#sec-promise.prototype.finally
9852$({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, {
9853 'finally': function (onFinally) {
9854 var C = speciesConstructor(this, getBuiltIn('Promise'));
9855 var isFunction = isCallable(onFinally);
9856 return this.then(
9857 isFunction ? function (x) {
9858 return promiseResolve(C, onFinally()).then(function () { return x; });
9859 } : onFinally,
9860 isFunction ? function (e) {
9861 return promiseResolve(C, onFinally()).then(function () { throw e; });
9862 } : onFinally
9863 );
9864 }
9865});
9866
9867// makes sure that native promise-based APIs `Promise#finally` properly works with patched `Promise#then`
9868if (!IS_PURE && isCallable(NativePromiseConstructor)) {
9869 var method = getBuiltIn('Promise').prototype['finally'];
9870 if (NativePromisePrototype['finally'] !== method) {
9871 defineBuiltIn(NativePromisePrototype, 'finally', method, { unsafe: true });
9872 }
9873}
9874
9875
9876/***/ }),
9877/* 310 */
9878/***/ (function(module, exports, __webpack_require__) {
9879
9880var uncurryThis = __webpack_require__(4);
9881var toIntegerOrInfinity = __webpack_require__(125);
9882var toString = __webpack_require__(79);
9883var requireObjectCoercible = __webpack_require__(120);
9884
9885var charAt = uncurryThis(''.charAt);
9886var charCodeAt = uncurryThis(''.charCodeAt);
9887var stringSlice = uncurryThis(''.slice);
9888
9889var createMethod = function (CONVERT_TO_STRING) {
9890 return function ($this, pos) {
9891 var S = toString(requireObjectCoercible($this));
9892 var position = toIntegerOrInfinity(pos);
9893 var size = S.length;
9894 var first, second;
9895 if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
9896 first = charCodeAt(S, position);
9897 return first < 0xD800 || first > 0xDBFF || position + 1 === size
9898 || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
9899 ? CONVERT_TO_STRING
9900 ? charAt(S, position)
9901 : first
9902 : CONVERT_TO_STRING
9903 ? stringSlice(S, position, position + 2)
9904 : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
9905 };
9906};
9907
9908module.exports = {
9909 // `String.prototype.codePointAt` method
9910 // https://tc39.es/ecma262/#sec-string.prototype.codepointat
9911 codeAt: createMethod(false),
9912 // `String.prototype.at` method
9913 // https://github.com/mathiasbynens/String.prototype.at
9914 charAt: createMethod(true)
9915};
9916
9917
9918/***/ }),
9919/* 311 */
9920/***/ (function(module, exports) {
9921
9922// iterable DOM collections
9923// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
9924module.exports = {
9925 CSSRuleList: 0,
9926 CSSStyleDeclaration: 0,
9927 CSSValueList: 0,
9928 ClientRectList: 0,
9929 DOMRectList: 0,
9930 DOMStringList: 0,
9931 DOMTokenList: 1,
9932 DataTransferItemList: 0,
9933 FileList: 0,
9934 HTMLAllCollection: 0,
9935 HTMLCollection: 0,
9936 HTMLFormElement: 0,
9937 HTMLSelectElement: 0,
9938 MediaList: 0,
9939 MimeTypeArray: 0,
9940 NamedNodeMap: 0,
9941 NodeList: 1,
9942 PaintRequestList: 0,
9943 Plugin: 0,
9944 PluginArray: 0,
9945 SVGLengthList: 0,
9946 SVGNumberList: 0,
9947 SVGPathSegList: 0,
9948 SVGPointList: 0,
9949 SVGStringList: 0,
9950 SVGTransformList: 0,
9951 SourceBufferList: 0,
9952 StyleSheetList: 0,
9953 TextTrackCueList: 0,
9954 TextTrackList: 0,
9955 TouchList: 0
9956};
9957
9958
9959/***/ }),
9960/* 312 */
9961/***/ (function(module, __webpack_exports__, __webpack_require__) {
9962
9963"use strict";
9964/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_js__ = __webpack_require__(131);
9965// Default Export
9966// ==============
9967// In this module, we mix our bundled exports into the `_` object and export
9968// the result. This is analogous to setting `module.exports = _` in CommonJS.
9969// Hence, this module is also the entry point of our UMD bundle and the package
9970// entry point for CommonJS and AMD users. In other words, this is (the source
9971// of) the module you are interfacing with when you do any of the following:
9972//
9973// ```js
9974// // CommonJS
9975// var _ = require('underscore');
9976//
9977// // AMD
9978// define(['underscore'], function(_) {...});
9979//
9980// // UMD in the browser
9981// // _ is available as a global variable
9982// ```
9983
9984
9985
9986// Add all of the Underscore functions to the wrapper object.
9987var _ = Object(__WEBPACK_IMPORTED_MODULE_0__index_js__["mixin"])(__WEBPACK_IMPORTED_MODULE_0__index_js__);
9988// Legacy Node.js API.
9989_._ = _;
9990// Export the Underscore API.
9991/* harmony default export */ __webpack_exports__["a"] = (_);
9992
9993
9994/***/ }),
9995/* 313 */
9996/***/ (function(module, __webpack_exports__, __webpack_require__) {
9997
9998"use strict";
9999/* harmony export (immutable) */ __webpack_exports__["a"] = isNull;
10000// Is a given value equal to null?
10001function isNull(obj) {
10002 return obj === null;
10003}
10004
10005
10006/***/ }),
10007/* 314 */
10008/***/ (function(module, __webpack_exports__, __webpack_require__) {
10009
10010"use strict";
10011/* harmony export (immutable) */ __webpack_exports__["a"] = isElement;
10012// Is a given value a DOM element?
10013function isElement(obj) {
10014 return !!(obj && obj.nodeType === 1);
10015}
10016
10017
10018/***/ }),
10019/* 315 */
10020/***/ (function(module, __webpack_exports__, __webpack_require__) {
10021
10022"use strict";
10023/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10024
10025
10026/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Date'));
10027
10028
10029/***/ }),
10030/* 316 */
10031/***/ (function(module, __webpack_exports__, __webpack_require__) {
10032
10033"use strict";
10034/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10035
10036
10037/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('RegExp'));
10038
10039
10040/***/ }),
10041/* 317 */
10042/***/ (function(module, __webpack_exports__, __webpack_require__) {
10043
10044"use strict";
10045/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10046
10047
10048/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Error'));
10049
10050
10051/***/ }),
10052/* 318 */
10053/***/ (function(module, __webpack_exports__, __webpack_require__) {
10054
10055"use strict";
10056/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10057
10058
10059/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Object'));
10060
10061
10062/***/ }),
10063/* 319 */
10064/***/ (function(module, __webpack_exports__, __webpack_require__) {
10065
10066"use strict";
10067/* harmony export (immutable) */ __webpack_exports__["a"] = isFinite;
10068/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(5);
10069/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isSymbol_js__ = __webpack_require__(177);
10070
10071
10072
10073// Is a given object a finite number?
10074function isFinite(obj) {
10075 return !Object(__WEBPACK_IMPORTED_MODULE_1__isSymbol_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["f" /* _isFinite */])(obj) && !isNaN(parseFloat(obj));
10076}
10077
10078
10079/***/ }),
10080/* 320 */
10081/***/ (function(module, __webpack_exports__, __webpack_require__) {
10082
10083"use strict";
10084/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(182);
10085/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getByteLength_js__ = __webpack_require__(135);
10086
10087
10088
10089// Internal helper to determine whether we should spend extensive checks against
10090// `ArrayBuffer` et al.
10091/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__getByteLength_js__["a" /* default */]));
10092
10093
10094/***/ }),
10095/* 321 */
10096/***/ (function(module, __webpack_exports__, __webpack_require__) {
10097
10098"use strict";
10099/* harmony export (immutable) */ __webpack_exports__["a"] = isEmpty;
10100/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
10101/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(55);
10102/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(132);
10103/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(134);
10104/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keys_js__ = __webpack_require__(16);
10105
10106
10107
10108
10109
10110
10111// Is a given array, string, or object empty?
10112// An "empty" object has no enumerable own-properties.
10113function isEmpty(obj) {
10114 if (obj == null) return true;
10115 // Skip the more expensive `toString`-based type checks if `obj` has no
10116 // `.length`.
10117 var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(obj);
10118 if (typeof length == 'number' && (
10119 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)
10120 )) return length === 0;
10121 return Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__keys_js__["a" /* default */])(obj)) === 0;
10122}
10123
10124
10125/***/ }),
10126/* 322 */
10127/***/ (function(module, __webpack_exports__, __webpack_require__) {
10128
10129"use strict";
10130/* harmony export (immutable) */ __webpack_exports__["a"] = isEqual;
10131/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
10132/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(5);
10133/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getByteLength_js__ = __webpack_require__(135);
10134/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__ = __webpack_require__(180);
10135/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isFunction_js__ = __webpack_require__(28);
10136/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__ = __webpack_require__(82);
10137/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isDataView_js__ = __webpack_require__(133);
10138/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__keys_js__ = __webpack_require__(16);
10139/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__has_js__ = __webpack_require__(45);
10140/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__toBufferView_js__ = __webpack_require__(323);
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152// We use this string twice, so give it a name for minification.
10153var tagDataView = '[object DataView]';
10154
10155// Internal recursive comparison function for `_.isEqual`.
10156function eq(a, b, aStack, bStack) {
10157 // Identical objects are equal. `0 === -0`, but they aren't identical.
10158 // See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal).
10159 if (a === b) return a !== 0 || 1 / a === 1 / b;
10160 // `null` or `undefined` only equal to itself (strict comparison).
10161 if (a == null || b == null) return false;
10162 // `NaN`s are equivalent, but non-reflexive.
10163 if (a !== a) return b !== b;
10164 // Exhaust primitive checks
10165 var type = typeof a;
10166 if (type !== 'function' && type !== 'object' && typeof b != 'object') return false;
10167 return deepEq(a, b, aStack, bStack);
10168}
10169
10170// Internal recursive comparison function for `_.isEqual`.
10171function deepEq(a, b, aStack, bStack) {
10172 // Unwrap any wrapped objects.
10173 if (a instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) a = a._wrapped;
10174 if (b instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) b = b._wrapped;
10175 // Compare `[[Class]]` names.
10176 var className = __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(a);
10177 if (className !== __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(b)) return false;
10178 // Work around a bug in IE 10 - Edge 13.
10179 if (__WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__["a" /* hasStringTagBug */] && className == '[object Object]' && Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(a)) {
10180 if (!Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(b)) return false;
10181 className = tagDataView;
10182 }
10183 switch (className) {
10184 // These types are compared by value.
10185 case '[object RegExp]':
10186 // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
10187 case '[object String]':
10188 // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
10189 // equivalent to `new String("5")`.
10190 return '' + a === '' + b;
10191 case '[object Number]':
10192 // `NaN`s are equivalent, but non-reflexive.
10193 // Object(NaN) is equivalent to NaN.
10194 if (+a !== +a) return +b !== +b;
10195 // An `egal` comparison is performed for other numeric values.
10196 return +a === 0 ? 1 / +a === 1 / b : +a === +b;
10197 case '[object Date]':
10198 case '[object Boolean]':
10199 // Coerce dates and booleans to numeric primitive values. Dates are compared by their
10200 // millisecond representations. Note that invalid dates with millisecond representations
10201 // of `NaN` are not equivalent.
10202 return +a === +b;
10203 case '[object Symbol]':
10204 return __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(a) === __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(b);
10205 case '[object ArrayBuffer]':
10206 case tagDataView:
10207 // Coerce to typed array so we can fall through.
10208 return deepEq(Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(a), Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(b), aStack, bStack);
10209 }
10210
10211 var areArrays = className === '[object Array]';
10212 if (!areArrays && Object(__WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__["a" /* default */])(a)) {
10213 var byteLength = Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(a);
10214 if (byteLength !== Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(b)) return false;
10215 if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true;
10216 areArrays = true;
10217 }
10218 if (!areArrays) {
10219 if (typeof a != 'object' || typeof b != 'object') return false;
10220
10221 // Objects with different constructors are not equivalent, but `Object`s or `Array`s
10222 // from different frames are.
10223 var aCtor = a.constructor, bCtor = b.constructor;
10224 if (aCtor !== bCtor && !(Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(aCtor) && aCtor instanceof aCtor &&
10225 Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(bCtor) && bCtor instanceof bCtor)
10226 && ('constructor' in a && 'constructor' in b)) {
10227 return false;
10228 }
10229 }
10230 // Assume equality for cyclic structures. The algorithm for detecting cyclic
10231 // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
10232
10233 // Initializing stack of traversed objects.
10234 // It's done here since we only need them for objects and arrays comparison.
10235 aStack = aStack || [];
10236 bStack = bStack || [];
10237 var length = aStack.length;
10238 while (length--) {
10239 // Linear search. Performance is inversely proportional to the number of
10240 // unique nested structures.
10241 if (aStack[length] === a) return bStack[length] === b;
10242 }
10243
10244 // Add the first object to the stack of traversed objects.
10245 aStack.push(a);
10246 bStack.push(b);
10247
10248 // Recursively compare objects and arrays.
10249 if (areArrays) {
10250 // Compare array lengths to determine if a deep comparison is necessary.
10251 length = a.length;
10252 if (length !== b.length) return false;
10253 // Deep compare the contents, ignoring non-numeric properties.
10254 while (length--) {
10255 if (!eq(a[length], b[length], aStack, bStack)) return false;
10256 }
10257 } else {
10258 // Deep compare objects.
10259 var _keys = Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(a), key;
10260 length = _keys.length;
10261 // Ensure that both objects contain the same number of properties before comparing deep equality.
10262 if (Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(b).length !== length) return false;
10263 while (length--) {
10264 // Deep compare each member
10265 key = _keys[length];
10266 if (!(Object(__WEBPACK_IMPORTED_MODULE_8__has_js__["a" /* default */])(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
10267 }
10268 }
10269 // Remove the first object from the stack of traversed objects.
10270 aStack.pop();
10271 bStack.pop();
10272 return true;
10273}
10274
10275// Perform a deep comparison to check if two objects are equal.
10276function isEqual(a, b) {
10277 return eq(a, b);
10278}
10279
10280
10281/***/ }),
10282/* 323 */
10283/***/ (function(module, __webpack_exports__, __webpack_require__) {
10284
10285"use strict";
10286/* harmony export (immutable) */ __webpack_exports__["a"] = toBufferView;
10287/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getByteLength_js__ = __webpack_require__(135);
10288
10289
10290// Internal function to wrap or shallow-copy an ArrayBuffer,
10291// typed array or DataView to a new view, reusing the buffer.
10292function toBufferView(bufferSource) {
10293 return new Uint8Array(
10294 bufferSource.buffer || bufferSource,
10295 bufferSource.byteOffset || 0,
10296 Object(__WEBPACK_IMPORTED_MODULE_0__getByteLength_js__["a" /* default */])(bufferSource)
10297 );
10298}
10299
10300
10301/***/ }),
10302/* 324 */
10303/***/ (function(module, __webpack_exports__, __webpack_require__) {
10304
10305"use strict";
10306/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10307/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(82);
10308/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(136);
10309
10310
10311
10312
10313/* 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'));
10314
10315
10316/***/ }),
10317/* 325 */
10318/***/ (function(module, __webpack_exports__, __webpack_require__) {
10319
10320"use strict";
10321/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10322/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(82);
10323/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(136);
10324
10325
10326
10327
10328/* 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'));
10329
10330
10331/***/ }),
10332/* 326 */
10333/***/ (function(module, __webpack_exports__, __webpack_require__) {
10334
10335"use strict";
10336/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10337/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(82);
10338/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(136);
10339
10340
10341
10342
10343/* 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'));
10344
10345
10346/***/ }),
10347/* 327 */
10348/***/ (function(module, __webpack_exports__, __webpack_require__) {
10349
10350"use strict";
10351/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10352
10353
10354/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('WeakSet'));
10355
10356
10357/***/ }),
10358/* 328 */
10359/***/ (function(module, __webpack_exports__, __webpack_require__) {
10360
10361"use strict";
10362/* harmony export (immutable) */ __webpack_exports__["a"] = pairs;
10363/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
10364
10365
10366// Convert an object into a list of `[key, value]` pairs.
10367// The opposite of `_.object` with one argument.
10368function pairs(obj) {
10369 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
10370 var length = _keys.length;
10371 var pairs = Array(length);
10372 for (var i = 0; i < length; i++) {
10373 pairs[i] = [_keys[i], obj[_keys[i]]];
10374 }
10375 return pairs;
10376}
10377
10378
10379/***/ }),
10380/* 329 */
10381/***/ (function(module, __webpack_exports__, __webpack_require__) {
10382
10383"use strict";
10384/* harmony export (immutable) */ __webpack_exports__["a"] = create;
10385/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(190);
10386/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__extendOwn_js__ = __webpack_require__(138);
10387
10388
10389
10390// Creates an object that inherits from the given prototype object.
10391// If additional properties are provided then they will be added to the
10392// created object.
10393function create(prototype, props) {
10394 var result = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(prototype);
10395 if (props) Object(__WEBPACK_IMPORTED_MODULE_1__extendOwn_js__["a" /* default */])(result, props);
10396 return result;
10397}
10398
10399
10400/***/ }),
10401/* 330 */
10402/***/ (function(module, __webpack_exports__, __webpack_require__) {
10403
10404"use strict";
10405/* harmony export (immutable) */ __webpack_exports__["a"] = tap;
10406// Invokes `interceptor` with the `obj` and then returns `obj`.
10407// The primary purpose of this method is to "tap into" a method chain, in
10408// order to perform operations on intermediate results within the chain.
10409function tap(obj, interceptor) {
10410 interceptor(obj);
10411 return obj;
10412}
10413
10414
10415/***/ }),
10416/* 331 */
10417/***/ (function(module, __webpack_exports__, __webpack_require__) {
10418
10419"use strict";
10420/* harmony export (immutable) */ __webpack_exports__["a"] = has;
10421/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(45);
10422/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(84);
10423
10424
10425
10426// Shortcut function for checking if an object has a given property directly on
10427// itself (in other words, not on a prototype). Unlike the internal `has`
10428// function, this public version can also traverse nested properties.
10429function has(obj, path) {
10430 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
10431 var length = path.length;
10432 for (var i = 0; i < length; i++) {
10433 var key = path[i];
10434 if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(obj, key)) return false;
10435 obj = obj[key];
10436 }
10437 return !!length;
10438}
10439
10440
10441/***/ }),
10442/* 332 */
10443/***/ (function(module, __webpack_exports__, __webpack_require__) {
10444
10445"use strict";
10446/* harmony export (immutable) */ __webpack_exports__["a"] = mapObject;
10447/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
10448/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
10449
10450
10451
10452// Returns the results of applying the `iteratee` to each element of `obj`.
10453// In contrast to `_.map` it returns an object.
10454function mapObject(obj, iteratee, context) {
10455 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
10456 var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
10457 length = _keys.length,
10458 results = {};
10459 for (var index = 0; index < length; index++) {
10460 var currentKey = _keys[index];
10461 results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
10462 }
10463 return results;
10464}
10465
10466
10467/***/ }),
10468/* 333 */
10469/***/ (function(module, __webpack_exports__, __webpack_require__) {
10470
10471"use strict";
10472/* harmony export (immutable) */ __webpack_exports__["a"] = propertyOf;
10473/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__noop_js__ = __webpack_require__(196);
10474/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__get_js__ = __webpack_require__(192);
10475
10476
10477
10478// Generates a function for a given object that returns a given property.
10479function propertyOf(obj) {
10480 if (obj == null) return __WEBPACK_IMPORTED_MODULE_0__noop_js__["a" /* default */];
10481 return function(path) {
10482 return Object(__WEBPACK_IMPORTED_MODULE_1__get_js__["a" /* default */])(obj, path);
10483 };
10484}
10485
10486
10487/***/ }),
10488/* 334 */
10489/***/ (function(module, __webpack_exports__, __webpack_require__) {
10490
10491"use strict";
10492/* harmony export (immutable) */ __webpack_exports__["a"] = times;
10493/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(85);
10494
10495
10496// Run a function **n** times.
10497function times(n, iteratee, context) {
10498 var accum = Array(Math.max(0, n));
10499 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context, 1);
10500 for (var i = 0; i < n; i++) accum[i] = iteratee(i);
10501 return accum;
10502}
10503
10504
10505/***/ }),
10506/* 335 */
10507/***/ (function(module, __webpack_exports__, __webpack_require__) {
10508
10509"use strict";
10510/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(198);
10511/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(199);
10512
10513
10514
10515// Function for escaping strings to HTML interpolation.
10516/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
10517
10518
10519/***/ }),
10520/* 336 */
10521/***/ (function(module, __webpack_exports__, __webpack_require__) {
10522
10523"use strict";
10524/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(198);
10525/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__ = __webpack_require__(337);
10526
10527
10528
10529// Function for unescaping strings from HTML interpolation.
10530/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__["a" /* default */]));
10531
10532
10533/***/ }),
10534/* 337 */
10535/***/ (function(module, __webpack_exports__, __webpack_require__) {
10536
10537"use strict";
10538/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__invert_js__ = __webpack_require__(186);
10539/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(199);
10540
10541
10542
10543// Internal list of HTML entities for unescaping.
10544/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__invert_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
10545
10546
10547/***/ }),
10548/* 338 */
10549/***/ (function(module, __webpack_exports__, __webpack_require__) {
10550
10551"use strict";
10552/* harmony export (immutable) */ __webpack_exports__["a"] = template;
10553/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__defaults_js__ = __webpack_require__(189);
10554/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__underscore_js__ = __webpack_require__(25);
10555/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__templateSettings_js__ = __webpack_require__(200);
10556
10557
10558
10559
10560// When customizing `_.templateSettings`, if you don't want to define an
10561// interpolation, evaluation or escaping regex, we need one that is
10562// guaranteed not to match.
10563var noMatch = /(.)^/;
10564
10565// Certain characters need to be escaped so that they can be put into a
10566// string literal.
10567var escapes = {
10568 "'": "'",
10569 '\\': '\\',
10570 '\r': 'r',
10571 '\n': 'n',
10572 '\u2028': 'u2028',
10573 '\u2029': 'u2029'
10574};
10575
10576var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g;
10577
10578function escapeChar(match) {
10579 return '\\' + escapes[match];
10580}
10581
10582var bareIdentifier = /^\s*(\w|\$)+\s*$/;
10583
10584// JavaScript micro-templating, similar to John Resig's implementation.
10585// Underscore templating handles arbitrary delimiters, preserves whitespace,
10586// and correctly escapes quotes within interpolated code.
10587// NB: `oldSettings` only exists for backwards compatibility.
10588function template(text, settings, oldSettings) {
10589 if (!settings && oldSettings) settings = oldSettings;
10590 settings = Object(__WEBPACK_IMPORTED_MODULE_0__defaults_js__["a" /* default */])({}, settings, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */].templateSettings);
10591
10592 // Combine delimiters into one regular expression via alternation.
10593 var matcher = RegExp([
10594 (settings.escape || noMatch).source,
10595 (settings.interpolate || noMatch).source,
10596 (settings.evaluate || noMatch).source
10597 ].join('|') + '|$', 'g');
10598
10599 // Compile the template source, escaping string literals appropriately.
10600 var index = 0;
10601 var source = "__p+='";
10602 text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
10603 source += text.slice(index, offset).replace(escapeRegExp, escapeChar);
10604 index = offset + match.length;
10605
10606 if (escape) {
10607 source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
10608 } else if (interpolate) {
10609 source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
10610 } else if (evaluate) {
10611 source += "';\n" + evaluate + "\n__p+='";
10612 }
10613
10614 // Adobe VMs need the match returned to produce the correct offset.
10615 return match;
10616 });
10617 source += "';\n";
10618
10619 var argument = settings.variable;
10620 if (argument) {
10621 if (!bareIdentifier.test(argument)) throw new Error(argument);
10622 } else {
10623 // If a variable is not specified, place data values in local scope.
10624 source = 'with(obj||{}){\n' + source + '}\n';
10625 argument = 'obj';
10626 }
10627
10628 source = "var __t,__p='',__j=Array.prototype.join," +
10629 "print=function(){__p+=__j.call(arguments,'');};\n" +
10630 source + 'return __p;\n';
10631
10632 var render;
10633 try {
10634 render = new Function(argument, '_', source);
10635 } catch (e) {
10636 e.source = source;
10637 throw e;
10638 }
10639
10640 var template = function(data) {
10641 return render.call(this, data, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */]);
10642 };
10643
10644 // Provide the compiled source as a convenience for precompilation.
10645 template.source = 'function(' + argument + '){\n' + source + '}';
10646
10647 return template;
10648}
10649
10650
10651/***/ }),
10652/* 339 */
10653/***/ (function(module, __webpack_exports__, __webpack_require__) {
10654
10655"use strict";
10656/* harmony export (immutable) */ __webpack_exports__["a"] = result;
10657/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(28);
10658/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(84);
10659
10660
10661
10662// Traverses the children of `obj` along `path`. If a child is a function, it
10663// is invoked with its parent as context. Returns the value of the final
10664// child, or `fallback` if any child is undefined.
10665function result(obj, path, fallback) {
10666 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
10667 var length = path.length;
10668 if (!length) {
10669 return Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(fallback) ? fallback.call(obj) : fallback;
10670 }
10671 for (var i = 0; i < length; i++) {
10672 var prop = obj == null ? void 0 : obj[path[i]];
10673 if (prop === void 0) {
10674 prop = fallback;
10675 i = length; // Ensure we don't continue iterating.
10676 }
10677 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(prop) ? prop.call(obj) : prop;
10678 }
10679 return obj;
10680}
10681
10682
10683/***/ }),
10684/* 340 */
10685/***/ (function(module, __webpack_exports__, __webpack_require__) {
10686
10687"use strict";
10688/* harmony export (immutable) */ __webpack_exports__["a"] = uniqueId;
10689// Generate a unique integer id (unique within the entire client session).
10690// Useful for temporary DOM ids.
10691var idCounter = 0;
10692function uniqueId(prefix) {
10693 var id = ++idCounter + '';
10694 return prefix ? prefix + id : id;
10695}
10696
10697
10698/***/ }),
10699/* 341 */
10700/***/ (function(module, __webpack_exports__, __webpack_require__) {
10701
10702"use strict";
10703/* harmony export (immutable) */ __webpack_exports__["a"] = chain;
10704/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
10705
10706
10707// Start chaining a wrapped Underscore object.
10708function chain(obj) {
10709 var instance = Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj);
10710 instance._chain = true;
10711 return instance;
10712}
10713
10714
10715/***/ }),
10716/* 342 */
10717/***/ (function(module, __webpack_exports__, __webpack_require__) {
10718
10719"use strict";
10720/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
10721/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(67);
10722/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bind_js__ = __webpack_require__(202);
10723
10724
10725
10726
10727// Bind a number of an object's methods to that object. Remaining arguments
10728// are the method names to be bound. Useful for ensuring that all callbacks
10729// defined on an object belong to it.
10730/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
10731 keys = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(keys, false, false);
10732 var index = keys.length;
10733 if (index < 1) throw new Error('bindAll must be passed function names');
10734 while (index--) {
10735 var key = keys[index];
10736 obj[key] = Object(__WEBPACK_IMPORTED_MODULE_2__bind_js__["a" /* default */])(obj[key], obj);
10737 }
10738 return obj;
10739}));
10740
10741
10742/***/ }),
10743/* 343 */
10744/***/ (function(module, __webpack_exports__, __webpack_require__) {
10745
10746"use strict";
10747/* harmony export (immutable) */ __webpack_exports__["a"] = memoize;
10748/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(45);
10749
10750
10751// Memoize an expensive function by storing its results.
10752function memoize(func, hasher) {
10753 var memoize = function(key) {
10754 var cache = memoize.cache;
10755 var address = '' + (hasher ? hasher.apply(this, arguments) : key);
10756 if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(cache, address)) cache[address] = func.apply(this, arguments);
10757 return cache[address];
10758 };
10759 memoize.cache = {};
10760 return memoize;
10761}
10762
10763
10764/***/ }),
10765/* 344 */
10766/***/ (function(module, __webpack_exports__, __webpack_require__) {
10767
10768"use strict";
10769/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(111);
10770/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__delay_js__ = __webpack_require__(203);
10771/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(25);
10772
10773
10774
10775
10776// Defers a function, scheduling it to run after the current call stack has
10777// cleared.
10778/* 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));
10779
10780
10781/***/ }),
10782/* 345 */
10783/***/ (function(module, __webpack_exports__, __webpack_require__) {
10784
10785"use strict";
10786/* harmony export (immutable) */ __webpack_exports__["a"] = throttle;
10787/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__now_js__ = __webpack_require__(142);
10788
10789
10790// Returns a function, that, when invoked, will only be triggered at most once
10791// during a given window of time. Normally, the throttled function will run
10792// as much as it can, without ever going more than once per `wait` duration;
10793// but if you'd like to disable the execution on the leading edge, pass
10794// `{leading: false}`. To disable execution on the trailing edge, ditto.
10795function throttle(func, wait, options) {
10796 var timeout, context, args, result;
10797 var previous = 0;
10798 if (!options) options = {};
10799
10800 var later = function() {
10801 previous = options.leading === false ? 0 : Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
10802 timeout = null;
10803 result = func.apply(context, args);
10804 if (!timeout) context = args = null;
10805 };
10806
10807 var throttled = function() {
10808 var _now = Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
10809 if (!previous && options.leading === false) previous = _now;
10810 var remaining = wait - (_now - previous);
10811 context = this;
10812 args = arguments;
10813 if (remaining <= 0 || remaining > wait) {
10814 if (timeout) {
10815 clearTimeout(timeout);
10816 timeout = null;
10817 }
10818 previous = _now;
10819 result = func.apply(context, args);
10820 if (!timeout) context = args = null;
10821 } else if (!timeout && options.trailing !== false) {
10822 timeout = setTimeout(later, remaining);
10823 }
10824 return result;
10825 };
10826
10827 throttled.cancel = function() {
10828 clearTimeout(timeout);
10829 previous = 0;
10830 timeout = context = args = null;
10831 };
10832
10833 return throttled;
10834}
10835
10836
10837/***/ }),
10838/* 346 */
10839/***/ (function(module, __webpack_exports__, __webpack_require__) {
10840
10841"use strict";
10842/* harmony export (immutable) */ __webpack_exports__["a"] = debounce;
10843/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
10844/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__now_js__ = __webpack_require__(142);
10845
10846
10847
10848// When a sequence of calls of the returned function ends, the argument
10849// function is triggered. The end of a sequence is defined by the `wait`
10850// parameter. If `immediate` is passed, the argument function will be
10851// triggered at the beginning of the sequence instead of at the end.
10852function debounce(func, wait, immediate) {
10853 var timeout, previous, args, result, context;
10854
10855 var later = function() {
10856 var passed = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])() - previous;
10857 if (wait > passed) {
10858 timeout = setTimeout(later, wait - passed);
10859 } else {
10860 timeout = null;
10861 if (!immediate) result = func.apply(context, args);
10862 // This check is needed because `func` can recursively invoke `debounced`.
10863 if (!timeout) args = context = null;
10864 }
10865 };
10866
10867 var debounced = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(_args) {
10868 context = this;
10869 args = _args;
10870 previous = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])();
10871 if (!timeout) {
10872 timeout = setTimeout(later, wait);
10873 if (immediate) result = func.apply(context, args);
10874 }
10875 return result;
10876 });
10877
10878 debounced.cancel = function() {
10879 clearTimeout(timeout);
10880 timeout = args = context = null;
10881 };
10882
10883 return debounced;
10884}
10885
10886
10887/***/ }),
10888/* 347 */
10889/***/ (function(module, __webpack_exports__, __webpack_require__) {
10890
10891"use strict";
10892/* harmony export (immutable) */ __webpack_exports__["a"] = wrap;
10893/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(111);
10894
10895
10896// Returns the first function passed as an argument to the second,
10897// allowing you to adjust arguments, run code before and after, and
10898// conditionally execute the original function.
10899function wrap(func, wrapper) {
10900 return Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(wrapper, func);
10901}
10902
10903
10904/***/ }),
10905/* 348 */
10906/***/ (function(module, __webpack_exports__, __webpack_require__) {
10907
10908"use strict";
10909/* harmony export (immutable) */ __webpack_exports__["a"] = compose;
10910// Returns a function that is the composition of a list of functions, each
10911// consuming the return value of the function that follows.
10912function compose() {
10913 var args = arguments;
10914 var start = args.length - 1;
10915 return function() {
10916 var i = start;
10917 var result = args[start].apply(this, arguments);
10918 while (i--) result = args[i].call(this, result);
10919 return result;
10920 };
10921}
10922
10923
10924/***/ }),
10925/* 349 */
10926/***/ (function(module, __webpack_exports__, __webpack_require__) {
10927
10928"use strict";
10929/* harmony export (immutable) */ __webpack_exports__["a"] = after;
10930// Returns a function that will only be executed on and after the Nth call.
10931function after(times, func) {
10932 return function() {
10933 if (--times < 1) {
10934 return func.apply(this, arguments);
10935 }
10936 };
10937}
10938
10939
10940/***/ }),
10941/* 350 */
10942/***/ (function(module, __webpack_exports__, __webpack_require__) {
10943
10944"use strict";
10945/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(111);
10946/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__before_js__ = __webpack_require__(204);
10947
10948
10949
10950// Returns a function that will be executed at most one time, no matter how
10951// often you call it. Useful for lazy initialization.
10952/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__before_js__["a" /* default */], 2));
10953
10954
10955/***/ }),
10956/* 351 */
10957/***/ (function(module, __webpack_exports__, __webpack_require__) {
10958
10959"use strict";
10960/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__ = __webpack_require__(207);
10961/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__ = __webpack_require__(210);
10962
10963
10964
10965// Return the position of the last occurrence of an item in an array,
10966// or -1 if the item is not included in the array.
10967/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__["a" /* default */])(-1, __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__["a" /* default */]));
10968
10969
10970/***/ }),
10971/* 352 */
10972/***/ (function(module, __webpack_exports__, __webpack_require__) {
10973
10974"use strict";
10975/* harmony export (immutable) */ __webpack_exports__["a"] = findWhere;
10976/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__find_js__ = __webpack_require__(211);
10977/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(110);
10978
10979
10980
10981// Convenience version of a common use case of `_.find`: getting the first
10982// object containing specific `key:value` pairs.
10983function findWhere(obj, attrs) {
10984 return Object(__WEBPACK_IMPORTED_MODULE_0__find_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
10985}
10986
10987
10988/***/ }),
10989/* 353 */
10990/***/ (function(module, __webpack_exports__, __webpack_require__) {
10991
10992"use strict";
10993/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(212);
10994
10995
10996// **Reduce** builds up a single result from a list of values, aka `inject`,
10997// or `foldl`.
10998/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(1));
10999
11000
11001/***/ }),
11002/* 354 */
11003/***/ (function(module, __webpack_exports__, __webpack_require__) {
11004
11005"use strict";
11006/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(212);
11007
11008
11009// The right-associative version of reduce, also known as `foldr`.
11010/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(-1));
11011
11012
11013/***/ }),
11014/* 355 */
11015/***/ (function(module, __webpack_exports__, __webpack_require__) {
11016
11017"use strict";
11018/* harmony export (immutable) */ __webpack_exports__["a"] = reject;
11019/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(86);
11020/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__negate_js__ = __webpack_require__(143);
11021/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(21);
11022
11023
11024
11025
11026// Return all the elements for which a truth test fails.
11027function reject(obj, predicate, context) {
11028 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);
11029}
11030
11031
11032/***/ }),
11033/* 356 */
11034/***/ (function(module, __webpack_exports__, __webpack_require__) {
11035
11036"use strict";
11037/* harmony export (immutable) */ __webpack_exports__["a"] = every;
11038/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
11039/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
11040/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16);
11041
11042
11043
11044
11045// Determine whether all of the elements pass a truth test.
11046function every(obj, predicate, context) {
11047 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
11048 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
11049 length = (_keys || obj).length;
11050 for (var index = 0; index < length; index++) {
11051 var currentKey = _keys ? _keys[index] : index;
11052 if (!predicate(obj[currentKey], currentKey, obj)) return false;
11053 }
11054 return true;
11055}
11056
11057
11058/***/ }),
11059/* 357 */
11060/***/ (function(module, __webpack_exports__, __webpack_require__) {
11061
11062"use strict";
11063/* harmony export (immutable) */ __webpack_exports__["a"] = some;
11064/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
11065/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
11066/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16);
11067
11068
11069
11070
11071// Determine if at least one element in the object passes a truth test.
11072function some(obj, predicate, context) {
11073 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
11074 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
11075 length = (_keys || obj).length;
11076 for (var index = 0; index < length; index++) {
11077 var currentKey = _keys ? _keys[index] : index;
11078 if (predicate(obj[currentKey], currentKey, obj)) return true;
11079 }
11080 return false;
11081}
11082
11083
11084/***/ }),
11085/* 358 */
11086/***/ (function(module, __webpack_exports__, __webpack_require__) {
11087
11088"use strict";
11089/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11090/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
11091/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(68);
11092/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__deepGet_js__ = __webpack_require__(139);
11093/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__toPath_js__ = __webpack_require__(84);
11094
11095
11096
11097
11098
11099
11100// Invoke a method (with arguments) on every item in a collection.
11101/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, path, args) {
11102 var contextPath, func;
11103 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(path)) {
11104 func = path;
11105 } else {
11106 path = Object(__WEBPACK_IMPORTED_MODULE_4__toPath_js__["a" /* default */])(path);
11107 contextPath = path.slice(0, -1);
11108 path = path[path.length - 1];
11109 }
11110 return Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(context) {
11111 var method = func;
11112 if (!method) {
11113 if (contextPath && contextPath.length) {
11114 context = Object(__WEBPACK_IMPORTED_MODULE_3__deepGet_js__["a" /* default */])(context, contextPath);
11115 }
11116 if (context == null) return void 0;
11117 method = context[path];
11118 }
11119 return method == null ? method : method.apply(context, args);
11120 });
11121}));
11122
11123
11124/***/ }),
11125/* 359 */
11126/***/ (function(module, __webpack_exports__, __webpack_require__) {
11127
11128"use strict";
11129/* harmony export (immutable) */ __webpack_exports__["a"] = where;
11130/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(86);
11131/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(110);
11132
11133
11134
11135// Convenience version of a common use case of `_.filter`: selecting only
11136// objects containing specific `key:value` pairs.
11137function where(obj, attrs) {
11138 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
11139}
11140
11141
11142/***/ }),
11143/* 360 */
11144/***/ (function(module, __webpack_exports__, __webpack_require__) {
11145
11146"use strict";
11147/* harmony export (immutable) */ __webpack_exports__["a"] = min;
11148/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
11149/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(66);
11150/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(21);
11151/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(56);
11152
11153
11154
11155
11156
11157// Return the minimum element (or element-based computation).
11158function min(obj, iteratee, context) {
11159 var result = Infinity, lastComputed = Infinity,
11160 value, computed;
11161 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
11162 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
11163 for (var i = 0, length = obj.length; i < length; i++) {
11164 value = obj[i];
11165 if (value != null && value < result) {
11166 result = value;
11167 }
11168 }
11169 } else {
11170 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
11171 Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
11172 computed = iteratee(v, index, list);
11173 if (computed < lastComputed || computed === Infinity && result === Infinity) {
11174 result = v;
11175 lastComputed = computed;
11176 }
11177 });
11178 }
11179 return result;
11180}
11181
11182
11183/***/ }),
11184/* 361 */
11185/***/ (function(module, __webpack_exports__, __webpack_require__) {
11186
11187"use strict";
11188/* harmony export (immutable) */ __webpack_exports__["a"] = shuffle;
11189/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sample_js__ = __webpack_require__(214);
11190
11191
11192// Shuffle a collection.
11193function shuffle(obj) {
11194 return Object(__WEBPACK_IMPORTED_MODULE_0__sample_js__["a" /* default */])(obj, Infinity);
11195}
11196
11197
11198/***/ }),
11199/* 362 */
11200/***/ (function(module, __webpack_exports__, __webpack_require__) {
11201
11202"use strict";
11203/* harmony export (immutable) */ __webpack_exports__["a"] = sortBy;
11204/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
11205/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__pluck_js__ = __webpack_require__(145);
11206/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(68);
11207
11208
11209
11210
11211// Sort the object's values by a criterion produced by an iteratee.
11212function sortBy(obj, iteratee, context) {
11213 var index = 0;
11214 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
11215 return Object(__WEBPACK_IMPORTED_MODULE_1__pluck_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(value, key, list) {
11216 return {
11217 value: value,
11218 index: index++,
11219 criteria: iteratee(value, key, list)
11220 };
11221 }).sort(function(left, right) {
11222 var a = left.criteria;
11223 var b = right.criteria;
11224 if (a !== b) {
11225 if (a > b || a === void 0) return 1;
11226 if (a < b || b === void 0) return -1;
11227 }
11228 return left.index - right.index;
11229 }), 'value');
11230}
11231
11232
11233/***/ }),
11234/* 363 */
11235/***/ (function(module, __webpack_exports__, __webpack_require__) {
11236
11237"use strict";
11238/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(112);
11239/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(45);
11240
11241
11242
11243// Groups the object's values by a criterion. Pass either a string attribute
11244// to group by, or a function that returns the criterion.
11245/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
11246 if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key].push(value); else result[key] = [value];
11247}));
11248
11249
11250/***/ }),
11251/* 364 */
11252/***/ (function(module, __webpack_exports__, __webpack_require__) {
11253
11254"use strict";
11255/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(112);
11256
11257
11258// Indexes the object's values by a criterion, similar to `_.groupBy`, but for
11259// when you know that your index values will be unique.
11260/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
11261 result[key] = value;
11262}));
11263
11264
11265/***/ }),
11266/* 365 */
11267/***/ (function(module, __webpack_exports__, __webpack_require__) {
11268
11269"use strict";
11270/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(112);
11271/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(45);
11272
11273
11274
11275// Counts instances of an object that group by a certain criterion. Pass
11276// either a string attribute to count by, or a function that returns the
11277// criterion.
11278/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
11279 if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key]++; else result[key] = 1;
11280}));
11281
11282
11283/***/ }),
11284/* 366 */
11285/***/ (function(module, __webpack_exports__, __webpack_require__) {
11286
11287"use strict";
11288/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(112);
11289
11290
11291// Split a collection into two arrays: one whose elements all pass the given
11292// truth test, and one whose elements all do not pass the truth test.
11293/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, pass) {
11294 result[pass ? 0 : 1].push(value);
11295}, true));
11296
11297
11298/***/ }),
11299/* 367 */
11300/***/ (function(module, __webpack_exports__, __webpack_require__) {
11301
11302"use strict";
11303/* harmony export (immutable) */ __webpack_exports__["a"] = toArray;
11304/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArray_js__ = __webpack_require__(55);
11305/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(5);
11306/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(132);
11307/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArrayLike_js__ = __webpack_require__(26);
11308/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__map_js__ = __webpack_require__(68);
11309/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__identity_js__ = __webpack_require__(140);
11310/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__values_js__ = __webpack_require__(66);
11311
11312
11313
11314
11315
11316
11317
11318
11319// Safely create a real, live array from anything iterable.
11320var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
11321function toArray(obj) {
11322 if (!obj) return [];
11323 if (Object(__WEBPACK_IMPORTED_MODULE_0__isArray_js__["a" /* default */])(obj)) return __WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(obj);
11324 if (Object(__WEBPACK_IMPORTED_MODULE_2__isString_js__["a" /* default */])(obj)) {
11325 // Keep surrogate pair characters together.
11326 return obj.match(reStrSymbol);
11327 }
11328 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 */]);
11329 return Object(__WEBPACK_IMPORTED_MODULE_6__values_js__["a" /* default */])(obj);
11330}
11331
11332
11333/***/ }),
11334/* 368 */
11335/***/ (function(module, __webpack_exports__, __webpack_require__) {
11336
11337"use strict";
11338/* harmony export (immutable) */ __webpack_exports__["a"] = size;
11339/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
11340/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
11341
11342
11343
11344// Return the number of elements in a collection.
11345function size(obj) {
11346 if (obj == null) return 0;
11347 return Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj.length : Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj).length;
11348}
11349
11350
11351/***/ }),
11352/* 369 */
11353/***/ (function(module, __webpack_exports__, __webpack_require__) {
11354
11355"use strict";
11356/* harmony export (immutable) */ __webpack_exports__["a"] = keyInObj;
11357// Internal `_.pick` helper function to determine whether `key` is an enumerable
11358// property name of `obj`.
11359function keyInObj(value, key, obj) {
11360 return key in obj;
11361}
11362
11363
11364/***/ }),
11365/* 370 */
11366/***/ (function(module, __webpack_exports__, __webpack_require__) {
11367
11368"use strict";
11369/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11370/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
11371/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__negate_js__ = __webpack_require__(143);
11372/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__map_js__ = __webpack_require__(68);
11373/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__flatten_js__ = __webpack_require__(67);
11374/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__contains_js__ = __webpack_require__(87);
11375/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__pick_js__ = __webpack_require__(215);
11376
11377
11378
11379
11380
11381
11382
11383
11384// Return a copy of the object without the disallowed properties.
11385/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
11386 var iteratee = keys[0], context;
11387 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
11388 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__negate_js__["a" /* default */])(iteratee);
11389 if (keys.length > 1) context = keys[1];
11390 } else {
11391 keys = Object(__WEBPACK_IMPORTED_MODULE_3__map_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__flatten_js__["a" /* default */])(keys, false, false), String);
11392 iteratee = function(value, key) {
11393 return !Object(__WEBPACK_IMPORTED_MODULE_5__contains_js__["a" /* default */])(keys, key);
11394 };
11395 }
11396 return Object(__WEBPACK_IMPORTED_MODULE_6__pick_js__["a" /* default */])(obj, iteratee, context);
11397}));
11398
11399
11400/***/ }),
11401/* 371 */
11402/***/ (function(module, __webpack_exports__, __webpack_require__) {
11403
11404"use strict";
11405/* harmony export (immutable) */ __webpack_exports__["a"] = first;
11406/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__initial_js__ = __webpack_require__(216);
11407
11408
11409// Get the first element of an array. Passing **n** will return the first N
11410// values in the array. The **guard** check allows it to work with `_.map`.
11411function first(array, n, guard) {
11412 if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
11413 if (n == null || guard) return array[0];
11414 return Object(__WEBPACK_IMPORTED_MODULE_0__initial_js__["a" /* default */])(array, array.length - n);
11415}
11416
11417
11418/***/ }),
11419/* 372 */
11420/***/ (function(module, __webpack_exports__, __webpack_require__) {
11421
11422"use strict";
11423/* harmony export (immutable) */ __webpack_exports__["a"] = last;
11424/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__rest_js__ = __webpack_require__(217);
11425
11426
11427// Get the last element of an array. Passing **n** will return the last N
11428// values in the array.
11429function last(array, n, guard) {
11430 if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
11431 if (n == null || guard) return array[array.length - 1];
11432 return Object(__WEBPACK_IMPORTED_MODULE_0__rest_js__["a" /* default */])(array, Math.max(0, array.length - n));
11433}
11434
11435
11436/***/ }),
11437/* 373 */
11438/***/ (function(module, __webpack_exports__, __webpack_require__) {
11439
11440"use strict";
11441/* harmony export (immutable) */ __webpack_exports__["a"] = compact;
11442/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(86);
11443
11444
11445// Trim out all falsy values from an array.
11446function compact(array) {
11447 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(array, Boolean);
11448}
11449
11450
11451/***/ }),
11452/* 374 */
11453/***/ (function(module, __webpack_exports__, __webpack_require__) {
11454
11455"use strict";
11456/* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
11457/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__flatten_js__ = __webpack_require__(67);
11458
11459
11460// Flatten out an array, either recursively (by default), or up to `depth`.
11461// Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively.
11462function flatten(array, depth) {
11463 return Object(__WEBPACK_IMPORTED_MODULE_0__flatten_js__["a" /* default */])(array, depth, false);
11464}
11465
11466
11467/***/ }),
11468/* 375 */
11469/***/ (function(module, __webpack_exports__, __webpack_require__) {
11470
11471"use strict";
11472/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11473/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__difference_js__ = __webpack_require__(218);
11474
11475
11476
11477// Return a version of the array that does not contain the specified value(s).
11478/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, otherArrays) {
11479 return Object(__WEBPACK_IMPORTED_MODULE_1__difference_js__["a" /* default */])(array, otherArrays);
11480}));
11481
11482
11483/***/ }),
11484/* 376 */
11485/***/ (function(module, __webpack_exports__, __webpack_require__) {
11486
11487"use strict";
11488/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11489/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__uniq_js__ = __webpack_require__(219);
11490/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__flatten_js__ = __webpack_require__(67);
11491
11492
11493
11494
11495// Produce an array that contains the union: each distinct element from all of
11496// the passed-in arrays.
11497/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(arrays) {
11498 return Object(__WEBPACK_IMPORTED_MODULE_1__uniq_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__flatten_js__["a" /* default */])(arrays, true, true));
11499}));
11500
11501
11502/***/ }),
11503/* 377 */
11504/***/ (function(module, __webpack_exports__, __webpack_require__) {
11505
11506"use strict";
11507/* harmony export (immutable) */ __webpack_exports__["a"] = intersection;
11508/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
11509/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__contains_js__ = __webpack_require__(87);
11510
11511
11512
11513// Produce an array that contains every item shared between all the
11514// passed-in arrays.
11515function intersection(array) {
11516 var result = [];
11517 var argsLength = arguments.length;
11518 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array); i < length; i++) {
11519 var item = array[i];
11520 if (Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(result, item)) continue;
11521 var j;
11522 for (j = 1; j < argsLength; j++) {
11523 if (!Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(arguments[j], item)) break;
11524 }
11525 if (j === argsLength) result.push(item);
11526 }
11527 return result;
11528}
11529
11530
11531/***/ }),
11532/* 378 */
11533/***/ (function(module, __webpack_exports__, __webpack_require__) {
11534
11535"use strict";
11536/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11537/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unzip_js__ = __webpack_require__(220);
11538
11539
11540
11541// Zip together multiple lists into a single array -- elements that share
11542// an index go together.
11543/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unzip_js__["a" /* default */]));
11544
11545
11546/***/ }),
11547/* 379 */
11548/***/ (function(module, __webpack_exports__, __webpack_require__) {
11549
11550"use strict";
11551/* harmony export (immutable) */ __webpack_exports__["a"] = object;
11552/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
11553
11554
11555// Converts lists into objects. Pass either a single array of `[key, value]`
11556// pairs, or two parallel arrays of the same length -- one of keys, and one of
11557// the corresponding values. Passing by pairs is the reverse of `_.pairs`.
11558function object(list, values) {
11559 var result = {};
11560 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(list); i < length; i++) {
11561 if (values) {
11562 result[list[i]] = values[i];
11563 } else {
11564 result[list[i][0]] = list[i][1];
11565 }
11566 }
11567 return result;
11568}
11569
11570
11571/***/ }),
11572/* 380 */
11573/***/ (function(module, __webpack_exports__, __webpack_require__) {
11574
11575"use strict";
11576/* harmony export (immutable) */ __webpack_exports__["a"] = range;
11577// Generate an integer Array containing an arithmetic progression. A port of
11578// the native Python `range()` function. See
11579// [the Python documentation](https://docs.python.org/library/functions.html#range).
11580function range(start, stop, step) {
11581 if (stop == null) {
11582 stop = start || 0;
11583 start = 0;
11584 }
11585 if (!step) {
11586 step = stop < start ? -1 : 1;
11587 }
11588
11589 var length = Math.max(Math.ceil((stop - start) / step), 0);
11590 var range = Array(length);
11591
11592 for (var idx = 0; idx < length; idx++, start += step) {
11593 range[idx] = start;
11594 }
11595
11596 return range;
11597}
11598
11599
11600/***/ }),
11601/* 381 */
11602/***/ (function(module, __webpack_exports__, __webpack_require__) {
11603
11604"use strict";
11605/* harmony export (immutable) */ __webpack_exports__["a"] = chunk;
11606/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(5);
11607
11608
11609// Chunk a single array into multiple arrays, each containing `count` or fewer
11610// items.
11611function chunk(array, count) {
11612 if (count == null || count < 1) return [];
11613 var result = [];
11614 var i = 0, length = array.length;
11615 while (i < length) {
11616 result.push(__WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, i, i += count));
11617 }
11618 return result;
11619}
11620
11621
11622/***/ }),
11623/* 382 */
11624/***/ (function(module, __webpack_exports__, __webpack_require__) {
11625
11626"use strict";
11627/* harmony export (immutable) */ __webpack_exports__["a"] = mixin;
11628/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
11629/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(56);
11630/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__functions_js__ = __webpack_require__(187);
11631/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__setup_js__ = __webpack_require__(5);
11632/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__chainResult_js__ = __webpack_require__(221);
11633
11634
11635
11636
11637
11638
11639// Add your own custom functions to the Underscore object.
11640function mixin(obj) {
11641 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__functions_js__["a" /* default */])(obj), function(name) {
11642 var func = __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */][name] = obj[name];
11643 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
11644 var args = [this._wrapped];
11645 __WEBPACK_IMPORTED_MODULE_3__setup_js__["o" /* push */].apply(args, arguments);
11646 return Object(__WEBPACK_IMPORTED_MODULE_4__chainResult_js__["a" /* default */])(this, func.apply(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */], args));
11647 };
11648 });
11649 return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */];
11650}
11651
11652
11653/***/ }),
11654/* 383 */
11655/***/ (function(module, __webpack_exports__, __webpack_require__) {
11656
11657"use strict";
11658/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
11659/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(56);
11660/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__setup_js__ = __webpack_require__(5);
11661/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__chainResult_js__ = __webpack_require__(221);
11662
11663
11664
11665
11666
11667// Add all mutator `Array` functions to the wrapper.
11668Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
11669 var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
11670 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
11671 var obj = this._wrapped;
11672 if (obj != null) {
11673 method.apply(obj, arguments);
11674 if ((name === 'shift' || name === 'splice') && obj.length === 0) {
11675 delete obj[0];
11676 }
11677 }
11678 return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
11679 };
11680});
11681
11682// Add all accessor `Array` functions to the wrapper.
11683Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['concat', 'join', 'slice'], function(name) {
11684 var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
11685 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
11686 var obj = this._wrapped;
11687 if (obj != null) obj = method.apply(obj, arguments);
11688 return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
11689 };
11690});
11691
11692/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]);
11693
11694
11695/***/ }),
11696/* 384 */
11697/***/ (function(module, exports, __webpack_require__) {
11698
11699var parent = __webpack_require__(385);
11700
11701module.exports = parent;
11702
11703
11704/***/ }),
11705/* 385 */
11706/***/ (function(module, exports, __webpack_require__) {
11707
11708var isPrototypeOf = __webpack_require__(19);
11709var method = __webpack_require__(386);
11710
11711var ArrayPrototype = Array.prototype;
11712
11713module.exports = function (it) {
11714 var own = it.concat;
11715 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.concat) ? method : own;
11716};
11717
11718
11719/***/ }),
11720/* 386 */
11721/***/ (function(module, exports, __webpack_require__) {
11722
11723__webpack_require__(222);
11724var entryVirtual = __webpack_require__(38);
11725
11726module.exports = entryVirtual('Array').concat;
11727
11728
11729/***/ }),
11730/* 387 */
11731/***/ (function(module, exports) {
11732
11733var $TypeError = TypeError;
11734var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
11735
11736module.exports = function (it) {
11737 if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
11738 return it;
11739};
11740
11741
11742/***/ }),
11743/* 388 */
11744/***/ (function(module, exports, __webpack_require__) {
11745
11746var isArray = __webpack_require__(88);
11747var isConstructor = __webpack_require__(108);
11748var isObject = __webpack_require__(11);
11749var wellKnownSymbol = __webpack_require__(9);
11750
11751var SPECIES = wellKnownSymbol('species');
11752var $Array = Array;
11753
11754// a part of `ArraySpeciesCreate` abstract operation
11755// https://tc39.es/ecma262/#sec-arrayspeciescreate
11756module.exports = function (originalArray) {
11757 var C;
11758 if (isArray(originalArray)) {
11759 C = originalArray.constructor;
11760 // cross-realm fallback
11761 if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined;
11762 else if (isObject(C)) {
11763 C = C[SPECIES];
11764 if (C === null) C = undefined;
11765 }
11766 } return C === undefined ? $Array : C;
11767};
11768
11769
11770/***/ }),
11771/* 389 */
11772/***/ (function(module, exports, __webpack_require__) {
11773
11774var parent = __webpack_require__(390);
11775
11776module.exports = parent;
11777
11778
11779/***/ }),
11780/* 390 */
11781/***/ (function(module, exports, __webpack_require__) {
11782
11783var isPrototypeOf = __webpack_require__(19);
11784var method = __webpack_require__(391);
11785
11786var ArrayPrototype = Array.prototype;
11787
11788module.exports = function (it) {
11789 var own = it.map;
11790 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.map) ? method : own;
11791};
11792
11793
11794/***/ }),
11795/* 391 */
11796/***/ (function(module, exports, __webpack_require__) {
11797
11798__webpack_require__(392);
11799var entryVirtual = __webpack_require__(38);
11800
11801module.exports = entryVirtual('Array').map;
11802
11803
11804/***/ }),
11805/* 392 */
11806/***/ (function(module, exports, __webpack_require__) {
11807
11808"use strict";
11809
11810var $ = __webpack_require__(0);
11811var $map = __webpack_require__(70).map;
11812var arrayMethodHasSpeciesSupport = __webpack_require__(113);
11813
11814var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');
11815
11816// `Array.prototype.map` method
11817// https://tc39.es/ecma262/#sec-array.prototype.map
11818// with adding support of @@species
11819$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
11820 map: function map(callbackfn /* , thisArg */) {
11821 return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
11822 }
11823});
11824
11825
11826/***/ }),
11827/* 393 */
11828/***/ (function(module, exports, __webpack_require__) {
11829
11830var parent = __webpack_require__(394);
11831
11832module.exports = parent;
11833
11834
11835/***/ }),
11836/* 394 */
11837/***/ (function(module, exports, __webpack_require__) {
11838
11839__webpack_require__(395);
11840var path = __webpack_require__(6);
11841
11842module.exports = path.Object.keys;
11843
11844
11845/***/ }),
11846/* 395 */
11847/***/ (function(module, exports, __webpack_require__) {
11848
11849var $ = __webpack_require__(0);
11850var toObject = __webpack_require__(34);
11851var nativeKeys = __webpack_require__(104);
11852var fails = __webpack_require__(2);
11853
11854var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); });
11855
11856// `Object.keys` method
11857// https://tc39.es/ecma262/#sec-object.keys
11858$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
11859 keys: function keys(it) {
11860 return nativeKeys(toObject(it));
11861 }
11862});
11863
11864
11865/***/ }),
11866/* 396 */
11867/***/ (function(module, exports, __webpack_require__) {
11868
11869var parent = __webpack_require__(397);
11870
11871module.exports = parent;
11872
11873
11874/***/ }),
11875/* 397 */
11876/***/ (function(module, exports, __webpack_require__) {
11877
11878__webpack_require__(224);
11879var path = __webpack_require__(6);
11880var apply = __webpack_require__(73);
11881
11882// eslint-disable-next-line es-x/no-json -- safe
11883if (!path.JSON) path.JSON = { stringify: JSON.stringify };
11884
11885// eslint-disable-next-line no-unused-vars -- required for `.length`
11886module.exports = function stringify(it, replacer, space) {
11887 return apply(path.JSON.stringify, null, arguments);
11888};
11889
11890
11891/***/ }),
11892/* 398 */
11893/***/ (function(module, exports, __webpack_require__) {
11894
11895var parent = __webpack_require__(399);
11896
11897module.exports = parent;
11898
11899
11900/***/ }),
11901/* 399 */
11902/***/ (function(module, exports, __webpack_require__) {
11903
11904var isPrototypeOf = __webpack_require__(19);
11905var method = __webpack_require__(400);
11906
11907var ArrayPrototype = Array.prototype;
11908
11909module.exports = function (it) {
11910 var own = it.indexOf;
11911 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.indexOf) ? method : own;
11912};
11913
11914
11915/***/ }),
11916/* 400 */
11917/***/ (function(module, exports, __webpack_require__) {
11918
11919__webpack_require__(401);
11920var entryVirtual = __webpack_require__(38);
11921
11922module.exports = entryVirtual('Array').indexOf;
11923
11924
11925/***/ }),
11926/* 401 */
11927/***/ (function(module, exports, __webpack_require__) {
11928
11929"use strict";
11930
11931/* eslint-disable es-x/no-array-prototype-indexof -- required for testing */
11932var $ = __webpack_require__(0);
11933var uncurryThis = __webpack_require__(4);
11934var $IndexOf = __webpack_require__(158).indexOf;
11935var arrayMethodIsStrict = __webpack_require__(225);
11936
11937var un$IndexOf = uncurryThis([].indexOf);
11938
11939var NEGATIVE_ZERO = !!un$IndexOf && 1 / un$IndexOf([1], 1, -0) < 0;
11940var STRICT_METHOD = arrayMethodIsStrict('indexOf');
11941
11942// `Array.prototype.indexOf` method
11943// https://tc39.es/ecma262/#sec-array.prototype.indexof
11944$({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {
11945 indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
11946 var fromIndex = arguments.length > 1 ? arguments[1] : undefined;
11947 return NEGATIVE_ZERO
11948 // convert -0 to +0
11949 ? un$IndexOf(this, searchElement, fromIndex) || 0
11950 : $IndexOf(this, searchElement, fromIndex);
11951 }
11952});
11953
11954
11955/***/ }),
11956/* 402 */
11957/***/ (function(module, exports, __webpack_require__) {
11958
11959__webpack_require__(44);
11960var classof = __webpack_require__(51);
11961var hasOwn = __webpack_require__(12);
11962var isPrototypeOf = __webpack_require__(19);
11963var method = __webpack_require__(403);
11964
11965var ArrayPrototype = Array.prototype;
11966
11967var DOMIterables = {
11968 DOMTokenList: true,
11969 NodeList: true
11970};
11971
11972module.exports = function (it) {
11973 var own = it.keys;
11974 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.keys)
11975 || hasOwn(DOMIterables, classof(it)) ? method : own;
11976};
11977
11978
11979/***/ }),
11980/* 403 */
11981/***/ (function(module, exports, __webpack_require__) {
11982
11983var parent = __webpack_require__(404);
11984
11985module.exports = parent;
11986
11987
11988/***/ }),
11989/* 404 */
11990/***/ (function(module, exports, __webpack_require__) {
11991
11992__webpack_require__(41);
11993__webpack_require__(63);
11994var entryVirtual = __webpack_require__(38);
11995
11996module.exports = entryVirtual('Array').keys;
11997
11998
11999/***/ }),
12000/* 405 */
12001/***/ (function(module, exports) {
12002
12003// Unique ID creation requires a high quality random # generator. In the
12004// browser this is a little complicated due to unknown quality of Math.random()
12005// and inconsistent support for the `crypto` API. We do the best we can via
12006// feature-detection
12007
12008// getRandomValues needs to be invoked in a context where "this" is a Crypto
12009// implementation. Also, find the complete implementation of crypto on IE11.
12010var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
12011 (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
12012
12013if (getRandomValues) {
12014 // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
12015 var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
12016
12017 module.exports = function whatwgRNG() {
12018 getRandomValues(rnds8);
12019 return rnds8;
12020 };
12021} else {
12022 // Math.random()-based (RNG)
12023 //
12024 // If all else fails, use Math.random(). It's fast, but is of unspecified
12025 // quality.
12026 var rnds = new Array(16);
12027
12028 module.exports = function mathRNG() {
12029 for (var i = 0, r; i < 16; i++) {
12030 if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
12031 rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
12032 }
12033
12034 return rnds;
12035 };
12036}
12037
12038
12039/***/ }),
12040/* 406 */
12041/***/ (function(module, exports) {
12042
12043/**
12044 * Convert array of 16 byte values to UUID string format of the form:
12045 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
12046 */
12047var byteToHex = [];
12048for (var i = 0; i < 256; ++i) {
12049 byteToHex[i] = (i + 0x100).toString(16).substr(1);
12050}
12051
12052function bytesToUuid(buf, offset) {
12053 var i = offset || 0;
12054 var bth = byteToHex;
12055 // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
12056 return ([bth[buf[i++]], bth[buf[i++]],
12057 bth[buf[i++]], bth[buf[i++]], '-',
12058 bth[buf[i++]], bth[buf[i++]], '-',
12059 bth[buf[i++]], bth[buf[i++]], '-',
12060 bth[buf[i++]], bth[buf[i++]], '-',
12061 bth[buf[i++]], bth[buf[i++]],
12062 bth[buf[i++]], bth[buf[i++]],
12063 bth[buf[i++]], bth[buf[i++]]]).join('');
12064}
12065
12066module.exports = bytesToUuid;
12067
12068
12069/***/ }),
12070/* 407 */
12071/***/ (function(module, exports, __webpack_require__) {
12072
12073"use strict";
12074
12075
12076/**
12077 * This is the common logic for both the Node.js and web browser
12078 * implementations of `debug()`.
12079 */
12080function setup(env) {
12081 createDebug.debug = createDebug;
12082 createDebug.default = createDebug;
12083 createDebug.coerce = coerce;
12084 createDebug.disable = disable;
12085 createDebug.enable = enable;
12086 createDebug.enabled = enabled;
12087 createDebug.humanize = __webpack_require__(408);
12088 Object.keys(env).forEach(function (key) {
12089 createDebug[key] = env[key];
12090 });
12091 /**
12092 * Active `debug` instances.
12093 */
12094
12095 createDebug.instances = [];
12096 /**
12097 * The currently active debug mode names, and names to skip.
12098 */
12099
12100 createDebug.names = [];
12101 createDebug.skips = [];
12102 /**
12103 * Map of special "%n" handling functions, for the debug "format" argument.
12104 *
12105 * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
12106 */
12107
12108 createDebug.formatters = {};
12109 /**
12110 * Selects a color for a debug namespace
12111 * @param {String} namespace The namespace string for the for the debug instance to be colored
12112 * @return {Number|String} An ANSI color code for the given namespace
12113 * @api private
12114 */
12115
12116 function selectColor(namespace) {
12117 var hash = 0;
12118
12119 for (var i = 0; i < namespace.length; i++) {
12120 hash = (hash << 5) - hash + namespace.charCodeAt(i);
12121 hash |= 0; // Convert to 32bit integer
12122 }
12123
12124 return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
12125 }
12126
12127 createDebug.selectColor = selectColor;
12128 /**
12129 * Create a debugger with the given `namespace`.
12130 *
12131 * @param {String} namespace
12132 * @return {Function}
12133 * @api public
12134 */
12135
12136 function createDebug(namespace) {
12137 var prevTime;
12138
12139 function debug() {
12140 // Disabled?
12141 if (!debug.enabled) {
12142 return;
12143 }
12144
12145 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
12146 args[_key] = arguments[_key];
12147 }
12148
12149 var self = debug; // Set `diff` timestamp
12150
12151 var curr = Number(new Date());
12152 var ms = curr - (prevTime || curr);
12153 self.diff = ms;
12154 self.prev = prevTime;
12155 self.curr = curr;
12156 prevTime = curr;
12157 args[0] = createDebug.coerce(args[0]);
12158
12159 if (typeof args[0] !== 'string') {
12160 // Anything else let's inspect with %O
12161 args.unshift('%O');
12162 } // Apply any `formatters` transformations
12163
12164
12165 var index = 0;
12166 args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
12167 // If we encounter an escaped % then don't increase the array index
12168 if (match === '%%') {
12169 return match;
12170 }
12171
12172 index++;
12173 var formatter = createDebug.formatters[format];
12174
12175 if (typeof formatter === 'function') {
12176 var val = args[index];
12177 match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
12178
12179 args.splice(index, 1);
12180 index--;
12181 }
12182
12183 return match;
12184 }); // Apply env-specific formatting (colors, etc.)
12185
12186 createDebug.formatArgs.call(self, args);
12187 var logFn = self.log || createDebug.log;
12188 logFn.apply(self, args);
12189 }
12190
12191 debug.namespace = namespace;
12192 debug.enabled = createDebug.enabled(namespace);
12193 debug.useColors = createDebug.useColors();
12194 debug.color = selectColor(namespace);
12195 debug.destroy = destroy;
12196 debug.extend = extend; // Debug.formatArgs = formatArgs;
12197 // debug.rawLog = rawLog;
12198 // env-specific initialization logic for debug instances
12199
12200 if (typeof createDebug.init === 'function') {
12201 createDebug.init(debug);
12202 }
12203
12204 createDebug.instances.push(debug);
12205 return debug;
12206 }
12207
12208 function destroy() {
12209 var index = createDebug.instances.indexOf(this);
12210
12211 if (index !== -1) {
12212 createDebug.instances.splice(index, 1);
12213 return true;
12214 }
12215
12216 return false;
12217 }
12218
12219 function extend(namespace, delimiter) {
12220 return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
12221 }
12222 /**
12223 * Enables a debug mode by namespaces. This can include modes
12224 * separated by a colon and wildcards.
12225 *
12226 * @param {String} namespaces
12227 * @api public
12228 */
12229
12230
12231 function enable(namespaces) {
12232 createDebug.save(namespaces);
12233 createDebug.names = [];
12234 createDebug.skips = [];
12235 var i;
12236 var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
12237 var len = split.length;
12238
12239 for (i = 0; i < len; i++) {
12240 if (!split[i]) {
12241 // ignore empty strings
12242 continue;
12243 }
12244
12245 namespaces = split[i].replace(/\*/g, '.*?');
12246
12247 if (namespaces[0] === '-') {
12248 createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
12249 } else {
12250 createDebug.names.push(new RegExp('^' + namespaces + '$'));
12251 }
12252 }
12253
12254 for (i = 0; i < createDebug.instances.length; i++) {
12255 var instance = createDebug.instances[i];
12256 instance.enabled = createDebug.enabled(instance.namespace);
12257 }
12258 }
12259 /**
12260 * Disable debug output.
12261 *
12262 * @api public
12263 */
12264
12265
12266 function disable() {
12267 createDebug.enable('');
12268 }
12269 /**
12270 * Returns true if the given mode name is enabled, false otherwise.
12271 *
12272 * @param {String} name
12273 * @return {Boolean}
12274 * @api public
12275 */
12276
12277
12278 function enabled(name) {
12279 if (name[name.length - 1] === '*') {
12280 return true;
12281 }
12282
12283 var i;
12284 var len;
12285
12286 for (i = 0, len = createDebug.skips.length; i < len; i++) {
12287 if (createDebug.skips[i].test(name)) {
12288 return false;
12289 }
12290 }
12291
12292 for (i = 0, len = createDebug.names.length; i < len; i++) {
12293 if (createDebug.names[i].test(name)) {
12294 return true;
12295 }
12296 }
12297
12298 return false;
12299 }
12300 /**
12301 * Coerce `val`.
12302 *
12303 * @param {Mixed} val
12304 * @return {Mixed}
12305 * @api private
12306 */
12307
12308
12309 function coerce(val) {
12310 if (val instanceof Error) {
12311 return val.stack || val.message;
12312 }
12313
12314 return val;
12315 }
12316
12317 createDebug.enable(createDebug.load());
12318 return createDebug;
12319}
12320
12321module.exports = setup;
12322
12323
12324
12325/***/ }),
12326/* 408 */
12327/***/ (function(module, exports) {
12328
12329/**
12330 * Helpers.
12331 */
12332
12333var s = 1000;
12334var m = s * 60;
12335var h = m * 60;
12336var d = h * 24;
12337var w = d * 7;
12338var y = d * 365.25;
12339
12340/**
12341 * Parse or format the given `val`.
12342 *
12343 * Options:
12344 *
12345 * - `long` verbose formatting [false]
12346 *
12347 * @param {String|Number} val
12348 * @param {Object} [options]
12349 * @throws {Error} throw an error if val is not a non-empty string or a number
12350 * @return {String|Number}
12351 * @api public
12352 */
12353
12354module.exports = function(val, options) {
12355 options = options || {};
12356 var type = typeof val;
12357 if (type === 'string' && val.length > 0) {
12358 return parse(val);
12359 } else if (type === 'number' && isFinite(val)) {
12360 return options.long ? fmtLong(val) : fmtShort(val);
12361 }
12362 throw new Error(
12363 'val is not a non-empty string or a valid number. val=' +
12364 JSON.stringify(val)
12365 );
12366};
12367
12368/**
12369 * Parse the given `str` and return milliseconds.
12370 *
12371 * @param {String} str
12372 * @return {Number}
12373 * @api private
12374 */
12375
12376function parse(str) {
12377 str = String(str);
12378 if (str.length > 100) {
12379 return;
12380 }
12381 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(
12382 str
12383 );
12384 if (!match) {
12385 return;
12386 }
12387 var n = parseFloat(match[1]);
12388 var type = (match[2] || 'ms').toLowerCase();
12389 switch (type) {
12390 case 'years':
12391 case 'year':
12392 case 'yrs':
12393 case 'yr':
12394 case 'y':
12395 return n * y;
12396 case 'weeks':
12397 case 'week':
12398 case 'w':
12399 return n * w;
12400 case 'days':
12401 case 'day':
12402 case 'd':
12403 return n * d;
12404 case 'hours':
12405 case 'hour':
12406 case 'hrs':
12407 case 'hr':
12408 case 'h':
12409 return n * h;
12410 case 'minutes':
12411 case 'minute':
12412 case 'mins':
12413 case 'min':
12414 case 'm':
12415 return n * m;
12416 case 'seconds':
12417 case 'second':
12418 case 'secs':
12419 case 'sec':
12420 case 's':
12421 return n * s;
12422 case 'milliseconds':
12423 case 'millisecond':
12424 case 'msecs':
12425 case 'msec':
12426 case 'ms':
12427 return n;
12428 default:
12429 return undefined;
12430 }
12431}
12432
12433/**
12434 * Short format for `ms`.
12435 *
12436 * @param {Number} ms
12437 * @return {String}
12438 * @api private
12439 */
12440
12441function fmtShort(ms) {
12442 var msAbs = Math.abs(ms);
12443 if (msAbs >= d) {
12444 return Math.round(ms / d) + 'd';
12445 }
12446 if (msAbs >= h) {
12447 return Math.round(ms / h) + 'h';
12448 }
12449 if (msAbs >= m) {
12450 return Math.round(ms / m) + 'm';
12451 }
12452 if (msAbs >= s) {
12453 return Math.round(ms / s) + 's';
12454 }
12455 return ms + 'ms';
12456}
12457
12458/**
12459 * Long format for `ms`.
12460 *
12461 * @param {Number} ms
12462 * @return {String}
12463 * @api private
12464 */
12465
12466function fmtLong(ms) {
12467 var msAbs = Math.abs(ms);
12468 if (msAbs >= d) {
12469 return plural(ms, msAbs, d, 'day');
12470 }
12471 if (msAbs >= h) {
12472 return plural(ms, msAbs, h, 'hour');
12473 }
12474 if (msAbs >= m) {
12475 return plural(ms, msAbs, m, 'minute');
12476 }
12477 if (msAbs >= s) {
12478 return plural(ms, msAbs, s, 'second');
12479 }
12480 return ms + ' ms';
12481}
12482
12483/**
12484 * Pluralization helper.
12485 */
12486
12487function plural(ms, msAbs, n, name) {
12488 var isPlural = msAbs >= n * 1.5;
12489 return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
12490}
12491
12492
12493/***/ }),
12494/* 409 */
12495/***/ (function(module, exports, __webpack_require__) {
12496
12497__webpack_require__(410);
12498var path = __webpack_require__(6);
12499
12500module.exports = path.Object.getPrototypeOf;
12501
12502
12503/***/ }),
12504/* 410 */
12505/***/ (function(module, exports, __webpack_require__) {
12506
12507var $ = __webpack_require__(0);
12508var fails = __webpack_require__(2);
12509var toObject = __webpack_require__(34);
12510var nativeGetPrototypeOf = __webpack_require__(99);
12511var CORRECT_PROTOTYPE_GETTER = __webpack_require__(155);
12512
12513var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); });
12514
12515// `Object.getPrototypeOf` method
12516// https://tc39.es/ecma262/#sec-object.getprototypeof
12517$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, {
12518 getPrototypeOf: function getPrototypeOf(it) {
12519 return nativeGetPrototypeOf(toObject(it));
12520 }
12521});
12522
12523
12524
12525/***/ }),
12526/* 411 */
12527/***/ (function(module, exports, __webpack_require__) {
12528
12529module.exports = __webpack_require__(233);
12530
12531/***/ }),
12532/* 412 */
12533/***/ (function(module, exports, __webpack_require__) {
12534
12535__webpack_require__(413);
12536var path = __webpack_require__(6);
12537
12538module.exports = path.Object.setPrototypeOf;
12539
12540
12541/***/ }),
12542/* 413 */
12543/***/ (function(module, exports, __webpack_require__) {
12544
12545var $ = __webpack_require__(0);
12546var setPrototypeOf = __webpack_require__(101);
12547
12548// `Object.setPrototypeOf` method
12549// https://tc39.es/ecma262/#sec-object.setprototypeof
12550$({ target: 'Object', stat: true }, {
12551 setPrototypeOf: setPrototypeOf
12552});
12553
12554
12555/***/ }),
12556/* 414 */
12557/***/ (function(module, exports, __webpack_require__) {
12558
12559"use strict";
12560
12561
12562var _interopRequireDefault = __webpack_require__(1);
12563
12564var _slice = _interopRequireDefault(__webpack_require__(59));
12565
12566var _concat = _interopRequireDefault(__webpack_require__(22));
12567
12568var _defineProperty = _interopRequireDefault(__webpack_require__(114));
12569
12570var AV = __webpack_require__(69);
12571
12572var AppRouter = __webpack_require__(420);
12573
12574var _require = __webpack_require__(30),
12575 isNullOrUndefined = _require.isNullOrUndefined;
12576
12577var _require2 = __webpack_require__(3),
12578 extend = _require2.extend,
12579 isObject = _require2.isObject,
12580 isEmpty = _require2.isEmpty;
12581
12582var isCNApp = function isCNApp(appId) {
12583 return (0, _slice.default)(appId).call(appId, -9) !== '-MdYXbMMI';
12584};
12585
12586var fillServerURLs = function fillServerURLs(url) {
12587 return {
12588 push: url,
12589 stats: url,
12590 engine: url,
12591 api: url,
12592 rtm: url
12593 };
12594};
12595
12596function getDefaultServerURLs(appId) {
12597 var _context, _context2, _context3, _context4, _context5;
12598
12599 if (isCNApp(appId)) {
12600 return {};
12601 }
12602
12603 var id = (0, _slice.default)(appId).call(appId, 0, 8).toLowerCase();
12604 var domain = 'lncldglobal.com';
12605 return {
12606 push: (0, _concat.default)(_context = "https://".concat(id, ".push.")).call(_context, domain),
12607 stats: (0, _concat.default)(_context2 = "https://".concat(id, ".stats.")).call(_context2, domain),
12608 engine: (0, _concat.default)(_context3 = "https://".concat(id, ".engine.")).call(_context3, domain),
12609 api: (0, _concat.default)(_context4 = "https://".concat(id, ".api.")).call(_context4, domain),
12610 rtm: (0, _concat.default)(_context5 = "https://".concat(id, ".rtm.")).call(_context5, domain)
12611 };
12612}
12613
12614var _disableAppRouter = false;
12615var _initialized = false;
12616/**
12617 * URLs for services
12618 * @typedef {Object} ServerURLs
12619 * @property {String} [api] serverURL for API service
12620 * @property {String} [engine] serverURL for engine service
12621 * @property {String} [stats] serverURL for stats service
12622 * @property {String} [push] serverURL for push service
12623 * @property {String} [rtm] serverURL for LiveQuery service
12624 */
12625
12626/**
12627 * Call this method first to set up your authentication tokens for AV.
12628 * You can get your app keys from the LeanCloud dashboard on http://leancloud.cn .
12629 * @function AV.init
12630 * @param {Object} options
12631 * @param {String} options.appId application id
12632 * @param {String} options.appKey application key
12633 * @param {String} [options.masterKey] application master key
12634 * @param {Boolean} [options.production]
12635 * @param {String|ServerURLs} [options.serverURL] URLs for services. if a string was given, it will be applied for all services.
12636 * @param {Boolean} [options.disableCurrentUser]
12637 */
12638
12639AV.init = function init(options) {
12640 if (!isObject(options)) {
12641 return AV.init({
12642 appId: options,
12643 appKey: arguments.length <= 1 ? undefined : arguments[1],
12644 masterKey: arguments.length <= 2 ? undefined : arguments[2]
12645 });
12646 }
12647
12648 var appId = options.appId,
12649 appKey = options.appKey,
12650 masterKey = options.masterKey,
12651 hookKey = options.hookKey,
12652 serverURL = options.serverURL,
12653 _options$serverURLs = options.serverURLs,
12654 serverURLs = _options$serverURLs === void 0 ? serverURL : _options$serverURLs,
12655 disableCurrentUser = options.disableCurrentUser,
12656 production = options.production,
12657 realtime = options.realtime;
12658 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.');
12659 if (!appId) throw new TypeError('appId must be a string');
12660 if (!appKey) throw new TypeError('appKey must be a string');
12661 if (undefined !== 'NODE_JS' && masterKey) console.warn('MasterKey is not supposed to be used at client side.');
12662
12663 if (isCNApp(appId)) {
12664 if (!serverURLs && isEmpty(AV._config.serverURLs)) {
12665 throw new TypeError("serverURL option is required for apps from CN region");
12666 }
12667 }
12668
12669 if (appId !== AV._config.applicationId) {
12670 // overwrite all keys when reinitializing as a new app
12671 AV._config.masterKey = masterKey;
12672 AV._config.hookKey = hookKey;
12673 } else {
12674 if (masterKey) AV._config.masterKey = masterKey;
12675 if (hookKey) AV._config.hookKey = hookKey;
12676 }
12677
12678 AV._config.applicationId = appId;
12679 AV._config.applicationKey = appKey;
12680
12681 if (!isNullOrUndefined(production)) {
12682 AV.setProduction(production);
12683 }
12684
12685 if (typeof disableCurrentUser !== 'undefined') AV._config.disableCurrentUser = disableCurrentUser;
12686 var disableAppRouter = _disableAppRouter || typeof serverURLs !== 'undefined';
12687
12688 if (!disableAppRouter) {
12689 AV._appRouter = new AppRouter(AV);
12690 }
12691
12692 AV._setServerURLs(extend({}, getDefaultServerURLs(appId), AV._config.serverURLs, typeof serverURLs === 'string' ? fillServerURLs(serverURLs) : serverURLs), disableAppRouter);
12693
12694 if (realtime) {
12695 AV._config.realtime = realtime;
12696 } else if (AV._sharedConfig.liveQueryRealtime) {
12697 var _AV$_config$serverURL = AV._config.serverURLs,
12698 api = _AV$_config$serverURL.api,
12699 rtm = _AV$_config$serverURL.rtm;
12700 AV._config.realtime = new AV._sharedConfig.liveQueryRealtime({
12701 appId: appId,
12702 appKey: appKey,
12703 server: {
12704 api: api,
12705 RTMRouter: rtm
12706 }
12707 });
12708 }
12709
12710 _initialized = true;
12711}; // If we're running in node.js, allow using the master key.
12712
12713
12714if (undefined === 'NODE_JS') {
12715 AV.Cloud = AV.Cloud || {};
12716 /**
12717 * Switches the LeanCloud SDK to using the Master key. The Master key grants
12718 * priveleged access to the data in LeanCloud and can be used to bypass ACLs and
12719 * other restrictions that are applied to the client SDKs.
12720 * <p><strong><em>Available in Cloud Code and Node.js only.</em></strong>
12721 * </p>
12722 */
12723
12724 AV.Cloud.useMasterKey = function () {
12725 AV._config.useMasterKey = true;
12726 };
12727}
12728/**
12729 * Call this method to set production environment variable.
12730 * @function AV.setProduction
12731 * @param {Boolean} production True is production environment,and
12732 * it's true by default.
12733 */
12734
12735
12736AV.setProduction = function (production) {
12737 if (!isNullOrUndefined(production)) {
12738 AV._config.production = production ? 1 : 0;
12739 } else {
12740 // change to default value
12741 AV._config.production = null;
12742 }
12743};
12744
12745AV._setServerURLs = function (urls) {
12746 var disableAppRouter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
12747
12748 if (typeof urls !== 'string') {
12749 extend(AV._config.serverURLs, urls);
12750 } else {
12751 AV._config.serverURLs = fillServerURLs(urls);
12752 }
12753
12754 if (disableAppRouter) {
12755 if (AV._appRouter) {
12756 AV._appRouter.disable();
12757 } else {
12758 _disableAppRouter = true;
12759 }
12760 }
12761};
12762/**
12763 * Set server URLs for services.
12764 * @function AV.setServerURL
12765 * @since 4.3.0
12766 * @param {String|ServerURLs} urls URLs for services. if a string was given, it will be applied for all services.
12767 * You can also set them when initializing SDK with `options.serverURL`
12768 */
12769
12770
12771AV.setServerURL = function (urls) {
12772 return AV._setServerURLs(urls);
12773};
12774
12775AV.setServerURLs = AV.setServerURL;
12776
12777AV.keepErrorRawMessage = function (value) {
12778 AV._sharedConfig.keepErrorRawMessage = value;
12779};
12780/**
12781 * Set a deadline for requests to complete.
12782 * Note that file upload requests are not affected.
12783 * @function AV.setRequestTimeout
12784 * @since 3.6.0
12785 * @param {number} ms
12786 */
12787
12788
12789AV.setRequestTimeout = function (ms) {
12790 AV._config.requestTimeout = ms;
12791}; // backword compatible
12792
12793
12794AV.initialize = AV.init;
12795
12796var defineConfig = function defineConfig(property) {
12797 return (0, _defineProperty.default)(AV, property, {
12798 get: function get() {
12799 return AV._config[property];
12800 },
12801 set: function set(value) {
12802 AV._config[property] = value;
12803 }
12804 });
12805};
12806
12807['applicationId', 'applicationKey', 'masterKey', 'hookKey'].forEach(defineConfig);
12808
12809/***/ }),
12810/* 415 */
12811/***/ (function(module, exports, __webpack_require__) {
12812
12813var isPrototypeOf = __webpack_require__(19);
12814var method = __webpack_require__(416);
12815
12816var ArrayPrototype = Array.prototype;
12817
12818module.exports = function (it) {
12819 var own = it.slice;
12820 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.slice) ? method : own;
12821};
12822
12823
12824/***/ }),
12825/* 416 */
12826/***/ (function(module, exports, __webpack_require__) {
12827
12828__webpack_require__(417);
12829var entryVirtual = __webpack_require__(38);
12830
12831module.exports = entryVirtual('Array').slice;
12832
12833
12834/***/ }),
12835/* 417 */
12836/***/ (function(module, exports, __webpack_require__) {
12837
12838"use strict";
12839
12840var $ = __webpack_require__(0);
12841var isArray = __webpack_require__(88);
12842var isConstructor = __webpack_require__(108);
12843var isObject = __webpack_require__(11);
12844var toAbsoluteIndex = __webpack_require__(124);
12845var lengthOfArrayLike = __webpack_require__(39);
12846var toIndexedObject = __webpack_require__(32);
12847var createProperty = __webpack_require__(89);
12848var wellKnownSymbol = __webpack_require__(9);
12849var arrayMethodHasSpeciesSupport = __webpack_require__(113);
12850var un$Slice = __webpack_require__(109);
12851
12852var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
12853
12854var SPECIES = wellKnownSymbol('species');
12855var $Array = Array;
12856var max = Math.max;
12857
12858// `Array.prototype.slice` method
12859// https://tc39.es/ecma262/#sec-array.prototype.slice
12860// fallback for not array-like ES3 strings and DOM objects
12861$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
12862 slice: function slice(start, end) {
12863 var O = toIndexedObject(this);
12864 var length = lengthOfArrayLike(O);
12865 var k = toAbsoluteIndex(start, length);
12866 var fin = toAbsoluteIndex(end === undefined ? length : end, length);
12867 // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
12868 var Constructor, result, n;
12869 if (isArray(O)) {
12870 Constructor = O.constructor;
12871 // cross-realm fallback
12872 if (isConstructor(Constructor) && (Constructor === $Array || isArray(Constructor.prototype))) {
12873 Constructor = undefined;
12874 } else if (isObject(Constructor)) {
12875 Constructor = Constructor[SPECIES];
12876 if (Constructor === null) Constructor = undefined;
12877 }
12878 if (Constructor === $Array || Constructor === undefined) {
12879 return un$Slice(O, k, fin);
12880 }
12881 }
12882 result = new (Constructor === undefined ? $Array : Constructor)(max(fin - k, 0));
12883 for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
12884 result.length = n;
12885 return result;
12886 }
12887});
12888
12889
12890/***/ }),
12891/* 418 */
12892/***/ (function(module, exports, __webpack_require__) {
12893
12894__webpack_require__(419);
12895var path = __webpack_require__(6);
12896
12897var Object = path.Object;
12898
12899var defineProperty = module.exports = function defineProperty(it, key, desc) {
12900 return Object.defineProperty(it, key, desc);
12901};
12902
12903if (Object.defineProperty.sham) defineProperty.sham = true;
12904
12905
12906/***/ }),
12907/* 419 */
12908/***/ (function(module, exports, __webpack_require__) {
12909
12910var $ = __webpack_require__(0);
12911var DESCRIPTORS = __webpack_require__(14);
12912var defineProperty = __webpack_require__(23).f;
12913
12914// `Object.defineProperty` method
12915// https://tc39.es/ecma262/#sec-object.defineproperty
12916// eslint-disable-next-line es-x/no-object-defineproperty -- safe
12917$({ target: 'Object', stat: true, forced: Object.defineProperty !== defineProperty, sham: !DESCRIPTORS }, {
12918 defineProperty: defineProperty
12919});
12920
12921
12922/***/ }),
12923/* 420 */
12924/***/ (function(module, exports, __webpack_require__) {
12925
12926"use strict";
12927
12928
12929var ajax = __webpack_require__(115);
12930
12931var Cache = __webpack_require__(232);
12932
12933function AppRouter(AV) {
12934 var _this = this;
12935
12936 this.AV = AV;
12937 this.lockedUntil = 0;
12938 Cache.getAsync('serverURLs').then(function (data) {
12939 if (_this.disabled) return;
12940 if (!data) return _this.lock(0);
12941 var serverURLs = data.serverURLs,
12942 lockedUntil = data.lockedUntil;
12943
12944 _this.AV._setServerURLs(serverURLs, false);
12945
12946 _this.lockedUntil = lockedUntil;
12947 }).catch(function () {
12948 return _this.lock(0);
12949 });
12950}
12951
12952AppRouter.prototype.disable = function disable() {
12953 this.disabled = true;
12954};
12955
12956AppRouter.prototype.lock = function lock(ttl) {
12957 this.lockedUntil = Date.now() + ttl;
12958};
12959
12960AppRouter.prototype.refresh = function refresh() {
12961 var _this2 = this;
12962
12963 if (this.disabled) return;
12964 if (Date.now() < this.lockedUntil) return;
12965 this.lock(10);
12966 var url = 'https://app-router.com/2/route';
12967 return ajax({
12968 method: 'get',
12969 url: url,
12970 query: {
12971 appId: this.AV.applicationId
12972 }
12973 }).then(function (servers) {
12974 if (_this2.disabled) return;
12975 var ttl = servers.ttl;
12976 if (!ttl) throw new Error('missing ttl');
12977 ttl = ttl * 1000;
12978 var protocal = 'https://';
12979 var serverURLs = {
12980 push: protocal + servers.push_server,
12981 stats: protocal + servers.stats_server,
12982 engine: protocal + servers.engine_server,
12983 api: protocal + servers.api_server
12984 };
12985
12986 _this2.AV._setServerURLs(serverURLs, false);
12987
12988 _this2.lock(ttl);
12989
12990 return Cache.setAsync('serverURLs', {
12991 serverURLs: serverURLs,
12992 lockedUntil: _this2.lockedUntil
12993 }, ttl);
12994 }).catch(function (error) {
12995 // bypass all errors
12996 console.warn("refresh server URLs failed: ".concat(error.message));
12997
12998 _this2.lock(600);
12999 });
13000};
13001
13002module.exports = AppRouter;
13003
13004/***/ }),
13005/* 421 */
13006/***/ (function(module, exports, __webpack_require__) {
13007
13008module.exports = __webpack_require__(422);
13009
13010
13011/***/ }),
13012/* 422 */
13013/***/ (function(module, exports, __webpack_require__) {
13014
13015var parent = __webpack_require__(423);
13016__webpack_require__(446);
13017__webpack_require__(447);
13018__webpack_require__(448);
13019__webpack_require__(449);
13020__webpack_require__(450);
13021// TODO: Remove from `core-js@4`
13022__webpack_require__(451);
13023__webpack_require__(452);
13024__webpack_require__(453);
13025
13026module.exports = parent;
13027
13028
13029/***/ }),
13030/* 423 */
13031/***/ (function(module, exports, __webpack_require__) {
13032
13033var parent = __webpack_require__(237);
13034
13035module.exports = parent;
13036
13037
13038/***/ }),
13039/* 424 */
13040/***/ (function(module, exports, __webpack_require__) {
13041
13042__webpack_require__(222);
13043__webpack_require__(63);
13044__webpack_require__(238);
13045__webpack_require__(430);
13046__webpack_require__(431);
13047__webpack_require__(432);
13048__webpack_require__(433);
13049__webpack_require__(242);
13050__webpack_require__(434);
13051__webpack_require__(435);
13052__webpack_require__(436);
13053__webpack_require__(437);
13054__webpack_require__(438);
13055__webpack_require__(439);
13056__webpack_require__(440);
13057__webpack_require__(441);
13058__webpack_require__(442);
13059__webpack_require__(443);
13060__webpack_require__(444);
13061__webpack_require__(445);
13062var path = __webpack_require__(6);
13063
13064module.exports = path.Symbol;
13065
13066
13067/***/ }),
13068/* 425 */
13069/***/ (function(module, exports, __webpack_require__) {
13070
13071"use strict";
13072
13073var $ = __webpack_require__(0);
13074var global = __webpack_require__(7);
13075var call = __webpack_require__(15);
13076var uncurryThis = __webpack_require__(4);
13077var IS_PURE = __webpack_require__(33);
13078var DESCRIPTORS = __webpack_require__(14);
13079var NATIVE_SYMBOL = __webpack_require__(62);
13080var fails = __webpack_require__(2);
13081var hasOwn = __webpack_require__(12);
13082var isPrototypeOf = __webpack_require__(19);
13083var anObject = __webpack_require__(20);
13084var toIndexedObject = __webpack_require__(32);
13085var toPropertyKey = __webpack_require__(95);
13086var $toString = __webpack_require__(79);
13087var createPropertyDescriptor = __webpack_require__(47);
13088var nativeObjectCreate = __webpack_require__(49);
13089var objectKeys = __webpack_require__(104);
13090var getOwnPropertyNamesModule = __webpack_require__(102);
13091var getOwnPropertyNamesExternal = __webpack_require__(239);
13092var getOwnPropertySymbolsModule = __webpack_require__(103);
13093var getOwnPropertyDescriptorModule = __webpack_require__(60);
13094var definePropertyModule = __webpack_require__(23);
13095var definePropertiesModule = __webpack_require__(127);
13096var propertyIsEnumerableModule = __webpack_require__(119);
13097var defineBuiltIn = __webpack_require__(43);
13098var shared = __webpack_require__(77);
13099var sharedKey = __webpack_require__(100);
13100var hiddenKeys = __webpack_require__(78);
13101var uid = __webpack_require__(98);
13102var wellKnownSymbol = __webpack_require__(9);
13103var wrappedWellKnownSymbolModule = __webpack_require__(147);
13104var defineWellKnownSymbol = __webpack_require__(10);
13105var defineSymbolToPrimitive = __webpack_require__(240);
13106var setToStringTag = __webpack_require__(52);
13107var InternalStateModule = __webpack_require__(42);
13108var $forEach = __webpack_require__(70).forEach;
13109
13110var HIDDEN = sharedKey('hidden');
13111var SYMBOL = 'Symbol';
13112var PROTOTYPE = 'prototype';
13113
13114var setInternalState = InternalStateModule.set;
13115var getInternalState = InternalStateModule.getterFor(SYMBOL);
13116
13117var ObjectPrototype = Object[PROTOTYPE];
13118var $Symbol = global.Symbol;
13119var SymbolPrototype = $Symbol && $Symbol[PROTOTYPE];
13120var TypeError = global.TypeError;
13121var QObject = global.QObject;
13122var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
13123var nativeDefineProperty = definePropertyModule.f;
13124var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
13125var nativePropertyIsEnumerable = propertyIsEnumerableModule.f;
13126var push = uncurryThis([].push);
13127
13128var AllSymbols = shared('symbols');
13129var ObjectPrototypeSymbols = shared('op-symbols');
13130var WellKnownSymbolsStore = shared('wks');
13131
13132// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
13133var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
13134
13135// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
13136var setSymbolDescriptor = DESCRIPTORS && fails(function () {
13137 return nativeObjectCreate(nativeDefineProperty({}, 'a', {
13138 get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; }
13139 })).a != 7;
13140}) ? function (O, P, Attributes) {
13141 var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);
13142 if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
13143 nativeDefineProperty(O, P, Attributes);
13144 if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
13145 nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);
13146 }
13147} : nativeDefineProperty;
13148
13149var wrap = function (tag, description) {
13150 var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype);
13151 setInternalState(symbol, {
13152 type: SYMBOL,
13153 tag: tag,
13154 description: description
13155 });
13156 if (!DESCRIPTORS) symbol.description = description;
13157 return symbol;
13158};
13159
13160var $defineProperty = function defineProperty(O, P, Attributes) {
13161 if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
13162 anObject(O);
13163 var key = toPropertyKey(P);
13164 anObject(Attributes);
13165 if (hasOwn(AllSymbols, key)) {
13166 if (!Attributes.enumerable) {
13167 if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));
13168 O[HIDDEN][key] = true;
13169 } else {
13170 if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
13171 Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
13172 } return setSymbolDescriptor(O, key, Attributes);
13173 } return nativeDefineProperty(O, key, Attributes);
13174};
13175
13176var $defineProperties = function defineProperties(O, Properties) {
13177 anObject(O);
13178 var properties = toIndexedObject(Properties);
13179 var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
13180 $forEach(keys, function (key) {
13181 if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]);
13182 });
13183 return O;
13184};
13185
13186var $create = function create(O, Properties) {
13187 return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);
13188};
13189
13190var $propertyIsEnumerable = function propertyIsEnumerable(V) {
13191 var P = toPropertyKey(V);
13192 var enumerable = call(nativePropertyIsEnumerable, this, P);
13193 if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false;
13194 return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P]
13195 ? enumerable : true;
13196};
13197
13198var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
13199 var it = toIndexedObject(O);
13200 var key = toPropertyKey(P);
13201 if (it === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return;
13202 var descriptor = nativeGetOwnPropertyDescriptor(it, key);
13203 if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it, HIDDEN) && it[HIDDEN][key])) {
13204 descriptor.enumerable = true;
13205 }
13206 return descriptor;
13207};
13208
13209var $getOwnPropertyNames = function getOwnPropertyNames(O) {
13210 var names = nativeGetOwnPropertyNames(toIndexedObject(O));
13211 var result = [];
13212 $forEach(names, function (key) {
13213 if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key);
13214 });
13215 return result;
13216};
13217
13218var $getOwnPropertySymbols = function (O) {
13219 var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
13220 var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
13221 var result = [];
13222 $forEach(names, function (key) {
13223 if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) {
13224 push(result, AllSymbols[key]);
13225 }
13226 });
13227 return result;
13228};
13229
13230// `Symbol` constructor
13231// https://tc39.es/ecma262/#sec-symbol-constructor
13232if (!NATIVE_SYMBOL) {
13233 $Symbol = function Symbol() {
13234 if (isPrototypeOf(SymbolPrototype, this)) throw TypeError('Symbol is not a constructor');
13235 var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]);
13236 var tag = uid(description);
13237 var setter = function (value) {
13238 if (this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value);
13239 if (hasOwn(this, HIDDEN) && hasOwn(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
13240 setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
13241 };
13242 if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
13243 return wrap(tag, description);
13244 };
13245
13246 SymbolPrototype = $Symbol[PROTOTYPE];
13247
13248 defineBuiltIn(SymbolPrototype, 'toString', function toString() {
13249 return getInternalState(this).tag;
13250 });
13251
13252 defineBuiltIn($Symbol, 'withoutSetter', function (description) {
13253 return wrap(uid(description), description);
13254 });
13255
13256 propertyIsEnumerableModule.f = $propertyIsEnumerable;
13257 definePropertyModule.f = $defineProperty;
13258 definePropertiesModule.f = $defineProperties;
13259 getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;
13260 getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;
13261 getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;
13262
13263 wrappedWellKnownSymbolModule.f = function (name) {
13264 return wrap(wellKnownSymbol(name), name);
13265 };
13266
13267 if (DESCRIPTORS) {
13268 // https://github.com/tc39/proposal-Symbol-description
13269 nativeDefineProperty(SymbolPrototype, 'description', {
13270 configurable: true,
13271 get: function description() {
13272 return getInternalState(this).description;
13273 }
13274 });
13275 if (!IS_PURE) {
13276 defineBuiltIn(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
13277 }
13278 }
13279}
13280
13281$({ global: true, constructor: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {
13282 Symbol: $Symbol
13283});
13284
13285$forEach(objectKeys(WellKnownSymbolsStore), function (name) {
13286 defineWellKnownSymbol(name);
13287});
13288
13289$({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, {
13290 useSetter: function () { USE_SETTER = true; },
13291 useSimple: function () { USE_SETTER = false; }
13292});
13293
13294$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, {
13295 // `Object.create` method
13296 // https://tc39.es/ecma262/#sec-object.create
13297 create: $create,
13298 // `Object.defineProperty` method
13299 // https://tc39.es/ecma262/#sec-object.defineproperty
13300 defineProperty: $defineProperty,
13301 // `Object.defineProperties` method
13302 // https://tc39.es/ecma262/#sec-object.defineproperties
13303 defineProperties: $defineProperties,
13304 // `Object.getOwnPropertyDescriptor` method
13305 // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
13306 getOwnPropertyDescriptor: $getOwnPropertyDescriptor
13307});
13308
13309$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, {
13310 // `Object.getOwnPropertyNames` method
13311 // https://tc39.es/ecma262/#sec-object.getownpropertynames
13312 getOwnPropertyNames: $getOwnPropertyNames
13313});
13314
13315// `Symbol.prototype[@@toPrimitive]` method
13316// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
13317defineSymbolToPrimitive();
13318
13319// `Symbol.prototype[@@toStringTag]` property
13320// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
13321setToStringTag($Symbol, SYMBOL);
13322
13323hiddenKeys[HIDDEN] = true;
13324
13325
13326/***/ }),
13327/* 426 */
13328/***/ (function(module, exports, __webpack_require__) {
13329
13330var toAbsoluteIndex = __webpack_require__(124);
13331var lengthOfArrayLike = __webpack_require__(39);
13332var createProperty = __webpack_require__(89);
13333
13334var $Array = Array;
13335var max = Math.max;
13336
13337module.exports = function (O, start, end) {
13338 var length = lengthOfArrayLike(O);
13339 var k = toAbsoluteIndex(start, length);
13340 var fin = toAbsoluteIndex(end === undefined ? length : end, length);
13341 var result = $Array(max(fin - k, 0));
13342 for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
13343 result.length = n;
13344 return result;
13345};
13346
13347
13348/***/ }),
13349/* 427 */
13350/***/ (function(module, exports, __webpack_require__) {
13351
13352var $ = __webpack_require__(0);
13353var getBuiltIn = __webpack_require__(18);
13354var hasOwn = __webpack_require__(12);
13355var toString = __webpack_require__(79);
13356var shared = __webpack_require__(77);
13357var NATIVE_SYMBOL_REGISTRY = __webpack_require__(241);
13358
13359var StringToSymbolRegistry = shared('string-to-symbol-registry');
13360var SymbolToStringRegistry = shared('symbol-to-string-registry');
13361
13362// `Symbol.for` method
13363// https://tc39.es/ecma262/#sec-symbol.for
13364$({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
13365 'for': function (key) {
13366 var string = toString(key);
13367 if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
13368 var symbol = getBuiltIn('Symbol')(string);
13369 StringToSymbolRegistry[string] = symbol;
13370 SymbolToStringRegistry[symbol] = string;
13371 return symbol;
13372 }
13373});
13374
13375
13376/***/ }),
13377/* 428 */
13378/***/ (function(module, exports, __webpack_require__) {
13379
13380var $ = __webpack_require__(0);
13381var hasOwn = __webpack_require__(12);
13382var isSymbol = __webpack_require__(96);
13383var tryToString = __webpack_require__(76);
13384var shared = __webpack_require__(77);
13385var NATIVE_SYMBOL_REGISTRY = __webpack_require__(241);
13386
13387var SymbolToStringRegistry = shared('symbol-to-string-registry');
13388
13389// `Symbol.keyFor` method
13390// https://tc39.es/ecma262/#sec-symbol.keyfor
13391$({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
13392 keyFor: function keyFor(sym) {
13393 if (!isSymbol(sym)) throw TypeError(tryToString(sym) + ' is not a symbol');
13394 if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
13395 }
13396});
13397
13398
13399/***/ }),
13400/* 429 */
13401/***/ (function(module, exports, __webpack_require__) {
13402
13403var $ = __webpack_require__(0);
13404var NATIVE_SYMBOL = __webpack_require__(62);
13405var fails = __webpack_require__(2);
13406var getOwnPropertySymbolsModule = __webpack_require__(103);
13407var toObject = __webpack_require__(34);
13408
13409// V8 ~ Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
13410// https://bugs.chromium.org/p/v8/issues/detail?id=3443
13411var FORCED = !NATIVE_SYMBOL || fails(function () { getOwnPropertySymbolsModule.f(1); });
13412
13413// `Object.getOwnPropertySymbols` method
13414// https://tc39.es/ecma262/#sec-object.getownpropertysymbols
13415$({ target: 'Object', stat: true, forced: FORCED }, {
13416 getOwnPropertySymbols: function getOwnPropertySymbols(it) {
13417 var $getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
13418 return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject(it)) : [];
13419 }
13420});
13421
13422
13423/***/ }),
13424/* 430 */
13425/***/ (function(module, exports, __webpack_require__) {
13426
13427var defineWellKnownSymbol = __webpack_require__(10);
13428
13429// `Symbol.asyncIterator` well-known symbol
13430// https://tc39.es/ecma262/#sec-symbol.asynciterator
13431defineWellKnownSymbol('asyncIterator');
13432
13433
13434/***/ }),
13435/* 431 */
13436/***/ (function(module, exports) {
13437
13438// empty
13439
13440
13441/***/ }),
13442/* 432 */
13443/***/ (function(module, exports, __webpack_require__) {
13444
13445var defineWellKnownSymbol = __webpack_require__(10);
13446
13447// `Symbol.hasInstance` well-known symbol
13448// https://tc39.es/ecma262/#sec-symbol.hasinstance
13449defineWellKnownSymbol('hasInstance');
13450
13451
13452/***/ }),
13453/* 433 */
13454/***/ (function(module, exports, __webpack_require__) {
13455
13456var defineWellKnownSymbol = __webpack_require__(10);
13457
13458// `Symbol.isConcatSpreadable` well-known symbol
13459// https://tc39.es/ecma262/#sec-symbol.isconcatspreadable
13460defineWellKnownSymbol('isConcatSpreadable');
13461
13462
13463/***/ }),
13464/* 434 */
13465/***/ (function(module, exports, __webpack_require__) {
13466
13467var defineWellKnownSymbol = __webpack_require__(10);
13468
13469// `Symbol.match` well-known symbol
13470// https://tc39.es/ecma262/#sec-symbol.match
13471defineWellKnownSymbol('match');
13472
13473
13474/***/ }),
13475/* 435 */
13476/***/ (function(module, exports, __webpack_require__) {
13477
13478var defineWellKnownSymbol = __webpack_require__(10);
13479
13480// `Symbol.matchAll` well-known symbol
13481// https://tc39.es/ecma262/#sec-symbol.matchall
13482defineWellKnownSymbol('matchAll');
13483
13484
13485/***/ }),
13486/* 436 */
13487/***/ (function(module, exports, __webpack_require__) {
13488
13489var defineWellKnownSymbol = __webpack_require__(10);
13490
13491// `Symbol.replace` well-known symbol
13492// https://tc39.es/ecma262/#sec-symbol.replace
13493defineWellKnownSymbol('replace');
13494
13495
13496/***/ }),
13497/* 437 */
13498/***/ (function(module, exports, __webpack_require__) {
13499
13500var defineWellKnownSymbol = __webpack_require__(10);
13501
13502// `Symbol.search` well-known symbol
13503// https://tc39.es/ecma262/#sec-symbol.search
13504defineWellKnownSymbol('search');
13505
13506
13507/***/ }),
13508/* 438 */
13509/***/ (function(module, exports, __webpack_require__) {
13510
13511var defineWellKnownSymbol = __webpack_require__(10);
13512
13513// `Symbol.species` well-known symbol
13514// https://tc39.es/ecma262/#sec-symbol.species
13515defineWellKnownSymbol('species');
13516
13517
13518/***/ }),
13519/* 439 */
13520/***/ (function(module, exports, __webpack_require__) {
13521
13522var defineWellKnownSymbol = __webpack_require__(10);
13523
13524// `Symbol.split` well-known symbol
13525// https://tc39.es/ecma262/#sec-symbol.split
13526defineWellKnownSymbol('split');
13527
13528
13529/***/ }),
13530/* 440 */
13531/***/ (function(module, exports, __webpack_require__) {
13532
13533var defineWellKnownSymbol = __webpack_require__(10);
13534var defineSymbolToPrimitive = __webpack_require__(240);
13535
13536// `Symbol.toPrimitive` well-known symbol
13537// https://tc39.es/ecma262/#sec-symbol.toprimitive
13538defineWellKnownSymbol('toPrimitive');
13539
13540// `Symbol.prototype[@@toPrimitive]` method
13541// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
13542defineSymbolToPrimitive();
13543
13544
13545/***/ }),
13546/* 441 */
13547/***/ (function(module, exports, __webpack_require__) {
13548
13549var getBuiltIn = __webpack_require__(18);
13550var defineWellKnownSymbol = __webpack_require__(10);
13551var setToStringTag = __webpack_require__(52);
13552
13553// `Symbol.toStringTag` well-known symbol
13554// https://tc39.es/ecma262/#sec-symbol.tostringtag
13555defineWellKnownSymbol('toStringTag');
13556
13557// `Symbol.prototype[@@toStringTag]` property
13558// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
13559setToStringTag(getBuiltIn('Symbol'), 'Symbol');
13560
13561
13562/***/ }),
13563/* 442 */
13564/***/ (function(module, exports, __webpack_require__) {
13565
13566var defineWellKnownSymbol = __webpack_require__(10);
13567
13568// `Symbol.unscopables` well-known symbol
13569// https://tc39.es/ecma262/#sec-symbol.unscopables
13570defineWellKnownSymbol('unscopables');
13571
13572
13573/***/ }),
13574/* 443 */
13575/***/ (function(module, exports, __webpack_require__) {
13576
13577var global = __webpack_require__(7);
13578var setToStringTag = __webpack_require__(52);
13579
13580// JSON[@@toStringTag] property
13581// https://tc39.es/ecma262/#sec-json-@@tostringtag
13582setToStringTag(global.JSON, 'JSON', true);
13583
13584
13585/***/ }),
13586/* 444 */
13587/***/ (function(module, exports) {
13588
13589// empty
13590
13591
13592/***/ }),
13593/* 445 */
13594/***/ (function(module, exports) {
13595
13596// empty
13597
13598
13599/***/ }),
13600/* 446 */
13601/***/ (function(module, exports, __webpack_require__) {
13602
13603var defineWellKnownSymbol = __webpack_require__(10);
13604
13605// `Symbol.asyncDispose` well-known symbol
13606// https://github.com/tc39/proposal-using-statement
13607defineWellKnownSymbol('asyncDispose');
13608
13609
13610/***/ }),
13611/* 447 */
13612/***/ (function(module, exports, __webpack_require__) {
13613
13614var defineWellKnownSymbol = __webpack_require__(10);
13615
13616// `Symbol.dispose` well-known symbol
13617// https://github.com/tc39/proposal-using-statement
13618defineWellKnownSymbol('dispose');
13619
13620
13621/***/ }),
13622/* 448 */
13623/***/ (function(module, exports, __webpack_require__) {
13624
13625var defineWellKnownSymbol = __webpack_require__(10);
13626
13627// `Symbol.matcher` well-known symbol
13628// https://github.com/tc39/proposal-pattern-matching
13629defineWellKnownSymbol('matcher');
13630
13631
13632/***/ }),
13633/* 449 */
13634/***/ (function(module, exports, __webpack_require__) {
13635
13636var defineWellKnownSymbol = __webpack_require__(10);
13637
13638// `Symbol.metadataKey` well-known symbol
13639// https://github.com/tc39/proposal-decorator-metadata
13640defineWellKnownSymbol('metadataKey');
13641
13642
13643/***/ }),
13644/* 450 */
13645/***/ (function(module, exports, __webpack_require__) {
13646
13647var defineWellKnownSymbol = __webpack_require__(10);
13648
13649// `Symbol.observable` well-known symbol
13650// https://github.com/tc39/proposal-observable
13651defineWellKnownSymbol('observable');
13652
13653
13654/***/ }),
13655/* 451 */
13656/***/ (function(module, exports, __webpack_require__) {
13657
13658// TODO: Remove from `core-js@4`
13659var defineWellKnownSymbol = __webpack_require__(10);
13660
13661// `Symbol.metadata` well-known symbol
13662// https://github.com/tc39/proposal-decorators
13663defineWellKnownSymbol('metadata');
13664
13665
13666/***/ }),
13667/* 452 */
13668/***/ (function(module, exports, __webpack_require__) {
13669
13670// TODO: remove from `core-js@4`
13671var defineWellKnownSymbol = __webpack_require__(10);
13672
13673// `Symbol.patternMatch` well-known symbol
13674// https://github.com/tc39/proposal-pattern-matching
13675defineWellKnownSymbol('patternMatch');
13676
13677
13678/***/ }),
13679/* 453 */
13680/***/ (function(module, exports, __webpack_require__) {
13681
13682// TODO: remove from `core-js@4`
13683var defineWellKnownSymbol = __webpack_require__(10);
13684
13685defineWellKnownSymbol('replaceAll');
13686
13687
13688/***/ }),
13689/* 454 */
13690/***/ (function(module, exports, __webpack_require__) {
13691
13692module.exports = __webpack_require__(455);
13693
13694/***/ }),
13695/* 455 */
13696/***/ (function(module, exports, __webpack_require__) {
13697
13698module.exports = __webpack_require__(456);
13699
13700
13701/***/ }),
13702/* 456 */
13703/***/ (function(module, exports, __webpack_require__) {
13704
13705var parent = __webpack_require__(457);
13706
13707module.exports = parent;
13708
13709
13710/***/ }),
13711/* 457 */
13712/***/ (function(module, exports, __webpack_require__) {
13713
13714var parent = __webpack_require__(458);
13715
13716module.exports = parent;
13717
13718
13719/***/ }),
13720/* 458 */
13721/***/ (function(module, exports, __webpack_require__) {
13722
13723var parent = __webpack_require__(459);
13724__webpack_require__(44);
13725
13726module.exports = parent;
13727
13728
13729/***/ }),
13730/* 459 */
13731/***/ (function(module, exports, __webpack_require__) {
13732
13733__webpack_require__(41);
13734__webpack_require__(63);
13735__webpack_require__(65);
13736__webpack_require__(242);
13737var WrappedWellKnownSymbolModule = __webpack_require__(147);
13738
13739module.exports = WrappedWellKnownSymbolModule.f('iterator');
13740
13741
13742/***/ }),
13743/* 460 */
13744/***/ (function(module, exports, __webpack_require__) {
13745
13746var parent = __webpack_require__(461);
13747
13748module.exports = parent;
13749
13750
13751/***/ }),
13752/* 461 */
13753/***/ (function(module, exports, __webpack_require__) {
13754
13755var isPrototypeOf = __webpack_require__(19);
13756var method = __webpack_require__(462);
13757
13758var ArrayPrototype = Array.prototype;
13759
13760module.exports = function (it) {
13761 var own = it.filter;
13762 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.filter) ? method : own;
13763};
13764
13765
13766/***/ }),
13767/* 462 */
13768/***/ (function(module, exports, __webpack_require__) {
13769
13770__webpack_require__(463);
13771var entryVirtual = __webpack_require__(38);
13772
13773module.exports = entryVirtual('Array').filter;
13774
13775
13776/***/ }),
13777/* 463 */
13778/***/ (function(module, exports, __webpack_require__) {
13779
13780"use strict";
13781
13782var $ = __webpack_require__(0);
13783var $filter = __webpack_require__(70).filter;
13784var arrayMethodHasSpeciesSupport = __webpack_require__(113);
13785
13786var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
13787
13788// `Array.prototype.filter` method
13789// https://tc39.es/ecma262/#sec-array.prototype.filter
13790// with adding support of @@species
13791$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
13792 filter: function filter(callbackfn /* , thisArg */) {
13793 return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
13794 }
13795});
13796
13797
13798/***/ }),
13799/* 464 */
13800/***/ (function(module, exports, __webpack_require__) {
13801
13802"use strict";
13803
13804
13805var _interopRequireDefault = __webpack_require__(1);
13806
13807var _slice = _interopRequireDefault(__webpack_require__(59));
13808
13809var _keys = _interopRequireDefault(__webpack_require__(57));
13810
13811var _concat = _interopRequireDefault(__webpack_require__(22));
13812
13813var _ = __webpack_require__(3);
13814
13815module.exports = function (AV) {
13816 var eventSplitter = /\s+/;
13817 var slice = (0, _slice.default)(Array.prototype);
13818 /**
13819 * @class
13820 *
13821 * <p>AV.Events is a fork of Backbone's Events module, provided for your
13822 * convenience.</p>
13823 *
13824 * <p>A module that can be mixed in to any object in order to provide
13825 * it with custom events. You may bind callback functions to an event
13826 * with `on`, or remove these functions with `off`.
13827 * Triggering an event fires all callbacks in the order that `on` was
13828 * called.
13829 *
13830 * @private
13831 * @example
13832 * var object = {};
13833 * _.extend(object, AV.Events);
13834 * object.on('expand', function(){ alert('expanded'); });
13835 * object.trigger('expand');</pre></p>
13836 *
13837 */
13838
13839 AV.Events = {
13840 /**
13841 * Bind one or more space separated events, `events`, to a `callback`
13842 * function. Passing `"all"` will bind the callback to all events fired.
13843 */
13844 on: function on(events, callback, context) {
13845 var calls, event, node, tail, list;
13846
13847 if (!callback) {
13848 return this;
13849 }
13850
13851 events = events.split(eventSplitter);
13852 calls = this._callbacks || (this._callbacks = {}); // Create an immutable callback list, allowing traversal during
13853 // modification. The tail is an empty object that will always be used
13854 // as the next node.
13855
13856 event = events.shift();
13857
13858 while (event) {
13859 list = calls[event];
13860 node = list ? list.tail : {};
13861 node.next = tail = {};
13862 node.context = context;
13863 node.callback = callback;
13864 calls[event] = {
13865 tail: tail,
13866 next: list ? list.next : node
13867 };
13868 event = events.shift();
13869 }
13870
13871 return this;
13872 },
13873
13874 /**
13875 * Remove one or many callbacks. If `context` is null, removes all callbacks
13876 * with that function. If `callback` is null, removes all callbacks for the
13877 * event. If `events` is null, removes all bound callbacks for all events.
13878 */
13879 off: function off(events, callback, context) {
13880 var event, calls, node, tail, cb, ctx; // No events, or removing *all* events.
13881
13882 if (!(calls = this._callbacks)) {
13883 return;
13884 }
13885
13886 if (!(events || callback || context)) {
13887 delete this._callbacks;
13888 return this;
13889 } // Loop through the listed events and contexts, splicing them out of the
13890 // linked list of callbacks if appropriate.
13891
13892
13893 events = events ? events.split(eventSplitter) : (0, _keys.default)(_).call(_, calls);
13894 event = events.shift();
13895
13896 while (event) {
13897 node = calls[event];
13898 delete calls[event];
13899
13900 if (!node || !(callback || context)) {
13901 continue;
13902 } // Create a new list, omitting the indicated callbacks.
13903
13904
13905 tail = node.tail;
13906 node = node.next;
13907
13908 while (node !== tail) {
13909 cb = node.callback;
13910 ctx = node.context;
13911
13912 if (callback && cb !== callback || context && ctx !== context) {
13913 this.on(event, cb, ctx);
13914 }
13915
13916 node = node.next;
13917 }
13918
13919 event = events.shift();
13920 }
13921
13922 return this;
13923 },
13924
13925 /**
13926 * Trigger one or many events, firing all bound callbacks. Callbacks are
13927 * passed the same arguments as `trigger` is, apart from the event name
13928 * (unless you're listening on `"all"`, which will cause your callback to
13929 * receive the true name of the event as the first argument).
13930 */
13931 trigger: function trigger(events) {
13932 var event, node, calls, tail, args, all, rest;
13933
13934 if (!(calls = this._callbacks)) {
13935 return this;
13936 }
13937
13938 all = calls.all;
13939 events = events.split(eventSplitter);
13940 rest = slice.call(arguments, 1); // For each event, walk through the linked list of callbacks twice,
13941 // first to trigger the event, then to trigger any `"all"` callbacks.
13942
13943 event = events.shift();
13944
13945 while (event) {
13946 node = calls[event];
13947
13948 if (node) {
13949 tail = node.tail;
13950
13951 while ((node = node.next) !== tail) {
13952 node.callback.apply(node.context || this, rest);
13953 }
13954 }
13955
13956 node = all;
13957
13958 if (node) {
13959 var _context;
13960
13961 tail = node.tail;
13962 args = (0, _concat.default)(_context = [event]).call(_context, rest);
13963
13964 while ((node = node.next) !== tail) {
13965 node.callback.apply(node.context || this, args);
13966 }
13967 }
13968
13969 event = events.shift();
13970 }
13971
13972 return this;
13973 }
13974 };
13975 /**
13976 * @function
13977 */
13978
13979 AV.Events.bind = AV.Events.on;
13980 /**
13981 * @function
13982 */
13983
13984 AV.Events.unbind = AV.Events.off;
13985};
13986
13987/***/ }),
13988/* 465 */
13989/***/ (function(module, exports, __webpack_require__) {
13990
13991"use strict";
13992
13993
13994var _interopRequireDefault = __webpack_require__(1);
13995
13996var _promise = _interopRequireDefault(__webpack_require__(13));
13997
13998var _ = __webpack_require__(3);
13999/*global navigator: false */
14000
14001
14002module.exports = function (AV) {
14003 /**
14004 * Creates a new GeoPoint with any of the following forms:<br>
14005 * @example
14006 * new GeoPoint(otherGeoPoint)
14007 * new GeoPoint(30, 30)
14008 * new GeoPoint([30, 30])
14009 * new GeoPoint({latitude: 30, longitude: 30})
14010 * new GeoPoint() // defaults to (0, 0)
14011 * @class
14012 *
14013 * <p>Represents a latitude / longitude point that may be associated
14014 * with a key in a AVObject or used as a reference point for geo queries.
14015 * This allows proximity-based queries on the key.</p>
14016 *
14017 * <p>Only one key in a class may contain a GeoPoint.</p>
14018 *
14019 * <p>Example:<pre>
14020 * var point = new AV.GeoPoint(30.0, -20.0);
14021 * var object = new AV.Object("PlaceObject");
14022 * object.set("location", point);
14023 * object.save();</pre></p>
14024 */
14025 AV.GeoPoint = function (arg1, arg2) {
14026 if (_.isArray(arg1)) {
14027 AV.GeoPoint._validate(arg1[0], arg1[1]);
14028
14029 this.latitude = arg1[0];
14030 this.longitude = arg1[1];
14031 } else if (_.isObject(arg1)) {
14032 AV.GeoPoint._validate(arg1.latitude, arg1.longitude);
14033
14034 this.latitude = arg1.latitude;
14035 this.longitude = arg1.longitude;
14036 } else if (_.isNumber(arg1) && _.isNumber(arg2)) {
14037 AV.GeoPoint._validate(arg1, arg2);
14038
14039 this.latitude = arg1;
14040 this.longitude = arg2;
14041 } else {
14042 this.latitude = 0;
14043 this.longitude = 0;
14044 } // Add properties so that anyone using Webkit or Mozilla will get an error
14045 // if they try to set values that are out of bounds.
14046
14047
14048 var self = this;
14049
14050 if (this.__defineGetter__ && this.__defineSetter__) {
14051 // Use _latitude and _longitude to actually store the values, and add
14052 // getters and setters for latitude and longitude.
14053 this._latitude = this.latitude;
14054 this._longitude = this.longitude;
14055
14056 this.__defineGetter__('latitude', function () {
14057 return self._latitude;
14058 });
14059
14060 this.__defineGetter__('longitude', function () {
14061 return self._longitude;
14062 });
14063
14064 this.__defineSetter__('latitude', function (val) {
14065 AV.GeoPoint._validate(val, self.longitude);
14066
14067 self._latitude = val;
14068 });
14069
14070 this.__defineSetter__('longitude', function (val) {
14071 AV.GeoPoint._validate(self.latitude, val);
14072
14073 self._longitude = val;
14074 });
14075 }
14076 };
14077 /**
14078 * @lends AV.GeoPoint.prototype
14079 * @property {float} latitude North-south portion of the coordinate, in range
14080 * [-90, 90]. Throws an exception if set out of range in a modern browser.
14081 * @property {float} longitude East-west portion of the coordinate, in range
14082 * [-180, 180]. Throws if set out of range in a modern browser.
14083 */
14084
14085 /**
14086 * Throws an exception if the given lat-long is out of bounds.
14087 * @private
14088 */
14089
14090
14091 AV.GeoPoint._validate = function (latitude, longitude) {
14092 if (latitude < -90.0) {
14093 throw new Error('AV.GeoPoint latitude ' + latitude + ' < -90.0.');
14094 }
14095
14096 if (latitude > 90.0) {
14097 throw new Error('AV.GeoPoint latitude ' + latitude + ' > 90.0.');
14098 }
14099
14100 if (longitude < -180.0) {
14101 throw new Error('AV.GeoPoint longitude ' + longitude + ' < -180.0.');
14102 }
14103
14104 if (longitude > 180.0) {
14105 throw new Error('AV.GeoPoint longitude ' + longitude + ' > 180.0.');
14106 }
14107 };
14108 /**
14109 * Creates a GeoPoint with the user's current location, if available.
14110 * @return {Promise.<AV.GeoPoint>}
14111 */
14112
14113
14114 AV.GeoPoint.current = function () {
14115 return new _promise.default(function (resolve, reject) {
14116 navigator.geolocation.getCurrentPosition(function (location) {
14117 resolve(new AV.GeoPoint({
14118 latitude: location.coords.latitude,
14119 longitude: location.coords.longitude
14120 }));
14121 }, reject);
14122 });
14123 };
14124
14125 _.extend(AV.GeoPoint.prototype,
14126 /** @lends AV.GeoPoint.prototype */
14127 {
14128 /**
14129 * Returns a JSON representation of the GeoPoint, suitable for AV.
14130 * @return {Object}
14131 */
14132 toJSON: function toJSON() {
14133 AV.GeoPoint._validate(this.latitude, this.longitude);
14134
14135 return {
14136 __type: 'GeoPoint',
14137 latitude: this.latitude,
14138 longitude: this.longitude
14139 };
14140 },
14141
14142 /**
14143 * Returns the distance from this GeoPoint to another in radians.
14144 * @param {AV.GeoPoint} point the other AV.GeoPoint.
14145 * @return {Number}
14146 */
14147 radiansTo: function radiansTo(point) {
14148 var d2r = Math.PI / 180.0;
14149 var lat1rad = this.latitude * d2r;
14150 var long1rad = this.longitude * d2r;
14151 var lat2rad = point.latitude * d2r;
14152 var long2rad = point.longitude * d2r;
14153 var deltaLat = lat1rad - lat2rad;
14154 var deltaLong = long1rad - long2rad;
14155 var sinDeltaLatDiv2 = Math.sin(deltaLat / 2);
14156 var sinDeltaLongDiv2 = Math.sin(deltaLong / 2); // Square of half the straight line chord distance between both points.
14157
14158 var a = sinDeltaLatDiv2 * sinDeltaLatDiv2 + Math.cos(lat1rad) * Math.cos(lat2rad) * sinDeltaLongDiv2 * sinDeltaLongDiv2;
14159 a = Math.min(1.0, a);
14160 return 2 * Math.asin(Math.sqrt(a));
14161 },
14162
14163 /**
14164 * Returns the distance from this GeoPoint to another in kilometers.
14165 * @param {AV.GeoPoint} point the other AV.GeoPoint.
14166 * @return {Number}
14167 */
14168 kilometersTo: function kilometersTo(point) {
14169 return this.radiansTo(point) * 6371.0;
14170 },
14171
14172 /**
14173 * Returns the distance from this GeoPoint to another in miles.
14174 * @param {AV.GeoPoint} point the other AV.GeoPoint.
14175 * @return {Number}
14176 */
14177 milesTo: function milesTo(point) {
14178 return this.radiansTo(point) * 3958.8;
14179 }
14180 });
14181};
14182
14183/***/ }),
14184/* 466 */
14185/***/ (function(module, exports, __webpack_require__) {
14186
14187"use strict";
14188
14189
14190var _ = __webpack_require__(3);
14191
14192module.exports = function (AV) {
14193 var PUBLIC_KEY = '*';
14194 /**
14195 * Creates a new ACL.
14196 * If no argument is given, the ACL has no permissions for anyone.
14197 * If the argument is a AV.User, the ACL will have read and write
14198 * permission for only that user.
14199 * If the argument is any other JSON object, that object will be interpretted
14200 * as a serialized ACL created with toJSON().
14201 * @see AV.Object#setACL
14202 * @class
14203 *
14204 * <p>An ACL, or Access Control List can be added to any
14205 * <code>AV.Object</code> to restrict access to only a subset of users
14206 * of your application.</p>
14207 */
14208
14209 AV.ACL = function (arg1) {
14210 var self = this;
14211 self.permissionsById = {};
14212
14213 if (_.isObject(arg1)) {
14214 if (arg1 instanceof AV.User) {
14215 self.setReadAccess(arg1, true);
14216 self.setWriteAccess(arg1, true);
14217 } else {
14218 if (_.isFunction(arg1)) {
14219 throw new Error('AV.ACL() called with a function. Did you forget ()?');
14220 }
14221
14222 AV._objectEach(arg1, function (accessList, userId) {
14223 if (!_.isString(userId)) {
14224 throw new Error('Tried to create an ACL with an invalid userId.');
14225 }
14226
14227 self.permissionsById[userId] = {};
14228
14229 AV._objectEach(accessList, function (allowed, permission) {
14230 if (permission !== 'read' && permission !== 'write') {
14231 throw new Error('Tried to create an ACL with an invalid permission type.');
14232 }
14233
14234 if (!_.isBoolean(allowed)) {
14235 throw new Error('Tried to create an ACL with an invalid permission value.');
14236 }
14237
14238 self.permissionsById[userId][permission] = allowed;
14239 });
14240 });
14241 }
14242 }
14243 };
14244 /**
14245 * Returns a JSON-encoded version of the ACL.
14246 * @return {Object}
14247 */
14248
14249
14250 AV.ACL.prototype.toJSON = function () {
14251 return _.clone(this.permissionsById);
14252 };
14253
14254 AV.ACL.prototype._setAccess = function (accessType, userId, allowed) {
14255 if (userId instanceof AV.User) {
14256 userId = userId.id;
14257 } else if (userId instanceof AV.Role) {
14258 userId = 'role:' + userId.getName();
14259 }
14260
14261 if (!_.isString(userId)) {
14262 throw new Error('userId must be a string.');
14263 }
14264
14265 if (!_.isBoolean(allowed)) {
14266 throw new Error('allowed must be either true or false.');
14267 }
14268
14269 var permissions = this.permissionsById[userId];
14270
14271 if (!permissions) {
14272 if (!allowed) {
14273 // The user already doesn't have this permission, so no action needed.
14274 return;
14275 } else {
14276 permissions = {};
14277 this.permissionsById[userId] = permissions;
14278 }
14279 }
14280
14281 if (allowed) {
14282 this.permissionsById[userId][accessType] = true;
14283 } else {
14284 delete permissions[accessType];
14285
14286 if (_.isEmpty(permissions)) {
14287 delete this.permissionsById[userId];
14288 }
14289 }
14290 };
14291
14292 AV.ACL.prototype._getAccess = function (accessType, userId) {
14293 if (userId instanceof AV.User) {
14294 userId = userId.id;
14295 } else if (userId instanceof AV.Role) {
14296 userId = 'role:' + userId.getName();
14297 }
14298
14299 var permissions = this.permissionsById[userId];
14300
14301 if (!permissions) {
14302 return false;
14303 }
14304
14305 return permissions[accessType] ? true : false;
14306 };
14307 /**
14308 * Set whether the given user is allowed to read this object.
14309 * @param userId An instance of AV.User or its objectId.
14310 * @param {Boolean} allowed Whether that user should have read access.
14311 */
14312
14313
14314 AV.ACL.prototype.setReadAccess = function (userId, allowed) {
14315 this._setAccess('read', userId, allowed);
14316 };
14317 /**
14318 * Get whether the given user id is *explicitly* allowed to read this object.
14319 * Even if this returns false, the user may still be able to access it if
14320 * getPublicReadAccess returns true or a role that the user belongs to has
14321 * write access.
14322 * @param userId An instance of AV.User or its objectId, or a AV.Role.
14323 * @return {Boolean}
14324 */
14325
14326
14327 AV.ACL.prototype.getReadAccess = function (userId) {
14328 return this._getAccess('read', userId);
14329 };
14330 /**
14331 * Set whether the given user id is allowed to write this object.
14332 * @param userId An instance of AV.User or its objectId, or a AV.Role..
14333 * @param {Boolean} allowed Whether that user should have write access.
14334 */
14335
14336
14337 AV.ACL.prototype.setWriteAccess = function (userId, allowed) {
14338 this._setAccess('write', userId, allowed);
14339 };
14340 /**
14341 * Get whether the given user id is *explicitly* allowed to write this object.
14342 * Even if this returns false, the user may still be able to write it if
14343 * getPublicWriteAccess returns true or a role that the user belongs to has
14344 * write access.
14345 * @param userId An instance of AV.User or its objectId, or a AV.Role.
14346 * @return {Boolean}
14347 */
14348
14349
14350 AV.ACL.prototype.getWriteAccess = function (userId) {
14351 return this._getAccess('write', userId);
14352 };
14353 /**
14354 * Set whether the public is allowed to read this object.
14355 * @param {Boolean} allowed
14356 */
14357
14358
14359 AV.ACL.prototype.setPublicReadAccess = function (allowed) {
14360 this.setReadAccess(PUBLIC_KEY, allowed);
14361 };
14362 /**
14363 * Get whether the public is allowed to read this object.
14364 * @return {Boolean}
14365 */
14366
14367
14368 AV.ACL.prototype.getPublicReadAccess = function () {
14369 return this.getReadAccess(PUBLIC_KEY);
14370 };
14371 /**
14372 * Set whether the public is allowed to write this object.
14373 * @param {Boolean} allowed
14374 */
14375
14376
14377 AV.ACL.prototype.setPublicWriteAccess = function (allowed) {
14378 this.setWriteAccess(PUBLIC_KEY, allowed);
14379 };
14380 /**
14381 * Get whether the public is allowed to write this object.
14382 * @return {Boolean}
14383 */
14384
14385
14386 AV.ACL.prototype.getPublicWriteAccess = function () {
14387 return this.getWriteAccess(PUBLIC_KEY);
14388 };
14389 /**
14390 * Get whether users belonging to the given role are allowed
14391 * to read this object. Even if this returns false, the role may
14392 * still be able to write it if a parent role has read access.
14393 *
14394 * @param role The name of the role, or a AV.Role object.
14395 * @return {Boolean} true if the role has read access. false otherwise.
14396 * @throws {String} If role is neither a AV.Role nor a String.
14397 */
14398
14399
14400 AV.ACL.prototype.getRoleReadAccess = function (role) {
14401 if (role instanceof AV.Role) {
14402 // Normalize to the String name
14403 role = role.getName();
14404 }
14405
14406 if (_.isString(role)) {
14407 return this.getReadAccess('role:' + role);
14408 }
14409
14410 throw new Error('role must be a AV.Role or a String');
14411 };
14412 /**
14413 * Get whether users belonging to the given role are allowed
14414 * to write this object. Even if this returns false, the role may
14415 * still be able to write it if a parent role has write access.
14416 *
14417 * @param role The name of the role, or a AV.Role object.
14418 * @return {Boolean} true if the role has write access. false otherwise.
14419 * @throws {String} If role is neither a AV.Role nor a String.
14420 */
14421
14422
14423 AV.ACL.prototype.getRoleWriteAccess = function (role) {
14424 if (role instanceof AV.Role) {
14425 // Normalize to the String name
14426 role = role.getName();
14427 }
14428
14429 if (_.isString(role)) {
14430 return this.getWriteAccess('role:' + role);
14431 }
14432
14433 throw new Error('role must be a AV.Role or a String');
14434 };
14435 /**
14436 * Set whether users belonging to the given role are allowed
14437 * to read this object.
14438 *
14439 * @param role The name of the role, or a AV.Role object.
14440 * @param {Boolean} allowed Whether the given role can read this object.
14441 * @throws {String} If role is neither a AV.Role nor a String.
14442 */
14443
14444
14445 AV.ACL.prototype.setRoleReadAccess = function (role, allowed) {
14446 if (role instanceof AV.Role) {
14447 // Normalize to the String name
14448 role = role.getName();
14449 }
14450
14451 if (_.isString(role)) {
14452 this.setReadAccess('role:' + role, allowed);
14453 return;
14454 }
14455
14456 throw new Error('role must be a AV.Role or a String');
14457 };
14458 /**
14459 * Set whether users belonging to the given role are allowed
14460 * to write this object.
14461 *
14462 * @param role The name of the role, or a AV.Role object.
14463 * @param {Boolean} allowed Whether the given role can write this object.
14464 * @throws {String} If role is neither a AV.Role nor a String.
14465 */
14466
14467
14468 AV.ACL.prototype.setRoleWriteAccess = function (role, allowed) {
14469 if (role instanceof AV.Role) {
14470 // Normalize to the String name
14471 role = role.getName();
14472 }
14473
14474 if (_.isString(role)) {
14475 this.setWriteAccess('role:' + role, allowed);
14476 return;
14477 }
14478
14479 throw new Error('role must be a AV.Role or a String');
14480 };
14481};
14482
14483/***/ }),
14484/* 467 */
14485/***/ (function(module, exports, __webpack_require__) {
14486
14487"use strict";
14488
14489
14490var _interopRequireDefault = __webpack_require__(1);
14491
14492var _concat = _interopRequireDefault(__webpack_require__(22));
14493
14494var _find = _interopRequireDefault(__webpack_require__(92));
14495
14496var _indexOf = _interopRequireDefault(__webpack_require__(90));
14497
14498var _map = _interopRequireDefault(__webpack_require__(35));
14499
14500var _ = __webpack_require__(3);
14501
14502module.exports = function (AV) {
14503 /**
14504 * @private
14505 * @class
14506 * A AV.Op is an atomic operation that can be applied to a field in a
14507 * AV.Object. For example, calling <code>object.set("foo", "bar")</code>
14508 * is an example of a AV.Op.Set. Calling <code>object.unset("foo")</code>
14509 * is a AV.Op.Unset. These operations are stored in a AV.Object and
14510 * sent to the server as part of <code>object.save()</code> operations.
14511 * Instances of AV.Op should be immutable.
14512 *
14513 * You should not create subclasses of AV.Op or instantiate AV.Op
14514 * directly.
14515 */
14516 AV.Op = function () {
14517 this._initialize.apply(this, arguments);
14518 };
14519
14520 _.extend(AV.Op.prototype,
14521 /** @lends AV.Op.prototype */
14522 {
14523 _initialize: function _initialize() {}
14524 });
14525
14526 _.extend(AV.Op, {
14527 /**
14528 * To create a new Op, call AV.Op._extend();
14529 * @private
14530 */
14531 _extend: AV._extend,
14532 // A map of __op string to decoder function.
14533 _opDecoderMap: {},
14534
14535 /**
14536 * Registers a function to convert a json object with an __op field into an
14537 * instance of a subclass of AV.Op.
14538 * @private
14539 */
14540 _registerDecoder: function _registerDecoder(opName, decoder) {
14541 AV.Op._opDecoderMap[opName] = decoder;
14542 },
14543
14544 /**
14545 * Converts a json object into an instance of a subclass of AV.Op.
14546 * @private
14547 */
14548 _decode: function _decode(json) {
14549 var decoder = AV.Op._opDecoderMap[json.__op];
14550
14551 if (decoder) {
14552 return decoder(json);
14553 } else {
14554 return undefined;
14555 }
14556 }
14557 });
14558 /*
14559 * Add a handler for Batch ops.
14560 */
14561
14562
14563 AV.Op._registerDecoder('Batch', function (json) {
14564 var op = null;
14565
14566 AV._arrayEach(json.ops, function (nextOp) {
14567 nextOp = AV.Op._decode(nextOp);
14568 op = nextOp._mergeWithPrevious(op);
14569 });
14570
14571 return op;
14572 });
14573 /**
14574 * @private
14575 * @class
14576 * A Set operation indicates that either the field was changed using
14577 * AV.Object.set, or it is a mutable container that was detected as being
14578 * changed.
14579 */
14580
14581
14582 AV.Op.Set = AV.Op._extend(
14583 /** @lends AV.Op.Set.prototype */
14584 {
14585 _initialize: function _initialize(value) {
14586 this._value = value;
14587 },
14588
14589 /**
14590 * Returns the new value of this field after the set.
14591 */
14592 value: function value() {
14593 return this._value;
14594 },
14595
14596 /**
14597 * Returns a JSON version of the operation suitable for sending to AV.
14598 * @return {Object}
14599 */
14600 toJSON: function toJSON() {
14601 return AV._encode(this.value());
14602 },
14603 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14604 return this;
14605 },
14606 _estimate: function _estimate(oldValue) {
14607 return this.value();
14608 }
14609 });
14610 /**
14611 * A sentinel value that is returned by AV.Op.Unset._estimate to
14612 * indicate the field should be deleted. Basically, if you find _UNSET as a
14613 * value in your object, you should remove that key.
14614 */
14615
14616 AV.Op._UNSET = {};
14617 /**
14618 * @private
14619 * @class
14620 * An Unset operation indicates that this field has been deleted from the
14621 * object.
14622 */
14623
14624 AV.Op.Unset = AV.Op._extend(
14625 /** @lends AV.Op.Unset.prototype */
14626 {
14627 /**
14628 * Returns a JSON version of the operation suitable for sending to AV.
14629 * @return {Object}
14630 */
14631 toJSON: function toJSON() {
14632 return {
14633 __op: 'Delete'
14634 };
14635 },
14636 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14637 return this;
14638 },
14639 _estimate: function _estimate(oldValue) {
14640 return AV.Op._UNSET;
14641 }
14642 });
14643
14644 AV.Op._registerDecoder('Delete', function (json) {
14645 return new AV.Op.Unset();
14646 });
14647 /**
14648 * @private
14649 * @class
14650 * An Increment is an atomic operation where the numeric value for the field
14651 * will be increased by a given amount.
14652 */
14653
14654
14655 AV.Op.Increment = AV.Op._extend(
14656 /** @lends AV.Op.Increment.prototype */
14657 {
14658 _initialize: function _initialize(amount) {
14659 this._amount = amount;
14660 },
14661
14662 /**
14663 * Returns the amount to increment by.
14664 * @return {Number} the amount to increment by.
14665 */
14666 amount: function amount() {
14667 return this._amount;
14668 },
14669
14670 /**
14671 * Returns a JSON version of the operation suitable for sending to AV.
14672 * @return {Object}
14673 */
14674 toJSON: function toJSON() {
14675 return {
14676 __op: 'Increment',
14677 amount: this._amount
14678 };
14679 },
14680 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14681 if (!previous) {
14682 return this;
14683 } else if (previous instanceof AV.Op.Unset) {
14684 return new AV.Op.Set(this.amount());
14685 } else if (previous instanceof AV.Op.Set) {
14686 return new AV.Op.Set(previous.value() + this.amount());
14687 } else if (previous instanceof AV.Op.Increment) {
14688 return new AV.Op.Increment(this.amount() + previous.amount());
14689 } else {
14690 throw new Error('Op is invalid after previous op.');
14691 }
14692 },
14693 _estimate: function _estimate(oldValue) {
14694 if (!oldValue) {
14695 return this.amount();
14696 }
14697
14698 return oldValue + this.amount();
14699 }
14700 });
14701
14702 AV.Op._registerDecoder('Increment', function (json) {
14703 return new AV.Op.Increment(json.amount);
14704 });
14705 /**
14706 * @private
14707 * @class
14708 * BitAnd is an atomic operation where the given value will be bit and to the
14709 * value than is stored in this field.
14710 */
14711
14712
14713 AV.Op.BitAnd = AV.Op._extend(
14714 /** @lends AV.Op.BitAnd.prototype */
14715 {
14716 _initialize: function _initialize(value) {
14717 this._value = value;
14718 },
14719 value: function value() {
14720 return this._value;
14721 },
14722
14723 /**
14724 * Returns a JSON version of the operation suitable for sending to AV.
14725 * @return {Object}
14726 */
14727 toJSON: function toJSON() {
14728 return {
14729 __op: 'BitAnd',
14730 value: this.value()
14731 };
14732 },
14733 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14734 if (!previous) {
14735 return this;
14736 } else if (previous instanceof AV.Op.Unset) {
14737 return new AV.Op.Set(0);
14738 } else if (previous instanceof AV.Op.Set) {
14739 return new AV.Op.Set(previous.value() & this.value());
14740 } else {
14741 throw new Error('Op is invalid after previous op.');
14742 }
14743 },
14744 _estimate: function _estimate(oldValue) {
14745 return oldValue & this.value();
14746 }
14747 });
14748
14749 AV.Op._registerDecoder('BitAnd', function (json) {
14750 return new AV.Op.BitAnd(json.value);
14751 });
14752 /**
14753 * @private
14754 * @class
14755 * BitOr is an atomic operation where the given value will be bit and to the
14756 * value than is stored in this field.
14757 */
14758
14759
14760 AV.Op.BitOr = AV.Op._extend(
14761 /** @lends AV.Op.BitOr.prototype */
14762 {
14763 _initialize: function _initialize(value) {
14764 this._value = value;
14765 },
14766 value: function value() {
14767 return this._value;
14768 },
14769
14770 /**
14771 * Returns a JSON version of the operation suitable for sending to AV.
14772 * @return {Object}
14773 */
14774 toJSON: function toJSON() {
14775 return {
14776 __op: 'BitOr',
14777 value: this.value()
14778 };
14779 },
14780 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14781 if (!previous) {
14782 return this;
14783 } else if (previous instanceof AV.Op.Unset) {
14784 return new AV.Op.Set(this.value());
14785 } else if (previous instanceof AV.Op.Set) {
14786 return new AV.Op.Set(previous.value() | this.value());
14787 } else {
14788 throw new Error('Op is invalid after previous op.');
14789 }
14790 },
14791 _estimate: function _estimate(oldValue) {
14792 return oldValue | this.value();
14793 }
14794 });
14795
14796 AV.Op._registerDecoder('BitOr', function (json) {
14797 return new AV.Op.BitOr(json.value);
14798 });
14799 /**
14800 * @private
14801 * @class
14802 * BitXor is an atomic operation where the given value will be bit and to the
14803 * value than is stored in this field.
14804 */
14805
14806
14807 AV.Op.BitXor = AV.Op._extend(
14808 /** @lends AV.Op.BitXor.prototype */
14809 {
14810 _initialize: function _initialize(value) {
14811 this._value = value;
14812 },
14813 value: function value() {
14814 return this._value;
14815 },
14816
14817 /**
14818 * Returns a JSON version of the operation suitable for sending to AV.
14819 * @return {Object}
14820 */
14821 toJSON: function toJSON() {
14822 return {
14823 __op: 'BitXor',
14824 value: this.value()
14825 };
14826 },
14827 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14828 if (!previous) {
14829 return this;
14830 } else if (previous instanceof AV.Op.Unset) {
14831 return new AV.Op.Set(this.value());
14832 } else if (previous instanceof AV.Op.Set) {
14833 return new AV.Op.Set(previous.value() ^ this.value());
14834 } else {
14835 throw new Error('Op is invalid after previous op.');
14836 }
14837 },
14838 _estimate: function _estimate(oldValue) {
14839 return oldValue ^ this.value();
14840 }
14841 });
14842
14843 AV.Op._registerDecoder('BitXor', function (json) {
14844 return new AV.Op.BitXor(json.value);
14845 });
14846 /**
14847 * @private
14848 * @class
14849 * Add is an atomic operation where the given objects will be appended to the
14850 * array that is stored in this field.
14851 */
14852
14853
14854 AV.Op.Add = AV.Op._extend(
14855 /** @lends AV.Op.Add.prototype */
14856 {
14857 _initialize: function _initialize(objects) {
14858 this._objects = objects;
14859 },
14860
14861 /**
14862 * Returns the objects to be added to the array.
14863 * @return {Array} The objects to be added to the array.
14864 */
14865 objects: function objects() {
14866 return this._objects;
14867 },
14868
14869 /**
14870 * Returns a JSON version of the operation suitable for sending to AV.
14871 * @return {Object}
14872 */
14873 toJSON: function toJSON() {
14874 return {
14875 __op: 'Add',
14876 objects: AV._encode(this.objects())
14877 };
14878 },
14879 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14880 if (!previous) {
14881 return this;
14882 } else if (previous instanceof AV.Op.Unset) {
14883 return new AV.Op.Set(this.objects());
14884 } else if (previous instanceof AV.Op.Set) {
14885 return new AV.Op.Set(this._estimate(previous.value()));
14886 } else if (previous instanceof AV.Op.Add) {
14887 var _context;
14888
14889 return new AV.Op.Add((0, _concat.default)(_context = previous.objects()).call(_context, this.objects()));
14890 } else {
14891 throw new Error('Op is invalid after previous op.');
14892 }
14893 },
14894 _estimate: function _estimate(oldValue) {
14895 if (!oldValue) {
14896 return _.clone(this.objects());
14897 } else {
14898 return (0, _concat.default)(oldValue).call(oldValue, this.objects());
14899 }
14900 }
14901 });
14902
14903 AV.Op._registerDecoder('Add', function (json) {
14904 return new AV.Op.Add(AV._decode(json.objects));
14905 });
14906 /**
14907 * @private
14908 * @class
14909 * AddUnique is an atomic operation where the given items will be appended to
14910 * the array that is stored in this field only if they were not already
14911 * present in the array.
14912 */
14913
14914
14915 AV.Op.AddUnique = AV.Op._extend(
14916 /** @lends AV.Op.AddUnique.prototype */
14917 {
14918 _initialize: function _initialize(objects) {
14919 this._objects = _.uniq(objects);
14920 },
14921
14922 /**
14923 * Returns the objects to be added to the array.
14924 * @return {Array} The objects to be added to the array.
14925 */
14926 objects: function objects() {
14927 return this._objects;
14928 },
14929
14930 /**
14931 * Returns a JSON version of the operation suitable for sending to AV.
14932 * @return {Object}
14933 */
14934 toJSON: function toJSON() {
14935 return {
14936 __op: 'AddUnique',
14937 objects: AV._encode(this.objects())
14938 };
14939 },
14940 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14941 if (!previous) {
14942 return this;
14943 } else if (previous instanceof AV.Op.Unset) {
14944 return new AV.Op.Set(this.objects());
14945 } else if (previous instanceof AV.Op.Set) {
14946 return new AV.Op.Set(this._estimate(previous.value()));
14947 } else if (previous instanceof AV.Op.AddUnique) {
14948 return new AV.Op.AddUnique(this._estimate(previous.objects()));
14949 } else {
14950 throw new Error('Op is invalid after previous op.');
14951 }
14952 },
14953 _estimate: function _estimate(oldValue) {
14954 if (!oldValue) {
14955 return _.clone(this.objects());
14956 } else {
14957 // We can't just take the _.uniq(_.union(...)) of oldValue and
14958 // this.objects, because the uniqueness may not apply to oldValue
14959 // (especially if the oldValue was set via .set())
14960 var newValue = _.clone(oldValue);
14961
14962 AV._arrayEach(this.objects(), function (obj) {
14963 if (obj instanceof AV.Object && obj.id) {
14964 var matchingObj = (0, _find.default)(_).call(_, newValue, function (anObj) {
14965 return anObj instanceof AV.Object && anObj.id === obj.id;
14966 });
14967
14968 if (!matchingObj) {
14969 newValue.push(obj);
14970 } else {
14971 var index = (0, _indexOf.default)(_).call(_, newValue, matchingObj);
14972 newValue[index] = obj;
14973 }
14974 } else if (!_.contains(newValue, obj)) {
14975 newValue.push(obj);
14976 }
14977 });
14978
14979 return newValue;
14980 }
14981 }
14982 });
14983
14984 AV.Op._registerDecoder('AddUnique', function (json) {
14985 return new AV.Op.AddUnique(AV._decode(json.objects));
14986 });
14987 /**
14988 * @private
14989 * @class
14990 * Remove is an atomic operation where the given objects will be removed from
14991 * the array that is stored in this field.
14992 */
14993
14994
14995 AV.Op.Remove = AV.Op._extend(
14996 /** @lends AV.Op.Remove.prototype */
14997 {
14998 _initialize: function _initialize(objects) {
14999 this._objects = _.uniq(objects);
15000 },
15001
15002 /**
15003 * Returns the objects to be removed from the array.
15004 * @return {Array} The objects to be removed from the array.
15005 */
15006 objects: function objects() {
15007 return this._objects;
15008 },
15009
15010 /**
15011 * Returns a JSON version of the operation suitable for sending to AV.
15012 * @return {Object}
15013 */
15014 toJSON: function toJSON() {
15015 return {
15016 __op: 'Remove',
15017 objects: AV._encode(this.objects())
15018 };
15019 },
15020 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15021 if (!previous) {
15022 return this;
15023 } else if (previous instanceof AV.Op.Unset) {
15024 return previous;
15025 } else if (previous instanceof AV.Op.Set) {
15026 return new AV.Op.Set(this._estimate(previous.value()));
15027 } else if (previous instanceof AV.Op.Remove) {
15028 return new AV.Op.Remove(_.union(previous.objects(), this.objects()));
15029 } else {
15030 throw new Error('Op is invalid after previous op.');
15031 }
15032 },
15033 _estimate: function _estimate(oldValue) {
15034 if (!oldValue) {
15035 return [];
15036 } else {
15037 var newValue = _.difference(oldValue, this.objects()); // If there are saved AV Objects being removed, also remove them.
15038
15039
15040 AV._arrayEach(this.objects(), function (obj) {
15041 if (obj instanceof AV.Object && obj.id) {
15042 newValue = _.reject(newValue, function (other) {
15043 return other instanceof AV.Object && other.id === obj.id;
15044 });
15045 }
15046 });
15047
15048 return newValue;
15049 }
15050 }
15051 });
15052
15053 AV.Op._registerDecoder('Remove', function (json) {
15054 return new AV.Op.Remove(AV._decode(json.objects));
15055 });
15056 /**
15057 * @private
15058 * @class
15059 * A Relation operation indicates that the field is an instance of
15060 * AV.Relation, and objects are being added to, or removed from, that
15061 * relation.
15062 */
15063
15064
15065 AV.Op.Relation = AV.Op._extend(
15066 /** @lends AV.Op.Relation.prototype */
15067 {
15068 _initialize: function _initialize(adds, removes) {
15069 this._targetClassName = null;
15070 var self = this;
15071
15072 var pointerToId = function pointerToId(object) {
15073 if (object instanceof AV.Object) {
15074 if (!object.id) {
15075 throw new Error("You can't add an unsaved AV.Object to a relation.");
15076 }
15077
15078 if (!self._targetClassName) {
15079 self._targetClassName = object.className;
15080 }
15081
15082 if (self._targetClassName !== object.className) {
15083 throw new Error('Tried to create a AV.Relation with 2 different types: ' + self._targetClassName + ' and ' + object.className + '.');
15084 }
15085
15086 return object.id;
15087 }
15088
15089 return object;
15090 };
15091
15092 this.relationsToAdd = _.uniq((0, _map.default)(_).call(_, adds, pointerToId));
15093 this.relationsToRemove = _.uniq((0, _map.default)(_).call(_, removes, pointerToId));
15094 },
15095
15096 /**
15097 * Returns an array of unfetched AV.Object that are being added to the
15098 * relation.
15099 * @return {Array}
15100 */
15101 added: function added() {
15102 var self = this;
15103 return (0, _map.default)(_).call(_, this.relationsToAdd, function (objectId) {
15104 var object = AV.Object._create(self._targetClassName);
15105
15106 object.id = objectId;
15107 return object;
15108 });
15109 },
15110
15111 /**
15112 * Returns an array of unfetched AV.Object that are being removed from
15113 * the relation.
15114 * @return {Array}
15115 */
15116 removed: function removed() {
15117 var self = this;
15118 return (0, _map.default)(_).call(_, this.relationsToRemove, function (objectId) {
15119 var object = AV.Object._create(self._targetClassName);
15120
15121 object.id = objectId;
15122 return object;
15123 });
15124 },
15125
15126 /**
15127 * Returns a JSON version of the operation suitable for sending to AV.
15128 * @return {Object}
15129 */
15130 toJSON: function toJSON() {
15131 var adds = null;
15132 var removes = null;
15133 var self = this;
15134
15135 var idToPointer = function idToPointer(id) {
15136 return {
15137 __type: 'Pointer',
15138 className: self._targetClassName,
15139 objectId: id
15140 };
15141 };
15142
15143 var pointers = null;
15144
15145 if (this.relationsToAdd.length > 0) {
15146 pointers = (0, _map.default)(_).call(_, this.relationsToAdd, idToPointer);
15147 adds = {
15148 __op: 'AddRelation',
15149 objects: pointers
15150 };
15151 }
15152
15153 if (this.relationsToRemove.length > 0) {
15154 pointers = (0, _map.default)(_).call(_, this.relationsToRemove, idToPointer);
15155 removes = {
15156 __op: 'RemoveRelation',
15157 objects: pointers
15158 };
15159 }
15160
15161 if (adds && removes) {
15162 return {
15163 __op: 'Batch',
15164 ops: [adds, removes]
15165 };
15166 }
15167
15168 return adds || removes || {};
15169 },
15170 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15171 if (!previous) {
15172 return this;
15173 } else if (previous instanceof AV.Op.Unset) {
15174 throw new Error("You can't modify a relation after deleting it.");
15175 } else if (previous instanceof AV.Op.Relation) {
15176 if (previous._targetClassName && previous._targetClassName !== this._targetClassName) {
15177 throw new Error('Related object must be of class ' + previous._targetClassName + ', but ' + this._targetClassName + ' was passed in.');
15178 }
15179
15180 var newAdd = _.union(_.difference(previous.relationsToAdd, this.relationsToRemove), this.relationsToAdd);
15181
15182 var newRemove = _.union(_.difference(previous.relationsToRemove, this.relationsToAdd), this.relationsToRemove);
15183
15184 var newRelation = new AV.Op.Relation(newAdd, newRemove);
15185 newRelation._targetClassName = this._targetClassName;
15186 return newRelation;
15187 } else {
15188 throw new Error('Op is invalid after previous op.');
15189 }
15190 },
15191 _estimate: function _estimate(oldValue, object, key) {
15192 if (!oldValue) {
15193 var relation = new AV.Relation(object, key);
15194 relation.targetClassName = this._targetClassName;
15195 } else if (oldValue instanceof AV.Relation) {
15196 if (this._targetClassName) {
15197 if (oldValue.targetClassName) {
15198 if (oldValue.targetClassName !== this._targetClassName) {
15199 throw new Error('Related object must be a ' + oldValue.targetClassName + ', but a ' + this._targetClassName + ' was passed in.');
15200 }
15201 } else {
15202 oldValue.targetClassName = this._targetClassName;
15203 }
15204 }
15205
15206 return oldValue;
15207 } else {
15208 throw new Error('Op is invalid after previous op.');
15209 }
15210 }
15211 });
15212
15213 AV.Op._registerDecoder('AddRelation', function (json) {
15214 return new AV.Op.Relation(AV._decode(json.objects), []);
15215 });
15216
15217 AV.Op._registerDecoder('RemoveRelation', function (json) {
15218 return new AV.Op.Relation([], AV._decode(json.objects));
15219 });
15220};
15221
15222/***/ }),
15223/* 468 */
15224/***/ (function(module, exports, __webpack_require__) {
15225
15226var parent = __webpack_require__(469);
15227
15228module.exports = parent;
15229
15230
15231/***/ }),
15232/* 469 */
15233/***/ (function(module, exports, __webpack_require__) {
15234
15235var isPrototypeOf = __webpack_require__(19);
15236var method = __webpack_require__(470);
15237
15238var ArrayPrototype = Array.prototype;
15239
15240module.exports = function (it) {
15241 var own = it.find;
15242 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.find) ? method : own;
15243};
15244
15245
15246/***/ }),
15247/* 470 */
15248/***/ (function(module, exports, __webpack_require__) {
15249
15250__webpack_require__(471);
15251var entryVirtual = __webpack_require__(38);
15252
15253module.exports = entryVirtual('Array').find;
15254
15255
15256/***/ }),
15257/* 471 */
15258/***/ (function(module, exports, __webpack_require__) {
15259
15260"use strict";
15261
15262var $ = __webpack_require__(0);
15263var $find = __webpack_require__(70).find;
15264var addToUnscopables = __webpack_require__(163);
15265
15266var FIND = 'find';
15267var SKIPS_HOLES = true;
15268
15269// Shouldn't skip holes
15270if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
15271
15272// `Array.prototype.find` method
15273// https://tc39.es/ecma262/#sec-array.prototype.find
15274$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
15275 find: function find(callbackfn /* , that = undefined */) {
15276 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
15277 }
15278});
15279
15280// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
15281addToUnscopables(FIND);
15282
15283
15284/***/ }),
15285/* 472 */
15286/***/ (function(module, exports, __webpack_require__) {
15287
15288"use strict";
15289
15290
15291var _ = __webpack_require__(3);
15292
15293module.exports = function (AV) {
15294 /**
15295 * Creates a new Relation for the given parent object and key. This
15296 * constructor should rarely be used directly, but rather created by
15297 * {@link AV.Object#relation}.
15298 * @param {AV.Object} parent The parent of this relation.
15299 * @param {String} key The key for this relation on the parent.
15300 * @see AV.Object#relation
15301 * @class
15302 *
15303 * <p>
15304 * A class that is used to access all of the children of a many-to-many
15305 * relationship. Each instance of AV.Relation is associated with a
15306 * particular parent object and key.
15307 * </p>
15308 */
15309 AV.Relation = function (parent, key) {
15310 if (!_.isString(key)) {
15311 throw new TypeError('key must be a string');
15312 }
15313
15314 this.parent = parent;
15315 this.key = key;
15316 this.targetClassName = null;
15317 };
15318 /**
15319 * Creates a query that can be used to query the parent objects in this relation.
15320 * @param {String} parentClass The parent class or name.
15321 * @param {String} relationKey The relation field key in parent.
15322 * @param {AV.Object} child The child object.
15323 * @return {AV.Query}
15324 */
15325
15326
15327 AV.Relation.reverseQuery = function (parentClass, relationKey, child) {
15328 var query = new AV.Query(parentClass);
15329 query.equalTo(relationKey, child._toPointer());
15330 return query;
15331 };
15332
15333 _.extend(AV.Relation.prototype,
15334 /** @lends AV.Relation.prototype */
15335 {
15336 /**
15337 * Makes sure that this relation has the right parent and key.
15338 * @private
15339 */
15340 _ensureParentAndKey: function _ensureParentAndKey(parent, key) {
15341 this.parent = this.parent || parent;
15342 this.key = this.key || key;
15343
15344 if (this.parent !== parent) {
15345 throw new Error('Internal Error. Relation retrieved from two different Objects.');
15346 }
15347
15348 if (this.key !== key) {
15349 throw new Error('Internal Error. Relation retrieved from two different keys.');
15350 }
15351 },
15352
15353 /**
15354 * Adds a AV.Object or an array of AV.Objects to the relation.
15355 * @param {AV.Object|AV.Object[]} objects The item or items to add.
15356 */
15357 add: function add(objects) {
15358 if (!_.isArray(objects)) {
15359 objects = [objects];
15360 }
15361
15362 var change = new AV.Op.Relation(objects, []);
15363 this.parent.set(this.key, change);
15364 this.targetClassName = change._targetClassName;
15365 },
15366
15367 /**
15368 * Removes a AV.Object or an array of AV.Objects from this relation.
15369 * @param {AV.Object|AV.Object[]} objects The item or items to remove.
15370 */
15371 remove: function remove(objects) {
15372 if (!_.isArray(objects)) {
15373 objects = [objects];
15374 }
15375
15376 var change = new AV.Op.Relation([], objects);
15377 this.parent.set(this.key, change);
15378 this.targetClassName = change._targetClassName;
15379 },
15380
15381 /**
15382 * Returns a JSON version of the object suitable for saving to disk.
15383 * @return {Object}
15384 */
15385 toJSON: function toJSON() {
15386 return {
15387 __type: 'Relation',
15388 className: this.targetClassName
15389 };
15390 },
15391
15392 /**
15393 * Returns a AV.Query that is limited to objects in this
15394 * relation.
15395 * @return {AV.Query}
15396 */
15397 query: function query() {
15398 var targetClass;
15399 var query;
15400
15401 if (!this.targetClassName) {
15402 targetClass = AV.Object._getSubclass(this.parent.className);
15403 query = new AV.Query(targetClass);
15404 query._defaultParams.redirectClassNameForKey = this.key;
15405 } else {
15406 targetClass = AV.Object._getSubclass(this.targetClassName);
15407 query = new AV.Query(targetClass);
15408 }
15409
15410 query._addCondition('$relatedTo', 'object', this.parent._toPointer());
15411
15412 query._addCondition('$relatedTo', 'key', this.key);
15413
15414 return query;
15415 }
15416 });
15417};
15418
15419/***/ }),
15420/* 473 */
15421/***/ (function(module, exports, __webpack_require__) {
15422
15423"use strict";
15424
15425
15426var _interopRequireDefault = __webpack_require__(1);
15427
15428var _promise = _interopRequireDefault(__webpack_require__(13));
15429
15430var _ = __webpack_require__(3);
15431
15432var cos = __webpack_require__(474);
15433
15434var qiniu = __webpack_require__(475);
15435
15436var s3 = __webpack_require__(521);
15437
15438var AVError = __webpack_require__(46);
15439
15440var _require = __webpack_require__(27),
15441 request = _require.request,
15442 AVRequest = _require._request;
15443
15444var _require2 = __webpack_require__(30),
15445 tap = _require2.tap,
15446 transformFetchOptions = _require2.transformFetchOptions;
15447
15448var debug = __webpack_require__(58)('leancloud:file');
15449
15450var parseBase64 = __webpack_require__(525);
15451
15452module.exports = function (AV) {
15453 // port from browserify path module
15454 // since react-native packager won't shim node modules.
15455 var extname = function extname(path) {
15456 if (!_.isString(path)) return '';
15457 return path.match(/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/)[4];
15458 };
15459
15460 var b64Digit = function b64Digit(number) {
15461 if (number < 26) {
15462 return String.fromCharCode(65 + number);
15463 }
15464
15465 if (number < 52) {
15466 return String.fromCharCode(97 + (number - 26));
15467 }
15468
15469 if (number < 62) {
15470 return String.fromCharCode(48 + (number - 52));
15471 }
15472
15473 if (number === 62) {
15474 return '+';
15475 }
15476
15477 if (number === 63) {
15478 return '/';
15479 }
15480
15481 throw new Error('Tried to encode large digit ' + number + ' in base64.');
15482 };
15483
15484 var encodeBase64 = function encodeBase64(array) {
15485 var chunks = [];
15486 chunks.length = Math.ceil(array.length / 3);
15487
15488 _.times(chunks.length, function (i) {
15489 var b1 = array[i * 3];
15490 var b2 = array[i * 3 + 1] || 0;
15491 var b3 = array[i * 3 + 2] || 0;
15492 var has2 = i * 3 + 1 < array.length;
15493 var has3 = i * 3 + 2 < array.length;
15494 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('');
15495 });
15496
15497 return chunks.join('');
15498 };
15499 /**
15500 * An AV.File is a local representation of a file that is saved to the AV
15501 * cloud.
15502 * @param name {String} The file's name. This will change to a unique value
15503 * once the file has finished saving.
15504 * @param data {Array} The data for the file, as either:
15505 * 1. an Array of byte value Numbers, or
15506 * 2. an Object like { base64: "..." } with a base64-encoded String.
15507 * 3. a Blob(File) selected with a file upload control in a browser.
15508 * 4. an Object like { blob: {uri: "..."} } that mimics Blob
15509 * in some non-browser environments such as React Native.
15510 * 5. a Buffer in Node.js runtime.
15511 * 6. a Stream in Node.js runtime.
15512 *
15513 * For example:<pre>
15514 * var fileUploadControl = $("#profilePhotoFileUpload")[0];
15515 * if (fileUploadControl.files.length > 0) {
15516 * var file = fileUploadControl.files[0];
15517 * var name = "photo.jpg";
15518 * var file = new AV.File(name, file);
15519 * file.save().then(function() {
15520 * // The file has been saved to AV.
15521 * }, function(error) {
15522 * // The file either could not be read, or could not be saved to AV.
15523 * });
15524 * }</pre>
15525 *
15526 * @class
15527 * @param [mimeType] {String} Content-Type header to use for the file. If
15528 * this is omitted, the content type will be inferred from the name's
15529 * extension.
15530 */
15531
15532
15533 AV.File = function (name, data, mimeType) {
15534 this.attributes = {
15535 name: name,
15536 url: '',
15537 metaData: {},
15538 // 用来存储转换后要上传的 base64 String
15539 base64: ''
15540 };
15541
15542 if (_.isString(data)) {
15543 throw new TypeError('Creating an AV.File from a String is not yet supported.');
15544 }
15545
15546 if (_.isArray(data)) {
15547 this.attributes.metaData.size = data.length;
15548 data = {
15549 base64: encodeBase64(data)
15550 };
15551 }
15552
15553 this._extName = '';
15554 this._data = data;
15555 this._uploadHeaders = {};
15556
15557 if (data && data.blob && typeof data.blob.uri === 'string') {
15558 this._extName = extname(data.blob.uri);
15559 }
15560
15561 if (typeof Blob !== 'undefined' && data instanceof Blob) {
15562 if (data.size) {
15563 this.attributes.metaData.size = data.size;
15564 }
15565
15566 if (data.name) {
15567 this._extName = extname(data.name);
15568 }
15569 }
15570
15571 var owner;
15572
15573 if (data && data.owner) {
15574 owner = data.owner;
15575 } else if (!AV._config.disableCurrentUser) {
15576 try {
15577 owner = AV.User.current();
15578 } catch (error) {
15579 if ('SYNC_API_NOT_AVAILABLE' !== error.code) {
15580 throw error;
15581 }
15582 }
15583 }
15584
15585 this.attributes.metaData.owner = owner ? owner.id : 'unknown';
15586 this.set('mime_type', mimeType);
15587 };
15588 /**
15589 * Creates a fresh AV.File object with exists url for saving to AVOS Cloud.
15590 * @param {String} name the file name
15591 * @param {String} url the file url.
15592 * @param {Object} [metaData] the file metadata object.
15593 * @param {String} [type] Content-Type header to use for the file. If
15594 * this is omitted, the content type will be inferred from the name's
15595 * extension.
15596 * @return {AV.File} the file object
15597 */
15598
15599
15600 AV.File.withURL = function (name, url, metaData, type) {
15601 if (!name || !url) {
15602 throw new Error('Please provide file name and url');
15603 }
15604
15605 var file = new AV.File(name, null, type); //copy metaData properties to file.
15606
15607 if (metaData) {
15608 for (var prop in metaData) {
15609 if (!file.attributes.metaData[prop]) file.attributes.metaData[prop] = metaData[prop];
15610 }
15611 }
15612
15613 file.attributes.url = url; //Mark the file is from external source.
15614
15615 file.attributes.metaData.__source = 'external';
15616 file.attributes.metaData.size = 0;
15617 return file;
15618 };
15619 /**
15620 * Creates a file object with exists objectId.
15621 * @param {String} objectId The objectId string
15622 * @return {AV.File} the file object
15623 */
15624
15625
15626 AV.File.createWithoutData = function (objectId) {
15627 if (!objectId) {
15628 throw new TypeError('The objectId must be provided');
15629 }
15630
15631 var file = new AV.File();
15632 file.id = objectId;
15633 return file;
15634 };
15635 /**
15636 * Request file censor.
15637 * @since 4.13.0
15638 * @param {String} objectId
15639 * @return {Promise.<string>}
15640 */
15641
15642
15643 AV.File.censor = function (objectId) {
15644 if (!AV._config.masterKey) {
15645 throw new Error('Cannot censor a file without masterKey');
15646 }
15647
15648 return request({
15649 method: 'POST',
15650 path: "/files/".concat(objectId, "/censor"),
15651 authOptions: {
15652 useMasterKey: true
15653 }
15654 }).then(function (res) {
15655 return res.censorResult;
15656 });
15657 };
15658
15659 _.extend(AV.File.prototype,
15660 /** @lends AV.File.prototype */
15661 {
15662 className: '_File',
15663 _toFullJSON: function _toFullJSON(seenObjects) {
15664 var _this = this;
15665
15666 var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
15667
15668 var json = _.clone(this.attributes);
15669
15670 AV._objectEach(json, function (val, key) {
15671 json[key] = AV._encode(val, seenObjects, undefined, full);
15672 });
15673
15674 AV._objectEach(this._operations, function (val, key) {
15675 json[key] = val;
15676 });
15677
15678 if (_.has(this, 'id')) {
15679 json.objectId = this.id;
15680 }
15681
15682 ['createdAt', 'updatedAt'].forEach(function (key) {
15683 if (_.has(_this, key)) {
15684 var val = _this[key];
15685 json[key] = _.isDate(val) ? val.toJSON() : val;
15686 }
15687 });
15688
15689 if (full) {
15690 json.__type = 'File';
15691 }
15692
15693 return json;
15694 },
15695
15696 /**
15697 * Returns a JSON version of the file with meta data.
15698 * Inverse to {@link AV.parseJSON}
15699 * @since 3.0.0
15700 * @return {Object}
15701 */
15702 toFullJSON: function toFullJSON() {
15703 var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
15704 return this._toFullJSON(seenObjects);
15705 },
15706
15707 /**
15708 * Returns a JSON version of the object.
15709 * @return {Object}
15710 */
15711 toJSON: function toJSON(key, holder) {
15712 var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [this];
15713 return this._toFullJSON(seenObjects, false);
15714 },
15715
15716 /**
15717 * Gets a Pointer referencing this file.
15718 * @private
15719 */
15720 _toPointer: function _toPointer() {
15721 return {
15722 __type: 'Pointer',
15723 className: this.className,
15724 objectId: this.id
15725 };
15726 },
15727
15728 /**
15729 * Returns the ACL for this file.
15730 * @returns {AV.ACL} An instance of AV.ACL.
15731 */
15732 getACL: function getACL() {
15733 return this._acl;
15734 },
15735
15736 /**
15737 * Sets the ACL to be used for this file.
15738 * @param {AV.ACL} acl An instance of AV.ACL.
15739 */
15740 setACL: function setACL(acl) {
15741 if (!(acl instanceof AV.ACL)) {
15742 return new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
15743 }
15744
15745 this._acl = acl;
15746 return this;
15747 },
15748
15749 /**
15750 * Gets the name of the file. Before save is called, this is the filename
15751 * given by the user. After save is called, that name gets prefixed with a
15752 * unique identifier.
15753 */
15754 name: function name() {
15755 return this.get('name');
15756 },
15757
15758 /**
15759 * Gets the url of the file. It is only available after you save the file or
15760 * after you get the file from a AV.Object.
15761 * @return {String}
15762 */
15763 url: function url() {
15764 return this.get('url');
15765 },
15766
15767 /**
15768 * Gets the attributs of the file object.
15769 * @param {String} The attribute name which want to get.
15770 * @returns {Any}
15771 */
15772 get: function get(attrName) {
15773 switch (attrName) {
15774 case 'objectId':
15775 return this.id;
15776
15777 case 'url':
15778 case 'name':
15779 case 'mime_type':
15780 case 'metaData':
15781 case 'createdAt':
15782 case 'updatedAt':
15783 return this.attributes[attrName];
15784
15785 default:
15786 return this.attributes.metaData[attrName];
15787 }
15788 },
15789
15790 /**
15791 * Set the metaData of the file object.
15792 * @param {Object} Object is an key value Object for setting metaData.
15793 * @param {String} attr is an optional metadata key.
15794 * @param {Object} value is an optional metadata value.
15795 * @returns {String|Number|Array|Object}
15796 */
15797 set: function set() {
15798 var _this2 = this;
15799
15800 var set = function set(attrName, value) {
15801 switch (attrName) {
15802 case 'name':
15803 case 'url':
15804 case 'mime_type':
15805 case 'base64':
15806 case 'metaData':
15807 _this2.attributes[attrName] = value;
15808 break;
15809
15810 default:
15811 // File 并非一个 AVObject,不能完全自定义其他属性,所以只能都放在 metaData 上面
15812 _this2.attributes.metaData[attrName] = value;
15813 break;
15814 }
15815 };
15816
15817 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
15818 args[_key] = arguments[_key];
15819 }
15820
15821 switch (args.length) {
15822 case 1:
15823 // 传入一个 Object
15824 for (var k in args[0]) {
15825 set(k, args[0][k]);
15826 }
15827
15828 break;
15829
15830 case 2:
15831 set(args[0], args[1]);
15832 break;
15833 }
15834
15835 return this;
15836 },
15837
15838 /**
15839 * Set a header for the upload request.
15840 * For more infomation, go to https://url.leanapp.cn/avfile-upload-headers
15841 *
15842 * @param {String} key header key
15843 * @param {String} value header value
15844 * @return {AV.File} this
15845 */
15846 setUploadHeader: function setUploadHeader(key, value) {
15847 this._uploadHeaders[key] = value;
15848 return this;
15849 },
15850
15851 /**
15852 * <p>Returns the file's metadata JSON object if no arguments is given.Returns the
15853 * metadata value if a key is given.Set metadata value if key and value are both given.</p>
15854 * <p><pre>
15855 * var metadata = file.metaData(); //Get metadata JSON object.
15856 * var size = file.metaData('size'); // Get the size metadata value.
15857 * file.metaData('format', 'jpeg'); //set metadata attribute and value.
15858 *</pre></p>
15859 * @return {Object} The file's metadata JSON object.
15860 * @param {String} attr an optional metadata key.
15861 * @param {Object} value an optional metadata value.
15862 **/
15863 metaData: function metaData(attr, value) {
15864 if (attr && value) {
15865 this.attributes.metaData[attr] = value;
15866 return this;
15867 } else if (attr && !value) {
15868 return this.attributes.metaData[attr];
15869 } else {
15870 return this.attributes.metaData;
15871 }
15872 },
15873
15874 /**
15875 * 如果文件是图片,获取图片的缩略图URL。可以传入宽度、高度、质量、格式等参数。
15876 * @return {String} 缩略图URL
15877 * @param {Number} width 宽度,单位:像素
15878 * @param {Number} heigth 高度,单位:像素
15879 * @param {Number} quality 质量,1-100的数字,默认100
15880 * @param {Number} scaleToFit 是否将图片自适应大小。默认为true。
15881 * @param {String} fmt 格式,默认为png,也可以为jpeg,gif等格式。
15882 */
15883 thumbnailURL: function thumbnailURL(width, height) {
15884 var quality = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
15885 var scaleToFit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
15886 var fmt = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'png';
15887 var url = this.attributes.url;
15888
15889 if (!url) {
15890 throw new Error('Invalid url.');
15891 }
15892
15893 if (!width || !height || width <= 0 || height <= 0) {
15894 throw new Error('Invalid width or height value.');
15895 }
15896
15897 if (quality <= 0 || quality > 100) {
15898 throw new Error('Invalid quality value.');
15899 }
15900
15901 var mode = scaleToFit ? 2 : 1;
15902 return url + '?imageView/' + mode + '/w/' + width + '/h/' + height + '/q/' + quality + '/format/' + fmt;
15903 },
15904
15905 /**
15906 * Returns the file's size.
15907 * @return {Number} The file's size in bytes.
15908 **/
15909 size: function size() {
15910 return this.metaData().size;
15911 },
15912
15913 /**
15914 * Returns the file's owner.
15915 * @return {String} The file's owner id.
15916 */
15917 ownerId: function ownerId() {
15918 return this.metaData().owner;
15919 },
15920
15921 /**
15922 * Destroy the file.
15923 * @param {AuthOptions} options
15924 * @return {Promise} A promise that is fulfilled when the destroy
15925 * completes.
15926 */
15927 destroy: function destroy(options) {
15928 if (!this.id) {
15929 return _promise.default.reject(new Error('The file id does not eixst.'));
15930 }
15931
15932 var request = AVRequest('files', null, this.id, 'DELETE', null, options);
15933 return request;
15934 },
15935
15936 /**
15937 * Request Qiniu upload token
15938 * @param {string} type
15939 * @return {Promise} Resolved with the response
15940 * @private
15941 */
15942 _fileToken: function _fileToken(type, authOptions) {
15943 var name = this.attributes.name;
15944 var extName = extname(name);
15945
15946 if (!extName && this._extName) {
15947 name += this._extName;
15948 extName = this._extName;
15949 }
15950
15951 var data = {
15952 name: name,
15953 keep_file_name: authOptions.keepFileName,
15954 key: authOptions.key,
15955 ACL: this._acl,
15956 mime_type: type,
15957 metaData: this.attributes.metaData
15958 };
15959 return AVRequest('fileTokens', null, null, 'POST', data, authOptions);
15960 },
15961
15962 /**
15963 * @callback UploadProgressCallback
15964 * @param {XMLHttpRequestProgressEvent} event - The progress event with 'loaded' and 'total' attributes
15965 */
15966
15967 /**
15968 * Saves the file to the AV cloud.
15969 * @param {AuthOptions} [options] AuthOptions plus:
15970 * @param {UploadProgressCallback} [options.onprogress] 文件上传进度,在 Node.js 中无效,回调参数说明详见 {@link UploadProgressCallback}。
15971 * @param {boolean} [options.keepFileName = false] 保留下载文件的文件名。
15972 * @param {string} [options.key] 指定文件的 key。设置该选项需要使用 masterKey
15973 * @return {Promise} Promise that is resolved when the save finishes.
15974 */
15975 save: function save() {
15976 var _this3 = this;
15977
15978 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
15979
15980 if (this.id) {
15981 throw new Error('File is already saved.');
15982 }
15983
15984 if (!this._previousSave) {
15985 if (this._data) {
15986 var mimeType = this.get('mime_type');
15987 this._previousSave = this._fileToken(mimeType, options).then(function (uploadInfo) {
15988 if (uploadInfo.mime_type) {
15989 mimeType = uploadInfo.mime_type;
15990
15991 _this3.set('mime_type', mimeType);
15992 }
15993
15994 _this3._token = uploadInfo.token;
15995 return _promise.default.resolve().then(function () {
15996 var data = _this3._data;
15997
15998 if (data && data.base64) {
15999 return parseBase64(data.base64, mimeType);
16000 }
16001
16002 if (data && data.blob) {
16003 if (!data.blob.type && mimeType) {
16004 data.blob.type = mimeType;
16005 }
16006
16007 if (!data.blob.name) {
16008 data.blob.name = _this3.get('name');
16009 }
16010
16011 return data.blob;
16012 }
16013
16014 if (typeof Blob !== 'undefined' && data instanceof Blob) {
16015 return data;
16016 }
16017
16018 throw new TypeError('malformed file data');
16019 }).then(function (data) {
16020 var _options = _.extend({}, options); // filter out download progress events
16021
16022
16023 if (options.onprogress) {
16024 _options.onprogress = function (event) {
16025 if (event.direction === 'download') return;
16026 return options.onprogress(event);
16027 };
16028 }
16029
16030 switch (uploadInfo.provider) {
16031 case 's3':
16032 return s3(uploadInfo, data, _this3, _options);
16033
16034 case 'qcloud':
16035 return cos(uploadInfo, data, _this3, _options);
16036
16037 case 'qiniu':
16038 default:
16039 return qiniu(uploadInfo, data, _this3, _options);
16040 }
16041 }).then(tap(function () {
16042 return _this3._callback(true);
16043 }), function (error) {
16044 _this3._callback(false);
16045
16046 throw error;
16047 });
16048 });
16049 } else if (this.attributes.url && this.attributes.metaData.__source === 'external') {
16050 // external link file.
16051 var data = {
16052 name: this.attributes.name,
16053 ACL: this._acl,
16054 metaData: this.attributes.metaData,
16055 mime_type: this.mimeType,
16056 url: this.attributes.url
16057 };
16058 this._previousSave = AVRequest('files', null, null, 'post', data, options).then(function (response) {
16059 _this3.id = response.objectId;
16060 return _this3;
16061 });
16062 }
16063 }
16064
16065 return this._previousSave;
16066 },
16067 _callback: function _callback(success) {
16068 AVRequest('fileCallback', null, null, 'post', {
16069 token: this._token,
16070 result: success
16071 }).catch(debug);
16072 delete this._token;
16073 delete this._data;
16074 },
16075
16076 /**
16077 * fetch the file from server. If the server's representation of the
16078 * model differs from its current attributes, they will be overriden,
16079 * @param {Object} fetchOptions Optional options to set 'keys',
16080 * 'include' and 'includeACL' option.
16081 * @param {AuthOptions} options
16082 * @return {Promise} A promise that is fulfilled when the fetch
16083 * completes.
16084 */
16085 fetch: function fetch(fetchOptions, options) {
16086 if (!this.id) {
16087 throw new Error('Cannot fetch unsaved file');
16088 }
16089
16090 var request = AVRequest('files', null, this.id, 'GET', transformFetchOptions(fetchOptions), options);
16091 return request.then(this._finishFetch.bind(this));
16092 },
16093 _finishFetch: function _finishFetch(response) {
16094 var value = AV.Object.prototype.parse(response);
16095 value.attributes = {
16096 name: value.name,
16097 url: value.url,
16098 mime_type: value.mime_type,
16099 bucket: value.bucket
16100 };
16101 value.attributes.metaData = value.metaData || {};
16102 value.id = value.objectId; // clean
16103
16104 delete value.objectId;
16105 delete value.metaData;
16106 delete value.url;
16107 delete value.name;
16108 delete value.mime_type;
16109 delete value.bucket;
16110
16111 _.extend(this, value);
16112
16113 return this;
16114 },
16115
16116 /**
16117 * Request file censor
16118 * @since 4.13.0
16119 * @return {Promise.<string>}
16120 */
16121 censor: function censor() {
16122 if (!this.id) {
16123 throw new Error('Cannot censor an unsaved file');
16124 }
16125
16126 return AV.File.censor(this.id);
16127 }
16128 });
16129};
16130
16131/***/ }),
16132/* 474 */
16133/***/ (function(module, exports, __webpack_require__) {
16134
16135"use strict";
16136
16137
16138var _require = __webpack_require__(71),
16139 getAdapter = _require.getAdapter;
16140
16141var debug = __webpack_require__(58)('cos');
16142
16143module.exports = function (uploadInfo, data, file) {
16144 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
16145 var url = uploadInfo.upload_url + '?sign=' + encodeURIComponent(uploadInfo.token);
16146 var fileFormData = {
16147 field: 'fileContent',
16148 data: data,
16149 name: file.attributes.name
16150 };
16151 var options = {
16152 headers: file._uploadHeaders,
16153 data: {
16154 op: 'upload'
16155 },
16156 onprogress: saveOptions.onprogress
16157 };
16158 debug('url: %s, file: %o, options: %o', url, fileFormData, options);
16159 var upload = getAdapter('upload');
16160 return upload(url, fileFormData, options).then(function (response) {
16161 debug(response.status, response.data);
16162
16163 if (response.ok === false) {
16164 var error = new Error(response.status);
16165 error.response = response;
16166 throw error;
16167 }
16168
16169 file.attributes.url = uploadInfo.url;
16170 file._bucket = uploadInfo.bucket;
16171 file.id = uploadInfo.objectId;
16172 return file;
16173 }, function (error) {
16174 var response = error.response;
16175
16176 if (response) {
16177 debug(response.status, response.data);
16178 error.statusCode = response.status;
16179 error.response = response.data;
16180 }
16181
16182 throw error;
16183 });
16184};
16185
16186/***/ }),
16187/* 475 */
16188/***/ (function(module, exports, __webpack_require__) {
16189
16190"use strict";
16191
16192
16193var _sliceInstanceProperty2 = __webpack_require__(59);
16194
16195var _Array$from = __webpack_require__(245);
16196
16197var _Symbol = __webpack_require__(247);
16198
16199var _getIteratorMethod = __webpack_require__(248);
16200
16201var _Reflect$construct = __webpack_require__(485);
16202
16203var _interopRequireDefault = __webpack_require__(1);
16204
16205var _inherits2 = _interopRequireDefault(__webpack_require__(489));
16206
16207var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(511));
16208
16209var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(513));
16210
16211var _classCallCheck2 = _interopRequireDefault(__webpack_require__(518));
16212
16213var _createClass2 = _interopRequireDefault(__webpack_require__(519));
16214
16215var _stringify = _interopRequireDefault(__webpack_require__(36));
16216
16217var _concat = _interopRequireDefault(__webpack_require__(22));
16218
16219var _promise = _interopRequireDefault(__webpack_require__(13));
16220
16221var _slice = _interopRequireDefault(__webpack_require__(59));
16222
16223function _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); }; }
16224
16225function _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; } }
16226
16227function _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; } } }; }
16228
16229function _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); }
16230
16231function _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; }
16232
16233var _require = __webpack_require__(71),
16234 getAdapter = _require.getAdapter;
16235
16236var debug = __webpack_require__(58)('leancloud:qiniu');
16237
16238var ajax = __webpack_require__(115);
16239
16240var btoa = __webpack_require__(520);
16241
16242var SHARD_THRESHOLD = 1024 * 1024 * 64;
16243var CHUNK_SIZE = 1024 * 1024 * 16;
16244
16245function upload(uploadInfo, data, file) {
16246 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
16247 // Get the uptoken to upload files to qiniu.
16248 var uptoken = uploadInfo.token;
16249 var url = uploadInfo.upload_url || 'https://upload.qiniup.com';
16250 var fileFormData = {
16251 field: 'file',
16252 data: data,
16253 name: file.attributes.name
16254 };
16255 var options = {
16256 headers: file._uploadHeaders,
16257 data: {
16258 name: file.attributes.name,
16259 key: uploadInfo.key,
16260 token: uptoken
16261 },
16262 onprogress: saveOptions.onprogress
16263 };
16264 debug('url: %s, file: %o, options: %o', url, fileFormData, options);
16265 var upload = getAdapter('upload');
16266 return upload(url, fileFormData, options).then(function (response) {
16267 debug(response.status, response.data);
16268
16269 if (response.ok === false) {
16270 var message = response.status;
16271
16272 if (response.data) {
16273 if (response.data.error) {
16274 message = response.data.error;
16275 } else {
16276 message = (0, _stringify.default)(response.data);
16277 }
16278 }
16279
16280 var error = new Error(message);
16281 error.response = response;
16282 throw error;
16283 }
16284
16285 file.attributes.url = uploadInfo.url;
16286 file._bucket = uploadInfo.bucket;
16287 file.id = uploadInfo.objectId;
16288 return file;
16289 }, function (error) {
16290 var response = error.response;
16291
16292 if (response) {
16293 debug(response.status, response.data);
16294 error.statusCode = response.status;
16295 error.response = response.data;
16296 }
16297
16298 throw error;
16299 });
16300}
16301
16302function urlSafeBase64(string) {
16303 var base64 = btoa(unescape(encodeURIComponent(string)));
16304 var result = '';
16305
16306 var _iterator = _createForOfIteratorHelper(base64),
16307 _step;
16308
16309 try {
16310 for (_iterator.s(); !(_step = _iterator.n()).done;) {
16311 var ch = _step.value;
16312
16313 switch (ch) {
16314 case '+':
16315 result += '-';
16316 break;
16317
16318 case '/':
16319 result += '_';
16320 break;
16321
16322 default:
16323 result += ch;
16324 }
16325 }
16326 } catch (err) {
16327 _iterator.e(err);
16328 } finally {
16329 _iterator.f();
16330 }
16331
16332 return result;
16333}
16334
16335var ShardUploader = /*#__PURE__*/function () {
16336 function ShardUploader(uploadInfo, data, file, saveOptions) {
16337 var _context,
16338 _context2,
16339 _this = this;
16340
16341 (0, _classCallCheck2.default)(this, ShardUploader);
16342 this.uploadInfo = uploadInfo;
16343 this.data = data;
16344 this.file = file;
16345 this.size = undefined;
16346 this.offset = 0;
16347 this.uploadedChunks = 0;
16348 var key = urlSafeBase64(uploadInfo.key);
16349 var uploadURL = uploadInfo.upload_url || 'https://upload.qiniup.com';
16350 this.baseURL = (0, _concat.default)(_context = (0, _concat.default)(_context2 = "".concat(uploadURL, "/buckets/")).call(_context2, uploadInfo.bucket, "/objects/")).call(_context, key, "/uploads");
16351 this.upToken = 'UpToken ' + uploadInfo.token;
16352 this.uploaded = 0;
16353
16354 if (saveOptions && saveOptions.onprogress) {
16355 this.onProgress = function (_ref) {
16356 var loaded = _ref.loaded;
16357 loaded += _this.uploadedChunks * CHUNK_SIZE;
16358
16359 if (loaded <= _this.uploaded) {
16360 return;
16361 }
16362
16363 if (_this.size) {
16364 saveOptions.onprogress({
16365 loaded: loaded,
16366 total: _this.size,
16367 percent: loaded / _this.size * 100
16368 });
16369 } else {
16370 saveOptions.onprogress({
16371 loaded: loaded
16372 });
16373 }
16374
16375 _this.uploaded = loaded;
16376 };
16377 }
16378 }
16379 /**
16380 * @returns {Promise<string>}
16381 */
16382
16383
16384 (0, _createClass2.default)(ShardUploader, [{
16385 key: "getUploadId",
16386 value: function getUploadId() {
16387 return ajax({
16388 method: 'POST',
16389 url: this.baseURL,
16390 headers: {
16391 Authorization: this.upToken
16392 }
16393 }).then(function (res) {
16394 return res.uploadId;
16395 });
16396 }
16397 }, {
16398 key: "getChunk",
16399 value: function getChunk() {
16400 throw new Error('Not implemented');
16401 }
16402 /**
16403 * @param {string} uploadId
16404 * @param {number} partNumber
16405 * @param {any} data
16406 * @returns {Promise<{ partNumber: number, etag: string }>}
16407 */
16408
16409 }, {
16410 key: "uploadPart",
16411 value: function uploadPart(uploadId, partNumber, data) {
16412 var _context3, _context4;
16413
16414 return ajax({
16415 method: 'PUT',
16416 url: (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = "".concat(this.baseURL, "/")).call(_context4, uploadId, "/")).call(_context3, partNumber),
16417 headers: {
16418 Authorization: this.upToken
16419 },
16420 data: data,
16421 onprogress: this.onProgress
16422 }).then(function (_ref2) {
16423 var etag = _ref2.etag;
16424 return {
16425 partNumber: partNumber,
16426 etag: etag
16427 };
16428 });
16429 }
16430 }, {
16431 key: "stopUpload",
16432 value: function stopUpload(uploadId) {
16433 var _context5;
16434
16435 return ajax({
16436 method: 'DELETE',
16437 url: (0, _concat.default)(_context5 = "".concat(this.baseURL, "/")).call(_context5, uploadId),
16438 headers: {
16439 Authorization: this.upToken
16440 }
16441 });
16442 }
16443 }, {
16444 key: "upload",
16445 value: function upload() {
16446 var _this2 = this;
16447
16448 var parts = [];
16449 return this.getUploadId().then(function (uploadId) {
16450 var uploadPart = function uploadPart() {
16451 return _promise.default.resolve(_this2.getChunk()).then(function (chunk) {
16452 if (!chunk) {
16453 return;
16454 }
16455
16456 var partNumber = parts.length + 1;
16457 return _this2.uploadPart(uploadId, partNumber, chunk).then(function (part) {
16458 parts.push(part);
16459 _this2.uploadedChunks++;
16460 return uploadPart();
16461 });
16462 }).catch(function (error) {
16463 return _this2.stopUpload(uploadId).then(function () {
16464 return _promise.default.reject(error);
16465 });
16466 });
16467 };
16468
16469 return uploadPart().then(function () {
16470 var _context6;
16471
16472 return ajax({
16473 method: 'POST',
16474 url: (0, _concat.default)(_context6 = "".concat(_this2.baseURL, "/")).call(_context6, uploadId),
16475 headers: {
16476 Authorization: _this2.upToken
16477 },
16478 data: {
16479 parts: parts,
16480 fname: _this2.file.attributes.name,
16481 mimeType: _this2.file.attributes.mime_type
16482 }
16483 });
16484 });
16485 }).then(function () {
16486 _this2.file.attributes.url = _this2.uploadInfo.url;
16487 _this2.file._bucket = _this2.uploadInfo.bucket;
16488 _this2.file.id = _this2.uploadInfo.objectId;
16489 return _this2.file;
16490 });
16491 }
16492 }]);
16493 return ShardUploader;
16494}();
16495
16496var BlobUploader = /*#__PURE__*/function (_ShardUploader) {
16497 (0, _inherits2.default)(BlobUploader, _ShardUploader);
16498
16499 var _super = _createSuper(BlobUploader);
16500
16501 function BlobUploader(uploadInfo, data, file, saveOptions) {
16502 var _this3;
16503
16504 (0, _classCallCheck2.default)(this, BlobUploader);
16505 _this3 = _super.call(this, uploadInfo, data, file, saveOptions);
16506 _this3.size = data.size;
16507 return _this3;
16508 }
16509 /**
16510 * @returns {Blob | null}
16511 */
16512
16513
16514 (0, _createClass2.default)(BlobUploader, [{
16515 key: "getChunk",
16516 value: function getChunk() {
16517 var _context7;
16518
16519 if (this.offset >= this.size) {
16520 return null;
16521 }
16522
16523 var chunk = (0, _slice.default)(_context7 = this.data).call(_context7, this.offset, this.offset + CHUNK_SIZE);
16524 this.offset += chunk.size;
16525 return chunk;
16526 }
16527 }]);
16528 return BlobUploader;
16529}(ShardUploader);
16530
16531function isBlob(data) {
16532 return typeof Blob !== 'undefined' && data instanceof Blob;
16533}
16534
16535module.exports = function (uploadInfo, data, file) {
16536 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
16537
16538 if (isBlob(data) && data.size >= SHARD_THRESHOLD) {
16539 return new BlobUploader(uploadInfo, data, file, saveOptions).upload();
16540 }
16541
16542 return upload(uploadInfo, data, file, saveOptions);
16543};
16544
16545/***/ }),
16546/* 476 */
16547/***/ (function(module, exports, __webpack_require__) {
16548
16549__webpack_require__(65);
16550__webpack_require__(477);
16551var path = __webpack_require__(6);
16552
16553module.exports = path.Array.from;
16554
16555
16556/***/ }),
16557/* 477 */
16558/***/ (function(module, exports, __webpack_require__) {
16559
16560var $ = __webpack_require__(0);
16561var from = __webpack_require__(478);
16562var checkCorrectnessOfIteration = __webpack_require__(172);
16563
16564var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
16565 // eslint-disable-next-line es-x/no-array-from -- required for testing
16566 Array.from(iterable);
16567});
16568
16569// `Array.from` method
16570// https://tc39.es/ecma262/#sec-array.from
16571$({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
16572 from: from
16573});
16574
16575
16576/***/ }),
16577/* 478 */
16578/***/ (function(module, exports, __webpack_require__) {
16579
16580"use strict";
16581
16582var bind = __webpack_require__(48);
16583var call = __webpack_require__(15);
16584var toObject = __webpack_require__(34);
16585var callWithSafeIterationClosing = __webpack_require__(479);
16586var isArrayIteratorMethod = __webpack_require__(160);
16587var isConstructor = __webpack_require__(108);
16588var lengthOfArrayLike = __webpack_require__(39);
16589var createProperty = __webpack_require__(89);
16590var getIterator = __webpack_require__(161);
16591var getIteratorMethod = __webpack_require__(105);
16592
16593var $Array = Array;
16594
16595// `Array.from` method implementation
16596// https://tc39.es/ecma262/#sec-array.from
16597module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
16598 var O = toObject(arrayLike);
16599 var IS_CONSTRUCTOR = isConstructor(this);
16600 var argumentsLength = arguments.length;
16601 var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
16602 var mapping = mapfn !== undefined;
16603 if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined);
16604 var iteratorMethod = getIteratorMethod(O);
16605 var index = 0;
16606 var length, result, step, iterator, next, value;
16607 // if the target is not iterable or it's an array with the default iterator - use a simple case
16608 if (iteratorMethod && !(this === $Array && isArrayIteratorMethod(iteratorMethod))) {
16609 iterator = getIterator(O, iteratorMethod);
16610 next = iterator.next;
16611 result = IS_CONSTRUCTOR ? new this() : [];
16612 for (;!(step = call(next, iterator)).done; index++) {
16613 value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
16614 createProperty(result, index, value);
16615 }
16616 } else {
16617 length = lengthOfArrayLike(O);
16618 result = IS_CONSTRUCTOR ? new this(length) : $Array(length);
16619 for (;length > index; index++) {
16620 value = mapping ? mapfn(O[index], index) : O[index];
16621 createProperty(result, index, value);
16622 }
16623 }
16624 result.length = index;
16625 return result;
16626};
16627
16628
16629/***/ }),
16630/* 479 */
16631/***/ (function(module, exports, __webpack_require__) {
16632
16633var anObject = __webpack_require__(20);
16634var iteratorClose = __webpack_require__(162);
16635
16636// call something on iterator step with safe closing on error
16637module.exports = function (iterator, fn, value, ENTRIES) {
16638 try {
16639 return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
16640 } catch (error) {
16641 iteratorClose(iterator, 'throw', error);
16642 }
16643};
16644
16645
16646/***/ }),
16647/* 480 */
16648/***/ (function(module, exports, __webpack_require__) {
16649
16650module.exports = __webpack_require__(481);
16651
16652
16653/***/ }),
16654/* 481 */
16655/***/ (function(module, exports, __webpack_require__) {
16656
16657var parent = __webpack_require__(482);
16658
16659module.exports = parent;
16660
16661
16662/***/ }),
16663/* 482 */
16664/***/ (function(module, exports, __webpack_require__) {
16665
16666var parent = __webpack_require__(483);
16667
16668module.exports = parent;
16669
16670
16671/***/ }),
16672/* 483 */
16673/***/ (function(module, exports, __webpack_require__) {
16674
16675var parent = __webpack_require__(484);
16676__webpack_require__(44);
16677
16678module.exports = parent;
16679
16680
16681/***/ }),
16682/* 484 */
16683/***/ (function(module, exports, __webpack_require__) {
16684
16685__webpack_require__(41);
16686__webpack_require__(65);
16687var getIteratorMethod = __webpack_require__(105);
16688
16689module.exports = getIteratorMethod;
16690
16691
16692/***/ }),
16693/* 485 */
16694/***/ (function(module, exports, __webpack_require__) {
16695
16696module.exports = __webpack_require__(486);
16697
16698/***/ }),
16699/* 486 */
16700/***/ (function(module, exports, __webpack_require__) {
16701
16702var parent = __webpack_require__(487);
16703
16704module.exports = parent;
16705
16706
16707/***/ }),
16708/* 487 */
16709/***/ (function(module, exports, __webpack_require__) {
16710
16711__webpack_require__(488);
16712var path = __webpack_require__(6);
16713
16714module.exports = path.Reflect.construct;
16715
16716
16717/***/ }),
16718/* 488 */
16719/***/ (function(module, exports, __webpack_require__) {
16720
16721var $ = __webpack_require__(0);
16722var getBuiltIn = __webpack_require__(18);
16723var apply = __webpack_require__(73);
16724var bind = __webpack_require__(249);
16725var aConstructor = __webpack_require__(168);
16726var anObject = __webpack_require__(20);
16727var isObject = __webpack_require__(11);
16728var create = __webpack_require__(49);
16729var fails = __webpack_require__(2);
16730
16731var nativeConstruct = getBuiltIn('Reflect', 'construct');
16732var ObjectPrototype = Object.prototype;
16733var push = [].push;
16734
16735// `Reflect.construct` method
16736// https://tc39.es/ecma262/#sec-reflect.construct
16737// MS Edge supports only 2 arguments and argumentsList argument is optional
16738// FF Nightly sets third argument as `new.target`, but does not create `this` from it
16739var NEW_TARGET_BUG = fails(function () {
16740 function F() { /* empty */ }
16741 return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F);
16742});
16743
16744var ARGS_BUG = !fails(function () {
16745 nativeConstruct(function () { /* empty */ });
16746});
16747
16748var FORCED = NEW_TARGET_BUG || ARGS_BUG;
16749
16750$({ target: 'Reflect', stat: true, forced: FORCED, sham: FORCED }, {
16751 construct: function construct(Target, args /* , newTarget */) {
16752 aConstructor(Target);
16753 anObject(args);
16754 var newTarget = arguments.length < 3 ? Target : aConstructor(arguments[2]);
16755 if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget);
16756 if (Target == newTarget) {
16757 // w/o altered newTarget, optimization for 0-4 arguments
16758 switch (args.length) {
16759 case 0: return new Target();
16760 case 1: return new Target(args[0]);
16761 case 2: return new Target(args[0], args[1]);
16762 case 3: return new Target(args[0], args[1], args[2]);
16763 case 4: return new Target(args[0], args[1], args[2], args[3]);
16764 }
16765 // w/o altered newTarget, lot of arguments case
16766 var $args = [null];
16767 apply(push, $args, args);
16768 return new (apply(bind, Target, $args))();
16769 }
16770 // with altered newTarget, not support built-in constructors
16771 var proto = newTarget.prototype;
16772 var instance = create(isObject(proto) ? proto : ObjectPrototype);
16773 var result = apply(Target, instance, args);
16774 return isObject(result) ? result : instance;
16775 }
16776});
16777
16778
16779/***/ }),
16780/* 489 */
16781/***/ (function(module, exports, __webpack_require__) {
16782
16783var _Object$create = __webpack_require__(490);
16784
16785var _Object$defineProperty = __webpack_require__(148);
16786
16787var setPrototypeOf = __webpack_require__(500);
16788
16789function _inherits(subClass, superClass) {
16790 if (typeof superClass !== "function" && superClass !== null) {
16791 throw new TypeError("Super expression must either be null or a function");
16792 }
16793
16794 subClass.prototype = _Object$create(superClass && superClass.prototype, {
16795 constructor: {
16796 value: subClass,
16797 writable: true,
16798 configurable: true
16799 }
16800 });
16801
16802 _Object$defineProperty(subClass, "prototype", {
16803 writable: false
16804 });
16805
16806 if (superClass) setPrototypeOf(subClass, superClass);
16807}
16808
16809module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
16810
16811/***/ }),
16812/* 490 */
16813/***/ (function(module, exports, __webpack_require__) {
16814
16815module.exports = __webpack_require__(491);
16816
16817/***/ }),
16818/* 491 */
16819/***/ (function(module, exports, __webpack_require__) {
16820
16821module.exports = __webpack_require__(492);
16822
16823
16824/***/ }),
16825/* 492 */
16826/***/ (function(module, exports, __webpack_require__) {
16827
16828var parent = __webpack_require__(493);
16829
16830module.exports = parent;
16831
16832
16833/***/ }),
16834/* 493 */
16835/***/ (function(module, exports, __webpack_require__) {
16836
16837var parent = __webpack_require__(494);
16838
16839module.exports = parent;
16840
16841
16842/***/ }),
16843/* 494 */
16844/***/ (function(module, exports, __webpack_require__) {
16845
16846var parent = __webpack_require__(495);
16847
16848module.exports = parent;
16849
16850
16851/***/ }),
16852/* 495 */
16853/***/ (function(module, exports, __webpack_require__) {
16854
16855__webpack_require__(496);
16856var path = __webpack_require__(6);
16857
16858var Object = path.Object;
16859
16860module.exports = function create(P, D) {
16861 return Object.create(P, D);
16862};
16863
16864
16865/***/ }),
16866/* 496 */
16867/***/ (function(module, exports, __webpack_require__) {
16868
16869// TODO: Remove from `core-js@4`
16870var $ = __webpack_require__(0);
16871var DESCRIPTORS = __webpack_require__(14);
16872var create = __webpack_require__(49);
16873
16874// `Object.create` method
16875// https://tc39.es/ecma262/#sec-object.create
16876$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
16877 create: create
16878});
16879
16880
16881/***/ }),
16882/* 497 */
16883/***/ (function(module, exports, __webpack_require__) {
16884
16885module.exports = __webpack_require__(498);
16886
16887
16888/***/ }),
16889/* 498 */
16890/***/ (function(module, exports, __webpack_require__) {
16891
16892var parent = __webpack_require__(499);
16893
16894module.exports = parent;
16895
16896
16897/***/ }),
16898/* 499 */
16899/***/ (function(module, exports, __webpack_require__) {
16900
16901var parent = __webpack_require__(235);
16902
16903module.exports = parent;
16904
16905
16906/***/ }),
16907/* 500 */
16908/***/ (function(module, exports, __webpack_require__) {
16909
16910var _Object$setPrototypeOf = __webpack_require__(250);
16911
16912var _bindInstanceProperty = __webpack_require__(251);
16913
16914function _setPrototypeOf(o, p) {
16915 var _context;
16916
16917 module.exports = _setPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$setPrototypeOf).call(_context) : function _setPrototypeOf(o, p) {
16918 o.__proto__ = p;
16919 return o;
16920 }, module.exports.__esModule = true, module.exports["default"] = module.exports;
16921 return _setPrototypeOf(o, p);
16922}
16923
16924module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
16925
16926/***/ }),
16927/* 501 */
16928/***/ (function(module, exports, __webpack_require__) {
16929
16930module.exports = __webpack_require__(502);
16931
16932
16933/***/ }),
16934/* 502 */
16935/***/ (function(module, exports, __webpack_require__) {
16936
16937var parent = __webpack_require__(503);
16938
16939module.exports = parent;
16940
16941
16942/***/ }),
16943/* 503 */
16944/***/ (function(module, exports, __webpack_require__) {
16945
16946var parent = __webpack_require__(233);
16947
16948module.exports = parent;
16949
16950
16951/***/ }),
16952/* 504 */
16953/***/ (function(module, exports, __webpack_require__) {
16954
16955module.exports = __webpack_require__(505);
16956
16957
16958/***/ }),
16959/* 505 */
16960/***/ (function(module, exports, __webpack_require__) {
16961
16962var parent = __webpack_require__(506);
16963
16964module.exports = parent;
16965
16966
16967/***/ }),
16968/* 506 */
16969/***/ (function(module, exports, __webpack_require__) {
16970
16971var parent = __webpack_require__(507);
16972
16973module.exports = parent;
16974
16975
16976/***/ }),
16977/* 507 */
16978/***/ (function(module, exports, __webpack_require__) {
16979
16980var parent = __webpack_require__(508);
16981
16982module.exports = parent;
16983
16984
16985/***/ }),
16986/* 508 */
16987/***/ (function(module, exports, __webpack_require__) {
16988
16989var isPrototypeOf = __webpack_require__(19);
16990var method = __webpack_require__(509);
16991
16992var FunctionPrototype = Function.prototype;
16993
16994module.exports = function (it) {
16995 var own = it.bind;
16996 return it === FunctionPrototype || (isPrototypeOf(FunctionPrototype, it) && own === FunctionPrototype.bind) ? method : own;
16997};
16998
16999
17000/***/ }),
17001/* 509 */
17002/***/ (function(module, exports, __webpack_require__) {
17003
17004__webpack_require__(510);
17005var entryVirtual = __webpack_require__(38);
17006
17007module.exports = entryVirtual('Function').bind;
17008
17009
17010/***/ }),
17011/* 510 */
17012/***/ (function(module, exports, __webpack_require__) {
17013
17014// TODO: Remove from `core-js@4`
17015var $ = __webpack_require__(0);
17016var bind = __webpack_require__(249);
17017
17018// `Function.prototype.bind` method
17019// https://tc39.es/ecma262/#sec-function.prototype.bind
17020$({ target: 'Function', proto: true, forced: Function.bind !== bind }, {
17021 bind: bind
17022});
17023
17024
17025/***/ }),
17026/* 511 */
17027/***/ (function(module, exports, __webpack_require__) {
17028
17029var _typeof = __webpack_require__(91)["default"];
17030
17031var assertThisInitialized = __webpack_require__(512);
17032
17033function _possibleConstructorReturn(self, call) {
17034 if (call && (_typeof(call) === "object" || typeof call === "function")) {
17035 return call;
17036 } else if (call !== void 0) {
17037 throw new TypeError("Derived constructors may only return object or undefined");
17038 }
17039
17040 return assertThisInitialized(self);
17041}
17042
17043module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
17044
17045/***/ }),
17046/* 512 */
17047/***/ (function(module, exports) {
17048
17049function _assertThisInitialized(self) {
17050 if (self === void 0) {
17051 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
17052 }
17053
17054 return self;
17055}
17056
17057module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
17058
17059/***/ }),
17060/* 513 */
17061/***/ (function(module, exports, __webpack_require__) {
17062
17063var _Object$setPrototypeOf = __webpack_require__(250);
17064
17065var _bindInstanceProperty = __webpack_require__(251);
17066
17067var _Object$getPrototypeOf = __webpack_require__(514);
17068
17069function _getPrototypeOf(o) {
17070 var _context;
17071
17072 module.exports = _getPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$getPrototypeOf).call(_context) : function _getPrototypeOf(o) {
17073 return o.__proto__ || _Object$getPrototypeOf(o);
17074 }, module.exports.__esModule = true, module.exports["default"] = module.exports;
17075 return _getPrototypeOf(o);
17076}
17077
17078module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
17079
17080/***/ }),
17081/* 514 */
17082/***/ (function(module, exports, __webpack_require__) {
17083
17084module.exports = __webpack_require__(515);
17085
17086/***/ }),
17087/* 515 */
17088/***/ (function(module, exports, __webpack_require__) {
17089
17090module.exports = __webpack_require__(516);
17091
17092
17093/***/ }),
17094/* 516 */
17095/***/ (function(module, exports, __webpack_require__) {
17096
17097var parent = __webpack_require__(517);
17098
17099module.exports = parent;
17100
17101
17102/***/ }),
17103/* 517 */
17104/***/ (function(module, exports, __webpack_require__) {
17105
17106var parent = __webpack_require__(228);
17107
17108module.exports = parent;
17109
17110
17111/***/ }),
17112/* 518 */
17113/***/ (function(module, exports) {
17114
17115function _classCallCheck(instance, Constructor) {
17116 if (!(instance instanceof Constructor)) {
17117 throw new TypeError("Cannot call a class as a function");
17118 }
17119}
17120
17121module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
17122
17123/***/ }),
17124/* 519 */
17125/***/ (function(module, exports, __webpack_require__) {
17126
17127var _Object$defineProperty = __webpack_require__(148);
17128
17129function _defineProperties(target, props) {
17130 for (var i = 0; i < props.length; i++) {
17131 var descriptor = props[i];
17132 descriptor.enumerable = descriptor.enumerable || false;
17133 descriptor.configurable = true;
17134 if ("value" in descriptor) descriptor.writable = true;
17135
17136 _Object$defineProperty(target, descriptor.key, descriptor);
17137 }
17138}
17139
17140function _createClass(Constructor, protoProps, staticProps) {
17141 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
17142 if (staticProps) _defineProperties(Constructor, staticProps);
17143
17144 _Object$defineProperty(Constructor, "prototype", {
17145 writable: false
17146 });
17147
17148 return Constructor;
17149}
17150
17151module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
17152
17153/***/ }),
17154/* 520 */
17155/***/ (function(module, exports, __webpack_require__) {
17156
17157"use strict";
17158
17159
17160var _interopRequireDefault = __webpack_require__(1);
17161
17162var _slice = _interopRequireDefault(__webpack_require__(59));
17163
17164// base64 character set, plus padding character (=)
17165var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
17166
17167module.exports = function (string) {
17168 var result = '';
17169
17170 for (var i = 0; i < string.length;) {
17171 var a = string.charCodeAt(i++);
17172 var b = string.charCodeAt(i++);
17173 var c = string.charCodeAt(i++);
17174
17175 if (a > 255 || b > 255 || c > 255) {
17176 throw new TypeError('Failed to encode base64: The string to be encoded contains characters outside of the Latin1 range.');
17177 }
17178
17179 var bitmap = a << 16 | b << 8 | c;
17180 result += b64.charAt(bitmap >> 18 & 63) + b64.charAt(bitmap >> 12 & 63) + b64.charAt(bitmap >> 6 & 63) + b64.charAt(bitmap & 63);
17181 } // To determine the final padding
17182
17183
17184 var rest = string.length % 3; // If there's need of padding, replace the last 'A's with equal signs
17185
17186 return rest ? (0, _slice.default)(result).call(result, 0, rest - 3) + '==='.substring(rest) : result;
17187};
17188
17189/***/ }),
17190/* 521 */
17191/***/ (function(module, exports, __webpack_require__) {
17192
17193"use strict";
17194
17195
17196var _ = __webpack_require__(3);
17197
17198var ajax = __webpack_require__(115);
17199
17200module.exports = function upload(uploadInfo, data, file) {
17201 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
17202 return ajax({
17203 url: uploadInfo.upload_url,
17204 method: 'PUT',
17205 data: data,
17206 headers: _.extend({
17207 'Content-Type': file.get('mime_type'),
17208 'Cache-Control': 'public, max-age=31536000'
17209 }, file._uploadHeaders),
17210 onprogress: saveOptions.onprogress
17211 }).then(function () {
17212 file.attributes.url = uploadInfo.url;
17213 file._bucket = uploadInfo.bucket;
17214 file.id = uploadInfo.objectId;
17215 return file;
17216 });
17217};
17218
17219/***/ }),
17220/* 522 */
17221/***/ (function(module, exports, __webpack_require__) {
17222
17223(function(){
17224 var crypt = __webpack_require__(523),
17225 utf8 = __webpack_require__(252).utf8,
17226 isBuffer = __webpack_require__(524),
17227 bin = __webpack_require__(252).bin,
17228
17229 // The core
17230 md5 = function (message, options) {
17231 // Convert to byte array
17232 if (message.constructor == String)
17233 if (options && options.encoding === 'binary')
17234 message = bin.stringToBytes(message);
17235 else
17236 message = utf8.stringToBytes(message);
17237 else if (isBuffer(message))
17238 message = Array.prototype.slice.call(message, 0);
17239 else if (!Array.isArray(message))
17240 message = message.toString();
17241 // else, assume byte array already
17242
17243 var m = crypt.bytesToWords(message),
17244 l = message.length * 8,
17245 a = 1732584193,
17246 b = -271733879,
17247 c = -1732584194,
17248 d = 271733878;
17249
17250 // Swap endian
17251 for (var i = 0; i < m.length; i++) {
17252 m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |
17253 ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;
17254 }
17255
17256 // Padding
17257 m[l >>> 5] |= 0x80 << (l % 32);
17258 m[(((l + 64) >>> 9) << 4) + 14] = l;
17259
17260 // Method shortcuts
17261 var FF = md5._ff,
17262 GG = md5._gg,
17263 HH = md5._hh,
17264 II = md5._ii;
17265
17266 for (var i = 0; i < m.length; i += 16) {
17267
17268 var aa = a,
17269 bb = b,
17270 cc = c,
17271 dd = d;
17272
17273 a = FF(a, b, c, d, m[i+ 0], 7, -680876936);
17274 d = FF(d, a, b, c, m[i+ 1], 12, -389564586);
17275 c = FF(c, d, a, b, m[i+ 2], 17, 606105819);
17276 b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);
17277 a = FF(a, b, c, d, m[i+ 4], 7, -176418897);
17278 d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);
17279 c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);
17280 b = FF(b, c, d, a, m[i+ 7], 22, -45705983);
17281 a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);
17282 d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);
17283 c = FF(c, d, a, b, m[i+10], 17, -42063);
17284 b = FF(b, c, d, a, m[i+11], 22, -1990404162);
17285 a = FF(a, b, c, d, m[i+12], 7, 1804603682);
17286 d = FF(d, a, b, c, m[i+13], 12, -40341101);
17287 c = FF(c, d, a, b, m[i+14], 17, -1502002290);
17288 b = FF(b, c, d, a, m[i+15], 22, 1236535329);
17289
17290 a = GG(a, b, c, d, m[i+ 1], 5, -165796510);
17291 d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);
17292 c = GG(c, d, a, b, m[i+11], 14, 643717713);
17293 b = GG(b, c, d, a, m[i+ 0], 20, -373897302);
17294 a = GG(a, b, c, d, m[i+ 5], 5, -701558691);
17295 d = GG(d, a, b, c, m[i+10], 9, 38016083);
17296 c = GG(c, d, a, b, m[i+15], 14, -660478335);
17297 b = GG(b, c, d, a, m[i+ 4], 20, -405537848);
17298 a = GG(a, b, c, d, m[i+ 9], 5, 568446438);
17299 d = GG(d, a, b, c, m[i+14], 9, -1019803690);
17300 c = GG(c, d, a, b, m[i+ 3], 14, -187363961);
17301 b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);
17302 a = GG(a, b, c, d, m[i+13], 5, -1444681467);
17303 d = GG(d, a, b, c, m[i+ 2], 9, -51403784);
17304 c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);
17305 b = GG(b, c, d, a, m[i+12], 20, -1926607734);
17306
17307 a = HH(a, b, c, d, m[i+ 5], 4, -378558);
17308 d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);
17309 c = HH(c, d, a, b, m[i+11], 16, 1839030562);
17310 b = HH(b, c, d, a, m[i+14], 23, -35309556);
17311 a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);
17312 d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);
17313 c = HH(c, d, a, b, m[i+ 7], 16, -155497632);
17314 b = HH(b, c, d, a, m[i+10], 23, -1094730640);
17315 a = HH(a, b, c, d, m[i+13], 4, 681279174);
17316 d = HH(d, a, b, c, m[i+ 0], 11, -358537222);
17317 c = HH(c, d, a, b, m[i+ 3], 16, -722521979);
17318 b = HH(b, c, d, a, m[i+ 6], 23, 76029189);
17319 a = HH(a, b, c, d, m[i+ 9], 4, -640364487);
17320 d = HH(d, a, b, c, m[i+12], 11, -421815835);
17321 c = HH(c, d, a, b, m[i+15], 16, 530742520);
17322 b = HH(b, c, d, a, m[i+ 2], 23, -995338651);
17323
17324 a = II(a, b, c, d, m[i+ 0], 6, -198630844);
17325 d = II(d, a, b, c, m[i+ 7], 10, 1126891415);
17326 c = II(c, d, a, b, m[i+14], 15, -1416354905);
17327 b = II(b, c, d, a, m[i+ 5], 21, -57434055);
17328 a = II(a, b, c, d, m[i+12], 6, 1700485571);
17329 d = II(d, a, b, c, m[i+ 3], 10, -1894986606);
17330 c = II(c, d, a, b, m[i+10], 15, -1051523);
17331 b = II(b, c, d, a, m[i+ 1], 21, -2054922799);
17332 a = II(a, b, c, d, m[i+ 8], 6, 1873313359);
17333 d = II(d, a, b, c, m[i+15], 10, -30611744);
17334 c = II(c, d, a, b, m[i+ 6], 15, -1560198380);
17335 b = II(b, c, d, a, m[i+13], 21, 1309151649);
17336 a = II(a, b, c, d, m[i+ 4], 6, -145523070);
17337 d = II(d, a, b, c, m[i+11], 10, -1120210379);
17338 c = II(c, d, a, b, m[i+ 2], 15, 718787259);
17339 b = II(b, c, d, a, m[i+ 9], 21, -343485551);
17340
17341 a = (a + aa) >>> 0;
17342 b = (b + bb) >>> 0;
17343 c = (c + cc) >>> 0;
17344 d = (d + dd) >>> 0;
17345 }
17346
17347 return crypt.endian([a, b, c, d]);
17348 };
17349
17350 // Auxiliary functions
17351 md5._ff = function (a, b, c, d, x, s, t) {
17352 var n = a + (b & c | ~b & d) + (x >>> 0) + t;
17353 return ((n << s) | (n >>> (32 - s))) + b;
17354 };
17355 md5._gg = function (a, b, c, d, x, s, t) {
17356 var n = a + (b & d | c & ~d) + (x >>> 0) + t;
17357 return ((n << s) | (n >>> (32 - s))) + b;
17358 };
17359 md5._hh = function (a, b, c, d, x, s, t) {
17360 var n = a + (b ^ c ^ d) + (x >>> 0) + t;
17361 return ((n << s) | (n >>> (32 - s))) + b;
17362 };
17363 md5._ii = function (a, b, c, d, x, s, t) {
17364 var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
17365 return ((n << s) | (n >>> (32 - s))) + b;
17366 };
17367
17368 // Package private blocksize
17369 md5._blocksize = 16;
17370 md5._digestsize = 16;
17371
17372 module.exports = function (message, options) {
17373 if (message === undefined || message === null)
17374 throw new Error('Illegal argument ' + message);
17375
17376 var digestbytes = crypt.wordsToBytes(md5(message, options));
17377 return options && options.asBytes ? digestbytes :
17378 options && options.asString ? bin.bytesToString(digestbytes) :
17379 crypt.bytesToHex(digestbytes);
17380 };
17381
17382})();
17383
17384
17385/***/ }),
17386/* 523 */
17387/***/ (function(module, exports) {
17388
17389(function() {
17390 var base64map
17391 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
17392
17393 crypt = {
17394 // Bit-wise rotation left
17395 rotl: function(n, b) {
17396 return (n << b) | (n >>> (32 - b));
17397 },
17398
17399 // Bit-wise rotation right
17400 rotr: function(n, b) {
17401 return (n << (32 - b)) | (n >>> b);
17402 },
17403
17404 // Swap big-endian to little-endian and vice versa
17405 endian: function(n) {
17406 // If number given, swap endian
17407 if (n.constructor == Number) {
17408 return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
17409 }
17410
17411 // Else, assume array and swap all items
17412 for (var i = 0; i < n.length; i++)
17413 n[i] = crypt.endian(n[i]);
17414 return n;
17415 },
17416
17417 // Generate an array of any length of random bytes
17418 randomBytes: function(n) {
17419 for (var bytes = []; n > 0; n--)
17420 bytes.push(Math.floor(Math.random() * 256));
17421 return bytes;
17422 },
17423
17424 // Convert a byte array to big-endian 32-bit words
17425 bytesToWords: function(bytes) {
17426 for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
17427 words[b >>> 5] |= bytes[i] << (24 - b % 32);
17428 return words;
17429 },
17430
17431 // Convert big-endian 32-bit words to a byte array
17432 wordsToBytes: function(words) {
17433 for (var bytes = [], b = 0; b < words.length * 32; b += 8)
17434 bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
17435 return bytes;
17436 },
17437
17438 // Convert a byte array to a hex string
17439 bytesToHex: function(bytes) {
17440 for (var hex = [], i = 0; i < bytes.length; i++) {
17441 hex.push((bytes[i] >>> 4).toString(16));
17442 hex.push((bytes[i] & 0xF).toString(16));
17443 }
17444 return hex.join('');
17445 },
17446
17447 // Convert a hex string to a byte array
17448 hexToBytes: function(hex) {
17449 for (var bytes = [], c = 0; c < hex.length; c += 2)
17450 bytes.push(parseInt(hex.substr(c, 2), 16));
17451 return bytes;
17452 },
17453
17454 // Convert a byte array to a base-64 string
17455 bytesToBase64: function(bytes) {
17456 for (var base64 = [], i = 0; i < bytes.length; i += 3) {
17457 var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
17458 for (var j = 0; j < 4; j++)
17459 if (i * 8 + j * 6 <= bytes.length * 8)
17460 base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
17461 else
17462 base64.push('=');
17463 }
17464 return base64.join('');
17465 },
17466
17467 // Convert a base-64 string to a byte array
17468 base64ToBytes: function(base64) {
17469 // Remove non-base-64 characters
17470 base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
17471
17472 for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
17473 imod4 = ++i % 4) {
17474 if (imod4 == 0) continue;
17475 bytes.push(((base64map.indexOf(base64.charAt(i - 1))
17476 & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
17477 | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
17478 }
17479 return bytes;
17480 }
17481 };
17482
17483 module.exports = crypt;
17484})();
17485
17486
17487/***/ }),
17488/* 524 */
17489/***/ (function(module, exports) {
17490
17491/*!
17492 * Determine if an object is a Buffer
17493 *
17494 * @author Feross Aboukhadijeh <https://feross.org>
17495 * @license MIT
17496 */
17497
17498// The _isBuffer check is for Safari 5-7 support, because it's missing
17499// Object.prototype.constructor. Remove this eventually
17500module.exports = function (obj) {
17501 return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
17502}
17503
17504function isBuffer (obj) {
17505 return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
17506}
17507
17508// For Node v0.10 support. Remove this eventually.
17509function isSlowBuffer (obj) {
17510 return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
17511}
17512
17513
17514/***/ }),
17515/* 525 */
17516/***/ (function(module, exports, __webpack_require__) {
17517
17518"use strict";
17519
17520
17521var _interopRequireDefault = __webpack_require__(1);
17522
17523var _indexOf = _interopRequireDefault(__webpack_require__(90));
17524
17525var dataURItoBlob = function dataURItoBlob(dataURI, type) {
17526 var _context;
17527
17528 var byteString; // 传入的 base64,不是 dataURL
17529
17530 if ((0, _indexOf.default)(dataURI).call(dataURI, 'base64') < 0) {
17531 byteString = atob(dataURI);
17532 } else if ((0, _indexOf.default)(_context = dataURI.split(',')[0]).call(_context, 'base64') >= 0) {
17533 type = type || dataURI.split(',')[0].split(':')[1].split(';')[0];
17534 byteString = atob(dataURI.split(',')[1]);
17535 } else {
17536 byteString = unescape(dataURI.split(',')[1]);
17537 }
17538
17539 var ia = new Uint8Array(byteString.length);
17540
17541 for (var i = 0; i < byteString.length; i++) {
17542 ia[i] = byteString.charCodeAt(i);
17543 }
17544
17545 return new Blob([ia], {
17546 type: type
17547 });
17548};
17549
17550module.exports = dataURItoBlob;
17551
17552/***/ }),
17553/* 526 */
17554/***/ (function(module, exports, __webpack_require__) {
17555
17556"use strict";
17557
17558
17559var _interopRequireDefault = __webpack_require__(1);
17560
17561var _slicedToArray2 = _interopRequireDefault(__webpack_require__(527));
17562
17563var _map = _interopRequireDefault(__webpack_require__(35));
17564
17565var _indexOf = _interopRequireDefault(__webpack_require__(90));
17566
17567var _find = _interopRequireDefault(__webpack_require__(92));
17568
17569var _promise = _interopRequireDefault(__webpack_require__(13));
17570
17571var _concat = _interopRequireDefault(__webpack_require__(22));
17572
17573var _keys2 = _interopRequireDefault(__webpack_require__(57));
17574
17575var _stringify = _interopRequireDefault(__webpack_require__(36));
17576
17577var _defineProperty = _interopRequireDefault(__webpack_require__(114));
17578
17579var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(253));
17580
17581var _ = __webpack_require__(3);
17582
17583var AVError = __webpack_require__(46);
17584
17585var _require = __webpack_require__(27),
17586 _request = _require._request;
17587
17588var _require2 = __webpack_require__(30),
17589 isNullOrUndefined = _require2.isNullOrUndefined,
17590 ensureArray = _require2.ensureArray,
17591 transformFetchOptions = _require2.transformFetchOptions,
17592 setValue = _require2.setValue,
17593 findValue = _require2.findValue,
17594 isPlainObject = _require2.isPlainObject,
17595 continueWhile = _require2.continueWhile;
17596
17597var recursiveToPointer = function recursiveToPointer(value) {
17598 if (_.isArray(value)) return (0, _map.default)(value).call(value, recursiveToPointer);
17599 if (isPlainObject(value)) return _.mapObject(value, recursiveToPointer);
17600 if (_.isObject(value) && value._toPointer) return value._toPointer();
17601 return value;
17602};
17603
17604var RESERVED_KEYS = ['objectId', 'createdAt', 'updatedAt'];
17605
17606var checkReservedKey = function checkReservedKey(key) {
17607 if ((0, _indexOf.default)(RESERVED_KEYS).call(RESERVED_KEYS, key) !== -1) {
17608 throw new Error("key[".concat(key, "] is reserved"));
17609 }
17610};
17611
17612var handleBatchResults = function handleBatchResults(results) {
17613 var firstError = (0, _find.default)(_).call(_, results, function (result) {
17614 return result instanceof Error;
17615 });
17616
17617 if (!firstError) {
17618 return results;
17619 }
17620
17621 var error = new AVError(firstError.code, firstError.message);
17622 error.results = results;
17623 throw error;
17624}; // Helper function to get a value from a Backbone object as a property
17625// or as a function.
17626
17627
17628function getValue(object, prop) {
17629 if (!(object && object[prop])) {
17630 return null;
17631 }
17632
17633 return _.isFunction(object[prop]) ? object[prop]() : object[prop];
17634} // AV.Object is analogous to the Java AVObject.
17635// It also implements the same interface as a Backbone model.
17636
17637
17638module.exports = function (AV) {
17639 /**
17640 * Creates a new model with defined attributes. A client id (cid) is
17641 * automatically generated and assigned for you.
17642 *
17643 * <p>You won't normally call this method directly. It is recommended that
17644 * you use a subclass of <code>AV.Object</code> instead, created by calling
17645 * <code>extend</code>.</p>
17646 *
17647 * <p>However, if you don't want to use a subclass, or aren't sure which
17648 * subclass is appropriate, you can use this form:<pre>
17649 * var object = new AV.Object("ClassName");
17650 * </pre>
17651 * That is basically equivalent to:<pre>
17652 * var MyClass = AV.Object.extend("ClassName");
17653 * var object = new MyClass();
17654 * </pre></p>
17655 *
17656 * @param {Object} attributes The initial set of data to store in the object.
17657 * @param {Object} options A set of Backbone-like options for creating the
17658 * object. The only option currently supported is "collection".
17659 * @see AV.Object.extend
17660 *
17661 * @class
17662 *
17663 * <p>The fundamental unit of AV data, which implements the Backbone Model
17664 * interface.</p>
17665 */
17666 AV.Object = function (attributes, options) {
17667 // Allow new AV.Object("ClassName") as a shortcut to _create.
17668 if (_.isString(attributes)) {
17669 return AV.Object._create.apply(this, arguments);
17670 }
17671
17672 attributes = attributes || {};
17673
17674 if (options && options.parse) {
17675 attributes = this.parse(attributes);
17676 attributes = this._mergeMagicFields(attributes);
17677 }
17678
17679 var defaults = getValue(this, 'defaults');
17680
17681 if (defaults) {
17682 attributes = _.extend({}, defaults, attributes);
17683 }
17684
17685 if (options && options.collection) {
17686 this.collection = options.collection;
17687 }
17688
17689 this._serverData = {}; // The last known data for this object from cloud.
17690
17691 this._opSetQueue = [{}]; // List of sets of changes to the data.
17692
17693 this._flags = {};
17694 this.attributes = {}; // The best estimate of this's current data.
17695
17696 this._hashedJSON = {}; // Hash of values of containers at last save.
17697
17698 this._escapedAttributes = {};
17699 this.cid = _.uniqueId('c');
17700 this.changed = {};
17701 this._silent = {};
17702 this._pending = {};
17703 this.set(attributes, {
17704 silent: true
17705 });
17706 this.changed = {};
17707 this._silent = {};
17708 this._pending = {};
17709 this._hasData = true;
17710 this._previousAttributes = _.clone(this.attributes);
17711 this.initialize.apply(this, arguments);
17712 };
17713 /**
17714 * @lends AV.Object.prototype
17715 * @property {String} id The objectId of the AV Object.
17716 */
17717
17718 /**
17719 * Saves the given list of AV.Object.
17720 * If any error is encountered, stops and calls the error handler.
17721 *
17722 * @example
17723 * AV.Object.saveAll([object1, object2, ...]).then(function(list) {
17724 * // All the objects were saved.
17725 * }, function(error) {
17726 * // An error occurred while saving one of the objects.
17727 * });
17728 *
17729 * @param {Array} list A list of <code>AV.Object</code>.
17730 */
17731
17732
17733 AV.Object.saveAll = function (list, options) {
17734 return AV.Object._deepSaveAsync(list, null, options);
17735 };
17736 /**
17737 * Fetch the given list of AV.Object.
17738 *
17739 * @param {AV.Object[]} objects A list of <code>AV.Object</code>
17740 * @param {AuthOptions} options
17741 * @return {Promise.<AV.Object[]>} The given list of <code>AV.Object</code>, updated
17742 */
17743
17744
17745 AV.Object.fetchAll = function (objects, options) {
17746 return _promise.default.resolve().then(function () {
17747 return _request('batch', null, null, 'POST', {
17748 requests: (0, _map.default)(_).call(_, objects, function (object) {
17749 var _context;
17750
17751 if (!object.className) throw new Error('object must have className to fetch');
17752 if (!object.id) throw new Error('object must have id to fetch');
17753 if (object.dirty()) throw new Error('object is modified but not saved');
17754 return {
17755 method: 'GET',
17756 path: (0, _concat.default)(_context = "/1.1/classes/".concat(object.className, "/")).call(_context, object.id)
17757 };
17758 })
17759 }, options);
17760 }).then(function (response) {
17761 var results = (0, _map.default)(_).call(_, objects, function (object, i) {
17762 if (response[i].success) {
17763 var fetchedAttrs = object.parse(response[i].success);
17764
17765 object._cleanupUnsetKeys(fetchedAttrs);
17766
17767 object._finishFetch(fetchedAttrs);
17768
17769 return object;
17770 }
17771
17772 if (response[i].success === null) {
17773 return new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
17774 }
17775
17776 return new AVError(response[i].error.code, response[i].error.error);
17777 });
17778 return handleBatchResults(results);
17779 });
17780 }; // Attach all inheritable methods to the AV.Object prototype.
17781
17782
17783 _.extend(AV.Object.prototype, AV.Events,
17784 /** @lends AV.Object.prototype */
17785 {
17786 _fetchWhenSave: false,
17787
17788 /**
17789 * Initialize is an empty function by default. Override it with your own
17790 * initialization logic.
17791 */
17792 initialize: function initialize() {},
17793
17794 /**
17795 * Set whether to enable fetchWhenSave option when updating object.
17796 * When set true, SDK would fetch the latest object after saving.
17797 * Default is false.
17798 *
17799 * @deprecated use AV.Object#save with options.fetchWhenSave instead
17800 * @param {boolean} enable true to enable fetchWhenSave option.
17801 */
17802 fetchWhenSave: function fetchWhenSave(enable) {
17803 console.warn('AV.Object#fetchWhenSave is deprecated, use AV.Object#save with options.fetchWhenSave instead.');
17804
17805 if (!_.isBoolean(enable)) {
17806 throw new Error('Expect boolean value for fetchWhenSave');
17807 }
17808
17809 this._fetchWhenSave = enable;
17810 },
17811
17812 /**
17813 * Returns the object's objectId.
17814 * @return {String} the objectId.
17815 */
17816 getObjectId: function getObjectId() {
17817 return this.id;
17818 },
17819
17820 /**
17821 * Returns the object's createdAt attribute.
17822 * @return {Date}
17823 */
17824 getCreatedAt: function getCreatedAt() {
17825 return this.createdAt;
17826 },
17827
17828 /**
17829 * Returns the object's updatedAt attribute.
17830 * @return {Date}
17831 */
17832 getUpdatedAt: function getUpdatedAt() {
17833 return this.updatedAt;
17834 },
17835
17836 /**
17837 * Returns a JSON version of the object.
17838 * @return {Object}
17839 */
17840 toJSON: function toJSON(key, holder) {
17841 var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
17842 return this._toFullJSON(seenObjects, false);
17843 },
17844
17845 /**
17846 * Returns a JSON version of the object with meta data.
17847 * Inverse to {@link AV.parseJSON}
17848 * @since 3.0.0
17849 * @return {Object}
17850 */
17851 toFullJSON: function toFullJSON() {
17852 var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
17853 return this._toFullJSON(seenObjects);
17854 },
17855 _toFullJSON: function _toFullJSON(seenObjects) {
17856 var _this = this;
17857
17858 var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
17859
17860 var json = _.clone(this.attributes);
17861
17862 if (_.isArray(seenObjects)) {
17863 var newSeenObjects = (0, _concat.default)(seenObjects).call(seenObjects, this);
17864 }
17865
17866 AV._objectEach(json, function (val, key) {
17867 json[key] = AV._encode(val, newSeenObjects, undefined, full);
17868 });
17869
17870 AV._objectEach(this._operations, function (val, key) {
17871 json[key] = val;
17872 });
17873
17874 if (_.has(this, 'id')) {
17875 json.objectId = this.id;
17876 }
17877
17878 ['createdAt', 'updatedAt'].forEach(function (key) {
17879 if (_.has(_this, key)) {
17880 var val = _this[key];
17881 json[key] = _.isDate(val) ? val.toJSON() : val;
17882 }
17883 });
17884
17885 if (full) {
17886 json.__type = 'Object';
17887 if (_.isArray(seenObjects) && seenObjects.length) json.__type = 'Pointer';
17888 json.className = this.className;
17889 }
17890
17891 return json;
17892 },
17893
17894 /**
17895 * Updates _hashedJSON to reflect the current state of this object.
17896 * Adds any changed hash values to the set of pending changes.
17897 * @private
17898 */
17899 _refreshCache: function _refreshCache() {
17900 var self = this;
17901
17902 if (self._refreshingCache) {
17903 return;
17904 }
17905
17906 self._refreshingCache = true;
17907
17908 AV._objectEach(this.attributes, function (value, key) {
17909 if (value instanceof AV.Object) {
17910 value._refreshCache();
17911 } else if (_.isObject(value)) {
17912 if (self._resetCacheForKey(key)) {
17913 self.set(key, new AV.Op.Set(value), {
17914 silent: true
17915 });
17916 }
17917 }
17918 });
17919
17920 delete self._refreshingCache;
17921 },
17922
17923 /**
17924 * Returns true if this object has been modified since its last
17925 * save/refresh. If an attribute is specified, it returns true only if that
17926 * particular attribute has been modified since the last save/refresh.
17927 * @param {String} attr An attribute name (optional).
17928 * @return {Boolean}
17929 */
17930 dirty: function dirty(attr) {
17931 this._refreshCache();
17932
17933 var currentChanges = _.last(this._opSetQueue);
17934
17935 if (attr) {
17936 return currentChanges[attr] ? true : false;
17937 }
17938
17939 if (!this.id) {
17940 return true;
17941 }
17942
17943 if ((0, _keys2.default)(_).call(_, currentChanges).length > 0) {
17944 return true;
17945 }
17946
17947 return false;
17948 },
17949
17950 /**
17951 * Returns the keys of the modified attribute since its last save/refresh.
17952 * @return {String[]}
17953 */
17954 dirtyKeys: function dirtyKeys() {
17955 this._refreshCache();
17956
17957 var currentChanges = _.last(this._opSetQueue);
17958
17959 return (0, _keys2.default)(_).call(_, currentChanges);
17960 },
17961
17962 /**
17963 * Gets a Pointer referencing this Object.
17964 * @private
17965 */
17966 _toPointer: function _toPointer() {
17967 // if (!this.id) {
17968 // throw new Error("Can't serialize an unsaved AV.Object");
17969 // }
17970 return {
17971 __type: 'Pointer',
17972 className: this.className,
17973 objectId: this.id
17974 };
17975 },
17976
17977 /**
17978 * Gets the value of an attribute.
17979 * @param {String} attr The string name of an attribute.
17980 */
17981 get: function get(attr) {
17982 switch (attr) {
17983 case 'objectId':
17984 return this.id;
17985
17986 case 'createdAt':
17987 case 'updatedAt':
17988 return this[attr];
17989
17990 default:
17991 return this.attributes[attr];
17992 }
17993 },
17994
17995 /**
17996 * Gets a relation on the given class for the attribute.
17997 * @param {String} attr The attribute to get the relation for.
17998 * @return {AV.Relation}
17999 */
18000 relation: function relation(attr) {
18001 var value = this.get(attr);
18002
18003 if (value) {
18004 if (!(value instanceof AV.Relation)) {
18005 throw new Error('Called relation() on non-relation field ' + attr);
18006 }
18007
18008 value._ensureParentAndKey(this, attr);
18009
18010 return value;
18011 } else {
18012 return new AV.Relation(this, attr);
18013 }
18014 },
18015
18016 /**
18017 * Gets the HTML-escaped value of an attribute.
18018 */
18019 escape: function escape(attr) {
18020 var html = this._escapedAttributes[attr];
18021
18022 if (html) {
18023 return html;
18024 }
18025
18026 var val = this.attributes[attr];
18027 var escaped;
18028
18029 if (isNullOrUndefined(val)) {
18030 escaped = '';
18031 } else {
18032 escaped = _.escape(val.toString());
18033 }
18034
18035 this._escapedAttributes[attr] = escaped;
18036 return escaped;
18037 },
18038
18039 /**
18040 * Returns <code>true</code> if the attribute contains a value that is not
18041 * null or undefined.
18042 * @param {String} attr The string name of the attribute.
18043 * @return {Boolean}
18044 */
18045 has: function has(attr) {
18046 return !isNullOrUndefined(this.attributes[attr]);
18047 },
18048
18049 /**
18050 * Pulls "special" fields like objectId, createdAt, etc. out of attrs
18051 * and puts them on "this" directly. Removes them from attrs.
18052 * @param attrs - A dictionary with the data for this AV.Object.
18053 * @private
18054 */
18055 _mergeMagicFields: function _mergeMagicFields(attrs) {
18056 // Check for changes of magic fields.
18057 var model = this;
18058 var specialFields = ['objectId', 'createdAt', 'updatedAt'];
18059
18060 AV._arrayEach(specialFields, function (attr) {
18061 if (attrs[attr]) {
18062 if (attr === 'objectId') {
18063 model.id = attrs[attr];
18064 } else if ((attr === 'createdAt' || attr === 'updatedAt') && !_.isDate(attrs[attr])) {
18065 model[attr] = AV._parseDate(attrs[attr]);
18066 } else {
18067 model[attr] = attrs[attr];
18068 }
18069
18070 delete attrs[attr];
18071 }
18072 });
18073
18074 return attrs;
18075 },
18076
18077 /**
18078 * Returns the json to be sent to the server.
18079 * @private
18080 */
18081 _startSave: function _startSave() {
18082 this._opSetQueue.push({});
18083 },
18084
18085 /**
18086 * Called when a save fails because of an error. Any changes that were part
18087 * of the save need to be merged with changes made after the save. This
18088 * might throw an exception is you do conflicting operations. For example,
18089 * if you do:
18090 * object.set("foo", "bar");
18091 * object.set("invalid field name", "baz");
18092 * object.save();
18093 * object.increment("foo");
18094 * then this will throw when the save fails and the client tries to merge
18095 * "bar" with the +1.
18096 * @private
18097 */
18098 _cancelSave: function _cancelSave() {
18099 var failedChanges = _.first(this._opSetQueue);
18100
18101 this._opSetQueue = _.rest(this._opSetQueue);
18102
18103 var nextChanges = _.first(this._opSetQueue);
18104
18105 AV._objectEach(failedChanges, function (op, key) {
18106 var op1 = failedChanges[key];
18107 var op2 = nextChanges[key];
18108
18109 if (op1 && op2) {
18110 nextChanges[key] = op2._mergeWithPrevious(op1);
18111 } else if (op1) {
18112 nextChanges[key] = op1;
18113 }
18114 });
18115
18116 this._saving = this._saving - 1;
18117 },
18118
18119 /**
18120 * Called when a save completes successfully. This merges the changes that
18121 * were saved into the known server data, and overrides it with any data
18122 * sent directly from the server.
18123 * @private
18124 */
18125 _finishSave: function _finishSave(serverData) {
18126 var _context2;
18127
18128 // Grab a copy of any object referenced by this object. These instances
18129 // may have already been fetched, and we don't want to lose their data.
18130 // Note that doing it like this means we will unify separate copies of the
18131 // same object, but that's a risk we have to take.
18132 var fetchedObjects = {};
18133
18134 AV._traverse(this.attributes, function (object) {
18135 if (object instanceof AV.Object && object.id && object._hasData) {
18136 fetchedObjects[object.id] = object;
18137 }
18138 });
18139
18140 var savedChanges = _.first(this._opSetQueue);
18141
18142 this._opSetQueue = _.rest(this._opSetQueue);
18143
18144 this._applyOpSet(savedChanges, this._serverData);
18145
18146 this._mergeMagicFields(serverData);
18147
18148 var self = this;
18149
18150 AV._objectEach(serverData, function (value, key) {
18151 self._serverData[key] = AV._decode(value, key); // Look for any objects that might have become unfetched and fix them
18152 // by replacing their values with the previously observed values.
18153
18154 var fetched = AV._traverse(self._serverData[key], function (object) {
18155 if (object instanceof AV.Object && fetchedObjects[object.id]) {
18156 return fetchedObjects[object.id];
18157 }
18158 });
18159
18160 if (fetched) {
18161 self._serverData[key] = fetched;
18162 }
18163 });
18164
18165 this._rebuildAllEstimatedData();
18166
18167 var opSetQueue = (0, _map.default)(_context2 = this._opSetQueue).call(_context2, _.clone);
18168
18169 this._refreshCache();
18170
18171 this._opSetQueue = opSetQueue;
18172 this._saving = this._saving - 1;
18173 },
18174
18175 /**
18176 * Called when a fetch or login is complete to set the known server data to
18177 * the given object.
18178 * @private
18179 */
18180 _finishFetch: function _finishFetch(serverData, hasData) {
18181 // Clear out any changes the user might have made previously.
18182 this._opSetQueue = [{}]; // Bring in all the new server data.
18183
18184 this._mergeMagicFields(serverData);
18185
18186 var self = this;
18187
18188 AV._objectEach(serverData, function (value, key) {
18189 self._serverData[key] = AV._decode(value, key);
18190 }); // Refresh the attributes.
18191
18192
18193 this._rebuildAllEstimatedData(); // Clear out the cache of mutable containers.
18194
18195
18196 this._refreshCache();
18197
18198 this._opSetQueue = [{}];
18199 this._hasData = hasData;
18200 },
18201
18202 /**
18203 * Applies the set of AV.Op in opSet to the object target.
18204 * @private
18205 */
18206 _applyOpSet: function _applyOpSet(opSet, target) {
18207 var self = this;
18208
18209 AV._objectEach(opSet, function (change, key) {
18210 var _findValue = findValue(target, key),
18211 _findValue2 = (0, _slicedToArray2.default)(_findValue, 3),
18212 value = _findValue2[0],
18213 actualTarget = _findValue2[1],
18214 actualKey = _findValue2[2];
18215
18216 setValue(target, key, change._estimate(value, self, key));
18217
18218 if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
18219 delete actualTarget[actualKey];
18220 }
18221 });
18222 },
18223
18224 /**
18225 * Replaces the cached value for key with the current value.
18226 * Returns true if the new value is different than the old value.
18227 * @private
18228 */
18229 _resetCacheForKey: function _resetCacheForKey(key) {
18230 var value = this.attributes[key];
18231
18232 if (_.isObject(value) && !(value instanceof AV.Object) && !(value instanceof AV.File)) {
18233 var json = (0, _stringify.default)(recursiveToPointer(value));
18234
18235 if (this._hashedJSON[key] !== json) {
18236 var wasSet = !!this._hashedJSON[key];
18237 this._hashedJSON[key] = json;
18238 return wasSet;
18239 }
18240 }
18241
18242 return false;
18243 },
18244
18245 /**
18246 * Populates attributes[key] by starting with the last known data from the
18247 * server, and applying all of the local changes that have been made to that
18248 * key since then.
18249 * @private
18250 */
18251 _rebuildEstimatedDataForKey: function _rebuildEstimatedDataForKey(key) {
18252 var self = this;
18253 delete this.attributes[key];
18254
18255 if (this._serverData[key]) {
18256 this.attributes[key] = this._serverData[key];
18257 }
18258
18259 AV._arrayEach(this._opSetQueue, function (opSet) {
18260 var op = opSet[key];
18261
18262 if (op) {
18263 var _findValue3 = findValue(self.attributes, key),
18264 _findValue4 = (0, _slicedToArray2.default)(_findValue3, 4),
18265 value = _findValue4[0],
18266 actualTarget = _findValue4[1],
18267 actualKey = _findValue4[2],
18268 firstKey = _findValue4[3];
18269
18270 setValue(self.attributes, key, op._estimate(value, self, key));
18271
18272 if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
18273 delete actualTarget[actualKey];
18274 }
18275
18276 self._resetCacheForKey(firstKey);
18277 }
18278 });
18279 },
18280
18281 /**
18282 * Populates attributes by starting with the last known data from the
18283 * server, and applying all of the local changes that have been made since
18284 * then.
18285 * @private
18286 */
18287 _rebuildAllEstimatedData: function _rebuildAllEstimatedData() {
18288 var self = this;
18289
18290 var previousAttributes = _.clone(this.attributes);
18291
18292 this.attributes = _.clone(this._serverData);
18293
18294 AV._arrayEach(this._opSetQueue, function (opSet) {
18295 self._applyOpSet(opSet, self.attributes);
18296
18297 AV._objectEach(opSet, function (op, key) {
18298 self._resetCacheForKey(key);
18299 });
18300 }); // Trigger change events for anything that changed because of the fetch.
18301
18302
18303 AV._objectEach(previousAttributes, function (oldValue, key) {
18304 if (self.attributes[key] !== oldValue) {
18305 self.trigger('change:' + key, self, self.attributes[key], {});
18306 }
18307 });
18308
18309 AV._objectEach(this.attributes, function (newValue, key) {
18310 if (!_.has(previousAttributes, key)) {
18311 self.trigger('change:' + key, self, newValue, {});
18312 }
18313 });
18314 },
18315
18316 /**
18317 * Sets a hash of model attributes on the object, firing
18318 * <code>"change"</code> unless you choose to silence it.
18319 *
18320 * <p>You can call it with an object containing keys and values, or with one
18321 * key and value. For example:</p>
18322 *
18323 * @example
18324 * gameTurn.set({
18325 * player: player1,
18326 * diceRoll: 2
18327 * });
18328 *
18329 * game.set("currentPlayer", player2);
18330 *
18331 * game.set("finished", true);
18332 *
18333 * @param {String} key The key to set.
18334 * @param {Any} value The value to give it.
18335 * @param {Object} [options]
18336 * @param {Boolean} [options.silent]
18337 * @return {AV.Object} self if succeeded, throws if the value is not valid.
18338 * @see AV.Object#validate
18339 */
18340 set: function set(key, value, options) {
18341 var attrs;
18342
18343 if (_.isObject(key) || isNullOrUndefined(key)) {
18344 attrs = _.mapObject(key, function (v, k) {
18345 checkReservedKey(k);
18346 return AV._decode(v, k);
18347 });
18348 options = value;
18349 } else {
18350 attrs = {};
18351 checkReservedKey(key);
18352 attrs[key] = AV._decode(value, key);
18353 } // Extract attributes and options.
18354
18355
18356 options = options || {};
18357
18358 if (!attrs) {
18359 return this;
18360 }
18361
18362 if (attrs instanceof AV.Object) {
18363 attrs = attrs.attributes;
18364 } // If the unset option is used, every attribute should be a Unset.
18365
18366
18367 if (options.unset) {
18368 AV._objectEach(attrs, function (unused_value, key) {
18369 attrs[key] = new AV.Op.Unset();
18370 });
18371 } // Apply all the attributes to get the estimated values.
18372
18373
18374 var dataToValidate = _.clone(attrs);
18375
18376 var self = this;
18377
18378 AV._objectEach(dataToValidate, function (value, key) {
18379 if (value instanceof AV.Op) {
18380 dataToValidate[key] = value._estimate(self.attributes[key], self, key);
18381
18382 if (dataToValidate[key] === AV.Op._UNSET) {
18383 delete dataToValidate[key];
18384 }
18385 }
18386 }); // Run validation.
18387
18388
18389 this._validate(attrs, options);
18390
18391 options.changes = {};
18392 var escaped = this._escapedAttributes; // Update attributes.
18393
18394 AV._arrayEach((0, _keys2.default)(_).call(_, attrs), function (attr) {
18395 var val = attrs[attr]; // If this is a relation object we need to set the parent correctly,
18396 // since the location where it was parsed does not have access to
18397 // this object.
18398
18399 if (val instanceof AV.Relation) {
18400 val.parent = self;
18401 }
18402
18403 if (!(val instanceof AV.Op)) {
18404 val = new AV.Op.Set(val);
18405 } // See if this change will actually have any effect.
18406
18407
18408 var isRealChange = true;
18409
18410 if (val instanceof AV.Op.Set && _.isEqual(self.attributes[attr], val.value)) {
18411 isRealChange = false;
18412 }
18413
18414 if (isRealChange) {
18415 delete escaped[attr];
18416
18417 if (options.silent) {
18418 self._silent[attr] = true;
18419 } else {
18420 options.changes[attr] = true;
18421 }
18422 }
18423
18424 var currentChanges = _.last(self._opSetQueue);
18425
18426 currentChanges[attr] = val._mergeWithPrevious(currentChanges[attr]);
18427
18428 self._rebuildEstimatedDataForKey(attr);
18429
18430 if (isRealChange) {
18431 self.changed[attr] = self.attributes[attr];
18432
18433 if (!options.silent) {
18434 self._pending[attr] = true;
18435 }
18436 } else {
18437 delete self.changed[attr];
18438 delete self._pending[attr];
18439 }
18440 });
18441
18442 if (!options.silent) {
18443 this.change(options);
18444 }
18445
18446 return this;
18447 },
18448
18449 /**
18450 * Remove an attribute from the model, firing <code>"change"</code> unless
18451 * you choose to silence it. This is a noop if the attribute doesn't
18452 * exist.
18453 * @param key {String} The key.
18454 */
18455 unset: function unset(attr, options) {
18456 options = options || {};
18457 options.unset = true;
18458 return this.set(attr, null, options);
18459 },
18460
18461 /**
18462 * Atomically increments the value of the given attribute the next time the
18463 * object is saved. If no amount is specified, 1 is used by default.
18464 *
18465 * @param key {String} The key.
18466 * @param amount {Number} The amount to increment by.
18467 */
18468 increment: function increment(attr, amount) {
18469 if (_.isUndefined(amount) || _.isNull(amount)) {
18470 amount = 1;
18471 }
18472
18473 return this.set(attr, new AV.Op.Increment(amount));
18474 },
18475
18476 /**
18477 * Atomically add an object to the end of the array associated with a given
18478 * key.
18479 * @param key {String} The key.
18480 * @param item {} The item to add.
18481 */
18482 add: function add(attr, item) {
18483 return this.set(attr, new AV.Op.Add(ensureArray(item)));
18484 },
18485
18486 /**
18487 * Atomically add an object to the array associated with a given key, only
18488 * if it is not already present in the array. The position of the insert is
18489 * not guaranteed.
18490 *
18491 * @param key {String} The key.
18492 * @param item {} The object to add.
18493 */
18494 addUnique: function addUnique(attr, item) {
18495 return this.set(attr, new AV.Op.AddUnique(ensureArray(item)));
18496 },
18497
18498 /**
18499 * Atomically remove all instances of an object from the array associated
18500 * with a given key.
18501 *
18502 * @param key {String} The key.
18503 * @param item {} The object to remove.
18504 */
18505 remove: function remove(attr, item) {
18506 return this.set(attr, new AV.Op.Remove(ensureArray(item)));
18507 },
18508
18509 /**
18510 * Atomically apply a "bit and" operation on the value associated with a
18511 * given key.
18512 *
18513 * @param key {String} The key.
18514 * @param value {Number} The value to apply.
18515 */
18516 bitAnd: function bitAnd(attr, value) {
18517 return this.set(attr, new AV.Op.BitAnd(value));
18518 },
18519
18520 /**
18521 * Atomically apply a "bit or" operation on the value associated with a
18522 * given key.
18523 *
18524 * @param key {String} The key.
18525 * @param value {Number} The value to apply.
18526 */
18527 bitOr: function bitOr(attr, value) {
18528 return this.set(attr, new AV.Op.BitOr(value));
18529 },
18530
18531 /**
18532 * Atomically apply a "bit xor" operation on the value associated with a
18533 * given key.
18534 *
18535 * @param key {String} The key.
18536 * @param value {Number} The value to apply.
18537 */
18538 bitXor: function bitXor(attr, value) {
18539 return this.set(attr, new AV.Op.BitXor(value));
18540 },
18541
18542 /**
18543 * Returns an instance of a subclass of AV.Op describing what kind of
18544 * modification has been performed on this field since the last time it was
18545 * saved. For example, after calling object.increment("x"), calling
18546 * object.op("x") would return an instance of AV.Op.Increment.
18547 *
18548 * @param key {String} The key.
18549 * @returns {AV.Op} The operation, or undefined if none.
18550 */
18551 op: function op(attr) {
18552 return _.last(this._opSetQueue)[attr];
18553 },
18554
18555 /**
18556 * Clear all attributes on the model, firing <code>"change"</code> unless
18557 * you choose to silence it.
18558 */
18559 clear: function clear(options) {
18560 options = options || {};
18561 options.unset = true;
18562
18563 var keysToClear = _.extend(this.attributes, this._operations);
18564
18565 return this.set(keysToClear, options);
18566 },
18567
18568 /**
18569 * Clears any (or specific) changes to the model made since the last save.
18570 * @param {string|string[]} [keys] specify keys to revert.
18571 */
18572 revert: function revert(keys) {
18573 var lastOp = _.last(this._opSetQueue);
18574
18575 var _keys = ensureArray(keys || (0, _keys2.default)(_).call(_, lastOp));
18576
18577 _keys.forEach(function (key) {
18578 delete lastOp[key];
18579 });
18580
18581 this._rebuildAllEstimatedData();
18582
18583 return this;
18584 },
18585
18586 /**
18587 * Returns a JSON-encoded set of operations to be sent with the next save
18588 * request.
18589 * @private
18590 */
18591 _getSaveJSON: function _getSaveJSON() {
18592 var json = _.clone(_.first(this._opSetQueue));
18593
18594 AV._objectEach(json, function (op, key) {
18595 json[key] = op.toJSON();
18596 });
18597
18598 return json;
18599 },
18600
18601 /**
18602 * Returns true if this object can be serialized for saving.
18603 * @private
18604 */
18605 _canBeSerialized: function _canBeSerialized() {
18606 return AV.Object._canBeSerializedAsValue(this.attributes);
18607 },
18608
18609 /**
18610 * Fetch the model from the server. If the server's representation of the
18611 * model differs from its current attributes, they will be overriden,
18612 * triggering a <code>"change"</code> event.
18613 * @param {Object} fetchOptions Optional options to set 'keys',
18614 * 'include' and 'includeACL' option.
18615 * @param {AuthOptions} options
18616 * @return {Promise} A promise that is fulfilled when the fetch
18617 * completes.
18618 */
18619 fetch: function fetch() {
18620 var fetchOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18621 var options = arguments.length > 1 ? arguments[1] : undefined;
18622
18623 if (!this.id) {
18624 throw new Error('Cannot fetch unsaved object');
18625 }
18626
18627 var self = this;
18628
18629 var request = _request('classes', this.className, this.id, 'GET', transformFetchOptions(fetchOptions), options);
18630
18631 return request.then(function (response) {
18632 var fetchedAttrs = self.parse(response);
18633
18634 self._cleanupUnsetKeys(fetchedAttrs, (0, _keys2.default)(fetchOptions) ? ensureArray((0, _keys2.default)(fetchOptions)).join(',').split(',') : undefined);
18635
18636 self._finishFetch(fetchedAttrs, true);
18637
18638 return self;
18639 });
18640 },
18641 _cleanupUnsetKeys: function _cleanupUnsetKeys(fetchedAttrs) {
18642 var _this2 = this;
18643
18644 var fetchedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _keys2.default)(_).call(_, this._serverData);
18645
18646 _.forEach(fetchedKeys, function (key) {
18647 if (fetchedAttrs[key] === undefined) delete _this2._serverData[key];
18648 });
18649 },
18650
18651 /**
18652 * Set a hash of model attributes, and save the model to the server.
18653 * updatedAt will be updated when the request returns.
18654 * You can either call it as:<pre>
18655 * object.save();</pre>
18656 * or<pre>
18657 * object.save(null, options);</pre>
18658 * or<pre>
18659 * object.save(attrs, options);</pre>
18660 * or<pre>
18661 * object.save(key, value, options);</pre>
18662 *
18663 * @example
18664 * gameTurn.save({
18665 * player: "Jake Cutter",
18666 * diceRoll: 2
18667 * }).then(function(gameTurnAgain) {
18668 * // The save was successful.
18669 * }, function(error) {
18670 * // The save failed. Error is an instance of AVError.
18671 * });
18672 *
18673 * @param {AuthOptions} options AuthOptions plus:
18674 * @param {Boolean} options.fetchWhenSave fetch and update object after save succeeded
18675 * @param {AV.Query} options.query Save object only when it matches the query
18676 * @return {Promise} A promise that is fulfilled when the save
18677 * completes.
18678 * @see AVError
18679 */
18680 save: function save(arg1, arg2, arg3) {
18681 var attrs, current, options;
18682
18683 if (_.isObject(arg1) || isNullOrUndefined(arg1)) {
18684 attrs = arg1;
18685 options = arg2;
18686 } else {
18687 attrs = {};
18688 attrs[arg1] = arg2;
18689 options = arg3;
18690 }
18691
18692 options = _.clone(options) || {};
18693
18694 if (options.wait) {
18695 current = _.clone(this.attributes);
18696 }
18697
18698 var setOptions = _.clone(options) || {};
18699
18700 if (setOptions.wait) {
18701 setOptions.silent = true;
18702 }
18703
18704 if (attrs) {
18705 this.set(attrs, setOptions);
18706 }
18707
18708 var model = this;
18709 var unsavedChildren = [];
18710 var unsavedFiles = [];
18711
18712 AV.Object._findUnsavedChildren(model, unsavedChildren, unsavedFiles);
18713
18714 if (unsavedChildren.length + unsavedFiles.length > 1) {
18715 return AV.Object._deepSaveAsync(this, model, options);
18716 }
18717
18718 this._startSave();
18719
18720 this._saving = (this._saving || 0) + 1;
18721 this._allPreviousSaves = this._allPreviousSaves || _promise.default.resolve();
18722 this._allPreviousSaves = this._allPreviousSaves.catch(function (e) {}).then(function () {
18723 var method = model.id ? 'PUT' : 'POST';
18724
18725 var json = model._getSaveJSON();
18726
18727 var query = {};
18728
18729 if (model._fetchWhenSave || options.fetchWhenSave) {
18730 query['new'] = 'true';
18731 } // user login option
18732
18733
18734 if (options._failOnNotExist) {
18735 query.failOnNotExist = 'true';
18736 }
18737
18738 if (options.query) {
18739 var queryParams;
18740
18741 if (typeof options.query._getParams === 'function') {
18742 queryParams = options.query._getParams();
18743
18744 if (queryParams) {
18745 query.where = queryParams.where;
18746 }
18747 }
18748
18749 if (!query.where) {
18750 var error = new Error('options.query is not an AV.Query');
18751 throw error;
18752 }
18753 }
18754
18755 _.extend(json, model._flags);
18756
18757 var route = 'classes';
18758 var className = model.className;
18759
18760 if (model.className === '_User' && !model.id) {
18761 // Special-case user sign-up.
18762 route = 'users';
18763 className = null;
18764 } //hook makeRequest in options.
18765
18766
18767 var makeRequest = options._makeRequest || _request;
18768 var requestPromise = makeRequest(route, className, model.id, method, json, options, query);
18769 requestPromise = requestPromise.then(function (resp) {
18770 var serverAttrs = model.parse(resp);
18771
18772 if (options.wait) {
18773 serverAttrs = _.extend(attrs || {}, serverAttrs);
18774 }
18775
18776 model._finishSave(serverAttrs);
18777
18778 if (options.wait) {
18779 model.set(current, setOptions);
18780 }
18781
18782 return model;
18783 }, function (error) {
18784 model._cancelSave();
18785
18786 throw error;
18787 });
18788 return requestPromise;
18789 });
18790 return this._allPreviousSaves;
18791 },
18792
18793 /**
18794 * Destroy this model on the server if it was already persisted.
18795 * Optimistically removes the model from its collection, if it has one.
18796 * @param {AuthOptions} options AuthOptions plus:
18797 * @param {Boolean} [options.wait] wait for the server to respond
18798 * before removal.
18799 *
18800 * @return {Promise} A promise that is fulfilled when the destroy
18801 * completes.
18802 */
18803 destroy: function destroy(options) {
18804 options = options || {};
18805 var model = this;
18806
18807 var triggerDestroy = function triggerDestroy() {
18808 model.trigger('destroy', model, model.collection, options);
18809 };
18810
18811 if (!this.id) {
18812 return triggerDestroy();
18813 }
18814
18815 if (!options.wait) {
18816 triggerDestroy();
18817 }
18818
18819 var request = _request('classes', this.className, this.id, 'DELETE', this._flags, options);
18820
18821 return request.then(function () {
18822 if (options.wait) {
18823 triggerDestroy();
18824 }
18825
18826 return model;
18827 });
18828 },
18829
18830 /**
18831 * Converts a response into the hash of attributes to be set on the model.
18832 * @ignore
18833 */
18834 parse: function parse(resp) {
18835 var output = _.clone(resp);
18836
18837 ['createdAt', 'updatedAt'].forEach(function (key) {
18838 if (output[key]) {
18839 output[key] = AV._parseDate(output[key]);
18840 }
18841 });
18842
18843 if (output.createdAt && !output.updatedAt) {
18844 output.updatedAt = output.createdAt;
18845 }
18846
18847 return output;
18848 },
18849
18850 /**
18851 * Creates a new model with identical attributes to this one.
18852 * @return {AV.Object}
18853 */
18854 clone: function clone() {
18855 return new this.constructor(this.attributes);
18856 },
18857
18858 /**
18859 * Returns true if this object has never been saved to AV.
18860 * @return {Boolean}
18861 */
18862 isNew: function isNew() {
18863 return !this.id;
18864 },
18865
18866 /**
18867 * Call this method to manually fire a `"change"` event for this model and
18868 * a `"change:attribute"` event for each changed attribute.
18869 * Calling this will cause all objects observing the model to update.
18870 */
18871 change: function change(options) {
18872 options = options || {};
18873 var changing = this._changing;
18874 this._changing = true; // Silent changes become pending changes.
18875
18876 var self = this;
18877
18878 AV._objectEach(this._silent, function (attr) {
18879 self._pending[attr] = true;
18880 }); // Silent changes are triggered.
18881
18882
18883 var changes = _.extend({}, options.changes, this._silent);
18884
18885 this._silent = {};
18886
18887 AV._objectEach(changes, function (unused_value, attr) {
18888 self.trigger('change:' + attr, self, self.get(attr), options);
18889 });
18890
18891 if (changing) {
18892 return this;
18893 } // This is to get around lint not letting us make a function in a loop.
18894
18895
18896 var deleteChanged = function deleteChanged(value, attr) {
18897 if (!self._pending[attr] && !self._silent[attr]) {
18898 delete self.changed[attr];
18899 }
18900 }; // Continue firing `"change"` events while there are pending changes.
18901
18902
18903 while (!_.isEmpty(this._pending)) {
18904 this._pending = {};
18905 this.trigger('change', this, options); // Pending and silent changes still remain.
18906
18907 AV._objectEach(this.changed, deleteChanged);
18908
18909 self._previousAttributes = _.clone(this.attributes);
18910 }
18911
18912 this._changing = false;
18913 return this;
18914 },
18915
18916 /**
18917 * Gets the previous value of an attribute, recorded at the time the last
18918 * <code>"change"</code> event was fired.
18919 * @param {String} attr Name of the attribute to get.
18920 */
18921 previous: function previous(attr) {
18922 if (!arguments.length || !this._previousAttributes) {
18923 return null;
18924 }
18925
18926 return this._previousAttributes[attr];
18927 },
18928
18929 /**
18930 * Gets all of the attributes of the model at the time of the previous
18931 * <code>"change"</code> event.
18932 * @return {Object}
18933 */
18934 previousAttributes: function previousAttributes() {
18935 return _.clone(this._previousAttributes);
18936 },
18937
18938 /**
18939 * Checks if the model is currently in a valid state. It's only possible to
18940 * get into an *invalid* state if you're using silent changes.
18941 * @return {Boolean}
18942 */
18943 isValid: function isValid() {
18944 try {
18945 this.validate(this.attributes);
18946 } catch (error) {
18947 return false;
18948 }
18949
18950 return true;
18951 },
18952
18953 /**
18954 * You should not call this function directly unless you subclass
18955 * <code>AV.Object</code>, in which case you can override this method
18956 * to provide additional validation on <code>set</code> and
18957 * <code>save</code>. Your implementation should throw an Error if
18958 * the attrs is invalid
18959 *
18960 * @param {Object} attrs The current data to validate.
18961 * @see AV.Object#set
18962 */
18963 validate: function validate(attrs) {
18964 if (_.has(attrs, 'ACL') && !(attrs.ACL instanceof AV.ACL)) {
18965 throw new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
18966 }
18967 },
18968
18969 /**
18970 * Run validation against a set of incoming attributes, returning `true`
18971 * if all is well. If a specific `error` callback has been passed,
18972 * call that instead of firing the general `"error"` event.
18973 * @private
18974 */
18975 _validate: function _validate(attrs, options) {
18976 if (options.silent || !this.validate) {
18977 return;
18978 }
18979
18980 attrs = _.extend({}, this.attributes, attrs);
18981 this.validate(attrs);
18982 },
18983
18984 /**
18985 * Returns the ACL for this object.
18986 * @returns {AV.ACL} An instance of AV.ACL.
18987 * @see AV.Object#get
18988 */
18989 getACL: function getACL() {
18990 return this.get('ACL');
18991 },
18992
18993 /**
18994 * Sets the ACL to be used for this object.
18995 * @param {AV.ACL} acl An instance of AV.ACL.
18996 * @param {Object} options Optional Backbone-like options object to be
18997 * passed in to set.
18998 * @return {AV.Object} self
18999 * @see AV.Object#set
19000 */
19001 setACL: function setACL(acl, options) {
19002 return this.set('ACL', acl, options);
19003 },
19004 disableBeforeHook: function disableBeforeHook() {
19005 this.ignoreHook('beforeSave');
19006 this.ignoreHook('beforeUpdate');
19007 this.ignoreHook('beforeDelete');
19008 },
19009 disableAfterHook: function disableAfterHook() {
19010 this.ignoreHook('afterSave');
19011 this.ignoreHook('afterUpdate');
19012 this.ignoreHook('afterDelete');
19013 },
19014 ignoreHook: function ignoreHook(hookName) {
19015 if (!_.contains(['beforeSave', 'afterSave', 'beforeUpdate', 'afterUpdate', 'beforeDelete', 'afterDelete'], hookName)) {
19016 throw new Error('Unsupported hookName: ' + hookName);
19017 }
19018
19019 if (!AV.hookKey) {
19020 throw new Error('ignoreHook required hookKey');
19021 }
19022
19023 if (!this._flags.__ignore_hooks) {
19024 this._flags.__ignore_hooks = [];
19025 }
19026
19027 this._flags.__ignore_hooks.push(hookName);
19028 }
19029 });
19030 /**
19031 * Creates an instance of a subclass of AV.Object for the give classname
19032 * and id.
19033 * @param {String|Function} class the className or a subclass of AV.Object.
19034 * @param {String} id The object id of this model.
19035 * @return {AV.Object} A new subclass instance of AV.Object.
19036 */
19037
19038
19039 AV.Object.createWithoutData = function (klass, id, hasData) {
19040 var _klass;
19041
19042 if (_.isString(klass)) {
19043 _klass = AV.Object._getSubclass(klass);
19044 } else if (klass.prototype && klass.prototype instanceof AV.Object) {
19045 _klass = klass;
19046 } else {
19047 throw new Error('class must be a string or a subclass of AV.Object.');
19048 }
19049
19050 if (!id) {
19051 throw new TypeError('The objectId must be provided');
19052 }
19053
19054 var object = new _klass();
19055 object.id = id;
19056 object._hasData = hasData;
19057 return object;
19058 };
19059 /**
19060 * Delete objects in batch.
19061 * @param {AV.Object[]} objects The <code>AV.Object</code> array to be deleted.
19062 * @param {AuthOptions} options
19063 * @return {Promise} A promise that is fulfilled when the save
19064 * completes.
19065 */
19066
19067
19068 AV.Object.destroyAll = function (objects) {
19069 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19070
19071 if (!objects || objects.length === 0) {
19072 return _promise.default.resolve();
19073 }
19074
19075 var objectsByClassNameAndFlags = _.groupBy(objects, function (object) {
19076 return (0, _stringify.default)({
19077 className: object.className,
19078 flags: object._flags
19079 });
19080 });
19081
19082 var body = {
19083 requests: (0, _map.default)(_).call(_, objectsByClassNameAndFlags, function (objects) {
19084 var _context3;
19085
19086 var ids = (0, _map.default)(_).call(_, objects, 'id').join(',');
19087 return {
19088 method: 'DELETE',
19089 path: (0, _concat.default)(_context3 = "/1.1/classes/".concat(objects[0].className, "/")).call(_context3, ids),
19090 body: objects[0]._flags
19091 };
19092 })
19093 };
19094 return _request('batch', null, null, 'POST', body, options).then(function (response) {
19095 var firstError = (0, _find.default)(_).call(_, response, function (result) {
19096 return !result.success;
19097 });
19098 if (firstError) throw new AVError(firstError.error.code, firstError.error.error);
19099 return undefined;
19100 });
19101 };
19102 /**
19103 * Returns the appropriate subclass for making new instances of the given
19104 * className string.
19105 * @private
19106 */
19107
19108
19109 AV.Object._getSubclass = function (className) {
19110 if (!_.isString(className)) {
19111 throw new Error('AV.Object._getSubclass requires a string argument.');
19112 }
19113
19114 var ObjectClass = AV.Object._classMap[className];
19115
19116 if (!ObjectClass) {
19117 ObjectClass = AV.Object.extend(className);
19118 AV.Object._classMap[className] = ObjectClass;
19119 }
19120
19121 return ObjectClass;
19122 };
19123 /**
19124 * Creates an instance of a subclass of AV.Object for the given classname.
19125 * @private
19126 */
19127
19128
19129 AV.Object._create = function (className, attributes, options) {
19130 var ObjectClass = AV.Object._getSubclass(className);
19131
19132 return new ObjectClass(attributes, options);
19133 }; // Set up a map of className to class so that we can create new instances of
19134 // AV Objects from JSON automatically.
19135
19136
19137 AV.Object._classMap = {};
19138 AV.Object._extend = AV._extend;
19139 /**
19140 * Creates a new model with defined attributes,
19141 * It's the same with
19142 * <pre>
19143 * new AV.Object(attributes, options);
19144 * </pre>
19145 * @param {Object} attributes The initial set of data to store in the object.
19146 * @param {Object} options A set of Backbone-like options for creating the
19147 * object. The only option currently supported is "collection".
19148 * @return {AV.Object}
19149 * @since v0.4.4
19150 * @see AV.Object
19151 * @see AV.Object.extend
19152 */
19153
19154 AV.Object['new'] = function (attributes, options) {
19155 return new AV.Object(attributes, options);
19156 };
19157 /**
19158 * Creates a new subclass of AV.Object for the given AV class name.
19159 *
19160 * <p>Every extension of a AV class will inherit from the most recent
19161 * previous extension of that class. When a AV.Object is automatically
19162 * created by parsing JSON, it will use the most recent extension of that
19163 * class.</p>
19164 *
19165 * @example
19166 * var MyClass = AV.Object.extend("MyClass", {
19167 * // Instance properties
19168 * }, {
19169 * // Class properties
19170 * });
19171 *
19172 * @param {String} className The name of the AV class backing this model.
19173 * @param {Object} protoProps Instance properties to add to instances of the
19174 * class returned from this method.
19175 * @param {Object} classProps Class properties to add the class returned from
19176 * this method.
19177 * @return {Class} A new subclass of AV.Object.
19178 */
19179
19180
19181 AV.Object.extend = function (className, protoProps, classProps) {
19182 // Handle the case with only two args.
19183 if (!_.isString(className)) {
19184 if (className && _.has(className, 'className')) {
19185 return AV.Object.extend(className.className, className, protoProps);
19186 } else {
19187 throw new Error("AV.Object.extend's first argument should be the className.");
19188 }
19189 } // If someone tries to subclass "User", coerce it to the right type.
19190
19191
19192 if (className === 'User') {
19193 className = '_User';
19194 }
19195
19196 var NewClassObject = null;
19197
19198 if (_.has(AV.Object._classMap, className)) {
19199 var OldClassObject = AV.Object._classMap[className]; // This new subclass has been told to extend both from "this" and from
19200 // OldClassObject. This is multiple inheritance, which isn't supported.
19201 // For now, let's just pick one.
19202
19203 if (protoProps || classProps) {
19204 NewClassObject = OldClassObject._extend(protoProps, classProps);
19205 } else {
19206 return OldClassObject;
19207 }
19208 } else {
19209 protoProps = protoProps || {};
19210 protoProps._className = className;
19211 NewClassObject = this._extend(protoProps, classProps);
19212 } // Extending a subclass should reuse the classname automatically.
19213
19214
19215 NewClassObject.extend = function (arg0) {
19216 var _context4;
19217
19218 if (_.isString(arg0) || arg0 && _.has(arg0, 'className')) {
19219 return AV.Object.extend.apply(NewClassObject, arguments);
19220 }
19221
19222 var newArguments = (0, _concat.default)(_context4 = [className]).call(_context4, _.toArray(arguments));
19223 return AV.Object.extend.apply(NewClassObject, newArguments);
19224 }; // Add the query property descriptor.
19225
19226
19227 (0, _defineProperty.default)(NewClassObject, 'query', (0, _getOwnPropertyDescriptor.default)(AV.Object, 'query'));
19228
19229 NewClassObject['new'] = function (attributes, options) {
19230 return new NewClassObject(attributes, options);
19231 };
19232
19233 AV.Object._classMap[className] = NewClassObject;
19234 return NewClassObject;
19235 }; // ES6 class syntax support
19236
19237
19238 (0, _defineProperty.default)(AV.Object.prototype, 'className', {
19239 get: function get() {
19240 var className = this._className || this.constructor._LCClassName || this.constructor.name; // If someone tries to subclass "User", coerce it to the right type.
19241
19242 if (className === 'User') {
19243 return '_User';
19244 }
19245
19246 return className;
19247 }
19248 });
19249 /**
19250 * Register a class.
19251 * If a subclass of <code>AV.Object</code> is defined with your own implement
19252 * rather then <code>AV.Object.extend</code>, the subclass must be registered.
19253 * @param {Function} klass A subclass of <code>AV.Object</code>
19254 * @param {String} [name] Specify the name of the class. Useful when the class might be uglified.
19255 * @example
19256 * class Person extend AV.Object {}
19257 * AV.Object.register(Person);
19258 */
19259
19260 AV.Object.register = function (klass, name) {
19261 if (!(klass.prototype instanceof AV.Object)) {
19262 throw new Error('registered class is not a subclass of AV.Object');
19263 }
19264
19265 var className = name || klass.name;
19266
19267 if (!className.length) {
19268 throw new Error('registered class must be named');
19269 }
19270
19271 if (name) {
19272 klass._LCClassName = name;
19273 }
19274
19275 AV.Object._classMap[className] = klass;
19276 };
19277 /**
19278 * Get a new Query of the current class
19279 * @name query
19280 * @memberof AV.Object
19281 * @type AV.Query
19282 * @readonly
19283 * @since v3.1.0
19284 * @example
19285 * const Post = AV.Object.extend('Post');
19286 * Post.query.equalTo('author', 'leancloud').find().then();
19287 */
19288
19289
19290 (0, _defineProperty.default)(AV.Object, 'query', {
19291 get: function get() {
19292 return new AV.Query(this.prototype.className);
19293 }
19294 });
19295
19296 AV.Object._findUnsavedChildren = function (objects, children, files) {
19297 AV._traverse(objects, function (object) {
19298 if (object instanceof AV.Object) {
19299 if (object.dirty()) {
19300 children.push(object);
19301 }
19302
19303 return;
19304 }
19305
19306 if (object instanceof AV.File) {
19307 if (!object.id) {
19308 files.push(object);
19309 }
19310
19311 return;
19312 }
19313 });
19314 };
19315
19316 AV.Object._canBeSerializedAsValue = function (object) {
19317 var canBeSerializedAsValue = true;
19318
19319 if (object instanceof AV.Object || object instanceof AV.File) {
19320 canBeSerializedAsValue = !!object.id;
19321 } else if (_.isArray(object)) {
19322 AV._arrayEach(object, function (child) {
19323 if (!AV.Object._canBeSerializedAsValue(child)) {
19324 canBeSerializedAsValue = false;
19325 }
19326 });
19327 } else if (_.isObject(object)) {
19328 AV._objectEach(object, function (child) {
19329 if (!AV.Object._canBeSerializedAsValue(child)) {
19330 canBeSerializedAsValue = false;
19331 }
19332 });
19333 }
19334
19335 return canBeSerializedAsValue;
19336 };
19337
19338 AV.Object._deepSaveAsync = function (object, model, options) {
19339 var unsavedChildren = [];
19340 var unsavedFiles = [];
19341
19342 AV.Object._findUnsavedChildren(object, unsavedChildren, unsavedFiles);
19343
19344 unsavedFiles = _.uniq(unsavedFiles);
19345
19346 var promise = _promise.default.resolve();
19347
19348 _.each(unsavedFiles, function (file) {
19349 promise = promise.then(function () {
19350 return file.save();
19351 });
19352 });
19353
19354 var objects = _.uniq(unsavedChildren);
19355
19356 var remaining = _.uniq(objects);
19357
19358 return promise.then(function () {
19359 return continueWhile(function () {
19360 return remaining.length > 0;
19361 }, function () {
19362 // Gather up all the objects that can be saved in this batch.
19363 var batch = [];
19364 var newRemaining = [];
19365
19366 AV._arrayEach(remaining, function (object) {
19367 if (object._canBeSerialized()) {
19368 batch.push(object);
19369 } else {
19370 newRemaining.push(object);
19371 }
19372 });
19373
19374 remaining = newRemaining; // If we can't save any objects, there must be a circular reference.
19375
19376 if (batch.length === 0) {
19377 return _promise.default.reject(new AVError(AVError.OTHER_CAUSE, 'Tried to save a batch with a cycle.'));
19378 } // Reserve a spot in every object's save queue.
19379
19380
19381 var readyToStart = _promise.default.resolve((0, _map.default)(_).call(_, batch, function (object) {
19382 return object._allPreviousSaves || _promise.default.resolve();
19383 })); // Save a single batch, whether previous saves succeeded or failed.
19384
19385
19386 var bathSavePromise = readyToStart.then(function () {
19387 return _request('batch', null, null, 'POST', {
19388 requests: (0, _map.default)(_).call(_, batch, function (object) {
19389 var method = object.id ? 'PUT' : 'POST';
19390
19391 var json = object._getSaveJSON();
19392
19393 _.extend(json, object._flags);
19394
19395 var route = 'classes';
19396 var className = object.className;
19397 var path = "/".concat(route, "/").concat(className);
19398
19399 if (object.className === '_User' && !object.id) {
19400 // Special-case user sign-up.
19401 path = '/users';
19402 }
19403
19404 var path = "/1.1".concat(path);
19405
19406 if (object.id) {
19407 path = path + '/' + object.id;
19408 }
19409
19410 object._startSave();
19411
19412 return {
19413 method: method,
19414 path: path,
19415 body: json,
19416 params: options && options.fetchWhenSave ? {
19417 fetchWhenSave: true
19418 } : undefined
19419 };
19420 })
19421 }, options).then(function (response) {
19422 var results = (0, _map.default)(_).call(_, batch, function (object, i) {
19423 if (response[i].success) {
19424 object._finishSave(object.parse(response[i].success));
19425
19426 return object;
19427 }
19428
19429 object._cancelSave();
19430
19431 return new AVError(response[i].error.code, response[i].error.error);
19432 });
19433 return handleBatchResults(results);
19434 });
19435 });
19436
19437 AV._arrayEach(batch, function (object) {
19438 object._allPreviousSaves = bathSavePromise;
19439 });
19440
19441 return bathSavePromise;
19442 });
19443 }).then(function () {
19444 return object;
19445 });
19446 };
19447};
19448
19449/***/ }),
19450/* 527 */
19451/***/ (function(module, exports, __webpack_require__) {
19452
19453var arrayWithHoles = __webpack_require__(528);
19454
19455var iterableToArrayLimit = __webpack_require__(536);
19456
19457var unsupportedIterableToArray = __webpack_require__(537);
19458
19459var nonIterableRest = __webpack_require__(547);
19460
19461function _slicedToArray(arr, i) {
19462 return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
19463}
19464
19465module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
19466
19467/***/ }),
19468/* 528 */
19469/***/ (function(module, exports, __webpack_require__) {
19470
19471var _Array$isArray = __webpack_require__(529);
19472
19473function _arrayWithHoles(arr) {
19474 if (_Array$isArray(arr)) return arr;
19475}
19476
19477module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
19478
19479/***/ }),
19480/* 529 */
19481/***/ (function(module, exports, __webpack_require__) {
19482
19483module.exports = __webpack_require__(530);
19484
19485/***/ }),
19486/* 530 */
19487/***/ (function(module, exports, __webpack_require__) {
19488
19489module.exports = __webpack_require__(531);
19490
19491
19492/***/ }),
19493/* 531 */
19494/***/ (function(module, exports, __webpack_require__) {
19495
19496var parent = __webpack_require__(532);
19497
19498module.exports = parent;
19499
19500
19501/***/ }),
19502/* 532 */
19503/***/ (function(module, exports, __webpack_require__) {
19504
19505var parent = __webpack_require__(533);
19506
19507module.exports = parent;
19508
19509
19510/***/ }),
19511/* 533 */
19512/***/ (function(module, exports, __webpack_require__) {
19513
19514var parent = __webpack_require__(534);
19515
19516module.exports = parent;
19517
19518
19519/***/ }),
19520/* 534 */
19521/***/ (function(module, exports, __webpack_require__) {
19522
19523__webpack_require__(535);
19524var path = __webpack_require__(6);
19525
19526module.exports = path.Array.isArray;
19527
19528
19529/***/ }),
19530/* 535 */
19531/***/ (function(module, exports, __webpack_require__) {
19532
19533var $ = __webpack_require__(0);
19534var isArray = __webpack_require__(88);
19535
19536// `Array.isArray` method
19537// https://tc39.es/ecma262/#sec-array.isarray
19538$({ target: 'Array', stat: true }, {
19539 isArray: isArray
19540});
19541
19542
19543/***/ }),
19544/* 536 */
19545/***/ (function(module, exports, __webpack_require__) {
19546
19547var _Symbol = __webpack_require__(236);
19548
19549var _getIteratorMethod = __webpack_require__(248);
19550
19551function _iterableToArrayLimit(arr, i) {
19552 var _i = arr == null ? null : typeof _Symbol !== "undefined" && _getIteratorMethod(arr) || arr["@@iterator"];
19553
19554 if (_i == null) return;
19555 var _arr = [];
19556 var _n = true;
19557 var _d = false;
19558
19559 var _s, _e;
19560
19561 try {
19562 for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
19563 _arr.push(_s.value);
19564
19565 if (i && _arr.length === i) break;
19566 }
19567 } catch (err) {
19568 _d = true;
19569 _e = err;
19570 } finally {
19571 try {
19572 if (!_n && _i["return"] != null) _i["return"]();
19573 } finally {
19574 if (_d) throw _e;
19575 }
19576 }
19577
19578 return _arr;
19579}
19580
19581module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
19582
19583/***/ }),
19584/* 537 */
19585/***/ (function(module, exports, __webpack_require__) {
19586
19587var _sliceInstanceProperty = __webpack_require__(538);
19588
19589var _Array$from = __webpack_require__(542);
19590
19591var arrayLikeToArray = __webpack_require__(546);
19592
19593function _unsupportedIterableToArray(o, minLen) {
19594 var _context;
19595
19596 if (!o) return;
19597 if (typeof o === "string") return arrayLikeToArray(o, minLen);
19598
19599 var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 8, -1);
19600
19601 if (n === "Object" && o.constructor) n = o.constructor.name;
19602 if (n === "Map" || n === "Set") return _Array$from(o);
19603 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
19604}
19605
19606module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
19607
19608/***/ }),
19609/* 538 */
19610/***/ (function(module, exports, __webpack_require__) {
19611
19612module.exports = __webpack_require__(539);
19613
19614/***/ }),
19615/* 539 */
19616/***/ (function(module, exports, __webpack_require__) {
19617
19618module.exports = __webpack_require__(540);
19619
19620
19621/***/ }),
19622/* 540 */
19623/***/ (function(module, exports, __webpack_require__) {
19624
19625var parent = __webpack_require__(541);
19626
19627module.exports = parent;
19628
19629
19630/***/ }),
19631/* 541 */
19632/***/ (function(module, exports, __webpack_require__) {
19633
19634var parent = __webpack_require__(234);
19635
19636module.exports = parent;
19637
19638
19639/***/ }),
19640/* 542 */
19641/***/ (function(module, exports, __webpack_require__) {
19642
19643module.exports = __webpack_require__(543);
19644
19645/***/ }),
19646/* 543 */
19647/***/ (function(module, exports, __webpack_require__) {
19648
19649module.exports = __webpack_require__(544);
19650
19651
19652/***/ }),
19653/* 544 */
19654/***/ (function(module, exports, __webpack_require__) {
19655
19656var parent = __webpack_require__(545);
19657
19658module.exports = parent;
19659
19660
19661/***/ }),
19662/* 545 */
19663/***/ (function(module, exports, __webpack_require__) {
19664
19665var parent = __webpack_require__(246);
19666
19667module.exports = parent;
19668
19669
19670/***/ }),
19671/* 546 */
19672/***/ (function(module, exports) {
19673
19674function _arrayLikeToArray(arr, len) {
19675 if (len == null || len > arr.length) len = arr.length;
19676
19677 for (var i = 0, arr2 = new Array(len); i < len; i++) {
19678 arr2[i] = arr[i];
19679 }
19680
19681 return arr2;
19682}
19683
19684module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
19685
19686/***/ }),
19687/* 547 */
19688/***/ (function(module, exports) {
19689
19690function _nonIterableRest() {
19691 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
19692}
19693
19694module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
19695
19696/***/ }),
19697/* 548 */
19698/***/ (function(module, exports, __webpack_require__) {
19699
19700var parent = __webpack_require__(549);
19701
19702module.exports = parent;
19703
19704
19705/***/ }),
19706/* 549 */
19707/***/ (function(module, exports, __webpack_require__) {
19708
19709__webpack_require__(550);
19710var path = __webpack_require__(6);
19711
19712var Object = path.Object;
19713
19714var getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) {
19715 return Object.getOwnPropertyDescriptor(it, key);
19716};
19717
19718if (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true;
19719
19720
19721/***/ }),
19722/* 550 */
19723/***/ (function(module, exports, __webpack_require__) {
19724
19725var $ = __webpack_require__(0);
19726var fails = __webpack_require__(2);
19727var toIndexedObject = __webpack_require__(32);
19728var nativeGetOwnPropertyDescriptor = __webpack_require__(60).f;
19729var DESCRIPTORS = __webpack_require__(14);
19730
19731var FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); });
19732var FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES;
19733
19734// `Object.getOwnPropertyDescriptor` method
19735// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
19736$({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, {
19737 getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
19738 return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key);
19739 }
19740});
19741
19742
19743/***/ }),
19744/* 551 */
19745/***/ (function(module, exports, __webpack_require__) {
19746
19747"use strict";
19748
19749
19750var _ = __webpack_require__(3);
19751
19752var AVError = __webpack_require__(46);
19753
19754module.exports = function (AV) {
19755 AV.Role = AV.Object.extend('_Role',
19756 /** @lends AV.Role.prototype */
19757 {
19758 // Instance Methods
19759
19760 /**
19761 * Represents a Role on the AV server. Roles represent groupings of
19762 * Users for the purposes of granting permissions (e.g. specifying an ACL
19763 * for an Object). Roles are specified by their sets of child users and
19764 * child roles, all of which are granted any permissions that the parent
19765 * role has.
19766 *
19767 * <p>Roles must have a name (which cannot be changed after creation of the
19768 * role), and must specify an ACL.</p>
19769 * An AV.Role is a local representation of a role persisted to the AV
19770 * cloud.
19771 * @class AV.Role
19772 * @param {String} name The name of the Role to create.
19773 * @param {AV.ACL} acl The ACL for this role.
19774 */
19775 constructor: function constructor(name, acl) {
19776 if (_.isString(name)) {
19777 AV.Object.prototype.constructor.call(this, null, null);
19778 this.setName(name);
19779 } else {
19780 AV.Object.prototype.constructor.call(this, name, acl);
19781 }
19782
19783 if (acl) {
19784 if (!(acl instanceof AV.ACL)) {
19785 throw new TypeError('acl must be an instance of AV.ACL');
19786 } else {
19787 this.setACL(acl);
19788 }
19789 }
19790 },
19791
19792 /**
19793 * Gets the name of the role. You can alternatively call role.get("name")
19794 *
19795 * @return {String} the name of the role.
19796 */
19797 getName: function getName() {
19798 return this.get('name');
19799 },
19800
19801 /**
19802 * Sets the name for a role. This value must be set before the role has
19803 * been saved to the server, and cannot be set once the role has been
19804 * saved.
19805 *
19806 * <p>
19807 * A role's name can only contain alphanumeric characters, _, -, and
19808 * spaces.
19809 * </p>
19810 *
19811 * <p>This is equivalent to calling role.set("name", name)</p>
19812 *
19813 * @param {String} name The name of the role.
19814 */
19815 setName: function setName(name, options) {
19816 return this.set('name', name, options);
19817 },
19818
19819 /**
19820 * Gets the AV.Relation for the AV.Users that are direct
19821 * children of this role. These users are granted any privileges that this
19822 * role has been granted (e.g. read or write access through ACLs). You can
19823 * add or remove users from the role through this relation.
19824 *
19825 * <p>This is equivalent to calling role.relation("users")</p>
19826 *
19827 * @return {AV.Relation} the relation for the users belonging to this
19828 * role.
19829 */
19830 getUsers: function getUsers() {
19831 return this.relation('users');
19832 },
19833
19834 /**
19835 * Gets the AV.Relation for the AV.Roles that are direct
19836 * children of this role. These roles' users are granted any privileges that
19837 * this role has been granted (e.g. read or write access through ACLs). You
19838 * can add or remove child roles from this role through this relation.
19839 *
19840 * <p>This is equivalent to calling role.relation("roles")</p>
19841 *
19842 * @return {AV.Relation} the relation for the roles belonging to this
19843 * role.
19844 */
19845 getRoles: function getRoles() {
19846 return this.relation('roles');
19847 },
19848
19849 /**
19850 * @ignore
19851 */
19852 validate: function validate(attrs, options) {
19853 if ('name' in attrs && attrs.name !== this.getName()) {
19854 var newName = attrs.name;
19855
19856 if (this.id && this.id !== attrs.objectId) {
19857 // Check to see if the objectId being set matches this.id.
19858 // This happens during a fetch -- the id is set before calling fetch.
19859 // Let the name be set in this case.
19860 return new AVError(AVError.OTHER_CAUSE, "A role's name can only be set before it has been saved.");
19861 }
19862
19863 if (!_.isString(newName)) {
19864 return new AVError(AVError.OTHER_CAUSE, "A role's name must be a String.");
19865 }
19866
19867 if (!/^[0-9a-zA-Z\-_ ]+$/.test(newName)) {
19868 return new AVError(AVError.OTHER_CAUSE, "A role's name can only contain alphanumeric characters, _," + ' -, and spaces.');
19869 }
19870 }
19871
19872 if (AV.Object.prototype.validate) {
19873 return AV.Object.prototype.validate.call(this, attrs, options);
19874 }
19875
19876 return false;
19877 }
19878 });
19879};
19880
19881/***/ }),
19882/* 552 */
19883/***/ (function(module, exports, __webpack_require__) {
19884
19885"use strict";
19886
19887
19888var _interopRequireDefault = __webpack_require__(1);
19889
19890var _defineProperty2 = _interopRequireDefault(__webpack_require__(553));
19891
19892var _promise = _interopRequireDefault(__webpack_require__(13));
19893
19894var _map = _interopRequireDefault(__webpack_require__(35));
19895
19896var _find = _interopRequireDefault(__webpack_require__(92));
19897
19898var _stringify = _interopRequireDefault(__webpack_require__(36));
19899
19900var _ = __webpack_require__(3);
19901
19902var uuid = __webpack_require__(226);
19903
19904var AVError = __webpack_require__(46);
19905
19906var _require = __webpack_require__(27),
19907 AVRequest = _require._request,
19908 request = _require.request;
19909
19910var _require2 = __webpack_require__(71),
19911 getAdapter = _require2.getAdapter;
19912
19913var PLATFORM_ANONYMOUS = 'anonymous';
19914var PLATFORM_QQAPP = 'lc_qqapp';
19915
19916var mergeUnionDataIntoAuthData = function mergeUnionDataIntoAuthData() {
19917 var defaultUnionIdPlatform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'weixin';
19918 return function (authData, unionId) {
19919 var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
19920 _ref$unionIdPlatform = _ref.unionIdPlatform,
19921 unionIdPlatform = _ref$unionIdPlatform === void 0 ? defaultUnionIdPlatform : _ref$unionIdPlatform,
19922 _ref$asMainAccount = _ref.asMainAccount,
19923 asMainAccount = _ref$asMainAccount === void 0 ? false : _ref$asMainAccount;
19924
19925 if (typeof unionId !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionId is not a string');
19926 if (typeof unionIdPlatform !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionIdPlatform is not a string');
19927 return _.extend({}, authData, {
19928 platform: unionIdPlatform,
19929 unionid: unionId,
19930 main_account: Boolean(asMainAccount)
19931 });
19932 };
19933};
19934
19935module.exports = function (AV) {
19936 /**
19937 * @class
19938 *
19939 * <p>An AV.User object is a local representation of a user persisted to the
19940 * LeanCloud server. This class is a subclass of an AV.Object, and retains the
19941 * same functionality of an AV.Object, but also extends it with various
19942 * user specific methods, like authentication, signing up, and validation of
19943 * uniqueness.</p>
19944 */
19945 AV.User = AV.Object.extend('_User',
19946 /** @lends AV.User.prototype */
19947 {
19948 // Instance Variables
19949 _isCurrentUser: false,
19950 // Instance Methods
19951
19952 /**
19953 * Internal method to handle special fields in a _User response.
19954 * @private
19955 */
19956 _mergeMagicFields: function _mergeMagicFields(attrs) {
19957 if (attrs.sessionToken) {
19958 this._sessionToken = attrs.sessionToken;
19959 delete attrs.sessionToken;
19960 }
19961
19962 return AV.User.__super__._mergeMagicFields.call(this, attrs);
19963 },
19964
19965 /**
19966 * Removes null values from authData (which exist temporarily for
19967 * unlinking)
19968 * @private
19969 */
19970 _cleanupAuthData: function _cleanupAuthData() {
19971 if (!this.isCurrent()) {
19972 return;
19973 }
19974
19975 var authData = this.get('authData');
19976
19977 if (!authData) {
19978 return;
19979 }
19980
19981 AV._objectEach(this.get('authData'), function (value, key) {
19982 if (!authData[key]) {
19983 delete authData[key];
19984 }
19985 });
19986 },
19987
19988 /**
19989 * Synchronizes authData for all providers.
19990 * @private
19991 */
19992 _synchronizeAllAuthData: function _synchronizeAllAuthData() {
19993 var authData = this.get('authData');
19994
19995 if (!authData) {
19996 return;
19997 }
19998
19999 var self = this;
20000
20001 AV._objectEach(this.get('authData'), function (value, key) {
20002 self._synchronizeAuthData(key);
20003 });
20004 },
20005
20006 /**
20007 * Synchronizes auth data for a provider (e.g. puts the access token in the
20008 * right place to be used by the Facebook SDK).
20009 * @private
20010 */
20011 _synchronizeAuthData: function _synchronizeAuthData(provider) {
20012 if (!this.isCurrent()) {
20013 return;
20014 }
20015
20016 var authType;
20017
20018 if (_.isString(provider)) {
20019 authType = provider;
20020 provider = AV.User._authProviders[authType];
20021 } else {
20022 authType = provider.getAuthType();
20023 }
20024
20025 var authData = this.get('authData');
20026
20027 if (!authData || !provider) {
20028 return;
20029 }
20030
20031 var success = provider.restoreAuthentication(authData[authType]);
20032
20033 if (!success) {
20034 this.dissociateAuthData(provider);
20035 }
20036 },
20037 _handleSaveResult: function _handleSaveResult(makeCurrent) {
20038 // Clean up and synchronize the authData object, removing any unset values
20039 if (makeCurrent && !AV._config.disableCurrentUser) {
20040 this._isCurrentUser = true;
20041 }
20042
20043 this._cleanupAuthData();
20044
20045 this._synchronizeAllAuthData(); // Don't keep the password around.
20046
20047
20048 delete this._serverData.password;
20049
20050 this._rebuildEstimatedDataForKey('password');
20051
20052 this._refreshCache();
20053
20054 if ((makeCurrent || this.isCurrent()) && !AV._config.disableCurrentUser) {
20055 // Some old version of leanengine-node-sdk will overwrite
20056 // AV.User._saveCurrentUser which returns no Promise.
20057 // So we need a Promise wrapper.
20058 return _promise.default.resolve(AV.User._saveCurrentUser(this));
20059 } else {
20060 return _promise.default.resolve();
20061 }
20062 },
20063
20064 /**
20065 * Unlike in the Android/iOS SDKs, logInWith is unnecessary, since you can
20066 * call linkWith on the user (even if it doesn't exist yet on the server).
20067 * @private
20068 */
20069 _linkWith: function _linkWith(provider, data) {
20070 var _this = this;
20071
20072 var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
20073 _ref2$failOnNotExist = _ref2.failOnNotExist,
20074 failOnNotExist = _ref2$failOnNotExist === void 0 ? false : _ref2$failOnNotExist;
20075
20076 var authType;
20077
20078 if (_.isString(provider)) {
20079 authType = provider;
20080 provider = AV.User._authProviders[provider];
20081 } else {
20082 authType = provider.getAuthType();
20083 }
20084
20085 if (data) {
20086 return this.save({
20087 authData: (0, _defineProperty2.default)({}, authType, data)
20088 }, {
20089 fetchWhenSave: !!this.get('authData'),
20090 _failOnNotExist: failOnNotExist
20091 }).then(function (model) {
20092 return model._handleSaveResult(true).then(function () {
20093 return model;
20094 });
20095 });
20096 } else {
20097 return provider.authenticate().then(function (result) {
20098 return _this._linkWith(provider, result);
20099 });
20100 }
20101 },
20102
20103 /**
20104 * Associate the user with a third party authData.
20105 * @since 3.3.0
20106 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
20107 * @param {string} platform Available platform for sign up.
20108 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
20109 * @example user.associateWithAuthData({
20110 * openid: 'abc123',
20111 * access_token: '123abc',
20112 * expires_in: 1382686496
20113 * }, 'weixin').then(function(user) {
20114 * //Access user here
20115 * }).catch(function(error) {
20116 * //console.error("error: ", error);
20117 * });
20118 */
20119 associateWithAuthData: function associateWithAuthData(authData, platform) {
20120 return this._linkWith(platform, authData);
20121 },
20122
20123 /**
20124 * Associate the user with a third party authData and unionId.
20125 * @since 3.5.0
20126 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
20127 * @param {string} platform Available platform for sign up.
20128 * @param {string} unionId
20129 * @param {Object} [unionLoginOptions]
20130 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
20131 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
20132 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
20133 * @example user.associateWithAuthDataAndUnionId({
20134 * openid: 'abc123',
20135 * access_token: '123abc',
20136 * expires_in: 1382686496
20137 * }, 'weixin', 'union123', {
20138 * unionIdPlatform: 'weixin',
20139 * asMainAccount: true,
20140 * }).then(function(user) {
20141 * //Access user here
20142 * }).catch(function(error) {
20143 * //console.error("error: ", error);
20144 * });
20145 */
20146 associateWithAuthDataAndUnionId: function associateWithAuthDataAndUnionId(authData, platform, unionId, unionOptions) {
20147 return this._linkWith(platform, mergeUnionDataIntoAuthData()(authData, unionId, unionOptions));
20148 },
20149
20150 /**
20151 * Associate the user with the identity of the current mini-app.
20152 * @since 4.6.0
20153 * @param {Object} [authInfo]
20154 * @param {Object} [option]
20155 * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
20156 * @return {Promise<AV.User>}
20157 */
20158 associateWithMiniApp: function associateWithMiniApp(authInfo, option) {
20159 var _this2 = this;
20160
20161 if (authInfo === undefined) {
20162 var getAuthInfo = getAdapter('getAuthInfo');
20163 return getAuthInfo().then(function (authInfo) {
20164 return _this2._linkWith(authInfo.provider, authInfo.authData, option);
20165 });
20166 }
20167
20168 return this._linkWith(authInfo.provider, authInfo.authData, option);
20169 },
20170
20171 /**
20172 * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的微信帐号。
20173 * 仅在 QQ 小程序中可用。
20174 *
20175 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20176 * @since 4.2.0
20177 * @param {Object} [options]
20178 * @param {boolean} [options.preferUnionId = false] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
20179 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
20180 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20181 * @return {Promise<AV.User>}
20182 */
20183 associateWithQQApp: function associateWithQQApp() {
20184 var _this3 = this;
20185
20186 var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20187 _ref3$preferUnionId = _ref3.preferUnionId,
20188 preferUnionId = _ref3$preferUnionId === void 0 ? false : _ref3$preferUnionId,
20189 _ref3$unionIdPlatform = _ref3.unionIdPlatform,
20190 unionIdPlatform = _ref3$unionIdPlatform === void 0 ? 'qq' : _ref3$unionIdPlatform,
20191 _ref3$asMainAccount = _ref3.asMainAccount,
20192 asMainAccount = _ref3$asMainAccount === void 0 ? true : _ref3$asMainAccount;
20193
20194 var getAuthInfo = getAdapter('getAuthInfo');
20195 return getAuthInfo({
20196 preferUnionId: preferUnionId,
20197 asMainAccount: asMainAccount,
20198 platform: unionIdPlatform
20199 }).then(function (authInfo) {
20200 authInfo.provider = PLATFORM_QQAPP;
20201 return _this3.associateWithMiniApp(authInfo);
20202 });
20203 },
20204
20205 /**
20206 * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
20207 * 仅在微信小程序中可用。
20208 *
20209 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20210 * @since 3.13.0
20211 * @param {Object} [options]
20212 * @param {boolean} [options.preferUnionId = false] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否将 UnionId 保存在用户账号中。
20213 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
20214 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20215 * @return {Promise<AV.User>}
20216 */
20217 associateWithWeapp: function associateWithWeapp() {
20218 var _this4 = this;
20219
20220 var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20221 _ref4$preferUnionId = _ref4.preferUnionId,
20222 preferUnionId = _ref4$preferUnionId === void 0 ? false : _ref4$preferUnionId,
20223 _ref4$unionIdPlatform = _ref4.unionIdPlatform,
20224 unionIdPlatform = _ref4$unionIdPlatform === void 0 ? 'weixin' : _ref4$unionIdPlatform,
20225 _ref4$asMainAccount = _ref4.asMainAccount,
20226 asMainAccount = _ref4$asMainAccount === void 0 ? true : _ref4$asMainAccount;
20227
20228 var getAuthInfo = getAdapter('getAuthInfo');
20229 return getAuthInfo({
20230 preferUnionId: preferUnionId,
20231 asMainAccount: asMainAccount,
20232 platform: unionIdPlatform
20233 }).then(function (authInfo) {
20234 return _this4.associateWithMiniApp(authInfo);
20235 });
20236 },
20237
20238 /**
20239 * @deprecated renamed to {@link AV.User#associateWithWeapp}
20240 * @return {Promise<AV.User>}
20241 */
20242 linkWithWeapp: function linkWithWeapp(options) {
20243 console.warn('DEPRECATED: User#linkWithWeapp 已废弃,请使用 User#associateWithWeapp 代替');
20244 return this.associateWithWeapp(options);
20245 },
20246
20247 /**
20248 * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的 QQ 帐号。
20249 * 仅在 QQ 小程序中可用。
20250 *
20251 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20252 * @since 4.2.0
20253 * @param {string} unionId
20254 * @param {Object} [unionOptions]
20255 * @param {string} [unionOptions.unionIdPlatform = 'qq'] unionId platform
20256 * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
20257 * @return {Promise<AV.User>}
20258 */
20259 associateWithQQAppWithUnionId: function associateWithQQAppWithUnionId(unionId) {
20260 var _this5 = this;
20261
20262 var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20263 _ref5$unionIdPlatform = _ref5.unionIdPlatform,
20264 unionIdPlatform = _ref5$unionIdPlatform === void 0 ? 'qq' : _ref5$unionIdPlatform,
20265 _ref5$asMainAccount = _ref5.asMainAccount,
20266 asMainAccount = _ref5$asMainAccount === void 0 ? false : _ref5$asMainAccount;
20267
20268 var getAuthInfo = getAdapter('getAuthInfo');
20269 return getAuthInfo({
20270 platform: unionIdPlatform
20271 }).then(function (authInfo) {
20272 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20273 asMainAccount: asMainAccount
20274 });
20275 authInfo.provider = PLATFORM_QQAPP;
20276 return _this5.associateWithMiniApp(authInfo);
20277 });
20278 },
20279
20280 /**
20281 * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
20282 * 仅在微信小程序中可用。
20283 *
20284 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20285 * @since 3.13.0
20286 * @param {string} unionId
20287 * @param {Object} [unionOptions]
20288 * @param {string} [unionOptions.unionIdPlatform = 'weixin'] unionId platform
20289 * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
20290 * @return {Promise<AV.User>}
20291 */
20292 associateWithWeappWithUnionId: function associateWithWeappWithUnionId(unionId) {
20293 var _this6 = this;
20294
20295 var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20296 _ref6$unionIdPlatform = _ref6.unionIdPlatform,
20297 unionIdPlatform = _ref6$unionIdPlatform === void 0 ? 'weixin' : _ref6$unionIdPlatform,
20298 _ref6$asMainAccount = _ref6.asMainAccount,
20299 asMainAccount = _ref6$asMainAccount === void 0 ? false : _ref6$asMainAccount;
20300
20301 var getAuthInfo = getAdapter('getAuthInfo');
20302 return getAuthInfo({
20303 platform: unionIdPlatform
20304 }).then(function (authInfo) {
20305 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20306 asMainAccount: asMainAccount
20307 });
20308 return _this6.associateWithMiniApp(authInfo);
20309 });
20310 },
20311
20312 /**
20313 * Unlinks a user from a service.
20314 * @param {string} platform
20315 * @return {Promise<AV.User>}
20316 * @since 3.3.0
20317 */
20318 dissociateAuthData: function dissociateAuthData(provider) {
20319 this.unset("authData.".concat(provider));
20320 return this.save().then(function (model) {
20321 return model._handleSaveResult(true).then(function () {
20322 return model;
20323 });
20324 });
20325 },
20326
20327 /**
20328 * @private
20329 * @deprecated
20330 */
20331 _unlinkFrom: function _unlinkFrom(provider) {
20332 console.warn('DEPRECATED: User#_unlinkFrom 已废弃,请使用 User#dissociateAuthData 代替');
20333 return this.dissociateAuthData(provider);
20334 },
20335
20336 /**
20337 * Checks whether a user is linked to a service.
20338 * @private
20339 */
20340 _isLinked: function _isLinked(provider) {
20341 var authType;
20342
20343 if (_.isString(provider)) {
20344 authType = provider;
20345 } else {
20346 authType = provider.getAuthType();
20347 }
20348
20349 var authData = this.get('authData') || {};
20350 return !!authData[authType];
20351 },
20352
20353 /**
20354 * Checks whether a user is anonymous.
20355 * @since 3.9.0
20356 * @return {boolean}
20357 */
20358 isAnonymous: function isAnonymous() {
20359 return this._isLinked(PLATFORM_ANONYMOUS);
20360 },
20361 logOut: function logOut() {
20362 this._logOutWithAll();
20363
20364 this._isCurrentUser = false;
20365 },
20366
20367 /**
20368 * Deauthenticates all providers.
20369 * @private
20370 */
20371 _logOutWithAll: function _logOutWithAll() {
20372 var authData = this.get('authData');
20373
20374 if (!authData) {
20375 return;
20376 }
20377
20378 var self = this;
20379
20380 AV._objectEach(this.get('authData'), function (value, key) {
20381 self._logOutWith(key);
20382 });
20383 },
20384
20385 /**
20386 * Deauthenticates a single provider (e.g. removing access tokens from the
20387 * Facebook SDK).
20388 * @private
20389 */
20390 _logOutWith: function _logOutWith(provider) {
20391 if (!this.isCurrent()) {
20392 return;
20393 }
20394
20395 if (_.isString(provider)) {
20396 provider = AV.User._authProviders[provider];
20397 }
20398
20399 if (provider && provider.deauthenticate) {
20400 provider.deauthenticate();
20401 }
20402 },
20403
20404 /**
20405 * Signs up a new user. You should call this instead of save for
20406 * new AV.Users. This will create a new AV.User on the server, and
20407 * also persist the session on disk so that you can access the user using
20408 * <code>current</code>.
20409 *
20410 * <p>A username and password must be set before calling signUp.</p>
20411 *
20412 * @param {Object} attrs Extra fields to set on the new user, or null.
20413 * @param {AuthOptions} options
20414 * @return {Promise} A promise that is fulfilled when the signup
20415 * finishes.
20416 * @see AV.User.signUp
20417 */
20418 signUp: function signUp(attrs, options) {
20419 var error;
20420 var username = attrs && attrs.username || this.get('username');
20421
20422 if (!username || username === '') {
20423 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty name.');
20424 throw error;
20425 }
20426
20427 var password = attrs && attrs.password || this.get('password');
20428
20429 if (!password || password === '') {
20430 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty password.');
20431 throw error;
20432 }
20433
20434 return this.save(attrs, options).then(function (model) {
20435 if (model.isAnonymous()) {
20436 model.unset("authData.".concat(PLATFORM_ANONYMOUS));
20437 model._opSetQueue = [{}];
20438 }
20439
20440 return model._handleSaveResult(true).then(function () {
20441 return model;
20442 });
20443 });
20444 },
20445
20446 /**
20447 * Signs up a new user with mobile phone and sms code.
20448 * You should call this instead of save for
20449 * new AV.Users. This will create a new AV.User on the server, and
20450 * also persist the session on disk so that you can access the user using
20451 * <code>current</code>.
20452 *
20453 * <p>A username and password must be set before calling signUp.</p>
20454 *
20455 * @param {Object} attrs Extra fields to set on the new user, or null.
20456 * @param {AuthOptions} options
20457 * @return {Promise} A promise that is fulfilled when the signup
20458 * finishes.
20459 * @see AV.User.signUpOrlogInWithMobilePhone
20460 * @see AV.Cloud.requestSmsCode
20461 */
20462 signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(attrs) {
20463 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20464 var error;
20465 var mobilePhoneNumber = attrs && attrs.mobilePhoneNumber || this.get('mobilePhoneNumber');
20466
20467 if (!mobilePhoneNumber || mobilePhoneNumber === '') {
20468 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty mobilePhoneNumber.');
20469 throw error;
20470 }
20471
20472 var smsCode = attrs && attrs.smsCode || this.get('smsCode');
20473
20474 if (!smsCode || smsCode === '') {
20475 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty smsCode.');
20476 throw error;
20477 }
20478
20479 options._makeRequest = function (route, className, id, method, json) {
20480 return AVRequest('usersByMobilePhone', null, null, 'POST', json);
20481 };
20482
20483 return this.save(attrs, options).then(function (model) {
20484 delete model.attributes.smsCode;
20485 delete model._serverData.smsCode;
20486 return model._handleSaveResult(true).then(function () {
20487 return model;
20488 });
20489 });
20490 },
20491
20492 /**
20493 * The same with {@link AV.User.loginWithAuthData}, except that you can set attributes before login.
20494 * @since 3.7.0
20495 */
20496 loginWithAuthData: function loginWithAuthData(authData, platform, options) {
20497 return this._linkWith(platform, authData, options);
20498 },
20499
20500 /**
20501 * The same with {@link AV.User.loginWithAuthDataAndUnionId}, except that you can set attributes before login.
20502 * @since 3.7.0
20503 */
20504 loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
20505 return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
20506 },
20507
20508 /**
20509 * The same with {@link AV.User.loginWithWeapp}, except that you can set attributes before login.
20510 * @deprecated please use {@link AV.User#loginWithMiniApp}
20511 * @since 3.7.0
20512 * @param {Object} [options]
20513 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
20514 * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
20515 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
20516 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20517 * @return {Promise<AV.User>}
20518 */
20519 loginWithWeapp: function loginWithWeapp() {
20520 var _this7 = this;
20521
20522 var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20523 _ref7$preferUnionId = _ref7.preferUnionId,
20524 preferUnionId = _ref7$preferUnionId === void 0 ? false : _ref7$preferUnionId,
20525 _ref7$unionIdPlatform = _ref7.unionIdPlatform,
20526 unionIdPlatform = _ref7$unionIdPlatform === void 0 ? 'weixin' : _ref7$unionIdPlatform,
20527 _ref7$asMainAccount = _ref7.asMainAccount,
20528 asMainAccount = _ref7$asMainAccount === void 0 ? true : _ref7$asMainAccount,
20529 _ref7$failOnNotExist = _ref7.failOnNotExist,
20530 failOnNotExist = _ref7$failOnNotExist === void 0 ? false : _ref7$failOnNotExist;
20531
20532 var getAuthInfo = getAdapter('getAuthInfo');
20533 return getAuthInfo({
20534 preferUnionId: preferUnionId,
20535 asMainAccount: asMainAccount,
20536 platform: unionIdPlatform
20537 }).then(function (authInfo) {
20538 return _this7.loginWithMiniApp(authInfo, {
20539 failOnNotExist: failOnNotExist
20540 });
20541 });
20542 },
20543
20544 /**
20545 * The same with {@link AV.User.loginWithWeappWithUnionId}, except that you can set attributes before login.
20546 * @deprecated please use {@link AV.User#loginWithMiniApp}
20547 * @since 3.13.0
20548 */
20549 loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
20550 var _this8 = this;
20551
20552 var _ref8 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20553 _ref8$unionIdPlatform = _ref8.unionIdPlatform,
20554 unionIdPlatform = _ref8$unionIdPlatform === void 0 ? 'weixin' : _ref8$unionIdPlatform,
20555 _ref8$asMainAccount = _ref8.asMainAccount,
20556 asMainAccount = _ref8$asMainAccount === void 0 ? false : _ref8$asMainAccount,
20557 _ref8$failOnNotExist = _ref8.failOnNotExist,
20558 failOnNotExist = _ref8$failOnNotExist === void 0 ? false : _ref8$failOnNotExist;
20559
20560 var getAuthInfo = getAdapter('getAuthInfo');
20561 return getAuthInfo({
20562 platform: unionIdPlatform
20563 }).then(function (authInfo) {
20564 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20565 asMainAccount: asMainAccount
20566 });
20567 return _this8.loginWithMiniApp(authInfo, {
20568 failOnNotExist: failOnNotExist
20569 });
20570 });
20571 },
20572
20573 /**
20574 * The same with {@link AV.User.loginWithQQApp}, except that you can set attributes before login.
20575 * @deprecated please use {@link AV.User#loginWithMiniApp}
20576 * @since 4.2.0
20577 * @param {Object} [options]
20578 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
20579 * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
20580 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
20581 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20582 */
20583 loginWithQQApp: function loginWithQQApp() {
20584 var _this9 = this;
20585
20586 var _ref9 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20587 _ref9$preferUnionId = _ref9.preferUnionId,
20588 preferUnionId = _ref9$preferUnionId === void 0 ? false : _ref9$preferUnionId,
20589 _ref9$unionIdPlatform = _ref9.unionIdPlatform,
20590 unionIdPlatform = _ref9$unionIdPlatform === void 0 ? 'qq' : _ref9$unionIdPlatform,
20591 _ref9$asMainAccount = _ref9.asMainAccount,
20592 asMainAccount = _ref9$asMainAccount === void 0 ? true : _ref9$asMainAccount,
20593 _ref9$failOnNotExist = _ref9.failOnNotExist,
20594 failOnNotExist = _ref9$failOnNotExist === void 0 ? false : _ref9$failOnNotExist;
20595
20596 var getAuthInfo = getAdapter('getAuthInfo');
20597 return getAuthInfo({
20598 preferUnionId: preferUnionId,
20599 asMainAccount: asMainAccount,
20600 platform: unionIdPlatform
20601 }).then(function (authInfo) {
20602 authInfo.provider = PLATFORM_QQAPP;
20603 return _this9.loginWithMiniApp(authInfo, {
20604 failOnNotExist: failOnNotExist
20605 });
20606 });
20607 },
20608
20609 /**
20610 * The same with {@link AV.User.loginWithQQAppWithUnionId}, except that you can set attributes before login.
20611 * @deprecated please use {@link AV.User#loginWithMiniApp}
20612 * @since 4.2.0
20613 */
20614 loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
20615 var _this10 = this;
20616
20617 var _ref10 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20618 _ref10$unionIdPlatfor = _ref10.unionIdPlatform,
20619 unionIdPlatform = _ref10$unionIdPlatfor === void 0 ? 'qq' : _ref10$unionIdPlatfor,
20620 _ref10$asMainAccount = _ref10.asMainAccount,
20621 asMainAccount = _ref10$asMainAccount === void 0 ? false : _ref10$asMainAccount,
20622 _ref10$failOnNotExist = _ref10.failOnNotExist,
20623 failOnNotExist = _ref10$failOnNotExist === void 0 ? false : _ref10$failOnNotExist;
20624
20625 var getAuthInfo = getAdapter('getAuthInfo');
20626 return getAuthInfo({
20627 platform: unionIdPlatform
20628 }).then(function (authInfo) {
20629 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20630 asMainAccount: asMainAccount
20631 });
20632 authInfo.provider = PLATFORM_QQAPP;
20633 return _this10.loginWithMiniApp(authInfo, {
20634 failOnNotExist: failOnNotExist
20635 });
20636 });
20637 },
20638
20639 /**
20640 * The same with {@link AV.User.loginWithMiniApp}, except that you can set attributes before login.
20641 * @since 4.6.0
20642 */
20643 loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
20644 var _this11 = this;
20645
20646 if (authInfo === undefined) {
20647 var getAuthInfo = getAdapter('getAuthInfo');
20648 return getAuthInfo().then(function (authInfo) {
20649 return _this11.loginWithAuthData(authInfo.authData, authInfo.provider, option);
20650 });
20651 }
20652
20653 return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
20654 },
20655
20656 /**
20657 * Logs in a AV.User. On success, this saves the session to localStorage,
20658 * so you can retrieve the currently logged in user using
20659 * <code>current</code>.
20660 *
20661 * <p>A username and password must be set before calling logIn.</p>
20662 *
20663 * @see AV.User.logIn
20664 * @return {Promise} A promise that is fulfilled with the user when
20665 * the login is complete.
20666 */
20667 logIn: function logIn() {
20668 var model = this;
20669 var request = AVRequest('login', null, null, 'POST', this.toJSON());
20670 return request.then(function (resp) {
20671 var serverAttrs = model.parse(resp);
20672
20673 model._finishFetch(serverAttrs);
20674
20675 return model._handleSaveResult(true).then(function () {
20676 if (!serverAttrs.smsCode) delete model.attributes['smsCode'];
20677 return model;
20678 });
20679 });
20680 },
20681
20682 /**
20683 * @see AV.Object#save
20684 */
20685 save: function save(arg1, arg2, arg3) {
20686 var attrs, options;
20687
20688 if (_.isObject(arg1) || _.isNull(arg1) || _.isUndefined(arg1)) {
20689 attrs = arg1;
20690 options = arg2;
20691 } else {
20692 attrs = {};
20693 attrs[arg1] = arg2;
20694 options = arg3;
20695 }
20696
20697 options = options || {};
20698 return AV.Object.prototype.save.call(this, attrs, options).then(function (model) {
20699 return model._handleSaveResult(false).then(function () {
20700 return model;
20701 });
20702 });
20703 },
20704
20705 /**
20706 * Follow a user
20707 * @since 0.3.0
20708 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
20709 * @param {AV.User | String} options.user The target user or user's objectId to follow.
20710 * @param {Object} [options.attributes] key-value attributes dictionary to be used as
20711 * conditions of followerQuery/followeeQuery.
20712 * @param {AuthOptions} [authOptions]
20713 */
20714 follow: function follow(options, authOptions) {
20715 if (!this.id) {
20716 throw new Error('Please signin.');
20717 }
20718
20719 var user;
20720 var attributes;
20721
20722 if (options.user) {
20723 user = options.user;
20724 attributes = options.attributes;
20725 } else {
20726 user = options;
20727 }
20728
20729 var userObjectId = _.isString(user) ? user : user.id;
20730
20731 if (!userObjectId) {
20732 throw new Error('Invalid target user.');
20733 }
20734
20735 var route = 'users/' + this.id + '/friendship/' + userObjectId;
20736 var request = AVRequest(route, null, null, 'POST', AV._encode(attributes), authOptions);
20737 return request;
20738 },
20739
20740 /**
20741 * Unfollow a user.
20742 * @since 0.3.0
20743 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
20744 * @param {AV.User | String} options.user The target user or user's objectId to unfollow.
20745 * @param {AuthOptions} [authOptions]
20746 */
20747 unfollow: function unfollow(options, authOptions) {
20748 if (!this.id) {
20749 throw new Error('Please signin.');
20750 }
20751
20752 var user;
20753
20754 if (options.user) {
20755 user = options.user;
20756 } else {
20757 user = options;
20758 }
20759
20760 var userObjectId = _.isString(user) ? user : user.id;
20761
20762 if (!userObjectId) {
20763 throw new Error('Invalid target user.');
20764 }
20765
20766 var route = 'users/' + this.id + '/friendship/' + userObjectId;
20767 var request = AVRequest(route, null, null, 'DELETE', null, authOptions);
20768 return request;
20769 },
20770
20771 /**
20772 * Get the user's followers and followees.
20773 * @since 4.8.0
20774 * @param {Object} [options]
20775 * @param {Number} [options.skip]
20776 * @param {Number} [options.limit]
20777 * @param {AuthOptions} [authOptions]
20778 */
20779 getFollowersAndFollowees: function getFollowersAndFollowees(options, authOptions) {
20780 if (!this.id) {
20781 throw new Error('Please signin.');
20782 }
20783
20784 return request({
20785 method: 'GET',
20786 path: "/users/".concat(this.id, "/followersAndFollowees"),
20787 query: {
20788 skip: options && options.skip,
20789 limit: options && options.limit,
20790 include: 'follower,followee',
20791 keys: 'follower,followee'
20792 },
20793 authOptions: authOptions
20794 }).then(function (_ref11) {
20795 var followers = _ref11.followers,
20796 followees = _ref11.followees;
20797 return {
20798 followers: (0, _map.default)(followers).call(followers, function (_ref12) {
20799 var follower = _ref12.follower;
20800 return AV._decode(follower);
20801 }),
20802 followees: (0, _map.default)(followees).call(followees, function (_ref13) {
20803 var followee = _ref13.followee;
20804 return AV._decode(followee);
20805 })
20806 };
20807 });
20808 },
20809
20810 /**
20811 *Create a follower query to query the user's followers.
20812 * @since 0.3.0
20813 * @see AV.User#followerQuery
20814 */
20815 followerQuery: function followerQuery() {
20816 return AV.User.followerQuery(this.id);
20817 },
20818
20819 /**
20820 *Create a followee query to query the user's followees.
20821 * @since 0.3.0
20822 * @see AV.User#followeeQuery
20823 */
20824 followeeQuery: function followeeQuery() {
20825 return AV.User.followeeQuery(this.id);
20826 },
20827
20828 /**
20829 * @see AV.Object#fetch
20830 */
20831 fetch: function fetch(fetchOptions, options) {
20832 return AV.Object.prototype.fetch.call(this, fetchOptions, options).then(function (model) {
20833 return model._handleSaveResult(false).then(function () {
20834 return model;
20835 });
20836 });
20837 },
20838
20839 /**
20840 * Update user's new password safely based on old password.
20841 * @param {String} oldPassword the old password.
20842 * @param {String} newPassword the new password.
20843 * @param {AuthOptions} options
20844 */
20845 updatePassword: function updatePassword(oldPassword, newPassword, options) {
20846 var _this12 = this;
20847
20848 var route = 'users/' + this.id + '/updatePassword';
20849 var params = {
20850 old_password: oldPassword,
20851 new_password: newPassword
20852 };
20853 var request = AVRequest(route, null, null, 'PUT', params, options);
20854 return request.then(function (resp) {
20855 _this12._finishFetch(_this12.parse(resp));
20856
20857 return _this12._handleSaveResult(true).then(function () {
20858 return resp;
20859 });
20860 });
20861 },
20862
20863 /**
20864 * Returns true if <code>current</code> would return this user.
20865 * @see AV.User#current
20866 */
20867 isCurrent: function isCurrent() {
20868 return this._isCurrentUser;
20869 },
20870
20871 /**
20872 * Returns get("username").
20873 * @return {String}
20874 * @see AV.Object#get
20875 */
20876 getUsername: function getUsername() {
20877 return this.get('username');
20878 },
20879
20880 /**
20881 * Returns get("mobilePhoneNumber").
20882 * @return {String}
20883 * @see AV.Object#get
20884 */
20885 getMobilePhoneNumber: function getMobilePhoneNumber() {
20886 return this.get('mobilePhoneNumber');
20887 },
20888
20889 /**
20890 * Calls set("mobilePhoneNumber", phoneNumber, options) and returns the result.
20891 * @param {String} mobilePhoneNumber
20892 * @return {Boolean}
20893 * @see AV.Object#set
20894 */
20895 setMobilePhoneNumber: function setMobilePhoneNumber(phone, options) {
20896 return this.set('mobilePhoneNumber', phone, options);
20897 },
20898
20899 /**
20900 * Calls set("username", username, options) and returns the result.
20901 * @param {String} username
20902 * @return {Boolean}
20903 * @see AV.Object#set
20904 */
20905 setUsername: function setUsername(username, options) {
20906 return this.set('username', username, options);
20907 },
20908
20909 /**
20910 * Calls set("password", password, options) and returns the result.
20911 * @param {String} password
20912 * @return {Boolean}
20913 * @see AV.Object#set
20914 */
20915 setPassword: function setPassword(password, options) {
20916 return this.set('password', password, options);
20917 },
20918
20919 /**
20920 * Returns get("email").
20921 * @return {String}
20922 * @see AV.Object#get
20923 */
20924 getEmail: function getEmail() {
20925 return this.get('email');
20926 },
20927
20928 /**
20929 * Calls set("email", email, options) and returns the result.
20930 * @param {String} email
20931 * @param {AuthOptions} options
20932 * @return {Boolean}
20933 * @see AV.Object#set
20934 */
20935 setEmail: function setEmail(email, options) {
20936 return this.set('email', email, options);
20937 },
20938
20939 /**
20940 * Checks whether this user is the current user and has been authenticated.
20941 * @deprecated 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),
20942 * 如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id
20943 * @return (Boolean) whether this user is the current user and is logged in.
20944 */
20945 authenticated: function authenticated() {
20946 console.warn('DEPRECATED: 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id。');
20947 return !!this._sessionToken && !AV._config.disableCurrentUser && AV.User.current() && AV.User.current().id === this.id;
20948 },
20949
20950 /**
20951 * Detects if current sessionToken is valid.
20952 *
20953 * @since 2.0.0
20954 * @return Promise.<Boolean>
20955 */
20956 isAuthenticated: function isAuthenticated() {
20957 var _this13 = this;
20958
20959 return _promise.default.resolve().then(function () {
20960 return !!_this13._sessionToken && AV.User._fetchUserBySessionToken(_this13._sessionToken).then(function () {
20961 return true;
20962 }, function (error) {
20963 if (error.code === 211) {
20964 return false;
20965 }
20966
20967 throw error;
20968 });
20969 });
20970 },
20971
20972 /**
20973 * Get sessionToken of current user.
20974 * @return {String} sessionToken
20975 */
20976 getSessionToken: function getSessionToken() {
20977 return this._sessionToken;
20978 },
20979
20980 /**
20981 * Refresh sessionToken of current user.
20982 * @since 2.1.0
20983 * @param {AuthOptions} [options]
20984 * @return {Promise.<AV.User>} user with refreshed sessionToken
20985 */
20986 refreshSessionToken: function refreshSessionToken(options) {
20987 var _this14 = this;
20988
20989 return AVRequest("users/".concat(this.id, "/refreshSessionToken"), null, null, 'PUT', null, options).then(function (response) {
20990 _this14._finishFetch(response);
20991
20992 return _this14._handleSaveResult(true).then(function () {
20993 return _this14;
20994 });
20995 });
20996 },
20997
20998 /**
20999 * Get this user's Roles.
21000 * @param {AuthOptions} [options]
21001 * @return {Promise.<AV.Role[]>} A promise that is fulfilled with the roles when
21002 * the query is complete.
21003 */
21004 getRoles: function getRoles(options) {
21005 var _context;
21006
21007 return (0, _find.default)(_context = AV.Relation.reverseQuery('_Role', 'users', this)).call(_context, options);
21008 }
21009 },
21010 /** @lends AV.User */
21011 {
21012 // Class Variables
21013 // The currently logged-in user.
21014 _currentUser: null,
21015 // Whether currentUser is known to match the serialized version on disk.
21016 // This is useful for saving a localstorage check if you try to load
21017 // _currentUser frequently while there is none stored.
21018 _currentUserMatchesDisk: false,
21019 // The localStorage key suffix that the current user is stored under.
21020 _CURRENT_USER_KEY: 'currentUser',
21021 // The mapping of auth provider names to actual providers
21022 _authProviders: {},
21023 // Class Methods
21024
21025 /**
21026 * Signs up a new user with a username (or email) and password.
21027 * This will create a new AV.User on the server, and also persist the
21028 * session in localStorage so that you can access the user using
21029 * {@link #current}.
21030 *
21031 * @param {String} username The username (or email) to sign up with.
21032 * @param {String} password The password to sign up with.
21033 * @param {Object} [attrs] Extra fields to set on the new user.
21034 * @param {AuthOptions} [options]
21035 * @return {Promise} A promise that is fulfilled with the user when
21036 * the signup completes.
21037 * @see AV.User#signUp
21038 */
21039 signUp: function signUp(username, password, attrs, options) {
21040 attrs = attrs || {};
21041 attrs.username = username;
21042 attrs.password = password;
21043
21044 var user = AV.Object._create('_User');
21045
21046 return user.signUp(attrs, options);
21047 },
21048
21049 /**
21050 * Logs in a user with a username (or email) and password. On success, this
21051 * saves the session to disk, so you can retrieve the currently logged in
21052 * user using <code>current</code>.
21053 *
21054 * @param {String} username The username (or email) to log in with.
21055 * @param {String} password The password to log in with.
21056 * @return {Promise} A promise that is fulfilled with the user when
21057 * the login completes.
21058 * @see AV.User#logIn
21059 */
21060 logIn: function logIn(username, password) {
21061 var user = AV.Object._create('_User');
21062
21063 user._finishFetch({
21064 username: username,
21065 password: password
21066 });
21067
21068 return user.logIn();
21069 },
21070
21071 /**
21072 * Logs in a user with a session token. On success, this saves the session
21073 * to disk, so you can retrieve the currently logged in user using
21074 * <code>current</code>.
21075 *
21076 * @param {String} sessionToken The sessionToken to log in with.
21077 * @return {Promise} A promise that is fulfilled with the user when
21078 * the login completes.
21079 */
21080 become: function become(sessionToken) {
21081 return this._fetchUserBySessionToken(sessionToken).then(function (user) {
21082 return user._handleSaveResult(true).then(function () {
21083 return user;
21084 });
21085 });
21086 },
21087 _fetchUserBySessionToken: function _fetchUserBySessionToken(sessionToken) {
21088 if (sessionToken === undefined) {
21089 return _promise.default.reject(new Error('The sessionToken cannot be undefined'));
21090 }
21091
21092 var user = AV.Object._create('_User');
21093
21094 return request({
21095 method: 'GET',
21096 path: '/users/me',
21097 authOptions: {
21098 sessionToken: sessionToken
21099 }
21100 }).then(function (resp) {
21101 var serverAttrs = user.parse(resp);
21102
21103 user._finishFetch(serverAttrs);
21104
21105 return user;
21106 });
21107 },
21108
21109 /**
21110 * Logs in a user with a mobile phone number and sms code sent by
21111 * AV.User.requestLoginSmsCode.On success, this
21112 * saves the session to disk, so you can retrieve the currently logged in
21113 * user using <code>current</code>.
21114 *
21115 * @param {String} mobilePhone The user's mobilePhoneNumber
21116 * @param {String} smsCode The sms code sent by AV.User.requestLoginSmsCode
21117 * @return {Promise} A promise that is fulfilled with the user when
21118 * the login completes.
21119 * @see AV.User#logIn
21120 */
21121 logInWithMobilePhoneSmsCode: function logInWithMobilePhoneSmsCode(mobilePhone, smsCode) {
21122 var user = AV.Object._create('_User');
21123
21124 user._finishFetch({
21125 mobilePhoneNumber: mobilePhone,
21126 smsCode: smsCode
21127 });
21128
21129 return user.logIn();
21130 },
21131
21132 /**
21133 * Signs up or logs in a user with a mobilePhoneNumber and smsCode.
21134 * On success, this saves the session to disk, so you can retrieve the currently
21135 * logged in user using <code>current</code>.
21136 *
21137 * @param {String} mobilePhoneNumber The user's mobilePhoneNumber.
21138 * @param {String} smsCode The sms code sent by AV.Cloud.requestSmsCode
21139 * @param {Object} attributes The user's other attributes such as username etc.
21140 * @param {AuthOptions} options
21141 * @return {Promise} A promise that is fulfilled with the user when
21142 * the login completes.
21143 * @see AV.User#signUpOrlogInWithMobilePhone
21144 * @see AV.Cloud.requestSmsCode
21145 */
21146 signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(mobilePhoneNumber, smsCode, attrs, options) {
21147 attrs = attrs || {};
21148 attrs.mobilePhoneNumber = mobilePhoneNumber;
21149 attrs.smsCode = smsCode;
21150
21151 var user = AV.Object._create('_User');
21152
21153 return user.signUpOrlogInWithMobilePhone(attrs, options);
21154 },
21155
21156 /**
21157 * Logs in a user with a mobile phone number and password. On success, this
21158 * saves the session to disk, so you can retrieve the currently logged in
21159 * user using <code>current</code>.
21160 *
21161 * @param {String} mobilePhone The user's mobilePhoneNumber
21162 * @param {String} password The password to log in with.
21163 * @return {Promise} A promise that is fulfilled with the user when
21164 * the login completes.
21165 * @see AV.User#logIn
21166 */
21167 logInWithMobilePhone: function logInWithMobilePhone(mobilePhone, password) {
21168 var user = AV.Object._create('_User');
21169
21170 user._finishFetch({
21171 mobilePhoneNumber: mobilePhone,
21172 password: password
21173 });
21174
21175 return user.logIn();
21176 },
21177
21178 /**
21179 * Logs in a user with email and password.
21180 *
21181 * @since 3.13.0
21182 * @param {String} email The user's email.
21183 * @param {String} password The password to log in with.
21184 * @return {Promise} A promise that is fulfilled with the user when
21185 * the login completes.
21186 */
21187 loginWithEmail: function loginWithEmail(email, password) {
21188 var user = AV.Object._create('_User');
21189
21190 user._finishFetch({
21191 email: email,
21192 password: password
21193 });
21194
21195 return user.logIn();
21196 },
21197
21198 /**
21199 * Signs up or logs in a user with a third party auth data(AccessToken).
21200 * On success, this saves the session to disk, so you can retrieve the currently
21201 * logged in user using <code>current</code>.
21202 *
21203 * @since 3.7.0
21204 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
21205 * @param {string} platform Available platform for sign up.
21206 * @param {Object} [options]
21207 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
21208 * @return {Promise} A promise that is fulfilled with the user when
21209 * the login completes.
21210 * @example AV.User.loginWithAuthData({
21211 * openid: 'abc123',
21212 * access_token: '123abc',
21213 * expires_in: 1382686496
21214 * }, 'weixin').then(function(user) {
21215 * //Access user here
21216 * }).catch(function(error) {
21217 * //console.error("error: ", error);
21218 * });
21219 * @see {@link https://leancloud.cn/docs/js_guide.html#绑定第三方平台账户}
21220 */
21221 loginWithAuthData: function loginWithAuthData(authData, platform, options) {
21222 return AV.User._logInWith(platform, authData, options);
21223 },
21224
21225 /**
21226 * @deprecated renamed to {@link AV.User.loginWithAuthData}
21227 */
21228 signUpOrlogInWithAuthData: function signUpOrlogInWithAuthData() {
21229 console.warn('DEPRECATED: User.signUpOrlogInWithAuthData 已废弃,请使用 User#loginWithAuthData 代替');
21230 return this.loginWithAuthData.apply(this, arguments);
21231 },
21232
21233 /**
21234 * Signs up or logs in a user with a third party authData and unionId.
21235 * @since 3.7.0
21236 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
21237 * @param {string} platform Available platform for sign up.
21238 * @param {string} unionId
21239 * @param {Object} [unionLoginOptions]
21240 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
21241 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
21242 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
21243 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
21244 * @example AV.User.loginWithAuthDataAndUnionId({
21245 * openid: 'abc123',
21246 * access_token: '123abc',
21247 * expires_in: 1382686496
21248 * }, 'weixin', 'union123', {
21249 * unionIdPlatform: 'weixin',
21250 * asMainAccount: true,
21251 * }).then(function(user) {
21252 * //Access user here
21253 * }).catch(function(error) {
21254 * //console.error("error: ", error);
21255 * });
21256 */
21257 loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
21258 return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
21259 },
21260
21261 /**
21262 * @deprecated renamed to {@link AV.User.loginWithAuthDataAndUnionId}
21263 * @since 3.5.0
21264 */
21265 signUpOrlogInWithAuthDataAndUnionId: function signUpOrlogInWithAuthDataAndUnionId() {
21266 console.warn('DEPRECATED: User.signUpOrlogInWithAuthDataAndUnionId 已废弃,请使用 User#loginWithAuthDataAndUnionId 代替');
21267 return this.loginWithAuthDataAndUnionId.apply(this, arguments);
21268 },
21269
21270 /**
21271 * Merge unionId into authInfo.
21272 * @since 4.6.0
21273 * @param {Object} authInfo
21274 * @param {String} unionId
21275 * @param {Object} [unionIdOption]
21276 * @param {Boolean} [unionIdOption.asMainAccount] If true, the unionId will be associated with the user.
21277 */
21278 mergeUnionId: function mergeUnionId(authInfo, unionId) {
21279 var _ref14 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
21280 _ref14$asMainAccount = _ref14.asMainAccount,
21281 asMainAccount = _ref14$asMainAccount === void 0 ? false : _ref14$asMainAccount;
21282
21283 authInfo = JSON.parse((0, _stringify.default)(authInfo));
21284 var _authInfo = authInfo,
21285 authData = _authInfo.authData,
21286 platform = _authInfo.platform;
21287 authData.platform = platform;
21288 authData.main_account = asMainAccount;
21289 authData.unionid = unionId;
21290 return authInfo;
21291 },
21292
21293 /**
21294 * 使用当前使用微信小程序的微信用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
21295 * 仅在微信小程序中可用。
21296 *
21297 * @deprecated please use {@link AV.User.loginWithMiniApp}
21298 * @since 2.0.0
21299 * @param {Object} [options]
21300 * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
21301 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
21302 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
21303 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
21304 * @return {Promise.<AV.User>}
21305 */
21306 loginWithWeapp: function loginWithWeapp() {
21307 var _this15 = this;
21308
21309 var _ref15 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
21310 _ref15$preferUnionId = _ref15.preferUnionId,
21311 preferUnionId = _ref15$preferUnionId === void 0 ? false : _ref15$preferUnionId,
21312 _ref15$unionIdPlatfor = _ref15.unionIdPlatform,
21313 unionIdPlatform = _ref15$unionIdPlatfor === void 0 ? 'weixin' : _ref15$unionIdPlatfor,
21314 _ref15$asMainAccount = _ref15.asMainAccount,
21315 asMainAccount = _ref15$asMainAccount === void 0 ? true : _ref15$asMainAccount,
21316 _ref15$failOnNotExist = _ref15.failOnNotExist,
21317 failOnNotExist = _ref15$failOnNotExist === void 0 ? false : _ref15$failOnNotExist;
21318
21319 var getAuthInfo = getAdapter('getAuthInfo');
21320 return getAuthInfo({
21321 preferUnionId: preferUnionId,
21322 asMainAccount: asMainAccount,
21323 platform: unionIdPlatform
21324 }).then(function (authInfo) {
21325 return _this15.loginWithMiniApp(authInfo, {
21326 failOnNotExist: failOnNotExist
21327 });
21328 });
21329 },
21330
21331 /**
21332 * 使用当前使用微信小程序的微信用户身份注册或登录,
21333 * 仅在微信小程序中可用。
21334 *
21335 * @deprecated please use {@link AV.User.loginWithMiniApp}
21336 * @since 3.13.0
21337 * @param {Object} [unionLoginOptions]
21338 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
21339 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
21340 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists. * @return {Promise.<AV.User>}
21341 */
21342 loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
21343 var _this16 = this;
21344
21345 var _ref16 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
21346 _ref16$unionIdPlatfor = _ref16.unionIdPlatform,
21347 unionIdPlatform = _ref16$unionIdPlatfor === void 0 ? 'weixin' : _ref16$unionIdPlatfor,
21348 _ref16$asMainAccount = _ref16.asMainAccount,
21349 asMainAccount = _ref16$asMainAccount === void 0 ? false : _ref16$asMainAccount,
21350 _ref16$failOnNotExist = _ref16.failOnNotExist,
21351 failOnNotExist = _ref16$failOnNotExist === void 0 ? false : _ref16$failOnNotExist;
21352
21353 var getAuthInfo = getAdapter('getAuthInfo');
21354 return getAuthInfo({
21355 platform: unionIdPlatform
21356 }).then(function (authInfo) {
21357 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
21358 asMainAccount: asMainAccount
21359 });
21360 return _this16.loginWithMiniApp(authInfo, {
21361 failOnNotExist: failOnNotExist
21362 });
21363 });
21364 },
21365
21366 /**
21367 * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
21368 * 仅在 QQ 小程序中可用。
21369 *
21370 * @deprecated please use {@link AV.User.loginWithMiniApp}
21371 * @since 4.2.0
21372 * @param {Object} [options]
21373 * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
21374 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
21375 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
21376 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
21377 * @return {Promise.<AV.User>}
21378 */
21379 loginWithQQApp: function loginWithQQApp() {
21380 var _this17 = this;
21381
21382 var _ref17 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
21383 _ref17$preferUnionId = _ref17.preferUnionId,
21384 preferUnionId = _ref17$preferUnionId === void 0 ? false : _ref17$preferUnionId,
21385 _ref17$unionIdPlatfor = _ref17.unionIdPlatform,
21386 unionIdPlatform = _ref17$unionIdPlatfor === void 0 ? 'qq' : _ref17$unionIdPlatfor,
21387 _ref17$asMainAccount = _ref17.asMainAccount,
21388 asMainAccount = _ref17$asMainAccount === void 0 ? true : _ref17$asMainAccount,
21389 _ref17$failOnNotExist = _ref17.failOnNotExist,
21390 failOnNotExist = _ref17$failOnNotExist === void 0 ? false : _ref17$failOnNotExist;
21391
21392 var getAuthInfo = getAdapter('getAuthInfo');
21393 return getAuthInfo({
21394 preferUnionId: preferUnionId,
21395 asMainAccount: asMainAccount,
21396 platform: unionIdPlatform
21397 }).then(function (authInfo) {
21398 authInfo.provider = PLATFORM_QQAPP;
21399 return _this17.loginWithMiniApp(authInfo, {
21400 failOnNotExist: failOnNotExist
21401 });
21402 });
21403 },
21404
21405 /**
21406 * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,
21407 * 仅在 QQ 小程序中可用。
21408 *
21409 * @deprecated please use {@link AV.User.loginWithMiniApp}
21410 * @since 4.2.0
21411 * @param {Object} [unionLoginOptions]
21412 * @param {string} [unionLoginOptions.unionIdPlatform = 'qq'] unionId platform
21413 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
21414 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
21415 * @return {Promise.<AV.User>}
21416 */
21417 loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
21418 var _this18 = this;
21419
21420 var _ref18 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
21421 _ref18$unionIdPlatfor = _ref18.unionIdPlatform,
21422 unionIdPlatform = _ref18$unionIdPlatfor === void 0 ? 'qq' : _ref18$unionIdPlatfor,
21423 _ref18$asMainAccount = _ref18.asMainAccount,
21424 asMainAccount = _ref18$asMainAccount === void 0 ? false : _ref18$asMainAccount,
21425 _ref18$failOnNotExist = _ref18.failOnNotExist,
21426 failOnNotExist = _ref18$failOnNotExist === void 0 ? false : _ref18$failOnNotExist;
21427
21428 var getAuthInfo = getAdapter('getAuthInfo');
21429 return getAuthInfo({
21430 platform: unionIdPlatform
21431 }).then(function (authInfo) {
21432 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
21433 asMainAccount: asMainAccount
21434 });
21435 authInfo.provider = PLATFORM_QQAPP;
21436 return _this18.loginWithMiniApp(authInfo, {
21437 failOnNotExist: failOnNotExist
21438 });
21439 });
21440 },
21441
21442 /**
21443 * Register or login using the identity of the current mini-app.
21444 * @param {Object} authInfo
21445 * @param {Object} [option]
21446 * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
21447 */
21448 loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
21449 var _this19 = this;
21450
21451 if (authInfo === undefined) {
21452 var getAuthInfo = getAdapter('getAuthInfo');
21453 return getAuthInfo().then(function (authInfo) {
21454 return _this19.loginWithAuthData(authInfo.authData, authInfo.provider, option);
21455 });
21456 }
21457
21458 return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
21459 },
21460
21461 /**
21462 * Only use for DI in tests to produce deterministic IDs.
21463 */
21464 _genId: function _genId() {
21465 return uuid();
21466 },
21467
21468 /**
21469 * Creates an anonymous user.
21470 *
21471 * @since 3.9.0
21472 * @return {Promise.<AV.User>}
21473 */
21474 loginAnonymously: function loginAnonymously() {
21475 return this.loginWithAuthData({
21476 id: AV.User._genId()
21477 }, 'anonymous');
21478 },
21479 associateWithAuthData: function associateWithAuthData(userObj, platform, authData) {
21480 console.warn('DEPRECATED: User.associateWithAuthData 已废弃,请使用 User#associateWithAuthData 代替');
21481 return userObj._linkWith(platform, authData);
21482 },
21483
21484 /**
21485 * Logs out the currently logged in user session. This will remove the
21486 * session from disk, log out of linked services, and future calls to
21487 * <code>current</code> will return <code>null</code>.
21488 * @return {Promise}
21489 */
21490 logOut: function logOut() {
21491 if (AV._config.disableCurrentUser) {
21492 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');
21493 return _promise.default.resolve(null);
21494 }
21495
21496 if (AV.User._currentUser !== null) {
21497 AV.User._currentUser._logOutWithAll();
21498
21499 AV.User._currentUser._isCurrentUser = false;
21500 }
21501
21502 AV.User._currentUserMatchesDisk = true;
21503 AV.User._currentUser = null;
21504 return AV.localStorage.removeItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function () {
21505 return AV._refreshSubscriptionId();
21506 });
21507 },
21508
21509 /**
21510 *Create a follower query for special user to query the user's followers.
21511 * @param {String} userObjectId The user object id.
21512 * @return {AV.FriendShipQuery}
21513 * @since 0.3.0
21514 */
21515 followerQuery: function followerQuery(userObjectId) {
21516 if (!userObjectId || !_.isString(userObjectId)) {
21517 throw new Error('Invalid user object id.');
21518 }
21519
21520 var query = new AV.FriendShipQuery('_Follower');
21521 query._friendshipTag = 'follower';
21522 query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
21523 return query;
21524 },
21525
21526 /**
21527 *Create a followee query for special user to query the user's followees.
21528 * @param {String} userObjectId The user object id.
21529 * @return {AV.FriendShipQuery}
21530 * @since 0.3.0
21531 */
21532 followeeQuery: function followeeQuery(userObjectId) {
21533 if (!userObjectId || !_.isString(userObjectId)) {
21534 throw new Error('Invalid user object id.');
21535 }
21536
21537 var query = new AV.FriendShipQuery('_Followee');
21538 query._friendshipTag = 'followee';
21539 query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
21540 return query;
21541 },
21542
21543 /**
21544 * Requests a password reset email to be sent to the specified email address
21545 * associated with the user account. This email allows the user to securely
21546 * reset their password on the AV site.
21547 *
21548 * @param {String} email The email address associated with the user that
21549 * forgot their password.
21550 * @return {Promise}
21551 */
21552 requestPasswordReset: function requestPasswordReset(email) {
21553 var json = {
21554 email: email
21555 };
21556 var request = AVRequest('requestPasswordReset', null, null, 'POST', json);
21557 return request;
21558 },
21559
21560 /**
21561 * Requests a verify email to be sent to the specified email address
21562 * associated with the user account. This email allows the user to securely
21563 * verify their email address on the AV site.
21564 *
21565 * @param {String} email The email address associated with the user that
21566 * doesn't verify their email address.
21567 * @return {Promise}
21568 */
21569 requestEmailVerify: function requestEmailVerify(email) {
21570 var json = {
21571 email: email
21572 };
21573 var request = AVRequest('requestEmailVerify', null, null, 'POST', json);
21574 return request;
21575 },
21576
21577 /**
21578 * Requests a verify sms code to be sent to the specified mobile phone
21579 * number associated with the user account. This sms code allows the user to
21580 * verify their mobile phone number by calling AV.User.verifyMobilePhone
21581 *
21582 * @param {String} mobilePhoneNumber The mobile phone number associated with the
21583 * user that doesn't verify their mobile phone number.
21584 * @param {SMSAuthOptions} [options]
21585 * @return {Promise}
21586 */
21587 requestMobilePhoneVerify: function requestMobilePhoneVerify(mobilePhoneNumber) {
21588 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21589 var data = {
21590 mobilePhoneNumber: mobilePhoneNumber
21591 };
21592
21593 if (options.validateToken) {
21594 data.validate_token = options.validateToken;
21595 }
21596
21597 var request = AVRequest('requestMobilePhoneVerify', null, null, 'POST', data, options);
21598 return request;
21599 },
21600
21601 /**
21602 * Requests a reset password sms code to be sent to the specified mobile phone
21603 * number associated with the user account. This sms code allows the user to
21604 * reset their account's password by calling AV.User.resetPasswordBySmsCode
21605 *
21606 * @param {String} mobilePhoneNumber The mobile phone number associated with the
21607 * user that doesn't verify their mobile phone number.
21608 * @param {SMSAuthOptions} [options]
21609 * @return {Promise}
21610 */
21611 requestPasswordResetBySmsCode: function requestPasswordResetBySmsCode(mobilePhoneNumber) {
21612 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21613 var data = {
21614 mobilePhoneNumber: mobilePhoneNumber
21615 };
21616
21617 if (options.validateToken) {
21618 data.validate_token = options.validateToken;
21619 }
21620
21621 var request = AVRequest('requestPasswordResetBySmsCode', null, null, 'POST', data, options);
21622 return request;
21623 },
21624
21625 /**
21626 * Requests a change mobile phone number sms code to be sent to the mobilePhoneNumber.
21627 * This sms code allows current user to reset it's mobilePhoneNumber by
21628 * calling {@link AV.User.changePhoneNumber}
21629 * @since 4.7.0
21630 * @param {String} mobilePhoneNumber
21631 * @param {Number} [ttl] ttl of sms code (default is 6 minutes)
21632 * @param {SMSAuthOptions} [options]
21633 * @return {Promise}
21634 */
21635 requestChangePhoneNumber: function requestChangePhoneNumber(mobilePhoneNumber, ttl, options) {
21636 var data = {
21637 mobilePhoneNumber: mobilePhoneNumber
21638 };
21639
21640 if (ttl) {
21641 data.ttl = options.ttl;
21642 }
21643
21644 if (options && options.validateToken) {
21645 data.validate_token = options.validateToken;
21646 }
21647
21648 return AVRequest('requestChangePhoneNumber', null, null, 'POST', data, options);
21649 },
21650
21651 /**
21652 * Makes a call to reset user's account mobilePhoneNumber by sms code.
21653 * The sms code is sent by {@link AV.User.requestChangePhoneNumber}
21654 * @since 4.7.0
21655 * @param {String} mobilePhoneNumber
21656 * @param {String} code The sms code.
21657 * @return {Promise}
21658 */
21659 changePhoneNumber: function changePhoneNumber(mobilePhoneNumber, code) {
21660 var data = {
21661 mobilePhoneNumber: mobilePhoneNumber,
21662 code: code
21663 };
21664 return AVRequest('changePhoneNumber', null, null, 'POST', data);
21665 },
21666
21667 /**
21668 * Makes a call to reset user's account password by sms code and new password.
21669 * The sms code is sent by AV.User.requestPasswordResetBySmsCode.
21670 * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
21671 * @param {String} password The new password.
21672 * @return {Promise} A promise that will be resolved with the result
21673 * of the function.
21674 */
21675 resetPasswordBySmsCode: function resetPasswordBySmsCode(code, password) {
21676 var json = {
21677 password: password
21678 };
21679 var request = AVRequest('resetPasswordBySmsCode', null, code, 'PUT', json);
21680 return request;
21681 },
21682
21683 /**
21684 * Makes a call to verify sms code that sent by AV.User.Cloud.requestSmsCode
21685 * If verify successfully,the user mobilePhoneVerified attribute will be true.
21686 * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
21687 * @return {Promise} A promise that will be resolved with the result
21688 * of the function.
21689 */
21690 verifyMobilePhone: function verifyMobilePhone(code) {
21691 var request = AVRequest('verifyMobilePhone', null, code, 'POST', null);
21692 return request;
21693 },
21694
21695 /**
21696 * Requests a logIn sms code to be sent to the specified mobile phone
21697 * number associated with the user account. This sms code allows the user to
21698 * login by AV.User.logInWithMobilePhoneSmsCode function.
21699 *
21700 * @param {String} mobilePhoneNumber The mobile phone number associated with the
21701 * user that want to login by AV.User.logInWithMobilePhoneSmsCode
21702 * @param {SMSAuthOptions} [options]
21703 * @return {Promise}
21704 */
21705 requestLoginSmsCode: function requestLoginSmsCode(mobilePhoneNumber) {
21706 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21707 var data = {
21708 mobilePhoneNumber: mobilePhoneNumber
21709 };
21710
21711 if (options.validateToken) {
21712 data.validate_token = options.validateToken;
21713 }
21714
21715 var request = AVRequest('requestLoginSmsCode', null, null, 'POST', data, options);
21716 return request;
21717 },
21718
21719 /**
21720 * Retrieves the currently logged in AVUser with a valid session,
21721 * either from memory or localStorage, if necessary.
21722 * @return {Promise.<AV.User>} resolved with the currently logged in AV.User.
21723 */
21724 currentAsync: function currentAsync() {
21725 if (AV._config.disableCurrentUser) {
21726 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');
21727 return _promise.default.resolve(null);
21728 }
21729
21730 if (AV.User._currentUser) {
21731 return _promise.default.resolve(AV.User._currentUser);
21732 }
21733
21734 if (AV.User._currentUserMatchesDisk) {
21735 return _promise.default.resolve(AV.User._currentUser);
21736 }
21737
21738 return AV.localStorage.getItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function (userData) {
21739 if (!userData) {
21740 return null;
21741 } // Load the user from local storage.
21742
21743
21744 AV.User._currentUserMatchesDisk = true;
21745 AV.User._currentUser = AV.Object._create('_User');
21746 AV.User._currentUser._isCurrentUser = true;
21747 var json = JSON.parse(userData);
21748 AV.User._currentUser.id = json._id;
21749 delete json._id;
21750 AV.User._currentUser._sessionToken = json._sessionToken;
21751 delete json._sessionToken;
21752
21753 AV.User._currentUser._finishFetch(json); //AV.User._currentUser.set(json);
21754
21755
21756 AV.User._currentUser._synchronizeAllAuthData();
21757
21758 AV.User._currentUser._refreshCache();
21759
21760 AV.User._currentUser._opSetQueue = [{}];
21761 return AV.User._currentUser;
21762 });
21763 },
21764
21765 /**
21766 * Retrieves the currently logged in AVUser with a valid session,
21767 * either from memory or localStorage, if necessary.
21768 * @return {AV.User} The currently logged in AV.User.
21769 */
21770 current: function current() {
21771 if (AV._config.disableCurrentUser) {
21772 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');
21773 return null;
21774 }
21775
21776 if (AV.localStorage.async) {
21777 var error = new Error('Synchronous API User.current() is not available in this runtime. Use User.currentAsync() instead.');
21778 error.code = 'SYNC_API_NOT_AVAILABLE';
21779 throw error;
21780 }
21781
21782 if (AV.User._currentUser) {
21783 return AV.User._currentUser;
21784 }
21785
21786 if (AV.User._currentUserMatchesDisk) {
21787 return AV.User._currentUser;
21788 } // Load the user from local storage.
21789
21790
21791 AV.User._currentUserMatchesDisk = true;
21792 var userData = AV.localStorage.getItem(AV._getAVPath(AV.User._CURRENT_USER_KEY));
21793
21794 if (!userData) {
21795 return null;
21796 }
21797
21798 AV.User._currentUser = AV.Object._create('_User');
21799 AV.User._currentUser._isCurrentUser = true;
21800 var json = JSON.parse(userData);
21801 AV.User._currentUser.id = json._id;
21802 delete json._id;
21803 AV.User._currentUser._sessionToken = json._sessionToken;
21804 delete json._sessionToken;
21805
21806 AV.User._currentUser._finishFetch(json); //AV.User._currentUser.set(json);
21807
21808
21809 AV.User._currentUser._synchronizeAllAuthData();
21810
21811 AV.User._currentUser._refreshCache();
21812
21813 AV.User._currentUser._opSetQueue = [{}];
21814 return AV.User._currentUser;
21815 },
21816
21817 /**
21818 * Persists a user as currentUser to localStorage, and into the singleton.
21819 * @private
21820 */
21821 _saveCurrentUser: function _saveCurrentUser(user) {
21822 var promise;
21823
21824 if (AV.User._currentUser !== user) {
21825 promise = AV.User.logOut();
21826 } else {
21827 promise = _promise.default.resolve();
21828 }
21829
21830 return promise.then(function () {
21831 user._isCurrentUser = true;
21832 AV.User._currentUser = user;
21833
21834 var json = user._toFullJSON();
21835
21836 json._id = user.id;
21837 json._sessionToken = user._sessionToken;
21838 return AV.localStorage.setItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY), (0, _stringify.default)(json)).then(function () {
21839 AV.User._currentUserMatchesDisk = true;
21840 return AV._refreshSubscriptionId();
21841 });
21842 });
21843 },
21844 _registerAuthenticationProvider: function _registerAuthenticationProvider(provider) {
21845 AV.User._authProviders[provider.getAuthType()] = provider; // Synchronize the current user with the auth provider.
21846
21847 if (!AV._config.disableCurrentUser && AV.User.current()) {
21848 AV.User.current()._synchronizeAuthData(provider.getAuthType());
21849 }
21850 },
21851 _logInWith: function _logInWith(provider, authData, options) {
21852 var user = AV.Object._create('_User');
21853
21854 return user._linkWith(provider, authData, options);
21855 }
21856 });
21857};
21858
21859/***/ }),
21860/* 553 */
21861/***/ (function(module, exports, __webpack_require__) {
21862
21863var _Object$defineProperty = __webpack_require__(148);
21864
21865function _defineProperty(obj, key, value) {
21866 if (key in obj) {
21867 _Object$defineProperty(obj, key, {
21868 value: value,
21869 enumerable: true,
21870 configurable: true,
21871 writable: true
21872 });
21873 } else {
21874 obj[key] = value;
21875 }
21876
21877 return obj;
21878}
21879
21880module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
21881
21882/***/ }),
21883/* 554 */
21884/***/ (function(module, exports, __webpack_require__) {
21885
21886"use strict";
21887
21888
21889var _interopRequireDefault = __webpack_require__(1);
21890
21891var _map = _interopRequireDefault(__webpack_require__(35));
21892
21893var _promise = _interopRequireDefault(__webpack_require__(13));
21894
21895var _keys = _interopRequireDefault(__webpack_require__(57));
21896
21897var _stringify = _interopRequireDefault(__webpack_require__(36));
21898
21899var _find = _interopRequireDefault(__webpack_require__(92));
21900
21901var _concat = _interopRequireDefault(__webpack_require__(22));
21902
21903var _ = __webpack_require__(3);
21904
21905var debug = __webpack_require__(58)('leancloud:query');
21906
21907var AVError = __webpack_require__(46);
21908
21909var _require = __webpack_require__(27),
21910 _request = _require._request,
21911 request = _require.request;
21912
21913var _require2 = __webpack_require__(30),
21914 ensureArray = _require2.ensureArray,
21915 transformFetchOptions = _require2.transformFetchOptions,
21916 continueWhile = _require2.continueWhile;
21917
21918var requires = function requires(value, message) {
21919 if (value === undefined) {
21920 throw new Error(message);
21921 }
21922}; // AV.Query is a way to create a list of AV.Objects.
21923
21924
21925module.exports = function (AV) {
21926 /**
21927 * Creates a new AV.Query for the given AV.Object subclass.
21928 * @param {Class|String} objectClass An instance of a subclass of AV.Object, or a AV className string.
21929 * @class
21930 *
21931 * <p>AV.Query defines a query that is used to fetch AV.Objects. The
21932 * most common use case is finding all objects that match a query through the
21933 * <code>find</code> method. For example, this sample code fetches all objects
21934 * of class <code>MyClass</code>. It calls a different function depending on
21935 * whether the fetch succeeded or not.
21936 *
21937 * <pre>
21938 * var query = new AV.Query(MyClass);
21939 * query.find().then(function(results) {
21940 * // results is an array of AV.Object.
21941 * }, function(error) {
21942 * // error is an instance of AVError.
21943 * });</pre></p>
21944 *
21945 * <p>An AV.Query can also be used to retrieve a single object whose id is
21946 * known, through the get method. For example, this sample code fetches an
21947 * object of class <code>MyClass</code> and id <code>myId</code>. It calls a
21948 * different function depending on whether the fetch succeeded or not.
21949 *
21950 * <pre>
21951 * var query = new AV.Query(MyClass);
21952 * query.get(myId).then(function(object) {
21953 * // object is an instance of AV.Object.
21954 * }, function(error) {
21955 * // error is an instance of AVError.
21956 * });</pre></p>
21957 *
21958 * <p>An AV.Query can also be used to count the number of objects that match
21959 * the query without retrieving all of those objects. For example, this
21960 * sample code counts the number of objects of the class <code>MyClass</code>
21961 * <pre>
21962 * var query = new AV.Query(MyClass);
21963 * query.count().then(function(number) {
21964 * // There are number instances of MyClass.
21965 * }, function(error) {
21966 * // error is an instance of AVError.
21967 * });</pre></p>
21968 */
21969 AV.Query = function (objectClass) {
21970 if (_.isString(objectClass)) {
21971 objectClass = AV.Object._getSubclass(objectClass);
21972 }
21973
21974 this.objectClass = objectClass;
21975 this.className = objectClass.prototype.className;
21976 this._where = {};
21977 this._include = [];
21978 this._select = [];
21979 this._limit = -1; // negative limit means, do not send a limit
21980
21981 this._skip = 0;
21982 this._defaultParams = {};
21983 };
21984 /**
21985 * Constructs a AV.Query that is the OR of the passed in queries. For
21986 * example:
21987 * <pre>var compoundQuery = AV.Query.or(query1, query2, query3);</pre>
21988 *
21989 * will create a compoundQuery that is an or of the query1, query2, and
21990 * query3.
21991 * @param {...AV.Query} var_args The list of queries to OR.
21992 * @return {AV.Query} The query that is the OR of the passed in queries.
21993 */
21994
21995
21996 AV.Query.or = function () {
21997 var queries = _.toArray(arguments);
21998
21999 var className = null;
22000
22001 AV._arrayEach(queries, function (q) {
22002 if (_.isNull(className)) {
22003 className = q.className;
22004 }
22005
22006 if (className !== q.className) {
22007 throw new Error('All queries must be for the same class');
22008 }
22009 });
22010
22011 var query = new AV.Query(className);
22012
22013 query._orQuery(queries);
22014
22015 return query;
22016 };
22017 /**
22018 * Constructs a AV.Query that is the AND of the passed in queries. For
22019 * example:
22020 * <pre>var compoundQuery = AV.Query.and(query1, query2, query3);</pre>
22021 *
22022 * will create a compoundQuery that is an 'and' of the query1, query2, and
22023 * query3.
22024 * @param {...AV.Query} var_args The list of queries to AND.
22025 * @return {AV.Query} The query that is the AND of the passed in queries.
22026 */
22027
22028
22029 AV.Query.and = function () {
22030 var queries = _.toArray(arguments);
22031
22032 var className = null;
22033
22034 AV._arrayEach(queries, function (q) {
22035 if (_.isNull(className)) {
22036 className = q.className;
22037 }
22038
22039 if (className !== q.className) {
22040 throw new Error('All queries must be for the same class');
22041 }
22042 });
22043
22044 var query = new AV.Query(className);
22045
22046 query._andQuery(queries);
22047
22048 return query;
22049 };
22050 /**
22051 * Retrieves a list of AVObjects that satisfy the CQL.
22052 * CQL syntax please see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
22053 *
22054 * @param {String} cql A CQL string, see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
22055 * @param {Array} pvalues An array contains placeholder values.
22056 * @param {AuthOptions} options
22057 * @return {Promise} A promise that is resolved with the results when
22058 * the query completes.
22059 */
22060
22061
22062 AV.Query.doCloudQuery = function (cql, pvalues, options) {
22063 var params = {
22064 cql: cql
22065 };
22066
22067 if (_.isArray(pvalues)) {
22068 params.pvalues = pvalues;
22069 } else {
22070 options = pvalues;
22071 }
22072
22073 var request = _request('cloudQuery', null, null, 'GET', params, options);
22074
22075 return request.then(function (response) {
22076 //query to process results.
22077 var query = new AV.Query(response.className);
22078 var results = (0, _map.default)(_).call(_, response.results, function (json) {
22079 var obj = query._newObject(response);
22080
22081 if (obj._finishFetch) {
22082 obj._finishFetch(query._processResult(json), true);
22083 }
22084
22085 return obj;
22086 });
22087 return {
22088 results: results,
22089 count: response.count,
22090 className: response.className
22091 };
22092 });
22093 };
22094 /**
22095 * Return a query with conditions from json.
22096 * This can be useful to send a query from server side to client side.
22097 * @since 4.0.0
22098 * @param {Object} json from {@link AV.Query#toJSON}
22099 * @return {AV.Query}
22100 */
22101
22102
22103 AV.Query.fromJSON = function (_ref) {
22104 var className = _ref.className,
22105 where = _ref.where,
22106 include = _ref.include,
22107 select = _ref.select,
22108 includeACL = _ref.includeACL,
22109 limit = _ref.limit,
22110 skip = _ref.skip,
22111 order = _ref.order;
22112
22113 if (typeof className !== 'string') {
22114 throw new TypeError('Invalid Query JSON, className must be a String.');
22115 }
22116
22117 var query = new AV.Query(className);
22118
22119 _.extend(query, {
22120 _where: where,
22121 _include: include,
22122 _select: select,
22123 _includeACL: includeACL,
22124 _limit: limit,
22125 _skip: skip,
22126 _order: order
22127 });
22128
22129 return query;
22130 };
22131
22132 AV.Query._extend = AV._extend;
22133
22134 _.extend(AV.Query.prototype,
22135 /** @lends AV.Query.prototype */
22136 {
22137 //hook to iterate result. Added by dennis<xzhuang@avoscloud.com>.
22138 _processResult: function _processResult(obj) {
22139 return obj;
22140 },
22141
22142 /**
22143 * Constructs an AV.Object whose id is already known by fetching data from
22144 * the server.
22145 *
22146 * @param {String} objectId The id of the object to be fetched.
22147 * @param {AuthOptions} options
22148 * @return {Promise.<AV.Object>}
22149 */
22150 get: function get(objectId, options) {
22151 if (!_.isString(objectId)) {
22152 throw new Error('objectId must be a string');
22153 }
22154
22155 if (objectId === '') {
22156 return _promise.default.reject(new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.'));
22157 }
22158
22159 var obj = this._newObject();
22160
22161 obj.id = objectId;
22162
22163 var queryJSON = this._getParams();
22164
22165 var fetchOptions = {};
22166 if ((0, _keys.default)(queryJSON)) fetchOptions.keys = (0, _keys.default)(queryJSON);
22167 if (queryJSON.include) fetchOptions.include = queryJSON.include;
22168 if (queryJSON.includeACL) fetchOptions.includeACL = queryJSON.includeACL;
22169 return _request('classes', this.className, objectId, 'GET', transformFetchOptions(fetchOptions), options).then(function (response) {
22170 if (_.isEmpty(response)) throw new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
22171
22172 obj._finishFetch(obj.parse(response), true);
22173
22174 return obj;
22175 });
22176 },
22177
22178 /**
22179 * Returns a JSON representation of this query.
22180 * @return {Object}
22181 */
22182 toJSON: function toJSON() {
22183 var className = this.className,
22184 where = this._where,
22185 include = this._include,
22186 select = this._select,
22187 includeACL = this._includeACL,
22188 limit = this._limit,
22189 skip = this._skip,
22190 order = this._order;
22191 return {
22192 className: className,
22193 where: where,
22194 include: include,
22195 select: select,
22196 includeACL: includeACL,
22197 limit: limit,
22198 skip: skip,
22199 order: order
22200 };
22201 },
22202 _getParams: function _getParams() {
22203 var params = _.extend({}, this._defaultParams, {
22204 where: this._where
22205 });
22206
22207 if (this._include.length > 0) {
22208 params.include = this._include.join(',');
22209 }
22210
22211 if (this._select.length > 0) {
22212 params.keys = this._select.join(',');
22213 }
22214
22215 if (this._includeACL !== undefined) {
22216 params.returnACL = this._includeACL;
22217 }
22218
22219 if (this._limit >= 0) {
22220 params.limit = this._limit;
22221 }
22222
22223 if (this._skip > 0) {
22224 params.skip = this._skip;
22225 }
22226
22227 if (this._order !== undefined) {
22228 params.order = this._order;
22229 }
22230
22231 return params;
22232 },
22233 _newObject: function _newObject(response) {
22234 var obj;
22235
22236 if (response && response.className) {
22237 obj = new AV.Object(response.className);
22238 } else {
22239 obj = new this.objectClass();
22240 }
22241
22242 return obj;
22243 },
22244 _createRequest: function _createRequest() {
22245 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._getParams();
22246 var options = arguments.length > 1 ? arguments[1] : undefined;
22247 var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "/classes/".concat(this.className);
22248
22249 if (encodeURIComponent((0, _stringify.default)(params)).length > 2000) {
22250 var body = {
22251 requests: [{
22252 method: 'GET',
22253 path: "/1.1".concat(path),
22254 params: params
22255 }]
22256 };
22257 return request({
22258 path: '/batch',
22259 method: 'POST',
22260 data: body,
22261 authOptions: options
22262 }).then(function (response) {
22263 var result = response[0];
22264
22265 if (result.success) {
22266 return result.success;
22267 }
22268
22269 var error = new AVError(result.error.code, result.error.error || 'Unknown batch error');
22270 throw error;
22271 });
22272 }
22273
22274 return request({
22275 method: 'GET',
22276 path: path,
22277 query: params,
22278 authOptions: options
22279 });
22280 },
22281 _parseResponse: function _parseResponse(response) {
22282 var _this = this;
22283
22284 return (0, _map.default)(_).call(_, response.results, function (json) {
22285 var obj = _this._newObject(response);
22286
22287 if (obj._finishFetch) {
22288 obj._finishFetch(_this._processResult(json), true);
22289 }
22290
22291 return obj;
22292 });
22293 },
22294
22295 /**
22296 * Retrieves a list of AVObjects that satisfy this query.
22297 *
22298 * @param {AuthOptions} options
22299 * @return {Promise} A promise that is resolved with the results when
22300 * the query completes.
22301 */
22302 find: function find(options) {
22303 var request = this._createRequest(undefined, options);
22304
22305 return request.then(this._parseResponse.bind(this));
22306 },
22307
22308 /**
22309 * Retrieves both AVObjects and total count.
22310 *
22311 * @since 4.12.0
22312 * @param {AuthOptions} options
22313 * @return {Promise} A tuple contains results and count.
22314 */
22315 findAndCount: function findAndCount(options) {
22316 var _this2 = this;
22317
22318 var params = this._getParams();
22319
22320 params.count = 1;
22321
22322 var request = this._createRequest(params, options);
22323
22324 return request.then(function (response) {
22325 return [_this2._parseResponse(response), response.count];
22326 });
22327 },
22328
22329 /**
22330 * scan a Query. masterKey required.
22331 *
22332 * @since 2.1.0
22333 * @param {object} [options]
22334 * @param {string} [options.orderedBy] specify the key to sort
22335 * @param {number} [options.batchSize] specify the batch size for each request
22336 * @param {AuthOptions} [authOptions]
22337 * @return {AsyncIterator.<AV.Object>}
22338 * @example const testIterator = {
22339 * [Symbol.asyncIterator]() {
22340 * return new Query('Test').scan(undefined, { useMasterKey: true });
22341 * },
22342 * };
22343 * for await (const test of testIterator) {
22344 * console.log(test.id);
22345 * }
22346 */
22347 scan: function scan() {
22348 var _this3 = this;
22349
22350 var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
22351 orderedBy = _ref2.orderedBy,
22352 batchSize = _ref2.batchSize;
22353
22354 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
22355
22356 var condition = this._getParams();
22357
22358 debug('scan %O', condition);
22359
22360 if (condition.order) {
22361 console.warn('The order of the query is ignored for Query#scan. Checkout the orderedBy option of Query#scan.');
22362 delete condition.order;
22363 }
22364
22365 if (condition.skip) {
22366 console.warn('The skip option of the query is ignored for Query#scan.');
22367 delete condition.skip;
22368 }
22369
22370 if (condition.limit) {
22371 console.warn('The limit option of the query is ignored for Query#scan.');
22372 delete condition.limit;
22373 }
22374
22375 if (orderedBy) condition.scan_key = orderedBy;
22376 if (batchSize) condition.limit = batchSize;
22377 var cursor;
22378 var remainResults = [];
22379 return {
22380 next: function next() {
22381 if (remainResults.length) {
22382 return _promise.default.resolve({
22383 done: false,
22384 value: remainResults.shift()
22385 });
22386 }
22387
22388 if (cursor === null) {
22389 return _promise.default.resolve({
22390 done: true
22391 });
22392 }
22393
22394 return _request('scan/classes', _this3.className, null, 'GET', cursor ? _.extend({}, condition, {
22395 cursor: cursor
22396 }) : condition, authOptions).then(function (response) {
22397 cursor = response.cursor;
22398
22399 if (response.results.length) {
22400 var results = _this3._parseResponse(response);
22401
22402 results.forEach(function (result) {
22403 return remainResults.push(result);
22404 });
22405 }
22406
22407 if (cursor === null && remainResults.length === 0) {
22408 return {
22409 done: true
22410 };
22411 }
22412
22413 return {
22414 done: false,
22415 value: remainResults.shift()
22416 };
22417 });
22418 }
22419 };
22420 },
22421
22422 /**
22423 * Delete objects retrieved by this query.
22424 * @param {AuthOptions} options
22425 * @return {Promise} A promise that is fulfilled when the save
22426 * completes.
22427 */
22428 destroyAll: function destroyAll(options) {
22429 var self = this;
22430 return (0, _find.default)(self).call(self, options).then(function (objects) {
22431 return AV.Object.destroyAll(objects, options);
22432 });
22433 },
22434
22435 /**
22436 * Counts the number of objects that match this query.
22437 *
22438 * @param {AuthOptions} options
22439 * @return {Promise} A promise that is resolved with the count when
22440 * the query completes.
22441 */
22442 count: function count(options) {
22443 var params = this._getParams();
22444
22445 params.limit = 0;
22446 params.count = 1;
22447
22448 var request = this._createRequest(params, options);
22449
22450 return request.then(function (response) {
22451 return response.count;
22452 });
22453 },
22454
22455 /**
22456 * Retrieves at most one AV.Object that satisfies this query.
22457 *
22458 * @param {AuthOptions} options
22459 * @return {Promise} A promise that is resolved with the object when
22460 * the query completes.
22461 */
22462 first: function first(options) {
22463 var self = this;
22464
22465 var params = this._getParams();
22466
22467 params.limit = 1;
22468
22469 var request = this._createRequest(params, options);
22470
22471 return request.then(function (response) {
22472 return (0, _map.default)(_).call(_, response.results, function (json) {
22473 var obj = self._newObject();
22474
22475 if (obj._finishFetch) {
22476 obj._finishFetch(self._processResult(json), true);
22477 }
22478
22479 return obj;
22480 })[0];
22481 });
22482 },
22483
22484 /**
22485 * Sets the number of results to skip before returning any results.
22486 * This is useful for pagination.
22487 * Default is to skip zero results.
22488 * @param {Number} n the number of results to skip.
22489 * @return {AV.Query} Returns the query, so you can chain this call.
22490 */
22491 skip: function skip(n) {
22492 requires(n, 'undefined is not a valid skip value');
22493 this._skip = n;
22494 return this;
22495 },
22496
22497 /**
22498 * Sets the limit of the number of results to return. The default limit is
22499 * 100, with a maximum of 1000 results being returned at a time.
22500 * @param {Number} n the number of results to limit to.
22501 * @return {AV.Query} Returns the query, so you can chain this call.
22502 */
22503 limit: function limit(n) {
22504 requires(n, 'undefined is not a valid limit value');
22505 this._limit = n;
22506 return this;
22507 },
22508
22509 /**
22510 * Add a constraint to the query that requires a particular key's value to
22511 * be equal to the provided value.
22512 * @param {String} key The key to check.
22513 * @param value The value that the AV.Object must contain.
22514 * @return {AV.Query} Returns the query, so you can chain this call.
22515 */
22516 equalTo: function equalTo(key, value) {
22517 requires(key, 'undefined is not a valid key');
22518 requires(value, 'undefined is not a valid value');
22519 this._where[key] = AV._encode(value);
22520 return this;
22521 },
22522
22523 /**
22524 * Helper for condition queries
22525 * @private
22526 */
22527 _addCondition: function _addCondition(key, condition, value) {
22528 requires(key, 'undefined is not a valid condition key');
22529 requires(condition, 'undefined is not a valid condition');
22530 requires(value, 'undefined is not a valid condition value'); // Check if we already have a condition
22531
22532 if (!this._where[key]) {
22533 this._where[key] = {};
22534 }
22535
22536 this._where[key][condition] = AV._encode(value);
22537 return this;
22538 },
22539
22540 /**
22541 * Add a constraint to the query that requires a particular
22542 * <strong>array</strong> key's length to be equal to the provided value.
22543 * @param {String} key The array key to check.
22544 * @param {number} value The length value.
22545 * @return {AV.Query} Returns the query, so you can chain this call.
22546 */
22547 sizeEqualTo: function sizeEqualTo(key, value) {
22548 this._addCondition(key, '$size', value);
22549
22550 return this;
22551 },
22552
22553 /**
22554 * Add a constraint to the query that requires a particular key's value to
22555 * be not equal to the provided value.
22556 * @param {String} key The key to check.
22557 * @param value The value that must not be equalled.
22558 * @return {AV.Query} Returns the query, so you can chain this call.
22559 */
22560 notEqualTo: function notEqualTo(key, value) {
22561 this._addCondition(key, '$ne', value);
22562
22563 return this;
22564 },
22565
22566 /**
22567 * Add a constraint to the query that requires a particular key's value to
22568 * be less than the provided value.
22569 * @param {String} key The key to check.
22570 * @param value The value that provides an upper bound.
22571 * @return {AV.Query} Returns the query, so you can chain this call.
22572 */
22573 lessThan: function lessThan(key, value) {
22574 this._addCondition(key, '$lt', value);
22575
22576 return this;
22577 },
22578
22579 /**
22580 * Add a constraint to the query that requires a particular key's value to
22581 * be greater than the provided value.
22582 * @param {String} key The key to check.
22583 * @param value The value that provides an lower bound.
22584 * @return {AV.Query} Returns the query, so you can chain this call.
22585 */
22586 greaterThan: function greaterThan(key, value) {
22587 this._addCondition(key, '$gt', value);
22588
22589 return this;
22590 },
22591
22592 /**
22593 * Add a constraint to the query that requires a particular key's value to
22594 * be less than or equal to the provided value.
22595 * @param {String} key The key to check.
22596 * @param value The value that provides an upper bound.
22597 * @return {AV.Query} Returns the query, so you can chain this call.
22598 */
22599 lessThanOrEqualTo: function lessThanOrEqualTo(key, value) {
22600 this._addCondition(key, '$lte', value);
22601
22602 return this;
22603 },
22604
22605 /**
22606 * Add a constraint to the query that requires a particular key's value to
22607 * be greater than or equal to the provided value.
22608 * @param {String} key The key to check.
22609 * @param value The value that provides an lower bound.
22610 * @return {AV.Query} Returns the query, so you can chain this call.
22611 */
22612 greaterThanOrEqualTo: function greaterThanOrEqualTo(key, value) {
22613 this._addCondition(key, '$gte', value);
22614
22615 return this;
22616 },
22617
22618 /**
22619 * Add a constraint to the query that requires a particular key's value to
22620 * be contained in the provided list of values.
22621 * @param {String} key The key to check.
22622 * @param {Array} values The values that will match.
22623 * @return {AV.Query} Returns the query, so you can chain this call.
22624 */
22625 containedIn: function containedIn(key, values) {
22626 this._addCondition(key, '$in', values);
22627
22628 return this;
22629 },
22630
22631 /**
22632 * Add a constraint to the query that requires a particular key's value to
22633 * not be contained in the provided list of values.
22634 * @param {String} key The key to check.
22635 * @param {Array} values The values that will not match.
22636 * @return {AV.Query} Returns the query, so you can chain this call.
22637 */
22638 notContainedIn: function notContainedIn(key, values) {
22639 this._addCondition(key, '$nin', values);
22640
22641 return this;
22642 },
22643
22644 /**
22645 * Add a constraint to the query that requires a particular key's value to
22646 * contain each one of the provided list of values.
22647 * @param {String} key The key to check. This key's value must be an array.
22648 * @param {Array} values The values that will match.
22649 * @return {AV.Query} Returns the query, so you can chain this call.
22650 */
22651 containsAll: function containsAll(key, values) {
22652 this._addCondition(key, '$all', values);
22653
22654 return this;
22655 },
22656
22657 /**
22658 * Add a constraint for finding objects that contain the given key.
22659 * @param {String} key The key that should exist.
22660 * @return {AV.Query} Returns the query, so you can chain this call.
22661 */
22662 exists: function exists(key) {
22663 this._addCondition(key, '$exists', true);
22664
22665 return this;
22666 },
22667
22668 /**
22669 * Add a constraint for finding objects that do not contain a given key.
22670 * @param {String} key The key that should not exist
22671 * @return {AV.Query} Returns the query, so you can chain this call.
22672 */
22673 doesNotExist: function doesNotExist(key) {
22674 this._addCondition(key, '$exists', false);
22675
22676 return this;
22677 },
22678
22679 /**
22680 * Add a regular expression constraint for finding string values that match
22681 * the provided regular expression.
22682 * This may be slow for large datasets.
22683 * @param {String} key The key that the string to match is stored in.
22684 * @param {RegExp} regex The regular expression pattern to match.
22685 * @return {AV.Query} Returns the query, so you can chain this call.
22686 */
22687 matches: function matches(key, regex, modifiers) {
22688 this._addCondition(key, '$regex', regex);
22689
22690 if (!modifiers) {
22691 modifiers = '';
22692 } // Javascript regex options support mig as inline options but store them
22693 // as properties of the object. We support mi & should migrate them to
22694 // modifiers
22695
22696
22697 if (regex.ignoreCase) {
22698 modifiers += 'i';
22699 }
22700
22701 if (regex.multiline) {
22702 modifiers += 'm';
22703 }
22704
22705 if (modifiers && modifiers.length) {
22706 this._addCondition(key, '$options', modifiers);
22707 }
22708
22709 return this;
22710 },
22711
22712 /**
22713 * Add a constraint that requires that a key's value matches a AV.Query
22714 * constraint.
22715 * @param {String} key The key that the contains the object to match the
22716 * query.
22717 * @param {AV.Query} query The query that should match.
22718 * @return {AV.Query} Returns the query, so you can chain this call.
22719 */
22720 matchesQuery: function matchesQuery(key, query) {
22721 var queryJSON = query._getParams();
22722
22723 queryJSON.className = query.className;
22724
22725 this._addCondition(key, '$inQuery', queryJSON);
22726
22727 return this;
22728 },
22729
22730 /**
22731 * Add a constraint that requires that a key's value not matches a
22732 * AV.Query constraint.
22733 * @param {String} key The key that the contains the object to match the
22734 * query.
22735 * @param {AV.Query} query The query that should not match.
22736 * @return {AV.Query} Returns the query, so you can chain this call.
22737 */
22738 doesNotMatchQuery: function doesNotMatchQuery(key, query) {
22739 var queryJSON = query._getParams();
22740
22741 queryJSON.className = query.className;
22742
22743 this._addCondition(key, '$notInQuery', queryJSON);
22744
22745 return this;
22746 },
22747
22748 /**
22749 * Add a constraint that requires that a key's value matches a value in
22750 * an object returned by a different AV.Query.
22751 * @param {String} key The key that contains the value that is being
22752 * matched.
22753 * @param {String} queryKey The key in the objects returned by the query to
22754 * match against.
22755 * @param {AV.Query} query The query to run.
22756 * @return {AV.Query} Returns the query, so you can chain this call.
22757 */
22758 matchesKeyInQuery: function matchesKeyInQuery(key, queryKey, query) {
22759 var queryJSON = query._getParams();
22760
22761 queryJSON.className = query.className;
22762
22763 this._addCondition(key, '$select', {
22764 key: queryKey,
22765 query: queryJSON
22766 });
22767
22768 return this;
22769 },
22770
22771 /**
22772 * Add a constraint that requires that a key's value not match a value in
22773 * an object returned by a different AV.Query.
22774 * @param {String} key The key that contains the value that is being
22775 * excluded.
22776 * @param {String} queryKey The key in the objects returned by the query to
22777 * match against.
22778 * @param {AV.Query} query The query to run.
22779 * @return {AV.Query} Returns the query, so you can chain this call.
22780 */
22781 doesNotMatchKeyInQuery: function doesNotMatchKeyInQuery(key, queryKey, query) {
22782 var queryJSON = query._getParams();
22783
22784 queryJSON.className = query.className;
22785
22786 this._addCondition(key, '$dontSelect', {
22787 key: queryKey,
22788 query: queryJSON
22789 });
22790
22791 return this;
22792 },
22793
22794 /**
22795 * Add constraint that at least one of the passed in queries matches.
22796 * @param {Array} queries
22797 * @return {AV.Query} Returns the query, so you can chain this call.
22798 * @private
22799 */
22800 _orQuery: function _orQuery(queries) {
22801 var queryJSON = (0, _map.default)(_).call(_, queries, function (q) {
22802 return q._getParams().where;
22803 });
22804 this._where.$or = queryJSON;
22805 return this;
22806 },
22807
22808 /**
22809 * Add constraint that both of the passed in queries matches.
22810 * @param {Array} queries
22811 * @return {AV.Query} Returns the query, so you can chain this call.
22812 * @private
22813 */
22814 _andQuery: function _andQuery(queries) {
22815 var queryJSON = (0, _map.default)(_).call(_, queries, function (q) {
22816 return q._getParams().where;
22817 });
22818 this._where.$and = queryJSON;
22819 return this;
22820 },
22821
22822 /**
22823 * Converts a string into a regex that matches it.
22824 * Surrounding with \Q .. \E does this, we just need to escape \E's in
22825 * the text separately.
22826 * @private
22827 */
22828 _quote: function _quote(s) {
22829 return '\\Q' + s.replace('\\E', '\\E\\\\E\\Q') + '\\E';
22830 },
22831
22832 /**
22833 * Add a constraint for finding string values that contain a provided
22834 * string. This may be slow for large datasets.
22835 * @param {String} key The key that the string to match is stored in.
22836 * @param {String} substring The substring that the value must contain.
22837 * @return {AV.Query} Returns the query, so you can chain this call.
22838 */
22839 contains: function contains(key, value) {
22840 this._addCondition(key, '$regex', this._quote(value));
22841
22842 return this;
22843 },
22844
22845 /**
22846 * Add a constraint for finding string values that start with a provided
22847 * string. This query will use the backend index, so it will be fast even
22848 * for large datasets.
22849 * @param {String} key The key that the string to match is stored in.
22850 * @param {String} prefix The substring that the value must start with.
22851 * @return {AV.Query} Returns the query, so you can chain this call.
22852 */
22853 startsWith: function startsWith(key, value) {
22854 this._addCondition(key, '$regex', '^' + this._quote(value));
22855
22856 return this;
22857 },
22858
22859 /**
22860 * Add a constraint for finding string values that end with a provided
22861 * string. This will be slow for large datasets.
22862 * @param {String} key The key that the string to match is stored in.
22863 * @param {String} suffix The substring that the value must end with.
22864 * @return {AV.Query} Returns the query, so you can chain this call.
22865 */
22866 endsWith: function endsWith(key, value) {
22867 this._addCondition(key, '$regex', this._quote(value) + '$');
22868
22869 return this;
22870 },
22871
22872 /**
22873 * Sorts the results in ascending order by the given key.
22874 *
22875 * @param {String} key The key to order by.
22876 * @return {AV.Query} Returns the query, so you can chain this call.
22877 */
22878 ascending: function ascending(key) {
22879 requires(key, 'undefined is not a valid key');
22880 this._order = key;
22881 return this;
22882 },
22883
22884 /**
22885 * Also sorts the results in ascending order by the given key. The previous sort keys have
22886 * precedence over this key.
22887 *
22888 * @param {String} key The key to order by
22889 * @return {AV.Query} Returns the query so you can chain this call.
22890 */
22891 addAscending: function addAscending(key) {
22892 requires(key, 'undefined is not a valid key');
22893 if (this._order) this._order += ',' + key;else this._order = key;
22894 return this;
22895 },
22896
22897 /**
22898 * Sorts the results in descending order by the given key.
22899 *
22900 * @param {String} key The key to order by.
22901 * @return {AV.Query} Returns the query, so you can chain this call.
22902 */
22903 descending: function descending(key) {
22904 requires(key, 'undefined is not a valid key');
22905 this._order = '-' + key;
22906 return this;
22907 },
22908
22909 /**
22910 * Also sorts the results in descending order by the given key. The previous sort keys have
22911 * precedence over this key.
22912 *
22913 * @param {String} key The key to order by
22914 * @return {AV.Query} Returns the query so you can chain this call.
22915 */
22916 addDescending: function addDescending(key) {
22917 requires(key, 'undefined is not a valid key');
22918 if (this._order) this._order += ',-' + key;else this._order = '-' + key;
22919 return this;
22920 },
22921
22922 /**
22923 * Add a proximity based constraint for finding objects with key point
22924 * values near the point given.
22925 * @param {String} key The key that the AV.GeoPoint is stored in.
22926 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
22927 * @return {AV.Query} Returns the query, so you can chain this call.
22928 */
22929 near: function near(key, point) {
22930 if (!(point instanceof AV.GeoPoint)) {
22931 // Try to cast it to a GeoPoint, so that near("loc", [20,30]) works.
22932 point = new AV.GeoPoint(point);
22933 }
22934
22935 this._addCondition(key, '$nearSphere', point);
22936
22937 return this;
22938 },
22939
22940 /**
22941 * Add a proximity based constraint for finding objects with key point
22942 * values near the point given and within the maximum distance given.
22943 * @param {String} key The key that the AV.GeoPoint is stored in.
22944 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
22945 * @param maxDistance Maximum distance (in radians) of results to return.
22946 * @return {AV.Query} Returns the query, so you can chain this call.
22947 */
22948 withinRadians: function withinRadians(key, point, distance) {
22949 this.near(key, point);
22950
22951 this._addCondition(key, '$maxDistance', distance);
22952
22953 return this;
22954 },
22955
22956 /**
22957 * Add a proximity based constraint for finding objects with key point
22958 * values near the point given and within the maximum distance given.
22959 * Radius of earth used is 3958.8 miles.
22960 * @param {String} key The key that the AV.GeoPoint is stored in.
22961 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
22962 * @param {Number} maxDistance Maximum distance (in miles) of results to
22963 * return.
22964 * @return {AV.Query} Returns the query, so you can chain this call.
22965 */
22966 withinMiles: function withinMiles(key, point, distance) {
22967 return this.withinRadians(key, point, distance / 3958.8);
22968 },
22969
22970 /**
22971 * Add a proximity based constraint for finding objects with key point
22972 * values near the point given and within the maximum distance given.
22973 * Radius of earth used is 6371.0 kilometers.
22974 * @param {String} key The key that the AV.GeoPoint is stored in.
22975 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
22976 * @param {Number} maxDistance Maximum distance (in kilometers) of results
22977 * to return.
22978 * @return {AV.Query} Returns the query, so you can chain this call.
22979 */
22980 withinKilometers: function withinKilometers(key, point, distance) {
22981 return this.withinRadians(key, point, distance / 6371.0);
22982 },
22983
22984 /**
22985 * Add a constraint to the query that requires a particular key's
22986 * coordinates be contained within a given rectangular geographic bounding
22987 * box.
22988 * @param {String} key The key to be constrained.
22989 * @param {AV.GeoPoint} southwest
22990 * The lower-left inclusive corner of the box.
22991 * @param {AV.GeoPoint} northeast
22992 * The upper-right inclusive corner of the box.
22993 * @return {AV.Query} Returns the query, so you can chain this call.
22994 */
22995 withinGeoBox: function withinGeoBox(key, southwest, northeast) {
22996 if (!(southwest instanceof AV.GeoPoint)) {
22997 southwest = new AV.GeoPoint(southwest);
22998 }
22999
23000 if (!(northeast instanceof AV.GeoPoint)) {
23001 northeast = new AV.GeoPoint(northeast);
23002 }
23003
23004 this._addCondition(key, '$within', {
23005 $box: [southwest, northeast]
23006 });
23007
23008 return this;
23009 },
23010
23011 /**
23012 * Include nested AV.Objects for the provided key. You can use dot
23013 * notation to specify which fields in the included object are also fetch.
23014 * @param {String[]} keys The name of the key to include.
23015 * @return {AV.Query} Returns the query, so you can chain this call.
23016 */
23017 include: function include(keys) {
23018 var _this4 = this;
23019
23020 requires(keys, 'undefined is not a valid key');
23021
23022 _.forEach(arguments, function (keys) {
23023 var _context;
23024
23025 _this4._include = (0, _concat.default)(_context = _this4._include).call(_context, ensureArray(keys));
23026 });
23027
23028 return this;
23029 },
23030
23031 /**
23032 * Include the ACL.
23033 * @param {Boolean} [value=true] Whether to include the ACL
23034 * @return {AV.Query} Returns the query, so you can chain this call.
23035 */
23036 includeACL: function includeACL() {
23037 var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
23038 this._includeACL = value;
23039 return this;
23040 },
23041
23042 /**
23043 * Restrict the fields of the returned AV.Objects to include only the
23044 * provided keys. If this is called multiple times, then all of the keys
23045 * specified in each of the calls will be included.
23046 * @param {String[]} keys The names of the keys to include.
23047 * @return {AV.Query} Returns the query, so you can chain this call.
23048 */
23049 select: function select(keys) {
23050 var _this5 = this;
23051
23052 requires(keys, 'undefined is not a valid key');
23053
23054 _.forEach(arguments, function (keys) {
23055 var _context2;
23056
23057 _this5._select = (0, _concat.default)(_context2 = _this5._select).call(_context2, ensureArray(keys));
23058 });
23059
23060 return this;
23061 },
23062
23063 /**
23064 * Iterates over each result of a query, calling a callback for each one. If
23065 * the callback returns a promise, the iteration will not continue until
23066 * that promise has been fulfilled. If the callback returns a rejected
23067 * promise, then iteration will stop with that error. The items are
23068 * processed in an unspecified order. The query may not have any sort order,
23069 * and may not use limit or skip.
23070 * @param callback {Function} Callback that will be called with each result
23071 * of the query.
23072 * @return {Promise} A promise that will be fulfilled once the
23073 * iteration has completed.
23074 */
23075 each: function each(callback) {
23076 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23077
23078 if (this._order || this._skip || this._limit >= 0) {
23079 var error = new Error('Cannot iterate on a query with sort, skip, or limit.');
23080 return _promise.default.reject(error);
23081 }
23082
23083 var query = new AV.Query(this.objectClass); // We can override the batch size from the options.
23084 // This is undocumented, but useful for testing.
23085
23086 query._limit = options.batchSize || 100;
23087 query._where = _.clone(this._where);
23088 query._include = _.clone(this._include);
23089 query.ascending('objectId');
23090 var finished = false;
23091 return continueWhile(function () {
23092 return !finished;
23093 }, function () {
23094 return (0, _find.default)(query).call(query, options).then(function (results) {
23095 var callbacksDone = _promise.default.resolve();
23096
23097 _.each(results, function (result) {
23098 callbacksDone = callbacksDone.then(function () {
23099 return callback(result);
23100 });
23101 });
23102
23103 return callbacksDone.then(function () {
23104 if (results.length >= query._limit) {
23105 query.greaterThan('objectId', results[results.length - 1].id);
23106 } else {
23107 finished = true;
23108 }
23109 });
23110 });
23111 });
23112 },
23113
23114 /**
23115 * Subscribe the changes of this query.
23116 *
23117 * LiveQuery is not included in the default bundle: {@link https://url.leanapp.cn/enable-live-query}.
23118 *
23119 * @since 3.0.0
23120 * @return {AV.LiveQuery} An eventemitter which can be used to get LiveQuery updates;
23121 */
23122 subscribe: function subscribe(options) {
23123 return AV.LiveQuery.init(this, options);
23124 }
23125 });
23126
23127 AV.FriendShipQuery = AV.Query._extend({
23128 _newObject: function _newObject() {
23129 var UserClass = AV.Object._getSubclass('_User');
23130
23131 return new UserClass();
23132 },
23133 _processResult: function _processResult(json) {
23134 if (json && json[this._friendshipTag]) {
23135 var user = json[this._friendshipTag];
23136
23137 if (user.__type === 'Pointer' && user.className === '_User') {
23138 delete user.__type;
23139 delete user.className;
23140 }
23141
23142 return user;
23143 } else {
23144 return null;
23145 }
23146 }
23147 });
23148};
23149
23150/***/ }),
23151/* 555 */
23152/***/ (function(module, exports, __webpack_require__) {
23153
23154"use strict";
23155
23156
23157var _interopRequireDefault = __webpack_require__(1);
23158
23159var _promise = _interopRequireDefault(__webpack_require__(13));
23160
23161var _keys = _interopRequireDefault(__webpack_require__(57));
23162
23163var _ = __webpack_require__(3);
23164
23165var EventEmitter = __webpack_require__(230);
23166
23167var _require = __webpack_require__(30),
23168 inherits = _require.inherits;
23169
23170var _require2 = __webpack_require__(27),
23171 request = _require2.request;
23172
23173var subscribe = function subscribe(queryJSON, subscriptionId) {
23174 return request({
23175 method: 'POST',
23176 path: '/LiveQuery/subscribe',
23177 data: {
23178 query: queryJSON,
23179 id: subscriptionId
23180 }
23181 });
23182};
23183
23184module.exports = function (AV) {
23185 var requireRealtime = function requireRealtime() {
23186 if (!AV._config.realtime) {
23187 throw new Error('LiveQuery not supported. Please use the LiveQuery bundle. https://url.leanapp.cn/enable-live-query');
23188 }
23189 };
23190 /**
23191 * @class
23192 * A LiveQuery, created by {@link AV.Query#subscribe} is an EventEmitter notifies changes of the Query.
23193 * @since 3.0.0
23194 */
23195
23196
23197 AV.LiveQuery = inherits(EventEmitter,
23198 /** @lends AV.LiveQuery.prototype */
23199 {
23200 constructor: function constructor(id, client, queryJSON, subscriptionId) {
23201 var _this = this;
23202
23203 EventEmitter.apply(this);
23204 this.id = id;
23205 this._client = client;
23206
23207 this._client.register(this);
23208
23209 this._queryJSON = queryJSON;
23210 this._subscriptionId = subscriptionId;
23211 this._onMessage = this._dispatch.bind(this);
23212
23213 this._onReconnect = function () {
23214 subscribe(_this._queryJSON, _this._subscriptionId).catch(function (error) {
23215 return console.error("LiveQuery resubscribe error: ".concat(error.message));
23216 });
23217 };
23218
23219 client.on('message', this._onMessage);
23220 client.on('reconnect', this._onReconnect);
23221 },
23222 _dispatch: function _dispatch(message) {
23223 var _this2 = this;
23224
23225 message.forEach(function (_ref) {
23226 var op = _ref.op,
23227 object = _ref.object,
23228 queryId = _ref.query_id,
23229 updatedKeys = _ref.updatedKeys;
23230 if (queryId !== _this2.id) return;
23231 var target = AV.parseJSON(_.extend({
23232 __type: object.className === '_File' ? 'File' : 'Object'
23233 }, object));
23234
23235 if (updatedKeys) {
23236 /**
23237 * An existing AV.Object which fulfills the Query you subscribe is updated.
23238 * @event AV.LiveQuery#update
23239 * @param {AV.Object|AV.File} target updated object
23240 * @param {String[]} updatedKeys updated keys
23241 */
23242
23243 /**
23244 * An existing AV.Object which doesn't fulfill the Query is updated and now it fulfills the Query.
23245 * @event AV.LiveQuery#enter
23246 * @param {AV.Object|AV.File} target updated object
23247 * @param {String[]} updatedKeys updated keys
23248 */
23249
23250 /**
23251 * An existing AV.Object which fulfills the Query is updated and now it doesn't fulfill the Query.
23252 * @event AV.LiveQuery#leave
23253 * @param {AV.Object|AV.File} target updated object
23254 * @param {String[]} updatedKeys updated keys
23255 */
23256 _this2.emit(op, target, updatedKeys);
23257 } else {
23258 /**
23259 * A new AV.Object which fulfills the Query you subscribe is created.
23260 * @event AV.LiveQuery#create
23261 * @param {AV.Object|AV.File} target updated object
23262 */
23263
23264 /**
23265 * An existing AV.Object which fulfills the Query you subscribe is deleted.
23266 * @event AV.LiveQuery#delete
23267 * @param {AV.Object|AV.File} target updated object
23268 */
23269 _this2.emit(op, target);
23270 }
23271 });
23272 },
23273
23274 /**
23275 * unsubscribe the query
23276 *
23277 * @return {Promise}
23278 */
23279 unsubscribe: function unsubscribe() {
23280 var client = this._client;
23281 client.off('message', this._onMessage);
23282 client.off('reconnect', this._onReconnect);
23283 client.deregister(this);
23284 return request({
23285 method: 'POST',
23286 path: '/LiveQuery/unsubscribe',
23287 data: {
23288 id: client.id,
23289 query_id: this.id
23290 }
23291 });
23292 }
23293 },
23294 /** @lends AV.LiveQuery */
23295 {
23296 init: function init(query) {
23297 var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
23298 _ref2$subscriptionId = _ref2.subscriptionId,
23299 userDefinedSubscriptionId = _ref2$subscriptionId === void 0 ? AV._getSubscriptionId() : _ref2$subscriptionId;
23300
23301 requireRealtime();
23302 if (!(query instanceof AV.Query)) throw new TypeError('LiveQuery must be inited with a Query');
23303 return _promise.default.resolve(userDefinedSubscriptionId).then(function (subscriptionId) {
23304 return AV._config.realtime.createLiveQueryClient(subscriptionId).then(function (liveQueryClient) {
23305 var _query$_getParams = query._getParams(),
23306 where = _query$_getParams.where,
23307 keys = (0, _keys.default)(_query$_getParams),
23308 returnACL = _query$_getParams.returnACL;
23309
23310 var queryJSON = {
23311 where: where,
23312 keys: keys,
23313 returnACL: returnACL,
23314 className: query.className
23315 };
23316 var promise = subscribe(queryJSON, subscriptionId).then(function (_ref3) {
23317 var queryId = _ref3.query_id;
23318 return new AV.LiveQuery(queryId, liveQueryClient, queryJSON, subscriptionId);
23319 }).finally(function () {
23320 liveQueryClient.deregister(promise);
23321 });
23322 liveQueryClient.register(promise);
23323 return promise;
23324 });
23325 });
23326 },
23327
23328 /**
23329 * Pause the LiveQuery connection. This is useful to deactivate the SDK when the app is swtiched to background.
23330 * @static
23331 * @return void
23332 */
23333 pause: function pause() {
23334 requireRealtime();
23335 return AV._config.realtime.pause();
23336 },
23337
23338 /**
23339 * Resume the LiveQuery connection. All subscriptions will be restored after reconnection.
23340 * @static
23341 * @return void
23342 */
23343 resume: function resume() {
23344 requireRealtime();
23345 return AV._config.realtime.resume();
23346 }
23347 });
23348};
23349
23350/***/ }),
23351/* 556 */
23352/***/ (function(module, exports, __webpack_require__) {
23353
23354"use strict";
23355
23356
23357var _ = __webpack_require__(3);
23358
23359var _require = __webpack_require__(30),
23360 tap = _require.tap;
23361
23362module.exports = function (AV) {
23363 /**
23364 * @class
23365 * @example
23366 * AV.Captcha.request().then(captcha => {
23367 * captcha.bind({
23368 * textInput: 'code', // the id for textInput
23369 * image: 'captcha',
23370 * verifyButton: 'verify',
23371 * }, {
23372 * success: (validateCode) => {}, // next step
23373 * error: (error) => {}, // present error.message to user
23374 * });
23375 * });
23376 */
23377 AV.Captcha = function Captcha(options, authOptions) {
23378 this._options = options;
23379 this._authOptions = authOptions;
23380 /**
23381 * The image url of the captcha
23382 * @type string
23383 */
23384
23385 this.url = undefined;
23386 /**
23387 * The captchaToken of the captcha.
23388 * @type string
23389 */
23390
23391 this.captchaToken = undefined;
23392 /**
23393 * The validateToken of the captcha.
23394 * @type string
23395 */
23396
23397 this.validateToken = undefined;
23398 };
23399 /**
23400 * Refresh the captcha
23401 * @return {Promise.<string>} a new capcha url
23402 */
23403
23404
23405 AV.Captcha.prototype.refresh = function refresh() {
23406 var _this = this;
23407
23408 return AV.Cloud._requestCaptcha(this._options, this._authOptions).then(function (_ref) {
23409 var captchaToken = _ref.captchaToken,
23410 url = _ref.url;
23411
23412 _.extend(_this, {
23413 captchaToken: captchaToken,
23414 url: url
23415 });
23416
23417 return url;
23418 });
23419 };
23420 /**
23421 * Verify the captcha
23422 * @param {String} code The code from user input
23423 * @return {Promise.<string>} validateToken if the code is valid
23424 */
23425
23426
23427 AV.Captcha.prototype.verify = function verify(code) {
23428 var _this2 = this;
23429
23430 return AV.Cloud.verifyCaptcha(code, this.captchaToken).then(tap(function (validateToken) {
23431 return _this2.validateToken = validateToken;
23432 }));
23433 };
23434
23435 if (undefined === 'Browser') {
23436 /**
23437 * Bind the captcha to HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
23438 * @param [elements]
23439 * @param {String|HTMLInputElement} [elements.textInput] An input element typed text, or the id for the element.
23440 * @param {String|HTMLImageElement} [elements.image] An image element, or the id for the element.
23441 * @param {String|HTMLElement} [elements.verifyButton] A button element, or the id for the element.
23442 * @param [callbacks]
23443 * @param {Function} [callbacks.success] Success callback will be called if the code is verified. The param `validateCode` can be used for further SMS request.
23444 * @param {Function} [callbacks.error] Error callback will be called if something goes wrong, detailed in param `error.message`.
23445 */
23446 AV.Captcha.prototype.bind = function bind(_ref2, _ref3) {
23447 var _this3 = this;
23448
23449 var textInput = _ref2.textInput,
23450 image = _ref2.image,
23451 verifyButton = _ref2.verifyButton;
23452 var success = _ref3.success,
23453 error = _ref3.error;
23454
23455 if (typeof textInput === 'string') {
23456 textInput = document.getElementById(textInput);
23457 if (!textInput) throw new Error("textInput with id ".concat(textInput, " not found"));
23458 }
23459
23460 if (typeof image === 'string') {
23461 image = document.getElementById(image);
23462 if (!image) throw new Error("image with id ".concat(image, " not found"));
23463 }
23464
23465 if (typeof verifyButton === 'string') {
23466 verifyButton = document.getElementById(verifyButton);
23467 if (!verifyButton) throw new Error("verifyButton with id ".concat(verifyButton, " not found"));
23468 }
23469
23470 this.__refresh = function () {
23471 return _this3.refresh().then(function (url) {
23472 image.src = url;
23473
23474 if (textInput) {
23475 textInput.value = '';
23476 textInput.focus();
23477 }
23478 }).catch(function (err) {
23479 return console.warn("refresh captcha fail: ".concat(err.message));
23480 });
23481 };
23482
23483 if (image) {
23484 this.__image = image;
23485 image.src = this.url;
23486 image.addEventListener('click', this.__refresh);
23487 }
23488
23489 this.__verify = function () {
23490 var code = textInput.value;
23491
23492 _this3.verify(code).catch(function (err) {
23493 _this3.__refresh();
23494
23495 throw err;
23496 }).then(success, error).catch(function (err) {
23497 return console.warn("verify captcha fail: ".concat(err.message));
23498 });
23499 };
23500
23501 if (textInput && verifyButton) {
23502 this.__verifyButton = verifyButton;
23503 verifyButton.addEventListener('click', this.__verify);
23504 }
23505 };
23506 /**
23507 * unbind the captcha from HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
23508 */
23509
23510
23511 AV.Captcha.prototype.unbind = function unbind() {
23512 if (this.__image) this.__image.removeEventListener('click', this.__refresh);
23513 if (this.__verifyButton) this.__verifyButton.removeEventListener('click', this.__verify);
23514 };
23515 }
23516 /**
23517 * Request a captcha
23518 * @param [options]
23519 * @param {Number} [options.width] width(px) of the captcha, ranged 60-200
23520 * @param {Number} [options.height] height(px) of the captcha, ranged 30-100
23521 * @param {Number} [options.size=4] length of the captcha, ranged 3-6. MasterKey required.
23522 * @param {Number} [options.ttl=60] time to live(s), ranged 10-180. MasterKey required.
23523 * @return {Promise.<AV.Captcha>}
23524 */
23525
23526
23527 AV.Captcha.request = function (options, authOptions) {
23528 var captcha = new AV.Captcha(options, authOptions);
23529 return captcha.refresh().then(function () {
23530 return captcha;
23531 });
23532 };
23533};
23534
23535/***/ }),
23536/* 557 */
23537/***/ (function(module, exports, __webpack_require__) {
23538
23539"use strict";
23540
23541
23542var _interopRequireDefault = __webpack_require__(1);
23543
23544var _promise = _interopRequireDefault(__webpack_require__(13));
23545
23546var _ = __webpack_require__(3);
23547
23548var _require = __webpack_require__(27),
23549 _request = _require._request,
23550 request = _require.request;
23551
23552module.exports = function (AV) {
23553 /**
23554 * Contains functions for calling and declaring
23555 * <p><strong><em>
23556 * Some functions are only available from Cloud Code.
23557 * </em></strong></p>
23558 *
23559 * @namespace
23560 * @borrows AV.Captcha.request as requestCaptcha
23561 */
23562 AV.Cloud = AV.Cloud || {};
23563
23564 _.extend(AV.Cloud,
23565 /** @lends AV.Cloud */
23566 {
23567 /**
23568 * Makes a call to a cloud function.
23569 * @param {String} name The function name.
23570 * @param {Object} [data] The parameters to send to the cloud function.
23571 * @param {AuthOptions} [options]
23572 * @return {Promise} A promise that will be resolved with the result
23573 * of the function.
23574 */
23575 run: function run(name, data, options) {
23576 return request({
23577 service: 'engine',
23578 method: 'POST',
23579 path: "/functions/".concat(name),
23580 data: AV._encode(data, null, true),
23581 authOptions: options
23582 }).then(function (resp) {
23583 return AV._decode(resp).result;
23584 });
23585 },
23586
23587 /**
23588 * Makes a call to a cloud function, you can send {AV.Object} as param or a field of param; the response
23589 * from server will also be parsed as an {AV.Object}, array of {AV.Object}, or object includes {AV.Object}
23590 * @param {String} name The function name.
23591 * @param {Object} [data] The parameters to send to the cloud function.
23592 * @param {AuthOptions} [options]
23593 * @return {Promise} A promise that will be resolved with the result of the function.
23594 */
23595 rpc: function rpc(name, data, options) {
23596 if (_.isArray(data)) {
23597 return _promise.default.reject(new Error("Can't pass Array as the param of rpc function in JavaScript SDK."));
23598 }
23599
23600 return request({
23601 service: 'engine',
23602 method: 'POST',
23603 path: "/call/".concat(name),
23604 data: AV._encodeObjectOrArray(data),
23605 authOptions: options
23606 }).then(function (resp) {
23607 return AV._decode(resp).result;
23608 });
23609 },
23610
23611 /**
23612 * Make a call to request server date time.
23613 * @return {Promise.<Date>} A promise that will be resolved with the result
23614 * of the function.
23615 * @since 0.5.9
23616 */
23617 getServerDate: function getServerDate() {
23618 return _request('date', null, null, 'GET').then(function (resp) {
23619 return AV._decode(resp);
23620 });
23621 },
23622
23623 /**
23624 * Makes a call to request an sms code for operation verification.
23625 * @param {String|Object} data The mobile phone number string or a JSON
23626 * object that contains mobilePhoneNumber,template,sign,op,ttl,name etc.
23627 * @param {String} data.mobilePhoneNumber
23628 * @param {String} [data.template] sms template name
23629 * @param {String} [data.sign] sms signature name
23630 * @param {String} [data.smsType] sending code by `sms` (default) or `voice` call
23631 * @param {SMSAuthOptions} [options]
23632 * @return {Promise} A promise that will be resolved if the request succeed
23633 */
23634 requestSmsCode: function requestSmsCode(data) {
23635 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23636
23637 if (_.isString(data)) {
23638 data = {
23639 mobilePhoneNumber: data
23640 };
23641 }
23642
23643 if (!data.mobilePhoneNumber) {
23644 throw new Error('Missing mobilePhoneNumber.');
23645 }
23646
23647 if (options.validateToken) {
23648 data = _.extend({}, data, {
23649 validate_token: options.validateToken
23650 });
23651 }
23652
23653 return _request('requestSmsCode', null, null, 'POST', data, options);
23654 },
23655
23656 /**
23657 * Makes a call to verify sms code that sent by AV.Cloud.requestSmsCode
23658 * @param {String} code The sms code sent by AV.Cloud.requestSmsCode
23659 * @param {phone} phone The mobile phoner number.
23660 * @return {Promise} A promise that will be resolved with the result
23661 * of the function.
23662 */
23663 verifySmsCode: function verifySmsCode(code, phone) {
23664 if (!code) throw new Error('Missing sms code.');
23665 var params = {};
23666
23667 if (_.isString(phone)) {
23668 params['mobilePhoneNumber'] = phone;
23669 }
23670
23671 return _request('verifySmsCode', code, null, 'POST', params);
23672 },
23673 _requestCaptcha: function _requestCaptcha(options, authOptions) {
23674 return _request('requestCaptcha', null, null, 'GET', options, authOptions).then(function (_ref) {
23675 var url = _ref.captcha_url,
23676 captchaToken = _ref.captcha_token;
23677 return {
23678 captchaToken: captchaToken,
23679 url: url
23680 };
23681 });
23682 },
23683
23684 /**
23685 * Request a captcha.
23686 */
23687 requestCaptcha: AV.Captcha.request,
23688
23689 /**
23690 * Verify captcha code. This is the low-level API for captcha.
23691 * Checkout {@link AV.Captcha} for high abstract APIs.
23692 * @param {String} code the code from user input
23693 * @param {String} captchaToken captchaToken returned by {@link AV.Cloud.requestCaptcha}
23694 * @return {Promise.<String>} validateToken if the code is valid
23695 */
23696 verifyCaptcha: function verifyCaptcha(code, captchaToken) {
23697 return _request('verifyCaptcha', null, null, 'POST', {
23698 captcha_code: code,
23699 captcha_token: captchaToken
23700 }).then(function (_ref2) {
23701 var validateToken = _ref2.validate_token;
23702 return validateToken;
23703 });
23704 }
23705 });
23706};
23707
23708/***/ }),
23709/* 558 */
23710/***/ (function(module, exports, __webpack_require__) {
23711
23712"use strict";
23713
23714
23715var request = __webpack_require__(27).request;
23716
23717module.exports = function (AV) {
23718 AV.Installation = AV.Object.extend('_Installation');
23719 /**
23720 * @namespace
23721 */
23722
23723 AV.Push = AV.Push || {};
23724 /**
23725 * Sends a push notification.
23726 * @param {Object} data The data of the push notification.
23727 * @param {String[]} [data.channels] An Array of channels to push to.
23728 * @param {Date} [data.push_time] A Date object for when to send the push.
23729 * @param {Date} [data.expiration_time] A Date object for when to expire
23730 * the push.
23731 * @param {Number} [data.expiration_interval] The seconds from now to expire the push.
23732 * @param {Number} [data.flow_control] The clients to notify per second
23733 * @param {AV.Query} [data.where] An AV.Query over AV.Installation that is used to match
23734 * a set of installations to push to.
23735 * @param {String} [data.cql] A CQL statement over AV.Installation that is used to match
23736 * a set of installations to push to.
23737 * @param {Object} data.data The data to send as part of the push.
23738 More details: https://url.leanapp.cn/pushData
23739 * @param {AuthOptions} [options]
23740 * @return {Promise}
23741 */
23742
23743 AV.Push.send = function (data, options) {
23744 if (data.where) {
23745 data.where = data.where._getParams().where;
23746 }
23747
23748 if (data.where && data.cql) {
23749 throw new Error("Both where and cql can't be set");
23750 }
23751
23752 if (data.push_time) {
23753 data.push_time = data.push_time.toJSON();
23754 }
23755
23756 if (data.expiration_time) {
23757 data.expiration_time = data.expiration_time.toJSON();
23758 }
23759
23760 if (data.expiration_time && data.expiration_interval) {
23761 throw new Error("Both expiration_time and expiration_interval can't be set");
23762 }
23763
23764 return request({
23765 service: 'push',
23766 method: 'POST',
23767 path: '/push',
23768 data: data,
23769 authOptions: options
23770 });
23771 };
23772};
23773
23774/***/ }),
23775/* 559 */
23776/***/ (function(module, exports, __webpack_require__) {
23777
23778"use strict";
23779
23780
23781var _interopRequireDefault = __webpack_require__(1);
23782
23783var _promise = _interopRequireDefault(__webpack_require__(13));
23784
23785var _typeof2 = _interopRequireDefault(__webpack_require__(91));
23786
23787var _ = __webpack_require__(3);
23788
23789var AVRequest = __webpack_require__(27)._request;
23790
23791var _require = __webpack_require__(30),
23792 getSessionToken = _require.getSessionToken;
23793
23794module.exports = function (AV) {
23795 var getUser = function getUser() {
23796 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
23797 var sessionToken = getSessionToken(options);
23798
23799 if (sessionToken) {
23800 return AV.User._fetchUserBySessionToken(getSessionToken(options));
23801 }
23802
23803 return AV.User.currentAsync();
23804 };
23805
23806 var getUserPointer = function getUserPointer(options) {
23807 return getUser(options).then(function (currUser) {
23808 return AV.Object.createWithoutData('_User', currUser.id)._toPointer();
23809 });
23810 };
23811 /**
23812 * Contains functions to deal with Status in LeanCloud.
23813 * @class
23814 */
23815
23816
23817 AV.Status = function (imageUrl, message) {
23818 this.data = {};
23819 this.inboxType = 'default';
23820 this.query = null;
23821
23822 if (imageUrl && (0, _typeof2.default)(imageUrl) === 'object') {
23823 this.data = imageUrl;
23824 } else {
23825 if (imageUrl) {
23826 this.data.image = imageUrl;
23827 }
23828
23829 if (message) {
23830 this.data.message = message;
23831 }
23832 }
23833
23834 return this;
23835 };
23836
23837 _.extend(AV.Status.prototype,
23838 /** @lends AV.Status.prototype */
23839 {
23840 /**
23841 * Gets the value of an attribute in status data.
23842 * @param {String} attr The string name of an attribute.
23843 */
23844 get: function get(attr) {
23845 return this.data[attr];
23846 },
23847
23848 /**
23849 * Sets a hash of model attributes on the status data.
23850 * @param {String} key The key to set.
23851 * @param {any} value The value to give it.
23852 */
23853 set: function set(key, value) {
23854 this.data[key] = value;
23855 return this;
23856 },
23857
23858 /**
23859 * Destroy this status,then it will not be avaiable in other user's inboxes.
23860 * @param {AuthOptions} options
23861 * @return {Promise} A promise that is fulfilled when the destroy
23862 * completes.
23863 */
23864 destroy: function destroy(options) {
23865 if (!this.id) return _promise.default.reject(new Error('The status id is not exists.'));
23866 var request = AVRequest('statuses', null, this.id, 'DELETE', options);
23867 return request;
23868 },
23869
23870 /**
23871 * Cast the AV.Status object to an AV.Object pointer.
23872 * @return {AV.Object} A AV.Object pointer.
23873 */
23874 toObject: function toObject() {
23875 if (!this.id) return null;
23876 return AV.Object.createWithoutData('_Status', this.id);
23877 },
23878 _getDataJSON: function _getDataJSON() {
23879 var json = _.clone(this.data);
23880
23881 return AV._encode(json);
23882 },
23883
23884 /**
23885 * Send a status by a AV.Query object.
23886 * @since 0.3.0
23887 * @param {AuthOptions} options
23888 * @return {Promise} A promise that is fulfilled when the send
23889 * completes.
23890 * @example
23891 * // send a status to male users
23892 * var status = new AVStatus('image url', 'a message');
23893 * status.query = new AV.Query('_User');
23894 * status.query.equalTo('gender', 'male');
23895 * status.send().then(function(){
23896 * //send status successfully.
23897 * }, function(err){
23898 * //an error threw.
23899 * console.dir(err);
23900 * });
23901 */
23902 send: function send() {
23903 var _this = this;
23904
23905 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
23906
23907 if (!getSessionToken(options) && !AV.User.current()) {
23908 throw new Error('Please signin an user.');
23909 }
23910
23911 if (!this.query) {
23912 return AV.Status.sendStatusToFollowers(this, options);
23913 }
23914
23915 return getUserPointer(options).then(function (currUser) {
23916 var query = _this.query._getParams();
23917
23918 query.className = _this.query.className;
23919 var data = {};
23920 data.query = query;
23921 _this.data = _this.data || {};
23922 _this.data.source = _this.data.source || currUser;
23923 data.data = _this._getDataJSON();
23924 data.inboxType = _this.inboxType || 'default';
23925 return AVRequest('statuses', null, null, 'POST', data, options);
23926 }).then(function (response) {
23927 _this.id = response.objectId;
23928 _this.createdAt = AV._parseDate(response.createdAt);
23929 return _this;
23930 });
23931 },
23932 _finishFetch: function _finishFetch(serverData) {
23933 this.id = serverData.objectId;
23934 this.createdAt = AV._parseDate(serverData.createdAt);
23935 this.updatedAt = AV._parseDate(serverData.updatedAt);
23936 this.messageId = serverData.messageId;
23937 delete serverData.messageId;
23938 delete serverData.objectId;
23939 delete serverData.createdAt;
23940 delete serverData.updatedAt;
23941 this.data = AV._decode(serverData);
23942 }
23943 });
23944 /**
23945 * Send a status to current signined user's followers.
23946 * @since 0.3.0
23947 * @param {AV.Status} status A status object to be send to followers.
23948 * @param {AuthOptions} options
23949 * @return {Promise} A promise that is fulfilled when the send
23950 * completes.
23951 * @example
23952 * var status = new AVStatus('image url', 'a message');
23953 * AV.Status.sendStatusToFollowers(status).then(function(){
23954 * //send status successfully.
23955 * }, function(err){
23956 * //an error threw.
23957 * console.dir(err);
23958 * });
23959 */
23960
23961
23962 AV.Status.sendStatusToFollowers = function (status) {
23963 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23964
23965 if (!getSessionToken(options) && !AV.User.current()) {
23966 throw new Error('Please signin an user.');
23967 }
23968
23969 return getUserPointer(options).then(function (currUser) {
23970 var query = {};
23971 query.className = '_Follower';
23972 query.keys = 'follower';
23973 query.where = {
23974 user: currUser
23975 };
23976 var data = {};
23977 data.query = query;
23978 status.data = status.data || {};
23979 status.data.source = status.data.source || currUser;
23980 data.data = status._getDataJSON();
23981 data.inboxType = status.inboxType || 'default';
23982 var request = AVRequest('statuses', null, null, 'POST', data, options);
23983 return request.then(function (response) {
23984 status.id = response.objectId;
23985 status.createdAt = AV._parseDate(response.createdAt);
23986 return status;
23987 });
23988 });
23989 };
23990 /**
23991 * <p>Send a status from current signined user to other user's private status inbox.</p>
23992 * @since 0.3.0
23993 * @param {AV.Status} status A status object to be send to followers.
23994 * @param {String} target The target user or user's objectId.
23995 * @param {AuthOptions} options
23996 * @return {Promise} A promise that is fulfilled when the send
23997 * completes.
23998 * @example
23999 * // send a private status to user '52e84e47e4b0f8de283b079b'
24000 * var status = new AVStatus('image url', 'a message');
24001 * AV.Status.sendPrivateStatus(status, '52e84e47e4b0f8de283b079b').then(function(){
24002 * //send status successfully.
24003 * }, function(err){
24004 * //an error threw.
24005 * console.dir(err);
24006 * });
24007 */
24008
24009
24010 AV.Status.sendPrivateStatus = function (status, target) {
24011 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
24012
24013 if (!getSessionToken(options) && !AV.User.current()) {
24014 throw new Error('Please signin an user.');
24015 }
24016
24017 if (!target) {
24018 throw new Error('Invalid target user.');
24019 }
24020
24021 var userObjectId = _.isString(target) ? target : target.id;
24022
24023 if (!userObjectId) {
24024 throw new Error('Invalid target user.');
24025 }
24026
24027 return getUserPointer(options).then(function (currUser) {
24028 var query = {};
24029 query.className = '_User';
24030 query.where = {
24031 objectId: userObjectId
24032 };
24033 var data = {};
24034 data.query = query;
24035 status.data = status.data || {};
24036 status.data.source = status.data.source || currUser;
24037 data.data = status._getDataJSON();
24038 data.inboxType = 'private';
24039 status.inboxType = 'private';
24040 var request = AVRequest('statuses', null, null, 'POST', data, options);
24041 return request.then(function (response) {
24042 status.id = response.objectId;
24043 status.createdAt = AV._parseDate(response.createdAt);
24044 return status;
24045 });
24046 });
24047 };
24048 /**
24049 * Count unread statuses in someone's inbox.
24050 * @since 0.3.0
24051 * @param {AV.User} owner The status owner.
24052 * @param {String} inboxType The inbox type, 'default' by default.
24053 * @param {AuthOptions} options
24054 * @return {Promise} A promise that is fulfilled when the count
24055 * completes.
24056 * @example
24057 * AV.Status.countUnreadStatuses(AV.User.current()).then(function(response){
24058 * console.log(response.unread); //unread statuses number.
24059 * console.log(response.total); //total statuses number.
24060 * });
24061 */
24062
24063
24064 AV.Status.countUnreadStatuses = function (owner) {
24065 var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
24066 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
24067 if (!_.isString(inboxType)) options = inboxType;
24068
24069 if (!getSessionToken(options) && owner == null && !AV.User.current()) {
24070 throw new Error('Please signin an user or pass the owner objectId.');
24071 }
24072
24073 return _promise.default.resolve(owner || getUser(options)).then(function (owner) {
24074 var params = {};
24075 params.inboxType = AV._encode(inboxType);
24076 params.owner = AV._encode(owner);
24077 return AVRequest('subscribe/statuses/count', null, null, 'GET', params, options);
24078 });
24079 };
24080 /**
24081 * reset unread statuses count in someone's inbox.
24082 * @since 2.1.0
24083 * @param {AV.User} owner The status owner.
24084 * @param {String} inboxType The inbox type, 'default' by default.
24085 * @param {AuthOptions} options
24086 * @return {Promise} A promise that is fulfilled when the reset
24087 * completes.
24088 * @example
24089 * AV.Status.resetUnreadCount(AV.User.current()).then(function(response){
24090 * console.log(response.unread); //unread statuses number.
24091 * console.log(response.total); //total statuses number.
24092 * });
24093 */
24094
24095
24096 AV.Status.resetUnreadCount = function (owner) {
24097 var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
24098 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
24099 if (!_.isString(inboxType)) options = inboxType;
24100
24101 if (!getSessionToken(options) && owner == null && !AV.User.current()) {
24102 throw new Error('Please signin an user or pass the owner objectId.');
24103 }
24104
24105 return _promise.default.resolve(owner || getUser(options)).then(function (owner) {
24106 var params = {};
24107 params.inboxType = AV._encode(inboxType);
24108 params.owner = AV._encode(owner);
24109 return AVRequest('subscribe/statuses/resetUnreadCount', null, null, 'POST', params, options);
24110 });
24111 };
24112 /**
24113 * Create a status query to find someone's published statuses.
24114 * @since 0.3.0
24115 * @param {AV.User} source The status source, typically the publisher.
24116 * @return {AV.Query} The query object for status.
24117 * @example
24118 * //Find current user's published statuses.
24119 * var query = AV.Status.statusQuery(AV.User.current());
24120 * query.find().then(function(statuses){
24121 * //process statuses
24122 * });
24123 */
24124
24125
24126 AV.Status.statusQuery = function (source) {
24127 var query = new AV.Query('_Status');
24128
24129 if (source) {
24130 query.equalTo('source', source);
24131 }
24132
24133 return query;
24134 };
24135 /**
24136 * <p>AV.InboxQuery defines a query that is used to fetch somebody's inbox statuses.</p>
24137 * @class
24138 */
24139
24140
24141 AV.InboxQuery = AV.Query._extend(
24142 /** @lends AV.InboxQuery.prototype */
24143 {
24144 _objectClass: AV.Status,
24145 _sinceId: 0,
24146 _maxId: 0,
24147 _inboxType: 'default',
24148 _owner: null,
24149 _newObject: function _newObject() {
24150 return new AV.Status();
24151 },
24152 _createRequest: function _createRequest(params, options) {
24153 return AV.InboxQuery.__super__._createRequest.call(this, params, options, '/subscribe/statuses');
24154 },
24155
24156 /**
24157 * Sets the messageId of results to skip before returning any results.
24158 * This is useful for pagination.
24159 * Default is zero.
24160 * @param {Number} n the mesage id.
24161 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24162 */
24163 sinceId: function sinceId(id) {
24164 this._sinceId = id;
24165 return this;
24166 },
24167
24168 /**
24169 * Sets the maximal messageId of results。
24170 * This is useful for pagination.
24171 * Default is zero that is no limition.
24172 * @param {Number} n the mesage id.
24173 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24174 */
24175 maxId: function maxId(id) {
24176 this._maxId = id;
24177 return this;
24178 },
24179
24180 /**
24181 * Sets the owner of the querying inbox.
24182 * @param {AV.User} owner The inbox owner.
24183 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24184 */
24185 owner: function owner(_owner) {
24186 this._owner = _owner;
24187 return this;
24188 },
24189
24190 /**
24191 * Sets the querying inbox type.default is 'default'.
24192 * @param {String} type The inbox type.
24193 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24194 */
24195 inboxType: function inboxType(type) {
24196 this._inboxType = type;
24197 return this;
24198 },
24199 _getParams: function _getParams() {
24200 var params = AV.InboxQuery.__super__._getParams.call(this);
24201
24202 params.owner = AV._encode(this._owner);
24203 params.inboxType = AV._encode(this._inboxType);
24204 params.sinceId = AV._encode(this._sinceId);
24205 params.maxId = AV._encode(this._maxId);
24206 return params;
24207 }
24208 });
24209 /**
24210 * Create a inbox status query to find someone's inbox statuses.
24211 * @since 0.3.0
24212 * @param {AV.User} owner The inbox's owner
24213 * @param {String} inboxType The inbox type,'default' by default.
24214 * @return {AV.InboxQuery} The inbox query object.
24215 * @see AV.InboxQuery
24216 * @example
24217 * //Find current user's default inbox statuses.
24218 * var query = AV.Status.inboxQuery(AV.User.current());
24219 * //find the statuses after the last message id
24220 * query.sinceId(lastMessageId);
24221 * query.find().then(function(statuses){
24222 * //process statuses
24223 * });
24224 */
24225
24226 AV.Status.inboxQuery = function (owner, inboxType) {
24227 var query = new AV.InboxQuery(AV.Status);
24228
24229 if (owner) {
24230 query._owner = owner;
24231 }
24232
24233 if (inboxType) {
24234 query._inboxType = inboxType;
24235 }
24236
24237 return query;
24238 };
24239};
24240
24241/***/ }),
24242/* 560 */
24243/***/ (function(module, exports, __webpack_require__) {
24244
24245"use strict";
24246
24247
24248var _interopRequireDefault = __webpack_require__(1);
24249
24250var _stringify = _interopRequireDefault(__webpack_require__(36));
24251
24252var _map = _interopRequireDefault(__webpack_require__(35));
24253
24254var _ = __webpack_require__(3);
24255
24256var AVRequest = __webpack_require__(27)._request;
24257
24258module.exports = function (AV) {
24259 /**
24260 * A builder to generate sort string for app searching.For example:
24261 * @class
24262 * @since 0.5.1
24263 * @example
24264 * var builder = new AV.SearchSortBuilder();
24265 * builder.ascending('key1').descending('key2','max');
24266 * var query = new AV.SearchQuery('Player');
24267 * query.sortBy(builder);
24268 * query.find().then();
24269 */
24270 AV.SearchSortBuilder = function () {
24271 this._sortFields = [];
24272 };
24273
24274 _.extend(AV.SearchSortBuilder.prototype,
24275 /** @lends AV.SearchSortBuilder.prototype */
24276 {
24277 _addField: function _addField(key, order, mode, missing) {
24278 var field = {};
24279 field[key] = {
24280 order: order || 'asc',
24281 mode: mode || 'avg',
24282 missing: '_' + (missing || 'last')
24283 };
24284
24285 this._sortFields.push(field);
24286
24287 return this;
24288 },
24289
24290 /**
24291 * Sorts the results in ascending order by the given key and options.
24292 *
24293 * @param {String} key The key to order by.
24294 * @param {String} mode The sort mode, default is 'avg', you can choose
24295 * 'max' or 'min' too.
24296 * @param {String} missing The missing key behaviour, default is 'last',
24297 * you can choose 'first' too.
24298 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
24299 */
24300 ascending: function ascending(key, mode, missing) {
24301 return this._addField(key, 'asc', mode, missing);
24302 },
24303
24304 /**
24305 * Sorts the results in descending order by the given key and options.
24306 *
24307 * @param {String} key The key to order by.
24308 * @param {String} mode The sort mode, default is 'avg', you can choose
24309 * 'max' or 'min' too.
24310 * @param {String} missing The missing key behaviour, default is 'last',
24311 * you can choose 'first' too.
24312 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
24313 */
24314 descending: function descending(key, mode, missing) {
24315 return this._addField(key, 'desc', mode, missing);
24316 },
24317
24318 /**
24319 * Add a proximity based constraint for finding objects with key point
24320 * values near the point given.
24321 * @param {String} key The key that the AV.GeoPoint is stored in.
24322 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
24323 * @param {Object} options The other options such as mode,order, unit etc.
24324 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
24325 */
24326 whereNear: function whereNear(key, point, options) {
24327 options = options || {};
24328 var field = {};
24329 var geo = {
24330 lat: point.latitude,
24331 lon: point.longitude
24332 };
24333 var m = {
24334 order: options.order || 'asc',
24335 mode: options.mode || 'avg',
24336 unit: options.unit || 'km'
24337 };
24338 m[key] = geo;
24339 field['_geo_distance'] = m;
24340
24341 this._sortFields.push(field);
24342
24343 return this;
24344 },
24345
24346 /**
24347 * Build a sort string by configuration.
24348 * @return {String} the sort string.
24349 */
24350 build: function build() {
24351 return (0, _stringify.default)(AV._encode(this._sortFields));
24352 }
24353 });
24354 /**
24355 * App searching query.Use just like AV.Query:
24356 *
24357 * Visit <a href='https://leancloud.cn/docs/app_search_guide.html'>App Searching Guide</a>
24358 * for more details.
24359 * @class
24360 * @since 0.5.1
24361 * @example
24362 * var query = new AV.SearchQuery('Player');
24363 * query.queryString('*');
24364 * query.find().then(function(results) {
24365 * console.log('Found %d objects', query.hits());
24366 * //Process results
24367 * });
24368 */
24369
24370
24371 AV.SearchQuery = AV.Query._extend(
24372 /** @lends AV.SearchQuery.prototype */
24373 {
24374 _sid: null,
24375 _hits: 0,
24376 _queryString: null,
24377 _highlights: null,
24378 _sortBuilder: null,
24379 _clazz: null,
24380 constructor: function constructor(className) {
24381 if (className) {
24382 this._clazz = className;
24383 } else {
24384 className = '__INVALID_CLASS';
24385 }
24386
24387 AV.Query.call(this, className);
24388 },
24389 _createRequest: function _createRequest(params, options) {
24390 return AVRequest('search/select', null, null, 'GET', params || this._getParams(), options);
24391 },
24392
24393 /**
24394 * Sets the sid of app searching query.Default is null.
24395 * @param {String} sid Scroll id for searching.
24396 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24397 */
24398 sid: function sid(_sid) {
24399 this._sid = _sid;
24400 return this;
24401 },
24402
24403 /**
24404 * Sets the query string of app searching.
24405 * @param {String} q The query string.
24406 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24407 */
24408 queryString: function queryString(q) {
24409 this._queryString = q;
24410 return this;
24411 },
24412
24413 /**
24414 * Sets the highlight fields. Such as
24415 * <pre><code>
24416 * query.highlights('title');
24417 * //or pass an array.
24418 * query.highlights(['title', 'content'])
24419 * </code></pre>
24420 * @param {String|String[]} highlights a list of fields.
24421 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24422 */
24423 highlights: function highlights(_highlights) {
24424 var objects;
24425
24426 if (_highlights && _.isString(_highlights)) {
24427 objects = _.toArray(arguments);
24428 } else {
24429 objects = _highlights;
24430 }
24431
24432 this._highlights = objects;
24433 return this;
24434 },
24435
24436 /**
24437 * Sets the sort builder for this query.
24438 * @see AV.SearchSortBuilder
24439 * @param { AV.SearchSortBuilder} builder The sort builder.
24440 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24441 *
24442 */
24443 sortBy: function sortBy(builder) {
24444 this._sortBuilder = builder;
24445 return this;
24446 },
24447
24448 /**
24449 * Returns the number of objects that match this query.
24450 * @return {Number}
24451 */
24452 hits: function hits() {
24453 if (!this._hits) {
24454 this._hits = 0;
24455 }
24456
24457 return this._hits;
24458 },
24459 _processResult: function _processResult(json) {
24460 delete json['className'];
24461 delete json['_app_url'];
24462 delete json['_deeplink'];
24463 return json;
24464 },
24465
24466 /**
24467 * Returns true when there are more documents can be retrieved by this
24468 * query instance, you can call find function to get more results.
24469 * @see AV.SearchQuery#find
24470 * @return {Boolean}
24471 */
24472 hasMore: function hasMore() {
24473 return !this._hitEnd;
24474 },
24475
24476 /**
24477 * Reset current query instance state(such as sid, hits etc) except params
24478 * for a new searching. After resetting, hasMore() will return true.
24479 */
24480 reset: function reset() {
24481 this._hitEnd = false;
24482 this._sid = null;
24483 this._hits = 0;
24484 },
24485
24486 /**
24487 * Retrieves a list of AVObjects that satisfy this query.
24488 * Either options.success or options.error is called when the find
24489 * completes.
24490 *
24491 * @see AV.Query#find
24492 * @param {AuthOptions} options
24493 * @return {Promise} A promise that is resolved with the results when
24494 * the query completes.
24495 */
24496 find: function find(options) {
24497 var self = this;
24498
24499 var request = this._createRequest(undefined, options);
24500
24501 return request.then(function (response) {
24502 //update sid for next querying.
24503 if (response.sid) {
24504 self._oldSid = self._sid;
24505 self._sid = response.sid;
24506 } else {
24507 self._sid = null;
24508 self._hitEnd = true;
24509 }
24510
24511 self._hits = response.hits || 0;
24512 return (0, _map.default)(_).call(_, response.results, function (json) {
24513 if (json.className) {
24514 response.className = json.className;
24515 }
24516
24517 var obj = self._newObject(response);
24518
24519 obj.appURL = json['_app_url'];
24520
24521 obj._finishFetch(self._processResult(json), true);
24522
24523 return obj;
24524 });
24525 });
24526 },
24527 _getParams: function _getParams() {
24528 var params = AV.SearchQuery.__super__._getParams.call(this);
24529
24530 delete params.where;
24531
24532 if (this._clazz) {
24533 params.clazz = this.className;
24534 }
24535
24536 if (this._sid) {
24537 params.sid = this._sid;
24538 }
24539
24540 if (!this._queryString) {
24541 throw new Error('Please set query string.');
24542 } else {
24543 params.q = this._queryString;
24544 }
24545
24546 if (this._highlights) {
24547 params.highlights = this._highlights.join(',');
24548 }
24549
24550 if (this._sortBuilder && params.order) {
24551 throw new Error('sort and order can not be set at same time.');
24552 }
24553
24554 if (this._sortBuilder) {
24555 params.sort = this._sortBuilder.build();
24556 }
24557
24558 return params;
24559 }
24560 });
24561};
24562/**
24563 * Sorts the results in ascending order by the given key.
24564 *
24565 * @method AV.SearchQuery#ascending
24566 * @param {String} key The key to order by.
24567 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24568 */
24569
24570/**
24571 * Also sorts the results in ascending order by the given key. The previous sort keys have
24572 * precedence over this key.
24573 *
24574 * @method AV.SearchQuery#addAscending
24575 * @param {String} key The key to order by
24576 * @return {AV.SearchQuery} Returns the query so you can chain this call.
24577 */
24578
24579/**
24580 * Sorts the results in descending order by the given key.
24581 *
24582 * @method AV.SearchQuery#descending
24583 * @param {String} key The key to order by.
24584 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24585 */
24586
24587/**
24588 * Also sorts the results in descending order by the given key. The previous sort keys have
24589 * precedence over this key.
24590 *
24591 * @method AV.SearchQuery#addDescending
24592 * @param {String} key The key to order by
24593 * @return {AV.SearchQuery} Returns the query so you can chain this call.
24594 */
24595
24596/**
24597 * Include nested AV.Objects for the provided key. You can use dot
24598 * notation to specify which fields in the included object are also fetch.
24599 * @method AV.SearchQuery#include
24600 * @param {String[]} keys The name of the key to include.
24601 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24602 */
24603
24604/**
24605 * Sets the number of results to skip before returning any results.
24606 * This is useful for pagination.
24607 * Default is to skip zero results.
24608 * @method AV.SearchQuery#skip
24609 * @param {Number} n the number of results to skip.
24610 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24611 */
24612
24613/**
24614 * Sets the limit of the number of results to return. The default limit is
24615 * 100, with a maximum of 1000 results being returned at a time.
24616 * @method AV.SearchQuery#limit
24617 * @param {Number} n the number of results to limit to.
24618 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24619 */
24620
24621/***/ }),
24622/* 561 */
24623/***/ (function(module, exports, __webpack_require__) {
24624
24625"use strict";
24626
24627
24628var _interopRequireDefault = __webpack_require__(1);
24629
24630var _promise = _interopRequireDefault(__webpack_require__(13));
24631
24632var _ = __webpack_require__(3);
24633
24634var AVError = __webpack_require__(46);
24635
24636var _require = __webpack_require__(27),
24637 request = _require.request;
24638
24639module.exports = function (AV) {
24640 /**
24641 * 包含了使用了 LeanCloud
24642 * <a href='/docs/leaninsight_guide.html'>离线数据分析功能</a>的函数。
24643 * <p><strong><em>
24644 * 仅在云引擎运行环境下有效。
24645 * </em></strong></p>
24646 * @namespace
24647 */
24648 AV.Insight = AV.Insight || {};
24649
24650 _.extend(AV.Insight,
24651 /** @lends AV.Insight */
24652 {
24653 /**
24654 * 开始一个 Insight 任务。结果里将返回 Job id,你可以拿得到的 id 使用
24655 * AV.Insight.JobQuery 查询任务状态和结果。
24656 * @param {Object} jobConfig 任务配置的 JSON 对象,例如:<code><pre>
24657 * { "sql" : "select count(*) as c,gender from _User group by gender",
24658 * "saveAs": {
24659 * "className" : "UserGender",
24660 * "limit": 1
24661 * }
24662 * }
24663 * </pre></code>
24664 * sql 指定任务执行的 SQL 语句, saveAs(可选) 指定将结果保存在哪张表里,limit 最大 1000。
24665 * @param {AuthOptions} [options]
24666 * @return {Promise} A promise that will be resolved with the result
24667 * of the function.
24668 */
24669 startJob: function startJob(jobConfig, options) {
24670 if (!jobConfig || !jobConfig.sql) {
24671 throw new Error('Please provide the sql to run the job.');
24672 }
24673
24674 var data = {
24675 jobConfig: jobConfig,
24676 appId: AV.applicationId
24677 };
24678 return request({
24679 path: '/bigquery/jobs',
24680 method: 'POST',
24681 data: AV._encode(data, null, true),
24682 authOptions: options,
24683 signKey: false
24684 }).then(function (resp) {
24685 return AV._decode(resp).id;
24686 });
24687 },
24688
24689 /**
24690 * 监听 Insight 任务事件(未来推出独立部署的离线分析服务后开放)
24691 * <p><strong><em>
24692 * 仅在云引擎运行环境下有效。
24693 * </em></strong></p>
24694 * @param {String} event 监听的事件,目前尚不支持。
24695 * @param {Function} 监听回调函数,接收 (err, id) 两个参数,err 表示错误信息,
24696 * id 表示任务 id。接下来你可以拿这个 id 使用AV.Insight.JobQuery 查询任务状态和结果。
24697 *
24698 */
24699 on: function on(event, cb) {}
24700 });
24701 /**
24702 * 创建一个对象,用于查询 Insight 任务状态和结果。
24703 * @class
24704 * @param {String} id 任务 id
24705 * @since 0.5.5
24706 */
24707
24708
24709 AV.Insight.JobQuery = function (id, className) {
24710 if (!id) {
24711 throw new Error('Please provide the job id.');
24712 }
24713
24714 this.id = id;
24715 this.className = className;
24716 this._skip = 0;
24717 this._limit = 100;
24718 };
24719
24720 _.extend(AV.Insight.JobQuery.prototype,
24721 /** @lends AV.Insight.JobQuery.prototype */
24722 {
24723 /**
24724 * Sets the number of results to skip before returning any results.
24725 * This is useful for pagination.
24726 * Default is to skip zero results.
24727 * @param {Number} n the number of results to skip.
24728 * @return {AV.Query} Returns the query, so you can chain this call.
24729 */
24730 skip: function skip(n) {
24731 this._skip = n;
24732 return this;
24733 },
24734
24735 /**
24736 * Sets the limit of the number of results to return. The default limit is
24737 * 100, with a maximum of 1000 results being returned at a time.
24738 * @param {Number} n the number of results to limit to.
24739 * @return {AV.Query} Returns the query, so you can chain this call.
24740 */
24741 limit: function limit(n) {
24742 this._limit = n;
24743 return this;
24744 },
24745
24746 /**
24747 * 查询任务状态和结果,任务结果为一个 JSON 对象,包括 status 表示任务状态, totalCount 表示总数,
24748 * results 数组表示任务结果数组,previewCount 表示可以返回的结果总数,任务的开始和截止时间
24749 * startTime、endTime 等信息。
24750 *
24751 * @param {AuthOptions} [options]
24752 * @return {Promise} A promise that will be resolved with the result
24753 * of the function.
24754 *
24755 */
24756 find: function find(options) {
24757 var params = {
24758 skip: this._skip,
24759 limit: this._limit
24760 };
24761 return request({
24762 path: "/bigquery/jobs/".concat(this.id),
24763 method: 'GET',
24764 query: params,
24765 authOptions: options,
24766 signKey: false
24767 }).then(function (response) {
24768 if (response.error) {
24769 return _promise.default.reject(new AVError(response.code, response.error));
24770 }
24771
24772 return _promise.default.resolve(response);
24773 });
24774 }
24775 });
24776};
24777
24778/***/ }),
24779/* 562 */
24780/***/ (function(module, exports, __webpack_require__) {
24781
24782"use strict";
24783
24784
24785var _interopRequireDefault = __webpack_require__(1);
24786
24787var _promise = _interopRequireDefault(__webpack_require__(13));
24788
24789var _ = __webpack_require__(3);
24790
24791var _require = __webpack_require__(27),
24792 LCRequest = _require.request;
24793
24794var _require2 = __webpack_require__(30),
24795 getSessionToken = _require2.getSessionToken;
24796
24797module.exports = function (AV) {
24798 var getUserWithSessionToken = function getUserWithSessionToken(authOptions) {
24799 if (authOptions.user) {
24800 if (!authOptions.user._sessionToken) {
24801 throw new Error('authOptions.user is not signed in.');
24802 }
24803
24804 return _promise.default.resolve(authOptions.user);
24805 }
24806
24807 if (authOptions.sessionToken) {
24808 return AV.User._fetchUserBySessionToken(authOptions.sessionToken);
24809 }
24810
24811 return AV.User.currentAsync();
24812 };
24813
24814 var getSessionTokenAsync = function getSessionTokenAsync(authOptions) {
24815 var sessionToken = getSessionToken(authOptions);
24816
24817 if (sessionToken) {
24818 return _promise.default.resolve(sessionToken);
24819 }
24820
24821 return AV.User.currentAsync().then(function (user) {
24822 if (user) {
24823 return user.getSessionToken();
24824 }
24825 });
24826 };
24827 /**
24828 * Contains functions to deal with Friendship in LeanCloud.
24829 * @class
24830 */
24831
24832
24833 AV.Friendship = {
24834 /**
24835 * Request friendship.
24836 * @since 4.8.0
24837 * @param {String | AV.User | Object} options if an AV.User or string is given, it will be used as the friend.
24838 * @param {AV.User | string} options.friend The friend (or friend's objectId) to follow.
24839 * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of followeeQuery.
24840 * @param {AuthOptions} [authOptions]
24841 * @return {Promise<void>}
24842 */
24843 request: function request(options) {
24844 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24845 var friend;
24846 var attributes;
24847
24848 if (options.friend) {
24849 friend = options.friend;
24850 attributes = options.attributes;
24851 } else {
24852 friend = options;
24853 }
24854
24855 var friendObj = _.isString(friend) ? AV.Object.createWithoutData('_User', friend) : friend;
24856 return getUserWithSessionToken(authOptions).then(function (userObj) {
24857 if (!userObj) {
24858 throw new Error('Please signin an user.');
24859 }
24860
24861 return LCRequest({
24862 method: 'POST',
24863 path: '/users/friendshipRequests',
24864 data: {
24865 user: userObj._toPointer(),
24866 friend: friendObj._toPointer(),
24867 friendship: attributes
24868 },
24869 authOptions: authOptions
24870 });
24871 });
24872 },
24873
24874 /**
24875 * Accept a friendship request.
24876 * @since 4.8.0
24877 * @param {AV.Object | string | Object} options if an AV.Object or string is given, it will be used as the request in _FriendshipRequest.
24878 * @param {AV.Object} options.request The request (or it's objectId) to be accepted.
24879 * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of {@link AV#followeeQuery}.
24880 * @param {AuthOptions} [authOptions]
24881 * @return {Promise<void>}
24882 */
24883 acceptRequest: function acceptRequest(options) {
24884 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24885 var request;
24886 var attributes;
24887
24888 if (options.request) {
24889 request = options.request;
24890 attributes = options.attributes;
24891 } else {
24892 request = options;
24893 }
24894
24895 var requestId = _.isString(request) ? request : request.id;
24896 return getSessionTokenAsync(authOptions).then(function (sessionToken) {
24897 if (!sessionToken) {
24898 throw new Error('Please signin an user.');
24899 }
24900
24901 return LCRequest({
24902 method: 'PUT',
24903 path: '/users/friendshipRequests/' + requestId + '/accept',
24904 data: {
24905 friendship: AV._encode(attributes)
24906 },
24907 authOptions: authOptions
24908 });
24909 });
24910 },
24911
24912 /**
24913 * Decline a friendship request.
24914 * @param {AV.Object | string} request The request (or it's objectId) to be declined.
24915 * @param {AuthOptions} [authOptions]
24916 * @return {Promise<void>}
24917 */
24918 declineRequest: function declineRequest(request) {
24919 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24920 var requestId = _.isString(request) ? request : request.id;
24921 return getSessionTokenAsync(authOptions).then(function (sessionToken) {
24922 if (!sessionToken) {
24923 throw new Error('Please signin an user.');
24924 }
24925
24926 return LCRequest({
24927 method: 'PUT',
24928 path: '/users/friendshipRequests/' + requestId + '/decline',
24929 authOptions: authOptions
24930 });
24931 });
24932 }
24933 };
24934};
24935
24936/***/ }),
24937/* 563 */
24938/***/ (function(module, exports, __webpack_require__) {
24939
24940"use strict";
24941
24942
24943var _interopRequireDefault = __webpack_require__(1);
24944
24945var _stringify = _interopRequireDefault(__webpack_require__(36));
24946
24947var _ = __webpack_require__(3);
24948
24949var _require = __webpack_require__(27),
24950 _request = _require._request;
24951
24952var AV = __webpack_require__(69);
24953
24954var serializeMessage = function serializeMessage(message) {
24955 if (typeof message === 'string') {
24956 return message;
24957 }
24958
24959 if (typeof message.getPayload === 'function') {
24960 return (0, _stringify.default)(message.getPayload());
24961 }
24962
24963 return (0, _stringify.default)(message);
24964};
24965/**
24966 * <p>An AV.Conversation is a local representation of a LeanCloud realtime's
24967 * conversation. This class is a subclass of AV.Object, and retains the
24968 * same functionality of an AV.Object, but also extends it with various
24969 * conversation specific methods, like get members, creators of this conversation.
24970 * </p>
24971 *
24972 * @class AV.Conversation
24973 * @param {String} name The name of the Role to create.
24974 * @param {Object} [options]
24975 * @param {Boolean} [options.isSystem] Set this conversation as system conversation.
24976 * @param {Boolean} [options.isTransient] Set this conversation as transient conversation.
24977 */
24978
24979
24980module.exports = AV.Object.extend('_Conversation',
24981/** @lends AV.Conversation.prototype */
24982{
24983 constructor: function constructor(name) {
24984 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24985 AV.Object.prototype.constructor.call(this, null, null);
24986 this.set('name', name);
24987
24988 if (options.isSystem !== undefined) {
24989 this.set('sys', options.isSystem ? true : false);
24990 }
24991
24992 if (options.isTransient !== undefined) {
24993 this.set('tr', options.isTransient ? true : false);
24994 }
24995 },
24996
24997 /**
24998 * Get current conversation's creator.
24999 *
25000 * @return {String}
25001 */
25002 getCreator: function getCreator() {
25003 return this.get('c');
25004 },
25005
25006 /**
25007 * Get the last message's time.
25008 *
25009 * @return {Date}
25010 */
25011 getLastMessageAt: function getLastMessageAt() {
25012 return this.get('lm');
25013 },
25014
25015 /**
25016 * Get this conversation's members
25017 *
25018 * @return {String[]}
25019 */
25020 getMembers: function getMembers() {
25021 return this.get('m');
25022 },
25023
25024 /**
25025 * Add a member to this conversation
25026 *
25027 * @param {String} member
25028 */
25029 addMember: function addMember(member) {
25030 return this.add('m', member);
25031 },
25032
25033 /**
25034 * Get this conversation's members who set this conversation as muted.
25035 *
25036 * @return {String[]}
25037 */
25038 getMutedMembers: function getMutedMembers() {
25039 return this.get('mu');
25040 },
25041
25042 /**
25043 * Get this conversation's name field.
25044 *
25045 * @return String
25046 */
25047 getName: function getName() {
25048 return this.get('name');
25049 },
25050
25051 /**
25052 * Returns true if this conversation is transient conversation.
25053 *
25054 * @return {Boolean}
25055 */
25056 isTransient: function isTransient() {
25057 return this.get('tr');
25058 },
25059
25060 /**
25061 * Returns true if this conversation is system conversation.
25062 *
25063 * @return {Boolean}
25064 */
25065 isSystem: function isSystem() {
25066 return this.get('sys');
25067 },
25068
25069 /**
25070 * Send realtime message to this conversation, using HTTP request.
25071 *
25072 * @param {String} fromClient Sender's client id.
25073 * @param {String|Object} message The message which will send to conversation.
25074 * It could be a raw string, or an object with a `toJSON` method, like a
25075 * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}
25076 * @param {Object} [options]
25077 * @param {Boolean} [options.transient] Whether send this message as transient message or not.
25078 * @param {String[]} [options.toClients] Ids of clients to send to. This option can be used only in system conversation.
25079 * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}
25080 * @param {AuthOptions} [authOptions]
25081 * @return {Promise}
25082 */
25083 send: function send(fromClient, message) {
25084 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25085 var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
25086 var data = {
25087 from_peer: fromClient,
25088 conv_id: this.id,
25089 transient: false,
25090 message: serializeMessage(message)
25091 };
25092
25093 if (options.toClients !== undefined) {
25094 data.to_peers = options.toClients;
25095 }
25096
25097 if (options.transient !== undefined) {
25098 data.transient = options.transient ? true : false;
25099 }
25100
25101 if (options.pushData !== undefined) {
25102 data.push_data = options.pushData;
25103 }
25104
25105 return _request('rtm', 'messages', null, 'POST', data, authOptions);
25106 },
25107
25108 /**
25109 * Send realtime broadcast message to all clients, via this conversation, using HTTP request.
25110 *
25111 * @param {String} fromClient Sender's client id.
25112 * @param {String|Object} message The message which will send to conversation.
25113 * It could be a raw string, or an object with a `toJSON` method, like a
25114 * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}.
25115 * @param {Object} [options]
25116 * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}.
25117 * @param {Object} [options.validTill] The message will valid till this time.
25118 * @param {AuthOptions} [authOptions]
25119 * @return {Promise}
25120 */
25121 broadcast: function broadcast(fromClient, message) {
25122 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25123 var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
25124 var data = {
25125 from_peer: fromClient,
25126 conv_id: this.id,
25127 message: serializeMessage(message)
25128 };
25129
25130 if (options.pushData !== undefined) {
25131 data.push = options.pushData;
25132 }
25133
25134 if (options.validTill !== undefined) {
25135 var ts = options.validTill;
25136
25137 if (_.isDate(ts)) {
25138 ts = ts.getTime();
25139 }
25140
25141 options.valid_till = ts;
25142 }
25143
25144 return _request('rtm', 'broadcast', null, 'POST', data, authOptions);
25145 }
25146});
25147
25148/***/ }),
25149/* 564 */
25150/***/ (function(module, exports, __webpack_require__) {
25151
25152"use strict";
25153
25154
25155var _interopRequireDefault = __webpack_require__(1);
25156
25157var _promise = _interopRequireDefault(__webpack_require__(13));
25158
25159var _map = _interopRequireDefault(__webpack_require__(35));
25160
25161var _concat = _interopRequireDefault(__webpack_require__(22));
25162
25163var _ = __webpack_require__(3);
25164
25165var _require = __webpack_require__(27),
25166 request = _require.request;
25167
25168var _require2 = __webpack_require__(30),
25169 ensureArray = _require2.ensureArray,
25170 parseDate = _require2.parseDate;
25171
25172var AV = __webpack_require__(69);
25173/**
25174 * The version change interval for Leaderboard
25175 * @enum
25176 */
25177
25178
25179AV.LeaderboardVersionChangeInterval = {
25180 NEVER: 'never',
25181 DAY: 'day',
25182 WEEK: 'week',
25183 MONTH: 'month'
25184};
25185/**
25186 * The order of the leaderboard results
25187 * @enum
25188 */
25189
25190AV.LeaderboardOrder = {
25191 ASCENDING: 'ascending',
25192 DESCENDING: 'descending'
25193};
25194/**
25195 * The update strategy for Leaderboard
25196 * @enum
25197 */
25198
25199AV.LeaderboardUpdateStrategy = {
25200 /** Only keep the best statistic. If the leaderboard is in descending order, the best statistic is the highest one. */
25201 BETTER: 'better',
25202
25203 /** Keep the last updated statistic */
25204 LAST: 'last',
25205
25206 /** Keep the sum of all updated statistics */
25207 SUM: 'sum'
25208};
25209/**
25210 * @typedef {Object} Ranking
25211 * @property {number} rank Starts at 0
25212 * @property {number} value the statistic value of this ranking
25213 * @property {AV.User} user The user of this ranking
25214 * @property {Statistic[]} [includedStatistics] Other statistics of the user, specified by the `includeStatistic` option of `AV.Leaderboard.getResults()`
25215 */
25216
25217/**
25218 * @typedef {Object} LeaderboardArchive
25219 * @property {string} statisticName
25220 * @property {number} version version of the leaderboard
25221 * @property {string} status
25222 * @property {string} url URL for the downloadable archive
25223 * @property {Date} activatedAt time when this version became active
25224 * @property {Date} deactivatedAt time when this version was deactivated by a version incrementing
25225 */
25226
25227/**
25228 * @class
25229 */
25230
25231function Statistic(_ref) {
25232 var name = _ref.name,
25233 value = _ref.value,
25234 version = _ref.version;
25235
25236 /**
25237 * @type {string}
25238 */
25239 this.name = name;
25240 /**
25241 * @type {number}
25242 */
25243
25244 this.value = value;
25245 /**
25246 * @type {number?}
25247 */
25248
25249 this.version = version;
25250}
25251
25252var parseStatisticData = function parseStatisticData(statisticData) {
25253 var _AV$_decode = AV._decode(statisticData),
25254 name = _AV$_decode.statisticName,
25255 value = _AV$_decode.statisticValue,
25256 version = _AV$_decode.version;
25257
25258 return new Statistic({
25259 name: name,
25260 value: value,
25261 version: version
25262 });
25263};
25264/**
25265 * @class
25266 */
25267
25268
25269AV.Leaderboard = function Leaderboard(statisticName) {
25270 /**
25271 * @type {string}
25272 */
25273 this.statisticName = statisticName;
25274 /**
25275 * @type {AV.LeaderboardOrder}
25276 */
25277
25278 this.order = undefined;
25279 /**
25280 * @type {AV.LeaderboardUpdateStrategy}
25281 */
25282
25283 this.updateStrategy = undefined;
25284 /**
25285 * @type {AV.LeaderboardVersionChangeInterval}
25286 */
25287
25288 this.versionChangeInterval = undefined;
25289 /**
25290 * @type {number}
25291 */
25292
25293 this.version = undefined;
25294 /**
25295 * @type {Date?}
25296 */
25297
25298 this.nextResetAt = undefined;
25299 /**
25300 * @type {Date?}
25301 */
25302
25303 this.createdAt = undefined;
25304};
25305
25306var Leaderboard = AV.Leaderboard;
25307/**
25308 * Create an instance of Leaderboard for the give statistic name.
25309 * @param {string} statisticName
25310 * @return {AV.Leaderboard}
25311 */
25312
25313AV.Leaderboard.createWithoutData = function (statisticName) {
25314 return new Leaderboard(statisticName);
25315};
25316/**
25317 * (masterKey required) Create a new Leaderboard.
25318 * @param {Object} options
25319 * @param {string} options.statisticName
25320 * @param {AV.LeaderboardOrder} options.order
25321 * @param {AV.LeaderboardVersionChangeInterval} [options.versionChangeInterval] default to WEEK
25322 * @param {AV.LeaderboardUpdateStrategy} [options.updateStrategy] default to BETTER
25323 * @param {AuthOptions} [authOptions]
25324 * @return {Promise<AV.Leaderboard>}
25325 */
25326
25327
25328AV.Leaderboard.createLeaderboard = function (_ref2, authOptions) {
25329 var statisticName = _ref2.statisticName,
25330 order = _ref2.order,
25331 versionChangeInterval = _ref2.versionChangeInterval,
25332 updateStrategy = _ref2.updateStrategy;
25333 return request({
25334 method: 'POST',
25335 path: '/leaderboard/leaderboards',
25336 data: {
25337 statisticName: statisticName,
25338 order: order,
25339 versionChangeInterval: versionChangeInterval,
25340 updateStrategy: updateStrategy
25341 },
25342 authOptions: authOptions
25343 }).then(function (data) {
25344 var leaderboard = new Leaderboard(statisticName);
25345 return leaderboard._finishFetch(data);
25346 });
25347};
25348/**
25349 * Get the Leaderboard with the specified statistic name.
25350 * @param {string} statisticName
25351 * @param {AuthOptions} [authOptions]
25352 * @return {Promise<AV.Leaderboard>}
25353 */
25354
25355
25356AV.Leaderboard.getLeaderboard = function (statisticName, authOptions) {
25357 return Leaderboard.createWithoutData(statisticName).fetch(authOptions);
25358};
25359/**
25360 * Get Statistics for the specified user.
25361 * @param {AV.User} user The specified AV.User pointer.
25362 * @param {Object} [options]
25363 * @param {string[]} [options.statisticNames] Specify the statisticNames. If not set, all statistics of the user will be fetched.
25364 * @param {AuthOptions} [authOptions]
25365 * @return {Promise<Statistic[]>}
25366 */
25367
25368
25369AV.Leaderboard.getStatistics = function (user) {
25370 var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
25371 statisticNames = _ref3.statisticNames;
25372
25373 var authOptions = arguments.length > 2 ? arguments[2] : undefined;
25374 return _promise.default.resolve().then(function () {
25375 if (!(user && user.id)) throw new Error('user must be an AV.User');
25376 return request({
25377 method: 'GET',
25378 path: "/leaderboard/users/".concat(user.id, "/statistics"),
25379 query: {
25380 statistics: statisticNames ? ensureArray(statisticNames).join(',') : undefined
25381 },
25382 authOptions: authOptions
25383 }).then(function (_ref4) {
25384 var results = _ref4.results;
25385 return (0, _map.default)(results).call(results, parseStatisticData);
25386 });
25387 });
25388};
25389/**
25390 * Update Statistics for the specified user.
25391 * @param {AV.User} user The specified AV.User pointer.
25392 * @param {Object} statistics A name-value pair representing the statistics to update.
25393 * @param {AuthOptions} [options] AuthOptions plus:
25394 * @param {boolean} [options.overwrite] Wethere to overwrite these statistics disregarding the updateStrategy of there leaderboards
25395 * @return {Promise<Statistic[]>}
25396 */
25397
25398
25399AV.Leaderboard.updateStatistics = function (user, statistics) {
25400 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25401 return _promise.default.resolve().then(function () {
25402 if (!(user && user.id)) throw new Error('user must be an AV.User');
25403 var data = (0, _map.default)(_).call(_, statistics, function (value, key) {
25404 return {
25405 statisticName: key,
25406 statisticValue: value
25407 };
25408 });
25409 var overwrite = options.overwrite;
25410 return request({
25411 method: 'POST',
25412 path: "/leaderboard/users/".concat(user.id, "/statistics"),
25413 query: {
25414 overwrite: overwrite ? 1 : undefined
25415 },
25416 data: data,
25417 authOptions: options
25418 }).then(function (_ref5) {
25419 var results = _ref5.results;
25420 return (0, _map.default)(results).call(results, parseStatisticData);
25421 });
25422 });
25423};
25424/**
25425 * Delete Statistics for the specified user.
25426 * @param {AV.User} user The specified AV.User pointer.
25427 * @param {Object} statistics A name-value pair representing the statistics to delete.
25428 * @param {AuthOptions} [options]
25429 * @return {Promise<void>}
25430 */
25431
25432
25433AV.Leaderboard.deleteStatistics = function (user, statisticNames, authOptions) {
25434 return _promise.default.resolve().then(function () {
25435 if (!(user && user.id)) throw new Error('user must be an AV.User');
25436 return request({
25437 method: 'DELETE',
25438 path: "/leaderboard/users/".concat(user.id, "/statistics"),
25439 query: {
25440 statistics: ensureArray(statisticNames).join(',')
25441 },
25442 authOptions: authOptions
25443 }).then(function () {
25444 return undefined;
25445 });
25446 });
25447};
25448
25449_.extend(Leaderboard.prototype,
25450/** @lends AV.Leaderboard.prototype */
25451{
25452 _finishFetch: function _finishFetch(data) {
25453 var _this = this;
25454
25455 _.forEach(data, function (value, key) {
25456 if (key === 'updatedAt' || key === 'objectId') return;
25457
25458 if (key === 'expiredAt') {
25459 key = 'nextResetAt';
25460 }
25461
25462 if (key === 'createdAt') {
25463 value = parseDate(value);
25464 }
25465
25466 if (value && value.__type === 'Date') {
25467 value = parseDate(value.iso);
25468 }
25469
25470 _this[key] = value;
25471 });
25472
25473 return this;
25474 },
25475
25476 /**
25477 * Fetch data from the srever.
25478 * @param {AuthOptions} [authOptions]
25479 * @return {Promise<AV.Leaderboard>}
25480 */
25481 fetch: function fetch(authOptions) {
25482 var _this2 = this;
25483
25484 return request({
25485 method: 'GET',
25486 path: "/leaderboard/leaderboards/".concat(this.statisticName),
25487 authOptions: authOptions
25488 }).then(function (data) {
25489 return _this2._finishFetch(data);
25490 });
25491 },
25492
25493 /**
25494 * Counts the number of users participated in this leaderboard
25495 * @param {Object} [options]
25496 * @param {number} [options.version] Specify the version of the leaderboard
25497 * @param {AuthOptions} [authOptions]
25498 * @return {Promise<number>}
25499 */
25500 count: function count() {
25501 var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
25502 version = _ref6.version;
25503
25504 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
25505 return request({
25506 method: 'GET',
25507 path: "/leaderboard/leaderboards/".concat(this.statisticName, "/ranks"),
25508 query: {
25509 count: 1,
25510 limit: 0,
25511 version: version
25512 },
25513 authOptions: authOptions
25514 }).then(function (_ref7) {
25515 var count = _ref7.count;
25516 return count;
25517 });
25518 },
25519 _getResults: function _getResults(_ref8, authOptions, userId) {
25520 var _context;
25521
25522 var skip = _ref8.skip,
25523 limit = _ref8.limit,
25524 selectUserKeys = _ref8.selectUserKeys,
25525 includeUserKeys = _ref8.includeUserKeys,
25526 includeStatistics = _ref8.includeStatistics,
25527 version = _ref8.version;
25528 return request({
25529 method: 'GET',
25530 path: (0, _concat.default)(_context = "/leaderboard/leaderboards/".concat(this.statisticName, "/ranks")).call(_context, userId ? "/".concat(userId) : ''),
25531 query: {
25532 skip: skip,
25533 limit: limit,
25534 selectUserKeys: _.union(ensureArray(selectUserKeys), ensureArray(includeUserKeys)).join(',') || undefined,
25535 includeUser: includeUserKeys ? ensureArray(includeUserKeys).join(',') : undefined,
25536 includeStatistics: includeStatistics ? ensureArray(includeStatistics).join(',') : undefined,
25537 version: version
25538 },
25539 authOptions: authOptions
25540 }).then(function (_ref9) {
25541 var rankings = _ref9.results;
25542 return (0, _map.default)(rankings).call(rankings, function (rankingData) {
25543 var _AV$_decode2 = AV._decode(rankingData),
25544 user = _AV$_decode2.user,
25545 value = _AV$_decode2.statisticValue,
25546 rank = _AV$_decode2.rank,
25547 _AV$_decode2$statisti = _AV$_decode2.statistics,
25548 statistics = _AV$_decode2$statisti === void 0 ? [] : _AV$_decode2$statisti;
25549
25550 return {
25551 user: user,
25552 value: value,
25553 rank: rank,
25554 includedStatistics: (0, _map.default)(statistics).call(statistics, parseStatisticData)
25555 };
25556 });
25557 });
25558 },
25559
25560 /**
25561 * Retrieve a list of ranked users for this Leaderboard.
25562 * @param {Object} [options]
25563 * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
25564 * @param {number} [options.limit] The limit of the number of results.
25565 * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
25566 * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
25567 * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
25568 * @param {number} [options.version] Specify the version of the leaderboard
25569 * @param {AuthOptions} [authOptions]
25570 * @return {Promise<Ranking[]>}
25571 */
25572 getResults: function getResults() {
25573 var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
25574 skip = _ref10.skip,
25575 limit = _ref10.limit,
25576 selectUserKeys = _ref10.selectUserKeys,
25577 includeUserKeys = _ref10.includeUserKeys,
25578 includeStatistics = _ref10.includeStatistics,
25579 version = _ref10.version;
25580
25581 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
25582 return this._getResults({
25583 skip: skip,
25584 limit: limit,
25585 selectUserKeys: selectUserKeys,
25586 includeUserKeys: includeUserKeys,
25587 includeStatistics: includeStatistics,
25588 version: version
25589 }, authOptions);
25590 },
25591
25592 /**
25593 * Retrieve a list of ranked users for this Leaderboard, centered on the specified user.
25594 * @param {AV.User} user The specified AV.User pointer.
25595 * @param {Object} [options]
25596 * @param {number} [options.limit] The limit of the number of results.
25597 * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
25598 * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
25599 * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
25600 * @param {number} [options.version] Specify the version of the leaderboard
25601 * @param {AuthOptions} [authOptions]
25602 * @return {Promise<Ranking[]>}
25603 */
25604 getResultsAroundUser: function getResultsAroundUser(user) {
25605 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25606 var authOptions = arguments.length > 2 ? arguments[2] : undefined;
25607
25608 // getResultsAroundUser(options, authOptions)
25609 if (user && typeof user.id !== 'string') {
25610 return this.getResultsAroundUser(undefined, user, options);
25611 }
25612
25613 var limit = options.limit,
25614 selectUserKeys = options.selectUserKeys,
25615 includeUserKeys = options.includeUserKeys,
25616 includeStatistics = options.includeStatistics,
25617 version = options.version;
25618 return this._getResults({
25619 limit: limit,
25620 selectUserKeys: selectUserKeys,
25621 includeUserKeys: includeUserKeys,
25622 includeStatistics: includeStatistics,
25623 version: version
25624 }, authOptions, user ? user.id : 'self');
25625 },
25626 _update: function _update(data, authOptions) {
25627 var _this3 = this;
25628
25629 return request({
25630 method: 'PUT',
25631 path: "/leaderboard/leaderboards/".concat(this.statisticName),
25632 data: data,
25633 authOptions: authOptions
25634 }).then(function (result) {
25635 return _this3._finishFetch(result);
25636 });
25637 },
25638
25639 /**
25640 * (masterKey required) Update the version change interval of the Leaderboard.
25641 * @param {AV.LeaderboardVersionChangeInterval} versionChangeInterval
25642 * @param {AuthOptions} [authOptions]
25643 * @return {Promise<AV.Leaderboard>}
25644 */
25645 updateVersionChangeInterval: function updateVersionChangeInterval(versionChangeInterval, authOptions) {
25646 return this._update({
25647 versionChangeInterval: versionChangeInterval
25648 }, authOptions);
25649 },
25650
25651 /**
25652 * (masterKey required) Update the version change interval of the Leaderboard.
25653 * @param {AV.LeaderboardUpdateStrategy} updateStrategy
25654 * @param {AuthOptions} [authOptions]
25655 * @return {Promise<AV.Leaderboard>}
25656 */
25657 updateUpdateStrategy: function updateUpdateStrategy(updateStrategy, authOptions) {
25658 return this._update({
25659 updateStrategy: updateStrategy
25660 }, authOptions);
25661 },
25662
25663 /**
25664 * (masterKey required) Reset the Leaderboard. The version of the Leaderboard will be incremented by 1.
25665 * @param {AuthOptions} [authOptions]
25666 * @return {Promise<AV.Leaderboard>}
25667 */
25668 reset: function reset(authOptions) {
25669 var _this4 = this;
25670
25671 return request({
25672 method: 'PUT',
25673 path: "/leaderboard/leaderboards/".concat(this.statisticName, "/incrementVersion"),
25674 authOptions: authOptions
25675 }).then(function (data) {
25676 return _this4._finishFetch(data);
25677 });
25678 },
25679
25680 /**
25681 * (masterKey required) Delete the Leaderboard and its all archived versions.
25682 * @param {AuthOptions} [authOptions]
25683 * @return {void}
25684 */
25685 destroy: function destroy(authOptions) {
25686 return AV.request({
25687 method: 'DELETE',
25688 path: "/leaderboard/leaderboards/".concat(this.statisticName),
25689 authOptions: authOptions
25690 }).then(function () {
25691 return undefined;
25692 });
25693 },
25694
25695 /**
25696 * (masterKey required) Get archived versions.
25697 * @param {Object} [options]
25698 * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
25699 * @param {number} [options.limit] The limit of the number of results.
25700 * @param {AuthOptions} [authOptions]
25701 * @return {Promise<LeaderboardArchive[]>}
25702 */
25703 getArchives: function getArchives() {
25704 var _this5 = this;
25705
25706 var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
25707 skip = _ref11.skip,
25708 limit = _ref11.limit;
25709
25710 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
25711 return request({
25712 method: 'GET',
25713 path: "/leaderboard/leaderboards/".concat(this.statisticName, "/archives"),
25714 query: {
25715 skip: skip,
25716 limit: limit
25717 },
25718 authOptions: authOptions
25719 }).then(function (_ref12) {
25720 var results = _ref12.results;
25721 return (0, _map.default)(results).call(results, function (_ref13) {
25722 var version = _ref13.version,
25723 status = _ref13.status,
25724 url = _ref13.url,
25725 activatedAt = _ref13.activatedAt,
25726 deactivatedAt = _ref13.deactivatedAt;
25727 return {
25728 statisticName: _this5.statisticName,
25729 version: version,
25730 status: status,
25731 url: url,
25732 activatedAt: parseDate(activatedAt.iso),
25733 deactivatedAt: parseDate(deactivatedAt.iso)
25734 };
25735 });
25736 });
25737 }
25738});
25739
25740/***/ }),
25741/* 565 */
25742/***/ (function(module, exports, __webpack_require__) {
25743
25744"use strict";
25745
25746
25747var _require = __webpack_require__(149),
25748 Realtime = _require.Realtime,
25749 setRTMAdapters = _require.setAdapters;
25750
25751var _require2 = __webpack_require__(655),
25752 LiveQueryPlugin = _require2.LiveQueryPlugin;
25753
25754Realtime.__preRegisteredPlugins = [LiveQueryPlugin];
25755
25756module.exports = function (AV) {
25757 AV._sharedConfig.liveQueryRealtime = Realtime;
25758 var setAdapters = AV.setAdapters;
25759
25760 AV.setAdapters = function (adapters) {
25761 setAdapters(adapters);
25762 setRTMAdapters(adapters);
25763 };
25764
25765 return AV;
25766};
25767
25768/***/ }),
25769/* 566 */
25770/***/ (function(module, exports, __webpack_require__) {
25771
25772"use strict";
25773/* WEBPACK VAR INJECTION */(function(global) {
25774
25775var _interopRequireDefault = __webpack_require__(1);
25776
25777var _typeof3 = _interopRequireDefault(__webpack_require__(91));
25778
25779var _defineProperty2 = _interopRequireDefault(__webpack_require__(114));
25780
25781var _freeze = _interopRequireDefault(__webpack_require__(567));
25782
25783var _assign = _interopRequireDefault(__webpack_require__(256));
25784
25785var _symbol = _interopRequireDefault(__webpack_require__(247));
25786
25787var _concat = _interopRequireDefault(__webpack_require__(22));
25788
25789var _keys = _interopRequireDefault(__webpack_require__(146));
25790
25791var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(257));
25792
25793var _filter = _interopRequireDefault(__webpack_require__(243));
25794
25795var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(253));
25796
25797var _getOwnPropertyDescriptors = _interopRequireDefault(__webpack_require__(578));
25798
25799var _defineProperties = _interopRequireDefault(__webpack_require__(582));
25800
25801var _promise = _interopRequireDefault(__webpack_require__(13));
25802
25803var _slice = _interopRequireDefault(__webpack_require__(59));
25804
25805var _indexOf = _interopRequireDefault(__webpack_require__(90));
25806
25807var _weakMap = _interopRequireDefault(__webpack_require__(586));
25808
25809var _stringify = _interopRequireDefault(__webpack_require__(36));
25810
25811var _map = _interopRequireDefault(__webpack_require__(35));
25812
25813var _reduce = _interopRequireDefault(__webpack_require__(592));
25814
25815var _find = _interopRequireDefault(__webpack_require__(92));
25816
25817var _set = _interopRequireDefault(__webpack_require__(259));
25818
25819var _context6, _context15;
25820
25821(0, _defineProperty2.default)(exports, '__esModule', {
25822 value: true
25823});
25824
25825function _interopDefault(ex) {
25826 return ex && (0, _typeof3.default)(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
25827}
25828
25829var protobufLight = _interopDefault(__webpack_require__(603));
25830
25831var EventEmitter = _interopDefault(__webpack_require__(607));
25832
25833var _regeneratorRuntime = _interopDefault(__webpack_require__(608));
25834
25835var _asyncToGenerator = _interopDefault(__webpack_require__(610));
25836
25837var _toConsumableArray = _interopDefault(__webpack_require__(611));
25838
25839var _defineProperty = _interopDefault(__webpack_require__(614));
25840
25841var _objectWithoutProperties = _interopDefault(__webpack_require__(615));
25842
25843var _assertThisInitialized = _interopDefault(__webpack_require__(617));
25844
25845var _inheritsLoose = _interopDefault(__webpack_require__(618));
25846
25847var d = _interopDefault(__webpack_require__(58));
25848
25849var shuffle = _interopDefault(__webpack_require__(619));
25850
25851var values = _interopDefault(__webpack_require__(264));
25852
25853var _toArray = _interopDefault(__webpack_require__(646));
25854
25855var _createClass = _interopDefault(__webpack_require__(649));
25856
25857var _applyDecoratedDescriptor = _interopDefault(__webpack_require__(650));
25858
25859var StateMachine = _interopDefault(__webpack_require__(651));
25860
25861var _typeof = _interopDefault(__webpack_require__(652));
25862
25863var isPlainObject = _interopDefault(__webpack_require__(653));
25864
25865var promiseTimeout = __webpack_require__(244);
25866
25867var messageCompiled = protobufLight.newBuilder({})['import']({
25868 "package": 'push_server.messages2',
25869 syntax: 'proto2',
25870 options: {
25871 objc_class_prefix: 'AVIM'
25872 },
25873 messages: [{
25874 name: 'JsonObjectMessage',
25875 syntax: 'proto2',
25876 fields: [{
25877 rule: 'required',
25878 type: 'string',
25879 name: 'data',
25880 id: 1
25881 }]
25882 }, {
25883 name: 'UnreadTuple',
25884 syntax: 'proto2',
25885 fields: [{
25886 rule: 'required',
25887 type: 'string',
25888 name: 'cid',
25889 id: 1
25890 }, {
25891 rule: 'required',
25892 type: 'int32',
25893 name: 'unread',
25894 id: 2
25895 }, {
25896 rule: 'optional',
25897 type: 'string',
25898 name: 'mid',
25899 id: 3
25900 }, {
25901 rule: 'optional',
25902 type: 'int64',
25903 name: 'timestamp',
25904 id: 4
25905 }, {
25906 rule: 'optional',
25907 type: 'string',
25908 name: 'from',
25909 id: 5
25910 }, {
25911 rule: 'optional',
25912 type: 'string',
25913 name: 'data',
25914 id: 6
25915 }, {
25916 rule: 'optional',
25917 type: 'int64',
25918 name: 'patchTimestamp',
25919 id: 7
25920 }, {
25921 rule: 'optional',
25922 type: 'bool',
25923 name: 'mentioned',
25924 id: 8
25925 }, {
25926 rule: 'optional',
25927 type: 'bytes',
25928 name: 'binaryMsg',
25929 id: 9
25930 }, {
25931 rule: 'optional',
25932 type: 'int32',
25933 name: 'convType',
25934 id: 10
25935 }]
25936 }, {
25937 name: 'LogItem',
25938 syntax: 'proto2',
25939 fields: [{
25940 rule: 'optional',
25941 type: 'string',
25942 name: 'from',
25943 id: 1
25944 }, {
25945 rule: 'optional',
25946 type: 'string',
25947 name: 'data',
25948 id: 2
25949 }, {
25950 rule: 'optional',
25951 type: 'int64',
25952 name: 'timestamp',
25953 id: 3
25954 }, {
25955 rule: 'optional',
25956 type: 'string',
25957 name: 'msgId',
25958 id: 4
25959 }, {
25960 rule: 'optional',
25961 type: 'int64',
25962 name: 'ackAt',
25963 id: 5
25964 }, {
25965 rule: 'optional',
25966 type: 'int64',
25967 name: 'readAt',
25968 id: 6
25969 }, {
25970 rule: 'optional',
25971 type: 'int64',
25972 name: 'patchTimestamp',
25973 id: 7
25974 }, {
25975 rule: 'optional',
25976 type: 'bool',
25977 name: 'mentionAll',
25978 id: 8
25979 }, {
25980 rule: 'repeated',
25981 type: 'string',
25982 name: 'mentionPids',
25983 id: 9
25984 }, {
25985 rule: 'optional',
25986 type: 'bool',
25987 name: 'bin',
25988 id: 10
25989 }, {
25990 rule: 'optional',
25991 type: 'int32',
25992 name: 'convType',
25993 id: 11
25994 }]
25995 }, {
25996 name: 'ConvMemberInfo',
25997 syntax: 'proto2',
25998 fields: [{
25999 rule: 'optional',
26000 type: 'string',
26001 name: 'pid',
26002 id: 1
26003 }, {
26004 rule: 'optional',
26005 type: 'string',
26006 name: 'role',
26007 id: 2
26008 }, {
26009 rule: 'optional',
26010 type: 'string',
26011 name: 'infoId',
26012 id: 3
26013 }]
26014 }, {
26015 name: 'DataCommand',
26016 syntax: 'proto2',
26017 fields: [{
26018 rule: 'repeated',
26019 type: 'string',
26020 name: 'ids',
26021 id: 1
26022 }, {
26023 rule: 'repeated',
26024 type: 'JsonObjectMessage',
26025 name: 'msg',
26026 id: 2
26027 }, {
26028 rule: 'optional',
26029 type: 'bool',
26030 name: 'offline',
26031 id: 3
26032 }]
26033 }, {
26034 name: 'SessionCommand',
26035 syntax: 'proto2',
26036 fields: [{
26037 rule: 'optional',
26038 type: 'int64',
26039 name: 't',
26040 id: 1
26041 }, {
26042 rule: 'optional',
26043 type: 'string',
26044 name: 'n',
26045 id: 2
26046 }, {
26047 rule: 'optional',
26048 type: 'string',
26049 name: 's',
26050 id: 3
26051 }, {
26052 rule: 'optional',
26053 type: 'string',
26054 name: 'ua',
26055 id: 4
26056 }, {
26057 rule: 'optional',
26058 type: 'bool',
26059 name: 'r',
26060 id: 5
26061 }, {
26062 rule: 'optional',
26063 type: 'string',
26064 name: 'tag',
26065 id: 6
26066 }, {
26067 rule: 'optional',
26068 type: 'string',
26069 name: 'deviceId',
26070 id: 7
26071 }, {
26072 rule: 'repeated',
26073 type: 'string',
26074 name: 'sessionPeerIds',
26075 id: 8
26076 }, {
26077 rule: 'repeated',
26078 type: 'string',
26079 name: 'onlineSessionPeerIds',
26080 id: 9
26081 }, {
26082 rule: 'optional',
26083 type: 'string',
26084 name: 'st',
26085 id: 10
26086 }, {
26087 rule: 'optional',
26088 type: 'int32',
26089 name: 'stTtl',
26090 id: 11
26091 }, {
26092 rule: 'optional',
26093 type: 'int32',
26094 name: 'code',
26095 id: 12
26096 }, {
26097 rule: 'optional',
26098 type: 'string',
26099 name: 'reason',
26100 id: 13
26101 }, {
26102 rule: 'optional',
26103 type: 'string',
26104 name: 'deviceToken',
26105 id: 14
26106 }, {
26107 rule: 'optional',
26108 type: 'bool',
26109 name: 'sp',
26110 id: 15
26111 }, {
26112 rule: 'optional',
26113 type: 'string',
26114 name: 'detail',
26115 id: 16
26116 }, {
26117 rule: 'optional',
26118 type: 'int64',
26119 name: 'lastUnreadNotifTime',
26120 id: 17
26121 }, {
26122 rule: 'optional',
26123 type: 'int64',
26124 name: 'lastPatchTime',
26125 id: 18
26126 }, {
26127 rule: 'optional',
26128 type: 'int64',
26129 name: 'configBitmap',
26130 id: 19
26131 }]
26132 }, {
26133 name: 'ErrorCommand',
26134 syntax: 'proto2',
26135 fields: [{
26136 rule: 'required',
26137 type: 'int32',
26138 name: 'code',
26139 id: 1
26140 }, {
26141 rule: 'required',
26142 type: 'string',
26143 name: 'reason',
26144 id: 2
26145 }, {
26146 rule: 'optional',
26147 type: 'int32',
26148 name: 'appCode',
26149 id: 3
26150 }, {
26151 rule: 'optional',
26152 type: 'string',
26153 name: 'detail',
26154 id: 4
26155 }, {
26156 rule: 'repeated',
26157 type: 'string',
26158 name: 'pids',
26159 id: 5
26160 }, {
26161 rule: 'optional',
26162 type: 'string',
26163 name: 'appMsg',
26164 id: 6
26165 }]
26166 }, {
26167 name: 'DirectCommand',
26168 syntax: 'proto2',
26169 fields: [{
26170 rule: 'optional',
26171 type: 'string',
26172 name: 'msg',
26173 id: 1
26174 }, {
26175 rule: 'optional',
26176 type: 'string',
26177 name: 'uid',
26178 id: 2
26179 }, {
26180 rule: 'optional',
26181 type: 'string',
26182 name: 'fromPeerId',
26183 id: 3
26184 }, {
26185 rule: 'optional',
26186 type: 'int64',
26187 name: 'timestamp',
26188 id: 4
26189 }, {
26190 rule: 'optional',
26191 type: 'bool',
26192 name: 'offline',
26193 id: 5
26194 }, {
26195 rule: 'optional',
26196 type: 'bool',
26197 name: 'hasMore',
26198 id: 6
26199 }, {
26200 rule: 'repeated',
26201 type: 'string',
26202 name: 'toPeerIds',
26203 id: 7
26204 }, {
26205 rule: 'optional',
26206 type: 'bool',
26207 name: 'r',
26208 id: 10
26209 }, {
26210 rule: 'optional',
26211 type: 'string',
26212 name: 'cid',
26213 id: 11
26214 }, {
26215 rule: 'optional',
26216 type: 'string',
26217 name: 'id',
26218 id: 12
26219 }, {
26220 rule: 'optional',
26221 type: 'bool',
26222 name: 'transient',
26223 id: 13
26224 }, {
26225 rule: 'optional',
26226 type: 'string',
26227 name: 'dt',
26228 id: 14
26229 }, {
26230 rule: 'optional',
26231 type: 'string',
26232 name: 'roomId',
26233 id: 15
26234 }, {
26235 rule: 'optional',
26236 type: 'string',
26237 name: 'pushData',
26238 id: 16
26239 }, {
26240 rule: 'optional',
26241 type: 'bool',
26242 name: 'will',
26243 id: 17
26244 }, {
26245 rule: 'optional',
26246 type: 'int64',
26247 name: 'patchTimestamp',
26248 id: 18
26249 }, {
26250 rule: 'optional',
26251 type: 'bytes',
26252 name: 'binaryMsg',
26253 id: 19
26254 }, {
26255 rule: 'repeated',
26256 type: 'string',
26257 name: 'mentionPids',
26258 id: 20
26259 }, {
26260 rule: 'optional',
26261 type: 'bool',
26262 name: 'mentionAll',
26263 id: 21
26264 }, {
26265 rule: 'optional',
26266 type: 'int32',
26267 name: 'convType',
26268 id: 22
26269 }]
26270 }, {
26271 name: 'AckCommand',
26272 syntax: 'proto2',
26273 fields: [{
26274 rule: 'optional',
26275 type: 'int32',
26276 name: 'code',
26277 id: 1
26278 }, {
26279 rule: 'optional',
26280 type: 'string',
26281 name: 'reason',
26282 id: 2
26283 }, {
26284 rule: 'optional',
26285 type: 'string',
26286 name: 'mid',
26287 id: 3
26288 }, {
26289 rule: 'optional',
26290 type: 'string',
26291 name: 'cid',
26292 id: 4
26293 }, {
26294 rule: 'optional',
26295 type: 'int64',
26296 name: 't',
26297 id: 5
26298 }, {
26299 rule: 'optional',
26300 type: 'string',
26301 name: 'uid',
26302 id: 6
26303 }, {
26304 rule: 'optional',
26305 type: 'int64',
26306 name: 'fromts',
26307 id: 7
26308 }, {
26309 rule: 'optional',
26310 type: 'int64',
26311 name: 'tots',
26312 id: 8
26313 }, {
26314 rule: 'optional',
26315 type: 'string',
26316 name: 'type',
26317 id: 9
26318 }, {
26319 rule: 'repeated',
26320 type: 'string',
26321 name: 'ids',
26322 id: 10
26323 }, {
26324 rule: 'optional',
26325 type: 'int32',
26326 name: 'appCode',
26327 id: 11
26328 }, {
26329 rule: 'optional',
26330 type: 'string',
26331 name: 'appMsg',
26332 id: 12
26333 }]
26334 }, {
26335 name: 'UnreadCommand',
26336 syntax: 'proto2',
26337 fields: [{
26338 rule: 'repeated',
26339 type: 'UnreadTuple',
26340 name: 'convs',
26341 id: 1
26342 }, {
26343 rule: 'optional',
26344 type: 'int64',
26345 name: 'notifTime',
26346 id: 2
26347 }]
26348 }, {
26349 name: 'ConvCommand',
26350 syntax: 'proto2',
26351 fields: [{
26352 rule: 'repeated',
26353 type: 'string',
26354 name: 'm',
26355 id: 1
26356 }, {
26357 rule: 'optional',
26358 type: 'bool',
26359 name: 'transient',
26360 id: 2
26361 }, {
26362 rule: 'optional',
26363 type: 'bool',
26364 name: 'unique',
26365 id: 3
26366 }, {
26367 rule: 'optional',
26368 type: 'string',
26369 name: 'cid',
26370 id: 4
26371 }, {
26372 rule: 'optional',
26373 type: 'string',
26374 name: 'cdate',
26375 id: 5
26376 }, {
26377 rule: 'optional',
26378 type: 'string',
26379 name: 'initBy',
26380 id: 6
26381 }, {
26382 rule: 'optional',
26383 type: 'string',
26384 name: 'sort',
26385 id: 7
26386 }, {
26387 rule: 'optional',
26388 type: 'int32',
26389 name: 'limit',
26390 id: 8
26391 }, {
26392 rule: 'optional',
26393 type: 'int32',
26394 name: 'skip',
26395 id: 9
26396 }, {
26397 rule: 'optional',
26398 type: 'int32',
26399 name: 'flag',
26400 id: 10
26401 }, {
26402 rule: 'optional',
26403 type: 'int32',
26404 name: 'count',
26405 id: 11
26406 }, {
26407 rule: 'optional',
26408 type: 'string',
26409 name: 'udate',
26410 id: 12
26411 }, {
26412 rule: 'optional',
26413 type: 'int64',
26414 name: 't',
26415 id: 13
26416 }, {
26417 rule: 'optional',
26418 type: 'string',
26419 name: 'n',
26420 id: 14
26421 }, {
26422 rule: 'optional',
26423 type: 'string',
26424 name: 's',
26425 id: 15
26426 }, {
26427 rule: 'optional',
26428 type: 'bool',
26429 name: 'statusSub',
26430 id: 16
26431 }, {
26432 rule: 'optional',
26433 type: 'bool',
26434 name: 'statusPub',
26435 id: 17
26436 }, {
26437 rule: 'optional',
26438 type: 'int32',
26439 name: 'statusTTL',
26440 id: 18
26441 }, {
26442 rule: 'optional',
26443 type: 'string',
26444 name: 'uniqueId',
26445 id: 19
26446 }, {
26447 rule: 'optional',
26448 type: 'string',
26449 name: 'targetClientId',
26450 id: 20
26451 }, {
26452 rule: 'optional',
26453 type: 'int64',
26454 name: 'maxReadTimestamp',
26455 id: 21
26456 }, {
26457 rule: 'optional',
26458 type: 'int64',
26459 name: 'maxAckTimestamp',
26460 id: 22
26461 }, {
26462 rule: 'optional',
26463 type: 'bool',
26464 name: 'queryAllMembers',
26465 id: 23
26466 }, {
26467 rule: 'repeated',
26468 type: 'MaxReadTuple',
26469 name: 'maxReadTuples',
26470 id: 24
26471 }, {
26472 rule: 'repeated',
26473 type: 'string',
26474 name: 'cids',
26475 id: 25
26476 }, {
26477 rule: 'optional',
26478 type: 'ConvMemberInfo',
26479 name: 'info',
26480 id: 26
26481 }, {
26482 rule: 'optional',
26483 type: 'bool',
26484 name: 'tempConv',
26485 id: 27
26486 }, {
26487 rule: 'optional',
26488 type: 'int32',
26489 name: 'tempConvTTL',
26490 id: 28
26491 }, {
26492 rule: 'repeated',
26493 type: 'string',
26494 name: 'tempConvIds',
26495 id: 29
26496 }, {
26497 rule: 'repeated',
26498 type: 'string',
26499 name: 'allowedPids',
26500 id: 30
26501 }, {
26502 rule: 'repeated',
26503 type: 'ErrorCommand',
26504 name: 'failedPids',
26505 id: 31
26506 }, {
26507 rule: 'optional',
26508 type: 'string',
26509 name: 'next',
26510 id: 40
26511 }, {
26512 rule: 'optional',
26513 type: 'JsonObjectMessage',
26514 name: 'results',
26515 id: 100
26516 }, {
26517 rule: 'optional',
26518 type: 'JsonObjectMessage',
26519 name: 'where',
26520 id: 101
26521 }, {
26522 rule: 'optional',
26523 type: 'JsonObjectMessage',
26524 name: 'attr',
26525 id: 103
26526 }, {
26527 rule: 'optional',
26528 type: 'JsonObjectMessage',
26529 name: 'attrModified',
26530 id: 104
26531 }]
26532 }, {
26533 name: 'RoomCommand',
26534 syntax: 'proto2',
26535 fields: [{
26536 rule: 'optional',
26537 type: 'string',
26538 name: 'roomId',
26539 id: 1
26540 }, {
26541 rule: 'optional',
26542 type: 'string',
26543 name: 's',
26544 id: 2
26545 }, {
26546 rule: 'optional',
26547 type: 'int64',
26548 name: 't',
26549 id: 3
26550 }, {
26551 rule: 'optional',
26552 type: 'string',
26553 name: 'n',
26554 id: 4
26555 }, {
26556 rule: 'optional',
26557 type: 'bool',
26558 name: 'transient',
26559 id: 5
26560 }, {
26561 rule: 'repeated',
26562 type: 'string',
26563 name: 'roomPeerIds',
26564 id: 6
26565 }, {
26566 rule: 'optional',
26567 type: 'string',
26568 name: 'byPeerId',
26569 id: 7
26570 }]
26571 }, {
26572 name: 'LogsCommand',
26573 syntax: 'proto2',
26574 fields: [{
26575 rule: 'optional',
26576 type: 'string',
26577 name: 'cid',
26578 id: 1
26579 }, {
26580 rule: 'optional',
26581 type: 'int32',
26582 name: 'l',
26583 id: 2
26584 }, {
26585 rule: 'optional',
26586 type: 'int32',
26587 name: 'limit',
26588 id: 3
26589 }, {
26590 rule: 'optional',
26591 type: 'int64',
26592 name: 't',
26593 id: 4
26594 }, {
26595 rule: 'optional',
26596 type: 'int64',
26597 name: 'tt',
26598 id: 5
26599 }, {
26600 rule: 'optional',
26601 type: 'string',
26602 name: 'tmid',
26603 id: 6
26604 }, {
26605 rule: 'optional',
26606 type: 'string',
26607 name: 'mid',
26608 id: 7
26609 }, {
26610 rule: 'optional',
26611 type: 'string',
26612 name: 'checksum',
26613 id: 8
26614 }, {
26615 rule: 'optional',
26616 type: 'bool',
26617 name: 'stored',
26618 id: 9
26619 }, {
26620 rule: 'optional',
26621 type: 'QueryDirection',
26622 name: 'direction',
26623 id: 10,
26624 options: {
26625 "default": 'OLD'
26626 }
26627 }, {
26628 rule: 'optional',
26629 type: 'bool',
26630 name: 'tIncluded',
26631 id: 11
26632 }, {
26633 rule: 'optional',
26634 type: 'bool',
26635 name: 'ttIncluded',
26636 id: 12
26637 }, {
26638 rule: 'optional',
26639 type: 'int32',
26640 name: 'lctype',
26641 id: 13
26642 }, {
26643 rule: 'repeated',
26644 type: 'LogItem',
26645 name: 'logs',
26646 id: 105
26647 }],
26648 enums: [{
26649 name: 'QueryDirection',
26650 syntax: 'proto2',
26651 values: [{
26652 name: 'OLD',
26653 id: 1
26654 }, {
26655 name: 'NEW',
26656 id: 2
26657 }]
26658 }]
26659 }, {
26660 name: 'RcpCommand',
26661 syntax: 'proto2',
26662 fields: [{
26663 rule: 'optional',
26664 type: 'string',
26665 name: 'id',
26666 id: 1
26667 }, {
26668 rule: 'optional',
26669 type: 'string',
26670 name: 'cid',
26671 id: 2
26672 }, {
26673 rule: 'optional',
26674 type: 'int64',
26675 name: 't',
26676 id: 3
26677 }, {
26678 rule: 'optional',
26679 type: 'bool',
26680 name: 'read',
26681 id: 4
26682 }, {
26683 rule: 'optional',
26684 type: 'string',
26685 name: 'from',
26686 id: 5
26687 }]
26688 }, {
26689 name: 'ReadTuple',
26690 syntax: 'proto2',
26691 fields: [{
26692 rule: 'required',
26693 type: 'string',
26694 name: 'cid',
26695 id: 1
26696 }, {
26697 rule: 'optional',
26698 type: 'int64',
26699 name: 'timestamp',
26700 id: 2
26701 }, {
26702 rule: 'optional',
26703 type: 'string',
26704 name: 'mid',
26705 id: 3
26706 }]
26707 }, {
26708 name: 'MaxReadTuple',
26709 syntax: 'proto2',
26710 fields: [{
26711 rule: 'optional',
26712 type: 'string',
26713 name: 'pid',
26714 id: 1
26715 }, {
26716 rule: 'optional',
26717 type: 'int64',
26718 name: 'maxAckTimestamp',
26719 id: 2
26720 }, {
26721 rule: 'optional',
26722 type: 'int64',
26723 name: 'maxReadTimestamp',
26724 id: 3
26725 }]
26726 }, {
26727 name: 'ReadCommand',
26728 syntax: 'proto2',
26729 fields: [{
26730 rule: 'optional',
26731 type: 'string',
26732 name: 'cid',
26733 id: 1
26734 }, {
26735 rule: 'repeated',
26736 type: 'string',
26737 name: 'cids',
26738 id: 2
26739 }, {
26740 rule: 'repeated',
26741 type: 'ReadTuple',
26742 name: 'convs',
26743 id: 3
26744 }]
26745 }, {
26746 name: 'PresenceCommand',
26747 syntax: 'proto2',
26748 fields: [{
26749 rule: 'optional',
26750 type: 'StatusType',
26751 name: 'status',
26752 id: 1
26753 }, {
26754 rule: 'repeated',
26755 type: 'string',
26756 name: 'sessionPeerIds',
26757 id: 2
26758 }, {
26759 rule: 'optional',
26760 type: 'string',
26761 name: 'cid',
26762 id: 3
26763 }]
26764 }, {
26765 name: 'ReportCommand',
26766 syntax: 'proto2',
26767 fields: [{
26768 rule: 'optional',
26769 type: 'bool',
26770 name: 'initiative',
26771 id: 1
26772 }, {
26773 rule: 'optional',
26774 type: 'string',
26775 name: 'type',
26776 id: 2
26777 }, {
26778 rule: 'optional',
26779 type: 'string',
26780 name: 'data',
26781 id: 3
26782 }]
26783 }, {
26784 name: 'PatchItem',
26785 syntax: 'proto2',
26786 fields: [{
26787 rule: 'optional',
26788 type: 'string',
26789 name: 'cid',
26790 id: 1
26791 }, {
26792 rule: 'optional',
26793 type: 'string',
26794 name: 'mid',
26795 id: 2
26796 }, {
26797 rule: 'optional',
26798 type: 'int64',
26799 name: 'timestamp',
26800 id: 3
26801 }, {
26802 rule: 'optional',
26803 type: 'bool',
26804 name: 'recall',
26805 id: 4
26806 }, {
26807 rule: 'optional',
26808 type: 'string',
26809 name: 'data',
26810 id: 5
26811 }, {
26812 rule: 'optional',
26813 type: 'int64',
26814 name: 'patchTimestamp',
26815 id: 6
26816 }, {
26817 rule: 'optional',
26818 type: 'string',
26819 name: 'from',
26820 id: 7
26821 }, {
26822 rule: 'optional',
26823 type: 'bytes',
26824 name: 'binaryMsg',
26825 id: 8
26826 }, {
26827 rule: 'optional',
26828 type: 'bool',
26829 name: 'mentionAll',
26830 id: 9
26831 }, {
26832 rule: 'repeated',
26833 type: 'string',
26834 name: 'mentionPids',
26835 id: 10
26836 }, {
26837 rule: 'optional',
26838 type: 'int64',
26839 name: 'patchCode',
26840 id: 11
26841 }, {
26842 rule: 'optional',
26843 type: 'string',
26844 name: 'patchReason',
26845 id: 12
26846 }]
26847 }, {
26848 name: 'PatchCommand',
26849 syntax: 'proto2',
26850 fields: [{
26851 rule: 'repeated',
26852 type: 'PatchItem',
26853 name: 'patches',
26854 id: 1
26855 }, {
26856 rule: 'optional',
26857 type: 'int64',
26858 name: 'lastPatchTime',
26859 id: 2
26860 }]
26861 }, {
26862 name: 'PubsubCommand',
26863 syntax: 'proto2',
26864 fields: [{
26865 rule: 'optional',
26866 type: 'string',
26867 name: 'cid',
26868 id: 1
26869 }, {
26870 rule: 'repeated',
26871 type: 'string',
26872 name: 'cids',
26873 id: 2
26874 }, {
26875 rule: 'optional',
26876 type: 'string',
26877 name: 'topic',
26878 id: 3
26879 }, {
26880 rule: 'optional',
26881 type: 'string',
26882 name: 'subtopic',
26883 id: 4
26884 }, {
26885 rule: 'repeated',
26886 type: 'string',
26887 name: 'topics',
26888 id: 5
26889 }, {
26890 rule: 'repeated',
26891 type: 'string',
26892 name: 'subtopics',
26893 id: 6
26894 }, {
26895 rule: 'optional',
26896 type: 'JsonObjectMessage',
26897 name: 'results',
26898 id: 7
26899 }]
26900 }, {
26901 name: 'BlacklistCommand',
26902 syntax: 'proto2',
26903 fields: [{
26904 rule: 'optional',
26905 type: 'string',
26906 name: 'srcCid',
26907 id: 1
26908 }, {
26909 rule: 'repeated',
26910 type: 'string',
26911 name: 'toPids',
26912 id: 2
26913 }, {
26914 rule: 'optional',
26915 type: 'string',
26916 name: 'srcPid',
26917 id: 3
26918 }, {
26919 rule: 'repeated',
26920 type: 'string',
26921 name: 'toCids',
26922 id: 4
26923 }, {
26924 rule: 'optional',
26925 type: 'int32',
26926 name: 'limit',
26927 id: 5
26928 }, {
26929 rule: 'optional',
26930 type: 'string',
26931 name: 'next',
26932 id: 6
26933 }, {
26934 rule: 'repeated',
26935 type: 'string',
26936 name: 'blockedPids',
26937 id: 8
26938 }, {
26939 rule: 'repeated',
26940 type: 'string',
26941 name: 'blockedCids',
26942 id: 9
26943 }, {
26944 rule: 'repeated',
26945 type: 'string',
26946 name: 'allowedPids',
26947 id: 10
26948 }, {
26949 rule: 'repeated',
26950 type: 'ErrorCommand',
26951 name: 'failedPids',
26952 id: 11
26953 }, {
26954 rule: 'optional',
26955 type: 'int64',
26956 name: 't',
26957 id: 12
26958 }, {
26959 rule: 'optional',
26960 type: 'string',
26961 name: 'n',
26962 id: 13
26963 }, {
26964 rule: 'optional',
26965 type: 'string',
26966 name: 's',
26967 id: 14
26968 }]
26969 }, {
26970 name: 'GenericCommand',
26971 syntax: 'proto2',
26972 fields: [{
26973 rule: 'optional',
26974 type: 'CommandType',
26975 name: 'cmd',
26976 id: 1
26977 }, {
26978 rule: 'optional',
26979 type: 'OpType',
26980 name: 'op',
26981 id: 2
26982 }, {
26983 rule: 'optional',
26984 type: 'string',
26985 name: 'appId',
26986 id: 3
26987 }, {
26988 rule: 'optional',
26989 type: 'string',
26990 name: 'peerId',
26991 id: 4
26992 }, {
26993 rule: 'optional',
26994 type: 'int32',
26995 name: 'i',
26996 id: 5
26997 }, {
26998 rule: 'optional',
26999 type: 'string',
27000 name: 'installationId',
27001 id: 6
27002 }, {
27003 rule: 'optional',
27004 type: 'int32',
27005 name: 'priority',
27006 id: 7
27007 }, {
27008 rule: 'optional',
27009 type: 'int32',
27010 name: 'service',
27011 id: 8
27012 }, {
27013 rule: 'optional',
27014 type: 'int64',
27015 name: 'serverTs',
27016 id: 9
27017 }, {
27018 rule: 'optional',
27019 type: 'int64',
27020 name: 'clientTs',
27021 id: 10
27022 }, {
27023 rule: 'optional',
27024 type: 'int32',
27025 name: 'notificationType',
27026 id: 11
27027 }, {
27028 rule: 'optional',
27029 type: 'DataCommand',
27030 name: 'dataMessage',
27031 id: 101
27032 }, {
27033 rule: 'optional',
27034 type: 'SessionCommand',
27035 name: 'sessionMessage',
27036 id: 102
27037 }, {
27038 rule: 'optional',
27039 type: 'ErrorCommand',
27040 name: 'errorMessage',
27041 id: 103
27042 }, {
27043 rule: 'optional',
27044 type: 'DirectCommand',
27045 name: 'directMessage',
27046 id: 104
27047 }, {
27048 rule: 'optional',
27049 type: 'AckCommand',
27050 name: 'ackMessage',
27051 id: 105
27052 }, {
27053 rule: 'optional',
27054 type: 'UnreadCommand',
27055 name: 'unreadMessage',
27056 id: 106
27057 }, {
27058 rule: 'optional',
27059 type: 'ReadCommand',
27060 name: 'readMessage',
27061 id: 107
27062 }, {
27063 rule: 'optional',
27064 type: 'RcpCommand',
27065 name: 'rcpMessage',
27066 id: 108
27067 }, {
27068 rule: 'optional',
27069 type: 'LogsCommand',
27070 name: 'logsMessage',
27071 id: 109
27072 }, {
27073 rule: 'optional',
27074 type: 'ConvCommand',
27075 name: 'convMessage',
27076 id: 110
27077 }, {
27078 rule: 'optional',
27079 type: 'RoomCommand',
27080 name: 'roomMessage',
27081 id: 111
27082 }, {
27083 rule: 'optional',
27084 type: 'PresenceCommand',
27085 name: 'presenceMessage',
27086 id: 112
27087 }, {
27088 rule: 'optional',
27089 type: 'ReportCommand',
27090 name: 'reportMessage',
27091 id: 113
27092 }, {
27093 rule: 'optional',
27094 type: 'PatchCommand',
27095 name: 'patchMessage',
27096 id: 114
27097 }, {
27098 rule: 'optional',
27099 type: 'PubsubCommand',
27100 name: 'pubsubMessage',
27101 id: 115
27102 }, {
27103 rule: 'optional',
27104 type: 'BlacklistCommand',
27105 name: 'blacklistMessage',
27106 id: 116
27107 }]
27108 }],
27109 enums: [{
27110 name: 'CommandType',
27111 syntax: 'proto2',
27112 values: [{
27113 name: 'session',
27114 id: 0
27115 }, {
27116 name: 'conv',
27117 id: 1
27118 }, {
27119 name: 'direct',
27120 id: 2
27121 }, {
27122 name: 'ack',
27123 id: 3
27124 }, {
27125 name: 'rcp',
27126 id: 4
27127 }, {
27128 name: 'unread',
27129 id: 5
27130 }, {
27131 name: 'logs',
27132 id: 6
27133 }, {
27134 name: 'error',
27135 id: 7
27136 }, {
27137 name: 'login',
27138 id: 8
27139 }, {
27140 name: 'data',
27141 id: 9
27142 }, {
27143 name: 'room',
27144 id: 10
27145 }, {
27146 name: 'read',
27147 id: 11
27148 }, {
27149 name: 'presence',
27150 id: 12
27151 }, {
27152 name: 'report',
27153 id: 13
27154 }, {
27155 name: 'echo',
27156 id: 14
27157 }, {
27158 name: 'loggedin',
27159 id: 15
27160 }, {
27161 name: 'logout',
27162 id: 16
27163 }, {
27164 name: 'loggedout',
27165 id: 17
27166 }, {
27167 name: 'patch',
27168 id: 18
27169 }, {
27170 name: 'pubsub',
27171 id: 19
27172 }, {
27173 name: 'blacklist',
27174 id: 20
27175 }, {
27176 name: 'goaway',
27177 id: 21
27178 }]
27179 }, {
27180 name: 'OpType',
27181 syntax: 'proto2',
27182 values: [{
27183 name: 'open',
27184 id: 1
27185 }, {
27186 name: 'add',
27187 id: 2
27188 }, {
27189 name: 'remove',
27190 id: 3
27191 }, {
27192 name: 'close',
27193 id: 4
27194 }, {
27195 name: 'opened',
27196 id: 5
27197 }, {
27198 name: 'closed',
27199 id: 6
27200 }, {
27201 name: 'query',
27202 id: 7
27203 }, {
27204 name: 'query_result',
27205 id: 8
27206 }, {
27207 name: 'conflict',
27208 id: 9
27209 }, {
27210 name: 'added',
27211 id: 10
27212 }, {
27213 name: 'removed',
27214 id: 11
27215 }, {
27216 name: 'refresh',
27217 id: 12
27218 }, {
27219 name: 'refreshed',
27220 id: 13
27221 }, {
27222 name: 'start',
27223 id: 30
27224 }, {
27225 name: 'started',
27226 id: 31
27227 }, {
27228 name: 'joined',
27229 id: 32
27230 }, {
27231 name: 'members_joined',
27232 id: 33
27233 }, {
27234 name: 'left',
27235 id: 39
27236 }, {
27237 name: 'members_left',
27238 id: 40
27239 }, {
27240 name: 'results',
27241 id: 42
27242 }, {
27243 name: 'count',
27244 id: 43
27245 }, {
27246 name: 'result',
27247 id: 44
27248 }, {
27249 name: 'update',
27250 id: 45
27251 }, {
27252 name: 'updated',
27253 id: 46
27254 }, {
27255 name: 'mute',
27256 id: 47
27257 }, {
27258 name: 'unmute',
27259 id: 48
27260 }, {
27261 name: 'status',
27262 id: 49
27263 }, {
27264 name: 'members',
27265 id: 50
27266 }, {
27267 name: 'max_read',
27268 id: 51
27269 }, {
27270 name: 'is_member',
27271 id: 52
27272 }, {
27273 name: 'member_info_update',
27274 id: 53
27275 }, {
27276 name: 'member_info_updated',
27277 id: 54
27278 }, {
27279 name: 'member_info_changed',
27280 id: 55
27281 }, {
27282 name: 'join',
27283 id: 80
27284 }, {
27285 name: 'invite',
27286 id: 81
27287 }, {
27288 name: 'leave',
27289 id: 82
27290 }, {
27291 name: 'kick',
27292 id: 83
27293 }, {
27294 name: 'reject',
27295 id: 84
27296 }, {
27297 name: 'invited',
27298 id: 85
27299 }, {
27300 name: 'kicked',
27301 id: 86
27302 }, {
27303 name: 'upload',
27304 id: 100
27305 }, {
27306 name: 'uploaded',
27307 id: 101
27308 }, {
27309 name: 'subscribe',
27310 id: 120
27311 }, {
27312 name: 'subscribed',
27313 id: 121
27314 }, {
27315 name: 'unsubscribe',
27316 id: 122
27317 }, {
27318 name: 'unsubscribed',
27319 id: 123
27320 }, {
27321 name: 'is_subscribed',
27322 id: 124
27323 }, {
27324 name: 'modify',
27325 id: 150
27326 }, {
27327 name: 'modified',
27328 id: 151
27329 }, {
27330 name: 'block',
27331 id: 170
27332 }, {
27333 name: 'unblock',
27334 id: 171
27335 }, {
27336 name: 'blocked',
27337 id: 172
27338 }, {
27339 name: 'unblocked',
27340 id: 173
27341 }, {
27342 name: 'members_blocked',
27343 id: 174
27344 }, {
27345 name: 'members_unblocked',
27346 id: 175
27347 }, {
27348 name: 'check_block',
27349 id: 176
27350 }, {
27351 name: 'check_result',
27352 id: 177
27353 }, {
27354 name: 'add_shutup',
27355 id: 180
27356 }, {
27357 name: 'remove_shutup',
27358 id: 181
27359 }, {
27360 name: 'query_shutup',
27361 id: 182
27362 }, {
27363 name: 'shutup_added',
27364 id: 183
27365 }, {
27366 name: 'shutup_removed',
27367 id: 184
27368 }, {
27369 name: 'shutup_result',
27370 id: 185
27371 }, {
27372 name: 'shutuped',
27373 id: 186
27374 }, {
27375 name: 'unshutuped',
27376 id: 187
27377 }, {
27378 name: 'members_shutuped',
27379 id: 188
27380 }, {
27381 name: 'members_unshutuped',
27382 id: 189
27383 }, {
27384 name: 'check_shutup',
27385 id: 190
27386 }]
27387 }, {
27388 name: 'StatusType',
27389 syntax: 'proto2',
27390 values: [{
27391 name: 'on',
27392 id: 1
27393 }, {
27394 name: 'off',
27395 id: 2
27396 }]
27397 }],
27398 isNamespace: true
27399}).build();
27400var _messages$push_server = messageCompiled.push_server.messages2,
27401 JsonObjectMessage = _messages$push_server.JsonObjectMessage,
27402 UnreadTuple = _messages$push_server.UnreadTuple,
27403 LogItem = _messages$push_server.LogItem,
27404 DataCommand = _messages$push_server.DataCommand,
27405 SessionCommand = _messages$push_server.SessionCommand,
27406 ErrorCommand = _messages$push_server.ErrorCommand,
27407 DirectCommand = _messages$push_server.DirectCommand,
27408 AckCommand = _messages$push_server.AckCommand,
27409 UnreadCommand = _messages$push_server.UnreadCommand,
27410 ConvCommand = _messages$push_server.ConvCommand,
27411 RoomCommand = _messages$push_server.RoomCommand,
27412 LogsCommand = _messages$push_server.LogsCommand,
27413 RcpCommand = _messages$push_server.RcpCommand,
27414 ReadTuple = _messages$push_server.ReadTuple,
27415 MaxReadTuple = _messages$push_server.MaxReadTuple,
27416 ReadCommand = _messages$push_server.ReadCommand,
27417 PresenceCommand = _messages$push_server.PresenceCommand,
27418 ReportCommand = _messages$push_server.ReportCommand,
27419 GenericCommand = _messages$push_server.GenericCommand,
27420 BlacklistCommand = _messages$push_server.BlacklistCommand,
27421 PatchCommand = _messages$push_server.PatchCommand,
27422 PatchItem = _messages$push_server.PatchItem,
27423 ConvMemberInfo = _messages$push_server.ConvMemberInfo,
27424 CommandType = _messages$push_server.CommandType,
27425 OpType = _messages$push_server.OpType,
27426 StatusType = _messages$push_server.StatusType;
27427var message = /*#__PURE__*/(0, _freeze.default)({
27428 __proto__: null,
27429 JsonObjectMessage: JsonObjectMessage,
27430 UnreadTuple: UnreadTuple,
27431 LogItem: LogItem,
27432 DataCommand: DataCommand,
27433 SessionCommand: SessionCommand,
27434 ErrorCommand: ErrorCommand,
27435 DirectCommand: DirectCommand,
27436 AckCommand: AckCommand,
27437 UnreadCommand: UnreadCommand,
27438 ConvCommand: ConvCommand,
27439 RoomCommand: RoomCommand,
27440 LogsCommand: LogsCommand,
27441 RcpCommand: RcpCommand,
27442 ReadTuple: ReadTuple,
27443 MaxReadTuple: MaxReadTuple,
27444 ReadCommand: ReadCommand,
27445 PresenceCommand: PresenceCommand,
27446 ReportCommand: ReportCommand,
27447 GenericCommand: GenericCommand,
27448 BlacklistCommand: BlacklistCommand,
27449 PatchCommand: PatchCommand,
27450 PatchItem: PatchItem,
27451 ConvMemberInfo: ConvMemberInfo,
27452 CommandType: CommandType,
27453 OpType: OpType,
27454 StatusType: StatusType
27455});
27456var adapters = {};
27457
27458var getAdapter = function getAdapter(name) {
27459 var adapter = adapters[name];
27460
27461 if (adapter === undefined) {
27462 throw new Error("".concat(name, " adapter is not configured"));
27463 }
27464
27465 return adapter;
27466};
27467/**
27468 * 指定 Adapters
27469 * @function
27470 * @memberof module:leancloud-realtime
27471 * @param {Adapters} newAdapters Adapters 的类型请参考 {@link https://url.leanapp.cn/adapter-type-definitions @leancloud/adapter-types} 中的定义
27472 */
27473
27474
27475var setAdapters = function setAdapters(newAdapters) {
27476 (0, _assign.default)(adapters, newAdapters);
27477};
27478/* eslint-disable */
27479
27480
27481var global$1 = typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : {};
27482var EXPIRED = (0, _symbol.default)('expired');
27483var debug = d('LC:Expirable');
27484
27485var Expirable = /*#__PURE__*/function () {
27486 function Expirable(value, ttl) {
27487 this.originalValue = value;
27488
27489 if (typeof ttl === 'number') {
27490 this.expiredAt = Date.now() + ttl;
27491 }
27492 }
27493
27494 _createClass(Expirable, [{
27495 key: "value",
27496 get: function get() {
27497 var expired = this.expiredAt && this.expiredAt <= Date.now();
27498 if (expired) debug("expired: ".concat(this.originalValue));
27499 return expired ? EXPIRED : this.originalValue;
27500 }
27501 }]);
27502
27503 return Expirable;
27504}();
27505
27506Expirable.EXPIRED = EXPIRED;
27507var debug$1 = d('LC:Cache');
27508
27509var Cache = /*#__PURE__*/function () {
27510 function Cache() {
27511 var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'anonymous';
27512 this.name = name;
27513 this._map = {};
27514 }
27515
27516 var _proto = Cache.prototype;
27517
27518 _proto.get = function get(key) {
27519 var _context5;
27520
27521 var cache = this._map[key];
27522
27523 if (cache) {
27524 var value = cache.value;
27525
27526 if (value !== Expirable.EXPIRED) {
27527 debug$1('[%s] hit: %s', this.name, key);
27528 return value;
27529 }
27530
27531 delete this._map[key];
27532 }
27533
27534 debug$1((0, _concat.default)(_context5 = "[".concat(this.name, "] missed: ")).call(_context5, key));
27535 return null;
27536 };
27537
27538 _proto.set = function set(key, value, ttl) {
27539 debug$1('[%s] set: %s %d', this.name, key, ttl);
27540 this._map[key] = new Expirable(value, ttl);
27541 };
27542
27543 return Cache;
27544}();
27545
27546function ownKeys(object, enumerableOnly) {
27547 var keys = (0, _keys.default)(object);
27548
27549 if (_getOwnPropertySymbols.default) {
27550 var symbols = (0, _getOwnPropertySymbols.default)(object);
27551 if (enumerableOnly) symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
27552 return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
27553 });
27554 keys.push.apply(keys, symbols);
27555 }
27556
27557 return keys;
27558}
27559
27560function _objectSpread(target) {
27561 for (var i = 1; i < arguments.length; i++) {
27562 var source = arguments[i] != null ? arguments[i] : {};
27563
27564 if (i % 2) {
27565 ownKeys(Object(source), true).forEach(function (key) {
27566 _defineProperty(target, key, source[key]);
27567 });
27568 } else if (_getOwnPropertyDescriptors.default) {
27569 (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source));
27570 } else {
27571 ownKeys(Object(source)).forEach(function (key) {
27572 (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
27573 });
27574 }
27575 }
27576
27577 return target;
27578}
27579/**
27580 * 调试日志控制器
27581 * @const
27582 * @memberof module:leancloud-realtime
27583 * @example
27584 * debug.enable(); // 启用调试日志
27585 * debug.disable(); // 关闭调试日志
27586 */
27587
27588
27589var debug$2 = {
27590 enable: function enable() {
27591 var namespaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'LC*';
27592 return d.enable(namespaces);
27593 },
27594 disable: d.disable
27595};
27596
27597var tryAll = function tryAll(promiseConstructors) {
27598 var promise = new _promise.default(promiseConstructors[0]);
27599
27600 if (promiseConstructors.length === 1) {
27601 return promise;
27602 }
27603
27604 return promise["catch"](function () {
27605 return tryAll((0, _slice.default)(promiseConstructors).call(promiseConstructors, 1));
27606 });
27607}; // eslint-disable-next-line no-sequences
27608
27609
27610var tap = function tap(interceptor) {
27611 return function (value) {
27612 return interceptor(value), value;
27613 };
27614};
27615
27616var isIE10 = global$1.navigator && global$1.navigator.userAgent && (0, _indexOf.default)(_context6 = global$1.navigator.userAgent).call(_context6, 'MSIE 10.') !== -1;
27617var map = new _weakMap.default(); // protected property helper
27618
27619var internal = function internal(object) {
27620 if (!map.has(object)) {
27621 map.set(object, {});
27622 }
27623
27624 return map.get(object);
27625};
27626
27627var compact = function compact(obj, filter) {
27628 if (!isPlainObject(obj)) return obj;
27629
27630 var object = _objectSpread({}, obj);
27631
27632 (0, _keys.default)(object).forEach(function (prop) {
27633 var value = object[prop];
27634
27635 if (value === filter) {
27636 delete object[prop];
27637 } else {
27638 object[prop] = compact(value, filter);
27639 }
27640 });
27641 return object;
27642}; // debug utility
27643
27644
27645var removeNull = function removeNull(obj) {
27646 return compact(obj, null);
27647};
27648
27649var trim = function trim(message) {
27650 return removeNull(JSON.parse((0, _stringify.default)(message)));
27651};
27652
27653var ensureArray = function ensureArray(target) {
27654 if (Array.isArray(target)) {
27655 return target;
27656 }
27657
27658 if (target === undefined || target === null) {
27659 return [];
27660 }
27661
27662 return [target];
27663};
27664
27665var isWeapp = // eslint-disable-next-line no-undef
27666(typeof wx === "undefined" ? "undefined" : _typeof(wx)) === 'object' && typeof wx.connectSocket === 'function'; // throttle decorator
27667
27668var isCNApp = function isCNApp(appId) {
27669 return (0, _slice.default)(appId).call(appId, -9) !== '-MdYXbMMI';
27670};
27671
27672var equalBuffer = function equalBuffer(buffer1, buffer2) {
27673 if (!buffer1 || !buffer2) return false;
27674 if (buffer1.byteLength !== buffer2.byteLength) return false;
27675 var a = new Uint8Array(buffer1);
27676 var b = new Uint8Array(buffer2);
27677 return !a.some(function (value, index) {
27678 return value !== b[index];
27679 });
27680};
27681
27682var _class;
27683
27684function ownKeys$1(object, enumerableOnly) {
27685 var keys = (0, _keys.default)(object);
27686
27687 if (_getOwnPropertySymbols.default) {
27688 var symbols = (0, _getOwnPropertySymbols.default)(object);
27689 if (enumerableOnly) symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
27690 return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
27691 });
27692 keys.push.apply(keys, symbols);
27693 }
27694
27695 return keys;
27696}
27697
27698function _objectSpread$1(target) {
27699 for (var i = 1; i < arguments.length; i++) {
27700 var source = arguments[i] != null ? arguments[i] : {};
27701
27702 if (i % 2) {
27703 ownKeys$1(Object(source), true).forEach(function (key) {
27704 _defineProperty(target, key, source[key]);
27705 });
27706 } else if (_getOwnPropertyDescriptors.default) {
27707 (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source));
27708 } else {
27709 ownKeys$1(Object(source)).forEach(function (key) {
27710 (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
27711 });
27712 }
27713 }
27714
27715 return target;
27716}
27717
27718var debug$3 = d('LC:WebSocketPlus');
27719var OPEN = 'open';
27720var DISCONNECT = 'disconnect';
27721var RECONNECT = 'reconnect';
27722var RETRY = 'retry';
27723var SCHEDULE = 'schedule';
27724var OFFLINE = 'offline';
27725var ONLINE = 'online';
27726var ERROR = 'error';
27727var MESSAGE = 'message';
27728var HEARTBEAT_TIME = 180000;
27729var TIMEOUT_TIME = 380000;
27730
27731var DEFAULT_RETRY_STRATEGY = function DEFAULT_RETRY_STRATEGY(attempt) {
27732 return Math.min(1000 * Math.pow(2, attempt), 300000);
27733};
27734
27735var requireConnected = function requireConnected(target, name, descriptor) {
27736 return _objectSpread$1(_objectSpread$1({}, descriptor), {}, {
27737 value: function requireConnectedWrapper() {
27738 var _context7;
27739
27740 var _descriptor$value;
27741
27742 this.checkConnectionAvailability(name);
27743
27744 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
27745 args[_key] = arguments[_key];
27746 }
27747
27748 return (_descriptor$value = descriptor.value).call.apply(_descriptor$value, (0, _concat.default)(_context7 = [this]).call(_context7, args));
27749 }
27750 });
27751};
27752
27753var WebSocketPlus = (_class = /*#__PURE__*/function (_EventEmitter) {
27754 _inheritsLoose(WebSocketPlus, _EventEmitter);
27755
27756 _createClass(WebSocketPlus, [{
27757 key: "urls",
27758 get: function get() {
27759 return this._urls;
27760 },
27761 set: function set(urls) {
27762 this._urls = ensureArray(urls);
27763 }
27764 }]);
27765
27766 function WebSocketPlus(getUrls, protocol) {
27767 var _this;
27768
27769 _this = _EventEmitter.call(this) || this;
27770
27771 _this.init();
27772
27773 _this._protocol = protocol;
27774
27775 _promise.default.resolve(typeof getUrls === 'function' ? getUrls() : getUrls).then(ensureArray).then(function (urls) {
27776 _this._urls = urls;
27777 return _this._open();
27778 }).then(function () {
27779 _this.__postponeTimeoutTimer = _this._postponeTimeoutTimer.bind(_assertThisInitialized(_this));
27780
27781 if (global$1.addEventListener) {
27782 _this.__pause = function () {
27783 if (_this.can('pause')) _this.pause();
27784 };
27785
27786 _this.__resume = function () {
27787 if (_this.can('resume')) _this.resume();
27788 };
27789
27790 global$1.addEventListener('offline', _this.__pause);
27791 global$1.addEventListener('online', _this.__resume);
27792 }
27793
27794 _this.open();
27795 })["catch"](_this["throw"].bind(_assertThisInitialized(_this)));
27796
27797 return _this;
27798 }
27799
27800 var _proto = WebSocketPlus.prototype;
27801
27802 _proto._open = function _open() {
27803 var _this2 = this;
27804
27805 return this._createWs(this._urls, this._protocol).then(function (ws) {
27806 var _context8;
27807
27808 var _this2$_urls = _toArray(_this2._urls),
27809 first = _this2$_urls[0],
27810 reset = (0, _slice.default)(_this2$_urls).call(_this2$_urls, 1);
27811
27812 _this2._urls = (0, _concat.default)(_context8 = []).call(_context8, _toConsumableArray(reset), [first]);
27813 return ws;
27814 });
27815 };
27816
27817 _proto._createWs = function _createWs(urls, protocol) {
27818 var _this3 = this;
27819
27820 return tryAll((0, _map.default)(urls).call(urls, function (url) {
27821 return function (resolve, reject) {
27822 var _context9;
27823
27824 debug$3((0, _concat.default)(_context9 = "connect [".concat(url, "] ")).call(_context9, protocol));
27825 var WebSocket = getAdapter('WebSocket');
27826 var ws = protocol ? new WebSocket(url, protocol) : new WebSocket(url);
27827 ws.binaryType = _this3.binaryType || 'arraybuffer';
27828
27829 ws.onopen = function () {
27830 return resolve(ws);
27831 };
27832
27833 ws.onclose = function (error) {
27834 if (error instanceof Error) {
27835 return reject(error);
27836 } // in browser, error event is useless
27837
27838
27839 return reject(new Error("Failed to connect [".concat(url, "]")));
27840 };
27841
27842 ws.onerror = ws.onclose;
27843 };
27844 })).then(function (ws) {
27845 _this3._ws = ws;
27846 _this3._ws.onclose = _this3._handleClose.bind(_this3);
27847 _this3._ws.onmessage = _this3._handleMessage.bind(_this3);
27848 return ws;
27849 });
27850 };
27851
27852 _proto._destroyWs = function _destroyWs() {
27853 var ws = this._ws;
27854 if (!ws) return;
27855 ws.onopen = null;
27856 ws.onclose = null;
27857 ws.onerror = null;
27858 ws.onmessage = null;
27859 this._ws = null;
27860 ws.close();
27861 } // eslint-disable-next-line class-methods-use-this
27862 ;
27863
27864 _proto.onbeforeevent = function onbeforeevent(event, from, to) {
27865 var _context10, _context11;
27866
27867 for (var _len2 = arguments.length, payload = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
27868 payload[_key2 - 3] = arguments[_key2];
27869 }
27870
27871 debug$3((0, _concat.default)(_context10 = (0, _concat.default)(_context11 = "".concat(event, ": ")).call(_context11, from, " -> ")).call(_context10, to, " %o"), payload);
27872 };
27873
27874 _proto.onopen = function onopen() {
27875 this.emit(OPEN);
27876 };
27877
27878 _proto.onconnected = function onconnected() {
27879 this._startConnectionKeeper();
27880 };
27881
27882 _proto.onleaveconnected = function onleaveconnected(event, from, to) {
27883 this._stopConnectionKeeper();
27884
27885 this._destroyWs();
27886
27887 if (to === 'offline' || to === 'disconnected') {
27888 this.emit(DISCONNECT);
27889 }
27890 };
27891
27892 _proto.onpause = function onpause() {
27893 this.emit(OFFLINE);
27894 };
27895
27896 _proto.onbeforeresume = function onbeforeresume() {
27897 this.emit(ONLINE);
27898 };
27899
27900 _proto.onreconnect = function onreconnect() {
27901 this.emit(RECONNECT);
27902 };
27903
27904 _proto.ondisconnected = function ondisconnected(event, from, to) {
27905 var _context12;
27906
27907 var _this4 = this;
27908
27909 var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
27910 var delay = from === OFFLINE ? 0 : DEFAULT_RETRY_STRATEGY.call(null, attempt);
27911 debug$3((0, _concat.default)(_context12 = "schedule attempt=".concat(attempt, " delay=")).call(_context12, delay));
27912 this.emit(SCHEDULE, attempt, delay);
27913
27914 if (this.__scheduledRetry) {
27915 clearTimeout(this.__scheduledRetry);
27916 }
27917
27918 this.__scheduledRetry = setTimeout(function () {
27919 if (_this4.is('disconnected')) {
27920 _this4.retry(attempt);
27921 }
27922 }, delay);
27923 };
27924
27925 _proto.onretry = function onretry(event, from, to) {
27926 var _this5 = this;
27927
27928 var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
27929 this.emit(RETRY, attempt);
27930
27931 this._open().then(function () {
27932 return _this5.can('reconnect') && _this5.reconnect();
27933 }, function () {
27934 return _this5.can('fail') && _this5.fail(attempt + 1);
27935 });
27936 };
27937
27938 _proto.onerror = function onerror(event, from, to, error) {
27939 this.emit(ERROR, error);
27940 };
27941
27942 _proto.onclose = function onclose() {
27943 if (global$1.removeEventListener) {
27944 if (this.__pause) global$1.removeEventListener('offline', this.__pause);
27945 if (this.__resume) global$1.removeEventListener('online', this.__resume);
27946 }
27947 };
27948
27949 _proto.checkConnectionAvailability = function checkConnectionAvailability() {
27950 var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'API';
27951
27952 if (!this.is('connected')) {
27953 var _context13;
27954
27955 var currentState = this.current;
27956 console.warn((0, _concat.default)(_context13 = "".concat(name, " should not be called when the connection is ")).call(_context13, currentState));
27957
27958 if (this.is('disconnected') || this.is('reconnecting')) {
27959 console.warn('disconnect and reconnect event should be handled to avoid such calls.');
27960 }
27961
27962 throw new Error('Connection unavailable');
27963 }
27964 } // jsdoc-ignore-start
27965 ;
27966
27967 _proto. // jsdoc-ignore-end
27968 _ping = function _ping() {
27969 debug$3('ping');
27970
27971 try {
27972 this.ping();
27973 } catch (error) {
27974 console.warn("websocket ping error: ".concat(error.message));
27975 }
27976 };
27977
27978 _proto.ping = function ping() {
27979 if (this._ws.ping) {
27980 this._ws.ping();
27981 } else {
27982 console.warn("The WebSocket implement does not support sending ping frame.\n Override ping method to use application defined ping/pong mechanism.");
27983 }
27984 };
27985
27986 _proto._postponeTimeoutTimer = function _postponeTimeoutTimer() {
27987 var _this6 = this;
27988
27989 debug$3('_postponeTimeoutTimer');
27990
27991 this._clearTimeoutTimers();
27992
27993 this._timeoutTimer = setTimeout(function () {
27994 debug$3('timeout');
27995
27996 _this6.disconnect();
27997 }, TIMEOUT_TIME);
27998 };
27999
28000 _proto._clearTimeoutTimers = function _clearTimeoutTimers() {
28001 if (this._timeoutTimer) {
28002 clearTimeout(this._timeoutTimer);
28003 }
28004 };
28005
28006 _proto._startConnectionKeeper = function _startConnectionKeeper() {
28007 debug$3('start connection keeper');
28008 this._heartbeatTimer = setInterval(this._ping.bind(this), HEARTBEAT_TIME);
28009 var addListener = this._ws.addListener || this._ws.addEventListener;
28010
28011 if (!addListener) {
28012 debug$3('connection keeper disabled due to the lack of #addEventListener.');
28013 return;
28014 }
28015
28016 addListener.call(this._ws, 'message', this.__postponeTimeoutTimer);
28017 addListener.call(this._ws, 'pong', this.__postponeTimeoutTimer);
28018
28019 this._postponeTimeoutTimer();
28020 };
28021
28022 _proto._stopConnectionKeeper = function _stopConnectionKeeper() {
28023 debug$3('stop connection keeper'); // websockets/ws#489
28024
28025 var removeListener = this._ws.removeListener || this._ws.removeEventListener;
28026
28027 if (removeListener) {
28028 removeListener.call(this._ws, 'message', this.__postponeTimeoutTimer);
28029 removeListener.call(this._ws, 'pong', this.__postponeTimeoutTimer);
28030
28031 this._clearTimeoutTimers();
28032 }
28033
28034 if (this._heartbeatTimer) {
28035 clearInterval(this._heartbeatTimer);
28036 }
28037 };
28038
28039 _proto._handleClose = function _handleClose(event) {
28040 var _context14;
28041
28042 debug$3((0, _concat.default)(_context14 = "ws closed [".concat(event.code, "] ")).call(_context14, event.reason)); // socket closed manually, ignore close event.
28043
28044 if (this.isFinished()) return;
28045 this.handleClose(event);
28046 };
28047
28048 _proto.handleClose = function handleClose() {
28049 // reconnect
28050 this.disconnect();
28051 } // jsdoc-ignore-start
28052 ;
28053
28054 _proto. // jsdoc-ignore-end
28055 send = function send(data) {
28056 debug$3('send', data);
28057
28058 this._ws.send(data);
28059 };
28060
28061 _proto._handleMessage = function _handleMessage(event) {
28062 debug$3('message', event.data);
28063 this.handleMessage(event.data);
28064 };
28065
28066 _proto.handleMessage = function handleMessage(message) {
28067 this.emit(MESSAGE, message);
28068 };
28069
28070 return WebSocketPlus;
28071}(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);
28072StateMachine.create({
28073 target: WebSocketPlus.prototype,
28074 initial: {
28075 state: 'initialized',
28076 event: 'init',
28077 defer: true
28078 },
28079 terminal: 'closed',
28080 events: [{
28081 name: 'open',
28082 from: 'initialized',
28083 to: 'connected'
28084 }, {
28085 name: 'disconnect',
28086 from: 'connected',
28087 to: 'disconnected'
28088 }, {
28089 name: 'retry',
28090 from: 'disconnected',
28091 to: 'reconnecting'
28092 }, {
28093 name: 'fail',
28094 from: 'reconnecting',
28095 to: 'disconnected'
28096 }, {
28097 name: 'reconnect',
28098 from: 'reconnecting',
28099 to: 'connected'
28100 }, {
28101 name: 'pause',
28102 from: ['connected', 'disconnected', 'reconnecting'],
28103 to: 'offline'
28104 }, {}, {
28105 name: 'resume',
28106 from: 'offline',
28107 to: 'disconnected'
28108 }, {
28109 name: 'close',
28110 from: ['connected', 'disconnected', 'reconnecting', 'offline'],
28111 to: 'closed'
28112 }, {
28113 name: 'throw',
28114 from: '*',
28115 to: 'error'
28116 }]
28117});
28118var error = (0, _freeze.default)({
28119 1000: {
28120 name: 'CLOSE_NORMAL'
28121 },
28122 1006: {
28123 name: 'CLOSE_ABNORMAL'
28124 },
28125 4100: {
28126 name: 'APP_NOT_AVAILABLE',
28127 message: 'App not exists or realtime message service is disabled.'
28128 },
28129 4102: {
28130 name: 'SIGNATURE_FAILED',
28131 message: 'Login signature mismatch.'
28132 },
28133 4103: {
28134 name: 'INVALID_LOGIN',
28135 message: 'Malformed clientId.'
28136 },
28137 4105: {
28138 name: 'SESSION_REQUIRED',
28139 message: 'Message sent before session opened.'
28140 },
28141 4107: {
28142 name: 'READ_TIMEOUT'
28143 },
28144 4108: {
28145 name: 'LOGIN_TIMEOUT'
28146 },
28147 4109: {
28148 name: 'FRAME_TOO_LONG'
28149 },
28150 4110: {
28151 name: 'INVALID_ORIGIN',
28152 message: 'Access denied by domain whitelist.'
28153 },
28154 4111: {
28155 name: 'SESSION_CONFLICT'
28156 },
28157 4112: {
28158 name: 'SESSION_TOKEN_EXPIRED'
28159 },
28160 4113: {
28161 name: 'APP_QUOTA_EXCEEDED',
28162 message: 'The daily active users limit exceeded.'
28163 },
28164 4116: {
28165 name: 'MESSAGE_SENT_QUOTA_EXCEEDED',
28166 message: 'Command sent too fast.'
28167 },
28168 4200: {
28169 name: 'INTERNAL_ERROR',
28170 message: 'Internal error, please contact LeanCloud for support.'
28171 },
28172 4301: {
28173 name: 'CONVERSATION_API_FAILED',
28174 message: 'Upstream Conversatoin API failed, see error.detail for details.'
28175 },
28176 4302: {
28177 name: 'CONVERSATION_SIGNATURE_FAILED',
28178 message: 'Conversation action signature mismatch.'
28179 },
28180 4303: {
28181 name: 'CONVERSATION_NOT_FOUND'
28182 },
28183 4304: {
28184 name: 'CONVERSATION_FULL'
28185 },
28186 4305: {
28187 name: 'CONVERSATION_REJECTED_BY_APP',
28188 message: 'Conversation action rejected by hook.'
28189 },
28190 4306: {
28191 name: 'CONVERSATION_UPDATE_FAILED'
28192 },
28193 4307: {
28194 name: 'CONVERSATION_READ_ONLY'
28195 },
28196 4308: {
28197 name: 'CONVERSATION_NOT_ALLOWED'
28198 },
28199 4309: {
28200 name: 'CONVERSATION_UPDATE_REJECTED',
28201 message: 'Conversation update rejected because the client is not a member.'
28202 },
28203 4310: {
28204 name: 'CONVERSATION_QUERY_FAILED',
28205 message: 'Conversation query failed because it is too expansive.'
28206 },
28207 4311: {
28208 name: 'CONVERSATION_LOG_FAILED'
28209 },
28210 4312: {
28211 name: 'CONVERSATION_LOG_REJECTED',
28212 message: 'Message query rejected because the client is not a member of the conversation.'
28213 },
28214 4313: {
28215 name: 'SYSTEM_CONVERSATION_REQUIRED'
28216 },
28217 4314: {
28218 name: 'NORMAL_CONVERSATION_REQUIRED'
28219 },
28220 4315: {
28221 name: 'CONVERSATION_BLACKLISTED',
28222 message: 'Blacklisted in the conversation.'
28223 },
28224 4316: {
28225 name: 'TRANSIENT_CONVERSATION_REQUIRED'
28226 },
28227 4317: {
28228 name: 'CONVERSATION_MEMBERSHIP_REQUIRED'
28229 },
28230 4318: {
28231 name: 'CONVERSATION_API_QUOTA_EXCEEDED',
28232 message: 'LeanCloud API quota exceeded. You may upgrade your plan.'
28233 },
28234 4323: {
28235 name: 'TEMPORARY_CONVERSATION_EXPIRED',
28236 message: 'Temporary conversation expired or does not exist.'
28237 },
28238 4401: {
28239 name: 'INVALID_MESSAGING_TARGET',
28240 message: 'Conversation does not exist or client is not a member.'
28241 },
28242 4402: {
28243 name: 'MESSAGE_REJECTED_BY_APP',
28244 message: 'Message rejected by hook.'
28245 },
28246 4403: {
28247 name: 'MESSAGE_OWNERSHIP_REQUIRED'
28248 },
28249 4404: {
28250 name: 'MESSAGE_NOT_FOUND'
28251 },
28252 4405: {
28253 name: 'MESSAGE_UPDATE_REJECTED_BY_APP',
28254 message: 'Message update rejected by hook.'
28255 },
28256 4406: {
28257 name: 'MESSAGE_EDIT_DISABLED'
28258 },
28259 4407: {
28260 name: 'MESSAGE_RECALL_DISABLED'
28261 },
28262 5130: {
28263 name: 'OWNER_PROMOTION_NOT_ALLOWED',
28264 message: "Updating a member's role to owner is not allowed."
28265 }
28266});
28267var ErrorCode = (0, _freeze.default)((0, _reduce.default)(_context15 = (0, _keys.default)(error)).call(_context15, function (result, code) {
28268 return (0, _assign.default)(result, _defineProperty({}, error[code].name, Number(code)));
28269}, {}));
28270
28271var createError = function createError(_ref) {
28272 var code = _ref.code,
28273 reason = _ref.reason,
28274 appCode = _ref.appCode,
28275 detail = _ref.detail,
28276 errorMessage = _ref.error;
28277 var message = reason || detail || errorMessage;
28278 var name = reason;
28279
28280 if (!message && error[code]) {
28281 name = error[code].name;
28282 message = error[code].message || name;
28283 }
28284
28285 if (!message) {
28286 message = "Unknow Error: ".concat(code);
28287 }
28288
28289 var err = new Error(message);
28290 return (0, _assign.default)(err, {
28291 code: code,
28292 appCode: appCode,
28293 detail: detail,
28294 name: name
28295 });
28296};
28297
28298var debug$4 = d('LC:Connection');
28299var COMMAND_TIMEOUT = 20000;
28300var EXPIRE = (0, _symbol.default)('expire');
28301
28302var isIdempotentCommand = function isIdempotentCommand(command) {
28303 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));
28304};
28305
28306var Connection = /*#__PURE__*/function (_WebSocketPlus) {
28307 _inheritsLoose(Connection, _WebSocketPlus);
28308
28309 function Connection(getUrl, _ref) {
28310 var _context16;
28311
28312 var _this;
28313
28314 var format = _ref.format,
28315 version = _ref.version;
28316 debug$4('initializing Connection');
28317 var protocolString = (0, _concat.default)(_context16 = "lc.".concat(format, ".")).call(_context16, version);
28318 _this = _WebSocketPlus.call(this, getUrl, protocolString) || this;
28319 _this._protocolFormat = format;
28320 _this._commands = {};
28321 _this._serialId = 0;
28322 return _this;
28323 }
28324
28325 var _proto = Connection.prototype;
28326
28327 _proto.send = /*#__PURE__*/function () {
28328 var _send = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(command) {
28329 var _this2 = this;
28330
28331 var waitingForRespond,
28332 buffer,
28333 serialId,
28334 duplicatedCommand,
28335 message,
28336 promise,
28337 _args = arguments;
28338 return _regeneratorRuntime.wrap(function _callee$(_context) {
28339 var _context17, _context18;
28340
28341 while (1) {
28342 switch (_context.prev = _context.next) {
28343 case 0:
28344 waitingForRespond = _args.length > 1 && _args[1] !== undefined ? _args[1] : true;
28345
28346 if (!waitingForRespond) {
28347 _context.next = 11;
28348 break;
28349 }
28350
28351 if (!isIdempotentCommand(command)) {
28352 _context.next = 8;
28353 break;
28354 }
28355
28356 buffer = command.toArrayBuffer();
28357 duplicatedCommand = (0, _find.default)(_context17 = values(this._commands)).call(_context17, function (_ref2) {
28358 var targetBuffer = _ref2.buffer,
28359 targetCommand = _ref2.command;
28360 return targetCommand.cmd === command.cmd && targetCommand.op === command.op && equalBuffer(targetBuffer, buffer);
28361 });
28362
28363 if (!duplicatedCommand) {
28364 _context.next = 8;
28365 break;
28366 }
28367
28368 console.warn((0, _concat.default)(_context18 = "Duplicated command [cmd:".concat(command.cmd, " op:")).call(_context18, command.op, "] is throttled."));
28369 return _context.abrupt("return", duplicatedCommand.promise);
28370
28371 case 8:
28372 this._serialId += 1;
28373 serialId = this._serialId;
28374 command.i = serialId;
28375 // eslint-disable-line no-param-reassign
28376
28377 case 11:
28378 if (debug$4.enabled) debug$4('↑ %O sent', trim(command));
28379
28380 if (this._protocolFormat === 'proto2base64') {
28381 message = command.toBase64();
28382 } else if (command.toArrayBuffer) {
28383 message = command.toArrayBuffer();
28384 }
28385
28386 if (message) {
28387 _context.next = 15;
28388 break;
28389 }
28390
28391 throw new TypeError("".concat(command, " is not a GenericCommand"));
28392
28393 case 15:
28394 _WebSocketPlus.prototype.send.call(this, message);
28395
28396 if (waitingForRespond) {
28397 _context.next = 18;
28398 break;
28399 }
28400
28401 return _context.abrupt("return", undefined);
28402
28403 case 18:
28404 promise = new _promise.default(function (resolve, reject) {
28405 _this2._commands[serialId] = {
28406 command: command,
28407 buffer: buffer,
28408 resolve: resolve,
28409 reject: reject,
28410 timeout: setTimeout(function () {
28411 if (_this2._commands[serialId]) {
28412 var _context19;
28413
28414 if (debug$4.enabled) debug$4('✗ %O timeout', trim(command));
28415 reject(createError({
28416 error: (0, _concat.default)(_context19 = "Command Timeout [cmd:".concat(command.cmd, " op:")).call(_context19, command.op, "]"),
28417 name: 'COMMAND_TIMEOUT'
28418 }));
28419 delete _this2._commands[serialId];
28420 }
28421 }, COMMAND_TIMEOUT)
28422 };
28423 });
28424 this._commands[serialId].promise = promise;
28425 return _context.abrupt("return", promise);
28426
28427 case 21:
28428 case "end":
28429 return _context.stop();
28430 }
28431 }
28432 }, _callee, this);
28433 }));
28434
28435 function send(_x) {
28436 return _send.apply(this, arguments);
28437 }
28438
28439 return send;
28440 }();
28441
28442 _proto.handleMessage = function handleMessage(msg) {
28443 var message;
28444
28445 try {
28446 message = GenericCommand.decode(msg);
28447 if (debug$4.enabled) debug$4('↓ %O received', trim(message));
28448 } catch (e) {
28449 console.warn('Decode message failed:', e.message, msg);
28450 return;
28451 }
28452
28453 var serialId = message.i;
28454
28455 if (serialId) {
28456 if (this._commands[serialId]) {
28457 clearTimeout(this._commands[serialId].timeout);
28458
28459 if (message.cmd === CommandType.error) {
28460 this._commands[serialId].reject(createError(message.errorMessage));
28461 } else {
28462 this._commands[serialId].resolve(message);
28463 }
28464
28465 delete this._commands[serialId];
28466 } else {
28467 console.warn("Unexpected command received with serialId [".concat(serialId, "],\n which have timed out or never been requested."));
28468 }
28469 } else {
28470 switch (message.cmd) {
28471 case CommandType.error:
28472 {
28473 this.emit(ERROR, createError(message.errorMessage));
28474 return;
28475 }
28476
28477 case CommandType.goaway:
28478 {
28479 this.emit(EXPIRE);
28480 return;
28481 }
28482
28483 default:
28484 {
28485 this.emit(MESSAGE, message);
28486 }
28487 }
28488 }
28489 };
28490
28491 _proto.ping = function ping() {
28492 return this.send(new GenericCommand({
28493 cmd: CommandType.echo
28494 }))["catch"](function (error) {
28495 return debug$4('ping failed:', error);
28496 });
28497 };
28498
28499 return Connection;
28500}(WebSocketPlus);
28501
28502var debug$5 = d('LC:request');
28503
28504var request = function request(_ref) {
28505 var _ref$method = _ref.method,
28506 method = _ref$method === void 0 ? 'GET' : _ref$method,
28507 _url = _ref.url,
28508 query = _ref.query,
28509 headers = _ref.headers,
28510 data = _ref.data,
28511 time = _ref.timeout;
28512 var url = _url;
28513
28514 if (query) {
28515 var _context20, _context21, _context23;
28516
28517 var queryString = (0, _filter.default)(_context20 = (0, _map.default)(_context21 = (0, _keys.default)(query)).call(_context21, function (key) {
28518 var _context22;
28519
28520 var value = query[key];
28521 if (value === undefined) return undefined;
28522 var v = isPlainObject(value) ? (0, _stringify.default)(value) : value;
28523 return (0, _concat.default)(_context22 = "".concat(encodeURIComponent(key), "=")).call(_context22, encodeURIComponent(v));
28524 })).call(_context20, function (qs) {
28525 return qs;
28526 }).join('&');
28527 url = (0, _concat.default)(_context23 = "".concat(url, "?")).call(_context23, queryString);
28528 }
28529
28530 debug$5('Req: %O %O %O', method, url, {
28531 headers: headers,
28532 data: data
28533 });
28534 var request = getAdapter('request');
28535 var promise = request(url, {
28536 method: method,
28537 headers: headers,
28538 data: data
28539 }).then(function (response) {
28540 if (response.ok === false) {
28541 var error = createError(response.data);
28542 error.response = response;
28543 throw error;
28544 }
28545
28546 debug$5('Res: %O %O %O', url, response.status, response.data);
28547 return response.data;
28548 })["catch"](function (error) {
28549 if (error.response) {
28550 debug$5('Error: %O %O %O', url, error.response.status, error.response.data);
28551 }
28552
28553 throw error;
28554 });
28555 return time ? promiseTimeout.timeout(promise, time) : promise;
28556};
28557
28558var applyDecorators = function applyDecorators(decorators, target) {
28559 if (decorators) {
28560 decorators.forEach(function (decorator) {
28561 try {
28562 decorator(target);
28563 } catch (error) {
28564 if (decorator._pluginName) {
28565 error.message += "[".concat(decorator._pluginName, "]");
28566 }
28567
28568 throw error;
28569 }
28570 });
28571 }
28572};
28573
28574var applyDispatcher = function applyDispatcher(dispatchers, payload) {
28575 var _context24;
28576
28577 return (0, _reduce.default)(_context24 = ensureArray(dispatchers)).call(_context24, function (resultPromise, dispatcher) {
28578 return resultPromise.then(function (shouldDispatch) {
28579 return shouldDispatch === false ? false : dispatcher.apply(void 0, _toConsumableArray(payload));
28580 })["catch"](function (error) {
28581 if (dispatcher._pluginName) {
28582 // eslint-disable-next-line no-param-reassign
28583 error.message += "[".concat(dispatcher._pluginName, "]");
28584 }
28585
28586 throw error;
28587 });
28588 }, _promise.default.resolve(true));
28589};
28590
28591var version = "5.0.0-rc.7";
28592
28593function ownKeys$2(object, enumerableOnly) {
28594 var keys = (0, _keys.default)(object);
28595
28596 if (_getOwnPropertySymbols.default) {
28597 var symbols = (0, _getOwnPropertySymbols.default)(object);
28598 if (enumerableOnly) symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
28599 return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
28600 });
28601 keys.push.apply(keys, symbols);
28602 }
28603
28604 return keys;
28605}
28606
28607function _objectSpread$2(target) {
28608 for (var i = 1; i < arguments.length; i++) {
28609 var source = arguments[i] != null ? arguments[i] : {};
28610
28611 if (i % 2) {
28612 ownKeys$2(Object(source), true).forEach(function (key) {
28613 _defineProperty(target, key, source[key]);
28614 });
28615 } else if (_getOwnPropertyDescriptors.default) {
28616 (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source));
28617 } else {
28618 ownKeys$2(Object(source)).forEach(function (key) {
28619 (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
28620 });
28621 }
28622 }
28623
28624 return target;
28625}
28626
28627var debug$6 = d('LC:Realtime');
28628var routerCache = new Cache('push-router');
28629var initializedApp = {};
28630
28631var Realtime = /*#__PURE__*/function (_EventEmitter) {
28632 _inheritsLoose(Realtime, _EventEmitter);
28633 /**
28634 * @extends EventEmitter
28635 * @param {Object} options
28636 * @param {String} options.appId
28637 * @param {String} options.appKey (since 4.0.0)
28638 * @param {String|Object} [options.server] 指定服务器域名,中国节点应用此参数必填(since 4.0.0)
28639 * @param {Boolean} [options.noBinary=false] 设置 WebSocket 使用字符串格式收发消息(默认为二进制格式)。
28640 * 适用于 WebSocket 实现不支持二进制数据格式的情况
28641 * @param {Boolean} [options.ssl=true] 使用 wss 进行连接
28642 * @param {String|String[]} [options.RTMServers] 指定私有部署的 RTM 服务器地址(since 4.0.0)
28643 * @param {Plugin[]} [options.plugins] 加载插件(since 3.1.0)
28644 */
28645
28646
28647 function Realtime(_ref) {
28648 var _context25;
28649
28650 var _this2;
28651
28652 var plugins = _ref.plugins,
28653 options = _objectWithoutProperties(_ref, ["plugins"]);
28654
28655 debug$6('initializing Realtime %s %O', version, options);
28656 _this2 = _EventEmitter.call(this) || this;
28657 var appId = options.appId;
28658
28659 if (typeof appId !== 'string') {
28660 throw new TypeError("appId [".concat(appId, "] is not a string"));
28661 }
28662
28663 if (initializedApp[appId]) {
28664 throw new Error("App [".concat(appId, "] is already initialized."));
28665 }
28666
28667 initializedApp[appId] = true;
28668
28669 if (typeof options.appKey !== 'string') {
28670 throw new TypeError("appKey [".concat(options.appKey, "] is not a string"));
28671 }
28672
28673 if (isCNApp(appId)) {
28674 if (!options.server) {
28675 throw new TypeError("server option is required for apps from CN region");
28676 }
28677 }
28678
28679 _this2._options = _objectSpread$2({
28680 appId: undefined,
28681 appKey: undefined,
28682 noBinary: false,
28683 ssl: true,
28684 RTMServerName: typeof process !== 'undefined' ? process.env.RTM_SERVER_NAME : undefined
28685 }, options);
28686 _this2._cache = new Cache('endpoints');
28687
28688 var _this = internal(_assertThisInitialized(_this2));
28689
28690 _this.clients = new _set.default();
28691 _this.pendingClients = new _set.default();
28692 var mergedPlugins = (0, _concat.default)(_context25 = []).call(_context25, _toConsumableArray(ensureArray(Realtime.__preRegisteredPlugins)), _toConsumableArray(ensureArray(plugins)));
28693 debug$6('Using plugins %o', (0, _map.default)(mergedPlugins).call(mergedPlugins, function (plugin) {
28694 return plugin.name;
28695 }));
28696 _this2._plugins = (0, _reduce.default)(mergedPlugins).call(mergedPlugins, function (result, plugin) {
28697 (0, _keys.default)(plugin).forEach(function (hook) {
28698 if ({}.hasOwnProperty.call(plugin, hook) && hook !== 'name') {
28699 var _context26;
28700
28701 if (plugin.name) {
28702 ensureArray(plugin[hook]).forEach(function (value) {
28703 // eslint-disable-next-line no-param-reassign
28704 value._pluginName = plugin.name;
28705 });
28706 } // eslint-disable-next-line no-param-reassign
28707
28708
28709 result[hook] = (0, _concat.default)(_context26 = ensureArray(result[hook])).call(_context26, plugin[hook]);
28710 }
28711 });
28712 return result;
28713 }, {}); // onRealtimeCreate hook
28714
28715 applyDecorators(_this2._plugins.onRealtimeCreate, _assertThisInitialized(_this2));
28716 return _this2;
28717 }
28718
28719 var _proto = Realtime.prototype;
28720
28721 _proto._request = /*#__PURE__*/function () {
28722 var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
28723 var method, _url, _ref2$version, version, path, query, headers, data, url, _this$_options, appId, server, _yield$this$construct, api;
28724
28725 return _regeneratorRuntime.wrap(function _callee$(_context) {
28726 var _context27, _context28;
28727
28728 while (1) {
28729 switch (_context.prev = _context.next) {
28730 case 0:
28731 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;
28732 url = _url;
28733
28734 if (url) {
28735 _context.next = 9;
28736 break;
28737 }
28738
28739 _this$_options = this._options, appId = _this$_options.appId, server = _this$_options.server;
28740 _context.next = 6;
28741 return this.constructor._getServerUrls({
28742 appId: appId,
28743 server: server
28744 });
28745
28746 case 6:
28747 _yield$this$construct = _context.sent;
28748 api = _yield$this$construct.api;
28749 url = (0, _concat.default)(_context27 = (0, _concat.default)(_context28 = "".concat(api, "/")).call(_context28, version)).call(_context27, path);
28750
28751 case 9:
28752 return _context.abrupt("return", request({
28753 url: url,
28754 method: method,
28755 query: query,
28756 headers: _objectSpread$2({
28757 'X-LC-Id': this._options.appId,
28758 'X-LC-Key': this._options.appKey
28759 }, headers),
28760 data: data
28761 }));
28762
28763 case 10:
28764 case "end":
28765 return _context.stop();
28766 }
28767 }
28768 }, _callee, this);
28769 }));
28770
28771 function _request(_x) {
28772 return _request2.apply(this, arguments);
28773 }
28774
28775 return _request;
28776 }();
28777
28778 _proto._open = function _open() {
28779 var _this3 = this;
28780
28781 if (this._openPromise) return this._openPromise;
28782 var format = 'protobuf2';
28783
28784 if (this._options.noBinary) {
28785 // 不发送 binary data,fallback to base64 string
28786 format = 'proto2base64';
28787 }
28788
28789 var version = 3;
28790 var protocol = {
28791 format: format,
28792 version: version
28793 };
28794 this._openPromise = new _promise.default(function (resolve, reject) {
28795 debug$6('No connection established, create a new one.');
28796 var connection = new Connection(function () {
28797 return _this3._getRTMServers(_this3._options);
28798 }, protocol);
28799 connection.on(OPEN, function () {
28800 return resolve(connection);
28801 }).on(ERROR, function (error) {
28802 delete _this3._openPromise;
28803 reject(error);
28804 }).on(EXPIRE, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
28805 return _regeneratorRuntime.wrap(function _callee2$(_context2) {
28806 while (1) {
28807 switch (_context2.prev = _context2.next) {
28808 case 0:
28809 debug$6('Connection expired. Refresh endpoints.');
28810
28811 _this3._cache.set('endpoints', null, 0);
28812
28813 _context2.next = 4;
28814 return _this3._getRTMServers(_this3._options);
28815
28816 case 4:
28817 connection.urls = _context2.sent;
28818 connection.disconnect();
28819
28820 case 6:
28821 case "end":
28822 return _context2.stop();
28823 }
28824 }
28825 }, _callee2);
28826 }))).on(MESSAGE, _this3._dispatchCommand.bind(_this3));
28827 /**
28828 * 连接断开。
28829 * 连接断开可能是因为 SDK 进入了离线状态(see {@link Realtime#event:OFFLINE}),或长时间没有收到服务器心跳。
28830 * 连接断开后所有的网络操作都会失败,请在连接断开后禁用相关的 UI 元素。
28831 * @event Realtime#DISCONNECT
28832 */
28833
28834 /**
28835 * 计划在一段时间后尝试重新连接
28836 * @event Realtime#SCHEDULE
28837 * @param {Number} attempt 尝试重连的次数
28838 * @param {Number} delay 延迟的毫秒数
28839 */
28840
28841 /**
28842 * 正在尝试重新连接
28843 * @event Realtime#RETRY
28844 * @param {Number} attempt 尝试重连的次数
28845 */
28846
28847 /**
28848 * 连接恢复正常。
28849 * 请重新启用在 {@link Realtime#event:DISCONNECT} 事件中禁用的相关 UI 元素
28850 * @event Realtime#RECONNECT
28851 */
28852
28853 /**
28854 * 客户端连接断开
28855 * @event IMClient#DISCONNECT
28856 * @see Realtime#event:DISCONNECT
28857 * @since 3.2.0
28858 */
28859
28860 /**
28861 * 计划在一段时间后尝试重新连接
28862 * @event IMClient#SCHEDULE
28863 * @param {Number} attempt 尝试重连的次数
28864 * @param {Number} delay 延迟的毫秒数
28865 * @since 3.2.0
28866 */
28867
28868 /**
28869 * 正在尝试重新连接
28870 * @event IMClient#RETRY
28871 * @param {Number} attempt 尝试重连的次数
28872 * @since 3.2.0
28873 */
28874
28875 /**
28876 * 客户端进入离线状态。
28877 * 这通常意味着网络已断开,或者 {@link Realtime#pause} 被调用
28878 * @event Realtime#OFFLINE
28879 * @since 3.4.0
28880 */
28881
28882 /**
28883 * 客户端恢复在线状态
28884 * 这通常意味着网络已恢复,或者 {@link Realtime#resume} 被调用
28885 * @event Realtime#ONLINE
28886 * @since 3.4.0
28887 */
28888
28889 /**
28890 * 进入离线状态。
28891 * 这通常意味着网络已断开,或者 {@link Realtime#pause} 被调用
28892 * @event IMClient#OFFLINE
28893 * @since 3.4.0
28894 */
28895
28896 /**
28897 * 恢复在线状态
28898 * 这通常意味着网络已恢复,或者 {@link Realtime#resume} 被调用
28899 * @event IMClient#ONLINE
28900 * @since 3.4.0
28901 */
28902 // event proxy
28903
28904 [DISCONNECT, RECONNECT, RETRY, SCHEDULE, OFFLINE, ONLINE].forEach(function (event) {
28905 return connection.on(event, function () {
28906 var _context29;
28907
28908 for (var _len = arguments.length, payload = new Array(_len), _key = 0; _key < _len; _key++) {
28909 payload[_key] = arguments[_key];
28910 }
28911
28912 debug$6("".concat(event, " event emitted. %o"), payload);
28913
28914 _this3.emit.apply(_this3, (0, _concat.default)(_context29 = [event]).call(_context29, payload));
28915
28916 if (event !== RECONNECT) {
28917 internal(_this3).clients.forEach(function (client) {
28918 var _context30;
28919
28920 client.emit.apply(client, (0, _concat.default)(_context30 = [event]).call(_context30, payload));
28921 });
28922 }
28923 });
28924 }); // override handleClose
28925
28926 connection.handleClose = function handleClose(event) {
28927 var isFatal = [ErrorCode.APP_NOT_AVAILABLE, ErrorCode.INVALID_LOGIN, ErrorCode.INVALID_ORIGIN].some(function (errorCode) {
28928 return errorCode === event.code;
28929 });
28930
28931 if (isFatal) {
28932 // in these cases, SDK should throw.
28933 this["throw"](createError(event));
28934 } else {
28935 // reconnect
28936 this.disconnect();
28937 }
28938 };
28939
28940 internal(_this3).connection = connection;
28941 });
28942 return this._openPromise;
28943 };
28944
28945 _proto._getRTMServers = /*#__PURE__*/function () {
28946 var _getRTMServers2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(options) {
28947 var info, cachedEndPoints, _info, server, secondary, ttl;
28948
28949 return _regeneratorRuntime.wrap(function _callee3$(_context3) {
28950 while (1) {
28951 switch (_context3.prev = _context3.next) {
28952 case 0:
28953 if (!options.RTMServers) {
28954 _context3.next = 2;
28955 break;
28956 }
28957
28958 return _context3.abrupt("return", shuffle(ensureArray(options.RTMServers)));
28959
28960 case 2:
28961 cachedEndPoints = this._cache.get('endpoints');
28962
28963 if (!cachedEndPoints) {
28964 _context3.next = 7;
28965 break;
28966 }
28967
28968 info = cachedEndPoints;
28969 _context3.next = 14;
28970 break;
28971
28972 case 7:
28973 _context3.next = 9;
28974 return this.constructor._fetchRTMServers(options);
28975
28976 case 9:
28977 info = _context3.sent;
28978 _info = info, server = _info.server, secondary = _info.secondary, ttl = _info.ttl;
28979
28980 if (!(typeof server !== 'string' && typeof secondary !== 'string' && typeof ttl !== 'number')) {
28981 _context3.next = 13;
28982 break;
28983 }
28984
28985 throw new Error("malformed RTM route response: ".concat((0, _stringify.default)(info)));
28986
28987 case 13:
28988 this._cache.set('endpoints', info, info.ttl * 1000);
28989
28990 case 14:
28991 debug$6('endpoint info: %O', info);
28992 return _context3.abrupt("return", [info.server, info.secondary]);
28993
28994 case 16:
28995 case "end":
28996 return _context3.stop();
28997 }
28998 }
28999 }, _callee3, this);
29000 }));
29001
29002 function _getRTMServers(_x2) {
29003 return _getRTMServers2.apply(this, arguments);
29004 }
29005
29006 return _getRTMServers;
29007 }();
29008
29009 Realtime._getServerUrls = /*#__PURE__*/function () {
29010 var _getServerUrls2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref4) {
29011 var appId, server, cachedRouter, defaultProtocol;
29012 return _regeneratorRuntime.wrap(function _callee4$(_context4) {
29013 while (1) {
29014 switch (_context4.prev = _context4.next) {
29015 case 0:
29016 appId = _ref4.appId, server = _ref4.server;
29017 debug$6('fetch server urls');
29018
29019 if (!server) {
29020 _context4.next = 6;
29021 break;
29022 }
29023
29024 if (!(typeof server !== 'string')) {
29025 _context4.next = 5;
29026 break;
29027 }
29028
29029 return _context4.abrupt("return", server);
29030
29031 case 5:
29032 return _context4.abrupt("return", {
29033 RTMRouter: server,
29034 api: server
29035 });
29036
29037 case 6:
29038 cachedRouter = routerCache.get(appId);
29039
29040 if (!cachedRouter) {
29041 _context4.next = 9;
29042 break;
29043 }
29044
29045 return _context4.abrupt("return", cachedRouter);
29046
29047 case 9:
29048 defaultProtocol = 'https://';
29049 return _context4.abrupt("return", request({
29050 url: 'https://app-router.com/2/route',
29051 query: {
29052 appId: appId
29053 },
29054 timeout: 20000
29055 }).then(tap(debug$6)).then(function (_ref5) {
29056 var _context31, _context32;
29057
29058 var RTMRouterServer = _ref5.rtm_router_server,
29059 APIServer = _ref5.api_server,
29060 _ref5$ttl = _ref5.ttl,
29061 ttl = _ref5$ttl === void 0 ? 3600 : _ref5$ttl;
29062
29063 if (!RTMRouterServer) {
29064 throw new Error('rtm router not exists');
29065 }
29066
29067 var serverUrls = {
29068 RTMRouter: (0, _concat.default)(_context31 = "".concat(defaultProtocol)).call(_context31, RTMRouterServer),
29069 api: (0, _concat.default)(_context32 = "".concat(defaultProtocol)).call(_context32, APIServer)
29070 };
29071 routerCache.set(appId, serverUrls, ttl * 1000);
29072 return serverUrls;
29073 })["catch"](function () {
29074 var _context33, _context34, _context35, _context36;
29075
29076 var id = (0, _slice.default)(appId).call(appId, 0, 8).toLowerCase();
29077 var domain = 'lncldglobal.com';
29078 return {
29079 RTMRouter: (0, _concat.default)(_context33 = (0, _concat.default)(_context34 = "".concat(defaultProtocol)).call(_context34, id, ".rtm.")).call(_context33, domain),
29080 api: (0, _concat.default)(_context35 = (0, _concat.default)(_context36 = "".concat(defaultProtocol)).call(_context36, id, ".api.")).call(_context35, domain)
29081 };
29082 }));
29083
29084 case 11:
29085 case "end":
29086 return _context4.stop();
29087 }
29088 }
29089 }, _callee4);
29090 }));
29091
29092 function _getServerUrls(_x3) {
29093 return _getServerUrls2.apply(this, arguments);
29094 }
29095
29096 return _getServerUrls;
29097 }();
29098
29099 Realtime._fetchRTMServers = function _fetchRTMServers(_ref6) {
29100 var appId = _ref6.appId,
29101 ssl = _ref6.ssl,
29102 server = _ref6.server,
29103 RTMServerName = _ref6.RTMServerName;
29104 debug$6('fetch endpoint info');
29105 return this._getServerUrls({
29106 appId: appId,
29107 server: server
29108 }).then(tap(debug$6)).then(function (_ref7) {
29109 var RTMRouter = _ref7.RTMRouter;
29110 return request({
29111 url: "".concat(RTMRouter, "/v1/route"),
29112 query: {
29113 appId: appId,
29114 secure: ssl,
29115 features: isWeapp ? 'wechat' : undefined,
29116 server: RTMServerName,
29117 _t: Date.now()
29118 },
29119 timeout: 20000
29120 }).then(tap(debug$6));
29121 });
29122 };
29123
29124 _proto._close = function _close() {
29125 if (this._openPromise) {
29126 this._openPromise.then(function (connection) {
29127 return connection.close();
29128 });
29129 }
29130
29131 delete this._openPromise;
29132 }
29133 /**
29134 * 手动进行重连。
29135 * SDK 在网络出现异常时会自动按照一定的时间间隔尝试重连,调用该方法会立即尝试重连并重置重连尝试计数器。
29136 * 只能在 `SCHEDULE` 事件之后,`RETRY` 事件之前调用,如果当前网络正常或者正在进行重连,调用该方法会抛异常。
29137 */
29138 ;
29139
29140 _proto.retry = function retry() {
29141 var _internal = internal(this),
29142 connection = _internal.connection;
29143
29144 if (!connection) {
29145 throw new Error('no connection established');
29146 }
29147
29148 if (connection.cannot('retry')) {
29149 throw new Error("retrying not allowed when not disconnected. the connection is now ".concat(connection.current));
29150 }
29151
29152 return connection.retry();
29153 }
29154 /**
29155 * 暂停,使 SDK 进入离线状态。
29156 * 你可以在网络断开、应用进入后台等时刻调用该方法让 SDK 进入离线状态,离线状态下不会尝试重连。
29157 * 在浏览器中 SDK 会自动监听网络变化,因此无需手动调用该方法。
29158 *
29159 * @since 3.4.0
29160 * @see Realtime#event:OFFLINE
29161 */
29162 ;
29163
29164 _proto.pause = function pause() {
29165 // 这个方法常常在网络断开、进入后台时被调用,此时 connection 可能没有建立或者已经 close。
29166 // 因此不像 retry,这个方法应该尽可能 loose
29167 var _internal2 = internal(this),
29168 connection = _internal2.connection;
29169
29170 if (!connection) return;
29171 if (connection.can('pause')) connection.pause();
29172 }
29173 /**
29174 * 恢复在线状态。
29175 * 你可以在网络恢复、应用回到前台等时刻调用该方法让 SDK 恢复在线状态,恢复在线状态后 SDK 会开始尝试重连。
29176 *
29177 * @since 3.4.0
29178 * @see Realtime#event:ONLINE
29179 */
29180 ;
29181
29182 _proto.resume = function resume() {
29183 // 与 pause 一样,这个方法应该尽可能 loose
29184 var _internal3 = internal(this),
29185 connection = _internal3.connection;
29186
29187 if (!connection) return;
29188 if (connection.can('resume')) connection.resume();
29189 };
29190
29191 _proto._registerPending = function _registerPending(value) {
29192 internal(this).pendingClients.add(value);
29193 };
29194
29195 _proto._deregisterPending = function _deregisterPending(client) {
29196 internal(this).pendingClients["delete"](client);
29197 };
29198
29199 _proto._register = function _register(client) {
29200 internal(this).clients.add(client);
29201 };
29202
29203 _proto._deregister = function _deregister(client) {
29204 var _this = internal(this);
29205
29206 _this.clients["delete"](client);
29207
29208 if (_this.clients.size + _this.pendingClients.size === 0) {
29209 this._close();
29210 }
29211 };
29212
29213 _proto._dispatchCommand = function _dispatchCommand(command) {
29214 return applyDispatcher(this._plugins.beforeCommandDispatch, [command, this]).then(function (shouldDispatch) {
29215 // no plugin handled this command
29216 if (shouldDispatch) return debug$6('[WARN] Unexpected message received: %O', trim(command));
29217 return false;
29218 });
29219 };
29220
29221 return Realtime;
29222}(EventEmitter); // For test purpose only
29223
29224
29225var polyfilledPromise = _promise.default;
29226exports.EventEmitter = EventEmitter;
29227exports.Promise = polyfilledPromise;
29228exports.Protocals = message;
29229exports.Protocols = message;
29230exports.Realtime = Realtime;
29231exports.debug = debug$2;
29232exports.getAdapter = getAdapter;
29233exports.setAdapters = setAdapters;
29234/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(72)))
29235
29236/***/ }),
29237/* 567 */
29238/***/ (function(module, exports, __webpack_require__) {
29239
29240module.exports = __webpack_require__(568);
29241
29242/***/ }),
29243/* 568 */
29244/***/ (function(module, exports, __webpack_require__) {
29245
29246var parent = __webpack_require__(569);
29247
29248module.exports = parent;
29249
29250
29251/***/ }),
29252/* 569 */
29253/***/ (function(module, exports, __webpack_require__) {
29254
29255__webpack_require__(570);
29256var path = __webpack_require__(6);
29257
29258module.exports = path.Object.freeze;
29259
29260
29261/***/ }),
29262/* 570 */
29263/***/ (function(module, exports, __webpack_require__) {
29264
29265var $ = __webpack_require__(0);
29266var FREEZING = __webpack_require__(254);
29267var fails = __webpack_require__(2);
29268var isObject = __webpack_require__(11);
29269var onFreeze = __webpack_require__(93).onFreeze;
29270
29271// eslint-disable-next-line es-x/no-object-freeze -- safe
29272var $freeze = Object.freeze;
29273var FAILS_ON_PRIMITIVES = fails(function () { $freeze(1); });
29274
29275// `Object.freeze` method
29276// https://tc39.es/ecma262/#sec-object.freeze
29277$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !FREEZING }, {
29278 freeze: function freeze(it) {
29279 return $freeze && isObject(it) ? $freeze(onFreeze(it)) : it;
29280 }
29281});
29282
29283
29284/***/ }),
29285/* 571 */
29286/***/ (function(module, exports, __webpack_require__) {
29287
29288// FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it
29289var fails = __webpack_require__(2);
29290
29291module.exports = fails(function () {
29292 if (typeof ArrayBuffer == 'function') {
29293 var buffer = new ArrayBuffer(8);
29294 // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-defineproperty -- safe
29295 if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 });
29296 }
29297});
29298
29299
29300/***/ }),
29301/* 572 */
29302/***/ (function(module, exports, __webpack_require__) {
29303
29304var parent = __webpack_require__(573);
29305
29306module.exports = parent;
29307
29308
29309/***/ }),
29310/* 573 */
29311/***/ (function(module, exports, __webpack_require__) {
29312
29313__webpack_require__(574);
29314var path = __webpack_require__(6);
29315
29316module.exports = path.Object.assign;
29317
29318
29319/***/ }),
29320/* 574 */
29321/***/ (function(module, exports, __webpack_require__) {
29322
29323var $ = __webpack_require__(0);
29324var assign = __webpack_require__(575);
29325
29326// `Object.assign` method
29327// https://tc39.es/ecma262/#sec-object.assign
29328// eslint-disable-next-line es-x/no-object-assign -- required for testing
29329$({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
29330 assign: assign
29331});
29332
29333
29334/***/ }),
29335/* 575 */
29336/***/ (function(module, exports, __webpack_require__) {
29337
29338"use strict";
29339
29340var DESCRIPTORS = __webpack_require__(14);
29341var uncurryThis = __webpack_require__(4);
29342var call = __webpack_require__(15);
29343var fails = __webpack_require__(2);
29344var objectKeys = __webpack_require__(104);
29345var getOwnPropertySymbolsModule = __webpack_require__(103);
29346var propertyIsEnumerableModule = __webpack_require__(119);
29347var toObject = __webpack_require__(34);
29348var IndexedObject = __webpack_require__(94);
29349
29350// eslint-disable-next-line es-x/no-object-assign -- safe
29351var $assign = Object.assign;
29352// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
29353var defineProperty = Object.defineProperty;
29354var concat = uncurryThis([].concat);
29355
29356// `Object.assign` method
29357// https://tc39.es/ecma262/#sec-object.assign
29358module.exports = !$assign || fails(function () {
29359 // should have correct order of operations (Edge bug)
29360 if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
29361 enumerable: true,
29362 get: function () {
29363 defineProperty(this, 'b', {
29364 value: 3,
29365 enumerable: false
29366 });
29367 }
29368 }), { b: 2 })).b !== 1) return true;
29369 // should work with symbols and should have deterministic property order (V8 bug)
29370 var A = {};
29371 var B = {};
29372 // eslint-disable-next-line es-x/no-symbol -- safe
29373 var symbol = Symbol();
29374 var alphabet = 'abcdefghijklmnopqrst';
29375 A[symbol] = 7;
29376 alphabet.split('').forEach(function (chr) { B[chr] = chr; });
29377 return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
29378}) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
29379 var T = toObject(target);
29380 var argumentsLength = arguments.length;
29381 var index = 1;
29382 var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
29383 var propertyIsEnumerable = propertyIsEnumerableModule.f;
29384 while (argumentsLength > index) {
29385 var S = IndexedObject(arguments[index++]);
29386 var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
29387 var length = keys.length;
29388 var j = 0;
29389 var key;
29390 while (length > j) {
29391 key = keys[j++];
29392 if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key];
29393 }
29394 } return T;
29395} : $assign;
29396
29397
29398/***/ }),
29399/* 576 */
29400/***/ (function(module, exports, __webpack_require__) {
29401
29402var parent = __webpack_require__(577);
29403
29404module.exports = parent;
29405
29406
29407/***/ }),
29408/* 577 */
29409/***/ (function(module, exports, __webpack_require__) {
29410
29411__webpack_require__(238);
29412var path = __webpack_require__(6);
29413
29414module.exports = path.Object.getOwnPropertySymbols;
29415
29416
29417/***/ }),
29418/* 578 */
29419/***/ (function(module, exports, __webpack_require__) {
29420
29421module.exports = __webpack_require__(579);
29422
29423/***/ }),
29424/* 579 */
29425/***/ (function(module, exports, __webpack_require__) {
29426
29427var parent = __webpack_require__(580);
29428
29429module.exports = parent;
29430
29431
29432/***/ }),
29433/* 580 */
29434/***/ (function(module, exports, __webpack_require__) {
29435
29436__webpack_require__(581);
29437var path = __webpack_require__(6);
29438
29439module.exports = path.Object.getOwnPropertyDescriptors;
29440
29441
29442/***/ }),
29443/* 581 */
29444/***/ (function(module, exports, __webpack_require__) {
29445
29446var $ = __webpack_require__(0);
29447var DESCRIPTORS = __webpack_require__(14);
29448var ownKeys = __webpack_require__(156);
29449var toIndexedObject = __webpack_require__(32);
29450var getOwnPropertyDescriptorModule = __webpack_require__(60);
29451var createProperty = __webpack_require__(89);
29452
29453// `Object.getOwnPropertyDescriptors` method
29454// https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
29455$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
29456 getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
29457 var O = toIndexedObject(object);
29458 var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
29459 var keys = ownKeys(O);
29460 var result = {};
29461 var index = 0;
29462 var key, descriptor;
29463 while (keys.length > index) {
29464 descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
29465 if (descriptor !== undefined) createProperty(result, key, descriptor);
29466 }
29467 return result;
29468 }
29469});
29470
29471
29472/***/ }),
29473/* 582 */
29474/***/ (function(module, exports, __webpack_require__) {
29475
29476module.exports = __webpack_require__(583);
29477
29478/***/ }),
29479/* 583 */
29480/***/ (function(module, exports, __webpack_require__) {
29481
29482var parent = __webpack_require__(584);
29483
29484module.exports = parent;
29485
29486
29487/***/ }),
29488/* 584 */
29489/***/ (function(module, exports, __webpack_require__) {
29490
29491__webpack_require__(585);
29492var path = __webpack_require__(6);
29493
29494var Object = path.Object;
29495
29496var defineProperties = module.exports = function defineProperties(T, D) {
29497 return Object.defineProperties(T, D);
29498};
29499
29500if (Object.defineProperties.sham) defineProperties.sham = true;
29501
29502
29503/***/ }),
29504/* 585 */
29505/***/ (function(module, exports, __webpack_require__) {
29506
29507var $ = __webpack_require__(0);
29508var DESCRIPTORS = __webpack_require__(14);
29509var defineProperties = __webpack_require__(127).f;
29510
29511// `Object.defineProperties` method
29512// https://tc39.es/ecma262/#sec-object.defineproperties
29513// eslint-disable-next-line es-x/no-object-defineproperties -- safe
29514$({ target: 'Object', stat: true, forced: Object.defineProperties !== defineProperties, sham: !DESCRIPTORS }, {
29515 defineProperties: defineProperties
29516});
29517
29518
29519/***/ }),
29520/* 586 */
29521/***/ (function(module, exports, __webpack_require__) {
29522
29523module.exports = __webpack_require__(587);
29524
29525/***/ }),
29526/* 587 */
29527/***/ (function(module, exports, __webpack_require__) {
29528
29529var parent = __webpack_require__(588);
29530__webpack_require__(44);
29531
29532module.exports = parent;
29533
29534
29535/***/ }),
29536/* 588 */
29537/***/ (function(module, exports, __webpack_require__) {
29538
29539__webpack_require__(41);
29540__webpack_require__(63);
29541__webpack_require__(589);
29542var path = __webpack_require__(6);
29543
29544module.exports = path.WeakMap;
29545
29546
29547/***/ }),
29548/* 589 */
29549/***/ (function(module, exports, __webpack_require__) {
29550
29551// TODO: Remove this module from `core-js@4` since it's replaced to module below
29552__webpack_require__(590);
29553
29554
29555/***/ }),
29556/* 590 */
29557/***/ (function(module, exports, __webpack_require__) {
29558
29559"use strict";
29560
29561var global = __webpack_require__(7);
29562var uncurryThis = __webpack_require__(4);
29563var defineBuiltIns = __webpack_require__(150);
29564var InternalMetadataModule = __webpack_require__(93);
29565var collection = __webpack_require__(258);
29566var collectionWeak = __webpack_require__(591);
29567var isObject = __webpack_require__(11);
29568var isExtensible = __webpack_require__(255);
29569var enforceInternalState = __webpack_require__(42).enforce;
29570var NATIVE_WEAK_MAP = __webpack_require__(164);
29571
29572var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
29573var InternalWeakMap;
29574
29575var wrapper = function (init) {
29576 return function WeakMap() {
29577 return init(this, arguments.length ? arguments[0] : undefined);
29578 };
29579};
29580
29581// `WeakMap` constructor
29582// https://tc39.es/ecma262/#sec-weakmap-constructor
29583var $WeakMap = collection('WeakMap', wrapper, collectionWeak);
29584
29585// IE11 WeakMap frozen keys fix
29586// We can't use feature detection because it crash some old IE builds
29587// https://github.com/zloirock/core-js/issues/485
29588if (NATIVE_WEAK_MAP && IS_IE11) {
29589 InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);
29590 InternalMetadataModule.enable();
29591 var WeakMapPrototype = $WeakMap.prototype;
29592 var nativeDelete = uncurryThis(WeakMapPrototype['delete']);
29593 var nativeHas = uncurryThis(WeakMapPrototype.has);
29594 var nativeGet = uncurryThis(WeakMapPrototype.get);
29595 var nativeSet = uncurryThis(WeakMapPrototype.set);
29596 defineBuiltIns(WeakMapPrototype, {
29597 'delete': function (key) {
29598 if (isObject(key) && !isExtensible(key)) {
29599 var state = enforceInternalState(this);
29600 if (!state.frozen) state.frozen = new InternalWeakMap();
29601 return nativeDelete(this, key) || state.frozen['delete'](key);
29602 } return nativeDelete(this, key);
29603 },
29604 has: function has(key) {
29605 if (isObject(key) && !isExtensible(key)) {
29606 var state = enforceInternalState(this);
29607 if (!state.frozen) state.frozen = new InternalWeakMap();
29608 return nativeHas(this, key) || state.frozen.has(key);
29609 } return nativeHas(this, key);
29610 },
29611 get: function get(key) {
29612 if (isObject(key) && !isExtensible(key)) {
29613 var state = enforceInternalState(this);
29614 if (!state.frozen) state.frozen = new InternalWeakMap();
29615 return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key);
29616 } return nativeGet(this, key);
29617 },
29618 set: function set(key, value) {
29619 if (isObject(key) && !isExtensible(key)) {
29620 var state = enforceInternalState(this);
29621 if (!state.frozen) state.frozen = new InternalWeakMap();
29622 nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value);
29623 } else nativeSet(this, key, value);
29624 return this;
29625 }
29626 });
29627}
29628
29629
29630/***/ }),
29631/* 591 */
29632/***/ (function(module, exports, __webpack_require__) {
29633
29634"use strict";
29635
29636var uncurryThis = __webpack_require__(4);
29637var defineBuiltIns = __webpack_require__(150);
29638var getWeakData = __webpack_require__(93).getWeakData;
29639var anObject = __webpack_require__(20);
29640var isObject = __webpack_require__(11);
29641var anInstance = __webpack_require__(107);
29642var iterate = __webpack_require__(40);
29643var ArrayIterationModule = __webpack_require__(70);
29644var hasOwn = __webpack_require__(12);
29645var InternalStateModule = __webpack_require__(42);
29646
29647var setInternalState = InternalStateModule.set;
29648var internalStateGetterFor = InternalStateModule.getterFor;
29649var find = ArrayIterationModule.find;
29650var findIndex = ArrayIterationModule.findIndex;
29651var splice = uncurryThis([].splice);
29652var id = 0;
29653
29654// fallback for uncaught frozen keys
29655var uncaughtFrozenStore = function (store) {
29656 return store.frozen || (store.frozen = new UncaughtFrozenStore());
29657};
29658
29659var UncaughtFrozenStore = function () {
29660 this.entries = [];
29661};
29662
29663var findUncaughtFrozen = function (store, key) {
29664 return find(store.entries, function (it) {
29665 return it[0] === key;
29666 });
29667};
29668
29669UncaughtFrozenStore.prototype = {
29670 get: function (key) {
29671 var entry = findUncaughtFrozen(this, key);
29672 if (entry) return entry[1];
29673 },
29674 has: function (key) {
29675 return !!findUncaughtFrozen(this, key);
29676 },
29677 set: function (key, value) {
29678 var entry = findUncaughtFrozen(this, key);
29679 if (entry) entry[1] = value;
29680 else this.entries.push([key, value]);
29681 },
29682 'delete': function (key) {
29683 var index = findIndex(this.entries, function (it) {
29684 return it[0] === key;
29685 });
29686 if (~index) splice(this.entries, index, 1);
29687 return !!~index;
29688 }
29689};
29690
29691module.exports = {
29692 getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
29693 var Constructor = wrapper(function (that, iterable) {
29694 anInstance(that, Prototype);
29695 setInternalState(that, {
29696 type: CONSTRUCTOR_NAME,
29697 id: id++,
29698 frozen: undefined
29699 });
29700 if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
29701 });
29702
29703 var Prototype = Constructor.prototype;
29704
29705 var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
29706
29707 var define = function (that, key, value) {
29708 var state = getInternalState(that);
29709 var data = getWeakData(anObject(key), true);
29710 if (data === true) uncaughtFrozenStore(state).set(key, value);
29711 else data[state.id] = value;
29712 return that;
29713 };
29714
29715 defineBuiltIns(Prototype, {
29716 // `{ WeakMap, WeakSet }.prototype.delete(key)` methods
29717 // https://tc39.es/ecma262/#sec-weakmap.prototype.delete
29718 // https://tc39.es/ecma262/#sec-weakset.prototype.delete
29719 'delete': function (key) {
29720 var state = getInternalState(this);
29721 if (!isObject(key)) return false;
29722 var data = getWeakData(key);
29723 if (data === true) return uncaughtFrozenStore(state)['delete'](key);
29724 return data && hasOwn(data, state.id) && delete data[state.id];
29725 },
29726 // `{ WeakMap, WeakSet }.prototype.has(key)` methods
29727 // https://tc39.es/ecma262/#sec-weakmap.prototype.has
29728 // https://tc39.es/ecma262/#sec-weakset.prototype.has
29729 has: function has(key) {
29730 var state = getInternalState(this);
29731 if (!isObject(key)) return false;
29732 var data = getWeakData(key);
29733 if (data === true) return uncaughtFrozenStore(state).has(key);
29734 return data && hasOwn(data, state.id);
29735 }
29736 });
29737
29738 defineBuiltIns(Prototype, IS_MAP ? {
29739 // `WeakMap.prototype.get(key)` method
29740 // https://tc39.es/ecma262/#sec-weakmap.prototype.get
29741 get: function get(key) {
29742 var state = getInternalState(this);
29743 if (isObject(key)) {
29744 var data = getWeakData(key);
29745 if (data === true) return uncaughtFrozenStore(state).get(key);
29746 return data ? data[state.id] : undefined;
29747 }
29748 },
29749 // `WeakMap.prototype.set(key, value)` method
29750 // https://tc39.es/ecma262/#sec-weakmap.prototype.set
29751 set: function set(key, value) {
29752 return define(this, key, value);
29753 }
29754 } : {
29755 // `WeakSet.prototype.add(value)` method
29756 // https://tc39.es/ecma262/#sec-weakset.prototype.add
29757 add: function add(value) {
29758 return define(this, value, true);
29759 }
29760 });
29761
29762 return Constructor;
29763 }
29764};
29765
29766
29767/***/ }),
29768/* 592 */
29769/***/ (function(module, exports, __webpack_require__) {
29770
29771module.exports = __webpack_require__(593);
29772
29773/***/ }),
29774/* 593 */
29775/***/ (function(module, exports, __webpack_require__) {
29776
29777var parent = __webpack_require__(594);
29778
29779module.exports = parent;
29780
29781
29782/***/ }),
29783/* 594 */
29784/***/ (function(module, exports, __webpack_require__) {
29785
29786var isPrototypeOf = __webpack_require__(19);
29787var method = __webpack_require__(595);
29788
29789var ArrayPrototype = Array.prototype;
29790
29791module.exports = function (it) {
29792 var own = it.reduce;
29793 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.reduce) ? method : own;
29794};
29795
29796
29797/***/ }),
29798/* 595 */
29799/***/ (function(module, exports, __webpack_require__) {
29800
29801__webpack_require__(596);
29802var entryVirtual = __webpack_require__(38);
29803
29804module.exports = entryVirtual('Array').reduce;
29805
29806
29807/***/ }),
29808/* 596 */
29809/***/ (function(module, exports, __webpack_require__) {
29810
29811"use strict";
29812
29813var $ = __webpack_require__(0);
29814var $reduce = __webpack_require__(597).left;
29815var arrayMethodIsStrict = __webpack_require__(225);
29816var CHROME_VERSION = __webpack_require__(75);
29817var IS_NODE = __webpack_require__(106);
29818
29819var STRICT_METHOD = arrayMethodIsStrict('reduce');
29820// Chrome 80-82 has a critical bug
29821// https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
29822var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
29823
29824// `Array.prototype.reduce` method
29825// https://tc39.es/ecma262/#sec-array.prototype.reduce
29826$({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
29827 reduce: function reduce(callbackfn /* , initialValue */) {
29828 var length = arguments.length;
29829 return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
29830 }
29831});
29832
29833
29834/***/ }),
29835/* 597 */
29836/***/ (function(module, exports, __webpack_require__) {
29837
29838var aCallable = __webpack_require__(31);
29839var toObject = __webpack_require__(34);
29840var IndexedObject = __webpack_require__(94);
29841var lengthOfArrayLike = __webpack_require__(39);
29842
29843var $TypeError = TypeError;
29844
29845// `Array.prototype.{ reduce, reduceRight }` methods implementation
29846var createMethod = function (IS_RIGHT) {
29847 return function (that, callbackfn, argumentsLength, memo) {
29848 aCallable(callbackfn);
29849 var O = toObject(that);
29850 var self = IndexedObject(O);
29851 var length = lengthOfArrayLike(O);
29852 var index = IS_RIGHT ? length - 1 : 0;
29853 var i = IS_RIGHT ? -1 : 1;
29854 if (argumentsLength < 2) while (true) {
29855 if (index in self) {
29856 memo = self[index];
29857 index += i;
29858 break;
29859 }
29860 index += i;
29861 if (IS_RIGHT ? index < 0 : length <= index) {
29862 throw $TypeError('Reduce of empty array with no initial value');
29863 }
29864 }
29865 for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
29866 memo = callbackfn(memo, self[index], index, O);
29867 }
29868 return memo;
29869 };
29870};
29871
29872module.exports = {
29873 // `Array.prototype.reduce` method
29874 // https://tc39.es/ecma262/#sec-array.prototype.reduce
29875 left: createMethod(false),
29876 // `Array.prototype.reduceRight` method
29877 // https://tc39.es/ecma262/#sec-array.prototype.reduceright
29878 right: createMethod(true)
29879};
29880
29881
29882/***/ }),
29883/* 598 */
29884/***/ (function(module, exports, __webpack_require__) {
29885
29886var parent = __webpack_require__(599);
29887__webpack_require__(44);
29888
29889module.exports = parent;
29890
29891
29892/***/ }),
29893/* 599 */
29894/***/ (function(module, exports, __webpack_require__) {
29895
29896__webpack_require__(41);
29897__webpack_require__(63);
29898__webpack_require__(600);
29899__webpack_require__(65);
29900var path = __webpack_require__(6);
29901
29902module.exports = path.Set;
29903
29904
29905/***/ }),
29906/* 600 */
29907/***/ (function(module, exports, __webpack_require__) {
29908
29909// TODO: Remove this module from `core-js@4` since it's replaced to module below
29910__webpack_require__(601);
29911
29912
29913/***/ }),
29914/* 601 */
29915/***/ (function(module, exports, __webpack_require__) {
29916
29917"use strict";
29918
29919var collection = __webpack_require__(258);
29920var collectionStrong = __webpack_require__(602);
29921
29922// `Set` constructor
29923// https://tc39.es/ecma262/#sec-set-objects
29924collection('Set', function (init) {
29925 return function Set() { return init(this, arguments.length ? arguments[0] : undefined); };
29926}, collectionStrong);
29927
29928
29929/***/ }),
29930/* 602 */
29931/***/ (function(module, exports, __webpack_require__) {
29932
29933"use strict";
29934
29935var defineProperty = __webpack_require__(23).f;
29936var create = __webpack_require__(49);
29937var defineBuiltIns = __webpack_require__(150);
29938var bind = __webpack_require__(48);
29939var anInstance = __webpack_require__(107);
29940var iterate = __webpack_require__(40);
29941var defineIterator = __webpack_require__(130);
29942var setSpecies = __webpack_require__(166);
29943var DESCRIPTORS = __webpack_require__(14);
29944var fastKey = __webpack_require__(93).fastKey;
29945var InternalStateModule = __webpack_require__(42);
29946
29947var setInternalState = InternalStateModule.set;
29948var internalStateGetterFor = InternalStateModule.getterFor;
29949
29950module.exports = {
29951 getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
29952 var Constructor = wrapper(function (that, iterable) {
29953 anInstance(that, Prototype);
29954 setInternalState(that, {
29955 type: CONSTRUCTOR_NAME,
29956 index: create(null),
29957 first: undefined,
29958 last: undefined,
29959 size: 0
29960 });
29961 if (!DESCRIPTORS) that.size = 0;
29962 if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
29963 });
29964
29965 var Prototype = Constructor.prototype;
29966
29967 var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
29968
29969 var define = function (that, key, value) {
29970 var state = getInternalState(that);
29971 var entry = getEntry(that, key);
29972 var previous, index;
29973 // change existing entry
29974 if (entry) {
29975 entry.value = value;
29976 // create new entry
29977 } else {
29978 state.last = entry = {
29979 index: index = fastKey(key, true),
29980 key: key,
29981 value: value,
29982 previous: previous = state.last,
29983 next: undefined,
29984 removed: false
29985 };
29986 if (!state.first) state.first = entry;
29987 if (previous) previous.next = entry;
29988 if (DESCRIPTORS) state.size++;
29989 else that.size++;
29990 // add to index
29991 if (index !== 'F') state.index[index] = entry;
29992 } return that;
29993 };
29994
29995 var getEntry = function (that, key) {
29996 var state = getInternalState(that);
29997 // fast case
29998 var index = fastKey(key);
29999 var entry;
30000 if (index !== 'F') return state.index[index];
30001 // frozen object case
30002 for (entry = state.first; entry; entry = entry.next) {
30003 if (entry.key == key) return entry;
30004 }
30005 };
30006
30007 defineBuiltIns(Prototype, {
30008 // `{ Map, Set }.prototype.clear()` methods
30009 // https://tc39.es/ecma262/#sec-map.prototype.clear
30010 // https://tc39.es/ecma262/#sec-set.prototype.clear
30011 clear: function clear() {
30012 var that = this;
30013 var state = getInternalState(that);
30014 var data = state.index;
30015 var entry = state.first;
30016 while (entry) {
30017 entry.removed = true;
30018 if (entry.previous) entry.previous = entry.previous.next = undefined;
30019 delete data[entry.index];
30020 entry = entry.next;
30021 }
30022 state.first = state.last = undefined;
30023 if (DESCRIPTORS) state.size = 0;
30024 else that.size = 0;
30025 },
30026 // `{ Map, Set }.prototype.delete(key)` methods
30027 // https://tc39.es/ecma262/#sec-map.prototype.delete
30028 // https://tc39.es/ecma262/#sec-set.prototype.delete
30029 'delete': function (key) {
30030 var that = this;
30031 var state = getInternalState(that);
30032 var entry = getEntry(that, key);
30033 if (entry) {
30034 var next = entry.next;
30035 var prev = entry.previous;
30036 delete state.index[entry.index];
30037 entry.removed = true;
30038 if (prev) prev.next = next;
30039 if (next) next.previous = prev;
30040 if (state.first == entry) state.first = next;
30041 if (state.last == entry) state.last = prev;
30042 if (DESCRIPTORS) state.size--;
30043 else that.size--;
30044 } return !!entry;
30045 },
30046 // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods
30047 // https://tc39.es/ecma262/#sec-map.prototype.foreach
30048 // https://tc39.es/ecma262/#sec-set.prototype.foreach
30049 forEach: function forEach(callbackfn /* , that = undefined */) {
30050 var state = getInternalState(this);
30051 var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
30052 var entry;
30053 while (entry = entry ? entry.next : state.first) {
30054 boundFunction(entry.value, entry.key, this);
30055 // revert to the last existing entry
30056 while (entry && entry.removed) entry = entry.previous;
30057 }
30058 },
30059 // `{ Map, Set}.prototype.has(key)` methods
30060 // https://tc39.es/ecma262/#sec-map.prototype.has
30061 // https://tc39.es/ecma262/#sec-set.prototype.has
30062 has: function has(key) {
30063 return !!getEntry(this, key);
30064 }
30065 });
30066
30067 defineBuiltIns(Prototype, IS_MAP ? {
30068 // `Map.prototype.get(key)` method
30069 // https://tc39.es/ecma262/#sec-map.prototype.get
30070 get: function get(key) {
30071 var entry = getEntry(this, key);
30072 return entry && entry.value;
30073 },
30074 // `Map.prototype.set(key, value)` method
30075 // https://tc39.es/ecma262/#sec-map.prototype.set
30076 set: function set(key, value) {
30077 return define(this, key === 0 ? 0 : key, value);
30078 }
30079 } : {
30080 // `Set.prototype.add(value)` method
30081 // https://tc39.es/ecma262/#sec-set.prototype.add
30082 add: function add(value) {
30083 return define(this, value = value === 0 ? 0 : value, value);
30084 }
30085 });
30086 if (DESCRIPTORS) defineProperty(Prototype, 'size', {
30087 get: function () {
30088 return getInternalState(this).size;
30089 }
30090 });
30091 return Constructor;
30092 },
30093 setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) {
30094 var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
30095 var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
30096 var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
30097 // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods
30098 // https://tc39.es/ecma262/#sec-map.prototype.entries
30099 // https://tc39.es/ecma262/#sec-map.prototype.keys
30100 // https://tc39.es/ecma262/#sec-map.prototype.values
30101 // https://tc39.es/ecma262/#sec-map.prototype-@@iterator
30102 // https://tc39.es/ecma262/#sec-set.prototype.entries
30103 // https://tc39.es/ecma262/#sec-set.prototype.keys
30104 // https://tc39.es/ecma262/#sec-set.prototype.values
30105 // https://tc39.es/ecma262/#sec-set.prototype-@@iterator
30106 defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) {
30107 setInternalState(this, {
30108 type: ITERATOR_NAME,
30109 target: iterated,
30110 state: getInternalCollectionState(iterated),
30111 kind: kind,
30112 last: undefined
30113 });
30114 }, function () {
30115 var state = getInternalIteratorState(this);
30116 var kind = state.kind;
30117 var entry = state.last;
30118 // revert to the last existing entry
30119 while (entry && entry.removed) entry = entry.previous;
30120 // get next entry
30121 if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
30122 // or finish the iteration
30123 state.target = undefined;
30124 return { value: undefined, done: true };
30125 }
30126 // return step by kind
30127 if (kind == 'keys') return { value: entry.key, done: false };
30128 if (kind == 'values') return { value: entry.value, done: false };
30129 return { value: [entry.key, entry.value], done: false };
30130 }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
30131
30132 // `{ Map, Set }.prototype[@@species]` accessors
30133 // https://tc39.es/ecma262/#sec-get-map-@@species
30134 // https://tc39.es/ecma262/#sec-get-set-@@species
30135 setSpecies(CONSTRUCTOR_NAME);
30136 }
30137};
30138
30139
30140/***/ }),
30141/* 603 */
30142/***/ (function(module, exports, __webpack_require__) {
30143
30144var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
30145 Copyright 2013 Daniel Wirtz <dcode@dcode.io>
30146
30147 Licensed under the Apache License, Version 2.0 (the "License");
30148 you may not use this file except in compliance with the License.
30149 You may obtain a copy of the License at
30150
30151 http://www.apache.org/licenses/LICENSE-2.0
30152
30153 Unless required by applicable law or agreed to in writing, software
30154 distributed under the License is distributed on an "AS IS" BASIS,
30155 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30156 See the License for the specific language governing permissions and
30157 limitations under the License.
30158 */
30159
30160/**
30161 * @license protobuf.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
30162 * Released under the Apache License, Version 2.0
30163 * see: https://github.com/dcodeIO/protobuf.js for details
30164 */
30165(function(global, factory) {
30166
30167 /* AMD */ if (true)
30168 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(604)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
30169 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
30170 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
30171 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
30172 /* CommonJS */ else if (typeof require === "function" && typeof module === "object" && module && module["exports"])
30173 module["exports"] = factory(require("bytebuffer"), true);
30174 /* Global */ else
30175 (global["dcodeIO"] = global["dcodeIO"] || {})["ProtoBuf"] = factory(global["dcodeIO"]["ByteBuffer"]);
30176
30177})(this, function(ByteBuffer, isCommonJS) {
30178 "use strict";
30179
30180 /**
30181 * The ProtoBuf namespace.
30182 * @exports ProtoBuf
30183 * @namespace
30184 * @expose
30185 */
30186 var ProtoBuf = {};
30187
30188 /**
30189 * @type {!function(new: ByteBuffer, ...[*])}
30190 * @expose
30191 */
30192 ProtoBuf.ByteBuffer = ByteBuffer;
30193
30194 /**
30195 * @type {?function(new: Long, ...[*])}
30196 * @expose
30197 */
30198 ProtoBuf.Long = ByteBuffer.Long || null;
30199
30200 /**
30201 * ProtoBuf.js version.
30202 * @type {string}
30203 * @const
30204 * @expose
30205 */
30206 ProtoBuf.VERSION = "5.0.3";
30207
30208 /**
30209 * Wire types.
30210 * @type {Object.<string,number>}
30211 * @const
30212 * @expose
30213 */
30214 ProtoBuf.WIRE_TYPES = {};
30215
30216 /**
30217 * Varint wire type.
30218 * @type {number}
30219 * @expose
30220 */
30221 ProtoBuf.WIRE_TYPES.VARINT = 0;
30222
30223 /**
30224 * Fixed 64 bits wire type.
30225 * @type {number}
30226 * @const
30227 * @expose
30228 */
30229 ProtoBuf.WIRE_TYPES.BITS64 = 1;
30230
30231 /**
30232 * Length delimited wire type.
30233 * @type {number}
30234 * @const
30235 * @expose
30236 */
30237 ProtoBuf.WIRE_TYPES.LDELIM = 2;
30238
30239 /**
30240 * Start group wire type.
30241 * @type {number}
30242 * @const
30243 * @expose
30244 */
30245 ProtoBuf.WIRE_TYPES.STARTGROUP = 3;
30246
30247 /**
30248 * End group wire type.
30249 * @type {number}
30250 * @const
30251 * @expose
30252 */
30253 ProtoBuf.WIRE_TYPES.ENDGROUP = 4;
30254
30255 /**
30256 * Fixed 32 bits wire type.
30257 * @type {number}
30258 * @const
30259 * @expose
30260 */
30261 ProtoBuf.WIRE_TYPES.BITS32 = 5;
30262
30263 /**
30264 * Packable wire types.
30265 * @type {!Array.<number>}
30266 * @const
30267 * @expose
30268 */
30269 ProtoBuf.PACKABLE_WIRE_TYPES = [
30270 ProtoBuf.WIRE_TYPES.VARINT,
30271 ProtoBuf.WIRE_TYPES.BITS64,
30272 ProtoBuf.WIRE_TYPES.BITS32
30273 ];
30274
30275 /**
30276 * Types.
30277 * @dict
30278 * @type {!Object.<string,{name: string, wireType: number, defaultValue: *}>}
30279 * @const
30280 * @expose
30281 */
30282 ProtoBuf.TYPES = {
30283 // According to the protobuf spec.
30284 "int32": {
30285 name: "int32",
30286 wireType: ProtoBuf.WIRE_TYPES.VARINT,
30287 defaultValue: 0
30288 },
30289 "uint32": {
30290 name: "uint32",
30291 wireType: ProtoBuf.WIRE_TYPES.VARINT,
30292 defaultValue: 0
30293 },
30294 "sint32": {
30295 name: "sint32",
30296 wireType: ProtoBuf.WIRE_TYPES.VARINT,
30297 defaultValue: 0
30298 },
30299 "int64": {
30300 name: "int64",
30301 wireType: ProtoBuf.WIRE_TYPES.VARINT,
30302 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
30303 },
30304 "uint64": {
30305 name: "uint64",
30306 wireType: ProtoBuf.WIRE_TYPES.VARINT,
30307 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
30308 },
30309 "sint64": {
30310 name: "sint64",
30311 wireType: ProtoBuf.WIRE_TYPES.VARINT,
30312 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
30313 },
30314 "bool": {
30315 name: "bool",
30316 wireType: ProtoBuf.WIRE_TYPES.VARINT,
30317 defaultValue: false
30318 },
30319 "double": {
30320 name: "double",
30321 wireType: ProtoBuf.WIRE_TYPES.BITS64,
30322 defaultValue: 0
30323 },
30324 "string": {
30325 name: "string",
30326 wireType: ProtoBuf.WIRE_TYPES.LDELIM,
30327 defaultValue: ""
30328 },
30329 "bytes": {
30330 name: "bytes",
30331 wireType: ProtoBuf.WIRE_TYPES.LDELIM,
30332 defaultValue: null // overridden in the code, must be a unique instance
30333 },
30334 "fixed32": {
30335 name: "fixed32",
30336 wireType: ProtoBuf.WIRE_TYPES.BITS32,
30337 defaultValue: 0
30338 },
30339 "sfixed32": {
30340 name: "sfixed32",
30341 wireType: ProtoBuf.WIRE_TYPES.BITS32,
30342 defaultValue: 0
30343 },
30344 "fixed64": {
30345 name: "fixed64",
30346 wireType: ProtoBuf.WIRE_TYPES.BITS64,
30347 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
30348 },
30349 "sfixed64": {
30350 name: "sfixed64",
30351 wireType: ProtoBuf.WIRE_TYPES.BITS64,
30352 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
30353 },
30354 "float": {
30355 name: "float",
30356 wireType: ProtoBuf.WIRE_TYPES.BITS32,
30357 defaultValue: 0
30358 },
30359 "enum": {
30360 name: "enum",
30361 wireType: ProtoBuf.WIRE_TYPES.VARINT,
30362 defaultValue: 0
30363 },
30364 "message": {
30365 name: "message",
30366 wireType: ProtoBuf.WIRE_TYPES.LDELIM,
30367 defaultValue: null
30368 },
30369 "group": {
30370 name: "group",
30371 wireType: ProtoBuf.WIRE_TYPES.STARTGROUP,
30372 defaultValue: null
30373 }
30374 };
30375
30376 /**
30377 * Valid map key types.
30378 * @type {!Array.<!Object.<string,{name: string, wireType: number, defaultValue: *}>>}
30379 * @const
30380 * @expose
30381 */
30382 ProtoBuf.MAP_KEY_TYPES = [
30383 ProtoBuf.TYPES["int32"],
30384 ProtoBuf.TYPES["sint32"],
30385 ProtoBuf.TYPES["sfixed32"],
30386 ProtoBuf.TYPES["uint32"],
30387 ProtoBuf.TYPES["fixed32"],
30388 ProtoBuf.TYPES["int64"],
30389 ProtoBuf.TYPES["sint64"],
30390 ProtoBuf.TYPES["sfixed64"],
30391 ProtoBuf.TYPES["uint64"],
30392 ProtoBuf.TYPES["fixed64"],
30393 ProtoBuf.TYPES["bool"],
30394 ProtoBuf.TYPES["string"],
30395 ProtoBuf.TYPES["bytes"]
30396 ];
30397
30398 /**
30399 * Minimum field id.
30400 * @type {number}
30401 * @const
30402 * @expose
30403 */
30404 ProtoBuf.ID_MIN = 1;
30405
30406 /**
30407 * Maximum field id.
30408 * @type {number}
30409 * @const
30410 * @expose
30411 */
30412 ProtoBuf.ID_MAX = 0x1FFFFFFF;
30413
30414 /**
30415 * If set to `true`, field names will be converted from underscore notation to camel case. Defaults to `false`.
30416 * Must be set prior to parsing.
30417 * @type {boolean}
30418 * @expose
30419 */
30420 ProtoBuf.convertFieldsToCamelCase = false;
30421
30422 /**
30423 * By default, messages are populated with (setX, set_x) accessors for each field. This can be disabled by
30424 * setting this to `false` prior to building messages.
30425 * @type {boolean}
30426 * @expose
30427 */
30428 ProtoBuf.populateAccessors = true;
30429
30430 /**
30431 * By default, messages are populated with default values if a field is not present on the wire. To disable
30432 * this behavior, set this setting to `false`.
30433 * @type {boolean}
30434 * @expose
30435 */
30436 ProtoBuf.populateDefaults = true;
30437
30438 /**
30439 * @alias ProtoBuf.Util
30440 * @expose
30441 */
30442 ProtoBuf.Util = (function() {
30443 "use strict";
30444
30445 /**
30446 * ProtoBuf utilities.
30447 * @exports ProtoBuf.Util
30448 * @namespace
30449 */
30450 var Util = {};
30451
30452 /**
30453 * Flag if running in node or not.
30454 * @type {boolean}
30455 * @const
30456 * @expose
30457 */
30458 Util.IS_NODE = !!(
30459 typeof process === 'object' && process+'' === '[object process]' && !process['browser']
30460 );
30461
30462 /**
30463 * Constructs a XMLHttpRequest object.
30464 * @return {XMLHttpRequest}
30465 * @throws {Error} If XMLHttpRequest is not supported
30466 * @expose
30467 */
30468 Util.XHR = function() {
30469 // No dependencies please, ref: http://www.quirksmode.org/js/xmlhttp.html
30470 var XMLHttpFactories = [
30471 function () {return new XMLHttpRequest()},
30472 function () {return new ActiveXObject("Msxml2.XMLHTTP")},
30473 function () {return new ActiveXObject("Msxml3.XMLHTTP")},
30474 function () {return new ActiveXObject("Microsoft.XMLHTTP")}
30475 ];
30476 /** @type {?XMLHttpRequest} */
30477 var xhr = null;
30478 for (var i=0;i<XMLHttpFactories.length;i++) {
30479 try { xhr = XMLHttpFactories[i](); }
30480 catch (e) { continue; }
30481 break;
30482 }
30483 if (!xhr)
30484 throw Error("XMLHttpRequest is not supported");
30485 return xhr;
30486 };
30487
30488 /**
30489 * Fetches a resource.
30490 * @param {string} path Resource path
30491 * @param {function(?string)=} callback Callback receiving the resource's contents. If omitted the resource will
30492 * be fetched synchronously. If the request failed, contents will be null.
30493 * @return {?string|undefined} Resource contents if callback is omitted (null if the request failed), else undefined.
30494 * @expose
30495 */
30496 Util.fetch = function(path, callback) {
30497 if (callback && typeof callback != 'function')
30498 callback = null;
30499 if (Util.IS_NODE) {
30500 var fs = __webpack_require__(606);
30501 if (callback) {
30502 fs.readFile(path, function(err, data) {
30503 if (err)
30504 callback(null);
30505 else
30506 callback(""+data);
30507 });
30508 } else
30509 try {
30510 return fs.readFileSync(path);
30511 } catch (e) {
30512 return null;
30513 }
30514 } else {
30515 var xhr = Util.XHR();
30516 xhr.open('GET', path, callback ? true : false);
30517 // xhr.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
30518 xhr.setRequestHeader('Accept', 'text/plain');
30519 if (typeof xhr.overrideMimeType === 'function') xhr.overrideMimeType('text/plain');
30520 if (callback) {
30521 xhr.onreadystatechange = function() {
30522 if (xhr.readyState != 4) return;
30523 if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
30524 callback(xhr.responseText);
30525 else
30526 callback(null);
30527 };
30528 if (xhr.readyState == 4)
30529 return;
30530 xhr.send(null);
30531 } else {
30532 xhr.send(null);
30533 if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
30534 return xhr.responseText;
30535 return null;
30536 }
30537 }
30538 };
30539
30540 /**
30541 * Converts a string to camel case.
30542 * @param {string} str
30543 * @returns {string}
30544 * @expose
30545 */
30546 Util.toCamelCase = function(str) {
30547 return str.replace(/_([a-zA-Z])/g, function ($0, $1) {
30548 return $1.toUpperCase();
30549 });
30550 };
30551
30552 return Util;
30553 })();
30554
30555 /**
30556 * Language expressions.
30557 * @type {!Object.<string,!RegExp>}
30558 * @expose
30559 */
30560 ProtoBuf.Lang = {
30561
30562 // Characters always ending a statement
30563 DELIM: /[\s\{\}=;:\[\],'"\(\)<>]/g,
30564
30565 // Field rules
30566 RULE: /^(?:required|optional|repeated|map)$/,
30567
30568 // Field types
30569 TYPE: /^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,
30570
30571 // Names
30572 NAME: /^[a-zA-Z_][a-zA-Z_0-9]*$/,
30573
30574 // Type definitions
30575 TYPEDEF: /^[a-zA-Z][a-zA-Z_0-9]*$/,
30576
30577 // Type references
30578 TYPEREF: /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,
30579
30580 // Fully qualified type references
30581 FQTYPEREF: /^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/,
30582
30583 // All numbers
30584 NUMBER: /^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,
30585
30586 // Decimal numbers
30587 NUMBER_DEC: /^(?:[1-9][0-9]*|0)$/,
30588
30589 // Hexadecimal numbers
30590 NUMBER_HEX: /^0[xX][0-9a-fA-F]+$/,
30591
30592 // Octal numbers
30593 NUMBER_OCT: /^0[0-7]+$/,
30594
30595 // Floating point numbers
30596 NUMBER_FLT: /^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,
30597
30598 // Booleans
30599 BOOL: /^(?:true|false)$/i,
30600
30601 // Id numbers
30602 ID: /^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
30603
30604 // Negative id numbers (enum values)
30605 NEGID: /^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
30606
30607 // Whitespaces
30608 WHITESPACE: /\s/,
30609
30610 // All strings
30611 STRING: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,
30612
30613 // Double quoted strings
30614 STRING_DQ: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,
30615
30616 // Single quoted strings
30617 STRING_SQ: /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g
30618 };
30619
30620
30621 /**
30622 * @alias ProtoBuf.Reflect
30623 * @expose
30624 */
30625 ProtoBuf.Reflect = (function(ProtoBuf) {
30626 "use strict";
30627
30628 /**
30629 * Reflection types.
30630 * @exports ProtoBuf.Reflect
30631 * @namespace
30632 */
30633 var Reflect = {};
30634
30635 /**
30636 * Constructs a Reflect base class.
30637 * @exports ProtoBuf.Reflect.T
30638 * @constructor
30639 * @abstract
30640 * @param {!ProtoBuf.Builder} builder Builder reference
30641 * @param {?ProtoBuf.Reflect.T} parent Parent object
30642 * @param {string} name Object name
30643 */
30644 var T = function(builder, parent, name) {
30645
30646 /**
30647 * Builder reference.
30648 * @type {!ProtoBuf.Builder}
30649 * @expose
30650 */
30651 this.builder = builder;
30652
30653 /**
30654 * Parent object.
30655 * @type {?ProtoBuf.Reflect.T}
30656 * @expose
30657 */
30658 this.parent = parent;
30659
30660 /**
30661 * Object name in namespace.
30662 * @type {string}
30663 * @expose
30664 */
30665 this.name = name;
30666
30667 /**
30668 * Fully qualified class name
30669 * @type {string}
30670 * @expose
30671 */
30672 this.className;
30673 };
30674
30675 /**
30676 * @alias ProtoBuf.Reflect.T.prototype
30677 * @inner
30678 */
30679 var TPrototype = T.prototype;
30680
30681 /**
30682 * Returns the fully qualified name of this object.
30683 * @returns {string} Fully qualified name as of ".PATH.TO.THIS"
30684 * @expose
30685 */
30686 TPrototype.fqn = function() {
30687 var name = this.name,
30688 ptr = this;
30689 do {
30690 ptr = ptr.parent;
30691 if (ptr == null)
30692 break;
30693 name = ptr.name+"."+name;
30694 } while (true);
30695 return name;
30696 };
30697
30698 /**
30699 * Returns a string representation of this Reflect object (its fully qualified name).
30700 * @param {boolean=} includeClass Set to true to include the class name. Defaults to false.
30701 * @return String representation
30702 * @expose
30703 */
30704 TPrototype.toString = function(includeClass) {
30705 return (includeClass ? this.className + " " : "") + this.fqn();
30706 };
30707
30708 /**
30709 * Builds this type.
30710 * @throws {Error} If this type cannot be built directly
30711 * @expose
30712 */
30713 TPrototype.build = function() {
30714 throw Error(this.toString(true)+" cannot be built directly");
30715 };
30716
30717 /**
30718 * @alias ProtoBuf.Reflect.T
30719 * @expose
30720 */
30721 Reflect.T = T;
30722
30723 /**
30724 * Constructs a new Namespace.
30725 * @exports ProtoBuf.Reflect.Namespace
30726 * @param {!ProtoBuf.Builder} builder Builder reference
30727 * @param {?ProtoBuf.Reflect.Namespace} parent Namespace parent
30728 * @param {string} name Namespace name
30729 * @param {Object.<string,*>=} options Namespace options
30730 * @param {string?} syntax The syntax level of this definition (e.g., proto3)
30731 * @constructor
30732 * @extends ProtoBuf.Reflect.T
30733 */
30734 var Namespace = function(builder, parent, name, options, syntax) {
30735 T.call(this, builder, parent, name);
30736
30737 /**
30738 * @override
30739 */
30740 this.className = "Namespace";
30741
30742 /**
30743 * Children inside the namespace.
30744 * @type {!Array.<ProtoBuf.Reflect.T>}
30745 */
30746 this.children = [];
30747
30748 /**
30749 * Options.
30750 * @type {!Object.<string, *>}
30751 */
30752 this.options = options || {};
30753
30754 /**
30755 * Syntax level (e.g., proto2 or proto3).
30756 * @type {!string}
30757 */
30758 this.syntax = syntax || "proto2";
30759 };
30760
30761 /**
30762 * @alias ProtoBuf.Reflect.Namespace.prototype
30763 * @inner
30764 */
30765 var NamespacePrototype = Namespace.prototype = Object.create(T.prototype);
30766
30767 /**
30768 * Returns an array of the namespace's children.
30769 * @param {ProtoBuf.Reflect.T=} type Filter type (returns instances of this type only). Defaults to null (all children).
30770 * @return {Array.<ProtoBuf.Reflect.T>}
30771 * @expose
30772 */
30773 NamespacePrototype.getChildren = function(type) {
30774 type = type || null;
30775 if (type == null)
30776 return this.children.slice();
30777 var children = [];
30778 for (var i=0, k=this.children.length; i<k; ++i)
30779 if (this.children[i] instanceof type)
30780 children.push(this.children[i]);
30781 return children;
30782 };
30783
30784 /**
30785 * Adds a child to the namespace.
30786 * @param {ProtoBuf.Reflect.T} child Child
30787 * @throws {Error} If the child cannot be added (duplicate)
30788 * @expose
30789 */
30790 NamespacePrototype.addChild = function(child) {
30791 var other;
30792 if (other = this.getChild(child.name)) {
30793 // Try to revert camelcase transformation on collision
30794 if (other instanceof Message.Field && other.name !== other.originalName && this.getChild(other.originalName) === null)
30795 other.name = other.originalName; // Revert previous first (effectively keeps both originals)
30796 else if (child instanceof Message.Field && child.name !== child.originalName && this.getChild(child.originalName) === null)
30797 child.name = child.originalName;
30798 else
30799 throw Error("Duplicate name in namespace "+this.toString(true)+": "+child.name);
30800 }
30801 this.children.push(child);
30802 };
30803
30804 /**
30805 * Gets a child by its name or id.
30806 * @param {string|number} nameOrId Child name or id
30807 * @return {?ProtoBuf.Reflect.T} The child or null if not found
30808 * @expose
30809 */
30810 NamespacePrototype.getChild = function(nameOrId) {
30811 var key = typeof nameOrId === 'number' ? 'id' : 'name';
30812 for (var i=0, k=this.children.length; i<k; ++i)
30813 if (this.children[i][key] === nameOrId)
30814 return this.children[i];
30815 return null;
30816 };
30817
30818 /**
30819 * Resolves a reflect object inside of this namespace.
30820 * @param {string|!Array.<string>} qn Qualified name to resolve
30821 * @param {boolean=} excludeNonNamespace Excludes non-namespace types, defaults to `false`
30822 * @return {?ProtoBuf.Reflect.Namespace} The resolved type or null if not found
30823 * @expose
30824 */
30825 NamespacePrototype.resolve = function(qn, excludeNonNamespace) {
30826 var part = typeof qn === 'string' ? qn.split(".") : qn,
30827 ptr = this,
30828 i = 0;
30829 if (part[i] === "") { // Fully qualified name, e.g. ".My.Message'
30830 while (ptr.parent !== null)
30831 ptr = ptr.parent;
30832 i++;
30833 }
30834 var child;
30835 do {
30836 do {
30837 if (!(ptr instanceof Reflect.Namespace)) {
30838 ptr = null;
30839 break;
30840 }
30841 child = ptr.getChild(part[i]);
30842 if (!child || !(child instanceof Reflect.T) || (excludeNonNamespace && !(child instanceof Reflect.Namespace))) {
30843 ptr = null;
30844 break;
30845 }
30846 ptr = child; i++;
30847 } while (i < part.length);
30848 if (ptr != null)
30849 break; // Found
30850 // Else search the parent
30851 if (this.parent !== null)
30852 return this.parent.resolve(qn, excludeNonNamespace);
30853 } while (ptr != null);
30854 return ptr;
30855 };
30856
30857 /**
30858 * Determines the shortest qualified name of the specified type, if any, relative to this namespace.
30859 * @param {!ProtoBuf.Reflect.T} t Reflection type
30860 * @returns {string} The shortest qualified name or, if there is none, the fqn
30861 * @expose
30862 */
30863 NamespacePrototype.qn = function(t) {
30864 var part = [], ptr = t;
30865 do {
30866 part.unshift(ptr.name);
30867 ptr = ptr.parent;
30868 } while (ptr !== null);
30869 for (var len=1; len <= part.length; len++) {
30870 var qn = part.slice(part.length-len);
30871 if (t === this.resolve(qn, t instanceof Reflect.Namespace))
30872 return qn.join(".");
30873 }
30874 return t.fqn();
30875 };
30876
30877 /**
30878 * Builds the namespace and returns the runtime counterpart.
30879 * @return {Object.<string,Function|Object>} Runtime namespace
30880 * @expose
30881 */
30882 NamespacePrototype.build = function() {
30883 /** @dict */
30884 var ns = {};
30885 var children = this.children;
30886 for (var i=0, k=children.length, child; i<k; ++i) {
30887 child = children[i];
30888 if (child instanceof Namespace)
30889 ns[child.name] = child.build();
30890 }
30891 if (Object.defineProperty)
30892 Object.defineProperty(ns, "$options", { "value": this.buildOpt() });
30893 return ns;
30894 };
30895
30896 /**
30897 * Builds the namespace's '$options' property.
30898 * @return {Object.<string,*>}
30899 */
30900 NamespacePrototype.buildOpt = function() {
30901 var opt = {},
30902 keys = Object.keys(this.options);
30903 for (var i=0, k=keys.length; i<k; ++i) {
30904 var key = keys[i],
30905 val = this.options[keys[i]];
30906 // TODO: Options are not resolved, yet.
30907 // if (val instanceof Namespace) {
30908 // opt[key] = val.build();
30909 // } else {
30910 opt[key] = val;
30911 // }
30912 }
30913 return opt;
30914 };
30915
30916 /**
30917 * Gets the value assigned to the option with the specified name.
30918 * @param {string=} name Returns the option value if specified, otherwise all options are returned.
30919 * @return {*|Object.<string,*>}null} Option value or NULL if there is no such option
30920 */
30921 NamespacePrototype.getOption = function(name) {
30922 if (typeof name === 'undefined')
30923 return this.options;
30924 return typeof this.options[name] !== 'undefined' ? this.options[name] : null;
30925 };
30926
30927 /**
30928 * @alias ProtoBuf.Reflect.Namespace
30929 * @expose
30930 */
30931 Reflect.Namespace = Namespace;
30932
30933 /**
30934 * Constructs a new Element implementation that checks and converts values for a
30935 * particular field type, as appropriate.
30936 *
30937 * An Element represents a single value: either the value of a singular field,
30938 * or a value contained in one entry of a repeated field or map field. This
30939 * class does not implement these higher-level concepts; it only encapsulates
30940 * the low-level typechecking and conversion.
30941 *
30942 * @exports ProtoBuf.Reflect.Element
30943 * @param {{name: string, wireType: number}} type Resolved data type
30944 * @param {ProtoBuf.Reflect.T|null} resolvedType Resolved type, if relevant
30945 * (e.g. submessage field).
30946 * @param {boolean} isMapKey Is this element a Map key? The value will be
30947 * converted to string form if so.
30948 * @param {string} syntax Syntax level of defining message type, e.g.,
30949 * proto2 or proto3.
30950 * @param {string} name Name of the field containing this element (for error
30951 * messages)
30952 * @constructor
30953 */
30954 var Element = function(type, resolvedType, isMapKey, syntax, name) {
30955
30956 /**
30957 * Element type, as a string (e.g., int32).
30958 * @type {{name: string, wireType: number}}
30959 */
30960 this.type = type;
30961
30962 /**
30963 * Element type reference to submessage or enum definition, if needed.
30964 * @type {ProtoBuf.Reflect.T|null}
30965 */
30966 this.resolvedType = resolvedType;
30967
30968 /**
30969 * Element is a map key.
30970 * @type {boolean}
30971 */
30972 this.isMapKey = isMapKey;
30973
30974 /**
30975 * Syntax level of defining message type, e.g., proto2 or proto3.
30976 * @type {string}
30977 */
30978 this.syntax = syntax;
30979
30980 /**
30981 * Name of the field containing this element (for error messages)
30982 * @type {string}
30983 */
30984 this.name = name;
30985
30986 if (isMapKey && ProtoBuf.MAP_KEY_TYPES.indexOf(type) < 0)
30987 throw Error("Invalid map key type: " + type.name);
30988 };
30989
30990 var ElementPrototype = Element.prototype;
30991
30992 /**
30993 * Obtains a (new) default value for the specified type.
30994 * @param type {string|{name: string, wireType: number}} Field type
30995 * @returns {*} Default value
30996 * @inner
30997 */
30998 function mkDefault(type) {
30999 if (typeof type === 'string')
31000 type = ProtoBuf.TYPES[type];
31001 if (typeof type.defaultValue === 'undefined')
31002 throw Error("default value for type "+type.name+" is not supported");
31003 if (type == ProtoBuf.TYPES["bytes"])
31004 return new ByteBuffer(0);
31005 return type.defaultValue;
31006 }
31007
31008 /**
31009 * Returns the default value for this field in proto3.
31010 * @function
31011 * @param type {string|{name: string, wireType: number}} the field type
31012 * @returns {*} Default value
31013 */
31014 Element.defaultFieldValue = mkDefault;
31015
31016 /**
31017 * Makes a Long from a value.
31018 * @param {{low: number, high: number, unsigned: boolean}|string|number} value Value
31019 * @param {boolean=} unsigned Whether unsigned or not, defaults to reuse it from Long-like objects or to signed for
31020 * strings and numbers
31021 * @returns {!Long}
31022 * @throws {Error} If the value cannot be converted to a Long
31023 * @inner
31024 */
31025 function mkLong(value, unsigned) {
31026 if (value && typeof value.low === 'number' && typeof value.high === 'number' && typeof value.unsigned === 'boolean'
31027 && value.low === value.low && value.high === value.high)
31028 return new ProtoBuf.Long(value.low, value.high, typeof unsigned === 'undefined' ? value.unsigned : unsigned);
31029 if (typeof value === 'string')
31030 return ProtoBuf.Long.fromString(value, unsigned || false, 10);
31031 if (typeof value === 'number')
31032 return ProtoBuf.Long.fromNumber(value, unsigned || false);
31033 throw Error("not convertible to Long");
31034 }
31035
31036 ElementPrototype.toString = function() {
31037 return (this.name || '') + (this.isMapKey ? 'map' : 'value') + ' element';
31038 }
31039
31040 /**
31041 * Checks if the given value can be set for an element of this type (singular
31042 * field or one element of a repeated field or map).
31043 * @param {*} value Value to check
31044 * @return {*} Verified, maybe adjusted, value
31045 * @throws {Error} If the value cannot be verified for this element slot
31046 * @expose
31047 */
31048 ElementPrototype.verifyValue = function(value) {
31049 var self = this;
31050 function fail(val, msg) {
31051 throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
31052 }
31053 switch (this.type) {
31054 // Signed 32bit
31055 case ProtoBuf.TYPES["int32"]:
31056 case ProtoBuf.TYPES["sint32"]:
31057 case ProtoBuf.TYPES["sfixed32"]:
31058 // Account for !NaN: value === value
31059 if (typeof value !== 'number' || (value === value && value % 1 !== 0))
31060 fail(typeof value, "not an integer");
31061 return value > 4294967295 ? value | 0 : value;
31062
31063 // Unsigned 32bit
31064 case ProtoBuf.TYPES["uint32"]:
31065 case ProtoBuf.TYPES["fixed32"]:
31066 if (typeof value !== 'number' || (value === value && value % 1 !== 0))
31067 fail(typeof value, "not an integer");
31068 return value < 0 ? value >>> 0 : value;
31069
31070 // Signed 64bit
31071 case ProtoBuf.TYPES["int64"]:
31072 case ProtoBuf.TYPES["sint64"]:
31073 case ProtoBuf.TYPES["sfixed64"]: {
31074 if (ProtoBuf.Long)
31075 try {
31076 return mkLong(value, false);
31077 } catch (e) {
31078 fail(typeof value, e.message);
31079 }
31080 else
31081 fail(typeof value, "requires Long.js");
31082 }
31083
31084 // Unsigned 64bit
31085 case ProtoBuf.TYPES["uint64"]:
31086 case ProtoBuf.TYPES["fixed64"]: {
31087 if (ProtoBuf.Long)
31088 try {
31089 return mkLong(value, true);
31090 } catch (e) {
31091 fail(typeof value, e.message);
31092 }
31093 else
31094 fail(typeof value, "requires Long.js");
31095 }
31096
31097 // Bool
31098 case ProtoBuf.TYPES["bool"]:
31099 if (typeof value !== 'boolean')
31100 fail(typeof value, "not a boolean");
31101 return value;
31102
31103 // Float
31104 case ProtoBuf.TYPES["float"]:
31105 case ProtoBuf.TYPES["double"]:
31106 if (typeof value !== 'number')
31107 fail(typeof value, "not a number");
31108 return value;
31109
31110 // Length-delimited string
31111 case ProtoBuf.TYPES["string"]:
31112 if (typeof value !== 'string' && !(value && value instanceof String))
31113 fail(typeof value, "not a string");
31114 return ""+value; // Convert String object to string
31115
31116 // Length-delimited bytes
31117 case ProtoBuf.TYPES["bytes"]:
31118 if (ByteBuffer.isByteBuffer(value))
31119 return value;
31120 return ByteBuffer.wrap(value, "base64");
31121
31122 // Constant enum value
31123 case ProtoBuf.TYPES["enum"]: {
31124 var values = this.resolvedType.getChildren(ProtoBuf.Reflect.Enum.Value);
31125 for (i=0; i<values.length; i++)
31126 if (values[i].name == value)
31127 return values[i].id;
31128 else if (values[i].id == value)
31129 return values[i].id;
31130
31131 if (this.syntax === 'proto3') {
31132 // proto3: just make sure it's an integer.
31133 if (typeof value !== 'number' || (value === value && value % 1 !== 0))
31134 fail(typeof value, "not an integer");
31135 if (value > 4294967295 || value < 0)
31136 fail(typeof value, "not in range for uint32")
31137 return value;
31138 } else {
31139 // proto2 requires enum values to be valid.
31140 fail(value, "not a valid enum value");
31141 }
31142 }
31143 // Embedded message
31144 case ProtoBuf.TYPES["group"]:
31145 case ProtoBuf.TYPES["message"]: {
31146 if (!value || typeof value !== 'object')
31147 fail(typeof value, "object expected");
31148 if (value instanceof this.resolvedType.clazz)
31149 return value;
31150 if (value instanceof ProtoBuf.Builder.Message) {
31151 // Mismatched type: Convert to object (see: https://github.com/dcodeIO/ProtoBuf.js/issues/180)
31152 var obj = {};
31153 for (var i in value)
31154 if (value.hasOwnProperty(i))
31155 obj[i] = value[i];
31156 value = obj;
31157 }
31158 // Else let's try to construct one from a key-value object
31159 return new (this.resolvedType.clazz)(value); // May throw for a hundred of reasons
31160 }
31161 }
31162
31163 // We should never end here
31164 throw Error("[INTERNAL] Illegal value for "+this.toString(true)+": "+value+" (undefined type "+this.type+")");
31165 };
31166
31167 /**
31168 * Calculates the byte length of an element on the wire.
31169 * @param {number} id Field number
31170 * @param {*} value Field value
31171 * @returns {number} Byte length
31172 * @throws {Error} If the value cannot be calculated
31173 * @expose
31174 */
31175 ElementPrototype.calculateLength = function(id, value) {
31176 if (value === null) return 0; // Nothing to encode
31177 // Tag has already been written
31178 var n;
31179 switch (this.type) {
31180 case ProtoBuf.TYPES["int32"]:
31181 return value < 0 ? ByteBuffer.calculateVarint64(value) : ByteBuffer.calculateVarint32(value);
31182 case ProtoBuf.TYPES["uint32"]:
31183 return ByteBuffer.calculateVarint32(value);
31184 case ProtoBuf.TYPES["sint32"]:
31185 return ByteBuffer.calculateVarint32(ByteBuffer.zigZagEncode32(value));
31186 case ProtoBuf.TYPES["fixed32"]:
31187 case ProtoBuf.TYPES["sfixed32"]:
31188 case ProtoBuf.TYPES["float"]:
31189 return 4;
31190 case ProtoBuf.TYPES["int64"]:
31191 case ProtoBuf.TYPES["uint64"]:
31192 return ByteBuffer.calculateVarint64(value);
31193 case ProtoBuf.TYPES["sint64"]:
31194 return ByteBuffer.calculateVarint64(ByteBuffer.zigZagEncode64(value));
31195 case ProtoBuf.TYPES["fixed64"]:
31196 case ProtoBuf.TYPES["sfixed64"]:
31197 return 8;
31198 case ProtoBuf.TYPES["bool"]:
31199 return 1;
31200 case ProtoBuf.TYPES["enum"]:
31201 return ByteBuffer.calculateVarint32(value);
31202 case ProtoBuf.TYPES["double"]:
31203 return 8;
31204 case ProtoBuf.TYPES["string"]:
31205 n = ByteBuffer.calculateUTF8Bytes(value);
31206 return ByteBuffer.calculateVarint32(n) + n;
31207 case ProtoBuf.TYPES["bytes"]:
31208 if (value.remaining() < 0)
31209 throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
31210 return ByteBuffer.calculateVarint32(value.remaining()) + value.remaining();
31211 case ProtoBuf.TYPES["message"]:
31212 n = this.resolvedType.calculate(value);
31213 return ByteBuffer.calculateVarint32(n) + n;
31214 case ProtoBuf.TYPES["group"]:
31215 n = this.resolvedType.calculate(value);
31216 return n + ByteBuffer.calculateVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
31217 }
31218 // We should never end here
31219 throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
31220 };
31221
31222 /**
31223 * Encodes a value to the specified buffer. Does not encode the key.
31224 * @param {number} id Field number
31225 * @param {*} value Field value
31226 * @param {ByteBuffer} buffer ByteBuffer to encode to
31227 * @return {ByteBuffer} The ByteBuffer for chaining
31228 * @throws {Error} If the value cannot be encoded
31229 * @expose
31230 */
31231 ElementPrototype.encodeValue = function(id, value, buffer) {
31232 if (value === null) return buffer; // Nothing to encode
31233 // Tag has already been written
31234
31235 switch (this.type) {
31236 // 32bit signed varint
31237 case ProtoBuf.TYPES["int32"]:
31238 // "If you use int32 or int64 as the type for a negative number, the resulting varint is always ten bytes
31239 // long – it is, effectively, treated like a very large unsigned integer." (see #122)
31240 if (value < 0)
31241 buffer.writeVarint64(value);
31242 else
31243 buffer.writeVarint32(value);
31244 break;
31245
31246 // 32bit unsigned varint
31247 case ProtoBuf.TYPES["uint32"]:
31248 buffer.writeVarint32(value);
31249 break;
31250
31251 // 32bit varint zig-zag
31252 case ProtoBuf.TYPES["sint32"]:
31253 buffer.writeVarint32ZigZag(value);
31254 break;
31255
31256 // Fixed unsigned 32bit
31257 case ProtoBuf.TYPES["fixed32"]:
31258 buffer.writeUint32(value);
31259 break;
31260
31261 // Fixed signed 32bit
31262 case ProtoBuf.TYPES["sfixed32"]:
31263 buffer.writeInt32(value);
31264 break;
31265
31266 // 64bit varint as-is
31267 case ProtoBuf.TYPES["int64"]:
31268 case ProtoBuf.TYPES["uint64"]:
31269 buffer.writeVarint64(value); // throws
31270 break;
31271
31272 // 64bit varint zig-zag
31273 case ProtoBuf.TYPES["sint64"]:
31274 buffer.writeVarint64ZigZag(value); // throws
31275 break;
31276
31277 // Fixed unsigned 64bit
31278 case ProtoBuf.TYPES["fixed64"]:
31279 buffer.writeUint64(value); // throws
31280 break;
31281
31282 // Fixed signed 64bit
31283 case ProtoBuf.TYPES["sfixed64"]:
31284 buffer.writeInt64(value); // throws
31285 break;
31286
31287 // Bool
31288 case ProtoBuf.TYPES["bool"]:
31289 if (typeof value === 'string')
31290 buffer.writeVarint32(value.toLowerCase() === 'false' ? 0 : !!value);
31291 else
31292 buffer.writeVarint32(value ? 1 : 0);
31293 break;
31294
31295 // Constant enum value
31296 case ProtoBuf.TYPES["enum"]:
31297 buffer.writeVarint32(value);
31298 break;
31299
31300 // 32bit float
31301 case ProtoBuf.TYPES["float"]:
31302 buffer.writeFloat32(value);
31303 break;
31304
31305 // 64bit float
31306 case ProtoBuf.TYPES["double"]:
31307 buffer.writeFloat64(value);
31308 break;
31309
31310 // Length-delimited string
31311 case ProtoBuf.TYPES["string"]:
31312 buffer.writeVString(value);
31313 break;
31314
31315 // Length-delimited bytes
31316 case ProtoBuf.TYPES["bytes"]:
31317 if (value.remaining() < 0)
31318 throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
31319 var prevOffset = value.offset;
31320 buffer.writeVarint32(value.remaining());
31321 buffer.append(value);
31322 value.offset = prevOffset;
31323 break;
31324
31325 // Embedded message
31326 case ProtoBuf.TYPES["message"]:
31327 var bb = new ByteBuffer().LE();
31328 this.resolvedType.encode(value, bb);
31329 buffer.writeVarint32(bb.offset);
31330 buffer.append(bb.flip());
31331 break;
31332
31333 // Legacy group
31334 case ProtoBuf.TYPES["group"]:
31335 this.resolvedType.encode(value, buffer);
31336 buffer.writeVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
31337 break;
31338
31339 default:
31340 // We should never end here
31341 throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
31342 }
31343 return buffer;
31344 };
31345
31346 /**
31347 * Decode one element value from the specified buffer.
31348 * @param {ByteBuffer} buffer ByteBuffer to decode from
31349 * @param {number} wireType The field wire type
31350 * @param {number} id The field number
31351 * @return {*} Decoded value
31352 * @throws {Error} If the field cannot be decoded
31353 * @expose
31354 */
31355 ElementPrototype.decode = function(buffer, wireType, id) {
31356 if (wireType != this.type.wireType)
31357 throw Error("Unexpected wire type for element");
31358
31359 var value, nBytes;
31360 switch (this.type) {
31361 // 32bit signed varint
31362 case ProtoBuf.TYPES["int32"]:
31363 return buffer.readVarint32() | 0;
31364
31365 // 32bit unsigned varint
31366 case ProtoBuf.TYPES["uint32"]:
31367 return buffer.readVarint32() >>> 0;
31368
31369 // 32bit signed varint zig-zag
31370 case ProtoBuf.TYPES["sint32"]:
31371 return buffer.readVarint32ZigZag() | 0;
31372
31373 // Fixed 32bit unsigned
31374 case ProtoBuf.TYPES["fixed32"]:
31375 return buffer.readUint32() >>> 0;
31376
31377 case ProtoBuf.TYPES["sfixed32"]:
31378 return buffer.readInt32() | 0;
31379
31380 // 64bit signed varint
31381 case ProtoBuf.TYPES["int64"]:
31382 return buffer.readVarint64();
31383
31384 // 64bit unsigned varint
31385 case ProtoBuf.TYPES["uint64"]:
31386 return buffer.readVarint64().toUnsigned();
31387
31388 // 64bit signed varint zig-zag
31389 case ProtoBuf.TYPES["sint64"]:
31390 return buffer.readVarint64ZigZag();
31391
31392 // Fixed 64bit unsigned
31393 case ProtoBuf.TYPES["fixed64"]:
31394 return buffer.readUint64();
31395
31396 // Fixed 64bit signed
31397 case ProtoBuf.TYPES["sfixed64"]:
31398 return buffer.readInt64();
31399
31400 // Bool varint
31401 case ProtoBuf.TYPES["bool"]:
31402 return !!buffer.readVarint32();
31403
31404 // Constant enum value (varint)
31405 case ProtoBuf.TYPES["enum"]:
31406 // The following Builder.Message#set will already throw
31407 return buffer.readVarint32();
31408
31409 // 32bit float
31410 case ProtoBuf.TYPES["float"]:
31411 return buffer.readFloat();
31412
31413 // 64bit float
31414 case ProtoBuf.TYPES["double"]:
31415 return buffer.readDouble();
31416
31417 // Length-delimited string
31418 case ProtoBuf.TYPES["string"]:
31419 return buffer.readVString();
31420
31421 // Length-delimited bytes
31422 case ProtoBuf.TYPES["bytes"]: {
31423 nBytes = buffer.readVarint32();
31424 if (buffer.remaining() < nBytes)
31425 throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
31426 value = buffer.clone(); // Offset already set
31427 value.limit = value.offset+nBytes;
31428 buffer.offset += nBytes;
31429 return value;
31430 }
31431
31432 // Length-delimited embedded message
31433 case ProtoBuf.TYPES["message"]: {
31434 nBytes = buffer.readVarint32();
31435 return this.resolvedType.decode(buffer, nBytes);
31436 }
31437
31438 // Legacy group
31439 case ProtoBuf.TYPES["group"]:
31440 return this.resolvedType.decode(buffer, -1, id);
31441 }
31442
31443 // We should never end here
31444 throw Error("[INTERNAL] Illegal decode type");
31445 };
31446
31447 /**
31448 * Converts a value from a string to the canonical element type.
31449 *
31450 * Legal only when isMapKey is true.
31451 *
31452 * @param {string} str The string value
31453 * @returns {*} The value
31454 */
31455 ElementPrototype.valueFromString = function(str) {
31456 if (!this.isMapKey) {
31457 throw Error("valueFromString() called on non-map-key element");
31458 }
31459
31460 switch (this.type) {
31461 case ProtoBuf.TYPES["int32"]:
31462 case ProtoBuf.TYPES["sint32"]:
31463 case ProtoBuf.TYPES["sfixed32"]:
31464 case ProtoBuf.TYPES["uint32"]:
31465 case ProtoBuf.TYPES["fixed32"]:
31466 return this.verifyValue(parseInt(str));
31467
31468 case ProtoBuf.TYPES["int64"]:
31469 case ProtoBuf.TYPES["sint64"]:
31470 case ProtoBuf.TYPES["sfixed64"]:
31471 case ProtoBuf.TYPES["uint64"]:
31472 case ProtoBuf.TYPES["fixed64"]:
31473 // Long-based fields support conversions from string already.
31474 return this.verifyValue(str);
31475
31476 case ProtoBuf.TYPES["bool"]:
31477 return str === "true";
31478
31479 case ProtoBuf.TYPES["string"]:
31480 return this.verifyValue(str);
31481
31482 case ProtoBuf.TYPES["bytes"]:
31483 return ByteBuffer.fromBinary(str);
31484 }
31485 };
31486
31487 /**
31488 * Converts a value from the canonical element type to a string.
31489 *
31490 * It should be the case that `valueFromString(valueToString(val))` returns
31491 * a value equivalent to `verifyValue(val)` for every legal value of `val`
31492 * according to this element type.
31493 *
31494 * This may be used when the element must be stored or used as a string,
31495 * e.g., as a map key on an Object.
31496 *
31497 * Legal only when isMapKey is true.
31498 *
31499 * @param {*} val The value
31500 * @returns {string} The string form of the value.
31501 */
31502 ElementPrototype.valueToString = function(value) {
31503 if (!this.isMapKey) {
31504 throw Error("valueToString() called on non-map-key element");
31505 }
31506
31507 if (this.type === ProtoBuf.TYPES["bytes"]) {
31508 return value.toString("binary");
31509 } else {
31510 return value.toString();
31511 }
31512 };
31513
31514 /**
31515 * @alias ProtoBuf.Reflect.Element
31516 * @expose
31517 */
31518 Reflect.Element = Element;
31519
31520 /**
31521 * Constructs a new Message.
31522 * @exports ProtoBuf.Reflect.Message
31523 * @param {!ProtoBuf.Builder} builder Builder reference
31524 * @param {!ProtoBuf.Reflect.Namespace} parent Parent message or namespace
31525 * @param {string} name Message name
31526 * @param {Object.<string,*>=} options Message options
31527 * @param {boolean=} isGroup `true` if this is a legacy group
31528 * @param {string?} syntax The syntax level of this definition (e.g., proto3)
31529 * @constructor
31530 * @extends ProtoBuf.Reflect.Namespace
31531 */
31532 var Message = function(builder, parent, name, options, isGroup, syntax) {
31533 Namespace.call(this, builder, parent, name, options, syntax);
31534
31535 /**
31536 * @override
31537 */
31538 this.className = "Message";
31539
31540 /**
31541 * Extensions range.
31542 * @type {!Array.<number>|undefined}
31543 * @expose
31544 */
31545 this.extensions = undefined;
31546
31547 /**
31548 * Runtime message class.
31549 * @type {?function(new:ProtoBuf.Builder.Message)}
31550 * @expose
31551 */
31552 this.clazz = null;
31553
31554 /**
31555 * Whether this is a legacy group or not.
31556 * @type {boolean}
31557 * @expose
31558 */
31559 this.isGroup = !!isGroup;
31560
31561 // The following cached collections are used to efficiently iterate over or look up fields when decoding.
31562
31563 /**
31564 * Cached fields.
31565 * @type {?Array.<!ProtoBuf.Reflect.Message.Field>}
31566 * @private
31567 */
31568 this._fields = null;
31569
31570 /**
31571 * Cached fields by id.
31572 * @type {?Object.<number,!ProtoBuf.Reflect.Message.Field>}
31573 * @private
31574 */
31575 this._fieldsById = null;
31576
31577 /**
31578 * Cached fields by name.
31579 * @type {?Object.<string,!ProtoBuf.Reflect.Message.Field>}
31580 * @private
31581 */
31582 this._fieldsByName = null;
31583 };
31584
31585 /**
31586 * @alias ProtoBuf.Reflect.Message.prototype
31587 * @inner
31588 */
31589 var MessagePrototype = Message.prototype = Object.create(Namespace.prototype);
31590
31591 /**
31592 * Builds the message and returns the runtime counterpart, which is a fully functional class.
31593 * @see ProtoBuf.Builder.Message
31594 * @param {boolean=} rebuild Whether to rebuild or not, defaults to false
31595 * @return {ProtoBuf.Reflect.Message} Message class
31596 * @throws {Error} If the message cannot be built
31597 * @expose
31598 */
31599 MessagePrototype.build = function(rebuild) {
31600 if (this.clazz && !rebuild)
31601 return this.clazz;
31602
31603 // Create the runtime Message class in its own scope
31604 var clazz = (function(ProtoBuf, T) {
31605
31606 var fields = T.getChildren(ProtoBuf.Reflect.Message.Field),
31607 oneofs = T.getChildren(ProtoBuf.Reflect.Message.OneOf);
31608
31609 /**
31610 * Constructs a new runtime Message.
31611 * @name ProtoBuf.Builder.Message
31612 * @class Barebone of all runtime messages.
31613 * @param {!Object.<string,*>|string} values Preset values
31614 * @param {...string} var_args
31615 * @constructor
31616 * @throws {Error} If the message cannot be created
31617 */
31618 var Message = function(values, var_args) {
31619 ProtoBuf.Builder.Message.call(this);
31620
31621 // Create virtual oneof properties
31622 for (var i=0, k=oneofs.length; i<k; ++i)
31623 this[oneofs[i].name] = null;
31624 // Create fields and set default values
31625 for (i=0, k=fields.length; i<k; ++i) {
31626 var field = fields[i];
31627 this[field.name] =
31628 field.repeated ? [] :
31629 (field.map ? new ProtoBuf.Map(field) : null);
31630 if ((field.required || T.syntax === 'proto3') &&
31631 field.defaultValue !== null)
31632 this[field.name] = field.defaultValue;
31633 }
31634
31635 if (arguments.length > 0) {
31636 var value;
31637 // Set field values from a values object
31638 if (arguments.length === 1 && values !== null && typeof values === 'object' &&
31639 /* not _another_ Message */ (typeof values.encode !== 'function' || values instanceof Message) &&
31640 /* not a repeated field */ !Array.isArray(values) &&
31641 /* not a Map */ !(values instanceof ProtoBuf.Map) &&
31642 /* not a ByteBuffer */ !ByteBuffer.isByteBuffer(values) &&
31643 /* not an ArrayBuffer */ !(values instanceof ArrayBuffer) &&
31644 /* not a Long */ !(ProtoBuf.Long && values instanceof ProtoBuf.Long)) {
31645 this.$set(values);
31646 } else // Set field values from arguments, in declaration order
31647 for (i=0, k=arguments.length; i<k; ++i)
31648 if (typeof (value = arguments[i]) !== 'undefined')
31649 this.$set(fields[i].name, value); // May throw
31650 }
31651 };
31652
31653 /**
31654 * @alias ProtoBuf.Builder.Message.prototype
31655 * @inner
31656 */
31657 var MessagePrototype = Message.prototype = Object.create(ProtoBuf.Builder.Message.prototype);
31658
31659 /**
31660 * Adds a value to a repeated field.
31661 * @name ProtoBuf.Builder.Message#add
31662 * @function
31663 * @param {string} key Field name
31664 * @param {*} value Value to add
31665 * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
31666 * @returns {!ProtoBuf.Builder.Message} this
31667 * @throws {Error} If the value cannot be added
31668 * @expose
31669 */
31670 MessagePrototype.add = function(key, value, noAssert) {
31671 var field = T._fieldsByName[key];
31672 if (!noAssert) {
31673 if (!field)
31674 throw Error(this+"#"+key+" is undefined");
31675 if (!(field instanceof ProtoBuf.Reflect.Message.Field))
31676 throw Error(this+"#"+key+" is not a field: "+field.toString(true)); // May throw if it's an enum or embedded message
31677 if (!field.repeated)
31678 throw Error(this+"#"+key+" is not a repeated field");
31679 value = field.verifyValue(value, true);
31680 }
31681 if (this[key] === null)
31682 this[key] = [];
31683 this[key].push(value);
31684 return this;
31685 };
31686
31687 /**
31688 * Adds a value to a repeated field. This is an alias for {@link ProtoBuf.Builder.Message#add}.
31689 * @name ProtoBuf.Builder.Message#$add
31690 * @function
31691 * @param {string} key Field name
31692 * @param {*} value Value to add
31693 * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
31694 * @returns {!ProtoBuf.Builder.Message} this
31695 * @throws {Error} If the value cannot be added
31696 * @expose
31697 */
31698 MessagePrototype.$add = MessagePrototype.add;
31699
31700 /**
31701 * Sets a field's value.
31702 * @name ProtoBuf.Builder.Message#set
31703 * @function
31704 * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
31705 * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
31706 * @param {boolean=} noAssert Whether to not assert for an actual field / proper value type, defaults to `false`
31707 * @returns {!ProtoBuf.Builder.Message} this
31708 * @throws {Error} If the value cannot be set
31709 * @expose
31710 */
31711 MessagePrototype.set = function(keyOrObj, value, noAssert) {
31712 if (keyOrObj && typeof keyOrObj === 'object') {
31713 noAssert = value;
31714 for (var ikey in keyOrObj) {
31715 // Check if virtual oneof field - don't set these
31716 if (keyOrObj.hasOwnProperty(ikey) && typeof (value = keyOrObj[ikey]) !== 'undefined' && T._oneofsByName[ikey] === undefined)
31717 this.$set(ikey, value, noAssert);
31718 }
31719 return this;
31720 }
31721 var field = T._fieldsByName[keyOrObj];
31722 if (!noAssert) {
31723 if (!field)
31724 throw Error(this+"#"+keyOrObj+" is not a field: undefined");
31725 if (!(field instanceof ProtoBuf.Reflect.Message.Field))
31726 throw Error(this+"#"+keyOrObj+" is not a field: "+field.toString(true));
31727 this[field.name] = (value = field.verifyValue(value)); // May throw
31728 } else
31729 this[keyOrObj] = value;
31730 if (field && field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
31731 var currentField = this[field.oneof.name]; // Virtual field references currently set field
31732 if (value !== null) {
31733 if (currentField !== null && currentField !== field.name)
31734 this[currentField] = null; // Clear currently set field
31735 this[field.oneof.name] = field.name; // Point virtual field at this field
31736 } else if (/* value === null && */currentField === keyOrObj)
31737 this[field.oneof.name] = null; // Clear virtual field (current field explicitly cleared)
31738 }
31739 return this;
31740 };
31741
31742 /**
31743 * Sets a field's value. This is an alias for [@link ProtoBuf.Builder.Message#set}.
31744 * @name ProtoBuf.Builder.Message#$set
31745 * @function
31746 * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
31747 * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
31748 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
31749 * @throws {Error} If the value cannot be set
31750 * @expose
31751 */
31752 MessagePrototype.$set = MessagePrototype.set;
31753
31754 /**
31755 * Gets a field's value.
31756 * @name ProtoBuf.Builder.Message#get
31757 * @function
31758 * @param {string} key Key
31759 * @param {boolean=} noAssert Whether to not assert for an actual field, defaults to `false`
31760 * @return {*} Value
31761 * @throws {Error} If there is no such field
31762 * @expose
31763 */
31764 MessagePrototype.get = function(key, noAssert) {
31765 if (noAssert)
31766 return this[key];
31767 var field = T._fieldsByName[key];
31768 if (!field || !(field instanceof ProtoBuf.Reflect.Message.Field))
31769 throw Error(this+"#"+key+" is not a field: undefined");
31770 if (!(field instanceof ProtoBuf.Reflect.Message.Field))
31771 throw Error(this+"#"+key+" is not a field: "+field.toString(true));
31772 return this[field.name];
31773 };
31774
31775 /**
31776 * Gets a field's value. This is an alias for {@link ProtoBuf.Builder.Message#$get}.
31777 * @name ProtoBuf.Builder.Message#$get
31778 * @function
31779 * @param {string} key Key
31780 * @return {*} Value
31781 * @throws {Error} If there is no such field
31782 * @expose
31783 */
31784 MessagePrototype.$get = MessagePrototype.get;
31785
31786 // Getters and setters
31787
31788 for (var i=0; i<fields.length; i++) {
31789 var field = fields[i];
31790 // no setters for extension fields as these are named by their fqn
31791 if (field instanceof ProtoBuf.Reflect.Message.ExtensionField)
31792 continue;
31793
31794 if (T.builder.options['populateAccessors'])
31795 (function(field) {
31796 // set/get[SomeValue]
31797 var Name = field.originalName.replace(/(_[a-zA-Z])/g, function(match) {
31798 return match.toUpperCase().replace('_','');
31799 });
31800 Name = Name.substring(0,1).toUpperCase() + Name.substring(1);
31801
31802 // set/get_[some_value] FIXME: Do we really need these?
31803 var name = field.originalName.replace(/([A-Z])/g, function(match) {
31804 return "_"+match;
31805 });
31806
31807 /**
31808 * The current field's unbound setter function.
31809 * @function
31810 * @param {*} value
31811 * @param {boolean=} noAssert
31812 * @returns {!ProtoBuf.Builder.Message}
31813 * @inner
31814 */
31815 var setter = function(value, noAssert) {
31816 this[field.name] = noAssert ? value : field.verifyValue(value);
31817 return this;
31818 };
31819
31820 /**
31821 * The current field's unbound getter function.
31822 * @function
31823 * @returns {*}
31824 * @inner
31825 */
31826 var getter = function() {
31827 return this[field.name];
31828 };
31829
31830 if (T.getChild("set"+Name) === null)
31831 /**
31832 * Sets a value. This method is present for each field, but only if there is no name conflict with
31833 * another field.
31834 * @name ProtoBuf.Builder.Message#set[SomeField]
31835 * @function
31836 * @param {*} value Value to set
31837 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
31838 * @returns {!ProtoBuf.Builder.Message} this
31839 * @abstract
31840 * @throws {Error} If the value cannot be set
31841 */
31842 MessagePrototype["set"+Name] = setter;
31843
31844 if (T.getChild("set_"+name) === null)
31845 /**
31846 * Sets a value. This method is present for each field, but only if there is no name conflict with
31847 * another field.
31848 * @name ProtoBuf.Builder.Message#set_[some_field]
31849 * @function
31850 * @param {*} value Value to set
31851 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
31852 * @returns {!ProtoBuf.Builder.Message} this
31853 * @abstract
31854 * @throws {Error} If the value cannot be set
31855 */
31856 MessagePrototype["set_"+name] = setter;
31857
31858 if (T.getChild("get"+Name) === null)
31859 /**
31860 * Gets a value. This method is present for each field, but only if there is no name conflict with
31861 * another field.
31862 * @name ProtoBuf.Builder.Message#get[SomeField]
31863 * @function
31864 * @abstract
31865 * @return {*} The value
31866 */
31867 MessagePrototype["get"+Name] = getter;
31868
31869 if (T.getChild("get_"+name) === null)
31870 /**
31871 * Gets a value. This method is present for each field, but only if there is no name conflict with
31872 * another field.
31873 * @name ProtoBuf.Builder.Message#get_[some_field]
31874 * @function
31875 * @return {*} The value
31876 * @abstract
31877 */
31878 MessagePrototype["get_"+name] = getter;
31879
31880 })(field);
31881 }
31882
31883 // En-/decoding
31884
31885 /**
31886 * Encodes the message.
31887 * @name ProtoBuf.Builder.Message#$encode
31888 * @function
31889 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
31890 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
31891 * @return {!ByteBuffer} Encoded message as a ByteBuffer
31892 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
31893 * returns the encoded ByteBuffer in the `encoded` property on the error.
31894 * @expose
31895 * @see ProtoBuf.Builder.Message#encode64
31896 * @see ProtoBuf.Builder.Message#encodeHex
31897 * @see ProtoBuf.Builder.Message#encodeAB
31898 */
31899 MessagePrototype.encode = function(buffer, noVerify) {
31900 if (typeof buffer === 'boolean')
31901 noVerify = buffer,
31902 buffer = undefined;
31903 var isNew = false;
31904 if (!buffer)
31905 buffer = new ByteBuffer(),
31906 isNew = true;
31907 var le = buffer.littleEndian;
31908 try {
31909 T.encode(this, buffer.LE(), noVerify);
31910 return (isNew ? buffer.flip() : buffer).LE(le);
31911 } catch (e) {
31912 buffer.LE(le);
31913 throw(e);
31914 }
31915 };
31916
31917 /**
31918 * Encodes a message using the specified data payload.
31919 * @param {!Object.<string,*>} data Data payload
31920 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
31921 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
31922 * @return {!ByteBuffer} Encoded message as a ByteBuffer
31923 * @expose
31924 */
31925 Message.encode = function(data, buffer, noVerify) {
31926 return new Message(data).encode(buffer, noVerify);
31927 };
31928
31929 /**
31930 * Calculates the byte length of the message.
31931 * @name ProtoBuf.Builder.Message#calculate
31932 * @function
31933 * @returns {number} Byte length
31934 * @throws {Error} If the message cannot be calculated or if required fields are missing.
31935 * @expose
31936 */
31937 MessagePrototype.calculate = function() {
31938 return T.calculate(this);
31939 };
31940
31941 /**
31942 * Encodes the varint32 length-delimited message.
31943 * @name ProtoBuf.Builder.Message#encodeDelimited
31944 * @function
31945 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
31946 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
31947 * @return {!ByteBuffer} Encoded message as a ByteBuffer
31948 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
31949 * returns the encoded ByteBuffer in the `encoded` property on the error.
31950 * @expose
31951 */
31952 MessagePrototype.encodeDelimited = function(buffer, noVerify) {
31953 var isNew = false;
31954 if (!buffer)
31955 buffer = new ByteBuffer(),
31956 isNew = true;
31957 var enc = new ByteBuffer().LE();
31958 T.encode(this, enc, noVerify).flip();
31959 buffer.writeVarint32(enc.remaining());
31960 buffer.append(enc);
31961 return isNew ? buffer.flip() : buffer;
31962 };
31963
31964 /**
31965 * Directly encodes the message to an ArrayBuffer.
31966 * @name ProtoBuf.Builder.Message#encodeAB
31967 * @function
31968 * @return {ArrayBuffer} Encoded message as ArrayBuffer
31969 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
31970 * returns the encoded ArrayBuffer in the `encoded` property on the error.
31971 * @expose
31972 */
31973 MessagePrototype.encodeAB = function() {
31974 try {
31975 return this.encode().toArrayBuffer();
31976 } catch (e) {
31977 if (e["encoded"]) e["encoded"] = e["encoded"].toArrayBuffer();
31978 throw(e);
31979 }
31980 };
31981
31982 /**
31983 * Returns the message as an ArrayBuffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeAB}.
31984 * @name ProtoBuf.Builder.Message#toArrayBuffer
31985 * @function
31986 * @return {ArrayBuffer} Encoded message as ArrayBuffer
31987 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
31988 * returns the encoded ArrayBuffer in the `encoded` property on the error.
31989 * @expose
31990 */
31991 MessagePrototype.toArrayBuffer = MessagePrototype.encodeAB;
31992
31993 /**
31994 * Directly encodes the message to a node Buffer.
31995 * @name ProtoBuf.Builder.Message#encodeNB
31996 * @function
31997 * @return {!Buffer}
31998 * @throws {Error} If the message cannot be encoded, not running under node.js or if required fields are
31999 * missing. The later still returns the encoded node Buffer in the `encoded` property on the error.
32000 * @expose
32001 */
32002 MessagePrototype.encodeNB = function() {
32003 try {
32004 return this.encode().toBuffer();
32005 } catch (e) {
32006 if (e["encoded"]) e["encoded"] = e["encoded"].toBuffer();
32007 throw(e);
32008 }
32009 };
32010
32011 /**
32012 * Returns the message as a node Buffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeNB}.
32013 * @name ProtoBuf.Builder.Message#toBuffer
32014 * @function
32015 * @return {!Buffer}
32016 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
32017 * returns the encoded node Buffer in the `encoded` property on the error.
32018 * @expose
32019 */
32020 MessagePrototype.toBuffer = MessagePrototype.encodeNB;
32021
32022 /**
32023 * Directly encodes the message to a base64 encoded string.
32024 * @name ProtoBuf.Builder.Message#encode64
32025 * @function
32026 * @return {string} Base64 encoded string
32027 * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
32028 * still returns the encoded base64 string in the `encoded` property on the error.
32029 * @expose
32030 */
32031 MessagePrototype.encode64 = function() {
32032 try {
32033 return this.encode().toBase64();
32034 } catch (e) {
32035 if (e["encoded"]) e["encoded"] = e["encoded"].toBase64();
32036 throw(e);
32037 }
32038 };
32039
32040 /**
32041 * Returns the message as a base64 encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encode64}.
32042 * @name ProtoBuf.Builder.Message#toBase64
32043 * @function
32044 * @return {string} Base64 encoded string
32045 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
32046 * returns the encoded base64 string in the `encoded` property on the error.
32047 * @expose
32048 */
32049 MessagePrototype.toBase64 = MessagePrototype.encode64;
32050
32051 /**
32052 * Directly encodes the message to a hex encoded string.
32053 * @name ProtoBuf.Builder.Message#encodeHex
32054 * @function
32055 * @return {string} Hex encoded string
32056 * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
32057 * still returns the encoded hex string in the `encoded` property on the error.
32058 * @expose
32059 */
32060 MessagePrototype.encodeHex = function() {
32061 try {
32062 return this.encode().toHex();
32063 } catch (e) {
32064 if (e["encoded"]) e["encoded"] = e["encoded"].toHex();
32065 throw(e);
32066 }
32067 };
32068
32069 /**
32070 * Returns the message as a hex encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encodeHex}.
32071 * @name ProtoBuf.Builder.Message#toHex
32072 * @function
32073 * @return {string} Hex encoded string
32074 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
32075 * returns the encoded hex string in the `encoded` property on the error.
32076 * @expose
32077 */
32078 MessagePrototype.toHex = MessagePrototype.encodeHex;
32079
32080 /**
32081 * Clones a message object or field value to a raw object.
32082 * @param {*} obj Object to clone
32083 * @param {boolean} binaryAsBase64 Whether to include binary data as base64 strings or as a buffer otherwise
32084 * @param {boolean} longsAsStrings Whether to encode longs as strings
32085 * @param {!ProtoBuf.Reflect.T=} resolvedType The resolved field type if a field
32086 * @returns {*} Cloned object
32087 * @inner
32088 */
32089 function cloneRaw(obj, binaryAsBase64, longsAsStrings, resolvedType) {
32090 if (obj === null || typeof obj !== 'object') {
32091 // Convert enum values to their respective names
32092 if (resolvedType && resolvedType instanceof ProtoBuf.Reflect.Enum) {
32093 var name = ProtoBuf.Reflect.Enum.getName(resolvedType.object, obj);
32094 if (name !== null)
32095 return name;
32096 }
32097 // Pass-through string, number, boolean, null...
32098 return obj;
32099 }
32100 // Convert ByteBuffers to raw buffer or strings
32101 if (ByteBuffer.isByteBuffer(obj))
32102 return binaryAsBase64 ? obj.toBase64() : obj.toBuffer();
32103 // Convert Longs to proper objects or strings
32104 if (ProtoBuf.Long.isLong(obj))
32105 return longsAsStrings ? obj.toString() : ProtoBuf.Long.fromValue(obj);
32106 var clone;
32107 // Clone arrays
32108 if (Array.isArray(obj)) {
32109 clone = [];
32110 obj.forEach(function(v, k) {
32111 clone[k] = cloneRaw(v, binaryAsBase64, longsAsStrings, resolvedType);
32112 });
32113 return clone;
32114 }
32115 clone = {};
32116 // Convert maps to objects
32117 if (obj instanceof ProtoBuf.Map) {
32118 var it = obj.entries();
32119 for (var e = it.next(); !e.done; e = it.next())
32120 clone[obj.keyElem.valueToString(e.value[0])] = cloneRaw(e.value[1], binaryAsBase64, longsAsStrings, obj.valueElem.resolvedType);
32121 return clone;
32122 }
32123 // Everything else is a non-null object
32124 var type = obj.$type,
32125 field = undefined;
32126 for (var i in obj)
32127 if (obj.hasOwnProperty(i)) {
32128 if (type && (field = type.getChild(i)))
32129 clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings, field.resolvedType);
32130 else
32131 clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings);
32132 }
32133 return clone;
32134 }
32135
32136 /**
32137 * Returns the message's raw payload.
32138 * @param {boolean=} binaryAsBase64 Whether to include binary data as base64 strings instead of Buffers, defaults to `false`
32139 * @param {boolean} longsAsStrings Whether to encode longs as strings
32140 * @returns {Object.<string,*>} Raw payload
32141 * @expose
32142 */
32143 MessagePrototype.toRaw = function(binaryAsBase64, longsAsStrings) {
32144 return cloneRaw(this, !!binaryAsBase64, !!longsAsStrings, this.$type);
32145 };
32146
32147 /**
32148 * Encodes a message to JSON.
32149 * @returns {string} JSON string
32150 * @expose
32151 */
32152 MessagePrototype.encodeJSON = function() {
32153 return JSON.stringify(
32154 cloneRaw(this,
32155 /* binary-as-base64 */ true,
32156 /* longs-as-strings */ true,
32157 this.$type
32158 )
32159 );
32160 };
32161
32162 /**
32163 * Decodes a message from the specified buffer or string.
32164 * @name ProtoBuf.Builder.Message.decode
32165 * @function
32166 * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
32167 * @param {(number|string)=} length Message length. Defaults to decode all the remainig data.
32168 * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
32169 * @return {!ProtoBuf.Builder.Message} Decoded message
32170 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
32171 * returns the decoded message with missing fields in the `decoded` property on the error.
32172 * @expose
32173 * @see ProtoBuf.Builder.Message.decode64
32174 * @see ProtoBuf.Builder.Message.decodeHex
32175 */
32176 Message.decode = function(buffer, length, enc) {
32177 if (typeof length === 'string')
32178 enc = length,
32179 length = -1;
32180 if (typeof buffer === 'string')
32181 buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
32182 else if (!ByteBuffer.isByteBuffer(buffer))
32183 buffer = ByteBuffer.wrap(buffer); // May throw
32184 var le = buffer.littleEndian;
32185 try {
32186 var msg = T.decode(buffer.LE(), length);
32187 buffer.LE(le);
32188 return msg;
32189 } catch (e) {
32190 buffer.LE(le);
32191 throw(e);
32192 }
32193 };
32194
32195 /**
32196 * Decodes a varint32 length-delimited message from the specified buffer or string.
32197 * @name ProtoBuf.Builder.Message.decodeDelimited
32198 * @function
32199 * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
32200 * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
32201 * @return {ProtoBuf.Builder.Message} Decoded message or `null` if not enough bytes are available yet
32202 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
32203 * returns the decoded message with missing fields in the `decoded` property on the error.
32204 * @expose
32205 */
32206 Message.decodeDelimited = function(buffer, enc) {
32207 if (typeof buffer === 'string')
32208 buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
32209 else if (!ByteBuffer.isByteBuffer(buffer))
32210 buffer = ByteBuffer.wrap(buffer); // May throw
32211 if (buffer.remaining() < 1)
32212 return null;
32213 var off = buffer.offset,
32214 len = buffer.readVarint32();
32215 if (buffer.remaining() < len) {
32216 buffer.offset = off;
32217 return null;
32218 }
32219 try {
32220 var msg = T.decode(buffer.slice(buffer.offset, buffer.offset + len).LE());
32221 buffer.offset += len;
32222 return msg;
32223 } catch (err) {
32224 buffer.offset += len;
32225 throw err;
32226 }
32227 };
32228
32229 /**
32230 * Decodes the message from the specified base64 encoded string.
32231 * @name ProtoBuf.Builder.Message.decode64
32232 * @function
32233 * @param {string} str String to decode from
32234 * @return {!ProtoBuf.Builder.Message} Decoded message
32235 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
32236 * returns the decoded message with missing fields in the `decoded` property on the error.
32237 * @expose
32238 */
32239 Message.decode64 = function(str) {
32240 return Message.decode(str, "base64");
32241 };
32242
32243 /**
32244 * Decodes the message from the specified hex encoded string.
32245 * @name ProtoBuf.Builder.Message.decodeHex
32246 * @function
32247 * @param {string} str String to decode from
32248 * @return {!ProtoBuf.Builder.Message} Decoded message
32249 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
32250 * returns the decoded message with missing fields in the `decoded` property on the error.
32251 * @expose
32252 */
32253 Message.decodeHex = function(str) {
32254 return Message.decode(str, "hex");
32255 };
32256
32257 /**
32258 * Decodes the message from a JSON string.
32259 * @name ProtoBuf.Builder.Message.decodeJSON
32260 * @function
32261 * @param {string} str String to decode from
32262 * @return {!ProtoBuf.Builder.Message} Decoded message
32263 * @throws {Error} If the message cannot be decoded or if required fields are
32264 * missing.
32265 * @expose
32266 */
32267 Message.decodeJSON = function(str) {
32268 return new Message(JSON.parse(str));
32269 };
32270
32271 // Utility
32272
32273 /**
32274 * Returns a string representation of this Message.
32275 * @name ProtoBuf.Builder.Message#toString
32276 * @function
32277 * @return {string} String representation as of ".Fully.Qualified.MessageName"
32278 * @expose
32279 */
32280 MessagePrototype.toString = function() {
32281 return T.toString();
32282 };
32283
32284 // Properties
32285
32286 /**
32287 * Message options.
32288 * @name ProtoBuf.Builder.Message.$options
32289 * @type {Object.<string,*>}
32290 * @expose
32291 */
32292 var $optionsS; // cc needs this
32293
32294 /**
32295 * Message options.
32296 * @name ProtoBuf.Builder.Message#$options
32297 * @type {Object.<string,*>}
32298 * @expose
32299 */
32300 var $options;
32301
32302 /**
32303 * Reflection type.
32304 * @name ProtoBuf.Builder.Message.$type
32305 * @type {!ProtoBuf.Reflect.Message}
32306 * @expose
32307 */
32308 var $typeS;
32309
32310 /**
32311 * Reflection type.
32312 * @name ProtoBuf.Builder.Message#$type
32313 * @type {!ProtoBuf.Reflect.Message}
32314 * @expose
32315 */
32316 var $type;
32317
32318 if (Object.defineProperty)
32319 Object.defineProperty(Message, '$options', { "value": T.buildOpt() }),
32320 Object.defineProperty(MessagePrototype, "$options", { "value": Message["$options"] }),
32321 Object.defineProperty(Message, "$type", { "value": T }),
32322 Object.defineProperty(MessagePrototype, "$type", { "value": T });
32323
32324 return Message;
32325
32326 })(ProtoBuf, this);
32327
32328 // Static enums and prototyped sub-messages / cached collections
32329 this._fields = [];
32330 this._fieldsById = {};
32331 this._fieldsByName = {};
32332 this._oneofsByName = {};
32333 for (var i=0, k=this.children.length, child; i<k; i++) {
32334 child = this.children[i];
32335 if (child instanceof Enum || child instanceof Message || child instanceof Service) {
32336 if (clazz.hasOwnProperty(child.name))
32337 throw Error("Illegal reflect child of "+this.toString(true)+": "+child.toString(true)+" cannot override static property '"+child.name+"'");
32338 clazz[child.name] = child.build();
32339 } else if (child instanceof Message.Field)
32340 child.build(),
32341 this._fields.push(child),
32342 this._fieldsById[child.id] = child,
32343 this._fieldsByName[child.name] = child;
32344 else if (child instanceof Message.OneOf) {
32345 this._oneofsByName[child.name] = child;
32346 }
32347 else if (!(child instanceof Message.OneOf) && !(child instanceof Extension)) // Not built
32348 throw Error("Illegal reflect child of "+this.toString(true)+": "+this.children[i].toString(true));
32349 }
32350
32351 return this.clazz = clazz;
32352 };
32353
32354 /**
32355 * Encodes a runtime message's contents to the specified buffer.
32356 * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
32357 * @param {ByteBuffer} buffer ByteBuffer to write to
32358 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
32359 * @return {ByteBuffer} The ByteBuffer for chaining
32360 * @throws {Error} If required fields are missing or the message cannot be encoded for another reason
32361 * @expose
32362 */
32363 MessagePrototype.encode = function(message, buffer, noVerify) {
32364 var fieldMissing = null,
32365 field;
32366 for (var i=0, k=this._fields.length, val; i<k; ++i) {
32367 field = this._fields[i];
32368 val = message[field.name];
32369 if (field.required && val === null) {
32370 if (fieldMissing === null)
32371 fieldMissing = field;
32372 } else
32373 field.encode(noVerify ? val : field.verifyValue(val), buffer, message);
32374 }
32375 if (fieldMissing !== null) {
32376 var err = Error("Missing at least one required field for "+this.toString(true)+": "+fieldMissing);
32377 err["encoded"] = buffer; // Still expose what we got
32378 throw(err);
32379 }
32380 return buffer;
32381 };
32382
32383 /**
32384 * Calculates a runtime message's byte length.
32385 * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
32386 * @returns {number} Byte length
32387 * @throws {Error} If required fields are missing or the message cannot be calculated for another reason
32388 * @expose
32389 */
32390 MessagePrototype.calculate = function(message) {
32391 for (var n=0, i=0, k=this._fields.length, field, val; i<k; ++i) {
32392 field = this._fields[i];
32393 val = message[field.name];
32394 if (field.required && val === null)
32395 throw Error("Missing at least one required field for "+this.toString(true)+": "+field);
32396 else
32397 n += field.calculate(val, message);
32398 }
32399 return n;
32400 };
32401
32402 /**
32403 * Skips all data until the end of the specified group has been reached.
32404 * @param {number} expectedId Expected GROUPEND id
32405 * @param {!ByteBuffer} buf ByteBuffer
32406 * @returns {boolean} `true` if a value as been skipped, `false` if the end has been reached
32407 * @throws {Error} If it wasn't possible to find the end of the group (buffer overrun or end tag mismatch)
32408 * @inner
32409 */
32410 function skipTillGroupEnd(expectedId, buf) {
32411 var tag = buf.readVarint32(), // Throws on OOB
32412 wireType = tag & 0x07,
32413 id = tag >>> 3;
32414 switch (wireType) {
32415 case ProtoBuf.WIRE_TYPES.VARINT:
32416 do tag = buf.readUint8();
32417 while ((tag & 0x80) === 0x80);
32418 break;
32419 case ProtoBuf.WIRE_TYPES.BITS64:
32420 buf.offset += 8;
32421 break;
32422 case ProtoBuf.WIRE_TYPES.LDELIM:
32423 tag = buf.readVarint32(); // reads the varint
32424 buf.offset += tag; // skips n bytes
32425 break;
32426 case ProtoBuf.WIRE_TYPES.STARTGROUP:
32427 skipTillGroupEnd(id, buf);
32428 break;
32429 case ProtoBuf.WIRE_TYPES.ENDGROUP:
32430 if (id === expectedId)
32431 return false;
32432 else
32433 throw Error("Illegal GROUPEND after unknown group: "+id+" ("+expectedId+" expected)");
32434 case ProtoBuf.WIRE_TYPES.BITS32:
32435 buf.offset += 4;
32436 break;
32437 default:
32438 throw Error("Illegal wire type in unknown group "+expectedId+": "+wireType);
32439 }
32440 return true;
32441 }
32442
32443 /**
32444 * Decodes an encoded message and returns the decoded message.
32445 * @param {ByteBuffer} buffer ByteBuffer to decode from
32446 * @param {number=} length Message length. Defaults to decode all remaining data.
32447 * @param {number=} expectedGroupEndId Expected GROUPEND id if this is a legacy group
32448 * @return {ProtoBuf.Builder.Message} Decoded message
32449 * @throws {Error} If the message cannot be decoded
32450 * @expose
32451 */
32452 MessagePrototype.decode = function(buffer, length, expectedGroupEndId) {
32453 if (typeof length !== 'number')
32454 length = -1;
32455 var start = buffer.offset,
32456 msg = new (this.clazz)(),
32457 tag, wireType, id, field;
32458 while (buffer.offset < start+length || (length === -1 && buffer.remaining() > 0)) {
32459 tag = buffer.readVarint32();
32460 wireType = tag & 0x07;
32461 id = tag >>> 3;
32462 if (wireType === ProtoBuf.WIRE_TYPES.ENDGROUP) {
32463 if (id !== expectedGroupEndId)
32464 throw Error("Illegal group end indicator for "+this.toString(true)+": "+id+" ("+(expectedGroupEndId ? expectedGroupEndId+" expected" : "not a group")+")");
32465 break;
32466 }
32467 if (!(field = this._fieldsById[id])) {
32468 // "messages created by your new code can be parsed by your old code: old binaries simply ignore the new field when parsing."
32469 switch (wireType) {
32470 case ProtoBuf.WIRE_TYPES.VARINT:
32471 buffer.readVarint32();
32472 break;
32473 case ProtoBuf.WIRE_TYPES.BITS32:
32474 buffer.offset += 4;
32475 break;
32476 case ProtoBuf.WIRE_TYPES.BITS64:
32477 buffer.offset += 8;
32478 break;
32479 case ProtoBuf.WIRE_TYPES.LDELIM:
32480 var len = buffer.readVarint32();
32481 buffer.offset += len;
32482 break;
32483 case ProtoBuf.WIRE_TYPES.STARTGROUP:
32484 while (skipTillGroupEnd(id, buffer)) {}
32485 break;
32486 default:
32487 throw Error("Illegal wire type for unknown field "+id+" in "+this.toString(true)+"#decode: "+wireType);
32488 }
32489 continue;
32490 }
32491 if (field.repeated && !field.options["packed"]) {
32492 msg[field.name].push(field.decode(wireType, buffer));
32493 } else if (field.map) {
32494 var keyval = field.decode(wireType, buffer);
32495 msg[field.name].set(keyval[0], keyval[1]);
32496 } else {
32497 msg[field.name] = field.decode(wireType, buffer);
32498 if (field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
32499 var currentField = msg[field.oneof.name]; // Virtual field references currently set field
32500 if (currentField !== null && currentField !== field.name)
32501 msg[currentField] = null; // Clear currently set field
32502 msg[field.oneof.name] = field.name; // Point virtual field at this field
32503 }
32504 }
32505 }
32506
32507 // Check if all required fields are present and set default values for optional fields that are not
32508 for (var i=0, k=this._fields.length; i<k; ++i) {
32509 field = this._fields[i];
32510 if (msg[field.name] === null) {
32511 if (this.syntax === "proto3") { // Proto3 sets default values by specification
32512 msg[field.name] = field.defaultValue;
32513 } else if (field.required) {
32514 var err = Error("Missing at least one required field for " + this.toString(true) + ": " + field.name);
32515 err["decoded"] = msg; // Still expose what we got
32516 throw(err);
32517 } else if (ProtoBuf.populateDefaults && field.defaultValue !== null)
32518 msg[field.name] = field.defaultValue;
32519 }
32520 }
32521 return msg;
32522 };
32523
32524 /**
32525 * @alias ProtoBuf.Reflect.Message
32526 * @expose
32527 */
32528 Reflect.Message = Message;
32529
32530 /**
32531 * Constructs a new Message Field.
32532 * @exports ProtoBuf.Reflect.Message.Field
32533 * @param {!ProtoBuf.Builder} builder Builder reference
32534 * @param {!ProtoBuf.Reflect.Message} message Message reference
32535 * @param {string} rule Rule, one of requried, optional, repeated
32536 * @param {string?} keytype Key data type, if any.
32537 * @param {string} type Data type, e.g. int32
32538 * @param {string} name Field name
32539 * @param {number} id Unique field id
32540 * @param {Object.<string,*>=} options Options
32541 * @param {!ProtoBuf.Reflect.Message.OneOf=} oneof Enclosing OneOf
32542 * @param {string?} syntax The syntax level of this definition (e.g., proto3)
32543 * @constructor
32544 * @extends ProtoBuf.Reflect.T
32545 */
32546 var Field = function(builder, message, rule, keytype, type, name, id, options, oneof, syntax) {
32547 T.call(this, builder, message, name);
32548
32549 /**
32550 * @override
32551 */
32552 this.className = "Message.Field";
32553
32554 /**
32555 * Message field required flag.
32556 * @type {boolean}
32557 * @expose
32558 */
32559 this.required = rule === "required";
32560
32561 /**
32562 * Message field repeated flag.
32563 * @type {boolean}
32564 * @expose
32565 */
32566 this.repeated = rule === "repeated";
32567
32568 /**
32569 * Message field map flag.
32570 * @type {boolean}
32571 * @expose
32572 */
32573 this.map = rule === "map";
32574
32575 /**
32576 * Message field key type. Type reference string if unresolved, protobuf
32577 * type if resolved. Valid only if this.map === true, null otherwise.
32578 * @type {string|{name: string, wireType: number}|null}
32579 * @expose
32580 */
32581 this.keyType = keytype || null;
32582
32583 /**
32584 * Message field type. Type reference string if unresolved, protobuf type if
32585 * resolved. In a map field, this is the value type.
32586 * @type {string|{name: string, wireType: number}}
32587 * @expose
32588 */
32589 this.type = type;
32590
32591 /**
32592 * Resolved type reference inside the global namespace.
32593 * @type {ProtoBuf.Reflect.T|null}
32594 * @expose
32595 */
32596 this.resolvedType = null;
32597
32598 /**
32599 * Unique message field id.
32600 * @type {number}
32601 * @expose
32602 */
32603 this.id = id;
32604
32605 /**
32606 * Message field options.
32607 * @type {!Object.<string,*>}
32608 * @dict
32609 * @expose
32610 */
32611 this.options = options || {};
32612
32613 /**
32614 * Default value.
32615 * @type {*}
32616 * @expose
32617 */
32618 this.defaultValue = null;
32619
32620 /**
32621 * Enclosing OneOf.
32622 * @type {?ProtoBuf.Reflect.Message.OneOf}
32623 * @expose
32624 */
32625 this.oneof = oneof || null;
32626
32627 /**
32628 * Syntax level of this definition (e.g., proto3).
32629 * @type {string}
32630 * @expose
32631 */
32632 this.syntax = syntax || 'proto2';
32633
32634 /**
32635 * Original field name.
32636 * @type {string}
32637 * @expose
32638 */
32639 this.originalName = this.name; // Used to revert camelcase transformation on naming collisions
32640
32641 /**
32642 * Element implementation. Created in build() after types are resolved.
32643 * @type {ProtoBuf.Element}
32644 * @expose
32645 */
32646 this.element = null;
32647
32648 /**
32649 * Key element implementation, for map fields. Created in build() after
32650 * types are resolved.
32651 * @type {ProtoBuf.Element}
32652 * @expose
32653 */
32654 this.keyElement = null;
32655
32656 // Convert field names to camel case notation if the override is set
32657 if (this.builder.options['convertFieldsToCamelCase'] && !(this instanceof Message.ExtensionField))
32658 this.name = ProtoBuf.Util.toCamelCase(this.name);
32659 };
32660
32661 /**
32662 * @alias ProtoBuf.Reflect.Message.Field.prototype
32663 * @inner
32664 */
32665 var FieldPrototype = Field.prototype = Object.create(T.prototype);
32666
32667 /**
32668 * Builds the field.
32669 * @override
32670 * @expose
32671 */
32672 FieldPrototype.build = function() {
32673 this.element = new Element(this.type, this.resolvedType, false, this.syntax, this.name);
32674 if (this.map)
32675 this.keyElement = new Element(this.keyType, undefined, true, this.syntax, this.name);
32676
32677 // In proto3, fields do not have field presence, and every field is set to
32678 // its type's default value ("", 0, 0.0, or false).
32679 if (this.syntax === 'proto3' && !this.repeated && !this.map)
32680 this.defaultValue = Element.defaultFieldValue(this.type);
32681
32682 // Otherwise, default values are present when explicitly specified
32683 else if (typeof this.options['default'] !== 'undefined')
32684 this.defaultValue = this.verifyValue(this.options['default']);
32685 };
32686
32687 /**
32688 * Checks if the given value can be set for this field.
32689 * @param {*} value Value to check
32690 * @param {boolean=} skipRepeated Whether to skip the repeated value check or not. Defaults to false.
32691 * @return {*} Verified, maybe adjusted, value
32692 * @throws {Error} If the value cannot be set for this field
32693 * @expose
32694 */
32695 FieldPrototype.verifyValue = function(value, skipRepeated) {
32696 skipRepeated = skipRepeated || false;
32697 var self = this;
32698 function fail(val, msg) {
32699 throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
32700 }
32701 if (value === null) { // NULL values for optional fields
32702 if (this.required)
32703 fail(typeof value, "required");
32704 if (this.syntax === 'proto3' && this.type !== ProtoBuf.TYPES["message"])
32705 fail(typeof value, "proto3 field without field presence cannot be null");
32706 return null;
32707 }
32708 var i;
32709 if (this.repeated && !skipRepeated) { // Repeated values as arrays
32710 if (!Array.isArray(value))
32711 value = [value];
32712 var res = [];
32713 for (i=0; i<value.length; i++)
32714 res.push(this.element.verifyValue(value[i]));
32715 return res;
32716 }
32717 if (this.map && !skipRepeated) { // Map values as objects
32718 if (!(value instanceof ProtoBuf.Map)) {
32719 // If not already a Map, attempt to convert.
32720 if (!(value instanceof Object)) {
32721 fail(typeof value,
32722 "expected ProtoBuf.Map or raw object for map field");
32723 }
32724 return new ProtoBuf.Map(this, value);
32725 } else {
32726 return value;
32727 }
32728 }
32729 // All non-repeated fields expect no array
32730 if (!this.repeated && Array.isArray(value))
32731 fail(typeof value, "no array expected");
32732
32733 return this.element.verifyValue(value);
32734 };
32735
32736 /**
32737 * Determines whether the field will have a presence on the wire given its
32738 * value.
32739 * @param {*} value Verified field value
32740 * @param {!ProtoBuf.Builder.Message} message Runtime message
32741 * @return {boolean} Whether the field will be present on the wire
32742 */
32743 FieldPrototype.hasWirePresence = function(value, message) {
32744 if (this.syntax !== 'proto3')
32745 return (value !== null);
32746 if (this.oneof && message[this.oneof.name] === this.name)
32747 return true;
32748 switch (this.type) {
32749 case ProtoBuf.TYPES["int32"]:
32750 case ProtoBuf.TYPES["sint32"]:
32751 case ProtoBuf.TYPES["sfixed32"]:
32752 case ProtoBuf.TYPES["uint32"]:
32753 case ProtoBuf.TYPES["fixed32"]:
32754 return value !== 0;
32755
32756 case ProtoBuf.TYPES["int64"]:
32757 case ProtoBuf.TYPES["sint64"]:
32758 case ProtoBuf.TYPES["sfixed64"]:
32759 case ProtoBuf.TYPES["uint64"]:
32760 case ProtoBuf.TYPES["fixed64"]:
32761 return value.low !== 0 || value.high !== 0;
32762
32763 case ProtoBuf.TYPES["bool"]:
32764 return value;
32765
32766 case ProtoBuf.TYPES["float"]:
32767 case ProtoBuf.TYPES["double"]:
32768 return value !== 0.0;
32769
32770 case ProtoBuf.TYPES["string"]:
32771 return value.length > 0;
32772
32773 case ProtoBuf.TYPES["bytes"]:
32774 return value.remaining() > 0;
32775
32776 case ProtoBuf.TYPES["enum"]:
32777 return value !== 0;
32778
32779 case ProtoBuf.TYPES["message"]:
32780 return value !== null;
32781 default:
32782 return true;
32783 }
32784 };
32785
32786 /**
32787 * Encodes the specified field value to the specified buffer.
32788 * @param {*} value Verified field value
32789 * @param {ByteBuffer} buffer ByteBuffer to encode to
32790 * @param {!ProtoBuf.Builder.Message} message Runtime message
32791 * @return {ByteBuffer} The ByteBuffer for chaining
32792 * @throws {Error} If the field cannot be encoded
32793 * @expose
32794 */
32795 FieldPrototype.encode = function(value, buffer, message) {
32796 if (this.type === null || typeof this.type !== 'object')
32797 throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
32798 if (value === null || (this.repeated && value.length == 0))
32799 return buffer; // Optional omitted
32800 try {
32801 if (this.repeated) {
32802 var i;
32803 // "Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire
32804 // types) can be declared 'packed'."
32805 if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
32806 // "All of the elements of the field are packed into a single key-value pair with wire type 2
32807 // (length-delimited). Each element is encoded the same way it would be normally, except without a
32808 // tag preceding it."
32809 buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
32810 buffer.ensureCapacity(buffer.offset += 1); // We do not know the length yet, so let's assume a varint of length 1
32811 var start = buffer.offset; // Remember where the contents begin
32812 for (i=0; i<value.length; i++)
32813 this.element.encodeValue(this.id, value[i], buffer);
32814 var len = buffer.offset-start,
32815 varintLen = ByteBuffer.calculateVarint32(len);
32816 if (varintLen > 1) { // We need to move the contents
32817 var contents = buffer.slice(start, buffer.offset);
32818 start += varintLen-1;
32819 buffer.offset = start;
32820 buffer.append(contents);
32821 }
32822 buffer.writeVarint32(len, start-varintLen);
32823 } else {
32824 // "If your message definition has repeated elements (without the [packed=true] option), the encoded
32825 // message has zero or more key-value pairs with the same tag number"
32826 for (i=0; i<value.length; i++)
32827 buffer.writeVarint32((this.id << 3) | this.type.wireType),
32828 this.element.encodeValue(this.id, value[i], buffer);
32829 }
32830 } else if (this.map) {
32831 // Write out each map entry as a submessage.
32832 value.forEach(function(val, key, m) {
32833 // Compute the length of the submessage (key, val) pair.
32834 var length =
32835 ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
32836 this.keyElement.calculateLength(1, key) +
32837 ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
32838 this.element.calculateLength(2, val);
32839
32840 // Submessage with wire type of length-delimited.
32841 buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
32842 buffer.writeVarint32(length);
32843
32844 // Write out the key and val.
32845 buffer.writeVarint32((1 << 3) | this.keyType.wireType);
32846 this.keyElement.encodeValue(1, key, buffer);
32847 buffer.writeVarint32((2 << 3) | this.type.wireType);
32848 this.element.encodeValue(2, val, buffer);
32849 }, this);
32850 } else {
32851 if (this.hasWirePresence(value, message)) {
32852 buffer.writeVarint32((this.id << 3) | this.type.wireType);
32853 this.element.encodeValue(this.id, value, buffer);
32854 }
32855 }
32856 } catch (e) {
32857 throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
32858 }
32859 return buffer;
32860 };
32861
32862 /**
32863 * Calculates the length of this field's value on the network level.
32864 * @param {*} value Field value
32865 * @param {!ProtoBuf.Builder.Message} message Runtime message
32866 * @returns {number} Byte length
32867 * @expose
32868 */
32869 FieldPrototype.calculate = function(value, message) {
32870 value = this.verifyValue(value); // May throw
32871 if (this.type === null || typeof this.type !== 'object')
32872 throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
32873 if (value === null || (this.repeated && value.length == 0))
32874 return 0; // Optional omitted
32875 var n = 0;
32876 try {
32877 if (this.repeated) {
32878 var i, ni;
32879 if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
32880 n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
32881 ni = 0;
32882 for (i=0; i<value.length; i++)
32883 ni += this.element.calculateLength(this.id, value[i]);
32884 n += ByteBuffer.calculateVarint32(ni);
32885 n += ni;
32886 } else {
32887 for (i=0; i<value.length; i++)
32888 n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType),
32889 n += this.element.calculateLength(this.id, value[i]);
32890 }
32891 } else if (this.map) {
32892 // Each map entry becomes a submessage.
32893 value.forEach(function(val, key, m) {
32894 // Compute the length of the submessage (key, val) pair.
32895 var length =
32896 ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
32897 this.keyElement.calculateLength(1, key) +
32898 ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
32899 this.element.calculateLength(2, val);
32900
32901 n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
32902 n += ByteBuffer.calculateVarint32(length);
32903 n += length;
32904 }, this);
32905 } else {
32906 if (this.hasWirePresence(value, message)) {
32907 n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType);
32908 n += this.element.calculateLength(this.id, value);
32909 }
32910 }
32911 } catch (e) {
32912 throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
32913 }
32914 return n;
32915 };
32916
32917 /**
32918 * Decode the field value from the specified buffer.
32919 * @param {number} wireType Leading wire type
32920 * @param {ByteBuffer} buffer ByteBuffer to decode from
32921 * @param {boolean=} skipRepeated Whether to skip the repeated check or not. Defaults to false.
32922 * @return {*} Decoded value: array for packed repeated fields, [key, value] for
32923 * map fields, or an individual value otherwise.
32924 * @throws {Error} If the field cannot be decoded
32925 * @expose
32926 */
32927 FieldPrototype.decode = function(wireType, buffer, skipRepeated) {
32928 var value, nBytes;
32929
32930 // We expect wireType to match the underlying type's wireType unless we see
32931 // a packed repeated field, or unless this is a map field.
32932 var wireTypeOK =
32933 (!this.map && wireType == this.type.wireType) ||
32934 (!skipRepeated && this.repeated && this.options["packed"] &&
32935 wireType == ProtoBuf.WIRE_TYPES.LDELIM) ||
32936 (this.map && wireType == ProtoBuf.WIRE_TYPES.LDELIM);
32937 if (!wireTypeOK)
32938 throw Error("Illegal wire type for field "+this.toString(true)+": "+wireType+" ("+this.type.wireType+" expected)");
32939
32940 // Handle packed repeated fields.
32941 if (wireType == ProtoBuf.WIRE_TYPES.LDELIM && this.repeated && this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
32942 if (!skipRepeated) {
32943 nBytes = buffer.readVarint32();
32944 nBytes = buffer.offset + nBytes; // Limit
32945 var values = [];
32946 while (buffer.offset < nBytes)
32947 values.push(this.decode(this.type.wireType, buffer, true));
32948 return values;
32949 }
32950 // Read the next value otherwise...
32951 }
32952
32953 // Handle maps.
32954 if (this.map) {
32955 // Read one (key, value) submessage, and return [key, value]
32956 var key = Element.defaultFieldValue(this.keyType);
32957 value = Element.defaultFieldValue(this.type);
32958
32959 // Read the length
32960 nBytes = buffer.readVarint32();
32961 if (buffer.remaining() < nBytes)
32962 throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
32963
32964 // Get a sub-buffer of this key/value submessage
32965 var msgbuf = buffer.clone();
32966 msgbuf.limit = msgbuf.offset + nBytes;
32967 buffer.offset += nBytes;
32968
32969 while (msgbuf.remaining() > 0) {
32970 var tag = msgbuf.readVarint32();
32971 wireType = tag & 0x07;
32972 var id = tag >>> 3;
32973 if (id === 1) {
32974 key = this.keyElement.decode(msgbuf, wireType, id);
32975 } else if (id === 2) {
32976 value = this.element.decode(msgbuf, wireType, id);
32977 } else {
32978 throw Error("Unexpected tag in map field key/value submessage");
32979 }
32980 }
32981
32982 return [key, value];
32983 }
32984
32985 // Handle singular and non-packed repeated field values.
32986 return this.element.decode(buffer, wireType, this.id);
32987 };
32988
32989 /**
32990 * @alias ProtoBuf.Reflect.Message.Field
32991 * @expose
32992 */
32993 Reflect.Message.Field = Field;
32994
32995 /**
32996 * Constructs a new Message ExtensionField.
32997 * @exports ProtoBuf.Reflect.Message.ExtensionField
32998 * @param {!ProtoBuf.Builder} builder Builder reference
32999 * @param {!ProtoBuf.Reflect.Message} message Message reference
33000 * @param {string} rule Rule, one of requried, optional, repeated
33001 * @param {string} type Data type, e.g. int32
33002 * @param {string} name Field name
33003 * @param {number} id Unique field id
33004 * @param {!Object.<string,*>=} options Options
33005 * @constructor
33006 * @extends ProtoBuf.Reflect.Message.Field
33007 */
33008 var ExtensionField = function(builder, message, rule, type, name, id, options) {
33009 Field.call(this, builder, message, rule, /* keytype = */ null, type, name, id, options);
33010
33011 /**
33012 * Extension reference.
33013 * @type {!ProtoBuf.Reflect.Extension}
33014 * @expose
33015 */
33016 this.extension;
33017 };
33018
33019 // Extends Field
33020 ExtensionField.prototype = Object.create(Field.prototype);
33021
33022 /**
33023 * @alias ProtoBuf.Reflect.Message.ExtensionField
33024 * @expose
33025 */
33026 Reflect.Message.ExtensionField = ExtensionField;
33027
33028 /**
33029 * Constructs a new Message OneOf.
33030 * @exports ProtoBuf.Reflect.Message.OneOf
33031 * @param {!ProtoBuf.Builder} builder Builder reference
33032 * @param {!ProtoBuf.Reflect.Message} message Message reference
33033 * @param {string} name OneOf name
33034 * @constructor
33035 * @extends ProtoBuf.Reflect.T
33036 */
33037 var OneOf = function(builder, message, name) {
33038 T.call(this, builder, message, name);
33039
33040 /**
33041 * Enclosed fields.
33042 * @type {!Array.<!ProtoBuf.Reflect.Message.Field>}
33043 * @expose
33044 */
33045 this.fields = [];
33046 };
33047
33048 /**
33049 * @alias ProtoBuf.Reflect.Message.OneOf
33050 * @expose
33051 */
33052 Reflect.Message.OneOf = OneOf;
33053
33054 /**
33055 * Constructs a new Enum.
33056 * @exports ProtoBuf.Reflect.Enum
33057 * @param {!ProtoBuf.Builder} builder Builder reference
33058 * @param {!ProtoBuf.Reflect.T} parent Parent Reflect object
33059 * @param {string} name Enum name
33060 * @param {Object.<string,*>=} options Enum options
33061 * @param {string?} syntax The syntax level (e.g., proto3)
33062 * @constructor
33063 * @extends ProtoBuf.Reflect.Namespace
33064 */
33065 var Enum = function(builder, parent, name, options, syntax) {
33066 Namespace.call(this, builder, parent, name, options, syntax);
33067
33068 /**
33069 * @override
33070 */
33071 this.className = "Enum";
33072
33073 /**
33074 * Runtime enum object.
33075 * @type {Object.<string,number>|null}
33076 * @expose
33077 */
33078 this.object = null;
33079 };
33080
33081 /**
33082 * Gets the string name of an enum value.
33083 * @param {!ProtoBuf.Builder.Enum} enm Runtime enum
33084 * @param {number} value Enum value
33085 * @returns {?string} Name or `null` if not present
33086 * @expose
33087 */
33088 Enum.getName = function(enm, value) {
33089 var keys = Object.keys(enm);
33090 for (var i=0, key; i<keys.length; ++i)
33091 if (enm[key = keys[i]] === value)
33092 return key;
33093 return null;
33094 };
33095
33096 /**
33097 * @alias ProtoBuf.Reflect.Enum.prototype
33098 * @inner
33099 */
33100 var EnumPrototype = Enum.prototype = Object.create(Namespace.prototype);
33101
33102 /**
33103 * Builds this enum and returns the runtime counterpart.
33104 * @param {boolean} rebuild Whether to rebuild or not, defaults to false
33105 * @returns {!Object.<string,number>}
33106 * @expose
33107 */
33108 EnumPrototype.build = function(rebuild) {
33109 if (this.object && !rebuild)
33110 return this.object;
33111 var enm = new ProtoBuf.Builder.Enum(),
33112 values = this.getChildren(Enum.Value);
33113 for (var i=0, k=values.length; i<k; ++i)
33114 enm[values[i]['name']] = values[i]['id'];
33115 if (Object.defineProperty)
33116 Object.defineProperty(enm, '$options', {
33117 "value": this.buildOpt(),
33118 "enumerable": false
33119 });
33120 return this.object = enm;
33121 };
33122
33123 /**
33124 * @alias ProtoBuf.Reflect.Enum
33125 * @expose
33126 */
33127 Reflect.Enum = Enum;
33128
33129 /**
33130 * Constructs a new Enum Value.
33131 * @exports ProtoBuf.Reflect.Enum.Value
33132 * @param {!ProtoBuf.Builder} builder Builder reference
33133 * @param {!ProtoBuf.Reflect.Enum} enm Enum reference
33134 * @param {string} name Field name
33135 * @param {number} id Unique field id
33136 * @constructor
33137 * @extends ProtoBuf.Reflect.T
33138 */
33139 var Value = function(builder, enm, name, id) {
33140 T.call(this, builder, enm, name);
33141
33142 /**
33143 * @override
33144 */
33145 this.className = "Enum.Value";
33146
33147 /**
33148 * Unique enum value id.
33149 * @type {number}
33150 * @expose
33151 */
33152 this.id = id;
33153 };
33154
33155 // Extends T
33156 Value.prototype = Object.create(T.prototype);
33157
33158 /**
33159 * @alias ProtoBuf.Reflect.Enum.Value
33160 * @expose
33161 */
33162 Reflect.Enum.Value = Value;
33163
33164 /**
33165 * An extension (field).
33166 * @exports ProtoBuf.Reflect.Extension
33167 * @constructor
33168 * @param {!ProtoBuf.Builder} builder Builder reference
33169 * @param {!ProtoBuf.Reflect.T} parent Parent object
33170 * @param {string} name Object name
33171 * @param {!ProtoBuf.Reflect.Message.Field} field Extension field
33172 */
33173 var Extension = function(builder, parent, name, field) {
33174 T.call(this, builder, parent, name);
33175
33176 /**
33177 * Extended message field.
33178 * @type {!ProtoBuf.Reflect.Message.Field}
33179 * @expose
33180 */
33181 this.field = field;
33182 };
33183
33184 // Extends T
33185 Extension.prototype = Object.create(T.prototype);
33186
33187 /**
33188 * @alias ProtoBuf.Reflect.Extension
33189 * @expose
33190 */
33191 Reflect.Extension = Extension;
33192
33193 /**
33194 * Constructs a new Service.
33195 * @exports ProtoBuf.Reflect.Service
33196 * @param {!ProtoBuf.Builder} builder Builder reference
33197 * @param {!ProtoBuf.Reflect.Namespace} root Root
33198 * @param {string} name Service name
33199 * @param {Object.<string,*>=} options Options
33200 * @constructor
33201 * @extends ProtoBuf.Reflect.Namespace
33202 */
33203 var Service = function(builder, root, name, options) {
33204 Namespace.call(this, builder, root, name, options);
33205
33206 /**
33207 * @override
33208 */
33209 this.className = "Service";
33210
33211 /**
33212 * Built runtime service class.
33213 * @type {?function(new:ProtoBuf.Builder.Service)}
33214 */
33215 this.clazz = null;
33216 };
33217
33218 /**
33219 * @alias ProtoBuf.Reflect.Service.prototype
33220 * @inner
33221 */
33222 var ServicePrototype = Service.prototype = Object.create(Namespace.prototype);
33223
33224 /**
33225 * Builds the service and returns the runtime counterpart, which is a fully functional class.
33226 * @see ProtoBuf.Builder.Service
33227 * @param {boolean=} rebuild Whether to rebuild or not
33228 * @return {Function} Service class
33229 * @throws {Error} If the message cannot be built
33230 * @expose
33231 */
33232 ServicePrototype.build = function(rebuild) {
33233 if (this.clazz && !rebuild)
33234 return this.clazz;
33235
33236 // Create the runtime Service class in its own scope
33237 return this.clazz = (function(ProtoBuf, T) {
33238
33239 /**
33240 * Constructs a new runtime Service.
33241 * @name ProtoBuf.Builder.Service
33242 * @param {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))=} rpcImpl RPC implementation receiving the method name and the message
33243 * @class Barebone of all runtime services.
33244 * @constructor
33245 * @throws {Error} If the service cannot be created
33246 */
33247 var Service = function(rpcImpl) {
33248 ProtoBuf.Builder.Service.call(this);
33249
33250 /**
33251 * Service implementation.
33252 * @name ProtoBuf.Builder.Service#rpcImpl
33253 * @type {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))}
33254 * @expose
33255 */
33256 this.rpcImpl = rpcImpl || function(name, msg, callback) {
33257 // This is what a user has to implement: A function receiving the method name, the actual message to
33258 // send (type checked) and the callback that's either provided with the error as its first
33259 // argument or null and the actual response message.
33260 setTimeout(callback.bind(this, Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")), 0); // Must be async!
33261 };
33262 };
33263
33264 /**
33265 * @alias ProtoBuf.Builder.Service.prototype
33266 * @inner
33267 */
33268 var ServicePrototype = Service.prototype = Object.create(ProtoBuf.Builder.Service.prototype);
33269
33270 /**
33271 * Asynchronously performs an RPC call using the given RPC implementation.
33272 * @name ProtoBuf.Builder.Service.[Method]
33273 * @function
33274 * @param {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} rpcImpl RPC implementation
33275 * @param {ProtoBuf.Builder.Message} req Request
33276 * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
33277 * the error if any and the response either as a pre-parsed message or as its raw bytes
33278 * @abstract
33279 */
33280
33281 /**
33282 * Asynchronously performs an RPC call using the instance's RPC implementation.
33283 * @name ProtoBuf.Builder.Service#[Method]
33284 * @function
33285 * @param {ProtoBuf.Builder.Message} req Request
33286 * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
33287 * the error if any and the response either as a pre-parsed message or as its raw bytes
33288 * @abstract
33289 */
33290
33291 var rpc = T.getChildren(ProtoBuf.Reflect.Service.RPCMethod);
33292 for (var i=0; i<rpc.length; i++) {
33293 (function(method) {
33294
33295 // service#Method(message, callback)
33296 ServicePrototype[method.name] = function(req, callback) {
33297 try {
33298 try {
33299 // If given as a buffer, decode the request. Will throw a TypeError if not a valid buffer.
33300 req = method.resolvedRequestType.clazz.decode(ByteBuffer.wrap(req));
33301 } catch (err) {
33302 if (!(err instanceof TypeError))
33303 throw err;
33304 }
33305 if (req === null || typeof req !== 'object')
33306 throw Error("Illegal arguments");
33307 if (!(req instanceof method.resolvedRequestType.clazz))
33308 req = new method.resolvedRequestType.clazz(req);
33309 this.rpcImpl(method.fqn(), req, function(err, res) { // Assumes that this is properly async
33310 if (err) {
33311 callback(err);
33312 return;
33313 }
33314 // Coalesce to empty string when service response has empty content
33315 if (res === null)
33316 res = ''
33317 try { res = method.resolvedResponseType.clazz.decode(res); } catch (notABuffer) {}
33318 if (!res || !(res instanceof method.resolvedResponseType.clazz)) {
33319 callback(Error("Illegal response type received in service method "+ T.name+"#"+method.name));
33320 return;
33321 }
33322 callback(null, res);
33323 });
33324 } catch (err) {
33325 setTimeout(callback.bind(this, err), 0);
33326 }
33327 };
33328
33329 // Service.Method(rpcImpl, message, callback)
33330 Service[method.name] = function(rpcImpl, req, callback) {
33331 new Service(rpcImpl)[method.name](req, callback);
33332 };
33333
33334 if (Object.defineProperty)
33335 Object.defineProperty(Service[method.name], "$options", { "value": method.buildOpt() }),
33336 Object.defineProperty(ServicePrototype[method.name], "$options", { "value": Service[method.name]["$options"] });
33337 })(rpc[i]);
33338 }
33339
33340 // Properties
33341
33342 /**
33343 * Service options.
33344 * @name ProtoBuf.Builder.Service.$options
33345 * @type {Object.<string,*>}
33346 * @expose
33347 */
33348 var $optionsS; // cc needs this
33349
33350 /**
33351 * Service options.
33352 * @name ProtoBuf.Builder.Service#$options
33353 * @type {Object.<string,*>}
33354 * @expose
33355 */
33356 var $options;
33357
33358 /**
33359 * Reflection type.
33360 * @name ProtoBuf.Builder.Service.$type
33361 * @type {!ProtoBuf.Reflect.Service}
33362 * @expose
33363 */
33364 var $typeS;
33365
33366 /**
33367 * Reflection type.
33368 * @name ProtoBuf.Builder.Service#$type
33369 * @type {!ProtoBuf.Reflect.Service}
33370 * @expose
33371 */
33372 var $type;
33373
33374 if (Object.defineProperty)
33375 Object.defineProperty(Service, "$options", { "value": T.buildOpt() }),
33376 Object.defineProperty(ServicePrototype, "$options", { "value": Service["$options"] }),
33377 Object.defineProperty(Service, "$type", { "value": T }),
33378 Object.defineProperty(ServicePrototype, "$type", { "value": T });
33379
33380 return Service;
33381
33382 })(ProtoBuf, this);
33383 };
33384
33385 /**
33386 * @alias ProtoBuf.Reflect.Service
33387 * @expose
33388 */
33389 Reflect.Service = Service;
33390
33391 /**
33392 * Abstract service method.
33393 * @exports ProtoBuf.Reflect.Service.Method
33394 * @param {!ProtoBuf.Builder} builder Builder reference
33395 * @param {!ProtoBuf.Reflect.Service} svc Service
33396 * @param {string} name Method name
33397 * @param {Object.<string,*>=} options Options
33398 * @constructor
33399 * @extends ProtoBuf.Reflect.T
33400 */
33401 var Method = function(builder, svc, name, options) {
33402 T.call(this, builder, svc, name);
33403
33404 /**
33405 * @override
33406 */
33407 this.className = "Service.Method";
33408
33409 /**
33410 * Options.
33411 * @type {Object.<string, *>}
33412 * @expose
33413 */
33414 this.options = options || {};
33415 };
33416
33417 /**
33418 * @alias ProtoBuf.Reflect.Service.Method.prototype
33419 * @inner
33420 */
33421 var MethodPrototype = Method.prototype = Object.create(T.prototype);
33422
33423 /**
33424 * Builds the method's '$options' property.
33425 * @name ProtoBuf.Reflect.Service.Method#buildOpt
33426 * @function
33427 * @return {Object.<string,*>}
33428 */
33429 MethodPrototype.buildOpt = NamespacePrototype.buildOpt;
33430
33431 /**
33432 * @alias ProtoBuf.Reflect.Service.Method
33433 * @expose
33434 */
33435 Reflect.Service.Method = Method;
33436
33437 /**
33438 * RPC service method.
33439 * @exports ProtoBuf.Reflect.Service.RPCMethod
33440 * @param {!ProtoBuf.Builder} builder Builder reference
33441 * @param {!ProtoBuf.Reflect.Service} svc Service
33442 * @param {string} name Method name
33443 * @param {string} request Request message name
33444 * @param {string} response Response message name
33445 * @param {boolean} request_stream Whether requests are streamed
33446 * @param {boolean} response_stream Whether responses are streamed
33447 * @param {Object.<string,*>=} options Options
33448 * @constructor
33449 * @extends ProtoBuf.Reflect.Service.Method
33450 */
33451 var RPCMethod = function(builder, svc, name, request, response, request_stream, response_stream, options) {
33452 Method.call(this, builder, svc, name, options);
33453
33454 /**
33455 * @override
33456 */
33457 this.className = "Service.RPCMethod";
33458
33459 /**
33460 * Request message name.
33461 * @type {string}
33462 * @expose
33463 */
33464 this.requestName = request;
33465
33466 /**
33467 * Response message name.
33468 * @type {string}
33469 * @expose
33470 */
33471 this.responseName = response;
33472
33473 /**
33474 * Whether requests are streamed
33475 * @type {bool}
33476 * @expose
33477 */
33478 this.requestStream = request_stream;
33479
33480 /**
33481 * Whether responses are streamed
33482 * @type {bool}
33483 * @expose
33484 */
33485 this.responseStream = response_stream;
33486
33487 /**
33488 * Resolved request message type.
33489 * @type {ProtoBuf.Reflect.Message}
33490 * @expose
33491 */
33492 this.resolvedRequestType = null;
33493
33494 /**
33495 * Resolved response message type.
33496 * @type {ProtoBuf.Reflect.Message}
33497 * @expose
33498 */
33499 this.resolvedResponseType = null;
33500 };
33501
33502 // Extends Method
33503 RPCMethod.prototype = Object.create(Method.prototype);
33504
33505 /**
33506 * @alias ProtoBuf.Reflect.Service.RPCMethod
33507 * @expose
33508 */
33509 Reflect.Service.RPCMethod = RPCMethod;
33510
33511 return Reflect;
33512
33513 })(ProtoBuf);
33514
33515 /**
33516 * @alias ProtoBuf.Builder
33517 * @expose
33518 */
33519 ProtoBuf.Builder = (function(ProtoBuf, Lang, Reflect) {
33520 "use strict";
33521
33522 /**
33523 * Constructs a new Builder.
33524 * @exports ProtoBuf.Builder
33525 * @class Provides the functionality to build protocol messages.
33526 * @param {Object.<string,*>=} options Options
33527 * @constructor
33528 */
33529 var Builder = function(options) {
33530
33531 /**
33532 * Namespace.
33533 * @type {ProtoBuf.Reflect.Namespace}
33534 * @expose
33535 */
33536 this.ns = new Reflect.Namespace(this, null, ""); // Global namespace
33537
33538 /**
33539 * Namespace pointer.
33540 * @type {ProtoBuf.Reflect.T}
33541 * @expose
33542 */
33543 this.ptr = this.ns;
33544
33545 /**
33546 * Resolved flag.
33547 * @type {boolean}
33548 * @expose
33549 */
33550 this.resolved = false;
33551
33552 /**
33553 * The current building result.
33554 * @type {Object.<string,ProtoBuf.Builder.Message|Object>|null}
33555 * @expose
33556 */
33557 this.result = null;
33558
33559 /**
33560 * Imported files.
33561 * @type {Array.<string>}
33562 * @expose
33563 */
33564 this.files = {};
33565
33566 /**
33567 * Import root override.
33568 * @type {?string}
33569 * @expose
33570 */
33571 this.importRoot = null;
33572
33573 /**
33574 * Options.
33575 * @type {!Object.<string, *>}
33576 * @expose
33577 */
33578 this.options = options || {};
33579 };
33580
33581 /**
33582 * @alias ProtoBuf.Builder.prototype
33583 * @inner
33584 */
33585 var BuilderPrototype = Builder.prototype;
33586
33587 // ----- Definition tests -----
33588
33589 /**
33590 * Tests if a definition most likely describes a message.
33591 * @param {!Object} def
33592 * @returns {boolean}
33593 * @expose
33594 */
33595 Builder.isMessage = function(def) {
33596 // Messages require a string name
33597 if (typeof def["name"] !== 'string')
33598 return false;
33599 // Messages do not contain values (enum) or rpc methods (service)
33600 if (typeof def["values"] !== 'undefined' || typeof def["rpc"] !== 'undefined')
33601 return false;
33602 return true;
33603 };
33604
33605 /**
33606 * Tests if a definition most likely describes a message field.
33607 * @param {!Object} def
33608 * @returns {boolean}
33609 * @expose
33610 */
33611 Builder.isMessageField = function(def) {
33612 // Message fields require a string rule, name and type and an id
33613 if (typeof def["rule"] !== 'string' || typeof def["name"] !== 'string' || typeof def["type"] !== 'string' || typeof def["id"] === 'undefined')
33614 return false;
33615 return true;
33616 };
33617
33618 /**
33619 * Tests if a definition most likely describes an enum.
33620 * @param {!Object} def
33621 * @returns {boolean}
33622 * @expose
33623 */
33624 Builder.isEnum = function(def) {
33625 // Enums require a string name
33626 if (typeof def["name"] !== 'string')
33627 return false;
33628 // Enums require at least one value
33629 if (typeof def["values"] === 'undefined' || !Array.isArray(def["values"]) || def["values"].length === 0)
33630 return false;
33631 return true;
33632 };
33633
33634 /**
33635 * Tests if a definition most likely describes a service.
33636 * @param {!Object} def
33637 * @returns {boolean}
33638 * @expose
33639 */
33640 Builder.isService = function(def) {
33641 // Services require a string name and an rpc object
33642 if (typeof def["name"] !== 'string' || typeof def["rpc"] !== 'object' || !def["rpc"])
33643 return false;
33644 return true;
33645 };
33646
33647 /**
33648 * Tests if a definition most likely describes an extended message
33649 * @param {!Object} def
33650 * @returns {boolean}
33651 * @expose
33652 */
33653 Builder.isExtend = function(def) {
33654 // Extends rquire a string ref
33655 if (typeof def["ref"] !== 'string')
33656 return false;
33657 return true;
33658 };
33659
33660 // ----- Building -----
33661
33662 /**
33663 * Resets the pointer to the root namespace.
33664 * @returns {!ProtoBuf.Builder} this
33665 * @expose
33666 */
33667 BuilderPrototype.reset = function() {
33668 this.ptr = this.ns;
33669 return this;
33670 };
33671
33672 /**
33673 * Defines a namespace on top of the current pointer position and places the pointer on it.
33674 * @param {string} namespace
33675 * @return {!ProtoBuf.Builder} this
33676 * @expose
33677 */
33678 BuilderPrototype.define = function(namespace) {
33679 if (typeof namespace !== 'string' || !Lang.TYPEREF.test(namespace))
33680 throw Error("illegal namespace: "+namespace);
33681 namespace.split(".").forEach(function(part) {
33682 var ns = this.ptr.getChild(part);
33683 if (ns === null) // Keep existing
33684 this.ptr.addChild(ns = new Reflect.Namespace(this, this.ptr, part));
33685 this.ptr = ns;
33686 }, this);
33687 return this;
33688 };
33689
33690 /**
33691 * Creates the specified definitions at the current pointer position.
33692 * @param {!Array.<!Object>} defs Messages, enums or services to create
33693 * @returns {!ProtoBuf.Builder} this
33694 * @throws {Error} If a message definition is invalid
33695 * @expose
33696 */
33697 BuilderPrototype.create = function(defs) {
33698 if (!defs)
33699 return this; // Nothing to create
33700 if (!Array.isArray(defs))
33701 defs = [defs];
33702 else {
33703 if (defs.length === 0)
33704 return this;
33705 defs = defs.slice();
33706 }
33707
33708 // It's quite hard to keep track of scopes and memory here, so let's do this iteratively.
33709 var stack = [defs];
33710 while (stack.length > 0) {
33711 defs = stack.pop();
33712
33713 if (!Array.isArray(defs)) // Stack always contains entire namespaces
33714 throw Error("not a valid namespace: "+JSON.stringify(defs));
33715
33716 while (defs.length > 0) {
33717 var def = defs.shift(); // Namespaces always contain an array of messages, enums and services
33718
33719 if (Builder.isMessage(def)) {
33720 var obj = new Reflect.Message(this, this.ptr, def["name"], def["options"], def["isGroup"], def["syntax"]);
33721
33722 // Create OneOfs
33723 var oneofs = {};
33724 if (def["oneofs"])
33725 Object.keys(def["oneofs"]).forEach(function(name) {
33726 obj.addChild(oneofs[name] = new Reflect.Message.OneOf(this, obj, name));
33727 }, this);
33728
33729 // Create fields
33730 if (def["fields"])
33731 def["fields"].forEach(function(fld) {
33732 if (obj.getChild(fld["id"]|0) !== null)
33733 throw Error("duplicate or invalid field id in "+obj.name+": "+fld['id']);
33734 if (fld["options"] && typeof fld["options"] !== 'object')
33735 throw Error("illegal field options in "+obj.name+"#"+fld["name"]);
33736 var oneof = null;
33737 if (typeof fld["oneof"] === 'string' && !(oneof = oneofs[fld["oneof"]]))
33738 throw Error("illegal oneof in "+obj.name+"#"+fld["name"]+": "+fld["oneof"]);
33739 fld = new Reflect.Message.Field(this, obj, fld["rule"], fld["keytype"], fld["type"], fld["name"], fld["id"], fld["options"], oneof, def["syntax"]);
33740 if (oneof)
33741 oneof.fields.push(fld);
33742 obj.addChild(fld);
33743 }, this);
33744
33745 // Push children to stack
33746 var subObj = [];
33747 if (def["enums"])
33748 def["enums"].forEach(function(enm) {
33749 subObj.push(enm);
33750 });
33751 if (def["messages"])
33752 def["messages"].forEach(function(msg) {
33753 subObj.push(msg);
33754 });
33755 if (def["services"])
33756 def["services"].forEach(function(svc) {
33757 subObj.push(svc);
33758 });
33759
33760 // Set extension ranges
33761 if (def["extensions"]) {
33762 if (typeof def["extensions"][0] === 'number') // pre 5.0.1
33763 obj.extensions = [ def["extensions"] ];
33764 else
33765 obj.extensions = def["extensions"];
33766 }
33767
33768 // Create on top of current namespace
33769 this.ptr.addChild(obj);
33770 if (subObj.length > 0) {
33771 stack.push(defs); // Push the current level back
33772 defs = subObj; // Continue processing sub level
33773 subObj = null;
33774 this.ptr = obj; // And move the pointer to this namespace
33775 obj = null;
33776 continue;
33777 }
33778 subObj = null;
33779
33780 } else if (Builder.isEnum(def)) {
33781
33782 obj = new Reflect.Enum(this, this.ptr, def["name"], def["options"], def["syntax"]);
33783 def["values"].forEach(function(val) {
33784 obj.addChild(new Reflect.Enum.Value(this, obj, val["name"], val["id"]));
33785 }, this);
33786 this.ptr.addChild(obj);
33787
33788 } else if (Builder.isService(def)) {
33789
33790 obj = new Reflect.Service(this, this.ptr, def["name"], def["options"]);
33791 Object.keys(def["rpc"]).forEach(function(name) {
33792 var mtd = def["rpc"][name];
33793 obj.addChild(new Reflect.Service.RPCMethod(this, obj, name, mtd["request"], mtd["response"], !!mtd["request_stream"], !!mtd["response_stream"], mtd["options"]));
33794 }, this);
33795 this.ptr.addChild(obj);
33796
33797 } else if (Builder.isExtend(def)) {
33798
33799 obj = this.ptr.resolve(def["ref"], true);
33800 if (obj) {
33801 def["fields"].forEach(function(fld) {
33802 if (obj.getChild(fld['id']|0) !== null)
33803 throw Error("duplicate extended field id in "+obj.name+": "+fld['id']);
33804 // Check if field id is allowed to be extended
33805 if (obj.extensions) {
33806 var valid = false;
33807 obj.extensions.forEach(function(range) {
33808 if (fld["id"] >= range[0] && fld["id"] <= range[1])
33809 valid = true;
33810 });
33811 if (!valid)
33812 throw Error("illegal extended field id in "+obj.name+": "+fld['id']+" (not within valid ranges)");
33813 }
33814 // Convert extension field names to camel case notation if the override is set
33815 var name = fld["name"];
33816 if (this.options['convertFieldsToCamelCase'])
33817 name = ProtoBuf.Util.toCamelCase(name);
33818 // see #161: Extensions use their fully qualified name as their runtime key and...
33819 var field = new Reflect.Message.ExtensionField(this, obj, fld["rule"], fld["type"], this.ptr.fqn()+'.'+name, fld["id"], fld["options"]);
33820 // ...are added on top of the current namespace as an extension which is used for
33821 // resolving their type later on (the extension always keeps the original name to
33822 // prevent naming collisions)
33823 var ext = new Reflect.Extension(this, this.ptr, fld["name"], field);
33824 field.extension = ext;
33825 this.ptr.addChild(ext);
33826 obj.addChild(field);
33827 }, this);
33828
33829 } else if (!/\.?google\.protobuf\./.test(def["ref"])) // Silently skip internal extensions
33830 throw Error("extended message "+def["ref"]+" is not defined");
33831
33832 } else
33833 throw Error("not a valid definition: "+JSON.stringify(def));
33834
33835 def = null;
33836 obj = null;
33837 }
33838 // Break goes here
33839 defs = null;
33840 this.ptr = this.ptr.parent; // Namespace done, continue at parent
33841 }
33842 this.resolved = false; // Require re-resolve
33843 this.result = null; // Require re-build
33844 return this;
33845 };
33846
33847 /**
33848 * Propagates syntax to all children.
33849 * @param {!Object} parent
33850 * @inner
33851 */
33852 function propagateSyntax(parent) {
33853 if (parent['messages']) {
33854 parent['messages'].forEach(function(child) {
33855 child["syntax"] = parent["syntax"];
33856 propagateSyntax(child);
33857 });
33858 }
33859 if (parent['enums']) {
33860 parent['enums'].forEach(function(child) {
33861 child["syntax"] = parent["syntax"];
33862 });
33863 }
33864 }
33865
33866 /**
33867 * Imports another definition into this builder.
33868 * @param {Object.<string,*>} json Parsed import
33869 * @param {(string|{root: string, file: string})=} filename Imported file name
33870 * @returns {!ProtoBuf.Builder} this
33871 * @throws {Error} If the definition or file cannot be imported
33872 * @expose
33873 */
33874 BuilderPrototype["import"] = function(json, filename) {
33875 var delim = '/';
33876
33877 // Make sure to skip duplicate imports
33878
33879 if (typeof filename === 'string') {
33880
33881 if (ProtoBuf.Util.IS_NODE)
33882 filename = __webpack_require__(116)['resolve'](filename);
33883 if (this.files[filename] === true)
33884 return this.reset();
33885 this.files[filename] = true;
33886
33887 } else if (typeof filename === 'object') { // Object with root, file.
33888
33889 var root = filename.root;
33890 if (ProtoBuf.Util.IS_NODE)
33891 root = __webpack_require__(116)['resolve'](root);
33892 if (root.indexOf("\\") >= 0 || filename.file.indexOf("\\") >= 0)
33893 delim = '\\';
33894 var fname;
33895 if (ProtoBuf.Util.IS_NODE)
33896 fname = __webpack_require__(116)['join'](root, filename.file);
33897 else
33898 fname = root + delim + filename.file;
33899 if (this.files[fname] === true)
33900 return this.reset();
33901 this.files[fname] = true;
33902 }
33903
33904 // Import imports
33905
33906 if (json['imports'] && json['imports'].length > 0) {
33907 var importRoot,
33908 resetRoot = false;
33909
33910 if (typeof filename === 'object') { // If an import root is specified, override
33911
33912 this.importRoot = filename["root"]; resetRoot = true; // ... and reset afterwards
33913 importRoot = this.importRoot;
33914 filename = filename["file"];
33915 if (importRoot.indexOf("\\") >= 0 || filename.indexOf("\\") >= 0)
33916 delim = '\\';
33917
33918 } else if (typeof filename === 'string') {
33919
33920 if (this.importRoot) // If import root is overridden, use it
33921 importRoot = this.importRoot;
33922 else { // Otherwise compute from filename
33923 if (filename.indexOf("/") >= 0) { // Unix
33924 importRoot = filename.replace(/\/[^\/]*$/, "");
33925 if (/* /file.proto */ importRoot === "")
33926 importRoot = "/";
33927 } else if (filename.indexOf("\\") >= 0) { // Windows
33928 importRoot = filename.replace(/\\[^\\]*$/, "");
33929 delim = '\\';
33930 } else
33931 importRoot = ".";
33932 }
33933
33934 } else
33935 importRoot = null;
33936
33937 for (var i=0; i<json['imports'].length; i++) {
33938 if (typeof json['imports'][i] === 'string') { // Import file
33939 if (!importRoot)
33940 throw Error("cannot determine import root");
33941 var importFilename = json['imports'][i];
33942 if (importFilename === "google/protobuf/descriptor.proto")
33943 continue; // Not needed and therefore not used
33944 if (ProtoBuf.Util.IS_NODE)
33945 importFilename = __webpack_require__(116)['join'](importRoot, importFilename);
33946 else
33947 importFilename = importRoot + delim + importFilename;
33948 if (this.files[importFilename] === true)
33949 continue; // Already imported
33950 if (/\.proto$/i.test(importFilename) && !ProtoBuf.DotProto) // If this is a light build
33951 importFilename = importFilename.replace(/\.proto$/, ".json"); // always load the JSON file
33952 var contents = ProtoBuf.Util.fetch(importFilename);
33953 if (contents === null)
33954 throw Error("failed to import '"+importFilename+"' in '"+filename+"': file not found");
33955 if (/\.json$/i.test(importFilename)) // Always possible
33956 this["import"](JSON.parse(contents+""), importFilename); // May throw
33957 else
33958 this["import"](ProtoBuf.DotProto.Parser.parse(contents), importFilename); // May throw
33959 } else // Import structure
33960 if (!filename)
33961 this["import"](json['imports'][i]);
33962 else if (/\.(\w+)$/.test(filename)) // With extension: Append _importN to the name portion to make it unique
33963 this["import"](json['imports'][i], filename.replace(/^(.+)\.(\w+)$/, function($0, $1, $2) { return $1+"_import"+i+"."+$2; }));
33964 else // Without extension: Append _importN to make it unique
33965 this["import"](json['imports'][i], filename+"_import"+i);
33966 }
33967 if (resetRoot) // Reset import root override when all imports are done
33968 this.importRoot = null;
33969 }
33970
33971 // Import structures
33972
33973 if (json['package'])
33974 this.define(json['package']);
33975 if (json['syntax'])
33976 propagateSyntax(json);
33977 var base = this.ptr;
33978 if (json['options'])
33979 Object.keys(json['options']).forEach(function(key) {
33980 base.options[key] = json['options'][key];
33981 });
33982 if (json['messages'])
33983 this.create(json['messages']),
33984 this.ptr = base;
33985 if (json['enums'])
33986 this.create(json['enums']),
33987 this.ptr = base;
33988 if (json['services'])
33989 this.create(json['services']),
33990 this.ptr = base;
33991 if (json['extends'])
33992 this.create(json['extends']);
33993
33994 return this.reset();
33995 };
33996
33997 /**
33998 * Resolves all namespace objects.
33999 * @throws {Error} If a type cannot be resolved
34000 * @returns {!ProtoBuf.Builder} this
34001 * @expose
34002 */
34003 BuilderPrototype.resolveAll = function() {
34004 // Resolve all reflected objects
34005 var res;
34006 if (this.ptr == null || typeof this.ptr.type === 'object')
34007 return this; // Done (already resolved)
34008
34009 if (this.ptr instanceof Reflect.Namespace) { // Resolve children
34010
34011 this.ptr.children.forEach(function(child) {
34012 this.ptr = child;
34013 this.resolveAll();
34014 }, this);
34015
34016 } else if (this.ptr instanceof Reflect.Message.Field) { // Resolve type
34017
34018 if (!Lang.TYPE.test(this.ptr.type)) {
34019 if (!Lang.TYPEREF.test(this.ptr.type))
34020 throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
34021 res = (this.ptr instanceof Reflect.Message.ExtensionField ? this.ptr.extension.parent : this.ptr.parent).resolve(this.ptr.type, true);
34022 if (!res)
34023 throw Error("unresolvable type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
34024 this.ptr.resolvedType = res;
34025 if (res instanceof Reflect.Enum) {
34026 this.ptr.type = ProtoBuf.TYPES["enum"];
34027 if (this.ptr.syntax === 'proto3' && res.syntax !== 'proto3')
34028 throw Error("proto3 message cannot reference proto2 enum");
34029 }
34030 else if (res instanceof Reflect.Message)
34031 this.ptr.type = res.isGroup ? ProtoBuf.TYPES["group"] : ProtoBuf.TYPES["message"];
34032 else
34033 throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
34034 } else
34035 this.ptr.type = ProtoBuf.TYPES[this.ptr.type];
34036
34037 // If it's a map field, also resolve the key type. The key type can be only a numeric, string, or bool type
34038 // (i.e., no enums or messages), so we don't need to resolve against the current namespace.
34039 if (this.ptr.map) {
34040 if (!Lang.TYPE.test(this.ptr.keyType))
34041 throw Error("illegal key type for map field in "+this.ptr.toString(true)+": "+this.ptr.keyType);
34042 this.ptr.keyType = ProtoBuf.TYPES[this.ptr.keyType];
34043 }
34044
34045 // If it's a repeated and packable field then proto3 mandates it should be packed by
34046 // default
34047 if (
34048 this.ptr.syntax === 'proto3' &&
34049 this.ptr.repeated && this.ptr.options.packed === undefined &&
34050 ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.ptr.type.wireType) !== -1
34051 ) {
34052 this.ptr.options.packed = true;
34053 }
34054
34055 } else if (this.ptr instanceof ProtoBuf.Reflect.Service.Method) {
34056
34057 if (this.ptr instanceof ProtoBuf.Reflect.Service.RPCMethod) {
34058 res = this.ptr.parent.resolve(this.ptr.requestName, true);
34059 if (!res || !(res instanceof ProtoBuf.Reflect.Message))
34060 throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.requestName);
34061 this.ptr.resolvedRequestType = res;
34062 res = this.ptr.parent.resolve(this.ptr.responseName, true);
34063 if (!res || !(res instanceof ProtoBuf.Reflect.Message))
34064 throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.responseName);
34065 this.ptr.resolvedResponseType = res;
34066 } else // Should not happen as nothing else is implemented
34067 throw Error("illegal service type in "+this.ptr.toString(true));
34068
34069 } else if (
34070 !(this.ptr instanceof ProtoBuf.Reflect.Message.OneOf) && // Not built
34071 !(this.ptr instanceof ProtoBuf.Reflect.Extension) && // Not built
34072 !(this.ptr instanceof ProtoBuf.Reflect.Enum.Value) // Built in enum
34073 )
34074 throw Error("illegal object in namespace: "+typeof(this.ptr)+": "+this.ptr);
34075
34076 return this.reset();
34077 };
34078
34079 /**
34080 * Builds the protocol. This will first try to resolve all definitions and, if this has been successful,
34081 * return the built package.
34082 * @param {(string|Array.<string>)=} path Specifies what to return. If omitted, the entire namespace will be returned.
34083 * @returns {!ProtoBuf.Builder.Message|!Object.<string,*>}
34084 * @throws {Error} If a type could not be resolved
34085 * @expose
34086 */
34087 BuilderPrototype.build = function(path) {
34088 this.reset();
34089 if (!this.resolved)
34090 this.resolveAll(),
34091 this.resolved = true,
34092 this.result = null; // Require re-build
34093 if (this.result === null) // (Re-)Build
34094 this.result = this.ns.build();
34095 if (!path)
34096 return this.result;
34097 var part = typeof path === 'string' ? path.split(".") : path,
34098 ptr = this.result; // Build namespace pointer (no hasChild etc.)
34099 for (var i=0; i<part.length; i++)
34100 if (ptr[part[i]])
34101 ptr = ptr[part[i]];
34102 else {
34103 ptr = null;
34104 break;
34105 }
34106 return ptr;
34107 };
34108
34109 /**
34110 * Similar to {@link ProtoBuf.Builder#build}, but looks up the internal reflection descriptor.
34111 * @param {string=} path Specifies what to return. If omitted, the entire namespace wiil be returned.
34112 * @param {boolean=} excludeNonNamespace Excludes non-namespace types like fields, defaults to `false`
34113 * @returns {?ProtoBuf.Reflect.T} Reflection descriptor or `null` if not found
34114 */
34115 BuilderPrototype.lookup = function(path, excludeNonNamespace) {
34116 return path ? this.ns.resolve(path, excludeNonNamespace) : this.ns;
34117 };
34118
34119 /**
34120 * Returns a string representation of this object.
34121 * @return {string} String representation as of "Builder"
34122 * @expose
34123 */
34124 BuilderPrototype.toString = function() {
34125 return "Builder";
34126 };
34127
34128 // ----- Base classes -----
34129 // Exist for the sole purpose of being able to "... instanceof ProtoBuf.Builder.Message" etc.
34130
34131 /**
34132 * @alias ProtoBuf.Builder.Message
34133 */
34134 Builder.Message = function() {};
34135
34136 /**
34137 * @alias ProtoBuf.Builder.Enum
34138 */
34139 Builder.Enum = function() {};
34140
34141 /**
34142 * @alias ProtoBuf.Builder.Message
34143 */
34144 Builder.Service = function() {};
34145
34146 return Builder;
34147
34148 })(ProtoBuf, ProtoBuf.Lang, ProtoBuf.Reflect);
34149
34150 /**
34151 * @alias ProtoBuf.Map
34152 * @expose
34153 */
34154 ProtoBuf.Map = (function(ProtoBuf, Reflect) {
34155 "use strict";
34156
34157 /**
34158 * Constructs a new Map. A Map is a container that is used to implement map
34159 * fields on message objects. It closely follows the ES6 Map API; however,
34160 * it is distinct because we do not want to depend on external polyfills or
34161 * on ES6 itself.
34162 *
34163 * @exports ProtoBuf.Map
34164 * @param {!ProtoBuf.Reflect.Field} field Map field
34165 * @param {Object.<string,*>=} contents Initial contents
34166 * @constructor
34167 */
34168 var Map = function(field, contents) {
34169 if (!field.map)
34170 throw Error("field is not a map");
34171
34172 /**
34173 * The field corresponding to this map.
34174 * @type {!ProtoBuf.Reflect.Field}
34175 */
34176 this.field = field;
34177
34178 /**
34179 * Element instance corresponding to key type.
34180 * @type {!ProtoBuf.Reflect.Element}
34181 */
34182 this.keyElem = new Reflect.Element(field.keyType, null, true, field.syntax);
34183
34184 /**
34185 * Element instance corresponding to value type.
34186 * @type {!ProtoBuf.Reflect.Element}
34187 */
34188 this.valueElem = new Reflect.Element(field.type, field.resolvedType, false, field.syntax);
34189
34190 /**
34191 * Internal map: stores mapping of (string form of key) -> (key, value)
34192 * pair.
34193 *
34194 * We provide map semantics for arbitrary key types, but we build on top
34195 * of an Object, which has only string keys. In order to avoid the need
34196 * to convert a string key back to its native type in many situations,
34197 * we store the native key value alongside the value. Thus, we only need
34198 * a one-way mapping from a key type to its string form that guarantees
34199 * uniqueness and equality (i.e., str(K1) === str(K2) if and only if K1
34200 * === K2).
34201 *
34202 * @type {!Object<string, {key: *, value: *}>}
34203 */
34204 this.map = {};
34205
34206 /**
34207 * Returns the number of elements in the map.
34208 */
34209 Object.defineProperty(this, "size", {
34210 get: function() { return Object.keys(this.map).length; }
34211 });
34212
34213 // Fill initial contents from a raw object.
34214 if (contents) {
34215 var keys = Object.keys(contents);
34216 for (var i = 0; i < keys.length; i++) {
34217 var key = this.keyElem.valueFromString(keys[i]);
34218 var val = this.valueElem.verifyValue(contents[keys[i]]);
34219 this.map[this.keyElem.valueToString(key)] =
34220 { key: key, value: val };
34221 }
34222 }
34223 };
34224
34225 var MapPrototype = Map.prototype;
34226
34227 /**
34228 * Helper: return an iterator over an array.
34229 * @param {!Array<*>} arr the array
34230 * @returns {!Object} an iterator
34231 * @inner
34232 */
34233 function arrayIterator(arr) {
34234 var idx = 0;
34235 return {
34236 next: function() {
34237 if (idx < arr.length)
34238 return { done: false, value: arr[idx++] };
34239 return { done: true };
34240 }
34241 }
34242 }
34243
34244 /**
34245 * Clears the map.
34246 */
34247 MapPrototype.clear = function() {
34248 this.map = {};
34249 };
34250
34251 /**
34252 * Deletes a particular key from the map.
34253 * @returns {boolean} Whether any entry with this key was deleted.
34254 */
34255 MapPrototype["delete"] = function(key) {
34256 var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
34257 var hadKey = keyValue in this.map;
34258 delete this.map[keyValue];
34259 return hadKey;
34260 };
34261
34262 /**
34263 * Returns an iterator over [key, value] pairs in the map.
34264 * @returns {Object} The iterator
34265 */
34266 MapPrototype.entries = function() {
34267 var entries = [];
34268 var strKeys = Object.keys(this.map);
34269 for (var i = 0, entry; i < strKeys.length; i++)
34270 entries.push([(entry=this.map[strKeys[i]]).key, entry.value]);
34271 return arrayIterator(entries);
34272 };
34273
34274 /**
34275 * Returns an iterator over keys in the map.
34276 * @returns {Object} The iterator
34277 */
34278 MapPrototype.keys = function() {
34279 var keys = [];
34280 var strKeys = Object.keys(this.map);
34281 for (var i = 0; i < strKeys.length; i++)
34282 keys.push(this.map[strKeys[i]].key);
34283 return arrayIterator(keys);
34284 };
34285
34286 /**
34287 * Returns an iterator over values in the map.
34288 * @returns {!Object} The iterator
34289 */
34290 MapPrototype.values = function() {
34291 var values = [];
34292 var strKeys = Object.keys(this.map);
34293 for (var i = 0; i < strKeys.length; i++)
34294 values.push(this.map[strKeys[i]].value);
34295 return arrayIterator(values);
34296 };
34297
34298 /**
34299 * Iterates over entries in the map, calling a function on each.
34300 * @param {function(this:*, *, *, *)} cb The callback to invoke with value, key, and map arguments.
34301 * @param {Object=} thisArg The `this` value for the callback
34302 */
34303 MapPrototype.forEach = function(cb, thisArg) {
34304 var strKeys = Object.keys(this.map);
34305 for (var i = 0, entry; i < strKeys.length; i++)
34306 cb.call(thisArg, (entry=this.map[strKeys[i]]).value, entry.key, this);
34307 };
34308
34309 /**
34310 * Sets a key in the map to the given value.
34311 * @param {*} key The key
34312 * @param {*} value The value
34313 * @returns {!ProtoBuf.Map} The map instance
34314 */
34315 MapPrototype.set = function(key, value) {
34316 var keyValue = this.keyElem.verifyValue(key);
34317 var valValue = this.valueElem.verifyValue(value);
34318 this.map[this.keyElem.valueToString(keyValue)] =
34319 { key: keyValue, value: valValue };
34320 return this;
34321 };
34322
34323 /**
34324 * Gets the value corresponding to a key in the map.
34325 * @param {*} key The key
34326 * @returns {*|undefined} The value, or `undefined` if key not present
34327 */
34328 MapPrototype.get = function(key) {
34329 var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
34330 if (!(keyValue in this.map))
34331 return undefined;
34332 return this.map[keyValue].value;
34333 };
34334
34335 /**
34336 * Determines whether the given key is present in the map.
34337 * @param {*} key The key
34338 * @returns {boolean} `true` if the key is present
34339 */
34340 MapPrototype.has = function(key) {
34341 var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
34342 return (keyValue in this.map);
34343 };
34344
34345 return Map;
34346 })(ProtoBuf, ProtoBuf.Reflect);
34347
34348
34349 /**
34350 * Constructs a new empty Builder.
34351 * @param {Object.<string,*>=} options Builder options, defaults to global options set on ProtoBuf
34352 * @return {!ProtoBuf.Builder} Builder
34353 * @expose
34354 */
34355 ProtoBuf.newBuilder = function(options) {
34356 options = options || {};
34357 if (typeof options['convertFieldsToCamelCase'] === 'undefined')
34358 options['convertFieldsToCamelCase'] = ProtoBuf.convertFieldsToCamelCase;
34359 if (typeof options['populateAccessors'] === 'undefined')
34360 options['populateAccessors'] = ProtoBuf.populateAccessors;
34361 return new ProtoBuf.Builder(options);
34362 };
34363
34364 /**
34365 * Loads a .json definition and returns the Builder.
34366 * @param {!*|string} json JSON definition
34367 * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted.
34368 * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.
34369 * @return {ProtoBuf.Builder} Builder to create new messages
34370 * @throws {Error} If the definition cannot be parsed or built
34371 * @expose
34372 */
34373 ProtoBuf.loadJson = function(json, builder, filename) {
34374 if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string'))
34375 filename = builder,
34376 builder = null;
34377 if (!builder || typeof builder !== 'object')
34378 builder = ProtoBuf.newBuilder();
34379 if (typeof json === 'string')
34380 json = JSON.parse(json);
34381 builder["import"](json, filename);
34382 builder.resolveAll();
34383 return builder;
34384 };
34385
34386 /**
34387 * Loads a .json file and returns the Builder.
34388 * @param {string|!{root: string, file: string}} filename Path to json file or an object specifying 'file' with
34389 * an overridden 'root' path for all imported files.
34390 * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and
34391 * the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the
34392 * file will be read synchronously and this function will return the Builder.
34393 * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.
34394 * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the
34395 * request has failed), else undefined
34396 * @expose
34397 */
34398 ProtoBuf.loadJsonFile = function(filename, callback, builder) {
34399 if (callback && typeof callback === 'object')
34400 builder = callback,
34401 callback = null;
34402 else if (!callback || typeof callback !== 'function')
34403 callback = null;
34404 if (callback)
34405 return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) {
34406 if (contents === null) {
34407 callback(Error("Failed to fetch file"));
34408 return;
34409 }
34410 try {
34411 callback(null, ProtoBuf.loadJson(JSON.parse(contents), builder, filename));
34412 } catch (e) {
34413 callback(e);
34414 }
34415 });
34416 var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename);
34417 return contents === null ? null : ProtoBuf.loadJson(JSON.parse(contents), builder, filename);
34418 };
34419
34420 return ProtoBuf;
34421});
34422
34423
34424/***/ }),
34425/* 604 */
34426/***/ (function(module, exports, __webpack_require__) {
34427
34428var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
34429 Copyright 2013-2014 Daniel Wirtz <dcode@dcode.io>
34430
34431 Licensed under the Apache License, Version 2.0 (the "License");
34432 you may not use this file except in compliance with the License.
34433 You may obtain a copy of the License at
34434
34435 http://www.apache.org/licenses/LICENSE-2.0
34436
34437 Unless required by applicable law or agreed to in writing, software
34438 distributed under the License is distributed on an "AS IS" BASIS,
34439 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34440 See the License for the specific language governing permissions and
34441 limitations under the License.
34442 */
34443
34444/**
34445 * @license bytebuffer.js (c) 2015 Daniel Wirtz <dcode@dcode.io>
34446 * Backing buffer: ArrayBuffer, Accessor: Uint8Array
34447 * Released under the Apache License, Version 2.0
34448 * see: https://github.com/dcodeIO/bytebuffer.js for details
34449 */
34450(function(global, factory) {
34451
34452 /* AMD */ if (true)
34453 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(605)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
34454 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
34455 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
34456 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
34457 /* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"])
34458 module['exports'] = (function() {
34459 var Long; try { Long = require("long"); } catch (e) {}
34460 return factory(Long);
34461 })();
34462 /* Global */ else
34463 (global["dcodeIO"] = global["dcodeIO"] || {})["ByteBuffer"] = factory(global["dcodeIO"]["Long"]);
34464
34465})(this, function(Long) {
34466 "use strict";
34467
34468 /**
34469 * Constructs a new ByteBuffer.
34470 * @class The swiss army knife for binary data in JavaScript.
34471 * @exports ByteBuffer
34472 * @constructor
34473 * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
34474 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
34475 * {@link ByteBuffer.DEFAULT_ENDIAN}.
34476 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
34477 * {@link ByteBuffer.DEFAULT_NOASSERT}.
34478 * @expose
34479 */
34480 var ByteBuffer = function(capacity, littleEndian, noAssert) {
34481 if (typeof capacity === 'undefined')
34482 capacity = ByteBuffer.DEFAULT_CAPACITY;
34483 if (typeof littleEndian === 'undefined')
34484 littleEndian = ByteBuffer.DEFAULT_ENDIAN;
34485 if (typeof noAssert === 'undefined')
34486 noAssert = ByteBuffer.DEFAULT_NOASSERT;
34487 if (!noAssert) {
34488 capacity = capacity | 0;
34489 if (capacity < 0)
34490 throw RangeError("Illegal capacity");
34491 littleEndian = !!littleEndian;
34492 noAssert = !!noAssert;
34493 }
34494
34495 /**
34496 * Backing ArrayBuffer.
34497 * @type {!ArrayBuffer}
34498 * @expose
34499 */
34500 this.buffer = capacity === 0 ? EMPTY_BUFFER : new ArrayBuffer(capacity);
34501
34502 /**
34503 * Uint8Array utilized to manipulate the backing buffer. Becomes `null` if the backing buffer has a capacity of `0`.
34504 * @type {?Uint8Array}
34505 * @expose
34506 */
34507 this.view = capacity === 0 ? null : new Uint8Array(this.buffer);
34508
34509 /**
34510 * Absolute read/write offset.
34511 * @type {number}
34512 * @expose
34513 * @see ByteBuffer#flip
34514 * @see ByteBuffer#clear
34515 */
34516 this.offset = 0;
34517
34518 /**
34519 * Marked offset.
34520 * @type {number}
34521 * @expose
34522 * @see ByteBuffer#mark
34523 * @see ByteBuffer#reset
34524 */
34525 this.markedOffset = -1;
34526
34527 /**
34528 * Absolute limit of the contained data. Set to the backing buffer's capacity upon allocation.
34529 * @type {number}
34530 * @expose
34531 * @see ByteBuffer#flip
34532 * @see ByteBuffer#clear
34533 */
34534 this.limit = capacity;
34535
34536 /**
34537 * Whether to use little endian byte order, defaults to `false` for big endian.
34538 * @type {boolean}
34539 * @expose
34540 */
34541 this.littleEndian = littleEndian;
34542
34543 /**
34544 * Whether to skip assertions of offsets and values, defaults to `false`.
34545 * @type {boolean}
34546 * @expose
34547 */
34548 this.noAssert = noAssert;
34549 };
34550
34551 /**
34552 * ByteBuffer version.
34553 * @type {string}
34554 * @const
34555 * @expose
34556 */
34557 ByteBuffer.VERSION = "5.0.1";
34558
34559 /**
34560 * Little endian constant that can be used instead of its boolean value. Evaluates to `true`.
34561 * @type {boolean}
34562 * @const
34563 * @expose
34564 */
34565 ByteBuffer.LITTLE_ENDIAN = true;
34566
34567 /**
34568 * Big endian constant that can be used instead of its boolean value. Evaluates to `false`.
34569 * @type {boolean}
34570 * @const
34571 * @expose
34572 */
34573 ByteBuffer.BIG_ENDIAN = false;
34574
34575 /**
34576 * Default initial capacity of `16`.
34577 * @type {number}
34578 * @expose
34579 */
34580 ByteBuffer.DEFAULT_CAPACITY = 16;
34581
34582 /**
34583 * Default endianess of `false` for big endian.
34584 * @type {boolean}
34585 * @expose
34586 */
34587 ByteBuffer.DEFAULT_ENDIAN = ByteBuffer.BIG_ENDIAN;
34588
34589 /**
34590 * Default no assertions flag of `false`.
34591 * @type {boolean}
34592 * @expose
34593 */
34594 ByteBuffer.DEFAULT_NOASSERT = false;
34595
34596 /**
34597 * A `Long` class for representing a 64-bit two's-complement integer value. May be `null` if Long.js has not been loaded
34598 * and int64 support is not available.
34599 * @type {?Long}
34600 * @const
34601 * @see https://github.com/dcodeIO/long.js
34602 * @expose
34603 */
34604 ByteBuffer.Long = Long || null;
34605
34606 /**
34607 * @alias ByteBuffer.prototype
34608 * @inner
34609 */
34610 var ByteBufferPrototype = ByteBuffer.prototype;
34611
34612 /**
34613 * An indicator used to reliably determine if an object is a ByteBuffer or not.
34614 * @type {boolean}
34615 * @const
34616 * @expose
34617 * @private
34618 */
34619 ByteBufferPrototype.__isByteBuffer__;
34620
34621 Object.defineProperty(ByteBufferPrototype, "__isByteBuffer__", {
34622 value: true,
34623 enumerable: false,
34624 configurable: false
34625 });
34626
34627 // helpers
34628
34629 /**
34630 * @type {!ArrayBuffer}
34631 * @inner
34632 */
34633 var EMPTY_BUFFER = new ArrayBuffer(0);
34634
34635 /**
34636 * String.fromCharCode reference for compile-time renaming.
34637 * @type {function(...number):string}
34638 * @inner
34639 */
34640 var stringFromCharCode = String.fromCharCode;
34641
34642 /**
34643 * Creates a source function for a string.
34644 * @param {string} s String to read from
34645 * @returns {function():number|null} Source function returning the next char code respectively `null` if there are
34646 * no more characters left.
34647 * @throws {TypeError} If the argument is invalid
34648 * @inner
34649 */
34650 function stringSource(s) {
34651 var i=0; return function() {
34652 return i < s.length ? s.charCodeAt(i++) : null;
34653 };
34654 }
34655
34656 /**
34657 * Creates a destination function for a string.
34658 * @returns {function(number=):undefined|string} Destination function successively called with the next char code.
34659 * Returns the final string when called without arguments.
34660 * @inner
34661 */
34662 function stringDestination() {
34663 var cs = [], ps = []; return function() {
34664 if (arguments.length === 0)
34665 return ps.join('')+stringFromCharCode.apply(String, cs);
34666 if (cs.length + arguments.length > 1024)
34667 ps.push(stringFromCharCode.apply(String, cs)),
34668 cs.length = 0;
34669 Array.prototype.push.apply(cs, arguments);
34670 };
34671 }
34672
34673 /**
34674 * Gets the accessor type.
34675 * @returns {Function} `Buffer` under node.js, `Uint8Array` respectively `DataView` in the browser (classes)
34676 * @expose
34677 */
34678 ByteBuffer.accessor = function() {
34679 return Uint8Array;
34680 };
34681 /**
34682 * Allocates a new ByteBuffer backed by a buffer of the specified capacity.
34683 * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
34684 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
34685 * {@link ByteBuffer.DEFAULT_ENDIAN}.
34686 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
34687 * {@link ByteBuffer.DEFAULT_NOASSERT}.
34688 * @returns {!ByteBuffer}
34689 * @expose
34690 */
34691 ByteBuffer.allocate = function(capacity, littleEndian, noAssert) {
34692 return new ByteBuffer(capacity, littleEndian, noAssert);
34693 };
34694
34695 /**
34696 * Concatenates multiple ByteBuffers into one.
34697 * @param {!Array.<!ByteBuffer|!ArrayBuffer|!Uint8Array|string>} buffers Buffers to concatenate
34698 * @param {(string|boolean)=} encoding String encoding if `buffers` contains a string ("base64", "hex", "binary",
34699 * defaults to "utf8")
34700 * @param {boolean=} littleEndian Whether to use little or big endian byte order for the resulting ByteBuffer. Defaults
34701 * to {@link ByteBuffer.DEFAULT_ENDIAN}.
34702 * @param {boolean=} noAssert Whether to skip assertions of offsets and values for the resulting ByteBuffer. Defaults to
34703 * {@link ByteBuffer.DEFAULT_NOASSERT}.
34704 * @returns {!ByteBuffer} Concatenated ByteBuffer
34705 * @expose
34706 */
34707 ByteBuffer.concat = function(buffers, encoding, littleEndian, noAssert) {
34708 if (typeof encoding === 'boolean' || typeof encoding !== 'string') {
34709 noAssert = littleEndian;
34710 littleEndian = encoding;
34711 encoding = undefined;
34712 }
34713 var capacity = 0;
34714 for (var i=0, k=buffers.length, length; i<k; ++i) {
34715 if (!ByteBuffer.isByteBuffer(buffers[i]))
34716 buffers[i] = ByteBuffer.wrap(buffers[i], encoding);
34717 length = buffers[i].limit - buffers[i].offset;
34718 if (length > 0) capacity += length;
34719 }
34720 if (capacity === 0)
34721 return new ByteBuffer(0, littleEndian, noAssert);
34722 var bb = new ByteBuffer(capacity, littleEndian, noAssert),
34723 bi;
34724 i=0; while (i<k) {
34725 bi = buffers[i++];
34726 length = bi.limit - bi.offset;
34727 if (length <= 0) continue;
34728 bb.view.set(bi.view.subarray(bi.offset, bi.limit), bb.offset);
34729 bb.offset += length;
34730 }
34731 bb.limit = bb.offset;
34732 bb.offset = 0;
34733 return bb;
34734 };
34735
34736 /**
34737 * Tests if the specified type is a ByteBuffer.
34738 * @param {*} bb ByteBuffer to test
34739 * @returns {boolean} `true` if it is a ByteBuffer, otherwise `false`
34740 * @expose
34741 */
34742 ByteBuffer.isByteBuffer = function(bb) {
34743 return (bb && bb["__isByteBuffer__"]) === true;
34744 };
34745 /**
34746 * Gets the backing buffer type.
34747 * @returns {Function} `Buffer` under node.js, `ArrayBuffer` in the browser (classes)
34748 * @expose
34749 */
34750 ByteBuffer.type = function() {
34751 return ArrayBuffer;
34752 };
34753 /**
34754 * Wraps a buffer or a string. Sets the allocated ByteBuffer's {@link ByteBuffer#offset} to `0` and its
34755 * {@link ByteBuffer#limit} to the length of the wrapped data.
34756 * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string|!Array.<number>} buffer Anything that can be wrapped
34757 * @param {(string|boolean)=} encoding String encoding if `buffer` is a string ("base64", "hex", "binary", defaults to
34758 * "utf8")
34759 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
34760 * {@link ByteBuffer.DEFAULT_ENDIAN}.
34761 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
34762 * {@link ByteBuffer.DEFAULT_NOASSERT}.
34763 * @returns {!ByteBuffer} A ByteBuffer wrapping `buffer`
34764 * @expose
34765 */
34766 ByteBuffer.wrap = function(buffer, encoding, littleEndian, noAssert) {
34767 if (typeof encoding !== 'string') {
34768 noAssert = littleEndian;
34769 littleEndian = encoding;
34770 encoding = undefined;
34771 }
34772 if (typeof buffer === 'string') {
34773 if (typeof encoding === 'undefined')
34774 encoding = "utf8";
34775 switch (encoding) {
34776 case "base64":
34777 return ByteBuffer.fromBase64(buffer, littleEndian);
34778 case "hex":
34779 return ByteBuffer.fromHex(buffer, littleEndian);
34780 case "binary":
34781 return ByteBuffer.fromBinary(buffer, littleEndian);
34782 case "utf8":
34783 return ByteBuffer.fromUTF8(buffer, littleEndian);
34784 case "debug":
34785 return ByteBuffer.fromDebug(buffer, littleEndian);
34786 default:
34787 throw Error("Unsupported encoding: "+encoding);
34788 }
34789 }
34790 if (buffer === null || typeof buffer !== 'object')
34791 throw TypeError("Illegal buffer");
34792 var bb;
34793 if (ByteBuffer.isByteBuffer(buffer)) {
34794 bb = ByteBufferPrototype.clone.call(buffer);
34795 bb.markedOffset = -1;
34796 return bb;
34797 }
34798 if (buffer instanceof Uint8Array) { // Extract ArrayBuffer from Uint8Array
34799 bb = new ByteBuffer(0, littleEndian, noAssert);
34800 if (buffer.length > 0) { // Avoid references to more than one EMPTY_BUFFER
34801 bb.buffer = buffer.buffer;
34802 bb.offset = buffer.byteOffset;
34803 bb.limit = buffer.byteOffset + buffer.byteLength;
34804 bb.view = new Uint8Array(buffer.buffer);
34805 }
34806 } else if (buffer instanceof ArrayBuffer) { // Reuse ArrayBuffer
34807 bb = new ByteBuffer(0, littleEndian, noAssert);
34808 if (buffer.byteLength > 0) {
34809 bb.buffer = buffer;
34810 bb.offset = 0;
34811 bb.limit = buffer.byteLength;
34812 bb.view = buffer.byteLength > 0 ? new Uint8Array(buffer) : null;
34813 }
34814 } else if (Object.prototype.toString.call(buffer) === "[object Array]") { // Create from octets
34815 bb = new ByteBuffer(buffer.length, littleEndian, noAssert);
34816 bb.limit = buffer.length;
34817 for (var i=0; i<buffer.length; ++i)
34818 bb.view[i] = buffer[i];
34819 } else
34820 throw TypeError("Illegal buffer"); // Otherwise fail
34821 return bb;
34822 };
34823
34824 /**
34825 * Writes the array as a bitset.
34826 * @param {Array<boolean>} value Array of booleans to write
34827 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
34828 * @returns {!ByteBuffer}
34829 * @expose
34830 */
34831 ByteBufferPrototype.writeBitSet = function(value, offset) {
34832 var relative = typeof offset === 'undefined';
34833 if (relative) offset = this.offset;
34834 if (!this.noAssert) {
34835 if (!(value instanceof Array))
34836 throw TypeError("Illegal BitSet: Not an array");
34837 if (typeof offset !== 'number' || offset % 1 !== 0)
34838 throw TypeError("Illegal offset: "+offset+" (not an integer)");
34839 offset >>>= 0;
34840 if (offset < 0 || offset + 0 > this.buffer.byteLength)
34841 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
34842 }
34843
34844 var start = offset,
34845 bits = value.length,
34846 bytes = (bits >> 3),
34847 bit = 0,
34848 k;
34849
34850 offset += this.writeVarint32(bits,offset);
34851
34852 while(bytes--) {
34853 k = (!!value[bit++] & 1) |
34854 ((!!value[bit++] & 1) << 1) |
34855 ((!!value[bit++] & 1) << 2) |
34856 ((!!value[bit++] & 1) << 3) |
34857 ((!!value[bit++] & 1) << 4) |
34858 ((!!value[bit++] & 1) << 5) |
34859 ((!!value[bit++] & 1) << 6) |
34860 ((!!value[bit++] & 1) << 7);
34861 this.writeByte(k,offset++);
34862 }
34863
34864 if(bit < bits) {
34865 var m = 0; k = 0;
34866 while(bit < bits) k = k | ((!!value[bit++] & 1) << (m++));
34867 this.writeByte(k,offset++);
34868 }
34869
34870 if (relative) {
34871 this.offset = offset;
34872 return this;
34873 }
34874 return offset - start;
34875 }
34876
34877 /**
34878 * Reads a BitSet as an array of booleans.
34879 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
34880 * @returns {Array<boolean>
34881 * @expose
34882 */
34883 ByteBufferPrototype.readBitSet = function(offset) {
34884 var relative = typeof offset === 'undefined';
34885 if (relative) offset = this.offset;
34886
34887 var ret = this.readVarint32(offset),
34888 bits = ret.value,
34889 bytes = (bits >> 3),
34890 bit = 0,
34891 value = [],
34892 k;
34893
34894 offset += ret.length;
34895
34896 while(bytes--) {
34897 k = this.readByte(offset++);
34898 value[bit++] = !!(k & 0x01);
34899 value[bit++] = !!(k & 0x02);
34900 value[bit++] = !!(k & 0x04);
34901 value[bit++] = !!(k & 0x08);
34902 value[bit++] = !!(k & 0x10);
34903 value[bit++] = !!(k & 0x20);
34904 value[bit++] = !!(k & 0x40);
34905 value[bit++] = !!(k & 0x80);
34906 }
34907
34908 if(bit < bits) {
34909 var m = 0;
34910 k = this.readByte(offset++);
34911 while(bit < bits) value[bit++] = !!((k >> (m++)) & 1);
34912 }
34913
34914 if (relative) {
34915 this.offset = offset;
34916 }
34917 return value;
34918 }
34919 /**
34920 * Reads the specified number of bytes.
34921 * @param {number} length Number of bytes to read
34922 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
34923 * @returns {!ByteBuffer}
34924 * @expose
34925 */
34926 ByteBufferPrototype.readBytes = function(length, offset) {
34927 var relative = typeof offset === 'undefined';
34928 if (relative) offset = this.offset;
34929 if (!this.noAssert) {
34930 if (typeof offset !== 'number' || offset % 1 !== 0)
34931 throw TypeError("Illegal offset: "+offset+" (not an integer)");
34932 offset >>>= 0;
34933 if (offset < 0 || offset + length > this.buffer.byteLength)
34934 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength);
34935 }
34936 var slice = this.slice(offset, offset + length);
34937 if (relative) this.offset += length;
34938 return slice;
34939 };
34940
34941 /**
34942 * Writes a payload of bytes. This is an alias of {@link ByteBuffer#append}.
34943 * @function
34944 * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to write. If `source` is a ByteBuffer, its offsets
34945 * will be modified according to the performed read operation.
34946 * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
34947 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
34948 * written if omitted.
34949 * @returns {!ByteBuffer} this
34950 * @expose
34951 */
34952 ByteBufferPrototype.writeBytes = ByteBufferPrototype.append;
34953
34954 // types/ints/int8
34955
34956 /**
34957 * Writes an 8bit signed integer.
34958 * @param {number} value Value to write
34959 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
34960 * @returns {!ByteBuffer} this
34961 * @expose
34962 */
34963 ByteBufferPrototype.writeInt8 = function(value, offset) {
34964 var relative = typeof offset === 'undefined';
34965 if (relative) offset = this.offset;
34966 if (!this.noAssert) {
34967 if (typeof value !== 'number' || value % 1 !== 0)
34968 throw TypeError("Illegal value: "+value+" (not an integer)");
34969 value |= 0;
34970 if (typeof offset !== 'number' || offset % 1 !== 0)
34971 throw TypeError("Illegal offset: "+offset+" (not an integer)");
34972 offset >>>= 0;
34973 if (offset < 0 || offset + 0 > this.buffer.byteLength)
34974 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
34975 }
34976 offset += 1;
34977 var capacity0 = this.buffer.byteLength;
34978 if (offset > capacity0)
34979 this.resize((capacity0 *= 2) > offset ? capacity0 : offset);
34980 offset -= 1;
34981 this.view[offset] = value;
34982 if (relative) this.offset += 1;
34983 return this;
34984 };
34985
34986 /**
34987 * Writes an 8bit signed integer. This is an alias of {@link ByteBuffer#writeInt8}.
34988 * @function
34989 * @param {number} value Value to write
34990 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
34991 * @returns {!ByteBuffer} this
34992 * @expose
34993 */
34994 ByteBufferPrototype.writeByte = ByteBufferPrototype.writeInt8;
34995
34996 /**
34997 * Reads an 8bit signed integer.
34998 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
34999 * @returns {number} Value read
35000 * @expose
35001 */
35002 ByteBufferPrototype.readInt8 = function(offset) {
35003 var relative = typeof offset === 'undefined';
35004 if (relative) offset = this.offset;
35005 if (!this.noAssert) {
35006 if (typeof offset !== 'number' || offset % 1 !== 0)
35007 throw TypeError("Illegal offset: "+offset+" (not an integer)");
35008 offset >>>= 0;
35009 if (offset < 0 || offset + 1 > this.buffer.byteLength)
35010 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
35011 }
35012 var value = this.view[offset];
35013 if ((value & 0x80) === 0x80) value = -(0xFF - value + 1); // Cast to signed
35014 if (relative) this.offset += 1;
35015 return value;
35016 };
35017
35018 /**
35019 * Reads an 8bit signed integer. This is an alias of {@link ByteBuffer#readInt8}.
35020 * @function
35021 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
35022 * @returns {number} Value read
35023 * @expose
35024 */
35025 ByteBufferPrototype.readByte = ByteBufferPrototype.readInt8;
35026
35027 /**
35028 * Writes an 8bit unsigned integer.
35029 * @param {number} value Value to write
35030 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
35031 * @returns {!ByteBuffer} this
35032 * @expose
35033 */
35034 ByteBufferPrototype.writeUint8 = function(value, offset) {
35035 var relative = typeof offset === 'undefined';
35036 if (relative) offset = this.offset;
35037 if (!this.noAssert) {
35038 if (typeof value !== 'number' || value % 1 !== 0)
35039 throw TypeError("Illegal value: "+value+" (not an integer)");
35040 value >>>= 0;
35041 if (typeof offset !== 'number' || offset % 1 !== 0)
35042 throw TypeError("Illegal offset: "+offset+" (not an integer)");
35043 offset >>>= 0;
35044 if (offset < 0 || offset + 0 > this.buffer.byteLength)
35045 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
35046 }
35047 offset += 1;
35048 var capacity1 = this.buffer.byteLength;
35049 if (offset > capacity1)
35050 this.resize((capacity1 *= 2) > offset ? capacity1 : offset);
35051 offset -= 1;
35052 this.view[offset] = value;
35053 if (relative) this.offset += 1;
35054 return this;
35055 };
35056
35057 /**
35058 * Writes an 8bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint8}.
35059 * @function
35060 * @param {number} value Value to write
35061 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
35062 * @returns {!ByteBuffer} this
35063 * @expose
35064 */
35065 ByteBufferPrototype.writeUInt8 = ByteBufferPrototype.writeUint8;
35066
35067 /**
35068 * Reads an 8bit unsigned integer.
35069 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
35070 * @returns {number} Value read
35071 * @expose
35072 */
35073 ByteBufferPrototype.readUint8 = function(offset) {
35074 var relative = typeof offset === 'undefined';
35075 if (relative) offset = this.offset;
35076 if (!this.noAssert) {
35077 if (typeof offset !== 'number' || offset % 1 !== 0)
35078 throw TypeError("Illegal offset: "+offset+" (not an integer)");
35079 offset >>>= 0;
35080 if (offset < 0 || offset + 1 > this.buffer.byteLength)
35081 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
35082 }
35083 var value = this.view[offset];
35084 if (relative) this.offset += 1;
35085 return value;
35086 };
35087
35088 /**
35089 * Reads an 8bit unsigned integer. This is an alias of {@link ByteBuffer#readUint8}.
35090 * @function
35091 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
35092 * @returns {number} Value read
35093 * @expose
35094 */
35095 ByteBufferPrototype.readUInt8 = ByteBufferPrototype.readUint8;
35096
35097 // types/ints/int16
35098
35099 /**
35100 * Writes a 16bit signed integer.
35101 * @param {number} value Value to write
35102 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
35103 * @throws {TypeError} If `offset` or `value` is not a valid number
35104 * @throws {RangeError} If `offset` is out of bounds
35105 * @expose
35106 */
35107 ByteBufferPrototype.writeInt16 = function(value, offset) {
35108 var relative = typeof offset === 'undefined';
35109 if (relative) offset = this.offset;
35110 if (!this.noAssert) {
35111 if (typeof value !== 'number' || value % 1 !== 0)
35112 throw TypeError("Illegal value: "+value+" (not an integer)");
35113 value |= 0;
35114 if (typeof offset !== 'number' || offset % 1 !== 0)
35115 throw TypeError("Illegal offset: "+offset+" (not an integer)");
35116 offset >>>= 0;
35117 if (offset < 0 || offset + 0 > this.buffer.byteLength)
35118 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
35119 }
35120 offset += 2;
35121 var capacity2 = this.buffer.byteLength;
35122 if (offset > capacity2)
35123 this.resize((capacity2 *= 2) > offset ? capacity2 : offset);
35124 offset -= 2;
35125 if (this.littleEndian) {
35126 this.view[offset+1] = (value & 0xFF00) >>> 8;
35127 this.view[offset ] = value & 0x00FF;
35128 } else {
35129 this.view[offset] = (value & 0xFF00) >>> 8;
35130 this.view[offset+1] = value & 0x00FF;
35131 }
35132 if (relative) this.offset += 2;
35133 return this;
35134 };
35135
35136 /**
35137 * Writes a 16bit signed integer. This is an alias of {@link ByteBuffer#writeInt16}.
35138 * @function
35139 * @param {number} value Value to write
35140 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
35141 * @throws {TypeError} If `offset` or `value` is not a valid number
35142 * @throws {RangeError} If `offset` is out of bounds
35143 * @expose
35144 */
35145 ByteBufferPrototype.writeShort = ByteBufferPrototype.writeInt16;
35146
35147 /**
35148 * Reads a 16bit signed integer.
35149 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
35150 * @returns {number} Value read
35151 * @throws {TypeError} If `offset` is not a valid number
35152 * @throws {RangeError} If `offset` is out of bounds
35153 * @expose
35154 */
35155 ByteBufferPrototype.readInt16 = function(offset) {
35156 var relative = typeof offset === 'undefined';
35157 if (relative) offset = this.offset;
35158 if (!this.noAssert) {
35159 if (typeof offset !== 'number' || offset % 1 !== 0)
35160 throw TypeError("Illegal offset: "+offset+" (not an integer)");
35161 offset >>>= 0;
35162 if (offset < 0 || offset + 2 > this.buffer.byteLength)
35163 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength);
35164 }
35165 var value = 0;
35166 if (this.littleEndian) {
35167 value = this.view[offset ];
35168 value |= this.view[offset+1] << 8;
35169 } else {
35170 value = this.view[offset ] << 8;
35171 value |= this.view[offset+1];
35172 }
35173 if ((value & 0x8000) === 0x8000) value = -(0xFFFF - value + 1); // Cast to signed
35174 if (relative) this.offset += 2;
35175 return value;
35176 };
35177
35178 /**
35179 * Reads a 16bit signed integer. This is an alias of {@link ByteBuffer#readInt16}.
35180 * @function
35181 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
35182 * @returns {number} Value read
35183 * @throws {TypeError} If `offset` is not a valid number
35184 * @throws {RangeError} If `offset` is out of bounds
35185 * @expose
35186 */
35187 ByteBufferPrototype.readShort = ByteBufferPrototype.readInt16;
35188
35189 /**
35190 * Writes a 16bit unsigned integer.
35191 * @param {number} value Value to write
35192 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
35193 * @throws {TypeError} If `offset` or `value` is not a valid number
35194 * @throws {RangeError} If `offset` is out of bounds
35195 * @expose
35196 */
35197 ByteBufferPrototype.writeUint16 = function(value, offset) {
35198 var relative = typeof offset === 'undefined';
35199 if (relative) offset = this.offset;
35200 if (!this.noAssert) {
35201 if (typeof value !== 'number' || value % 1 !== 0)
35202 throw TypeError("Illegal value: "+value+" (not an integer)");
35203 value >>>= 0;
35204 if (typeof offset !== 'number' || offset % 1 !== 0)
35205 throw TypeError("Illegal offset: "+offset+" (not an integer)");
35206 offset >>>= 0;
35207 if (offset < 0 || offset + 0 > this.buffer.byteLength)
35208 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
35209 }
35210 offset += 2;
35211 var capacity3 = this.buffer.byteLength;
35212 if (offset > capacity3)
35213 this.resize((capacity3 *= 2) > offset ? capacity3 : offset);
35214 offset -= 2;
35215 if (this.littleEndian) {
35216 this.view[offset+1] = (value & 0xFF00) >>> 8;
35217 this.view[offset ] = value & 0x00FF;
35218 } else {
35219 this.view[offset] = (value & 0xFF00) >>> 8;
35220 this.view[offset+1] = value & 0x00FF;
35221 }
35222 if (relative) this.offset += 2;
35223 return this;
35224 };
35225
35226 /**
35227 * Writes a 16bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint16}.
35228 * @function
35229 * @param {number} value Value to write
35230 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
35231 * @throws {TypeError} If `offset` or `value` is not a valid number
35232 * @throws {RangeError} If `offset` is out of bounds
35233 * @expose
35234 */
35235 ByteBufferPrototype.writeUInt16 = ByteBufferPrototype.writeUint16;
35236
35237 /**
35238 * Reads a 16bit unsigned integer.
35239 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
35240 * @returns {number} Value read
35241 * @throws {TypeError} If `offset` is not a valid number
35242 * @throws {RangeError} If `offset` is out of bounds
35243 * @expose
35244 */
35245 ByteBufferPrototype.readUint16 = function(offset) {
35246 var relative = typeof offset === 'undefined';
35247 if (relative) offset = this.offset;
35248 if (!this.noAssert) {
35249 if (typeof offset !== 'number' || offset % 1 !== 0)
35250 throw TypeError("Illegal offset: "+offset+" (not an integer)");
35251 offset >>>= 0;
35252 if (offset < 0 || offset + 2 > this.buffer.byteLength)
35253 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength);
35254 }
35255 var value = 0;
35256 if (this.littleEndian) {
35257 value = this.view[offset ];
35258 value |= this.view[offset+1] << 8;
35259 } else {
35260 value = this.view[offset ] << 8;
35261 value |= this.view[offset+1];
35262 }
35263 if (relative) this.offset += 2;
35264 return value;
35265 };
35266
35267 /**
35268 * Reads a 16bit unsigned integer. This is an alias of {@link ByteBuffer#readUint16}.
35269 * @function
35270 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
35271 * @returns {number} Value read
35272 * @throws {TypeError} If `offset` is not a valid number
35273 * @throws {RangeError} If `offset` is out of bounds
35274 * @expose
35275 */
35276 ByteBufferPrototype.readUInt16 = ByteBufferPrototype.readUint16;
35277
35278 // types/ints/int32
35279
35280 /**
35281 * Writes a 32bit signed integer.
35282 * @param {number} value Value to write
35283 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
35284 * @expose
35285 */
35286 ByteBufferPrototype.writeInt32 = function(value, offset) {
35287 var relative = typeof offset === 'undefined';
35288 if (relative) offset = this.offset;
35289 if (!this.noAssert) {
35290 if (typeof value !== 'number' || value % 1 !== 0)
35291 throw TypeError("Illegal value: "+value+" (not an integer)");
35292 value |= 0;
35293 if (typeof offset !== 'number' || offset % 1 !== 0)
35294 throw TypeError("Illegal offset: "+offset+" (not an integer)");
35295 offset >>>= 0;
35296 if (offset < 0 || offset + 0 > this.buffer.byteLength)
35297 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
35298 }
35299 offset += 4;
35300 var capacity4 = this.buffer.byteLength;
35301 if (offset > capacity4)
35302 this.resize((capacity4 *= 2) > offset ? capacity4 : offset);
35303 offset -= 4;
35304 if (this.littleEndian) {
35305 this.view[offset+3] = (value >>> 24) & 0xFF;
35306 this.view[offset+2] = (value >>> 16) & 0xFF;
35307 this.view[offset+1] = (value >>> 8) & 0xFF;
35308 this.view[offset ] = value & 0xFF;
35309 } else {
35310 this.view[offset ] = (value >>> 24) & 0xFF;
35311 this.view[offset+1] = (value >>> 16) & 0xFF;
35312 this.view[offset+2] = (value >>> 8) & 0xFF;
35313 this.view[offset+3] = value & 0xFF;
35314 }
35315 if (relative) this.offset += 4;
35316 return this;
35317 };
35318
35319 /**
35320 * Writes a 32bit signed integer. This is an alias of {@link ByteBuffer#writeInt32}.
35321 * @param {number} value Value to write
35322 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
35323 * @expose
35324 */
35325 ByteBufferPrototype.writeInt = ByteBufferPrototype.writeInt32;
35326
35327 /**
35328 * Reads a 32bit signed integer.
35329 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
35330 * @returns {number} Value read
35331 * @expose
35332 */
35333 ByteBufferPrototype.readInt32 = function(offset) {
35334 var relative = typeof offset === 'undefined';
35335 if (relative) offset = this.offset;
35336 if (!this.noAssert) {
35337 if (typeof offset !== 'number' || offset % 1 !== 0)
35338 throw TypeError("Illegal offset: "+offset+" (not an integer)");
35339 offset >>>= 0;
35340 if (offset < 0 || offset + 4 > this.buffer.byteLength)
35341 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
35342 }
35343 var value = 0;
35344 if (this.littleEndian) {
35345 value = this.view[offset+2] << 16;
35346 value |= this.view[offset+1] << 8;
35347 value |= this.view[offset ];
35348 value += this.view[offset+3] << 24 >>> 0;
35349 } else {
35350 value = this.view[offset+1] << 16;
35351 value |= this.view[offset+2] << 8;
35352 value |= this.view[offset+3];
35353 value += this.view[offset ] << 24 >>> 0;
35354 }
35355 value |= 0; // Cast to signed
35356 if (relative) this.offset += 4;
35357 return value;
35358 };
35359
35360 /**
35361 * Reads a 32bit signed integer. This is an alias of {@link ByteBuffer#readInt32}.
35362 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `4` if omitted.
35363 * @returns {number} Value read
35364 * @expose
35365 */
35366 ByteBufferPrototype.readInt = ByteBufferPrototype.readInt32;
35367
35368 /**
35369 * Writes a 32bit unsigned integer.
35370 * @param {number} value Value to write
35371 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
35372 * @expose
35373 */
35374 ByteBufferPrototype.writeUint32 = function(value, offset) {
35375 var relative = typeof offset === 'undefined';
35376 if (relative) offset = this.offset;
35377 if (!this.noAssert) {
35378 if (typeof value !== 'number' || value % 1 !== 0)
35379 throw TypeError("Illegal value: "+value+" (not an integer)");
35380 value >>>= 0;
35381 if (typeof offset !== 'number' || offset % 1 !== 0)
35382 throw TypeError("Illegal offset: "+offset+" (not an integer)");
35383 offset >>>= 0;
35384 if (offset < 0 || offset + 0 > this.buffer.byteLength)
35385 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
35386 }
35387 offset += 4;
35388 var capacity5 = this.buffer.byteLength;
35389 if (offset > capacity5)
35390 this.resize((capacity5 *= 2) > offset ? capacity5 : offset);
35391 offset -= 4;
35392 if (this.littleEndian) {
35393 this.view[offset+3] = (value >>> 24) & 0xFF;
35394 this.view[offset+2] = (value >>> 16) & 0xFF;
35395 this.view[offset+1] = (value >>> 8) & 0xFF;
35396 this.view[offset ] = value & 0xFF;
35397 } else {
35398 this.view[offset ] = (value >>> 24) & 0xFF;
35399 this.view[offset+1] = (value >>> 16) & 0xFF;
35400 this.view[offset+2] = (value >>> 8) & 0xFF;
35401 this.view[offset+3] = value & 0xFF;
35402 }
35403 if (relative) this.offset += 4;
35404 return this;
35405 };
35406
35407 /**
35408 * Writes a 32bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint32}.
35409 * @function
35410 * @param {number} value Value to write
35411 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
35412 * @expose
35413 */
35414 ByteBufferPrototype.writeUInt32 = ByteBufferPrototype.writeUint32;
35415
35416 /**
35417 * Reads a 32bit unsigned integer.
35418 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
35419 * @returns {number} Value read
35420 * @expose
35421 */
35422 ByteBufferPrototype.readUint32 = function(offset) {
35423 var relative = typeof offset === 'undefined';
35424 if (relative) offset = this.offset;
35425 if (!this.noAssert) {
35426 if (typeof offset !== 'number' || offset % 1 !== 0)
35427 throw TypeError("Illegal offset: "+offset+" (not an integer)");
35428 offset >>>= 0;
35429 if (offset < 0 || offset + 4 > this.buffer.byteLength)
35430 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
35431 }
35432 var value = 0;
35433 if (this.littleEndian) {
35434 value = this.view[offset+2] << 16;
35435 value |= this.view[offset+1] << 8;
35436 value |= this.view[offset ];
35437 value += this.view[offset+3] << 24 >>> 0;
35438 } else {
35439 value = this.view[offset+1] << 16;
35440 value |= this.view[offset+2] << 8;
35441 value |= this.view[offset+3];
35442 value += this.view[offset ] << 24 >>> 0;
35443 }
35444 if (relative) this.offset += 4;
35445 return value;
35446 };
35447
35448 /**
35449 * Reads a 32bit unsigned integer. This is an alias of {@link ByteBuffer#readUint32}.
35450 * @function
35451 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
35452 * @returns {number} Value read
35453 * @expose
35454 */
35455 ByteBufferPrototype.readUInt32 = ByteBufferPrototype.readUint32;
35456
35457 // types/ints/int64
35458
35459 if (Long) {
35460
35461 /**
35462 * Writes a 64bit signed integer.
35463 * @param {number|!Long} value Value to write
35464 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
35465 * @returns {!ByteBuffer} this
35466 * @expose
35467 */
35468 ByteBufferPrototype.writeInt64 = function(value, offset) {
35469 var relative = typeof offset === 'undefined';
35470 if (relative) offset = this.offset;
35471 if (!this.noAssert) {
35472 if (typeof value === 'number')
35473 value = Long.fromNumber(value);
35474 else if (typeof value === 'string')
35475 value = Long.fromString(value);
35476 else if (!(value && value instanceof Long))
35477 throw TypeError("Illegal value: "+value+" (not an integer or Long)");
35478 if (typeof offset !== 'number' || offset % 1 !== 0)
35479 throw TypeError("Illegal offset: "+offset+" (not an integer)");
35480 offset >>>= 0;
35481 if (offset < 0 || offset + 0 > this.buffer.byteLength)
35482 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
35483 }
35484 if (typeof value === 'number')
35485 value = Long.fromNumber(value);
35486 else if (typeof value === 'string')
35487 value = Long.fromString(value);
35488 offset += 8;
35489 var capacity6 = this.buffer.byteLength;
35490 if (offset > capacity6)
35491 this.resize((capacity6 *= 2) > offset ? capacity6 : offset);
35492 offset -= 8;
35493 var lo = value.low,
35494 hi = value.high;
35495 if (this.littleEndian) {
35496 this.view[offset+3] = (lo >>> 24) & 0xFF;
35497 this.view[offset+2] = (lo >>> 16) & 0xFF;
35498 this.view[offset+1] = (lo >>> 8) & 0xFF;
35499 this.view[offset ] = lo & 0xFF;
35500 offset += 4;
35501 this.view[offset+3] = (hi >>> 24) & 0xFF;
35502 this.view[offset+2] = (hi >>> 16) & 0xFF;
35503 this.view[offset+1] = (hi >>> 8) & 0xFF;
35504 this.view[offset ] = hi & 0xFF;
35505 } else {
35506 this.view[offset ] = (hi >>> 24) & 0xFF;
35507 this.view[offset+1] = (hi >>> 16) & 0xFF;
35508 this.view[offset+2] = (hi >>> 8) & 0xFF;
35509 this.view[offset+3] = hi & 0xFF;
35510 offset += 4;
35511 this.view[offset ] = (lo >>> 24) & 0xFF;
35512 this.view[offset+1] = (lo >>> 16) & 0xFF;
35513 this.view[offset+2] = (lo >>> 8) & 0xFF;
35514 this.view[offset+3] = lo & 0xFF;
35515 }
35516 if (relative) this.offset += 8;
35517 return this;
35518 };
35519
35520 /**
35521 * Writes a 64bit signed integer. This is an alias of {@link ByteBuffer#writeInt64}.
35522 * @param {number|!Long} value Value to write
35523 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
35524 * @returns {!ByteBuffer} this
35525 * @expose
35526 */
35527 ByteBufferPrototype.writeLong = ByteBufferPrototype.writeInt64;
35528
35529 /**
35530 * Reads a 64bit signed integer.
35531 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
35532 * @returns {!Long}
35533 * @expose
35534 */
35535 ByteBufferPrototype.readInt64 = function(offset) {
35536 var relative = typeof offset === 'undefined';
35537 if (relative) offset = this.offset;
35538 if (!this.noAssert) {
35539 if (typeof offset !== 'number' || offset % 1 !== 0)
35540 throw TypeError("Illegal offset: "+offset+" (not an integer)");
35541 offset >>>= 0;
35542 if (offset < 0 || offset + 8 > this.buffer.byteLength)
35543 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
35544 }
35545 var lo = 0,
35546 hi = 0;
35547 if (this.littleEndian) {
35548 lo = this.view[offset+2] << 16;
35549 lo |= this.view[offset+1] << 8;
35550 lo |= this.view[offset ];
35551 lo += this.view[offset+3] << 24 >>> 0;
35552 offset += 4;
35553 hi = this.view[offset+2] << 16;
35554 hi |= this.view[offset+1] << 8;
35555 hi |= this.view[offset ];
35556 hi += this.view[offset+3] << 24 >>> 0;
35557 } else {
35558 hi = this.view[offset+1] << 16;
35559 hi |= this.view[offset+2] << 8;
35560 hi |= this.view[offset+3];
35561 hi += this.view[offset ] << 24 >>> 0;
35562 offset += 4;
35563 lo = this.view[offset+1] << 16;
35564 lo |= this.view[offset+2] << 8;
35565 lo |= this.view[offset+3];
35566 lo += this.view[offset ] << 24 >>> 0;
35567 }
35568 var value = new Long(lo, hi, false);
35569 if (relative) this.offset += 8;
35570 return value;
35571 };
35572
35573 /**
35574 * Reads a 64bit signed integer. This is an alias of {@link ByteBuffer#readInt64}.
35575 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
35576 * @returns {!Long}
35577 * @expose
35578 */
35579 ByteBufferPrototype.readLong = ByteBufferPrototype.readInt64;
35580
35581 /**
35582 * Writes a 64bit unsigned integer.
35583 * @param {number|!Long} value Value to write
35584 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
35585 * @returns {!ByteBuffer} this
35586 * @expose
35587 */
35588 ByteBufferPrototype.writeUint64 = function(value, offset) {
35589 var relative = typeof offset === 'undefined';
35590 if (relative) offset = this.offset;
35591 if (!this.noAssert) {
35592 if (typeof value === 'number')
35593 value = Long.fromNumber(value);
35594 else if (typeof value === 'string')
35595 value = Long.fromString(value);
35596 else if (!(value && value instanceof Long))
35597 throw TypeError("Illegal value: "+value+" (not an integer or Long)");
35598 if (typeof offset !== 'number' || offset % 1 !== 0)
35599 throw TypeError("Illegal offset: "+offset+" (not an integer)");
35600 offset >>>= 0;
35601 if (offset < 0 || offset + 0 > this.buffer.byteLength)
35602 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
35603 }
35604 if (typeof value === 'number')
35605 value = Long.fromNumber(value);
35606 else if (typeof value === 'string')
35607 value = Long.fromString(value);
35608 offset += 8;
35609 var capacity7 = this.buffer.byteLength;
35610 if (offset > capacity7)
35611 this.resize((capacity7 *= 2) > offset ? capacity7 : offset);
35612 offset -= 8;
35613 var lo = value.low,
35614 hi = value.high;
35615 if (this.littleEndian) {
35616 this.view[offset+3] = (lo >>> 24) & 0xFF;
35617 this.view[offset+2] = (lo >>> 16) & 0xFF;
35618 this.view[offset+1] = (lo >>> 8) & 0xFF;
35619 this.view[offset ] = lo & 0xFF;
35620 offset += 4;
35621 this.view[offset+3] = (hi >>> 24) & 0xFF;
35622 this.view[offset+2] = (hi >>> 16) & 0xFF;
35623 this.view[offset+1] = (hi >>> 8) & 0xFF;
35624 this.view[offset ] = hi & 0xFF;
35625 } else {
35626 this.view[offset ] = (hi >>> 24) & 0xFF;
35627 this.view[offset+1] = (hi >>> 16) & 0xFF;
35628 this.view[offset+2] = (hi >>> 8) & 0xFF;
35629 this.view[offset+3] = hi & 0xFF;
35630 offset += 4;
35631 this.view[offset ] = (lo >>> 24) & 0xFF;
35632 this.view[offset+1] = (lo >>> 16) & 0xFF;
35633 this.view[offset+2] = (lo >>> 8) & 0xFF;
35634 this.view[offset+3] = lo & 0xFF;
35635 }
35636 if (relative) this.offset += 8;
35637 return this;
35638 };
35639
35640 /**
35641 * Writes a 64bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint64}.
35642 * @function
35643 * @param {number|!Long} value Value to write
35644 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
35645 * @returns {!ByteBuffer} this
35646 * @expose
35647 */
35648 ByteBufferPrototype.writeUInt64 = ByteBufferPrototype.writeUint64;
35649
35650 /**
35651 * Reads a 64bit unsigned integer.
35652 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
35653 * @returns {!Long}
35654 * @expose
35655 */
35656 ByteBufferPrototype.readUint64 = function(offset) {
35657 var relative = typeof offset === 'undefined';
35658 if (relative) offset = this.offset;
35659 if (!this.noAssert) {
35660 if (typeof offset !== 'number' || offset % 1 !== 0)
35661 throw TypeError("Illegal offset: "+offset+" (not an integer)");
35662 offset >>>= 0;
35663 if (offset < 0 || offset + 8 > this.buffer.byteLength)
35664 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
35665 }
35666 var lo = 0,
35667 hi = 0;
35668 if (this.littleEndian) {
35669 lo = this.view[offset+2] << 16;
35670 lo |= this.view[offset+1] << 8;
35671 lo |= this.view[offset ];
35672 lo += this.view[offset+3] << 24 >>> 0;
35673 offset += 4;
35674 hi = this.view[offset+2] << 16;
35675 hi |= this.view[offset+1] << 8;
35676 hi |= this.view[offset ];
35677 hi += this.view[offset+3] << 24 >>> 0;
35678 } else {
35679 hi = this.view[offset+1] << 16;
35680 hi |= this.view[offset+2] << 8;
35681 hi |= this.view[offset+3];
35682 hi += this.view[offset ] << 24 >>> 0;
35683 offset += 4;
35684 lo = this.view[offset+1] << 16;
35685 lo |= this.view[offset+2] << 8;
35686 lo |= this.view[offset+3];
35687 lo += this.view[offset ] << 24 >>> 0;
35688 }
35689 var value = new Long(lo, hi, true);
35690 if (relative) this.offset += 8;
35691 return value;
35692 };
35693
35694 /**
35695 * Reads a 64bit unsigned integer. This is an alias of {@link ByteBuffer#readUint64}.
35696 * @function
35697 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
35698 * @returns {!Long}
35699 * @expose
35700 */
35701 ByteBufferPrototype.readUInt64 = ByteBufferPrototype.readUint64;
35702
35703 } // Long
35704
35705
35706 // types/floats/float32
35707
35708 /*
35709 ieee754 - https://github.com/feross/ieee754
35710
35711 The MIT License (MIT)
35712
35713 Copyright (c) Feross Aboukhadijeh
35714
35715 Permission is hereby granted, free of charge, to any person obtaining a copy
35716 of this software and associated documentation files (the "Software"), to deal
35717 in the Software without restriction, including without limitation the rights
35718 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
35719 copies of the Software, and to permit persons to whom the Software is
35720 furnished to do so, subject to the following conditions:
35721
35722 The above copyright notice and this permission notice shall be included in
35723 all copies or substantial portions of the Software.
35724
35725 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35726 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35727 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
35728 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35729 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35730 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
35731 THE SOFTWARE.
35732 */
35733
35734 /**
35735 * Reads an IEEE754 float from a byte array.
35736 * @param {!Array} buffer
35737 * @param {number} offset
35738 * @param {boolean} isLE
35739 * @param {number} mLen
35740 * @param {number} nBytes
35741 * @returns {number}
35742 * @inner
35743 */
35744 function ieee754_read(buffer, offset, isLE, mLen, nBytes) {
35745 var e, m,
35746 eLen = nBytes * 8 - mLen - 1,
35747 eMax = (1 << eLen) - 1,
35748 eBias = eMax >> 1,
35749 nBits = -7,
35750 i = isLE ? (nBytes - 1) : 0,
35751 d = isLE ? -1 : 1,
35752 s = buffer[offset + i];
35753
35754 i += d;
35755
35756 e = s & ((1 << (-nBits)) - 1);
35757 s >>= (-nBits);
35758 nBits += eLen;
35759 for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
35760
35761 m = e & ((1 << (-nBits)) - 1);
35762 e >>= (-nBits);
35763 nBits += mLen;
35764 for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
35765
35766 if (e === 0) {
35767 e = 1 - eBias;
35768 } else if (e === eMax) {
35769 return m ? NaN : ((s ? -1 : 1) * Infinity);
35770 } else {
35771 m = m + Math.pow(2, mLen);
35772 e = e - eBias;
35773 }
35774 return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
35775 }
35776
35777 /**
35778 * Writes an IEEE754 float to a byte array.
35779 * @param {!Array} buffer
35780 * @param {number} value
35781 * @param {number} offset
35782 * @param {boolean} isLE
35783 * @param {number} mLen
35784 * @param {number} nBytes
35785 * @inner
35786 */
35787 function ieee754_write(buffer, value, offset, isLE, mLen, nBytes) {
35788 var e, m, c,
35789 eLen = nBytes * 8 - mLen - 1,
35790 eMax = (1 << eLen) - 1,
35791 eBias = eMax >> 1,
35792 rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),
35793 i = isLE ? 0 : (nBytes - 1),
35794 d = isLE ? 1 : -1,
35795 s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
35796
35797 value = Math.abs(value);
35798
35799 if (isNaN(value) || value === Infinity) {
35800 m = isNaN(value) ? 1 : 0;
35801 e = eMax;
35802 } else {
35803 e = Math.floor(Math.log(value) / Math.LN2);
35804 if (value * (c = Math.pow(2, -e)) < 1) {
35805 e--;
35806 c *= 2;
35807 }
35808 if (e + eBias >= 1) {
35809 value += rt / c;
35810 } else {
35811 value += rt * Math.pow(2, 1 - eBias);
35812 }
35813 if (value * c >= 2) {
35814 e++;
35815 c /= 2;
35816 }
35817
35818 if (e + eBias >= eMax) {
35819 m = 0;
35820 e = eMax;
35821 } else if (e + eBias >= 1) {
35822 m = (value * c - 1) * Math.pow(2, mLen);
35823 e = e + eBias;
35824 } else {
35825 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
35826 e = 0;
35827 }
35828 }
35829
35830 for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
35831
35832 e = (e << mLen) | m;
35833 eLen += mLen;
35834 for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
35835
35836 buffer[offset + i - d] |= s * 128;
35837 }
35838
35839 /**
35840 * Writes a 32bit float.
35841 * @param {number} value Value to write
35842 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
35843 * @returns {!ByteBuffer} this
35844 * @expose
35845 */
35846 ByteBufferPrototype.writeFloat32 = function(value, offset) {
35847 var relative = typeof offset === 'undefined';
35848 if (relative) offset = this.offset;
35849 if (!this.noAssert) {
35850 if (typeof value !== 'number')
35851 throw TypeError("Illegal value: "+value+" (not a number)");
35852 if (typeof offset !== 'number' || offset % 1 !== 0)
35853 throw TypeError("Illegal offset: "+offset+" (not an integer)");
35854 offset >>>= 0;
35855 if (offset < 0 || offset + 0 > this.buffer.byteLength)
35856 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
35857 }
35858 offset += 4;
35859 var capacity8 = this.buffer.byteLength;
35860 if (offset > capacity8)
35861 this.resize((capacity8 *= 2) > offset ? capacity8 : offset);
35862 offset -= 4;
35863 ieee754_write(this.view, value, offset, this.littleEndian, 23, 4);
35864 if (relative) this.offset += 4;
35865 return this;
35866 };
35867
35868 /**
35869 * Writes a 32bit float. This is an alias of {@link ByteBuffer#writeFloat32}.
35870 * @function
35871 * @param {number} value Value to write
35872 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
35873 * @returns {!ByteBuffer} this
35874 * @expose
35875 */
35876 ByteBufferPrototype.writeFloat = ByteBufferPrototype.writeFloat32;
35877
35878 /**
35879 * Reads a 32bit float.
35880 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
35881 * @returns {number}
35882 * @expose
35883 */
35884 ByteBufferPrototype.readFloat32 = function(offset) {
35885 var relative = typeof offset === 'undefined';
35886 if (relative) offset = this.offset;
35887 if (!this.noAssert) {
35888 if (typeof offset !== 'number' || offset % 1 !== 0)
35889 throw TypeError("Illegal offset: "+offset+" (not an integer)");
35890 offset >>>= 0;
35891 if (offset < 0 || offset + 4 > this.buffer.byteLength)
35892 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
35893 }
35894 var value = ieee754_read(this.view, offset, this.littleEndian, 23, 4);
35895 if (relative) this.offset += 4;
35896 return value;
35897 };
35898
35899 /**
35900 * Reads a 32bit float. This is an alias of {@link ByteBuffer#readFloat32}.
35901 * @function
35902 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
35903 * @returns {number}
35904 * @expose
35905 */
35906 ByteBufferPrototype.readFloat = ByteBufferPrototype.readFloat32;
35907
35908 // types/floats/float64
35909
35910 /**
35911 * Writes a 64bit float.
35912 * @param {number} value Value to write
35913 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
35914 * @returns {!ByteBuffer} this
35915 * @expose
35916 */
35917 ByteBufferPrototype.writeFloat64 = function(value, offset) {
35918 var relative = typeof offset === 'undefined';
35919 if (relative) offset = this.offset;
35920 if (!this.noAssert) {
35921 if (typeof value !== 'number')
35922 throw TypeError("Illegal value: "+value+" (not a number)");
35923 if (typeof offset !== 'number' || offset % 1 !== 0)
35924 throw TypeError("Illegal offset: "+offset+" (not an integer)");
35925 offset >>>= 0;
35926 if (offset < 0 || offset + 0 > this.buffer.byteLength)
35927 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
35928 }
35929 offset += 8;
35930 var capacity9 = this.buffer.byteLength;
35931 if (offset > capacity9)
35932 this.resize((capacity9 *= 2) > offset ? capacity9 : offset);
35933 offset -= 8;
35934 ieee754_write(this.view, value, offset, this.littleEndian, 52, 8);
35935 if (relative) this.offset += 8;
35936 return this;
35937 };
35938
35939 /**
35940 * Writes a 64bit float. This is an alias of {@link ByteBuffer#writeFloat64}.
35941 * @function
35942 * @param {number} value Value to write
35943 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
35944 * @returns {!ByteBuffer} this
35945 * @expose
35946 */
35947 ByteBufferPrototype.writeDouble = ByteBufferPrototype.writeFloat64;
35948
35949 /**
35950 * Reads a 64bit float.
35951 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
35952 * @returns {number}
35953 * @expose
35954 */
35955 ByteBufferPrototype.readFloat64 = function(offset) {
35956 var relative = typeof offset === 'undefined';
35957 if (relative) offset = this.offset;
35958 if (!this.noAssert) {
35959 if (typeof offset !== 'number' || offset % 1 !== 0)
35960 throw TypeError("Illegal offset: "+offset+" (not an integer)");
35961 offset >>>= 0;
35962 if (offset < 0 || offset + 8 > this.buffer.byteLength)
35963 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
35964 }
35965 var value = ieee754_read(this.view, offset, this.littleEndian, 52, 8);
35966 if (relative) this.offset += 8;
35967 return value;
35968 };
35969
35970 /**
35971 * Reads a 64bit float. This is an alias of {@link ByteBuffer#readFloat64}.
35972 * @function
35973 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
35974 * @returns {number}
35975 * @expose
35976 */
35977 ByteBufferPrototype.readDouble = ByteBufferPrototype.readFloat64;
35978
35979
35980 // types/varints/varint32
35981
35982 /**
35983 * Maximum number of bytes required to store a 32bit base 128 variable-length integer.
35984 * @type {number}
35985 * @const
35986 * @expose
35987 */
35988 ByteBuffer.MAX_VARINT32_BYTES = 5;
35989
35990 /**
35991 * Calculates the actual number of bytes required to store a 32bit base 128 variable-length integer.
35992 * @param {number} value Value to encode
35993 * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT32_BYTES}
35994 * @expose
35995 */
35996 ByteBuffer.calculateVarint32 = function(value) {
35997 // ref: src/google/protobuf/io/coded_stream.cc
35998 value = value >>> 0;
35999 if (value < 1 << 7 ) return 1;
36000 else if (value < 1 << 14) return 2;
36001 else if (value < 1 << 21) return 3;
36002 else if (value < 1 << 28) return 4;
36003 else return 5;
36004 };
36005
36006 /**
36007 * Zigzag encodes a signed 32bit integer so that it can be effectively used with varint encoding.
36008 * @param {number} n Signed 32bit integer
36009 * @returns {number} Unsigned zigzag encoded 32bit integer
36010 * @expose
36011 */
36012 ByteBuffer.zigZagEncode32 = function(n) {
36013 return (((n |= 0) << 1) ^ (n >> 31)) >>> 0; // ref: src/google/protobuf/wire_format_lite.h
36014 };
36015
36016 /**
36017 * Decodes a zigzag encoded signed 32bit integer.
36018 * @param {number} n Unsigned zigzag encoded 32bit integer
36019 * @returns {number} Signed 32bit integer
36020 * @expose
36021 */
36022 ByteBuffer.zigZagDecode32 = function(n) {
36023 return ((n >>> 1) ^ -(n & 1)) | 0; // // ref: src/google/protobuf/wire_format_lite.h
36024 };
36025
36026 /**
36027 * Writes a 32bit base 128 variable-length integer.
36028 * @param {number} value Value to write
36029 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
36030 * written if omitted.
36031 * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written
36032 * @expose
36033 */
36034 ByteBufferPrototype.writeVarint32 = function(value, offset) {
36035 var relative = typeof offset === 'undefined';
36036 if (relative) offset = this.offset;
36037 if (!this.noAssert) {
36038 if (typeof value !== 'number' || value % 1 !== 0)
36039 throw TypeError("Illegal value: "+value+" (not an integer)");
36040 value |= 0;
36041 if (typeof offset !== 'number' || offset % 1 !== 0)
36042 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36043 offset >>>= 0;
36044 if (offset < 0 || offset + 0 > this.buffer.byteLength)
36045 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
36046 }
36047 var size = ByteBuffer.calculateVarint32(value),
36048 b;
36049 offset += size;
36050 var capacity10 = this.buffer.byteLength;
36051 if (offset > capacity10)
36052 this.resize((capacity10 *= 2) > offset ? capacity10 : offset);
36053 offset -= size;
36054 value >>>= 0;
36055 while (value >= 0x80) {
36056 b = (value & 0x7f) | 0x80;
36057 this.view[offset++] = b;
36058 value >>>= 7;
36059 }
36060 this.view[offset++] = value;
36061 if (relative) {
36062 this.offset = offset;
36063 return this;
36064 }
36065 return size;
36066 };
36067
36068 /**
36069 * Writes a zig-zag encoded (signed) 32bit base 128 variable-length integer.
36070 * @param {number} value Value to write
36071 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
36072 * written if omitted.
36073 * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written
36074 * @expose
36075 */
36076 ByteBufferPrototype.writeVarint32ZigZag = function(value, offset) {
36077 return this.writeVarint32(ByteBuffer.zigZagEncode32(value), offset);
36078 };
36079
36080 /**
36081 * Reads a 32bit base 128 variable-length integer.
36082 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
36083 * written if omitted.
36084 * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read
36085 * and the actual number of bytes read.
36086 * @throws {Error} If it's not a valid varint. Has a property `truncated = true` if there is not enough data available
36087 * to fully decode the varint.
36088 * @expose
36089 */
36090 ByteBufferPrototype.readVarint32 = function(offset) {
36091 var relative = typeof offset === 'undefined';
36092 if (relative) offset = this.offset;
36093 if (!this.noAssert) {
36094 if (typeof offset !== 'number' || offset % 1 !== 0)
36095 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36096 offset >>>= 0;
36097 if (offset < 0 || offset + 1 > this.buffer.byteLength)
36098 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
36099 }
36100 var c = 0,
36101 value = 0 >>> 0,
36102 b;
36103 do {
36104 if (!this.noAssert && offset > this.limit) {
36105 var err = Error("Truncated");
36106 err['truncated'] = true;
36107 throw err;
36108 }
36109 b = this.view[offset++];
36110 if (c < 5)
36111 value |= (b & 0x7f) << (7*c);
36112 ++c;
36113 } while ((b & 0x80) !== 0);
36114 value |= 0;
36115 if (relative) {
36116 this.offset = offset;
36117 return value;
36118 }
36119 return {
36120 "value": value,
36121 "length": c
36122 };
36123 };
36124
36125 /**
36126 * Reads a zig-zag encoded (signed) 32bit base 128 variable-length integer.
36127 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
36128 * written if omitted.
36129 * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read
36130 * and the actual number of bytes read.
36131 * @throws {Error} If it's not a valid varint
36132 * @expose
36133 */
36134 ByteBufferPrototype.readVarint32ZigZag = function(offset) {
36135 var val = this.readVarint32(offset);
36136 if (typeof val === 'object')
36137 val["value"] = ByteBuffer.zigZagDecode32(val["value"]);
36138 else
36139 val = ByteBuffer.zigZagDecode32(val);
36140 return val;
36141 };
36142
36143 // types/varints/varint64
36144
36145 if (Long) {
36146
36147 /**
36148 * Maximum number of bytes required to store a 64bit base 128 variable-length integer.
36149 * @type {number}
36150 * @const
36151 * @expose
36152 */
36153 ByteBuffer.MAX_VARINT64_BYTES = 10;
36154
36155 /**
36156 * Calculates the actual number of bytes required to store a 64bit base 128 variable-length integer.
36157 * @param {number|!Long} value Value to encode
36158 * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT64_BYTES}
36159 * @expose
36160 */
36161 ByteBuffer.calculateVarint64 = function(value) {
36162 if (typeof value === 'number')
36163 value = Long.fromNumber(value);
36164 else if (typeof value === 'string')
36165 value = Long.fromString(value);
36166 // ref: src/google/protobuf/io/coded_stream.cc
36167 var part0 = value.toInt() >>> 0,
36168 part1 = value.shiftRightUnsigned(28).toInt() >>> 0,
36169 part2 = value.shiftRightUnsigned(56).toInt() >>> 0;
36170 if (part2 == 0) {
36171 if (part1 == 0) {
36172 if (part0 < 1 << 14)
36173 return part0 < 1 << 7 ? 1 : 2;
36174 else
36175 return part0 < 1 << 21 ? 3 : 4;
36176 } else {
36177 if (part1 < 1 << 14)
36178 return part1 < 1 << 7 ? 5 : 6;
36179 else
36180 return part1 < 1 << 21 ? 7 : 8;
36181 }
36182 } else
36183 return part2 < 1 << 7 ? 9 : 10;
36184 };
36185
36186 /**
36187 * Zigzag encodes a signed 64bit integer so that it can be effectively used with varint encoding.
36188 * @param {number|!Long} value Signed long
36189 * @returns {!Long} Unsigned zigzag encoded long
36190 * @expose
36191 */
36192 ByteBuffer.zigZagEncode64 = function(value) {
36193 if (typeof value === 'number')
36194 value = Long.fromNumber(value, false);
36195 else if (typeof value === 'string')
36196 value = Long.fromString(value, false);
36197 else if (value.unsigned !== false) value = value.toSigned();
36198 // ref: src/google/protobuf/wire_format_lite.h
36199 return value.shiftLeft(1).xor(value.shiftRight(63)).toUnsigned();
36200 };
36201
36202 /**
36203 * Decodes a zigzag encoded signed 64bit integer.
36204 * @param {!Long|number} value Unsigned zigzag encoded long or JavaScript number
36205 * @returns {!Long} Signed long
36206 * @expose
36207 */
36208 ByteBuffer.zigZagDecode64 = function(value) {
36209 if (typeof value === 'number')
36210 value = Long.fromNumber(value, false);
36211 else if (typeof value === 'string')
36212 value = Long.fromString(value, false);
36213 else if (value.unsigned !== false) value = value.toSigned();
36214 // ref: src/google/protobuf/wire_format_lite.h
36215 return value.shiftRightUnsigned(1).xor(value.and(Long.ONE).toSigned().negate()).toSigned();
36216 };
36217
36218 /**
36219 * Writes a 64bit base 128 variable-length integer.
36220 * @param {number|Long} value Value to write
36221 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
36222 * written if omitted.
36223 * @returns {!ByteBuffer|number} `this` if offset is omitted, else the actual number of bytes written.
36224 * @expose
36225 */
36226 ByteBufferPrototype.writeVarint64 = function(value, offset) {
36227 var relative = typeof offset === 'undefined';
36228 if (relative) offset = this.offset;
36229 if (!this.noAssert) {
36230 if (typeof value === 'number')
36231 value = Long.fromNumber(value);
36232 else if (typeof value === 'string')
36233 value = Long.fromString(value);
36234 else if (!(value && value instanceof Long))
36235 throw TypeError("Illegal value: "+value+" (not an integer or Long)");
36236 if (typeof offset !== 'number' || offset % 1 !== 0)
36237 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36238 offset >>>= 0;
36239 if (offset < 0 || offset + 0 > this.buffer.byteLength)
36240 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
36241 }
36242 if (typeof value === 'number')
36243 value = Long.fromNumber(value, false);
36244 else if (typeof value === 'string')
36245 value = Long.fromString(value, false);
36246 else if (value.unsigned !== false) value = value.toSigned();
36247 var size = ByteBuffer.calculateVarint64(value),
36248 part0 = value.toInt() >>> 0,
36249 part1 = value.shiftRightUnsigned(28).toInt() >>> 0,
36250 part2 = value.shiftRightUnsigned(56).toInt() >>> 0;
36251 offset += size;
36252 var capacity11 = this.buffer.byteLength;
36253 if (offset > capacity11)
36254 this.resize((capacity11 *= 2) > offset ? capacity11 : offset);
36255 offset -= size;
36256 switch (size) {
36257 case 10: this.view[offset+9] = (part2 >>> 7) & 0x01;
36258 case 9 : this.view[offset+8] = size !== 9 ? (part2 ) | 0x80 : (part2 ) & 0x7F;
36259 case 8 : this.view[offset+7] = size !== 8 ? (part1 >>> 21) | 0x80 : (part1 >>> 21) & 0x7F;
36260 case 7 : this.view[offset+6] = size !== 7 ? (part1 >>> 14) | 0x80 : (part1 >>> 14) & 0x7F;
36261 case 6 : this.view[offset+5] = size !== 6 ? (part1 >>> 7) | 0x80 : (part1 >>> 7) & 0x7F;
36262 case 5 : this.view[offset+4] = size !== 5 ? (part1 ) | 0x80 : (part1 ) & 0x7F;
36263 case 4 : this.view[offset+3] = size !== 4 ? (part0 >>> 21) | 0x80 : (part0 >>> 21) & 0x7F;
36264 case 3 : this.view[offset+2] = size !== 3 ? (part0 >>> 14) | 0x80 : (part0 >>> 14) & 0x7F;
36265 case 2 : this.view[offset+1] = size !== 2 ? (part0 >>> 7) | 0x80 : (part0 >>> 7) & 0x7F;
36266 case 1 : this.view[offset ] = size !== 1 ? (part0 ) | 0x80 : (part0 ) & 0x7F;
36267 }
36268 if (relative) {
36269 this.offset += size;
36270 return this;
36271 } else {
36272 return size;
36273 }
36274 };
36275
36276 /**
36277 * Writes a zig-zag encoded 64bit base 128 variable-length integer.
36278 * @param {number|Long} value Value to write
36279 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
36280 * written if omitted.
36281 * @returns {!ByteBuffer|number} `this` if offset is omitted, else the actual number of bytes written.
36282 * @expose
36283 */
36284 ByteBufferPrototype.writeVarint64ZigZag = function(value, offset) {
36285 return this.writeVarint64(ByteBuffer.zigZagEncode64(value), offset);
36286 };
36287
36288 /**
36289 * Reads a 64bit base 128 variable-length integer. Requires Long.js.
36290 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
36291 * read if omitted.
36292 * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and
36293 * the actual number of bytes read.
36294 * @throws {Error} If it's not a valid varint
36295 * @expose
36296 */
36297 ByteBufferPrototype.readVarint64 = function(offset) {
36298 var relative = typeof offset === 'undefined';
36299 if (relative) offset = this.offset;
36300 if (!this.noAssert) {
36301 if (typeof offset !== 'number' || offset % 1 !== 0)
36302 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36303 offset >>>= 0;
36304 if (offset < 0 || offset + 1 > this.buffer.byteLength)
36305 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
36306 }
36307 // ref: src/google/protobuf/io/coded_stream.cc
36308 var start = offset,
36309 part0 = 0,
36310 part1 = 0,
36311 part2 = 0,
36312 b = 0;
36313 b = this.view[offset++]; part0 = (b & 0x7F) ; if ( b & 0x80 ) {
36314 b = this.view[offset++]; part0 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
36315 b = this.view[offset++]; part0 |= (b & 0x7F) << 14; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
36316 b = this.view[offset++]; part0 |= (b & 0x7F) << 21; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
36317 b = this.view[offset++]; part1 = (b & 0x7F) ; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
36318 b = this.view[offset++]; part1 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
36319 b = this.view[offset++]; part1 |= (b & 0x7F) << 14; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
36320 b = this.view[offset++]; part1 |= (b & 0x7F) << 21; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
36321 b = this.view[offset++]; part2 = (b & 0x7F) ; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
36322 b = this.view[offset++]; part2 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
36323 throw Error("Buffer overrun"); }}}}}}}}}}
36324 var value = Long.fromBits(part0 | (part1 << 28), (part1 >>> 4) | (part2) << 24, false);
36325 if (relative) {
36326 this.offset = offset;
36327 return value;
36328 } else {
36329 return {
36330 'value': value,
36331 'length': offset-start
36332 };
36333 }
36334 };
36335
36336 /**
36337 * Reads a zig-zag encoded 64bit base 128 variable-length integer. Requires Long.js.
36338 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
36339 * read if omitted.
36340 * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and
36341 * the actual number of bytes read.
36342 * @throws {Error} If it's not a valid varint
36343 * @expose
36344 */
36345 ByteBufferPrototype.readVarint64ZigZag = function(offset) {
36346 var val = this.readVarint64(offset);
36347 if (val && val['value'] instanceof Long)
36348 val["value"] = ByteBuffer.zigZagDecode64(val["value"]);
36349 else
36350 val = ByteBuffer.zigZagDecode64(val);
36351 return val;
36352 };
36353
36354 } // Long
36355
36356
36357 // types/strings/cstring
36358
36359 /**
36360 * Writes a NULL-terminated UTF8 encoded string. For this to work the specified string must not contain any NULL
36361 * characters itself.
36362 * @param {string} str String to write
36363 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
36364 * contained in `str` + 1 if omitted.
36365 * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written
36366 * @expose
36367 */
36368 ByteBufferPrototype.writeCString = function(str, offset) {
36369 var relative = typeof offset === 'undefined';
36370 if (relative) offset = this.offset;
36371 var i,
36372 k = str.length;
36373 if (!this.noAssert) {
36374 if (typeof str !== 'string')
36375 throw TypeError("Illegal str: Not a string");
36376 for (i=0; i<k; ++i) {
36377 if (str.charCodeAt(i) === 0)
36378 throw RangeError("Illegal str: Contains NULL-characters");
36379 }
36380 if (typeof offset !== 'number' || offset % 1 !== 0)
36381 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36382 offset >>>= 0;
36383 if (offset < 0 || offset + 0 > this.buffer.byteLength)
36384 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
36385 }
36386 // UTF8 strings do not contain zero bytes in between except for the zero character, so:
36387 k = utfx.calculateUTF16asUTF8(stringSource(str))[1];
36388 offset += k+1;
36389 var capacity12 = this.buffer.byteLength;
36390 if (offset > capacity12)
36391 this.resize((capacity12 *= 2) > offset ? capacity12 : offset);
36392 offset -= k+1;
36393 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
36394 this.view[offset++] = b;
36395 }.bind(this));
36396 this.view[offset++] = 0;
36397 if (relative) {
36398 this.offset = offset;
36399 return this;
36400 }
36401 return k;
36402 };
36403
36404 /**
36405 * Reads a NULL-terminated UTF8 encoded string. For this to work the string read must not contain any NULL characters
36406 * itself.
36407 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
36408 * read if omitted.
36409 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
36410 * read and the actual number of bytes read.
36411 * @expose
36412 */
36413 ByteBufferPrototype.readCString = function(offset) {
36414 var relative = typeof offset === 'undefined';
36415 if (relative) offset = this.offset;
36416 if (!this.noAssert) {
36417 if (typeof offset !== 'number' || offset % 1 !== 0)
36418 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36419 offset >>>= 0;
36420 if (offset < 0 || offset + 1 > this.buffer.byteLength)
36421 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
36422 }
36423 var start = offset,
36424 temp;
36425 // UTF8 strings do not contain zero bytes in between except for the zero character itself, so:
36426 var sd, b = -1;
36427 utfx.decodeUTF8toUTF16(function() {
36428 if (b === 0) return null;
36429 if (offset >= this.limit)
36430 throw RangeError("Illegal range: Truncated data, "+offset+" < "+this.limit);
36431 b = this.view[offset++];
36432 return b === 0 ? null : b;
36433 }.bind(this), sd = stringDestination(), true);
36434 if (relative) {
36435 this.offset = offset;
36436 return sd();
36437 } else {
36438 return {
36439 "string": sd(),
36440 "length": offset - start
36441 };
36442 }
36443 };
36444
36445 // types/strings/istring
36446
36447 /**
36448 * Writes a length as uint32 prefixed UTF8 encoded string.
36449 * @param {string} str String to write
36450 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
36451 * written if omitted.
36452 * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written
36453 * @expose
36454 * @see ByteBuffer#writeVarint32
36455 */
36456 ByteBufferPrototype.writeIString = function(str, offset) {
36457 var relative = typeof offset === 'undefined';
36458 if (relative) offset = this.offset;
36459 if (!this.noAssert) {
36460 if (typeof str !== 'string')
36461 throw TypeError("Illegal str: Not a string");
36462 if (typeof offset !== 'number' || offset % 1 !== 0)
36463 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36464 offset >>>= 0;
36465 if (offset < 0 || offset + 0 > this.buffer.byteLength)
36466 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
36467 }
36468 var start = offset,
36469 k;
36470 k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1];
36471 offset += 4+k;
36472 var capacity13 = this.buffer.byteLength;
36473 if (offset > capacity13)
36474 this.resize((capacity13 *= 2) > offset ? capacity13 : offset);
36475 offset -= 4+k;
36476 if (this.littleEndian) {
36477 this.view[offset+3] = (k >>> 24) & 0xFF;
36478 this.view[offset+2] = (k >>> 16) & 0xFF;
36479 this.view[offset+1] = (k >>> 8) & 0xFF;
36480 this.view[offset ] = k & 0xFF;
36481 } else {
36482 this.view[offset ] = (k >>> 24) & 0xFF;
36483 this.view[offset+1] = (k >>> 16) & 0xFF;
36484 this.view[offset+2] = (k >>> 8) & 0xFF;
36485 this.view[offset+3] = k & 0xFF;
36486 }
36487 offset += 4;
36488 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
36489 this.view[offset++] = b;
36490 }.bind(this));
36491 if (offset !== start + 4 + k)
36492 throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+4+k));
36493 if (relative) {
36494 this.offset = offset;
36495 return this;
36496 }
36497 return offset - start;
36498 };
36499
36500 /**
36501 * Reads a length as uint32 prefixed UTF8 encoded string.
36502 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
36503 * read if omitted.
36504 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
36505 * read and the actual number of bytes read.
36506 * @expose
36507 * @see ByteBuffer#readVarint32
36508 */
36509 ByteBufferPrototype.readIString = function(offset) {
36510 var relative = typeof offset === 'undefined';
36511 if (relative) offset = this.offset;
36512 if (!this.noAssert) {
36513 if (typeof offset !== 'number' || offset % 1 !== 0)
36514 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36515 offset >>>= 0;
36516 if (offset < 0 || offset + 4 > this.buffer.byteLength)
36517 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
36518 }
36519 var start = offset;
36520 var len = this.readUint32(offset);
36521 var str = this.readUTF8String(len, ByteBuffer.METRICS_BYTES, offset += 4);
36522 offset += str['length'];
36523 if (relative) {
36524 this.offset = offset;
36525 return str['string'];
36526 } else {
36527 return {
36528 'string': str['string'],
36529 'length': offset - start
36530 };
36531 }
36532 };
36533
36534 // types/strings/utf8string
36535
36536 /**
36537 * Metrics representing number of UTF8 characters. Evaluates to `c`.
36538 * @type {string}
36539 * @const
36540 * @expose
36541 */
36542 ByteBuffer.METRICS_CHARS = 'c';
36543
36544 /**
36545 * Metrics representing number of bytes. Evaluates to `b`.
36546 * @type {string}
36547 * @const
36548 * @expose
36549 */
36550 ByteBuffer.METRICS_BYTES = 'b';
36551
36552 /**
36553 * Writes an UTF8 encoded string.
36554 * @param {string} str String to write
36555 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted.
36556 * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written.
36557 * @expose
36558 */
36559 ByteBufferPrototype.writeUTF8String = function(str, offset) {
36560 var relative = typeof offset === 'undefined';
36561 if (relative) offset = this.offset;
36562 if (!this.noAssert) {
36563 if (typeof offset !== 'number' || offset % 1 !== 0)
36564 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36565 offset >>>= 0;
36566 if (offset < 0 || offset + 0 > this.buffer.byteLength)
36567 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
36568 }
36569 var k;
36570 var start = offset;
36571 k = utfx.calculateUTF16asUTF8(stringSource(str))[1];
36572 offset += k;
36573 var capacity14 = this.buffer.byteLength;
36574 if (offset > capacity14)
36575 this.resize((capacity14 *= 2) > offset ? capacity14 : offset);
36576 offset -= k;
36577 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
36578 this.view[offset++] = b;
36579 }.bind(this));
36580 if (relative) {
36581 this.offset = offset;
36582 return this;
36583 }
36584 return offset - start;
36585 };
36586
36587 /**
36588 * Writes an UTF8 encoded string. This is an alias of {@link ByteBuffer#writeUTF8String}.
36589 * @function
36590 * @param {string} str String to write
36591 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted.
36592 * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written.
36593 * @expose
36594 */
36595 ByteBufferPrototype.writeString = ByteBufferPrototype.writeUTF8String;
36596
36597 /**
36598 * Calculates the number of UTF8 characters of a string. JavaScript itself uses UTF-16, so that a string's
36599 * `length` property does not reflect its actual UTF8 size if it contains code points larger than 0xFFFF.
36600 * @param {string} str String to calculate
36601 * @returns {number} Number of UTF8 characters
36602 * @expose
36603 */
36604 ByteBuffer.calculateUTF8Chars = function(str) {
36605 return utfx.calculateUTF16asUTF8(stringSource(str))[0];
36606 };
36607
36608 /**
36609 * Calculates the number of UTF8 bytes of a string.
36610 * @param {string} str String to calculate
36611 * @returns {number} Number of UTF8 bytes
36612 * @expose
36613 */
36614 ByteBuffer.calculateUTF8Bytes = function(str) {
36615 return utfx.calculateUTF16asUTF8(stringSource(str))[1];
36616 };
36617
36618 /**
36619 * Calculates the number of UTF8 bytes of a string. This is an alias of {@link ByteBuffer.calculateUTF8Bytes}.
36620 * @function
36621 * @param {string} str String to calculate
36622 * @returns {number} Number of UTF8 bytes
36623 * @expose
36624 */
36625 ByteBuffer.calculateString = ByteBuffer.calculateUTF8Bytes;
36626
36627 /**
36628 * Reads an UTF8 encoded string.
36629 * @param {number} length Number of characters or bytes to read.
36630 * @param {string=} metrics Metrics specifying what `length` is meant to count. Defaults to
36631 * {@link ByteBuffer.METRICS_CHARS}.
36632 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
36633 * read if omitted.
36634 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
36635 * read and the actual number of bytes read.
36636 * @expose
36637 */
36638 ByteBufferPrototype.readUTF8String = function(length, metrics, offset) {
36639 if (typeof metrics === 'number') {
36640 offset = metrics;
36641 metrics = undefined;
36642 }
36643 var relative = typeof offset === 'undefined';
36644 if (relative) offset = this.offset;
36645 if (typeof metrics === 'undefined') metrics = ByteBuffer.METRICS_CHARS;
36646 if (!this.noAssert) {
36647 if (typeof length !== 'number' || length % 1 !== 0)
36648 throw TypeError("Illegal length: "+length+" (not an integer)");
36649 length |= 0;
36650 if (typeof offset !== 'number' || offset % 1 !== 0)
36651 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36652 offset >>>= 0;
36653 if (offset < 0 || offset + 0 > this.buffer.byteLength)
36654 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
36655 }
36656 var i = 0,
36657 start = offset,
36658 sd;
36659 if (metrics === ByteBuffer.METRICS_CHARS) { // The same for node and the browser
36660 sd = stringDestination();
36661 utfx.decodeUTF8(function() {
36662 return i < length && offset < this.limit ? this.view[offset++] : null;
36663 }.bind(this), function(cp) {
36664 ++i; utfx.UTF8toUTF16(cp, sd);
36665 });
36666 if (i !== length)
36667 throw RangeError("Illegal range: Truncated data, "+i+" == "+length);
36668 if (relative) {
36669 this.offset = offset;
36670 return sd();
36671 } else {
36672 return {
36673 "string": sd(),
36674 "length": offset - start
36675 };
36676 }
36677 } else if (metrics === ByteBuffer.METRICS_BYTES) {
36678 if (!this.noAssert) {
36679 if (typeof offset !== 'number' || offset % 1 !== 0)
36680 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36681 offset >>>= 0;
36682 if (offset < 0 || offset + length > this.buffer.byteLength)
36683 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength);
36684 }
36685 var k = offset + length;
36686 utfx.decodeUTF8toUTF16(function() {
36687 return offset < k ? this.view[offset++] : null;
36688 }.bind(this), sd = stringDestination(), this.noAssert);
36689 if (offset !== k)
36690 throw RangeError("Illegal range: Truncated data, "+offset+" == "+k);
36691 if (relative) {
36692 this.offset = offset;
36693 return sd();
36694 } else {
36695 return {
36696 'string': sd(),
36697 'length': offset - start
36698 };
36699 }
36700 } else
36701 throw TypeError("Unsupported metrics: "+metrics);
36702 };
36703
36704 /**
36705 * Reads an UTF8 encoded string. This is an alias of {@link ByteBuffer#readUTF8String}.
36706 * @function
36707 * @param {number} length Number of characters or bytes to read
36708 * @param {number=} metrics Metrics specifying what `n` is meant to count. Defaults to
36709 * {@link ByteBuffer.METRICS_CHARS}.
36710 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
36711 * read if omitted.
36712 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
36713 * read and the actual number of bytes read.
36714 * @expose
36715 */
36716 ByteBufferPrototype.readString = ByteBufferPrototype.readUTF8String;
36717
36718 // types/strings/vstring
36719
36720 /**
36721 * Writes a length as varint32 prefixed UTF8 encoded string.
36722 * @param {string} str String to write
36723 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
36724 * written if omitted.
36725 * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written
36726 * @expose
36727 * @see ByteBuffer#writeVarint32
36728 */
36729 ByteBufferPrototype.writeVString = function(str, offset) {
36730 var relative = typeof offset === 'undefined';
36731 if (relative) offset = this.offset;
36732 if (!this.noAssert) {
36733 if (typeof str !== 'string')
36734 throw TypeError("Illegal str: Not a string");
36735 if (typeof offset !== 'number' || offset % 1 !== 0)
36736 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36737 offset >>>= 0;
36738 if (offset < 0 || offset + 0 > this.buffer.byteLength)
36739 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
36740 }
36741 var start = offset,
36742 k, l;
36743 k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1];
36744 l = ByteBuffer.calculateVarint32(k);
36745 offset += l+k;
36746 var capacity15 = this.buffer.byteLength;
36747 if (offset > capacity15)
36748 this.resize((capacity15 *= 2) > offset ? capacity15 : offset);
36749 offset -= l+k;
36750 offset += this.writeVarint32(k, offset);
36751 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
36752 this.view[offset++] = b;
36753 }.bind(this));
36754 if (offset !== start+k+l)
36755 throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+k+l));
36756 if (relative) {
36757 this.offset = offset;
36758 return this;
36759 }
36760 return offset - start;
36761 };
36762
36763 /**
36764 * Reads a length as varint32 prefixed UTF8 encoded string.
36765 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
36766 * read if omitted.
36767 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
36768 * read and the actual number of bytes read.
36769 * @expose
36770 * @see ByteBuffer#readVarint32
36771 */
36772 ByteBufferPrototype.readVString = function(offset) {
36773 var relative = typeof offset === 'undefined';
36774 if (relative) offset = this.offset;
36775 if (!this.noAssert) {
36776 if (typeof offset !== 'number' || offset % 1 !== 0)
36777 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36778 offset >>>= 0;
36779 if (offset < 0 || offset + 1 > this.buffer.byteLength)
36780 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
36781 }
36782 var start = offset;
36783 var len = this.readVarint32(offset);
36784 var str = this.readUTF8String(len['value'], ByteBuffer.METRICS_BYTES, offset += len['length']);
36785 offset += str['length'];
36786 if (relative) {
36787 this.offset = offset;
36788 return str['string'];
36789 } else {
36790 return {
36791 'string': str['string'],
36792 'length': offset - start
36793 };
36794 }
36795 };
36796
36797
36798 /**
36799 * Appends some data to this ByteBuffer. This will overwrite any contents behind the specified offset up to the appended
36800 * data's length.
36801 * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to append. If `source` is a ByteBuffer, its offsets
36802 * will be modified according to the performed read operation.
36803 * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
36804 * @param {number=} offset Offset to append at. Will use and increase {@link ByteBuffer#offset} by the number of bytes
36805 * written if omitted.
36806 * @returns {!ByteBuffer} this
36807 * @expose
36808 * @example A relative `<01 02>03.append(<04 05>)` will result in `<01 02 04 05>, 04 05|`
36809 * @example An absolute `<01 02>03.append(04 05>, 1)` will result in `<01 04>05, 04 05|`
36810 */
36811 ByteBufferPrototype.append = function(source, encoding, offset) {
36812 if (typeof encoding === 'number' || typeof encoding !== 'string') {
36813 offset = encoding;
36814 encoding = undefined;
36815 }
36816 var relative = typeof offset === 'undefined';
36817 if (relative) offset = this.offset;
36818 if (!this.noAssert) {
36819 if (typeof offset !== 'number' || offset % 1 !== 0)
36820 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36821 offset >>>= 0;
36822 if (offset < 0 || offset + 0 > this.buffer.byteLength)
36823 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
36824 }
36825 if (!(source instanceof ByteBuffer))
36826 source = ByteBuffer.wrap(source, encoding);
36827 var length = source.limit - source.offset;
36828 if (length <= 0) return this; // Nothing to append
36829 offset += length;
36830 var capacity16 = this.buffer.byteLength;
36831 if (offset > capacity16)
36832 this.resize((capacity16 *= 2) > offset ? capacity16 : offset);
36833 offset -= length;
36834 this.view.set(source.view.subarray(source.offset, source.limit), offset);
36835 source.offset += length;
36836 if (relative) this.offset += length;
36837 return this;
36838 };
36839
36840 /**
36841 * Appends this ByteBuffer's contents to another ByteBuffer. This will overwrite any contents at and after the
36842 specified offset up to the length of this ByteBuffer's data.
36843 * @param {!ByteBuffer} target Target ByteBuffer
36844 * @param {number=} offset Offset to append to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
36845 * read if omitted.
36846 * @returns {!ByteBuffer} this
36847 * @expose
36848 * @see ByteBuffer#append
36849 */
36850 ByteBufferPrototype.appendTo = function(target, offset) {
36851 target.append(this, offset);
36852 return this;
36853 };
36854
36855 /**
36856 * Enables or disables assertions of argument types and offsets. Assertions are enabled by default but you can opt to
36857 * disable them if your code already makes sure that everything is valid.
36858 * @param {boolean} assert `true` to enable assertions, otherwise `false`
36859 * @returns {!ByteBuffer} this
36860 * @expose
36861 */
36862 ByteBufferPrototype.assert = function(assert) {
36863 this.noAssert = !assert;
36864 return this;
36865 };
36866
36867 /**
36868 * Gets the capacity of this ByteBuffer's backing buffer.
36869 * @returns {number} Capacity of the backing buffer
36870 * @expose
36871 */
36872 ByteBufferPrototype.capacity = function() {
36873 return this.buffer.byteLength;
36874 };
36875 /**
36876 * Clears this ByteBuffer's offsets by setting {@link ByteBuffer#offset} to `0` and {@link ByteBuffer#limit} to the
36877 * backing buffer's capacity. Discards {@link ByteBuffer#markedOffset}.
36878 * @returns {!ByteBuffer} this
36879 * @expose
36880 */
36881 ByteBufferPrototype.clear = function() {
36882 this.offset = 0;
36883 this.limit = this.buffer.byteLength;
36884 this.markedOffset = -1;
36885 return this;
36886 };
36887
36888 /**
36889 * Creates a cloned instance of this ByteBuffer, preset with this ByteBuffer's values for {@link ByteBuffer#offset},
36890 * {@link ByteBuffer#markedOffset} and {@link ByteBuffer#limit}.
36891 * @param {boolean=} copy Whether to copy the backing buffer or to return another view on the same, defaults to `false`
36892 * @returns {!ByteBuffer} Cloned instance
36893 * @expose
36894 */
36895 ByteBufferPrototype.clone = function(copy) {
36896 var bb = new ByteBuffer(0, this.littleEndian, this.noAssert);
36897 if (copy) {
36898 bb.buffer = new ArrayBuffer(this.buffer.byteLength);
36899 bb.view = new Uint8Array(bb.buffer);
36900 } else {
36901 bb.buffer = this.buffer;
36902 bb.view = this.view;
36903 }
36904 bb.offset = this.offset;
36905 bb.markedOffset = this.markedOffset;
36906 bb.limit = this.limit;
36907 return bb;
36908 };
36909
36910 /**
36911 * Compacts this ByteBuffer to be backed by a {@link ByteBuffer#buffer} of its contents' length. Contents are the bytes
36912 * between {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. Will set `offset = 0` and `limit = capacity` and
36913 * adapt {@link ByteBuffer#markedOffset} to the same relative position if set.
36914 * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
36915 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
36916 * @returns {!ByteBuffer} this
36917 * @expose
36918 */
36919 ByteBufferPrototype.compact = function(begin, end) {
36920 if (typeof begin === 'undefined') begin = this.offset;
36921 if (typeof end === 'undefined') end = this.limit;
36922 if (!this.noAssert) {
36923 if (typeof begin !== 'number' || begin % 1 !== 0)
36924 throw TypeError("Illegal begin: Not an integer");
36925 begin >>>= 0;
36926 if (typeof end !== 'number' || end % 1 !== 0)
36927 throw TypeError("Illegal end: Not an integer");
36928 end >>>= 0;
36929 if (begin < 0 || begin > end || end > this.buffer.byteLength)
36930 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
36931 }
36932 if (begin === 0 && end === this.buffer.byteLength)
36933 return this; // Already compacted
36934 var len = end - begin;
36935 if (len === 0) {
36936 this.buffer = EMPTY_BUFFER;
36937 this.view = null;
36938 if (this.markedOffset >= 0) this.markedOffset -= begin;
36939 this.offset = 0;
36940 this.limit = 0;
36941 return this;
36942 }
36943 var buffer = new ArrayBuffer(len);
36944 var view = new Uint8Array(buffer);
36945 view.set(this.view.subarray(begin, end));
36946 this.buffer = buffer;
36947 this.view = view;
36948 if (this.markedOffset >= 0) this.markedOffset -= begin;
36949 this.offset = 0;
36950 this.limit = len;
36951 return this;
36952 };
36953
36954 /**
36955 * Creates a copy of this ByteBuffer's contents. Contents are the bytes between {@link ByteBuffer#offset} and
36956 * {@link ByteBuffer#limit}.
36957 * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
36958 * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
36959 * @returns {!ByteBuffer} Copy
36960 * @expose
36961 */
36962 ByteBufferPrototype.copy = function(begin, end) {
36963 if (typeof begin === 'undefined') begin = this.offset;
36964 if (typeof end === 'undefined') end = this.limit;
36965 if (!this.noAssert) {
36966 if (typeof begin !== 'number' || begin % 1 !== 0)
36967 throw TypeError("Illegal begin: Not an integer");
36968 begin >>>= 0;
36969 if (typeof end !== 'number' || end % 1 !== 0)
36970 throw TypeError("Illegal end: Not an integer");
36971 end >>>= 0;
36972 if (begin < 0 || begin > end || end > this.buffer.byteLength)
36973 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
36974 }
36975 if (begin === end)
36976 return new ByteBuffer(0, this.littleEndian, this.noAssert);
36977 var capacity = end - begin,
36978 bb = new ByteBuffer(capacity, this.littleEndian, this.noAssert);
36979 bb.offset = 0;
36980 bb.limit = capacity;
36981 if (bb.markedOffset >= 0) bb.markedOffset -= begin;
36982 this.copyTo(bb, 0, begin, end);
36983 return bb;
36984 };
36985
36986 /**
36987 * Copies this ByteBuffer's contents to another ByteBuffer. Contents are the bytes between {@link ByteBuffer#offset} and
36988 * {@link ByteBuffer#limit}.
36989 * @param {!ByteBuffer} target Target ByteBuffer
36990 * @param {number=} targetOffset Offset to copy to. Will use and increase the target's {@link ByteBuffer#offset}
36991 * by the number of bytes copied if omitted.
36992 * @param {number=} sourceOffset Offset to start copying from. Will use and increase {@link ByteBuffer#offset} by the
36993 * number of bytes copied if omitted.
36994 * @param {number=} sourceLimit Offset to end copying from, defaults to {@link ByteBuffer#limit}
36995 * @returns {!ByteBuffer} this
36996 * @expose
36997 */
36998 ByteBufferPrototype.copyTo = function(target, targetOffset, sourceOffset, sourceLimit) {
36999 var relative,
37000 targetRelative;
37001 if (!this.noAssert) {
37002 if (!ByteBuffer.isByteBuffer(target))
37003 throw TypeError("Illegal target: Not a ByteBuffer");
37004 }
37005 targetOffset = (targetRelative = typeof targetOffset === 'undefined') ? target.offset : targetOffset | 0;
37006 sourceOffset = (relative = typeof sourceOffset === 'undefined') ? this.offset : sourceOffset | 0;
37007 sourceLimit = typeof sourceLimit === 'undefined' ? this.limit : sourceLimit | 0;
37008
37009 if (targetOffset < 0 || targetOffset > target.buffer.byteLength)
37010 throw RangeError("Illegal target range: 0 <= "+targetOffset+" <= "+target.buffer.byteLength);
37011 if (sourceOffset < 0 || sourceLimit > this.buffer.byteLength)
37012 throw RangeError("Illegal source range: 0 <= "+sourceOffset+" <= "+this.buffer.byteLength);
37013
37014 var len = sourceLimit - sourceOffset;
37015 if (len === 0)
37016 return target; // Nothing to copy
37017
37018 target.ensureCapacity(targetOffset + len);
37019
37020 target.view.set(this.view.subarray(sourceOffset, sourceLimit), targetOffset);
37021
37022 if (relative) this.offset += len;
37023 if (targetRelative) target.offset += len;
37024
37025 return this;
37026 };
37027
37028 /**
37029 * Makes sure that this ByteBuffer is backed by a {@link ByteBuffer#buffer} of at least the specified capacity. If the
37030 * current capacity is exceeded, it will be doubled. If double the current capacity is less than the required capacity,
37031 * the required capacity will be used instead.
37032 * @param {number} capacity Required capacity
37033 * @returns {!ByteBuffer} this
37034 * @expose
37035 */
37036 ByteBufferPrototype.ensureCapacity = function(capacity) {
37037 var current = this.buffer.byteLength;
37038 if (current < capacity)
37039 return this.resize((current *= 2) > capacity ? current : capacity);
37040 return this;
37041 };
37042
37043 /**
37044 * Overwrites this ByteBuffer's contents with the specified value. Contents are the bytes between
37045 * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
37046 * @param {number|string} value Byte value to fill with. If given as a string, the first character is used.
37047 * @param {number=} begin Begin offset. Will use and increase {@link ByteBuffer#offset} by the number of bytes
37048 * written if omitted. defaults to {@link ByteBuffer#offset}.
37049 * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
37050 * @returns {!ByteBuffer} this
37051 * @expose
37052 * @example `someByteBuffer.clear().fill(0)` fills the entire backing buffer with zeroes
37053 */
37054 ByteBufferPrototype.fill = function(value, begin, end) {
37055 var relative = typeof begin === 'undefined';
37056 if (relative) begin = this.offset;
37057 if (typeof value === 'string' && value.length > 0)
37058 value = value.charCodeAt(0);
37059 if (typeof begin === 'undefined') begin = this.offset;
37060 if (typeof end === 'undefined') end = this.limit;
37061 if (!this.noAssert) {
37062 if (typeof value !== 'number' || value % 1 !== 0)
37063 throw TypeError("Illegal value: "+value+" (not an integer)");
37064 value |= 0;
37065 if (typeof begin !== 'number' || begin % 1 !== 0)
37066 throw TypeError("Illegal begin: Not an integer");
37067 begin >>>= 0;
37068 if (typeof end !== 'number' || end % 1 !== 0)
37069 throw TypeError("Illegal end: Not an integer");
37070 end >>>= 0;
37071 if (begin < 0 || begin > end || end > this.buffer.byteLength)
37072 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
37073 }
37074 if (begin >= end)
37075 return this; // Nothing to fill
37076 while (begin < end) this.view[begin++] = value;
37077 if (relative) this.offset = begin;
37078 return this;
37079 };
37080
37081 /**
37082 * Makes this ByteBuffer ready for a new sequence of write or relative read operations. Sets `limit = offset` and
37083 * `offset = 0`. Make sure always to flip a ByteBuffer when all relative read or write operations are complete.
37084 * @returns {!ByteBuffer} this
37085 * @expose
37086 */
37087 ByteBufferPrototype.flip = function() {
37088 this.limit = this.offset;
37089 this.offset = 0;
37090 return this;
37091 };
37092 /**
37093 * Marks an offset on this ByteBuffer to be used later.
37094 * @param {number=} offset Offset to mark. Defaults to {@link ByteBuffer#offset}.
37095 * @returns {!ByteBuffer} this
37096 * @throws {TypeError} If `offset` is not a valid number
37097 * @throws {RangeError} If `offset` is out of bounds
37098 * @see ByteBuffer#reset
37099 * @expose
37100 */
37101 ByteBufferPrototype.mark = function(offset) {
37102 offset = typeof offset === 'undefined' ? this.offset : offset;
37103 if (!this.noAssert) {
37104 if (typeof offset !== 'number' || offset % 1 !== 0)
37105 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37106 offset >>>= 0;
37107 if (offset < 0 || offset + 0 > this.buffer.byteLength)
37108 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
37109 }
37110 this.markedOffset = offset;
37111 return this;
37112 };
37113 /**
37114 * Sets the byte order.
37115 * @param {boolean} littleEndian `true` for little endian byte order, `false` for big endian
37116 * @returns {!ByteBuffer} this
37117 * @expose
37118 */
37119 ByteBufferPrototype.order = function(littleEndian) {
37120 if (!this.noAssert) {
37121 if (typeof littleEndian !== 'boolean')
37122 throw TypeError("Illegal littleEndian: Not a boolean");
37123 }
37124 this.littleEndian = !!littleEndian;
37125 return this;
37126 };
37127
37128 /**
37129 * Switches (to) little endian byte order.
37130 * @param {boolean=} littleEndian Defaults to `true`, otherwise uses big endian
37131 * @returns {!ByteBuffer} this
37132 * @expose
37133 */
37134 ByteBufferPrototype.LE = function(littleEndian) {
37135 this.littleEndian = typeof littleEndian !== 'undefined' ? !!littleEndian : true;
37136 return this;
37137 };
37138
37139 /**
37140 * Switches (to) big endian byte order.
37141 * @param {boolean=} bigEndian Defaults to `true`, otherwise uses little endian
37142 * @returns {!ByteBuffer} this
37143 * @expose
37144 */
37145 ByteBufferPrototype.BE = function(bigEndian) {
37146 this.littleEndian = typeof bigEndian !== 'undefined' ? !bigEndian : false;
37147 return this;
37148 };
37149 /**
37150 * Prepends some data to this ByteBuffer. This will overwrite any contents before the specified offset up to the
37151 * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
37152 * will be resized and its contents moved accordingly.
37153 * @param {!ByteBuffer|string|!ArrayBuffer} source Data to prepend. If `source` is a ByteBuffer, its offset will be
37154 * modified according to the performed read operation.
37155 * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
37156 * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
37157 * prepended if omitted.
37158 * @returns {!ByteBuffer} this
37159 * @expose
37160 * @example A relative `00<01 02 03>.prepend(<04 05>)` results in `<04 05 01 02 03>, 04 05|`
37161 * @example An absolute `00<01 02 03>.prepend(<04 05>, 2)` results in `04<05 02 03>, 04 05|`
37162 */
37163 ByteBufferPrototype.prepend = function(source, encoding, offset) {
37164 if (typeof encoding === 'number' || typeof encoding !== 'string') {
37165 offset = encoding;
37166 encoding = undefined;
37167 }
37168 var relative = typeof offset === 'undefined';
37169 if (relative) offset = this.offset;
37170 if (!this.noAssert) {
37171 if (typeof offset !== 'number' || offset % 1 !== 0)
37172 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37173 offset >>>= 0;
37174 if (offset < 0 || offset + 0 > this.buffer.byteLength)
37175 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
37176 }
37177 if (!(source instanceof ByteBuffer))
37178 source = ByteBuffer.wrap(source, encoding);
37179 var len = source.limit - source.offset;
37180 if (len <= 0) return this; // Nothing to prepend
37181 var diff = len - offset;
37182 if (diff > 0) { // Not enough space before offset, so resize + move
37183 var buffer = new ArrayBuffer(this.buffer.byteLength + diff);
37184 var view = new Uint8Array(buffer);
37185 view.set(this.view.subarray(offset, this.buffer.byteLength), len);
37186 this.buffer = buffer;
37187 this.view = view;
37188 this.offset += diff;
37189 if (this.markedOffset >= 0) this.markedOffset += diff;
37190 this.limit += diff;
37191 offset += diff;
37192 } else {
37193 var arrayView = new Uint8Array(this.buffer);
37194 }
37195 this.view.set(source.view.subarray(source.offset, source.limit), offset - len);
37196
37197 source.offset = source.limit;
37198 if (relative)
37199 this.offset -= len;
37200 return this;
37201 };
37202
37203 /**
37204 * Prepends this ByteBuffer to another ByteBuffer. This will overwrite any contents before the specified offset up to the
37205 * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
37206 * will be resized and its contents moved accordingly.
37207 * @param {!ByteBuffer} target Target ByteBuffer
37208 * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
37209 * prepended if omitted.
37210 * @returns {!ByteBuffer} this
37211 * @expose
37212 * @see ByteBuffer#prepend
37213 */
37214 ByteBufferPrototype.prependTo = function(target, offset) {
37215 target.prepend(this, offset);
37216 return this;
37217 };
37218 /**
37219 * Prints debug information about this ByteBuffer's contents.
37220 * @param {function(string)=} out Output function to call, defaults to console.log
37221 * @expose
37222 */
37223 ByteBufferPrototype.printDebug = function(out) {
37224 if (typeof out !== 'function') out = console.log.bind(console);
37225 out(
37226 this.toString()+"\n"+
37227 "-------------------------------------------------------------------\n"+
37228 this.toDebug(/* columns */ true)
37229 );
37230 };
37231
37232 /**
37233 * Gets the number of remaining readable bytes. Contents are the bytes between {@link ByteBuffer#offset} and
37234 * {@link ByteBuffer#limit}, so this returns `limit - offset`.
37235 * @returns {number} Remaining readable bytes. May be negative if `offset > limit`.
37236 * @expose
37237 */
37238 ByteBufferPrototype.remaining = function() {
37239 return this.limit - this.offset;
37240 };
37241 /**
37242 * Resets this ByteBuffer's {@link ByteBuffer#offset}. If an offset has been marked through {@link ByteBuffer#mark}
37243 * before, `offset` will be set to {@link ByteBuffer#markedOffset}, which will then be discarded. If no offset has been
37244 * marked, sets `offset = 0`.
37245 * @returns {!ByteBuffer} this
37246 * @see ByteBuffer#mark
37247 * @expose
37248 */
37249 ByteBufferPrototype.reset = function() {
37250 if (this.markedOffset >= 0) {
37251 this.offset = this.markedOffset;
37252 this.markedOffset = -1;
37253 } else {
37254 this.offset = 0;
37255 }
37256 return this;
37257 };
37258 /**
37259 * Resizes this ByteBuffer to be backed by a buffer of at least the given capacity. Will do nothing if already that
37260 * large or larger.
37261 * @param {number} capacity Capacity required
37262 * @returns {!ByteBuffer} this
37263 * @throws {TypeError} If `capacity` is not a number
37264 * @throws {RangeError} If `capacity < 0`
37265 * @expose
37266 */
37267 ByteBufferPrototype.resize = function(capacity) {
37268 if (!this.noAssert) {
37269 if (typeof capacity !== 'number' || capacity % 1 !== 0)
37270 throw TypeError("Illegal capacity: "+capacity+" (not an integer)");
37271 capacity |= 0;
37272 if (capacity < 0)
37273 throw RangeError("Illegal capacity: 0 <= "+capacity);
37274 }
37275 if (this.buffer.byteLength < capacity) {
37276 var buffer = new ArrayBuffer(capacity);
37277 var view = new Uint8Array(buffer);
37278 view.set(this.view);
37279 this.buffer = buffer;
37280 this.view = view;
37281 }
37282 return this;
37283 };
37284 /**
37285 * Reverses this ByteBuffer's contents.
37286 * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
37287 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
37288 * @returns {!ByteBuffer} this
37289 * @expose
37290 */
37291 ByteBufferPrototype.reverse = function(begin, end) {
37292 if (typeof begin === 'undefined') begin = this.offset;
37293 if (typeof end === 'undefined') end = this.limit;
37294 if (!this.noAssert) {
37295 if (typeof begin !== 'number' || begin % 1 !== 0)
37296 throw TypeError("Illegal begin: Not an integer");
37297 begin >>>= 0;
37298 if (typeof end !== 'number' || end % 1 !== 0)
37299 throw TypeError("Illegal end: Not an integer");
37300 end >>>= 0;
37301 if (begin < 0 || begin > end || end > this.buffer.byteLength)
37302 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
37303 }
37304 if (begin === end)
37305 return this; // Nothing to reverse
37306 Array.prototype.reverse.call(this.view.subarray(begin, end));
37307 return this;
37308 };
37309 /**
37310 * Skips the next `length` bytes. This will just advance
37311 * @param {number} length Number of bytes to skip. May also be negative to move the offset back.
37312 * @returns {!ByteBuffer} this
37313 * @expose
37314 */
37315 ByteBufferPrototype.skip = function(length) {
37316 if (!this.noAssert) {
37317 if (typeof length !== 'number' || length % 1 !== 0)
37318 throw TypeError("Illegal length: "+length+" (not an integer)");
37319 length |= 0;
37320 }
37321 var offset = this.offset + length;
37322 if (!this.noAssert) {
37323 if (offset < 0 || offset > this.buffer.byteLength)
37324 throw RangeError("Illegal length: 0 <= "+this.offset+" + "+length+" <= "+this.buffer.byteLength);
37325 }
37326 this.offset = offset;
37327 return this;
37328 };
37329
37330 /**
37331 * Slices this ByteBuffer by creating a cloned instance with `offset = begin` and `limit = end`.
37332 * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
37333 * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
37334 * @returns {!ByteBuffer} Clone of this ByteBuffer with slicing applied, backed by the same {@link ByteBuffer#buffer}
37335 * @expose
37336 */
37337 ByteBufferPrototype.slice = function(begin, end) {
37338 if (typeof begin === 'undefined') begin = this.offset;
37339 if (typeof end === 'undefined') end = this.limit;
37340 if (!this.noAssert) {
37341 if (typeof begin !== 'number' || begin % 1 !== 0)
37342 throw TypeError("Illegal begin: Not an integer");
37343 begin >>>= 0;
37344 if (typeof end !== 'number' || end % 1 !== 0)
37345 throw TypeError("Illegal end: Not an integer");
37346 end >>>= 0;
37347 if (begin < 0 || begin > end || end > this.buffer.byteLength)
37348 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
37349 }
37350 var bb = this.clone();
37351 bb.offset = begin;
37352 bb.limit = end;
37353 return bb;
37354 };
37355 /**
37356 * Returns a copy of the backing buffer that contains this ByteBuffer's contents. Contents are the bytes between
37357 * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
37358 * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory if
37359 * possible. Defaults to `false`
37360 * @returns {!ArrayBuffer} Contents as an ArrayBuffer
37361 * @expose
37362 */
37363 ByteBufferPrototype.toBuffer = function(forceCopy) {
37364 var offset = this.offset,
37365 limit = this.limit;
37366 if (!this.noAssert) {
37367 if (typeof offset !== 'number' || offset % 1 !== 0)
37368 throw TypeError("Illegal offset: Not an integer");
37369 offset >>>= 0;
37370 if (typeof limit !== 'number' || limit % 1 !== 0)
37371 throw TypeError("Illegal limit: Not an integer");
37372 limit >>>= 0;
37373 if (offset < 0 || offset > limit || limit > this.buffer.byteLength)
37374 throw RangeError("Illegal range: 0 <= "+offset+" <= "+limit+" <= "+this.buffer.byteLength);
37375 }
37376 // NOTE: It's not possible to have another ArrayBuffer reference the same memory as the backing buffer. This is
37377 // possible with Uint8Array#subarray only, but we have to return an ArrayBuffer by contract. So:
37378 if (!forceCopy && offset === 0 && limit === this.buffer.byteLength)
37379 return this.buffer;
37380 if (offset === limit)
37381 return EMPTY_BUFFER;
37382 var buffer = new ArrayBuffer(limit - offset);
37383 new Uint8Array(buffer).set(new Uint8Array(this.buffer).subarray(offset, limit), 0);
37384 return buffer;
37385 };
37386
37387 /**
37388 * Returns a raw buffer compacted to contain this ByteBuffer's contents. Contents are the bytes between
37389 * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. This is an alias of {@link ByteBuffer#toBuffer}.
37390 * @function
37391 * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory.
37392 * Defaults to `false`
37393 * @returns {!ArrayBuffer} Contents as an ArrayBuffer
37394 * @expose
37395 */
37396 ByteBufferPrototype.toArrayBuffer = ByteBufferPrototype.toBuffer;
37397
37398 /**
37399 * Converts the ByteBuffer's contents to a string.
37400 * @param {string=} encoding Output encoding. Returns an informative string representation if omitted but also allows
37401 * direct conversion to "utf8", "hex", "base64" and "binary" encoding. "debug" returns a hex representation with
37402 * highlighted offsets.
37403 * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}
37404 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
37405 * @returns {string} String representation
37406 * @throws {Error} If `encoding` is invalid
37407 * @expose
37408 */
37409 ByteBufferPrototype.toString = function(encoding, begin, end) {
37410 if (typeof encoding === 'undefined')
37411 return "ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";
37412 if (typeof encoding === 'number')
37413 encoding = "utf8",
37414 begin = encoding,
37415 end = begin;
37416 switch (encoding) {
37417 case "utf8":
37418 return this.toUTF8(begin, end);
37419 case "base64":
37420 return this.toBase64(begin, end);
37421 case "hex":
37422 return this.toHex(begin, end);
37423 case "binary":
37424 return this.toBinary(begin, end);
37425 case "debug":
37426 return this.toDebug();
37427 case "columns":
37428 return this.toColumns();
37429 default:
37430 throw Error("Unsupported encoding: "+encoding);
37431 }
37432 };
37433
37434 // lxiv-embeddable
37435
37436 /**
37437 * lxiv-embeddable (c) 2014 Daniel Wirtz <dcode@dcode.io>
37438 * Released under the Apache License, Version 2.0
37439 * see: https://github.com/dcodeIO/lxiv for details
37440 */
37441 var lxiv = function() {
37442 "use strict";
37443
37444 /**
37445 * lxiv namespace.
37446 * @type {!Object.<string,*>}
37447 * @exports lxiv
37448 */
37449 var lxiv = {};
37450
37451 /**
37452 * Character codes for output.
37453 * @type {!Array.<number>}
37454 * @inner
37455 */
37456 var aout = [
37457 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
37458 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102,
37459 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
37460 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47
37461 ];
37462
37463 /**
37464 * Character codes for input.
37465 * @type {!Array.<number>}
37466 * @inner
37467 */
37468 var ain = [];
37469 for (var i=0, k=aout.length; i<k; ++i)
37470 ain[aout[i]] = i;
37471
37472 /**
37473 * Encodes bytes to base64 char codes.
37474 * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if
37475 * there are no more bytes left.
37476 * @param {!function(number)} dst Characters destination as a function successively called with each encoded char
37477 * code.
37478 */
37479 lxiv.encode = function(src, dst) {
37480 var b, t;
37481 while ((b = src()) !== null) {
37482 dst(aout[(b>>2)&0x3f]);
37483 t = (b&0x3)<<4;
37484 if ((b = src()) !== null) {
37485 t |= (b>>4)&0xf;
37486 dst(aout[(t|((b>>4)&0xf))&0x3f]);
37487 t = (b&0xf)<<2;
37488 if ((b = src()) !== null)
37489 dst(aout[(t|((b>>6)&0x3))&0x3f]),
37490 dst(aout[b&0x3f]);
37491 else
37492 dst(aout[t&0x3f]),
37493 dst(61);
37494 } else
37495 dst(aout[t&0x3f]),
37496 dst(61),
37497 dst(61);
37498 }
37499 };
37500
37501 /**
37502 * Decodes base64 char codes to bytes.
37503 * @param {!function():number|null} src Characters source as a function returning the next char code respectively
37504 * `null` if there are no more characters left.
37505 * @param {!function(number)} dst Bytes destination as a function successively called with the next byte.
37506 * @throws {Error} If a character code is invalid
37507 */
37508 lxiv.decode = function(src, dst) {
37509 var c, t1, t2;
37510 function fail(c) {
37511 throw Error("Illegal character code: "+c);
37512 }
37513 while ((c = src()) !== null) {
37514 t1 = ain[c];
37515 if (typeof t1 === 'undefined') fail(c);
37516 if ((c = src()) !== null) {
37517 t2 = ain[c];
37518 if (typeof t2 === 'undefined') fail(c);
37519 dst((t1<<2)>>>0|(t2&0x30)>>4);
37520 if ((c = src()) !== null) {
37521 t1 = ain[c];
37522 if (typeof t1 === 'undefined')
37523 if (c === 61) break; else fail(c);
37524 dst(((t2&0xf)<<4)>>>0|(t1&0x3c)>>2);
37525 if ((c = src()) !== null) {
37526 t2 = ain[c];
37527 if (typeof t2 === 'undefined')
37528 if (c === 61) break; else fail(c);
37529 dst(((t1&0x3)<<6)>>>0|t2);
37530 }
37531 }
37532 }
37533 }
37534 };
37535
37536 /**
37537 * Tests if a string is valid base64.
37538 * @param {string} str String to test
37539 * @returns {boolean} `true` if valid, otherwise `false`
37540 */
37541 lxiv.test = function(str) {
37542 return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(str);
37543 };
37544
37545 return lxiv;
37546 }();
37547
37548 // encodings/base64
37549
37550 /**
37551 * Encodes this ByteBuffer's contents to a base64 encoded string.
37552 * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}.
37553 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}.
37554 * @returns {string} Base64 encoded string
37555 * @throws {RangeError} If `begin` or `end` is out of bounds
37556 * @expose
37557 */
37558 ByteBufferPrototype.toBase64 = function(begin, end) {
37559 if (typeof begin === 'undefined')
37560 begin = this.offset;
37561 if (typeof end === 'undefined')
37562 end = this.limit;
37563 begin = begin | 0; end = end | 0;
37564 if (begin < 0 || end > this.capacity || begin > end)
37565 throw RangeError("begin, end");
37566 var sd; lxiv.encode(function() {
37567 return begin < end ? this.view[begin++] : null;
37568 }.bind(this), sd = stringDestination());
37569 return sd();
37570 };
37571
37572 /**
37573 * Decodes a base64 encoded string to a ByteBuffer.
37574 * @param {string} str String to decode
37575 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
37576 * {@link ByteBuffer.DEFAULT_ENDIAN}.
37577 * @returns {!ByteBuffer} ByteBuffer
37578 * @expose
37579 */
37580 ByteBuffer.fromBase64 = function(str, littleEndian) {
37581 if (typeof str !== 'string')
37582 throw TypeError("str");
37583 var bb = new ByteBuffer(str.length/4*3, littleEndian),
37584 i = 0;
37585 lxiv.decode(stringSource(str), function(b) {
37586 bb.view[i++] = b;
37587 });
37588 bb.limit = i;
37589 return bb;
37590 };
37591
37592 /**
37593 * Encodes a binary string to base64 like `window.btoa` does.
37594 * @param {string} str Binary string
37595 * @returns {string} Base64 encoded string
37596 * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.btoa
37597 * @expose
37598 */
37599 ByteBuffer.btoa = function(str) {
37600 return ByteBuffer.fromBinary(str).toBase64();
37601 };
37602
37603 /**
37604 * Decodes a base64 encoded string to binary like `window.atob` does.
37605 * @param {string} b64 Base64 encoded string
37606 * @returns {string} Binary string
37607 * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.atob
37608 * @expose
37609 */
37610 ByteBuffer.atob = function(b64) {
37611 return ByteBuffer.fromBase64(b64).toBinary();
37612 };
37613
37614 // encodings/binary
37615
37616 /**
37617 * Encodes this ByteBuffer to a binary encoded string, that is using only characters 0x00-0xFF as bytes.
37618 * @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
37619 * @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
37620 * @returns {string} Binary encoded string
37621 * @throws {RangeError} If `offset > limit`
37622 * @expose
37623 */
37624 ByteBufferPrototype.toBinary = function(begin, end) {
37625 if (typeof begin === 'undefined')
37626 begin = this.offset;
37627 if (typeof end === 'undefined')
37628 end = this.limit;
37629 begin |= 0; end |= 0;
37630 if (begin < 0 || end > this.capacity() || begin > end)
37631 throw RangeError("begin, end");
37632 if (begin === end)
37633 return "";
37634 var chars = [],
37635 parts = [];
37636 while (begin < end) {
37637 chars.push(this.view[begin++]);
37638 if (chars.length >= 1024)
37639 parts.push(String.fromCharCode.apply(String, chars)),
37640 chars = [];
37641 }
37642 return parts.join('') + String.fromCharCode.apply(String, chars);
37643 };
37644
37645 /**
37646 * Decodes a binary encoded string, that is using only characters 0x00-0xFF as bytes, to a ByteBuffer.
37647 * @param {string} str String to decode
37648 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
37649 * {@link ByteBuffer.DEFAULT_ENDIAN}.
37650 * @returns {!ByteBuffer} ByteBuffer
37651 * @expose
37652 */
37653 ByteBuffer.fromBinary = function(str, littleEndian) {
37654 if (typeof str !== 'string')
37655 throw TypeError("str");
37656 var i = 0,
37657 k = str.length,
37658 charCode,
37659 bb = new ByteBuffer(k, littleEndian);
37660 while (i<k) {
37661 charCode = str.charCodeAt(i);
37662 if (charCode > 0xff)
37663 throw RangeError("illegal char code: "+charCode);
37664 bb.view[i++] = charCode;
37665 }
37666 bb.limit = k;
37667 return bb;
37668 };
37669
37670 // encodings/debug
37671
37672 /**
37673 * Encodes this ByteBuffer to a hex encoded string with marked offsets. Offset symbols are:
37674 * * `<` : offset,
37675 * * `'` : markedOffset,
37676 * * `>` : limit,
37677 * * `|` : offset and limit,
37678 * * `[` : offset and markedOffset,
37679 * * `]` : markedOffset and limit,
37680 * * `!` : offset, markedOffset and limit
37681 * @param {boolean=} columns If `true` returns two columns hex + ascii, defaults to `false`
37682 * @returns {string|!Array.<string>} Debug string or array of lines if `asArray = true`
37683 * @expose
37684 * @example `>00'01 02<03` contains four bytes with `limit=0, markedOffset=1, offset=3`
37685 * @example `00[01 02 03>` contains four bytes with `offset=markedOffset=1, limit=4`
37686 * @example `00|01 02 03` contains four bytes with `offset=limit=1, markedOffset=-1`
37687 * @example `|` contains zero bytes with `offset=limit=0, markedOffset=-1`
37688 */
37689 ByteBufferPrototype.toDebug = function(columns) {
37690 var i = -1,
37691 k = this.buffer.byteLength,
37692 b,
37693 hex = "",
37694 asc = "",
37695 out = "";
37696 while (i<k) {
37697 if (i !== -1) {
37698 b = this.view[i];
37699 if (b < 0x10) hex += "0"+b.toString(16).toUpperCase();
37700 else hex += b.toString(16).toUpperCase();
37701 if (columns)
37702 asc += b > 32 && b < 127 ? String.fromCharCode(b) : '.';
37703 }
37704 ++i;
37705 if (columns) {
37706 if (i > 0 && i % 16 === 0 && i !== k) {
37707 while (hex.length < 3*16+3) hex += " ";
37708 out += hex+asc+"\n";
37709 hex = asc = "";
37710 }
37711 }
37712 if (i === this.offset && i === this.limit)
37713 hex += i === this.markedOffset ? "!" : "|";
37714 else if (i === this.offset)
37715 hex += i === this.markedOffset ? "[" : "<";
37716 else if (i === this.limit)
37717 hex += i === this.markedOffset ? "]" : ">";
37718 else
37719 hex += i === this.markedOffset ? "'" : (columns || (i !== 0 && i !== k) ? " " : "");
37720 }
37721 if (columns && hex !== " ") {
37722 while (hex.length < 3*16+3)
37723 hex += " ";
37724 out += hex + asc + "\n";
37725 }
37726 return columns ? out : hex;
37727 };
37728
37729 /**
37730 * Decodes a hex encoded string with marked offsets to a ByteBuffer.
37731 * @param {string} str Debug string to decode (not be generated with `columns = true`)
37732 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
37733 * {@link ByteBuffer.DEFAULT_ENDIAN}.
37734 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
37735 * {@link ByteBuffer.DEFAULT_NOASSERT}.
37736 * @returns {!ByteBuffer} ByteBuffer
37737 * @expose
37738 * @see ByteBuffer#toDebug
37739 */
37740 ByteBuffer.fromDebug = function(str, littleEndian, noAssert) {
37741 var k = str.length,
37742 bb = new ByteBuffer(((k+1)/3)|0, littleEndian, noAssert);
37743 var i = 0, j = 0, ch, b,
37744 rs = false, // Require symbol next
37745 ho = false, hm = false, hl = false, // Already has offset (ho), markedOffset (hm), limit (hl)?
37746 fail = false;
37747 while (i<k) {
37748 switch (ch = str.charAt(i++)) {
37749 case '!':
37750 if (!noAssert) {
37751 if (ho || hm || hl) {
37752 fail = true;
37753 break;
37754 }
37755 ho = hm = hl = true;
37756 }
37757 bb.offset = bb.markedOffset = bb.limit = j;
37758 rs = false;
37759 break;
37760 case '|':
37761 if (!noAssert) {
37762 if (ho || hl) {
37763 fail = true;
37764 break;
37765 }
37766 ho = hl = true;
37767 }
37768 bb.offset = bb.limit = j;
37769 rs = false;
37770 break;
37771 case '[':
37772 if (!noAssert) {
37773 if (ho || hm) {
37774 fail = true;
37775 break;
37776 }
37777 ho = hm = true;
37778 }
37779 bb.offset = bb.markedOffset = j;
37780 rs = false;
37781 break;
37782 case '<':
37783 if (!noAssert) {
37784 if (ho) {
37785 fail = true;
37786 break;
37787 }
37788 ho = true;
37789 }
37790 bb.offset = j;
37791 rs = false;
37792 break;
37793 case ']':
37794 if (!noAssert) {
37795 if (hl || hm) {
37796 fail = true;
37797 break;
37798 }
37799 hl = hm = true;
37800 }
37801 bb.limit = bb.markedOffset = j;
37802 rs = false;
37803 break;
37804 case '>':
37805 if (!noAssert) {
37806 if (hl) {
37807 fail = true;
37808 break;
37809 }
37810 hl = true;
37811 }
37812 bb.limit = j;
37813 rs = false;
37814 break;
37815 case "'":
37816 if (!noAssert) {
37817 if (hm) {
37818 fail = true;
37819 break;
37820 }
37821 hm = true;
37822 }
37823 bb.markedOffset = j;
37824 rs = false;
37825 break;
37826 case ' ':
37827 rs = false;
37828 break;
37829 default:
37830 if (!noAssert) {
37831 if (rs) {
37832 fail = true;
37833 break;
37834 }
37835 }
37836 b = parseInt(ch+str.charAt(i++), 16);
37837 if (!noAssert) {
37838 if (isNaN(b) || b < 0 || b > 255)
37839 throw TypeError("Illegal str: Not a debug encoded string");
37840 }
37841 bb.view[j++] = b;
37842 rs = true;
37843 }
37844 if (fail)
37845 throw TypeError("Illegal str: Invalid symbol at "+i);
37846 }
37847 if (!noAssert) {
37848 if (!ho || !hl)
37849 throw TypeError("Illegal str: Missing offset or limit");
37850 if (j<bb.buffer.byteLength)
37851 throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+j+" < "+k);
37852 }
37853 return bb;
37854 };
37855
37856 // encodings/hex
37857
37858 /**
37859 * Encodes this ByteBuffer's contents to a hex encoded string.
37860 * @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
37861 * @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
37862 * @returns {string} Hex encoded string
37863 * @expose
37864 */
37865 ByteBufferPrototype.toHex = function(begin, end) {
37866 begin = typeof begin === 'undefined' ? this.offset : begin;
37867 end = typeof end === 'undefined' ? this.limit : end;
37868 if (!this.noAssert) {
37869 if (typeof begin !== 'number' || begin % 1 !== 0)
37870 throw TypeError("Illegal begin: Not an integer");
37871 begin >>>= 0;
37872 if (typeof end !== 'number' || end % 1 !== 0)
37873 throw TypeError("Illegal end: Not an integer");
37874 end >>>= 0;
37875 if (begin < 0 || begin > end || end > this.buffer.byteLength)
37876 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
37877 }
37878 var out = new Array(end - begin),
37879 b;
37880 while (begin < end) {
37881 b = this.view[begin++];
37882 if (b < 0x10)
37883 out.push("0", b.toString(16));
37884 else out.push(b.toString(16));
37885 }
37886 return out.join('');
37887 };
37888
37889 /**
37890 * Decodes a hex encoded string to a ByteBuffer.
37891 * @param {string} str String to decode
37892 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
37893 * {@link ByteBuffer.DEFAULT_ENDIAN}.
37894 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
37895 * {@link ByteBuffer.DEFAULT_NOASSERT}.
37896 * @returns {!ByteBuffer} ByteBuffer
37897 * @expose
37898 */
37899 ByteBuffer.fromHex = function(str, littleEndian, noAssert) {
37900 if (!noAssert) {
37901 if (typeof str !== 'string')
37902 throw TypeError("Illegal str: Not a string");
37903 if (str.length % 2 !== 0)
37904 throw TypeError("Illegal str: Length not a multiple of 2");
37905 }
37906 var k = str.length,
37907 bb = new ByteBuffer((k / 2) | 0, littleEndian),
37908 b;
37909 for (var i=0, j=0; i<k; i+=2) {
37910 b = parseInt(str.substring(i, i+2), 16);
37911 if (!noAssert)
37912 if (!isFinite(b) || b < 0 || b > 255)
37913 throw TypeError("Illegal str: Contains non-hex characters");
37914 bb.view[j++] = b;
37915 }
37916 bb.limit = j;
37917 return bb;
37918 };
37919
37920 // utfx-embeddable
37921
37922 /**
37923 * utfx-embeddable (c) 2014 Daniel Wirtz <dcode@dcode.io>
37924 * Released under the Apache License, Version 2.0
37925 * see: https://github.com/dcodeIO/utfx for details
37926 */
37927 var utfx = function() {
37928 "use strict";
37929
37930 /**
37931 * utfx namespace.
37932 * @inner
37933 * @type {!Object.<string,*>}
37934 */
37935 var utfx = {};
37936
37937 /**
37938 * Maximum valid code point.
37939 * @type {number}
37940 * @const
37941 */
37942 utfx.MAX_CODEPOINT = 0x10FFFF;
37943
37944 /**
37945 * Encodes UTF8 code points to UTF8 bytes.
37946 * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
37947 * respectively `null` if there are no more code points left or a single numeric code point.
37948 * @param {!function(number)} dst Bytes destination as a function successively called with the next byte
37949 */
37950 utfx.encodeUTF8 = function(src, dst) {
37951 var cp = null;
37952 if (typeof src === 'number')
37953 cp = src,
37954 src = function() { return null; };
37955 while (cp !== null || (cp = src()) !== null) {
37956 if (cp < 0x80)
37957 dst(cp&0x7F);
37958 else if (cp < 0x800)
37959 dst(((cp>>6)&0x1F)|0xC0),
37960 dst((cp&0x3F)|0x80);
37961 else if (cp < 0x10000)
37962 dst(((cp>>12)&0x0F)|0xE0),
37963 dst(((cp>>6)&0x3F)|0x80),
37964 dst((cp&0x3F)|0x80);
37965 else
37966 dst(((cp>>18)&0x07)|0xF0),
37967 dst(((cp>>12)&0x3F)|0x80),
37968 dst(((cp>>6)&0x3F)|0x80),
37969 dst((cp&0x3F)|0x80);
37970 cp = null;
37971 }
37972 };
37973
37974 /**
37975 * Decodes UTF8 bytes to UTF8 code points.
37976 * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
37977 * are no more bytes left.
37978 * @param {!function(number)} dst Code points destination as a function successively called with each decoded code point.
37979 * @throws {RangeError} If a starting byte is invalid in UTF8
37980 * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the
37981 * remaining bytes.
37982 */
37983 utfx.decodeUTF8 = function(src, dst) {
37984 var a, b, c, d, fail = function(b) {
37985 b = b.slice(0, b.indexOf(null));
37986 var err = Error(b.toString());
37987 err.name = "TruncatedError";
37988 err['bytes'] = b;
37989 throw err;
37990 };
37991 while ((a = src()) !== null) {
37992 if ((a&0x80) === 0)
37993 dst(a);
37994 else if ((a&0xE0) === 0xC0)
37995 ((b = src()) === null) && fail([a, b]),
37996 dst(((a&0x1F)<<6) | (b&0x3F));
37997 else if ((a&0xF0) === 0xE0)
37998 ((b=src()) === null || (c=src()) === null) && fail([a, b, c]),
37999 dst(((a&0x0F)<<12) | ((b&0x3F)<<6) | (c&0x3F));
38000 else if ((a&0xF8) === 0xF0)
38001 ((b=src()) === null || (c=src()) === null || (d=src()) === null) && fail([a, b, c ,d]),
38002 dst(((a&0x07)<<18) | ((b&0x3F)<<12) | ((c&0x3F)<<6) | (d&0x3F));
38003 else throw RangeError("Illegal starting byte: "+a);
38004 }
38005 };
38006
38007 /**
38008 * Converts UTF16 characters to UTF8 code points.
38009 * @param {!function():number|null} src Characters source as a function returning the next char code respectively
38010 * `null` if there are no more characters left.
38011 * @param {!function(number)} dst Code points destination as a function successively called with each converted code
38012 * point.
38013 */
38014 utfx.UTF16toUTF8 = function(src, dst) {
38015 var c1, c2 = null;
38016 while (true) {
38017 if ((c1 = c2 !== null ? c2 : src()) === null)
38018 break;
38019 if (c1 >= 0xD800 && c1 <= 0xDFFF) {
38020 if ((c2 = src()) !== null) {
38021 if (c2 >= 0xDC00 && c2 <= 0xDFFF) {
38022 dst((c1-0xD800)*0x400+c2-0xDC00+0x10000);
38023 c2 = null; continue;
38024 }
38025 }
38026 }
38027 dst(c1);
38028 }
38029 if (c2 !== null) dst(c2);
38030 };
38031
38032 /**
38033 * Converts UTF8 code points to UTF16 characters.
38034 * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
38035 * respectively `null` if there are no more code points left or a single numeric code point.
38036 * @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
38037 * @throws {RangeError} If a code point is out of range
38038 */
38039 utfx.UTF8toUTF16 = function(src, dst) {
38040 var cp = null;
38041 if (typeof src === 'number')
38042 cp = src, src = function() { return null; };
38043 while (cp !== null || (cp = src()) !== null) {
38044 if (cp <= 0xFFFF)
38045 dst(cp);
38046 else
38047 cp -= 0x10000,
38048 dst((cp>>10)+0xD800),
38049 dst((cp%0x400)+0xDC00);
38050 cp = null;
38051 }
38052 };
38053
38054 /**
38055 * Converts and encodes UTF16 characters to UTF8 bytes.
38056 * @param {!function():number|null} src Characters source as a function returning the next char code respectively `null`
38057 * if there are no more characters left.
38058 * @param {!function(number)} dst Bytes destination as a function successively called with the next byte.
38059 */
38060 utfx.encodeUTF16toUTF8 = function(src, dst) {
38061 utfx.UTF16toUTF8(src, function(cp) {
38062 utfx.encodeUTF8(cp, dst);
38063 });
38064 };
38065
38066 /**
38067 * Decodes and converts UTF8 bytes to UTF16 characters.
38068 * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
38069 * are no more bytes left.
38070 * @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
38071 * @throws {RangeError} If a starting byte is invalid in UTF8
38072 * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the remaining bytes.
38073 */
38074 utfx.decodeUTF8toUTF16 = function(src, dst) {
38075 utfx.decodeUTF8(src, function(cp) {
38076 utfx.UTF8toUTF16(cp, dst);
38077 });
38078 };
38079
38080 /**
38081 * Calculates the byte length of an UTF8 code point.
38082 * @param {number} cp UTF8 code point
38083 * @returns {number} Byte length
38084 */
38085 utfx.calculateCodePoint = function(cp) {
38086 return (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
38087 };
38088
38089 /**
38090 * Calculates the number of UTF8 bytes required to store UTF8 code points.
38091 * @param {(!function():number|null)} src Code points source as a function returning the next code point respectively
38092 * `null` if there are no more code points left.
38093 * @returns {number} The number of UTF8 bytes required
38094 */
38095 utfx.calculateUTF8 = function(src) {
38096 var cp, l=0;
38097 while ((cp = src()) !== null)
38098 l += (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
38099 return l;
38100 };
38101
38102 /**
38103 * Calculates the number of UTF8 code points respectively UTF8 bytes required to store UTF16 char codes.
38104 * @param {(!function():number|null)} src Characters source as a function returning the next char code respectively
38105 * `null` if there are no more characters left.
38106 * @returns {!Array.<number>} The number of UTF8 code points at index 0 and the number of UTF8 bytes required at index 1.
38107 */
38108 utfx.calculateUTF16asUTF8 = function(src) {
38109 var n=0, l=0;
38110 utfx.UTF16toUTF8(src, function(cp) {
38111 ++n; l += (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
38112 });
38113 return [n,l];
38114 };
38115
38116 return utfx;
38117 }();
38118
38119 // encodings/utf8
38120
38121 /**
38122 * Encodes this ByteBuffer's contents between {@link ByteBuffer#offset} and {@link ByteBuffer#limit} to an UTF8 encoded
38123 * string.
38124 * @returns {string} Hex encoded string
38125 * @throws {RangeError} If `offset > limit`
38126 * @expose
38127 */
38128 ByteBufferPrototype.toUTF8 = function(begin, end) {
38129 if (typeof begin === 'undefined') begin = this.offset;
38130 if (typeof end === 'undefined') end = this.limit;
38131 if (!this.noAssert) {
38132 if (typeof begin !== 'number' || begin % 1 !== 0)
38133 throw TypeError("Illegal begin: Not an integer");
38134 begin >>>= 0;
38135 if (typeof end !== 'number' || end % 1 !== 0)
38136 throw TypeError("Illegal end: Not an integer");
38137 end >>>= 0;
38138 if (begin < 0 || begin > end || end > this.buffer.byteLength)
38139 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
38140 }
38141 var sd; try {
38142 utfx.decodeUTF8toUTF16(function() {
38143 return begin < end ? this.view[begin++] : null;
38144 }.bind(this), sd = stringDestination());
38145 } catch (e) {
38146 if (begin !== end)
38147 throw RangeError("Illegal range: Truncated data, "+begin+" != "+end);
38148 }
38149 return sd();
38150 };
38151
38152 /**
38153 * Decodes an UTF8 encoded string to a ByteBuffer.
38154 * @param {string} str String to decode
38155 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
38156 * {@link ByteBuffer.DEFAULT_ENDIAN}.
38157 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
38158 * {@link ByteBuffer.DEFAULT_NOASSERT}.
38159 * @returns {!ByteBuffer} ByteBuffer
38160 * @expose
38161 */
38162 ByteBuffer.fromUTF8 = function(str, littleEndian, noAssert) {
38163 if (!noAssert)
38164 if (typeof str !== 'string')
38165 throw TypeError("Illegal str: Not a string");
38166 var bb = new ByteBuffer(utfx.calculateUTF16asUTF8(stringSource(str), true)[1], littleEndian, noAssert),
38167 i = 0;
38168 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
38169 bb.view[i++] = b;
38170 });
38171 bb.limit = i;
38172 return bb;
38173 };
38174
38175 return ByteBuffer;
38176});
38177
38178
38179/***/ }),
38180/* 605 */
38181/***/ (function(module, exports, __webpack_require__) {
38182
38183var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
38184 Copyright 2013 Daniel Wirtz <dcode@dcode.io>
38185 Copyright 2009 The Closure Library Authors. All Rights Reserved.
38186
38187 Licensed under the Apache License, Version 2.0 (the "License");
38188 you may not use this file except in compliance with the License.
38189 You may obtain a copy of the License at
38190
38191 http://www.apache.org/licenses/LICENSE-2.0
38192
38193 Unless required by applicable law or agreed to in writing, software
38194 distributed under the License is distributed on an "AS-IS" BASIS,
38195 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
38196 See the License for the specific language governing permissions and
38197 limitations under the License.
38198 */
38199
38200/**
38201 * @license long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
38202 * Released under the Apache License, Version 2.0
38203 * see: https://github.com/dcodeIO/long.js for details
38204 */
38205(function(global, factory) {
38206
38207 /* AMD */ if (true)
38208 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
38209 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
38210 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
38211 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
38212 /* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"])
38213 module["exports"] = factory();
38214 /* Global */ else
38215 (global["dcodeIO"] = global["dcodeIO"] || {})["Long"] = factory();
38216
38217})(this, function() {
38218 "use strict";
38219
38220 /**
38221 * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
38222 * See the from* functions below for more convenient ways of constructing Longs.
38223 * @exports Long
38224 * @class A Long class for representing a 64 bit two's-complement integer value.
38225 * @param {number} low The low (signed) 32 bits of the long
38226 * @param {number} high The high (signed) 32 bits of the long
38227 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
38228 * @constructor
38229 */
38230 function Long(low, high, unsigned) {
38231
38232 /**
38233 * The low 32 bits as a signed value.
38234 * @type {number}
38235 */
38236 this.low = low | 0;
38237
38238 /**
38239 * The high 32 bits as a signed value.
38240 * @type {number}
38241 */
38242 this.high = high | 0;
38243
38244 /**
38245 * Whether unsigned or not.
38246 * @type {boolean}
38247 */
38248 this.unsigned = !!unsigned;
38249 }
38250
38251 // The internal representation of a long is the two given signed, 32-bit values.
38252 // We use 32-bit pieces because these are the size of integers on which
38253 // Javascript performs bit-operations. For operations like addition and
38254 // multiplication, we split each number into 16 bit pieces, which can easily be
38255 // multiplied within Javascript's floating-point representation without overflow
38256 // or change in sign.
38257 //
38258 // In the algorithms below, we frequently reduce the negative case to the
38259 // positive case by negating the input(s) and then post-processing the result.
38260 // Note that we must ALWAYS check specially whether those values are MIN_VALUE
38261 // (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
38262 // a positive number, it overflows back into a negative). Not handling this
38263 // case would often result in infinite recursion.
38264 //
38265 // Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
38266 // methods on which they depend.
38267
38268 /**
38269 * An indicator used to reliably determine if an object is a Long or not.
38270 * @type {boolean}
38271 * @const
38272 * @private
38273 */
38274 Long.prototype.__isLong__;
38275
38276 Object.defineProperty(Long.prototype, "__isLong__", {
38277 value: true,
38278 enumerable: false,
38279 configurable: false
38280 });
38281
38282 /**
38283 * @function
38284 * @param {*} obj Object
38285 * @returns {boolean}
38286 * @inner
38287 */
38288 function isLong(obj) {
38289 return (obj && obj["__isLong__"]) === true;
38290 }
38291
38292 /**
38293 * Tests if the specified object is a Long.
38294 * @function
38295 * @param {*} obj Object
38296 * @returns {boolean}
38297 */
38298 Long.isLong = isLong;
38299
38300 /**
38301 * A cache of the Long representations of small integer values.
38302 * @type {!Object}
38303 * @inner
38304 */
38305 var INT_CACHE = {};
38306
38307 /**
38308 * A cache of the Long representations of small unsigned integer values.
38309 * @type {!Object}
38310 * @inner
38311 */
38312 var UINT_CACHE = {};
38313
38314 /**
38315 * @param {number} value
38316 * @param {boolean=} unsigned
38317 * @returns {!Long}
38318 * @inner
38319 */
38320 function fromInt(value, unsigned) {
38321 var obj, cachedObj, cache;
38322 if (unsigned) {
38323 value >>>= 0;
38324 if (cache = (0 <= value && value < 256)) {
38325 cachedObj = UINT_CACHE[value];
38326 if (cachedObj)
38327 return cachedObj;
38328 }
38329 obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);
38330 if (cache)
38331 UINT_CACHE[value] = obj;
38332 return obj;
38333 } else {
38334 value |= 0;
38335 if (cache = (-128 <= value && value < 128)) {
38336 cachedObj = INT_CACHE[value];
38337 if (cachedObj)
38338 return cachedObj;
38339 }
38340 obj = fromBits(value, value < 0 ? -1 : 0, false);
38341 if (cache)
38342 INT_CACHE[value] = obj;
38343 return obj;
38344 }
38345 }
38346
38347 /**
38348 * Returns a Long representing the given 32 bit integer value.
38349 * @function
38350 * @param {number} value The 32 bit integer in question
38351 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
38352 * @returns {!Long} The corresponding Long value
38353 */
38354 Long.fromInt = fromInt;
38355
38356 /**
38357 * @param {number} value
38358 * @param {boolean=} unsigned
38359 * @returns {!Long}
38360 * @inner
38361 */
38362 function fromNumber(value, unsigned) {
38363 if (isNaN(value) || !isFinite(value))
38364 return unsigned ? UZERO : ZERO;
38365 if (unsigned) {
38366 if (value < 0)
38367 return UZERO;
38368 if (value >= TWO_PWR_64_DBL)
38369 return MAX_UNSIGNED_VALUE;
38370 } else {
38371 if (value <= -TWO_PWR_63_DBL)
38372 return MIN_VALUE;
38373 if (value + 1 >= TWO_PWR_63_DBL)
38374 return MAX_VALUE;
38375 }
38376 if (value < 0)
38377 return fromNumber(-value, unsigned).neg();
38378 return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
38379 }
38380
38381 /**
38382 * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
38383 * @function
38384 * @param {number} value The number in question
38385 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
38386 * @returns {!Long} The corresponding Long value
38387 */
38388 Long.fromNumber = fromNumber;
38389
38390 /**
38391 * @param {number} lowBits
38392 * @param {number} highBits
38393 * @param {boolean=} unsigned
38394 * @returns {!Long}
38395 * @inner
38396 */
38397 function fromBits(lowBits, highBits, unsigned) {
38398 return new Long(lowBits, highBits, unsigned);
38399 }
38400
38401 /**
38402 * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
38403 * assumed to use 32 bits.
38404 * @function
38405 * @param {number} lowBits The low 32 bits
38406 * @param {number} highBits The high 32 bits
38407 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
38408 * @returns {!Long} The corresponding Long value
38409 */
38410 Long.fromBits = fromBits;
38411
38412 /**
38413 * @function
38414 * @param {number} base
38415 * @param {number} exponent
38416 * @returns {number}
38417 * @inner
38418 */
38419 var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)
38420
38421 /**
38422 * @param {string} str
38423 * @param {(boolean|number)=} unsigned
38424 * @param {number=} radix
38425 * @returns {!Long}
38426 * @inner
38427 */
38428 function fromString(str, unsigned, radix) {
38429 if (str.length === 0)
38430 throw Error('empty string');
38431 if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
38432 return ZERO;
38433 if (typeof unsigned === 'number') {
38434 // For goog.math.long compatibility
38435 radix = unsigned,
38436 unsigned = false;
38437 } else {
38438 unsigned = !! unsigned;
38439 }
38440 radix = radix || 10;
38441 if (radix < 2 || 36 < radix)
38442 throw RangeError('radix');
38443
38444 var p;
38445 if ((p = str.indexOf('-')) > 0)
38446 throw Error('interior hyphen');
38447 else if (p === 0) {
38448 return fromString(str.substring(1), unsigned, radix).neg();
38449 }
38450
38451 // Do several (8) digits each time through the loop, so as to
38452 // minimize the calls to the very expensive emulated div.
38453 var radixToPower = fromNumber(pow_dbl(radix, 8));
38454
38455 var result = ZERO;
38456 for (var i = 0; i < str.length; i += 8) {
38457 var size = Math.min(8, str.length - i),
38458 value = parseInt(str.substring(i, i + size), radix);
38459 if (size < 8) {
38460 var power = fromNumber(pow_dbl(radix, size));
38461 result = result.mul(power).add(fromNumber(value));
38462 } else {
38463 result = result.mul(radixToPower);
38464 result = result.add(fromNumber(value));
38465 }
38466 }
38467 result.unsigned = unsigned;
38468 return result;
38469 }
38470
38471 /**
38472 * Returns a Long representation of the given string, written using the specified radix.
38473 * @function
38474 * @param {string} str The textual representation of the Long
38475 * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to `false` for signed
38476 * @param {number=} radix The radix in which the text is written (2-36), defaults to 10
38477 * @returns {!Long} The corresponding Long value
38478 */
38479 Long.fromString = fromString;
38480
38481 /**
38482 * @function
38483 * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
38484 * @returns {!Long}
38485 * @inner
38486 */
38487 function fromValue(val) {
38488 if (val /* is compatible */ instanceof Long)
38489 return val;
38490 if (typeof val === 'number')
38491 return fromNumber(val);
38492 if (typeof val === 'string')
38493 return fromString(val);
38494 // Throws for non-objects, converts non-instanceof Long:
38495 return fromBits(val.low, val.high, val.unsigned);
38496 }
38497
38498 /**
38499 * Converts the specified value to a Long.
38500 * @function
38501 * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value
38502 * @returns {!Long}
38503 */
38504 Long.fromValue = fromValue;
38505
38506 // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
38507 // no runtime penalty for these.
38508
38509 /**
38510 * @type {number}
38511 * @const
38512 * @inner
38513 */
38514 var TWO_PWR_16_DBL = 1 << 16;
38515
38516 /**
38517 * @type {number}
38518 * @const
38519 * @inner
38520 */
38521 var TWO_PWR_24_DBL = 1 << 24;
38522
38523 /**
38524 * @type {number}
38525 * @const
38526 * @inner
38527 */
38528 var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
38529
38530 /**
38531 * @type {number}
38532 * @const
38533 * @inner
38534 */
38535 var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
38536
38537 /**
38538 * @type {number}
38539 * @const
38540 * @inner
38541 */
38542 var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
38543
38544 /**
38545 * @type {!Long}
38546 * @const
38547 * @inner
38548 */
38549 var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
38550
38551 /**
38552 * @type {!Long}
38553 * @inner
38554 */
38555 var ZERO = fromInt(0);
38556
38557 /**
38558 * Signed zero.
38559 * @type {!Long}
38560 */
38561 Long.ZERO = ZERO;
38562
38563 /**
38564 * @type {!Long}
38565 * @inner
38566 */
38567 var UZERO = fromInt(0, true);
38568
38569 /**
38570 * Unsigned zero.
38571 * @type {!Long}
38572 */
38573 Long.UZERO = UZERO;
38574
38575 /**
38576 * @type {!Long}
38577 * @inner
38578 */
38579 var ONE = fromInt(1);
38580
38581 /**
38582 * Signed one.
38583 * @type {!Long}
38584 */
38585 Long.ONE = ONE;
38586
38587 /**
38588 * @type {!Long}
38589 * @inner
38590 */
38591 var UONE = fromInt(1, true);
38592
38593 /**
38594 * Unsigned one.
38595 * @type {!Long}
38596 */
38597 Long.UONE = UONE;
38598
38599 /**
38600 * @type {!Long}
38601 * @inner
38602 */
38603 var NEG_ONE = fromInt(-1);
38604
38605 /**
38606 * Signed negative one.
38607 * @type {!Long}
38608 */
38609 Long.NEG_ONE = NEG_ONE;
38610
38611 /**
38612 * @type {!Long}
38613 * @inner
38614 */
38615 var MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);
38616
38617 /**
38618 * Maximum signed value.
38619 * @type {!Long}
38620 */
38621 Long.MAX_VALUE = MAX_VALUE;
38622
38623 /**
38624 * @type {!Long}
38625 * @inner
38626 */
38627 var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);
38628
38629 /**
38630 * Maximum unsigned value.
38631 * @type {!Long}
38632 */
38633 Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
38634
38635 /**
38636 * @type {!Long}
38637 * @inner
38638 */
38639 var MIN_VALUE = fromBits(0, 0x80000000|0, false);
38640
38641 /**
38642 * Minimum signed value.
38643 * @type {!Long}
38644 */
38645 Long.MIN_VALUE = MIN_VALUE;
38646
38647 /**
38648 * @alias Long.prototype
38649 * @inner
38650 */
38651 var LongPrototype = Long.prototype;
38652
38653 /**
38654 * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
38655 * @returns {number}
38656 */
38657 LongPrototype.toInt = function toInt() {
38658 return this.unsigned ? this.low >>> 0 : this.low;
38659 };
38660
38661 /**
38662 * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
38663 * @returns {number}
38664 */
38665 LongPrototype.toNumber = function toNumber() {
38666 if (this.unsigned)
38667 return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);
38668 return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
38669 };
38670
38671 /**
38672 * Converts the Long to a string written in the specified radix.
38673 * @param {number=} radix Radix (2-36), defaults to 10
38674 * @returns {string}
38675 * @override
38676 * @throws {RangeError} If `radix` is out of range
38677 */
38678 LongPrototype.toString = function toString(radix) {
38679 radix = radix || 10;
38680 if (radix < 2 || 36 < radix)
38681 throw RangeError('radix');
38682 if (this.isZero())
38683 return '0';
38684 if (this.isNegative()) { // Unsigned Longs are never negative
38685 if (this.eq(MIN_VALUE)) {
38686 // We need to change the Long value before it can be negated, so we remove
38687 // the bottom-most digit in this base and then recurse to do the rest.
38688 var radixLong = fromNumber(radix),
38689 div = this.div(radixLong),
38690 rem1 = div.mul(radixLong).sub(this);
38691 return div.toString(radix) + rem1.toInt().toString(radix);
38692 } else
38693 return '-' + this.neg().toString(radix);
38694 }
38695
38696 // Do several (6) digits each time through the loop, so as to
38697 // minimize the calls to the very expensive emulated div.
38698 var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),
38699 rem = this;
38700 var result = '';
38701 while (true) {
38702 var remDiv = rem.div(radixToPower),
38703 intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,
38704 digits = intval.toString(radix);
38705 rem = remDiv;
38706 if (rem.isZero())
38707 return digits + result;
38708 else {
38709 while (digits.length < 6)
38710 digits = '0' + digits;
38711 result = '' + digits + result;
38712 }
38713 }
38714 };
38715
38716 /**
38717 * Gets the high 32 bits as a signed integer.
38718 * @returns {number} Signed high bits
38719 */
38720 LongPrototype.getHighBits = function getHighBits() {
38721 return this.high;
38722 };
38723
38724 /**
38725 * Gets the high 32 bits as an unsigned integer.
38726 * @returns {number} Unsigned high bits
38727 */
38728 LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
38729 return this.high >>> 0;
38730 };
38731
38732 /**
38733 * Gets the low 32 bits as a signed integer.
38734 * @returns {number} Signed low bits
38735 */
38736 LongPrototype.getLowBits = function getLowBits() {
38737 return this.low;
38738 };
38739
38740 /**
38741 * Gets the low 32 bits as an unsigned integer.
38742 * @returns {number} Unsigned low bits
38743 */
38744 LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
38745 return this.low >>> 0;
38746 };
38747
38748 /**
38749 * Gets the number of bits needed to represent the absolute value of this Long.
38750 * @returns {number}
38751 */
38752 LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
38753 if (this.isNegative()) // Unsigned Longs are never negative
38754 return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
38755 var val = this.high != 0 ? this.high : this.low;
38756 for (var bit = 31; bit > 0; bit--)
38757 if ((val & (1 << bit)) != 0)
38758 break;
38759 return this.high != 0 ? bit + 33 : bit + 1;
38760 };
38761
38762 /**
38763 * Tests if this Long's value equals zero.
38764 * @returns {boolean}
38765 */
38766 LongPrototype.isZero = function isZero() {
38767 return this.high === 0 && this.low === 0;
38768 };
38769
38770 /**
38771 * Tests if this Long's value is negative.
38772 * @returns {boolean}
38773 */
38774 LongPrototype.isNegative = function isNegative() {
38775 return !this.unsigned && this.high < 0;
38776 };
38777
38778 /**
38779 * Tests if this Long's value is positive.
38780 * @returns {boolean}
38781 */
38782 LongPrototype.isPositive = function isPositive() {
38783 return this.unsigned || this.high >= 0;
38784 };
38785
38786 /**
38787 * Tests if this Long's value is odd.
38788 * @returns {boolean}
38789 */
38790 LongPrototype.isOdd = function isOdd() {
38791 return (this.low & 1) === 1;
38792 };
38793
38794 /**
38795 * Tests if this Long's value is even.
38796 * @returns {boolean}
38797 */
38798 LongPrototype.isEven = function isEven() {
38799 return (this.low & 1) === 0;
38800 };
38801
38802 /**
38803 * Tests if this Long's value equals the specified's.
38804 * @param {!Long|number|string} other Other value
38805 * @returns {boolean}
38806 */
38807 LongPrototype.equals = function equals(other) {
38808 if (!isLong(other))
38809 other = fromValue(other);
38810 if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)
38811 return false;
38812 return this.high === other.high && this.low === other.low;
38813 };
38814
38815 /**
38816 * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.
38817 * @function
38818 * @param {!Long|number|string} other Other value
38819 * @returns {boolean}
38820 */
38821 LongPrototype.eq = LongPrototype.equals;
38822
38823 /**
38824 * Tests if this Long's value differs from the specified's.
38825 * @param {!Long|number|string} other Other value
38826 * @returns {boolean}
38827 */
38828 LongPrototype.notEquals = function notEquals(other) {
38829 return !this.eq(/* validates */ other);
38830 };
38831
38832 /**
38833 * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
38834 * @function
38835 * @param {!Long|number|string} other Other value
38836 * @returns {boolean}
38837 */
38838 LongPrototype.neq = LongPrototype.notEquals;
38839
38840 /**
38841 * Tests if this Long's value is less than the specified's.
38842 * @param {!Long|number|string} other Other value
38843 * @returns {boolean}
38844 */
38845 LongPrototype.lessThan = function lessThan(other) {
38846 return this.comp(/* validates */ other) < 0;
38847 };
38848
38849 /**
38850 * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.
38851 * @function
38852 * @param {!Long|number|string} other Other value
38853 * @returns {boolean}
38854 */
38855 LongPrototype.lt = LongPrototype.lessThan;
38856
38857 /**
38858 * Tests if this Long's value is less than or equal the specified's.
38859 * @param {!Long|number|string} other Other value
38860 * @returns {boolean}
38861 */
38862 LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
38863 return this.comp(/* validates */ other) <= 0;
38864 };
38865
38866 /**
38867 * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
38868 * @function
38869 * @param {!Long|number|string} other Other value
38870 * @returns {boolean}
38871 */
38872 LongPrototype.lte = LongPrototype.lessThanOrEqual;
38873
38874 /**
38875 * Tests if this Long's value is greater than the specified's.
38876 * @param {!Long|number|string} other Other value
38877 * @returns {boolean}
38878 */
38879 LongPrototype.greaterThan = function greaterThan(other) {
38880 return this.comp(/* validates */ other) > 0;
38881 };
38882
38883 /**
38884 * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.
38885 * @function
38886 * @param {!Long|number|string} other Other value
38887 * @returns {boolean}
38888 */
38889 LongPrototype.gt = LongPrototype.greaterThan;
38890
38891 /**
38892 * Tests if this Long's value is greater than or equal the specified's.
38893 * @param {!Long|number|string} other Other value
38894 * @returns {boolean}
38895 */
38896 LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
38897 return this.comp(/* validates */ other) >= 0;
38898 };
38899
38900 /**
38901 * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
38902 * @function
38903 * @param {!Long|number|string} other Other value
38904 * @returns {boolean}
38905 */
38906 LongPrototype.gte = LongPrototype.greaterThanOrEqual;
38907
38908 /**
38909 * Compares this Long's value with the specified's.
38910 * @param {!Long|number|string} other Other value
38911 * @returns {number} 0 if they are the same, 1 if the this is greater and -1
38912 * if the given one is greater
38913 */
38914 LongPrototype.compare = function compare(other) {
38915 if (!isLong(other))
38916 other = fromValue(other);
38917 if (this.eq(other))
38918 return 0;
38919 var thisNeg = this.isNegative(),
38920 otherNeg = other.isNegative();
38921 if (thisNeg && !otherNeg)
38922 return -1;
38923 if (!thisNeg && otherNeg)
38924 return 1;
38925 // At this point the sign bits are the same
38926 if (!this.unsigned)
38927 return this.sub(other).isNegative() ? -1 : 1;
38928 // Both are positive if at least one is unsigned
38929 return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;
38930 };
38931
38932 /**
38933 * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.
38934 * @function
38935 * @param {!Long|number|string} other Other value
38936 * @returns {number} 0 if they are the same, 1 if the this is greater and -1
38937 * if the given one is greater
38938 */
38939 LongPrototype.comp = LongPrototype.compare;
38940
38941 /**
38942 * Negates this Long's value.
38943 * @returns {!Long} Negated Long
38944 */
38945 LongPrototype.negate = function negate() {
38946 if (!this.unsigned && this.eq(MIN_VALUE))
38947 return MIN_VALUE;
38948 return this.not().add(ONE);
38949 };
38950
38951 /**
38952 * Negates this Long's value. This is an alias of {@link Long#negate}.
38953 * @function
38954 * @returns {!Long} Negated Long
38955 */
38956 LongPrototype.neg = LongPrototype.negate;
38957
38958 /**
38959 * Returns the sum of this and the specified Long.
38960 * @param {!Long|number|string} addend Addend
38961 * @returns {!Long} Sum
38962 */
38963 LongPrototype.add = function add(addend) {
38964 if (!isLong(addend))
38965 addend = fromValue(addend);
38966
38967 // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
38968
38969 var a48 = this.high >>> 16;
38970 var a32 = this.high & 0xFFFF;
38971 var a16 = this.low >>> 16;
38972 var a00 = this.low & 0xFFFF;
38973
38974 var b48 = addend.high >>> 16;
38975 var b32 = addend.high & 0xFFFF;
38976 var b16 = addend.low >>> 16;
38977 var b00 = addend.low & 0xFFFF;
38978
38979 var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
38980 c00 += a00 + b00;
38981 c16 += c00 >>> 16;
38982 c00 &= 0xFFFF;
38983 c16 += a16 + b16;
38984 c32 += c16 >>> 16;
38985 c16 &= 0xFFFF;
38986 c32 += a32 + b32;
38987 c48 += c32 >>> 16;
38988 c32 &= 0xFFFF;
38989 c48 += a48 + b48;
38990 c48 &= 0xFFFF;
38991 return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
38992 };
38993
38994 /**
38995 * Returns the difference of this and the specified Long.
38996 * @param {!Long|number|string} subtrahend Subtrahend
38997 * @returns {!Long} Difference
38998 */
38999 LongPrototype.subtract = function subtract(subtrahend) {
39000 if (!isLong(subtrahend))
39001 subtrahend = fromValue(subtrahend);
39002 return this.add(subtrahend.neg());
39003 };
39004
39005 /**
39006 * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.
39007 * @function
39008 * @param {!Long|number|string} subtrahend Subtrahend
39009 * @returns {!Long} Difference
39010 */
39011 LongPrototype.sub = LongPrototype.subtract;
39012
39013 /**
39014 * Returns the product of this and the specified Long.
39015 * @param {!Long|number|string} multiplier Multiplier
39016 * @returns {!Long} Product
39017 */
39018 LongPrototype.multiply = function multiply(multiplier) {
39019 if (this.isZero())
39020 return ZERO;
39021 if (!isLong(multiplier))
39022 multiplier = fromValue(multiplier);
39023 if (multiplier.isZero())
39024 return ZERO;
39025 if (this.eq(MIN_VALUE))
39026 return multiplier.isOdd() ? MIN_VALUE : ZERO;
39027 if (multiplier.eq(MIN_VALUE))
39028 return this.isOdd() ? MIN_VALUE : ZERO;
39029
39030 if (this.isNegative()) {
39031 if (multiplier.isNegative())
39032 return this.neg().mul(multiplier.neg());
39033 else
39034 return this.neg().mul(multiplier).neg();
39035 } else if (multiplier.isNegative())
39036 return this.mul(multiplier.neg()).neg();
39037
39038 // If both longs are small, use float multiplication
39039 if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
39040 return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
39041
39042 // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
39043 // We can skip products that would overflow.
39044
39045 var a48 = this.high >>> 16;
39046 var a32 = this.high & 0xFFFF;
39047 var a16 = this.low >>> 16;
39048 var a00 = this.low & 0xFFFF;
39049
39050 var b48 = multiplier.high >>> 16;
39051 var b32 = multiplier.high & 0xFFFF;
39052 var b16 = multiplier.low >>> 16;
39053 var b00 = multiplier.low & 0xFFFF;
39054
39055 var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
39056 c00 += a00 * b00;
39057 c16 += c00 >>> 16;
39058 c00 &= 0xFFFF;
39059 c16 += a16 * b00;
39060 c32 += c16 >>> 16;
39061 c16 &= 0xFFFF;
39062 c16 += a00 * b16;
39063 c32 += c16 >>> 16;
39064 c16 &= 0xFFFF;
39065 c32 += a32 * b00;
39066 c48 += c32 >>> 16;
39067 c32 &= 0xFFFF;
39068 c32 += a16 * b16;
39069 c48 += c32 >>> 16;
39070 c32 &= 0xFFFF;
39071 c32 += a00 * b32;
39072 c48 += c32 >>> 16;
39073 c32 &= 0xFFFF;
39074 c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
39075 c48 &= 0xFFFF;
39076 return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
39077 };
39078
39079 /**
39080 * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.
39081 * @function
39082 * @param {!Long|number|string} multiplier Multiplier
39083 * @returns {!Long} Product
39084 */
39085 LongPrototype.mul = LongPrototype.multiply;
39086
39087 /**
39088 * Returns this Long divided by the specified. The result is signed if this Long is signed or
39089 * unsigned if this Long is unsigned.
39090 * @param {!Long|number|string} divisor Divisor
39091 * @returns {!Long} Quotient
39092 */
39093 LongPrototype.divide = function divide(divisor) {
39094 if (!isLong(divisor))
39095 divisor = fromValue(divisor);
39096 if (divisor.isZero())
39097 throw Error('division by zero');
39098 if (this.isZero())
39099 return this.unsigned ? UZERO : ZERO;
39100 var approx, rem, res;
39101 if (!this.unsigned) {
39102 // This section is only relevant for signed longs and is derived from the
39103 // closure library as a whole.
39104 if (this.eq(MIN_VALUE)) {
39105 if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
39106 return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
39107 else if (divisor.eq(MIN_VALUE))
39108 return ONE;
39109 else {
39110 // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
39111 var halfThis = this.shr(1);
39112 approx = halfThis.div(divisor).shl(1);
39113 if (approx.eq(ZERO)) {
39114 return divisor.isNegative() ? ONE : NEG_ONE;
39115 } else {
39116 rem = this.sub(divisor.mul(approx));
39117 res = approx.add(rem.div(divisor));
39118 return res;
39119 }
39120 }
39121 } else if (divisor.eq(MIN_VALUE))
39122 return this.unsigned ? UZERO : ZERO;
39123 if (this.isNegative()) {
39124 if (divisor.isNegative())
39125 return this.neg().div(divisor.neg());
39126 return this.neg().div(divisor).neg();
39127 } else if (divisor.isNegative())
39128 return this.div(divisor.neg()).neg();
39129 res = ZERO;
39130 } else {
39131 // The algorithm below has not been made for unsigned longs. It's therefore
39132 // required to take special care of the MSB prior to running it.
39133 if (!divisor.unsigned)
39134 divisor = divisor.toUnsigned();
39135 if (divisor.gt(this))
39136 return UZERO;
39137 if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true
39138 return UONE;
39139 res = UZERO;
39140 }
39141
39142 // Repeat the following until the remainder is less than other: find a
39143 // floating-point that approximates remainder / other *from below*, add this
39144 // into the result, and subtract it from the remainder. It is critical that
39145 // the approximate value is less than or equal to the real value so that the
39146 // remainder never becomes negative.
39147 rem = this;
39148 while (rem.gte(divisor)) {
39149 // Approximate the result of division. This may be a little greater or
39150 // smaller than the actual value.
39151 approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
39152
39153 // We will tweak the approximate result by changing it in the 48-th digit or
39154 // the smallest non-fractional digit, whichever is larger.
39155 var log2 = Math.ceil(Math.log(approx) / Math.LN2),
39156 delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),
39157
39158 // Decrease the approximation until it is smaller than the remainder. Note
39159 // that if it is too large, the product overflows and is negative.
39160 approxRes = fromNumber(approx),
39161 approxRem = approxRes.mul(divisor);
39162 while (approxRem.isNegative() || approxRem.gt(rem)) {
39163 approx -= delta;
39164 approxRes = fromNumber(approx, this.unsigned);
39165 approxRem = approxRes.mul(divisor);
39166 }
39167
39168 // We know the answer can't be zero... and actually, zero would cause
39169 // infinite recursion since we would make no progress.
39170 if (approxRes.isZero())
39171 approxRes = ONE;
39172
39173 res = res.add(approxRes);
39174 rem = rem.sub(approxRem);
39175 }
39176 return res;
39177 };
39178
39179 /**
39180 * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.
39181 * @function
39182 * @param {!Long|number|string} divisor Divisor
39183 * @returns {!Long} Quotient
39184 */
39185 LongPrototype.div = LongPrototype.divide;
39186
39187 /**
39188 * Returns this Long modulo the specified.
39189 * @param {!Long|number|string} divisor Divisor
39190 * @returns {!Long} Remainder
39191 */
39192 LongPrototype.modulo = function modulo(divisor) {
39193 if (!isLong(divisor))
39194 divisor = fromValue(divisor);
39195 return this.sub(this.div(divisor).mul(divisor));
39196 };
39197
39198 /**
39199 * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
39200 * @function
39201 * @param {!Long|number|string} divisor Divisor
39202 * @returns {!Long} Remainder
39203 */
39204 LongPrototype.mod = LongPrototype.modulo;
39205
39206 /**
39207 * Returns the bitwise NOT of this Long.
39208 * @returns {!Long}
39209 */
39210 LongPrototype.not = function not() {
39211 return fromBits(~this.low, ~this.high, this.unsigned);
39212 };
39213
39214 /**
39215 * Returns the bitwise AND of this Long and the specified.
39216 * @param {!Long|number|string} other Other Long
39217 * @returns {!Long}
39218 */
39219 LongPrototype.and = function and(other) {
39220 if (!isLong(other))
39221 other = fromValue(other);
39222 return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
39223 };
39224
39225 /**
39226 * Returns the bitwise OR of this Long and the specified.
39227 * @param {!Long|number|string} other Other Long
39228 * @returns {!Long}
39229 */
39230 LongPrototype.or = function or(other) {
39231 if (!isLong(other))
39232 other = fromValue(other);
39233 return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
39234 };
39235
39236 /**
39237 * Returns the bitwise XOR of this Long and the given one.
39238 * @param {!Long|number|string} other Other Long
39239 * @returns {!Long}
39240 */
39241 LongPrototype.xor = function xor(other) {
39242 if (!isLong(other))
39243 other = fromValue(other);
39244 return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
39245 };
39246
39247 /**
39248 * Returns this Long with bits shifted to the left by the given amount.
39249 * @param {number|!Long} numBits Number of bits
39250 * @returns {!Long} Shifted Long
39251 */
39252 LongPrototype.shiftLeft = function shiftLeft(numBits) {
39253 if (isLong(numBits))
39254 numBits = numBits.toInt();
39255 if ((numBits &= 63) === 0)
39256 return this;
39257 else if (numBits < 32)
39258 return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
39259 else
39260 return fromBits(0, this.low << (numBits - 32), this.unsigned);
39261 };
39262
39263 /**
39264 * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.
39265 * @function
39266 * @param {number|!Long} numBits Number of bits
39267 * @returns {!Long} Shifted Long
39268 */
39269 LongPrototype.shl = LongPrototype.shiftLeft;
39270
39271 /**
39272 * Returns this Long with bits arithmetically shifted to the right by the given amount.
39273 * @param {number|!Long} numBits Number of bits
39274 * @returns {!Long} Shifted Long
39275 */
39276 LongPrototype.shiftRight = function shiftRight(numBits) {
39277 if (isLong(numBits))
39278 numBits = numBits.toInt();
39279 if ((numBits &= 63) === 0)
39280 return this;
39281 else if (numBits < 32)
39282 return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
39283 else
39284 return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
39285 };
39286
39287 /**
39288 * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.
39289 * @function
39290 * @param {number|!Long} numBits Number of bits
39291 * @returns {!Long} Shifted Long
39292 */
39293 LongPrototype.shr = LongPrototype.shiftRight;
39294
39295 /**
39296 * Returns this Long with bits logically shifted to the right by the given amount.
39297 * @param {number|!Long} numBits Number of bits
39298 * @returns {!Long} Shifted Long
39299 */
39300 LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
39301 if (isLong(numBits))
39302 numBits = numBits.toInt();
39303 numBits &= 63;
39304 if (numBits === 0)
39305 return this;
39306 else {
39307 var high = this.high;
39308 if (numBits < 32) {
39309 var low = this.low;
39310 return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);
39311 } else if (numBits === 32)
39312 return fromBits(high, 0, this.unsigned);
39313 else
39314 return fromBits(high >>> (numBits - 32), 0, this.unsigned);
39315 }
39316 };
39317
39318 /**
39319 * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
39320 * @function
39321 * @param {number|!Long} numBits Number of bits
39322 * @returns {!Long} Shifted Long
39323 */
39324 LongPrototype.shru = LongPrototype.shiftRightUnsigned;
39325
39326 /**
39327 * Converts this Long to signed.
39328 * @returns {!Long} Signed long
39329 */
39330 LongPrototype.toSigned = function toSigned() {
39331 if (!this.unsigned)
39332 return this;
39333 return fromBits(this.low, this.high, false);
39334 };
39335
39336 /**
39337 * Converts this Long to unsigned.
39338 * @returns {!Long} Unsigned long
39339 */
39340 LongPrototype.toUnsigned = function toUnsigned() {
39341 if (this.unsigned)
39342 return this;
39343 return fromBits(this.low, this.high, true);
39344 };
39345
39346 /**
39347 * Converts this Long to its byte representation.
39348 * @param {boolean=} le Whether little or big endian, defaults to big endian
39349 * @returns {!Array.<number>} Byte representation
39350 */
39351 LongPrototype.toBytes = function(le) {
39352 return le ? this.toBytesLE() : this.toBytesBE();
39353 }
39354
39355 /**
39356 * Converts this Long to its little endian byte representation.
39357 * @returns {!Array.<number>} Little endian byte representation
39358 */
39359 LongPrototype.toBytesLE = function() {
39360 var hi = this.high,
39361 lo = this.low;
39362 return [
39363 lo & 0xff,
39364 (lo >>> 8) & 0xff,
39365 (lo >>> 16) & 0xff,
39366 (lo >>> 24) & 0xff,
39367 hi & 0xff,
39368 (hi >>> 8) & 0xff,
39369 (hi >>> 16) & 0xff,
39370 (hi >>> 24) & 0xff
39371 ];
39372 }
39373
39374 /**
39375 * Converts this Long to its big endian byte representation.
39376 * @returns {!Array.<number>} Big endian byte representation
39377 */
39378 LongPrototype.toBytesBE = function() {
39379 var hi = this.high,
39380 lo = this.low;
39381 return [
39382 (hi >>> 24) & 0xff,
39383 (hi >>> 16) & 0xff,
39384 (hi >>> 8) & 0xff,
39385 hi & 0xff,
39386 (lo >>> 24) & 0xff,
39387 (lo >>> 16) & 0xff,
39388 (lo >>> 8) & 0xff,
39389 lo & 0xff
39390 ];
39391 }
39392
39393 return Long;
39394});
39395
39396
39397/***/ }),
39398/* 606 */
39399/***/ (function(module, exports) {
39400
39401/* (ignored) */
39402
39403/***/ }),
39404/* 607 */
39405/***/ (function(module, exports, __webpack_require__) {
39406
39407"use strict";
39408
39409
39410var _interopRequireDefault = __webpack_require__(1);
39411
39412var _slice = _interopRequireDefault(__webpack_require__(59));
39413
39414var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(257));
39415
39416var _concat = _interopRequireDefault(__webpack_require__(22));
39417
39418var has = Object.prototype.hasOwnProperty,
39419 prefix = '~';
39420/**
39421 * Constructor to create a storage for our `EE` objects.
39422 * An `Events` instance is a plain object whose properties are event names.
39423 *
39424 * @constructor
39425 * @private
39426 */
39427
39428function Events() {} //
39429// We try to not inherit from `Object.prototype`. In some engines creating an
39430// instance in this way is faster than calling `Object.create(null)` directly.
39431// If `Object.create(null)` is not supported we prefix the event names with a
39432// character to make sure that the built-in object properties are not
39433// overridden or used as an attack vector.
39434//
39435
39436
39437if (Object.create) {
39438 Events.prototype = Object.create(null); //
39439 // This hack is needed because the `__proto__` property is still inherited in
39440 // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
39441 //
39442
39443 if (!new Events().__proto__) prefix = false;
39444}
39445/**
39446 * Representation of a single event listener.
39447 *
39448 * @param {Function} fn The listener function.
39449 * @param {*} context The context to invoke the listener with.
39450 * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
39451 * @constructor
39452 * @private
39453 */
39454
39455
39456function EE(fn, context, once) {
39457 this.fn = fn;
39458 this.context = context;
39459 this.once = once || false;
39460}
39461/**
39462 * Add a listener for a given event.
39463 *
39464 * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
39465 * @param {(String|Symbol)} event The event name.
39466 * @param {Function} fn The listener function.
39467 * @param {*} context The context to invoke the listener with.
39468 * @param {Boolean} once Specify if the listener is a one-time listener.
39469 * @returns {EventEmitter}
39470 * @private
39471 */
39472
39473
39474function addListener(emitter, event, fn, context, once) {
39475 if (typeof fn !== 'function') {
39476 throw new TypeError('The listener must be a function');
39477 }
39478
39479 var listener = new EE(fn, context || emitter, once),
39480 evt = prefix ? prefix + event : event;
39481 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];
39482 return emitter;
39483}
39484/**
39485 * Clear event by name.
39486 *
39487 * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
39488 * @param {(String|Symbol)} evt The Event name.
39489 * @private
39490 */
39491
39492
39493function clearEvent(emitter, evt) {
39494 if (--emitter._eventsCount === 0) emitter._events = new Events();else delete emitter._events[evt];
39495}
39496/**
39497 * Minimal `EventEmitter` interface that is molded against the Node.js
39498 * `EventEmitter` interface.
39499 *
39500 * @constructor
39501 * @public
39502 */
39503
39504
39505function EventEmitter() {
39506 this._events = new Events();
39507 this._eventsCount = 0;
39508}
39509/**
39510 * Return an array listing the events for which the emitter has registered
39511 * listeners.
39512 *
39513 * @returns {Array}
39514 * @public
39515 */
39516
39517
39518EventEmitter.prototype.eventNames = function eventNames() {
39519 var names = [],
39520 events,
39521 name;
39522 if (this._eventsCount === 0) return names;
39523
39524 for (name in events = this._events) {
39525 if (has.call(events, name)) names.push(prefix ? (0, _slice.default)(name).call(name, 1) : name);
39526 }
39527
39528 if (_getOwnPropertySymbols.default) {
39529 return (0, _concat.default)(names).call(names, (0, _getOwnPropertySymbols.default)(events));
39530 }
39531
39532 return names;
39533};
39534/**
39535 * Return the listeners registered for a given event.
39536 *
39537 * @param {(String|Symbol)} event The event name.
39538 * @returns {Array} The registered listeners.
39539 * @public
39540 */
39541
39542
39543EventEmitter.prototype.listeners = function listeners(event) {
39544 var evt = prefix ? prefix + event : event,
39545 handlers = this._events[evt];
39546 if (!handlers) return [];
39547 if (handlers.fn) return [handlers.fn];
39548
39549 for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
39550 ee[i] = handlers[i].fn;
39551 }
39552
39553 return ee;
39554};
39555/**
39556 * Return the number of listeners listening to a given event.
39557 *
39558 * @param {(String|Symbol)} event The event name.
39559 * @returns {Number} The number of listeners.
39560 * @public
39561 */
39562
39563
39564EventEmitter.prototype.listenerCount = function listenerCount(event) {
39565 var evt = prefix ? prefix + event : event,
39566 listeners = this._events[evt];
39567 if (!listeners) return 0;
39568 if (listeners.fn) return 1;
39569 return listeners.length;
39570};
39571/**
39572 * Calls each of the listeners registered for a given event.
39573 *
39574 * @param {(String|Symbol)} event The event name.
39575 * @returns {Boolean} `true` if the event had listeners, else `false`.
39576 * @public
39577 */
39578
39579
39580EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
39581 var evt = prefix ? prefix + event : event;
39582 if (!this._events[evt]) return false;
39583 var listeners = this._events[evt],
39584 len = arguments.length,
39585 args,
39586 i;
39587
39588 if (listeners.fn) {
39589 if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
39590
39591 switch (len) {
39592 case 1:
39593 return listeners.fn.call(listeners.context), true;
39594
39595 case 2:
39596 return listeners.fn.call(listeners.context, a1), true;
39597
39598 case 3:
39599 return listeners.fn.call(listeners.context, a1, a2), true;
39600
39601 case 4:
39602 return listeners.fn.call(listeners.context, a1, a2, a3), true;
39603
39604 case 5:
39605 return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
39606
39607 case 6:
39608 return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
39609 }
39610
39611 for (i = 1, args = new Array(len - 1); i < len; i++) {
39612 args[i - 1] = arguments[i];
39613 }
39614
39615 listeners.fn.apply(listeners.context, args);
39616 } else {
39617 var length = listeners.length,
39618 j;
39619
39620 for (i = 0; i < length; i++) {
39621 if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
39622
39623 switch (len) {
39624 case 1:
39625 listeners[i].fn.call(listeners[i].context);
39626 break;
39627
39628 case 2:
39629 listeners[i].fn.call(listeners[i].context, a1);
39630 break;
39631
39632 case 3:
39633 listeners[i].fn.call(listeners[i].context, a1, a2);
39634 break;
39635
39636 case 4:
39637 listeners[i].fn.call(listeners[i].context, a1, a2, a3);
39638 break;
39639
39640 default:
39641 if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) {
39642 args[j - 1] = arguments[j];
39643 }
39644 listeners[i].fn.apply(listeners[i].context, args);
39645 }
39646 }
39647 }
39648
39649 return true;
39650};
39651/**
39652 * Add a listener for a given event.
39653 *
39654 * @param {(String|Symbol)} event The event name.
39655 * @param {Function} fn The listener function.
39656 * @param {*} [context=this] The context to invoke the listener with.
39657 * @returns {EventEmitter} `this`.
39658 * @public
39659 */
39660
39661
39662EventEmitter.prototype.on = function on(event, fn, context) {
39663 return addListener(this, event, fn, context, false);
39664};
39665/**
39666 * Add a one-time listener for a given event.
39667 *
39668 * @param {(String|Symbol)} event The event name.
39669 * @param {Function} fn The listener function.
39670 * @param {*} [context=this] The context to invoke the listener with.
39671 * @returns {EventEmitter} `this`.
39672 * @public
39673 */
39674
39675
39676EventEmitter.prototype.once = function once(event, fn, context) {
39677 return addListener(this, event, fn, context, true);
39678};
39679/**
39680 * Remove the listeners of a given event.
39681 *
39682 * @param {(String|Symbol)} event The event name.
39683 * @param {Function} fn Only remove the listeners that match this function.
39684 * @param {*} context Only remove the listeners that have this context.
39685 * @param {Boolean} once Only remove one-time listeners.
39686 * @returns {EventEmitter} `this`.
39687 * @public
39688 */
39689
39690
39691EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
39692 var evt = prefix ? prefix + event : event;
39693 if (!this._events[evt]) return this;
39694
39695 if (!fn) {
39696 clearEvent(this, evt);
39697 return this;
39698 }
39699
39700 var listeners = this._events[evt];
39701
39702 if (listeners.fn) {
39703 if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
39704 clearEvent(this, evt);
39705 }
39706 } else {
39707 for (var i = 0, events = [], length = listeners.length; i < length; i++) {
39708 if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) {
39709 events.push(listeners[i]);
39710 }
39711 } //
39712 // Reset the array, or remove it completely if we have no more listeners.
39713 //
39714
39715
39716 if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;else clearEvent(this, evt);
39717 }
39718
39719 return this;
39720};
39721/**
39722 * Remove all listeners, or those of the specified event.
39723 *
39724 * @param {(String|Symbol)} [event] The event name.
39725 * @returns {EventEmitter} `this`.
39726 * @public
39727 */
39728
39729
39730EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
39731 var evt;
39732
39733 if (event) {
39734 evt = prefix ? prefix + event : event;
39735 if (this._events[evt]) clearEvent(this, evt);
39736 } else {
39737 this._events = new Events();
39738 this._eventsCount = 0;
39739 }
39740
39741 return this;
39742}; //
39743// Alias methods names because people roll like that.
39744//
39745
39746
39747EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
39748EventEmitter.prototype.addListener = EventEmitter.prototype.on; //
39749// Expose the prefix.
39750//
39751
39752EventEmitter.prefixed = prefix; //
39753// Allow `EventEmitter` to be imported as module namespace.
39754//
39755
39756EventEmitter.EventEmitter = EventEmitter; //
39757// Expose the module.
39758//
39759
39760if (true) {
39761 module.exports = EventEmitter;
39762}
39763
39764/***/ }),
39765/* 608 */
39766/***/ (function(module, exports, __webpack_require__) {
39767
39768module.exports = __webpack_require__(609);
39769
39770
39771/***/ }),
39772/* 609 */
39773/***/ (function(module, exports, __webpack_require__) {
39774
39775/**
39776 * Copyright (c) 2014-present, Facebook, Inc.
39777 *
39778 * This source code is licensed under the MIT license found in the
39779 * LICENSE file in the root directory of this source tree.
39780 */
39781
39782var runtime = (function (exports) {
39783 "use strict";
39784
39785 var Op = Object.prototype;
39786 var hasOwn = Op.hasOwnProperty;
39787 var undefined; // More compressible than void 0.
39788 var $Symbol = typeof Symbol === "function" ? Symbol : {};
39789 var iteratorSymbol = $Symbol.iterator || "@@iterator";
39790 var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
39791 var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
39792
39793 function define(obj, key, value) {
39794 Object.defineProperty(obj, key, {
39795 value: value,
39796 enumerable: true,
39797 configurable: true,
39798 writable: true
39799 });
39800 return obj[key];
39801 }
39802 try {
39803 // IE 8 has a broken Object.defineProperty that only works on DOM objects.
39804 define({}, "");
39805 } catch (err) {
39806 define = function(obj, key, value) {
39807 return obj[key] = value;
39808 };
39809 }
39810
39811 function wrap(innerFn, outerFn, self, tryLocsList) {
39812 // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
39813 var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
39814 var generator = Object.create(protoGenerator.prototype);
39815 var context = new Context(tryLocsList || []);
39816
39817 // The ._invoke method unifies the implementations of the .next,
39818 // .throw, and .return methods.
39819 generator._invoke = makeInvokeMethod(innerFn, self, context);
39820
39821 return generator;
39822 }
39823 exports.wrap = wrap;
39824
39825 // Try/catch helper to minimize deoptimizations. Returns a completion
39826 // record like context.tryEntries[i].completion. This interface could
39827 // have been (and was previously) designed to take a closure to be
39828 // invoked without arguments, but in all the cases we care about we
39829 // already have an existing method we want to call, so there's no need
39830 // to create a new function object. We can even get away with assuming
39831 // the method takes exactly one argument, since that happens to be true
39832 // in every case, so we don't have to touch the arguments object. The
39833 // only additional allocation required is the completion record, which
39834 // has a stable shape and so hopefully should be cheap to allocate.
39835 function tryCatch(fn, obj, arg) {
39836 try {
39837 return { type: "normal", arg: fn.call(obj, arg) };
39838 } catch (err) {
39839 return { type: "throw", arg: err };
39840 }
39841 }
39842
39843 var GenStateSuspendedStart = "suspendedStart";
39844 var GenStateSuspendedYield = "suspendedYield";
39845 var GenStateExecuting = "executing";
39846 var GenStateCompleted = "completed";
39847
39848 // Returning this object from the innerFn has the same effect as
39849 // breaking out of the dispatch switch statement.
39850 var ContinueSentinel = {};
39851
39852 // Dummy constructor functions that we use as the .constructor and
39853 // .constructor.prototype properties for functions that return Generator
39854 // objects. For full spec compliance, you may wish to configure your
39855 // minifier not to mangle the names of these two functions.
39856 function Generator() {}
39857 function GeneratorFunction() {}
39858 function GeneratorFunctionPrototype() {}
39859
39860 // This is a polyfill for %IteratorPrototype% for environments that
39861 // don't natively support it.
39862 var IteratorPrototype = {};
39863 IteratorPrototype[iteratorSymbol] = function () {
39864 return this;
39865 };
39866
39867 var getProto = Object.getPrototypeOf;
39868 var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
39869 if (NativeIteratorPrototype &&
39870 NativeIteratorPrototype !== Op &&
39871 hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
39872 // This environment has a native %IteratorPrototype%; use it instead
39873 // of the polyfill.
39874 IteratorPrototype = NativeIteratorPrototype;
39875 }
39876
39877 var Gp = GeneratorFunctionPrototype.prototype =
39878 Generator.prototype = Object.create(IteratorPrototype);
39879 GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
39880 GeneratorFunctionPrototype.constructor = GeneratorFunction;
39881 GeneratorFunction.displayName = define(
39882 GeneratorFunctionPrototype,
39883 toStringTagSymbol,
39884 "GeneratorFunction"
39885 );
39886
39887 // Helper for defining the .next, .throw, and .return methods of the
39888 // Iterator interface in terms of a single ._invoke method.
39889 function defineIteratorMethods(prototype) {
39890 ["next", "throw", "return"].forEach(function(method) {
39891 define(prototype, method, function(arg) {
39892 return this._invoke(method, arg);
39893 });
39894 });
39895 }
39896
39897 exports.isGeneratorFunction = function(genFun) {
39898 var ctor = typeof genFun === "function" && genFun.constructor;
39899 return ctor
39900 ? ctor === GeneratorFunction ||
39901 // For the native GeneratorFunction constructor, the best we can
39902 // do is to check its .name property.
39903 (ctor.displayName || ctor.name) === "GeneratorFunction"
39904 : false;
39905 };
39906
39907 exports.mark = function(genFun) {
39908 if (Object.setPrototypeOf) {
39909 Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
39910 } else {
39911 genFun.__proto__ = GeneratorFunctionPrototype;
39912 define(genFun, toStringTagSymbol, "GeneratorFunction");
39913 }
39914 genFun.prototype = Object.create(Gp);
39915 return genFun;
39916 };
39917
39918 // Within the body of any async function, `await x` is transformed to
39919 // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
39920 // `hasOwn.call(value, "__await")` to determine if the yielded value is
39921 // meant to be awaited.
39922 exports.awrap = function(arg) {
39923 return { __await: arg };
39924 };
39925
39926 function AsyncIterator(generator, PromiseImpl) {
39927 function invoke(method, arg, resolve, reject) {
39928 var record = tryCatch(generator[method], generator, arg);
39929 if (record.type === "throw") {
39930 reject(record.arg);
39931 } else {
39932 var result = record.arg;
39933 var value = result.value;
39934 if (value &&
39935 typeof value === "object" &&
39936 hasOwn.call(value, "__await")) {
39937 return PromiseImpl.resolve(value.__await).then(function(value) {
39938 invoke("next", value, resolve, reject);
39939 }, function(err) {
39940 invoke("throw", err, resolve, reject);
39941 });
39942 }
39943
39944 return PromiseImpl.resolve(value).then(function(unwrapped) {
39945 // When a yielded Promise is resolved, its final value becomes
39946 // the .value of the Promise<{value,done}> result for the
39947 // current iteration.
39948 result.value = unwrapped;
39949 resolve(result);
39950 }, function(error) {
39951 // If a rejected Promise was yielded, throw the rejection back
39952 // into the async generator function so it can be handled there.
39953 return invoke("throw", error, resolve, reject);
39954 });
39955 }
39956 }
39957
39958 var previousPromise;
39959
39960 function enqueue(method, arg) {
39961 function callInvokeWithMethodAndArg() {
39962 return new PromiseImpl(function(resolve, reject) {
39963 invoke(method, arg, resolve, reject);
39964 });
39965 }
39966
39967 return previousPromise =
39968 // If enqueue has been called before, then we want to wait until
39969 // all previous Promises have been resolved before calling invoke,
39970 // so that results are always delivered in the correct order. If
39971 // enqueue has not been called before, then it is important to
39972 // call invoke immediately, without waiting on a callback to fire,
39973 // so that the async generator function has the opportunity to do
39974 // any necessary setup in a predictable way. This predictability
39975 // is why the Promise constructor synchronously invokes its
39976 // executor callback, and why async functions synchronously
39977 // execute code before the first await. Since we implement simple
39978 // async functions in terms of async generators, it is especially
39979 // important to get this right, even though it requires care.
39980 previousPromise ? previousPromise.then(
39981 callInvokeWithMethodAndArg,
39982 // Avoid propagating failures to Promises returned by later
39983 // invocations of the iterator.
39984 callInvokeWithMethodAndArg
39985 ) : callInvokeWithMethodAndArg();
39986 }
39987
39988 // Define the unified helper method that is used to implement .next,
39989 // .throw, and .return (see defineIteratorMethods).
39990 this._invoke = enqueue;
39991 }
39992
39993 defineIteratorMethods(AsyncIterator.prototype);
39994 AsyncIterator.prototype[asyncIteratorSymbol] = function () {
39995 return this;
39996 };
39997 exports.AsyncIterator = AsyncIterator;
39998
39999 // Note that simple async functions are implemented on top of
40000 // AsyncIterator objects; they just return a Promise for the value of
40001 // the final result produced by the iterator.
40002 exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
40003 if (PromiseImpl === void 0) PromiseImpl = Promise;
40004
40005 var iter = new AsyncIterator(
40006 wrap(innerFn, outerFn, self, tryLocsList),
40007 PromiseImpl
40008 );
40009
40010 return exports.isGeneratorFunction(outerFn)
40011 ? iter // If outerFn is a generator, return the full iterator.
40012 : iter.next().then(function(result) {
40013 return result.done ? result.value : iter.next();
40014 });
40015 };
40016
40017 function makeInvokeMethod(innerFn, self, context) {
40018 var state = GenStateSuspendedStart;
40019
40020 return function invoke(method, arg) {
40021 if (state === GenStateExecuting) {
40022 throw new Error("Generator is already running");
40023 }
40024
40025 if (state === GenStateCompleted) {
40026 if (method === "throw") {
40027 throw arg;
40028 }
40029
40030 // Be forgiving, per 25.3.3.3.3 of the spec:
40031 // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
40032 return doneResult();
40033 }
40034
40035 context.method = method;
40036 context.arg = arg;
40037
40038 while (true) {
40039 var delegate = context.delegate;
40040 if (delegate) {
40041 var delegateResult = maybeInvokeDelegate(delegate, context);
40042 if (delegateResult) {
40043 if (delegateResult === ContinueSentinel) continue;
40044 return delegateResult;
40045 }
40046 }
40047
40048 if (context.method === "next") {
40049 // Setting context._sent for legacy support of Babel's
40050 // function.sent implementation.
40051 context.sent = context._sent = context.arg;
40052
40053 } else if (context.method === "throw") {
40054 if (state === GenStateSuspendedStart) {
40055 state = GenStateCompleted;
40056 throw context.arg;
40057 }
40058
40059 context.dispatchException(context.arg);
40060
40061 } else if (context.method === "return") {
40062 context.abrupt("return", context.arg);
40063 }
40064
40065 state = GenStateExecuting;
40066
40067 var record = tryCatch(innerFn, self, context);
40068 if (record.type === "normal") {
40069 // If an exception is thrown from innerFn, we leave state ===
40070 // GenStateExecuting and loop back for another invocation.
40071 state = context.done
40072 ? GenStateCompleted
40073 : GenStateSuspendedYield;
40074
40075 if (record.arg === ContinueSentinel) {
40076 continue;
40077 }
40078
40079 return {
40080 value: record.arg,
40081 done: context.done
40082 };
40083
40084 } else if (record.type === "throw") {
40085 state = GenStateCompleted;
40086 // Dispatch the exception by looping back around to the
40087 // context.dispatchException(context.arg) call above.
40088 context.method = "throw";
40089 context.arg = record.arg;
40090 }
40091 }
40092 };
40093 }
40094
40095 // Call delegate.iterator[context.method](context.arg) and handle the
40096 // result, either by returning a { value, done } result from the
40097 // delegate iterator, or by modifying context.method and context.arg,
40098 // setting context.delegate to null, and returning the ContinueSentinel.
40099 function maybeInvokeDelegate(delegate, context) {
40100 var method = delegate.iterator[context.method];
40101 if (method === undefined) {
40102 // A .throw or .return when the delegate iterator has no .throw
40103 // method always terminates the yield* loop.
40104 context.delegate = null;
40105
40106 if (context.method === "throw") {
40107 // Note: ["return"] must be used for ES3 parsing compatibility.
40108 if (delegate.iterator["return"]) {
40109 // If the delegate iterator has a return method, give it a
40110 // chance to clean up.
40111 context.method = "return";
40112 context.arg = undefined;
40113 maybeInvokeDelegate(delegate, context);
40114
40115 if (context.method === "throw") {
40116 // If maybeInvokeDelegate(context) changed context.method from
40117 // "return" to "throw", let that override the TypeError below.
40118 return ContinueSentinel;
40119 }
40120 }
40121
40122 context.method = "throw";
40123 context.arg = new TypeError(
40124 "The iterator does not provide a 'throw' method");
40125 }
40126
40127 return ContinueSentinel;
40128 }
40129
40130 var record = tryCatch(method, delegate.iterator, context.arg);
40131
40132 if (record.type === "throw") {
40133 context.method = "throw";
40134 context.arg = record.arg;
40135 context.delegate = null;
40136 return ContinueSentinel;
40137 }
40138
40139 var info = record.arg;
40140
40141 if (! info) {
40142 context.method = "throw";
40143 context.arg = new TypeError("iterator result is not an object");
40144 context.delegate = null;
40145 return ContinueSentinel;
40146 }
40147
40148 if (info.done) {
40149 // Assign the result of the finished delegate to the temporary
40150 // variable specified by delegate.resultName (see delegateYield).
40151 context[delegate.resultName] = info.value;
40152
40153 // Resume execution at the desired location (see delegateYield).
40154 context.next = delegate.nextLoc;
40155
40156 // If context.method was "throw" but the delegate handled the
40157 // exception, let the outer generator proceed normally. If
40158 // context.method was "next", forget context.arg since it has been
40159 // "consumed" by the delegate iterator. If context.method was
40160 // "return", allow the original .return call to continue in the
40161 // outer generator.
40162 if (context.method !== "return") {
40163 context.method = "next";
40164 context.arg = undefined;
40165 }
40166
40167 } else {
40168 // Re-yield the result returned by the delegate method.
40169 return info;
40170 }
40171
40172 // The delegate iterator is finished, so forget it and continue with
40173 // the outer generator.
40174 context.delegate = null;
40175 return ContinueSentinel;
40176 }
40177
40178 // Define Generator.prototype.{next,throw,return} in terms of the
40179 // unified ._invoke helper method.
40180 defineIteratorMethods(Gp);
40181
40182 define(Gp, toStringTagSymbol, "Generator");
40183
40184 // A Generator should always return itself as the iterator object when the
40185 // @@iterator function is called on it. Some browsers' implementations of the
40186 // iterator prototype chain incorrectly implement this, causing the Generator
40187 // object to not be returned from this call. This ensures that doesn't happen.
40188 // See https://github.com/facebook/regenerator/issues/274 for more details.
40189 Gp[iteratorSymbol] = function() {
40190 return this;
40191 };
40192
40193 Gp.toString = function() {
40194 return "[object Generator]";
40195 };
40196
40197 function pushTryEntry(locs) {
40198 var entry = { tryLoc: locs[0] };
40199
40200 if (1 in locs) {
40201 entry.catchLoc = locs[1];
40202 }
40203
40204 if (2 in locs) {
40205 entry.finallyLoc = locs[2];
40206 entry.afterLoc = locs[3];
40207 }
40208
40209 this.tryEntries.push(entry);
40210 }
40211
40212 function resetTryEntry(entry) {
40213 var record = entry.completion || {};
40214 record.type = "normal";
40215 delete record.arg;
40216 entry.completion = record;
40217 }
40218
40219 function Context(tryLocsList) {
40220 // The root entry object (effectively a try statement without a catch
40221 // or a finally block) gives us a place to store values thrown from
40222 // locations where there is no enclosing try statement.
40223 this.tryEntries = [{ tryLoc: "root" }];
40224 tryLocsList.forEach(pushTryEntry, this);
40225 this.reset(true);
40226 }
40227
40228 exports.keys = function(object) {
40229 var keys = [];
40230 for (var key in object) {
40231 keys.push(key);
40232 }
40233 keys.reverse();
40234
40235 // Rather than returning an object with a next method, we keep
40236 // things simple and return the next function itself.
40237 return function next() {
40238 while (keys.length) {
40239 var key = keys.pop();
40240 if (key in object) {
40241 next.value = key;
40242 next.done = false;
40243 return next;
40244 }
40245 }
40246
40247 // To avoid creating an additional object, we just hang the .value
40248 // and .done properties off the next function object itself. This
40249 // also ensures that the minifier will not anonymize the function.
40250 next.done = true;
40251 return next;
40252 };
40253 };
40254
40255 function values(iterable) {
40256 if (iterable) {
40257 var iteratorMethod = iterable[iteratorSymbol];
40258 if (iteratorMethod) {
40259 return iteratorMethod.call(iterable);
40260 }
40261
40262 if (typeof iterable.next === "function") {
40263 return iterable;
40264 }
40265
40266 if (!isNaN(iterable.length)) {
40267 var i = -1, next = function next() {
40268 while (++i < iterable.length) {
40269 if (hasOwn.call(iterable, i)) {
40270 next.value = iterable[i];
40271 next.done = false;
40272 return next;
40273 }
40274 }
40275
40276 next.value = undefined;
40277 next.done = true;
40278
40279 return next;
40280 };
40281
40282 return next.next = next;
40283 }
40284 }
40285
40286 // Return an iterator with no values.
40287 return { next: doneResult };
40288 }
40289 exports.values = values;
40290
40291 function doneResult() {
40292 return { value: undefined, done: true };
40293 }
40294
40295 Context.prototype = {
40296 constructor: Context,
40297
40298 reset: function(skipTempReset) {
40299 this.prev = 0;
40300 this.next = 0;
40301 // Resetting context._sent for legacy support of Babel's
40302 // function.sent implementation.
40303 this.sent = this._sent = undefined;
40304 this.done = false;
40305 this.delegate = null;
40306
40307 this.method = "next";
40308 this.arg = undefined;
40309
40310 this.tryEntries.forEach(resetTryEntry);
40311
40312 if (!skipTempReset) {
40313 for (var name in this) {
40314 // Not sure about the optimal order of these conditions:
40315 if (name.charAt(0) === "t" &&
40316 hasOwn.call(this, name) &&
40317 !isNaN(+name.slice(1))) {
40318 this[name] = undefined;
40319 }
40320 }
40321 }
40322 },
40323
40324 stop: function() {
40325 this.done = true;
40326
40327 var rootEntry = this.tryEntries[0];
40328 var rootRecord = rootEntry.completion;
40329 if (rootRecord.type === "throw") {
40330 throw rootRecord.arg;
40331 }
40332
40333 return this.rval;
40334 },
40335
40336 dispatchException: function(exception) {
40337 if (this.done) {
40338 throw exception;
40339 }
40340
40341 var context = this;
40342 function handle(loc, caught) {
40343 record.type = "throw";
40344 record.arg = exception;
40345 context.next = loc;
40346
40347 if (caught) {
40348 // If the dispatched exception was caught by a catch block,
40349 // then let that catch block handle the exception normally.
40350 context.method = "next";
40351 context.arg = undefined;
40352 }
40353
40354 return !! caught;
40355 }
40356
40357 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
40358 var entry = this.tryEntries[i];
40359 var record = entry.completion;
40360
40361 if (entry.tryLoc === "root") {
40362 // Exception thrown outside of any try block that could handle
40363 // it, so set the completion value of the entire function to
40364 // throw the exception.
40365 return handle("end");
40366 }
40367
40368 if (entry.tryLoc <= this.prev) {
40369 var hasCatch = hasOwn.call(entry, "catchLoc");
40370 var hasFinally = hasOwn.call(entry, "finallyLoc");
40371
40372 if (hasCatch && hasFinally) {
40373 if (this.prev < entry.catchLoc) {
40374 return handle(entry.catchLoc, true);
40375 } else if (this.prev < entry.finallyLoc) {
40376 return handle(entry.finallyLoc);
40377 }
40378
40379 } else if (hasCatch) {
40380 if (this.prev < entry.catchLoc) {
40381 return handle(entry.catchLoc, true);
40382 }
40383
40384 } else if (hasFinally) {
40385 if (this.prev < entry.finallyLoc) {
40386 return handle(entry.finallyLoc);
40387 }
40388
40389 } else {
40390 throw new Error("try statement without catch or finally");
40391 }
40392 }
40393 }
40394 },
40395
40396 abrupt: function(type, arg) {
40397 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
40398 var entry = this.tryEntries[i];
40399 if (entry.tryLoc <= this.prev &&
40400 hasOwn.call(entry, "finallyLoc") &&
40401 this.prev < entry.finallyLoc) {
40402 var finallyEntry = entry;
40403 break;
40404 }
40405 }
40406
40407 if (finallyEntry &&
40408 (type === "break" ||
40409 type === "continue") &&
40410 finallyEntry.tryLoc <= arg &&
40411 arg <= finallyEntry.finallyLoc) {
40412 // Ignore the finally entry if control is not jumping to a
40413 // location outside the try/catch block.
40414 finallyEntry = null;
40415 }
40416
40417 var record = finallyEntry ? finallyEntry.completion : {};
40418 record.type = type;
40419 record.arg = arg;
40420
40421 if (finallyEntry) {
40422 this.method = "next";
40423 this.next = finallyEntry.finallyLoc;
40424 return ContinueSentinel;
40425 }
40426
40427 return this.complete(record);
40428 },
40429
40430 complete: function(record, afterLoc) {
40431 if (record.type === "throw") {
40432 throw record.arg;
40433 }
40434
40435 if (record.type === "break" ||
40436 record.type === "continue") {
40437 this.next = record.arg;
40438 } else if (record.type === "return") {
40439 this.rval = this.arg = record.arg;
40440 this.method = "return";
40441 this.next = "end";
40442 } else if (record.type === "normal" && afterLoc) {
40443 this.next = afterLoc;
40444 }
40445
40446 return ContinueSentinel;
40447 },
40448
40449 finish: function(finallyLoc) {
40450 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
40451 var entry = this.tryEntries[i];
40452 if (entry.finallyLoc === finallyLoc) {
40453 this.complete(entry.completion, entry.afterLoc);
40454 resetTryEntry(entry);
40455 return ContinueSentinel;
40456 }
40457 }
40458 },
40459
40460 "catch": function(tryLoc) {
40461 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
40462 var entry = this.tryEntries[i];
40463 if (entry.tryLoc === tryLoc) {
40464 var record = entry.completion;
40465 if (record.type === "throw") {
40466 var thrown = record.arg;
40467 resetTryEntry(entry);
40468 }
40469 return thrown;
40470 }
40471 }
40472
40473 // The context.catch method must only be called with a location
40474 // argument that corresponds to a known catch block.
40475 throw new Error("illegal catch attempt");
40476 },
40477
40478 delegateYield: function(iterable, resultName, nextLoc) {
40479 this.delegate = {
40480 iterator: values(iterable),
40481 resultName: resultName,
40482 nextLoc: nextLoc
40483 };
40484
40485 if (this.method === "next") {
40486 // Deliberately forget the last sent value so that we don't
40487 // accidentally pass it on to the delegate.
40488 this.arg = undefined;
40489 }
40490
40491 return ContinueSentinel;
40492 }
40493 };
40494
40495 // Regardless of whether this script is executing as a CommonJS module
40496 // or not, return the runtime object so that we can declare the variable
40497 // regeneratorRuntime in the outer scope, which allows this module to be
40498 // injected easily by `bin/regenerator --include-runtime script.js`.
40499 return exports;
40500
40501}(
40502 // If this script is executing as a CommonJS module, use module.exports
40503 // as the regeneratorRuntime namespace. Otherwise create a new empty
40504 // object. Either way, the resulting object will be used to initialize
40505 // the regeneratorRuntime variable at the top of this file.
40506 true ? module.exports : {}
40507));
40508
40509try {
40510 regeneratorRuntime = runtime;
40511} catch (accidentalStrictMode) {
40512 // This module should not be running in strict mode, so the above
40513 // assignment should always work unless something is misconfigured. Just
40514 // in case runtime.js accidentally runs in strict mode, we can escape
40515 // strict mode using a global Function call. This could conceivably fail
40516 // if a Content Security Policy forbids using Function, but in that case
40517 // the proper solution is to fix the accidental strict mode problem. If
40518 // you've misconfigured your bundler to force strict mode and applied a
40519 // CSP to forbid Function, and you're not willing to fix either of those
40520 // problems, please detail your unique predicament in a GitHub issue.
40521 Function("r", "regeneratorRuntime = r")(runtime);
40522}
40523
40524
40525/***/ }),
40526/* 610 */
40527/***/ (function(module, exports) {
40528
40529function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
40530 try {
40531 var info = gen[key](arg);
40532 var value = info.value;
40533 } catch (error) {
40534 reject(error);
40535 return;
40536 }
40537
40538 if (info.done) {
40539 resolve(value);
40540 } else {
40541 Promise.resolve(value).then(_next, _throw);
40542 }
40543}
40544
40545function _asyncToGenerator(fn) {
40546 return function () {
40547 var self = this,
40548 args = arguments;
40549 return new Promise(function (resolve, reject) {
40550 var gen = fn.apply(self, args);
40551
40552 function _next(value) {
40553 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
40554 }
40555
40556 function _throw(err) {
40557 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
40558 }
40559
40560 _next(undefined);
40561 });
40562 };
40563}
40564
40565module.exports = _asyncToGenerator;
40566
40567/***/ }),
40568/* 611 */
40569/***/ (function(module, exports, __webpack_require__) {
40570
40571var arrayWithoutHoles = __webpack_require__(612);
40572
40573var iterableToArray = __webpack_require__(261);
40574
40575var unsupportedIterableToArray = __webpack_require__(262);
40576
40577var nonIterableSpread = __webpack_require__(613);
40578
40579function _toConsumableArray(arr) {
40580 return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
40581}
40582
40583module.exports = _toConsumableArray;
40584
40585/***/ }),
40586/* 612 */
40587/***/ (function(module, exports, __webpack_require__) {
40588
40589var arrayLikeToArray = __webpack_require__(260);
40590
40591function _arrayWithoutHoles(arr) {
40592 if (Array.isArray(arr)) return arrayLikeToArray(arr);
40593}
40594
40595module.exports = _arrayWithoutHoles;
40596
40597/***/ }),
40598/* 613 */
40599/***/ (function(module, exports) {
40600
40601function _nonIterableSpread() {
40602 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
40603}
40604
40605module.exports = _nonIterableSpread;
40606
40607/***/ }),
40608/* 614 */
40609/***/ (function(module, exports) {
40610
40611function _defineProperty(obj, key, value) {
40612 if (key in obj) {
40613 Object.defineProperty(obj, key, {
40614 value: value,
40615 enumerable: true,
40616 configurable: true,
40617 writable: true
40618 });
40619 } else {
40620 obj[key] = value;
40621 }
40622
40623 return obj;
40624}
40625
40626module.exports = _defineProperty;
40627
40628/***/ }),
40629/* 615 */
40630/***/ (function(module, exports, __webpack_require__) {
40631
40632var objectWithoutPropertiesLoose = __webpack_require__(616);
40633
40634function _objectWithoutProperties(source, excluded) {
40635 if (source == null) return {};
40636 var target = objectWithoutPropertiesLoose(source, excluded);
40637 var key, i;
40638
40639 if (Object.getOwnPropertySymbols) {
40640 var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
40641
40642 for (i = 0; i < sourceSymbolKeys.length; i++) {
40643 key = sourceSymbolKeys[i];
40644 if (excluded.indexOf(key) >= 0) continue;
40645 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
40646 target[key] = source[key];
40647 }
40648 }
40649
40650 return target;
40651}
40652
40653module.exports = _objectWithoutProperties;
40654
40655/***/ }),
40656/* 616 */
40657/***/ (function(module, exports) {
40658
40659function _objectWithoutPropertiesLoose(source, excluded) {
40660 if (source == null) return {};
40661 var target = {};
40662 var sourceKeys = Object.keys(source);
40663 var key, i;
40664
40665 for (i = 0; i < sourceKeys.length; i++) {
40666 key = sourceKeys[i];
40667 if (excluded.indexOf(key) >= 0) continue;
40668 target[key] = source[key];
40669 }
40670
40671 return target;
40672}
40673
40674module.exports = _objectWithoutPropertiesLoose;
40675
40676/***/ }),
40677/* 617 */
40678/***/ (function(module, exports) {
40679
40680function _assertThisInitialized(self) {
40681 if (self === void 0) {
40682 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
40683 }
40684
40685 return self;
40686}
40687
40688module.exports = _assertThisInitialized;
40689
40690/***/ }),
40691/* 618 */
40692/***/ (function(module, exports) {
40693
40694function _inheritsLoose(subClass, superClass) {
40695 subClass.prototype = Object.create(superClass.prototype);
40696 subClass.prototype.constructor = subClass;
40697 subClass.__proto__ = superClass;
40698}
40699
40700module.exports = _inheritsLoose;
40701
40702/***/ }),
40703/* 619 */
40704/***/ (function(module, exports, __webpack_require__) {
40705
40706var arrayShuffle = __webpack_require__(620),
40707 baseShuffle = __webpack_require__(623),
40708 isArray = __webpack_require__(268);
40709
40710/**
40711 * Creates an array of shuffled values, using a version of the
40712 * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
40713 *
40714 * @static
40715 * @memberOf _
40716 * @since 0.1.0
40717 * @category Collection
40718 * @param {Array|Object} collection The collection to shuffle.
40719 * @returns {Array} Returns the new shuffled array.
40720 * @example
40721 *
40722 * _.shuffle([1, 2, 3, 4]);
40723 * // => [4, 1, 3, 2]
40724 */
40725function shuffle(collection) {
40726 var func = isArray(collection) ? arrayShuffle : baseShuffle;
40727 return func(collection);
40728}
40729
40730module.exports = shuffle;
40731
40732
40733/***/ }),
40734/* 620 */
40735/***/ (function(module, exports, __webpack_require__) {
40736
40737var copyArray = __webpack_require__(621),
40738 shuffleSelf = __webpack_require__(263);
40739
40740/**
40741 * A specialized version of `_.shuffle` for arrays.
40742 *
40743 * @private
40744 * @param {Array} array The array to shuffle.
40745 * @returns {Array} Returns the new shuffled array.
40746 */
40747function arrayShuffle(array) {
40748 return shuffleSelf(copyArray(array));
40749}
40750
40751module.exports = arrayShuffle;
40752
40753
40754/***/ }),
40755/* 621 */
40756/***/ (function(module, exports) {
40757
40758/**
40759 * Copies the values of `source` to `array`.
40760 *
40761 * @private
40762 * @param {Array} source The array to copy values from.
40763 * @param {Array} [array=[]] The array to copy values to.
40764 * @returns {Array} Returns `array`.
40765 */
40766function copyArray(source, array) {
40767 var index = -1,
40768 length = source.length;
40769
40770 array || (array = Array(length));
40771 while (++index < length) {
40772 array[index] = source[index];
40773 }
40774 return array;
40775}
40776
40777module.exports = copyArray;
40778
40779
40780/***/ }),
40781/* 622 */
40782/***/ (function(module, exports) {
40783
40784/* Built-in method references for those with the same name as other `lodash` methods. */
40785var nativeFloor = Math.floor,
40786 nativeRandom = Math.random;
40787
40788/**
40789 * The base implementation of `_.random` without support for returning
40790 * floating-point numbers.
40791 *
40792 * @private
40793 * @param {number} lower The lower bound.
40794 * @param {number} upper The upper bound.
40795 * @returns {number} Returns the random number.
40796 */
40797function baseRandom(lower, upper) {
40798 return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
40799}
40800
40801module.exports = baseRandom;
40802
40803
40804/***/ }),
40805/* 623 */
40806/***/ (function(module, exports, __webpack_require__) {
40807
40808var shuffleSelf = __webpack_require__(263),
40809 values = __webpack_require__(264);
40810
40811/**
40812 * The base implementation of `_.shuffle`.
40813 *
40814 * @private
40815 * @param {Array|Object} collection The collection to shuffle.
40816 * @returns {Array} Returns the new shuffled array.
40817 */
40818function baseShuffle(collection) {
40819 return shuffleSelf(values(collection));
40820}
40821
40822module.exports = baseShuffle;
40823
40824
40825/***/ }),
40826/* 624 */
40827/***/ (function(module, exports, __webpack_require__) {
40828
40829var arrayMap = __webpack_require__(625);
40830
40831/**
40832 * The base implementation of `_.values` and `_.valuesIn` which creates an
40833 * array of `object` property values corresponding to the property names
40834 * of `props`.
40835 *
40836 * @private
40837 * @param {Object} object The object to query.
40838 * @param {Array} props The property names to get values for.
40839 * @returns {Object} Returns the array of property values.
40840 */
40841function baseValues(object, props) {
40842 return arrayMap(props, function(key) {
40843 return object[key];
40844 });
40845}
40846
40847module.exports = baseValues;
40848
40849
40850/***/ }),
40851/* 625 */
40852/***/ (function(module, exports) {
40853
40854/**
40855 * A specialized version of `_.map` for arrays without support for iteratee
40856 * shorthands.
40857 *
40858 * @private
40859 * @param {Array} [array] The array to iterate over.
40860 * @param {Function} iteratee The function invoked per iteration.
40861 * @returns {Array} Returns the new mapped array.
40862 */
40863function arrayMap(array, iteratee) {
40864 var index = -1,
40865 length = array == null ? 0 : array.length,
40866 result = Array(length);
40867
40868 while (++index < length) {
40869 result[index] = iteratee(array[index], index, array);
40870 }
40871 return result;
40872}
40873
40874module.exports = arrayMap;
40875
40876
40877/***/ }),
40878/* 626 */
40879/***/ (function(module, exports, __webpack_require__) {
40880
40881var arrayLikeKeys = __webpack_require__(627),
40882 baseKeys = __webpack_require__(640),
40883 isArrayLike = __webpack_require__(643);
40884
40885/**
40886 * Creates an array of the own enumerable property names of `object`.
40887 *
40888 * **Note:** Non-object values are coerced to objects. See the
40889 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
40890 * for more details.
40891 *
40892 * @static
40893 * @since 0.1.0
40894 * @memberOf _
40895 * @category Object
40896 * @param {Object} object The object to query.
40897 * @returns {Array} Returns the array of property names.
40898 * @example
40899 *
40900 * function Foo() {
40901 * this.a = 1;
40902 * this.b = 2;
40903 * }
40904 *
40905 * Foo.prototype.c = 3;
40906 *
40907 * _.keys(new Foo);
40908 * // => ['a', 'b'] (iteration order is not guaranteed)
40909 *
40910 * _.keys('hi');
40911 * // => ['0', '1']
40912 */
40913function keys(object) {
40914 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
40915}
40916
40917module.exports = keys;
40918
40919
40920/***/ }),
40921/* 627 */
40922/***/ (function(module, exports, __webpack_require__) {
40923
40924var baseTimes = __webpack_require__(628),
40925 isArguments = __webpack_require__(629),
40926 isArray = __webpack_require__(268),
40927 isBuffer = __webpack_require__(633),
40928 isIndex = __webpack_require__(635),
40929 isTypedArray = __webpack_require__(636);
40930
40931/** Used for built-in method references. */
40932var objectProto = Object.prototype;
40933
40934/** Used to check objects for own properties. */
40935var hasOwnProperty = objectProto.hasOwnProperty;
40936
40937/**
40938 * Creates an array of the enumerable property names of the array-like `value`.
40939 *
40940 * @private
40941 * @param {*} value The value to query.
40942 * @param {boolean} inherited Specify returning inherited property names.
40943 * @returns {Array} Returns the array of property names.
40944 */
40945function arrayLikeKeys(value, inherited) {
40946 var isArr = isArray(value),
40947 isArg = !isArr && isArguments(value),
40948 isBuff = !isArr && !isArg && isBuffer(value),
40949 isType = !isArr && !isArg && !isBuff && isTypedArray(value),
40950 skipIndexes = isArr || isArg || isBuff || isType,
40951 result = skipIndexes ? baseTimes(value.length, String) : [],
40952 length = result.length;
40953
40954 for (var key in value) {
40955 if ((inherited || hasOwnProperty.call(value, key)) &&
40956 !(skipIndexes && (
40957 // Safari 9 has enumerable `arguments.length` in strict mode.
40958 key == 'length' ||
40959 // Node.js 0.10 has enumerable non-index properties on buffers.
40960 (isBuff && (key == 'offset' || key == 'parent')) ||
40961 // PhantomJS 2 has enumerable non-index properties on typed arrays.
40962 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
40963 // Skip index properties.
40964 isIndex(key, length)
40965 ))) {
40966 result.push(key);
40967 }
40968 }
40969 return result;
40970}
40971
40972module.exports = arrayLikeKeys;
40973
40974
40975/***/ }),
40976/* 628 */
40977/***/ (function(module, exports) {
40978
40979/**
40980 * The base implementation of `_.times` without support for iteratee shorthands
40981 * or max array length checks.
40982 *
40983 * @private
40984 * @param {number} n The number of times to invoke `iteratee`.
40985 * @param {Function} iteratee The function invoked per iteration.
40986 * @returns {Array} Returns the array of results.
40987 */
40988function baseTimes(n, iteratee) {
40989 var index = -1,
40990 result = Array(n);
40991
40992 while (++index < n) {
40993 result[index] = iteratee(index);
40994 }
40995 return result;
40996}
40997
40998module.exports = baseTimes;
40999
41000
41001/***/ }),
41002/* 629 */
41003/***/ (function(module, exports, __webpack_require__) {
41004
41005var baseIsArguments = __webpack_require__(630),
41006 isObjectLike = __webpack_require__(118);
41007
41008/** Used for built-in method references. */
41009var objectProto = Object.prototype;
41010
41011/** Used to check objects for own properties. */
41012var hasOwnProperty = objectProto.hasOwnProperty;
41013
41014/** Built-in value references. */
41015var propertyIsEnumerable = objectProto.propertyIsEnumerable;
41016
41017/**
41018 * Checks if `value` is likely an `arguments` object.
41019 *
41020 * @static
41021 * @memberOf _
41022 * @since 0.1.0
41023 * @category Lang
41024 * @param {*} value The value to check.
41025 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
41026 * else `false`.
41027 * @example
41028 *
41029 * _.isArguments(function() { return arguments; }());
41030 * // => true
41031 *
41032 * _.isArguments([1, 2, 3]);
41033 * // => false
41034 */
41035var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
41036 return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
41037 !propertyIsEnumerable.call(value, 'callee');
41038};
41039
41040module.exports = isArguments;
41041
41042
41043/***/ }),
41044/* 630 */
41045/***/ (function(module, exports, __webpack_require__) {
41046
41047var baseGetTag = __webpack_require__(117),
41048 isObjectLike = __webpack_require__(118);
41049
41050/** `Object#toString` result references. */
41051var argsTag = '[object Arguments]';
41052
41053/**
41054 * The base implementation of `_.isArguments`.
41055 *
41056 * @private
41057 * @param {*} value The value to check.
41058 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
41059 */
41060function baseIsArguments(value) {
41061 return isObjectLike(value) && baseGetTag(value) == argsTag;
41062}
41063
41064module.exports = baseIsArguments;
41065
41066
41067/***/ }),
41068/* 631 */
41069/***/ (function(module, exports, __webpack_require__) {
41070
41071var Symbol = __webpack_require__(265);
41072
41073/** Used for built-in method references. */
41074var objectProto = Object.prototype;
41075
41076/** Used to check objects for own properties. */
41077var hasOwnProperty = objectProto.hasOwnProperty;
41078
41079/**
41080 * Used to resolve the
41081 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
41082 * of values.
41083 */
41084var nativeObjectToString = objectProto.toString;
41085
41086/** Built-in value references. */
41087var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
41088
41089/**
41090 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
41091 *
41092 * @private
41093 * @param {*} value The value to query.
41094 * @returns {string} Returns the raw `toStringTag`.
41095 */
41096function getRawTag(value) {
41097 var isOwn = hasOwnProperty.call(value, symToStringTag),
41098 tag = value[symToStringTag];
41099
41100 try {
41101 value[symToStringTag] = undefined;
41102 var unmasked = true;
41103 } catch (e) {}
41104
41105 var result = nativeObjectToString.call(value);
41106 if (unmasked) {
41107 if (isOwn) {
41108 value[symToStringTag] = tag;
41109 } else {
41110 delete value[symToStringTag];
41111 }
41112 }
41113 return result;
41114}
41115
41116module.exports = getRawTag;
41117
41118
41119/***/ }),
41120/* 632 */
41121/***/ (function(module, exports) {
41122
41123/** Used for built-in method references. */
41124var objectProto = Object.prototype;
41125
41126/**
41127 * Used to resolve the
41128 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
41129 * of values.
41130 */
41131var nativeObjectToString = objectProto.toString;
41132
41133/**
41134 * Converts `value` to a string using `Object.prototype.toString`.
41135 *
41136 * @private
41137 * @param {*} value The value to convert.
41138 * @returns {string} Returns the converted string.
41139 */
41140function objectToString(value) {
41141 return nativeObjectToString.call(value);
41142}
41143
41144module.exports = objectToString;
41145
41146
41147/***/ }),
41148/* 633 */
41149/***/ (function(module, exports, __webpack_require__) {
41150
41151/* WEBPACK VAR INJECTION */(function(module) {var root = __webpack_require__(266),
41152 stubFalse = __webpack_require__(634);
41153
41154/** Detect free variable `exports`. */
41155var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
41156
41157/** Detect free variable `module`. */
41158var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
41159
41160/** Detect the popular CommonJS extension `module.exports`. */
41161var moduleExports = freeModule && freeModule.exports === freeExports;
41162
41163/** Built-in value references. */
41164var Buffer = moduleExports ? root.Buffer : undefined;
41165
41166/* Built-in method references for those with the same name as other `lodash` methods. */
41167var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
41168
41169/**
41170 * Checks if `value` is a buffer.
41171 *
41172 * @static
41173 * @memberOf _
41174 * @since 4.3.0
41175 * @category Lang
41176 * @param {*} value The value to check.
41177 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
41178 * @example
41179 *
41180 * _.isBuffer(new Buffer(2));
41181 * // => true
41182 *
41183 * _.isBuffer(new Uint8Array(2));
41184 * // => false
41185 */
41186var isBuffer = nativeIsBuffer || stubFalse;
41187
41188module.exports = isBuffer;
41189
41190/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(269)(module)))
41191
41192/***/ }),
41193/* 634 */
41194/***/ (function(module, exports) {
41195
41196/**
41197 * This method returns `false`.
41198 *
41199 * @static
41200 * @memberOf _
41201 * @since 4.13.0
41202 * @category Util
41203 * @returns {boolean} Returns `false`.
41204 * @example
41205 *
41206 * _.times(2, _.stubFalse);
41207 * // => [false, false]
41208 */
41209function stubFalse() {
41210 return false;
41211}
41212
41213module.exports = stubFalse;
41214
41215
41216/***/ }),
41217/* 635 */
41218/***/ (function(module, exports) {
41219
41220/** Used as references for various `Number` constants. */
41221var MAX_SAFE_INTEGER = 9007199254740991;
41222
41223/** Used to detect unsigned integer values. */
41224var reIsUint = /^(?:0|[1-9]\d*)$/;
41225
41226/**
41227 * Checks if `value` is a valid array-like index.
41228 *
41229 * @private
41230 * @param {*} value The value to check.
41231 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
41232 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
41233 */
41234function isIndex(value, length) {
41235 var type = typeof value;
41236 length = length == null ? MAX_SAFE_INTEGER : length;
41237
41238 return !!length &&
41239 (type == 'number' ||
41240 (type != 'symbol' && reIsUint.test(value))) &&
41241 (value > -1 && value % 1 == 0 && value < length);
41242}
41243
41244module.exports = isIndex;
41245
41246
41247/***/ }),
41248/* 636 */
41249/***/ (function(module, exports, __webpack_require__) {
41250
41251var baseIsTypedArray = __webpack_require__(637),
41252 baseUnary = __webpack_require__(638),
41253 nodeUtil = __webpack_require__(639);
41254
41255/* Node.js helper references. */
41256var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
41257
41258/**
41259 * Checks if `value` is classified as a typed array.
41260 *
41261 * @static
41262 * @memberOf _
41263 * @since 3.0.0
41264 * @category Lang
41265 * @param {*} value The value to check.
41266 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
41267 * @example
41268 *
41269 * _.isTypedArray(new Uint8Array);
41270 * // => true
41271 *
41272 * _.isTypedArray([]);
41273 * // => false
41274 */
41275var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
41276
41277module.exports = isTypedArray;
41278
41279
41280/***/ }),
41281/* 637 */
41282/***/ (function(module, exports, __webpack_require__) {
41283
41284var baseGetTag = __webpack_require__(117),
41285 isLength = __webpack_require__(270),
41286 isObjectLike = __webpack_require__(118);
41287
41288/** `Object#toString` result references. */
41289var argsTag = '[object Arguments]',
41290 arrayTag = '[object Array]',
41291 boolTag = '[object Boolean]',
41292 dateTag = '[object Date]',
41293 errorTag = '[object Error]',
41294 funcTag = '[object Function]',
41295 mapTag = '[object Map]',
41296 numberTag = '[object Number]',
41297 objectTag = '[object Object]',
41298 regexpTag = '[object RegExp]',
41299 setTag = '[object Set]',
41300 stringTag = '[object String]',
41301 weakMapTag = '[object WeakMap]';
41302
41303var arrayBufferTag = '[object ArrayBuffer]',
41304 dataViewTag = '[object DataView]',
41305 float32Tag = '[object Float32Array]',
41306 float64Tag = '[object Float64Array]',
41307 int8Tag = '[object Int8Array]',
41308 int16Tag = '[object Int16Array]',
41309 int32Tag = '[object Int32Array]',
41310 uint8Tag = '[object Uint8Array]',
41311 uint8ClampedTag = '[object Uint8ClampedArray]',
41312 uint16Tag = '[object Uint16Array]',
41313 uint32Tag = '[object Uint32Array]';
41314
41315/** Used to identify `toStringTag` values of typed arrays. */
41316var typedArrayTags = {};
41317typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
41318typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
41319typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
41320typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
41321typedArrayTags[uint32Tag] = true;
41322typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
41323typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
41324typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
41325typedArrayTags[errorTag] = typedArrayTags[funcTag] =
41326typedArrayTags[mapTag] = typedArrayTags[numberTag] =
41327typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
41328typedArrayTags[setTag] = typedArrayTags[stringTag] =
41329typedArrayTags[weakMapTag] = false;
41330
41331/**
41332 * The base implementation of `_.isTypedArray` without Node.js optimizations.
41333 *
41334 * @private
41335 * @param {*} value The value to check.
41336 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
41337 */
41338function baseIsTypedArray(value) {
41339 return isObjectLike(value) &&
41340 isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
41341}
41342
41343module.exports = baseIsTypedArray;
41344
41345
41346/***/ }),
41347/* 638 */
41348/***/ (function(module, exports) {
41349
41350/**
41351 * The base implementation of `_.unary` without support for storing metadata.
41352 *
41353 * @private
41354 * @param {Function} func The function to cap arguments for.
41355 * @returns {Function} Returns the new capped function.
41356 */
41357function baseUnary(func) {
41358 return function(value) {
41359 return func(value);
41360 };
41361}
41362
41363module.exports = baseUnary;
41364
41365
41366/***/ }),
41367/* 639 */
41368/***/ (function(module, exports, __webpack_require__) {
41369
41370/* WEBPACK VAR INJECTION */(function(module) {var freeGlobal = __webpack_require__(267);
41371
41372/** Detect free variable `exports`. */
41373var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
41374
41375/** Detect free variable `module`. */
41376var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
41377
41378/** Detect the popular CommonJS extension `module.exports`. */
41379var moduleExports = freeModule && freeModule.exports === freeExports;
41380
41381/** Detect free variable `process` from Node.js. */
41382var freeProcess = moduleExports && freeGlobal.process;
41383
41384/** Used to access faster Node.js helpers. */
41385var nodeUtil = (function() {
41386 try {
41387 // Use `util.types` for Node.js 10+.
41388 var types = freeModule && freeModule.require && freeModule.require('util').types;
41389
41390 if (types) {
41391 return types;
41392 }
41393
41394 // Legacy `process.binding('util')` for Node.js < 10.
41395 return freeProcess && freeProcess.binding && freeProcess.binding('util');
41396 } catch (e) {}
41397}());
41398
41399module.exports = nodeUtil;
41400
41401/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(269)(module)))
41402
41403/***/ }),
41404/* 640 */
41405/***/ (function(module, exports, __webpack_require__) {
41406
41407var isPrototype = __webpack_require__(641),
41408 nativeKeys = __webpack_require__(642);
41409
41410/** Used for built-in method references. */
41411var objectProto = Object.prototype;
41412
41413/** Used to check objects for own properties. */
41414var hasOwnProperty = objectProto.hasOwnProperty;
41415
41416/**
41417 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
41418 *
41419 * @private
41420 * @param {Object} object The object to query.
41421 * @returns {Array} Returns the array of property names.
41422 */
41423function baseKeys(object) {
41424 if (!isPrototype(object)) {
41425 return nativeKeys(object);
41426 }
41427 var result = [];
41428 for (var key in Object(object)) {
41429 if (hasOwnProperty.call(object, key) && key != 'constructor') {
41430 result.push(key);
41431 }
41432 }
41433 return result;
41434}
41435
41436module.exports = baseKeys;
41437
41438
41439/***/ }),
41440/* 641 */
41441/***/ (function(module, exports) {
41442
41443/** Used for built-in method references. */
41444var objectProto = Object.prototype;
41445
41446/**
41447 * Checks if `value` is likely a prototype object.
41448 *
41449 * @private
41450 * @param {*} value The value to check.
41451 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
41452 */
41453function isPrototype(value) {
41454 var Ctor = value && value.constructor,
41455 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
41456
41457 return value === proto;
41458}
41459
41460module.exports = isPrototype;
41461
41462
41463/***/ }),
41464/* 642 */
41465/***/ (function(module, exports, __webpack_require__) {
41466
41467var overArg = __webpack_require__(271);
41468
41469/* Built-in method references for those with the same name as other `lodash` methods. */
41470var nativeKeys = overArg(Object.keys, Object);
41471
41472module.exports = nativeKeys;
41473
41474
41475/***/ }),
41476/* 643 */
41477/***/ (function(module, exports, __webpack_require__) {
41478
41479var isFunction = __webpack_require__(644),
41480 isLength = __webpack_require__(270);
41481
41482/**
41483 * Checks if `value` is array-like. A value is considered array-like if it's
41484 * not a function and has a `value.length` that's an integer greater than or
41485 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
41486 *
41487 * @static
41488 * @memberOf _
41489 * @since 4.0.0
41490 * @category Lang
41491 * @param {*} value The value to check.
41492 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
41493 * @example
41494 *
41495 * _.isArrayLike([1, 2, 3]);
41496 * // => true
41497 *
41498 * _.isArrayLike(document.body.children);
41499 * // => true
41500 *
41501 * _.isArrayLike('abc');
41502 * // => true
41503 *
41504 * _.isArrayLike(_.noop);
41505 * // => false
41506 */
41507function isArrayLike(value) {
41508 return value != null && isLength(value.length) && !isFunction(value);
41509}
41510
41511module.exports = isArrayLike;
41512
41513
41514/***/ }),
41515/* 644 */
41516/***/ (function(module, exports, __webpack_require__) {
41517
41518var baseGetTag = __webpack_require__(117),
41519 isObject = __webpack_require__(645);
41520
41521/** `Object#toString` result references. */
41522var asyncTag = '[object AsyncFunction]',
41523 funcTag = '[object Function]',
41524 genTag = '[object GeneratorFunction]',
41525 proxyTag = '[object Proxy]';
41526
41527/**
41528 * Checks if `value` is classified as a `Function` object.
41529 *
41530 * @static
41531 * @memberOf _
41532 * @since 0.1.0
41533 * @category Lang
41534 * @param {*} value The value to check.
41535 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
41536 * @example
41537 *
41538 * _.isFunction(_);
41539 * // => true
41540 *
41541 * _.isFunction(/abc/);
41542 * // => false
41543 */
41544function isFunction(value) {
41545 if (!isObject(value)) {
41546 return false;
41547 }
41548 // The use of `Object#toString` avoids issues with the `typeof` operator
41549 // in Safari 9 which returns 'object' for typed arrays and other constructors.
41550 var tag = baseGetTag(value);
41551 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
41552}
41553
41554module.exports = isFunction;
41555
41556
41557/***/ }),
41558/* 645 */
41559/***/ (function(module, exports) {
41560
41561/**
41562 * Checks if `value` is the
41563 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
41564 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
41565 *
41566 * @static
41567 * @memberOf _
41568 * @since 0.1.0
41569 * @category Lang
41570 * @param {*} value The value to check.
41571 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
41572 * @example
41573 *
41574 * _.isObject({});
41575 * // => true
41576 *
41577 * _.isObject([1, 2, 3]);
41578 * // => true
41579 *
41580 * _.isObject(_.noop);
41581 * // => true
41582 *
41583 * _.isObject(null);
41584 * // => false
41585 */
41586function isObject(value) {
41587 var type = typeof value;
41588 return value != null && (type == 'object' || type == 'function');
41589}
41590
41591module.exports = isObject;
41592
41593
41594/***/ }),
41595/* 646 */
41596/***/ (function(module, exports, __webpack_require__) {
41597
41598var arrayWithHoles = __webpack_require__(647);
41599
41600var iterableToArray = __webpack_require__(261);
41601
41602var unsupportedIterableToArray = __webpack_require__(262);
41603
41604var nonIterableRest = __webpack_require__(648);
41605
41606function _toArray(arr) {
41607 return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest();
41608}
41609
41610module.exports = _toArray;
41611
41612/***/ }),
41613/* 647 */
41614/***/ (function(module, exports) {
41615
41616function _arrayWithHoles(arr) {
41617 if (Array.isArray(arr)) return arr;
41618}
41619
41620module.exports = _arrayWithHoles;
41621
41622/***/ }),
41623/* 648 */
41624/***/ (function(module, exports) {
41625
41626function _nonIterableRest() {
41627 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
41628}
41629
41630module.exports = _nonIterableRest;
41631
41632/***/ }),
41633/* 649 */
41634/***/ (function(module, exports) {
41635
41636function _defineProperties(target, props) {
41637 for (var i = 0; i < props.length; i++) {
41638 var descriptor = props[i];
41639 descriptor.enumerable = descriptor.enumerable || false;
41640 descriptor.configurable = true;
41641 if ("value" in descriptor) descriptor.writable = true;
41642 Object.defineProperty(target, descriptor.key, descriptor);
41643 }
41644}
41645
41646function _createClass(Constructor, protoProps, staticProps) {
41647 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
41648 if (staticProps) _defineProperties(Constructor, staticProps);
41649 return Constructor;
41650}
41651
41652module.exports = _createClass;
41653
41654/***/ }),
41655/* 650 */
41656/***/ (function(module, exports) {
41657
41658function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
41659 var desc = {};
41660 Object.keys(descriptor).forEach(function (key) {
41661 desc[key] = descriptor[key];
41662 });
41663 desc.enumerable = !!desc.enumerable;
41664 desc.configurable = !!desc.configurable;
41665
41666 if ('value' in desc || desc.initializer) {
41667 desc.writable = true;
41668 }
41669
41670 desc = decorators.slice().reverse().reduce(function (desc, decorator) {
41671 return decorator(target, property, desc) || desc;
41672 }, desc);
41673
41674 if (context && desc.initializer !== void 0) {
41675 desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
41676 desc.initializer = undefined;
41677 }
41678
41679 if (desc.initializer === void 0) {
41680 Object.defineProperty(target, property, desc);
41681 desc = null;
41682 }
41683
41684 return desc;
41685}
41686
41687module.exports = _applyDecoratedDescriptor;
41688
41689/***/ }),
41690/* 651 */
41691/***/ (function(module, exports, __webpack_require__) {
41692
41693/*
41694
41695 Javascript State Machine Library - https://github.com/jakesgordon/javascript-state-machine
41696
41697 Copyright (c) 2012, 2013, 2014, 2015, Jake Gordon and contributors
41698 Released under the MIT license - https://github.com/jakesgordon/javascript-state-machine/blob/master/LICENSE
41699
41700*/
41701
41702(function () {
41703
41704 var StateMachine = {
41705
41706 //---------------------------------------------------------------------------
41707
41708 VERSION: "2.4.0",
41709
41710 //---------------------------------------------------------------------------
41711
41712 Result: {
41713 SUCCEEDED: 1, // the event transitioned successfully from one state to another
41714 NOTRANSITION: 2, // the event was successfull but no state transition was necessary
41715 CANCELLED: 3, // the event was cancelled by the caller in a beforeEvent callback
41716 PENDING: 4 // the event is asynchronous and the caller is in control of when the transition occurs
41717 },
41718
41719 Error: {
41720 INVALID_TRANSITION: 100, // caller tried to fire an event that was innapropriate in the current state
41721 PENDING_TRANSITION: 200, // caller tried to fire an event while an async transition was still pending
41722 INVALID_CALLBACK: 300 // caller provided callback function threw an exception
41723 },
41724
41725 WILDCARD: '*',
41726 ASYNC: 'async',
41727
41728 //---------------------------------------------------------------------------
41729
41730 create: function(cfg, target) {
41731
41732 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 }
41733 var terminal = cfg.terminal || cfg['final'];
41734 var fsm = target || cfg.target || {};
41735 var events = cfg.events || [];
41736 var callbacks = cfg.callbacks || {};
41737 var map = {}; // track state transitions allowed for an event { event: { from: [ to ] } }
41738 var transitions = {}; // track events allowed from a state { state: [ event ] }
41739
41740 var add = function(e) {
41741 var from = Array.isArray(e.from) ? e.from : (e.from ? [e.from] : [StateMachine.WILDCARD]); // allow 'wildcard' transition if 'from' is not specified
41742 map[e.name] = map[e.name] || {};
41743 for (var n = 0 ; n < from.length ; n++) {
41744 transitions[from[n]] = transitions[from[n]] || [];
41745 transitions[from[n]].push(e.name);
41746
41747 map[e.name][from[n]] = e.to || from[n]; // allow no-op transition if 'to' is not specified
41748 }
41749 if (e.to)
41750 transitions[e.to] = transitions[e.to] || [];
41751 };
41752
41753 if (initial) {
41754 initial.event = initial.event || 'startup';
41755 add({ name: initial.event, from: 'none', to: initial.state });
41756 }
41757
41758 for(var n = 0 ; n < events.length ; n++)
41759 add(events[n]);
41760
41761 for(var name in map) {
41762 if (map.hasOwnProperty(name))
41763 fsm[name] = StateMachine.buildEvent(name, map[name]);
41764 }
41765
41766 for(var name in callbacks) {
41767 if (callbacks.hasOwnProperty(name))
41768 fsm[name] = callbacks[name]
41769 }
41770
41771 fsm.current = 'none';
41772 fsm.is = function(state) { return Array.isArray(state) ? (state.indexOf(this.current) >= 0) : (this.current === state); };
41773 fsm.can = function(event) { return !this.transition && (map[event] !== undefined) && (map[event].hasOwnProperty(this.current) || map[event].hasOwnProperty(StateMachine.WILDCARD)); }
41774 fsm.cannot = function(event) { return !this.can(event); };
41775 fsm.transitions = function() { return (transitions[this.current] || []).concat(transitions[StateMachine.WILDCARD] || []); };
41776 fsm.isFinished = function() { return this.is(terminal); };
41777 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)
41778 fsm.states = function() { return Object.keys(transitions).sort() };
41779
41780 if (initial && !initial.defer)
41781 fsm[initial.event]();
41782
41783 return fsm;
41784
41785 },
41786
41787 //===========================================================================
41788
41789 doCallback: function(fsm, func, name, from, to, args) {
41790 if (func) {
41791 try {
41792 return func.apply(fsm, [name, from, to].concat(args));
41793 }
41794 catch(e) {
41795 return fsm.error(name, from, to, args, StateMachine.Error.INVALID_CALLBACK, "an exception occurred in a caller-provided callback function", e);
41796 }
41797 }
41798 },
41799
41800 beforeAnyEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onbeforeevent'], name, from, to, args); },
41801 afterAnyEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onafterevent'] || fsm['onevent'], name, from, to, args); },
41802 leaveAnyState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onleavestate'], name, from, to, args); },
41803 enterAnyState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onenterstate'] || fsm['onstate'], name, from, to, args); },
41804 changeState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onchangestate'], name, from, to, args); },
41805
41806 beforeThisEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onbefore' + name], name, from, to, args); },
41807 afterThisEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onafter' + name] || fsm['on' + name], name, from, to, args); },
41808 leaveThisState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onleave' + from], name, from, to, args); },
41809 enterThisState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onenter' + to] || fsm['on' + to], name, from, to, args); },
41810
41811 beforeEvent: function(fsm, name, from, to, args) {
41812 if ((false === StateMachine.beforeThisEvent(fsm, name, from, to, args)) ||
41813 (false === StateMachine.beforeAnyEvent( fsm, name, from, to, args)))
41814 return false;
41815 },
41816
41817 afterEvent: function(fsm, name, from, to, args) {
41818 StateMachine.afterThisEvent(fsm, name, from, to, args);
41819 StateMachine.afterAnyEvent( fsm, name, from, to, args);
41820 },
41821
41822 leaveState: function(fsm, name, from, to, args) {
41823 var specific = StateMachine.leaveThisState(fsm, name, from, to, args),
41824 general = StateMachine.leaveAnyState( fsm, name, from, to, args);
41825 if ((false === specific) || (false === general))
41826 return false;
41827 else if ((StateMachine.ASYNC === specific) || (StateMachine.ASYNC === general))
41828 return StateMachine.ASYNC;
41829 },
41830
41831 enterState: function(fsm, name, from, to, args) {
41832 StateMachine.enterThisState(fsm, name, from, to, args);
41833 StateMachine.enterAnyState( fsm, name, from, to, args);
41834 },
41835
41836 //===========================================================================
41837
41838 buildEvent: function(name, map) {
41839 return function() {
41840
41841 var from = this.current;
41842 var to = map[from] || (map[StateMachine.WILDCARD] != StateMachine.WILDCARD ? map[StateMachine.WILDCARD] : from) || from;
41843 var args = Array.prototype.slice.call(arguments); // turn arguments into pure array
41844
41845 if (this.transition)
41846 return this.error(name, from, to, args, StateMachine.Error.PENDING_TRANSITION, "event " + name + " inappropriate because previous transition did not complete");
41847
41848 if (this.cannot(name))
41849 return this.error(name, from, to, args, StateMachine.Error.INVALID_TRANSITION, "event " + name + " inappropriate in current state " + this.current);
41850
41851 if (false === StateMachine.beforeEvent(this, name, from, to, args))
41852 return StateMachine.Result.CANCELLED;
41853
41854 if (from === to) {
41855 StateMachine.afterEvent(this, name, from, to, args);
41856 return StateMachine.Result.NOTRANSITION;
41857 }
41858
41859 // 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)
41860 var fsm = this;
41861 this.transition = function() {
41862 fsm.transition = null; // this method should only ever be called once
41863 fsm.current = to;
41864 StateMachine.enterState( fsm, name, from, to, args);
41865 StateMachine.changeState(fsm, name, from, to, args);
41866 StateMachine.afterEvent( fsm, name, from, to, args);
41867 return StateMachine.Result.SUCCEEDED;
41868 };
41869 this.transition.cancel = function() { // provide a way for caller to cancel async transition if desired (issue #22)
41870 fsm.transition = null;
41871 StateMachine.afterEvent(fsm, name, from, to, args);
41872 }
41873
41874 var leave = StateMachine.leaveState(this, name, from, to, args);
41875 if (false === leave) {
41876 this.transition = null;
41877 return StateMachine.Result.CANCELLED;
41878 }
41879 else if (StateMachine.ASYNC === leave) {
41880 return StateMachine.Result.PENDING;
41881 }
41882 else {
41883 if (this.transition) // need to check in case user manually called transition() but forgot to return StateMachine.ASYNC
41884 return this.transition();
41885 }
41886
41887 };
41888 }
41889
41890 }; // StateMachine
41891
41892 //===========================================================================
41893
41894 //======
41895 // NODE
41896 //======
41897 if (true) {
41898 if (typeof module !== 'undefined' && module.exports) {
41899 exports = module.exports = StateMachine;
41900 }
41901 exports.StateMachine = StateMachine;
41902 }
41903 //============
41904 // AMD/REQUIRE
41905 //============
41906 else if (typeof define === 'function' && define.amd) {
41907 define(function(require) { return StateMachine; });
41908 }
41909 //========
41910 // BROWSER
41911 //========
41912 else if (typeof window !== 'undefined') {
41913 window.StateMachine = StateMachine;
41914 }
41915 //===========
41916 // WEB WORKER
41917 //===========
41918 else if (typeof self !== 'undefined') {
41919 self.StateMachine = StateMachine;
41920 }
41921
41922}());
41923
41924
41925/***/ }),
41926/* 652 */
41927/***/ (function(module, exports) {
41928
41929function _typeof(obj) {
41930 "@babel/helpers - typeof";
41931
41932 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
41933 module.exports = _typeof = function _typeof(obj) {
41934 return typeof obj;
41935 };
41936 } else {
41937 module.exports = _typeof = function _typeof(obj) {
41938 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
41939 };
41940 }
41941
41942 return _typeof(obj);
41943}
41944
41945module.exports = _typeof;
41946
41947/***/ }),
41948/* 653 */
41949/***/ (function(module, exports, __webpack_require__) {
41950
41951var baseGetTag = __webpack_require__(117),
41952 getPrototype = __webpack_require__(654),
41953 isObjectLike = __webpack_require__(118);
41954
41955/** `Object#toString` result references. */
41956var objectTag = '[object Object]';
41957
41958/** Used for built-in method references. */
41959var funcProto = Function.prototype,
41960 objectProto = Object.prototype;
41961
41962/** Used to resolve the decompiled source of functions. */
41963var funcToString = funcProto.toString;
41964
41965/** Used to check objects for own properties. */
41966var hasOwnProperty = objectProto.hasOwnProperty;
41967
41968/** Used to infer the `Object` constructor. */
41969var objectCtorString = funcToString.call(Object);
41970
41971/**
41972 * Checks if `value` is a plain object, that is, an object created by the
41973 * `Object` constructor or one with a `[[Prototype]]` of `null`.
41974 *
41975 * @static
41976 * @memberOf _
41977 * @since 0.8.0
41978 * @category Lang
41979 * @param {*} value The value to check.
41980 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
41981 * @example
41982 *
41983 * function Foo() {
41984 * this.a = 1;
41985 * }
41986 *
41987 * _.isPlainObject(new Foo);
41988 * // => false
41989 *
41990 * _.isPlainObject([1, 2, 3]);
41991 * // => false
41992 *
41993 * _.isPlainObject({ 'x': 0, 'y': 0 });
41994 * // => true
41995 *
41996 * _.isPlainObject(Object.create(null));
41997 * // => true
41998 */
41999function isPlainObject(value) {
42000 if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
42001 return false;
42002 }
42003 var proto = getPrototype(value);
42004 if (proto === null) {
42005 return true;
42006 }
42007 var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
42008 return typeof Ctor == 'function' && Ctor instanceof Ctor &&
42009 funcToString.call(Ctor) == objectCtorString;
42010}
42011
42012module.exports = isPlainObject;
42013
42014
42015/***/ }),
42016/* 654 */
42017/***/ (function(module, exports, __webpack_require__) {
42018
42019var overArg = __webpack_require__(271);
42020
42021/** Built-in value references. */
42022var getPrototype = overArg(Object.getPrototypeOf, Object);
42023
42024module.exports = getPrototype;
42025
42026
42027/***/ }),
42028/* 655 */
42029/***/ (function(module, exports, __webpack_require__) {
42030
42031"use strict";
42032var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
42033
42034var _interopRequireDefault = __webpack_require__(1);
42035
42036var _isIterable2 = _interopRequireDefault(__webpack_require__(656));
42037
42038var _from = _interopRequireDefault(__webpack_require__(245));
42039
42040var _set = _interopRequireDefault(__webpack_require__(259));
42041
42042var _concat = _interopRequireDefault(__webpack_require__(22));
42043
42044var _assign = _interopRequireDefault(__webpack_require__(256));
42045
42046var _map = _interopRequireDefault(__webpack_require__(35));
42047
42048var _defineProperty = _interopRequireDefault(__webpack_require__(114));
42049
42050var _typeof2 = _interopRequireDefault(__webpack_require__(91));
42051
42052(function (global, factory) {
42053 ( false ? "undefined" : (0, _typeof2.default)(exports)) === 'object' && typeof module !== 'undefined' ? factory(exports, __webpack_require__(149)) : true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(149)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
42054 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
42055 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
42056 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : (global = global || self, factory(global.AV = global.AV || {}, global.AV));
42057})(void 0, function (exports, core) {
42058 'use strict';
42059
42060 function _inheritsLoose(subClass, superClass) {
42061 subClass.prototype = Object.create(superClass.prototype);
42062 subClass.prototype.constructor = subClass;
42063 subClass.__proto__ = superClass;
42064 }
42065
42066 function _toConsumableArray(arr) {
42067 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
42068 }
42069
42070 function _arrayWithoutHoles(arr) {
42071 if (Array.isArray(arr)) {
42072 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
42073 arr2[i] = arr[i];
42074 }
42075
42076 return arr2;
42077 }
42078 }
42079
42080 function _iterableToArray(iter) {
42081 if ((0, _isIterable2.default)(Object(iter)) || Object.prototype.toString.call(iter) === "[object Arguments]") return (0, _from.default)(iter);
42082 }
42083
42084 function _nonIterableSpread() {
42085 throw new TypeError("Invalid attempt to spread non-iterable instance");
42086 }
42087 /* eslint-disable import/no-unresolved */
42088
42089
42090 if (!core.Protocals) {
42091 throw new Error('LeanCloud Realtime SDK not installed');
42092 }
42093
42094 var CommandType = core.Protocals.CommandType,
42095 GenericCommand = core.Protocals.GenericCommand,
42096 AckCommand = core.Protocals.AckCommand;
42097
42098 var warn = function warn(error) {
42099 return console.warn(error.message);
42100 };
42101
42102 var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
42103 _inheritsLoose(LiveQueryClient, _EventEmitter);
42104
42105 function LiveQueryClient(appId, subscriptionId, connection) {
42106 var _this;
42107
42108 _this = _EventEmitter.call(this) || this;
42109 _this._appId = appId;
42110 _this.id = subscriptionId;
42111 _this._connection = connection;
42112 _this._eventemitter = new core.EventEmitter();
42113 _this._querys = new _set.default();
42114 return _this;
42115 }
42116
42117 var _proto = LiveQueryClient.prototype;
42118
42119 _proto._send = function _send(cmd) {
42120 var _context;
42121
42122 var _this$_connection;
42123
42124 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
42125 args[_key - 1] = arguments[_key];
42126 }
42127
42128 return (_this$_connection = this._connection).send.apply(_this$_connection, (0, _concat.default)(_context = [(0, _assign.default)(cmd, {
42129 appId: this._appId,
42130 installationId: this.id,
42131 service: 1
42132 })]).call(_context, args));
42133 };
42134
42135 _proto._open = function _open() {
42136 return this._send(new GenericCommand({
42137 cmd: CommandType.login
42138 }));
42139 };
42140
42141 _proto.close = function close() {
42142 var _ee = this._eventemitter;
42143
42144 _ee.emit('beforeclose');
42145
42146 return this._send(new GenericCommand({
42147 cmd: CommandType.logout
42148 })).then(function () {
42149 return _ee.emit('close');
42150 });
42151 };
42152
42153 _proto.register = function register(liveQuery) {
42154 this._querys.add(liveQuery);
42155 };
42156
42157 _proto.deregister = function deregister(liveQuery) {
42158 var _this2 = this;
42159
42160 this._querys.delete(liveQuery);
42161
42162 setTimeout(function () {
42163 if (!_this2._querys.size) _this2.close().catch(warn);
42164 }, 0);
42165 };
42166
42167 _proto._dispatchCommand = function _dispatchCommand(command) {
42168 if (command.cmd !== CommandType.data) {
42169 this.emit('unhandledmessage', command);
42170 return core.Promise.resolve();
42171 }
42172
42173 return this._dispatchDataCommand(command);
42174 };
42175
42176 _proto._dispatchDataCommand = function _dispatchDataCommand(_ref) {
42177 var _ref$dataMessage = _ref.dataMessage,
42178 ids = _ref$dataMessage.ids,
42179 msg = _ref$dataMessage.msg;
42180 this.emit('message', (0, _map.default)(msg).call(msg, function (_ref2) {
42181 var data = _ref2.data;
42182 return JSON.parse(data);
42183 })); // send ack
42184
42185 var command = new GenericCommand({
42186 cmd: CommandType.ack,
42187 ackMessage: new AckCommand({
42188 ids: ids
42189 })
42190 });
42191 return this._send(command, false).catch(warn);
42192 };
42193
42194 return LiveQueryClient;
42195 }(core.EventEmitter);
42196
42197 var finalize = function finalize(callback) {
42198 return [// eslint-disable-next-line no-sequences
42199 function (value) {
42200 return callback(), value;
42201 }, function (error) {
42202 callback();
42203 throw error;
42204 }];
42205 };
42206
42207 var onRealtimeCreate = function onRealtimeCreate(realtime) {
42208 /* eslint-disable no-param-reassign */
42209 realtime._liveQueryClients = {};
42210
42211 realtime.createLiveQueryClient = function (subscriptionId) {
42212 var _realtime$_open$then;
42213
42214 if (realtime._liveQueryClients[subscriptionId] !== undefined) {
42215 return core.Promise.resolve(realtime._liveQueryClients[subscriptionId]);
42216 }
42217
42218 var promise = (_realtime$_open$then = realtime._open().then(function (connection) {
42219 var client = new LiveQueryClient(realtime._options.appId, subscriptionId, connection);
42220 connection.on('reconnect', function () {
42221 return client._open().then(function () {
42222 return client.emit('reconnect');
42223 }, function (error) {
42224 return client.emit('reconnecterror', error);
42225 });
42226 });
42227
42228 client._eventemitter.on('beforeclose', function () {
42229 delete realtime._liveQueryClients[client.id];
42230 }, realtime);
42231
42232 client._eventemitter.on('close', function () {
42233 realtime._deregister(client);
42234 }, realtime);
42235
42236 return client._open().then(function () {
42237 realtime._liveQueryClients[client.id] = client;
42238
42239 realtime._register(client);
42240
42241 return client;
42242 });
42243 })).then.apply(_realtime$_open$then, _toConsumableArray(finalize(function () {
42244 if (realtime._deregisterPending) realtime._deregisterPending(promise);
42245 })));
42246
42247 realtime._liveQueryClients[subscriptionId] = promise;
42248 if (realtime._registerPending) realtime._registerPending(promise);
42249 return promise;
42250 };
42251 /* eslint-enable no-param-reassign */
42252
42253 };
42254
42255 var beforeCommandDispatch = function beforeCommandDispatch(command, realtime) {
42256 var isLiveQueryCommand = command.installationId && command.service === 1;
42257 if (!isLiveQueryCommand) return true;
42258 var targetClient = realtime._liveQueryClients[command.installationId];
42259
42260 if (targetClient) {
42261 targetClient._dispatchCommand(command).catch(function (error) {
42262 return console.warn(error);
42263 });
42264 } else {
42265 console.warn('Unexpected message received without any live client match: %O', command);
42266 }
42267
42268 return false;
42269 }; // eslint-disable-next-line import/prefer-default-export
42270
42271
42272 var LiveQueryPlugin = {
42273 name: 'leancloud-realtime-plugin-live-query',
42274 onRealtimeCreate: onRealtimeCreate,
42275 beforeCommandDispatch: beforeCommandDispatch
42276 };
42277 exports.LiveQueryPlugin = LiveQueryPlugin;
42278 (0, _defineProperty.default)(exports, '__esModule', {
42279 value: true
42280 });
42281});
42282
42283/***/ }),
42284/* 656 */
42285/***/ (function(module, exports, __webpack_require__) {
42286
42287module.exports = __webpack_require__(657);
42288
42289/***/ }),
42290/* 657 */
42291/***/ (function(module, exports, __webpack_require__) {
42292
42293module.exports = __webpack_require__(658);
42294
42295
42296/***/ }),
42297/* 658 */
42298/***/ (function(module, exports, __webpack_require__) {
42299
42300var parent = __webpack_require__(659);
42301
42302module.exports = parent;
42303
42304
42305/***/ }),
42306/* 659 */
42307/***/ (function(module, exports, __webpack_require__) {
42308
42309var parent = __webpack_require__(660);
42310
42311module.exports = parent;
42312
42313
42314/***/ }),
42315/* 660 */
42316/***/ (function(module, exports, __webpack_require__) {
42317
42318var parent = __webpack_require__(661);
42319__webpack_require__(44);
42320
42321module.exports = parent;
42322
42323
42324/***/ }),
42325/* 661 */
42326/***/ (function(module, exports, __webpack_require__) {
42327
42328__webpack_require__(41);
42329__webpack_require__(65);
42330var isIterable = __webpack_require__(662);
42331
42332module.exports = isIterable;
42333
42334
42335/***/ }),
42336/* 662 */
42337/***/ (function(module, exports, __webpack_require__) {
42338
42339var classof = __webpack_require__(51);
42340var hasOwn = __webpack_require__(12);
42341var wellKnownSymbol = __webpack_require__(9);
42342var Iterators = __webpack_require__(50);
42343
42344var ITERATOR = wellKnownSymbol('iterator');
42345var $Object = Object;
42346
42347module.exports = function (it) {
42348 var O = $Object(it);
42349 return O[ITERATOR] !== undefined
42350 || '@@iterator' in O
42351 || hasOwn(Iterators, classof(O));
42352};
42353
42354
42355/***/ })
42356/******/ ]);
42357});
42358//# sourceMappingURL=av-live-query-core.js.map
\No newline at end of file