UNPKG

1.45 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 = 277);
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__(75);
84var uncurryThis = __webpack_require__(4);
85var isCallable = __webpack_require__(8);
86var getOwnPropertyDescriptor = __webpack_require__(62).f;
87var isForced = __webpack_require__(159);
88var path = __webpack_require__(5);
89var bind = __webpack_require__(48);
90var createNonEnumerableProperty = __webpack_require__(37);
91var hasOwn = __webpack_require__(13);
92
93var wrapConstructor = function (NativeConstructor) {
94 var Wrapper = function (a, b, c) {
95 if (this instanceof Wrapper) {
96 switch (arguments.length) {
97 case 0: return new NativeConstructor();
98 case 1: return new NativeConstructor(a);
99 case 2: return new NativeConstructor(a, b);
100 } return new NativeConstructor(a, b, c);
101 } return apply(NativeConstructor, this, arguments);
102 };
103 Wrapper.prototype = NativeConstructor.prototype;
104 return Wrapper;
105};
106
107/*
108 options.target - name of the target object
109 options.global - target is the global object
110 options.stat - export as static methods of target
111 options.proto - export as prototype methods of target
112 options.real - real prototype method for the `pure` version
113 options.forced - export even if the native feature is available
114 options.bind - bind methods to the target, required for the `pure` version
115 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
116 options.unsafe - use the simple assignment of property instead of delete + defineProperty
117 options.sham - add a flag to not completely full polyfills
118 options.enumerable - export as enumerable property
119 options.dontCallGetSet - prevent calling a getter on target
120 options.name - the .name of the function if it does not match the key
121*/
122module.exports = function (options, source) {
123 var TARGET = options.target;
124 var GLOBAL = options.global;
125 var STATIC = options.stat;
126 var PROTO = options.proto;
127
128 var nativeSource = GLOBAL ? global : STATIC ? global[TARGET] : (global[TARGET] || {}).prototype;
129
130 var target = GLOBAL ? path : path[TARGET] || createNonEnumerableProperty(path, TARGET, {})[TARGET];
131 var targetPrototype = target.prototype;
132
133 var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
134 var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;
135
136 for (key in source) {
137 FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
138 // contains in native
139 USE_NATIVE = !FORCED && nativeSource && hasOwn(nativeSource, key);
140
141 targetProperty = target[key];
142
143 if (USE_NATIVE) if (options.dontCallGetSet) {
144 descriptor = getOwnPropertyDescriptor(nativeSource, key);
145 nativeProperty = descriptor && descriptor.value;
146 } else nativeProperty = nativeSource[key];
147
148 // export native or implementation
149 sourceProperty = (USE_NATIVE && nativeProperty) ? nativeProperty : source[key];
150
151 if (USE_NATIVE && typeof targetProperty == typeof sourceProperty) continue;
152
153 // bind timers to global for call from export context
154 if (options.bind && USE_NATIVE) resultProperty = bind(sourceProperty, global);
155 // wrap global constructors for prevent changs in this version
156 else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty);
157 // make static versions for prototype methods
158 else if (PROTO && isCallable(sourceProperty)) resultProperty = uncurryThis(sourceProperty);
159 // default case
160 else resultProperty = sourceProperty;
161
162 // add a flag to not completely full polyfills
163 if (options.sham || (sourceProperty && sourceProperty.sham) || (targetProperty && targetProperty.sham)) {
164 createNonEnumerableProperty(resultProperty, 'sham', true);
165 }
166
167 createNonEnumerableProperty(target, key, resultProperty);
168
169 if (PROTO) {
170 VIRTUAL_PROTOTYPE = TARGET + 'Prototype';
171 if (!hasOwn(path, VIRTUAL_PROTOTYPE)) {
172 createNonEnumerableProperty(path, VIRTUAL_PROTOTYPE, {});
173 }
174 // export virtual prototype methods
175 createNonEnumerableProperty(path[VIRTUAL_PROTOTYPE], key, sourceProperty);
176 // export real prototype methods
177 if (options.real && targetPrototype && !targetPrototype[key]) {
178 createNonEnumerableProperty(targetPrototype, key, sourceProperty);
179 }
180 }
181 }
182};
183
184
185/***/ }),
186/* 1 */
187/***/ (function(module, exports) {
188
189function _interopRequireDefault(obj) {
190 return obj && obj.__esModule ? obj : {
191 "default": obj
192 };
193}
194
195module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
196
197/***/ }),
198/* 2 */
199/***/ (function(module, exports) {
200
201module.exports = function (exec) {
202 try {
203 return !!exec();
204 } catch (error) {
205 return true;
206 }
207};
208
209
210/***/ }),
211/* 3 */
212/***/ (function(module, __webpack_exports__, __webpack_require__) {
213
214"use strict";
215Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
216/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_default_js__ = __webpack_require__(318);
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__(132);
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__(76);
389
390var FunctionPrototype = Function.prototype;
391var bind = FunctionPrototype.bind;
392var call = FunctionPrototype.call;
393var uncurryThis = NATIVE_BIND && bind.bind(call, call);
394
395module.exports = NATIVE_BIND ? function (fn) {
396 return fn && uncurryThis(fn);
397} : function (fn) {
398 return fn && function () {
399 return call.apply(fn, arguments);
400 };
401};
402
403
404/***/ }),
405/* 5 */
406/***/ (function(module, exports) {
407
408module.exports = {};
409
410
411/***/ }),
412/* 6 */
413/***/ (function(module, __webpack_exports__, __webpack_require__) {
414
415"use strict";
416/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return VERSION; });
417/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return root; });
418/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ArrayProto; });
419/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ObjProto; });
420/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return SymbolProto; });
421/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return push; });
422/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return slice; });
423/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return toString; });
424/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return hasOwnProperty; });
425/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return supportsArrayBuffer; });
426/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return supportsDataView; });
427/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return nativeIsArray; });
428/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return nativeKeys; });
429/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return nativeCreate; });
430/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return nativeIsView; });
431/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return _isNaN; });
432/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return _isFinite; });
433/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return hasEnumBug; });
434/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return nonEnumerableProps; });
435/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return MAX_ARRAY_INDEX; });
436// Current version.
437var VERSION = '1.12.1';
438
439// Establish the root object, `window` (`self`) in the browser, `global`
440// on the server, or `this` in some virtual machines. We use `self`
441// instead of `window` for `WebWorker` support.
442var root = typeof self == 'object' && self.self === self && self ||
443 typeof global == 'object' && global.global === global && global ||
444 Function('return this')() ||
445 {};
446
447// Save bytes in the minified (but not gzipped) version:
448var ArrayProto = Array.prototype, ObjProto = Object.prototype;
449var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null;
450
451// Create quick reference variables for speed access to core prototypes.
452var push = ArrayProto.push,
453 slice = ArrayProto.slice,
454 toString = ObjProto.toString,
455 hasOwnProperty = ObjProto.hasOwnProperty;
456
457// Modern feature detection.
458var supportsArrayBuffer = typeof ArrayBuffer !== 'undefined',
459 supportsDataView = typeof DataView !== 'undefined';
460
461// All **ECMAScript 5+** native function implementations that we hope to use
462// are declared here.
463var nativeIsArray = Array.isArray,
464 nativeKeys = Object.keys,
465 nativeCreate = Object.create,
466 nativeIsView = supportsArrayBuffer && ArrayBuffer.isView;
467
468// Create references to these builtin functions because we override them.
469var _isNaN = isNaN,
470 _isFinite = isFinite;
471
472// Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
473var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');
474var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',
475 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];
476
477// The largest integer that can be represented exactly.
478var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
479
480/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(74)))
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__(74)))
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__(79);
520var hasOwn = __webpack_require__(13);
521var uid = __webpack_require__(99);
522var NATIVE_SYMBOL = __webpack_require__(64);
523var USE_SYMBOL_AS_UID = __webpack_require__(157);
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__(5);
549var hasOwn = __webpack_require__(13);
550var wrappedWellKnownSymbolModule = __webpack_require__(148);
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
576module.exports = __webpack_require__(281);
577
578/***/ }),
579/* 13 */
580/***/ (function(module, exports, __webpack_require__) {
581
582var uncurryThis = __webpack_require__(4);
583var toObject = __webpack_require__(34);
584
585var hasOwnProperty = uncurryThis({}.hasOwnProperty);
586
587// `HasOwnProperty` abstract operation
588// https://tc39.es/ecma262/#sec-hasownproperty
589// eslint-disable-next-line es-x/no-object-hasown -- safe
590module.exports = Object.hasOwn || function hasOwn(it, key) {
591 return hasOwnProperty(toObject(it), key);
592};
593
594
595/***/ }),
596/* 14 */
597/***/ (function(module, exports, __webpack_require__) {
598
599var fails = __webpack_require__(2);
600
601// Detect IE8's incomplete defineProperty implementation
602module.exports = !fails(function () {
603 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
604 return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
605});
606
607
608/***/ }),
609/* 15 */
610/***/ (function(module, exports, __webpack_require__) {
611
612var NATIVE_BIND = __webpack_require__(76);
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__(56);
628/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
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__(190);
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__(6);
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__(5);
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__(200);
718/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__iteratee_js__ = __webpack_require__(201);
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__(390);
736
737/***/ }),
738/* 23 */
739/***/ (function(module, exports, __webpack_require__) {
740
741var DESCRIPTORS = __webpack_require__(14);
742var IE8_DOM_DEFINE = __webpack_require__(158);
743var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(160);
744var anObject = __webpack_require__(20);
745var toPropertyKey = __webpack_require__(96);
746
747var $TypeError = TypeError;
748// eslint-disable-next-line es-x/no-object-defineproperty -- safe
749var $defineProperty = Object.defineProperty;
750// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
751var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
752var ENUMERABLE = 'enumerable';
753var CONFIGURABLE = 'configurable';
754var WRITABLE = 'writable';
755
756// `Object.defineProperty` method
757// https://tc39.es/ecma262/#sec-object.defineproperty
758exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
759 anObject(O);
760 P = toPropertyKey(P);
761 anObject(Attributes);
762 if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
763 var current = $getOwnPropertyDescriptor(O, P);
764 if (current && current[WRITABLE]) {
765 O[P] = Attributes.value;
766 Attributes = {
767 configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
768 enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
769 writable: false
770 };
771 }
772 } return $defineProperty(O, P, Attributes);
773} : $defineProperty : function defineProperty(O, P, Attributes) {
774 anObject(O);
775 P = toPropertyKey(P);
776 anObject(Attributes);
777 if (IE8_DOM_DEFINE) try {
778 return $defineProperty(O, P, Attributes);
779 } catch (error) { /* empty */ }
780 if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');
781 if ('value' in Attributes) O[P] = Attributes.value;
782 return O;
783};
784
785
786/***/ }),
787/* 24 */
788/***/ (function(module, __webpack_exports__, __webpack_require__) {
789
790"use strict";
791/* harmony export (immutable) */ __webpack_exports__["a"] = restArguments;
792// Some functions take a variable number of arguments, or a few expected
793// arguments at the beginning and then a variable number of values to operate
794// on. This helper accumulates all remaining arguments past the function’s
795// argument length (or an explicit `startIndex`), into an array that becomes
796// the last argument. Similar to ES6’s "rest parameter".
797function restArguments(func, startIndex) {
798 startIndex = startIndex == null ? func.length - 1 : +startIndex;
799 return function() {
800 var length = Math.max(arguments.length - startIndex, 0),
801 rest = Array(length),
802 index = 0;
803 for (; index < length; index++) {
804 rest[index] = arguments[index + startIndex];
805 }
806 switch (startIndex) {
807 case 0: return func.call(this, rest);
808 case 1: return func.call(this, arguments[0], rest);
809 case 2: return func.call(this, arguments[0], arguments[1], rest);
810 }
811 var args = Array(startIndex + 1);
812 for (index = 0; index < startIndex; index++) {
813 args[index] = arguments[index];
814 }
815 args[startIndex] = rest;
816 return func.apply(this, args);
817 };
818}
819
820
821/***/ }),
822/* 25 */
823/***/ (function(module, __webpack_exports__, __webpack_require__) {
824
825"use strict";
826/* harmony export (immutable) */ __webpack_exports__["a"] = _;
827/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
828
829
830// If Underscore is called as a function, it returns a wrapped object that can
831// be used OO-style. This wrapper holds altered versions of all functions added
832// through `_.mixin`. Wrapped objects may be chained.
833function _(obj) {
834 if (obj instanceof _) return obj;
835 if (!(this instanceof _)) return new _(obj);
836 this._wrapped = obj;
837}
838
839_.VERSION = __WEBPACK_IMPORTED_MODULE_0__setup_js__["e" /* VERSION */];
840
841// Extracts the result from a wrapped and chained object.
842_.prototype.value = function() {
843 return this._wrapped;
844};
845
846// Provide unwrapping proxies for some methods used in engine operations
847// such as arithmetic and JSON stringification.
848_.prototype.valueOf = _.prototype.toJSON = _.prototype.value;
849
850_.prototype.toString = function() {
851 return String(this._wrapped);
852};
853
854
855/***/ }),
856/* 26 */
857/***/ (function(module, __webpack_exports__, __webpack_require__) {
858
859"use strict";
860/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(188);
861/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(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__(12));
884
885var _ = __webpack_require__(3);
886
887var md5 = __webpack_require__(526);
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__(116); // 计算 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[ false ? '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__(6);
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__(189);
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__(59));
1161
1162var _getPrototypeOf = _interopRequireDefault(__webpack_require__(147));
1163
1164var _promise = _interopRequireDefault(__webpack_require__(12));
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__(78);
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__(95);
1355var requireObjectCoercible = __webpack_require__(121);
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__(121);
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__(395);
1389
1390/***/ }),
1391/* 36 */
1392/***/ (function(module, exports, __webpack_require__) {
1393
1394module.exports = __webpack_require__(402);
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
1416"use strict";
1417
1418var toIndexedObject = __webpack_require__(32);
1419var addToUnscopables = __webpack_require__(169);
1420var Iterators = __webpack_require__(50);
1421var InternalStateModule = __webpack_require__(43);
1422var defineProperty = __webpack_require__(23).f;
1423var defineIterator = __webpack_require__(131);
1424var IS_PURE = __webpack_require__(33);
1425var DESCRIPTORS = __webpack_require__(14);
1426
1427var ARRAY_ITERATOR = 'Array Iterator';
1428var setInternalState = InternalStateModule.set;
1429var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
1430
1431// `Array.prototype.entries` method
1432// https://tc39.es/ecma262/#sec-array.prototype.entries
1433// `Array.prototype.keys` method
1434// https://tc39.es/ecma262/#sec-array.prototype.keys
1435// `Array.prototype.values` method
1436// https://tc39.es/ecma262/#sec-array.prototype.values
1437// `Array.prototype[@@iterator]` method
1438// https://tc39.es/ecma262/#sec-array.prototype-@@iterator
1439// `CreateArrayIterator` internal method
1440// https://tc39.es/ecma262/#sec-createarrayiterator
1441module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
1442 setInternalState(this, {
1443 type: ARRAY_ITERATOR,
1444 target: toIndexedObject(iterated), // target
1445 index: 0, // next index
1446 kind: kind // kind
1447 });
1448// `%ArrayIteratorPrototype%.next` method
1449// https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
1450}, function () {
1451 var state = getInternalState(this);
1452 var target = state.target;
1453 var kind = state.kind;
1454 var index = state.index++;
1455 if (!target || index >= target.length) {
1456 state.target = undefined;
1457 return { value: undefined, done: true };
1458 }
1459 if (kind == 'keys') return { value: index, done: false };
1460 if (kind == 'values') return { value: target[index], done: false };
1461 return { value: [index, target[index]], done: false };
1462}, 'values');
1463
1464// argumentsList[@@iterator] is %ArrayProto_values%
1465// https://tc39.es/ecma262/#sec-createunmappedargumentsobject
1466// https://tc39.es/ecma262/#sec-createmappedargumentsobject
1467var values = Iterators.Arguments = Iterators.Array;
1468
1469// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1470addToUnscopables('keys');
1471addToUnscopables('values');
1472addToUnscopables('entries');
1473
1474// V8 ~ Chrome 45- bug
1475if (!IS_PURE && DESCRIPTORS && values.name !== 'values') try {
1476 defineProperty(values, 'name', { value: 'values' });
1477} catch (error) { /* empty */ }
1478
1479
1480/***/ }),
1481/* 39 */
1482/***/ (function(module, exports, __webpack_require__) {
1483
1484__webpack_require__(38);
1485var DOMIterables = __webpack_require__(317);
1486var global = __webpack_require__(7);
1487var classof = __webpack_require__(51);
1488var createNonEnumerableProperty = __webpack_require__(37);
1489var Iterators = __webpack_require__(50);
1490var wellKnownSymbol = __webpack_require__(9);
1491
1492var TO_STRING_TAG = wellKnownSymbol('toStringTag');
1493
1494for (var COLLECTION_NAME in DOMIterables) {
1495 var Collection = global[COLLECTION_NAME];
1496 var CollectionPrototype = Collection && Collection.prototype;
1497 if (CollectionPrototype && classof(CollectionPrototype) !== TO_STRING_TAG) {
1498 createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
1499 }
1500 Iterators[COLLECTION_NAME] = Iterators.Array;
1501}
1502
1503
1504/***/ }),
1505/* 40 */
1506/***/ (function(module, exports, __webpack_require__) {
1507
1508var path = __webpack_require__(5);
1509
1510module.exports = function (CONSTRUCTOR) {
1511 return path[CONSTRUCTOR + 'Prototype'];
1512};
1513
1514
1515/***/ }),
1516/* 41 */
1517/***/ (function(module, exports, __webpack_require__) {
1518
1519var toLength = __webpack_require__(291);
1520
1521// `LengthOfArrayLike` abstract operation
1522// https://tc39.es/ecma262/#sec-lengthofarraylike
1523module.exports = function (obj) {
1524 return toLength(obj.length);
1525};
1526
1527
1528/***/ }),
1529/* 42 */
1530/***/ (function(module, exports, __webpack_require__) {
1531
1532var bind = __webpack_require__(48);
1533var call = __webpack_require__(15);
1534var anObject = __webpack_require__(20);
1535var tryToString = __webpack_require__(78);
1536var isArrayIteratorMethod = __webpack_require__(166);
1537var lengthOfArrayLike = __webpack_require__(41);
1538var isPrototypeOf = __webpack_require__(19);
1539var getIterator = __webpack_require__(167);
1540var getIteratorMethod = __webpack_require__(106);
1541var iteratorClose = __webpack_require__(168);
1542
1543var $TypeError = TypeError;
1544
1545var Result = function (stopped, result) {
1546 this.stopped = stopped;
1547 this.result = result;
1548};
1549
1550var ResultPrototype = Result.prototype;
1551
1552module.exports = function (iterable, unboundFunction, options) {
1553 var that = options && options.that;
1554 var AS_ENTRIES = !!(options && options.AS_ENTRIES);
1555 var IS_ITERATOR = !!(options && options.IS_ITERATOR);
1556 var INTERRUPTED = !!(options && options.INTERRUPTED);
1557 var fn = bind(unboundFunction, that);
1558 var iterator, iterFn, index, length, result, next, step;
1559
1560 var stop = function (condition) {
1561 if (iterator) iteratorClose(iterator, 'normal', condition);
1562 return new Result(true, condition);
1563 };
1564
1565 var callFn = function (value) {
1566 if (AS_ENTRIES) {
1567 anObject(value);
1568 return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
1569 } return INTERRUPTED ? fn(value, stop) : fn(value);
1570 };
1571
1572 if (IS_ITERATOR) {
1573 iterator = iterable;
1574 } else {
1575 iterFn = getIteratorMethod(iterable);
1576 if (!iterFn) throw $TypeError(tryToString(iterable) + ' is not iterable');
1577 // optimisation for array iterators
1578 if (isArrayIteratorMethod(iterFn)) {
1579 for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
1580 result = callFn(iterable[index]);
1581 if (result && isPrototypeOf(ResultPrototype, result)) return result;
1582 } return new Result(false);
1583 }
1584 iterator = getIterator(iterable, iterFn);
1585 }
1586
1587 next = iterator.next;
1588 while (!(step = call(next, iterator)).done) {
1589 try {
1590 result = callFn(step.value);
1591 } catch (error) {
1592 iteratorClose(iterator, 'throw', error);
1593 }
1594 if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
1595 } return new Result(false);
1596};
1597
1598
1599/***/ }),
1600/* 43 */
1601/***/ (function(module, exports, __webpack_require__) {
1602
1603var NATIVE_WEAK_MAP = __webpack_require__(170);
1604var global = __webpack_require__(7);
1605var uncurryThis = __webpack_require__(4);
1606var isObject = __webpack_require__(11);
1607var createNonEnumerableProperty = __webpack_require__(37);
1608var hasOwn = __webpack_require__(13);
1609var shared = __webpack_require__(123);
1610var sharedKey = __webpack_require__(101);
1611var hiddenKeys = __webpack_require__(80);
1612
1613var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
1614var TypeError = global.TypeError;
1615var WeakMap = global.WeakMap;
1616var set, get, has;
1617
1618var enforce = function (it) {
1619 return has(it) ? get(it) : set(it, {});
1620};
1621
1622var getterFor = function (TYPE) {
1623 return function (it) {
1624 var state;
1625 if (!isObject(it) || (state = get(it)).type !== TYPE) {
1626 throw TypeError('Incompatible receiver, ' + TYPE + ' required');
1627 } return state;
1628 };
1629};
1630
1631if (NATIVE_WEAK_MAP || shared.state) {
1632 var store = shared.state || (shared.state = new WeakMap());
1633 var wmget = uncurryThis(store.get);
1634 var wmhas = uncurryThis(store.has);
1635 var wmset = uncurryThis(store.set);
1636 set = function (it, metadata) {
1637 if (wmhas(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
1638 metadata.facade = it;
1639 wmset(store, it, metadata);
1640 return metadata;
1641 };
1642 get = function (it) {
1643 return wmget(store, it) || {};
1644 };
1645 has = function (it) {
1646 return wmhas(store, it);
1647 };
1648} else {
1649 var STATE = sharedKey('state');
1650 hiddenKeys[STATE] = true;
1651 set = function (it, metadata) {
1652 if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
1653 metadata.facade = it;
1654 createNonEnumerableProperty(it, STATE, metadata);
1655 return metadata;
1656 };
1657 get = function (it) {
1658 return hasOwn(it, STATE) ? it[STATE] : {};
1659 };
1660 has = function (it) {
1661 return hasOwn(it, STATE);
1662 };
1663}
1664
1665module.exports = {
1666 set: set,
1667 get: get,
1668 has: has,
1669 enforce: enforce,
1670 getterFor: getterFor
1671};
1672
1673
1674/***/ }),
1675/* 44 */
1676/***/ (function(module, exports, __webpack_require__) {
1677
1678var createNonEnumerableProperty = __webpack_require__(37);
1679
1680module.exports = function (target, key, value, options) {
1681 if (options && options.enumerable) target[key] = value;
1682 else createNonEnumerableProperty(target, key, value);
1683 return target;
1684};
1685
1686
1687/***/ }),
1688/* 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__(6);
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__(238));
1712
1713var _getPrototypeOf = _interopRequireDefault(__webpack_require__(147));
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__(76);
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__(128);
2113var enumBugKeys = __webpack_require__(127);
2114var hiddenKeys = __webpack_require__(80);
2115var html = __webpack_require__(165);
2116var documentCreateElement = __webpack_require__(124);
2117var sharedKey = __webpack_require__(101);
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__(129);
2207var isCallable = __webpack_require__(8);
2208var classofRaw = __webpack_require__(63);
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__(129);
2242var defineProperty = __webpack_require__(23).f;
2243var createNonEnumerableProperty = __webpack_require__(37);
2244var hasOwn = __webpack_require__(13);
2245var toString = __webpack_require__(298);
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) {
2266
2267// empty
2268
2269
2270/***/ }),
2271/* 54 */
2272/***/ (function(module, exports, __webpack_require__) {
2273
2274"use strict";
2275
2276var aCallable = __webpack_require__(31);
2277
2278var PromiseCapability = function (C) {
2279 var resolve, reject;
2280 this.promise = new C(function ($$resolve, $$reject) {
2281 if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
2282 resolve = $$resolve;
2283 reject = $$reject;
2284 });
2285 this.resolve = aCallable(resolve);
2286 this.reject = aCallable(reject);
2287};
2288
2289// `NewPromiseCapability` abstract operation
2290// https://tc39.es/ecma262/#sec-newpromisecapability
2291module.exports.f = function (C) {
2292 return new PromiseCapability(C);
2293};
2294
2295
2296/***/ }),
2297/* 55 */
2298/***/ (function(module, exports, __webpack_require__) {
2299
2300"use strict";
2301
2302var charAt = __webpack_require__(316).charAt;
2303var toString = __webpack_require__(81);
2304var InternalStateModule = __webpack_require__(43);
2305var defineIterator = __webpack_require__(131);
2306
2307var STRING_ITERATOR = 'String Iterator';
2308var setInternalState = InternalStateModule.set;
2309var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
2310
2311// `String.prototype[@@iterator]` method
2312// https://tc39.es/ecma262/#sec-string.prototype-@@iterator
2313defineIterator(String, 'String', function (iterated) {
2314 setInternalState(this, {
2315 type: STRING_ITERATOR,
2316 string: toString(iterated),
2317 index: 0
2318 });
2319// `%StringIteratorPrototype%.next` method
2320// https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
2321}, function next() {
2322 var state = getInternalState(this);
2323 var string = state.string;
2324 var index = state.index;
2325 var point;
2326 if (index >= string.length) return { value: undefined, done: true };
2327 point = charAt(string, index);
2328 state.index += point.length;
2329 return { value: point, done: false };
2330});
2331
2332
2333/***/ }),
2334/* 56 */
2335/***/ (function(module, __webpack_exports__, __webpack_require__) {
2336
2337"use strict";
2338/* harmony export (immutable) */ __webpack_exports__["a"] = isObject;
2339// Is a given variable an object?
2340function isObject(obj) {
2341 var type = typeof obj;
2342 return type === 'function' || type === 'object' && !!obj;
2343}
2344
2345
2346/***/ }),
2347/* 57 */
2348/***/ (function(module, __webpack_exports__, __webpack_require__) {
2349
2350"use strict";
2351/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
2352/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__tagTester_js__ = __webpack_require__(17);
2353
2354
2355
2356// Is a given value an array?
2357// Delegates to ECMA5's native `Array.isArray`.
2358/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__setup_js__["k" /* nativeIsArray */] || Object(__WEBPACK_IMPORTED_MODULE_1__tagTester_js__["a" /* default */])('Array'));
2359
2360
2361/***/ }),
2362/* 58 */
2363/***/ (function(module, __webpack_exports__, __webpack_require__) {
2364
2365"use strict";
2366/* harmony export (immutable) */ __webpack_exports__["a"] = each;
2367/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(87);
2368/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
2369/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16);
2370
2371
2372
2373
2374// The cornerstone for collection functions, an `each`
2375// implementation, aka `forEach`.
2376// Handles raw objects in addition to array-likes. Treats all
2377// sparse array-likes as if they were dense.
2378function each(obj, iteratee, context) {
2379 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context);
2380 var i, length;
2381 if (Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj)) {
2382 for (i = 0, length = obj.length; i < length; i++) {
2383 iteratee(obj[i], i, obj);
2384 }
2385 } else {
2386 var _keys = Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj);
2387 for (i = 0, length = _keys.length; i < length; i++) {
2388 iteratee(obj[_keys[i]], _keys[i], obj);
2389 }
2390 }
2391 return obj;
2392}
2393
2394
2395/***/ }),
2396/* 59 */
2397/***/ (function(module, exports, __webpack_require__) {
2398
2399module.exports = __webpack_require__(408);
2400
2401/***/ }),
2402/* 60 */
2403/***/ (function(module, exports, __webpack_require__) {
2404
2405"use strict";
2406
2407
2408function _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); }
2409
2410/* eslint-env browser */
2411
2412/**
2413 * This is the web browser implementation of `debug()`.
2414 */
2415exports.log = log;
2416exports.formatArgs = formatArgs;
2417exports.save = save;
2418exports.load = load;
2419exports.useColors = useColors;
2420exports.storage = localstorage();
2421/**
2422 * Colors.
2423 */
2424
2425exports.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'];
2426/**
2427 * Currently only WebKit-based Web Inspectors, Firefox >= v31,
2428 * and the Firebug extension (any Firefox version) are known
2429 * to support "%c" CSS customizations.
2430 *
2431 * TODO: add a `localStorage` variable to explicitly enable/disable colors
2432 */
2433// eslint-disable-next-line complexity
2434
2435function useColors() {
2436 // NB: In an Electron preload script, document will be defined but not fully
2437 // initialized. Since we know we're in Chrome, we'll just detect this case
2438 // explicitly
2439 if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
2440 return true;
2441 } // Internet Explorer and Edge do not support colors.
2442
2443
2444 if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
2445 return false;
2446 } // Is webkit? http://stackoverflow.com/a/16459606/376773
2447 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
2448
2449
2450 return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
2451 typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
2452 // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
2453 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
2454 typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
2455}
2456/**
2457 * Colorize log arguments if enabled.
2458 *
2459 * @api public
2460 */
2461
2462
2463function formatArgs(args) {
2464 args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
2465
2466 if (!this.useColors) {
2467 return;
2468 }
2469
2470 var c = 'color: ' + this.color;
2471 args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
2472 // arguments passed either before or after the %c, so we need to
2473 // figure out the correct index to insert the CSS into
2474
2475 var index = 0;
2476 var lastC = 0;
2477 args[0].replace(/%[a-zA-Z%]/g, function (match) {
2478 if (match === '%%') {
2479 return;
2480 }
2481
2482 index++;
2483
2484 if (match === '%c') {
2485 // We only are interested in the *last* %c
2486 // (the user may have provided their own)
2487 lastC = index;
2488 }
2489 });
2490 args.splice(lastC, 0, c);
2491}
2492/**
2493 * Invokes `console.log()` when available.
2494 * No-op when `console.log` is not a "function".
2495 *
2496 * @api public
2497 */
2498
2499
2500function log() {
2501 var _console;
2502
2503 // This hackery is required for IE8/9, where
2504 // the `console.log` function doesn't have 'apply'
2505 return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
2506}
2507/**
2508 * Save `namespaces`.
2509 *
2510 * @param {String} namespaces
2511 * @api private
2512 */
2513
2514
2515function save(namespaces) {
2516 try {
2517 if (namespaces) {
2518 exports.storage.setItem('debug', namespaces);
2519 } else {
2520 exports.storage.removeItem('debug');
2521 }
2522 } catch (error) {// Swallow
2523 // XXX (@Qix-) should we be logging these?
2524 }
2525}
2526/**
2527 * Load `namespaces`.
2528 *
2529 * @return {String} returns the previously persisted debug modes
2530 * @api private
2531 */
2532
2533
2534function load() {
2535 var r;
2536
2537 try {
2538 r = exports.storage.getItem('debug');
2539 } catch (error) {} // Swallow
2540 // XXX (@Qix-) should we be logging these?
2541 // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
2542
2543
2544 if (!r && typeof process !== 'undefined' && 'env' in process) {
2545 r = process.env.DEBUG;
2546 }
2547
2548 return r;
2549}
2550/**
2551 * Localstorage attempts to return the localstorage.
2552 *
2553 * This is necessary because safari throws
2554 * when a user disables cookies/localstorage
2555 * and you attempt to access it.
2556 *
2557 * @return {LocalStorage}
2558 * @api private
2559 */
2560
2561
2562function localstorage() {
2563 try {
2564 // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
2565 // The Browser also has localStorage in the global context.
2566 return localStorage;
2567 } catch (error) {// Swallow
2568 // XXX (@Qix-) should we be logging these?
2569 }
2570}
2571
2572module.exports = __webpack_require__(413)(exports);
2573var formatters = module.exports.formatters;
2574/**
2575 * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
2576 */
2577
2578formatters.j = function (v) {
2579 try {
2580 return JSON.stringify(v);
2581 } catch (error) {
2582 return '[UnexpectedJSONParseError]: ' + error.message;
2583 }
2584};
2585
2586
2587
2588/***/ }),
2589/* 61 */
2590/***/ (function(module, exports, __webpack_require__) {
2591
2592module.exports = __webpack_require__(240);
2593
2594/***/ }),
2595/* 62 */
2596/***/ (function(module, exports, __webpack_require__) {
2597
2598var DESCRIPTORS = __webpack_require__(14);
2599var call = __webpack_require__(15);
2600var propertyIsEnumerableModule = __webpack_require__(120);
2601var createPropertyDescriptor = __webpack_require__(47);
2602var toIndexedObject = __webpack_require__(32);
2603var toPropertyKey = __webpack_require__(96);
2604var hasOwn = __webpack_require__(13);
2605var IE8_DOM_DEFINE = __webpack_require__(158);
2606
2607// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
2608var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
2609
2610// `Object.getOwnPropertyDescriptor` method
2611// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
2612exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
2613 O = toIndexedObject(O);
2614 P = toPropertyKey(P);
2615 if (IE8_DOM_DEFINE) try {
2616 return $getOwnPropertyDescriptor(O, P);
2617 } catch (error) { /* empty */ }
2618 if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
2619};
2620
2621
2622/***/ }),
2623/* 63 */
2624/***/ (function(module, exports, __webpack_require__) {
2625
2626var uncurryThis = __webpack_require__(4);
2627
2628var toString = uncurryThis({}.toString);
2629var stringSlice = uncurryThis(''.slice);
2630
2631module.exports = function (it) {
2632 return stringSlice(toString(it), 8, -1);
2633};
2634
2635
2636/***/ }),
2637/* 64 */
2638/***/ (function(module, exports, __webpack_require__) {
2639
2640/* eslint-disable es-x/no-symbol -- required for testing */
2641var V8_VERSION = __webpack_require__(77);
2642var fails = __webpack_require__(2);
2643
2644// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
2645module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
2646 var symbol = Symbol();
2647 // Chrome 38 Symbol has incorrect toString conversion
2648 // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
2649 return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
2650 // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
2651 !Symbol.sham && V8_VERSION && V8_VERSION < 41;
2652});
2653
2654
2655/***/ }),
2656/* 65 */
2657/***/ (function(module, exports, __webpack_require__) {
2658
2659var global = __webpack_require__(7);
2660
2661module.exports = global.Promise;
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__(57);
2694/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(135);
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__(12));
2765
2766var _concat = _interopRequireDefault(__webpack_require__(22));
2767
2768var _map = _interopRequireDefault(__webpack_require__(35));
2769
2770var _keys = _interopRequireDefault(__webpack_require__(115));
2771
2772var _stringify = _interopRequireDefault(__webpack_require__(36));
2773
2774var _indexOf = _interopRequireDefault(__webpack_require__(71));
2775
2776var _keys2 = _interopRequireDefault(__webpack_require__(59));
2777
2778var _ = __webpack_require__(3);
2779
2780var uuid = __webpack_require__(232);
2781
2782var debug = __webpack_require__(60);
2783
2784var _require = __webpack_require__(30),
2785 inherits = _require.inherits,
2786 parseDate = _require.parseDate;
2787
2788var version = __webpack_require__(234);
2789
2790var _require2 = __webpack_require__(72),
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__(74)))
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__(95);
3294var toObject = __webpack_require__(34);
3295var lengthOfArrayLike = __webpack_require__(41);
3296var arraySpeciesCreate = __webpack_require__(229);
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
3370module.exports = __webpack_require__(404);
3371
3372/***/ }),
3373/* 72 */
3374/***/ (function(module, exports, __webpack_require__) {
3375
3376"use strict";
3377
3378
3379var _interopRequireDefault = __webpack_require__(1);
3380
3381var _keys = _interopRequireDefault(__webpack_require__(59));
3382
3383var _ = __webpack_require__(3);
3384
3385var EventEmitter = __webpack_require__(235);
3386
3387var _require = __webpack_require__(30),
3388 inherits = _require.inherits;
3389
3390var AdapterManager = inherits(EventEmitter, {
3391 constructor: function constructor() {
3392 EventEmitter.apply(this);
3393 this._adapters = {};
3394 },
3395 getAdapter: function getAdapter(name) {
3396 var adapter = this._adapters[name];
3397
3398 if (adapter === undefined) {
3399 throw new Error("".concat(name, " adapter is not configured"));
3400 }
3401
3402 return adapter;
3403 },
3404 setAdapters: function setAdapters(newAdapters) {
3405 var _this = this;
3406
3407 _.extend(this._adapters, newAdapters);
3408
3409 (0, _keys.default)(_).call(_, newAdapters).forEach(function (name) {
3410 return _this.emit(name, newAdapters[name]);
3411 });
3412 }
3413});
3414var adapterManager = new AdapterManager();
3415module.exports = {
3416 getAdapter: adapterManager.getAdapter.bind(adapterManager),
3417 setAdapters: adapterManager.setAdapters.bind(adapterManager),
3418 adapterManager: adapterManager
3419};
3420
3421/***/ }),
3422/* 73 */
3423/***/ (function(module, exports, __webpack_require__) {
3424
3425var _Symbol = __webpack_require__(242);
3426
3427var _Symbol$iterator = __webpack_require__(459);
3428
3429function _typeof(obj) {
3430 "@babel/helpers - typeof";
3431
3432 return (module.exports = _typeof = "function" == typeof _Symbol && "symbol" == typeof _Symbol$iterator ? function (obj) {
3433 return typeof obj;
3434 } : function (obj) {
3435 return obj && "function" == typeof _Symbol && obj.constructor === _Symbol && obj !== _Symbol.prototype ? "symbol" : typeof obj;
3436 }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
3437}
3438
3439module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
3440
3441/***/ }),
3442/* 74 */
3443/***/ (function(module, exports) {
3444
3445var g;
3446
3447// This works in non-strict mode
3448g = (function() {
3449 return this;
3450})();
3451
3452try {
3453 // This works if eval is allowed (see CSP)
3454 g = g || Function("return this")() || (1,eval)("this");
3455} catch(e) {
3456 // This works if the window reference is available
3457 if(typeof window === "object")
3458 g = window;
3459}
3460
3461// g can still be undefined, but nothing to do about it...
3462// We return undefined, instead of nothing here, so it's
3463// easier to handle this case. if(!global) { ...}
3464
3465module.exports = g;
3466
3467
3468/***/ }),
3469/* 75 */
3470/***/ (function(module, exports, __webpack_require__) {
3471
3472var NATIVE_BIND = __webpack_require__(76);
3473
3474var FunctionPrototype = Function.prototype;
3475var apply = FunctionPrototype.apply;
3476var call = FunctionPrototype.call;
3477
3478// eslint-disable-next-line es-x/no-reflect -- safe
3479module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () {
3480 return call.apply(apply, arguments);
3481});
3482
3483
3484/***/ }),
3485/* 76 */
3486/***/ (function(module, exports, __webpack_require__) {
3487
3488var fails = __webpack_require__(2);
3489
3490module.exports = !fails(function () {
3491 // eslint-disable-next-line es-x/no-function-prototype-bind -- safe
3492 var test = (function () { /* empty */ }).bind();
3493 // eslint-disable-next-line no-prototype-builtins -- safe
3494 return typeof test != 'function' || test.hasOwnProperty('prototype');
3495});
3496
3497
3498/***/ }),
3499/* 77 */
3500/***/ (function(module, exports, __webpack_require__) {
3501
3502var global = __webpack_require__(7);
3503var userAgent = __webpack_require__(98);
3504
3505var process = global.process;
3506var Deno = global.Deno;
3507var versions = process && process.versions || Deno && Deno.version;
3508var v8 = versions && versions.v8;
3509var match, version;
3510
3511if (v8) {
3512 match = v8.split('.');
3513 // in old Chrome, versions of V8 isn't V8 = Chrome / 10
3514 // but their correct versions are not interesting for us
3515 version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
3516}
3517
3518// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
3519// so check `userAgent` even if `.v8` exists, but 0
3520if (!version && userAgent) {
3521 match = userAgent.match(/Edge\/(\d+)/);
3522 if (!match || match[1] >= 74) {
3523 match = userAgent.match(/Chrome\/(\d+)/);
3524 if (match) version = +match[1];
3525 }
3526}
3527
3528module.exports = version;
3529
3530
3531/***/ }),
3532/* 78 */
3533/***/ (function(module, exports) {
3534
3535var $String = String;
3536
3537module.exports = function (argument) {
3538 try {
3539 return $String(argument);
3540 } catch (error) {
3541 return 'Object';
3542 }
3543};
3544
3545
3546/***/ }),
3547/* 79 */
3548/***/ (function(module, exports, __webpack_require__) {
3549
3550var IS_PURE = __webpack_require__(33);
3551var store = __webpack_require__(123);
3552
3553(module.exports = function (key, value) {
3554 return store[key] || (store[key] = value !== undefined ? value : {});
3555})('versions', []).push({
3556 version: '3.23.3',
3557 mode: IS_PURE ? 'pure' : 'global',
3558 copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
3559 license: 'https://github.com/zloirock/core-js/blob/v3.23.3/LICENSE',
3560 source: 'https://github.com/zloirock/core-js'
3561});
3562
3563
3564/***/ }),
3565/* 80 */
3566/***/ (function(module, exports) {
3567
3568module.exports = {};
3569
3570
3571/***/ }),
3572/* 81 */
3573/***/ (function(module, exports, __webpack_require__) {
3574
3575var classof = __webpack_require__(51);
3576
3577var $String = String;
3578
3579module.exports = function (argument) {
3580 if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
3581 return $String(argument);
3582};
3583
3584
3585/***/ }),
3586/* 82 */
3587/***/ (function(module, exports) {
3588
3589module.exports = function (exec) {
3590 try {
3591 return { error: false, value: exec() };
3592 } catch (error) {
3593 return { error: true, value: error };
3594 }
3595};
3596
3597
3598/***/ }),
3599/* 83 */
3600/***/ (function(module, exports, __webpack_require__) {
3601
3602var global = __webpack_require__(7);
3603var NativePromiseConstructor = __webpack_require__(65);
3604var isCallable = __webpack_require__(8);
3605var isForced = __webpack_require__(159);
3606var inspectSource = __webpack_require__(130);
3607var wellKnownSymbol = __webpack_require__(9);
3608var IS_BROWSER = __webpack_require__(307);
3609var IS_PURE = __webpack_require__(33);
3610var V8_VERSION = __webpack_require__(77);
3611
3612var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
3613var SPECIES = wellKnownSymbol('species');
3614var SUBCLASSING = false;
3615var NATIVE_PROMISE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent);
3616
3617var FORCED_PROMISE_CONSTRUCTOR = isForced('Promise', function () {
3618 var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor);
3619 var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor);
3620 // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
3621 // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
3622 // We can't detect it synchronously, so just check versions
3623 if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
3624 // We need Promise#{ catch, finally } in the pure version for preventing prototype pollution
3625 if (IS_PURE && !(NativePromisePrototype['catch'] && NativePromisePrototype['finally'])) return true;
3626 // We can't use @@species feature detection in V8 since it causes
3627 // deoptimization and performance degradation
3628 // https://github.com/zloirock/core-js/issues/679
3629 if (V8_VERSION >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
3630 // Detect correctness of subclassing with @@species support
3631 var promise = new NativePromiseConstructor(function (resolve) { resolve(1); });
3632 var FakePromise = function (exec) {
3633 exec(function () { /* empty */ }, function () { /* empty */ });
3634 };
3635 var constructor = promise.constructor = {};
3636 constructor[SPECIES] = FakePromise;
3637 SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
3638 if (!SUBCLASSING) return true;
3639 // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
3640 return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_PROMISE_REJECTION_EVENT;
3641});
3642
3643module.exports = {
3644 CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR,
3645 REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT,
3646 SUBCLASSING: SUBCLASSING
3647};
3648
3649
3650/***/ }),
3651/* 84 */
3652/***/ (function(module, __webpack_exports__, __webpack_require__) {
3653
3654"use strict";
3655/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hasStringTagBug; });
3656/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isIE11; });
3657/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
3658/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__ = __webpack_require__(324);
3659
3660
3661
3662// In IE 10 - Edge 13, `DataView` has string tag `'[object Object]'`.
3663// In IE 11, the most common among them, this problem also applies to
3664// `Map`, `WeakMap` and `Set`.
3665var hasStringTagBug = (
3666 __WEBPACK_IMPORTED_MODULE_0__setup_js__["s" /* supportsDataView */] && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new DataView(new ArrayBuffer(8)))
3667 ),
3668 isIE11 = (typeof Map !== 'undefined' && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new Map));
3669
3670
3671/***/ }),
3672/* 85 */
3673/***/ (function(module, __webpack_exports__, __webpack_require__) {
3674
3675"use strict";
3676/* harmony export (immutable) */ __webpack_exports__["a"] = allKeys;
3677/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(56);
3678/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
3679/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__ = __webpack_require__(190);
3680
3681
3682
3683
3684// Retrieve all the enumerable property names of an object.
3685function allKeys(obj) {
3686 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return [];
3687 var keys = [];
3688 for (var key in obj) keys.push(key);
3689 // Ahem, IE < 9.
3690 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__["a" /* default */])(obj, keys);
3691 return keys;
3692}
3693
3694
3695/***/ }),
3696/* 86 */
3697/***/ (function(module, __webpack_exports__, __webpack_require__) {
3698
3699"use strict";
3700/* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
3701/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
3702/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(199);
3703
3704
3705
3706// Internal wrapper for `_.toPath` to enable minification.
3707// Similar to `cb` for `_.iteratee`.
3708function toPath(path) {
3709 return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath(path);
3710}
3711
3712
3713/***/ }),
3714/* 87 */
3715/***/ (function(module, __webpack_exports__, __webpack_require__) {
3716
3717"use strict";
3718/* harmony export (immutable) */ __webpack_exports__["a"] = optimizeCb;
3719// Internal function that returns an efficient (for current engines) version
3720// of the passed-in callback, to be repeatedly applied in other Underscore
3721// functions.
3722function optimizeCb(func, context, argCount) {
3723 if (context === void 0) return func;
3724 switch (argCount == null ? 3 : argCount) {
3725 case 1: return function(value) {
3726 return func.call(context, value);
3727 };
3728 // The 2-argument case is omitted because we’re not using it.
3729 case 3: return function(value, index, collection) {
3730 return func.call(context, value, index, collection);
3731 };
3732 case 4: return function(accumulator, value, index, collection) {
3733 return func.call(context, accumulator, value, index, collection);
3734 };
3735 }
3736 return function() {
3737 return func.apply(context, arguments);
3738 };
3739}
3740
3741
3742/***/ }),
3743/* 88 */
3744/***/ (function(module, __webpack_exports__, __webpack_require__) {
3745
3746"use strict";
3747/* harmony export (immutable) */ __webpack_exports__["a"] = filter;
3748/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
3749/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(58);
3750
3751
3752
3753// Return all the elements that pass a truth test.
3754function filter(obj, predicate, context) {
3755 var results = [];
3756 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
3757 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index, list) {
3758 if (predicate(value, index, list)) results.push(value);
3759 });
3760 return results;
3761}
3762
3763
3764/***/ }),
3765/* 89 */
3766/***/ (function(module, __webpack_exports__, __webpack_require__) {
3767
3768"use strict";
3769/* harmony export (immutable) */ __webpack_exports__["a"] = contains;
3770/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
3771/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(66);
3772/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__indexOf_js__ = __webpack_require__(215);
3773
3774
3775
3776
3777// Determine if the array or object contains a given item (using `===`).
3778function contains(obj, item, fromIndex, guard) {
3779 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
3780 if (typeof fromIndex != 'number' || guard) fromIndex = 0;
3781 return Object(__WEBPACK_IMPORTED_MODULE_2__indexOf_js__["a" /* default */])(obj, item, fromIndex) >= 0;
3782}
3783
3784
3785/***/ }),
3786/* 90 */
3787/***/ (function(module, exports, __webpack_require__) {
3788
3789var classof = __webpack_require__(63);
3790
3791// `IsArray` abstract operation
3792// https://tc39.es/ecma262/#sec-isarray
3793// eslint-disable-next-line es-x/no-array-isarray -- safe
3794module.exports = Array.isArray || function isArray(argument) {
3795 return classof(argument) == 'Array';
3796};
3797
3798
3799/***/ }),
3800/* 91 */
3801/***/ (function(module, exports, __webpack_require__) {
3802
3803"use strict";
3804
3805var toPropertyKey = __webpack_require__(96);
3806var definePropertyModule = __webpack_require__(23);
3807var createPropertyDescriptor = __webpack_require__(47);
3808
3809module.exports = function (object, key, value) {
3810 var propertyKey = toPropertyKey(key);
3811 if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
3812 else object[propertyKey] = value;
3813};
3814
3815
3816/***/ }),
3817/* 92 */
3818/***/ (function(module, exports, __webpack_require__) {
3819
3820module.exports = __webpack_require__(241);
3821
3822/***/ }),
3823/* 93 */
3824/***/ (function(module, exports, __webpack_require__) {
3825
3826module.exports = __webpack_require__(472);
3827
3828/***/ }),
3829/* 94 */
3830/***/ (function(module, exports, __webpack_require__) {
3831
3832var $ = __webpack_require__(0);
3833var uncurryThis = __webpack_require__(4);
3834var hiddenKeys = __webpack_require__(80);
3835var isObject = __webpack_require__(11);
3836var hasOwn = __webpack_require__(13);
3837var defineProperty = __webpack_require__(23).f;
3838var getOwnPropertyNamesModule = __webpack_require__(103);
3839var getOwnPropertyNamesExternalModule = __webpack_require__(245);
3840var isExtensible = __webpack_require__(261);
3841var uid = __webpack_require__(99);
3842var FREEZING = __webpack_require__(262);
3843
3844var REQUIRED = false;
3845var METADATA = uid('meta');
3846var id = 0;
3847
3848var setMetadata = function (it) {
3849 defineProperty(it, METADATA, { value: {
3850 objectID: 'O' + id++, // object ID
3851 weakData: {} // weak collections IDs
3852 } });
3853};
3854
3855var fastKey = function (it, create) {
3856 // return a primitive with prefix
3857 if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
3858 if (!hasOwn(it, METADATA)) {
3859 // can't set metadata to uncaught frozen object
3860 if (!isExtensible(it)) return 'F';
3861 // not necessary to add metadata
3862 if (!create) return 'E';
3863 // add missing metadata
3864 setMetadata(it);
3865 // return object ID
3866 } return it[METADATA].objectID;
3867};
3868
3869var getWeakData = function (it, create) {
3870 if (!hasOwn(it, METADATA)) {
3871 // can't set metadata to uncaught frozen object
3872 if (!isExtensible(it)) return true;
3873 // not necessary to add metadata
3874 if (!create) return false;
3875 // add missing metadata
3876 setMetadata(it);
3877 // return the store of weak collections IDs
3878 } return it[METADATA].weakData;
3879};
3880
3881// add metadata on freeze-family methods calling
3882var onFreeze = function (it) {
3883 if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA)) setMetadata(it);
3884 return it;
3885};
3886
3887var enable = function () {
3888 meta.enable = function () { /* empty */ };
3889 REQUIRED = true;
3890 var getOwnPropertyNames = getOwnPropertyNamesModule.f;
3891 var splice = uncurryThis([].splice);
3892 var test = {};
3893 test[METADATA] = 1;
3894
3895 // prevent exposing of metadata key
3896 if (getOwnPropertyNames(test).length) {
3897 getOwnPropertyNamesModule.f = function (it) {
3898 var result = getOwnPropertyNames(it);
3899 for (var i = 0, length = result.length; i < length; i++) {
3900 if (result[i] === METADATA) {
3901 splice(result, i, 1);
3902 break;
3903 }
3904 } return result;
3905 };
3906
3907 $({ target: 'Object', stat: true, forced: true }, {
3908 getOwnPropertyNames: getOwnPropertyNamesExternalModule.f
3909 });
3910 }
3911};
3912
3913var meta = module.exports = {
3914 enable: enable,
3915 fastKey: fastKey,
3916 getWeakData: getWeakData,
3917 onFreeze: onFreeze
3918};
3919
3920hiddenKeys[METADATA] = true;
3921
3922
3923/***/ }),
3924/* 95 */
3925/***/ (function(module, exports, __webpack_require__) {
3926
3927var uncurryThis = __webpack_require__(4);
3928var fails = __webpack_require__(2);
3929var classof = __webpack_require__(63);
3930
3931var $Object = Object;
3932var split = uncurryThis(''.split);
3933
3934// fallback for non-array-like ES3 and non-enumerable old V8 strings
3935module.exports = fails(function () {
3936 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
3937 // eslint-disable-next-line no-prototype-builtins -- safe
3938 return !$Object('z').propertyIsEnumerable(0);
3939}) ? function (it) {
3940 return classof(it) == 'String' ? split(it, '') : $Object(it);
3941} : $Object;
3942
3943
3944/***/ }),
3945/* 96 */
3946/***/ (function(module, exports, __webpack_require__) {
3947
3948var toPrimitive = __webpack_require__(285);
3949var isSymbol = __webpack_require__(97);
3950
3951// `ToPropertyKey` abstract operation
3952// https://tc39.es/ecma262/#sec-topropertykey
3953module.exports = function (argument) {
3954 var key = toPrimitive(argument, 'string');
3955 return isSymbol(key) ? key : key + '';
3956};
3957
3958
3959/***/ }),
3960/* 97 */
3961/***/ (function(module, exports, __webpack_require__) {
3962
3963var getBuiltIn = __webpack_require__(18);
3964var isCallable = __webpack_require__(8);
3965var isPrototypeOf = __webpack_require__(19);
3966var USE_SYMBOL_AS_UID = __webpack_require__(157);
3967
3968var $Object = Object;
3969
3970module.exports = USE_SYMBOL_AS_UID ? function (it) {
3971 return typeof it == 'symbol';
3972} : function (it) {
3973 var $Symbol = getBuiltIn('Symbol');
3974 return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
3975};
3976
3977
3978/***/ }),
3979/* 98 */
3980/***/ (function(module, exports, __webpack_require__) {
3981
3982var getBuiltIn = __webpack_require__(18);
3983
3984module.exports = getBuiltIn('navigator', 'userAgent') || '';
3985
3986
3987/***/ }),
3988/* 99 */
3989/***/ (function(module, exports, __webpack_require__) {
3990
3991var uncurryThis = __webpack_require__(4);
3992
3993var id = 0;
3994var postfix = Math.random();
3995var toString = uncurryThis(1.0.toString);
3996
3997module.exports = function (key) {
3998 return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
3999};
4000
4001
4002/***/ }),
4003/* 100 */
4004/***/ (function(module, exports, __webpack_require__) {
4005
4006var hasOwn = __webpack_require__(13);
4007var isCallable = __webpack_require__(8);
4008var toObject = __webpack_require__(34);
4009var sharedKey = __webpack_require__(101);
4010var CORRECT_PROTOTYPE_GETTER = __webpack_require__(161);
4011
4012var IE_PROTO = sharedKey('IE_PROTO');
4013var $Object = Object;
4014var ObjectPrototype = $Object.prototype;
4015
4016// `Object.getPrototypeOf` method
4017// https://tc39.es/ecma262/#sec-object.getprototypeof
4018// eslint-disable-next-line es-x/no-object-getprototypeof -- safe
4019module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
4020 var object = toObject(O);
4021 if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];
4022 var constructor = object.constructor;
4023 if (isCallable(constructor) && object instanceof constructor) {
4024 return constructor.prototype;
4025 } return object instanceof $Object ? ObjectPrototype : null;
4026};
4027
4028
4029/***/ }),
4030/* 101 */
4031/***/ (function(module, exports, __webpack_require__) {
4032
4033var shared = __webpack_require__(79);
4034var uid = __webpack_require__(99);
4035
4036var keys = shared('keys');
4037
4038module.exports = function (key) {
4039 return keys[key] || (keys[key] = uid(key));
4040};
4041
4042
4043/***/ }),
4044/* 102 */
4045/***/ (function(module, exports, __webpack_require__) {
4046
4047/* eslint-disable no-proto -- safe */
4048var uncurryThis = __webpack_require__(4);
4049var anObject = __webpack_require__(20);
4050var aPossiblePrototype = __webpack_require__(288);
4051
4052// `Object.setPrototypeOf` method
4053// https://tc39.es/ecma262/#sec-object.setprototypeof
4054// Works with __proto__ only. Old v8 can't work with null proto objects.
4055// eslint-disable-next-line es-x/no-object-setprototypeof -- safe
4056module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
4057 var CORRECT_SETTER = false;
4058 var test = {};
4059 var setter;
4060 try {
4061 // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
4062 setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
4063 setter(test, []);
4064 CORRECT_SETTER = test instanceof Array;
4065 } catch (error) { /* empty */ }
4066 return function setPrototypeOf(O, proto) {
4067 anObject(O);
4068 aPossiblePrototype(proto);
4069 if (CORRECT_SETTER) setter(O, proto);
4070 else O.__proto__ = proto;
4071 return O;
4072 };
4073}() : undefined);
4074
4075
4076/***/ }),
4077/* 103 */
4078/***/ (function(module, exports, __webpack_require__) {
4079
4080var internalObjectKeys = __webpack_require__(163);
4081var enumBugKeys = __webpack_require__(127);
4082
4083var hiddenKeys = enumBugKeys.concat('length', 'prototype');
4084
4085// `Object.getOwnPropertyNames` method
4086// https://tc39.es/ecma262/#sec-object.getownpropertynames
4087// eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
4088exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
4089 return internalObjectKeys(O, hiddenKeys);
4090};
4091
4092
4093/***/ }),
4094/* 104 */
4095/***/ (function(module, exports) {
4096
4097// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
4098exports.f = Object.getOwnPropertySymbols;
4099
4100
4101/***/ }),
4102/* 105 */
4103/***/ (function(module, exports, __webpack_require__) {
4104
4105var internalObjectKeys = __webpack_require__(163);
4106var enumBugKeys = __webpack_require__(127);
4107
4108// `Object.keys` method
4109// https://tc39.es/ecma262/#sec-object.keys
4110// eslint-disable-next-line es-x/no-object-keys -- safe
4111module.exports = Object.keys || function keys(O) {
4112 return internalObjectKeys(O, enumBugKeys);
4113};
4114
4115
4116/***/ }),
4117/* 106 */
4118/***/ (function(module, exports, __webpack_require__) {
4119
4120var classof = __webpack_require__(51);
4121var getMethod = __webpack_require__(122);
4122var Iterators = __webpack_require__(50);
4123var wellKnownSymbol = __webpack_require__(9);
4124
4125var ITERATOR = wellKnownSymbol('iterator');
4126
4127module.exports = function (it) {
4128 if (it != undefined) return getMethod(it, ITERATOR)
4129 || getMethod(it, '@@iterator')
4130 || Iterators[classof(it)];
4131};
4132
4133
4134/***/ }),
4135/* 107 */
4136/***/ (function(module, exports, __webpack_require__) {
4137
4138var classof = __webpack_require__(63);
4139var global = __webpack_require__(7);
4140
4141module.exports = classof(global.process) == 'process';
4142
4143
4144/***/ }),
4145/* 108 */
4146/***/ (function(module, exports, __webpack_require__) {
4147
4148var isPrototypeOf = __webpack_require__(19);
4149
4150var $TypeError = TypeError;
4151
4152module.exports = function (it, Prototype) {
4153 if (isPrototypeOf(Prototype, it)) return it;
4154 throw $TypeError('Incorrect invocation');
4155};
4156
4157
4158/***/ }),
4159/* 109 */
4160/***/ (function(module, exports, __webpack_require__) {
4161
4162var uncurryThis = __webpack_require__(4);
4163var fails = __webpack_require__(2);
4164var isCallable = __webpack_require__(8);
4165var classof = __webpack_require__(51);
4166var getBuiltIn = __webpack_require__(18);
4167var inspectSource = __webpack_require__(130);
4168
4169var noop = function () { /* empty */ };
4170var empty = [];
4171var construct = getBuiltIn('Reflect', 'construct');
4172var constructorRegExp = /^\s*(?:class|function)\b/;
4173var exec = uncurryThis(constructorRegExp.exec);
4174var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
4175
4176var isConstructorModern = function isConstructor(argument) {
4177 if (!isCallable(argument)) return false;
4178 try {
4179 construct(noop, empty, argument);
4180 return true;
4181 } catch (error) {
4182 return false;
4183 }
4184};
4185
4186var isConstructorLegacy = function isConstructor(argument) {
4187 if (!isCallable(argument)) return false;
4188 switch (classof(argument)) {
4189 case 'AsyncFunction':
4190 case 'GeneratorFunction':
4191 case 'AsyncGeneratorFunction': return false;
4192 }
4193 try {
4194 // we can't check .prototype since constructors produced by .bind haven't it
4195 // `Function#toString` throws on some built-it function in some legacy engines
4196 // (for example, `DOMQuad` and similar in FF41-)
4197 return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
4198 } catch (error) {
4199 return true;
4200 }
4201};
4202
4203isConstructorLegacy.sham = true;
4204
4205// `IsConstructor` abstract operation
4206// https://tc39.es/ecma262/#sec-isconstructor
4207module.exports = !construct || fails(function () {
4208 var called;
4209 return isConstructorModern(isConstructorModern.call)
4210 || !isConstructorModern(Object)
4211 || !isConstructorModern(function () { called = true; })
4212 || called;
4213}) ? isConstructorLegacy : isConstructorModern;
4214
4215
4216/***/ }),
4217/* 110 */
4218/***/ (function(module, exports, __webpack_require__) {
4219
4220var uncurryThis = __webpack_require__(4);
4221
4222module.exports = uncurryThis([].slice);
4223
4224
4225/***/ }),
4226/* 111 */
4227/***/ (function(module, __webpack_exports__, __webpack_require__) {
4228
4229"use strict";
4230/* harmony export (immutable) */ __webpack_exports__["a"] = matcher;
4231/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__extendOwn_js__ = __webpack_require__(139);
4232/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isMatch_js__ = __webpack_require__(191);
4233
4234
4235
4236// Returns a predicate for checking whether an object has a given set of
4237// `key:value` pairs.
4238function matcher(attrs) {
4239 attrs = Object(__WEBPACK_IMPORTED_MODULE_0__extendOwn_js__["a" /* default */])({}, attrs);
4240 return function(obj) {
4241 return Object(__WEBPACK_IMPORTED_MODULE_1__isMatch_js__["a" /* default */])(obj, attrs);
4242 };
4243}
4244
4245
4246/***/ }),
4247/* 112 */
4248/***/ (function(module, __webpack_exports__, __webpack_require__) {
4249
4250"use strict";
4251/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
4252/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__executeBound_js__ = __webpack_require__(207);
4253/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(25);
4254
4255
4256
4257
4258// Partially apply a function by creating a version that has had some of its
4259// arguments pre-filled, without changing its dynamic `this` context. `_` acts
4260// as a placeholder by default, allowing any combination of arguments to be
4261// pre-filled. Set `_.partial.placeholder` for a custom placeholder argument.
4262var partial = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, boundArgs) {
4263 var placeholder = partial.placeholder;
4264 var bound = function() {
4265 var position = 0, length = boundArgs.length;
4266 var args = Array(length);
4267 for (var i = 0; i < length; i++) {
4268 args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i];
4269 }
4270 while (position < arguments.length) args.push(arguments[position++]);
4271 return Object(__WEBPACK_IMPORTED_MODULE_1__executeBound_js__["a" /* default */])(func, bound, this, this, args);
4272 };
4273 return bound;
4274});
4275
4276partial.placeholder = __WEBPACK_IMPORTED_MODULE_2__underscore_js__["a" /* default */];
4277/* harmony default export */ __webpack_exports__["a"] = (partial);
4278
4279
4280/***/ }),
4281/* 113 */
4282/***/ (function(module, __webpack_exports__, __webpack_require__) {
4283
4284"use strict";
4285/* harmony export (immutable) */ __webpack_exports__["a"] = group;
4286/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
4287/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(58);
4288
4289
4290
4291// An internal function used for aggregate "group by" operations.
4292function group(behavior, partition) {
4293 return function(obj, iteratee, context) {
4294 var result = partition ? [[], []] : {};
4295 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
4296 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index) {
4297 var key = iteratee(value, index, obj);
4298 behavior(result, value, key);
4299 });
4300 return result;
4301 };
4302}
4303
4304
4305/***/ }),
4306/* 114 */
4307/***/ (function(module, exports, __webpack_require__) {
4308
4309var fails = __webpack_require__(2);
4310var wellKnownSymbol = __webpack_require__(9);
4311var V8_VERSION = __webpack_require__(77);
4312
4313var SPECIES = wellKnownSymbol('species');
4314
4315module.exports = function (METHOD_NAME) {
4316 // We can't use this feature detection in V8 since it causes
4317 // deoptimization and serious performance degradation
4318 // https://github.com/zloirock/core-js/issues/677
4319 return V8_VERSION >= 51 || !fails(function () {
4320 var array = [];
4321 var constructor = array.constructor = {};
4322 constructor[SPECIES] = function () {
4323 return { foo: 1 };
4324 };
4325 return array[METHOD_NAME](Boolean).foo !== 1;
4326 });
4327};
4328
4329
4330/***/ }),
4331/* 115 */
4332/***/ (function(module, exports, __webpack_require__) {
4333
4334module.exports = __webpack_require__(399);
4335
4336/***/ }),
4337/* 116 */
4338/***/ (function(module, exports, __webpack_require__) {
4339
4340"use strict";
4341
4342
4343var _interopRequireDefault = __webpack_require__(1);
4344
4345var _typeof2 = _interopRequireDefault(__webpack_require__(73));
4346
4347var _filter = _interopRequireDefault(__webpack_require__(250));
4348
4349var _map = _interopRequireDefault(__webpack_require__(35));
4350
4351var _keys = _interopRequireDefault(__webpack_require__(115));
4352
4353var _stringify = _interopRequireDefault(__webpack_require__(36));
4354
4355var _concat = _interopRequireDefault(__webpack_require__(22));
4356
4357var _ = __webpack_require__(3);
4358
4359var _require = __webpack_require__(251),
4360 timeout = _require.timeout;
4361
4362var debug = __webpack_require__(60);
4363
4364var debugRequest = debug('leancloud:request');
4365var debugRequestError = debug('leancloud:request:error');
4366
4367var _require2 = __webpack_require__(72),
4368 getAdapter = _require2.getAdapter;
4369
4370var requestsCount = 0;
4371
4372var ajax = function ajax(_ref) {
4373 var method = _ref.method,
4374 url = _ref.url,
4375 query = _ref.query,
4376 data = _ref.data,
4377 _ref$headers = _ref.headers,
4378 headers = _ref$headers === void 0 ? {} : _ref$headers,
4379 time = _ref.timeout,
4380 onprogress = _ref.onprogress;
4381
4382 if (query) {
4383 var _context, _context2, _context4;
4384
4385 var queryString = (0, _filter.default)(_context = (0, _map.default)(_context2 = (0, _keys.default)(query)).call(_context2, function (key) {
4386 var _context3;
4387
4388 var value = query[key];
4389 if (value === undefined) return undefined;
4390 var v = (0, _typeof2.default)(value) === 'object' ? (0, _stringify.default)(value) : value;
4391 return (0, _concat.default)(_context3 = "".concat(encodeURIComponent(key), "=")).call(_context3, encodeURIComponent(v));
4392 })).call(_context, function (qs) {
4393 return qs;
4394 }).join('&');
4395 url = (0, _concat.default)(_context4 = "".concat(url, "?")).call(_context4, queryString);
4396 }
4397
4398 var count = requestsCount++;
4399 debugRequest('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
4400 var request = getAdapter('request');
4401 var promise = request(url, {
4402 method: method,
4403 headers: headers,
4404 data: data,
4405 onprogress: onprogress
4406 }).then(function (response) {
4407 debugRequest('response(%d) %d %O %o', count, response.status, response.data || response.text, response.header);
4408
4409 if (response.ok === false) {
4410 var error = new Error();
4411 error.response = response;
4412 throw error;
4413 }
4414
4415 return response.data;
4416 }).catch(function (error) {
4417 if (error.response) {
4418 if (!debug.enabled('leancloud:request')) {
4419 debugRequestError('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
4420 }
4421
4422 debugRequestError('response(%d) %d %O %o', count, error.response.status, error.response.data || error.response.text, error.response.header);
4423 error.statusCode = error.response.status;
4424 error.responseText = error.response.text;
4425 error.response = error.response.data;
4426 }
4427
4428 throw error;
4429 });
4430 return time ? timeout(promise, time) : promise;
4431};
4432
4433module.exports = ajax;
4434
4435/***/ }),
4436/* 117 */
4437/***/ (function(module, exports) {
4438
4439/* (ignored) */
4440
4441/***/ }),
4442/* 118 */
4443/***/ (function(module, exports, __webpack_require__) {
4444
4445var Symbol = __webpack_require__(270),
4446 getRawTag = __webpack_require__(640),
4447 objectToString = __webpack_require__(641);
4448
4449/** `Object#toString` result references. */
4450var nullTag = '[object Null]',
4451 undefinedTag = '[object Undefined]';
4452
4453/** Built-in value references. */
4454var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
4455
4456/**
4457 * The base implementation of `getTag` without fallbacks for buggy environments.
4458 *
4459 * @private
4460 * @param {*} value The value to query.
4461 * @returns {string} Returns the `toStringTag`.
4462 */
4463function baseGetTag(value) {
4464 if (value == null) {
4465 return value === undefined ? undefinedTag : nullTag;
4466 }
4467 return (symToStringTag && symToStringTag in Object(value))
4468 ? getRawTag(value)
4469 : objectToString(value);
4470}
4471
4472module.exports = baseGetTag;
4473
4474
4475/***/ }),
4476/* 119 */
4477/***/ (function(module, exports) {
4478
4479/**
4480 * Checks if `value` is object-like. A value is object-like if it's not `null`
4481 * and has a `typeof` result of "object".
4482 *
4483 * @static
4484 * @memberOf _
4485 * @since 4.0.0
4486 * @category Lang
4487 * @param {*} value The value to check.
4488 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
4489 * @example
4490 *
4491 * _.isObjectLike({});
4492 * // => true
4493 *
4494 * _.isObjectLike([1, 2, 3]);
4495 * // => true
4496 *
4497 * _.isObjectLike(_.noop);
4498 * // => false
4499 *
4500 * _.isObjectLike(null);
4501 * // => false
4502 */
4503function isObjectLike(value) {
4504 return value != null && typeof value == 'object';
4505}
4506
4507module.exports = isObjectLike;
4508
4509
4510/***/ }),
4511/* 120 */
4512/***/ (function(module, exports, __webpack_require__) {
4513
4514"use strict";
4515
4516var $propertyIsEnumerable = {}.propertyIsEnumerable;
4517// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
4518var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
4519
4520// Nashorn ~ JDK8 bug
4521var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
4522
4523// `Object.prototype.propertyIsEnumerable` method implementation
4524// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
4525exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
4526 var descriptor = getOwnPropertyDescriptor(this, V);
4527 return !!descriptor && descriptor.enumerable;
4528} : $propertyIsEnumerable;
4529
4530
4531/***/ }),
4532/* 121 */
4533/***/ (function(module, exports) {
4534
4535var $TypeError = TypeError;
4536
4537// `RequireObjectCoercible` abstract operation
4538// https://tc39.es/ecma262/#sec-requireobjectcoercible
4539module.exports = function (it) {
4540 if (it == undefined) throw $TypeError("Can't call method on " + it);
4541 return it;
4542};
4543
4544
4545/***/ }),
4546/* 122 */
4547/***/ (function(module, exports, __webpack_require__) {
4548
4549var aCallable = __webpack_require__(31);
4550
4551// `GetMethod` abstract operation
4552// https://tc39.es/ecma262/#sec-getmethod
4553module.exports = function (V, P) {
4554 var func = V[P];
4555 return func == null ? undefined : aCallable(func);
4556};
4557
4558
4559/***/ }),
4560/* 123 */
4561/***/ (function(module, exports, __webpack_require__) {
4562
4563var global = __webpack_require__(7);
4564var defineGlobalProperty = __webpack_require__(287);
4565
4566var SHARED = '__core-js_shared__';
4567var store = global[SHARED] || defineGlobalProperty(SHARED, {});
4568
4569module.exports = store;
4570
4571
4572/***/ }),
4573/* 124 */
4574/***/ (function(module, exports, __webpack_require__) {
4575
4576var global = __webpack_require__(7);
4577var isObject = __webpack_require__(11);
4578
4579var document = global.document;
4580// typeof document.createElement is 'object' in old IE
4581var EXISTS = isObject(document) && isObject(document.createElement);
4582
4583module.exports = function (it) {
4584 return EXISTS ? document.createElement(it) : {};
4585};
4586
4587
4588/***/ }),
4589/* 125 */
4590/***/ (function(module, exports, __webpack_require__) {
4591
4592var toIntegerOrInfinity = __webpack_require__(126);
4593
4594var max = Math.max;
4595var min = Math.min;
4596
4597// Helper for a popular repeating case of the spec:
4598// Let integer be ? ToInteger(index).
4599// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
4600module.exports = function (index, length) {
4601 var integer = toIntegerOrInfinity(index);
4602 return integer < 0 ? max(integer + length, 0) : min(integer, length);
4603};
4604
4605
4606/***/ }),
4607/* 126 */
4608/***/ (function(module, exports, __webpack_require__) {
4609
4610var trunc = __webpack_require__(290);
4611
4612// `ToIntegerOrInfinity` abstract operation
4613// https://tc39.es/ecma262/#sec-tointegerorinfinity
4614module.exports = function (argument) {
4615 var number = +argument;
4616 // eslint-disable-next-line no-self-compare -- NaN check
4617 return number !== number || number === 0 ? 0 : trunc(number);
4618};
4619
4620
4621/***/ }),
4622/* 127 */
4623/***/ (function(module, exports) {
4624
4625// IE8- don't enum bug keys
4626module.exports = [
4627 'constructor',
4628 'hasOwnProperty',
4629 'isPrototypeOf',
4630 'propertyIsEnumerable',
4631 'toLocaleString',
4632 'toString',
4633 'valueOf'
4634];
4635
4636
4637/***/ }),
4638/* 128 */
4639/***/ (function(module, exports, __webpack_require__) {
4640
4641var DESCRIPTORS = __webpack_require__(14);
4642var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(160);
4643var definePropertyModule = __webpack_require__(23);
4644var anObject = __webpack_require__(20);
4645var toIndexedObject = __webpack_require__(32);
4646var objectKeys = __webpack_require__(105);
4647
4648// `Object.defineProperties` method
4649// https://tc39.es/ecma262/#sec-object.defineproperties
4650// eslint-disable-next-line es-x/no-object-defineproperties -- safe
4651exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
4652 anObject(O);
4653 var props = toIndexedObject(Properties);
4654 var keys = objectKeys(Properties);
4655 var length = keys.length;
4656 var index = 0;
4657 var key;
4658 while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
4659 return O;
4660};
4661
4662
4663/***/ }),
4664/* 129 */
4665/***/ (function(module, exports, __webpack_require__) {
4666
4667var wellKnownSymbol = __webpack_require__(9);
4668
4669var TO_STRING_TAG = wellKnownSymbol('toStringTag');
4670var test = {};
4671
4672test[TO_STRING_TAG] = 'z';
4673
4674module.exports = String(test) === '[object z]';
4675
4676
4677/***/ }),
4678/* 130 */
4679/***/ (function(module, exports, __webpack_require__) {
4680
4681var uncurryThis = __webpack_require__(4);
4682var isCallable = __webpack_require__(8);
4683var store = __webpack_require__(123);
4684
4685var functionToString = uncurryThis(Function.toString);
4686
4687// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
4688if (!isCallable(store.inspectSource)) {
4689 store.inspectSource = function (it) {
4690 return functionToString(it);
4691 };
4692}
4693
4694module.exports = store.inspectSource;
4695
4696
4697/***/ }),
4698/* 131 */
4699/***/ (function(module, exports, __webpack_require__) {
4700
4701"use strict";
4702
4703var $ = __webpack_require__(0);
4704var call = __webpack_require__(15);
4705var IS_PURE = __webpack_require__(33);
4706var FunctionName = __webpack_require__(296);
4707var isCallable = __webpack_require__(8);
4708var createIteratorConstructor = __webpack_require__(297);
4709var getPrototypeOf = __webpack_require__(100);
4710var setPrototypeOf = __webpack_require__(102);
4711var setToStringTag = __webpack_require__(52);
4712var createNonEnumerableProperty = __webpack_require__(37);
4713var defineBuiltIn = __webpack_require__(44);
4714var wellKnownSymbol = __webpack_require__(9);
4715var Iterators = __webpack_require__(50);
4716var IteratorsCore = __webpack_require__(171);
4717
4718var PROPER_FUNCTION_NAME = FunctionName.PROPER;
4719var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
4720var IteratorPrototype = IteratorsCore.IteratorPrototype;
4721var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
4722var ITERATOR = wellKnownSymbol('iterator');
4723var KEYS = 'keys';
4724var VALUES = 'values';
4725var ENTRIES = 'entries';
4726
4727var returnThis = function () { return this; };
4728
4729module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
4730 createIteratorConstructor(IteratorConstructor, NAME, next);
4731
4732 var getIterationMethod = function (KIND) {
4733 if (KIND === DEFAULT && defaultIterator) return defaultIterator;
4734 if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
4735 switch (KIND) {
4736 case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
4737 case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
4738 case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
4739 } return function () { return new IteratorConstructor(this); };
4740 };
4741
4742 var TO_STRING_TAG = NAME + ' Iterator';
4743 var INCORRECT_VALUES_NAME = false;
4744 var IterablePrototype = Iterable.prototype;
4745 var nativeIterator = IterablePrototype[ITERATOR]
4746 || IterablePrototype['@@iterator']
4747 || DEFAULT && IterablePrototype[DEFAULT];
4748 var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
4749 var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
4750 var CurrentIteratorPrototype, methods, KEY;
4751
4752 // fix native
4753 if (anyNativeIterator) {
4754 CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
4755 if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
4756 if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
4757 if (setPrototypeOf) {
4758 setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
4759 } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {
4760 defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);
4761 }
4762 }
4763 // Set @@toStringTag to native iterators
4764 setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
4765 if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
4766 }
4767 }
4768
4769 // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
4770 if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
4771 if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {
4772 createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
4773 } else {
4774 INCORRECT_VALUES_NAME = true;
4775 defaultIterator = function values() { return call(nativeIterator, this); };
4776 }
4777 }
4778
4779 // export additional methods
4780 if (DEFAULT) {
4781 methods = {
4782 values: getIterationMethod(VALUES),
4783 keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
4784 entries: getIterationMethod(ENTRIES)
4785 };
4786 if (FORCED) for (KEY in methods) {
4787 if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
4788 defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
4789 }
4790 } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
4791 }
4792
4793 // define iterator
4794 if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
4795 defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });
4796 }
4797 Iterators[NAME] = defaultIterator;
4798
4799 return methods;
4800};
4801
4802
4803/***/ }),
4804/* 132 */
4805/***/ (function(module, __webpack_exports__, __webpack_require__) {
4806
4807"use strict";
4808Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
4809/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
4810/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return __WEBPACK_IMPORTED_MODULE_0__setup_js__["e"]; });
4811/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__restArguments_js__ = __webpack_require__(24);
4812/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "restArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__restArguments_js__["a"]; });
4813/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(56);
4814/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return __WEBPACK_IMPORTED_MODULE_2__isObject_js__["a"]; });
4815/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isNull_js__ = __webpack_require__(319);
4816/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return __WEBPACK_IMPORTED_MODULE_3__isNull_js__["a"]; });
4817/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__ = __webpack_require__(180);
4818/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__["a"]; });
4819/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__ = __webpack_require__(181);
4820/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isBoolean", function() { return __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__["a"]; });
4821/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isElement_js__ = __webpack_require__(320);
4822/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isElement", function() { return __WEBPACK_IMPORTED_MODULE_6__isElement_js__["a"]; });
4823/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__isString_js__ = __webpack_require__(133);
4824/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return __WEBPACK_IMPORTED_MODULE_7__isString_js__["a"]; });
4825/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__isNumber_js__ = __webpack_require__(182);
4826/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return __WEBPACK_IMPORTED_MODULE_8__isNumber_js__["a"]; });
4827/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__isDate_js__ = __webpack_require__(321);
4828/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return __WEBPACK_IMPORTED_MODULE_9__isDate_js__["a"]; });
4829/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__ = __webpack_require__(322);
4830/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__["a"]; });
4831/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__isError_js__ = __webpack_require__(323);
4832/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isError", function() { return __WEBPACK_IMPORTED_MODULE_11__isError_js__["a"]; });
4833/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__ = __webpack_require__(183);
4834/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSymbol", function() { return __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__["a"]; });
4835/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__ = __webpack_require__(184);
4836/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__["a"]; });
4837/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__isDataView_js__ = __webpack_require__(134);
4838/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDataView", function() { return __WEBPACK_IMPORTED_MODULE_14__isDataView_js__["a"]; });
4839/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__isArray_js__ = __webpack_require__(57);
4840/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return __WEBPACK_IMPORTED_MODULE_15__isArray_js__["a"]; });
4841/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__isFunction_js__ = __webpack_require__(28);
4842/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return __WEBPACK_IMPORTED_MODULE_16__isFunction_js__["a"]; });
4843/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__isArguments_js__ = __webpack_require__(135);
4844/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArguments", function() { return __WEBPACK_IMPORTED_MODULE_17__isArguments_js__["a"]; });
4845/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__isFinite_js__ = __webpack_require__(325);
4846/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFinite", function() { return __WEBPACK_IMPORTED_MODULE_18__isFinite_js__["a"]; });
4847/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__isNaN_js__ = __webpack_require__(185);
4848/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNaN", function() { return __WEBPACK_IMPORTED_MODULE_19__isNaN_js__["a"]; });
4849/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__ = __webpack_require__(186);
4850/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__["a"]; });
4851/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__ = __webpack_require__(327);
4852/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__["a"]; });
4853/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__isMatch_js__ = __webpack_require__(191);
4854/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMatch", function() { return __WEBPACK_IMPORTED_MODULE_22__isMatch_js__["a"]; });
4855/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__isEqual_js__ = __webpack_require__(328);
4856/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return __WEBPACK_IMPORTED_MODULE_23__isEqual_js__["a"]; });
4857/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__isMap_js__ = __webpack_require__(330);
4858/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMap", function() { return __WEBPACK_IMPORTED_MODULE_24__isMap_js__["a"]; });
4859/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__ = __webpack_require__(331);
4860/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakMap", function() { return __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__["a"]; });
4861/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__isSet_js__ = __webpack_require__(332);
4862/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSet", function() { return __WEBPACK_IMPORTED_MODULE_26__isSet_js__["a"]; });
4863/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__ = __webpack_require__(333);
4864/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakSet", function() { return __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__["a"]; });
4865/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__keys_js__ = __webpack_require__(16);
4866/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return __WEBPACK_IMPORTED_MODULE_28__keys_js__["a"]; });
4867/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__allKeys_js__ = __webpack_require__(85);
4868/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "allKeys", function() { return __WEBPACK_IMPORTED_MODULE_29__allKeys_js__["a"]; });
4869/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__values_js__ = __webpack_require__(66);
4870/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "values", function() { return __WEBPACK_IMPORTED_MODULE_30__values_js__["a"]; });
4871/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__pairs_js__ = __webpack_require__(334);
4872/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return __WEBPACK_IMPORTED_MODULE_31__pairs_js__["a"]; });
4873/* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__invert_js__ = __webpack_require__(192);
4874/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return __WEBPACK_IMPORTED_MODULE_32__invert_js__["a"]; });
4875/* harmony import */ var __WEBPACK_IMPORTED_MODULE_33__functions_js__ = __webpack_require__(193);
4876/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "functions", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
4877/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "methods", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
4878/* harmony import */ var __WEBPACK_IMPORTED_MODULE_34__extend_js__ = __webpack_require__(194);
4879/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return __WEBPACK_IMPORTED_MODULE_34__extend_js__["a"]; });
4880/* harmony import */ var __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__ = __webpack_require__(139);
4881/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extendOwn", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
4882/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
4883/* harmony import */ var __WEBPACK_IMPORTED_MODULE_36__defaults_js__ = __webpack_require__(195);
4884/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return __WEBPACK_IMPORTED_MODULE_36__defaults_js__["a"]; });
4885/* harmony import */ var __WEBPACK_IMPORTED_MODULE_37__create_js__ = __webpack_require__(335);
4886/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return __WEBPACK_IMPORTED_MODULE_37__create_js__["a"]; });
4887/* harmony import */ var __WEBPACK_IMPORTED_MODULE_38__clone_js__ = __webpack_require__(197);
4888/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return __WEBPACK_IMPORTED_MODULE_38__clone_js__["a"]; });
4889/* harmony import */ var __WEBPACK_IMPORTED_MODULE_39__tap_js__ = __webpack_require__(336);
4890/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return __WEBPACK_IMPORTED_MODULE_39__tap_js__["a"]; });
4891/* harmony import */ var __WEBPACK_IMPORTED_MODULE_40__get_js__ = __webpack_require__(198);
4892/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return __WEBPACK_IMPORTED_MODULE_40__get_js__["a"]; });
4893/* harmony import */ var __WEBPACK_IMPORTED_MODULE_41__has_js__ = __webpack_require__(337);
4894/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "has", function() { return __WEBPACK_IMPORTED_MODULE_41__has_js__["a"]; });
4895/* harmony import */ var __WEBPACK_IMPORTED_MODULE_42__mapObject_js__ = __webpack_require__(338);
4896/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mapObject", function() { return __WEBPACK_IMPORTED_MODULE_42__mapObject_js__["a"]; });
4897/* harmony import */ var __WEBPACK_IMPORTED_MODULE_43__identity_js__ = __webpack_require__(141);
4898/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return __WEBPACK_IMPORTED_MODULE_43__identity_js__["a"]; });
4899/* harmony import */ var __WEBPACK_IMPORTED_MODULE_44__constant_js__ = __webpack_require__(187);
4900/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "constant", function() { return __WEBPACK_IMPORTED_MODULE_44__constant_js__["a"]; });
4901/* harmony import */ var __WEBPACK_IMPORTED_MODULE_45__noop_js__ = __webpack_require__(202);
4902/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return __WEBPACK_IMPORTED_MODULE_45__noop_js__["a"]; });
4903/* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__toPath_js__ = __webpack_require__(199);
4904/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toPath", function() { return __WEBPACK_IMPORTED_MODULE_46__toPath_js__["a"]; });
4905/* harmony import */ var __WEBPACK_IMPORTED_MODULE_47__property_js__ = __webpack_require__(142);
4906/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "property", function() { return __WEBPACK_IMPORTED_MODULE_47__property_js__["a"]; });
4907/* harmony import */ var __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__ = __webpack_require__(339);
4908/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "propertyOf", function() { return __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__["a"]; });
4909/* harmony import */ var __WEBPACK_IMPORTED_MODULE_49__matcher_js__ = __webpack_require__(111);
4910/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matcher", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
4911/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
4912/* harmony import */ var __WEBPACK_IMPORTED_MODULE_50__times_js__ = __webpack_require__(340);
4913/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "times", function() { return __WEBPACK_IMPORTED_MODULE_50__times_js__["a"]; });
4914/* harmony import */ var __WEBPACK_IMPORTED_MODULE_51__random_js__ = __webpack_require__(203);
4915/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return __WEBPACK_IMPORTED_MODULE_51__random_js__["a"]; });
4916/* harmony import */ var __WEBPACK_IMPORTED_MODULE_52__now_js__ = __webpack_require__(143);
4917/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "now", function() { return __WEBPACK_IMPORTED_MODULE_52__now_js__["a"]; });
4918/* harmony import */ var __WEBPACK_IMPORTED_MODULE_53__escape_js__ = __webpack_require__(341);
4919/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "escape", function() { return __WEBPACK_IMPORTED_MODULE_53__escape_js__["a"]; });
4920/* harmony import */ var __WEBPACK_IMPORTED_MODULE_54__unescape_js__ = __webpack_require__(342);
4921/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unescape", function() { return __WEBPACK_IMPORTED_MODULE_54__unescape_js__["a"]; });
4922/* harmony import */ var __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__ = __webpack_require__(206);
4923/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "templateSettings", function() { return __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__["a"]; });
4924/* harmony import */ var __WEBPACK_IMPORTED_MODULE_56__template_js__ = __webpack_require__(344);
4925/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "template", function() { return __WEBPACK_IMPORTED_MODULE_56__template_js__["a"]; });
4926/* harmony import */ var __WEBPACK_IMPORTED_MODULE_57__result_js__ = __webpack_require__(345);
4927/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "result", function() { return __WEBPACK_IMPORTED_MODULE_57__result_js__["a"]; });
4928/* harmony import */ var __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__ = __webpack_require__(346);
4929/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniqueId", function() { return __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__["a"]; });
4930/* harmony import */ var __WEBPACK_IMPORTED_MODULE_59__chain_js__ = __webpack_require__(347);
4931/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chain", function() { return __WEBPACK_IMPORTED_MODULE_59__chain_js__["a"]; });
4932/* harmony import */ var __WEBPACK_IMPORTED_MODULE_60__iteratee_js__ = __webpack_require__(201);
4933/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "iteratee", function() { return __WEBPACK_IMPORTED_MODULE_60__iteratee_js__["a"]; });
4934/* harmony import */ var __WEBPACK_IMPORTED_MODULE_61__partial_js__ = __webpack_require__(112);
4935/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partial", function() { return __WEBPACK_IMPORTED_MODULE_61__partial_js__["a"]; });
4936/* harmony import */ var __WEBPACK_IMPORTED_MODULE_62__bind_js__ = __webpack_require__(208);
4937/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return __WEBPACK_IMPORTED_MODULE_62__bind_js__["a"]; });
4938/* harmony import */ var __WEBPACK_IMPORTED_MODULE_63__bindAll_js__ = __webpack_require__(348);
4939/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bindAll", function() { return __WEBPACK_IMPORTED_MODULE_63__bindAll_js__["a"]; });
4940/* harmony import */ var __WEBPACK_IMPORTED_MODULE_64__memoize_js__ = __webpack_require__(349);
4941/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "memoize", function() { return __WEBPACK_IMPORTED_MODULE_64__memoize_js__["a"]; });
4942/* harmony import */ var __WEBPACK_IMPORTED_MODULE_65__delay_js__ = __webpack_require__(209);
4943/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return __WEBPACK_IMPORTED_MODULE_65__delay_js__["a"]; });
4944/* harmony import */ var __WEBPACK_IMPORTED_MODULE_66__defer_js__ = __webpack_require__(350);
4945/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return __WEBPACK_IMPORTED_MODULE_66__defer_js__["a"]; });
4946/* harmony import */ var __WEBPACK_IMPORTED_MODULE_67__throttle_js__ = __webpack_require__(351);
4947/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return __WEBPACK_IMPORTED_MODULE_67__throttle_js__["a"]; });
4948/* harmony import */ var __WEBPACK_IMPORTED_MODULE_68__debounce_js__ = __webpack_require__(352);
4949/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return __WEBPACK_IMPORTED_MODULE_68__debounce_js__["a"]; });
4950/* harmony import */ var __WEBPACK_IMPORTED_MODULE_69__wrap_js__ = __webpack_require__(353);
4951/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "wrap", function() { return __WEBPACK_IMPORTED_MODULE_69__wrap_js__["a"]; });
4952/* harmony import */ var __WEBPACK_IMPORTED_MODULE_70__negate_js__ = __webpack_require__(144);
4953/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return __WEBPACK_IMPORTED_MODULE_70__negate_js__["a"]; });
4954/* harmony import */ var __WEBPACK_IMPORTED_MODULE_71__compose_js__ = __webpack_require__(354);
4955/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return __WEBPACK_IMPORTED_MODULE_71__compose_js__["a"]; });
4956/* harmony import */ var __WEBPACK_IMPORTED_MODULE_72__after_js__ = __webpack_require__(355);
4957/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "after", function() { return __WEBPACK_IMPORTED_MODULE_72__after_js__["a"]; });
4958/* harmony import */ var __WEBPACK_IMPORTED_MODULE_73__before_js__ = __webpack_require__(210);
4959/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "before", function() { return __WEBPACK_IMPORTED_MODULE_73__before_js__["a"]; });
4960/* harmony import */ var __WEBPACK_IMPORTED_MODULE_74__once_js__ = __webpack_require__(356);
4961/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "once", function() { return __WEBPACK_IMPORTED_MODULE_74__once_js__["a"]; });
4962/* harmony import */ var __WEBPACK_IMPORTED_MODULE_75__findKey_js__ = __webpack_require__(211);
4963/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findKey", function() { return __WEBPACK_IMPORTED_MODULE_75__findKey_js__["a"]; });
4964/* harmony import */ var __WEBPACK_IMPORTED_MODULE_76__findIndex_js__ = __webpack_require__(145);
4965/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return __WEBPACK_IMPORTED_MODULE_76__findIndex_js__["a"]; });
4966/* harmony import */ var __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__ = __webpack_require__(213);
4967/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__["a"]; });
4968/* harmony import */ var __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__ = __webpack_require__(214);
4969/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortedIndex", function() { return __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__["a"]; });
4970/* harmony import */ var __WEBPACK_IMPORTED_MODULE_79__indexOf_js__ = __webpack_require__(215);
4971/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return __WEBPACK_IMPORTED_MODULE_79__indexOf_js__["a"]; });
4972/* harmony import */ var __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__ = __webpack_require__(357);
4973/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__["a"]; });
4974/* harmony import */ var __WEBPACK_IMPORTED_MODULE_81__find_js__ = __webpack_require__(217);
4975/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "find", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
4976/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "detect", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
4977/* harmony import */ var __WEBPACK_IMPORTED_MODULE_82__findWhere_js__ = __webpack_require__(358);
4978/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findWhere", function() { return __WEBPACK_IMPORTED_MODULE_82__findWhere_js__["a"]; });
4979/* harmony import */ var __WEBPACK_IMPORTED_MODULE_83__each_js__ = __webpack_require__(58);
4980/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "each", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
4981/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
4982/* harmony import */ var __WEBPACK_IMPORTED_MODULE_84__map_js__ = __webpack_require__(68);
4983/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "map", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
4984/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "collect", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
4985/* harmony import */ var __WEBPACK_IMPORTED_MODULE_85__reduce_js__ = __webpack_require__(359);
4986/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
4987/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldl", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
4988/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
4989/* harmony import */ var __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__ = __webpack_require__(360);
4990/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduceRight", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
4991/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldr", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
4992/* harmony import */ var __WEBPACK_IMPORTED_MODULE_87__filter_js__ = __webpack_require__(88);
4993/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
4994/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
4995/* harmony import */ var __WEBPACK_IMPORTED_MODULE_88__reject_js__ = __webpack_require__(361);
4996/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return __WEBPACK_IMPORTED_MODULE_88__reject_js__["a"]; });
4997/* harmony import */ var __WEBPACK_IMPORTED_MODULE_89__every_js__ = __webpack_require__(362);
4998/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "every", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
4999/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "all", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
5000/* harmony import */ var __WEBPACK_IMPORTED_MODULE_90__some_js__ = __webpack_require__(363);
5001/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "some", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
5002/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "any", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
5003/* harmony import */ var __WEBPACK_IMPORTED_MODULE_91__contains_js__ = __webpack_require__(89);
5004/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
5005/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
5006/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "include", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
5007/* harmony import */ var __WEBPACK_IMPORTED_MODULE_92__invoke_js__ = __webpack_require__(364);
5008/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invoke", function() { return __WEBPACK_IMPORTED_MODULE_92__invoke_js__["a"]; });
5009/* harmony import */ var __WEBPACK_IMPORTED_MODULE_93__pluck_js__ = __webpack_require__(146);
5010/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return __WEBPACK_IMPORTED_MODULE_93__pluck_js__["a"]; });
5011/* harmony import */ var __WEBPACK_IMPORTED_MODULE_94__where_js__ = __webpack_require__(365);
5012/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "where", function() { return __WEBPACK_IMPORTED_MODULE_94__where_js__["a"]; });
5013/* harmony import */ var __WEBPACK_IMPORTED_MODULE_95__max_js__ = __webpack_require__(219);
5014/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "max", function() { return __WEBPACK_IMPORTED_MODULE_95__max_js__["a"]; });
5015/* harmony import */ var __WEBPACK_IMPORTED_MODULE_96__min_js__ = __webpack_require__(366);
5016/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "min", function() { return __WEBPACK_IMPORTED_MODULE_96__min_js__["a"]; });
5017/* harmony import */ var __WEBPACK_IMPORTED_MODULE_97__shuffle_js__ = __webpack_require__(367);
5018/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "shuffle", function() { return __WEBPACK_IMPORTED_MODULE_97__shuffle_js__["a"]; });
5019/* harmony import */ var __WEBPACK_IMPORTED_MODULE_98__sample_js__ = __webpack_require__(220);
5020/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return __WEBPACK_IMPORTED_MODULE_98__sample_js__["a"]; });
5021/* harmony import */ var __WEBPACK_IMPORTED_MODULE_99__sortBy_js__ = __webpack_require__(368);
5022/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return __WEBPACK_IMPORTED_MODULE_99__sortBy_js__["a"]; });
5023/* harmony import */ var __WEBPACK_IMPORTED_MODULE_100__groupBy_js__ = __webpack_require__(369);
5024/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return __WEBPACK_IMPORTED_MODULE_100__groupBy_js__["a"]; });
5025/* harmony import */ var __WEBPACK_IMPORTED_MODULE_101__indexBy_js__ = __webpack_require__(370);
5026/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexBy", function() { return __WEBPACK_IMPORTED_MODULE_101__indexBy_js__["a"]; });
5027/* harmony import */ var __WEBPACK_IMPORTED_MODULE_102__countBy_js__ = __webpack_require__(371);
5028/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "countBy", function() { return __WEBPACK_IMPORTED_MODULE_102__countBy_js__["a"]; });
5029/* harmony import */ var __WEBPACK_IMPORTED_MODULE_103__partition_js__ = __webpack_require__(372);
5030/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return __WEBPACK_IMPORTED_MODULE_103__partition_js__["a"]; });
5031/* harmony import */ var __WEBPACK_IMPORTED_MODULE_104__toArray_js__ = __webpack_require__(373);
5032/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return __WEBPACK_IMPORTED_MODULE_104__toArray_js__["a"]; });
5033/* harmony import */ var __WEBPACK_IMPORTED_MODULE_105__size_js__ = __webpack_require__(374);
5034/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "size", function() { return __WEBPACK_IMPORTED_MODULE_105__size_js__["a"]; });
5035/* harmony import */ var __WEBPACK_IMPORTED_MODULE_106__pick_js__ = __webpack_require__(221);
5036/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return __WEBPACK_IMPORTED_MODULE_106__pick_js__["a"]; });
5037/* harmony import */ var __WEBPACK_IMPORTED_MODULE_107__omit_js__ = __webpack_require__(376);
5038/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "omit", function() { return __WEBPACK_IMPORTED_MODULE_107__omit_js__["a"]; });
5039/* harmony import */ var __WEBPACK_IMPORTED_MODULE_108__first_js__ = __webpack_require__(377);
5040/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "first", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
5041/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "head", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
5042/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "take", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
5043/* harmony import */ var __WEBPACK_IMPORTED_MODULE_109__initial_js__ = __webpack_require__(222);
5044/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "initial", function() { return __WEBPACK_IMPORTED_MODULE_109__initial_js__["a"]; });
5045/* harmony import */ var __WEBPACK_IMPORTED_MODULE_110__last_js__ = __webpack_require__(378);
5046/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "last", function() { return __WEBPACK_IMPORTED_MODULE_110__last_js__["a"]; });
5047/* harmony import */ var __WEBPACK_IMPORTED_MODULE_111__rest_js__ = __webpack_require__(223);
5048/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "rest", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
5049/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tail", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
5050/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "drop", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
5051/* harmony import */ var __WEBPACK_IMPORTED_MODULE_112__compact_js__ = __webpack_require__(379);
5052/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compact", function() { return __WEBPACK_IMPORTED_MODULE_112__compact_js__["a"]; });
5053/* harmony import */ var __WEBPACK_IMPORTED_MODULE_113__flatten_js__ = __webpack_require__(380);
5054/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return __WEBPACK_IMPORTED_MODULE_113__flatten_js__["a"]; });
5055/* harmony import */ var __WEBPACK_IMPORTED_MODULE_114__without_js__ = __webpack_require__(381);
5056/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "without", function() { return __WEBPACK_IMPORTED_MODULE_114__without_js__["a"]; });
5057/* harmony import */ var __WEBPACK_IMPORTED_MODULE_115__uniq_js__ = __webpack_require__(225);
5058/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
5059/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
5060/* harmony import */ var __WEBPACK_IMPORTED_MODULE_116__union_js__ = __webpack_require__(382);
5061/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "union", function() { return __WEBPACK_IMPORTED_MODULE_116__union_js__["a"]; });
5062/* harmony import */ var __WEBPACK_IMPORTED_MODULE_117__intersection_js__ = __webpack_require__(383);
5063/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return __WEBPACK_IMPORTED_MODULE_117__intersection_js__["a"]; });
5064/* harmony import */ var __WEBPACK_IMPORTED_MODULE_118__difference_js__ = __webpack_require__(224);
5065/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return __WEBPACK_IMPORTED_MODULE_118__difference_js__["a"]; });
5066/* harmony import */ var __WEBPACK_IMPORTED_MODULE_119__unzip_js__ = __webpack_require__(226);
5067/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unzip", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
5068/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
5069/* harmony import */ var __WEBPACK_IMPORTED_MODULE_120__zip_js__ = __webpack_require__(384);
5070/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return __WEBPACK_IMPORTED_MODULE_120__zip_js__["a"]; });
5071/* harmony import */ var __WEBPACK_IMPORTED_MODULE_121__object_js__ = __webpack_require__(385);
5072/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "object", function() { return __WEBPACK_IMPORTED_MODULE_121__object_js__["a"]; });
5073/* harmony import */ var __WEBPACK_IMPORTED_MODULE_122__range_js__ = __webpack_require__(386);
5074/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_122__range_js__["a"]; });
5075/* harmony import */ var __WEBPACK_IMPORTED_MODULE_123__chunk_js__ = __webpack_require__(387);
5076/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chunk", function() { return __WEBPACK_IMPORTED_MODULE_123__chunk_js__["a"]; });
5077/* harmony import */ var __WEBPACK_IMPORTED_MODULE_124__mixin_js__ = __webpack_require__(388);
5078/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mixin", function() { return __WEBPACK_IMPORTED_MODULE_124__mixin_js__["a"]; });
5079/* harmony import */ var __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__ = __webpack_require__(389);
5080/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__["a"]; });
5081// Named Exports
5082// =============
5083
5084// Underscore.js 1.12.1
5085// https://underscorejs.org
5086// (c) 2009-2020 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
5087// Underscore may be freely distributed under the MIT license.
5088
5089// Baseline setup.
5090
5091
5092
5093// Object Functions
5094// ----------------
5095// Our most fundamental functions operate on any JavaScript object.
5096// Most functions in Underscore depend on at least one function in this section.
5097
5098// A group of functions that check the types of core JavaScript values.
5099// These are often informally referred to as the "isType" functions.
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127// Functions that treat an object as a dictionary of key-value pairs.
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144// Utility Functions
5145// -----------------
5146// A bit of a grab bag: Predicate-generating functions for use with filters and
5147// loops, string escaping and templating, create random numbers and unique ids,
5148// and functions that facilitate Underscore's chaining and iteration conventions.
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168// Function (ahem) Functions
5169// -------------------------
5170// These functions take a function as an argument and return a new function
5171// as the result. Also known as higher-order functions.
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187// Finders
5188// -------
5189// Functions that extract (the position of) a single element from an object
5190// or array based on some criterion.
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200// Collection Functions
5201// --------------------
5202// Functions that work on any collection of elements: either an array, or
5203// an object of key-value pairs.
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228// `_.pick` and `_.omit` are actually object functions, but we put
5229// them here in order to create a more natural reading order in the
5230// monolithic build as they depend on `_.contains`.
5231
5232
5233
5234// Array Functions
5235// ---------------
5236// Functions that operate on arrays (and array-likes) only, because they’re
5237// expressed in terms of operations on an ordered list of values.
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255// OOP
5256// ---
5257// These modules support the "object-oriented" calling style. See also
5258// `underscore.js` and `index-default.js`.
5259
5260
5261
5262
5263/***/ }),
5264/* 133 */
5265/***/ (function(module, __webpack_exports__, __webpack_require__) {
5266
5267"use strict";
5268/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
5269
5270
5271/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('String'));
5272
5273
5274/***/ }),
5275/* 134 */
5276/***/ (function(module, __webpack_exports__, __webpack_require__) {
5277
5278"use strict";
5279/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
5280/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
5281/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArrayBuffer_js__ = __webpack_require__(184);
5282/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__ = __webpack_require__(84);
5283
5284
5285
5286
5287
5288var isDataView = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('DataView');
5289
5290// In IE 10 - Edge 13, we need a different heuristic
5291// to determine whether an object is a `DataView`.
5292function ie10IsDataView(obj) {
5293 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);
5294}
5295
5296/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__["a" /* hasStringTagBug */] ? ie10IsDataView : isDataView);
5297
5298
5299/***/ }),
5300/* 135 */
5301/***/ (function(module, __webpack_exports__, __webpack_require__) {
5302
5303"use strict";
5304/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
5305/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(45);
5306
5307
5308
5309var isArguments = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Arguments');
5310
5311// Define a fallback version of the method in browsers (ahem, IE < 9), where
5312// there isn't any inspectable "Arguments" type.
5313(function() {
5314 if (!isArguments(arguments)) {
5315 isArguments = function(obj) {
5316 return Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(obj, 'callee');
5317 };
5318 }
5319}());
5320
5321/* harmony default export */ __webpack_exports__["a"] = (isArguments);
5322
5323
5324/***/ }),
5325/* 136 */
5326/***/ (function(module, __webpack_exports__, __webpack_require__) {
5327
5328"use strict";
5329/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(189);
5330
5331
5332// Internal helper to obtain the `byteLength` property of an object.
5333/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('byteLength'));
5334
5335
5336/***/ }),
5337/* 137 */
5338/***/ (function(module, __webpack_exports__, __webpack_require__) {
5339
5340"use strict";
5341/* harmony export (immutable) */ __webpack_exports__["a"] = ie11fingerprint;
5342/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return mapMethods; });
5343/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return weakMapMethods; });
5344/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setMethods; });
5345/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
5346/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
5347/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__allKeys_js__ = __webpack_require__(85);
5348
5349
5350
5351
5352// Since the regular `Object.prototype.toString` type tests don't work for
5353// some types in IE 11, we use a fingerprinting heuristic instead, based
5354// on the methods. It's not great, but it's the best we got.
5355// The fingerprint method lists are defined below.
5356function ie11fingerprint(methods) {
5357 var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(methods);
5358 return function(obj) {
5359 if (obj == null) return false;
5360 // `Map`, `WeakMap` and `Set` have no enumerable keys.
5361 var keys = Object(__WEBPACK_IMPORTED_MODULE_2__allKeys_js__["a" /* default */])(obj);
5362 if (Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(keys)) return false;
5363 for (var i = 0; i < length; i++) {
5364 if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[methods[i]])) return false;
5365 }
5366 // If we are testing against `WeakMap`, we need to ensure that
5367 // `obj` doesn't have a `forEach` method in order to distinguish
5368 // it from a regular `Map`.
5369 return methods !== weakMapMethods || !Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[forEachName]);
5370 };
5371}
5372
5373// In the interest of compact minification, we write
5374// each string in the fingerprints only once.
5375var forEachName = 'forEach',
5376 hasName = 'has',
5377 commonInit = ['clear', 'delete'],
5378 mapTail = ['get', hasName, 'set'];
5379
5380// `Map`, `WeakMap` and `Set` each have slightly different
5381// combinations of the above sublists.
5382var mapMethods = commonInit.concat(forEachName, mapTail),
5383 weakMapMethods = commonInit.concat(mapTail),
5384 setMethods = ['add'].concat(commonInit, forEachName, hasName);
5385
5386
5387/***/ }),
5388/* 138 */
5389/***/ (function(module, __webpack_exports__, __webpack_require__) {
5390
5391"use strict";
5392/* harmony export (immutable) */ __webpack_exports__["a"] = createAssigner;
5393// An internal function for creating assigner functions.
5394function createAssigner(keysFunc, defaults) {
5395 return function(obj) {
5396 var length = arguments.length;
5397 if (defaults) obj = Object(obj);
5398 if (length < 2 || obj == null) return obj;
5399 for (var index = 1; index < length; index++) {
5400 var source = arguments[index],
5401 keys = keysFunc(source),
5402 l = keys.length;
5403 for (var i = 0; i < l; i++) {
5404 var key = keys[i];
5405 if (!defaults || obj[key] === void 0) obj[key] = source[key];
5406 }
5407 }
5408 return obj;
5409 };
5410}
5411
5412
5413/***/ }),
5414/* 139 */
5415/***/ (function(module, __webpack_exports__, __webpack_require__) {
5416
5417"use strict";
5418/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(138);
5419/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
5420
5421
5422
5423// Assigns a given object with all the own properties in the passed-in
5424// object(s).
5425// (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
5426/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */]));
5427
5428
5429/***/ }),
5430/* 140 */
5431/***/ (function(module, __webpack_exports__, __webpack_require__) {
5432
5433"use strict";
5434/* harmony export (immutable) */ __webpack_exports__["a"] = deepGet;
5435// Internal function to obtain a nested property in `obj` along `path`.
5436function deepGet(obj, path) {
5437 var length = path.length;
5438 for (var i = 0; i < length; i++) {
5439 if (obj == null) return void 0;
5440 obj = obj[path[i]];
5441 }
5442 return length ? obj : void 0;
5443}
5444
5445
5446/***/ }),
5447/* 141 */
5448/***/ (function(module, __webpack_exports__, __webpack_require__) {
5449
5450"use strict";
5451/* harmony export (immutable) */ __webpack_exports__["a"] = identity;
5452// Keep the identity function around for default iteratees.
5453function identity(value) {
5454 return value;
5455}
5456
5457
5458/***/ }),
5459/* 142 */
5460/***/ (function(module, __webpack_exports__, __webpack_require__) {
5461
5462"use strict";
5463/* harmony export (immutable) */ __webpack_exports__["a"] = property;
5464/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__deepGet_js__ = __webpack_require__(140);
5465/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(86);
5466
5467
5468
5469// Creates a function that, when passed an object, will traverse that object’s
5470// properties down the given `path`, specified as an array of keys or indices.
5471function property(path) {
5472 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
5473 return function(obj) {
5474 return Object(__WEBPACK_IMPORTED_MODULE_0__deepGet_js__["a" /* default */])(obj, path);
5475 };
5476}
5477
5478
5479/***/ }),
5480/* 143 */
5481/***/ (function(module, __webpack_exports__, __webpack_require__) {
5482
5483"use strict";
5484// A (possibly faster) way to get the current timestamp as an integer.
5485/* harmony default export */ __webpack_exports__["a"] = (Date.now || function() {
5486 return new Date().getTime();
5487});
5488
5489
5490/***/ }),
5491/* 144 */
5492/***/ (function(module, __webpack_exports__, __webpack_require__) {
5493
5494"use strict";
5495/* harmony export (immutable) */ __webpack_exports__["a"] = negate;
5496// Returns a negated version of the passed-in predicate.
5497function negate(predicate) {
5498 return function() {
5499 return !predicate.apply(this, arguments);
5500 };
5501}
5502
5503
5504/***/ }),
5505/* 145 */
5506/***/ (function(module, __webpack_exports__, __webpack_require__) {
5507
5508"use strict";
5509/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(212);
5510
5511
5512// Returns the first index on an array-like that passes a truth test.
5513/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(1));
5514
5515
5516/***/ }),
5517/* 146 */
5518/***/ (function(module, __webpack_exports__, __webpack_require__) {
5519
5520"use strict";
5521/* harmony export (immutable) */ __webpack_exports__["a"] = pluck;
5522/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__map_js__ = __webpack_require__(68);
5523/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__property_js__ = __webpack_require__(142);
5524
5525
5526
5527// Convenience version of a common use case of `_.map`: fetching a property.
5528function pluck(obj, key) {
5529 return Object(__WEBPACK_IMPORTED_MODULE_0__map_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__property_js__["a" /* default */])(key));
5530}
5531
5532
5533/***/ }),
5534/* 147 */
5535/***/ (function(module, exports, __webpack_require__) {
5536
5537module.exports = __webpack_require__(233);
5538
5539/***/ }),
5540/* 148 */
5541/***/ (function(module, exports, __webpack_require__) {
5542
5543var wellKnownSymbol = __webpack_require__(9);
5544
5545exports.f = wellKnownSymbol;
5546
5547
5548/***/ }),
5549/* 149 */
5550/***/ (function(module, exports, __webpack_require__) {
5551
5552module.exports = __webpack_require__(243);
5553
5554/***/ }),
5555/* 150 */
5556/***/ (function(module, exports, __webpack_require__) {
5557
5558module.exports = __webpack_require__(501);
5559
5560/***/ }),
5561/* 151 */
5562/***/ (function(module, exports, __webpack_require__) {
5563
5564module.exports = __webpack_require__(552);
5565
5566/***/ }),
5567/* 152 */
5568/***/ (function(module, exports, __webpack_require__) {
5569
5570module.exports = __webpack_require__(570);
5571
5572/***/ }),
5573/* 153 */
5574/***/ (function(module, exports, __webpack_require__) {
5575
5576module.exports = __webpack_require__(574);
5577
5578/***/ }),
5579/* 154 */
5580/***/ (function(module, exports, __webpack_require__) {
5581
5582var defineBuiltIn = __webpack_require__(44);
5583
5584module.exports = function (target, src, options) {
5585 for (var key in src) {
5586 if (options && options.unsafe && target[key]) target[key] = src[key];
5587 else defineBuiltIn(target, key, src[key], options);
5588 } return target;
5589};
5590
5591
5592/***/ }),
5593/* 155 */
5594/***/ (function(module, exports, __webpack_require__) {
5595
5596"use strict";
5597
5598var $ = __webpack_require__(0);
5599var global = __webpack_require__(7);
5600var InternalMetadataModule = __webpack_require__(94);
5601var fails = __webpack_require__(2);
5602var createNonEnumerableProperty = __webpack_require__(37);
5603var iterate = __webpack_require__(42);
5604var anInstance = __webpack_require__(108);
5605var isCallable = __webpack_require__(8);
5606var isObject = __webpack_require__(11);
5607var setToStringTag = __webpack_require__(52);
5608var defineProperty = __webpack_require__(23).f;
5609var forEach = __webpack_require__(70).forEach;
5610var DESCRIPTORS = __webpack_require__(14);
5611var InternalStateModule = __webpack_require__(43);
5612
5613var setInternalState = InternalStateModule.set;
5614var internalStateGetterFor = InternalStateModule.getterFor;
5615
5616module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
5617 var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
5618 var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
5619 var ADDER = IS_MAP ? 'set' : 'add';
5620 var NativeConstructor = global[CONSTRUCTOR_NAME];
5621 var NativePrototype = NativeConstructor && NativeConstructor.prototype;
5622 var exported = {};
5623 var Constructor;
5624
5625 if (!DESCRIPTORS || !isCallable(NativeConstructor)
5626 || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); }))
5627 ) {
5628 // create collection constructor
5629 Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
5630 InternalMetadataModule.enable();
5631 } else {
5632 Constructor = wrapper(function (target, iterable) {
5633 setInternalState(anInstance(target, Prototype), {
5634 type: CONSTRUCTOR_NAME,
5635 collection: new NativeConstructor()
5636 });
5637 if (iterable != undefined) iterate(iterable, target[ADDER], { that: target, AS_ENTRIES: IS_MAP });
5638 });
5639
5640 var Prototype = Constructor.prototype;
5641
5642 var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
5643
5644 forEach(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) {
5645 var IS_ADDER = KEY == 'add' || KEY == 'set';
5646 if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) {
5647 createNonEnumerableProperty(Prototype, KEY, function (a, b) {
5648 var collection = getInternalState(this).collection;
5649 if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;
5650 var result = collection[KEY](a === 0 ? 0 : a, b);
5651 return IS_ADDER ? this : result;
5652 });
5653 }
5654 });
5655
5656 IS_WEAK || defineProperty(Prototype, 'size', {
5657 configurable: true,
5658 get: function () {
5659 return getInternalState(this).collection.size;
5660 }
5661 });
5662 }
5663
5664 setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true);
5665
5666 exported[CONSTRUCTOR_NAME] = Constructor;
5667 $({ global: true, forced: true }, exported);
5668
5669 if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
5670
5671 return Constructor;
5672};
5673
5674
5675/***/ }),
5676/* 156 */
5677/***/ (function(module, exports, __webpack_require__) {
5678
5679"use strict";
5680
5681
5682module.exports = __webpack_require__(589);
5683
5684/***/ }),
5685/* 157 */
5686/***/ (function(module, exports, __webpack_require__) {
5687
5688/* eslint-disable es-x/no-symbol -- required for testing */
5689var NATIVE_SYMBOL = __webpack_require__(64);
5690
5691module.exports = NATIVE_SYMBOL
5692 && !Symbol.sham
5693 && typeof Symbol.iterator == 'symbol';
5694
5695
5696/***/ }),
5697/* 158 */
5698/***/ (function(module, exports, __webpack_require__) {
5699
5700var DESCRIPTORS = __webpack_require__(14);
5701var fails = __webpack_require__(2);
5702var createElement = __webpack_require__(124);
5703
5704// Thanks to IE8 for its funny defineProperty
5705module.exports = !DESCRIPTORS && !fails(function () {
5706 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
5707 return Object.defineProperty(createElement('div'), 'a', {
5708 get: function () { return 7; }
5709 }).a != 7;
5710});
5711
5712
5713/***/ }),
5714/* 159 */
5715/***/ (function(module, exports, __webpack_require__) {
5716
5717var fails = __webpack_require__(2);
5718var isCallable = __webpack_require__(8);
5719
5720var replacement = /#|\.prototype\./;
5721
5722var isForced = function (feature, detection) {
5723 var value = data[normalize(feature)];
5724 return value == POLYFILL ? true
5725 : value == NATIVE ? false
5726 : isCallable(detection) ? fails(detection)
5727 : !!detection;
5728};
5729
5730var normalize = isForced.normalize = function (string) {
5731 return String(string).replace(replacement, '.').toLowerCase();
5732};
5733
5734var data = isForced.data = {};
5735var NATIVE = isForced.NATIVE = 'N';
5736var POLYFILL = isForced.POLYFILL = 'P';
5737
5738module.exports = isForced;
5739
5740
5741/***/ }),
5742/* 160 */
5743/***/ (function(module, exports, __webpack_require__) {
5744
5745var DESCRIPTORS = __webpack_require__(14);
5746var fails = __webpack_require__(2);
5747
5748// V8 ~ Chrome 36-
5749// https://bugs.chromium.org/p/v8/issues/detail?id=3334
5750module.exports = DESCRIPTORS && fails(function () {
5751 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
5752 return Object.defineProperty(function () { /* empty */ }, 'prototype', {
5753 value: 42,
5754 writable: false
5755 }).prototype != 42;
5756});
5757
5758
5759/***/ }),
5760/* 161 */
5761/***/ (function(module, exports, __webpack_require__) {
5762
5763var fails = __webpack_require__(2);
5764
5765module.exports = !fails(function () {
5766 function F() { /* empty */ }
5767 F.prototype.constructor = null;
5768 // eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing
5769 return Object.getPrototypeOf(new F()) !== F.prototype;
5770});
5771
5772
5773/***/ }),
5774/* 162 */
5775/***/ (function(module, exports, __webpack_require__) {
5776
5777var getBuiltIn = __webpack_require__(18);
5778var uncurryThis = __webpack_require__(4);
5779var getOwnPropertyNamesModule = __webpack_require__(103);
5780var getOwnPropertySymbolsModule = __webpack_require__(104);
5781var anObject = __webpack_require__(20);
5782
5783var concat = uncurryThis([].concat);
5784
5785// all object keys, includes non-enumerable and symbols
5786module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
5787 var keys = getOwnPropertyNamesModule.f(anObject(it));
5788 var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
5789 return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
5790};
5791
5792
5793/***/ }),
5794/* 163 */
5795/***/ (function(module, exports, __webpack_require__) {
5796
5797var uncurryThis = __webpack_require__(4);
5798var hasOwn = __webpack_require__(13);
5799var toIndexedObject = __webpack_require__(32);
5800var indexOf = __webpack_require__(164).indexOf;
5801var hiddenKeys = __webpack_require__(80);
5802
5803var push = uncurryThis([].push);
5804
5805module.exports = function (object, names) {
5806 var O = toIndexedObject(object);
5807 var i = 0;
5808 var result = [];
5809 var key;
5810 for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
5811 // Don't enum bug & hidden keys
5812 while (names.length > i) if (hasOwn(O, key = names[i++])) {
5813 ~indexOf(result, key) || push(result, key);
5814 }
5815 return result;
5816};
5817
5818
5819/***/ }),
5820/* 164 */
5821/***/ (function(module, exports, __webpack_require__) {
5822
5823var toIndexedObject = __webpack_require__(32);
5824var toAbsoluteIndex = __webpack_require__(125);
5825var lengthOfArrayLike = __webpack_require__(41);
5826
5827// `Array.prototype.{ indexOf, includes }` methods implementation
5828var createMethod = function (IS_INCLUDES) {
5829 return function ($this, el, fromIndex) {
5830 var O = toIndexedObject($this);
5831 var length = lengthOfArrayLike(O);
5832 var index = toAbsoluteIndex(fromIndex, length);
5833 var value;
5834 // Array#includes uses SameValueZero equality algorithm
5835 // eslint-disable-next-line no-self-compare -- NaN check
5836 if (IS_INCLUDES && el != el) while (length > index) {
5837 value = O[index++];
5838 // eslint-disable-next-line no-self-compare -- NaN check
5839 if (value != value) return true;
5840 // Array#indexOf ignores holes, Array#includes - not
5841 } else for (;length > index; index++) {
5842 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
5843 } return !IS_INCLUDES && -1;
5844 };
5845};
5846
5847module.exports = {
5848 // `Array.prototype.includes` method
5849 // https://tc39.es/ecma262/#sec-array.prototype.includes
5850 includes: createMethod(true),
5851 // `Array.prototype.indexOf` method
5852 // https://tc39.es/ecma262/#sec-array.prototype.indexof
5853 indexOf: createMethod(false)
5854};
5855
5856
5857/***/ }),
5858/* 165 */
5859/***/ (function(module, exports, __webpack_require__) {
5860
5861var getBuiltIn = __webpack_require__(18);
5862
5863module.exports = getBuiltIn('document', 'documentElement');
5864
5865
5866/***/ }),
5867/* 166 */
5868/***/ (function(module, exports, __webpack_require__) {
5869
5870var wellKnownSymbol = __webpack_require__(9);
5871var Iterators = __webpack_require__(50);
5872
5873var ITERATOR = wellKnownSymbol('iterator');
5874var ArrayPrototype = Array.prototype;
5875
5876// check on default Array iterator
5877module.exports = function (it) {
5878 return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
5879};
5880
5881
5882/***/ }),
5883/* 167 */
5884/***/ (function(module, exports, __webpack_require__) {
5885
5886var call = __webpack_require__(15);
5887var aCallable = __webpack_require__(31);
5888var anObject = __webpack_require__(20);
5889var tryToString = __webpack_require__(78);
5890var getIteratorMethod = __webpack_require__(106);
5891
5892var $TypeError = TypeError;
5893
5894module.exports = function (argument, usingIterator) {
5895 var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
5896 if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));
5897 throw $TypeError(tryToString(argument) + ' is not iterable');
5898};
5899
5900
5901/***/ }),
5902/* 168 */
5903/***/ (function(module, exports, __webpack_require__) {
5904
5905var call = __webpack_require__(15);
5906var anObject = __webpack_require__(20);
5907var getMethod = __webpack_require__(122);
5908
5909module.exports = function (iterator, kind, value) {
5910 var innerResult, innerError;
5911 anObject(iterator);
5912 try {
5913 innerResult = getMethod(iterator, 'return');
5914 if (!innerResult) {
5915 if (kind === 'throw') throw value;
5916 return value;
5917 }
5918 innerResult = call(innerResult, iterator);
5919 } catch (error) {
5920 innerError = true;
5921 innerResult = error;
5922 }
5923 if (kind === 'throw') throw value;
5924 if (innerError) throw innerResult;
5925 anObject(innerResult);
5926 return value;
5927};
5928
5929
5930/***/ }),
5931/* 169 */
5932/***/ (function(module, exports) {
5933
5934module.exports = function () { /* empty */ };
5935
5936
5937/***/ }),
5938/* 170 */
5939/***/ (function(module, exports, __webpack_require__) {
5940
5941var global = __webpack_require__(7);
5942var isCallable = __webpack_require__(8);
5943var inspectSource = __webpack_require__(130);
5944
5945var WeakMap = global.WeakMap;
5946
5947module.exports = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap));
5948
5949
5950/***/ }),
5951/* 171 */
5952/***/ (function(module, exports, __webpack_require__) {
5953
5954"use strict";
5955
5956var fails = __webpack_require__(2);
5957var isCallable = __webpack_require__(8);
5958var create = __webpack_require__(49);
5959var getPrototypeOf = __webpack_require__(100);
5960var defineBuiltIn = __webpack_require__(44);
5961var wellKnownSymbol = __webpack_require__(9);
5962var IS_PURE = __webpack_require__(33);
5963
5964var ITERATOR = wellKnownSymbol('iterator');
5965var BUGGY_SAFARI_ITERATORS = false;
5966
5967// `%IteratorPrototype%` object
5968// https://tc39.es/ecma262/#sec-%iteratorprototype%-object
5969var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
5970
5971/* eslint-disable es-x/no-array-prototype-keys -- safe */
5972if ([].keys) {
5973 arrayIterator = [].keys();
5974 // Safari 8 has buggy iterators w/o `next`
5975 if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
5976 else {
5977 PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
5978 if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
5979 }
5980}
5981
5982var NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function () {
5983 var test = {};
5984 // FF44- legacy iterators case
5985 return IteratorPrototype[ITERATOR].call(test) !== test;
5986});
5987
5988if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
5989else if (IS_PURE) IteratorPrototype = create(IteratorPrototype);
5990
5991// `%IteratorPrototype%[@@iterator]()` method
5992// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
5993if (!isCallable(IteratorPrototype[ITERATOR])) {
5994 defineBuiltIn(IteratorPrototype, ITERATOR, function () {
5995 return this;
5996 });
5997}
5998
5999module.exports = {
6000 IteratorPrototype: IteratorPrototype,
6001 BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
6002};
6003
6004
6005/***/ }),
6006/* 172 */
6007/***/ (function(module, exports, __webpack_require__) {
6008
6009"use strict";
6010
6011var getBuiltIn = __webpack_require__(18);
6012var definePropertyModule = __webpack_require__(23);
6013var wellKnownSymbol = __webpack_require__(9);
6014var DESCRIPTORS = __webpack_require__(14);
6015
6016var SPECIES = wellKnownSymbol('species');
6017
6018module.exports = function (CONSTRUCTOR_NAME) {
6019 var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
6020 var defineProperty = definePropertyModule.f;
6021
6022 if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
6023 defineProperty(Constructor, SPECIES, {
6024 configurable: true,
6025 get: function () { return this; }
6026 });
6027 }
6028};
6029
6030
6031/***/ }),
6032/* 173 */
6033/***/ (function(module, exports, __webpack_require__) {
6034
6035var anObject = __webpack_require__(20);
6036var aConstructor = __webpack_require__(174);
6037var wellKnownSymbol = __webpack_require__(9);
6038
6039var SPECIES = wellKnownSymbol('species');
6040
6041// `SpeciesConstructor` abstract operation
6042// https://tc39.es/ecma262/#sec-speciesconstructor
6043module.exports = function (O, defaultConstructor) {
6044 var C = anObject(O).constructor;
6045 var S;
6046 return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aConstructor(S);
6047};
6048
6049
6050/***/ }),
6051/* 174 */
6052/***/ (function(module, exports, __webpack_require__) {
6053
6054var isConstructor = __webpack_require__(109);
6055var tryToString = __webpack_require__(78);
6056
6057var $TypeError = TypeError;
6058
6059// `Assert: IsConstructor(argument) is true`
6060module.exports = function (argument) {
6061 if (isConstructor(argument)) return argument;
6062 throw $TypeError(tryToString(argument) + ' is not a constructor');
6063};
6064
6065
6066/***/ }),
6067/* 175 */
6068/***/ (function(module, exports, __webpack_require__) {
6069
6070var global = __webpack_require__(7);
6071var apply = __webpack_require__(75);
6072var bind = __webpack_require__(48);
6073var isCallable = __webpack_require__(8);
6074var hasOwn = __webpack_require__(13);
6075var fails = __webpack_require__(2);
6076var html = __webpack_require__(165);
6077var arraySlice = __webpack_require__(110);
6078var createElement = __webpack_require__(124);
6079var validateArgumentsLength = __webpack_require__(301);
6080var IS_IOS = __webpack_require__(176);
6081var IS_NODE = __webpack_require__(107);
6082
6083var set = global.setImmediate;
6084var clear = global.clearImmediate;
6085var process = global.process;
6086var Dispatch = global.Dispatch;
6087var Function = global.Function;
6088var MessageChannel = global.MessageChannel;
6089var String = global.String;
6090var counter = 0;
6091var queue = {};
6092var ONREADYSTATECHANGE = 'onreadystatechange';
6093var location, defer, channel, port;
6094
6095try {
6096 // Deno throws a ReferenceError on `location` access without `--location` flag
6097 location = global.location;
6098} catch (error) { /* empty */ }
6099
6100var run = function (id) {
6101 if (hasOwn(queue, id)) {
6102 var fn = queue[id];
6103 delete queue[id];
6104 fn();
6105 }
6106};
6107
6108var runner = function (id) {
6109 return function () {
6110 run(id);
6111 };
6112};
6113
6114var listener = function (event) {
6115 run(event.data);
6116};
6117
6118var post = function (id) {
6119 // old engines have not location.origin
6120 global.postMessage(String(id), location.protocol + '//' + location.host);
6121};
6122
6123// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
6124if (!set || !clear) {
6125 set = function setImmediate(handler) {
6126 validateArgumentsLength(arguments.length, 1);
6127 var fn = isCallable(handler) ? handler : Function(handler);
6128 var args = arraySlice(arguments, 1);
6129 queue[++counter] = function () {
6130 apply(fn, undefined, args);
6131 };
6132 defer(counter);
6133 return counter;
6134 };
6135 clear = function clearImmediate(id) {
6136 delete queue[id];
6137 };
6138 // Node.js 0.8-
6139 if (IS_NODE) {
6140 defer = function (id) {
6141 process.nextTick(runner(id));
6142 };
6143 // Sphere (JS game engine) Dispatch API
6144 } else if (Dispatch && Dispatch.now) {
6145 defer = function (id) {
6146 Dispatch.now(runner(id));
6147 };
6148 // Browsers with MessageChannel, includes WebWorkers
6149 // except iOS - https://github.com/zloirock/core-js/issues/624
6150 } else if (MessageChannel && !IS_IOS) {
6151 channel = new MessageChannel();
6152 port = channel.port2;
6153 channel.port1.onmessage = listener;
6154 defer = bind(port.postMessage, port);
6155 // Browsers with postMessage, skip WebWorkers
6156 // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
6157 } else if (
6158 global.addEventListener &&
6159 isCallable(global.postMessage) &&
6160 !global.importScripts &&
6161 location && location.protocol !== 'file:' &&
6162 !fails(post)
6163 ) {
6164 defer = post;
6165 global.addEventListener('message', listener, false);
6166 // IE8-
6167 } else if (ONREADYSTATECHANGE in createElement('script')) {
6168 defer = function (id) {
6169 html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
6170 html.removeChild(this);
6171 run(id);
6172 };
6173 };
6174 // Rest old browsers
6175 } else {
6176 defer = function (id) {
6177 setTimeout(runner(id), 0);
6178 };
6179 }
6180}
6181
6182module.exports = {
6183 set: set,
6184 clear: clear
6185};
6186
6187
6188/***/ }),
6189/* 176 */
6190/***/ (function(module, exports, __webpack_require__) {
6191
6192var userAgent = __webpack_require__(98);
6193
6194module.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent);
6195
6196
6197/***/ }),
6198/* 177 */
6199/***/ (function(module, exports, __webpack_require__) {
6200
6201var NativePromiseConstructor = __webpack_require__(65);
6202var checkCorrectnessOfIteration = __webpack_require__(178);
6203var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(83).CONSTRUCTOR;
6204
6205module.exports = FORCED_PROMISE_CONSTRUCTOR || !checkCorrectnessOfIteration(function (iterable) {
6206 NativePromiseConstructor.all(iterable).then(undefined, function () { /* empty */ });
6207});
6208
6209
6210/***/ }),
6211/* 178 */
6212/***/ (function(module, exports, __webpack_require__) {
6213
6214var wellKnownSymbol = __webpack_require__(9);
6215
6216var ITERATOR = wellKnownSymbol('iterator');
6217var SAFE_CLOSING = false;
6218
6219try {
6220 var called = 0;
6221 var iteratorWithReturn = {
6222 next: function () {
6223 return { done: !!called++ };
6224 },
6225 'return': function () {
6226 SAFE_CLOSING = true;
6227 }
6228 };
6229 iteratorWithReturn[ITERATOR] = function () {
6230 return this;
6231 };
6232 // eslint-disable-next-line es-x/no-array-from, no-throw-literal -- required for testing
6233 Array.from(iteratorWithReturn, function () { throw 2; });
6234} catch (error) { /* empty */ }
6235
6236module.exports = function (exec, SKIP_CLOSING) {
6237 if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
6238 var ITERATION_SUPPORT = false;
6239 try {
6240 var object = {};
6241 object[ITERATOR] = function () {
6242 return {
6243 next: function () {
6244 return { done: ITERATION_SUPPORT = true };
6245 }
6246 };
6247 };
6248 exec(object);
6249 } catch (error) { /* empty */ }
6250 return ITERATION_SUPPORT;
6251};
6252
6253
6254/***/ }),
6255/* 179 */
6256/***/ (function(module, exports, __webpack_require__) {
6257
6258var anObject = __webpack_require__(20);
6259var isObject = __webpack_require__(11);
6260var newPromiseCapability = __webpack_require__(54);
6261
6262module.exports = function (C, x) {
6263 anObject(C);
6264 if (isObject(x) && x.constructor === C) return x;
6265 var promiseCapability = newPromiseCapability.f(C);
6266 var resolve = promiseCapability.resolve;
6267 resolve(x);
6268 return promiseCapability.promise;
6269};
6270
6271
6272/***/ }),
6273/* 180 */
6274/***/ (function(module, __webpack_exports__, __webpack_require__) {
6275
6276"use strict";
6277/* harmony export (immutable) */ __webpack_exports__["a"] = isUndefined;
6278// Is a given variable undefined?
6279function isUndefined(obj) {
6280 return obj === void 0;
6281}
6282
6283
6284/***/ }),
6285/* 181 */
6286/***/ (function(module, __webpack_exports__, __webpack_require__) {
6287
6288"use strict";
6289/* harmony export (immutable) */ __webpack_exports__["a"] = isBoolean;
6290/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6291
6292
6293// Is a given value a boolean?
6294function isBoolean(obj) {
6295 return obj === true || obj === false || __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === '[object Boolean]';
6296}
6297
6298
6299/***/ }),
6300/* 182 */
6301/***/ (function(module, __webpack_exports__, __webpack_require__) {
6302
6303"use strict";
6304/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
6305
6306
6307/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Number'));
6308
6309
6310/***/ }),
6311/* 183 */
6312/***/ (function(module, __webpack_exports__, __webpack_require__) {
6313
6314"use strict";
6315/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
6316
6317
6318/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Symbol'));
6319
6320
6321/***/ }),
6322/* 184 */
6323/***/ (function(module, __webpack_exports__, __webpack_require__) {
6324
6325"use strict";
6326/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
6327
6328
6329/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('ArrayBuffer'));
6330
6331
6332/***/ }),
6333/* 185 */
6334/***/ (function(module, __webpack_exports__, __webpack_require__) {
6335
6336"use strict";
6337/* harmony export (immutable) */ __webpack_exports__["a"] = isNaN;
6338/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6339/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isNumber_js__ = __webpack_require__(182);
6340
6341
6342
6343// Is the given value `NaN`?
6344function isNaN(obj) {
6345 return Object(__WEBPACK_IMPORTED_MODULE_1__isNumber_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["g" /* _isNaN */])(obj);
6346}
6347
6348
6349/***/ }),
6350/* 186 */
6351/***/ (function(module, __webpack_exports__, __webpack_require__) {
6352
6353"use strict";
6354/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6355/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isDataView_js__ = __webpack_require__(134);
6356/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constant_js__ = __webpack_require__(187);
6357/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__ = __webpack_require__(326);
6358
6359
6360
6361
6362
6363// Is a given value a typed array?
6364var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
6365function isTypedArray(obj) {
6366 // `ArrayBuffer.isView` is the most future-proof, so use it when available.
6367 // Otherwise, fall back on the above regular expression.
6368 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)) :
6369 Object(__WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__["a" /* default */])(obj) && typedArrayPattern.test(__WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj));
6370}
6371
6372/* 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));
6373
6374
6375/***/ }),
6376/* 187 */
6377/***/ (function(module, __webpack_exports__, __webpack_require__) {
6378
6379"use strict";
6380/* harmony export (immutable) */ __webpack_exports__["a"] = constant;
6381// Predicate-generating function. Often useful outside of Underscore.
6382function constant(value) {
6383 return function() {
6384 return value;
6385 };
6386}
6387
6388
6389/***/ }),
6390/* 188 */
6391/***/ (function(module, __webpack_exports__, __webpack_require__) {
6392
6393"use strict";
6394/* harmony export (immutable) */ __webpack_exports__["a"] = createSizePropertyCheck;
6395/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6396
6397
6398// Common internal logic for `isArrayLike` and `isBufferLike`.
6399function createSizePropertyCheck(getSizeProperty) {
6400 return function(collection) {
6401 var sizeProperty = getSizeProperty(collection);
6402 return typeof sizeProperty == 'number' && sizeProperty >= 0 && sizeProperty <= __WEBPACK_IMPORTED_MODULE_0__setup_js__["b" /* MAX_ARRAY_INDEX */];
6403 }
6404}
6405
6406
6407/***/ }),
6408/* 189 */
6409/***/ (function(module, __webpack_exports__, __webpack_require__) {
6410
6411"use strict";
6412/* harmony export (immutable) */ __webpack_exports__["a"] = shallowProperty;
6413// Internal helper to generate a function to obtain property `key` from `obj`.
6414function shallowProperty(key) {
6415 return function(obj) {
6416 return obj == null ? void 0 : obj[key];
6417 };
6418}
6419
6420
6421/***/ }),
6422/* 190 */
6423/***/ (function(module, __webpack_exports__, __webpack_require__) {
6424
6425"use strict";
6426/* harmony export (immutable) */ __webpack_exports__["a"] = collectNonEnumProps;
6427/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6428/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
6429/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(45);
6430
6431
6432
6433
6434// Internal helper to create a simple lookup structure.
6435// `collectNonEnumProps` used to depend on `_.contains`, but this led to
6436// circular imports. `emulatedSet` is a one-off solution that only works for
6437// arrays of strings.
6438function emulatedSet(keys) {
6439 var hash = {};
6440 for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true;
6441 return {
6442 contains: function(key) { return hash[key]; },
6443 push: function(key) {
6444 hash[key] = true;
6445 return keys.push(key);
6446 }
6447 };
6448}
6449
6450// Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't
6451// be iterated by `for key in ...` and thus missed. Extends `keys` in place if
6452// needed.
6453function collectNonEnumProps(obj, keys) {
6454 keys = emulatedSet(keys);
6455 var nonEnumIdx = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */].length;
6456 var constructor = obj.constructor;
6457 var proto = Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(constructor) && constructor.prototype || __WEBPACK_IMPORTED_MODULE_0__setup_js__["c" /* ObjProto */];
6458
6459 // Constructor is a special case.
6460 var prop = 'constructor';
6461 if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, prop) && !keys.contains(prop)) keys.push(prop);
6462
6463 while (nonEnumIdx--) {
6464 prop = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */][nonEnumIdx];
6465 if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) {
6466 keys.push(prop);
6467 }
6468 }
6469}
6470
6471
6472/***/ }),
6473/* 191 */
6474/***/ (function(module, __webpack_exports__, __webpack_require__) {
6475
6476"use strict";
6477/* harmony export (immutable) */ __webpack_exports__["a"] = isMatch;
6478/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
6479
6480
6481// Returns whether an object has a given set of `key:value` pairs.
6482function isMatch(object, attrs) {
6483 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(attrs), length = _keys.length;
6484 if (object == null) return !length;
6485 var obj = Object(object);
6486 for (var i = 0; i < length; i++) {
6487 var key = _keys[i];
6488 if (attrs[key] !== obj[key] || !(key in obj)) return false;
6489 }
6490 return true;
6491}
6492
6493
6494/***/ }),
6495/* 192 */
6496/***/ (function(module, __webpack_exports__, __webpack_require__) {
6497
6498"use strict";
6499/* harmony export (immutable) */ __webpack_exports__["a"] = invert;
6500/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
6501
6502
6503// Invert the keys and values of an object. The values must be serializable.
6504function invert(obj) {
6505 var result = {};
6506 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
6507 for (var i = 0, length = _keys.length; i < length; i++) {
6508 result[obj[_keys[i]]] = _keys[i];
6509 }
6510 return result;
6511}
6512
6513
6514/***/ }),
6515/* 193 */
6516/***/ (function(module, __webpack_exports__, __webpack_require__) {
6517
6518"use strict";
6519/* harmony export (immutable) */ __webpack_exports__["a"] = functions;
6520/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(28);
6521
6522
6523// Return a sorted list of the function names available on the object.
6524function functions(obj) {
6525 var names = [];
6526 for (var key in obj) {
6527 if (Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(obj[key])) names.push(key);
6528 }
6529 return names.sort();
6530}
6531
6532
6533/***/ }),
6534/* 194 */
6535/***/ (function(module, __webpack_exports__, __webpack_require__) {
6536
6537"use strict";
6538/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(138);
6539/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(85);
6540
6541
6542
6543// Extend a given object with all the properties in passed-in object(s).
6544/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */]));
6545
6546
6547/***/ }),
6548/* 195 */
6549/***/ (function(module, __webpack_exports__, __webpack_require__) {
6550
6551"use strict";
6552/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(138);
6553/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(85);
6554
6555
6556
6557// Fill in a given object with default properties.
6558/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */], true));
6559
6560
6561/***/ }),
6562/* 196 */
6563/***/ (function(module, __webpack_exports__, __webpack_require__) {
6564
6565"use strict";
6566/* harmony export (immutable) */ __webpack_exports__["a"] = baseCreate;
6567/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(56);
6568/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
6569
6570
6571
6572// Create a naked function reference for surrogate-prototype-swapping.
6573function ctor() {
6574 return function(){};
6575}
6576
6577// An internal function for creating a new object that inherits from another.
6578function baseCreate(prototype) {
6579 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(prototype)) return {};
6580 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */])(prototype);
6581 var Ctor = ctor();
6582 Ctor.prototype = prototype;
6583 var result = new Ctor;
6584 Ctor.prototype = null;
6585 return result;
6586}
6587
6588
6589/***/ }),
6590/* 197 */
6591/***/ (function(module, __webpack_exports__, __webpack_require__) {
6592
6593"use strict";
6594/* harmony export (immutable) */ __webpack_exports__["a"] = clone;
6595/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(56);
6596/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(57);
6597/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__extend_js__ = __webpack_require__(194);
6598
6599
6600
6601
6602// Create a (shallow-cloned) duplicate of an object.
6603function clone(obj) {
6604 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return obj;
6605 return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(obj) ? obj.slice() : Object(__WEBPACK_IMPORTED_MODULE_2__extend_js__["a" /* default */])({}, obj);
6606}
6607
6608
6609/***/ }),
6610/* 198 */
6611/***/ (function(module, __webpack_exports__, __webpack_require__) {
6612
6613"use strict";
6614/* harmony export (immutable) */ __webpack_exports__["a"] = get;
6615/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__toPath_js__ = __webpack_require__(86);
6616/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__deepGet_js__ = __webpack_require__(140);
6617/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isUndefined_js__ = __webpack_require__(180);
6618
6619
6620
6621
6622// Get the value of the (deep) property on `path` from `object`.
6623// If any property in `path` does not exist or if the value is
6624// `undefined`, return `defaultValue` instead.
6625// The `path` is normalized through `_.toPath`.
6626function get(object, path, defaultValue) {
6627 var value = Object(__WEBPACK_IMPORTED_MODULE_1__deepGet_js__["a" /* default */])(object, Object(__WEBPACK_IMPORTED_MODULE_0__toPath_js__["a" /* default */])(path));
6628 return Object(__WEBPACK_IMPORTED_MODULE_2__isUndefined_js__["a" /* default */])(value) ? defaultValue : value;
6629}
6630
6631
6632/***/ }),
6633/* 199 */
6634/***/ (function(module, __webpack_exports__, __webpack_require__) {
6635
6636"use strict";
6637/* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
6638/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
6639/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(57);
6640
6641
6642
6643// Normalize a (deep) property `path` to array.
6644// Like `_.iteratee`, this function can be customized.
6645function toPath(path) {
6646 return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(path) ? path : [path];
6647}
6648__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath = toPath;
6649
6650
6651/***/ }),
6652/* 200 */
6653/***/ (function(module, __webpack_exports__, __webpack_require__) {
6654
6655"use strict";
6656/* harmony export (immutable) */ __webpack_exports__["a"] = baseIteratee;
6657/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__identity_js__ = __webpack_require__(141);
6658/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
6659/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(56);
6660/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArray_js__ = __webpack_require__(57);
6661/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__matcher_js__ = __webpack_require__(111);
6662/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__property_js__ = __webpack_require__(142);
6663/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__ = __webpack_require__(87);
6664
6665
6666
6667
6668
6669
6670
6671
6672// An internal function to generate callbacks that can be applied to each
6673// element in a collection, returning the desired result — either `_.identity`,
6674// an arbitrary callback, a property matcher, or a property accessor.
6675function baseIteratee(value, context, argCount) {
6676 if (value == null) return __WEBPACK_IMPORTED_MODULE_0__identity_js__["a" /* default */];
6677 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(value)) return Object(__WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__["a" /* default */])(value, context, argCount);
6678 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);
6679 return Object(__WEBPACK_IMPORTED_MODULE_5__property_js__["a" /* default */])(value);
6680}
6681
6682
6683/***/ }),
6684/* 201 */
6685/***/ (function(module, __webpack_exports__, __webpack_require__) {
6686
6687"use strict";
6688/* harmony export (immutable) */ __webpack_exports__["a"] = iteratee;
6689/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
6690/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(200);
6691
6692
6693
6694// External wrapper for our callback generator. Users may customize
6695// `_.iteratee` if they want additional predicate/iteratee shorthand styles.
6696// This abstraction hides the internal-only `argCount` argument.
6697function iteratee(value, context) {
6698 return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, Infinity);
6699}
6700__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].iteratee = iteratee;
6701
6702
6703/***/ }),
6704/* 202 */
6705/***/ (function(module, __webpack_exports__, __webpack_require__) {
6706
6707"use strict";
6708/* harmony export (immutable) */ __webpack_exports__["a"] = noop;
6709// Predicate-generating function. Often useful outside of Underscore.
6710function noop(){}
6711
6712
6713/***/ }),
6714/* 203 */
6715/***/ (function(module, __webpack_exports__, __webpack_require__) {
6716
6717"use strict";
6718/* harmony export (immutable) */ __webpack_exports__["a"] = random;
6719// Return a random integer between `min` and `max` (inclusive).
6720function random(min, max) {
6721 if (max == null) {
6722 max = min;
6723 min = 0;
6724 }
6725 return min + Math.floor(Math.random() * (max - min + 1));
6726}
6727
6728
6729/***/ }),
6730/* 204 */
6731/***/ (function(module, __webpack_exports__, __webpack_require__) {
6732
6733"use strict";
6734/* harmony export (immutable) */ __webpack_exports__["a"] = createEscaper;
6735/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
6736
6737
6738// Internal helper to generate functions for escaping and unescaping strings
6739// to/from HTML interpolation.
6740function createEscaper(map) {
6741 var escaper = function(match) {
6742 return map[match];
6743 };
6744 // Regexes for identifying a key that needs to be escaped.
6745 var source = '(?:' + Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(map).join('|') + ')';
6746 var testRegexp = RegExp(source);
6747 var replaceRegexp = RegExp(source, 'g');
6748 return function(string) {
6749 string = string == null ? '' : '' + string;
6750 return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
6751 };
6752}
6753
6754
6755/***/ }),
6756/* 205 */
6757/***/ (function(module, __webpack_exports__, __webpack_require__) {
6758
6759"use strict";
6760// Internal list of HTML entities for escaping.
6761/* harmony default export */ __webpack_exports__["a"] = ({
6762 '&': '&amp;',
6763 '<': '&lt;',
6764 '>': '&gt;',
6765 '"': '&quot;',
6766 "'": '&#x27;',
6767 '`': '&#x60;'
6768});
6769
6770
6771/***/ }),
6772/* 206 */
6773/***/ (function(module, __webpack_exports__, __webpack_require__) {
6774
6775"use strict";
6776/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
6777
6778
6779// By default, Underscore uses ERB-style template delimiters. Change the
6780// following template settings to use alternative delimiters.
6781/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].templateSettings = {
6782 evaluate: /<%([\s\S]+?)%>/g,
6783 interpolate: /<%=([\s\S]+?)%>/g,
6784 escape: /<%-([\s\S]+?)%>/g
6785});
6786
6787
6788/***/ }),
6789/* 207 */
6790/***/ (function(module, __webpack_exports__, __webpack_require__) {
6791
6792"use strict";
6793/* harmony export (immutable) */ __webpack_exports__["a"] = executeBound;
6794/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(196);
6795/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isObject_js__ = __webpack_require__(56);
6796
6797
6798
6799// Internal function to execute `sourceFunc` bound to `context` with optional
6800// `args`. Determines whether to execute a function as a constructor or as a
6801// normal function.
6802function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
6803 if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
6804 var self = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(sourceFunc.prototype);
6805 var result = sourceFunc.apply(self, args);
6806 if (Object(__WEBPACK_IMPORTED_MODULE_1__isObject_js__["a" /* default */])(result)) return result;
6807 return self;
6808}
6809
6810
6811/***/ }),
6812/* 208 */
6813/***/ (function(module, __webpack_exports__, __webpack_require__) {
6814
6815"use strict";
6816/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
6817/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
6818/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__executeBound_js__ = __webpack_require__(207);
6819
6820
6821
6822
6823// Create a function bound to a given object (assigning `this`, and arguments,
6824// optionally).
6825/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, context, args) {
6826 if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(func)) throw new TypeError('Bind must be called on a function');
6827 var bound = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(callArgs) {
6828 return Object(__WEBPACK_IMPORTED_MODULE_2__executeBound_js__["a" /* default */])(func, bound, context, this, args.concat(callArgs));
6829 });
6830 return bound;
6831}));
6832
6833
6834/***/ }),
6835/* 209 */
6836/***/ (function(module, __webpack_exports__, __webpack_require__) {
6837
6838"use strict";
6839/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
6840
6841
6842// Delays a function for the given number of milliseconds, and then calls
6843// it with the arguments supplied.
6844/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, wait, args) {
6845 return setTimeout(function() {
6846 return func.apply(null, args);
6847 }, wait);
6848}));
6849
6850
6851/***/ }),
6852/* 210 */
6853/***/ (function(module, __webpack_exports__, __webpack_require__) {
6854
6855"use strict";
6856/* harmony export (immutable) */ __webpack_exports__["a"] = before;
6857// Returns a function that will only be executed up to (but not including) the
6858// Nth call.
6859function before(times, func) {
6860 var memo;
6861 return function() {
6862 if (--times > 0) {
6863 memo = func.apply(this, arguments);
6864 }
6865 if (times <= 1) func = null;
6866 return memo;
6867 };
6868}
6869
6870
6871/***/ }),
6872/* 211 */
6873/***/ (function(module, __webpack_exports__, __webpack_require__) {
6874
6875"use strict";
6876/* harmony export (immutable) */ __webpack_exports__["a"] = findKey;
6877/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
6878/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
6879
6880
6881
6882// Returns the first key on an object that passes a truth test.
6883function findKey(obj, predicate, context) {
6884 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
6885 var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj), key;
6886 for (var i = 0, length = _keys.length; i < length; i++) {
6887 key = _keys[i];
6888 if (predicate(obj[key], key, obj)) return key;
6889 }
6890}
6891
6892
6893/***/ }),
6894/* 212 */
6895/***/ (function(module, __webpack_exports__, __webpack_require__) {
6896
6897"use strict";
6898/* harmony export (immutable) */ __webpack_exports__["a"] = createPredicateIndexFinder;
6899/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
6900/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29);
6901
6902
6903
6904// Internal function to generate `_.findIndex` and `_.findLastIndex`.
6905function createPredicateIndexFinder(dir) {
6906 return function(array, predicate, context) {
6907 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
6908 var length = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
6909 var index = dir > 0 ? 0 : length - 1;
6910 for (; index >= 0 && index < length; index += dir) {
6911 if (predicate(array[index], index, array)) return index;
6912 }
6913 return -1;
6914 };
6915}
6916
6917
6918/***/ }),
6919/* 213 */
6920/***/ (function(module, __webpack_exports__, __webpack_require__) {
6921
6922"use strict";
6923/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(212);
6924
6925
6926// Returns the last index on an array-like that passes a truth test.
6927/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(-1));
6928
6929
6930/***/ }),
6931/* 214 */
6932/***/ (function(module, __webpack_exports__, __webpack_require__) {
6933
6934"use strict";
6935/* harmony export (immutable) */ __webpack_exports__["a"] = sortedIndex;
6936/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
6937/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29);
6938
6939
6940
6941// Use a comparator function to figure out the smallest index at which
6942// an object should be inserted so as to maintain order. Uses binary search.
6943function sortedIndex(array, obj, iteratee, context) {
6944 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context, 1);
6945 var value = iteratee(obj);
6946 var low = 0, high = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
6947 while (low < high) {
6948 var mid = Math.floor((low + high) / 2);
6949 if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
6950 }
6951 return low;
6952}
6953
6954
6955/***/ }),
6956/* 215 */
6957/***/ (function(module, __webpack_exports__, __webpack_require__) {
6958
6959"use strict";
6960/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sortedIndex_js__ = __webpack_require__(214);
6961/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(145);
6962/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__createIndexFinder_js__ = __webpack_require__(216);
6963
6964
6965
6966
6967// Return the position of the first occurrence of an item in an array,
6968// or -1 if the item is not included in the array.
6969// If the array is large and already in sort order, pass `true`
6970// for **isSorted** to use binary search.
6971/* 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 */]));
6972
6973
6974/***/ }),
6975/* 216 */
6976/***/ (function(module, __webpack_exports__, __webpack_require__) {
6977
6978"use strict";
6979/* harmony export (immutable) */ __webpack_exports__["a"] = createIndexFinder;
6980/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
6981/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
6982/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isNaN_js__ = __webpack_require__(185);
6983
6984
6985
6986
6987// Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions.
6988function createIndexFinder(dir, predicateFind, sortedIndex) {
6989 return function(array, item, idx) {
6990 var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array);
6991 if (typeof idx == 'number') {
6992 if (dir > 0) {
6993 i = idx >= 0 ? idx : Math.max(idx + length, i);
6994 } else {
6995 length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
6996 }
6997 } else if (sortedIndex && idx && length) {
6998 idx = sortedIndex(array, item);
6999 return array[idx] === item ? idx : -1;
7000 }
7001 if (item !== item) {
7002 idx = predicateFind(__WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(array, i, length), __WEBPACK_IMPORTED_MODULE_2__isNaN_js__["a" /* default */]);
7003 return idx >= 0 ? idx + i : -1;
7004 }
7005 for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
7006 if (array[idx] === item) return idx;
7007 }
7008 return -1;
7009 };
7010}
7011
7012
7013/***/ }),
7014/* 217 */
7015/***/ (function(module, __webpack_exports__, __webpack_require__) {
7016
7017"use strict";
7018/* harmony export (immutable) */ __webpack_exports__["a"] = find;
7019/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
7020/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(145);
7021/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__findKey_js__ = __webpack_require__(211);
7022
7023
7024
7025
7026// Return the first value which passes a truth test.
7027function find(obj, predicate, context) {
7028 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 */];
7029 var key = keyFinder(obj, predicate, context);
7030 if (key !== void 0 && key !== -1) return obj[key];
7031}
7032
7033
7034/***/ }),
7035/* 218 */
7036/***/ (function(module, __webpack_exports__, __webpack_require__) {
7037
7038"use strict";
7039/* harmony export (immutable) */ __webpack_exports__["a"] = createReduce;
7040/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
7041/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
7042/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(87);
7043
7044
7045
7046
7047// Internal helper to create a reducing function, iterating left or right.
7048function createReduce(dir) {
7049 // Wrap code that reassigns argument variables in a separate function than
7050 // the one that accesses `arguments.length` to avoid a perf hit. (#1991)
7051 var reducer = function(obj, iteratee, memo, initial) {
7052 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
7053 length = (_keys || obj).length,
7054 index = dir > 0 ? 0 : length - 1;
7055 if (!initial) {
7056 memo = obj[_keys ? _keys[index] : index];
7057 index += dir;
7058 }
7059 for (; index >= 0 && index < length; index += dir) {
7060 var currentKey = _keys ? _keys[index] : index;
7061 memo = iteratee(memo, obj[currentKey], currentKey, obj);
7062 }
7063 return memo;
7064 };
7065
7066 return function(obj, iteratee, memo, context) {
7067 var initial = arguments.length >= 3;
7068 return reducer(obj, Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, context, 4), memo, initial);
7069 };
7070}
7071
7072
7073/***/ }),
7074/* 219 */
7075/***/ (function(module, __webpack_exports__, __webpack_require__) {
7076
7077"use strict";
7078/* harmony export (immutable) */ __webpack_exports__["a"] = max;
7079/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
7080/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(66);
7081/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(21);
7082/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(58);
7083
7084
7085
7086
7087
7088// Return the maximum element (or element-based computation).
7089function max(obj, iteratee, context) {
7090 var result = -Infinity, lastComputed = -Infinity,
7091 value, computed;
7092 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
7093 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
7094 for (var i = 0, length = obj.length; i < length; i++) {
7095 value = obj[i];
7096 if (value != null && value > result) {
7097 result = value;
7098 }
7099 }
7100 } else {
7101 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
7102 Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
7103 computed = iteratee(v, index, list);
7104 if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
7105 result = v;
7106 lastComputed = computed;
7107 }
7108 });
7109 }
7110 return result;
7111}
7112
7113
7114/***/ }),
7115/* 220 */
7116/***/ (function(module, __webpack_exports__, __webpack_require__) {
7117
7118"use strict";
7119/* harmony export (immutable) */ __webpack_exports__["a"] = sample;
7120/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
7121/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__clone_js__ = __webpack_require__(197);
7122/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__values_js__ = __webpack_require__(66);
7123/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__getLength_js__ = __webpack_require__(29);
7124/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__random_js__ = __webpack_require__(203);
7125
7126
7127
7128
7129
7130
7131// Sample **n** random values from a collection using the modern version of the
7132// [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
7133// If **n** is not specified, returns a single random element.
7134// The internal `guard` argument allows it to work with `_.map`.
7135function sample(obj, n, guard) {
7136 if (n == null || guard) {
7137 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_2__values_js__["a" /* default */])(obj);
7138 return obj[Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(obj.length - 1)];
7139 }
7140 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);
7141 var length = Object(__WEBPACK_IMPORTED_MODULE_3__getLength_js__["a" /* default */])(sample);
7142 n = Math.max(Math.min(n, length), 0);
7143 var last = length - 1;
7144 for (var index = 0; index < n; index++) {
7145 var rand = Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(index, last);
7146 var temp = sample[index];
7147 sample[index] = sample[rand];
7148 sample[rand] = temp;
7149 }
7150 return sample.slice(0, n);
7151}
7152
7153
7154/***/ }),
7155/* 221 */
7156/***/ (function(module, __webpack_exports__, __webpack_require__) {
7157
7158"use strict";
7159/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
7160/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
7161/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(87);
7162/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__allKeys_js__ = __webpack_require__(85);
7163/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__ = __webpack_require__(375);
7164/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__flatten_js__ = __webpack_require__(67);
7165
7166
7167
7168
7169
7170
7171
7172// Return a copy of the object only containing the allowed properties.
7173/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
7174 var result = {}, iteratee = keys[0];
7175 if (obj == null) return result;
7176 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
7177 if (keys.length > 1) iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, keys[1]);
7178 keys = Object(__WEBPACK_IMPORTED_MODULE_3__allKeys_js__["a" /* default */])(obj);
7179 } else {
7180 iteratee = __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__["a" /* default */];
7181 keys = Object(__WEBPACK_IMPORTED_MODULE_5__flatten_js__["a" /* default */])(keys, false, false);
7182 obj = Object(obj);
7183 }
7184 for (var i = 0, length = keys.length; i < length; i++) {
7185 var key = keys[i];
7186 var value = obj[key];
7187 if (iteratee(value, key, obj)) result[key] = value;
7188 }
7189 return result;
7190}));
7191
7192
7193/***/ }),
7194/* 222 */
7195/***/ (function(module, __webpack_exports__, __webpack_require__) {
7196
7197"use strict";
7198/* harmony export (immutable) */ __webpack_exports__["a"] = initial;
7199/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
7200
7201
7202// Returns everything but the last entry of the array. Especially useful on
7203// the arguments object. Passing **n** will return all the values in
7204// the array, excluding the last N.
7205function initial(array, n, guard) {
7206 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
7207}
7208
7209
7210/***/ }),
7211/* 223 */
7212/***/ (function(module, __webpack_exports__, __webpack_require__) {
7213
7214"use strict";
7215/* harmony export (immutable) */ __webpack_exports__["a"] = rest;
7216/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
7217
7218
7219// Returns everything but the first entry of the `array`. Especially useful on
7220// the `arguments` object. Passing an **n** will return the rest N values in the
7221// `array`.
7222function rest(array, n, guard) {
7223 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, n == null || guard ? 1 : n);
7224}
7225
7226
7227/***/ }),
7228/* 224 */
7229/***/ (function(module, __webpack_exports__, __webpack_require__) {
7230
7231"use strict";
7232/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
7233/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(67);
7234/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__filter_js__ = __webpack_require__(88);
7235/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(89);
7236
7237
7238
7239
7240
7241// Take the difference between one array and a number of other arrays.
7242// Only the elements present in just the first array will remain.
7243/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, rest) {
7244 rest = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(rest, true, true);
7245 return Object(__WEBPACK_IMPORTED_MODULE_2__filter_js__["a" /* default */])(array, function(value){
7246 return !Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(rest, value);
7247 });
7248}));
7249
7250
7251/***/ }),
7252/* 225 */
7253/***/ (function(module, __webpack_exports__, __webpack_require__) {
7254
7255"use strict";
7256/* harmony export (immutable) */ __webpack_exports__["a"] = uniq;
7257/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isBoolean_js__ = __webpack_require__(181);
7258/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__cb_js__ = __webpack_require__(21);
7259/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getLength_js__ = __webpack_require__(29);
7260/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(89);
7261
7262
7263
7264
7265
7266// Produce a duplicate-free version of the array. If the array has already
7267// been sorted, you have the option of using a faster algorithm.
7268// The faster algorithm will not work with an iteratee if the iteratee
7269// is not a one-to-one function, so providing an iteratee will disable
7270// the faster algorithm.
7271function uniq(array, isSorted, iteratee, context) {
7272 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isBoolean_js__["a" /* default */])(isSorted)) {
7273 context = iteratee;
7274 iteratee = isSorted;
7275 isSorted = false;
7276 }
7277 if (iteratee != null) iteratee = Object(__WEBPACK_IMPORTED_MODULE_1__cb_js__["a" /* default */])(iteratee, context);
7278 var result = [];
7279 var seen = [];
7280 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_2__getLength_js__["a" /* default */])(array); i < length; i++) {
7281 var value = array[i],
7282 computed = iteratee ? iteratee(value, i, array) : value;
7283 if (isSorted && !iteratee) {
7284 if (!i || seen !== computed) result.push(value);
7285 seen = computed;
7286 } else if (iteratee) {
7287 if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(seen, computed)) {
7288 seen.push(computed);
7289 result.push(value);
7290 }
7291 } else if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(result, value)) {
7292 result.push(value);
7293 }
7294 }
7295 return result;
7296}
7297
7298
7299/***/ }),
7300/* 226 */
7301/***/ (function(module, __webpack_exports__, __webpack_require__) {
7302
7303"use strict";
7304/* harmony export (immutable) */ __webpack_exports__["a"] = unzip;
7305/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__max_js__ = __webpack_require__(219);
7306/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29);
7307/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__pluck_js__ = __webpack_require__(146);
7308
7309
7310
7311
7312// Complement of zip. Unzip accepts an array of arrays and groups
7313// each array's elements on shared indices.
7314function unzip(array) {
7315 var length = array && Object(__WEBPACK_IMPORTED_MODULE_0__max_js__["a" /* default */])(array, __WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */]).length || 0;
7316 var result = Array(length);
7317
7318 for (var index = 0; index < length; index++) {
7319 result[index] = Object(__WEBPACK_IMPORTED_MODULE_2__pluck_js__["a" /* default */])(array, index);
7320 }
7321 return result;
7322}
7323
7324
7325/***/ }),
7326/* 227 */
7327/***/ (function(module, __webpack_exports__, __webpack_require__) {
7328
7329"use strict";
7330/* harmony export (immutable) */ __webpack_exports__["a"] = chainResult;
7331/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
7332
7333
7334// Helper function to continue chaining intermediate results.
7335function chainResult(instance, obj) {
7336 return instance._chain ? Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj).chain() : obj;
7337}
7338
7339
7340/***/ }),
7341/* 228 */
7342/***/ (function(module, exports, __webpack_require__) {
7343
7344"use strict";
7345
7346var $ = __webpack_require__(0);
7347var fails = __webpack_require__(2);
7348var isArray = __webpack_require__(90);
7349var isObject = __webpack_require__(11);
7350var toObject = __webpack_require__(34);
7351var lengthOfArrayLike = __webpack_require__(41);
7352var doesNotExceedSafeInteger = __webpack_require__(393);
7353var createProperty = __webpack_require__(91);
7354var arraySpeciesCreate = __webpack_require__(229);
7355var arrayMethodHasSpeciesSupport = __webpack_require__(114);
7356var wellKnownSymbol = __webpack_require__(9);
7357var V8_VERSION = __webpack_require__(77);
7358
7359var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
7360
7361// We can't use this feature detection in V8 since it causes
7362// deoptimization and serious performance degradation
7363// https://github.com/zloirock/core-js/issues/679
7364var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
7365 var array = [];
7366 array[IS_CONCAT_SPREADABLE] = false;
7367 return array.concat()[0] !== array;
7368});
7369
7370var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
7371
7372var isConcatSpreadable = function (O) {
7373 if (!isObject(O)) return false;
7374 var spreadable = O[IS_CONCAT_SPREADABLE];
7375 return spreadable !== undefined ? !!spreadable : isArray(O);
7376};
7377
7378var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
7379
7380// `Array.prototype.concat` method
7381// https://tc39.es/ecma262/#sec-array.prototype.concat
7382// with adding support of @@isConcatSpreadable and @@species
7383$({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
7384 // eslint-disable-next-line no-unused-vars -- required for `.length`
7385 concat: function concat(arg) {
7386 var O = toObject(this);
7387 var A = arraySpeciesCreate(O, 0);
7388 var n = 0;
7389 var i, k, length, len, E;
7390 for (i = -1, length = arguments.length; i < length; i++) {
7391 E = i === -1 ? O : arguments[i];
7392 if (isConcatSpreadable(E)) {
7393 len = lengthOfArrayLike(E);
7394 doesNotExceedSafeInteger(n + len);
7395 for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
7396 } else {
7397 doesNotExceedSafeInteger(n + 1);
7398 createProperty(A, n++, E);
7399 }
7400 }
7401 A.length = n;
7402 return A;
7403 }
7404});
7405
7406
7407/***/ }),
7408/* 229 */
7409/***/ (function(module, exports, __webpack_require__) {
7410
7411var arraySpeciesConstructor = __webpack_require__(394);
7412
7413// `ArraySpeciesCreate` abstract operation
7414// https://tc39.es/ecma262/#sec-arrayspeciescreate
7415module.exports = function (originalArray, length) {
7416 return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
7417};
7418
7419
7420/***/ }),
7421/* 230 */
7422/***/ (function(module, exports, __webpack_require__) {
7423
7424var $ = __webpack_require__(0);
7425var getBuiltIn = __webpack_require__(18);
7426var apply = __webpack_require__(75);
7427var call = __webpack_require__(15);
7428var uncurryThis = __webpack_require__(4);
7429var fails = __webpack_require__(2);
7430var isArray = __webpack_require__(90);
7431var isCallable = __webpack_require__(8);
7432var isObject = __webpack_require__(11);
7433var isSymbol = __webpack_require__(97);
7434var arraySlice = __webpack_require__(110);
7435var NATIVE_SYMBOL = __webpack_require__(64);
7436
7437var $stringify = getBuiltIn('JSON', 'stringify');
7438var exec = uncurryThis(/./.exec);
7439var charAt = uncurryThis(''.charAt);
7440var charCodeAt = uncurryThis(''.charCodeAt);
7441var replace = uncurryThis(''.replace);
7442var numberToString = uncurryThis(1.0.toString);
7443
7444var tester = /[\uD800-\uDFFF]/g;
7445var low = /^[\uD800-\uDBFF]$/;
7446var hi = /^[\uDC00-\uDFFF]$/;
7447
7448var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails(function () {
7449 var symbol = getBuiltIn('Symbol')();
7450 // MS Edge converts symbol values to JSON as {}
7451 return $stringify([symbol]) != '[null]'
7452 // WebKit converts symbol values to JSON as null
7453 || $stringify({ a: symbol }) != '{}'
7454 // V8 throws on boxed symbols
7455 || $stringify(Object(symbol)) != '{}';
7456});
7457
7458// https://github.com/tc39/proposal-well-formed-stringify
7459var ILL_FORMED_UNICODE = fails(function () {
7460 return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"'
7461 || $stringify('\uDEAD') !== '"\\udead"';
7462});
7463
7464var stringifyWithSymbolsFix = function (it, replacer) {
7465 var args = arraySlice(arguments);
7466 var $replacer = replacer;
7467 if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
7468 if (!isArray(replacer)) replacer = function (key, value) {
7469 if (isCallable($replacer)) value = call($replacer, this, key, value);
7470 if (!isSymbol(value)) return value;
7471 };
7472 args[1] = replacer;
7473 return apply($stringify, null, args);
7474};
7475
7476var fixIllFormed = function (match, offset, string) {
7477 var prev = charAt(string, offset - 1);
7478 var next = charAt(string, offset + 1);
7479 if ((exec(low, match) && !exec(hi, next)) || (exec(hi, match) && !exec(low, prev))) {
7480 return '\\u' + numberToString(charCodeAt(match, 0), 16);
7481 } return match;
7482};
7483
7484if ($stringify) {
7485 // `JSON.stringify` method
7486 // https://tc39.es/ecma262/#sec-json.stringify
7487 $({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {
7488 // eslint-disable-next-line no-unused-vars -- required for `.length`
7489 stringify: function stringify(it, replacer, space) {
7490 var args = arraySlice(arguments);
7491 var result = apply(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args);
7492 return ILL_FORMED_UNICODE && typeof result == 'string' ? replace(result, tester, fixIllFormed) : result;
7493 }
7494 });
7495}
7496
7497
7498/***/ }),
7499/* 231 */
7500/***/ (function(module, exports, __webpack_require__) {
7501
7502"use strict";
7503
7504var fails = __webpack_require__(2);
7505
7506module.exports = function (METHOD_NAME, argument) {
7507 var method = [][METHOD_NAME];
7508 return !!method && fails(function () {
7509 // eslint-disable-next-line no-useless-call -- required for testing
7510 method.call(null, argument || function () { return 1; }, 1);
7511 });
7512};
7513
7514
7515/***/ }),
7516/* 232 */
7517/***/ (function(module, exports, __webpack_require__) {
7518
7519var rng = __webpack_require__(411);
7520var bytesToUuid = __webpack_require__(412);
7521
7522function v4(options, buf, offset) {
7523 var i = buf && offset || 0;
7524
7525 if (typeof(options) == 'string') {
7526 buf = options === 'binary' ? new Array(16) : null;
7527 options = null;
7528 }
7529 options = options || {};
7530
7531 var rnds = options.random || (options.rng || rng)();
7532
7533 // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
7534 rnds[6] = (rnds[6] & 0x0f) | 0x40;
7535 rnds[8] = (rnds[8] & 0x3f) | 0x80;
7536
7537 // Copy bytes to buffer, if provided
7538 if (buf) {
7539 for (var ii = 0; ii < 16; ++ii) {
7540 buf[i + ii] = rnds[ii];
7541 }
7542 }
7543
7544 return buf || bytesToUuid(rnds);
7545}
7546
7547module.exports = v4;
7548
7549
7550/***/ }),
7551/* 233 */
7552/***/ (function(module, exports, __webpack_require__) {
7553
7554var parent = __webpack_require__(415);
7555
7556module.exports = parent;
7557
7558
7559/***/ }),
7560/* 234 */
7561/***/ (function(module, exports, __webpack_require__) {
7562
7563"use strict";
7564
7565
7566module.exports = '4.13.4';
7567
7568/***/ }),
7569/* 235 */
7570/***/ (function(module, exports, __webpack_require__) {
7571
7572"use strict";
7573
7574
7575var has = Object.prototype.hasOwnProperty
7576 , prefix = '~';
7577
7578/**
7579 * Constructor to create a storage for our `EE` objects.
7580 * An `Events` instance is a plain object whose properties are event names.
7581 *
7582 * @constructor
7583 * @api private
7584 */
7585function Events() {}
7586
7587//
7588// We try to not inherit from `Object.prototype`. In some engines creating an
7589// instance in this way is faster than calling `Object.create(null)` directly.
7590// If `Object.create(null)` is not supported we prefix the event names with a
7591// character to make sure that the built-in object properties are not
7592// overridden or used as an attack vector.
7593//
7594if (Object.create) {
7595 Events.prototype = Object.create(null);
7596
7597 //
7598 // This hack is needed because the `__proto__` property is still inherited in
7599 // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
7600 //
7601 if (!new Events().__proto__) prefix = false;
7602}
7603
7604/**
7605 * Representation of a single event listener.
7606 *
7607 * @param {Function} fn The listener function.
7608 * @param {Mixed} context The context to invoke the listener with.
7609 * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
7610 * @constructor
7611 * @api private
7612 */
7613function EE(fn, context, once) {
7614 this.fn = fn;
7615 this.context = context;
7616 this.once = once || false;
7617}
7618
7619/**
7620 * Minimal `EventEmitter` interface that is molded against the Node.js
7621 * `EventEmitter` interface.
7622 *
7623 * @constructor
7624 * @api public
7625 */
7626function EventEmitter() {
7627 this._events = new Events();
7628 this._eventsCount = 0;
7629}
7630
7631/**
7632 * Return an array listing the events for which the emitter has registered
7633 * listeners.
7634 *
7635 * @returns {Array}
7636 * @api public
7637 */
7638EventEmitter.prototype.eventNames = function eventNames() {
7639 var names = []
7640 , events
7641 , name;
7642
7643 if (this._eventsCount === 0) return names;
7644
7645 for (name in (events = this._events)) {
7646 if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
7647 }
7648
7649 if (Object.getOwnPropertySymbols) {
7650 return names.concat(Object.getOwnPropertySymbols(events));
7651 }
7652
7653 return names;
7654};
7655
7656/**
7657 * Return the listeners registered for a given event.
7658 *
7659 * @param {String|Symbol} event The event name.
7660 * @param {Boolean} exists Only check if there are listeners.
7661 * @returns {Array|Boolean}
7662 * @api public
7663 */
7664EventEmitter.prototype.listeners = function listeners(event, exists) {
7665 var evt = prefix ? prefix + event : event
7666 , available = this._events[evt];
7667
7668 if (exists) return !!available;
7669 if (!available) return [];
7670 if (available.fn) return [available.fn];
7671
7672 for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {
7673 ee[i] = available[i].fn;
7674 }
7675
7676 return ee;
7677};
7678
7679/**
7680 * Calls each of the listeners registered for a given event.
7681 *
7682 * @param {String|Symbol} event The event name.
7683 * @returns {Boolean} `true` if the event had listeners, else `false`.
7684 * @api public
7685 */
7686EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
7687 var evt = prefix ? prefix + event : event;
7688
7689 if (!this._events[evt]) return false;
7690
7691 var listeners = this._events[evt]
7692 , len = arguments.length
7693 , args
7694 , i;
7695
7696 if (listeners.fn) {
7697 if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
7698
7699 switch (len) {
7700 case 1: return listeners.fn.call(listeners.context), true;
7701 case 2: return listeners.fn.call(listeners.context, a1), true;
7702 case 3: return listeners.fn.call(listeners.context, a1, a2), true;
7703 case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
7704 case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
7705 case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
7706 }
7707
7708 for (i = 1, args = new Array(len -1); i < len; i++) {
7709 args[i - 1] = arguments[i];
7710 }
7711
7712 listeners.fn.apply(listeners.context, args);
7713 } else {
7714 var length = listeners.length
7715 , j;
7716
7717 for (i = 0; i < length; i++) {
7718 if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
7719
7720 switch (len) {
7721 case 1: listeners[i].fn.call(listeners[i].context); break;
7722 case 2: listeners[i].fn.call(listeners[i].context, a1); break;
7723 case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
7724 case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
7725 default:
7726 if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
7727 args[j - 1] = arguments[j];
7728 }
7729
7730 listeners[i].fn.apply(listeners[i].context, args);
7731 }
7732 }
7733 }
7734
7735 return true;
7736};
7737
7738/**
7739 * Add a listener for a given event.
7740 *
7741 * @param {String|Symbol} event The event name.
7742 * @param {Function} fn The listener function.
7743 * @param {Mixed} [context=this] The context to invoke the listener with.
7744 * @returns {EventEmitter} `this`.
7745 * @api public
7746 */
7747EventEmitter.prototype.on = function on(event, fn, context) {
7748 var listener = new EE(fn, context || this)
7749 , evt = prefix ? prefix + event : event;
7750
7751 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
7752 else if (!this._events[evt].fn) this._events[evt].push(listener);
7753 else this._events[evt] = [this._events[evt], listener];
7754
7755 return this;
7756};
7757
7758/**
7759 * Add a one-time listener for a given event.
7760 *
7761 * @param {String|Symbol} event The event name.
7762 * @param {Function} fn The listener function.
7763 * @param {Mixed} [context=this] The context to invoke the listener with.
7764 * @returns {EventEmitter} `this`.
7765 * @api public
7766 */
7767EventEmitter.prototype.once = function once(event, fn, context) {
7768 var listener = new EE(fn, context || this, true)
7769 , evt = prefix ? prefix + event : event;
7770
7771 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
7772 else if (!this._events[evt].fn) this._events[evt].push(listener);
7773 else this._events[evt] = [this._events[evt], listener];
7774
7775 return this;
7776};
7777
7778/**
7779 * Remove the listeners of a given event.
7780 *
7781 * @param {String|Symbol} event The event name.
7782 * @param {Function} fn Only remove the listeners that match this function.
7783 * @param {Mixed} context Only remove the listeners that have this context.
7784 * @param {Boolean} once Only remove one-time listeners.
7785 * @returns {EventEmitter} `this`.
7786 * @api public
7787 */
7788EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
7789 var evt = prefix ? prefix + event : event;
7790
7791 if (!this._events[evt]) return this;
7792 if (!fn) {
7793 if (--this._eventsCount === 0) this._events = new Events();
7794 else delete this._events[evt];
7795 return this;
7796 }
7797
7798 var listeners = this._events[evt];
7799
7800 if (listeners.fn) {
7801 if (
7802 listeners.fn === fn
7803 && (!once || listeners.once)
7804 && (!context || listeners.context === context)
7805 ) {
7806 if (--this._eventsCount === 0) this._events = new Events();
7807 else delete this._events[evt];
7808 }
7809 } else {
7810 for (var i = 0, events = [], length = listeners.length; i < length; i++) {
7811 if (
7812 listeners[i].fn !== fn
7813 || (once && !listeners[i].once)
7814 || (context && listeners[i].context !== context)
7815 ) {
7816 events.push(listeners[i]);
7817 }
7818 }
7819
7820 //
7821 // Reset the array, or remove it completely if we have no more listeners.
7822 //
7823 if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
7824 else if (--this._eventsCount === 0) this._events = new Events();
7825 else delete this._events[evt];
7826 }
7827
7828 return this;
7829};
7830
7831/**
7832 * Remove all listeners, or those of the specified event.
7833 *
7834 * @param {String|Symbol} [event] The event name.
7835 * @returns {EventEmitter} `this`.
7836 * @api public
7837 */
7838EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
7839 var evt;
7840
7841 if (event) {
7842 evt = prefix ? prefix + event : event;
7843 if (this._events[evt]) {
7844 if (--this._eventsCount === 0) this._events = new Events();
7845 else delete this._events[evt];
7846 }
7847 } else {
7848 this._events = new Events();
7849 this._eventsCount = 0;
7850 }
7851
7852 return this;
7853};
7854
7855//
7856// Alias methods names because people roll like that.
7857//
7858EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
7859EventEmitter.prototype.addListener = EventEmitter.prototype.on;
7860
7861//
7862// This function doesn't apply anymore.
7863//
7864EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
7865 return this;
7866};
7867
7868//
7869// Expose the prefix.
7870//
7871EventEmitter.prefixed = prefix;
7872
7873//
7874// Allow `EventEmitter` to be imported as module namespace.
7875//
7876EventEmitter.EventEmitter = EventEmitter;
7877
7878//
7879// Expose the module.
7880//
7881if (true) {
7882 module.exports = EventEmitter;
7883}
7884
7885
7886/***/ }),
7887/* 236 */
7888/***/ (function(module, exports, __webpack_require__) {
7889
7890"use strict";
7891
7892
7893var _interopRequireDefault = __webpack_require__(1);
7894
7895var _promise = _interopRequireDefault(__webpack_require__(12));
7896
7897var _require = __webpack_require__(72),
7898 getAdapter = _require.getAdapter;
7899
7900var syncApiNames = ['getItem', 'setItem', 'removeItem', 'clear'];
7901var localStorage = {
7902 get async() {
7903 return getAdapter('storage').async;
7904 }
7905
7906}; // wrap sync apis with async ones.
7907
7908syncApiNames.forEach(function (apiName) {
7909 localStorage[apiName + 'Async'] = function () {
7910 var storage = getAdapter('storage');
7911 return _promise.default.resolve(storage[apiName].apply(storage, arguments));
7912 };
7913
7914 localStorage[apiName] = function () {
7915 var storage = getAdapter('storage');
7916
7917 if (!storage.async) {
7918 return storage[apiName].apply(storage, arguments);
7919 }
7920
7921 var error = new Error('Synchronous API [' + apiName + '] is not available in this runtime.');
7922 error.code = 'SYNC_API_NOT_AVAILABLE';
7923 throw error;
7924 };
7925});
7926module.exports = localStorage;
7927
7928/***/ }),
7929/* 237 */
7930/***/ (function(module, exports, __webpack_require__) {
7931
7932"use strict";
7933
7934
7935var _interopRequireDefault = __webpack_require__(1);
7936
7937var _concat = _interopRequireDefault(__webpack_require__(22));
7938
7939var _stringify = _interopRequireDefault(__webpack_require__(36));
7940
7941var storage = __webpack_require__(236);
7942
7943var AV = __webpack_require__(69);
7944
7945var removeAsync = exports.removeAsync = storage.removeItemAsync.bind(storage);
7946
7947var getCacheData = function getCacheData(cacheData, key) {
7948 try {
7949 cacheData = JSON.parse(cacheData);
7950 } catch (e) {
7951 return null;
7952 }
7953
7954 if (cacheData) {
7955 var expired = cacheData.expiredAt && cacheData.expiredAt < Date.now();
7956
7957 if (!expired) {
7958 return cacheData.value;
7959 }
7960
7961 return removeAsync(key).then(function () {
7962 return null;
7963 });
7964 }
7965
7966 return null;
7967};
7968
7969exports.getAsync = function (key) {
7970 var _context;
7971
7972 key = (0, _concat.default)(_context = "AV/".concat(AV.applicationId, "/")).call(_context, key);
7973 return storage.getItemAsync(key).then(function (cache) {
7974 return getCacheData(cache, key);
7975 });
7976};
7977
7978exports.setAsync = function (key, value, ttl) {
7979 var _context2;
7980
7981 var cache = {
7982 value: value
7983 };
7984
7985 if (typeof ttl === 'number') {
7986 cache.expiredAt = Date.now() + ttl;
7987 }
7988
7989 return storage.setItemAsync((0, _concat.default)(_context2 = "AV/".concat(AV.applicationId, "/")).call(_context2, key), (0, _stringify.default)(cache));
7990};
7991
7992/***/ }),
7993/* 238 */
7994/***/ (function(module, exports, __webpack_require__) {
7995
7996module.exports = __webpack_require__(239);
7997
7998/***/ }),
7999/* 239 */
8000/***/ (function(module, exports, __webpack_require__) {
8001
8002var parent = __webpack_require__(417);
8003
8004module.exports = parent;
8005
8006
8007/***/ }),
8008/* 240 */
8009/***/ (function(module, exports, __webpack_require__) {
8010
8011var parent = __webpack_require__(420);
8012
8013module.exports = parent;
8014
8015
8016/***/ }),
8017/* 241 */
8018/***/ (function(module, exports, __webpack_require__) {
8019
8020var parent = __webpack_require__(423);
8021
8022module.exports = parent;
8023
8024
8025/***/ }),
8026/* 242 */
8027/***/ (function(module, exports, __webpack_require__) {
8028
8029module.exports = __webpack_require__(426);
8030
8031/***/ }),
8032/* 243 */
8033/***/ (function(module, exports, __webpack_require__) {
8034
8035var parent = __webpack_require__(429);
8036__webpack_require__(39);
8037
8038module.exports = parent;
8039
8040
8041/***/ }),
8042/* 244 */
8043/***/ (function(module, exports, __webpack_require__) {
8044
8045// TODO: Remove this module from `core-js@4` since it's split to modules listed below
8046__webpack_require__(430);
8047__webpack_require__(432);
8048__webpack_require__(433);
8049__webpack_require__(230);
8050__webpack_require__(434);
8051
8052
8053/***/ }),
8054/* 245 */
8055/***/ (function(module, exports, __webpack_require__) {
8056
8057/* eslint-disable es-x/no-object-getownpropertynames -- safe */
8058var classof = __webpack_require__(63);
8059var toIndexedObject = __webpack_require__(32);
8060var $getOwnPropertyNames = __webpack_require__(103).f;
8061var arraySlice = __webpack_require__(431);
8062
8063var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
8064 ? Object.getOwnPropertyNames(window) : [];
8065
8066var getWindowNames = function (it) {
8067 try {
8068 return $getOwnPropertyNames(it);
8069 } catch (error) {
8070 return arraySlice(windowNames);
8071 }
8072};
8073
8074// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
8075module.exports.f = function getOwnPropertyNames(it) {
8076 return windowNames && classof(it) == 'Window'
8077 ? getWindowNames(it)
8078 : $getOwnPropertyNames(toIndexedObject(it));
8079};
8080
8081
8082/***/ }),
8083/* 246 */
8084/***/ (function(module, exports, __webpack_require__) {
8085
8086var call = __webpack_require__(15);
8087var getBuiltIn = __webpack_require__(18);
8088var wellKnownSymbol = __webpack_require__(9);
8089var defineBuiltIn = __webpack_require__(44);
8090
8091module.exports = function () {
8092 var Symbol = getBuiltIn('Symbol');
8093 var SymbolPrototype = Symbol && Symbol.prototype;
8094 var valueOf = SymbolPrototype && SymbolPrototype.valueOf;
8095 var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
8096
8097 if (SymbolPrototype && !SymbolPrototype[TO_PRIMITIVE]) {
8098 // `Symbol.prototype[@@toPrimitive]` method
8099 // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
8100 // eslint-disable-next-line no-unused-vars -- required for .length
8101 defineBuiltIn(SymbolPrototype, TO_PRIMITIVE, function (hint) {
8102 return call(valueOf, this);
8103 }, { arity: 1 });
8104 }
8105};
8106
8107
8108/***/ }),
8109/* 247 */
8110/***/ (function(module, exports, __webpack_require__) {
8111
8112var NATIVE_SYMBOL = __webpack_require__(64);
8113
8114/* eslint-disable es-x/no-symbol -- safe */
8115module.exports = NATIVE_SYMBOL && !!Symbol['for'] && !!Symbol.keyFor;
8116
8117
8118/***/ }),
8119/* 248 */
8120/***/ (function(module, exports, __webpack_require__) {
8121
8122var defineWellKnownSymbol = __webpack_require__(10);
8123
8124// `Symbol.iterator` well-known symbol
8125// https://tc39.es/ecma262/#sec-symbol.iterator
8126defineWellKnownSymbol('iterator');
8127
8128
8129/***/ }),
8130/* 249 */
8131/***/ (function(module, exports, __webpack_require__) {
8132
8133var parent = __webpack_require__(463);
8134__webpack_require__(39);
8135
8136module.exports = parent;
8137
8138
8139/***/ }),
8140/* 250 */
8141/***/ (function(module, exports, __webpack_require__) {
8142
8143module.exports = __webpack_require__(464);
8144
8145/***/ }),
8146/* 251 */
8147/***/ (function(module, exports, __webpack_require__) {
8148
8149"use strict";
8150// Copyright (c) 2015-2017 David M. Lee, II
8151
8152
8153/**
8154 * Local reference to TimeoutError
8155 * @private
8156 */
8157var TimeoutError;
8158
8159/**
8160 * Rejects a promise with a {@link TimeoutError} if it does not settle within
8161 * the specified timeout.
8162 *
8163 * @param {Promise} promise The promise.
8164 * @param {number} timeoutMillis Number of milliseconds to wait on settling.
8165 * @returns {Promise} Either resolves/rejects with `promise`, or rejects with
8166 * `TimeoutError`, whichever settles first.
8167 */
8168var timeout = module.exports.timeout = function(promise, timeoutMillis) {
8169 var error = new TimeoutError(),
8170 timeout;
8171
8172 return Promise.race([
8173 promise,
8174 new Promise(function(resolve, reject) {
8175 timeout = setTimeout(function() {
8176 reject(error);
8177 }, timeoutMillis);
8178 }),
8179 ]).then(function(v) {
8180 clearTimeout(timeout);
8181 return v;
8182 }, function(err) {
8183 clearTimeout(timeout);
8184 throw err;
8185 });
8186};
8187
8188/**
8189 * Exception indicating that the timeout expired.
8190 */
8191TimeoutError = module.exports.TimeoutError = function() {
8192 Error.call(this)
8193 this.stack = Error().stack
8194 this.message = 'Timeout';
8195};
8196
8197TimeoutError.prototype = Object.create(Error.prototype);
8198TimeoutError.prototype.name = "TimeoutError";
8199
8200
8201/***/ }),
8202/* 252 */
8203/***/ (function(module, exports, __webpack_require__) {
8204
8205module.exports = __webpack_require__(253);
8206
8207/***/ }),
8208/* 253 */
8209/***/ (function(module, exports, __webpack_require__) {
8210
8211var parent = __webpack_require__(480);
8212
8213module.exports = parent;
8214
8215
8216/***/ }),
8217/* 254 */
8218/***/ (function(module, exports, __webpack_require__) {
8219
8220module.exports = __webpack_require__(484);
8221
8222/***/ }),
8223/* 255 */
8224/***/ (function(module, exports, __webpack_require__) {
8225
8226"use strict";
8227
8228var uncurryThis = __webpack_require__(4);
8229var aCallable = __webpack_require__(31);
8230var isObject = __webpack_require__(11);
8231var hasOwn = __webpack_require__(13);
8232var arraySlice = __webpack_require__(110);
8233var NATIVE_BIND = __webpack_require__(76);
8234
8235var $Function = Function;
8236var concat = uncurryThis([].concat);
8237var join = uncurryThis([].join);
8238var factories = {};
8239
8240var construct = function (C, argsLength, args) {
8241 if (!hasOwn(factories, argsLength)) {
8242 for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']';
8243 factories[argsLength] = $Function('C,a', 'return new C(' + join(list, ',') + ')');
8244 } return factories[argsLength](C, args);
8245};
8246
8247// `Function.prototype.bind` method implementation
8248// https://tc39.es/ecma262/#sec-function.prototype.bind
8249module.exports = NATIVE_BIND ? $Function.bind : function bind(that /* , ...args */) {
8250 var F = aCallable(this);
8251 var Prototype = F.prototype;
8252 var partArgs = arraySlice(arguments, 1);
8253 var boundFunction = function bound(/* args... */) {
8254 var args = concat(partArgs, arraySlice(arguments));
8255 return this instanceof boundFunction ? construct(F, args.length, args) : F.apply(that, args);
8256 };
8257 if (isObject(Prototype)) boundFunction.prototype = Prototype;
8258 return boundFunction;
8259};
8260
8261
8262/***/ }),
8263/* 256 */
8264/***/ (function(module, exports, __webpack_require__) {
8265
8266module.exports = __webpack_require__(505);
8267
8268/***/ }),
8269/* 257 */
8270/***/ (function(module, exports, __webpack_require__) {
8271
8272module.exports = __webpack_require__(508);
8273
8274/***/ }),
8275/* 258 */
8276/***/ (function(module, exports) {
8277
8278var charenc = {
8279 // UTF-8 encoding
8280 utf8: {
8281 // Convert a string to a byte array
8282 stringToBytes: function(str) {
8283 return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
8284 },
8285
8286 // Convert a byte array to a string
8287 bytesToString: function(bytes) {
8288 return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
8289 }
8290 },
8291
8292 // Binary encoding
8293 bin: {
8294 // Convert a string to a byte array
8295 stringToBytes: function(str) {
8296 for (var bytes = [], i = 0; i < str.length; i++)
8297 bytes.push(str.charCodeAt(i) & 0xFF);
8298 return bytes;
8299 },
8300
8301 // Convert a byte array to a string
8302 bytesToString: function(bytes) {
8303 for (var str = [], i = 0; i < bytes.length; i++)
8304 str.push(String.fromCharCode(bytes[i]));
8305 return str.join('');
8306 }
8307 }
8308};
8309
8310module.exports = charenc;
8311
8312
8313/***/ }),
8314/* 259 */
8315/***/ (function(module, exports, __webpack_require__) {
8316
8317"use strict";
8318
8319
8320var adapters = __webpack_require__(569);
8321
8322module.exports = function (AV) {
8323 AV.setAdapters(adapters);
8324 return AV;
8325};
8326
8327/***/ }),
8328/* 260 */
8329/***/ (function(module, exports, __webpack_require__) {
8330
8331module.exports = __webpack_require__(577);
8332
8333/***/ }),
8334/* 261 */
8335/***/ (function(module, exports, __webpack_require__) {
8336
8337var fails = __webpack_require__(2);
8338var isObject = __webpack_require__(11);
8339var classof = __webpack_require__(63);
8340var ARRAY_BUFFER_NON_EXTENSIBLE = __webpack_require__(581);
8341
8342// eslint-disable-next-line es-x/no-object-isextensible -- safe
8343var $isExtensible = Object.isExtensible;
8344var FAILS_ON_PRIMITIVES = fails(function () { $isExtensible(1); });
8345
8346// `Object.isExtensible` method
8347// https://tc39.es/ecma262/#sec-object.isextensible
8348module.exports = (FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE) ? function isExtensible(it) {
8349 if (!isObject(it)) return false;
8350 if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return false;
8351 return $isExtensible ? $isExtensible(it) : true;
8352} : $isExtensible;
8353
8354
8355/***/ }),
8356/* 262 */
8357/***/ (function(module, exports, __webpack_require__) {
8358
8359var fails = __webpack_require__(2);
8360
8361module.exports = !fails(function () {
8362 // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-preventextensions -- required for testing
8363 return Object.isExtensible(Object.preventExtensions({}));
8364});
8365
8366
8367/***/ }),
8368/* 263 */
8369/***/ (function(module, exports, __webpack_require__) {
8370
8371"use strict";
8372
8373var defineProperty = __webpack_require__(23).f;
8374var create = __webpack_require__(49);
8375var defineBuiltIns = __webpack_require__(154);
8376var bind = __webpack_require__(48);
8377var anInstance = __webpack_require__(108);
8378var iterate = __webpack_require__(42);
8379var defineIterator = __webpack_require__(131);
8380var setSpecies = __webpack_require__(172);
8381var DESCRIPTORS = __webpack_require__(14);
8382var fastKey = __webpack_require__(94).fastKey;
8383var InternalStateModule = __webpack_require__(43);
8384
8385var setInternalState = InternalStateModule.set;
8386var internalStateGetterFor = InternalStateModule.getterFor;
8387
8388module.exports = {
8389 getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
8390 var Constructor = wrapper(function (that, iterable) {
8391 anInstance(that, Prototype);
8392 setInternalState(that, {
8393 type: CONSTRUCTOR_NAME,
8394 index: create(null),
8395 first: undefined,
8396 last: undefined,
8397 size: 0
8398 });
8399 if (!DESCRIPTORS) that.size = 0;
8400 if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
8401 });
8402
8403 var Prototype = Constructor.prototype;
8404
8405 var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
8406
8407 var define = function (that, key, value) {
8408 var state = getInternalState(that);
8409 var entry = getEntry(that, key);
8410 var previous, index;
8411 // change existing entry
8412 if (entry) {
8413 entry.value = value;
8414 // create new entry
8415 } else {
8416 state.last = entry = {
8417 index: index = fastKey(key, true),
8418 key: key,
8419 value: value,
8420 previous: previous = state.last,
8421 next: undefined,
8422 removed: false
8423 };
8424 if (!state.first) state.first = entry;
8425 if (previous) previous.next = entry;
8426 if (DESCRIPTORS) state.size++;
8427 else that.size++;
8428 // add to index
8429 if (index !== 'F') state.index[index] = entry;
8430 } return that;
8431 };
8432
8433 var getEntry = function (that, key) {
8434 var state = getInternalState(that);
8435 // fast case
8436 var index = fastKey(key);
8437 var entry;
8438 if (index !== 'F') return state.index[index];
8439 // frozen object case
8440 for (entry = state.first; entry; entry = entry.next) {
8441 if (entry.key == key) return entry;
8442 }
8443 };
8444
8445 defineBuiltIns(Prototype, {
8446 // `{ Map, Set }.prototype.clear()` methods
8447 // https://tc39.es/ecma262/#sec-map.prototype.clear
8448 // https://tc39.es/ecma262/#sec-set.prototype.clear
8449 clear: function clear() {
8450 var that = this;
8451 var state = getInternalState(that);
8452 var data = state.index;
8453 var entry = state.first;
8454 while (entry) {
8455 entry.removed = true;
8456 if (entry.previous) entry.previous = entry.previous.next = undefined;
8457 delete data[entry.index];
8458 entry = entry.next;
8459 }
8460 state.first = state.last = undefined;
8461 if (DESCRIPTORS) state.size = 0;
8462 else that.size = 0;
8463 },
8464 // `{ Map, Set }.prototype.delete(key)` methods
8465 // https://tc39.es/ecma262/#sec-map.prototype.delete
8466 // https://tc39.es/ecma262/#sec-set.prototype.delete
8467 'delete': function (key) {
8468 var that = this;
8469 var state = getInternalState(that);
8470 var entry = getEntry(that, key);
8471 if (entry) {
8472 var next = entry.next;
8473 var prev = entry.previous;
8474 delete state.index[entry.index];
8475 entry.removed = true;
8476 if (prev) prev.next = next;
8477 if (next) next.previous = prev;
8478 if (state.first == entry) state.first = next;
8479 if (state.last == entry) state.last = prev;
8480 if (DESCRIPTORS) state.size--;
8481 else that.size--;
8482 } return !!entry;
8483 },
8484 // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods
8485 // https://tc39.es/ecma262/#sec-map.prototype.foreach
8486 // https://tc39.es/ecma262/#sec-set.prototype.foreach
8487 forEach: function forEach(callbackfn /* , that = undefined */) {
8488 var state = getInternalState(this);
8489 var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
8490 var entry;
8491 while (entry = entry ? entry.next : state.first) {
8492 boundFunction(entry.value, entry.key, this);
8493 // revert to the last existing entry
8494 while (entry && entry.removed) entry = entry.previous;
8495 }
8496 },
8497 // `{ Map, Set}.prototype.has(key)` methods
8498 // https://tc39.es/ecma262/#sec-map.prototype.has
8499 // https://tc39.es/ecma262/#sec-set.prototype.has
8500 has: function has(key) {
8501 return !!getEntry(this, key);
8502 }
8503 });
8504
8505 defineBuiltIns(Prototype, IS_MAP ? {
8506 // `Map.prototype.get(key)` method
8507 // https://tc39.es/ecma262/#sec-map.prototype.get
8508 get: function get(key) {
8509 var entry = getEntry(this, key);
8510 return entry && entry.value;
8511 },
8512 // `Map.prototype.set(key, value)` method
8513 // https://tc39.es/ecma262/#sec-map.prototype.set
8514 set: function set(key, value) {
8515 return define(this, key === 0 ? 0 : key, value);
8516 }
8517 } : {
8518 // `Set.prototype.add(value)` method
8519 // https://tc39.es/ecma262/#sec-set.prototype.add
8520 add: function add(value) {
8521 return define(this, value = value === 0 ? 0 : value, value);
8522 }
8523 });
8524 if (DESCRIPTORS) defineProperty(Prototype, 'size', {
8525 get: function () {
8526 return getInternalState(this).size;
8527 }
8528 });
8529 return Constructor;
8530 },
8531 setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) {
8532 var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
8533 var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
8534 var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
8535 // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods
8536 // https://tc39.es/ecma262/#sec-map.prototype.entries
8537 // https://tc39.es/ecma262/#sec-map.prototype.keys
8538 // https://tc39.es/ecma262/#sec-map.prototype.values
8539 // https://tc39.es/ecma262/#sec-map.prototype-@@iterator
8540 // https://tc39.es/ecma262/#sec-set.prototype.entries
8541 // https://tc39.es/ecma262/#sec-set.prototype.keys
8542 // https://tc39.es/ecma262/#sec-set.prototype.values
8543 // https://tc39.es/ecma262/#sec-set.prototype-@@iterator
8544 defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) {
8545 setInternalState(this, {
8546 type: ITERATOR_NAME,
8547 target: iterated,
8548 state: getInternalCollectionState(iterated),
8549 kind: kind,
8550 last: undefined
8551 });
8552 }, function () {
8553 var state = getInternalIteratorState(this);
8554 var kind = state.kind;
8555 var entry = state.last;
8556 // revert to the last existing entry
8557 while (entry && entry.removed) entry = entry.previous;
8558 // get next entry
8559 if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
8560 // or finish the iteration
8561 state.target = undefined;
8562 return { value: undefined, done: true };
8563 }
8564 // return step by kind
8565 if (kind == 'keys') return { value: entry.key, done: false };
8566 if (kind == 'values') return { value: entry.value, done: false };
8567 return { value: [entry.key, entry.value], done: false };
8568 }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
8569
8570 // `{ Map, Set }.prototype[@@species]` accessors
8571 // https://tc39.es/ecma262/#sec-get-map-@@species
8572 // https://tc39.es/ecma262/#sec-get-set-@@species
8573 setSpecies(CONSTRUCTOR_NAME);
8574 }
8575};
8576
8577
8578/***/ }),
8579/* 264 */
8580/***/ (function(module, exports, __webpack_require__) {
8581
8582module.exports = __webpack_require__(608);
8583
8584/***/ }),
8585/* 265 */
8586/***/ (function(module, exports) {
8587
8588function _arrayLikeToArray(arr, len) {
8589 if (len == null || len > arr.length) len = arr.length;
8590
8591 for (var i = 0, arr2 = new Array(len); i < len; i++) {
8592 arr2[i] = arr[i];
8593 }
8594
8595 return arr2;
8596}
8597
8598module.exports = _arrayLikeToArray;
8599
8600/***/ }),
8601/* 266 */
8602/***/ (function(module, exports) {
8603
8604function _iterableToArray(iter) {
8605 if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
8606}
8607
8608module.exports = _iterableToArray;
8609
8610/***/ }),
8611/* 267 */
8612/***/ (function(module, exports, __webpack_require__) {
8613
8614var arrayLikeToArray = __webpack_require__(265);
8615
8616function _unsupportedIterableToArray(o, minLen) {
8617 if (!o) return;
8618 if (typeof o === "string") return arrayLikeToArray(o, minLen);
8619 var n = Object.prototype.toString.call(o).slice(8, -1);
8620 if (n === "Object" && o.constructor) n = o.constructor.name;
8621 if (n === "Map" || n === "Set") return Array.from(o);
8622 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
8623}
8624
8625module.exports = _unsupportedIterableToArray;
8626
8627/***/ }),
8628/* 268 */
8629/***/ (function(module, exports, __webpack_require__) {
8630
8631var baseRandom = __webpack_require__(631);
8632
8633/**
8634 * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
8635 *
8636 * @private
8637 * @param {Array} array The array to shuffle.
8638 * @param {number} [size=array.length] The size of `array`.
8639 * @returns {Array} Returns `array`.
8640 */
8641function shuffleSelf(array, size) {
8642 var index = -1,
8643 length = array.length,
8644 lastIndex = length - 1;
8645
8646 size = size === undefined ? length : size;
8647 while (++index < size) {
8648 var rand = baseRandom(index, lastIndex),
8649 value = array[rand];
8650
8651 array[rand] = array[index];
8652 array[index] = value;
8653 }
8654 array.length = size;
8655 return array;
8656}
8657
8658module.exports = shuffleSelf;
8659
8660
8661/***/ }),
8662/* 269 */
8663/***/ (function(module, exports, __webpack_require__) {
8664
8665var baseValues = __webpack_require__(633),
8666 keys = __webpack_require__(635);
8667
8668/**
8669 * Creates an array of the own enumerable string keyed property values of `object`.
8670 *
8671 * **Note:** Non-object values are coerced to objects.
8672 *
8673 * @static
8674 * @since 0.1.0
8675 * @memberOf _
8676 * @category Object
8677 * @param {Object} object The object to query.
8678 * @returns {Array} Returns the array of property values.
8679 * @example
8680 *
8681 * function Foo() {
8682 * this.a = 1;
8683 * this.b = 2;
8684 * }
8685 *
8686 * Foo.prototype.c = 3;
8687 *
8688 * _.values(new Foo);
8689 * // => [1, 2] (iteration order is not guaranteed)
8690 *
8691 * _.values('hi');
8692 * // => ['h', 'i']
8693 */
8694function values(object) {
8695 return object == null ? [] : baseValues(object, keys(object));
8696}
8697
8698module.exports = values;
8699
8700
8701/***/ }),
8702/* 270 */
8703/***/ (function(module, exports, __webpack_require__) {
8704
8705var root = __webpack_require__(271);
8706
8707/** Built-in value references. */
8708var Symbol = root.Symbol;
8709
8710module.exports = Symbol;
8711
8712
8713/***/ }),
8714/* 271 */
8715/***/ (function(module, exports, __webpack_require__) {
8716
8717var freeGlobal = __webpack_require__(272);
8718
8719/** Detect free variable `self`. */
8720var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
8721
8722/** Used as a reference to the global object. */
8723var root = freeGlobal || freeSelf || Function('return this')();
8724
8725module.exports = root;
8726
8727
8728/***/ }),
8729/* 272 */
8730/***/ (function(module, exports, __webpack_require__) {
8731
8732/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
8733var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
8734
8735module.exports = freeGlobal;
8736
8737/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74)))
8738
8739/***/ }),
8740/* 273 */
8741/***/ (function(module, exports) {
8742
8743/**
8744 * Checks if `value` is classified as an `Array` object.
8745 *
8746 * @static
8747 * @memberOf _
8748 * @since 0.1.0
8749 * @category Lang
8750 * @param {*} value The value to check.
8751 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
8752 * @example
8753 *
8754 * _.isArray([1, 2, 3]);
8755 * // => true
8756 *
8757 * _.isArray(document.body.children);
8758 * // => false
8759 *
8760 * _.isArray('abc');
8761 * // => false
8762 *
8763 * _.isArray(_.noop);
8764 * // => false
8765 */
8766var isArray = Array.isArray;
8767
8768module.exports = isArray;
8769
8770
8771/***/ }),
8772/* 274 */
8773/***/ (function(module, exports) {
8774
8775module.exports = function(module) {
8776 if(!module.webpackPolyfill) {
8777 module.deprecate = function() {};
8778 module.paths = [];
8779 // module.parent = undefined by default
8780 if(!module.children) module.children = [];
8781 Object.defineProperty(module, "loaded", {
8782 enumerable: true,
8783 get: function() {
8784 return module.l;
8785 }
8786 });
8787 Object.defineProperty(module, "id", {
8788 enumerable: true,
8789 get: function() {
8790 return module.i;
8791 }
8792 });
8793 module.webpackPolyfill = 1;
8794 }
8795 return module;
8796};
8797
8798
8799/***/ }),
8800/* 275 */
8801/***/ (function(module, exports) {
8802
8803/** Used as references for various `Number` constants. */
8804var MAX_SAFE_INTEGER = 9007199254740991;
8805
8806/**
8807 * Checks if `value` is a valid array-like length.
8808 *
8809 * **Note:** This method is loosely based on
8810 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
8811 *
8812 * @static
8813 * @memberOf _
8814 * @since 4.0.0
8815 * @category Lang
8816 * @param {*} value The value to check.
8817 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
8818 * @example
8819 *
8820 * _.isLength(3);
8821 * // => true
8822 *
8823 * _.isLength(Number.MIN_VALUE);
8824 * // => false
8825 *
8826 * _.isLength(Infinity);
8827 * // => false
8828 *
8829 * _.isLength('3');
8830 * // => false
8831 */
8832function isLength(value) {
8833 return typeof value == 'number' &&
8834 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
8835}
8836
8837module.exports = isLength;
8838
8839
8840/***/ }),
8841/* 276 */
8842/***/ (function(module, exports) {
8843
8844/**
8845 * Creates a unary function that invokes `func` with its argument transformed.
8846 *
8847 * @private
8848 * @param {Function} func The function to wrap.
8849 * @param {Function} transform The argument transform.
8850 * @returns {Function} Returns the new function.
8851 */
8852function overArg(func, transform) {
8853 return function(arg) {
8854 return func(transform(arg));
8855 };
8856}
8857
8858module.exports = overArg;
8859
8860
8861/***/ }),
8862/* 277 */
8863/***/ (function(module, exports, __webpack_require__) {
8864
8865"use strict";
8866
8867
8868var AV = __webpack_require__(278);
8869
8870var useLiveQuery = __webpack_require__(588);
8871
8872var useAdatpers = __webpack_require__(259);
8873
8874module.exports = useAdatpers(useLiveQuery(AV));
8875
8876/***/ }),
8877/* 278 */
8878/***/ (function(module, exports, __webpack_require__) {
8879
8880"use strict";
8881
8882
8883var AV = __webpack_require__(279);
8884
8885var useAdatpers = __webpack_require__(259);
8886
8887module.exports = useAdatpers(AV);
8888
8889/***/ }),
8890/* 279 */
8891/***/ (function(module, exports, __webpack_require__) {
8892
8893"use strict";
8894
8895
8896module.exports = __webpack_require__(280);
8897
8898/***/ }),
8899/* 280 */
8900/***/ (function(module, exports, __webpack_require__) {
8901
8902"use strict";
8903
8904
8905var _interopRequireDefault = __webpack_require__(1);
8906
8907var _promise = _interopRequireDefault(__webpack_require__(12));
8908
8909/*!
8910 * LeanCloud JavaScript SDK
8911 * https://leancloud.cn
8912 *
8913 * Copyright 2016 LeanCloud.cn, Inc.
8914 * The LeanCloud JavaScript SDK is freely distributable under the MIT license.
8915 */
8916var _ = __webpack_require__(3);
8917
8918var AV = __webpack_require__(69);
8919
8920AV._ = _;
8921AV.version = __webpack_require__(234);
8922AV.Promise = _promise.default;
8923AV.localStorage = __webpack_require__(236);
8924AV.Cache = __webpack_require__(237);
8925AV.Error = __webpack_require__(46);
8926
8927__webpack_require__(419);
8928
8929__webpack_require__(468)(AV);
8930
8931__webpack_require__(469)(AV);
8932
8933__webpack_require__(470)(AV);
8934
8935__webpack_require__(471)(AV);
8936
8937__webpack_require__(476)(AV);
8938
8939__webpack_require__(477)(AV);
8940
8941__webpack_require__(530)(AV);
8942
8943__webpack_require__(555)(AV);
8944
8945__webpack_require__(556)(AV);
8946
8947__webpack_require__(558)(AV);
8948
8949__webpack_require__(559)(AV);
8950
8951__webpack_require__(560)(AV);
8952
8953__webpack_require__(561)(AV);
8954
8955__webpack_require__(562)(AV);
8956
8957__webpack_require__(563)(AV);
8958
8959__webpack_require__(564)(AV);
8960
8961__webpack_require__(565)(AV);
8962
8963__webpack_require__(566)(AV);
8964
8965AV.Conversation = __webpack_require__(567);
8966
8967__webpack_require__(568);
8968
8969module.exports = AV;
8970/**
8971 * Options to controll the authentication for an operation
8972 * @typedef {Object} AuthOptions
8973 * @property {String} [sessionToken] Specify a user to excute the operation as.
8974 * @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.
8975 * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
8976 */
8977
8978/**
8979 * Options to controll the authentication for an SMS operation
8980 * @typedef {Object} SMSAuthOptions
8981 * @property {String} [sessionToken] Specify a user to excute the operation as.
8982 * @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.
8983 * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
8984 * @property {String} [validateToken] a validate token returned by {@link AV.Cloud.verifyCaptcha}
8985 */
8986
8987/***/ }),
8988/* 281 */
8989/***/ (function(module, exports, __webpack_require__) {
8990
8991var parent = __webpack_require__(282);
8992__webpack_require__(39);
8993
8994module.exports = parent;
8995
8996
8997/***/ }),
8998/* 282 */
8999/***/ (function(module, exports, __webpack_require__) {
9000
9001__webpack_require__(283);
9002__webpack_require__(38);
9003__webpack_require__(53);
9004__webpack_require__(299);
9005__webpack_require__(313);
9006__webpack_require__(314);
9007__webpack_require__(315);
9008__webpack_require__(55);
9009var path = __webpack_require__(5);
9010
9011module.exports = path.Promise;
9012
9013
9014/***/ }),
9015/* 283 */
9016/***/ (function(module, exports, __webpack_require__) {
9017
9018// TODO: Remove this module from `core-js@4` since it's replaced to module below
9019__webpack_require__(284);
9020
9021
9022/***/ }),
9023/* 284 */
9024/***/ (function(module, exports, __webpack_require__) {
9025
9026"use strict";
9027
9028var $ = __webpack_require__(0);
9029var isPrototypeOf = __webpack_require__(19);
9030var getPrototypeOf = __webpack_require__(100);
9031var setPrototypeOf = __webpack_require__(102);
9032var copyConstructorProperties = __webpack_require__(289);
9033var create = __webpack_require__(49);
9034var createNonEnumerableProperty = __webpack_require__(37);
9035var createPropertyDescriptor = __webpack_require__(47);
9036var clearErrorStack = __webpack_require__(292);
9037var installErrorCause = __webpack_require__(293);
9038var iterate = __webpack_require__(42);
9039var normalizeStringArgument = __webpack_require__(294);
9040var wellKnownSymbol = __webpack_require__(9);
9041var ERROR_STACK_INSTALLABLE = __webpack_require__(295);
9042
9043var TO_STRING_TAG = wellKnownSymbol('toStringTag');
9044var $Error = Error;
9045var push = [].push;
9046
9047var $AggregateError = function AggregateError(errors, message /* , options */) {
9048 var options = arguments.length > 2 ? arguments[2] : undefined;
9049 var isInstance = isPrototypeOf(AggregateErrorPrototype, this);
9050 var that;
9051 if (setPrototypeOf) {
9052 that = setPrototypeOf(new $Error(), isInstance ? getPrototypeOf(this) : AggregateErrorPrototype);
9053 } else {
9054 that = isInstance ? this : create(AggregateErrorPrototype);
9055 createNonEnumerableProperty(that, TO_STRING_TAG, 'Error');
9056 }
9057 if (message !== undefined) createNonEnumerableProperty(that, 'message', normalizeStringArgument(message));
9058 if (ERROR_STACK_INSTALLABLE) createNonEnumerableProperty(that, 'stack', clearErrorStack(that.stack, 1));
9059 installErrorCause(that, options);
9060 var errorsArray = [];
9061 iterate(errors, push, { that: errorsArray });
9062 createNonEnumerableProperty(that, 'errors', errorsArray);
9063 return that;
9064};
9065
9066if (setPrototypeOf) setPrototypeOf($AggregateError, $Error);
9067else copyConstructorProperties($AggregateError, $Error, { name: true });
9068
9069var AggregateErrorPrototype = $AggregateError.prototype = create($Error.prototype, {
9070 constructor: createPropertyDescriptor(1, $AggregateError),
9071 message: createPropertyDescriptor(1, ''),
9072 name: createPropertyDescriptor(1, 'AggregateError')
9073});
9074
9075// `AggregateError` constructor
9076// https://tc39.es/ecma262/#sec-aggregate-error-constructor
9077$({ global: true, constructor: true, arity: 2 }, {
9078 AggregateError: $AggregateError
9079});
9080
9081
9082/***/ }),
9083/* 285 */
9084/***/ (function(module, exports, __webpack_require__) {
9085
9086var call = __webpack_require__(15);
9087var isObject = __webpack_require__(11);
9088var isSymbol = __webpack_require__(97);
9089var getMethod = __webpack_require__(122);
9090var ordinaryToPrimitive = __webpack_require__(286);
9091var wellKnownSymbol = __webpack_require__(9);
9092
9093var $TypeError = TypeError;
9094var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
9095
9096// `ToPrimitive` abstract operation
9097// https://tc39.es/ecma262/#sec-toprimitive
9098module.exports = function (input, pref) {
9099 if (!isObject(input) || isSymbol(input)) return input;
9100 var exoticToPrim = getMethod(input, TO_PRIMITIVE);
9101 var result;
9102 if (exoticToPrim) {
9103 if (pref === undefined) pref = 'default';
9104 result = call(exoticToPrim, input, pref);
9105 if (!isObject(result) || isSymbol(result)) return result;
9106 throw $TypeError("Can't convert object to primitive value");
9107 }
9108 if (pref === undefined) pref = 'number';
9109 return ordinaryToPrimitive(input, pref);
9110};
9111
9112
9113/***/ }),
9114/* 286 */
9115/***/ (function(module, exports, __webpack_require__) {
9116
9117var call = __webpack_require__(15);
9118var isCallable = __webpack_require__(8);
9119var isObject = __webpack_require__(11);
9120
9121var $TypeError = TypeError;
9122
9123// `OrdinaryToPrimitive` abstract operation
9124// https://tc39.es/ecma262/#sec-ordinarytoprimitive
9125module.exports = function (input, pref) {
9126 var fn, val;
9127 if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
9128 if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
9129 if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
9130 throw $TypeError("Can't convert object to primitive value");
9131};
9132
9133
9134/***/ }),
9135/* 287 */
9136/***/ (function(module, exports, __webpack_require__) {
9137
9138var global = __webpack_require__(7);
9139
9140// eslint-disable-next-line es-x/no-object-defineproperty -- safe
9141var defineProperty = Object.defineProperty;
9142
9143module.exports = function (key, value) {
9144 try {
9145 defineProperty(global, key, { value: value, configurable: true, writable: true });
9146 } catch (error) {
9147 global[key] = value;
9148 } return value;
9149};
9150
9151
9152/***/ }),
9153/* 288 */
9154/***/ (function(module, exports, __webpack_require__) {
9155
9156var isCallable = __webpack_require__(8);
9157
9158var $String = String;
9159var $TypeError = TypeError;
9160
9161module.exports = function (argument) {
9162 if (typeof argument == 'object' || isCallable(argument)) return argument;
9163 throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
9164};
9165
9166
9167/***/ }),
9168/* 289 */
9169/***/ (function(module, exports, __webpack_require__) {
9170
9171var hasOwn = __webpack_require__(13);
9172var ownKeys = __webpack_require__(162);
9173var getOwnPropertyDescriptorModule = __webpack_require__(62);
9174var definePropertyModule = __webpack_require__(23);
9175
9176module.exports = function (target, source, exceptions) {
9177 var keys = ownKeys(source);
9178 var defineProperty = definePropertyModule.f;
9179 var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
9180 for (var i = 0; i < keys.length; i++) {
9181 var key = keys[i];
9182 if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
9183 defineProperty(target, key, getOwnPropertyDescriptor(source, key));
9184 }
9185 }
9186};
9187
9188
9189/***/ }),
9190/* 290 */
9191/***/ (function(module, exports) {
9192
9193var ceil = Math.ceil;
9194var floor = Math.floor;
9195
9196// `Math.trunc` method
9197// https://tc39.es/ecma262/#sec-math.trunc
9198// eslint-disable-next-line es-x/no-math-trunc -- safe
9199module.exports = Math.trunc || function trunc(x) {
9200 var n = +x;
9201 return (n > 0 ? floor : ceil)(n);
9202};
9203
9204
9205/***/ }),
9206/* 291 */
9207/***/ (function(module, exports, __webpack_require__) {
9208
9209var toIntegerOrInfinity = __webpack_require__(126);
9210
9211var min = Math.min;
9212
9213// `ToLength` abstract operation
9214// https://tc39.es/ecma262/#sec-tolength
9215module.exports = function (argument) {
9216 return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
9217};
9218
9219
9220/***/ }),
9221/* 292 */
9222/***/ (function(module, exports, __webpack_require__) {
9223
9224var uncurryThis = __webpack_require__(4);
9225
9226var $Error = Error;
9227var replace = uncurryThis(''.replace);
9228
9229var TEST = (function (arg) { return String($Error(arg).stack); })('zxcasd');
9230var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
9231var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
9232
9233module.exports = function (stack, dropEntries) {
9234 if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {
9235 while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');
9236 } return stack;
9237};
9238
9239
9240/***/ }),
9241/* 293 */
9242/***/ (function(module, exports, __webpack_require__) {
9243
9244var isObject = __webpack_require__(11);
9245var createNonEnumerableProperty = __webpack_require__(37);
9246
9247// `InstallErrorCause` abstract operation
9248// https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause
9249module.exports = function (O, options) {
9250 if (isObject(options) && 'cause' in options) {
9251 createNonEnumerableProperty(O, 'cause', options.cause);
9252 }
9253};
9254
9255
9256/***/ }),
9257/* 294 */
9258/***/ (function(module, exports, __webpack_require__) {
9259
9260var toString = __webpack_require__(81);
9261
9262module.exports = function (argument, $default) {
9263 return argument === undefined ? arguments.length < 2 ? '' : $default : toString(argument);
9264};
9265
9266
9267/***/ }),
9268/* 295 */
9269/***/ (function(module, exports, __webpack_require__) {
9270
9271var fails = __webpack_require__(2);
9272var createPropertyDescriptor = __webpack_require__(47);
9273
9274module.exports = !fails(function () {
9275 var error = Error('a');
9276 if (!('stack' in error)) return true;
9277 // eslint-disable-next-line es-x/no-object-defineproperty -- safe
9278 Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
9279 return error.stack !== 7;
9280});
9281
9282
9283/***/ }),
9284/* 296 */
9285/***/ (function(module, exports, __webpack_require__) {
9286
9287var DESCRIPTORS = __webpack_require__(14);
9288var hasOwn = __webpack_require__(13);
9289
9290var FunctionPrototype = Function.prototype;
9291// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
9292var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
9293
9294var EXISTS = hasOwn(FunctionPrototype, 'name');
9295// additional protection from minified / mangled / dropped function names
9296var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
9297var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
9298
9299module.exports = {
9300 EXISTS: EXISTS,
9301 PROPER: PROPER,
9302 CONFIGURABLE: CONFIGURABLE
9303};
9304
9305
9306/***/ }),
9307/* 297 */
9308/***/ (function(module, exports, __webpack_require__) {
9309
9310"use strict";
9311
9312var IteratorPrototype = __webpack_require__(171).IteratorPrototype;
9313var create = __webpack_require__(49);
9314var createPropertyDescriptor = __webpack_require__(47);
9315var setToStringTag = __webpack_require__(52);
9316var Iterators = __webpack_require__(50);
9317
9318var returnThis = function () { return this; };
9319
9320module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
9321 var TO_STRING_TAG = NAME + ' Iterator';
9322 IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
9323 setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
9324 Iterators[TO_STRING_TAG] = returnThis;
9325 return IteratorConstructor;
9326};
9327
9328
9329/***/ }),
9330/* 298 */
9331/***/ (function(module, exports, __webpack_require__) {
9332
9333"use strict";
9334
9335var TO_STRING_TAG_SUPPORT = __webpack_require__(129);
9336var classof = __webpack_require__(51);
9337
9338// `Object.prototype.toString` method implementation
9339// https://tc39.es/ecma262/#sec-object.prototype.tostring
9340module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
9341 return '[object ' + classof(this) + ']';
9342};
9343
9344
9345/***/ }),
9346/* 299 */
9347/***/ (function(module, exports, __webpack_require__) {
9348
9349// TODO: Remove this module from `core-js@4` since it's split to modules listed below
9350__webpack_require__(300);
9351__webpack_require__(308);
9352__webpack_require__(309);
9353__webpack_require__(310);
9354__webpack_require__(311);
9355__webpack_require__(312);
9356
9357
9358/***/ }),
9359/* 300 */
9360/***/ (function(module, exports, __webpack_require__) {
9361
9362"use strict";
9363
9364var $ = __webpack_require__(0);
9365var IS_PURE = __webpack_require__(33);
9366var IS_NODE = __webpack_require__(107);
9367var global = __webpack_require__(7);
9368var call = __webpack_require__(15);
9369var defineBuiltIn = __webpack_require__(44);
9370var setPrototypeOf = __webpack_require__(102);
9371var setToStringTag = __webpack_require__(52);
9372var setSpecies = __webpack_require__(172);
9373var aCallable = __webpack_require__(31);
9374var isCallable = __webpack_require__(8);
9375var isObject = __webpack_require__(11);
9376var anInstance = __webpack_require__(108);
9377var speciesConstructor = __webpack_require__(173);
9378var task = __webpack_require__(175).set;
9379var microtask = __webpack_require__(302);
9380var hostReportErrors = __webpack_require__(305);
9381var perform = __webpack_require__(82);
9382var Queue = __webpack_require__(306);
9383var InternalStateModule = __webpack_require__(43);
9384var NativePromiseConstructor = __webpack_require__(65);
9385var PromiseConstructorDetection = __webpack_require__(83);
9386var newPromiseCapabilityModule = __webpack_require__(54);
9387
9388var PROMISE = 'Promise';
9389var FORCED_PROMISE_CONSTRUCTOR = PromiseConstructorDetection.CONSTRUCTOR;
9390var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;
9391var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;
9392var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
9393var setInternalState = InternalStateModule.set;
9394var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
9395var PromiseConstructor = NativePromiseConstructor;
9396var PromisePrototype = NativePromisePrototype;
9397var TypeError = global.TypeError;
9398var document = global.document;
9399var process = global.process;
9400var newPromiseCapability = newPromiseCapabilityModule.f;
9401var newGenericPromiseCapability = newPromiseCapability;
9402
9403var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
9404var UNHANDLED_REJECTION = 'unhandledrejection';
9405var REJECTION_HANDLED = 'rejectionhandled';
9406var PENDING = 0;
9407var FULFILLED = 1;
9408var REJECTED = 2;
9409var HANDLED = 1;
9410var UNHANDLED = 2;
9411
9412var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
9413
9414// helpers
9415var isThenable = function (it) {
9416 var then;
9417 return isObject(it) && isCallable(then = it.then) ? then : false;
9418};
9419
9420var callReaction = function (reaction, state) {
9421 var value = state.value;
9422 var ok = state.state == FULFILLED;
9423 var handler = ok ? reaction.ok : reaction.fail;
9424 var resolve = reaction.resolve;
9425 var reject = reaction.reject;
9426 var domain = reaction.domain;
9427 var result, then, exited;
9428 try {
9429 if (handler) {
9430 if (!ok) {
9431 if (state.rejection === UNHANDLED) onHandleUnhandled(state);
9432 state.rejection = HANDLED;
9433 }
9434 if (handler === true) result = value;
9435 else {
9436 if (domain) domain.enter();
9437 result = handler(value); // can throw
9438 if (domain) {
9439 domain.exit();
9440 exited = true;
9441 }
9442 }
9443 if (result === reaction.promise) {
9444 reject(TypeError('Promise-chain cycle'));
9445 } else if (then = isThenable(result)) {
9446 call(then, result, resolve, reject);
9447 } else resolve(result);
9448 } else reject(value);
9449 } catch (error) {
9450 if (domain && !exited) domain.exit();
9451 reject(error);
9452 }
9453};
9454
9455var notify = function (state, isReject) {
9456 if (state.notified) return;
9457 state.notified = true;
9458 microtask(function () {
9459 var reactions = state.reactions;
9460 var reaction;
9461 while (reaction = reactions.get()) {
9462 callReaction(reaction, state);
9463 }
9464 state.notified = false;
9465 if (isReject && !state.rejection) onUnhandled(state);
9466 });
9467};
9468
9469var dispatchEvent = function (name, promise, reason) {
9470 var event, handler;
9471 if (DISPATCH_EVENT) {
9472 event = document.createEvent('Event');
9473 event.promise = promise;
9474 event.reason = reason;
9475 event.initEvent(name, false, true);
9476 global.dispatchEvent(event);
9477 } else event = { promise: promise, reason: reason };
9478 if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global['on' + name])) handler(event);
9479 else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
9480};
9481
9482var onUnhandled = function (state) {
9483 call(task, global, function () {
9484 var promise = state.facade;
9485 var value = state.value;
9486 var IS_UNHANDLED = isUnhandled(state);
9487 var result;
9488 if (IS_UNHANDLED) {
9489 result = perform(function () {
9490 if (IS_NODE) {
9491 process.emit('unhandledRejection', value, promise);
9492 } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
9493 });
9494 // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
9495 state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
9496 if (result.error) throw result.value;
9497 }
9498 });
9499};
9500
9501var isUnhandled = function (state) {
9502 return state.rejection !== HANDLED && !state.parent;
9503};
9504
9505var onHandleUnhandled = function (state) {
9506 call(task, global, function () {
9507 var promise = state.facade;
9508 if (IS_NODE) {
9509 process.emit('rejectionHandled', promise);
9510 } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
9511 });
9512};
9513
9514var bind = function (fn, state, unwrap) {
9515 return function (value) {
9516 fn(state, value, unwrap);
9517 };
9518};
9519
9520var internalReject = function (state, value, unwrap) {
9521 if (state.done) return;
9522 state.done = true;
9523 if (unwrap) state = unwrap;
9524 state.value = value;
9525 state.state = REJECTED;
9526 notify(state, true);
9527};
9528
9529var internalResolve = function (state, value, unwrap) {
9530 if (state.done) return;
9531 state.done = true;
9532 if (unwrap) state = unwrap;
9533 try {
9534 if (state.facade === value) throw TypeError("Promise can't be resolved itself");
9535 var then = isThenable(value);
9536 if (then) {
9537 microtask(function () {
9538 var wrapper = { done: false };
9539 try {
9540 call(then, value,
9541 bind(internalResolve, wrapper, state),
9542 bind(internalReject, wrapper, state)
9543 );
9544 } catch (error) {
9545 internalReject(wrapper, error, state);
9546 }
9547 });
9548 } else {
9549 state.value = value;
9550 state.state = FULFILLED;
9551 notify(state, false);
9552 }
9553 } catch (error) {
9554 internalReject({ done: false }, error, state);
9555 }
9556};
9557
9558// constructor polyfill
9559if (FORCED_PROMISE_CONSTRUCTOR) {
9560 // 25.4.3.1 Promise(executor)
9561 PromiseConstructor = function Promise(executor) {
9562 anInstance(this, PromisePrototype);
9563 aCallable(executor);
9564 call(Internal, this);
9565 var state = getInternalPromiseState(this);
9566 try {
9567 executor(bind(internalResolve, state), bind(internalReject, state));
9568 } catch (error) {
9569 internalReject(state, error);
9570 }
9571 };
9572
9573 PromisePrototype = PromiseConstructor.prototype;
9574
9575 // eslint-disable-next-line no-unused-vars -- required for `.length`
9576 Internal = function Promise(executor) {
9577 setInternalState(this, {
9578 type: PROMISE,
9579 done: false,
9580 notified: false,
9581 parent: false,
9582 reactions: new Queue(),
9583 rejection: false,
9584 state: PENDING,
9585 value: undefined
9586 });
9587 };
9588
9589 // `Promise.prototype.then` method
9590 // https://tc39.es/ecma262/#sec-promise.prototype.then
9591 Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
9592 var state = getInternalPromiseState(this);
9593 var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
9594 state.parent = true;
9595 reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
9596 reaction.fail = isCallable(onRejected) && onRejected;
9597 reaction.domain = IS_NODE ? process.domain : undefined;
9598 if (state.state == PENDING) state.reactions.add(reaction);
9599 else microtask(function () {
9600 callReaction(reaction, state);
9601 });
9602 return reaction.promise;
9603 });
9604
9605 OwnPromiseCapability = function () {
9606 var promise = new Internal();
9607 var state = getInternalPromiseState(promise);
9608 this.promise = promise;
9609 this.resolve = bind(internalResolve, state);
9610 this.reject = bind(internalReject, state);
9611 };
9612
9613 newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
9614 return C === PromiseConstructor || C === PromiseWrapper
9615 ? new OwnPromiseCapability(C)
9616 : newGenericPromiseCapability(C);
9617 };
9618
9619 if (!IS_PURE && isCallable(NativePromiseConstructor) && NativePromisePrototype !== Object.prototype) {
9620 nativeThen = NativePromisePrototype.then;
9621
9622 if (!NATIVE_PROMISE_SUBCLASSING) {
9623 // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
9624 defineBuiltIn(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
9625 var that = this;
9626 return new PromiseConstructor(function (resolve, reject) {
9627 call(nativeThen, that, resolve, reject);
9628 }).then(onFulfilled, onRejected);
9629 // https://github.com/zloirock/core-js/issues/640
9630 }, { unsafe: true });
9631 }
9632
9633 // make `.constructor === Promise` work for native promise-based APIs
9634 try {
9635 delete NativePromisePrototype.constructor;
9636 } catch (error) { /* empty */ }
9637
9638 // make `instanceof Promise` work for native promise-based APIs
9639 if (setPrototypeOf) {
9640 setPrototypeOf(NativePromisePrototype, PromisePrototype);
9641 }
9642 }
9643}
9644
9645$({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
9646 Promise: PromiseConstructor
9647});
9648
9649setToStringTag(PromiseConstructor, PROMISE, false, true);
9650setSpecies(PROMISE);
9651
9652
9653/***/ }),
9654/* 301 */
9655/***/ (function(module, exports) {
9656
9657var $TypeError = TypeError;
9658
9659module.exports = function (passed, required) {
9660 if (passed < required) throw $TypeError('Not enough arguments');
9661 return passed;
9662};
9663
9664
9665/***/ }),
9666/* 302 */
9667/***/ (function(module, exports, __webpack_require__) {
9668
9669var global = __webpack_require__(7);
9670var bind = __webpack_require__(48);
9671var getOwnPropertyDescriptor = __webpack_require__(62).f;
9672var macrotask = __webpack_require__(175).set;
9673var IS_IOS = __webpack_require__(176);
9674var IS_IOS_PEBBLE = __webpack_require__(303);
9675var IS_WEBOS_WEBKIT = __webpack_require__(304);
9676var IS_NODE = __webpack_require__(107);
9677
9678var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
9679var document = global.document;
9680var process = global.process;
9681var Promise = global.Promise;
9682// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
9683var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
9684var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
9685
9686var flush, head, last, notify, toggle, node, promise, then;
9687
9688// modern engines have queueMicrotask method
9689if (!queueMicrotask) {
9690 flush = function () {
9691 var parent, fn;
9692 if (IS_NODE && (parent = process.domain)) parent.exit();
9693 while (head) {
9694 fn = head.fn;
9695 head = head.next;
9696 try {
9697 fn();
9698 } catch (error) {
9699 if (head) notify();
9700 else last = undefined;
9701 throw error;
9702 }
9703 } last = undefined;
9704 if (parent) parent.enter();
9705 };
9706
9707 // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
9708 // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
9709 if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) {
9710 toggle = true;
9711 node = document.createTextNode('');
9712 new MutationObserver(flush).observe(node, { characterData: true });
9713 notify = function () {
9714 node.data = toggle = !toggle;
9715 };
9716 // environments with maybe non-completely correct, but existent Promise
9717 } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) {
9718 // Promise.resolve without an argument throws an error in LG WebOS 2
9719 promise = Promise.resolve(undefined);
9720 // workaround of WebKit ~ iOS Safari 10.1 bug
9721 promise.constructor = Promise;
9722 then = bind(promise.then, promise);
9723 notify = function () {
9724 then(flush);
9725 };
9726 // Node.js without promises
9727 } else if (IS_NODE) {
9728 notify = function () {
9729 process.nextTick(flush);
9730 };
9731 // for other environments - macrotask based on:
9732 // - setImmediate
9733 // - MessageChannel
9734 // - window.postMessage
9735 // - onreadystatechange
9736 // - setTimeout
9737 } else {
9738 // strange IE + webpack dev server bug - use .bind(global)
9739 macrotask = bind(macrotask, global);
9740 notify = function () {
9741 macrotask(flush);
9742 };
9743 }
9744}
9745
9746module.exports = queueMicrotask || function (fn) {
9747 var task = { fn: fn, next: undefined };
9748 if (last) last.next = task;
9749 if (!head) {
9750 head = task;
9751 notify();
9752 } last = task;
9753};
9754
9755
9756/***/ }),
9757/* 303 */
9758/***/ (function(module, exports, __webpack_require__) {
9759
9760var userAgent = __webpack_require__(98);
9761var global = __webpack_require__(7);
9762
9763module.exports = /ipad|iphone|ipod/i.test(userAgent) && global.Pebble !== undefined;
9764
9765
9766/***/ }),
9767/* 304 */
9768/***/ (function(module, exports, __webpack_require__) {
9769
9770var userAgent = __webpack_require__(98);
9771
9772module.exports = /web0s(?!.*chrome)/i.test(userAgent);
9773
9774
9775/***/ }),
9776/* 305 */
9777/***/ (function(module, exports, __webpack_require__) {
9778
9779var global = __webpack_require__(7);
9780
9781module.exports = function (a, b) {
9782 var console = global.console;
9783 if (console && console.error) {
9784 arguments.length == 1 ? console.error(a) : console.error(a, b);
9785 }
9786};
9787
9788
9789/***/ }),
9790/* 306 */
9791/***/ (function(module, exports) {
9792
9793var Queue = function () {
9794 this.head = null;
9795 this.tail = null;
9796};
9797
9798Queue.prototype = {
9799 add: function (item) {
9800 var entry = { item: item, next: null };
9801 if (this.head) this.tail.next = entry;
9802 else this.head = entry;
9803 this.tail = entry;
9804 },
9805 get: function () {
9806 var entry = this.head;
9807 if (entry) {
9808 this.head = entry.next;
9809 if (this.tail === entry) this.tail = null;
9810 return entry.item;
9811 }
9812 }
9813};
9814
9815module.exports = Queue;
9816
9817
9818/***/ }),
9819/* 307 */
9820/***/ (function(module, exports) {
9821
9822module.exports = typeof window == 'object' && typeof Deno != 'object';
9823
9824
9825/***/ }),
9826/* 308 */
9827/***/ (function(module, exports, __webpack_require__) {
9828
9829"use strict";
9830
9831var $ = __webpack_require__(0);
9832var call = __webpack_require__(15);
9833var aCallable = __webpack_require__(31);
9834var newPromiseCapabilityModule = __webpack_require__(54);
9835var perform = __webpack_require__(82);
9836var iterate = __webpack_require__(42);
9837var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(177);
9838
9839// `Promise.all` method
9840// https://tc39.es/ecma262/#sec-promise.all
9841$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
9842 all: function all(iterable) {
9843 var C = this;
9844 var capability = newPromiseCapabilityModule.f(C);
9845 var resolve = capability.resolve;
9846 var reject = capability.reject;
9847 var result = perform(function () {
9848 var $promiseResolve = aCallable(C.resolve);
9849 var values = [];
9850 var counter = 0;
9851 var remaining = 1;
9852 iterate(iterable, function (promise) {
9853 var index = counter++;
9854 var alreadyCalled = false;
9855 remaining++;
9856 call($promiseResolve, C, promise).then(function (value) {
9857 if (alreadyCalled) return;
9858 alreadyCalled = true;
9859 values[index] = value;
9860 --remaining || resolve(values);
9861 }, reject);
9862 });
9863 --remaining || resolve(values);
9864 });
9865 if (result.error) reject(result.value);
9866 return capability.promise;
9867 }
9868});
9869
9870
9871/***/ }),
9872/* 309 */
9873/***/ (function(module, exports, __webpack_require__) {
9874
9875"use strict";
9876
9877var $ = __webpack_require__(0);
9878var IS_PURE = __webpack_require__(33);
9879var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(83).CONSTRUCTOR;
9880var NativePromiseConstructor = __webpack_require__(65);
9881var getBuiltIn = __webpack_require__(18);
9882var isCallable = __webpack_require__(8);
9883var defineBuiltIn = __webpack_require__(44);
9884
9885var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
9886
9887// `Promise.prototype.catch` method
9888// https://tc39.es/ecma262/#sec-promise.prototype.catch
9889$({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR, real: true }, {
9890 'catch': function (onRejected) {
9891 return this.then(undefined, onRejected);
9892 }
9893});
9894
9895// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
9896if (!IS_PURE && isCallable(NativePromiseConstructor)) {
9897 var method = getBuiltIn('Promise').prototype['catch'];
9898 if (NativePromisePrototype['catch'] !== method) {
9899 defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });
9900 }
9901}
9902
9903
9904/***/ }),
9905/* 310 */
9906/***/ (function(module, exports, __webpack_require__) {
9907
9908"use strict";
9909
9910var $ = __webpack_require__(0);
9911var call = __webpack_require__(15);
9912var aCallable = __webpack_require__(31);
9913var newPromiseCapabilityModule = __webpack_require__(54);
9914var perform = __webpack_require__(82);
9915var iterate = __webpack_require__(42);
9916var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(177);
9917
9918// `Promise.race` method
9919// https://tc39.es/ecma262/#sec-promise.race
9920$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
9921 race: function race(iterable) {
9922 var C = this;
9923 var capability = newPromiseCapabilityModule.f(C);
9924 var reject = capability.reject;
9925 var result = perform(function () {
9926 var $promiseResolve = aCallable(C.resolve);
9927 iterate(iterable, function (promise) {
9928 call($promiseResolve, C, promise).then(capability.resolve, reject);
9929 });
9930 });
9931 if (result.error) reject(result.value);
9932 return capability.promise;
9933 }
9934});
9935
9936
9937/***/ }),
9938/* 311 */
9939/***/ (function(module, exports, __webpack_require__) {
9940
9941"use strict";
9942
9943var $ = __webpack_require__(0);
9944var call = __webpack_require__(15);
9945var newPromiseCapabilityModule = __webpack_require__(54);
9946var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(83).CONSTRUCTOR;
9947
9948// `Promise.reject` method
9949// https://tc39.es/ecma262/#sec-promise.reject
9950$({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
9951 reject: function reject(r) {
9952 var capability = newPromiseCapabilityModule.f(this);
9953 call(capability.reject, undefined, r);
9954 return capability.promise;
9955 }
9956});
9957
9958
9959/***/ }),
9960/* 312 */
9961/***/ (function(module, exports, __webpack_require__) {
9962
9963"use strict";
9964
9965var $ = __webpack_require__(0);
9966var getBuiltIn = __webpack_require__(18);
9967var IS_PURE = __webpack_require__(33);
9968var NativePromiseConstructor = __webpack_require__(65);
9969var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(83).CONSTRUCTOR;
9970var promiseResolve = __webpack_require__(179);
9971
9972var PromiseConstructorWrapper = getBuiltIn('Promise');
9973var CHECK_WRAPPER = IS_PURE && !FORCED_PROMISE_CONSTRUCTOR;
9974
9975// `Promise.resolve` method
9976// https://tc39.es/ecma262/#sec-promise.resolve
9977$({ target: 'Promise', stat: true, forced: IS_PURE || FORCED_PROMISE_CONSTRUCTOR }, {
9978 resolve: function resolve(x) {
9979 return promiseResolve(CHECK_WRAPPER && this === PromiseConstructorWrapper ? NativePromiseConstructor : this, x);
9980 }
9981});
9982
9983
9984/***/ }),
9985/* 313 */
9986/***/ (function(module, exports, __webpack_require__) {
9987
9988"use strict";
9989
9990var $ = __webpack_require__(0);
9991var call = __webpack_require__(15);
9992var aCallable = __webpack_require__(31);
9993var newPromiseCapabilityModule = __webpack_require__(54);
9994var perform = __webpack_require__(82);
9995var iterate = __webpack_require__(42);
9996
9997// `Promise.allSettled` method
9998// https://tc39.es/ecma262/#sec-promise.allsettled
9999$({ target: 'Promise', stat: true }, {
10000 allSettled: function allSettled(iterable) {
10001 var C = this;
10002 var capability = newPromiseCapabilityModule.f(C);
10003 var resolve = capability.resolve;
10004 var reject = capability.reject;
10005 var result = perform(function () {
10006 var promiseResolve = aCallable(C.resolve);
10007 var values = [];
10008 var counter = 0;
10009 var remaining = 1;
10010 iterate(iterable, function (promise) {
10011 var index = counter++;
10012 var alreadyCalled = false;
10013 remaining++;
10014 call(promiseResolve, C, promise).then(function (value) {
10015 if (alreadyCalled) return;
10016 alreadyCalled = true;
10017 values[index] = { status: 'fulfilled', value: value };
10018 --remaining || resolve(values);
10019 }, function (error) {
10020 if (alreadyCalled) return;
10021 alreadyCalled = true;
10022 values[index] = { status: 'rejected', reason: error };
10023 --remaining || resolve(values);
10024 });
10025 });
10026 --remaining || resolve(values);
10027 });
10028 if (result.error) reject(result.value);
10029 return capability.promise;
10030 }
10031});
10032
10033
10034/***/ }),
10035/* 314 */
10036/***/ (function(module, exports, __webpack_require__) {
10037
10038"use strict";
10039
10040var $ = __webpack_require__(0);
10041var call = __webpack_require__(15);
10042var aCallable = __webpack_require__(31);
10043var getBuiltIn = __webpack_require__(18);
10044var newPromiseCapabilityModule = __webpack_require__(54);
10045var perform = __webpack_require__(82);
10046var iterate = __webpack_require__(42);
10047
10048var PROMISE_ANY_ERROR = 'No one promise resolved';
10049
10050// `Promise.any` method
10051// https://tc39.es/ecma262/#sec-promise.any
10052$({ target: 'Promise', stat: true }, {
10053 any: function any(iterable) {
10054 var C = this;
10055 var AggregateError = getBuiltIn('AggregateError');
10056 var capability = newPromiseCapabilityModule.f(C);
10057 var resolve = capability.resolve;
10058 var reject = capability.reject;
10059 var result = perform(function () {
10060 var promiseResolve = aCallable(C.resolve);
10061 var errors = [];
10062 var counter = 0;
10063 var remaining = 1;
10064 var alreadyResolved = false;
10065 iterate(iterable, function (promise) {
10066 var index = counter++;
10067 var alreadyRejected = false;
10068 remaining++;
10069 call(promiseResolve, C, promise).then(function (value) {
10070 if (alreadyRejected || alreadyResolved) return;
10071 alreadyResolved = true;
10072 resolve(value);
10073 }, function (error) {
10074 if (alreadyRejected || alreadyResolved) return;
10075 alreadyRejected = true;
10076 errors[index] = error;
10077 --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
10078 });
10079 });
10080 --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
10081 });
10082 if (result.error) reject(result.value);
10083 return capability.promise;
10084 }
10085});
10086
10087
10088/***/ }),
10089/* 315 */
10090/***/ (function(module, exports, __webpack_require__) {
10091
10092"use strict";
10093
10094var $ = __webpack_require__(0);
10095var IS_PURE = __webpack_require__(33);
10096var NativePromiseConstructor = __webpack_require__(65);
10097var fails = __webpack_require__(2);
10098var getBuiltIn = __webpack_require__(18);
10099var isCallable = __webpack_require__(8);
10100var speciesConstructor = __webpack_require__(173);
10101var promiseResolve = __webpack_require__(179);
10102var defineBuiltIn = __webpack_require__(44);
10103
10104var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
10105
10106// Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829
10107var NON_GENERIC = !!NativePromiseConstructor && fails(function () {
10108 // eslint-disable-next-line unicorn/no-thenable -- required for testing
10109 NativePromisePrototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ });
10110});
10111
10112// `Promise.prototype.finally` method
10113// https://tc39.es/ecma262/#sec-promise.prototype.finally
10114$({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, {
10115 'finally': function (onFinally) {
10116 var C = speciesConstructor(this, getBuiltIn('Promise'));
10117 var isFunction = isCallable(onFinally);
10118 return this.then(
10119 isFunction ? function (x) {
10120 return promiseResolve(C, onFinally()).then(function () { return x; });
10121 } : onFinally,
10122 isFunction ? function (e) {
10123 return promiseResolve(C, onFinally()).then(function () { throw e; });
10124 } : onFinally
10125 );
10126 }
10127});
10128
10129// makes sure that native promise-based APIs `Promise#finally` properly works with patched `Promise#then`
10130if (!IS_PURE && isCallable(NativePromiseConstructor)) {
10131 var method = getBuiltIn('Promise').prototype['finally'];
10132 if (NativePromisePrototype['finally'] !== method) {
10133 defineBuiltIn(NativePromisePrototype, 'finally', method, { unsafe: true });
10134 }
10135}
10136
10137
10138/***/ }),
10139/* 316 */
10140/***/ (function(module, exports, __webpack_require__) {
10141
10142var uncurryThis = __webpack_require__(4);
10143var toIntegerOrInfinity = __webpack_require__(126);
10144var toString = __webpack_require__(81);
10145var requireObjectCoercible = __webpack_require__(121);
10146
10147var charAt = uncurryThis(''.charAt);
10148var charCodeAt = uncurryThis(''.charCodeAt);
10149var stringSlice = uncurryThis(''.slice);
10150
10151var createMethod = function (CONVERT_TO_STRING) {
10152 return function ($this, pos) {
10153 var S = toString(requireObjectCoercible($this));
10154 var position = toIntegerOrInfinity(pos);
10155 var size = S.length;
10156 var first, second;
10157 if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
10158 first = charCodeAt(S, position);
10159 return first < 0xD800 || first > 0xDBFF || position + 1 === size
10160 || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
10161 ? CONVERT_TO_STRING
10162 ? charAt(S, position)
10163 : first
10164 : CONVERT_TO_STRING
10165 ? stringSlice(S, position, position + 2)
10166 : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
10167 };
10168};
10169
10170module.exports = {
10171 // `String.prototype.codePointAt` method
10172 // https://tc39.es/ecma262/#sec-string.prototype.codepointat
10173 codeAt: createMethod(false),
10174 // `String.prototype.at` method
10175 // https://github.com/mathiasbynens/String.prototype.at
10176 charAt: createMethod(true)
10177};
10178
10179
10180/***/ }),
10181/* 317 */
10182/***/ (function(module, exports) {
10183
10184// iterable DOM collections
10185// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
10186module.exports = {
10187 CSSRuleList: 0,
10188 CSSStyleDeclaration: 0,
10189 CSSValueList: 0,
10190 ClientRectList: 0,
10191 DOMRectList: 0,
10192 DOMStringList: 0,
10193 DOMTokenList: 1,
10194 DataTransferItemList: 0,
10195 FileList: 0,
10196 HTMLAllCollection: 0,
10197 HTMLCollection: 0,
10198 HTMLFormElement: 0,
10199 HTMLSelectElement: 0,
10200 MediaList: 0,
10201 MimeTypeArray: 0,
10202 NamedNodeMap: 0,
10203 NodeList: 1,
10204 PaintRequestList: 0,
10205 Plugin: 0,
10206 PluginArray: 0,
10207 SVGLengthList: 0,
10208 SVGNumberList: 0,
10209 SVGPathSegList: 0,
10210 SVGPointList: 0,
10211 SVGStringList: 0,
10212 SVGTransformList: 0,
10213 SourceBufferList: 0,
10214 StyleSheetList: 0,
10215 TextTrackCueList: 0,
10216 TextTrackList: 0,
10217 TouchList: 0
10218};
10219
10220
10221/***/ }),
10222/* 318 */
10223/***/ (function(module, __webpack_exports__, __webpack_require__) {
10224
10225"use strict";
10226/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_js__ = __webpack_require__(132);
10227// Default Export
10228// ==============
10229// In this module, we mix our bundled exports into the `_` object and export
10230// the result. This is analogous to setting `module.exports = _` in CommonJS.
10231// Hence, this module is also the entry point of our UMD bundle and the package
10232// entry point for CommonJS and AMD users. In other words, this is (the source
10233// of) the module you are interfacing with when you do any of the following:
10234//
10235// ```js
10236// // CommonJS
10237// var _ = require('underscore');
10238//
10239// // AMD
10240// define(['underscore'], function(_) {...});
10241//
10242// // UMD in the browser
10243// // _ is available as a global variable
10244// ```
10245
10246
10247
10248// Add all of the Underscore functions to the wrapper object.
10249var _ = Object(__WEBPACK_IMPORTED_MODULE_0__index_js__["mixin"])(__WEBPACK_IMPORTED_MODULE_0__index_js__);
10250// Legacy Node.js API.
10251_._ = _;
10252// Export the Underscore API.
10253/* harmony default export */ __webpack_exports__["a"] = (_);
10254
10255
10256/***/ }),
10257/* 319 */
10258/***/ (function(module, __webpack_exports__, __webpack_require__) {
10259
10260"use strict";
10261/* harmony export (immutable) */ __webpack_exports__["a"] = isNull;
10262// Is a given value equal to null?
10263function isNull(obj) {
10264 return obj === null;
10265}
10266
10267
10268/***/ }),
10269/* 320 */
10270/***/ (function(module, __webpack_exports__, __webpack_require__) {
10271
10272"use strict";
10273/* harmony export (immutable) */ __webpack_exports__["a"] = isElement;
10274// Is a given value a DOM element?
10275function isElement(obj) {
10276 return !!(obj && obj.nodeType === 1);
10277}
10278
10279
10280/***/ }),
10281/* 321 */
10282/***/ (function(module, __webpack_exports__, __webpack_require__) {
10283
10284"use strict";
10285/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10286
10287
10288/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Date'));
10289
10290
10291/***/ }),
10292/* 322 */
10293/***/ (function(module, __webpack_exports__, __webpack_require__) {
10294
10295"use strict";
10296/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10297
10298
10299/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('RegExp'));
10300
10301
10302/***/ }),
10303/* 323 */
10304/***/ (function(module, __webpack_exports__, __webpack_require__) {
10305
10306"use strict";
10307/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10308
10309
10310/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Error'));
10311
10312
10313/***/ }),
10314/* 324 */
10315/***/ (function(module, __webpack_exports__, __webpack_require__) {
10316
10317"use strict";
10318/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10319
10320
10321/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Object'));
10322
10323
10324/***/ }),
10325/* 325 */
10326/***/ (function(module, __webpack_exports__, __webpack_require__) {
10327
10328"use strict";
10329/* harmony export (immutable) */ __webpack_exports__["a"] = isFinite;
10330/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
10331/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isSymbol_js__ = __webpack_require__(183);
10332
10333
10334
10335// Is a given object a finite number?
10336function isFinite(obj) {
10337 return !Object(__WEBPACK_IMPORTED_MODULE_1__isSymbol_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["f" /* _isFinite */])(obj) && !isNaN(parseFloat(obj));
10338}
10339
10340
10341/***/ }),
10342/* 326 */
10343/***/ (function(module, __webpack_exports__, __webpack_require__) {
10344
10345"use strict";
10346/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(188);
10347/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getByteLength_js__ = __webpack_require__(136);
10348
10349
10350
10351// Internal helper to determine whether we should spend extensive checks against
10352// `ArrayBuffer` et al.
10353/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__getByteLength_js__["a" /* default */]));
10354
10355
10356/***/ }),
10357/* 327 */
10358/***/ (function(module, __webpack_exports__, __webpack_require__) {
10359
10360"use strict";
10361/* harmony export (immutable) */ __webpack_exports__["a"] = isEmpty;
10362/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
10363/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(57);
10364/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(133);
10365/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(135);
10366/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keys_js__ = __webpack_require__(16);
10367
10368
10369
10370
10371
10372
10373// Is a given array, string, or object empty?
10374// An "empty" object has no enumerable own-properties.
10375function isEmpty(obj) {
10376 if (obj == null) return true;
10377 // Skip the more expensive `toString`-based type checks if `obj` has no
10378 // `.length`.
10379 var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(obj);
10380 if (typeof length == 'number' && (
10381 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)
10382 )) return length === 0;
10383 return Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__keys_js__["a" /* default */])(obj)) === 0;
10384}
10385
10386
10387/***/ }),
10388/* 328 */
10389/***/ (function(module, __webpack_exports__, __webpack_require__) {
10390
10391"use strict";
10392/* harmony export (immutable) */ __webpack_exports__["a"] = isEqual;
10393/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
10394/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
10395/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getByteLength_js__ = __webpack_require__(136);
10396/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__ = __webpack_require__(186);
10397/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isFunction_js__ = __webpack_require__(28);
10398/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__ = __webpack_require__(84);
10399/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isDataView_js__ = __webpack_require__(134);
10400/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__keys_js__ = __webpack_require__(16);
10401/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__has_js__ = __webpack_require__(45);
10402/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__toBufferView_js__ = __webpack_require__(329);
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414// We use this string twice, so give it a name for minification.
10415var tagDataView = '[object DataView]';
10416
10417// Internal recursive comparison function for `_.isEqual`.
10418function eq(a, b, aStack, bStack) {
10419 // Identical objects are equal. `0 === -0`, but they aren't identical.
10420 // See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal).
10421 if (a === b) return a !== 0 || 1 / a === 1 / b;
10422 // `null` or `undefined` only equal to itself (strict comparison).
10423 if (a == null || b == null) return false;
10424 // `NaN`s are equivalent, but non-reflexive.
10425 if (a !== a) return b !== b;
10426 // Exhaust primitive checks
10427 var type = typeof a;
10428 if (type !== 'function' && type !== 'object' && typeof b != 'object') return false;
10429 return deepEq(a, b, aStack, bStack);
10430}
10431
10432// Internal recursive comparison function for `_.isEqual`.
10433function deepEq(a, b, aStack, bStack) {
10434 // Unwrap any wrapped objects.
10435 if (a instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) a = a._wrapped;
10436 if (b instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) b = b._wrapped;
10437 // Compare `[[Class]]` names.
10438 var className = __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(a);
10439 if (className !== __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(b)) return false;
10440 // Work around a bug in IE 10 - Edge 13.
10441 if (__WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__["a" /* hasStringTagBug */] && className == '[object Object]' && Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(a)) {
10442 if (!Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(b)) return false;
10443 className = tagDataView;
10444 }
10445 switch (className) {
10446 // These types are compared by value.
10447 case '[object RegExp]':
10448 // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
10449 case '[object String]':
10450 // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
10451 // equivalent to `new String("5")`.
10452 return '' + a === '' + b;
10453 case '[object Number]':
10454 // `NaN`s are equivalent, but non-reflexive.
10455 // Object(NaN) is equivalent to NaN.
10456 if (+a !== +a) return +b !== +b;
10457 // An `egal` comparison is performed for other numeric values.
10458 return +a === 0 ? 1 / +a === 1 / b : +a === +b;
10459 case '[object Date]':
10460 case '[object Boolean]':
10461 // Coerce dates and booleans to numeric primitive values. Dates are compared by their
10462 // millisecond representations. Note that invalid dates with millisecond representations
10463 // of `NaN` are not equivalent.
10464 return +a === +b;
10465 case '[object Symbol]':
10466 return __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(a) === __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(b);
10467 case '[object ArrayBuffer]':
10468 case tagDataView:
10469 // Coerce to typed array so we can fall through.
10470 return deepEq(Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(a), Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(b), aStack, bStack);
10471 }
10472
10473 var areArrays = className === '[object Array]';
10474 if (!areArrays && Object(__WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__["a" /* default */])(a)) {
10475 var byteLength = Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(a);
10476 if (byteLength !== Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(b)) return false;
10477 if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true;
10478 areArrays = true;
10479 }
10480 if (!areArrays) {
10481 if (typeof a != 'object' || typeof b != 'object') return false;
10482
10483 // Objects with different constructors are not equivalent, but `Object`s or `Array`s
10484 // from different frames are.
10485 var aCtor = a.constructor, bCtor = b.constructor;
10486 if (aCtor !== bCtor && !(Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(aCtor) && aCtor instanceof aCtor &&
10487 Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(bCtor) && bCtor instanceof bCtor)
10488 && ('constructor' in a && 'constructor' in b)) {
10489 return false;
10490 }
10491 }
10492 // Assume equality for cyclic structures. The algorithm for detecting cyclic
10493 // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
10494
10495 // Initializing stack of traversed objects.
10496 // It's done here since we only need them for objects and arrays comparison.
10497 aStack = aStack || [];
10498 bStack = bStack || [];
10499 var length = aStack.length;
10500 while (length--) {
10501 // Linear search. Performance is inversely proportional to the number of
10502 // unique nested structures.
10503 if (aStack[length] === a) return bStack[length] === b;
10504 }
10505
10506 // Add the first object to the stack of traversed objects.
10507 aStack.push(a);
10508 bStack.push(b);
10509
10510 // Recursively compare objects and arrays.
10511 if (areArrays) {
10512 // Compare array lengths to determine if a deep comparison is necessary.
10513 length = a.length;
10514 if (length !== b.length) return false;
10515 // Deep compare the contents, ignoring non-numeric properties.
10516 while (length--) {
10517 if (!eq(a[length], b[length], aStack, bStack)) return false;
10518 }
10519 } else {
10520 // Deep compare objects.
10521 var _keys = Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(a), key;
10522 length = _keys.length;
10523 // Ensure that both objects contain the same number of properties before comparing deep equality.
10524 if (Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(b).length !== length) return false;
10525 while (length--) {
10526 // Deep compare each member
10527 key = _keys[length];
10528 if (!(Object(__WEBPACK_IMPORTED_MODULE_8__has_js__["a" /* default */])(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
10529 }
10530 }
10531 // Remove the first object from the stack of traversed objects.
10532 aStack.pop();
10533 bStack.pop();
10534 return true;
10535}
10536
10537// Perform a deep comparison to check if two objects are equal.
10538function isEqual(a, b) {
10539 return eq(a, b);
10540}
10541
10542
10543/***/ }),
10544/* 329 */
10545/***/ (function(module, __webpack_exports__, __webpack_require__) {
10546
10547"use strict";
10548/* harmony export (immutable) */ __webpack_exports__["a"] = toBufferView;
10549/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getByteLength_js__ = __webpack_require__(136);
10550
10551
10552// Internal function to wrap or shallow-copy an ArrayBuffer,
10553// typed array or DataView to a new view, reusing the buffer.
10554function toBufferView(bufferSource) {
10555 return new Uint8Array(
10556 bufferSource.buffer || bufferSource,
10557 bufferSource.byteOffset || 0,
10558 Object(__WEBPACK_IMPORTED_MODULE_0__getByteLength_js__["a" /* default */])(bufferSource)
10559 );
10560}
10561
10562
10563/***/ }),
10564/* 330 */
10565/***/ (function(module, __webpack_exports__, __webpack_require__) {
10566
10567"use strict";
10568/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10569/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(84);
10570/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(137);
10571
10572
10573
10574
10575/* 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'));
10576
10577
10578/***/ }),
10579/* 331 */
10580/***/ (function(module, __webpack_exports__, __webpack_require__) {
10581
10582"use strict";
10583/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10584/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(84);
10585/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(137);
10586
10587
10588
10589
10590/* 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'));
10591
10592
10593/***/ }),
10594/* 332 */
10595/***/ (function(module, __webpack_exports__, __webpack_require__) {
10596
10597"use strict";
10598/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10599/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(84);
10600/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(137);
10601
10602
10603
10604
10605/* 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'));
10606
10607
10608/***/ }),
10609/* 333 */
10610/***/ (function(module, __webpack_exports__, __webpack_require__) {
10611
10612"use strict";
10613/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10614
10615
10616/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('WeakSet'));
10617
10618
10619/***/ }),
10620/* 334 */
10621/***/ (function(module, __webpack_exports__, __webpack_require__) {
10622
10623"use strict";
10624/* harmony export (immutable) */ __webpack_exports__["a"] = pairs;
10625/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
10626
10627
10628// Convert an object into a list of `[key, value]` pairs.
10629// The opposite of `_.object` with one argument.
10630function pairs(obj) {
10631 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
10632 var length = _keys.length;
10633 var pairs = Array(length);
10634 for (var i = 0; i < length; i++) {
10635 pairs[i] = [_keys[i], obj[_keys[i]]];
10636 }
10637 return pairs;
10638}
10639
10640
10641/***/ }),
10642/* 335 */
10643/***/ (function(module, __webpack_exports__, __webpack_require__) {
10644
10645"use strict";
10646/* harmony export (immutable) */ __webpack_exports__["a"] = create;
10647/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(196);
10648/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__extendOwn_js__ = __webpack_require__(139);
10649
10650
10651
10652// Creates an object that inherits from the given prototype object.
10653// If additional properties are provided then they will be added to the
10654// created object.
10655function create(prototype, props) {
10656 var result = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(prototype);
10657 if (props) Object(__WEBPACK_IMPORTED_MODULE_1__extendOwn_js__["a" /* default */])(result, props);
10658 return result;
10659}
10660
10661
10662/***/ }),
10663/* 336 */
10664/***/ (function(module, __webpack_exports__, __webpack_require__) {
10665
10666"use strict";
10667/* harmony export (immutable) */ __webpack_exports__["a"] = tap;
10668// Invokes `interceptor` with the `obj` and then returns `obj`.
10669// The primary purpose of this method is to "tap into" a method chain, in
10670// order to perform operations on intermediate results within the chain.
10671function tap(obj, interceptor) {
10672 interceptor(obj);
10673 return obj;
10674}
10675
10676
10677/***/ }),
10678/* 337 */
10679/***/ (function(module, __webpack_exports__, __webpack_require__) {
10680
10681"use strict";
10682/* harmony export (immutable) */ __webpack_exports__["a"] = has;
10683/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(45);
10684/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(86);
10685
10686
10687
10688// Shortcut function for checking if an object has a given property directly on
10689// itself (in other words, not on a prototype). Unlike the internal `has`
10690// function, this public version can also traverse nested properties.
10691function has(obj, path) {
10692 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
10693 var length = path.length;
10694 for (var i = 0; i < length; i++) {
10695 var key = path[i];
10696 if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(obj, key)) return false;
10697 obj = obj[key];
10698 }
10699 return !!length;
10700}
10701
10702
10703/***/ }),
10704/* 338 */
10705/***/ (function(module, __webpack_exports__, __webpack_require__) {
10706
10707"use strict";
10708/* harmony export (immutable) */ __webpack_exports__["a"] = mapObject;
10709/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
10710/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
10711
10712
10713
10714// Returns the results of applying the `iteratee` to each element of `obj`.
10715// In contrast to `_.map` it returns an object.
10716function mapObject(obj, iteratee, context) {
10717 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
10718 var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
10719 length = _keys.length,
10720 results = {};
10721 for (var index = 0; index < length; index++) {
10722 var currentKey = _keys[index];
10723 results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
10724 }
10725 return results;
10726}
10727
10728
10729/***/ }),
10730/* 339 */
10731/***/ (function(module, __webpack_exports__, __webpack_require__) {
10732
10733"use strict";
10734/* harmony export (immutable) */ __webpack_exports__["a"] = propertyOf;
10735/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__noop_js__ = __webpack_require__(202);
10736/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__get_js__ = __webpack_require__(198);
10737
10738
10739
10740// Generates a function for a given object that returns a given property.
10741function propertyOf(obj) {
10742 if (obj == null) return __WEBPACK_IMPORTED_MODULE_0__noop_js__["a" /* default */];
10743 return function(path) {
10744 return Object(__WEBPACK_IMPORTED_MODULE_1__get_js__["a" /* default */])(obj, path);
10745 };
10746}
10747
10748
10749/***/ }),
10750/* 340 */
10751/***/ (function(module, __webpack_exports__, __webpack_require__) {
10752
10753"use strict";
10754/* harmony export (immutable) */ __webpack_exports__["a"] = times;
10755/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(87);
10756
10757
10758// Run a function **n** times.
10759function times(n, iteratee, context) {
10760 var accum = Array(Math.max(0, n));
10761 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context, 1);
10762 for (var i = 0; i < n; i++) accum[i] = iteratee(i);
10763 return accum;
10764}
10765
10766
10767/***/ }),
10768/* 341 */
10769/***/ (function(module, __webpack_exports__, __webpack_require__) {
10770
10771"use strict";
10772/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(204);
10773/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(205);
10774
10775
10776
10777// Function for escaping strings to HTML interpolation.
10778/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
10779
10780
10781/***/ }),
10782/* 342 */
10783/***/ (function(module, __webpack_exports__, __webpack_require__) {
10784
10785"use strict";
10786/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(204);
10787/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__ = __webpack_require__(343);
10788
10789
10790
10791// Function for unescaping strings from HTML interpolation.
10792/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__["a" /* default */]));
10793
10794
10795/***/ }),
10796/* 343 */
10797/***/ (function(module, __webpack_exports__, __webpack_require__) {
10798
10799"use strict";
10800/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__invert_js__ = __webpack_require__(192);
10801/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(205);
10802
10803
10804
10805// Internal list of HTML entities for unescaping.
10806/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__invert_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
10807
10808
10809/***/ }),
10810/* 344 */
10811/***/ (function(module, __webpack_exports__, __webpack_require__) {
10812
10813"use strict";
10814/* harmony export (immutable) */ __webpack_exports__["a"] = template;
10815/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__defaults_js__ = __webpack_require__(195);
10816/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__underscore_js__ = __webpack_require__(25);
10817/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__templateSettings_js__ = __webpack_require__(206);
10818
10819
10820
10821
10822// When customizing `_.templateSettings`, if you don't want to define an
10823// interpolation, evaluation or escaping regex, we need one that is
10824// guaranteed not to match.
10825var noMatch = /(.)^/;
10826
10827// Certain characters need to be escaped so that they can be put into a
10828// string literal.
10829var escapes = {
10830 "'": "'",
10831 '\\': '\\',
10832 '\r': 'r',
10833 '\n': 'n',
10834 '\u2028': 'u2028',
10835 '\u2029': 'u2029'
10836};
10837
10838var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g;
10839
10840function escapeChar(match) {
10841 return '\\' + escapes[match];
10842}
10843
10844var bareIdentifier = /^\s*(\w|\$)+\s*$/;
10845
10846// JavaScript micro-templating, similar to John Resig's implementation.
10847// Underscore templating handles arbitrary delimiters, preserves whitespace,
10848// and correctly escapes quotes within interpolated code.
10849// NB: `oldSettings` only exists for backwards compatibility.
10850function template(text, settings, oldSettings) {
10851 if (!settings && oldSettings) settings = oldSettings;
10852 settings = Object(__WEBPACK_IMPORTED_MODULE_0__defaults_js__["a" /* default */])({}, settings, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */].templateSettings);
10853
10854 // Combine delimiters into one regular expression via alternation.
10855 var matcher = RegExp([
10856 (settings.escape || noMatch).source,
10857 (settings.interpolate || noMatch).source,
10858 (settings.evaluate || noMatch).source
10859 ].join('|') + '|$', 'g');
10860
10861 // Compile the template source, escaping string literals appropriately.
10862 var index = 0;
10863 var source = "__p+='";
10864 text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
10865 source += text.slice(index, offset).replace(escapeRegExp, escapeChar);
10866 index = offset + match.length;
10867
10868 if (escape) {
10869 source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
10870 } else if (interpolate) {
10871 source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
10872 } else if (evaluate) {
10873 source += "';\n" + evaluate + "\n__p+='";
10874 }
10875
10876 // Adobe VMs need the match returned to produce the correct offset.
10877 return match;
10878 });
10879 source += "';\n";
10880
10881 var argument = settings.variable;
10882 if (argument) {
10883 if (!bareIdentifier.test(argument)) throw new Error(argument);
10884 } else {
10885 // If a variable is not specified, place data values in local scope.
10886 source = 'with(obj||{}){\n' + source + '}\n';
10887 argument = 'obj';
10888 }
10889
10890 source = "var __t,__p='',__j=Array.prototype.join," +
10891 "print=function(){__p+=__j.call(arguments,'');};\n" +
10892 source + 'return __p;\n';
10893
10894 var render;
10895 try {
10896 render = new Function(argument, '_', source);
10897 } catch (e) {
10898 e.source = source;
10899 throw e;
10900 }
10901
10902 var template = function(data) {
10903 return render.call(this, data, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */]);
10904 };
10905
10906 // Provide the compiled source as a convenience for precompilation.
10907 template.source = 'function(' + argument + '){\n' + source + '}';
10908
10909 return template;
10910}
10911
10912
10913/***/ }),
10914/* 345 */
10915/***/ (function(module, __webpack_exports__, __webpack_require__) {
10916
10917"use strict";
10918/* harmony export (immutable) */ __webpack_exports__["a"] = result;
10919/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(28);
10920/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(86);
10921
10922
10923
10924// Traverses the children of `obj` along `path`. If a child is a function, it
10925// is invoked with its parent as context. Returns the value of the final
10926// child, or `fallback` if any child is undefined.
10927function result(obj, path, fallback) {
10928 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
10929 var length = path.length;
10930 if (!length) {
10931 return Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(fallback) ? fallback.call(obj) : fallback;
10932 }
10933 for (var i = 0; i < length; i++) {
10934 var prop = obj == null ? void 0 : obj[path[i]];
10935 if (prop === void 0) {
10936 prop = fallback;
10937 i = length; // Ensure we don't continue iterating.
10938 }
10939 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(prop) ? prop.call(obj) : prop;
10940 }
10941 return obj;
10942}
10943
10944
10945/***/ }),
10946/* 346 */
10947/***/ (function(module, __webpack_exports__, __webpack_require__) {
10948
10949"use strict";
10950/* harmony export (immutable) */ __webpack_exports__["a"] = uniqueId;
10951// Generate a unique integer id (unique within the entire client session).
10952// Useful for temporary DOM ids.
10953var idCounter = 0;
10954function uniqueId(prefix) {
10955 var id = ++idCounter + '';
10956 return prefix ? prefix + id : id;
10957}
10958
10959
10960/***/ }),
10961/* 347 */
10962/***/ (function(module, __webpack_exports__, __webpack_require__) {
10963
10964"use strict";
10965/* harmony export (immutable) */ __webpack_exports__["a"] = chain;
10966/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
10967
10968
10969// Start chaining a wrapped Underscore object.
10970function chain(obj) {
10971 var instance = Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj);
10972 instance._chain = true;
10973 return instance;
10974}
10975
10976
10977/***/ }),
10978/* 348 */
10979/***/ (function(module, __webpack_exports__, __webpack_require__) {
10980
10981"use strict";
10982/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
10983/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(67);
10984/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bind_js__ = __webpack_require__(208);
10985
10986
10987
10988
10989// Bind a number of an object's methods to that object. Remaining arguments
10990// are the method names to be bound. Useful for ensuring that all callbacks
10991// defined on an object belong to it.
10992/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
10993 keys = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(keys, false, false);
10994 var index = keys.length;
10995 if (index < 1) throw new Error('bindAll must be passed function names');
10996 while (index--) {
10997 var key = keys[index];
10998 obj[key] = Object(__WEBPACK_IMPORTED_MODULE_2__bind_js__["a" /* default */])(obj[key], obj);
10999 }
11000 return obj;
11001}));
11002
11003
11004/***/ }),
11005/* 349 */
11006/***/ (function(module, __webpack_exports__, __webpack_require__) {
11007
11008"use strict";
11009/* harmony export (immutable) */ __webpack_exports__["a"] = memoize;
11010/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(45);
11011
11012
11013// Memoize an expensive function by storing its results.
11014function memoize(func, hasher) {
11015 var memoize = function(key) {
11016 var cache = memoize.cache;
11017 var address = '' + (hasher ? hasher.apply(this, arguments) : key);
11018 if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(cache, address)) cache[address] = func.apply(this, arguments);
11019 return cache[address];
11020 };
11021 memoize.cache = {};
11022 return memoize;
11023}
11024
11025
11026/***/ }),
11027/* 350 */
11028/***/ (function(module, __webpack_exports__, __webpack_require__) {
11029
11030"use strict";
11031/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(112);
11032/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__delay_js__ = __webpack_require__(209);
11033/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(25);
11034
11035
11036
11037
11038// Defers a function, scheduling it to run after the current call stack has
11039// cleared.
11040/* 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));
11041
11042
11043/***/ }),
11044/* 351 */
11045/***/ (function(module, __webpack_exports__, __webpack_require__) {
11046
11047"use strict";
11048/* harmony export (immutable) */ __webpack_exports__["a"] = throttle;
11049/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__now_js__ = __webpack_require__(143);
11050
11051
11052// Returns a function, that, when invoked, will only be triggered at most once
11053// during a given window of time. Normally, the throttled function will run
11054// as much as it can, without ever going more than once per `wait` duration;
11055// but if you'd like to disable the execution on the leading edge, pass
11056// `{leading: false}`. To disable execution on the trailing edge, ditto.
11057function throttle(func, wait, options) {
11058 var timeout, context, args, result;
11059 var previous = 0;
11060 if (!options) options = {};
11061
11062 var later = function() {
11063 previous = options.leading === false ? 0 : Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
11064 timeout = null;
11065 result = func.apply(context, args);
11066 if (!timeout) context = args = null;
11067 };
11068
11069 var throttled = function() {
11070 var _now = Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
11071 if (!previous && options.leading === false) previous = _now;
11072 var remaining = wait - (_now - previous);
11073 context = this;
11074 args = arguments;
11075 if (remaining <= 0 || remaining > wait) {
11076 if (timeout) {
11077 clearTimeout(timeout);
11078 timeout = null;
11079 }
11080 previous = _now;
11081 result = func.apply(context, args);
11082 if (!timeout) context = args = null;
11083 } else if (!timeout && options.trailing !== false) {
11084 timeout = setTimeout(later, remaining);
11085 }
11086 return result;
11087 };
11088
11089 throttled.cancel = function() {
11090 clearTimeout(timeout);
11091 previous = 0;
11092 timeout = context = args = null;
11093 };
11094
11095 return throttled;
11096}
11097
11098
11099/***/ }),
11100/* 352 */
11101/***/ (function(module, __webpack_exports__, __webpack_require__) {
11102
11103"use strict";
11104/* harmony export (immutable) */ __webpack_exports__["a"] = debounce;
11105/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11106/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__now_js__ = __webpack_require__(143);
11107
11108
11109
11110// When a sequence of calls of the returned function ends, the argument
11111// function is triggered. The end of a sequence is defined by the `wait`
11112// parameter. If `immediate` is passed, the argument function will be
11113// triggered at the beginning of the sequence instead of at the end.
11114function debounce(func, wait, immediate) {
11115 var timeout, previous, args, result, context;
11116
11117 var later = function() {
11118 var passed = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])() - previous;
11119 if (wait > passed) {
11120 timeout = setTimeout(later, wait - passed);
11121 } else {
11122 timeout = null;
11123 if (!immediate) result = func.apply(context, args);
11124 // This check is needed because `func` can recursively invoke `debounced`.
11125 if (!timeout) args = context = null;
11126 }
11127 };
11128
11129 var debounced = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(_args) {
11130 context = this;
11131 args = _args;
11132 previous = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])();
11133 if (!timeout) {
11134 timeout = setTimeout(later, wait);
11135 if (immediate) result = func.apply(context, args);
11136 }
11137 return result;
11138 });
11139
11140 debounced.cancel = function() {
11141 clearTimeout(timeout);
11142 timeout = args = context = null;
11143 };
11144
11145 return debounced;
11146}
11147
11148
11149/***/ }),
11150/* 353 */
11151/***/ (function(module, __webpack_exports__, __webpack_require__) {
11152
11153"use strict";
11154/* harmony export (immutable) */ __webpack_exports__["a"] = wrap;
11155/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(112);
11156
11157
11158// Returns the first function passed as an argument to the second,
11159// allowing you to adjust arguments, run code before and after, and
11160// conditionally execute the original function.
11161function wrap(func, wrapper) {
11162 return Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(wrapper, func);
11163}
11164
11165
11166/***/ }),
11167/* 354 */
11168/***/ (function(module, __webpack_exports__, __webpack_require__) {
11169
11170"use strict";
11171/* harmony export (immutable) */ __webpack_exports__["a"] = compose;
11172// Returns a function that is the composition of a list of functions, each
11173// consuming the return value of the function that follows.
11174function compose() {
11175 var args = arguments;
11176 var start = args.length - 1;
11177 return function() {
11178 var i = start;
11179 var result = args[start].apply(this, arguments);
11180 while (i--) result = args[i].call(this, result);
11181 return result;
11182 };
11183}
11184
11185
11186/***/ }),
11187/* 355 */
11188/***/ (function(module, __webpack_exports__, __webpack_require__) {
11189
11190"use strict";
11191/* harmony export (immutable) */ __webpack_exports__["a"] = after;
11192// Returns a function that will only be executed on and after the Nth call.
11193function after(times, func) {
11194 return function() {
11195 if (--times < 1) {
11196 return func.apply(this, arguments);
11197 }
11198 };
11199}
11200
11201
11202/***/ }),
11203/* 356 */
11204/***/ (function(module, __webpack_exports__, __webpack_require__) {
11205
11206"use strict";
11207/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(112);
11208/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__before_js__ = __webpack_require__(210);
11209
11210
11211
11212// Returns a function that will be executed at most one time, no matter how
11213// often you call it. Useful for lazy initialization.
11214/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__before_js__["a" /* default */], 2));
11215
11216
11217/***/ }),
11218/* 357 */
11219/***/ (function(module, __webpack_exports__, __webpack_require__) {
11220
11221"use strict";
11222/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__ = __webpack_require__(213);
11223/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__ = __webpack_require__(216);
11224
11225
11226
11227// Return the position of the last occurrence of an item in an array,
11228// or -1 if the item is not included in the array.
11229/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__["a" /* default */])(-1, __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__["a" /* default */]));
11230
11231
11232/***/ }),
11233/* 358 */
11234/***/ (function(module, __webpack_exports__, __webpack_require__) {
11235
11236"use strict";
11237/* harmony export (immutable) */ __webpack_exports__["a"] = findWhere;
11238/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__find_js__ = __webpack_require__(217);
11239/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(111);
11240
11241
11242
11243// Convenience version of a common use case of `_.find`: getting the first
11244// object containing specific `key:value` pairs.
11245function findWhere(obj, attrs) {
11246 return Object(__WEBPACK_IMPORTED_MODULE_0__find_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
11247}
11248
11249
11250/***/ }),
11251/* 359 */
11252/***/ (function(module, __webpack_exports__, __webpack_require__) {
11253
11254"use strict";
11255/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(218);
11256
11257
11258// **Reduce** builds up a single result from a list of values, aka `inject`,
11259// or `foldl`.
11260/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(1));
11261
11262
11263/***/ }),
11264/* 360 */
11265/***/ (function(module, __webpack_exports__, __webpack_require__) {
11266
11267"use strict";
11268/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(218);
11269
11270
11271// The right-associative version of reduce, also known as `foldr`.
11272/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(-1));
11273
11274
11275/***/ }),
11276/* 361 */
11277/***/ (function(module, __webpack_exports__, __webpack_require__) {
11278
11279"use strict";
11280/* harmony export (immutable) */ __webpack_exports__["a"] = reject;
11281/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(88);
11282/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__negate_js__ = __webpack_require__(144);
11283/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(21);
11284
11285
11286
11287
11288// Return all the elements for which a truth test fails.
11289function reject(obj, predicate, context) {
11290 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);
11291}
11292
11293
11294/***/ }),
11295/* 362 */
11296/***/ (function(module, __webpack_exports__, __webpack_require__) {
11297
11298"use strict";
11299/* harmony export (immutable) */ __webpack_exports__["a"] = every;
11300/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
11301/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
11302/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16);
11303
11304
11305
11306
11307// Determine whether all of the elements pass a truth test.
11308function every(obj, predicate, context) {
11309 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
11310 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
11311 length = (_keys || obj).length;
11312 for (var index = 0; index < length; index++) {
11313 var currentKey = _keys ? _keys[index] : index;
11314 if (!predicate(obj[currentKey], currentKey, obj)) return false;
11315 }
11316 return true;
11317}
11318
11319
11320/***/ }),
11321/* 363 */
11322/***/ (function(module, __webpack_exports__, __webpack_require__) {
11323
11324"use strict";
11325/* harmony export (immutable) */ __webpack_exports__["a"] = some;
11326/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
11327/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
11328/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16);
11329
11330
11331
11332
11333// Determine if at least one element in the object passes a truth test.
11334function some(obj, predicate, context) {
11335 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
11336 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
11337 length = (_keys || obj).length;
11338 for (var index = 0; index < length; index++) {
11339 var currentKey = _keys ? _keys[index] : index;
11340 if (predicate(obj[currentKey], currentKey, obj)) return true;
11341 }
11342 return false;
11343}
11344
11345
11346/***/ }),
11347/* 364 */
11348/***/ (function(module, __webpack_exports__, __webpack_require__) {
11349
11350"use strict";
11351/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11352/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
11353/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(68);
11354/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__deepGet_js__ = __webpack_require__(140);
11355/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__toPath_js__ = __webpack_require__(86);
11356
11357
11358
11359
11360
11361
11362// Invoke a method (with arguments) on every item in a collection.
11363/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, path, args) {
11364 var contextPath, func;
11365 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(path)) {
11366 func = path;
11367 } else {
11368 path = Object(__WEBPACK_IMPORTED_MODULE_4__toPath_js__["a" /* default */])(path);
11369 contextPath = path.slice(0, -1);
11370 path = path[path.length - 1];
11371 }
11372 return Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(context) {
11373 var method = func;
11374 if (!method) {
11375 if (contextPath && contextPath.length) {
11376 context = Object(__WEBPACK_IMPORTED_MODULE_3__deepGet_js__["a" /* default */])(context, contextPath);
11377 }
11378 if (context == null) return void 0;
11379 method = context[path];
11380 }
11381 return method == null ? method : method.apply(context, args);
11382 });
11383}));
11384
11385
11386/***/ }),
11387/* 365 */
11388/***/ (function(module, __webpack_exports__, __webpack_require__) {
11389
11390"use strict";
11391/* harmony export (immutable) */ __webpack_exports__["a"] = where;
11392/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(88);
11393/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(111);
11394
11395
11396
11397// Convenience version of a common use case of `_.filter`: selecting only
11398// objects containing specific `key:value` pairs.
11399function where(obj, attrs) {
11400 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
11401}
11402
11403
11404/***/ }),
11405/* 366 */
11406/***/ (function(module, __webpack_exports__, __webpack_require__) {
11407
11408"use strict";
11409/* harmony export (immutable) */ __webpack_exports__["a"] = min;
11410/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
11411/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(66);
11412/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(21);
11413/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(58);
11414
11415
11416
11417
11418
11419// Return the minimum element (or element-based computation).
11420function min(obj, iteratee, context) {
11421 var result = Infinity, lastComputed = Infinity,
11422 value, computed;
11423 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
11424 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
11425 for (var i = 0, length = obj.length; i < length; i++) {
11426 value = obj[i];
11427 if (value != null && value < result) {
11428 result = value;
11429 }
11430 }
11431 } else {
11432 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
11433 Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
11434 computed = iteratee(v, index, list);
11435 if (computed < lastComputed || computed === Infinity && result === Infinity) {
11436 result = v;
11437 lastComputed = computed;
11438 }
11439 });
11440 }
11441 return result;
11442}
11443
11444
11445/***/ }),
11446/* 367 */
11447/***/ (function(module, __webpack_exports__, __webpack_require__) {
11448
11449"use strict";
11450/* harmony export (immutable) */ __webpack_exports__["a"] = shuffle;
11451/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sample_js__ = __webpack_require__(220);
11452
11453
11454// Shuffle a collection.
11455function shuffle(obj) {
11456 return Object(__WEBPACK_IMPORTED_MODULE_0__sample_js__["a" /* default */])(obj, Infinity);
11457}
11458
11459
11460/***/ }),
11461/* 368 */
11462/***/ (function(module, __webpack_exports__, __webpack_require__) {
11463
11464"use strict";
11465/* harmony export (immutable) */ __webpack_exports__["a"] = sortBy;
11466/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
11467/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__pluck_js__ = __webpack_require__(146);
11468/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(68);
11469
11470
11471
11472
11473// Sort the object's values by a criterion produced by an iteratee.
11474function sortBy(obj, iteratee, context) {
11475 var index = 0;
11476 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
11477 return Object(__WEBPACK_IMPORTED_MODULE_1__pluck_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(value, key, list) {
11478 return {
11479 value: value,
11480 index: index++,
11481 criteria: iteratee(value, key, list)
11482 };
11483 }).sort(function(left, right) {
11484 var a = left.criteria;
11485 var b = right.criteria;
11486 if (a !== b) {
11487 if (a > b || a === void 0) return 1;
11488 if (a < b || b === void 0) return -1;
11489 }
11490 return left.index - right.index;
11491 }), 'value');
11492}
11493
11494
11495/***/ }),
11496/* 369 */
11497/***/ (function(module, __webpack_exports__, __webpack_require__) {
11498
11499"use strict";
11500/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(113);
11501/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(45);
11502
11503
11504
11505// Groups the object's values by a criterion. Pass either a string attribute
11506// to group by, or a function that returns the criterion.
11507/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
11508 if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key].push(value); else result[key] = [value];
11509}));
11510
11511
11512/***/ }),
11513/* 370 */
11514/***/ (function(module, __webpack_exports__, __webpack_require__) {
11515
11516"use strict";
11517/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(113);
11518
11519
11520// Indexes the object's values by a criterion, similar to `_.groupBy`, but for
11521// when you know that your index values will be unique.
11522/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
11523 result[key] = value;
11524}));
11525
11526
11527/***/ }),
11528/* 371 */
11529/***/ (function(module, __webpack_exports__, __webpack_require__) {
11530
11531"use strict";
11532/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(113);
11533/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(45);
11534
11535
11536
11537// Counts instances of an object that group by a certain criterion. Pass
11538// either a string attribute to count by, or a function that returns the
11539// criterion.
11540/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
11541 if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key]++; else result[key] = 1;
11542}));
11543
11544
11545/***/ }),
11546/* 372 */
11547/***/ (function(module, __webpack_exports__, __webpack_require__) {
11548
11549"use strict";
11550/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(113);
11551
11552
11553// Split a collection into two arrays: one whose elements all pass the given
11554// truth test, and one whose elements all do not pass the truth test.
11555/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, pass) {
11556 result[pass ? 0 : 1].push(value);
11557}, true));
11558
11559
11560/***/ }),
11561/* 373 */
11562/***/ (function(module, __webpack_exports__, __webpack_require__) {
11563
11564"use strict";
11565/* harmony export (immutable) */ __webpack_exports__["a"] = toArray;
11566/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArray_js__ = __webpack_require__(57);
11567/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
11568/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(133);
11569/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArrayLike_js__ = __webpack_require__(26);
11570/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__map_js__ = __webpack_require__(68);
11571/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__identity_js__ = __webpack_require__(141);
11572/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__values_js__ = __webpack_require__(66);
11573
11574
11575
11576
11577
11578
11579
11580
11581// Safely create a real, live array from anything iterable.
11582var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
11583function toArray(obj) {
11584 if (!obj) return [];
11585 if (Object(__WEBPACK_IMPORTED_MODULE_0__isArray_js__["a" /* default */])(obj)) return __WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(obj);
11586 if (Object(__WEBPACK_IMPORTED_MODULE_2__isString_js__["a" /* default */])(obj)) {
11587 // Keep surrogate pair characters together.
11588 return obj.match(reStrSymbol);
11589 }
11590 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 */]);
11591 return Object(__WEBPACK_IMPORTED_MODULE_6__values_js__["a" /* default */])(obj);
11592}
11593
11594
11595/***/ }),
11596/* 374 */
11597/***/ (function(module, __webpack_exports__, __webpack_require__) {
11598
11599"use strict";
11600/* harmony export (immutable) */ __webpack_exports__["a"] = size;
11601/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
11602/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
11603
11604
11605
11606// Return the number of elements in a collection.
11607function size(obj) {
11608 if (obj == null) return 0;
11609 return Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj.length : Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj).length;
11610}
11611
11612
11613/***/ }),
11614/* 375 */
11615/***/ (function(module, __webpack_exports__, __webpack_require__) {
11616
11617"use strict";
11618/* harmony export (immutable) */ __webpack_exports__["a"] = keyInObj;
11619// Internal `_.pick` helper function to determine whether `key` is an enumerable
11620// property name of `obj`.
11621function keyInObj(value, key, obj) {
11622 return key in obj;
11623}
11624
11625
11626/***/ }),
11627/* 376 */
11628/***/ (function(module, __webpack_exports__, __webpack_require__) {
11629
11630"use strict";
11631/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11632/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
11633/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__negate_js__ = __webpack_require__(144);
11634/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__map_js__ = __webpack_require__(68);
11635/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__flatten_js__ = __webpack_require__(67);
11636/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__contains_js__ = __webpack_require__(89);
11637/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__pick_js__ = __webpack_require__(221);
11638
11639
11640
11641
11642
11643
11644
11645
11646// Return a copy of the object without the disallowed properties.
11647/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
11648 var iteratee = keys[0], context;
11649 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
11650 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__negate_js__["a" /* default */])(iteratee);
11651 if (keys.length > 1) context = keys[1];
11652 } else {
11653 keys = Object(__WEBPACK_IMPORTED_MODULE_3__map_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__flatten_js__["a" /* default */])(keys, false, false), String);
11654 iteratee = function(value, key) {
11655 return !Object(__WEBPACK_IMPORTED_MODULE_5__contains_js__["a" /* default */])(keys, key);
11656 };
11657 }
11658 return Object(__WEBPACK_IMPORTED_MODULE_6__pick_js__["a" /* default */])(obj, iteratee, context);
11659}));
11660
11661
11662/***/ }),
11663/* 377 */
11664/***/ (function(module, __webpack_exports__, __webpack_require__) {
11665
11666"use strict";
11667/* harmony export (immutable) */ __webpack_exports__["a"] = first;
11668/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__initial_js__ = __webpack_require__(222);
11669
11670
11671// Get the first element of an array. Passing **n** will return the first N
11672// values in the array. The **guard** check allows it to work with `_.map`.
11673function first(array, n, guard) {
11674 if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
11675 if (n == null || guard) return array[0];
11676 return Object(__WEBPACK_IMPORTED_MODULE_0__initial_js__["a" /* default */])(array, array.length - n);
11677}
11678
11679
11680/***/ }),
11681/* 378 */
11682/***/ (function(module, __webpack_exports__, __webpack_require__) {
11683
11684"use strict";
11685/* harmony export (immutable) */ __webpack_exports__["a"] = last;
11686/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__rest_js__ = __webpack_require__(223);
11687
11688
11689// Get the last element of an array. Passing **n** will return the last N
11690// values in the array.
11691function last(array, n, guard) {
11692 if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
11693 if (n == null || guard) return array[array.length - 1];
11694 return Object(__WEBPACK_IMPORTED_MODULE_0__rest_js__["a" /* default */])(array, Math.max(0, array.length - n));
11695}
11696
11697
11698/***/ }),
11699/* 379 */
11700/***/ (function(module, __webpack_exports__, __webpack_require__) {
11701
11702"use strict";
11703/* harmony export (immutable) */ __webpack_exports__["a"] = compact;
11704/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(88);
11705
11706
11707// Trim out all falsy values from an array.
11708function compact(array) {
11709 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(array, Boolean);
11710}
11711
11712
11713/***/ }),
11714/* 380 */
11715/***/ (function(module, __webpack_exports__, __webpack_require__) {
11716
11717"use strict";
11718/* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
11719/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__flatten_js__ = __webpack_require__(67);
11720
11721
11722// Flatten out an array, either recursively (by default), or up to `depth`.
11723// Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively.
11724function flatten(array, depth) {
11725 return Object(__WEBPACK_IMPORTED_MODULE_0__flatten_js__["a" /* default */])(array, depth, false);
11726}
11727
11728
11729/***/ }),
11730/* 381 */
11731/***/ (function(module, __webpack_exports__, __webpack_require__) {
11732
11733"use strict";
11734/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11735/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__difference_js__ = __webpack_require__(224);
11736
11737
11738
11739// Return a version of the array that does not contain the specified value(s).
11740/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, otherArrays) {
11741 return Object(__WEBPACK_IMPORTED_MODULE_1__difference_js__["a" /* default */])(array, otherArrays);
11742}));
11743
11744
11745/***/ }),
11746/* 382 */
11747/***/ (function(module, __webpack_exports__, __webpack_require__) {
11748
11749"use strict";
11750/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11751/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__uniq_js__ = __webpack_require__(225);
11752/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__flatten_js__ = __webpack_require__(67);
11753
11754
11755
11756
11757// Produce an array that contains the union: each distinct element from all of
11758// the passed-in arrays.
11759/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(arrays) {
11760 return Object(__WEBPACK_IMPORTED_MODULE_1__uniq_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__flatten_js__["a" /* default */])(arrays, true, true));
11761}));
11762
11763
11764/***/ }),
11765/* 383 */
11766/***/ (function(module, __webpack_exports__, __webpack_require__) {
11767
11768"use strict";
11769/* harmony export (immutable) */ __webpack_exports__["a"] = intersection;
11770/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
11771/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__contains_js__ = __webpack_require__(89);
11772
11773
11774
11775// Produce an array that contains every item shared between all the
11776// passed-in arrays.
11777function intersection(array) {
11778 var result = [];
11779 var argsLength = arguments.length;
11780 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array); i < length; i++) {
11781 var item = array[i];
11782 if (Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(result, item)) continue;
11783 var j;
11784 for (j = 1; j < argsLength; j++) {
11785 if (!Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(arguments[j], item)) break;
11786 }
11787 if (j === argsLength) result.push(item);
11788 }
11789 return result;
11790}
11791
11792
11793/***/ }),
11794/* 384 */
11795/***/ (function(module, __webpack_exports__, __webpack_require__) {
11796
11797"use strict";
11798/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11799/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unzip_js__ = __webpack_require__(226);
11800
11801
11802
11803// Zip together multiple lists into a single array -- elements that share
11804// an index go together.
11805/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unzip_js__["a" /* default */]));
11806
11807
11808/***/ }),
11809/* 385 */
11810/***/ (function(module, __webpack_exports__, __webpack_require__) {
11811
11812"use strict";
11813/* harmony export (immutable) */ __webpack_exports__["a"] = object;
11814/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
11815
11816
11817// Converts lists into objects. Pass either a single array of `[key, value]`
11818// pairs, or two parallel arrays of the same length -- one of keys, and one of
11819// the corresponding values. Passing by pairs is the reverse of `_.pairs`.
11820function object(list, values) {
11821 var result = {};
11822 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(list); i < length; i++) {
11823 if (values) {
11824 result[list[i]] = values[i];
11825 } else {
11826 result[list[i][0]] = list[i][1];
11827 }
11828 }
11829 return result;
11830}
11831
11832
11833/***/ }),
11834/* 386 */
11835/***/ (function(module, __webpack_exports__, __webpack_require__) {
11836
11837"use strict";
11838/* harmony export (immutable) */ __webpack_exports__["a"] = range;
11839// Generate an integer Array containing an arithmetic progression. A port of
11840// the native Python `range()` function. See
11841// [the Python documentation](https://docs.python.org/library/functions.html#range).
11842function range(start, stop, step) {
11843 if (stop == null) {
11844 stop = start || 0;
11845 start = 0;
11846 }
11847 if (!step) {
11848 step = stop < start ? -1 : 1;
11849 }
11850
11851 var length = Math.max(Math.ceil((stop - start) / step), 0);
11852 var range = Array(length);
11853
11854 for (var idx = 0; idx < length; idx++, start += step) {
11855 range[idx] = start;
11856 }
11857
11858 return range;
11859}
11860
11861
11862/***/ }),
11863/* 387 */
11864/***/ (function(module, __webpack_exports__, __webpack_require__) {
11865
11866"use strict";
11867/* harmony export (immutable) */ __webpack_exports__["a"] = chunk;
11868/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
11869
11870
11871// Chunk a single array into multiple arrays, each containing `count` or fewer
11872// items.
11873function chunk(array, count) {
11874 if (count == null || count < 1) return [];
11875 var result = [];
11876 var i = 0, length = array.length;
11877 while (i < length) {
11878 result.push(__WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, i, i += count));
11879 }
11880 return result;
11881}
11882
11883
11884/***/ }),
11885/* 388 */
11886/***/ (function(module, __webpack_exports__, __webpack_require__) {
11887
11888"use strict";
11889/* harmony export (immutable) */ __webpack_exports__["a"] = mixin;
11890/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
11891/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(58);
11892/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__functions_js__ = __webpack_require__(193);
11893/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__setup_js__ = __webpack_require__(6);
11894/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__chainResult_js__ = __webpack_require__(227);
11895
11896
11897
11898
11899
11900
11901// Add your own custom functions to the Underscore object.
11902function mixin(obj) {
11903 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__functions_js__["a" /* default */])(obj), function(name) {
11904 var func = __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */][name] = obj[name];
11905 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
11906 var args = [this._wrapped];
11907 __WEBPACK_IMPORTED_MODULE_3__setup_js__["o" /* push */].apply(args, arguments);
11908 return Object(__WEBPACK_IMPORTED_MODULE_4__chainResult_js__["a" /* default */])(this, func.apply(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */], args));
11909 };
11910 });
11911 return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */];
11912}
11913
11914
11915/***/ }),
11916/* 389 */
11917/***/ (function(module, __webpack_exports__, __webpack_require__) {
11918
11919"use strict";
11920/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
11921/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(58);
11922/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__setup_js__ = __webpack_require__(6);
11923/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__chainResult_js__ = __webpack_require__(227);
11924
11925
11926
11927
11928
11929// Add all mutator `Array` functions to the wrapper.
11930Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
11931 var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
11932 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
11933 var obj = this._wrapped;
11934 if (obj != null) {
11935 method.apply(obj, arguments);
11936 if ((name === 'shift' || name === 'splice') && obj.length === 0) {
11937 delete obj[0];
11938 }
11939 }
11940 return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
11941 };
11942});
11943
11944// Add all accessor `Array` functions to the wrapper.
11945Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['concat', 'join', 'slice'], function(name) {
11946 var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
11947 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
11948 var obj = this._wrapped;
11949 if (obj != null) obj = method.apply(obj, arguments);
11950 return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
11951 };
11952});
11953
11954/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]);
11955
11956
11957/***/ }),
11958/* 390 */
11959/***/ (function(module, exports, __webpack_require__) {
11960
11961var parent = __webpack_require__(391);
11962
11963module.exports = parent;
11964
11965
11966/***/ }),
11967/* 391 */
11968/***/ (function(module, exports, __webpack_require__) {
11969
11970var isPrototypeOf = __webpack_require__(19);
11971var method = __webpack_require__(392);
11972
11973var ArrayPrototype = Array.prototype;
11974
11975module.exports = function (it) {
11976 var own = it.concat;
11977 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.concat) ? method : own;
11978};
11979
11980
11981/***/ }),
11982/* 392 */
11983/***/ (function(module, exports, __webpack_require__) {
11984
11985__webpack_require__(228);
11986var entryVirtual = __webpack_require__(40);
11987
11988module.exports = entryVirtual('Array').concat;
11989
11990
11991/***/ }),
11992/* 393 */
11993/***/ (function(module, exports) {
11994
11995var $TypeError = TypeError;
11996var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
11997
11998module.exports = function (it) {
11999 if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
12000 return it;
12001};
12002
12003
12004/***/ }),
12005/* 394 */
12006/***/ (function(module, exports, __webpack_require__) {
12007
12008var isArray = __webpack_require__(90);
12009var isConstructor = __webpack_require__(109);
12010var isObject = __webpack_require__(11);
12011var wellKnownSymbol = __webpack_require__(9);
12012
12013var SPECIES = wellKnownSymbol('species');
12014var $Array = Array;
12015
12016// a part of `ArraySpeciesCreate` abstract operation
12017// https://tc39.es/ecma262/#sec-arrayspeciescreate
12018module.exports = function (originalArray) {
12019 var C;
12020 if (isArray(originalArray)) {
12021 C = originalArray.constructor;
12022 // cross-realm fallback
12023 if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined;
12024 else if (isObject(C)) {
12025 C = C[SPECIES];
12026 if (C === null) C = undefined;
12027 }
12028 } return C === undefined ? $Array : C;
12029};
12030
12031
12032/***/ }),
12033/* 395 */
12034/***/ (function(module, exports, __webpack_require__) {
12035
12036var parent = __webpack_require__(396);
12037
12038module.exports = parent;
12039
12040
12041/***/ }),
12042/* 396 */
12043/***/ (function(module, exports, __webpack_require__) {
12044
12045var isPrototypeOf = __webpack_require__(19);
12046var method = __webpack_require__(397);
12047
12048var ArrayPrototype = Array.prototype;
12049
12050module.exports = function (it) {
12051 var own = it.map;
12052 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.map) ? method : own;
12053};
12054
12055
12056/***/ }),
12057/* 397 */
12058/***/ (function(module, exports, __webpack_require__) {
12059
12060__webpack_require__(398);
12061var entryVirtual = __webpack_require__(40);
12062
12063module.exports = entryVirtual('Array').map;
12064
12065
12066/***/ }),
12067/* 398 */
12068/***/ (function(module, exports, __webpack_require__) {
12069
12070"use strict";
12071
12072var $ = __webpack_require__(0);
12073var $map = __webpack_require__(70).map;
12074var arrayMethodHasSpeciesSupport = __webpack_require__(114);
12075
12076var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');
12077
12078// `Array.prototype.map` method
12079// https://tc39.es/ecma262/#sec-array.prototype.map
12080// with adding support of @@species
12081$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
12082 map: function map(callbackfn /* , thisArg */) {
12083 return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
12084 }
12085});
12086
12087
12088/***/ }),
12089/* 399 */
12090/***/ (function(module, exports, __webpack_require__) {
12091
12092var parent = __webpack_require__(400);
12093
12094module.exports = parent;
12095
12096
12097/***/ }),
12098/* 400 */
12099/***/ (function(module, exports, __webpack_require__) {
12100
12101__webpack_require__(401);
12102var path = __webpack_require__(5);
12103
12104module.exports = path.Object.keys;
12105
12106
12107/***/ }),
12108/* 401 */
12109/***/ (function(module, exports, __webpack_require__) {
12110
12111var $ = __webpack_require__(0);
12112var toObject = __webpack_require__(34);
12113var nativeKeys = __webpack_require__(105);
12114var fails = __webpack_require__(2);
12115
12116var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); });
12117
12118// `Object.keys` method
12119// https://tc39.es/ecma262/#sec-object.keys
12120$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
12121 keys: function keys(it) {
12122 return nativeKeys(toObject(it));
12123 }
12124});
12125
12126
12127/***/ }),
12128/* 402 */
12129/***/ (function(module, exports, __webpack_require__) {
12130
12131var parent = __webpack_require__(403);
12132
12133module.exports = parent;
12134
12135
12136/***/ }),
12137/* 403 */
12138/***/ (function(module, exports, __webpack_require__) {
12139
12140__webpack_require__(230);
12141var path = __webpack_require__(5);
12142var apply = __webpack_require__(75);
12143
12144// eslint-disable-next-line es-x/no-json -- safe
12145if (!path.JSON) path.JSON = { stringify: JSON.stringify };
12146
12147// eslint-disable-next-line no-unused-vars -- required for `.length`
12148module.exports = function stringify(it, replacer, space) {
12149 return apply(path.JSON.stringify, null, arguments);
12150};
12151
12152
12153/***/ }),
12154/* 404 */
12155/***/ (function(module, exports, __webpack_require__) {
12156
12157var parent = __webpack_require__(405);
12158
12159module.exports = parent;
12160
12161
12162/***/ }),
12163/* 405 */
12164/***/ (function(module, exports, __webpack_require__) {
12165
12166var isPrototypeOf = __webpack_require__(19);
12167var method = __webpack_require__(406);
12168
12169var ArrayPrototype = Array.prototype;
12170
12171module.exports = function (it) {
12172 var own = it.indexOf;
12173 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.indexOf) ? method : own;
12174};
12175
12176
12177/***/ }),
12178/* 406 */
12179/***/ (function(module, exports, __webpack_require__) {
12180
12181__webpack_require__(407);
12182var entryVirtual = __webpack_require__(40);
12183
12184module.exports = entryVirtual('Array').indexOf;
12185
12186
12187/***/ }),
12188/* 407 */
12189/***/ (function(module, exports, __webpack_require__) {
12190
12191"use strict";
12192
12193/* eslint-disable es-x/no-array-prototype-indexof -- required for testing */
12194var $ = __webpack_require__(0);
12195var uncurryThis = __webpack_require__(4);
12196var $IndexOf = __webpack_require__(164).indexOf;
12197var arrayMethodIsStrict = __webpack_require__(231);
12198
12199var un$IndexOf = uncurryThis([].indexOf);
12200
12201var NEGATIVE_ZERO = !!un$IndexOf && 1 / un$IndexOf([1], 1, -0) < 0;
12202var STRICT_METHOD = arrayMethodIsStrict('indexOf');
12203
12204// `Array.prototype.indexOf` method
12205// https://tc39.es/ecma262/#sec-array.prototype.indexof
12206$({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {
12207 indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
12208 var fromIndex = arguments.length > 1 ? arguments[1] : undefined;
12209 return NEGATIVE_ZERO
12210 // convert -0 to +0
12211 ? un$IndexOf(this, searchElement, fromIndex) || 0
12212 : $IndexOf(this, searchElement, fromIndex);
12213 }
12214});
12215
12216
12217/***/ }),
12218/* 408 */
12219/***/ (function(module, exports, __webpack_require__) {
12220
12221__webpack_require__(39);
12222var classof = __webpack_require__(51);
12223var hasOwn = __webpack_require__(13);
12224var isPrototypeOf = __webpack_require__(19);
12225var method = __webpack_require__(409);
12226
12227var ArrayPrototype = Array.prototype;
12228
12229var DOMIterables = {
12230 DOMTokenList: true,
12231 NodeList: true
12232};
12233
12234module.exports = function (it) {
12235 var own = it.keys;
12236 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.keys)
12237 || hasOwn(DOMIterables, classof(it)) ? method : own;
12238};
12239
12240
12241/***/ }),
12242/* 409 */
12243/***/ (function(module, exports, __webpack_require__) {
12244
12245var parent = __webpack_require__(410);
12246
12247module.exports = parent;
12248
12249
12250/***/ }),
12251/* 410 */
12252/***/ (function(module, exports, __webpack_require__) {
12253
12254__webpack_require__(38);
12255__webpack_require__(53);
12256var entryVirtual = __webpack_require__(40);
12257
12258module.exports = entryVirtual('Array').keys;
12259
12260
12261/***/ }),
12262/* 411 */
12263/***/ (function(module, exports) {
12264
12265// Unique ID creation requires a high quality random # generator. In the
12266// browser this is a little complicated due to unknown quality of Math.random()
12267// and inconsistent support for the `crypto` API. We do the best we can via
12268// feature-detection
12269
12270// getRandomValues needs to be invoked in a context where "this" is a Crypto
12271// implementation. Also, find the complete implementation of crypto on IE11.
12272var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
12273 (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
12274
12275if (getRandomValues) {
12276 // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
12277 var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
12278
12279 module.exports = function whatwgRNG() {
12280 getRandomValues(rnds8);
12281 return rnds8;
12282 };
12283} else {
12284 // Math.random()-based (RNG)
12285 //
12286 // If all else fails, use Math.random(). It's fast, but is of unspecified
12287 // quality.
12288 var rnds = new Array(16);
12289
12290 module.exports = function mathRNG() {
12291 for (var i = 0, r; i < 16; i++) {
12292 if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
12293 rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
12294 }
12295
12296 return rnds;
12297 };
12298}
12299
12300
12301/***/ }),
12302/* 412 */
12303/***/ (function(module, exports) {
12304
12305/**
12306 * Convert array of 16 byte values to UUID string format of the form:
12307 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
12308 */
12309var byteToHex = [];
12310for (var i = 0; i < 256; ++i) {
12311 byteToHex[i] = (i + 0x100).toString(16).substr(1);
12312}
12313
12314function bytesToUuid(buf, offset) {
12315 var i = offset || 0;
12316 var bth = byteToHex;
12317 // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
12318 return ([bth[buf[i++]], bth[buf[i++]],
12319 bth[buf[i++]], bth[buf[i++]], '-',
12320 bth[buf[i++]], bth[buf[i++]], '-',
12321 bth[buf[i++]], bth[buf[i++]], '-',
12322 bth[buf[i++]], bth[buf[i++]], '-',
12323 bth[buf[i++]], bth[buf[i++]],
12324 bth[buf[i++]], bth[buf[i++]],
12325 bth[buf[i++]], bth[buf[i++]]]).join('');
12326}
12327
12328module.exports = bytesToUuid;
12329
12330
12331/***/ }),
12332/* 413 */
12333/***/ (function(module, exports, __webpack_require__) {
12334
12335"use strict";
12336
12337
12338/**
12339 * This is the common logic for both the Node.js and web browser
12340 * implementations of `debug()`.
12341 */
12342function setup(env) {
12343 createDebug.debug = createDebug;
12344 createDebug.default = createDebug;
12345 createDebug.coerce = coerce;
12346 createDebug.disable = disable;
12347 createDebug.enable = enable;
12348 createDebug.enabled = enabled;
12349 createDebug.humanize = __webpack_require__(414);
12350 Object.keys(env).forEach(function (key) {
12351 createDebug[key] = env[key];
12352 });
12353 /**
12354 * Active `debug` instances.
12355 */
12356
12357 createDebug.instances = [];
12358 /**
12359 * The currently active debug mode names, and names to skip.
12360 */
12361
12362 createDebug.names = [];
12363 createDebug.skips = [];
12364 /**
12365 * Map of special "%n" handling functions, for the debug "format" argument.
12366 *
12367 * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
12368 */
12369
12370 createDebug.formatters = {};
12371 /**
12372 * Selects a color for a debug namespace
12373 * @param {String} namespace The namespace string for the for the debug instance to be colored
12374 * @return {Number|String} An ANSI color code for the given namespace
12375 * @api private
12376 */
12377
12378 function selectColor(namespace) {
12379 var hash = 0;
12380
12381 for (var i = 0; i < namespace.length; i++) {
12382 hash = (hash << 5) - hash + namespace.charCodeAt(i);
12383 hash |= 0; // Convert to 32bit integer
12384 }
12385
12386 return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
12387 }
12388
12389 createDebug.selectColor = selectColor;
12390 /**
12391 * Create a debugger with the given `namespace`.
12392 *
12393 * @param {String} namespace
12394 * @return {Function}
12395 * @api public
12396 */
12397
12398 function createDebug(namespace) {
12399 var prevTime;
12400
12401 function debug() {
12402 // Disabled?
12403 if (!debug.enabled) {
12404 return;
12405 }
12406
12407 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
12408 args[_key] = arguments[_key];
12409 }
12410
12411 var self = debug; // Set `diff` timestamp
12412
12413 var curr = Number(new Date());
12414 var ms = curr - (prevTime || curr);
12415 self.diff = ms;
12416 self.prev = prevTime;
12417 self.curr = curr;
12418 prevTime = curr;
12419 args[0] = createDebug.coerce(args[0]);
12420
12421 if (typeof args[0] !== 'string') {
12422 // Anything else let's inspect with %O
12423 args.unshift('%O');
12424 } // Apply any `formatters` transformations
12425
12426
12427 var index = 0;
12428 args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
12429 // If we encounter an escaped % then don't increase the array index
12430 if (match === '%%') {
12431 return match;
12432 }
12433
12434 index++;
12435 var formatter = createDebug.formatters[format];
12436
12437 if (typeof formatter === 'function') {
12438 var val = args[index];
12439 match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
12440
12441 args.splice(index, 1);
12442 index--;
12443 }
12444
12445 return match;
12446 }); // Apply env-specific formatting (colors, etc.)
12447
12448 createDebug.formatArgs.call(self, args);
12449 var logFn = self.log || createDebug.log;
12450 logFn.apply(self, args);
12451 }
12452
12453 debug.namespace = namespace;
12454 debug.enabled = createDebug.enabled(namespace);
12455 debug.useColors = createDebug.useColors();
12456 debug.color = selectColor(namespace);
12457 debug.destroy = destroy;
12458 debug.extend = extend; // Debug.formatArgs = formatArgs;
12459 // debug.rawLog = rawLog;
12460 // env-specific initialization logic for debug instances
12461
12462 if (typeof createDebug.init === 'function') {
12463 createDebug.init(debug);
12464 }
12465
12466 createDebug.instances.push(debug);
12467 return debug;
12468 }
12469
12470 function destroy() {
12471 var index = createDebug.instances.indexOf(this);
12472
12473 if (index !== -1) {
12474 createDebug.instances.splice(index, 1);
12475 return true;
12476 }
12477
12478 return false;
12479 }
12480
12481 function extend(namespace, delimiter) {
12482 return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
12483 }
12484 /**
12485 * Enables a debug mode by namespaces. This can include modes
12486 * separated by a colon and wildcards.
12487 *
12488 * @param {String} namespaces
12489 * @api public
12490 */
12491
12492
12493 function enable(namespaces) {
12494 createDebug.save(namespaces);
12495 createDebug.names = [];
12496 createDebug.skips = [];
12497 var i;
12498 var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
12499 var len = split.length;
12500
12501 for (i = 0; i < len; i++) {
12502 if (!split[i]) {
12503 // ignore empty strings
12504 continue;
12505 }
12506
12507 namespaces = split[i].replace(/\*/g, '.*?');
12508
12509 if (namespaces[0] === '-') {
12510 createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
12511 } else {
12512 createDebug.names.push(new RegExp('^' + namespaces + '$'));
12513 }
12514 }
12515
12516 for (i = 0; i < createDebug.instances.length; i++) {
12517 var instance = createDebug.instances[i];
12518 instance.enabled = createDebug.enabled(instance.namespace);
12519 }
12520 }
12521 /**
12522 * Disable debug output.
12523 *
12524 * @api public
12525 */
12526
12527
12528 function disable() {
12529 createDebug.enable('');
12530 }
12531 /**
12532 * Returns true if the given mode name is enabled, false otherwise.
12533 *
12534 * @param {String} name
12535 * @return {Boolean}
12536 * @api public
12537 */
12538
12539
12540 function enabled(name) {
12541 if (name[name.length - 1] === '*') {
12542 return true;
12543 }
12544
12545 var i;
12546 var len;
12547
12548 for (i = 0, len = createDebug.skips.length; i < len; i++) {
12549 if (createDebug.skips[i].test(name)) {
12550 return false;
12551 }
12552 }
12553
12554 for (i = 0, len = createDebug.names.length; i < len; i++) {
12555 if (createDebug.names[i].test(name)) {
12556 return true;
12557 }
12558 }
12559
12560 return false;
12561 }
12562 /**
12563 * Coerce `val`.
12564 *
12565 * @param {Mixed} val
12566 * @return {Mixed}
12567 * @api private
12568 */
12569
12570
12571 function coerce(val) {
12572 if (val instanceof Error) {
12573 return val.stack || val.message;
12574 }
12575
12576 return val;
12577 }
12578
12579 createDebug.enable(createDebug.load());
12580 return createDebug;
12581}
12582
12583module.exports = setup;
12584
12585
12586
12587/***/ }),
12588/* 414 */
12589/***/ (function(module, exports) {
12590
12591/**
12592 * Helpers.
12593 */
12594
12595var s = 1000;
12596var m = s * 60;
12597var h = m * 60;
12598var d = h * 24;
12599var w = d * 7;
12600var y = d * 365.25;
12601
12602/**
12603 * Parse or format the given `val`.
12604 *
12605 * Options:
12606 *
12607 * - `long` verbose formatting [false]
12608 *
12609 * @param {String|Number} val
12610 * @param {Object} [options]
12611 * @throws {Error} throw an error if val is not a non-empty string or a number
12612 * @return {String|Number}
12613 * @api public
12614 */
12615
12616module.exports = function(val, options) {
12617 options = options || {};
12618 var type = typeof val;
12619 if (type === 'string' && val.length > 0) {
12620 return parse(val);
12621 } else if (type === 'number' && isFinite(val)) {
12622 return options.long ? fmtLong(val) : fmtShort(val);
12623 }
12624 throw new Error(
12625 'val is not a non-empty string or a valid number. val=' +
12626 JSON.stringify(val)
12627 );
12628};
12629
12630/**
12631 * Parse the given `str` and return milliseconds.
12632 *
12633 * @param {String} str
12634 * @return {Number}
12635 * @api private
12636 */
12637
12638function parse(str) {
12639 str = String(str);
12640 if (str.length > 100) {
12641 return;
12642 }
12643 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(
12644 str
12645 );
12646 if (!match) {
12647 return;
12648 }
12649 var n = parseFloat(match[1]);
12650 var type = (match[2] || 'ms').toLowerCase();
12651 switch (type) {
12652 case 'years':
12653 case 'year':
12654 case 'yrs':
12655 case 'yr':
12656 case 'y':
12657 return n * y;
12658 case 'weeks':
12659 case 'week':
12660 case 'w':
12661 return n * w;
12662 case 'days':
12663 case 'day':
12664 case 'd':
12665 return n * d;
12666 case 'hours':
12667 case 'hour':
12668 case 'hrs':
12669 case 'hr':
12670 case 'h':
12671 return n * h;
12672 case 'minutes':
12673 case 'minute':
12674 case 'mins':
12675 case 'min':
12676 case 'm':
12677 return n * m;
12678 case 'seconds':
12679 case 'second':
12680 case 'secs':
12681 case 'sec':
12682 case 's':
12683 return n * s;
12684 case 'milliseconds':
12685 case 'millisecond':
12686 case 'msecs':
12687 case 'msec':
12688 case 'ms':
12689 return n;
12690 default:
12691 return undefined;
12692 }
12693}
12694
12695/**
12696 * Short format for `ms`.
12697 *
12698 * @param {Number} ms
12699 * @return {String}
12700 * @api private
12701 */
12702
12703function fmtShort(ms) {
12704 var msAbs = Math.abs(ms);
12705 if (msAbs >= d) {
12706 return Math.round(ms / d) + 'd';
12707 }
12708 if (msAbs >= h) {
12709 return Math.round(ms / h) + 'h';
12710 }
12711 if (msAbs >= m) {
12712 return Math.round(ms / m) + 'm';
12713 }
12714 if (msAbs >= s) {
12715 return Math.round(ms / s) + 's';
12716 }
12717 return ms + 'ms';
12718}
12719
12720/**
12721 * Long format for `ms`.
12722 *
12723 * @param {Number} ms
12724 * @return {String}
12725 * @api private
12726 */
12727
12728function fmtLong(ms) {
12729 var msAbs = Math.abs(ms);
12730 if (msAbs >= d) {
12731 return plural(ms, msAbs, d, 'day');
12732 }
12733 if (msAbs >= h) {
12734 return plural(ms, msAbs, h, 'hour');
12735 }
12736 if (msAbs >= m) {
12737 return plural(ms, msAbs, m, 'minute');
12738 }
12739 if (msAbs >= s) {
12740 return plural(ms, msAbs, s, 'second');
12741 }
12742 return ms + ' ms';
12743}
12744
12745/**
12746 * Pluralization helper.
12747 */
12748
12749function plural(ms, msAbs, n, name) {
12750 var isPlural = msAbs >= n * 1.5;
12751 return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
12752}
12753
12754
12755/***/ }),
12756/* 415 */
12757/***/ (function(module, exports, __webpack_require__) {
12758
12759__webpack_require__(416);
12760var path = __webpack_require__(5);
12761
12762module.exports = path.Object.getPrototypeOf;
12763
12764
12765/***/ }),
12766/* 416 */
12767/***/ (function(module, exports, __webpack_require__) {
12768
12769var $ = __webpack_require__(0);
12770var fails = __webpack_require__(2);
12771var toObject = __webpack_require__(34);
12772var nativeGetPrototypeOf = __webpack_require__(100);
12773var CORRECT_PROTOTYPE_GETTER = __webpack_require__(161);
12774
12775var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); });
12776
12777// `Object.getPrototypeOf` method
12778// https://tc39.es/ecma262/#sec-object.getprototypeof
12779$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, {
12780 getPrototypeOf: function getPrototypeOf(it) {
12781 return nativeGetPrototypeOf(toObject(it));
12782 }
12783});
12784
12785
12786
12787/***/ }),
12788/* 417 */
12789/***/ (function(module, exports, __webpack_require__) {
12790
12791__webpack_require__(418);
12792var path = __webpack_require__(5);
12793
12794module.exports = path.Object.setPrototypeOf;
12795
12796
12797/***/ }),
12798/* 418 */
12799/***/ (function(module, exports, __webpack_require__) {
12800
12801var $ = __webpack_require__(0);
12802var setPrototypeOf = __webpack_require__(102);
12803
12804// `Object.setPrototypeOf` method
12805// https://tc39.es/ecma262/#sec-object.setprototypeof
12806$({ target: 'Object', stat: true }, {
12807 setPrototypeOf: setPrototypeOf
12808});
12809
12810
12811/***/ }),
12812/* 419 */
12813/***/ (function(module, exports, __webpack_require__) {
12814
12815"use strict";
12816
12817
12818var _interopRequireDefault = __webpack_require__(1);
12819
12820var _slice = _interopRequireDefault(__webpack_require__(61));
12821
12822var _concat = _interopRequireDefault(__webpack_require__(22));
12823
12824var _defineProperty = _interopRequireDefault(__webpack_require__(92));
12825
12826var AV = __webpack_require__(69);
12827
12828var AppRouter = __webpack_require__(425);
12829
12830var _require = __webpack_require__(30),
12831 isNullOrUndefined = _require.isNullOrUndefined;
12832
12833var _require2 = __webpack_require__(3),
12834 extend = _require2.extend,
12835 isObject = _require2.isObject,
12836 isEmpty = _require2.isEmpty;
12837
12838var isCNApp = function isCNApp(appId) {
12839 return (0, _slice.default)(appId).call(appId, -9) !== '-MdYXbMMI';
12840};
12841
12842var fillServerURLs = function fillServerURLs(url) {
12843 return {
12844 push: url,
12845 stats: url,
12846 engine: url,
12847 api: url,
12848 rtm: url
12849 };
12850};
12851
12852function getDefaultServerURLs(appId) {
12853 var _context, _context2, _context3, _context4, _context5;
12854
12855 if (isCNApp(appId)) {
12856 return {};
12857 }
12858
12859 var id = (0, _slice.default)(appId).call(appId, 0, 8).toLowerCase();
12860 var domain = 'lncldglobal.com';
12861 return {
12862 push: (0, _concat.default)(_context = "https://".concat(id, ".push.")).call(_context, domain),
12863 stats: (0, _concat.default)(_context2 = "https://".concat(id, ".stats.")).call(_context2, domain),
12864 engine: (0, _concat.default)(_context3 = "https://".concat(id, ".engine.")).call(_context3, domain),
12865 api: (0, _concat.default)(_context4 = "https://".concat(id, ".api.")).call(_context4, domain),
12866 rtm: (0, _concat.default)(_context5 = "https://".concat(id, ".rtm.")).call(_context5, domain)
12867 };
12868}
12869
12870var _disableAppRouter = false;
12871var _initialized = false;
12872/**
12873 * URLs for services
12874 * @typedef {Object} ServerURLs
12875 * @property {String} [api] serverURL for API service
12876 * @property {String} [engine] serverURL for engine service
12877 * @property {String} [stats] serverURL for stats service
12878 * @property {String} [push] serverURL for push service
12879 * @property {String} [rtm] serverURL for LiveQuery service
12880 */
12881
12882/**
12883 * Call this method first to set up your authentication tokens for AV.
12884 * You can get your app keys from the LeanCloud dashboard on http://leancloud.cn .
12885 * @function AV.init
12886 * @param {Object} options
12887 * @param {String} options.appId application id
12888 * @param {String} options.appKey application key
12889 * @param {String} [options.masterKey] application master key
12890 * @param {Boolean} [options.production]
12891 * @param {String|ServerURLs} [options.serverURL] URLs for services. if a string was given, it will be applied for all services.
12892 * @param {Boolean} [options.disableCurrentUser]
12893 */
12894
12895AV.init = function init(options) {
12896 if (!isObject(options)) {
12897 return AV.init({
12898 appId: options,
12899 appKey: arguments.length <= 1 ? undefined : arguments[1],
12900 masterKey: arguments.length <= 2 ? undefined : arguments[2]
12901 });
12902 }
12903
12904 var appId = options.appId,
12905 appKey = options.appKey,
12906 masterKey = options.masterKey,
12907 hookKey = options.hookKey,
12908 serverURL = options.serverURL,
12909 _options$serverURLs = options.serverURLs,
12910 serverURLs = _options$serverURLs === void 0 ? serverURL : _options$serverURLs,
12911 disableCurrentUser = options.disableCurrentUser,
12912 production = options.production,
12913 realtime = options.realtime;
12914 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.');
12915 if (!appId) throw new TypeError('appId must be a string');
12916 if (!appKey) throw new TypeError('appKey must be a string');
12917 if ("Weapp" !== 'NODE_JS' && masterKey) console.warn('MasterKey is not supposed to be used at client side.');
12918
12919 if (isCNApp(appId)) {
12920 if (!serverURLs && isEmpty(AV._config.serverURLs)) {
12921 throw new TypeError("serverURL option is required for apps from CN region");
12922 }
12923 }
12924
12925 if (appId !== AV._config.applicationId) {
12926 // overwrite all keys when reinitializing as a new app
12927 AV._config.masterKey = masterKey;
12928 AV._config.hookKey = hookKey;
12929 } else {
12930 if (masterKey) AV._config.masterKey = masterKey;
12931 if (hookKey) AV._config.hookKey = hookKey;
12932 }
12933
12934 AV._config.applicationId = appId;
12935 AV._config.applicationKey = appKey;
12936
12937 if (!isNullOrUndefined(production)) {
12938 AV.setProduction(production);
12939 }
12940
12941 if (typeof disableCurrentUser !== 'undefined') AV._config.disableCurrentUser = disableCurrentUser;
12942 var disableAppRouter = _disableAppRouter || typeof serverURLs !== 'undefined';
12943
12944 if (!disableAppRouter) {
12945 AV._appRouter = new AppRouter(AV);
12946 }
12947
12948 AV._setServerURLs(extend({}, getDefaultServerURLs(appId), AV._config.serverURLs, typeof serverURLs === 'string' ? fillServerURLs(serverURLs) : serverURLs), disableAppRouter);
12949
12950 if (realtime) {
12951 AV._config.realtime = realtime;
12952 } else if (AV._sharedConfig.liveQueryRealtime) {
12953 var _AV$_config$serverURL = AV._config.serverURLs,
12954 api = _AV$_config$serverURL.api,
12955 rtm = _AV$_config$serverURL.rtm;
12956 AV._config.realtime = new AV._sharedConfig.liveQueryRealtime({
12957 appId: appId,
12958 appKey: appKey,
12959 server: {
12960 api: api,
12961 RTMRouter: rtm
12962 }
12963 });
12964 }
12965
12966 _initialized = true;
12967}; // If we're running in node.js, allow using the master key.
12968
12969
12970if (false) {
12971 AV.Cloud = AV.Cloud || {};
12972 /**
12973 * Switches the LeanCloud SDK to using the Master key. The Master key grants
12974 * priveleged access to the data in LeanCloud and can be used to bypass ACLs and
12975 * other restrictions that are applied to the client SDKs.
12976 * <p><strong><em>Available in Cloud Code and Node.js only.</em></strong>
12977 * </p>
12978 */
12979
12980 AV.Cloud.useMasterKey = function () {
12981 AV._config.useMasterKey = true;
12982 };
12983}
12984/**
12985 * Call this method to set production environment variable.
12986 * @function AV.setProduction
12987 * @param {Boolean} production True is production environment,and
12988 * it's true by default.
12989 */
12990
12991
12992AV.setProduction = function (production) {
12993 if (!isNullOrUndefined(production)) {
12994 AV._config.production = production ? 1 : 0;
12995 } else {
12996 // change to default value
12997 AV._config.production = null;
12998 }
12999};
13000
13001AV._setServerURLs = function (urls) {
13002 var disableAppRouter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
13003
13004 if (typeof urls !== 'string') {
13005 extend(AV._config.serverURLs, urls);
13006 } else {
13007 AV._config.serverURLs = fillServerURLs(urls);
13008 }
13009
13010 if (disableAppRouter) {
13011 if (AV._appRouter) {
13012 AV._appRouter.disable();
13013 } else {
13014 _disableAppRouter = true;
13015 }
13016 }
13017};
13018/**
13019 * Set server URLs for services.
13020 * @function AV.setServerURL
13021 * @since 4.3.0
13022 * @param {String|ServerURLs} urls URLs for services. if a string was given, it will be applied for all services.
13023 * You can also set them when initializing SDK with `options.serverURL`
13024 */
13025
13026
13027AV.setServerURL = function (urls) {
13028 return AV._setServerURLs(urls);
13029};
13030
13031AV.setServerURLs = AV.setServerURL;
13032
13033AV.keepErrorRawMessage = function (value) {
13034 AV._sharedConfig.keepErrorRawMessage = value;
13035};
13036/**
13037 * Set a deadline for requests to complete.
13038 * Note that file upload requests are not affected.
13039 * @function AV.setRequestTimeout
13040 * @since 3.6.0
13041 * @param {number} ms
13042 */
13043
13044
13045AV.setRequestTimeout = function (ms) {
13046 AV._config.requestTimeout = ms;
13047}; // backword compatible
13048
13049
13050AV.initialize = AV.init;
13051
13052var defineConfig = function defineConfig(property) {
13053 return (0, _defineProperty.default)(AV, property, {
13054 get: function get() {
13055 return AV._config[property];
13056 },
13057 set: function set(value) {
13058 AV._config[property] = value;
13059 }
13060 });
13061};
13062
13063['applicationId', 'applicationKey', 'masterKey', 'hookKey'].forEach(defineConfig);
13064
13065/***/ }),
13066/* 420 */
13067/***/ (function(module, exports, __webpack_require__) {
13068
13069var isPrototypeOf = __webpack_require__(19);
13070var method = __webpack_require__(421);
13071
13072var ArrayPrototype = Array.prototype;
13073
13074module.exports = function (it) {
13075 var own = it.slice;
13076 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.slice) ? method : own;
13077};
13078
13079
13080/***/ }),
13081/* 421 */
13082/***/ (function(module, exports, __webpack_require__) {
13083
13084__webpack_require__(422);
13085var entryVirtual = __webpack_require__(40);
13086
13087module.exports = entryVirtual('Array').slice;
13088
13089
13090/***/ }),
13091/* 422 */
13092/***/ (function(module, exports, __webpack_require__) {
13093
13094"use strict";
13095
13096var $ = __webpack_require__(0);
13097var isArray = __webpack_require__(90);
13098var isConstructor = __webpack_require__(109);
13099var isObject = __webpack_require__(11);
13100var toAbsoluteIndex = __webpack_require__(125);
13101var lengthOfArrayLike = __webpack_require__(41);
13102var toIndexedObject = __webpack_require__(32);
13103var createProperty = __webpack_require__(91);
13104var wellKnownSymbol = __webpack_require__(9);
13105var arrayMethodHasSpeciesSupport = __webpack_require__(114);
13106var un$Slice = __webpack_require__(110);
13107
13108var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
13109
13110var SPECIES = wellKnownSymbol('species');
13111var $Array = Array;
13112var max = Math.max;
13113
13114// `Array.prototype.slice` method
13115// https://tc39.es/ecma262/#sec-array.prototype.slice
13116// fallback for not array-like ES3 strings and DOM objects
13117$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
13118 slice: function slice(start, end) {
13119 var O = toIndexedObject(this);
13120 var length = lengthOfArrayLike(O);
13121 var k = toAbsoluteIndex(start, length);
13122 var fin = toAbsoluteIndex(end === undefined ? length : end, length);
13123 // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
13124 var Constructor, result, n;
13125 if (isArray(O)) {
13126 Constructor = O.constructor;
13127 // cross-realm fallback
13128 if (isConstructor(Constructor) && (Constructor === $Array || isArray(Constructor.prototype))) {
13129 Constructor = undefined;
13130 } else if (isObject(Constructor)) {
13131 Constructor = Constructor[SPECIES];
13132 if (Constructor === null) Constructor = undefined;
13133 }
13134 if (Constructor === $Array || Constructor === undefined) {
13135 return un$Slice(O, k, fin);
13136 }
13137 }
13138 result = new (Constructor === undefined ? $Array : Constructor)(max(fin - k, 0));
13139 for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
13140 result.length = n;
13141 return result;
13142 }
13143});
13144
13145
13146/***/ }),
13147/* 423 */
13148/***/ (function(module, exports, __webpack_require__) {
13149
13150__webpack_require__(424);
13151var path = __webpack_require__(5);
13152
13153var Object = path.Object;
13154
13155var defineProperty = module.exports = function defineProperty(it, key, desc) {
13156 return Object.defineProperty(it, key, desc);
13157};
13158
13159if (Object.defineProperty.sham) defineProperty.sham = true;
13160
13161
13162/***/ }),
13163/* 424 */
13164/***/ (function(module, exports, __webpack_require__) {
13165
13166var $ = __webpack_require__(0);
13167var DESCRIPTORS = __webpack_require__(14);
13168var defineProperty = __webpack_require__(23).f;
13169
13170// `Object.defineProperty` method
13171// https://tc39.es/ecma262/#sec-object.defineproperty
13172// eslint-disable-next-line es-x/no-object-defineproperty -- safe
13173$({ target: 'Object', stat: true, forced: Object.defineProperty !== defineProperty, sham: !DESCRIPTORS }, {
13174 defineProperty: defineProperty
13175});
13176
13177
13178/***/ }),
13179/* 425 */
13180/***/ (function(module, exports, __webpack_require__) {
13181
13182"use strict";
13183
13184
13185var ajax = __webpack_require__(116);
13186
13187var Cache = __webpack_require__(237);
13188
13189function AppRouter(AV) {
13190 var _this = this;
13191
13192 this.AV = AV;
13193 this.lockedUntil = 0;
13194 Cache.getAsync('serverURLs').then(function (data) {
13195 if (_this.disabled) return;
13196 if (!data) return _this.lock(0);
13197 var serverURLs = data.serverURLs,
13198 lockedUntil = data.lockedUntil;
13199
13200 _this.AV._setServerURLs(serverURLs, false);
13201
13202 _this.lockedUntil = lockedUntil;
13203 }).catch(function () {
13204 return _this.lock(0);
13205 });
13206}
13207
13208AppRouter.prototype.disable = function disable() {
13209 this.disabled = true;
13210};
13211
13212AppRouter.prototype.lock = function lock(ttl) {
13213 this.lockedUntil = Date.now() + ttl;
13214};
13215
13216AppRouter.prototype.refresh = function refresh() {
13217 var _this2 = this;
13218
13219 if (this.disabled) return;
13220 if (Date.now() < this.lockedUntil) return;
13221 this.lock(10);
13222 var url = 'https://app-router.com/2/route';
13223 return ajax({
13224 method: 'get',
13225 url: url,
13226 query: {
13227 appId: this.AV.applicationId
13228 }
13229 }).then(function (servers) {
13230 if (_this2.disabled) return;
13231 var ttl = servers.ttl;
13232 if (!ttl) throw new Error('missing ttl');
13233 ttl = ttl * 1000;
13234 var protocal = 'https://';
13235 var serverURLs = {
13236 push: protocal + servers.push_server,
13237 stats: protocal + servers.stats_server,
13238 engine: protocal + servers.engine_server,
13239 api: protocal + servers.api_server
13240 };
13241
13242 _this2.AV._setServerURLs(serverURLs, false);
13243
13244 _this2.lock(ttl);
13245
13246 return Cache.setAsync('serverURLs', {
13247 serverURLs: serverURLs,
13248 lockedUntil: _this2.lockedUntil
13249 }, ttl);
13250 }).catch(function (error) {
13251 // bypass all errors
13252 console.warn("refresh server URLs failed: ".concat(error.message));
13253
13254 _this2.lock(600);
13255 });
13256};
13257
13258module.exports = AppRouter;
13259
13260/***/ }),
13261/* 426 */
13262/***/ (function(module, exports, __webpack_require__) {
13263
13264module.exports = __webpack_require__(427);
13265
13266
13267/***/ }),
13268/* 427 */
13269/***/ (function(module, exports, __webpack_require__) {
13270
13271var parent = __webpack_require__(428);
13272__webpack_require__(451);
13273__webpack_require__(452);
13274__webpack_require__(453);
13275__webpack_require__(454);
13276__webpack_require__(455);
13277// TODO: Remove from `core-js@4`
13278__webpack_require__(456);
13279__webpack_require__(457);
13280__webpack_require__(458);
13281
13282module.exports = parent;
13283
13284
13285/***/ }),
13286/* 428 */
13287/***/ (function(module, exports, __webpack_require__) {
13288
13289var parent = __webpack_require__(243);
13290
13291module.exports = parent;
13292
13293
13294/***/ }),
13295/* 429 */
13296/***/ (function(module, exports, __webpack_require__) {
13297
13298__webpack_require__(228);
13299__webpack_require__(53);
13300__webpack_require__(244);
13301__webpack_require__(435);
13302__webpack_require__(436);
13303__webpack_require__(437);
13304__webpack_require__(438);
13305__webpack_require__(248);
13306__webpack_require__(439);
13307__webpack_require__(440);
13308__webpack_require__(441);
13309__webpack_require__(442);
13310__webpack_require__(443);
13311__webpack_require__(444);
13312__webpack_require__(445);
13313__webpack_require__(446);
13314__webpack_require__(447);
13315__webpack_require__(448);
13316__webpack_require__(449);
13317__webpack_require__(450);
13318var path = __webpack_require__(5);
13319
13320module.exports = path.Symbol;
13321
13322
13323/***/ }),
13324/* 430 */
13325/***/ (function(module, exports, __webpack_require__) {
13326
13327"use strict";
13328
13329var $ = __webpack_require__(0);
13330var global = __webpack_require__(7);
13331var call = __webpack_require__(15);
13332var uncurryThis = __webpack_require__(4);
13333var IS_PURE = __webpack_require__(33);
13334var DESCRIPTORS = __webpack_require__(14);
13335var NATIVE_SYMBOL = __webpack_require__(64);
13336var fails = __webpack_require__(2);
13337var hasOwn = __webpack_require__(13);
13338var isPrototypeOf = __webpack_require__(19);
13339var anObject = __webpack_require__(20);
13340var toIndexedObject = __webpack_require__(32);
13341var toPropertyKey = __webpack_require__(96);
13342var $toString = __webpack_require__(81);
13343var createPropertyDescriptor = __webpack_require__(47);
13344var nativeObjectCreate = __webpack_require__(49);
13345var objectKeys = __webpack_require__(105);
13346var getOwnPropertyNamesModule = __webpack_require__(103);
13347var getOwnPropertyNamesExternal = __webpack_require__(245);
13348var getOwnPropertySymbolsModule = __webpack_require__(104);
13349var getOwnPropertyDescriptorModule = __webpack_require__(62);
13350var definePropertyModule = __webpack_require__(23);
13351var definePropertiesModule = __webpack_require__(128);
13352var propertyIsEnumerableModule = __webpack_require__(120);
13353var defineBuiltIn = __webpack_require__(44);
13354var shared = __webpack_require__(79);
13355var sharedKey = __webpack_require__(101);
13356var hiddenKeys = __webpack_require__(80);
13357var uid = __webpack_require__(99);
13358var wellKnownSymbol = __webpack_require__(9);
13359var wrappedWellKnownSymbolModule = __webpack_require__(148);
13360var defineWellKnownSymbol = __webpack_require__(10);
13361var defineSymbolToPrimitive = __webpack_require__(246);
13362var setToStringTag = __webpack_require__(52);
13363var InternalStateModule = __webpack_require__(43);
13364var $forEach = __webpack_require__(70).forEach;
13365
13366var HIDDEN = sharedKey('hidden');
13367var SYMBOL = 'Symbol';
13368var PROTOTYPE = 'prototype';
13369
13370var setInternalState = InternalStateModule.set;
13371var getInternalState = InternalStateModule.getterFor(SYMBOL);
13372
13373var ObjectPrototype = Object[PROTOTYPE];
13374var $Symbol = global.Symbol;
13375var SymbolPrototype = $Symbol && $Symbol[PROTOTYPE];
13376var TypeError = global.TypeError;
13377var QObject = global.QObject;
13378var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
13379var nativeDefineProperty = definePropertyModule.f;
13380var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
13381var nativePropertyIsEnumerable = propertyIsEnumerableModule.f;
13382var push = uncurryThis([].push);
13383
13384var AllSymbols = shared('symbols');
13385var ObjectPrototypeSymbols = shared('op-symbols');
13386var WellKnownSymbolsStore = shared('wks');
13387
13388// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
13389var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
13390
13391// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
13392var setSymbolDescriptor = DESCRIPTORS && fails(function () {
13393 return nativeObjectCreate(nativeDefineProperty({}, 'a', {
13394 get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; }
13395 })).a != 7;
13396}) ? function (O, P, Attributes) {
13397 var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);
13398 if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
13399 nativeDefineProperty(O, P, Attributes);
13400 if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
13401 nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);
13402 }
13403} : nativeDefineProperty;
13404
13405var wrap = function (tag, description) {
13406 var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype);
13407 setInternalState(symbol, {
13408 type: SYMBOL,
13409 tag: tag,
13410 description: description
13411 });
13412 if (!DESCRIPTORS) symbol.description = description;
13413 return symbol;
13414};
13415
13416var $defineProperty = function defineProperty(O, P, Attributes) {
13417 if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
13418 anObject(O);
13419 var key = toPropertyKey(P);
13420 anObject(Attributes);
13421 if (hasOwn(AllSymbols, key)) {
13422 if (!Attributes.enumerable) {
13423 if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));
13424 O[HIDDEN][key] = true;
13425 } else {
13426 if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
13427 Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
13428 } return setSymbolDescriptor(O, key, Attributes);
13429 } return nativeDefineProperty(O, key, Attributes);
13430};
13431
13432var $defineProperties = function defineProperties(O, Properties) {
13433 anObject(O);
13434 var properties = toIndexedObject(Properties);
13435 var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
13436 $forEach(keys, function (key) {
13437 if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]);
13438 });
13439 return O;
13440};
13441
13442var $create = function create(O, Properties) {
13443 return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);
13444};
13445
13446var $propertyIsEnumerable = function propertyIsEnumerable(V) {
13447 var P = toPropertyKey(V);
13448 var enumerable = call(nativePropertyIsEnumerable, this, P);
13449 if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false;
13450 return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P]
13451 ? enumerable : true;
13452};
13453
13454var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
13455 var it = toIndexedObject(O);
13456 var key = toPropertyKey(P);
13457 if (it === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return;
13458 var descriptor = nativeGetOwnPropertyDescriptor(it, key);
13459 if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it, HIDDEN) && it[HIDDEN][key])) {
13460 descriptor.enumerable = true;
13461 }
13462 return descriptor;
13463};
13464
13465var $getOwnPropertyNames = function getOwnPropertyNames(O) {
13466 var names = nativeGetOwnPropertyNames(toIndexedObject(O));
13467 var result = [];
13468 $forEach(names, function (key) {
13469 if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key);
13470 });
13471 return result;
13472};
13473
13474var $getOwnPropertySymbols = function (O) {
13475 var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
13476 var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
13477 var result = [];
13478 $forEach(names, function (key) {
13479 if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) {
13480 push(result, AllSymbols[key]);
13481 }
13482 });
13483 return result;
13484};
13485
13486// `Symbol` constructor
13487// https://tc39.es/ecma262/#sec-symbol-constructor
13488if (!NATIVE_SYMBOL) {
13489 $Symbol = function Symbol() {
13490 if (isPrototypeOf(SymbolPrototype, this)) throw TypeError('Symbol is not a constructor');
13491 var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]);
13492 var tag = uid(description);
13493 var setter = function (value) {
13494 if (this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value);
13495 if (hasOwn(this, HIDDEN) && hasOwn(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
13496 setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
13497 };
13498 if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
13499 return wrap(tag, description);
13500 };
13501
13502 SymbolPrototype = $Symbol[PROTOTYPE];
13503
13504 defineBuiltIn(SymbolPrototype, 'toString', function toString() {
13505 return getInternalState(this).tag;
13506 });
13507
13508 defineBuiltIn($Symbol, 'withoutSetter', function (description) {
13509 return wrap(uid(description), description);
13510 });
13511
13512 propertyIsEnumerableModule.f = $propertyIsEnumerable;
13513 definePropertyModule.f = $defineProperty;
13514 definePropertiesModule.f = $defineProperties;
13515 getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;
13516 getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;
13517 getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;
13518
13519 wrappedWellKnownSymbolModule.f = function (name) {
13520 return wrap(wellKnownSymbol(name), name);
13521 };
13522
13523 if (DESCRIPTORS) {
13524 // https://github.com/tc39/proposal-Symbol-description
13525 nativeDefineProperty(SymbolPrototype, 'description', {
13526 configurable: true,
13527 get: function description() {
13528 return getInternalState(this).description;
13529 }
13530 });
13531 if (!IS_PURE) {
13532 defineBuiltIn(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
13533 }
13534 }
13535}
13536
13537$({ global: true, constructor: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {
13538 Symbol: $Symbol
13539});
13540
13541$forEach(objectKeys(WellKnownSymbolsStore), function (name) {
13542 defineWellKnownSymbol(name);
13543});
13544
13545$({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, {
13546 useSetter: function () { USE_SETTER = true; },
13547 useSimple: function () { USE_SETTER = false; }
13548});
13549
13550$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, {
13551 // `Object.create` method
13552 // https://tc39.es/ecma262/#sec-object.create
13553 create: $create,
13554 // `Object.defineProperty` method
13555 // https://tc39.es/ecma262/#sec-object.defineproperty
13556 defineProperty: $defineProperty,
13557 // `Object.defineProperties` method
13558 // https://tc39.es/ecma262/#sec-object.defineproperties
13559 defineProperties: $defineProperties,
13560 // `Object.getOwnPropertyDescriptor` method
13561 // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
13562 getOwnPropertyDescriptor: $getOwnPropertyDescriptor
13563});
13564
13565$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, {
13566 // `Object.getOwnPropertyNames` method
13567 // https://tc39.es/ecma262/#sec-object.getownpropertynames
13568 getOwnPropertyNames: $getOwnPropertyNames
13569});
13570
13571// `Symbol.prototype[@@toPrimitive]` method
13572// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
13573defineSymbolToPrimitive();
13574
13575// `Symbol.prototype[@@toStringTag]` property
13576// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
13577setToStringTag($Symbol, SYMBOL);
13578
13579hiddenKeys[HIDDEN] = true;
13580
13581
13582/***/ }),
13583/* 431 */
13584/***/ (function(module, exports, __webpack_require__) {
13585
13586var toAbsoluteIndex = __webpack_require__(125);
13587var lengthOfArrayLike = __webpack_require__(41);
13588var createProperty = __webpack_require__(91);
13589
13590var $Array = Array;
13591var max = Math.max;
13592
13593module.exports = function (O, start, end) {
13594 var length = lengthOfArrayLike(O);
13595 var k = toAbsoluteIndex(start, length);
13596 var fin = toAbsoluteIndex(end === undefined ? length : end, length);
13597 var result = $Array(max(fin - k, 0));
13598 for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
13599 result.length = n;
13600 return result;
13601};
13602
13603
13604/***/ }),
13605/* 432 */
13606/***/ (function(module, exports, __webpack_require__) {
13607
13608var $ = __webpack_require__(0);
13609var getBuiltIn = __webpack_require__(18);
13610var hasOwn = __webpack_require__(13);
13611var toString = __webpack_require__(81);
13612var shared = __webpack_require__(79);
13613var NATIVE_SYMBOL_REGISTRY = __webpack_require__(247);
13614
13615var StringToSymbolRegistry = shared('string-to-symbol-registry');
13616var SymbolToStringRegistry = shared('symbol-to-string-registry');
13617
13618// `Symbol.for` method
13619// https://tc39.es/ecma262/#sec-symbol.for
13620$({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
13621 'for': function (key) {
13622 var string = toString(key);
13623 if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
13624 var symbol = getBuiltIn('Symbol')(string);
13625 StringToSymbolRegistry[string] = symbol;
13626 SymbolToStringRegistry[symbol] = string;
13627 return symbol;
13628 }
13629});
13630
13631
13632/***/ }),
13633/* 433 */
13634/***/ (function(module, exports, __webpack_require__) {
13635
13636var $ = __webpack_require__(0);
13637var hasOwn = __webpack_require__(13);
13638var isSymbol = __webpack_require__(97);
13639var tryToString = __webpack_require__(78);
13640var shared = __webpack_require__(79);
13641var NATIVE_SYMBOL_REGISTRY = __webpack_require__(247);
13642
13643var SymbolToStringRegistry = shared('symbol-to-string-registry');
13644
13645// `Symbol.keyFor` method
13646// https://tc39.es/ecma262/#sec-symbol.keyfor
13647$({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
13648 keyFor: function keyFor(sym) {
13649 if (!isSymbol(sym)) throw TypeError(tryToString(sym) + ' is not a symbol');
13650 if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
13651 }
13652});
13653
13654
13655/***/ }),
13656/* 434 */
13657/***/ (function(module, exports, __webpack_require__) {
13658
13659var $ = __webpack_require__(0);
13660var NATIVE_SYMBOL = __webpack_require__(64);
13661var fails = __webpack_require__(2);
13662var getOwnPropertySymbolsModule = __webpack_require__(104);
13663var toObject = __webpack_require__(34);
13664
13665// V8 ~ Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
13666// https://bugs.chromium.org/p/v8/issues/detail?id=3443
13667var FORCED = !NATIVE_SYMBOL || fails(function () { getOwnPropertySymbolsModule.f(1); });
13668
13669// `Object.getOwnPropertySymbols` method
13670// https://tc39.es/ecma262/#sec-object.getownpropertysymbols
13671$({ target: 'Object', stat: true, forced: FORCED }, {
13672 getOwnPropertySymbols: function getOwnPropertySymbols(it) {
13673 var $getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
13674 return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject(it)) : [];
13675 }
13676});
13677
13678
13679/***/ }),
13680/* 435 */
13681/***/ (function(module, exports, __webpack_require__) {
13682
13683var defineWellKnownSymbol = __webpack_require__(10);
13684
13685// `Symbol.asyncIterator` well-known symbol
13686// https://tc39.es/ecma262/#sec-symbol.asynciterator
13687defineWellKnownSymbol('asyncIterator');
13688
13689
13690/***/ }),
13691/* 436 */
13692/***/ (function(module, exports) {
13693
13694// empty
13695
13696
13697/***/ }),
13698/* 437 */
13699/***/ (function(module, exports, __webpack_require__) {
13700
13701var defineWellKnownSymbol = __webpack_require__(10);
13702
13703// `Symbol.hasInstance` well-known symbol
13704// https://tc39.es/ecma262/#sec-symbol.hasinstance
13705defineWellKnownSymbol('hasInstance');
13706
13707
13708/***/ }),
13709/* 438 */
13710/***/ (function(module, exports, __webpack_require__) {
13711
13712var defineWellKnownSymbol = __webpack_require__(10);
13713
13714// `Symbol.isConcatSpreadable` well-known symbol
13715// https://tc39.es/ecma262/#sec-symbol.isconcatspreadable
13716defineWellKnownSymbol('isConcatSpreadable');
13717
13718
13719/***/ }),
13720/* 439 */
13721/***/ (function(module, exports, __webpack_require__) {
13722
13723var defineWellKnownSymbol = __webpack_require__(10);
13724
13725// `Symbol.match` well-known symbol
13726// https://tc39.es/ecma262/#sec-symbol.match
13727defineWellKnownSymbol('match');
13728
13729
13730/***/ }),
13731/* 440 */
13732/***/ (function(module, exports, __webpack_require__) {
13733
13734var defineWellKnownSymbol = __webpack_require__(10);
13735
13736// `Symbol.matchAll` well-known symbol
13737// https://tc39.es/ecma262/#sec-symbol.matchall
13738defineWellKnownSymbol('matchAll');
13739
13740
13741/***/ }),
13742/* 441 */
13743/***/ (function(module, exports, __webpack_require__) {
13744
13745var defineWellKnownSymbol = __webpack_require__(10);
13746
13747// `Symbol.replace` well-known symbol
13748// https://tc39.es/ecma262/#sec-symbol.replace
13749defineWellKnownSymbol('replace');
13750
13751
13752/***/ }),
13753/* 442 */
13754/***/ (function(module, exports, __webpack_require__) {
13755
13756var defineWellKnownSymbol = __webpack_require__(10);
13757
13758// `Symbol.search` well-known symbol
13759// https://tc39.es/ecma262/#sec-symbol.search
13760defineWellKnownSymbol('search');
13761
13762
13763/***/ }),
13764/* 443 */
13765/***/ (function(module, exports, __webpack_require__) {
13766
13767var defineWellKnownSymbol = __webpack_require__(10);
13768
13769// `Symbol.species` well-known symbol
13770// https://tc39.es/ecma262/#sec-symbol.species
13771defineWellKnownSymbol('species');
13772
13773
13774/***/ }),
13775/* 444 */
13776/***/ (function(module, exports, __webpack_require__) {
13777
13778var defineWellKnownSymbol = __webpack_require__(10);
13779
13780// `Symbol.split` well-known symbol
13781// https://tc39.es/ecma262/#sec-symbol.split
13782defineWellKnownSymbol('split');
13783
13784
13785/***/ }),
13786/* 445 */
13787/***/ (function(module, exports, __webpack_require__) {
13788
13789var defineWellKnownSymbol = __webpack_require__(10);
13790var defineSymbolToPrimitive = __webpack_require__(246);
13791
13792// `Symbol.toPrimitive` well-known symbol
13793// https://tc39.es/ecma262/#sec-symbol.toprimitive
13794defineWellKnownSymbol('toPrimitive');
13795
13796// `Symbol.prototype[@@toPrimitive]` method
13797// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
13798defineSymbolToPrimitive();
13799
13800
13801/***/ }),
13802/* 446 */
13803/***/ (function(module, exports, __webpack_require__) {
13804
13805var getBuiltIn = __webpack_require__(18);
13806var defineWellKnownSymbol = __webpack_require__(10);
13807var setToStringTag = __webpack_require__(52);
13808
13809// `Symbol.toStringTag` well-known symbol
13810// https://tc39.es/ecma262/#sec-symbol.tostringtag
13811defineWellKnownSymbol('toStringTag');
13812
13813// `Symbol.prototype[@@toStringTag]` property
13814// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
13815setToStringTag(getBuiltIn('Symbol'), 'Symbol');
13816
13817
13818/***/ }),
13819/* 447 */
13820/***/ (function(module, exports, __webpack_require__) {
13821
13822var defineWellKnownSymbol = __webpack_require__(10);
13823
13824// `Symbol.unscopables` well-known symbol
13825// https://tc39.es/ecma262/#sec-symbol.unscopables
13826defineWellKnownSymbol('unscopables');
13827
13828
13829/***/ }),
13830/* 448 */
13831/***/ (function(module, exports, __webpack_require__) {
13832
13833var global = __webpack_require__(7);
13834var setToStringTag = __webpack_require__(52);
13835
13836// JSON[@@toStringTag] property
13837// https://tc39.es/ecma262/#sec-json-@@tostringtag
13838setToStringTag(global.JSON, 'JSON', true);
13839
13840
13841/***/ }),
13842/* 449 */
13843/***/ (function(module, exports) {
13844
13845// empty
13846
13847
13848/***/ }),
13849/* 450 */
13850/***/ (function(module, exports) {
13851
13852// empty
13853
13854
13855/***/ }),
13856/* 451 */
13857/***/ (function(module, exports, __webpack_require__) {
13858
13859var defineWellKnownSymbol = __webpack_require__(10);
13860
13861// `Symbol.asyncDispose` well-known symbol
13862// https://github.com/tc39/proposal-using-statement
13863defineWellKnownSymbol('asyncDispose');
13864
13865
13866/***/ }),
13867/* 452 */
13868/***/ (function(module, exports, __webpack_require__) {
13869
13870var defineWellKnownSymbol = __webpack_require__(10);
13871
13872// `Symbol.dispose` well-known symbol
13873// https://github.com/tc39/proposal-using-statement
13874defineWellKnownSymbol('dispose');
13875
13876
13877/***/ }),
13878/* 453 */
13879/***/ (function(module, exports, __webpack_require__) {
13880
13881var defineWellKnownSymbol = __webpack_require__(10);
13882
13883// `Symbol.matcher` well-known symbol
13884// https://github.com/tc39/proposal-pattern-matching
13885defineWellKnownSymbol('matcher');
13886
13887
13888/***/ }),
13889/* 454 */
13890/***/ (function(module, exports, __webpack_require__) {
13891
13892var defineWellKnownSymbol = __webpack_require__(10);
13893
13894// `Symbol.metadataKey` well-known symbol
13895// https://github.com/tc39/proposal-decorator-metadata
13896defineWellKnownSymbol('metadataKey');
13897
13898
13899/***/ }),
13900/* 455 */
13901/***/ (function(module, exports, __webpack_require__) {
13902
13903var defineWellKnownSymbol = __webpack_require__(10);
13904
13905// `Symbol.observable` well-known symbol
13906// https://github.com/tc39/proposal-observable
13907defineWellKnownSymbol('observable');
13908
13909
13910/***/ }),
13911/* 456 */
13912/***/ (function(module, exports, __webpack_require__) {
13913
13914// TODO: Remove from `core-js@4`
13915var defineWellKnownSymbol = __webpack_require__(10);
13916
13917// `Symbol.metadata` well-known symbol
13918// https://github.com/tc39/proposal-decorators
13919defineWellKnownSymbol('metadata');
13920
13921
13922/***/ }),
13923/* 457 */
13924/***/ (function(module, exports, __webpack_require__) {
13925
13926// TODO: remove from `core-js@4`
13927var defineWellKnownSymbol = __webpack_require__(10);
13928
13929// `Symbol.patternMatch` well-known symbol
13930// https://github.com/tc39/proposal-pattern-matching
13931defineWellKnownSymbol('patternMatch');
13932
13933
13934/***/ }),
13935/* 458 */
13936/***/ (function(module, exports, __webpack_require__) {
13937
13938// TODO: remove from `core-js@4`
13939var defineWellKnownSymbol = __webpack_require__(10);
13940
13941defineWellKnownSymbol('replaceAll');
13942
13943
13944/***/ }),
13945/* 459 */
13946/***/ (function(module, exports, __webpack_require__) {
13947
13948module.exports = __webpack_require__(460);
13949
13950/***/ }),
13951/* 460 */
13952/***/ (function(module, exports, __webpack_require__) {
13953
13954module.exports = __webpack_require__(461);
13955
13956
13957/***/ }),
13958/* 461 */
13959/***/ (function(module, exports, __webpack_require__) {
13960
13961var parent = __webpack_require__(462);
13962
13963module.exports = parent;
13964
13965
13966/***/ }),
13967/* 462 */
13968/***/ (function(module, exports, __webpack_require__) {
13969
13970var parent = __webpack_require__(249);
13971
13972module.exports = parent;
13973
13974
13975/***/ }),
13976/* 463 */
13977/***/ (function(module, exports, __webpack_require__) {
13978
13979__webpack_require__(38);
13980__webpack_require__(53);
13981__webpack_require__(55);
13982__webpack_require__(248);
13983var WrappedWellKnownSymbolModule = __webpack_require__(148);
13984
13985module.exports = WrappedWellKnownSymbolModule.f('iterator');
13986
13987
13988/***/ }),
13989/* 464 */
13990/***/ (function(module, exports, __webpack_require__) {
13991
13992var parent = __webpack_require__(465);
13993
13994module.exports = parent;
13995
13996
13997/***/ }),
13998/* 465 */
13999/***/ (function(module, exports, __webpack_require__) {
14000
14001var isPrototypeOf = __webpack_require__(19);
14002var method = __webpack_require__(466);
14003
14004var ArrayPrototype = Array.prototype;
14005
14006module.exports = function (it) {
14007 var own = it.filter;
14008 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.filter) ? method : own;
14009};
14010
14011
14012/***/ }),
14013/* 466 */
14014/***/ (function(module, exports, __webpack_require__) {
14015
14016__webpack_require__(467);
14017var entryVirtual = __webpack_require__(40);
14018
14019module.exports = entryVirtual('Array').filter;
14020
14021
14022/***/ }),
14023/* 467 */
14024/***/ (function(module, exports, __webpack_require__) {
14025
14026"use strict";
14027
14028var $ = __webpack_require__(0);
14029var $filter = __webpack_require__(70).filter;
14030var arrayMethodHasSpeciesSupport = __webpack_require__(114);
14031
14032var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
14033
14034// `Array.prototype.filter` method
14035// https://tc39.es/ecma262/#sec-array.prototype.filter
14036// with adding support of @@species
14037$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
14038 filter: function filter(callbackfn /* , thisArg */) {
14039 return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
14040 }
14041});
14042
14043
14044/***/ }),
14045/* 468 */
14046/***/ (function(module, exports, __webpack_require__) {
14047
14048"use strict";
14049
14050
14051var _interopRequireDefault = __webpack_require__(1);
14052
14053var _slice = _interopRequireDefault(__webpack_require__(61));
14054
14055var _keys = _interopRequireDefault(__webpack_require__(59));
14056
14057var _concat = _interopRequireDefault(__webpack_require__(22));
14058
14059var _ = __webpack_require__(3);
14060
14061module.exports = function (AV) {
14062 var eventSplitter = /\s+/;
14063 var slice = (0, _slice.default)(Array.prototype);
14064 /**
14065 * @class
14066 *
14067 * <p>AV.Events is a fork of Backbone's Events module, provided for your
14068 * convenience.</p>
14069 *
14070 * <p>A module that can be mixed in to any object in order to provide
14071 * it with custom events. You may bind callback functions to an event
14072 * with `on`, or remove these functions with `off`.
14073 * Triggering an event fires all callbacks in the order that `on` was
14074 * called.
14075 *
14076 * @private
14077 * @example
14078 * var object = {};
14079 * _.extend(object, AV.Events);
14080 * object.on('expand', function(){ alert('expanded'); });
14081 * object.trigger('expand');</pre></p>
14082 *
14083 */
14084
14085 AV.Events = {
14086 /**
14087 * Bind one or more space separated events, `events`, to a `callback`
14088 * function. Passing `"all"` will bind the callback to all events fired.
14089 */
14090 on: function on(events, callback, context) {
14091 var calls, event, node, tail, list;
14092
14093 if (!callback) {
14094 return this;
14095 }
14096
14097 events = events.split(eventSplitter);
14098 calls = this._callbacks || (this._callbacks = {}); // Create an immutable callback list, allowing traversal during
14099 // modification. The tail is an empty object that will always be used
14100 // as the next node.
14101
14102 event = events.shift();
14103
14104 while (event) {
14105 list = calls[event];
14106 node = list ? list.tail : {};
14107 node.next = tail = {};
14108 node.context = context;
14109 node.callback = callback;
14110 calls[event] = {
14111 tail: tail,
14112 next: list ? list.next : node
14113 };
14114 event = events.shift();
14115 }
14116
14117 return this;
14118 },
14119
14120 /**
14121 * Remove one or many callbacks. If `context` is null, removes all callbacks
14122 * with that function. If `callback` is null, removes all callbacks for the
14123 * event. If `events` is null, removes all bound callbacks for all events.
14124 */
14125 off: function off(events, callback, context) {
14126 var event, calls, node, tail, cb, ctx; // No events, or removing *all* events.
14127
14128 if (!(calls = this._callbacks)) {
14129 return;
14130 }
14131
14132 if (!(events || callback || context)) {
14133 delete this._callbacks;
14134 return this;
14135 } // Loop through the listed events and contexts, splicing them out of the
14136 // linked list of callbacks if appropriate.
14137
14138
14139 events = events ? events.split(eventSplitter) : (0, _keys.default)(_).call(_, calls);
14140 event = events.shift();
14141
14142 while (event) {
14143 node = calls[event];
14144 delete calls[event];
14145
14146 if (!node || !(callback || context)) {
14147 continue;
14148 } // Create a new list, omitting the indicated callbacks.
14149
14150
14151 tail = node.tail;
14152 node = node.next;
14153
14154 while (node !== tail) {
14155 cb = node.callback;
14156 ctx = node.context;
14157
14158 if (callback && cb !== callback || context && ctx !== context) {
14159 this.on(event, cb, ctx);
14160 }
14161
14162 node = node.next;
14163 }
14164
14165 event = events.shift();
14166 }
14167
14168 return this;
14169 },
14170
14171 /**
14172 * Trigger one or many events, firing all bound callbacks. Callbacks are
14173 * passed the same arguments as `trigger` is, apart from the event name
14174 * (unless you're listening on `"all"`, which will cause your callback to
14175 * receive the true name of the event as the first argument).
14176 */
14177 trigger: function trigger(events) {
14178 var event, node, calls, tail, args, all, rest;
14179
14180 if (!(calls = this._callbacks)) {
14181 return this;
14182 }
14183
14184 all = calls.all;
14185 events = events.split(eventSplitter);
14186 rest = slice.call(arguments, 1); // For each event, walk through the linked list of callbacks twice,
14187 // first to trigger the event, then to trigger any `"all"` callbacks.
14188
14189 event = events.shift();
14190
14191 while (event) {
14192 node = calls[event];
14193
14194 if (node) {
14195 tail = node.tail;
14196
14197 while ((node = node.next) !== tail) {
14198 node.callback.apply(node.context || this, rest);
14199 }
14200 }
14201
14202 node = all;
14203
14204 if (node) {
14205 var _context;
14206
14207 tail = node.tail;
14208 args = (0, _concat.default)(_context = [event]).call(_context, rest);
14209
14210 while ((node = node.next) !== tail) {
14211 node.callback.apply(node.context || this, args);
14212 }
14213 }
14214
14215 event = events.shift();
14216 }
14217
14218 return this;
14219 }
14220 };
14221 /**
14222 * @function
14223 */
14224
14225 AV.Events.bind = AV.Events.on;
14226 /**
14227 * @function
14228 */
14229
14230 AV.Events.unbind = AV.Events.off;
14231};
14232
14233/***/ }),
14234/* 469 */
14235/***/ (function(module, exports, __webpack_require__) {
14236
14237"use strict";
14238
14239
14240var _interopRequireDefault = __webpack_require__(1);
14241
14242var _promise = _interopRequireDefault(__webpack_require__(12));
14243
14244var _ = __webpack_require__(3);
14245/*global navigator: false */
14246
14247
14248module.exports = function (AV) {
14249 /**
14250 * Creates a new GeoPoint with any of the following forms:<br>
14251 * @example
14252 * new GeoPoint(otherGeoPoint)
14253 * new GeoPoint(30, 30)
14254 * new GeoPoint([30, 30])
14255 * new GeoPoint({latitude: 30, longitude: 30})
14256 * new GeoPoint() // defaults to (0, 0)
14257 * @class
14258 *
14259 * <p>Represents a latitude / longitude point that may be associated
14260 * with a key in a AVObject or used as a reference point for geo queries.
14261 * This allows proximity-based queries on the key.</p>
14262 *
14263 * <p>Only one key in a class may contain a GeoPoint.</p>
14264 *
14265 * <p>Example:<pre>
14266 * var point = new AV.GeoPoint(30.0, -20.0);
14267 * var object = new AV.Object("PlaceObject");
14268 * object.set("location", point);
14269 * object.save();</pre></p>
14270 */
14271 AV.GeoPoint = function (arg1, arg2) {
14272 if (_.isArray(arg1)) {
14273 AV.GeoPoint._validate(arg1[0], arg1[1]);
14274
14275 this.latitude = arg1[0];
14276 this.longitude = arg1[1];
14277 } else if (_.isObject(arg1)) {
14278 AV.GeoPoint._validate(arg1.latitude, arg1.longitude);
14279
14280 this.latitude = arg1.latitude;
14281 this.longitude = arg1.longitude;
14282 } else if (_.isNumber(arg1) && _.isNumber(arg2)) {
14283 AV.GeoPoint._validate(arg1, arg2);
14284
14285 this.latitude = arg1;
14286 this.longitude = arg2;
14287 } else {
14288 this.latitude = 0;
14289 this.longitude = 0;
14290 } // Add properties so that anyone using Webkit or Mozilla will get an error
14291 // if they try to set values that are out of bounds.
14292
14293
14294 var self = this;
14295
14296 if (this.__defineGetter__ && this.__defineSetter__) {
14297 // Use _latitude and _longitude to actually store the values, and add
14298 // getters and setters for latitude and longitude.
14299 this._latitude = this.latitude;
14300 this._longitude = this.longitude;
14301
14302 this.__defineGetter__('latitude', function () {
14303 return self._latitude;
14304 });
14305
14306 this.__defineGetter__('longitude', function () {
14307 return self._longitude;
14308 });
14309
14310 this.__defineSetter__('latitude', function (val) {
14311 AV.GeoPoint._validate(val, self.longitude);
14312
14313 self._latitude = val;
14314 });
14315
14316 this.__defineSetter__('longitude', function (val) {
14317 AV.GeoPoint._validate(self.latitude, val);
14318
14319 self._longitude = val;
14320 });
14321 }
14322 };
14323 /**
14324 * @lends AV.GeoPoint.prototype
14325 * @property {float} latitude North-south portion of the coordinate, in range
14326 * [-90, 90]. Throws an exception if set out of range in a modern browser.
14327 * @property {float} longitude East-west portion of the coordinate, in range
14328 * [-180, 180]. Throws if set out of range in a modern browser.
14329 */
14330
14331 /**
14332 * Throws an exception if the given lat-long is out of bounds.
14333 * @private
14334 */
14335
14336
14337 AV.GeoPoint._validate = function (latitude, longitude) {
14338 if (latitude < -90.0) {
14339 throw new Error('AV.GeoPoint latitude ' + latitude + ' < -90.0.');
14340 }
14341
14342 if (latitude > 90.0) {
14343 throw new Error('AV.GeoPoint latitude ' + latitude + ' > 90.0.');
14344 }
14345
14346 if (longitude < -180.0) {
14347 throw new Error('AV.GeoPoint longitude ' + longitude + ' < -180.0.');
14348 }
14349
14350 if (longitude > 180.0) {
14351 throw new Error('AV.GeoPoint longitude ' + longitude + ' > 180.0.');
14352 }
14353 };
14354 /**
14355 * Creates a GeoPoint with the user's current location, if available.
14356 * @return {Promise.<AV.GeoPoint>}
14357 */
14358
14359
14360 AV.GeoPoint.current = function () {
14361 return new _promise.default(function (resolve, reject) {
14362 navigator.geolocation.getCurrentPosition(function (location) {
14363 resolve(new AV.GeoPoint({
14364 latitude: location.coords.latitude,
14365 longitude: location.coords.longitude
14366 }));
14367 }, reject);
14368 });
14369 };
14370
14371 _.extend(AV.GeoPoint.prototype,
14372 /** @lends AV.GeoPoint.prototype */
14373 {
14374 /**
14375 * Returns a JSON representation of the GeoPoint, suitable for AV.
14376 * @return {Object}
14377 */
14378 toJSON: function toJSON() {
14379 AV.GeoPoint._validate(this.latitude, this.longitude);
14380
14381 return {
14382 __type: 'GeoPoint',
14383 latitude: this.latitude,
14384 longitude: this.longitude
14385 };
14386 },
14387
14388 /**
14389 * Returns the distance from this GeoPoint to another in radians.
14390 * @param {AV.GeoPoint} point the other AV.GeoPoint.
14391 * @return {Number}
14392 */
14393 radiansTo: function radiansTo(point) {
14394 var d2r = Math.PI / 180.0;
14395 var lat1rad = this.latitude * d2r;
14396 var long1rad = this.longitude * d2r;
14397 var lat2rad = point.latitude * d2r;
14398 var long2rad = point.longitude * d2r;
14399 var deltaLat = lat1rad - lat2rad;
14400 var deltaLong = long1rad - long2rad;
14401 var sinDeltaLatDiv2 = Math.sin(deltaLat / 2);
14402 var sinDeltaLongDiv2 = Math.sin(deltaLong / 2); // Square of half the straight line chord distance between both points.
14403
14404 var a = sinDeltaLatDiv2 * sinDeltaLatDiv2 + Math.cos(lat1rad) * Math.cos(lat2rad) * sinDeltaLongDiv2 * sinDeltaLongDiv2;
14405 a = Math.min(1.0, a);
14406 return 2 * Math.asin(Math.sqrt(a));
14407 },
14408
14409 /**
14410 * Returns the distance from this GeoPoint to another in kilometers.
14411 * @param {AV.GeoPoint} point the other AV.GeoPoint.
14412 * @return {Number}
14413 */
14414 kilometersTo: function kilometersTo(point) {
14415 return this.radiansTo(point) * 6371.0;
14416 },
14417
14418 /**
14419 * Returns the distance from this GeoPoint to another in miles.
14420 * @param {AV.GeoPoint} point the other AV.GeoPoint.
14421 * @return {Number}
14422 */
14423 milesTo: function milesTo(point) {
14424 return this.radiansTo(point) * 3958.8;
14425 }
14426 });
14427};
14428
14429/***/ }),
14430/* 470 */
14431/***/ (function(module, exports, __webpack_require__) {
14432
14433"use strict";
14434
14435
14436var _ = __webpack_require__(3);
14437
14438module.exports = function (AV) {
14439 var PUBLIC_KEY = '*';
14440 /**
14441 * Creates a new ACL.
14442 * If no argument is given, the ACL has no permissions for anyone.
14443 * If the argument is a AV.User, the ACL will have read and write
14444 * permission for only that user.
14445 * If the argument is any other JSON object, that object will be interpretted
14446 * as a serialized ACL created with toJSON().
14447 * @see AV.Object#setACL
14448 * @class
14449 *
14450 * <p>An ACL, or Access Control List can be added to any
14451 * <code>AV.Object</code> to restrict access to only a subset of users
14452 * of your application.</p>
14453 */
14454
14455 AV.ACL = function (arg1) {
14456 var self = this;
14457 self.permissionsById = {};
14458
14459 if (_.isObject(arg1)) {
14460 if (arg1 instanceof AV.User) {
14461 self.setReadAccess(arg1, true);
14462 self.setWriteAccess(arg1, true);
14463 } else {
14464 if (_.isFunction(arg1)) {
14465 throw new Error('AV.ACL() called with a function. Did you forget ()?');
14466 }
14467
14468 AV._objectEach(arg1, function (accessList, userId) {
14469 if (!_.isString(userId)) {
14470 throw new Error('Tried to create an ACL with an invalid userId.');
14471 }
14472
14473 self.permissionsById[userId] = {};
14474
14475 AV._objectEach(accessList, function (allowed, permission) {
14476 if (permission !== 'read' && permission !== 'write') {
14477 throw new Error('Tried to create an ACL with an invalid permission type.');
14478 }
14479
14480 if (!_.isBoolean(allowed)) {
14481 throw new Error('Tried to create an ACL with an invalid permission value.');
14482 }
14483
14484 self.permissionsById[userId][permission] = allowed;
14485 });
14486 });
14487 }
14488 }
14489 };
14490 /**
14491 * Returns a JSON-encoded version of the ACL.
14492 * @return {Object}
14493 */
14494
14495
14496 AV.ACL.prototype.toJSON = function () {
14497 return _.clone(this.permissionsById);
14498 };
14499
14500 AV.ACL.prototype._setAccess = function (accessType, userId, allowed) {
14501 if (userId instanceof AV.User) {
14502 userId = userId.id;
14503 } else if (userId instanceof AV.Role) {
14504 userId = 'role:' + userId.getName();
14505 }
14506
14507 if (!_.isString(userId)) {
14508 throw new Error('userId must be a string.');
14509 }
14510
14511 if (!_.isBoolean(allowed)) {
14512 throw new Error('allowed must be either true or false.');
14513 }
14514
14515 var permissions = this.permissionsById[userId];
14516
14517 if (!permissions) {
14518 if (!allowed) {
14519 // The user already doesn't have this permission, so no action needed.
14520 return;
14521 } else {
14522 permissions = {};
14523 this.permissionsById[userId] = permissions;
14524 }
14525 }
14526
14527 if (allowed) {
14528 this.permissionsById[userId][accessType] = true;
14529 } else {
14530 delete permissions[accessType];
14531
14532 if (_.isEmpty(permissions)) {
14533 delete this.permissionsById[userId];
14534 }
14535 }
14536 };
14537
14538 AV.ACL.prototype._getAccess = function (accessType, userId) {
14539 if (userId instanceof AV.User) {
14540 userId = userId.id;
14541 } else if (userId instanceof AV.Role) {
14542 userId = 'role:' + userId.getName();
14543 }
14544
14545 var permissions = this.permissionsById[userId];
14546
14547 if (!permissions) {
14548 return false;
14549 }
14550
14551 return permissions[accessType] ? true : false;
14552 };
14553 /**
14554 * Set whether the given user is allowed to read this object.
14555 * @param userId An instance of AV.User or its objectId.
14556 * @param {Boolean} allowed Whether that user should have read access.
14557 */
14558
14559
14560 AV.ACL.prototype.setReadAccess = function (userId, allowed) {
14561 this._setAccess('read', userId, allowed);
14562 };
14563 /**
14564 * Get whether the given user id is *explicitly* allowed to read this object.
14565 * Even if this returns false, the user may still be able to access it if
14566 * getPublicReadAccess returns true or a role that the user belongs to has
14567 * write access.
14568 * @param userId An instance of AV.User or its objectId, or a AV.Role.
14569 * @return {Boolean}
14570 */
14571
14572
14573 AV.ACL.prototype.getReadAccess = function (userId) {
14574 return this._getAccess('read', userId);
14575 };
14576 /**
14577 * Set whether the given user id is allowed to write this object.
14578 * @param userId An instance of AV.User or its objectId, or a AV.Role..
14579 * @param {Boolean} allowed Whether that user should have write access.
14580 */
14581
14582
14583 AV.ACL.prototype.setWriteAccess = function (userId, allowed) {
14584 this._setAccess('write', userId, allowed);
14585 };
14586 /**
14587 * Get whether the given user id is *explicitly* allowed to write this object.
14588 * Even if this returns false, the user may still be able to write it if
14589 * getPublicWriteAccess returns true or a role that the user belongs to has
14590 * write access.
14591 * @param userId An instance of AV.User or its objectId, or a AV.Role.
14592 * @return {Boolean}
14593 */
14594
14595
14596 AV.ACL.prototype.getWriteAccess = function (userId) {
14597 return this._getAccess('write', userId);
14598 };
14599 /**
14600 * Set whether the public is allowed to read this object.
14601 * @param {Boolean} allowed
14602 */
14603
14604
14605 AV.ACL.prototype.setPublicReadAccess = function (allowed) {
14606 this.setReadAccess(PUBLIC_KEY, allowed);
14607 };
14608 /**
14609 * Get whether the public is allowed to read this object.
14610 * @return {Boolean}
14611 */
14612
14613
14614 AV.ACL.prototype.getPublicReadAccess = function () {
14615 return this.getReadAccess(PUBLIC_KEY);
14616 };
14617 /**
14618 * Set whether the public is allowed to write this object.
14619 * @param {Boolean} allowed
14620 */
14621
14622
14623 AV.ACL.prototype.setPublicWriteAccess = function (allowed) {
14624 this.setWriteAccess(PUBLIC_KEY, allowed);
14625 };
14626 /**
14627 * Get whether the public is allowed to write this object.
14628 * @return {Boolean}
14629 */
14630
14631
14632 AV.ACL.prototype.getPublicWriteAccess = function () {
14633 return this.getWriteAccess(PUBLIC_KEY);
14634 };
14635 /**
14636 * Get whether users belonging to the given role are allowed
14637 * to read this object. Even if this returns false, the role may
14638 * still be able to write it if a parent role has read access.
14639 *
14640 * @param role The name of the role, or a AV.Role object.
14641 * @return {Boolean} true if the role has read access. false otherwise.
14642 * @throws {String} If role is neither a AV.Role nor a String.
14643 */
14644
14645
14646 AV.ACL.prototype.getRoleReadAccess = function (role) {
14647 if (role instanceof AV.Role) {
14648 // Normalize to the String name
14649 role = role.getName();
14650 }
14651
14652 if (_.isString(role)) {
14653 return this.getReadAccess('role:' + role);
14654 }
14655
14656 throw new Error('role must be a AV.Role or a String');
14657 };
14658 /**
14659 * Get whether users belonging to the given role are allowed
14660 * to write this object. Even if this returns false, the role may
14661 * still be able to write it if a parent role has write access.
14662 *
14663 * @param role The name of the role, or a AV.Role object.
14664 * @return {Boolean} true if the role has write access. false otherwise.
14665 * @throws {String} If role is neither a AV.Role nor a String.
14666 */
14667
14668
14669 AV.ACL.prototype.getRoleWriteAccess = function (role) {
14670 if (role instanceof AV.Role) {
14671 // Normalize to the String name
14672 role = role.getName();
14673 }
14674
14675 if (_.isString(role)) {
14676 return this.getWriteAccess('role:' + role);
14677 }
14678
14679 throw new Error('role must be a AV.Role or a String');
14680 };
14681 /**
14682 * Set whether users belonging to the given role are allowed
14683 * to read this object.
14684 *
14685 * @param role The name of the role, or a AV.Role object.
14686 * @param {Boolean} allowed Whether the given role can read this object.
14687 * @throws {String} If role is neither a AV.Role nor a String.
14688 */
14689
14690
14691 AV.ACL.prototype.setRoleReadAccess = function (role, allowed) {
14692 if (role instanceof AV.Role) {
14693 // Normalize to the String name
14694 role = role.getName();
14695 }
14696
14697 if (_.isString(role)) {
14698 this.setReadAccess('role:' + role, allowed);
14699 return;
14700 }
14701
14702 throw new Error('role must be a AV.Role or a String');
14703 };
14704 /**
14705 * Set whether users belonging to the given role are allowed
14706 * to write this object.
14707 *
14708 * @param role The name of the role, or a AV.Role object.
14709 * @param {Boolean} allowed Whether the given role can write this object.
14710 * @throws {String} If role is neither a AV.Role nor a String.
14711 */
14712
14713
14714 AV.ACL.prototype.setRoleWriteAccess = function (role, allowed) {
14715 if (role instanceof AV.Role) {
14716 // Normalize to the String name
14717 role = role.getName();
14718 }
14719
14720 if (_.isString(role)) {
14721 this.setWriteAccess('role:' + role, allowed);
14722 return;
14723 }
14724
14725 throw new Error('role must be a AV.Role or a String');
14726 };
14727};
14728
14729/***/ }),
14730/* 471 */
14731/***/ (function(module, exports, __webpack_require__) {
14732
14733"use strict";
14734
14735
14736var _interopRequireDefault = __webpack_require__(1);
14737
14738var _concat = _interopRequireDefault(__webpack_require__(22));
14739
14740var _find = _interopRequireDefault(__webpack_require__(93));
14741
14742var _indexOf = _interopRequireDefault(__webpack_require__(71));
14743
14744var _map = _interopRequireDefault(__webpack_require__(35));
14745
14746var _ = __webpack_require__(3);
14747
14748module.exports = function (AV) {
14749 /**
14750 * @private
14751 * @class
14752 * A AV.Op is an atomic operation that can be applied to a field in a
14753 * AV.Object. For example, calling <code>object.set("foo", "bar")</code>
14754 * is an example of a AV.Op.Set. Calling <code>object.unset("foo")</code>
14755 * is a AV.Op.Unset. These operations are stored in a AV.Object and
14756 * sent to the server as part of <code>object.save()</code> operations.
14757 * Instances of AV.Op should be immutable.
14758 *
14759 * You should not create subclasses of AV.Op or instantiate AV.Op
14760 * directly.
14761 */
14762 AV.Op = function () {
14763 this._initialize.apply(this, arguments);
14764 };
14765
14766 _.extend(AV.Op.prototype,
14767 /** @lends AV.Op.prototype */
14768 {
14769 _initialize: function _initialize() {}
14770 });
14771
14772 _.extend(AV.Op, {
14773 /**
14774 * To create a new Op, call AV.Op._extend();
14775 * @private
14776 */
14777 _extend: AV._extend,
14778 // A map of __op string to decoder function.
14779 _opDecoderMap: {},
14780
14781 /**
14782 * Registers a function to convert a json object with an __op field into an
14783 * instance of a subclass of AV.Op.
14784 * @private
14785 */
14786 _registerDecoder: function _registerDecoder(opName, decoder) {
14787 AV.Op._opDecoderMap[opName] = decoder;
14788 },
14789
14790 /**
14791 * Converts a json object into an instance of a subclass of AV.Op.
14792 * @private
14793 */
14794 _decode: function _decode(json) {
14795 var decoder = AV.Op._opDecoderMap[json.__op];
14796
14797 if (decoder) {
14798 return decoder(json);
14799 } else {
14800 return undefined;
14801 }
14802 }
14803 });
14804 /*
14805 * Add a handler for Batch ops.
14806 */
14807
14808
14809 AV.Op._registerDecoder('Batch', function (json) {
14810 var op = null;
14811
14812 AV._arrayEach(json.ops, function (nextOp) {
14813 nextOp = AV.Op._decode(nextOp);
14814 op = nextOp._mergeWithPrevious(op);
14815 });
14816
14817 return op;
14818 });
14819 /**
14820 * @private
14821 * @class
14822 * A Set operation indicates that either the field was changed using
14823 * AV.Object.set, or it is a mutable container that was detected as being
14824 * changed.
14825 */
14826
14827
14828 AV.Op.Set = AV.Op._extend(
14829 /** @lends AV.Op.Set.prototype */
14830 {
14831 _initialize: function _initialize(value) {
14832 this._value = value;
14833 },
14834
14835 /**
14836 * Returns the new value of this field after the set.
14837 */
14838 value: function value() {
14839 return this._value;
14840 },
14841
14842 /**
14843 * Returns a JSON version of the operation suitable for sending to AV.
14844 * @return {Object}
14845 */
14846 toJSON: function toJSON() {
14847 return AV._encode(this.value());
14848 },
14849 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14850 return this;
14851 },
14852 _estimate: function _estimate(oldValue) {
14853 return this.value();
14854 }
14855 });
14856 /**
14857 * A sentinel value that is returned by AV.Op.Unset._estimate to
14858 * indicate the field should be deleted. Basically, if you find _UNSET as a
14859 * value in your object, you should remove that key.
14860 */
14861
14862 AV.Op._UNSET = {};
14863 /**
14864 * @private
14865 * @class
14866 * An Unset operation indicates that this field has been deleted from the
14867 * object.
14868 */
14869
14870 AV.Op.Unset = AV.Op._extend(
14871 /** @lends AV.Op.Unset.prototype */
14872 {
14873 /**
14874 * Returns a JSON version of the operation suitable for sending to AV.
14875 * @return {Object}
14876 */
14877 toJSON: function toJSON() {
14878 return {
14879 __op: 'Delete'
14880 };
14881 },
14882 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14883 return this;
14884 },
14885 _estimate: function _estimate(oldValue) {
14886 return AV.Op._UNSET;
14887 }
14888 });
14889
14890 AV.Op._registerDecoder('Delete', function (json) {
14891 return new AV.Op.Unset();
14892 });
14893 /**
14894 * @private
14895 * @class
14896 * An Increment is an atomic operation where the numeric value for the field
14897 * will be increased by a given amount.
14898 */
14899
14900
14901 AV.Op.Increment = AV.Op._extend(
14902 /** @lends AV.Op.Increment.prototype */
14903 {
14904 _initialize: function _initialize(amount) {
14905 this._amount = amount;
14906 },
14907
14908 /**
14909 * Returns the amount to increment by.
14910 * @return {Number} the amount to increment by.
14911 */
14912 amount: function amount() {
14913 return this._amount;
14914 },
14915
14916 /**
14917 * Returns a JSON version of the operation suitable for sending to AV.
14918 * @return {Object}
14919 */
14920 toJSON: function toJSON() {
14921 return {
14922 __op: 'Increment',
14923 amount: this._amount
14924 };
14925 },
14926 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14927 if (!previous) {
14928 return this;
14929 } else if (previous instanceof AV.Op.Unset) {
14930 return new AV.Op.Set(this.amount());
14931 } else if (previous instanceof AV.Op.Set) {
14932 return new AV.Op.Set(previous.value() + this.amount());
14933 } else if (previous instanceof AV.Op.Increment) {
14934 return new AV.Op.Increment(this.amount() + previous.amount());
14935 } else {
14936 throw new Error('Op is invalid after previous op.');
14937 }
14938 },
14939 _estimate: function _estimate(oldValue) {
14940 if (!oldValue) {
14941 return this.amount();
14942 }
14943
14944 return oldValue + this.amount();
14945 }
14946 });
14947
14948 AV.Op._registerDecoder('Increment', function (json) {
14949 return new AV.Op.Increment(json.amount);
14950 });
14951 /**
14952 * @private
14953 * @class
14954 * BitAnd is an atomic operation where the given value will be bit and to the
14955 * value than is stored in this field.
14956 */
14957
14958
14959 AV.Op.BitAnd = AV.Op._extend(
14960 /** @lends AV.Op.BitAnd.prototype */
14961 {
14962 _initialize: function _initialize(value) {
14963 this._value = value;
14964 },
14965 value: function value() {
14966 return this._value;
14967 },
14968
14969 /**
14970 * Returns a JSON version of the operation suitable for sending to AV.
14971 * @return {Object}
14972 */
14973 toJSON: function toJSON() {
14974 return {
14975 __op: 'BitAnd',
14976 value: this.value()
14977 };
14978 },
14979 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14980 if (!previous) {
14981 return this;
14982 } else if (previous instanceof AV.Op.Unset) {
14983 return new AV.Op.Set(0);
14984 } else if (previous instanceof AV.Op.Set) {
14985 return new AV.Op.Set(previous.value() & this.value());
14986 } else {
14987 throw new Error('Op is invalid after previous op.');
14988 }
14989 },
14990 _estimate: function _estimate(oldValue) {
14991 return oldValue & this.value();
14992 }
14993 });
14994
14995 AV.Op._registerDecoder('BitAnd', function (json) {
14996 return new AV.Op.BitAnd(json.value);
14997 });
14998 /**
14999 * @private
15000 * @class
15001 * BitOr is an atomic operation where the given value will be bit and to the
15002 * value than is stored in this field.
15003 */
15004
15005
15006 AV.Op.BitOr = AV.Op._extend(
15007 /** @lends AV.Op.BitOr.prototype */
15008 {
15009 _initialize: function _initialize(value) {
15010 this._value = value;
15011 },
15012 value: function value() {
15013 return this._value;
15014 },
15015
15016 /**
15017 * Returns a JSON version of the operation suitable for sending to AV.
15018 * @return {Object}
15019 */
15020 toJSON: function toJSON() {
15021 return {
15022 __op: 'BitOr',
15023 value: this.value()
15024 };
15025 },
15026 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15027 if (!previous) {
15028 return this;
15029 } else if (previous instanceof AV.Op.Unset) {
15030 return new AV.Op.Set(this.value());
15031 } else if (previous instanceof AV.Op.Set) {
15032 return new AV.Op.Set(previous.value() | this.value());
15033 } else {
15034 throw new Error('Op is invalid after previous op.');
15035 }
15036 },
15037 _estimate: function _estimate(oldValue) {
15038 return oldValue | this.value();
15039 }
15040 });
15041
15042 AV.Op._registerDecoder('BitOr', function (json) {
15043 return new AV.Op.BitOr(json.value);
15044 });
15045 /**
15046 * @private
15047 * @class
15048 * BitXor is an atomic operation where the given value will be bit and to the
15049 * value than is stored in this field.
15050 */
15051
15052
15053 AV.Op.BitXor = AV.Op._extend(
15054 /** @lends AV.Op.BitXor.prototype */
15055 {
15056 _initialize: function _initialize(value) {
15057 this._value = value;
15058 },
15059 value: function value() {
15060 return this._value;
15061 },
15062
15063 /**
15064 * Returns a JSON version of the operation suitable for sending to AV.
15065 * @return {Object}
15066 */
15067 toJSON: function toJSON() {
15068 return {
15069 __op: 'BitXor',
15070 value: this.value()
15071 };
15072 },
15073 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15074 if (!previous) {
15075 return this;
15076 } else if (previous instanceof AV.Op.Unset) {
15077 return new AV.Op.Set(this.value());
15078 } else if (previous instanceof AV.Op.Set) {
15079 return new AV.Op.Set(previous.value() ^ this.value());
15080 } else {
15081 throw new Error('Op is invalid after previous op.');
15082 }
15083 },
15084 _estimate: function _estimate(oldValue) {
15085 return oldValue ^ this.value();
15086 }
15087 });
15088
15089 AV.Op._registerDecoder('BitXor', function (json) {
15090 return new AV.Op.BitXor(json.value);
15091 });
15092 /**
15093 * @private
15094 * @class
15095 * Add is an atomic operation where the given objects will be appended to the
15096 * array that is stored in this field.
15097 */
15098
15099
15100 AV.Op.Add = AV.Op._extend(
15101 /** @lends AV.Op.Add.prototype */
15102 {
15103 _initialize: function _initialize(objects) {
15104 this._objects = objects;
15105 },
15106
15107 /**
15108 * Returns the objects to be added to the array.
15109 * @return {Array} The objects to be added to the array.
15110 */
15111 objects: function objects() {
15112 return this._objects;
15113 },
15114
15115 /**
15116 * Returns a JSON version of the operation suitable for sending to AV.
15117 * @return {Object}
15118 */
15119 toJSON: function toJSON() {
15120 return {
15121 __op: 'Add',
15122 objects: AV._encode(this.objects())
15123 };
15124 },
15125 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15126 if (!previous) {
15127 return this;
15128 } else if (previous instanceof AV.Op.Unset) {
15129 return new AV.Op.Set(this.objects());
15130 } else if (previous instanceof AV.Op.Set) {
15131 return new AV.Op.Set(this._estimate(previous.value()));
15132 } else if (previous instanceof AV.Op.Add) {
15133 var _context;
15134
15135 return new AV.Op.Add((0, _concat.default)(_context = previous.objects()).call(_context, this.objects()));
15136 } else {
15137 throw new Error('Op is invalid after previous op.');
15138 }
15139 },
15140 _estimate: function _estimate(oldValue) {
15141 if (!oldValue) {
15142 return _.clone(this.objects());
15143 } else {
15144 return (0, _concat.default)(oldValue).call(oldValue, this.objects());
15145 }
15146 }
15147 });
15148
15149 AV.Op._registerDecoder('Add', function (json) {
15150 return new AV.Op.Add(AV._decode(json.objects));
15151 });
15152 /**
15153 * @private
15154 * @class
15155 * AddUnique is an atomic operation where the given items will be appended to
15156 * the array that is stored in this field only if they were not already
15157 * present in the array.
15158 */
15159
15160
15161 AV.Op.AddUnique = AV.Op._extend(
15162 /** @lends AV.Op.AddUnique.prototype */
15163 {
15164 _initialize: function _initialize(objects) {
15165 this._objects = _.uniq(objects);
15166 },
15167
15168 /**
15169 * Returns the objects to be added to the array.
15170 * @return {Array} The objects to be added to the array.
15171 */
15172 objects: function objects() {
15173 return this._objects;
15174 },
15175
15176 /**
15177 * Returns a JSON version of the operation suitable for sending to AV.
15178 * @return {Object}
15179 */
15180 toJSON: function toJSON() {
15181 return {
15182 __op: 'AddUnique',
15183 objects: AV._encode(this.objects())
15184 };
15185 },
15186 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15187 if (!previous) {
15188 return this;
15189 } else if (previous instanceof AV.Op.Unset) {
15190 return new AV.Op.Set(this.objects());
15191 } else if (previous instanceof AV.Op.Set) {
15192 return new AV.Op.Set(this._estimate(previous.value()));
15193 } else if (previous instanceof AV.Op.AddUnique) {
15194 return new AV.Op.AddUnique(this._estimate(previous.objects()));
15195 } else {
15196 throw new Error('Op is invalid after previous op.');
15197 }
15198 },
15199 _estimate: function _estimate(oldValue) {
15200 if (!oldValue) {
15201 return _.clone(this.objects());
15202 } else {
15203 // We can't just take the _.uniq(_.union(...)) of oldValue and
15204 // this.objects, because the uniqueness may not apply to oldValue
15205 // (especially if the oldValue was set via .set())
15206 var newValue = _.clone(oldValue);
15207
15208 AV._arrayEach(this.objects(), function (obj) {
15209 if (obj instanceof AV.Object && obj.id) {
15210 var matchingObj = (0, _find.default)(_).call(_, newValue, function (anObj) {
15211 return anObj instanceof AV.Object && anObj.id === obj.id;
15212 });
15213
15214 if (!matchingObj) {
15215 newValue.push(obj);
15216 } else {
15217 var index = (0, _indexOf.default)(_).call(_, newValue, matchingObj);
15218 newValue[index] = obj;
15219 }
15220 } else if (!_.contains(newValue, obj)) {
15221 newValue.push(obj);
15222 }
15223 });
15224
15225 return newValue;
15226 }
15227 }
15228 });
15229
15230 AV.Op._registerDecoder('AddUnique', function (json) {
15231 return new AV.Op.AddUnique(AV._decode(json.objects));
15232 });
15233 /**
15234 * @private
15235 * @class
15236 * Remove is an atomic operation where the given objects will be removed from
15237 * the array that is stored in this field.
15238 */
15239
15240
15241 AV.Op.Remove = AV.Op._extend(
15242 /** @lends AV.Op.Remove.prototype */
15243 {
15244 _initialize: function _initialize(objects) {
15245 this._objects = _.uniq(objects);
15246 },
15247
15248 /**
15249 * Returns the objects to be removed from the array.
15250 * @return {Array} The objects to be removed from the array.
15251 */
15252 objects: function objects() {
15253 return this._objects;
15254 },
15255
15256 /**
15257 * Returns a JSON version of the operation suitable for sending to AV.
15258 * @return {Object}
15259 */
15260 toJSON: function toJSON() {
15261 return {
15262 __op: 'Remove',
15263 objects: AV._encode(this.objects())
15264 };
15265 },
15266 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15267 if (!previous) {
15268 return this;
15269 } else if (previous instanceof AV.Op.Unset) {
15270 return previous;
15271 } else if (previous instanceof AV.Op.Set) {
15272 return new AV.Op.Set(this._estimate(previous.value()));
15273 } else if (previous instanceof AV.Op.Remove) {
15274 return new AV.Op.Remove(_.union(previous.objects(), this.objects()));
15275 } else {
15276 throw new Error('Op is invalid after previous op.');
15277 }
15278 },
15279 _estimate: function _estimate(oldValue) {
15280 if (!oldValue) {
15281 return [];
15282 } else {
15283 var newValue = _.difference(oldValue, this.objects()); // If there are saved AV Objects being removed, also remove them.
15284
15285
15286 AV._arrayEach(this.objects(), function (obj) {
15287 if (obj instanceof AV.Object && obj.id) {
15288 newValue = _.reject(newValue, function (other) {
15289 return other instanceof AV.Object && other.id === obj.id;
15290 });
15291 }
15292 });
15293
15294 return newValue;
15295 }
15296 }
15297 });
15298
15299 AV.Op._registerDecoder('Remove', function (json) {
15300 return new AV.Op.Remove(AV._decode(json.objects));
15301 });
15302 /**
15303 * @private
15304 * @class
15305 * A Relation operation indicates that the field is an instance of
15306 * AV.Relation, and objects are being added to, or removed from, that
15307 * relation.
15308 */
15309
15310
15311 AV.Op.Relation = AV.Op._extend(
15312 /** @lends AV.Op.Relation.prototype */
15313 {
15314 _initialize: function _initialize(adds, removes) {
15315 this._targetClassName = null;
15316 var self = this;
15317
15318 var pointerToId = function pointerToId(object) {
15319 if (object instanceof AV.Object) {
15320 if (!object.id) {
15321 throw new Error("You can't add an unsaved AV.Object to a relation.");
15322 }
15323
15324 if (!self._targetClassName) {
15325 self._targetClassName = object.className;
15326 }
15327
15328 if (self._targetClassName !== object.className) {
15329 throw new Error('Tried to create a AV.Relation with 2 different types: ' + self._targetClassName + ' and ' + object.className + '.');
15330 }
15331
15332 return object.id;
15333 }
15334
15335 return object;
15336 };
15337
15338 this.relationsToAdd = _.uniq((0, _map.default)(_).call(_, adds, pointerToId));
15339 this.relationsToRemove = _.uniq((0, _map.default)(_).call(_, removes, pointerToId));
15340 },
15341
15342 /**
15343 * Returns an array of unfetched AV.Object that are being added to the
15344 * relation.
15345 * @return {Array}
15346 */
15347 added: function added() {
15348 var self = this;
15349 return (0, _map.default)(_).call(_, this.relationsToAdd, function (objectId) {
15350 var object = AV.Object._create(self._targetClassName);
15351
15352 object.id = objectId;
15353 return object;
15354 });
15355 },
15356
15357 /**
15358 * Returns an array of unfetched AV.Object that are being removed from
15359 * the relation.
15360 * @return {Array}
15361 */
15362 removed: function removed() {
15363 var self = this;
15364 return (0, _map.default)(_).call(_, this.relationsToRemove, function (objectId) {
15365 var object = AV.Object._create(self._targetClassName);
15366
15367 object.id = objectId;
15368 return object;
15369 });
15370 },
15371
15372 /**
15373 * Returns a JSON version of the operation suitable for sending to AV.
15374 * @return {Object}
15375 */
15376 toJSON: function toJSON() {
15377 var adds = null;
15378 var removes = null;
15379 var self = this;
15380
15381 var idToPointer = function idToPointer(id) {
15382 return {
15383 __type: 'Pointer',
15384 className: self._targetClassName,
15385 objectId: id
15386 };
15387 };
15388
15389 var pointers = null;
15390
15391 if (this.relationsToAdd.length > 0) {
15392 pointers = (0, _map.default)(_).call(_, this.relationsToAdd, idToPointer);
15393 adds = {
15394 __op: 'AddRelation',
15395 objects: pointers
15396 };
15397 }
15398
15399 if (this.relationsToRemove.length > 0) {
15400 pointers = (0, _map.default)(_).call(_, this.relationsToRemove, idToPointer);
15401 removes = {
15402 __op: 'RemoveRelation',
15403 objects: pointers
15404 };
15405 }
15406
15407 if (adds && removes) {
15408 return {
15409 __op: 'Batch',
15410 ops: [adds, removes]
15411 };
15412 }
15413
15414 return adds || removes || {};
15415 },
15416 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15417 if (!previous) {
15418 return this;
15419 } else if (previous instanceof AV.Op.Unset) {
15420 throw new Error("You can't modify a relation after deleting it.");
15421 } else if (previous instanceof AV.Op.Relation) {
15422 if (previous._targetClassName && previous._targetClassName !== this._targetClassName) {
15423 throw new Error('Related object must be of class ' + previous._targetClassName + ', but ' + this._targetClassName + ' was passed in.');
15424 }
15425
15426 var newAdd = _.union(_.difference(previous.relationsToAdd, this.relationsToRemove), this.relationsToAdd);
15427
15428 var newRemove = _.union(_.difference(previous.relationsToRemove, this.relationsToAdd), this.relationsToRemove);
15429
15430 var newRelation = new AV.Op.Relation(newAdd, newRemove);
15431 newRelation._targetClassName = this._targetClassName;
15432 return newRelation;
15433 } else {
15434 throw new Error('Op is invalid after previous op.');
15435 }
15436 },
15437 _estimate: function _estimate(oldValue, object, key) {
15438 if (!oldValue) {
15439 var relation = new AV.Relation(object, key);
15440 relation.targetClassName = this._targetClassName;
15441 } else if (oldValue instanceof AV.Relation) {
15442 if (this._targetClassName) {
15443 if (oldValue.targetClassName) {
15444 if (oldValue.targetClassName !== this._targetClassName) {
15445 throw new Error('Related object must be a ' + oldValue.targetClassName + ', but a ' + this._targetClassName + ' was passed in.');
15446 }
15447 } else {
15448 oldValue.targetClassName = this._targetClassName;
15449 }
15450 }
15451
15452 return oldValue;
15453 } else {
15454 throw new Error('Op is invalid after previous op.');
15455 }
15456 }
15457 });
15458
15459 AV.Op._registerDecoder('AddRelation', function (json) {
15460 return new AV.Op.Relation(AV._decode(json.objects), []);
15461 });
15462
15463 AV.Op._registerDecoder('RemoveRelation', function (json) {
15464 return new AV.Op.Relation([], AV._decode(json.objects));
15465 });
15466};
15467
15468/***/ }),
15469/* 472 */
15470/***/ (function(module, exports, __webpack_require__) {
15471
15472var parent = __webpack_require__(473);
15473
15474module.exports = parent;
15475
15476
15477/***/ }),
15478/* 473 */
15479/***/ (function(module, exports, __webpack_require__) {
15480
15481var isPrototypeOf = __webpack_require__(19);
15482var method = __webpack_require__(474);
15483
15484var ArrayPrototype = Array.prototype;
15485
15486module.exports = function (it) {
15487 var own = it.find;
15488 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.find) ? method : own;
15489};
15490
15491
15492/***/ }),
15493/* 474 */
15494/***/ (function(module, exports, __webpack_require__) {
15495
15496__webpack_require__(475);
15497var entryVirtual = __webpack_require__(40);
15498
15499module.exports = entryVirtual('Array').find;
15500
15501
15502/***/ }),
15503/* 475 */
15504/***/ (function(module, exports, __webpack_require__) {
15505
15506"use strict";
15507
15508var $ = __webpack_require__(0);
15509var $find = __webpack_require__(70).find;
15510var addToUnscopables = __webpack_require__(169);
15511
15512var FIND = 'find';
15513var SKIPS_HOLES = true;
15514
15515// Shouldn't skip holes
15516if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
15517
15518// `Array.prototype.find` method
15519// https://tc39.es/ecma262/#sec-array.prototype.find
15520$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
15521 find: function find(callbackfn /* , that = undefined */) {
15522 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
15523 }
15524});
15525
15526// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
15527addToUnscopables(FIND);
15528
15529
15530/***/ }),
15531/* 476 */
15532/***/ (function(module, exports, __webpack_require__) {
15533
15534"use strict";
15535
15536
15537var _ = __webpack_require__(3);
15538
15539module.exports = function (AV) {
15540 /**
15541 * Creates a new Relation for the given parent object and key. This
15542 * constructor should rarely be used directly, but rather created by
15543 * {@link AV.Object#relation}.
15544 * @param {AV.Object} parent The parent of this relation.
15545 * @param {String} key The key for this relation on the parent.
15546 * @see AV.Object#relation
15547 * @class
15548 *
15549 * <p>
15550 * A class that is used to access all of the children of a many-to-many
15551 * relationship. Each instance of AV.Relation is associated with a
15552 * particular parent object and key.
15553 * </p>
15554 */
15555 AV.Relation = function (parent, key) {
15556 if (!_.isString(key)) {
15557 throw new TypeError('key must be a string');
15558 }
15559
15560 this.parent = parent;
15561 this.key = key;
15562 this.targetClassName = null;
15563 };
15564 /**
15565 * Creates a query that can be used to query the parent objects in this relation.
15566 * @param {String} parentClass The parent class or name.
15567 * @param {String} relationKey The relation field key in parent.
15568 * @param {AV.Object} child The child object.
15569 * @return {AV.Query}
15570 */
15571
15572
15573 AV.Relation.reverseQuery = function (parentClass, relationKey, child) {
15574 var query = new AV.Query(parentClass);
15575 query.equalTo(relationKey, child._toPointer());
15576 return query;
15577 };
15578
15579 _.extend(AV.Relation.prototype,
15580 /** @lends AV.Relation.prototype */
15581 {
15582 /**
15583 * Makes sure that this relation has the right parent and key.
15584 * @private
15585 */
15586 _ensureParentAndKey: function _ensureParentAndKey(parent, key) {
15587 this.parent = this.parent || parent;
15588 this.key = this.key || key;
15589
15590 if (this.parent !== parent) {
15591 throw new Error('Internal Error. Relation retrieved from two different Objects.');
15592 }
15593
15594 if (this.key !== key) {
15595 throw new Error('Internal Error. Relation retrieved from two different keys.');
15596 }
15597 },
15598
15599 /**
15600 * Adds a AV.Object or an array of AV.Objects to the relation.
15601 * @param {AV.Object|AV.Object[]} objects The item or items to add.
15602 */
15603 add: function add(objects) {
15604 if (!_.isArray(objects)) {
15605 objects = [objects];
15606 }
15607
15608 var change = new AV.Op.Relation(objects, []);
15609 this.parent.set(this.key, change);
15610 this.targetClassName = change._targetClassName;
15611 },
15612
15613 /**
15614 * Removes a AV.Object or an array of AV.Objects from this relation.
15615 * @param {AV.Object|AV.Object[]} objects The item or items to remove.
15616 */
15617 remove: function remove(objects) {
15618 if (!_.isArray(objects)) {
15619 objects = [objects];
15620 }
15621
15622 var change = new AV.Op.Relation([], objects);
15623 this.parent.set(this.key, change);
15624 this.targetClassName = change._targetClassName;
15625 },
15626
15627 /**
15628 * Returns a JSON version of the object suitable for saving to disk.
15629 * @return {Object}
15630 */
15631 toJSON: function toJSON() {
15632 return {
15633 __type: 'Relation',
15634 className: this.targetClassName
15635 };
15636 },
15637
15638 /**
15639 * Returns a AV.Query that is limited to objects in this
15640 * relation.
15641 * @return {AV.Query}
15642 */
15643 query: function query() {
15644 var targetClass;
15645 var query;
15646
15647 if (!this.targetClassName) {
15648 targetClass = AV.Object._getSubclass(this.parent.className);
15649 query = new AV.Query(targetClass);
15650 query._defaultParams.redirectClassNameForKey = this.key;
15651 } else {
15652 targetClass = AV.Object._getSubclass(this.targetClassName);
15653 query = new AV.Query(targetClass);
15654 }
15655
15656 query._addCondition('$relatedTo', 'object', this.parent._toPointer());
15657
15658 query._addCondition('$relatedTo', 'key', this.key);
15659
15660 return query;
15661 }
15662 });
15663};
15664
15665/***/ }),
15666/* 477 */
15667/***/ (function(module, exports, __webpack_require__) {
15668
15669"use strict";
15670
15671
15672var _interopRequireDefault = __webpack_require__(1);
15673
15674var _promise = _interopRequireDefault(__webpack_require__(12));
15675
15676var _ = __webpack_require__(3);
15677
15678var cos = __webpack_require__(478);
15679
15680var qiniu = __webpack_require__(479);
15681
15682var s3 = __webpack_require__(525);
15683
15684var AVError = __webpack_require__(46);
15685
15686var _require = __webpack_require__(27),
15687 request = _require.request,
15688 AVRequest = _require._request;
15689
15690var _require2 = __webpack_require__(30),
15691 tap = _require2.tap,
15692 transformFetchOptions = _require2.transformFetchOptions;
15693
15694var debug = __webpack_require__(60)('leancloud:file');
15695
15696var parseBase64 = __webpack_require__(529);
15697
15698module.exports = function (AV) {
15699 // port from browserify path module
15700 // since react-native packager won't shim node modules.
15701 var extname = function extname(path) {
15702 if (!_.isString(path)) return '';
15703 return path.match(/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/)[4];
15704 };
15705
15706 var b64Digit = function b64Digit(number) {
15707 if (number < 26) {
15708 return String.fromCharCode(65 + number);
15709 }
15710
15711 if (number < 52) {
15712 return String.fromCharCode(97 + (number - 26));
15713 }
15714
15715 if (number < 62) {
15716 return String.fromCharCode(48 + (number - 52));
15717 }
15718
15719 if (number === 62) {
15720 return '+';
15721 }
15722
15723 if (number === 63) {
15724 return '/';
15725 }
15726
15727 throw new Error('Tried to encode large digit ' + number + ' in base64.');
15728 };
15729
15730 var encodeBase64 = function encodeBase64(array) {
15731 var chunks = [];
15732 chunks.length = Math.ceil(array.length / 3);
15733
15734 _.times(chunks.length, function (i) {
15735 var b1 = array[i * 3];
15736 var b2 = array[i * 3 + 1] || 0;
15737 var b3 = array[i * 3 + 2] || 0;
15738 var has2 = i * 3 + 1 < array.length;
15739 var has3 = i * 3 + 2 < array.length;
15740 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('');
15741 });
15742
15743 return chunks.join('');
15744 };
15745 /**
15746 * An AV.File is a local representation of a file that is saved to the AV
15747 * cloud.
15748 * @param name {String} The file's name. This will change to a unique value
15749 * once the file has finished saving.
15750 * @param data {Array} The data for the file, as either:
15751 * 1. an Array of byte value Numbers, or
15752 * 2. an Object like { base64: "..." } with a base64-encoded String.
15753 * 3. a Blob(File) selected with a file upload control in a browser.
15754 * 4. an Object like { blob: {uri: "..."} } that mimics Blob
15755 * in some non-browser environments such as React Native.
15756 * 5. a Buffer in Node.js runtime.
15757 * 6. a Stream in Node.js runtime.
15758 *
15759 * For example:<pre>
15760 * var fileUploadControl = $("#profilePhotoFileUpload")[0];
15761 * if (fileUploadControl.files.length > 0) {
15762 * var file = fileUploadControl.files[0];
15763 * var name = "photo.jpg";
15764 * var file = new AV.File(name, file);
15765 * file.save().then(function() {
15766 * // The file has been saved to AV.
15767 * }, function(error) {
15768 * // The file either could not be read, or could not be saved to AV.
15769 * });
15770 * }</pre>
15771 *
15772 * @class
15773 * @param [mimeType] {String} Content-Type header to use for the file. If
15774 * this is omitted, the content type will be inferred from the name's
15775 * extension.
15776 */
15777
15778
15779 AV.File = function (name, data, mimeType) {
15780 this.attributes = {
15781 name: name,
15782 url: '',
15783 metaData: {},
15784 // 用来存储转换后要上传的 base64 String
15785 base64: ''
15786 };
15787
15788 if (_.isString(data)) {
15789 throw new TypeError('Creating an AV.File from a String is not yet supported.');
15790 }
15791
15792 if (_.isArray(data)) {
15793 this.attributes.metaData.size = data.length;
15794 data = {
15795 base64: encodeBase64(data)
15796 };
15797 }
15798
15799 this._extName = '';
15800 this._data = data;
15801 this._uploadHeaders = {};
15802
15803 if (data && data.blob && typeof data.blob.uri === 'string') {
15804 this._extName = extname(data.blob.uri);
15805 }
15806
15807 if (typeof Blob !== 'undefined' && data instanceof Blob) {
15808 if (data.size) {
15809 this.attributes.metaData.size = data.size;
15810 }
15811
15812 if (data.name) {
15813 this._extName = extname(data.name);
15814 }
15815 }
15816
15817 var owner;
15818
15819 if (data && data.owner) {
15820 owner = data.owner;
15821 } else if (!AV._config.disableCurrentUser) {
15822 try {
15823 owner = AV.User.current();
15824 } catch (error) {
15825 if ('SYNC_API_NOT_AVAILABLE' !== error.code) {
15826 throw error;
15827 }
15828 }
15829 }
15830
15831 this.attributes.metaData.owner = owner ? owner.id : 'unknown';
15832 this.set('mime_type', mimeType);
15833 };
15834 /**
15835 * Creates a fresh AV.File object with exists url for saving to AVOS Cloud.
15836 * @param {String} name the file name
15837 * @param {String} url the file url.
15838 * @param {Object} [metaData] the file metadata object.
15839 * @param {String} [type] Content-Type header to use for the file. If
15840 * this is omitted, the content type will be inferred from the name's
15841 * extension.
15842 * @return {AV.File} the file object
15843 */
15844
15845
15846 AV.File.withURL = function (name, url, metaData, type) {
15847 if (!name || !url) {
15848 throw new Error('Please provide file name and url');
15849 }
15850
15851 var file = new AV.File(name, null, type); //copy metaData properties to file.
15852
15853 if (metaData) {
15854 for (var prop in metaData) {
15855 if (!file.attributes.metaData[prop]) file.attributes.metaData[prop] = metaData[prop];
15856 }
15857 }
15858
15859 file.attributes.url = url; //Mark the file is from external source.
15860
15861 file.attributes.metaData.__source = 'external';
15862 file.attributes.metaData.size = 0;
15863 return file;
15864 };
15865 /**
15866 * Creates a file object with exists objectId.
15867 * @param {String} objectId The objectId string
15868 * @return {AV.File} the file object
15869 */
15870
15871
15872 AV.File.createWithoutData = function (objectId) {
15873 if (!objectId) {
15874 throw new TypeError('The objectId must be provided');
15875 }
15876
15877 var file = new AV.File();
15878 file.id = objectId;
15879 return file;
15880 };
15881 /**
15882 * Request file censor.
15883 * @since 4.13.0
15884 * @param {String} objectId
15885 * @return {Promise.<string>}
15886 */
15887
15888
15889 AV.File.censor = function (objectId) {
15890 if (!AV._config.masterKey) {
15891 throw new Error('Cannot censor a file without masterKey');
15892 }
15893
15894 return request({
15895 method: 'POST',
15896 path: "/files/".concat(objectId, "/censor"),
15897 authOptions: {
15898 useMasterKey: true
15899 }
15900 }).then(function (res) {
15901 return res.censorResult;
15902 });
15903 };
15904
15905 _.extend(AV.File.prototype,
15906 /** @lends AV.File.prototype */
15907 {
15908 className: '_File',
15909 _toFullJSON: function _toFullJSON(seenObjects) {
15910 var _this = this;
15911
15912 var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
15913
15914 var json = _.clone(this.attributes);
15915
15916 AV._objectEach(json, function (val, key) {
15917 json[key] = AV._encode(val, seenObjects, undefined, full);
15918 });
15919
15920 AV._objectEach(this._operations, function (val, key) {
15921 json[key] = val;
15922 });
15923
15924 if (_.has(this, 'id')) {
15925 json.objectId = this.id;
15926 }
15927
15928 ['createdAt', 'updatedAt'].forEach(function (key) {
15929 if (_.has(_this, key)) {
15930 var val = _this[key];
15931 json[key] = _.isDate(val) ? val.toJSON() : val;
15932 }
15933 });
15934
15935 if (full) {
15936 json.__type = 'File';
15937 }
15938
15939 return json;
15940 },
15941
15942 /**
15943 * Returns a JSON version of the file with meta data.
15944 * Inverse to {@link AV.parseJSON}
15945 * @since 3.0.0
15946 * @return {Object}
15947 */
15948 toFullJSON: function toFullJSON() {
15949 var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
15950 return this._toFullJSON(seenObjects);
15951 },
15952
15953 /**
15954 * Returns a JSON version of the object.
15955 * @return {Object}
15956 */
15957 toJSON: function toJSON(key, holder) {
15958 var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [this];
15959 return this._toFullJSON(seenObjects, false);
15960 },
15961
15962 /**
15963 * Gets a Pointer referencing this file.
15964 * @private
15965 */
15966 _toPointer: function _toPointer() {
15967 return {
15968 __type: 'Pointer',
15969 className: this.className,
15970 objectId: this.id
15971 };
15972 },
15973
15974 /**
15975 * Returns the ACL for this file.
15976 * @returns {AV.ACL} An instance of AV.ACL.
15977 */
15978 getACL: function getACL() {
15979 return this._acl;
15980 },
15981
15982 /**
15983 * Sets the ACL to be used for this file.
15984 * @param {AV.ACL} acl An instance of AV.ACL.
15985 */
15986 setACL: function setACL(acl) {
15987 if (!(acl instanceof AV.ACL)) {
15988 return new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
15989 }
15990
15991 this._acl = acl;
15992 return this;
15993 },
15994
15995 /**
15996 * Gets the name of the file. Before save is called, this is the filename
15997 * given by the user. After save is called, that name gets prefixed with a
15998 * unique identifier.
15999 */
16000 name: function name() {
16001 return this.get('name');
16002 },
16003
16004 /**
16005 * Gets the url of the file. It is only available after you save the file or
16006 * after you get the file from a AV.Object.
16007 * @return {String}
16008 */
16009 url: function url() {
16010 return this.get('url');
16011 },
16012
16013 /**
16014 * Gets the attributs of the file object.
16015 * @param {String} The attribute name which want to get.
16016 * @returns {Any}
16017 */
16018 get: function get(attrName) {
16019 switch (attrName) {
16020 case 'objectId':
16021 return this.id;
16022
16023 case 'url':
16024 case 'name':
16025 case 'mime_type':
16026 case 'metaData':
16027 case 'createdAt':
16028 case 'updatedAt':
16029 return this.attributes[attrName];
16030
16031 default:
16032 return this.attributes.metaData[attrName];
16033 }
16034 },
16035
16036 /**
16037 * Set the metaData of the file object.
16038 * @param {Object} Object is an key value Object for setting metaData.
16039 * @param {String} attr is an optional metadata key.
16040 * @param {Object} value is an optional metadata value.
16041 * @returns {String|Number|Array|Object}
16042 */
16043 set: function set() {
16044 var _this2 = this;
16045
16046 var set = function set(attrName, value) {
16047 switch (attrName) {
16048 case 'name':
16049 case 'url':
16050 case 'mime_type':
16051 case 'base64':
16052 case 'metaData':
16053 _this2.attributes[attrName] = value;
16054 break;
16055
16056 default:
16057 // File 并非一个 AVObject,不能完全自定义其他属性,所以只能都放在 metaData 上面
16058 _this2.attributes.metaData[attrName] = value;
16059 break;
16060 }
16061 };
16062
16063 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
16064 args[_key] = arguments[_key];
16065 }
16066
16067 switch (args.length) {
16068 case 1:
16069 // 传入一个 Object
16070 for (var k in args[0]) {
16071 set(k, args[0][k]);
16072 }
16073
16074 break;
16075
16076 case 2:
16077 set(args[0], args[1]);
16078 break;
16079 }
16080
16081 return this;
16082 },
16083
16084 /**
16085 * Set a header for the upload request.
16086 * For more infomation, go to https://url.leanapp.cn/avfile-upload-headers
16087 *
16088 * @param {String} key header key
16089 * @param {String} value header value
16090 * @return {AV.File} this
16091 */
16092 setUploadHeader: function setUploadHeader(key, value) {
16093 this._uploadHeaders[key] = value;
16094 return this;
16095 },
16096
16097 /**
16098 * <p>Returns the file's metadata JSON object if no arguments is given.Returns the
16099 * metadata value if a key is given.Set metadata value if key and value are both given.</p>
16100 * <p><pre>
16101 * var metadata = file.metaData(); //Get metadata JSON object.
16102 * var size = file.metaData('size'); // Get the size metadata value.
16103 * file.metaData('format', 'jpeg'); //set metadata attribute and value.
16104 *</pre></p>
16105 * @return {Object} The file's metadata JSON object.
16106 * @param {String} attr an optional metadata key.
16107 * @param {Object} value an optional metadata value.
16108 **/
16109 metaData: function metaData(attr, value) {
16110 if (attr && value) {
16111 this.attributes.metaData[attr] = value;
16112 return this;
16113 } else if (attr && !value) {
16114 return this.attributes.metaData[attr];
16115 } else {
16116 return this.attributes.metaData;
16117 }
16118 },
16119
16120 /**
16121 * 如果文件是图片,获取图片的缩略图URL。可以传入宽度、高度、质量、格式等参数。
16122 * @return {String} 缩略图URL
16123 * @param {Number} width 宽度,单位:像素
16124 * @param {Number} heigth 高度,单位:像素
16125 * @param {Number} quality 质量,1-100的数字,默认100
16126 * @param {Number} scaleToFit 是否将图片自适应大小。默认为true。
16127 * @param {String} fmt 格式,默认为png,也可以为jpeg,gif等格式。
16128 */
16129 thumbnailURL: function thumbnailURL(width, height) {
16130 var quality = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
16131 var scaleToFit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
16132 var fmt = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'png';
16133 var url = this.attributes.url;
16134
16135 if (!url) {
16136 throw new Error('Invalid url.');
16137 }
16138
16139 if (!width || !height || width <= 0 || height <= 0) {
16140 throw new Error('Invalid width or height value.');
16141 }
16142
16143 if (quality <= 0 || quality > 100) {
16144 throw new Error('Invalid quality value.');
16145 }
16146
16147 var mode = scaleToFit ? 2 : 1;
16148 return url + '?imageView/' + mode + '/w/' + width + '/h/' + height + '/q/' + quality + '/format/' + fmt;
16149 },
16150
16151 /**
16152 * Returns the file's size.
16153 * @return {Number} The file's size in bytes.
16154 **/
16155 size: function size() {
16156 return this.metaData().size;
16157 },
16158
16159 /**
16160 * Returns the file's owner.
16161 * @return {String} The file's owner id.
16162 */
16163 ownerId: function ownerId() {
16164 return this.metaData().owner;
16165 },
16166
16167 /**
16168 * Destroy the file.
16169 * @param {AuthOptions} options
16170 * @return {Promise} A promise that is fulfilled when the destroy
16171 * completes.
16172 */
16173 destroy: function destroy(options) {
16174 if (!this.id) {
16175 return _promise.default.reject(new Error('The file id does not eixst.'));
16176 }
16177
16178 var request = AVRequest('files', null, this.id, 'DELETE', null, options);
16179 return request;
16180 },
16181
16182 /**
16183 * Request Qiniu upload token
16184 * @param {string} type
16185 * @return {Promise} Resolved with the response
16186 * @private
16187 */
16188 _fileToken: function _fileToken(type, authOptions) {
16189 var name = this.attributes.name;
16190 var extName = extname(name);
16191
16192 if (!extName && this._extName) {
16193 name += this._extName;
16194 extName = this._extName;
16195 }
16196
16197 var data = {
16198 name: name,
16199 keep_file_name: authOptions.keepFileName,
16200 key: authOptions.key,
16201 ACL: this._acl,
16202 mime_type: type,
16203 metaData: this.attributes.metaData
16204 };
16205 return AVRequest('fileTokens', null, null, 'POST', data, authOptions);
16206 },
16207
16208 /**
16209 * @callback UploadProgressCallback
16210 * @param {XMLHttpRequestProgressEvent} event - The progress event with 'loaded' and 'total' attributes
16211 */
16212
16213 /**
16214 * Saves the file to the AV cloud.
16215 * @param {AuthOptions} [options] AuthOptions plus:
16216 * @param {UploadProgressCallback} [options.onprogress] 文件上传进度,在 Node.js 中无效,回调参数说明详见 {@link UploadProgressCallback}。
16217 * @param {boolean} [options.keepFileName = false] 保留下载文件的文件名。
16218 * @param {string} [options.key] 指定文件的 key。设置该选项需要使用 masterKey
16219 * @return {Promise} Promise that is resolved when the save finishes.
16220 */
16221 save: function save() {
16222 var _this3 = this;
16223
16224 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
16225
16226 if (this.id) {
16227 throw new Error('File is already saved.');
16228 }
16229
16230 if (!this._previousSave) {
16231 if (this._data) {
16232 var mimeType = this.get('mime_type');
16233 this._previousSave = this._fileToken(mimeType, options).then(function (uploadInfo) {
16234 if (uploadInfo.mime_type) {
16235 mimeType = uploadInfo.mime_type;
16236
16237 _this3.set('mime_type', mimeType);
16238 }
16239
16240 _this3._token = uploadInfo.token;
16241 return _promise.default.resolve().then(function () {
16242 var data = _this3._data;
16243
16244 if (data && data.base64) {
16245 return parseBase64(data.base64, mimeType);
16246 }
16247
16248 if (data && data.blob) {
16249 if (!data.blob.type && mimeType) {
16250 data.blob.type = mimeType;
16251 }
16252
16253 if (!data.blob.name) {
16254 data.blob.name = _this3.get('name');
16255 }
16256
16257 return data.blob;
16258 }
16259
16260 if (typeof Blob !== 'undefined' && data instanceof Blob) {
16261 return data;
16262 }
16263
16264 throw new TypeError('malformed file data');
16265 }).then(function (data) {
16266 var _options = _.extend({}, options); // filter out download progress events
16267
16268
16269 if (options.onprogress) {
16270 _options.onprogress = function (event) {
16271 if (event.direction === 'download') return;
16272 return options.onprogress(event);
16273 };
16274 }
16275
16276 switch (uploadInfo.provider) {
16277 case 's3':
16278 return s3(uploadInfo, data, _this3, _options);
16279
16280 case 'qcloud':
16281 return cos(uploadInfo, data, _this3, _options);
16282
16283 case 'qiniu':
16284 default:
16285 return qiniu(uploadInfo, data, _this3, _options);
16286 }
16287 }).then(tap(function () {
16288 return _this3._callback(true);
16289 }), function (error) {
16290 _this3._callback(false);
16291
16292 throw error;
16293 });
16294 });
16295 } else if (this.attributes.url && this.attributes.metaData.__source === 'external') {
16296 // external link file.
16297 var data = {
16298 name: this.attributes.name,
16299 ACL: this._acl,
16300 metaData: this.attributes.metaData,
16301 mime_type: this.mimeType,
16302 url: this.attributes.url
16303 };
16304 this._previousSave = AVRequest('files', null, null, 'post', data, options).then(function (response) {
16305 _this3.id = response.objectId;
16306 return _this3;
16307 });
16308 }
16309 }
16310
16311 return this._previousSave;
16312 },
16313 _callback: function _callback(success) {
16314 AVRequest('fileCallback', null, null, 'post', {
16315 token: this._token,
16316 result: success
16317 }).catch(debug);
16318 delete this._token;
16319 delete this._data;
16320 },
16321
16322 /**
16323 * fetch the file from server. If the server's representation of the
16324 * model differs from its current attributes, they will be overriden,
16325 * @param {Object} fetchOptions Optional options to set 'keys',
16326 * 'include' and 'includeACL' option.
16327 * @param {AuthOptions} options
16328 * @return {Promise} A promise that is fulfilled when the fetch
16329 * completes.
16330 */
16331 fetch: function fetch(fetchOptions, options) {
16332 if (!this.id) {
16333 throw new Error('Cannot fetch unsaved file');
16334 }
16335
16336 var request = AVRequest('files', null, this.id, 'GET', transformFetchOptions(fetchOptions), options);
16337 return request.then(this._finishFetch.bind(this));
16338 },
16339 _finishFetch: function _finishFetch(response) {
16340 var value = AV.Object.prototype.parse(response);
16341 value.attributes = {
16342 name: value.name,
16343 url: value.url,
16344 mime_type: value.mime_type,
16345 bucket: value.bucket
16346 };
16347 value.attributes.metaData = value.metaData || {};
16348 value.id = value.objectId; // clean
16349
16350 delete value.objectId;
16351 delete value.metaData;
16352 delete value.url;
16353 delete value.name;
16354 delete value.mime_type;
16355 delete value.bucket;
16356
16357 _.extend(this, value);
16358
16359 return this;
16360 },
16361
16362 /**
16363 * Request file censor
16364 * @since 4.13.0
16365 * @return {Promise.<string>}
16366 */
16367 censor: function censor() {
16368 if (!this.id) {
16369 throw new Error('Cannot censor an unsaved file');
16370 }
16371
16372 return AV.File.censor(this.id);
16373 }
16374 });
16375};
16376
16377/***/ }),
16378/* 478 */
16379/***/ (function(module, exports, __webpack_require__) {
16380
16381"use strict";
16382
16383
16384var _require = __webpack_require__(72),
16385 getAdapter = _require.getAdapter;
16386
16387var debug = __webpack_require__(60)('cos');
16388
16389module.exports = function (uploadInfo, data, file) {
16390 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
16391 var url = uploadInfo.upload_url + '?sign=' + encodeURIComponent(uploadInfo.token);
16392 var fileFormData = {
16393 field: 'fileContent',
16394 data: data,
16395 name: file.attributes.name
16396 };
16397 var options = {
16398 headers: file._uploadHeaders,
16399 data: {
16400 op: 'upload'
16401 },
16402 onprogress: saveOptions.onprogress
16403 };
16404 debug('url: %s, file: %o, options: %o', url, fileFormData, options);
16405 var upload = getAdapter('upload');
16406 return upload(url, fileFormData, options).then(function (response) {
16407 debug(response.status, response.data);
16408
16409 if (response.ok === false) {
16410 var error = new Error(response.status);
16411 error.response = response;
16412 throw error;
16413 }
16414
16415 file.attributes.url = uploadInfo.url;
16416 file._bucket = uploadInfo.bucket;
16417 file.id = uploadInfo.objectId;
16418 return file;
16419 }, function (error) {
16420 var response = error.response;
16421
16422 if (response) {
16423 debug(response.status, response.data);
16424 error.statusCode = response.status;
16425 error.response = response.data;
16426 }
16427
16428 throw error;
16429 });
16430};
16431
16432/***/ }),
16433/* 479 */
16434/***/ (function(module, exports, __webpack_require__) {
16435
16436"use strict";
16437
16438
16439var _sliceInstanceProperty2 = __webpack_require__(61);
16440
16441var _Array$from = __webpack_require__(252);
16442
16443var _Symbol = __webpack_require__(149);
16444
16445var _getIteratorMethod = __webpack_require__(254);
16446
16447var _Reflect$construct = __webpack_require__(489);
16448
16449var _interopRequireDefault = __webpack_require__(1);
16450
16451var _inherits2 = _interopRequireDefault(__webpack_require__(493));
16452
16453var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(515));
16454
16455var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(517));
16456
16457var _classCallCheck2 = _interopRequireDefault(__webpack_require__(522));
16458
16459var _createClass2 = _interopRequireDefault(__webpack_require__(523));
16460
16461var _stringify = _interopRequireDefault(__webpack_require__(36));
16462
16463var _concat = _interopRequireDefault(__webpack_require__(22));
16464
16465var _promise = _interopRequireDefault(__webpack_require__(12));
16466
16467var _slice = _interopRequireDefault(__webpack_require__(61));
16468
16469function _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); }; }
16470
16471function _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; } }
16472
16473function _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; } } }; }
16474
16475function _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); }
16476
16477function _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; }
16478
16479var _require = __webpack_require__(72),
16480 getAdapter = _require.getAdapter;
16481
16482var debug = __webpack_require__(60)('leancloud:qiniu');
16483
16484var ajax = __webpack_require__(116);
16485
16486var btoa = __webpack_require__(524);
16487
16488var SHARD_THRESHOLD = 1024 * 1024 * 64;
16489var CHUNK_SIZE = 1024 * 1024 * 16;
16490
16491function upload(uploadInfo, data, file) {
16492 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
16493 // Get the uptoken to upload files to qiniu.
16494 var uptoken = uploadInfo.token;
16495 var url = uploadInfo.upload_url || 'https://upload.qiniup.com';
16496 var fileFormData = {
16497 field: 'file',
16498 data: data,
16499 name: file.attributes.name
16500 };
16501 var options = {
16502 headers: file._uploadHeaders,
16503 data: {
16504 name: file.attributes.name,
16505 key: uploadInfo.key,
16506 token: uptoken
16507 },
16508 onprogress: saveOptions.onprogress
16509 };
16510 debug('url: %s, file: %o, options: %o', url, fileFormData, options);
16511 var upload = getAdapter('upload');
16512 return upload(url, fileFormData, options).then(function (response) {
16513 debug(response.status, response.data);
16514
16515 if (response.ok === false) {
16516 var message = response.status;
16517
16518 if (response.data) {
16519 if (response.data.error) {
16520 message = response.data.error;
16521 } else {
16522 message = (0, _stringify.default)(response.data);
16523 }
16524 }
16525
16526 var error = new Error(message);
16527 error.response = response;
16528 throw error;
16529 }
16530
16531 file.attributes.url = uploadInfo.url;
16532 file._bucket = uploadInfo.bucket;
16533 file.id = uploadInfo.objectId;
16534 return file;
16535 }, function (error) {
16536 var response = error.response;
16537
16538 if (response) {
16539 debug(response.status, response.data);
16540 error.statusCode = response.status;
16541 error.response = response.data;
16542 }
16543
16544 throw error;
16545 });
16546}
16547
16548function urlSafeBase64(string) {
16549 var base64 = btoa(unescape(encodeURIComponent(string)));
16550 var result = '';
16551
16552 var _iterator = _createForOfIteratorHelper(base64),
16553 _step;
16554
16555 try {
16556 for (_iterator.s(); !(_step = _iterator.n()).done;) {
16557 var ch = _step.value;
16558
16559 switch (ch) {
16560 case '+':
16561 result += '-';
16562 break;
16563
16564 case '/':
16565 result += '_';
16566 break;
16567
16568 default:
16569 result += ch;
16570 }
16571 }
16572 } catch (err) {
16573 _iterator.e(err);
16574 } finally {
16575 _iterator.f();
16576 }
16577
16578 return result;
16579}
16580
16581var ShardUploader = /*#__PURE__*/function () {
16582 function ShardUploader(uploadInfo, data, file, saveOptions) {
16583 var _context,
16584 _context2,
16585 _this = this;
16586
16587 (0, _classCallCheck2.default)(this, ShardUploader);
16588 this.uploadInfo = uploadInfo;
16589 this.data = data;
16590 this.file = file;
16591 this.size = undefined;
16592 this.offset = 0;
16593 this.uploadedChunks = 0;
16594 var key = urlSafeBase64(uploadInfo.key);
16595 var uploadURL = uploadInfo.upload_url || 'https://upload.qiniup.com';
16596 this.baseURL = (0, _concat.default)(_context = (0, _concat.default)(_context2 = "".concat(uploadURL, "/buckets/")).call(_context2, uploadInfo.bucket, "/objects/")).call(_context, key, "/uploads");
16597 this.upToken = 'UpToken ' + uploadInfo.token;
16598 this.uploaded = 0;
16599
16600 if (saveOptions && saveOptions.onprogress) {
16601 this.onProgress = function (_ref) {
16602 var loaded = _ref.loaded;
16603 loaded += _this.uploadedChunks * CHUNK_SIZE;
16604
16605 if (loaded <= _this.uploaded) {
16606 return;
16607 }
16608
16609 if (_this.size) {
16610 saveOptions.onprogress({
16611 loaded: loaded,
16612 total: _this.size,
16613 percent: loaded / _this.size * 100
16614 });
16615 } else {
16616 saveOptions.onprogress({
16617 loaded: loaded
16618 });
16619 }
16620
16621 _this.uploaded = loaded;
16622 };
16623 }
16624 }
16625 /**
16626 * @returns {Promise<string>}
16627 */
16628
16629
16630 (0, _createClass2.default)(ShardUploader, [{
16631 key: "getUploadId",
16632 value: function getUploadId() {
16633 return ajax({
16634 method: 'POST',
16635 url: this.baseURL,
16636 headers: {
16637 Authorization: this.upToken
16638 }
16639 }).then(function (res) {
16640 return res.uploadId;
16641 });
16642 }
16643 }, {
16644 key: "getChunk",
16645 value: function getChunk() {
16646 throw new Error('Not implemented');
16647 }
16648 /**
16649 * @param {string} uploadId
16650 * @param {number} partNumber
16651 * @param {any} data
16652 * @returns {Promise<{ partNumber: number, etag: string }>}
16653 */
16654
16655 }, {
16656 key: "uploadPart",
16657 value: function uploadPart(uploadId, partNumber, data) {
16658 var _context3, _context4;
16659
16660 return ajax({
16661 method: 'PUT',
16662 url: (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = "".concat(this.baseURL, "/")).call(_context4, uploadId, "/")).call(_context3, partNumber),
16663 headers: {
16664 Authorization: this.upToken
16665 },
16666 data: data,
16667 onprogress: this.onProgress
16668 }).then(function (_ref2) {
16669 var etag = _ref2.etag;
16670 return {
16671 partNumber: partNumber,
16672 etag: etag
16673 };
16674 });
16675 }
16676 }, {
16677 key: "stopUpload",
16678 value: function stopUpload(uploadId) {
16679 var _context5;
16680
16681 return ajax({
16682 method: 'DELETE',
16683 url: (0, _concat.default)(_context5 = "".concat(this.baseURL, "/")).call(_context5, uploadId),
16684 headers: {
16685 Authorization: this.upToken
16686 }
16687 });
16688 }
16689 }, {
16690 key: "upload",
16691 value: function upload() {
16692 var _this2 = this;
16693
16694 var parts = [];
16695 return this.getUploadId().then(function (uploadId) {
16696 var uploadPart = function uploadPart() {
16697 return _promise.default.resolve(_this2.getChunk()).then(function (chunk) {
16698 if (!chunk) {
16699 return;
16700 }
16701
16702 var partNumber = parts.length + 1;
16703 return _this2.uploadPart(uploadId, partNumber, chunk).then(function (part) {
16704 parts.push(part);
16705 _this2.uploadedChunks++;
16706 return uploadPart();
16707 });
16708 }).catch(function (error) {
16709 return _this2.stopUpload(uploadId).then(function () {
16710 return _promise.default.reject(error);
16711 });
16712 });
16713 };
16714
16715 return uploadPart().then(function () {
16716 var _context6;
16717
16718 return ajax({
16719 method: 'POST',
16720 url: (0, _concat.default)(_context6 = "".concat(_this2.baseURL, "/")).call(_context6, uploadId),
16721 headers: {
16722 Authorization: _this2.upToken
16723 },
16724 data: {
16725 parts: parts,
16726 fname: _this2.file.attributes.name,
16727 mimeType: _this2.file.attributes.mime_type
16728 }
16729 });
16730 });
16731 }).then(function () {
16732 _this2.file.attributes.url = _this2.uploadInfo.url;
16733 _this2.file._bucket = _this2.uploadInfo.bucket;
16734 _this2.file.id = _this2.uploadInfo.objectId;
16735 return _this2.file;
16736 });
16737 }
16738 }]);
16739 return ShardUploader;
16740}();
16741
16742var BlobUploader = /*#__PURE__*/function (_ShardUploader) {
16743 (0, _inherits2.default)(BlobUploader, _ShardUploader);
16744
16745 var _super = _createSuper(BlobUploader);
16746
16747 function BlobUploader(uploadInfo, data, file, saveOptions) {
16748 var _this3;
16749
16750 (0, _classCallCheck2.default)(this, BlobUploader);
16751 _this3 = _super.call(this, uploadInfo, data, file, saveOptions);
16752 _this3.size = data.size;
16753 return _this3;
16754 }
16755 /**
16756 * @returns {Blob | null}
16757 */
16758
16759
16760 (0, _createClass2.default)(BlobUploader, [{
16761 key: "getChunk",
16762 value: function getChunk() {
16763 var _context7;
16764
16765 if (this.offset >= this.size) {
16766 return null;
16767 }
16768
16769 var chunk = (0, _slice.default)(_context7 = this.data).call(_context7, this.offset, this.offset + CHUNK_SIZE);
16770 this.offset += chunk.size;
16771 return chunk;
16772 }
16773 }]);
16774 return BlobUploader;
16775}(ShardUploader);
16776
16777function isBlob(data) {
16778 return typeof Blob !== 'undefined' && data instanceof Blob;
16779}
16780
16781module.exports = function (uploadInfo, data, file) {
16782 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
16783
16784 if (isBlob(data) && data.size >= SHARD_THRESHOLD) {
16785 return new BlobUploader(uploadInfo, data, file, saveOptions).upload();
16786 }
16787
16788 return upload(uploadInfo, data, file, saveOptions);
16789};
16790
16791/***/ }),
16792/* 480 */
16793/***/ (function(module, exports, __webpack_require__) {
16794
16795__webpack_require__(55);
16796__webpack_require__(481);
16797var path = __webpack_require__(5);
16798
16799module.exports = path.Array.from;
16800
16801
16802/***/ }),
16803/* 481 */
16804/***/ (function(module, exports, __webpack_require__) {
16805
16806var $ = __webpack_require__(0);
16807var from = __webpack_require__(482);
16808var checkCorrectnessOfIteration = __webpack_require__(178);
16809
16810var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
16811 // eslint-disable-next-line es-x/no-array-from -- required for testing
16812 Array.from(iterable);
16813});
16814
16815// `Array.from` method
16816// https://tc39.es/ecma262/#sec-array.from
16817$({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
16818 from: from
16819});
16820
16821
16822/***/ }),
16823/* 482 */
16824/***/ (function(module, exports, __webpack_require__) {
16825
16826"use strict";
16827
16828var bind = __webpack_require__(48);
16829var call = __webpack_require__(15);
16830var toObject = __webpack_require__(34);
16831var callWithSafeIterationClosing = __webpack_require__(483);
16832var isArrayIteratorMethod = __webpack_require__(166);
16833var isConstructor = __webpack_require__(109);
16834var lengthOfArrayLike = __webpack_require__(41);
16835var createProperty = __webpack_require__(91);
16836var getIterator = __webpack_require__(167);
16837var getIteratorMethod = __webpack_require__(106);
16838
16839var $Array = Array;
16840
16841// `Array.from` method implementation
16842// https://tc39.es/ecma262/#sec-array.from
16843module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
16844 var O = toObject(arrayLike);
16845 var IS_CONSTRUCTOR = isConstructor(this);
16846 var argumentsLength = arguments.length;
16847 var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
16848 var mapping = mapfn !== undefined;
16849 if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined);
16850 var iteratorMethod = getIteratorMethod(O);
16851 var index = 0;
16852 var length, result, step, iterator, next, value;
16853 // if the target is not iterable or it's an array with the default iterator - use a simple case
16854 if (iteratorMethod && !(this === $Array && isArrayIteratorMethod(iteratorMethod))) {
16855 iterator = getIterator(O, iteratorMethod);
16856 next = iterator.next;
16857 result = IS_CONSTRUCTOR ? new this() : [];
16858 for (;!(step = call(next, iterator)).done; index++) {
16859 value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
16860 createProperty(result, index, value);
16861 }
16862 } else {
16863 length = lengthOfArrayLike(O);
16864 result = IS_CONSTRUCTOR ? new this(length) : $Array(length);
16865 for (;length > index; index++) {
16866 value = mapping ? mapfn(O[index], index) : O[index];
16867 createProperty(result, index, value);
16868 }
16869 }
16870 result.length = index;
16871 return result;
16872};
16873
16874
16875/***/ }),
16876/* 483 */
16877/***/ (function(module, exports, __webpack_require__) {
16878
16879var anObject = __webpack_require__(20);
16880var iteratorClose = __webpack_require__(168);
16881
16882// call something on iterator step with safe closing on error
16883module.exports = function (iterator, fn, value, ENTRIES) {
16884 try {
16885 return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
16886 } catch (error) {
16887 iteratorClose(iterator, 'throw', error);
16888 }
16889};
16890
16891
16892/***/ }),
16893/* 484 */
16894/***/ (function(module, exports, __webpack_require__) {
16895
16896module.exports = __webpack_require__(485);
16897
16898
16899/***/ }),
16900/* 485 */
16901/***/ (function(module, exports, __webpack_require__) {
16902
16903var parent = __webpack_require__(486);
16904
16905module.exports = parent;
16906
16907
16908/***/ }),
16909/* 486 */
16910/***/ (function(module, exports, __webpack_require__) {
16911
16912var parent = __webpack_require__(487);
16913
16914module.exports = parent;
16915
16916
16917/***/ }),
16918/* 487 */
16919/***/ (function(module, exports, __webpack_require__) {
16920
16921var parent = __webpack_require__(488);
16922__webpack_require__(39);
16923
16924module.exports = parent;
16925
16926
16927/***/ }),
16928/* 488 */
16929/***/ (function(module, exports, __webpack_require__) {
16930
16931__webpack_require__(38);
16932__webpack_require__(55);
16933var getIteratorMethod = __webpack_require__(106);
16934
16935module.exports = getIteratorMethod;
16936
16937
16938/***/ }),
16939/* 489 */
16940/***/ (function(module, exports, __webpack_require__) {
16941
16942module.exports = __webpack_require__(490);
16943
16944/***/ }),
16945/* 490 */
16946/***/ (function(module, exports, __webpack_require__) {
16947
16948var parent = __webpack_require__(491);
16949
16950module.exports = parent;
16951
16952
16953/***/ }),
16954/* 491 */
16955/***/ (function(module, exports, __webpack_require__) {
16956
16957__webpack_require__(492);
16958var path = __webpack_require__(5);
16959
16960module.exports = path.Reflect.construct;
16961
16962
16963/***/ }),
16964/* 492 */
16965/***/ (function(module, exports, __webpack_require__) {
16966
16967var $ = __webpack_require__(0);
16968var getBuiltIn = __webpack_require__(18);
16969var apply = __webpack_require__(75);
16970var bind = __webpack_require__(255);
16971var aConstructor = __webpack_require__(174);
16972var anObject = __webpack_require__(20);
16973var isObject = __webpack_require__(11);
16974var create = __webpack_require__(49);
16975var fails = __webpack_require__(2);
16976
16977var nativeConstruct = getBuiltIn('Reflect', 'construct');
16978var ObjectPrototype = Object.prototype;
16979var push = [].push;
16980
16981// `Reflect.construct` method
16982// https://tc39.es/ecma262/#sec-reflect.construct
16983// MS Edge supports only 2 arguments and argumentsList argument is optional
16984// FF Nightly sets third argument as `new.target`, but does not create `this` from it
16985var NEW_TARGET_BUG = fails(function () {
16986 function F() { /* empty */ }
16987 return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F);
16988});
16989
16990var ARGS_BUG = !fails(function () {
16991 nativeConstruct(function () { /* empty */ });
16992});
16993
16994var FORCED = NEW_TARGET_BUG || ARGS_BUG;
16995
16996$({ target: 'Reflect', stat: true, forced: FORCED, sham: FORCED }, {
16997 construct: function construct(Target, args /* , newTarget */) {
16998 aConstructor(Target);
16999 anObject(args);
17000 var newTarget = arguments.length < 3 ? Target : aConstructor(arguments[2]);
17001 if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget);
17002 if (Target == newTarget) {
17003 // w/o altered newTarget, optimization for 0-4 arguments
17004 switch (args.length) {
17005 case 0: return new Target();
17006 case 1: return new Target(args[0]);
17007 case 2: return new Target(args[0], args[1]);
17008 case 3: return new Target(args[0], args[1], args[2]);
17009 case 4: return new Target(args[0], args[1], args[2], args[3]);
17010 }
17011 // w/o altered newTarget, lot of arguments case
17012 var $args = [null];
17013 apply(push, $args, args);
17014 return new (apply(bind, Target, $args))();
17015 }
17016 // with altered newTarget, not support built-in constructors
17017 var proto = newTarget.prototype;
17018 var instance = create(isObject(proto) ? proto : ObjectPrototype);
17019 var result = apply(Target, instance, args);
17020 return isObject(result) ? result : instance;
17021 }
17022});
17023
17024
17025/***/ }),
17026/* 493 */
17027/***/ (function(module, exports, __webpack_require__) {
17028
17029var _Object$create = __webpack_require__(494);
17030
17031var _Object$defineProperty = __webpack_require__(150);
17032
17033var setPrototypeOf = __webpack_require__(504);
17034
17035function _inherits(subClass, superClass) {
17036 if (typeof superClass !== "function" && superClass !== null) {
17037 throw new TypeError("Super expression must either be null or a function");
17038 }
17039
17040 subClass.prototype = _Object$create(superClass && superClass.prototype, {
17041 constructor: {
17042 value: subClass,
17043 writable: true,
17044 configurable: true
17045 }
17046 });
17047
17048 _Object$defineProperty(subClass, "prototype", {
17049 writable: false
17050 });
17051
17052 if (superClass) setPrototypeOf(subClass, superClass);
17053}
17054
17055module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
17056
17057/***/ }),
17058/* 494 */
17059/***/ (function(module, exports, __webpack_require__) {
17060
17061module.exports = __webpack_require__(495);
17062
17063/***/ }),
17064/* 495 */
17065/***/ (function(module, exports, __webpack_require__) {
17066
17067module.exports = __webpack_require__(496);
17068
17069
17070/***/ }),
17071/* 496 */
17072/***/ (function(module, exports, __webpack_require__) {
17073
17074var parent = __webpack_require__(497);
17075
17076module.exports = parent;
17077
17078
17079/***/ }),
17080/* 497 */
17081/***/ (function(module, exports, __webpack_require__) {
17082
17083var parent = __webpack_require__(498);
17084
17085module.exports = parent;
17086
17087
17088/***/ }),
17089/* 498 */
17090/***/ (function(module, exports, __webpack_require__) {
17091
17092var parent = __webpack_require__(499);
17093
17094module.exports = parent;
17095
17096
17097/***/ }),
17098/* 499 */
17099/***/ (function(module, exports, __webpack_require__) {
17100
17101__webpack_require__(500);
17102var path = __webpack_require__(5);
17103
17104var Object = path.Object;
17105
17106module.exports = function create(P, D) {
17107 return Object.create(P, D);
17108};
17109
17110
17111/***/ }),
17112/* 500 */
17113/***/ (function(module, exports, __webpack_require__) {
17114
17115// TODO: Remove from `core-js@4`
17116var $ = __webpack_require__(0);
17117var DESCRIPTORS = __webpack_require__(14);
17118var create = __webpack_require__(49);
17119
17120// `Object.create` method
17121// https://tc39.es/ecma262/#sec-object.create
17122$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
17123 create: create
17124});
17125
17126
17127/***/ }),
17128/* 501 */
17129/***/ (function(module, exports, __webpack_require__) {
17130
17131module.exports = __webpack_require__(502);
17132
17133
17134/***/ }),
17135/* 502 */
17136/***/ (function(module, exports, __webpack_require__) {
17137
17138var parent = __webpack_require__(503);
17139
17140module.exports = parent;
17141
17142
17143/***/ }),
17144/* 503 */
17145/***/ (function(module, exports, __webpack_require__) {
17146
17147var parent = __webpack_require__(241);
17148
17149module.exports = parent;
17150
17151
17152/***/ }),
17153/* 504 */
17154/***/ (function(module, exports, __webpack_require__) {
17155
17156var _Object$setPrototypeOf = __webpack_require__(256);
17157
17158var _bindInstanceProperty = __webpack_require__(257);
17159
17160function _setPrototypeOf(o, p) {
17161 var _context;
17162
17163 module.exports = _setPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$setPrototypeOf).call(_context) : function _setPrototypeOf(o, p) {
17164 o.__proto__ = p;
17165 return o;
17166 }, module.exports.__esModule = true, module.exports["default"] = module.exports;
17167 return _setPrototypeOf(o, p);
17168}
17169
17170module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
17171
17172/***/ }),
17173/* 505 */
17174/***/ (function(module, exports, __webpack_require__) {
17175
17176module.exports = __webpack_require__(506);
17177
17178
17179/***/ }),
17180/* 506 */
17181/***/ (function(module, exports, __webpack_require__) {
17182
17183var parent = __webpack_require__(507);
17184
17185module.exports = parent;
17186
17187
17188/***/ }),
17189/* 507 */
17190/***/ (function(module, exports, __webpack_require__) {
17191
17192var parent = __webpack_require__(239);
17193
17194module.exports = parent;
17195
17196
17197/***/ }),
17198/* 508 */
17199/***/ (function(module, exports, __webpack_require__) {
17200
17201module.exports = __webpack_require__(509);
17202
17203
17204/***/ }),
17205/* 509 */
17206/***/ (function(module, exports, __webpack_require__) {
17207
17208var parent = __webpack_require__(510);
17209
17210module.exports = parent;
17211
17212
17213/***/ }),
17214/* 510 */
17215/***/ (function(module, exports, __webpack_require__) {
17216
17217var parent = __webpack_require__(511);
17218
17219module.exports = parent;
17220
17221
17222/***/ }),
17223/* 511 */
17224/***/ (function(module, exports, __webpack_require__) {
17225
17226var parent = __webpack_require__(512);
17227
17228module.exports = parent;
17229
17230
17231/***/ }),
17232/* 512 */
17233/***/ (function(module, exports, __webpack_require__) {
17234
17235var isPrototypeOf = __webpack_require__(19);
17236var method = __webpack_require__(513);
17237
17238var FunctionPrototype = Function.prototype;
17239
17240module.exports = function (it) {
17241 var own = it.bind;
17242 return it === FunctionPrototype || (isPrototypeOf(FunctionPrototype, it) && own === FunctionPrototype.bind) ? method : own;
17243};
17244
17245
17246/***/ }),
17247/* 513 */
17248/***/ (function(module, exports, __webpack_require__) {
17249
17250__webpack_require__(514);
17251var entryVirtual = __webpack_require__(40);
17252
17253module.exports = entryVirtual('Function').bind;
17254
17255
17256/***/ }),
17257/* 514 */
17258/***/ (function(module, exports, __webpack_require__) {
17259
17260// TODO: Remove from `core-js@4`
17261var $ = __webpack_require__(0);
17262var bind = __webpack_require__(255);
17263
17264// `Function.prototype.bind` method
17265// https://tc39.es/ecma262/#sec-function.prototype.bind
17266$({ target: 'Function', proto: true, forced: Function.bind !== bind }, {
17267 bind: bind
17268});
17269
17270
17271/***/ }),
17272/* 515 */
17273/***/ (function(module, exports, __webpack_require__) {
17274
17275var _typeof = __webpack_require__(73)["default"];
17276
17277var assertThisInitialized = __webpack_require__(516);
17278
17279function _possibleConstructorReturn(self, call) {
17280 if (call && (_typeof(call) === "object" || typeof call === "function")) {
17281 return call;
17282 } else if (call !== void 0) {
17283 throw new TypeError("Derived constructors may only return object or undefined");
17284 }
17285
17286 return assertThisInitialized(self);
17287}
17288
17289module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
17290
17291/***/ }),
17292/* 516 */
17293/***/ (function(module, exports) {
17294
17295function _assertThisInitialized(self) {
17296 if (self === void 0) {
17297 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
17298 }
17299
17300 return self;
17301}
17302
17303module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
17304
17305/***/ }),
17306/* 517 */
17307/***/ (function(module, exports, __webpack_require__) {
17308
17309var _Object$setPrototypeOf = __webpack_require__(256);
17310
17311var _bindInstanceProperty = __webpack_require__(257);
17312
17313var _Object$getPrototypeOf = __webpack_require__(518);
17314
17315function _getPrototypeOf(o) {
17316 var _context;
17317
17318 module.exports = _getPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$getPrototypeOf).call(_context) : function _getPrototypeOf(o) {
17319 return o.__proto__ || _Object$getPrototypeOf(o);
17320 }, module.exports.__esModule = true, module.exports["default"] = module.exports;
17321 return _getPrototypeOf(o);
17322}
17323
17324module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
17325
17326/***/ }),
17327/* 518 */
17328/***/ (function(module, exports, __webpack_require__) {
17329
17330module.exports = __webpack_require__(519);
17331
17332/***/ }),
17333/* 519 */
17334/***/ (function(module, exports, __webpack_require__) {
17335
17336module.exports = __webpack_require__(520);
17337
17338
17339/***/ }),
17340/* 520 */
17341/***/ (function(module, exports, __webpack_require__) {
17342
17343var parent = __webpack_require__(521);
17344
17345module.exports = parent;
17346
17347
17348/***/ }),
17349/* 521 */
17350/***/ (function(module, exports, __webpack_require__) {
17351
17352var parent = __webpack_require__(233);
17353
17354module.exports = parent;
17355
17356
17357/***/ }),
17358/* 522 */
17359/***/ (function(module, exports) {
17360
17361function _classCallCheck(instance, Constructor) {
17362 if (!(instance instanceof Constructor)) {
17363 throw new TypeError("Cannot call a class as a function");
17364 }
17365}
17366
17367module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
17368
17369/***/ }),
17370/* 523 */
17371/***/ (function(module, exports, __webpack_require__) {
17372
17373var _Object$defineProperty = __webpack_require__(150);
17374
17375function _defineProperties(target, props) {
17376 for (var i = 0; i < props.length; i++) {
17377 var descriptor = props[i];
17378 descriptor.enumerable = descriptor.enumerable || false;
17379 descriptor.configurable = true;
17380 if ("value" in descriptor) descriptor.writable = true;
17381
17382 _Object$defineProperty(target, descriptor.key, descriptor);
17383 }
17384}
17385
17386function _createClass(Constructor, protoProps, staticProps) {
17387 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
17388 if (staticProps) _defineProperties(Constructor, staticProps);
17389
17390 _Object$defineProperty(Constructor, "prototype", {
17391 writable: false
17392 });
17393
17394 return Constructor;
17395}
17396
17397module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
17398
17399/***/ }),
17400/* 524 */
17401/***/ (function(module, exports, __webpack_require__) {
17402
17403"use strict";
17404
17405
17406var _interopRequireDefault = __webpack_require__(1);
17407
17408var _slice = _interopRequireDefault(__webpack_require__(61));
17409
17410// base64 character set, plus padding character (=)
17411var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
17412
17413module.exports = function (string) {
17414 var result = '';
17415
17416 for (var i = 0; i < string.length;) {
17417 var a = string.charCodeAt(i++);
17418 var b = string.charCodeAt(i++);
17419 var c = string.charCodeAt(i++);
17420
17421 if (a > 255 || b > 255 || c > 255) {
17422 throw new TypeError('Failed to encode base64: The string to be encoded contains characters outside of the Latin1 range.');
17423 }
17424
17425 var bitmap = a << 16 | b << 8 | c;
17426 result += b64.charAt(bitmap >> 18 & 63) + b64.charAt(bitmap >> 12 & 63) + b64.charAt(bitmap >> 6 & 63) + b64.charAt(bitmap & 63);
17427 } // To determine the final padding
17428
17429
17430 var rest = string.length % 3; // If there's need of padding, replace the last 'A's with equal signs
17431
17432 return rest ? (0, _slice.default)(result).call(result, 0, rest - 3) + '==='.substring(rest) : result;
17433};
17434
17435/***/ }),
17436/* 525 */
17437/***/ (function(module, exports, __webpack_require__) {
17438
17439"use strict";
17440
17441
17442var _ = __webpack_require__(3);
17443
17444var ajax = __webpack_require__(116);
17445
17446module.exports = function upload(uploadInfo, data, file) {
17447 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
17448 return ajax({
17449 url: uploadInfo.upload_url,
17450 method: 'PUT',
17451 data: data,
17452 headers: _.extend({
17453 'Content-Type': file.get('mime_type'),
17454 'Cache-Control': 'public, max-age=31536000'
17455 }, file._uploadHeaders),
17456 onprogress: saveOptions.onprogress
17457 }).then(function () {
17458 file.attributes.url = uploadInfo.url;
17459 file._bucket = uploadInfo.bucket;
17460 file.id = uploadInfo.objectId;
17461 return file;
17462 });
17463};
17464
17465/***/ }),
17466/* 526 */
17467/***/ (function(module, exports, __webpack_require__) {
17468
17469(function(){
17470 var crypt = __webpack_require__(527),
17471 utf8 = __webpack_require__(258).utf8,
17472 isBuffer = __webpack_require__(528),
17473 bin = __webpack_require__(258).bin,
17474
17475 // The core
17476 md5 = function (message, options) {
17477 // Convert to byte array
17478 if (message.constructor == String)
17479 if (options && options.encoding === 'binary')
17480 message = bin.stringToBytes(message);
17481 else
17482 message = utf8.stringToBytes(message);
17483 else if (isBuffer(message))
17484 message = Array.prototype.slice.call(message, 0);
17485 else if (!Array.isArray(message))
17486 message = message.toString();
17487 // else, assume byte array already
17488
17489 var m = crypt.bytesToWords(message),
17490 l = message.length * 8,
17491 a = 1732584193,
17492 b = -271733879,
17493 c = -1732584194,
17494 d = 271733878;
17495
17496 // Swap endian
17497 for (var i = 0; i < m.length; i++) {
17498 m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |
17499 ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;
17500 }
17501
17502 // Padding
17503 m[l >>> 5] |= 0x80 << (l % 32);
17504 m[(((l + 64) >>> 9) << 4) + 14] = l;
17505
17506 // Method shortcuts
17507 var FF = md5._ff,
17508 GG = md5._gg,
17509 HH = md5._hh,
17510 II = md5._ii;
17511
17512 for (var i = 0; i < m.length; i += 16) {
17513
17514 var aa = a,
17515 bb = b,
17516 cc = c,
17517 dd = d;
17518
17519 a = FF(a, b, c, d, m[i+ 0], 7, -680876936);
17520 d = FF(d, a, b, c, m[i+ 1], 12, -389564586);
17521 c = FF(c, d, a, b, m[i+ 2], 17, 606105819);
17522 b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);
17523 a = FF(a, b, c, d, m[i+ 4], 7, -176418897);
17524 d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);
17525 c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);
17526 b = FF(b, c, d, a, m[i+ 7], 22, -45705983);
17527 a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);
17528 d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);
17529 c = FF(c, d, a, b, m[i+10], 17, -42063);
17530 b = FF(b, c, d, a, m[i+11], 22, -1990404162);
17531 a = FF(a, b, c, d, m[i+12], 7, 1804603682);
17532 d = FF(d, a, b, c, m[i+13], 12, -40341101);
17533 c = FF(c, d, a, b, m[i+14], 17, -1502002290);
17534 b = FF(b, c, d, a, m[i+15], 22, 1236535329);
17535
17536 a = GG(a, b, c, d, m[i+ 1], 5, -165796510);
17537 d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);
17538 c = GG(c, d, a, b, m[i+11], 14, 643717713);
17539 b = GG(b, c, d, a, m[i+ 0], 20, -373897302);
17540 a = GG(a, b, c, d, m[i+ 5], 5, -701558691);
17541 d = GG(d, a, b, c, m[i+10], 9, 38016083);
17542 c = GG(c, d, a, b, m[i+15], 14, -660478335);
17543 b = GG(b, c, d, a, m[i+ 4], 20, -405537848);
17544 a = GG(a, b, c, d, m[i+ 9], 5, 568446438);
17545 d = GG(d, a, b, c, m[i+14], 9, -1019803690);
17546 c = GG(c, d, a, b, m[i+ 3], 14, -187363961);
17547 b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);
17548 a = GG(a, b, c, d, m[i+13], 5, -1444681467);
17549 d = GG(d, a, b, c, m[i+ 2], 9, -51403784);
17550 c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);
17551 b = GG(b, c, d, a, m[i+12], 20, -1926607734);
17552
17553 a = HH(a, b, c, d, m[i+ 5], 4, -378558);
17554 d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);
17555 c = HH(c, d, a, b, m[i+11], 16, 1839030562);
17556 b = HH(b, c, d, a, m[i+14], 23, -35309556);
17557 a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);
17558 d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);
17559 c = HH(c, d, a, b, m[i+ 7], 16, -155497632);
17560 b = HH(b, c, d, a, m[i+10], 23, -1094730640);
17561 a = HH(a, b, c, d, m[i+13], 4, 681279174);
17562 d = HH(d, a, b, c, m[i+ 0], 11, -358537222);
17563 c = HH(c, d, a, b, m[i+ 3], 16, -722521979);
17564 b = HH(b, c, d, a, m[i+ 6], 23, 76029189);
17565 a = HH(a, b, c, d, m[i+ 9], 4, -640364487);
17566 d = HH(d, a, b, c, m[i+12], 11, -421815835);
17567 c = HH(c, d, a, b, m[i+15], 16, 530742520);
17568 b = HH(b, c, d, a, m[i+ 2], 23, -995338651);
17569
17570 a = II(a, b, c, d, m[i+ 0], 6, -198630844);
17571 d = II(d, a, b, c, m[i+ 7], 10, 1126891415);
17572 c = II(c, d, a, b, m[i+14], 15, -1416354905);
17573 b = II(b, c, d, a, m[i+ 5], 21, -57434055);
17574 a = II(a, b, c, d, m[i+12], 6, 1700485571);
17575 d = II(d, a, b, c, m[i+ 3], 10, -1894986606);
17576 c = II(c, d, a, b, m[i+10], 15, -1051523);
17577 b = II(b, c, d, a, m[i+ 1], 21, -2054922799);
17578 a = II(a, b, c, d, m[i+ 8], 6, 1873313359);
17579 d = II(d, a, b, c, m[i+15], 10, -30611744);
17580 c = II(c, d, a, b, m[i+ 6], 15, -1560198380);
17581 b = II(b, c, d, a, m[i+13], 21, 1309151649);
17582 a = II(a, b, c, d, m[i+ 4], 6, -145523070);
17583 d = II(d, a, b, c, m[i+11], 10, -1120210379);
17584 c = II(c, d, a, b, m[i+ 2], 15, 718787259);
17585 b = II(b, c, d, a, m[i+ 9], 21, -343485551);
17586
17587 a = (a + aa) >>> 0;
17588 b = (b + bb) >>> 0;
17589 c = (c + cc) >>> 0;
17590 d = (d + dd) >>> 0;
17591 }
17592
17593 return crypt.endian([a, b, c, d]);
17594 };
17595
17596 // Auxiliary functions
17597 md5._ff = function (a, b, c, d, x, s, t) {
17598 var n = a + (b & c | ~b & d) + (x >>> 0) + t;
17599 return ((n << s) | (n >>> (32 - s))) + b;
17600 };
17601 md5._gg = function (a, b, c, d, x, s, t) {
17602 var n = a + (b & d | c & ~d) + (x >>> 0) + t;
17603 return ((n << s) | (n >>> (32 - s))) + b;
17604 };
17605 md5._hh = function (a, b, c, d, x, s, t) {
17606 var n = a + (b ^ c ^ d) + (x >>> 0) + t;
17607 return ((n << s) | (n >>> (32 - s))) + b;
17608 };
17609 md5._ii = function (a, b, c, d, x, s, t) {
17610 var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
17611 return ((n << s) | (n >>> (32 - s))) + b;
17612 };
17613
17614 // Package private blocksize
17615 md5._blocksize = 16;
17616 md5._digestsize = 16;
17617
17618 module.exports = function (message, options) {
17619 if (message === undefined || message === null)
17620 throw new Error('Illegal argument ' + message);
17621
17622 var digestbytes = crypt.wordsToBytes(md5(message, options));
17623 return options && options.asBytes ? digestbytes :
17624 options && options.asString ? bin.bytesToString(digestbytes) :
17625 crypt.bytesToHex(digestbytes);
17626 };
17627
17628})();
17629
17630
17631/***/ }),
17632/* 527 */
17633/***/ (function(module, exports) {
17634
17635(function() {
17636 var base64map
17637 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
17638
17639 crypt = {
17640 // Bit-wise rotation left
17641 rotl: function(n, b) {
17642 return (n << b) | (n >>> (32 - b));
17643 },
17644
17645 // Bit-wise rotation right
17646 rotr: function(n, b) {
17647 return (n << (32 - b)) | (n >>> b);
17648 },
17649
17650 // Swap big-endian to little-endian and vice versa
17651 endian: function(n) {
17652 // If number given, swap endian
17653 if (n.constructor == Number) {
17654 return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
17655 }
17656
17657 // Else, assume array and swap all items
17658 for (var i = 0; i < n.length; i++)
17659 n[i] = crypt.endian(n[i]);
17660 return n;
17661 },
17662
17663 // Generate an array of any length of random bytes
17664 randomBytes: function(n) {
17665 for (var bytes = []; n > 0; n--)
17666 bytes.push(Math.floor(Math.random() * 256));
17667 return bytes;
17668 },
17669
17670 // Convert a byte array to big-endian 32-bit words
17671 bytesToWords: function(bytes) {
17672 for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
17673 words[b >>> 5] |= bytes[i] << (24 - b % 32);
17674 return words;
17675 },
17676
17677 // Convert big-endian 32-bit words to a byte array
17678 wordsToBytes: function(words) {
17679 for (var bytes = [], b = 0; b < words.length * 32; b += 8)
17680 bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
17681 return bytes;
17682 },
17683
17684 // Convert a byte array to a hex string
17685 bytesToHex: function(bytes) {
17686 for (var hex = [], i = 0; i < bytes.length; i++) {
17687 hex.push((bytes[i] >>> 4).toString(16));
17688 hex.push((bytes[i] & 0xF).toString(16));
17689 }
17690 return hex.join('');
17691 },
17692
17693 // Convert a hex string to a byte array
17694 hexToBytes: function(hex) {
17695 for (var bytes = [], c = 0; c < hex.length; c += 2)
17696 bytes.push(parseInt(hex.substr(c, 2), 16));
17697 return bytes;
17698 },
17699
17700 // Convert a byte array to a base-64 string
17701 bytesToBase64: function(bytes) {
17702 for (var base64 = [], i = 0; i < bytes.length; i += 3) {
17703 var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
17704 for (var j = 0; j < 4; j++)
17705 if (i * 8 + j * 6 <= bytes.length * 8)
17706 base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
17707 else
17708 base64.push('=');
17709 }
17710 return base64.join('');
17711 },
17712
17713 // Convert a base-64 string to a byte array
17714 base64ToBytes: function(base64) {
17715 // Remove non-base-64 characters
17716 base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
17717
17718 for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
17719 imod4 = ++i % 4) {
17720 if (imod4 == 0) continue;
17721 bytes.push(((base64map.indexOf(base64.charAt(i - 1))
17722 & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
17723 | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
17724 }
17725 return bytes;
17726 }
17727 };
17728
17729 module.exports = crypt;
17730})();
17731
17732
17733/***/ }),
17734/* 528 */
17735/***/ (function(module, exports) {
17736
17737/*!
17738 * Determine if an object is a Buffer
17739 *
17740 * @author Feross Aboukhadijeh <https://feross.org>
17741 * @license MIT
17742 */
17743
17744// The _isBuffer check is for Safari 5-7 support, because it's missing
17745// Object.prototype.constructor. Remove this eventually
17746module.exports = function (obj) {
17747 return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
17748}
17749
17750function isBuffer (obj) {
17751 return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
17752}
17753
17754// For Node v0.10 support. Remove this eventually.
17755function isSlowBuffer (obj) {
17756 return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
17757}
17758
17759
17760/***/ }),
17761/* 529 */
17762/***/ (function(module, exports, __webpack_require__) {
17763
17764"use strict";
17765
17766
17767var _interopRequireDefault = __webpack_require__(1);
17768
17769var _indexOf = _interopRequireDefault(__webpack_require__(71));
17770
17771var dataURItoBlob = function dataURItoBlob(dataURI, type) {
17772 var _context;
17773
17774 var byteString; // 传入的 base64,不是 dataURL
17775
17776 if ((0, _indexOf.default)(dataURI).call(dataURI, 'base64') < 0) {
17777 byteString = atob(dataURI);
17778 } else if ((0, _indexOf.default)(_context = dataURI.split(',')[0]).call(_context, 'base64') >= 0) {
17779 type = type || dataURI.split(',')[0].split(':')[1].split(';')[0];
17780 byteString = atob(dataURI.split(',')[1]);
17781 } else {
17782 byteString = unescape(dataURI.split(',')[1]);
17783 }
17784
17785 var ia = new Uint8Array(byteString.length);
17786
17787 for (var i = 0; i < byteString.length; i++) {
17788 ia[i] = byteString.charCodeAt(i);
17789 }
17790
17791 return new Blob([ia], {
17792 type: type
17793 });
17794};
17795
17796module.exports = dataURItoBlob;
17797
17798/***/ }),
17799/* 530 */
17800/***/ (function(module, exports, __webpack_require__) {
17801
17802"use strict";
17803
17804
17805var _interopRequireDefault = __webpack_require__(1);
17806
17807var _slicedToArray2 = _interopRequireDefault(__webpack_require__(531));
17808
17809var _map = _interopRequireDefault(__webpack_require__(35));
17810
17811var _indexOf = _interopRequireDefault(__webpack_require__(71));
17812
17813var _find = _interopRequireDefault(__webpack_require__(93));
17814
17815var _promise = _interopRequireDefault(__webpack_require__(12));
17816
17817var _concat = _interopRequireDefault(__webpack_require__(22));
17818
17819var _keys2 = _interopRequireDefault(__webpack_require__(59));
17820
17821var _stringify = _interopRequireDefault(__webpack_require__(36));
17822
17823var _defineProperty = _interopRequireDefault(__webpack_require__(92));
17824
17825var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(151));
17826
17827var _ = __webpack_require__(3);
17828
17829var AVError = __webpack_require__(46);
17830
17831var _require = __webpack_require__(27),
17832 _request = _require._request;
17833
17834var _require2 = __webpack_require__(30),
17835 isNullOrUndefined = _require2.isNullOrUndefined,
17836 ensureArray = _require2.ensureArray,
17837 transformFetchOptions = _require2.transformFetchOptions,
17838 setValue = _require2.setValue,
17839 findValue = _require2.findValue,
17840 isPlainObject = _require2.isPlainObject,
17841 continueWhile = _require2.continueWhile;
17842
17843var recursiveToPointer = function recursiveToPointer(value) {
17844 if (_.isArray(value)) return (0, _map.default)(value).call(value, recursiveToPointer);
17845 if (isPlainObject(value)) return _.mapObject(value, recursiveToPointer);
17846 if (_.isObject(value) && value._toPointer) return value._toPointer();
17847 return value;
17848};
17849
17850var RESERVED_KEYS = ['objectId', 'createdAt', 'updatedAt'];
17851
17852var checkReservedKey = function checkReservedKey(key) {
17853 if ((0, _indexOf.default)(RESERVED_KEYS).call(RESERVED_KEYS, key) !== -1) {
17854 throw new Error("key[".concat(key, "] is reserved"));
17855 }
17856};
17857
17858var handleBatchResults = function handleBatchResults(results) {
17859 var firstError = (0, _find.default)(_).call(_, results, function (result) {
17860 return result instanceof Error;
17861 });
17862
17863 if (!firstError) {
17864 return results;
17865 }
17866
17867 var error = new AVError(firstError.code, firstError.message);
17868 error.results = results;
17869 throw error;
17870}; // Helper function to get a value from a Backbone object as a property
17871// or as a function.
17872
17873
17874function getValue(object, prop) {
17875 if (!(object && object[prop])) {
17876 return null;
17877 }
17878
17879 return _.isFunction(object[prop]) ? object[prop]() : object[prop];
17880} // AV.Object is analogous to the Java AVObject.
17881// It also implements the same interface as a Backbone model.
17882
17883
17884module.exports = function (AV) {
17885 /**
17886 * Creates a new model with defined attributes. A client id (cid) is
17887 * automatically generated and assigned for you.
17888 *
17889 * <p>You won't normally call this method directly. It is recommended that
17890 * you use a subclass of <code>AV.Object</code> instead, created by calling
17891 * <code>extend</code>.</p>
17892 *
17893 * <p>However, if you don't want to use a subclass, or aren't sure which
17894 * subclass is appropriate, you can use this form:<pre>
17895 * var object = new AV.Object("ClassName");
17896 * </pre>
17897 * That is basically equivalent to:<pre>
17898 * var MyClass = AV.Object.extend("ClassName");
17899 * var object = new MyClass();
17900 * </pre></p>
17901 *
17902 * @param {Object} attributes The initial set of data to store in the object.
17903 * @param {Object} options A set of Backbone-like options for creating the
17904 * object. The only option currently supported is "collection".
17905 * @see AV.Object.extend
17906 *
17907 * @class
17908 *
17909 * <p>The fundamental unit of AV data, which implements the Backbone Model
17910 * interface.</p>
17911 */
17912 AV.Object = function (attributes, options) {
17913 // Allow new AV.Object("ClassName") as a shortcut to _create.
17914 if (_.isString(attributes)) {
17915 return AV.Object._create.apply(this, arguments);
17916 }
17917
17918 attributes = attributes || {};
17919
17920 if (options && options.parse) {
17921 attributes = this.parse(attributes);
17922 attributes = this._mergeMagicFields(attributes);
17923 }
17924
17925 var defaults = getValue(this, 'defaults');
17926
17927 if (defaults) {
17928 attributes = _.extend({}, defaults, attributes);
17929 }
17930
17931 if (options && options.collection) {
17932 this.collection = options.collection;
17933 }
17934
17935 this._serverData = {}; // The last known data for this object from cloud.
17936
17937 this._opSetQueue = [{}]; // List of sets of changes to the data.
17938
17939 this._flags = {};
17940 this.attributes = {}; // The best estimate of this's current data.
17941
17942 this._hashedJSON = {}; // Hash of values of containers at last save.
17943
17944 this._escapedAttributes = {};
17945 this.cid = _.uniqueId('c');
17946 this.changed = {};
17947 this._silent = {};
17948 this._pending = {};
17949 this.set(attributes, {
17950 silent: true
17951 });
17952 this.changed = {};
17953 this._silent = {};
17954 this._pending = {};
17955 this._hasData = true;
17956 this._previousAttributes = _.clone(this.attributes);
17957 this.initialize.apply(this, arguments);
17958 };
17959 /**
17960 * @lends AV.Object.prototype
17961 * @property {String} id The objectId of the AV Object.
17962 */
17963
17964 /**
17965 * Saves the given list of AV.Object.
17966 * If any error is encountered, stops and calls the error handler.
17967 *
17968 * @example
17969 * AV.Object.saveAll([object1, object2, ...]).then(function(list) {
17970 * // All the objects were saved.
17971 * }, function(error) {
17972 * // An error occurred while saving one of the objects.
17973 * });
17974 *
17975 * @param {Array} list A list of <code>AV.Object</code>.
17976 */
17977
17978
17979 AV.Object.saveAll = function (list, options) {
17980 return AV.Object._deepSaveAsync(list, null, options);
17981 };
17982 /**
17983 * Fetch the given list of AV.Object.
17984 *
17985 * @param {AV.Object[]} objects A list of <code>AV.Object</code>
17986 * @param {AuthOptions} options
17987 * @return {Promise.<AV.Object[]>} The given list of <code>AV.Object</code>, updated
17988 */
17989
17990
17991 AV.Object.fetchAll = function (objects, options) {
17992 return _promise.default.resolve().then(function () {
17993 return _request('batch', null, null, 'POST', {
17994 requests: (0, _map.default)(_).call(_, objects, function (object) {
17995 var _context;
17996
17997 if (!object.className) throw new Error('object must have className to fetch');
17998 if (!object.id) throw new Error('object must have id to fetch');
17999 if (object.dirty()) throw new Error('object is modified but not saved');
18000 return {
18001 method: 'GET',
18002 path: (0, _concat.default)(_context = "/1.1/classes/".concat(object.className, "/")).call(_context, object.id)
18003 };
18004 })
18005 }, options);
18006 }).then(function (response) {
18007 var results = (0, _map.default)(_).call(_, objects, function (object, i) {
18008 if (response[i].success) {
18009 var fetchedAttrs = object.parse(response[i].success);
18010
18011 object._cleanupUnsetKeys(fetchedAttrs);
18012
18013 object._finishFetch(fetchedAttrs);
18014
18015 return object;
18016 }
18017
18018 if (response[i].success === null) {
18019 return new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
18020 }
18021
18022 return new AVError(response[i].error.code, response[i].error.error);
18023 });
18024 return handleBatchResults(results);
18025 });
18026 }; // Attach all inheritable methods to the AV.Object prototype.
18027
18028
18029 _.extend(AV.Object.prototype, AV.Events,
18030 /** @lends AV.Object.prototype */
18031 {
18032 _fetchWhenSave: false,
18033
18034 /**
18035 * Initialize is an empty function by default. Override it with your own
18036 * initialization logic.
18037 */
18038 initialize: function initialize() {},
18039
18040 /**
18041 * Set whether to enable fetchWhenSave option when updating object.
18042 * When set true, SDK would fetch the latest object after saving.
18043 * Default is false.
18044 *
18045 * @deprecated use AV.Object#save with options.fetchWhenSave instead
18046 * @param {boolean} enable true to enable fetchWhenSave option.
18047 */
18048 fetchWhenSave: function fetchWhenSave(enable) {
18049 console.warn('AV.Object#fetchWhenSave is deprecated, use AV.Object#save with options.fetchWhenSave instead.');
18050
18051 if (!_.isBoolean(enable)) {
18052 throw new Error('Expect boolean value for fetchWhenSave');
18053 }
18054
18055 this._fetchWhenSave = enable;
18056 },
18057
18058 /**
18059 * Returns the object's objectId.
18060 * @return {String} the objectId.
18061 */
18062 getObjectId: function getObjectId() {
18063 return this.id;
18064 },
18065
18066 /**
18067 * Returns the object's createdAt attribute.
18068 * @return {Date}
18069 */
18070 getCreatedAt: function getCreatedAt() {
18071 return this.createdAt;
18072 },
18073
18074 /**
18075 * Returns the object's updatedAt attribute.
18076 * @return {Date}
18077 */
18078 getUpdatedAt: function getUpdatedAt() {
18079 return this.updatedAt;
18080 },
18081
18082 /**
18083 * Returns a JSON version of the object.
18084 * @return {Object}
18085 */
18086 toJSON: function toJSON(key, holder) {
18087 var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
18088 return this._toFullJSON(seenObjects, false);
18089 },
18090
18091 /**
18092 * Returns a JSON version of the object with meta data.
18093 * Inverse to {@link AV.parseJSON}
18094 * @since 3.0.0
18095 * @return {Object}
18096 */
18097 toFullJSON: function toFullJSON() {
18098 var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
18099 return this._toFullJSON(seenObjects);
18100 },
18101 _toFullJSON: function _toFullJSON(seenObjects) {
18102 var _this = this;
18103
18104 var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
18105
18106 var json = _.clone(this.attributes);
18107
18108 if (_.isArray(seenObjects)) {
18109 var newSeenObjects = (0, _concat.default)(seenObjects).call(seenObjects, this);
18110 }
18111
18112 AV._objectEach(json, function (val, key) {
18113 json[key] = AV._encode(val, newSeenObjects, undefined, full);
18114 });
18115
18116 AV._objectEach(this._operations, function (val, key) {
18117 json[key] = val;
18118 });
18119
18120 if (_.has(this, 'id')) {
18121 json.objectId = this.id;
18122 }
18123
18124 ['createdAt', 'updatedAt'].forEach(function (key) {
18125 if (_.has(_this, key)) {
18126 var val = _this[key];
18127 json[key] = _.isDate(val) ? val.toJSON() : val;
18128 }
18129 });
18130
18131 if (full) {
18132 json.__type = 'Object';
18133 if (_.isArray(seenObjects) && seenObjects.length) json.__type = 'Pointer';
18134 json.className = this.className;
18135 }
18136
18137 return json;
18138 },
18139
18140 /**
18141 * Updates _hashedJSON to reflect the current state of this object.
18142 * Adds any changed hash values to the set of pending changes.
18143 * @private
18144 */
18145 _refreshCache: function _refreshCache() {
18146 var self = this;
18147
18148 if (self._refreshingCache) {
18149 return;
18150 }
18151
18152 self._refreshingCache = true;
18153
18154 AV._objectEach(this.attributes, function (value, key) {
18155 if (value instanceof AV.Object) {
18156 value._refreshCache();
18157 } else if (_.isObject(value)) {
18158 if (self._resetCacheForKey(key)) {
18159 self.set(key, new AV.Op.Set(value), {
18160 silent: true
18161 });
18162 }
18163 }
18164 });
18165
18166 delete self._refreshingCache;
18167 },
18168
18169 /**
18170 * Returns true if this object has been modified since its last
18171 * save/refresh. If an attribute is specified, it returns true only if that
18172 * particular attribute has been modified since the last save/refresh.
18173 * @param {String} attr An attribute name (optional).
18174 * @return {Boolean}
18175 */
18176 dirty: function dirty(attr) {
18177 this._refreshCache();
18178
18179 var currentChanges = _.last(this._opSetQueue);
18180
18181 if (attr) {
18182 return currentChanges[attr] ? true : false;
18183 }
18184
18185 if (!this.id) {
18186 return true;
18187 }
18188
18189 if ((0, _keys2.default)(_).call(_, currentChanges).length > 0) {
18190 return true;
18191 }
18192
18193 return false;
18194 },
18195
18196 /**
18197 * Returns the keys of the modified attribute since its last save/refresh.
18198 * @return {String[]}
18199 */
18200 dirtyKeys: function dirtyKeys() {
18201 this._refreshCache();
18202
18203 var currentChanges = _.last(this._opSetQueue);
18204
18205 return (0, _keys2.default)(_).call(_, currentChanges);
18206 },
18207
18208 /**
18209 * Gets a Pointer referencing this Object.
18210 * @private
18211 */
18212 _toPointer: function _toPointer() {
18213 // if (!this.id) {
18214 // throw new Error("Can't serialize an unsaved AV.Object");
18215 // }
18216 return {
18217 __type: 'Pointer',
18218 className: this.className,
18219 objectId: this.id
18220 };
18221 },
18222
18223 /**
18224 * Gets the value of an attribute.
18225 * @param {String} attr The string name of an attribute.
18226 */
18227 get: function get(attr) {
18228 switch (attr) {
18229 case 'objectId':
18230 return this.id;
18231
18232 case 'createdAt':
18233 case 'updatedAt':
18234 return this[attr];
18235
18236 default:
18237 return this.attributes[attr];
18238 }
18239 },
18240
18241 /**
18242 * Gets a relation on the given class for the attribute.
18243 * @param {String} attr The attribute to get the relation for.
18244 * @return {AV.Relation}
18245 */
18246 relation: function relation(attr) {
18247 var value = this.get(attr);
18248
18249 if (value) {
18250 if (!(value instanceof AV.Relation)) {
18251 throw new Error('Called relation() on non-relation field ' + attr);
18252 }
18253
18254 value._ensureParentAndKey(this, attr);
18255
18256 return value;
18257 } else {
18258 return new AV.Relation(this, attr);
18259 }
18260 },
18261
18262 /**
18263 * Gets the HTML-escaped value of an attribute.
18264 */
18265 escape: function escape(attr) {
18266 var html = this._escapedAttributes[attr];
18267
18268 if (html) {
18269 return html;
18270 }
18271
18272 var val = this.attributes[attr];
18273 var escaped;
18274
18275 if (isNullOrUndefined(val)) {
18276 escaped = '';
18277 } else {
18278 escaped = _.escape(val.toString());
18279 }
18280
18281 this._escapedAttributes[attr] = escaped;
18282 return escaped;
18283 },
18284
18285 /**
18286 * Returns <code>true</code> if the attribute contains a value that is not
18287 * null or undefined.
18288 * @param {String} attr The string name of the attribute.
18289 * @return {Boolean}
18290 */
18291 has: function has(attr) {
18292 return !isNullOrUndefined(this.attributes[attr]);
18293 },
18294
18295 /**
18296 * Pulls "special" fields like objectId, createdAt, etc. out of attrs
18297 * and puts them on "this" directly. Removes them from attrs.
18298 * @param attrs - A dictionary with the data for this AV.Object.
18299 * @private
18300 */
18301 _mergeMagicFields: function _mergeMagicFields(attrs) {
18302 // Check for changes of magic fields.
18303 var model = this;
18304 var specialFields = ['objectId', 'createdAt', 'updatedAt'];
18305
18306 AV._arrayEach(specialFields, function (attr) {
18307 if (attrs[attr]) {
18308 if (attr === 'objectId') {
18309 model.id = attrs[attr];
18310 } else if ((attr === 'createdAt' || attr === 'updatedAt') && !_.isDate(attrs[attr])) {
18311 model[attr] = AV._parseDate(attrs[attr]);
18312 } else {
18313 model[attr] = attrs[attr];
18314 }
18315
18316 delete attrs[attr];
18317 }
18318 });
18319
18320 return attrs;
18321 },
18322
18323 /**
18324 * Returns the json to be sent to the server.
18325 * @private
18326 */
18327 _startSave: function _startSave() {
18328 this._opSetQueue.push({});
18329 },
18330
18331 /**
18332 * Called when a save fails because of an error. Any changes that were part
18333 * of the save need to be merged with changes made after the save. This
18334 * might throw an exception is you do conflicting operations. For example,
18335 * if you do:
18336 * object.set("foo", "bar");
18337 * object.set("invalid field name", "baz");
18338 * object.save();
18339 * object.increment("foo");
18340 * then this will throw when the save fails and the client tries to merge
18341 * "bar" with the +1.
18342 * @private
18343 */
18344 _cancelSave: function _cancelSave() {
18345 var failedChanges = _.first(this._opSetQueue);
18346
18347 this._opSetQueue = _.rest(this._opSetQueue);
18348
18349 var nextChanges = _.first(this._opSetQueue);
18350
18351 AV._objectEach(failedChanges, function (op, key) {
18352 var op1 = failedChanges[key];
18353 var op2 = nextChanges[key];
18354
18355 if (op1 && op2) {
18356 nextChanges[key] = op2._mergeWithPrevious(op1);
18357 } else if (op1) {
18358 nextChanges[key] = op1;
18359 }
18360 });
18361
18362 this._saving = this._saving - 1;
18363 },
18364
18365 /**
18366 * Called when a save completes successfully. This merges the changes that
18367 * were saved into the known server data, and overrides it with any data
18368 * sent directly from the server.
18369 * @private
18370 */
18371 _finishSave: function _finishSave(serverData) {
18372 var _context2;
18373
18374 // Grab a copy of any object referenced by this object. These instances
18375 // may have already been fetched, and we don't want to lose their data.
18376 // Note that doing it like this means we will unify separate copies of the
18377 // same object, but that's a risk we have to take.
18378 var fetchedObjects = {};
18379
18380 AV._traverse(this.attributes, function (object) {
18381 if (object instanceof AV.Object && object.id && object._hasData) {
18382 fetchedObjects[object.id] = object;
18383 }
18384 });
18385
18386 var savedChanges = _.first(this._opSetQueue);
18387
18388 this._opSetQueue = _.rest(this._opSetQueue);
18389
18390 this._applyOpSet(savedChanges, this._serverData);
18391
18392 this._mergeMagicFields(serverData);
18393
18394 var self = this;
18395
18396 AV._objectEach(serverData, function (value, key) {
18397 self._serverData[key] = AV._decode(value, key); // Look for any objects that might have become unfetched and fix them
18398 // by replacing their values with the previously observed values.
18399
18400 var fetched = AV._traverse(self._serverData[key], function (object) {
18401 if (object instanceof AV.Object && fetchedObjects[object.id]) {
18402 return fetchedObjects[object.id];
18403 }
18404 });
18405
18406 if (fetched) {
18407 self._serverData[key] = fetched;
18408 }
18409 });
18410
18411 this._rebuildAllEstimatedData();
18412
18413 var opSetQueue = (0, _map.default)(_context2 = this._opSetQueue).call(_context2, _.clone);
18414
18415 this._refreshCache();
18416
18417 this._opSetQueue = opSetQueue;
18418 this._saving = this._saving - 1;
18419 },
18420
18421 /**
18422 * Called when a fetch or login is complete to set the known server data to
18423 * the given object.
18424 * @private
18425 */
18426 _finishFetch: function _finishFetch(serverData, hasData) {
18427 // Clear out any changes the user might have made previously.
18428 this._opSetQueue = [{}]; // Bring in all the new server data.
18429
18430 this._mergeMagicFields(serverData);
18431
18432 var self = this;
18433
18434 AV._objectEach(serverData, function (value, key) {
18435 self._serverData[key] = AV._decode(value, key);
18436 }); // Refresh the attributes.
18437
18438
18439 this._rebuildAllEstimatedData(); // Clear out the cache of mutable containers.
18440
18441
18442 this._refreshCache();
18443
18444 this._opSetQueue = [{}];
18445 this._hasData = hasData;
18446 },
18447
18448 /**
18449 * Applies the set of AV.Op in opSet to the object target.
18450 * @private
18451 */
18452 _applyOpSet: function _applyOpSet(opSet, target) {
18453 var self = this;
18454
18455 AV._objectEach(opSet, function (change, key) {
18456 var _findValue = findValue(target, key),
18457 _findValue2 = (0, _slicedToArray2.default)(_findValue, 3),
18458 value = _findValue2[0],
18459 actualTarget = _findValue2[1],
18460 actualKey = _findValue2[2];
18461
18462 setValue(target, key, change._estimate(value, self, key));
18463
18464 if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
18465 delete actualTarget[actualKey];
18466 }
18467 });
18468 },
18469
18470 /**
18471 * Replaces the cached value for key with the current value.
18472 * Returns true if the new value is different than the old value.
18473 * @private
18474 */
18475 _resetCacheForKey: function _resetCacheForKey(key) {
18476 var value = this.attributes[key];
18477
18478 if (_.isObject(value) && !(value instanceof AV.Object) && !(value instanceof AV.File)) {
18479 var json = (0, _stringify.default)(recursiveToPointer(value));
18480
18481 if (this._hashedJSON[key] !== json) {
18482 var wasSet = !!this._hashedJSON[key];
18483 this._hashedJSON[key] = json;
18484 return wasSet;
18485 }
18486 }
18487
18488 return false;
18489 },
18490
18491 /**
18492 * Populates attributes[key] by starting with the last known data from the
18493 * server, and applying all of the local changes that have been made to that
18494 * key since then.
18495 * @private
18496 */
18497 _rebuildEstimatedDataForKey: function _rebuildEstimatedDataForKey(key) {
18498 var self = this;
18499 delete this.attributes[key];
18500
18501 if (this._serverData[key]) {
18502 this.attributes[key] = this._serverData[key];
18503 }
18504
18505 AV._arrayEach(this._opSetQueue, function (opSet) {
18506 var op = opSet[key];
18507
18508 if (op) {
18509 var _findValue3 = findValue(self.attributes, key),
18510 _findValue4 = (0, _slicedToArray2.default)(_findValue3, 4),
18511 value = _findValue4[0],
18512 actualTarget = _findValue4[1],
18513 actualKey = _findValue4[2],
18514 firstKey = _findValue4[3];
18515
18516 setValue(self.attributes, key, op._estimate(value, self, key));
18517
18518 if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
18519 delete actualTarget[actualKey];
18520 }
18521
18522 self._resetCacheForKey(firstKey);
18523 }
18524 });
18525 },
18526
18527 /**
18528 * Populates attributes by starting with the last known data from the
18529 * server, and applying all of the local changes that have been made since
18530 * then.
18531 * @private
18532 */
18533 _rebuildAllEstimatedData: function _rebuildAllEstimatedData() {
18534 var self = this;
18535
18536 var previousAttributes = _.clone(this.attributes);
18537
18538 this.attributes = _.clone(this._serverData);
18539
18540 AV._arrayEach(this._opSetQueue, function (opSet) {
18541 self._applyOpSet(opSet, self.attributes);
18542
18543 AV._objectEach(opSet, function (op, key) {
18544 self._resetCacheForKey(key);
18545 });
18546 }); // Trigger change events for anything that changed because of the fetch.
18547
18548
18549 AV._objectEach(previousAttributes, function (oldValue, key) {
18550 if (self.attributes[key] !== oldValue) {
18551 self.trigger('change:' + key, self, self.attributes[key], {});
18552 }
18553 });
18554
18555 AV._objectEach(this.attributes, function (newValue, key) {
18556 if (!_.has(previousAttributes, key)) {
18557 self.trigger('change:' + key, self, newValue, {});
18558 }
18559 });
18560 },
18561
18562 /**
18563 * Sets a hash of model attributes on the object, firing
18564 * <code>"change"</code> unless you choose to silence it.
18565 *
18566 * <p>You can call it with an object containing keys and values, or with one
18567 * key and value. For example:</p>
18568 *
18569 * @example
18570 * gameTurn.set({
18571 * player: player1,
18572 * diceRoll: 2
18573 * });
18574 *
18575 * game.set("currentPlayer", player2);
18576 *
18577 * game.set("finished", true);
18578 *
18579 * @param {String} key The key to set.
18580 * @param {Any} value The value to give it.
18581 * @param {Object} [options]
18582 * @param {Boolean} [options.silent]
18583 * @return {AV.Object} self if succeeded, throws if the value is not valid.
18584 * @see AV.Object#validate
18585 */
18586 set: function set(key, value, options) {
18587 var attrs;
18588
18589 if (_.isObject(key) || isNullOrUndefined(key)) {
18590 attrs = _.mapObject(key, function (v, k) {
18591 checkReservedKey(k);
18592 return AV._decode(v, k);
18593 });
18594 options = value;
18595 } else {
18596 attrs = {};
18597 checkReservedKey(key);
18598 attrs[key] = AV._decode(value, key);
18599 } // Extract attributes and options.
18600
18601
18602 options = options || {};
18603
18604 if (!attrs) {
18605 return this;
18606 }
18607
18608 if (attrs instanceof AV.Object) {
18609 attrs = attrs.attributes;
18610 } // If the unset option is used, every attribute should be a Unset.
18611
18612
18613 if (options.unset) {
18614 AV._objectEach(attrs, function (unused_value, key) {
18615 attrs[key] = new AV.Op.Unset();
18616 });
18617 } // Apply all the attributes to get the estimated values.
18618
18619
18620 var dataToValidate = _.clone(attrs);
18621
18622 var self = this;
18623
18624 AV._objectEach(dataToValidate, function (value, key) {
18625 if (value instanceof AV.Op) {
18626 dataToValidate[key] = value._estimate(self.attributes[key], self, key);
18627
18628 if (dataToValidate[key] === AV.Op._UNSET) {
18629 delete dataToValidate[key];
18630 }
18631 }
18632 }); // Run validation.
18633
18634
18635 this._validate(attrs, options);
18636
18637 options.changes = {};
18638 var escaped = this._escapedAttributes; // Update attributes.
18639
18640 AV._arrayEach((0, _keys2.default)(_).call(_, attrs), function (attr) {
18641 var val = attrs[attr]; // If this is a relation object we need to set the parent correctly,
18642 // since the location where it was parsed does not have access to
18643 // this object.
18644
18645 if (val instanceof AV.Relation) {
18646 val.parent = self;
18647 }
18648
18649 if (!(val instanceof AV.Op)) {
18650 val = new AV.Op.Set(val);
18651 } // See if this change will actually have any effect.
18652
18653
18654 var isRealChange = true;
18655
18656 if (val instanceof AV.Op.Set && _.isEqual(self.attributes[attr], val.value)) {
18657 isRealChange = false;
18658 }
18659
18660 if (isRealChange) {
18661 delete escaped[attr];
18662
18663 if (options.silent) {
18664 self._silent[attr] = true;
18665 } else {
18666 options.changes[attr] = true;
18667 }
18668 }
18669
18670 var currentChanges = _.last(self._opSetQueue);
18671
18672 currentChanges[attr] = val._mergeWithPrevious(currentChanges[attr]);
18673
18674 self._rebuildEstimatedDataForKey(attr);
18675
18676 if (isRealChange) {
18677 self.changed[attr] = self.attributes[attr];
18678
18679 if (!options.silent) {
18680 self._pending[attr] = true;
18681 }
18682 } else {
18683 delete self.changed[attr];
18684 delete self._pending[attr];
18685 }
18686 });
18687
18688 if (!options.silent) {
18689 this.change(options);
18690 }
18691
18692 return this;
18693 },
18694
18695 /**
18696 * Remove an attribute from the model, firing <code>"change"</code> unless
18697 * you choose to silence it. This is a noop if the attribute doesn't
18698 * exist.
18699 * @param key {String} The key.
18700 */
18701 unset: function unset(attr, options) {
18702 options = options || {};
18703 options.unset = true;
18704 return this.set(attr, null, options);
18705 },
18706
18707 /**
18708 * Atomically increments the value of the given attribute the next time the
18709 * object is saved. If no amount is specified, 1 is used by default.
18710 *
18711 * @param key {String} The key.
18712 * @param amount {Number} The amount to increment by.
18713 */
18714 increment: function increment(attr, amount) {
18715 if (_.isUndefined(amount) || _.isNull(amount)) {
18716 amount = 1;
18717 }
18718
18719 return this.set(attr, new AV.Op.Increment(amount));
18720 },
18721
18722 /**
18723 * Atomically add an object to the end of the array associated with a given
18724 * key.
18725 * @param key {String} The key.
18726 * @param item {} The item to add.
18727 */
18728 add: function add(attr, item) {
18729 return this.set(attr, new AV.Op.Add(ensureArray(item)));
18730 },
18731
18732 /**
18733 * Atomically add an object to the array associated with a given key, only
18734 * if it is not already present in the array. The position of the insert is
18735 * not guaranteed.
18736 *
18737 * @param key {String} The key.
18738 * @param item {} The object to add.
18739 */
18740 addUnique: function addUnique(attr, item) {
18741 return this.set(attr, new AV.Op.AddUnique(ensureArray(item)));
18742 },
18743
18744 /**
18745 * Atomically remove all instances of an object from the array associated
18746 * with a given key.
18747 *
18748 * @param key {String} The key.
18749 * @param item {} The object to remove.
18750 */
18751 remove: function remove(attr, item) {
18752 return this.set(attr, new AV.Op.Remove(ensureArray(item)));
18753 },
18754
18755 /**
18756 * Atomically apply a "bit and" operation on the value associated with a
18757 * given key.
18758 *
18759 * @param key {String} The key.
18760 * @param value {Number} The value to apply.
18761 */
18762 bitAnd: function bitAnd(attr, value) {
18763 return this.set(attr, new AV.Op.BitAnd(value));
18764 },
18765
18766 /**
18767 * Atomically apply a "bit or" operation on the value associated with a
18768 * given key.
18769 *
18770 * @param key {String} The key.
18771 * @param value {Number} The value to apply.
18772 */
18773 bitOr: function bitOr(attr, value) {
18774 return this.set(attr, new AV.Op.BitOr(value));
18775 },
18776
18777 /**
18778 * Atomically apply a "bit xor" operation on the value associated with a
18779 * given key.
18780 *
18781 * @param key {String} The key.
18782 * @param value {Number} The value to apply.
18783 */
18784 bitXor: function bitXor(attr, value) {
18785 return this.set(attr, new AV.Op.BitXor(value));
18786 },
18787
18788 /**
18789 * Returns an instance of a subclass of AV.Op describing what kind of
18790 * modification has been performed on this field since the last time it was
18791 * saved. For example, after calling object.increment("x"), calling
18792 * object.op("x") would return an instance of AV.Op.Increment.
18793 *
18794 * @param key {String} The key.
18795 * @returns {AV.Op} The operation, or undefined if none.
18796 */
18797 op: function op(attr) {
18798 return _.last(this._opSetQueue)[attr];
18799 },
18800
18801 /**
18802 * Clear all attributes on the model, firing <code>"change"</code> unless
18803 * you choose to silence it.
18804 */
18805 clear: function clear(options) {
18806 options = options || {};
18807 options.unset = true;
18808
18809 var keysToClear = _.extend(this.attributes, this._operations);
18810
18811 return this.set(keysToClear, options);
18812 },
18813
18814 /**
18815 * Clears any (or specific) changes to the model made since the last save.
18816 * @param {string|string[]} [keys] specify keys to revert.
18817 */
18818 revert: function revert(keys) {
18819 var lastOp = _.last(this._opSetQueue);
18820
18821 var _keys = ensureArray(keys || (0, _keys2.default)(_).call(_, lastOp));
18822
18823 _keys.forEach(function (key) {
18824 delete lastOp[key];
18825 });
18826
18827 this._rebuildAllEstimatedData();
18828
18829 return this;
18830 },
18831
18832 /**
18833 * Returns a JSON-encoded set of operations to be sent with the next save
18834 * request.
18835 * @private
18836 */
18837 _getSaveJSON: function _getSaveJSON() {
18838 var json = _.clone(_.first(this._opSetQueue));
18839
18840 AV._objectEach(json, function (op, key) {
18841 json[key] = op.toJSON();
18842 });
18843
18844 return json;
18845 },
18846
18847 /**
18848 * Returns true if this object can be serialized for saving.
18849 * @private
18850 */
18851 _canBeSerialized: function _canBeSerialized() {
18852 return AV.Object._canBeSerializedAsValue(this.attributes);
18853 },
18854
18855 /**
18856 * Fetch the model from the server. If the server's representation of the
18857 * model differs from its current attributes, they will be overriden,
18858 * triggering a <code>"change"</code> event.
18859 * @param {Object} fetchOptions Optional options to set 'keys',
18860 * 'include' and 'includeACL' option.
18861 * @param {AuthOptions} options
18862 * @return {Promise} A promise that is fulfilled when the fetch
18863 * completes.
18864 */
18865 fetch: function fetch() {
18866 var fetchOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18867 var options = arguments.length > 1 ? arguments[1] : undefined;
18868
18869 if (!this.id) {
18870 throw new Error('Cannot fetch unsaved object');
18871 }
18872
18873 var self = this;
18874
18875 var request = _request('classes', this.className, this.id, 'GET', transformFetchOptions(fetchOptions), options);
18876
18877 return request.then(function (response) {
18878 var fetchedAttrs = self.parse(response);
18879
18880 self._cleanupUnsetKeys(fetchedAttrs, (0, _keys2.default)(fetchOptions) ? ensureArray((0, _keys2.default)(fetchOptions)).join(',').split(',') : undefined);
18881
18882 self._finishFetch(fetchedAttrs, true);
18883
18884 return self;
18885 });
18886 },
18887 _cleanupUnsetKeys: function _cleanupUnsetKeys(fetchedAttrs) {
18888 var _this2 = this;
18889
18890 var fetchedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _keys2.default)(_).call(_, this._serverData);
18891
18892 _.forEach(fetchedKeys, function (key) {
18893 if (fetchedAttrs[key] === undefined) delete _this2._serverData[key];
18894 });
18895 },
18896
18897 /**
18898 * Set a hash of model attributes, and save the model to the server.
18899 * updatedAt will be updated when the request returns.
18900 * You can either call it as:<pre>
18901 * object.save();</pre>
18902 * or<pre>
18903 * object.save(null, options);</pre>
18904 * or<pre>
18905 * object.save(attrs, options);</pre>
18906 * or<pre>
18907 * object.save(key, value, options);</pre>
18908 *
18909 * @example
18910 * gameTurn.save({
18911 * player: "Jake Cutter",
18912 * diceRoll: 2
18913 * }).then(function(gameTurnAgain) {
18914 * // The save was successful.
18915 * }, function(error) {
18916 * // The save failed. Error is an instance of AVError.
18917 * });
18918 *
18919 * @param {AuthOptions} options AuthOptions plus:
18920 * @param {Boolean} options.fetchWhenSave fetch and update object after save succeeded
18921 * @param {AV.Query} options.query Save object only when it matches the query
18922 * @return {Promise} A promise that is fulfilled when the save
18923 * completes.
18924 * @see AVError
18925 */
18926 save: function save(arg1, arg2, arg3) {
18927 var attrs, current, options;
18928
18929 if (_.isObject(arg1) || isNullOrUndefined(arg1)) {
18930 attrs = arg1;
18931 options = arg2;
18932 } else {
18933 attrs = {};
18934 attrs[arg1] = arg2;
18935 options = arg3;
18936 }
18937
18938 options = _.clone(options) || {};
18939
18940 if (options.wait) {
18941 current = _.clone(this.attributes);
18942 }
18943
18944 var setOptions = _.clone(options) || {};
18945
18946 if (setOptions.wait) {
18947 setOptions.silent = true;
18948 }
18949
18950 if (attrs) {
18951 this.set(attrs, setOptions);
18952 }
18953
18954 var model = this;
18955 var unsavedChildren = [];
18956 var unsavedFiles = [];
18957
18958 AV.Object._findUnsavedChildren(model, unsavedChildren, unsavedFiles);
18959
18960 if (unsavedChildren.length + unsavedFiles.length > 1) {
18961 return AV.Object._deepSaveAsync(this, model, options);
18962 }
18963
18964 this._startSave();
18965
18966 this._saving = (this._saving || 0) + 1;
18967 this._allPreviousSaves = this._allPreviousSaves || _promise.default.resolve();
18968 this._allPreviousSaves = this._allPreviousSaves.catch(function (e) {}).then(function () {
18969 var method = model.id ? 'PUT' : 'POST';
18970
18971 var json = model._getSaveJSON();
18972
18973 var query = {};
18974
18975 if (model._fetchWhenSave || options.fetchWhenSave) {
18976 query['new'] = 'true';
18977 } // user login option
18978
18979
18980 if (options._failOnNotExist) {
18981 query.failOnNotExist = 'true';
18982 }
18983
18984 if (options.query) {
18985 var queryParams;
18986
18987 if (typeof options.query._getParams === 'function') {
18988 queryParams = options.query._getParams();
18989
18990 if (queryParams) {
18991 query.where = queryParams.where;
18992 }
18993 }
18994
18995 if (!query.where) {
18996 var error = new Error('options.query is not an AV.Query');
18997 throw error;
18998 }
18999 }
19000
19001 _.extend(json, model._flags);
19002
19003 var route = 'classes';
19004 var className = model.className;
19005
19006 if (model.className === '_User' && !model.id) {
19007 // Special-case user sign-up.
19008 route = 'users';
19009 className = null;
19010 } //hook makeRequest in options.
19011
19012
19013 var makeRequest = options._makeRequest || _request;
19014 var requestPromise = makeRequest(route, className, model.id, method, json, options, query);
19015 requestPromise = requestPromise.then(function (resp) {
19016 var serverAttrs = model.parse(resp);
19017
19018 if (options.wait) {
19019 serverAttrs = _.extend(attrs || {}, serverAttrs);
19020 }
19021
19022 model._finishSave(serverAttrs);
19023
19024 if (options.wait) {
19025 model.set(current, setOptions);
19026 }
19027
19028 return model;
19029 }, function (error) {
19030 model._cancelSave();
19031
19032 throw error;
19033 });
19034 return requestPromise;
19035 });
19036 return this._allPreviousSaves;
19037 },
19038
19039 /**
19040 * Destroy this model on the server if it was already persisted.
19041 * Optimistically removes the model from its collection, if it has one.
19042 * @param {AuthOptions} options AuthOptions plus:
19043 * @param {Boolean} [options.wait] wait for the server to respond
19044 * before removal.
19045 *
19046 * @return {Promise} A promise that is fulfilled when the destroy
19047 * completes.
19048 */
19049 destroy: function destroy(options) {
19050 options = options || {};
19051 var model = this;
19052
19053 var triggerDestroy = function triggerDestroy() {
19054 model.trigger('destroy', model, model.collection, options);
19055 };
19056
19057 if (!this.id) {
19058 return triggerDestroy();
19059 }
19060
19061 if (!options.wait) {
19062 triggerDestroy();
19063 }
19064
19065 var request = _request('classes', this.className, this.id, 'DELETE', this._flags, options);
19066
19067 return request.then(function () {
19068 if (options.wait) {
19069 triggerDestroy();
19070 }
19071
19072 return model;
19073 });
19074 },
19075
19076 /**
19077 * Converts a response into the hash of attributes to be set on the model.
19078 * @ignore
19079 */
19080 parse: function parse(resp) {
19081 var output = _.clone(resp);
19082
19083 ['createdAt', 'updatedAt'].forEach(function (key) {
19084 if (output[key]) {
19085 output[key] = AV._parseDate(output[key]);
19086 }
19087 });
19088
19089 if (output.createdAt && !output.updatedAt) {
19090 output.updatedAt = output.createdAt;
19091 }
19092
19093 return output;
19094 },
19095
19096 /**
19097 * Creates a new model with identical attributes to this one.
19098 * @return {AV.Object}
19099 */
19100 clone: function clone() {
19101 return new this.constructor(this.attributes);
19102 },
19103
19104 /**
19105 * Returns true if this object has never been saved to AV.
19106 * @return {Boolean}
19107 */
19108 isNew: function isNew() {
19109 return !this.id;
19110 },
19111
19112 /**
19113 * Call this method to manually fire a `"change"` event for this model and
19114 * a `"change:attribute"` event for each changed attribute.
19115 * Calling this will cause all objects observing the model to update.
19116 */
19117 change: function change(options) {
19118 options = options || {};
19119 var changing = this._changing;
19120 this._changing = true; // Silent changes become pending changes.
19121
19122 var self = this;
19123
19124 AV._objectEach(this._silent, function (attr) {
19125 self._pending[attr] = true;
19126 }); // Silent changes are triggered.
19127
19128
19129 var changes = _.extend({}, options.changes, this._silent);
19130
19131 this._silent = {};
19132
19133 AV._objectEach(changes, function (unused_value, attr) {
19134 self.trigger('change:' + attr, self, self.get(attr), options);
19135 });
19136
19137 if (changing) {
19138 return this;
19139 } // This is to get around lint not letting us make a function in a loop.
19140
19141
19142 var deleteChanged = function deleteChanged(value, attr) {
19143 if (!self._pending[attr] && !self._silent[attr]) {
19144 delete self.changed[attr];
19145 }
19146 }; // Continue firing `"change"` events while there are pending changes.
19147
19148
19149 while (!_.isEmpty(this._pending)) {
19150 this._pending = {};
19151 this.trigger('change', this, options); // Pending and silent changes still remain.
19152
19153 AV._objectEach(this.changed, deleteChanged);
19154
19155 self._previousAttributes = _.clone(this.attributes);
19156 }
19157
19158 this._changing = false;
19159 return this;
19160 },
19161
19162 /**
19163 * Gets the previous value of an attribute, recorded at the time the last
19164 * <code>"change"</code> event was fired.
19165 * @param {String} attr Name of the attribute to get.
19166 */
19167 previous: function previous(attr) {
19168 if (!arguments.length || !this._previousAttributes) {
19169 return null;
19170 }
19171
19172 return this._previousAttributes[attr];
19173 },
19174
19175 /**
19176 * Gets all of the attributes of the model at the time of the previous
19177 * <code>"change"</code> event.
19178 * @return {Object}
19179 */
19180 previousAttributes: function previousAttributes() {
19181 return _.clone(this._previousAttributes);
19182 },
19183
19184 /**
19185 * Checks if the model is currently in a valid state. It's only possible to
19186 * get into an *invalid* state if you're using silent changes.
19187 * @return {Boolean}
19188 */
19189 isValid: function isValid() {
19190 try {
19191 this.validate(this.attributes);
19192 } catch (error) {
19193 return false;
19194 }
19195
19196 return true;
19197 },
19198
19199 /**
19200 * You should not call this function directly unless you subclass
19201 * <code>AV.Object</code>, in which case you can override this method
19202 * to provide additional validation on <code>set</code> and
19203 * <code>save</code>. Your implementation should throw an Error if
19204 * the attrs is invalid
19205 *
19206 * @param {Object} attrs The current data to validate.
19207 * @see AV.Object#set
19208 */
19209 validate: function validate(attrs) {
19210 if (_.has(attrs, 'ACL') && !(attrs.ACL instanceof AV.ACL)) {
19211 throw new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
19212 }
19213 },
19214
19215 /**
19216 * Run validation against a set of incoming attributes, returning `true`
19217 * if all is well. If a specific `error` callback has been passed,
19218 * call that instead of firing the general `"error"` event.
19219 * @private
19220 */
19221 _validate: function _validate(attrs, options) {
19222 if (options.silent || !this.validate) {
19223 return;
19224 }
19225
19226 attrs = _.extend({}, this.attributes, attrs);
19227 this.validate(attrs);
19228 },
19229
19230 /**
19231 * Returns the ACL for this object.
19232 * @returns {AV.ACL} An instance of AV.ACL.
19233 * @see AV.Object#get
19234 */
19235 getACL: function getACL() {
19236 return this.get('ACL');
19237 },
19238
19239 /**
19240 * Sets the ACL to be used for this object.
19241 * @param {AV.ACL} acl An instance of AV.ACL.
19242 * @param {Object} options Optional Backbone-like options object to be
19243 * passed in to set.
19244 * @return {AV.Object} self
19245 * @see AV.Object#set
19246 */
19247 setACL: function setACL(acl, options) {
19248 return this.set('ACL', acl, options);
19249 },
19250 disableBeforeHook: function disableBeforeHook() {
19251 this.ignoreHook('beforeSave');
19252 this.ignoreHook('beforeUpdate');
19253 this.ignoreHook('beforeDelete');
19254 },
19255 disableAfterHook: function disableAfterHook() {
19256 this.ignoreHook('afterSave');
19257 this.ignoreHook('afterUpdate');
19258 this.ignoreHook('afterDelete');
19259 },
19260 ignoreHook: function ignoreHook(hookName) {
19261 if (!_.contains(['beforeSave', 'afterSave', 'beforeUpdate', 'afterUpdate', 'beforeDelete', 'afterDelete'], hookName)) {
19262 throw new Error('Unsupported hookName: ' + hookName);
19263 }
19264
19265 if (!AV.hookKey) {
19266 throw new Error('ignoreHook required hookKey');
19267 }
19268
19269 if (!this._flags.__ignore_hooks) {
19270 this._flags.__ignore_hooks = [];
19271 }
19272
19273 this._flags.__ignore_hooks.push(hookName);
19274 }
19275 });
19276 /**
19277 * Creates an instance of a subclass of AV.Object for the give classname
19278 * and id.
19279 * @param {String|Function} class the className or a subclass of AV.Object.
19280 * @param {String} id The object id of this model.
19281 * @return {AV.Object} A new subclass instance of AV.Object.
19282 */
19283
19284
19285 AV.Object.createWithoutData = function (klass, id, hasData) {
19286 var _klass;
19287
19288 if (_.isString(klass)) {
19289 _klass = AV.Object._getSubclass(klass);
19290 } else if (klass.prototype && klass.prototype instanceof AV.Object) {
19291 _klass = klass;
19292 } else {
19293 throw new Error('class must be a string or a subclass of AV.Object.');
19294 }
19295
19296 if (!id) {
19297 throw new TypeError('The objectId must be provided');
19298 }
19299
19300 var object = new _klass();
19301 object.id = id;
19302 object._hasData = hasData;
19303 return object;
19304 };
19305 /**
19306 * Delete objects in batch.
19307 * @param {AV.Object[]} objects The <code>AV.Object</code> array to be deleted.
19308 * @param {AuthOptions} options
19309 * @return {Promise} A promise that is fulfilled when the save
19310 * completes.
19311 */
19312
19313
19314 AV.Object.destroyAll = function (objects) {
19315 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19316
19317 if (!objects || objects.length === 0) {
19318 return _promise.default.resolve();
19319 }
19320
19321 var objectsByClassNameAndFlags = _.groupBy(objects, function (object) {
19322 return (0, _stringify.default)({
19323 className: object.className,
19324 flags: object._flags
19325 });
19326 });
19327
19328 var body = {
19329 requests: (0, _map.default)(_).call(_, objectsByClassNameAndFlags, function (objects) {
19330 var _context3;
19331
19332 var ids = (0, _map.default)(_).call(_, objects, 'id').join(',');
19333 return {
19334 method: 'DELETE',
19335 path: (0, _concat.default)(_context3 = "/1.1/classes/".concat(objects[0].className, "/")).call(_context3, ids),
19336 body: objects[0]._flags
19337 };
19338 })
19339 };
19340 return _request('batch', null, null, 'POST', body, options).then(function (response) {
19341 var firstError = (0, _find.default)(_).call(_, response, function (result) {
19342 return !result.success;
19343 });
19344 if (firstError) throw new AVError(firstError.error.code, firstError.error.error);
19345 return undefined;
19346 });
19347 };
19348 /**
19349 * Returns the appropriate subclass for making new instances of the given
19350 * className string.
19351 * @private
19352 */
19353
19354
19355 AV.Object._getSubclass = function (className) {
19356 if (!_.isString(className)) {
19357 throw new Error('AV.Object._getSubclass requires a string argument.');
19358 }
19359
19360 var ObjectClass = AV.Object._classMap[className];
19361
19362 if (!ObjectClass) {
19363 ObjectClass = AV.Object.extend(className);
19364 AV.Object._classMap[className] = ObjectClass;
19365 }
19366
19367 return ObjectClass;
19368 };
19369 /**
19370 * Creates an instance of a subclass of AV.Object for the given classname.
19371 * @private
19372 */
19373
19374
19375 AV.Object._create = function (className, attributes, options) {
19376 var ObjectClass = AV.Object._getSubclass(className);
19377
19378 return new ObjectClass(attributes, options);
19379 }; // Set up a map of className to class so that we can create new instances of
19380 // AV Objects from JSON automatically.
19381
19382
19383 AV.Object._classMap = {};
19384 AV.Object._extend = AV._extend;
19385 /**
19386 * Creates a new model with defined attributes,
19387 * It's the same with
19388 * <pre>
19389 * new AV.Object(attributes, options);
19390 * </pre>
19391 * @param {Object} attributes The initial set of data to store in the object.
19392 * @param {Object} options A set of Backbone-like options for creating the
19393 * object. The only option currently supported is "collection".
19394 * @return {AV.Object}
19395 * @since v0.4.4
19396 * @see AV.Object
19397 * @see AV.Object.extend
19398 */
19399
19400 AV.Object['new'] = function (attributes, options) {
19401 return new AV.Object(attributes, options);
19402 };
19403 /**
19404 * Creates a new subclass of AV.Object for the given AV class name.
19405 *
19406 * <p>Every extension of a AV class will inherit from the most recent
19407 * previous extension of that class. When a AV.Object is automatically
19408 * created by parsing JSON, it will use the most recent extension of that
19409 * class.</p>
19410 *
19411 * @example
19412 * var MyClass = AV.Object.extend("MyClass", {
19413 * // Instance properties
19414 * }, {
19415 * // Class properties
19416 * });
19417 *
19418 * @param {String} className The name of the AV class backing this model.
19419 * @param {Object} protoProps Instance properties to add to instances of the
19420 * class returned from this method.
19421 * @param {Object} classProps Class properties to add the class returned from
19422 * this method.
19423 * @return {Class} A new subclass of AV.Object.
19424 */
19425
19426
19427 AV.Object.extend = function (className, protoProps, classProps) {
19428 // Handle the case with only two args.
19429 if (!_.isString(className)) {
19430 if (className && _.has(className, 'className')) {
19431 return AV.Object.extend(className.className, className, protoProps);
19432 } else {
19433 throw new Error("AV.Object.extend's first argument should be the className.");
19434 }
19435 } // If someone tries to subclass "User", coerce it to the right type.
19436
19437
19438 if (className === 'User') {
19439 className = '_User';
19440 }
19441
19442 var NewClassObject = null;
19443
19444 if (_.has(AV.Object._classMap, className)) {
19445 var OldClassObject = AV.Object._classMap[className]; // This new subclass has been told to extend both from "this" and from
19446 // OldClassObject. This is multiple inheritance, which isn't supported.
19447 // For now, let's just pick one.
19448
19449 if (protoProps || classProps) {
19450 NewClassObject = OldClassObject._extend(protoProps, classProps);
19451 } else {
19452 return OldClassObject;
19453 }
19454 } else {
19455 protoProps = protoProps || {};
19456 protoProps._className = className;
19457 NewClassObject = this._extend(protoProps, classProps);
19458 } // Extending a subclass should reuse the classname automatically.
19459
19460
19461 NewClassObject.extend = function (arg0) {
19462 var _context4;
19463
19464 if (_.isString(arg0) || arg0 && _.has(arg0, 'className')) {
19465 return AV.Object.extend.apply(NewClassObject, arguments);
19466 }
19467
19468 var newArguments = (0, _concat.default)(_context4 = [className]).call(_context4, _.toArray(arguments));
19469 return AV.Object.extend.apply(NewClassObject, newArguments);
19470 }; // Add the query property descriptor.
19471
19472
19473 (0, _defineProperty.default)(NewClassObject, 'query', (0, _getOwnPropertyDescriptor.default)(AV.Object, 'query'));
19474
19475 NewClassObject['new'] = function (attributes, options) {
19476 return new NewClassObject(attributes, options);
19477 };
19478
19479 AV.Object._classMap[className] = NewClassObject;
19480 return NewClassObject;
19481 }; // ES6 class syntax support
19482
19483
19484 (0, _defineProperty.default)(AV.Object.prototype, 'className', {
19485 get: function get() {
19486 var className = this._className || this.constructor._LCClassName || this.constructor.name; // If someone tries to subclass "User", coerce it to the right type.
19487
19488 if (className === 'User') {
19489 return '_User';
19490 }
19491
19492 return className;
19493 }
19494 });
19495 /**
19496 * Register a class.
19497 * If a subclass of <code>AV.Object</code> is defined with your own implement
19498 * rather then <code>AV.Object.extend</code>, the subclass must be registered.
19499 * @param {Function} klass A subclass of <code>AV.Object</code>
19500 * @param {String} [name] Specify the name of the class. Useful when the class might be uglified.
19501 * @example
19502 * class Person extend AV.Object {}
19503 * AV.Object.register(Person);
19504 */
19505
19506 AV.Object.register = function (klass, name) {
19507 if (!(klass.prototype instanceof AV.Object)) {
19508 throw new Error('registered class is not a subclass of AV.Object');
19509 }
19510
19511 var className = name || klass.name;
19512
19513 if (!className.length) {
19514 throw new Error('registered class must be named');
19515 }
19516
19517 if (name) {
19518 klass._LCClassName = name;
19519 }
19520
19521 AV.Object._classMap[className] = klass;
19522 };
19523 /**
19524 * Get a new Query of the current class
19525 * @name query
19526 * @memberof AV.Object
19527 * @type AV.Query
19528 * @readonly
19529 * @since v3.1.0
19530 * @example
19531 * const Post = AV.Object.extend('Post');
19532 * Post.query.equalTo('author', 'leancloud').find().then();
19533 */
19534
19535
19536 (0, _defineProperty.default)(AV.Object, 'query', {
19537 get: function get() {
19538 return new AV.Query(this.prototype.className);
19539 }
19540 });
19541
19542 AV.Object._findUnsavedChildren = function (objects, children, files) {
19543 AV._traverse(objects, function (object) {
19544 if (object instanceof AV.Object) {
19545 if (object.dirty()) {
19546 children.push(object);
19547 }
19548
19549 return;
19550 }
19551
19552 if (object instanceof AV.File) {
19553 if (!object.id) {
19554 files.push(object);
19555 }
19556
19557 return;
19558 }
19559 });
19560 };
19561
19562 AV.Object._canBeSerializedAsValue = function (object) {
19563 var canBeSerializedAsValue = true;
19564
19565 if (object instanceof AV.Object || object instanceof AV.File) {
19566 canBeSerializedAsValue = !!object.id;
19567 } else if (_.isArray(object)) {
19568 AV._arrayEach(object, function (child) {
19569 if (!AV.Object._canBeSerializedAsValue(child)) {
19570 canBeSerializedAsValue = false;
19571 }
19572 });
19573 } else if (_.isObject(object)) {
19574 AV._objectEach(object, function (child) {
19575 if (!AV.Object._canBeSerializedAsValue(child)) {
19576 canBeSerializedAsValue = false;
19577 }
19578 });
19579 }
19580
19581 return canBeSerializedAsValue;
19582 };
19583
19584 AV.Object._deepSaveAsync = function (object, model, options) {
19585 var unsavedChildren = [];
19586 var unsavedFiles = [];
19587
19588 AV.Object._findUnsavedChildren(object, unsavedChildren, unsavedFiles);
19589
19590 unsavedFiles = _.uniq(unsavedFiles);
19591
19592 var promise = _promise.default.resolve();
19593
19594 _.each(unsavedFiles, function (file) {
19595 promise = promise.then(function () {
19596 return file.save();
19597 });
19598 });
19599
19600 var objects = _.uniq(unsavedChildren);
19601
19602 var remaining = _.uniq(objects);
19603
19604 return promise.then(function () {
19605 return continueWhile(function () {
19606 return remaining.length > 0;
19607 }, function () {
19608 // Gather up all the objects that can be saved in this batch.
19609 var batch = [];
19610 var newRemaining = [];
19611
19612 AV._arrayEach(remaining, function (object) {
19613 if (object._canBeSerialized()) {
19614 batch.push(object);
19615 } else {
19616 newRemaining.push(object);
19617 }
19618 });
19619
19620 remaining = newRemaining; // If we can't save any objects, there must be a circular reference.
19621
19622 if (batch.length === 0) {
19623 return _promise.default.reject(new AVError(AVError.OTHER_CAUSE, 'Tried to save a batch with a cycle.'));
19624 } // Reserve a spot in every object's save queue.
19625
19626
19627 var readyToStart = _promise.default.resolve((0, _map.default)(_).call(_, batch, function (object) {
19628 return object._allPreviousSaves || _promise.default.resolve();
19629 })); // Save a single batch, whether previous saves succeeded or failed.
19630
19631
19632 var bathSavePromise = readyToStart.then(function () {
19633 return _request('batch', null, null, 'POST', {
19634 requests: (0, _map.default)(_).call(_, batch, function (object) {
19635 var method = object.id ? 'PUT' : 'POST';
19636
19637 var json = object._getSaveJSON();
19638
19639 _.extend(json, object._flags);
19640
19641 var route = 'classes';
19642 var className = object.className;
19643 var path = "/".concat(route, "/").concat(className);
19644
19645 if (object.className === '_User' && !object.id) {
19646 // Special-case user sign-up.
19647 path = '/users';
19648 }
19649
19650 var path = "/1.1".concat(path);
19651
19652 if (object.id) {
19653 path = path + '/' + object.id;
19654 }
19655
19656 object._startSave();
19657
19658 return {
19659 method: method,
19660 path: path,
19661 body: json,
19662 params: options && options.fetchWhenSave ? {
19663 fetchWhenSave: true
19664 } : undefined
19665 };
19666 })
19667 }, options).then(function (response) {
19668 var results = (0, _map.default)(_).call(_, batch, function (object, i) {
19669 if (response[i].success) {
19670 object._finishSave(object.parse(response[i].success));
19671
19672 return object;
19673 }
19674
19675 object._cancelSave();
19676
19677 return new AVError(response[i].error.code, response[i].error.error);
19678 });
19679 return handleBatchResults(results);
19680 });
19681 });
19682
19683 AV._arrayEach(batch, function (object) {
19684 object._allPreviousSaves = bathSavePromise;
19685 });
19686
19687 return bathSavePromise;
19688 });
19689 }).then(function () {
19690 return object;
19691 });
19692 };
19693};
19694
19695/***/ }),
19696/* 531 */
19697/***/ (function(module, exports, __webpack_require__) {
19698
19699var arrayWithHoles = __webpack_require__(532);
19700
19701var iterableToArrayLimit = __webpack_require__(540);
19702
19703var unsupportedIterableToArray = __webpack_require__(541);
19704
19705var nonIterableRest = __webpack_require__(551);
19706
19707function _slicedToArray(arr, i) {
19708 return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
19709}
19710
19711module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
19712
19713/***/ }),
19714/* 532 */
19715/***/ (function(module, exports, __webpack_require__) {
19716
19717var _Array$isArray = __webpack_require__(533);
19718
19719function _arrayWithHoles(arr) {
19720 if (_Array$isArray(arr)) return arr;
19721}
19722
19723module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
19724
19725/***/ }),
19726/* 533 */
19727/***/ (function(module, exports, __webpack_require__) {
19728
19729module.exports = __webpack_require__(534);
19730
19731/***/ }),
19732/* 534 */
19733/***/ (function(module, exports, __webpack_require__) {
19734
19735module.exports = __webpack_require__(535);
19736
19737
19738/***/ }),
19739/* 535 */
19740/***/ (function(module, exports, __webpack_require__) {
19741
19742var parent = __webpack_require__(536);
19743
19744module.exports = parent;
19745
19746
19747/***/ }),
19748/* 536 */
19749/***/ (function(module, exports, __webpack_require__) {
19750
19751var parent = __webpack_require__(537);
19752
19753module.exports = parent;
19754
19755
19756/***/ }),
19757/* 537 */
19758/***/ (function(module, exports, __webpack_require__) {
19759
19760var parent = __webpack_require__(538);
19761
19762module.exports = parent;
19763
19764
19765/***/ }),
19766/* 538 */
19767/***/ (function(module, exports, __webpack_require__) {
19768
19769__webpack_require__(539);
19770var path = __webpack_require__(5);
19771
19772module.exports = path.Array.isArray;
19773
19774
19775/***/ }),
19776/* 539 */
19777/***/ (function(module, exports, __webpack_require__) {
19778
19779var $ = __webpack_require__(0);
19780var isArray = __webpack_require__(90);
19781
19782// `Array.isArray` method
19783// https://tc39.es/ecma262/#sec-array.isarray
19784$({ target: 'Array', stat: true }, {
19785 isArray: isArray
19786});
19787
19788
19789/***/ }),
19790/* 540 */
19791/***/ (function(module, exports, __webpack_require__) {
19792
19793var _Symbol = __webpack_require__(242);
19794
19795var _getIteratorMethod = __webpack_require__(254);
19796
19797function _iterableToArrayLimit(arr, i) {
19798 var _i = arr == null ? null : typeof _Symbol !== "undefined" && _getIteratorMethod(arr) || arr["@@iterator"];
19799
19800 if (_i == null) return;
19801 var _arr = [];
19802 var _n = true;
19803 var _d = false;
19804
19805 var _s, _e;
19806
19807 try {
19808 for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
19809 _arr.push(_s.value);
19810
19811 if (i && _arr.length === i) break;
19812 }
19813 } catch (err) {
19814 _d = true;
19815 _e = err;
19816 } finally {
19817 try {
19818 if (!_n && _i["return"] != null) _i["return"]();
19819 } finally {
19820 if (_d) throw _e;
19821 }
19822 }
19823
19824 return _arr;
19825}
19826
19827module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
19828
19829/***/ }),
19830/* 541 */
19831/***/ (function(module, exports, __webpack_require__) {
19832
19833var _sliceInstanceProperty = __webpack_require__(542);
19834
19835var _Array$from = __webpack_require__(546);
19836
19837var arrayLikeToArray = __webpack_require__(550);
19838
19839function _unsupportedIterableToArray(o, minLen) {
19840 var _context;
19841
19842 if (!o) return;
19843 if (typeof o === "string") return arrayLikeToArray(o, minLen);
19844
19845 var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 8, -1);
19846
19847 if (n === "Object" && o.constructor) n = o.constructor.name;
19848 if (n === "Map" || n === "Set") return _Array$from(o);
19849 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
19850}
19851
19852module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
19853
19854/***/ }),
19855/* 542 */
19856/***/ (function(module, exports, __webpack_require__) {
19857
19858module.exports = __webpack_require__(543);
19859
19860/***/ }),
19861/* 543 */
19862/***/ (function(module, exports, __webpack_require__) {
19863
19864module.exports = __webpack_require__(544);
19865
19866
19867/***/ }),
19868/* 544 */
19869/***/ (function(module, exports, __webpack_require__) {
19870
19871var parent = __webpack_require__(545);
19872
19873module.exports = parent;
19874
19875
19876/***/ }),
19877/* 545 */
19878/***/ (function(module, exports, __webpack_require__) {
19879
19880var parent = __webpack_require__(240);
19881
19882module.exports = parent;
19883
19884
19885/***/ }),
19886/* 546 */
19887/***/ (function(module, exports, __webpack_require__) {
19888
19889module.exports = __webpack_require__(547);
19890
19891/***/ }),
19892/* 547 */
19893/***/ (function(module, exports, __webpack_require__) {
19894
19895module.exports = __webpack_require__(548);
19896
19897
19898/***/ }),
19899/* 548 */
19900/***/ (function(module, exports, __webpack_require__) {
19901
19902var parent = __webpack_require__(549);
19903
19904module.exports = parent;
19905
19906
19907/***/ }),
19908/* 549 */
19909/***/ (function(module, exports, __webpack_require__) {
19910
19911var parent = __webpack_require__(253);
19912
19913module.exports = parent;
19914
19915
19916/***/ }),
19917/* 550 */
19918/***/ (function(module, exports) {
19919
19920function _arrayLikeToArray(arr, len) {
19921 if (len == null || len > arr.length) len = arr.length;
19922
19923 for (var i = 0, arr2 = new Array(len); i < len; i++) {
19924 arr2[i] = arr[i];
19925 }
19926
19927 return arr2;
19928}
19929
19930module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
19931
19932/***/ }),
19933/* 551 */
19934/***/ (function(module, exports) {
19935
19936function _nonIterableRest() {
19937 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
19938}
19939
19940module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
19941
19942/***/ }),
19943/* 552 */
19944/***/ (function(module, exports, __webpack_require__) {
19945
19946var parent = __webpack_require__(553);
19947
19948module.exports = parent;
19949
19950
19951/***/ }),
19952/* 553 */
19953/***/ (function(module, exports, __webpack_require__) {
19954
19955__webpack_require__(554);
19956var path = __webpack_require__(5);
19957
19958var Object = path.Object;
19959
19960var getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) {
19961 return Object.getOwnPropertyDescriptor(it, key);
19962};
19963
19964if (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true;
19965
19966
19967/***/ }),
19968/* 554 */
19969/***/ (function(module, exports, __webpack_require__) {
19970
19971var $ = __webpack_require__(0);
19972var fails = __webpack_require__(2);
19973var toIndexedObject = __webpack_require__(32);
19974var nativeGetOwnPropertyDescriptor = __webpack_require__(62).f;
19975var DESCRIPTORS = __webpack_require__(14);
19976
19977var FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); });
19978var FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES;
19979
19980// `Object.getOwnPropertyDescriptor` method
19981// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
19982$({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, {
19983 getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
19984 return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key);
19985 }
19986});
19987
19988
19989/***/ }),
19990/* 555 */
19991/***/ (function(module, exports, __webpack_require__) {
19992
19993"use strict";
19994
19995
19996var _ = __webpack_require__(3);
19997
19998var AVError = __webpack_require__(46);
19999
20000module.exports = function (AV) {
20001 AV.Role = AV.Object.extend('_Role',
20002 /** @lends AV.Role.prototype */
20003 {
20004 // Instance Methods
20005
20006 /**
20007 * Represents a Role on the AV server. Roles represent groupings of
20008 * Users for the purposes of granting permissions (e.g. specifying an ACL
20009 * for an Object). Roles are specified by their sets of child users and
20010 * child roles, all of which are granted any permissions that the parent
20011 * role has.
20012 *
20013 * <p>Roles must have a name (which cannot be changed after creation of the
20014 * role), and must specify an ACL.</p>
20015 * An AV.Role is a local representation of a role persisted to the AV
20016 * cloud.
20017 * @class AV.Role
20018 * @param {String} name The name of the Role to create.
20019 * @param {AV.ACL} acl The ACL for this role.
20020 */
20021 constructor: function constructor(name, acl) {
20022 if (_.isString(name)) {
20023 AV.Object.prototype.constructor.call(this, null, null);
20024 this.setName(name);
20025 } else {
20026 AV.Object.prototype.constructor.call(this, name, acl);
20027 }
20028
20029 if (acl) {
20030 if (!(acl instanceof AV.ACL)) {
20031 throw new TypeError('acl must be an instance of AV.ACL');
20032 } else {
20033 this.setACL(acl);
20034 }
20035 }
20036 },
20037
20038 /**
20039 * Gets the name of the role. You can alternatively call role.get("name")
20040 *
20041 * @return {String} the name of the role.
20042 */
20043 getName: function getName() {
20044 return this.get('name');
20045 },
20046
20047 /**
20048 * Sets the name for a role. This value must be set before the role has
20049 * been saved to the server, and cannot be set once the role has been
20050 * saved.
20051 *
20052 * <p>
20053 * A role's name can only contain alphanumeric characters, _, -, and
20054 * spaces.
20055 * </p>
20056 *
20057 * <p>This is equivalent to calling role.set("name", name)</p>
20058 *
20059 * @param {String} name The name of the role.
20060 */
20061 setName: function setName(name, options) {
20062 return this.set('name', name, options);
20063 },
20064
20065 /**
20066 * Gets the AV.Relation for the AV.Users that are direct
20067 * children of this role. These users are granted any privileges that this
20068 * role has been granted (e.g. read or write access through ACLs). You can
20069 * add or remove users from the role through this relation.
20070 *
20071 * <p>This is equivalent to calling role.relation("users")</p>
20072 *
20073 * @return {AV.Relation} the relation for the users belonging to this
20074 * role.
20075 */
20076 getUsers: function getUsers() {
20077 return this.relation('users');
20078 },
20079
20080 /**
20081 * Gets the AV.Relation for the AV.Roles that are direct
20082 * children of this role. These roles' users are granted any privileges that
20083 * this role has been granted (e.g. read or write access through ACLs). You
20084 * can add or remove child roles from this role through this relation.
20085 *
20086 * <p>This is equivalent to calling role.relation("roles")</p>
20087 *
20088 * @return {AV.Relation} the relation for the roles belonging to this
20089 * role.
20090 */
20091 getRoles: function getRoles() {
20092 return this.relation('roles');
20093 },
20094
20095 /**
20096 * @ignore
20097 */
20098 validate: function validate(attrs, options) {
20099 if ('name' in attrs && attrs.name !== this.getName()) {
20100 var newName = attrs.name;
20101
20102 if (this.id && this.id !== attrs.objectId) {
20103 // Check to see if the objectId being set matches this.id.
20104 // This happens during a fetch -- the id is set before calling fetch.
20105 // Let the name be set in this case.
20106 return new AVError(AVError.OTHER_CAUSE, "A role's name can only be set before it has been saved.");
20107 }
20108
20109 if (!_.isString(newName)) {
20110 return new AVError(AVError.OTHER_CAUSE, "A role's name must be a String.");
20111 }
20112
20113 if (!/^[0-9a-zA-Z\-_ ]+$/.test(newName)) {
20114 return new AVError(AVError.OTHER_CAUSE, "A role's name can only contain alphanumeric characters, _," + ' -, and spaces.');
20115 }
20116 }
20117
20118 if (AV.Object.prototype.validate) {
20119 return AV.Object.prototype.validate.call(this, attrs, options);
20120 }
20121
20122 return false;
20123 }
20124 });
20125};
20126
20127/***/ }),
20128/* 556 */
20129/***/ (function(module, exports, __webpack_require__) {
20130
20131"use strict";
20132
20133
20134var _interopRequireDefault = __webpack_require__(1);
20135
20136var _defineProperty2 = _interopRequireDefault(__webpack_require__(557));
20137
20138var _promise = _interopRequireDefault(__webpack_require__(12));
20139
20140var _map = _interopRequireDefault(__webpack_require__(35));
20141
20142var _find = _interopRequireDefault(__webpack_require__(93));
20143
20144var _stringify = _interopRequireDefault(__webpack_require__(36));
20145
20146var _ = __webpack_require__(3);
20147
20148var uuid = __webpack_require__(232);
20149
20150var AVError = __webpack_require__(46);
20151
20152var _require = __webpack_require__(27),
20153 AVRequest = _require._request,
20154 request = _require.request;
20155
20156var _require2 = __webpack_require__(72),
20157 getAdapter = _require2.getAdapter;
20158
20159var PLATFORM_ANONYMOUS = 'anonymous';
20160var PLATFORM_QQAPP = 'lc_qqapp';
20161
20162var mergeUnionDataIntoAuthData = function mergeUnionDataIntoAuthData() {
20163 var defaultUnionIdPlatform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'weixin';
20164 return function (authData, unionId) {
20165 var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
20166 _ref$unionIdPlatform = _ref.unionIdPlatform,
20167 unionIdPlatform = _ref$unionIdPlatform === void 0 ? defaultUnionIdPlatform : _ref$unionIdPlatform,
20168 _ref$asMainAccount = _ref.asMainAccount,
20169 asMainAccount = _ref$asMainAccount === void 0 ? false : _ref$asMainAccount;
20170
20171 if (typeof unionId !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionId is not a string');
20172 if (typeof unionIdPlatform !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionIdPlatform is not a string');
20173 return _.extend({}, authData, {
20174 platform: unionIdPlatform,
20175 unionid: unionId,
20176 main_account: Boolean(asMainAccount)
20177 });
20178 };
20179};
20180
20181module.exports = function (AV) {
20182 /**
20183 * @class
20184 *
20185 * <p>An AV.User object is a local representation of a user persisted to the
20186 * LeanCloud server. This class is a subclass of an AV.Object, and retains the
20187 * same functionality of an AV.Object, but also extends it with various
20188 * user specific methods, like authentication, signing up, and validation of
20189 * uniqueness.</p>
20190 */
20191 AV.User = AV.Object.extend('_User',
20192 /** @lends AV.User.prototype */
20193 {
20194 // Instance Variables
20195 _isCurrentUser: false,
20196 // Instance Methods
20197
20198 /**
20199 * Internal method to handle special fields in a _User response.
20200 * @private
20201 */
20202 _mergeMagicFields: function _mergeMagicFields(attrs) {
20203 if (attrs.sessionToken) {
20204 this._sessionToken = attrs.sessionToken;
20205 delete attrs.sessionToken;
20206 }
20207
20208 return AV.User.__super__._mergeMagicFields.call(this, attrs);
20209 },
20210
20211 /**
20212 * Removes null values from authData (which exist temporarily for
20213 * unlinking)
20214 * @private
20215 */
20216 _cleanupAuthData: function _cleanupAuthData() {
20217 if (!this.isCurrent()) {
20218 return;
20219 }
20220
20221 var authData = this.get('authData');
20222
20223 if (!authData) {
20224 return;
20225 }
20226
20227 AV._objectEach(this.get('authData'), function (value, key) {
20228 if (!authData[key]) {
20229 delete authData[key];
20230 }
20231 });
20232 },
20233
20234 /**
20235 * Synchronizes authData for all providers.
20236 * @private
20237 */
20238 _synchronizeAllAuthData: function _synchronizeAllAuthData() {
20239 var authData = this.get('authData');
20240
20241 if (!authData) {
20242 return;
20243 }
20244
20245 var self = this;
20246
20247 AV._objectEach(this.get('authData'), function (value, key) {
20248 self._synchronizeAuthData(key);
20249 });
20250 },
20251
20252 /**
20253 * Synchronizes auth data for a provider (e.g. puts the access token in the
20254 * right place to be used by the Facebook SDK).
20255 * @private
20256 */
20257 _synchronizeAuthData: function _synchronizeAuthData(provider) {
20258 if (!this.isCurrent()) {
20259 return;
20260 }
20261
20262 var authType;
20263
20264 if (_.isString(provider)) {
20265 authType = provider;
20266 provider = AV.User._authProviders[authType];
20267 } else {
20268 authType = provider.getAuthType();
20269 }
20270
20271 var authData = this.get('authData');
20272
20273 if (!authData || !provider) {
20274 return;
20275 }
20276
20277 var success = provider.restoreAuthentication(authData[authType]);
20278
20279 if (!success) {
20280 this.dissociateAuthData(provider);
20281 }
20282 },
20283 _handleSaveResult: function _handleSaveResult(makeCurrent) {
20284 // Clean up and synchronize the authData object, removing any unset values
20285 if (makeCurrent && !AV._config.disableCurrentUser) {
20286 this._isCurrentUser = true;
20287 }
20288
20289 this._cleanupAuthData();
20290
20291 this._synchronizeAllAuthData(); // Don't keep the password around.
20292
20293
20294 delete this._serverData.password;
20295
20296 this._rebuildEstimatedDataForKey('password');
20297
20298 this._refreshCache();
20299
20300 if ((makeCurrent || this.isCurrent()) && !AV._config.disableCurrentUser) {
20301 // Some old version of leanengine-node-sdk will overwrite
20302 // AV.User._saveCurrentUser which returns no Promise.
20303 // So we need a Promise wrapper.
20304 return _promise.default.resolve(AV.User._saveCurrentUser(this));
20305 } else {
20306 return _promise.default.resolve();
20307 }
20308 },
20309
20310 /**
20311 * Unlike in the Android/iOS SDKs, logInWith is unnecessary, since you can
20312 * call linkWith on the user (even if it doesn't exist yet on the server).
20313 * @private
20314 */
20315 _linkWith: function _linkWith(provider, data) {
20316 var _this = this;
20317
20318 var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
20319 _ref2$failOnNotExist = _ref2.failOnNotExist,
20320 failOnNotExist = _ref2$failOnNotExist === void 0 ? false : _ref2$failOnNotExist;
20321
20322 var authType;
20323
20324 if (_.isString(provider)) {
20325 authType = provider;
20326 provider = AV.User._authProviders[provider];
20327 } else {
20328 authType = provider.getAuthType();
20329 }
20330
20331 if (data) {
20332 return this.save({
20333 authData: (0, _defineProperty2.default)({}, authType, data)
20334 }, {
20335 fetchWhenSave: !!this.get('authData'),
20336 _failOnNotExist: failOnNotExist
20337 }).then(function (model) {
20338 return model._handleSaveResult(true).then(function () {
20339 return model;
20340 });
20341 });
20342 } else {
20343 return provider.authenticate().then(function (result) {
20344 return _this._linkWith(provider, result);
20345 });
20346 }
20347 },
20348
20349 /**
20350 * Associate the user with a third party authData.
20351 * @since 3.3.0
20352 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
20353 * @param {string} platform Available platform for sign up.
20354 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
20355 * @example user.associateWithAuthData({
20356 * openid: 'abc123',
20357 * access_token: '123abc',
20358 * expires_in: 1382686496
20359 * }, 'weixin').then(function(user) {
20360 * //Access user here
20361 * }).catch(function(error) {
20362 * //console.error("error: ", error);
20363 * });
20364 */
20365 associateWithAuthData: function associateWithAuthData(authData, platform) {
20366 return this._linkWith(platform, authData);
20367 },
20368
20369 /**
20370 * Associate the user with a third party authData and unionId.
20371 * @since 3.5.0
20372 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
20373 * @param {string} platform Available platform for sign up.
20374 * @param {string} unionId
20375 * @param {Object} [unionLoginOptions]
20376 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
20377 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
20378 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
20379 * @example user.associateWithAuthDataAndUnionId({
20380 * openid: 'abc123',
20381 * access_token: '123abc',
20382 * expires_in: 1382686496
20383 * }, 'weixin', 'union123', {
20384 * unionIdPlatform: 'weixin',
20385 * asMainAccount: true,
20386 * }).then(function(user) {
20387 * //Access user here
20388 * }).catch(function(error) {
20389 * //console.error("error: ", error);
20390 * });
20391 */
20392 associateWithAuthDataAndUnionId: function associateWithAuthDataAndUnionId(authData, platform, unionId, unionOptions) {
20393 return this._linkWith(platform, mergeUnionDataIntoAuthData()(authData, unionId, unionOptions));
20394 },
20395
20396 /**
20397 * Associate the user with the identity of the current mini-app.
20398 * @since 4.6.0
20399 * @param {Object} [authInfo]
20400 * @param {Object} [option]
20401 * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
20402 * @return {Promise<AV.User>}
20403 */
20404 associateWithMiniApp: function associateWithMiniApp(authInfo, option) {
20405 var _this2 = this;
20406
20407 if (authInfo === undefined) {
20408 var getAuthInfo = getAdapter('getAuthInfo');
20409 return getAuthInfo().then(function (authInfo) {
20410 return _this2._linkWith(authInfo.provider, authInfo.authData, option);
20411 });
20412 }
20413
20414 return this._linkWith(authInfo.provider, authInfo.authData, option);
20415 },
20416
20417 /**
20418 * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的微信帐号。
20419 * 仅在 QQ 小程序中可用。
20420 *
20421 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20422 * @since 4.2.0
20423 * @param {Object} [options]
20424 * @param {boolean} [options.preferUnionId = false] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
20425 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
20426 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20427 * @return {Promise<AV.User>}
20428 */
20429 associateWithQQApp: function associateWithQQApp() {
20430 var _this3 = this;
20431
20432 var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20433 _ref3$preferUnionId = _ref3.preferUnionId,
20434 preferUnionId = _ref3$preferUnionId === void 0 ? false : _ref3$preferUnionId,
20435 _ref3$unionIdPlatform = _ref3.unionIdPlatform,
20436 unionIdPlatform = _ref3$unionIdPlatform === void 0 ? 'qq' : _ref3$unionIdPlatform,
20437 _ref3$asMainAccount = _ref3.asMainAccount,
20438 asMainAccount = _ref3$asMainAccount === void 0 ? true : _ref3$asMainAccount;
20439
20440 var getAuthInfo = getAdapter('getAuthInfo');
20441 return getAuthInfo({
20442 preferUnionId: preferUnionId,
20443 asMainAccount: asMainAccount,
20444 platform: unionIdPlatform
20445 }).then(function (authInfo) {
20446 authInfo.provider = PLATFORM_QQAPP;
20447 return _this3.associateWithMiniApp(authInfo);
20448 });
20449 },
20450
20451 /**
20452 * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
20453 * 仅在微信小程序中可用。
20454 *
20455 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20456 * @since 3.13.0
20457 * @param {Object} [options]
20458 * @param {boolean} [options.preferUnionId = false] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否将 UnionId 保存在用户账号中。
20459 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
20460 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20461 * @return {Promise<AV.User>}
20462 */
20463 associateWithWeapp: function associateWithWeapp() {
20464 var _this4 = this;
20465
20466 var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20467 _ref4$preferUnionId = _ref4.preferUnionId,
20468 preferUnionId = _ref4$preferUnionId === void 0 ? false : _ref4$preferUnionId,
20469 _ref4$unionIdPlatform = _ref4.unionIdPlatform,
20470 unionIdPlatform = _ref4$unionIdPlatform === void 0 ? 'weixin' : _ref4$unionIdPlatform,
20471 _ref4$asMainAccount = _ref4.asMainAccount,
20472 asMainAccount = _ref4$asMainAccount === void 0 ? true : _ref4$asMainAccount;
20473
20474 var getAuthInfo = getAdapter('getAuthInfo');
20475 return getAuthInfo({
20476 preferUnionId: preferUnionId,
20477 asMainAccount: asMainAccount,
20478 platform: unionIdPlatform
20479 }).then(function (authInfo) {
20480 return _this4.associateWithMiniApp(authInfo);
20481 });
20482 },
20483
20484 /**
20485 * @deprecated renamed to {@link AV.User#associateWithWeapp}
20486 * @return {Promise<AV.User>}
20487 */
20488 linkWithWeapp: function linkWithWeapp(options) {
20489 console.warn('DEPRECATED: User#linkWithWeapp 已废弃,请使用 User#associateWithWeapp 代替');
20490 return this.associateWithWeapp(options);
20491 },
20492
20493 /**
20494 * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的 QQ 帐号。
20495 * 仅在 QQ 小程序中可用。
20496 *
20497 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20498 * @since 4.2.0
20499 * @param {string} unionId
20500 * @param {Object} [unionOptions]
20501 * @param {string} [unionOptions.unionIdPlatform = 'qq'] unionId platform
20502 * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
20503 * @return {Promise<AV.User>}
20504 */
20505 associateWithQQAppWithUnionId: function associateWithQQAppWithUnionId(unionId) {
20506 var _this5 = this;
20507
20508 var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20509 _ref5$unionIdPlatform = _ref5.unionIdPlatform,
20510 unionIdPlatform = _ref5$unionIdPlatform === void 0 ? 'qq' : _ref5$unionIdPlatform,
20511 _ref5$asMainAccount = _ref5.asMainAccount,
20512 asMainAccount = _ref5$asMainAccount === void 0 ? false : _ref5$asMainAccount;
20513
20514 var getAuthInfo = getAdapter('getAuthInfo');
20515 return getAuthInfo({
20516 platform: unionIdPlatform
20517 }).then(function (authInfo) {
20518 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20519 asMainAccount: asMainAccount
20520 });
20521 authInfo.provider = PLATFORM_QQAPP;
20522 return _this5.associateWithMiniApp(authInfo);
20523 });
20524 },
20525
20526 /**
20527 * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
20528 * 仅在微信小程序中可用。
20529 *
20530 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20531 * @since 3.13.0
20532 * @param {string} unionId
20533 * @param {Object} [unionOptions]
20534 * @param {string} [unionOptions.unionIdPlatform = 'weixin'] unionId platform
20535 * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
20536 * @return {Promise<AV.User>}
20537 */
20538 associateWithWeappWithUnionId: function associateWithWeappWithUnionId(unionId) {
20539 var _this6 = this;
20540
20541 var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20542 _ref6$unionIdPlatform = _ref6.unionIdPlatform,
20543 unionIdPlatform = _ref6$unionIdPlatform === void 0 ? 'weixin' : _ref6$unionIdPlatform,
20544 _ref6$asMainAccount = _ref6.asMainAccount,
20545 asMainAccount = _ref6$asMainAccount === void 0 ? false : _ref6$asMainAccount;
20546
20547 var getAuthInfo = getAdapter('getAuthInfo');
20548 return getAuthInfo({
20549 platform: unionIdPlatform
20550 }).then(function (authInfo) {
20551 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20552 asMainAccount: asMainAccount
20553 });
20554 return _this6.associateWithMiniApp(authInfo);
20555 });
20556 },
20557
20558 /**
20559 * Unlinks a user from a service.
20560 * @param {string} platform
20561 * @return {Promise<AV.User>}
20562 * @since 3.3.0
20563 */
20564 dissociateAuthData: function dissociateAuthData(provider) {
20565 this.unset("authData.".concat(provider));
20566 return this.save().then(function (model) {
20567 return model._handleSaveResult(true).then(function () {
20568 return model;
20569 });
20570 });
20571 },
20572
20573 /**
20574 * @private
20575 * @deprecated
20576 */
20577 _unlinkFrom: function _unlinkFrom(provider) {
20578 console.warn('DEPRECATED: User#_unlinkFrom 已废弃,请使用 User#dissociateAuthData 代替');
20579 return this.dissociateAuthData(provider);
20580 },
20581
20582 /**
20583 * Checks whether a user is linked to a service.
20584 * @private
20585 */
20586 _isLinked: function _isLinked(provider) {
20587 var authType;
20588
20589 if (_.isString(provider)) {
20590 authType = provider;
20591 } else {
20592 authType = provider.getAuthType();
20593 }
20594
20595 var authData = this.get('authData') || {};
20596 return !!authData[authType];
20597 },
20598
20599 /**
20600 * Checks whether a user is anonymous.
20601 * @since 3.9.0
20602 * @return {boolean}
20603 */
20604 isAnonymous: function isAnonymous() {
20605 return this._isLinked(PLATFORM_ANONYMOUS);
20606 },
20607 logOut: function logOut() {
20608 this._logOutWithAll();
20609
20610 this._isCurrentUser = false;
20611 },
20612
20613 /**
20614 * Deauthenticates all providers.
20615 * @private
20616 */
20617 _logOutWithAll: function _logOutWithAll() {
20618 var authData = this.get('authData');
20619
20620 if (!authData) {
20621 return;
20622 }
20623
20624 var self = this;
20625
20626 AV._objectEach(this.get('authData'), function (value, key) {
20627 self._logOutWith(key);
20628 });
20629 },
20630
20631 /**
20632 * Deauthenticates a single provider (e.g. removing access tokens from the
20633 * Facebook SDK).
20634 * @private
20635 */
20636 _logOutWith: function _logOutWith(provider) {
20637 if (!this.isCurrent()) {
20638 return;
20639 }
20640
20641 if (_.isString(provider)) {
20642 provider = AV.User._authProviders[provider];
20643 }
20644
20645 if (provider && provider.deauthenticate) {
20646 provider.deauthenticate();
20647 }
20648 },
20649
20650 /**
20651 * Signs up a new user. You should call this instead of save for
20652 * new AV.Users. This will create a new AV.User on the server, and
20653 * also persist the session on disk so that you can access the user using
20654 * <code>current</code>.
20655 *
20656 * <p>A username and password must be set before calling signUp.</p>
20657 *
20658 * @param {Object} attrs Extra fields to set on the new user, or null.
20659 * @param {AuthOptions} options
20660 * @return {Promise} A promise that is fulfilled when the signup
20661 * finishes.
20662 * @see AV.User.signUp
20663 */
20664 signUp: function signUp(attrs, options) {
20665 var error;
20666 var username = attrs && attrs.username || this.get('username');
20667
20668 if (!username || username === '') {
20669 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty name.');
20670 throw error;
20671 }
20672
20673 var password = attrs && attrs.password || this.get('password');
20674
20675 if (!password || password === '') {
20676 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty password.');
20677 throw error;
20678 }
20679
20680 return this.save(attrs, options).then(function (model) {
20681 if (model.isAnonymous()) {
20682 model.unset("authData.".concat(PLATFORM_ANONYMOUS));
20683 model._opSetQueue = [{}];
20684 }
20685
20686 return model._handleSaveResult(true).then(function () {
20687 return model;
20688 });
20689 });
20690 },
20691
20692 /**
20693 * Signs up a new user with mobile phone and sms code.
20694 * You should call this instead of save for
20695 * new AV.Users. This will create a new AV.User on the server, and
20696 * also persist the session on disk so that you can access the user using
20697 * <code>current</code>.
20698 *
20699 * <p>A username and password must be set before calling signUp.</p>
20700 *
20701 * @param {Object} attrs Extra fields to set on the new user, or null.
20702 * @param {AuthOptions} options
20703 * @return {Promise} A promise that is fulfilled when the signup
20704 * finishes.
20705 * @see AV.User.signUpOrlogInWithMobilePhone
20706 * @see AV.Cloud.requestSmsCode
20707 */
20708 signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(attrs) {
20709 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20710 var error;
20711 var mobilePhoneNumber = attrs && attrs.mobilePhoneNumber || this.get('mobilePhoneNumber');
20712
20713 if (!mobilePhoneNumber || mobilePhoneNumber === '') {
20714 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty mobilePhoneNumber.');
20715 throw error;
20716 }
20717
20718 var smsCode = attrs && attrs.smsCode || this.get('smsCode');
20719
20720 if (!smsCode || smsCode === '') {
20721 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty smsCode.');
20722 throw error;
20723 }
20724
20725 options._makeRequest = function (route, className, id, method, json) {
20726 return AVRequest('usersByMobilePhone', null, null, 'POST', json);
20727 };
20728
20729 return this.save(attrs, options).then(function (model) {
20730 delete model.attributes.smsCode;
20731 delete model._serverData.smsCode;
20732 return model._handleSaveResult(true).then(function () {
20733 return model;
20734 });
20735 });
20736 },
20737
20738 /**
20739 * The same with {@link AV.User.loginWithAuthData}, except that you can set attributes before login.
20740 * @since 3.7.0
20741 */
20742 loginWithAuthData: function loginWithAuthData(authData, platform, options) {
20743 return this._linkWith(platform, authData, options);
20744 },
20745
20746 /**
20747 * The same with {@link AV.User.loginWithAuthDataAndUnionId}, except that you can set attributes before login.
20748 * @since 3.7.0
20749 */
20750 loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
20751 return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
20752 },
20753
20754 /**
20755 * The same with {@link AV.User.loginWithWeapp}, except that you can set attributes before login.
20756 * @deprecated please use {@link AV.User#loginWithMiniApp}
20757 * @since 3.7.0
20758 * @param {Object} [options]
20759 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
20760 * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
20761 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
20762 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20763 * @return {Promise<AV.User>}
20764 */
20765 loginWithWeapp: function loginWithWeapp() {
20766 var _this7 = this;
20767
20768 var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20769 _ref7$preferUnionId = _ref7.preferUnionId,
20770 preferUnionId = _ref7$preferUnionId === void 0 ? false : _ref7$preferUnionId,
20771 _ref7$unionIdPlatform = _ref7.unionIdPlatform,
20772 unionIdPlatform = _ref7$unionIdPlatform === void 0 ? 'weixin' : _ref7$unionIdPlatform,
20773 _ref7$asMainAccount = _ref7.asMainAccount,
20774 asMainAccount = _ref7$asMainAccount === void 0 ? true : _ref7$asMainAccount,
20775 _ref7$failOnNotExist = _ref7.failOnNotExist,
20776 failOnNotExist = _ref7$failOnNotExist === void 0 ? false : _ref7$failOnNotExist;
20777
20778 var getAuthInfo = getAdapter('getAuthInfo');
20779 return getAuthInfo({
20780 preferUnionId: preferUnionId,
20781 asMainAccount: asMainAccount,
20782 platform: unionIdPlatform
20783 }).then(function (authInfo) {
20784 return _this7.loginWithMiniApp(authInfo, {
20785 failOnNotExist: failOnNotExist
20786 });
20787 });
20788 },
20789
20790 /**
20791 * The same with {@link AV.User.loginWithWeappWithUnionId}, except that you can set attributes before login.
20792 * @deprecated please use {@link AV.User#loginWithMiniApp}
20793 * @since 3.13.0
20794 */
20795 loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
20796 var _this8 = this;
20797
20798 var _ref8 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20799 _ref8$unionIdPlatform = _ref8.unionIdPlatform,
20800 unionIdPlatform = _ref8$unionIdPlatform === void 0 ? 'weixin' : _ref8$unionIdPlatform,
20801 _ref8$asMainAccount = _ref8.asMainAccount,
20802 asMainAccount = _ref8$asMainAccount === void 0 ? false : _ref8$asMainAccount,
20803 _ref8$failOnNotExist = _ref8.failOnNotExist,
20804 failOnNotExist = _ref8$failOnNotExist === void 0 ? false : _ref8$failOnNotExist;
20805
20806 var getAuthInfo = getAdapter('getAuthInfo');
20807 return getAuthInfo({
20808 platform: unionIdPlatform
20809 }).then(function (authInfo) {
20810 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20811 asMainAccount: asMainAccount
20812 });
20813 return _this8.loginWithMiniApp(authInfo, {
20814 failOnNotExist: failOnNotExist
20815 });
20816 });
20817 },
20818
20819 /**
20820 * The same with {@link AV.User.loginWithQQApp}, except that you can set attributes before login.
20821 * @deprecated please use {@link AV.User#loginWithMiniApp}
20822 * @since 4.2.0
20823 * @param {Object} [options]
20824 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
20825 * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
20826 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
20827 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20828 */
20829 loginWithQQApp: function loginWithQQApp() {
20830 var _this9 = this;
20831
20832 var _ref9 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20833 _ref9$preferUnionId = _ref9.preferUnionId,
20834 preferUnionId = _ref9$preferUnionId === void 0 ? false : _ref9$preferUnionId,
20835 _ref9$unionIdPlatform = _ref9.unionIdPlatform,
20836 unionIdPlatform = _ref9$unionIdPlatform === void 0 ? 'qq' : _ref9$unionIdPlatform,
20837 _ref9$asMainAccount = _ref9.asMainAccount,
20838 asMainAccount = _ref9$asMainAccount === void 0 ? true : _ref9$asMainAccount,
20839 _ref9$failOnNotExist = _ref9.failOnNotExist,
20840 failOnNotExist = _ref9$failOnNotExist === void 0 ? false : _ref9$failOnNotExist;
20841
20842 var getAuthInfo = getAdapter('getAuthInfo');
20843 return getAuthInfo({
20844 preferUnionId: preferUnionId,
20845 asMainAccount: asMainAccount,
20846 platform: unionIdPlatform
20847 }).then(function (authInfo) {
20848 authInfo.provider = PLATFORM_QQAPP;
20849 return _this9.loginWithMiniApp(authInfo, {
20850 failOnNotExist: failOnNotExist
20851 });
20852 });
20853 },
20854
20855 /**
20856 * The same with {@link AV.User.loginWithQQAppWithUnionId}, except that you can set attributes before login.
20857 * @deprecated please use {@link AV.User#loginWithMiniApp}
20858 * @since 4.2.0
20859 */
20860 loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
20861 var _this10 = this;
20862
20863 var _ref10 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20864 _ref10$unionIdPlatfor = _ref10.unionIdPlatform,
20865 unionIdPlatform = _ref10$unionIdPlatfor === void 0 ? 'qq' : _ref10$unionIdPlatfor,
20866 _ref10$asMainAccount = _ref10.asMainAccount,
20867 asMainAccount = _ref10$asMainAccount === void 0 ? false : _ref10$asMainAccount,
20868 _ref10$failOnNotExist = _ref10.failOnNotExist,
20869 failOnNotExist = _ref10$failOnNotExist === void 0 ? false : _ref10$failOnNotExist;
20870
20871 var getAuthInfo = getAdapter('getAuthInfo');
20872 return getAuthInfo({
20873 platform: unionIdPlatform
20874 }).then(function (authInfo) {
20875 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20876 asMainAccount: asMainAccount
20877 });
20878 authInfo.provider = PLATFORM_QQAPP;
20879 return _this10.loginWithMiniApp(authInfo, {
20880 failOnNotExist: failOnNotExist
20881 });
20882 });
20883 },
20884
20885 /**
20886 * The same with {@link AV.User.loginWithMiniApp}, except that you can set attributes before login.
20887 * @since 4.6.0
20888 */
20889 loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
20890 var _this11 = this;
20891
20892 if (authInfo === undefined) {
20893 var getAuthInfo = getAdapter('getAuthInfo');
20894 return getAuthInfo().then(function (authInfo) {
20895 return _this11.loginWithAuthData(authInfo.authData, authInfo.provider, option);
20896 });
20897 }
20898
20899 return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
20900 },
20901
20902 /**
20903 * Logs in a AV.User. On success, this saves the session to localStorage,
20904 * so you can retrieve the currently logged in user using
20905 * <code>current</code>.
20906 *
20907 * <p>A username and password must be set before calling logIn.</p>
20908 *
20909 * @see AV.User.logIn
20910 * @return {Promise} A promise that is fulfilled with the user when
20911 * the login is complete.
20912 */
20913 logIn: function logIn() {
20914 var model = this;
20915 var request = AVRequest('login', null, null, 'POST', this.toJSON());
20916 return request.then(function (resp) {
20917 var serverAttrs = model.parse(resp);
20918
20919 model._finishFetch(serverAttrs);
20920
20921 return model._handleSaveResult(true).then(function () {
20922 if (!serverAttrs.smsCode) delete model.attributes['smsCode'];
20923 return model;
20924 });
20925 });
20926 },
20927
20928 /**
20929 * @see AV.Object#save
20930 */
20931 save: function save(arg1, arg2, arg3) {
20932 var attrs, options;
20933
20934 if (_.isObject(arg1) || _.isNull(arg1) || _.isUndefined(arg1)) {
20935 attrs = arg1;
20936 options = arg2;
20937 } else {
20938 attrs = {};
20939 attrs[arg1] = arg2;
20940 options = arg3;
20941 }
20942
20943 options = options || {};
20944 return AV.Object.prototype.save.call(this, attrs, options).then(function (model) {
20945 return model._handleSaveResult(false).then(function () {
20946 return model;
20947 });
20948 });
20949 },
20950
20951 /**
20952 * Follow a user
20953 * @since 0.3.0
20954 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
20955 * @param {AV.User | String} options.user The target user or user's objectId to follow.
20956 * @param {Object} [options.attributes] key-value attributes dictionary to be used as
20957 * conditions of followerQuery/followeeQuery.
20958 * @param {AuthOptions} [authOptions]
20959 */
20960 follow: function follow(options, authOptions) {
20961 if (!this.id) {
20962 throw new Error('Please signin.');
20963 }
20964
20965 var user;
20966 var attributes;
20967
20968 if (options.user) {
20969 user = options.user;
20970 attributes = options.attributes;
20971 } else {
20972 user = options;
20973 }
20974
20975 var userObjectId = _.isString(user) ? user : user.id;
20976
20977 if (!userObjectId) {
20978 throw new Error('Invalid target user.');
20979 }
20980
20981 var route = 'users/' + this.id + '/friendship/' + userObjectId;
20982 var request = AVRequest(route, null, null, 'POST', AV._encode(attributes), authOptions);
20983 return request;
20984 },
20985
20986 /**
20987 * Unfollow a user.
20988 * @since 0.3.0
20989 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
20990 * @param {AV.User | String} options.user The target user or user's objectId to unfollow.
20991 * @param {AuthOptions} [authOptions]
20992 */
20993 unfollow: function unfollow(options, authOptions) {
20994 if (!this.id) {
20995 throw new Error('Please signin.');
20996 }
20997
20998 var user;
20999
21000 if (options.user) {
21001 user = options.user;
21002 } else {
21003 user = options;
21004 }
21005
21006 var userObjectId = _.isString(user) ? user : user.id;
21007
21008 if (!userObjectId) {
21009 throw new Error('Invalid target user.');
21010 }
21011
21012 var route = 'users/' + this.id + '/friendship/' + userObjectId;
21013 var request = AVRequest(route, null, null, 'DELETE', null, authOptions);
21014 return request;
21015 },
21016
21017 /**
21018 * Get the user's followers and followees.
21019 * @since 4.8.0
21020 * @param {Object} [options]
21021 * @param {Number} [options.skip]
21022 * @param {Number} [options.limit]
21023 * @param {AuthOptions} [authOptions]
21024 */
21025 getFollowersAndFollowees: function getFollowersAndFollowees(options, authOptions) {
21026 if (!this.id) {
21027 throw new Error('Please signin.');
21028 }
21029
21030 return request({
21031 method: 'GET',
21032 path: "/users/".concat(this.id, "/followersAndFollowees"),
21033 query: {
21034 skip: options && options.skip,
21035 limit: options && options.limit,
21036 include: 'follower,followee',
21037 keys: 'follower,followee'
21038 },
21039 authOptions: authOptions
21040 }).then(function (_ref11) {
21041 var followers = _ref11.followers,
21042 followees = _ref11.followees;
21043 return {
21044 followers: (0, _map.default)(followers).call(followers, function (_ref12) {
21045 var follower = _ref12.follower;
21046 return AV._decode(follower);
21047 }),
21048 followees: (0, _map.default)(followees).call(followees, function (_ref13) {
21049 var followee = _ref13.followee;
21050 return AV._decode(followee);
21051 })
21052 };
21053 });
21054 },
21055
21056 /**
21057 *Create a follower query to query the user's followers.
21058 * @since 0.3.0
21059 * @see AV.User#followerQuery
21060 */
21061 followerQuery: function followerQuery() {
21062 return AV.User.followerQuery(this.id);
21063 },
21064
21065 /**
21066 *Create a followee query to query the user's followees.
21067 * @since 0.3.0
21068 * @see AV.User#followeeQuery
21069 */
21070 followeeQuery: function followeeQuery() {
21071 return AV.User.followeeQuery(this.id);
21072 },
21073
21074 /**
21075 * @see AV.Object#fetch
21076 */
21077 fetch: function fetch(fetchOptions, options) {
21078 return AV.Object.prototype.fetch.call(this, fetchOptions, options).then(function (model) {
21079 return model._handleSaveResult(false).then(function () {
21080 return model;
21081 });
21082 });
21083 },
21084
21085 /**
21086 * Update user's new password safely based on old password.
21087 * @param {String} oldPassword the old password.
21088 * @param {String} newPassword the new password.
21089 * @param {AuthOptions} options
21090 */
21091 updatePassword: function updatePassword(oldPassword, newPassword, options) {
21092 var _this12 = this;
21093
21094 var route = 'users/' + this.id + '/updatePassword';
21095 var params = {
21096 old_password: oldPassword,
21097 new_password: newPassword
21098 };
21099 var request = AVRequest(route, null, null, 'PUT', params, options);
21100 return request.then(function (resp) {
21101 _this12._finishFetch(_this12.parse(resp));
21102
21103 return _this12._handleSaveResult(true).then(function () {
21104 return resp;
21105 });
21106 });
21107 },
21108
21109 /**
21110 * Returns true if <code>current</code> would return this user.
21111 * @see AV.User#current
21112 */
21113 isCurrent: function isCurrent() {
21114 return this._isCurrentUser;
21115 },
21116
21117 /**
21118 * Returns get("username").
21119 * @return {String}
21120 * @see AV.Object#get
21121 */
21122 getUsername: function getUsername() {
21123 return this.get('username');
21124 },
21125
21126 /**
21127 * Returns get("mobilePhoneNumber").
21128 * @return {String}
21129 * @see AV.Object#get
21130 */
21131 getMobilePhoneNumber: function getMobilePhoneNumber() {
21132 return this.get('mobilePhoneNumber');
21133 },
21134
21135 /**
21136 * Calls set("mobilePhoneNumber", phoneNumber, options) and returns the result.
21137 * @param {String} mobilePhoneNumber
21138 * @return {Boolean}
21139 * @see AV.Object#set
21140 */
21141 setMobilePhoneNumber: function setMobilePhoneNumber(phone, options) {
21142 return this.set('mobilePhoneNumber', phone, options);
21143 },
21144
21145 /**
21146 * Calls set("username", username, options) and returns the result.
21147 * @param {String} username
21148 * @return {Boolean}
21149 * @see AV.Object#set
21150 */
21151 setUsername: function setUsername(username, options) {
21152 return this.set('username', username, options);
21153 },
21154
21155 /**
21156 * Calls set("password", password, options) and returns the result.
21157 * @param {String} password
21158 * @return {Boolean}
21159 * @see AV.Object#set
21160 */
21161 setPassword: function setPassword(password, options) {
21162 return this.set('password', password, options);
21163 },
21164
21165 /**
21166 * Returns get("email").
21167 * @return {String}
21168 * @see AV.Object#get
21169 */
21170 getEmail: function getEmail() {
21171 return this.get('email');
21172 },
21173
21174 /**
21175 * Calls set("email", email, options) and returns the result.
21176 * @param {String} email
21177 * @param {AuthOptions} options
21178 * @return {Boolean}
21179 * @see AV.Object#set
21180 */
21181 setEmail: function setEmail(email, options) {
21182 return this.set('email', email, options);
21183 },
21184
21185 /**
21186 * Checks whether this user is the current user and has been authenticated.
21187 * @deprecated 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),
21188 * 如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id
21189 * @return (Boolean) whether this user is the current user and is logged in.
21190 */
21191 authenticated: function authenticated() {
21192 console.warn('DEPRECATED: 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id。');
21193 return !!this._sessionToken && !AV._config.disableCurrentUser && AV.User.current() && AV.User.current().id === this.id;
21194 },
21195
21196 /**
21197 * Detects if current sessionToken is valid.
21198 *
21199 * @since 2.0.0
21200 * @return Promise.<Boolean>
21201 */
21202 isAuthenticated: function isAuthenticated() {
21203 var _this13 = this;
21204
21205 return _promise.default.resolve().then(function () {
21206 return !!_this13._sessionToken && AV.User._fetchUserBySessionToken(_this13._sessionToken).then(function () {
21207 return true;
21208 }, function (error) {
21209 if (error.code === 211) {
21210 return false;
21211 }
21212
21213 throw error;
21214 });
21215 });
21216 },
21217
21218 /**
21219 * Get sessionToken of current user.
21220 * @return {String} sessionToken
21221 */
21222 getSessionToken: function getSessionToken() {
21223 return this._sessionToken;
21224 },
21225
21226 /**
21227 * Refresh sessionToken of current user.
21228 * @since 2.1.0
21229 * @param {AuthOptions} [options]
21230 * @return {Promise.<AV.User>} user with refreshed sessionToken
21231 */
21232 refreshSessionToken: function refreshSessionToken(options) {
21233 var _this14 = this;
21234
21235 return AVRequest("users/".concat(this.id, "/refreshSessionToken"), null, null, 'PUT', null, options).then(function (response) {
21236 _this14._finishFetch(response);
21237
21238 return _this14._handleSaveResult(true).then(function () {
21239 return _this14;
21240 });
21241 });
21242 },
21243
21244 /**
21245 * Get this user's Roles.
21246 * @param {AuthOptions} [options]
21247 * @return {Promise.<AV.Role[]>} A promise that is fulfilled with the roles when
21248 * the query is complete.
21249 */
21250 getRoles: function getRoles(options) {
21251 var _context;
21252
21253 return (0, _find.default)(_context = AV.Relation.reverseQuery('_Role', 'users', this)).call(_context, options);
21254 }
21255 },
21256 /** @lends AV.User */
21257 {
21258 // Class Variables
21259 // The currently logged-in user.
21260 _currentUser: null,
21261 // Whether currentUser is known to match the serialized version on disk.
21262 // This is useful for saving a localstorage check if you try to load
21263 // _currentUser frequently while there is none stored.
21264 _currentUserMatchesDisk: false,
21265 // The localStorage key suffix that the current user is stored under.
21266 _CURRENT_USER_KEY: 'currentUser',
21267 // The mapping of auth provider names to actual providers
21268 _authProviders: {},
21269 // Class Methods
21270
21271 /**
21272 * Signs up a new user with a username (or email) and password.
21273 * This will create a new AV.User on the server, and also persist the
21274 * session in localStorage so that you can access the user using
21275 * {@link #current}.
21276 *
21277 * @param {String} username The username (or email) to sign up with.
21278 * @param {String} password The password to sign up with.
21279 * @param {Object} [attrs] Extra fields to set on the new user.
21280 * @param {AuthOptions} [options]
21281 * @return {Promise} A promise that is fulfilled with the user when
21282 * the signup completes.
21283 * @see AV.User#signUp
21284 */
21285 signUp: function signUp(username, password, attrs, options) {
21286 attrs = attrs || {};
21287 attrs.username = username;
21288 attrs.password = password;
21289
21290 var user = AV.Object._create('_User');
21291
21292 return user.signUp(attrs, options);
21293 },
21294
21295 /**
21296 * Logs in a user with a username (or email) and password. On success, this
21297 * saves the session to disk, so you can retrieve the currently logged in
21298 * user using <code>current</code>.
21299 *
21300 * @param {String} username The username (or email) to log in with.
21301 * @param {String} password The password to log in with.
21302 * @return {Promise} A promise that is fulfilled with the user when
21303 * the login completes.
21304 * @see AV.User#logIn
21305 */
21306 logIn: function logIn(username, password) {
21307 var user = AV.Object._create('_User');
21308
21309 user._finishFetch({
21310 username: username,
21311 password: password
21312 });
21313
21314 return user.logIn();
21315 },
21316
21317 /**
21318 * Logs in a user with a session token. On success, this saves the session
21319 * to disk, so you can retrieve the currently logged in user using
21320 * <code>current</code>.
21321 *
21322 * @param {String} sessionToken The sessionToken to log in with.
21323 * @return {Promise} A promise that is fulfilled with the user when
21324 * the login completes.
21325 */
21326 become: function become(sessionToken) {
21327 return this._fetchUserBySessionToken(sessionToken).then(function (user) {
21328 return user._handleSaveResult(true).then(function () {
21329 return user;
21330 });
21331 });
21332 },
21333 _fetchUserBySessionToken: function _fetchUserBySessionToken(sessionToken) {
21334 if (sessionToken === undefined) {
21335 return _promise.default.reject(new Error('The sessionToken cannot be undefined'));
21336 }
21337
21338 var user = AV.Object._create('_User');
21339
21340 return request({
21341 method: 'GET',
21342 path: '/users/me',
21343 authOptions: {
21344 sessionToken: sessionToken
21345 }
21346 }).then(function (resp) {
21347 var serverAttrs = user.parse(resp);
21348
21349 user._finishFetch(serverAttrs);
21350
21351 return user;
21352 });
21353 },
21354
21355 /**
21356 * Logs in a user with a mobile phone number and sms code sent by
21357 * AV.User.requestLoginSmsCode.On success, this
21358 * saves the session to disk, so you can retrieve the currently logged in
21359 * user using <code>current</code>.
21360 *
21361 * @param {String} mobilePhone The user's mobilePhoneNumber
21362 * @param {String} smsCode The sms code sent by AV.User.requestLoginSmsCode
21363 * @return {Promise} A promise that is fulfilled with the user when
21364 * the login completes.
21365 * @see AV.User#logIn
21366 */
21367 logInWithMobilePhoneSmsCode: function logInWithMobilePhoneSmsCode(mobilePhone, smsCode) {
21368 var user = AV.Object._create('_User');
21369
21370 user._finishFetch({
21371 mobilePhoneNumber: mobilePhone,
21372 smsCode: smsCode
21373 });
21374
21375 return user.logIn();
21376 },
21377
21378 /**
21379 * Signs up or logs in a user with a mobilePhoneNumber and smsCode.
21380 * On success, this saves the session to disk, so you can retrieve the currently
21381 * logged in user using <code>current</code>.
21382 *
21383 * @param {String} mobilePhoneNumber The user's mobilePhoneNumber.
21384 * @param {String} smsCode The sms code sent by AV.Cloud.requestSmsCode
21385 * @param {Object} attributes The user's other attributes such as username etc.
21386 * @param {AuthOptions} options
21387 * @return {Promise} A promise that is fulfilled with the user when
21388 * the login completes.
21389 * @see AV.User#signUpOrlogInWithMobilePhone
21390 * @see AV.Cloud.requestSmsCode
21391 */
21392 signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(mobilePhoneNumber, smsCode, attrs, options) {
21393 attrs = attrs || {};
21394 attrs.mobilePhoneNumber = mobilePhoneNumber;
21395 attrs.smsCode = smsCode;
21396
21397 var user = AV.Object._create('_User');
21398
21399 return user.signUpOrlogInWithMobilePhone(attrs, options);
21400 },
21401
21402 /**
21403 * Logs in a user with a mobile phone number and password. On success, this
21404 * saves the session to disk, so you can retrieve the currently logged in
21405 * user using <code>current</code>.
21406 *
21407 * @param {String} mobilePhone The user's mobilePhoneNumber
21408 * @param {String} password The password to log in with.
21409 * @return {Promise} A promise that is fulfilled with the user when
21410 * the login completes.
21411 * @see AV.User#logIn
21412 */
21413 logInWithMobilePhone: function logInWithMobilePhone(mobilePhone, password) {
21414 var user = AV.Object._create('_User');
21415
21416 user._finishFetch({
21417 mobilePhoneNumber: mobilePhone,
21418 password: password
21419 });
21420
21421 return user.logIn();
21422 },
21423
21424 /**
21425 * Logs in a user with email and password.
21426 *
21427 * @since 3.13.0
21428 * @param {String} email The user's email.
21429 * @param {String} password The password to log in with.
21430 * @return {Promise} A promise that is fulfilled with the user when
21431 * the login completes.
21432 */
21433 loginWithEmail: function loginWithEmail(email, password) {
21434 var user = AV.Object._create('_User');
21435
21436 user._finishFetch({
21437 email: email,
21438 password: password
21439 });
21440
21441 return user.logIn();
21442 },
21443
21444 /**
21445 * Signs up or logs in a user with a third party auth data(AccessToken).
21446 * On success, this saves the session to disk, so you can retrieve the currently
21447 * logged in user using <code>current</code>.
21448 *
21449 * @since 3.7.0
21450 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
21451 * @param {string} platform Available platform for sign up.
21452 * @param {Object} [options]
21453 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
21454 * @return {Promise} A promise that is fulfilled with the user when
21455 * the login completes.
21456 * @example AV.User.loginWithAuthData({
21457 * openid: 'abc123',
21458 * access_token: '123abc',
21459 * expires_in: 1382686496
21460 * }, 'weixin').then(function(user) {
21461 * //Access user here
21462 * }).catch(function(error) {
21463 * //console.error("error: ", error);
21464 * });
21465 * @see {@link https://leancloud.cn/docs/js_guide.html#绑定第三方平台账户}
21466 */
21467 loginWithAuthData: function loginWithAuthData(authData, platform, options) {
21468 return AV.User._logInWith(platform, authData, options);
21469 },
21470
21471 /**
21472 * @deprecated renamed to {@link AV.User.loginWithAuthData}
21473 */
21474 signUpOrlogInWithAuthData: function signUpOrlogInWithAuthData() {
21475 console.warn('DEPRECATED: User.signUpOrlogInWithAuthData 已废弃,请使用 User#loginWithAuthData 代替');
21476 return this.loginWithAuthData.apply(this, arguments);
21477 },
21478
21479 /**
21480 * Signs up or logs in a user with a third party authData and unionId.
21481 * @since 3.7.0
21482 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
21483 * @param {string} platform Available platform for sign up.
21484 * @param {string} unionId
21485 * @param {Object} [unionLoginOptions]
21486 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
21487 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
21488 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
21489 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
21490 * @example AV.User.loginWithAuthDataAndUnionId({
21491 * openid: 'abc123',
21492 * access_token: '123abc',
21493 * expires_in: 1382686496
21494 * }, 'weixin', 'union123', {
21495 * unionIdPlatform: 'weixin',
21496 * asMainAccount: true,
21497 * }).then(function(user) {
21498 * //Access user here
21499 * }).catch(function(error) {
21500 * //console.error("error: ", error);
21501 * });
21502 */
21503 loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
21504 return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
21505 },
21506
21507 /**
21508 * @deprecated renamed to {@link AV.User.loginWithAuthDataAndUnionId}
21509 * @since 3.5.0
21510 */
21511 signUpOrlogInWithAuthDataAndUnionId: function signUpOrlogInWithAuthDataAndUnionId() {
21512 console.warn('DEPRECATED: User.signUpOrlogInWithAuthDataAndUnionId 已废弃,请使用 User#loginWithAuthDataAndUnionId 代替');
21513 return this.loginWithAuthDataAndUnionId.apply(this, arguments);
21514 },
21515
21516 /**
21517 * Merge unionId into authInfo.
21518 * @since 4.6.0
21519 * @param {Object} authInfo
21520 * @param {String} unionId
21521 * @param {Object} [unionIdOption]
21522 * @param {Boolean} [unionIdOption.asMainAccount] If true, the unionId will be associated with the user.
21523 */
21524 mergeUnionId: function mergeUnionId(authInfo, unionId) {
21525 var _ref14 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
21526 _ref14$asMainAccount = _ref14.asMainAccount,
21527 asMainAccount = _ref14$asMainAccount === void 0 ? false : _ref14$asMainAccount;
21528
21529 authInfo = JSON.parse((0, _stringify.default)(authInfo));
21530 var _authInfo = authInfo,
21531 authData = _authInfo.authData,
21532 platform = _authInfo.platform;
21533 authData.platform = platform;
21534 authData.main_account = asMainAccount;
21535 authData.unionid = unionId;
21536 return authInfo;
21537 },
21538
21539 /**
21540 * 使用当前使用微信小程序的微信用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
21541 * 仅在微信小程序中可用。
21542 *
21543 * @deprecated please use {@link AV.User.loginWithMiniApp}
21544 * @since 2.0.0
21545 * @param {Object} [options]
21546 * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
21547 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
21548 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
21549 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
21550 * @return {Promise.<AV.User>}
21551 */
21552 loginWithWeapp: function loginWithWeapp() {
21553 var _this15 = this;
21554
21555 var _ref15 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
21556 _ref15$preferUnionId = _ref15.preferUnionId,
21557 preferUnionId = _ref15$preferUnionId === void 0 ? false : _ref15$preferUnionId,
21558 _ref15$unionIdPlatfor = _ref15.unionIdPlatform,
21559 unionIdPlatform = _ref15$unionIdPlatfor === void 0 ? 'weixin' : _ref15$unionIdPlatfor,
21560 _ref15$asMainAccount = _ref15.asMainAccount,
21561 asMainAccount = _ref15$asMainAccount === void 0 ? true : _ref15$asMainAccount,
21562 _ref15$failOnNotExist = _ref15.failOnNotExist,
21563 failOnNotExist = _ref15$failOnNotExist === void 0 ? false : _ref15$failOnNotExist;
21564
21565 var getAuthInfo = getAdapter('getAuthInfo');
21566 return getAuthInfo({
21567 preferUnionId: preferUnionId,
21568 asMainAccount: asMainAccount,
21569 platform: unionIdPlatform
21570 }).then(function (authInfo) {
21571 return _this15.loginWithMiniApp(authInfo, {
21572 failOnNotExist: failOnNotExist
21573 });
21574 });
21575 },
21576
21577 /**
21578 * 使用当前使用微信小程序的微信用户身份注册或登录,
21579 * 仅在微信小程序中可用。
21580 *
21581 * @deprecated please use {@link AV.User.loginWithMiniApp}
21582 * @since 3.13.0
21583 * @param {Object} [unionLoginOptions]
21584 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
21585 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
21586 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists. * @return {Promise.<AV.User>}
21587 */
21588 loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
21589 var _this16 = this;
21590
21591 var _ref16 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
21592 _ref16$unionIdPlatfor = _ref16.unionIdPlatform,
21593 unionIdPlatform = _ref16$unionIdPlatfor === void 0 ? 'weixin' : _ref16$unionIdPlatfor,
21594 _ref16$asMainAccount = _ref16.asMainAccount,
21595 asMainAccount = _ref16$asMainAccount === void 0 ? false : _ref16$asMainAccount,
21596 _ref16$failOnNotExist = _ref16.failOnNotExist,
21597 failOnNotExist = _ref16$failOnNotExist === void 0 ? false : _ref16$failOnNotExist;
21598
21599 var getAuthInfo = getAdapter('getAuthInfo');
21600 return getAuthInfo({
21601 platform: unionIdPlatform
21602 }).then(function (authInfo) {
21603 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
21604 asMainAccount: asMainAccount
21605 });
21606 return _this16.loginWithMiniApp(authInfo, {
21607 failOnNotExist: failOnNotExist
21608 });
21609 });
21610 },
21611
21612 /**
21613 * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
21614 * 仅在 QQ 小程序中可用。
21615 *
21616 * @deprecated please use {@link AV.User.loginWithMiniApp}
21617 * @since 4.2.0
21618 * @param {Object} [options]
21619 * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
21620 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
21621 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
21622 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
21623 * @return {Promise.<AV.User>}
21624 */
21625 loginWithQQApp: function loginWithQQApp() {
21626 var _this17 = this;
21627
21628 var _ref17 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
21629 _ref17$preferUnionId = _ref17.preferUnionId,
21630 preferUnionId = _ref17$preferUnionId === void 0 ? false : _ref17$preferUnionId,
21631 _ref17$unionIdPlatfor = _ref17.unionIdPlatform,
21632 unionIdPlatform = _ref17$unionIdPlatfor === void 0 ? 'qq' : _ref17$unionIdPlatfor,
21633 _ref17$asMainAccount = _ref17.asMainAccount,
21634 asMainAccount = _ref17$asMainAccount === void 0 ? true : _ref17$asMainAccount,
21635 _ref17$failOnNotExist = _ref17.failOnNotExist,
21636 failOnNotExist = _ref17$failOnNotExist === void 0 ? false : _ref17$failOnNotExist;
21637
21638 var getAuthInfo = getAdapter('getAuthInfo');
21639 return getAuthInfo({
21640 preferUnionId: preferUnionId,
21641 asMainAccount: asMainAccount,
21642 platform: unionIdPlatform
21643 }).then(function (authInfo) {
21644 authInfo.provider = PLATFORM_QQAPP;
21645 return _this17.loginWithMiniApp(authInfo, {
21646 failOnNotExist: failOnNotExist
21647 });
21648 });
21649 },
21650
21651 /**
21652 * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,
21653 * 仅在 QQ 小程序中可用。
21654 *
21655 * @deprecated please use {@link AV.User.loginWithMiniApp}
21656 * @since 4.2.0
21657 * @param {Object} [unionLoginOptions]
21658 * @param {string} [unionLoginOptions.unionIdPlatform = 'qq'] unionId platform
21659 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
21660 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
21661 * @return {Promise.<AV.User>}
21662 */
21663 loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
21664 var _this18 = this;
21665
21666 var _ref18 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
21667 _ref18$unionIdPlatfor = _ref18.unionIdPlatform,
21668 unionIdPlatform = _ref18$unionIdPlatfor === void 0 ? 'qq' : _ref18$unionIdPlatfor,
21669 _ref18$asMainAccount = _ref18.asMainAccount,
21670 asMainAccount = _ref18$asMainAccount === void 0 ? false : _ref18$asMainAccount,
21671 _ref18$failOnNotExist = _ref18.failOnNotExist,
21672 failOnNotExist = _ref18$failOnNotExist === void 0 ? false : _ref18$failOnNotExist;
21673
21674 var getAuthInfo = getAdapter('getAuthInfo');
21675 return getAuthInfo({
21676 platform: unionIdPlatform
21677 }).then(function (authInfo) {
21678 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
21679 asMainAccount: asMainAccount
21680 });
21681 authInfo.provider = PLATFORM_QQAPP;
21682 return _this18.loginWithMiniApp(authInfo, {
21683 failOnNotExist: failOnNotExist
21684 });
21685 });
21686 },
21687
21688 /**
21689 * Register or login using the identity of the current mini-app.
21690 * @param {Object} authInfo
21691 * @param {Object} [option]
21692 * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
21693 */
21694 loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
21695 var _this19 = this;
21696
21697 if (authInfo === undefined) {
21698 var getAuthInfo = getAdapter('getAuthInfo');
21699 return getAuthInfo().then(function (authInfo) {
21700 return _this19.loginWithAuthData(authInfo.authData, authInfo.provider, option);
21701 });
21702 }
21703
21704 return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
21705 },
21706
21707 /**
21708 * Only use for DI in tests to produce deterministic IDs.
21709 */
21710 _genId: function _genId() {
21711 return uuid();
21712 },
21713
21714 /**
21715 * Creates an anonymous user.
21716 *
21717 * @since 3.9.0
21718 * @return {Promise.<AV.User>}
21719 */
21720 loginAnonymously: function loginAnonymously() {
21721 return this.loginWithAuthData({
21722 id: AV.User._genId()
21723 }, 'anonymous');
21724 },
21725 associateWithAuthData: function associateWithAuthData(userObj, platform, authData) {
21726 console.warn('DEPRECATED: User.associateWithAuthData 已废弃,请使用 User#associateWithAuthData 代替');
21727 return userObj._linkWith(platform, authData);
21728 },
21729
21730 /**
21731 * Logs out the currently logged in user session. This will remove the
21732 * session from disk, log out of linked services, and future calls to
21733 * <code>current</code> will return <code>null</code>.
21734 * @return {Promise}
21735 */
21736 logOut: function logOut() {
21737 if (AV._config.disableCurrentUser) {
21738 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');
21739 return _promise.default.resolve(null);
21740 }
21741
21742 if (AV.User._currentUser !== null) {
21743 AV.User._currentUser._logOutWithAll();
21744
21745 AV.User._currentUser._isCurrentUser = false;
21746 }
21747
21748 AV.User._currentUserMatchesDisk = true;
21749 AV.User._currentUser = null;
21750 return AV.localStorage.removeItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function () {
21751 return AV._refreshSubscriptionId();
21752 });
21753 },
21754
21755 /**
21756 *Create a follower query for special user to query the user's followers.
21757 * @param {String} userObjectId The user object id.
21758 * @return {AV.FriendShipQuery}
21759 * @since 0.3.0
21760 */
21761 followerQuery: function followerQuery(userObjectId) {
21762 if (!userObjectId || !_.isString(userObjectId)) {
21763 throw new Error('Invalid user object id.');
21764 }
21765
21766 var query = new AV.FriendShipQuery('_Follower');
21767 query._friendshipTag = 'follower';
21768 query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
21769 return query;
21770 },
21771
21772 /**
21773 *Create a followee query for special user to query the user's followees.
21774 * @param {String} userObjectId The user object id.
21775 * @return {AV.FriendShipQuery}
21776 * @since 0.3.0
21777 */
21778 followeeQuery: function followeeQuery(userObjectId) {
21779 if (!userObjectId || !_.isString(userObjectId)) {
21780 throw new Error('Invalid user object id.');
21781 }
21782
21783 var query = new AV.FriendShipQuery('_Followee');
21784 query._friendshipTag = 'followee';
21785 query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
21786 return query;
21787 },
21788
21789 /**
21790 * Requests a password reset email to be sent to the specified email address
21791 * associated with the user account. This email allows the user to securely
21792 * reset their password on the AV site.
21793 *
21794 * @param {String} email The email address associated with the user that
21795 * forgot their password.
21796 * @return {Promise}
21797 */
21798 requestPasswordReset: function requestPasswordReset(email) {
21799 var json = {
21800 email: email
21801 };
21802 var request = AVRequest('requestPasswordReset', null, null, 'POST', json);
21803 return request;
21804 },
21805
21806 /**
21807 * Requests a verify email to be sent to the specified email address
21808 * associated with the user account. This email allows the user to securely
21809 * verify their email address on the AV site.
21810 *
21811 * @param {String} email The email address associated with the user that
21812 * doesn't verify their email address.
21813 * @return {Promise}
21814 */
21815 requestEmailVerify: function requestEmailVerify(email) {
21816 var json = {
21817 email: email
21818 };
21819 var request = AVRequest('requestEmailVerify', null, null, 'POST', json);
21820 return request;
21821 },
21822
21823 /**
21824 * Requests a verify sms code to be sent to the specified mobile phone
21825 * number associated with the user account. This sms code allows the user to
21826 * verify their mobile phone number by calling AV.User.verifyMobilePhone
21827 *
21828 * @param {String} mobilePhoneNumber The mobile phone number associated with the
21829 * user that doesn't verify their mobile phone number.
21830 * @param {SMSAuthOptions} [options]
21831 * @return {Promise}
21832 */
21833 requestMobilePhoneVerify: function requestMobilePhoneVerify(mobilePhoneNumber) {
21834 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21835 var data = {
21836 mobilePhoneNumber: mobilePhoneNumber
21837 };
21838
21839 if (options.validateToken) {
21840 data.validate_token = options.validateToken;
21841 }
21842
21843 var request = AVRequest('requestMobilePhoneVerify', null, null, 'POST', data, options);
21844 return request;
21845 },
21846
21847 /**
21848 * Requests a reset password sms code to be sent to the specified mobile phone
21849 * number associated with the user account. This sms code allows the user to
21850 * reset their account's password by calling AV.User.resetPasswordBySmsCode
21851 *
21852 * @param {String} mobilePhoneNumber The mobile phone number associated with the
21853 * user that doesn't verify their mobile phone number.
21854 * @param {SMSAuthOptions} [options]
21855 * @return {Promise}
21856 */
21857 requestPasswordResetBySmsCode: function requestPasswordResetBySmsCode(mobilePhoneNumber) {
21858 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21859 var data = {
21860 mobilePhoneNumber: mobilePhoneNumber
21861 };
21862
21863 if (options.validateToken) {
21864 data.validate_token = options.validateToken;
21865 }
21866
21867 var request = AVRequest('requestPasswordResetBySmsCode', null, null, 'POST', data, options);
21868 return request;
21869 },
21870
21871 /**
21872 * Requests a change mobile phone number sms code to be sent to the mobilePhoneNumber.
21873 * This sms code allows current user to reset it's mobilePhoneNumber by
21874 * calling {@link AV.User.changePhoneNumber}
21875 * @since 4.7.0
21876 * @param {String} mobilePhoneNumber
21877 * @param {Number} [ttl] ttl of sms code (default is 6 minutes)
21878 * @param {SMSAuthOptions} [options]
21879 * @return {Promise}
21880 */
21881 requestChangePhoneNumber: function requestChangePhoneNumber(mobilePhoneNumber, ttl, options) {
21882 var data = {
21883 mobilePhoneNumber: mobilePhoneNumber
21884 };
21885
21886 if (ttl) {
21887 data.ttl = options.ttl;
21888 }
21889
21890 if (options && options.validateToken) {
21891 data.validate_token = options.validateToken;
21892 }
21893
21894 return AVRequest('requestChangePhoneNumber', null, null, 'POST', data, options);
21895 },
21896
21897 /**
21898 * Makes a call to reset user's account mobilePhoneNumber by sms code.
21899 * The sms code is sent by {@link AV.User.requestChangePhoneNumber}
21900 * @since 4.7.0
21901 * @param {String} mobilePhoneNumber
21902 * @param {String} code The sms code.
21903 * @return {Promise}
21904 */
21905 changePhoneNumber: function changePhoneNumber(mobilePhoneNumber, code) {
21906 var data = {
21907 mobilePhoneNumber: mobilePhoneNumber,
21908 code: code
21909 };
21910 return AVRequest('changePhoneNumber', null, null, 'POST', data);
21911 },
21912
21913 /**
21914 * Makes a call to reset user's account password by sms code and new password.
21915 * The sms code is sent by AV.User.requestPasswordResetBySmsCode.
21916 * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
21917 * @param {String} password The new password.
21918 * @return {Promise} A promise that will be resolved with the result
21919 * of the function.
21920 */
21921 resetPasswordBySmsCode: function resetPasswordBySmsCode(code, password) {
21922 var json = {
21923 password: password
21924 };
21925 var request = AVRequest('resetPasswordBySmsCode', null, code, 'PUT', json);
21926 return request;
21927 },
21928
21929 /**
21930 * Makes a call to verify sms code that sent by AV.User.Cloud.requestSmsCode
21931 * If verify successfully,the user mobilePhoneVerified attribute will be true.
21932 * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
21933 * @return {Promise} A promise that will be resolved with the result
21934 * of the function.
21935 */
21936 verifyMobilePhone: function verifyMobilePhone(code) {
21937 var request = AVRequest('verifyMobilePhone', null, code, 'POST', null);
21938 return request;
21939 },
21940
21941 /**
21942 * Requests a logIn sms code to be sent to the specified mobile phone
21943 * number associated with the user account. This sms code allows the user to
21944 * login by AV.User.logInWithMobilePhoneSmsCode function.
21945 *
21946 * @param {String} mobilePhoneNumber The mobile phone number associated with the
21947 * user that want to login by AV.User.logInWithMobilePhoneSmsCode
21948 * @param {SMSAuthOptions} [options]
21949 * @return {Promise}
21950 */
21951 requestLoginSmsCode: function requestLoginSmsCode(mobilePhoneNumber) {
21952 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21953 var data = {
21954 mobilePhoneNumber: mobilePhoneNumber
21955 };
21956
21957 if (options.validateToken) {
21958 data.validate_token = options.validateToken;
21959 }
21960
21961 var request = AVRequest('requestLoginSmsCode', null, null, 'POST', data, options);
21962 return request;
21963 },
21964
21965 /**
21966 * Retrieves the currently logged in AVUser with a valid session,
21967 * either from memory or localStorage, if necessary.
21968 * @return {Promise.<AV.User>} resolved with the currently logged in AV.User.
21969 */
21970 currentAsync: function currentAsync() {
21971 if (AV._config.disableCurrentUser) {
21972 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');
21973 return _promise.default.resolve(null);
21974 }
21975
21976 if (AV.User._currentUser) {
21977 return _promise.default.resolve(AV.User._currentUser);
21978 }
21979
21980 if (AV.User._currentUserMatchesDisk) {
21981 return _promise.default.resolve(AV.User._currentUser);
21982 }
21983
21984 return AV.localStorage.getItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function (userData) {
21985 if (!userData) {
21986 return null;
21987 } // Load the user from local storage.
21988
21989
21990 AV.User._currentUserMatchesDisk = true;
21991 AV.User._currentUser = AV.Object._create('_User');
21992 AV.User._currentUser._isCurrentUser = true;
21993 var json = JSON.parse(userData);
21994 AV.User._currentUser.id = json._id;
21995 delete json._id;
21996 AV.User._currentUser._sessionToken = json._sessionToken;
21997 delete json._sessionToken;
21998
21999 AV.User._currentUser._finishFetch(json); //AV.User._currentUser.set(json);
22000
22001
22002 AV.User._currentUser._synchronizeAllAuthData();
22003
22004 AV.User._currentUser._refreshCache();
22005
22006 AV.User._currentUser._opSetQueue = [{}];
22007 return AV.User._currentUser;
22008 });
22009 },
22010
22011 /**
22012 * Retrieves the currently logged in AVUser with a valid session,
22013 * either from memory or localStorage, if necessary.
22014 * @return {AV.User} The currently logged in AV.User.
22015 */
22016 current: function current() {
22017 if (AV._config.disableCurrentUser) {
22018 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');
22019 return null;
22020 }
22021
22022 if (AV.localStorage.async) {
22023 var error = new Error('Synchronous API User.current() is not available in this runtime. Use User.currentAsync() instead.');
22024 error.code = 'SYNC_API_NOT_AVAILABLE';
22025 throw error;
22026 }
22027
22028 if (AV.User._currentUser) {
22029 return AV.User._currentUser;
22030 }
22031
22032 if (AV.User._currentUserMatchesDisk) {
22033 return AV.User._currentUser;
22034 } // Load the user from local storage.
22035
22036
22037 AV.User._currentUserMatchesDisk = true;
22038 var userData = AV.localStorage.getItem(AV._getAVPath(AV.User._CURRENT_USER_KEY));
22039
22040 if (!userData) {
22041 return null;
22042 }
22043
22044 AV.User._currentUser = AV.Object._create('_User');
22045 AV.User._currentUser._isCurrentUser = true;
22046 var json = JSON.parse(userData);
22047 AV.User._currentUser.id = json._id;
22048 delete json._id;
22049 AV.User._currentUser._sessionToken = json._sessionToken;
22050 delete json._sessionToken;
22051
22052 AV.User._currentUser._finishFetch(json); //AV.User._currentUser.set(json);
22053
22054
22055 AV.User._currentUser._synchronizeAllAuthData();
22056
22057 AV.User._currentUser._refreshCache();
22058
22059 AV.User._currentUser._opSetQueue = [{}];
22060 return AV.User._currentUser;
22061 },
22062
22063 /**
22064 * Persists a user as currentUser to localStorage, and into the singleton.
22065 * @private
22066 */
22067 _saveCurrentUser: function _saveCurrentUser(user) {
22068 var promise;
22069
22070 if (AV.User._currentUser !== user) {
22071 promise = AV.User.logOut();
22072 } else {
22073 promise = _promise.default.resolve();
22074 }
22075
22076 return promise.then(function () {
22077 user._isCurrentUser = true;
22078 AV.User._currentUser = user;
22079
22080 var json = user._toFullJSON();
22081
22082 json._id = user.id;
22083 json._sessionToken = user._sessionToken;
22084 return AV.localStorage.setItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY), (0, _stringify.default)(json)).then(function () {
22085 AV.User._currentUserMatchesDisk = true;
22086 return AV._refreshSubscriptionId();
22087 });
22088 });
22089 },
22090 _registerAuthenticationProvider: function _registerAuthenticationProvider(provider) {
22091 AV.User._authProviders[provider.getAuthType()] = provider; // Synchronize the current user with the auth provider.
22092
22093 if (!AV._config.disableCurrentUser && AV.User.current()) {
22094 AV.User.current()._synchronizeAuthData(provider.getAuthType());
22095 }
22096 },
22097 _logInWith: function _logInWith(provider, authData, options) {
22098 var user = AV.Object._create('_User');
22099
22100 return user._linkWith(provider, authData, options);
22101 }
22102 });
22103};
22104
22105/***/ }),
22106/* 557 */
22107/***/ (function(module, exports, __webpack_require__) {
22108
22109var _Object$defineProperty = __webpack_require__(150);
22110
22111function _defineProperty(obj, key, value) {
22112 if (key in obj) {
22113 _Object$defineProperty(obj, key, {
22114 value: value,
22115 enumerable: true,
22116 configurable: true,
22117 writable: true
22118 });
22119 } else {
22120 obj[key] = value;
22121 }
22122
22123 return obj;
22124}
22125
22126module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
22127
22128/***/ }),
22129/* 558 */
22130/***/ (function(module, exports, __webpack_require__) {
22131
22132"use strict";
22133
22134
22135var _interopRequireDefault = __webpack_require__(1);
22136
22137var _map = _interopRequireDefault(__webpack_require__(35));
22138
22139var _promise = _interopRequireDefault(__webpack_require__(12));
22140
22141var _keys = _interopRequireDefault(__webpack_require__(59));
22142
22143var _stringify = _interopRequireDefault(__webpack_require__(36));
22144
22145var _find = _interopRequireDefault(__webpack_require__(93));
22146
22147var _concat = _interopRequireDefault(__webpack_require__(22));
22148
22149var _ = __webpack_require__(3);
22150
22151var debug = __webpack_require__(60)('leancloud:query');
22152
22153var AVError = __webpack_require__(46);
22154
22155var _require = __webpack_require__(27),
22156 _request = _require._request,
22157 request = _require.request;
22158
22159var _require2 = __webpack_require__(30),
22160 ensureArray = _require2.ensureArray,
22161 transformFetchOptions = _require2.transformFetchOptions,
22162 continueWhile = _require2.continueWhile;
22163
22164var requires = function requires(value, message) {
22165 if (value === undefined) {
22166 throw new Error(message);
22167 }
22168}; // AV.Query is a way to create a list of AV.Objects.
22169
22170
22171module.exports = function (AV) {
22172 /**
22173 * Creates a new AV.Query for the given AV.Object subclass.
22174 * @param {Class|String} objectClass An instance of a subclass of AV.Object, or a AV className string.
22175 * @class
22176 *
22177 * <p>AV.Query defines a query that is used to fetch AV.Objects. The
22178 * most common use case is finding all objects that match a query through the
22179 * <code>find</code> method. For example, this sample code fetches all objects
22180 * of class <code>MyClass</code>. It calls a different function depending on
22181 * whether the fetch succeeded or not.
22182 *
22183 * <pre>
22184 * var query = new AV.Query(MyClass);
22185 * query.find().then(function(results) {
22186 * // results is an array of AV.Object.
22187 * }, function(error) {
22188 * // error is an instance of AVError.
22189 * });</pre></p>
22190 *
22191 * <p>An AV.Query can also be used to retrieve a single object whose id is
22192 * known, through the get method. For example, this sample code fetches an
22193 * object of class <code>MyClass</code> and id <code>myId</code>. It calls a
22194 * different function depending on whether the fetch succeeded or not.
22195 *
22196 * <pre>
22197 * var query = new AV.Query(MyClass);
22198 * query.get(myId).then(function(object) {
22199 * // object is an instance of AV.Object.
22200 * }, function(error) {
22201 * // error is an instance of AVError.
22202 * });</pre></p>
22203 *
22204 * <p>An AV.Query can also be used to count the number of objects that match
22205 * the query without retrieving all of those objects. For example, this
22206 * sample code counts the number of objects of the class <code>MyClass</code>
22207 * <pre>
22208 * var query = new AV.Query(MyClass);
22209 * query.count().then(function(number) {
22210 * // There are number instances of MyClass.
22211 * }, function(error) {
22212 * // error is an instance of AVError.
22213 * });</pre></p>
22214 */
22215 AV.Query = function (objectClass) {
22216 if (_.isString(objectClass)) {
22217 objectClass = AV.Object._getSubclass(objectClass);
22218 }
22219
22220 this.objectClass = objectClass;
22221 this.className = objectClass.prototype.className;
22222 this._where = {};
22223 this._include = [];
22224 this._select = [];
22225 this._limit = -1; // negative limit means, do not send a limit
22226
22227 this._skip = 0;
22228 this._defaultParams = {};
22229 };
22230 /**
22231 * Constructs a AV.Query that is the OR of the passed in queries. For
22232 * example:
22233 * <pre>var compoundQuery = AV.Query.or(query1, query2, query3);</pre>
22234 *
22235 * will create a compoundQuery that is an or of the query1, query2, and
22236 * query3.
22237 * @param {...AV.Query} var_args The list of queries to OR.
22238 * @return {AV.Query} The query that is the OR of the passed in queries.
22239 */
22240
22241
22242 AV.Query.or = function () {
22243 var queries = _.toArray(arguments);
22244
22245 var className = null;
22246
22247 AV._arrayEach(queries, function (q) {
22248 if (_.isNull(className)) {
22249 className = q.className;
22250 }
22251
22252 if (className !== q.className) {
22253 throw new Error('All queries must be for the same class');
22254 }
22255 });
22256
22257 var query = new AV.Query(className);
22258
22259 query._orQuery(queries);
22260
22261 return query;
22262 };
22263 /**
22264 * Constructs a AV.Query that is the AND of the passed in queries. For
22265 * example:
22266 * <pre>var compoundQuery = AV.Query.and(query1, query2, query3);</pre>
22267 *
22268 * will create a compoundQuery that is an 'and' of the query1, query2, and
22269 * query3.
22270 * @param {...AV.Query} var_args The list of queries to AND.
22271 * @return {AV.Query} The query that is the AND of the passed in queries.
22272 */
22273
22274
22275 AV.Query.and = function () {
22276 var queries = _.toArray(arguments);
22277
22278 var className = null;
22279
22280 AV._arrayEach(queries, function (q) {
22281 if (_.isNull(className)) {
22282 className = q.className;
22283 }
22284
22285 if (className !== q.className) {
22286 throw new Error('All queries must be for the same class');
22287 }
22288 });
22289
22290 var query = new AV.Query(className);
22291
22292 query._andQuery(queries);
22293
22294 return query;
22295 };
22296 /**
22297 * Retrieves a list of AVObjects that satisfy the CQL.
22298 * CQL syntax please see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
22299 *
22300 * @param {String} cql A CQL string, see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
22301 * @param {Array} pvalues An array contains placeholder values.
22302 * @param {AuthOptions} options
22303 * @return {Promise} A promise that is resolved with the results when
22304 * the query completes.
22305 */
22306
22307
22308 AV.Query.doCloudQuery = function (cql, pvalues, options) {
22309 var params = {
22310 cql: cql
22311 };
22312
22313 if (_.isArray(pvalues)) {
22314 params.pvalues = pvalues;
22315 } else {
22316 options = pvalues;
22317 }
22318
22319 var request = _request('cloudQuery', null, null, 'GET', params, options);
22320
22321 return request.then(function (response) {
22322 //query to process results.
22323 var query = new AV.Query(response.className);
22324 var results = (0, _map.default)(_).call(_, response.results, function (json) {
22325 var obj = query._newObject(response);
22326
22327 if (obj._finishFetch) {
22328 obj._finishFetch(query._processResult(json), true);
22329 }
22330
22331 return obj;
22332 });
22333 return {
22334 results: results,
22335 count: response.count,
22336 className: response.className
22337 };
22338 });
22339 };
22340 /**
22341 * Return a query with conditions from json.
22342 * This can be useful to send a query from server side to client side.
22343 * @since 4.0.0
22344 * @param {Object} json from {@link AV.Query#toJSON}
22345 * @return {AV.Query}
22346 */
22347
22348
22349 AV.Query.fromJSON = function (_ref) {
22350 var className = _ref.className,
22351 where = _ref.where,
22352 include = _ref.include,
22353 select = _ref.select,
22354 includeACL = _ref.includeACL,
22355 limit = _ref.limit,
22356 skip = _ref.skip,
22357 order = _ref.order;
22358
22359 if (typeof className !== 'string') {
22360 throw new TypeError('Invalid Query JSON, className must be a String.');
22361 }
22362
22363 var query = new AV.Query(className);
22364
22365 _.extend(query, {
22366 _where: where,
22367 _include: include,
22368 _select: select,
22369 _includeACL: includeACL,
22370 _limit: limit,
22371 _skip: skip,
22372 _order: order
22373 });
22374
22375 return query;
22376 };
22377
22378 AV.Query._extend = AV._extend;
22379
22380 _.extend(AV.Query.prototype,
22381 /** @lends AV.Query.prototype */
22382 {
22383 //hook to iterate result. Added by dennis<xzhuang@avoscloud.com>.
22384 _processResult: function _processResult(obj) {
22385 return obj;
22386 },
22387
22388 /**
22389 * Constructs an AV.Object whose id is already known by fetching data from
22390 * the server.
22391 *
22392 * @param {String} objectId The id of the object to be fetched.
22393 * @param {AuthOptions} options
22394 * @return {Promise.<AV.Object>}
22395 */
22396 get: function get(objectId, options) {
22397 if (!_.isString(objectId)) {
22398 throw new Error('objectId must be a string');
22399 }
22400
22401 if (objectId === '') {
22402 return _promise.default.reject(new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.'));
22403 }
22404
22405 var obj = this._newObject();
22406
22407 obj.id = objectId;
22408
22409 var queryJSON = this._getParams();
22410
22411 var fetchOptions = {};
22412 if ((0, _keys.default)(queryJSON)) fetchOptions.keys = (0, _keys.default)(queryJSON);
22413 if (queryJSON.include) fetchOptions.include = queryJSON.include;
22414 if (queryJSON.includeACL) fetchOptions.includeACL = queryJSON.includeACL;
22415 return _request('classes', this.className, objectId, 'GET', transformFetchOptions(fetchOptions), options).then(function (response) {
22416 if (_.isEmpty(response)) throw new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
22417
22418 obj._finishFetch(obj.parse(response), true);
22419
22420 return obj;
22421 });
22422 },
22423
22424 /**
22425 * Returns a JSON representation of this query.
22426 * @return {Object}
22427 */
22428 toJSON: function toJSON() {
22429 var className = this.className,
22430 where = this._where,
22431 include = this._include,
22432 select = this._select,
22433 includeACL = this._includeACL,
22434 limit = this._limit,
22435 skip = this._skip,
22436 order = this._order;
22437 return {
22438 className: className,
22439 where: where,
22440 include: include,
22441 select: select,
22442 includeACL: includeACL,
22443 limit: limit,
22444 skip: skip,
22445 order: order
22446 };
22447 },
22448 _getParams: function _getParams() {
22449 var params = _.extend({}, this._defaultParams, {
22450 where: this._where
22451 });
22452
22453 if (this._include.length > 0) {
22454 params.include = this._include.join(',');
22455 }
22456
22457 if (this._select.length > 0) {
22458 params.keys = this._select.join(',');
22459 }
22460
22461 if (this._includeACL !== undefined) {
22462 params.returnACL = this._includeACL;
22463 }
22464
22465 if (this._limit >= 0) {
22466 params.limit = this._limit;
22467 }
22468
22469 if (this._skip > 0) {
22470 params.skip = this._skip;
22471 }
22472
22473 if (this._order !== undefined) {
22474 params.order = this._order;
22475 }
22476
22477 return params;
22478 },
22479 _newObject: function _newObject(response) {
22480 var obj;
22481
22482 if (response && response.className) {
22483 obj = new AV.Object(response.className);
22484 } else {
22485 obj = new this.objectClass();
22486 }
22487
22488 return obj;
22489 },
22490 _createRequest: function _createRequest() {
22491 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._getParams();
22492 var options = arguments.length > 1 ? arguments[1] : undefined;
22493 var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "/classes/".concat(this.className);
22494
22495 if (encodeURIComponent((0, _stringify.default)(params)).length > 2000) {
22496 var body = {
22497 requests: [{
22498 method: 'GET',
22499 path: "/1.1".concat(path),
22500 params: params
22501 }]
22502 };
22503 return request({
22504 path: '/batch',
22505 method: 'POST',
22506 data: body,
22507 authOptions: options
22508 }).then(function (response) {
22509 var result = response[0];
22510
22511 if (result.success) {
22512 return result.success;
22513 }
22514
22515 var error = new AVError(result.error.code, result.error.error || 'Unknown batch error');
22516 throw error;
22517 });
22518 }
22519
22520 return request({
22521 method: 'GET',
22522 path: path,
22523 query: params,
22524 authOptions: options
22525 });
22526 },
22527 _parseResponse: function _parseResponse(response) {
22528 var _this = this;
22529
22530 return (0, _map.default)(_).call(_, response.results, function (json) {
22531 var obj = _this._newObject(response);
22532
22533 if (obj._finishFetch) {
22534 obj._finishFetch(_this._processResult(json), true);
22535 }
22536
22537 return obj;
22538 });
22539 },
22540
22541 /**
22542 * Retrieves a list of AVObjects that satisfy this query.
22543 *
22544 * @param {AuthOptions} options
22545 * @return {Promise} A promise that is resolved with the results when
22546 * the query completes.
22547 */
22548 find: function find(options) {
22549 var request = this._createRequest(undefined, options);
22550
22551 return request.then(this._parseResponse.bind(this));
22552 },
22553
22554 /**
22555 * Retrieves both AVObjects and total count.
22556 *
22557 * @since 4.12.0
22558 * @param {AuthOptions} options
22559 * @return {Promise} A tuple contains results and count.
22560 */
22561 findAndCount: function findAndCount(options) {
22562 var _this2 = this;
22563
22564 var params = this._getParams();
22565
22566 params.count = 1;
22567
22568 var request = this._createRequest(params, options);
22569
22570 return request.then(function (response) {
22571 return [_this2._parseResponse(response), response.count];
22572 });
22573 },
22574
22575 /**
22576 * scan a Query. masterKey required.
22577 *
22578 * @since 2.1.0
22579 * @param {object} [options]
22580 * @param {string} [options.orderedBy] specify the key to sort
22581 * @param {number} [options.batchSize] specify the batch size for each request
22582 * @param {AuthOptions} [authOptions]
22583 * @return {AsyncIterator.<AV.Object>}
22584 * @example const testIterator = {
22585 * [Symbol.asyncIterator]() {
22586 * return new Query('Test').scan(undefined, { useMasterKey: true });
22587 * },
22588 * };
22589 * for await (const test of testIterator) {
22590 * console.log(test.id);
22591 * }
22592 */
22593 scan: function scan() {
22594 var _this3 = this;
22595
22596 var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
22597 orderedBy = _ref2.orderedBy,
22598 batchSize = _ref2.batchSize;
22599
22600 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
22601
22602 var condition = this._getParams();
22603
22604 debug('scan %O', condition);
22605
22606 if (condition.order) {
22607 console.warn('The order of the query is ignored for Query#scan. Checkout the orderedBy option of Query#scan.');
22608 delete condition.order;
22609 }
22610
22611 if (condition.skip) {
22612 console.warn('The skip option of the query is ignored for Query#scan.');
22613 delete condition.skip;
22614 }
22615
22616 if (condition.limit) {
22617 console.warn('The limit option of the query is ignored for Query#scan.');
22618 delete condition.limit;
22619 }
22620
22621 if (orderedBy) condition.scan_key = orderedBy;
22622 if (batchSize) condition.limit = batchSize;
22623 var cursor;
22624 var remainResults = [];
22625 return {
22626 next: function next() {
22627 if (remainResults.length) {
22628 return _promise.default.resolve({
22629 done: false,
22630 value: remainResults.shift()
22631 });
22632 }
22633
22634 if (cursor === null) {
22635 return _promise.default.resolve({
22636 done: true
22637 });
22638 }
22639
22640 return _request('scan/classes', _this3.className, null, 'GET', cursor ? _.extend({}, condition, {
22641 cursor: cursor
22642 }) : condition, authOptions).then(function (response) {
22643 cursor = response.cursor;
22644
22645 if (response.results.length) {
22646 var results = _this3._parseResponse(response);
22647
22648 results.forEach(function (result) {
22649 return remainResults.push(result);
22650 });
22651 }
22652
22653 if (cursor === null && remainResults.length === 0) {
22654 return {
22655 done: true
22656 };
22657 }
22658
22659 return {
22660 done: false,
22661 value: remainResults.shift()
22662 };
22663 });
22664 }
22665 };
22666 },
22667
22668 /**
22669 * Delete objects retrieved by this query.
22670 * @param {AuthOptions} options
22671 * @return {Promise} A promise that is fulfilled when the save
22672 * completes.
22673 */
22674 destroyAll: function destroyAll(options) {
22675 var self = this;
22676 return (0, _find.default)(self).call(self, options).then(function (objects) {
22677 return AV.Object.destroyAll(objects, options);
22678 });
22679 },
22680
22681 /**
22682 * Counts the number of objects that match this query.
22683 *
22684 * @param {AuthOptions} options
22685 * @return {Promise} A promise that is resolved with the count when
22686 * the query completes.
22687 */
22688 count: function count(options) {
22689 var params = this._getParams();
22690
22691 params.limit = 0;
22692 params.count = 1;
22693
22694 var request = this._createRequest(params, options);
22695
22696 return request.then(function (response) {
22697 return response.count;
22698 });
22699 },
22700
22701 /**
22702 * Retrieves at most one AV.Object that satisfies this query.
22703 *
22704 * @param {AuthOptions} options
22705 * @return {Promise} A promise that is resolved with the object when
22706 * the query completes.
22707 */
22708 first: function first(options) {
22709 var self = this;
22710
22711 var params = this._getParams();
22712
22713 params.limit = 1;
22714
22715 var request = this._createRequest(params, options);
22716
22717 return request.then(function (response) {
22718 return (0, _map.default)(_).call(_, response.results, function (json) {
22719 var obj = self._newObject();
22720
22721 if (obj._finishFetch) {
22722 obj._finishFetch(self._processResult(json), true);
22723 }
22724
22725 return obj;
22726 })[0];
22727 });
22728 },
22729
22730 /**
22731 * Sets the number of results to skip before returning any results.
22732 * This is useful for pagination.
22733 * Default is to skip zero results.
22734 * @param {Number} n the number of results to skip.
22735 * @return {AV.Query} Returns the query, so you can chain this call.
22736 */
22737 skip: function skip(n) {
22738 requires(n, 'undefined is not a valid skip value');
22739 this._skip = n;
22740 return this;
22741 },
22742
22743 /**
22744 * Sets the limit of the number of results to return. The default limit is
22745 * 100, with a maximum of 1000 results being returned at a time.
22746 * @param {Number} n the number of results to limit to.
22747 * @return {AV.Query} Returns the query, so you can chain this call.
22748 */
22749 limit: function limit(n) {
22750 requires(n, 'undefined is not a valid limit value');
22751 this._limit = n;
22752 return this;
22753 },
22754
22755 /**
22756 * Add a constraint to the query that requires a particular key's value to
22757 * be equal to the provided value.
22758 * @param {String} key The key to check.
22759 * @param value The value that the AV.Object must contain.
22760 * @return {AV.Query} Returns the query, so you can chain this call.
22761 */
22762 equalTo: function equalTo(key, value) {
22763 requires(key, 'undefined is not a valid key');
22764 requires(value, 'undefined is not a valid value');
22765 this._where[key] = AV._encode(value);
22766 return this;
22767 },
22768
22769 /**
22770 * Helper for condition queries
22771 * @private
22772 */
22773 _addCondition: function _addCondition(key, condition, value) {
22774 requires(key, 'undefined is not a valid condition key');
22775 requires(condition, 'undefined is not a valid condition');
22776 requires(value, 'undefined is not a valid condition value'); // Check if we already have a condition
22777
22778 if (!this._where[key]) {
22779 this._where[key] = {};
22780 }
22781
22782 this._where[key][condition] = AV._encode(value);
22783 return this;
22784 },
22785
22786 /**
22787 * Add a constraint to the query that requires a particular
22788 * <strong>array</strong> key's length to be equal to the provided value.
22789 * @param {String} key The array key to check.
22790 * @param {number} value The length value.
22791 * @return {AV.Query} Returns the query, so you can chain this call.
22792 */
22793 sizeEqualTo: function sizeEqualTo(key, value) {
22794 this._addCondition(key, '$size', value);
22795
22796 return this;
22797 },
22798
22799 /**
22800 * Add a constraint to the query that requires a particular key's value to
22801 * be not equal to the provided value.
22802 * @param {String} key The key to check.
22803 * @param value The value that must not be equalled.
22804 * @return {AV.Query} Returns the query, so you can chain this call.
22805 */
22806 notEqualTo: function notEqualTo(key, value) {
22807 this._addCondition(key, '$ne', value);
22808
22809 return this;
22810 },
22811
22812 /**
22813 * Add a constraint to the query that requires a particular key's value to
22814 * be less than the provided value.
22815 * @param {String} key The key to check.
22816 * @param value The value that provides an upper bound.
22817 * @return {AV.Query} Returns the query, so you can chain this call.
22818 */
22819 lessThan: function lessThan(key, value) {
22820 this._addCondition(key, '$lt', value);
22821
22822 return this;
22823 },
22824
22825 /**
22826 * Add a constraint to the query that requires a particular key's value to
22827 * be greater than the provided value.
22828 * @param {String} key The key to check.
22829 * @param value The value that provides an lower bound.
22830 * @return {AV.Query} Returns the query, so you can chain this call.
22831 */
22832 greaterThan: function greaterThan(key, value) {
22833 this._addCondition(key, '$gt', value);
22834
22835 return this;
22836 },
22837
22838 /**
22839 * Add a constraint to the query that requires a particular key's value to
22840 * be less than or equal to the provided value.
22841 * @param {String} key The key to check.
22842 * @param value The value that provides an upper bound.
22843 * @return {AV.Query} Returns the query, so you can chain this call.
22844 */
22845 lessThanOrEqualTo: function lessThanOrEqualTo(key, value) {
22846 this._addCondition(key, '$lte', value);
22847
22848 return this;
22849 },
22850
22851 /**
22852 * Add a constraint to the query that requires a particular key's value to
22853 * be greater than or equal to the provided value.
22854 * @param {String} key The key to check.
22855 * @param value The value that provides an lower bound.
22856 * @return {AV.Query} Returns the query, so you can chain this call.
22857 */
22858 greaterThanOrEqualTo: function greaterThanOrEqualTo(key, value) {
22859 this._addCondition(key, '$gte', value);
22860
22861 return this;
22862 },
22863
22864 /**
22865 * Add a constraint to the query that requires a particular key's value to
22866 * be contained in the provided list of values.
22867 * @param {String} key The key to check.
22868 * @param {Array} values The values that will match.
22869 * @return {AV.Query} Returns the query, so you can chain this call.
22870 */
22871 containedIn: function containedIn(key, values) {
22872 this._addCondition(key, '$in', values);
22873
22874 return this;
22875 },
22876
22877 /**
22878 * Add a constraint to the query that requires a particular key's value to
22879 * not be contained in the provided list of values.
22880 * @param {String} key The key to check.
22881 * @param {Array} values The values that will not match.
22882 * @return {AV.Query} Returns the query, so you can chain this call.
22883 */
22884 notContainedIn: function notContainedIn(key, values) {
22885 this._addCondition(key, '$nin', values);
22886
22887 return this;
22888 },
22889
22890 /**
22891 * Add a constraint to the query that requires a particular key's value to
22892 * contain each one of the provided list of values.
22893 * @param {String} key The key to check. This key's value must be an array.
22894 * @param {Array} values The values that will match.
22895 * @return {AV.Query} Returns the query, so you can chain this call.
22896 */
22897 containsAll: function containsAll(key, values) {
22898 this._addCondition(key, '$all', values);
22899
22900 return this;
22901 },
22902
22903 /**
22904 * Add a constraint for finding objects that contain the given key.
22905 * @param {String} key The key that should exist.
22906 * @return {AV.Query} Returns the query, so you can chain this call.
22907 */
22908 exists: function exists(key) {
22909 this._addCondition(key, '$exists', true);
22910
22911 return this;
22912 },
22913
22914 /**
22915 * Add a constraint for finding objects that do not contain a given key.
22916 * @param {String} key The key that should not exist
22917 * @return {AV.Query} Returns the query, so you can chain this call.
22918 */
22919 doesNotExist: function doesNotExist(key) {
22920 this._addCondition(key, '$exists', false);
22921
22922 return this;
22923 },
22924
22925 /**
22926 * Add a regular expression constraint for finding string values that match
22927 * the provided regular expression.
22928 * This may be slow for large datasets.
22929 * @param {String} key The key that the string to match is stored in.
22930 * @param {RegExp} regex The regular expression pattern to match.
22931 * @return {AV.Query} Returns the query, so you can chain this call.
22932 */
22933 matches: function matches(key, regex, modifiers) {
22934 this._addCondition(key, '$regex', regex);
22935
22936 if (!modifiers) {
22937 modifiers = '';
22938 } // Javascript regex options support mig as inline options but store them
22939 // as properties of the object. We support mi & should migrate them to
22940 // modifiers
22941
22942
22943 if (regex.ignoreCase) {
22944 modifiers += 'i';
22945 }
22946
22947 if (regex.multiline) {
22948 modifiers += 'm';
22949 }
22950
22951 if (modifiers && modifiers.length) {
22952 this._addCondition(key, '$options', modifiers);
22953 }
22954
22955 return this;
22956 },
22957
22958 /**
22959 * Add a constraint that requires that a key's value matches a AV.Query
22960 * constraint.
22961 * @param {String} key The key that the contains the object to match the
22962 * query.
22963 * @param {AV.Query} query The query that should match.
22964 * @return {AV.Query} Returns the query, so you can chain this call.
22965 */
22966 matchesQuery: function matchesQuery(key, query) {
22967 var queryJSON = query._getParams();
22968
22969 queryJSON.className = query.className;
22970
22971 this._addCondition(key, '$inQuery', queryJSON);
22972
22973 return this;
22974 },
22975
22976 /**
22977 * Add a constraint that requires that a key's value not matches a
22978 * AV.Query constraint.
22979 * @param {String} key The key that the contains the object to match the
22980 * query.
22981 * @param {AV.Query} query The query that should not match.
22982 * @return {AV.Query} Returns the query, so you can chain this call.
22983 */
22984 doesNotMatchQuery: function doesNotMatchQuery(key, query) {
22985 var queryJSON = query._getParams();
22986
22987 queryJSON.className = query.className;
22988
22989 this._addCondition(key, '$notInQuery', queryJSON);
22990
22991 return this;
22992 },
22993
22994 /**
22995 * Add a constraint that requires that a key's value matches a value in
22996 * an object returned by a different AV.Query.
22997 * @param {String} key The key that contains the value that is being
22998 * matched.
22999 * @param {String} queryKey The key in the objects returned by the query to
23000 * match against.
23001 * @param {AV.Query} query The query to run.
23002 * @return {AV.Query} Returns the query, so you can chain this call.
23003 */
23004 matchesKeyInQuery: function matchesKeyInQuery(key, queryKey, query) {
23005 var queryJSON = query._getParams();
23006
23007 queryJSON.className = query.className;
23008
23009 this._addCondition(key, '$select', {
23010 key: queryKey,
23011 query: queryJSON
23012 });
23013
23014 return this;
23015 },
23016
23017 /**
23018 * Add a constraint that requires that a key's value not match a value in
23019 * an object returned by a different AV.Query.
23020 * @param {String} key The key that contains the value that is being
23021 * excluded.
23022 * @param {String} queryKey The key in the objects returned by the query to
23023 * match against.
23024 * @param {AV.Query} query The query to run.
23025 * @return {AV.Query} Returns the query, so you can chain this call.
23026 */
23027 doesNotMatchKeyInQuery: function doesNotMatchKeyInQuery(key, queryKey, query) {
23028 var queryJSON = query._getParams();
23029
23030 queryJSON.className = query.className;
23031
23032 this._addCondition(key, '$dontSelect', {
23033 key: queryKey,
23034 query: queryJSON
23035 });
23036
23037 return this;
23038 },
23039
23040 /**
23041 * Add constraint that at least one of the passed in queries matches.
23042 * @param {Array} queries
23043 * @return {AV.Query} Returns the query, so you can chain this call.
23044 * @private
23045 */
23046 _orQuery: function _orQuery(queries) {
23047 var queryJSON = (0, _map.default)(_).call(_, queries, function (q) {
23048 return q._getParams().where;
23049 });
23050 this._where.$or = queryJSON;
23051 return this;
23052 },
23053
23054 /**
23055 * Add constraint that both of the passed in queries matches.
23056 * @param {Array} queries
23057 * @return {AV.Query} Returns the query, so you can chain this call.
23058 * @private
23059 */
23060 _andQuery: function _andQuery(queries) {
23061 var queryJSON = (0, _map.default)(_).call(_, queries, function (q) {
23062 return q._getParams().where;
23063 });
23064 this._where.$and = queryJSON;
23065 return this;
23066 },
23067
23068 /**
23069 * Converts a string into a regex that matches it.
23070 * Surrounding with \Q .. \E does this, we just need to escape \E's in
23071 * the text separately.
23072 * @private
23073 */
23074 _quote: function _quote(s) {
23075 return '\\Q' + s.replace('\\E', '\\E\\\\E\\Q') + '\\E';
23076 },
23077
23078 /**
23079 * Add a constraint for finding string values that contain a provided
23080 * string. This may be slow for large datasets.
23081 * @param {String} key The key that the string to match is stored in.
23082 * @param {String} substring The substring that the value must contain.
23083 * @return {AV.Query} Returns the query, so you can chain this call.
23084 */
23085 contains: function contains(key, value) {
23086 this._addCondition(key, '$regex', this._quote(value));
23087
23088 return this;
23089 },
23090
23091 /**
23092 * Add a constraint for finding string values that start with a provided
23093 * string. This query will use the backend index, so it will be fast even
23094 * for large datasets.
23095 * @param {String} key The key that the string to match is stored in.
23096 * @param {String} prefix The substring that the value must start with.
23097 * @return {AV.Query} Returns the query, so you can chain this call.
23098 */
23099 startsWith: function startsWith(key, value) {
23100 this._addCondition(key, '$regex', '^' + this._quote(value));
23101
23102 return this;
23103 },
23104
23105 /**
23106 * Add a constraint for finding string values that end with a provided
23107 * string. This will be slow for large datasets.
23108 * @param {String} key The key that the string to match is stored in.
23109 * @param {String} suffix The substring that the value must end with.
23110 * @return {AV.Query} Returns the query, so you can chain this call.
23111 */
23112 endsWith: function endsWith(key, value) {
23113 this._addCondition(key, '$regex', this._quote(value) + '$');
23114
23115 return this;
23116 },
23117
23118 /**
23119 * Sorts the results in ascending order by the given key.
23120 *
23121 * @param {String} key The key to order by.
23122 * @return {AV.Query} Returns the query, so you can chain this call.
23123 */
23124 ascending: function ascending(key) {
23125 requires(key, 'undefined is not a valid key');
23126 this._order = key;
23127 return this;
23128 },
23129
23130 /**
23131 * Also sorts the results in ascending order by the given key. The previous sort keys have
23132 * precedence over this key.
23133 *
23134 * @param {String} key The key to order by
23135 * @return {AV.Query} Returns the query so you can chain this call.
23136 */
23137 addAscending: function addAscending(key) {
23138 requires(key, 'undefined is not a valid key');
23139 if (this._order) this._order += ',' + key;else this._order = key;
23140 return this;
23141 },
23142
23143 /**
23144 * Sorts the results in descending order by the given key.
23145 *
23146 * @param {String} key The key to order by.
23147 * @return {AV.Query} Returns the query, so you can chain this call.
23148 */
23149 descending: function descending(key) {
23150 requires(key, 'undefined is not a valid key');
23151 this._order = '-' + key;
23152 return this;
23153 },
23154
23155 /**
23156 * Also sorts the results in descending order by the given key. The previous sort keys have
23157 * precedence over this key.
23158 *
23159 * @param {String} key The key to order by
23160 * @return {AV.Query} Returns the query so you can chain this call.
23161 */
23162 addDescending: function addDescending(key) {
23163 requires(key, 'undefined is not a valid key');
23164 if (this._order) this._order += ',-' + key;else this._order = '-' + key;
23165 return this;
23166 },
23167
23168 /**
23169 * Add a proximity based constraint for finding objects with key point
23170 * values near the point given.
23171 * @param {String} key The key that the AV.GeoPoint is stored in.
23172 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
23173 * @return {AV.Query} Returns the query, so you can chain this call.
23174 */
23175 near: function near(key, point) {
23176 if (!(point instanceof AV.GeoPoint)) {
23177 // Try to cast it to a GeoPoint, so that near("loc", [20,30]) works.
23178 point = new AV.GeoPoint(point);
23179 }
23180
23181 this._addCondition(key, '$nearSphere', point);
23182
23183 return this;
23184 },
23185
23186 /**
23187 * Add a proximity based constraint for finding objects with key point
23188 * values near the point given and within the maximum distance given.
23189 * @param {String} key The key that the AV.GeoPoint is stored in.
23190 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
23191 * @param maxDistance Maximum distance (in radians) of results to return.
23192 * @return {AV.Query} Returns the query, so you can chain this call.
23193 */
23194 withinRadians: function withinRadians(key, point, distance) {
23195 this.near(key, point);
23196
23197 this._addCondition(key, '$maxDistance', distance);
23198
23199 return this;
23200 },
23201
23202 /**
23203 * Add a proximity based constraint for finding objects with key point
23204 * values near the point given and within the maximum distance given.
23205 * Radius of earth used is 3958.8 miles.
23206 * @param {String} key The key that the AV.GeoPoint is stored in.
23207 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
23208 * @param {Number} maxDistance Maximum distance (in miles) of results to
23209 * return.
23210 * @return {AV.Query} Returns the query, so you can chain this call.
23211 */
23212 withinMiles: function withinMiles(key, point, distance) {
23213 return this.withinRadians(key, point, distance / 3958.8);
23214 },
23215
23216 /**
23217 * Add a proximity based constraint for finding objects with key point
23218 * values near the point given and within the maximum distance given.
23219 * Radius of earth used is 6371.0 kilometers.
23220 * @param {String} key The key that the AV.GeoPoint is stored in.
23221 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
23222 * @param {Number} maxDistance Maximum distance (in kilometers) of results
23223 * to return.
23224 * @return {AV.Query} Returns the query, so you can chain this call.
23225 */
23226 withinKilometers: function withinKilometers(key, point, distance) {
23227 return this.withinRadians(key, point, distance / 6371.0);
23228 },
23229
23230 /**
23231 * Add a constraint to the query that requires a particular key's
23232 * coordinates be contained within a given rectangular geographic bounding
23233 * box.
23234 * @param {String} key The key to be constrained.
23235 * @param {AV.GeoPoint} southwest
23236 * The lower-left inclusive corner of the box.
23237 * @param {AV.GeoPoint} northeast
23238 * The upper-right inclusive corner of the box.
23239 * @return {AV.Query} Returns the query, so you can chain this call.
23240 */
23241 withinGeoBox: function withinGeoBox(key, southwest, northeast) {
23242 if (!(southwest instanceof AV.GeoPoint)) {
23243 southwest = new AV.GeoPoint(southwest);
23244 }
23245
23246 if (!(northeast instanceof AV.GeoPoint)) {
23247 northeast = new AV.GeoPoint(northeast);
23248 }
23249
23250 this._addCondition(key, '$within', {
23251 $box: [southwest, northeast]
23252 });
23253
23254 return this;
23255 },
23256
23257 /**
23258 * Include nested AV.Objects for the provided key. You can use dot
23259 * notation to specify which fields in the included object are also fetch.
23260 * @param {String[]} keys The name of the key to include.
23261 * @return {AV.Query} Returns the query, so you can chain this call.
23262 */
23263 include: function include(keys) {
23264 var _this4 = this;
23265
23266 requires(keys, 'undefined is not a valid key');
23267
23268 _.forEach(arguments, function (keys) {
23269 var _context;
23270
23271 _this4._include = (0, _concat.default)(_context = _this4._include).call(_context, ensureArray(keys));
23272 });
23273
23274 return this;
23275 },
23276
23277 /**
23278 * Include the ACL.
23279 * @param {Boolean} [value=true] Whether to include the ACL
23280 * @return {AV.Query} Returns the query, so you can chain this call.
23281 */
23282 includeACL: function includeACL() {
23283 var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
23284 this._includeACL = value;
23285 return this;
23286 },
23287
23288 /**
23289 * Restrict the fields of the returned AV.Objects to include only the
23290 * provided keys. If this is called multiple times, then all of the keys
23291 * specified in each of the calls will be included.
23292 * @param {String[]} keys The names of the keys to include.
23293 * @return {AV.Query} Returns the query, so you can chain this call.
23294 */
23295 select: function select(keys) {
23296 var _this5 = this;
23297
23298 requires(keys, 'undefined is not a valid key');
23299
23300 _.forEach(arguments, function (keys) {
23301 var _context2;
23302
23303 _this5._select = (0, _concat.default)(_context2 = _this5._select).call(_context2, ensureArray(keys));
23304 });
23305
23306 return this;
23307 },
23308
23309 /**
23310 * Iterates over each result of a query, calling a callback for each one. If
23311 * the callback returns a promise, the iteration will not continue until
23312 * that promise has been fulfilled. If the callback returns a rejected
23313 * promise, then iteration will stop with that error. The items are
23314 * processed in an unspecified order. The query may not have any sort order,
23315 * and may not use limit or skip.
23316 * @param callback {Function} Callback that will be called with each result
23317 * of the query.
23318 * @return {Promise} A promise that will be fulfilled once the
23319 * iteration has completed.
23320 */
23321 each: function each(callback) {
23322 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23323
23324 if (this._order || this._skip || this._limit >= 0) {
23325 var error = new Error('Cannot iterate on a query with sort, skip, or limit.');
23326 return _promise.default.reject(error);
23327 }
23328
23329 var query = new AV.Query(this.objectClass); // We can override the batch size from the options.
23330 // This is undocumented, but useful for testing.
23331
23332 query._limit = options.batchSize || 100;
23333 query._where = _.clone(this._where);
23334 query._include = _.clone(this._include);
23335 query.ascending('objectId');
23336 var finished = false;
23337 return continueWhile(function () {
23338 return !finished;
23339 }, function () {
23340 return (0, _find.default)(query).call(query, options).then(function (results) {
23341 var callbacksDone = _promise.default.resolve();
23342
23343 _.each(results, function (result) {
23344 callbacksDone = callbacksDone.then(function () {
23345 return callback(result);
23346 });
23347 });
23348
23349 return callbacksDone.then(function () {
23350 if (results.length >= query._limit) {
23351 query.greaterThan('objectId', results[results.length - 1].id);
23352 } else {
23353 finished = true;
23354 }
23355 });
23356 });
23357 });
23358 },
23359
23360 /**
23361 * Subscribe the changes of this query.
23362 *
23363 * LiveQuery is not included in the default bundle: {@link https://url.leanapp.cn/enable-live-query}.
23364 *
23365 * @since 3.0.0
23366 * @return {AV.LiveQuery} An eventemitter which can be used to get LiveQuery updates;
23367 */
23368 subscribe: function subscribe(options) {
23369 return AV.LiveQuery.init(this, options);
23370 }
23371 });
23372
23373 AV.FriendShipQuery = AV.Query._extend({
23374 _newObject: function _newObject() {
23375 var UserClass = AV.Object._getSubclass('_User');
23376
23377 return new UserClass();
23378 },
23379 _processResult: function _processResult(json) {
23380 if (json && json[this._friendshipTag]) {
23381 var user = json[this._friendshipTag];
23382
23383 if (user.__type === 'Pointer' && user.className === '_User') {
23384 delete user.__type;
23385 delete user.className;
23386 }
23387
23388 return user;
23389 } else {
23390 return null;
23391 }
23392 }
23393 });
23394};
23395
23396/***/ }),
23397/* 559 */
23398/***/ (function(module, exports, __webpack_require__) {
23399
23400"use strict";
23401
23402
23403var _interopRequireDefault = __webpack_require__(1);
23404
23405var _promise = _interopRequireDefault(__webpack_require__(12));
23406
23407var _keys = _interopRequireDefault(__webpack_require__(59));
23408
23409var _ = __webpack_require__(3);
23410
23411var EventEmitter = __webpack_require__(235);
23412
23413var _require = __webpack_require__(30),
23414 inherits = _require.inherits;
23415
23416var _require2 = __webpack_require__(27),
23417 request = _require2.request;
23418
23419var subscribe = function subscribe(queryJSON, subscriptionId) {
23420 return request({
23421 method: 'POST',
23422 path: '/LiveQuery/subscribe',
23423 data: {
23424 query: queryJSON,
23425 id: subscriptionId
23426 }
23427 });
23428};
23429
23430module.exports = function (AV) {
23431 var requireRealtime = function requireRealtime() {
23432 if (!AV._config.realtime) {
23433 throw new Error('LiveQuery not supported. Please use the LiveQuery bundle. https://url.leanapp.cn/enable-live-query');
23434 }
23435 };
23436 /**
23437 * @class
23438 * A LiveQuery, created by {@link AV.Query#subscribe} is an EventEmitter notifies changes of the Query.
23439 * @since 3.0.0
23440 */
23441
23442
23443 AV.LiveQuery = inherits(EventEmitter,
23444 /** @lends AV.LiveQuery.prototype */
23445 {
23446 constructor: function constructor(id, client, queryJSON, subscriptionId) {
23447 var _this = this;
23448
23449 EventEmitter.apply(this);
23450 this.id = id;
23451 this._client = client;
23452
23453 this._client.register(this);
23454
23455 this._queryJSON = queryJSON;
23456 this._subscriptionId = subscriptionId;
23457 this._onMessage = this._dispatch.bind(this);
23458
23459 this._onReconnect = function () {
23460 subscribe(_this._queryJSON, _this._subscriptionId).catch(function (error) {
23461 return console.error("LiveQuery resubscribe error: ".concat(error.message));
23462 });
23463 };
23464
23465 client.on('message', this._onMessage);
23466 client.on('reconnect', this._onReconnect);
23467 },
23468 _dispatch: function _dispatch(message) {
23469 var _this2 = this;
23470
23471 message.forEach(function (_ref) {
23472 var op = _ref.op,
23473 object = _ref.object,
23474 queryId = _ref.query_id,
23475 updatedKeys = _ref.updatedKeys;
23476 if (queryId !== _this2.id) return;
23477 var target = AV.parseJSON(_.extend({
23478 __type: object.className === '_File' ? 'File' : 'Object'
23479 }, object));
23480
23481 if (updatedKeys) {
23482 /**
23483 * An existing AV.Object which fulfills the Query you subscribe is updated.
23484 * @event AV.LiveQuery#update
23485 * @param {AV.Object|AV.File} target updated object
23486 * @param {String[]} updatedKeys updated keys
23487 */
23488
23489 /**
23490 * An existing AV.Object which doesn't fulfill the Query is updated and now it fulfills the Query.
23491 * @event AV.LiveQuery#enter
23492 * @param {AV.Object|AV.File} target updated object
23493 * @param {String[]} updatedKeys updated keys
23494 */
23495
23496 /**
23497 * An existing AV.Object which fulfills the Query is updated and now it doesn't fulfill the Query.
23498 * @event AV.LiveQuery#leave
23499 * @param {AV.Object|AV.File} target updated object
23500 * @param {String[]} updatedKeys updated keys
23501 */
23502 _this2.emit(op, target, updatedKeys);
23503 } else {
23504 /**
23505 * A new AV.Object which fulfills the Query you subscribe is created.
23506 * @event AV.LiveQuery#create
23507 * @param {AV.Object|AV.File} target updated object
23508 */
23509
23510 /**
23511 * An existing AV.Object which fulfills the Query you subscribe is deleted.
23512 * @event AV.LiveQuery#delete
23513 * @param {AV.Object|AV.File} target updated object
23514 */
23515 _this2.emit(op, target);
23516 }
23517 });
23518 },
23519
23520 /**
23521 * unsubscribe the query
23522 *
23523 * @return {Promise}
23524 */
23525 unsubscribe: function unsubscribe() {
23526 var client = this._client;
23527 client.off('message', this._onMessage);
23528 client.off('reconnect', this._onReconnect);
23529 client.deregister(this);
23530 return request({
23531 method: 'POST',
23532 path: '/LiveQuery/unsubscribe',
23533 data: {
23534 id: client.id,
23535 query_id: this.id
23536 }
23537 });
23538 }
23539 },
23540 /** @lends AV.LiveQuery */
23541 {
23542 init: function init(query) {
23543 var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
23544 _ref2$subscriptionId = _ref2.subscriptionId,
23545 userDefinedSubscriptionId = _ref2$subscriptionId === void 0 ? AV._getSubscriptionId() : _ref2$subscriptionId;
23546
23547 requireRealtime();
23548 if (!(query instanceof AV.Query)) throw new TypeError('LiveQuery must be inited with a Query');
23549 return _promise.default.resolve(userDefinedSubscriptionId).then(function (subscriptionId) {
23550 return AV._config.realtime.createLiveQueryClient(subscriptionId).then(function (liveQueryClient) {
23551 var _query$_getParams = query._getParams(),
23552 where = _query$_getParams.where,
23553 keys = (0, _keys.default)(_query$_getParams),
23554 returnACL = _query$_getParams.returnACL;
23555
23556 var queryJSON = {
23557 where: where,
23558 keys: keys,
23559 returnACL: returnACL,
23560 className: query.className
23561 };
23562 var promise = subscribe(queryJSON, subscriptionId).then(function (_ref3) {
23563 var queryId = _ref3.query_id;
23564 return new AV.LiveQuery(queryId, liveQueryClient, queryJSON, subscriptionId);
23565 }).finally(function () {
23566 liveQueryClient.deregister(promise);
23567 });
23568 liveQueryClient.register(promise);
23569 return promise;
23570 });
23571 });
23572 },
23573
23574 /**
23575 * Pause the LiveQuery connection. This is useful to deactivate the SDK when the app is swtiched to background.
23576 * @static
23577 * @return void
23578 */
23579 pause: function pause() {
23580 requireRealtime();
23581 return AV._config.realtime.pause();
23582 },
23583
23584 /**
23585 * Resume the LiveQuery connection. All subscriptions will be restored after reconnection.
23586 * @static
23587 * @return void
23588 */
23589 resume: function resume() {
23590 requireRealtime();
23591 return AV._config.realtime.resume();
23592 }
23593 });
23594};
23595
23596/***/ }),
23597/* 560 */
23598/***/ (function(module, exports, __webpack_require__) {
23599
23600"use strict";
23601
23602
23603var _ = __webpack_require__(3);
23604
23605var _require = __webpack_require__(30),
23606 tap = _require.tap;
23607
23608module.exports = function (AV) {
23609 /**
23610 * @class
23611 * @example
23612 * AV.Captcha.request().then(captcha => {
23613 * captcha.bind({
23614 * textInput: 'code', // the id for textInput
23615 * image: 'captcha',
23616 * verifyButton: 'verify',
23617 * }, {
23618 * success: (validateCode) => {}, // next step
23619 * error: (error) => {}, // present error.message to user
23620 * });
23621 * });
23622 */
23623 AV.Captcha = function Captcha(options, authOptions) {
23624 this._options = options;
23625 this._authOptions = authOptions;
23626 /**
23627 * The image url of the captcha
23628 * @type string
23629 */
23630
23631 this.url = undefined;
23632 /**
23633 * The captchaToken of the captcha.
23634 * @type string
23635 */
23636
23637 this.captchaToken = undefined;
23638 /**
23639 * The validateToken of the captcha.
23640 * @type string
23641 */
23642
23643 this.validateToken = undefined;
23644 };
23645 /**
23646 * Refresh the captcha
23647 * @return {Promise.<string>} a new capcha url
23648 */
23649
23650
23651 AV.Captcha.prototype.refresh = function refresh() {
23652 var _this = this;
23653
23654 return AV.Cloud._requestCaptcha(this._options, this._authOptions).then(function (_ref) {
23655 var captchaToken = _ref.captchaToken,
23656 url = _ref.url;
23657
23658 _.extend(_this, {
23659 captchaToken: captchaToken,
23660 url: url
23661 });
23662
23663 return url;
23664 });
23665 };
23666 /**
23667 * Verify the captcha
23668 * @param {String} code The code from user input
23669 * @return {Promise.<string>} validateToken if the code is valid
23670 */
23671
23672
23673 AV.Captcha.prototype.verify = function verify(code) {
23674 var _this2 = this;
23675
23676 return AV.Cloud.verifyCaptcha(code, this.captchaToken).then(tap(function (validateToken) {
23677 return _this2.validateToken = validateToken;
23678 }));
23679 };
23680
23681 if (false) {
23682 /**
23683 * Bind the captcha to HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
23684 * @param [elements]
23685 * @param {String|HTMLInputElement} [elements.textInput] An input element typed text, or the id for the element.
23686 * @param {String|HTMLImageElement} [elements.image] An image element, or the id for the element.
23687 * @param {String|HTMLElement} [elements.verifyButton] A button element, or the id for the element.
23688 * @param [callbacks]
23689 * @param {Function} [callbacks.success] Success callback will be called if the code is verified. The param `validateCode` can be used for further SMS request.
23690 * @param {Function} [callbacks.error] Error callback will be called if something goes wrong, detailed in param `error.message`.
23691 */
23692 AV.Captcha.prototype.bind = function bind(_ref2, _ref3) {
23693 var _this3 = this;
23694
23695 var textInput = _ref2.textInput,
23696 image = _ref2.image,
23697 verifyButton = _ref2.verifyButton;
23698 var success = _ref3.success,
23699 error = _ref3.error;
23700
23701 if (typeof textInput === 'string') {
23702 textInput = document.getElementById(textInput);
23703 if (!textInput) throw new Error("textInput with id ".concat(textInput, " not found"));
23704 }
23705
23706 if (typeof image === 'string') {
23707 image = document.getElementById(image);
23708 if (!image) throw new Error("image with id ".concat(image, " not found"));
23709 }
23710
23711 if (typeof verifyButton === 'string') {
23712 verifyButton = document.getElementById(verifyButton);
23713 if (!verifyButton) throw new Error("verifyButton with id ".concat(verifyButton, " not found"));
23714 }
23715
23716 this.__refresh = function () {
23717 return _this3.refresh().then(function (url) {
23718 image.src = url;
23719
23720 if (textInput) {
23721 textInput.value = '';
23722 textInput.focus();
23723 }
23724 }).catch(function (err) {
23725 return console.warn("refresh captcha fail: ".concat(err.message));
23726 });
23727 };
23728
23729 if (image) {
23730 this.__image = image;
23731 image.src = this.url;
23732 image.addEventListener('click', this.__refresh);
23733 }
23734
23735 this.__verify = function () {
23736 var code = textInput.value;
23737
23738 _this3.verify(code).catch(function (err) {
23739 _this3.__refresh();
23740
23741 throw err;
23742 }).then(success, error).catch(function (err) {
23743 return console.warn("verify captcha fail: ".concat(err.message));
23744 });
23745 };
23746
23747 if (textInput && verifyButton) {
23748 this.__verifyButton = verifyButton;
23749 verifyButton.addEventListener('click', this.__verify);
23750 }
23751 };
23752 /**
23753 * unbind the captcha from HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
23754 */
23755
23756
23757 AV.Captcha.prototype.unbind = function unbind() {
23758 if (this.__image) this.__image.removeEventListener('click', this.__refresh);
23759 if (this.__verifyButton) this.__verifyButton.removeEventListener('click', this.__verify);
23760 };
23761 }
23762 /**
23763 * Request a captcha
23764 * @param [options]
23765 * @param {Number} [options.width] width(px) of the captcha, ranged 60-200
23766 * @param {Number} [options.height] height(px) of the captcha, ranged 30-100
23767 * @param {Number} [options.size=4] length of the captcha, ranged 3-6. MasterKey required.
23768 * @param {Number} [options.ttl=60] time to live(s), ranged 10-180. MasterKey required.
23769 * @return {Promise.<AV.Captcha>}
23770 */
23771
23772
23773 AV.Captcha.request = function (options, authOptions) {
23774 var captcha = new AV.Captcha(options, authOptions);
23775 return captcha.refresh().then(function () {
23776 return captcha;
23777 });
23778 };
23779};
23780
23781/***/ }),
23782/* 561 */
23783/***/ (function(module, exports, __webpack_require__) {
23784
23785"use strict";
23786
23787
23788var _interopRequireDefault = __webpack_require__(1);
23789
23790var _promise = _interopRequireDefault(__webpack_require__(12));
23791
23792var _ = __webpack_require__(3);
23793
23794var _require = __webpack_require__(27),
23795 _request = _require._request,
23796 request = _require.request;
23797
23798module.exports = function (AV) {
23799 /**
23800 * Contains functions for calling and declaring
23801 * <p><strong><em>
23802 * Some functions are only available from Cloud Code.
23803 * </em></strong></p>
23804 *
23805 * @namespace
23806 * @borrows AV.Captcha.request as requestCaptcha
23807 */
23808 AV.Cloud = AV.Cloud || {};
23809
23810 _.extend(AV.Cloud,
23811 /** @lends AV.Cloud */
23812 {
23813 /**
23814 * Makes a call to a cloud function.
23815 * @param {String} name The function name.
23816 * @param {Object} [data] The parameters to send to the cloud function.
23817 * @param {AuthOptions} [options]
23818 * @return {Promise} A promise that will be resolved with the result
23819 * of the function.
23820 */
23821 run: function run(name, data, options) {
23822 return request({
23823 service: 'engine',
23824 method: 'POST',
23825 path: "/functions/".concat(name),
23826 data: AV._encode(data, null, true),
23827 authOptions: options
23828 }).then(function (resp) {
23829 return AV._decode(resp).result;
23830 });
23831 },
23832
23833 /**
23834 * Makes a call to a cloud function, you can send {AV.Object} as param or a field of param; the response
23835 * from server will also be parsed as an {AV.Object}, array of {AV.Object}, or object includes {AV.Object}
23836 * @param {String} name The function name.
23837 * @param {Object} [data] The parameters to send to the cloud function.
23838 * @param {AuthOptions} [options]
23839 * @return {Promise} A promise that will be resolved with the result of the function.
23840 */
23841 rpc: function rpc(name, data, options) {
23842 if (_.isArray(data)) {
23843 return _promise.default.reject(new Error("Can't pass Array as the param of rpc function in JavaScript SDK."));
23844 }
23845
23846 return request({
23847 service: 'engine',
23848 method: 'POST',
23849 path: "/call/".concat(name),
23850 data: AV._encodeObjectOrArray(data),
23851 authOptions: options
23852 }).then(function (resp) {
23853 return AV._decode(resp).result;
23854 });
23855 },
23856
23857 /**
23858 * Make a call to request server date time.
23859 * @return {Promise.<Date>} A promise that will be resolved with the result
23860 * of the function.
23861 * @since 0.5.9
23862 */
23863 getServerDate: function getServerDate() {
23864 return _request('date', null, null, 'GET').then(function (resp) {
23865 return AV._decode(resp);
23866 });
23867 },
23868
23869 /**
23870 * Makes a call to request an sms code for operation verification.
23871 * @param {String|Object} data The mobile phone number string or a JSON
23872 * object that contains mobilePhoneNumber,template,sign,op,ttl,name etc.
23873 * @param {String} data.mobilePhoneNumber
23874 * @param {String} [data.template] sms template name
23875 * @param {String} [data.sign] sms signature name
23876 * @param {String} [data.smsType] sending code by `sms` (default) or `voice` call
23877 * @param {SMSAuthOptions} [options]
23878 * @return {Promise} A promise that will be resolved if the request succeed
23879 */
23880 requestSmsCode: function requestSmsCode(data) {
23881 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23882
23883 if (_.isString(data)) {
23884 data = {
23885 mobilePhoneNumber: data
23886 };
23887 }
23888
23889 if (!data.mobilePhoneNumber) {
23890 throw new Error('Missing mobilePhoneNumber.');
23891 }
23892
23893 if (options.validateToken) {
23894 data = _.extend({}, data, {
23895 validate_token: options.validateToken
23896 });
23897 }
23898
23899 return _request('requestSmsCode', null, null, 'POST', data, options);
23900 },
23901
23902 /**
23903 * Makes a call to verify sms code that sent by AV.Cloud.requestSmsCode
23904 * @param {String} code The sms code sent by AV.Cloud.requestSmsCode
23905 * @param {phone} phone The mobile phoner number.
23906 * @return {Promise} A promise that will be resolved with the result
23907 * of the function.
23908 */
23909 verifySmsCode: function verifySmsCode(code, phone) {
23910 if (!code) throw new Error('Missing sms code.');
23911 var params = {};
23912
23913 if (_.isString(phone)) {
23914 params['mobilePhoneNumber'] = phone;
23915 }
23916
23917 return _request('verifySmsCode', code, null, 'POST', params);
23918 },
23919 _requestCaptcha: function _requestCaptcha(options, authOptions) {
23920 return _request('requestCaptcha', null, null, 'GET', options, authOptions).then(function (_ref) {
23921 var url = _ref.captcha_url,
23922 captchaToken = _ref.captcha_token;
23923 return {
23924 captchaToken: captchaToken,
23925 url: url
23926 };
23927 });
23928 },
23929
23930 /**
23931 * Request a captcha.
23932 */
23933 requestCaptcha: AV.Captcha.request,
23934
23935 /**
23936 * Verify captcha code. This is the low-level API for captcha.
23937 * Checkout {@link AV.Captcha} for high abstract APIs.
23938 * @param {String} code the code from user input
23939 * @param {String} captchaToken captchaToken returned by {@link AV.Cloud.requestCaptcha}
23940 * @return {Promise.<String>} validateToken if the code is valid
23941 */
23942 verifyCaptcha: function verifyCaptcha(code, captchaToken) {
23943 return _request('verifyCaptcha', null, null, 'POST', {
23944 captcha_code: code,
23945 captcha_token: captchaToken
23946 }).then(function (_ref2) {
23947 var validateToken = _ref2.validate_token;
23948 return validateToken;
23949 });
23950 }
23951 });
23952};
23953
23954/***/ }),
23955/* 562 */
23956/***/ (function(module, exports, __webpack_require__) {
23957
23958"use strict";
23959
23960
23961var request = __webpack_require__(27).request;
23962
23963module.exports = function (AV) {
23964 AV.Installation = AV.Object.extend('_Installation');
23965 /**
23966 * @namespace
23967 */
23968
23969 AV.Push = AV.Push || {};
23970 /**
23971 * Sends a push notification.
23972 * @param {Object} data The data of the push notification.
23973 * @param {String[]} [data.channels] An Array of channels to push to.
23974 * @param {Date} [data.push_time] A Date object for when to send the push.
23975 * @param {Date} [data.expiration_time] A Date object for when to expire
23976 * the push.
23977 * @param {Number} [data.expiration_interval] The seconds from now to expire the push.
23978 * @param {Number} [data.flow_control] The clients to notify per second
23979 * @param {AV.Query} [data.where] An AV.Query over AV.Installation that is used to match
23980 * a set of installations to push to.
23981 * @param {String} [data.cql] A CQL statement over AV.Installation that is used to match
23982 * a set of installations to push to.
23983 * @param {Object} data.data The data to send as part of the push.
23984 More details: https://url.leanapp.cn/pushData
23985 * @param {AuthOptions} [options]
23986 * @return {Promise}
23987 */
23988
23989 AV.Push.send = function (data, options) {
23990 if (data.where) {
23991 data.where = data.where._getParams().where;
23992 }
23993
23994 if (data.where && data.cql) {
23995 throw new Error("Both where and cql can't be set");
23996 }
23997
23998 if (data.push_time) {
23999 data.push_time = data.push_time.toJSON();
24000 }
24001
24002 if (data.expiration_time) {
24003 data.expiration_time = data.expiration_time.toJSON();
24004 }
24005
24006 if (data.expiration_time && data.expiration_interval) {
24007 throw new Error("Both expiration_time and expiration_interval can't be set");
24008 }
24009
24010 return request({
24011 service: 'push',
24012 method: 'POST',
24013 path: '/push',
24014 data: data,
24015 authOptions: options
24016 });
24017 };
24018};
24019
24020/***/ }),
24021/* 563 */
24022/***/ (function(module, exports, __webpack_require__) {
24023
24024"use strict";
24025
24026
24027var _interopRequireDefault = __webpack_require__(1);
24028
24029var _promise = _interopRequireDefault(__webpack_require__(12));
24030
24031var _typeof2 = _interopRequireDefault(__webpack_require__(73));
24032
24033var _ = __webpack_require__(3);
24034
24035var AVRequest = __webpack_require__(27)._request;
24036
24037var _require = __webpack_require__(30),
24038 getSessionToken = _require.getSessionToken;
24039
24040module.exports = function (AV) {
24041 var getUser = function getUser() {
24042 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
24043 var sessionToken = getSessionToken(options);
24044
24045 if (sessionToken) {
24046 return AV.User._fetchUserBySessionToken(getSessionToken(options));
24047 }
24048
24049 return AV.User.currentAsync();
24050 };
24051
24052 var getUserPointer = function getUserPointer(options) {
24053 return getUser(options).then(function (currUser) {
24054 return AV.Object.createWithoutData('_User', currUser.id)._toPointer();
24055 });
24056 };
24057 /**
24058 * Contains functions to deal with Status in LeanCloud.
24059 * @class
24060 */
24061
24062
24063 AV.Status = function (imageUrl, message) {
24064 this.data = {};
24065 this.inboxType = 'default';
24066 this.query = null;
24067
24068 if (imageUrl && (0, _typeof2.default)(imageUrl) === 'object') {
24069 this.data = imageUrl;
24070 } else {
24071 if (imageUrl) {
24072 this.data.image = imageUrl;
24073 }
24074
24075 if (message) {
24076 this.data.message = message;
24077 }
24078 }
24079
24080 return this;
24081 };
24082
24083 _.extend(AV.Status.prototype,
24084 /** @lends AV.Status.prototype */
24085 {
24086 /**
24087 * Gets the value of an attribute in status data.
24088 * @param {String} attr The string name of an attribute.
24089 */
24090 get: function get(attr) {
24091 return this.data[attr];
24092 },
24093
24094 /**
24095 * Sets a hash of model attributes on the status data.
24096 * @param {String} key The key to set.
24097 * @param {any} value The value to give it.
24098 */
24099 set: function set(key, value) {
24100 this.data[key] = value;
24101 return this;
24102 },
24103
24104 /**
24105 * Destroy this status,then it will not be avaiable in other user's inboxes.
24106 * @param {AuthOptions} options
24107 * @return {Promise} A promise that is fulfilled when the destroy
24108 * completes.
24109 */
24110 destroy: function destroy(options) {
24111 if (!this.id) return _promise.default.reject(new Error('The status id is not exists.'));
24112 var request = AVRequest('statuses', null, this.id, 'DELETE', options);
24113 return request;
24114 },
24115
24116 /**
24117 * Cast the AV.Status object to an AV.Object pointer.
24118 * @return {AV.Object} A AV.Object pointer.
24119 */
24120 toObject: function toObject() {
24121 if (!this.id) return null;
24122 return AV.Object.createWithoutData('_Status', this.id);
24123 },
24124 _getDataJSON: function _getDataJSON() {
24125 var json = _.clone(this.data);
24126
24127 return AV._encode(json);
24128 },
24129
24130 /**
24131 * Send a status by a AV.Query object.
24132 * @since 0.3.0
24133 * @param {AuthOptions} options
24134 * @return {Promise} A promise that is fulfilled when the send
24135 * completes.
24136 * @example
24137 * // send a status to male users
24138 * var status = new AVStatus('image url', 'a message');
24139 * status.query = new AV.Query('_User');
24140 * status.query.equalTo('gender', 'male');
24141 * status.send().then(function(){
24142 * //send status successfully.
24143 * }, function(err){
24144 * //an error threw.
24145 * console.dir(err);
24146 * });
24147 */
24148 send: function send() {
24149 var _this = this;
24150
24151 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
24152
24153 if (!getSessionToken(options) && !AV.User.current()) {
24154 throw new Error('Please signin an user.');
24155 }
24156
24157 if (!this.query) {
24158 return AV.Status.sendStatusToFollowers(this, options);
24159 }
24160
24161 return getUserPointer(options).then(function (currUser) {
24162 var query = _this.query._getParams();
24163
24164 query.className = _this.query.className;
24165 var data = {};
24166 data.query = query;
24167 _this.data = _this.data || {};
24168 _this.data.source = _this.data.source || currUser;
24169 data.data = _this._getDataJSON();
24170 data.inboxType = _this.inboxType || 'default';
24171 return AVRequest('statuses', null, null, 'POST', data, options);
24172 }).then(function (response) {
24173 _this.id = response.objectId;
24174 _this.createdAt = AV._parseDate(response.createdAt);
24175 return _this;
24176 });
24177 },
24178 _finishFetch: function _finishFetch(serverData) {
24179 this.id = serverData.objectId;
24180 this.createdAt = AV._parseDate(serverData.createdAt);
24181 this.updatedAt = AV._parseDate(serverData.updatedAt);
24182 this.messageId = serverData.messageId;
24183 delete serverData.messageId;
24184 delete serverData.objectId;
24185 delete serverData.createdAt;
24186 delete serverData.updatedAt;
24187 this.data = AV._decode(serverData);
24188 }
24189 });
24190 /**
24191 * Send a status to current signined user's followers.
24192 * @since 0.3.0
24193 * @param {AV.Status} status A status object to be send to followers.
24194 * @param {AuthOptions} options
24195 * @return {Promise} A promise that is fulfilled when the send
24196 * completes.
24197 * @example
24198 * var status = new AVStatus('image url', 'a message');
24199 * AV.Status.sendStatusToFollowers(status).then(function(){
24200 * //send status successfully.
24201 * }, function(err){
24202 * //an error threw.
24203 * console.dir(err);
24204 * });
24205 */
24206
24207
24208 AV.Status.sendStatusToFollowers = function (status) {
24209 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24210
24211 if (!getSessionToken(options) && !AV.User.current()) {
24212 throw new Error('Please signin an user.');
24213 }
24214
24215 return getUserPointer(options).then(function (currUser) {
24216 var query = {};
24217 query.className = '_Follower';
24218 query.keys = 'follower';
24219 query.where = {
24220 user: currUser
24221 };
24222 var data = {};
24223 data.query = query;
24224 status.data = status.data || {};
24225 status.data.source = status.data.source || currUser;
24226 data.data = status._getDataJSON();
24227 data.inboxType = status.inboxType || 'default';
24228 var request = AVRequest('statuses', null, null, 'POST', data, options);
24229 return request.then(function (response) {
24230 status.id = response.objectId;
24231 status.createdAt = AV._parseDate(response.createdAt);
24232 return status;
24233 });
24234 });
24235 };
24236 /**
24237 * <p>Send a status from current signined user to other user's private status inbox.</p>
24238 * @since 0.3.0
24239 * @param {AV.Status} status A status object to be send to followers.
24240 * @param {String} target The target user or user's objectId.
24241 * @param {AuthOptions} options
24242 * @return {Promise} A promise that is fulfilled when the send
24243 * completes.
24244 * @example
24245 * // send a private status to user '52e84e47e4b0f8de283b079b'
24246 * var status = new AVStatus('image url', 'a message');
24247 * AV.Status.sendPrivateStatus(status, '52e84e47e4b0f8de283b079b').then(function(){
24248 * //send status successfully.
24249 * }, function(err){
24250 * //an error threw.
24251 * console.dir(err);
24252 * });
24253 */
24254
24255
24256 AV.Status.sendPrivateStatus = function (status, target) {
24257 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
24258
24259 if (!getSessionToken(options) && !AV.User.current()) {
24260 throw new Error('Please signin an user.');
24261 }
24262
24263 if (!target) {
24264 throw new Error('Invalid target user.');
24265 }
24266
24267 var userObjectId = _.isString(target) ? target : target.id;
24268
24269 if (!userObjectId) {
24270 throw new Error('Invalid target user.');
24271 }
24272
24273 return getUserPointer(options).then(function (currUser) {
24274 var query = {};
24275 query.className = '_User';
24276 query.where = {
24277 objectId: userObjectId
24278 };
24279 var data = {};
24280 data.query = query;
24281 status.data = status.data || {};
24282 status.data.source = status.data.source || currUser;
24283 data.data = status._getDataJSON();
24284 data.inboxType = 'private';
24285 status.inboxType = 'private';
24286 var request = AVRequest('statuses', null, null, 'POST', data, options);
24287 return request.then(function (response) {
24288 status.id = response.objectId;
24289 status.createdAt = AV._parseDate(response.createdAt);
24290 return status;
24291 });
24292 });
24293 };
24294 /**
24295 * Count unread statuses in someone's inbox.
24296 * @since 0.3.0
24297 * @param {AV.User} owner The status owner.
24298 * @param {String} inboxType The inbox type, 'default' by default.
24299 * @param {AuthOptions} options
24300 * @return {Promise} A promise that is fulfilled when the count
24301 * completes.
24302 * @example
24303 * AV.Status.countUnreadStatuses(AV.User.current()).then(function(response){
24304 * console.log(response.unread); //unread statuses number.
24305 * console.log(response.total); //total statuses number.
24306 * });
24307 */
24308
24309
24310 AV.Status.countUnreadStatuses = function (owner) {
24311 var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
24312 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
24313 if (!_.isString(inboxType)) options = inboxType;
24314
24315 if (!getSessionToken(options) && owner == null && !AV.User.current()) {
24316 throw new Error('Please signin an user or pass the owner objectId.');
24317 }
24318
24319 return _promise.default.resolve(owner || getUser(options)).then(function (owner) {
24320 var params = {};
24321 params.inboxType = AV._encode(inboxType);
24322 params.owner = AV._encode(owner);
24323 return AVRequest('subscribe/statuses/count', null, null, 'GET', params, options);
24324 });
24325 };
24326 /**
24327 * reset unread statuses count in someone's inbox.
24328 * @since 2.1.0
24329 * @param {AV.User} owner The status owner.
24330 * @param {String} inboxType The inbox type, 'default' by default.
24331 * @param {AuthOptions} options
24332 * @return {Promise} A promise that is fulfilled when the reset
24333 * completes.
24334 * @example
24335 * AV.Status.resetUnreadCount(AV.User.current()).then(function(response){
24336 * console.log(response.unread); //unread statuses number.
24337 * console.log(response.total); //total statuses number.
24338 * });
24339 */
24340
24341
24342 AV.Status.resetUnreadCount = function (owner) {
24343 var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
24344 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
24345 if (!_.isString(inboxType)) options = inboxType;
24346
24347 if (!getSessionToken(options) && owner == null && !AV.User.current()) {
24348 throw new Error('Please signin an user or pass the owner objectId.');
24349 }
24350
24351 return _promise.default.resolve(owner || getUser(options)).then(function (owner) {
24352 var params = {};
24353 params.inboxType = AV._encode(inboxType);
24354 params.owner = AV._encode(owner);
24355 return AVRequest('subscribe/statuses/resetUnreadCount', null, null, 'POST', params, options);
24356 });
24357 };
24358 /**
24359 * Create a status query to find someone's published statuses.
24360 * @since 0.3.0
24361 * @param {AV.User} source The status source, typically the publisher.
24362 * @return {AV.Query} The query object for status.
24363 * @example
24364 * //Find current user's published statuses.
24365 * var query = AV.Status.statusQuery(AV.User.current());
24366 * query.find().then(function(statuses){
24367 * //process statuses
24368 * });
24369 */
24370
24371
24372 AV.Status.statusQuery = function (source) {
24373 var query = new AV.Query('_Status');
24374
24375 if (source) {
24376 query.equalTo('source', source);
24377 }
24378
24379 return query;
24380 };
24381 /**
24382 * <p>AV.InboxQuery defines a query that is used to fetch somebody's inbox statuses.</p>
24383 * @class
24384 */
24385
24386
24387 AV.InboxQuery = AV.Query._extend(
24388 /** @lends AV.InboxQuery.prototype */
24389 {
24390 _objectClass: AV.Status,
24391 _sinceId: 0,
24392 _maxId: 0,
24393 _inboxType: 'default',
24394 _owner: null,
24395 _newObject: function _newObject() {
24396 return new AV.Status();
24397 },
24398 _createRequest: function _createRequest(params, options) {
24399 return AV.InboxQuery.__super__._createRequest.call(this, params, options, '/subscribe/statuses');
24400 },
24401
24402 /**
24403 * Sets the messageId of results to skip before returning any results.
24404 * This is useful for pagination.
24405 * Default is zero.
24406 * @param {Number} n the mesage id.
24407 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24408 */
24409 sinceId: function sinceId(id) {
24410 this._sinceId = id;
24411 return this;
24412 },
24413
24414 /**
24415 * Sets the maximal messageId of results。
24416 * This is useful for pagination.
24417 * Default is zero that is no limition.
24418 * @param {Number} n the mesage id.
24419 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24420 */
24421 maxId: function maxId(id) {
24422 this._maxId = id;
24423 return this;
24424 },
24425
24426 /**
24427 * Sets the owner of the querying inbox.
24428 * @param {AV.User} owner The inbox owner.
24429 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24430 */
24431 owner: function owner(_owner) {
24432 this._owner = _owner;
24433 return this;
24434 },
24435
24436 /**
24437 * Sets the querying inbox type.default is 'default'.
24438 * @param {String} type The inbox type.
24439 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24440 */
24441 inboxType: function inboxType(type) {
24442 this._inboxType = type;
24443 return this;
24444 },
24445 _getParams: function _getParams() {
24446 var params = AV.InboxQuery.__super__._getParams.call(this);
24447
24448 params.owner = AV._encode(this._owner);
24449 params.inboxType = AV._encode(this._inboxType);
24450 params.sinceId = AV._encode(this._sinceId);
24451 params.maxId = AV._encode(this._maxId);
24452 return params;
24453 }
24454 });
24455 /**
24456 * Create a inbox status query to find someone's inbox statuses.
24457 * @since 0.3.0
24458 * @param {AV.User} owner The inbox's owner
24459 * @param {String} inboxType The inbox type,'default' by default.
24460 * @return {AV.InboxQuery} The inbox query object.
24461 * @see AV.InboxQuery
24462 * @example
24463 * //Find current user's default inbox statuses.
24464 * var query = AV.Status.inboxQuery(AV.User.current());
24465 * //find the statuses after the last message id
24466 * query.sinceId(lastMessageId);
24467 * query.find().then(function(statuses){
24468 * //process statuses
24469 * });
24470 */
24471
24472 AV.Status.inboxQuery = function (owner, inboxType) {
24473 var query = new AV.InboxQuery(AV.Status);
24474
24475 if (owner) {
24476 query._owner = owner;
24477 }
24478
24479 if (inboxType) {
24480 query._inboxType = inboxType;
24481 }
24482
24483 return query;
24484 };
24485};
24486
24487/***/ }),
24488/* 564 */
24489/***/ (function(module, exports, __webpack_require__) {
24490
24491"use strict";
24492
24493
24494var _interopRequireDefault = __webpack_require__(1);
24495
24496var _stringify = _interopRequireDefault(__webpack_require__(36));
24497
24498var _map = _interopRequireDefault(__webpack_require__(35));
24499
24500var _ = __webpack_require__(3);
24501
24502var AVRequest = __webpack_require__(27)._request;
24503
24504module.exports = function (AV) {
24505 /**
24506 * A builder to generate sort string for app searching.For example:
24507 * @class
24508 * @since 0.5.1
24509 * @example
24510 * var builder = new AV.SearchSortBuilder();
24511 * builder.ascending('key1').descending('key2','max');
24512 * var query = new AV.SearchQuery('Player');
24513 * query.sortBy(builder);
24514 * query.find().then();
24515 */
24516 AV.SearchSortBuilder = function () {
24517 this._sortFields = [];
24518 };
24519
24520 _.extend(AV.SearchSortBuilder.prototype,
24521 /** @lends AV.SearchSortBuilder.prototype */
24522 {
24523 _addField: function _addField(key, order, mode, missing) {
24524 var field = {};
24525 field[key] = {
24526 order: order || 'asc',
24527 mode: mode || 'avg',
24528 missing: '_' + (missing || 'last')
24529 };
24530
24531 this._sortFields.push(field);
24532
24533 return this;
24534 },
24535
24536 /**
24537 * Sorts the results in ascending order by the given key and options.
24538 *
24539 * @param {String} key The key to order by.
24540 * @param {String} mode The sort mode, default is 'avg', you can choose
24541 * 'max' or 'min' too.
24542 * @param {String} missing The missing key behaviour, default is 'last',
24543 * you can choose 'first' too.
24544 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
24545 */
24546 ascending: function ascending(key, mode, missing) {
24547 return this._addField(key, 'asc', mode, missing);
24548 },
24549
24550 /**
24551 * Sorts the results in descending order by the given key and options.
24552 *
24553 * @param {String} key The key to order by.
24554 * @param {String} mode The sort mode, default is 'avg', you can choose
24555 * 'max' or 'min' too.
24556 * @param {String} missing The missing key behaviour, default is 'last',
24557 * you can choose 'first' too.
24558 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
24559 */
24560 descending: function descending(key, mode, missing) {
24561 return this._addField(key, 'desc', mode, missing);
24562 },
24563
24564 /**
24565 * Add a proximity based constraint for finding objects with key point
24566 * values near the point given.
24567 * @param {String} key The key that the AV.GeoPoint is stored in.
24568 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
24569 * @param {Object} options The other options such as mode,order, unit etc.
24570 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
24571 */
24572 whereNear: function whereNear(key, point, options) {
24573 options = options || {};
24574 var field = {};
24575 var geo = {
24576 lat: point.latitude,
24577 lon: point.longitude
24578 };
24579 var m = {
24580 order: options.order || 'asc',
24581 mode: options.mode || 'avg',
24582 unit: options.unit || 'km'
24583 };
24584 m[key] = geo;
24585 field['_geo_distance'] = m;
24586
24587 this._sortFields.push(field);
24588
24589 return this;
24590 },
24591
24592 /**
24593 * Build a sort string by configuration.
24594 * @return {String} the sort string.
24595 */
24596 build: function build() {
24597 return (0, _stringify.default)(AV._encode(this._sortFields));
24598 }
24599 });
24600 /**
24601 * App searching query.Use just like AV.Query:
24602 *
24603 * Visit <a href='https://leancloud.cn/docs/app_search_guide.html'>App Searching Guide</a>
24604 * for more details.
24605 * @class
24606 * @since 0.5.1
24607 * @example
24608 * var query = new AV.SearchQuery('Player');
24609 * query.queryString('*');
24610 * query.find().then(function(results) {
24611 * console.log('Found %d objects', query.hits());
24612 * //Process results
24613 * });
24614 */
24615
24616
24617 AV.SearchQuery = AV.Query._extend(
24618 /** @lends AV.SearchQuery.prototype */
24619 {
24620 _sid: null,
24621 _hits: 0,
24622 _queryString: null,
24623 _highlights: null,
24624 _sortBuilder: null,
24625 _clazz: null,
24626 constructor: function constructor(className) {
24627 if (className) {
24628 this._clazz = className;
24629 } else {
24630 className = '__INVALID_CLASS';
24631 }
24632
24633 AV.Query.call(this, className);
24634 },
24635 _createRequest: function _createRequest(params, options) {
24636 return AVRequest('search/select', null, null, 'GET', params || this._getParams(), options);
24637 },
24638
24639 /**
24640 * Sets the sid of app searching query.Default is null.
24641 * @param {String} sid Scroll id for searching.
24642 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24643 */
24644 sid: function sid(_sid) {
24645 this._sid = _sid;
24646 return this;
24647 },
24648
24649 /**
24650 * Sets the query string of app searching.
24651 * @param {String} q The query string.
24652 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24653 */
24654 queryString: function queryString(q) {
24655 this._queryString = q;
24656 return this;
24657 },
24658
24659 /**
24660 * Sets the highlight fields. Such as
24661 * <pre><code>
24662 * query.highlights('title');
24663 * //or pass an array.
24664 * query.highlights(['title', 'content'])
24665 * </code></pre>
24666 * @param {String|String[]} highlights a list of fields.
24667 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24668 */
24669 highlights: function highlights(_highlights) {
24670 var objects;
24671
24672 if (_highlights && _.isString(_highlights)) {
24673 objects = _.toArray(arguments);
24674 } else {
24675 objects = _highlights;
24676 }
24677
24678 this._highlights = objects;
24679 return this;
24680 },
24681
24682 /**
24683 * Sets the sort builder for this query.
24684 * @see AV.SearchSortBuilder
24685 * @param { AV.SearchSortBuilder} builder The sort builder.
24686 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24687 *
24688 */
24689 sortBy: function sortBy(builder) {
24690 this._sortBuilder = builder;
24691 return this;
24692 },
24693
24694 /**
24695 * Returns the number of objects that match this query.
24696 * @return {Number}
24697 */
24698 hits: function hits() {
24699 if (!this._hits) {
24700 this._hits = 0;
24701 }
24702
24703 return this._hits;
24704 },
24705 _processResult: function _processResult(json) {
24706 delete json['className'];
24707 delete json['_app_url'];
24708 delete json['_deeplink'];
24709 return json;
24710 },
24711
24712 /**
24713 * Returns true when there are more documents can be retrieved by this
24714 * query instance, you can call find function to get more results.
24715 * @see AV.SearchQuery#find
24716 * @return {Boolean}
24717 */
24718 hasMore: function hasMore() {
24719 return !this._hitEnd;
24720 },
24721
24722 /**
24723 * Reset current query instance state(such as sid, hits etc) except params
24724 * for a new searching. After resetting, hasMore() will return true.
24725 */
24726 reset: function reset() {
24727 this._hitEnd = false;
24728 this._sid = null;
24729 this._hits = 0;
24730 },
24731
24732 /**
24733 * Retrieves a list of AVObjects that satisfy this query.
24734 * Either options.success or options.error is called when the find
24735 * completes.
24736 *
24737 * @see AV.Query#find
24738 * @param {AuthOptions} options
24739 * @return {Promise} A promise that is resolved with the results when
24740 * the query completes.
24741 */
24742 find: function find(options) {
24743 var self = this;
24744
24745 var request = this._createRequest(undefined, options);
24746
24747 return request.then(function (response) {
24748 //update sid for next querying.
24749 if (response.sid) {
24750 self._oldSid = self._sid;
24751 self._sid = response.sid;
24752 } else {
24753 self._sid = null;
24754 self._hitEnd = true;
24755 }
24756
24757 self._hits = response.hits || 0;
24758 return (0, _map.default)(_).call(_, response.results, function (json) {
24759 if (json.className) {
24760 response.className = json.className;
24761 }
24762
24763 var obj = self._newObject(response);
24764
24765 obj.appURL = json['_app_url'];
24766
24767 obj._finishFetch(self._processResult(json), true);
24768
24769 return obj;
24770 });
24771 });
24772 },
24773 _getParams: function _getParams() {
24774 var params = AV.SearchQuery.__super__._getParams.call(this);
24775
24776 delete params.where;
24777
24778 if (this._clazz) {
24779 params.clazz = this.className;
24780 }
24781
24782 if (this._sid) {
24783 params.sid = this._sid;
24784 }
24785
24786 if (!this._queryString) {
24787 throw new Error('Please set query string.');
24788 } else {
24789 params.q = this._queryString;
24790 }
24791
24792 if (this._highlights) {
24793 params.highlights = this._highlights.join(',');
24794 }
24795
24796 if (this._sortBuilder && params.order) {
24797 throw new Error('sort and order can not be set at same time.');
24798 }
24799
24800 if (this._sortBuilder) {
24801 params.sort = this._sortBuilder.build();
24802 }
24803
24804 return params;
24805 }
24806 });
24807};
24808/**
24809 * Sorts the results in ascending order by the given key.
24810 *
24811 * @method AV.SearchQuery#ascending
24812 * @param {String} key The key to order by.
24813 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24814 */
24815
24816/**
24817 * Also sorts the results in ascending order by the given key. The previous sort keys have
24818 * precedence over this key.
24819 *
24820 * @method AV.SearchQuery#addAscending
24821 * @param {String} key The key to order by
24822 * @return {AV.SearchQuery} Returns the query so you can chain this call.
24823 */
24824
24825/**
24826 * Sorts the results in descending order by the given key.
24827 *
24828 * @method AV.SearchQuery#descending
24829 * @param {String} key The key to order by.
24830 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24831 */
24832
24833/**
24834 * Also sorts the results in descending order by the given key. The previous sort keys have
24835 * precedence over this key.
24836 *
24837 * @method AV.SearchQuery#addDescending
24838 * @param {String} key The key to order by
24839 * @return {AV.SearchQuery} Returns the query so you can chain this call.
24840 */
24841
24842/**
24843 * Include nested AV.Objects for the provided key. You can use dot
24844 * notation to specify which fields in the included object are also fetch.
24845 * @method AV.SearchQuery#include
24846 * @param {String[]} keys The name of the key to include.
24847 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24848 */
24849
24850/**
24851 * Sets the number of results to skip before returning any results.
24852 * This is useful for pagination.
24853 * Default is to skip zero results.
24854 * @method AV.SearchQuery#skip
24855 * @param {Number} n the number of results to skip.
24856 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24857 */
24858
24859/**
24860 * Sets the limit of the number of results to return. The default limit is
24861 * 100, with a maximum of 1000 results being returned at a time.
24862 * @method AV.SearchQuery#limit
24863 * @param {Number} n the number of results to limit to.
24864 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24865 */
24866
24867/***/ }),
24868/* 565 */
24869/***/ (function(module, exports, __webpack_require__) {
24870
24871"use strict";
24872
24873
24874var _interopRequireDefault = __webpack_require__(1);
24875
24876var _promise = _interopRequireDefault(__webpack_require__(12));
24877
24878var _ = __webpack_require__(3);
24879
24880var AVError = __webpack_require__(46);
24881
24882var _require = __webpack_require__(27),
24883 request = _require.request;
24884
24885module.exports = function (AV) {
24886 /**
24887 * 包含了使用了 LeanCloud
24888 * <a href='/docs/leaninsight_guide.html'>离线数据分析功能</a>的函数。
24889 * <p><strong><em>
24890 * 仅在云引擎运行环境下有效。
24891 * </em></strong></p>
24892 * @namespace
24893 */
24894 AV.Insight = AV.Insight || {};
24895
24896 _.extend(AV.Insight,
24897 /** @lends AV.Insight */
24898 {
24899 /**
24900 * 开始一个 Insight 任务。结果里将返回 Job id,你可以拿得到的 id 使用
24901 * AV.Insight.JobQuery 查询任务状态和结果。
24902 * @param {Object} jobConfig 任务配置的 JSON 对象,例如:<code><pre>
24903 * { "sql" : "select count(*) as c,gender from _User group by gender",
24904 * "saveAs": {
24905 * "className" : "UserGender",
24906 * "limit": 1
24907 * }
24908 * }
24909 * </pre></code>
24910 * sql 指定任务执行的 SQL 语句, saveAs(可选) 指定将结果保存在哪张表里,limit 最大 1000。
24911 * @param {AuthOptions} [options]
24912 * @return {Promise} A promise that will be resolved with the result
24913 * of the function.
24914 */
24915 startJob: function startJob(jobConfig, options) {
24916 if (!jobConfig || !jobConfig.sql) {
24917 throw new Error('Please provide the sql to run the job.');
24918 }
24919
24920 var data = {
24921 jobConfig: jobConfig,
24922 appId: AV.applicationId
24923 };
24924 return request({
24925 path: '/bigquery/jobs',
24926 method: 'POST',
24927 data: AV._encode(data, null, true),
24928 authOptions: options,
24929 signKey: false
24930 }).then(function (resp) {
24931 return AV._decode(resp).id;
24932 });
24933 },
24934
24935 /**
24936 * 监听 Insight 任务事件(未来推出独立部署的离线分析服务后开放)
24937 * <p><strong><em>
24938 * 仅在云引擎运行环境下有效。
24939 * </em></strong></p>
24940 * @param {String} event 监听的事件,目前尚不支持。
24941 * @param {Function} 监听回调函数,接收 (err, id) 两个参数,err 表示错误信息,
24942 * id 表示任务 id。接下来你可以拿这个 id 使用AV.Insight.JobQuery 查询任务状态和结果。
24943 *
24944 */
24945 on: function on(event, cb) {}
24946 });
24947 /**
24948 * 创建一个对象,用于查询 Insight 任务状态和结果。
24949 * @class
24950 * @param {String} id 任务 id
24951 * @since 0.5.5
24952 */
24953
24954
24955 AV.Insight.JobQuery = function (id, className) {
24956 if (!id) {
24957 throw new Error('Please provide the job id.');
24958 }
24959
24960 this.id = id;
24961 this.className = className;
24962 this._skip = 0;
24963 this._limit = 100;
24964 };
24965
24966 _.extend(AV.Insight.JobQuery.prototype,
24967 /** @lends AV.Insight.JobQuery.prototype */
24968 {
24969 /**
24970 * Sets the number of results to skip before returning any results.
24971 * This is useful for pagination.
24972 * Default is to skip zero results.
24973 * @param {Number} n the number of results to skip.
24974 * @return {AV.Query} Returns the query, so you can chain this call.
24975 */
24976 skip: function skip(n) {
24977 this._skip = n;
24978 return this;
24979 },
24980
24981 /**
24982 * Sets the limit of the number of results to return. The default limit is
24983 * 100, with a maximum of 1000 results being returned at a time.
24984 * @param {Number} n the number of results to limit to.
24985 * @return {AV.Query} Returns the query, so you can chain this call.
24986 */
24987 limit: function limit(n) {
24988 this._limit = n;
24989 return this;
24990 },
24991
24992 /**
24993 * 查询任务状态和结果,任务结果为一个 JSON 对象,包括 status 表示任务状态, totalCount 表示总数,
24994 * results 数组表示任务结果数组,previewCount 表示可以返回的结果总数,任务的开始和截止时间
24995 * startTime、endTime 等信息。
24996 *
24997 * @param {AuthOptions} [options]
24998 * @return {Promise} A promise that will be resolved with the result
24999 * of the function.
25000 *
25001 */
25002 find: function find(options) {
25003 var params = {
25004 skip: this._skip,
25005 limit: this._limit
25006 };
25007 return request({
25008 path: "/bigquery/jobs/".concat(this.id),
25009 method: 'GET',
25010 query: params,
25011 authOptions: options,
25012 signKey: false
25013 }).then(function (response) {
25014 if (response.error) {
25015 return _promise.default.reject(new AVError(response.code, response.error));
25016 }
25017
25018 return _promise.default.resolve(response);
25019 });
25020 }
25021 });
25022};
25023
25024/***/ }),
25025/* 566 */
25026/***/ (function(module, exports, __webpack_require__) {
25027
25028"use strict";
25029
25030
25031var _interopRequireDefault = __webpack_require__(1);
25032
25033var _promise = _interopRequireDefault(__webpack_require__(12));
25034
25035var _ = __webpack_require__(3);
25036
25037var _require = __webpack_require__(27),
25038 LCRequest = _require.request;
25039
25040var _require2 = __webpack_require__(30),
25041 getSessionToken = _require2.getSessionToken;
25042
25043module.exports = function (AV) {
25044 var getUserWithSessionToken = function getUserWithSessionToken(authOptions) {
25045 if (authOptions.user) {
25046 if (!authOptions.user._sessionToken) {
25047 throw new Error('authOptions.user is not signed in.');
25048 }
25049
25050 return _promise.default.resolve(authOptions.user);
25051 }
25052
25053 if (authOptions.sessionToken) {
25054 return AV.User._fetchUserBySessionToken(authOptions.sessionToken);
25055 }
25056
25057 return AV.User.currentAsync();
25058 };
25059
25060 var getSessionTokenAsync = function getSessionTokenAsync(authOptions) {
25061 var sessionToken = getSessionToken(authOptions);
25062
25063 if (sessionToken) {
25064 return _promise.default.resolve(sessionToken);
25065 }
25066
25067 return AV.User.currentAsync().then(function (user) {
25068 if (user) {
25069 return user.getSessionToken();
25070 }
25071 });
25072 };
25073 /**
25074 * Contains functions to deal with Friendship in LeanCloud.
25075 * @class
25076 */
25077
25078
25079 AV.Friendship = {
25080 /**
25081 * Request friendship.
25082 * @since 4.8.0
25083 * @param {String | AV.User | Object} options if an AV.User or string is given, it will be used as the friend.
25084 * @param {AV.User | string} options.friend The friend (or friend's objectId) to follow.
25085 * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of followeeQuery.
25086 * @param {AuthOptions} [authOptions]
25087 * @return {Promise<void>}
25088 */
25089 request: function request(options) {
25090 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25091 var friend;
25092 var attributes;
25093
25094 if (options.friend) {
25095 friend = options.friend;
25096 attributes = options.attributes;
25097 } else {
25098 friend = options;
25099 }
25100
25101 var friendObj = _.isString(friend) ? AV.Object.createWithoutData('_User', friend) : friend;
25102 return getUserWithSessionToken(authOptions).then(function (userObj) {
25103 if (!userObj) {
25104 throw new Error('Please signin an user.');
25105 }
25106
25107 return LCRequest({
25108 method: 'POST',
25109 path: '/users/friendshipRequests',
25110 data: {
25111 user: userObj._toPointer(),
25112 friend: friendObj._toPointer(),
25113 friendship: attributes
25114 },
25115 authOptions: authOptions
25116 });
25117 });
25118 },
25119
25120 /**
25121 * Accept a friendship request.
25122 * @since 4.8.0
25123 * @param {AV.Object | string | Object} options if an AV.Object or string is given, it will be used as the request in _FriendshipRequest.
25124 * @param {AV.Object} options.request The request (or it's objectId) to be accepted.
25125 * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of {@link AV#followeeQuery}.
25126 * @param {AuthOptions} [authOptions]
25127 * @return {Promise<void>}
25128 */
25129 acceptRequest: function acceptRequest(options) {
25130 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25131 var request;
25132 var attributes;
25133
25134 if (options.request) {
25135 request = options.request;
25136 attributes = options.attributes;
25137 } else {
25138 request = options;
25139 }
25140
25141 var requestId = _.isString(request) ? request : request.id;
25142 return getSessionTokenAsync(authOptions).then(function (sessionToken) {
25143 if (!sessionToken) {
25144 throw new Error('Please signin an user.');
25145 }
25146
25147 return LCRequest({
25148 method: 'PUT',
25149 path: '/users/friendshipRequests/' + requestId + '/accept',
25150 data: {
25151 friendship: AV._encode(attributes)
25152 },
25153 authOptions: authOptions
25154 });
25155 });
25156 },
25157
25158 /**
25159 * Decline a friendship request.
25160 * @param {AV.Object | string} request The request (or it's objectId) to be declined.
25161 * @param {AuthOptions} [authOptions]
25162 * @return {Promise<void>}
25163 */
25164 declineRequest: function declineRequest(request) {
25165 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25166 var requestId = _.isString(request) ? request : request.id;
25167 return getSessionTokenAsync(authOptions).then(function (sessionToken) {
25168 if (!sessionToken) {
25169 throw new Error('Please signin an user.');
25170 }
25171
25172 return LCRequest({
25173 method: 'PUT',
25174 path: '/users/friendshipRequests/' + requestId + '/decline',
25175 authOptions: authOptions
25176 });
25177 });
25178 }
25179 };
25180};
25181
25182/***/ }),
25183/* 567 */
25184/***/ (function(module, exports, __webpack_require__) {
25185
25186"use strict";
25187
25188
25189var _interopRequireDefault = __webpack_require__(1);
25190
25191var _stringify = _interopRequireDefault(__webpack_require__(36));
25192
25193var _ = __webpack_require__(3);
25194
25195var _require = __webpack_require__(27),
25196 _request = _require._request;
25197
25198var AV = __webpack_require__(69);
25199
25200var serializeMessage = function serializeMessage(message) {
25201 if (typeof message === 'string') {
25202 return message;
25203 }
25204
25205 if (typeof message.getPayload === 'function') {
25206 return (0, _stringify.default)(message.getPayload());
25207 }
25208
25209 return (0, _stringify.default)(message);
25210};
25211/**
25212 * <p>An AV.Conversation is a local representation of a LeanCloud realtime's
25213 * conversation. This class is a subclass of AV.Object, and retains the
25214 * same functionality of an AV.Object, but also extends it with various
25215 * conversation specific methods, like get members, creators of this conversation.
25216 * </p>
25217 *
25218 * @class AV.Conversation
25219 * @param {String} name The name of the Role to create.
25220 * @param {Object} [options]
25221 * @param {Boolean} [options.isSystem] Set this conversation as system conversation.
25222 * @param {Boolean} [options.isTransient] Set this conversation as transient conversation.
25223 */
25224
25225
25226module.exports = AV.Object.extend('_Conversation',
25227/** @lends AV.Conversation.prototype */
25228{
25229 constructor: function constructor(name) {
25230 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25231 AV.Object.prototype.constructor.call(this, null, null);
25232 this.set('name', name);
25233
25234 if (options.isSystem !== undefined) {
25235 this.set('sys', options.isSystem ? true : false);
25236 }
25237
25238 if (options.isTransient !== undefined) {
25239 this.set('tr', options.isTransient ? true : false);
25240 }
25241 },
25242
25243 /**
25244 * Get current conversation's creator.
25245 *
25246 * @return {String}
25247 */
25248 getCreator: function getCreator() {
25249 return this.get('c');
25250 },
25251
25252 /**
25253 * Get the last message's time.
25254 *
25255 * @return {Date}
25256 */
25257 getLastMessageAt: function getLastMessageAt() {
25258 return this.get('lm');
25259 },
25260
25261 /**
25262 * Get this conversation's members
25263 *
25264 * @return {String[]}
25265 */
25266 getMembers: function getMembers() {
25267 return this.get('m');
25268 },
25269
25270 /**
25271 * Add a member to this conversation
25272 *
25273 * @param {String} member
25274 */
25275 addMember: function addMember(member) {
25276 return this.add('m', member);
25277 },
25278
25279 /**
25280 * Get this conversation's members who set this conversation as muted.
25281 *
25282 * @return {String[]}
25283 */
25284 getMutedMembers: function getMutedMembers() {
25285 return this.get('mu');
25286 },
25287
25288 /**
25289 * Get this conversation's name field.
25290 *
25291 * @return String
25292 */
25293 getName: function getName() {
25294 return this.get('name');
25295 },
25296
25297 /**
25298 * Returns true if this conversation is transient conversation.
25299 *
25300 * @return {Boolean}
25301 */
25302 isTransient: function isTransient() {
25303 return this.get('tr');
25304 },
25305
25306 /**
25307 * Returns true if this conversation is system conversation.
25308 *
25309 * @return {Boolean}
25310 */
25311 isSystem: function isSystem() {
25312 return this.get('sys');
25313 },
25314
25315 /**
25316 * Send realtime message to this conversation, using HTTP request.
25317 *
25318 * @param {String} fromClient Sender's client id.
25319 * @param {String|Object} message The message which will send to conversation.
25320 * It could be a raw string, or an object with a `toJSON` method, like a
25321 * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}
25322 * @param {Object} [options]
25323 * @param {Boolean} [options.transient] Whether send this message as transient message or not.
25324 * @param {String[]} [options.toClients] Ids of clients to send to. This option can be used only in system conversation.
25325 * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}
25326 * @param {AuthOptions} [authOptions]
25327 * @return {Promise}
25328 */
25329 send: function send(fromClient, message) {
25330 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25331 var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
25332 var data = {
25333 from_peer: fromClient,
25334 conv_id: this.id,
25335 transient: false,
25336 message: serializeMessage(message)
25337 };
25338
25339 if (options.toClients !== undefined) {
25340 data.to_peers = options.toClients;
25341 }
25342
25343 if (options.transient !== undefined) {
25344 data.transient = options.transient ? true : false;
25345 }
25346
25347 if (options.pushData !== undefined) {
25348 data.push_data = options.pushData;
25349 }
25350
25351 return _request('rtm', 'messages', null, 'POST', data, authOptions);
25352 },
25353
25354 /**
25355 * Send realtime broadcast message to all clients, via this conversation, using HTTP request.
25356 *
25357 * @param {String} fromClient Sender's client id.
25358 * @param {String|Object} message The message which will send to conversation.
25359 * It could be a raw string, or an object with a `toJSON` method, like a
25360 * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}.
25361 * @param {Object} [options]
25362 * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}.
25363 * @param {Object} [options.validTill] The message will valid till this time.
25364 * @param {AuthOptions} [authOptions]
25365 * @return {Promise}
25366 */
25367 broadcast: function broadcast(fromClient, message) {
25368 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25369 var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
25370 var data = {
25371 from_peer: fromClient,
25372 conv_id: this.id,
25373 message: serializeMessage(message)
25374 };
25375
25376 if (options.pushData !== undefined) {
25377 data.push = options.pushData;
25378 }
25379
25380 if (options.validTill !== undefined) {
25381 var ts = options.validTill;
25382
25383 if (_.isDate(ts)) {
25384 ts = ts.getTime();
25385 }
25386
25387 options.valid_till = ts;
25388 }
25389
25390 return _request('rtm', 'broadcast', null, 'POST', data, authOptions);
25391 }
25392});
25393
25394/***/ }),
25395/* 568 */
25396/***/ (function(module, exports, __webpack_require__) {
25397
25398"use strict";
25399
25400
25401var _interopRequireDefault = __webpack_require__(1);
25402
25403var _promise = _interopRequireDefault(__webpack_require__(12));
25404
25405var _map = _interopRequireDefault(__webpack_require__(35));
25406
25407var _concat = _interopRequireDefault(__webpack_require__(22));
25408
25409var _ = __webpack_require__(3);
25410
25411var _require = __webpack_require__(27),
25412 request = _require.request;
25413
25414var _require2 = __webpack_require__(30),
25415 ensureArray = _require2.ensureArray,
25416 parseDate = _require2.parseDate;
25417
25418var AV = __webpack_require__(69);
25419/**
25420 * The version change interval for Leaderboard
25421 * @enum
25422 */
25423
25424
25425AV.LeaderboardVersionChangeInterval = {
25426 NEVER: 'never',
25427 DAY: 'day',
25428 WEEK: 'week',
25429 MONTH: 'month'
25430};
25431/**
25432 * The order of the leaderboard results
25433 * @enum
25434 */
25435
25436AV.LeaderboardOrder = {
25437 ASCENDING: 'ascending',
25438 DESCENDING: 'descending'
25439};
25440/**
25441 * The update strategy for Leaderboard
25442 * @enum
25443 */
25444
25445AV.LeaderboardUpdateStrategy = {
25446 /** Only keep the best statistic. If the leaderboard is in descending order, the best statistic is the highest one. */
25447 BETTER: 'better',
25448
25449 /** Keep the last updated statistic */
25450 LAST: 'last',
25451
25452 /** Keep the sum of all updated statistics */
25453 SUM: 'sum'
25454};
25455/**
25456 * @typedef {Object} Ranking
25457 * @property {number} rank Starts at 0
25458 * @property {number} value the statistic value of this ranking
25459 * @property {AV.User} user The user of this ranking
25460 * @property {Statistic[]} [includedStatistics] Other statistics of the user, specified by the `includeStatistic` option of `AV.Leaderboard.getResults()`
25461 */
25462
25463/**
25464 * @typedef {Object} LeaderboardArchive
25465 * @property {string} statisticName
25466 * @property {number} version version of the leaderboard
25467 * @property {string} status
25468 * @property {string} url URL for the downloadable archive
25469 * @property {Date} activatedAt time when this version became active
25470 * @property {Date} deactivatedAt time when this version was deactivated by a version incrementing
25471 */
25472
25473/**
25474 * @class
25475 */
25476
25477function Statistic(_ref) {
25478 var name = _ref.name,
25479 value = _ref.value,
25480 version = _ref.version;
25481
25482 /**
25483 * @type {string}
25484 */
25485 this.name = name;
25486 /**
25487 * @type {number}
25488 */
25489
25490 this.value = value;
25491 /**
25492 * @type {number?}
25493 */
25494
25495 this.version = version;
25496}
25497
25498var parseStatisticData = function parseStatisticData(statisticData) {
25499 var _AV$_decode = AV._decode(statisticData),
25500 name = _AV$_decode.statisticName,
25501 value = _AV$_decode.statisticValue,
25502 version = _AV$_decode.version;
25503
25504 return new Statistic({
25505 name: name,
25506 value: value,
25507 version: version
25508 });
25509};
25510/**
25511 * @class
25512 */
25513
25514
25515AV.Leaderboard = function Leaderboard(statisticName) {
25516 /**
25517 * @type {string}
25518 */
25519 this.statisticName = statisticName;
25520 /**
25521 * @type {AV.LeaderboardOrder}
25522 */
25523
25524 this.order = undefined;
25525 /**
25526 * @type {AV.LeaderboardUpdateStrategy}
25527 */
25528
25529 this.updateStrategy = undefined;
25530 /**
25531 * @type {AV.LeaderboardVersionChangeInterval}
25532 */
25533
25534 this.versionChangeInterval = undefined;
25535 /**
25536 * @type {number}
25537 */
25538
25539 this.version = undefined;
25540 /**
25541 * @type {Date?}
25542 */
25543
25544 this.nextResetAt = undefined;
25545 /**
25546 * @type {Date?}
25547 */
25548
25549 this.createdAt = undefined;
25550};
25551
25552var Leaderboard = AV.Leaderboard;
25553/**
25554 * Create an instance of Leaderboard for the give statistic name.
25555 * @param {string} statisticName
25556 * @return {AV.Leaderboard}
25557 */
25558
25559AV.Leaderboard.createWithoutData = function (statisticName) {
25560 return new Leaderboard(statisticName);
25561};
25562/**
25563 * (masterKey required) Create a new Leaderboard.
25564 * @param {Object} options
25565 * @param {string} options.statisticName
25566 * @param {AV.LeaderboardOrder} options.order
25567 * @param {AV.LeaderboardVersionChangeInterval} [options.versionChangeInterval] default to WEEK
25568 * @param {AV.LeaderboardUpdateStrategy} [options.updateStrategy] default to BETTER
25569 * @param {AuthOptions} [authOptions]
25570 * @return {Promise<AV.Leaderboard>}
25571 */
25572
25573
25574AV.Leaderboard.createLeaderboard = function (_ref2, authOptions) {
25575 var statisticName = _ref2.statisticName,
25576 order = _ref2.order,
25577 versionChangeInterval = _ref2.versionChangeInterval,
25578 updateStrategy = _ref2.updateStrategy;
25579 return request({
25580 method: 'POST',
25581 path: '/leaderboard/leaderboards',
25582 data: {
25583 statisticName: statisticName,
25584 order: order,
25585 versionChangeInterval: versionChangeInterval,
25586 updateStrategy: updateStrategy
25587 },
25588 authOptions: authOptions
25589 }).then(function (data) {
25590 var leaderboard = new Leaderboard(statisticName);
25591 return leaderboard._finishFetch(data);
25592 });
25593};
25594/**
25595 * Get the Leaderboard with the specified statistic name.
25596 * @param {string} statisticName
25597 * @param {AuthOptions} [authOptions]
25598 * @return {Promise<AV.Leaderboard>}
25599 */
25600
25601
25602AV.Leaderboard.getLeaderboard = function (statisticName, authOptions) {
25603 return Leaderboard.createWithoutData(statisticName).fetch(authOptions);
25604};
25605/**
25606 * Get Statistics for the specified user.
25607 * @param {AV.User} user The specified AV.User pointer.
25608 * @param {Object} [options]
25609 * @param {string[]} [options.statisticNames] Specify the statisticNames. If not set, all statistics of the user will be fetched.
25610 * @param {AuthOptions} [authOptions]
25611 * @return {Promise<Statistic[]>}
25612 */
25613
25614
25615AV.Leaderboard.getStatistics = function (user) {
25616 var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
25617 statisticNames = _ref3.statisticNames;
25618
25619 var authOptions = arguments.length > 2 ? arguments[2] : undefined;
25620 return _promise.default.resolve().then(function () {
25621 if (!(user && user.id)) throw new Error('user must be an AV.User');
25622 return request({
25623 method: 'GET',
25624 path: "/leaderboard/users/".concat(user.id, "/statistics"),
25625 query: {
25626 statistics: statisticNames ? ensureArray(statisticNames).join(',') : undefined
25627 },
25628 authOptions: authOptions
25629 }).then(function (_ref4) {
25630 var results = _ref4.results;
25631 return (0, _map.default)(results).call(results, parseStatisticData);
25632 });
25633 });
25634};
25635/**
25636 * Update Statistics for the specified user.
25637 * @param {AV.User} user The specified AV.User pointer.
25638 * @param {Object} statistics A name-value pair representing the statistics to update.
25639 * @param {AuthOptions} [options] AuthOptions plus:
25640 * @param {boolean} [options.overwrite] Wethere to overwrite these statistics disregarding the updateStrategy of there leaderboards
25641 * @return {Promise<Statistic[]>}
25642 */
25643
25644
25645AV.Leaderboard.updateStatistics = function (user, statistics) {
25646 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25647 return _promise.default.resolve().then(function () {
25648 if (!(user && user.id)) throw new Error('user must be an AV.User');
25649 var data = (0, _map.default)(_).call(_, statistics, function (value, key) {
25650 return {
25651 statisticName: key,
25652 statisticValue: value
25653 };
25654 });
25655 var overwrite = options.overwrite;
25656 return request({
25657 method: 'POST',
25658 path: "/leaderboard/users/".concat(user.id, "/statistics"),
25659 query: {
25660 overwrite: overwrite ? 1 : undefined
25661 },
25662 data: data,
25663 authOptions: options
25664 }).then(function (_ref5) {
25665 var results = _ref5.results;
25666 return (0, _map.default)(results).call(results, parseStatisticData);
25667 });
25668 });
25669};
25670/**
25671 * Delete Statistics for the specified user.
25672 * @param {AV.User} user The specified AV.User pointer.
25673 * @param {Object} statistics A name-value pair representing the statistics to delete.
25674 * @param {AuthOptions} [options]
25675 * @return {Promise<void>}
25676 */
25677
25678
25679AV.Leaderboard.deleteStatistics = function (user, statisticNames, authOptions) {
25680 return _promise.default.resolve().then(function () {
25681 if (!(user && user.id)) throw new Error('user must be an AV.User');
25682 return request({
25683 method: 'DELETE',
25684 path: "/leaderboard/users/".concat(user.id, "/statistics"),
25685 query: {
25686 statistics: ensureArray(statisticNames).join(',')
25687 },
25688 authOptions: authOptions
25689 }).then(function () {
25690 return undefined;
25691 });
25692 });
25693};
25694
25695_.extend(Leaderboard.prototype,
25696/** @lends AV.Leaderboard.prototype */
25697{
25698 _finishFetch: function _finishFetch(data) {
25699 var _this = this;
25700
25701 _.forEach(data, function (value, key) {
25702 if (key === 'updatedAt' || key === 'objectId') return;
25703
25704 if (key === 'expiredAt') {
25705 key = 'nextResetAt';
25706 }
25707
25708 if (key === 'createdAt') {
25709 value = parseDate(value);
25710 }
25711
25712 if (value && value.__type === 'Date') {
25713 value = parseDate(value.iso);
25714 }
25715
25716 _this[key] = value;
25717 });
25718
25719 return this;
25720 },
25721
25722 /**
25723 * Fetch data from the srever.
25724 * @param {AuthOptions} [authOptions]
25725 * @return {Promise<AV.Leaderboard>}
25726 */
25727 fetch: function fetch(authOptions) {
25728 var _this2 = this;
25729
25730 return request({
25731 method: 'GET',
25732 path: "/leaderboard/leaderboards/".concat(this.statisticName),
25733 authOptions: authOptions
25734 }).then(function (data) {
25735 return _this2._finishFetch(data);
25736 });
25737 },
25738
25739 /**
25740 * Counts the number of users participated in this leaderboard
25741 * @param {Object} [options]
25742 * @param {number} [options.version] Specify the version of the leaderboard
25743 * @param {AuthOptions} [authOptions]
25744 * @return {Promise<number>}
25745 */
25746 count: function count() {
25747 var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
25748 version = _ref6.version;
25749
25750 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
25751 return request({
25752 method: 'GET',
25753 path: "/leaderboard/leaderboards/".concat(this.statisticName, "/ranks"),
25754 query: {
25755 count: 1,
25756 limit: 0,
25757 version: version
25758 },
25759 authOptions: authOptions
25760 }).then(function (_ref7) {
25761 var count = _ref7.count;
25762 return count;
25763 });
25764 },
25765 _getResults: function _getResults(_ref8, authOptions, userId) {
25766 var _context;
25767
25768 var skip = _ref8.skip,
25769 limit = _ref8.limit,
25770 selectUserKeys = _ref8.selectUserKeys,
25771 includeUserKeys = _ref8.includeUserKeys,
25772 includeStatistics = _ref8.includeStatistics,
25773 version = _ref8.version;
25774 return request({
25775 method: 'GET',
25776 path: (0, _concat.default)(_context = "/leaderboard/leaderboards/".concat(this.statisticName, "/ranks")).call(_context, userId ? "/".concat(userId) : ''),
25777 query: {
25778 skip: skip,
25779 limit: limit,
25780 selectUserKeys: _.union(ensureArray(selectUserKeys), ensureArray(includeUserKeys)).join(',') || undefined,
25781 includeUser: includeUserKeys ? ensureArray(includeUserKeys).join(',') : undefined,
25782 includeStatistics: includeStatistics ? ensureArray(includeStatistics).join(',') : undefined,
25783 version: version
25784 },
25785 authOptions: authOptions
25786 }).then(function (_ref9) {
25787 var rankings = _ref9.results;
25788 return (0, _map.default)(rankings).call(rankings, function (rankingData) {
25789 var _AV$_decode2 = AV._decode(rankingData),
25790 user = _AV$_decode2.user,
25791 value = _AV$_decode2.statisticValue,
25792 rank = _AV$_decode2.rank,
25793 _AV$_decode2$statisti = _AV$_decode2.statistics,
25794 statistics = _AV$_decode2$statisti === void 0 ? [] : _AV$_decode2$statisti;
25795
25796 return {
25797 user: user,
25798 value: value,
25799 rank: rank,
25800 includedStatistics: (0, _map.default)(statistics).call(statistics, parseStatisticData)
25801 };
25802 });
25803 });
25804 },
25805
25806 /**
25807 * Retrieve a list of ranked users for this Leaderboard.
25808 * @param {Object} [options]
25809 * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
25810 * @param {number} [options.limit] The limit of the number of results.
25811 * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
25812 * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
25813 * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
25814 * @param {number} [options.version] Specify the version of the leaderboard
25815 * @param {AuthOptions} [authOptions]
25816 * @return {Promise<Ranking[]>}
25817 */
25818 getResults: function getResults() {
25819 var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
25820 skip = _ref10.skip,
25821 limit = _ref10.limit,
25822 selectUserKeys = _ref10.selectUserKeys,
25823 includeUserKeys = _ref10.includeUserKeys,
25824 includeStatistics = _ref10.includeStatistics,
25825 version = _ref10.version;
25826
25827 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
25828 return this._getResults({
25829 skip: skip,
25830 limit: limit,
25831 selectUserKeys: selectUserKeys,
25832 includeUserKeys: includeUserKeys,
25833 includeStatistics: includeStatistics,
25834 version: version
25835 }, authOptions);
25836 },
25837
25838 /**
25839 * Retrieve a list of ranked users for this Leaderboard, centered on the specified user.
25840 * @param {AV.User} user The specified AV.User pointer.
25841 * @param {Object} [options]
25842 * @param {number} [options.limit] The limit of the number of results.
25843 * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
25844 * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
25845 * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
25846 * @param {number} [options.version] Specify the version of the leaderboard
25847 * @param {AuthOptions} [authOptions]
25848 * @return {Promise<Ranking[]>}
25849 */
25850 getResultsAroundUser: function getResultsAroundUser(user) {
25851 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25852 var authOptions = arguments.length > 2 ? arguments[2] : undefined;
25853
25854 // getResultsAroundUser(options, authOptions)
25855 if (user && typeof user.id !== 'string') {
25856 return this.getResultsAroundUser(undefined, user, options);
25857 }
25858
25859 var limit = options.limit,
25860 selectUserKeys = options.selectUserKeys,
25861 includeUserKeys = options.includeUserKeys,
25862 includeStatistics = options.includeStatistics,
25863 version = options.version;
25864 return this._getResults({
25865 limit: limit,
25866 selectUserKeys: selectUserKeys,
25867 includeUserKeys: includeUserKeys,
25868 includeStatistics: includeStatistics,
25869 version: version
25870 }, authOptions, user ? user.id : 'self');
25871 },
25872 _update: function _update(data, authOptions) {
25873 var _this3 = this;
25874
25875 return request({
25876 method: 'PUT',
25877 path: "/leaderboard/leaderboards/".concat(this.statisticName),
25878 data: data,
25879 authOptions: authOptions
25880 }).then(function (result) {
25881 return _this3._finishFetch(result);
25882 });
25883 },
25884
25885 /**
25886 * (masterKey required) Update the version change interval of the Leaderboard.
25887 * @param {AV.LeaderboardVersionChangeInterval} versionChangeInterval
25888 * @param {AuthOptions} [authOptions]
25889 * @return {Promise<AV.Leaderboard>}
25890 */
25891 updateVersionChangeInterval: function updateVersionChangeInterval(versionChangeInterval, authOptions) {
25892 return this._update({
25893 versionChangeInterval: versionChangeInterval
25894 }, authOptions);
25895 },
25896
25897 /**
25898 * (masterKey required) Update the version change interval of the Leaderboard.
25899 * @param {AV.LeaderboardUpdateStrategy} updateStrategy
25900 * @param {AuthOptions} [authOptions]
25901 * @return {Promise<AV.Leaderboard>}
25902 */
25903 updateUpdateStrategy: function updateUpdateStrategy(updateStrategy, authOptions) {
25904 return this._update({
25905 updateStrategy: updateStrategy
25906 }, authOptions);
25907 },
25908
25909 /**
25910 * (masterKey required) Reset the Leaderboard. The version of the Leaderboard will be incremented by 1.
25911 * @param {AuthOptions} [authOptions]
25912 * @return {Promise<AV.Leaderboard>}
25913 */
25914 reset: function reset(authOptions) {
25915 var _this4 = this;
25916
25917 return request({
25918 method: 'PUT',
25919 path: "/leaderboard/leaderboards/".concat(this.statisticName, "/incrementVersion"),
25920 authOptions: authOptions
25921 }).then(function (data) {
25922 return _this4._finishFetch(data);
25923 });
25924 },
25925
25926 /**
25927 * (masterKey required) Delete the Leaderboard and its all archived versions.
25928 * @param {AuthOptions} [authOptions]
25929 * @return {void}
25930 */
25931 destroy: function destroy(authOptions) {
25932 return AV.request({
25933 method: 'DELETE',
25934 path: "/leaderboard/leaderboards/".concat(this.statisticName),
25935 authOptions: authOptions
25936 }).then(function () {
25937 return undefined;
25938 });
25939 },
25940
25941 /**
25942 * (masterKey required) Get archived versions.
25943 * @param {Object} [options]
25944 * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
25945 * @param {number} [options.limit] The limit of the number of results.
25946 * @param {AuthOptions} [authOptions]
25947 * @return {Promise<LeaderboardArchive[]>}
25948 */
25949 getArchives: function getArchives() {
25950 var _this5 = this;
25951
25952 var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
25953 skip = _ref11.skip,
25954 limit = _ref11.limit;
25955
25956 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
25957 return request({
25958 method: 'GET',
25959 path: "/leaderboard/leaderboards/".concat(this.statisticName, "/archives"),
25960 query: {
25961 skip: skip,
25962 limit: limit
25963 },
25964 authOptions: authOptions
25965 }).then(function (_ref12) {
25966 var results = _ref12.results;
25967 return (0, _map.default)(results).call(results, function (_ref13) {
25968 var version = _ref13.version,
25969 status = _ref13.status,
25970 url = _ref13.url,
25971 activatedAt = _ref13.activatedAt,
25972 deactivatedAt = _ref13.deactivatedAt;
25973 return {
25974 statisticName: _this5.statisticName,
25975 version: version,
25976 status: status,
25977 url: url,
25978 activatedAt: parseDate(activatedAt.iso),
25979 deactivatedAt: parseDate(deactivatedAt.iso)
25980 };
25981 });
25982 });
25983 }
25984});
25985
25986/***/ }),
25987/* 569 */
25988/***/ (function(module, exports, __webpack_require__) {
25989
25990"use strict";
25991
25992
25993var _interopRequireDefault = __webpack_require__(1);
25994
25995var _typeof2 = _interopRequireDefault(__webpack_require__(73));
25996
25997var _defineProperty = _interopRequireDefault(__webpack_require__(92));
25998
25999var _setPrototypeOf = _interopRequireDefault(__webpack_require__(238));
26000
26001var _assign2 = _interopRequireDefault(__webpack_require__(152));
26002
26003var _indexOf = _interopRequireDefault(__webpack_require__(71));
26004
26005var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(153));
26006
26007var _promise = _interopRequireDefault(__webpack_require__(12));
26008
26009var _symbol = _interopRequireDefault(__webpack_require__(149));
26010
26011var _iterator = _interopRequireDefault(__webpack_require__(576));
26012
26013var _weakMap = _interopRequireDefault(__webpack_require__(260));
26014
26015var _keys = _interopRequireDefault(__webpack_require__(115));
26016
26017var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(151));
26018
26019var _getPrototypeOf = _interopRequireDefault(__webpack_require__(147));
26020
26021var _map = _interopRequireDefault(__webpack_require__(583));
26022
26023(0, _defineProperty.default)(exports, '__esModule', {
26024 value: true
26025});
26026/******************************************************************************
26027Copyright (c) Microsoft Corporation.
26028
26029Permission to use, copy, modify, and/or distribute this software for any
26030purpose with or without fee is hereby granted.
26031
26032THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
26033REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
26034AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
26035INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
26036LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
26037OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
26038PERFORMANCE OF THIS SOFTWARE.
26039***************************************************************************** */
26040
26041/* global Reflect, Promise */
26042
26043var _extendStatics$ = function extendStatics$1(d, b) {
26044 _extendStatics$ = _setPrototypeOf.default || {
26045 __proto__: []
26046 } instanceof Array && function (d, b) {
26047 d.__proto__ = b;
26048 } || function (d, b) {
26049 for (var p in b) {
26050 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
26051 }
26052 };
26053
26054 return _extendStatics$(d, b);
26055};
26056
26057function __extends$1(d, b) {
26058 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
26059
26060 _extendStatics$(d, b);
26061
26062 function __() {
26063 this.constructor = d;
26064 }
26065
26066 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26067}
26068
26069var _assign = function __assign() {
26070 _assign = _assign2.default || function __assign(t) {
26071 for (var s, i = 1, n = arguments.length; i < n; i++) {
26072 s = arguments[i];
26073
26074 for (var p in s) {
26075 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
26076 }
26077 }
26078
26079 return t;
26080 };
26081
26082 return _assign.apply(this, arguments);
26083};
26084
26085function __rest(s, e) {
26086 var t = {};
26087
26088 for (var p in s) {
26089 if (Object.prototype.hasOwnProperty.call(s, p) && (0, _indexOf.default)(e).call(e, p) < 0) t[p] = s[p];
26090 }
26091
26092 if (s != null && typeof _getOwnPropertySymbols.default === "function") for (var i = 0, p = (0, _getOwnPropertySymbols.default)(s); i < p.length; i++) {
26093 if ((0, _indexOf.default)(e).call(e, p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
26094 }
26095 return t;
26096}
26097
26098function __awaiter(thisArg, _arguments, P, generator) {
26099 function adopt(value) {
26100 return value instanceof P ? value : new P(function (resolve) {
26101 resolve(value);
26102 });
26103 }
26104
26105 return new (P || (P = _promise.default))(function (resolve, reject) {
26106 function fulfilled(value) {
26107 try {
26108 step(generator.next(value));
26109 } catch (e) {
26110 reject(e);
26111 }
26112 }
26113
26114 function rejected(value) {
26115 try {
26116 step(generator["throw"](value));
26117 } catch (e) {
26118 reject(e);
26119 }
26120 }
26121
26122 function step(result) {
26123 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
26124 }
26125
26126 step((generator = generator.apply(thisArg, _arguments || [])).next());
26127 });
26128}
26129
26130function __generator(thisArg, body) {
26131 var _ = {
26132 label: 0,
26133 sent: function sent() {
26134 if (t[0] & 1) throw t[1];
26135 return t[1];
26136 },
26137 trys: [],
26138 ops: []
26139 },
26140 f,
26141 y,
26142 t,
26143 g;
26144 return g = {
26145 next: verb(0),
26146 "throw": verb(1),
26147 "return": verb(2)
26148 }, typeof _symbol.default === "function" && (g[_iterator.default] = function () {
26149 return this;
26150 }), g;
26151
26152 function verb(n) {
26153 return function (v) {
26154 return step([n, v]);
26155 };
26156 }
26157
26158 function step(op) {
26159 if (f) throw new TypeError("Generator is already executing.");
26160
26161 while (_) {
26162 try {
26163 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
26164 if (y = 0, t) op = [op[0] & 2, t.value];
26165
26166 switch (op[0]) {
26167 case 0:
26168 case 1:
26169 t = op;
26170 break;
26171
26172 case 4:
26173 _.label++;
26174 return {
26175 value: op[1],
26176 done: false
26177 };
26178
26179 case 5:
26180 _.label++;
26181 y = op[1];
26182 op = [0];
26183 continue;
26184
26185 case 7:
26186 op = _.ops.pop();
26187
26188 _.trys.pop();
26189
26190 continue;
26191
26192 default:
26193 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
26194 _ = 0;
26195 continue;
26196 }
26197
26198 if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
26199 _.label = op[1];
26200 break;
26201 }
26202
26203 if (op[0] === 6 && _.label < t[1]) {
26204 _.label = t[1];
26205 t = op;
26206 break;
26207 }
26208
26209 if (t && _.label < t[2]) {
26210 _.label = t[2];
26211
26212 _.ops.push(op);
26213
26214 break;
26215 }
26216
26217 if (t[2]) _.ops.pop();
26218
26219 _.trys.pop();
26220
26221 continue;
26222 }
26223
26224 op = body.call(thisArg, _);
26225 } catch (e) {
26226 op = [6, e];
26227 y = 0;
26228 } finally {
26229 f = t = 0;
26230 }
26231 }
26232
26233 if (op[0] & 5) throw op[1];
26234 return {
26235 value: op[0] ? op[1] : void 0,
26236 done: true
26237 };
26238 }
26239}
26240
26241var PROVIDER = "lc_weapp";
26242var PLATFORM = "weixin";
26243
26244function getLoginCode() {
26245 return new _promise.default(function (resolve, reject) {
26246 wx.login({
26247 success: function success(res) {
26248 return res.code ? resolve(res.code) : reject(new Error(res.errMsg));
26249 },
26250 fail: function fail(_a) {
26251 var errMsg = _a.errMsg;
26252 return reject(new Error(errMsg));
26253 }
26254 });
26255 });
26256}
26257
26258var getAuthInfo = function getAuthInfo(_a) {
26259 var _b = _a === void 0 ? {} : _a,
26260 _c = _b.platform,
26261 platform = _c === void 0 ? PLATFORM : _c,
26262 _d = _b.preferUnionId,
26263 preferUnionId = _d === void 0 ? false : _d,
26264 _e = _b.asMainAccount,
26265 asMainAccount = _e === void 0 ? false : _e;
26266
26267 return __awaiter(this, void 0, void 0, function () {
26268 var code, authData;
26269 return __generator(this, function (_f) {
26270 switch (_f.label) {
26271 case 0:
26272 return [4
26273 /*yield*/
26274 , getLoginCode()];
26275
26276 case 1:
26277 code = _f.sent();
26278 authData = {
26279 code: code
26280 };
26281
26282 if (preferUnionId) {
26283 authData.platform = platform;
26284 authData.main_account = asMainAccount;
26285 }
26286
26287 return [2
26288 /*return*/
26289 , {
26290 authData: authData,
26291 platform: platform,
26292 provider: PROVIDER
26293 }];
26294 }
26295 });
26296 });
26297};
26298
26299var storage = {
26300 getItem: function getItem(key) {
26301 return wx.getStorageSync(key);
26302 },
26303 setItem: function setItem(key, value) {
26304 return wx.setStorageSync(key, value);
26305 },
26306 removeItem: function removeItem(key) {
26307 return wx.removeStorageSync(key);
26308 },
26309 clear: function clear() {
26310 return wx.clearStorageSync();
26311 }
26312};
26313/******************************************************************************
26314Copyright (c) Microsoft Corporation.
26315
26316Permission to use, copy, modify, and/or distribute this software for any
26317purpose with or without fee is hereby granted.
26318
26319THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
26320REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
26321AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
26322INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
26323LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
26324OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
26325PERFORMANCE OF THIS SOFTWARE.
26326***************************************************************************** */
26327
26328/* global Reflect, Promise */
26329
26330var _extendStatics = function extendStatics(d, b) {
26331 _extendStatics = _setPrototypeOf.default || {
26332 __proto__: []
26333 } instanceof Array && function (d, b) {
26334 d.__proto__ = b;
26335 } || function (d, b) {
26336 for (var p in b) {
26337 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
26338 }
26339 };
26340
26341 return _extendStatics(d, b);
26342};
26343
26344function __extends(d, b) {
26345 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
26346
26347 _extendStatics(d, b);
26348
26349 function __() {
26350 this.constructor = d;
26351 }
26352
26353 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26354}
26355
26356var AbortError =
26357/** @class */
26358function (_super) {
26359 __extends(AbortError, _super);
26360
26361 function AbortError() {
26362 var _this = _super !== null && _super.apply(this, arguments) || this;
26363
26364 _this.name = "AbortError";
26365 return _this;
26366 }
26367
26368 return AbortError;
26369}(Error);
26370
26371var request = function request(url, options) {
26372 if (options === void 0) {
26373 options = {};
26374 }
26375
26376 var method = options.method,
26377 data = options.data,
26378 headers = options.headers,
26379 signal = options.signal;
26380
26381 if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
26382 return _promise.default.reject(new AbortError("Request aborted"));
26383 }
26384
26385 return new _promise.default(function (resolve, reject) {
26386 var task = wx.request({
26387 url: url,
26388 method: method,
26389 data: data,
26390 header: headers,
26391 complete: function complete(res) {
26392 signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", abortListener);
26393
26394 if (!res.statusCode) {
26395 reject(new Error(res.errMsg));
26396 return;
26397 }
26398
26399 resolve({
26400 ok: !(res.statusCode >= 400),
26401 status: res.statusCode,
26402 headers: res.header,
26403 data: res.data
26404 });
26405 }
26406 });
26407
26408 var abortListener = function abortListener() {
26409 reject(new AbortError("Request aborted"));
26410 task.abort();
26411 };
26412
26413 signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", abortListener);
26414 });
26415};
26416
26417var upload = function upload(url, file, options) {
26418 if (options === void 0) {
26419 options = {};
26420 }
26421
26422 var headers = options.headers,
26423 data = options.data,
26424 onprogress = options.onprogress,
26425 signal = options.signal;
26426
26427 if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
26428 return _promise.default.reject(new AbortError("Request aborted"));
26429 }
26430
26431 if (!(file && file.data && file.data.uri)) {
26432 return _promise.default.reject(new TypeError("File data must be an object like { uri: localPath }."));
26433 }
26434
26435 return new _promise.default(function (resolve, reject) {
26436 var task = wx.uploadFile({
26437 url: url,
26438 header: headers,
26439 filePath: file.data.uri,
26440 name: file.field,
26441 formData: data,
26442 success: function success(response) {
26443 var status = response.statusCode,
26444 data = response.data,
26445 rest = __rest(response, ["statusCode", "data"]);
26446
26447 resolve(_assign(_assign({}, rest), {
26448 data: typeof data === "string" ? JSON.parse(data) : data,
26449 status: status,
26450 ok: !(status >= 400)
26451 }));
26452 },
26453 fail: function fail(response) {
26454 reject(new Error(response.errMsg));
26455 },
26456 complete: function complete() {
26457 signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", abortListener);
26458 }
26459 });
26460
26461 var abortListener = function abortListener() {
26462 reject(new AbortError("Request aborted"));
26463 task.abort();
26464 };
26465
26466 signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", abortListener);
26467
26468 if (onprogress) {
26469 task.onProgressUpdate(function (event) {
26470 return onprogress({
26471 loaded: event.totalBytesSent,
26472 total: event.totalBytesExpectedToSend,
26473 percent: event.progress
26474 });
26475 });
26476 }
26477 });
26478};
26479/**
26480 * @author Toru Nagashima <https://github.com/mysticatea>
26481 * @copyright 2015 Toru Nagashima. All rights reserved.
26482 * See LICENSE file in root directory for full license.
26483 */
26484
26485/**
26486 * @typedef {object} PrivateData
26487 * @property {EventTarget} eventTarget The event target.
26488 * @property {{type:string}} event The original event object.
26489 * @property {number} eventPhase The current event phase.
26490 * @property {EventTarget|null} currentTarget The current event target.
26491 * @property {boolean} canceled The flag to prevent default.
26492 * @property {boolean} stopped The flag to stop propagation.
26493 * @property {boolean} immediateStopped The flag to stop propagation immediately.
26494 * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.
26495 * @property {number} timeStamp The unix time.
26496 * @private
26497 */
26498
26499/**
26500 * Private data for event wrappers.
26501 * @type {WeakMap<Event, PrivateData>}
26502 * @private
26503 */
26504
26505
26506var privateData = new _weakMap.default();
26507/**
26508 * Cache for wrapper classes.
26509 * @type {WeakMap<Object, Function>}
26510 * @private
26511 */
26512
26513var wrappers = new _weakMap.default();
26514/**
26515 * Get private data.
26516 * @param {Event} event The event object to get private data.
26517 * @returns {PrivateData} The private data of the event.
26518 * @private
26519 */
26520
26521function pd(event) {
26522 var retv = privateData.get(event);
26523 console.assert(retv != null, "'this' is expected an Event object, but got", event);
26524 return retv;
26525}
26526/**
26527 * https://dom.spec.whatwg.org/#set-the-canceled-flag
26528 * @param data {PrivateData} private data.
26529 */
26530
26531
26532function setCancelFlag(data) {
26533 if (data.passiveListener != null) {
26534 if (typeof console !== "undefined" && typeof console.error === "function") {
26535 console.error("Unable to preventDefault inside passive event listener invocation.", data.passiveListener);
26536 }
26537
26538 return;
26539 }
26540
26541 if (!data.event.cancelable) {
26542 return;
26543 }
26544
26545 data.canceled = true;
26546
26547 if (typeof data.event.preventDefault === "function") {
26548 data.event.preventDefault();
26549 }
26550}
26551/**
26552 * @see https://dom.spec.whatwg.org/#interface-event
26553 * @private
26554 */
26555
26556/**
26557 * The event wrapper.
26558 * @constructor
26559 * @param {EventTarget} eventTarget The event target of this dispatching.
26560 * @param {Event|{type:string}} event The original event to wrap.
26561 */
26562
26563
26564function Event(eventTarget, event) {
26565 privateData.set(this, {
26566 eventTarget: eventTarget,
26567 event: event,
26568 eventPhase: 2,
26569 currentTarget: eventTarget,
26570 canceled: false,
26571 stopped: false,
26572 immediateStopped: false,
26573 passiveListener: null,
26574 timeStamp: event.timeStamp || Date.now()
26575 }); // https://heycam.github.io/webidl/#Unforgeable
26576
26577 (0, _defineProperty.default)(this, "isTrusted", {
26578 value: false,
26579 enumerable: true
26580 }); // Define accessors
26581
26582 var keys = (0, _keys.default)(event);
26583
26584 for (var i = 0; i < keys.length; ++i) {
26585 var key = keys[i];
26586
26587 if (!(key in this)) {
26588 (0, _defineProperty.default)(this, key, defineRedirectDescriptor(key));
26589 }
26590 }
26591} // Should be enumerable, but class methods are not enumerable.
26592
26593
26594Event.prototype = {
26595 /**
26596 * The type of this event.
26597 * @type {string}
26598 */
26599 get type() {
26600 return pd(this).event.type;
26601 },
26602
26603 /**
26604 * The target of this event.
26605 * @type {EventTarget}
26606 */
26607 get target() {
26608 return pd(this).eventTarget;
26609 },
26610
26611 /**
26612 * The target of this event.
26613 * @type {EventTarget}
26614 */
26615 get currentTarget() {
26616 return pd(this).currentTarget;
26617 },
26618
26619 /**
26620 * @returns {EventTarget[]} The composed path of this event.
26621 */
26622 composedPath: function composedPath() {
26623 var currentTarget = pd(this).currentTarget;
26624
26625 if (currentTarget == null) {
26626 return [];
26627 }
26628
26629 return [currentTarget];
26630 },
26631
26632 /**
26633 * Constant of NONE.
26634 * @type {number}
26635 */
26636 get NONE() {
26637 return 0;
26638 },
26639
26640 /**
26641 * Constant of CAPTURING_PHASE.
26642 * @type {number}
26643 */
26644 get CAPTURING_PHASE() {
26645 return 1;
26646 },
26647
26648 /**
26649 * Constant of AT_TARGET.
26650 * @type {number}
26651 */
26652 get AT_TARGET() {
26653 return 2;
26654 },
26655
26656 /**
26657 * Constant of BUBBLING_PHASE.
26658 * @type {number}
26659 */
26660 get BUBBLING_PHASE() {
26661 return 3;
26662 },
26663
26664 /**
26665 * The target of this event.
26666 * @type {number}
26667 */
26668 get eventPhase() {
26669 return pd(this).eventPhase;
26670 },
26671
26672 /**
26673 * Stop event bubbling.
26674 * @returns {void}
26675 */
26676 stopPropagation: function stopPropagation() {
26677 var data = pd(this);
26678 data.stopped = true;
26679
26680 if (typeof data.event.stopPropagation === "function") {
26681 data.event.stopPropagation();
26682 }
26683 },
26684
26685 /**
26686 * Stop event bubbling.
26687 * @returns {void}
26688 */
26689 stopImmediatePropagation: function stopImmediatePropagation() {
26690 var data = pd(this);
26691 data.stopped = true;
26692 data.immediateStopped = true;
26693
26694 if (typeof data.event.stopImmediatePropagation === "function") {
26695 data.event.stopImmediatePropagation();
26696 }
26697 },
26698
26699 /**
26700 * The flag to be bubbling.
26701 * @type {boolean}
26702 */
26703 get bubbles() {
26704 return Boolean(pd(this).event.bubbles);
26705 },
26706
26707 /**
26708 * The flag to be cancelable.
26709 * @type {boolean}
26710 */
26711 get cancelable() {
26712 return Boolean(pd(this).event.cancelable);
26713 },
26714
26715 /**
26716 * Cancel this event.
26717 * @returns {void}
26718 */
26719 preventDefault: function preventDefault() {
26720 setCancelFlag(pd(this));
26721 },
26722
26723 /**
26724 * The flag to indicate cancellation state.
26725 * @type {boolean}
26726 */
26727 get defaultPrevented() {
26728 return pd(this).canceled;
26729 },
26730
26731 /**
26732 * The flag to be composed.
26733 * @type {boolean}
26734 */
26735 get composed() {
26736 return Boolean(pd(this).event.composed);
26737 },
26738
26739 /**
26740 * The unix time of this event.
26741 * @type {number}
26742 */
26743 get timeStamp() {
26744 return pd(this).timeStamp;
26745 },
26746
26747 /**
26748 * The target of this event.
26749 * @type {EventTarget}
26750 * @deprecated
26751 */
26752 get srcElement() {
26753 return pd(this).eventTarget;
26754 },
26755
26756 /**
26757 * The flag to stop event bubbling.
26758 * @type {boolean}
26759 * @deprecated
26760 */
26761 get cancelBubble() {
26762 return pd(this).stopped;
26763 },
26764
26765 set cancelBubble(value) {
26766 if (!value) {
26767 return;
26768 }
26769
26770 var data = pd(this);
26771 data.stopped = true;
26772
26773 if (typeof data.event.cancelBubble === "boolean") {
26774 data.event.cancelBubble = true;
26775 }
26776 },
26777
26778 /**
26779 * The flag to indicate cancellation state.
26780 * @type {boolean}
26781 * @deprecated
26782 */
26783 get returnValue() {
26784 return !pd(this).canceled;
26785 },
26786
26787 set returnValue(value) {
26788 if (!value) {
26789 setCancelFlag(pd(this));
26790 }
26791 },
26792
26793 /**
26794 * Initialize this event object. But do nothing under event dispatching.
26795 * @param {string} type The event type.
26796 * @param {boolean} [bubbles=false] The flag to be possible to bubble up.
26797 * @param {boolean} [cancelable=false] The flag to be possible to cancel.
26798 * @deprecated
26799 */
26800 initEvent: function initEvent() {// Do nothing.
26801 }
26802}; // `constructor` is not enumerable.
26803
26804(0, _defineProperty.default)(Event.prototype, "constructor", {
26805 value: Event,
26806 configurable: true,
26807 writable: true
26808}); // Ensure `event instanceof window.Event` is `true`.
26809
26810if (typeof window !== "undefined" && typeof window.Event !== "undefined") {
26811 (0, _setPrototypeOf.default)(Event.prototype, window.Event.prototype); // Make association for wrappers.
26812
26813 wrappers.set(window.Event.prototype, Event);
26814}
26815/**
26816 * Get the property descriptor to redirect a given property.
26817 * @param {string} key Property name to define property descriptor.
26818 * @returns {PropertyDescriptor} The property descriptor to redirect the property.
26819 * @private
26820 */
26821
26822
26823function defineRedirectDescriptor(key) {
26824 return {
26825 get: function get() {
26826 return pd(this).event[key];
26827 },
26828 set: function set(value) {
26829 pd(this).event[key] = value;
26830 },
26831 configurable: true,
26832 enumerable: true
26833 };
26834}
26835/**
26836 * Get the property descriptor to call a given method property.
26837 * @param {string} key Property name to define property descriptor.
26838 * @returns {PropertyDescriptor} The property descriptor to call the method property.
26839 * @private
26840 */
26841
26842
26843function defineCallDescriptor(key) {
26844 return {
26845 value: function value() {
26846 var event = pd(this).event;
26847 return event[key].apply(event, arguments);
26848 },
26849 configurable: true,
26850 enumerable: true
26851 };
26852}
26853/**
26854 * Define new wrapper class.
26855 * @param {Function} BaseEvent The base wrapper class.
26856 * @param {Object} proto The prototype of the original event.
26857 * @returns {Function} The defined wrapper class.
26858 * @private
26859 */
26860
26861
26862function defineWrapper(BaseEvent, proto) {
26863 var keys = (0, _keys.default)(proto);
26864
26865 if (keys.length === 0) {
26866 return BaseEvent;
26867 }
26868 /** CustomEvent */
26869
26870
26871 function CustomEvent(eventTarget, event) {
26872 BaseEvent.call(this, eventTarget, event);
26873 }
26874
26875 CustomEvent.prototype = Object.create(BaseEvent.prototype, {
26876 constructor: {
26877 value: CustomEvent,
26878 configurable: true,
26879 writable: true
26880 }
26881 }); // Define accessors.
26882
26883 for (var i = 0; i < keys.length; ++i) {
26884 var key = keys[i];
26885
26886 if (!(key in BaseEvent.prototype)) {
26887 var descriptor = (0, _getOwnPropertyDescriptor.default)(proto, key);
26888 var isFunc = typeof descriptor.value === "function";
26889 (0, _defineProperty.default)(CustomEvent.prototype, key, isFunc ? defineCallDescriptor(key) : defineRedirectDescriptor(key));
26890 }
26891 }
26892
26893 return CustomEvent;
26894}
26895/**
26896 * Get the wrapper class of a given prototype.
26897 * @param {Object} proto The prototype of the original event to get its wrapper.
26898 * @returns {Function} The wrapper class.
26899 * @private
26900 */
26901
26902
26903function getWrapper(proto) {
26904 if (proto == null || proto === Object.prototype) {
26905 return Event;
26906 }
26907
26908 var wrapper = wrappers.get(proto);
26909
26910 if (wrapper == null) {
26911 wrapper = defineWrapper(getWrapper((0, _getPrototypeOf.default)(proto)), proto);
26912 wrappers.set(proto, wrapper);
26913 }
26914
26915 return wrapper;
26916}
26917/**
26918 * Wrap a given event to management a dispatching.
26919 * @param {EventTarget} eventTarget The event target of this dispatching.
26920 * @param {Object} event The event to wrap.
26921 * @returns {Event} The wrapper instance.
26922 * @private
26923 */
26924
26925
26926function wrapEvent(eventTarget, event) {
26927 var Wrapper = getWrapper((0, _getPrototypeOf.default)(event));
26928 return new Wrapper(eventTarget, event);
26929}
26930/**
26931 * Get the immediateStopped flag of a given event.
26932 * @param {Event} event The event to get.
26933 * @returns {boolean} The flag to stop propagation immediately.
26934 * @private
26935 */
26936
26937
26938function isStopped(event) {
26939 return pd(event).immediateStopped;
26940}
26941/**
26942 * Set the current event phase of a given event.
26943 * @param {Event} event The event to set current target.
26944 * @param {number} eventPhase New event phase.
26945 * @returns {void}
26946 * @private
26947 */
26948
26949
26950function setEventPhase(event, eventPhase) {
26951 pd(event).eventPhase = eventPhase;
26952}
26953/**
26954 * Set the current target of a given event.
26955 * @param {Event} event The event to set current target.
26956 * @param {EventTarget|null} currentTarget New current target.
26957 * @returns {void}
26958 * @private
26959 */
26960
26961
26962function setCurrentTarget(event, currentTarget) {
26963 pd(event).currentTarget = currentTarget;
26964}
26965/**
26966 * Set a passive listener of a given event.
26967 * @param {Event} event The event to set current target.
26968 * @param {Function|null} passiveListener New passive listener.
26969 * @returns {void}
26970 * @private
26971 */
26972
26973
26974function setPassiveListener(event, passiveListener) {
26975 pd(event).passiveListener = passiveListener;
26976}
26977/**
26978 * @typedef {object} ListenerNode
26979 * @property {Function} listener
26980 * @property {1|2|3} listenerType
26981 * @property {boolean} passive
26982 * @property {boolean} once
26983 * @property {ListenerNode|null} next
26984 * @private
26985 */
26986
26987/**
26988 * @type {WeakMap<object, Map<string, ListenerNode>>}
26989 * @private
26990 */
26991
26992
26993var listenersMap = new _weakMap.default(); // Listener types
26994
26995var CAPTURE = 1;
26996var BUBBLE = 2;
26997var ATTRIBUTE = 3;
26998/**
26999 * Check whether a given value is an object or not.
27000 * @param {any} x The value to check.
27001 * @returns {boolean} `true` if the value is an object.
27002 */
27003
27004function isObject(x) {
27005 return x !== null && (0, _typeof2.default)(x) === "object"; //eslint-disable-line no-restricted-syntax
27006}
27007/**
27008 * Get listeners.
27009 * @param {EventTarget} eventTarget The event target to get.
27010 * @returns {Map<string, ListenerNode>} The listeners.
27011 * @private
27012 */
27013
27014
27015function getListeners(eventTarget) {
27016 var listeners = listenersMap.get(eventTarget);
27017
27018 if (listeners == null) {
27019 throw new TypeError("'this' is expected an EventTarget object, but got another value.");
27020 }
27021
27022 return listeners;
27023}
27024/**
27025 * Get the property descriptor for the event attribute of a given event.
27026 * @param {string} eventName The event name to get property descriptor.
27027 * @returns {PropertyDescriptor} The property descriptor.
27028 * @private
27029 */
27030
27031
27032function defineEventAttributeDescriptor(eventName) {
27033 return {
27034 get: function get() {
27035 var listeners = getListeners(this);
27036 var node = listeners.get(eventName);
27037
27038 while (node != null) {
27039 if (node.listenerType === ATTRIBUTE) {
27040 return node.listener;
27041 }
27042
27043 node = node.next;
27044 }
27045
27046 return null;
27047 },
27048 set: function set(listener) {
27049 if (typeof listener !== "function" && !isObject(listener)) {
27050 listener = null; // eslint-disable-line no-param-reassign
27051 }
27052
27053 var listeners = getListeners(this); // Traverse to the tail while removing old value.
27054
27055 var prev = null;
27056 var node = listeners.get(eventName);
27057
27058 while (node != null) {
27059 if (node.listenerType === ATTRIBUTE) {
27060 // Remove old value.
27061 if (prev !== null) {
27062 prev.next = node.next;
27063 } else if (node.next !== null) {
27064 listeners.set(eventName, node.next);
27065 } else {
27066 listeners.delete(eventName);
27067 }
27068 } else {
27069 prev = node;
27070 }
27071
27072 node = node.next;
27073 } // Add new value.
27074
27075
27076 if (listener !== null) {
27077 var newNode = {
27078 listener: listener,
27079 listenerType: ATTRIBUTE,
27080 passive: false,
27081 once: false,
27082 next: null
27083 };
27084
27085 if (prev === null) {
27086 listeners.set(eventName, newNode);
27087 } else {
27088 prev.next = newNode;
27089 }
27090 }
27091 },
27092 configurable: true,
27093 enumerable: true
27094 };
27095}
27096/**
27097 * Define an event attribute (e.g. `eventTarget.onclick`).
27098 * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.
27099 * @param {string} eventName The event name to define.
27100 * @returns {void}
27101 */
27102
27103
27104function defineEventAttribute(eventTargetPrototype, eventName) {
27105 (0, _defineProperty.default)(eventTargetPrototype, "on".concat(eventName), defineEventAttributeDescriptor(eventName));
27106}
27107/**
27108 * Define a custom EventTarget with event attributes.
27109 * @param {string[]} eventNames Event names for event attributes.
27110 * @returns {EventTarget} The custom EventTarget.
27111 * @private
27112 */
27113
27114
27115function defineCustomEventTarget(eventNames) {
27116 /** CustomEventTarget */
27117 function CustomEventTarget() {
27118 EventTarget.call(this);
27119 }
27120
27121 CustomEventTarget.prototype = Object.create(EventTarget.prototype, {
27122 constructor: {
27123 value: CustomEventTarget,
27124 configurable: true,
27125 writable: true
27126 }
27127 });
27128
27129 for (var i = 0; i < eventNames.length; ++i) {
27130 defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);
27131 }
27132
27133 return CustomEventTarget;
27134}
27135/**
27136 * EventTarget.
27137 *
27138 * - This is constructor if no arguments.
27139 * - This is a function which returns a CustomEventTarget constructor if there are arguments.
27140 *
27141 * For example:
27142 *
27143 * class A extends EventTarget {}
27144 * class B extends EventTarget("message") {}
27145 * class C extends EventTarget("message", "error") {}
27146 * class D extends EventTarget(["message", "error"]) {}
27147 */
27148
27149
27150function EventTarget() {
27151 /*eslint-disable consistent-return */
27152 if (this instanceof EventTarget) {
27153 listenersMap.set(this, new _map.default());
27154 return;
27155 }
27156
27157 if (arguments.length === 1 && Array.isArray(arguments[0])) {
27158 return defineCustomEventTarget(arguments[0]);
27159 }
27160
27161 if (arguments.length > 0) {
27162 var types = new Array(arguments.length);
27163
27164 for (var i = 0; i < arguments.length; ++i) {
27165 types[i] = arguments[i];
27166 }
27167
27168 return defineCustomEventTarget(types);
27169 }
27170
27171 throw new TypeError("Cannot call a class as a function");
27172 /*eslint-enable consistent-return */
27173} // Should be enumerable, but class methods are not enumerable.
27174
27175
27176EventTarget.prototype = {
27177 /**
27178 * Add a given listener to this event target.
27179 * @param {string} eventName The event name to add.
27180 * @param {Function} listener The listener to add.
27181 * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
27182 * @returns {void}
27183 */
27184 addEventListener: function addEventListener(eventName, listener, options) {
27185 if (listener == null) {
27186 return;
27187 }
27188
27189 if (typeof listener !== "function" && !isObject(listener)) {
27190 throw new TypeError("'listener' should be a function or an object.");
27191 }
27192
27193 var listeners = getListeners(this);
27194 var optionsIsObj = isObject(options);
27195 var capture = optionsIsObj ? Boolean(options.capture) : Boolean(options);
27196 var listenerType = capture ? CAPTURE : BUBBLE;
27197 var newNode = {
27198 listener: listener,
27199 listenerType: listenerType,
27200 passive: optionsIsObj && Boolean(options.passive),
27201 once: optionsIsObj && Boolean(options.once),
27202 next: null
27203 }; // Set it as the first node if the first node is null.
27204
27205 var node = listeners.get(eventName);
27206
27207 if (node === undefined) {
27208 listeners.set(eventName, newNode);
27209 return;
27210 } // Traverse to the tail while checking duplication..
27211
27212
27213 var prev = null;
27214
27215 while (node != null) {
27216 if (node.listener === listener && node.listenerType === listenerType) {
27217 // Should ignore duplication.
27218 return;
27219 }
27220
27221 prev = node;
27222 node = node.next;
27223 } // Add it.
27224
27225
27226 prev.next = newNode;
27227 },
27228
27229 /**
27230 * Remove a given listener from this event target.
27231 * @param {string} eventName The event name to remove.
27232 * @param {Function} listener The listener to remove.
27233 * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
27234 * @returns {void}
27235 */
27236 removeEventListener: function removeEventListener(eventName, listener, options) {
27237 if (listener == null) {
27238 return;
27239 }
27240
27241 var listeners = getListeners(this);
27242 var capture = isObject(options) ? Boolean(options.capture) : Boolean(options);
27243 var listenerType = capture ? CAPTURE : BUBBLE;
27244 var prev = null;
27245 var node = listeners.get(eventName);
27246
27247 while (node != null) {
27248 if (node.listener === listener && node.listenerType === listenerType) {
27249 if (prev !== null) {
27250 prev.next = node.next;
27251 } else if (node.next !== null) {
27252 listeners.set(eventName, node.next);
27253 } else {
27254 listeners.delete(eventName);
27255 }
27256
27257 return;
27258 }
27259
27260 prev = node;
27261 node = node.next;
27262 }
27263 },
27264
27265 /**
27266 * Dispatch a given event.
27267 * @param {Event|{type:string}} event The event to dispatch.
27268 * @returns {boolean} `false` if canceled.
27269 */
27270 dispatchEvent: function dispatchEvent(event) {
27271 if (event == null || typeof event.type !== "string") {
27272 throw new TypeError('"event.type" should be a string.');
27273 } // If listeners aren't registered, terminate.
27274
27275
27276 var listeners = getListeners(this);
27277 var eventName = event.type;
27278 var node = listeners.get(eventName);
27279
27280 if (node == null) {
27281 return true;
27282 } // Since we cannot rewrite several properties, so wrap object.
27283
27284
27285 var wrappedEvent = wrapEvent(this, event); // This doesn't process capturing phase and bubbling phase.
27286 // This isn't participating in a tree.
27287
27288 var prev = null;
27289
27290 while (node != null) {
27291 // Remove this listener if it's once
27292 if (node.once) {
27293 if (prev !== null) {
27294 prev.next = node.next;
27295 } else if (node.next !== null) {
27296 listeners.set(eventName, node.next);
27297 } else {
27298 listeners.delete(eventName);
27299 }
27300 } else {
27301 prev = node;
27302 } // Call this listener
27303
27304
27305 setPassiveListener(wrappedEvent, node.passive ? node.listener : null);
27306
27307 if (typeof node.listener === "function") {
27308 try {
27309 node.listener.call(this, wrappedEvent);
27310 } catch (err) {
27311 if (typeof console !== "undefined" && typeof console.error === "function") {
27312 console.error(err);
27313 }
27314 }
27315 } else if (node.listenerType !== ATTRIBUTE && typeof node.listener.handleEvent === "function") {
27316 node.listener.handleEvent(wrappedEvent);
27317 } // Break if `event.stopImmediatePropagation` was called.
27318
27319
27320 if (isStopped(wrappedEvent)) {
27321 break;
27322 }
27323
27324 node = node.next;
27325 }
27326
27327 setPassiveListener(wrappedEvent, null);
27328 setEventPhase(wrappedEvent, 0);
27329 setCurrentTarget(wrappedEvent, null);
27330 return !wrappedEvent.defaultPrevented;
27331 }
27332}; // `constructor` is not enumerable.
27333
27334(0, _defineProperty.default)(EventTarget.prototype, "constructor", {
27335 value: EventTarget,
27336 configurable: true,
27337 writable: true
27338}); // Ensure `eventTarget instanceof window.EventTarget` is `true`.
27339
27340if (typeof window !== "undefined" && typeof window.EventTarget !== "undefined") {
27341 (0, _setPrototypeOf.default)(EventTarget.prototype, window.EventTarget.prototype);
27342}
27343
27344var WS =
27345/** @class */
27346function (_super) {
27347 __extends$1(WS, _super);
27348
27349 function WS(url, protocol) {
27350 var _this = _super.call(this) || this;
27351
27352 _this._readyState = WS.CLOSED;
27353
27354 if (!url) {
27355 throw new TypeError("Failed to construct 'WebSocket': url required");
27356 }
27357
27358 _this._url = url;
27359 _this._protocol = protocol;
27360 return _this;
27361 }
27362
27363 (0, _defineProperty.default)(WS.prototype, "url", {
27364 get: function get() {
27365 return this._url;
27366 },
27367 enumerable: false,
27368 configurable: true
27369 });
27370 (0, _defineProperty.default)(WS.prototype, "protocol", {
27371 get: function get() {
27372 return this._protocol;
27373 },
27374 enumerable: false,
27375 configurable: true
27376 });
27377 (0, _defineProperty.default)(WS.prototype, "readyState", {
27378 get: function get() {
27379 return this._readyState;
27380 },
27381 enumerable: false,
27382 configurable: true
27383 });
27384 WS.CONNECTING = 0;
27385 WS.OPEN = 1;
27386 WS.CLOSING = 2;
27387 WS.CLOSED = 3;
27388 return WS;
27389}(EventTarget("open", "error", "message", "close"));
27390
27391var WechatWS =
27392/** @class */
27393function (_super) {
27394 __extends$1(WechatWS, _super);
27395
27396 function WechatWS(url, protocol) {
27397 var _this = _super.call(this, url, protocol) || this;
27398
27399 if (protocol && !(wx.canIUse && wx.canIUse("connectSocket.object.protocols"))) {
27400 throw new Error("subprotocol not supported in weapp");
27401 }
27402
27403 _this._readyState = WS.CONNECTING;
27404
27405 var errorHandler = function errorHandler(event) {
27406 _this._readyState = WS.CLOSED;
27407
27408 _this.dispatchEvent({
27409 type: "error",
27410 message: event.errMsg
27411 });
27412 };
27413
27414 var socketTask = wx.connectSocket({
27415 url: url,
27416 protocols: _this._protocol === undefined || Array.isArray(_this._protocol) ? _this._protocol : [_this._protocol],
27417 fail: function fail(error) {
27418 return setTimeout(function () {
27419 return errorHandler(error);
27420 }, 0);
27421 }
27422 });
27423 _this._socketTask = socketTask;
27424 socketTask.onOpen(function () {
27425 _this._readyState = WS.OPEN;
27426
27427 _this.dispatchEvent({
27428 type: "open"
27429 });
27430 });
27431 socketTask.onError(errorHandler);
27432 socketTask.onMessage(function (event) {
27433 var data = event.data;
27434
27435 _this.dispatchEvent({
27436 data: data,
27437 type: "message"
27438 });
27439 });
27440 socketTask.onClose(function (event) {
27441 _this._readyState = WS.CLOSED;
27442 var code = event.code,
27443 reason = event.reason;
27444
27445 _this.dispatchEvent({
27446 code: code,
27447 reason: reason,
27448 type: "close"
27449 });
27450 });
27451 return _this;
27452 }
27453
27454 WechatWS.prototype.close = function () {
27455 if (this.readyState === WS.CLOSED) return;
27456
27457 if (this.readyState === WS.CONNECTING) {
27458 console.warn("close WebSocket which is connecting might not work");
27459 }
27460
27461 this._socketTask.close({});
27462 };
27463
27464 WechatWS.prototype.send = function (data) {
27465 if (this.readyState !== WS.OPEN) {
27466 throw new Error("INVALID_STATE_ERR");
27467 }
27468
27469 if (!(typeof data === "string" || data instanceof ArrayBuffer)) {
27470 throw new TypeError("only String/ArrayBuffer supported");
27471 }
27472
27473 this._socketTask.send({
27474 data: data
27475 });
27476 };
27477
27478 return WechatWS;
27479}(WS);
27480
27481var WebSocket = WechatWS;
27482var platformInfo = {
27483 name: "Weapp"
27484};
27485exports.WebSocket = WebSocket;
27486exports.getAuthInfo = getAuthInfo;
27487exports.platformInfo = platformInfo;
27488exports.request = request;
27489exports.storage = storage;
27490exports.upload = upload;
27491
27492/***/ }),
27493/* 570 */
27494/***/ (function(module, exports, __webpack_require__) {
27495
27496var parent = __webpack_require__(571);
27497
27498module.exports = parent;
27499
27500
27501/***/ }),
27502/* 571 */
27503/***/ (function(module, exports, __webpack_require__) {
27504
27505__webpack_require__(572);
27506var path = __webpack_require__(5);
27507
27508module.exports = path.Object.assign;
27509
27510
27511/***/ }),
27512/* 572 */
27513/***/ (function(module, exports, __webpack_require__) {
27514
27515var $ = __webpack_require__(0);
27516var assign = __webpack_require__(573);
27517
27518// `Object.assign` method
27519// https://tc39.es/ecma262/#sec-object.assign
27520// eslint-disable-next-line es-x/no-object-assign -- required for testing
27521$({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
27522 assign: assign
27523});
27524
27525
27526/***/ }),
27527/* 573 */
27528/***/ (function(module, exports, __webpack_require__) {
27529
27530"use strict";
27531
27532var DESCRIPTORS = __webpack_require__(14);
27533var uncurryThis = __webpack_require__(4);
27534var call = __webpack_require__(15);
27535var fails = __webpack_require__(2);
27536var objectKeys = __webpack_require__(105);
27537var getOwnPropertySymbolsModule = __webpack_require__(104);
27538var propertyIsEnumerableModule = __webpack_require__(120);
27539var toObject = __webpack_require__(34);
27540var IndexedObject = __webpack_require__(95);
27541
27542// eslint-disable-next-line es-x/no-object-assign -- safe
27543var $assign = Object.assign;
27544// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
27545var defineProperty = Object.defineProperty;
27546var concat = uncurryThis([].concat);
27547
27548// `Object.assign` method
27549// https://tc39.es/ecma262/#sec-object.assign
27550module.exports = !$assign || fails(function () {
27551 // should have correct order of operations (Edge bug)
27552 if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
27553 enumerable: true,
27554 get: function () {
27555 defineProperty(this, 'b', {
27556 value: 3,
27557 enumerable: false
27558 });
27559 }
27560 }), { b: 2 })).b !== 1) return true;
27561 // should work with symbols and should have deterministic property order (V8 bug)
27562 var A = {};
27563 var B = {};
27564 // eslint-disable-next-line es-x/no-symbol -- safe
27565 var symbol = Symbol();
27566 var alphabet = 'abcdefghijklmnopqrst';
27567 A[symbol] = 7;
27568 alphabet.split('').forEach(function (chr) { B[chr] = chr; });
27569 return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
27570}) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
27571 var T = toObject(target);
27572 var argumentsLength = arguments.length;
27573 var index = 1;
27574 var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
27575 var propertyIsEnumerable = propertyIsEnumerableModule.f;
27576 while (argumentsLength > index) {
27577 var S = IndexedObject(arguments[index++]);
27578 var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
27579 var length = keys.length;
27580 var j = 0;
27581 var key;
27582 while (length > j) {
27583 key = keys[j++];
27584 if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key];
27585 }
27586 } return T;
27587} : $assign;
27588
27589
27590/***/ }),
27591/* 574 */
27592/***/ (function(module, exports, __webpack_require__) {
27593
27594var parent = __webpack_require__(575);
27595
27596module.exports = parent;
27597
27598
27599/***/ }),
27600/* 575 */
27601/***/ (function(module, exports, __webpack_require__) {
27602
27603__webpack_require__(244);
27604var path = __webpack_require__(5);
27605
27606module.exports = path.Object.getOwnPropertySymbols;
27607
27608
27609/***/ }),
27610/* 576 */
27611/***/ (function(module, exports, __webpack_require__) {
27612
27613module.exports = __webpack_require__(249);
27614
27615/***/ }),
27616/* 577 */
27617/***/ (function(module, exports, __webpack_require__) {
27618
27619var parent = __webpack_require__(578);
27620__webpack_require__(39);
27621
27622module.exports = parent;
27623
27624
27625/***/ }),
27626/* 578 */
27627/***/ (function(module, exports, __webpack_require__) {
27628
27629__webpack_require__(38);
27630__webpack_require__(53);
27631__webpack_require__(579);
27632var path = __webpack_require__(5);
27633
27634module.exports = path.WeakMap;
27635
27636
27637/***/ }),
27638/* 579 */
27639/***/ (function(module, exports, __webpack_require__) {
27640
27641// TODO: Remove this module from `core-js@4` since it's replaced to module below
27642__webpack_require__(580);
27643
27644
27645/***/ }),
27646/* 580 */
27647/***/ (function(module, exports, __webpack_require__) {
27648
27649"use strict";
27650
27651var global = __webpack_require__(7);
27652var uncurryThis = __webpack_require__(4);
27653var defineBuiltIns = __webpack_require__(154);
27654var InternalMetadataModule = __webpack_require__(94);
27655var collection = __webpack_require__(155);
27656var collectionWeak = __webpack_require__(582);
27657var isObject = __webpack_require__(11);
27658var isExtensible = __webpack_require__(261);
27659var enforceInternalState = __webpack_require__(43).enforce;
27660var NATIVE_WEAK_MAP = __webpack_require__(170);
27661
27662var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
27663var InternalWeakMap;
27664
27665var wrapper = function (init) {
27666 return function WeakMap() {
27667 return init(this, arguments.length ? arguments[0] : undefined);
27668 };
27669};
27670
27671// `WeakMap` constructor
27672// https://tc39.es/ecma262/#sec-weakmap-constructor
27673var $WeakMap = collection('WeakMap', wrapper, collectionWeak);
27674
27675// IE11 WeakMap frozen keys fix
27676// We can't use feature detection because it crash some old IE builds
27677// https://github.com/zloirock/core-js/issues/485
27678if (NATIVE_WEAK_MAP && IS_IE11) {
27679 InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);
27680 InternalMetadataModule.enable();
27681 var WeakMapPrototype = $WeakMap.prototype;
27682 var nativeDelete = uncurryThis(WeakMapPrototype['delete']);
27683 var nativeHas = uncurryThis(WeakMapPrototype.has);
27684 var nativeGet = uncurryThis(WeakMapPrototype.get);
27685 var nativeSet = uncurryThis(WeakMapPrototype.set);
27686 defineBuiltIns(WeakMapPrototype, {
27687 'delete': function (key) {
27688 if (isObject(key) && !isExtensible(key)) {
27689 var state = enforceInternalState(this);
27690 if (!state.frozen) state.frozen = new InternalWeakMap();
27691 return nativeDelete(this, key) || state.frozen['delete'](key);
27692 } return nativeDelete(this, key);
27693 },
27694 has: function has(key) {
27695 if (isObject(key) && !isExtensible(key)) {
27696 var state = enforceInternalState(this);
27697 if (!state.frozen) state.frozen = new InternalWeakMap();
27698 return nativeHas(this, key) || state.frozen.has(key);
27699 } return nativeHas(this, key);
27700 },
27701 get: function get(key) {
27702 if (isObject(key) && !isExtensible(key)) {
27703 var state = enforceInternalState(this);
27704 if (!state.frozen) state.frozen = new InternalWeakMap();
27705 return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key);
27706 } return nativeGet(this, key);
27707 },
27708 set: function set(key, value) {
27709 if (isObject(key) && !isExtensible(key)) {
27710 var state = enforceInternalState(this);
27711 if (!state.frozen) state.frozen = new InternalWeakMap();
27712 nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value);
27713 } else nativeSet(this, key, value);
27714 return this;
27715 }
27716 });
27717}
27718
27719
27720/***/ }),
27721/* 581 */
27722/***/ (function(module, exports, __webpack_require__) {
27723
27724// FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it
27725var fails = __webpack_require__(2);
27726
27727module.exports = fails(function () {
27728 if (typeof ArrayBuffer == 'function') {
27729 var buffer = new ArrayBuffer(8);
27730 // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-defineproperty -- safe
27731 if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 });
27732 }
27733});
27734
27735
27736/***/ }),
27737/* 582 */
27738/***/ (function(module, exports, __webpack_require__) {
27739
27740"use strict";
27741
27742var uncurryThis = __webpack_require__(4);
27743var defineBuiltIns = __webpack_require__(154);
27744var getWeakData = __webpack_require__(94).getWeakData;
27745var anObject = __webpack_require__(20);
27746var isObject = __webpack_require__(11);
27747var anInstance = __webpack_require__(108);
27748var iterate = __webpack_require__(42);
27749var ArrayIterationModule = __webpack_require__(70);
27750var hasOwn = __webpack_require__(13);
27751var InternalStateModule = __webpack_require__(43);
27752
27753var setInternalState = InternalStateModule.set;
27754var internalStateGetterFor = InternalStateModule.getterFor;
27755var find = ArrayIterationModule.find;
27756var findIndex = ArrayIterationModule.findIndex;
27757var splice = uncurryThis([].splice);
27758var id = 0;
27759
27760// fallback for uncaught frozen keys
27761var uncaughtFrozenStore = function (store) {
27762 return store.frozen || (store.frozen = new UncaughtFrozenStore());
27763};
27764
27765var UncaughtFrozenStore = function () {
27766 this.entries = [];
27767};
27768
27769var findUncaughtFrozen = function (store, key) {
27770 return find(store.entries, function (it) {
27771 return it[0] === key;
27772 });
27773};
27774
27775UncaughtFrozenStore.prototype = {
27776 get: function (key) {
27777 var entry = findUncaughtFrozen(this, key);
27778 if (entry) return entry[1];
27779 },
27780 has: function (key) {
27781 return !!findUncaughtFrozen(this, key);
27782 },
27783 set: function (key, value) {
27784 var entry = findUncaughtFrozen(this, key);
27785 if (entry) entry[1] = value;
27786 else this.entries.push([key, value]);
27787 },
27788 'delete': function (key) {
27789 var index = findIndex(this.entries, function (it) {
27790 return it[0] === key;
27791 });
27792 if (~index) splice(this.entries, index, 1);
27793 return !!~index;
27794 }
27795};
27796
27797module.exports = {
27798 getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
27799 var Constructor = wrapper(function (that, iterable) {
27800 anInstance(that, Prototype);
27801 setInternalState(that, {
27802 type: CONSTRUCTOR_NAME,
27803 id: id++,
27804 frozen: undefined
27805 });
27806 if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
27807 });
27808
27809 var Prototype = Constructor.prototype;
27810
27811 var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
27812
27813 var define = function (that, key, value) {
27814 var state = getInternalState(that);
27815 var data = getWeakData(anObject(key), true);
27816 if (data === true) uncaughtFrozenStore(state).set(key, value);
27817 else data[state.id] = value;
27818 return that;
27819 };
27820
27821 defineBuiltIns(Prototype, {
27822 // `{ WeakMap, WeakSet }.prototype.delete(key)` methods
27823 // https://tc39.es/ecma262/#sec-weakmap.prototype.delete
27824 // https://tc39.es/ecma262/#sec-weakset.prototype.delete
27825 'delete': function (key) {
27826 var state = getInternalState(this);
27827 if (!isObject(key)) return false;
27828 var data = getWeakData(key);
27829 if (data === true) return uncaughtFrozenStore(state)['delete'](key);
27830 return data && hasOwn(data, state.id) && delete data[state.id];
27831 },
27832 // `{ WeakMap, WeakSet }.prototype.has(key)` methods
27833 // https://tc39.es/ecma262/#sec-weakmap.prototype.has
27834 // https://tc39.es/ecma262/#sec-weakset.prototype.has
27835 has: function has(key) {
27836 var state = getInternalState(this);
27837 if (!isObject(key)) return false;
27838 var data = getWeakData(key);
27839 if (data === true) return uncaughtFrozenStore(state).has(key);
27840 return data && hasOwn(data, state.id);
27841 }
27842 });
27843
27844 defineBuiltIns(Prototype, IS_MAP ? {
27845 // `WeakMap.prototype.get(key)` method
27846 // https://tc39.es/ecma262/#sec-weakmap.prototype.get
27847 get: function get(key) {
27848 var state = getInternalState(this);
27849 if (isObject(key)) {
27850 var data = getWeakData(key);
27851 if (data === true) return uncaughtFrozenStore(state).get(key);
27852 return data ? data[state.id] : undefined;
27853 }
27854 },
27855 // `WeakMap.prototype.set(key, value)` method
27856 // https://tc39.es/ecma262/#sec-weakmap.prototype.set
27857 set: function set(key, value) {
27858 return define(this, key, value);
27859 }
27860 } : {
27861 // `WeakSet.prototype.add(value)` method
27862 // https://tc39.es/ecma262/#sec-weakset.prototype.add
27863 add: function add(value) {
27864 return define(this, value, true);
27865 }
27866 });
27867
27868 return Constructor;
27869 }
27870};
27871
27872
27873/***/ }),
27874/* 583 */
27875/***/ (function(module, exports, __webpack_require__) {
27876
27877module.exports = __webpack_require__(584);
27878
27879/***/ }),
27880/* 584 */
27881/***/ (function(module, exports, __webpack_require__) {
27882
27883var parent = __webpack_require__(585);
27884__webpack_require__(39);
27885
27886module.exports = parent;
27887
27888
27889/***/ }),
27890/* 585 */
27891/***/ (function(module, exports, __webpack_require__) {
27892
27893__webpack_require__(38);
27894__webpack_require__(586);
27895__webpack_require__(53);
27896__webpack_require__(55);
27897var path = __webpack_require__(5);
27898
27899module.exports = path.Map;
27900
27901
27902/***/ }),
27903/* 586 */
27904/***/ (function(module, exports, __webpack_require__) {
27905
27906// TODO: Remove this module from `core-js@4` since it's replaced to module below
27907__webpack_require__(587);
27908
27909
27910/***/ }),
27911/* 587 */
27912/***/ (function(module, exports, __webpack_require__) {
27913
27914"use strict";
27915
27916var collection = __webpack_require__(155);
27917var collectionStrong = __webpack_require__(263);
27918
27919// `Map` constructor
27920// https://tc39.es/ecma262/#sec-map-objects
27921collection('Map', function (init) {
27922 return function Map() { return init(this, arguments.length ? arguments[0] : undefined); };
27923}, collectionStrong);
27924
27925
27926/***/ }),
27927/* 588 */
27928/***/ (function(module, exports, __webpack_require__) {
27929
27930"use strict";
27931
27932
27933var _require = __webpack_require__(156),
27934 Realtime = _require.Realtime,
27935 setRTMAdapters = _require.setAdapters;
27936
27937var _require2 = __webpack_require__(664),
27938 LiveQueryPlugin = _require2.LiveQueryPlugin;
27939
27940Realtime.__preRegisteredPlugins = [LiveQueryPlugin];
27941
27942module.exports = function (AV) {
27943 AV._sharedConfig.liveQueryRealtime = Realtime;
27944 var setAdapters = AV.setAdapters;
27945
27946 AV.setAdapters = function (adapters) {
27947 setAdapters(adapters);
27948 setRTMAdapters(adapters);
27949 };
27950
27951 return AV;
27952};
27953
27954/***/ }),
27955/* 589 */
27956/***/ (function(module, exports, __webpack_require__) {
27957
27958"use strict";
27959/* WEBPACK VAR INJECTION */(function(global) {
27960
27961var _interopRequireDefault = __webpack_require__(1);
27962
27963var _typeof3 = _interopRequireDefault(__webpack_require__(73));
27964
27965var _defineProperty2 = _interopRequireDefault(__webpack_require__(92));
27966
27967var _freeze = _interopRequireDefault(__webpack_require__(590));
27968
27969var _assign = _interopRequireDefault(__webpack_require__(152));
27970
27971var _symbol = _interopRequireDefault(__webpack_require__(149));
27972
27973var _concat = _interopRequireDefault(__webpack_require__(22));
27974
27975var _keys = _interopRequireDefault(__webpack_require__(115));
27976
27977var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(153));
27978
27979var _filter = _interopRequireDefault(__webpack_require__(250));
27980
27981var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(151));
27982
27983var _getOwnPropertyDescriptors = _interopRequireDefault(__webpack_require__(594));
27984
27985var _defineProperties = _interopRequireDefault(__webpack_require__(598));
27986
27987var _promise = _interopRequireDefault(__webpack_require__(12));
27988
27989var _slice = _interopRequireDefault(__webpack_require__(61));
27990
27991var _indexOf = _interopRequireDefault(__webpack_require__(71));
27992
27993var _weakMap = _interopRequireDefault(__webpack_require__(260));
27994
27995var _stringify = _interopRequireDefault(__webpack_require__(36));
27996
27997var _map = _interopRequireDefault(__webpack_require__(35));
27998
27999var _reduce = _interopRequireDefault(__webpack_require__(602));
28000
28001var _find = _interopRequireDefault(__webpack_require__(93));
28002
28003var _set = _interopRequireDefault(__webpack_require__(264));
28004
28005var _context6, _context15;
28006
28007(0, _defineProperty2.default)(exports, '__esModule', {
28008 value: true
28009});
28010
28011function _interopDefault(ex) {
28012 return ex && (0, _typeof3.default)(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
28013}
28014
28015var protobufLight = _interopDefault(__webpack_require__(612));
28016
28017var EventEmitter = _interopDefault(__webpack_require__(616));
28018
28019var _regeneratorRuntime = _interopDefault(__webpack_require__(617));
28020
28021var _asyncToGenerator = _interopDefault(__webpack_require__(619));
28022
28023var _toConsumableArray = _interopDefault(__webpack_require__(620));
28024
28025var _defineProperty = _interopDefault(__webpack_require__(623));
28026
28027var _objectWithoutProperties = _interopDefault(__webpack_require__(624));
28028
28029var _assertThisInitialized = _interopDefault(__webpack_require__(626));
28030
28031var _inheritsLoose = _interopDefault(__webpack_require__(627));
28032
28033var d = _interopDefault(__webpack_require__(60));
28034
28035var shuffle = _interopDefault(__webpack_require__(628));
28036
28037var values = _interopDefault(__webpack_require__(269));
28038
28039var _toArray = _interopDefault(__webpack_require__(655));
28040
28041var _createClass = _interopDefault(__webpack_require__(658));
28042
28043var _applyDecoratedDescriptor = _interopDefault(__webpack_require__(659));
28044
28045var StateMachine = _interopDefault(__webpack_require__(660));
28046
28047var _typeof = _interopDefault(__webpack_require__(661));
28048
28049var isPlainObject = _interopDefault(__webpack_require__(662));
28050
28051var promiseTimeout = __webpack_require__(251);
28052
28053var messageCompiled = protobufLight.newBuilder({})['import']({
28054 "package": 'push_server.messages2',
28055 syntax: 'proto2',
28056 options: {
28057 objc_class_prefix: 'AVIM'
28058 },
28059 messages: [{
28060 name: 'JsonObjectMessage',
28061 syntax: 'proto2',
28062 fields: [{
28063 rule: 'required',
28064 type: 'string',
28065 name: 'data',
28066 id: 1
28067 }]
28068 }, {
28069 name: 'UnreadTuple',
28070 syntax: 'proto2',
28071 fields: [{
28072 rule: 'required',
28073 type: 'string',
28074 name: 'cid',
28075 id: 1
28076 }, {
28077 rule: 'required',
28078 type: 'int32',
28079 name: 'unread',
28080 id: 2
28081 }, {
28082 rule: 'optional',
28083 type: 'string',
28084 name: 'mid',
28085 id: 3
28086 }, {
28087 rule: 'optional',
28088 type: 'int64',
28089 name: 'timestamp',
28090 id: 4
28091 }, {
28092 rule: 'optional',
28093 type: 'string',
28094 name: 'from',
28095 id: 5
28096 }, {
28097 rule: 'optional',
28098 type: 'string',
28099 name: 'data',
28100 id: 6
28101 }, {
28102 rule: 'optional',
28103 type: 'int64',
28104 name: 'patchTimestamp',
28105 id: 7
28106 }, {
28107 rule: 'optional',
28108 type: 'bool',
28109 name: 'mentioned',
28110 id: 8
28111 }, {
28112 rule: 'optional',
28113 type: 'bytes',
28114 name: 'binaryMsg',
28115 id: 9
28116 }, {
28117 rule: 'optional',
28118 type: 'int32',
28119 name: 'convType',
28120 id: 10
28121 }]
28122 }, {
28123 name: 'LogItem',
28124 syntax: 'proto2',
28125 fields: [{
28126 rule: 'optional',
28127 type: 'string',
28128 name: 'from',
28129 id: 1
28130 }, {
28131 rule: 'optional',
28132 type: 'string',
28133 name: 'data',
28134 id: 2
28135 }, {
28136 rule: 'optional',
28137 type: 'int64',
28138 name: 'timestamp',
28139 id: 3
28140 }, {
28141 rule: 'optional',
28142 type: 'string',
28143 name: 'msgId',
28144 id: 4
28145 }, {
28146 rule: 'optional',
28147 type: 'int64',
28148 name: 'ackAt',
28149 id: 5
28150 }, {
28151 rule: 'optional',
28152 type: 'int64',
28153 name: 'readAt',
28154 id: 6
28155 }, {
28156 rule: 'optional',
28157 type: 'int64',
28158 name: 'patchTimestamp',
28159 id: 7
28160 }, {
28161 rule: 'optional',
28162 type: 'bool',
28163 name: 'mentionAll',
28164 id: 8
28165 }, {
28166 rule: 'repeated',
28167 type: 'string',
28168 name: 'mentionPids',
28169 id: 9
28170 }, {
28171 rule: 'optional',
28172 type: 'bool',
28173 name: 'bin',
28174 id: 10
28175 }, {
28176 rule: 'optional',
28177 type: 'int32',
28178 name: 'convType',
28179 id: 11
28180 }]
28181 }, {
28182 name: 'ConvMemberInfo',
28183 syntax: 'proto2',
28184 fields: [{
28185 rule: 'optional',
28186 type: 'string',
28187 name: 'pid',
28188 id: 1
28189 }, {
28190 rule: 'optional',
28191 type: 'string',
28192 name: 'role',
28193 id: 2
28194 }, {
28195 rule: 'optional',
28196 type: 'string',
28197 name: 'infoId',
28198 id: 3
28199 }]
28200 }, {
28201 name: 'DataCommand',
28202 syntax: 'proto2',
28203 fields: [{
28204 rule: 'repeated',
28205 type: 'string',
28206 name: 'ids',
28207 id: 1
28208 }, {
28209 rule: 'repeated',
28210 type: 'JsonObjectMessage',
28211 name: 'msg',
28212 id: 2
28213 }, {
28214 rule: 'optional',
28215 type: 'bool',
28216 name: 'offline',
28217 id: 3
28218 }]
28219 }, {
28220 name: 'SessionCommand',
28221 syntax: 'proto2',
28222 fields: [{
28223 rule: 'optional',
28224 type: 'int64',
28225 name: 't',
28226 id: 1
28227 }, {
28228 rule: 'optional',
28229 type: 'string',
28230 name: 'n',
28231 id: 2
28232 }, {
28233 rule: 'optional',
28234 type: 'string',
28235 name: 's',
28236 id: 3
28237 }, {
28238 rule: 'optional',
28239 type: 'string',
28240 name: 'ua',
28241 id: 4
28242 }, {
28243 rule: 'optional',
28244 type: 'bool',
28245 name: 'r',
28246 id: 5
28247 }, {
28248 rule: 'optional',
28249 type: 'string',
28250 name: 'tag',
28251 id: 6
28252 }, {
28253 rule: 'optional',
28254 type: 'string',
28255 name: 'deviceId',
28256 id: 7
28257 }, {
28258 rule: 'repeated',
28259 type: 'string',
28260 name: 'sessionPeerIds',
28261 id: 8
28262 }, {
28263 rule: 'repeated',
28264 type: 'string',
28265 name: 'onlineSessionPeerIds',
28266 id: 9
28267 }, {
28268 rule: 'optional',
28269 type: 'string',
28270 name: 'st',
28271 id: 10
28272 }, {
28273 rule: 'optional',
28274 type: 'int32',
28275 name: 'stTtl',
28276 id: 11
28277 }, {
28278 rule: 'optional',
28279 type: 'int32',
28280 name: 'code',
28281 id: 12
28282 }, {
28283 rule: 'optional',
28284 type: 'string',
28285 name: 'reason',
28286 id: 13
28287 }, {
28288 rule: 'optional',
28289 type: 'string',
28290 name: 'deviceToken',
28291 id: 14
28292 }, {
28293 rule: 'optional',
28294 type: 'bool',
28295 name: 'sp',
28296 id: 15
28297 }, {
28298 rule: 'optional',
28299 type: 'string',
28300 name: 'detail',
28301 id: 16
28302 }, {
28303 rule: 'optional',
28304 type: 'int64',
28305 name: 'lastUnreadNotifTime',
28306 id: 17
28307 }, {
28308 rule: 'optional',
28309 type: 'int64',
28310 name: 'lastPatchTime',
28311 id: 18
28312 }, {
28313 rule: 'optional',
28314 type: 'int64',
28315 name: 'configBitmap',
28316 id: 19
28317 }]
28318 }, {
28319 name: 'ErrorCommand',
28320 syntax: 'proto2',
28321 fields: [{
28322 rule: 'required',
28323 type: 'int32',
28324 name: 'code',
28325 id: 1
28326 }, {
28327 rule: 'required',
28328 type: 'string',
28329 name: 'reason',
28330 id: 2
28331 }, {
28332 rule: 'optional',
28333 type: 'int32',
28334 name: 'appCode',
28335 id: 3
28336 }, {
28337 rule: 'optional',
28338 type: 'string',
28339 name: 'detail',
28340 id: 4
28341 }, {
28342 rule: 'repeated',
28343 type: 'string',
28344 name: 'pids',
28345 id: 5
28346 }, {
28347 rule: 'optional',
28348 type: 'string',
28349 name: 'appMsg',
28350 id: 6
28351 }]
28352 }, {
28353 name: 'DirectCommand',
28354 syntax: 'proto2',
28355 fields: [{
28356 rule: 'optional',
28357 type: 'string',
28358 name: 'msg',
28359 id: 1
28360 }, {
28361 rule: 'optional',
28362 type: 'string',
28363 name: 'uid',
28364 id: 2
28365 }, {
28366 rule: 'optional',
28367 type: 'string',
28368 name: 'fromPeerId',
28369 id: 3
28370 }, {
28371 rule: 'optional',
28372 type: 'int64',
28373 name: 'timestamp',
28374 id: 4
28375 }, {
28376 rule: 'optional',
28377 type: 'bool',
28378 name: 'offline',
28379 id: 5
28380 }, {
28381 rule: 'optional',
28382 type: 'bool',
28383 name: 'hasMore',
28384 id: 6
28385 }, {
28386 rule: 'repeated',
28387 type: 'string',
28388 name: 'toPeerIds',
28389 id: 7
28390 }, {
28391 rule: 'optional',
28392 type: 'bool',
28393 name: 'r',
28394 id: 10
28395 }, {
28396 rule: 'optional',
28397 type: 'string',
28398 name: 'cid',
28399 id: 11
28400 }, {
28401 rule: 'optional',
28402 type: 'string',
28403 name: 'id',
28404 id: 12
28405 }, {
28406 rule: 'optional',
28407 type: 'bool',
28408 name: 'transient',
28409 id: 13
28410 }, {
28411 rule: 'optional',
28412 type: 'string',
28413 name: 'dt',
28414 id: 14
28415 }, {
28416 rule: 'optional',
28417 type: 'string',
28418 name: 'roomId',
28419 id: 15
28420 }, {
28421 rule: 'optional',
28422 type: 'string',
28423 name: 'pushData',
28424 id: 16
28425 }, {
28426 rule: 'optional',
28427 type: 'bool',
28428 name: 'will',
28429 id: 17
28430 }, {
28431 rule: 'optional',
28432 type: 'int64',
28433 name: 'patchTimestamp',
28434 id: 18
28435 }, {
28436 rule: 'optional',
28437 type: 'bytes',
28438 name: 'binaryMsg',
28439 id: 19
28440 }, {
28441 rule: 'repeated',
28442 type: 'string',
28443 name: 'mentionPids',
28444 id: 20
28445 }, {
28446 rule: 'optional',
28447 type: 'bool',
28448 name: 'mentionAll',
28449 id: 21
28450 }, {
28451 rule: 'optional',
28452 type: 'int32',
28453 name: 'convType',
28454 id: 22
28455 }]
28456 }, {
28457 name: 'AckCommand',
28458 syntax: 'proto2',
28459 fields: [{
28460 rule: 'optional',
28461 type: 'int32',
28462 name: 'code',
28463 id: 1
28464 }, {
28465 rule: 'optional',
28466 type: 'string',
28467 name: 'reason',
28468 id: 2
28469 }, {
28470 rule: 'optional',
28471 type: 'string',
28472 name: 'mid',
28473 id: 3
28474 }, {
28475 rule: 'optional',
28476 type: 'string',
28477 name: 'cid',
28478 id: 4
28479 }, {
28480 rule: 'optional',
28481 type: 'int64',
28482 name: 't',
28483 id: 5
28484 }, {
28485 rule: 'optional',
28486 type: 'string',
28487 name: 'uid',
28488 id: 6
28489 }, {
28490 rule: 'optional',
28491 type: 'int64',
28492 name: 'fromts',
28493 id: 7
28494 }, {
28495 rule: 'optional',
28496 type: 'int64',
28497 name: 'tots',
28498 id: 8
28499 }, {
28500 rule: 'optional',
28501 type: 'string',
28502 name: 'type',
28503 id: 9
28504 }, {
28505 rule: 'repeated',
28506 type: 'string',
28507 name: 'ids',
28508 id: 10
28509 }, {
28510 rule: 'optional',
28511 type: 'int32',
28512 name: 'appCode',
28513 id: 11
28514 }, {
28515 rule: 'optional',
28516 type: 'string',
28517 name: 'appMsg',
28518 id: 12
28519 }]
28520 }, {
28521 name: 'UnreadCommand',
28522 syntax: 'proto2',
28523 fields: [{
28524 rule: 'repeated',
28525 type: 'UnreadTuple',
28526 name: 'convs',
28527 id: 1
28528 }, {
28529 rule: 'optional',
28530 type: 'int64',
28531 name: 'notifTime',
28532 id: 2
28533 }]
28534 }, {
28535 name: 'ConvCommand',
28536 syntax: 'proto2',
28537 fields: [{
28538 rule: 'repeated',
28539 type: 'string',
28540 name: 'm',
28541 id: 1
28542 }, {
28543 rule: 'optional',
28544 type: 'bool',
28545 name: 'transient',
28546 id: 2
28547 }, {
28548 rule: 'optional',
28549 type: 'bool',
28550 name: 'unique',
28551 id: 3
28552 }, {
28553 rule: 'optional',
28554 type: 'string',
28555 name: 'cid',
28556 id: 4
28557 }, {
28558 rule: 'optional',
28559 type: 'string',
28560 name: 'cdate',
28561 id: 5
28562 }, {
28563 rule: 'optional',
28564 type: 'string',
28565 name: 'initBy',
28566 id: 6
28567 }, {
28568 rule: 'optional',
28569 type: 'string',
28570 name: 'sort',
28571 id: 7
28572 }, {
28573 rule: 'optional',
28574 type: 'int32',
28575 name: 'limit',
28576 id: 8
28577 }, {
28578 rule: 'optional',
28579 type: 'int32',
28580 name: 'skip',
28581 id: 9
28582 }, {
28583 rule: 'optional',
28584 type: 'int32',
28585 name: 'flag',
28586 id: 10
28587 }, {
28588 rule: 'optional',
28589 type: 'int32',
28590 name: 'count',
28591 id: 11
28592 }, {
28593 rule: 'optional',
28594 type: 'string',
28595 name: 'udate',
28596 id: 12
28597 }, {
28598 rule: 'optional',
28599 type: 'int64',
28600 name: 't',
28601 id: 13
28602 }, {
28603 rule: 'optional',
28604 type: 'string',
28605 name: 'n',
28606 id: 14
28607 }, {
28608 rule: 'optional',
28609 type: 'string',
28610 name: 's',
28611 id: 15
28612 }, {
28613 rule: 'optional',
28614 type: 'bool',
28615 name: 'statusSub',
28616 id: 16
28617 }, {
28618 rule: 'optional',
28619 type: 'bool',
28620 name: 'statusPub',
28621 id: 17
28622 }, {
28623 rule: 'optional',
28624 type: 'int32',
28625 name: 'statusTTL',
28626 id: 18
28627 }, {
28628 rule: 'optional',
28629 type: 'string',
28630 name: 'uniqueId',
28631 id: 19
28632 }, {
28633 rule: 'optional',
28634 type: 'string',
28635 name: 'targetClientId',
28636 id: 20
28637 }, {
28638 rule: 'optional',
28639 type: 'int64',
28640 name: 'maxReadTimestamp',
28641 id: 21
28642 }, {
28643 rule: 'optional',
28644 type: 'int64',
28645 name: 'maxAckTimestamp',
28646 id: 22
28647 }, {
28648 rule: 'optional',
28649 type: 'bool',
28650 name: 'queryAllMembers',
28651 id: 23
28652 }, {
28653 rule: 'repeated',
28654 type: 'MaxReadTuple',
28655 name: 'maxReadTuples',
28656 id: 24
28657 }, {
28658 rule: 'repeated',
28659 type: 'string',
28660 name: 'cids',
28661 id: 25
28662 }, {
28663 rule: 'optional',
28664 type: 'ConvMemberInfo',
28665 name: 'info',
28666 id: 26
28667 }, {
28668 rule: 'optional',
28669 type: 'bool',
28670 name: 'tempConv',
28671 id: 27
28672 }, {
28673 rule: 'optional',
28674 type: 'int32',
28675 name: 'tempConvTTL',
28676 id: 28
28677 }, {
28678 rule: 'repeated',
28679 type: 'string',
28680 name: 'tempConvIds',
28681 id: 29
28682 }, {
28683 rule: 'repeated',
28684 type: 'string',
28685 name: 'allowedPids',
28686 id: 30
28687 }, {
28688 rule: 'repeated',
28689 type: 'ErrorCommand',
28690 name: 'failedPids',
28691 id: 31
28692 }, {
28693 rule: 'optional',
28694 type: 'string',
28695 name: 'next',
28696 id: 40
28697 }, {
28698 rule: 'optional',
28699 type: 'JsonObjectMessage',
28700 name: 'results',
28701 id: 100
28702 }, {
28703 rule: 'optional',
28704 type: 'JsonObjectMessage',
28705 name: 'where',
28706 id: 101
28707 }, {
28708 rule: 'optional',
28709 type: 'JsonObjectMessage',
28710 name: 'attr',
28711 id: 103
28712 }, {
28713 rule: 'optional',
28714 type: 'JsonObjectMessage',
28715 name: 'attrModified',
28716 id: 104
28717 }]
28718 }, {
28719 name: 'RoomCommand',
28720 syntax: 'proto2',
28721 fields: [{
28722 rule: 'optional',
28723 type: 'string',
28724 name: 'roomId',
28725 id: 1
28726 }, {
28727 rule: 'optional',
28728 type: 'string',
28729 name: 's',
28730 id: 2
28731 }, {
28732 rule: 'optional',
28733 type: 'int64',
28734 name: 't',
28735 id: 3
28736 }, {
28737 rule: 'optional',
28738 type: 'string',
28739 name: 'n',
28740 id: 4
28741 }, {
28742 rule: 'optional',
28743 type: 'bool',
28744 name: 'transient',
28745 id: 5
28746 }, {
28747 rule: 'repeated',
28748 type: 'string',
28749 name: 'roomPeerIds',
28750 id: 6
28751 }, {
28752 rule: 'optional',
28753 type: 'string',
28754 name: 'byPeerId',
28755 id: 7
28756 }]
28757 }, {
28758 name: 'LogsCommand',
28759 syntax: 'proto2',
28760 fields: [{
28761 rule: 'optional',
28762 type: 'string',
28763 name: 'cid',
28764 id: 1
28765 }, {
28766 rule: 'optional',
28767 type: 'int32',
28768 name: 'l',
28769 id: 2
28770 }, {
28771 rule: 'optional',
28772 type: 'int32',
28773 name: 'limit',
28774 id: 3
28775 }, {
28776 rule: 'optional',
28777 type: 'int64',
28778 name: 't',
28779 id: 4
28780 }, {
28781 rule: 'optional',
28782 type: 'int64',
28783 name: 'tt',
28784 id: 5
28785 }, {
28786 rule: 'optional',
28787 type: 'string',
28788 name: 'tmid',
28789 id: 6
28790 }, {
28791 rule: 'optional',
28792 type: 'string',
28793 name: 'mid',
28794 id: 7
28795 }, {
28796 rule: 'optional',
28797 type: 'string',
28798 name: 'checksum',
28799 id: 8
28800 }, {
28801 rule: 'optional',
28802 type: 'bool',
28803 name: 'stored',
28804 id: 9
28805 }, {
28806 rule: 'optional',
28807 type: 'QueryDirection',
28808 name: 'direction',
28809 id: 10,
28810 options: {
28811 "default": 'OLD'
28812 }
28813 }, {
28814 rule: 'optional',
28815 type: 'bool',
28816 name: 'tIncluded',
28817 id: 11
28818 }, {
28819 rule: 'optional',
28820 type: 'bool',
28821 name: 'ttIncluded',
28822 id: 12
28823 }, {
28824 rule: 'optional',
28825 type: 'int32',
28826 name: 'lctype',
28827 id: 13
28828 }, {
28829 rule: 'repeated',
28830 type: 'LogItem',
28831 name: 'logs',
28832 id: 105
28833 }],
28834 enums: [{
28835 name: 'QueryDirection',
28836 syntax: 'proto2',
28837 values: [{
28838 name: 'OLD',
28839 id: 1
28840 }, {
28841 name: 'NEW',
28842 id: 2
28843 }]
28844 }]
28845 }, {
28846 name: 'RcpCommand',
28847 syntax: 'proto2',
28848 fields: [{
28849 rule: 'optional',
28850 type: 'string',
28851 name: 'id',
28852 id: 1
28853 }, {
28854 rule: 'optional',
28855 type: 'string',
28856 name: 'cid',
28857 id: 2
28858 }, {
28859 rule: 'optional',
28860 type: 'int64',
28861 name: 't',
28862 id: 3
28863 }, {
28864 rule: 'optional',
28865 type: 'bool',
28866 name: 'read',
28867 id: 4
28868 }, {
28869 rule: 'optional',
28870 type: 'string',
28871 name: 'from',
28872 id: 5
28873 }]
28874 }, {
28875 name: 'ReadTuple',
28876 syntax: 'proto2',
28877 fields: [{
28878 rule: 'required',
28879 type: 'string',
28880 name: 'cid',
28881 id: 1
28882 }, {
28883 rule: 'optional',
28884 type: 'int64',
28885 name: 'timestamp',
28886 id: 2
28887 }, {
28888 rule: 'optional',
28889 type: 'string',
28890 name: 'mid',
28891 id: 3
28892 }]
28893 }, {
28894 name: 'MaxReadTuple',
28895 syntax: 'proto2',
28896 fields: [{
28897 rule: 'optional',
28898 type: 'string',
28899 name: 'pid',
28900 id: 1
28901 }, {
28902 rule: 'optional',
28903 type: 'int64',
28904 name: 'maxAckTimestamp',
28905 id: 2
28906 }, {
28907 rule: 'optional',
28908 type: 'int64',
28909 name: 'maxReadTimestamp',
28910 id: 3
28911 }]
28912 }, {
28913 name: 'ReadCommand',
28914 syntax: 'proto2',
28915 fields: [{
28916 rule: 'optional',
28917 type: 'string',
28918 name: 'cid',
28919 id: 1
28920 }, {
28921 rule: 'repeated',
28922 type: 'string',
28923 name: 'cids',
28924 id: 2
28925 }, {
28926 rule: 'repeated',
28927 type: 'ReadTuple',
28928 name: 'convs',
28929 id: 3
28930 }]
28931 }, {
28932 name: 'PresenceCommand',
28933 syntax: 'proto2',
28934 fields: [{
28935 rule: 'optional',
28936 type: 'StatusType',
28937 name: 'status',
28938 id: 1
28939 }, {
28940 rule: 'repeated',
28941 type: 'string',
28942 name: 'sessionPeerIds',
28943 id: 2
28944 }, {
28945 rule: 'optional',
28946 type: 'string',
28947 name: 'cid',
28948 id: 3
28949 }]
28950 }, {
28951 name: 'ReportCommand',
28952 syntax: 'proto2',
28953 fields: [{
28954 rule: 'optional',
28955 type: 'bool',
28956 name: 'initiative',
28957 id: 1
28958 }, {
28959 rule: 'optional',
28960 type: 'string',
28961 name: 'type',
28962 id: 2
28963 }, {
28964 rule: 'optional',
28965 type: 'string',
28966 name: 'data',
28967 id: 3
28968 }]
28969 }, {
28970 name: 'PatchItem',
28971 syntax: 'proto2',
28972 fields: [{
28973 rule: 'optional',
28974 type: 'string',
28975 name: 'cid',
28976 id: 1
28977 }, {
28978 rule: 'optional',
28979 type: 'string',
28980 name: 'mid',
28981 id: 2
28982 }, {
28983 rule: 'optional',
28984 type: 'int64',
28985 name: 'timestamp',
28986 id: 3
28987 }, {
28988 rule: 'optional',
28989 type: 'bool',
28990 name: 'recall',
28991 id: 4
28992 }, {
28993 rule: 'optional',
28994 type: 'string',
28995 name: 'data',
28996 id: 5
28997 }, {
28998 rule: 'optional',
28999 type: 'int64',
29000 name: 'patchTimestamp',
29001 id: 6
29002 }, {
29003 rule: 'optional',
29004 type: 'string',
29005 name: 'from',
29006 id: 7
29007 }, {
29008 rule: 'optional',
29009 type: 'bytes',
29010 name: 'binaryMsg',
29011 id: 8
29012 }, {
29013 rule: 'optional',
29014 type: 'bool',
29015 name: 'mentionAll',
29016 id: 9
29017 }, {
29018 rule: 'repeated',
29019 type: 'string',
29020 name: 'mentionPids',
29021 id: 10
29022 }, {
29023 rule: 'optional',
29024 type: 'int64',
29025 name: 'patchCode',
29026 id: 11
29027 }, {
29028 rule: 'optional',
29029 type: 'string',
29030 name: 'patchReason',
29031 id: 12
29032 }]
29033 }, {
29034 name: 'PatchCommand',
29035 syntax: 'proto2',
29036 fields: [{
29037 rule: 'repeated',
29038 type: 'PatchItem',
29039 name: 'patches',
29040 id: 1
29041 }, {
29042 rule: 'optional',
29043 type: 'int64',
29044 name: 'lastPatchTime',
29045 id: 2
29046 }]
29047 }, {
29048 name: 'PubsubCommand',
29049 syntax: 'proto2',
29050 fields: [{
29051 rule: 'optional',
29052 type: 'string',
29053 name: 'cid',
29054 id: 1
29055 }, {
29056 rule: 'repeated',
29057 type: 'string',
29058 name: 'cids',
29059 id: 2
29060 }, {
29061 rule: 'optional',
29062 type: 'string',
29063 name: 'topic',
29064 id: 3
29065 }, {
29066 rule: 'optional',
29067 type: 'string',
29068 name: 'subtopic',
29069 id: 4
29070 }, {
29071 rule: 'repeated',
29072 type: 'string',
29073 name: 'topics',
29074 id: 5
29075 }, {
29076 rule: 'repeated',
29077 type: 'string',
29078 name: 'subtopics',
29079 id: 6
29080 }, {
29081 rule: 'optional',
29082 type: 'JsonObjectMessage',
29083 name: 'results',
29084 id: 7
29085 }]
29086 }, {
29087 name: 'BlacklistCommand',
29088 syntax: 'proto2',
29089 fields: [{
29090 rule: 'optional',
29091 type: 'string',
29092 name: 'srcCid',
29093 id: 1
29094 }, {
29095 rule: 'repeated',
29096 type: 'string',
29097 name: 'toPids',
29098 id: 2
29099 }, {
29100 rule: 'optional',
29101 type: 'string',
29102 name: 'srcPid',
29103 id: 3
29104 }, {
29105 rule: 'repeated',
29106 type: 'string',
29107 name: 'toCids',
29108 id: 4
29109 }, {
29110 rule: 'optional',
29111 type: 'int32',
29112 name: 'limit',
29113 id: 5
29114 }, {
29115 rule: 'optional',
29116 type: 'string',
29117 name: 'next',
29118 id: 6
29119 }, {
29120 rule: 'repeated',
29121 type: 'string',
29122 name: 'blockedPids',
29123 id: 8
29124 }, {
29125 rule: 'repeated',
29126 type: 'string',
29127 name: 'blockedCids',
29128 id: 9
29129 }, {
29130 rule: 'repeated',
29131 type: 'string',
29132 name: 'allowedPids',
29133 id: 10
29134 }, {
29135 rule: 'repeated',
29136 type: 'ErrorCommand',
29137 name: 'failedPids',
29138 id: 11
29139 }, {
29140 rule: 'optional',
29141 type: 'int64',
29142 name: 't',
29143 id: 12
29144 }, {
29145 rule: 'optional',
29146 type: 'string',
29147 name: 'n',
29148 id: 13
29149 }, {
29150 rule: 'optional',
29151 type: 'string',
29152 name: 's',
29153 id: 14
29154 }]
29155 }, {
29156 name: 'GenericCommand',
29157 syntax: 'proto2',
29158 fields: [{
29159 rule: 'optional',
29160 type: 'CommandType',
29161 name: 'cmd',
29162 id: 1
29163 }, {
29164 rule: 'optional',
29165 type: 'OpType',
29166 name: 'op',
29167 id: 2
29168 }, {
29169 rule: 'optional',
29170 type: 'string',
29171 name: 'appId',
29172 id: 3
29173 }, {
29174 rule: 'optional',
29175 type: 'string',
29176 name: 'peerId',
29177 id: 4
29178 }, {
29179 rule: 'optional',
29180 type: 'int32',
29181 name: 'i',
29182 id: 5
29183 }, {
29184 rule: 'optional',
29185 type: 'string',
29186 name: 'installationId',
29187 id: 6
29188 }, {
29189 rule: 'optional',
29190 type: 'int32',
29191 name: 'priority',
29192 id: 7
29193 }, {
29194 rule: 'optional',
29195 type: 'int32',
29196 name: 'service',
29197 id: 8
29198 }, {
29199 rule: 'optional',
29200 type: 'int64',
29201 name: 'serverTs',
29202 id: 9
29203 }, {
29204 rule: 'optional',
29205 type: 'int64',
29206 name: 'clientTs',
29207 id: 10
29208 }, {
29209 rule: 'optional',
29210 type: 'int32',
29211 name: 'notificationType',
29212 id: 11
29213 }, {
29214 rule: 'optional',
29215 type: 'DataCommand',
29216 name: 'dataMessage',
29217 id: 101
29218 }, {
29219 rule: 'optional',
29220 type: 'SessionCommand',
29221 name: 'sessionMessage',
29222 id: 102
29223 }, {
29224 rule: 'optional',
29225 type: 'ErrorCommand',
29226 name: 'errorMessage',
29227 id: 103
29228 }, {
29229 rule: 'optional',
29230 type: 'DirectCommand',
29231 name: 'directMessage',
29232 id: 104
29233 }, {
29234 rule: 'optional',
29235 type: 'AckCommand',
29236 name: 'ackMessage',
29237 id: 105
29238 }, {
29239 rule: 'optional',
29240 type: 'UnreadCommand',
29241 name: 'unreadMessage',
29242 id: 106
29243 }, {
29244 rule: 'optional',
29245 type: 'ReadCommand',
29246 name: 'readMessage',
29247 id: 107
29248 }, {
29249 rule: 'optional',
29250 type: 'RcpCommand',
29251 name: 'rcpMessage',
29252 id: 108
29253 }, {
29254 rule: 'optional',
29255 type: 'LogsCommand',
29256 name: 'logsMessage',
29257 id: 109
29258 }, {
29259 rule: 'optional',
29260 type: 'ConvCommand',
29261 name: 'convMessage',
29262 id: 110
29263 }, {
29264 rule: 'optional',
29265 type: 'RoomCommand',
29266 name: 'roomMessage',
29267 id: 111
29268 }, {
29269 rule: 'optional',
29270 type: 'PresenceCommand',
29271 name: 'presenceMessage',
29272 id: 112
29273 }, {
29274 rule: 'optional',
29275 type: 'ReportCommand',
29276 name: 'reportMessage',
29277 id: 113
29278 }, {
29279 rule: 'optional',
29280 type: 'PatchCommand',
29281 name: 'patchMessage',
29282 id: 114
29283 }, {
29284 rule: 'optional',
29285 type: 'PubsubCommand',
29286 name: 'pubsubMessage',
29287 id: 115
29288 }, {
29289 rule: 'optional',
29290 type: 'BlacklistCommand',
29291 name: 'blacklistMessage',
29292 id: 116
29293 }]
29294 }],
29295 enums: [{
29296 name: 'CommandType',
29297 syntax: 'proto2',
29298 values: [{
29299 name: 'session',
29300 id: 0
29301 }, {
29302 name: 'conv',
29303 id: 1
29304 }, {
29305 name: 'direct',
29306 id: 2
29307 }, {
29308 name: 'ack',
29309 id: 3
29310 }, {
29311 name: 'rcp',
29312 id: 4
29313 }, {
29314 name: 'unread',
29315 id: 5
29316 }, {
29317 name: 'logs',
29318 id: 6
29319 }, {
29320 name: 'error',
29321 id: 7
29322 }, {
29323 name: 'login',
29324 id: 8
29325 }, {
29326 name: 'data',
29327 id: 9
29328 }, {
29329 name: 'room',
29330 id: 10
29331 }, {
29332 name: 'read',
29333 id: 11
29334 }, {
29335 name: 'presence',
29336 id: 12
29337 }, {
29338 name: 'report',
29339 id: 13
29340 }, {
29341 name: 'echo',
29342 id: 14
29343 }, {
29344 name: 'loggedin',
29345 id: 15
29346 }, {
29347 name: 'logout',
29348 id: 16
29349 }, {
29350 name: 'loggedout',
29351 id: 17
29352 }, {
29353 name: 'patch',
29354 id: 18
29355 }, {
29356 name: 'pubsub',
29357 id: 19
29358 }, {
29359 name: 'blacklist',
29360 id: 20
29361 }, {
29362 name: 'goaway',
29363 id: 21
29364 }]
29365 }, {
29366 name: 'OpType',
29367 syntax: 'proto2',
29368 values: [{
29369 name: 'open',
29370 id: 1
29371 }, {
29372 name: 'add',
29373 id: 2
29374 }, {
29375 name: 'remove',
29376 id: 3
29377 }, {
29378 name: 'close',
29379 id: 4
29380 }, {
29381 name: 'opened',
29382 id: 5
29383 }, {
29384 name: 'closed',
29385 id: 6
29386 }, {
29387 name: 'query',
29388 id: 7
29389 }, {
29390 name: 'query_result',
29391 id: 8
29392 }, {
29393 name: 'conflict',
29394 id: 9
29395 }, {
29396 name: 'added',
29397 id: 10
29398 }, {
29399 name: 'removed',
29400 id: 11
29401 }, {
29402 name: 'refresh',
29403 id: 12
29404 }, {
29405 name: 'refreshed',
29406 id: 13
29407 }, {
29408 name: 'start',
29409 id: 30
29410 }, {
29411 name: 'started',
29412 id: 31
29413 }, {
29414 name: 'joined',
29415 id: 32
29416 }, {
29417 name: 'members_joined',
29418 id: 33
29419 }, {
29420 name: 'left',
29421 id: 39
29422 }, {
29423 name: 'members_left',
29424 id: 40
29425 }, {
29426 name: 'results',
29427 id: 42
29428 }, {
29429 name: 'count',
29430 id: 43
29431 }, {
29432 name: 'result',
29433 id: 44
29434 }, {
29435 name: 'update',
29436 id: 45
29437 }, {
29438 name: 'updated',
29439 id: 46
29440 }, {
29441 name: 'mute',
29442 id: 47
29443 }, {
29444 name: 'unmute',
29445 id: 48
29446 }, {
29447 name: 'status',
29448 id: 49
29449 }, {
29450 name: 'members',
29451 id: 50
29452 }, {
29453 name: 'max_read',
29454 id: 51
29455 }, {
29456 name: 'is_member',
29457 id: 52
29458 }, {
29459 name: 'member_info_update',
29460 id: 53
29461 }, {
29462 name: 'member_info_updated',
29463 id: 54
29464 }, {
29465 name: 'member_info_changed',
29466 id: 55
29467 }, {
29468 name: 'join',
29469 id: 80
29470 }, {
29471 name: 'invite',
29472 id: 81
29473 }, {
29474 name: 'leave',
29475 id: 82
29476 }, {
29477 name: 'kick',
29478 id: 83
29479 }, {
29480 name: 'reject',
29481 id: 84
29482 }, {
29483 name: 'invited',
29484 id: 85
29485 }, {
29486 name: 'kicked',
29487 id: 86
29488 }, {
29489 name: 'upload',
29490 id: 100
29491 }, {
29492 name: 'uploaded',
29493 id: 101
29494 }, {
29495 name: 'subscribe',
29496 id: 120
29497 }, {
29498 name: 'subscribed',
29499 id: 121
29500 }, {
29501 name: 'unsubscribe',
29502 id: 122
29503 }, {
29504 name: 'unsubscribed',
29505 id: 123
29506 }, {
29507 name: 'is_subscribed',
29508 id: 124
29509 }, {
29510 name: 'modify',
29511 id: 150
29512 }, {
29513 name: 'modified',
29514 id: 151
29515 }, {
29516 name: 'block',
29517 id: 170
29518 }, {
29519 name: 'unblock',
29520 id: 171
29521 }, {
29522 name: 'blocked',
29523 id: 172
29524 }, {
29525 name: 'unblocked',
29526 id: 173
29527 }, {
29528 name: 'members_blocked',
29529 id: 174
29530 }, {
29531 name: 'members_unblocked',
29532 id: 175
29533 }, {
29534 name: 'check_block',
29535 id: 176
29536 }, {
29537 name: 'check_result',
29538 id: 177
29539 }, {
29540 name: 'add_shutup',
29541 id: 180
29542 }, {
29543 name: 'remove_shutup',
29544 id: 181
29545 }, {
29546 name: 'query_shutup',
29547 id: 182
29548 }, {
29549 name: 'shutup_added',
29550 id: 183
29551 }, {
29552 name: 'shutup_removed',
29553 id: 184
29554 }, {
29555 name: 'shutup_result',
29556 id: 185
29557 }, {
29558 name: 'shutuped',
29559 id: 186
29560 }, {
29561 name: 'unshutuped',
29562 id: 187
29563 }, {
29564 name: 'members_shutuped',
29565 id: 188
29566 }, {
29567 name: 'members_unshutuped',
29568 id: 189
29569 }, {
29570 name: 'check_shutup',
29571 id: 190
29572 }]
29573 }, {
29574 name: 'StatusType',
29575 syntax: 'proto2',
29576 values: [{
29577 name: 'on',
29578 id: 1
29579 }, {
29580 name: 'off',
29581 id: 2
29582 }]
29583 }],
29584 isNamespace: true
29585}).build();
29586var _messages$push_server = messageCompiled.push_server.messages2,
29587 JsonObjectMessage = _messages$push_server.JsonObjectMessage,
29588 UnreadTuple = _messages$push_server.UnreadTuple,
29589 LogItem = _messages$push_server.LogItem,
29590 DataCommand = _messages$push_server.DataCommand,
29591 SessionCommand = _messages$push_server.SessionCommand,
29592 ErrorCommand = _messages$push_server.ErrorCommand,
29593 DirectCommand = _messages$push_server.DirectCommand,
29594 AckCommand = _messages$push_server.AckCommand,
29595 UnreadCommand = _messages$push_server.UnreadCommand,
29596 ConvCommand = _messages$push_server.ConvCommand,
29597 RoomCommand = _messages$push_server.RoomCommand,
29598 LogsCommand = _messages$push_server.LogsCommand,
29599 RcpCommand = _messages$push_server.RcpCommand,
29600 ReadTuple = _messages$push_server.ReadTuple,
29601 MaxReadTuple = _messages$push_server.MaxReadTuple,
29602 ReadCommand = _messages$push_server.ReadCommand,
29603 PresenceCommand = _messages$push_server.PresenceCommand,
29604 ReportCommand = _messages$push_server.ReportCommand,
29605 GenericCommand = _messages$push_server.GenericCommand,
29606 BlacklistCommand = _messages$push_server.BlacklistCommand,
29607 PatchCommand = _messages$push_server.PatchCommand,
29608 PatchItem = _messages$push_server.PatchItem,
29609 ConvMemberInfo = _messages$push_server.ConvMemberInfo,
29610 CommandType = _messages$push_server.CommandType,
29611 OpType = _messages$push_server.OpType,
29612 StatusType = _messages$push_server.StatusType;
29613var message = /*#__PURE__*/(0, _freeze.default)({
29614 __proto__: null,
29615 JsonObjectMessage: JsonObjectMessage,
29616 UnreadTuple: UnreadTuple,
29617 LogItem: LogItem,
29618 DataCommand: DataCommand,
29619 SessionCommand: SessionCommand,
29620 ErrorCommand: ErrorCommand,
29621 DirectCommand: DirectCommand,
29622 AckCommand: AckCommand,
29623 UnreadCommand: UnreadCommand,
29624 ConvCommand: ConvCommand,
29625 RoomCommand: RoomCommand,
29626 LogsCommand: LogsCommand,
29627 RcpCommand: RcpCommand,
29628 ReadTuple: ReadTuple,
29629 MaxReadTuple: MaxReadTuple,
29630 ReadCommand: ReadCommand,
29631 PresenceCommand: PresenceCommand,
29632 ReportCommand: ReportCommand,
29633 GenericCommand: GenericCommand,
29634 BlacklistCommand: BlacklistCommand,
29635 PatchCommand: PatchCommand,
29636 PatchItem: PatchItem,
29637 ConvMemberInfo: ConvMemberInfo,
29638 CommandType: CommandType,
29639 OpType: OpType,
29640 StatusType: StatusType
29641});
29642var adapters = {};
29643
29644var getAdapter = function getAdapter(name) {
29645 var adapter = adapters[name];
29646
29647 if (adapter === undefined) {
29648 throw new Error("".concat(name, " adapter is not configured"));
29649 }
29650
29651 return adapter;
29652};
29653/**
29654 * 指定 Adapters
29655 * @function
29656 * @memberof module:leancloud-realtime
29657 * @param {Adapters} newAdapters Adapters 的类型请参考 {@link https://url.leanapp.cn/adapter-type-definitions @leancloud/adapter-types} 中的定义
29658 */
29659
29660
29661var setAdapters = function setAdapters(newAdapters) {
29662 (0, _assign.default)(adapters, newAdapters);
29663};
29664/* eslint-disable */
29665
29666
29667var global$1 = typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : {};
29668var EXPIRED = (0, _symbol.default)('expired');
29669var debug = d('LC:Expirable');
29670
29671var Expirable = /*#__PURE__*/function () {
29672 function Expirable(value, ttl) {
29673 this.originalValue = value;
29674
29675 if (typeof ttl === 'number') {
29676 this.expiredAt = Date.now() + ttl;
29677 }
29678 }
29679
29680 _createClass(Expirable, [{
29681 key: "value",
29682 get: function get() {
29683 var expired = this.expiredAt && this.expiredAt <= Date.now();
29684 if (expired) debug("expired: ".concat(this.originalValue));
29685 return expired ? EXPIRED : this.originalValue;
29686 }
29687 }]);
29688
29689 return Expirable;
29690}();
29691
29692Expirable.EXPIRED = EXPIRED;
29693var debug$1 = d('LC:Cache');
29694
29695var Cache = /*#__PURE__*/function () {
29696 function Cache() {
29697 var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'anonymous';
29698 this.name = name;
29699 this._map = {};
29700 }
29701
29702 var _proto = Cache.prototype;
29703
29704 _proto.get = function get(key) {
29705 var _context5;
29706
29707 var cache = this._map[key];
29708
29709 if (cache) {
29710 var value = cache.value;
29711
29712 if (value !== Expirable.EXPIRED) {
29713 debug$1('[%s] hit: %s', this.name, key);
29714 return value;
29715 }
29716
29717 delete this._map[key];
29718 }
29719
29720 debug$1((0, _concat.default)(_context5 = "[".concat(this.name, "] missed: ")).call(_context5, key));
29721 return null;
29722 };
29723
29724 _proto.set = function set(key, value, ttl) {
29725 debug$1('[%s] set: %s %d', this.name, key, ttl);
29726 this._map[key] = new Expirable(value, ttl);
29727 };
29728
29729 return Cache;
29730}();
29731
29732function ownKeys(object, enumerableOnly) {
29733 var keys = (0, _keys.default)(object);
29734
29735 if (_getOwnPropertySymbols.default) {
29736 var symbols = (0, _getOwnPropertySymbols.default)(object);
29737 if (enumerableOnly) symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
29738 return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
29739 });
29740 keys.push.apply(keys, symbols);
29741 }
29742
29743 return keys;
29744}
29745
29746function _objectSpread(target) {
29747 for (var i = 1; i < arguments.length; i++) {
29748 var source = arguments[i] != null ? arguments[i] : {};
29749
29750 if (i % 2) {
29751 ownKeys(Object(source), true).forEach(function (key) {
29752 _defineProperty(target, key, source[key]);
29753 });
29754 } else if (_getOwnPropertyDescriptors.default) {
29755 (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source));
29756 } else {
29757 ownKeys(Object(source)).forEach(function (key) {
29758 (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
29759 });
29760 }
29761 }
29762
29763 return target;
29764}
29765/**
29766 * 调试日志控制器
29767 * @const
29768 * @memberof module:leancloud-realtime
29769 * @example
29770 * debug.enable(); // 启用调试日志
29771 * debug.disable(); // 关闭调试日志
29772 */
29773
29774
29775var debug$2 = {
29776 enable: function enable() {
29777 var namespaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'LC*';
29778 return d.enable(namespaces);
29779 },
29780 disable: d.disable
29781};
29782
29783var tryAll = function tryAll(promiseConstructors) {
29784 var promise = new _promise.default(promiseConstructors[0]);
29785
29786 if (promiseConstructors.length === 1) {
29787 return promise;
29788 }
29789
29790 return promise["catch"](function () {
29791 return tryAll((0, _slice.default)(promiseConstructors).call(promiseConstructors, 1));
29792 });
29793}; // eslint-disable-next-line no-sequences
29794
29795
29796var tap = function tap(interceptor) {
29797 return function (value) {
29798 return interceptor(value), value;
29799 };
29800};
29801
29802var isIE10 = global$1.navigator && global$1.navigator.userAgent && (0, _indexOf.default)(_context6 = global$1.navigator.userAgent).call(_context6, 'MSIE 10.') !== -1;
29803var map = new _weakMap.default(); // protected property helper
29804
29805var internal = function internal(object) {
29806 if (!map.has(object)) {
29807 map.set(object, {});
29808 }
29809
29810 return map.get(object);
29811};
29812
29813var compact = function compact(obj, filter) {
29814 if (!isPlainObject(obj)) return obj;
29815
29816 var object = _objectSpread({}, obj);
29817
29818 (0, _keys.default)(object).forEach(function (prop) {
29819 var value = object[prop];
29820
29821 if (value === filter) {
29822 delete object[prop];
29823 } else {
29824 object[prop] = compact(value, filter);
29825 }
29826 });
29827 return object;
29828}; // debug utility
29829
29830
29831var removeNull = function removeNull(obj) {
29832 return compact(obj, null);
29833};
29834
29835var trim = function trim(message) {
29836 return removeNull(JSON.parse((0, _stringify.default)(message)));
29837};
29838
29839var ensureArray = function ensureArray(target) {
29840 if (Array.isArray(target)) {
29841 return target;
29842 }
29843
29844 if (target === undefined || target === null) {
29845 return [];
29846 }
29847
29848 return [target];
29849};
29850
29851var isWeapp = // eslint-disable-next-line no-undef
29852(typeof wx === "undefined" ? "undefined" : _typeof(wx)) === 'object' && typeof wx.connectSocket === 'function'; // throttle decorator
29853
29854var isCNApp = function isCNApp(appId) {
29855 return (0, _slice.default)(appId).call(appId, -9) !== '-MdYXbMMI';
29856};
29857
29858var equalBuffer = function equalBuffer(buffer1, buffer2) {
29859 if (!buffer1 || !buffer2) return false;
29860 if (buffer1.byteLength !== buffer2.byteLength) return false;
29861 var a = new Uint8Array(buffer1);
29862 var b = new Uint8Array(buffer2);
29863 return !a.some(function (value, index) {
29864 return value !== b[index];
29865 });
29866};
29867
29868var _class;
29869
29870function ownKeys$1(object, enumerableOnly) {
29871 var keys = (0, _keys.default)(object);
29872
29873 if (_getOwnPropertySymbols.default) {
29874 var symbols = (0, _getOwnPropertySymbols.default)(object);
29875 if (enumerableOnly) symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
29876 return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
29877 });
29878 keys.push.apply(keys, symbols);
29879 }
29880
29881 return keys;
29882}
29883
29884function _objectSpread$1(target) {
29885 for (var i = 1; i < arguments.length; i++) {
29886 var source = arguments[i] != null ? arguments[i] : {};
29887
29888 if (i % 2) {
29889 ownKeys$1(Object(source), true).forEach(function (key) {
29890 _defineProperty(target, key, source[key]);
29891 });
29892 } else if (_getOwnPropertyDescriptors.default) {
29893 (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source));
29894 } else {
29895 ownKeys$1(Object(source)).forEach(function (key) {
29896 (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
29897 });
29898 }
29899 }
29900
29901 return target;
29902}
29903
29904var debug$3 = d('LC:WebSocketPlus');
29905var OPEN = 'open';
29906var DISCONNECT = 'disconnect';
29907var RECONNECT = 'reconnect';
29908var RETRY = 'retry';
29909var SCHEDULE = 'schedule';
29910var OFFLINE = 'offline';
29911var ONLINE = 'online';
29912var ERROR = 'error';
29913var MESSAGE = 'message';
29914var HEARTBEAT_TIME = 180000;
29915var TIMEOUT_TIME = 380000;
29916
29917var DEFAULT_RETRY_STRATEGY = function DEFAULT_RETRY_STRATEGY(attempt) {
29918 return Math.min(1000 * Math.pow(2, attempt), 300000);
29919};
29920
29921var requireConnected = function requireConnected(target, name, descriptor) {
29922 return _objectSpread$1(_objectSpread$1({}, descriptor), {}, {
29923 value: function requireConnectedWrapper() {
29924 var _context7;
29925
29926 var _descriptor$value;
29927
29928 this.checkConnectionAvailability(name);
29929
29930 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
29931 args[_key] = arguments[_key];
29932 }
29933
29934 return (_descriptor$value = descriptor.value).call.apply(_descriptor$value, (0, _concat.default)(_context7 = [this]).call(_context7, args));
29935 }
29936 });
29937};
29938
29939var WebSocketPlus = (_class = /*#__PURE__*/function (_EventEmitter) {
29940 _inheritsLoose(WebSocketPlus, _EventEmitter);
29941
29942 _createClass(WebSocketPlus, [{
29943 key: "urls",
29944 get: function get() {
29945 return this._urls;
29946 },
29947 set: function set(urls) {
29948 this._urls = ensureArray(urls);
29949 }
29950 }]);
29951
29952 function WebSocketPlus(getUrls, protocol) {
29953 var _this;
29954
29955 _this = _EventEmitter.call(this) || this;
29956
29957 _this.init();
29958
29959 _this._protocol = protocol;
29960
29961 _promise.default.resolve(typeof getUrls === 'function' ? getUrls() : getUrls).then(ensureArray).then(function (urls) {
29962 _this._urls = urls;
29963 return _this._open();
29964 }).then(function () {
29965 _this.__postponeTimeoutTimer = _this._postponeTimeoutTimer.bind(_assertThisInitialized(_this));
29966
29967 if (global$1.addEventListener) {
29968 _this.__pause = function () {
29969 if (_this.can('pause')) _this.pause();
29970 };
29971
29972 _this.__resume = function () {
29973 if (_this.can('resume')) _this.resume();
29974 };
29975
29976 global$1.addEventListener('offline', _this.__pause);
29977 global$1.addEventListener('online', _this.__resume);
29978 }
29979
29980 _this.open();
29981 })["catch"](_this["throw"].bind(_assertThisInitialized(_this)));
29982
29983 return _this;
29984 }
29985
29986 var _proto = WebSocketPlus.prototype;
29987
29988 _proto._open = function _open() {
29989 var _this2 = this;
29990
29991 return this._createWs(this._urls, this._protocol).then(function (ws) {
29992 var _context8;
29993
29994 var _this2$_urls = _toArray(_this2._urls),
29995 first = _this2$_urls[0],
29996 reset = (0, _slice.default)(_this2$_urls).call(_this2$_urls, 1);
29997
29998 _this2._urls = (0, _concat.default)(_context8 = []).call(_context8, _toConsumableArray(reset), [first]);
29999 return ws;
30000 });
30001 };
30002
30003 _proto._createWs = function _createWs(urls, protocol) {
30004 var _this3 = this;
30005
30006 return tryAll((0, _map.default)(urls).call(urls, function (url) {
30007 return function (resolve, reject) {
30008 var _context9;
30009
30010 debug$3((0, _concat.default)(_context9 = "connect [".concat(url, "] ")).call(_context9, protocol));
30011 var WebSocket = getAdapter('WebSocket');
30012 var ws = protocol ? new WebSocket(url, protocol) : new WebSocket(url);
30013 ws.binaryType = _this3.binaryType || 'arraybuffer';
30014
30015 ws.onopen = function () {
30016 return resolve(ws);
30017 };
30018
30019 ws.onclose = function (error) {
30020 if (error instanceof Error) {
30021 return reject(error);
30022 } // in browser, error event is useless
30023
30024
30025 return reject(new Error("Failed to connect [".concat(url, "]")));
30026 };
30027
30028 ws.onerror = ws.onclose;
30029 };
30030 })).then(function (ws) {
30031 _this3._ws = ws;
30032 _this3._ws.onclose = _this3._handleClose.bind(_this3);
30033 _this3._ws.onmessage = _this3._handleMessage.bind(_this3);
30034 return ws;
30035 });
30036 };
30037
30038 _proto._destroyWs = function _destroyWs() {
30039 var ws = this._ws;
30040 if (!ws) return;
30041 ws.onopen = null;
30042 ws.onclose = null;
30043 ws.onerror = null;
30044 ws.onmessage = null;
30045 this._ws = null;
30046 ws.close();
30047 } // eslint-disable-next-line class-methods-use-this
30048 ;
30049
30050 _proto.onbeforeevent = function onbeforeevent(event, from, to) {
30051 var _context10, _context11;
30052
30053 for (var _len2 = arguments.length, payload = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
30054 payload[_key2 - 3] = arguments[_key2];
30055 }
30056
30057 debug$3((0, _concat.default)(_context10 = (0, _concat.default)(_context11 = "".concat(event, ": ")).call(_context11, from, " -> ")).call(_context10, to, " %o"), payload);
30058 };
30059
30060 _proto.onopen = function onopen() {
30061 this.emit(OPEN);
30062 };
30063
30064 _proto.onconnected = function onconnected() {
30065 this._startConnectionKeeper();
30066 };
30067
30068 _proto.onleaveconnected = function onleaveconnected(event, from, to) {
30069 this._stopConnectionKeeper();
30070
30071 this._destroyWs();
30072
30073 if (to === 'offline' || to === 'disconnected') {
30074 this.emit(DISCONNECT);
30075 }
30076 };
30077
30078 _proto.onpause = function onpause() {
30079 this.emit(OFFLINE);
30080 };
30081
30082 _proto.onbeforeresume = function onbeforeresume() {
30083 this.emit(ONLINE);
30084 };
30085
30086 _proto.onreconnect = function onreconnect() {
30087 this.emit(RECONNECT);
30088 };
30089
30090 _proto.ondisconnected = function ondisconnected(event, from, to) {
30091 var _context12;
30092
30093 var _this4 = this;
30094
30095 var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
30096 var delay = from === OFFLINE ? 0 : DEFAULT_RETRY_STRATEGY.call(null, attempt);
30097 debug$3((0, _concat.default)(_context12 = "schedule attempt=".concat(attempt, " delay=")).call(_context12, delay));
30098 this.emit(SCHEDULE, attempt, delay);
30099
30100 if (this.__scheduledRetry) {
30101 clearTimeout(this.__scheduledRetry);
30102 }
30103
30104 this.__scheduledRetry = setTimeout(function () {
30105 if (_this4.is('disconnected')) {
30106 _this4.retry(attempt);
30107 }
30108 }, delay);
30109 };
30110
30111 _proto.onretry = function onretry(event, from, to) {
30112 var _this5 = this;
30113
30114 var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
30115 this.emit(RETRY, attempt);
30116
30117 this._open().then(function () {
30118 return _this5.can('reconnect') && _this5.reconnect();
30119 }, function () {
30120 return _this5.can('fail') && _this5.fail(attempt + 1);
30121 });
30122 };
30123
30124 _proto.onerror = function onerror(event, from, to, error) {
30125 this.emit(ERROR, error);
30126 };
30127
30128 _proto.onclose = function onclose() {
30129 if (global$1.removeEventListener) {
30130 if (this.__pause) global$1.removeEventListener('offline', this.__pause);
30131 if (this.__resume) global$1.removeEventListener('online', this.__resume);
30132 }
30133 };
30134
30135 _proto.checkConnectionAvailability = function checkConnectionAvailability() {
30136 var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'API';
30137
30138 if (!this.is('connected')) {
30139 var _context13;
30140
30141 var currentState = this.current;
30142 console.warn((0, _concat.default)(_context13 = "".concat(name, " should not be called when the connection is ")).call(_context13, currentState));
30143
30144 if (this.is('disconnected') || this.is('reconnecting')) {
30145 console.warn('disconnect and reconnect event should be handled to avoid such calls.');
30146 }
30147
30148 throw new Error('Connection unavailable');
30149 }
30150 } // jsdoc-ignore-start
30151 ;
30152
30153 _proto. // jsdoc-ignore-end
30154 _ping = function _ping() {
30155 debug$3('ping');
30156
30157 try {
30158 this.ping();
30159 } catch (error) {
30160 console.warn("websocket ping error: ".concat(error.message));
30161 }
30162 };
30163
30164 _proto.ping = function ping() {
30165 if (this._ws.ping) {
30166 this._ws.ping();
30167 } else {
30168 console.warn("The WebSocket implement does not support sending ping frame.\n Override ping method to use application defined ping/pong mechanism.");
30169 }
30170 };
30171
30172 _proto._postponeTimeoutTimer = function _postponeTimeoutTimer() {
30173 var _this6 = this;
30174
30175 debug$3('_postponeTimeoutTimer');
30176
30177 this._clearTimeoutTimers();
30178
30179 this._timeoutTimer = setTimeout(function () {
30180 debug$3('timeout');
30181
30182 _this6.disconnect();
30183 }, TIMEOUT_TIME);
30184 };
30185
30186 _proto._clearTimeoutTimers = function _clearTimeoutTimers() {
30187 if (this._timeoutTimer) {
30188 clearTimeout(this._timeoutTimer);
30189 }
30190 };
30191
30192 _proto._startConnectionKeeper = function _startConnectionKeeper() {
30193 debug$3('start connection keeper');
30194 this._heartbeatTimer = setInterval(this._ping.bind(this), HEARTBEAT_TIME);
30195 var addListener = this._ws.addListener || this._ws.addEventListener;
30196
30197 if (!addListener) {
30198 debug$3('connection keeper disabled due to the lack of #addEventListener.');
30199 return;
30200 }
30201
30202 addListener.call(this._ws, 'message', this.__postponeTimeoutTimer);
30203 addListener.call(this._ws, 'pong', this.__postponeTimeoutTimer);
30204
30205 this._postponeTimeoutTimer();
30206 };
30207
30208 _proto._stopConnectionKeeper = function _stopConnectionKeeper() {
30209 debug$3('stop connection keeper'); // websockets/ws#489
30210
30211 var removeListener = this._ws.removeListener || this._ws.removeEventListener;
30212
30213 if (removeListener) {
30214 removeListener.call(this._ws, 'message', this.__postponeTimeoutTimer);
30215 removeListener.call(this._ws, 'pong', this.__postponeTimeoutTimer);
30216
30217 this._clearTimeoutTimers();
30218 }
30219
30220 if (this._heartbeatTimer) {
30221 clearInterval(this._heartbeatTimer);
30222 }
30223 };
30224
30225 _proto._handleClose = function _handleClose(event) {
30226 var _context14;
30227
30228 debug$3((0, _concat.default)(_context14 = "ws closed [".concat(event.code, "] ")).call(_context14, event.reason)); // socket closed manually, ignore close event.
30229
30230 if (this.isFinished()) return;
30231 this.handleClose(event);
30232 };
30233
30234 _proto.handleClose = function handleClose() {
30235 // reconnect
30236 this.disconnect();
30237 } // jsdoc-ignore-start
30238 ;
30239
30240 _proto. // jsdoc-ignore-end
30241 send = function send(data) {
30242 debug$3('send', data);
30243
30244 this._ws.send(data);
30245 };
30246
30247 _proto._handleMessage = function _handleMessage(event) {
30248 debug$3('message', event.data);
30249 this.handleMessage(event.data);
30250 };
30251
30252 _proto.handleMessage = function handleMessage(message) {
30253 this.emit(MESSAGE, message);
30254 };
30255
30256 return WebSocketPlus;
30257}(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);
30258StateMachine.create({
30259 target: WebSocketPlus.prototype,
30260 initial: {
30261 state: 'initialized',
30262 event: 'init',
30263 defer: true
30264 },
30265 terminal: 'closed',
30266 events: [{
30267 name: 'open',
30268 from: 'initialized',
30269 to: 'connected'
30270 }, {
30271 name: 'disconnect',
30272 from: 'connected',
30273 to: 'disconnected'
30274 }, {
30275 name: 'retry',
30276 from: 'disconnected',
30277 to: 'reconnecting'
30278 }, {
30279 name: 'fail',
30280 from: 'reconnecting',
30281 to: 'disconnected'
30282 }, {
30283 name: 'reconnect',
30284 from: 'reconnecting',
30285 to: 'connected'
30286 }, {
30287 name: 'pause',
30288 from: ['connected', 'disconnected', 'reconnecting'],
30289 to: 'offline'
30290 }, {}, {
30291 name: 'resume',
30292 from: 'offline',
30293 to: 'disconnected'
30294 }, {
30295 name: 'close',
30296 from: ['connected', 'disconnected', 'reconnecting', 'offline'],
30297 to: 'closed'
30298 }, {
30299 name: 'throw',
30300 from: '*',
30301 to: 'error'
30302 }]
30303});
30304var error = (0, _freeze.default)({
30305 1000: {
30306 name: 'CLOSE_NORMAL'
30307 },
30308 1006: {
30309 name: 'CLOSE_ABNORMAL'
30310 },
30311 4100: {
30312 name: 'APP_NOT_AVAILABLE',
30313 message: 'App not exists or realtime message service is disabled.'
30314 },
30315 4102: {
30316 name: 'SIGNATURE_FAILED',
30317 message: 'Login signature mismatch.'
30318 },
30319 4103: {
30320 name: 'INVALID_LOGIN',
30321 message: 'Malformed clientId.'
30322 },
30323 4105: {
30324 name: 'SESSION_REQUIRED',
30325 message: 'Message sent before session opened.'
30326 },
30327 4107: {
30328 name: 'READ_TIMEOUT'
30329 },
30330 4108: {
30331 name: 'LOGIN_TIMEOUT'
30332 },
30333 4109: {
30334 name: 'FRAME_TOO_LONG'
30335 },
30336 4110: {
30337 name: 'INVALID_ORIGIN',
30338 message: 'Access denied by domain whitelist.'
30339 },
30340 4111: {
30341 name: 'SESSION_CONFLICT'
30342 },
30343 4112: {
30344 name: 'SESSION_TOKEN_EXPIRED'
30345 },
30346 4113: {
30347 name: 'APP_QUOTA_EXCEEDED',
30348 message: 'The daily active users limit exceeded.'
30349 },
30350 4116: {
30351 name: 'MESSAGE_SENT_QUOTA_EXCEEDED',
30352 message: 'Command sent too fast.'
30353 },
30354 4200: {
30355 name: 'INTERNAL_ERROR',
30356 message: 'Internal error, please contact LeanCloud for support.'
30357 },
30358 4301: {
30359 name: 'CONVERSATION_API_FAILED',
30360 message: 'Upstream Conversatoin API failed, see error.detail for details.'
30361 },
30362 4302: {
30363 name: 'CONVERSATION_SIGNATURE_FAILED',
30364 message: 'Conversation action signature mismatch.'
30365 },
30366 4303: {
30367 name: 'CONVERSATION_NOT_FOUND'
30368 },
30369 4304: {
30370 name: 'CONVERSATION_FULL'
30371 },
30372 4305: {
30373 name: 'CONVERSATION_REJECTED_BY_APP',
30374 message: 'Conversation action rejected by hook.'
30375 },
30376 4306: {
30377 name: 'CONVERSATION_UPDATE_FAILED'
30378 },
30379 4307: {
30380 name: 'CONVERSATION_READ_ONLY'
30381 },
30382 4308: {
30383 name: 'CONVERSATION_NOT_ALLOWED'
30384 },
30385 4309: {
30386 name: 'CONVERSATION_UPDATE_REJECTED',
30387 message: 'Conversation update rejected because the client is not a member.'
30388 },
30389 4310: {
30390 name: 'CONVERSATION_QUERY_FAILED',
30391 message: 'Conversation query failed because it is too expansive.'
30392 },
30393 4311: {
30394 name: 'CONVERSATION_LOG_FAILED'
30395 },
30396 4312: {
30397 name: 'CONVERSATION_LOG_REJECTED',
30398 message: 'Message query rejected because the client is not a member of the conversation.'
30399 },
30400 4313: {
30401 name: 'SYSTEM_CONVERSATION_REQUIRED'
30402 },
30403 4314: {
30404 name: 'NORMAL_CONVERSATION_REQUIRED'
30405 },
30406 4315: {
30407 name: 'CONVERSATION_BLACKLISTED',
30408 message: 'Blacklisted in the conversation.'
30409 },
30410 4316: {
30411 name: 'TRANSIENT_CONVERSATION_REQUIRED'
30412 },
30413 4317: {
30414 name: 'CONVERSATION_MEMBERSHIP_REQUIRED'
30415 },
30416 4318: {
30417 name: 'CONVERSATION_API_QUOTA_EXCEEDED',
30418 message: 'LeanCloud API quota exceeded. You may upgrade your plan.'
30419 },
30420 4323: {
30421 name: 'TEMPORARY_CONVERSATION_EXPIRED',
30422 message: 'Temporary conversation expired or does not exist.'
30423 },
30424 4401: {
30425 name: 'INVALID_MESSAGING_TARGET',
30426 message: 'Conversation does not exist or client is not a member.'
30427 },
30428 4402: {
30429 name: 'MESSAGE_REJECTED_BY_APP',
30430 message: 'Message rejected by hook.'
30431 },
30432 4403: {
30433 name: 'MESSAGE_OWNERSHIP_REQUIRED'
30434 },
30435 4404: {
30436 name: 'MESSAGE_NOT_FOUND'
30437 },
30438 4405: {
30439 name: 'MESSAGE_UPDATE_REJECTED_BY_APP',
30440 message: 'Message update rejected by hook.'
30441 },
30442 4406: {
30443 name: 'MESSAGE_EDIT_DISABLED'
30444 },
30445 4407: {
30446 name: 'MESSAGE_RECALL_DISABLED'
30447 },
30448 5130: {
30449 name: 'OWNER_PROMOTION_NOT_ALLOWED',
30450 message: "Updating a member's role to owner is not allowed."
30451 }
30452});
30453var ErrorCode = (0, _freeze.default)((0, _reduce.default)(_context15 = (0, _keys.default)(error)).call(_context15, function (result, code) {
30454 return (0, _assign.default)(result, _defineProperty({}, error[code].name, Number(code)));
30455}, {}));
30456
30457var createError = function createError(_ref) {
30458 var code = _ref.code,
30459 reason = _ref.reason,
30460 appCode = _ref.appCode,
30461 detail = _ref.detail,
30462 errorMessage = _ref.error;
30463 var message = reason || detail || errorMessage;
30464 var name = reason;
30465
30466 if (!message && error[code]) {
30467 name = error[code].name;
30468 message = error[code].message || name;
30469 }
30470
30471 if (!message) {
30472 message = "Unknow Error: ".concat(code);
30473 }
30474
30475 var err = new Error(message);
30476 return (0, _assign.default)(err, {
30477 code: code,
30478 appCode: appCode,
30479 detail: detail,
30480 name: name
30481 });
30482};
30483
30484var debug$4 = d('LC:Connection');
30485var COMMAND_TIMEOUT = 20000;
30486var EXPIRE = (0, _symbol.default)('expire');
30487
30488var isIdempotentCommand = function isIdempotentCommand(command) {
30489 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));
30490};
30491
30492var Connection = /*#__PURE__*/function (_WebSocketPlus) {
30493 _inheritsLoose(Connection, _WebSocketPlus);
30494
30495 function Connection(getUrl, _ref) {
30496 var _context16;
30497
30498 var _this;
30499
30500 var format = _ref.format,
30501 version = _ref.version;
30502 debug$4('initializing Connection');
30503 var protocolString = (0, _concat.default)(_context16 = "lc.".concat(format, ".")).call(_context16, version);
30504 _this = _WebSocketPlus.call(this, getUrl, protocolString) || this;
30505 _this._protocolFormat = format;
30506 _this._commands = {};
30507 _this._serialId = 0;
30508 return _this;
30509 }
30510
30511 var _proto = Connection.prototype;
30512
30513 _proto.send = /*#__PURE__*/function () {
30514 var _send = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(command) {
30515 var _this2 = this;
30516
30517 var waitingForRespond,
30518 buffer,
30519 serialId,
30520 duplicatedCommand,
30521 message,
30522 promise,
30523 _args = arguments;
30524 return _regeneratorRuntime.wrap(function _callee$(_context) {
30525 var _context17, _context18;
30526
30527 while (1) {
30528 switch (_context.prev = _context.next) {
30529 case 0:
30530 waitingForRespond = _args.length > 1 && _args[1] !== undefined ? _args[1] : true;
30531
30532 if (!waitingForRespond) {
30533 _context.next = 11;
30534 break;
30535 }
30536
30537 if (!isIdempotentCommand(command)) {
30538 _context.next = 8;
30539 break;
30540 }
30541
30542 buffer = command.toArrayBuffer();
30543 duplicatedCommand = (0, _find.default)(_context17 = values(this._commands)).call(_context17, function (_ref2) {
30544 var targetBuffer = _ref2.buffer,
30545 targetCommand = _ref2.command;
30546 return targetCommand.cmd === command.cmd && targetCommand.op === command.op && equalBuffer(targetBuffer, buffer);
30547 });
30548
30549 if (!duplicatedCommand) {
30550 _context.next = 8;
30551 break;
30552 }
30553
30554 console.warn((0, _concat.default)(_context18 = "Duplicated command [cmd:".concat(command.cmd, " op:")).call(_context18, command.op, "] is throttled."));
30555 return _context.abrupt("return", duplicatedCommand.promise);
30556
30557 case 8:
30558 this._serialId += 1;
30559 serialId = this._serialId;
30560 command.i = serialId;
30561 // eslint-disable-line no-param-reassign
30562
30563 case 11:
30564 if (debug$4.enabled) debug$4('↑ %O sent', trim(command));
30565
30566 if (this._protocolFormat === 'proto2base64') {
30567 message = command.toBase64();
30568 } else if (command.toArrayBuffer) {
30569 message = command.toArrayBuffer();
30570 }
30571
30572 if (message) {
30573 _context.next = 15;
30574 break;
30575 }
30576
30577 throw new TypeError("".concat(command, " is not a GenericCommand"));
30578
30579 case 15:
30580 _WebSocketPlus.prototype.send.call(this, message);
30581
30582 if (waitingForRespond) {
30583 _context.next = 18;
30584 break;
30585 }
30586
30587 return _context.abrupt("return", undefined);
30588
30589 case 18:
30590 promise = new _promise.default(function (resolve, reject) {
30591 _this2._commands[serialId] = {
30592 command: command,
30593 buffer: buffer,
30594 resolve: resolve,
30595 reject: reject,
30596 timeout: setTimeout(function () {
30597 if (_this2._commands[serialId]) {
30598 var _context19;
30599
30600 if (debug$4.enabled) debug$4('✗ %O timeout', trim(command));
30601 reject(createError({
30602 error: (0, _concat.default)(_context19 = "Command Timeout [cmd:".concat(command.cmd, " op:")).call(_context19, command.op, "]"),
30603 name: 'COMMAND_TIMEOUT'
30604 }));
30605 delete _this2._commands[serialId];
30606 }
30607 }, COMMAND_TIMEOUT)
30608 };
30609 });
30610 this._commands[serialId].promise = promise;
30611 return _context.abrupt("return", promise);
30612
30613 case 21:
30614 case "end":
30615 return _context.stop();
30616 }
30617 }
30618 }, _callee, this);
30619 }));
30620
30621 function send(_x) {
30622 return _send.apply(this, arguments);
30623 }
30624
30625 return send;
30626 }();
30627
30628 _proto.handleMessage = function handleMessage(msg) {
30629 var message;
30630
30631 try {
30632 message = GenericCommand.decode(msg);
30633 if (debug$4.enabled) debug$4('↓ %O received', trim(message));
30634 } catch (e) {
30635 console.warn('Decode message failed:', e.message, msg);
30636 return;
30637 }
30638
30639 var serialId = message.i;
30640
30641 if (serialId) {
30642 if (this._commands[serialId]) {
30643 clearTimeout(this._commands[serialId].timeout);
30644
30645 if (message.cmd === CommandType.error) {
30646 this._commands[serialId].reject(createError(message.errorMessage));
30647 } else {
30648 this._commands[serialId].resolve(message);
30649 }
30650
30651 delete this._commands[serialId];
30652 } else {
30653 console.warn("Unexpected command received with serialId [".concat(serialId, "],\n which have timed out or never been requested."));
30654 }
30655 } else {
30656 switch (message.cmd) {
30657 case CommandType.error:
30658 {
30659 this.emit(ERROR, createError(message.errorMessage));
30660 return;
30661 }
30662
30663 case CommandType.goaway:
30664 {
30665 this.emit(EXPIRE);
30666 return;
30667 }
30668
30669 default:
30670 {
30671 this.emit(MESSAGE, message);
30672 }
30673 }
30674 }
30675 };
30676
30677 _proto.ping = function ping() {
30678 return this.send(new GenericCommand({
30679 cmd: CommandType.echo
30680 }))["catch"](function (error) {
30681 return debug$4('ping failed:', error);
30682 });
30683 };
30684
30685 return Connection;
30686}(WebSocketPlus);
30687
30688var debug$5 = d('LC:request');
30689
30690var request = function request(_ref) {
30691 var _ref$method = _ref.method,
30692 method = _ref$method === void 0 ? 'GET' : _ref$method,
30693 _url = _ref.url,
30694 query = _ref.query,
30695 headers = _ref.headers,
30696 data = _ref.data,
30697 time = _ref.timeout;
30698 var url = _url;
30699
30700 if (query) {
30701 var _context20, _context21, _context23;
30702
30703 var queryString = (0, _filter.default)(_context20 = (0, _map.default)(_context21 = (0, _keys.default)(query)).call(_context21, function (key) {
30704 var _context22;
30705
30706 var value = query[key];
30707 if (value === undefined) return undefined;
30708 var v = isPlainObject(value) ? (0, _stringify.default)(value) : value;
30709 return (0, _concat.default)(_context22 = "".concat(encodeURIComponent(key), "=")).call(_context22, encodeURIComponent(v));
30710 })).call(_context20, function (qs) {
30711 return qs;
30712 }).join('&');
30713 url = (0, _concat.default)(_context23 = "".concat(url, "?")).call(_context23, queryString);
30714 }
30715
30716 debug$5('Req: %O %O %O', method, url, {
30717 headers: headers,
30718 data: data
30719 });
30720 var request = getAdapter('request');
30721 var promise = request(url, {
30722 method: method,
30723 headers: headers,
30724 data: data
30725 }).then(function (response) {
30726 if (response.ok === false) {
30727 var error = createError(response.data);
30728 error.response = response;
30729 throw error;
30730 }
30731
30732 debug$5('Res: %O %O %O', url, response.status, response.data);
30733 return response.data;
30734 })["catch"](function (error) {
30735 if (error.response) {
30736 debug$5('Error: %O %O %O', url, error.response.status, error.response.data);
30737 }
30738
30739 throw error;
30740 });
30741 return time ? promiseTimeout.timeout(promise, time) : promise;
30742};
30743
30744var applyDecorators = function applyDecorators(decorators, target) {
30745 if (decorators) {
30746 decorators.forEach(function (decorator) {
30747 try {
30748 decorator(target);
30749 } catch (error) {
30750 if (decorator._pluginName) {
30751 error.message += "[".concat(decorator._pluginName, "]");
30752 }
30753
30754 throw error;
30755 }
30756 });
30757 }
30758};
30759
30760var applyDispatcher = function applyDispatcher(dispatchers, payload) {
30761 var _context24;
30762
30763 return (0, _reduce.default)(_context24 = ensureArray(dispatchers)).call(_context24, function (resultPromise, dispatcher) {
30764 return resultPromise.then(function (shouldDispatch) {
30765 return shouldDispatch === false ? false : dispatcher.apply(void 0, _toConsumableArray(payload));
30766 })["catch"](function (error) {
30767 if (dispatcher._pluginName) {
30768 // eslint-disable-next-line no-param-reassign
30769 error.message += "[".concat(dispatcher._pluginName, "]");
30770 }
30771
30772 throw error;
30773 });
30774 }, _promise.default.resolve(true));
30775};
30776
30777var version = "5.0.0-rc.7";
30778
30779function ownKeys$2(object, enumerableOnly) {
30780 var keys = (0, _keys.default)(object);
30781
30782 if (_getOwnPropertySymbols.default) {
30783 var symbols = (0, _getOwnPropertySymbols.default)(object);
30784 if (enumerableOnly) symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
30785 return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
30786 });
30787 keys.push.apply(keys, symbols);
30788 }
30789
30790 return keys;
30791}
30792
30793function _objectSpread$2(target) {
30794 for (var i = 1; i < arguments.length; i++) {
30795 var source = arguments[i] != null ? arguments[i] : {};
30796
30797 if (i % 2) {
30798 ownKeys$2(Object(source), true).forEach(function (key) {
30799 _defineProperty(target, key, source[key]);
30800 });
30801 } else if (_getOwnPropertyDescriptors.default) {
30802 (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source));
30803 } else {
30804 ownKeys$2(Object(source)).forEach(function (key) {
30805 (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
30806 });
30807 }
30808 }
30809
30810 return target;
30811}
30812
30813var debug$6 = d('LC:Realtime');
30814var routerCache = new Cache('push-router');
30815var initializedApp = {};
30816
30817var Realtime = /*#__PURE__*/function (_EventEmitter) {
30818 _inheritsLoose(Realtime, _EventEmitter);
30819 /**
30820 * @extends EventEmitter
30821 * @param {Object} options
30822 * @param {String} options.appId
30823 * @param {String} options.appKey (since 4.0.0)
30824 * @param {String|Object} [options.server] 指定服务器域名,中国节点应用此参数必填(since 4.0.0)
30825 * @param {Boolean} [options.noBinary=false] 设置 WebSocket 使用字符串格式收发消息(默认为二进制格式)。
30826 * 适用于 WebSocket 实现不支持二进制数据格式的情况
30827 * @param {Boolean} [options.ssl=true] 使用 wss 进行连接
30828 * @param {String|String[]} [options.RTMServers] 指定私有部署的 RTM 服务器地址(since 4.0.0)
30829 * @param {Plugin[]} [options.plugins] 加载插件(since 3.1.0)
30830 */
30831
30832
30833 function Realtime(_ref) {
30834 var _context25;
30835
30836 var _this2;
30837
30838 var plugins = _ref.plugins,
30839 options = _objectWithoutProperties(_ref, ["plugins"]);
30840
30841 debug$6('initializing Realtime %s %O', version, options);
30842 _this2 = _EventEmitter.call(this) || this;
30843 var appId = options.appId;
30844
30845 if (typeof appId !== 'string') {
30846 throw new TypeError("appId [".concat(appId, "] is not a string"));
30847 }
30848
30849 if (initializedApp[appId]) {
30850 throw new Error("App [".concat(appId, "] is already initialized."));
30851 }
30852
30853 initializedApp[appId] = true;
30854
30855 if (typeof options.appKey !== 'string') {
30856 throw new TypeError("appKey [".concat(options.appKey, "] is not a string"));
30857 }
30858
30859 if (isCNApp(appId)) {
30860 if (!options.server) {
30861 throw new TypeError("server option is required for apps from CN region");
30862 }
30863 }
30864
30865 _this2._options = _objectSpread$2({
30866 appId: undefined,
30867 appKey: undefined,
30868 noBinary: false,
30869 ssl: true,
30870 RTMServerName: typeof process !== 'undefined' ? process.env.RTM_SERVER_NAME : undefined
30871 }, options);
30872 _this2._cache = new Cache('endpoints');
30873
30874 var _this = internal(_assertThisInitialized(_this2));
30875
30876 _this.clients = new _set.default();
30877 _this.pendingClients = new _set.default();
30878 var mergedPlugins = (0, _concat.default)(_context25 = []).call(_context25, _toConsumableArray(ensureArray(Realtime.__preRegisteredPlugins)), _toConsumableArray(ensureArray(plugins)));
30879 debug$6('Using plugins %o', (0, _map.default)(mergedPlugins).call(mergedPlugins, function (plugin) {
30880 return plugin.name;
30881 }));
30882 _this2._plugins = (0, _reduce.default)(mergedPlugins).call(mergedPlugins, function (result, plugin) {
30883 (0, _keys.default)(plugin).forEach(function (hook) {
30884 if ({}.hasOwnProperty.call(plugin, hook) && hook !== 'name') {
30885 var _context26;
30886
30887 if (plugin.name) {
30888 ensureArray(plugin[hook]).forEach(function (value) {
30889 // eslint-disable-next-line no-param-reassign
30890 value._pluginName = plugin.name;
30891 });
30892 } // eslint-disable-next-line no-param-reassign
30893
30894
30895 result[hook] = (0, _concat.default)(_context26 = ensureArray(result[hook])).call(_context26, plugin[hook]);
30896 }
30897 });
30898 return result;
30899 }, {}); // onRealtimeCreate hook
30900
30901 applyDecorators(_this2._plugins.onRealtimeCreate, _assertThisInitialized(_this2));
30902 return _this2;
30903 }
30904
30905 var _proto = Realtime.prototype;
30906
30907 _proto._request = /*#__PURE__*/function () {
30908 var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
30909 var method, _url, _ref2$version, version, path, query, headers, data, url, _this$_options, appId, server, _yield$this$construct, api;
30910
30911 return _regeneratorRuntime.wrap(function _callee$(_context) {
30912 var _context27, _context28;
30913
30914 while (1) {
30915 switch (_context.prev = _context.next) {
30916 case 0:
30917 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;
30918 url = _url;
30919
30920 if (url) {
30921 _context.next = 9;
30922 break;
30923 }
30924
30925 _this$_options = this._options, appId = _this$_options.appId, server = _this$_options.server;
30926 _context.next = 6;
30927 return this.constructor._getServerUrls({
30928 appId: appId,
30929 server: server
30930 });
30931
30932 case 6:
30933 _yield$this$construct = _context.sent;
30934 api = _yield$this$construct.api;
30935 url = (0, _concat.default)(_context27 = (0, _concat.default)(_context28 = "".concat(api, "/")).call(_context28, version)).call(_context27, path);
30936
30937 case 9:
30938 return _context.abrupt("return", request({
30939 url: url,
30940 method: method,
30941 query: query,
30942 headers: _objectSpread$2({
30943 'X-LC-Id': this._options.appId,
30944 'X-LC-Key': this._options.appKey
30945 }, headers),
30946 data: data
30947 }));
30948
30949 case 10:
30950 case "end":
30951 return _context.stop();
30952 }
30953 }
30954 }, _callee, this);
30955 }));
30956
30957 function _request(_x) {
30958 return _request2.apply(this, arguments);
30959 }
30960
30961 return _request;
30962 }();
30963
30964 _proto._open = function _open() {
30965 var _this3 = this;
30966
30967 if (this._openPromise) return this._openPromise;
30968 var format = 'protobuf2';
30969
30970 if (this._options.noBinary) {
30971 // 不发送 binary data,fallback to base64 string
30972 format = 'proto2base64';
30973 }
30974
30975 var version = 3;
30976 var protocol = {
30977 format: format,
30978 version: version
30979 };
30980 this._openPromise = new _promise.default(function (resolve, reject) {
30981 debug$6('No connection established, create a new one.');
30982 var connection = new Connection(function () {
30983 return _this3._getRTMServers(_this3._options);
30984 }, protocol);
30985 connection.on(OPEN, function () {
30986 return resolve(connection);
30987 }).on(ERROR, function (error) {
30988 delete _this3._openPromise;
30989 reject(error);
30990 }).on(EXPIRE, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
30991 return _regeneratorRuntime.wrap(function _callee2$(_context2) {
30992 while (1) {
30993 switch (_context2.prev = _context2.next) {
30994 case 0:
30995 debug$6('Connection expired. Refresh endpoints.');
30996
30997 _this3._cache.set('endpoints', null, 0);
30998
30999 _context2.next = 4;
31000 return _this3._getRTMServers(_this3._options);
31001
31002 case 4:
31003 connection.urls = _context2.sent;
31004 connection.disconnect();
31005
31006 case 6:
31007 case "end":
31008 return _context2.stop();
31009 }
31010 }
31011 }, _callee2);
31012 }))).on(MESSAGE, _this3._dispatchCommand.bind(_this3));
31013 /**
31014 * 连接断开。
31015 * 连接断开可能是因为 SDK 进入了离线状态(see {@link Realtime#event:OFFLINE}),或长时间没有收到服务器心跳。
31016 * 连接断开后所有的网络操作都会失败,请在连接断开后禁用相关的 UI 元素。
31017 * @event Realtime#DISCONNECT
31018 */
31019
31020 /**
31021 * 计划在一段时间后尝试重新连接
31022 * @event Realtime#SCHEDULE
31023 * @param {Number} attempt 尝试重连的次数
31024 * @param {Number} delay 延迟的毫秒数
31025 */
31026
31027 /**
31028 * 正在尝试重新连接
31029 * @event Realtime#RETRY
31030 * @param {Number} attempt 尝试重连的次数
31031 */
31032
31033 /**
31034 * 连接恢复正常。
31035 * 请重新启用在 {@link Realtime#event:DISCONNECT} 事件中禁用的相关 UI 元素
31036 * @event Realtime#RECONNECT
31037 */
31038
31039 /**
31040 * 客户端连接断开
31041 * @event IMClient#DISCONNECT
31042 * @see Realtime#event:DISCONNECT
31043 * @since 3.2.0
31044 */
31045
31046 /**
31047 * 计划在一段时间后尝试重新连接
31048 * @event IMClient#SCHEDULE
31049 * @param {Number} attempt 尝试重连的次数
31050 * @param {Number} delay 延迟的毫秒数
31051 * @since 3.2.0
31052 */
31053
31054 /**
31055 * 正在尝试重新连接
31056 * @event IMClient#RETRY
31057 * @param {Number} attempt 尝试重连的次数
31058 * @since 3.2.0
31059 */
31060
31061 /**
31062 * 客户端进入离线状态。
31063 * 这通常意味着网络已断开,或者 {@link Realtime#pause} 被调用
31064 * @event Realtime#OFFLINE
31065 * @since 3.4.0
31066 */
31067
31068 /**
31069 * 客户端恢复在线状态
31070 * 这通常意味着网络已恢复,或者 {@link Realtime#resume} 被调用
31071 * @event Realtime#ONLINE
31072 * @since 3.4.0
31073 */
31074
31075 /**
31076 * 进入离线状态。
31077 * 这通常意味着网络已断开,或者 {@link Realtime#pause} 被调用
31078 * @event IMClient#OFFLINE
31079 * @since 3.4.0
31080 */
31081
31082 /**
31083 * 恢复在线状态
31084 * 这通常意味着网络已恢复,或者 {@link Realtime#resume} 被调用
31085 * @event IMClient#ONLINE
31086 * @since 3.4.0
31087 */
31088 // event proxy
31089
31090 [DISCONNECT, RECONNECT, RETRY, SCHEDULE, OFFLINE, ONLINE].forEach(function (event) {
31091 return connection.on(event, function () {
31092 var _context29;
31093
31094 for (var _len = arguments.length, payload = new Array(_len), _key = 0; _key < _len; _key++) {
31095 payload[_key] = arguments[_key];
31096 }
31097
31098 debug$6("".concat(event, " event emitted. %o"), payload);
31099
31100 _this3.emit.apply(_this3, (0, _concat.default)(_context29 = [event]).call(_context29, payload));
31101
31102 if (event !== RECONNECT) {
31103 internal(_this3).clients.forEach(function (client) {
31104 var _context30;
31105
31106 client.emit.apply(client, (0, _concat.default)(_context30 = [event]).call(_context30, payload));
31107 });
31108 }
31109 });
31110 }); // override handleClose
31111
31112 connection.handleClose = function handleClose(event) {
31113 var isFatal = [ErrorCode.APP_NOT_AVAILABLE, ErrorCode.INVALID_LOGIN, ErrorCode.INVALID_ORIGIN].some(function (errorCode) {
31114 return errorCode === event.code;
31115 });
31116
31117 if (isFatal) {
31118 // in these cases, SDK should throw.
31119 this["throw"](createError(event));
31120 } else {
31121 // reconnect
31122 this.disconnect();
31123 }
31124 };
31125
31126 internal(_this3).connection = connection;
31127 });
31128 return this._openPromise;
31129 };
31130
31131 _proto._getRTMServers = /*#__PURE__*/function () {
31132 var _getRTMServers2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(options) {
31133 var info, cachedEndPoints, _info, server, secondary, ttl;
31134
31135 return _regeneratorRuntime.wrap(function _callee3$(_context3) {
31136 while (1) {
31137 switch (_context3.prev = _context3.next) {
31138 case 0:
31139 if (!options.RTMServers) {
31140 _context3.next = 2;
31141 break;
31142 }
31143
31144 return _context3.abrupt("return", shuffle(ensureArray(options.RTMServers)));
31145
31146 case 2:
31147 cachedEndPoints = this._cache.get('endpoints');
31148
31149 if (!cachedEndPoints) {
31150 _context3.next = 7;
31151 break;
31152 }
31153
31154 info = cachedEndPoints;
31155 _context3.next = 14;
31156 break;
31157
31158 case 7:
31159 _context3.next = 9;
31160 return this.constructor._fetchRTMServers(options);
31161
31162 case 9:
31163 info = _context3.sent;
31164 _info = info, server = _info.server, secondary = _info.secondary, ttl = _info.ttl;
31165
31166 if (!(typeof server !== 'string' && typeof secondary !== 'string' && typeof ttl !== 'number')) {
31167 _context3.next = 13;
31168 break;
31169 }
31170
31171 throw new Error("malformed RTM route response: ".concat((0, _stringify.default)(info)));
31172
31173 case 13:
31174 this._cache.set('endpoints', info, info.ttl * 1000);
31175
31176 case 14:
31177 debug$6('endpoint info: %O', info);
31178 return _context3.abrupt("return", [info.server, info.secondary]);
31179
31180 case 16:
31181 case "end":
31182 return _context3.stop();
31183 }
31184 }
31185 }, _callee3, this);
31186 }));
31187
31188 function _getRTMServers(_x2) {
31189 return _getRTMServers2.apply(this, arguments);
31190 }
31191
31192 return _getRTMServers;
31193 }();
31194
31195 Realtime._getServerUrls = /*#__PURE__*/function () {
31196 var _getServerUrls2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref4) {
31197 var appId, server, cachedRouter, defaultProtocol;
31198 return _regeneratorRuntime.wrap(function _callee4$(_context4) {
31199 while (1) {
31200 switch (_context4.prev = _context4.next) {
31201 case 0:
31202 appId = _ref4.appId, server = _ref4.server;
31203 debug$6('fetch server urls');
31204
31205 if (!server) {
31206 _context4.next = 6;
31207 break;
31208 }
31209
31210 if (!(typeof server !== 'string')) {
31211 _context4.next = 5;
31212 break;
31213 }
31214
31215 return _context4.abrupt("return", server);
31216
31217 case 5:
31218 return _context4.abrupt("return", {
31219 RTMRouter: server,
31220 api: server
31221 });
31222
31223 case 6:
31224 cachedRouter = routerCache.get(appId);
31225
31226 if (!cachedRouter) {
31227 _context4.next = 9;
31228 break;
31229 }
31230
31231 return _context4.abrupt("return", cachedRouter);
31232
31233 case 9:
31234 defaultProtocol = 'https://';
31235 return _context4.abrupt("return", request({
31236 url: 'https://app-router.com/2/route',
31237 query: {
31238 appId: appId
31239 },
31240 timeout: 20000
31241 }).then(tap(debug$6)).then(function (_ref5) {
31242 var _context31, _context32;
31243
31244 var RTMRouterServer = _ref5.rtm_router_server,
31245 APIServer = _ref5.api_server,
31246 _ref5$ttl = _ref5.ttl,
31247 ttl = _ref5$ttl === void 0 ? 3600 : _ref5$ttl;
31248
31249 if (!RTMRouterServer) {
31250 throw new Error('rtm router not exists');
31251 }
31252
31253 var serverUrls = {
31254 RTMRouter: (0, _concat.default)(_context31 = "".concat(defaultProtocol)).call(_context31, RTMRouterServer),
31255 api: (0, _concat.default)(_context32 = "".concat(defaultProtocol)).call(_context32, APIServer)
31256 };
31257 routerCache.set(appId, serverUrls, ttl * 1000);
31258 return serverUrls;
31259 })["catch"](function () {
31260 var _context33, _context34, _context35, _context36;
31261
31262 var id = (0, _slice.default)(appId).call(appId, 0, 8).toLowerCase();
31263 var domain = 'lncldglobal.com';
31264 return {
31265 RTMRouter: (0, _concat.default)(_context33 = (0, _concat.default)(_context34 = "".concat(defaultProtocol)).call(_context34, id, ".rtm.")).call(_context33, domain),
31266 api: (0, _concat.default)(_context35 = (0, _concat.default)(_context36 = "".concat(defaultProtocol)).call(_context36, id, ".api.")).call(_context35, domain)
31267 };
31268 }));
31269
31270 case 11:
31271 case "end":
31272 return _context4.stop();
31273 }
31274 }
31275 }, _callee4);
31276 }));
31277
31278 function _getServerUrls(_x3) {
31279 return _getServerUrls2.apply(this, arguments);
31280 }
31281
31282 return _getServerUrls;
31283 }();
31284
31285 Realtime._fetchRTMServers = function _fetchRTMServers(_ref6) {
31286 var appId = _ref6.appId,
31287 ssl = _ref6.ssl,
31288 server = _ref6.server,
31289 RTMServerName = _ref6.RTMServerName;
31290 debug$6('fetch endpoint info');
31291 return this._getServerUrls({
31292 appId: appId,
31293 server: server
31294 }).then(tap(debug$6)).then(function (_ref7) {
31295 var RTMRouter = _ref7.RTMRouter;
31296 return request({
31297 url: "".concat(RTMRouter, "/v1/route"),
31298 query: {
31299 appId: appId,
31300 secure: ssl,
31301 features: isWeapp ? 'wechat' : undefined,
31302 server: RTMServerName,
31303 _t: Date.now()
31304 },
31305 timeout: 20000
31306 }).then(tap(debug$6));
31307 });
31308 };
31309
31310 _proto._close = function _close() {
31311 if (this._openPromise) {
31312 this._openPromise.then(function (connection) {
31313 return connection.close();
31314 });
31315 }
31316
31317 delete this._openPromise;
31318 }
31319 /**
31320 * 手动进行重连。
31321 * SDK 在网络出现异常时会自动按照一定的时间间隔尝试重连,调用该方法会立即尝试重连并重置重连尝试计数器。
31322 * 只能在 `SCHEDULE` 事件之后,`RETRY` 事件之前调用,如果当前网络正常或者正在进行重连,调用该方法会抛异常。
31323 */
31324 ;
31325
31326 _proto.retry = function retry() {
31327 var _internal = internal(this),
31328 connection = _internal.connection;
31329
31330 if (!connection) {
31331 throw new Error('no connection established');
31332 }
31333
31334 if (connection.cannot('retry')) {
31335 throw new Error("retrying not allowed when not disconnected. the connection is now ".concat(connection.current));
31336 }
31337
31338 return connection.retry();
31339 }
31340 /**
31341 * 暂停,使 SDK 进入离线状态。
31342 * 你可以在网络断开、应用进入后台等时刻调用该方法让 SDK 进入离线状态,离线状态下不会尝试重连。
31343 * 在浏览器中 SDK 会自动监听网络变化,因此无需手动调用该方法。
31344 *
31345 * @since 3.4.0
31346 * @see Realtime#event:OFFLINE
31347 */
31348 ;
31349
31350 _proto.pause = function pause() {
31351 // 这个方法常常在网络断开、进入后台时被调用,此时 connection 可能没有建立或者已经 close。
31352 // 因此不像 retry,这个方法应该尽可能 loose
31353 var _internal2 = internal(this),
31354 connection = _internal2.connection;
31355
31356 if (!connection) return;
31357 if (connection.can('pause')) connection.pause();
31358 }
31359 /**
31360 * 恢复在线状态。
31361 * 你可以在网络恢复、应用回到前台等时刻调用该方法让 SDK 恢复在线状态,恢复在线状态后 SDK 会开始尝试重连。
31362 *
31363 * @since 3.4.0
31364 * @see Realtime#event:ONLINE
31365 */
31366 ;
31367
31368 _proto.resume = function resume() {
31369 // 与 pause 一样,这个方法应该尽可能 loose
31370 var _internal3 = internal(this),
31371 connection = _internal3.connection;
31372
31373 if (!connection) return;
31374 if (connection.can('resume')) connection.resume();
31375 };
31376
31377 _proto._registerPending = function _registerPending(value) {
31378 internal(this).pendingClients.add(value);
31379 };
31380
31381 _proto._deregisterPending = function _deregisterPending(client) {
31382 internal(this).pendingClients["delete"](client);
31383 };
31384
31385 _proto._register = function _register(client) {
31386 internal(this).clients.add(client);
31387 };
31388
31389 _proto._deregister = function _deregister(client) {
31390 var _this = internal(this);
31391
31392 _this.clients["delete"](client);
31393
31394 if (_this.clients.size + _this.pendingClients.size === 0) {
31395 this._close();
31396 }
31397 };
31398
31399 _proto._dispatchCommand = function _dispatchCommand(command) {
31400 return applyDispatcher(this._plugins.beforeCommandDispatch, [command, this]).then(function (shouldDispatch) {
31401 // no plugin handled this command
31402 if (shouldDispatch) return debug$6('[WARN] Unexpected message received: %O', trim(command));
31403 return false;
31404 });
31405 };
31406
31407 return Realtime;
31408}(EventEmitter); // For test purpose only
31409
31410
31411var polyfilledPromise = _promise.default;
31412exports.EventEmitter = EventEmitter;
31413exports.Promise = polyfilledPromise;
31414exports.Protocals = message;
31415exports.Protocols = message;
31416exports.Realtime = Realtime;
31417exports.debug = debug$2;
31418exports.getAdapter = getAdapter;
31419exports.setAdapters = setAdapters;
31420/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74)))
31421
31422/***/ }),
31423/* 590 */
31424/***/ (function(module, exports, __webpack_require__) {
31425
31426module.exports = __webpack_require__(591);
31427
31428/***/ }),
31429/* 591 */
31430/***/ (function(module, exports, __webpack_require__) {
31431
31432var parent = __webpack_require__(592);
31433
31434module.exports = parent;
31435
31436
31437/***/ }),
31438/* 592 */
31439/***/ (function(module, exports, __webpack_require__) {
31440
31441__webpack_require__(593);
31442var path = __webpack_require__(5);
31443
31444module.exports = path.Object.freeze;
31445
31446
31447/***/ }),
31448/* 593 */
31449/***/ (function(module, exports, __webpack_require__) {
31450
31451var $ = __webpack_require__(0);
31452var FREEZING = __webpack_require__(262);
31453var fails = __webpack_require__(2);
31454var isObject = __webpack_require__(11);
31455var onFreeze = __webpack_require__(94).onFreeze;
31456
31457// eslint-disable-next-line es-x/no-object-freeze -- safe
31458var $freeze = Object.freeze;
31459var FAILS_ON_PRIMITIVES = fails(function () { $freeze(1); });
31460
31461// `Object.freeze` method
31462// https://tc39.es/ecma262/#sec-object.freeze
31463$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !FREEZING }, {
31464 freeze: function freeze(it) {
31465 return $freeze && isObject(it) ? $freeze(onFreeze(it)) : it;
31466 }
31467});
31468
31469
31470/***/ }),
31471/* 594 */
31472/***/ (function(module, exports, __webpack_require__) {
31473
31474module.exports = __webpack_require__(595);
31475
31476/***/ }),
31477/* 595 */
31478/***/ (function(module, exports, __webpack_require__) {
31479
31480var parent = __webpack_require__(596);
31481
31482module.exports = parent;
31483
31484
31485/***/ }),
31486/* 596 */
31487/***/ (function(module, exports, __webpack_require__) {
31488
31489__webpack_require__(597);
31490var path = __webpack_require__(5);
31491
31492module.exports = path.Object.getOwnPropertyDescriptors;
31493
31494
31495/***/ }),
31496/* 597 */
31497/***/ (function(module, exports, __webpack_require__) {
31498
31499var $ = __webpack_require__(0);
31500var DESCRIPTORS = __webpack_require__(14);
31501var ownKeys = __webpack_require__(162);
31502var toIndexedObject = __webpack_require__(32);
31503var getOwnPropertyDescriptorModule = __webpack_require__(62);
31504var createProperty = __webpack_require__(91);
31505
31506// `Object.getOwnPropertyDescriptors` method
31507// https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
31508$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
31509 getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
31510 var O = toIndexedObject(object);
31511 var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
31512 var keys = ownKeys(O);
31513 var result = {};
31514 var index = 0;
31515 var key, descriptor;
31516 while (keys.length > index) {
31517 descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
31518 if (descriptor !== undefined) createProperty(result, key, descriptor);
31519 }
31520 return result;
31521 }
31522});
31523
31524
31525/***/ }),
31526/* 598 */
31527/***/ (function(module, exports, __webpack_require__) {
31528
31529module.exports = __webpack_require__(599);
31530
31531/***/ }),
31532/* 599 */
31533/***/ (function(module, exports, __webpack_require__) {
31534
31535var parent = __webpack_require__(600);
31536
31537module.exports = parent;
31538
31539
31540/***/ }),
31541/* 600 */
31542/***/ (function(module, exports, __webpack_require__) {
31543
31544__webpack_require__(601);
31545var path = __webpack_require__(5);
31546
31547var Object = path.Object;
31548
31549var defineProperties = module.exports = function defineProperties(T, D) {
31550 return Object.defineProperties(T, D);
31551};
31552
31553if (Object.defineProperties.sham) defineProperties.sham = true;
31554
31555
31556/***/ }),
31557/* 601 */
31558/***/ (function(module, exports, __webpack_require__) {
31559
31560var $ = __webpack_require__(0);
31561var DESCRIPTORS = __webpack_require__(14);
31562var defineProperties = __webpack_require__(128).f;
31563
31564// `Object.defineProperties` method
31565// https://tc39.es/ecma262/#sec-object.defineproperties
31566// eslint-disable-next-line es-x/no-object-defineproperties -- safe
31567$({ target: 'Object', stat: true, forced: Object.defineProperties !== defineProperties, sham: !DESCRIPTORS }, {
31568 defineProperties: defineProperties
31569});
31570
31571
31572/***/ }),
31573/* 602 */
31574/***/ (function(module, exports, __webpack_require__) {
31575
31576module.exports = __webpack_require__(603);
31577
31578/***/ }),
31579/* 603 */
31580/***/ (function(module, exports, __webpack_require__) {
31581
31582var parent = __webpack_require__(604);
31583
31584module.exports = parent;
31585
31586
31587/***/ }),
31588/* 604 */
31589/***/ (function(module, exports, __webpack_require__) {
31590
31591var isPrototypeOf = __webpack_require__(19);
31592var method = __webpack_require__(605);
31593
31594var ArrayPrototype = Array.prototype;
31595
31596module.exports = function (it) {
31597 var own = it.reduce;
31598 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.reduce) ? method : own;
31599};
31600
31601
31602/***/ }),
31603/* 605 */
31604/***/ (function(module, exports, __webpack_require__) {
31605
31606__webpack_require__(606);
31607var entryVirtual = __webpack_require__(40);
31608
31609module.exports = entryVirtual('Array').reduce;
31610
31611
31612/***/ }),
31613/* 606 */
31614/***/ (function(module, exports, __webpack_require__) {
31615
31616"use strict";
31617
31618var $ = __webpack_require__(0);
31619var $reduce = __webpack_require__(607).left;
31620var arrayMethodIsStrict = __webpack_require__(231);
31621var CHROME_VERSION = __webpack_require__(77);
31622var IS_NODE = __webpack_require__(107);
31623
31624var STRICT_METHOD = arrayMethodIsStrict('reduce');
31625// Chrome 80-82 has a critical bug
31626// https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
31627var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
31628
31629// `Array.prototype.reduce` method
31630// https://tc39.es/ecma262/#sec-array.prototype.reduce
31631$({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
31632 reduce: function reduce(callbackfn /* , initialValue */) {
31633 var length = arguments.length;
31634 return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
31635 }
31636});
31637
31638
31639/***/ }),
31640/* 607 */
31641/***/ (function(module, exports, __webpack_require__) {
31642
31643var aCallable = __webpack_require__(31);
31644var toObject = __webpack_require__(34);
31645var IndexedObject = __webpack_require__(95);
31646var lengthOfArrayLike = __webpack_require__(41);
31647
31648var $TypeError = TypeError;
31649
31650// `Array.prototype.{ reduce, reduceRight }` methods implementation
31651var createMethod = function (IS_RIGHT) {
31652 return function (that, callbackfn, argumentsLength, memo) {
31653 aCallable(callbackfn);
31654 var O = toObject(that);
31655 var self = IndexedObject(O);
31656 var length = lengthOfArrayLike(O);
31657 var index = IS_RIGHT ? length - 1 : 0;
31658 var i = IS_RIGHT ? -1 : 1;
31659 if (argumentsLength < 2) while (true) {
31660 if (index in self) {
31661 memo = self[index];
31662 index += i;
31663 break;
31664 }
31665 index += i;
31666 if (IS_RIGHT ? index < 0 : length <= index) {
31667 throw $TypeError('Reduce of empty array with no initial value');
31668 }
31669 }
31670 for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
31671 memo = callbackfn(memo, self[index], index, O);
31672 }
31673 return memo;
31674 };
31675};
31676
31677module.exports = {
31678 // `Array.prototype.reduce` method
31679 // https://tc39.es/ecma262/#sec-array.prototype.reduce
31680 left: createMethod(false),
31681 // `Array.prototype.reduceRight` method
31682 // https://tc39.es/ecma262/#sec-array.prototype.reduceright
31683 right: createMethod(true)
31684};
31685
31686
31687/***/ }),
31688/* 608 */
31689/***/ (function(module, exports, __webpack_require__) {
31690
31691var parent = __webpack_require__(609);
31692__webpack_require__(39);
31693
31694module.exports = parent;
31695
31696
31697/***/ }),
31698/* 609 */
31699/***/ (function(module, exports, __webpack_require__) {
31700
31701__webpack_require__(38);
31702__webpack_require__(53);
31703__webpack_require__(610);
31704__webpack_require__(55);
31705var path = __webpack_require__(5);
31706
31707module.exports = path.Set;
31708
31709
31710/***/ }),
31711/* 610 */
31712/***/ (function(module, exports, __webpack_require__) {
31713
31714// TODO: Remove this module from `core-js@4` since it's replaced to module below
31715__webpack_require__(611);
31716
31717
31718/***/ }),
31719/* 611 */
31720/***/ (function(module, exports, __webpack_require__) {
31721
31722"use strict";
31723
31724var collection = __webpack_require__(155);
31725var collectionStrong = __webpack_require__(263);
31726
31727// `Set` constructor
31728// https://tc39.es/ecma262/#sec-set-objects
31729collection('Set', function (init) {
31730 return function Set() { return init(this, arguments.length ? arguments[0] : undefined); };
31731}, collectionStrong);
31732
31733
31734/***/ }),
31735/* 612 */
31736/***/ (function(module, exports, __webpack_require__) {
31737
31738var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
31739 Copyright 2013 Daniel Wirtz <dcode@dcode.io>
31740
31741 Licensed under the Apache License, Version 2.0 (the "License");
31742 you may not use this file except in compliance with the License.
31743 You may obtain a copy of the License at
31744
31745 http://www.apache.org/licenses/LICENSE-2.0
31746
31747 Unless required by applicable law or agreed to in writing, software
31748 distributed under the License is distributed on an "AS IS" BASIS,
31749 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31750 See the License for the specific language governing permissions and
31751 limitations under the License.
31752 */
31753
31754/**
31755 * @license protobuf.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
31756 * Released under the Apache License, Version 2.0
31757 * see: https://github.com/dcodeIO/protobuf.js for details
31758 */
31759(function(global, factory) {
31760
31761 /* AMD */ if (true)
31762 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(613)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
31763 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
31764 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
31765 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
31766 /* CommonJS */ else if (typeof require === "function" && typeof module === "object" && module && module["exports"])
31767 module["exports"] = factory(require("bytebuffer"), true);
31768 /* Global */ else
31769 (global["dcodeIO"] = global["dcodeIO"] || {})["ProtoBuf"] = factory(global["dcodeIO"]["ByteBuffer"]);
31770
31771})(this, function(ByteBuffer, isCommonJS) {
31772 "use strict";
31773
31774 /**
31775 * The ProtoBuf namespace.
31776 * @exports ProtoBuf
31777 * @namespace
31778 * @expose
31779 */
31780 var ProtoBuf = {};
31781
31782 /**
31783 * @type {!function(new: ByteBuffer, ...[*])}
31784 * @expose
31785 */
31786 ProtoBuf.ByteBuffer = ByteBuffer;
31787
31788 /**
31789 * @type {?function(new: Long, ...[*])}
31790 * @expose
31791 */
31792 ProtoBuf.Long = ByteBuffer.Long || null;
31793
31794 /**
31795 * ProtoBuf.js version.
31796 * @type {string}
31797 * @const
31798 * @expose
31799 */
31800 ProtoBuf.VERSION = "5.0.3";
31801
31802 /**
31803 * Wire types.
31804 * @type {Object.<string,number>}
31805 * @const
31806 * @expose
31807 */
31808 ProtoBuf.WIRE_TYPES = {};
31809
31810 /**
31811 * Varint wire type.
31812 * @type {number}
31813 * @expose
31814 */
31815 ProtoBuf.WIRE_TYPES.VARINT = 0;
31816
31817 /**
31818 * Fixed 64 bits wire type.
31819 * @type {number}
31820 * @const
31821 * @expose
31822 */
31823 ProtoBuf.WIRE_TYPES.BITS64 = 1;
31824
31825 /**
31826 * Length delimited wire type.
31827 * @type {number}
31828 * @const
31829 * @expose
31830 */
31831 ProtoBuf.WIRE_TYPES.LDELIM = 2;
31832
31833 /**
31834 * Start group wire type.
31835 * @type {number}
31836 * @const
31837 * @expose
31838 */
31839 ProtoBuf.WIRE_TYPES.STARTGROUP = 3;
31840
31841 /**
31842 * End group wire type.
31843 * @type {number}
31844 * @const
31845 * @expose
31846 */
31847 ProtoBuf.WIRE_TYPES.ENDGROUP = 4;
31848
31849 /**
31850 * Fixed 32 bits wire type.
31851 * @type {number}
31852 * @const
31853 * @expose
31854 */
31855 ProtoBuf.WIRE_TYPES.BITS32 = 5;
31856
31857 /**
31858 * Packable wire types.
31859 * @type {!Array.<number>}
31860 * @const
31861 * @expose
31862 */
31863 ProtoBuf.PACKABLE_WIRE_TYPES = [
31864 ProtoBuf.WIRE_TYPES.VARINT,
31865 ProtoBuf.WIRE_TYPES.BITS64,
31866 ProtoBuf.WIRE_TYPES.BITS32
31867 ];
31868
31869 /**
31870 * Types.
31871 * @dict
31872 * @type {!Object.<string,{name: string, wireType: number, defaultValue: *}>}
31873 * @const
31874 * @expose
31875 */
31876 ProtoBuf.TYPES = {
31877 // According to the protobuf spec.
31878 "int32": {
31879 name: "int32",
31880 wireType: ProtoBuf.WIRE_TYPES.VARINT,
31881 defaultValue: 0
31882 },
31883 "uint32": {
31884 name: "uint32",
31885 wireType: ProtoBuf.WIRE_TYPES.VARINT,
31886 defaultValue: 0
31887 },
31888 "sint32": {
31889 name: "sint32",
31890 wireType: ProtoBuf.WIRE_TYPES.VARINT,
31891 defaultValue: 0
31892 },
31893 "int64": {
31894 name: "int64",
31895 wireType: ProtoBuf.WIRE_TYPES.VARINT,
31896 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
31897 },
31898 "uint64": {
31899 name: "uint64",
31900 wireType: ProtoBuf.WIRE_TYPES.VARINT,
31901 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
31902 },
31903 "sint64": {
31904 name: "sint64",
31905 wireType: ProtoBuf.WIRE_TYPES.VARINT,
31906 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
31907 },
31908 "bool": {
31909 name: "bool",
31910 wireType: ProtoBuf.WIRE_TYPES.VARINT,
31911 defaultValue: false
31912 },
31913 "double": {
31914 name: "double",
31915 wireType: ProtoBuf.WIRE_TYPES.BITS64,
31916 defaultValue: 0
31917 },
31918 "string": {
31919 name: "string",
31920 wireType: ProtoBuf.WIRE_TYPES.LDELIM,
31921 defaultValue: ""
31922 },
31923 "bytes": {
31924 name: "bytes",
31925 wireType: ProtoBuf.WIRE_TYPES.LDELIM,
31926 defaultValue: null // overridden in the code, must be a unique instance
31927 },
31928 "fixed32": {
31929 name: "fixed32",
31930 wireType: ProtoBuf.WIRE_TYPES.BITS32,
31931 defaultValue: 0
31932 },
31933 "sfixed32": {
31934 name: "sfixed32",
31935 wireType: ProtoBuf.WIRE_TYPES.BITS32,
31936 defaultValue: 0
31937 },
31938 "fixed64": {
31939 name: "fixed64",
31940 wireType: ProtoBuf.WIRE_TYPES.BITS64,
31941 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
31942 },
31943 "sfixed64": {
31944 name: "sfixed64",
31945 wireType: ProtoBuf.WIRE_TYPES.BITS64,
31946 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
31947 },
31948 "float": {
31949 name: "float",
31950 wireType: ProtoBuf.WIRE_TYPES.BITS32,
31951 defaultValue: 0
31952 },
31953 "enum": {
31954 name: "enum",
31955 wireType: ProtoBuf.WIRE_TYPES.VARINT,
31956 defaultValue: 0
31957 },
31958 "message": {
31959 name: "message",
31960 wireType: ProtoBuf.WIRE_TYPES.LDELIM,
31961 defaultValue: null
31962 },
31963 "group": {
31964 name: "group",
31965 wireType: ProtoBuf.WIRE_TYPES.STARTGROUP,
31966 defaultValue: null
31967 }
31968 };
31969
31970 /**
31971 * Valid map key types.
31972 * @type {!Array.<!Object.<string,{name: string, wireType: number, defaultValue: *}>>}
31973 * @const
31974 * @expose
31975 */
31976 ProtoBuf.MAP_KEY_TYPES = [
31977 ProtoBuf.TYPES["int32"],
31978 ProtoBuf.TYPES["sint32"],
31979 ProtoBuf.TYPES["sfixed32"],
31980 ProtoBuf.TYPES["uint32"],
31981 ProtoBuf.TYPES["fixed32"],
31982 ProtoBuf.TYPES["int64"],
31983 ProtoBuf.TYPES["sint64"],
31984 ProtoBuf.TYPES["sfixed64"],
31985 ProtoBuf.TYPES["uint64"],
31986 ProtoBuf.TYPES["fixed64"],
31987 ProtoBuf.TYPES["bool"],
31988 ProtoBuf.TYPES["string"],
31989 ProtoBuf.TYPES["bytes"]
31990 ];
31991
31992 /**
31993 * Minimum field id.
31994 * @type {number}
31995 * @const
31996 * @expose
31997 */
31998 ProtoBuf.ID_MIN = 1;
31999
32000 /**
32001 * Maximum field id.
32002 * @type {number}
32003 * @const
32004 * @expose
32005 */
32006 ProtoBuf.ID_MAX = 0x1FFFFFFF;
32007
32008 /**
32009 * If set to `true`, field names will be converted from underscore notation to camel case. Defaults to `false`.
32010 * Must be set prior to parsing.
32011 * @type {boolean}
32012 * @expose
32013 */
32014 ProtoBuf.convertFieldsToCamelCase = false;
32015
32016 /**
32017 * By default, messages are populated with (setX, set_x) accessors for each field. This can be disabled by
32018 * setting this to `false` prior to building messages.
32019 * @type {boolean}
32020 * @expose
32021 */
32022 ProtoBuf.populateAccessors = true;
32023
32024 /**
32025 * By default, messages are populated with default values if a field is not present on the wire. To disable
32026 * this behavior, set this setting to `false`.
32027 * @type {boolean}
32028 * @expose
32029 */
32030 ProtoBuf.populateDefaults = true;
32031
32032 /**
32033 * @alias ProtoBuf.Util
32034 * @expose
32035 */
32036 ProtoBuf.Util = (function() {
32037 "use strict";
32038
32039 /**
32040 * ProtoBuf utilities.
32041 * @exports ProtoBuf.Util
32042 * @namespace
32043 */
32044 var Util = {};
32045
32046 /**
32047 * Flag if running in node or not.
32048 * @type {boolean}
32049 * @const
32050 * @expose
32051 */
32052 Util.IS_NODE = !!(
32053 typeof process === 'object' && process+'' === '[object process]' && !process['browser']
32054 );
32055
32056 /**
32057 * Constructs a XMLHttpRequest object.
32058 * @return {XMLHttpRequest}
32059 * @throws {Error} If XMLHttpRequest is not supported
32060 * @expose
32061 */
32062 Util.XHR = function() {
32063 // No dependencies please, ref: http://www.quirksmode.org/js/xmlhttp.html
32064 var XMLHttpFactories = [
32065 function () {return new XMLHttpRequest()},
32066 function () {return new ActiveXObject("Msxml2.XMLHTTP")},
32067 function () {return new ActiveXObject("Msxml3.XMLHTTP")},
32068 function () {return new ActiveXObject("Microsoft.XMLHTTP")}
32069 ];
32070 /** @type {?XMLHttpRequest} */
32071 var xhr = null;
32072 for (var i=0;i<XMLHttpFactories.length;i++) {
32073 try { xhr = XMLHttpFactories[i](); }
32074 catch (e) { continue; }
32075 break;
32076 }
32077 if (!xhr)
32078 throw Error("XMLHttpRequest is not supported");
32079 return xhr;
32080 };
32081
32082 /**
32083 * Fetches a resource.
32084 * @param {string} path Resource path
32085 * @param {function(?string)=} callback Callback receiving the resource's contents. If omitted the resource will
32086 * be fetched synchronously. If the request failed, contents will be null.
32087 * @return {?string|undefined} Resource contents if callback is omitted (null if the request failed), else undefined.
32088 * @expose
32089 */
32090 Util.fetch = function(path, callback) {
32091 if (callback && typeof callback != 'function')
32092 callback = null;
32093 if (Util.IS_NODE) {
32094 var fs = __webpack_require__(615);
32095 if (callback) {
32096 fs.readFile(path, function(err, data) {
32097 if (err)
32098 callback(null);
32099 else
32100 callback(""+data);
32101 });
32102 } else
32103 try {
32104 return fs.readFileSync(path);
32105 } catch (e) {
32106 return null;
32107 }
32108 } else {
32109 var xhr = Util.XHR();
32110 xhr.open('GET', path, callback ? true : false);
32111 // xhr.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
32112 xhr.setRequestHeader('Accept', 'text/plain');
32113 if (typeof xhr.overrideMimeType === 'function') xhr.overrideMimeType('text/plain');
32114 if (callback) {
32115 xhr.onreadystatechange = function() {
32116 if (xhr.readyState != 4) return;
32117 if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
32118 callback(xhr.responseText);
32119 else
32120 callback(null);
32121 };
32122 if (xhr.readyState == 4)
32123 return;
32124 xhr.send(null);
32125 } else {
32126 xhr.send(null);
32127 if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
32128 return xhr.responseText;
32129 return null;
32130 }
32131 }
32132 };
32133
32134 /**
32135 * Converts a string to camel case.
32136 * @param {string} str
32137 * @returns {string}
32138 * @expose
32139 */
32140 Util.toCamelCase = function(str) {
32141 return str.replace(/_([a-zA-Z])/g, function ($0, $1) {
32142 return $1.toUpperCase();
32143 });
32144 };
32145
32146 return Util;
32147 })();
32148
32149 /**
32150 * Language expressions.
32151 * @type {!Object.<string,!RegExp>}
32152 * @expose
32153 */
32154 ProtoBuf.Lang = {
32155
32156 // Characters always ending a statement
32157 DELIM: /[\s\{\}=;:\[\],'"\(\)<>]/g,
32158
32159 // Field rules
32160 RULE: /^(?:required|optional|repeated|map)$/,
32161
32162 // Field types
32163 TYPE: /^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,
32164
32165 // Names
32166 NAME: /^[a-zA-Z_][a-zA-Z_0-9]*$/,
32167
32168 // Type definitions
32169 TYPEDEF: /^[a-zA-Z][a-zA-Z_0-9]*$/,
32170
32171 // Type references
32172 TYPEREF: /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,
32173
32174 // Fully qualified type references
32175 FQTYPEREF: /^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/,
32176
32177 // All numbers
32178 NUMBER: /^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,
32179
32180 // Decimal numbers
32181 NUMBER_DEC: /^(?:[1-9][0-9]*|0)$/,
32182
32183 // Hexadecimal numbers
32184 NUMBER_HEX: /^0[xX][0-9a-fA-F]+$/,
32185
32186 // Octal numbers
32187 NUMBER_OCT: /^0[0-7]+$/,
32188
32189 // Floating point numbers
32190 NUMBER_FLT: /^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,
32191
32192 // Booleans
32193 BOOL: /^(?:true|false)$/i,
32194
32195 // Id numbers
32196 ID: /^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
32197
32198 // Negative id numbers (enum values)
32199 NEGID: /^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
32200
32201 // Whitespaces
32202 WHITESPACE: /\s/,
32203
32204 // All strings
32205 STRING: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,
32206
32207 // Double quoted strings
32208 STRING_DQ: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,
32209
32210 // Single quoted strings
32211 STRING_SQ: /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g
32212 };
32213
32214
32215 /**
32216 * @alias ProtoBuf.Reflect
32217 * @expose
32218 */
32219 ProtoBuf.Reflect = (function(ProtoBuf) {
32220 "use strict";
32221
32222 /**
32223 * Reflection types.
32224 * @exports ProtoBuf.Reflect
32225 * @namespace
32226 */
32227 var Reflect = {};
32228
32229 /**
32230 * Constructs a Reflect base class.
32231 * @exports ProtoBuf.Reflect.T
32232 * @constructor
32233 * @abstract
32234 * @param {!ProtoBuf.Builder} builder Builder reference
32235 * @param {?ProtoBuf.Reflect.T} parent Parent object
32236 * @param {string} name Object name
32237 */
32238 var T = function(builder, parent, name) {
32239
32240 /**
32241 * Builder reference.
32242 * @type {!ProtoBuf.Builder}
32243 * @expose
32244 */
32245 this.builder = builder;
32246
32247 /**
32248 * Parent object.
32249 * @type {?ProtoBuf.Reflect.T}
32250 * @expose
32251 */
32252 this.parent = parent;
32253
32254 /**
32255 * Object name in namespace.
32256 * @type {string}
32257 * @expose
32258 */
32259 this.name = name;
32260
32261 /**
32262 * Fully qualified class name
32263 * @type {string}
32264 * @expose
32265 */
32266 this.className;
32267 };
32268
32269 /**
32270 * @alias ProtoBuf.Reflect.T.prototype
32271 * @inner
32272 */
32273 var TPrototype = T.prototype;
32274
32275 /**
32276 * Returns the fully qualified name of this object.
32277 * @returns {string} Fully qualified name as of ".PATH.TO.THIS"
32278 * @expose
32279 */
32280 TPrototype.fqn = function() {
32281 var name = this.name,
32282 ptr = this;
32283 do {
32284 ptr = ptr.parent;
32285 if (ptr == null)
32286 break;
32287 name = ptr.name+"."+name;
32288 } while (true);
32289 return name;
32290 };
32291
32292 /**
32293 * Returns a string representation of this Reflect object (its fully qualified name).
32294 * @param {boolean=} includeClass Set to true to include the class name. Defaults to false.
32295 * @return String representation
32296 * @expose
32297 */
32298 TPrototype.toString = function(includeClass) {
32299 return (includeClass ? this.className + " " : "") + this.fqn();
32300 };
32301
32302 /**
32303 * Builds this type.
32304 * @throws {Error} If this type cannot be built directly
32305 * @expose
32306 */
32307 TPrototype.build = function() {
32308 throw Error(this.toString(true)+" cannot be built directly");
32309 };
32310
32311 /**
32312 * @alias ProtoBuf.Reflect.T
32313 * @expose
32314 */
32315 Reflect.T = T;
32316
32317 /**
32318 * Constructs a new Namespace.
32319 * @exports ProtoBuf.Reflect.Namespace
32320 * @param {!ProtoBuf.Builder} builder Builder reference
32321 * @param {?ProtoBuf.Reflect.Namespace} parent Namespace parent
32322 * @param {string} name Namespace name
32323 * @param {Object.<string,*>=} options Namespace options
32324 * @param {string?} syntax The syntax level of this definition (e.g., proto3)
32325 * @constructor
32326 * @extends ProtoBuf.Reflect.T
32327 */
32328 var Namespace = function(builder, parent, name, options, syntax) {
32329 T.call(this, builder, parent, name);
32330
32331 /**
32332 * @override
32333 */
32334 this.className = "Namespace";
32335
32336 /**
32337 * Children inside the namespace.
32338 * @type {!Array.<ProtoBuf.Reflect.T>}
32339 */
32340 this.children = [];
32341
32342 /**
32343 * Options.
32344 * @type {!Object.<string, *>}
32345 */
32346 this.options = options || {};
32347
32348 /**
32349 * Syntax level (e.g., proto2 or proto3).
32350 * @type {!string}
32351 */
32352 this.syntax = syntax || "proto2";
32353 };
32354
32355 /**
32356 * @alias ProtoBuf.Reflect.Namespace.prototype
32357 * @inner
32358 */
32359 var NamespacePrototype = Namespace.prototype = Object.create(T.prototype);
32360
32361 /**
32362 * Returns an array of the namespace's children.
32363 * @param {ProtoBuf.Reflect.T=} type Filter type (returns instances of this type only). Defaults to null (all children).
32364 * @return {Array.<ProtoBuf.Reflect.T>}
32365 * @expose
32366 */
32367 NamespacePrototype.getChildren = function(type) {
32368 type = type || null;
32369 if (type == null)
32370 return this.children.slice();
32371 var children = [];
32372 for (var i=0, k=this.children.length; i<k; ++i)
32373 if (this.children[i] instanceof type)
32374 children.push(this.children[i]);
32375 return children;
32376 };
32377
32378 /**
32379 * Adds a child to the namespace.
32380 * @param {ProtoBuf.Reflect.T} child Child
32381 * @throws {Error} If the child cannot be added (duplicate)
32382 * @expose
32383 */
32384 NamespacePrototype.addChild = function(child) {
32385 var other;
32386 if (other = this.getChild(child.name)) {
32387 // Try to revert camelcase transformation on collision
32388 if (other instanceof Message.Field && other.name !== other.originalName && this.getChild(other.originalName) === null)
32389 other.name = other.originalName; // Revert previous first (effectively keeps both originals)
32390 else if (child instanceof Message.Field && child.name !== child.originalName && this.getChild(child.originalName) === null)
32391 child.name = child.originalName;
32392 else
32393 throw Error("Duplicate name in namespace "+this.toString(true)+": "+child.name);
32394 }
32395 this.children.push(child);
32396 };
32397
32398 /**
32399 * Gets a child by its name or id.
32400 * @param {string|number} nameOrId Child name or id
32401 * @return {?ProtoBuf.Reflect.T} The child or null if not found
32402 * @expose
32403 */
32404 NamespacePrototype.getChild = function(nameOrId) {
32405 var key = typeof nameOrId === 'number' ? 'id' : 'name';
32406 for (var i=0, k=this.children.length; i<k; ++i)
32407 if (this.children[i][key] === nameOrId)
32408 return this.children[i];
32409 return null;
32410 };
32411
32412 /**
32413 * Resolves a reflect object inside of this namespace.
32414 * @param {string|!Array.<string>} qn Qualified name to resolve
32415 * @param {boolean=} excludeNonNamespace Excludes non-namespace types, defaults to `false`
32416 * @return {?ProtoBuf.Reflect.Namespace} The resolved type or null if not found
32417 * @expose
32418 */
32419 NamespacePrototype.resolve = function(qn, excludeNonNamespace) {
32420 var part = typeof qn === 'string' ? qn.split(".") : qn,
32421 ptr = this,
32422 i = 0;
32423 if (part[i] === "") { // Fully qualified name, e.g. ".My.Message'
32424 while (ptr.parent !== null)
32425 ptr = ptr.parent;
32426 i++;
32427 }
32428 var child;
32429 do {
32430 do {
32431 if (!(ptr instanceof Reflect.Namespace)) {
32432 ptr = null;
32433 break;
32434 }
32435 child = ptr.getChild(part[i]);
32436 if (!child || !(child instanceof Reflect.T) || (excludeNonNamespace && !(child instanceof Reflect.Namespace))) {
32437 ptr = null;
32438 break;
32439 }
32440 ptr = child; i++;
32441 } while (i < part.length);
32442 if (ptr != null)
32443 break; // Found
32444 // Else search the parent
32445 if (this.parent !== null)
32446 return this.parent.resolve(qn, excludeNonNamespace);
32447 } while (ptr != null);
32448 return ptr;
32449 };
32450
32451 /**
32452 * Determines the shortest qualified name of the specified type, if any, relative to this namespace.
32453 * @param {!ProtoBuf.Reflect.T} t Reflection type
32454 * @returns {string} The shortest qualified name or, if there is none, the fqn
32455 * @expose
32456 */
32457 NamespacePrototype.qn = function(t) {
32458 var part = [], ptr = t;
32459 do {
32460 part.unshift(ptr.name);
32461 ptr = ptr.parent;
32462 } while (ptr !== null);
32463 for (var len=1; len <= part.length; len++) {
32464 var qn = part.slice(part.length-len);
32465 if (t === this.resolve(qn, t instanceof Reflect.Namespace))
32466 return qn.join(".");
32467 }
32468 return t.fqn();
32469 };
32470
32471 /**
32472 * Builds the namespace and returns the runtime counterpart.
32473 * @return {Object.<string,Function|Object>} Runtime namespace
32474 * @expose
32475 */
32476 NamespacePrototype.build = function() {
32477 /** @dict */
32478 var ns = {};
32479 var children = this.children;
32480 for (var i=0, k=children.length, child; i<k; ++i) {
32481 child = children[i];
32482 if (child instanceof Namespace)
32483 ns[child.name] = child.build();
32484 }
32485 if (Object.defineProperty)
32486 Object.defineProperty(ns, "$options", { "value": this.buildOpt() });
32487 return ns;
32488 };
32489
32490 /**
32491 * Builds the namespace's '$options' property.
32492 * @return {Object.<string,*>}
32493 */
32494 NamespacePrototype.buildOpt = function() {
32495 var opt = {},
32496 keys = Object.keys(this.options);
32497 for (var i=0, k=keys.length; i<k; ++i) {
32498 var key = keys[i],
32499 val = this.options[keys[i]];
32500 // TODO: Options are not resolved, yet.
32501 // if (val instanceof Namespace) {
32502 // opt[key] = val.build();
32503 // } else {
32504 opt[key] = val;
32505 // }
32506 }
32507 return opt;
32508 };
32509
32510 /**
32511 * Gets the value assigned to the option with the specified name.
32512 * @param {string=} name Returns the option value if specified, otherwise all options are returned.
32513 * @return {*|Object.<string,*>}null} Option value or NULL if there is no such option
32514 */
32515 NamespacePrototype.getOption = function(name) {
32516 if (typeof name === 'undefined')
32517 return this.options;
32518 return typeof this.options[name] !== 'undefined' ? this.options[name] : null;
32519 };
32520
32521 /**
32522 * @alias ProtoBuf.Reflect.Namespace
32523 * @expose
32524 */
32525 Reflect.Namespace = Namespace;
32526
32527 /**
32528 * Constructs a new Element implementation that checks and converts values for a
32529 * particular field type, as appropriate.
32530 *
32531 * An Element represents a single value: either the value of a singular field,
32532 * or a value contained in one entry of a repeated field or map field. This
32533 * class does not implement these higher-level concepts; it only encapsulates
32534 * the low-level typechecking and conversion.
32535 *
32536 * @exports ProtoBuf.Reflect.Element
32537 * @param {{name: string, wireType: number}} type Resolved data type
32538 * @param {ProtoBuf.Reflect.T|null} resolvedType Resolved type, if relevant
32539 * (e.g. submessage field).
32540 * @param {boolean} isMapKey Is this element a Map key? The value will be
32541 * converted to string form if so.
32542 * @param {string} syntax Syntax level of defining message type, e.g.,
32543 * proto2 or proto3.
32544 * @param {string} name Name of the field containing this element (for error
32545 * messages)
32546 * @constructor
32547 */
32548 var Element = function(type, resolvedType, isMapKey, syntax, name) {
32549
32550 /**
32551 * Element type, as a string (e.g., int32).
32552 * @type {{name: string, wireType: number}}
32553 */
32554 this.type = type;
32555
32556 /**
32557 * Element type reference to submessage or enum definition, if needed.
32558 * @type {ProtoBuf.Reflect.T|null}
32559 */
32560 this.resolvedType = resolvedType;
32561
32562 /**
32563 * Element is a map key.
32564 * @type {boolean}
32565 */
32566 this.isMapKey = isMapKey;
32567
32568 /**
32569 * Syntax level of defining message type, e.g., proto2 or proto3.
32570 * @type {string}
32571 */
32572 this.syntax = syntax;
32573
32574 /**
32575 * Name of the field containing this element (for error messages)
32576 * @type {string}
32577 */
32578 this.name = name;
32579
32580 if (isMapKey && ProtoBuf.MAP_KEY_TYPES.indexOf(type) < 0)
32581 throw Error("Invalid map key type: " + type.name);
32582 };
32583
32584 var ElementPrototype = Element.prototype;
32585
32586 /**
32587 * Obtains a (new) default value for the specified type.
32588 * @param type {string|{name: string, wireType: number}} Field type
32589 * @returns {*} Default value
32590 * @inner
32591 */
32592 function mkDefault(type) {
32593 if (typeof type === 'string')
32594 type = ProtoBuf.TYPES[type];
32595 if (typeof type.defaultValue === 'undefined')
32596 throw Error("default value for type "+type.name+" is not supported");
32597 if (type == ProtoBuf.TYPES["bytes"])
32598 return new ByteBuffer(0);
32599 return type.defaultValue;
32600 }
32601
32602 /**
32603 * Returns the default value for this field in proto3.
32604 * @function
32605 * @param type {string|{name: string, wireType: number}} the field type
32606 * @returns {*} Default value
32607 */
32608 Element.defaultFieldValue = mkDefault;
32609
32610 /**
32611 * Makes a Long from a value.
32612 * @param {{low: number, high: number, unsigned: boolean}|string|number} value Value
32613 * @param {boolean=} unsigned Whether unsigned or not, defaults to reuse it from Long-like objects or to signed for
32614 * strings and numbers
32615 * @returns {!Long}
32616 * @throws {Error} If the value cannot be converted to a Long
32617 * @inner
32618 */
32619 function mkLong(value, unsigned) {
32620 if (value && typeof value.low === 'number' && typeof value.high === 'number' && typeof value.unsigned === 'boolean'
32621 && value.low === value.low && value.high === value.high)
32622 return new ProtoBuf.Long(value.low, value.high, typeof unsigned === 'undefined' ? value.unsigned : unsigned);
32623 if (typeof value === 'string')
32624 return ProtoBuf.Long.fromString(value, unsigned || false, 10);
32625 if (typeof value === 'number')
32626 return ProtoBuf.Long.fromNumber(value, unsigned || false);
32627 throw Error("not convertible to Long");
32628 }
32629
32630 ElementPrototype.toString = function() {
32631 return (this.name || '') + (this.isMapKey ? 'map' : 'value') + ' element';
32632 }
32633
32634 /**
32635 * Checks if the given value can be set for an element of this type (singular
32636 * field or one element of a repeated field or map).
32637 * @param {*} value Value to check
32638 * @return {*} Verified, maybe adjusted, value
32639 * @throws {Error} If the value cannot be verified for this element slot
32640 * @expose
32641 */
32642 ElementPrototype.verifyValue = function(value) {
32643 var self = this;
32644 function fail(val, msg) {
32645 throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
32646 }
32647 switch (this.type) {
32648 // Signed 32bit
32649 case ProtoBuf.TYPES["int32"]:
32650 case ProtoBuf.TYPES["sint32"]:
32651 case ProtoBuf.TYPES["sfixed32"]:
32652 // Account for !NaN: value === value
32653 if (typeof value !== 'number' || (value === value && value % 1 !== 0))
32654 fail(typeof value, "not an integer");
32655 return value > 4294967295 ? value | 0 : value;
32656
32657 // Unsigned 32bit
32658 case ProtoBuf.TYPES["uint32"]:
32659 case ProtoBuf.TYPES["fixed32"]:
32660 if (typeof value !== 'number' || (value === value && value % 1 !== 0))
32661 fail(typeof value, "not an integer");
32662 return value < 0 ? value >>> 0 : value;
32663
32664 // Signed 64bit
32665 case ProtoBuf.TYPES["int64"]:
32666 case ProtoBuf.TYPES["sint64"]:
32667 case ProtoBuf.TYPES["sfixed64"]: {
32668 if (ProtoBuf.Long)
32669 try {
32670 return mkLong(value, false);
32671 } catch (e) {
32672 fail(typeof value, e.message);
32673 }
32674 else
32675 fail(typeof value, "requires Long.js");
32676 }
32677
32678 // Unsigned 64bit
32679 case ProtoBuf.TYPES["uint64"]:
32680 case ProtoBuf.TYPES["fixed64"]: {
32681 if (ProtoBuf.Long)
32682 try {
32683 return mkLong(value, true);
32684 } catch (e) {
32685 fail(typeof value, e.message);
32686 }
32687 else
32688 fail(typeof value, "requires Long.js");
32689 }
32690
32691 // Bool
32692 case ProtoBuf.TYPES["bool"]:
32693 if (typeof value !== 'boolean')
32694 fail(typeof value, "not a boolean");
32695 return value;
32696
32697 // Float
32698 case ProtoBuf.TYPES["float"]:
32699 case ProtoBuf.TYPES["double"]:
32700 if (typeof value !== 'number')
32701 fail(typeof value, "not a number");
32702 return value;
32703
32704 // Length-delimited string
32705 case ProtoBuf.TYPES["string"]:
32706 if (typeof value !== 'string' && !(value && value instanceof String))
32707 fail(typeof value, "not a string");
32708 return ""+value; // Convert String object to string
32709
32710 // Length-delimited bytes
32711 case ProtoBuf.TYPES["bytes"]:
32712 if (ByteBuffer.isByteBuffer(value))
32713 return value;
32714 return ByteBuffer.wrap(value, "base64");
32715
32716 // Constant enum value
32717 case ProtoBuf.TYPES["enum"]: {
32718 var values = this.resolvedType.getChildren(ProtoBuf.Reflect.Enum.Value);
32719 for (i=0; i<values.length; i++)
32720 if (values[i].name == value)
32721 return values[i].id;
32722 else if (values[i].id == value)
32723 return values[i].id;
32724
32725 if (this.syntax === 'proto3') {
32726 // proto3: just make sure it's an integer.
32727 if (typeof value !== 'number' || (value === value && value % 1 !== 0))
32728 fail(typeof value, "not an integer");
32729 if (value > 4294967295 || value < 0)
32730 fail(typeof value, "not in range for uint32")
32731 return value;
32732 } else {
32733 // proto2 requires enum values to be valid.
32734 fail(value, "not a valid enum value");
32735 }
32736 }
32737 // Embedded message
32738 case ProtoBuf.TYPES["group"]:
32739 case ProtoBuf.TYPES["message"]: {
32740 if (!value || typeof value !== 'object')
32741 fail(typeof value, "object expected");
32742 if (value instanceof this.resolvedType.clazz)
32743 return value;
32744 if (value instanceof ProtoBuf.Builder.Message) {
32745 // Mismatched type: Convert to object (see: https://github.com/dcodeIO/ProtoBuf.js/issues/180)
32746 var obj = {};
32747 for (var i in value)
32748 if (value.hasOwnProperty(i))
32749 obj[i] = value[i];
32750 value = obj;
32751 }
32752 // Else let's try to construct one from a key-value object
32753 return new (this.resolvedType.clazz)(value); // May throw for a hundred of reasons
32754 }
32755 }
32756
32757 // We should never end here
32758 throw Error("[INTERNAL] Illegal value for "+this.toString(true)+": "+value+" (undefined type "+this.type+")");
32759 };
32760
32761 /**
32762 * Calculates the byte length of an element on the wire.
32763 * @param {number} id Field number
32764 * @param {*} value Field value
32765 * @returns {number} Byte length
32766 * @throws {Error} If the value cannot be calculated
32767 * @expose
32768 */
32769 ElementPrototype.calculateLength = function(id, value) {
32770 if (value === null) return 0; // Nothing to encode
32771 // Tag has already been written
32772 var n;
32773 switch (this.type) {
32774 case ProtoBuf.TYPES["int32"]:
32775 return value < 0 ? ByteBuffer.calculateVarint64(value) : ByteBuffer.calculateVarint32(value);
32776 case ProtoBuf.TYPES["uint32"]:
32777 return ByteBuffer.calculateVarint32(value);
32778 case ProtoBuf.TYPES["sint32"]:
32779 return ByteBuffer.calculateVarint32(ByteBuffer.zigZagEncode32(value));
32780 case ProtoBuf.TYPES["fixed32"]:
32781 case ProtoBuf.TYPES["sfixed32"]:
32782 case ProtoBuf.TYPES["float"]:
32783 return 4;
32784 case ProtoBuf.TYPES["int64"]:
32785 case ProtoBuf.TYPES["uint64"]:
32786 return ByteBuffer.calculateVarint64(value);
32787 case ProtoBuf.TYPES["sint64"]:
32788 return ByteBuffer.calculateVarint64(ByteBuffer.zigZagEncode64(value));
32789 case ProtoBuf.TYPES["fixed64"]:
32790 case ProtoBuf.TYPES["sfixed64"]:
32791 return 8;
32792 case ProtoBuf.TYPES["bool"]:
32793 return 1;
32794 case ProtoBuf.TYPES["enum"]:
32795 return ByteBuffer.calculateVarint32(value);
32796 case ProtoBuf.TYPES["double"]:
32797 return 8;
32798 case ProtoBuf.TYPES["string"]:
32799 n = ByteBuffer.calculateUTF8Bytes(value);
32800 return ByteBuffer.calculateVarint32(n) + n;
32801 case ProtoBuf.TYPES["bytes"]:
32802 if (value.remaining() < 0)
32803 throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
32804 return ByteBuffer.calculateVarint32(value.remaining()) + value.remaining();
32805 case ProtoBuf.TYPES["message"]:
32806 n = this.resolvedType.calculate(value);
32807 return ByteBuffer.calculateVarint32(n) + n;
32808 case ProtoBuf.TYPES["group"]:
32809 n = this.resolvedType.calculate(value);
32810 return n + ByteBuffer.calculateVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
32811 }
32812 // We should never end here
32813 throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
32814 };
32815
32816 /**
32817 * Encodes a value to the specified buffer. Does not encode the key.
32818 * @param {number} id Field number
32819 * @param {*} value Field value
32820 * @param {ByteBuffer} buffer ByteBuffer to encode to
32821 * @return {ByteBuffer} The ByteBuffer for chaining
32822 * @throws {Error} If the value cannot be encoded
32823 * @expose
32824 */
32825 ElementPrototype.encodeValue = function(id, value, buffer) {
32826 if (value === null) return buffer; // Nothing to encode
32827 // Tag has already been written
32828
32829 switch (this.type) {
32830 // 32bit signed varint
32831 case ProtoBuf.TYPES["int32"]:
32832 // "If you use int32 or int64 as the type for a negative number, the resulting varint is always ten bytes
32833 // long – it is, effectively, treated like a very large unsigned integer." (see #122)
32834 if (value < 0)
32835 buffer.writeVarint64(value);
32836 else
32837 buffer.writeVarint32(value);
32838 break;
32839
32840 // 32bit unsigned varint
32841 case ProtoBuf.TYPES["uint32"]:
32842 buffer.writeVarint32(value);
32843 break;
32844
32845 // 32bit varint zig-zag
32846 case ProtoBuf.TYPES["sint32"]:
32847 buffer.writeVarint32ZigZag(value);
32848 break;
32849
32850 // Fixed unsigned 32bit
32851 case ProtoBuf.TYPES["fixed32"]:
32852 buffer.writeUint32(value);
32853 break;
32854
32855 // Fixed signed 32bit
32856 case ProtoBuf.TYPES["sfixed32"]:
32857 buffer.writeInt32(value);
32858 break;
32859
32860 // 64bit varint as-is
32861 case ProtoBuf.TYPES["int64"]:
32862 case ProtoBuf.TYPES["uint64"]:
32863 buffer.writeVarint64(value); // throws
32864 break;
32865
32866 // 64bit varint zig-zag
32867 case ProtoBuf.TYPES["sint64"]:
32868 buffer.writeVarint64ZigZag(value); // throws
32869 break;
32870
32871 // Fixed unsigned 64bit
32872 case ProtoBuf.TYPES["fixed64"]:
32873 buffer.writeUint64(value); // throws
32874 break;
32875
32876 // Fixed signed 64bit
32877 case ProtoBuf.TYPES["sfixed64"]:
32878 buffer.writeInt64(value); // throws
32879 break;
32880
32881 // Bool
32882 case ProtoBuf.TYPES["bool"]:
32883 if (typeof value === 'string')
32884 buffer.writeVarint32(value.toLowerCase() === 'false' ? 0 : !!value);
32885 else
32886 buffer.writeVarint32(value ? 1 : 0);
32887 break;
32888
32889 // Constant enum value
32890 case ProtoBuf.TYPES["enum"]:
32891 buffer.writeVarint32(value);
32892 break;
32893
32894 // 32bit float
32895 case ProtoBuf.TYPES["float"]:
32896 buffer.writeFloat32(value);
32897 break;
32898
32899 // 64bit float
32900 case ProtoBuf.TYPES["double"]:
32901 buffer.writeFloat64(value);
32902 break;
32903
32904 // Length-delimited string
32905 case ProtoBuf.TYPES["string"]:
32906 buffer.writeVString(value);
32907 break;
32908
32909 // Length-delimited bytes
32910 case ProtoBuf.TYPES["bytes"]:
32911 if (value.remaining() < 0)
32912 throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
32913 var prevOffset = value.offset;
32914 buffer.writeVarint32(value.remaining());
32915 buffer.append(value);
32916 value.offset = prevOffset;
32917 break;
32918
32919 // Embedded message
32920 case ProtoBuf.TYPES["message"]:
32921 var bb = new ByteBuffer().LE();
32922 this.resolvedType.encode(value, bb);
32923 buffer.writeVarint32(bb.offset);
32924 buffer.append(bb.flip());
32925 break;
32926
32927 // Legacy group
32928 case ProtoBuf.TYPES["group"]:
32929 this.resolvedType.encode(value, buffer);
32930 buffer.writeVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
32931 break;
32932
32933 default:
32934 // We should never end here
32935 throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
32936 }
32937 return buffer;
32938 };
32939
32940 /**
32941 * Decode one element value from the specified buffer.
32942 * @param {ByteBuffer} buffer ByteBuffer to decode from
32943 * @param {number} wireType The field wire type
32944 * @param {number} id The field number
32945 * @return {*} Decoded value
32946 * @throws {Error} If the field cannot be decoded
32947 * @expose
32948 */
32949 ElementPrototype.decode = function(buffer, wireType, id) {
32950 if (wireType != this.type.wireType)
32951 throw Error("Unexpected wire type for element");
32952
32953 var value, nBytes;
32954 switch (this.type) {
32955 // 32bit signed varint
32956 case ProtoBuf.TYPES["int32"]:
32957 return buffer.readVarint32() | 0;
32958
32959 // 32bit unsigned varint
32960 case ProtoBuf.TYPES["uint32"]:
32961 return buffer.readVarint32() >>> 0;
32962
32963 // 32bit signed varint zig-zag
32964 case ProtoBuf.TYPES["sint32"]:
32965 return buffer.readVarint32ZigZag() | 0;
32966
32967 // Fixed 32bit unsigned
32968 case ProtoBuf.TYPES["fixed32"]:
32969 return buffer.readUint32() >>> 0;
32970
32971 case ProtoBuf.TYPES["sfixed32"]:
32972 return buffer.readInt32() | 0;
32973
32974 // 64bit signed varint
32975 case ProtoBuf.TYPES["int64"]:
32976 return buffer.readVarint64();
32977
32978 // 64bit unsigned varint
32979 case ProtoBuf.TYPES["uint64"]:
32980 return buffer.readVarint64().toUnsigned();
32981
32982 // 64bit signed varint zig-zag
32983 case ProtoBuf.TYPES["sint64"]:
32984 return buffer.readVarint64ZigZag();
32985
32986 // Fixed 64bit unsigned
32987 case ProtoBuf.TYPES["fixed64"]:
32988 return buffer.readUint64();
32989
32990 // Fixed 64bit signed
32991 case ProtoBuf.TYPES["sfixed64"]:
32992 return buffer.readInt64();
32993
32994 // Bool varint
32995 case ProtoBuf.TYPES["bool"]:
32996 return !!buffer.readVarint32();
32997
32998 // Constant enum value (varint)
32999 case ProtoBuf.TYPES["enum"]:
33000 // The following Builder.Message#set will already throw
33001 return buffer.readVarint32();
33002
33003 // 32bit float
33004 case ProtoBuf.TYPES["float"]:
33005 return buffer.readFloat();
33006
33007 // 64bit float
33008 case ProtoBuf.TYPES["double"]:
33009 return buffer.readDouble();
33010
33011 // Length-delimited string
33012 case ProtoBuf.TYPES["string"]:
33013 return buffer.readVString();
33014
33015 // Length-delimited bytes
33016 case ProtoBuf.TYPES["bytes"]: {
33017 nBytes = buffer.readVarint32();
33018 if (buffer.remaining() < nBytes)
33019 throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
33020 value = buffer.clone(); // Offset already set
33021 value.limit = value.offset+nBytes;
33022 buffer.offset += nBytes;
33023 return value;
33024 }
33025
33026 // Length-delimited embedded message
33027 case ProtoBuf.TYPES["message"]: {
33028 nBytes = buffer.readVarint32();
33029 return this.resolvedType.decode(buffer, nBytes);
33030 }
33031
33032 // Legacy group
33033 case ProtoBuf.TYPES["group"]:
33034 return this.resolvedType.decode(buffer, -1, id);
33035 }
33036
33037 // We should never end here
33038 throw Error("[INTERNAL] Illegal decode type");
33039 };
33040
33041 /**
33042 * Converts a value from a string to the canonical element type.
33043 *
33044 * Legal only when isMapKey is true.
33045 *
33046 * @param {string} str The string value
33047 * @returns {*} The value
33048 */
33049 ElementPrototype.valueFromString = function(str) {
33050 if (!this.isMapKey) {
33051 throw Error("valueFromString() called on non-map-key element");
33052 }
33053
33054 switch (this.type) {
33055 case ProtoBuf.TYPES["int32"]:
33056 case ProtoBuf.TYPES["sint32"]:
33057 case ProtoBuf.TYPES["sfixed32"]:
33058 case ProtoBuf.TYPES["uint32"]:
33059 case ProtoBuf.TYPES["fixed32"]:
33060 return this.verifyValue(parseInt(str));
33061
33062 case ProtoBuf.TYPES["int64"]:
33063 case ProtoBuf.TYPES["sint64"]:
33064 case ProtoBuf.TYPES["sfixed64"]:
33065 case ProtoBuf.TYPES["uint64"]:
33066 case ProtoBuf.TYPES["fixed64"]:
33067 // Long-based fields support conversions from string already.
33068 return this.verifyValue(str);
33069
33070 case ProtoBuf.TYPES["bool"]:
33071 return str === "true";
33072
33073 case ProtoBuf.TYPES["string"]:
33074 return this.verifyValue(str);
33075
33076 case ProtoBuf.TYPES["bytes"]:
33077 return ByteBuffer.fromBinary(str);
33078 }
33079 };
33080
33081 /**
33082 * Converts a value from the canonical element type to a string.
33083 *
33084 * It should be the case that `valueFromString(valueToString(val))` returns
33085 * a value equivalent to `verifyValue(val)` for every legal value of `val`
33086 * according to this element type.
33087 *
33088 * This may be used when the element must be stored or used as a string,
33089 * e.g., as a map key on an Object.
33090 *
33091 * Legal only when isMapKey is true.
33092 *
33093 * @param {*} val The value
33094 * @returns {string} The string form of the value.
33095 */
33096 ElementPrototype.valueToString = function(value) {
33097 if (!this.isMapKey) {
33098 throw Error("valueToString() called on non-map-key element");
33099 }
33100
33101 if (this.type === ProtoBuf.TYPES["bytes"]) {
33102 return value.toString("binary");
33103 } else {
33104 return value.toString();
33105 }
33106 };
33107
33108 /**
33109 * @alias ProtoBuf.Reflect.Element
33110 * @expose
33111 */
33112 Reflect.Element = Element;
33113
33114 /**
33115 * Constructs a new Message.
33116 * @exports ProtoBuf.Reflect.Message
33117 * @param {!ProtoBuf.Builder} builder Builder reference
33118 * @param {!ProtoBuf.Reflect.Namespace} parent Parent message or namespace
33119 * @param {string} name Message name
33120 * @param {Object.<string,*>=} options Message options
33121 * @param {boolean=} isGroup `true` if this is a legacy group
33122 * @param {string?} syntax The syntax level of this definition (e.g., proto3)
33123 * @constructor
33124 * @extends ProtoBuf.Reflect.Namespace
33125 */
33126 var Message = function(builder, parent, name, options, isGroup, syntax) {
33127 Namespace.call(this, builder, parent, name, options, syntax);
33128
33129 /**
33130 * @override
33131 */
33132 this.className = "Message";
33133
33134 /**
33135 * Extensions range.
33136 * @type {!Array.<number>|undefined}
33137 * @expose
33138 */
33139 this.extensions = undefined;
33140
33141 /**
33142 * Runtime message class.
33143 * @type {?function(new:ProtoBuf.Builder.Message)}
33144 * @expose
33145 */
33146 this.clazz = null;
33147
33148 /**
33149 * Whether this is a legacy group or not.
33150 * @type {boolean}
33151 * @expose
33152 */
33153 this.isGroup = !!isGroup;
33154
33155 // The following cached collections are used to efficiently iterate over or look up fields when decoding.
33156
33157 /**
33158 * Cached fields.
33159 * @type {?Array.<!ProtoBuf.Reflect.Message.Field>}
33160 * @private
33161 */
33162 this._fields = null;
33163
33164 /**
33165 * Cached fields by id.
33166 * @type {?Object.<number,!ProtoBuf.Reflect.Message.Field>}
33167 * @private
33168 */
33169 this._fieldsById = null;
33170
33171 /**
33172 * Cached fields by name.
33173 * @type {?Object.<string,!ProtoBuf.Reflect.Message.Field>}
33174 * @private
33175 */
33176 this._fieldsByName = null;
33177 };
33178
33179 /**
33180 * @alias ProtoBuf.Reflect.Message.prototype
33181 * @inner
33182 */
33183 var MessagePrototype = Message.prototype = Object.create(Namespace.prototype);
33184
33185 /**
33186 * Builds the message and returns the runtime counterpart, which is a fully functional class.
33187 * @see ProtoBuf.Builder.Message
33188 * @param {boolean=} rebuild Whether to rebuild or not, defaults to false
33189 * @return {ProtoBuf.Reflect.Message} Message class
33190 * @throws {Error} If the message cannot be built
33191 * @expose
33192 */
33193 MessagePrototype.build = function(rebuild) {
33194 if (this.clazz && !rebuild)
33195 return this.clazz;
33196
33197 // Create the runtime Message class in its own scope
33198 var clazz = (function(ProtoBuf, T) {
33199
33200 var fields = T.getChildren(ProtoBuf.Reflect.Message.Field),
33201 oneofs = T.getChildren(ProtoBuf.Reflect.Message.OneOf);
33202
33203 /**
33204 * Constructs a new runtime Message.
33205 * @name ProtoBuf.Builder.Message
33206 * @class Barebone of all runtime messages.
33207 * @param {!Object.<string,*>|string} values Preset values
33208 * @param {...string} var_args
33209 * @constructor
33210 * @throws {Error} If the message cannot be created
33211 */
33212 var Message = function(values, var_args) {
33213 ProtoBuf.Builder.Message.call(this);
33214
33215 // Create virtual oneof properties
33216 for (var i=0, k=oneofs.length; i<k; ++i)
33217 this[oneofs[i].name] = null;
33218 // Create fields and set default values
33219 for (i=0, k=fields.length; i<k; ++i) {
33220 var field = fields[i];
33221 this[field.name] =
33222 field.repeated ? [] :
33223 (field.map ? new ProtoBuf.Map(field) : null);
33224 if ((field.required || T.syntax === 'proto3') &&
33225 field.defaultValue !== null)
33226 this[field.name] = field.defaultValue;
33227 }
33228
33229 if (arguments.length > 0) {
33230 var value;
33231 // Set field values from a values object
33232 if (arguments.length === 1 && values !== null && typeof values === 'object' &&
33233 /* not _another_ Message */ (typeof values.encode !== 'function' || values instanceof Message) &&
33234 /* not a repeated field */ !Array.isArray(values) &&
33235 /* not a Map */ !(values instanceof ProtoBuf.Map) &&
33236 /* not a ByteBuffer */ !ByteBuffer.isByteBuffer(values) &&
33237 /* not an ArrayBuffer */ !(values instanceof ArrayBuffer) &&
33238 /* not a Long */ !(ProtoBuf.Long && values instanceof ProtoBuf.Long)) {
33239 this.$set(values);
33240 } else // Set field values from arguments, in declaration order
33241 for (i=0, k=arguments.length; i<k; ++i)
33242 if (typeof (value = arguments[i]) !== 'undefined')
33243 this.$set(fields[i].name, value); // May throw
33244 }
33245 };
33246
33247 /**
33248 * @alias ProtoBuf.Builder.Message.prototype
33249 * @inner
33250 */
33251 var MessagePrototype = Message.prototype = Object.create(ProtoBuf.Builder.Message.prototype);
33252
33253 /**
33254 * Adds a value to a repeated field.
33255 * @name ProtoBuf.Builder.Message#add
33256 * @function
33257 * @param {string} key Field name
33258 * @param {*} value Value to add
33259 * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
33260 * @returns {!ProtoBuf.Builder.Message} this
33261 * @throws {Error} If the value cannot be added
33262 * @expose
33263 */
33264 MessagePrototype.add = function(key, value, noAssert) {
33265 var field = T._fieldsByName[key];
33266 if (!noAssert) {
33267 if (!field)
33268 throw Error(this+"#"+key+" is undefined");
33269 if (!(field instanceof ProtoBuf.Reflect.Message.Field))
33270 throw Error(this+"#"+key+" is not a field: "+field.toString(true)); // May throw if it's an enum or embedded message
33271 if (!field.repeated)
33272 throw Error(this+"#"+key+" is not a repeated field");
33273 value = field.verifyValue(value, true);
33274 }
33275 if (this[key] === null)
33276 this[key] = [];
33277 this[key].push(value);
33278 return this;
33279 };
33280
33281 /**
33282 * Adds a value to a repeated field. This is an alias for {@link ProtoBuf.Builder.Message#add}.
33283 * @name ProtoBuf.Builder.Message#$add
33284 * @function
33285 * @param {string} key Field name
33286 * @param {*} value Value to add
33287 * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
33288 * @returns {!ProtoBuf.Builder.Message} this
33289 * @throws {Error} If the value cannot be added
33290 * @expose
33291 */
33292 MessagePrototype.$add = MessagePrototype.add;
33293
33294 /**
33295 * Sets a field's value.
33296 * @name ProtoBuf.Builder.Message#set
33297 * @function
33298 * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
33299 * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
33300 * @param {boolean=} noAssert Whether to not assert for an actual field / proper value type, defaults to `false`
33301 * @returns {!ProtoBuf.Builder.Message} this
33302 * @throws {Error} If the value cannot be set
33303 * @expose
33304 */
33305 MessagePrototype.set = function(keyOrObj, value, noAssert) {
33306 if (keyOrObj && typeof keyOrObj === 'object') {
33307 noAssert = value;
33308 for (var ikey in keyOrObj) {
33309 // Check if virtual oneof field - don't set these
33310 if (keyOrObj.hasOwnProperty(ikey) && typeof (value = keyOrObj[ikey]) !== 'undefined' && T._oneofsByName[ikey] === undefined)
33311 this.$set(ikey, value, noAssert);
33312 }
33313 return this;
33314 }
33315 var field = T._fieldsByName[keyOrObj];
33316 if (!noAssert) {
33317 if (!field)
33318 throw Error(this+"#"+keyOrObj+" is not a field: undefined");
33319 if (!(field instanceof ProtoBuf.Reflect.Message.Field))
33320 throw Error(this+"#"+keyOrObj+" is not a field: "+field.toString(true));
33321 this[field.name] = (value = field.verifyValue(value)); // May throw
33322 } else
33323 this[keyOrObj] = value;
33324 if (field && field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
33325 var currentField = this[field.oneof.name]; // Virtual field references currently set field
33326 if (value !== null) {
33327 if (currentField !== null && currentField !== field.name)
33328 this[currentField] = null; // Clear currently set field
33329 this[field.oneof.name] = field.name; // Point virtual field at this field
33330 } else if (/* value === null && */currentField === keyOrObj)
33331 this[field.oneof.name] = null; // Clear virtual field (current field explicitly cleared)
33332 }
33333 return this;
33334 };
33335
33336 /**
33337 * Sets a field's value. This is an alias for [@link ProtoBuf.Builder.Message#set}.
33338 * @name ProtoBuf.Builder.Message#$set
33339 * @function
33340 * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
33341 * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
33342 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
33343 * @throws {Error} If the value cannot be set
33344 * @expose
33345 */
33346 MessagePrototype.$set = MessagePrototype.set;
33347
33348 /**
33349 * Gets a field's value.
33350 * @name ProtoBuf.Builder.Message#get
33351 * @function
33352 * @param {string} key Key
33353 * @param {boolean=} noAssert Whether to not assert for an actual field, defaults to `false`
33354 * @return {*} Value
33355 * @throws {Error} If there is no such field
33356 * @expose
33357 */
33358 MessagePrototype.get = function(key, noAssert) {
33359 if (noAssert)
33360 return this[key];
33361 var field = T._fieldsByName[key];
33362 if (!field || !(field instanceof ProtoBuf.Reflect.Message.Field))
33363 throw Error(this+"#"+key+" is not a field: undefined");
33364 if (!(field instanceof ProtoBuf.Reflect.Message.Field))
33365 throw Error(this+"#"+key+" is not a field: "+field.toString(true));
33366 return this[field.name];
33367 };
33368
33369 /**
33370 * Gets a field's value. This is an alias for {@link ProtoBuf.Builder.Message#$get}.
33371 * @name ProtoBuf.Builder.Message#$get
33372 * @function
33373 * @param {string} key Key
33374 * @return {*} Value
33375 * @throws {Error} If there is no such field
33376 * @expose
33377 */
33378 MessagePrototype.$get = MessagePrototype.get;
33379
33380 // Getters and setters
33381
33382 for (var i=0; i<fields.length; i++) {
33383 var field = fields[i];
33384 // no setters for extension fields as these are named by their fqn
33385 if (field instanceof ProtoBuf.Reflect.Message.ExtensionField)
33386 continue;
33387
33388 if (T.builder.options['populateAccessors'])
33389 (function(field) {
33390 // set/get[SomeValue]
33391 var Name = field.originalName.replace(/(_[a-zA-Z])/g, function(match) {
33392 return match.toUpperCase().replace('_','');
33393 });
33394 Name = Name.substring(0,1).toUpperCase() + Name.substring(1);
33395
33396 // set/get_[some_value] FIXME: Do we really need these?
33397 var name = field.originalName.replace(/([A-Z])/g, function(match) {
33398 return "_"+match;
33399 });
33400
33401 /**
33402 * The current field's unbound setter function.
33403 * @function
33404 * @param {*} value
33405 * @param {boolean=} noAssert
33406 * @returns {!ProtoBuf.Builder.Message}
33407 * @inner
33408 */
33409 var setter = function(value, noAssert) {
33410 this[field.name] = noAssert ? value : field.verifyValue(value);
33411 return this;
33412 };
33413
33414 /**
33415 * The current field's unbound getter function.
33416 * @function
33417 * @returns {*}
33418 * @inner
33419 */
33420 var getter = function() {
33421 return this[field.name];
33422 };
33423
33424 if (T.getChild("set"+Name) === null)
33425 /**
33426 * Sets a value. This method is present for each field, but only if there is no name conflict with
33427 * another field.
33428 * @name ProtoBuf.Builder.Message#set[SomeField]
33429 * @function
33430 * @param {*} value Value to set
33431 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
33432 * @returns {!ProtoBuf.Builder.Message} this
33433 * @abstract
33434 * @throws {Error} If the value cannot be set
33435 */
33436 MessagePrototype["set"+Name] = setter;
33437
33438 if (T.getChild("set_"+name) === null)
33439 /**
33440 * Sets a value. This method is present for each field, but only if there is no name conflict with
33441 * another field.
33442 * @name ProtoBuf.Builder.Message#set_[some_field]
33443 * @function
33444 * @param {*} value Value to set
33445 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
33446 * @returns {!ProtoBuf.Builder.Message} this
33447 * @abstract
33448 * @throws {Error} If the value cannot be set
33449 */
33450 MessagePrototype["set_"+name] = setter;
33451
33452 if (T.getChild("get"+Name) === null)
33453 /**
33454 * Gets a value. This method is present for each field, but only if there is no name conflict with
33455 * another field.
33456 * @name ProtoBuf.Builder.Message#get[SomeField]
33457 * @function
33458 * @abstract
33459 * @return {*} The value
33460 */
33461 MessagePrototype["get"+Name] = getter;
33462
33463 if (T.getChild("get_"+name) === null)
33464 /**
33465 * Gets a value. This method is present for each field, but only if there is no name conflict with
33466 * another field.
33467 * @name ProtoBuf.Builder.Message#get_[some_field]
33468 * @function
33469 * @return {*} The value
33470 * @abstract
33471 */
33472 MessagePrototype["get_"+name] = getter;
33473
33474 })(field);
33475 }
33476
33477 // En-/decoding
33478
33479 /**
33480 * Encodes the message.
33481 * @name ProtoBuf.Builder.Message#$encode
33482 * @function
33483 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
33484 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
33485 * @return {!ByteBuffer} Encoded message as a ByteBuffer
33486 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
33487 * returns the encoded ByteBuffer in the `encoded` property on the error.
33488 * @expose
33489 * @see ProtoBuf.Builder.Message#encode64
33490 * @see ProtoBuf.Builder.Message#encodeHex
33491 * @see ProtoBuf.Builder.Message#encodeAB
33492 */
33493 MessagePrototype.encode = function(buffer, noVerify) {
33494 if (typeof buffer === 'boolean')
33495 noVerify = buffer,
33496 buffer = undefined;
33497 var isNew = false;
33498 if (!buffer)
33499 buffer = new ByteBuffer(),
33500 isNew = true;
33501 var le = buffer.littleEndian;
33502 try {
33503 T.encode(this, buffer.LE(), noVerify);
33504 return (isNew ? buffer.flip() : buffer).LE(le);
33505 } catch (e) {
33506 buffer.LE(le);
33507 throw(e);
33508 }
33509 };
33510
33511 /**
33512 * Encodes a message using the specified data payload.
33513 * @param {!Object.<string,*>} data Data payload
33514 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
33515 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
33516 * @return {!ByteBuffer} Encoded message as a ByteBuffer
33517 * @expose
33518 */
33519 Message.encode = function(data, buffer, noVerify) {
33520 return new Message(data).encode(buffer, noVerify);
33521 };
33522
33523 /**
33524 * Calculates the byte length of the message.
33525 * @name ProtoBuf.Builder.Message#calculate
33526 * @function
33527 * @returns {number} Byte length
33528 * @throws {Error} If the message cannot be calculated or if required fields are missing.
33529 * @expose
33530 */
33531 MessagePrototype.calculate = function() {
33532 return T.calculate(this);
33533 };
33534
33535 /**
33536 * Encodes the varint32 length-delimited message.
33537 * @name ProtoBuf.Builder.Message#encodeDelimited
33538 * @function
33539 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
33540 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
33541 * @return {!ByteBuffer} Encoded message as a ByteBuffer
33542 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
33543 * returns the encoded ByteBuffer in the `encoded` property on the error.
33544 * @expose
33545 */
33546 MessagePrototype.encodeDelimited = function(buffer, noVerify) {
33547 var isNew = false;
33548 if (!buffer)
33549 buffer = new ByteBuffer(),
33550 isNew = true;
33551 var enc = new ByteBuffer().LE();
33552 T.encode(this, enc, noVerify).flip();
33553 buffer.writeVarint32(enc.remaining());
33554 buffer.append(enc);
33555 return isNew ? buffer.flip() : buffer;
33556 };
33557
33558 /**
33559 * Directly encodes the message to an ArrayBuffer.
33560 * @name ProtoBuf.Builder.Message#encodeAB
33561 * @function
33562 * @return {ArrayBuffer} Encoded message as ArrayBuffer
33563 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
33564 * returns the encoded ArrayBuffer in the `encoded` property on the error.
33565 * @expose
33566 */
33567 MessagePrototype.encodeAB = function() {
33568 try {
33569 return this.encode().toArrayBuffer();
33570 } catch (e) {
33571 if (e["encoded"]) e["encoded"] = e["encoded"].toArrayBuffer();
33572 throw(e);
33573 }
33574 };
33575
33576 /**
33577 * Returns the message as an ArrayBuffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeAB}.
33578 * @name ProtoBuf.Builder.Message#toArrayBuffer
33579 * @function
33580 * @return {ArrayBuffer} Encoded message as ArrayBuffer
33581 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
33582 * returns the encoded ArrayBuffer in the `encoded` property on the error.
33583 * @expose
33584 */
33585 MessagePrototype.toArrayBuffer = MessagePrototype.encodeAB;
33586
33587 /**
33588 * Directly encodes the message to a node Buffer.
33589 * @name ProtoBuf.Builder.Message#encodeNB
33590 * @function
33591 * @return {!Buffer}
33592 * @throws {Error} If the message cannot be encoded, not running under node.js or if required fields are
33593 * missing. The later still returns the encoded node Buffer in the `encoded` property on the error.
33594 * @expose
33595 */
33596 MessagePrototype.encodeNB = function() {
33597 try {
33598 return this.encode().toBuffer();
33599 } catch (e) {
33600 if (e["encoded"]) e["encoded"] = e["encoded"].toBuffer();
33601 throw(e);
33602 }
33603 };
33604
33605 /**
33606 * Returns the message as a node Buffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeNB}.
33607 * @name ProtoBuf.Builder.Message#toBuffer
33608 * @function
33609 * @return {!Buffer}
33610 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
33611 * returns the encoded node Buffer in the `encoded` property on the error.
33612 * @expose
33613 */
33614 MessagePrototype.toBuffer = MessagePrototype.encodeNB;
33615
33616 /**
33617 * Directly encodes the message to a base64 encoded string.
33618 * @name ProtoBuf.Builder.Message#encode64
33619 * @function
33620 * @return {string} Base64 encoded string
33621 * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
33622 * still returns the encoded base64 string in the `encoded` property on the error.
33623 * @expose
33624 */
33625 MessagePrototype.encode64 = function() {
33626 try {
33627 return this.encode().toBase64();
33628 } catch (e) {
33629 if (e["encoded"]) e["encoded"] = e["encoded"].toBase64();
33630 throw(e);
33631 }
33632 };
33633
33634 /**
33635 * Returns the message as a base64 encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encode64}.
33636 * @name ProtoBuf.Builder.Message#toBase64
33637 * @function
33638 * @return {string} Base64 encoded string
33639 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
33640 * returns the encoded base64 string in the `encoded` property on the error.
33641 * @expose
33642 */
33643 MessagePrototype.toBase64 = MessagePrototype.encode64;
33644
33645 /**
33646 * Directly encodes the message to a hex encoded string.
33647 * @name ProtoBuf.Builder.Message#encodeHex
33648 * @function
33649 * @return {string} Hex encoded string
33650 * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
33651 * still returns the encoded hex string in the `encoded` property on the error.
33652 * @expose
33653 */
33654 MessagePrototype.encodeHex = function() {
33655 try {
33656 return this.encode().toHex();
33657 } catch (e) {
33658 if (e["encoded"]) e["encoded"] = e["encoded"].toHex();
33659 throw(e);
33660 }
33661 };
33662
33663 /**
33664 * Returns the message as a hex encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encodeHex}.
33665 * @name ProtoBuf.Builder.Message#toHex
33666 * @function
33667 * @return {string} Hex encoded string
33668 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
33669 * returns the encoded hex string in the `encoded` property on the error.
33670 * @expose
33671 */
33672 MessagePrototype.toHex = MessagePrototype.encodeHex;
33673
33674 /**
33675 * Clones a message object or field value to a raw object.
33676 * @param {*} obj Object to clone
33677 * @param {boolean} binaryAsBase64 Whether to include binary data as base64 strings or as a buffer otherwise
33678 * @param {boolean} longsAsStrings Whether to encode longs as strings
33679 * @param {!ProtoBuf.Reflect.T=} resolvedType The resolved field type if a field
33680 * @returns {*} Cloned object
33681 * @inner
33682 */
33683 function cloneRaw(obj, binaryAsBase64, longsAsStrings, resolvedType) {
33684 if (obj === null || typeof obj !== 'object') {
33685 // Convert enum values to their respective names
33686 if (resolvedType && resolvedType instanceof ProtoBuf.Reflect.Enum) {
33687 var name = ProtoBuf.Reflect.Enum.getName(resolvedType.object, obj);
33688 if (name !== null)
33689 return name;
33690 }
33691 // Pass-through string, number, boolean, null...
33692 return obj;
33693 }
33694 // Convert ByteBuffers to raw buffer or strings
33695 if (ByteBuffer.isByteBuffer(obj))
33696 return binaryAsBase64 ? obj.toBase64() : obj.toBuffer();
33697 // Convert Longs to proper objects or strings
33698 if (ProtoBuf.Long.isLong(obj))
33699 return longsAsStrings ? obj.toString() : ProtoBuf.Long.fromValue(obj);
33700 var clone;
33701 // Clone arrays
33702 if (Array.isArray(obj)) {
33703 clone = [];
33704 obj.forEach(function(v, k) {
33705 clone[k] = cloneRaw(v, binaryAsBase64, longsAsStrings, resolvedType);
33706 });
33707 return clone;
33708 }
33709 clone = {};
33710 // Convert maps to objects
33711 if (obj instanceof ProtoBuf.Map) {
33712 var it = obj.entries();
33713 for (var e = it.next(); !e.done; e = it.next())
33714 clone[obj.keyElem.valueToString(e.value[0])] = cloneRaw(e.value[1], binaryAsBase64, longsAsStrings, obj.valueElem.resolvedType);
33715 return clone;
33716 }
33717 // Everything else is a non-null object
33718 var type = obj.$type,
33719 field = undefined;
33720 for (var i in obj)
33721 if (obj.hasOwnProperty(i)) {
33722 if (type && (field = type.getChild(i)))
33723 clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings, field.resolvedType);
33724 else
33725 clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings);
33726 }
33727 return clone;
33728 }
33729
33730 /**
33731 * Returns the message's raw payload.
33732 * @param {boolean=} binaryAsBase64 Whether to include binary data as base64 strings instead of Buffers, defaults to `false`
33733 * @param {boolean} longsAsStrings Whether to encode longs as strings
33734 * @returns {Object.<string,*>} Raw payload
33735 * @expose
33736 */
33737 MessagePrototype.toRaw = function(binaryAsBase64, longsAsStrings) {
33738 return cloneRaw(this, !!binaryAsBase64, !!longsAsStrings, this.$type);
33739 };
33740
33741 /**
33742 * Encodes a message to JSON.
33743 * @returns {string} JSON string
33744 * @expose
33745 */
33746 MessagePrototype.encodeJSON = function() {
33747 return JSON.stringify(
33748 cloneRaw(this,
33749 /* binary-as-base64 */ true,
33750 /* longs-as-strings */ true,
33751 this.$type
33752 )
33753 );
33754 };
33755
33756 /**
33757 * Decodes a message from the specified buffer or string.
33758 * @name ProtoBuf.Builder.Message.decode
33759 * @function
33760 * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
33761 * @param {(number|string)=} length Message length. Defaults to decode all the remainig data.
33762 * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
33763 * @return {!ProtoBuf.Builder.Message} Decoded message
33764 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
33765 * returns the decoded message with missing fields in the `decoded` property on the error.
33766 * @expose
33767 * @see ProtoBuf.Builder.Message.decode64
33768 * @see ProtoBuf.Builder.Message.decodeHex
33769 */
33770 Message.decode = function(buffer, length, enc) {
33771 if (typeof length === 'string')
33772 enc = length,
33773 length = -1;
33774 if (typeof buffer === 'string')
33775 buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
33776 else if (!ByteBuffer.isByteBuffer(buffer))
33777 buffer = ByteBuffer.wrap(buffer); // May throw
33778 var le = buffer.littleEndian;
33779 try {
33780 var msg = T.decode(buffer.LE(), length);
33781 buffer.LE(le);
33782 return msg;
33783 } catch (e) {
33784 buffer.LE(le);
33785 throw(e);
33786 }
33787 };
33788
33789 /**
33790 * Decodes a varint32 length-delimited message from the specified buffer or string.
33791 * @name ProtoBuf.Builder.Message.decodeDelimited
33792 * @function
33793 * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
33794 * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
33795 * @return {ProtoBuf.Builder.Message} Decoded message or `null` if not enough bytes are available yet
33796 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
33797 * returns the decoded message with missing fields in the `decoded` property on the error.
33798 * @expose
33799 */
33800 Message.decodeDelimited = function(buffer, enc) {
33801 if (typeof buffer === 'string')
33802 buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
33803 else if (!ByteBuffer.isByteBuffer(buffer))
33804 buffer = ByteBuffer.wrap(buffer); // May throw
33805 if (buffer.remaining() < 1)
33806 return null;
33807 var off = buffer.offset,
33808 len = buffer.readVarint32();
33809 if (buffer.remaining() < len) {
33810 buffer.offset = off;
33811 return null;
33812 }
33813 try {
33814 var msg = T.decode(buffer.slice(buffer.offset, buffer.offset + len).LE());
33815 buffer.offset += len;
33816 return msg;
33817 } catch (err) {
33818 buffer.offset += len;
33819 throw err;
33820 }
33821 };
33822
33823 /**
33824 * Decodes the message from the specified base64 encoded string.
33825 * @name ProtoBuf.Builder.Message.decode64
33826 * @function
33827 * @param {string} str String to decode from
33828 * @return {!ProtoBuf.Builder.Message} Decoded message
33829 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
33830 * returns the decoded message with missing fields in the `decoded` property on the error.
33831 * @expose
33832 */
33833 Message.decode64 = function(str) {
33834 return Message.decode(str, "base64");
33835 };
33836
33837 /**
33838 * Decodes the message from the specified hex encoded string.
33839 * @name ProtoBuf.Builder.Message.decodeHex
33840 * @function
33841 * @param {string} str String to decode from
33842 * @return {!ProtoBuf.Builder.Message} Decoded message
33843 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
33844 * returns the decoded message with missing fields in the `decoded` property on the error.
33845 * @expose
33846 */
33847 Message.decodeHex = function(str) {
33848 return Message.decode(str, "hex");
33849 };
33850
33851 /**
33852 * Decodes the message from a JSON string.
33853 * @name ProtoBuf.Builder.Message.decodeJSON
33854 * @function
33855 * @param {string} str String to decode from
33856 * @return {!ProtoBuf.Builder.Message} Decoded message
33857 * @throws {Error} If the message cannot be decoded or if required fields are
33858 * missing.
33859 * @expose
33860 */
33861 Message.decodeJSON = function(str) {
33862 return new Message(JSON.parse(str));
33863 };
33864
33865 // Utility
33866
33867 /**
33868 * Returns a string representation of this Message.
33869 * @name ProtoBuf.Builder.Message#toString
33870 * @function
33871 * @return {string} String representation as of ".Fully.Qualified.MessageName"
33872 * @expose
33873 */
33874 MessagePrototype.toString = function() {
33875 return T.toString();
33876 };
33877
33878 // Properties
33879
33880 /**
33881 * Message options.
33882 * @name ProtoBuf.Builder.Message.$options
33883 * @type {Object.<string,*>}
33884 * @expose
33885 */
33886 var $optionsS; // cc needs this
33887
33888 /**
33889 * Message options.
33890 * @name ProtoBuf.Builder.Message#$options
33891 * @type {Object.<string,*>}
33892 * @expose
33893 */
33894 var $options;
33895
33896 /**
33897 * Reflection type.
33898 * @name ProtoBuf.Builder.Message.$type
33899 * @type {!ProtoBuf.Reflect.Message}
33900 * @expose
33901 */
33902 var $typeS;
33903
33904 /**
33905 * Reflection type.
33906 * @name ProtoBuf.Builder.Message#$type
33907 * @type {!ProtoBuf.Reflect.Message}
33908 * @expose
33909 */
33910 var $type;
33911
33912 if (Object.defineProperty)
33913 Object.defineProperty(Message, '$options', { "value": T.buildOpt() }),
33914 Object.defineProperty(MessagePrototype, "$options", { "value": Message["$options"] }),
33915 Object.defineProperty(Message, "$type", { "value": T }),
33916 Object.defineProperty(MessagePrototype, "$type", { "value": T });
33917
33918 return Message;
33919
33920 })(ProtoBuf, this);
33921
33922 // Static enums and prototyped sub-messages / cached collections
33923 this._fields = [];
33924 this._fieldsById = {};
33925 this._fieldsByName = {};
33926 this._oneofsByName = {};
33927 for (var i=0, k=this.children.length, child; i<k; i++) {
33928 child = this.children[i];
33929 if (child instanceof Enum || child instanceof Message || child instanceof Service) {
33930 if (clazz.hasOwnProperty(child.name))
33931 throw Error("Illegal reflect child of "+this.toString(true)+": "+child.toString(true)+" cannot override static property '"+child.name+"'");
33932 clazz[child.name] = child.build();
33933 } else if (child instanceof Message.Field)
33934 child.build(),
33935 this._fields.push(child),
33936 this._fieldsById[child.id] = child,
33937 this._fieldsByName[child.name] = child;
33938 else if (child instanceof Message.OneOf) {
33939 this._oneofsByName[child.name] = child;
33940 }
33941 else if (!(child instanceof Message.OneOf) && !(child instanceof Extension)) // Not built
33942 throw Error("Illegal reflect child of "+this.toString(true)+": "+this.children[i].toString(true));
33943 }
33944
33945 return this.clazz = clazz;
33946 };
33947
33948 /**
33949 * Encodes a runtime message's contents to the specified buffer.
33950 * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
33951 * @param {ByteBuffer} buffer ByteBuffer to write to
33952 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
33953 * @return {ByteBuffer} The ByteBuffer for chaining
33954 * @throws {Error} If required fields are missing or the message cannot be encoded for another reason
33955 * @expose
33956 */
33957 MessagePrototype.encode = function(message, buffer, noVerify) {
33958 var fieldMissing = null,
33959 field;
33960 for (var i=0, k=this._fields.length, val; i<k; ++i) {
33961 field = this._fields[i];
33962 val = message[field.name];
33963 if (field.required && val === null) {
33964 if (fieldMissing === null)
33965 fieldMissing = field;
33966 } else
33967 field.encode(noVerify ? val : field.verifyValue(val), buffer, message);
33968 }
33969 if (fieldMissing !== null) {
33970 var err = Error("Missing at least one required field for "+this.toString(true)+": "+fieldMissing);
33971 err["encoded"] = buffer; // Still expose what we got
33972 throw(err);
33973 }
33974 return buffer;
33975 };
33976
33977 /**
33978 * Calculates a runtime message's byte length.
33979 * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
33980 * @returns {number} Byte length
33981 * @throws {Error} If required fields are missing or the message cannot be calculated for another reason
33982 * @expose
33983 */
33984 MessagePrototype.calculate = function(message) {
33985 for (var n=0, i=0, k=this._fields.length, field, val; i<k; ++i) {
33986 field = this._fields[i];
33987 val = message[field.name];
33988 if (field.required && val === null)
33989 throw Error("Missing at least one required field for "+this.toString(true)+": "+field);
33990 else
33991 n += field.calculate(val, message);
33992 }
33993 return n;
33994 };
33995
33996 /**
33997 * Skips all data until the end of the specified group has been reached.
33998 * @param {number} expectedId Expected GROUPEND id
33999 * @param {!ByteBuffer} buf ByteBuffer
34000 * @returns {boolean} `true` if a value as been skipped, `false` if the end has been reached
34001 * @throws {Error} If it wasn't possible to find the end of the group (buffer overrun or end tag mismatch)
34002 * @inner
34003 */
34004 function skipTillGroupEnd(expectedId, buf) {
34005 var tag = buf.readVarint32(), // Throws on OOB
34006 wireType = tag & 0x07,
34007 id = tag >>> 3;
34008 switch (wireType) {
34009 case ProtoBuf.WIRE_TYPES.VARINT:
34010 do tag = buf.readUint8();
34011 while ((tag & 0x80) === 0x80);
34012 break;
34013 case ProtoBuf.WIRE_TYPES.BITS64:
34014 buf.offset += 8;
34015 break;
34016 case ProtoBuf.WIRE_TYPES.LDELIM:
34017 tag = buf.readVarint32(); // reads the varint
34018 buf.offset += tag; // skips n bytes
34019 break;
34020 case ProtoBuf.WIRE_TYPES.STARTGROUP:
34021 skipTillGroupEnd(id, buf);
34022 break;
34023 case ProtoBuf.WIRE_TYPES.ENDGROUP:
34024 if (id === expectedId)
34025 return false;
34026 else
34027 throw Error("Illegal GROUPEND after unknown group: "+id+" ("+expectedId+" expected)");
34028 case ProtoBuf.WIRE_TYPES.BITS32:
34029 buf.offset += 4;
34030 break;
34031 default:
34032 throw Error("Illegal wire type in unknown group "+expectedId+": "+wireType);
34033 }
34034 return true;
34035 }
34036
34037 /**
34038 * Decodes an encoded message and returns the decoded message.
34039 * @param {ByteBuffer} buffer ByteBuffer to decode from
34040 * @param {number=} length Message length. Defaults to decode all remaining data.
34041 * @param {number=} expectedGroupEndId Expected GROUPEND id if this is a legacy group
34042 * @return {ProtoBuf.Builder.Message} Decoded message
34043 * @throws {Error} If the message cannot be decoded
34044 * @expose
34045 */
34046 MessagePrototype.decode = function(buffer, length, expectedGroupEndId) {
34047 if (typeof length !== 'number')
34048 length = -1;
34049 var start = buffer.offset,
34050 msg = new (this.clazz)(),
34051 tag, wireType, id, field;
34052 while (buffer.offset < start+length || (length === -1 && buffer.remaining() > 0)) {
34053 tag = buffer.readVarint32();
34054 wireType = tag & 0x07;
34055 id = tag >>> 3;
34056 if (wireType === ProtoBuf.WIRE_TYPES.ENDGROUP) {
34057 if (id !== expectedGroupEndId)
34058 throw Error("Illegal group end indicator for "+this.toString(true)+": "+id+" ("+(expectedGroupEndId ? expectedGroupEndId+" expected" : "not a group")+")");
34059 break;
34060 }
34061 if (!(field = this._fieldsById[id])) {
34062 // "messages created by your new code can be parsed by your old code: old binaries simply ignore the new field when parsing."
34063 switch (wireType) {
34064 case ProtoBuf.WIRE_TYPES.VARINT:
34065 buffer.readVarint32();
34066 break;
34067 case ProtoBuf.WIRE_TYPES.BITS32:
34068 buffer.offset += 4;
34069 break;
34070 case ProtoBuf.WIRE_TYPES.BITS64:
34071 buffer.offset += 8;
34072 break;
34073 case ProtoBuf.WIRE_TYPES.LDELIM:
34074 var len = buffer.readVarint32();
34075 buffer.offset += len;
34076 break;
34077 case ProtoBuf.WIRE_TYPES.STARTGROUP:
34078 while (skipTillGroupEnd(id, buffer)) {}
34079 break;
34080 default:
34081 throw Error("Illegal wire type for unknown field "+id+" in "+this.toString(true)+"#decode: "+wireType);
34082 }
34083 continue;
34084 }
34085 if (field.repeated && !field.options["packed"]) {
34086 msg[field.name].push(field.decode(wireType, buffer));
34087 } else if (field.map) {
34088 var keyval = field.decode(wireType, buffer);
34089 msg[field.name].set(keyval[0], keyval[1]);
34090 } else {
34091 msg[field.name] = field.decode(wireType, buffer);
34092 if (field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
34093 var currentField = msg[field.oneof.name]; // Virtual field references currently set field
34094 if (currentField !== null && currentField !== field.name)
34095 msg[currentField] = null; // Clear currently set field
34096 msg[field.oneof.name] = field.name; // Point virtual field at this field
34097 }
34098 }
34099 }
34100
34101 // Check if all required fields are present and set default values for optional fields that are not
34102 for (var i=0, k=this._fields.length; i<k; ++i) {
34103 field = this._fields[i];
34104 if (msg[field.name] === null) {
34105 if (this.syntax === "proto3") { // Proto3 sets default values by specification
34106 msg[field.name] = field.defaultValue;
34107 } else if (field.required) {
34108 var err = Error("Missing at least one required field for " + this.toString(true) + ": " + field.name);
34109 err["decoded"] = msg; // Still expose what we got
34110 throw(err);
34111 } else if (ProtoBuf.populateDefaults && field.defaultValue !== null)
34112 msg[field.name] = field.defaultValue;
34113 }
34114 }
34115 return msg;
34116 };
34117
34118 /**
34119 * @alias ProtoBuf.Reflect.Message
34120 * @expose
34121 */
34122 Reflect.Message = Message;
34123
34124 /**
34125 * Constructs a new Message Field.
34126 * @exports ProtoBuf.Reflect.Message.Field
34127 * @param {!ProtoBuf.Builder} builder Builder reference
34128 * @param {!ProtoBuf.Reflect.Message} message Message reference
34129 * @param {string} rule Rule, one of requried, optional, repeated
34130 * @param {string?} keytype Key data type, if any.
34131 * @param {string} type Data type, e.g. int32
34132 * @param {string} name Field name
34133 * @param {number} id Unique field id
34134 * @param {Object.<string,*>=} options Options
34135 * @param {!ProtoBuf.Reflect.Message.OneOf=} oneof Enclosing OneOf
34136 * @param {string?} syntax The syntax level of this definition (e.g., proto3)
34137 * @constructor
34138 * @extends ProtoBuf.Reflect.T
34139 */
34140 var Field = function(builder, message, rule, keytype, type, name, id, options, oneof, syntax) {
34141 T.call(this, builder, message, name);
34142
34143 /**
34144 * @override
34145 */
34146 this.className = "Message.Field";
34147
34148 /**
34149 * Message field required flag.
34150 * @type {boolean}
34151 * @expose
34152 */
34153 this.required = rule === "required";
34154
34155 /**
34156 * Message field repeated flag.
34157 * @type {boolean}
34158 * @expose
34159 */
34160 this.repeated = rule === "repeated";
34161
34162 /**
34163 * Message field map flag.
34164 * @type {boolean}
34165 * @expose
34166 */
34167 this.map = rule === "map";
34168
34169 /**
34170 * Message field key type. Type reference string if unresolved, protobuf
34171 * type if resolved. Valid only if this.map === true, null otherwise.
34172 * @type {string|{name: string, wireType: number}|null}
34173 * @expose
34174 */
34175 this.keyType = keytype || null;
34176
34177 /**
34178 * Message field type. Type reference string if unresolved, protobuf type if
34179 * resolved. In a map field, this is the value type.
34180 * @type {string|{name: string, wireType: number}}
34181 * @expose
34182 */
34183 this.type = type;
34184
34185 /**
34186 * Resolved type reference inside the global namespace.
34187 * @type {ProtoBuf.Reflect.T|null}
34188 * @expose
34189 */
34190 this.resolvedType = null;
34191
34192 /**
34193 * Unique message field id.
34194 * @type {number}
34195 * @expose
34196 */
34197 this.id = id;
34198
34199 /**
34200 * Message field options.
34201 * @type {!Object.<string,*>}
34202 * @dict
34203 * @expose
34204 */
34205 this.options = options || {};
34206
34207 /**
34208 * Default value.
34209 * @type {*}
34210 * @expose
34211 */
34212 this.defaultValue = null;
34213
34214 /**
34215 * Enclosing OneOf.
34216 * @type {?ProtoBuf.Reflect.Message.OneOf}
34217 * @expose
34218 */
34219 this.oneof = oneof || null;
34220
34221 /**
34222 * Syntax level of this definition (e.g., proto3).
34223 * @type {string}
34224 * @expose
34225 */
34226 this.syntax = syntax || 'proto2';
34227
34228 /**
34229 * Original field name.
34230 * @type {string}
34231 * @expose
34232 */
34233 this.originalName = this.name; // Used to revert camelcase transformation on naming collisions
34234
34235 /**
34236 * Element implementation. Created in build() after types are resolved.
34237 * @type {ProtoBuf.Element}
34238 * @expose
34239 */
34240 this.element = null;
34241
34242 /**
34243 * Key element implementation, for map fields. Created in build() after
34244 * types are resolved.
34245 * @type {ProtoBuf.Element}
34246 * @expose
34247 */
34248 this.keyElement = null;
34249
34250 // Convert field names to camel case notation if the override is set
34251 if (this.builder.options['convertFieldsToCamelCase'] && !(this instanceof Message.ExtensionField))
34252 this.name = ProtoBuf.Util.toCamelCase(this.name);
34253 };
34254
34255 /**
34256 * @alias ProtoBuf.Reflect.Message.Field.prototype
34257 * @inner
34258 */
34259 var FieldPrototype = Field.prototype = Object.create(T.prototype);
34260
34261 /**
34262 * Builds the field.
34263 * @override
34264 * @expose
34265 */
34266 FieldPrototype.build = function() {
34267 this.element = new Element(this.type, this.resolvedType, false, this.syntax, this.name);
34268 if (this.map)
34269 this.keyElement = new Element(this.keyType, undefined, true, this.syntax, this.name);
34270
34271 // In proto3, fields do not have field presence, and every field is set to
34272 // its type's default value ("", 0, 0.0, or false).
34273 if (this.syntax === 'proto3' && !this.repeated && !this.map)
34274 this.defaultValue = Element.defaultFieldValue(this.type);
34275
34276 // Otherwise, default values are present when explicitly specified
34277 else if (typeof this.options['default'] !== 'undefined')
34278 this.defaultValue = this.verifyValue(this.options['default']);
34279 };
34280
34281 /**
34282 * Checks if the given value can be set for this field.
34283 * @param {*} value Value to check
34284 * @param {boolean=} skipRepeated Whether to skip the repeated value check or not. Defaults to false.
34285 * @return {*} Verified, maybe adjusted, value
34286 * @throws {Error} If the value cannot be set for this field
34287 * @expose
34288 */
34289 FieldPrototype.verifyValue = function(value, skipRepeated) {
34290 skipRepeated = skipRepeated || false;
34291 var self = this;
34292 function fail(val, msg) {
34293 throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
34294 }
34295 if (value === null) { // NULL values for optional fields
34296 if (this.required)
34297 fail(typeof value, "required");
34298 if (this.syntax === 'proto3' && this.type !== ProtoBuf.TYPES["message"])
34299 fail(typeof value, "proto3 field without field presence cannot be null");
34300 return null;
34301 }
34302 var i;
34303 if (this.repeated && !skipRepeated) { // Repeated values as arrays
34304 if (!Array.isArray(value))
34305 value = [value];
34306 var res = [];
34307 for (i=0; i<value.length; i++)
34308 res.push(this.element.verifyValue(value[i]));
34309 return res;
34310 }
34311 if (this.map && !skipRepeated) { // Map values as objects
34312 if (!(value instanceof ProtoBuf.Map)) {
34313 // If not already a Map, attempt to convert.
34314 if (!(value instanceof Object)) {
34315 fail(typeof value,
34316 "expected ProtoBuf.Map or raw object for map field");
34317 }
34318 return new ProtoBuf.Map(this, value);
34319 } else {
34320 return value;
34321 }
34322 }
34323 // All non-repeated fields expect no array
34324 if (!this.repeated && Array.isArray(value))
34325 fail(typeof value, "no array expected");
34326
34327 return this.element.verifyValue(value);
34328 };
34329
34330 /**
34331 * Determines whether the field will have a presence on the wire given its
34332 * value.
34333 * @param {*} value Verified field value
34334 * @param {!ProtoBuf.Builder.Message} message Runtime message
34335 * @return {boolean} Whether the field will be present on the wire
34336 */
34337 FieldPrototype.hasWirePresence = function(value, message) {
34338 if (this.syntax !== 'proto3')
34339 return (value !== null);
34340 if (this.oneof && message[this.oneof.name] === this.name)
34341 return true;
34342 switch (this.type) {
34343 case ProtoBuf.TYPES["int32"]:
34344 case ProtoBuf.TYPES["sint32"]:
34345 case ProtoBuf.TYPES["sfixed32"]:
34346 case ProtoBuf.TYPES["uint32"]:
34347 case ProtoBuf.TYPES["fixed32"]:
34348 return value !== 0;
34349
34350 case ProtoBuf.TYPES["int64"]:
34351 case ProtoBuf.TYPES["sint64"]:
34352 case ProtoBuf.TYPES["sfixed64"]:
34353 case ProtoBuf.TYPES["uint64"]:
34354 case ProtoBuf.TYPES["fixed64"]:
34355 return value.low !== 0 || value.high !== 0;
34356
34357 case ProtoBuf.TYPES["bool"]:
34358 return value;
34359
34360 case ProtoBuf.TYPES["float"]:
34361 case ProtoBuf.TYPES["double"]:
34362 return value !== 0.0;
34363
34364 case ProtoBuf.TYPES["string"]:
34365 return value.length > 0;
34366
34367 case ProtoBuf.TYPES["bytes"]:
34368 return value.remaining() > 0;
34369
34370 case ProtoBuf.TYPES["enum"]:
34371 return value !== 0;
34372
34373 case ProtoBuf.TYPES["message"]:
34374 return value !== null;
34375 default:
34376 return true;
34377 }
34378 };
34379
34380 /**
34381 * Encodes the specified field value to the specified buffer.
34382 * @param {*} value Verified field value
34383 * @param {ByteBuffer} buffer ByteBuffer to encode to
34384 * @param {!ProtoBuf.Builder.Message} message Runtime message
34385 * @return {ByteBuffer} The ByteBuffer for chaining
34386 * @throws {Error} If the field cannot be encoded
34387 * @expose
34388 */
34389 FieldPrototype.encode = function(value, buffer, message) {
34390 if (this.type === null || typeof this.type !== 'object')
34391 throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
34392 if (value === null || (this.repeated && value.length == 0))
34393 return buffer; // Optional omitted
34394 try {
34395 if (this.repeated) {
34396 var i;
34397 // "Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire
34398 // types) can be declared 'packed'."
34399 if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
34400 // "All of the elements of the field are packed into a single key-value pair with wire type 2
34401 // (length-delimited). Each element is encoded the same way it would be normally, except without a
34402 // tag preceding it."
34403 buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
34404 buffer.ensureCapacity(buffer.offset += 1); // We do not know the length yet, so let's assume a varint of length 1
34405 var start = buffer.offset; // Remember where the contents begin
34406 for (i=0; i<value.length; i++)
34407 this.element.encodeValue(this.id, value[i], buffer);
34408 var len = buffer.offset-start,
34409 varintLen = ByteBuffer.calculateVarint32(len);
34410 if (varintLen > 1) { // We need to move the contents
34411 var contents = buffer.slice(start, buffer.offset);
34412 start += varintLen-1;
34413 buffer.offset = start;
34414 buffer.append(contents);
34415 }
34416 buffer.writeVarint32(len, start-varintLen);
34417 } else {
34418 // "If your message definition has repeated elements (without the [packed=true] option), the encoded
34419 // message has zero or more key-value pairs with the same tag number"
34420 for (i=0; i<value.length; i++)
34421 buffer.writeVarint32((this.id << 3) | this.type.wireType),
34422 this.element.encodeValue(this.id, value[i], buffer);
34423 }
34424 } else if (this.map) {
34425 // Write out each map entry as a submessage.
34426 value.forEach(function(val, key, m) {
34427 // Compute the length of the submessage (key, val) pair.
34428 var length =
34429 ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
34430 this.keyElement.calculateLength(1, key) +
34431 ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
34432 this.element.calculateLength(2, val);
34433
34434 // Submessage with wire type of length-delimited.
34435 buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
34436 buffer.writeVarint32(length);
34437
34438 // Write out the key and val.
34439 buffer.writeVarint32((1 << 3) | this.keyType.wireType);
34440 this.keyElement.encodeValue(1, key, buffer);
34441 buffer.writeVarint32((2 << 3) | this.type.wireType);
34442 this.element.encodeValue(2, val, buffer);
34443 }, this);
34444 } else {
34445 if (this.hasWirePresence(value, message)) {
34446 buffer.writeVarint32((this.id << 3) | this.type.wireType);
34447 this.element.encodeValue(this.id, value, buffer);
34448 }
34449 }
34450 } catch (e) {
34451 throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
34452 }
34453 return buffer;
34454 };
34455
34456 /**
34457 * Calculates the length of this field's value on the network level.
34458 * @param {*} value Field value
34459 * @param {!ProtoBuf.Builder.Message} message Runtime message
34460 * @returns {number} Byte length
34461 * @expose
34462 */
34463 FieldPrototype.calculate = function(value, message) {
34464 value = this.verifyValue(value); // May throw
34465 if (this.type === null || typeof this.type !== 'object')
34466 throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
34467 if (value === null || (this.repeated && value.length == 0))
34468 return 0; // Optional omitted
34469 var n = 0;
34470 try {
34471 if (this.repeated) {
34472 var i, ni;
34473 if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
34474 n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
34475 ni = 0;
34476 for (i=0; i<value.length; i++)
34477 ni += this.element.calculateLength(this.id, value[i]);
34478 n += ByteBuffer.calculateVarint32(ni);
34479 n += ni;
34480 } else {
34481 for (i=0; i<value.length; i++)
34482 n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType),
34483 n += this.element.calculateLength(this.id, value[i]);
34484 }
34485 } else if (this.map) {
34486 // Each map entry becomes a submessage.
34487 value.forEach(function(val, key, m) {
34488 // Compute the length of the submessage (key, val) pair.
34489 var length =
34490 ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
34491 this.keyElement.calculateLength(1, key) +
34492 ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
34493 this.element.calculateLength(2, val);
34494
34495 n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
34496 n += ByteBuffer.calculateVarint32(length);
34497 n += length;
34498 }, this);
34499 } else {
34500 if (this.hasWirePresence(value, message)) {
34501 n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType);
34502 n += this.element.calculateLength(this.id, value);
34503 }
34504 }
34505 } catch (e) {
34506 throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
34507 }
34508 return n;
34509 };
34510
34511 /**
34512 * Decode the field value from the specified buffer.
34513 * @param {number} wireType Leading wire type
34514 * @param {ByteBuffer} buffer ByteBuffer to decode from
34515 * @param {boolean=} skipRepeated Whether to skip the repeated check or not. Defaults to false.
34516 * @return {*} Decoded value: array for packed repeated fields, [key, value] for
34517 * map fields, or an individual value otherwise.
34518 * @throws {Error} If the field cannot be decoded
34519 * @expose
34520 */
34521 FieldPrototype.decode = function(wireType, buffer, skipRepeated) {
34522 var value, nBytes;
34523
34524 // We expect wireType to match the underlying type's wireType unless we see
34525 // a packed repeated field, or unless this is a map field.
34526 var wireTypeOK =
34527 (!this.map && wireType == this.type.wireType) ||
34528 (!skipRepeated && this.repeated && this.options["packed"] &&
34529 wireType == ProtoBuf.WIRE_TYPES.LDELIM) ||
34530 (this.map && wireType == ProtoBuf.WIRE_TYPES.LDELIM);
34531 if (!wireTypeOK)
34532 throw Error("Illegal wire type for field "+this.toString(true)+": "+wireType+" ("+this.type.wireType+" expected)");
34533
34534 // Handle packed repeated fields.
34535 if (wireType == ProtoBuf.WIRE_TYPES.LDELIM && this.repeated && this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
34536 if (!skipRepeated) {
34537 nBytes = buffer.readVarint32();
34538 nBytes = buffer.offset + nBytes; // Limit
34539 var values = [];
34540 while (buffer.offset < nBytes)
34541 values.push(this.decode(this.type.wireType, buffer, true));
34542 return values;
34543 }
34544 // Read the next value otherwise...
34545 }
34546
34547 // Handle maps.
34548 if (this.map) {
34549 // Read one (key, value) submessage, and return [key, value]
34550 var key = Element.defaultFieldValue(this.keyType);
34551 value = Element.defaultFieldValue(this.type);
34552
34553 // Read the length
34554 nBytes = buffer.readVarint32();
34555 if (buffer.remaining() < nBytes)
34556 throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
34557
34558 // Get a sub-buffer of this key/value submessage
34559 var msgbuf = buffer.clone();
34560 msgbuf.limit = msgbuf.offset + nBytes;
34561 buffer.offset += nBytes;
34562
34563 while (msgbuf.remaining() > 0) {
34564 var tag = msgbuf.readVarint32();
34565 wireType = tag & 0x07;
34566 var id = tag >>> 3;
34567 if (id === 1) {
34568 key = this.keyElement.decode(msgbuf, wireType, id);
34569 } else if (id === 2) {
34570 value = this.element.decode(msgbuf, wireType, id);
34571 } else {
34572 throw Error("Unexpected tag in map field key/value submessage");
34573 }
34574 }
34575
34576 return [key, value];
34577 }
34578
34579 // Handle singular and non-packed repeated field values.
34580 return this.element.decode(buffer, wireType, this.id);
34581 };
34582
34583 /**
34584 * @alias ProtoBuf.Reflect.Message.Field
34585 * @expose
34586 */
34587 Reflect.Message.Field = Field;
34588
34589 /**
34590 * Constructs a new Message ExtensionField.
34591 * @exports ProtoBuf.Reflect.Message.ExtensionField
34592 * @param {!ProtoBuf.Builder} builder Builder reference
34593 * @param {!ProtoBuf.Reflect.Message} message Message reference
34594 * @param {string} rule Rule, one of requried, optional, repeated
34595 * @param {string} type Data type, e.g. int32
34596 * @param {string} name Field name
34597 * @param {number} id Unique field id
34598 * @param {!Object.<string,*>=} options Options
34599 * @constructor
34600 * @extends ProtoBuf.Reflect.Message.Field
34601 */
34602 var ExtensionField = function(builder, message, rule, type, name, id, options) {
34603 Field.call(this, builder, message, rule, /* keytype = */ null, type, name, id, options);
34604
34605 /**
34606 * Extension reference.
34607 * @type {!ProtoBuf.Reflect.Extension}
34608 * @expose
34609 */
34610 this.extension;
34611 };
34612
34613 // Extends Field
34614 ExtensionField.prototype = Object.create(Field.prototype);
34615
34616 /**
34617 * @alias ProtoBuf.Reflect.Message.ExtensionField
34618 * @expose
34619 */
34620 Reflect.Message.ExtensionField = ExtensionField;
34621
34622 /**
34623 * Constructs a new Message OneOf.
34624 * @exports ProtoBuf.Reflect.Message.OneOf
34625 * @param {!ProtoBuf.Builder} builder Builder reference
34626 * @param {!ProtoBuf.Reflect.Message} message Message reference
34627 * @param {string} name OneOf name
34628 * @constructor
34629 * @extends ProtoBuf.Reflect.T
34630 */
34631 var OneOf = function(builder, message, name) {
34632 T.call(this, builder, message, name);
34633
34634 /**
34635 * Enclosed fields.
34636 * @type {!Array.<!ProtoBuf.Reflect.Message.Field>}
34637 * @expose
34638 */
34639 this.fields = [];
34640 };
34641
34642 /**
34643 * @alias ProtoBuf.Reflect.Message.OneOf
34644 * @expose
34645 */
34646 Reflect.Message.OneOf = OneOf;
34647
34648 /**
34649 * Constructs a new Enum.
34650 * @exports ProtoBuf.Reflect.Enum
34651 * @param {!ProtoBuf.Builder} builder Builder reference
34652 * @param {!ProtoBuf.Reflect.T} parent Parent Reflect object
34653 * @param {string} name Enum name
34654 * @param {Object.<string,*>=} options Enum options
34655 * @param {string?} syntax The syntax level (e.g., proto3)
34656 * @constructor
34657 * @extends ProtoBuf.Reflect.Namespace
34658 */
34659 var Enum = function(builder, parent, name, options, syntax) {
34660 Namespace.call(this, builder, parent, name, options, syntax);
34661
34662 /**
34663 * @override
34664 */
34665 this.className = "Enum";
34666
34667 /**
34668 * Runtime enum object.
34669 * @type {Object.<string,number>|null}
34670 * @expose
34671 */
34672 this.object = null;
34673 };
34674
34675 /**
34676 * Gets the string name of an enum value.
34677 * @param {!ProtoBuf.Builder.Enum} enm Runtime enum
34678 * @param {number} value Enum value
34679 * @returns {?string} Name or `null` if not present
34680 * @expose
34681 */
34682 Enum.getName = function(enm, value) {
34683 var keys = Object.keys(enm);
34684 for (var i=0, key; i<keys.length; ++i)
34685 if (enm[key = keys[i]] === value)
34686 return key;
34687 return null;
34688 };
34689
34690 /**
34691 * @alias ProtoBuf.Reflect.Enum.prototype
34692 * @inner
34693 */
34694 var EnumPrototype = Enum.prototype = Object.create(Namespace.prototype);
34695
34696 /**
34697 * Builds this enum and returns the runtime counterpart.
34698 * @param {boolean} rebuild Whether to rebuild or not, defaults to false
34699 * @returns {!Object.<string,number>}
34700 * @expose
34701 */
34702 EnumPrototype.build = function(rebuild) {
34703 if (this.object && !rebuild)
34704 return this.object;
34705 var enm = new ProtoBuf.Builder.Enum(),
34706 values = this.getChildren(Enum.Value);
34707 for (var i=0, k=values.length; i<k; ++i)
34708 enm[values[i]['name']] = values[i]['id'];
34709 if (Object.defineProperty)
34710 Object.defineProperty(enm, '$options', {
34711 "value": this.buildOpt(),
34712 "enumerable": false
34713 });
34714 return this.object = enm;
34715 };
34716
34717 /**
34718 * @alias ProtoBuf.Reflect.Enum
34719 * @expose
34720 */
34721 Reflect.Enum = Enum;
34722
34723 /**
34724 * Constructs a new Enum Value.
34725 * @exports ProtoBuf.Reflect.Enum.Value
34726 * @param {!ProtoBuf.Builder} builder Builder reference
34727 * @param {!ProtoBuf.Reflect.Enum} enm Enum reference
34728 * @param {string} name Field name
34729 * @param {number} id Unique field id
34730 * @constructor
34731 * @extends ProtoBuf.Reflect.T
34732 */
34733 var Value = function(builder, enm, name, id) {
34734 T.call(this, builder, enm, name);
34735
34736 /**
34737 * @override
34738 */
34739 this.className = "Enum.Value";
34740
34741 /**
34742 * Unique enum value id.
34743 * @type {number}
34744 * @expose
34745 */
34746 this.id = id;
34747 };
34748
34749 // Extends T
34750 Value.prototype = Object.create(T.prototype);
34751
34752 /**
34753 * @alias ProtoBuf.Reflect.Enum.Value
34754 * @expose
34755 */
34756 Reflect.Enum.Value = Value;
34757
34758 /**
34759 * An extension (field).
34760 * @exports ProtoBuf.Reflect.Extension
34761 * @constructor
34762 * @param {!ProtoBuf.Builder} builder Builder reference
34763 * @param {!ProtoBuf.Reflect.T} parent Parent object
34764 * @param {string} name Object name
34765 * @param {!ProtoBuf.Reflect.Message.Field} field Extension field
34766 */
34767 var Extension = function(builder, parent, name, field) {
34768 T.call(this, builder, parent, name);
34769
34770 /**
34771 * Extended message field.
34772 * @type {!ProtoBuf.Reflect.Message.Field}
34773 * @expose
34774 */
34775 this.field = field;
34776 };
34777
34778 // Extends T
34779 Extension.prototype = Object.create(T.prototype);
34780
34781 /**
34782 * @alias ProtoBuf.Reflect.Extension
34783 * @expose
34784 */
34785 Reflect.Extension = Extension;
34786
34787 /**
34788 * Constructs a new Service.
34789 * @exports ProtoBuf.Reflect.Service
34790 * @param {!ProtoBuf.Builder} builder Builder reference
34791 * @param {!ProtoBuf.Reflect.Namespace} root Root
34792 * @param {string} name Service name
34793 * @param {Object.<string,*>=} options Options
34794 * @constructor
34795 * @extends ProtoBuf.Reflect.Namespace
34796 */
34797 var Service = function(builder, root, name, options) {
34798 Namespace.call(this, builder, root, name, options);
34799
34800 /**
34801 * @override
34802 */
34803 this.className = "Service";
34804
34805 /**
34806 * Built runtime service class.
34807 * @type {?function(new:ProtoBuf.Builder.Service)}
34808 */
34809 this.clazz = null;
34810 };
34811
34812 /**
34813 * @alias ProtoBuf.Reflect.Service.prototype
34814 * @inner
34815 */
34816 var ServicePrototype = Service.prototype = Object.create(Namespace.prototype);
34817
34818 /**
34819 * Builds the service and returns the runtime counterpart, which is a fully functional class.
34820 * @see ProtoBuf.Builder.Service
34821 * @param {boolean=} rebuild Whether to rebuild or not
34822 * @return {Function} Service class
34823 * @throws {Error} If the message cannot be built
34824 * @expose
34825 */
34826 ServicePrototype.build = function(rebuild) {
34827 if (this.clazz && !rebuild)
34828 return this.clazz;
34829
34830 // Create the runtime Service class in its own scope
34831 return this.clazz = (function(ProtoBuf, T) {
34832
34833 /**
34834 * Constructs a new runtime Service.
34835 * @name ProtoBuf.Builder.Service
34836 * @param {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))=} rpcImpl RPC implementation receiving the method name and the message
34837 * @class Barebone of all runtime services.
34838 * @constructor
34839 * @throws {Error} If the service cannot be created
34840 */
34841 var Service = function(rpcImpl) {
34842 ProtoBuf.Builder.Service.call(this);
34843
34844 /**
34845 * Service implementation.
34846 * @name ProtoBuf.Builder.Service#rpcImpl
34847 * @type {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))}
34848 * @expose
34849 */
34850 this.rpcImpl = rpcImpl || function(name, msg, callback) {
34851 // This is what a user has to implement: A function receiving the method name, the actual message to
34852 // send (type checked) and the callback that's either provided with the error as its first
34853 // argument or null and the actual response message.
34854 setTimeout(callback.bind(this, Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")), 0); // Must be async!
34855 };
34856 };
34857
34858 /**
34859 * @alias ProtoBuf.Builder.Service.prototype
34860 * @inner
34861 */
34862 var ServicePrototype = Service.prototype = Object.create(ProtoBuf.Builder.Service.prototype);
34863
34864 /**
34865 * Asynchronously performs an RPC call using the given RPC implementation.
34866 * @name ProtoBuf.Builder.Service.[Method]
34867 * @function
34868 * @param {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} rpcImpl RPC implementation
34869 * @param {ProtoBuf.Builder.Message} req Request
34870 * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
34871 * the error if any and the response either as a pre-parsed message or as its raw bytes
34872 * @abstract
34873 */
34874
34875 /**
34876 * Asynchronously performs an RPC call using the instance's RPC implementation.
34877 * @name ProtoBuf.Builder.Service#[Method]
34878 * @function
34879 * @param {ProtoBuf.Builder.Message} req Request
34880 * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
34881 * the error if any and the response either as a pre-parsed message or as its raw bytes
34882 * @abstract
34883 */
34884
34885 var rpc = T.getChildren(ProtoBuf.Reflect.Service.RPCMethod);
34886 for (var i=0; i<rpc.length; i++) {
34887 (function(method) {
34888
34889 // service#Method(message, callback)
34890 ServicePrototype[method.name] = function(req, callback) {
34891 try {
34892 try {
34893 // If given as a buffer, decode the request. Will throw a TypeError if not a valid buffer.
34894 req = method.resolvedRequestType.clazz.decode(ByteBuffer.wrap(req));
34895 } catch (err) {
34896 if (!(err instanceof TypeError))
34897 throw err;
34898 }
34899 if (req === null || typeof req !== 'object')
34900 throw Error("Illegal arguments");
34901 if (!(req instanceof method.resolvedRequestType.clazz))
34902 req = new method.resolvedRequestType.clazz(req);
34903 this.rpcImpl(method.fqn(), req, function(err, res) { // Assumes that this is properly async
34904 if (err) {
34905 callback(err);
34906 return;
34907 }
34908 // Coalesce to empty string when service response has empty content
34909 if (res === null)
34910 res = ''
34911 try { res = method.resolvedResponseType.clazz.decode(res); } catch (notABuffer) {}
34912 if (!res || !(res instanceof method.resolvedResponseType.clazz)) {
34913 callback(Error("Illegal response type received in service method "+ T.name+"#"+method.name));
34914 return;
34915 }
34916 callback(null, res);
34917 });
34918 } catch (err) {
34919 setTimeout(callback.bind(this, err), 0);
34920 }
34921 };
34922
34923 // Service.Method(rpcImpl, message, callback)
34924 Service[method.name] = function(rpcImpl, req, callback) {
34925 new Service(rpcImpl)[method.name](req, callback);
34926 };
34927
34928 if (Object.defineProperty)
34929 Object.defineProperty(Service[method.name], "$options", { "value": method.buildOpt() }),
34930 Object.defineProperty(ServicePrototype[method.name], "$options", { "value": Service[method.name]["$options"] });
34931 })(rpc[i]);
34932 }
34933
34934 // Properties
34935
34936 /**
34937 * Service options.
34938 * @name ProtoBuf.Builder.Service.$options
34939 * @type {Object.<string,*>}
34940 * @expose
34941 */
34942 var $optionsS; // cc needs this
34943
34944 /**
34945 * Service options.
34946 * @name ProtoBuf.Builder.Service#$options
34947 * @type {Object.<string,*>}
34948 * @expose
34949 */
34950 var $options;
34951
34952 /**
34953 * Reflection type.
34954 * @name ProtoBuf.Builder.Service.$type
34955 * @type {!ProtoBuf.Reflect.Service}
34956 * @expose
34957 */
34958 var $typeS;
34959
34960 /**
34961 * Reflection type.
34962 * @name ProtoBuf.Builder.Service#$type
34963 * @type {!ProtoBuf.Reflect.Service}
34964 * @expose
34965 */
34966 var $type;
34967
34968 if (Object.defineProperty)
34969 Object.defineProperty(Service, "$options", { "value": T.buildOpt() }),
34970 Object.defineProperty(ServicePrototype, "$options", { "value": Service["$options"] }),
34971 Object.defineProperty(Service, "$type", { "value": T }),
34972 Object.defineProperty(ServicePrototype, "$type", { "value": T });
34973
34974 return Service;
34975
34976 })(ProtoBuf, this);
34977 };
34978
34979 /**
34980 * @alias ProtoBuf.Reflect.Service
34981 * @expose
34982 */
34983 Reflect.Service = Service;
34984
34985 /**
34986 * Abstract service method.
34987 * @exports ProtoBuf.Reflect.Service.Method
34988 * @param {!ProtoBuf.Builder} builder Builder reference
34989 * @param {!ProtoBuf.Reflect.Service} svc Service
34990 * @param {string} name Method name
34991 * @param {Object.<string,*>=} options Options
34992 * @constructor
34993 * @extends ProtoBuf.Reflect.T
34994 */
34995 var Method = function(builder, svc, name, options) {
34996 T.call(this, builder, svc, name);
34997
34998 /**
34999 * @override
35000 */
35001 this.className = "Service.Method";
35002
35003 /**
35004 * Options.
35005 * @type {Object.<string, *>}
35006 * @expose
35007 */
35008 this.options = options || {};
35009 };
35010
35011 /**
35012 * @alias ProtoBuf.Reflect.Service.Method.prototype
35013 * @inner
35014 */
35015 var MethodPrototype = Method.prototype = Object.create(T.prototype);
35016
35017 /**
35018 * Builds the method's '$options' property.
35019 * @name ProtoBuf.Reflect.Service.Method#buildOpt
35020 * @function
35021 * @return {Object.<string,*>}
35022 */
35023 MethodPrototype.buildOpt = NamespacePrototype.buildOpt;
35024
35025 /**
35026 * @alias ProtoBuf.Reflect.Service.Method
35027 * @expose
35028 */
35029 Reflect.Service.Method = Method;
35030
35031 /**
35032 * RPC service method.
35033 * @exports ProtoBuf.Reflect.Service.RPCMethod
35034 * @param {!ProtoBuf.Builder} builder Builder reference
35035 * @param {!ProtoBuf.Reflect.Service} svc Service
35036 * @param {string} name Method name
35037 * @param {string} request Request message name
35038 * @param {string} response Response message name
35039 * @param {boolean} request_stream Whether requests are streamed
35040 * @param {boolean} response_stream Whether responses are streamed
35041 * @param {Object.<string,*>=} options Options
35042 * @constructor
35043 * @extends ProtoBuf.Reflect.Service.Method
35044 */
35045 var RPCMethod = function(builder, svc, name, request, response, request_stream, response_stream, options) {
35046 Method.call(this, builder, svc, name, options);
35047
35048 /**
35049 * @override
35050 */
35051 this.className = "Service.RPCMethod";
35052
35053 /**
35054 * Request message name.
35055 * @type {string}
35056 * @expose
35057 */
35058 this.requestName = request;
35059
35060 /**
35061 * Response message name.
35062 * @type {string}
35063 * @expose
35064 */
35065 this.responseName = response;
35066
35067 /**
35068 * Whether requests are streamed
35069 * @type {bool}
35070 * @expose
35071 */
35072 this.requestStream = request_stream;
35073
35074 /**
35075 * Whether responses are streamed
35076 * @type {bool}
35077 * @expose
35078 */
35079 this.responseStream = response_stream;
35080
35081 /**
35082 * Resolved request message type.
35083 * @type {ProtoBuf.Reflect.Message}
35084 * @expose
35085 */
35086 this.resolvedRequestType = null;
35087
35088 /**
35089 * Resolved response message type.
35090 * @type {ProtoBuf.Reflect.Message}
35091 * @expose
35092 */
35093 this.resolvedResponseType = null;
35094 };
35095
35096 // Extends Method
35097 RPCMethod.prototype = Object.create(Method.prototype);
35098
35099 /**
35100 * @alias ProtoBuf.Reflect.Service.RPCMethod
35101 * @expose
35102 */
35103 Reflect.Service.RPCMethod = RPCMethod;
35104
35105 return Reflect;
35106
35107 })(ProtoBuf);
35108
35109 /**
35110 * @alias ProtoBuf.Builder
35111 * @expose
35112 */
35113 ProtoBuf.Builder = (function(ProtoBuf, Lang, Reflect) {
35114 "use strict";
35115
35116 /**
35117 * Constructs a new Builder.
35118 * @exports ProtoBuf.Builder
35119 * @class Provides the functionality to build protocol messages.
35120 * @param {Object.<string,*>=} options Options
35121 * @constructor
35122 */
35123 var Builder = function(options) {
35124
35125 /**
35126 * Namespace.
35127 * @type {ProtoBuf.Reflect.Namespace}
35128 * @expose
35129 */
35130 this.ns = new Reflect.Namespace(this, null, ""); // Global namespace
35131
35132 /**
35133 * Namespace pointer.
35134 * @type {ProtoBuf.Reflect.T}
35135 * @expose
35136 */
35137 this.ptr = this.ns;
35138
35139 /**
35140 * Resolved flag.
35141 * @type {boolean}
35142 * @expose
35143 */
35144 this.resolved = false;
35145
35146 /**
35147 * The current building result.
35148 * @type {Object.<string,ProtoBuf.Builder.Message|Object>|null}
35149 * @expose
35150 */
35151 this.result = null;
35152
35153 /**
35154 * Imported files.
35155 * @type {Array.<string>}
35156 * @expose
35157 */
35158 this.files = {};
35159
35160 /**
35161 * Import root override.
35162 * @type {?string}
35163 * @expose
35164 */
35165 this.importRoot = null;
35166
35167 /**
35168 * Options.
35169 * @type {!Object.<string, *>}
35170 * @expose
35171 */
35172 this.options = options || {};
35173 };
35174
35175 /**
35176 * @alias ProtoBuf.Builder.prototype
35177 * @inner
35178 */
35179 var BuilderPrototype = Builder.prototype;
35180
35181 // ----- Definition tests -----
35182
35183 /**
35184 * Tests if a definition most likely describes a message.
35185 * @param {!Object} def
35186 * @returns {boolean}
35187 * @expose
35188 */
35189 Builder.isMessage = function(def) {
35190 // Messages require a string name
35191 if (typeof def["name"] !== 'string')
35192 return false;
35193 // Messages do not contain values (enum) or rpc methods (service)
35194 if (typeof def["values"] !== 'undefined' || typeof def["rpc"] !== 'undefined')
35195 return false;
35196 return true;
35197 };
35198
35199 /**
35200 * Tests if a definition most likely describes a message field.
35201 * @param {!Object} def
35202 * @returns {boolean}
35203 * @expose
35204 */
35205 Builder.isMessageField = function(def) {
35206 // Message fields require a string rule, name and type and an id
35207 if (typeof def["rule"] !== 'string' || typeof def["name"] !== 'string' || typeof def["type"] !== 'string' || typeof def["id"] === 'undefined')
35208 return false;
35209 return true;
35210 };
35211
35212 /**
35213 * Tests if a definition most likely describes an enum.
35214 * @param {!Object} def
35215 * @returns {boolean}
35216 * @expose
35217 */
35218 Builder.isEnum = function(def) {
35219 // Enums require a string name
35220 if (typeof def["name"] !== 'string')
35221 return false;
35222 // Enums require at least one value
35223 if (typeof def["values"] === 'undefined' || !Array.isArray(def["values"]) || def["values"].length === 0)
35224 return false;
35225 return true;
35226 };
35227
35228 /**
35229 * Tests if a definition most likely describes a service.
35230 * @param {!Object} def
35231 * @returns {boolean}
35232 * @expose
35233 */
35234 Builder.isService = function(def) {
35235 // Services require a string name and an rpc object
35236 if (typeof def["name"] !== 'string' || typeof def["rpc"] !== 'object' || !def["rpc"])
35237 return false;
35238 return true;
35239 };
35240
35241 /**
35242 * Tests if a definition most likely describes an extended message
35243 * @param {!Object} def
35244 * @returns {boolean}
35245 * @expose
35246 */
35247 Builder.isExtend = function(def) {
35248 // Extends rquire a string ref
35249 if (typeof def["ref"] !== 'string')
35250 return false;
35251 return true;
35252 };
35253
35254 // ----- Building -----
35255
35256 /**
35257 * Resets the pointer to the root namespace.
35258 * @returns {!ProtoBuf.Builder} this
35259 * @expose
35260 */
35261 BuilderPrototype.reset = function() {
35262 this.ptr = this.ns;
35263 return this;
35264 };
35265
35266 /**
35267 * Defines a namespace on top of the current pointer position and places the pointer on it.
35268 * @param {string} namespace
35269 * @return {!ProtoBuf.Builder} this
35270 * @expose
35271 */
35272 BuilderPrototype.define = function(namespace) {
35273 if (typeof namespace !== 'string' || !Lang.TYPEREF.test(namespace))
35274 throw Error("illegal namespace: "+namespace);
35275 namespace.split(".").forEach(function(part) {
35276 var ns = this.ptr.getChild(part);
35277 if (ns === null) // Keep existing
35278 this.ptr.addChild(ns = new Reflect.Namespace(this, this.ptr, part));
35279 this.ptr = ns;
35280 }, this);
35281 return this;
35282 };
35283
35284 /**
35285 * Creates the specified definitions at the current pointer position.
35286 * @param {!Array.<!Object>} defs Messages, enums or services to create
35287 * @returns {!ProtoBuf.Builder} this
35288 * @throws {Error} If a message definition is invalid
35289 * @expose
35290 */
35291 BuilderPrototype.create = function(defs) {
35292 if (!defs)
35293 return this; // Nothing to create
35294 if (!Array.isArray(defs))
35295 defs = [defs];
35296 else {
35297 if (defs.length === 0)
35298 return this;
35299 defs = defs.slice();
35300 }
35301
35302 // It's quite hard to keep track of scopes and memory here, so let's do this iteratively.
35303 var stack = [defs];
35304 while (stack.length > 0) {
35305 defs = stack.pop();
35306
35307 if (!Array.isArray(defs)) // Stack always contains entire namespaces
35308 throw Error("not a valid namespace: "+JSON.stringify(defs));
35309
35310 while (defs.length > 0) {
35311 var def = defs.shift(); // Namespaces always contain an array of messages, enums and services
35312
35313 if (Builder.isMessage(def)) {
35314 var obj = new Reflect.Message(this, this.ptr, def["name"], def["options"], def["isGroup"], def["syntax"]);
35315
35316 // Create OneOfs
35317 var oneofs = {};
35318 if (def["oneofs"])
35319 Object.keys(def["oneofs"]).forEach(function(name) {
35320 obj.addChild(oneofs[name] = new Reflect.Message.OneOf(this, obj, name));
35321 }, this);
35322
35323 // Create fields
35324 if (def["fields"])
35325 def["fields"].forEach(function(fld) {
35326 if (obj.getChild(fld["id"]|0) !== null)
35327 throw Error("duplicate or invalid field id in "+obj.name+": "+fld['id']);
35328 if (fld["options"] && typeof fld["options"] !== 'object')
35329 throw Error("illegal field options in "+obj.name+"#"+fld["name"]);
35330 var oneof = null;
35331 if (typeof fld["oneof"] === 'string' && !(oneof = oneofs[fld["oneof"]]))
35332 throw Error("illegal oneof in "+obj.name+"#"+fld["name"]+": "+fld["oneof"]);
35333 fld = new Reflect.Message.Field(this, obj, fld["rule"], fld["keytype"], fld["type"], fld["name"], fld["id"], fld["options"], oneof, def["syntax"]);
35334 if (oneof)
35335 oneof.fields.push(fld);
35336 obj.addChild(fld);
35337 }, this);
35338
35339 // Push children to stack
35340 var subObj = [];
35341 if (def["enums"])
35342 def["enums"].forEach(function(enm) {
35343 subObj.push(enm);
35344 });
35345 if (def["messages"])
35346 def["messages"].forEach(function(msg) {
35347 subObj.push(msg);
35348 });
35349 if (def["services"])
35350 def["services"].forEach(function(svc) {
35351 subObj.push(svc);
35352 });
35353
35354 // Set extension ranges
35355 if (def["extensions"]) {
35356 if (typeof def["extensions"][0] === 'number') // pre 5.0.1
35357 obj.extensions = [ def["extensions"] ];
35358 else
35359 obj.extensions = def["extensions"];
35360 }
35361
35362 // Create on top of current namespace
35363 this.ptr.addChild(obj);
35364 if (subObj.length > 0) {
35365 stack.push(defs); // Push the current level back
35366 defs = subObj; // Continue processing sub level
35367 subObj = null;
35368 this.ptr = obj; // And move the pointer to this namespace
35369 obj = null;
35370 continue;
35371 }
35372 subObj = null;
35373
35374 } else if (Builder.isEnum(def)) {
35375
35376 obj = new Reflect.Enum(this, this.ptr, def["name"], def["options"], def["syntax"]);
35377 def["values"].forEach(function(val) {
35378 obj.addChild(new Reflect.Enum.Value(this, obj, val["name"], val["id"]));
35379 }, this);
35380 this.ptr.addChild(obj);
35381
35382 } else if (Builder.isService(def)) {
35383
35384 obj = new Reflect.Service(this, this.ptr, def["name"], def["options"]);
35385 Object.keys(def["rpc"]).forEach(function(name) {
35386 var mtd = def["rpc"][name];
35387 obj.addChild(new Reflect.Service.RPCMethod(this, obj, name, mtd["request"], mtd["response"], !!mtd["request_stream"], !!mtd["response_stream"], mtd["options"]));
35388 }, this);
35389 this.ptr.addChild(obj);
35390
35391 } else if (Builder.isExtend(def)) {
35392
35393 obj = this.ptr.resolve(def["ref"], true);
35394 if (obj) {
35395 def["fields"].forEach(function(fld) {
35396 if (obj.getChild(fld['id']|0) !== null)
35397 throw Error("duplicate extended field id in "+obj.name+": "+fld['id']);
35398 // Check if field id is allowed to be extended
35399 if (obj.extensions) {
35400 var valid = false;
35401 obj.extensions.forEach(function(range) {
35402 if (fld["id"] >= range[0] && fld["id"] <= range[1])
35403 valid = true;
35404 });
35405 if (!valid)
35406 throw Error("illegal extended field id in "+obj.name+": "+fld['id']+" (not within valid ranges)");
35407 }
35408 // Convert extension field names to camel case notation if the override is set
35409 var name = fld["name"];
35410 if (this.options['convertFieldsToCamelCase'])
35411 name = ProtoBuf.Util.toCamelCase(name);
35412 // see #161: Extensions use their fully qualified name as their runtime key and...
35413 var field = new Reflect.Message.ExtensionField(this, obj, fld["rule"], fld["type"], this.ptr.fqn()+'.'+name, fld["id"], fld["options"]);
35414 // ...are added on top of the current namespace as an extension which is used for
35415 // resolving their type later on (the extension always keeps the original name to
35416 // prevent naming collisions)
35417 var ext = new Reflect.Extension(this, this.ptr, fld["name"], field);
35418 field.extension = ext;
35419 this.ptr.addChild(ext);
35420 obj.addChild(field);
35421 }, this);
35422
35423 } else if (!/\.?google\.protobuf\./.test(def["ref"])) // Silently skip internal extensions
35424 throw Error("extended message "+def["ref"]+" is not defined");
35425
35426 } else
35427 throw Error("not a valid definition: "+JSON.stringify(def));
35428
35429 def = null;
35430 obj = null;
35431 }
35432 // Break goes here
35433 defs = null;
35434 this.ptr = this.ptr.parent; // Namespace done, continue at parent
35435 }
35436 this.resolved = false; // Require re-resolve
35437 this.result = null; // Require re-build
35438 return this;
35439 };
35440
35441 /**
35442 * Propagates syntax to all children.
35443 * @param {!Object} parent
35444 * @inner
35445 */
35446 function propagateSyntax(parent) {
35447 if (parent['messages']) {
35448 parent['messages'].forEach(function(child) {
35449 child["syntax"] = parent["syntax"];
35450 propagateSyntax(child);
35451 });
35452 }
35453 if (parent['enums']) {
35454 parent['enums'].forEach(function(child) {
35455 child["syntax"] = parent["syntax"];
35456 });
35457 }
35458 }
35459
35460 /**
35461 * Imports another definition into this builder.
35462 * @param {Object.<string,*>} json Parsed import
35463 * @param {(string|{root: string, file: string})=} filename Imported file name
35464 * @returns {!ProtoBuf.Builder} this
35465 * @throws {Error} If the definition or file cannot be imported
35466 * @expose
35467 */
35468 BuilderPrototype["import"] = function(json, filename) {
35469 var delim = '/';
35470
35471 // Make sure to skip duplicate imports
35472
35473 if (typeof filename === 'string') {
35474
35475 if (ProtoBuf.Util.IS_NODE)
35476 filename = __webpack_require__(117)['resolve'](filename);
35477 if (this.files[filename] === true)
35478 return this.reset();
35479 this.files[filename] = true;
35480
35481 } else if (typeof filename === 'object') { // Object with root, file.
35482
35483 var root = filename.root;
35484 if (ProtoBuf.Util.IS_NODE)
35485 root = __webpack_require__(117)['resolve'](root);
35486 if (root.indexOf("\\") >= 0 || filename.file.indexOf("\\") >= 0)
35487 delim = '\\';
35488 var fname;
35489 if (ProtoBuf.Util.IS_NODE)
35490 fname = __webpack_require__(117)['join'](root, filename.file);
35491 else
35492 fname = root + delim + filename.file;
35493 if (this.files[fname] === true)
35494 return this.reset();
35495 this.files[fname] = true;
35496 }
35497
35498 // Import imports
35499
35500 if (json['imports'] && json['imports'].length > 0) {
35501 var importRoot,
35502 resetRoot = false;
35503
35504 if (typeof filename === 'object') { // If an import root is specified, override
35505
35506 this.importRoot = filename["root"]; resetRoot = true; // ... and reset afterwards
35507 importRoot = this.importRoot;
35508 filename = filename["file"];
35509 if (importRoot.indexOf("\\") >= 0 || filename.indexOf("\\") >= 0)
35510 delim = '\\';
35511
35512 } else if (typeof filename === 'string') {
35513
35514 if (this.importRoot) // If import root is overridden, use it
35515 importRoot = this.importRoot;
35516 else { // Otherwise compute from filename
35517 if (filename.indexOf("/") >= 0) { // Unix
35518 importRoot = filename.replace(/\/[^\/]*$/, "");
35519 if (/* /file.proto */ importRoot === "")
35520 importRoot = "/";
35521 } else if (filename.indexOf("\\") >= 0) { // Windows
35522 importRoot = filename.replace(/\\[^\\]*$/, "");
35523 delim = '\\';
35524 } else
35525 importRoot = ".";
35526 }
35527
35528 } else
35529 importRoot = null;
35530
35531 for (var i=0; i<json['imports'].length; i++) {
35532 if (typeof json['imports'][i] === 'string') { // Import file
35533 if (!importRoot)
35534 throw Error("cannot determine import root");
35535 var importFilename = json['imports'][i];
35536 if (importFilename === "google/protobuf/descriptor.proto")
35537 continue; // Not needed and therefore not used
35538 if (ProtoBuf.Util.IS_NODE)
35539 importFilename = __webpack_require__(117)['join'](importRoot, importFilename);
35540 else
35541 importFilename = importRoot + delim + importFilename;
35542 if (this.files[importFilename] === true)
35543 continue; // Already imported
35544 if (/\.proto$/i.test(importFilename) && !ProtoBuf.DotProto) // If this is a light build
35545 importFilename = importFilename.replace(/\.proto$/, ".json"); // always load the JSON file
35546 var contents = ProtoBuf.Util.fetch(importFilename);
35547 if (contents === null)
35548 throw Error("failed to import '"+importFilename+"' in '"+filename+"': file not found");
35549 if (/\.json$/i.test(importFilename)) // Always possible
35550 this["import"](JSON.parse(contents+""), importFilename); // May throw
35551 else
35552 this["import"](ProtoBuf.DotProto.Parser.parse(contents), importFilename); // May throw
35553 } else // Import structure
35554 if (!filename)
35555 this["import"](json['imports'][i]);
35556 else if (/\.(\w+)$/.test(filename)) // With extension: Append _importN to the name portion to make it unique
35557 this["import"](json['imports'][i], filename.replace(/^(.+)\.(\w+)$/, function($0, $1, $2) { return $1+"_import"+i+"."+$2; }));
35558 else // Without extension: Append _importN to make it unique
35559 this["import"](json['imports'][i], filename+"_import"+i);
35560 }
35561 if (resetRoot) // Reset import root override when all imports are done
35562 this.importRoot = null;
35563 }
35564
35565 // Import structures
35566
35567 if (json['package'])
35568 this.define(json['package']);
35569 if (json['syntax'])
35570 propagateSyntax(json);
35571 var base = this.ptr;
35572 if (json['options'])
35573 Object.keys(json['options']).forEach(function(key) {
35574 base.options[key] = json['options'][key];
35575 });
35576 if (json['messages'])
35577 this.create(json['messages']),
35578 this.ptr = base;
35579 if (json['enums'])
35580 this.create(json['enums']),
35581 this.ptr = base;
35582 if (json['services'])
35583 this.create(json['services']),
35584 this.ptr = base;
35585 if (json['extends'])
35586 this.create(json['extends']);
35587
35588 return this.reset();
35589 };
35590
35591 /**
35592 * Resolves all namespace objects.
35593 * @throws {Error} If a type cannot be resolved
35594 * @returns {!ProtoBuf.Builder} this
35595 * @expose
35596 */
35597 BuilderPrototype.resolveAll = function() {
35598 // Resolve all reflected objects
35599 var res;
35600 if (this.ptr == null || typeof this.ptr.type === 'object')
35601 return this; // Done (already resolved)
35602
35603 if (this.ptr instanceof Reflect.Namespace) { // Resolve children
35604
35605 this.ptr.children.forEach(function(child) {
35606 this.ptr = child;
35607 this.resolveAll();
35608 }, this);
35609
35610 } else if (this.ptr instanceof Reflect.Message.Field) { // Resolve type
35611
35612 if (!Lang.TYPE.test(this.ptr.type)) {
35613 if (!Lang.TYPEREF.test(this.ptr.type))
35614 throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
35615 res = (this.ptr instanceof Reflect.Message.ExtensionField ? this.ptr.extension.parent : this.ptr.parent).resolve(this.ptr.type, true);
35616 if (!res)
35617 throw Error("unresolvable type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
35618 this.ptr.resolvedType = res;
35619 if (res instanceof Reflect.Enum) {
35620 this.ptr.type = ProtoBuf.TYPES["enum"];
35621 if (this.ptr.syntax === 'proto3' && res.syntax !== 'proto3')
35622 throw Error("proto3 message cannot reference proto2 enum");
35623 }
35624 else if (res instanceof Reflect.Message)
35625 this.ptr.type = res.isGroup ? ProtoBuf.TYPES["group"] : ProtoBuf.TYPES["message"];
35626 else
35627 throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
35628 } else
35629 this.ptr.type = ProtoBuf.TYPES[this.ptr.type];
35630
35631 // If it's a map field, also resolve the key type. The key type can be only a numeric, string, or bool type
35632 // (i.e., no enums or messages), so we don't need to resolve against the current namespace.
35633 if (this.ptr.map) {
35634 if (!Lang.TYPE.test(this.ptr.keyType))
35635 throw Error("illegal key type for map field in "+this.ptr.toString(true)+": "+this.ptr.keyType);
35636 this.ptr.keyType = ProtoBuf.TYPES[this.ptr.keyType];
35637 }
35638
35639 // If it's a repeated and packable field then proto3 mandates it should be packed by
35640 // default
35641 if (
35642 this.ptr.syntax === 'proto3' &&
35643 this.ptr.repeated && this.ptr.options.packed === undefined &&
35644 ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.ptr.type.wireType) !== -1
35645 ) {
35646 this.ptr.options.packed = true;
35647 }
35648
35649 } else if (this.ptr instanceof ProtoBuf.Reflect.Service.Method) {
35650
35651 if (this.ptr instanceof ProtoBuf.Reflect.Service.RPCMethod) {
35652 res = this.ptr.parent.resolve(this.ptr.requestName, true);
35653 if (!res || !(res instanceof ProtoBuf.Reflect.Message))
35654 throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.requestName);
35655 this.ptr.resolvedRequestType = res;
35656 res = this.ptr.parent.resolve(this.ptr.responseName, true);
35657 if (!res || !(res instanceof ProtoBuf.Reflect.Message))
35658 throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.responseName);
35659 this.ptr.resolvedResponseType = res;
35660 } else // Should not happen as nothing else is implemented
35661 throw Error("illegal service type in "+this.ptr.toString(true));
35662
35663 } else if (
35664 !(this.ptr instanceof ProtoBuf.Reflect.Message.OneOf) && // Not built
35665 !(this.ptr instanceof ProtoBuf.Reflect.Extension) && // Not built
35666 !(this.ptr instanceof ProtoBuf.Reflect.Enum.Value) // Built in enum
35667 )
35668 throw Error("illegal object in namespace: "+typeof(this.ptr)+": "+this.ptr);
35669
35670 return this.reset();
35671 };
35672
35673 /**
35674 * Builds the protocol. This will first try to resolve all definitions and, if this has been successful,
35675 * return the built package.
35676 * @param {(string|Array.<string>)=} path Specifies what to return. If omitted, the entire namespace will be returned.
35677 * @returns {!ProtoBuf.Builder.Message|!Object.<string,*>}
35678 * @throws {Error} If a type could not be resolved
35679 * @expose
35680 */
35681 BuilderPrototype.build = function(path) {
35682 this.reset();
35683 if (!this.resolved)
35684 this.resolveAll(),
35685 this.resolved = true,
35686 this.result = null; // Require re-build
35687 if (this.result === null) // (Re-)Build
35688 this.result = this.ns.build();
35689 if (!path)
35690 return this.result;
35691 var part = typeof path === 'string' ? path.split(".") : path,
35692 ptr = this.result; // Build namespace pointer (no hasChild etc.)
35693 for (var i=0; i<part.length; i++)
35694 if (ptr[part[i]])
35695 ptr = ptr[part[i]];
35696 else {
35697 ptr = null;
35698 break;
35699 }
35700 return ptr;
35701 };
35702
35703 /**
35704 * Similar to {@link ProtoBuf.Builder#build}, but looks up the internal reflection descriptor.
35705 * @param {string=} path Specifies what to return. If omitted, the entire namespace wiil be returned.
35706 * @param {boolean=} excludeNonNamespace Excludes non-namespace types like fields, defaults to `false`
35707 * @returns {?ProtoBuf.Reflect.T} Reflection descriptor or `null` if not found
35708 */
35709 BuilderPrototype.lookup = function(path, excludeNonNamespace) {
35710 return path ? this.ns.resolve(path, excludeNonNamespace) : this.ns;
35711 };
35712
35713 /**
35714 * Returns a string representation of this object.
35715 * @return {string} String representation as of "Builder"
35716 * @expose
35717 */
35718 BuilderPrototype.toString = function() {
35719 return "Builder";
35720 };
35721
35722 // ----- Base classes -----
35723 // Exist for the sole purpose of being able to "... instanceof ProtoBuf.Builder.Message" etc.
35724
35725 /**
35726 * @alias ProtoBuf.Builder.Message
35727 */
35728 Builder.Message = function() {};
35729
35730 /**
35731 * @alias ProtoBuf.Builder.Enum
35732 */
35733 Builder.Enum = function() {};
35734
35735 /**
35736 * @alias ProtoBuf.Builder.Message
35737 */
35738 Builder.Service = function() {};
35739
35740 return Builder;
35741
35742 })(ProtoBuf, ProtoBuf.Lang, ProtoBuf.Reflect);
35743
35744 /**
35745 * @alias ProtoBuf.Map
35746 * @expose
35747 */
35748 ProtoBuf.Map = (function(ProtoBuf, Reflect) {
35749 "use strict";
35750
35751 /**
35752 * Constructs a new Map. A Map is a container that is used to implement map
35753 * fields on message objects. It closely follows the ES6 Map API; however,
35754 * it is distinct because we do not want to depend on external polyfills or
35755 * on ES6 itself.
35756 *
35757 * @exports ProtoBuf.Map
35758 * @param {!ProtoBuf.Reflect.Field} field Map field
35759 * @param {Object.<string,*>=} contents Initial contents
35760 * @constructor
35761 */
35762 var Map = function(field, contents) {
35763 if (!field.map)
35764 throw Error("field is not a map");
35765
35766 /**
35767 * The field corresponding to this map.
35768 * @type {!ProtoBuf.Reflect.Field}
35769 */
35770 this.field = field;
35771
35772 /**
35773 * Element instance corresponding to key type.
35774 * @type {!ProtoBuf.Reflect.Element}
35775 */
35776 this.keyElem = new Reflect.Element(field.keyType, null, true, field.syntax);
35777
35778 /**
35779 * Element instance corresponding to value type.
35780 * @type {!ProtoBuf.Reflect.Element}
35781 */
35782 this.valueElem = new Reflect.Element(field.type, field.resolvedType, false, field.syntax);
35783
35784 /**
35785 * Internal map: stores mapping of (string form of key) -> (key, value)
35786 * pair.
35787 *
35788 * We provide map semantics for arbitrary key types, but we build on top
35789 * of an Object, which has only string keys. In order to avoid the need
35790 * to convert a string key back to its native type in many situations,
35791 * we store the native key value alongside the value. Thus, we only need
35792 * a one-way mapping from a key type to its string form that guarantees
35793 * uniqueness and equality (i.e., str(K1) === str(K2) if and only if K1
35794 * === K2).
35795 *
35796 * @type {!Object<string, {key: *, value: *}>}
35797 */
35798 this.map = {};
35799
35800 /**
35801 * Returns the number of elements in the map.
35802 */
35803 Object.defineProperty(this, "size", {
35804 get: function() { return Object.keys(this.map).length; }
35805 });
35806
35807 // Fill initial contents from a raw object.
35808 if (contents) {
35809 var keys = Object.keys(contents);
35810 for (var i = 0; i < keys.length; i++) {
35811 var key = this.keyElem.valueFromString(keys[i]);
35812 var val = this.valueElem.verifyValue(contents[keys[i]]);
35813 this.map[this.keyElem.valueToString(key)] =
35814 { key: key, value: val };
35815 }
35816 }
35817 };
35818
35819 var MapPrototype = Map.prototype;
35820
35821 /**
35822 * Helper: return an iterator over an array.
35823 * @param {!Array<*>} arr the array
35824 * @returns {!Object} an iterator
35825 * @inner
35826 */
35827 function arrayIterator(arr) {
35828 var idx = 0;
35829 return {
35830 next: function() {
35831 if (idx < arr.length)
35832 return { done: false, value: arr[idx++] };
35833 return { done: true };
35834 }
35835 }
35836 }
35837
35838 /**
35839 * Clears the map.
35840 */
35841 MapPrototype.clear = function() {
35842 this.map = {};
35843 };
35844
35845 /**
35846 * Deletes a particular key from the map.
35847 * @returns {boolean} Whether any entry with this key was deleted.
35848 */
35849 MapPrototype["delete"] = function(key) {
35850 var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
35851 var hadKey = keyValue in this.map;
35852 delete this.map[keyValue];
35853 return hadKey;
35854 };
35855
35856 /**
35857 * Returns an iterator over [key, value] pairs in the map.
35858 * @returns {Object} The iterator
35859 */
35860 MapPrototype.entries = function() {
35861 var entries = [];
35862 var strKeys = Object.keys(this.map);
35863 for (var i = 0, entry; i < strKeys.length; i++)
35864 entries.push([(entry=this.map[strKeys[i]]).key, entry.value]);
35865 return arrayIterator(entries);
35866 };
35867
35868 /**
35869 * Returns an iterator over keys in the map.
35870 * @returns {Object} The iterator
35871 */
35872 MapPrototype.keys = function() {
35873 var keys = [];
35874 var strKeys = Object.keys(this.map);
35875 for (var i = 0; i < strKeys.length; i++)
35876 keys.push(this.map[strKeys[i]].key);
35877 return arrayIterator(keys);
35878 };
35879
35880 /**
35881 * Returns an iterator over values in the map.
35882 * @returns {!Object} The iterator
35883 */
35884 MapPrototype.values = function() {
35885 var values = [];
35886 var strKeys = Object.keys(this.map);
35887 for (var i = 0; i < strKeys.length; i++)
35888 values.push(this.map[strKeys[i]].value);
35889 return arrayIterator(values);
35890 };
35891
35892 /**
35893 * Iterates over entries in the map, calling a function on each.
35894 * @param {function(this:*, *, *, *)} cb The callback to invoke with value, key, and map arguments.
35895 * @param {Object=} thisArg The `this` value for the callback
35896 */
35897 MapPrototype.forEach = function(cb, thisArg) {
35898 var strKeys = Object.keys(this.map);
35899 for (var i = 0, entry; i < strKeys.length; i++)
35900 cb.call(thisArg, (entry=this.map[strKeys[i]]).value, entry.key, this);
35901 };
35902
35903 /**
35904 * Sets a key in the map to the given value.
35905 * @param {*} key The key
35906 * @param {*} value The value
35907 * @returns {!ProtoBuf.Map} The map instance
35908 */
35909 MapPrototype.set = function(key, value) {
35910 var keyValue = this.keyElem.verifyValue(key);
35911 var valValue = this.valueElem.verifyValue(value);
35912 this.map[this.keyElem.valueToString(keyValue)] =
35913 { key: keyValue, value: valValue };
35914 return this;
35915 };
35916
35917 /**
35918 * Gets the value corresponding to a key in the map.
35919 * @param {*} key The key
35920 * @returns {*|undefined} The value, or `undefined` if key not present
35921 */
35922 MapPrototype.get = function(key) {
35923 var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
35924 if (!(keyValue in this.map))
35925 return undefined;
35926 return this.map[keyValue].value;
35927 };
35928
35929 /**
35930 * Determines whether the given key is present in the map.
35931 * @param {*} key The key
35932 * @returns {boolean} `true` if the key is present
35933 */
35934 MapPrototype.has = function(key) {
35935 var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
35936 return (keyValue in this.map);
35937 };
35938
35939 return Map;
35940 })(ProtoBuf, ProtoBuf.Reflect);
35941
35942
35943 /**
35944 * Constructs a new empty Builder.
35945 * @param {Object.<string,*>=} options Builder options, defaults to global options set on ProtoBuf
35946 * @return {!ProtoBuf.Builder} Builder
35947 * @expose
35948 */
35949 ProtoBuf.newBuilder = function(options) {
35950 options = options || {};
35951 if (typeof options['convertFieldsToCamelCase'] === 'undefined')
35952 options['convertFieldsToCamelCase'] = ProtoBuf.convertFieldsToCamelCase;
35953 if (typeof options['populateAccessors'] === 'undefined')
35954 options['populateAccessors'] = ProtoBuf.populateAccessors;
35955 return new ProtoBuf.Builder(options);
35956 };
35957
35958 /**
35959 * Loads a .json definition and returns the Builder.
35960 * @param {!*|string} json JSON definition
35961 * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted.
35962 * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.
35963 * @return {ProtoBuf.Builder} Builder to create new messages
35964 * @throws {Error} If the definition cannot be parsed or built
35965 * @expose
35966 */
35967 ProtoBuf.loadJson = function(json, builder, filename) {
35968 if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string'))
35969 filename = builder,
35970 builder = null;
35971 if (!builder || typeof builder !== 'object')
35972 builder = ProtoBuf.newBuilder();
35973 if (typeof json === 'string')
35974 json = JSON.parse(json);
35975 builder["import"](json, filename);
35976 builder.resolveAll();
35977 return builder;
35978 };
35979
35980 /**
35981 * Loads a .json file and returns the Builder.
35982 * @param {string|!{root: string, file: string}} filename Path to json file or an object specifying 'file' with
35983 * an overridden 'root' path for all imported files.
35984 * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and
35985 * the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the
35986 * file will be read synchronously and this function will return the Builder.
35987 * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.
35988 * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the
35989 * request has failed), else undefined
35990 * @expose
35991 */
35992 ProtoBuf.loadJsonFile = function(filename, callback, builder) {
35993 if (callback && typeof callback === 'object')
35994 builder = callback,
35995 callback = null;
35996 else if (!callback || typeof callback !== 'function')
35997 callback = null;
35998 if (callback)
35999 return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) {
36000 if (contents === null) {
36001 callback(Error("Failed to fetch file"));
36002 return;
36003 }
36004 try {
36005 callback(null, ProtoBuf.loadJson(JSON.parse(contents), builder, filename));
36006 } catch (e) {
36007 callback(e);
36008 }
36009 });
36010 var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename);
36011 return contents === null ? null : ProtoBuf.loadJson(JSON.parse(contents), builder, filename);
36012 };
36013
36014 return ProtoBuf;
36015});
36016
36017
36018/***/ }),
36019/* 613 */
36020/***/ (function(module, exports, __webpack_require__) {
36021
36022var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
36023 Copyright 2013-2014 Daniel Wirtz <dcode@dcode.io>
36024
36025 Licensed under the Apache License, Version 2.0 (the "License");
36026 you may not use this file except in compliance with the License.
36027 You may obtain a copy of the License at
36028
36029 http://www.apache.org/licenses/LICENSE-2.0
36030
36031 Unless required by applicable law or agreed to in writing, software
36032 distributed under the License is distributed on an "AS IS" BASIS,
36033 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36034 See the License for the specific language governing permissions and
36035 limitations under the License.
36036 */
36037
36038/**
36039 * @license bytebuffer.js (c) 2015 Daniel Wirtz <dcode@dcode.io>
36040 * Backing buffer: ArrayBuffer, Accessor: Uint8Array
36041 * Released under the Apache License, Version 2.0
36042 * see: https://github.com/dcodeIO/bytebuffer.js for details
36043 */
36044(function(global, factory) {
36045
36046 /* AMD */ if (true)
36047 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(614)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
36048 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
36049 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
36050 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
36051 /* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"])
36052 module['exports'] = (function() {
36053 var Long; try { Long = require("long"); } catch (e) {}
36054 return factory(Long);
36055 })();
36056 /* Global */ else
36057 (global["dcodeIO"] = global["dcodeIO"] || {})["ByteBuffer"] = factory(global["dcodeIO"]["Long"]);
36058
36059})(this, function(Long) {
36060 "use strict";
36061
36062 /**
36063 * Constructs a new ByteBuffer.
36064 * @class The swiss army knife for binary data in JavaScript.
36065 * @exports ByteBuffer
36066 * @constructor
36067 * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
36068 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
36069 * {@link ByteBuffer.DEFAULT_ENDIAN}.
36070 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
36071 * {@link ByteBuffer.DEFAULT_NOASSERT}.
36072 * @expose
36073 */
36074 var ByteBuffer = function(capacity, littleEndian, noAssert) {
36075 if (typeof capacity === 'undefined')
36076 capacity = ByteBuffer.DEFAULT_CAPACITY;
36077 if (typeof littleEndian === 'undefined')
36078 littleEndian = ByteBuffer.DEFAULT_ENDIAN;
36079 if (typeof noAssert === 'undefined')
36080 noAssert = ByteBuffer.DEFAULT_NOASSERT;
36081 if (!noAssert) {
36082 capacity = capacity | 0;
36083 if (capacity < 0)
36084 throw RangeError("Illegal capacity");
36085 littleEndian = !!littleEndian;
36086 noAssert = !!noAssert;
36087 }
36088
36089 /**
36090 * Backing ArrayBuffer.
36091 * @type {!ArrayBuffer}
36092 * @expose
36093 */
36094 this.buffer = capacity === 0 ? EMPTY_BUFFER : new ArrayBuffer(capacity);
36095
36096 /**
36097 * Uint8Array utilized to manipulate the backing buffer. Becomes `null` if the backing buffer has a capacity of `0`.
36098 * @type {?Uint8Array}
36099 * @expose
36100 */
36101 this.view = capacity === 0 ? null : new Uint8Array(this.buffer);
36102
36103 /**
36104 * Absolute read/write offset.
36105 * @type {number}
36106 * @expose
36107 * @see ByteBuffer#flip
36108 * @see ByteBuffer#clear
36109 */
36110 this.offset = 0;
36111
36112 /**
36113 * Marked offset.
36114 * @type {number}
36115 * @expose
36116 * @see ByteBuffer#mark
36117 * @see ByteBuffer#reset
36118 */
36119 this.markedOffset = -1;
36120
36121 /**
36122 * Absolute limit of the contained data. Set to the backing buffer's capacity upon allocation.
36123 * @type {number}
36124 * @expose
36125 * @see ByteBuffer#flip
36126 * @see ByteBuffer#clear
36127 */
36128 this.limit = capacity;
36129
36130 /**
36131 * Whether to use little endian byte order, defaults to `false` for big endian.
36132 * @type {boolean}
36133 * @expose
36134 */
36135 this.littleEndian = littleEndian;
36136
36137 /**
36138 * Whether to skip assertions of offsets and values, defaults to `false`.
36139 * @type {boolean}
36140 * @expose
36141 */
36142 this.noAssert = noAssert;
36143 };
36144
36145 /**
36146 * ByteBuffer version.
36147 * @type {string}
36148 * @const
36149 * @expose
36150 */
36151 ByteBuffer.VERSION = "5.0.1";
36152
36153 /**
36154 * Little endian constant that can be used instead of its boolean value. Evaluates to `true`.
36155 * @type {boolean}
36156 * @const
36157 * @expose
36158 */
36159 ByteBuffer.LITTLE_ENDIAN = true;
36160
36161 /**
36162 * Big endian constant that can be used instead of its boolean value. Evaluates to `false`.
36163 * @type {boolean}
36164 * @const
36165 * @expose
36166 */
36167 ByteBuffer.BIG_ENDIAN = false;
36168
36169 /**
36170 * Default initial capacity of `16`.
36171 * @type {number}
36172 * @expose
36173 */
36174 ByteBuffer.DEFAULT_CAPACITY = 16;
36175
36176 /**
36177 * Default endianess of `false` for big endian.
36178 * @type {boolean}
36179 * @expose
36180 */
36181 ByteBuffer.DEFAULT_ENDIAN = ByteBuffer.BIG_ENDIAN;
36182
36183 /**
36184 * Default no assertions flag of `false`.
36185 * @type {boolean}
36186 * @expose
36187 */
36188 ByteBuffer.DEFAULT_NOASSERT = false;
36189
36190 /**
36191 * A `Long` class for representing a 64-bit two's-complement integer value. May be `null` if Long.js has not been loaded
36192 * and int64 support is not available.
36193 * @type {?Long}
36194 * @const
36195 * @see https://github.com/dcodeIO/long.js
36196 * @expose
36197 */
36198 ByteBuffer.Long = Long || null;
36199
36200 /**
36201 * @alias ByteBuffer.prototype
36202 * @inner
36203 */
36204 var ByteBufferPrototype = ByteBuffer.prototype;
36205
36206 /**
36207 * An indicator used to reliably determine if an object is a ByteBuffer or not.
36208 * @type {boolean}
36209 * @const
36210 * @expose
36211 * @private
36212 */
36213 ByteBufferPrototype.__isByteBuffer__;
36214
36215 Object.defineProperty(ByteBufferPrototype, "__isByteBuffer__", {
36216 value: true,
36217 enumerable: false,
36218 configurable: false
36219 });
36220
36221 // helpers
36222
36223 /**
36224 * @type {!ArrayBuffer}
36225 * @inner
36226 */
36227 var EMPTY_BUFFER = new ArrayBuffer(0);
36228
36229 /**
36230 * String.fromCharCode reference for compile-time renaming.
36231 * @type {function(...number):string}
36232 * @inner
36233 */
36234 var stringFromCharCode = String.fromCharCode;
36235
36236 /**
36237 * Creates a source function for a string.
36238 * @param {string} s String to read from
36239 * @returns {function():number|null} Source function returning the next char code respectively `null` if there are
36240 * no more characters left.
36241 * @throws {TypeError} If the argument is invalid
36242 * @inner
36243 */
36244 function stringSource(s) {
36245 var i=0; return function() {
36246 return i < s.length ? s.charCodeAt(i++) : null;
36247 };
36248 }
36249
36250 /**
36251 * Creates a destination function for a string.
36252 * @returns {function(number=):undefined|string} Destination function successively called with the next char code.
36253 * Returns the final string when called without arguments.
36254 * @inner
36255 */
36256 function stringDestination() {
36257 var cs = [], ps = []; return function() {
36258 if (arguments.length === 0)
36259 return ps.join('')+stringFromCharCode.apply(String, cs);
36260 if (cs.length + arguments.length > 1024)
36261 ps.push(stringFromCharCode.apply(String, cs)),
36262 cs.length = 0;
36263 Array.prototype.push.apply(cs, arguments);
36264 };
36265 }
36266
36267 /**
36268 * Gets the accessor type.
36269 * @returns {Function} `Buffer` under node.js, `Uint8Array` respectively `DataView` in the browser (classes)
36270 * @expose
36271 */
36272 ByteBuffer.accessor = function() {
36273 return Uint8Array;
36274 };
36275 /**
36276 * Allocates a new ByteBuffer backed by a buffer of the specified capacity.
36277 * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
36278 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
36279 * {@link ByteBuffer.DEFAULT_ENDIAN}.
36280 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
36281 * {@link ByteBuffer.DEFAULT_NOASSERT}.
36282 * @returns {!ByteBuffer}
36283 * @expose
36284 */
36285 ByteBuffer.allocate = function(capacity, littleEndian, noAssert) {
36286 return new ByteBuffer(capacity, littleEndian, noAssert);
36287 };
36288
36289 /**
36290 * Concatenates multiple ByteBuffers into one.
36291 * @param {!Array.<!ByteBuffer|!ArrayBuffer|!Uint8Array|string>} buffers Buffers to concatenate
36292 * @param {(string|boolean)=} encoding String encoding if `buffers` contains a string ("base64", "hex", "binary",
36293 * defaults to "utf8")
36294 * @param {boolean=} littleEndian Whether to use little or big endian byte order for the resulting ByteBuffer. Defaults
36295 * to {@link ByteBuffer.DEFAULT_ENDIAN}.
36296 * @param {boolean=} noAssert Whether to skip assertions of offsets and values for the resulting ByteBuffer. Defaults to
36297 * {@link ByteBuffer.DEFAULT_NOASSERT}.
36298 * @returns {!ByteBuffer} Concatenated ByteBuffer
36299 * @expose
36300 */
36301 ByteBuffer.concat = function(buffers, encoding, littleEndian, noAssert) {
36302 if (typeof encoding === 'boolean' || typeof encoding !== 'string') {
36303 noAssert = littleEndian;
36304 littleEndian = encoding;
36305 encoding = undefined;
36306 }
36307 var capacity = 0;
36308 for (var i=0, k=buffers.length, length; i<k; ++i) {
36309 if (!ByteBuffer.isByteBuffer(buffers[i]))
36310 buffers[i] = ByteBuffer.wrap(buffers[i], encoding);
36311 length = buffers[i].limit - buffers[i].offset;
36312 if (length > 0) capacity += length;
36313 }
36314 if (capacity === 0)
36315 return new ByteBuffer(0, littleEndian, noAssert);
36316 var bb = new ByteBuffer(capacity, littleEndian, noAssert),
36317 bi;
36318 i=0; while (i<k) {
36319 bi = buffers[i++];
36320 length = bi.limit - bi.offset;
36321 if (length <= 0) continue;
36322 bb.view.set(bi.view.subarray(bi.offset, bi.limit), bb.offset);
36323 bb.offset += length;
36324 }
36325 bb.limit = bb.offset;
36326 bb.offset = 0;
36327 return bb;
36328 };
36329
36330 /**
36331 * Tests if the specified type is a ByteBuffer.
36332 * @param {*} bb ByteBuffer to test
36333 * @returns {boolean} `true` if it is a ByteBuffer, otherwise `false`
36334 * @expose
36335 */
36336 ByteBuffer.isByteBuffer = function(bb) {
36337 return (bb && bb["__isByteBuffer__"]) === true;
36338 };
36339 /**
36340 * Gets the backing buffer type.
36341 * @returns {Function} `Buffer` under node.js, `ArrayBuffer` in the browser (classes)
36342 * @expose
36343 */
36344 ByteBuffer.type = function() {
36345 return ArrayBuffer;
36346 };
36347 /**
36348 * Wraps a buffer or a string. Sets the allocated ByteBuffer's {@link ByteBuffer#offset} to `0` and its
36349 * {@link ByteBuffer#limit} to the length of the wrapped data.
36350 * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string|!Array.<number>} buffer Anything that can be wrapped
36351 * @param {(string|boolean)=} encoding String encoding if `buffer` is a string ("base64", "hex", "binary", defaults to
36352 * "utf8")
36353 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
36354 * {@link ByteBuffer.DEFAULT_ENDIAN}.
36355 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
36356 * {@link ByteBuffer.DEFAULT_NOASSERT}.
36357 * @returns {!ByteBuffer} A ByteBuffer wrapping `buffer`
36358 * @expose
36359 */
36360 ByteBuffer.wrap = function(buffer, encoding, littleEndian, noAssert) {
36361 if (typeof encoding !== 'string') {
36362 noAssert = littleEndian;
36363 littleEndian = encoding;
36364 encoding = undefined;
36365 }
36366 if (typeof buffer === 'string') {
36367 if (typeof encoding === 'undefined')
36368 encoding = "utf8";
36369 switch (encoding) {
36370 case "base64":
36371 return ByteBuffer.fromBase64(buffer, littleEndian);
36372 case "hex":
36373 return ByteBuffer.fromHex(buffer, littleEndian);
36374 case "binary":
36375 return ByteBuffer.fromBinary(buffer, littleEndian);
36376 case "utf8":
36377 return ByteBuffer.fromUTF8(buffer, littleEndian);
36378 case "debug":
36379 return ByteBuffer.fromDebug(buffer, littleEndian);
36380 default:
36381 throw Error("Unsupported encoding: "+encoding);
36382 }
36383 }
36384 if (buffer === null || typeof buffer !== 'object')
36385 throw TypeError("Illegal buffer");
36386 var bb;
36387 if (ByteBuffer.isByteBuffer(buffer)) {
36388 bb = ByteBufferPrototype.clone.call(buffer);
36389 bb.markedOffset = -1;
36390 return bb;
36391 }
36392 if (buffer instanceof Uint8Array) { // Extract ArrayBuffer from Uint8Array
36393 bb = new ByteBuffer(0, littleEndian, noAssert);
36394 if (buffer.length > 0) { // Avoid references to more than one EMPTY_BUFFER
36395 bb.buffer = buffer.buffer;
36396 bb.offset = buffer.byteOffset;
36397 bb.limit = buffer.byteOffset + buffer.byteLength;
36398 bb.view = new Uint8Array(buffer.buffer);
36399 }
36400 } else if (buffer instanceof ArrayBuffer) { // Reuse ArrayBuffer
36401 bb = new ByteBuffer(0, littleEndian, noAssert);
36402 if (buffer.byteLength > 0) {
36403 bb.buffer = buffer;
36404 bb.offset = 0;
36405 bb.limit = buffer.byteLength;
36406 bb.view = buffer.byteLength > 0 ? new Uint8Array(buffer) : null;
36407 }
36408 } else if (Object.prototype.toString.call(buffer) === "[object Array]") { // Create from octets
36409 bb = new ByteBuffer(buffer.length, littleEndian, noAssert);
36410 bb.limit = buffer.length;
36411 for (var i=0; i<buffer.length; ++i)
36412 bb.view[i] = buffer[i];
36413 } else
36414 throw TypeError("Illegal buffer"); // Otherwise fail
36415 return bb;
36416 };
36417
36418 /**
36419 * Writes the array as a bitset.
36420 * @param {Array<boolean>} value Array of booleans to write
36421 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
36422 * @returns {!ByteBuffer}
36423 * @expose
36424 */
36425 ByteBufferPrototype.writeBitSet = function(value, offset) {
36426 var relative = typeof offset === 'undefined';
36427 if (relative) offset = this.offset;
36428 if (!this.noAssert) {
36429 if (!(value instanceof Array))
36430 throw TypeError("Illegal BitSet: Not an array");
36431 if (typeof offset !== 'number' || offset % 1 !== 0)
36432 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36433 offset >>>= 0;
36434 if (offset < 0 || offset + 0 > this.buffer.byteLength)
36435 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
36436 }
36437
36438 var start = offset,
36439 bits = value.length,
36440 bytes = (bits >> 3),
36441 bit = 0,
36442 k;
36443
36444 offset += this.writeVarint32(bits,offset);
36445
36446 while(bytes--) {
36447 k = (!!value[bit++] & 1) |
36448 ((!!value[bit++] & 1) << 1) |
36449 ((!!value[bit++] & 1) << 2) |
36450 ((!!value[bit++] & 1) << 3) |
36451 ((!!value[bit++] & 1) << 4) |
36452 ((!!value[bit++] & 1) << 5) |
36453 ((!!value[bit++] & 1) << 6) |
36454 ((!!value[bit++] & 1) << 7);
36455 this.writeByte(k,offset++);
36456 }
36457
36458 if(bit < bits) {
36459 var m = 0; k = 0;
36460 while(bit < bits) k = k | ((!!value[bit++] & 1) << (m++));
36461 this.writeByte(k,offset++);
36462 }
36463
36464 if (relative) {
36465 this.offset = offset;
36466 return this;
36467 }
36468 return offset - start;
36469 }
36470
36471 /**
36472 * Reads a BitSet as an array of booleans.
36473 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
36474 * @returns {Array<boolean>
36475 * @expose
36476 */
36477 ByteBufferPrototype.readBitSet = function(offset) {
36478 var relative = typeof offset === 'undefined';
36479 if (relative) offset = this.offset;
36480
36481 var ret = this.readVarint32(offset),
36482 bits = ret.value,
36483 bytes = (bits >> 3),
36484 bit = 0,
36485 value = [],
36486 k;
36487
36488 offset += ret.length;
36489
36490 while(bytes--) {
36491 k = this.readByte(offset++);
36492 value[bit++] = !!(k & 0x01);
36493 value[bit++] = !!(k & 0x02);
36494 value[bit++] = !!(k & 0x04);
36495 value[bit++] = !!(k & 0x08);
36496 value[bit++] = !!(k & 0x10);
36497 value[bit++] = !!(k & 0x20);
36498 value[bit++] = !!(k & 0x40);
36499 value[bit++] = !!(k & 0x80);
36500 }
36501
36502 if(bit < bits) {
36503 var m = 0;
36504 k = this.readByte(offset++);
36505 while(bit < bits) value[bit++] = !!((k >> (m++)) & 1);
36506 }
36507
36508 if (relative) {
36509 this.offset = offset;
36510 }
36511 return value;
36512 }
36513 /**
36514 * Reads the specified number of bytes.
36515 * @param {number} length Number of bytes to read
36516 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
36517 * @returns {!ByteBuffer}
36518 * @expose
36519 */
36520 ByteBufferPrototype.readBytes = function(length, offset) {
36521 var relative = typeof offset === 'undefined';
36522 if (relative) offset = this.offset;
36523 if (!this.noAssert) {
36524 if (typeof offset !== 'number' || offset % 1 !== 0)
36525 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36526 offset >>>= 0;
36527 if (offset < 0 || offset + length > this.buffer.byteLength)
36528 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength);
36529 }
36530 var slice = this.slice(offset, offset + length);
36531 if (relative) this.offset += length;
36532 return slice;
36533 };
36534
36535 /**
36536 * Writes a payload of bytes. This is an alias of {@link ByteBuffer#append}.
36537 * @function
36538 * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to write. If `source` is a ByteBuffer, its offsets
36539 * will be modified according to the performed read operation.
36540 * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
36541 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
36542 * written if omitted.
36543 * @returns {!ByteBuffer} this
36544 * @expose
36545 */
36546 ByteBufferPrototype.writeBytes = ByteBufferPrototype.append;
36547
36548 // types/ints/int8
36549
36550 /**
36551 * Writes an 8bit signed integer.
36552 * @param {number} value Value to write
36553 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
36554 * @returns {!ByteBuffer} this
36555 * @expose
36556 */
36557 ByteBufferPrototype.writeInt8 = function(value, offset) {
36558 var relative = typeof offset === 'undefined';
36559 if (relative) offset = this.offset;
36560 if (!this.noAssert) {
36561 if (typeof value !== 'number' || value % 1 !== 0)
36562 throw TypeError("Illegal value: "+value+" (not an integer)");
36563 value |= 0;
36564 if (typeof offset !== 'number' || offset % 1 !== 0)
36565 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36566 offset >>>= 0;
36567 if (offset < 0 || offset + 0 > this.buffer.byteLength)
36568 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
36569 }
36570 offset += 1;
36571 var capacity0 = this.buffer.byteLength;
36572 if (offset > capacity0)
36573 this.resize((capacity0 *= 2) > offset ? capacity0 : offset);
36574 offset -= 1;
36575 this.view[offset] = value;
36576 if (relative) this.offset += 1;
36577 return this;
36578 };
36579
36580 /**
36581 * Writes an 8bit signed integer. This is an alias of {@link ByteBuffer#writeInt8}.
36582 * @function
36583 * @param {number} value Value to write
36584 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
36585 * @returns {!ByteBuffer} this
36586 * @expose
36587 */
36588 ByteBufferPrototype.writeByte = ByteBufferPrototype.writeInt8;
36589
36590 /**
36591 * Reads an 8bit signed integer.
36592 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
36593 * @returns {number} Value read
36594 * @expose
36595 */
36596 ByteBufferPrototype.readInt8 = function(offset) {
36597 var relative = typeof offset === 'undefined';
36598 if (relative) offset = this.offset;
36599 if (!this.noAssert) {
36600 if (typeof offset !== 'number' || offset % 1 !== 0)
36601 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36602 offset >>>= 0;
36603 if (offset < 0 || offset + 1 > this.buffer.byteLength)
36604 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
36605 }
36606 var value = this.view[offset];
36607 if ((value & 0x80) === 0x80) value = -(0xFF - value + 1); // Cast to signed
36608 if (relative) this.offset += 1;
36609 return value;
36610 };
36611
36612 /**
36613 * Reads an 8bit signed integer. This is an alias of {@link ByteBuffer#readInt8}.
36614 * @function
36615 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
36616 * @returns {number} Value read
36617 * @expose
36618 */
36619 ByteBufferPrototype.readByte = ByteBufferPrototype.readInt8;
36620
36621 /**
36622 * Writes an 8bit unsigned integer.
36623 * @param {number} value Value to write
36624 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
36625 * @returns {!ByteBuffer} this
36626 * @expose
36627 */
36628 ByteBufferPrototype.writeUint8 = function(value, offset) {
36629 var relative = typeof offset === 'undefined';
36630 if (relative) offset = this.offset;
36631 if (!this.noAssert) {
36632 if (typeof value !== 'number' || value % 1 !== 0)
36633 throw TypeError("Illegal value: "+value+" (not an integer)");
36634 value >>>= 0;
36635 if (typeof offset !== 'number' || offset % 1 !== 0)
36636 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36637 offset >>>= 0;
36638 if (offset < 0 || offset + 0 > this.buffer.byteLength)
36639 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
36640 }
36641 offset += 1;
36642 var capacity1 = this.buffer.byteLength;
36643 if (offset > capacity1)
36644 this.resize((capacity1 *= 2) > offset ? capacity1 : offset);
36645 offset -= 1;
36646 this.view[offset] = value;
36647 if (relative) this.offset += 1;
36648 return this;
36649 };
36650
36651 /**
36652 * Writes an 8bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint8}.
36653 * @function
36654 * @param {number} value Value to write
36655 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
36656 * @returns {!ByteBuffer} this
36657 * @expose
36658 */
36659 ByteBufferPrototype.writeUInt8 = ByteBufferPrototype.writeUint8;
36660
36661 /**
36662 * Reads an 8bit unsigned integer.
36663 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
36664 * @returns {number} Value read
36665 * @expose
36666 */
36667 ByteBufferPrototype.readUint8 = function(offset) {
36668 var relative = typeof offset === 'undefined';
36669 if (relative) offset = this.offset;
36670 if (!this.noAssert) {
36671 if (typeof offset !== 'number' || offset % 1 !== 0)
36672 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36673 offset >>>= 0;
36674 if (offset < 0 || offset + 1 > this.buffer.byteLength)
36675 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
36676 }
36677 var value = this.view[offset];
36678 if (relative) this.offset += 1;
36679 return value;
36680 };
36681
36682 /**
36683 * Reads an 8bit unsigned integer. This is an alias of {@link ByteBuffer#readUint8}.
36684 * @function
36685 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
36686 * @returns {number} Value read
36687 * @expose
36688 */
36689 ByteBufferPrototype.readUInt8 = ByteBufferPrototype.readUint8;
36690
36691 // types/ints/int16
36692
36693 /**
36694 * Writes a 16bit signed integer.
36695 * @param {number} value Value to write
36696 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
36697 * @throws {TypeError} If `offset` or `value` is not a valid number
36698 * @throws {RangeError} If `offset` is out of bounds
36699 * @expose
36700 */
36701 ByteBufferPrototype.writeInt16 = function(value, offset) {
36702 var relative = typeof offset === 'undefined';
36703 if (relative) offset = this.offset;
36704 if (!this.noAssert) {
36705 if (typeof value !== 'number' || value % 1 !== 0)
36706 throw TypeError("Illegal value: "+value+" (not an integer)");
36707 value |= 0;
36708 if (typeof offset !== 'number' || offset % 1 !== 0)
36709 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36710 offset >>>= 0;
36711 if (offset < 0 || offset + 0 > this.buffer.byteLength)
36712 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
36713 }
36714 offset += 2;
36715 var capacity2 = this.buffer.byteLength;
36716 if (offset > capacity2)
36717 this.resize((capacity2 *= 2) > offset ? capacity2 : offset);
36718 offset -= 2;
36719 if (this.littleEndian) {
36720 this.view[offset+1] = (value & 0xFF00) >>> 8;
36721 this.view[offset ] = value & 0x00FF;
36722 } else {
36723 this.view[offset] = (value & 0xFF00) >>> 8;
36724 this.view[offset+1] = value & 0x00FF;
36725 }
36726 if (relative) this.offset += 2;
36727 return this;
36728 };
36729
36730 /**
36731 * Writes a 16bit signed integer. This is an alias of {@link ByteBuffer#writeInt16}.
36732 * @function
36733 * @param {number} value Value to write
36734 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
36735 * @throws {TypeError} If `offset` or `value` is not a valid number
36736 * @throws {RangeError} If `offset` is out of bounds
36737 * @expose
36738 */
36739 ByteBufferPrototype.writeShort = ByteBufferPrototype.writeInt16;
36740
36741 /**
36742 * Reads a 16bit signed integer.
36743 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
36744 * @returns {number} Value read
36745 * @throws {TypeError} If `offset` is not a valid number
36746 * @throws {RangeError} If `offset` is out of bounds
36747 * @expose
36748 */
36749 ByteBufferPrototype.readInt16 = function(offset) {
36750 var relative = typeof offset === 'undefined';
36751 if (relative) offset = this.offset;
36752 if (!this.noAssert) {
36753 if (typeof offset !== 'number' || offset % 1 !== 0)
36754 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36755 offset >>>= 0;
36756 if (offset < 0 || offset + 2 > this.buffer.byteLength)
36757 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength);
36758 }
36759 var value = 0;
36760 if (this.littleEndian) {
36761 value = this.view[offset ];
36762 value |= this.view[offset+1] << 8;
36763 } else {
36764 value = this.view[offset ] << 8;
36765 value |= this.view[offset+1];
36766 }
36767 if ((value & 0x8000) === 0x8000) value = -(0xFFFF - value + 1); // Cast to signed
36768 if (relative) this.offset += 2;
36769 return value;
36770 };
36771
36772 /**
36773 * Reads a 16bit signed integer. This is an alias of {@link ByteBuffer#readInt16}.
36774 * @function
36775 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
36776 * @returns {number} Value read
36777 * @throws {TypeError} If `offset` is not a valid number
36778 * @throws {RangeError} If `offset` is out of bounds
36779 * @expose
36780 */
36781 ByteBufferPrototype.readShort = ByteBufferPrototype.readInt16;
36782
36783 /**
36784 * Writes a 16bit unsigned integer.
36785 * @param {number} value Value to write
36786 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
36787 * @throws {TypeError} If `offset` or `value` is not a valid number
36788 * @throws {RangeError} If `offset` is out of bounds
36789 * @expose
36790 */
36791 ByteBufferPrototype.writeUint16 = function(value, offset) {
36792 var relative = typeof offset === 'undefined';
36793 if (relative) offset = this.offset;
36794 if (!this.noAssert) {
36795 if (typeof value !== 'number' || value % 1 !== 0)
36796 throw TypeError("Illegal value: "+value+" (not an integer)");
36797 value >>>= 0;
36798 if (typeof offset !== 'number' || offset % 1 !== 0)
36799 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36800 offset >>>= 0;
36801 if (offset < 0 || offset + 0 > this.buffer.byteLength)
36802 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
36803 }
36804 offset += 2;
36805 var capacity3 = this.buffer.byteLength;
36806 if (offset > capacity3)
36807 this.resize((capacity3 *= 2) > offset ? capacity3 : offset);
36808 offset -= 2;
36809 if (this.littleEndian) {
36810 this.view[offset+1] = (value & 0xFF00) >>> 8;
36811 this.view[offset ] = value & 0x00FF;
36812 } else {
36813 this.view[offset] = (value & 0xFF00) >>> 8;
36814 this.view[offset+1] = value & 0x00FF;
36815 }
36816 if (relative) this.offset += 2;
36817 return this;
36818 };
36819
36820 /**
36821 * Writes a 16bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint16}.
36822 * @function
36823 * @param {number} value Value to write
36824 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
36825 * @throws {TypeError} If `offset` or `value` is not a valid number
36826 * @throws {RangeError} If `offset` is out of bounds
36827 * @expose
36828 */
36829 ByteBufferPrototype.writeUInt16 = ByteBufferPrototype.writeUint16;
36830
36831 /**
36832 * Reads a 16bit unsigned integer.
36833 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
36834 * @returns {number} Value read
36835 * @throws {TypeError} If `offset` is not a valid number
36836 * @throws {RangeError} If `offset` is out of bounds
36837 * @expose
36838 */
36839 ByteBufferPrototype.readUint16 = function(offset) {
36840 var relative = typeof offset === 'undefined';
36841 if (relative) offset = this.offset;
36842 if (!this.noAssert) {
36843 if (typeof offset !== 'number' || offset % 1 !== 0)
36844 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36845 offset >>>= 0;
36846 if (offset < 0 || offset + 2 > this.buffer.byteLength)
36847 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength);
36848 }
36849 var value = 0;
36850 if (this.littleEndian) {
36851 value = this.view[offset ];
36852 value |= this.view[offset+1] << 8;
36853 } else {
36854 value = this.view[offset ] << 8;
36855 value |= this.view[offset+1];
36856 }
36857 if (relative) this.offset += 2;
36858 return value;
36859 };
36860
36861 /**
36862 * Reads a 16bit unsigned integer. This is an alias of {@link ByteBuffer#readUint16}.
36863 * @function
36864 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
36865 * @returns {number} Value read
36866 * @throws {TypeError} If `offset` is not a valid number
36867 * @throws {RangeError} If `offset` is out of bounds
36868 * @expose
36869 */
36870 ByteBufferPrototype.readUInt16 = ByteBufferPrototype.readUint16;
36871
36872 // types/ints/int32
36873
36874 /**
36875 * Writes a 32bit signed integer.
36876 * @param {number} value Value to write
36877 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
36878 * @expose
36879 */
36880 ByteBufferPrototype.writeInt32 = function(value, offset) {
36881 var relative = typeof offset === 'undefined';
36882 if (relative) offset = this.offset;
36883 if (!this.noAssert) {
36884 if (typeof value !== 'number' || value % 1 !== 0)
36885 throw TypeError("Illegal value: "+value+" (not an integer)");
36886 value |= 0;
36887 if (typeof offset !== 'number' || offset % 1 !== 0)
36888 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36889 offset >>>= 0;
36890 if (offset < 0 || offset + 0 > this.buffer.byteLength)
36891 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
36892 }
36893 offset += 4;
36894 var capacity4 = this.buffer.byteLength;
36895 if (offset > capacity4)
36896 this.resize((capacity4 *= 2) > offset ? capacity4 : offset);
36897 offset -= 4;
36898 if (this.littleEndian) {
36899 this.view[offset+3] = (value >>> 24) & 0xFF;
36900 this.view[offset+2] = (value >>> 16) & 0xFF;
36901 this.view[offset+1] = (value >>> 8) & 0xFF;
36902 this.view[offset ] = value & 0xFF;
36903 } else {
36904 this.view[offset ] = (value >>> 24) & 0xFF;
36905 this.view[offset+1] = (value >>> 16) & 0xFF;
36906 this.view[offset+2] = (value >>> 8) & 0xFF;
36907 this.view[offset+3] = value & 0xFF;
36908 }
36909 if (relative) this.offset += 4;
36910 return this;
36911 };
36912
36913 /**
36914 * Writes a 32bit signed integer. This is an alias of {@link ByteBuffer#writeInt32}.
36915 * @param {number} value Value to write
36916 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
36917 * @expose
36918 */
36919 ByteBufferPrototype.writeInt = ByteBufferPrototype.writeInt32;
36920
36921 /**
36922 * Reads a 32bit signed integer.
36923 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
36924 * @returns {number} Value read
36925 * @expose
36926 */
36927 ByteBufferPrototype.readInt32 = function(offset) {
36928 var relative = typeof offset === 'undefined';
36929 if (relative) offset = this.offset;
36930 if (!this.noAssert) {
36931 if (typeof offset !== 'number' || offset % 1 !== 0)
36932 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36933 offset >>>= 0;
36934 if (offset < 0 || offset + 4 > this.buffer.byteLength)
36935 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
36936 }
36937 var value = 0;
36938 if (this.littleEndian) {
36939 value = this.view[offset+2] << 16;
36940 value |= this.view[offset+1] << 8;
36941 value |= this.view[offset ];
36942 value += this.view[offset+3] << 24 >>> 0;
36943 } else {
36944 value = this.view[offset+1] << 16;
36945 value |= this.view[offset+2] << 8;
36946 value |= this.view[offset+3];
36947 value += this.view[offset ] << 24 >>> 0;
36948 }
36949 value |= 0; // Cast to signed
36950 if (relative) this.offset += 4;
36951 return value;
36952 };
36953
36954 /**
36955 * Reads a 32bit signed integer. This is an alias of {@link ByteBuffer#readInt32}.
36956 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `4` if omitted.
36957 * @returns {number} Value read
36958 * @expose
36959 */
36960 ByteBufferPrototype.readInt = ByteBufferPrototype.readInt32;
36961
36962 /**
36963 * Writes a 32bit unsigned integer.
36964 * @param {number} value Value to write
36965 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
36966 * @expose
36967 */
36968 ByteBufferPrototype.writeUint32 = function(value, offset) {
36969 var relative = typeof offset === 'undefined';
36970 if (relative) offset = this.offset;
36971 if (!this.noAssert) {
36972 if (typeof value !== 'number' || value % 1 !== 0)
36973 throw TypeError("Illegal value: "+value+" (not an integer)");
36974 value >>>= 0;
36975 if (typeof offset !== 'number' || offset % 1 !== 0)
36976 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36977 offset >>>= 0;
36978 if (offset < 0 || offset + 0 > this.buffer.byteLength)
36979 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
36980 }
36981 offset += 4;
36982 var capacity5 = this.buffer.byteLength;
36983 if (offset > capacity5)
36984 this.resize((capacity5 *= 2) > offset ? capacity5 : offset);
36985 offset -= 4;
36986 if (this.littleEndian) {
36987 this.view[offset+3] = (value >>> 24) & 0xFF;
36988 this.view[offset+2] = (value >>> 16) & 0xFF;
36989 this.view[offset+1] = (value >>> 8) & 0xFF;
36990 this.view[offset ] = value & 0xFF;
36991 } else {
36992 this.view[offset ] = (value >>> 24) & 0xFF;
36993 this.view[offset+1] = (value >>> 16) & 0xFF;
36994 this.view[offset+2] = (value >>> 8) & 0xFF;
36995 this.view[offset+3] = value & 0xFF;
36996 }
36997 if (relative) this.offset += 4;
36998 return this;
36999 };
37000
37001 /**
37002 * Writes a 32bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint32}.
37003 * @function
37004 * @param {number} value Value to write
37005 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
37006 * @expose
37007 */
37008 ByteBufferPrototype.writeUInt32 = ByteBufferPrototype.writeUint32;
37009
37010 /**
37011 * Reads a 32bit unsigned integer.
37012 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
37013 * @returns {number} Value read
37014 * @expose
37015 */
37016 ByteBufferPrototype.readUint32 = function(offset) {
37017 var relative = typeof offset === 'undefined';
37018 if (relative) offset = this.offset;
37019 if (!this.noAssert) {
37020 if (typeof offset !== 'number' || offset % 1 !== 0)
37021 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37022 offset >>>= 0;
37023 if (offset < 0 || offset + 4 > this.buffer.byteLength)
37024 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
37025 }
37026 var value = 0;
37027 if (this.littleEndian) {
37028 value = this.view[offset+2] << 16;
37029 value |= this.view[offset+1] << 8;
37030 value |= this.view[offset ];
37031 value += this.view[offset+3] << 24 >>> 0;
37032 } else {
37033 value = this.view[offset+1] << 16;
37034 value |= this.view[offset+2] << 8;
37035 value |= this.view[offset+3];
37036 value += this.view[offset ] << 24 >>> 0;
37037 }
37038 if (relative) this.offset += 4;
37039 return value;
37040 };
37041
37042 /**
37043 * Reads a 32bit unsigned integer. This is an alias of {@link ByteBuffer#readUint32}.
37044 * @function
37045 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
37046 * @returns {number} Value read
37047 * @expose
37048 */
37049 ByteBufferPrototype.readUInt32 = ByteBufferPrototype.readUint32;
37050
37051 // types/ints/int64
37052
37053 if (Long) {
37054
37055 /**
37056 * Writes a 64bit signed integer.
37057 * @param {number|!Long} value Value to write
37058 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37059 * @returns {!ByteBuffer} this
37060 * @expose
37061 */
37062 ByteBufferPrototype.writeInt64 = function(value, offset) {
37063 var relative = typeof offset === 'undefined';
37064 if (relative) offset = this.offset;
37065 if (!this.noAssert) {
37066 if (typeof value === 'number')
37067 value = Long.fromNumber(value);
37068 else if (typeof value === 'string')
37069 value = Long.fromString(value);
37070 else if (!(value && value instanceof Long))
37071 throw TypeError("Illegal value: "+value+" (not an integer or Long)");
37072 if (typeof offset !== 'number' || offset % 1 !== 0)
37073 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37074 offset >>>= 0;
37075 if (offset < 0 || offset + 0 > this.buffer.byteLength)
37076 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
37077 }
37078 if (typeof value === 'number')
37079 value = Long.fromNumber(value);
37080 else if (typeof value === 'string')
37081 value = Long.fromString(value);
37082 offset += 8;
37083 var capacity6 = this.buffer.byteLength;
37084 if (offset > capacity6)
37085 this.resize((capacity6 *= 2) > offset ? capacity6 : offset);
37086 offset -= 8;
37087 var lo = value.low,
37088 hi = value.high;
37089 if (this.littleEndian) {
37090 this.view[offset+3] = (lo >>> 24) & 0xFF;
37091 this.view[offset+2] = (lo >>> 16) & 0xFF;
37092 this.view[offset+1] = (lo >>> 8) & 0xFF;
37093 this.view[offset ] = lo & 0xFF;
37094 offset += 4;
37095 this.view[offset+3] = (hi >>> 24) & 0xFF;
37096 this.view[offset+2] = (hi >>> 16) & 0xFF;
37097 this.view[offset+1] = (hi >>> 8) & 0xFF;
37098 this.view[offset ] = hi & 0xFF;
37099 } else {
37100 this.view[offset ] = (hi >>> 24) & 0xFF;
37101 this.view[offset+1] = (hi >>> 16) & 0xFF;
37102 this.view[offset+2] = (hi >>> 8) & 0xFF;
37103 this.view[offset+3] = hi & 0xFF;
37104 offset += 4;
37105 this.view[offset ] = (lo >>> 24) & 0xFF;
37106 this.view[offset+1] = (lo >>> 16) & 0xFF;
37107 this.view[offset+2] = (lo >>> 8) & 0xFF;
37108 this.view[offset+3] = lo & 0xFF;
37109 }
37110 if (relative) this.offset += 8;
37111 return this;
37112 };
37113
37114 /**
37115 * Writes a 64bit signed integer. This is an alias of {@link ByteBuffer#writeInt64}.
37116 * @param {number|!Long} value Value to write
37117 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37118 * @returns {!ByteBuffer} this
37119 * @expose
37120 */
37121 ByteBufferPrototype.writeLong = ByteBufferPrototype.writeInt64;
37122
37123 /**
37124 * Reads a 64bit signed integer.
37125 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37126 * @returns {!Long}
37127 * @expose
37128 */
37129 ByteBufferPrototype.readInt64 = function(offset) {
37130 var relative = typeof offset === 'undefined';
37131 if (relative) offset = this.offset;
37132 if (!this.noAssert) {
37133 if (typeof offset !== 'number' || offset % 1 !== 0)
37134 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37135 offset >>>= 0;
37136 if (offset < 0 || offset + 8 > this.buffer.byteLength)
37137 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
37138 }
37139 var lo = 0,
37140 hi = 0;
37141 if (this.littleEndian) {
37142 lo = this.view[offset+2] << 16;
37143 lo |= this.view[offset+1] << 8;
37144 lo |= this.view[offset ];
37145 lo += this.view[offset+3] << 24 >>> 0;
37146 offset += 4;
37147 hi = this.view[offset+2] << 16;
37148 hi |= this.view[offset+1] << 8;
37149 hi |= this.view[offset ];
37150 hi += this.view[offset+3] << 24 >>> 0;
37151 } else {
37152 hi = this.view[offset+1] << 16;
37153 hi |= this.view[offset+2] << 8;
37154 hi |= this.view[offset+3];
37155 hi += this.view[offset ] << 24 >>> 0;
37156 offset += 4;
37157 lo = this.view[offset+1] << 16;
37158 lo |= this.view[offset+2] << 8;
37159 lo |= this.view[offset+3];
37160 lo += this.view[offset ] << 24 >>> 0;
37161 }
37162 var value = new Long(lo, hi, false);
37163 if (relative) this.offset += 8;
37164 return value;
37165 };
37166
37167 /**
37168 * Reads a 64bit signed integer. This is an alias of {@link ByteBuffer#readInt64}.
37169 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37170 * @returns {!Long}
37171 * @expose
37172 */
37173 ByteBufferPrototype.readLong = ByteBufferPrototype.readInt64;
37174
37175 /**
37176 * Writes a 64bit unsigned integer.
37177 * @param {number|!Long} value Value to write
37178 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37179 * @returns {!ByteBuffer} this
37180 * @expose
37181 */
37182 ByteBufferPrototype.writeUint64 = function(value, offset) {
37183 var relative = typeof offset === 'undefined';
37184 if (relative) offset = this.offset;
37185 if (!this.noAssert) {
37186 if (typeof value === 'number')
37187 value = Long.fromNumber(value);
37188 else if (typeof value === 'string')
37189 value = Long.fromString(value);
37190 else if (!(value && value instanceof Long))
37191 throw TypeError("Illegal value: "+value+" (not an integer or Long)");
37192 if (typeof offset !== 'number' || offset % 1 !== 0)
37193 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37194 offset >>>= 0;
37195 if (offset < 0 || offset + 0 > this.buffer.byteLength)
37196 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
37197 }
37198 if (typeof value === 'number')
37199 value = Long.fromNumber(value);
37200 else if (typeof value === 'string')
37201 value = Long.fromString(value);
37202 offset += 8;
37203 var capacity7 = this.buffer.byteLength;
37204 if (offset > capacity7)
37205 this.resize((capacity7 *= 2) > offset ? capacity7 : offset);
37206 offset -= 8;
37207 var lo = value.low,
37208 hi = value.high;
37209 if (this.littleEndian) {
37210 this.view[offset+3] = (lo >>> 24) & 0xFF;
37211 this.view[offset+2] = (lo >>> 16) & 0xFF;
37212 this.view[offset+1] = (lo >>> 8) & 0xFF;
37213 this.view[offset ] = lo & 0xFF;
37214 offset += 4;
37215 this.view[offset+3] = (hi >>> 24) & 0xFF;
37216 this.view[offset+2] = (hi >>> 16) & 0xFF;
37217 this.view[offset+1] = (hi >>> 8) & 0xFF;
37218 this.view[offset ] = hi & 0xFF;
37219 } else {
37220 this.view[offset ] = (hi >>> 24) & 0xFF;
37221 this.view[offset+1] = (hi >>> 16) & 0xFF;
37222 this.view[offset+2] = (hi >>> 8) & 0xFF;
37223 this.view[offset+3] = hi & 0xFF;
37224 offset += 4;
37225 this.view[offset ] = (lo >>> 24) & 0xFF;
37226 this.view[offset+1] = (lo >>> 16) & 0xFF;
37227 this.view[offset+2] = (lo >>> 8) & 0xFF;
37228 this.view[offset+3] = lo & 0xFF;
37229 }
37230 if (relative) this.offset += 8;
37231 return this;
37232 };
37233
37234 /**
37235 * Writes a 64bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint64}.
37236 * @function
37237 * @param {number|!Long} value Value to write
37238 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37239 * @returns {!ByteBuffer} this
37240 * @expose
37241 */
37242 ByteBufferPrototype.writeUInt64 = ByteBufferPrototype.writeUint64;
37243
37244 /**
37245 * Reads a 64bit unsigned integer.
37246 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37247 * @returns {!Long}
37248 * @expose
37249 */
37250 ByteBufferPrototype.readUint64 = function(offset) {
37251 var relative = typeof offset === 'undefined';
37252 if (relative) offset = this.offset;
37253 if (!this.noAssert) {
37254 if (typeof offset !== 'number' || offset % 1 !== 0)
37255 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37256 offset >>>= 0;
37257 if (offset < 0 || offset + 8 > this.buffer.byteLength)
37258 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
37259 }
37260 var lo = 0,
37261 hi = 0;
37262 if (this.littleEndian) {
37263 lo = this.view[offset+2] << 16;
37264 lo |= this.view[offset+1] << 8;
37265 lo |= this.view[offset ];
37266 lo += this.view[offset+3] << 24 >>> 0;
37267 offset += 4;
37268 hi = this.view[offset+2] << 16;
37269 hi |= this.view[offset+1] << 8;
37270 hi |= this.view[offset ];
37271 hi += this.view[offset+3] << 24 >>> 0;
37272 } else {
37273 hi = this.view[offset+1] << 16;
37274 hi |= this.view[offset+2] << 8;
37275 hi |= this.view[offset+3];
37276 hi += this.view[offset ] << 24 >>> 0;
37277 offset += 4;
37278 lo = this.view[offset+1] << 16;
37279 lo |= this.view[offset+2] << 8;
37280 lo |= this.view[offset+3];
37281 lo += this.view[offset ] << 24 >>> 0;
37282 }
37283 var value = new Long(lo, hi, true);
37284 if (relative) this.offset += 8;
37285 return value;
37286 };
37287
37288 /**
37289 * Reads a 64bit unsigned integer. This is an alias of {@link ByteBuffer#readUint64}.
37290 * @function
37291 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37292 * @returns {!Long}
37293 * @expose
37294 */
37295 ByteBufferPrototype.readUInt64 = ByteBufferPrototype.readUint64;
37296
37297 } // Long
37298
37299
37300 // types/floats/float32
37301
37302 /*
37303 ieee754 - https://github.com/feross/ieee754
37304
37305 The MIT License (MIT)
37306
37307 Copyright (c) Feross Aboukhadijeh
37308
37309 Permission is hereby granted, free of charge, to any person obtaining a copy
37310 of this software and associated documentation files (the "Software"), to deal
37311 in the Software without restriction, including without limitation the rights
37312 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
37313 copies of the Software, and to permit persons to whom the Software is
37314 furnished to do so, subject to the following conditions:
37315
37316 The above copyright notice and this permission notice shall be included in
37317 all copies or substantial portions of the Software.
37318
37319 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
37320 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37321 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
37322 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
37323 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
37324 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
37325 THE SOFTWARE.
37326 */
37327
37328 /**
37329 * Reads an IEEE754 float from a byte array.
37330 * @param {!Array} buffer
37331 * @param {number} offset
37332 * @param {boolean} isLE
37333 * @param {number} mLen
37334 * @param {number} nBytes
37335 * @returns {number}
37336 * @inner
37337 */
37338 function ieee754_read(buffer, offset, isLE, mLen, nBytes) {
37339 var e, m,
37340 eLen = nBytes * 8 - mLen - 1,
37341 eMax = (1 << eLen) - 1,
37342 eBias = eMax >> 1,
37343 nBits = -7,
37344 i = isLE ? (nBytes - 1) : 0,
37345 d = isLE ? -1 : 1,
37346 s = buffer[offset + i];
37347
37348 i += d;
37349
37350 e = s & ((1 << (-nBits)) - 1);
37351 s >>= (-nBits);
37352 nBits += eLen;
37353 for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
37354
37355 m = e & ((1 << (-nBits)) - 1);
37356 e >>= (-nBits);
37357 nBits += mLen;
37358 for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
37359
37360 if (e === 0) {
37361 e = 1 - eBias;
37362 } else if (e === eMax) {
37363 return m ? NaN : ((s ? -1 : 1) * Infinity);
37364 } else {
37365 m = m + Math.pow(2, mLen);
37366 e = e - eBias;
37367 }
37368 return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
37369 }
37370
37371 /**
37372 * Writes an IEEE754 float to a byte array.
37373 * @param {!Array} buffer
37374 * @param {number} value
37375 * @param {number} offset
37376 * @param {boolean} isLE
37377 * @param {number} mLen
37378 * @param {number} nBytes
37379 * @inner
37380 */
37381 function ieee754_write(buffer, value, offset, isLE, mLen, nBytes) {
37382 var e, m, c,
37383 eLen = nBytes * 8 - mLen - 1,
37384 eMax = (1 << eLen) - 1,
37385 eBias = eMax >> 1,
37386 rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),
37387 i = isLE ? 0 : (nBytes - 1),
37388 d = isLE ? 1 : -1,
37389 s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
37390
37391 value = Math.abs(value);
37392
37393 if (isNaN(value) || value === Infinity) {
37394 m = isNaN(value) ? 1 : 0;
37395 e = eMax;
37396 } else {
37397 e = Math.floor(Math.log(value) / Math.LN2);
37398 if (value * (c = Math.pow(2, -e)) < 1) {
37399 e--;
37400 c *= 2;
37401 }
37402 if (e + eBias >= 1) {
37403 value += rt / c;
37404 } else {
37405 value += rt * Math.pow(2, 1 - eBias);
37406 }
37407 if (value * c >= 2) {
37408 e++;
37409 c /= 2;
37410 }
37411
37412 if (e + eBias >= eMax) {
37413 m = 0;
37414 e = eMax;
37415 } else if (e + eBias >= 1) {
37416 m = (value * c - 1) * Math.pow(2, mLen);
37417 e = e + eBias;
37418 } else {
37419 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
37420 e = 0;
37421 }
37422 }
37423
37424 for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
37425
37426 e = (e << mLen) | m;
37427 eLen += mLen;
37428 for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
37429
37430 buffer[offset + i - d] |= s * 128;
37431 }
37432
37433 /**
37434 * Writes a 32bit float.
37435 * @param {number} value Value to write
37436 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
37437 * @returns {!ByteBuffer} this
37438 * @expose
37439 */
37440 ByteBufferPrototype.writeFloat32 = function(value, offset) {
37441 var relative = typeof offset === 'undefined';
37442 if (relative) offset = this.offset;
37443 if (!this.noAssert) {
37444 if (typeof value !== 'number')
37445 throw TypeError("Illegal value: "+value+" (not a number)");
37446 if (typeof offset !== 'number' || offset % 1 !== 0)
37447 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37448 offset >>>= 0;
37449 if (offset < 0 || offset + 0 > this.buffer.byteLength)
37450 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
37451 }
37452 offset += 4;
37453 var capacity8 = this.buffer.byteLength;
37454 if (offset > capacity8)
37455 this.resize((capacity8 *= 2) > offset ? capacity8 : offset);
37456 offset -= 4;
37457 ieee754_write(this.view, value, offset, this.littleEndian, 23, 4);
37458 if (relative) this.offset += 4;
37459 return this;
37460 };
37461
37462 /**
37463 * Writes a 32bit float. This is an alias of {@link ByteBuffer#writeFloat32}.
37464 * @function
37465 * @param {number} value Value to write
37466 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
37467 * @returns {!ByteBuffer} this
37468 * @expose
37469 */
37470 ByteBufferPrototype.writeFloat = ByteBufferPrototype.writeFloat32;
37471
37472 /**
37473 * Reads a 32bit float.
37474 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
37475 * @returns {number}
37476 * @expose
37477 */
37478 ByteBufferPrototype.readFloat32 = function(offset) {
37479 var relative = typeof offset === 'undefined';
37480 if (relative) offset = this.offset;
37481 if (!this.noAssert) {
37482 if (typeof offset !== 'number' || offset % 1 !== 0)
37483 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37484 offset >>>= 0;
37485 if (offset < 0 || offset + 4 > this.buffer.byteLength)
37486 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
37487 }
37488 var value = ieee754_read(this.view, offset, this.littleEndian, 23, 4);
37489 if (relative) this.offset += 4;
37490 return value;
37491 };
37492
37493 /**
37494 * Reads a 32bit float. This is an alias of {@link ByteBuffer#readFloat32}.
37495 * @function
37496 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
37497 * @returns {number}
37498 * @expose
37499 */
37500 ByteBufferPrototype.readFloat = ByteBufferPrototype.readFloat32;
37501
37502 // types/floats/float64
37503
37504 /**
37505 * Writes a 64bit float.
37506 * @param {number} value Value to write
37507 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37508 * @returns {!ByteBuffer} this
37509 * @expose
37510 */
37511 ByteBufferPrototype.writeFloat64 = function(value, offset) {
37512 var relative = typeof offset === 'undefined';
37513 if (relative) offset = this.offset;
37514 if (!this.noAssert) {
37515 if (typeof value !== 'number')
37516 throw TypeError("Illegal value: "+value+" (not a number)");
37517 if (typeof offset !== 'number' || offset % 1 !== 0)
37518 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37519 offset >>>= 0;
37520 if (offset < 0 || offset + 0 > this.buffer.byteLength)
37521 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
37522 }
37523 offset += 8;
37524 var capacity9 = this.buffer.byteLength;
37525 if (offset > capacity9)
37526 this.resize((capacity9 *= 2) > offset ? capacity9 : offset);
37527 offset -= 8;
37528 ieee754_write(this.view, value, offset, this.littleEndian, 52, 8);
37529 if (relative) this.offset += 8;
37530 return this;
37531 };
37532
37533 /**
37534 * Writes a 64bit float. This is an alias of {@link ByteBuffer#writeFloat64}.
37535 * @function
37536 * @param {number} value Value to write
37537 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37538 * @returns {!ByteBuffer} this
37539 * @expose
37540 */
37541 ByteBufferPrototype.writeDouble = ByteBufferPrototype.writeFloat64;
37542
37543 /**
37544 * Reads a 64bit float.
37545 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37546 * @returns {number}
37547 * @expose
37548 */
37549 ByteBufferPrototype.readFloat64 = function(offset) {
37550 var relative = typeof offset === 'undefined';
37551 if (relative) offset = this.offset;
37552 if (!this.noAssert) {
37553 if (typeof offset !== 'number' || offset % 1 !== 0)
37554 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37555 offset >>>= 0;
37556 if (offset < 0 || offset + 8 > this.buffer.byteLength)
37557 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
37558 }
37559 var value = ieee754_read(this.view, offset, this.littleEndian, 52, 8);
37560 if (relative) this.offset += 8;
37561 return value;
37562 };
37563
37564 /**
37565 * Reads a 64bit float. This is an alias of {@link ByteBuffer#readFloat64}.
37566 * @function
37567 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37568 * @returns {number}
37569 * @expose
37570 */
37571 ByteBufferPrototype.readDouble = ByteBufferPrototype.readFloat64;
37572
37573
37574 // types/varints/varint32
37575
37576 /**
37577 * Maximum number of bytes required to store a 32bit base 128 variable-length integer.
37578 * @type {number}
37579 * @const
37580 * @expose
37581 */
37582 ByteBuffer.MAX_VARINT32_BYTES = 5;
37583
37584 /**
37585 * Calculates the actual number of bytes required to store a 32bit base 128 variable-length integer.
37586 * @param {number} value Value to encode
37587 * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT32_BYTES}
37588 * @expose
37589 */
37590 ByteBuffer.calculateVarint32 = function(value) {
37591 // ref: src/google/protobuf/io/coded_stream.cc
37592 value = value >>> 0;
37593 if (value < 1 << 7 ) return 1;
37594 else if (value < 1 << 14) return 2;
37595 else if (value < 1 << 21) return 3;
37596 else if (value < 1 << 28) return 4;
37597 else return 5;
37598 };
37599
37600 /**
37601 * Zigzag encodes a signed 32bit integer so that it can be effectively used with varint encoding.
37602 * @param {number} n Signed 32bit integer
37603 * @returns {number} Unsigned zigzag encoded 32bit integer
37604 * @expose
37605 */
37606 ByteBuffer.zigZagEncode32 = function(n) {
37607 return (((n |= 0) << 1) ^ (n >> 31)) >>> 0; // ref: src/google/protobuf/wire_format_lite.h
37608 };
37609
37610 /**
37611 * Decodes a zigzag encoded signed 32bit integer.
37612 * @param {number} n Unsigned zigzag encoded 32bit integer
37613 * @returns {number} Signed 32bit integer
37614 * @expose
37615 */
37616 ByteBuffer.zigZagDecode32 = function(n) {
37617 return ((n >>> 1) ^ -(n & 1)) | 0; // // ref: src/google/protobuf/wire_format_lite.h
37618 };
37619
37620 /**
37621 * Writes a 32bit base 128 variable-length integer.
37622 * @param {number} value Value to write
37623 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
37624 * written if omitted.
37625 * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written
37626 * @expose
37627 */
37628 ByteBufferPrototype.writeVarint32 = function(value, offset) {
37629 var relative = typeof offset === 'undefined';
37630 if (relative) offset = this.offset;
37631 if (!this.noAssert) {
37632 if (typeof value !== 'number' || value % 1 !== 0)
37633 throw TypeError("Illegal value: "+value+" (not an integer)");
37634 value |= 0;
37635 if (typeof offset !== 'number' || offset % 1 !== 0)
37636 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37637 offset >>>= 0;
37638 if (offset < 0 || offset + 0 > this.buffer.byteLength)
37639 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
37640 }
37641 var size = ByteBuffer.calculateVarint32(value),
37642 b;
37643 offset += size;
37644 var capacity10 = this.buffer.byteLength;
37645 if (offset > capacity10)
37646 this.resize((capacity10 *= 2) > offset ? capacity10 : offset);
37647 offset -= size;
37648 value >>>= 0;
37649 while (value >= 0x80) {
37650 b = (value & 0x7f) | 0x80;
37651 this.view[offset++] = b;
37652 value >>>= 7;
37653 }
37654 this.view[offset++] = value;
37655 if (relative) {
37656 this.offset = offset;
37657 return this;
37658 }
37659 return size;
37660 };
37661
37662 /**
37663 * Writes a zig-zag encoded (signed) 32bit base 128 variable-length integer.
37664 * @param {number} value Value to write
37665 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
37666 * written if omitted.
37667 * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written
37668 * @expose
37669 */
37670 ByteBufferPrototype.writeVarint32ZigZag = function(value, offset) {
37671 return this.writeVarint32(ByteBuffer.zigZagEncode32(value), offset);
37672 };
37673
37674 /**
37675 * Reads a 32bit base 128 variable-length integer.
37676 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
37677 * written if omitted.
37678 * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read
37679 * and the actual number of bytes read.
37680 * @throws {Error} If it's not a valid varint. Has a property `truncated = true` if there is not enough data available
37681 * to fully decode the varint.
37682 * @expose
37683 */
37684 ByteBufferPrototype.readVarint32 = function(offset) {
37685 var relative = typeof offset === 'undefined';
37686 if (relative) offset = this.offset;
37687 if (!this.noAssert) {
37688 if (typeof offset !== 'number' || offset % 1 !== 0)
37689 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37690 offset >>>= 0;
37691 if (offset < 0 || offset + 1 > this.buffer.byteLength)
37692 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
37693 }
37694 var c = 0,
37695 value = 0 >>> 0,
37696 b;
37697 do {
37698 if (!this.noAssert && offset > this.limit) {
37699 var err = Error("Truncated");
37700 err['truncated'] = true;
37701 throw err;
37702 }
37703 b = this.view[offset++];
37704 if (c < 5)
37705 value |= (b & 0x7f) << (7*c);
37706 ++c;
37707 } while ((b & 0x80) !== 0);
37708 value |= 0;
37709 if (relative) {
37710 this.offset = offset;
37711 return value;
37712 }
37713 return {
37714 "value": value,
37715 "length": c
37716 };
37717 };
37718
37719 /**
37720 * Reads a zig-zag encoded (signed) 32bit base 128 variable-length integer.
37721 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
37722 * written if omitted.
37723 * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read
37724 * and the actual number of bytes read.
37725 * @throws {Error} If it's not a valid varint
37726 * @expose
37727 */
37728 ByteBufferPrototype.readVarint32ZigZag = function(offset) {
37729 var val = this.readVarint32(offset);
37730 if (typeof val === 'object')
37731 val["value"] = ByteBuffer.zigZagDecode32(val["value"]);
37732 else
37733 val = ByteBuffer.zigZagDecode32(val);
37734 return val;
37735 };
37736
37737 // types/varints/varint64
37738
37739 if (Long) {
37740
37741 /**
37742 * Maximum number of bytes required to store a 64bit base 128 variable-length integer.
37743 * @type {number}
37744 * @const
37745 * @expose
37746 */
37747 ByteBuffer.MAX_VARINT64_BYTES = 10;
37748
37749 /**
37750 * Calculates the actual number of bytes required to store a 64bit base 128 variable-length integer.
37751 * @param {number|!Long} value Value to encode
37752 * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT64_BYTES}
37753 * @expose
37754 */
37755 ByteBuffer.calculateVarint64 = function(value) {
37756 if (typeof value === 'number')
37757 value = Long.fromNumber(value);
37758 else if (typeof value === 'string')
37759 value = Long.fromString(value);
37760 // ref: src/google/protobuf/io/coded_stream.cc
37761 var part0 = value.toInt() >>> 0,
37762 part1 = value.shiftRightUnsigned(28).toInt() >>> 0,
37763 part2 = value.shiftRightUnsigned(56).toInt() >>> 0;
37764 if (part2 == 0) {
37765 if (part1 == 0) {
37766 if (part0 < 1 << 14)
37767 return part0 < 1 << 7 ? 1 : 2;
37768 else
37769 return part0 < 1 << 21 ? 3 : 4;
37770 } else {
37771 if (part1 < 1 << 14)
37772 return part1 < 1 << 7 ? 5 : 6;
37773 else
37774 return part1 < 1 << 21 ? 7 : 8;
37775 }
37776 } else
37777 return part2 < 1 << 7 ? 9 : 10;
37778 };
37779
37780 /**
37781 * Zigzag encodes a signed 64bit integer so that it can be effectively used with varint encoding.
37782 * @param {number|!Long} value Signed long
37783 * @returns {!Long} Unsigned zigzag encoded long
37784 * @expose
37785 */
37786 ByteBuffer.zigZagEncode64 = function(value) {
37787 if (typeof value === 'number')
37788 value = Long.fromNumber(value, false);
37789 else if (typeof value === 'string')
37790 value = Long.fromString(value, false);
37791 else if (value.unsigned !== false) value = value.toSigned();
37792 // ref: src/google/protobuf/wire_format_lite.h
37793 return value.shiftLeft(1).xor(value.shiftRight(63)).toUnsigned();
37794 };
37795
37796 /**
37797 * Decodes a zigzag encoded signed 64bit integer.
37798 * @param {!Long|number} value Unsigned zigzag encoded long or JavaScript number
37799 * @returns {!Long} Signed long
37800 * @expose
37801 */
37802 ByteBuffer.zigZagDecode64 = function(value) {
37803 if (typeof value === 'number')
37804 value = Long.fromNumber(value, false);
37805 else if (typeof value === 'string')
37806 value = Long.fromString(value, false);
37807 else if (value.unsigned !== false) value = value.toSigned();
37808 // ref: src/google/protobuf/wire_format_lite.h
37809 return value.shiftRightUnsigned(1).xor(value.and(Long.ONE).toSigned().negate()).toSigned();
37810 };
37811
37812 /**
37813 * Writes a 64bit base 128 variable-length integer.
37814 * @param {number|Long} value Value to write
37815 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
37816 * written if omitted.
37817 * @returns {!ByteBuffer|number} `this` if offset is omitted, else the actual number of bytes written.
37818 * @expose
37819 */
37820 ByteBufferPrototype.writeVarint64 = function(value, offset) {
37821 var relative = typeof offset === 'undefined';
37822 if (relative) offset = this.offset;
37823 if (!this.noAssert) {
37824 if (typeof value === 'number')
37825 value = Long.fromNumber(value);
37826 else if (typeof value === 'string')
37827 value = Long.fromString(value);
37828 else if (!(value && value instanceof Long))
37829 throw TypeError("Illegal value: "+value+" (not an integer or Long)");
37830 if (typeof offset !== 'number' || offset % 1 !== 0)
37831 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37832 offset >>>= 0;
37833 if (offset < 0 || offset + 0 > this.buffer.byteLength)
37834 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
37835 }
37836 if (typeof value === 'number')
37837 value = Long.fromNumber(value, false);
37838 else if (typeof value === 'string')
37839 value = Long.fromString(value, false);
37840 else if (value.unsigned !== false) value = value.toSigned();
37841 var size = ByteBuffer.calculateVarint64(value),
37842 part0 = value.toInt() >>> 0,
37843 part1 = value.shiftRightUnsigned(28).toInt() >>> 0,
37844 part2 = value.shiftRightUnsigned(56).toInt() >>> 0;
37845 offset += size;
37846 var capacity11 = this.buffer.byteLength;
37847 if (offset > capacity11)
37848 this.resize((capacity11 *= 2) > offset ? capacity11 : offset);
37849 offset -= size;
37850 switch (size) {
37851 case 10: this.view[offset+9] = (part2 >>> 7) & 0x01;
37852 case 9 : this.view[offset+8] = size !== 9 ? (part2 ) | 0x80 : (part2 ) & 0x7F;
37853 case 8 : this.view[offset+7] = size !== 8 ? (part1 >>> 21) | 0x80 : (part1 >>> 21) & 0x7F;
37854 case 7 : this.view[offset+6] = size !== 7 ? (part1 >>> 14) | 0x80 : (part1 >>> 14) & 0x7F;
37855 case 6 : this.view[offset+5] = size !== 6 ? (part1 >>> 7) | 0x80 : (part1 >>> 7) & 0x7F;
37856 case 5 : this.view[offset+4] = size !== 5 ? (part1 ) | 0x80 : (part1 ) & 0x7F;
37857 case 4 : this.view[offset+3] = size !== 4 ? (part0 >>> 21) | 0x80 : (part0 >>> 21) & 0x7F;
37858 case 3 : this.view[offset+2] = size !== 3 ? (part0 >>> 14) | 0x80 : (part0 >>> 14) & 0x7F;
37859 case 2 : this.view[offset+1] = size !== 2 ? (part0 >>> 7) | 0x80 : (part0 >>> 7) & 0x7F;
37860 case 1 : this.view[offset ] = size !== 1 ? (part0 ) | 0x80 : (part0 ) & 0x7F;
37861 }
37862 if (relative) {
37863 this.offset += size;
37864 return this;
37865 } else {
37866 return size;
37867 }
37868 };
37869
37870 /**
37871 * Writes a zig-zag encoded 64bit base 128 variable-length integer.
37872 * @param {number|Long} value Value to write
37873 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
37874 * written if omitted.
37875 * @returns {!ByteBuffer|number} `this` if offset is omitted, else the actual number of bytes written.
37876 * @expose
37877 */
37878 ByteBufferPrototype.writeVarint64ZigZag = function(value, offset) {
37879 return this.writeVarint64(ByteBuffer.zigZagEncode64(value), offset);
37880 };
37881
37882 /**
37883 * Reads a 64bit base 128 variable-length integer. Requires Long.js.
37884 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
37885 * read if omitted.
37886 * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and
37887 * the actual number of bytes read.
37888 * @throws {Error} If it's not a valid varint
37889 * @expose
37890 */
37891 ByteBufferPrototype.readVarint64 = function(offset) {
37892 var relative = typeof offset === 'undefined';
37893 if (relative) offset = this.offset;
37894 if (!this.noAssert) {
37895 if (typeof offset !== 'number' || offset % 1 !== 0)
37896 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37897 offset >>>= 0;
37898 if (offset < 0 || offset + 1 > this.buffer.byteLength)
37899 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
37900 }
37901 // ref: src/google/protobuf/io/coded_stream.cc
37902 var start = offset,
37903 part0 = 0,
37904 part1 = 0,
37905 part2 = 0,
37906 b = 0;
37907 b = this.view[offset++]; part0 = (b & 0x7F) ; if ( b & 0x80 ) {
37908 b = this.view[offset++]; part0 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
37909 b = this.view[offset++]; part0 |= (b & 0x7F) << 14; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
37910 b = this.view[offset++]; part0 |= (b & 0x7F) << 21; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
37911 b = this.view[offset++]; part1 = (b & 0x7F) ; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
37912 b = this.view[offset++]; part1 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
37913 b = this.view[offset++]; part1 |= (b & 0x7F) << 14; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
37914 b = this.view[offset++]; part1 |= (b & 0x7F) << 21; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
37915 b = this.view[offset++]; part2 = (b & 0x7F) ; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
37916 b = this.view[offset++]; part2 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
37917 throw Error("Buffer overrun"); }}}}}}}}}}
37918 var value = Long.fromBits(part0 | (part1 << 28), (part1 >>> 4) | (part2) << 24, false);
37919 if (relative) {
37920 this.offset = offset;
37921 return value;
37922 } else {
37923 return {
37924 'value': value,
37925 'length': offset-start
37926 };
37927 }
37928 };
37929
37930 /**
37931 * Reads a zig-zag encoded 64bit base 128 variable-length integer. Requires Long.js.
37932 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
37933 * read if omitted.
37934 * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and
37935 * the actual number of bytes read.
37936 * @throws {Error} If it's not a valid varint
37937 * @expose
37938 */
37939 ByteBufferPrototype.readVarint64ZigZag = function(offset) {
37940 var val = this.readVarint64(offset);
37941 if (val && val['value'] instanceof Long)
37942 val["value"] = ByteBuffer.zigZagDecode64(val["value"]);
37943 else
37944 val = ByteBuffer.zigZagDecode64(val);
37945 return val;
37946 };
37947
37948 } // Long
37949
37950
37951 // types/strings/cstring
37952
37953 /**
37954 * Writes a NULL-terminated UTF8 encoded string. For this to work the specified string must not contain any NULL
37955 * characters itself.
37956 * @param {string} str String to write
37957 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
37958 * contained in `str` + 1 if omitted.
37959 * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written
37960 * @expose
37961 */
37962 ByteBufferPrototype.writeCString = function(str, offset) {
37963 var relative = typeof offset === 'undefined';
37964 if (relative) offset = this.offset;
37965 var i,
37966 k = str.length;
37967 if (!this.noAssert) {
37968 if (typeof str !== 'string')
37969 throw TypeError("Illegal str: Not a string");
37970 for (i=0; i<k; ++i) {
37971 if (str.charCodeAt(i) === 0)
37972 throw RangeError("Illegal str: Contains NULL-characters");
37973 }
37974 if (typeof offset !== 'number' || offset % 1 !== 0)
37975 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37976 offset >>>= 0;
37977 if (offset < 0 || offset + 0 > this.buffer.byteLength)
37978 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
37979 }
37980 // UTF8 strings do not contain zero bytes in between except for the zero character, so:
37981 k = utfx.calculateUTF16asUTF8(stringSource(str))[1];
37982 offset += k+1;
37983 var capacity12 = this.buffer.byteLength;
37984 if (offset > capacity12)
37985 this.resize((capacity12 *= 2) > offset ? capacity12 : offset);
37986 offset -= k+1;
37987 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
37988 this.view[offset++] = b;
37989 }.bind(this));
37990 this.view[offset++] = 0;
37991 if (relative) {
37992 this.offset = offset;
37993 return this;
37994 }
37995 return k;
37996 };
37997
37998 /**
37999 * Reads a NULL-terminated UTF8 encoded string. For this to work the string read must not contain any NULL characters
38000 * itself.
38001 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38002 * read if omitted.
38003 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
38004 * read and the actual number of bytes read.
38005 * @expose
38006 */
38007 ByteBufferPrototype.readCString = function(offset) {
38008 var relative = typeof offset === 'undefined';
38009 if (relative) offset = this.offset;
38010 if (!this.noAssert) {
38011 if (typeof offset !== 'number' || offset % 1 !== 0)
38012 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38013 offset >>>= 0;
38014 if (offset < 0 || offset + 1 > this.buffer.byteLength)
38015 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
38016 }
38017 var start = offset,
38018 temp;
38019 // UTF8 strings do not contain zero bytes in between except for the zero character itself, so:
38020 var sd, b = -1;
38021 utfx.decodeUTF8toUTF16(function() {
38022 if (b === 0) return null;
38023 if (offset >= this.limit)
38024 throw RangeError("Illegal range: Truncated data, "+offset+" < "+this.limit);
38025 b = this.view[offset++];
38026 return b === 0 ? null : b;
38027 }.bind(this), sd = stringDestination(), true);
38028 if (relative) {
38029 this.offset = offset;
38030 return sd();
38031 } else {
38032 return {
38033 "string": sd(),
38034 "length": offset - start
38035 };
38036 }
38037 };
38038
38039 // types/strings/istring
38040
38041 /**
38042 * Writes a length as uint32 prefixed UTF8 encoded string.
38043 * @param {string} str String to write
38044 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38045 * written if omitted.
38046 * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written
38047 * @expose
38048 * @see ByteBuffer#writeVarint32
38049 */
38050 ByteBufferPrototype.writeIString = function(str, offset) {
38051 var relative = typeof offset === 'undefined';
38052 if (relative) offset = this.offset;
38053 if (!this.noAssert) {
38054 if (typeof str !== 'string')
38055 throw TypeError("Illegal str: Not a string");
38056 if (typeof offset !== 'number' || offset % 1 !== 0)
38057 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38058 offset >>>= 0;
38059 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38060 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38061 }
38062 var start = offset,
38063 k;
38064 k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1];
38065 offset += 4+k;
38066 var capacity13 = this.buffer.byteLength;
38067 if (offset > capacity13)
38068 this.resize((capacity13 *= 2) > offset ? capacity13 : offset);
38069 offset -= 4+k;
38070 if (this.littleEndian) {
38071 this.view[offset+3] = (k >>> 24) & 0xFF;
38072 this.view[offset+2] = (k >>> 16) & 0xFF;
38073 this.view[offset+1] = (k >>> 8) & 0xFF;
38074 this.view[offset ] = k & 0xFF;
38075 } else {
38076 this.view[offset ] = (k >>> 24) & 0xFF;
38077 this.view[offset+1] = (k >>> 16) & 0xFF;
38078 this.view[offset+2] = (k >>> 8) & 0xFF;
38079 this.view[offset+3] = k & 0xFF;
38080 }
38081 offset += 4;
38082 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
38083 this.view[offset++] = b;
38084 }.bind(this));
38085 if (offset !== start + 4 + k)
38086 throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+4+k));
38087 if (relative) {
38088 this.offset = offset;
38089 return this;
38090 }
38091 return offset - start;
38092 };
38093
38094 /**
38095 * Reads a length as uint32 prefixed UTF8 encoded string.
38096 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38097 * read if omitted.
38098 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
38099 * read and the actual number of bytes read.
38100 * @expose
38101 * @see ByteBuffer#readVarint32
38102 */
38103 ByteBufferPrototype.readIString = function(offset) {
38104 var relative = typeof offset === 'undefined';
38105 if (relative) offset = this.offset;
38106 if (!this.noAssert) {
38107 if (typeof offset !== 'number' || offset % 1 !== 0)
38108 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38109 offset >>>= 0;
38110 if (offset < 0 || offset + 4 > this.buffer.byteLength)
38111 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
38112 }
38113 var start = offset;
38114 var len = this.readUint32(offset);
38115 var str = this.readUTF8String(len, ByteBuffer.METRICS_BYTES, offset += 4);
38116 offset += str['length'];
38117 if (relative) {
38118 this.offset = offset;
38119 return str['string'];
38120 } else {
38121 return {
38122 'string': str['string'],
38123 'length': offset - start
38124 };
38125 }
38126 };
38127
38128 // types/strings/utf8string
38129
38130 /**
38131 * Metrics representing number of UTF8 characters. Evaluates to `c`.
38132 * @type {string}
38133 * @const
38134 * @expose
38135 */
38136 ByteBuffer.METRICS_CHARS = 'c';
38137
38138 /**
38139 * Metrics representing number of bytes. Evaluates to `b`.
38140 * @type {string}
38141 * @const
38142 * @expose
38143 */
38144 ByteBuffer.METRICS_BYTES = 'b';
38145
38146 /**
38147 * Writes an UTF8 encoded string.
38148 * @param {string} str String to write
38149 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted.
38150 * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written.
38151 * @expose
38152 */
38153 ByteBufferPrototype.writeUTF8String = function(str, offset) {
38154 var relative = typeof offset === 'undefined';
38155 if (relative) offset = this.offset;
38156 if (!this.noAssert) {
38157 if (typeof offset !== 'number' || offset % 1 !== 0)
38158 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38159 offset >>>= 0;
38160 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38161 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38162 }
38163 var k;
38164 var start = offset;
38165 k = utfx.calculateUTF16asUTF8(stringSource(str))[1];
38166 offset += k;
38167 var capacity14 = this.buffer.byteLength;
38168 if (offset > capacity14)
38169 this.resize((capacity14 *= 2) > offset ? capacity14 : offset);
38170 offset -= k;
38171 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
38172 this.view[offset++] = b;
38173 }.bind(this));
38174 if (relative) {
38175 this.offset = offset;
38176 return this;
38177 }
38178 return offset - start;
38179 };
38180
38181 /**
38182 * Writes an UTF8 encoded string. This is an alias of {@link ByteBuffer#writeUTF8String}.
38183 * @function
38184 * @param {string} str String to write
38185 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted.
38186 * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written.
38187 * @expose
38188 */
38189 ByteBufferPrototype.writeString = ByteBufferPrototype.writeUTF8String;
38190
38191 /**
38192 * Calculates the number of UTF8 characters of a string. JavaScript itself uses UTF-16, so that a string's
38193 * `length` property does not reflect its actual UTF8 size if it contains code points larger than 0xFFFF.
38194 * @param {string} str String to calculate
38195 * @returns {number} Number of UTF8 characters
38196 * @expose
38197 */
38198 ByteBuffer.calculateUTF8Chars = function(str) {
38199 return utfx.calculateUTF16asUTF8(stringSource(str))[0];
38200 };
38201
38202 /**
38203 * Calculates the number of UTF8 bytes of a string.
38204 * @param {string} str String to calculate
38205 * @returns {number} Number of UTF8 bytes
38206 * @expose
38207 */
38208 ByteBuffer.calculateUTF8Bytes = function(str) {
38209 return utfx.calculateUTF16asUTF8(stringSource(str))[1];
38210 };
38211
38212 /**
38213 * Calculates the number of UTF8 bytes of a string. This is an alias of {@link ByteBuffer.calculateUTF8Bytes}.
38214 * @function
38215 * @param {string} str String to calculate
38216 * @returns {number} Number of UTF8 bytes
38217 * @expose
38218 */
38219 ByteBuffer.calculateString = ByteBuffer.calculateUTF8Bytes;
38220
38221 /**
38222 * Reads an UTF8 encoded string.
38223 * @param {number} length Number of characters or bytes to read.
38224 * @param {string=} metrics Metrics specifying what `length` is meant to count. Defaults to
38225 * {@link ByteBuffer.METRICS_CHARS}.
38226 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38227 * read if omitted.
38228 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
38229 * read and the actual number of bytes read.
38230 * @expose
38231 */
38232 ByteBufferPrototype.readUTF8String = function(length, metrics, offset) {
38233 if (typeof metrics === 'number') {
38234 offset = metrics;
38235 metrics = undefined;
38236 }
38237 var relative = typeof offset === 'undefined';
38238 if (relative) offset = this.offset;
38239 if (typeof metrics === 'undefined') metrics = ByteBuffer.METRICS_CHARS;
38240 if (!this.noAssert) {
38241 if (typeof length !== 'number' || length % 1 !== 0)
38242 throw TypeError("Illegal length: "+length+" (not an integer)");
38243 length |= 0;
38244 if (typeof offset !== 'number' || offset % 1 !== 0)
38245 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38246 offset >>>= 0;
38247 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38248 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38249 }
38250 var i = 0,
38251 start = offset,
38252 sd;
38253 if (metrics === ByteBuffer.METRICS_CHARS) { // The same for node and the browser
38254 sd = stringDestination();
38255 utfx.decodeUTF8(function() {
38256 return i < length && offset < this.limit ? this.view[offset++] : null;
38257 }.bind(this), function(cp) {
38258 ++i; utfx.UTF8toUTF16(cp, sd);
38259 });
38260 if (i !== length)
38261 throw RangeError("Illegal range: Truncated data, "+i+" == "+length);
38262 if (relative) {
38263 this.offset = offset;
38264 return sd();
38265 } else {
38266 return {
38267 "string": sd(),
38268 "length": offset - start
38269 };
38270 }
38271 } else if (metrics === ByteBuffer.METRICS_BYTES) {
38272 if (!this.noAssert) {
38273 if (typeof offset !== 'number' || offset % 1 !== 0)
38274 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38275 offset >>>= 0;
38276 if (offset < 0 || offset + length > this.buffer.byteLength)
38277 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength);
38278 }
38279 var k = offset + length;
38280 utfx.decodeUTF8toUTF16(function() {
38281 return offset < k ? this.view[offset++] : null;
38282 }.bind(this), sd = stringDestination(), this.noAssert);
38283 if (offset !== k)
38284 throw RangeError("Illegal range: Truncated data, "+offset+" == "+k);
38285 if (relative) {
38286 this.offset = offset;
38287 return sd();
38288 } else {
38289 return {
38290 'string': sd(),
38291 'length': offset - start
38292 };
38293 }
38294 } else
38295 throw TypeError("Unsupported metrics: "+metrics);
38296 };
38297
38298 /**
38299 * Reads an UTF8 encoded string. This is an alias of {@link ByteBuffer#readUTF8String}.
38300 * @function
38301 * @param {number} length Number of characters or bytes to read
38302 * @param {number=} metrics Metrics specifying what `n` is meant to count. Defaults to
38303 * {@link ByteBuffer.METRICS_CHARS}.
38304 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38305 * read if omitted.
38306 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
38307 * read and the actual number of bytes read.
38308 * @expose
38309 */
38310 ByteBufferPrototype.readString = ByteBufferPrototype.readUTF8String;
38311
38312 // types/strings/vstring
38313
38314 /**
38315 * Writes a length as varint32 prefixed UTF8 encoded string.
38316 * @param {string} str String to write
38317 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38318 * written if omitted.
38319 * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written
38320 * @expose
38321 * @see ByteBuffer#writeVarint32
38322 */
38323 ByteBufferPrototype.writeVString = function(str, offset) {
38324 var relative = typeof offset === 'undefined';
38325 if (relative) offset = this.offset;
38326 if (!this.noAssert) {
38327 if (typeof str !== 'string')
38328 throw TypeError("Illegal str: Not a string");
38329 if (typeof offset !== 'number' || offset % 1 !== 0)
38330 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38331 offset >>>= 0;
38332 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38333 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38334 }
38335 var start = offset,
38336 k, l;
38337 k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1];
38338 l = ByteBuffer.calculateVarint32(k);
38339 offset += l+k;
38340 var capacity15 = this.buffer.byteLength;
38341 if (offset > capacity15)
38342 this.resize((capacity15 *= 2) > offset ? capacity15 : offset);
38343 offset -= l+k;
38344 offset += this.writeVarint32(k, offset);
38345 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
38346 this.view[offset++] = b;
38347 }.bind(this));
38348 if (offset !== start+k+l)
38349 throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+k+l));
38350 if (relative) {
38351 this.offset = offset;
38352 return this;
38353 }
38354 return offset - start;
38355 };
38356
38357 /**
38358 * Reads a length as varint32 prefixed UTF8 encoded string.
38359 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38360 * read if omitted.
38361 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
38362 * read and the actual number of bytes read.
38363 * @expose
38364 * @see ByteBuffer#readVarint32
38365 */
38366 ByteBufferPrototype.readVString = function(offset) {
38367 var relative = typeof offset === 'undefined';
38368 if (relative) offset = this.offset;
38369 if (!this.noAssert) {
38370 if (typeof offset !== 'number' || offset % 1 !== 0)
38371 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38372 offset >>>= 0;
38373 if (offset < 0 || offset + 1 > this.buffer.byteLength)
38374 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
38375 }
38376 var start = offset;
38377 var len = this.readVarint32(offset);
38378 var str = this.readUTF8String(len['value'], ByteBuffer.METRICS_BYTES, offset += len['length']);
38379 offset += str['length'];
38380 if (relative) {
38381 this.offset = offset;
38382 return str['string'];
38383 } else {
38384 return {
38385 'string': str['string'],
38386 'length': offset - start
38387 };
38388 }
38389 };
38390
38391
38392 /**
38393 * Appends some data to this ByteBuffer. This will overwrite any contents behind the specified offset up to the appended
38394 * data's length.
38395 * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to append. If `source` is a ByteBuffer, its offsets
38396 * will be modified according to the performed read operation.
38397 * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
38398 * @param {number=} offset Offset to append at. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38399 * written if omitted.
38400 * @returns {!ByteBuffer} this
38401 * @expose
38402 * @example A relative `<01 02>03.append(<04 05>)` will result in `<01 02 04 05>, 04 05|`
38403 * @example An absolute `<01 02>03.append(04 05>, 1)` will result in `<01 04>05, 04 05|`
38404 */
38405 ByteBufferPrototype.append = function(source, encoding, offset) {
38406 if (typeof encoding === 'number' || typeof encoding !== 'string') {
38407 offset = encoding;
38408 encoding = undefined;
38409 }
38410 var relative = typeof offset === 'undefined';
38411 if (relative) offset = this.offset;
38412 if (!this.noAssert) {
38413 if (typeof offset !== 'number' || offset % 1 !== 0)
38414 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38415 offset >>>= 0;
38416 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38417 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38418 }
38419 if (!(source instanceof ByteBuffer))
38420 source = ByteBuffer.wrap(source, encoding);
38421 var length = source.limit - source.offset;
38422 if (length <= 0) return this; // Nothing to append
38423 offset += length;
38424 var capacity16 = this.buffer.byteLength;
38425 if (offset > capacity16)
38426 this.resize((capacity16 *= 2) > offset ? capacity16 : offset);
38427 offset -= length;
38428 this.view.set(source.view.subarray(source.offset, source.limit), offset);
38429 source.offset += length;
38430 if (relative) this.offset += length;
38431 return this;
38432 };
38433
38434 /**
38435 * Appends this ByteBuffer's contents to another ByteBuffer. This will overwrite any contents at and after the
38436 specified offset up to the length of this ByteBuffer's data.
38437 * @param {!ByteBuffer} target Target ByteBuffer
38438 * @param {number=} offset Offset to append to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38439 * read if omitted.
38440 * @returns {!ByteBuffer} this
38441 * @expose
38442 * @see ByteBuffer#append
38443 */
38444 ByteBufferPrototype.appendTo = function(target, offset) {
38445 target.append(this, offset);
38446 return this;
38447 };
38448
38449 /**
38450 * Enables or disables assertions of argument types and offsets. Assertions are enabled by default but you can opt to
38451 * disable them if your code already makes sure that everything is valid.
38452 * @param {boolean} assert `true` to enable assertions, otherwise `false`
38453 * @returns {!ByteBuffer} this
38454 * @expose
38455 */
38456 ByteBufferPrototype.assert = function(assert) {
38457 this.noAssert = !assert;
38458 return this;
38459 };
38460
38461 /**
38462 * Gets the capacity of this ByteBuffer's backing buffer.
38463 * @returns {number} Capacity of the backing buffer
38464 * @expose
38465 */
38466 ByteBufferPrototype.capacity = function() {
38467 return this.buffer.byteLength;
38468 };
38469 /**
38470 * Clears this ByteBuffer's offsets by setting {@link ByteBuffer#offset} to `0` and {@link ByteBuffer#limit} to the
38471 * backing buffer's capacity. Discards {@link ByteBuffer#markedOffset}.
38472 * @returns {!ByteBuffer} this
38473 * @expose
38474 */
38475 ByteBufferPrototype.clear = function() {
38476 this.offset = 0;
38477 this.limit = this.buffer.byteLength;
38478 this.markedOffset = -1;
38479 return this;
38480 };
38481
38482 /**
38483 * Creates a cloned instance of this ByteBuffer, preset with this ByteBuffer's values for {@link ByteBuffer#offset},
38484 * {@link ByteBuffer#markedOffset} and {@link ByteBuffer#limit}.
38485 * @param {boolean=} copy Whether to copy the backing buffer or to return another view on the same, defaults to `false`
38486 * @returns {!ByteBuffer} Cloned instance
38487 * @expose
38488 */
38489 ByteBufferPrototype.clone = function(copy) {
38490 var bb = new ByteBuffer(0, this.littleEndian, this.noAssert);
38491 if (copy) {
38492 bb.buffer = new ArrayBuffer(this.buffer.byteLength);
38493 bb.view = new Uint8Array(bb.buffer);
38494 } else {
38495 bb.buffer = this.buffer;
38496 bb.view = this.view;
38497 }
38498 bb.offset = this.offset;
38499 bb.markedOffset = this.markedOffset;
38500 bb.limit = this.limit;
38501 return bb;
38502 };
38503
38504 /**
38505 * Compacts this ByteBuffer to be backed by a {@link ByteBuffer#buffer} of its contents' length. Contents are the bytes
38506 * between {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. Will set `offset = 0` and `limit = capacity` and
38507 * adapt {@link ByteBuffer#markedOffset} to the same relative position if set.
38508 * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
38509 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
38510 * @returns {!ByteBuffer} this
38511 * @expose
38512 */
38513 ByteBufferPrototype.compact = function(begin, end) {
38514 if (typeof begin === 'undefined') begin = this.offset;
38515 if (typeof end === 'undefined') end = this.limit;
38516 if (!this.noAssert) {
38517 if (typeof begin !== 'number' || begin % 1 !== 0)
38518 throw TypeError("Illegal begin: Not an integer");
38519 begin >>>= 0;
38520 if (typeof end !== 'number' || end % 1 !== 0)
38521 throw TypeError("Illegal end: Not an integer");
38522 end >>>= 0;
38523 if (begin < 0 || begin > end || end > this.buffer.byteLength)
38524 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
38525 }
38526 if (begin === 0 && end === this.buffer.byteLength)
38527 return this; // Already compacted
38528 var len = end - begin;
38529 if (len === 0) {
38530 this.buffer = EMPTY_BUFFER;
38531 this.view = null;
38532 if (this.markedOffset >= 0) this.markedOffset -= begin;
38533 this.offset = 0;
38534 this.limit = 0;
38535 return this;
38536 }
38537 var buffer = new ArrayBuffer(len);
38538 var view = new Uint8Array(buffer);
38539 view.set(this.view.subarray(begin, end));
38540 this.buffer = buffer;
38541 this.view = view;
38542 if (this.markedOffset >= 0) this.markedOffset -= begin;
38543 this.offset = 0;
38544 this.limit = len;
38545 return this;
38546 };
38547
38548 /**
38549 * Creates a copy of this ByteBuffer's contents. Contents are the bytes between {@link ByteBuffer#offset} and
38550 * {@link ByteBuffer#limit}.
38551 * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
38552 * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
38553 * @returns {!ByteBuffer} Copy
38554 * @expose
38555 */
38556 ByteBufferPrototype.copy = function(begin, end) {
38557 if (typeof begin === 'undefined') begin = this.offset;
38558 if (typeof end === 'undefined') end = this.limit;
38559 if (!this.noAssert) {
38560 if (typeof begin !== 'number' || begin % 1 !== 0)
38561 throw TypeError("Illegal begin: Not an integer");
38562 begin >>>= 0;
38563 if (typeof end !== 'number' || end % 1 !== 0)
38564 throw TypeError("Illegal end: Not an integer");
38565 end >>>= 0;
38566 if (begin < 0 || begin > end || end > this.buffer.byteLength)
38567 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
38568 }
38569 if (begin === end)
38570 return new ByteBuffer(0, this.littleEndian, this.noAssert);
38571 var capacity = end - begin,
38572 bb = new ByteBuffer(capacity, this.littleEndian, this.noAssert);
38573 bb.offset = 0;
38574 bb.limit = capacity;
38575 if (bb.markedOffset >= 0) bb.markedOffset -= begin;
38576 this.copyTo(bb, 0, begin, end);
38577 return bb;
38578 };
38579
38580 /**
38581 * Copies this ByteBuffer's contents to another ByteBuffer. Contents are the bytes between {@link ByteBuffer#offset} and
38582 * {@link ByteBuffer#limit}.
38583 * @param {!ByteBuffer} target Target ByteBuffer
38584 * @param {number=} targetOffset Offset to copy to. Will use and increase the target's {@link ByteBuffer#offset}
38585 * by the number of bytes copied if omitted.
38586 * @param {number=} sourceOffset Offset to start copying from. Will use and increase {@link ByteBuffer#offset} by the
38587 * number of bytes copied if omitted.
38588 * @param {number=} sourceLimit Offset to end copying from, defaults to {@link ByteBuffer#limit}
38589 * @returns {!ByteBuffer} this
38590 * @expose
38591 */
38592 ByteBufferPrototype.copyTo = function(target, targetOffset, sourceOffset, sourceLimit) {
38593 var relative,
38594 targetRelative;
38595 if (!this.noAssert) {
38596 if (!ByteBuffer.isByteBuffer(target))
38597 throw TypeError("Illegal target: Not a ByteBuffer");
38598 }
38599 targetOffset = (targetRelative = typeof targetOffset === 'undefined') ? target.offset : targetOffset | 0;
38600 sourceOffset = (relative = typeof sourceOffset === 'undefined') ? this.offset : sourceOffset | 0;
38601 sourceLimit = typeof sourceLimit === 'undefined' ? this.limit : sourceLimit | 0;
38602
38603 if (targetOffset < 0 || targetOffset > target.buffer.byteLength)
38604 throw RangeError("Illegal target range: 0 <= "+targetOffset+" <= "+target.buffer.byteLength);
38605 if (sourceOffset < 0 || sourceLimit > this.buffer.byteLength)
38606 throw RangeError("Illegal source range: 0 <= "+sourceOffset+" <= "+this.buffer.byteLength);
38607
38608 var len = sourceLimit - sourceOffset;
38609 if (len === 0)
38610 return target; // Nothing to copy
38611
38612 target.ensureCapacity(targetOffset + len);
38613
38614 target.view.set(this.view.subarray(sourceOffset, sourceLimit), targetOffset);
38615
38616 if (relative) this.offset += len;
38617 if (targetRelative) target.offset += len;
38618
38619 return this;
38620 };
38621
38622 /**
38623 * Makes sure that this ByteBuffer is backed by a {@link ByteBuffer#buffer} of at least the specified capacity. If the
38624 * current capacity is exceeded, it will be doubled. If double the current capacity is less than the required capacity,
38625 * the required capacity will be used instead.
38626 * @param {number} capacity Required capacity
38627 * @returns {!ByteBuffer} this
38628 * @expose
38629 */
38630 ByteBufferPrototype.ensureCapacity = function(capacity) {
38631 var current = this.buffer.byteLength;
38632 if (current < capacity)
38633 return this.resize((current *= 2) > capacity ? current : capacity);
38634 return this;
38635 };
38636
38637 /**
38638 * Overwrites this ByteBuffer's contents with the specified value. Contents are the bytes between
38639 * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
38640 * @param {number|string} value Byte value to fill with. If given as a string, the first character is used.
38641 * @param {number=} begin Begin offset. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38642 * written if omitted. defaults to {@link ByteBuffer#offset}.
38643 * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
38644 * @returns {!ByteBuffer} this
38645 * @expose
38646 * @example `someByteBuffer.clear().fill(0)` fills the entire backing buffer with zeroes
38647 */
38648 ByteBufferPrototype.fill = function(value, begin, end) {
38649 var relative = typeof begin === 'undefined';
38650 if (relative) begin = this.offset;
38651 if (typeof value === 'string' && value.length > 0)
38652 value = value.charCodeAt(0);
38653 if (typeof begin === 'undefined') begin = this.offset;
38654 if (typeof end === 'undefined') end = this.limit;
38655 if (!this.noAssert) {
38656 if (typeof value !== 'number' || value % 1 !== 0)
38657 throw TypeError("Illegal value: "+value+" (not an integer)");
38658 value |= 0;
38659 if (typeof begin !== 'number' || begin % 1 !== 0)
38660 throw TypeError("Illegal begin: Not an integer");
38661 begin >>>= 0;
38662 if (typeof end !== 'number' || end % 1 !== 0)
38663 throw TypeError("Illegal end: Not an integer");
38664 end >>>= 0;
38665 if (begin < 0 || begin > end || end > this.buffer.byteLength)
38666 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
38667 }
38668 if (begin >= end)
38669 return this; // Nothing to fill
38670 while (begin < end) this.view[begin++] = value;
38671 if (relative) this.offset = begin;
38672 return this;
38673 };
38674
38675 /**
38676 * Makes this ByteBuffer ready for a new sequence of write or relative read operations. Sets `limit = offset` and
38677 * `offset = 0`. Make sure always to flip a ByteBuffer when all relative read or write operations are complete.
38678 * @returns {!ByteBuffer} this
38679 * @expose
38680 */
38681 ByteBufferPrototype.flip = function() {
38682 this.limit = this.offset;
38683 this.offset = 0;
38684 return this;
38685 };
38686 /**
38687 * Marks an offset on this ByteBuffer to be used later.
38688 * @param {number=} offset Offset to mark. Defaults to {@link ByteBuffer#offset}.
38689 * @returns {!ByteBuffer} this
38690 * @throws {TypeError} If `offset` is not a valid number
38691 * @throws {RangeError} If `offset` is out of bounds
38692 * @see ByteBuffer#reset
38693 * @expose
38694 */
38695 ByteBufferPrototype.mark = function(offset) {
38696 offset = typeof offset === 'undefined' ? this.offset : offset;
38697 if (!this.noAssert) {
38698 if (typeof offset !== 'number' || offset % 1 !== 0)
38699 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38700 offset >>>= 0;
38701 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38702 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38703 }
38704 this.markedOffset = offset;
38705 return this;
38706 };
38707 /**
38708 * Sets the byte order.
38709 * @param {boolean} littleEndian `true` for little endian byte order, `false` for big endian
38710 * @returns {!ByteBuffer} this
38711 * @expose
38712 */
38713 ByteBufferPrototype.order = function(littleEndian) {
38714 if (!this.noAssert) {
38715 if (typeof littleEndian !== 'boolean')
38716 throw TypeError("Illegal littleEndian: Not a boolean");
38717 }
38718 this.littleEndian = !!littleEndian;
38719 return this;
38720 };
38721
38722 /**
38723 * Switches (to) little endian byte order.
38724 * @param {boolean=} littleEndian Defaults to `true`, otherwise uses big endian
38725 * @returns {!ByteBuffer} this
38726 * @expose
38727 */
38728 ByteBufferPrototype.LE = function(littleEndian) {
38729 this.littleEndian = typeof littleEndian !== 'undefined' ? !!littleEndian : true;
38730 return this;
38731 };
38732
38733 /**
38734 * Switches (to) big endian byte order.
38735 * @param {boolean=} bigEndian Defaults to `true`, otherwise uses little endian
38736 * @returns {!ByteBuffer} this
38737 * @expose
38738 */
38739 ByteBufferPrototype.BE = function(bigEndian) {
38740 this.littleEndian = typeof bigEndian !== 'undefined' ? !bigEndian : false;
38741 return this;
38742 };
38743 /**
38744 * Prepends some data to this ByteBuffer. This will overwrite any contents before the specified offset up to the
38745 * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
38746 * will be resized and its contents moved accordingly.
38747 * @param {!ByteBuffer|string|!ArrayBuffer} source Data to prepend. If `source` is a ByteBuffer, its offset will be
38748 * modified according to the performed read operation.
38749 * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
38750 * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
38751 * prepended if omitted.
38752 * @returns {!ByteBuffer} this
38753 * @expose
38754 * @example A relative `00<01 02 03>.prepend(<04 05>)` results in `<04 05 01 02 03>, 04 05|`
38755 * @example An absolute `00<01 02 03>.prepend(<04 05>, 2)` results in `04<05 02 03>, 04 05|`
38756 */
38757 ByteBufferPrototype.prepend = function(source, encoding, offset) {
38758 if (typeof encoding === 'number' || typeof encoding !== 'string') {
38759 offset = encoding;
38760 encoding = undefined;
38761 }
38762 var relative = typeof offset === 'undefined';
38763 if (relative) offset = this.offset;
38764 if (!this.noAssert) {
38765 if (typeof offset !== 'number' || offset % 1 !== 0)
38766 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38767 offset >>>= 0;
38768 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38769 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38770 }
38771 if (!(source instanceof ByteBuffer))
38772 source = ByteBuffer.wrap(source, encoding);
38773 var len = source.limit - source.offset;
38774 if (len <= 0) return this; // Nothing to prepend
38775 var diff = len - offset;
38776 if (diff > 0) { // Not enough space before offset, so resize + move
38777 var buffer = new ArrayBuffer(this.buffer.byteLength + diff);
38778 var view = new Uint8Array(buffer);
38779 view.set(this.view.subarray(offset, this.buffer.byteLength), len);
38780 this.buffer = buffer;
38781 this.view = view;
38782 this.offset += diff;
38783 if (this.markedOffset >= 0) this.markedOffset += diff;
38784 this.limit += diff;
38785 offset += diff;
38786 } else {
38787 var arrayView = new Uint8Array(this.buffer);
38788 }
38789 this.view.set(source.view.subarray(source.offset, source.limit), offset - len);
38790
38791 source.offset = source.limit;
38792 if (relative)
38793 this.offset -= len;
38794 return this;
38795 };
38796
38797 /**
38798 * Prepends this ByteBuffer to another ByteBuffer. This will overwrite any contents before the specified offset up to the
38799 * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
38800 * will be resized and its contents moved accordingly.
38801 * @param {!ByteBuffer} target Target ByteBuffer
38802 * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
38803 * prepended if omitted.
38804 * @returns {!ByteBuffer} this
38805 * @expose
38806 * @see ByteBuffer#prepend
38807 */
38808 ByteBufferPrototype.prependTo = function(target, offset) {
38809 target.prepend(this, offset);
38810 return this;
38811 };
38812 /**
38813 * Prints debug information about this ByteBuffer's contents.
38814 * @param {function(string)=} out Output function to call, defaults to console.log
38815 * @expose
38816 */
38817 ByteBufferPrototype.printDebug = function(out) {
38818 if (typeof out !== 'function') out = console.log.bind(console);
38819 out(
38820 this.toString()+"\n"+
38821 "-------------------------------------------------------------------\n"+
38822 this.toDebug(/* columns */ true)
38823 );
38824 };
38825
38826 /**
38827 * Gets the number of remaining readable bytes. Contents are the bytes between {@link ByteBuffer#offset} and
38828 * {@link ByteBuffer#limit}, so this returns `limit - offset`.
38829 * @returns {number} Remaining readable bytes. May be negative if `offset > limit`.
38830 * @expose
38831 */
38832 ByteBufferPrototype.remaining = function() {
38833 return this.limit - this.offset;
38834 };
38835 /**
38836 * Resets this ByteBuffer's {@link ByteBuffer#offset}. If an offset has been marked through {@link ByteBuffer#mark}
38837 * before, `offset` will be set to {@link ByteBuffer#markedOffset}, which will then be discarded. If no offset has been
38838 * marked, sets `offset = 0`.
38839 * @returns {!ByteBuffer} this
38840 * @see ByteBuffer#mark
38841 * @expose
38842 */
38843 ByteBufferPrototype.reset = function() {
38844 if (this.markedOffset >= 0) {
38845 this.offset = this.markedOffset;
38846 this.markedOffset = -1;
38847 } else {
38848 this.offset = 0;
38849 }
38850 return this;
38851 };
38852 /**
38853 * Resizes this ByteBuffer to be backed by a buffer of at least the given capacity. Will do nothing if already that
38854 * large or larger.
38855 * @param {number} capacity Capacity required
38856 * @returns {!ByteBuffer} this
38857 * @throws {TypeError} If `capacity` is not a number
38858 * @throws {RangeError} If `capacity < 0`
38859 * @expose
38860 */
38861 ByteBufferPrototype.resize = function(capacity) {
38862 if (!this.noAssert) {
38863 if (typeof capacity !== 'number' || capacity % 1 !== 0)
38864 throw TypeError("Illegal capacity: "+capacity+" (not an integer)");
38865 capacity |= 0;
38866 if (capacity < 0)
38867 throw RangeError("Illegal capacity: 0 <= "+capacity);
38868 }
38869 if (this.buffer.byteLength < capacity) {
38870 var buffer = new ArrayBuffer(capacity);
38871 var view = new Uint8Array(buffer);
38872 view.set(this.view);
38873 this.buffer = buffer;
38874 this.view = view;
38875 }
38876 return this;
38877 };
38878 /**
38879 * Reverses this ByteBuffer's contents.
38880 * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
38881 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
38882 * @returns {!ByteBuffer} this
38883 * @expose
38884 */
38885 ByteBufferPrototype.reverse = function(begin, end) {
38886 if (typeof begin === 'undefined') begin = this.offset;
38887 if (typeof end === 'undefined') end = this.limit;
38888 if (!this.noAssert) {
38889 if (typeof begin !== 'number' || begin % 1 !== 0)
38890 throw TypeError("Illegal begin: Not an integer");
38891 begin >>>= 0;
38892 if (typeof end !== 'number' || end % 1 !== 0)
38893 throw TypeError("Illegal end: Not an integer");
38894 end >>>= 0;
38895 if (begin < 0 || begin > end || end > this.buffer.byteLength)
38896 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
38897 }
38898 if (begin === end)
38899 return this; // Nothing to reverse
38900 Array.prototype.reverse.call(this.view.subarray(begin, end));
38901 return this;
38902 };
38903 /**
38904 * Skips the next `length` bytes. This will just advance
38905 * @param {number} length Number of bytes to skip. May also be negative to move the offset back.
38906 * @returns {!ByteBuffer} this
38907 * @expose
38908 */
38909 ByteBufferPrototype.skip = function(length) {
38910 if (!this.noAssert) {
38911 if (typeof length !== 'number' || length % 1 !== 0)
38912 throw TypeError("Illegal length: "+length+" (not an integer)");
38913 length |= 0;
38914 }
38915 var offset = this.offset + length;
38916 if (!this.noAssert) {
38917 if (offset < 0 || offset > this.buffer.byteLength)
38918 throw RangeError("Illegal length: 0 <= "+this.offset+" + "+length+" <= "+this.buffer.byteLength);
38919 }
38920 this.offset = offset;
38921 return this;
38922 };
38923
38924 /**
38925 * Slices this ByteBuffer by creating a cloned instance with `offset = begin` and `limit = end`.
38926 * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
38927 * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
38928 * @returns {!ByteBuffer} Clone of this ByteBuffer with slicing applied, backed by the same {@link ByteBuffer#buffer}
38929 * @expose
38930 */
38931 ByteBufferPrototype.slice = function(begin, end) {
38932 if (typeof begin === 'undefined') begin = this.offset;
38933 if (typeof end === 'undefined') end = this.limit;
38934 if (!this.noAssert) {
38935 if (typeof begin !== 'number' || begin % 1 !== 0)
38936 throw TypeError("Illegal begin: Not an integer");
38937 begin >>>= 0;
38938 if (typeof end !== 'number' || end % 1 !== 0)
38939 throw TypeError("Illegal end: Not an integer");
38940 end >>>= 0;
38941 if (begin < 0 || begin > end || end > this.buffer.byteLength)
38942 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
38943 }
38944 var bb = this.clone();
38945 bb.offset = begin;
38946 bb.limit = end;
38947 return bb;
38948 };
38949 /**
38950 * Returns a copy of the backing buffer that contains this ByteBuffer's contents. Contents are the bytes between
38951 * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
38952 * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory if
38953 * possible. Defaults to `false`
38954 * @returns {!ArrayBuffer} Contents as an ArrayBuffer
38955 * @expose
38956 */
38957 ByteBufferPrototype.toBuffer = function(forceCopy) {
38958 var offset = this.offset,
38959 limit = this.limit;
38960 if (!this.noAssert) {
38961 if (typeof offset !== 'number' || offset % 1 !== 0)
38962 throw TypeError("Illegal offset: Not an integer");
38963 offset >>>= 0;
38964 if (typeof limit !== 'number' || limit % 1 !== 0)
38965 throw TypeError("Illegal limit: Not an integer");
38966 limit >>>= 0;
38967 if (offset < 0 || offset > limit || limit > this.buffer.byteLength)
38968 throw RangeError("Illegal range: 0 <= "+offset+" <= "+limit+" <= "+this.buffer.byteLength);
38969 }
38970 // NOTE: It's not possible to have another ArrayBuffer reference the same memory as the backing buffer. This is
38971 // possible with Uint8Array#subarray only, but we have to return an ArrayBuffer by contract. So:
38972 if (!forceCopy && offset === 0 && limit === this.buffer.byteLength)
38973 return this.buffer;
38974 if (offset === limit)
38975 return EMPTY_BUFFER;
38976 var buffer = new ArrayBuffer(limit - offset);
38977 new Uint8Array(buffer).set(new Uint8Array(this.buffer).subarray(offset, limit), 0);
38978 return buffer;
38979 };
38980
38981 /**
38982 * Returns a raw buffer compacted to contain this ByteBuffer's contents. Contents are the bytes between
38983 * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. This is an alias of {@link ByteBuffer#toBuffer}.
38984 * @function
38985 * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory.
38986 * Defaults to `false`
38987 * @returns {!ArrayBuffer} Contents as an ArrayBuffer
38988 * @expose
38989 */
38990 ByteBufferPrototype.toArrayBuffer = ByteBufferPrototype.toBuffer;
38991
38992 /**
38993 * Converts the ByteBuffer's contents to a string.
38994 * @param {string=} encoding Output encoding. Returns an informative string representation if omitted but also allows
38995 * direct conversion to "utf8", "hex", "base64" and "binary" encoding. "debug" returns a hex representation with
38996 * highlighted offsets.
38997 * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}
38998 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
38999 * @returns {string} String representation
39000 * @throws {Error} If `encoding` is invalid
39001 * @expose
39002 */
39003 ByteBufferPrototype.toString = function(encoding, begin, end) {
39004 if (typeof encoding === 'undefined')
39005 return "ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";
39006 if (typeof encoding === 'number')
39007 encoding = "utf8",
39008 begin = encoding,
39009 end = begin;
39010 switch (encoding) {
39011 case "utf8":
39012 return this.toUTF8(begin, end);
39013 case "base64":
39014 return this.toBase64(begin, end);
39015 case "hex":
39016 return this.toHex(begin, end);
39017 case "binary":
39018 return this.toBinary(begin, end);
39019 case "debug":
39020 return this.toDebug();
39021 case "columns":
39022 return this.toColumns();
39023 default:
39024 throw Error("Unsupported encoding: "+encoding);
39025 }
39026 };
39027
39028 // lxiv-embeddable
39029
39030 /**
39031 * lxiv-embeddable (c) 2014 Daniel Wirtz <dcode@dcode.io>
39032 * Released under the Apache License, Version 2.0
39033 * see: https://github.com/dcodeIO/lxiv for details
39034 */
39035 var lxiv = function() {
39036 "use strict";
39037
39038 /**
39039 * lxiv namespace.
39040 * @type {!Object.<string,*>}
39041 * @exports lxiv
39042 */
39043 var lxiv = {};
39044
39045 /**
39046 * Character codes for output.
39047 * @type {!Array.<number>}
39048 * @inner
39049 */
39050 var aout = [
39051 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
39052 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102,
39053 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
39054 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47
39055 ];
39056
39057 /**
39058 * Character codes for input.
39059 * @type {!Array.<number>}
39060 * @inner
39061 */
39062 var ain = [];
39063 for (var i=0, k=aout.length; i<k; ++i)
39064 ain[aout[i]] = i;
39065
39066 /**
39067 * Encodes bytes to base64 char codes.
39068 * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if
39069 * there are no more bytes left.
39070 * @param {!function(number)} dst Characters destination as a function successively called with each encoded char
39071 * code.
39072 */
39073 lxiv.encode = function(src, dst) {
39074 var b, t;
39075 while ((b = src()) !== null) {
39076 dst(aout[(b>>2)&0x3f]);
39077 t = (b&0x3)<<4;
39078 if ((b = src()) !== null) {
39079 t |= (b>>4)&0xf;
39080 dst(aout[(t|((b>>4)&0xf))&0x3f]);
39081 t = (b&0xf)<<2;
39082 if ((b = src()) !== null)
39083 dst(aout[(t|((b>>6)&0x3))&0x3f]),
39084 dst(aout[b&0x3f]);
39085 else
39086 dst(aout[t&0x3f]),
39087 dst(61);
39088 } else
39089 dst(aout[t&0x3f]),
39090 dst(61),
39091 dst(61);
39092 }
39093 };
39094
39095 /**
39096 * Decodes base64 char codes to bytes.
39097 * @param {!function():number|null} src Characters source as a function returning the next char code respectively
39098 * `null` if there are no more characters left.
39099 * @param {!function(number)} dst Bytes destination as a function successively called with the next byte.
39100 * @throws {Error} If a character code is invalid
39101 */
39102 lxiv.decode = function(src, dst) {
39103 var c, t1, t2;
39104 function fail(c) {
39105 throw Error("Illegal character code: "+c);
39106 }
39107 while ((c = src()) !== null) {
39108 t1 = ain[c];
39109 if (typeof t1 === 'undefined') fail(c);
39110 if ((c = src()) !== null) {
39111 t2 = ain[c];
39112 if (typeof t2 === 'undefined') fail(c);
39113 dst((t1<<2)>>>0|(t2&0x30)>>4);
39114 if ((c = src()) !== null) {
39115 t1 = ain[c];
39116 if (typeof t1 === 'undefined')
39117 if (c === 61) break; else fail(c);
39118 dst(((t2&0xf)<<4)>>>0|(t1&0x3c)>>2);
39119 if ((c = src()) !== null) {
39120 t2 = ain[c];
39121 if (typeof t2 === 'undefined')
39122 if (c === 61) break; else fail(c);
39123 dst(((t1&0x3)<<6)>>>0|t2);
39124 }
39125 }
39126 }
39127 }
39128 };
39129
39130 /**
39131 * Tests if a string is valid base64.
39132 * @param {string} str String to test
39133 * @returns {boolean} `true` if valid, otherwise `false`
39134 */
39135 lxiv.test = function(str) {
39136 return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(str);
39137 };
39138
39139 return lxiv;
39140 }();
39141
39142 // encodings/base64
39143
39144 /**
39145 * Encodes this ByteBuffer's contents to a base64 encoded string.
39146 * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}.
39147 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}.
39148 * @returns {string} Base64 encoded string
39149 * @throws {RangeError} If `begin` or `end` is out of bounds
39150 * @expose
39151 */
39152 ByteBufferPrototype.toBase64 = function(begin, end) {
39153 if (typeof begin === 'undefined')
39154 begin = this.offset;
39155 if (typeof end === 'undefined')
39156 end = this.limit;
39157 begin = begin | 0; end = end | 0;
39158 if (begin < 0 || end > this.capacity || begin > end)
39159 throw RangeError("begin, end");
39160 var sd; lxiv.encode(function() {
39161 return begin < end ? this.view[begin++] : null;
39162 }.bind(this), sd = stringDestination());
39163 return sd();
39164 };
39165
39166 /**
39167 * Decodes a base64 encoded string to a ByteBuffer.
39168 * @param {string} str String to decode
39169 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
39170 * {@link ByteBuffer.DEFAULT_ENDIAN}.
39171 * @returns {!ByteBuffer} ByteBuffer
39172 * @expose
39173 */
39174 ByteBuffer.fromBase64 = function(str, littleEndian) {
39175 if (typeof str !== 'string')
39176 throw TypeError("str");
39177 var bb = new ByteBuffer(str.length/4*3, littleEndian),
39178 i = 0;
39179 lxiv.decode(stringSource(str), function(b) {
39180 bb.view[i++] = b;
39181 });
39182 bb.limit = i;
39183 return bb;
39184 };
39185
39186 /**
39187 * Encodes a binary string to base64 like `window.btoa` does.
39188 * @param {string} str Binary string
39189 * @returns {string} Base64 encoded string
39190 * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.btoa
39191 * @expose
39192 */
39193 ByteBuffer.btoa = function(str) {
39194 return ByteBuffer.fromBinary(str).toBase64();
39195 };
39196
39197 /**
39198 * Decodes a base64 encoded string to binary like `window.atob` does.
39199 * @param {string} b64 Base64 encoded string
39200 * @returns {string} Binary string
39201 * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.atob
39202 * @expose
39203 */
39204 ByteBuffer.atob = function(b64) {
39205 return ByteBuffer.fromBase64(b64).toBinary();
39206 };
39207
39208 // encodings/binary
39209
39210 /**
39211 * Encodes this ByteBuffer to a binary encoded string, that is using only characters 0x00-0xFF as bytes.
39212 * @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
39213 * @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
39214 * @returns {string} Binary encoded string
39215 * @throws {RangeError} If `offset > limit`
39216 * @expose
39217 */
39218 ByteBufferPrototype.toBinary = function(begin, end) {
39219 if (typeof begin === 'undefined')
39220 begin = this.offset;
39221 if (typeof end === 'undefined')
39222 end = this.limit;
39223 begin |= 0; end |= 0;
39224 if (begin < 0 || end > this.capacity() || begin > end)
39225 throw RangeError("begin, end");
39226 if (begin === end)
39227 return "";
39228 var chars = [],
39229 parts = [];
39230 while (begin < end) {
39231 chars.push(this.view[begin++]);
39232 if (chars.length >= 1024)
39233 parts.push(String.fromCharCode.apply(String, chars)),
39234 chars = [];
39235 }
39236 return parts.join('') + String.fromCharCode.apply(String, chars);
39237 };
39238
39239 /**
39240 * Decodes a binary encoded string, that is using only characters 0x00-0xFF as bytes, to a ByteBuffer.
39241 * @param {string} str String to decode
39242 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
39243 * {@link ByteBuffer.DEFAULT_ENDIAN}.
39244 * @returns {!ByteBuffer} ByteBuffer
39245 * @expose
39246 */
39247 ByteBuffer.fromBinary = function(str, littleEndian) {
39248 if (typeof str !== 'string')
39249 throw TypeError("str");
39250 var i = 0,
39251 k = str.length,
39252 charCode,
39253 bb = new ByteBuffer(k, littleEndian);
39254 while (i<k) {
39255 charCode = str.charCodeAt(i);
39256 if (charCode > 0xff)
39257 throw RangeError("illegal char code: "+charCode);
39258 bb.view[i++] = charCode;
39259 }
39260 bb.limit = k;
39261 return bb;
39262 };
39263
39264 // encodings/debug
39265
39266 /**
39267 * Encodes this ByteBuffer to a hex encoded string with marked offsets. Offset symbols are:
39268 * * `<` : offset,
39269 * * `'` : markedOffset,
39270 * * `>` : limit,
39271 * * `|` : offset and limit,
39272 * * `[` : offset and markedOffset,
39273 * * `]` : markedOffset and limit,
39274 * * `!` : offset, markedOffset and limit
39275 * @param {boolean=} columns If `true` returns two columns hex + ascii, defaults to `false`
39276 * @returns {string|!Array.<string>} Debug string or array of lines if `asArray = true`
39277 * @expose
39278 * @example `>00'01 02<03` contains four bytes with `limit=0, markedOffset=1, offset=3`
39279 * @example `00[01 02 03>` contains four bytes with `offset=markedOffset=1, limit=4`
39280 * @example `00|01 02 03` contains four bytes with `offset=limit=1, markedOffset=-1`
39281 * @example `|` contains zero bytes with `offset=limit=0, markedOffset=-1`
39282 */
39283 ByteBufferPrototype.toDebug = function(columns) {
39284 var i = -1,
39285 k = this.buffer.byteLength,
39286 b,
39287 hex = "",
39288 asc = "",
39289 out = "";
39290 while (i<k) {
39291 if (i !== -1) {
39292 b = this.view[i];
39293 if (b < 0x10) hex += "0"+b.toString(16).toUpperCase();
39294 else hex += b.toString(16).toUpperCase();
39295 if (columns)
39296 asc += b > 32 && b < 127 ? String.fromCharCode(b) : '.';
39297 }
39298 ++i;
39299 if (columns) {
39300 if (i > 0 && i % 16 === 0 && i !== k) {
39301 while (hex.length < 3*16+3) hex += " ";
39302 out += hex+asc+"\n";
39303 hex = asc = "";
39304 }
39305 }
39306 if (i === this.offset && i === this.limit)
39307 hex += i === this.markedOffset ? "!" : "|";
39308 else if (i === this.offset)
39309 hex += i === this.markedOffset ? "[" : "<";
39310 else if (i === this.limit)
39311 hex += i === this.markedOffset ? "]" : ">";
39312 else
39313 hex += i === this.markedOffset ? "'" : (columns || (i !== 0 && i !== k) ? " " : "");
39314 }
39315 if (columns && hex !== " ") {
39316 while (hex.length < 3*16+3)
39317 hex += " ";
39318 out += hex + asc + "\n";
39319 }
39320 return columns ? out : hex;
39321 };
39322
39323 /**
39324 * Decodes a hex encoded string with marked offsets to a ByteBuffer.
39325 * @param {string} str Debug string to decode (not be generated with `columns = true`)
39326 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
39327 * {@link ByteBuffer.DEFAULT_ENDIAN}.
39328 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
39329 * {@link ByteBuffer.DEFAULT_NOASSERT}.
39330 * @returns {!ByteBuffer} ByteBuffer
39331 * @expose
39332 * @see ByteBuffer#toDebug
39333 */
39334 ByteBuffer.fromDebug = function(str, littleEndian, noAssert) {
39335 var k = str.length,
39336 bb = new ByteBuffer(((k+1)/3)|0, littleEndian, noAssert);
39337 var i = 0, j = 0, ch, b,
39338 rs = false, // Require symbol next
39339 ho = false, hm = false, hl = false, // Already has offset (ho), markedOffset (hm), limit (hl)?
39340 fail = false;
39341 while (i<k) {
39342 switch (ch = str.charAt(i++)) {
39343 case '!':
39344 if (!noAssert) {
39345 if (ho || hm || hl) {
39346 fail = true;
39347 break;
39348 }
39349 ho = hm = hl = true;
39350 }
39351 bb.offset = bb.markedOffset = bb.limit = j;
39352 rs = false;
39353 break;
39354 case '|':
39355 if (!noAssert) {
39356 if (ho || hl) {
39357 fail = true;
39358 break;
39359 }
39360 ho = hl = true;
39361 }
39362 bb.offset = bb.limit = j;
39363 rs = false;
39364 break;
39365 case '[':
39366 if (!noAssert) {
39367 if (ho || hm) {
39368 fail = true;
39369 break;
39370 }
39371 ho = hm = true;
39372 }
39373 bb.offset = bb.markedOffset = j;
39374 rs = false;
39375 break;
39376 case '<':
39377 if (!noAssert) {
39378 if (ho) {
39379 fail = true;
39380 break;
39381 }
39382 ho = true;
39383 }
39384 bb.offset = j;
39385 rs = false;
39386 break;
39387 case ']':
39388 if (!noAssert) {
39389 if (hl || hm) {
39390 fail = true;
39391 break;
39392 }
39393 hl = hm = true;
39394 }
39395 bb.limit = bb.markedOffset = j;
39396 rs = false;
39397 break;
39398 case '>':
39399 if (!noAssert) {
39400 if (hl) {
39401 fail = true;
39402 break;
39403 }
39404 hl = true;
39405 }
39406 bb.limit = j;
39407 rs = false;
39408 break;
39409 case "'":
39410 if (!noAssert) {
39411 if (hm) {
39412 fail = true;
39413 break;
39414 }
39415 hm = true;
39416 }
39417 bb.markedOffset = j;
39418 rs = false;
39419 break;
39420 case ' ':
39421 rs = false;
39422 break;
39423 default:
39424 if (!noAssert) {
39425 if (rs) {
39426 fail = true;
39427 break;
39428 }
39429 }
39430 b = parseInt(ch+str.charAt(i++), 16);
39431 if (!noAssert) {
39432 if (isNaN(b) || b < 0 || b > 255)
39433 throw TypeError("Illegal str: Not a debug encoded string");
39434 }
39435 bb.view[j++] = b;
39436 rs = true;
39437 }
39438 if (fail)
39439 throw TypeError("Illegal str: Invalid symbol at "+i);
39440 }
39441 if (!noAssert) {
39442 if (!ho || !hl)
39443 throw TypeError("Illegal str: Missing offset or limit");
39444 if (j<bb.buffer.byteLength)
39445 throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+j+" < "+k);
39446 }
39447 return bb;
39448 };
39449
39450 // encodings/hex
39451
39452 /**
39453 * Encodes this ByteBuffer's contents to a hex encoded string.
39454 * @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
39455 * @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
39456 * @returns {string} Hex encoded string
39457 * @expose
39458 */
39459 ByteBufferPrototype.toHex = function(begin, end) {
39460 begin = typeof begin === 'undefined' ? this.offset : begin;
39461 end = typeof end === 'undefined' ? this.limit : end;
39462 if (!this.noAssert) {
39463 if (typeof begin !== 'number' || begin % 1 !== 0)
39464 throw TypeError("Illegal begin: Not an integer");
39465 begin >>>= 0;
39466 if (typeof end !== 'number' || end % 1 !== 0)
39467 throw TypeError("Illegal end: Not an integer");
39468 end >>>= 0;
39469 if (begin < 0 || begin > end || end > this.buffer.byteLength)
39470 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
39471 }
39472 var out = new Array(end - begin),
39473 b;
39474 while (begin < end) {
39475 b = this.view[begin++];
39476 if (b < 0x10)
39477 out.push("0", b.toString(16));
39478 else out.push(b.toString(16));
39479 }
39480 return out.join('');
39481 };
39482
39483 /**
39484 * Decodes a hex encoded string to a ByteBuffer.
39485 * @param {string} str String to decode
39486 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
39487 * {@link ByteBuffer.DEFAULT_ENDIAN}.
39488 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
39489 * {@link ByteBuffer.DEFAULT_NOASSERT}.
39490 * @returns {!ByteBuffer} ByteBuffer
39491 * @expose
39492 */
39493 ByteBuffer.fromHex = function(str, littleEndian, noAssert) {
39494 if (!noAssert) {
39495 if (typeof str !== 'string')
39496 throw TypeError("Illegal str: Not a string");
39497 if (str.length % 2 !== 0)
39498 throw TypeError("Illegal str: Length not a multiple of 2");
39499 }
39500 var k = str.length,
39501 bb = new ByteBuffer((k / 2) | 0, littleEndian),
39502 b;
39503 for (var i=0, j=0; i<k; i+=2) {
39504 b = parseInt(str.substring(i, i+2), 16);
39505 if (!noAssert)
39506 if (!isFinite(b) || b < 0 || b > 255)
39507 throw TypeError("Illegal str: Contains non-hex characters");
39508 bb.view[j++] = b;
39509 }
39510 bb.limit = j;
39511 return bb;
39512 };
39513
39514 // utfx-embeddable
39515
39516 /**
39517 * utfx-embeddable (c) 2014 Daniel Wirtz <dcode@dcode.io>
39518 * Released under the Apache License, Version 2.0
39519 * see: https://github.com/dcodeIO/utfx for details
39520 */
39521 var utfx = function() {
39522 "use strict";
39523
39524 /**
39525 * utfx namespace.
39526 * @inner
39527 * @type {!Object.<string,*>}
39528 */
39529 var utfx = {};
39530
39531 /**
39532 * Maximum valid code point.
39533 * @type {number}
39534 * @const
39535 */
39536 utfx.MAX_CODEPOINT = 0x10FFFF;
39537
39538 /**
39539 * Encodes UTF8 code points to UTF8 bytes.
39540 * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
39541 * respectively `null` if there are no more code points left or a single numeric code point.
39542 * @param {!function(number)} dst Bytes destination as a function successively called with the next byte
39543 */
39544 utfx.encodeUTF8 = function(src, dst) {
39545 var cp = null;
39546 if (typeof src === 'number')
39547 cp = src,
39548 src = function() { return null; };
39549 while (cp !== null || (cp = src()) !== null) {
39550 if (cp < 0x80)
39551 dst(cp&0x7F);
39552 else if (cp < 0x800)
39553 dst(((cp>>6)&0x1F)|0xC0),
39554 dst((cp&0x3F)|0x80);
39555 else if (cp < 0x10000)
39556 dst(((cp>>12)&0x0F)|0xE0),
39557 dst(((cp>>6)&0x3F)|0x80),
39558 dst((cp&0x3F)|0x80);
39559 else
39560 dst(((cp>>18)&0x07)|0xF0),
39561 dst(((cp>>12)&0x3F)|0x80),
39562 dst(((cp>>6)&0x3F)|0x80),
39563 dst((cp&0x3F)|0x80);
39564 cp = null;
39565 }
39566 };
39567
39568 /**
39569 * Decodes UTF8 bytes to UTF8 code points.
39570 * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
39571 * are no more bytes left.
39572 * @param {!function(number)} dst Code points destination as a function successively called with each decoded code point.
39573 * @throws {RangeError} If a starting byte is invalid in UTF8
39574 * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the
39575 * remaining bytes.
39576 */
39577 utfx.decodeUTF8 = function(src, dst) {
39578 var a, b, c, d, fail = function(b) {
39579 b = b.slice(0, b.indexOf(null));
39580 var err = Error(b.toString());
39581 err.name = "TruncatedError";
39582 err['bytes'] = b;
39583 throw err;
39584 };
39585 while ((a = src()) !== null) {
39586 if ((a&0x80) === 0)
39587 dst(a);
39588 else if ((a&0xE0) === 0xC0)
39589 ((b = src()) === null) && fail([a, b]),
39590 dst(((a&0x1F)<<6) | (b&0x3F));
39591 else if ((a&0xF0) === 0xE0)
39592 ((b=src()) === null || (c=src()) === null) && fail([a, b, c]),
39593 dst(((a&0x0F)<<12) | ((b&0x3F)<<6) | (c&0x3F));
39594 else if ((a&0xF8) === 0xF0)
39595 ((b=src()) === null || (c=src()) === null || (d=src()) === null) && fail([a, b, c ,d]),
39596 dst(((a&0x07)<<18) | ((b&0x3F)<<12) | ((c&0x3F)<<6) | (d&0x3F));
39597 else throw RangeError("Illegal starting byte: "+a);
39598 }
39599 };
39600
39601 /**
39602 * Converts UTF16 characters to UTF8 code points.
39603 * @param {!function():number|null} src Characters source as a function returning the next char code respectively
39604 * `null` if there are no more characters left.
39605 * @param {!function(number)} dst Code points destination as a function successively called with each converted code
39606 * point.
39607 */
39608 utfx.UTF16toUTF8 = function(src, dst) {
39609 var c1, c2 = null;
39610 while (true) {
39611 if ((c1 = c2 !== null ? c2 : src()) === null)
39612 break;
39613 if (c1 >= 0xD800 && c1 <= 0xDFFF) {
39614 if ((c2 = src()) !== null) {
39615 if (c2 >= 0xDC00 && c2 <= 0xDFFF) {
39616 dst((c1-0xD800)*0x400+c2-0xDC00+0x10000);
39617 c2 = null; continue;
39618 }
39619 }
39620 }
39621 dst(c1);
39622 }
39623 if (c2 !== null) dst(c2);
39624 };
39625
39626 /**
39627 * Converts UTF8 code points to UTF16 characters.
39628 * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
39629 * respectively `null` if there are no more code points left or a single numeric code point.
39630 * @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
39631 * @throws {RangeError} If a code point is out of range
39632 */
39633 utfx.UTF8toUTF16 = function(src, dst) {
39634 var cp = null;
39635 if (typeof src === 'number')
39636 cp = src, src = function() { return null; };
39637 while (cp !== null || (cp = src()) !== null) {
39638 if (cp <= 0xFFFF)
39639 dst(cp);
39640 else
39641 cp -= 0x10000,
39642 dst((cp>>10)+0xD800),
39643 dst((cp%0x400)+0xDC00);
39644 cp = null;
39645 }
39646 };
39647
39648 /**
39649 * Converts and encodes UTF16 characters to UTF8 bytes.
39650 * @param {!function():number|null} src Characters source as a function returning the next char code respectively `null`
39651 * if there are no more characters left.
39652 * @param {!function(number)} dst Bytes destination as a function successively called with the next byte.
39653 */
39654 utfx.encodeUTF16toUTF8 = function(src, dst) {
39655 utfx.UTF16toUTF8(src, function(cp) {
39656 utfx.encodeUTF8(cp, dst);
39657 });
39658 };
39659
39660 /**
39661 * Decodes and converts UTF8 bytes to UTF16 characters.
39662 * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
39663 * are no more bytes left.
39664 * @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
39665 * @throws {RangeError} If a starting byte is invalid in UTF8
39666 * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the remaining bytes.
39667 */
39668 utfx.decodeUTF8toUTF16 = function(src, dst) {
39669 utfx.decodeUTF8(src, function(cp) {
39670 utfx.UTF8toUTF16(cp, dst);
39671 });
39672 };
39673
39674 /**
39675 * Calculates the byte length of an UTF8 code point.
39676 * @param {number} cp UTF8 code point
39677 * @returns {number} Byte length
39678 */
39679 utfx.calculateCodePoint = function(cp) {
39680 return (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
39681 };
39682
39683 /**
39684 * Calculates the number of UTF8 bytes required to store UTF8 code points.
39685 * @param {(!function():number|null)} src Code points source as a function returning the next code point respectively
39686 * `null` if there are no more code points left.
39687 * @returns {number} The number of UTF8 bytes required
39688 */
39689 utfx.calculateUTF8 = function(src) {
39690 var cp, l=0;
39691 while ((cp = src()) !== null)
39692 l += (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
39693 return l;
39694 };
39695
39696 /**
39697 * Calculates the number of UTF8 code points respectively UTF8 bytes required to store UTF16 char codes.
39698 * @param {(!function():number|null)} src Characters source as a function returning the next char code respectively
39699 * `null` if there are no more characters left.
39700 * @returns {!Array.<number>} The number of UTF8 code points at index 0 and the number of UTF8 bytes required at index 1.
39701 */
39702 utfx.calculateUTF16asUTF8 = function(src) {
39703 var n=0, l=0;
39704 utfx.UTF16toUTF8(src, function(cp) {
39705 ++n; l += (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
39706 });
39707 return [n,l];
39708 };
39709
39710 return utfx;
39711 }();
39712
39713 // encodings/utf8
39714
39715 /**
39716 * Encodes this ByteBuffer's contents between {@link ByteBuffer#offset} and {@link ByteBuffer#limit} to an UTF8 encoded
39717 * string.
39718 * @returns {string} Hex encoded string
39719 * @throws {RangeError} If `offset > limit`
39720 * @expose
39721 */
39722 ByteBufferPrototype.toUTF8 = function(begin, end) {
39723 if (typeof begin === 'undefined') begin = this.offset;
39724 if (typeof end === 'undefined') end = this.limit;
39725 if (!this.noAssert) {
39726 if (typeof begin !== 'number' || begin % 1 !== 0)
39727 throw TypeError("Illegal begin: Not an integer");
39728 begin >>>= 0;
39729 if (typeof end !== 'number' || end % 1 !== 0)
39730 throw TypeError("Illegal end: Not an integer");
39731 end >>>= 0;
39732 if (begin < 0 || begin > end || end > this.buffer.byteLength)
39733 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
39734 }
39735 var sd; try {
39736 utfx.decodeUTF8toUTF16(function() {
39737 return begin < end ? this.view[begin++] : null;
39738 }.bind(this), sd = stringDestination());
39739 } catch (e) {
39740 if (begin !== end)
39741 throw RangeError("Illegal range: Truncated data, "+begin+" != "+end);
39742 }
39743 return sd();
39744 };
39745
39746 /**
39747 * Decodes an UTF8 encoded string to a ByteBuffer.
39748 * @param {string} str String to decode
39749 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
39750 * {@link ByteBuffer.DEFAULT_ENDIAN}.
39751 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
39752 * {@link ByteBuffer.DEFAULT_NOASSERT}.
39753 * @returns {!ByteBuffer} ByteBuffer
39754 * @expose
39755 */
39756 ByteBuffer.fromUTF8 = function(str, littleEndian, noAssert) {
39757 if (!noAssert)
39758 if (typeof str !== 'string')
39759 throw TypeError("Illegal str: Not a string");
39760 var bb = new ByteBuffer(utfx.calculateUTF16asUTF8(stringSource(str), true)[1], littleEndian, noAssert),
39761 i = 0;
39762 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
39763 bb.view[i++] = b;
39764 });
39765 bb.limit = i;
39766 return bb;
39767 };
39768
39769 return ByteBuffer;
39770});
39771
39772
39773/***/ }),
39774/* 614 */
39775/***/ (function(module, exports, __webpack_require__) {
39776
39777var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
39778 Copyright 2013 Daniel Wirtz <dcode@dcode.io>
39779 Copyright 2009 The Closure Library Authors. All Rights Reserved.
39780
39781 Licensed under the Apache License, Version 2.0 (the "License");
39782 you may not use this file except in compliance with the License.
39783 You may obtain a copy of the License at
39784
39785 http://www.apache.org/licenses/LICENSE-2.0
39786
39787 Unless required by applicable law or agreed to in writing, software
39788 distributed under the License is distributed on an "AS-IS" BASIS,
39789 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39790 See the License for the specific language governing permissions and
39791 limitations under the License.
39792 */
39793
39794/**
39795 * @license long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
39796 * Released under the Apache License, Version 2.0
39797 * see: https://github.com/dcodeIO/long.js for details
39798 */
39799(function(global, factory) {
39800
39801 /* AMD */ if (true)
39802 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
39803 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
39804 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
39805 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
39806 /* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"])
39807 module["exports"] = factory();
39808 /* Global */ else
39809 (global["dcodeIO"] = global["dcodeIO"] || {})["Long"] = factory();
39810
39811})(this, function() {
39812 "use strict";
39813
39814 /**
39815 * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
39816 * See the from* functions below for more convenient ways of constructing Longs.
39817 * @exports Long
39818 * @class A Long class for representing a 64 bit two's-complement integer value.
39819 * @param {number} low The low (signed) 32 bits of the long
39820 * @param {number} high The high (signed) 32 bits of the long
39821 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
39822 * @constructor
39823 */
39824 function Long(low, high, unsigned) {
39825
39826 /**
39827 * The low 32 bits as a signed value.
39828 * @type {number}
39829 */
39830 this.low = low | 0;
39831
39832 /**
39833 * The high 32 bits as a signed value.
39834 * @type {number}
39835 */
39836 this.high = high | 0;
39837
39838 /**
39839 * Whether unsigned or not.
39840 * @type {boolean}
39841 */
39842 this.unsigned = !!unsigned;
39843 }
39844
39845 // The internal representation of a long is the two given signed, 32-bit values.
39846 // We use 32-bit pieces because these are the size of integers on which
39847 // Javascript performs bit-operations. For operations like addition and
39848 // multiplication, we split each number into 16 bit pieces, which can easily be
39849 // multiplied within Javascript's floating-point representation without overflow
39850 // or change in sign.
39851 //
39852 // In the algorithms below, we frequently reduce the negative case to the
39853 // positive case by negating the input(s) and then post-processing the result.
39854 // Note that we must ALWAYS check specially whether those values are MIN_VALUE
39855 // (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
39856 // a positive number, it overflows back into a negative). Not handling this
39857 // case would often result in infinite recursion.
39858 //
39859 // Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
39860 // methods on which they depend.
39861
39862 /**
39863 * An indicator used to reliably determine if an object is a Long or not.
39864 * @type {boolean}
39865 * @const
39866 * @private
39867 */
39868 Long.prototype.__isLong__;
39869
39870 Object.defineProperty(Long.prototype, "__isLong__", {
39871 value: true,
39872 enumerable: false,
39873 configurable: false
39874 });
39875
39876 /**
39877 * @function
39878 * @param {*} obj Object
39879 * @returns {boolean}
39880 * @inner
39881 */
39882 function isLong(obj) {
39883 return (obj && obj["__isLong__"]) === true;
39884 }
39885
39886 /**
39887 * Tests if the specified object is a Long.
39888 * @function
39889 * @param {*} obj Object
39890 * @returns {boolean}
39891 */
39892 Long.isLong = isLong;
39893
39894 /**
39895 * A cache of the Long representations of small integer values.
39896 * @type {!Object}
39897 * @inner
39898 */
39899 var INT_CACHE = {};
39900
39901 /**
39902 * A cache of the Long representations of small unsigned integer values.
39903 * @type {!Object}
39904 * @inner
39905 */
39906 var UINT_CACHE = {};
39907
39908 /**
39909 * @param {number} value
39910 * @param {boolean=} unsigned
39911 * @returns {!Long}
39912 * @inner
39913 */
39914 function fromInt(value, unsigned) {
39915 var obj, cachedObj, cache;
39916 if (unsigned) {
39917 value >>>= 0;
39918 if (cache = (0 <= value && value < 256)) {
39919 cachedObj = UINT_CACHE[value];
39920 if (cachedObj)
39921 return cachedObj;
39922 }
39923 obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);
39924 if (cache)
39925 UINT_CACHE[value] = obj;
39926 return obj;
39927 } else {
39928 value |= 0;
39929 if (cache = (-128 <= value && value < 128)) {
39930 cachedObj = INT_CACHE[value];
39931 if (cachedObj)
39932 return cachedObj;
39933 }
39934 obj = fromBits(value, value < 0 ? -1 : 0, false);
39935 if (cache)
39936 INT_CACHE[value] = obj;
39937 return obj;
39938 }
39939 }
39940
39941 /**
39942 * Returns a Long representing the given 32 bit integer value.
39943 * @function
39944 * @param {number} value The 32 bit integer in question
39945 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
39946 * @returns {!Long} The corresponding Long value
39947 */
39948 Long.fromInt = fromInt;
39949
39950 /**
39951 * @param {number} value
39952 * @param {boolean=} unsigned
39953 * @returns {!Long}
39954 * @inner
39955 */
39956 function fromNumber(value, unsigned) {
39957 if (isNaN(value) || !isFinite(value))
39958 return unsigned ? UZERO : ZERO;
39959 if (unsigned) {
39960 if (value < 0)
39961 return UZERO;
39962 if (value >= TWO_PWR_64_DBL)
39963 return MAX_UNSIGNED_VALUE;
39964 } else {
39965 if (value <= -TWO_PWR_63_DBL)
39966 return MIN_VALUE;
39967 if (value + 1 >= TWO_PWR_63_DBL)
39968 return MAX_VALUE;
39969 }
39970 if (value < 0)
39971 return fromNumber(-value, unsigned).neg();
39972 return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
39973 }
39974
39975 /**
39976 * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
39977 * @function
39978 * @param {number} value The number in question
39979 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
39980 * @returns {!Long} The corresponding Long value
39981 */
39982 Long.fromNumber = fromNumber;
39983
39984 /**
39985 * @param {number} lowBits
39986 * @param {number} highBits
39987 * @param {boolean=} unsigned
39988 * @returns {!Long}
39989 * @inner
39990 */
39991 function fromBits(lowBits, highBits, unsigned) {
39992 return new Long(lowBits, highBits, unsigned);
39993 }
39994
39995 /**
39996 * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
39997 * assumed to use 32 bits.
39998 * @function
39999 * @param {number} lowBits The low 32 bits
40000 * @param {number} highBits The high 32 bits
40001 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
40002 * @returns {!Long} The corresponding Long value
40003 */
40004 Long.fromBits = fromBits;
40005
40006 /**
40007 * @function
40008 * @param {number} base
40009 * @param {number} exponent
40010 * @returns {number}
40011 * @inner
40012 */
40013 var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)
40014
40015 /**
40016 * @param {string} str
40017 * @param {(boolean|number)=} unsigned
40018 * @param {number=} radix
40019 * @returns {!Long}
40020 * @inner
40021 */
40022 function fromString(str, unsigned, radix) {
40023 if (str.length === 0)
40024 throw Error('empty string');
40025 if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
40026 return ZERO;
40027 if (typeof unsigned === 'number') {
40028 // For goog.math.long compatibility
40029 radix = unsigned,
40030 unsigned = false;
40031 } else {
40032 unsigned = !! unsigned;
40033 }
40034 radix = radix || 10;
40035 if (radix < 2 || 36 < radix)
40036 throw RangeError('radix');
40037
40038 var p;
40039 if ((p = str.indexOf('-')) > 0)
40040 throw Error('interior hyphen');
40041 else if (p === 0) {
40042 return fromString(str.substring(1), unsigned, radix).neg();
40043 }
40044
40045 // Do several (8) digits each time through the loop, so as to
40046 // minimize the calls to the very expensive emulated div.
40047 var radixToPower = fromNumber(pow_dbl(radix, 8));
40048
40049 var result = ZERO;
40050 for (var i = 0; i < str.length; i += 8) {
40051 var size = Math.min(8, str.length - i),
40052 value = parseInt(str.substring(i, i + size), radix);
40053 if (size < 8) {
40054 var power = fromNumber(pow_dbl(radix, size));
40055 result = result.mul(power).add(fromNumber(value));
40056 } else {
40057 result = result.mul(radixToPower);
40058 result = result.add(fromNumber(value));
40059 }
40060 }
40061 result.unsigned = unsigned;
40062 return result;
40063 }
40064
40065 /**
40066 * Returns a Long representation of the given string, written using the specified radix.
40067 * @function
40068 * @param {string} str The textual representation of the Long
40069 * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to `false` for signed
40070 * @param {number=} radix The radix in which the text is written (2-36), defaults to 10
40071 * @returns {!Long} The corresponding Long value
40072 */
40073 Long.fromString = fromString;
40074
40075 /**
40076 * @function
40077 * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
40078 * @returns {!Long}
40079 * @inner
40080 */
40081 function fromValue(val) {
40082 if (val /* is compatible */ instanceof Long)
40083 return val;
40084 if (typeof val === 'number')
40085 return fromNumber(val);
40086 if (typeof val === 'string')
40087 return fromString(val);
40088 // Throws for non-objects, converts non-instanceof Long:
40089 return fromBits(val.low, val.high, val.unsigned);
40090 }
40091
40092 /**
40093 * Converts the specified value to a Long.
40094 * @function
40095 * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value
40096 * @returns {!Long}
40097 */
40098 Long.fromValue = fromValue;
40099
40100 // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
40101 // no runtime penalty for these.
40102
40103 /**
40104 * @type {number}
40105 * @const
40106 * @inner
40107 */
40108 var TWO_PWR_16_DBL = 1 << 16;
40109
40110 /**
40111 * @type {number}
40112 * @const
40113 * @inner
40114 */
40115 var TWO_PWR_24_DBL = 1 << 24;
40116
40117 /**
40118 * @type {number}
40119 * @const
40120 * @inner
40121 */
40122 var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
40123
40124 /**
40125 * @type {number}
40126 * @const
40127 * @inner
40128 */
40129 var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
40130
40131 /**
40132 * @type {number}
40133 * @const
40134 * @inner
40135 */
40136 var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
40137
40138 /**
40139 * @type {!Long}
40140 * @const
40141 * @inner
40142 */
40143 var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
40144
40145 /**
40146 * @type {!Long}
40147 * @inner
40148 */
40149 var ZERO = fromInt(0);
40150
40151 /**
40152 * Signed zero.
40153 * @type {!Long}
40154 */
40155 Long.ZERO = ZERO;
40156
40157 /**
40158 * @type {!Long}
40159 * @inner
40160 */
40161 var UZERO = fromInt(0, true);
40162
40163 /**
40164 * Unsigned zero.
40165 * @type {!Long}
40166 */
40167 Long.UZERO = UZERO;
40168
40169 /**
40170 * @type {!Long}
40171 * @inner
40172 */
40173 var ONE = fromInt(1);
40174
40175 /**
40176 * Signed one.
40177 * @type {!Long}
40178 */
40179 Long.ONE = ONE;
40180
40181 /**
40182 * @type {!Long}
40183 * @inner
40184 */
40185 var UONE = fromInt(1, true);
40186
40187 /**
40188 * Unsigned one.
40189 * @type {!Long}
40190 */
40191 Long.UONE = UONE;
40192
40193 /**
40194 * @type {!Long}
40195 * @inner
40196 */
40197 var NEG_ONE = fromInt(-1);
40198
40199 /**
40200 * Signed negative one.
40201 * @type {!Long}
40202 */
40203 Long.NEG_ONE = NEG_ONE;
40204
40205 /**
40206 * @type {!Long}
40207 * @inner
40208 */
40209 var MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);
40210
40211 /**
40212 * Maximum signed value.
40213 * @type {!Long}
40214 */
40215 Long.MAX_VALUE = MAX_VALUE;
40216
40217 /**
40218 * @type {!Long}
40219 * @inner
40220 */
40221 var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);
40222
40223 /**
40224 * Maximum unsigned value.
40225 * @type {!Long}
40226 */
40227 Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
40228
40229 /**
40230 * @type {!Long}
40231 * @inner
40232 */
40233 var MIN_VALUE = fromBits(0, 0x80000000|0, false);
40234
40235 /**
40236 * Minimum signed value.
40237 * @type {!Long}
40238 */
40239 Long.MIN_VALUE = MIN_VALUE;
40240
40241 /**
40242 * @alias Long.prototype
40243 * @inner
40244 */
40245 var LongPrototype = Long.prototype;
40246
40247 /**
40248 * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
40249 * @returns {number}
40250 */
40251 LongPrototype.toInt = function toInt() {
40252 return this.unsigned ? this.low >>> 0 : this.low;
40253 };
40254
40255 /**
40256 * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
40257 * @returns {number}
40258 */
40259 LongPrototype.toNumber = function toNumber() {
40260 if (this.unsigned)
40261 return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);
40262 return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
40263 };
40264
40265 /**
40266 * Converts the Long to a string written in the specified radix.
40267 * @param {number=} radix Radix (2-36), defaults to 10
40268 * @returns {string}
40269 * @override
40270 * @throws {RangeError} If `radix` is out of range
40271 */
40272 LongPrototype.toString = function toString(radix) {
40273 radix = radix || 10;
40274 if (radix < 2 || 36 < radix)
40275 throw RangeError('radix');
40276 if (this.isZero())
40277 return '0';
40278 if (this.isNegative()) { // Unsigned Longs are never negative
40279 if (this.eq(MIN_VALUE)) {
40280 // We need to change the Long value before it can be negated, so we remove
40281 // the bottom-most digit in this base and then recurse to do the rest.
40282 var radixLong = fromNumber(radix),
40283 div = this.div(radixLong),
40284 rem1 = div.mul(radixLong).sub(this);
40285 return div.toString(radix) + rem1.toInt().toString(radix);
40286 } else
40287 return '-' + this.neg().toString(radix);
40288 }
40289
40290 // Do several (6) digits each time through the loop, so as to
40291 // minimize the calls to the very expensive emulated div.
40292 var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),
40293 rem = this;
40294 var result = '';
40295 while (true) {
40296 var remDiv = rem.div(radixToPower),
40297 intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,
40298 digits = intval.toString(radix);
40299 rem = remDiv;
40300 if (rem.isZero())
40301 return digits + result;
40302 else {
40303 while (digits.length < 6)
40304 digits = '0' + digits;
40305 result = '' + digits + result;
40306 }
40307 }
40308 };
40309
40310 /**
40311 * Gets the high 32 bits as a signed integer.
40312 * @returns {number} Signed high bits
40313 */
40314 LongPrototype.getHighBits = function getHighBits() {
40315 return this.high;
40316 };
40317
40318 /**
40319 * Gets the high 32 bits as an unsigned integer.
40320 * @returns {number} Unsigned high bits
40321 */
40322 LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
40323 return this.high >>> 0;
40324 };
40325
40326 /**
40327 * Gets the low 32 bits as a signed integer.
40328 * @returns {number} Signed low bits
40329 */
40330 LongPrototype.getLowBits = function getLowBits() {
40331 return this.low;
40332 };
40333
40334 /**
40335 * Gets the low 32 bits as an unsigned integer.
40336 * @returns {number} Unsigned low bits
40337 */
40338 LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
40339 return this.low >>> 0;
40340 };
40341
40342 /**
40343 * Gets the number of bits needed to represent the absolute value of this Long.
40344 * @returns {number}
40345 */
40346 LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
40347 if (this.isNegative()) // Unsigned Longs are never negative
40348 return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
40349 var val = this.high != 0 ? this.high : this.low;
40350 for (var bit = 31; bit > 0; bit--)
40351 if ((val & (1 << bit)) != 0)
40352 break;
40353 return this.high != 0 ? bit + 33 : bit + 1;
40354 };
40355
40356 /**
40357 * Tests if this Long's value equals zero.
40358 * @returns {boolean}
40359 */
40360 LongPrototype.isZero = function isZero() {
40361 return this.high === 0 && this.low === 0;
40362 };
40363
40364 /**
40365 * Tests if this Long's value is negative.
40366 * @returns {boolean}
40367 */
40368 LongPrototype.isNegative = function isNegative() {
40369 return !this.unsigned && this.high < 0;
40370 };
40371
40372 /**
40373 * Tests if this Long's value is positive.
40374 * @returns {boolean}
40375 */
40376 LongPrototype.isPositive = function isPositive() {
40377 return this.unsigned || this.high >= 0;
40378 };
40379
40380 /**
40381 * Tests if this Long's value is odd.
40382 * @returns {boolean}
40383 */
40384 LongPrototype.isOdd = function isOdd() {
40385 return (this.low & 1) === 1;
40386 };
40387
40388 /**
40389 * Tests if this Long's value is even.
40390 * @returns {boolean}
40391 */
40392 LongPrototype.isEven = function isEven() {
40393 return (this.low & 1) === 0;
40394 };
40395
40396 /**
40397 * Tests if this Long's value equals the specified's.
40398 * @param {!Long|number|string} other Other value
40399 * @returns {boolean}
40400 */
40401 LongPrototype.equals = function equals(other) {
40402 if (!isLong(other))
40403 other = fromValue(other);
40404 if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)
40405 return false;
40406 return this.high === other.high && this.low === other.low;
40407 };
40408
40409 /**
40410 * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.
40411 * @function
40412 * @param {!Long|number|string} other Other value
40413 * @returns {boolean}
40414 */
40415 LongPrototype.eq = LongPrototype.equals;
40416
40417 /**
40418 * Tests if this Long's value differs from the specified's.
40419 * @param {!Long|number|string} other Other value
40420 * @returns {boolean}
40421 */
40422 LongPrototype.notEquals = function notEquals(other) {
40423 return !this.eq(/* validates */ other);
40424 };
40425
40426 /**
40427 * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
40428 * @function
40429 * @param {!Long|number|string} other Other value
40430 * @returns {boolean}
40431 */
40432 LongPrototype.neq = LongPrototype.notEquals;
40433
40434 /**
40435 * Tests if this Long's value is less than the specified's.
40436 * @param {!Long|number|string} other Other value
40437 * @returns {boolean}
40438 */
40439 LongPrototype.lessThan = function lessThan(other) {
40440 return this.comp(/* validates */ other) < 0;
40441 };
40442
40443 /**
40444 * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.
40445 * @function
40446 * @param {!Long|number|string} other Other value
40447 * @returns {boolean}
40448 */
40449 LongPrototype.lt = LongPrototype.lessThan;
40450
40451 /**
40452 * Tests if this Long's value is less than or equal the specified's.
40453 * @param {!Long|number|string} other Other value
40454 * @returns {boolean}
40455 */
40456 LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
40457 return this.comp(/* validates */ other) <= 0;
40458 };
40459
40460 /**
40461 * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
40462 * @function
40463 * @param {!Long|number|string} other Other value
40464 * @returns {boolean}
40465 */
40466 LongPrototype.lte = LongPrototype.lessThanOrEqual;
40467
40468 /**
40469 * Tests if this Long's value is greater than the specified's.
40470 * @param {!Long|number|string} other Other value
40471 * @returns {boolean}
40472 */
40473 LongPrototype.greaterThan = function greaterThan(other) {
40474 return this.comp(/* validates */ other) > 0;
40475 };
40476
40477 /**
40478 * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.
40479 * @function
40480 * @param {!Long|number|string} other Other value
40481 * @returns {boolean}
40482 */
40483 LongPrototype.gt = LongPrototype.greaterThan;
40484
40485 /**
40486 * Tests if this Long's value is greater than or equal the specified's.
40487 * @param {!Long|number|string} other Other value
40488 * @returns {boolean}
40489 */
40490 LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
40491 return this.comp(/* validates */ other) >= 0;
40492 };
40493
40494 /**
40495 * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
40496 * @function
40497 * @param {!Long|number|string} other Other value
40498 * @returns {boolean}
40499 */
40500 LongPrototype.gte = LongPrototype.greaterThanOrEqual;
40501
40502 /**
40503 * Compares this Long's value with the specified's.
40504 * @param {!Long|number|string} other Other value
40505 * @returns {number} 0 if they are the same, 1 if the this is greater and -1
40506 * if the given one is greater
40507 */
40508 LongPrototype.compare = function compare(other) {
40509 if (!isLong(other))
40510 other = fromValue(other);
40511 if (this.eq(other))
40512 return 0;
40513 var thisNeg = this.isNegative(),
40514 otherNeg = other.isNegative();
40515 if (thisNeg && !otherNeg)
40516 return -1;
40517 if (!thisNeg && otherNeg)
40518 return 1;
40519 // At this point the sign bits are the same
40520 if (!this.unsigned)
40521 return this.sub(other).isNegative() ? -1 : 1;
40522 // Both are positive if at least one is unsigned
40523 return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;
40524 };
40525
40526 /**
40527 * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.
40528 * @function
40529 * @param {!Long|number|string} other Other value
40530 * @returns {number} 0 if they are the same, 1 if the this is greater and -1
40531 * if the given one is greater
40532 */
40533 LongPrototype.comp = LongPrototype.compare;
40534
40535 /**
40536 * Negates this Long's value.
40537 * @returns {!Long} Negated Long
40538 */
40539 LongPrototype.negate = function negate() {
40540 if (!this.unsigned && this.eq(MIN_VALUE))
40541 return MIN_VALUE;
40542 return this.not().add(ONE);
40543 };
40544
40545 /**
40546 * Negates this Long's value. This is an alias of {@link Long#negate}.
40547 * @function
40548 * @returns {!Long} Negated Long
40549 */
40550 LongPrototype.neg = LongPrototype.negate;
40551
40552 /**
40553 * Returns the sum of this and the specified Long.
40554 * @param {!Long|number|string} addend Addend
40555 * @returns {!Long} Sum
40556 */
40557 LongPrototype.add = function add(addend) {
40558 if (!isLong(addend))
40559 addend = fromValue(addend);
40560
40561 // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
40562
40563 var a48 = this.high >>> 16;
40564 var a32 = this.high & 0xFFFF;
40565 var a16 = this.low >>> 16;
40566 var a00 = this.low & 0xFFFF;
40567
40568 var b48 = addend.high >>> 16;
40569 var b32 = addend.high & 0xFFFF;
40570 var b16 = addend.low >>> 16;
40571 var b00 = addend.low & 0xFFFF;
40572
40573 var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
40574 c00 += a00 + b00;
40575 c16 += c00 >>> 16;
40576 c00 &= 0xFFFF;
40577 c16 += a16 + b16;
40578 c32 += c16 >>> 16;
40579 c16 &= 0xFFFF;
40580 c32 += a32 + b32;
40581 c48 += c32 >>> 16;
40582 c32 &= 0xFFFF;
40583 c48 += a48 + b48;
40584 c48 &= 0xFFFF;
40585 return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
40586 };
40587
40588 /**
40589 * Returns the difference of this and the specified Long.
40590 * @param {!Long|number|string} subtrahend Subtrahend
40591 * @returns {!Long} Difference
40592 */
40593 LongPrototype.subtract = function subtract(subtrahend) {
40594 if (!isLong(subtrahend))
40595 subtrahend = fromValue(subtrahend);
40596 return this.add(subtrahend.neg());
40597 };
40598
40599 /**
40600 * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.
40601 * @function
40602 * @param {!Long|number|string} subtrahend Subtrahend
40603 * @returns {!Long} Difference
40604 */
40605 LongPrototype.sub = LongPrototype.subtract;
40606
40607 /**
40608 * Returns the product of this and the specified Long.
40609 * @param {!Long|number|string} multiplier Multiplier
40610 * @returns {!Long} Product
40611 */
40612 LongPrototype.multiply = function multiply(multiplier) {
40613 if (this.isZero())
40614 return ZERO;
40615 if (!isLong(multiplier))
40616 multiplier = fromValue(multiplier);
40617 if (multiplier.isZero())
40618 return ZERO;
40619 if (this.eq(MIN_VALUE))
40620 return multiplier.isOdd() ? MIN_VALUE : ZERO;
40621 if (multiplier.eq(MIN_VALUE))
40622 return this.isOdd() ? MIN_VALUE : ZERO;
40623
40624 if (this.isNegative()) {
40625 if (multiplier.isNegative())
40626 return this.neg().mul(multiplier.neg());
40627 else
40628 return this.neg().mul(multiplier).neg();
40629 } else if (multiplier.isNegative())
40630 return this.mul(multiplier.neg()).neg();
40631
40632 // If both longs are small, use float multiplication
40633 if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
40634 return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
40635
40636 // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
40637 // We can skip products that would overflow.
40638
40639 var a48 = this.high >>> 16;
40640 var a32 = this.high & 0xFFFF;
40641 var a16 = this.low >>> 16;
40642 var a00 = this.low & 0xFFFF;
40643
40644 var b48 = multiplier.high >>> 16;
40645 var b32 = multiplier.high & 0xFFFF;
40646 var b16 = multiplier.low >>> 16;
40647 var b00 = multiplier.low & 0xFFFF;
40648
40649 var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
40650 c00 += a00 * b00;
40651 c16 += c00 >>> 16;
40652 c00 &= 0xFFFF;
40653 c16 += a16 * b00;
40654 c32 += c16 >>> 16;
40655 c16 &= 0xFFFF;
40656 c16 += a00 * b16;
40657 c32 += c16 >>> 16;
40658 c16 &= 0xFFFF;
40659 c32 += a32 * b00;
40660 c48 += c32 >>> 16;
40661 c32 &= 0xFFFF;
40662 c32 += a16 * b16;
40663 c48 += c32 >>> 16;
40664 c32 &= 0xFFFF;
40665 c32 += a00 * b32;
40666 c48 += c32 >>> 16;
40667 c32 &= 0xFFFF;
40668 c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
40669 c48 &= 0xFFFF;
40670 return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
40671 };
40672
40673 /**
40674 * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.
40675 * @function
40676 * @param {!Long|number|string} multiplier Multiplier
40677 * @returns {!Long} Product
40678 */
40679 LongPrototype.mul = LongPrototype.multiply;
40680
40681 /**
40682 * Returns this Long divided by the specified. The result is signed if this Long is signed or
40683 * unsigned if this Long is unsigned.
40684 * @param {!Long|number|string} divisor Divisor
40685 * @returns {!Long} Quotient
40686 */
40687 LongPrototype.divide = function divide(divisor) {
40688 if (!isLong(divisor))
40689 divisor = fromValue(divisor);
40690 if (divisor.isZero())
40691 throw Error('division by zero');
40692 if (this.isZero())
40693 return this.unsigned ? UZERO : ZERO;
40694 var approx, rem, res;
40695 if (!this.unsigned) {
40696 // This section is only relevant for signed longs and is derived from the
40697 // closure library as a whole.
40698 if (this.eq(MIN_VALUE)) {
40699 if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
40700 return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
40701 else if (divisor.eq(MIN_VALUE))
40702 return ONE;
40703 else {
40704 // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
40705 var halfThis = this.shr(1);
40706 approx = halfThis.div(divisor).shl(1);
40707 if (approx.eq(ZERO)) {
40708 return divisor.isNegative() ? ONE : NEG_ONE;
40709 } else {
40710 rem = this.sub(divisor.mul(approx));
40711 res = approx.add(rem.div(divisor));
40712 return res;
40713 }
40714 }
40715 } else if (divisor.eq(MIN_VALUE))
40716 return this.unsigned ? UZERO : ZERO;
40717 if (this.isNegative()) {
40718 if (divisor.isNegative())
40719 return this.neg().div(divisor.neg());
40720 return this.neg().div(divisor).neg();
40721 } else if (divisor.isNegative())
40722 return this.div(divisor.neg()).neg();
40723 res = ZERO;
40724 } else {
40725 // The algorithm below has not been made for unsigned longs. It's therefore
40726 // required to take special care of the MSB prior to running it.
40727 if (!divisor.unsigned)
40728 divisor = divisor.toUnsigned();
40729 if (divisor.gt(this))
40730 return UZERO;
40731 if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true
40732 return UONE;
40733 res = UZERO;
40734 }
40735
40736 // Repeat the following until the remainder is less than other: find a
40737 // floating-point that approximates remainder / other *from below*, add this
40738 // into the result, and subtract it from the remainder. It is critical that
40739 // the approximate value is less than or equal to the real value so that the
40740 // remainder never becomes negative.
40741 rem = this;
40742 while (rem.gte(divisor)) {
40743 // Approximate the result of division. This may be a little greater or
40744 // smaller than the actual value.
40745 approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
40746
40747 // We will tweak the approximate result by changing it in the 48-th digit or
40748 // the smallest non-fractional digit, whichever is larger.
40749 var log2 = Math.ceil(Math.log(approx) / Math.LN2),
40750 delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),
40751
40752 // Decrease the approximation until it is smaller than the remainder. Note
40753 // that if it is too large, the product overflows and is negative.
40754 approxRes = fromNumber(approx),
40755 approxRem = approxRes.mul(divisor);
40756 while (approxRem.isNegative() || approxRem.gt(rem)) {
40757 approx -= delta;
40758 approxRes = fromNumber(approx, this.unsigned);
40759 approxRem = approxRes.mul(divisor);
40760 }
40761
40762 // We know the answer can't be zero... and actually, zero would cause
40763 // infinite recursion since we would make no progress.
40764 if (approxRes.isZero())
40765 approxRes = ONE;
40766
40767 res = res.add(approxRes);
40768 rem = rem.sub(approxRem);
40769 }
40770 return res;
40771 };
40772
40773 /**
40774 * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.
40775 * @function
40776 * @param {!Long|number|string} divisor Divisor
40777 * @returns {!Long} Quotient
40778 */
40779 LongPrototype.div = LongPrototype.divide;
40780
40781 /**
40782 * Returns this Long modulo the specified.
40783 * @param {!Long|number|string} divisor Divisor
40784 * @returns {!Long} Remainder
40785 */
40786 LongPrototype.modulo = function modulo(divisor) {
40787 if (!isLong(divisor))
40788 divisor = fromValue(divisor);
40789 return this.sub(this.div(divisor).mul(divisor));
40790 };
40791
40792 /**
40793 * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
40794 * @function
40795 * @param {!Long|number|string} divisor Divisor
40796 * @returns {!Long} Remainder
40797 */
40798 LongPrototype.mod = LongPrototype.modulo;
40799
40800 /**
40801 * Returns the bitwise NOT of this Long.
40802 * @returns {!Long}
40803 */
40804 LongPrototype.not = function not() {
40805 return fromBits(~this.low, ~this.high, this.unsigned);
40806 };
40807
40808 /**
40809 * Returns the bitwise AND of this Long and the specified.
40810 * @param {!Long|number|string} other Other Long
40811 * @returns {!Long}
40812 */
40813 LongPrototype.and = function and(other) {
40814 if (!isLong(other))
40815 other = fromValue(other);
40816 return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
40817 };
40818
40819 /**
40820 * Returns the bitwise OR of this Long and the specified.
40821 * @param {!Long|number|string} other Other Long
40822 * @returns {!Long}
40823 */
40824 LongPrototype.or = function or(other) {
40825 if (!isLong(other))
40826 other = fromValue(other);
40827 return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
40828 };
40829
40830 /**
40831 * Returns the bitwise XOR of this Long and the given one.
40832 * @param {!Long|number|string} other Other Long
40833 * @returns {!Long}
40834 */
40835 LongPrototype.xor = function xor(other) {
40836 if (!isLong(other))
40837 other = fromValue(other);
40838 return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
40839 };
40840
40841 /**
40842 * Returns this Long with bits shifted to the left by the given amount.
40843 * @param {number|!Long} numBits Number of bits
40844 * @returns {!Long} Shifted Long
40845 */
40846 LongPrototype.shiftLeft = function shiftLeft(numBits) {
40847 if (isLong(numBits))
40848 numBits = numBits.toInt();
40849 if ((numBits &= 63) === 0)
40850 return this;
40851 else if (numBits < 32)
40852 return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
40853 else
40854 return fromBits(0, this.low << (numBits - 32), this.unsigned);
40855 };
40856
40857 /**
40858 * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.
40859 * @function
40860 * @param {number|!Long} numBits Number of bits
40861 * @returns {!Long} Shifted Long
40862 */
40863 LongPrototype.shl = LongPrototype.shiftLeft;
40864
40865 /**
40866 * Returns this Long with bits arithmetically shifted to the right by the given amount.
40867 * @param {number|!Long} numBits Number of bits
40868 * @returns {!Long} Shifted Long
40869 */
40870 LongPrototype.shiftRight = function shiftRight(numBits) {
40871 if (isLong(numBits))
40872 numBits = numBits.toInt();
40873 if ((numBits &= 63) === 0)
40874 return this;
40875 else if (numBits < 32)
40876 return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
40877 else
40878 return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
40879 };
40880
40881 /**
40882 * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.
40883 * @function
40884 * @param {number|!Long} numBits Number of bits
40885 * @returns {!Long} Shifted Long
40886 */
40887 LongPrototype.shr = LongPrototype.shiftRight;
40888
40889 /**
40890 * Returns this Long with bits logically shifted to the right by the given amount.
40891 * @param {number|!Long} numBits Number of bits
40892 * @returns {!Long} Shifted Long
40893 */
40894 LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
40895 if (isLong(numBits))
40896 numBits = numBits.toInt();
40897 numBits &= 63;
40898 if (numBits === 0)
40899 return this;
40900 else {
40901 var high = this.high;
40902 if (numBits < 32) {
40903 var low = this.low;
40904 return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);
40905 } else if (numBits === 32)
40906 return fromBits(high, 0, this.unsigned);
40907 else
40908 return fromBits(high >>> (numBits - 32), 0, this.unsigned);
40909 }
40910 };
40911
40912 /**
40913 * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
40914 * @function
40915 * @param {number|!Long} numBits Number of bits
40916 * @returns {!Long} Shifted Long
40917 */
40918 LongPrototype.shru = LongPrototype.shiftRightUnsigned;
40919
40920 /**
40921 * Converts this Long to signed.
40922 * @returns {!Long} Signed long
40923 */
40924 LongPrototype.toSigned = function toSigned() {
40925 if (!this.unsigned)
40926 return this;
40927 return fromBits(this.low, this.high, false);
40928 };
40929
40930 /**
40931 * Converts this Long to unsigned.
40932 * @returns {!Long} Unsigned long
40933 */
40934 LongPrototype.toUnsigned = function toUnsigned() {
40935 if (this.unsigned)
40936 return this;
40937 return fromBits(this.low, this.high, true);
40938 };
40939
40940 /**
40941 * Converts this Long to its byte representation.
40942 * @param {boolean=} le Whether little or big endian, defaults to big endian
40943 * @returns {!Array.<number>} Byte representation
40944 */
40945 LongPrototype.toBytes = function(le) {
40946 return le ? this.toBytesLE() : this.toBytesBE();
40947 }
40948
40949 /**
40950 * Converts this Long to its little endian byte representation.
40951 * @returns {!Array.<number>} Little endian byte representation
40952 */
40953 LongPrototype.toBytesLE = function() {
40954 var hi = this.high,
40955 lo = this.low;
40956 return [
40957 lo & 0xff,
40958 (lo >>> 8) & 0xff,
40959 (lo >>> 16) & 0xff,
40960 (lo >>> 24) & 0xff,
40961 hi & 0xff,
40962 (hi >>> 8) & 0xff,
40963 (hi >>> 16) & 0xff,
40964 (hi >>> 24) & 0xff
40965 ];
40966 }
40967
40968 /**
40969 * Converts this Long to its big endian byte representation.
40970 * @returns {!Array.<number>} Big endian byte representation
40971 */
40972 LongPrototype.toBytesBE = function() {
40973 var hi = this.high,
40974 lo = this.low;
40975 return [
40976 (hi >>> 24) & 0xff,
40977 (hi >>> 16) & 0xff,
40978 (hi >>> 8) & 0xff,
40979 hi & 0xff,
40980 (lo >>> 24) & 0xff,
40981 (lo >>> 16) & 0xff,
40982 (lo >>> 8) & 0xff,
40983 lo & 0xff
40984 ];
40985 }
40986
40987 return Long;
40988});
40989
40990
40991/***/ }),
40992/* 615 */
40993/***/ (function(module, exports) {
40994
40995/* (ignored) */
40996
40997/***/ }),
40998/* 616 */
40999/***/ (function(module, exports, __webpack_require__) {
41000
41001"use strict";
41002
41003
41004var _interopRequireDefault = __webpack_require__(1);
41005
41006var _slice = _interopRequireDefault(__webpack_require__(61));
41007
41008var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(153));
41009
41010var _concat = _interopRequireDefault(__webpack_require__(22));
41011
41012var has = Object.prototype.hasOwnProperty,
41013 prefix = '~';
41014/**
41015 * Constructor to create a storage for our `EE` objects.
41016 * An `Events` instance is a plain object whose properties are event names.
41017 *
41018 * @constructor
41019 * @private
41020 */
41021
41022function Events() {} //
41023// We try to not inherit from `Object.prototype`. In some engines creating an
41024// instance in this way is faster than calling `Object.create(null)` directly.
41025// If `Object.create(null)` is not supported we prefix the event names with a
41026// character to make sure that the built-in object properties are not
41027// overridden or used as an attack vector.
41028//
41029
41030
41031if (Object.create) {
41032 Events.prototype = Object.create(null); //
41033 // This hack is needed because the `__proto__` property is still inherited in
41034 // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
41035 //
41036
41037 if (!new Events().__proto__) prefix = false;
41038}
41039/**
41040 * Representation of a single event listener.
41041 *
41042 * @param {Function} fn The listener function.
41043 * @param {*} context The context to invoke the listener with.
41044 * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
41045 * @constructor
41046 * @private
41047 */
41048
41049
41050function EE(fn, context, once) {
41051 this.fn = fn;
41052 this.context = context;
41053 this.once = once || false;
41054}
41055/**
41056 * Add a listener for a given event.
41057 *
41058 * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
41059 * @param {(String|Symbol)} event The event name.
41060 * @param {Function} fn The listener function.
41061 * @param {*} context The context to invoke the listener with.
41062 * @param {Boolean} once Specify if the listener is a one-time listener.
41063 * @returns {EventEmitter}
41064 * @private
41065 */
41066
41067
41068function addListener(emitter, event, fn, context, once) {
41069 if (typeof fn !== 'function') {
41070 throw new TypeError('The listener must be a function');
41071 }
41072
41073 var listener = new EE(fn, context || emitter, once),
41074 evt = prefix ? prefix + event : event;
41075 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];
41076 return emitter;
41077}
41078/**
41079 * Clear event by name.
41080 *
41081 * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
41082 * @param {(String|Symbol)} evt The Event name.
41083 * @private
41084 */
41085
41086
41087function clearEvent(emitter, evt) {
41088 if (--emitter._eventsCount === 0) emitter._events = new Events();else delete emitter._events[evt];
41089}
41090/**
41091 * Minimal `EventEmitter` interface that is molded against the Node.js
41092 * `EventEmitter` interface.
41093 *
41094 * @constructor
41095 * @public
41096 */
41097
41098
41099function EventEmitter() {
41100 this._events = new Events();
41101 this._eventsCount = 0;
41102}
41103/**
41104 * Return an array listing the events for which the emitter has registered
41105 * listeners.
41106 *
41107 * @returns {Array}
41108 * @public
41109 */
41110
41111
41112EventEmitter.prototype.eventNames = function eventNames() {
41113 var names = [],
41114 events,
41115 name;
41116 if (this._eventsCount === 0) return names;
41117
41118 for (name in events = this._events) {
41119 if (has.call(events, name)) names.push(prefix ? (0, _slice.default)(name).call(name, 1) : name);
41120 }
41121
41122 if (_getOwnPropertySymbols.default) {
41123 return (0, _concat.default)(names).call(names, (0, _getOwnPropertySymbols.default)(events));
41124 }
41125
41126 return names;
41127};
41128/**
41129 * Return the listeners registered for a given event.
41130 *
41131 * @param {(String|Symbol)} event The event name.
41132 * @returns {Array} The registered listeners.
41133 * @public
41134 */
41135
41136
41137EventEmitter.prototype.listeners = function listeners(event) {
41138 var evt = prefix ? prefix + event : event,
41139 handlers = this._events[evt];
41140 if (!handlers) return [];
41141 if (handlers.fn) return [handlers.fn];
41142
41143 for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
41144 ee[i] = handlers[i].fn;
41145 }
41146
41147 return ee;
41148};
41149/**
41150 * Return the number of listeners listening to a given event.
41151 *
41152 * @param {(String|Symbol)} event The event name.
41153 * @returns {Number} The number of listeners.
41154 * @public
41155 */
41156
41157
41158EventEmitter.prototype.listenerCount = function listenerCount(event) {
41159 var evt = prefix ? prefix + event : event,
41160 listeners = this._events[evt];
41161 if (!listeners) return 0;
41162 if (listeners.fn) return 1;
41163 return listeners.length;
41164};
41165/**
41166 * Calls each of the listeners registered for a given event.
41167 *
41168 * @param {(String|Symbol)} event The event name.
41169 * @returns {Boolean} `true` if the event had listeners, else `false`.
41170 * @public
41171 */
41172
41173
41174EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
41175 var evt = prefix ? prefix + event : event;
41176 if (!this._events[evt]) return false;
41177 var listeners = this._events[evt],
41178 len = arguments.length,
41179 args,
41180 i;
41181
41182 if (listeners.fn) {
41183 if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
41184
41185 switch (len) {
41186 case 1:
41187 return listeners.fn.call(listeners.context), true;
41188
41189 case 2:
41190 return listeners.fn.call(listeners.context, a1), true;
41191
41192 case 3:
41193 return listeners.fn.call(listeners.context, a1, a2), true;
41194
41195 case 4:
41196 return listeners.fn.call(listeners.context, a1, a2, a3), true;
41197
41198 case 5:
41199 return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
41200
41201 case 6:
41202 return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
41203 }
41204
41205 for (i = 1, args = new Array(len - 1); i < len; i++) {
41206 args[i - 1] = arguments[i];
41207 }
41208
41209 listeners.fn.apply(listeners.context, args);
41210 } else {
41211 var length = listeners.length,
41212 j;
41213
41214 for (i = 0; i < length; i++) {
41215 if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
41216
41217 switch (len) {
41218 case 1:
41219 listeners[i].fn.call(listeners[i].context);
41220 break;
41221
41222 case 2:
41223 listeners[i].fn.call(listeners[i].context, a1);
41224 break;
41225
41226 case 3:
41227 listeners[i].fn.call(listeners[i].context, a1, a2);
41228 break;
41229
41230 case 4:
41231 listeners[i].fn.call(listeners[i].context, a1, a2, a3);
41232 break;
41233
41234 default:
41235 if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) {
41236 args[j - 1] = arguments[j];
41237 }
41238 listeners[i].fn.apply(listeners[i].context, args);
41239 }
41240 }
41241 }
41242
41243 return true;
41244};
41245/**
41246 * Add a listener for a given event.
41247 *
41248 * @param {(String|Symbol)} event The event name.
41249 * @param {Function} fn The listener function.
41250 * @param {*} [context=this] The context to invoke the listener with.
41251 * @returns {EventEmitter} `this`.
41252 * @public
41253 */
41254
41255
41256EventEmitter.prototype.on = function on(event, fn, context) {
41257 return addListener(this, event, fn, context, false);
41258};
41259/**
41260 * Add a one-time listener for a given event.
41261 *
41262 * @param {(String|Symbol)} event The event name.
41263 * @param {Function} fn The listener function.
41264 * @param {*} [context=this] The context to invoke the listener with.
41265 * @returns {EventEmitter} `this`.
41266 * @public
41267 */
41268
41269
41270EventEmitter.prototype.once = function once(event, fn, context) {
41271 return addListener(this, event, fn, context, true);
41272};
41273/**
41274 * Remove the listeners of a given event.
41275 *
41276 * @param {(String|Symbol)} event The event name.
41277 * @param {Function} fn Only remove the listeners that match this function.
41278 * @param {*} context Only remove the listeners that have this context.
41279 * @param {Boolean} once Only remove one-time listeners.
41280 * @returns {EventEmitter} `this`.
41281 * @public
41282 */
41283
41284
41285EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
41286 var evt = prefix ? prefix + event : event;
41287 if (!this._events[evt]) return this;
41288
41289 if (!fn) {
41290 clearEvent(this, evt);
41291 return this;
41292 }
41293
41294 var listeners = this._events[evt];
41295
41296 if (listeners.fn) {
41297 if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
41298 clearEvent(this, evt);
41299 }
41300 } else {
41301 for (var i = 0, events = [], length = listeners.length; i < length; i++) {
41302 if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) {
41303 events.push(listeners[i]);
41304 }
41305 } //
41306 // Reset the array, or remove it completely if we have no more listeners.
41307 //
41308
41309
41310 if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;else clearEvent(this, evt);
41311 }
41312
41313 return this;
41314};
41315/**
41316 * Remove all listeners, or those of the specified event.
41317 *
41318 * @param {(String|Symbol)} [event] The event name.
41319 * @returns {EventEmitter} `this`.
41320 * @public
41321 */
41322
41323
41324EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
41325 var evt;
41326
41327 if (event) {
41328 evt = prefix ? prefix + event : event;
41329 if (this._events[evt]) clearEvent(this, evt);
41330 } else {
41331 this._events = new Events();
41332 this._eventsCount = 0;
41333 }
41334
41335 return this;
41336}; //
41337// Alias methods names because people roll like that.
41338//
41339
41340
41341EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
41342EventEmitter.prototype.addListener = EventEmitter.prototype.on; //
41343// Expose the prefix.
41344//
41345
41346EventEmitter.prefixed = prefix; //
41347// Allow `EventEmitter` to be imported as module namespace.
41348//
41349
41350EventEmitter.EventEmitter = EventEmitter; //
41351// Expose the module.
41352//
41353
41354if (true) {
41355 module.exports = EventEmitter;
41356}
41357
41358/***/ }),
41359/* 617 */
41360/***/ (function(module, exports, __webpack_require__) {
41361
41362module.exports = __webpack_require__(618);
41363
41364
41365/***/ }),
41366/* 618 */
41367/***/ (function(module, exports, __webpack_require__) {
41368
41369/**
41370 * Copyright (c) 2014-present, Facebook, Inc.
41371 *
41372 * This source code is licensed under the MIT license found in the
41373 * LICENSE file in the root directory of this source tree.
41374 */
41375
41376var runtime = (function (exports) {
41377 "use strict";
41378
41379 var Op = Object.prototype;
41380 var hasOwn = Op.hasOwnProperty;
41381 var undefined; // More compressible than void 0.
41382 var $Symbol = typeof Symbol === "function" ? Symbol : {};
41383 var iteratorSymbol = $Symbol.iterator || "@@iterator";
41384 var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
41385 var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
41386
41387 function define(obj, key, value) {
41388 Object.defineProperty(obj, key, {
41389 value: value,
41390 enumerable: true,
41391 configurable: true,
41392 writable: true
41393 });
41394 return obj[key];
41395 }
41396 try {
41397 // IE 8 has a broken Object.defineProperty that only works on DOM objects.
41398 define({}, "");
41399 } catch (err) {
41400 define = function(obj, key, value) {
41401 return obj[key] = value;
41402 };
41403 }
41404
41405 function wrap(innerFn, outerFn, self, tryLocsList) {
41406 // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
41407 var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
41408 var generator = Object.create(protoGenerator.prototype);
41409 var context = new Context(tryLocsList || []);
41410
41411 // The ._invoke method unifies the implementations of the .next,
41412 // .throw, and .return methods.
41413 generator._invoke = makeInvokeMethod(innerFn, self, context);
41414
41415 return generator;
41416 }
41417 exports.wrap = wrap;
41418
41419 // Try/catch helper to minimize deoptimizations. Returns a completion
41420 // record like context.tryEntries[i].completion. This interface could
41421 // have been (and was previously) designed to take a closure to be
41422 // invoked without arguments, but in all the cases we care about we
41423 // already have an existing method we want to call, so there's no need
41424 // to create a new function object. We can even get away with assuming
41425 // the method takes exactly one argument, since that happens to be true
41426 // in every case, so we don't have to touch the arguments object. The
41427 // only additional allocation required is the completion record, which
41428 // has a stable shape and so hopefully should be cheap to allocate.
41429 function tryCatch(fn, obj, arg) {
41430 try {
41431 return { type: "normal", arg: fn.call(obj, arg) };
41432 } catch (err) {
41433 return { type: "throw", arg: err };
41434 }
41435 }
41436
41437 var GenStateSuspendedStart = "suspendedStart";
41438 var GenStateSuspendedYield = "suspendedYield";
41439 var GenStateExecuting = "executing";
41440 var GenStateCompleted = "completed";
41441
41442 // Returning this object from the innerFn has the same effect as
41443 // breaking out of the dispatch switch statement.
41444 var ContinueSentinel = {};
41445
41446 // Dummy constructor functions that we use as the .constructor and
41447 // .constructor.prototype properties for functions that return Generator
41448 // objects. For full spec compliance, you may wish to configure your
41449 // minifier not to mangle the names of these two functions.
41450 function Generator() {}
41451 function GeneratorFunction() {}
41452 function GeneratorFunctionPrototype() {}
41453
41454 // This is a polyfill for %IteratorPrototype% for environments that
41455 // don't natively support it.
41456 var IteratorPrototype = {};
41457 IteratorPrototype[iteratorSymbol] = function () {
41458 return this;
41459 };
41460
41461 var getProto = Object.getPrototypeOf;
41462 var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
41463 if (NativeIteratorPrototype &&
41464 NativeIteratorPrototype !== Op &&
41465 hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
41466 // This environment has a native %IteratorPrototype%; use it instead
41467 // of the polyfill.
41468 IteratorPrototype = NativeIteratorPrototype;
41469 }
41470
41471 var Gp = GeneratorFunctionPrototype.prototype =
41472 Generator.prototype = Object.create(IteratorPrototype);
41473 GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
41474 GeneratorFunctionPrototype.constructor = GeneratorFunction;
41475 GeneratorFunction.displayName = define(
41476 GeneratorFunctionPrototype,
41477 toStringTagSymbol,
41478 "GeneratorFunction"
41479 );
41480
41481 // Helper for defining the .next, .throw, and .return methods of the
41482 // Iterator interface in terms of a single ._invoke method.
41483 function defineIteratorMethods(prototype) {
41484 ["next", "throw", "return"].forEach(function(method) {
41485 define(prototype, method, function(arg) {
41486 return this._invoke(method, arg);
41487 });
41488 });
41489 }
41490
41491 exports.isGeneratorFunction = function(genFun) {
41492 var ctor = typeof genFun === "function" && genFun.constructor;
41493 return ctor
41494 ? ctor === GeneratorFunction ||
41495 // For the native GeneratorFunction constructor, the best we can
41496 // do is to check its .name property.
41497 (ctor.displayName || ctor.name) === "GeneratorFunction"
41498 : false;
41499 };
41500
41501 exports.mark = function(genFun) {
41502 if (Object.setPrototypeOf) {
41503 Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
41504 } else {
41505 genFun.__proto__ = GeneratorFunctionPrototype;
41506 define(genFun, toStringTagSymbol, "GeneratorFunction");
41507 }
41508 genFun.prototype = Object.create(Gp);
41509 return genFun;
41510 };
41511
41512 // Within the body of any async function, `await x` is transformed to
41513 // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
41514 // `hasOwn.call(value, "__await")` to determine if the yielded value is
41515 // meant to be awaited.
41516 exports.awrap = function(arg) {
41517 return { __await: arg };
41518 };
41519
41520 function AsyncIterator(generator, PromiseImpl) {
41521 function invoke(method, arg, resolve, reject) {
41522 var record = tryCatch(generator[method], generator, arg);
41523 if (record.type === "throw") {
41524 reject(record.arg);
41525 } else {
41526 var result = record.arg;
41527 var value = result.value;
41528 if (value &&
41529 typeof value === "object" &&
41530 hasOwn.call(value, "__await")) {
41531 return PromiseImpl.resolve(value.__await).then(function(value) {
41532 invoke("next", value, resolve, reject);
41533 }, function(err) {
41534 invoke("throw", err, resolve, reject);
41535 });
41536 }
41537
41538 return PromiseImpl.resolve(value).then(function(unwrapped) {
41539 // When a yielded Promise is resolved, its final value becomes
41540 // the .value of the Promise<{value,done}> result for the
41541 // current iteration.
41542 result.value = unwrapped;
41543 resolve(result);
41544 }, function(error) {
41545 // If a rejected Promise was yielded, throw the rejection back
41546 // into the async generator function so it can be handled there.
41547 return invoke("throw", error, resolve, reject);
41548 });
41549 }
41550 }
41551
41552 var previousPromise;
41553
41554 function enqueue(method, arg) {
41555 function callInvokeWithMethodAndArg() {
41556 return new PromiseImpl(function(resolve, reject) {
41557 invoke(method, arg, resolve, reject);
41558 });
41559 }
41560
41561 return previousPromise =
41562 // If enqueue has been called before, then we want to wait until
41563 // all previous Promises have been resolved before calling invoke,
41564 // so that results are always delivered in the correct order. If
41565 // enqueue has not been called before, then it is important to
41566 // call invoke immediately, without waiting on a callback to fire,
41567 // so that the async generator function has the opportunity to do
41568 // any necessary setup in a predictable way. This predictability
41569 // is why the Promise constructor synchronously invokes its
41570 // executor callback, and why async functions synchronously
41571 // execute code before the first await. Since we implement simple
41572 // async functions in terms of async generators, it is especially
41573 // important to get this right, even though it requires care.
41574 previousPromise ? previousPromise.then(
41575 callInvokeWithMethodAndArg,
41576 // Avoid propagating failures to Promises returned by later
41577 // invocations of the iterator.
41578 callInvokeWithMethodAndArg
41579 ) : callInvokeWithMethodAndArg();
41580 }
41581
41582 // Define the unified helper method that is used to implement .next,
41583 // .throw, and .return (see defineIteratorMethods).
41584 this._invoke = enqueue;
41585 }
41586
41587 defineIteratorMethods(AsyncIterator.prototype);
41588 AsyncIterator.prototype[asyncIteratorSymbol] = function () {
41589 return this;
41590 };
41591 exports.AsyncIterator = AsyncIterator;
41592
41593 // Note that simple async functions are implemented on top of
41594 // AsyncIterator objects; they just return a Promise for the value of
41595 // the final result produced by the iterator.
41596 exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
41597 if (PromiseImpl === void 0) PromiseImpl = Promise;
41598
41599 var iter = new AsyncIterator(
41600 wrap(innerFn, outerFn, self, tryLocsList),
41601 PromiseImpl
41602 );
41603
41604 return exports.isGeneratorFunction(outerFn)
41605 ? iter // If outerFn is a generator, return the full iterator.
41606 : iter.next().then(function(result) {
41607 return result.done ? result.value : iter.next();
41608 });
41609 };
41610
41611 function makeInvokeMethod(innerFn, self, context) {
41612 var state = GenStateSuspendedStart;
41613
41614 return function invoke(method, arg) {
41615 if (state === GenStateExecuting) {
41616 throw new Error("Generator is already running");
41617 }
41618
41619 if (state === GenStateCompleted) {
41620 if (method === "throw") {
41621 throw arg;
41622 }
41623
41624 // Be forgiving, per 25.3.3.3.3 of the spec:
41625 // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
41626 return doneResult();
41627 }
41628
41629 context.method = method;
41630 context.arg = arg;
41631
41632 while (true) {
41633 var delegate = context.delegate;
41634 if (delegate) {
41635 var delegateResult = maybeInvokeDelegate(delegate, context);
41636 if (delegateResult) {
41637 if (delegateResult === ContinueSentinel) continue;
41638 return delegateResult;
41639 }
41640 }
41641
41642 if (context.method === "next") {
41643 // Setting context._sent for legacy support of Babel's
41644 // function.sent implementation.
41645 context.sent = context._sent = context.arg;
41646
41647 } else if (context.method === "throw") {
41648 if (state === GenStateSuspendedStart) {
41649 state = GenStateCompleted;
41650 throw context.arg;
41651 }
41652
41653 context.dispatchException(context.arg);
41654
41655 } else if (context.method === "return") {
41656 context.abrupt("return", context.arg);
41657 }
41658
41659 state = GenStateExecuting;
41660
41661 var record = tryCatch(innerFn, self, context);
41662 if (record.type === "normal") {
41663 // If an exception is thrown from innerFn, we leave state ===
41664 // GenStateExecuting and loop back for another invocation.
41665 state = context.done
41666 ? GenStateCompleted
41667 : GenStateSuspendedYield;
41668
41669 if (record.arg === ContinueSentinel) {
41670 continue;
41671 }
41672
41673 return {
41674 value: record.arg,
41675 done: context.done
41676 };
41677
41678 } else if (record.type === "throw") {
41679 state = GenStateCompleted;
41680 // Dispatch the exception by looping back around to the
41681 // context.dispatchException(context.arg) call above.
41682 context.method = "throw";
41683 context.arg = record.arg;
41684 }
41685 }
41686 };
41687 }
41688
41689 // Call delegate.iterator[context.method](context.arg) and handle the
41690 // result, either by returning a { value, done } result from the
41691 // delegate iterator, or by modifying context.method and context.arg,
41692 // setting context.delegate to null, and returning the ContinueSentinel.
41693 function maybeInvokeDelegate(delegate, context) {
41694 var method = delegate.iterator[context.method];
41695 if (method === undefined) {
41696 // A .throw or .return when the delegate iterator has no .throw
41697 // method always terminates the yield* loop.
41698 context.delegate = null;
41699
41700 if (context.method === "throw") {
41701 // Note: ["return"] must be used for ES3 parsing compatibility.
41702 if (delegate.iterator["return"]) {
41703 // If the delegate iterator has a return method, give it a
41704 // chance to clean up.
41705 context.method = "return";
41706 context.arg = undefined;
41707 maybeInvokeDelegate(delegate, context);
41708
41709 if (context.method === "throw") {
41710 // If maybeInvokeDelegate(context) changed context.method from
41711 // "return" to "throw", let that override the TypeError below.
41712 return ContinueSentinel;
41713 }
41714 }
41715
41716 context.method = "throw";
41717 context.arg = new TypeError(
41718 "The iterator does not provide a 'throw' method");
41719 }
41720
41721 return ContinueSentinel;
41722 }
41723
41724 var record = tryCatch(method, delegate.iterator, context.arg);
41725
41726 if (record.type === "throw") {
41727 context.method = "throw";
41728 context.arg = record.arg;
41729 context.delegate = null;
41730 return ContinueSentinel;
41731 }
41732
41733 var info = record.arg;
41734
41735 if (! info) {
41736 context.method = "throw";
41737 context.arg = new TypeError("iterator result is not an object");
41738 context.delegate = null;
41739 return ContinueSentinel;
41740 }
41741
41742 if (info.done) {
41743 // Assign the result of the finished delegate to the temporary
41744 // variable specified by delegate.resultName (see delegateYield).
41745 context[delegate.resultName] = info.value;
41746
41747 // Resume execution at the desired location (see delegateYield).
41748 context.next = delegate.nextLoc;
41749
41750 // If context.method was "throw" but the delegate handled the
41751 // exception, let the outer generator proceed normally. If
41752 // context.method was "next", forget context.arg since it has been
41753 // "consumed" by the delegate iterator. If context.method was
41754 // "return", allow the original .return call to continue in the
41755 // outer generator.
41756 if (context.method !== "return") {
41757 context.method = "next";
41758 context.arg = undefined;
41759 }
41760
41761 } else {
41762 // Re-yield the result returned by the delegate method.
41763 return info;
41764 }
41765
41766 // The delegate iterator is finished, so forget it and continue with
41767 // the outer generator.
41768 context.delegate = null;
41769 return ContinueSentinel;
41770 }
41771
41772 // Define Generator.prototype.{next,throw,return} in terms of the
41773 // unified ._invoke helper method.
41774 defineIteratorMethods(Gp);
41775
41776 define(Gp, toStringTagSymbol, "Generator");
41777
41778 // A Generator should always return itself as the iterator object when the
41779 // @@iterator function is called on it. Some browsers' implementations of the
41780 // iterator prototype chain incorrectly implement this, causing the Generator
41781 // object to not be returned from this call. This ensures that doesn't happen.
41782 // See https://github.com/facebook/regenerator/issues/274 for more details.
41783 Gp[iteratorSymbol] = function() {
41784 return this;
41785 };
41786
41787 Gp.toString = function() {
41788 return "[object Generator]";
41789 };
41790
41791 function pushTryEntry(locs) {
41792 var entry = { tryLoc: locs[0] };
41793
41794 if (1 in locs) {
41795 entry.catchLoc = locs[1];
41796 }
41797
41798 if (2 in locs) {
41799 entry.finallyLoc = locs[2];
41800 entry.afterLoc = locs[3];
41801 }
41802
41803 this.tryEntries.push(entry);
41804 }
41805
41806 function resetTryEntry(entry) {
41807 var record = entry.completion || {};
41808 record.type = "normal";
41809 delete record.arg;
41810 entry.completion = record;
41811 }
41812
41813 function Context(tryLocsList) {
41814 // The root entry object (effectively a try statement without a catch
41815 // or a finally block) gives us a place to store values thrown from
41816 // locations where there is no enclosing try statement.
41817 this.tryEntries = [{ tryLoc: "root" }];
41818 tryLocsList.forEach(pushTryEntry, this);
41819 this.reset(true);
41820 }
41821
41822 exports.keys = function(object) {
41823 var keys = [];
41824 for (var key in object) {
41825 keys.push(key);
41826 }
41827 keys.reverse();
41828
41829 // Rather than returning an object with a next method, we keep
41830 // things simple and return the next function itself.
41831 return function next() {
41832 while (keys.length) {
41833 var key = keys.pop();
41834 if (key in object) {
41835 next.value = key;
41836 next.done = false;
41837 return next;
41838 }
41839 }
41840
41841 // To avoid creating an additional object, we just hang the .value
41842 // and .done properties off the next function object itself. This
41843 // also ensures that the minifier will not anonymize the function.
41844 next.done = true;
41845 return next;
41846 };
41847 };
41848
41849 function values(iterable) {
41850 if (iterable) {
41851 var iteratorMethod = iterable[iteratorSymbol];
41852 if (iteratorMethod) {
41853 return iteratorMethod.call(iterable);
41854 }
41855
41856 if (typeof iterable.next === "function") {
41857 return iterable;
41858 }
41859
41860 if (!isNaN(iterable.length)) {
41861 var i = -1, next = function next() {
41862 while (++i < iterable.length) {
41863 if (hasOwn.call(iterable, i)) {
41864 next.value = iterable[i];
41865 next.done = false;
41866 return next;
41867 }
41868 }
41869
41870 next.value = undefined;
41871 next.done = true;
41872
41873 return next;
41874 };
41875
41876 return next.next = next;
41877 }
41878 }
41879
41880 // Return an iterator with no values.
41881 return { next: doneResult };
41882 }
41883 exports.values = values;
41884
41885 function doneResult() {
41886 return { value: undefined, done: true };
41887 }
41888
41889 Context.prototype = {
41890 constructor: Context,
41891
41892 reset: function(skipTempReset) {
41893 this.prev = 0;
41894 this.next = 0;
41895 // Resetting context._sent for legacy support of Babel's
41896 // function.sent implementation.
41897 this.sent = this._sent = undefined;
41898 this.done = false;
41899 this.delegate = null;
41900
41901 this.method = "next";
41902 this.arg = undefined;
41903
41904 this.tryEntries.forEach(resetTryEntry);
41905
41906 if (!skipTempReset) {
41907 for (var name in this) {
41908 // Not sure about the optimal order of these conditions:
41909 if (name.charAt(0) === "t" &&
41910 hasOwn.call(this, name) &&
41911 !isNaN(+name.slice(1))) {
41912 this[name] = undefined;
41913 }
41914 }
41915 }
41916 },
41917
41918 stop: function() {
41919 this.done = true;
41920
41921 var rootEntry = this.tryEntries[0];
41922 var rootRecord = rootEntry.completion;
41923 if (rootRecord.type === "throw") {
41924 throw rootRecord.arg;
41925 }
41926
41927 return this.rval;
41928 },
41929
41930 dispatchException: function(exception) {
41931 if (this.done) {
41932 throw exception;
41933 }
41934
41935 var context = this;
41936 function handle(loc, caught) {
41937 record.type = "throw";
41938 record.arg = exception;
41939 context.next = loc;
41940
41941 if (caught) {
41942 // If the dispatched exception was caught by a catch block,
41943 // then let that catch block handle the exception normally.
41944 context.method = "next";
41945 context.arg = undefined;
41946 }
41947
41948 return !! caught;
41949 }
41950
41951 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
41952 var entry = this.tryEntries[i];
41953 var record = entry.completion;
41954
41955 if (entry.tryLoc === "root") {
41956 // Exception thrown outside of any try block that could handle
41957 // it, so set the completion value of the entire function to
41958 // throw the exception.
41959 return handle("end");
41960 }
41961
41962 if (entry.tryLoc <= this.prev) {
41963 var hasCatch = hasOwn.call(entry, "catchLoc");
41964 var hasFinally = hasOwn.call(entry, "finallyLoc");
41965
41966 if (hasCatch && hasFinally) {
41967 if (this.prev < entry.catchLoc) {
41968 return handle(entry.catchLoc, true);
41969 } else if (this.prev < entry.finallyLoc) {
41970 return handle(entry.finallyLoc);
41971 }
41972
41973 } else if (hasCatch) {
41974 if (this.prev < entry.catchLoc) {
41975 return handle(entry.catchLoc, true);
41976 }
41977
41978 } else if (hasFinally) {
41979 if (this.prev < entry.finallyLoc) {
41980 return handle(entry.finallyLoc);
41981 }
41982
41983 } else {
41984 throw new Error("try statement without catch or finally");
41985 }
41986 }
41987 }
41988 },
41989
41990 abrupt: function(type, arg) {
41991 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
41992 var entry = this.tryEntries[i];
41993 if (entry.tryLoc <= this.prev &&
41994 hasOwn.call(entry, "finallyLoc") &&
41995 this.prev < entry.finallyLoc) {
41996 var finallyEntry = entry;
41997 break;
41998 }
41999 }
42000
42001 if (finallyEntry &&
42002 (type === "break" ||
42003 type === "continue") &&
42004 finallyEntry.tryLoc <= arg &&
42005 arg <= finallyEntry.finallyLoc) {
42006 // Ignore the finally entry if control is not jumping to a
42007 // location outside the try/catch block.
42008 finallyEntry = null;
42009 }
42010
42011 var record = finallyEntry ? finallyEntry.completion : {};
42012 record.type = type;
42013 record.arg = arg;
42014
42015 if (finallyEntry) {
42016 this.method = "next";
42017 this.next = finallyEntry.finallyLoc;
42018 return ContinueSentinel;
42019 }
42020
42021 return this.complete(record);
42022 },
42023
42024 complete: function(record, afterLoc) {
42025 if (record.type === "throw") {
42026 throw record.arg;
42027 }
42028
42029 if (record.type === "break" ||
42030 record.type === "continue") {
42031 this.next = record.arg;
42032 } else if (record.type === "return") {
42033 this.rval = this.arg = record.arg;
42034 this.method = "return";
42035 this.next = "end";
42036 } else if (record.type === "normal" && afterLoc) {
42037 this.next = afterLoc;
42038 }
42039
42040 return ContinueSentinel;
42041 },
42042
42043 finish: function(finallyLoc) {
42044 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
42045 var entry = this.tryEntries[i];
42046 if (entry.finallyLoc === finallyLoc) {
42047 this.complete(entry.completion, entry.afterLoc);
42048 resetTryEntry(entry);
42049 return ContinueSentinel;
42050 }
42051 }
42052 },
42053
42054 "catch": function(tryLoc) {
42055 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
42056 var entry = this.tryEntries[i];
42057 if (entry.tryLoc === tryLoc) {
42058 var record = entry.completion;
42059 if (record.type === "throw") {
42060 var thrown = record.arg;
42061 resetTryEntry(entry);
42062 }
42063 return thrown;
42064 }
42065 }
42066
42067 // The context.catch method must only be called with a location
42068 // argument that corresponds to a known catch block.
42069 throw new Error("illegal catch attempt");
42070 },
42071
42072 delegateYield: function(iterable, resultName, nextLoc) {
42073 this.delegate = {
42074 iterator: values(iterable),
42075 resultName: resultName,
42076 nextLoc: nextLoc
42077 };
42078
42079 if (this.method === "next") {
42080 // Deliberately forget the last sent value so that we don't
42081 // accidentally pass it on to the delegate.
42082 this.arg = undefined;
42083 }
42084
42085 return ContinueSentinel;
42086 }
42087 };
42088
42089 // Regardless of whether this script is executing as a CommonJS module
42090 // or not, return the runtime object so that we can declare the variable
42091 // regeneratorRuntime in the outer scope, which allows this module to be
42092 // injected easily by `bin/regenerator --include-runtime script.js`.
42093 return exports;
42094
42095}(
42096 // If this script is executing as a CommonJS module, use module.exports
42097 // as the regeneratorRuntime namespace. Otherwise create a new empty
42098 // object. Either way, the resulting object will be used to initialize
42099 // the regeneratorRuntime variable at the top of this file.
42100 true ? module.exports : {}
42101));
42102
42103try {
42104 regeneratorRuntime = runtime;
42105} catch (accidentalStrictMode) {
42106 // This module should not be running in strict mode, so the above
42107 // assignment should always work unless something is misconfigured. Just
42108 // in case runtime.js accidentally runs in strict mode, we can escape
42109 // strict mode using a global Function call. This could conceivably fail
42110 // if a Content Security Policy forbids using Function, but in that case
42111 // the proper solution is to fix the accidental strict mode problem. If
42112 // you've misconfigured your bundler to force strict mode and applied a
42113 // CSP to forbid Function, and you're not willing to fix either of those
42114 // problems, please detail your unique predicament in a GitHub issue.
42115 Function("r", "regeneratorRuntime = r")(runtime);
42116}
42117
42118
42119/***/ }),
42120/* 619 */
42121/***/ (function(module, exports) {
42122
42123function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
42124 try {
42125 var info = gen[key](arg);
42126 var value = info.value;
42127 } catch (error) {
42128 reject(error);
42129 return;
42130 }
42131
42132 if (info.done) {
42133 resolve(value);
42134 } else {
42135 Promise.resolve(value).then(_next, _throw);
42136 }
42137}
42138
42139function _asyncToGenerator(fn) {
42140 return function () {
42141 var self = this,
42142 args = arguments;
42143 return new Promise(function (resolve, reject) {
42144 var gen = fn.apply(self, args);
42145
42146 function _next(value) {
42147 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
42148 }
42149
42150 function _throw(err) {
42151 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
42152 }
42153
42154 _next(undefined);
42155 });
42156 };
42157}
42158
42159module.exports = _asyncToGenerator;
42160
42161/***/ }),
42162/* 620 */
42163/***/ (function(module, exports, __webpack_require__) {
42164
42165var arrayWithoutHoles = __webpack_require__(621);
42166
42167var iterableToArray = __webpack_require__(266);
42168
42169var unsupportedIterableToArray = __webpack_require__(267);
42170
42171var nonIterableSpread = __webpack_require__(622);
42172
42173function _toConsumableArray(arr) {
42174 return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
42175}
42176
42177module.exports = _toConsumableArray;
42178
42179/***/ }),
42180/* 621 */
42181/***/ (function(module, exports, __webpack_require__) {
42182
42183var arrayLikeToArray = __webpack_require__(265);
42184
42185function _arrayWithoutHoles(arr) {
42186 if (Array.isArray(arr)) return arrayLikeToArray(arr);
42187}
42188
42189module.exports = _arrayWithoutHoles;
42190
42191/***/ }),
42192/* 622 */
42193/***/ (function(module, exports) {
42194
42195function _nonIterableSpread() {
42196 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
42197}
42198
42199module.exports = _nonIterableSpread;
42200
42201/***/ }),
42202/* 623 */
42203/***/ (function(module, exports) {
42204
42205function _defineProperty(obj, key, value) {
42206 if (key in obj) {
42207 Object.defineProperty(obj, key, {
42208 value: value,
42209 enumerable: true,
42210 configurable: true,
42211 writable: true
42212 });
42213 } else {
42214 obj[key] = value;
42215 }
42216
42217 return obj;
42218}
42219
42220module.exports = _defineProperty;
42221
42222/***/ }),
42223/* 624 */
42224/***/ (function(module, exports, __webpack_require__) {
42225
42226var objectWithoutPropertiesLoose = __webpack_require__(625);
42227
42228function _objectWithoutProperties(source, excluded) {
42229 if (source == null) return {};
42230 var target = objectWithoutPropertiesLoose(source, excluded);
42231 var key, i;
42232
42233 if (Object.getOwnPropertySymbols) {
42234 var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
42235
42236 for (i = 0; i < sourceSymbolKeys.length; i++) {
42237 key = sourceSymbolKeys[i];
42238 if (excluded.indexOf(key) >= 0) continue;
42239 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
42240 target[key] = source[key];
42241 }
42242 }
42243
42244 return target;
42245}
42246
42247module.exports = _objectWithoutProperties;
42248
42249/***/ }),
42250/* 625 */
42251/***/ (function(module, exports) {
42252
42253function _objectWithoutPropertiesLoose(source, excluded) {
42254 if (source == null) return {};
42255 var target = {};
42256 var sourceKeys = Object.keys(source);
42257 var key, i;
42258
42259 for (i = 0; i < sourceKeys.length; i++) {
42260 key = sourceKeys[i];
42261 if (excluded.indexOf(key) >= 0) continue;
42262 target[key] = source[key];
42263 }
42264
42265 return target;
42266}
42267
42268module.exports = _objectWithoutPropertiesLoose;
42269
42270/***/ }),
42271/* 626 */
42272/***/ (function(module, exports) {
42273
42274function _assertThisInitialized(self) {
42275 if (self === void 0) {
42276 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
42277 }
42278
42279 return self;
42280}
42281
42282module.exports = _assertThisInitialized;
42283
42284/***/ }),
42285/* 627 */
42286/***/ (function(module, exports) {
42287
42288function _inheritsLoose(subClass, superClass) {
42289 subClass.prototype = Object.create(superClass.prototype);
42290 subClass.prototype.constructor = subClass;
42291 subClass.__proto__ = superClass;
42292}
42293
42294module.exports = _inheritsLoose;
42295
42296/***/ }),
42297/* 628 */
42298/***/ (function(module, exports, __webpack_require__) {
42299
42300var arrayShuffle = __webpack_require__(629),
42301 baseShuffle = __webpack_require__(632),
42302 isArray = __webpack_require__(273);
42303
42304/**
42305 * Creates an array of shuffled values, using a version of the
42306 * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
42307 *
42308 * @static
42309 * @memberOf _
42310 * @since 0.1.0
42311 * @category Collection
42312 * @param {Array|Object} collection The collection to shuffle.
42313 * @returns {Array} Returns the new shuffled array.
42314 * @example
42315 *
42316 * _.shuffle([1, 2, 3, 4]);
42317 * // => [4, 1, 3, 2]
42318 */
42319function shuffle(collection) {
42320 var func = isArray(collection) ? arrayShuffle : baseShuffle;
42321 return func(collection);
42322}
42323
42324module.exports = shuffle;
42325
42326
42327/***/ }),
42328/* 629 */
42329/***/ (function(module, exports, __webpack_require__) {
42330
42331var copyArray = __webpack_require__(630),
42332 shuffleSelf = __webpack_require__(268);
42333
42334/**
42335 * A specialized version of `_.shuffle` for arrays.
42336 *
42337 * @private
42338 * @param {Array} array The array to shuffle.
42339 * @returns {Array} Returns the new shuffled array.
42340 */
42341function arrayShuffle(array) {
42342 return shuffleSelf(copyArray(array));
42343}
42344
42345module.exports = arrayShuffle;
42346
42347
42348/***/ }),
42349/* 630 */
42350/***/ (function(module, exports) {
42351
42352/**
42353 * Copies the values of `source` to `array`.
42354 *
42355 * @private
42356 * @param {Array} source The array to copy values from.
42357 * @param {Array} [array=[]] The array to copy values to.
42358 * @returns {Array} Returns `array`.
42359 */
42360function copyArray(source, array) {
42361 var index = -1,
42362 length = source.length;
42363
42364 array || (array = Array(length));
42365 while (++index < length) {
42366 array[index] = source[index];
42367 }
42368 return array;
42369}
42370
42371module.exports = copyArray;
42372
42373
42374/***/ }),
42375/* 631 */
42376/***/ (function(module, exports) {
42377
42378/* Built-in method references for those with the same name as other `lodash` methods. */
42379var nativeFloor = Math.floor,
42380 nativeRandom = Math.random;
42381
42382/**
42383 * The base implementation of `_.random` without support for returning
42384 * floating-point numbers.
42385 *
42386 * @private
42387 * @param {number} lower The lower bound.
42388 * @param {number} upper The upper bound.
42389 * @returns {number} Returns the random number.
42390 */
42391function baseRandom(lower, upper) {
42392 return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
42393}
42394
42395module.exports = baseRandom;
42396
42397
42398/***/ }),
42399/* 632 */
42400/***/ (function(module, exports, __webpack_require__) {
42401
42402var shuffleSelf = __webpack_require__(268),
42403 values = __webpack_require__(269);
42404
42405/**
42406 * The base implementation of `_.shuffle`.
42407 *
42408 * @private
42409 * @param {Array|Object} collection The collection to shuffle.
42410 * @returns {Array} Returns the new shuffled array.
42411 */
42412function baseShuffle(collection) {
42413 return shuffleSelf(values(collection));
42414}
42415
42416module.exports = baseShuffle;
42417
42418
42419/***/ }),
42420/* 633 */
42421/***/ (function(module, exports, __webpack_require__) {
42422
42423var arrayMap = __webpack_require__(634);
42424
42425/**
42426 * The base implementation of `_.values` and `_.valuesIn` which creates an
42427 * array of `object` property values corresponding to the property names
42428 * of `props`.
42429 *
42430 * @private
42431 * @param {Object} object The object to query.
42432 * @param {Array} props The property names to get values for.
42433 * @returns {Object} Returns the array of property values.
42434 */
42435function baseValues(object, props) {
42436 return arrayMap(props, function(key) {
42437 return object[key];
42438 });
42439}
42440
42441module.exports = baseValues;
42442
42443
42444/***/ }),
42445/* 634 */
42446/***/ (function(module, exports) {
42447
42448/**
42449 * A specialized version of `_.map` for arrays without support for iteratee
42450 * shorthands.
42451 *
42452 * @private
42453 * @param {Array} [array] The array to iterate over.
42454 * @param {Function} iteratee The function invoked per iteration.
42455 * @returns {Array} Returns the new mapped array.
42456 */
42457function arrayMap(array, iteratee) {
42458 var index = -1,
42459 length = array == null ? 0 : array.length,
42460 result = Array(length);
42461
42462 while (++index < length) {
42463 result[index] = iteratee(array[index], index, array);
42464 }
42465 return result;
42466}
42467
42468module.exports = arrayMap;
42469
42470
42471/***/ }),
42472/* 635 */
42473/***/ (function(module, exports, __webpack_require__) {
42474
42475var arrayLikeKeys = __webpack_require__(636),
42476 baseKeys = __webpack_require__(649),
42477 isArrayLike = __webpack_require__(652);
42478
42479/**
42480 * Creates an array of the own enumerable property names of `object`.
42481 *
42482 * **Note:** Non-object values are coerced to objects. See the
42483 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
42484 * for more details.
42485 *
42486 * @static
42487 * @since 0.1.0
42488 * @memberOf _
42489 * @category Object
42490 * @param {Object} object The object to query.
42491 * @returns {Array} Returns the array of property names.
42492 * @example
42493 *
42494 * function Foo() {
42495 * this.a = 1;
42496 * this.b = 2;
42497 * }
42498 *
42499 * Foo.prototype.c = 3;
42500 *
42501 * _.keys(new Foo);
42502 * // => ['a', 'b'] (iteration order is not guaranteed)
42503 *
42504 * _.keys('hi');
42505 * // => ['0', '1']
42506 */
42507function keys(object) {
42508 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
42509}
42510
42511module.exports = keys;
42512
42513
42514/***/ }),
42515/* 636 */
42516/***/ (function(module, exports, __webpack_require__) {
42517
42518var baseTimes = __webpack_require__(637),
42519 isArguments = __webpack_require__(638),
42520 isArray = __webpack_require__(273),
42521 isBuffer = __webpack_require__(642),
42522 isIndex = __webpack_require__(644),
42523 isTypedArray = __webpack_require__(645);
42524
42525/** Used for built-in method references. */
42526var objectProto = Object.prototype;
42527
42528/** Used to check objects for own properties. */
42529var hasOwnProperty = objectProto.hasOwnProperty;
42530
42531/**
42532 * Creates an array of the enumerable property names of the array-like `value`.
42533 *
42534 * @private
42535 * @param {*} value The value to query.
42536 * @param {boolean} inherited Specify returning inherited property names.
42537 * @returns {Array} Returns the array of property names.
42538 */
42539function arrayLikeKeys(value, inherited) {
42540 var isArr = isArray(value),
42541 isArg = !isArr && isArguments(value),
42542 isBuff = !isArr && !isArg && isBuffer(value),
42543 isType = !isArr && !isArg && !isBuff && isTypedArray(value),
42544 skipIndexes = isArr || isArg || isBuff || isType,
42545 result = skipIndexes ? baseTimes(value.length, String) : [],
42546 length = result.length;
42547
42548 for (var key in value) {
42549 if ((inherited || hasOwnProperty.call(value, key)) &&
42550 !(skipIndexes && (
42551 // Safari 9 has enumerable `arguments.length` in strict mode.
42552 key == 'length' ||
42553 // Node.js 0.10 has enumerable non-index properties on buffers.
42554 (isBuff && (key == 'offset' || key == 'parent')) ||
42555 // PhantomJS 2 has enumerable non-index properties on typed arrays.
42556 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
42557 // Skip index properties.
42558 isIndex(key, length)
42559 ))) {
42560 result.push(key);
42561 }
42562 }
42563 return result;
42564}
42565
42566module.exports = arrayLikeKeys;
42567
42568
42569/***/ }),
42570/* 637 */
42571/***/ (function(module, exports) {
42572
42573/**
42574 * The base implementation of `_.times` without support for iteratee shorthands
42575 * or max array length checks.
42576 *
42577 * @private
42578 * @param {number} n The number of times to invoke `iteratee`.
42579 * @param {Function} iteratee The function invoked per iteration.
42580 * @returns {Array} Returns the array of results.
42581 */
42582function baseTimes(n, iteratee) {
42583 var index = -1,
42584 result = Array(n);
42585
42586 while (++index < n) {
42587 result[index] = iteratee(index);
42588 }
42589 return result;
42590}
42591
42592module.exports = baseTimes;
42593
42594
42595/***/ }),
42596/* 638 */
42597/***/ (function(module, exports, __webpack_require__) {
42598
42599var baseIsArguments = __webpack_require__(639),
42600 isObjectLike = __webpack_require__(119);
42601
42602/** Used for built-in method references. */
42603var objectProto = Object.prototype;
42604
42605/** Used to check objects for own properties. */
42606var hasOwnProperty = objectProto.hasOwnProperty;
42607
42608/** Built-in value references. */
42609var propertyIsEnumerable = objectProto.propertyIsEnumerable;
42610
42611/**
42612 * Checks if `value` is likely an `arguments` object.
42613 *
42614 * @static
42615 * @memberOf _
42616 * @since 0.1.0
42617 * @category Lang
42618 * @param {*} value The value to check.
42619 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
42620 * else `false`.
42621 * @example
42622 *
42623 * _.isArguments(function() { return arguments; }());
42624 * // => true
42625 *
42626 * _.isArguments([1, 2, 3]);
42627 * // => false
42628 */
42629var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
42630 return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
42631 !propertyIsEnumerable.call(value, 'callee');
42632};
42633
42634module.exports = isArguments;
42635
42636
42637/***/ }),
42638/* 639 */
42639/***/ (function(module, exports, __webpack_require__) {
42640
42641var baseGetTag = __webpack_require__(118),
42642 isObjectLike = __webpack_require__(119);
42643
42644/** `Object#toString` result references. */
42645var argsTag = '[object Arguments]';
42646
42647/**
42648 * The base implementation of `_.isArguments`.
42649 *
42650 * @private
42651 * @param {*} value The value to check.
42652 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
42653 */
42654function baseIsArguments(value) {
42655 return isObjectLike(value) && baseGetTag(value) == argsTag;
42656}
42657
42658module.exports = baseIsArguments;
42659
42660
42661/***/ }),
42662/* 640 */
42663/***/ (function(module, exports, __webpack_require__) {
42664
42665var Symbol = __webpack_require__(270);
42666
42667/** Used for built-in method references. */
42668var objectProto = Object.prototype;
42669
42670/** Used to check objects for own properties. */
42671var hasOwnProperty = objectProto.hasOwnProperty;
42672
42673/**
42674 * Used to resolve the
42675 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
42676 * of values.
42677 */
42678var nativeObjectToString = objectProto.toString;
42679
42680/** Built-in value references. */
42681var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
42682
42683/**
42684 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
42685 *
42686 * @private
42687 * @param {*} value The value to query.
42688 * @returns {string} Returns the raw `toStringTag`.
42689 */
42690function getRawTag(value) {
42691 var isOwn = hasOwnProperty.call(value, symToStringTag),
42692 tag = value[symToStringTag];
42693
42694 try {
42695 value[symToStringTag] = undefined;
42696 var unmasked = true;
42697 } catch (e) {}
42698
42699 var result = nativeObjectToString.call(value);
42700 if (unmasked) {
42701 if (isOwn) {
42702 value[symToStringTag] = tag;
42703 } else {
42704 delete value[symToStringTag];
42705 }
42706 }
42707 return result;
42708}
42709
42710module.exports = getRawTag;
42711
42712
42713/***/ }),
42714/* 641 */
42715/***/ (function(module, exports) {
42716
42717/** Used for built-in method references. */
42718var objectProto = Object.prototype;
42719
42720/**
42721 * Used to resolve the
42722 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
42723 * of values.
42724 */
42725var nativeObjectToString = objectProto.toString;
42726
42727/**
42728 * Converts `value` to a string using `Object.prototype.toString`.
42729 *
42730 * @private
42731 * @param {*} value The value to convert.
42732 * @returns {string} Returns the converted string.
42733 */
42734function objectToString(value) {
42735 return nativeObjectToString.call(value);
42736}
42737
42738module.exports = objectToString;
42739
42740
42741/***/ }),
42742/* 642 */
42743/***/ (function(module, exports, __webpack_require__) {
42744
42745/* WEBPACK VAR INJECTION */(function(module) {var root = __webpack_require__(271),
42746 stubFalse = __webpack_require__(643);
42747
42748/** Detect free variable `exports`. */
42749var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
42750
42751/** Detect free variable `module`. */
42752var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
42753
42754/** Detect the popular CommonJS extension `module.exports`. */
42755var moduleExports = freeModule && freeModule.exports === freeExports;
42756
42757/** Built-in value references. */
42758var Buffer = moduleExports ? root.Buffer : undefined;
42759
42760/* Built-in method references for those with the same name as other `lodash` methods. */
42761var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
42762
42763/**
42764 * Checks if `value` is a buffer.
42765 *
42766 * @static
42767 * @memberOf _
42768 * @since 4.3.0
42769 * @category Lang
42770 * @param {*} value The value to check.
42771 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
42772 * @example
42773 *
42774 * _.isBuffer(new Buffer(2));
42775 * // => true
42776 *
42777 * _.isBuffer(new Uint8Array(2));
42778 * // => false
42779 */
42780var isBuffer = nativeIsBuffer || stubFalse;
42781
42782module.exports = isBuffer;
42783
42784/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(274)(module)))
42785
42786/***/ }),
42787/* 643 */
42788/***/ (function(module, exports) {
42789
42790/**
42791 * This method returns `false`.
42792 *
42793 * @static
42794 * @memberOf _
42795 * @since 4.13.0
42796 * @category Util
42797 * @returns {boolean} Returns `false`.
42798 * @example
42799 *
42800 * _.times(2, _.stubFalse);
42801 * // => [false, false]
42802 */
42803function stubFalse() {
42804 return false;
42805}
42806
42807module.exports = stubFalse;
42808
42809
42810/***/ }),
42811/* 644 */
42812/***/ (function(module, exports) {
42813
42814/** Used as references for various `Number` constants. */
42815var MAX_SAFE_INTEGER = 9007199254740991;
42816
42817/** Used to detect unsigned integer values. */
42818var reIsUint = /^(?:0|[1-9]\d*)$/;
42819
42820/**
42821 * Checks if `value` is a valid array-like index.
42822 *
42823 * @private
42824 * @param {*} value The value to check.
42825 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
42826 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
42827 */
42828function isIndex(value, length) {
42829 var type = typeof value;
42830 length = length == null ? MAX_SAFE_INTEGER : length;
42831
42832 return !!length &&
42833 (type == 'number' ||
42834 (type != 'symbol' && reIsUint.test(value))) &&
42835 (value > -1 && value % 1 == 0 && value < length);
42836}
42837
42838module.exports = isIndex;
42839
42840
42841/***/ }),
42842/* 645 */
42843/***/ (function(module, exports, __webpack_require__) {
42844
42845var baseIsTypedArray = __webpack_require__(646),
42846 baseUnary = __webpack_require__(647),
42847 nodeUtil = __webpack_require__(648);
42848
42849/* Node.js helper references. */
42850var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
42851
42852/**
42853 * Checks if `value` is classified as a typed array.
42854 *
42855 * @static
42856 * @memberOf _
42857 * @since 3.0.0
42858 * @category Lang
42859 * @param {*} value The value to check.
42860 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
42861 * @example
42862 *
42863 * _.isTypedArray(new Uint8Array);
42864 * // => true
42865 *
42866 * _.isTypedArray([]);
42867 * // => false
42868 */
42869var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
42870
42871module.exports = isTypedArray;
42872
42873
42874/***/ }),
42875/* 646 */
42876/***/ (function(module, exports, __webpack_require__) {
42877
42878var baseGetTag = __webpack_require__(118),
42879 isLength = __webpack_require__(275),
42880 isObjectLike = __webpack_require__(119);
42881
42882/** `Object#toString` result references. */
42883var argsTag = '[object Arguments]',
42884 arrayTag = '[object Array]',
42885 boolTag = '[object Boolean]',
42886 dateTag = '[object Date]',
42887 errorTag = '[object Error]',
42888 funcTag = '[object Function]',
42889 mapTag = '[object Map]',
42890 numberTag = '[object Number]',
42891 objectTag = '[object Object]',
42892 regexpTag = '[object RegExp]',
42893 setTag = '[object Set]',
42894 stringTag = '[object String]',
42895 weakMapTag = '[object WeakMap]';
42896
42897var arrayBufferTag = '[object ArrayBuffer]',
42898 dataViewTag = '[object DataView]',
42899 float32Tag = '[object Float32Array]',
42900 float64Tag = '[object Float64Array]',
42901 int8Tag = '[object Int8Array]',
42902 int16Tag = '[object Int16Array]',
42903 int32Tag = '[object Int32Array]',
42904 uint8Tag = '[object Uint8Array]',
42905 uint8ClampedTag = '[object Uint8ClampedArray]',
42906 uint16Tag = '[object Uint16Array]',
42907 uint32Tag = '[object Uint32Array]';
42908
42909/** Used to identify `toStringTag` values of typed arrays. */
42910var typedArrayTags = {};
42911typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
42912typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
42913typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
42914typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
42915typedArrayTags[uint32Tag] = true;
42916typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
42917typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
42918typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
42919typedArrayTags[errorTag] = typedArrayTags[funcTag] =
42920typedArrayTags[mapTag] = typedArrayTags[numberTag] =
42921typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
42922typedArrayTags[setTag] = typedArrayTags[stringTag] =
42923typedArrayTags[weakMapTag] = false;
42924
42925/**
42926 * The base implementation of `_.isTypedArray` without Node.js optimizations.
42927 *
42928 * @private
42929 * @param {*} value The value to check.
42930 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
42931 */
42932function baseIsTypedArray(value) {
42933 return isObjectLike(value) &&
42934 isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
42935}
42936
42937module.exports = baseIsTypedArray;
42938
42939
42940/***/ }),
42941/* 647 */
42942/***/ (function(module, exports) {
42943
42944/**
42945 * The base implementation of `_.unary` without support for storing metadata.
42946 *
42947 * @private
42948 * @param {Function} func The function to cap arguments for.
42949 * @returns {Function} Returns the new capped function.
42950 */
42951function baseUnary(func) {
42952 return function(value) {
42953 return func(value);
42954 };
42955}
42956
42957module.exports = baseUnary;
42958
42959
42960/***/ }),
42961/* 648 */
42962/***/ (function(module, exports, __webpack_require__) {
42963
42964/* WEBPACK VAR INJECTION */(function(module) {var freeGlobal = __webpack_require__(272);
42965
42966/** Detect free variable `exports`. */
42967var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
42968
42969/** Detect free variable `module`. */
42970var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
42971
42972/** Detect the popular CommonJS extension `module.exports`. */
42973var moduleExports = freeModule && freeModule.exports === freeExports;
42974
42975/** Detect free variable `process` from Node.js. */
42976var freeProcess = moduleExports && freeGlobal.process;
42977
42978/** Used to access faster Node.js helpers. */
42979var nodeUtil = (function() {
42980 try {
42981 // Use `util.types` for Node.js 10+.
42982 var types = freeModule && freeModule.require && freeModule.require('util').types;
42983
42984 if (types) {
42985 return types;
42986 }
42987
42988 // Legacy `process.binding('util')` for Node.js < 10.
42989 return freeProcess && freeProcess.binding && freeProcess.binding('util');
42990 } catch (e) {}
42991}());
42992
42993module.exports = nodeUtil;
42994
42995/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(274)(module)))
42996
42997/***/ }),
42998/* 649 */
42999/***/ (function(module, exports, __webpack_require__) {
43000
43001var isPrototype = __webpack_require__(650),
43002 nativeKeys = __webpack_require__(651);
43003
43004/** Used for built-in method references. */
43005var objectProto = Object.prototype;
43006
43007/** Used to check objects for own properties. */
43008var hasOwnProperty = objectProto.hasOwnProperty;
43009
43010/**
43011 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
43012 *
43013 * @private
43014 * @param {Object} object The object to query.
43015 * @returns {Array} Returns the array of property names.
43016 */
43017function baseKeys(object) {
43018 if (!isPrototype(object)) {
43019 return nativeKeys(object);
43020 }
43021 var result = [];
43022 for (var key in Object(object)) {
43023 if (hasOwnProperty.call(object, key) && key != 'constructor') {
43024 result.push(key);
43025 }
43026 }
43027 return result;
43028}
43029
43030module.exports = baseKeys;
43031
43032
43033/***/ }),
43034/* 650 */
43035/***/ (function(module, exports) {
43036
43037/** Used for built-in method references. */
43038var objectProto = Object.prototype;
43039
43040/**
43041 * Checks if `value` is likely a prototype object.
43042 *
43043 * @private
43044 * @param {*} value The value to check.
43045 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
43046 */
43047function isPrototype(value) {
43048 var Ctor = value && value.constructor,
43049 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
43050
43051 return value === proto;
43052}
43053
43054module.exports = isPrototype;
43055
43056
43057/***/ }),
43058/* 651 */
43059/***/ (function(module, exports, __webpack_require__) {
43060
43061var overArg = __webpack_require__(276);
43062
43063/* Built-in method references for those with the same name as other `lodash` methods. */
43064var nativeKeys = overArg(Object.keys, Object);
43065
43066module.exports = nativeKeys;
43067
43068
43069/***/ }),
43070/* 652 */
43071/***/ (function(module, exports, __webpack_require__) {
43072
43073var isFunction = __webpack_require__(653),
43074 isLength = __webpack_require__(275);
43075
43076/**
43077 * Checks if `value` is array-like. A value is considered array-like if it's
43078 * not a function and has a `value.length` that's an integer greater than or
43079 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
43080 *
43081 * @static
43082 * @memberOf _
43083 * @since 4.0.0
43084 * @category Lang
43085 * @param {*} value The value to check.
43086 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
43087 * @example
43088 *
43089 * _.isArrayLike([1, 2, 3]);
43090 * // => true
43091 *
43092 * _.isArrayLike(document.body.children);
43093 * // => true
43094 *
43095 * _.isArrayLike('abc');
43096 * // => true
43097 *
43098 * _.isArrayLike(_.noop);
43099 * // => false
43100 */
43101function isArrayLike(value) {
43102 return value != null && isLength(value.length) && !isFunction(value);
43103}
43104
43105module.exports = isArrayLike;
43106
43107
43108/***/ }),
43109/* 653 */
43110/***/ (function(module, exports, __webpack_require__) {
43111
43112var baseGetTag = __webpack_require__(118),
43113 isObject = __webpack_require__(654);
43114
43115/** `Object#toString` result references. */
43116var asyncTag = '[object AsyncFunction]',
43117 funcTag = '[object Function]',
43118 genTag = '[object GeneratorFunction]',
43119 proxyTag = '[object Proxy]';
43120
43121/**
43122 * Checks if `value` is classified as a `Function` object.
43123 *
43124 * @static
43125 * @memberOf _
43126 * @since 0.1.0
43127 * @category Lang
43128 * @param {*} value The value to check.
43129 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
43130 * @example
43131 *
43132 * _.isFunction(_);
43133 * // => true
43134 *
43135 * _.isFunction(/abc/);
43136 * // => false
43137 */
43138function isFunction(value) {
43139 if (!isObject(value)) {
43140 return false;
43141 }
43142 // The use of `Object#toString` avoids issues with the `typeof` operator
43143 // in Safari 9 which returns 'object' for typed arrays and other constructors.
43144 var tag = baseGetTag(value);
43145 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
43146}
43147
43148module.exports = isFunction;
43149
43150
43151/***/ }),
43152/* 654 */
43153/***/ (function(module, exports) {
43154
43155/**
43156 * Checks if `value` is the
43157 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
43158 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
43159 *
43160 * @static
43161 * @memberOf _
43162 * @since 0.1.0
43163 * @category Lang
43164 * @param {*} value The value to check.
43165 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
43166 * @example
43167 *
43168 * _.isObject({});
43169 * // => true
43170 *
43171 * _.isObject([1, 2, 3]);
43172 * // => true
43173 *
43174 * _.isObject(_.noop);
43175 * // => true
43176 *
43177 * _.isObject(null);
43178 * // => false
43179 */
43180function isObject(value) {
43181 var type = typeof value;
43182 return value != null && (type == 'object' || type == 'function');
43183}
43184
43185module.exports = isObject;
43186
43187
43188/***/ }),
43189/* 655 */
43190/***/ (function(module, exports, __webpack_require__) {
43191
43192var arrayWithHoles = __webpack_require__(656);
43193
43194var iterableToArray = __webpack_require__(266);
43195
43196var unsupportedIterableToArray = __webpack_require__(267);
43197
43198var nonIterableRest = __webpack_require__(657);
43199
43200function _toArray(arr) {
43201 return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest();
43202}
43203
43204module.exports = _toArray;
43205
43206/***/ }),
43207/* 656 */
43208/***/ (function(module, exports) {
43209
43210function _arrayWithHoles(arr) {
43211 if (Array.isArray(arr)) return arr;
43212}
43213
43214module.exports = _arrayWithHoles;
43215
43216/***/ }),
43217/* 657 */
43218/***/ (function(module, exports) {
43219
43220function _nonIterableRest() {
43221 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
43222}
43223
43224module.exports = _nonIterableRest;
43225
43226/***/ }),
43227/* 658 */
43228/***/ (function(module, exports) {
43229
43230function _defineProperties(target, props) {
43231 for (var i = 0; i < props.length; i++) {
43232 var descriptor = props[i];
43233 descriptor.enumerable = descriptor.enumerable || false;
43234 descriptor.configurable = true;
43235 if ("value" in descriptor) descriptor.writable = true;
43236 Object.defineProperty(target, descriptor.key, descriptor);
43237 }
43238}
43239
43240function _createClass(Constructor, protoProps, staticProps) {
43241 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
43242 if (staticProps) _defineProperties(Constructor, staticProps);
43243 return Constructor;
43244}
43245
43246module.exports = _createClass;
43247
43248/***/ }),
43249/* 659 */
43250/***/ (function(module, exports) {
43251
43252function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
43253 var desc = {};
43254 Object.keys(descriptor).forEach(function (key) {
43255 desc[key] = descriptor[key];
43256 });
43257 desc.enumerable = !!desc.enumerable;
43258 desc.configurable = !!desc.configurable;
43259
43260 if ('value' in desc || desc.initializer) {
43261 desc.writable = true;
43262 }
43263
43264 desc = decorators.slice().reverse().reduce(function (desc, decorator) {
43265 return decorator(target, property, desc) || desc;
43266 }, desc);
43267
43268 if (context && desc.initializer !== void 0) {
43269 desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
43270 desc.initializer = undefined;
43271 }
43272
43273 if (desc.initializer === void 0) {
43274 Object.defineProperty(target, property, desc);
43275 desc = null;
43276 }
43277
43278 return desc;
43279}
43280
43281module.exports = _applyDecoratedDescriptor;
43282
43283/***/ }),
43284/* 660 */
43285/***/ (function(module, exports, __webpack_require__) {
43286
43287/*
43288
43289 Javascript State Machine Library - https://github.com/jakesgordon/javascript-state-machine
43290
43291 Copyright (c) 2012, 2013, 2014, 2015, Jake Gordon and contributors
43292 Released under the MIT license - https://github.com/jakesgordon/javascript-state-machine/blob/master/LICENSE
43293
43294*/
43295
43296(function () {
43297
43298 var StateMachine = {
43299
43300 //---------------------------------------------------------------------------
43301
43302 VERSION: "2.4.0",
43303
43304 //---------------------------------------------------------------------------
43305
43306 Result: {
43307 SUCCEEDED: 1, // the event transitioned successfully from one state to another
43308 NOTRANSITION: 2, // the event was successfull but no state transition was necessary
43309 CANCELLED: 3, // the event was cancelled by the caller in a beforeEvent callback
43310 PENDING: 4 // the event is asynchronous and the caller is in control of when the transition occurs
43311 },
43312
43313 Error: {
43314 INVALID_TRANSITION: 100, // caller tried to fire an event that was innapropriate in the current state
43315 PENDING_TRANSITION: 200, // caller tried to fire an event while an async transition was still pending
43316 INVALID_CALLBACK: 300 // caller provided callback function threw an exception
43317 },
43318
43319 WILDCARD: '*',
43320 ASYNC: 'async',
43321
43322 //---------------------------------------------------------------------------
43323
43324 create: function(cfg, target) {
43325
43326 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 }
43327 var terminal = cfg.terminal || cfg['final'];
43328 var fsm = target || cfg.target || {};
43329 var events = cfg.events || [];
43330 var callbacks = cfg.callbacks || {};
43331 var map = {}; // track state transitions allowed for an event { event: { from: [ to ] } }
43332 var transitions = {}; // track events allowed from a state { state: [ event ] }
43333
43334 var add = function(e) {
43335 var from = Array.isArray(e.from) ? e.from : (e.from ? [e.from] : [StateMachine.WILDCARD]); // allow 'wildcard' transition if 'from' is not specified
43336 map[e.name] = map[e.name] || {};
43337 for (var n = 0 ; n < from.length ; n++) {
43338 transitions[from[n]] = transitions[from[n]] || [];
43339 transitions[from[n]].push(e.name);
43340
43341 map[e.name][from[n]] = e.to || from[n]; // allow no-op transition if 'to' is not specified
43342 }
43343 if (e.to)
43344 transitions[e.to] = transitions[e.to] || [];
43345 };
43346
43347 if (initial) {
43348 initial.event = initial.event || 'startup';
43349 add({ name: initial.event, from: 'none', to: initial.state });
43350 }
43351
43352 for(var n = 0 ; n < events.length ; n++)
43353 add(events[n]);
43354
43355 for(var name in map) {
43356 if (map.hasOwnProperty(name))
43357 fsm[name] = StateMachine.buildEvent(name, map[name]);
43358 }
43359
43360 for(var name in callbacks) {
43361 if (callbacks.hasOwnProperty(name))
43362 fsm[name] = callbacks[name]
43363 }
43364
43365 fsm.current = 'none';
43366 fsm.is = function(state) { return Array.isArray(state) ? (state.indexOf(this.current) >= 0) : (this.current === state); };
43367 fsm.can = function(event) { return !this.transition && (map[event] !== undefined) && (map[event].hasOwnProperty(this.current) || map[event].hasOwnProperty(StateMachine.WILDCARD)); }
43368 fsm.cannot = function(event) { return !this.can(event); };
43369 fsm.transitions = function() { return (transitions[this.current] || []).concat(transitions[StateMachine.WILDCARD] || []); };
43370 fsm.isFinished = function() { return this.is(terminal); };
43371 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)
43372 fsm.states = function() { return Object.keys(transitions).sort() };
43373
43374 if (initial && !initial.defer)
43375 fsm[initial.event]();
43376
43377 return fsm;
43378
43379 },
43380
43381 //===========================================================================
43382
43383 doCallback: function(fsm, func, name, from, to, args) {
43384 if (func) {
43385 try {
43386 return func.apply(fsm, [name, from, to].concat(args));
43387 }
43388 catch(e) {
43389 return fsm.error(name, from, to, args, StateMachine.Error.INVALID_CALLBACK, "an exception occurred in a caller-provided callback function", e);
43390 }
43391 }
43392 },
43393
43394 beforeAnyEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onbeforeevent'], name, from, to, args); },
43395 afterAnyEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onafterevent'] || fsm['onevent'], name, from, to, args); },
43396 leaveAnyState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onleavestate'], name, from, to, args); },
43397 enterAnyState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onenterstate'] || fsm['onstate'], name, from, to, args); },
43398 changeState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onchangestate'], name, from, to, args); },
43399
43400 beforeThisEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onbefore' + name], name, from, to, args); },
43401 afterThisEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onafter' + name] || fsm['on' + name], name, from, to, args); },
43402 leaveThisState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onleave' + from], name, from, to, args); },
43403 enterThisState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onenter' + to] || fsm['on' + to], name, from, to, args); },
43404
43405 beforeEvent: function(fsm, name, from, to, args) {
43406 if ((false === StateMachine.beforeThisEvent(fsm, name, from, to, args)) ||
43407 (false === StateMachine.beforeAnyEvent( fsm, name, from, to, args)))
43408 return false;
43409 },
43410
43411 afterEvent: function(fsm, name, from, to, args) {
43412 StateMachine.afterThisEvent(fsm, name, from, to, args);
43413 StateMachine.afterAnyEvent( fsm, name, from, to, args);
43414 },
43415
43416 leaveState: function(fsm, name, from, to, args) {
43417 var specific = StateMachine.leaveThisState(fsm, name, from, to, args),
43418 general = StateMachine.leaveAnyState( fsm, name, from, to, args);
43419 if ((false === specific) || (false === general))
43420 return false;
43421 else if ((StateMachine.ASYNC === specific) || (StateMachine.ASYNC === general))
43422 return StateMachine.ASYNC;
43423 },
43424
43425 enterState: function(fsm, name, from, to, args) {
43426 StateMachine.enterThisState(fsm, name, from, to, args);
43427 StateMachine.enterAnyState( fsm, name, from, to, args);
43428 },
43429
43430 //===========================================================================
43431
43432 buildEvent: function(name, map) {
43433 return function() {
43434
43435 var from = this.current;
43436 var to = map[from] || (map[StateMachine.WILDCARD] != StateMachine.WILDCARD ? map[StateMachine.WILDCARD] : from) || from;
43437 var args = Array.prototype.slice.call(arguments); // turn arguments into pure array
43438
43439 if (this.transition)
43440 return this.error(name, from, to, args, StateMachine.Error.PENDING_TRANSITION, "event " + name + " inappropriate because previous transition did not complete");
43441
43442 if (this.cannot(name))
43443 return this.error(name, from, to, args, StateMachine.Error.INVALID_TRANSITION, "event " + name + " inappropriate in current state " + this.current);
43444
43445 if (false === StateMachine.beforeEvent(this, name, from, to, args))
43446 return StateMachine.Result.CANCELLED;
43447
43448 if (from === to) {
43449 StateMachine.afterEvent(this, name, from, to, args);
43450 return StateMachine.Result.NOTRANSITION;
43451 }
43452
43453 // 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)
43454 var fsm = this;
43455 this.transition = function() {
43456 fsm.transition = null; // this method should only ever be called once
43457 fsm.current = to;
43458 StateMachine.enterState( fsm, name, from, to, args);
43459 StateMachine.changeState(fsm, name, from, to, args);
43460 StateMachine.afterEvent( fsm, name, from, to, args);
43461 return StateMachine.Result.SUCCEEDED;
43462 };
43463 this.transition.cancel = function() { // provide a way for caller to cancel async transition if desired (issue #22)
43464 fsm.transition = null;
43465 StateMachine.afterEvent(fsm, name, from, to, args);
43466 }
43467
43468 var leave = StateMachine.leaveState(this, name, from, to, args);
43469 if (false === leave) {
43470 this.transition = null;
43471 return StateMachine.Result.CANCELLED;
43472 }
43473 else if (StateMachine.ASYNC === leave) {
43474 return StateMachine.Result.PENDING;
43475 }
43476 else {
43477 if (this.transition) // need to check in case user manually called transition() but forgot to return StateMachine.ASYNC
43478 return this.transition();
43479 }
43480
43481 };
43482 }
43483
43484 }; // StateMachine
43485
43486 //===========================================================================
43487
43488 //======
43489 // NODE
43490 //======
43491 if (true) {
43492 if (typeof module !== 'undefined' && module.exports) {
43493 exports = module.exports = StateMachine;
43494 }
43495 exports.StateMachine = StateMachine;
43496 }
43497 //============
43498 // AMD/REQUIRE
43499 //============
43500 else if (typeof define === 'function' && define.amd) {
43501 define(function(require) { return StateMachine; });
43502 }
43503 //========
43504 // BROWSER
43505 //========
43506 else if (typeof window !== 'undefined') {
43507 window.StateMachine = StateMachine;
43508 }
43509 //===========
43510 // WEB WORKER
43511 //===========
43512 else if (typeof self !== 'undefined') {
43513 self.StateMachine = StateMachine;
43514 }
43515
43516}());
43517
43518
43519/***/ }),
43520/* 661 */
43521/***/ (function(module, exports) {
43522
43523function _typeof(obj) {
43524 "@babel/helpers - typeof";
43525
43526 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
43527 module.exports = _typeof = function _typeof(obj) {
43528 return typeof obj;
43529 };
43530 } else {
43531 module.exports = _typeof = function _typeof(obj) {
43532 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
43533 };
43534 }
43535
43536 return _typeof(obj);
43537}
43538
43539module.exports = _typeof;
43540
43541/***/ }),
43542/* 662 */
43543/***/ (function(module, exports, __webpack_require__) {
43544
43545var baseGetTag = __webpack_require__(118),
43546 getPrototype = __webpack_require__(663),
43547 isObjectLike = __webpack_require__(119);
43548
43549/** `Object#toString` result references. */
43550var objectTag = '[object Object]';
43551
43552/** Used for built-in method references. */
43553var funcProto = Function.prototype,
43554 objectProto = Object.prototype;
43555
43556/** Used to resolve the decompiled source of functions. */
43557var funcToString = funcProto.toString;
43558
43559/** Used to check objects for own properties. */
43560var hasOwnProperty = objectProto.hasOwnProperty;
43561
43562/** Used to infer the `Object` constructor. */
43563var objectCtorString = funcToString.call(Object);
43564
43565/**
43566 * Checks if `value` is a plain object, that is, an object created by the
43567 * `Object` constructor or one with a `[[Prototype]]` of `null`.
43568 *
43569 * @static
43570 * @memberOf _
43571 * @since 0.8.0
43572 * @category Lang
43573 * @param {*} value The value to check.
43574 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
43575 * @example
43576 *
43577 * function Foo() {
43578 * this.a = 1;
43579 * }
43580 *
43581 * _.isPlainObject(new Foo);
43582 * // => false
43583 *
43584 * _.isPlainObject([1, 2, 3]);
43585 * // => false
43586 *
43587 * _.isPlainObject({ 'x': 0, 'y': 0 });
43588 * // => true
43589 *
43590 * _.isPlainObject(Object.create(null));
43591 * // => true
43592 */
43593function isPlainObject(value) {
43594 if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
43595 return false;
43596 }
43597 var proto = getPrototype(value);
43598 if (proto === null) {
43599 return true;
43600 }
43601 var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
43602 return typeof Ctor == 'function' && Ctor instanceof Ctor &&
43603 funcToString.call(Ctor) == objectCtorString;
43604}
43605
43606module.exports = isPlainObject;
43607
43608
43609/***/ }),
43610/* 663 */
43611/***/ (function(module, exports, __webpack_require__) {
43612
43613var overArg = __webpack_require__(276);
43614
43615/** Built-in value references. */
43616var getPrototype = overArg(Object.getPrototypeOf, Object);
43617
43618module.exports = getPrototype;
43619
43620
43621/***/ }),
43622/* 664 */
43623/***/ (function(module, exports, __webpack_require__) {
43624
43625"use strict";
43626var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
43627
43628var _interopRequireDefault = __webpack_require__(1);
43629
43630var _isIterable2 = _interopRequireDefault(__webpack_require__(665));
43631
43632var _from = _interopRequireDefault(__webpack_require__(252));
43633
43634var _set = _interopRequireDefault(__webpack_require__(264));
43635
43636var _concat = _interopRequireDefault(__webpack_require__(22));
43637
43638var _assign = _interopRequireDefault(__webpack_require__(152));
43639
43640var _map = _interopRequireDefault(__webpack_require__(35));
43641
43642var _defineProperty = _interopRequireDefault(__webpack_require__(92));
43643
43644var _typeof2 = _interopRequireDefault(__webpack_require__(73));
43645
43646(function (global, factory) {
43647 ( false ? "undefined" : (0, _typeof2.default)(exports)) === 'object' && typeof module !== 'undefined' ? factory(exports, __webpack_require__(156)) : true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(156)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
43648 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
43649 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
43650 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : (global = global || self, factory(global.AV = global.AV || {}, global.AV));
43651})(void 0, function (exports, core) {
43652 'use strict';
43653
43654 function _inheritsLoose(subClass, superClass) {
43655 subClass.prototype = Object.create(superClass.prototype);
43656 subClass.prototype.constructor = subClass;
43657 subClass.__proto__ = superClass;
43658 }
43659
43660 function _toConsumableArray(arr) {
43661 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
43662 }
43663
43664 function _arrayWithoutHoles(arr) {
43665 if (Array.isArray(arr)) {
43666 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
43667 arr2[i] = arr[i];
43668 }
43669
43670 return arr2;
43671 }
43672 }
43673
43674 function _iterableToArray(iter) {
43675 if ((0, _isIterable2.default)(Object(iter)) || Object.prototype.toString.call(iter) === "[object Arguments]") return (0, _from.default)(iter);
43676 }
43677
43678 function _nonIterableSpread() {
43679 throw new TypeError("Invalid attempt to spread non-iterable instance");
43680 }
43681 /* eslint-disable import/no-unresolved */
43682
43683
43684 if (!core.Protocals) {
43685 throw new Error('LeanCloud Realtime SDK not installed');
43686 }
43687
43688 var CommandType = core.Protocals.CommandType,
43689 GenericCommand = core.Protocals.GenericCommand,
43690 AckCommand = core.Protocals.AckCommand;
43691
43692 var warn = function warn(error) {
43693 return console.warn(error.message);
43694 };
43695
43696 var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
43697 _inheritsLoose(LiveQueryClient, _EventEmitter);
43698
43699 function LiveQueryClient(appId, subscriptionId, connection) {
43700 var _this;
43701
43702 _this = _EventEmitter.call(this) || this;
43703 _this._appId = appId;
43704 _this.id = subscriptionId;
43705 _this._connection = connection;
43706 _this._eventemitter = new core.EventEmitter();
43707 _this._querys = new _set.default();
43708 return _this;
43709 }
43710
43711 var _proto = LiveQueryClient.prototype;
43712
43713 _proto._send = function _send(cmd) {
43714 var _context;
43715
43716 var _this$_connection;
43717
43718 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
43719 args[_key - 1] = arguments[_key];
43720 }
43721
43722 return (_this$_connection = this._connection).send.apply(_this$_connection, (0, _concat.default)(_context = [(0, _assign.default)(cmd, {
43723 appId: this._appId,
43724 installationId: this.id,
43725 service: 1
43726 })]).call(_context, args));
43727 };
43728
43729 _proto._open = function _open() {
43730 return this._send(new GenericCommand({
43731 cmd: CommandType.login
43732 }));
43733 };
43734
43735 _proto.close = function close() {
43736 var _ee = this._eventemitter;
43737
43738 _ee.emit('beforeclose');
43739
43740 return this._send(new GenericCommand({
43741 cmd: CommandType.logout
43742 })).then(function () {
43743 return _ee.emit('close');
43744 });
43745 };
43746
43747 _proto.register = function register(liveQuery) {
43748 this._querys.add(liveQuery);
43749 };
43750
43751 _proto.deregister = function deregister(liveQuery) {
43752 var _this2 = this;
43753
43754 this._querys.delete(liveQuery);
43755
43756 setTimeout(function () {
43757 if (!_this2._querys.size) _this2.close().catch(warn);
43758 }, 0);
43759 };
43760
43761 _proto._dispatchCommand = function _dispatchCommand(command) {
43762 if (command.cmd !== CommandType.data) {
43763 this.emit('unhandledmessage', command);
43764 return core.Promise.resolve();
43765 }
43766
43767 return this._dispatchDataCommand(command);
43768 };
43769
43770 _proto._dispatchDataCommand = function _dispatchDataCommand(_ref) {
43771 var _ref$dataMessage = _ref.dataMessage,
43772 ids = _ref$dataMessage.ids,
43773 msg = _ref$dataMessage.msg;
43774 this.emit('message', (0, _map.default)(msg).call(msg, function (_ref2) {
43775 var data = _ref2.data;
43776 return JSON.parse(data);
43777 })); // send ack
43778
43779 var command = new GenericCommand({
43780 cmd: CommandType.ack,
43781 ackMessage: new AckCommand({
43782 ids: ids
43783 })
43784 });
43785 return this._send(command, false).catch(warn);
43786 };
43787
43788 return LiveQueryClient;
43789 }(core.EventEmitter);
43790
43791 var finalize = function finalize(callback) {
43792 return [// eslint-disable-next-line no-sequences
43793 function (value) {
43794 return callback(), value;
43795 }, function (error) {
43796 callback();
43797 throw error;
43798 }];
43799 };
43800
43801 var onRealtimeCreate = function onRealtimeCreate(realtime) {
43802 /* eslint-disable no-param-reassign */
43803 realtime._liveQueryClients = {};
43804
43805 realtime.createLiveQueryClient = function (subscriptionId) {
43806 var _realtime$_open$then;
43807
43808 if (realtime._liveQueryClients[subscriptionId] !== undefined) {
43809 return core.Promise.resolve(realtime._liveQueryClients[subscriptionId]);
43810 }
43811
43812 var promise = (_realtime$_open$then = realtime._open().then(function (connection) {
43813 var client = new LiveQueryClient(realtime._options.appId, subscriptionId, connection);
43814 connection.on('reconnect', function () {
43815 return client._open().then(function () {
43816 return client.emit('reconnect');
43817 }, function (error) {
43818 return client.emit('reconnecterror', error);
43819 });
43820 });
43821
43822 client._eventemitter.on('beforeclose', function () {
43823 delete realtime._liveQueryClients[client.id];
43824 }, realtime);
43825
43826 client._eventemitter.on('close', function () {
43827 realtime._deregister(client);
43828 }, realtime);
43829
43830 return client._open().then(function () {
43831 realtime._liveQueryClients[client.id] = client;
43832
43833 realtime._register(client);
43834
43835 return client;
43836 });
43837 })).then.apply(_realtime$_open$then, _toConsumableArray(finalize(function () {
43838 if (realtime._deregisterPending) realtime._deregisterPending(promise);
43839 })));
43840
43841 realtime._liveQueryClients[subscriptionId] = promise;
43842 if (realtime._registerPending) realtime._registerPending(promise);
43843 return promise;
43844 };
43845 /* eslint-enable no-param-reassign */
43846
43847 };
43848
43849 var beforeCommandDispatch = function beforeCommandDispatch(command, realtime) {
43850 var isLiveQueryCommand = command.installationId && command.service === 1;
43851 if (!isLiveQueryCommand) return true;
43852 var targetClient = realtime._liveQueryClients[command.installationId];
43853
43854 if (targetClient) {
43855 targetClient._dispatchCommand(command).catch(function (error) {
43856 return console.warn(error);
43857 });
43858 } else {
43859 console.warn('Unexpected message received without any live client match: %O', command);
43860 }
43861
43862 return false;
43863 }; // eslint-disable-next-line import/prefer-default-export
43864
43865
43866 var LiveQueryPlugin = {
43867 name: 'leancloud-realtime-plugin-live-query',
43868 onRealtimeCreate: onRealtimeCreate,
43869 beforeCommandDispatch: beforeCommandDispatch
43870 };
43871 exports.LiveQueryPlugin = LiveQueryPlugin;
43872 (0, _defineProperty.default)(exports, '__esModule', {
43873 value: true
43874 });
43875});
43876
43877/***/ }),
43878/* 665 */
43879/***/ (function(module, exports, __webpack_require__) {
43880
43881module.exports = __webpack_require__(666);
43882
43883/***/ }),
43884/* 666 */
43885/***/ (function(module, exports, __webpack_require__) {
43886
43887module.exports = __webpack_require__(667);
43888
43889
43890/***/ }),
43891/* 667 */
43892/***/ (function(module, exports, __webpack_require__) {
43893
43894var parent = __webpack_require__(668);
43895
43896module.exports = parent;
43897
43898
43899/***/ }),
43900/* 668 */
43901/***/ (function(module, exports, __webpack_require__) {
43902
43903var parent = __webpack_require__(669);
43904
43905module.exports = parent;
43906
43907
43908/***/ }),
43909/* 669 */
43910/***/ (function(module, exports, __webpack_require__) {
43911
43912var parent = __webpack_require__(670);
43913__webpack_require__(39);
43914
43915module.exports = parent;
43916
43917
43918/***/ }),
43919/* 670 */
43920/***/ (function(module, exports, __webpack_require__) {
43921
43922__webpack_require__(38);
43923__webpack_require__(55);
43924var isIterable = __webpack_require__(671);
43925
43926module.exports = isIterable;
43927
43928
43929/***/ }),
43930/* 671 */
43931/***/ (function(module, exports, __webpack_require__) {
43932
43933var classof = __webpack_require__(51);
43934var hasOwn = __webpack_require__(13);
43935var wellKnownSymbol = __webpack_require__(9);
43936var Iterators = __webpack_require__(50);
43937
43938var ITERATOR = wellKnownSymbol('iterator');
43939var $Object = Object;
43940
43941module.exports = function (it) {
43942 var O = $Object(it);
43943 return O[ITERATOR] !== undefined
43944 || '@@iterator' in O
43945 || hasOwn(Iterators, classof(O));
43946};
43947
43948
43949/***/ })
43950/******/ ]);
43951});
43952//# sourceMappingURL=av-live-query-weapp.js.map
\No newline at end of file